@sap-ux/fiori-mcp-server 0.0.2 → 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/constant.d.ts +1 -0
- package/dist/constant.js +2 -1
- package/dist/tools/functionalities/controller-extension/index.js +2 -1
- package/dist/tools/functionalities/functionalities.js +5 -4
- 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/dist/tools/get-functionality-details.d.ts +2 -2
- package/dist/tools/output-schema/get-functionality-details.json +29 -5
- package/dist/types.d.ts +10 -6
- package/package.json +6 -6
package/dist/constant.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export declare const LATEST_UI5_VERSION = "1.136.7";
|
|
|
2
2
|
export declare const GENERATE_FIORI_UI_APP_ID = "generate-fiori-ui-app";
|
|
3
3
|
export declare const ADD_PAGE = "add-page";
|
|
4
4
|
export declare const DELETE_PAGE = "delete-page";
|
|
5
|
+
export declare const CREATE_CONTROLLER_EXTENSION_FUNCTIONALITY_ID = "create-controller-extension";
|
|
5
6
|
//# sourceMappingURL=constant.d.ts.map
|
package/dist/constant.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DELETE_PAGE = exports.ADD_PAGE = exports.GENERATE_FIORI_UI_APP_ID = exports.LATEST_UI5_VERSION = void 0;
|
|
3
|
+
exports.CREATE_CONTROLLER_EXTENSION_FUNCTIONALITY_ID = exports.DELETE_PAGE = exports.ADD_PAGE = exports.GENERATE_FIORI_UI_APP_ID = exports.LATEST_UI5_VERSION = void 0;
|
|
4
4
|
exports.LATEST_UI5_VERSION = '1.136.7';
|
|
5
5
|
exports.GENERATE_FIORI_UI_APP_ID = 'generate-fiori-ui-app';
|
|
6
6
|
exports.ADD_PAGE = 'add-page';
|
|
7
7
|
exports.DELETE_PAGE = 'delete-page';
|
|
8
|
+
exports.CREATE_CONTROLLER_EXTENSION_FUNCTIONALITY_ID = 'create-controller-extension';
|
|
8
9
|
//# sourceMappingURL=constant.js.map
|
|
@@ -5,6 +5,7 @@ const src_1 = require("@sap/ux-specification/dist/types/src");
|
|
|
5
5
|
const page_editor_api_1 = require("../../../page-editor-api");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const path_1 = require("path");
|
|
8
|
+
const constant_1 = require("../../../constant");
|
|
8
9
|
/**
|
|
9
10
|
* Retrieves the parameter definitions for creating a controller extension.
|
|
10
11
|
*
|
|
@@ -34,7 +35,7 @@ function getParameters() {
|
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
exports.CREATE_CONTROLLER_EXTENSION_FUNCTIONALITY = {
|
|
37
|
-
functionalityId:
|
|
38
|
+
functionalityId: constant_1.CREATE_CONTROLLER_EXTENSION_FUNCTIONALITY_ID,
|
|
38
39
|
name: 'Add new controller extension by creating javascript or typescript file and updates manifest.json with entry',
|
|
39
40
|
description: 'Add new controller extension by creating javascript or typescript file and updates manifest.json with entry. Controller extensions allow users to extensiate default behaviour with custom controllers code.',
|
|
40
41
|
parameters: Object.values(getParameters())
|
|
@@ -4,6 +4,7 @@ exports.FUNCTIONALITIES_HANDLERS = exports.FUNCTIONALITIES_DETAILS = void 0;
|
|
|
4
4
|
const page_1 = require("./page");
|
|
5
5
|
const controller_extension_1 = require("./controller-extension");
|
|
6
6
|
const generate_fiori_ui_app_1 = require("./generate-fiori-ui-app");
|
|
7
|
+
const constant_1 = require("../../constant");
|
|
7
8
|
exports.FUNCTIONALITIES_DETAILS = [
|
|
8
9
|
page_1.ADD_PAGE_FUNCTIONALITY,
|
|
9
10
|
generate_fiori_ui_app_1.GENERATE_FIORI_UI_APP,
|
|
@@ -11,9 +12,9 @@ exports.FUNCTIONALITIES_DETAILS = [
|
|
|
11
12
|
controller_extension_1.CREATE_CONTROLLER_EXTENSION_FUNCTIONALITY
|
|
12
13
|
];
|
|
13
14
|
exports.FUNCTIONALITIES_HANDLERS = new Map([
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
15
|
+
[constant_1.ADD_PAGE, page_1.addPageHandlers],
|
|
16
|
+
[constant_1.DELETE_PAGE, page_1.deletePageHandlers],
|
|
17
|
+
[constant_1.GENERATE_FIORI_UI_APP_ID, generate_fiori_ui_app_1.generateFioriUIAppHandlers],
|
|
18
|
+
[constant_1.CREATE_CONTROLLER_EXTENSION_FUNCTIONALITY_ID, controller_extension_1.createControllerExtensionHandlers]
|
|
18
19
|
]);
|
|
19
20
|
//# sourceMappingURL=functionalities.js.map
|
|
@@ -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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetFunctionalityDetailsInput, GetFunctionalityDetailsOutput } from '../types';
|
|
1
|
+
import type { FunctionalityId, GetFunctionalityDetailsInput, GetFunctionalityDetailsOutput } from '../types';
|
|
2
2
|
import type { PropertyPath } from '../page-editor-api';
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves functionality details based on the provided input parameters.
|
|
@@ -17,7 +17,7 @@ export declare function getFunctionalityDetails(params: GetFunctionalityDetailsI
|
|
|
17
17
|
* @returns An object containing the resolved page name (if applicable) and property path.
|
|
18
18
|
* @throws Error if the functionalityId parameter has an invalid format.
|
|
19
19
|
*/
|
|
20
|
-
export declare function resolveFunctionality(functionalityId:
|
|
20
|
+
export declare function resolveFunctionality(functionalityId: FunctionalityId): {
|
|
21
21
|
pageName?: string;
|
|
22
22
|
propertyPath: PropertyPath;
|
|
23
23
|
};
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"properties": {
|
|
4
4
|
"functionalityId": {
|
|
5
5
|
"anyOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
6
9
|
{
|
|
7
10
|
"type": "array",
|
|
8
11
|
"items": {
|
|
9
12
|
"type": ["string", "number"]
|
|
10
13
|
}
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"type": "string"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"description": "Identifier to pass as the `functionalityId` parameter when calling `get-functionality-details` or `execute-functionality`"
|
|
@@ -61,11 +61,23 @@
|
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"not": {}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "null"
|
|
64
67
|
}
|
|
65
68
|
]
|
|
66
69
|
}
|
|
67
70
|
},
|
|
68
71
|
"currentValue": {},
|
|
72
|
+
"examples": {
|
|
73
|
+
"type": "array",
|
|
74
|
+
"items": {
|
|
75
|
+
"type": "string"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"pattern": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
69
81
|
"parameters": {
|
|
70
82
|
"type": "array",
|
|
71
83
|
"items": {
|
|
@@ -103,11 +115,23 @@
|
|
|
103
115
|
},
|
|
104
116
|
{
|
|
105
117
|
"not": {}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"type": "null"
|
|
106
121
|
}
|
|
107
122
|
]
|
|
108
123
|
}
|
|
109
124
|
},
|
|
110
|
-
"currentValue": {}
|
|
125
|
+
"currentValue": {},
|
|
126
|
+
"examples": {
|
|
127
|
+
"type": "array",
|
|
128
|
+
"items": {
|
|
129
|
+
"type": "string"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"pattern": {
|
|
133
|
+
"type": "string"
|
|
134
|
+
}
|
|
111
135
|
},
|
|
112
136
|
"required": ["id", "type"],
|
|
113
137
|
"additionalProperties": false
|
|
@@ -137,6 +161,6 @@
|
|
|
137
161
|
"type": "string"
|
|
138
162
|
}
|
|
139
163
|
},
|
|
140
|
-
"required": ["
|
|
164
|
+
"required": ["functionalityId", "name", "description", "parameters"],
|
|
141
165
|
"additionalProperties": false
|
|
142
166
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -39,14 +39,14 @@ export interface GetFunctionalityDetailsInput {
|
|
|
39
39
|
/** Path to the Fiori application */
|
|
40
40
|
appPath: string;
|
|
41
41
|
/** ID or array of IDs of the functionality(ies) */
|
|
42
|
-
functionalityId:
|
|
42
|
+
functionalityId: FunctionalityId;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Output interface for the 'get-functionality-details' functionality
|
|
46
46
|
*/
|
|
47
47
|
export interface GetFunctionalityDetailsOutput {
|
|
48
48
|
/** ID of the functionality */
|
|
49
|
-
functionalityId:
|
|
49
|
+
functionalityId: FunctionalityId;
|
|
50
50
|
/** Name of the functionality */
|
|
51
51
|
name: string;
|
|
52
52
|
/** Description of the functionality */
|
|
@@ -69,7 +69,7 @@ export interface GetFunctionalityDetailsOutput {
|
|
|
69
69
|
*/
|
|
70
70
|
export interface ExecuteFunctionalitiesInput {
|
|
71
71
|
/** ID or array of IDs of the functionality(ies) to execute */
|
|
72
|
-
functionalityId:
|
|
72
|
+
functionalityId: FunctionalityId;
|
|
73
73
|
/** Parameters for the functionality execution */
|
|
74
74
|
parameters: {
|
|
75
75
|
[key: string]: unknown;
|
|
@@ -82,7 +82,7 @@ export interface ExecuteFunctionalitiesInput {
|
|
|
82
82
|
*/
|
|
83
83
|
export interface ExecuteFunctionalityOutput {
|
|
84
84
|
/** ID or array of IDs of the executed functionality(ies) */
|
|
85
|
-
functionalityId:
|
|
85
|
+
functionalityId: FunctionalityId;
|
|
86
86
|
/** Status of the execution */
|
|
87
87
|
status: string;
|
|
88
88
|
/** Message describing the execution result */
|
|
@@ -116,10 +116,14 @@ export interface FioriApp {
|
|
|
116
116
|
*/
|
|
117
117
|
export interface Functionality {
|
|
118
118
|
/** ID or array of IDs for the functionality */
|
|
119
|
-
functionalityId:
|
|
119
|
+
functionalityId: FunctionalityId;
|
|
120
120
|
/** Description of the functionality */
|
|
121
121
|
description: string;
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Type for functionality id
|
|
125
|
+
*/
|
|
126
|
+
export type FunctionalityId = Array<string | number> | string;
|
|
123
127
|
/**
|
|
124
128
|
* Interface representing a parameter
|
|
125
129
|
*/
|
|
@@ -137,7 +141,7 @@ export interface Parameter {
|
|
|
137
141
|
/** Default value of the parameter */
|
|
138
142
|
defaultValue?: unknown;
|
|
139
143
|
/** Possible options for the parameter */
|
|
140
|
-
options?: Array<string | number | boolean | undefined>;
|
|
144
|
+
options?: Array<string | number | boolean | undefined | null>;
|
|
141
145
|
/** Current value of the parameter */
|
|
142
146
|
currentValue?: unknown;
|
|
143
147
|
/** Examples for the parameter */
|
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/
|
|
34
|
-
"@sap-ux/odata-annotation-core-types": "0.4.5",
|
|
33
|
+
"@sap-ux/text-document-utils": "0.3.1",
|
|
35
34
|
"@sap-ux/odata-entity-model": "0.3.1",
|
|
36
|
-
"@sap-ux/
|
|
35
|
+
"@sap-ux/odata-annotation-core-types": "0.4.5",
|
|
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"
|