@ui5/task-adaptation 1.3.1 → 1.3.3

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 (97) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +18 -0
  3. package/dist/annotationManager.d.ts +18 -0
  4. package/dist/annotationManager.js +79 -0
  5. package/dist/annotations/comparator/comparator.d.ts +47 -0
  6. package/dist/annotations/comparator/comparator.js +283 -0
  7. package/dist/annotations/comparator/diffCase.d.ts +4 -0
  8. package/dist/annotations/comparator/diffCase.js +2 -0
  9. package/dist/annotations/comparator/interchangableCase.d.ts +25 -0
  10. package/dist/annotations/comparator/interchangableCase.js +60 -0
  11. package/dist/annotations/converter/metadataJsonReferenceUtil.d.ts +12 -0
  12. package/dist/annotations/converter/metadataJsonReferenceUtil.js +48 -0
  13. package/dist/annotations/converter/metadataJsonUtil.d.ts +30 -0
  14. package/dist/annotations/converter/metadataJsonUtil.js +70 -0
  15. package/dist/annotations/converter/ui5JsonConverter.d.ts +21 -0
  16. package/dist/annotations/converter/ui5JsonConverter.js +252 -0
  17. package/dist/annotations/converter/ui5MetadataJsonUtil.d.ts +3 -0
  18. package/dist/annotations/converter/ui5MetadataJsonUtil.js +10 -0
  19. package/dist/annotations/converter/ui5XmlConverter.d.ts +5 -0
  20. package/dist/annotations/converter/ui5XmlConverter.js +14 -0
  21. package/dist/annotations/dataSource/dataSource.d.ts +34 -0
  22. package/dist/annotations/dataSource/dataSource.js +62 -0
  23. package/dist/annotations/dataSource/dataSourceManager.d.ts +12 -0
  24. package/dist/annotations/dataSource/dataSourceManager.js +45 -0
  25. package/dist/annotations/dataSource/dataSourceOData.d.ts +17 -0
  26. package/dist/annotations/dataSource/dataSourceOData.js +45 -0
  27. package/dist/annotations/dataSource/dataSourceODataAnnotation.d.ts +6 -0
  28. package/dist/annotations/dataSource/dataSourceODataAnnotation.js +16 -0
  29. package/dist/annotations/serviceRequestor.d.ts +9 -0
  30. package/dist/annotations/serviceRequestor.js +73 -0
  31. package/dist/annotations/transformers/convertV2ToV4.d.ts +4 -0
  32. package/dist/annotations/transformers/convertV2ToV4.js +13 -0
  33. package/dist/annotations/transformers/makeAnnotationNamespaceUnique.d.ts +6 -0
  34. package/dist/annotations/transformers/makeAnnotationNamespaceUnique.js +41 -0
  35. package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.d.ts +4 -0
  36. package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.js +14 -0
  37. package/dist/annotations/transformers/transformer.d.ts +12 -0
  38. package/dist/annotations/transformers/transformer.js +2 -0
  39. package/dist/annotations/transformers/traverseReferences.d.ts +9 -0
  40. package/dist/annotations/transformers/traverseReferences.js +66 -0
  41. package/dist/appVariantManager.d.ts +12 -0
  42. package/dist/appVariantManager.js +102 -0
  43. package/dist/baseAppManager.d.ts +29 -0
  44. package/dist/baseAppManager.js +139 -0
  45. package/dist/buildStrategy.d.ts +7 -0
  46. package/dist/buildStrategy.js +19 -0
  47. package/dist/bundle.d.ts +25 -0
  48. package/dist/bundle.js +7146 -0
  49. package/dist/cache/annotationsCacheManager.d.ts +8 -0
  50. package/dist/cache/annotationsCacheManager.js +16 -0
  51. package/dist/cache/baseAppFilesCacheManager.d.ts +6 -0
  52. package/dist/cache/baseAppFilesCacheManager.js +12 -0
  53. package/dist/cache/cacheManager.d.ts +16 -0
  54. package/dist/cache/cacheManager.js +65 -0
  55. package/dist/i18nManager.d.ts +43 -0
  56. package/dist/i18nManager.js +203 -0
  57. package/dist/index.d.ts +6 -0
  58. package/dist/index.js +25 -0
  59. package/dist/model/annotationDiffStructureError.d.ts +3 -0
  60. package/dist/model/annotationDiffStructureError.js +8 -0
  61. package/dist/model/configuration.d.ts +21 -0
  62. package/dist/model/configuration.js +2 -0
  63. package/dist/model/language.d.ts +13 -0
  64. package/dist/model/language.js +37 -0
  65. package/dist/model/serverError.d.ts +3 -0
  66. package/dist/model/serverError.js +6 -0
  67. package/dist/model/types.d.ts +105 -0
  68. package/dist/model/types.js +2 -0
  69. package/dist/processors/abapProcessor.d.ts +21 -0
  70. package/dist/processors/abapProcessor.js +39 -0
  71. package/dist/processors/cfProcessor.d.ts +17 -0
  72. package/dist/processors/cfProcessor.js +45 -0
  73. package/dist/processors/processor.d.ts +7 -0
  74. package/dist/processors/processor.js +32 -0
  75. package/dist/repositories/abapProvider.d.ts +9 -0
  76. package/dist/repositories/abapProvider.js +69 -0
  77. package/dist/repositories/abapRepoManager.d.ts +11 -0
  78. package/dist/repositories/abapRepoManager.js +71 -0
  79. package/dist/repositories/html5RepoManager.d.ts +11 -0
  80. package/dist/repositories/html5RepoManager.js +87 -0
  81. package/dist/util/cfUtil.d.ts +30 -0
  82. package/dist/util/cfUtil.js +171 -0
  83. package/dist/util/commonUtil.d.ts +13 -0
  84. package/dist/util/commonUtil.js +118 -0
  85. package/dist/util/i18nMerger.d.ts +32 -0
  86. package/dist/util/i18nMerger.js +99 -0
  87. package/dist/util/requestUtil.d.ts +6 -0
  88. package/dist/util/requestUtil.js +36 -0
  89. package/dist/util/resourceUtil.d.ts +11 -0
  90. package/dist/util/resourceUtil.js +62 -0
  91. package/dist/util/urlUtil.d.ts +4 -0
  92. package/dist/util/urlUtil.js +18 -0
  93. package/dist/util/xmlUtil.d.ts +4 -0
  94. package/dist/util/xmlUtil.js +21 -0
  95. package/dist/util/zipUtil.d.ts +2 -0
  96. package/dist/util/zipUtil.js +16 -0
  97. package/package.json +8 -3
@@ -0,0 +1,8 @@
1
+ import CacheManager from "./cacheManager.js";
2
+ import { IConfiguration } from "../model/types.js";
3
+ export default class AnnotationsCacheManager extends CacheManager {
4
+ private tempSubFolder;
5
+ constructor(configuration: IConfiguration, tempSubFolder: string);
6
+ protected getTempId(): string;
7
+ getMetadataFilename(): string;
8
+ }
@@ -0,0 +1,16 @@
1
+ import CacheManager from "./cacheManager.js";
2
+ export default class AnnotationsCacheManager extends CacheManager {
3
+ tempSubFolder;
4
+ constructor(configuration, tempSubFolder) {
5
+ super(configuration);
6
+ this.tempSubFolder = tempSubFolder;
7
+ }
8
+ getTempId() {
9
+ const { destination, appName } = this.configuration;
10
+ return super.normalizeId(`ui5-${destination}-${appName}-${this.tempSubFolder}`);
11
+ }
12
+ getMetadataFilename() {
13
+ return "annotationsmetadata.json";
14
+ }
15
+ }
16
+ //# sourceMappingURL=annotationsCacheManager.js.map
@@ -0,0 +1,6 @@
1
+ import CacheManager from "./cacheManager.js";
2
+ export default class BaseAppFilesCacheManager extends CacheManager {
3
+ static METADATA_FILENAME: string;
4
+ protected getTempId(): string;
5
+ getMetadataFilename(): string;
6
+ }
@@ -0,0 +1,12 @@
1
+ import CacheManager from "./cacheManager.js";
2
+ export default class BaseAppFilesCacheManager extends CacheManager {
3
+ static METADATA_FILENAME = "html5metadata.json";
4
+ getTempId() {
5
+ const { appHostId, appName, appVersion } = this.configuration;
6
+ return super.normalizeId(`ui5-${appHostId}-${appName}-${appVersion}`);
7
+ }
8
+ getMetadataFilename() {
9
+ return BaseAppFilesCacheManager.METADATA_FILENAME;
10
+ }
11
+ }
12
+ //# sourceMappingURL=baseAppFilesCacheManager.js.map
@@ -0,0 +1,16 @@
1
+ import { IConfiguration, IMetadata } from "../model/types.js";
2
+ export default abstract class CacheManager {
3
+ protected configuration: IConfiguration;
4
+ constructor(configuration: IConfiguration);
5
+ protected abstract getMetadataFilename(): string;
6
+ protected abstract getTempId(): string;
7
+ protected getTempFolder(): string;
8
+ getFiles(fetchMetadata: () => Promise<IMetadata>, fetchFiles: () => Promise<Map<string, string>>): Promise<Map<string, string>>;
9
+ isMetadataSame(tempMetadata: IMetadata, metadata: IMetadata): boolean;
10
+ readTempMetadata(): any;
11
+ writeTemp(files: Map<string, string>, metadata: any): Promise<void[]>;
12
+ readTemp(): Promise<Map<string, string>>;
13
+ deleteTemp(): void;
14
+ protected normalizeId(id: string): string;
15
+ private getFilesToCache;
16
+ }
@@ -0,0 +1,65 @@
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
@@ -0,0 +1,43 @@
1
+ import { IDiffProperty } from "./annotations/comparator/comparator.js";
2
+ import { IJsonPerLanguage, IJsonPromisePerLanguage } from "./model/types.js";
3
+ import Language from "./model/language.js";
4
+ export declare class PropertyValue {
5
+ value: string;
6
+ isReference: boolean;
7
+ qualifier: string;
8
+ language: Language;
9
+ private static OLD;
10
+ private static NEW;
11
+ private constructor();
12
+ get isOld(): boolean;
13
+ set(diff: any, references: Map<string, string>): void;
14
+ static oldFrom(language: Language, value?: string): PropertyValue;
15
+ static newFrom(language: Language, value?: string): PropertyValue;
16
+ }
17
+ export declare class I18nFileContent {
18
+ private properties;
19
+ constructor(languages: Language[]);
20
+ add(prop: PropertyValue, key: string): void;
21
+ private initKeyValuesForOtherLanguages;
22
+ hasTranslations(): boolean;
23
+ private getOrCreateLanguageContent;
24
+ createFiles(i18nPathName: string): Map<string, string>;
25
+ }
26
+ export default class I18nManager {
27
+ private modelName;
28
+ private appVariantId;
29
+ private references;
30
+ private existingKeys;
31
+ private i18nFileContent;
32
+ constructor(modelName: string, appVariantId: string, languages: Language[]);
33
+ processDiff(properties: Set<IDiffProperty>, previousLanguage: Language, currentLanguage: Language): void;
34
+ createFiles(i18nPathName: string): Map<string, string>;
35
+ populateTranslations(annotationJsons: Map<Language, Promise<any>>): Promise<IJsonPromisePerLanguage>;
36
+ populate(annotationJsons: [Language, Promise<any>][], defaultAnnotation: IJsonPerLanguage): Promise<IJsonPerLanguage>;
37
+ static extractDefaultLanguageAnnotation(annotationJsons: Map<Language, Promise<any>>): IJsonPromisePerLanguage;
38
+ private replaceWithModelReference;
39
+ private createReference;
40
+ getUniqueKeyForValue(value: string): string;
41
+ hasTranslations(): boolean;
42
+ private initPropertyValues;
43
+ }
@@ -0,0 +1,203 @@
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
5
+ // To generate keys, english language is more common, so compare all other
6
+ // languages with it
7
+ export class PropertyValue {
8
+ value;
9
+ isReference = false;
10
+ qualifier;
11
+ language;
12
+ static OLD = "__old";
13
+ static NEW = "__new";
14
+ constructor(qualifier, language, value) {
15
+ this.qualifier = qualifier;
16
+ this.language = language;
17
+ this.value = value;
18
+ }
19
+ get isOld() {
20
+ return this.qualifier === PropertyValue.OLD;
21
+ }
22
+ set(diff, references) {
23
+ this.value = diff[this.qualifier];
24
+ this.isReference = references.has(diff[this.qualifier]);
25
+ }
26
+ static oldFrom(language, value = "") {
27
+ return new PropertyValue(PropertyValue.OLD, language, value);
28
+ }
29
+ static newFrom(language, value = "") {
30
+ return new PropertyValue(PropertyValue.NEW, language, value);
31
+ }
32
+ }
33
+ export class I18nFileContent {
34
+ properties = new Map();
35
+ constructor(languages) {
36
+ languages.forEach(language => this.properties.set(language, new Map()));
37
+ }
38
+ add(prop, key) {
39
+ this.getOrCreateLanguageContent(prop.language).set(key, prop.value);
40
+ this.initKeyValuesForOtherLanguages(prop, key);
41
+ }
42
+ initKeyValuesForOtherLanguages(prop, key) {
43
+ // "", EN, EN_US, DE, FR
44
+ // If we already compared 2 languages and saved translations, we assume
45
+ // that we have generated all property keys, but suddenly 3d language or
46
+ // further contain translation which was not present in previous
47
+ // languages we need to update all other languages then. These values
48
+ // will be overwritten later by actual values of the language:
49
+ // this.getOrCreateLanguageContent(prop.language).set(key, prop.value);
50
+ if (prop.isOld) {
51
+ this.properties.forEach((keyValue, language) => {
52
+ if (language !== prop.language && !keyValue.has(key)) {
53
+ keyValue.set(key, prop.value);
54
+ }
55
+ });
56
+ }
57
+ }
58
+ hasTranslations() {
59
+ // this.properties.size can be 0 or 2+, it can't be 1
60
+ return [...this.properties.values()].some(keyValue => keyValue.size > 0);
61
+ }
62
+ getOrCreateLanguageContent(language) {
63
+ if (!this.properties.has(language)) {
64
+ this.properties.set(language, new Map());
65
+ }
66
+ return this.properties.get(language);
67
+ }
68
+ createFiles(i18nPathName) {
69
+ const files = new Map();
70
+ if (this.hasTranslations()) {
71
+ this.properties.forEach((i18nLines, language) => {
72
+ let filename = "i18n";
73
+ if (language.i18n) {
74
+ filename += "_" + language.i18n;
75
+ }
76
+ const filepath = join(i18nPathName, filename + ".properties");
77
+ files.set(filepath, [...i18nLines].map(([key, value]) => `${key}=${value}`).join("\n"));
78
+ });
79
+ }
80
+ return files;
81
+ }
82
+ }
83
+ export default class I18nManager {
84
+ modelName;
85
+ appVariantId;
86
+ references = new Map();
87
+ existingKeys = new Set();
88
+ i18nFileContent;
89
+ constructor(modelName, appVariantId, languages) {
90
+ this.modelName = modelName;
91
+ this.appVariantId = appVariantId;
92
+ this.i18nFileContent = new I18nFileContent(languages);
93
+ }
94
+ processDiff(properties, previousLanguage, currentLanguage) {
95
+ // json-diff uses __old and __new value as diff,
96
+ // so we assign it with languages which were in comparison
97
+ const propertyValues = [
98
+ PropertyValue.oldFrom(previousLanguage),
99
+ PropertyValue.newFrom(currentLanguage)
100
+ ];
101
+ for (const property of properties) {
102
+ this.replaceWithModelReference(property, propertyValues);
103
+ }
104
+ }
105
+ createFiles(i18nPathName) {
106
+ return this.i18nFileContent.createFiles(i18nPathName);
107
+ }
108
+ async populateTranslations(annotationJsons) {
109
+ /* We compare annotations. Diff gives us:
110
+ {
111
+ "string": {
112
+ "__old": "A"
113
+ "__new": "B"
114
+ }
115
+ }
116
+ we generate key and extract to properties file. Now it looks so:
117
+ {
118
+ "string": "{@i18n>id_KEY}"
119
+ }
120
+ and we compare this with next language and diff gives us:
121
+ {
122
+ "string": {
123
+ "__old": "{@i18n>id_KEY}"
124
+ "__new": "C"
125
+ }
126
+ }
127
+ we use already generate key id_KEY and extract translation value to
128
+ properties file again. And then compare with the next language and so on
129
+ and so on */
130
+ let defaultAnnotation = I18nManager.extractDefaultLanguageAnnotation(annotationJsons);
131
+ if (annotationJsons.size > 0 && defaultAnnotation) {
132
+ defaultAnnotation = await this.populate([...annotationJsons], defaultAnnotation);
133
+ }
134
+ return defaultAnnotation;
135
+ }
136
+ async populate(annotationJsons, defaultAnnotation) {
137
+ let p = defaultAnnotation;
138
+ for (const c of annotationJsons.map(([language, json]) => ({ language, json }))) {
139
+ try {
140
+ const comparator = new Comparator(await p.json, await c.json);
141
+ const pDiff = comparator.compare();
142
+ this.processDiff(pDiff.properties, p.language, c.language);
143
+ p.json = pDiff.json;
144
+ }
145
+ catch (error) {
146
+ if (error instanceof AnnotationDiffStructureError) {
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}`);
148
+ }
149
+ throw error;
150
+ }
151
+ }
152
+ return p;
153
+ }
154
+ static extractDefaultLanguageAnnotation(annotationJsons) {
155
+ let json = null;
156
+ for (const [language, json] of annotationJsons) {
157
+ if (language.isDefault) {
158
+ annotationJsons.delete(language);
159
+ return { json, language };
160
+ }
161
+ }
162
+ const language = [...annotationJsons.keys()][0];
163
+ json = annotationJsons.get(language);
164
+ annotationJsons.delete(language);
165
+ return { json, language };
166
+ }
167
+ replaceWithModelReference({ object, property }, propertyValues) {
168
+ const diff = object[property];
169
+ this.initPropertyValues(diff, propertyValues);
170
+ // If there are already generated key, like on step 3. above comment, we
171
+ // take it (from __old), so we don't need to generate new
172
+ const propReference = propertyValues.find(prop => prop.isReference);
173
+ let reference = propReference?.value ?? this.createReference(diff.__old);
174
+ object[property] = reference;
175
+ // Other values, which are not references, are extracted to .properties
176
+ const key = this.references.get(reference);
177
+ if (key) {
178
+ propertyValues.filter(prop => !prop.isReference).forEach(prop => this.i18nFileContent.add(prop, key));
179
+ }
180
+ }
181
+ createReference(value) {
182
+ const key = this.appVariantId + "_" + this.getUniqueKeyForValue(value);
183
+ const reference = `{${this.modelName}>${key}}`;
184
+ this.references.set(reference, key);
185
+ return reference;
186
+ }
187
+ getUniqueKeyForValue(value) {
188
+ if (typeof value !== "string") {
189
+ throw new Error("Failed to create unique key from: " + JSON.stringify(value));
190
+ }
191
+ const propertyName = value.replace(/\W/gi, "_").toUpperCase();
192
+ const key = getUniqueName([...this.existingKeys.keys()], propertyName);
193
+ this.existingKeys.add(key);
194
+ return key;
195
+ }
196
+ hasTranslations() {
197
+ return this.i18nFileContent.hasTranslations();
198
+ }
199
+ initPropertyValues(diff, propertyValues) {
200
+ propertyValues.forEach(prop => prop.set(diff, this.references));
201
+ }
202
+ }
203
+ //# sourceMappingURL=i18nManager.js.map
@@ -0,0 +1,6 @@
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 ADDED
@@ -0,0 +1,25 @@
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";
7
+ /**
8
+ * Creates an appVariant bundle from the provided resources.
9
+ */
10
+ export default ({ workspace, options, taskUtil }) => {
11
+ dotenv.config();
12
+ async function process(workspace, taskUtil) {
13
+ 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);
18
+ const baseAppFiles = await processor.getBaseAppFiles(appVariantInfo.reference);
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);
21
+ await Promise.all(mergedResources.map(resource => workspace.write(resource)));
22
+ }
23
+ return process(workspace, taskUtil);
24
+ };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ export default class AnnotationDiffStructureError extends Error {
2
+ constructor(json: any);
3
+ }
@@ -0,0 +1,8 @@
1
+ export default class AnnotationDiffStructureError extends Error {
2
+ constructor(json) {
3
+ super(JSON.stringify(json));
4
+ this.name = "AnnotationDiffStructureError";
5
+ this.message = `The structure of the OData annotation xml is different near element: ${JSON.stringify(json)}`;
6
+ }
7
+ }
8
+ //# sourceMappingURL=annotationDiffStructureError.js.map
@@ -0,0 +1,21 @@
1
+ import { AbapTarget } from "@sap-ux/system-access";
2
+ export interface IConfiguration {
3
+ appHostId?: string;
4
+ appId?: string;
5
+ appName?: string;
6
+ appVersion?: string;
7
+ spaceGuid?: string;
8
+ orgGuid?: string;
9
+ sapCloudService?: string;
10
+ destination?: string;
11
+ type?: "cf" | "abap";
12
+ languages?: any[] | undefined;
13
+ enableAnnotationCache?: boolean;
14
+ enableBetaFeatures?: boolean;
15
+ writeTempFiles?: any;
16
+ connections?: (AbapTarget & IAbapTargetMeta)[];
17
+ }
18
+ export interface IAbapTargetMeta {
19
+ name?: string;
20
+ ignoreCertErrors?: boolean;
21
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1,13 @@
1
+ export default class Language {
2
+ sap: string;
3
+ i18n: string;
4
+ isDefault: boolean;
5
+ constructor(sap: string, i18n: string);
6
+ /**
7
+ * Create a language array from languages in configuration and default language.
8
+ * @param languages Typically an array of objects. Probably could be undefined.
9
+ * @returns An array of type Language, where the default language is placed first,
10
+ * followed by the passed config languages.
11
+ */
12
+ static create(languages: any[] | undefined): Language[];
13
+ }
@@ -0,0 +1,37 @@
1
+ export default class Language {
2
+ sap;
3
+ i18n;
4
+ isDefault;
5
+ constructor(sap, i18n) {
6
+ this.sap = sap;
7
+ this.i18n = i18n;
8
+ this.isDefault = sap === "";
9
+ }
10
+ /**
11
+ * Create a language array from languages in configuration and default language.
12
+ * @param languages Typically an array of objects. Probably could be undefined.
13
+ * @returns An array of type Language, where the default language is placed first,
14
+ * followed by the passed config languages.
15
+ */
16
+ static create(languages) {
17
+ const defaultLanguage = new Language("", "");
18
+ let configLanguages = [];
19
+ if (languages !== undefined) {
20
+ configLanguages = languages.map(item => {
21
+ if (typeof item === "string") {
22
+ // For legacy language format support which is just a string and doesn't contain i18n
23
+ return new Language(item, item.toLowerCase());
24
+ }
25
+ else if (item.sap !== undefined && item.i18n !== undefined) {
26
+ return new Language(item.sap, item.i18n);
27
+ }
28
+ else {
29
+ throw new Error("Can not parse languages from ui5.yaml configuration. Please use the 'AdaptationProject: Create wizard' to generate the project.");
30
+ }
31
+ });
32
+ }
33
+ return [defaultLanguage, ...configLanguages];
34
+ }
35
+ ;
36
+ }
37
+ //# sourceMappingURL=language.js.map
@@ -0,0 +1,3 @@
1
+ export default class ServerError extends Error {
2
+ constructor(uri: string, error: any);
3
+ }
@@ -0,0 +1,6 @@
1
+ export default class ServerError extends Error {
2
+ constructor(uri, error) {
3
+ super(`Request ${uri} failed with Server error: ${error.response.status}${error.response.data ?? ""}`);
4
+ }
5
+ }
6
+ //# sourceMappingURL=serverError.js.map
@@ -0,0 +1,105 @@
1
+ import { IConfiguration } from "./configuration.js";
2
+ import Language from "./language.js";
3
+ export interface IProjectOptions {
4
+ configuration: IConfiguration;
5
+ projectNamespace: string;
6
+ }
7
+ export interface ICreateServiceInstanceParams {
8
+ spaceGuid: string;
9
+ planName: string;
10
+ serviceName: string;
11
+ serviceInstanceName?: string;
12
+ tags: string[];
13
+ parameters?: any;
14
+ }
15
+ export interface IGetServiceInstanceParams {
16
+ [key: string]: string[] | undefined;
17
+ spaceGuids?: string[];
18
+ planNames?: string[];
19
+ names: string[];
20
+ }
21
+ export interface IServiceInstance {
22
+ name: string;
23
+ guid: string;
24
+ }
25
+ export interface IResource {
26
+ name: string;
27
+ guid: string;
28
+ tags: string[];
29
+ visibility_type: string;
30
+ }
31
+ export interface IServiceKeys {
32
+ credentials: ICredentials;
33
+ serviceInstance: IServiceInstance;
34
+ }
35
+ export interface ICredentials {
36
+ [key: string]: any;
37
+ uaa: IUaa;
38
+ uri: string;
39
+ endpoints: any;
40
+ }
41
+ export interface IUaa {
42
+ clientid: string;
43
+ clientsecret: string;
44
+ url: string;
45
+ }
46
+ export interface IAppVariantInfo {
47
+ id: string;
48
+ reference: string;
49
+ layer?: string;
50
+ changes: IChange[];
51
+ }
52
+ export interface IAppVariantManifest {
53
+ id: string;
54
+ reference: string;
55
+ layer?: string;
56
+ content: IChange[];
57
+ }
58
+ export interface IChange {
59
+ changeType: string;
60
+ texts?: IChangeText;
61
+ layer?: string;
62
+ content?: IChangeContent;
63
+ }
64
+ export interface IChangeText {
65
+ i18n: string;
66
+ }
67
+ export interface IChangeContent {
68
+ bundleUrl?: string;
69
+ fallbackLocale?: string;
70
+ modelId?: string;
71
+ supportedLocales?: string[];
72
+ }
73
+ export interface ITaskParameters {
74
+ workspace: any;
75
+ options: IProjectOptions;
76
+ taskUtil: any;
77
+ }
78
+ export interface IBaseAppInfo {
79
+ filepath: string;
80
+ content: any;
81
+ }
82
+ export interface IHTML5RepoInfo {
83
+ token: string;
84
+ baseUri: string;
85
+ }
86
+ export interface IAuth {
87
+ username: string;
88
+ password: string;
89
+ }
90
+ export interface IMetadata {
91
+ changedOn: string;
92
+ id?: string;
93
+ }
94
+ export type KeyedMap<T, K extends keyof T, V> = {
95
+ [k in K]: V;
96
+ };
97
+ export interface IJsonPerLanguage {
98
+ language: Language;
99
+ json: any;
100
+ }
101
+ export interface IJsonPromisePerLanguage {
102
+ language: Language;
103
+ json: Promise<any>;
104
+ }
105
+ export { IConfiguration };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,21 @@
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
+ export default class AbapProcessor implements IProcessor {
7
+ private abapRepoManager;
8
+ private configuration;
9
+ private cacheManager;
10
+ private annotationManager;
11
+ constructor(configuration: IConfiguration, cacheManager: BaseAppFilesCacheManager, abapRepoManager: AbapRepoManager, annotationManager: AnnotationManager);
12
+ getBaseAppFiles(baseAppId: string): Promise<Map<string, string>>;
13
+ validateConfiguration(): void;
14
+ updateLandscapeSpecificContent(renamedBaseAppManifest: any, baseAppFiles?: Map<string, string>): Promise<void>;
15
+ getConfigurationType(): string;
16
+ createAppVariantHierarchyItem(appVariantId: string, version: string): {
17
+ appVariantId: string;
18
+ version: string;
19
+ layer: string;
20
+ };
21
+ }