@ui5/task-adaptation 1.4.3 → 1.5.1

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 (42) hide show
  1. package/CHANGELOG.md +6 -2
  2. package/README.md +16 -12
  3. package/dist/annotationManager.js +1 -3
  4. package/dist/annotations/serviceRequestor.js +3 -15
  5. package/dist/appVariantManager.d.ts +18 -11
  6. package/dist/appVariantManager.js +77 -80
  7. package/dist/baseAppManager.d.ts +16 -16
  8. package/dist/baseAppManager.js +57 -79
  9. package/dist/bundle.js +58 -42
  10. package/dist/cache/cacheHolder.d.ts +18 -0
  11. package/dist/cache/cacheHolder.js +80 -0
  12. package/dist/i18nManager.js +11 -9
  13. package/dist/index.js +26 -9
  14. package/dist/model/appVariantIdHierarchyItem.d.ts +5 -0
  15. package/dist/model/appVariantIdHierarchyItem.js +2 -0
  16. package/dist/model/language.d.ts +3 -3
  17. package/dist/model/language.js +11 -4
  18. package/dist/model/types.d.ts +2 -0
  19. package/dist/processors/abapProcessor.d.ts +4 -4
  20. package/dist/processors/abapProcessor.js +17 -6
  21. package/dist/processors/cfProcessor.d.ts +4 -4
  22. package/dist/processors/cfProcessor.js +21 -5
  23. package/dist/processors/processor.d.ts +4 -2
  24. package/dist/processors/processor.js +2 -4
  25. package/dist/repositories/abapRepoManager.d.ts +3 -1
  26. package/dist/repositories/abapRepoManager.js +24 -5
  27. package/dist/util/cfUtil.js +1 -1
  28. package/dist/util/commonUtil.d.ts +3 -2
  29. package/dist/util/commonUtil.js +17 -9
  30. package/dist/util/i18nMerger.d.ts +15 -20
  31. package/dist/util/i18nMerger.js +46 -64
  32. package/dist/util/resourceUtil.d.ts +3 -1
  33. package/dist/util/resourceUtil.js +15 -2
  34. package/eslint.config.js +2 -5
  35. package/package.json +16 -11
  36. package/types/ui5.d.ts +10 -0
  37. package/dist/cache/annotationsCacheManager.d.ts +0 -8
  38. package/dist/cache/annotationsCacheManager.js +0 -16
  39. package/dist/cache/baseAppFilesCacheManager.d.ts +0 -6
  40. package/dist/cache/baseAppFilesCacheManager.js +0 -12
  41. package/dist/cache/cacheManager.d.ts +0 -16
  42. package/dist/cache/cacheManager.js +0 -65
@@ -1,65 +0,0 @@
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;
7
- constructor(configuration) {
8
- this.configuration = configuration;
9
- }
10
- getTempFolder() {
11
- return path.join(tempFolder, this.getTempId());
12
- }
13
- async getFiles(fetchMetadata, fetchFiles) {
14
- const tempMetadata = this.readTempMetadata();
15
- const metadata = await fetchMetadata();
16
- if (this.isMetadataSame(tempMetadata, metadata)) {
17
- return this.readTemp();
18
- }
19
- else {
20
- const files = await fetchFiles();
21
- if (files?.size > 0) {
22
- await this.writeTemp(files, metadata);
23
- }
24
- return files;
25
- }
26
- }
27
- isMetadataSame(tempMetadata, metadata) {
28
- // TODO: Implement correct metadata comparision.
29
- return tempMetadata && metadata && tempMetadata.changedOn === metadata.changedOn;
30
- }
31
- readTempMetadata() {
32
- const tempFolder = this.getTempFolder();
33
- const filename = this.getMetadataFilename();
34
- const metadataPath = path.resolve(tempFolder, filename);
35
- if (fs.existsSync(metadataPath)) {
36
- return JSON.parse(fs.readFileSync(metadataPath, { encoding: "utf-8" }));
37
- }
38
- }
39
- writeTemp(files, metadata) {
40
- this.deleteTemp();
41
- const filesToCache = this.getFilesToCache(files, metadata);
42
- return ResourceUtil.write(this.getTempFolder(), filesToCache);
43
- }
44
- async readTemp() {
45
- const files = new Map();
46
- const tempFolder = this.getTempFolder();
47
- if (fs.existsSync(tempFolder)) {
48
- ResourceUtil.read(tempFolder, tempFolder, files, [this.getMetadataFilename()]);
49
- }
50
- return files;
51
- }
52
- deleteTemp() {
53
- fs.rmSync(this.getTempFolder(), { recursive: true, force: true });
54
- }
55
- normalizeId(id) {
56
- return id.replace(/\/\\/g, "_");
57
- }
58
- getFilesToCache(files, metadata) {
59
- const filename = this.getMetadataFilename();
60
- const filesClone = new Map([...files]);
61
- filesClone.set(filename, JSON.stringify(metadata));
62
- return filesClone;
63
- }
64
- }
65
- //# sourceMappingURL=cacheManager.js.map