@sap/ux-specification 1.71.37 → 1.71.41

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 (123) hide show
  1. package/CHANGELOG.md +101 -3
  2. package/dist/index-min.js +1 -1
  3. package/dist/schemas/v2/AnalyticalListPageConfig.json +394 -44
  4. package/dist/schemas/v2/ListReportConfig.json +257 -78
  5. package/dist/schemas/v2/ObjectPageConfig.json +220 -66
  6. package/dist/schemas/v2/OverviewPageConfig.json +80 -38
  7. package/dist/scripts/extractDocu.d.ts +1 -0
  8. package/dist/scripts/extractDocu.js +311 -0
  9. package/dist/scripts/extractDocu.js.map +1 -0
  10. package/dist/scripts/spec.d.ts +1 -0
  11. package/dist/scripts/spec.js +114 -0
  12. package/dist/scripts/spec.js.map +1 -0
  13. package/dist/scripts/to-json-schema.d.ts +10 -0
  14. package/dist/scripts/to-json-schema.js +109 -0
  15. package/dist/scripts/to-json-schema.js.map +1 -0
  16. package/dist/specification/v2/index-min.js +1 -1
  17. package/dist/src/api.js +2 -1
  18. package/dist/src/api.js.map +1 -1
  19. package/dist/src/apiTypes.d.ts +2 -1
  20. package/dist/src/extensionLogger.js +6 -0
  21. package/dist/src/extensionLogger.js.map +1 -1
  22. package/dist/src/specification/common/types.d.ts +4 -0
  23. package/dist/src/specification/common/types.js +5 -0
  24. package/dist/src/specification/common/types.js.map +1 -1
  25. package/dist/src/specification/common/webapp/manifest/Manifest.d.ts +7 -0
  26. package/dist/src/specification/common/webapp/manifest/Manifest.js +8 -0
  27. package/dist/src/specification/common/webapp/manifest/Manifest.js.map +1 -1
  28. package/dist/src/specification/v2/controls/Card.d.ts +4 -0
  29. package/dist/src/specification/v2/controls/Card.js.map +1 -1
  30. package/dist/src/specification/v2/controls/FilterBar.d.ts +15 -0
  31. package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +9 -0
  32. package/dist/src/specification/v2/controls/ObjectPageTable.js.map +1 -1
  33. package/dist/src/specification/v2/controls/ObjectPageToolBar.d.ts +19 -0
  34. package/dist/src/specification/v2/controls/ObjectPageToolBar.js +3 -0
  35. package/dist/src/specification/v2/controls/ObjectPageToolBar.js.map +1 -0
  36. package/dist/src/specification/v2/controls/Table.d.ts +54 -5
  37. package/dist/src/specification/v2/controls/Table.js.map +1 -1
  38. package/dist/src/specification/v2/controls/ToolBar.d.ts +19 -0
  39. package/dist/src/specification/v2/controls/ToolBar.js +3 -0
  40. package/dist/src/specification/v2/controls/ToolBar.js.map +1 -0
  41. package/dist/src/specification/v2/controls/index.d.ts +2 -0
  42. package/dist/src/specification/v2/controls/index.js.map +1 -1
  43. package/dist/src/specification/v2/pages/AnalyticalListPageConfig.d.ts +2 -2
  44. package/dist/src/specification/v2/webapp/manifest/sapUi5.d.ts +2 -1
  45. package/dist/src/specification/v2/webapp/manifest/sapUi5.js +1 -0
  46. package/dist/src/specification/v2/webapp/manifest/sapUi5.js.map +1 -1
  47. package/dist/src/sync/common/appProvider.d.ts +3 -1
  48. package/dist/src/sync/common/appProvider.js +2 -1
  49. package/dist/src/sync/common/appProvider.js.map +1 -1
  50. package/dist/src/sync/common/decoration/control.js +7 -4
  51. package/dist/src/sync/common/decoration/control.js.map +1 -1
  52. package/dist/src/sync/common/flexUtils.d.ts +3 -2
  53. package/dist/src/sync/common/flexUtils.js +4 -1
  54. package/dist/src/sync/common/flexUtils.js.map +1 -1
  55. package/dist/src/sync/common/i18n.json +3 -1
  56. package/dist/src/sync/common/importProject.js +9 -7
  57. package/dist/src/sync/common/importProject.js.map +1 -1
  58. package/dist/src/sync/common/types.d.ts +20 -4
  59. package/dist/src/sync/common/types.js +20 -4
  60. package/dist/src/sync/common/types.js.map +1 -1
  61. package/dist/src/sync/common/utils.d.ts +64 -20
  62. package/dist/src/sync/common/utils.js +216 -90
  63. package/dist/src/sync/common/utils.js.map +1 -1
  64. package/dist/src/sync/v2/application.js +7 -6
  65. package/dist/src/sync/v2/application.js.map +1 -1
  66. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.d.ts +1 -0
  67. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js +5 -5
  68. package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js.map +1 -1
  69. package/dist/src/sync/v2/export/controls/Card.d.ts +1 -0
  70. package/dist/src/sync/v2/export/controls/Card.js +7 -0
  71. package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
  72. package/dist/src/sync/v2/export/controls/FilterBar.d.ts +3 -0
  73. package/dist/src/sync/v2/export/controls/FilterBar.js +36 -0
  74. package/dist/src/sync/v2/export/controls/FilterBar.js.map +1 -1
  75. package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js +2 -1
  76. package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js.map +1 -1
  77. package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +1 -0
  78. package/dist/src/sync/v2/export/controls/ObjectPageTable.js +12 -0
  79. package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
  80. package/dist/src/sync/v2/export/controls/Table.d.ts +11 -2
  81. package/dist/src/sync/v2/export/controls/Table.js +39 -6
  82. package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
  83. package/dist/src/sync/v2/export/export.d.ts +2 -2
  84. package/dist/src/sync/v2/export/export.js +15 -13
  85. package/dist/src/sync/v2/export/export.js.map +1 -1
  86. package/dist/src/sync/v2/export/pages/AnalyticalListPage.js +1 -1
  87. package/dist/src/sync/v2/generate/analyticalListReport.d.ts +3 -1
  88. package/dist/src/sync/v2/generate/analyticalListReport.js +59 -16
  89. package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
  90. package/dist/src/sync/v2/generate/generate.d.ts +5 -2
  91. package/dist/src/sync/v2/generate/generate.js +8 -5
  92. package/dist/src/sync/v2/generate/generate.js.map +1 -1
  93. package/dist/src/sync/v2/generate/listReport.d.ts +6 -2
  94. package/dist/src/sync/v2/generate/listReport.js +60 -23
  95. package/dist/src/sync/v2/generate/listReport.js.map +1 -1
  96. package/dist/src/sync/v2/generate/objectPage.js +74 -52
  97. package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
  98. package/dist/src/sync/v2/generate/utils.d.ts +19 -2
  99. package/dist/src/sync/v2/generate/utils.js +134 -55
  100. package/dist/src/sync/v2/generate/utils.js.map +1 -1
  101. package/dist/src/sync/v2/import/app/appProvider.d.ts +3 -2
  102. package/dist/src/sync/v2/import/app/appProvider.js +10 -9
  103. package/dist/src/sync/v2/import/app/appProvider.js.map +1 -1
  104. package/dist/src/sync/v2/import/app/ovpProvider.js +6 -6
  105. package/dist/src/sync/v2/import/app/ovpProvider.js.map +1 -1
  106. package/dist/src/sync/v2/import/common/index.d.ts +1 -0
  107. package/dist/src/sync/v2/import/common/index.js +11 -7
  108. package/dist/src/sync/v2/import/common/index.js.map +1 -1
  109. package/dist/src/sync/v2/import/pages/analyticalListPage.d.ts +10 -0
  110. package/dist/src/sync/v2/import/pages/analyticalListPage.js +24 -13
  111. package/dist/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
  112. package/dist/src/sync/v2/import/pages/listReport.d.ts +10 -0
  113. package/dist/src/sync/v2/import/pages/listReport.js +24 -14
  114. package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
  115. package/dist/src/sync/v2/import/pages/objectPage.js +15 -13
  116. package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
  117. package/dist/src/sync/v2/import/pages/overviewPage.js +5 -3
  118. package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
  119. package/dist/src/sync/v2/import/utils.d.ts +0 -12
  120. package/dist/src/sync/v2/import/utils.js +0 -35
  121. package/dist/src/sync/v2/import/utils.js.map +1 -1
  122. package/dist/test/test-utils/utils.d.ts +0 -1
  123. package/package.json +8 -8
@@ -15,6 +15,17 @@ var FileName;
15
15
  FileName["App"] = "app.json";
16
16
  })(FileName = exports.FileName || (exports.FileName = {}));
17
17
  exports.FacetTitlePrefix = 'Facet ID: ';
18
+ var SectionType;
19
+ (function (SectionType) {
20
+ SectionType["Section"] = "Section";
21
+ SectionType["HeaderSection"] = "HeaderSection";
22
+ })(SectionType = exports.SectionType || (exports.SectionType = {}));
23
+ var ArtifactType;
24
+ (function (ArtifactType) {
25
+ ArtifactType["Manifest"] = "Manifest";
26
+ ArtifactType["FlexChange"] = "FlexChange";
27
+ ArtifactType["Annotation"] = "Annotation";
28
+ })(ArtifactType = exports.ArtifactType || (exports.ArtifactType = {}));
18
29
  var ControlType;
19
30
  (function (ControlType) {
20
31
  ControlType["Table"] = "sap.m.Table";
@@ -35,14 +46,17 @@ var ControlType;
35
46
  })(ControlType = exports.ControlType || (exports.ControlType = {}));
36
47
  var FacetBase;
37
48
  (function (FacetBase) {
38
- FacetBase["LineItemFacet"] = "LineItemFacet";
49
+ FacetBase["LineItem"] = "LineItem";
39
50
  FacetBase["CollectionFacet"] = "CollectionFacet";
40
- FacetBase["ChartFacet"] = "ChartFacet";
41
- FacetBase["FormFacet"] = "FormFacet";
51
+ FacetBase["Chart"] = "Chart";
52
+ FacetBase["Form"] = "Form";
42
53
  FacetBase["Identification"] = "Identification";
54
+ FacetBase["DataPoint"] = "DataPoint";
55
+ FacetBase["Address"] = "Address";
56
+ FacetBase["Contact"] = "Contact";
43
57
  FacetBase["Unknown"] = "";
44
58
  })(FacetBase = exports.FacetBase || (exports.FacetBase = {}));
45
- exports.BindingPropertyRegexAsString = "^{[A-Za-z0-9{}&$@#!? _|,<>'()[\\]\\/:=.]+}$";
59
+ exports.BindingPropertyRegexAsString = "^{[A-Za-z0-9{}&$!@#? _|,<>'()[\\]\\/:=.]+}$";
46
60
  var ViewTemplateType;
47
61
  (function (ViewTemplateType) {
48
62
  ViewTemplateType["ResponsiveTableColumnsExtension"] = "ResponsiveTableColumnsExtension";
@@ -51,4 +65,6 @@ var ViewTemplateType;
51
65
  ViewTemplateType["GridTableColumnsExtension"] = "GridTableColumnsExtension";
52
66
  ViewTemplateType["ResponsiveTableCellsExtension"] = "ResponsiveTableCellsExtension";
53
67
  })(ViewTemplateType = exports.ViewTemplateType || (exports.ViewTemplateType = {}));
68
+ exports.METADATAPATH = 'webapp/localService/metadata.xml';
69
+ exports.MANIFESTPATH = 'webapp/manifest.json';
54
70
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sync/common/types.ts"],"names":[],"mappings":";;AAGA,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,wCAAqB,CAAA;AACzB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AACD,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,+BAAoB,CAAA;IACpB,0BAAe,CAAA;AACnB,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB;AACD,IAAY,QAEX;AAFD,WAAY,QAAQ;IAChB,4BAAgB,CAAA;AACpB,CAAC,EAFW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAEnB;AACY,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAQ7C,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACnB,oCAAqB,CAAA;IACrB,2CAA4B,CAAA;IAC5B,+DAAgD,CAAA;IAChD,2EAA4D,CAAA;IAC5D,+DAAgD,CAAA;IAChD,sCAAuB,CAAA;IACvB,4DAA6C,CAAA;IAC7C,sCAAuB,CAAA;IACvB,qFAAsE,CAAA;IACtE,kEAAmD,CAAA;IACnD,6DAA8C,CAAA;IAC9C,6DAA8C,CAAA;IAC9C,gDAAiC,CAAA;IACjC,0CAA2B,CAAA;IAC3B,gDAAiC,CAAA;AACrC,CAAC,EAhBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAgBtB;AAyHD,IAAY,SAOX;AAPD,WAAY,SAAS;IACjB,4CAA+B,CAAA;IAC/B,gDAAmC,CAAA;IACnC,sCAAyB,CAAA;IACzB,oCAAuB,CAAA;IACvB,8CAAiC,CAAA;IACjC,yBAAY,CAAA;AAChB,CAAC,EAPW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAOpB;AA8CY,QAAA,4BAA4B,GAAG,6CAA6C,CAAC;AAE1F,IAAY,gBAMX;AAND,WAAY,gBAAgB;IACxB,uFAAmE,CAAA;IACnE,uFAAmE,CAAA;IACnE,2EAAuD,CAAA;IACvD,2EAAuD,CAAA;IACvD,mFAA+D,CAAA;AACnE,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sync/common/types.ts"],"names":[],"mappings":";;AAGA,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,wCAAqB,CAAA;AACzB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AACD,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,+BAAoB,CAAA;IACpB,0BAAe,CAAA;AACnB,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB;AACD,IAAY,QAEX;AAFD,WAAY,QAAQ;IAChB,4BAAgB,CAAA;AACpB,CAAC,EAFW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAEnB;AACY,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAQ7C,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,kCAAmB,CAAA;IACnB,8CAA+B,CAAA;AACnC,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAED,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qCAAqB,CAAA;IACrB,yCAAyB,CAAA;IACzB,yCAAyB,CAAA;AAC7B,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACnB,oCAAqB,CAAA;IACrB,2CAA4B,CAAA;IAC5B,+DAAgD,CAAA;IAChD,2EAA4D,CAAA;IAC5D,+DAAgD,CAAA;IAChD,sCAAuB,CAAA;IACvB,4DAA6C,CAAA;IAC7C,sCAAuB,CAAA;IACvB,qFAAsE,CAAA;IACtE,kEAAmD,CAAA;IACnD,6DAA8C,CAAA;IAC9C,6DAA8C,CAAA;IAC9C,gDAAiC,CAAA;IACjC,0CAA2B,CAAA;IAC3B,gDAAiC,CAAA;AACrC,CAAC,EAhBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAgBtB;AAyHD,IAAY,SAUX;AAVD,WAAY,SAAS;IACjB,kCAAqB,CAAA;IACrB,gDAAmC,CAAA;IACnC,4BAAe,CAAA;IACf,0BAAa,CAAA;IACb,8CAAiC,CAAA;IACjC,oCAAuB,CAAA;IACvB,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;IACnB,yBAAY,CAAA;AAChB,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB;AAgDY,QAAA,4BAA4B,GAAG,6CAA6C,CAAC;AAE1F,IAAY,gBAMX;AAND,WAAY,gBAAgB;IACxB,uFAAmE,CAAA;IACnE,uFAAmE,CAAA;IACnE,2EAAuD,CAAA;IACvD,2EAAuD,CAAA;IACvD,mFAA+D,CAAA;AACnE,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B;AAEY,QAAA,YAAY,GAAG,kCAAkC,CAAC;AAClD,QAAA,YAAY,GAAG,sBAAsB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { FacetConfigs, FileData, FacetConfig, FacetSection, SchemaFilePath } from './types';
2
- import { AnnotationTerm, CollectionFacet, ConverterOutput, DataFieldAbstractTypes, EntityType, ReferenceFacet, ReferenceURLFacet } from '@sap-ux/vocabularies-types';
2
+ import { AnnotationTerm, CollectionFacet, ConverterOutput, LineItem, DataFieldAbstractTypes, EntityType, PropertyAnnotations, PropertyPath, ReferenceFacet, ReferenceURLFacet } from '@sap-ux/vocabularies-types';
3
3
  import { FioriElementsVersion, Manifest, PageType } from '../../specification/common';
4
4
  import { SchemaType } from '../../specification/schemaAccess';
5
5
  import { ExtensionLogger } from '../../apiTypes';
@@ -11,7 +11,14 @@ export declare enum TemplateType {
11
11
  AnalyticalListPageV2 = "AnalyticalListPageV2"
12
12
  }
13
13
  export declare const DEFINITION_LINK_PREFIX = "#/definitions/";
14
- export declare function readFile(path: string): Promise<string>;
14
+ /**
15
+ * Function returns annotation path for schema based on received params.
16
+ * @param entityTypeName - Entity type name.
17
+ * @param term - Annotation term.
18
+ * @param qualifier - Annotation qualifier.
19
+ * @returns Annotation path based on received params
20
+ */
21
+ export declare const createAnnotationPath: (entityTypeName: string, term: string, qualifier?: string) => string;
15
22
  /**
16
23
  * Parses, merges, and converts a list of annotation files with aid of tools from annotation-vocabularies-tools
17
24
  * @param annotationFiles - The list of all annotation files, in JSON format
@@ -19,35 +26,65 @@ export declare function readFile(path: string): Promise<string>;
19
26
  */
20
27
  export declare function parseAndMergeAndConvert(annotationFiles: FileData[], logger: ExtensionLogger): ConverterOutput;
21
28
  export declare const getAnnotationPropertyValue: (annotationProperty: any) => string;
29
+ /**
30
+ * Checks for Common.Label and overwrites the label from it if present
31
+ * @param {PropertyAnnotations} annotations - property annotations
32
+ * @param {EntityType} entityType - entity type
33
+ * @param {string} label - label, to be actualized
34
+ */
35
+ export declare function evaluateCommonLabel(annotations: PropertyAnnotations, entityType: EntityType, label: string): string;
36
+ /**
37
+ * Determines the label for a property path
38
+ * @param {PropertyPath} propertyPath - property path
39
+ * @param {EntityType} entityType - entity type
40
+ * @returns label, derived from Common.Label or from property value
41
+ */
42
+ export declare function getLabelForPropertyPath(propertyPath: PropertyPath, entityType: EntityType): string;
43
+ /**
44
+ * Determines the label for a LineItem record
45
+ * @param {DataFieldAbstractType} field - Line item record
46
+ * @param {EntityType} entityType - entity type
47
+ * @returns label, derived from Common.Label or from property value
48
+ */
49
+ export declare function getLabelForDataField(field: DataFieldAbstractTypes, entityType: EntityType): string;
22
50
  /**
23
51
  * Determines the description of a data field, e.g. for the column header
24
- * @param dataField - the given record of the line item annotation
52
+ * @param dataFieldAbstract - the given record of the line item annotation
25
53
  * @param entityType - the entity type as part of the AVT ConverterOutput
26
54
  */
27
- export declare function getDatafieldDescription(dataField: DataFieldAbstractTypes, entityType: EntityType): string;
55
+ export declare function getDatafieldDescription(dataFieldAbstract: DataFieldAbstractTypes, entityType: EntityType): string;
28
56
  /**
29
57
  * Return the page type for a given V2 page in manifest
30
58
  * @param name - page component name
31
59
  */
32
60
  export declare function getPageTypeV2(name: string): PageType;
61
+ /**
62
+ * Finds the alias for a given namespace in the references' section of the converted service metadata
63
+ * @param {string} namespace - complete namespace, e.g. 'com.sap.vocabularies.UI.v1'
64
+ * @param {ConverterOutput} oDataServiceAVT - combined service metadata, as returned by annotation vocabularies tools
65
+ * @returns alias for the given namespace
66
+ */
67
+ export declare function findAlias(namespace: string, oDataServiceAVT: ConverterOutput): string;
33
68
  /**
34
69
  * Resolve page section(get key and label->description).
35
70
  * @param facetDefinition - the actual annotation record
36
71
  * @param keyForRelatedFacetKeys - construct key for 'keyForRelatedFacetKeys' property(used to define custom sections) - we should not add '@' symbol there.
37
72
  * @param {FioriElementsVersion} oDataVersion - OData version
73
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
38
74
  * @param {ExtensionLogger} logger - Logger class for logging messages
39
75
  * @returns {FacetSection} - object comprising the relevant facet information
40
76
  */
41
- export declare function getSectionFacet(facetDefinition: AnnotationTerm<CollectionFacet> | AnnotationTerm<ReferenceFacet> | AnnotationTerm<ReferenceURLFacet>, keyForRelatedFacetKeys: boolean, oDataVersion: FioriElementsVersion, sourceEntityType: EntityType, alias: string, logger?: ExtensionLogger): FacetSection | undefined;
77
+ export declare function getSectionFacet(facetDefinition: AnnotationTerm<CollectionFacet> | AnnotationTerm<ReferenceFacet> | AnnotationTerm<ReferenceURLFacet>, keyForRelatedFacetKeys: boolean, oDataVersion: FioriElementsVersion, sourceEntityType: EntityType, oDataServiceAVT: ConverterOutput, logger?: ExtensionLogger): FacetSection | undefined;
42
78
  export declare const getManifestSectionByPathV4: (exportResultManifest: object, path: string, targetAnnotation?: string, targetAnnotationEncoded?: string) => object;
79
+ export declare function getSchemaKeyOfLineItemRecord(lineItemRecord: DataFieldAbstractTypes): string;
43
80
  /**
44
- * Finds the alias for a given namespace in the references' section of the converted service metadata
45
- * @param {string} namespace - complete namespace, e.g. 'com.sap.vocabularies.UI.v1'
46
- * @param {ConverterOutput} oDataServiceAVT - combined service metadata, as returned by annotation vocabularies tools
47
- * @returns alias for the given namespace
81
+ * Retrieve header facet configurations that can be used to generate ObjectPage schemas
82
+ * @param {QualifiedName} entityTypeName - the name of the actual entity type
83
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
84
+ * @param {FioriElementsVersion} oDataVersion - OData version
85
+ * @param {ExtensionLogger} logger - Logger class for logging messages
48
86
  */
49
- export declare function findAlias(namespace: string, oDataServiceAVT: ConverterOutput): string;
50
- export declare function getSchemaKeyOfLineItemRecord(lineItemRecord: DataFieldAbstractTypes): string;
87
+ export declare function getObjectPageHeaderFacets(entityType: EntityType, oDataServiceAVT: ConverterOutput, oDataVersion?: FioriElementsVersion, logger?: ExtensionLogger): FacetConfigs;
51
88
  /**
52
89
  * Retrieve facet configurations that can be used to generate ObjectPage schemas
53
90
  * @param {QualifiedName} entityTypeName - the name of the actual entity type
@@ -74,9 +111,10 @@ export declare function createSectionWithoutProperties(facet?: FacetConfig): obj
74
111
  * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
75
112
  * @param {ExtensionLogger} logger - Logger class for logging messages
76
113
  * @param {FioriElementsVersion} oDataVersion - OData version
114
+ * @param {boolean} [checkUnresolvableFacets=false] - Check and avoid facets and sections without ID and Target.
77
115
  * @returns {FacetSection[]} - Array of facets or sections
78
116
  */
79
- export declare function getObjectPageFacetSection(entityType: EntityType, oDataServiceAVT: ConverterOutput, logger?: ExtensionLogger, oDataVersion?: FioriElementsVersion): FacetSection[];
117
+ export declare function getObjectPageFacetSection(entityType: EntityType, oDataServiceAVT: ConverterOutput, logger?: ExtensionLogger, oDataVersion?: FioriElementsVersion, checkUnresolvableFacets?: boolean): FacetSection[];
80
118
  /**
81
119
  * Cleans empty sub-structures from the export result for manifest
82
120
  * @param manifest - manifest.json part of the export result
@@ -114,8 +152,22 @@ export declare type NextDefinition = {
114
152
  * @param currentConfigObject - current part of the configuration that gets traversed
115
153
  * @param propertyDefinition - definition of a given property in the app schema
116
154
  * @param key - actual key
155
+ * @param factory - factory for creating metadata instances
156
+ * @param pageType - page type
117
157
  */
118
158
  export declare function getNextTargetDefinition(appSchema: object, title: string, currentConfigObject: object, propertyDefinition: object, key: string, factory: MetadataInstanceInterface, pageType: PageType): NextDefinition;
159
+ /**
160
+ * Functions used both by V2 and V4 to add the common definitions for a line item to the app schema
161
+ * @param appSchema - the app specific schema that shall get enhanced
162
+ * @param lineItemAnnotation - the UI.LineItem annotation, comprising all records
163
+ * @param entityType - the entity type as part of the AVT ConverterOutput
164
+ * @param lineItemId - line item ID, as comprise in stable ID
165
+ * @returns the actions definition plus the annotation path to the given line item
166
+ */
167
+ export declare function addCommonLineItemDefinitions(appSchema: object, lineItemAnnotation: AnnotationTerm<LineItem>, entityType: EntityType, lineItemId: string): {
168
+ actions: object;
169
+ lineItemPath: string;
170
+ };
119
171
  /**
120
172
  * Method adds definition for 'RelatedFacetKeys' as enum with describtion and adds references to 'RelatedFacetKeys' for custom section definitions.
121
173
  * @param {object} schema App specific schema that potentially gets enhanced
@@ -134,11 +186,3 @@ export declare function addDefinitionForRelatedFacetKeys(schema: object, section
134
186
  * @returns
135
187
  */
136
188
  export declare const arrayCombineMerge: (target: any, source: any, options: any) => any;
137
- /**
138
- * Function returns annotation path for schema based on received params.
139
- * @param entityTypeName - Entity type name.
140
- * @param term - Annotation term.
141
- * @param qualifier - Annotation qualifier.
142
- * @returns Annotation path based on received params
143
- */
144
- export declare const createAnnotationPath: (entityTypeName: string, term: string, qualifier?: string) => string;
@@ -1,11 +1,4 @@
1
1
  "use strict";
2
- var __importStar = (this && this.__importStar) || function (mod) {
3
- if (mod && mod.__esModule) return mod;
4
- var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
7
- return result;
8
- };
9
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
10
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
4
  };
@@ -15,7 +8,6 @@ const annotation_converter_1 = require("@sap-ux/annotation-converter");
15
8
  const edmx_parser_1 = require("@sap-ux/edmx-parser");
16
9
  const common_1 = require("../../specification/common");
17
10
  const schemaAccess_1 = require("../../specification/schemaAccess");
18
- const fs = __importStar(require("fs"));
19
11
  const i18next_1 = __importDefault(require("i18next"));
20
12
  const extensionLogger_1 = require("../../extensionLogger");
21
13
  const deepmerge_1 = __importDefault(require("deepmerge"));
@@ -27,19 +19,20 @@ var TemplateType;
27
19
  TemplateType["AnalyticalListPageV2"] = "AnalyticalListPageV2";
28
20
  })(TemplateType = exports.TemplateType || (exports.TemplateType = {}));
29
21
  exports.DEFINITION_LINK_PREFIX = '#/definitions/';
30
- async function readFile(path) {
31
- return new Promise((resolve, reject) => {
32
- fs.readFile(path, { encoding: 'utf8' }, (err, data) => {
33
- if (err) {
34
- reject(err);
35
- }
36
- else {
37
- resolve(data);
38
- }
39
- });
40
- });
41
- }
42
- exports.readFile = readFile;
22
+ /**
23
+ * Function returns annotation path for schema based on received params.
24
+ * @param entityTypeName - Entity type name.
25
+ * @param term - Annotation term.
26
+ * @param qualifier - Annotation qualifier.
27
+ * @returns Annotation path based on received params
28
+ */
29
+ exports.createAnnotationPath = (entityTypeName, term, qualifier) => {
30
+ let annotationPath = `/${entityTypeName}/@${term}`;
31
+ if (qualifier) {
32
+ annotationPath += `#${qualifier}`;
33
+ }
34
+ return annotationPath;
35
+ };
43
36
  /**
44
37
  * Parses, merges, and converts a list of annotation files with aid of tools from annotation-vocabularies-tools
45
38
  * @param annotationFiles - The list of all annotation files, in JSON format
@@ -53,9 +46,6 @@ function parseAndMergeAndConvert(annotationFiles, logger) {
53
46
  parseResult.push(edmx_parser_1.parseEDMX(annotationData.fileContent, annotationData.dataSourceUri));
54
47
  });
55
48
  }
56
- if (parseResult.length === 0) {
57
- return;
58
- }
59
49
  const converterOutput = annotation_converter_1.convertTypes(edmx_parser_1.merge(parseResult));
60
50
  if (logger && converterOutput.diagnostics) {
61
51
  for (let index = 0; index < converterOutput.diagnostics.length; index++) {
@@ -78,11 +68,51 @@ function parseAndMergeAndConvert(annotationFiles, logger) {
78
68
  exports.parseAndMergeAndConvert = parseAndMergeAndConvert;
79
69
  exports.getAnnotationPropertyValue = (annotationProperty) => (annotationProperty === null || annotationProperty === void 0 ? void 0 : annotationProperty.value) || (annotationProperty === null || annotationProperty === void 0 ? void 0 : annotationProperty.path);
80
70
  /**
81
- * Common function determining the label for a LineItem record
71
+ * Checks for Common.Label and overwrites the label from it if present
72
+ * @param {PropertyAnnotations} annotations - property annotations
73
+ * @param {EntityType} entityType - entity type
74
+ * @param {string} label - label, to be actualized
75
+ */
76
+ function evaluateCommonLabel(annotations, entityType, label) {
77
+ var _a, _b, _c, _d;
78
+ if ((_a = annotations === null || annotations === void 0 ? void 0 : annotations.Common) === null || _a === void 0 ? void 0 : _a.Label) {
79
+ if (typeof annotations.Common.Label === 'string') {
80
+ label = annotations.Common.Label;
81
+ }
82
+ else if (annotations.Common.Label['type'] === 'Path') {
83
+ const targetProperty = entityType.resolvePath(annotations.Common.Label['path']);
84
+ label = targetProperty.value
85
+ ? targetProperty.value
86
+ : typeof ((_b = targetProperty.Common) === null || _b === void 0 ? void 0 : _b.Label) === 'string'
87
+ ? targetProperty.annotations.Common.Label
88
+ : label;
89
+ }
90
+ else if (typeof ((_d = (_c = annotations.Common) === null || _c === void 0 ? void 0 : _c.Label) === null || _d === void 0 ? void 0 : _d.toString()) === 'string') {
91
+ label = annotations.Common.Label.toString();
92
+ }
93
+ }
94
+ return label;
95
+ }
96
+ exports.evaluateCommonLabel = evaluateCommonLabel;
97
+ /**
98
+ * Determines the label for a property path
99
+ * @param {PropertyPath} propertyPath - property path
100
+ * @param {EntityType} entityType - entity type
101
+ * @returns label, derived from Common.Label or from property value
102
+ */
103
+ function getLabelForPropertyPath(propertyPath, entityType) {
104
+ let label = propertyPath.value;
105
+ label = evaluateCommonLabel(propertyPath.$target.annotations, entityType, label);
106
+ return label;
107
+ }
108
+ exports.getLabelForPropertyPath = getLabelForPropertyPath;
109
+ /**
110
+ * Determines the label for a LineItem record
82
111
  * @param {DataFieldAbstractType} field - Line item record
83
- * @param {EntityType} entityType - Entity type
112
+ * @param {EntityType} entityType - entity type
113
+ * @returns label, derived from Common.Label or from property value
84
114
  */
85
- function getCommonLabel(field, entityType) {
115
+ function getLabelForDataField(field, entityType) {
86
116
  var _a, _b;
87
117
  let label, property;
88
118
  if (field['Value']) {
@@ -100,10 +130,11 @@ function getCommonLabel(field, entityType) {
100
130
  property = field['Target'].$target.Value.$target;
101
131
  }
102
132
  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) {
103
- label = property.annotations.Common.Label.toString();
133
+ label = evaluateCommonLabel(property.annotations, entityType, label);
104
134
  }
105
135
  return label;
106
136
  }
137
+ exports.getLabelForDataField = getLabelForDataField;
107
138
  /**
108
139
  * Function to resolve the dataField label
109
140
  * @param dataFieldLabel - Given dataField label; might be of type string, or an object in case of a path reference
@@ -123,7 +154,8 @@ function getLabel(dataFieldLabel, entityType) {
123
154
  else {
124
155
  const singleProperty = property[0];
125
156
  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) {
126
- return singleProperty.annotations.Common.Label.toString();
157
+ const label = dataFieldLabel;
158
+ return evaluateCommonLabel(singleProperty.annotations, entityType, label);
127
159
  }
128
160
  }
129
161
  }
@@ -133,15 +165,16 @@ function getLabel(dataFieldLabel, entityType) {
133
165
  }
134
166
  /**
135
167
  * Determines the description of a data field, e.g. for the column header
136
- * @param dataField - the given record of the line item annotation
168
+ * @param dataFieldAbstract - the given record of the line item annotation
137
169
  * @param entityType - the entity type as part of the AVT ConverterOutput
138
170
  */
139
- function getDatafieldDescription(dataField, entityType) {
140
- let title = '', propertyCommonLabel;
141
- const dataFieldLabel = getLabel(dataField.Label, entityType);
142
- switch (dataField.$Type) {
171
+ function getDatafieldDescription(dataFieldAbstract, entityType) {
172
+ let title = '', propertyCommonLabel, dataField;
173
+ const dataFieldLabel = getLabel(dataFieldAbstract.Label, entityType);
174
+ switch (dataFieldAbstract.$Type) {
143
175
  case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
144
- propertyCommonLabel = getCommonLabel(dataField, entityType);
176
+ dataField = dataFieldAbstract;
177
+ propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
145
178
  title =
146
179
  dataFieldLabel ||
147
180
  propertyCommonLabel ||
@@ -150,31 +183,36 @@ function getDatafieldDescription(dataField, entityType) {
150
183
  : dataField.Value.value || dataField.Value.path);
151
184
  break;
152
185
  case "com.sap.vocabularies.UI.v1.DataFieldWithUrl" /* DataFieldWithUrl */:
153
- propertyCommonLabel = getCommonLabel(dataField, entityType);
186
+ dataField = dataFieldAbstract;
187
+ propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
154
188
  title =
155
189
  dataFieldLabel ||
156
190
  propertyCommonLabel ||
157
191
  (typeof dataField.Value === 'string' ? dataField.Value : dataField.Value.path);
158
192
  break;
159
193
  case "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */:
160
- propertyCommonLabel = getCommonLabel(dataField, entityType);
194
+ dataField = dataFieldAbstract;
195
+ propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
161
196
  title = dataFieldLabel || propertyCommonLabel || dataField.Target.$target.Title || dataField.Target.value;
162
197
  break;
163
198
  case "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */:
164
199
  case "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* DataFieldForIntentBasedNavigation */:
200
+ dataField = dataFieldAbstract;
165
201
  if (dataFieldLabel) {
166
202
  title = typeof dataFieldLabel === 'string' ? dataFieldLabel : dataField.Action;
167
203
  }
168
204
  else {
169
- title = dataField.Action;
205
+ title = dataFieldAbstract.Action;
170
206
  }
171
207
  break;
172
208
  case "com.sap.vocabularies.UI.v1.DataFieldWithIntentBasedNavigation" /* DataFieldWithIntentBasedNavigation */:
173
- propertyCommonLabel = getCommonLabel(dataField, entityType);
209
+ dataField = dataFieldAbstract;
210
+ propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
174
211
  title = propertyCommonLabel || dataField.Value.path;
175
212
  break;
176
213
  case "com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath" /* DataFieldWithNavigationPath */:
177
- propertyCommonLabel = getCommonLabel(dataField, entityType);
214
+ dataField = dataFieldAbstract;
215
+ propertyCommonLabel = getLabelForDataField(dataFieldAbstract, entityType);
178
216
  title =
179
217
  dataFieldLabel ||
180
218
  propertyCommonLabel ||
@@ -201,15 +239,40 @@ exports.getPageTypeV2 = getPageTypeV2;
201
239
  function getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys = false) {
202
240
  return `${!keyForRelatedFacetKeys ? '@' : ''}${targetAnnotation.qualifier ? targetAnnotation.term + '#' + targetAnnotation.qualifier : targetAnnotation.term}`;
203
241
  }
242
+ /**
243
+ * Finds the alias for a given namespace in the references' section of the converted service metadata
244
+ * @param {string} namespace - complete namespace, e.g. 'com.sap.vocabularies.UI.v1'
245
+ * @param {ConverterOutput} oDataServiceAVT - combined service metadata, as returned by annotation vocabularies tools
246
+ * @returns alias for the given namespace
247
+ */
248
+ function findAlias(namespace, oDataServiceAVT) {
249
+ let aliasReference = oDataServiceAVT.references.find((reference) => {
250
+ return reference.namespace === namespace;
251
+ });
252
+ if (!aliasReference) {
253
+ aliasReference = oDataServiceAVT.references.find((reference) => {
254
+ return reference.alias === namespace;
255
+ });
256
+ }
257
+ if (!aliasReference) {
258
+ aliasReference = oDataServiceAVT.references.find((reference) => {
259
+ return (reference.alias.toUpperCase() ===
260
+ namespace.split('SAP__')[namespace.split('SAP__').length - 1].toUpperCase());
261
+ });
262
+ }
263
+ return aliasReference === null || aliasReference === void 0 ? void 0 : aliasReference.alias;
264
+ }
265
+ exports.findAlias = findAlias;
204
266
  /**
205
267
  * Resolve page section(get key and label->description).
206
268
  * @param facetDefinition - the actual annotation record
207
269
  * @param keyForRelatedFacetKeys - construct key for 'keyForRelatedFacetKeys' property(used to define custom sections) - we should not add '@' symbol there.
208
270
  * @param {FioriElementsVersion} oDataVersion - OData version
271
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
209
272
  * @param {ExtensionLogger} logger - Logger class for logging messages
210
273
  * @returns {FacetSection} - object comprising the relevant facet information
211
274
  */
212
- function getSectionFacet(facetDefinition, keyForRelatedFacetKeys = false, oDataVersion = common_1.FioriElementsVersion.v2, sourceEntityType, alias, logger) {
275
+ function getSectionFacet(facetDefinition, keyForRelatedFacetKeys = false, oDataVersion = common_1.FioriElementsVersion.v2, sourceEntityType, oDataServiceAVT, logger) {
213
276
  var _a, _b;
214
277
  let entityType = sourceEntityType; //default
215
278
  const facetName = facetDefinition.fullyQualifiedName.substr(facetDefinition.fullyQualifiedName.lastIndexOf('@'));
@@ -242,7 +305,9 @@ function getSectionFacet(facetDefinition, keyForRelatedFacetKeys = false, oDataV
242
305
  else {
243
306
  key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1`);
244
307
  }
245
- const annotation = propertyValue.split('.')[propertyValue.split('.').length - 1];
308
+ const lastNavigationPart = navigationParts[navigationParts.length - 1];
309
+ const annotation = lastNavigationPart.substring(lastNavigationPart.lastIndexOf('.') + 1, lastNavigationPart.length);
310
+ const alias = findAlias(lastNavigationPart.substring(0, lastNavigationPart.lastIndexOf('.')).replace('@', ''), oDataServiceAVT);
246
311
  const targetAnnotation = (_b = entityType === null || entityType === void 0 ? void 0 : entityType.annotations[alias]) === null || _b === void 0 ? void 0 : _b[annotation];
247
312
  if (targetAnnotation) {
248
313
  key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
@@ -272,19 +337,6 @@ exports.getManifestSectionByPathV4 = (exportResultManifest, path, targetAnnotati
272
337
  });
273
338
  return exportResultSection;
274
339
  };
275
- /**
276
- * Finds the alias for a given namespace in the references' section of the converted service metadata
277
- * @param {string} namespace - complete namespace, e.g. 'com.sap.vocabularies.UI.v1'
278
- * @param {ConverterOutput} oDataServiceAVT - combined service metadata, as returned by annotation vocabularies tools
279
- * @returns alias for the given namespace
280
- */
281
- function findAlias(namespace, oDataServiceAVT) {
282
- const aliasReference = oDataServiceAVT.references.find((reference) => {
283
- return reference.namespace === namespace;
284
- });
285
- return aliasReference && aliasReference.alias;
286
- }
287
- exports.findAlias = findAlias;
288
340
  function getSchemaKeyOfLineItemRecord(lineItemRecord) {
289
341
  let schemaKey, target, value;
290
342
  switch (lineItemRecord.$Type) {
@@ -361,9 +413,9 @@ exports.getSchemaKeyOfLineItemRecord = getSchemaKeyOfLineItemRecord;
361
413
  * @param {ExtensionLogger} logger - Logger class for logging messages
362
414
  */
363
415
  function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
364
- var _a, _b;
416
+ var _a, _b, _c, _d, _e;
365
417
  const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
366
- const section = getSectionFacet(annotationRecord, false, oDataVersion, entityType, alias, logger);
418
+ const section = getSectionFacet(annotationRecord, false, oDataVersion, entityType, oDataServiceAVT, logger);
367
419
  if (!section) {
368
420
  return;
369
421
  }
@@ -372,7 +424,7 @@ function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataSer
372
424
  let version, annotation, targetAnnotation;
373
425
  let scope = alias;
374
426
  if (path.includes('com.sap.vocabularies.UI.v1.Chart') || path.includes(alias + '.Chart')) {
375
- facets[path] = { base: types_1.FacetBase.ChartFacet };
427
+ facets[path] = { base: types_1.FacetBase.Chart };
376
428
  facets[path]['entityType'] = targetEntityType;
377
429
  }
378
430
  else if (path.includes('com.sap.vocabularies.UI.v1.Identification') || path.includes(alias + '.Identification')) {
@@ -380,7 +432,7 @@ function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataSer
380
432
  targetAnnotation = targetEntityType.annotations[scope][annotation];
381
433
  facets[path] = { base: types_1.FacetBase.Identification };
382
434
  facets[path]['entityType'] = targetEntityType;
383
- facets[path]['form'] = targetAnnotation;
435
+ facets[path]['target'] = targetAnnotation;
384
436
  }
385
437
  else if (path.includes('com.sap.vocabularies.UI.v1.LineItem') || path.includes(alias + '.LineItem')) {
386
438
  if (entityType) {
@@ -393,14 +445,29 @@ function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataSer
393
445
  pathParts[pathParts.length - 1] = '@com.sap.vocabularies.UI.v1.LineItem';
394
446
  path = pathParts.join('::');
395
447
  }
396
- facets[path] = { base: types_1.FacetBase.LineItemFacet };
448
+ facets[path] = { base: types_1.FacetBase.LineItem };
397
449
  facets[path]['lineItem'] = (_a = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _a === void 0 ? void 0 : _a.$target;
398
450
  facets[path]['entityType'] = targetEntityType;
399
451
  }
400
452
  }
401
453
  else if (path.includes('com.sap.vocabularies.UI.v1.FieldGroup') || path.includes(alias + '.FieldGroup')) {
402
- facets[path] = { base: types_1.FacetBase.FormFacet };
403
- facets[path]['form'] = (_b = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _b === void 0 ? void 0 : _b.$target;
454
+ facets[path] = { base: types_1.FacetBase.Form };
455
+ facets[path]['target'] = (_b = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _b === void 0 ? void 0 : _b.$target;
456
+ facets[path]['entityType'] = targetEntityType;
457
+ }
458
+ else if (path.includes('com.sap.vocabularies.UI.v1.DataPoint') || path.includes(alias + '.DataPoint')) {
459
+ facets[path] = { base: types_1.FacetBase.DataPoint };
460
+ facets[path].target = (_c = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _c === void 0 ? void 0 : _c.$target;
461
+ facets[path]['entityType'] = targetEntityType;
462
+ }
463
+ else if (path.includes('com.sap.vocabularies.Communication.v1.Contact') || path.includes(alias + '.Contact')) {
464
+ facets[path] = { base: types_1.FacetBase.Contact };
465
+ facets[path].target = (_d = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _d === void 0 ? void 0 : _d.$target;
466
+ facets[path]['entityType'] = targetEntityType;
467
+ }
468
+ else if (path.includes('com.sap.vocabularies.Communication.v1.Address') || path.includes(alias + '.Address')) {
469
+ facets[path] = { base: types_1.FacetBase.Address };
470
+ facets[path].target = (_e = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _e === void 0 ? void 0 : _e.$target;
404
471
  facets[path]['entityType'] = targetEntityType;
405
472
  }
406
473
  else {
@@ -415,6 +482,12 @@ function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataSer
415
482
  if (annotationRecord.ID) {
416
483
  facets[path]['ID'] = annotationRecord.ID;
417
484
  }
485
+ else if (oDataVersion === common_1.FioriElementsVersion.v4) {
486
+ extensionLogger_1.log(logger, {
487
+ severity: "error" /* Error */,
488
+ message: i18next_1.default.t('NOID4SECTION', { facet: annotationRecord.fullyQualifiedName })
489
+ });
490
+ }
418
491
  if (section && section.entityType) {
419
492
  facets[path].entityType = section.entityType;
420
493
  }
@@ -431,14 +504,14 @@ function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataSer
431
504
  * @param {ExtensionLogger} logger - Logger class for logging messages
432
505
  */
433
506
  function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
507
+ var _a;
434
508
  switch (annotationRecord.$Type) {
435
509
  case "com.sap.vocabularies.UI.v1.ReferenceFacet" /* ReferenceFacet */: {
436
510
  evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion, logger);
437
511
  break;
438
512
  }
439
513
  case "com.sap.vocabularies.UI.v1.CollectionFacet" /* CollectionFacet */: {
440
- const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
441
- const section = getSectionFacet(annotationRecord, false, oDataVersion, entityType, alias, logger);
514
+ const section = getSectionFacet(annotationRecord, false, oDataVersion, entityType, oDataServiceAVT, logger);
442
515
  if (section) {
443
516
  const annotationPath = `/${entityType.fullyQualifiedName}/${annotationRecord.fullyQualifiedName.split(entityType.fullyQualifiedName)[1]}`;
444
517
  const facet = (facets[section.key] = {
@@ -448,7 +521,7 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
448
521
  annotationPath: annotationPath,
449
522
  Label: section.label
450
523
  });
451
- annotationRecord.Facets.forEach((collectionItem) => {
524
+ (_a = annotationRecord.Facets) === null || _a === void 0 ? void 0 : _a.forEach((collectionItem) => {
452
525
  addFacetToConfig(collectionItem, oDataServiceAVT, serviceName, entityType, facet.facets, oDataVersion, logger);
453
526
  });
454
527
  }
@@ -456,6 +529,31 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
456
529
  }
457
530
  }
458
531
  }
532
+ /**
533
+ * Retrieve header facet configurations that can be used to generate ObjectPage schemas
534
+ * @param {QualifiedName} entityTypeName - the name of the actual entity type
535
+ * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
536
+ * @param {FioriElementsVersion} oDataVersion - OData version
537
+ * @param {ExtensionLogger} logger - Logger class for logging messages
538
+ */
539
+ function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
540
+ const facets = {};
541
+ if (!entityType || !entityType.annotations) {
542
+ return;
543
+ }
544
+ const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
545
+ const facetAnnotation = alias && entityType.annotations[alias] && entityType.annotations[alias].HeaderFacets;
546
+ if (facetAnnotation) {
547
+ const lastDot = entityType.fullyQualifiedName.lastIndexOf('.');
548
+ const serviceName = entityType.fullyQualifiedName.substr(0, lastDot);
549
+ // Add facets to configuration
550
+ facetAnnotation.forEach((item) => {
551
+ addFacetToConfig(item, oDataServiceAVT, serviceName, entityType, facets, oDataVersion, logger);
552
+ });
553
+ }
554
+ return facets;
555
+ }
556
+ exports.getObjectPageHeaderFacets = getObjectPageHeaderFacets;
459
557
  /**
460
558
  * Retrieve facet configurations that can be used to generate ObjectPage schemas
461
559
  * @param {QualifiedName} entityTypeName - the name of the actual entity type
@@ -486,7 +584,7 @@ exports.getObjectPageFacets = getObjectPageFacets;
486
584
  * @param manifest - the manifest.json file
487
585
  */
488
586
  function getVersionFromManifest(manifest) {
489
- if (manifest['sap.ui.generic.app'] || manifest['sap.ovp']) {
587
+ if (manifest[common_1.ManifestSection.generic] || manifest[common_1.ManifestSection.ovp]) {
490
588
  return common_1.FioriElementsVersion.v2;
491
589
  }
492
590
  else {
@@ -496,19 +594,19 @@ function getVersionFromManifest(manifest) {
496
594
  exports.getVersionFromManifest = getVersionFromManifest;
497
595
  function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
498
596
  let templateType;
499
- if (manifest['sap.ovp']) {
597
+ if (manifest[common_1.ManifestSection.ovp]) {
500
598
  templateType = TemplateType.OverviewPageV2;
501
599
  }
502
600
  else if (fioriElementsVersion === common_1.FioriElementsVersion.v2) {
503
- if (manifest['sap.ui.generic.app']) {
504
- const v2Pages = manifest['sap.ui.generic.app'].pages;
601
+ if (manifest[common_1.ManifestSection.generic]) {
602
+ const v2Pages = manifest[common_1.ManifestSection.generic].pages;
505
603
  if (!v2Pages) {
506
604
  extensionLogger_1.log(logger, {
507
605
  severity: "error" /* Error */,
508
606
  message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
509
607
  location: {
510
- path: 'webapp/manifest.json',
511
- range: ['sap.ui.generic.app']
608
+ path: types_1.MANIFESTPATH,
609
+ range: [common_1.ManifestSection.generic]
512
610
  }
513
611
  });
514
612
  return;
@@ -529,10 +627,10 @@ function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
529
627
  if (!templateType) {
530
628
  extensionLogger_1.log(logger, {
531
629
  severity: "error" /* Error */,
532
- message: i18next_1.default.t('NOTEMPLATE', { section: 'sap.ui.generic.app' }),
630
+ message: i18next_1.default.t('NOTEMPLATE', { section: common_1.ManifestSection.generic }),
533
631
  location: {
534
- path: 'webapp/manifest.json',
535
- range: ['sap.ui.generic.app']
632
+ path: types_1.MANIFESTPATH,
633
+ range: [common_1.ManifestSection.generic]
536
634
  }
537
635
  });
538
636
  }
@@ -572,9 +670,10 @@ exports.createSectionWithoutProperties = createSectionWithoutProperties;
572
670
  * @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
573
671
  * @param {ExtensionLogger} logger - Logger class for logging messages
574
672
  * @param {FioriElementsVersion} oDataVersion - OData version
673
+ * @param {boolean} [checkUnresolvableFacets=false] - Check and avoid facets and sections without ID and Target.
575
674
  * @returns {FacetSection[]} - Array of facets or sections
576
675
  */
577
- function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2) {
676
+ function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
578
677
  const alias = findAlias('com.sap.vocabularies.UI.v1', oDataServiceAVT);
579
678
  if (entityType) {
580
679
  const facetAnnotation = alias && entityType.annotations && entityType.annotations[alias] && entityType.annotations[alias].Facets;
@@ -582,7 +681,10 @@ function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVer
582
681
  return [];
583
682
  }
584
683
  return facetAnnotation.reduce(function (result, item) {
585
- const section = getSectionFacet(item, true, oDataVersion, entityType, alias, logger);
684
+ if (checkUnresolvableFacets && !item['ID'] && !('Target' in item && item['Target'])) {
685
+ return result;
686
+ }
687
+ const section = getSectionFacet(item, true, oDataVersion, entityType, oDataServiceAVT, logger);
586
688
  if (section) {
587
689
  result.push(section);
588
690
  }
@@ -699,6 +801,8 @@ exports.generatePageId = generatePageId;
699
801
  * @param currentConfigObject - current part of the configuration that gets traversed
700
802
  * @param propertyDefinition - definition of a given property in the app schema
701
803
  * @param key - actual key
804
+ * @param factory - factory for creating metadata instances
805
+ * @param pageType - page type
702
806
  */
703
807
  function getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition, key, factory, pageType) {
704
808
  let nextDefinition = {
@@ -764,6 +868,42 @@ function getNextTargetDefinition(appSchema, title, currentConfigObject, property
764
868
  return nextDefinition;
765
869
  }
766
870
  exports.getNextTargetDefinition = getNextTargetDefinition;
871
+ /**
872
+ * Functions used both by V2 and V4 to add the common definitions for a line item to the app schema
873
+ * @param appSchema - the app specific schema that shall get enhanced
874
+ * @param lineItemAnnotation - the UI.LineItem annotation, comprising all records
875
+ * @param entityType - the entity type as part of the AVT ConverterOutput
876
+ * @param lineItemId - line item ID, as comprise in stable ID
877
+ * @returns the actions definition plus the annotation path to the given line item
878
+ */
879
+ function addCommonLineItemDefinitions(appSchema, lineItemAnnotation, entityType, lineItemId) {
880
+ let lineItemPath;
881
+ appSchema['definitions'][lineItemId] = {
882
+ type: 'object',
883
+ properties: {},
884
+ additionalProperties: false,
885
+ isViewNode: true,
886
+ description: 'Columns'
887
+ };
888
+ //Copy toolbar
889
+ const toolBar = lineItemId === 'LineItems' ? 'ToolBar' : 'ObjectPageToolBar';
890
+ const schemaIdForToolBar = `${toolBar}<${lineItemId}>`;
891
+ appSchema['definitions'][schemaIdForToolBar] = JSON.parse(JSON.stringify(appSchema['definitions'][`${toolBar}`]));
892
+ appSchema['definitions'][schemaIdForToolBar].properties.actions.$ref =
893
+ exports.DEFINITION_LINK_PREFIX + 'Actions<' + lineItemId + '>';
894
+ const schemaIdForActions = `Actions<${lineItemId}>`;
895
+ const actionId = lineItemId === 'LineItems' ? 'Actions' : 'ObjectPageToolBarActions';
896
+ const actions = (appSchema['definitions'][schemaIdForActions] = JSON.parse(JSON.stringify(appSchema['definitions'][actionId])));
897
+ actions.properties = {};
898
+ actions.additionalProperties = false;
899
+ //Determine annotation path
900
+ if (lineItemAnnotation) {
901
+ lineItemPath = exports.createAnnotationPath(entityType.fullyQualifiedName, lineItemAnnotation.term, lineItemAnnotation.qualifier);
902
+ appSchema['definitions'][lineItemId].annotationPath = appSchema['definitions'][schemaIdForToolBar].annotationPath = lineItemPath;
903
+ }
904
+ return { actions, lineItemPath };
905
+ }
906
+ exports.addCommonLineItemDefinitions = addCommonLineItemDefinitions;
767
907
  /**
768
908
  * Method adds definition for 'RelatedFacetKeys' as enum with describtion and adds references to 'RelatedFacetKeys' for custom section definitions.
769
909
  * @param {object} schema App specific schema that potentially gets enhanced
@@ -826,18 +966,4 @@ exports.arrayCombineMerge = (target, source, options) => {
826
966
  });
827
967
  return destination;
828
968
  };
829
- /**
830
- * Function returns annotation path for schema based on received params.
831
- * @param entityTypeName - Entity type name.
832
- * @param term - Annotation term.
833
- * @param qualifier - Annotation qualifier.
834
- * @returns Annotation path based on received params
835
- */
836
- exports.createAnnotationPath = (entityTypeName, term, qualifier) => {
837
- let annotationPath = `/${entityTypeName}/@${term}`;
838
- if (qualifier) {
839
- annotationPath += `#${qualifier}`;
840
- }
841
- return annotationPath;
842
- };
843
969
  //# sourceMappingURL=utils.js.map