@ui5/task-adaptation 1.2.0 → 1.3.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 (92) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/annotationManager.d.ts +3 -3
  3. package/dist/annotationManager.js +15 -16
  4. package/dist/annotations/comparator/comparator.js +30 -26
  5. package/dist/annotations/comparator/diffCase.js +1 -2
  6. package/dist/annotations/comparator/interchangableCase.d.ts +1 -1
  7. package/dist/annotations/comparator/interchangableCase.js +7 -12
  8. package/dist/annotations/converter/metadataJsonReferenceUtil.js +7 -9
  9. package/dist/annotations/converter/metadataJsonUtil.js +7 -10
  10. package/dist/annotations/converter/ui5JsonConverter.js +5 -6
  11. package/dist/annotations/converter/ui5MetadataJsonUtil.js +1 -4
  12. package/dist/annotations/converter/ui5XmlConverter.js +4 -7
  13. package/dist/annotations/dataSource/dataSource.d.ts +5 -5
  14. package/dist/annotations/dataSource/dataSource.js +8 -8
  15. package/dist/annotations/dataSource/dataSourceManager.d.ts +3 -3
  16. package/dist/annotations/dataSource/dataSourceManager.js +8 -13
  17. package/dist/annotations/dataSource/dataSourceOData.d.ts +3 -3
  18. package/dist/annotations/dataSource/dataSourceOData.js +13 -15
  19. package/dist/annotations/dataSource/dataSourceODataAnnotation.d.ts +1 -1
  20. package/dist/annotations/dataSource/dataSourceODataAnnotation.js +5 -7
  21. package/dist/annotations/serviceRequestor.d.ts +3 -3
  22. package/dist/annotations/serviceRequestor.js +15 -13
  23. package/dist/annotations/transformers/convertV2ToV4.d.ts +1 -1
  24. package/dist/annotations/transformers/convertV2ToV4.js +7 -10
  25. package/dist/annotations/transformers/makeAnnotationNamespaceUnique.d.ts +1 -1
  26. package/dist/annotations/transformers/makeAnnotationNamespaceUnique.js +8 -11
  27. package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.d.ts +1 -1
  28. package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.js +3 -6
  29. package/dist/annotations/transformers/transformer.d.ts +2 -2
  30. package/dist/annotations/transformers/transformer.js +1 -2
  31. package/dist/annotations/transformers/traverseReferences.d.ts +1 -1
  32. package/dist/annotations/transformers/traverseReferences.js +16 -17
  33. package/dist/appVariantManager.d.ts +1 -1
  34. package/dist/appVariantManager.js +17 -20
  35. package/dist/baseAppManager.d.ts +2 -2
  36. package/dist/baseAppManager.js +18 -20
  37. package/dist/buildStrategy.js +2 -4
  38. package/dist/bundle.d.ts +25 -0
  39. package/dist/bundle.js +3696 -219
  40. package/dist/cache/annotationsCacheManager.d.ts +2 -2
  41. package/dist/cache/annotationsCacheManager.js +3 -5
  42. package/dist/cache/baseAppFilesCacheManager.d.ts +1 -1
  43. package/dist/cache/baseAppFilesCacheManager.js +3 -6
  44. package/dist/cache/cacheManager.d.ts +1 -1
  45. package/dist/cache/cacheManager.js +9 -12
  46. package/dist/i18nManager.d.ts +3 -3
  47. package/dist/i18nManager.js +23 -23
  48. package/dist/index.d.ts +6 -1
  49. package/dist/index.js +14 -16
  50. package/dist/model/annotationDiffStructureError.js +1 -4
  51. package/dist/model/language.js +4 -4
  52. package/dist/model/noAuthorizationProvidedError.js +1 -4
  53. package/dist/model/serverError.js +1 -4
  54. package/dist/model/types.d.ts +1 -1
  55. package/dist/model/types.js +1 -2
  56. package/dist/processors/abapProcessor.d.ts +5 -5
  57. package/dist/processors/abapProcessor.js +9 -8
  58. package/dist/processors/cfProcessor.d.ts +3 -3
  59. package/dist/processors/cfProcessor.js +7 -8
  60. package/dist/processors/processor.d.ts +1 -1
  61. package/dist/processors/processor.js +11 -15
  62. package/dist/repositories/abapRepoManager.d.ts +1 -1
  63. package/dist/repositories/abapRepoManager.js +14 -14
  64. package/dist/repositories/html5RepoManager.d.ts +1 -1
  65. package/dist/repositories/html5RepoManager.js +12 -14
  66. package/dist/util/cfUtil.d.ts +1 -1
  67. package/dist/util/cfUtil.js +12 -14
  68. package/dist/util/commonUtil.d.ts +2 -2
  69. package/dist/util/commonUtil.js +19 -32
  70. package/dist/util/i18nMerger.d.ts +6 -2
  71. package/dist/util/i18nMerger.js +10 -14
  72. package/dist/util/requestUtil.d.ts +1 -1
  73. package/dist/util/requestUtil.js +9 -12
  74. package/dist/util/resourceUtil.js +8 -11
  75. package/dist/util/urlUtil.d.ts +2 -2
  76. package/dist/util/urlUtil.js +3 -6
  77. package/dist/util/xmlUtil.js +2 -5
  78. package/dist/util/zipUtil.js +2 -6
  79. package/eslint.config.js +52 -0
  80. package/package.json +44 -51
  81. package/scripts/metadataDownloadHelper.ts +8 -7
  82. package/scripts/rollup/bundle.d.ts +25 -0
  83. package/scripts/rollup/bundleDefinition.js +11 -1
  84. package/scripts/{bundler.ts → rollup/bundler.ts} +6 -17
  85. package/scripts/rollup/overrides/sap/base/config.js +10 -0
  86. package/scripts/rollup/project/package.json +2 -1
  87. package/scripts/rollup/project/ui5.yaml +1 -1
  88. package/scripts/rollup/ui5Resolve.ts +14 -38
  89. package/scripts/rollup.ts +67 -23
  90. package/types/ui5.d.ts +44 -0
  91. package/dist/bundle-odata.js +0 -5498
  92. package/scripts/rollup/bundleDefinition-odata.js +0 -9
package/CHANGELOG.md CHANGED
@@ -2,7 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.2.0...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.3.0...HEAD).
6
+
7
+ <a name="v1.3.0"></a>
8
+ ## [v1.3.0] - 2024-03-22
6
9
 
7
10
  <a name="v1.2.0"></a>
8
11
  ## [v1.2.0] - 2024-03-05
@@ -85,6 +88,7 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
85
88
  <a name="v1.0.0"></a>
86
89
  ## v1.0.0 - 2020-12-09
87
90
 
91
+ [v1.3.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.2.0...v1.3.0
88
92
  [v1.2.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.3...v1.2.0
89
93
  [v1.1.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.2...v1.1.3
90
94
  [v1.1.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.1...v1.1.2
@@ -1,6 +1,6 @@
1
- import AbapRepoManager from "./repositories/abapRepoManager";
2
- import { IConfiguration } from "./model/types";
3
- import Language from "./model/language";
1
+ import AbapRepoManager from "./repositories/abapRepoManager.js";
2
+ import { IConfiguration } from "./model/types.js";
3
+ import Language from "./model/language.js";
4
4
  export interface IAnnotationFiles {
5
5
  annotationName: string;
6
6
  annotationFileName: string;
@@ -1,29 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const baseAppManager_1 = require("./baseAppManager");
4
- const dataSourceManager_1 = require("./annotations/dataSource/dataSourceManager");
5
- const i18nManager_1 = require("./i18nManager");
6
- const serviceRequestor_1 = require("./annotations/serviceRequestor");
7
- const path_1 = require("path");
1
+ import BaseAppManager from "./baseAppManager.js";
2
+ import DataSourceManager from "./annotations/dataSource/dataSourceManager.js";
3
+ import I18nManager from "./i18nManager.js";
4
+ import ServiceRequestor from "./annotations/serviceRequestor.js";
5
+ import { posix as path } from "path";
8
6
  const I18N_DEFAULT_PATH = "i18n/annotations";
9
7
  const I18N_DEFAULT_MODEL_NAME = "@i18n";
10
8
  const SAPUI5 = "sap.ui5";
11
- class AnnotationManager {
9
+ export default class AnnotationManager {
10
+ abapRepoManager;
11
+ configuration;
12
12
  constructor(configuration, abapRepoManager) {
13
- this.ANNOTATIONS_FOLDER = "annotations";
14
13
  this.configuration = configuration;
15
14
  this.abapRepoManager = abapRepoManager;
16
15
  }
16
+ ANNOTATIONS_FOLDER = "annotations";
17
17
  async process(renamedBaseAppManifest, languages) {
18
- const { id } = baseAppManager_1.default.getIdVersion(renamedBaseAppManifest);
19
- baseAppManager_1.default.validateProperty(id, "sap.app/id");
18
+ const { id } = BaseAppManager.getIdVersion(renamedBaseAppManifest);
19
+ BaseAppManager.validateProperty(id, "sap.app/id");
20
20
  const normalisedId = this.normalizeAppVariantId(id);
21
21
  //TODO: switch to this after resolving @i18n custom model
22
22
  const modelName = I18N_DEFAULT_MODEL_NAME; //`i18n_a9n_${normalisedId}`;
23
- const i18nPathName = path_1.posix.join(I18N_DEFAULT_PATH, normalisedId);
24
- const i18nManager = new i18nManager_1.default(modelName, id, languages);
25
- const serviceRequestor = new serviceRequestor_1.default(this.configuration, this.abapRepoManager);
26
- const dataSourceManager = new dataSourceManager_1.default();
23
+ const i18nPathName = path.join(I18N_DEFAULT_PATH, normalisedId);
24
+ const i18nManager = new I18nManager(modelName, id, languages);
25
+ const serviceRequestor = new ServiceRequestor(this.configuration, this.abapRepoManager);
26
+ const dataSourceManager = new DataSourceManager();
27
27
  dataSourceManager.addDataSources(renamedBaseAppManifest["sap.app"]?.dataSources);
28
28
  const annotationFiles = await dataSourceManager.createAnnotationFiles(languages, i18nManager, serviceRequestor);
29
29
  const i18nFiles = i18nManager.createFiles(i18nPathName);
@@ -76,5 +76,4 @@ class AnnotationManager {
76
76
  }
77
77
  }
78
78
  }
79
- exports.default = AnnotationManager;
80
79
  //# sourceMappingURL=annotationManager.js.map
@@ -1,12 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Diff = void 0;
4
- const commonUtil_1 = require("../../util/commonUtil");
5
- const annotationDiffStructureError_1 = require("../../model/annotationDiffStructureError");
6
- const interchangableCase_1 = require("./interchangableCase");
7
- const metadataJsonUtil_1 = require("../converter/metadataJsonUtil");
8
- const xmlUtil_1 = require("../../util/xmlUtil");
9
- class Diff {
1
+ import { insertInArray, traverse } from "../../util/commonUtil.js";
2
+ import AnnotationDiffStructureError from "../../model/annotationDiffStructureError.js";
3
+ import InterchangableCase from "./interchangableCase.js";
4
+ import MetadataJsonUtil from "../converter/metadataJsonUtil.js";
5
+ import XmlUtil from "../../util/xmlUtil.js";
6
+ export class Diff {
7
+ __old;
8
+ __new;
10
9
  constructor(__old, __new) {
11
10
  this.__old = __old;
12
11
  this.__new = __new;
@@ -15,18 +14,19 @@ class Diff {
15
14
  return `{ __old: ${this.__old}, __new: ${this.__new} }`;
16
15
  }
17
16
  }
18
- exports.Diff = Diff;
19
- class Comparator {
17
+ export default class Comparator {
18
+ diffs = new Set();
19
+ xml_a;
20
+ xml_b;
20
21
  constructor(xml_a, xml_b) {
21
- this.diffs = new Set();
22
22
  this.xml_a = xml_a;
23
23
  this.xml_b = xml_b;
24
24
  }
25
25
  compare() {
26
- const json_a = typeof this.xml_a === "string" ? xmlUtil_1.default.xmlToJson(this.xml_a) : this.xml_a;
27
- const json_b = typeof this.xml_b === "string" ? xmlUtil_1.default.xmlToJson(this.xml_b) : this.xml_b;
28
- const scheme_a = metadataJsonUtil_1.default.getSchemaNode(json_a);
29
- const scheme_b = metadataJsonUtil_1.default.getSchemaNode(json_b);
26
+ const json_a = typeof this.xml_a === "string" ? XmlUtil.xmlToJson(this.xml_a) : this.xml_a;
27
+ const json_b = typeof this.xml_b === "string" ? XmlUtil.xmlToJson(this.xml_b) : this.xml_b;
28
+ const scheme_a = MetadataJsonUtil.getSchemaNode(json_a);
29
+ const scheme_b = MetadataJsonUtil.getSchemaNode(json_b);
30
30
  if (scheme_a && scheme_b) {
31
31
  // we compare only Annotations, other types are left as it is
32
32
  this.traverseCompare(scheme_a, scheme_b, "Annotations");
@@ -45,7 +45,7 @@ class Comparator {
45
45
  // When during traversing we end up in primitives like string, we
46
46
  // compare the values. If one of them is not primitive or oone of
47
47
  // them is undefined, we throw exception (see test 06, 07).
48
- throw new annotationDiffStructureError_1.default({ a, b });
48
+ throw new AnnotationDiffStructureError({ a, b });
49
49
  }
50
50
  else if (typeof a !== "object" && typeof b !== "object") {
51
51
  // If primitive values are not same - we assume they are
@@ -71,7 +71,7 @@ class Comparator {
71
71
  else {
72
72
  // If the number of items of nodes without id are
73
73
  // different, we throw error (see test 08).
74
- throw new annotationDiffStructureError_1.default({ a, b });
74
+ throw new AnnotationDiffStructureError({ a, b });
75
75
  }
76
76
  }
77
77
  }
@@ -153,8 +153,14 @@ class Comparator {
153
153
  return simpleIdentifiers.get(property);
154
154
  }
155
155
  }
156
- exports.default = Comparator;
157
156
  class Includer {
157
+ ALL_DIFF_CASES = [
158
+ new InterchangableCase()
159
+ ];
160
+ diffCases = new Array();
161
+ shouldClear;
162
+ target;
163
+ property;
158
164
  /**
159
165
  * It will decide what to do with the item missing in one language.
160
166
  * @param target an array which might miss the item
@@ -165,10 +171,6 @@ class Includer {
165
171
  * they will have empty values. Because we don't know what should be there.
166
172
  */
167
173
  constructor(target, property, shouldClear = true) {
168
- this.ALL_DIFF_CASES = [
169
- new interchangableCase_1.default()
170
- ];
171
- this.diffCases = new Array();
172
174
  this.shouldClear = shouldClear;
173
175
  this.target = target;
174
176
  this.property = property;
@@ -189,7 +191,7 @@ class Includer {
189
191
  // language or default language value if missing in other language
190
192
  // (see test 03).
191
193
  const clone = Includer.cloneAndClear(source[index], this.shouldClear);
192
- (0, commonUtil_1.insertInArray)(this.target, index, clone);
194
+ insertInArray(this.target, index, clone);
193
195
  // Some annotations like Label, QuickInfo or Heading are
194
196
  // interchangable so if QuickInfo is missing we can copy the value
195
197
  // from Label or Heading (see test 01).
@@ -208,7 +210,7 @@ class Includer {
208
210
  static cloneAndClear(obj, shouldClear = true) {
209
211
  const clone = structuredClone(obj);
210
212
  if (shouldClear) {
211
- (0, commonUtil_1.traverse)(clone, [], (json, key) => {
213
+ traverse(clone, [], (json, key) => {
212
214
  if (typeof key !== "string" || !simpleIdentifiersReversed.has(key)) {
213
215
  json[key] = "";
214
216
  }
@@ -218,13 +220,15 @@ class Includer {
218
220
  }
219
221
  }
220
222
  class Items {
223
+ idProperty;
224
+ array;
225
+ objectMap = null;
221
226
  /**
222
227
  * Map of id per item which is lazy initialized if needed
223
228
  * @param array
224
229
  * @param idProperty
225
230
  */
226
231
  constructor(array, idProperty) {
227
- this.objectMap = null;
228
232
  this.array = array;
229
233
  this.idProperty = idProperty;
230
234
  }
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=diffCase.js.map
@@ -1,4 +1,4 @@
1
- import DiffCase from "./diffCase";
1
+ import DiffCase from "./diffCase.js";
2
2
  export default class InterchangableCase implements DiffCase {
3
3
  accept(target: any[], i: number, name: string): void;
4
4
  /**
@@ -1,13 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const comparator_1 = require("./comparator");
4
- class InterchangableCase {
5
- constructor() {
6
- // If one of the terms is missing, its values can be filled by others.
7
- // Usually Heading or QuickInfo is missing. So we order terms by source
8
- // priority (take from label first).
9
- this.interchangableTerms = ["SAP__common.Label", "SAP__common.Heading", "SAP__common.QuickInfo"];
10
- }
1
+ import { Diff } from "./comparator.js";
2
+ export default class InterchangableCase {
11
3
  accept(target, i, name) {
12
4
  if (name === "Annotation" && this.interchangableTerms.includes(target[i]?._attributes?.Term)) {
13
5
  const source = this.findByPriority(target, i);
@@ -31,7 +23,7 @@ class InterchangableCase {
31
23
  */
32
24
  getSourceValue(source, attribute) {
33
25
  let value = source._attributes[attribute];
34
- if (value instanceof comparator_1.Diff) {
26
+ if (value instanceof Diff) {
35
27
  value = value.__old;
36
28
  }
37
29
  return value;
@@ -50,6 +42,10 @@ class InterchangableCase {
50
42
  .map(item => item._attributes?.Term)
51
43
  .some(term => this.interchangableTerms.includes(term));
52
44
  }
45
+ // If one of the terms is missing, its values can be filled by others.
46
+ // Usually Heading or QuickInfo is missing. So we order terms by source
47
+ // priority (take from label first).
48
+ interchangableTerms = ["SAP__common.Label", "SAP__common.Heading", "SAP__common.QuickInfo"];
53
49
  findByPriority(annotations, index) {
54
50
  for (const interchangableTerm of this.interchangableTerms) {
55
51
  for (const annotation of annotations) {
@@ -61,5 +57,4 @@ class InterchangableCase {
61
57
  }
62
58
  }
63
59
  }
64
- exports.default = InterchangableCase;
65
60
  //# sourceMappingURL=interchangableCase.js.map
@@ -1,10 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const metadataJsonUtil_1 = require("./metadataJsonUtil");
4
- class MetadataJsonReferenceUtil {
1
+ import MetadataJsonUtil from "./metadataJsonUtil.js";
2
+ export default class MetadataJsonReferenceUtil {
3
+ json;
4
+ aliases = null;
5
+ namespaces = null;
5
6
  constructor(json) {
6
- this.aliases = null;
7
- this.namespaces = null;
8
7
  this.json = json;
9
8
  }
10
9
  aliasToNamespace(target) {
@@ -30,10 +29,10 @@ class MetadataJsonReferenceUtil {
30
29
  initReferences() {
31
30
  if (!this.aliases || !this.namespaces) {
32
31
  const references = new Array();
33
- for (const ref of metadataJsonUtil_1.default.getReferences(this.json)) {
32
+ for (const ref of MetadataJsonUtil.getReferences(this.json)) {
34
33
  references.push(...ref.includes);
35
34
  }
36
- references.push(metadataJsonUtil_1.default.getSchemaReference(this.json));
35
+ references.push(MetadataJsonUtil.getSchemaReference(this.json));
37
36
  this.aliases = new Map();
38
37
  this.namespaces = new Map();
39
38
  for (const mapping of references) {
@@ -46,5 +45,4 @@ class MetadataJsonReferenceUtil {
46
45
  }
47
46
  }
48
47
  }
49
- exports.default = MetadataJsonReferenceUtil;
50
48
  //# sourceMappingURL=metadataJsonReferenceUtil.js.map
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetadataInclude = exports.MetadataReference = void 0;
4
- class MetadataJsonUtil {
1
+ export default class MetadataJsonUtil {
5
2
  static mapAnnotationsPerTarget(json) {
6
3
  const annotations = Array.isArray(json) ? json : this.getAnnotations(json);
7
4
  return new Map(annotations.map((json, index) => [json?._attributes?.Target, { json, index }]));
@@ -42,10 +39,10 @@ class MetadataJsonUtil {
42
39
  }
43
40
  }
44
41
  }
45
- exports.default = MetadataJsonUtil;
46
- class MetadataReference {
42
+ export class MetadataReference {
43
+ uri;
44
+ includes = new Array();
47
45
  constructor(referenceJson) {
48
- this.includes = new Array();
49
46
  this.uri = referenceJson._attributes.Uri;
50
47
  for (const include of MetadataJsonUtil.toArrayReadOnly(referenceJson["edmx:Include"])) {
51
48
  this.includes.push(MetadataInclude.fromJson(include));
@@ -56,8 +53,9 @@ class MetadataReference {
56
53
  return include?.alias;
57
54
  }
58
55
  }
59
- exports.MetadataReference = MetadataReference;
60
- class MetadataInclude {
56
+ export class MetadataInclude {
57
+ namespace;
58
+ alias;
61
59
  constructor(alias, namespace) {
62
60
  this.alias = alias;
63
61
  this.namespace = namespace;
@@ -69,5 +67,4 @@ class MetadataInclude {
69
67
  return new MetadataInclude(json?._attributes?.Alias, json?._attributes?.Namespace);
70
68
  }
71
69
  }
72
- exports.MetadataInclude = MetadataInclude;
73
70
  //# sourceMappingURL=metadataJsonUtil.js.map
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ui5MetadataJsonUtil_1 = require("./ui5MetadataJsonUtil");
4
- class UI5JsonConverter {
1
+ import UI5JsonParser from "./ui5MetadataJsonUtil.js";
2
+ export default class UI5JsonConverter {
3
+ config;
4
+ oAnnotationConfig;
5
5
  static convertAnnotations(json) {
6
- const annotationsNode = ui5MetadataJsonUtil_1.default.getAnnotationsNode(json);
6
+ const annotationsNode = UI5JsonParser.getAnnotationsNode(json);
7
7
  if (annotationsNode) {
8
8
  return Object.entries(annotationsNode).map(([target, annotations]) => this.processAnnotations(annotations, target));
9
9
  }
@@ -249,5 +249,4 @@ class UI5JsonConverter {
249
249
  }
250
250
  }
251
251
  }
252
- exports.default = UI5JsonConverter;
253
252
  //# sourceMappingURL=ui5JsonConverter.js.map
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class UI5MetadataJsonUtil {
1
+ export default class UI5MetadataJsonUtil {
4
2
  static getAnnotationsNode(json) {
5
3
  for (const key of Object.keys(json)) {
6
4
  if (json[key].$kind === "Schema") {
@@ -9,5 +7,4 @@ class UI5MetadataJsonUtil {
9
7
  }
10
8
  }
11
9
  }
12
- exports.default = UI5MetadataJsonUtil;
13
10
  //# sourceMappingURL=ui5MetadataJsonUtil.js.map
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const { V2MetadataConverter, V4MetadataConverter } = require("../../../dist/bundle-odata");
4
- const jsdom_1 = require("jsdom");
5
- class UI5XmlConverter {
1
+ import { V2MetadataConverter, V4MetadataConverter } from "../../../dist/bundle.js";
2
+ import { JSDOM } from "jsdom";
3
+ export default class UI5XmlConverter {
6
4
  static convertV2(xml) {
7
5
  return new V2MetadataConverter().convertXMLMetadata(this.getDocument(xml));
8
6
  }
@@ -10,8 +8,7 @@ class UI5XmlConverter {
10
8
  return new V4MetadataConverter().convertXMLMetadata(this.getDocument(xml));
11
9
  }
12
10
  static getDocument(xml) {
13
- return (new jsdom_1.JSDOM(xml, { contentType: "application/xml" })).window._document;
11
+ return (new JSDOM(xml, { contentType: "application/xml" })).window._document;
14
12
  }
15
13
  }
16
- exports.default = UI5XmlConverter;
17
14
  //# sourceMappingURL=ui5XmlConverter.js.map
@@ -1,8 +1,8 @@
1
- import I18nManager from "../../i18nManager";
2
- import { IAnnotationDownloadParams } from "./dataSourceOData";
3
- import Language from "../../model/language";
4
- import ServiceRequestor from "../serviceRequestor";
5
- import Transformer from "../transformers/transformer";
1
+ import I18nManager from "../../i18nManager.js";
2
+ import { IAnnotationDownloadParams } from "./dataSourceOData.js";
3
+ import Language from "../../model/language.js";
4
+ import ServiceRequestor from "../serviceRequestor.js";
5
+ import Transformer from "../transformers/transformer.js";
6
6
  export default class DataSource {
7
7
  protected name: string;
8
8
  private uri;
@@ -1,15 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const xmlUtil_1 = require("../../util/xmlUtil");
4
- class DataSource {
1
+ import XmlUtil from "../../util/xmlUtil.js";
2
+ export default class DataSource {
3
+ name;
4
+ uri;
5
+ jsonTransformers = new Array();
5
6
  constructor(name, uri) {
6
- this.jsonTransformers = new Array();
7
7
  this.name = name;
8
8
  this.uri = uri;
9
9
  }
10
10
  /**
11
11
  * Update the json of the dataSources in manifest.json
12
12
  */
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
14
  updateManifest(_) {
14
15
  // to be overriden in children
15
16
  }
@@ -22,7 +23,7 @@ class DataSource {
22
23
  async createAnnotationFile(languages, i18nManager, serviceRequestor) {
23
24
  const annotationJsons = this.getPromisesPerLanguage(languages, serviceRequestor);
24
25
  const annotationJson = await i18nManager.populateTranslations(annotationJsons);
25
- const xml = xmlUtil_1.default.jsonToXml(await annotationJson.json);
26
+ const xml = XmlUtil.jsonToXml(await annotationJson.json);
26
27
  return {
27
28
  filename: this.getFilename(),
28
29
  xml
@@ -51,12 +52,11 @@ class DataSource {
51
52
  return this.afterXmlDownload({ xml: languageXmlContent, language, serviceRequestor, uri: this.uri });
52
53
  }
53
54
  async afterXmlDownload({ xml, language, serviceRequestor, uri }) {
54
- let json = xmlUtil_1.default.xmlToJson(xml);
55
+ let json = XmlUtil.xmlToJson(xml);
55
56
  for (const transformer of this.jsonTransformers) {
56
57
  json = await transformer.transform({ xml, json, language, serviceRequestor, uri });
57
58
  }
58
59
  return json;
59
60
  }
60
61
  }
61
- exports.default = DataSource;
62
62
  //# sourceMappingURL=dataSource.js.map
@@ -1,6 +1,6 @@
1
- import I18nManager from "../../i18nManager";
2
- import Language from "../../model/language";
3
- import ServiceRequestor from "../serviceRequestor";
1
+ import I18nManager from "../../i18nManager.js";
2
+ import Language from "../../model/language.js";
3
+ import ServiceRequestor from "../serviceRequestor.js";
4
4
  export default class DataSourceManager {
5
5
  private dataSources;
6
6
  /**
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const dataSourceOData_1 = require("./dataSourceOData");
4
- const dataSourceODataAnnotation_1 = require("./dataSourceODataAnnotation");
5
- const path_1 = require("path");
6
- class DataSourceManager {
7
- constructor() {
8
- this.dataSources = new Array();
9
- }
1
+ import DataSourceOData from "./dataSourceOData.js";
2
+ import DataSourceODataAnnotation from "./dataSourceODataAnnotation.js";
3
+ import path from "path/posix";
4
+ export default class DataSourceManager {
5
+ dataSources = new Array();
10
6
  /**
11
7
  * Parses dataSources from manifest.json.
12
8
  * @param dataSourcesJson manifest.json/sap.app/dataSources node
@@ -19,8 +15,8 @@ class DataSourceManager {
19
15
  // Loop over OData first to collect linked annotation names
20
16
  for (const [name, dataSource] of Object.entries(dataSourcesJson)) {
21
17
  if (dataSource.uri?.startsWith("/") && dataSource.type === "OData") {
22
- const uri = path_1.posix.normalize(dataSource.uri + "/$metadata");
23
- const odata = new dataSourceOData_1.default(name, uri, dataSource);
18
+ const uri = path.normalize(dataSource.uri + "/$metadata");
19
+ const odata = new DataSourceOData(name, uri, dataSource);
24
20
  odata.getAnnotations().forEach(annotation => odataAnnotationMap.set(annotation, uri));
25
21
  this.dataSources.push(odata);
26
22
  }
@@ -30,7 +26,7 @@ class DataSourceManager {
30
26
  const uri = dataSource.uri;
31
27
  const metadataUrl = odataAnnotationMap.get(name);
32
28
  if (uri?.startsWith("/") && dataSource.type === "ODataAnnotation") {
33
- this.dataSources.push(new dataSourceODataAnnotation_1.default(name, uri, dataSource, metadataUrl));
29
+ this.dataSources.push(new DataSourceODataAnnotation(name, uri, dataSource, metadataUrl));
34
30
  }
35
31
  }
36
32
  for (const dataSource of this.dataSources) {
@@ -46,5 +42,4 @@ class DataSourceManager {
46
42
  return annotationFiles;
47
43
  }
48
44
  }
49
- exports.default = DataSourceManager;
50
45
  //# sourceMappingURL=dataSourceManager.js.map
@@ -1,6 +1,6 @@
1
- import DataSource from "./dataSource";
2
- import Language from "../../model/language";
3
- import ServiceRequestor from "../serviceRequestor";
1
+ import DataSource from "./dataSource.js";
2
+ import Language from "../../model/language.js";
3
+ import ServiceRequestor from "../serviceRequestor.js";
4
4
  export interface IAnnotationDownloadParams {
5
5
  uri: string;
6
6
  xml: string;
@@ -1,20 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const convertV2ToV4_1 = require("../transformers/convertV2ToV4");
4
- const dataSource_1 = require("./dataSource");
5
- const makeAnnotationNamespaceUnique_1 = require("../transformers/makeAnnotationNamespaceUnique");
6
- const removeAllSchemaNodesExceptAnnotations_1 = require("../transformers/removeAllSchemaNodesExceptAnnotations");
7
- const traverseReferences_1 = require("../transformers/traverseReferences");
8
- const commonUtil_1 = require("../../util/commonUtil");
9
- class DataSourceOData extends dataSource_1.default {
1
+ import ConvertV2ToV4 from "../transformers/convertV2ToV4.js";
2
+ import DataSource from "./dataSource.js";
3
+ import MakeAnnotationNamespaceUnique from "../transformers/makeAnnotationNamespaceUnique.js";
4
+ import RemoveAllSchemaNodesExceptAnnotations from "../transformers/removeAllSchemaNodesExceptAnnotations.js";
5
+ import TraverseReferences from "../transformers/traverseReferences.js";
6
+ import { getUniqueName } from "../../util/commonUtil.js";
7
+ export default class DataSourceOData extends DataSource {
8
+ dataSourceJson;
10
9
  constructor(name, uri, dataSourceJson) {
11
10
  super(name, uri);
12
11
  this.dataSourceJson = dataSourceJson;
13
12
  this.jsonTransformers = [
14
- new traverseReferences_1.default(),
15
- new convertV2ToV4_1.default(),
16
- new removeAllSchemaNodesExceptAnnotations_1.default(),
17
- new makeAnnotationNamespaceUnique_1.default()
13
+ new TraverseReferences(),
14
+ new ConvertV2ToV4(),
15
+ new RemoveAllSchemaNodesExceptAnnotations(),
16
+ new MakeAnnotationNamespaceUnique()
18
17
  ];
19
18
  }
20
19
  updateManifest(manifestDataSources) {
@@ -23,7 +22,7 @@ class DataSourceOData extends dataSource_1.default {
23
22
  }
24
23
  addNewODataAnnotation(manifestDataSources) {
25
24
  const newAnnotationNameTemplate = `annotation_${this.name}`;
26
- let newAnnotationName = (0, commonUtil_1.getUniqueName)(Object.keys(manifestDataSources), newAnnotationNameTemplate);
25
+ let newAnnotationName = getUniqueName(Object.keys(manifestDataSources), newAnnotationNameTemplate);
27
26
  this.getAnnotations().unshift(newAnnotationName);
28
27
  manifestDataSources[newAnnotationName] = {
29
28
  type: "ODataAnnotation",
@@ -43,5 +42,4 @@ class DataSourceOData extends dataSource_1.default {
43
42
  return this.getSettings().annotations;
44
43
  }
45
44
  }
46
- exports.default = DataSourceOData;
47
45
  //# sourceMappingURL=dataSourceOData.js.map
@@ -1,4 +1,4 @@
1
- import DataSource from "./dataSource";
1
+ import DataSource from "./dataSource.js";
2
2
  export default class DataSourceODataAnnotation extends DataSource {
3
3
  private dataSourceJson;
4
4
  constructor(name: string, uri: string, dataSourceJson: any, metadataUrl: string | undefined);
@@ -1,18 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const dataSource_1 = require("./dataSource");
4
- const traverseReferences_1 = require("../transformers/traverseReferences");
5
- class DataSourceODataAnnotation extends dataSource_1.default {
1
+ import DataSource from "./dataSource.js";
2
+ import TraverseReferences from "../transformers/traverseReferences.js";
3
+ export default class DataSourceODataAnnotation extends DataSource {
4
+ dataSourceJson;
6
5
  constructor(name, uri, dataSourceJson, metadataUrl) {
7
6
  super(name, uri);
8
7
  this.dataSourceJson = dataSourceJson;
9
8
  this.jsonTransformers = [
10
- new traverseReferences_1.default(metadataUrl)
9
+ new TraverseReferences(metadataUrl)
11
10
  ];
12
11
  }
13
12
  updateManifest() {
14
13
  this.dataSourceJson.uri = this.getFilename();
15
14
  }
16
15
  }
17
- exports.default = DataSourceODataAnnotation;
18
16
  //# sourceMappingURL=dataSourceODataAnnotation.js.map
@@ -1,6 +1,6 @@
1
- import AbapRepoManager from "../repositories/abapRepoManager";
2
- import { IConfiguration } from "../model/types";
3
- import Language from "../model/language";
1
+ import AbapRepoManager from "../repositories/abapRepoManager.js";
2
+ import { IConfiguration } from "../model/types.js";
3
+ import Language from "../model/language.js";
4
4
  export default class ServiceRequestor {
5
5
  private abapRepoManager;
6
6
  private configuration;