@babamba2/abap-mcp-adt-powerup 4.8.12 → 4.8.13
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 -1
- package/dist/handlers/smartform/high/handleCreateSmartForm.d.ts +71 -0
- package/dist/handlers/smartform/high/handleCreateSmartForm.d.ts.map +1 -0
- package/dist/handlers/smartform/high/handleCreateSmartForm.js +163 -0
- package/dist/handlers/smartform/high/handleCreateSmartForm.js.map +1 -0
- package/dist/handlers/smartform/high/handleDeleteSmartForm.d.ts +41 -0
- package/dist/handlers/smartform/high/handleDeleteSmartForm.d.ts.map +1 -0
- package/dist/handlers/smartform/high/handleDeleteSmartForm.js +76 -0
- package/dist/handlers/smartform/high/handleDeleteSmartForm.js.map +1 -0
- package/dist/handlers/system/readonly/handleGetSmartFormContent.d.ts +77 -0
- package/dist/handlers/system/readonly/handleGetSmartFormContent.d.ts.map +1 -0
- package/dist/handlers/system/readonly/handleGetSmartFormContent.js +98 -0
- package/dist/handlers/system/readonly/handleGetSmartFormContent.js.map +1 -0
- package/dist/handlers/system/readonly/handleGetSmartFormLayout.d.ts +47 -0
- package/dist/handlers/system/readonly/handleGetSmartFormLayout.d.ts.map +1 -0
- package/dist/handlers/system/readonly/handleGetSmartFormLayout.js +70 -0
- package/dist/handlers/system/readonly/handleGetSmartFormLayout.js.map +1 -0
- package/dist/handlers/system/readonly/handleRenderSmartForm.d.ts +65 -0
- package/dist/handlers/system/readonly/handleRenderSmartForm.d.ts.map +1 -0
- package/dist/handlers/system/readonly/handleRenderSmartForm.js +111 -0
- package/dist/handlers/system/readonly/handleRenderSmartForm.js.map +1 -0
- package/dist/handlers/system/readonly/runtimeFeedsHelper.d.ts +1 -1
- package/dist/handlers/system/readonly/runtimeFeedsHelper.d.ts.map +1 -1
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.js +11 -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 +15 -0
- package/dist/lib/handlers/groups/ReadOnlyHandlersGroup.js.map +1 -1
- package/dist/lib/legacyTableRead.d.ts.map +1 -1
- package/dist/lib/legacyTableRead.js +19 -9
- package/dist/lib/legacyTableRead.js.map +1 -1
- package/dist/lib/smartFormContent.d.ts +277 -0
- package/dist/lib/smartFormContent.d.ts.map +1 -0
- package/dist/lib/smartFormContent.js +1130 -0
- package/dist/lib/smartFormContent.js.map +1 -0
- package/dist/lib/smartFormLayout.d.ts +83 -0
- package/dist/lib/smartFormLayout.d.ts.map +1 -0
- package/dist/lib/smartFormLayout.js +236 -0
- package/dist/lib/smartFormLayout.js.map +1 -0
- package/dist/lib/smartFormRender.d.ts +17 -0
- package/dist/lib/smartFormRender.d.ts.map +1 -0
- package/dist/lib/smartFormRender.js +112 -0
- package/dist/lib/smartFormRender.js.map +1 -0
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/docs/user-guide/AVAILABLE_TOOLS.md +1039 -204
- package/docs/user-guide/AVAILABLE_TOOLS_COMPACT.md +2 -1
- package/docs/user-guide/AVAILABLE_TOOLS_HIGH.md +470 -85
- package/docs/user-guide/AVAILABLE_TOOLS_LEGACY.md +955 -78
- package/docs/user-guide/AVAILABLE_TOOLS_LOW.md +271 -60
- package/docs/user-guide/AVAILABLE_TOOLS_READONLY.md +299 -60
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [4.8.13] - 2026-10-20
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **`GetSmartFormLayout`** (read-only, on-premise and legacy systems): page and window layout of a SmartForm. Per page the format, orientation, next page, CPI / LPI and style; per window its type (MAIN, SECONDARY, ...), position and size as stored (value + unit) and converted to millimetres (CM, MM, IN, PT, TW, and LN / CH through the page LPI / CPI). Reads the active version (a form that was never activated is read from its saved version and `active` is false). `language` takes a 1-character SAP key or a 2-letter ISO code. Layout only: no texts, code or form interface. Runs through `ZMCP_ADT_DISPATCH` action `SSF_LAYOUT`, so it works on the OData backend (BASIS 7.40) and over SOAP RFC (BASIS 7.31). Needs the new `ZMCP_SSF_LAYOUT` FM and the `SSF_LAYOUT` dispatcher branch; without them the tool answers with an install hint.
|
|
11
|
+
- **`GetSmartFormContent`** (read-only, on-premise and legacy systems): what a SmartForm prints, for preview rendering. Per page and window (position in mm) the content tree: text nodes with their lines (paragraph format, inline character formats, `&symbols&`), include texts, templates with line heights and cells (width, border widths, shading colour), loops and tables with header / footer events, graphics, addresses, print conditions; code nodes only as markers, never program lines. Also the form interface and global data with their types (`data`), the SmartStyles as CSS, SE78 graphics with a fixed key as BMP with their printed size, and include texts with a fixed key. Everything is written under the MCP output directory (`smartforms/<form>/`, full result in `<form>.content.json`); `summary: true` answers with an overview (windows, data declarations, `&symbols&`, graphics, files) because the full tree easily exceeds a tool answer. Runs through `ZMCP_ADT_DISPATCH` action `SSF_CONTENT` (FM `ZMCP_SSF_CONTENT`).
|
|
12
|
+
- **`RenderSmartForm`** (on-premise and legacy systems): the output of a SmartForm exactly as SAP prints it, for given interface values. Calls the form's generated function module with GETOTF (no dialog, no print, no spool) and writes the OTF and the PDF under the MCP output directory (`smartforms/<form>/<form>.sap.otf.txt` / `.sap.pdf`). `values` / `values_file` take the interface in internal format; `device` or `families` choose the device type, so the output has the printer fonts the form was made for. The form's own program lines run as in a real print and may read the database — pass invented sample values only. Runs through `ZMCP_ADT_DISPATCH` action `SSF_RENDER` (FM `ZMCP_SSF_RENDER`); without them the tool answers with an install hint.
|
|
13
|
+
- **`CreateSmartForm`** (writes, on-premise and legacy systems, DEV profiles only): creates — or with `overwrite` replaces — a Z/Y SmartForm from Form Builder XML (the format of SMARTFORMS > Utilities > Download and of `GetSmartFormContent`'s form XML). The form is checked and stored active, its function module generated (also for a replaced form); when the check finds errors it is stored inactive and the errors come back. `package_name` defaults to `$TMP`; another package needs `transport_request`. The XML travels raw-deflate compressed in parts of 5000 base64 characters, because the OData `Dispatch` function import carries its parameters in the URL. Runs through `ZMCP_ADT_DISPATCH` action `SSF_UPLOAD_XML` (FM `ZMCP_SSF_UPLOAD`); without them the tool answers with an install hint.
|
|
14
|
+
- **`DeleteSmartForm`** (writes, destructive, DEV profiles only): deletes a Z/Y SmartForm of a local package (`$TMP`, `$…`) with its generated function module — a dry run unless `confirm: true`; transportable forms are refused. Runs through action `SSF_DELETE_FORM` (FM `ZMCP_SSF_DELETE`).
|
|
15
|
+
- **`GetSmartFormContent`** reads more of what decides the print:
|
|
16
|
+
- SmartStyle paragraphs and character formats as stored (value + unit, family, size, tabs), with the SE73 bar-code definition (`barcodeDef`: symbology, module, height) of bar-code formats.
|
|
17
|
+
- Table / template patterns with their outer frame flag (`frame.border`), box sides switched on with thickness 0 (`on`), and the `reference` of a template line type that takes another line's height.
|
|
18
|
+
- Styles named only in output options (template / window STDSTYLE) are read too.
|
|
19
|
+
- The device type and its printer fonts for the form's families (`printer`).
|
|
20
|
+
- Texts with no translation in the logon language are taken from the form's master language, as SAP prints them. This needs `ZMCP_SSF_CONTENT` with `IV_LANGUAGE` for the `FORM` part; an older FM keeps the logon-language texts.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- `npm run docs:tools` cut a description at the first quote of the other kind (`'… (e.g. "ZMY_FORM")'`, `"… dump's …"`): string values now end at the quote they opened with, escapes are resolved. The user-guide tool lists are regenerated with the full texts.
|
|
24
|
+
|
|
7
25
|
### Changed
|
|
8
|
-
-
|
|
26
|
+
- Dependencies updated within their major versions: `@modelcontextprotocol/sdk` 1.32.1, `axios` 1.20, `fast-xml-parser` 5.11, `zod` 4.6, `js-yaml` 4.3, `pino` 10.4, `pino-pretty` 13.2, and the dev tooling (Biome 2.5, ts-jest, tsx, express, yaml). `jest` stays on 30.2: 30.5 pulls in `@parcel/watcher`, whose install script fails under the nested `jest` tree on Windows (path over 260 characters).
|
|
9
27
|
|
|
10
28
|
## [4.8.12] - 2026-10-14
|
|
11
29
|
|
|
30
|
+
### Changed
|
|
31
|
+
- **ADT source writes on BASIS < 7.40 now explain the invalid-lock-handle failure.** Some 7.31 systems never send a `sap-contextid` cookie, so no stateful ADT session exists and the lock is gone before the write: the PUT fails with HTTP 423 `ExceptionResourceInvalidLockHandle` in every session mode. No client-side setting fixes it. The error now carries a hint that ADT source writes cannot work on that system and that the source has to be edited in SE38 / SE24 / SE37. Applies to every tool error that mentions an invalid lock handle when `ABAP_RELEASE` < 740.
|
|
32
|
+
|
|
12
33
|
### Fixed
|
|
13
34
|
- **`ReloadProfile` switched the profile but not the connection.** The stdio server kept the connection context it built at boot, so after a switch every tool still talked to the previous system until Claude Code was restarted. A profile switch now rebinds the stdio connection context and drops the RFC sessions of the previous system (SOAP / OData CSRF session, native RFC pool, ZRFC proxy session). Every `SAP_RFC_*` key of the previous profile is cleared, so a profile that does not set one no longer inherits it. The default `MCP_OUTPUT_DIR` (`.sc4sap/work/<alias>/mcp-output`) follows the new alias; a user-chosen directory is left alone. When part of the switch fails, the result is `ok: false` with `restartRequired: true` and `errors`.
|
|
14
35
|
- **`ListTransports` / `GetTransport` returned nothing on BASIS < 7.40.** The ADT transport organizer does not exist there: the list URL answers an empty body, which parsed to 0 transports. On these releases the request header, tasks and objects are read from E070 / E07T / E071 with the standard `RFC_READ_TABLE` over SOAP RFC. No custom ABAP is needed.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CreateSmartForm — create or replace a SmartForm from Form Builder XML
|
|
3
|
+
* (the format of SMARTFORMS > Utilities > Download, FB_CONVERT_FORM_TO_XML,
|
|
4
|
+
* and the `xml` that GetSmartFormContent stores).
|
|
5
|
+
*
|
|
6
|
+
* SAP side: ZMCP_ADT_DISPATCH action SSF_UPLOAD_XML → FM ZMCP_SSF_UPLOAD,
|
|
7
|
+
* which loads the XML with CL_SSF_FB_SMART_FORM->XML_UPLOAD, checks the form
|
|
8
|
+
* and stores it active (generating its function module) when the check finds
|
|
9
|
+
* no error — otherwise inactive, with the check messages in the result.
|
|
10
|
+
* Companion ABAP source: sc4sap/abap/zmcp_ssf_upload.abap
|
|
11
|
+
*/
|
|
12
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
13
|
+
export declare const SSF_UPLOAD_INSTALL_HINT: string;
|
|
14
|
+
export declare const TOOL_DEFINITION: {
|
|
15
|
+
readonly name: "CreateSmartForm";
|
|
16
|
+
readonly available_in: readonly ["onprem", "legacy"];
|
|
17
|
+
readonly description: "[writes] Create (or, with overwrite, replace) a Z/Y SmartForm from Form Builder XML — the format of SMARTFORMS > Utilities > Download. The form is checked and stored active (function module generated) when the check finds no error; otherwise it is stored inactive and the check errors are returned. SmartStyles and SE78 graphics the XML names must already exist. Needs the ZMCP_SSF_UPLOAD FM and the SSF_UPLOAD_XML dispatcher action.";
|
|
18
|
+
readonly inputSchema: {
|
|
19
|
+
readonly type: "object";
|
|
20
|
+
readonly properties: {
|
|
21
|
+
readonly form_name: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly description: "Target SmartForm name, Z* or Y* (e.g. \"ZMY_FORM\").";
|
|
24
|
+
};
|
|
25
|
+
readonly xml_file: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly description: "Path of the Form Builder XML file (UTF-8).";
|
|
28
|
+
};
|
|
29
|
+
readonly package_name: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
readonly description: "Package. Default $TMP; any other package needs transport_request.";
|
|
32
|
+
};
|
|
33
|
+
readonly transport_request: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly description: "Transport request the form is recorded in.";
|
|
36
|
+
};
|
|
37
|
+
readonly overwrite: {
|
|
38
|
+
readonly type: "boolean";
|
|
39
|
+
readonly description: "Replace the form when it exists. Default false (an existing form is refused).";
|
|
40
|
+
};
|
|
41
|
+
readonly activate: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
readonly description: "Check and store active. Default true; false stores the form inactive without a check.";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly required: readonly ["form_name", "xml_file"];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The XML as the dispatcher takes it: the OData backend carries the params in
|
|
51
|
+
* the URL (~8 KB), so the XML goes raw-deflate compressed (what CL_ABAP_GZIP
|
|
52
|
+
* reads) and base64-encoded, in parts the dispatcher joins on the last one.
|
|
53
|
+
*/
|
|
54
|
+
export declare function uploadParts(xml: Buffer, partChars?: number): string[];
|
|
55
|
+
interface CreateSmartFormArgs {
|
|
56
|
+
form_name: string;
|
|
57
|
+
xml_file: string;
|
|
58
|
+
package_name?: string;
|
|
59
|
+
transport_request?: string;
|
|
60
|
+
overwrite?: boolean;
|
|
61
|
+
activate?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare function handleCreateSmartForm(context: HandlerContext, args: CreateSmartFormArgs): Promise<{
|
|
64
|
+
isError: boolean;
|
|
65
|
+
content: {
|
|
66
|
+
type: string;
|
|
67
|
+
text: any;
|
|
68
|
+
}[];
|
|
69
|
+
}>;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=handleCreateSmartForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCreateSmartForm.d.ts","sourceRoot":"","sources":["../../../../src/handlers/smartform/high/handleCreateSmartForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAQvE,eAAO,MAAM,uBAAuB,QAGwC,CAAC;AAK7E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsClB,CAAC;AAEX;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,SAAS,SAAoB,GAC5B,MAAM,EAAE,CAMV;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,mBAAmB;;;;;;GA6D1B"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CreateSmartForm — create or replace a SmartForm from Form Builder XML
|
|
4
|
+
* (the format of SMARTFORMS > Utilities > Download, FB_CONVERT_FORM_TO_XML,
|
|
5
|
+
* and the `xml` that GetSmartFormContent stores).
|
|
6
|
+
*
|
|
7
|
+
* SAP side: ZMCP_ADT_DISPATCH action SSF_UPLOAD_XML → FM ZMCP_SSF_UPLOAD,
|
|
8
|
+
* which loads the XML with CL_SSF_FB_SMART_FORM->XML_UPLOAD, checks the form
|
|
9
|
+
* and stores it active (generating its function module) when the check finds
|
|
10
|
+
* no error — otherwise inactive, with the check messages in the result.
|
|
11
|
+
* Companion ABAP source: sc4sap/abap/zmcp_ssf_upload.abap
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.TOOL_DEFINITION = exports.SSF_UPLOAD_INSTALL_HINT = void 0;
|
|
48
|
+
exports.uploadParts = uploadParts;
|
|
49
|
+
exports.handleCreateSmartForm = handleCreateSmartForm;
|
|
50
|
+
const crypto = __importStar(require("node:crypto"));
|
|
51
|
+
const fs = __importStar(require("node:fs"));
|
|
52
|
+
const zlib = __importStar(require("node:zlib"));
|
|
53
|
+
const rfcBackend_1 = require("../../../lib/rfcBackend");
|
|
54
|
+
const utils_1 = require("../../../lib/utils");
|
|
55
|
+
exports.SSF_UPLOAD_INSTALL_HINT = 'The SAP side of CreateSmartForm is not installed on this system: it needs FM ZMCP_SSF_UPLOAD ' +
|
|
56
|
+
'(function group ZMCP_ADT_UTILS) and the SSF_UPLOAD_XML branch in ZMCP_ADT_DISPATCH. ' +
|
|
57
|
+
'Sources and install steps: sc4sap/abap/README.md (zmcp_ssf_upload.abap).';
|
|
58
|
+
/** base64 characters per dispatcher call (URL-encoded it stays below 8 KB). */
|
|
59
|
+
const UPLOAD_PART_CHARS = 5000;
|
|
60
|
+
exports.TOOL_DEFINITION = {
|
|
61
|
+
name: 'CreateSmartForm',
|
|
62
|
+
available_in: ['onprem', 'legacy'],
|
|
63
|
+
description: '[writes] Create (or, with overwrite, replace) a Z/Y SmartForm from Form Builder XML — the format of SMARTFORMS > Utilities > Download. The form is checked and stored active (function module generated) when the check finds no error; otherwise it is stored inactive and the check errors are returned. SmartStyles and SE78 graphics the XML names must already exist. Needs the ZMCP_SSF_UPLOAD FM and the SSF_UPLOAD_XML dispatcher action.',
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
67
|
+
form_name: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'Target SmartForm name, Z* or Y* (e.g. "ZMY_FORM").',
|
|
70
|
+
},
|
|
71
|
+
xml_file: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: 'Path of the Form Builder XML file (UTF-8).',
|
|
74
|
+
},
|
|
75
|
+
package_name: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Package. Default $TMP; any other package needs transport_request.',
|
|
78
|
+
},
|
|
79
|
+
transport_request: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description: 'Transport request the form is recorded in.',
|
|
82
|
+
},
|
|
83
|
+
overwrite: {
|
|
84
|
+
type: 'boolean',
|
|
85
|
+
description: 'Replace the form when it exists. Default false (an existing form is refused).',
|
|
86
|
+
},
|
|
87
|
+
activate: {
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
description: 'Check and store active. Default true; false stores the form inactive without a check.',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
required: ['form_name', 'xml_file'],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The XML as the dispatcher takes it: the OData backend carries the params in
|
|
97
|
+
* the URL (~8 KB), so the XML goes raw-deflate compressed (what CL_ABAP_GZIP
|
|
98
|
+
* reads) and base64-encoded, in parts the dispatcher joins on the last one.
|
|
99
|
+
*/
|
|
100
|
+
function uploadParts(xml, partChars = UPLOAD_PART_CHARS) {
|
|
101
|
+
const b64 = zlib.deflateRawSync(xml).toString('base64');
|
|
102
|
+
const parts = [];
|
|
103
|
+
for (let i = 0; i < b64.length; i += partChars)
|
|
104
|
+
parts.push(b64.slice(i, i + partChars));
|
|
105
|
+
return parts.length ? parts : [''];
|
|
106
|
+
}
|
|
107
|
+
async function handleCreateSmartForm(context, args) {
|
|
108
|
+
const { connection, logger } = context;
|
|
109
|
+
try {
|
|
110
|
+
const formName = String(args?.form_name ?? '')
|
|
111
|
+
.trim()
|
|
112
|
+
.toUpperCase();
|
|
113
|
+
if (!/^[ZY]/.test(formName))
|
|
114
|
+
return (0, utils_1.return_error)(new Error('form_name must start with Z or Y'));
|
|
115
|
+
if (!args?.xml_file)
|
|
116
|
+
return (0, utils_1.return_error)(new Error('xml_file is required'));
|
|
117
|
+
const xml = fs.readFileSync(args.xml_file);
|
|
118
|
+
const devclass = (args.package_name ?? '').trim().toUpperCase() || '$TMP';
|
|
119
|
+
if (!devclass.startsWith('$') && !args.transport_request)
|
|
120
|
+
return (0, utils_1.return_error)(new Error(`package ${devclass} needs transport_request`));
|
|
121
|
+
logger?.info(`CreateSmartForm: ${formName} (${devclass})`);
|
|
122
|
+
const parts = uploadParts(xml);
|
|
123
|
+
const uploadId = crypto.randomBytes(6).toString('hex').toUpperCase();
|
|
124
|
+
let resp;
|
|
125
|
+
try {
|
|
126
|
+
for (let p = 0; p < parts.length; p++)
|
|
127
|
+
resp = await (0, rfcBackend_1.callDispatch)(connection, 'SSF_UPLOAD_XML', {
|
|
128
|
+
form_name: formName,
|
|
129
|
+
xml: parts[p],
|
|
130
|
+
gzip: 'X',
|
|
131
|
+
upload_id: uploadId,
|
|
132
|
+
part: p + 1,
|
|
133
|
+
parts: parts.length,
|
|
134
|
+
devclass,
|
|
135
|
+
transport: (args.transport_request ?? '').trim().toUpperCase(),
|
|
136
|
+
overwrite: args.overwrite ? 'X' : '',
|
|
137
|
+
activate: args.activate === false ? '-' : 'X',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
142
|
+
if (/Unknown action:\s*SSF_UPLOAD_XML/i.test(msg) ||
|
|
143
|
+
/ZMCP_SSF_UPLOAD[\s\S]*not found/i.test(msg))
|
|
144
|
+
throw new Error(`${exports.SSF_UPLOAD_INSTALL_HINT} (SAP said: ${msg})`);
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
// callDispatch throws on subrc <> 0; a form stored inactive because the
|
|
148
|
+
// check failed comes back with subrc 0, active = false and the errors
|
|
149
|
+
const { result, message } = resp ?? {};
|
|
150
|
+
return (0, utils_1.return_response)({
|
|
151
|
+
data: JSON.stringify({
|
|
152
|
+
...(typeof result === 'object' ? result : {}),
|
|
153
|
+
message: message || undefined,
|
|
154
|
+
}, null, 2),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
159
|
+
logger?.error(`CreateSmartForm error: ${errorMessage}`);
|
|
160
|
+
return (0, utils_1.return_error)(new Error(errorMessage));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=handleCreateSmartForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCreateSmartForm.js","sourceRoot":"","sources":["../../../../src/handlers/smartform/high/handleCreateSmartForm.ts"],"names":[],"mappings":";AAAA;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MAAM,KAAK,CAAC;QACd,CAAC;QACD,wEAAwE;QACxE,sEAAsE;QACtE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;QACvC,OAAO,IAAA,uBAAe,EAAC;YACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;gBACE,GAAG,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7C,OAAO,EAAE,OAAO,IAAI,SAAS;aAC9B,EACD,IAAI,EACJ,CAAC,CACF;SACe,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,EAAE,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;QACxD,OAAO,IAAA,oBAAY,EAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeleteSmartForm — delete a local Z/Y SmartForm (form, generated function
|
|
3
|
+
* module, TADIR entry). Dry run unless `confirm` is true.
|
|
4
|
+
*
|
|
5
|
+
* SAP side: ZMCP_ADT_DISPATCH action SSF_DELETE_FORM → FM ZMCP_SSF_DELETE.
|
|
6
|
+
* Only forms in a local package ($…) are deleted; a transportable form is
|
|
7
|
+
* refused (its deletion belongs on a transport — use SMARTFORMS).
|
|
8
|
+
* Companion ABAP source: sc4sap/abap/zmcp_ssf_delete.abap
|
|
9
|
+
*/
|
|
10
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
11
|
+
export declare const SSF_DELETE_INSTALL_HINT: string;
|
|
12
|
+
export declare const TOOL_DEFINITION: {
|
|
13
|
+
readonly name: "DeleteSmartForm";
|
|
14
|
+
readonly available_in: readonly ["onprem", "legacy"];
|
|
15
|
+
readonly description: "[writes, destructive] Delete a Z/Y SmartForm of a local package ($TMP, $…) with its generated function module. Without confirm: true only reports what would be deleted (dry run). Transportable forms are refused. Needs the ZMCP_SSF_DELETE FM and the SSF_DELETE_FORM dispatcher action.";
|
|
16
|
+
readonly inputSchema: {
|
|
17
|
+
readonly type: "object";
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly form_name: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "SmartForm name, Z* or Y*.";
|
|
22
|
+
};
|
|
23
|
+
readonly confirm: {
|
|
24
|
+
readonly type: "boolean";
|
|
25
|
+
readonly description: "true = really delete. Default false (dry run).";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly required: readonly ["form_name"];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare function handleDeleteSmartForm(context: HandlerContext, args: {
|
|
32
|
+
form_name: string;
|
|
33
|
+
confirm?: boolean;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
isError: boolean;
|
|
36
|
+
content: {
|
|
37
|
+
type: string;
|
|
38
|
+
text: any;
|
|
39
|
+
}[];
|
|
40
|
+
}>;
|
|
41
|
+
//# sourceMappingURL=handleDeleteSmartForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeleteSmartForm.d.ts","sourceRoot":"","sources":["../../../../src/handlers/smartform/high/handleDeleteSmartForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAQvE,eAAO,MAAM,uBAAuB,QAGwC,CAAC;AAE7E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAmBlB,CAAC;AAEX,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;GA0C/C"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DeleteSmartForm — delete a local Z/Y SmartForm (form, generated function
|
|
4
|
+
* module, TADIR entry). Dry run unless `confirm` is true.
|
|
5
|
+
*
|
|
6
|
+
* SAP side: ZMCP_ADT_DISPATCH action SSF_DELETE_FORM → FM ZMCP_SSF_DELETE.
|
|
7
|
+
* Only forms in a local package ($…) are deleted; a transportable form is
|
|
8
|
+
* refused (its deletion belongs on a transport — use SMARTFORMS).
|
|
9
|
+
* Companion ABAP source: sc4sap/abap/zmcp_ssf_delete.abap
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TOOL_DEFINITION = exports.SSF_DELETE_INSTALL_HINT = void 0;
|
|
13
|
+
exports.handleDeleteSmartForm = handleDeleteSmartForm;
|
|
14
|
+
const rfcBackend_1 = require("../../../lib/rfcBackend");
|
|
15
|
+
const utils_1 = require("../../../lib/utils");
|
|
16
|
+
exports.SSF_DELETE_INSTALL_HINT = 'The SAP side of DeleteSmartForm is not installed on this system: it needs FM ZMCP_SSF_DELETE ' +
|
|
17
|
+
'(function group ZMCP_ADT_UTILS) and the SSF_DELETE_FORM branch in ZMCP_ADT_DISPATCH. ' +
|
|
18
|
+
'Sources and install steps: sc4sap/abap/README.md (zmcp_ssf_delete.abap).';
|
|
19
|
+
exports.TOOL_DEFINITION = {
|
|
20
|
+
name: 'DeleteSmartForm',
|
|
21
|
+
available_in: ['onprem', 'legacy'],
|
|
22
|
+
description: '[writes, destructive] Delete a Z/Y SmartForm of a local package ($TMP, $…) with its generated function module. Without confirm: true only reports what would be deleted (dry run). Transportable forms are refused. Needs the ZMCP_SSF_DELETE FM and the SSF_DELETE_FORM dispatcher action.',
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
form_name: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'SmartForm name, Z* or Y*.',
|
|
29
|
+
},
|
|
30
|
+
confirm: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
description: 'true = really delete. Default false (dry run).',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ['form_name'],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
async function handleDeleteSmartForm(context, args) {
|
|
39
|
+
const { connection, logger } = context;
|
|
40
|
+
try {
|
|
41
|
+
const formName = String(args?.form_name ?? '')
|
|
42
|
+
.trim()
|
|
43
|
+
.toUpperCase();
|
|
44
|
+
if (!/^[ZY]/.test(formName))
|
|
45
|
+
return (0, utils_1.return_error)(new Error('form_name must start with Z or Y'));
|
|
46
|
+
const confirm = args?.confirm === true;
|
|
47
|
+
logger?.info(`DeleteSmartForm: ${formName} (confirm=${confirm})`);
|
|
48
|
+
let resp;
|
|
49
|
+
try {
|
|
50
|
+
resp = await (0, rfcBackend_1.callDispatch)(connection, 'SSF_DELETE_FORM', {
|
|
51
|
+
form_name: formName,
|
|
52
|
+
confirm: confirm ? 'X' : '',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
57
|
+
if (/Unknown action:\s*SSF_DELETE_FORM/i.test(msg) ||
|
|
58
|
+
/ZMCP_SSF_DELETE[\s\S]*not found/i.test(msg))
|
|
59
|
+
throw new Error(`${exports.SSF_DELETE_INSTALL_HINT} (SAP said: ${msg})`);
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
const { result, message } = resp ?? {};
|
|
63
|
+
return (0, utils_1.return_response)({
|
|
64
|
+
data: JSON.stringify({
|
|
65
|
+
...(typeof result === 'object' ? result : {}),
|
|
66
|
+
message: message || undefined,
|
|
67
|
+
}, null, 2),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
72
|
+
logger?.error(`DeleteSmartForm error: ${errorMessage}`);
|
|
73
|
+
return (0, utils_1.return_error)(new Error(errorMessage));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=handleDeleteSmartForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeleteSmartForm.js","sourceRoot":"","sources":["../../../../src/handlers/smartform/high/handleDeleteSmartForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAoCH,sDA4CC;AA7ED,wDAAuD;AACvD,8CAI4B;AAEf,QAAA,uBAAuB,GAClC,+FAA+F;IAC/F,uFAAuF;IACvF,0EAA0E,CAAC;AAEhE,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,iBAAiB;IACvB,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAU;IAC3C,WAAW,EACT,6RAA6R;IAC/R,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2BAA2B;aACzC;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,gDAAgD;aAC9D;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACO,CAAC;AAEJ,KAAK,UAAU,qBAAqB,CACzC,OAAuB,EACvB,IAA8C;IAE9C,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;aAC3C,IAAI,EAAE;aACN,WAAW,EAAE,CAAC;QACjB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YACzB,OAAO,IAAA,oBAAY,EAAC,IAAI,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AC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,EAAE,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;QACxD,OAAO,IAAA,oBAAY,EAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GetSmartFormContent — read-only: what each window of a SmartForm prints.
|
|
3
|
+
*
|
|
4
|
+
* Source: the Form Builder XML of the active version (FB_CONVERT_FORM_TO_XML,
|
|
5
|
+
* the same XML as SMARTFORMS > Utilities > Download), parsed into pages →
|
|
6
|
+
* windows → content nodes. Styles (CSS), SE78 graphics (BMP) and include
|
|
7
|
+
* texts with a fixed key are fetched too and written as files under the MCP
|
|
8
|
+
* output directory. Program lines (code nodes, global coding) are never
|
|
9
|
+
* returned — a code node only shows up as a marker.
|
|
10
|
+
*
|
|
11
|
+
* Backend: ZMCP_ADT_DISPATCH action SSF_CONTENT through callDispatch, so it
|
|
12
|
+
* runs on the OData backend (BASIS 7.40) and on SOAP RFC (BASIS 7.31) alike.
|
|
13
|
+
*
|
|
14
|
+
* Companion ABAP sources: sc4sap/abap/zmcp_ssf_content.abap and
|
|
15
|
+
* sc4sap/abap/zmcp_adt_dispatch_ssf_content_branch.abap
|
|
16
|
+
*/
|
|
17
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
18
|
+
export declare const TOOL_DEFINITION: {
|
|
19
|
+
readonly name: "GetSmartFormContent";
|
|
20
|
+
readonly available_in: readonly ["onprem", "legacy"];
|
|
21
|
+
readonly description: "[read-only] Read what a SmartForm prints, for a preview: per page and window (position in mm) the content tree — text nodes with their lines (paragraph format + text with inline tags and &symbols&), include texts, tables / templates / loops with line types and cells, graphics, addresses, conditions; code nodes appear only as markers (no program lines). Also fetches the SmartStyles as CSS, the SE78 graphics with a fixed key as BMP files (with printed size) and the include texts with a fixed key. Graphics / texts whose key holds a &symbol& are listed under dynamicReferences. Active version, texts in the logon language. Files go under the MCP output directory (smartforms/<form>/), including <form>.content.json with the full result; summary=true answers with an overview (windows, data declarations, &symbols&, files) instead of the content tree. Needs the ZMCP_SSF_CONTENT FM and the SSF_CONTENT dispatcher action.";
|
|
22
|
+
readonly inputSchema: {
|
|
23
|
+
readonly type: "object";
|
|
24
|
+
readonly properties: {
|
|
25
|
+
readonly form_name: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly description: "SmartForm name (e.g. \"ZMY_FORM\").";
|
|
28
|
+
};
|
|
29
|
+
readonly include_graphics: {
|
|
30
|
+
readonly type: "boolean";
|
|
31
|
+
readonly description: "Fetch SE78 graphics with a fixed key as BMP files. Default true.";
|
|
32
|
+
};
|
|
33
|
+
readonly include_styles: {
|
|
34
|
+
readonly type: "boolean";
|
|
35
|
+
readonly description: "Fetch the SmartStyles (form default + text node styles) as CSS. Default true.";
|
|
36
|
+
};
|
|
37
|
+
readonly include_texts: {
|
|
38
|
+
readonly type: "boolean";
|
|
39
|
+
readonly description: "Fetch include texts (SO10) with a fixed key. Default true.";
|
|
40
|
+
};
|
|
41
|
+
readonly summary: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
readonly description: "Answer with an overview (windows, data declarations, &symbols&, graphics, files) instead of the full content tree; the full result is always written to files.content. Default false.";
|
|
44
|
+
};
|
|
45
|
+
readonly values: {
|
|
46
|
+
readonly type: "object";
|
|
47
|
+
readonly description: "Sample values for &symbols& in graphic keys (e.g. {\"IM_SIGN\": \"ZSIGN\"}): graphics named by a variable are then fetched too.";
|
|
48
|
+
};
|
|
49
|
+
readonly device: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly description: "Output device whose printer fonts the preview should assume. Default: a device whose type has fonts for most of the families of the form.";
|
|
52
|
+
};
|
|
53
|
+
readonly text_language: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
readonly description: "Language for include texts whose key has no language: 1-char SAP key (e.g. \"3\") or 2-letter ISO code (e.g. \"KO\"). Default: the form language.";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly required: readonly ["form_name"];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export declare function handleGetSmartFormContent(context: HandlerContext, args: {
|
|
62
|
+
form_name: string;
|
|
63
|
+
include_graphics?: boolean;
|
|
64
|
+
include_styles?: boolean;
|
|
65
|
+
include_texts?: boolean;
|
|
66
|
+
summary?: boolean;
|
|
67
|
+
text_language?: string;
|
|
68
|
+
device?: string;
|
|
69
|
+
values?: Record<string, string>;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
isError: boolean;
|
|
72
|
+
content: {
|
|
73
|
+
type: string;
|
|
74
|
+
text: any;
|
|
75
|
+
}[];
|
|
76
|
+
}>;
|
|
77
|
+
//# sourceMappingURL=handleGetSmartFormContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGetSmartFormContent.d.ts","sourceRoot":"","sources":["../../../../src/handlers/system/readonly/handleGetSmartFormContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAWvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDlB,CAAC;AAEX,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;;;;;;GAsCF"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GetSmartFormContent — read-only: what each window of a SmartForm prints.
|
|
4
|
+
*
|
|
5
|
+
* Source: the Form Builder XML of the active version (FB_CONVERT_FORM_TO_XML,
|
|
6
|
+
* the same XML as SMARTFORMS > Utilities > Download), parsed into pages →
|
|
7
|
+
* windows → content nodes. Styles (CSS), SE78 graphics (BMP) and include
|
|
8
|
+
* texts with a fixed key are fetched too and written as files under the MCP
|
|
9
|
+
* output directory. Program lines (code nodes, global coding) are never
|
|
10
|
+
* returned — a code node only shows up as a marker.
|
|
11
|
+
*
|
|
12
|
+
* Backend: ZMCP_ADT_DISPATCH action SSF_CONTENT through callDispatch, so it
|
|
13
|
+
* runs on the OData backend (BASIS 7.40) and on SOAP RFC (BASIS 7.31) alike.
|
|
14
|
+
*
|
|
15
|
+
* Companion ABAP sources: sc4sap/abap/zmcp_ssf_content.abap and
|
|
16
|
+
* sc4sap/abap/zmcp_adt_dispatch_ssf_content_branch.abap
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.TOOL_DEFINITION = void 0;
|
|
20
|
+
exports.handleGetSmartFormContent = handleGetSmartFormContent;
|
|
21
|
+
const smartFormContent_1 = require("../../../lib/smartFormContent");
|
|
22
|
+
const utils_1 = require("../../../lib/utils");
|
|
23
|
+
exports.TOOL_DEFINITION = {
|
|
24
|
+
name: 'GetSmartFormContent',
|
|
25
|
+
available_in: ['onprem', 'legacy'],
|
|
26
|
+
description: '[read-only] Read what a SmartForm prints, for a preview: per page and window (position in mm) the content tree — text nodes with their lines (paragraph format + text with inline tags and &symbols&), include texts, tables / templates / loops with line types and cells, graphics, addresses, conditions; code nodes appear only as markers (no program lines). Also fetches the SmartStyles as CSS, the SE78 graphics with a fixed key as BMP files (with printed size) and the include texts with a fixed key. Graphics / texts whose key holds a &symbol& are listed under dynamicReferences. Active version, texts in the logon language. Files go under the MCP output directory (smartforms/<form>/), including <form>.content.json with the full result; summary=true answers with an overview (windows, data declarations, &symbols&, files) instead of the content tree. Needs the ZMCP_SSF_CONTENT FM and the SSF_CONTENT dispatcher action.',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
form_name: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'SmartForm name (e.g. "ZMY_FORM").',
|
|
33
|
+
},
|
|
34
|
+
include_graphics: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
description: 'Fetch SE78 graphics with a fixed key as BMP files. Default true.',
|
|
37
|
+
},
|
|
38
|
+
include_styles: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
description: 'Fetch the SmartStyles (form default + text node styles) as CSS. Default true.',
|
|
41
|
+
},
|
|
42
|
+
include_texts: {
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
description: 'Fetch include texts (SO10) with a fixed key. Default true.',
|
|
45
|
+
},
|
|
46
|
+
summary: {
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
description: 'Answer with an overview (windows, data declarations, &symbols&, graphics, files) instead of the full content tree; the full result is always written to files.content. Default false.',
|
|
49
|
+
},
|
|
50
|
+
values: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
description: 'Sample values for &symbols& in graphic keys (e.g. {"IM_SIGN": "ZSIGN"}): graphics named by a variable are then fetched too.',
|
|
53
|
+
},
|
|
54
|
+
device: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'Output device whose printer fonts the preview should assume. Default: a device whose type has fonts for most of the families of the form.',
|
|
57
|
+
},
|
|
58
|
+
text_language: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'Language for include texts whose key has no language: 1-char SAP key (e.g. "3") or 2-letter ISO code (e.g. "KO"). Default: the form language.',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
required: ['form_name'],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
async function handleGetSmartFormContent(context, args) {
|
|
67
|
+
const { connection, logger } = context;
|
|
68
|
+
try {
|
|
69
|
+
const formName = String(args?.form_name ?? '')
|
|
70
|
+
.trim()
|
|
71
|
+
.toUpperCase();
|
|
72
|
+
if (!formName) {
|
|
73
|
+
return (0, utils_1.return_error)(new Error('form_name is required'));
|
|
74
|
+
}
|
|
75
|
+
logger?.info(`GetSmartFormContent: ${formName}`);
|
|
76
|
+
const content = await (0, smartFormContent_1.getSmartFormContent)(connection, formName, {
|
|
77
|
+
includeGraphics: args?.include_graphics,
|
|
78
|
+
includeStyles: args?.include_styles,
|
|
79
|
+
includeTexts: args?.include_texts,
|
|
80
|
+
textLanguage: args?.text_language
|
|
81
|
+
? String(args.text_language).trim()
|
|
82
|
+
: undefined,
|
|
83
|
+
device: args?.device ? String(args.device).trim() : undefined,
|
|
84
|
+
values: args?.values && typeof args.values === 'object'
|
|
85
|
+
? args.values
|
|
86
|
+
: undefined,
|
|
87
|
+
});
|
|
88
|
+
return (0, utils_1.return_response)({
|
|
89
|
+
data: JSON.stringify(args?.summary ? (0, smartFormContent_1.summarizeSmartFormContent)(content) : content, null, 2),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
94
|
+
logger?.error(`GetSmartFormContent error: ${errorMessage}`);
|
|
95
|
+
return (0, utils_1.return_error)(new Error(errorMessage));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=handleGetSmartFormContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGetSmartFormContent.js","sourceRoot":"","sources":["../../../../src/handlers/system/readonly/handleGetSmartFormContent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAiEH,8DAiDC;AA/GD,oEAGuC;AACvC,8CAI4B;AAEf,QAAA,eAAe,GAAG;IAC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