@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
@@ -1,5 +1,5 @@
1
- import CacheManager from "./cacheManager";
2
- import { IConfiguration } from "../model/types";
1
+ import CacheManager from "./cacheManager.js";
2
+ import { IConfiguration } from "../model/types.js";
3
3
  export default class AnnotationsCacheManager extends CacheManager {
4
4
  private tempSubFolder;
5
5
  constructor(configuration: IConfiguration, tempSubFolder: string);
@@ -1,7 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cacheManager_1 = require("./cacheManager");
4
- class AnnotationsCacheManager extends cacheManager_1.default {
1
+ import CacheManager from "./cacheManager.js";
2
+ export default class AnnotationsCacheManager extends CacheManager {
3
+ tempSubFolder;
5
4
  constructor(configuration, tempSubFolder) {
6
5
  super(configuration);
7
6
  this.tempSubFolder = tempSubFolder;
@@ -14,5 +13,4 @@ class AnnotationsCacheManager extends cacheManager_1.default {
14
13
  return "annotationsmetadata.json";
15
14
  }
16
15
  }
17
- exports.default = AnnotationsCacheManager;
18
16
  //# sourceMappingURL=annotationsCacheManager.js.map
@@ -1,4 +1,4 @@
1
- import CacheManager from "./cacheManager";
1
+ import CacheManager from "./cacheManager.js";
2
2
  export default class BaseAppFilesCacheManager extends CacheManager {
3
3
  static METADATA_FILENAME: string;
4
4
  protected getTempId(): string;
@@ -1,7 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cacheManager_1 = require("./cacheManager");
4
- class BaseAppFilesCacheManager extends cacheManager_1.default {
1
+ import CacheManager from "./cacheManager.js";
2
+ export default class BaseAppFilesCacheManager extends CacheManager {
3
+ static METADATA_FILENAME = "html5metadata.json";
5
4
  getTempId() {
6
5
  const { appHostId, appName, appVersion } = this.configuration;
7
6
  return super.normalizeId(`ui5-${appHostId}-${appName}-${appVersion}`);
@@ -10,6 +9,4 @@ class BaseAppFilesCacheManager extends cacheManager_1.default {
10
9
  return BaseAppFilesCacheManager.METADATA_FILENAME;
11
10
  }
12
11
  }
13
- exports.default = BaseAppFilesCacheManager;
14
- BaseAppFilesCacheManager.METADATA_FILENAME = "html5metadata.json";
15
12
  //# sourceMappingURL=baseAppFilesCacheManager.js.map
@@ -1,4 +1,4 @@
1
- import { IConfiguration, IMetadata } from "../model/types";
1
+ import { IConfiguration, IMetadata } from "../model/types.js";
2
2
  export default abstract class CacheManager {
3
3
  protected configuration: IConfiguration;
4
4
  constructor(configuration: IConfiguration);
@@ -1,11 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs = require("fs");
4
- const path = require("path");
5
- const resourceUtil_1 = require("../util/resourceUtil");
6
- const rimraf = require("rimraf");
7
- const tempFolder = require('temp-dir');
8
- class CacheManager {
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import ResourceUtil from "../util/resourceUtil.js";
4
+ import tempFolder from "temp-dir";
5
+ export default class CacheManager {
6
+ configuration;
9
7
  constructor(configuration) {
10
8
  this.configuration = configuration;
11
9
  }
@@ -41,18 +39,18 @@ class CacheManager {
41
39
  writeTemp(files, metadata) {
42
40
  this.deleteTemp();
43
41
  const filesToCache = this.getFilesToCache(files, metadata);
44
- return resourceUtil_1.default.write(this.getTempFolder(), filesToCache);
42
+ return ResourceUtil.write(this.getTempFolder(), filesToCache);
45
43
  }
46
44
  async readTemp() {
47
45
  const files = new Map();
48
46
  const tempFolder = this.getTempFolder();
49
47
  if (fs.existsSync(tempFolder)) {
50
- resourceUtil_1.default.read(tempFolder, tempFolder, files, [this.getMetadataFilename()]);
48
+ ResourceUtil.read(tempFolder, tempFolder, files, [this.getMetadataFilename()]);
51
49
  }
52
50
  return files;
53
51
  }
54
52
  deleteTemp() {
55
- rimraf.sync(this.getTempFolder());
53
+ fs.rmSync(this.getTempFolder(), { recursive: true, force: true });
56
54
  }
57
55
  normalizeId(id) {
58
56
  return id.replace(/\/\\/g, "_");
@@ -64,5 +62,4 @@ class CacheManager {
64
62
  return filesClone;
65
63
  }
66
64
  }
67
- exports.default = CacheManager;
68
65
  //# sourceMappingURL=cacheManager.js.map
@@ -1,6 +1,6 @@
1
- import { IDiffProperty } from "./annotations/comparator/comparator";
2
- import { IJsonPerLanguage, IJsonPromisePerLanguage } from "./model/types";
3
- import Language from "./model/language";
1
+ import { IDiffProperty } from "./annotations/comparator/comparator.js";
2
+ import { IJsonPerLanguage, IJsonPromisePerLanguage } from "./model/types.js";
3
+ import Language from "./model/language.js";
4
4
  export declare class PropertyValue {
5
5
  value: string;
6
6
  isReference: boolean;
@@ -1,15 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.I18nFileContent = exports.PropertyValue = void 0;
4
- const comparator_1 = require("./annotations/comparator/comparator");
5
- const annotationDiffStructureError_1 = require("./model/annotationDiffStructureError");
6
- const commonUtil_1 = require("./util/commonUtil");
7
- const posix_1 = require("path/posix"); // Ensure standardized dir separators to ensure Windows compatibility
1
+ import Comparator from "./annotations/comparator/comparator.js";
2
+ import AnnotationDiffStructureError from "./model/annotationDiffStructureError.js";
3
+ import { getUniqueName } from "./util/commonUtil.js";
4
+ import { join } from "path/posix"; // Ensure standardized dir separators to ensure Windows compatibility
8
5
  // To generate keys, english language is more common, so compare all other
9
6
  // languages with it
10
- class PropertyValue {
7
+ export class PropertyValue {
8
+ value;
9
+ isReference = false;
10
+ qualifier;
11
+ language;
12
+ static OLD = "__old";
13
+ static NEW = "__new";
11
14
  constructor(qualifier, language, value) {
12
- this.isReference = false;
13
15
  this.qualifier = qualifier;
14
16
  this.language = language;
15
17
  this.value = value;
@@ -28,12 +30,9 @@ class PropertyValue {
28
30
  return new PropertyValue(PropertyValue.NEW, language, value);
29
31
  }
30
32
  }
31
- exports.PropertyValue = PropertyValue;
32
- PropertyValue.OLD = "__old";
33
- PropertyValue.NEW = "__new";
34
- class I18nFileContent {
33
+ export class I18nFileContent {
34
+ properties = new Map();
35
35
  constructor(languages) {
36
- this.properties = new Map();
37
36
  languages.forEach(language => this.properties.set(language, new Map()));
38
37
  }
39
38
  add(prop, key) {
@@ -74,18 +73,20 @@ class I18nFileContent {
74
73
  if (language.i18n) {
75
74
  filename += "_" + language.i18n;
76
75
  }
77
- const filepath = (0, posix_1.join)(i18nPathName, filename + ".properties");
76
+ const filepath = join(i18nPathName, filename + ".properties");
78
77
  files.set(filepath, [...i18nLines].map(([key, value]) => `${key}=${value}`).join("\n"));
79
78
  });
80
79
  }
81
80
  return files;
82
81
  }
83
82
  }
84
- exports.I18nFileContent = I18nFileContent;
85
- class I18nManager {
83
+ export default class I18nManager {
84
+ modelName;
85
+ appVariantId;
86
+ references = new Map();
87
+ existingKeys = new Set();
88
+ i18nFileContent;
86
89
  constructor(modelName, appVariantId, languages) {
87
- this.references = new Map();
88
- this.existingKeys = new Set();
89
90
  this.modelName = modelName;
90
91
  this.appVariantId = appVariantId;
91
92
  this.i18nFileContent = new I18nFileContent(languages);
@@ -136,13 +137,13 @@ class I18nManager {
136
137
  let p = defaultAnnotation;
137
138
  for (const c of annotationJsons.map(([language, json]) => ({ language, json }))) {
138
139
  try {
139
- const comparator = new comparator_1.default(await p.json, await c.json);
140
+ const comparator = new Comparator(await p.json, await c.json);
140
141
  const pDiff = comparator.compare();
141
142
  this.processDiff(pDiff.properties, p.language, c.language);
142
143
  p.json = pDiff.json;
143
144
  }
144
145
  catch (error) {
145
- if (error instanceof annotationDiffStructureError_1.default) {
146
+ if (error instanceof AnnotationDiffStructureError) {
146
147
  throw new Error(`The structure of the OData annotation xml of language '${p.language}' is different from xml of language '${c.language}' near element: ${error.message}`);
147
148
  }
148
149
  throw error;
@@ -188,7 +189,7 @@ class I18nManager {
188
189
  throw new Error("Failed to create unique key from: " + JSON.stringify(value));
189
190
  }
190
191
  const propertyName = value.replace(/\W/gi, "_").toUpperCase();
191
- const key = (0, commonUtil_1.getUniqueName)([...this.existingKeys.keys()], propertyName);
192
+ const key = getUniqueName([...this.existingKeys.keys()], propertyName);
192
193
  this.existingKeys.add(key);
193
194
  return key;
194
195
  }
@@ -199,5 +200,4 @@ class I18nManager {
199
200
  propertyValues.forEach(prop => prop.set(diff, this.references));
200
201
  }
201
202
  }
202
- exports.default = I18nManager;
203
203
  //# sourceMappingURL=i18nManager.js.map
package/dist/index.d.ts CHANGED
@@ -1 +1,6 @@
1
- export {};
1
+ import { ITaskParameters } from "./model/types.js";
2
+ /**
3
+ * Creates an appVariant bundle from the provided resources.
4
+ */
5
+ declare const _default: ({ workspace, options, taskUtil }: ITaskParameters) => Promise<void>;
6
+ export default _default;
package/dist/index.js CHANGED
@@ -1,25 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const dotenv = require("dotenv");
4
- const commonUtil_1 = require("./util/commonUtil");
5
- const appVariantManager_1 = require("./appVariantManager");
6
- const baseAppManager_1 = require("./baseAppManager");
7
- const i18nMerger_1 = require("./util/i18nMerger");
8
- const processor_1 = require("./processors/processor");
1
+ import * as dotenv from "dotenv";
2
+ import { logBetaUsage, logBuilderVersion } from "./util/commonUtil.js";
3
+ import AppVariantManager from "./appVariantManager.js";
4
+ import BaseAppManager from "./baseAppManager.js";
5
+ import I18NMerger from "./util/i18nMerger.js";
6
+ import { determineProcessor } from "./processors/processor.js";
9
7
  /**
10
8
  * Creates an appVariant bundle from the provided resources.
11
9
  */
12
- module.exports = ({ workspace, options, taskUtil }) => {
10
+ export default ({ workspace, options, taskUtil }) => {
13
11
  dotenv.config();
14
12
  async function process(workspace, taskUtil) {
15
- await (0, commonUtil_1.logBuilderVersion)();
16
- (0, commonUtil_1.logBetaUsage)();
17
- const processor = (0, processor_1.determineProcessor)(options.configuration);
18
- const appVariantResources = await appVariantManager_1.default.getAppVariantResourcesToProcess(workspace);
19
- const appVariantInfo = await appVariantManager_1.default.process(appVariantResources, options.projectNamespace, taskUtil);
13
+ await logBuilderVersion();
14
+ logBetaUsage();
15
+ const processor = determineProcessor(options.configuration);
16
+ const appVariantResources = await AppVariantManager.getAppVariantResourcesToProcess(workspace);
17
+ const appVariantInfo = await AppVariantManager.process(appVariantResources, options.projectNamespace, taskUtil);
20
18
  const baseAppFiles = await processor.getBaseAppFiles(appVariantInfo.reference);
21
- const { resources, manifestInfo } = await baseAppManager_1.default.process(baseAppFiles, appVariantInfo, options, processor);
22
- const mergedResources = await i18nMerger_1.default.mergeI18NFiles(resources, appVariantResources, options.projectNamespace, manifestInfo.i18nPath, appVariantInfo, taskUtil);
19
+ const { resources, manifestInfo } = await BaseAppManager.process(baseAppFiles, appVariantInfo, options, processor);
20
+ const mergedResources = await I18NMerger.mergeI18NFiles(resources, appVariantResources, options.projectNamespace, manifestInfo.i18nPath, appVariantInfo, taskUtil);
23
21
  await Promise.all(mergedResources.map(resource => workspace.write(resource)));
24
22
  }
25
23
  return process(workspace, taskUtil);
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class AnnotationDiffStructureError extends Error {
1
+ export default class AnnotationDiffStructureError extends Error {
4
2
  constructor(json) {
5
3
  super(JSON.stringify(json));
6
4
  this.name = "AnnotationDiffStructureError";
7
5
  this.message = `The structure of the OData annotation xml is different near element: ${JSON.stringify(json)}`;
8
6
  }
9
7
  }
10
- exports.default = AnnotationDiffStructureError;
11
8
  //# sourceMappingURL=annotationDiffStructureError.js.map
@@ -1,6 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class Language {
1
+ export default class Language {
2
+ sap;
3
+ i18n;
4
+ isDefault;
4
5
  constructor(sap, i18n) {
5
6
  this.sap = sap;
6
7
  this.i18n = i18n;
@@ -33,5 +34,4 @@ class Language {
33
34
  }
34
35
  ;
35
36
  }
36
- exports.default = Language;
37
37
  //# sourceMappingURL=language.js.map
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class NoAuthorizationProvidedError extends Error {
1
+ export default class NoAuthorizationProvidedError extends Error {
4
2
  constructor(uri) {
5
3
  super(`Request requires authorization: '${uri}'`);
6
4
  }
7
5
  }
8
- exports.default = NoAuthorizationProvidedError;
9
6
  //# sourceMappingURL=noAuthorizationProvidedError.js.map
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class ServerError extends Error {
1
+ export default class ServerError extends Error {
4
2
  constructor(uri, error) {
5
3
  super(`Request ${uri} failed with Server error: ${error.response.status}${error.response.data ?? ""}`);
6
4
  }
7
5
  }
8
- exports.default = ServerError;
9
6
  //# sourceMappingURL=serverError.js.map
@@ -1,4 +1,4 @@
1
- import Language from "./language";
1
+ import Language from "./language.js";
2
2
  export interface IConfiguration {
3
3
  writeTempFiles?: any;
4
4
  appHostId?: string;
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
@@ -1,8 +1,8 @@
1
- import AbapRepoManager from "../repositories/abapRepoManager";
2
- import AnnotationManager from "../annotationManager";
3
- import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager";
4
- import { IConfiguration } from "../model/types";
5
- import IProcessor from "./processor";
1
+ import AbapRepoManager from "../repositories/abapRepoManager.js";
2
+ import AnnotationManager from "../annotationManager.js";
3
+ import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager.js";
4
+ import { IConfiguration } from "../model/types.js";
5
+ import IProcessor from "./processor.js";
6
6
  export default class AbapProcessor implements IProcessor {
7
7
  private abapRepoManager;
8
8
  private configuration;
@@ -1,8 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const commonUtil_1 = require("../util/commonUtil");
4
- const language_1 = require("../model/language");
5
- class AbapProcessor {
1
+ import { validateObject } from "../util/commonUtil.js";
2
+ import Language from "../model/language.js";
3
+ export default class AbapProcessor {
4
+ abapRepoManager;
5
+ configuration;
6
+ cacheManager;
7
+ annotationManager;
6
8
  constructor(configuration, cacheManager, abapRepoManager, annotationManager) {
7
9
  this.configuration = configuration;
8
10
  this.abapRepoManager = abapRepoManager;
@@ -13,10 +15,10 @@ class AbapProcessor {
13
15
  return this.cacheManager.getFiles(() => this.abapRepoManager.getMetadata(baseAppId), () => this.abapRepoManager.downloadBaseAppFiles());
14
16
  }
15
17
  validateConfiguration() {
16
- (0, commonUtil_1.validateObject)(this.configuration, ["destination", "appName"], "should be specified in ui5.yaml configuration");
18
+ validateObject(this.configuration, ["destination", "appName"], "should be specified in ui5.yaml configuration");
17
19
  }
18
20
  async updateLandscapeSpecificContent(renamedBaseAppManifest, baseAppFiles) {
19
- const files = await this.annotationManager.process(renamedBaseAppManifest, (language_1.default.create(this.configuration.languages)));
21
+ const files = await this.annotationManager.process(renamedBaseAppManifest, (Language.create(this.configuration.languages)));
20
22
  if (baseAppFiles) {
21
23
  files.forEach((value, key) => baseAppFiles.set(key, value));
22
24
  }
@@ -32,5 +34,4 @@ class AbapProcessor {
32
34
  };
33
35
  }
34
36
  }
35
- exports.default = AbapProcessor;
36
37
  //# sourceMappingURL=abapProcessor.js.map
@@ -1,6 +1,6 @@
1
- import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager";
2
- import { IConfiguration } from "../model/types";
3
- import IProcessor from "./processor";
1
+ import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager.js";
2
+ import { IConfiguration } from "../model/types.js";
3
+ import IProcessor from "./processor.js";
4
4
  export default class CFProcessor implements IProcessor {
5
5
  private configuration;
6
6
  private cacheManager;
@@ -1,17 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const html5RepoManager_1 = require("../repositories/html5RepoManager");
4
- const commonUtil_1 = require("../util/commonUtil");
5
- class CFProcessor {
1
+ import HTML5RepoManager from "../repositories/html5RepoManager.js";
2
+ import { validateObject } from "../util/commonUtil.js";
3
+ export default class CFProcessor {
4
+ configuration;
5
+ cacheManager;
6
6
  constructor(configuration, cacheManager) {
7
7
  this.configuration = configuration;
8
8
  this.cacheManager = cacheManager;
9
9
  }
10
10
  async getBaseAppFiles() {
11
- return this.cacheManager.getFiles(() => html5RepoManager_1.default.getMetadata(this.configuration), () => html5RepoManager_1.default.getBaseAppFiles(this.configuration));
11
+ return this.cacheManager.getFiles(() => HTML5RepoManager.getMetadata(this.configuration), () => HTML5RepoManager.getBaseAppFiles(this.configuration));
12
12
  }
13
13
  validateConfiguration() {
14
- (0, commonUtil_1.validateObject)(this.configuration, ["appHostId", "appName", "appVersion"], "should be specified in ui5.yaml configuration");
14
+ validateObject(this.configuration, ["appHostId", "appName", "appVersion"], "should be specified in ui5.yaml configuration");
15
15
  }
16
16
  async updateLandscapeSpecificContent(renamedBaseAppManifest) {
17
17
  this.updateCloudPlatform(renamedBaseAppManifest);
@@ -42,5 +42,4 @@ class CFProcessor {
42
42
  };
43
43
  }
44
44
  }
45
- exports.default = CFProcessor;
46
45
  //# sourceMappingURL=cfProcessor.js.map
@@ -1,4 +1,4 @@
1
- import { IConfiguration } from "../model/types";
1
+ import { IConfiguration } from "../model/types.js";
2
2
  export default interface IProcessor {
3
3
  createAppVariantHierarchyItem(appVariantId: string, version: string): void;
4
4
  getBaseAppFiles(baseAppId: string): Promise<Map<string, string>>;
@@ -1,18 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.determineProcessor = void 0;
4
- const abapProcessor_1 = require("./abapProcessor");
5
- const abapRepoManager_1 = require("../repositories/abapRepoManager");
6
- const annotationManager_1 = require("../annotationManager");
7
- const baseAppFilesCacheManager_1 = require("../cache/baseAppFilesCacheManager");
8
- const cfProcessor_1 = require("./cfProcessor");
9
- function determineProcessor(configuration) {
10
- const cacheManager = new baseAppFilesCacheManager_1.default(configuration);
11
- const abapRepoManager = new abapRepoManager_1.default(configuration);
12
- const annotationManager = new annotationManager_1.default(configuration, abapRepoManager);
1
+ import AbapProcessor from "./abapProcessor.js";
2
+ import AbapRepoManager from "../repositories/abapRepoManager.js";
3
+ import AnnotationManager from "../annotationManager.js";
4
+ import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager.js";
5
+ import CFProcessor from "./cfProcessor.js";
6
+ export function determineProcessor(configuration) {
7
+ const cacheManager = new BaseAppFilesCacheManager(configuration);
8
+ const abapRepoManager = new AbapRepoManager(configuration);
9
+ const annotationManager = new AnnotationManager(configuration, abapRepoManager);
13
10
  const processors = [
14
- new cfProcessor_1.default(configuration, cacheManager),
15
- new abapProcessor_1.default(configuration, cacheManager, abapRepoManager, annotationManager)
11
+ new CFProcessor(configuration, cacheManager),
12
+ new AbapProcessor(configuration, cacheManager, abapRepoManager, annotationManager)
16
13
  ];
17
14
  let processor = processors.find(processor => processor.getConfigurationType() === configuration.type);
18
15
  if (processor) {
@@ -32,5 +29,4 @@ function determineProcessor(configuration) {
32
29
  }
33
30
  throw new Error("ui5.yaml configuration should correspond either ABAP or SAP BTP landscape");
34
31
  }
35
- exports.determineProcessor = determineProcessor;
36
32
  //# sourceMappingURL=processor.js.map
@@ -1,4 +1,4 @@
1
- import { IConfiguration, IMetadata } from "../model/types";
1
+ import { IConfiguration, IMetadata } from "../model/types.js";
2
2
  export default class AbapRepoManager {
3
3
  private auth?;
4
4
  private configuration;
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const requestUtil_1 = require("../util/requestUtil");
4
- const zipUtil_1 = require("../util/zipUtil");
5
- const log = require("@ui5/logger").getLogger("@ui5/task-adaptation::AbapRepoManager");
1
+ import RequestUtil from "../util/requestUtil.js";
2
+ import { getLogger } from "@ui5/logger";
3
+ import { unzipZipEntries } from "../util/zipUtil.js";
4
+ const log = getLogger("@ui5/task-adaptation::AbapRepoManager");
6
5
  const REQUEST_OPTIONS_XML = {
7
6
  responseType: "text",
8
7
  headers: {
@@ -14,28 +13,30 @@ const REQUEST_OPTIONS_JSON = {
14
13
  "Accept": "application/json"
15
14
  }
16
15
  };
17
- class AbapRepoManager {
16
+ export default class AbapRepoManager {
17
+ auth;
18
+ configuration;
18
19
  constructor(configuration) {
19
20
  this.configuration = configuration;
20
21
  }
21
22
  async getAnnotationMetadata(uri) {
22
- const header = await requestUtil_1.default.retryWithAuth(() => requestUtil_1.default.head(uri), () => requestUtil_1.default.head(uri, this.getAuth()));
23
+ const header = await RequestUtil.retryWithAuth(() => RequestUtil.head(uri), () => RequestUtil.head(uri, this.getAuth()));
23
24
  return { changedOn: header.modified };
24
25
  }
25
26
  async downloadAnnotationFile(uri) {
26
27
  const annotationUri = `https://${this.configuration.destination}.dest${uri}`;
27
- const annotation = await requestUtil_1.default.retryWithAuth(() => requestUtil_1.default.get(annotationUri, REQUEST_OPTIONS_XML), () => requestUtil_1.default.get(annotationUri, REQUEST_OPTIONS_XML, this.getAuth()));
28
+ const annotation = await RequestUtil.retryWithAuth(() => RequestUtil.get(annotationUri, REQUEST_OPTIONS_XML), () => RequestUtil.get(annotationUri, REQUEST_OPTIONS_XML, this.getAuth()));
28
29
  return new Map([["annotation.xml", annotation]]);
29
30
  }
30
31
  getMetadata(baseAppId) {
31
- return requestUtil_1.default.retryWithAuth(() => this.getMetadataRequest(baseAppId), () => this.getMetadataRequest(baseAppId, this.getAuth()));
32
+ return RequestUtil.retryWithAuth(() => this.getMetadataRequest(baseAppId), () => this.getMetadataRequest(baseAppId, this.getAuth()));
32
33
  }
33
34
  downloadBaseAppFiles() {
34
- return requestUtil_1.default.retryWithAuth(() => this.downloadBaseAppFilesRequest(), () => this.downloadBaseAppFilesRequest(this.getAuth()));
35
+ return RequestUtil.retryWithAuth(() => this.downloadBaseAppFilesRequest(), () => this.downloadBaseAppFilesRequest(this.getAuth()));
35
36
  }
36
37
  async getMetadataRequest(id, auth) {
37
38
  let uri = `https://${this.configuration.destination}.dest/sap/bc/ui2/app_index/ui5_app_info_json?id=${id}`;
38
- const data = await requestUtil_1.default.get(uri, REQUEST_OPTIONS_JSON, auth);
39
+ const data = await RequestUtil.get(uri, REQUEST_OPTIONS_JSON, auth);
39
40
  if (data && data[id]) {
40
41
  return {
41
42
  changedOn: data[id].url,
@@ -48,10 +49,10 @@ class AbapRepoManager {
48
49
  const { destination, appName } = this.configuration;
49
50
  const encodedAppName = encodeURIComponent(appName);
50
51
  const uri = `https://${destination}.dest/sap/opu/odata/UI5/ABAP_REPOSITORY_SRV/Repositories('${encodedAppName}')?DownloadFiles=RUNTIME&CodePage=UTF8`;
51
- const data = await requestUtil_1.default.get(uri, {}, auth);
52
+ const data = await RequestUtil.get(uri, {}, auth);
52
53
  if (data?.d?.ZipArchive.length > 0) {
53
54
  const buffer = Buffer.from(data.d.ZipArchive, "base64");
54
- return (0, zipUtil_1.unzipZipEntries)(buffer);
55
+ return unzipZipEntries(buffer);
55
56
  }
56
57
  throw new Error(`App '${appName}' from destination '${destination}' doesn't contain files`);
57
58
  }
@@ -78,5 +79,4 @@ class AbapRepoManager {
78
79
  return this.auth;
79
80
  }
80
81
  }
81
- exports.default = AbapRepoManager;
82
82
  //# sourceMappingURL=abapRepoManager.js.map
@@ -1,4 +1,4 @@
1
- import { IConfiguration } from "./../model/types";
1
+ import { IConfiguration } from "./../model/types.js";
2
2
  export default class HTML5RepoManager {
3
3
  static getBaseAppFiles(configuration: IConfiguration): Promise<Map<string, string>>;
4
4
  static getMetadata(configuration: IConfiguration): Promise<any>;
@@ -1,10 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cfUtil_1 = require("./../util/cfUtil");
4
- const requestUtil_1 = require("./../util/requestUtil");
5
- const zipUtil_1 = require("./../util/zipUtil");
6
- const log = require("@ui5/logger").getLogger("@ui5/task-adaptation::HTML5RepoManager");
7
- class HTML5RepoManager {
1
+ import CFUtil from "./../util/cfUtil.js";
2
+ import RequestUtil from "./../util/requestUtil.js";
3
+ import { getLogger } from "@ui5/logger";
4
+ import { unzipZipEntries } from "./../util/zipUtil.js";
5
+ const log = getLogger("@ui5/task-adaptation::HTML5RepoManager");
6
+ export default class HTML5RepoManager {
8
7
  static async getBaseAppFiles(configuration) {
9
8
  const { token, baseUri } = await this.getHtml5RepoInfo(configuration);
10
9
  return this.getBaseAppZipEntries(configuration, baseUri, token);
@@ -14,7 +13,7 @@ class HTML5RepoManager {
14
13
  return this.requestMetadata(configuration, baseUri, token);
15
14
  }
16
15
  static async getHtml5RepoInfo(configuration) {
17
- const spaceGuid = await cfUtil_1.default.getSpaceGuid(configuration?.spaceGuid);
16
+ const spaceGuid = await CFUtil.getSpaceGuid(configuration?.spaceGuid);
18
17
  const credentials = await this.getHTML5Credentials(spaceGuid);
19
18
  const token = await this.getToken(credentials);
20
19
  return {
@@ -37,7 +36,7 @@ class HTML5RepoManager {
37
36
  serviceName: SERVIСE_INSTANCE_NAME,
38
37
  tags: ["html5-apps-repo-rt"]
39
38
  };
40
- const serviceKeys = await cfUtil_1.default.getServiceInstanceKeys(getParams, createParams);
39
+ const serviceKeys = await CFUtil.getServiceInstanceKeys(getParams, createParams);
41
40
  return serviceKeys.credentials;
42
41
  }
43
42
  static async getToken({ uaa }) {
@@ -50,7 +49,7 @@ class HTML5RepoManager {
50
49
  }
51
50
  };
52
51
  const uri = `${uaa.url}/oauth/token?grant_type=client_credentials`;
53
- return requestUtil_1.default.get(uri, options).then((json) => json["access_token"]);
52
+ return RequestUtil.get(uri, options).then((json) => json["access_token"]);
54
53
  }
55
54
  static async requestMetadata(options, html5RepoBaseUri, token) {
56
55
  const { appHostId, appName, appVersion } = options;
@@ -62,20 +61,20 @@ class HTML5RepoManager {
62
61
  "x-app-host-id": appHostId
63
62
  }
64
63
  };
65
- const metadata = await requestUtil_1.default.get(uri, requestOptions);
64
+ const metadata = await RequestUtil.get(uri, requestOptions);
66
65
  return metadata.find((item) => item.appHostId === appHostId && item.applicationName === appName && item.applicationVersion === appVersion);
67
66
  }
68
67
  static async getBaseAppZipEntries(options, html5RepoBaseUri, token) {
69
68
  const { appHostId, appName, appVersion } = options;
70
69
  const uri = `${html5RepoBaseUri}/applications/content/${appName}-${appVersion}/`;
71
70
  const zip = await this.download(token, appHostId, uri);
72
- return (0, zipUtil_1.unzipZipEntries)(zip);
71
+ return unzipZipEntries(zip);
73
72
  }
74
73
  static async download(token, appHostId, uri) {
75
74
  if (!token) {
76
75
  throw new Error("HTML5 token is undefined");
77
76
  }
78
- return requestUtil_1.default.get(uri, {
77
+ return RequestUtil.get(uri, {
79
78
  responseType: "arraybuffer",
80
79
  headers: {
81
80
  "Content-Type": "application/json",
@@ -85,5 +84,4 @@ class HTML5RepoManager {
85
84
  });
86
85
  }
87
86
  }
88
- exports.default = HTML5RepoManager;
89
87
  //# sourceMappingURL=html5RepoManager.js.map