@sap-ux/fiori-mcp-server 0.0.3 → 0.0.4
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/dist/tools/functionalities/page/add-page.js +10 -1
- package/dist/tools/functionalities/page/application.d.ts +1 -2
- package/dist/tools/functionalities/page/application.js +12 -14
- package/dist/tools/functionalities/page/types.d.ts +1 -0
- package/dist/tools/functionalities/page/types.js +2 -1
- package/package.json +5 -5
|
@@ -7,6 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const constant_1 = require("../../../constant");
|
|
8
8
|
const page_editor_api_1 = require("../../../page-editor-api");
|
|
9
9
|
const src_1 = require("@sap/ux-specification/dist/types/src");
|
|
10
|
+
const types_1 = require("./types");
|
|
10
11
|
/**
|
|
11
12
|
* Retrieves the details of the Add Page functionality.
|
|
12
13
|
*
|
|
@@ -43,10 +44,18 @@ async function executeFunctionality(params) {
|
|
|
43
44
|
const parentPage = typeof parameters.parentPage === 'string' ? parameters.parentPage : undefined;
|
|
44
45
|
const entitySet = typeof parameters.entitySet === 'string' ? parameters.entitySet : undefined;
|
|
45
46
|
const pageNavigation = typeof parameters.pageNavigation === 'string' ? parameters.pageNavigation : undefined;
|
|
46
|
-
const viewName = typeof parameters.pageViewName === 'string' ? parameters.pageViewName : '
|
|
47
|
+
const viewName = typeof parameters.pageViewName === 'string' ? parameters.pageViewName : '';
|
|
47
48
|
if (!pageType) {
|
|
48
49
|
throw new Error('Missing or invalid parameter "pageType"');
|
|
49
50
|
}
|
|
51
|
+
if (pageType === src_1.PageTypeV4.CustomPage) {
|
|
52
|
+
if (!viewName) {
|
|
53
|
+
throw new Error('Missing value for parameter "pageViewName"');
|
|
54
|
+
}
|
|
55
|
+
else if (!types_1.PAGE_VIEW_NAME_PATTERN.exec(viewName)) {
|
|
56
|
+
throw new Error(`Invalid parameter "pageViewName". Parameter "pageViewName" should match pattern "${types_1.PAGE_VIEW_NAME_PATTERN.toString()}"`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
50
59
|
const appDetails = await (0, utils_1.resolveApplication)(appPath);
|
|
51
60
|
if (!appDetails?.applicationAccess) {
|
|
52
61
|
return {
|
|
@@ -181,10 +181,9 @@ export declare class Application {
|
|
|
181
181
|
/**
|
|
182
182
|
* Retrieves creation options for a new page.
|
|
183
183
|
*
|
|
184
|
-
* @param pageType - Optional page type to get specific creation options.
|
|
185
184
|
* @returns A promise that resolves to GetFunctionalityDetailsOutput containing creation options.
|
|
186
185
|
*/
|
|
187
|
-
getCreationOptions(
|
|
186
|
+
getCreationOptions(): Promise<GetFunctionalityDetailsOutput>;
|
|
188
187
|
/**
|
|
189
188
|
* Creates a new page in the application.
|
|
190
189
|
*
|
|
@@ -278,7 +278,8 @@ class Application {
|
|
|
278
278
|
id,
|
|
279
279
|
entity: targetNavigation?.entitySet ?? entitySet ?? '',
|
|
280
280
|
navigation: fpnNavigation,
|
|
281
|
-
contextPath
|
|
281
|
+
contextPath,
|
|
282
|
+
name: newPage.pageType === src_1.PageTypeV4.CustomPage ? viewName : undefined
|
|
282
283
|
};
|
|
283
284
|
const changes = await this.writeFPM(newPage.pageType, pageApi, viewName);
|
|
284
285
|
return { pageID: id, changes };
|
|
@@ -430,10 +431,9 @@ class Application {
|
|
|
430
431
|
/**
|
|
431
432
|
* Retrieves creation options for a new page.
|
|
432
433
|
*
|
|
433
|
-
* @param pageType - Optional page type to get specific creation options.
|
|
434
434
|
* @returns A promise that resolves to GetFunctionalityDetailsOutput containing creation options.
|
|
435
435
|
*/
|
|
436
|
-
async getCreationOptions(
|
|
436
|
+
async getCreationOptions() {
|
|
437
437
|
exports.ADD_PAGE_FUNCTIONALITY.parameters = [];
|
|
438
438
|
const pages = this.getPages();
|
|
439
439
|
if (pages.length) {
|
|
@@ -446,15 +446,6 @@ class Application {
|
|
|
446
446
|
// Pass with refresh only once
|
|
447
447
|
refreshNavigations = false;
|
|
448
448
|
}
|
|
449
|
-
if (pageType === src_1.PageTypeV4.CustomPage) {
|
|
450
|
-
exports.ADD_PAGE_FUNCTIONALITY.parameters.push({
|
|
451
|
-
id: 'pageViewName',
|
|
452
|
-
type: 'string',
|
|
453
|
-
description: `Name of custom view file. First try to extract view name from user input that satisfies the pattern, if not possible ask user to provide view name`,
|
|
454
|
-
pattern: '/^[a-zA-Z][a-zA-Z0-9_-]{0,}$/i',
|
|
455
|
-
required: true
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
449
|
exports.ADD_PAGE_FUNCTIONALITY.parameters = [
|
|
459
450
|
{
|
|
460
451
|
id: 'parentPage',
|
|
@@ -476,8 +467,15 @@ class Application {
|
|
|
476
467
|
id: 'pageType',
|
|
477
468
|
type: 'string',
|
|
478
469
|
description: `Type of page to be created. First try to extract page type from user input in a format defined in example, if not possible suggest content defined in options.`,
|
|
479
|
-
options:
|
|
480
|
-
examples: ['pageType: ' +
|
|
470
|
+
options: [src_1.PageTypeV4.ListReport, src_1.PageTypeV4.ObjectPage, src_1.PageTypeV4.CustomPage],
|
|
471
|
+
examples: ['pageType: ' + src_1.PageTypeV4.ObjectPage],
|
|
472
|
+
required: true
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
id: 'pageViewName',
|
|
476
|
+
type: 'string',
|
|
477
|
+
description: `Required if pageType is "CustomPage". Name of custom view file. First try to extract view name from user input that satisfies the pattern, if not possible ask user to provide view name`,
|
|
478
|
+
pattern: types_1.PAGE_VIEW_NAME_PATTERN.toString(),
|
|
481
479
|
required: true
|
|
482
480
|
}
|
|
483
481
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingNavigationReason = void 0;
|
|
3
|
+
exports.PAGE_VIEW_NAME_PATTERN = exports.MissingNavigationReason = void 0;
|
|
4
4
|
var MissingNavigationReason;
|
|
5
5
|
(function (MissingNavigationReason) {
|
|
6
6
|
MissingNavigationReason[MissingNavigationReason["NoAnyNavigationsForParent"] = 1] = "NoAnyNavigationsForParent";
|
|
@@ -8,4 +8,5 @@ var MissingNavigationReason;
|
|
|
8
8
|
MissingNavigationReason[MissingNavigationReason["NoEntityProvided"] = 3] = "NoEntityProvided";
|
|
9
9
|
MissingNavigationReason[MissingNavigationReason["NotFoundEntity"] = 4] = "NotFoundEntity";
|
|
10
10
|
})(MissingNavigationReason || (exports.MissingNavigationReason = MissingNavigationReason = {}));
|
|
11
|
+
exports.PAGE_VIEW_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
11
12
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fiori-mcp-server",
|
|
3
3
|
"description": "SAP Fiori - Model Context Protocol (MCP) server",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"SAP Fiori tools",
|
|
7
7
|
"SAP Fiori elements",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/json-schema": "7.0.5",
|
|
32
32
|
"@types/mem-fs": "1.1.2",
|
|
33
|
-
"@sap-ux/
|
|
33
|
+
"@sap-ux/text-document-utils": "0.3.1",
|
|
34
34
|
"@sap-ux/odata-entity-model": "0.3.1",
|
|
35
35
|
"@sap-ux/odata-annotation-core-types": "0.4.5",
|
|
36
|
-
"@sap-ux/
|
|
36
|
+
"@sap-ux/i18n": "0.3.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@modelcontextprotocol/sdk": "1.17.4",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@sap-ux/annotation-converter": "0.10.3",
|
|
42
42
|
"i18next": "25.3.0",
|
|
43
43
|
"zod": "4.1.5",
|
|
44
|
+
"@sap-ux/project-access": "1.30.13",
|
|
44
45
|
"@sap-ux/fiori-annotation-api": "0.6.17",
|
|
45
|
-
"@sap-ux/nodejs-utils": "0.2.3"
|
|
46
|
-
"@sap-ux/project-access": "1.30.13"
|
|
46
|
+
"@sap-ux/nodejs-utils": "0.2.3"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=20.x"
|