@kohost/api-client 3.0.0-beta.12 → 3.0.0-beta.18
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/Client.js +329 -712
- package/dist/cjs/Commands.js +49 -1
- package/dist/cjs/Events.js +44 -0
- package/dist/cjs/Models.js +326 -153
- package/dist/cjs/SocketIoClient.js +68 -0
- package/dist/cjs/defs.js +8 -31
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/esm/Client.js +329 -712
- package/dist/esm/Client.js.map +3 -3
- package/dist/esm/Commands.js +49 -1
- package/dist/esm/Commands.js.map +3 -3
- package/dist/esm/Events.js +44 -0
- package/dist/esm/Events.js.map +3 -3
- package/dist/esm/Models.js +319 -147
- 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/defs.js +8 -31
- package/dist/esm/defs.js.map +2 -2
- package/dist/esm/index.js +2 -1
- package/dist/useCases/AdminUpdateCustomer.js +1 -1
- package/dist/useCases/{AdminListCustomers.js → CreateOrganization.js} +3 -3
- package/dist/useCases/{AdminLoginUser.js → CreateProperty.js} +2 -2
- package/dist/useCases/{AdminCreateAdminUser.js → DescribeOrganization.js} +4 -4
- package/dist/useCases/{ListIntegrations.js → DescribeProperty.js} +3 -3
- package/dist/useCases/{CreateIntegration.js → ListOrganizations.js} +3 -3
- package/dist/useCases/{AdminListAdminUsers.js → ListProperties.js} +2 -2
- package/dist/useCases/{DeleteIntegration.js → LogoutUser.js} +3 -3
- package/dist/useCases/{CreateIntegrationDeviceMapEntry.js → SendCheckInSMS.js} +2 -2
- package/dist/useCases/{UpdateIntegration.js → UpdateProperty.js} +2 -2
- package/package.json +3 -2
- package/dist/useCases/AdminCreateCustomer.js +0 -32
- package/dist/useCases/AdminCreateProperty.js +0 -32
- package/dist/useCases/AdminDescribeCustomer.js +0 -32
- package/dist/useCases/AdminDescribeProperty.js +0 -32
- package/dist/useCases/AdminListProperties.js +0 -32
- package/dist/useCases/AdminRefreshToken.js +0 -32
- package/dist/useCases/AdminRequestLoginLink.js +0 -32
- package/dist/useCases/AdminUpdateProperty.js +0 -32
- package/dist/useCases/DescribeIntegration.js +0 -32
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
|
};
|
|
@@ -1428,6 +1398,9 @@ var require_payment = __commonJS({
|
|
|
1428
1398
|
"vpay"
|
|
1429
1399
|
]
|
|
1430
1400
|
},
|
|
1401
|
+
storageData: {
|
|
1402
|
+
type: ["string", "null"]
|
|
1403
|
+
},
|
|
1431
1404
|
maskedNumber: {
|
|
1432
1405
|
string: "string"
|
|
1433
1406
|
},
|
|
@@ -1489,10 +1462,161 @@ var require_user2 = __commonJS({
|
|
|
1489
1462
|
return `${this.firstName} ${this.lastName}`;
|
|
1490
1463
|
}
|
|
1491
1464
|
});
|
|
1465
|
+
Object.defineProperty(User2.prototype, "roles", {
|
|
1466
|
+
get: function() {
|
|
1467
|
+
const roles = /* @__PURE__ */ new Set();
|
|
1468
|
+
if (this.permissions) {
|
|
1469
|
+
for (const permission of this.permissions) {
|
|
1470
|
+
roles.add(permission.role);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return Array.from(roles);
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1492
1476
|
module2.exports = User2;
|
|
1493
1477
|
}
|
|
1494
1478
|
});
|
|
1495
1479
|
|
|
1480
|
+
// src/schemas/systemUser.json
|
|
1481
|
+
var require_systemUser = __commonJS({
|
|
1482
|
+
"src/schemas/systemUser.json"(exports2, module2) {
|
|
1483
|
+
module2.exports = {
|
|
1484
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
1485
|
+
$id: "https://api.kohost.app/schemas/v3/systemUser.json",
|
|
1486
|
+
title: "System User",
|
|
1487
|
+
description: "A system user is a user that originated from an external 3rd party system.",
|
|
1488
|
+
type: "object",
|
|
1489
|
+
required: ["firstName", "lastName"],
|
|
1490
|
+
properties: {
|
|
1491
|
+
id: {
|
|
1492
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
1493
|
+
},
|
|
1494
|
+
type: {
|
|
1495
|
+
type: "string",
|
|
1496
|
+
default: "systemUser"
|
|
1497
|
+
},
|
|
1498
|
+
firstName: {
|
|
1499
|
+
type: "string"
|
|
1500
|
+
},
|
|
1501
|
+
lastName: {
|
|
1502
|
+
type: "string"
|
|
1503
|
+
},
|
|
1504
|
+
phone: {
|
|
1505
|
+
type: ["string", "null"],
|
|
1506
|
+
pattern: "^\\+[0-9]{1,14}$"
|
|
1507
|
+
},
|
|
1508
|
+
email: {
|
|
1509
|
+
type: ["string", "null"],
|
|
1510
|
+
format: "email"
|
|
1511
|
+
},
|
|
1512
|
+
address: {
|
|
1513
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/address"
|
|
1514
|
+
},
|
|
1515
|
+
photo: {
|
|
1516
|
+
type: "string"
|
|
1517
|
+
},
|
|
1518
|
+
jobTitle: {
|
|
1519
|
+
type: "string"
|
|
1520
|
+
},
|
|
1521
|
+
dob: {
|
|
1522
|
+
type: "string"
|
|
1523
|
+
},
|
|
1524
|
+
gender: {
|
|
1525
|
+
type: "string",
|
|
1526
|
+
enum: ["male", "female"]
|
|
1527
|
+
},
|
|
1528
|
+
roles: {
|
|
1529
|
+
type: "array",
|
|
1530
|
+
items: {
|
|
1531
|
+
type: "string",
|
|
1532
|
+
enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
|
|
1533
|
+
}
|
|
1534
|
+
},
|
|
1535
|
+
nationality: {
|
|
1536
|
+
type: "string",
|
|
1537
|
+
minLength: 2,
|
|
1538
|
+
maxLength: 2
|
|
1539
|
+
},
|
|
1540
|
+
notes: {
|
|
1541
|
+
type: "array",
|
|
1542
|
+
items: {
|
|
1543
|
+
type: "string"
|
|
1544
|
+
}
|
|
1545
|
+
},
|
|
1546
|
+
files: {
|
|
1547
|
+
type: "array",
|
|
1548
|
+
items: {
|
|
1549
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
identifications: {
|
|
1553
|
+
type: "array",
|
|
1554
|
+
items: {
|
|
1555
|
+
$ref: "https://api.kohost.app/schemas/v3/identification.json#"
|
|
1556
|
+
}
|
|
1557
|
+
},
|
|
1558
|
+
payments: {
|
|
1559
|
+
type: "array",
|
|
1560
|
+
items: {
|
|
1561
|
+
$ref: "https://api.kohost.app/schemas/v3/payment.json#"
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
createdAt: {
|
|
1565
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1566
|
+
},
|
|
1567
|
+
updatedAt: {
|
|
1568
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
1569
|
+
},
|
|
1570
|
+
systemData: {
|
|
1571
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
});
|
|
1577
|
+
|
|
1578
|
+
// src/Models/systemUser.js
|
|
1579
|
+
var require_systemUser2 = __commonJS({
|
|
1580
|
+
"src/Models/systemUser.js"(exports2, module2) {
|
|
1581
|
+
var schemas = require_schema();
|
|
1582
|
+
var schema = require_systemUser();
|
|
1583
|
+
var Kohost = require_kohost();
|
|
1584
|
+
schemas.add(schema);
|
|
1585
|
+
var validator = schemas.compile(schema);
|
|
1586
|
+
var SystemUser2 = class extends Kohost {
|
|
1587
|
+
constructor(data) {
|
|
1588
|
+
super(data);
|
|
1589
|
+
}
|
|
1590
|
+
static validatePhone(phoneNumber) {
|
|
1591
|
+
const regex = /^\+?[1-9]\d{1,14}$/;
|
|
1592
|
+
return regex.test(phoneNumber);
|
|
1593
|
+
}
|
|
1594
|
+
static validateEmail(email) {
|
|
1595
|
+
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,}))$/;
|
|
1596
|
+
return regex.test(email);
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
__name(SystemUser2, "SystemUser");
|
|
1600
|
+
Object.defineProperty(SystemUser2.prototype, "schema", {
|
|
1601
|
+
value: schema
|
|
1602
|
+
});
|
|
1603
|
+
Object.defineProperty(SystemUser2.prototype, "validator", {
|
|
1604
|
+
get: function() {
|
|
1605
|
+
return validator;
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
Object.defineProperty(SystemUser2, "validProperties", {
|
|
1609
|
+
value: Object.keys(schema.properties)
|
|
1610
|
+
});
|
|
1611
|
+
Object.defineProperty(SystemUser2.prototype, "fullName", {
|
|
1612
|
+
get: function() {
|
|
1613
|
+
return `${this.firstName} ${this.lastName}`;
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
module2.exports = SystemUser2;
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
|
|
1496
1620
|
// src/schemas/courtesy.json
|
|
1497
1621
|
var require_courtesy = __commonJS({
|
|
1498
1622
|
"src/schemas/courtesy.json"(exports2, module2) {
|
|
@@ -2233,6 +2357,30 @@ var require_room2 = __commonJS({
|
|
|
2233
2357
|
return `${type}s`;
|
|
2234
2358
|
}
|
|
2235
2359
|
}
|
|
2360
|
+
static getDeviceTypeFromPath(path) {
|
|
2361
|
+
const validPaths = [
|
|
2362
|
+
"dimmers",
|
|
2363
|
+
"switches",
|
|
2364
|
+
"thermostats",
|
|
2365
|
+
"locks",
|
|
2366
|
+
"windowCoverings",
|
|
2367
|
+
"courtesy",
|
|
2368
|
+
"cameras",
|
|
2369
|
+
"sources",
|
|
2370
|
+
"motionSensors",
|
|
2371
|
+
"alarms"
|
|
2372
|
+
];
|
|
2373
|
+
if (!validPaths.includes(path))
|
|
2374
|
+
throw new Error("Invalid device path:" + path);
|
|
2375
|
+
switch (path) {
|
|
2376
|
+
case "courtesy":
|
|
2377
|
+
return path;
|
|
2378
|
+
case "switches":
|
|
2379
|
+
return "switch";
|
|
2380
|
+
default:
|
|
2381
|
+
return path.slice(0, -1);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2236
2384
|
get hasDimmer() {
|
|
2237
2385
|
var _a;
|
|
2238
2386
|
return ((_a = this.dimmers) == null ? void 0 : _a.length) > 0;
|
|
@@ -2245,10 +2393,16 @@ var require_room2 = __commonJS({
|
|
|
2245
2393
|
var _a;
|
|
2246
2394
|
return ((_a = this.windowCoverings) == null ? void 0 : _a.length) > 0;
|
|
2247
2395
|
}
|
|
2396
|
+
get hasShade() {
|
|
2397
|
+
return this.hasWindowCovering;
|
|
2398
|
+
}
|
|
2248
2399
|
get hasThermostat() {
|
|
2249
2400
|
var _a;
|
|
2250
2401
|
return ((_a = this.thermostats) == null ? void 0 : _a.length) > 0;
|
|
2251
2402
|
}
|
|
2403
|
+
get hasClimate() {
|
|
2404
|
+
return this.hasThermostat;
|
|
2405
|
+
}
|
|
2252
2406
|
get hasLock() {
|
|
2253
2407
|
var _a;
|
|
2254
2408
|
return ((_a = this.locks) == null ? void 0 : _a.length) > 0;
|
|
@@ -2269,6 +2423,13 @@ var require_room2 = __commonJS({
|
|
|
2269
2423
|
var _a;
|
|
2270
2424
|
return ((_a = this.sources) == null ? void 0 : _a.length) > 0;
|
|
2271
2425
|
}
|
|
2426
|
+
get hasLight() {
|
|
2427
|
+
var _a;
|
|
2428
|
+
const hasSubTypeLight = (_a = this.switches) == null ? void 0 : _a.some((sw) => {
|
|
2429
|
+
return sw.subType === "light" || sw.subType === "fan";
|
|
2430
|
+
});
|
|
2431
|
+
return this.hasDimmer || hasSubTypeLight;
|
|
2432
|
+
}
|
|
2272
2433
|
get occupied() {
|
|
2273
2434
|
const now = /* @__PURE__ */ new Date();
|
|
2274
2435
|
const lastOccupied = new Date(this.occupiedAt);
|
|
@@ -3133,7 +3294,7 @@ var require_product = __commonJS({
|
|
|
3133
3294
|
$id: "https://api.kohost.app/schemas/v3/product.json",
|
|
3134
3295
|
title: "Product",
|
|
3135
3296
|
type: "object",
|
|
3136
|
-
required: ["name", "
|
|
3297
|
+
required: ["name", "price", "currency"],
|
|
3137
3298
|
properties: {
|
|
3138
3299
|
id: {
|
|
3139
3300
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -3159,6 +3320,10 @@ var require_product = __commonJS({
|
|
|
3159
3320
|
image: {
|
|
3160
3321
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
3161
3322
|
},
|
|
3323
|
+
imageUrl: {
|
|
3324
|
+
format: "uri",
|
|
3325
|
+
pattern: "^https?://"
|
|
3326
|
+
},
|
|
3162
3327
|
systemData: {
|
|
3163
3328
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3164
3329
|
}
|
|
@@ -3205,7 +3370,7 @@ var require_discoveredDevice = __commonJS({
|
|
|
3205
3370
|
title: "Discovered Device",
|
|
3206
3371
|
description: "A device that has been discovered by Kohost, but not yet added to the Kohost system.",
|
|
3207
3372
|
type: "object",
|
|
3208
|
-
required: ["name", "deviceId", "
|
|
3373
|
+
required: ["name", "deviceId", "deviceData"],
|
|
3209
3374
|
properties: {
|
|
3210
3375
|
id: {
|
|
3211
3376
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -3402,83 +3567,16 @@ var require_shortLink2 = __commonJS({
|
|
|
3402
3567
|
}
|
|
3403
3568
|
});
|
|
3404
3569
|
|
|
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
|
|
3570
|
+
// src/schemas/property.json
|
|
3473
3571
|
var require_property = __commonJS({
|
|
3474
|
-
"src/schemas/
|
|
3572
|
+
"src/schemas/property.json"(exports2, module2) {
|
|
3475
3573
|
module2.exports = {
|
|
3476
3574
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3477
3575
|
$id: "https://api.kohost.app/schemas/v3/admin/property.json",
|
|
3478
3576
|
title: "Property",
|
|
3479
3577
|
type: "object",
|
|
3480
3578
|
description: "A property is a physical asset or building",
|
|
3481
|
-
required: ["id", "name", "type", "hostname"],
|
|
3579
|
+
required: ["id", "name", "type", "hostname", "organization"],
|
|
3482
3580
|
properties: {
|
|
3483
3581
|
id: {
|
|
3484
3582
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -3499,6 +3597,10 @@ var require_property = __commonJS({
|
|
|
3499
3597
|
hostname: {
|
|
3500
3598
|
type: "string"
|
|
3501
3599
|
},
|
|
3600
|
+
organization: {
|
|
3601
|
+
type: "string",
|
|
3602
|
+
description: "Reference to the organization that owns this property"
|
|
3603
|
+
},
|
|
3502
3604
|
address: {
|
|
3503
3605
|
type: "object",
|
|
3504
3606
|
properties: {
|
|
@@ -3654,32 +3756,103 @@ var require_property = __commonJS({
|
|
|
3654
3756
|
}
|
|
3655
3757
|
});
|
|
3656
3758
|
|
|
3657
|
-
// src/Models/
|
|
3759
|
+
// src/Models/property.js
|
|
3658
3760
|
var require_property2 = __commonJS({
|
|
3659
|
-
"src/Models/
|
|
3761
|
+
"src/Models/property.js"(exports2, module2) {
|
|
3660
3762
|
var schemas = require_schema();
|
|
3661
3763
|
var schema = require_property();
|
|
3662
3764
|
var Kohost = require_kohost();
|
|
3663
3765
|
schemas.add(schema);
|
|
3664
3766
|
var validator = schemas.compile(schema);
|
|
3665
|
-
var
|
|
3767
|
+
var Property2 = class extends Kohost {
|
|
3768
|
+
constructor(data) {
|
|
3769
|
+
super(data);
|
|
3770
|
+
}
|
|
3771
|
+
};
|
|
3772
|
+
__name(Property2, "Property");
|
|
3773
|
+
Object.defineProperty(Property2.prototype, "schema", {
|
|
3774
|
+
value: schema
|
|
3775
|
+
});
|
|
3776
|
+
Object.defineProperty(Property2.prototype, "validator", {
|
|
3777
|
+
get: function() {
|
|
3778
|
+
return validator;
|
|
3779
|
+
}
|
|
3780
|
+
});
|
|
3781
|
+
Object.defineProperty(Property2, "validProperties", {
|
|
3782
|
+
value: Object.keys(schema.properties)
|
|
3783
|
+
});
|
|
3784
|
+
module2.exports = Property2;
|
|
3785
|
+
}
|
|
3786
|
+
});
|
|
3787
|
+
|
|
3788
|
+
// src/schemas/organization.json
|
|
3789
|
+
var require_organization = __commonJS({
|
|
3790
|
+
"src/schemas/organization.json"(exports2, module2) {
|
|
3791
|
+
module2.exports = {
|
|
3792
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
3793
|
+
$id: "https://api.kohost.app/schemas/v3/admin/organization.json",
|
|
3794
|
+
title: "Organization",
|
|
3795
|
+
type: "object",
|
|
3796
|
+
description: "An organization is a group or entity that subscribes to Kohost software.",
|
|
3797
|
+
required: ["accountNumber", "name"],
|
|
3798
|
+
properties: {
|
|
3799
|
+
id: {
|
|
3800
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
3801
|
+
},
|
|
3802
|
+
accountNumber: {
|
|
3803
|
+
type: "number",
|
|
3804
|
+
minimum: 1e4
|
|
3805
|
+
},
|
|
3806
|
+
name: {
|
|
3807
|
+
type: "string"
|
|
3808
|
+
},
|
|
3809
|
+
properties: {
|
|
3810
|
+
type: "array",
|
|
3811
|
+
items: {
|
|
3812
|
+
type: "string"
|
|
3813
|
+
}
|
|
3814
|
+
},
|
|
3815
|
+
credentials: {
|
|
3816
|
+
type: "object",
|
|
3817
|
+
additionalProperties: true
|
|
3818
|
+
},
|
|
3819
|
+
createdAt: {
|
|
3820
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
3821
|
+
},
|
|
3822
|
+
updatedAt: {
|
|
3823
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
};
|
|
3827
|
+
}
|
|
3828
|
+
});
|
|
3829
|
+
|
|
3830
|
+
// src/Models/organization.js
|
|
3831
|
+
var require_organization2 = __commonJS({
|
|
3832
|
+
"src/Models/organization.js"(exports2, module2) {
|
|
3833
|
+
var schemas = require_schema();
|
|
3834
|
+
var schema = require_organization();
|
|
3835
|
+
var Kohost = require_kohost();
|
|
3836
|
+
schemas.add(schema);
|
|
3837
|
+
var validator = schemas.compile(schema);
|
|
3838
|
+
var Organization2 = class extends Kohost {
|
|
3666
3839
|
constructor(data) {
|
|
3667
3840
|
super(data);
|
|
3668
3841
|
}
|
|
3669
3842
|
};
|
|
3670
|
-
__name(
|
|
3671
|
-
Object.defineProperty(
|
|
3843
|
+
__name(Organization2, "Organization");
|
|
3844
|
+
Object.defineProperty(Organization2.prototype, "schema", {
|
|
3672
3845
|
value: schema
|
|
3673
3846
|
});
|
|
3674
|
-
Object.defineProperty(
|
|
3847
|
+
Object.defineProperty(Organization2.prototype, "validator", {
|
|
3675
3848
|
get: function() {
|
|
3676
3849
|
return validator;
|
|
3677
3850
|
}
|
|
3678
3851
|
});
|
|
3679
|
-
Object.defineProperty(
|
|
3852
|
+
Object.defineProperty(Organization2, "validProperties", {
|
|
3680
3853
|
value: Object.keys(schema.properties)
|
|
3681
3854
|
});
|
|
3682
|
-
module2.exports =
|
|
3855
|
+
module2.exports = Organization2;
|
|
3683
3856
|
}
|
|
3684
3857
|
});
|
|
3685
3858
|
|
|
@@ -3692,6 +3865,7 @@ var Thermostat = require_thermostat2();
|
|
|
3692
3865
|
var WindowCovering = require_windowCovering2();
|
|
3693
3866
|
var Identification = require_identification2();
|
|
3694
3867
|
var User = require_user2();
|
|
3868
|
+
var SystemUser = require_systemUser2();
|
|
3695
3869
|
var Courtesy = require_courtesy2();
|
|
3696
3870
|
var Camera = require_camera2();
|
|
3697
3871
|
var MotionSensor = require_motionSensor2();
|
|
@@ -3708,13 +3882,11 @@ var Product = require_product2();
|
|
|
3708
3882
|
var DiscoveredDevice = require_discoveredDevice2();
|
|
3709
3883
|
var Credential = require_credential2();
|
|
3710
3884
|
var ShortLink = require_shortLink2();
|
|
3711
|
-
var
|
|
3712
|
-
var
|
|
3885
|
+
var Property = require_property2();
|
|
3886
|
+
var Organization = require_organization2();
|
|
3713
3887
|
module.exports = {
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
Property: AdminProperty
|
|
3717
|
-
},
|
|
3888
|
+
Organization,
|
|
3889
|
+
Property,
|
|
3718
3890
|
Gateway,
|
|
3719
3891
|
Switch,
|
|
3720
3892
|
Alarm,
|
|
@@ -3729,6 +3901,7 @@ module.exports = {
|
|
|
3729
3901
|
Identification,
|
|
3730
3902
|
Product,
|
|
3731
3903
|
User,
|
|
3904
|
+
SystemUser,
|
|
3732
3905
|
Room,
|
|
3733
3906
|
Application,
|
|
3734
3907
|
Space,
|