@xenon-device-management/xenon 1.1.14 → 1.1.15

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.
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenon-device-management/xenon",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Xenon - Intelligent Mobile Infrastructure. A self-healing device orchestration platform for Appium.",
5
5
  "main": "./lib/src/index.js",
6
6
  "exports": {
@@ -49,6 +49,7 @@ exports.createRouter = createRouter;
49
49
  const express_1 = __importDefault(require("express"));
50
50
  const path_1 = __importDefault(require("path"));
51
51
  const fs_1 = __importDefault(require("fs"));
52
+ const package_json_1 = __importDefault(require("../../package.json"));
52
53
  const pluginArgs_1 = require("../data-service/pluginArgs");
53
54
  const cors_1 = __importDefault(require("cors"));
54
55
  const async_lock_1 = __importDefault(require("async-lock"));
@@ -131,7 +132,18 @@ apiRouter.get('/metrics', (req, res) => __awaiter(void 0, void 0, void 0, functi
131
132
  res.set('Content-Type', 'text/plain');
132
133
  res.send(metrics);
133
134
  }));
134
- const publicPath = [path_1.default.join(__dirname, '..', 'public'), path_1.default.join(__dirname, '..', '..', 'public')].find((p) => fs_1.default.existsSync(p)) || path_1.default.join(__dirname, '..', '..', 'public');
135
+ const publicPathCandidates = [
136
+ path_1.default.resolve(__dirname, '..', 'public'),
137
+ path_1.default.resolve(__dirname, '..', '..', 'public'),
138
+ path_1.default.resolve(__dirname, '..', '..', '..', 'public'),
139
+ ];
140
+ const publicPath = publicPathCandidates.find((p) => {
141
+ const exists = fs_1.default.existsSync(p) && fs_1.default.existsSync(path_1.default.join(p, 'index.html'));
142
+ if (exists)
143
+ logger_1.default.debug(`[Xenon] Found public assets at: ${p}`);
144
+ return exists;
145
+ }) || publicPathCandidates[1];
146
+ logger_1.default.info(`[Xenon] Public assets path resolved to: ${publicPath}`);
135
147
  staticFilesRouter.use(express_1.default.static(publicPath));
136
148
  router.use('/api', apiRouter);
137
149
  router.use('/assets', express_1.default.static(config_1.config.sessionAssetsPath));
@@ -144,6 +156,8 @@ function createRouter(pluginArgs) {
144
156
  webhook_1.default.register(apiRouter);
145
157
  config_2.default.register(apiRouter, pluginArgs);
146
158
  apiRouter.use('/reservation', reservation_1.default);
159
+ // Principal Health: Add ping endpoint
160
+ apiRouter.get('/ping', (req, res) => res.json({ pong: true, version: package_json_1.default.version }));
147
161
  // Setup Swagger API documentation at /xenon/api-docs
148
162
  try {
149
163
  (0, swagger_1.setupSwagger)(router, '/xenon');
@@ -161,7 +175,14 @@ function createRouter(pluginArgs) {
161
175
  // Fallback route for client-side routing - serve index.html for all non-API routes
162
176
  // MUST be registered after Swagger to avoid interception
163
177
  router.get(/^(?!\/api).*/, (req, res) => {
164
- res.sendFile(path_1.default.join(publicPath, 'index.html'));
178
+ const indexPath = path_1.default.join(publicPath, 'index.html');
179
+ if (fs_1.default.existsSync(indexPath)) {
180
+ res.sendFile(indexPath);
181
+ }
182
+ else {
183
+ logger_1.default.error(`[Xenon] UI Fallback failed: index.html not found at ${indexPath}`);
184
+ res.status(404).send('Xenon UI assets not found. Check installation.');
185
+ }
165
186
  });
166
187
  return router;
167
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenon-device-management/xenon",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Xenon - Intelligent Mobile Infrastructure. A self-healing device orchestration platform for Appium.",
5
5
  "main": "./lib/src/index.js",
6
6
  "exports": {