@sap-ux/fiori-annotation-api 0.1.0

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 (211) hide show
  1. package/LICENSE +201 -0
  2. package/Readme.md +35 -0
  3. package/dist/avt/annotations.d.ts +72 -0
  4. package/dist/avt/annotations.d.ts.map +1 -0
  5. package/dist/avt/annotations.js +508 -0
  6. package/dist/avt/annotations.js.map +1 -0
  7. package/dist/avt/expressions.d.ts +13 -0
  8. package/dist/avt/expressions.d.ts.map +1 -0
  9. package/dist/avt/expressions.js +34 -0
  10. package/dist/avt/expressions.js.map +1 -0
  11. package/dist/avt/find.d.ts +39 -0
  12. package/dist/avt/find.d.ts.map +1 -0
  13. package/dist/avt/find.js +130 -0
  14. package/dist/avt/find.js.map +1 -0
  15. package/dist/avt/index.d.ts +9 -0
  16. package/dist/avt/index.d.ts.map +1 -0
  17. package/dist/avt/index.js +32 -0
  18. package/dist/avt/index.js.map +1 -0
  19. package/dist/avt/metadata.d.ts +10 -0
  20. package/dist/avt/metadata.d.ts.map +1 -0
  21. package/dist/avt/metadata.js +346 -0
  22. package/dist/avt/metadata.js.map +1 -0
  23. package/dist/avt/pointer.d.ts +12 -0
  24. package/dist/avt/pointer.d.ts.map +1 -0
  25. package/dist/avt/pointer.js +188 -0
  26. package/dist/avt/pointer.js.map +1 -0
  27. package/dist/avt/to-internal.d.ts +81 -0
  28. package/dist/avt/to-internal.d.ts.map +1 -0
  29. package/dist/avt/to-internal.js +340 -0
  30. package/dist/avt/to-internal.js.map +1 -0
  31. package/dist/avt/types.d.ts +3 -0
  32. package/dist/avt/types.d.ts.map +1 -0
  33. package/dist/avt/types.js +3 -0
  34. package/dist/avt/types.js.map +1 -0
  35. package/dist/avt/utils.d.ts +61 -0
  36. package/dist/avt/utils.d.ts.map +1 -0
  37. package/dist/avt/utils.js +87 -0
  38. package/dist/avt/utils.js.map +1 -0
  39. package/dist/cds/adapter.d.ts +112 -0
  40. package/dist/cds/adapter.d.ts.map +1 -0
  41. package/dist/cds/adapter.js +703 -0
  42. package/dist/cds/adapter.js.map +1 -0
  43. package/dist/cds/cds-compiler-tokens.d.ts +30 -0
  44. package/dist/cds/cds-compiler-tokens.d.ts.map +1 -0
  45. package/dist/cds/cds-compiler-tokens.js +57 -0
  46. package/dist/cds/cds-compiler-tokens.js.map +1 -0
  47. package/dist/cds/change.d.ts +347 -0
  48. package/dist/cds/change.d.ts.map +1 -0
  49. package/dist/cds/change.js +232 -0
  50. package/dist/cds/change.js.map +1 -0
  51. package/dist/cds/comments.d.ts +15 -0
  52. package/dist/cds/comments.d.ts.map +1 -0
  53. package/dist/cds/comments.js +56 -0
  54. package/dist/cds/comments.js.map +1 -0
  55. package/dist/cds/deletion.d.ts +59 -0
  56. package/dist/cds/deletion.d.ts.map +1 -0
  57. package/dist/cds/deletion.js +821 -0
  58. package/dist/cds/deletion.js.map +1 -0
  59. package/dist/cds/document.d.ts +52 -0
  60. package/dist/cds/document.d.ts.map +1 -0
  61. package/dist/cds/document.js +98 -0
  62. package/dist/cds/document.js.map +1 -0
  63. package/dist/cds/indent.d.ts +20 -0
  64. package/dist/cds/indent.d.ts.map +1 -0
  65. package/dist/cds/indent.js +86 -0
  66. package/dist/cds/indent.js.map +1 -0
  67. package/dist/cds/index.d.ts +3 -0
  68. package/dist/cds/index.d.ts.map +1 -0
  69. package/dist/cds/index.js +21 -0
  70. package/dist/cds/index.js.map +1 -0
  71. package/dist/cds/pointer.d.ts +23 -0
  72. package/dist/cds/pointer.d.ts.map +1 -0
  73. package/dist/cds/pointer.js +438 -0
  74. package/dist/cds/pointer.js.map +1 -0
  75. package/dist/cds/preprocessor.d.ts +12 -0
  76. package/dist/cds/preprocessor.d.ts.map +1 -0
  77. package/dist/cds/preprocessor.js +338 -0
  78. package/dist/cds/preprocessor.js.map +1 -0
  79. package/dist/cds/references.d.ts +35 -0
  80. package/dist/cds/references.d.ts.map +1 -0
  81. package/dist/cds/references.js +413 -0
  82. package/dist/cds/references.js.map +1 -0
  83. package/dist/cds/service.d.ts +11 -0
  84. package/dist/cds/service.d.ts.map +1 -0
  85. package/dist/cds/service.js +37 -0
  86. package/dist/cds/service.js.map +1 -0
  87. package/dist/cds/utils.d.ts +35 -0
  88. package/dist/cds/utils.d.ts.map +1 -0
  89. package/dist/cds/utils.js +75 -0
  90. package/dist/cds/utils.js.map +1 -0
  91. package/dist/cds/writer.d.ts +104 -0
  92. package/dist/cds/writer.d.ts.map +1 -0
  93. package/dist/cds/writer.js +1086 -0
  94. package/dist/cds/writer.js.map +1 -0
  95. package/dist/change-converter.d.ts +54 -0
  96. package/dist/change-converter.d.ts.map +1 -0
  97. package/dist/change-converter.js +639 -0
  98. package/dist/change-converter.js.map +1 -0
  99. package/dist/error.d.ts +35 -0
  100. package/dist/error.d.ts.map +1 -0
  101. package/dist/error.js +64 -0
  102. package/dist/error.js.map +1 -0
  103. package/dist/fiori-service.d.ts +130 -0
  104. package/dist/fiori-service.d.ts.map +1 -0
  105. package/dist/fiori-service.js +362 -0
  106. package/dist/fiori-service.js.map +1 -0
  107. package/dist/index.d.ts +5 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +25 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/protected.d.ts +3 -0
  112. package/dist/protected.d.ts.map +1 -0
  113. package/dist/protected.js +11 -0
  114. package/dist/protected.js.map +1 -0
  115. package/dist/types/adapter.d.ts +46 -0
  116. package/dist/types/adapter.d.ts.map +1 -0
  117. package/dist/types/adapter.js +3 -0
  118. package/dist/types/adapter.js.map +1 -0
  119. package/dist/types/change.d.ts +187 -0
  120. package/dist/types/change.d.ts.map +1 -0
  121. package/dist/types/change.js +52 -0
  122. package/dist/types/change.js.map +1 -0
  123. package/dist/types/index.d.ts +7 -0
  124. package/dist/types/index.d.ts.map +1 -0
  125. package/dist/types/index.js +33 -0
  126. package/dist/types/index.js.map +1 -0
  127. package/dist/types/internal-change.d.ts +98 -0
  128. package/dist/types/internal-change.d.ts.map +1 -0
  129. package/dist/types/internal-change.js +18 -0
  130. package/dist/types/internal-change.js.map +1 -0
  131. package/dist/types/project-info.d.ts +6 -0
  132. package/dist/types/project-info.d.ts.map +1 -0
  133. package/dist/types/project-info.js +3 -0
  134. package/dist/types/project-info.js.map +1 -0
  135. package/dist/types/service.d.ts +27 -0
  136. package/dist/types/service.d.ts.map +1 -0
  137. package/dist/types/service.js +3 -0
  138. package/dist/types/service.js.map +1 -0
  139. package/dist/types/text-file.d.ts +12 -0
  140. package/dist/types/text-file.d.ts.map +1 -0
  141. package/dist/types/text-file.js +3 -0
  142. package/dist/types/text-file.js.map +1 -0
  143. package/dist/utils/constants.d.ts +2 -0
  144. package/dist/utils/constants.d.ts.map +1 -0
  145. package/dist/utils/constants.js +24 -0
  146. package/dist/utils/constants.js.map +1 -0
  147. package/dist/utils/indent.d.ts +10 -0
  148. package/dist/utils/indent.d.ts.map +1 -0
  149. package/dist/utils/indent.js +36 -0
  150. package/dist/utils/indent.js.map +1 -0
  151. package/dist/utils/index.d.ts +7 -0
  152. package/dist/utils/index.d.ts.map +1 -0
  153. package/dist/utils/index.js +16 -0
  154. package/dist/utils/index.js.map +1 -0
  155. package/dist/utils/path.d.ts +8 -0
  156. package/dist/utils/path.d.ts.map +1 -0
  157. package/dist/utils/path.js +31 -0
  158. package/dist/utils/path.js.map +1 -0
  159. package/dist/utils/pointer.d.ts +11 -0
  160. package/dist/utils/pointer.d.ts.map +1 -0
  161. package/dist/utils/pointer.js +26 -0
  162. package/dist/utils/pointer.js.map +1 -0
  163. package/dist/utils/reference.d.ts +10 -0
  164. package/dist/utils/reference.d.ts.map +1 -0
  165. package/dist/utils/reference.js +20 -0
  166. package/dist/utils/reference.js.map +1 -0
  167. package/dist/utils/text-edits.d.ts +12 -0
  168. package/dist/utils/text-edits.d.ts.map +1 -0
  169. package/dist/utils/text-edits.js +29 -0
  170. package/dist/utils/text-edits.js.map +1 -0
  171. package/dist/vocabularies.d.ts +11 -0
  172. package/dist/vocabularies.d.ts.map +1 -0
  173. package/dist/vocabularies.js +26 -0
  174. package/dist/vocabularies.js.map +1 -0
  175. package/dist/xml/adapter.d.ts +85 -0
  176. package/dist/xml/adapter.d.ts.map +1 -0
  177. package/dist/xml/adapter.js +579 -0
  178. package/dist/xml/adapter.js.map +1 -0
  179. package/dist/xml/changes.d.ts +117 -0
  180. package/dist/xml/changes.d.ts.map +1 -0
  181. package/dist/xml/changes.js +34 -0
  182. package/dist/xml/changes.js.map +1 -0
  183. package/dist/xml/comments.d.ts +17 -0
  184. package/dist/xml/comments.d.ts.map +1 -0
  185. package/dist/xml/comments.js +49 -0
  186. package/dist/xml/comments.js.map +1 -0
  187. package/dist/xml/document.d.ts +11 -0
  188. package/dist/xml/document.d.ts.map +1 -0
  189. package/dist/xml/document.js +3 -0
  190. package/dist/xml/document.js.map +1 -0
  191. package/dist/xml/index.d.ts +3 -0
  192. package/dist/xml/index.d.ts.map +1 -0
  193. package/dist/xml/index.js +8 -0
  194. package/dist/xml/index.js.map +1 -0
  195. package/dist/xml/pointer.d.ts +10 -0
  196. package/dist/xml/pointer.d.ts.map +1 -0
  197. package/dist/xml/pointer.js +29 -0
  198. package/dist/xml/pointer.js.map +1 -0
  199. package/dist/xml/references.d.ts +9 -0
  200. package/dist/xml/references.d.ts.map +1 -0
  201. package/dist/xml/references.js +87 -0
  202. package/dist/xml/references.js.map +1 -0
  203. package/dist/xml/service.d.ts +12 -0
  204. package/dist/xml/service.d.ts.map +1 -0
  205. package/dist/xml/service.js +55 -0
  206. package/dist/xml/service.js.map +1 -0
  207. package/dist/xml/writer.d.ts +39 -0
  208. package/dist/xml/writer.d.ts.map +1 -0
  209. package/dist/xml/writer.js +855 -0
  210. package/dist/xml/writer.js.map +1 -0
  211. package/package.json +47 -0
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertPointerInAnnotationToInternal = void 0;
4
+ const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types");
5
+ const expressions_1 = require("./expressions");
6
+ /*
7
+ Fiori Annotation API uses paths (in JsonPointer format) to specify locations inside a (non embedded) annotation value.
8
+
9
+ Annotation values are represented as in internal annotation file representation (Element, Attribute, TextNode) and
10
+ paths therein use JsonPointer format.
11
+
12
+ Remark: Internal representation of annotation value has more flexibility (choice between attribute and sub element notation)
13
+ Hence - converting path to internal needs to have the actual internal representation.
14
+ Also: error situations can occur in internal representation, which cannot be expressed in AVT format (e.g. multiple values for a PropertyValue)
15
+ */
16
+ /**
17
+ * Convert path in annotation to internal representation.
18
+ *
19
+ * @param annotation - Internal representation element.
20
+ * @param pointer - path in external representation
21
+ * @param valueType - Current value type
22
+ * @returns Pointer to an internal representation node.
23
+ */
24
+ function convertPointerInAnnotationToInternal(annotation, pointer, valueType) {
25
+ // e.g.
26
+ // "/record/propertyValues/3/value/Collection/0/PropertyPath"
27
+ // into "/content/0/content/3/content/0/content/0/text"
28
+ // based on
29
+ /*
30
+ <Annotation Term="UI.Chart">
31
+ <Record Type="UI.ChartDefinitionType">
32
+ <PropertyValue Property="Title" String="Sales Data"/>
33
+ <PropertyValue Property="Description" String="Sales"/>
34
+ <PropertyValue Property="ChartType" EnumMember="UI.ChartType/Bar"/>
35
+ <PropertyValue Property="Dimensions">
36
+ <Collection>
37
+ <PropertyPath>Revenue</PropertyPath> // <<<====
38
+ */
39
+ let path = [''];
40
+ const segments = pointer.split('/').filter((segment) => !!segment);
41
+ let currentElement = annotation;
42
+ let indexedSubElementName; // '' is valid value when looking for all sub element names
43
+ segments.forEach((segment) => {
44
+ if (!currentElement || !path) {
45
+ // further path segments but no element to resolve it: error
46
+ path = [];
47
+ return;
48
+ }
49
+ let result = { subElementIndex: -1 };
50
+ switch (segment) {
51
+ case 'annotations':
52
+ // n'th Annotation sub element should represent n'th embedded annotation
53
+ indexedSubElementName = "Annotation" /* Edm.Annotation */;
54
+ break;
55
+ case 'record':
56
+ case 'Record':
57
+ // must be record sub element
58
+ result = findSubElement(currentElement, "Record" /* Edm.Record */, 0);
59
+ break;
60
+ case 'propertyValues':
61
+ // n'th PropertyValue sub element should represent n'th entry in propertyValues
62
+ indexedSubElementName = "PropertyValue" /* Edm.PropertyValue */;
63
+ break;
64
+ case 'collection':
65
+ case 'Collection':
66
+ // just goto n'th subElement
67
+ result = findSubElement(currentElement, "Collection" /* Edm.Collection */, 0);
68
+ indexedSubElementName = '';
69
+ break;
70
+ case 'value':
71
+ // if last segment: stay on current element, if further segments follow: they are handled in default
72
+ path.push(...handleExpressionValueSegment(currentElement, valueType));
73
+ break;
74
+ case 'type':
75
+ // type attribute in a Record
76
+ path.push('attributes', 'Type', 'value');
77
+ break;
78
+ default:
79
+ if (isNaN(Number(segment))) {
80
+ // segment is not an index
81
+ const { subElement, clearPath, pathSegments } = handleStringSegment(segment, currentElement);
82
+ result.subElement = subElement;
83
+ path = clearPath ? [] : [...path, ...(pathSegments !== null && pathSegments !== void 0 ? pathSegments : [])];
84
+ }
85
+ else if (indexedSubElementName !== null) {
86
+ // segment is an index - find sub element with specific name
87
+ result = findSubElement(currentElement, indexedSubElementName, Number(segment));
88
+ indexedSubElementName = undefined;
89
+ }
90
+ break;
91
+ }
92
+ if ((result === null || result === void 0 ? void 0 : result.subElementIndex) >= 0) {
93
+ path.push('content', result.subElementIndex.toString());
94
+ }
95
+ if (result === null || result === void 0 ? void 0 : result.subElement) {
96
+ currentElement = result.subElement;
97
+ }
98
+ });
99
+ return path.join('/');
100
+ }
101
+ exports.convertPointerInAnnotationToInternal = convertPointerInAnnotationToInternal;
102
+ function handleExpressionValueSegment(currentElement, valueType) {
103
+ if (valueType === undefined) {
104
+ return [];
105
+ }
106
+ if (currentElement.attributes[valueType]) {
107
+ return ['attributes', valueType];
108
+ }
109
+ const elementIndex = currentElement.content.findIndex((element) => element.type === odata_annotation_core_types_1.ELEMENT_TYPE && element.name === valueType);
110
+ if (elementIndex !== -1) {
111
+ return ['content', elementIndex.toString()];
112
+ }
113
+ return [];
114
+ }
115
+ function handleStringSegment(segment, currentElement) {
116
+ if (expressions_1.expressionNames[segment]) {
117
+ // primitive type name; represented either as attribute or text sub node; should be the last segment
118
+ return handleExpressionNameSegment(currentElement, segment);
119
+ }
120
+ else if (currentElement.attributes[firstCharToUpper(segment)]) {
121
+ // can be qualifier, term, type: all are EDMX attribute names
122
+ return { pathSegments: ['attributes', firstCharToUpper(segment), 'value'] };
123
+ }
124
+ else if (segment === 'name') {
125
+ // propertyValue.name is value of EDMX attribute 'Property'
126
+ return { pathSegments: ['attributes', "Property" /* Edm.Property */, 'value'] };
127
+ }
128
+ else {
129
+ return { clearPath: true };
130
+ }
131
+ }
132
+ function handleExpressionNameSegment(currentElement, segment) {
133
+ if (currentElement === null || currentElement === void 0 ? void 0 : currentElement.attributes[segment]) {
134
+ // primitive type name represented as attribute
135
+ return { pathSegments: ['attributes', segment, 'value'] };
136
+ }
137
+ if (currentElement.name === segment) {
138
+ // point to first text node
139
+ const firstTextNodeIndex = getFirstTextNodeIndex(currentElement);
140
+ if (firstTextNodeIndex < 0) {
141
+ return { clearPath: true };
142
+ }
143
+ else {
144
+ return { pathSegments: ['content', firstTextNodeIndex.toString()] };
145
+ }
146
+ }
147
+ // find sub node representing primitive value and point to it's first text node
148
+ const { subElement, subElementIndex } = findSubElement(currentElement, segment, 0);
149
+ if (subElementIndex < 0) {
150
+ return { clearPath: true, subElement };
151
+ }
152
+ // subElementIndex found
153
+ const pathSegments = ['content', subElementIndex.toString()];
154
+ const firstTextNodeIndex = getFirstTextNodeIndex(currentElement.content[subElementIndex]);
155
+ if (firstTextNodeIndex < 0) {
156
+ return { clearPath: true, subElement };
157
+ }
158
+ pathSegments.push('content', firstTextNodeIndex.toString());
159
+ return { subElement, pathSegments };
160
+ }
161
+ function getFirstTextNodeIndex(element) {
162
+ return element.content.findIndex((subNode) => subNode.type === odata_annotation_core_types_1.TEXT_TYPE);
163
+ }
164
+ function findSubElement(element, subElementName, occurrence) {
165
+ const result = {
166
+ subElementIndex: -1
167
+ };
168
+ let currentMatchIndex = -1;
169
+ for (let index = 0; index < element.content.length; index++) {
170
+ const child = element.content[index];
171
+ if (child.type === odata_annotation_core_types_1.ELEMENT_TYPE && (!subElementName || child.name === subElementName)) {
172
+ currentMatchIndex++;
173
+ if (currentMatchIndex === occurrence) {
174
+ result.subElement = child;
175
+ result.subElementIndex = index;
176
+ }
177
+ }
178
+ }
179
+ return result;
180
+ }
181
+ function firstCharToUpper(source) {
182
+ let out = source;
183
+ if (source) {
184
+ out = source.slice(0, 1).toUpperCase() + source.slice(1);
185
+ }
186
+ return out;
187
+ }
188
+ //# sourceMappingURL=pointer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointer.js","sourceRoot":"","sources":["../../src/avt/pointer.ts"],"names":[],"mappings":";;;AACA,qFAAmF;AAGnF,+CAAgD;AAEhD;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACH,SAAgB,oCAAoC,CAChD,UAAmB,EACnB,OAAoB,EACpB,SAAkB;IAElB,OAAO;IACP,6DAA6D;IAC7D,uDAAuD;IACvD,WAAW;IACX;;;;;;;;;MASE;IACF,IAAI,IAAI,GAAa,CAAC,EAAE,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACnE,IAAI,cAAc,GAAG,UAAU,CAAC;IAChC,IAAI,qBAAyC,CAAC,CAAC,2DAA2D;IAC1G,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACzB,IAAI,CAAC,cAAc,IAAI,CAAC,IAAI,EAAE,CAAC;YAC3B,4DAA4D;YAC5D,IAAI,GAAG,EAAE,CAAC;YACV,OAAO;QACX,CAAC;QACD,IAAI,MAAM,GAAsD,EAAE,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC;QACxF,QAAQ,OAAO,EAAE,CA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,iBAAiB,KAAK,UAAU,EAAE,CAAC;gBACnC,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC;gBAC1B,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;YACnC,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc;IACpC,IAAI,GAAG,GAAW,MAAM,CAAC;IACzB,IAAI,MAAM,EAAE,CAAC;QACT,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -0,0 +1,81 @@
1
+ import type { AnnotationRecord, Apply, Collection, Expression, PropertyValue, RawAnnotation } from '@sap-ux/vocabularies-types';
2
+ import type { AliasInformation, Element, ElementChild, Target } from '@sap-ux/odata-annotation-core-types';
3
+ import type { AnnotationListWithOrigins } from './annotations';
4
+ /**
5
+ * Convert target annotations to internal format.
6
+ *
7
+ * @param targetAnnotations - AVT annotation list
8
+ * @param aliasInfo - Alias Information.
9
+ * @returns Internal representation of the Target.
10
+ */
11
+ export declare function convertTargetAnnotationsToInternal(targetAnnotations: AnnotationListWithOrigins, aliasInfo: AliasInformation): Target;
12
+ /**
13
+ * Build empty target (generic annotation file format).
14
+ *
15
+ * @param path - Target name.
16
+ * @returns Internal representation of the target.
17
+ */
18
+ export declare function buildEmptyTarget(path: string): Target;
19
+ /**
20
+ * Convert annotation to internal format.
21
+ *
22
+ * @param annotation - Annotation.
23
+ * @param aliasInfo - Alias Information.
24
+ * @returns Internal representation of the annotation.
25
+ */
26
+ export declare function convertAnnotationToInternal(annotation: RawAnnotation, aliasInfo: AliasInformation): Element;
27
+ /**
28
+ * Convert collection to internal format.
29
+ *
30
+ * @param aliasInfo - Alias Information.
31
+ * @param collection - Collection.
32
+ * @returns Internal representation of the collection.
33
+ */
34
+ export declare function convertCollectionToInternal(aliasInfo: AliasInformation, collection: Collection): Element;
35
+ /**
36
+ *
37
+ * @param aliasInfo - Alias Information.
38
+ * @param entry - Collection entry.
39
+ * @returns Internal representation of the collection entry.
40
+ */
41
+ export declare function convertCollectionElement(aliasInfo: AliasInformation, entry: Collection[number]): ElementChild | undefined;
42
+ /**
43
+ * Convert record to internal format.
44
+ *
45
+ * @param aliasInfo - Alias Information.
46
+ * @param record - Record.
47
+ * @returns Internal representation of the record.
48
+ */
49
+ export declare function convertRecordToInternal(aliasInfo: AliasInformation, record: AnnotationRecord): Element;
50
+ /**
51
+ *
52
+ * @param aliasInfo - Alias Information.
53
+ * @param propertyValue - Property value.
54
+ * @returns Internal representation of the property value.
55
+ */
56
+ export declare function convertPropertyValueToInternal(aliasInfo: AliasInformation, propertyValue: PropertyValue): Element;
57
+ /**
58
+ * Convert expression to internal representation.
59
+ *
60
+ * @param aliasInfo - Alias Information.
61
+ * @param value - Expression value.
62
+ * @param hostElement add value to this element as host (e.g. add for elements Annotation and PropertyValue)
63
+ * @returns Internal representation of the expression.
64
+ */
65
+ export declare function convertExpressionToInternal(aliasInfo: AliasInformation, value: Expression, hostElement?: Element): Element | undefined;
66
+ /**
67
+ *
68
+ * @param aliasInfo - Alias Information.
69
+ * @param apply - Apply expression.
70
+ * @returns Internal representation of apply.
71
+ */
72
+ export declare function convertApplyToInternal(aliasInfo: AliasInformation, apply: Apply): Element;
73
+ /**
74
+ *
75
+ * @param type - Type of primitive value.
76
+ * @param value - Primitive value.
77
+ * @param aliasInfo - Alias Information.
78
+ * @returns Internal representation of primitive value
79
+ */
80
+ export declare function convertPrimitiveValueToInternal(type: string, value: string | number | boolean, aliasInfo: AliasInformation): string;
81
+ //# sourceMappingURL=to-internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-internal.d.ts","sourceRoot":"","sources":["../../src/avt/to-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,gB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,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAIzF;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC3C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAChC,SAAS,EAAE,gBAAgB,GAC5B,MAAM,CAaR"}
@@ -0,0 +1,340 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertPrimitiveValueToInternal = exports.convertApplyToInternal = exports.convertExpressionToInternal = exports.convertPropertyValueToInternal = exports.convertRecordToInternal = exports.convertCollectionElement = exports.convertCollectionToInternal = exports.convertAnnotationToInternal = exports.buildEmptyTarget = exports.convertTargetAnnotationsToInternal = void 0;
4
+ const odata_annotation_core_1 = require("@sap-ux/odata-annotation-core");
5
+ const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types");
6
+ const expressions_1 = require("./expressions");
7
+ const utils_1 = require("./utils");
8
+ /**
9
+ * Convert target annotations to internal format.
10
+ *
11
+ * @param targetAnnotations - AVT annotation list
12
+ * @param aliasInfo - Alias Information.
13
+ * @returns Internal representation of the Target.
14
+ */
15
+ function convertTargetAnnotationsToInternal(targetAnnotations, aliasInfo) {
16
+ const target = buildEmptyTarget(getAliasedPath(aliasInfo, targetAnnotations.target));
17
+ target.terms = targetAnnotations.annotations.map((annotation) => convertAnnotationToInternal(annotation, aliasInfo));
18
+ return target;
19
+ }
20
+ exports.convertTargetAnnotationsToInternal = convertTargetAnnotationsToInternal;
21
+ /**
22
+ * Build empty target (generic annotation file format).
23
+ *
24
+ * @param path - Target name.
25
+ * @returns Internal representation of the target.
26
+ */
27
+ function buildEmptyTarget(path) {
28
+ return { type: 'target', name: path, terms: [], range: undefined, nameRange: undefined, termsRange: undefined };
29
+ }
30
+ exports.buildEmptyTarget = buildEmptyTarget;
31
+ /**
32
+ * Convert annotation to internal format.
33
+ *
34
+ * @param annotation - Annotation.
35
+ * @param aliasInfo - Alias Information.
36
+ * @returns Internal representation of the annotation.
37
+ */
38
+ function convertAnnotationToInternal(annotation, aliasInfo) {
39
+ var _a;
40
+ const annotationElement = (0, odata_annotation_core_types_1.createElementNode)({ name: "Annotation" /* Edm.Annotation */ });
41
+ annotationElement.attributes["Term" /* Edm.Term */] = (0, odata_annotation_core_types_1.createAttributeNode)("Term" /* Edm.Term */, (0, odata_annotation_core_1.toAliasQualifiedName)(annotation.term, aliasInfo));
42
+ if (annotation.qualifier) {
43
+ annotationElement.attributes["Qualifier" /* Edm.Qualifier */] = (0, odata_annotation_core_types_1.createAttributeNode)("Qualifier" /* Edm.Qualifier */, annotation.qualifier);
44
+ }
45
+ if (annotation.collection) {
46
+ annotationElement.content = annotationElement.content || [];
47
+ annotationElement.content.push(convertCollectionToInternal(aliasInfo, annotation.collection));
48
+ }
49
+ else if (annotation.record) {
50
+ annotationElement.content = annotationElement.content || [];
51
+ annotationElement.content.push(convertRecordToInternal(aliasInfo, annotation.record));
52
+ }
53
+ else if (annotation.value) {
54
+ convertExpressionToInternal(aliasInfo, annotation.value, annotationElement);
55
+ }
56
+ if ((_a = annotation.annotations) === null || _a === void 0 ? void 0 : _a.length) {
57
+ // add embedded annotations
58
+ annotation.annotations.forEach((annotation) => {
59
+ annotationElement.content = annotationElement.content || [];
60
+ annotationElement.content.push(convertAnnotationToInternal(annotation, aliasInfo));
61
+ });
62
+ }
63
+ return annotationElement;
64
+ }
65
+ exports.convertAnnotationToInternal = convertAnnotationToInternal;
66
+ /**
67
+ * Convert collection to internal format.
68
+ *
69
+ * @param aliasInfo - Alias Information.
70
+ * @param collection - Collection.
71
+ * @returns Internal representation of the collection.
72
+ */
73
+ function convertCollectionToInternal(aliasInfo, collection) {
74
+ const collectionElement = (0, odata_annotation_core_types_1.createElementNode)({ name: "Collection" /* Edm.Collection */ });
75
+ for (const entry of collection) {
76
+ const entryNode = convertCollectionElement(aliasInfo, entry);
77
+ if (entryNode) {
78
+ collectionElement.content.push(entryNode);
79
+ }
80
+ }
81
+ return collectionElement;
82
+ }
83
+ exports.convertCollectionToInternal = convertCollectionToInternal;
84
+ /**
85
+ *
86
+ * @param aliasInfo - Alias Information.
87
+ * @param entry - Collection entry.
88
+ * @returns Internal representation of the collection entry.
89
+ */
90
+ function convertCollectionElement(aliasInfo, entry) {
91
+ if (typeof entry === 'object') {
92
+ if ((0, expressions_1.isExpression)(entry)) {
93
+ // entry is expression
94
+ return convertExpressionToInternal(aliasInfo, entry);
95
+ }
96
+ else {
97
+ // entry must be record
98
+ return convertRecordToInternal(aliasInfo, entry);
99
+ }
100
+ }
101
+ else if (typeof entry === 'string') {
102
+ return (0, odata_annotation_core_types_1.createElementNode)({ name: "String" /* Edm.String */, content: [(0, odata_annotation_core_types_1.createTextNode)(entry.toString())] });
103
+ }
104
+ else if (typeof entry === 'boolean') {
105
+ // obvious extension of annotation.record definition
106
+ return (0, odata_annotation_core_types_1.createElementNode)({ name: "Bool" /* Edm.Bool */, content: [(0, odata_annotation_core_types_1.createTextNode)(entry ? 'true' : 'false')] });
107
+ }
108
+ return undefined;
109
+ }
110
+ exports.convertCollectionElement = convertCollectionElement;
111
+ /**
112
+ * Convert record to internal format.
113
+ *
114
+ * @param aliasInfo - Alias Information.
115
+ * @param record - Record.
116
+ * @returns Internal representation of the record.
117
+ */
118
+ function convertRecordToInternal(aliasInfo, record) {
119
+ var _a;
120
+ const recordElement = (0, odata_annotation_core_types_1.createElementNode)({ name: "Record" /* Edm.Record */ });
121
+ if (record.type) {
122
+ recordElement.attributes["Type" /* Edm.Type */] = (0, odata_annotation_core_types_1.createAttributeNode)("Type" /* Edm.Type */, (0, odata_annotation_core_1.toAliasQualifiedName)(record.type, aliasInfo));
123
+ }
124
+ record.propertyValues.forEach((propertyValue) => {
125
+ const propValueElement = convertPropertyValueToInternal(aliasInfo, propertyValue);
126
+ recordElement.content.push(propValueElement);
127
+ });
128
+ if ((_a = record.annotations) === null || _a === void 0 ? void 0 : _a.length) {
129
+ // add embedded annotations
130
+ recordElement.content = recordElement.content || [];
131
+ record.annotations.forEach((annotation) => {
132
+ recordElement.content.push(convertAnnotationToInternal(annotation, aliasInfo));
133
+ });
134
+ }
135
+ return recordElement;
136
+ }
137
+ exports.convertRecordToInternal = convertRecordToInternal;
138
+ /**
139
+ *
140
+ * @param aliasInfo - Alias Information.
141
+ * @param propertyValue - Property value.
142
+ * @returns Internal representation of the property value.
143
+ */
144
+ function convertPropertyValueToInternal(aliasInfo, propertyValue) {
145
+ var _a;
146
+ const propValueElement = (0, odata_annotation_core_types_1.createElementNode)({ name: "PropertyValue" /* Edm.PropertyValue */ });
147
+ propValueElement.attributes["Property" /* Edm.Property */] = (0, odata_annotation_core_types_1.createAttributeNode)("Property" /* Edm.Property */, propertyValue.name);
148
+ convertExpressionToInternal(aliasInfo, propertyValue.value, propValueElement);
149
+ if ((_a = propertyValue.annotations) === null || _a === void 0 ? void 0 : _a.length) {
150
+ // add embedded annotations
151
+ propValueElement.content = propValueElement.content || [];
152
+ propertyValue.annotations.forEach((annotation) => {
153
+ propValueElement.content.push(convertAnnotationToInternal(annotation, aliasInfo));
154
+ });
155
+ }
156
+ return propValueElement;
157
+ }
158
+ exports.convertPropertyValueToInternal = convertPropertyValueToInternal;
159
+ /**
160
+ * Convert expression to internal representation.
161
+ *
162
+ * @param aliasInfo - Alias Information.
163
+ * @param value - Expression value.
164
+ * @param hostElement add value to this element as host (e.g. add for elements Annotation and PropertyValue)
165
+ * @returns Internal representation of the expression.
166
+ */
167
+ function convertExpressionToInternal(aliasInfo, value, hostElement) {
168
+ const elementName = expressions_1.expressionNames[value.type] ? value.type : '';
169
+ let element = hostElement !== null && hostElement !== void 0 ? hostElement : (elementName ? (0, odata_annotation_core_types_1.createElementNode)({ name: elementName }) : undefined);
170
+ if (!element) {
171
+ return undefined;
172
+ }
173
+ let collectionElement;
174
+ let recordElement;
175
+ let nullElement;
176
+ let primitiveValue;
177
+ switch (value.type) {
178
+ case 'Collection':
179
+ collectionElement = convertCollectionToInternal(aliasInfo, value.Collection);
180
+ element = consumeElement(element, collectionElement, hostElement);
181
+ break;
182
+ case 'Record':
183
+ recordElement = convertRecordToInternal(aliasInfo, value.Record);
184
+ element = consumeElement(element, recordElement, hostElement);
185
+ break;
186
+ case 'Apply':
187
+ recordElement = convertApplyToInternal(aliasInfo, value.Apply);
188
+ element = consumeElement(element, recordElement, hostElement);
189
+ break;
190
+ case 'Null':
191
+ nullElement = (0, odata_annotation_core_types_1.createElementNode)({ name: elementName });
192
+ element = consumeElement(element, nullElement, hostElement);
193
+ break;
194
+ case 'Unknown':
195
+ return undefined;
196
+ default: {
197
+ // value type is EDMX primitive expression
198
+ const rawPrimitiveValue = value[value.type]; // There is always a property with on the object as type name, Typescript does not infer this case as expected
199
+ primitiveValue = convertPrimitiveValueToInternal(value.type, rawPrimitiveValue, aliasInfo);
200
+ if (hostElement) {
201
+ // add value to host element as attribute
202
+ element.attributes = element.attributes || {};
203
+ element.attributes[value.type] = (0, odata_annotation_core_types_1.createAttributeNode)(value.type, primitiveValue);
204
+ }
205
+ else {
206
+ // add value as single text sub node
207
+ element.content.push((0, odata_annotation_core_types_1.createTextNode)(primitiveValue));
208
+ }
209
+ break;
210
+ }
211
+ }
212
+ return element;
213
+ }
214
+ exports.convertExpressionToInternal = convertExpressionToInternal;
215
+ /**
216
+ *
217
+ * @param aliasInfo - Alias Information.
218
+ * @param apply - Apply expression.
219
+ * @returns Internal representation of apply.
220
+ */
221
+ function convertApplyToInternal(aliasInfo, apply) {
222
+ // Apply value is regular internal representation (without alias)
223
+ const clone = JSON.parse(JSON.stringify(apply));
224
+ return replaceAliasInElement(clone, aliasInfo, true);
225
+ }
226
+ exports.convertApplyToInternal = convertApplyToInternal;
227
+ /**
228
+ *
229
+ * @param type - Type of primitive value.
230
+ * @param value - Primitive value.
231
+ * @param aliasInfo - Alias Information.
232
+ * @returns Internal representation of primitive value
233
+ */
234
+ function convertPrimitiveValueToInternal(type, value, aliasInfo) {
235
+ const text = value.toString();
236
+ if (!text) {
237
+ return text;
238
+ }
239
+ else if (type === "EnumMember" /* Edm.EnumMember */) {
240
+ return (0, utils_1.getAliasedEnumMember)(aliasInfo, text);
241
+ }
242
+ else if (type.indexOf('Path') >= 0) {
243
+ return getAliasedPath(aliasInfo, text);
244
+ }
245
+ else if (type === "Type" /* Edm.Type */ || type === "Term" /* Edm.Term */) {
246
+ return (0, odata_annotation_core_1.toAliasQualifiedName)(text, aliasInfo);
247
+ }
248
+ else {
249
+ return text;
250
+ }
251
+ }
252
+ exports.convertPrimitiveValueToInternal = convertPrimitiveValueToInternal;
253
+ function consumeElement(element, collectionElement, hostElement) {
254
+ if (hostElement) {
255
+ element.content = element.content || [];
256
+ element.content.push(collectionElement); // add whole collection as sub element
257
+ }
258
+ else {
259
+ element = collectionElement;
260
+ }
261
+ return element;
262
+ }
263
+ function replaceAliasInElement(element, aliasInfo, reverse) {
264
+ // replace aliases in all attributes/sub nodes with full namespaces (reverse = true ? vice versa):
265
+ const result = element;
266
+ removeEmptyTextNodes(result);
267
+ replaceAliasInAttributes(result, aliasInfo, reverse);
268
+ replaceAliasInSubNodes(result, aliasInfo, reverse);
269
+ return result;
270
+ }
271
+ function replaceAliasInAttributes(result, aliasInfo, reverse) {
272
+ // in attributes: term or type attributes, enumValue and any path values provided as attributes
273
+ Object.keys(result.attributes || {}).forEach((attributeName) => {
274
+ var _a;
275
+ const attribute = result.attributes[attributeName];
276
+ switch (attributeName) {
277
+ case "Term" /* Edm.Term */:
278
+ case "Type" /* Edm.Type */:
279
+ attribute.value = reverse
280
+ ? (0, odata_annotation_core_1.toAliasQualifiedName)(attribute.value, aliasInfo)
281
+ : (_a = (0, odata_annotation_core_1.resolveName)(attribute.value, aliasInfo.aliasMap)) === null || _a === void 0 ? void 0 : _a.qName;
282
+ break;
283
+ case "EnumMember" /* Edm.EnumMember */:
284
+ attribute.value = reverse
285
+ ? (0, utils_1.getAliasedEnumMember)(aliasInfo, attribute.value)
286
+ : (0, utils_1.resolveEnumMemberValue)(aliasInfo.aliasMap, aliasInfo.currentFileNamespace, attribute.value);
287
+ break;
288
+ default:
289
+ if (attributeName.endsWith('Path')) {
290
+ attribute.value = reverse
291
+ ? getAliasedPath(aliasInfo, attribute.value)
292
+ : (0, utils_1.resolvePath)(aliasInfo.aliasMap, aliasInfo.currentFileNamespace, attribute.value);
293
+ }
294
+ break;
295
+ }
296
+ });
297
+ }
298
+ function replaceAliasInSubNodes(result, aliasInfo, reverse) {
299
+ for (const subNode of result.content) {
300
+ if (subNode.type === odata_annotation_core_types_1.ELEMENT_TYPE) {
301
+ replaceAliasInElement(subNode, aliasInfo, reverse);
302
+ }
303
+ else if (subNode.type === odata_annotation_core_types_1.TEXT_TYPE && result.name === "EnumMember" /* Edm.EnumMember */) {
304
+ subNode.text = reverse
305
+ ? (0, utils_1.getAliasedEnumMember)(aliasInfo, subNode.text)
306
+ : (0, utils_1.resolveEnumMemberValue)(aliasInfo.aliasMap, aliasInfo.currentFileNamespace, subNode.text);
307
+ }
308
+ else if (subNode.type === odata_annotation_core_types_1.TEXT_TYPE && result.name.endsWith('Path')) {
309
+ subNode.text = reverse
310
+ ? getAliasedPath(aliasInfo, subNode.text)
311
+ : (0, utils_1.resolvePath)(aliasInfo.aliasMap, aliasInfo.currentFileNamespace, subNode.text);
312
+ }
313
+ }
314
+ }
315
+ function removeEmptyTextNodes(result) {
316
+ var _a;
317
+ if (((_a = result.content) !== null && _a !== void 0 ? _a : []).some((entry) => entry.type === odata_annotation_core_types_1.ELEMENT_TYPE)) {
318
+ // sub elements present: filter out empty text nodes
319
+ result.content = result.content.filter((entry) => { var _a; return !(entry.type === odata_annotation_core_types_1.TEXT_TYPE && !((_a = entry.text) !== null && _a !== void 0 ? _a : '').trim()); });
320
+ }
321
+ }
322
+ function getAliasedSegment(aliasInfo, segment) {
323
+ const [path, term] = segment.split('@');
324
+ if (term) {
325
+ return `${path}@${(0, odata_annotation_core_1.toAliasQualifiedName)(term, aliasInfo)}`;
326
+ }
327
+ else if (segment.indexOf('.') > -1) {
328
+ return (0, odata_annotation_core_1.toAliasQualifiedName)(segment, aliasInfo);
329
+ }
330
+ else {
331
+ return segment;
332
+ }
333
+ }
334
+ function getAliasedPath(aliasInfo, path) {
335
+ return path
336
+ .split('/')
337
+ .map((segment) => getAliasedSegment(aliasInfo, segment))
338
+ .join('/');
339
+ }
340
+ //# sourceMappingURL=to-internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-internal.js","sourceRoot":"","sources":["../../src/avt/to-internal.ts"],"names":[],"mappings":";;;AAQA,yEAAkF;AAElF,qFAO6C;AAC7C,+CAA8D;AAC9D,mCAAoF;AAGpF;;;;;;GAMG;AACH,SAAgB,kCAAkC,CAC9C,iBAA4C,EAC5C,SAA2B;IAE3B,MAAM,MAAM,GAAG,gBAAgB,CAAC,cAAc,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF,MAAM,CAAC,KAAK,GAAG,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAC5D,2BAA2B,CAAC,UAAU,EAAE,SAAS,CAAC,CACrD,CAAC;IACF,OAAO,MAAM,CAAC;AAClB,CAAC;AATD,gFASC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AACpH,CAAC;AAFD,4CAEC;AAED;;;;;;GAMG;AACH,SAAgB,2BAA2B,CAAC,UAAyB,EAAE,SAA2B;;IAC9F,MAAM,iBAAiB,GAAG,IAAA,+CAAiB,EAAC,EAAE,IAAI,mCAAgB,EAAE,CAAC,CAAC;IACtE,iBAAiB,CAAC,UAAU,uBAAU,GAAG,IAAA,iDAAmB,yBAExD,IAAA,4CAAoB,EAAC,UAAU,C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 @@
1
+ import type { RawAnnotation, AnnotationRecord, PropertyValue, Expression, Collection, AnnotationList } from '@sap-ux/vocabularies-types';
2
+ export type AVTNode = RawAnnotation | AnnotationRecord | PropertyValue | Expression | Collection | AnnotationList;
3
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/avt/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,UAAU,EACV,cAAc,EACjB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,gBAAgB,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map