@sap-ux/fiori-mcp-server 0.0.1
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/LICENSE +201 -0
- package/README.md +99 -0
- package/dist/constant.d.ts +5 -0
- package/dist/constant.js +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/page-editor-api/api.d.ts +48 -0
- package/dist/page-editor-api/api.js +93 -0
- package/dist/page-editor-api/index.d.ts +5 -0
- package/dist/page-editor-api/index.js +24 -0
- package/dist/page-editor-api/json-helper.d.ts +11 -0
- package/dist/page-editor-api/json-helper.js +64 -0
- package/dist/page-editor-api/parser/annotations.d.ts +9 -0
- package/dist/page-editor-api/parser/annotations.js +13 -0
- package/dist/page-editor-api/parser/index.d.ts +3 -0
- package/dist/page-editor-api/parser/index.js +19 -0
- package/dist/page-editor-api/parser/model/AggregationValidator.d.ts +64 -0
- package/dist/page-editor-api/parser/model/AggregationValidator.js +209 -0
- package/dist/page-editor-api/parser/model/ArrayAggregation.d.ts +49 -0
- package/dist/page-editor-api/parser/model/ArrayAggregation.js +122 -0
- package/dist/page-editor-api/parser/model/ObjectAggregation.d.ts +374 -0
- package/dist/page-editor-api/parser/model/ObjectAggregation.js +802 -0
- package/dist/page-editor-api/parser/model/PageEditModel.d.ts +223 -0
- package/dist/page-editor-api/parser/model/PageEditModel.js +954 -0
- package/dist/page-editor-api/parser/model/PageEditProperty.d.ts +38 -0
- package/dist/page-editor-api/parser/model/PageEditProperty.js +49 -0
- package/dist/page-editor-api/parser/model/RootAggregation.d.ts +24 -0
- package/dist/page-editor-api/parser/model/RootAggregation.js +54 -0
- package/dist/page-editor-api/parser/model/actions/ActionAggregation.d.ts +34 -0
- package/dist/page-editor-api/parser/model/actions/ActionAggregation.js +92 -0
- package/dist/page-editor-api/parser/model/actions/ActionsAggregation.d.ts +96 -0
- package/dist/page-editor-api/parser/model/actions/ActionsAggregation.js +252 -0
- package/dist/page-editor-api/parser/model/actions/index.d.ts +3 -0
- package/dist/page-editor-api/parser/model/actions/index.js +19 -0
- package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectAggregation.d.ts +17 -0
- package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectAggregation.js +26 -0
- package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectsAggregation.d.ts +46 -0
- package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectsAggregation.js +66 -0
- package/dist/page-editor-api/parser/model/additionalObjects/index.d.ts +3 -0
- package/dist/page-editor-api/parser/model/additionalObjects/index.js +19 -0
- package/dist/page-editor-api/parser/model/chart/ChartAggregation.d.ts +41 -0
- package/dist/page-editor-api/parser/model/chart/ChartAggregation.js +94 -0
- package/dist/page-editor-api/parser/model/chart/index.d.ts +2 -0
- package/dist/page-editor-api/parser/model/chart/index.js +18 -0
- package/dist/page-editor-api/parser/model/fields/ConnectedFieldsAggregation.d.ts +9 -0
- package/dist/page-editor-api/parser/model/fields/ConnectedFieldsAggregation.js +13 -0
- package/dist/page-editor-api/parser/model/fields/FieldAggregation.d.ts +25 -0
- package/dist/page-editor-api/parser/model/fields/FieldAggregation.js +42 -0
- package/dist/page-editor-api/parser/model/fields/FieldsAggregation.d.ts +22 -0
- package/dist/page-editor-api/parser/model/fields/FieldsAggregation.js +34 -0
- package/dist/page-editor-api/parser/model/fields/index.d.ts +4 -0
- package/dist/page-editor-api/parser/model/fields/index.js +20 -0
- package/dist/page-editor-api/parser/model/filter-fields/FilterFieldAggregation.d.ts +39 -0
- package/dist/page-editor-api/parser/model/filter-fields/FilterFieldAggregation.js +94 -0
- package/dist/page-editor-api/parser/model/filter-fields/FilterFieldsAggregation.d.ts +36 -0
- package/dist/page-editor-api/parser/model/filter-fields/FilterFieldsAggregation.js +59 -0
- package/dist/page-editor-api/parser/model/filter-fields/index.d.ts +3 -0
- package/dist/page-editor-api/parser/model/filter-fields/index.js +19 -0
- package/dist/page-editor-api/parser/model/index.d.ts +19 -0
- package/dist/page-editor-api/parser/model/index.js +35 -0
- package/dist/page-editor-api/parser/model/macros/MacrosRoot.d.ts +48 -0
- package/dist/page-editor-api/parser/model/macros/MacrosRoot.js +114 -0
- package/dist/page-editor-api/parser/model/macros/index.d.ts +2 -0
- package/dist/page-editor-api/parser/model/macros/index.js +18 -0
- package/dist/page-editor-api/parser/model/sections/HeaderSectionsAggregation.d.ts +31 -0
- package/dist/page-editor-api/parser/model/sections/HeaderSectionsAggregation.js +82 -0
- package/dist/page-editor-api/parser/model/sections/SectionAggregation.d.ts +78 -0
- package/dist/page-editor-api/parser/model/sections/SectionAggregation.js +131 -0
- package/dist/page-editor-api/parser/model/sections/SectionsAggregation.d.ts +135 -0
- package/dist/page-editor-api/parser/model/sections/SectionsAggregation.js +402 -0
- package/dist/page-editor-api/parser/model/sections/SectionsObjectAggregation.d.ts +50 -0
- package/dist/page-editor-api/parser/model/sections/SectionsObjectAggregation.js +119 -0
- package/dist/page-editor-api/parser/model/sections/SubSectionsAggregation.d.ts +39 -0
- package/dist/page-editor-api/parser/model/sections/SubSectionsAggregation.js +70 -0
- package/dist/page-editor-api/parser/model/sections/index.d.ts +6 -0
- package/dist/page-editor-api/parser/model/sections/index.js +22 -0
- package/dist/page-editor-api/parser/model/table/ColumnAggregation.d.ts +89 -0
- package/dist/page-editor-api/parser/model/table/ColumnAggregation.js +175 -0
- package/dist/page-editor-api/parser/model/table/ColumnsAggregation.d.ts +113 -0
- package/dist/page-editor-api/parser/model/table/ColumnsAggregation.js +293 -0
- package/dist/page-editor-api/parser/model/table/TableAggregation.d.ts +13 -0
- package/dist/page-editor-api/parser/model/table/TableAggregation.js +21 -0
- package/dist/page-editor-api/parser/model/table/ToolbarAggregation.d.ts +15 -0
- package/dist/page-editor-api/parser/model/table/ToolbarAggregation.js +22 -0
- package/dist/page-editor-api/parser/model/table/index.d.ts +5 -0
- package/dist/page-editor-api/parser/model/table/index.js +21 -0
- package/dist/page-editor-api/parser/model/table/utils.d.ts +12 -0
- package/dist/page-editor-api/parser/model/table/utils.js +44 -0
- package/dist/page-editor-api/parser/model/types/annotations.d.ts +63 -0
- package/dist/page-editor-api/parser/model/types/annotations.js +29 -0
- package/dist/page-editor-api/parser/model/types/common.d.ts +13 -0
- package/dist/page-editor-api/parser/model/types/common.js +3 -0
- package/dist/page-editor-api/parser/model/types/index.d.ts +220 -0
- package/dist/page-editor-api/parser/model/types/index.js +149 -0
- package/dist/page-editor-api/parser/model/utils/annotations.d.ts +38 -0
- package/dist/page-editor-api/parser/model/utils/annotations.js +120 -0
- package/dist/page-editor-api/parser/model/utils/i18n.d.ts +33 -0
- package/dist/page-editor-api/parser/model/utils/i18n.js +69 -0
- package/dist/page-editor-api/parser/model/utils/index.d.ts +6 -0
- package/dist/page-editor-api/parser/model/utils/index.js +22 -0
- package/dist/page-editor-api/parser/model/utils/object.d.ts +25 -0
- package/dist/page-editor-api/parser/model/utils/object.js +68 -0
- package/dist/page-editor-api/parser/model/utils/sort.d.ts +31 -0
- package/dist/page-editor-api/parser/model/utils/sort.js +18 -0
- package/dist/page-editor-api/parser/model/utils/utils.d.ts +94 -0
- package/dist/page-editor-api/parser/model/utils/utils.js +267 -0
- package/dist/page-editor-api/parser/model/views/ViewAggregation.d.ts +62 -0
- package/dist/page-editor-api/parser/model/views/ViewAggregation.js +112 -0
- package/dist/page-editor-api/parser/model/views/ViewsAggregation.d.ts +54 -0
- package/dist/page-editor-api/parser/model/views/ViewsAggregation.js +141 -0
- package/dist/page-editor-api/parser/model/views/index.d.ts +3 -0
- package/dist/page-editor-api/parser/model/views/index.js +19 -0
- package/dist/page-editor-api/parser/model/visual-filters/VisualFilterAggregation.d.ts +11 -0
- package/dist/page-editor-api/parser/model/visual-filters/VisualFilterAggregation.js +15 -0
- package/dist/page-editor-api/parser/model/visual-filters/VisualFiltersAggregation.d.ts +11 -0
- package/dist/page-editor-api/parser/model/visual-filters/VisualFiltersAggregation.js +15 -0
- package/dist/page-editor-api/parser/model/visual-filters/index.d.ts +3 -0
- package/dist/page-editor-api/parser/model/visual-filters/index.js +19 -0
- package/dist/page-editor-api/parser/tree.d.ts +135 -0
- package/dist/page-editor-api/parser/tree.js +464 -0
- package/dist/page-editor-api/project.d.ts +40 -0
- package/dist/page-editor-api/project.js +124 -0
- package/dist/page-editor-api/sapuxFtfsFileIO.d.ts +84 -0
- package/dist/page-editor-api/sapuxFtfsFileIO.js +195 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.js +120 -0
- package/dist/tools/execute-functionality.d.ts +19 -0
- package/dist/tools/execute-functionality.js +175 -0
- package/dist/tools/functionalities/controller-extension/index.d.ts +4 -0
- package/dist/tools/functionalities/controller-extension/index.js +136 -0
- package/dist/tools/functionalities/functionalities.d.ts +4 -0
- package/dist/tools/functionalities/functionalities.js +19 -0
- package/dist/tools/functionalities/generate-fiori-ui-app/command.d.ts +9 -0
- package/dist/tools/functionalities/generate-fiori-ui-app/command.js +158 -0
- package/dist/tools/functionalities/generate-fiori-ui-app/generate-fiori-ui-app.d.ts +4 -0
- package/dist/tools/functionalities/generate-fiori-ui-app/generate-fiori-ui-app.js +240 -0
- package/dist/tools/functionalities/generate-fiori-ui-app/index.d.ts +2 -0
- package/dist/tools/functionalities/generate-fiori-ui-app/index.js +7 -0
- package/dist/tools/functionalities/index.d.ts +2 -0
- package/dist/tools/functionalities/index.js +18 -0
- package/dist/tools/functionalities/page/add-page.d.ts +5 -0
- package/dist/tools/functionalities/page/add-page.js +89 -0
- package/dist/tools/functionalities/page/application.d.ts +212 -0
- package/dist/tools/functionalities/page/application.js +616 -0
- package/dist/tools/functionalities/page/delete-page.d.ts +4 -0
- package/dist/tools/functionalities/page/delete-page.js +71 -0
- package/dist/tools/functionalities/page/index.d.ts +3 -0
- package/dist/tools/functionalities/page/index.js +10 -0
- package/dist/tools/functionalities/page/service.d.ts +82 -0
- package/dist/tools/functionalities/page/service.js +114 -0
- package/dist/tools/functionalities/page/serviceStore.d.ts +17 -0
- package/dist/tools/functionalities/page/serviceStore.js +34 -0
- package/dist/tools/functionalities/page/types.d.ts +42 -0
- package/dist/tools/functionalities/page/types.js +11 -0
- package/dist/tools/functionalities/page/utils.d.ts +12 -0
- package/dist/tools/functionalities/page/utils.js +63 -0
- package/dist/tools/get-functionality-details.d.ts +24 -0
- package/dist/tools/get-functionality-details.js +142 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.js +55 -0
- package/dist/tools/input-schema/execute-functionality.json +28 -0
- package/dist/tools/input-schema/get-functionality-details.json +24 -0
- package/dist/tools/input-schema/index.d.ts +5 -0
- package/dist/tools/input-schema/index.js +15 -0
- package/dist/tools/input-schema/list-fiori-apps.json +12 -0
- package/dist/tools/input-schema/list-functionality.json +10 -0
- package/dist/tools/list-fiori-apps.d.ts +10 -0
- package/dist/tools/list-fiori-apps.js +33 -0
- package/dist/tools/list-functionalities.d.ts +10 -0
- package/dist/tools/list-functionalities.js +145 -0
- package/dist/tools/output-schema/execute-functionality.json +39 -0
- package/dist/tools/output-schema/get-functionality-details.json +142 -0
- package/dist/tools/output-schema/index.d.ts +5 -0
- package/dist/tools/output-schema/index.js +15 -0
- package/dist/tools/output-schema/list-fiori-apps.json +41 -0
- package/dist/tools/output-schema/list-functionality.json +37 -0
- package/dist/tools/utils.d.ts +16 -0
- package/dist/tools/utils.js +74 -0
- package/dist/types.d.ts +170 -0
- package/dist/types.js +3 -0
- package/package.json +63 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"appPath": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"description": "Path to the Fiori application. Path should be an absolute path."
|
|
7
|
+
},
|
|
8
|
+
"functionalityId": {
|
|
9
|
+
"anyOf": [
|
|
10
|
+
{
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": ["string", "number"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "string"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"description": "The ID of the functionality to get details for"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": ["appPath", "functionalityId"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as executeFunctionalityInputSchema } from './execute-functionality.json';
|
|
2
|
+
export { default as getFunctionalityDetailsInputSchema } from './get-functionality-details.json';
|
|
3
|
+
export { default as listFioriAppsInputSchema } from './list-fiori-apps.json';
|
|
4
|
+
export { default as listFunctionalityInputSchema } from './list-functionality.json';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.listFunctionalityInputSchema = exports.listFioriAppsInputSchema = exports.getFunctionalityDetailsInputSchema = exports.executeFunctionalityInputSchema = void 0;
|
|
7
|
+
var execute_functionality_json_1 = require("./execute-functionality.json");
|
|
8
|
+
Object.defineProperty(exports, "executeFunctionalityInputSchema", { enumerable: true, get: function () { return __importDefault(execute_functionality_json_1).default; } });
|
|
9
|
+
var get_functionality_details_json_1 = require("./get-functionality-details.json");
|
|
10
|
+
Object.defineProperty(exports, "getFunctionalityDetailsInputSchema", { enumerable: true, get: function () { return __importDefault(get_functionality_details_json_1).default; } });
|
|
11
|
+
var list_fiori_apps_json_1 = require("./list-fiori-apps.json");
|
|
12
|
+
Object.defineProperty(exports, "listFioriAppsInputSchema", { enumerable: true, get: function () { return __importDefault(list_fiori_apps_json_1).default; } });
|
|
13
|
+
var list_functionality_json_1 = require("./list-functionality.json");
|
|
14
|
+
Object.defineProperty(exports, "listFunctionalityInputSchema", { enumerable: true, get: function () { return __importDefault(list_functionality_json_1).default; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"searchPath": {
|
|
5
|
+
"type": "array",
|
|
6
|
+
"items": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"description": "Path to search for Fiori applications (defaults to current directory). If VSCode - list of VS Code workspace folder paths(`workspace.workspaceFolders`)"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ListFioriAppsInput, ListFioriAppsOutput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Scans the provided workspace paths for Fiori applications and returns
|
|
4
|
+
* a structured list of discovered apps.
|
|
5
|
+
*
|
|
6
|
+
* @param params - Input parameters for the search.
|
|
7
|
+
* @returns A promise resolving to an object containing a list of discovered Fiori applications.
|
|
8
|
+
*/
|
|
9
|
+
export declare function listFioriApps(params: ListFioriAppsInput): Promise<ListFioriAppsOutput>;
|
|
10
|
+
//# sourceMappingURL=list-fiori-apps.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listFioriApps = listFioriApps;
|
|
4
|
+
const project_access_1 = require("@sap-ux/project-access");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Scans the provided workspace paths for Fiori applications and returns
|
|
8
|
+
* a structured list of discovered apps.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Input parameters for the search.
|
|
11
|
+
* @returns A promise resolving to an object containing a list of discovered Fiori applications.
|
|
12
|
+
*/
|
|
13
|
+
async function listFioriApps(params) {
|
|
14
|
+
const { searchPath = [] } = params;
|
|
15
|
+
const newFoundFioriArtifacts = await (0, project_access_1.findFioriArtifacts)({
|
|
16
|
+
wsFolders: searchPath,
|
|
17
|
+
artifacts: ['applications']
|
|
18
|
+
});
|
|
19
|
+
const applications = newFoundFioriArtifacts.applications ?? [];
|
|
20
|
+
return {
|
|
21
|
+
applications: (await Promise.all(applications.map(async (app) => {
|
|
22
|
+
const projectType = await (0, project_access_1.getProjectType)(app.projectRoot);
|
|
23
|
+
return {
|
|
24
|
+
name: app.manifest['sap.app']?.id ?? (0, path_1.basename)(app.appRoot),
|
|
25
|
+
appPath: app.appRoot,
|
|
26
|
+
projectPath: app.projectRoot,
|
|
27
|
+
projectType,
|
|
28
|
+
odataVersion: app.manifest['sap.app']?.dataSources?.mainService?.settings?.odataVersion ?? '4.0'
|
|
29
|
+
};
|
|
30
|
+
}))) ?? []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=list-fiori-apps.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ListFunctionalitiesInput, ListFunctionalitiesOutput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Lists all functionalities for a given application.
|
|
4
|
+
*
|
|
5
|
+
* @param params - The input parameters for listing functionalities.
|
|
6
|
+
* @param params.appPath - The path to the application.
|
|
7
|
+
* @returns A promise that resolves to either a ListFunctionalitiesOutput object or an error message string.
|
|
8
|
+
*/
|
|
9
|
+
export declare function listFunctionalities(params: ListFunctionalitiesInput): Promise<ListFunctionalitiesOutput | string>;
|
|
10
|
+
//# sourceMappingURL=list-functionalities.d.ts.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listFunctionalities = listFunctionalities;
|
|
4
|
+
const page_editor_api_1 = require("../page-editor-api");
|
|
5
|
+
const functionalities_1 = require("./functionalities");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
/**
|
|
8
|
+
* Lists all functionalities for a given application.
|
|
9
|
+
*
|
|
10
|
+
* @param params - The input parameters for listing functionalities.
|
|
11
|
+
* @param params.appPath - The path to the application.
|
|
12
|
+
* @returns A promise that resolves to either a ListFunctionalitiesOutput object or an error message string.
|
|
13
|
+
*/
|
|
14
|
+
async function listFunctionalities(params) {
|
|
15
|
+
const { appPath } = params;
|
|
16
|
+
let functionalities = [];
|
|
17
|
+
try {
|
|
18
|
+
// If we need dynamic handlers then we can add additional method in interface of FUNCTIONALITIES_HANDLERS
|
|
19
|
+
for (const functionality of functionalities_1.FUNCTIONALITIES_DETAILS) {
|
|
20
|
+
functionalities.push({
|
|
21
|
+
functionalityId: functionality.functionalityId,
|
|
22
|
+
description: functionality.description
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const project = await (0, utils_1.resolveApplication)(appPath);
|
|
26
|
+
const apps = project?.applicationAccess?.project.apps ?? {};
|
|
27
|
+
if (project?.applicationAccess && Object.keys(apps).length) {
|
|
28
|
+
const { applicationAccess } = project;
|
|
29
|
+
const ftfsFileIo = new page_editor_api_1.SapuxFtfsFileIO(applicationAccess);
|
|
30
|
+
const appData = await ftfsFileIo.readApp();
|
|
31
|
+
functionalities = functionalities.concat(await getAppFunctionalities(applicationAccess));
|
|
32
|
+
const pages = Object.keys(appData.config?.pages ?? {});
|
|
33
|
+
for (const pageId of pages) {
|
|
34
|
+
functionalities = functionalities.concat(await getPageFunctionalities(applicationAccess, pageId));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return `Error while trying to list functionalities: ${error.message}`;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
applicationPath: appPath,
|
|
43
|
+
functionalities
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves functionalities for the application settings.
|
|
48
|
+
*
|
|
49
|
+
* @param appAccess - The ApplicationAccess object for accessing the application.
|
|
50
|
+
* @returns A promise that resolves to an array of Functionality objects.
|
|
51
|
+
*/
|
|
52
|
+
async function getAppFunctionalities(appAccess) {
|
|
53
|
+
const pageEditorApi = new page_editor_api_1.PageEditorApi(appAccess, undefined);
|
|
54
|
+
const tree = await pageEditorApi.getPageTree();
|
|
55
|
+
const settingsNode = tree.children.find((node) => node.path[node.path.length - 1] === 'settings');
|
|
56
|
+
if (!settingsNode) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
// Ignore 'minVersion', 'lazy' properties
|
|
60
|
+
settingsNode.properties = settingsNode.properties.filter((setting) => !['minVersion', 'lazy', 'dependencies'].includes(setting.name));
|
|
61
|
+
return getFunctionalitiesFromPageTree(settingsNode);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves functionalities for a specific page in the application.
|
|
65
|
+
*
|
|
66
|
+
* @param appAccess - The ApplicationAccess object for accessing the application.
|
|
67
|
+
* @param pageId - Optional. The ID of the page to retrieve functionalities for.
|
|
68
|
+
* @returns A promise that resolves to an array of Functionality objects.
|
|
69
|
+
*/
|
|
70
|
+
async function getPageFunctionalities(appAccess, pageId) {
|
|
71
|
+
const pageEditorApi = new page_editor_api_1.PageEditorApi(appAccess, pageId);
|
|
72
|
+
const pageTree = await pageEditorApi.getPageTree();
|
|
73
|
+
return getFunctionalitiesFromPageTree(pageTree, undefined, pageId);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Extracts functionalities from a page tree structure.
|
|
77
|
+
*
|
|
78
|
+
* @param pageTree - The TreeNode representing the page structure.
|
|
79
|
+
* @param parentId - Optional. The parent ID array for nested functionalities.
|
|
80
|
+
* @param pageName - Optional. The name of the page being processed.
|
|
81
|
+
* @returns An array of Functionality objects extracted from the page tree.
|
|
82
|
+
*/
|
|
83
|
+
function getFunctionalitiesFromPageTree(pageTree, parentId = [], pageName) {
|
|
84
|
+
const functionalities = [];
|
|
85
|
+
// Process properties of the current node
|
|
86
|
+
if (pageTree.properties) {
|
|
87
|
+
for (const property of pageTree.properties) {
|
|
88
|
+
// Create functionality from property with schemaPath as id
|
|
89
|
+
const functionality = getPropertyFunctionality(property, pageName);
|
|
90
|
+
functionalities.push(functionality);
|
|
91
|
+
// Recursively process nested properties
|
|
92
|
+
if (property.properties) {
|
|
93
|
+
const nestedFunctionalities = processNestedProperties(property.properties);
|
|
94
|
+
functionalities.push(...nestedFunctionalities);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Recursively process child nodes
|
|
99
|
+
if (pageTree.children) {
|
|
100
|
+
for (const child of pageTree.children) {
|
|
101
|
+
const childFunctionalities = getFunctionalitiesFromPageTree(child, [...parentId, ...pageTree.path.map(String)], pageName);
|
|
102
|
+
functionalities.push(...childFunctionalities);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return functionalities;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Processes nested properties to extract functionalities.
|
|
109
|
+
*
|
|
110
|
+
* @param properties - An array of TreeNodeProperty objects to process.
|
|
111
|
+
* @param pageName - Optional. The name of the page being processed.
|
|
112
|
+
* @returns An array of Functionality objects extracted from the nested properties.
|
|
113
|
+
*/
|
|
114
|
+
function processNestedProperties(properties, pageName) {
|
|
115
|
+
const functionalities = [];
|
|
116
|
+
for (const property of properties) {
|
|
117
|
+
const functionality = getPropertyFunctionality(property, pageName);
|
|
118
|
+
functionalities.push(functionality);
|
|
119
|
+
// Recursively process further nested properties
|
|
120
|
+
if (property.properties) {
|
|
121
|
+
const nestedFunctionalities = processNestedProperties(property.properties);
|
|
122
|
+
functionalities.push(...nestedFunctionalities);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return functionalities;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Creates a Functionality object from a TreeNodeProperty.
|
|
129
|
+
*
|
|
130
|
+
* @param property - The TreeNodeProperty to convert into a Functionality.
|
|
131
|
+
* @param pageName - Optional. The name of the page the property belongs to.
|
|
132
|
+
* @returns A Functionality object representing the property.
|
|
133
|
+
*/
|
|
134
|
+
function getPropertyFunctionality(property, pageName) {
|
|
135
|
+
const path = [];
|
|
136
|
+
if (pageName) {
|
|
137
|
+
path.push(pageName);
|
|
138
|
+
}
|
|
139
|
+
path.push(...property.schemaPath);
|
|
140
|
+
return {
|
|
141
|
+
functionalityId: path,
|
|
142
|
+
description: property.description || property.displayName || property.name || 'No description available'
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=list-functionalities.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"functionalityId": {
|
|
5
|
+
"anyOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "array",
|
|
8
|
+
"items": {
|
|
9
|
+
"type": ["string", "number"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"status": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"message": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"parameters": {},
|
|
24
|
+
"appPath": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"changes": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"timestamp": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": ["functionalityId", "status", "message", "parameters", "appPath", "changes", "timestamp"],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"functionalityId": {
|
|
5
|
+
"anyOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "array",
|
|
8
|
+
"items": {
|
|
9
|
+
"type": ["string", "number"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"description": "Identifier to pass as the `functionalityId` parameter when calling `get-functionality-details` or `execute-functionality`"
|
|
17
|
+
},
|
|
18
|
+
"name": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"description": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"technicalDescription": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"parameters": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"id": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"type": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"enum": ["string", "number", "boolean", "array", "object"]
|
|
41
|
+
},
|
|
42
|
+
"required": {
|
|
43
|
+
"type": "boolean"
|
|
44
|
+
},
|
|
45
|
+
"description": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"defaultValue": {},
|
|
49
|
+
"options": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"anyOf": [
|
|
53
|
+
{
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"type": "number"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "boolean"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"not": {}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"currentValue": {},
|
|
69
|
+
"parameters": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"items": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"id": {
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
"name": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
},
|
|
80
|
+
"type": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"enum": ["string", "number", "boolean", "array", "object"]
|
|
83
|
+
},
|
|
84
|
+
"required": {
|
|
85
|
+
"type": "boolean"
|
|
86
|
+
},
|
|
87
|
+
"description": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"defaultValue": {},
|
|
91
|
+
"options": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": {
|
|
94
|
+
"anyOf": [
|
|
95
|
+
{
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "number"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"not": {}
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"currentValue": {}
|
|
111
|
+
},
|
|
112
|
+
"required": ["id", "type"],
|
|
113
|
+
"additionalProperties": false
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"required": ["id", "type"],
|
|
118
|
+
"additionalProperties": false
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"prerequisites": {
|
|
122
|
+
"type": "array",
|
|
123
|
+
"items": {
|
|
124
|
+
"type": "string"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"impact": {
|
|
128
|
+
"type": "string"
|
|
129
|
+
},
|
|
130
|
+
"examples": {
|
|
131
|
+
"type": "array",
|
|
132
|
+
"items": {
|
|
133
|
+
"type": "string"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"pageName": {
|
|
137
|
+
"type": "string"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"required": ["id", "name", "description", "parameters"],
|
|
141
|
+
"additionalProperties": false
|
|
142
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as executeFunctionalityOutputSchema } from './execute-functionality.json';
|
|
2
|
+
export { default as getFunctionalityDetailsOutputSchema } from './get-functionality-details.json';
|
|
3
|
+
export { default as listFioriAppsOutputSchema } from './list-fiori-apps.json';
|
|
4
|
+
export { default as listFunctionalityOutputSchema } from './list-functionality.json';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.listFunctionalityOutputSchema = exports.listFioriAppsOutputSchema = exports.getFunctionalityDetailsOutputSchema = exports.executeFunctionalityOutputSchema = void 0;
|
|
7
|
+
var execute_functionality_json_1 = require("./execute-functionality.json");
|
|
8
|
+
Object.defineProperty(exports, "executeFunctionalityOutputSchema", { enumerable: true, get: function () { return __importDefault(execute_functionality_json_1).default; } });
|
|
9
|
+
var get_functionality_details_json_1 = require("./get-functionality-details.json");
|
|
10
|
+
Object.defineProperty(exports, "getFunctionalityDetailsOutputSchema", { enumerable: true, get: function () { return __importDefault(get_functionality_details_json_1).default; } });
|
|
11
|
+
var list_fiori_apps_json_1 = require("./list-fiori-apps.json");
|
|
12
|
+
Object.defineProperty(exports, "listFioriAppsOutputSchema", { enumerable: true, get: function () { return __importDefault(list_fiori_apps_json_1).default; } });
|
|
13
|
+
var list_functionality_json_1 = require("./list-functionality.json");
|
|
14
|
+
Object.defineProperty(exports, "listFunctionalityOutputSchema", { enumerable: true, get: function () { return __importDefault(list_functionality_json_1).default; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"applications": {
|
|
7
|
+
"type": "array",
|
|
8
|
+
"items": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"name": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."
|
|
14
|
+
},
|
|
15
|
+
"appPath": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Absolute path to the Fiori application's root directory."
|
|
18
|
+
},
|
|
19
|
+
"projectPath": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Absolute path to the root directory of the project containing this Fiori application. For EDMXBackend (standalone) projects, this is the same as `appPath`. For CAP projects, this points to the CAP project root, which may contain multiple Fiori applications."
|
|
22
|
+
},
|
|
23
|
+
"projectType": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"enum": ["EDMXBackend", "CAPJava", "CAPNodejs"],
|
|
26
|
+
"description": "Type of project the application belongs to."
|
|
27
|
+
},
|
|
28
|
+
"odataVersion": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "OData protocol version used by the application's main service."
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": ["name", "appPath", "projectPath", "projectType", "odataVersion"],
|
|
34
|
+
"additionalProperties": false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": ["applications"],
|
|
39
|
+
"additionalProperties": false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"applicationPath": {
|
|
5
|
+
"type": "string"
|
|
6
|
+
},
|
|
7
|
+
"functionalities": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"functionalityId": {
|
|
13
|
+
"anyOf": [
|
|
14
|
+
{
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": {
|
|
17
|
+
"type": ["string", "number"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"description": "Identifier to pass as the `functionalityId` parameter when calling `get-functionality-details` or `execute-functionality`"
|
|
25
|
+
},
|
|
26
|
+
"description": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["functionalityId", "description"],
|
|
31
|
+
"additionalProperties": false
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": ["applicationPath", "functionalities"],
|
|
36
|
+
"additionalProperties": false
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Appdetails } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the application details from a given path.
|
|
4
|
+
*
|
|
5
|
+
* @param path - The file system path to resolve the application from.
|
|
6
|
+
* @returns A promise that resolves to an Appdetails object if the application is found, or undefined otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveApplication(path: string): Promise<Appdetails | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the folder path for new extension creation using the FPM writer approach.
|
|
11
|
+
*
|
|
12
|
+
* @param directory - Target file type (fragment, view, controller) or a custom subfolder.
|
|
13
|
+
* @returns The relative path for the extension folder, or undefined if the directory type is not recognized.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getDefaultExtensionFolder: (directory: string) => string | undefined;
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultExtensionFolder = void 0;
|
|
4
|
+
exports.resolveApplication = resolveApplication;
|
|
5
|
+
const project_access_1 = require("@sap-ux/project-access");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the application details from a given path.
|
|
9
|
+
*
|
|
10
|
+
* @param path - The file system path to resolve the application from.
|
|
11
|
+
* @returns A promise that resolves to an Appdetails object if the application is found, or undefined otherwise.
|
|
12
|
+
*/
|
|
13
|
+
async function resolveApplication(path) {
|
|
14
|
+
try {
|
|
15
|
+
// normalize app path
|
|
16
|
+
path = (0, path_1.join)(path);
|
|
17
|
+
try {
|
|
18
|
+
const applicationAccess = await (0, project_access_1.createApplicationAccess)(path);
|
|
19
|
+
return {
|
|
20
|
+
root: applicationAccess.project.root,
|
|
21
|
+
appId: applicationAccess.getAppId(),
|
|
22
|
+
// projectProvider,
|
|
23
|
+
applicationAccess
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
console.log(`Application was not found by given path. Error: ${e}`);
|
|
28
|
+
// Fallback - project without app
|
|
29
|
+
const root = await (0, project_access_1.findProjectRoot)(path);
|
|
30
|
+
const project = await (0, project_access_1.getProject)(root);
|
|
31
|
+
if (project) {
|
|
32
|
+
return {
|
|
33
|
+
root: project.root,
|
|
34
|
+
appId: ''
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.log(`Project was not found by given path. Error: ${e}`);
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns the folder path for new extension creation using the FPM writer approach.
|
|
47
|
+
*
|
|
48
|
+
* @param directory - Target file type (fragment, view, controller) or a custom subfolder.
|
|
49
|
+
* @returns The relative path for the extension folder, or undefined if the directory type is not recognized.
|
|
50
|
+
*/
|
|
51
|
+
const getDefaultExtensionFolder = (directory) => {
|
|
52
|
+
let subFolder;
|
|
53
|
+
switch (directory) {
|
|
54
|
+
case project_access_1.DirName.View: {
|
|
55
|
+
subFolder = (0, path_1.join)(project_access_1.DirName.Ext, project_access_1.DirName.View);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case project_access_1.DirName.Fragment: {
|
|
59
|
+
subFolder = (0, path_1.join)(project_access_1.DirName.Ext, project_access_1.DirName.Fragment);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case project_access_1.DirName.Controller: {
|
|
63
|
+
subFolder = (0, path_1.join)(project_access_1.DirName.Ext, project_access_1.DirName.Controller);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
default: {
|
|
67
|
+
// Subfolder is passed
|
|
68
|
+
subFolder = directory;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return subFolder;
|
|
72
|
+
};
|
|
73
|
+
exports.getDefaultExtensionFolder = getDefaultExtensionFolder;
|
|
74
|
+
//# sourceMappingURL=utils.js.map
|