@sap-ux/fiori-mcp-server 0.0.3 → 0.0.5

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.
Files changed (34) hide show
  1. package/dist/tools/execute-functionality.d.ts +2 -2
  2. package/dist/tools/functionalities/functionalities.d.ts +58 -1
  3. package/dist/tools/functionalities/generate-fiori-ui-app/command.d.ts +2 -2
  4. package/dist/tools/functionalities/page/add-page.js +10 -1
  5. package/dist/tools/functionalities/page/application.d.ts +1 -2
  6. package/dist/tools/functionalities/page/application.js +12 -14
  7. package/dist/tools/functionalities/page/types.d.ts +1 -0
  8. package/dist/tools/functionalities/page/types.js +2 -1
  9. package/dist/tools/get-functionality-details.js +1 -1
  10. package/dist/tools/index.js +44 -10
  11. package/dist/tools/utils.d.ts +10 -0
  12. package/dist/tools/utils.js +49 -1
  13. package/dist/types/basic.d.ts +123 -0
  14. package/dist/types/basic.js +108 -0
  15. package/dist/types/index.d.ts +38 -0
  16. package/dist/{types.js → types/index.js} +1 -1
  17. package/dist/types/input.d.ts +29 -0
  18. package/dist/types/input.js +77 -0
  19. package/dist/types/output.d.ts +125 -0
  20. package/dist/types/output.js +97 -0
  21. package/package.json +3 -3
  22. package/dist/tools/input-schema/execute-functionality.json +0 -28
  23. package/dist/tools/input-schema/get-functionality-details.json +0 -24
  24. package/dist/tools/input-schema/index.d.ts +0 -5
  25. package/dist/tools/input-schema/index.js +0 -15
  26. package/dist/tools/input-schema/list-fiori-apps.json +0 -12
  27. package/dist/tools/input-schema/list-functionality.json +0 -10
  28. package/dist/tools/output-schema/execute-functionality.json +0 -39
  29. package/dist/tools/output-schema/get-functionality-details.json +0 -166
  30. package/dist/tools/output-schema/index.d.ts +0 -5
  31. package/dist/tools/output-schema/index.js +0 -15
  32. package/dist/tools/output-schema/list-fiori-apps.json +0 -41
  33. package/dist/tools/output-schema/list-functionality.json +0 -37
  34. package/dist/types.d.ts +0 -174
@@ -1,4 +1,4 @@
1
- import type { ExecuteFunctionalitiesInput, ExecuteFunctionalityOutput } from '../types';
1
+ import type { ExecuteFunctionalityInput, ExecuteFunctionalityOutput } from '../types';
2
2
  import { PageEditorApi } from '../page-editor-api';
3
3
  /**
4
4
  * Executes a functionality based on the provided parameters.
@@ -7,7 +7,7 @@ import { PageEditorApi } from '../page-editor-api';
7
7
  * @returns A promise that resolves to the execution output
8
8
  * @throws Error if required parameters are missing
9
9
  */
10
- export declare function executeFunctionality(params: ExecuteFunctionalitiesInput): Promise<ExecuteFunctionalityOutput>;
10
+ export declare function executeFunctionality(params: ExecuteFunctionalityInput): Promise<ExecuteFunctionalityOutput>;
11
11
  /**
12
12
  * Retrieves the PageEditorApi instance for the given application path and page name.
13
13
  *
@@ -1,4 +1,61 @@
1
1
  import type { FunctionalityHandlers } from '../../types';
2
- export declare const FUNCTIONALITIES_DETAILS: import("../../types").GetFunctionalityDetailsOutput[];
2
+ export declare const FUNCTIONALITIES_DETAILS: {
3
+ functionalityId: string | (string | number)[];
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ id: string;
8
+ type: "string" | "number" | "boolean" | "object" | "array";
9
+ name?: string | undefined;
10
+ required?: boolean | undefined;
11
+ description?: string | undefined;
12
+ defaultValue?: unknown;
13
+ options?: (string | number | boolean | null)[] | undefined;
14
+ currentValue?: unknown;
15
+ examples?: string[] | undefined;
16
+ pattern?: string | undefined;
17
+ parameters?: {
18
+ id: string;
19
+ type: "string" | "number" | "boolean" | "object" | "array";
20
+ name?: string | undefined;
21
+ required?: boolean | undefined;
22
+ description?: string | undefined;
23
+ defaultValue?: unknown;
24
+ options?: (string | number | boolean | null)[] | undefined;
25
+ currentValue?: unknown;
26
+ examples?: string[] | undefined;
27
+ pattern?: string | undefined;
28
+ parameters?: {
29
+ id: string;
30
+ type: "string" | "number" | "boolean" | "object" | "array";
31
+ name?: string | undefined;
32
+ required?: boolean | undefined;
33
+ description?: string | undefined;
34
+ defaultValue?: unknown;
35
+ options?: (string | number | boolean | null)[] | undefined;
36
+ currentValue?: unknown;
37
+ examples?: string[] | undefined;
38
+ pattern?: string | undefined;
39
+ parameters?: {
40
+ id: string;
41
+ type: "string" | "number" | "boolean" | "object" | "array";
42
+ name?: string | undefined;
43
+ required?: boolean | undefined;
44
+ description?: string | undefined;
45
+ defaultValue?: unknown;
46
+ options?: (string | number | boolean | null)[] | undefined;
47
+ currentValue?: unknown;
48
+ examples?: string[] | undefined;
49
+ pattern?: string | undefined;
50
+ }[] | undefined;
51
+ }[] | undefined;
52
+ }[] | undefined;
53
+ }[];
54
+ technicalDescription?: string | undefined;
55
+ prerequisites?: string[] | undefined;
56
+ impact?: string | undefined;
57
+ examples?: string[] | undefined;
58
+ pageName?: string | undefined;
59
+ }[];
3
60
  export declare const FUNCTIONALITIES_HANDLERS: Map<string, FunctionalityHandlers>;
4
61
  //# sourceMappingURL=functionalities.d.ts.map
@@ -1,9 +1,9 @@
1
- import type { ExecuteFunctionalitiesInput, ExecuteFunctionalityOutput } from '../../../types';
1
+ import type { ExecuteFunctionalityInput, ExecuteFunctionalityOutput } from '../../../types';
2
2
  /**
3
3
  * Method to generate fiori app.
4
4
  *
5
5
  * @param params Input parameters for application generation.
6
6
  * @returns Application generation execution output.
7
7
  */
8
- export declare function command(params: ExecuteFunctionalitiesInput): Promise<ExecuteFunctionalityOutput>;
8
+ export declare function command(params: ExecuteFunctionalityInput): Promise<ExecuteFunctionalityOutput>;
9
9
  //# sourceMappingURL=command.d.ts.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 : 'CustomView';
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(pageType?: string): Promise<GetFunctionalityDetailsOutput>;
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(pageType) {
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: Object.keys(src_1.PageTypeV4),
480
- examples: ['pageType: ' + Object.keys(src_1.PageTypeV4)[0]],
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
  ];
@@ -39,4 +39,5 @@ export declare enum MissingNavigationReason {
39
39
  NoEntityProvided = 3,
40
40
  NotFoundEntity = 4
41
41
  }
42
+ export declare const PAGE_VIEW_NAME_PATTERN: RegExp;
42
43
  //# sourceMappingURL=types.d.ts.map
@@ -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
@@ -54,7 +54,7 @@ function getParameters(properties) {
54
54
  currentValue: property.value
55
55
  };
56
56
  if (property.options) {
57
- parameter.options = property.options.map((option) => option.key);
57
+ parameter.options = property.options.map((option) => option.key ?? null);
58
58
  }
59
59
  if (property.properties) {
60
60
  parameter.parameters = getParameters(property.properties);
@@ -1,8 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.tools = exports.executeFunctionality = exports.getFunctionalityDetails = exports.listFunctionalities = exports.listFioriApps = void 0;
4
- const output_schema_1 = require("./output-schema");
5
- const input_schema_1 = require("./input-schema");
37
+ const Input = __importStar(require("../types/input"));
38
+ const Output = __importStar(require("../types/output"));
39
+ const utils_1 = require("./utils");
6
40
  var list_fiori_apps_1 = require("./list-fiori-apps");
7
41
  Object.defineProperty(exports, "listFioriApps", { enumerable: true, get: function () { return list_fiori_apps_1.listFioriApps; } });
8
42
  var list_functionalities_1 = require("./list-functionalities");
@@ -18,8 +52,8 @@ exports.tools = [
18
52
  This is an optional, preliminary tool.
19
53
  **Use this first ONLY if the target application's name or path is not already known.**
20
54
  The output can be used to ask the user for clarification before starting the main 3-step workflow.`,
21
- inputSchema: input_schema_1.listFioriAppsInputSchema,
22
- outputSchema: output_schema_1.listFioriAppsOutputSchema
55
+ inputSchema: (0, utils_1.convertToSchema)(Input.ListFioriAppsInputSchema),
56
+ outputSchema: (0, utils_1.convertToSchema)(Output.ListFioriAppsOutputSchema)
23
57
  },
24
58
  {
25
59
  name: 'list-functionality',
@@ -30,8 +64,8 @@ exports.tools = [
30
64
  You MUST not use a functionalityId as name of a tool.
31
65
  Do not guess, assume, or use any functionality not present in this list, as it is invalid and will cause the operation to fail.
32
66
  **Note: If the target application is not known, use the list-fiori-apps tool first to identify it.**`,
33
- inputSchema: input_schema_1.listFunctionalityInputSchema,
34
- outputSchema: output_schema_1.listFunctionalityOutputSchema
67
+ inputSchema: (0, utils_1.convertToSchema)(Input.ListFunctionalitiesInputSchema),
68
+ outputSchema: (0, utils_1.convertToSchema)(Output.ListFunctionalitiesOutputSchema)
35
69
  },
36
70
  {
37
71
  name: 'get-functionality-details',
@@ -39,8 +73,8 @@ exports.tools = [
39
73
  Gets the required parameters and detailed information for a specific functionality to create a new or modify an existing SAP Fiori application.
40
74
  You MUST provide a functionalityId obtained from 'list-functionality' (Step 1).
41
75
  The output of this tool is required for the final step 'execute-functionality' (Step 3).`,
42
- inputSchema: input_schema_1.getFunctionalityDetailsInputSchema,
43
- outputSchema: output_schema_1.getFunctionalityDetailsOutputSchema
76
+ inputSchema: (0, utils_1.convertToSchema)(Input.GetFunctionalityDetailsInputSchema),
77
+ outputSchema: (0, utils_1.convertToSchema)(Output.GetFunctionalityDetailsOutputSchema)
44
78
  },
45
79
  {
46
80
  name: 'execute-functionality',
@@ -48,8 +82,8 @@ exports.tools = [
48
82
  Executes a specific functionality to create a new or modify an existing SAP Fiori application with provided parameters.
49
83
  This is the **final step** of the workflow and performs the actual creation or modification.
50
84
  You MUST provide the exact parameter information obtained from get-functionality-details (Step 2).`,
51
- inputSchema: input_schema_1.executeFunctionalityInputSchema,
52
- outputSchema: output_schema_1.executeFunctionalityOutputSchema
85
+ inputSchema: (0, utils_1.convertToSchema)(Input.ExecuteFunctionalityInputSchema),
86
+ outputSchema: (0, utils_1.convertToSchema)(Output.ExecuteFunctionalityOutputSchema)
53
87
  }
54
88
  ];
55
89
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,4 @@
1
+ import * as zod from 'zod';
1
2
  import type { Appdetails } from '../types';
2
3
  /**
3
4
  * Resolves the application details from a given path.
@@ -13,4 +14,13 @@ export declare function resolveApplication(path: string): Promise<Appdetails | u
13
14
  * @returns The relative path for the extension folder, or undefined if the directory type is not recognized.
14
15
  */
15
16
  export declare const getDefaultExtensionFolder: (directory: string) => string | undefined;
17
+ /**
18
+ * Converts a Zod schema into a JSON Schema object.
19
+ * Additionally function removes the `$schema` property (if present),
20
+ * since it is unnecessary for mcp server.
21
+ *
22
+ * @param schema - A Zod schema instance to be converted.
23
+ * @returns A JSON Schema object representing the given Zod schema.
24
+ */
25
+ export declare const convertToSchema: (schema: zod.ZodType) => zod.core.JSONSchema.JSONSchema;
16
26
  //# sourceMappingURL=utils.d.ts.map
@@ -1,9 +1,43 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultExtensionFolder = void 0;
36
+ exports.convertToSchema = exports.getDefaultExtensionFolder = void 0;
4
37
  exports.resolveApplication = resolveApplication;
5
38
  const project_access_1 = require("@sap-ux/project-access");
6
39
  const path_1 = require("path");
40
+ const zod = __importStar(require("zod"));
7
41
  /**
8
42
  * Resolves the application details from a given path.
9
43
  *
@@ -71,4 +105,18 @@ const getDefaultExtensionFolder = (directory) => {
71
105
  return subFolder;
72
106
  };
73
107
  exports.getDefaultExtensionFolder = getDefaultExtensionFolder;
108
+ /**
109
+ * Converts a Zod schema into a JSON Schema object.
110
+ * Additionally function removes the `$schema` property (if present),
111
+ * since it is unnecessary for mcp server.
112
+ *
113
+ * @param schema - A Zod schema instance to be converted.
114
+ * @returns A JSON Schema object representing the given Zod schema.
115
+ */
116
+ const convertToSchema = (schema) => {
117
+ const jsonSchema = zod.toJSONSchema(schema);
118
+ delete jsonSchema.$schema;
119
+ return jsonSchema;
120
+ };
121
+ exports.convertToSchema = convertToSchema;
74
122
  //# sourceMappingURL=utils.js.map
@@ -0,0 +1,123 @@
1
+ import * as zod from 'zod';
2
+ /**
3
+ * Interface representing a Fiori application
4
+ */
5
+ export declare const FioriAppSchema: zod.ZodObject<{
6
+ name: zod.ZodString;
7
+ appPath: zod.ZodString;
8
+ projectPath: zod.ZodString;
9
+ projectType: zod.ZodEnum<{
10
+ EDMXBackend: "EDMXBackend";
11
+ CAPJava: "CAPJava";
12
+ CAPNodejs: "CAPNodejs";
13
+ }>;
14
+ odataVersion: zod.ZodString;
15
+ }, zod.z.core.$strip>;
16
+ /**
17
+ * Type for functionality id
18
+ */
19
+ export declare const FunctionalityIdSchema: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber]>>]>;
20
+ export type Test = zod.infer<typeof FunctionalityIdSchema>;
21
+ /**
22
+ * Schema representing a functionality
23
+ */
24
+ export declare const FunctionalitySchema: zod.ZodObject<{
25
+ functionalityId: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber]>>]>;
26
+ description: zod.ZodString;
27
+ }, zod.z.core.$strip>;
28
+ /**
29
+ * Schema for a Parameter
30
+ */
31
+ declare const BaseParameterSchema: zod.ZodObject<{
32
+ id: zod.ZodString;
33
+ name: zod.ZodOptional<zod.ZodString>;
34
+ type: zod.ZodEnum<{
35
+ string: "string";
36
+ number: "number";
37
+ boolean: "boolean";
38
+ object: "object";
39
+ array: "array";
40
+ }>;
41
+ required: zod.ZodOptional<zod.ZodBoolean>;
42
+ description: zod.ZodOptional<zod.ZodString>;
43
+ defaultValue: zod.ZodOptional<zod.ZodUnknown>;
44
+ options: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean, zod.ZodNull]>>>;
45
+ currentValue: zod.ZodOptional<zod.ZodUnknown>;
46
+ examples: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
47
+ pattern: zod.ZodOptional<zod.ZodString>;
48
+ }, zod.z.core.$strip>;
49
+ export declare const ParameterSchema: zod.ZodObject<{
50
+ id: zod.ZodString;
51
+ name: zod.ZodOptional<zod.ZodString>;
52
+ type: zod.ZodEnum<{
53
+ string: "string";
54
+ number: "number";
55
+ boolean: "boolean";
56
+ object: "object";
57
+ array: "array";
58
+ }>;
59
+ required: zod.ZodOptional<zod.ZodBoolean>;
60
+ description: zod.ZodOptional<zod.ZodString>;
61
+ defaultValue: zod.ZodOptional<zod.ZodUnknown>;
62
+ options: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean, zod.ZodNull]>>>;
63
+ currentValue: zod.ZodOptional<zod.ZodUnknown>;
64
+ examples: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
65
+ pattern: zod.ZodOptional<zod.ZodString>;
66
+ parameters: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
67
+ id: zod.ZodString;
68
+ name: zod.ZodOptional<zod.ZodString>;
69
+ type: zod.ZodEnum<{
70
+ string: "string";
71
+ number: "number";
72
+ boolean: "boolean";
73
+ object: "object";
74
+ array: "array";
75
+ }>;
76
+ required: zod.ZodOptional<zod.ZodBoolean>;
77
+ description: zod.ZodOptional<zod.ZodString>;
78
+ defaultValue: zod.ZodOptional<zod.ZodUnknown>;
79
+ options: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean, zod.ZodNull]>>>;
80
+ currentValue: zod.ZodOptional<zod.ZodUnknown>;
81
+ examples: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
82
+ pattern: zod.ZodOptional<zod.ZodString>;
83
+ parameters: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
84
+ id: zod.ZodString;
85
+ name: zod.ZodOptional<zod.ZodString>;
86
+ type: zod.ZodEnum<{
87
+ string: "string";
88
+ number: "number";
89
+ boolean: "boolean";
90
+ object: "object";
91
+ array: "array";
92
+ }>;
93
+ required: zod.ZodOptional<zod.ZodBoolean>;
94
+ description: zod.ZodOptional<zod.ZodString>;
95
+ defaultValue: zod.ZodOptional<zod.ZodUnknown>;
96
+ options: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean, zod.ZodNull]>>>;
97
+ currentValue: zod.ZodOptional<zod.ZodUnknown>;
98
+ examples: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
99
+ pattern: zod.ZodOptional<zod.ZodString>;
100
+ parameters: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
101
+ id: zod.ZodString;
102
+ name: zod.ZodOptional<zod.ZodString>;
103
+ type: zod.ZodEnum<{
104
+ string: "string";
105
+ number: "number";
106
+ boolean: "boolean";
107
+ object: "object";
108
+ array: "array";
109
+ }>;
110
+ required: zod.ZodOptional<zod.ZodBoolean>;
111
+ description: zod.ZodOptional<zod.ZodString>;
112
+ defaultValue: zod.ZodOptional<zod.ZodUnknown>;
113
+ options: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean, zod.ZodNull]>>>;
114
+ currentValue: zod.ZodOptional<zod.ZodUnknown>;
115
+ examples: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
116
+ pattern: zod.ZodOptional<zod.ZodString>;
117
+ }, zod.z.core.$strip>>>;
118
+ }, zod.z.core.$strip>>>;
119
+ }, zod.z.core.$strip>>>;
120
+ }, zod.z.core.$strip>;
121
+ export type Parameter = zod.infer<typeof BaseParameterSchema>;
122
+ export {};
123
+ //# sourceMappingURL=basic.d.ts.map
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ParameterSchema = exports.FunctionalitySchema = exports.FunctionalityIdSchema = exports.FioriAppSchema = void 0;
37
+ const zod = __importStar(require("zod"));
38
+ /**
39
+ * Interface representing a Fiori application
40
+ */
41
+ exports.FioriAppSchema = zod.object({
42
+ /** Name of the Fiori application */
43
+ name: zod
44
+ .string()
45
+ .describe("Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."),
46
+ /** Path to the Fiori application */
47
+ appPath: zod.string().describe("Absolute path to the Fiori application's root directory."),
48
+ /** Path to project */
49
+ projectPath: zod
50
+ .string()
51
+ .describe('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.'),
52
+ /** Type of the Fiori project */
53
+ projectType: zod
54
+ .enum(['EDMXBackend', 'CAPJava', 'CAPNodejs'])
55
+ .describe('Type of project the application belongs to.'),
56
+ /** OData version of the Fiori application */
57
+ odataVersion: zod.string().describe("OData protocol version used by the application's main service.")
58
+ });
59
+ /**
60
+ * Type for functionality id
61
+ */
62
+ exports.FunctionalityIdSchema = zod.union([zod.string(), zod.array(zod.union([zod.string(), zod.number()]))]);
63
+ /**
64
+ * Schema representing a functionality
65
+ */
66
+ exports.FunctionalitySchema = zod.object({
67
+ functionalityId: exports.FunctionalityIdSchema.describe('Identifier to pass as the `functionalityId` parameter when calling `get-functionality-details` or `execute-functionality`'),
68
+ description: zod.string()
69
+ });
70
+ /**
71
+ * Schema for a Parameter
72
+ */
73
+ const BaseParameterSchema = zod.object({
74
+ /** ID of the parameter */
75
+ id: zod.string(),
76
+ /** Name of the parameter */
77
+ name: zod.string().optional(),
78
+ /** Type of the parameter */
79
+ type: zod.enum(['string', 'number', 'boolean', 'array', 'object']),
80
+ /** Whether the parameter is required */
81
+ required: zod.boolean().optional(),
82
+ /** Description of the parameter */
83
+ description: zod.string().optional(),
84
+ /** Default value of the parameter */
85
+ defaultValue: zod.unknown().optional(),
86
+ /** Possible options for the parameter */
87
+ options: zod.array(zod.union([zod.string(), zod.number(), zod.boolean(), zod.null()])).optional(),
88
+ /** Current value of the parameter */
89
+ currentValue: zod.unknown().optional(),
90
+ /** Examples for the parameter */
91
+ examples: zod.array(zod.string()).optional(),
92
+ /** Regex pattern to validate the value of this parameter */
93
+ pattern: zod.string().optional()
94
+ });
95
+ /**
96
+ * Parameters with nesting
97
+ */
98
+ const NestedParameterSchema = BaseParameterSchema.extend({
99
+ parameters: zod
100
+ .array(BaseParameterSchema.extend({
101
+ parameters: zod.array(BaseParameterSchema).optional()
102
+ }))
103
+ .optional()
104
+ });
105
+ exports.ParameterSchema = BaseParameterSchema.extend({
106
+ parameters: zod.array(NestedParameterSchema).optional()
107
+ });
108
+ //# sourceMappingURL=basic.js.map
@@ -0,0 +1,38 @@
1
+ import type * as zod from 'zod';
2
+ import type { ApplicationAccess } from '@sap-ux/project-access';
3
+ import type { FioriAppSchema, FunctionalityIdSchema, FunctionalitySchema, ParameterSchema } from './basic';
4
+ import type { ExecuteFunctionalityInputSchema, GetFunctionalityDetailsInputSchema, ListFioriAppsInputSchema, ListFunctionalitiesInputSchema } from './input';
5
+ import type { ExecuteFunctionalityOutputSchema, GetFunctionalityDetailsOutputSchema, ListFioriAppsOutputSchema, ListFunctionalitiesOutputSchema } from './output';
6
+ export type FioriApp = zod.infer<typeof FioriAppSchema>;
7
+ export type FunctionalityId = zod.infer<typeof FunctionalityIdSchema>;
8
+ export type Parameter = zod.infer<typeof ParameterSchema>;
9
+ export type Functionality = zod.infer<typeof FunctionalitySchema>;
10
+ export type ListFioriAppsInput = zod.infer<typeof ListFioriAppsInputSchema>;
11
+ export type ListFioriAppsOutput = zod.infer<typeof ListFioriAppsOutputSchema>;
12
+ export type ListFunctionalitiesInput = zod.infer<typeof ListFunctionalitiesInputSchema>;
13
+ export type ListFunctionalitiesOutput = zod.infer<typeof ListFunctionalitiesOutputSchema>;
14
+ export type GetFunctionalityDetailsInput = zod.infer<typeof GetFunctionalityDetailsInputSchema>;
15
+ export type GetFunctionalityDetailsOutput = zod.infer<typeof GetFunctionalityDetailsOutputSchema>;
16
+ export type ExecuteFunctionalityInput = zod.infer<typeof ExecuteFunctionalityInputSchema>;
17
+ export type ExecuteFunctionalityOutput = zod.infer<typeof ExecuteFunctionalityOutputSchema>;
18
+ /**
19
+ * Interface for functionality handlers
20
+ */
21
+ export interface FunctionalityHandlers {
22
+ /** Handler for getting functionality details */
23
+ getFunctionalityDetails: (params: GetFunctionalityDetailsInput) => Promise<GetFunctionalityDetailsOutput>;
24
+ /** Handler for executing functionality */
25
+ executeFunctionality: (params: ExecuteFunctionalityInput) => Promise<ExecuteFunctionalityOutput>;
26
+ }
27
+ /**
28
+ * Interface representing application details
29
+ */
30
+ export interface Appdetails {
31
+ /** Root path of the application */
32
+ root: string;
33
+ /** ID of the application */
34
+ appId: string;
35
+ /** Access details for the application */
36
+ applicationAccess?: ApplicationAccess;
37
+ }
38
+ //# sourceMappingURL=index.d.ts.map