@sap/ux-specification 1.71.67 → 1.71.71

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 (190) hide show
  1. package/dist/documentation/runDocu-min.js +5 -5
  2. package/dist/documentation/runDocu-min.js.map +2 -2
  3. package/dist/documentation/v2/v2-AnalyticalListPage.html +1 -1
  4. package/dist/documentation/v2/v2-ApplicationV2.html +1 -1
  5. package/dist/documentation/v2/v2-ListReport.html +1 -1
  6. package/dist/documentation/v2/v2-ObjectPage.html +1 -1
  7. package/dist/documentation/v2/v2-OverviewPage.html +1 -1
  8. package/dist/index-min.js +42 -42
  9. package/dist/index-min.js.map +3 -3
  10. package/dist/scripts/extractDocu.js +18 -5
  11. package/dist/scripts/extractDocu.js.map +1 -1
  12. package/dist/scripts/spec.js +1 -2
  13. package/dist/scripts/spec.js.map +1 -1
  14. package/dist/scripts/to-json-schema.js +17 -3
  15. package/dist/scripts/to-json-schema.js.map +1 -1
  16. package/dist/src/api.js +2 -1
  17. package/dist/src/api.js.map +1 -1
  18. package/dist/src/extensionLogger.d.ts +1 -1
  19. package/dist/src/extensionLogger.d.ts.map +1 -1
  20. package/dist/src/extensionLogger.js +3 -1
  21. package/dist/src/extensionLogger.js.map +1 -1
  22. package/dist/src/i18n/i18n.js +1 -0
  23. package/dist/src/i18n/i18n.js.map +1 -1
  24. package/dist/src/index.js +17 -9
  25. package/dist/src/index.js.map +1 -1
  26. package/dist/src/project.d.ts.map +1 -1
  27. package/dist/src/project.js +14 -10
  28. package/dist/src/project.js.map +1 -1
  29. package/dist/src/specification/schemaAccess.d.ts +1 -1
  30. package/dist/src/specification/schemaAccess.d.ts.map +1 -1
  31. package/dist/src/specification/schemaAccess.js +5 -2
  32. package/dist/src/specification/schemaAccess.js.map +1 -1
  33. package/dist/src/sync/common/appProvider.js +10 -3
  34. package/dist/src/sync/common/appProvider.js.map +1 -1
  35. package/dist/src/sync/common/decoration/control.d.ts +2 -2
  36. package/dist/src/sync/common/decoration/control.d.ts.map +1 -1
  37. package/dist/src/sync/common/decoration/control.js +15 -7
  38. package/dist/src/sync/common/decoration/control.js.map +1 -1
  39. package/dist/src/sync/common/decoration/decorators.d.ts.map +1 -1
  40. package/dist/src/sync/common/decoration/decorators.js +13 -6
  41. package/dist/src/sync/common/decoration/decorators.js.map +1 -1
  42. package/dist/src/sync/common/decoration/factory.js +1 -0
  43. package/dist/src/sync/common/decoration/factory.js.map +1 -1
  44. package/dist/src/sync/common/decoration/flex.js +1 -0
  45. package/dist/src/sync/common/decoration/flex.js.map +1 -1
  46. package/dist/src/sync/common/decoration/index.js +13 -6
  47. package/dist/src/sync/common/decoration/index.js.map +1 -1
  48. package/dist/src/sync/common/flexUtils.js +15 -2
  49. package/dist/src/sync/common/flexUtils.js.map +1 -1
  50. package/dist/src/sync/common/generate/index.js +12 -5
  51. package/dist/src/sync/common/generate/index.js.map +1 -1
  52. package/dist/src/sync/common/generate/objectPage.js +10 -8
  53. package/dist/src/sync/common/generate/objectPage.js.map +1 -1
  54. package/dist/src/sync/common/generate/utils.d.ts.map +1 -1
  55. package/dist/src/sync/common/generate/utils.js +14 -13
  56. package/dist/src/sync/common/generate/utils.js.map +1 -1
  57. package/dist/src/sync/common/import/utils.js +1 -0
  58. package/dist/src/sync/common/import/utils.js.map +1 -1
  59. package/dist/src/sync/common/importProject.d.ts.map +1 -1
  60. package/dist/src/sync/common/importProject.js +15 -17
  61. package/dist/src/sync/common/importProject.js.map +1 -1
  62. package/dist/src/sync/common/index.js +19 -11
  63. package/dist/src/sync/common/index.js.map +1 -1
  64. package/dist/src/sync/common/types.d.ts +2 -1
  65. package/dist/src/sync/common/types.d.ts.map +1 -1
  66. package/dist/src/sync/common/types.js +2 -0
  67. package/dist/src/sync/common/types.js.map +1 -1
  68. package/dist/src/sync/common/utils.d.ts +4 -4
  69. package/dist/src/sync/common/utils.d.ts.map +1 -1
  70. package/dist/src/sync/common/utils.js +165 -95
  71. package/dist/src/sync/common/utils.js.map +1 -1
  72. package/dist/src/sync/i18n.js +15 -2
  73. package/dist/src/sync/i18n.js.map +1 -1
  74. package/dist/src/sync/v2/application.d.ts.map +1 -1
  75. package/dist/src/sync/v2/application.js +29 -14
  76. package/dist/src/sync/v2/application.js.map +1 -1
  77. package/dist/src/sync/v2/export/controls/Action.d.ts.map +1 -1
  78. package/dist/src/sync/v2/export/controls/Action.js +3 -1
  79. package/dist/src/sync/v2/export/controls/Action.js.map +1 -1
  80. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.d.ts.map +1 -1
  81. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js +3 -1
  82. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js.map +1 -1
  83. package/dist/src/sync/v2/export/controls/AnalyticalListPageKPI.js +1 -0
  84. package/dist/src/sync/v2/export/controls/AnalyticalListPageKPI.js.map +1 -1
  85. package/dist/src/sync/v2/export/controls/Card.js +1 -0
  86. package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
  87. package/dist/src/sync/v2/export/controls/Field.js +1 -0
  88. package/dist/src/sync/v2/export/controls/Field.js.map +1 -1
  89. package/dist/src/sync/v2/export/controls/FilterBar.js +1 -0
  90. package/dist/src/sync/v2/export/controls/FilterBar.js.map +1 -1
  91. package/dist/src/sync/v2/export/controls/FormAction.js +1 -0
  92. package/dist/src/sync/v2/export/controls/FormAction.js.map +1 -1
  93. package/dist/src/sync/v2/export/controls/Fragment.d.ts.map +1 -1
  94. package/dist/src/sync/v2/export/controls/Fragment.js +8 -8
  95. package/dist/src/sync/v2/export/controls/Fragment.js.map +1 -1
  96. package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js +1 -0
  97. package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js.map +1 -1
  98. package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.js +1 -0
  99. package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.js.map +1 -1
  100. package/dist/src/sync/v2/export/controls/ObjectPageHeader.js +1 -0
  101. package/dist/src/sync/v2/export/controls/ObjectPageHeader.js.map +1 -1
  102. package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js +1 -0
  103. package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js.map +1 -1
  104. package/dist/src/sync/v2/export/controls/ObjectPageLayout.js +1 -0
  105. package/dist/src/sync/v2/export/controls/ObjectPageLayout.js.map +1 -1
  106. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.d.ts.map +1 -1
  107. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +11 -5
  108. package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +1 -1
  109. package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +1 -1
  110. package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts.map +1 -1
  111. package/dist/src/sync/v2/export/controls/ObjectPageTable.js +1 -0
  112. package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
  113. package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.js +1 -0
  114. package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.js.map +1 -1
  115. package/dist/src/sync/v2/export/controls/Table.d.ts +1 -1
  116. package/dist/src/sync/v2/export/controls/Table.d.ts.map +1 -1
  117. package/dist/src/sync/v2/export/controls/Table.js +9 -9
  118. package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
  119. package/dist/src/sync/v2/export/controls/TableColumn.js +9 -2
  120. package/dist/src/sync/v2/export/controls/TableColumn.js.map +1 -1
  121. package/dist/src/sync/v2/export/controls/ToolBar.js +1 -0
  122. package/dist/src/sync/v2/export/controls/ToolBar.js.map +1 -1
  123. package/dist/src/sync/v2/export/controls/index.js +29 -22
  124. package/dist/src/sync/v2/export/controls/index.js.map +1 -1
  125. package/dist/src/sync/v2/export/export.js +13 -16
  126. package/dist/src/sync/v2/export/export.js.map +1 -1
  127. package/dist/src/sync/v2/export/exportPage.js +3 -3
  128. package/dist/src/sync/v2/export/exportPage.js.map +1 -1
  129. package/dist/src/sync/v2/export/factory.js +15 -2
  130. package/dist/src/sync/v2/export/factory.js.map +1 -1
  131. package/dist/src/sync/v2/export/manifest.d.ts +1 -1
  132. package/dist/src/sync/v2/export/manifest.d.ts.map +1 -1
  133. package/dist/src/sync/v2/export/manifest.js +9 -4
  134. package/dist/src/sync/v2/export/manifest.js.map +1 -1
  135. package/dist/src/sync/v2/export/pages/AnalyticalListPage.js +1 -0
  136. package/dist/src/sync/v2/export/pages/AnalyticalListPage.js.map +1 -1
  137. package/dist/src/sync/v2/export/pages/ListReport.js +1 -0
  138. package/dist/src/sync/v2/export/pages/ListReport.js.map +1 -1
  139. package/dist/src/sync/v2/export/pages/ObjectPage.js +1 -0
  140. package/dist/src/sync/v2/export/pages/ObjectPage.js.map +1 -1
  141. package/dist/src/sync/v2/export/pages/OverviewPage.js +1 -0
  142. package/dist/src/sync/v2/export/pages/OverviewPage.js.map +1 -1
  143. package/dist/src/sync/v2/export/pages/index.js +14 -7
  144. package/dist/src/sync/v2/export/pages/index.js.map +1 -1
  145. package/dist/src/sync/v2/export/view-controller-generator.d.ts.map +1 -1
  146. package/dist/src/sync/v2/export/view-controller-generator.js +17 -8
  147. package/dist/src/sync/v2/export/view-controller-generator.js.map +1 -1
  148. package/dist/src/sync/v2/generate/analyticalListReport.js +5 -5
  149. package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
  150. package/dist/src/sync/v2/generate/generate.js +1 -0
  151. package/dist/src/sync/v2/generate/generate.js.map +1 -1
  152. package/dist/src/sync/v2/generate/index.js +8 -7
  153. package/dist/src/sync/v2/generate/index.js.map +1 -1
  154. package/dist/src/sync/v2/generate/listReport.d.ts +1 -1
  155. package/dist/src/sync/v2/generate/listReport.d.ts.map +1 -1
  156. package/dist/src/sync/v2/generate/listReport.js +30 -33
  157. package/dist/src/sync/v2/generate/listReport.js.map +1 -1
  158. package/dist/src/sync/v2/generate/objectPage.js +9 -7
  159. package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
  160. package/dist/src/sync/v2/generate/overviewPage.js +1 -0
  161. package/dist/src/sync/v2/generate/overviewPage.js.map +1 -1
  162. package/dist/src/sync/v2/generate/utils.js +17 -8
  163. package/dist/src/sync/v2/generate/utils.js.map +1 -1
  164. package/dist/src/sync/v2/import/app/appProvider.js +7 -1
  165. package/dist/src/sync/v2/import/app/appProvider.js.map +1 -1
  166. package/dist/src/sync/v2/import/app/ovpProvider.js +1 -0
  167. package/dist/src/sync/v2/import/app/ovpProvider.js.map +1 -1
  168. package/dist/src/sync/v2/import/common/index.js +24 -17
  169. package/dist/src/sync/v2/import/common/index.js.map +1 -1
  170. package/dist/src/sync/v2/import/controls/table.js +2 -1
  171. package/dist/src/sync/v2/import/controls/table.js.map +1 -1
  172. package/dist/src/sync/v2/import/index.js +15 -8
  173. package/dist/src/sync/v2/import/index.js.map +1 -1
  174. package/dist/src/sync/v2/import/pages/analyticalListPage.js +1 -0
  175. package/dist/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
  176. package/dist/src/sync/v2/import/pages/listReport.js +1 -0
  177. package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
  178. package/dist/src/sync/v2/import/pages/objectPage.js +33 -36
  179. package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
  180. package/dist/src/sync/v2/import/pages/overviewPage.js +2 -1
  181. package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
  182. package/dist/src/sync/v2/import/utils.js +5 -7
  183. package/dist/src/sync/v2/import/utils.js.map +1 -1
  184. package/dist/src/sync/v2/types.js +1 -0
  185. package/dist/src/sync/v2/types.js.map +1 -1
  186. package/dist/src/sync/v4/utils/StableIdHelper.d.ts +1 -1
  187. package/dist/src/sync/v4/utils/StableIdHelper.d.ts.map +1 -1
  188. package/dist/src/sync/v4/utils/StableIdHelper.js +13 -24
  189. package/dist/src/sync/v4/utils/StableIdHelper.js.map +1 -1
  190. package/package.json +8 -8
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.convertActionKeyToStableId = exports.convertEnumToCSV = exports.arrayCombineMerge = exports.getNextTargetDefinition = exports.generatePageId = exports.getSchemaFilePath = exports.deleteEmptyStructure = exports.getObjectPageFacetSection = exports.createDefaultSection = exports.addTargetTitleAndSectionDescription = exports.addSectionTitleAndDescription = exports.getTemplateTypeFromManifest = exports.determineV2Template = exports.getVersionFromManifest = exports.getObjectPageFacets = exports.getObjectPageHeaderFacets = exports.getSchemaKeyOfLineItemRecord = exports.getManifestSectionByPathV4 = exports.getSectionFacet = exports.findAlias = exports.getPageTypeV2 = exports.getDatafieldDescription = exports.getLabelForDataField = exports.getLabelForPropertyPath = exports.evaluateCommonLabel = exports.getAnnotationPropertyValue = exports.parseAndMergeAndConvert = exports.createAnnotationPath = exports.prepareRef = exports.DEFINITION_LINK_PREFIX = exports.TemplateType = void 0;
6
7
  const ux_specification_types_1 = require("@sap/ux-specification-types");
7
8
  const i18next_1 = __importDefault(require("i18next"));
8
9
  const deepmerge_1 = __importDefault(require("deepmerge"));
@@ -29,13 +30,14 @@ exports.prepareRef = prepareRef;
29
30
  * @param qualifier - Annotation qualifier.
30
31
  * @returns Annotation path based on received params
31
32
  */
32
- exports.createAnnotationPath = (entityTypeName, term, qualifier) => {
33
+ const createAnnotationPath = (entityTypeName, term, qualifier) => {
33
34
  let annotationPath = `/${entityTypeName}/@${term}`;
34
35
  if (qualifier) {
35
36
  annotationPath += `#${qualifier}`;
36
37
  }
37
38
  return annotationPath;
38
39
  };
40
+ exports.createAnnotationPath = createAnnotationPath;
39
41
  /**
40
42
  * Parses, merges, and converts a list of annotation files with aid of tools from annotation-vocabularies-tools
41
43
  * @param annotationFiles - The list of all annotation files, in JSON format
@@ -53,14 +55,6 @@ function parseAndMergeAndConvert(annotationFiles, logger) {
53
55
  if (parseResult.length > 0) {
54
56
  converterOutput = annotation_converter_1.convert(edmx_parser_1.merge(...parseResult));
55
57
  }
56
- if (logger && (converterOutput === null || converterOutput === void 0 ? void 0 : converterOutput.diagnostics)) {
57
- for (const converterMessage of converterOutput.diagnostics) {
58
- extensionLogger_1.log(logger, {
59
- severity: "error" /* Error */,
60
- message: converterMessage.message
61
- });
62
- }
63
- }
64
58
  }
65
59
  catch (error) {
66
60
  extensionLogger_1.log(logger, {
@@ -71,7 +65,8 @@ function parseAndMergeAndConvert(annotationFiles, logger) {
71
65
  return converterOutput;
72
66
  }
73
67
  exports.parseAndMergeAndConvert = parseAndMergeAndConvert;
74
- exports.getAnnotationPropertyValue = (annotationProperty) => (annotationProperty === null || annotationProperty === void 0 ? void 0 : annotationProperty.value) || (annotationProperty === null || annotationProperty === void 0 ? void 0 : annotationProperty.path);
68
+ const getAnnotationPropertyValue = (annotationProperty) => annotationProperty?.value || annotationProperty?.path;
69
+ exports.getAnnotationPropertyValue = getAnnotationPropertyValue;
75
70
  /**
76
71
  * Checks for Common.Label and overwrites the label from it if present
77
72
  * @param {PropertyAnnotations} annotations - property annotations
@@ -79,8 +74,7 @@ exports.getAnnotationPropertyValue = (annotationProperty) => (annotationProperty
79
74
  * @param {string} label - label, to be actualized
80
75
  */
81
76
  function evaluateCommonLabel(annotations, entityType, label) {
82
- var _a, _b, _c, _d;
83
- if ((_a = annotations === null || annotations === void 0 ? void 0 : annotations.Common) === null || _a === void 0 ? void 0 : _a.Label) {
77
+ if (annotations?.Common?.Label) {
84
78
  if (typeof annotations.Common.Label === 'string') {
85
79
  label = annotations.Common.Label;
86
80
  }
@@ -89,11 +83,11 @@ function evaluateCommonLabel(annotations, entityType, label) {
89
83
  if (targetProperty.value) {
90
84
  label = targetProperty.value;
91
85
  }
92
- else if (typeof ((_b = targetProperty.Common) === null || _b === void 0 ? void 0 : _b.Label) === 'string') {
86
+ else if (typeof targetProperty.Common?.Label === 'string') {
93
87
  label = targetProperty.annotations.Common.Label;
94
88
  }
95
89
  }
96
- else if (typeof ((_d = (_c = annotations.Common) === null || _c === void 0 ? void 0 : _c.Label) === null || _d === void 0 ? void 0 : _d.toString()) === 'string') {
90
+ else if (typeof annotations.Common?.Label?.toString() === 'string') {
97
91
  label = annotations.Common.Label.toString();
98
92
  }
99
93
  }
@@ -121,7 +115,6 @@ exports.getLabelForPropertyPath = getLabelForPropertyPath;
121
115
  * @returns label, derived from Common.Label or from property value
122
116
  */
123
117
  function getLabelForDataField(field, entityType) {
124
- var _a, _b;
125
118
  let label, property;
126
119
  if (field['Value']) {
127
120
  if (typeof field['Value'] === 'string') {
@@ -137,7 +130,7 @@ function getLabelForDataField(field, entityType) {
137
130
  else if (field['Target'] && field['Target'].$target && field['Target'].$target.Value) {
138
131
  property = field['Target'].$target.Value.$target;
139
132
  }
140
- if ((_b = (_a = property === null || property === void 0 ? void 0 : property.annotations) === null || _a === void 0 ? void 0 : _a.Common) === null || _b === void 0 ? void 0 : _b.Label) {
133
+ if (property?.annotations?.Common?.Label) {
141
134
  label = evaluateCommonLabel(property.annotations, entityType, label);
142
135
  }
143
136
  return label;
@@ -150,7 +143,6 @@ exports.getLabelForDataField = getLabelForDataField;
150
143
  * @returns undefined or the right string value
151
144
  */
152
145
  function getLabel(dataFieldLabel, entityType) {
153
- var _a, _b;
154
146
  if (typeof dataFieldLabel === 'string') {
155
147
  return dataFieldLabel;
156
148
  }
@@ -161,7 +153,7 @@ function getLabel(dataFieldLabel, entityType) {
161
153
  }
162
154
  else {
163
155
  const singleProperty = property[0];
164
- if ((_b = (_a = singleProperty === null || singleProperty === void 0 ? void 0 : singleProperty.annotations) === null || _a === void 0 ? void 0 : _a.Common) === null || _b === void 0 ? void 0 : _b.Label) {
156
+ if (singleProperty?.annotations?.Common?.Label) {
165
157
  const label = dataFieldLabel;
166
158
  return evaluateCommonLabel(singleProperty.annotations, entityType, label);
167
159
  }
@@ -204,6 +196,7 @@ function getDatafieldDescription(dataFieldAbstract, entityType) {
204
196
  title = dataFieldLabel || propertyCommonLabel || dataField.Target.$target.Title || dataField.Target.value;
205
197
  break;
206
198
  case "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */:
199
+ case "com.sap.vocabularies.UI.v1.DataFieldWithAction" /* DataFieldWithAction */:
207
200
  case "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* DataFieldForIntentBasedNavigation */:
208
201
  dataField = dataFieldAbstract;
209
202
  if (dataFieldLabel) {
@@ -250,7 +243,10 @@ function getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys = fals
250
243
  * @returns alias for the given namespace
251
244
  */
252
245
  function findAlias(namespace, oDataServiceAVT) {
253
- let aliasReference = oDataServiceAVT === null || oDataServiceAVT === void 0 ? void 0 : oDataServiceAVT.references.find((reference) => {
246
+ if (!oDataServiceAVT) {
247
+ return;
248
+ }
249
+ let aliasReference = oDataServiceAVT.references.find((reference) => {
254
250
  return reference.namespace === namespace;
255
251
  });
256
252
  if (!aliasReference) {
@@ -264,7 +260,7 @@ function findAlias(namespace, oDataServiceAVT) {
264
260
  namespace.split('SAP__')[namespace.split('SAP__').length - 1].toUpperCase());
265
261
  });
266
262
  }
267
- return aliasReference === null || aliasReference === void 0 ? void 0 : aliasReference.alias;
263
+ return aliasReference?.alias;
268
264
  }
269
265
  exports.findAlias = findAlias;
270
266
  /**
@@ -275,11 +271,10 @@ exports.findAlias = findAlias;
275
271
  * @returns the target annotation
276
272
  */
277
273
  function determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT) {
278
- var _a;
279
274
  const lastNavigationPart = navigationParts[navigationParts.length - 1];
280
275
  const annotation = lastNavigationPart.substring(lastNavigationPart.lastIndexOf('.') + 1, lastNavigationPart.length);
281
276
  const alias = findAlias(lastNavigationPart.substring(0, lastNavigationPart.lastIndexOf('.')).replace('@', ''), oDataServiceAVT);
282
- return (_a = entityType === null || entityType === void 0 ? void 0 : entityType.annotations[alias]) === null || _a === void 0 ? void 0 : _a[annotation];
277
+ return entityType?.annotations[alias]?.[annotation];
283
278
  }
284
279
  /**
285
280
  * Adjust key by considering navigation
@@ -300,12 +295,11 @@ function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
300
295
  return key;
301
296
  }
302
297
  function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
303
- var _a;
304
298
  let stopProcessing = false;
305
299
  const navigationParts = propertyValue.split('/');
306
300
  const navigation = navigationParts.length > 1;
307
301
  if (navigation) {
308
- entityType = (_a = entityType.resolvePath(propertyValue.substring(0, propertyValue.lastIndexOf('/')))) === null || _a === void 0 ? void 0 : _a.targetType;
302
+ entityType = entityType.resolvePath(propertyValue.substring(0, propertyValue.lastIndexOf('/')))?.targetType;
309
303
  }
310
304
  key = adjustKey(key, navigationParts, keyForRelatedFacetKeys);
311
305
  const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
@@ -358,7 +352,13 @@ function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, log
358
352
  }
359
353
  key = key.replace(/\//gi, '::');
360
354
  return key
361
- ? Object.assign(Object.assign(Object.assign({ key }, (facetDefinition.Label && { label: facetDefinition.Label.toString() })), (facetDefinition.ID && { ID: facetDefinition.ID.toString() })), { entityType }) : undefined;
355
+ ? {
356
+ key,
357
+ ...(facetDefinition.Label && { label: facetDefinition.Label.toString() }),
358
+ ...(facetDefinition.ID && { ID: facetDefinition.ID.toString() }),
359
+ entityType
360
+ }
361
+ : undefined;
362
362
  }
363
363
  exports.getSectionFacet = getSectionFacet;
364
364
  /**
@@ -372,7 +372,7 @@ exports.getSectionFacet = getSectionFacet;
372
372
  * @param {boolean} importScenario - indicates if the function is called for the import, else it is the export
373
373
  * @returns returns section of the manifest based on path, generates an empty object in case it does not exists
374
374
  */
375
- exports.getManifestSectionByPathV4 = (manifest, path, targetAnnotation, targetAnnotationEncoded) => {
375
+ const getManifestSectionByPathV4 = (manifest, path, targetAnnotation, targetAnnotationEncoded) => {
376
376
  if (!path) {
377
377
  return undefined;
378
378
  }
@@ -399,6 +399,7 @@ exports.getManifestSectionByPathV4 = (manifest, path, targetAnnotation, targetAn
399
399
  }
400
400
  return manifestSection;
401
401
  };
402
+ exports.getManifestSectionByPathV4 = getManifestSectionByPathV4;
402
403
  function getSchemaKeyOfLineItemRecord(lineItemRecord) {
403
404
  let schemaKey, target, value;
404
405
  switch (lineItemRecord.$Type) {
@@ -448,13 +449,63 @@ function getSchemaKeyOfLineItemRecord(lineItemRecord) {
448
449
  }
449
450
  exports.getSchemaKeyOfLineItemRecord = getSchemaKeyOfLineItemRecord;
450
451
  /**
451
- * Evaluates the target annotation of a reference facet and actualizes the facets for the config
452
- * @param {AnnotationTerm} annotationRecord - the actual annotation record
453
- * @param {FacetConfigs} facets - list of facets in config format, to be updated
454
- * @param {string} serviceName - name of the service of the app
455
- * @param {string} entityName - the entity (type) name
456
- * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
452
+ * Determines if type of given annotation term is of UIAnnotationTerm
453
+ * @param {string} path path in manifest
454
+ * @param {string} alias for a given namespace
455
+ * @param {EntityType} entityType - the entity type
456
+ * @returns UI annotation term type
457
+ */
458
+ function getUIAnnotationTerm(path, alias, entityType) {
459
+ if (path.includes("com.sap.vocabularies.UI.v1.Chart" /* Chart */) || path.includes(alias + '.Chart')) {
460
+ return "com.sap.vocabularies.UI.v1.Chart" /* Chart */;
461
+ }
462
+ else if (path.includes("com.sap.vocabularies.UI.v1.Identification" /* Identification */) || path.includes(alias + '.Identification')) {
463
+ return "com.sap.vocabularies.UI.v1.Identification" /* Identification */;
464
+ }
465
+ else if ((entityType && path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */)) || path.includes(alias + '.LineItem')) {
466
+ return "com.sap.vocabularies.UI.v1.LineItem" /* LineItem */;
467
+ }
468
+ else if (path.includes("com.sap.vocabularies.UI.v1.FieldGroup" /* FieldGroup */) || path.includes(alias + '.FieldGroup')) {
469
+ return "com.sap.vocabularies.UI.v1.FieldGroup" /* FieldGroup */;
470
+ }
471
+ else if (path.includes("com.sap.vocabularies.UI.v1.DataPoint" /* DataPoint */) || path.includes(alias + '.DataPoint')) {
472
+ return "com.sap.vocabularies.UI.v1.DataPoint" /* DataPoint */;
473
+ }
474
+ else if (path.includes("com.sap.vocabularies.UI.v1.PresentationVariant" /* PresentationVariant */) || path.includes(alias + '.PresentationVariant')) {
475
+ return "com.sap.vocabularies.UI.v1.PresentationVariant" /* PresentationVariant */;
476
+ }
477
+ else {
478
+ return undefined;
479
+ }
480
+ }
481
+ /**
482
+ * Determines if type of given annotation term is of CommunicationAnnotationTerm
483
+ * @param {string} path path in manifest
484
+ * @param {string} alias for a given namespace
485
+ * @param {EntityType} entityType - the entity type
486
+ * @returns Communication annotation term type
457
487
  */
488
+ function getCommunicationAnnotationTerm(path, alias) {
489
+ if (path.includes('com.sap.vocabularies.Communication.v1.Contact') || path.includes(alias + '.Contact')) {
490
+ return "com.sap.vocabularies.Communication.v1.Contact" /* Contact */;
491
+ }
492
+ else if (path.includes('com.sap.vocabularies.Communication.v1.Address') || path.includes(alias + '.Address')) {
493
+ return "com.sap.vocabularies.Communication.v1.Address" /* Address */;
494
+ }
495
+ else {
496
+ return undefined;
497
+ }
498
+ }
499
+ /**
500
+ * Determines the type of given annotation term
501
+ * @param {string} path path in manifest
502
+ * @param {string} alias for a given namespace
503
+ * @param {EntityType} entityType - the entity type
504
+ * @returns annotation term type
505
+ */
506
+ function getAnnotationTerm(path, alias, entityType) {
507
+ return getUIAnnotationTerm(path, alias, entityType) || getCommunicationAnnotationTerm(path, alias);
508
+ }
458
509
  /**
459
510
  * Evaluates the target annotation of a reference facet and actualizes the facets for the config
460
511
  * @param {AnnotationTerm} annotationRecord - the actual annotation record
@@ -465,55 +516,70 @@ exports.getSchemaKeyOfLineItemRecord = getSchemaKeyOfLineItemRecord;
465
516
  * @param {ExtensionLogger} logger - Logger class for logging messages
466
517
  */
467
518
  function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, logger) {
468
- var _a, _b, _c, _d, _e, _f;
469
519
  const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
470
520
  let path = section ? section.key : '';
471
521
  const targetEntityType = section.entityType;
522
+ const annotationTerm = getAnnotationTerm(path, alias, entityType);
472
523
  let annotation, targetAnnotation;
473
- if (path.includes("com.sap.vocabularies.UI.v1.Chart" /* Chart */) || path.includes(alias + '.Chart')) {
474
- facets[path] = { base: types_1.FacetBase.Chart };
475
- facets[path].entityType = targetEntityType;
476
- }
477
- else if (path.includes("com.sap.vocabularies.UI.v1.Identification" /* Identification */) || path.includes(alias + '.Identification')) {
478
- annotation = path.split('.')[path.split('.').length - 1];
479
- targetAnnotation = targetEntityType.annotations[alias][annotation];
480
- facets[path] = { base: types_1.FacetBase.Identification };
481
- facets[path].entityType = targetEntityType;
482
- facets[path].target = targetAnnotation;
483
- }
484
- else if (entityType && (path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) || path.includes(alias + '.LineItem'))) {
485
- if (!path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) && path.includes('.LineItem')) {
486
- const pathParts = path.split('::');
487
- pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
488
- path = pathParts.join('::');
524
+ switch (annotationTerm) {
525
+ case "com.sap.vocabularies.UI.v1.Chart" /* Chart */: {
526
+ facets[path] = { base: types_1.FacetBase.Chart };
527
+ facets[path].target = annotationRecord?.Target?.$target;
528
+ facets[path].entityType = targetEntityType;
529
+ break;
530
+ }
531
+ case "com.sap.vocabularies.UI.v1.Identification" /* Identification */: {
532
+ annotation = path.split('.')[path.split('.').length - 1];
533
+ facets[path] = { base: types_1.FacetBase.Identification };
534
+ facets[path].entityType = targetEntityType;
535
+ facets[path].target = annotationRecord?.Target?.$target;
536
+ break;
537
+ }
538
+ case "com.sap.vocabularies.UI.v1.LineItem" /* LineItem */: {
539
+ if (!path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) && path.includes('.LineItem')) {
540
+ const pathParts = path.split('::');
541
+ pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
542
+ path = pathParts.join('::');
543
+ }
544
+ facets[path] = { base: types_1.FacetBase.LineItem };
545
+ facets[path].target = annotationRecord?.Target?.$target;
546
+ facets[path].entityType = targetEntityType;
547
+ break;
548
+ }
549
+ case "com.sap.vocabularies.UI.v1.FieldGroup" /* FieldGroup */: {
550
+ facets[path] = { base: types_1.FacetBase.Form };
551
+ facets[path].target = annotationRecord?.Target?.$target;
552
+ facets[path].entityType = targetEntityType;
553
+ break;
554
+ }
555
+ case "com.sap.vocabularies.UI.v1.DataPoint" /* DataPoint */: {
556
+ facets[path] = { base: types_1.FacetBase.DataPoint };
557
+ facets[path].target = annotationRecord?.Target?.$target;
558
+ facets[path].entityType = targetEntityType;
559
+ facets[path].Label = annotationRecord?.Target?.$target['Title'];
560
+ break;
561
+ }
562
+ case "com.sap.vocabularies.UI.v1.PresentationVariant" /* PresentationVariant */: {
563
+ facets[path] = { base: types_1.FacetBase.PresentationVariant };
564
+ facets[path].target = annotationRecord?.Target?.$target;
565
+ facets[path].entityType = targetEntityType;
566
+ break;
567
+ }
568
+ case "com.sap.vocabularies.Communication.v1.Contact" /* Contact */: {
569
+ facets[path] = { base: types_1.FacetBase.Contact };
570
+ facets[path].target = annotationRecord?.Target?.$target;
571
+ facets[path].entityType = targetEntityType;
572
+ break;
573
+ }
574
+ case "com.sap.vocabularies.Communication.v1.Address" /* Address */: {
575
+ facets[path] = { base: types_1.FacetBase.Address };
576
+ facets[path].target = annotationRecord?.Target?.$target;
577
+ facets[path].entityType = targetEntityType;
578
+ break;
579
+ }
580
+ default: {
581
+ facets[path] = { base: types_1.FacetBase.Unknown };
489
582
  }
490
- facets[path] = { base: types_1.FacetBase.LineItem };
491
- facets[path].target = (_a = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _a === void 0 ? void 0 : _a.$target;
492
- facets[path].entityType = targetEntityType;
493
- }
494
- else if (path.includes("com.sap.vocabularies.UI.v1.FieldGroup" /* FieldGroup */) || path.includes(alias + '.FieldGroup')) {
495
- facets[path] = { base: types_1.FacetBase.Form };
496
- facets[path].target = (_b = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _b === void 0 ? void 0 : _b.$target;
497
- facets[path].entityType = targetEntityType;
498
- }
499
- else if (path.includes("com.sap.vocabularies.UI.v1.DataPoint" /* DataPoint */) || path.includes(alias + '.DataPoint')) {
500
- facets[path] = { base: types_1.FacetBase.DataPoint };
501
- facets[path].target = (_c = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _c === void 0 ? void 0 : _c.$target;
502
- facets[path].entityType = targetEntityType;
503
- facets[path].Label = (_d = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _d === void 0 ? void 0 : _d.$target['Title'];
504
- }
505
- else if (path.includes('com.sap.vocabularies.Communication.v1.Contact') || path.includes(alias + '.Contact')) {
506
- facets[path] = { base: types_1.FacetBase.Contact };
507
- facets[path].target = (_e = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _e === void 0 ? void 0 : _e.$target;
508
- facets[path].entityType = targetEntityType;
509
- }
510
- else if (path.includes('com.sap.vocabularies.Communication.v1.Address') || path.includes(alias + '.Address')) {
511
- facets[path] = { base: types_1.FacetBase.Address };
512
- facets[path].target = (_f = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _f === void 0 ? void 0 : _f.$target;
513
- facets[path].entityType = targetEntityType;
514
- }
515
- else {
516
- facets[path] = { base: types_1.FacetBase.Unknown };
517
583
  }
518
584
  if (facets[path]) {
519
585
  facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', types_1.VOCWITHSLASH)}`;
@@ -546,7 +612,6 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
546
612
  * @param {ExtensionLogger} logger - Logger class for logging messages
547
613
  */
548
614
  function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, logger) {
549
- var _a;
550
615
  const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
551
616
  if (section) {
552
617
  switch (annotationRecord.$Type) {
@@ -563,7 +628,7 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
563
628
  annotationPath: annotationPath,
564
629
  Label: section.label
565
630
  });
566
- (_a = annotationRecord.Facets) === null || _a === void 0 ? void 0 : _a.forEach((collectionItem) => {
631
+ annotationRecord.Facets?.forEach((collectionItem) => {
567
632
  addFacetToConfig(collectionItem, oDataServiceAVT, serviceName, entityType, facet.facets, oDataVersion, logger);
568
633
  });
569
634
  break;
@@ -707,17 +772,17 @@ exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
707
772
  * @param facetKey - key of the facet
708
773
  */
709
774
  function addSectionTitleAndDescription(facet, section, facetKey) {
710
- if (facet === null || facet === void 0 ? void 0 : facet.ID) {
775
+ if (facet?.ID) {
711
776
  section.title = types_1.FacetTitlePrefix + facet.ID;
712
777
  }
713
778
  else {
714
779
  section.title = facetKey.replace(/@com.sap/g, 'com.sap');
715
780
  }
716
781
  // Description
717
- if (facet === null || facet === void 0 ? void 0 : facet.Label) {
782
+ if (facet?.Label) {
718
783
  section.description = facet.Label;
719
784
  }
720
- else if (facet === null || facet === void 0 ? void 0 : facet.ID) {
785
+ else if (facet?.ID) {
721
786
  section.description = facet.ID;
722
787
  }
723
788
  else {
@@ -732,15 +797,14 @@ exports.addSectionTitleAndDescription = addSectionTitleAndDescription;
732
797
  * @param facetKey - key of the facet
733
798
  */
734
799
  function addTargetTitleAndSectionDescription(facet, section, facetKey) {
735
- var _a;
736
800
  addSectionTitleAndDescription(facet, section, facetKey);
737
- if (facet === null || facet === void 0 ? void 0 : facet.Label) {
738
- section.description = facet === null || facet === void 0 ? void 0 : facet.Label;
801
+ if (facet?.Label) {
802
+ section.description = facet?.Label;
739
803
  }
740
- else if (facet === null || facet === void 0 ? void 0 : facet['Title']) {
804
+ else if (facet?.['Title']) {
741
805
  section.description = facet['Title'];
742
806
  }
743
- else if ((_a = facet === null || facet === void 0 ? void 0 : facet.target) === null || _a === void 0 ? void 0 : _a['Title']) {
807
+ else if (facet?.target?.['Title']) {
744
808
  section.description = facet.target['Title'];
745
809
  }
746
810
  }
@@ -809,7 +873,7 @@ exports.getObjectPageFacetSection = getObjectPageFacetSection;
809
873
  * @param targetAnnotation - target annotation (optional, in case of sections, subsections)
810
874
  * @param targetAnnotationEncoded - encoded version of the target annotation, as represented in the manifest
811
875
  */
812
- exports.deleteEmptyStructure = (manifest, path, targetAnnotation, targetAnnotationEncoded) => {
876
+ const deleteEmptyStructure = (manifest, path, targetAnnotation, targetAnnotationEncoded) => {
813
877
  if (!path) {
814
878
  return;
815
879
  }
@@ -836,6 +900,7 @@ exports.deleteEmptyStructure = (manifest, path, targetAnnotation, targetAnnotati
836
900
  manifestSection = manifestSection && manifestSection[decodedElement];
837
901
  });
838
902
  };
903
+ exports.deleteEmptyStructure = deleteEmptyStructure;
839
904
  /**
840
905
  * Method which returns generic schema file name.
841
906
  * @param {SchemaType | PageType} schemaType Schema type or Page type.
@@ -850,7 +915,7 @@ const getGenericSchemaFileName = (schemaType) => {
850
915
  * @param {string} [entitySet] Entity set string.
851
916
  * @return {SchemaFilePath} File path info.
852
917
  */
853
- exports.getSchemaFilePath = (schemaType, entitySet) => {
918
+ const getSchemaFilePath = (schemaType, entitySet) => {
854
919
  const schemaFile = {
855
920
  filename: '',
856
921
  path: ''
@@ -885,6 +950,7 @@ exports.getSchemaFilePath = (schemaType, entitySet) => {
885
950
  schemaFile.path += '.json';
886
951
  return schemaFile;
887
952
  };
953
+ exports.getSchemaFilePath = getSchemaFilePath;
888
954
  /**
889
955
  * Method which generates id of page according to passed parameters.
890
956
  * @param appVersion - Fiori Elements version - V2 or V4.
@@ -957,7 +1023,6 @@ function fillArrayFromPropertyDefinition(propertyDefinition, currentConfigObject
957
1023
  * @returns {NextDefinition} - Next target definition to process
958
1024
  */
959
1025
  function determineNextDefinitionFromDefinitionArray(definitionArray, appSchema, title, currentConfigObject, key, factory, pageType, propertyDefinition) {
960
- var _a, _b, _c, _d;
961
1026
  let nextDefinition = {
962
1027
  configObject: undefined,
963
1028
  targetDefinition: {},
@@ -966,7 +1031,7 @@ function determineNextDefinitionFromDefinitionArray(definitionArray, appSchema,
966
1031
  if (definitionArray.length) {
967
1032
  const lastDefinition = definitionArray[definitionArray.length - 1];
968
1033
  nextDefinition.targetDefinition = appSchema['definitions'][lastDefinition];
969
- if (((_a = nextDefinition === null || nextDefinition === void 0 ? void 0 : nextDefinition.targetDefinition) === null || _a === void 0 ? void 0 : _a['$ref']) || ((_b = nextDefinition === null || nextDefinition === void 0 ? void 0 : nextDefinition.targetDefinition) === null || _b === void 0 ? void 0 : _b['type']) === 'array') {
1034
+ if (nextDefinition?.targetDefinition?.['$ref'] || nextDefinition?.targetDefinition?.['type'] === 'array') {
970
1035
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
971
1036
  nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, nextDefinition.targetDefinition, key, factory, pageType);
972
1037
  return nextDefinition;
@@ -974,15 +1039,19 @@ function determineNextDefinitionFromDefinitionArray(definitionArray, appSchema,
974
1039
  if (definitionArray.length > 1) {
975
1040
  definitionArray.forEach((element) => {
976
1041
  if (element !== '') {
977
- nextDefinition.targetDefinition['properties'] = Object.assign(Object.assign({}, nextDefinition.targetDefinition['properties']), appSchema['definitions'][element]['properties']);
1042
+ nextDefinition.targetDefinition['properties'] = {
1043
+ ...nextDefinition.targetDefinition['properties'],
1044
+ ...appSchema['definitions'][element]['properties']
1045
+ };
978
1046
  }
979
1047
  });
980
1048
  }
981
- nextDefinition.title = ((_c = nextDefinition === null || nextDefinition === void 0 ? void 0 : nextDefinition.targetDefinition) === null || _c === void 0 ? void 0 : _c['title']) ? nextDefinition.targetDefinition['title']
1049
+ nextDefinition.title = nextDefinition?.targetDefinition?.['title']
1050
+ ? nextDefinition.targetDefinition['title']
982
1051
  : title;
983
- const factoryKey = lastDefinition === null || lastDefinition === void 0 ? void 0 : lastDefinition.split('<')[0];
1052
+ const factoryKey = lastDefinition?.split('<')[0];
984
1053
  const targetObject = currentConfigObject ? currentConfigObject : {};
985
- nextDefinition.configObject = factory.createInstance(pageType, factoryKey, targetObject, (_d = nextDefinition === null || nextDefinition === void 0 ? void 0 : nextDefinition.targetDefinition) === null || _d === void 0 ? void 0 : _d['controlProperty']);
1054
+ nextDefinition.configObject = factory.createInstance(pageType, factoryKey, targetObject, nextDefinition?.targetDefinition?.['controlProperty']);
986
1055
  }
987
1056
  else {
988
1057
  //e.g. sections ==> loop over all properties = subsections or other
@@ -1026,7 +1095,7 @@ exports.getNextTargetDefinition = getNextTargetDefinition;
1026
1095
  * @param {*} options options object provided by deepmerge's merge function
1027
1096
  * @returns
1028
1097
  */
1029
- exports.arrayCombineMerge = (target, source, options) => {
1098
+ const arrayCombineMerge = (target, source, options) => {
1030
1099
  const destination = target.slice();
1031
1100
  source.forEach((item, index) => {
1032
1101
  if (typeof destination[index] === 'undefined') {
@@ -1041,6 +1110,7 @@ exports.arrayCombineMerge = (target, source, options) => {
1041
1110
  });
1042
1111
  return destination;
1043
1112
  };
1113
+ exports.arrayCombineMerge = arrayCombineMerge;
1044
1114
  /**
1045
1115
  * Converts an enum into a CSV
1046
1116
  * @param {object} manifestSection - manifestSection where the key exists