@sap/ux-specification 1.108.37 → 1.108.38

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 (32) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
  3. package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
  4. package/dist/documentation/v2/v2-ListReport.html +2 -2
  5. package/dist/documentation/v2/v2-ObjectPage.html +2 -2
  6. package/dist/documentation/v2/v2-OverviewPage.html +2 -2
  7. package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
  8. package/dist/documentation/v4/v4-BuildingBlocks.html +2 -2
  9. package/dist/documentation/v4/v4-FreestylePage.html +2 -2
  10. package/dist/documentation/v4/v4-ListReport.html +2 -2
  11. package/dist/documentation/v4/v4-ObjectPage.html +2 -2
  12. package/dist/index-min.js +84 -84
  13. package/dist/index-min.js.map +3 -3
  14. package/dist/schemas/v2/ApplicationV2.json +1 -5
  15. package/dist/schemas/v4/ApplicationV4.json +1 -5
  16. package/dist/specification/package.json +5 -5
  17. package/dist/specification/src/api.js +1 -1
  18. package/dist/specification/src/sync/common/appProvider.js +5 -3
  19. package/dist/specification/src/sync/common/appProvider.js.map +1 -1
  20. package/dist/specification/src/sync/common/importProject.d.ts.map +1 -1
  21. package/dist/specification/src/sync/common/importProject.js +5 -3
  22. package/dist/specification/src/sync/common/importProject.js.map +1 -1
  23. package/dist/specification/src/sync/common/utils.d.ts +19 -1
  24. package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
  25. package/dist/specification/src/sync/common/utils.js +139 -102
  26. package/dist/specification/src/sync/common/utils.js.map +1 -1
  27. package/dist/types/src/apiTypes.d.ts +2 -1
  28. package/dist/types/src/apiTypes.d.ts.map +1 -1
  29. package/dist/types/src/apiTypes.js.map +1 -1
  30. package/dist/types/src/common/page.d.ts +2 -2
  31. package/dist/types/src/common/page.d.ts.map +1 -1
  32. package/package.json +5 -5
@@ -3,8 +3,10 @@ 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.replaceNamespaces = exports.removeNamespaces = exports.getJSONPropertyByPath = exports.updatePropertyIndices = exports.isFeatureSupported = exports.getErrorMessage = exports.getDefinitionsRef = exports.getDefinitionKey = exports.convertActionKeyToStableId = exports.convertEnumToCSV = exports.arrayCombineMerge = exports.getNextTargetDefinition = exports.findMatchingKeysByAdditionalProperties = exports.generatePageId = exports.getSchemaFilePath = exports.deleteEmptyStructure = exports.getObjectPageFacetSection = exports.createDefaultSection = exports.addTargetTitleAndSectionDescription = exports.addSectionTitleAndDescription = exports.getTemplateTypeFromManifest = exports.determineV4Template = exports.determineV4PageTemplateType = exports.determineV2Template = exports.getVersionFromManifest = exports.getObjectPageFacets = exports.getObjectPageHeaderFacets = exports.getAnnotationPathUsingFullyQualifiedName = exports.getSchemaKeyOfLineItemRecord = exports.setManifestSectionByPathV4 = exports.getManifestSectionByPathV4 = exports.prepareValueForPath = exports.getSectionFacet = exports.getAnnotationFromMetaPath = exports.findAlias = exports.getPageTypeV4 = exports.getPageTypeV2 = exports.prepareRef = exports.getDataFieldDescription = exports.getLabelForDataField = exports.getLabelForPropertyPath = exports.evaluateCommonLabel = exports.getAnnotationPropertyValue = exports.parseAndMergeAndConvert = exports.createAnnotationPath = exports.arrayIncludes = exports.V4_TEMPLATES = exports.DEFINITION_LINK_PREFIX = void 0;
6
+ exports.removeNamespaces = exports.getJSONPropertyByPath = exports.updatePropertyIndices = exports.isFeatureSupported = exports.getErrorMessage = exports.getDefinitionsRef = exports.getDefinitionKey = exports.convertActionKeyToStableId = exports.convertEnumToCSV = exports.arrayCombineMerge = exports.getNextTargetDefinition = exports.findMatchingKeysByAdditionalProperties = exports.generatePageId = exports.getSchemaFilePath = exports.deleteEmptyStructure = exports.getObjectPageFacetSection = exports.createDefaultSection = exports.addTargetTitleAndSectionDescription = exports.addSectionTitleAndDescription = exports.getTemplateTypeFromManifest = exports.determineV4Template = exports.determineV4PageTemplateType = exports.determineV2Template = exports.getODataVersionFromManifest = exports.getMainService = exports.getFEVersionFromManifest = exports.getObjectPageFacets = exports.getObjectPageHeaderFacets = exports.getAnnotationPathUsingFullyQualifiedName = exports.getSchemaKeyOfLineItemRecord = exports.setManifestSectionByPathV4 = exports.getManifestSectionByPathV4 = exports.prepareValueForPath = exports.getSectionFacet = exports.getAnnotationFromMetaPath = exports.findAlias = exports.getPageTypeV4 = exports.getPageTypeV2 = exports.prepareRef = exports.getDataFieldDescription = exports.getLabelForDataField = exports.getLabelForPropertyPath = exports.evaluateCommonLabel = exports.getAnnotationPropertyValue = exports.parseAndMergeAndConvert = exports.createAnnotationPath = exports.arrayIncludes = exports.V4_LIBS = exports.V4_TEMPLATES = exports.DEFINITION_LINK_PREFIX = void 0;
7
+ exports.replaceNamespaces = void 0;
7
8
  const ux_specification_types_1 = require("@sap/ux-specification-types");
9
+ const ux_specification_types_2 = require("@sap/ux-specification-types");
8
10
  const i18next_1 = __importDefault(require("i18next"));
9
11
  const deepmerge_1 = __importDefault(require("deepmerge"));
10
12
  const annotation_converter_1 = require("@sap-ux/annotation-converter");
@@ -12,11 +14,12 @@ const edmx_parser_1 = require("@sap-ux/edmx-parser");
12
14
  const extensionLogger_1 = require("../../extensionLogger");
13
15
  exports.DEFINITION_LINK_PREFIX = '#/definitions/';
14
16
  exports.V4_TEMPLATES = [
15
- ux_specification_types_1.v4.FE_TEMPLATE_V4_LIST_REPORT,
16
- ux_specification_types_1.v4.FE_TEMPLATE_V4_ALP,
17
- ux_specification_types_1.v4.FE_TEMPLATE_V4_OBJECT_PAGE,
18
- ux_specification_types_1.v4.FE_TEMPLATE_V4_CUSTOM_PAGE
17
+ ux_specification_types_2.v4.FE_TEMPLATE_V4_LIST_REPORT,
18
+ ux_specification_types_2.v4.FE_TEMPLATE_V4_ALP,
19
+ ux_specification_types_2.v4.FE_TEMPLATE_V4_OBJECT_PAGE,
20
+ ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE
19
21
  ];
22
+ exports.V4_LIBS = ['sap.fe.core', 'sap.fe.templates'];
20
23
  const arrayIncludes = (arr, target) => target.every((v) => arr.includes(v));
21
24
  exports.arrayIncludes = arrayIncludes;
22
25
  /**
@@ -252,7 +255,7 @@ exports.prepareRef = prepareRef;
252
255
  */
253
256
  function getPageTypeV2(name) {
254
257
  if (name) {
255
- const templatePart = `${ux_specification_types_1.v2.FE_TEMPLATE_V2}.`;
258
+ const templatePart = `${ux_specification_types_2.v2.FE_TEMPLATE_V2}.`;
256
259
  return name.split(templatePart)[1];
257
260
  }
258
261
  }
@@ -262,16 +265,16 @@ exports.getPageTypeV2 = getPageTypeV2;
262
265
  * @param name - page component name
263
266
  */
264
267
  function getPageTypeV4(v4App) {
265
- if (v4App.name && v4App.name !== ux_specification_types_1.v4.FE_TEMPLATE_V4_CUSTOM_PAGE) {
266
- const templatePart = `${ux_specification_types_1.v4.FE_TEMPLATE_V4}.`;
268
+ if (v4App.name && v4App.name !== ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE) {
269
+ const templatePart = `${ux_specification_types_2.v4.FE_TEMPLATE_V4}.`;
267
270
  return v4App.name.split(templatePart)[1];
268
271
  }
269
- else if (v4App?.name === ux_specification_types_1.v4.FE_TEMPLATE_V4_CUSTOM_PAGE) {
270
- return ux_specification_types_1.PageTypeV4.FPMCustomPage;
272
+ else if (v4App?.name === ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE) {
273
+ return ux_specification_types_2.PageTypeV4.FPMCustomPage;
271
274
  }
272
275
  else if (v4App.viewId ||
273
276
  v4App.viewName) {
274
- return ux_specification_types_1.PageTypeV4.CustomPage;
277
+ return ux_specification_types_2.PageTypeV4.CustomPage;
275
278
  }
276
279
  }
277
280
  exports.getPageTypeV4 = getPageTypeV4;
@@ -342,11 +345,11 @@ function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
342
345
  key = pathParts.join('::');
343
346
  }
344
347
  else {
345
- key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${ux_specification_types_1.UIVOCABULARY}`);
348
+ key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${ux_specification_types_2.UIVOCABULARY}`);
346
349
  }
347
350
  return key;
348
351
  }
349
- function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
352
+ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
350
353
  let stopProcessing = false;
351
354
  let namespace;
352
355
  const navigationParts = propertyValue.split('/');
@@ -357,7 +360,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
357
360
  key = adjustKey(key, navigationParts, keyForRelatedFacetKeys);
358
361
  const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
359
362
  if (targetAnnotation) {
360
- const separator = oDataVersion === ux_specification_types_1.FioriElementsVersion.v2 ? '::' : '#';
363
+ const separator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '#';
361
364
  key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
362
365
  namespace = targetAnnotation.fullyQualifiedName?.split('@')[0];
363
366
  }
@@ -366,7 +369,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
366
369
  return { key, entityType, stopProcessing, namespace };
367
370
  }
368
371
  if (navigation) {
369
- const navSeparator = oDataVersion === ux_specification_types_1.FioriElementsVersion.v2 ? '::' : '/';
372
+ const navSeparator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '/';
370
373
  navigationParts.pop();
371
374
  const navigationIDs = [...navigationParts].join(navSeparator);
372
375
  key = `${navigationIDs}${navSeparator}${key}`;
@@ -382,7 +385,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
382
385
  * @param {ExtensionLogger} logger - Logger class for logging messages
383
386
  * @returns {FacetSection} - object comprising the relevant facet information
384
387
  */
385
- function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
388
+ function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
386
389
  //Take facet ID as fallback
387
390
  const facetName = facetDefinition.fullyQualifiedName?.substring(facetDefinition.fullyQualifiedName?.lastIndexOf('@'));
388
391
  let key = facetDefinition.ID ? facetDefinition.ID.toString() : facetName;
@@ -539,7 +542,7 @@ function getSchemaKeyOfLineItemRecord(lineItemRecord) {
539
542
  schemaKey =
540
543
  'DataFieldForAnnotation:::sTarget::' +
541
544
  target
542
- .replace('@UI', `@${ux_specification_types_1.UIVOCABULARY}`)
545
+ .replace('@UI', `@${ux_specification_types_2.UIVOCABULARY}`)
543
546
  .replace('@Communication', '@com.sap.vocabularies.Communication.v1')
544
547
  .replace('@Contact', '@com.sap.vocabularies.Contact.v1');
545
548
  }
@@ -635,20 +638,20 @@ function getAnnotationTerm(path, alias, entityType) {
635
638
  * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
636
639
  */
637
640
  function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT) {
638
- const alias = findAlias(ux_specification_types_1.UIVOCABULARY, oDataServiceAVT);
641
+ const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
639
642
  let path = section ? section.key : '';
640
643
  const targetEntityType = section.entityType;
641
644
  const annotationTerm = getAnnotationTerm(path, alias, entityType);
642
645
  switch (annotationTerm) {
643
646
  case "com.sap.vocabularies.UI.v1.Chart" /* UIAnnotationTerms.Chart */: {
644
- facets[path] = { base: ux_specification_types_1.FacetBase.Chart };
647
+ facets[path] = { base: ux_specification_types_2.FacetBase.Chart };
645
648
  facets[path].target = annotationRecord?.Target?.$target;
646
649
  facets[path].entityType = targetEntityType;
647
650
  facets[path].namespace = section.namespace;
648
651
  break;
649
652
  }
650
653
  case "com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */: {
651
- facets[path] = { base: ux_specification_types_1.FacetBase.Identification };
654
+ facets[path] = { base: ux_specification_types_2.FacetBase.Identification };
652
655
  facets[path].target = annotationRecord?.Target?.$target;
653
656
  facets[path].entityType = targetEntityType;
654
657
  facets[path].namespace = section.namespace;
@@ -660,21 +663,21 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
660
663
  pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* UIAnnotationTerms.LineItem */}`;
661
664
  path = pathParts.join('::');
662
665
  }
663
- facets[path] = { base: ux_specification_types_1.FacetBase.LineItem };
666
+ facets[path] = { base: ux_specification_types_2.FacetBase.LineItem };
664
667
  facets[path].target = annotationRecord?.Target?.$target;
665
668
  facets[path].entityType = targetEntityType;
666
669
  facets[path].namespace = section.namespace;
667
670
  break;
668
671
  }
669
672
  case "com.sap.vocabularies.UI.v1.FieldGroup" /* UIAnnotationTerms.FieldGroup */: {
670
- facets[path] = { base: ux_specification_types_1.FacetBase.Form };
673
+ facets[path] = { base: ux_specification_types_2.FacetBase.Form };
671
674
  facets[path].target = annotationRecord?.Target?.$target;
672
675
  facets[path].entityType = targetEntityType;
673
676
  facets[path].namespace = section.namespace;
674
677
  break;
675
678
  }
676
679
  case "com.sap.vocabularies.UI.v1.DataPoint" /* UIAnnotationTerms.DataPoint */: {
677
- facets[path] = { base: ux_specification_types_1.FacetBase.DataPoint };
680
+ facets[path] = { base: ux_specification_types_2.FacetBase.DataPoint };
678
681
  facets[path].Label = annotationRecord?.Target?.$target['Title'];
679
682
  facets[path].target = annotationRecord?.Target?.$target;
680
683
  facets[path].entityType = targetEntityType;
@@ -682,32 +685,32 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
682
685
  break;
683
686
  }
684
687
  case "com.sap.vocabularies.UI.v1.PresentationVariant" /* UIAnnotationTerms.PresentationVariant */: {
685
- facets[path] = { base: ux_specification_types_1.FacetBase.PresentationVariant };
688
+ facets[path] = { base: ux_specification_types_2.FacetBase.PresentationVariant };
686
689
  facets[path].target = annotationRecord?.Target?.$target;
687
690
  facets[path].entityType = targetEntityType;
688
691
  facets[path].namespace = section.namespace;
689
692
  break;
690
693
  }
691
694
  case "com.sap.vocabularies.Communication.v1.Contact" /* CommunicationAnnotationTerms.Contact */: {
692
- facets[path] = { base: ux_specification_types_1.FacetBase.Contact };
695
+ facets[path] = { base: ux_specification_types_2.FacetBase.Contact };
693
696
  facets[path].target = annotationRecord?.Target?.$target;
694
697
  facets[path].entityType = targetEntityType;
695
698
  facets[path].namespace = section.namespace;
696
699
  break;
697
700
  }
698
701
  case "com.sap.vocabularies.Communication.v1.Address" /* CommunicationAnnotationTerms.Address */: {
699
- facets[path] = { base: ux_specification_types_1.FacetBase.Address };
702
+ facets[path] = { base: ux_specification_types_2.FacetBase.Address };
700
703
  facets[path].target = annotationRecord?.Target?.$target;
701
704
  facets[path].entityType = targetEntityType;
702
705
  facets[path].namespace = section.namespace;
703
706
  break;
704
707
  }
705
708
  default: {
706
- facets[path] = { base: ux_specification_types_1.FacetBase.Unknown };
709
+ facets[path] = { base: ux_specification_types_2.FacetBase.Unknown };
707
710
  }
708
711
  }
709
712
  if (facets[path]) {
710
- facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', ux_specification_types_1.VOCWITHSLASH)}`;
713
+ facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', ux_specification_types_2.VOCWITHSLASH)}`;
711
714
  if (annotationRecord.Label) {
712
715
  facets[path].Label = annotationRecord.Label;
713
716
  }
@@ -740,7 +743,7 @@ exports.getAnnotationPathUsingFullyQualifiedName = getAnnotationPathUsingFullyQu
740
743
  * @param {FioriElementsVersion} oDataVersion - OData version
741
744
  * @param {ExtensionLogger} logger - Logger class for logging messages
742
745
  */
743
- function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, logger) {
746
+ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
744
747
  const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
745
748
  if (section) {
746
749
  switch (annotationRecord.$Type) {
@@ -751,14 +754,14 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
751
754
  case "com.sap.vocabularies.UI.v1.CollectionFacet" /* UIAnnotationTypes.CollectionFacet */: {
752
755
  const annotationPath = getAnnotationPathUsingFullyQualifiedName(entityType, annotationRecord.fullyQualifiedName);
753
756
  const facet = (facets[section.key] = {
754
- base: ux_specification_types_1.FacetBase.CollectionFacet,
757
+ base: ux_specification_types_2.FacetBase.CollectionFacet,
755
758
  facets: {},
756
759
  ID: section.ID,
757
760
  annotationPath: annotationPath,
758
761
  Label: section.label,
759
762
  namespace: section.namespace
760
763
  });
761
- if (!facet.ID && oDataVersion === ux_specification_types_1.FioriElementsVersion.v4) {
764
+ if (!facet.ID && oDataVersion === ux_specification_types_2.FioriElementsVersion.v4) {
762
765
  (0, extensionLogger_1.log)(logger, {
763
766
  severity: "error" /* LogSeverity.Error */,
764
767
  message: i18next_1.default.t('NOID4SECTION', { facet: annotationRecord.fullyQualifiedName })
@@ -779,12 +782,12 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
779
782
  * @param {FioriElementsVersion} oDataVersion - OData version
780
783
  * @param {ExtensionLogger} logger - Logger class for logging messages
781
784
  */
782
- function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, logger) {
785
+ function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
783
786
  const facets = {};
784
787
  if (!entityType || !entityType.annotations) {
785
788
  return;
786
789
  }
787
- const alias = findAlias(ux_specification_types_1.UIVOCABULARY, oDataServiceAVT);
790
+ const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
788
791
  const facetAnnotation = alias && entityType?.annotations?.[alias]?.HeaderFacets;
789
792
  if (facetAnnotation) {
790
793
  const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
@@ -804,12 +807,12 @@ exports.getObjectPageHeaderFacets = getObjectPageHeaderFacets;
804
807
  * @param {FioriElementsVersion} oDataVersion - OData version
805
808
  * @param {ExtensionLogger} logger - Logger class for logging messages
806
809
  */
807
- function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, logger) {
810
+ function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
808
811
  const facets = {};
809
812
  if (!entityType || !entityType.annotations) {
810
813
  return;
811
814
  }
812
- const alias = findAlias(ux_specification_types_1.UIVOCABULARY, oDataServiceAVT);
815
+ const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
813
816
  const facetAnnotation = alias && entityType?.annotations[alias]?.Facets;
814
817
  if (facetAnnotation) {
815
818
  const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
@@ -825,24 +828,58 @@ exports.getObjectPageFacets = getObjectPageFacets;
825
828
  /**
826
829
  * Returns the version of Fiori elements (v2/v4) from a given manifest
827
830
  * @param manifest - the manifest.json file
831
+ * @returns FioriElementsVersion
828
832
  */
829
- function getVersionFromManifest(manifest) {
830
- if ((manifest[ux_specification_types_1.ManifestSection.generic] && Object.keys(manifest[ux_specification_types_1.ManifestSection.generic]).length > 0) ||
831
- (manifest[ux_specification_types_1.ManifestSection.ovp] && Object.keys(manifest[ux_specification_types_1.ManifestSection.ovp]).length > 0)) {
832
- return ux_specification_types_1.FioriElementsVersion.v2;
833
+ function getFEVersionFromManifest(manifest) {
834
+ if ((manifest[ux_specification_types_2.ManifestSection.generic] && Object.keys(manifest[ux_specification_types_2.ManifestSection.generic]).length > 0) ||
835
+ (manifest[ux_specification_types_2.ManifestSection.ovp] && Object.keys(manifest[ux_specification_types_2.ManifestSection.ovp]).length > 0)) {
836
+ return ux_specification_types_2.FioriElementsVersion.v2;
833
837
  }
834
838
  else {
835
- const targets = manifest[ux_specification_types_1.ManifestSection.ui5]?.routing?.targets;
836
- if (targets &&
837
- Object.keys(targets).find((targetKey) => exports.V4_TEMPLATES.indexOf(targets[targetKey].name) > -1)) {
838
- return ux_specification_types_1.FioriElementsVersion.v4;
839
+ const targets = manifest[ux_specification_types_2.ManifestSection.ui5]?.routing?.targets;
840
+ const libs = manifest[ux_specification_types_2.ManifestSection.ui5]?.dependencies?.libs;
841
+ if ((targets &&
842
+ Object.keys(targets).find((targetKey) => exports.V4_TEMPLATES.indexOf(targets[targetKey].name) > -1)) ||
843
+ (libs && Object.keys(libs).find((lib) => exports.V4_LIBS.indexOf(lib) > -1))) {
844
+ return ux_specification_types_2.FioriElementsVersion.v4;
839
845
  }
840
846
  else {
841
847
  return undefined;
842
848
  }
843
849
  }
844
850
  }
845
- exports.getVersionFromManifest = getVersionFromManifest;
851
+ exports.getFEVersionFromManifest = getFEVersionFromManifest;
852
+ /**
853
+ * Get the main service name from the manifest.
854
+ * LROP: by definition the service name can be read from the UI5 model with "" as name.
855
+ * OVP: the main model needs to be read from the sap.ovp config and then the service can be derived.
856
+ *
857
+ * @param manifest - application manifest
858
+ * @returns - main service name
859
+ */
860
+ function getMainService(manifest) {
861
+ const model = typeof manifest?.[ux_specification_types_2.ManifestSection.ovp]?.globalFilterModel === 'string'
862
+ ? manifest[ux_specification_types_2.ManifestSection.ovp].globalFilterModel
863
+ : '';
864
+ return typeof manifest?.[ux_specification_types_2.ManifestSection.ui5]?.models?.[model]?.dataSource === 'string'
865
+ ? manifest[ux_specification_types_2.ManifestSection.ui5].models[model].dataSource
866
+ : undefined;
867
+ }
868
+ exports.getMainService = getMainService;
869
+ /**
870
+ * Returns the oData version of the service (if any) from a given manifest
871
+ * @param manifest - the manifest.json file
872
+ * @returns the OData version
873
+ */
874
+ function getODataVersionFromManifest(manifest) {
875
+ const mainService = getMainService(manifest);
876
+ if (!mainService) {
877
+ return ux_specification_types_1.OdataVersion.v2;
878
+ }
879
+ const dataSource = manifest[ux_specification_types_2.ManifestSection.app].dataSources?.[mainService];
880
+ return dataSource?.settings?.odataVersion === '4.0' ? ux_specification_types_1.OdataVersion.v4 : ux_specification_types_1.OdataVersion.v2;
881
+ }
882
+ exports.getODataVersionFromManifest = getODataVersionFromManifest;
846
883
  /**
847
884
  * Determines the template type of a V2 app
848
885
  * @param manifest - the manifest.json file
@@ -851,27 +888,27 @@ exports.getVersionFromManifest = getVersionFromManifest;
851
888
  */
852
889
  function determineV2Template(manifest, logger) {
853
890
  let templateType;
854
- if (manifest[ux_specification_types_1.ManifestSection.generic]) {
855
- const v2Pages = manifest[ux_specification_types_1.ManifestSection.generic].pages;
891
+ if (manifest[ux_specification_types_2.ManifestSection.generic]) {
892
+ const v2Pages = manifest[ux_specification_types_2.ManifestSection.generic].pages;
856
893
  if (!v2Pages) {
857
894
  (0, extensionLogger_1.log)(logger, {
858
895
  severity: "error" /* LogSeverity.Error */,
859
896
  message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
860
897
  location: {
861
- path: ux_specification_types_1.MANIFESTPATH,
862
- range: [ux_specification_types_1.ManifestSection.generic]
898
+ path: ux_specification_types_2.MANIFESTPATH,
899
+ range: [ux_specification_types_2.ManifestSection.generic]
863
900
  }
864
901
  });
865
902
  return;
866
903
  }
867
904
  for (const pageKey in v2Pages) {
868
905
  const v2Page = v2Pages[pageKey];
869
- if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_1.PageTypeV2.AnalyticalListPage) {
870
- templateType = ux_specification_types_1.TemplateType.AnalyticalListPageV2;
906
+ if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.AnalyticalListPage) {
907
+ templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV2;
871
908
  break;
872
909
  }
873
- else if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_1.PageTypeV2.ListReport) {
874
- templateType = ux_specification_types_1.TemplateType.ListReportObjectPageV2;
910
+ else if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.ListReport) {
911
+ templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV2;
875
912
  break;
876
913
  }
877
914
  }
@@ -880,10 +917,10 @@ function determineV2Template(manifest, logger) {
880
917
  if (!templateType) {
881
918
  (0, extensionLogger_1.log)(logger, {
882
919
  severity: "error" /* LogSeverity.Error */,
883
- message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_1.ManifestSection.generic }),
920
+ message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.generic }),
884
921
  location: {
885
- path: ux_specification_types_1.MANIFESTPATH,
886
- range: [ux_specification_types_1.ManifestSection.generic]
922
+ path: ux_specification_types_2.MANIFESTPATH,
923
+ range: [ux_specification_types_2.ManifestSection.generic]
887
924
  }
888
925
  });
889
926
  }
@@ -899,24 +936,24 @@ exports.determineV2Template = determineV2Template;
899
936
  function determineV4PageTemplateType(v4Page) {
900
937
  let templateType;
901
938
  const pageType = getPageTypeV4(v4Page);
902
- if (pageType === ux_specification_types_1.PageTypeV4.AnalyticalListPage) {
903
- templateType = ux_specification_types_1.TemplateType.AnalyticalListPageV4;
939
+ if (pageType === ux_specification_types_2.PageTypeV4.AnalyticalListPage) {
940
+ templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV4;
904
941
  }
905
- else if (pageType === ux_specification_types_1.PageTypeV4.ListReport) {
942
+ else if (pageType === ux_specification_types_2.PageTypeV4.ListReport) {
906
943
  const viewPath = v4Page.options?.settings?.views?.paths?.[0];
907
- if (viewPath && (viewPath[ux_specification_types_1.ALPViewType.Primary] || viewPath[ux_specification_types_1.ALPViewType.Secondary])) {
908
- templateType = ux_specification_types_1.TemplateType.AnalyticalListPageV4;
944
+ if (viewPath && (viewPath[ux_specification_types_2.ALPViewType.Primary] || viewPath[ux_specification_types_2.ALPViewType.Secondary])) {
945
+ templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV4;
909
946
  }
910
947
  else {
911
- templateType = ux_specification_types_1.TemplateType.ListReportObjectPageV4;
948
+ templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
912
949
  }
913
950
  }
914
- else if (pageType === ux_specification_types_1.PageTypeV4.ObjectPage) {
915
- templateType = ux_specification_types_1.TemplateType.ListReportObjectPageV4;
951
+ else if (pageType === ux_specification_types_2.PageTypeV4.ObjectPage) {
952
+ templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
916
953
  //fixed now for FEOP scenario, bit continue to check if LR/ALP exists
917
954
  }
918
- else if ([ux_specification_types_1.PageTypeV4.CustomPage, ux_specification_types_1.PageTypeV4.FPMCustomPage].includes(pageType)) {
919
- templateType = ux_specification_types_1.TemplateType.FreestylePageV4;
955
+ else if ([ux_specification_types_2.PageTypeV4.CustomPage, ux_specification_types_2.PageTypeV4.FPMCustomPage].includes(pageType)) {
956
+ templateType = ux_specification_types_2.TemplateType.FreestylePageV4;
920
957
  }
921
958
  return templateType;
922
959
  }
@@ -944,29 +981,29 @@ function determineV4TemplateFromPages(v4Pages) {
944
981
  * @returns {TemplateType} the template type
945
982
  */
946
983
  function determineV4Template(manifest, logger) {
947
- const v4Pages = manifest[ux_specification_types_1.ManifestSection.ui5].routing &&
948
- manifest[ux_specification_types_1.ManifestSection.ui5].routing.targets;
984
+ const v4Pages = manifest[ux_specification_types_2.ManifestSection.ui5].routing &&
985
+ manifest[ux_specification_types_2.ManifestSection.ui5].routing.targets;
949
986
  // if there are no pages in routing targets, we use LROPV4 as default template type
950
987
  if (!v4Pages || Object.keys(v4Pages).length === 0) {
951
988
  (0, extensionLogger_1.log)(logger, {
952
989
  severity: "info" /* LogSeverity.Info */,
953
990
  message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
954
991
  location: {
955
- path: ux_specification_types_1.MANIFESTPATH,
956
- range: [ux_specification_types_1.ManifestSection.ui5, 'routing']
992
+ path: ux_specification_types_2.MANIFESTPATH,
993
+ range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
957
994
  }
958
995
  });
959
- return ux_specification_types_1.TemplateType.ListReportObjectPageV4;
996
+ return ux_specification_types_2.TemplateType.ListReportObjectPageV4;
960
997
  }
961
998
  // else try to determine template type from routing targets
962
999
  const templateType = determineV4TemplateFromPages(v4Pages);
963
1000
  if (!templateType) {
964
1001
  (0, extensionLogger_1.log)(logger, {
965
1002
  severity: "error" /* LogSeverity.Error */,
966
- message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_1.ManifestSection.ui5 }),
1003
+ message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.ui5 }),
967
1004
  location: {
968
- path: ux_specification_types_1.MANIFESTPATH,
969
- range: [ux_specification_types_1.ManifestSection.ui5, 'routing', 'targets']
1005
+ path: ux_specification_types_2.MANIFESTPATH,
1006
+ range: [ux_specification_types_2.ManifestSection.ui5, 'routing', 'targets']
970
1007
  }
971
1008
  });
972
1009
  }
@@ -982,13 +1019,13 @@ exports.determineV4Template = determineV4Template;
982
1019
  */
983
1020
  function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
984
1021
  let templateType;
985
- if (manifest[ux_specification_types_1.ManifestSection.ovp]) {
986
- templateType = ux_specification_types_1.TemplateType.OverviewPageV2;
1022
+ if (manifest[ux_specification_types_2.ManifestSection.ovp]) {
1023
+ templateType = ux_specification_types_2.TemplateType.OverviewPageV2;
987
1024
  }
988
- else if (fioriElementsVersion === ux_specification_types_1.FioriElementsVersion.v2) {
1025
+ else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v2) {
989
1026
  templateType = determineV2Template(manifest, logger);
990
1027
  }
991
- else if (fioriElementsVersion === ux_specification_types_1.FioriElementsVersion.v4) {
1028
+ else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v4) {
992
1029
  templateType = determineV4Template(manifest, logger);
993
1030
  }
994
1031
  return templateType;
@@ -1002,12 +1039,12 @@ exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
1002
1039
  */
1003
1040
  function addSectionTitleAndDescription(facet, section, facetKey) {
1004
1041
  if (facet?.ID) {
1005
- section.title = ux_specification_types_1.FacetTitlePrefix + facet.ID;
1006
- section[ux_specification_types_1.SchemaTag.keys] = [{ name: ux_specification_types_1.SchemaKeyName.id, value: facet.ID }];
1042
+ section.title = ux_specification_types_2.FacetTitlePrefix + facet.ID;
1043
+ section[ux_specification_types_2.SchemaTag.keys] = [{ name: ux_specification_types_2.SchemaKeyName.id, value: facet.ID }];
1007
1044
  }
1008
1045
  else {
1009
1046
  section.title = facetKey.replace(/@com.sap/g, 'com.sap');
1010
- section[ux_specification_types_1.SchemaTag.keys] = [{ name: ux_specification_types_1.SchemaKeyName.id, value: facetKey.replace(ux_specification_types_1.UIVOCABULARYALPHADOT, '') }];
1047
+ section[ux_specification_types_2.SchemaTag.keys] = [{ name: ux_specification_types_2.SchemaKeyName.id, value: facetKey.replace(ux_specification_types_2.UIVOCABULARYALPHADOT, '') }];
1011
1048
  }
1012
1049
  // Description
1013
1050
  if (facet?.Label) {
@@ -1054,8 +1091,8 @@ function createDefaultSection(appSchema, facet, facetKey) {
1054
1091
  properties: {},
1055
1092
  additionalProperties: false
1056
1093
  };
1057
- section[ux_specification_types_1.SchemaTag.isViewNode] = true;
1058
- section[ux_specification_types_1.SchemaTag.annotationPath] = facet.annotationPath;
1094
+ section[ux_specification_types_2.SchemaTag.isViewNode] = true;
1095
+ section[ux_specification_types_2.SchemaTag.annotationPath] = facet.annotationPath;
1059
1096
  addTargetTitleAndSectionDescription(facet, section, facetKey);
1060
1097
  return section;
1061
1098
  }
@@ -1069,8 +1106,8 @@ exports.createDefaultSection = createDefaultSection;
1069
1106
  * @param {boolean} [checkUnresolvableFacets=false] - Check and avoid facets and sections without ID and Target.
1070
1107
  * @returns {FacetSection[]} - Array of facets or sections
1071
1108
  */
1072
- function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_1.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
1073
- const alias = findAlias(ux_specification_types_1.UIVOCABULARY, oDataServiceAVT);
1109
+ function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
1110
+ const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
1074
1111
  let sections = [];
1075
1112
  if (entityType) {
1076
1113
  const facetAnnotation = alias && entityType?.annotations?.[alias]?.Facets;
@@ -1136,12 +1173,12 @@ exports.deleteEmptyStructure = deleteEmptyStructure;
1136
1173
  * @return {string} File name of generic schema.
1137
1174
  */
1138
1175
  const getGenericSchemaFileName = (schemaType) => {
1139
- if (schemaType === ux_specification_types_1.SchemaType.FreestylePage) {
1140
- return ux_specification_types_1.PageTypeV2.CustomPage;
1176
+ if (schemaType === ux_specification_types_2.SchemaType.FreestylePage) {
1177
+ return ux_specification_types_2.PageTypeV2.CustomPage;
1141
1178
  }
1142
- if (schemaType === ux_specification_types_1.SchemaType.FPMCustomPage) {
1179
+ if (schemaType === ux_specification_types_2.SchemaType.FPMCustomPage) {
1143
1180
  // FPM custom pages uses generic schema generated for building blocks
1144
- return ux_specification_types_1.SchemaType.BuildingBlocks;
1181
+ return ux_specification_types_2.SchemaType.BuildingBlocks;
1145
1182
  }
1146
1183
  return `${schemaType}`;
1147
1184
  };
@@ -1158,30 +1195,30 @@ const getSchemaFilePath = (schemaType, pageId, viewId) => {
1158
1195
  };
1159
1196
  switch (schemaType) {
1160
1197
  // Application schema
1161
- case ux_specification_types_1.SchemaType.Application: {
1198
+ case ux_specification_types_2.SchemaType.Application: {
1162
1199
  // File name
1163
1200
  schemaFile.filename = `App`;
1164
1201
  // Full path
1165
- schemaFile.path = `./${ux_specification_types_1.DirName.Schemas}/${schemaFile.filename}`;
1202
+ schemaFile.path = `./${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
1166
1203
  break;
1167
1204
  }
1168
1205
  // List report and object page
1169
- case ux_specification_types_1.SchemaType.ListReport:
1170
- case ux_specification_types_1.SchemaType.ObjectPage: {
1206
+ case ux_specification_types_2.SchemaType.ListReport:
1207
+ case ux_specification_types_2.SchemaType.ObjectPage: {
1171
1208
  // File name
1172
1209
  schemaFile.filename = pageId ? `${schemaType}_${pageId}` : getGenericSchemaFileName(schemaType);
1173
1210
  // Full path
1174
- schemaFile.path = `../${ux_specification_types_1.DirName.Schemas}/${schemaFile.filename}`;
1211
+ schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
1175
1212
  break;
1176
1213
  }
1177
- case ux_specification_types_1.PageTypeV4.FPMCustomPage:
1178
- case ux_specification_types_1.SchemaType.FPMCustomPage: {
1214
+ case ux_specification_types_2.PageTypeV4.FPMCustomPage:
1215
+ case ux_specification_types_2.SchemaType.FPMCustomPage: {
1179
1216
  // File name
1180
1217
  schemaFile.filename = viewId
1181
- ? `${ux_specification_types_1.SchemaType.FPMCustomPage}_${viewId}`
1182
- : getGenericSchemaFileName(ux_specification_types_1.SchemaType.FPMCustomPage);
1218
+ ? `${ux_specification_types_2.SchemaType.FPMCustomPage}_${viewId}`
1219
+ : getGenericSchemaFileName(ux_specification_types_2.SchemaType.FPMCustomPage);
1183
1220
  // Full path
1184
- schemaFile.path = `../${ux_specification_types_1.DirName.Schemas}/${schemaFile.filename}`;
1221
+ schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
1185
1222
  break;
1186
1223
  }
1187
1224
  // Other page configs
@@ -1189,7 +1226,7 @@ const getSchemaFilePath = (schemaType, pageId, viewId) => {
1189
1226
  // File name
1190
1227
  schemaFile.filename = getGenericSchemaFileName(schemaType);
1191
1228
  // Full path
1192
- schemaFile.path = `../${ux_specification_types_1.DirName.Schemas}/${schemaFile.filename}`;
1229
+ schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
1193
1230
  break;
1194
1231
  }
1195
1232
  }
@@ -1207,7 +1244,7 @@ exports.getSchemaFilePath = getSchemaFilePath;
1207
1244
  * @returns {string} Generated page id
1208
1245
  */
1209
1246
  function generatePageId(pageType, entitySet, viewId, pageName) {
1210
- if (pageType === ux_specification_types_1.PageTypeV2.CustomPage) {
1247
+ if (pageType === ux_specification_types_2.PageTypeV2.CustomPage) {
1211
1248
  const names = viewId && viewId.split('.');
1212
1249
  return names && names[names.length - 1] + 'Page';
1213
1250
  }
@@ -1515,7 +1552,7 @@ exports.getJSONPropertyByPath = getJSONPropertyByPath;
1515
1552
  * @returns {string} modified string without namespace
1516
1553
  */
1517
1554
  function removeNamespaces(sId) {
1518
- sId = sId.replace(ux_specification_types_1.UIVOCABULARYDOT, '');
1555
+ sId = sId.replace(ux_specification_types_2.UIVOCABULARYDOT, '');
1519
1556
  sId = sId.replace('com.sap.vocabularies.Communication.v1.', '');
1520
1557
  return sId;
1521
1558
  }
@@ -1526,7 +1563,7 @@ exports.removeNamespaces = removeNamespaces;
1526
1563
  * @returns {string} modified string with replaced namespaces
1527
1564
  */
1528
1565
  function replaceNamespaces(sId) {
1529
- sId = sId.replace(ux_specification_types_1.UIVOCABULARY, 'UI');
1566
+ sId = sId.replace(ux_specification_types_2.UIVOCABULARY, 'UI');
1530
1567
  sId = sId.replace('com.sap.vocabularies.Communication.v1', 'Communication');
1531
1568
  return sId;
1532
1569
  }