@kohost/api-client 3.0.0-beta.11 → 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/README.md +71 -0
- package/dist/cjs/Client.js +288 -1
- package/dist/cjs/Commands.js +67 -3
- package/dist/cjs/Events.js +104 -25
- package/dist/cjs/Models.js +443 -156
- package/dist/cjs/SocketIoClient.js +68 -0
- package/dist/cjs/defs.js +7 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/esm/Client.js +337 -20
- package/dist/esm/Client.js.map +4 -4
- package/dist/esm/Commands.js +67 -3
- package/dist/esm/Commands.js.map +3 -3
- package/dist/esm/Events.js +104 -25
- package/dist/esm/Events.js.map +3 -3
- package/dist/esm/Models.js +437 -150
- 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 +56 -19
- package/dist/esm/defs.js.map +4 -4
- package/dist/esm/index.js +2 -1
- package/dist/useCases/AssignSpaceToReservation.js +32 -0
- package/dist/useCases/BatchNotifyCheckIn.js +32 -0
- package/dist/useCases/CreateSpaceType.js +32 -0
- package/dist/useCases/DeleteSpaceType.js +32 -0
- package/dist/useCases/DescribeSpaceType.js +32 -0
- package/dist/useCases/ListSpaceTypes.js +32 -0
- package/dist/useCases/SetDimmer.js +32 -0
- package/dist/useCases/UpdateSpace.js +1 -1
- package/package.json +10 -3
package/dist/cjs/Models.js
CHANGED
|
@@ -209,6 +209,9 @@ var require_switch = __commonJS({
|
|
|
209
209
|
id: {
|
|
210
210
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
211
211
|
},
|
|
212
|
+
name: {
|
|
213
|
+
type: "string"
|
|
214
|
+
},
|
|
212
215
|
type: {
|
|
213
216
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
214
217
|
},
|
|
@@ -668,6 +671,9 @@ var require_dimmer = __commonJS({
|
|
|
668
671
|
id: {
|
|
669
672
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
670
673
|
},
|
|
674
|
+
name: {
|
|
675
|
+
type: "string"
|
|
676
|
+
},
|
|
671
677
|
type: {
|
|
672
678
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
673
679
|
},
|
|
@@ -891,7 +897,7 @@ var require_thermostat = __commonJS({
|
|
|
891
897
|
type: "array",
|
|
892
898
|
uniqueItems: true,
|
|
893
899
|
items: {
|
|
894
|
-
enum: ["auto", "low", "medium", "high", "off"]
|
|
900
|
+
enum: ["auto", "low", "medium", "high", "off", "on"]
|
|
895
901
|
}
|
|
896
902
|
},
|
|
897
903
|
setpoints: {
|
|
@@ -909,6 +915,9 @@ var require_thermostat = __commonJS({
|
|
|
909
915
|
}
|
|
910
916
|
}
|
|
911
917
|
},
|
|
918
|
+
minAutoDelta: {
|
|
919
|
+
type: "number"
|
|
920
|
+
},
|
|
912
921
|
batteryLevel: {
|
|
913
922
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/batteryLevel"
|
|
914
923
|
},
|
|
@@ -1048,6 +1057,9 @@ var require_windowCovering = __commonJS({
|
|
|
1048
1057
|
id: {
|
|
1049
1058
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
1050
1059
|
},
|
|
1060
|
+
name: {
|
|
1061
|
+
type: "string"
|
|
1062
|
+
},
|
|
1051
1063
|
type: {
|
|
1052
1064
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
1053
1065
|
},
|
|
@@ -1216,7 +1228,7 @@ var require_user = __commonJS({
|
|
|
1216
1228
|
$id: "https://api.kohost.app/schemas/v3/user.json",
|
|
1217
1229
|
title: "User",
|
|
1218
1230
|
type: "object",
|
|
1219
|
-
required: ["
|
|
1231
|
+
required: ["firstName", "lastName"],
|
|
1220
1232
|
properties: {
|
|
1221
1233
|
id: {
|
|
1222
1234
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -1225,10 +1237,6 @@ var require_user = __commonJS({
|
|
|
1225
1237
|
type: "string",
|
|
1226
1238
|
default: "user"
|
|
1227
1239
|
},
|
|
1228
|
-
active: {
|
|
1229
|
-
type: "boolean",
|
|
1230
|
-
default: true
|
|
1231
|
-
},
|
|
1232
1240
|
firstName: {
|
|
1233
1241
|
type: "string"
|
|
1234
1242
|
},
|
|
@@ -1273,32 +1281,44 @@ var require_user = __commonJS({
|
|
|
1273
1281
|
minLength: 2,
|
|
1274
1282
|
maxLength: 2
|
|
1275
1283
|
},
|
|
1276
|
-
|
|
1284
|
+
permissions: {
|
|
1277
1285
|
type: "array",
|
|
1286
|
+
default: [],
|
|
1278
1287
|
items: {
|
|
1279
|
-
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
|
+
}
|
|
1280
1310
|
}
|
|
1281
1311
|
},
|
|
1282
|
-
|
|
1312
|
+
notes: {
|
|
1283
1313
|
type: "array",
|
|
1284
1314
|
items: {
|
|
1285
|
-
|
|
1315
|
+
type: "string"
|
|
1286
1316
|
}
|
|
1287
1317
|
},
|
|
1288
|
-
|
|
1318
|
+
files: {
|
|
1289
1319
|
type: "array",
|
|
1290
1320
|
items: {
|
|
1291
|
-
|
|
1292
|
-
enum: [
|
|
1293
|
-
"Guest",
|
|
1294
|
-
"Staff",
|
|
1295
|
-
"Faculty",
|
|
1296
|
-
"Student",
|
|
1297
|
-
"Visitor",
|
|
1298
|
-
"Manager",
|
|
1299
|
-
"Administrator",
|
|
1300
|
-
"SuperAdmin"
|
|
1301
|
-
]
|
|
1321
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
1302
1322
|
}
|
|
1303
1323
|
},
|
|
1304
1324
|
identifications: {
|
|
@@ -1313,25 +1333,6 @@ var require_user = __commonJS({
|
|
|
1313
1333
|
$ref: "https://api.kohost.app/schemas/v3/payment.json#"
|
|
1314
1334
|
}
|
|
1315
1335
|
},
|
|
1316
|
-
preferences: {
|
|
1317
|
-
type: "object",
|
|
1318
|
-
additionalProperties: false,
|
|
1319
|
-
properties: {
|
|
1320
|
-
notifications: {
|
|
1321
|
-
type: "array",
|
|
1322
|
-
items: {
|
|
1323
|
-
type: "string"
|
|
1324
|
-
},
|
|
1325
|
-
examples: [["roomControl", "marketing"]]
|
|
1326
|
-
},
|
|
1327
|
-
location: {
|
|
1328
|
-
title: "The location Schema",
|
|
1329
|
-
type: "boolean",
|
|
1330
|
-
default: false,
|
|
1331
|
-
examples: [true]
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
},
|
|
1335
1336
|
location: {
|
|
1336
1337
|
type: "object",
|
|
1337
1338
|
required: ["accuracy", "latitude", "longitude", "timestamp"],
|
|
@@ -1351,31 +1352,6 @@ var require_user = __commonJS({
|
|
|
1351
1352
|
}
|
|
1352
1353
|
}
|
|
1353
1354
|
},
|
|
1354
|
-
registeredDevices: {
|
|
1355
|
-
type: "array",
|
|
1356
|
-
items: {
|
|
1357
|
-
type: "object",
|
|
1358
|
-
properties: {
|
|
1359
|
-
userAgent: {
|
|
1360
|
-
type: "string"
|
|
1361
|
-
},
|
|
1362
|
-
fingerPrint: {
|
|
1363
|
-
type: "string"
|
|
1364
|
-
},
|
|
1365
|
-
ip: {
|
|
1366
|
-
type: "string"
|
|
1367
|
-
},
|
|
1368
|
-
registeredAt: {
|
|
1369
|
-
type: "string",
|
|
1370
|
-
format: "date-time"
|
|
1371
|
-
},
|
|
1372
|
-
expiresAt: {
|
|
1373
|
-
type: "string",
|
|
1374
|
-
format: "date-time"
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
},
|
|
1379
1355
|
createdAt: {
|
|
1380
1356
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1381
1357
|
},
|
|
@@ -1383,7 +1359,10 @@ var require_user = __commonJS({
|
|
|
1383
1359
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
1384
1360
|
},
|
|
1385
1361
|
systemData: {
|
|
1386
|
-
|
|
1362
|
+
type: "array",
|
|
1363
|
+
items: {
|
|
1364
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1365
|
+
}
|
|
1387
1366
|
}
|
|
1388
1367
|
}
|
|
1389
1368
|
};
|
|
@@ -1480,10 +1459,161 @@ var require_user2 = __commonJS({
|
|
|
1480
1459
|
return `${this.firstName} ${this.lastName}`;
|
|
1481
1460
|
}
|
|
1482
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
|
+
});
|
|
1483
1473
|
module2.exports = User2;
|
|
1484
1474
|
}
|
|
1485
1475
|
});
|
|
1486
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
|
+
|
|
1487
1617
|
// src/schemas/courtesy.json
|
|
1488
1618
|
var require_courtesy = __commonJS({
|
|
1489
1619
|
"src/schemas/courtesy.json"(exports2, module2) {
|
|
@@ -1497,6 +1627,9 @@ var require_courtesy = __commonJS({
|
|
|
1497
1627
|
id: {
|
|
1498
1628
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
1499
1629
|
},
|
|
1630
|
+
name: {
|
|
1631
|
+
type: "string"
|
|
1632
|
+
},
|
|
1500
1633
|
type: {
|
|
1501
1634
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
1502
1635
|
},
|
|
@@ -2221,6 +2354,30 @@ var require_room2 = __commonJS({
|
|
|
2221
2354
|
return `${type}s`;
|
|
2222
2355
|
}
|
|
2223
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
|
+
}
|
|
2224
2381
|
get hasDimmer() {
|
|
2225
2382
|
var _a;
|
|
2226
2383
|
return ((_a = this.dimmers) == null ? void 0 : _a.length) > 0;
|
|
@@ -2377,14 +2534,40 @@ var require_reservation = __commonJS({
|
|
|
2377
2534
|
type: "string"
|
|
2378
2535
|
}
|
|
2379
2536
|
},
|
|
2537
|
+
spaceType: {
|
|
2538
|
+
type: "string"
|
|
2539
|
+
},
|
|
2380
2540
|
space: {
|
|
2381
2541
|
type: "string"
|
|
2382
2542
|
},
|
|
2383
2543
|
status: {
|
|
2384
2544
|
type: "string",
|
|
2385
|
-
enum: [
|
|
2545
|
+
enum: [
|
|
2546
|
+
"reserved",
|
|
2547
|
+
"checkedIn",
|
|
2548
|
+
"checkedOut",
|
|
2549
|
+
"cancelled",
|
|
2550
|
+
"noShow",
|
|
2551
|
+
"enquired",
|
|
2552
|
+
"requested",
|
|
2553
|
+
"optional"
|
|
2554
|
+
],
|
|
2386
2555
|
description: " reserved - confirmed by both parties, before check-in\n checkedIn - checked in\n checkedOut - checked out\n cancelled - Cancelled\n noShow - No show\n enquired - Confirmed neither by the customer nor enterprise\n requested - Confirmed by the customer but not the enterprise (waitlist)\n optional - Confirmed by the enterprise but not the customer (holding)"
|
|
2387
2556
|
},
|
|
2557
|
+
mobileCheckInStatus: {
|
|
2558
|
+
type: "string",
|
|
2559
|
+
enum: [
|
|
2560
|
+
"ready",
|
|
2561
|
+
"blocked",
|
|
2562
|
+
"preArrivalStepsRequired",
|
|
2563
|
+
"spaceNotAssigned",
|
|
2564
|
+
"spaceNotReady",
|
|
2565
|
+
"checkInTimeNotStarted"
|
|
2566
|
+
]
|
|
2567
|
+
},
|
|
2568
|
+
mobileCheckInStatusMessage: {
|
|
2569
|
+
type: "string"
|
|
2570
|
+
},
|
|
2388
2571
|
confirmationNumber: {
|
|
2389
2572
|
type: "string"
|
|
2390
2573
|
},
|
|
@@ -2405,6 +2588,24 @@ var require_reservation = __commonJS({
|
|
|
2405
2588
|
type: "number",
|
|
2406
2589
|
default: 0
|
|
2407
2590
|
},
|
|
2591
|
+
revenue: {
|
|
2592
|
+
type: "array",
|
|
2593
|
+
items: {
|
|
2594
|
+
type: "object",
|
|
2595
|
+
properties: {
|
|
2596
|
+
date: {
|
|
2597
|
+
type: "string",
|
|
2598
|
+
format: "date"
|
|
2599
|
+
},
|
|
2600
|
+
amount: {
|
|
2601
|
+
type: "number"
|
|
2602
|
+
},
|
|
2603
|
+
type: {
|
|
2604
|
+
type: "string"
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
},
|
|
2408
2609
|
rateSuppressed: {
|
|
2409
2610
|
type: "boolean"
|
|
2410
2611
|
},
|
|
@@ -2450,6 +2651,15 @@ var require_reservation2 = __commonJS({
|
|
|
2450
2651
|
range(tz) {
|
|
2451
2652
|
const start = new Date(this.checkInDateTime);
|
|
2452
2653
|
const end = new Date(this.checkOutDateTime);
|
|
2654
|
+
if (start.getDate() === end.getDate() && start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
|
|
2655
|
+
return `${start.toLocaleString("default", {
|
|
2656
|
+
month: "short",
|
|
2657
|
+
timeZone: tz
|
|
2658
|
+
})} ${start.toLocaleString("default", {
|
|
2659
|
+
timeZone: tz,
|
|
2660
|
+
day: "numeric"
|
|
2661
|
+
})}`;
|
|
2662
|
+
}
|
|
2453
2663
|
if (start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
|
|
2454
2664
|
return `${start.toLocaleString("default", {
|
|
2455
2665
|
month: "short",
|
|
@@ -2587,6 +2797,9 @@ var require_space = __commonJS({
|
|
|
2587
2797
|
"other"
|
|
2588
2798
|
]
|
|
2589
2799
|
},
|
|
2800
|
+
subType: {
|
|
2801
|
+
type: "string"
|
|
2802
|
+
},
|
|
2590
2803
|
rooms: {
|
|
2591
2804
|
type: "array",
|
|
2592
2805
|
items: {
|
|
@@ -2718,9 +2931,6 @@ var require_space2 = __commonJS({
|
|
|
2718
2931
|
get hasCourtesy() {
|
|
2719
2932
|
return this.rooms.some((room) => room.hasCourtesy);
|
|
2720
2933
|
}
|
|
2721
|
-
get hasSceneController() {
|
|
2722
|
-
return this.rooms.some((room) => room.hasSceneController);
|
|
2723
|
-
}
|
|
2724
2934
|
get hasCamera() {
|
|
2725
2935
|
return this.rooms.some((room) => room.hasCamera);
|
|
2726
2936
|
}
|
|
@@ -2765,6 +2975,69 @@ var require_space2 = __commonJS({
|
|
|
2765
2975
|
}
|
|
2766
2976
|
});
|
|
2767
2977
|
|
|
2978
|
+
// src/schemas/spaceType.json
|
|
2979
|
+
var require_spaceType = __commonJS({
|
|
2980
|
+
"src/schemas/spaceType.json"(exports2, module2) {
|
|
2981
|
+
module2.exports = {
|
|
2982
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
2983
|
+
$id: "https://api.kohost.app/schemas/v3/spaceType.json",
|
|
2984
|
+
title: "Space Type",
|
|
2985
|
+
type: "object",
|
|
2986
|
+
properties: {
|
|
2987
|
+
id: {
|
|
2988
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
2989
|
+
},
|
|
2990
|
+
type: {
|
|
2991
|
+
type: "string"
|
|
2992
|
+
},
|
|
2993
|
+
name: {
|
|
2994
|
+
type: "string",
|
|
2995
|
+
minLength: 1
|
|
2996
|
+
},
|
|
2997
|
+
description: {
|
|
2998
|
+
type: "string"
|
|
2999
|
+
},
|
|
3000
|
+
imageUrl: {
|
|
3001
|
+
format: "uri",
|
|
3002
|
+
pattern: "^https?://"
|
|
3003
|
+
},
|
|
3004
|
+
systemData: {
|
|
3005
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
};
|
|
3009
|
+
}
|
|
3010
|
+
});
|
|
3011
|
+
|
|
3012
|
+
// src/Models/spaceType.js
|
|
3013
|
+
var require_spaceType2 = __commonJS({
|
|
3014
|
+
"src/Models/spaceType.js"(exports2, module2) {
|
|
3015
|
+
var schemas = require_schema();
|
|
3016
|
+
var schema = require_spaceType();
|
|
3017
|
+
var Kohost = require_kohost();
|
|
3018
|
+
schemas.add(schema);
|
|
3019
|
+
var validator = schemas.compile(schema);
|
|
3020
|
+
var SpaceType2 = class extends Kohost {
|
|
3021
|
+
constructor(data) {
|
|
3022
|
+
super(data);
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
__name(SpaceType2, "SpaceType");
|
|
3026
|
+
Object.defineProperty(SpaceType2.prototype, "schema", {
|
|
3027
|
+
value: schema
|
|
3028
|
+
});
|
|
3029
|
+
Object.defineProperty(SpaceType2.prototype, "validator", {
|
|
3030
|
+
get: function() {
|
|
3031
|
+
return validator;
|
|
3032
|
+
}
|
|
3033
|
+
});
|
|
3034
|
+
Object.defineProperty(SpaceType2, "validProperties", {
|
|
3035
|
+
value: Object.keys(schema.properties)
|
|
3036
|
+
});
|
|
3037
|
+
module2.exports = SpaceType2;
|
|
3038
|
+
}
|
|
3039
|
+
});
|
|
3040
|
+
|
|
2768
3041
|
// src/schemas/ticket.json
|
|
2769
3042
|
var require_ticket = __commonJS({
|
|
2770
3043
|
"src/schemas/ticket.json"(exports2, module2) {
|
|
@@ -3005,7 +3278,7 @@ var require_product = __commonJS({
|
|
|
3005
3278
|
$id: "https://api.kohost.app/schemas/v3/product.json",
|
|
3006
3279
|
title: "Product",
|
|
3007
3280
|
type: "object",
|
|
3008
|
-
required: ["name", "
|
|
3281
|
+
required: ["name", "price", "currency"],
|
|
3009
3282
|
properties: {
|
|
3010
3283
|
id: {
|
|
3011
3284
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -3031,6 +3304,10 @@ var require_product = __commonJS({
|
|
|
3031
3304
|
image: {
|
|
3032
3305
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
3033
3306
|
},
|
|
3307
|
+
imageUrl: {
|
|
3308
|
+
format: "uri",
|
|
3309
|
+
pattern: "^https?://"
|
|
3310
|
+
},
|
|
3034
3311
|
systemData: {
|
|
3035
3312
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3036
3313
|
}
|
|
@@ -3274,83 +3551,16 @@ var require_shortLink2 = __commonJS({
|
|
|
3274
3551
|
}
|
|
3275
3552
|
});
|
|
3276
3553
|
|
|
3277
|
-
// src/schemas/
|
|
3278
|
-
var require_customer = __commonJS({
|
|
3279
|
-
"src/schemas/admin/customer.json"(exports2, module2) {
|
|
3280
|
-
module2.exports = {
|
|
3281
|
-
$schema: "http://json-schema.org/draft-07/schema",
|
|
3282
|
-
$id: "https://api.kohost.app/schemas/v3/admin/customer.json",
|
|
3283
|
-
title: "Customer",
|
|
3284
|
-
type: "object",
|
|
3285
|
-
description: "A Kohost customer",
|
|
3286
|
-
required: ["accountNumber", "name"],
|
|
3287
|
-
properties: {
|
|
3288
|
-
id: {
|
|
3289
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
3290
|
-
},
|
|
3291
|
-
accountNumber: {
|
|
3292
|
-
type: "number",
|
|
3293
|
-
minimum: 1e4
|
|
3294
|
-
},
|
|
3295
|
-
name: {
|
|
3296
|
-
type: "string"
|
|
3297
|
-
},
|
|
3298
|
-
properties: {
|
|
3299
|
-
type: "array",
|
|
3300
|
-
items: {
|
|
3301
|
-
type: "string"
|
|
3302
|
-
}
|
|
3303
|
-
},
|
|
3304
|
-
createdAt: {
|
|
3305
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
3306
|
-
},
|
|
3307
|
-
updatedAt: {
|
|
3308
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
3309
|
-
}
|
|
3310
|
-
}
|
|
3311
|
-
};
|
|
3312
|
-
}
|
|
3313
|
-
});
|
|
3314
|
-
|
|
3315
|
-
// src/Models/admin/customer.js
|
|
3316
|
-
var require_customer2 = __commonJS({
|
|
3317
|
-
"src/Models/admin/customer.js"(exports2, module2) {
|
|
3318
|
-
var schemas = require_schema();
|
|
3319
|
-
var schema = require_customer();
|
|
3320
|
-
var Kohost = require_kohost();
|
|
3321
|
-
schemas.add(schema);
|
|
3322
|
-
var validator = schemas.compile(schema);
|
|
3323
|
-
var Customer = class extends Kohost {
|
|
3324
|
-
constructor(data) {
|
|
3325
|
-
super(data);
|
|
3326
|
-
}
|
|
3327
|
-
};
|
|
3328
|
-
__name(Customer, "Customer");
|
|
3329
|
-
Object.defineProperty(Customer.prototype, "schema", {
|
|
3330
|
-
value: schema
|
|
3331
|
-
});
|
|
3332
|
-
Object.defineProperty(Customer.prototype, "validator", {
|
|
3333
|
-
get: function() {
|
|
3334
|
-
return validator;
|
|
3335
|
-
}
|
|
3336
|
-
});
|
|
3337
|
-
Object.defineProperty(Customer, "validProperties", {
|
|
3338
|
-
value: Object.keys(schema.properties)
|
|
3339
|
-
});
|
|
3340
|
-
module2.exports = Customer;
|
|
3341
|
-
}
|
|
3342
|
-
});
|
|
3343
|
-
|
|
3344
|
-
// src/schemas/admin/property.json
|
|
3554
|
+
// src/schemas/property.json
|
|
3345
3555
|
var require_property = __commonJS({
|
|
3346
|
-
"src/schemas/
|
|
3556
|
+
"src/schemas/property.json"(exports2, module2) {
|
|
3347
3557
|
module2.exports = {
|
|
3348
3558
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3349
3559
|
$id: "https://api.kohost.app/schemas/v3/admin/property.json",
|
|
3350
3560
|
title: "Property",
|
|
3351
3561
|
type: "object",
|
|
3352
3562
|
description: "A property is a physical asset or building",
|
|
3353
|
-
required: ["id", "name", "type", "hostname"],
|
|
3563
|
+
required: ["id", "name", "type", "hostname", "organization"],
|
|
3354
3564
|
properties: {
|
|
3355
3565
|
id: {
|
|
3356
3566
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -3371,6 +3581,10 @@ var require_property = __commonJS({
|
|
|
3371
3581
|
hostname: {
|
|
3372
3582
|
type: "string"
|
|
3373
3583
|
},
|
|
3584
|
+
organization: {
|
|
3585
|
+
type: "string",
|
|
3586
|
+
description: "Reference to the organization that owns this property"
|
|
3587
|
+
},
|
|
3374
3588
|
address: {
|
|
3375
3589
|
type: "object",
|
|
3376
3590
|
properties: {
|
|
@@ -3526,32 +3740,103 @@ var require_property = __commonJS({
|
|
|
3526
3740
|
}
|
|
3527
3741
|
});
|
|
3528
3742
|
|
|
3529
|
-
// src/Models/
|
|
3743
|
+
// src/Models/property.js
|
|
3530
3744
|
var require_property2 = __commonJS({
|
|
3531
|
-
"src/Models/
|
|
3745
|
+
"src/Models/property.js"(exports2, module2) {
|
|
3532
3746
|
var schemas = require_schema();
|
|
3533
3747
|
var schema = require_property();
|
|
3534
3748
|
var Kohost = require_kohost();
|
|
3535
3749
|
schemas.add(schema);
|
|
3536
3750
|
var validator = schemas.compile(schema);
|
|
3537
|
-
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 {
|
|
3538
3823
|
constructor(data) {
|
|
3539
3824
|
super(data);
|
|
3540
3825
|
}
|
|
3541
3826
|
};
|
|
3542
|
-
__name(
|
|
3543
|
-
Object.defineProperty(
|
|
3827
|
+
__name(Organization2, "Organization");
|
|
3828
|
+
Object.defineProperty(Organization2.prototype, "schema", {
|
|
3544
3829
|
value: schema
|
|
3545
3830
|
});
|
|
3546
|
-
Object.defineProperty(
|
|
3831
|
+
Object.defineProperty(Organization2.prototype, "validator", {
|
|
3547
3832
|
get: function() {
|
|
3548
3833
|
return validator;
|
|
3549
3834
|
}
|
|
3550
3835
|
});
|
|
3551
|
-
Object.defineProperty(
|
|
3836
|
+
Object.defineProperty(Organization2, "validProperties", {
|
|
3552
3837
|
value: Object.keys(schema.properties)
|
|
3553
3838
|
});
|
|
3554
|
-
module2.exports =
|
|
3839
|
+
module2.exports = Organization2;
|
|
3555
3840
|
}
|
|
3556
3841
|
});
|
|
3557
3842
|
|
|
@@ -3564,6 +3849,7 @@ var Thermostat = require_thermostat2();
|
|
|
3564
3849
|
var WindowCovering = require_windowCovering2();
|
|
3565
3850
|
var Identification = require_identification2();
|
|
3566
3851
|
var User = require_user2();
|
|
3852
|
+
var SystemUser = require_systemUser2();
|
|
3567
3853
|
var Courtesy = require_courtesy2();
|
|
3568
3854
|
var Camera = require_camera2();
|
|
3569
3855
|
var MotionSensor = require_motionSensor2();
|
|
@@ -3572,6 +3858,7 @@ var Room = require_room2();
|
|
|
3572
3858
|
var Reservation = require_reservation2();
|
|
3573
3859
|
var Application = require_application2();
|
|
3574
3860
|
var Space = require_space2();
|
|
3861
|
+
var SpaceType = require_spaceType2();
|
|
3575
3862
|
var Ticket = require_ticket2();
|
|
3576
3863
|
var Scene = require_scene2();
|
|
3577
3864
|
var Gateway = require_gateway2();
|
|
@@ -3579,13 +3866,11 @@ var Product = require_product2();
|
|
|
3579
3866
|
var DiscoveredDevice = require_discoveredDevice2();
|
|
3580
3867
|
var Credential = require_credential2();
|
|
3581
3868
|
var ShortLink = require_shortLink2();
|
|
3582
|
-
var
|
|
3583
|
-
var
|
|
3869
|
+
var Property = require_property2();
|
|
3870
|
+
var Organization = require_organization2();
|
|
3584
3871
|
module.exports = {
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
Property: AdminProperty
|
|
3588
|
-
},
|
|
3872
|
+
Organization,
|
|
3873
|
+
Property,
|
|
3589
3874
|
Gateway,
|
|
3590
3875
|
Switch,
|
|
3591
3876
|
Alarm,
|
|
@@ -3600,9 +3885,11 @@ module.exports = {
|
|
|
3600
3885
|
Identification,
|
|
3601
3886
|
Product,
|
|
3602
3887
|
User,
|
|
3888
|
+
SystemUser,
|
|
3603
3889
|
Room,
|
|
3604
3890
|
Application,
|
|
3605
3891
|
Space,
|
|
3892
|
+
SpaceType,
|
|
3606
3893
|
Ticket,
|
|
3607
3894
|
Scene,
|
|
3608
3895
|
DiscoveredDevice,
|