@xenon-device-management/xenon 1.1.13 → 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.13",
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/lib/src/index.js CHANGED
@@ -89,7 +89,8 @@ process.on('unhandledRejection', (reason, promise) => {
89
89
  logger_1.default.error('❌ [Xenon] Unhandled Rejection at:', promise, 'reason:', reason);
90
90
  });
91
91
  process.on('uncaughtException', (err) => {
92
- const errorDetails = err instanceof Error ? Object.assign({ name: err.name, message: err.message, stack: err.stack }, (lodash_1.default.omit(err, ['name', 'message', 'stack']))) : err;
92
+ const errorDetails = err instanceof Error
93
+ ? Object.assign({ name: err.name, message: err.message, stack: err.stack }, lodash_1.default.omit(err, ['name', 'message', 'stack'])) : err;
93
94
  logger_1.default.error('❌ [Xenon] Uncaught Exception:', JSON.stringify(errorDetails, null, 2));
94
95
  logger_1.default.error('❌ [Xenon] Stack Trace:', err instanceof Error ? err.stack : new Error().stack);
95
96
  // Give logger time to flush before exiting
@@ -287,7 +287,7 @@ let InspectorService = class InspectorService {
287
287
  (node.attributes.name
288
288
  ? `name == "${node.attributes.name}"`
289
289
  : `label == "${node.text || ''}"`) +
290
- `]`;
290
+ ']';
291
291
  suggestions.push({
292
292
  strategy: '-ios class chain',
293
293
  value: classChain,
@@ -210,7 +210,7 @@ describe('Device Utils', () => {
210
210
  }
211
211
  const foundDevice = (yield getFilteredDevice(allocatedDeviceForFirstSession.udid, allocatedDeviceForFirstSession.host))[0];
212
212
  expect(foundDevice.busy).to.be.true;
213
- let filterDeviceWithSameUDID = (yield db_1.XenonDatabase.DeviceModel)
213
+ const filterDeviceWithSameUDID = (yield db_1.XenonDatabase.DeviceModel)
214
214
  .chain()
215
215
  .find({ udid: allocatedDeviceForFirstSession.udid })
216
216
  .data();
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chai_1 = require("chai");
4
4
  const prisma_1 = require("../../src/prisma");
5
- const client_1 = require("@prisma/client");
5
+ const client_1 = require("../../src/generated/client");
6
6
  describe('Prisma Client Unit Tests', () => {
7
7
  it('getPrismaClient should return an instance of PrismaClient', () => {
8
8
  const client = (0, prisma_1.getPrismaClient)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenon-device-management/xenon",
3
- "version": "1.1.13",
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": {