@sap-ux/adp-tooling 0.12.49 → 0.12.50

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.
@@ -7,6 +7,9 @@ import type { UI5FlexLayer } from '@sap-ux/project-access';
7
7
  import type { MergedAppDescriptor } from '@sap-ux/axios-extension';
8
8
  import type { AdpPreviewConfig, CommonChangeProperties, DescriptorVariant, OperationType } from '../types';
9
9
  import type { Editor } from 'mem-fs-editor';
10
+ declare global {
11
+ var __SAP_UX_MANIFEST_SYNC_REQUIRED__: boolean | undefined;
12
+ }
10
13
  export declare const enum ApiRoutes {
11
14
  FRAGMENT = "/adp/api/fragment",
12
15
  CONTROLLER = "/adp/api/controller",
@@ -28,6 +31,8 @@ export declare class AdpPreview {
28
31
  * Routes handler class to handle API requests
29
32
  */
30
33
  private routesHandler;
34
+ private lrep;
35
+ private descriptorVariantId;
31
36
  /**
32
37
  * @returns merged manifest.
33
38
  */
@@ -36,7 +41,7 @@ export declare class AdpPreview {
36
41
  * @returns a list of resources required to the adaptation project as well as the original app.
37
42
  */
38
43
  get resources(): {
39
- [x: string]: string;
44
+ [name: string]: string;
40
45
  };
41
46
  /**
42
47
  * Constructor taking the config and a logger as input.
@@ -54,6 +59,11 @@ export declare class AdpPreview {
54
59
  * @returns the UI5 flex layer for which editing is enabled
55
60
  */
56
61
  init(descriptorVariant: DescriptorVariant): Promise<UI5FlexLayer>;
62
+ /**
63
+ * Synchronize local changes with the backend.
64
+ *
65
+ */
66
+ sync(): Promise<void>;
57
67
  /**
58
68
  * Proxy for the merged application manifest.json and blocking of preload files.
59
69
  *
@@ -24,6 +24,8 @@ class AdpPreview {
24
24
  * Routes handler class to handle API requests
25
25
  */
26
26
  routesHandler;
27
+ lrep;
28
+ descriptorVariantId;
27
29
  /**
28
30
  * @returns merged manifest.
29
31
  */
@@ -81,18 +83,29 @@ class AdpPreview {
81
83
  * @returns the UI5 flex layer for which editing is enabled
82
84
  */
83
85
  async init(descriptorVariant) {
86
+ this.descriptorVariantId = descriptorVariant.id;
84
87
  const provider = await (0, system_access_1.createAbapServiceProvider)(this.config.target, { ignoreCertErrors: this.config.ignoreCertErrors }, true, this.logger);
85
- const lrep = provider.getLayeredRepository();
88
+ this.lrep = provider.getLayeredRepository();
89
+ // fetch a merged descriptor from the backend
90
+ await this.lrep.getCsrfToken();
91
+ await this.sync();
92
+ return descriptorVariant.layer;
93
+ }
94
+ /**
95
+ * Synchronize local changes with the backend.
96
+ *
97
+ */
98
+ async sync() {
99
+ if (!this.lrep || !this.descriptorVariantId) {
100
+ throw new Error('Not initialized');
101
+ }
86
102
  const zip = new adm_zip_1.default();
87
103
  const files = await this.project.byGlob('**/*.*');
88
104
  for (const file of files) {
89
105
  zip.addFile(file.getPath().substring(1), await file.getBuffer());
90
106
  }
91
107
  const buffer = zip.toBuffer();
92
- // fetch a merged descriptor from the backend
93
- await lrep.getCsrfToken();
94
- this.mergedDescriptor = (await lrep.mergeAppDescriptorVariant(buffer))[descriptorVariant.id];
95
- return descriptorVariant.layer;
108
+ this.mergedDescriptor = (await this.lrep.mergeAppDescriptorVariant(buffer))[this.descriptorVariantId];
96
109
  }
97
110
  /**
98
111
  * Proxy for the merged application manifest.json and blocking of preload files.
@@ -103,6 +116,10 @@ class AdpPreview {
103
116
  */
104
117
  async proxy(req, res, next) {
105
118
  if (req.path === '/manifest.json') {
119
+ if (global.__SAP_UX_MANIFEST_SYNC_REQUIRED__) {
120
+ await this.sync();
121
+ global.__SAP_UX_MANIFEST_SYNC_REQUIRED__ = false;
122
+ }
106
123
  res.status(200);
107
124
  res.send(JSON.stringify(this.descriptor.manifest, undefined, 2));
108
125
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
11
11
  },
12
- "version": "0.12.49",
12
+ "version": "0.12.50",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",