@sap-ux/adp-tooling 0.9.1 → 0.9.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.
@@ -137,13 +137,14 @@ function findChangeWithInboundId(projectPath, inboundId) {
137
137
  };
138
138
  }
139
139
  try {
140
- const file = (0, fs_1.readdirSync)(pathToInboundChangeFiles, { withFileTypes: true }).find((dirent) => dirent.isFile() && dirent.name.includes('changeInbound'));
141
- if (file) {
140
+ const files = (0, fs_1.readdirSync)(pathToInboundChangeFiles, { withFileTypes: true }).filter((dirent) => dirent.isFile() && dirent.name.includes('changeInbound'));
141
+ for (const file of files) {
142
142
  const pathToFile = path_1.default.join(pathToInboundChangeFiles, file.name);
143
143
  const change = JSON.parse((0, fs_1.readFileSync)(pathToFile, 'utf-8'));
144
144
  if (((_a = change.content) === null || _a === void 0 ? void 0 : _a.inboundId) === inboundId) {
145
145
  changeObj = change;
146
146
  filePath = pathToFile;
147
+ break;
147
148
  }
148
149
  }
149
150
  return {
@@ -64,7 +64,29 @@ export declare class AdpPreview {
64
64
  /**
65
65
  * Add additional APIs to the router that are required for adaptation projects only.
66
66
  *
67
- * @param router router that is to be enhanced with the API
67
+ * This method sets up various GET and POST routes for handling fragments, controllers,
68
+ * and code extensions. For POST routes to work correctly, ensure that the router is
69
+ * using the **express.json()** middleware. This middleware is responsible for parsing
70
+ * incoming requests with JSON payloads and is based on body-parser.
71
+ *
72
+ * Usage:
73
+ * ```ts
74
+ * import express from "express";
75
+ *
76
+ * const app = express();
77
+ * const router = express.Router();
78
+ *
79
+ * // Ensure express.json() middleware is applied to the router or app
80
+ * router.use(express.json());
81
+ *
82
+ * const adp = new AdpPreview();
83
+ * adp.addApis(router);
84
+ *
85
+ * app.use('/', router);
86
+ * ```
87
+ *
88
+ * @param {Router} router - The router that is to be enhanced with the API.
89
+ * @returns {void} A promise that resolves when the APIs have been added.
68
90
  */
69
91
  addApis(router: Router): void;
70
92
  }
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AdpPreview = void 0;
16
- const express_1 = __importDefault(require("express"));
17
16
  const adm_zip_1 = __importDefault(require("adm-zip"));
18
17
  const system_access_1 = require("@sap-ux/system-access");
19
18
  const routes_handler_1 = __importDefault(require("./routes-handler"));
@@ -121,13 +120,35 @@ class AdpPreview {
121
120
  /**
122
121
  * Add additional APIs to the router that are required for adaptation projects only.
123
122
  *
124
- * @param router router that is to be enhanced with the API
123
+ * This method sets up various GET and POST routes for handling fragments, controllers,
124
+ * and code extensions. For POST routes to work correctly, ensure that the router is
125
+ * using the **express.json()** middleware. This middleware is responsible for parsing
126
+ * incoming requests with JSON payloads and is based on body-parser.
127
+ *
128
+ * Usage:
129
+ * ```ts
130
+ * import express from "express";
131
+ *
132
+ * const app = express();
133
+ * const router = express.Router();
134
+ *
135
+ * // Ensure express.json() middleware is applied to the router or app
136
+ * router.use(express.json());
137
+ *
138
+ * const adp = new AdpPreview();
139
+ * adp.addApis(router);
140
+ *
141
+ * app.use('/', router);
142
+ * ```
143
+ *
144
+ * @param {Router} router - The router that is to be enhanced with the API.
145
+ * @returns {void} A promise that resolves when the APIs have been added.
125
146
  */
126
147
  addApis(router) {
127
148
  router.get("/adp/api/fragment" /* ApiRoutes.FRAGMENT */, this.routesHandler.handleReadAllFragments);
128
- router.post("/adp/api/fragment" /* ApiRoutes.FRAGMENT */, express_1.default.json(), this.routesHandler.handleWriteFragment);
149
+ router.post("/adp/api/fragment" /* ApiRoutes.FRAGMENT */, this.routesHandler.handleWriteFragment);
129
150
  router.get("/adp/api/controller" /* ApiRoutes.CONTROLLER */, this.routesHandler.handleReadAllControllers);
130
- router.post("/adp/api/controller" /* ApiRoutes.CONTROLLER */, express_1.default.json(), this.routesHandler.handleWriteControllerExt);
151
+ router.post("/adp/api/controller" /* ApiRoutes.CONTROLLER */, this.routesHandler.handleWriteControllerExt);
131
152
  router.get("/adp/api/code_ext/:controllerName" /* ApiRoutes.CODE_EXT */, this.routesHandler.handleGetControllerExtensionData);
132
153
  }
133
154
  }
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.9.1",
12
+ "version": "0.9.3",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -42,16 +42,14 @@
42
42
  "@types/prompts": "2.4.4",
43
43
  "@types/supertest": "2.0.12",
44
44
  "@types/adm-zip": "0.5.5",
45
+ "express": "4.18.2",
45
46
  "dotenv": "16.3.1",
46
47
  "nock": "13.4.0",
47
48
  "rimraf": "5.0.1",
48
49
  "supertest": "6.3.3",
49
- "@sap-ux/project-access": "1.17.6",
50
+ "@sap-ux/project-access": "1.18.0",
50
51
  "@sap-ux/store": "0.5.0"
51
52
  },
52
- "peerDependencies": {
53
- "express": "4"
54
- },
55
53
  "engines": {
56
54
  "node": ">=18.x"
57
55
  },