@ui5/task-adaptation 1.6.2 → 1.6.4-rc.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 (55) hide show
  1. package/CHANGELOG.md +42 -3
  2. package/dist/adapters/abapAdapter.d.ts +2 -4
  3. package/dist/adapters/abapAdapter.js +5 -16
  4. package/dist/adapters/adapter.d.ts +3 -1
  5. package/dist/adapters/adapter.js +15 -1
  6. package/dist/adapters/cfAdapter.js +3 -12
  7. package/dist/adapters/commands/command.d.ts +3 -8
  8. package/dist/adapters/commands/command.js +5 -7
  9. package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +2 -4
  10. package/dist/adapters/commands/downloadAnnotationsCommand.js +2 -6
  11. package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.js +5 -24
  12. package/dist/adapters/previewAdapter.d.ts +10 -2
  13. package/dist/adapters/previewAdapter.js +14 -1
  14. package/dist/annotations/abapAnnotationManager.d.ts +17 -0
  15. package/dist/{annotationManager.js → annotations/abapAnnotationManager.js} +12 -10
  16. package/dist/annotations/annotationManager.d.ts +3 -0
  17. package/dist/annotations/annotationManager.js +2 -0
  18. package/dist/annotations/localAnnotationManager.d.ts +4 -0
  19. package/dist/annotations/localAnnotationManager.js +7 -0
  20. package/dist/annotations/serviceRequestor.d.ts +3 -3
  21. package/dist/annotations/serviceRequestor.js +4 -4
  22. package/dist/bundle.js +119 -2
  23. package/dist/index.js +6 -7
  24. package/dist/landscapeConfiguration.d.ts +9 -0
  25. package/dist/landscapeConfiguration.js +65 -0
  26. package/dist/model/configuration.d.ts +2 -0
  27. package/dist/previewManager.d.ts +4 -3
  28. package/dist/previewManager.js +15 -15
  29. package/dist/repositories/{abapRepoManager.d.ts → abapRepository.d.ts} +5 -3
  30. package/dist/repositories/{abapRepoManager.js → abapRepository.js} +17 -4
  31. package/dist/repositories/html5Repository.d.ts +18 -0
  32. package/dist/repositories/{html5RepoManager.js → html5Repository.js} +58 -27
  33. package/dist/repositories/localRepository.d.ts +16 -0
  34. package/dist/repositories/localRepository.js +62 -0
  35. package/dist/repositories/repository.d.ts +8 -0
  36. package/dist/repositories/repository.js +2 -0
  37. package/dist/util/cf/xsAppJsonUtil.d.ts +2 -1
  38. package/dist/util/cf/xsAppJsonUtil.js +19 -0
  39. package/dist/util/commonUtil.d.ts +1 -0
  40. package/dist/util/commonUtil.js +3 -0
  41. package/dist/util/fsUtil.d.ts +2 -0
  42. package/dist/util/fsUtil.js +34 -0
  43. package/package.json +6 -3
  44. package/scripts/publish.ts +256 -0
  45. package/scripts/test-integration-prep.sh +4 -0
  46. package/dist/annotationManager.d.ts +0 -17
  47. package/dist/processors/abapProcessor.d.ts +0 -18
  48. package/dist/processors/abapProcessor.js +0 -43
  49. package/dist/processors/cfProcessor.d.ts +0 -14
  50. package/dist/processors/cfProcessor.js +0 -46
  51. package/dist/processors/previewProcessor.d.ts +0 -8
  52. package/dist/processors/previewProcessor.js +0 -11
  53. package/dist/processors/processor.d.ts +0 -10
  54. package/dist/processors/processor.js +0 -39
  55. package/dist/repositories/html5RepoManager.d.ts +0 -12
@@ -0,0 +1,62 @@
1
+ import { getLogger } from "@ui5/logger";
2
+ import path from "node:path";
3
+ import fs from "node:fs/promises";
4
+ import FsUtil from "../util/fsUtil.js";
5
+ const log = getLogger("@ui5/task-adaptation::LocalRepository");
6
+ export default class LocalRepository {
7
+ configuration;
8
+ constructor(configuration) {
9
+ this.configuration = configuration;
10
+ }
11
+ async downloadAnnotationFile(_uri) {
12
+ log.verbose("Downloading annotation files is not supported in LocalRepository.");
13
+ return new Map();
14
+ }
15
+ async getAppVariantIdHierarchy(appId) {
16
+ const items = [];
17
+ await this.collectAppVariantIdHierarchyItems(appId, items);
18
+ return items;
19
+ }
20
+ fetch(appId, _cachebusterToken) {
21
+ return this.readFilesInBaseAppDir(appId);
22
+ }
23
+ fetchReuseLib(libName, _cachebusterToken, _lib) {
24
+ return this.readFilesInBaseAppDir(libName);
25
+ }
26
+ async collectAppVariantIdHierarchyItems(appId, items) {
27
+ items.push({
28
+ appVariantId: appId,
29
+ repoName: appId,
30
+ cachebusterToken: "local"
31
+ });
32
+ const appDir = this.getLocalFilesDirectory(appId);
33
+ const filenames = ["manifest.json", "manifest.appdescr_variant"];
34
+ const filepaths = filenames.map((filename) => path.join(appDir, filename));
35
+ const existingManifestPath = await this.getExistingManifestPath(filepaths);
36
+ if (existingManifestPath.endsWith("manifest.appdescr_variant")) {
37
+ const manifestContent = await fs.readFile(existingManifestPath, "utf-8");
38
+ const manifest = JSON.parse(manifestContent);
39
+ await this.collectAppVariantIdHierarchyItems(manifest.reference, items);
40
+ }
41
+ }
42
+ async getExistingManifestPath(filePaths) {
43
+ const existenceChecks = await Promise.all(filePaths.map((filePath) => FsUtil.exists(filePath)));
44
+ const existingIndex = existenceChecks.findIndex((exists) => exists);
45
+ if (existingIndex !== -1) {
46
+ return filePaths[existingIndex];
47
+ }
48
+ throw new Error(`None of the paths exist: '${filePaths.join("', '")}'.`);
49
+ }
50
+ readFilesInBaseAppDir(appId) {
51
+ const appDir = this.getLocalFilesDirectory(appId);
52
+ log.verbose(`Fetching base app files from local directory: ${appDir}`);
53
+ return FsUtil.readFilesRecursively(appDir);
54
+ }
55
+ getLocalFilesDirectory(appId) {
56
+ const baseDir = this.configuration.adpDir
57
+ ? path.normalize(this.configuration.adpDir).replace(/\\/g, "/").replace(/\/+$/, "").split("/")
58
+ : [".."];
59
+ return path.join(process.cwd(), ...baseDir, appId);
60
+ }
61
+ }
62
+ //# sourceMappingURL=localRepository.js.map
@@ -0,0 +1,8 @@
1
+ import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
2
+ import { IReuseLibInfo } from "../model/types.js";
3
+ export default interface IRepository {
4
+ getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
5
+ fetch(repoName: string, cachebusterToken: string): Promise<Map<string, string>>;
6
+ fetchReuseLib(libName: string, cachebusterToken: string, lib: IReuseLibInfo): Promise<Map<string, string>>;
7
+ downloadAnnotationFile(uri: string): Promise<Map<string, string>>;
8
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=repository.js.map
@@ -1,4 +1,4 @@
1
- import { ServiceCredentials } from "../../model/types.js";
1
+ import { IConfiguration, ServiceCredentials } from "../../model/types.js";
2
2
  export declare const XSAPP_JSON_FILENAME = "xs-app.json";
3
3
  /**
4
4
  * Merges multiple xs-app.json contents into one. AppVariant and Reuse Library
@@ -11,3 +11,4 @@ export declare const XSAPP_JSON_FILENAME = "xs-app.json";
11
11
  export declare function merge(xsAppFiles: string[]): string | undefined;
12
12
  export declare function enhanceRoutesWithEndpointAndService(xsAppJsonContent: string, serviceCredentials: ServiceCredentials): string;
13
13
  export declare function enhanceRoutes(serviceCredentials: ServiceCredentials, baseRoutes: any): any;
14
+ export declare function fetchCredentialsAndEnhanceRoutes(xsAppJson: string, { serviceInstanceName, space, appName }: IConfiguration): Promise<string>;
@@ -1,4 +1,5 @@
1
1
  import { getLogger } from "@ui5/logger";
2
+ import CFUtil from "../cfUtil.js";
2
3
  const log = getLogger("@ui5/task-adaptation::XSAppJsonUtil");
3
4
  export const XSAPP_JSON_FILENAME = "xs-app.json";
4
5
  /**
@@ -78,4 +79,22 @@ export function enhanceRoutes(serviceCredentials, baseRoutes) {
78
79
  }
79
80
  });
80
81
  }
82
+ export async function fetchCredentialsAndEnhanceRoutes(xsAppJson, { serviceInstanceName, space, appName }) {
83
+ if (!serviceInstanceName) {
84
+ throw new Error(`Service instance name must be specified in ui5.yaml configuration for app '${appName}'`);
85
+ }
86
+ let serviceCredentials;
87
+ try {
88
+ // Get valid service keys with proper endpoints structure
89
+ serviceCredentials = await CFUtil.getOrCreateServiceKeyWithEndpoints(serviceInstanceName, space);
90
+ }
91
+ catch (error) {
92
+ throw new Error(`Failed to get valid service keys for app '${appName}': ${error.message}`);
93
+ }
94
+ if (serviceCredentials) {
95
+ return enhanceRoutesWithEndpointAndService(xsAppJson, serviceCredentials);
96
+ }
97
+ log.info(`No endpoints found for app '${appName}'. xs-app.json will not be updated.`);
98
+ return xsAppJson;
99
+ }
81
100
  //# sourceMappingURL=xsAppJsonUtil.js.map
@@ -1,6 +1,7 @@
1
1
  import { IConfiguration } from "../model/types.js";
2
2
  import Language from "../model/language.js";
3
3
  export declare function dotToUnderscore(value: string): string;
4
+ export declare function validateConfiguration<T extends object>(options: T, properties: Array<keyof T>): void;
4
5
  export declare function validateObject<T extends object>(options: T, properties: Array<keyof T>, message: string): void;
5
6
  export declare function escapeRegex(update: string): string;
6
7
  export declare function insertInArray<T>(array: T[], index: number, insert: T): void;
@@ -9,6 +9,9 @@ const MANIFEST_CHANGE = "appdescr_";
9
9
  export function dotToUnderscore(value) {
10
10
  return value.replace(/\./g, "_");
11
11
  }
12
+ export function validateConfiguration(options, properties) {
13
+ validateObject(options, properties, "should be specified in ui5.yaml configuration");
14
+ }
12
15
  export function validateObject(options, properties, message) {
13
16
  for (const property of properties) {
14
17
  if (!options[property]) {
@@ -6,4 +6,6 @@ export default class FsUtil {
6
6
  * @returns true if the path exists, false if not
7
7
  */
8
8
  private static fileExists;
9
+ static readFilesRecursively(rootDirectory: string): Promise<Map<string, string>>;
10
+ static exists(filePath: string): Promise<boolean>;
9
11
  }
@@ -36,5 +36,39 @@ export default class FsUtil {
36
36
  throw e;
37
37
  }
38
38
  }
39
+ static async readFilesRecursively(rootDirectory) {
40
+ const directoriesToScan = [rootDirectory];
41
+ const fileReadTasks = [];
42
+ while (directoriesToScan.length > 0) {
43
+ const currentDirectory = directoriesToScan.pop();
44
+ if (!currentDirectory) {
45
+ continue;
46
+ }
47
+ const entries = await fs.readdir(currentDirectory, { withFileTypes: true });
48
+ for (const entry of entries) {
49
+ const entryPath = path.join(currentDirectory, entry.name);
50
+ if (entry.isDirectory()) {
51
+ directoriesToScan.push(entryPath);
52
+ }
53
+ else if (entry.isFile()) {
54
+ fileReadTasks.push((async () => {
55
+ const relativeFilePath = path.relative(rootDirectory, entryPath);
56
+ const content = await fs.readFile(entryPath, "utf-8");
57
+ return [relativeFilePath, content];
58
+ })());
59
+ }
60
+ }
61
+ }
62
+ return new Map(await Promise.all(fileReadTasks));
63
+ }
64
+ static async exists(filePath) {
65
+ try {
66
+ await fs.access(filePath);
67
+ return true;
68
+ }
69
+ catch {
70
+ return false;
71
+ }
72
+ }
39
73
  }
40
74
  //# sourceMappingURL=fsUtil.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/task-adaptation",
3
- "version": "1.6.2",
3
+ "version": "1.6.4-rc.1",
4
4
  "description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -59,7 +59,6 @@
59
59
  "@types/chai-as-promised": "^7.1.4",
60
60
  "@types/js-yaml": "^4.0.3",
61
61
  "@types/jsdom": "^21.1.6",
62
- "@types/lodash": "^4.14.196",
63
62
  "@types/mocha": "^9.1.0",
64
63
  "@types/semver": "^7.3.8",
65
64
  "@types/sinon": "^10.0.16",
@@ -115,7 +114,11 @@
115
114
  "src/annotations/transformers/transformer.ts",
116
115
  "src/model/configuration.ts",
117
116
  "src/model/appVariantIdHierarchyItem.ts",
118
- "src/adapters/adapter.ts"
117
+ "src/adapters/adapter.ts",
118
+ "src/adapters/previewAdapter.ts",
119
+ "src/repositories/repository.ts",
120
+ "src/annotations/annotationManager.ts",
121
+ "src/processors/processor.ts"
119
122
  ],
120
123
  "check-coverage": true,
121
124
  "statements": 85,
@@ -0,0 +1,256 @@
1
+ import { promises as fs } from "fs";
2
+ import path from "path";
3
+ import yargs from "yargs";
4
+ import { hideBin } from "yargs/helpers";
5
+ import { Octokit } from "@octokit/rest";
6
+ import { retry } from "@octokit/plugin-retry";
7
+
8
+ const OctokitClass = Octokit.plugin(retry);
9
+
10
+
11
+ /**
12
+ * Recursively get all file paths in the workspace root, excluding:
13
+ * - test/lib/integration
14
+ * - test/fixtures
15
+ * - test/expected
16
+ * - test/lib/index.perf.ts
17
+ * Returns relative paths from the root.
18
+ */
19
+ async function getAllRootFilesExceptTestExclusions(root: string): Promise<string[]> {
20
+ const excludeDirs = [
21
+ "test/lib/integration",
22
+ "test/fixtures",
23
+ "test/expected",
24
+ ".git",
25
+ "coverage",
26
+ ".DS_Store",
27
+ "node_modules",
28
+ ".nyc_output",
29
+ "coverage",
30
+ "dist",
31
+ "dist-debug",
32
+ "dist.zip",
33
+ ".env",
34
+ "test/resources/metadata/download"
35
+ ];
36
+ const excludeFiles = [
37
+ "test/lib/index.perf.ts",
38
+ "scripts/test-integration-prep.sh",
39
+ "Jenkinsfile"
40
+ ];
41
+
42
+ async function walk(dir: string): Promise<string[]> {
43
+ const dirents = await fs.readdir(dir, { withFileTypes: true });
44
+ const files: string[] = [];
45
+ for (const dirent of dirents) {
46
+ const relPath = path.relative(root, path.join(dir, dirent.name));
47
+ if (excludeDirs.some(ex => relPath === ex || relPath.startsWith(ex + path.sep))) {
48
+ continue;
49
+ }
50
+ if (excludeFiles.includes(relPath)) {
51
+ continue;
52
+ }
53
+ if (dirent.isDirectory()) {
54
+ files.push(...await walk(path.join(dir, dirent.name)));
55
+ } else {
56
+ files.push(relPath);
57
+ }
58
+ }
59
+ return files;
60
+ }
61
+ return walk(root);
62
+ }
63
+
64
+ const FILES = await getAllRootFilesExceptTestExclusions(process.cwd());
65
+
66
+
67
+ interface PublishArgs {
68
+ p?: string;
69
+ dryRun?: boolean;
70
+ tag?: string;
71
+ branch?: string;
72
+ [key: string]: unknown;
73
+ }
74
+
75
+ async function publish() {
76
+ const argv = yargs(hideBin(process.argv))
77
+ .option("p", {
78
+ type: "string",
79
+ description: "GitHub token (-p)",
80
+ alias: "p"
81
+ })
82
+ .option("dryRun", {
83
+ type: "boolean",
84
+ description: "Run without publishing",
85
+ default: false
86
+ })
87
+ .option("tag", {
88
+ type: "string",
89
+ description: "Publish with a specific tag"
90
+ })
91
+ .option("branch", {
92
+ type: "string",
93
+ description: "Branch to update (default: main)",
94
+ default: "main",
95
+ alias: "b"
96
+ })
97
+ .help()
98
+ .alias("h", "help")
99
+ .parseSync() as PublishArgs;
100
+
101
+ if (argv.dryRun) {
102
+ console.log("Dry run: no publishing will be performed.");
103
+ return;
104
+ }
105
+ const auth = argv.p;
106
+ if (auth) {
107
+ const octokit = new OctokitClass({ auth });
108
+ const ORGANIZATION = "SAP";
109
+ const REPO = "ui5-task-adaptation";
110
+ await uploadToRepo(octokit, ORGANIZATION, REPO, argv.branch);
111
+ if (argv.tag) {
112
+ console.log(`Published with tag: ${argv.tag}`);
113
+ }
114
+ } else {
115
+ console.log("Github token is not provided.");
116
+ }
117
+ }
118
+
119
+
120
+ async function getLatestVersion(): Promise<string> {
121
+ const pkg = await fs.readFile(path.join(process.cwd(), "package.json"), { encoding: "utf-8" });
122
+ const pkgJson = JSON.parse(pkg);
123
+ return pkgJson.version;
124
+ }
125
+
126
+
127
+ async function uploadToRepo(
128
+ octokit: InstanceType<typeof OctokitClass>,
129
+ org: string,
130
+ repo: string,
131
+ branch: string = "main"
132
+ ): Promise<void> {
133
+ const fileBlobs = await Promise.all(Object.values(FILES).map(file => toBlob(octokit, org, repo, path.join(process.cwd(), file))));
134
+ const currentCommit = await getCurrentCommit(octokit, org, repo, branch);
135
+ const newTree = await createNewTree(
136
+ octokit,
137
+ org,
138
+ repo,
139
+ fileBlobs,
140
+ FILES,
141
+ currentCommit.treeSha
142
+ );
143
+ const currentVersion = await getLatestVersion();
144
+ const commitMessage = `Release ${currentVersion}`;
145
+ const newCommit = await createNewCommit(
146
+ octokit,
147
+ org,
148
+ repo,
149
+ commitMessage,
150
+ newTree.sha,
151
+ currentCommit.commitSha
152
+ );
153
+ await setBranchToCommit(octokit, org, repo, branch, newCommit.sha);
154
+ }
155
+
156
+
157
+ async function getCurrentCommit(
158
+ octokit: InstanceType<typeof OctokitClass>,
159
+ org: string,
160
+ repo: string,
161
+ branch: string = "main"
162
+ ): Promise<{ commitSha: string; treeSha: string }> {
163
+ const { data: refData } = await octokit.git.getRef({
164
+ owner: org,
165
+ repo,
166
+ ref: `heads/${branch}`,
167
+ });
168
+ const commitSha = refData.object.sha
169
+ const { data: commitData } = await octokit.git.getCommit({
170
+ owner: org,
171
+ repo,
172
+ commit_sha: commitSha,
173
+ });
174
+ return {
175
+ commitSha,
176
+ treeSha: commitData.tree.sha,
177
+ }
178
+ }
179
+
180
+
181
+ async function toBlob(
182
+ octokit: InstanceType<typeof OctokitClass>,
183
+ org: string,
184
+ repo: string,
185
+ filePath: string
186
+ ): Promise<{ sha: string }> {
187
+ const content = await fs.readFile(filePath, { encoding: "utf8" });
188
+ const blobData = await octokit.git.createBlob({
189
+ owner: org,
190
+ repo,
191
+ content,
192
+ encoding: "utf-8",
193
+ })
194
+ return blobData.data;
195
+ }
196
+
197
+
198
+ async function createNewTree(
199
+ octokit: InstanceType<typeof OctokitClass>,
200
+ owner: string,
201
+ repo: string,
202
+ blobs: { sha: string }[],
203
+ paths: string[],
204
+ parentTreeSha: string
205
+ ): Promise<any> {
206
+ const tree = blobs.map(({ sha }, i) => ({
207
+ path: paths[i],
208
+ mode: "100644" as const,
209
+ type: "blob" as const,
210
+ sha,
211
+ }));
212
+ const { data } = await octokit.git.createTree({
213
+ owner,
214
+ repo,
215
+ tree,
216
+ base_tree: parentTreeSha,
217
+ })
218
+ return data;
219
+ }
220
+
221
+
222
+ async function createNewCommit(
223
+ octokit: InstanceType<typeof OctokitClass>,
224
+ org: string,
225
+ repo: string,
226
+ message: string,
227
+ currentTreeSha: string,
228
+ currentCommitSha: string
229
+ ): Promise<any> {
230
+ const commit = await octokit.git.createCommit({
231
+ owner: org,
232
+ repo,
233
+ message,
234
+ tree: currentTreeSha,
235
+ parents: [currentCommitSha],
236
+ });
237
+ return commit.data;
238
+ };
239
+
240
+
241
+ async function setBranchToCommit(
242
+ octokit: InstanceType<typeof OctokitClass>,
243
+ org: string,
244
+ repo: string,
245
+ branch: string = "main",
246
+ commitSha: string
247
+ ): Promise<any> {
248
+ return octokit.git.updateRef({
249
+ owner: org,
250
+ repo,
251
+ ref: `heads/${branch}`,
252
+ sha: commitSha,
253
+ });
254
+ }
255
+
256
+ publish();
@@ -0,0 +1,4 @@
1
+ for d in test/fixtures/*/ ; do
2
+ echo "$d"
3
+ npm --prefix $d i
4
+ done
@@ -1,17 +0,0 @@
1
- import AbapRepoManager from "./repositories/abapRepoManager.js";
2
- import { IConfiguration } from "./model/types.js";
3
- import Language from "./model/language.js";
4
- export interface IAnnotationFiles {
5
- annotationName: string;
6
- annotationFileName: string;
7
- }
8
- export default class AnnotationManager {
9
- private abapRepoManager;
10
- private configuration;
11
- constructor(configuration: IConfiguration, abapRepoManager: AbapRepoManager);
12
- ANNOTATIONS_FOLDER: string;
13
- process(baseAppManifest: any, languages: Language[], appVariantId: string, prefix: string): Promise<Map<string, string>>;
14
- private updateManifestModel;
15
- private createManifestModel;
16
- private enhanceManifestModel;
17
- }
@@ -1,18 +0,0 @@
1
- import AbapRepoManager from "../repositories/abapRepoManager.js";
2
- import AnnotationManager from "../annotationManager.js";
3
- import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
4
- import { IConfiguration } from "../model/types.js";
5
- import IProcessor from "./processor.js";
6
- import { IAdapter } from "../adapters/adapter.js";
7
- export default class AbapProcessor implements IProcessor {
8
- private abapRepoManager;
9
- private configuration;
10
- private annotationManager;
11
- constructor(configuration: IConfiguration, abapRepoManager: AbapRepoManager, annotationManager: AnnotationManager);
12
- getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
13
- getAdapter(): IAdapter;
14
- fetch(repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
15
- fetchReuseLib(): Promise<Map<string, string>>;
16
- validateConfiguration(): void;
17
- getConfigurationType(): string;
18
- }
@@ -1,43 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { cached } from "../cache/cacheHolder.js";
8
- import { validateObject } from "../util/commonUtil.js";
9
- import AbapAdapter from "../adapters/abapAdapter.js";
10
- export default class AbapProcessor {
11
- abapRepoManager;
12
- configuration;
13
- annotationManager;
14
- constructor(configuration, abapRepoManager, annotationManager) {
15
- this.configuration = configuration;
16
- this.abapRepoManager = abapRepoManager;
17
- this.annotationManager = annotationManager;
18
- }
19
- getAppVariantIdHierarchy(appId) {
20
- return this.abapRepoManager.getAppVariantIdHierarchy(appId);
21
- }
22
- getAdapter() {
23
- return new AbapAdapter(this.configuration, this.annotationManager);
24
- }
25
- fetch(repoName, _cachebusterToken) {
26
- return this.abapRepoManager.fetch(repoName);
27
- }
28
- fetchReuseLib() {
29
- throw new Error("Preview is not available on SAP S/4HANA On-Premise or Cloud Systems. Please create a ticket on CA-UI5-FL-ADP-BAS component.");
30
- }
31
- validateConfiguration() {
32
- // validate general app config
33
- const properties = ["appName"];
34
- validateObject(this.configuration, properties, "should be specified in ui5.yaml configuration");
35
- }
36
- getConfigurationType() {
37
- return "abap";
38
- }
39
- }
40
- __decorate([
41
- cached()
42
- ], AbapProcessor.prototype, "fetch", null);
43
- //# sourceMappingURL=abapProcessor.js.map
@@ -1,14 +0,0 @@
1
- import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
2
- import { IConfiguration, IReuseLibInfo } from "../model/types.js";
3
- import IProcessor from "./processor.js";
4
- import { IAdapter } from "../adapters/adapter.js";
5
- export default class CFProcessor implements IProcessor {
6
- protected configuration: IConfiguration;
7
- constructor(configuration: IConfiguration);
8
- getAdapter(): IAdapter;
9
- getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
10
- fetch(_repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
11
- fetchReuseLib(_libName: string, _cachebusterToken: string, lib: IReuseLibInfo): Promise<Map<string, string>>;
12
- validateConfiguration(): void;
13
- getConfigurationType(): string;
14
- }
@@ -1,46 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import HTML5RepoManager from "../repositories/html5RepoManager.js";
8
- import { cached } from "../cache/cacheHolder.js";
9
- import { validateObject } from "../util/commonUtil.js";
10
- import CFAdapter from "../adapters/cfAdapter.js";
11
- export default class CFProcessor {
12
- configuration;
13
- constructor(configuration) {
14
- this.configuration = configuration;
15
- }
16
- getAdapter() {
17
- return new CFAdapter(this.configuration);
18
- }
19
- async getAppVariantIdHierarchy(appId) {
20
- const metadata = await HTML5RepoManager.getMetadata(this.configuration);
21
- return [{
22
- repoName: this.configuration.appName,
23
- appVariantId: appId,
24
- cachebusterToken: metadata.changedOn
25
- }];
26
- }
27
- fetch(_repoName, _cachebusterToken) {
28
- return HTML5RepoManager.getBaseAppFiles(this.configuration);
29
- }
30
- fetchReuseLib(_libName, _cachebusterToken, lib) {
31
- return HTML5RepoManager.getReuseLibFiles(this.configuration, lib);
32
- }
33
- validateConfiguration() {
34
- validateObject(this.configuration, ["appHostId", "appName", "appVersion"], "should be specified in ui5.yaml configuration");
35
- }
36
- getConfigurationType() {
37
- return "cf";
38
- }
39
- }
40
- __decorate([
41
- cached()
42
- ], CFProcessor.prototype, "fetch", null);
43
- __decorate([
44
- cached()
45
- ], CFProcessor.prototype, "fetchReuseLib", null);
46
- //# sourceMappingURL=cfProcessor.js.map
@@ -1,8 +0,0 @@
1
- import { IAdapter } from "../adapters/adapter.js";
2
- import { IConfiguration } from "../model/types.js";
3
- import CFProcessor from "./cfProcessor.js";
4
- import IProcessor from "./processor.js";
5
- export default class PreviewProcessor extends CFProcessor implements IProcessor {
6
- constructor(configuration: IConfiguration);
7
- getAdapter(): IAdapter;
8
- }
@@ -1,11 +0,0 @@
1
- import PreviewAdapter from "../adapters/previewAdapter.js";
2
- import CFProcessor from "./cfProcessor.js";
3
- export default class PreviewProcessor extends CFProcessor {
4
- constructor(configuration) {
5
- super(configuration);
6
- }
7
- getAdapter() {
8
- return new PreviewAdapter(this.configuration);
9
- }
10
- }
11
- //# sourceMappingURL=previewProcessor.js.map
@@ -1,10 +0,0 @@
1
- import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
2
- import { IConfiguration, IReuseLibInfo } from "../model/types.js";
3
- import { IAdapter } from "../adapters/adapter.js";
4
- export default interface IProcessor {
5
- getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
6
- getAdapter(): IAdapter;
7
- fetch(repoName: string, cachebusterToken: string): Promise<Map<string, string>>;
8
- fetchReuseLib(repoName: string, cachebusterToken: string, lib: IReuseLibInfo): Promise<Map<string, string>>;
9
- }
10
- export declare function determineProcessor(configuration: IConfiguration): IProcessor;