@kohost/api-client 3.0.0-beta.12 → 3.0.0-beta.17
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/dist/cjs/Events.js +44 -0
- package/dist/cjs/Models.js +309 -152
- package/dist/cjs/SocketIoClient.js +68 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/esm/Commands.js.map +1 -1
- package/dist/esm/Events.js +44 -0
- package/dist/esm/Events.js.map +3 -3
- package/dist/esm/Models.js +303 -146
- package/dist/esm/Models.js.map +4 -4
- package/dist/esm/SocketIoClient.js +4533 -0
- package/dist/esm/SocketIoClient.js.map +7 -0
- package/dist/esm/index.js +2 -1
- package/package.json +3 -2
package/dist/cjs/Events.js
CHANGED
|
@@ -65,6 +65,26 @@ var require_Event = __commonJS({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
// src/Events/SystemGatewayUpdatedEvent.js
|
|
69
|
+
var require_SystemGatewayUpdatedEvent = __commonJS({
|
|
70
|
+
"src/Events/SystemGatewayUpdatedEvent.js"(exports2, module2) {
|
|
71
|
+
var Event = require_Event();
|
|
72
|
+
var SystemGatewayUpdatedEvent2 = class extends Event {
|
|
73
|
+
constructor(space) {
|
|
74
|
+
super(space);
|
|
75
|
+
}
|
|
76
|
+
get name() {
|
|
77
|
+
return "SystemGatewayUpdated";
|
|
78
|
+
}
|
|
79
|
+
get routingKey() {
|
|
80
|
+
return `gateway.${this.keyId}.updated`;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
__name(SystemGatewayUpdatedEvent2, "SystemGatewayUpdatedEvent");
|
|
84
|
+
module2.exports = SystemGatewayUpdatedEvent2;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
68
88
|
// src/Events/SystemThermostatUpdatedEvent.js
|
|
69
89
|
var require_SystemThermostatUpdatedEvent = __commonJS({
|
|
70
90
|
"src/Events/SystemThermostatUpdatedEvent.js"(exports2, module2) {
|
|
@@ -305,6 +325,26 @@ var require_SystemSpaceTypeUpdatedEvent = __commonJS({
|
|
|
305
325
|
}
|
|
306
326
|
});
|
|
307
327
|
|
|
328
|
+
// src/Events/SystemProductUpdatedEvent.js
|
|
329
|
+
var require_SystemProductUpdatedEvent = __commonJS({
|
|
330
|
+
"src/Events/SystemProductUpdatedEvent.js"(exports2, module2) {
|
|
331
|
+
var Event = require_Event();
|
|
332
|
+
var SystemProductUpdatedEvent2 = class extends Event {
|
|
333
|
+
constructor(product) {
|
|
334
|
+
super(product);
|
|
335
|
+
}
|
|
336
|
+
get name() {
|
|
337
|
+
return "SystemProductUpdated";
|
|
338
|
+
}
|
|
339
|
+
get routingKey() {
|
|
340
|
+
return `product.${this.keyId}.updated`;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
__name(SystemProductUpdatedEvent2, "SystemProductUpdatedEvent");
|
|
344
|
+
module2.exports = SystemProductUpdatedEvent2;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
308
348
|
// src/Events/SystemReservationUpdatedEvent.js
|
|
309
349
|
var require_SystemReservationUpdatedEvent = __commonJS({
|
|
310
350
|
"src/Events/SystemReservationUpdatedEvent.js"(exports2, module2) {
|
|
@@ -386,6 +426,7 @@ var require_ShortLinkCreatedEvent = __commonJS({
|
|
|
386
426
|
});
|
|
387
427
|
|
|
388
428
|
// src/Events/index.js
|
|
429
|
+
var SystemGatewayUpdatedEvent = require_SystemGatewayUpdatedEvent();
|
|
389
430
|
var SystemThermostatUpdatedEvent = require_SystemThermostatUpdatedEvent();
|
|
390
431
|
var SystemDimmerUpdatedEvent = require_SystemDimmerUpdatedEvent();
|
|
391
432
|
var SystemSwitchUpdatedEvent = require_SystemSwitchUpdatedEvent();
|
|
@@ -398,11 +439,13 @@ var SystemCourtesyUpdatedEvent = require_SystemCourtesyUpdatedEvent();
|
|
|
398
439
|
var SystemUserUpdatedEvent = require_SystemUserUpdatedEvent();
|
|
399
440
|
var SystemSpaceUpdatedEvent = require_SystemSpaceUpdatedEvent();
|
|
400
441
|
var SystemSpaceTypeUpdatedEvent = require_SystemSpaceTypeUpdatedEvent();
|
|
442
|
+
var SystemProductUpdatedEvent = require_SystemProductUpdatedEvent();
|
|
401
443
|
var SystemReservationUpdatedEvent = require_SystemReservationUpdatedEvent();
|
|
402
444
|
var SMSSentEvent = require_SMSSentEvent();
|
|
403
445
|
var EmailSentEvent = require_EmailSentEvent();
|
|
404
446
|
var ShortLinkCreatedEvent = require_ShortLinkCreatedEvent();
|
|
405
447
|
module.exports = {
|
|
448
|
+
SystemGatewayUpdatedEvent,
|
|
406
449
|
SystemThermostatUpdatedEvent,
|
|
407
450
|
SystemDimmerUpdatedEvent,
|
|
408
451
|
SystemSwitchUpdatedEvent,
|
|
@@ -415,6 +458,7 @@ module.exports = {
|
|
|
415
458
|
SystemUserUpdatedEvent,
|
|
416
459
|
SystemSpaceUpdatedEvent,
|
|
417
460
|
SystemSpaceTypeUpdatedEvent,
|
|
461
|
+
SystemProductUpdatedEvent,
|
|
418
462
|
SystemReservationUpdatedEvent,
|
|
419
463
|
SMSSentEvent,
|
|
420
464
|
EmailSentEvent,
|
package/dist/cjs/Models.js
CHANGED
|
@@ -897,7 +897,7 @@ var require_thermostat = __commonJS({
|
|
|
897
897
|
type: "array",
|
|
898
898
|
uniqueItems: true,
|
|
899
899
|
items: {
|
|
900
|
-
enum: ["auto", "low", "medium", "high", "off"]
|
|
900
|
+
enum: ["auto", "low", "medium", "high", "off", "on"]
|
|
901
901
|
}
|
|
902
902
|
},
|
|
903
903
|
setpoints: {
|
|
@@ -915,6 +915,9 @@ var require_thermostat = __commonJS({
|
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
917
|
},
|
|
918
|
+
minAutoDelta: {
|
|
919
|
+
type: "number"
|
|
920
|
+
},
|
|
918
921
|
batteryLevel: {
|
|
919
922
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/batteryLevel"
|
|
920
923
|
},
|
|
@@ -1225,7 +1228,7 @@ var require_user = __commonJS({
|
|
|
1225
1228
|
$id: "https://api.kohost.app/schemas/v3/user.json",
|
|
1226
1229
|
title: "User",
|
|
1227
1230
|
type: "object",
|
|
1228
|
-
required: ["
|
|
1231
|
+
required: ["firstName", "lastName"],
|
|
1229
1232
|
properties: {
|
|
1230
1233
|
id: {
|
|
1231
1234
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -1234,10 +1237,6 @@ var require_user = __commonJS({
|
|
|
1234
1237
|
type: "string",
|
|
1235
1238
|
default: "user"
|
|
1236
1239
|
},
|
|
1237
|
-
active: {
|
|
1238
|
-
type: "boolean",
|
|
1239
|
-
default: true
|
|
1240
|
-
},
|
|
1241
1240
|
firstName: {
|
|
1242
1241
|
type: "string"
|
|
1243
1242
|
},
|
|
@@ -1282,32 +1281,44 @@ var require_user = __commonJS({
|
|
|
1282
1281
|
minLength: 2,
|
|
1283
1282
|
maxLength: 2
|
|
1284
1283
|
},
|
|
1285
|
-
|
|
1284
|
+
permissions: {
|
|
1286
1285
|
type: "array",
|
|
1286
|
+
default: [],
|
|
1287
1287
|
items: {
|
|
1288
|
-
type: "
|
|
1288
|
+
type: "object",
|
|
1289
|
+
required: ["organization", "property", "role"],
|
|
1290
|
+
properties: {
|
|
1291
|
+
organization: {
|
|
1292
|
+
type: "string",
|
|
1293
|
+
description: "The ID of the organization the permission is applies to."
|
|
1294
|
+
},
|
|
1295
|
+
property: {
|
|
1296
|
+
type: "string",
|
|
1297
|
+
description: "The ID of the property the permission is applies to."
|
|
1298
|
+
},
|
|
1299
|
+
role: {
|
|
1300
|
+
type: "string",
|
|
1301
|
+
enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
|
|
1302
|
+
},
|
|
1303
|
+
customPermissions: {
|
|
1304
|
+
type: "array",
|
|
1305
|
+
items: {
|
|
1306
|
+
type: "string"
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1289
1310
|
}
|
|
1290
1311
|
},
|
|
1291
|
-
|
|
1312
|
+
notes: {
|
|
1292
1313
|
type: "array",
|
|
1293
1314
|
items: {
|
|
1294
|
-
|
|
1315
|
+
type: "string"
|
|
1295
1316
|
}
|
|
1296
1317
|
},
|
|
1297
|
-
|
|
1318
|
+
files: {
|
|
1298
1319
|
type: "array",
|
|
1299
1320
|
items: {
|
|
1300
|
-
|
|
1301
|
-
enum: [
|
|
1302
|
-
"Guest",
|
|
1303
|
-
"Staff",
|
|
1304
|
-
"Faculty",
|
|
1305
|
-
"Student",
|
|
1306
|
-
"Visitor",
|
|
1307
|
-
"Manager",
|
|
1308
|
-
"Administrator",
|
|
1309
|
-
"SuperAdmin"
|
|
1310
|
-
]
|
|
1321
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
1311
1322
|
}
|
|
1312
1323
|
},
|
|
1313
1324
|
identifications: {
|
|
@@ -1322,25 +1333,6 @@ var require_user = __commonJS({
|
|
|
1322
1333
|
$ref: "https://api.kohost.app/schemas/v3/payment.json#"
|
|
1323
1334
|
}
|
|
1324
1335
|
},
|
|
1325
|
-
preferences: {
|
|
1326
|
-
type: "object",
|
|
1327
|
-
additionalProperties: false,
|
|
1328
|
-
properties: {
|
|
1329
|
-
notifications: {
|
|
1330
|
-
type: "array",
|
|
1331
|
-
items: {
|
|
1332
|
-
type: "string"
|
|
1333
|
-
},
|
|
1334
|
-
examples: [["roomControl", "marketing"]]
|
|
1335
|
-
},
|
|
1336
|
-
location: {
|
|
1337
|
-
title: "The location Schema",
|
|
1338
|
-
type: "boolean",
|
|
1339
|
-
default: false,
|
|
1340
|
-
examples: [true]
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
},
|
|
1344
1336
|
location: {
|
|
1345
1337
|
type: "object",
|
|
1346
1338
|
required: ["accuracy", "latitude", "longitude", "timestamp"],
|
|
@@ -1360,31 +1352,6 @@ var require_user = __commonJS({
|
|
|
1360
1352
|
}
|
|
1361
1353
|
}
|
|
1362
1354
|
},
|
|
1363
|
-
registeredDevices: {
|
|
1364
|
-
type: "array",
|
|
1365
|
-
items: {
|
|
1366
|
-
type: "object",
|
|
1367
|
-
properties: {
|
|
1368
|
-
userAgent: {
|
|
1369
|
-
type: "string"
|
|
1370
|
-
},
|
|
1371
|
-
fingerPrint: {
|
|
1372
|
-
type: "string"
|
|
1373
|
-
},
|
|
1374
|
-
ip: {
|
|
1375
|
-
type: "string"
|
|
1376
|
-
},
|
|
1377
|
-
registeredAt: {
|
|
1378
|
-
type: "string",
|
|
1379
|
-
format: "date-time"
|
|
1380
|
-
},
|
|
1381
|
-
expiresAt: {
|
|
1382
|
-
type: "string",
|
|
1383
|
-
format: "date-time"
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
},
|
|
1388
1355
|
createdAt: {
|
|
1389
1356
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1390
1357
|
},
|
|
@@ -1392,7 +1359,10 @@ var require_user = __commonJS({
|
|
|
1392
1359
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
1393
1360
|
},
|
|
1394
1361
|
systemData: {
|
|
1395
|
-
|
|
1362
|
+
type: "array",
|
|
1363
|
+
items: {
|
|
1364
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1365
|
+
}
|
|
1396
1366
|
}
|
|
1397
1367
|
}
|
|
1398
1368
|
};
|
|
@@ -1489,10 +1459,161 @@ var require_user2 = __commonJS({
|
|
|
1489
1459
|
return `${this.firstName} ${this.lastName}`;
|
|
1490
1460
|
}
|
|
1491
1461
|
});
|
|
1462
|
+
Object.defineProperty(User2.prototype, "roles", {
|
|
1463
|
+
get: function() {
|
|
1464
|
+
const roles = /* @__PURE__ */ new Set();
|
|
1465
|
+
if (this.permissions) {
|
|
1466
|
+
for (const permission of this.permissions) {
|
|
1467
|
+
roles.add(permission.role);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
return Array.from(roles);
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1492
1473
|
module2.exports = User2;
|
|
1493
1474
|
}
|
|
1494
1475
|
});
|
|
1495
1476
|
|
|
1477
|
+
// src/schemas/systemUser.json
|
|
1478
|
+
var require_systemUser = __commonJS({
|
|
1479
|
+
"src/schemas/systemUser.json"(exports2, module2) {
|
|
1480
|
+
module2.exports = {
|
|
1481
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
1482
|
+
$id: "https://api.kohost.app/schemas/v3/systemUser.json",
|
|
1483
|
+
title: "System User",
|
|
1484
|
+
description: "A system user is a user that originated from an external 3rd party system.",
|
|
1485
|
+
type: "object",
|
|
1486
|
+
required: ["firstName", "lastName"],
|
|
1487
|
+
properties: {
|
|
1488
|
+
id: {
|
|
1489
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
1490
|
+
},
|
|
1491
|
+
type: {
|
|
1492
|
+
type: "string",
|
|
1493
|
+
default: "systemUser"
|
|
1494
|
+
},
|
|
1495
|
+
firstName: {
|
|
1496
|
+
type: "string"
|
|
1497
|
+
},
|
|
1498
|
+
lastName: {
|
|
1499
|
+
type: "string"
|
|
1500
|
+
},
|
|
1501
|
+
phone: {
|
|
1502
|
+
type: ["string", "null"],
|
|
1503
|
+
pattern: "^\\+[0-9]{1,14}$"
|
|
1504
|
+
},
|
|
1505
|
+
email: {
|
|
1506
|
+
type: ["string", "null"],
|
|
1507
|
+
format: "email"
|
|
1508
|
+
},
|
|
1509
|
+
address: {
|
|
1510
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/address"
|
|
1511
|
+
},
|
|
1512
|
+
photo: {
|
|
1513
|
+
type: "string"
|
|
1514
|
+
},
|
|
1515
|
+
jobTitle: {
|
|
1516
|
+
type: "string"
|
|
1517
|
+
},
|
|
1518
|
+
dob: {
|
|
1519
|
+
type: "string"
|
|
1520
|
+
},
|
|
1521
|
+
gender: {
|
|
1522
|
+
type: "string",
|
|
1523
|
+
enum: ["male", "female"]
|
|
1524
|
+
},
|
|
1525
|
+
roles: {
|
|
1526
|
+
type: "array",
|
|
1527
|
+
items: {
|
|
1528
|
+
type: "string",
|
|
1529
|
+
enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
|
|
1530
|
+
}
|
|
1531
|
+
},
|
|
1532
|
+
nationality: {
|
|
1533
|
+
type: "string",
|
|
1534
|
+
minLength: 2,
|
|
1535
|
+
maxLength: 2
|
|
1536
|
+
},
|
|
1537
|
+
notes: {
|
|
1538
|
+
type: "array",
|
|
1539
|
+
items: {
|
|
1540
|
+
type: "string"
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
files: {
|
|
1544
|
+
type: "array",
|
|
1545
|
+
items: {
|
|
1546
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1549
|
+
identifications: {
|
|
1550
|
+
type: "array",
|
|
1551
|
+
items: {
|
|
1552
|
+
$ref: "https://api.kohost.app/schemas/v3/identification.json#"
|
|
1553
|
+
}
|
|
1554
|
+
},
|
|
1555
|
+
payments: {
|
|
1556
|
+
type: "array",
|
|
1557
|
+
items: {
|
|
1558
|
+
$ref: "https://api.kohost.app/schemas/v3/payment.json#"
|
|
1559
|
+
}
|
|
1560
|
+
},
|
|
1561
|
+
createdAt: {
|
|
1562
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1563
|
+
},
|
|
1564
|
+
updatedAt: {
|
|
1565
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
1566
|
+
},
|
|
1567
|
+
systemData: {
|
|
1568
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1574
|
+
|
|
1575
|
+
// src/Models/systemUser.js
|
|
1576
|
+
var require_systemUser2 = __commonJS({
|
|
1577
|
+
"src/Models/systemUser.js"(exports2, module2) {
|
|
1578
|
+
var schemas = require_schema();
|
|
1579
|
+
var schema = require_systemUser();
|
|
1580
|
+
var Kohost = require_kohost();
|
|
1581
|
+
schemas.add(schema);
|
|
1582
|
+
var validator = schemas.compile(schema);
|
|
1583
|
+
var SystemUser2 = class extends Kohost {
|
|
1584
|
+
constructor(data) {
|
|
1585
|
+
super(data);
|
|
1586
|
+
}
|
|
1587
|
+
static validatePhone(phoneNumber) {
|
|
1588
|
+
const regex = /^\+?[1-9]\d{1,14}$/;
|
|
1589
|
+
return regex.test(phoneNumber);
|
|
1590
|
+
}
|
|
1591
|
+
static validateEmail(email) {
|
|
1592
|
+
const regex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
1593
|
+
return regex.test(email);
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
__name(SystemUser2, "SystemUser");
|
|
1597
|
+
Object.defineProperty(SystemUser2.prototype, "schema", {
|
|
1598
|
+
value: schema
|
|
1599
|
+
});
|
|
1600
|
+
Object.defineProperty(SystemUser2.prototype, "validator", {
|
|
1601
|
+
get: function() {
|
|
1602
|
+
return validator;
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
Object.defineProperty(SystemUser2, "validProperties", {
|
|
1606
|
+
value: Object.keys(schema.properties)
|
|
1607
|
+
});
|
|
1608
|
+
Object.defineProperty(SystemUser2.prototype, "fullName", {
|
|
1609
|
+
get: function() {
|
|
1610
|
+
return `${this.firstName} ${this.lastName}`;
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
module2.exports = SystemUser2;
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
|
|
1496
1617
|
// src/schemas/courtesy.json
|
|
1497
1618
|
var require_courtesy = __commonJS({
|
|
1498
1619
|
"src/schemas/courtesy.json"(exports2, module2) {
|
|
@@ -2233,6 +2354,30 @@ var require_room2 = __commonJS({
|
|
|
2233
2354
|
return `${type}s`;
|
|
2234
2355
|
}
|
|
2235
2356
|
}
|
|
2357
|
+
static getDeviceTypeFromPath(path) {
|
|
2358
|
+
const validPaths = [
|
|
2359
|
+
"dimmers",
|
|
2360
|
+
"switches",
|
|
2361
|
+
"thermostats",
|
|
2362
|
+
"locks",
|
|
2363
|
+
"windowCoverings",
|
|
2364
|
+
"courtesy",
|
|
2365
|
+
"cameras",
|
|
2366
|
+
"sources",
|
|
2367
|
+
"motionSensors",
|
|
2368
|
+
"alarms"
|
|
2369
|
+
];
|
|
2370
|
+
if (!validPaths.includes(path))
|
|
2371
|
+
throw new Error("Invalid device path:" + path);
|
|
2372
|
+
switch (path) {
|
|
2373
|
+
case "courtesy":
|
|
2374
|
+
return path;
|
|
2375
|
+
case "switches":
|
|
2376
|
+
return "switch";
|
|
2377
|
+
default:
|
|
2378
|
+
return path.slice(0, -1);
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2236
2381
|
get hasDimmer() {
|
|
2237
2382
|
var _a;
|
|
2238
2383
|
return ((_a = this.dimmers) == null ? void 0 : _a.length) > 0;
|
|
@@ -3133,7 +3278,7 @@ var require_product = __commonJS({
|
|
|
3133
3278
|
$id: "https://api.kohost.app/schemas/v3/product.json",
|
|
3134
3279
|
title: "Product",
|
|
3135
3280
|
type: "object",
|
|
3136
|
-
required: ["name", "
|
|
3281
|
+
required: ["name", "price", "currency"],
|
|
3137
3282
|
properties: {
|
|
3138
3283
|
id: {
|
|
3139
3284
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -3159,6 +3304,10 @@ var require_product = __commonJS({
|
|
|
3159
3304
|
image: {
|
|
3160
3305
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
3161
3306
|
},
|
|
3307
|
+
imageUrl: {
|
|
3308
|
+
format: "uri",
|
|
3309
|
+
pattern: "^https?://"
|
|
3310
|
+
},
|
|
3162
3311
|
systemData: {
|
|
3163
3312
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3164
3313
|
}
|
|
@@ -3402,83 +3551,16 @@ var require_shortLink2 = __commonJS({
|
|
|
3402
3551
|
}
|
|
3403
3552
|
});
|
|
3404
3553
|
|
|
3405
|
-
// src/schemas/
|
|
3406
|
-
var require_customer = __commonJS({
|
|
3407
|
-
"src/schemas/admin/customer.json"(exports2, module2) {
|
|
3408
|
-
module2.exports = {
|
|
3409
|
-
$schema: "http://json-schema.org/draft-07/schema",
|
|
3410
|
-
$id: "https://api.kohost.app/schemas/v3/admin/customer.json",
|
|
3411
|
-
title: "Customer",
|
|
3412
|
-
type: "object",
|
|
3413
|
-
description: "A Kohost customer",
|
|
3414
|
-
required: ["accountNumber", "name"],
|
|
3415
|
-
properties: {
|
|
3416
|
-
id: {
|
|
3417
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
3418
|
-
},
|
|
3419
|
-
accountNumber: {
|
|
3420
|
-
type: "number",
|
|
3421
|
-
minimum: 1e4
|
|
3422
|
-
},
|
|
3423
|
-
name: {
|
|
3424
|
-
type: "string"
|
|
3425
|
-
},
|
|
3426
|
-
properties: {
|
|
3427
|
-
type: "array",
|
|
3428
|
-
items: {
|
|
3429
|
-
type: "string"
|
|
3430
|
-
}
|
|
3431
|
-
},
|
|
3432
|
-
createdAt: {
|
|
3433
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
3434
|
-
},
|
|
3435
|
-
updatedAt: {
|
|
3436
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
3437
|
-
}
|
|
3438
|
-
}
|
|
3439
|
-
};
|
|
3440
|
-
}
|
|
3441
|
-
});
|
|
3442
|
-
|
|
3443
|
-
// src/Models/admin/customer.js
|
|
3444
|
-
var require_customer2 = __commonJS({
|
|
3445
|
-
"src/Models/admin/customer.js"(exports2, module2) {
|
|
3446
|
-
var schemas = require_schema();
|
|
3447
|
-
var schema = require_customer();
|
|
3448
|
-
var Kohost = require_kohost();
|
|
3449
|
-
schemas.add(schema);
|
|
3450
|
-
var validator = schemas.compile(schema);
|
|
3451
|
-
var Customer = class extends Kohost {
|
|
3452
|
-
constructor(data) {
|
|
3453
|
-
super(data);
|
|
3454
|
-
}
|
|
3455
|
-
};
|
|
3456
|
-
__name(Customer, "Customer");
|
|
3457
|
-
Object.defineProperty(Customer.prototype, "schema", {
|
|
3458
|
-
value: schema
|
|
3459
|
-
});
|
|
3460
|
-
Object.defineProperty(Customer.prototype, "validator", {
|
|
3461
|
-
get: function() {
|
|
3462
|
-
return validator;
|
|
3463
|
-
}
|
|
3464
|
-
});
|
|
3465
|
-
Object.defineProperty(Customer, "validProperties", {
|
|
3466
|
-
value: Object.keys(schema.properties)
|
|
3467
|
-
});
|
|
3468
|
-
module2.exports = Customer;
|
|
3469
|
-
}
|
|
3470
|
-
});
|
|
3471
|
-
|
|
3472
|
-
// src/schemas/admin/property.json
|
|
3554
|
+
// src/schemas/property.json
|
|
3473
3555
|
var require_property = __commonJS({
|
|
3474
|
-
"src/schemas/
|
|
3556
|
+
"src/schemas/property.json"(exports2, module2) {
|
|
3475
3557
|
module2.exports = {
|
|
3476
3558
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3477
3559
|
$id: "https://api.kohost.app/schemas/v3/admin/property.json",
|
|
3478
3560
|
title: "Property",
|
|
3479
3561
|
type: "object",
|
|
3480
3562
|
description: "A property is a physical asset or building",
|
|
3481
|
-
required: ["id", "name", "type", "hostname"],
|
|
3563
|
+
required: ["id", "name", "type", "hostname", "organization"],
|
|
3482
3564
|
properties: {
|
|
3483
3565
|
id: {
|
|
3484
3566
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -3499,6 +3581,10 @@ var require_property = __commonJS({
|
|
|
3499
3581
|
hostname: {
|
|
3500
3582
|
type: "string"
|
|
3501
3583
|
},
|
|
3584
|
+
organization: {
|
|
3585
|
+
type: "string",
|
|
3586
|
+
description: "Reference to the organization that owns this property"
|
|
3587
|
+
},
|
|
3502
3588
|
address: {
|
|
3503
3589
|
type: "object",
|
|
3504
3590
|
properties: {
|
|
@@ -3654,32 +3740,103 @@ var require_property = __commonJS({
|
|
|
3654
3740
|
}
|
|
3655
3741
|
});
|
|
3656
3742
|
|
|
3657
|
-
// src/Models/
|
|
3743
|
+
// src/Models/property.js
|
|
3658
3744
|
var require_property2 = __commonJS({
|
|
3659
|
-
"src/Models/
|
|
3745
|
+
"src/Models/property.js"(exports2, module2) {
|
|
3660
3746
|
var schemas = require_schema();
|
|
3661
3747
|
var schema = require_property();
|
|
3662
3748
|
var Kohost = require_kohost();
|
|
3663
3749
|
schemas.add(schema);
|
|
3664
3750
|
var validator = schemas.compile(schema);
|
|
3665
|
-
var
|
|
3751
|
+
var Property2 = class extends Kohost {
|
|
3752
|
+
constructor(data) {
|
|
3753
|
+
super(data);
|
|
3754
|
+
}
|
|
3755
|
+
};
|
|
3756
|
+
__name(Property2, "Property");
|
|
3757
|
+
Object.defineProperty(Property2.prototype, "schema", {
|
|
3758
|
+
value: schema
|
|
3759
|
+
});
|
|
3760
|
+
Object.defineProperty(Property2.prototype, "validator", {
|
|
3761
|
+
get: function() {
|
|
3762
|
+
return validator;
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
Object.defineProperty(Property2, "validProperties", {
|
|
3766
|
+
value: Object.keys(schema.properties)
|
|
3767
|
+
});
|
|
3768
|
+
module2.exports = Property2;
|
|
3769
|
+
}
|
|
3770
|
+
});
|
|
3771
|
+
|
|
3772
|
+
// src/schemas/organization.json
|
|
3773
|
+
var require_organization = __commonJS({
|
|
3774
|
+
"src/schemas/organization.json"(exports2, module2) {
|
|
3775
|
+
module2.exports = {
|
|
3776
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
3777
|
+
$id: "https://api.kohost.app/schemas/v3/admin/organization.json",
|
|
3778
|
+
title: "Organization",
|
|
3779
|
+
type: "object",
|
|
3780
|
+
description: "An organization is a group or entity that subscribes to Kohost software.",
|
|
3781
|
+
required: ["accountNumber", "name"],
|
|
3782
|
+
properties: {
|
|
3783
|
+
id: {
|
|
3784
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
3785
|
+
},
|
|
3786
|
+
accountNumber: {
|
|
3787
|
+
type: "number",
|
|
3788
|
+
minimum: 1e4
|
|
3789
|
+
},
|
|
3790
|
+
name: {
|
|
3791
|
+
type: "string"
|
|
3792
|
+
},
|
|
3793
|
+
properties: {
|
|
3794
|
+
type: "array",
|
|
3795
|
+
items: {
|
|
3796
|
+
type: "string"
|
|
3797
|
+
}
|
|
3798
|
+
},
|
|
3799
|
+
credentials: {
|
|
3800
|
+
type: "object",
|
|
3801
|
+
additionalProperties: true
|
|
3802
|
+
},
|
|
3803
|
+
createdAt: {
|
|
3804
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
3805
|
+
},
|
|
3806
|
+
updatedAt: {
|
|
3807
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
};
|
|
3811
|
+
}
|
|
3812
|
+
});
|
|
3813
|
+
|
|
3814
|
+
// src/Models/organization.js
|
|
3815
|
+
var require_organization2 = __commonJS({
|
|
3816
|
+
"src/Models/organization.js"(exports2, module2) {
|
|
3817
|
+
var schemas = require_schema();
|
|
3818
|
+
var schema = require_organization();
|
|
3819
|
+
var Kohost = require_kohost();
|
|
3820
|
+
schemas.add(schema);
|
|
3821
|
+
var validator = schemas.compile(schema);
|
|
3822
|
+
var Organization2 = class extends Kohost {
|
|
3666
3823
|
constructor(data) {
|
|
3667
3824
|
super(data);
|
|
3668
3825
|
}
|
|
3669
3826
|
};
|
|
3670
|
-
__name(
|
|
3671
|
-
Object.defineProperty(
|
|
3827
|
+
__name(Organization2, "Organization");
|
|
3828
|
+
Object.defineProperty(Organization2.prototype, "schema", {
|
|
3672
3829
|
value: schema
|
|
3673
3830
|
});
|
|
3674
|
-
Object.defineProperty(
|
|
3831
|
+
Object.defineProperty(Organization2.prototype, "validator", {
|
|
3675
3832
|
get: function() {
|
|
3676
3833
|
return validator;
|
|
3677
3834
|
}
|
|
3678
3835
|
});
|
|
3679
|
-
Object.defineProperty(
|
|
3836
|
+
Object.defineProperty(Organization2, "validProperties", {
|
|
3680
3837
|
value: Object.keys(schema.properties)
|
|
3681
3838
|
});
|
|
3682
|
-
module2.exports =
|
|
3839
|
+
module2.exports = Organization2;
|
|
3683
3840
|
}
|
|
3684
3841
|
});
|
|
3685
3842
|
|
|
@@ -3692,6 +3849,7 @@ var Thermostat = require_thermostat2();
|
|
|
3692
3849
|
var WindowCovering = require_windowCovering2();
|
|
3693
3850
|
var Identification = require_identification2();
|
|
3694
3851
|
var User = require_user2();
|
|
3852
|
+
var SystemUser = require_systemUser2();
|
|
3695
3853
|
var Courtesy = require_courtesy2();
|
|
3696
3854
|
var Camera = require_camera2();
|
|
3697
3855
|
var MotionSensor = require_motionSensor2();
|
|
@@ -3708,13 +3866,11 @@ var Product = require_product2();
|
|
|
3708
3866
|
var DiscoveredDevice = require_discoveredDevice2();
|
|
3709
3867
|
var Credential = require_credential2();
|
|
3710
3868
|
var ShortLink = require_shortLink2();
|
|
3711
|
-
var
|
|
3712
|
-
var
|
|
3869
|
+
var Property = require_property2();
|
|
3870
|
+
var Organization = require_organization2();
|
|
3713
3871
|
module.exports = {
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
Property: AdminProperty
|
|
3717
|
-
},
|
|
3872
|
+
Organization,
|
|
3873
|
+
Property,
|
|
3718
3874
|
Gateway,
|
|
3719
3875
|
Switch,
|
|
3720
3876
|
Alarm,
|
|
@@ -3729,6 +3885,7 @@ module.exports = {
|
|
|
3729
3885
|
Identification,
|
|
3730
3886
|
Product,
|
|
3731
3887
|
User,
|
|
3888
|
+
SystemUser,
|
|
3732
3889
|
Room,
|
|
3733
3890
|
Application,
|
|
3734
3891
|
Space,
|