@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.
Files changed (181) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +99 -0
  3. package/dist/constant.d.ts +5 -0
  4. package/dist/constant.js +8 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.js +7 -0
  7. package/dist/page-editor-api/api.d.ts +48 -0
  8. package/dist/page-editor-api/api.js +93 -0
  9. package/dist/page-editor-api/index.d.ts +5 -0
  10. package/dist/page-editor-api/index.js +24 -0
  11. package/dist/page-editor-api/json-helper.d.ts +11 -0
  12. package/dist/page-editor-api/json-helper.js +64 -0
  13. package/dist/page-editor-api/parser/annotations.d.ts +9 -0
  14. package/dist/page-editor-api/parser/annotations.js +13 -0
  15. package/dist/page-editor-api/parser/index.d.ts +3 -0
  16. package/dist/page-editor-api/parser/index.js +19 -0
  17. package/dist/page-editor-api/parser/model/AggregationValidator.d.ts +64 -0
  18. package/dist/page-editor-api/parser/model/AggregationValidator.js +209 -0
  19. package/dist/page-editor-api/parser/model/ArrayAggregation.d.ts +49 -0
  20. package/dist/page-editor-api/parser/model/ArrayAggregation.js +122 -0
  21. package/dist/page-editor-api/parser/model/ObjectAggregation.d.ts +374 -0
  22. package/dist/page-editor-api/parser/model/ObjectAggregation.js +802 -0
  23. package/dist/page-editor-api/parser/model/PageEditModel.d.ts +223 -0
  24. package/dist/page-editor-api/parser/model/PageEditModel.js +954 -0
  25. package/dist/page-editor-api/parser/model/PageEditProperty.d.ts +38 -0
  26. package/dist/page-editor-api/parser/model/PageEditProperty.js +49 -0
  27. package/dist/page-editor-api/parser/model/RootAggregation.d.ts +24 -0
  28. package/dist/page-editor-api/parser/model/RootAggregation.js +54 -0
  29. package/dist/page-editor-api/parser/model/actions/ActionAggregation.d.ts +34 -0
  30. package/dist/page-editor-api/parser/model/actions/ActionAggregation.js +92 -0
  31. package/dist/page-editor-api/parser/model/actions/ActionsAggregation.d.ts +96 -0
  32. package/dist/page-editor-api/parser/model/actions/ActionsAggregation.js +252 -0
  33. package/dist/page-editor-api/parser/model/actions/index.d.ts +3 -0
  34. package/dist/page-editor-api/parser/model/actions/index.js +19 -0
  35. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectAggregation.d.ts +17 -0
  36. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectAggregation.js +26 -0
  37. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectsAggregation.d.ts +46 -0
  38. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectsAggregation.js +66 -0
  39. package/dist/page-editor-api/parser/model/additionalObjects/index.d.ts +3 -0
  40. package/dist/page-editor-api/parser/model/additionalObjects/index.js +19 -0
  41. package/dist/page-editor-api/parser/model/chart/ChartAggregation.d.ts +41 -0
  42. package/dist/page-editor-api/parser/model/chart/ChartAggregation.js +94 -0
  43. package/dist/page-editor-api/parser/model/chart/index.d.ts +2 -0
  44. package/dist/page-editor-api/parser/model/chart/index.js +18 -0
  45. package/dist/page-editor-api/parser/model/fields/ConnectedFieldsAggregation.d.ts +9 -0
  46. package/dist/page-editor-api/parser/model/fields/ConnectedFieldsAggregation.js +13 -0
  47. package/dist/page-editor-api/parser/model/fields/FieldAggregation.d.ts +25 -0
  48. package/dist/page-editor-api/parser/model/fields/FieldAggregation.js +42 -0
  49. package/dist/page-editor-api/parser/model/fields/FieldsAggregation.d.ts +22 -0
  50. package/dist/page-editor-api/parser/model/fields/FieldsAggregation.js +34 -0
  51. package/dist/page-editor-api/parser/model/fields/index.d.ts +4 -0
  52. package/dist/page-editor-api/parser/model/fields/index.js +20 -0
  53. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldAggregation.d.ts +39 -0
  54. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldAggregation.js +94 -0
  55. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldsAggregation.d.ts +36 -0
  56. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldsAggregation.js +59 -0
  57. package/dist/page-editor-api/parser/model/filter-fields/index.d.ts +3 -0
  58. package/dist/page-editor-api/parser/model/filter-fields/index.js +19 -0
  59. package/dist/page-editor-api/parser/model/index.d.ts +19 -0
  60. package/dist/page-editor-api/parser/model/index.js +35 -0
  61. package/dist/page-editor-api/parser/model/macros/MacrosRoot.d.ts +48 -0
  62. package/dist/page-editor-api/parser/model/macros/MacrosRoot.js +114 -0
  63. package/dist/page-editor-api/parser/model/macros/index.d.ts +2 -0
  64. package/dist/page-editor-api/parser/model/macros/index.js +18 -0
  65. package/dist/page-editor-api/parser/model/sections/HeaderSectionsAggregation.d.ts +31 -0
  66. package/dist/page-editor-api/parser/model/sections/HeaderSectionsAggregation.js +82 -0
  67. package/dist/page-editor-api/parser/model/sections/SectionAggregation.d.ts +78 -0
  68. package/dist/page-editor-api/parser/model/sections/SectionAggregation.js +131 -0
  69. package/dist/page-editor-api/parser/model/sections/SectionsAggregation.d.ts +135 -0
  70. package/dist/page-editor-api/parser/model/sections/SectionsAggregation.js +402 -0
  71. package/dist/page-editor-api/parser/model/sections/SectionsObjectAggregation.d.ts +50 -0
  72. package/dist/page-editor-api/parser/model/sections/SectionsObjectAggregation.js +119 -0
  73. package/dist/page-editor-api/parser/model/sections/SubSectionsAggregation.d.ts +39 -0
  74. package/dist/page-editor-api/parser/model/sections/SubSectionsAggregation.js +70 -0
  75. package/dist/page-editor-api/parser/model/sections/index.d.ts +6 -0
  76. package/dist/page-editor-api/parser/model/sections/index.js +22 -0
  77. package/dist/page-editor-api/parser/model/table/ColumnAggregation.d.ts +89 -0
  78. package/dist/page-editor-api/parser/model/table/ColumnAggregation.js +175 -0
  79. package/dist/page-editor-api/parser/model/table/ColumnsAggregation.d.ts +113 -0
  80. package/dist/page-editor-api/parser/model/table/ColumnsAggregation.js +293 -0
  81. package/dist/page-editor-api/parser/model/table/TableAggregation.d.ts +13 -0
  82. package/dist/page-editor-api/parser/model/table/TableAggregation.js +21 -0
  83. package/dist/page-editor-api/parser/model/table/ToolbarAggregation.d.ts +15 -0
  84. package/dist/page-editor-api/parser/model/table/ToolbarAggregation.js +22 -0
  85. package/dist/page-editor-api/parser/model/table/index.d.ts +5 -0
  86. package/dist/page-editor-api/parser/model/table/index.js +21 -0
  87. package/dist/page-editor-api/parser/model/table/utils.d.ts +12 -0
  88. package/dist/page-editor-api/parser/model/table/utils.js +44 -0
  89. package/dist/page-editor-api/parser/model/types/annotations.d.ts +63 -0
  90. package/dist/page-editor-api/parser/model/types/annotations.js +29 -0
  91. package/dist/page-editor-api/parser/model/types/common.d.ts +13 -0
  92. package/dist/page-editor-api/parser/model/types/common.js +3 -0
  93. package/dist/page-editor-api/parser/model/types/index.d.ts +220 -0
  94. package/dist/page-editor-api/parser/model/types/index.js +149 -0
  95. package/dist/page-editor-api/parser/model/utils/annotations.d.ts +38 -0
  96. package/dist/page-editor-api/parser/model/utils/annotations.js +120 -0
  97. package/dist/page-editor-api/parser/model/utils/i18n.d.ts +33 -0
  98. package/dist/page-editor-api/parser/model/utils/i18n.js +69 -0
  99. package/dist/page-editor-api/parser/model/utils/index.d.ts +6 -0
  100. package/dist/page-editor-api/parser/model/utils/index.js +22 -0
  101. package/dist/page-editor-api/parser/model/utils/object.d.ts +25 -0
  102. package/dist/page-editor-api/parser/model/utils/object.js +68 -0
  103. package/dist/page-editor-api/parser/model/utils/sort.d.ts +31 -0
  104. package/dist/page-editor-api/parser/model/utils/sort.js +18 -0
  105. package/dist/page-editor-api/parser/model/utils/utils.d.ts +94 -0
  106. package/dist/page-editor-api/parser/model/utils/utils.js +267 -0
  107. package/dist/page-editor-api/parser/model/views/ViewAggregation.d.ts +62 -0
  108. package/dist/page-editor-api/parser/model/views/ViewAggregation.js +112 -0
  109. package/dist/page-editor-api/parser/model/views/ViewsAggregation.d.ts +54 -0
  110. package/dist/page-editor-api/parser/model/views/ViewsAggregation.js +141 -0
  111. package/dist/page-editor-api/parser/model/views/index.d.ts +3 -0
  112. package/dist/page-editor-api/parser/model/views/index.js +19 -0
  113. package/dist/page-editor-api/parser/model/visual-filters/VisualFilterAggregation.d.ts +11 -0
  114. package/dist/page-editor-api/parser/model/visual-filters/VisualFilterAggregation.js +15 -0
  115. package/dist/page-editor-api/parser/model/visual-filters/VisualFiltersAggregation.d.ts +11 -0
  116. package/dist/page-editor-api/parser/model/visual-filters/VisualFiltersAggregation.js +15 -0
  117. package/dist/page-editor-api/parser/model/visual-filters/index.d.ts +3 -0
  118. package/dist/page-editor-api/parser/model/visual-filters/index.js +19 -0
  119. package/dist/page-editor-api/parser/tree.d.ts +135 -0
  120. package/dist/page-editor-api/parser/tree.js +464 -0
  121. package/dist/page-editor-api/project.d.ts +40 -0
  122. package/dist/page-editor-api/project.js +124 -0
  123. package/dist/page-editor-api/sapuxFtfsFileIO.d.ts +84 -0
  124. package/dist/page-editor-api/sapuxFtfsFileIO.js +195 -0
  125. package/dist/server.d.ts +35 -0
  126. package/dist/server.js +120 -0
  127. package/dist/tools/execute-functionality.d.ts +19 -0
  128. package/dist/tools/execute-functionality.js +175 -0
  129. package/dist/tools/functionalities/controller-extension/index.d.ts +4 -0
  130. package/dist/tools/functionalities/controller-extension/index.js +136 -0
  131. package/dist/tools/functionalities/functionalities.d.ts +4 -0
  132. package/dist/tools/functionalities/functionalities.js +19 -0
  133. package/dist/tools/functionalities/generate-fiori-ui-app/command.d.ts +9 -0
  134. package/dist/tools/functionalities/generate-fiori-ui-app/command.js +158 -0
  135. package/dist/tools/functionalities/generate-fiori-ui-app/generate-fiori-ui-app.d.ts +4 -0
  136. package/dist/tools/functionalities/generate-fiori-ui-app/generate-fiori-ui-app.js +240 -0
  137. package/dist/tools/functionalities/generate-fiori-ui-app/index.d.ts +2 -0
  138. package/dist/tools/functionalities/generate-fiori-ui-app/index.js +7 -0
  139. package/dist/tools/functionalities/index.d.ts +2 -0
  140. package/dist/tools/functionalities/index.js +18 -0
  141. package/dist/tools/functionalities/page/add-page.d.ts +5 -0
  142. package/dist/tools/functionalities/page/add-page.js +89 -0
  143. package/dist/tools/functionalities/page/application.d.ts +212 -0
  144. package/dist/tools/functionalities/page/application.js +616 -0
  145. package/dist/tools/functionalities/page/delete-page.d.ts +4 -0
  146. package/dist/tools/functionalities/page/delete-page.js +71 -0
  147. package/dist/tools/functionalities/page/index.d.ts +3 -0
  148. package/dist/tools/functionalities/page/index.js +10 -0
  149. package/dist/tools/functionalities/page/service.d.ts +82 -0
  150. package/dist/tools/functionalities/page/service.js +114 -0
  151. package/dist/tools/functionalities/page/serviceStore.d.ts +17 -0
  152. package/dist/tools/functionalities/page/serviceStore.js +34 -0
  153. package/dist/tools/functionalities/page/types.d.ts +42 -0
  154. package/dist/tools/functionalities/page/types.js +11 -0
  155. package/dist/tools/functionalities/page/utils.d.ts +12 -0
  156. package/dist/tools/functionalities/page/utils.js +63 -0
  157. package/dist/tools/get-functionality-details.d.ts +24 -0
  158. package/dist/tools/get-functionality-details.js +142 -0
  159. package/dist/tools/index.d.ts +7 -0
  160. package/dist/tools/index.js +55 -0
  161. package/dist/tools/input-schema/execute-functionality.json +28 -0
  162. package/dist/tools/input-schema/get-functionality-details.json +24 -0
  163. package/dist/tools/input-schema/index.d.ts +5 -0
  164. package/dist/tools/input-schema/index.js +15 -0
  165. package/dist/tools/input-schema/list-fiori-apps.json +12 -0
  166. package/dist/tools/input-schema/list-functionality.json +10 -0
  167. package/dist/tools/list-fiori-apps.d.ts +10 -0
  168. package/dist/tools/list-fiori-apps.js +33 -0
  169. package/dist/tools/list-functionalities.d.ts +10 -0
  170. package/dist/tools/list-functionalities.js +145 -0
  171. package/dist/tools/output-schema/execute-functionality.json +39 -0
  172. package/dist/tools/output-schema/get-functionality-details.json +142 -0
  173. package/dist/tools/output-schema/index.d.ts +5 -0
  174. package/dist/tools/output-schema/index.js +15 -0
  175. package/dist/tools/output-schema/list-fiori-apps.json +41 -0
  176. package/dist/tools/output-schema/list-functionality.json +37 -0
  177. package/dist/tools/utils.d.ts +16 -0
  178. package/dist/tools/utils.js +74 -0
  179. package/dist/types.d.ts +170 -0
  180. package/dist/types.js +3 -0
  181. package/package.json +63 -0
@@ -0,0 +1,22 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./annotations"), exports);
18
+ __exportStar(require("./i18n"), exports);
19
+ __exportStar(require("./object"), exports);
20
+ __exportStar(require("./sort"), exports);
21
+ __exportStar(require("./utils"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Method checks if arrays are same - check is performed without deep equality.
3
+ *
4
+ * @param arr1 - First array.
5
+ * @param arr2 - Second array.
6
+ * @returns Is arrays are same.
7
+ */
8
+ export declare const isArrayEqual: (arr1: Array<unknown> | null | undefined, arr2: Array<unknown> | null | undefined) => boolean;
9
+ /**
10
+ * Method checks if array 'arr1' ends with all entries from 'arr2'.
11
+ *
12
+ * @param arr1 - First array.
13
+ * @param arr2 - Second array.
14
+ * @returns Is 'arr1' ends with entries from 'arr2'.
15
+ */
16
+ export declare const isArrayEndsWith: <T>(arr1: Array<T> | null, arr2: Array<T> | null) => boolean;
17
+ /**
18
+ * Method to get value for passed path in passed object.
19
+ *
20
+ * @param obj - Object to use.
21
+ * @param paths - Path for searching property/value.
22
+ * @returns Found value for passed path.
23
+ */
24
+ export declare const getProperty: (obj: object, paths: Array<string | number>) => unknown;
25
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProperty = exports.isArrayEndsWith = exports.isArrayEqual = void 0;
4
+ /**
5
+ * Method checks if arrays are same - check is performed without deep equality.
6
+ *
7
+ * @param arr1 - First array.
8
+ * @param arr2 - Second array.
9
+ * @returns Is arrays are same.
10
+ */
11
+ const isArrayEqual = (arr1, arr2) => {
12
+ if (!arr1 || !arr2) {
13
+ return arr1 === arr2;
14
+ }
15
+ return (arr1.length === arr2.length &&
16
+ arr1.every(function (value, index) {
17
+ return value === arr2[index];
18
+ }));
19
+ };
20
+ exports.isArrayEqual = isArrayEqual;
21
+ /**
22
+ * Method checks if array 'arr1' ends with all entries from 'arr2'.
23
+ *
24
+ * @param arr1 - First array.
25
+ * @param arr2 - Second array.
26
+ * @returns Is 'arr1' ends with entries from 'arr2'.
27
+ */
28
+ const isArrayEndsWith = (arr1, arr2) => {
29
+ if (!arr1 || !arr2 || arr2.length > arr1.length) {
30
+ return false;
31
+ }
32
+ let index1 = arr1.length - 1;
33
+ let index2 = arr2.length - 1;
34
+ while (index2 >= 0) {
35
+ if (arr2[index2] !== arr1[index1]) {
36
+ return false;
37
+ }
38
+ index1--;
39
+ index2--;
40
+ }
41
+ return true;
42
+ };
43
+ exports.isArrayEndsWith = isArrayEndsWith;
44
+ /**
45
+ * Method to get value for passed path in passed object.
46
+ *
47
+ * @param obj - Object to use.
48
+ * @param paths - Path for searching property/value.
49
+ * @returns Found value for passed path.
50
+ */
51
+ const getProperty = (obj, paths) => {
52
+ let current = obj;
53
+ for (const path of paths) {
54
+ if (path === undefined) {
55
+ continue;
56
+ }
57
+ if (typeof current === 'object' && path in current) {
58
+ // found and continue
59
+ current = current[path];
60
+ }
61
+ else {
62
+ return undefined;
63
+ }
64
+ }
65
+ return current;
66
+ };
67
+ exports.getProperty = getProperty;
68
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1,31 @@
1
+ import type { ObjectAggregation } from '../ObjectAggregation';
2
+ export declare enum SortReferencePosition {
3
+ After = "After",
4
+ Before = "Before",
5
+ Replace = "Replace"
6
+ }
7
+ export interface ReordableAggregations<T extends ObjectAggregation> {
8
+ [key: string]: T;
9
+ }
10
+ export interface RelationPosition {
11
+ anchor?: string | null;
12
+ placement?: string | null;
13
+ position?: SortReferencePosition;
14
+ }
15
+ export interface SiblingPosition<T extends ObjectAggregation> {
16
+ id: string;
17
+ order: number;
18
+ aggregation: T;
19
+ }
20
+ export interface DefaultExtensionPosition {
21
+ position?: {
22
+ anchor?: string | null;
23
+ placement?: string | null;
24
+ };
25
+ }
26
+ export declare enum SortingApproach {
27
+ Normal = "Normal",
28
+ WithIds = "WithIds",
29
+ WithIndices = "WithIndices"
30
+ }
31
+ //# sourceMappingURL=sort.d.ts.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SortingApproach = exports.SortReferencePosition = void 0;
4
+ var SortReferencePosition;
5
+ (function (SortReferencePosition) {
6
+ SortReferencePosition["After"] = "After";
7
+ SortReferencePosition["Before"] = "Before";
8
+ SortReferencePosition["Replace"] = "Replace";
9
+ })(SortReferencePosition || (exports.SortReferencePosition = SortReferencePosition = {}));
10
+ // In V2 we can not reffer custom extenstion to another custom extension
11
+ // In result we have two sorting approaches
12
+ var SortingApproach;
13
+ (function (SortingApproach) {
14
+ SortingApproach["Normal"] = "Normal";
15
+ SortingApproach["WithIds"] = "WithIds";
16
+ SortingApproach["WithIndices"] = "WithIndices";
17
+ })(SortingApproach || (exports.SortingApproach = SortingApproach = {}));
18
+ //# sourceMappingURL=sort.js.map
@@ -0,0 +1,94 @@
1
+ import type { TranslationBundles, PropertyPath, PropertyMessage } from '../types';
2
+ import type { JSONSchema4 } from 'json-schema';
3
+ import type { ObjectAggregation } from '../ObjectAggregation';
4
+ import type { ProjectType } from '@sap-ux/project-access';
5
+ export interface AppTranslationBundleData {
6
+ bundles: TranslationBundles;
7
+ projectType?: ProjectType;
8
+ }
9
+ /**
10
+ * Method returns application specific i18n bundle data.
11
+ *
12
+ * @returns i18n bundle data.
13
+ */
14
+ export declare const getAppI18nBundle: () => AppTranslationBundleData;
15
+ export declare const getTechnicalIdFromPath: (path: PropertyPath, firstOnly?: boolean) => string | undefined;
16
+ /**
17
+ * Method disables deletion of last annotation node if there is any custom nodes.
18
+ * There can be cases when custom nodes referenced to last annotation node and by deleting last annotation node, we can not provide correct order.
19
+ *
20
+ * @param aggregation Container aggregation.
21
+ * @param text I18n key for disabled deletion explanation.
22
+ */
23
+ export declare const ensureLastNodeIsUndeletable: (aggregation: ObjectAggregation, text: string) => void;
24
+ /**
25
+ * Function validates extension using validation parameter by setting warning message to aggregation.
26
+ *
27
+ * @param aggregation aggregation for which to set warning message.
28
+ * @param isValid validation result.
29
+ * @param description description to show in case extension is invalid.
30
+ * @param property name of the property
31
+ */
32
+ export declare const validateExtension: (aggregation: ObjectAggregation, isValid: boolean, description: string, property?: string) => void;
33
+ /**
34
+ * Function validates macros extension key by checking aggregation value of it.
35
+ *
36
+ * @param aggregation aggregation for which to set warning message.
37
+ * @param value value of custom extension aggregation.
38
+ */
39
+ export declare const validateMacrosExtension: (aggregation: ObjectAggregation, value?: unknown) => void;
40
+ /**
41
+ * Method which formats and returns display/description text for anchor selection option.
42
+ * Method resolves i18n translation for text if translation exists.
43
+ *
44
+ * @param i18nKey I18n entry for option.
45
+ * @param aggregation Object aggregation.
46
+ * @param text Anchor label without i18n resolution.
47
+ * @param id Anchor ID.
48
+ * @returns Formatted text for related anchor option.
49
+ */
50
+ export declare const formatAnchorDescriptionText: (i18nKey: string, aggregation: ObjectAggregation, text: string, id?: string) => string;
51
+ /**
52
+ * Method which receives 'oneOf' entries from schema and converts to dropdown option entries.
53
+ *
54
+ * @param i18nKey I18n entry for option.
55
+ * @param aggregation Object aggregation.
56
+ * @param oneOf One of entries from schema.
57
+ * @returns Options for dropdown.
58
+ */
59
+ export declare const oneOfToDropdownOptions: (i18nKey: string, aggregation: ObjectAggregation, oneOf?: JSONSchema4[]) => {
60
+ key: string;
61
+ text: string;
62
+ }[];
63
+ /**
64
+ * Method returns updated schema for anchor property.
65
+ * Method hides enum entry which is associated with passed aggregation to avoid anchoring extension to itself.
66
+ *
67
+ * @param aggregation Aggregation object.
68
+ * @param originalSchema Schema of anchor property.
69
+ * @returns Modified schema.
70
+ */
71
+ export declare const updateAnchorSchema: (aggregation: ObjectAggregation, originalSchema: JSONSchema4) => JSONSchema4;
72
+ /**
73
+ * Method adds validation message to property or node instance.
74
+ *
75
+ * @param instance Property or node instance.
76
+ * @param instance.messages Messages of instance.
77
+ * @param messages Array of validation messages.
78
+ */
79
+ export declare function addValidationMessages(instance: {
80
+ messages?: PropertyMessage[];
81
+ }, messages: PropertyMessage[]): void;
82
+ /**
83
+ * Converts a string into "Start Case" format.
84
+ *
85
+ * - Splits words on underscores (`_`), hyphens (`-`), and spaces.
86
+ * - Detects camelCase boundaries (`fooBar` → `Foo Bar`).
87
+ * - Capitalizes the first character of each word.
88
+ * - Preserves acronyms (`FCL`, `WORLD`) when they appear in uppercase.
89
+ *
90
+ * @param text - The input string to convert.
91
+ * @returns The formatted string in start case.
92
+ */
93
+ export declare function startCase(text: string): string;
94
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,267 @@
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.updateAnchorSchema = exports.oneOfToDropdownOptions = exports.formatAnchorDescriptionText = exports.validateMacrosExtension = exports.validateExtension = exports.ensureLastNodeIsUndeletable = exports.getTechnicalIdFromPath = exports.getAppI18nBundle = void 0;
7
+ exports.addValidationMessages = addValidationMessages;
8
+ exports.startCase = startCase;
9
+ const i18next_1 = __importDefault(require("i18next"));
10
+ const types_1 = require("../types");
11
+ const i18n_1 = require("./i18n");
12
+ /**
13
+ * Method returns application specific i18n bundle data.
14
+ *
15
+ * @returns i18n bundle data.
16
+ */
17
+ const getAppI18nBundle = () => {
18
+ return {
19
+ bundles: {
20
+ annotation: {},
21
+ app: {},
22
+ service: {},
23
+ ui5: {}
24
+ }
25
+ };
26
+ };
27
+ exports.getAppI18nBundle = getAppI18nBundle;
28
+ const getTechnicalIdFromPath = (path, firstOnly = false) => {
29
+ const key = path[path.length - 1];
30
+ if (key) {
31
+ let id = key.toString();
32
+ const separator = id.includes(':::') ? ':::' : '::';
33
+ const parts = key.toString().split(separator);
34
+ id = parts[0];
35
+ if (!firstOnly && parts.length > 1) {
36
+ // remove first entry
37
+ parts.splice(0, 1);
38
+ id = parts.join('/');
39
+ }
40
+ if (id) {
41
+ return id;
42
+ }
43
+ }
44
+ };
45
+ exports.getTechnicalIdFromPath = getTechnicalIdFromPath;
46
+ /**
47
+ * Method disables deletion of last annotation node if there is any custom nodes.
48
+ * There can be cases when custom nodes referenced to last annotation node and by deleting last annotation node, we can not provide correct order.
49
+ *
50
+ * @param aggregation Container aggregation.
51
+ * @param text I18n key for disabled deletion explanation.
52
+ */
53
+ const ensureLastNodeIsUndeletable = (aggregation, text) => {
54
+ // Find if there is very last node
55
+ // Should be undefined if there is two annotation nodes
56
+ let lastNativeNode;
57
+ let nativeNodes = 0;
58
+ let customNodeExists = false;
59
+ for (const key in aggregation.aggregations) {
60
+ if (!aggregation.aggregations[key].custom) {
61
+ lastNativeNode = nativeNodes > 0 ? undefined : aggregation.aggregations[key];
62
+ nativeNodes++;
63
+ }
64
+ else {
65
+ customNodeExists = true;
66
+ }
67
+ }
68
+ // Check if signle and last annotation node exists with actions
69
+ if (!customNodeExists || !lastNativeNode?.actions) {
70
+ return;
71
+ }
72
+ // Find deletion action
73
+ const index = lastNativeNode.actions.findIndex((action) => action === types_1.AggregationActions.Delete ||
74
+ (typeof action === 'object' && action.type === types_1.AggregationActions.Delete));
75
+ if (index !== -1) {
76
+ let deleteAction = lastNativeNode.actions[index];
77
+ if (typeof deleteAction !== 'object') {
78
+ // Simple string - make object which allow to disable action
79
+ deleteAction = {
80
+ type: deleteAction
81
+ };
82
+ }
83
+ // Disable actiondeletion
84
+ deleteAction.disabled = true;
85
+ deleteAction.title = i18next_1.default.t(text);
86
+ lastNativeNode.actions[index] = deleteAction;
87
+ }
88
+ };
89
+ exports.ensureLastNodeIsUndeletable = ensureLastNodeIsUndeletable;
90
+ /**
91
+ * Function validates extension using validation parameter by setting warning message to aggregation.
92
+ *
93
+ * @param aggregation aggregation for which to set warning message.
94
+ * @param isValid validation result.
95
+ * @param description description to show in case extension is invalid.
96
+ * @param property name of the property
97
+ */
98
+ const validateExtension = (aggregation, isValid, description, property) => {
99
+ if (!isValid) {
100
+ aggregation.state = types_1.ValidationState.Invalid;
101
+ aggregation.messages = [
102
+ {
103
+ text: description,
104
+ type: types_1.PropertyMessageType.Warning
105
+ }
106
+ ];
107
+ aggregation.inactive = true;
108
+ if (property && aggregation.properties[property]) {
109
+ addValidationMessages(aggregation.properties[property], [{ text: description }]);
110
+ }
111
+ }
112
+ };
113
+ exports.validateExtension = validateExtension;
114
+ /**
115
+ * Function validates macros extension key by checking aggregation value of it.
116
+ *
117
+ * @param aggregation aggregation for which to set warning message.
118
+ * @param value value of custom extension aggregation.
119
+ */
120
+ const validateMacrosExtension = (aggregation, value = aggregation.value) => {
121
+ const extensionValue = value && typeof value === 'object' ? value : {};
122
+ const isKeyDefined = 'key' in extensionValue && !!extensionValue.key;
123
+ // validate custom extension key
124
+ (0, exports.validateExtension)(aggregation, isKeyDefined, i18next_1.default.t('PAGE_EDITOR_CUSTOM_EXTENSION_NO_KEY'), 'key');
125
+ };
126
+ exports.validateMacrosExtension = validateMacrosExtension;
127
+ /**
128
+ * Method which formats and returns display/description text for anchor selection option.
129
+ * Method resolves i18n translation for text if translation exists.
130
+ *
131
+ * @param i18nKey I18n entry for option.
132
+ * @param aggregation Object aggregation.
133
+ * @param text Anchor label without i18n resolution.
134
+ * @param id Anchor ID.
135
+ * @returns Formatted text for related anchor option.
136
+ */
137
+ const formatAnchorDescriptionText = (i18nKey, aggregation, text, id) => {
138
+ const appI18n = (0, exports.getAppI18nBundle)();
139
+ const i18nBundle = (0, i18n_1.getRelevantI18nBundle)(aggregation, appI18n.bundles, appI18n.projectType);
140
+ const label = (0, i18n_1.resolveI18nValue)(text, i18nBundle) || text;
141
+ return id
142
+ ? i18next_1.default.t(i18nKey, {
143
+ id,
144
+ label
145
+ })
146
+ : label;
147
+ };
148
+ exports.formatAnchorDescriptionText = formatAnchorDescriptionText;
149
+ /**
150
+ * Method which receives 'oneOf' entries from schema and converts to dropdown option entries.
151
+ *
152
+ * @param i18nKey I18n entry for option.
153
+ * @param aggregation Object aggregation.
154
+ * @param oneOf One of entries from schema.
155
+ * @returns Options for dropdown.
156
+ */
157
+ const oneOfToDropdownOptions = (i18nKey, aggregation, oneOf = []) => {
158
+ return oneOf
159
+ .filter((entry) => !entry.hidden)
160
+ .map((option, index) => {
161
+ const text = option.description || option.const || index.toString();
162
+ return {
163
+ key: option.const || index.toString(),
164
+ text: (0, exports.formatAnchorDescriptionText)(i18nKey, aggregation, text, option.const)
165
+ };
166
+ });
167
+ };
168
+ exports.oneOfToDropdownOptions = oneOfToDropdownOptions;
169
+ /**
170
+ * Method returns updated schema for anchor property.
171
+ * Method hides enum entry which is associated with passed aggregation to avoid anchoring extension to itself.
172
+ *
173
+ * @param aggregation Aggregation object.
174
+ * @param originalSchema Schema of anchor property.
175
+ * @returns Modified schema.
176
+ */
177
+ const updateAnchorSchema = (aggregation, originalSchema) => {
178
+ const anchor = aggregation.name === 'position' ? aggregation.parent?.name : aggregation.name;
179
+ if (originalSchema.enum) {
180
+ // Copy to avoid sharing same reference across other custom columns
181
+ const schema = { ...originalSchema, enum: [...originalSchema.enum] };
182
+ // Handle enum
183
+ const index = schema.enum.findIndex((entry) => entry === anchor);
184
+ if (index !== -1) {
185
+ schema.enum.splice(index, 1);
186
+ }
187
+ return schema;
188
+ }
189
+ else if (originalSchema.oneOf) {
190
+ const appI18n = (0, exports.getAppI18nBundle)();
191
+ // Copy to avoid sharing same reference across other custom columns
192
+ const schema = { ...originalSchema, oneOf: [...originalSchema.oneOf] };
193
+ // Handle oneOf
194
+ for (let i = 0; i < schema.oneOf.length; i++) {
195
+ const entry = schema.oneOf[i];
196
+ entry.bundle = (0, i18n_1.getI18nBundleName)(entry.custom, true, !!entry.annotationNodeId, appI18n.projectType);
197
+ // Hide anchors which refers to itself
198
+ if (entry.const === anchor) {
199
+ schema.oneOf[i] = {
200
+ ...entry,
201
+ hidden: true
202
+ };
203
+ }
204
+ }
205
+ return schema;
206
+ }
207
+ return originalSchema;
208
+ };
209
+ exports.updateAnchorSchema = updateAnchorSchema;
210
+ /**
211
+ * Method adds validation message to property or node instance.
212
+ *
213
+ * @param instance Property or node instance.
214
+ * @param instance.messages Messages of instance.
215
+ * @param messages Array of validation messages.
216
+ */
217
+ function addValidationMessages(instance, messages) {
218
+ instance.messages ??= [];
219
+ instance.messages.push(...messages);
220
+ }
221
+ /**
222
+ * Converts a string into "Start Case" format.
223
+ *
224
+ * - Splits words on underscores (`_`), hyphens (`-`), and spaces.
225
+ * - Detects camelCase boundaries (`fooBar` → `Foo Bar`).
226
+ * - Capitalizes the first character of each word.
227
+ * - Preserves acronyms (`FCL`, `WORLD`) when they appear in uppercase.
228
+ *
229
+ * @param text - The input string to convert.
230
+ * @returns The formatted string in start case.
231
+ */
232
+ function startCase(text) {
233
+ let result = '';
234
+ let capitalizeNext = true;
235
+ for (let i = 0; i < text.length; i++) {
236
+ const char = text[i];
237
+ // Treat separators as spaces
238
+ if (char === '_' || char === '-' || char === ' ') {
239
+ if (!result.endsWith(' ')) {
240
+ result += ' ';
241
+ }
242
+ capitalizeNext = true;
243
+ continue;
244
+ }
245
+ const prev = text[i - 1];
246
+ const next = text[i + 1];
247
+ // Insert space before camelCase or acronym boundaries
248
+ if (i > 0 &&
249
+ // lower → UPPER (camelCase)
250
+ ((prev >= 'a' && prev <= 'z' && char >= 'A' && char <= 'Z') ||
251
+ // acronym → next word (like FCLTo)
252
+ (prev >= 'A' && prev <= 'Z' && char >= 'A' && char <= 'Z' && next && next >= 'a' && next <= 'z'))) {
253
+ result += ' ';
254
+ capitalizeNext = true;
255
+ }
256
+ // Apply capitalization inline
257
+ if (capitalizeNext) {
258
+ result += char.toUpperCase();
259
+ capitalizeNext = false;
260
+ }
261
+ else {
262
+ result += char;
263
+ }
264
+ }
265
+ return result.trim();
266
+ }
267
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,62 @@
1
+ import type { JSONSchema4 } from 'json-schema';
2
+ import { ObjectAggregation } from '../ObjectAggregation';
3
+ import type { PageEditAggregationData } from '../ObjectAggregation';
4
+ import { AggregationActions, SortingOptions } from '../types';
5
+ import type { PageData, PropertyPath, PageAnnotations } from '../types';
6
+ import type { PageConfig, PageType } from '@sap/ux-specification/dist/types/src';
7
+ /**
8
+ * Represents an aggregation for view objects.
9
+ */
10
+ export declare class ViewAggregation extends ObjectAggregation {
11
+ private title?;
12
+ actions: AggregationActions[];
13
+ sortableItem: SortingOptions | undefined;
14
+ sortableCollection: string | undefined;
15
+ /**
16
+ * Creates an instance of `ViewAggregation`.
17
+ *
18
+ * @param data Optional aggregation data object used to initialize properties.
19
+ * @param schema Optional JSON schema fragment associated with this aggregation.
20
+ */
21
+ constructor(data?: PageEditAggregationData, schema?: JSONSchema4);
22
+ /**
23
+ * Method returns display name of aggregation without applying i18n translation.
24
+ * Overwritten for column handling.
25
+ *
26
+ * @returns Display name of aggregation.
27
+ */
28
+ protected getRawDisplayName(): string;
29
+ /**
30
+ * Public method to mark view as custom action.
31
+ */
32
+ markAsCustomView(): void;
33
+ /**
34
+ * Overwritten method for data update of list report view.
35
+ *
36
+ * @param data Data which should be used for value population.
37
+ * @param page Page config data.
38
+ * @param pageType Page type.
39
+ * @param path Aggregation path.
40
+ * @param annotations Annotations data.
41
+ */
42
+ updatePropertiesValues(data: PageData, page: PageConfig, pageType: PageType, path: PropertyPath, annotations: PageAnnotations | undefined): void;
43
+ /**
44
+ * Method returns true if view aggregation is table view.
45
+ *
46
+ * @returns True if view is table view.
47
+ */
48
+ private isTableView;
49
+ /**
50
+ * Method returns true if view aggregation is chart view.
51
+ *
52
+ * @returns True if view is chart view.
53
+ */
54
+ private isChartView;
55
+ /**
56
+ * Method returns true if aggregation is annotation view.
57
+ *
58
+ * @returns True if view is annotation view.
59
+ */
60
+ isAnnotationView(): boolean;
61
+ }
62
+ //# sourceMappingURL=ViewAggregation.d.ts.map