@xenon-device-management/xenon 1.1.4 → 1.1.6
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.
|
|
3
|
+
"version": "1.1.6",
|
|
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": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"./package.json": "./package.json"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
+
"postinstall": "npx prisma generate",
|
|
12
13
|
"build": "npx prisma generate && tsc -b && npm run build:copy",
|
|
13
14
|
"build:all": "npm run build:xenon && npm run build",
|
|
14
15
|
"build:copy": "rm -rf lib/public && mkdir -p lib && cp -R src/public lib/ && cp schema.json lib/",
|
|
@@ -9,19 +9,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PrismaService = void 0;
|
|
13
|
-
const
|
|
14
|
-
const config_1 = require("../config");
|
|
12
|
+
exports.getPrismaService = exports.PrismaService = void 0;
|
|
13
|
+
const prisma_1 = require("../prisma");
|
|
15
14
|
const typedi_1 = require("typedi");
|
|
16
|
-
let PrismaService = class PrismaService
|
|
17
|
-
constructor() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
db: {
|
|
21
|
-
url: config_1.config.databaseUrl,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
});
|
|
15
|
+
let PrismaService = class PrismaService {
|
|
16
|
+
constructor() { }
|
|
17
|
+
get client() {
|
|
18
|
+
return prisma_1.prisma;
|
|
25
19
|
}
|
|
26
20
|
};
|
|
27
21
|
exports.PrismaService = PrismaService;
|
|
@@ -29,3 +23,6 @@ exports.PrismaService = PrismaService = __decorate([
|
|
|
29
23
|
(0, typedi_1.Service)(),
|
|
30
24
|
__metadata("design:paramtypes", [])
|
|
31
25
|
], PrismaService);
|
|
26
|
+
// For compatibility with parts of the code that might expect PrismaService to be the client
|
|
27
|
+
const getPrismaService = () => prisma_1.prisma;
|
|
28
|
+
exports.getPrismaService = getPrismaService;
|
|
@@ -52,7 +52,7 @@ const semver = __importStar(require("semver"));
|
|
|
52
52
|
const logger_1 = __importDefault(require("../logger"));
|
|
53
53
|
class PrismaDeviceStore {
|
|
54
54
|
constructor() {
|
|
55
|
-
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService);
|
|
55
|
+
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService).client;
|
|
56
56
|
}
|
|
57
57
|
toIDevice(device) {
|
|
58
58
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -276,7 +276,7 @@ class PrismaDeviceStore {
|
|
|
276
276
|
exports.PrismaDeviceStore = PrismaDeviceStore;
|
|
277
277
|
class PrismaPendingSessionStore {
|
|
278
278
|
constructor() {
|
|
279
|
-
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService);
|
|
279
|
+
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService).client;
|
|
280
280
|
}
|
|
281
281
|
addPendingSession(capability) {
|
|
282
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -328,7 +328,7 @@ class PrismaPendingSessionStore {
|
|
|
328
328
|
exports.PrismaPendingSessionStore = PrismaPendingSessionStore;
|
|
329
329
|
class PrismaCLIArgsStore {
|
|
330
330
|
constructor() {
|
|
331
|
-
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService);
|
|
331
|
+
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService).client;
|
|
332
332
|
}
|
|
333
333
|
addCLIArgs(args) {
|
|
334
334
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -349,7 +349,7 @@ class PrismaCLIArgsStore {
|
|
|
349
349
|
exports.PrismaCLIArgsStore = PrismaCLIArgsStore;
|
|
350
350
|
class PrismaHealEtalonStore {
|
|
351
351
|
constructor() {
|
|
352
|
-
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService);
|
|
352
|
+
this.prisma = typedi_1.Container.get(prisma_service_1.PrismaService).client;
|
|
353
353
|
}
|
|
354
354
|
saveSignature(etalon) {
|
|
355
355
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -27,8 +27,8 @@ const prisma_service_1 = require("./prisma-service");
|
|
|
27
27
|
const logger_1 = __importDefault(require("../logger"));
|
|
28
28
|
const typedi_1 = require("typedi");
|
|
29
29
|
let QueueService = class QueueService {
|
|
30
|
-
constructor(
|
|
31
|
-
this.
|
|
30
|
+
constructor(prismaService) {
|
|
31
|
+
this.prismaService = prismaService;
|
|
32
32
|
this.deviceStore = device_store_1.DeviceStoreFactory.getStore();
|
|
33
33
|
this.pendingStore = device_store_1.DeviceStoreFactory.getPendingSessionStore();
|
|
34
34
|
}
|
|
@@ -39,7 +39,7 @@ let QueueService = class QueueService {
|
|
|
39
39
|
getAverageSessionDuration(platform) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
try {
|
|
42
|
-
const recentSessions = yield this.
|
|
42
|
+
const recentSessions = yield this.prismaService.client.session.findMany({
|
|
43
43
|
where: {
|
|
44
44
|
device_platform: platform.toLowerCase(),
|
|
45
45
|
endTime: { not: null },
|
|
@@ -32,12 +32,12 @@ let NotificationService = class NotificationService {
|
|
|
32
32
|
}
|
|
33
33
|
getConfigs() {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
return this.prisma.webhookConfig.findMany();
|
|
35
|
+
return this.prisma.client.webhookConfig.findMany();
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
saveConfig(url_1, events_1) {
|
|
39
39
|
return __awaiter(this, arguments, void 0, function* (url, events, type = 'slack', payloadTemplate) {
|
|
40
|
-
return this.prisma.webhookConfig.create({
|
|
40
|
+
return this.prisma.client.webhookConfig.create({
|
|
41
41
|
data: {
|
|
42
42
|
url,
|
|
43
43
|
events: JSON.stringify(events),
|
|
@@ -50,7 +50,7 @@ let NotificationService = class NotificationService {
|
|
|
50
50
|
}
|
|
51
51
|
deleteConfig(id) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
yield this.prisma.webhookConfig.delete({ where: { id } });
|
|
53
|
+
yield this.prisma.client.webhookConfig.delete({ where: { id } });
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
dispatchEvent(eventType, payload) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenon-device-management/xenon",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
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": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"./package.json": "./package.json"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
+
"postinstall": "npx prisma generate",
|
|
12
13
|
"build": "npx prisma generate && tsc -b && npm run build:copy",
|
|
13
14
|
"build:all": "npm run build:xenon && npm run build",
|
|
14
15
|
"build:copy": "rm -rf lib/public && mkdir -p lib && cp -R src/public lib/ && cp schema.json lib/",
|