@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/esm/Models.js
CHANGED
|
@@ -7586,6 +7586,9 @@ var require_switch = __commonJS({
|
|
|
7586
7586
|
id: {
|
|
7587
7587
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
7588
7588
|
},
|
|
7589
|
+
name: {
|
|
7590
|
+
type: "string"
|
|
7591
|
+
},
|
|
7589
7592
|
type: {
|
|
7590
7593
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
7591
7594
|
},
|
|
@@ -8099,6 +8102,9 @@ var require_dimmer = __commonJS({
|
|
|
8099
8102
|
id: {
|
|
8100
8103
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
8101
8104
|
},
|
|
8105
|
+
name: {
|
|
8106
|
+
type: "string"
|
|
8107
|
+
},
|
|
8102
8108
|
type: {
|
|
8103
8109
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
8104
8110
|
},
|
|
@@ -8321,7 +8327,7 @@ var require_thermostat = __commonJS({
|
|
|
8321
8327
|
type: "array",
|
|
8322
8328
|
uniqueItems: true,
|
|
8323
8329
|
items: {
|
|
8324
|
-
enum: ["auto", "low", "medium", "high", "off"]
|
|
8330
|
+
enum: ["auto", "low", "medium", "high", "off", "on"]
|
|
8325
8331
|
}
|
|
8326
8332
|
},
|
|
8327
8333
|
setpoints: {
|
|
@@ -8339,6 +8345,9 @@ var require_thermostat = __commonJS({
|
|
|
8339
8345
|
}
|
|
8340
8346
|
}
|
|
8341
8347
|
},
|
|
8348
|
+
minAutoDelta: {
|
|
8349
|
+
type: "number"
|
|
8350
|
+
},
|
|
8342
8351
|
batteryLevel: {
|
|
8343
8352
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/batteryLevel"
|
|
8344
8353
|
},
|
|
@@ -8478,6 +8487,9 @@ var require_windowCovering = __commonJS({
|
|
|
8478
8487
|
id: {
|
|
8479
8488
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
8480
8489
|
},
|
|
8490
|
+
name: {
|
|
8491
|
+
type: "string"
|
|
8492
|
+
},
|
|
8481
8493
|
type: {
|
|
8482
8494
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
8483
8495
|
},
|
|
@@ -8645,7 +8657,7 @@ var require_user = __commonJS({
|
|
|
8645
8657
|
$id: "https://api.kohost.app/schemas/v3/user.json",
|
|
8646
8658
|
title: "User",
|
|
8647
8659
|
type: "object",
|
|
8648
|
-
required: ["
|
|
8660
|
+
required: ["firstName", "lastName"],
|
|
8649
8661
|
properties: {
|
|
8650
8662
|
id: {
|
|
8651
8663
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -8654,10 +8666,6 @@ var require_user = __commonJS({
|
|
|
8654
8666
|
type: "string",
|
|
8655
8667
|
default: "user"
|
|
8656
8668
|
},
|
|
8657
|
-
active: {
|
|
8658
|
-
type: "boolean",
|
|
8659
|
-
default: true
|
|
8660
|
-
},
|
|
8661
8669
|
firstName: {
|
|
8662
8670
|
type: "string"
|
|
8663
8671
|
},
|
|
@@ -8702,32 +8710,44 @@ var require_user = __commonJS({
|
|
|
8702
8710
|
minLength: 2,
|
|
8703
8711
|
maxLength: 2
|
|
8704
8712
|
},
|
|
8705
|
-
|
|
8713
|
+
permissions: {
|
|
8706
8714
|
type: "array",
|
|
8715
|
+
default: [],
|
|
8707
8716
|
items: {
|
|
8708
|
-
type: "
|
|
8717
|
+
type: "object",
|
|
8718
|
+
required: ["organization", "property", "role"],
|
|
8719
|
+
properties: {
|
|
8720
|
+
organization: {
|
|
8721
|
+
type: "string",
|
|
8722
|
+
description: "The ID of the organization the permission is applies to."
|
|
8723
|
+
},
|
|
8724
|
+
property: {
|
|
8725
|
+
type: "string",
|
|
8726
|
+
description: "The ID of the property the permission is applies to."
|
|
8727
|
+
},
|
|
8728
|
+
role: {
|
|
8729
|
+
type: "string",
|
|
8730
|
+
enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
|
|
8731
|
+
},
|
|
8732
|
+
customPermissions: {
|
|
8733
|
+
type: "array",
|
|
8734
|
+
items: {
|
|
8735
|
+
type: "string"
|
|
8736
|
+
}
|
|
8737
|
+
}
|
|
8738
|
+
}
|
|
8709
8739
|
}
|
|
8710
8740
|
},
|
|
8711
|
-
|
|
8741
|
+
notes: {
|
|
8712
8742
|
type: "array",
|
|
8713
8743
|
items: {
|
|
8714
|
-
|
|
8744
|
+
type: "string"
|
|
8715
8745
|
}
|
|
8716
8746
|
},
|
|
8717
|
-
|
|
8747
|
+
files: {
|
|
8718
8748
|
type: "array",
|
|
8719
8749
|
items: {
|
|
8720
|
-
|
|
8721
|
-
enum: [
|
|
8722
|
-
"Guest",
|
|
8723
|
-
"Staff",
|
|
8724
|
-
"Faculty",
|
|
8725
|
-
"Student",
|
|
8726
|
-
"Visitor",
|
|
8727
|
-
"Manager",
|
|
8728
|
-
"Administrator",
|
|
8729
|
-
"SuperAdmin"
|
|
8730
|
-
]
|
|
8750
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
8731
8751
|
}
|
|
8732
8752
|
},
|
|
8733
8753
|
identifications: {
|
|
@@ -8742,25 +8762,6 @@ var require_user = __commonJS({
|
|
|
8742
8762
|
$ref: "https://api.kohost.app/schemas/v3/payment.json#"
|
|
8743
8763
|
}
|
|
8744
8764
|
},
|
|
8745
|
-
preferences: {
|
|
8746
|
-
type: "object",
|
|
8747
|
-
additionalProperties: false,
|
|
8748
|
-
properties: {
|
|
8749
|
-
notifications: {
|
|
8750
|
-
type: "array",
|
|
8751
|
-
items: {
|
|
8752
|
-
type: "string"
|
|
8753
|
-
},
|
|
8754
|
-
examples: [["roomControl", "marketing"]]
|
|
8755
|
-
},
|
|
8756
|
-
location: {
|
|
8757
|
-
title: "The location Schema",
|
|
8758
|
-
type: "boolean",
|
|
8759
|
-
default: false,
|
|
8760
|
-
examples: [true]
|
|
8761
|
-
}
|
|
8762
|
-
}
|
|
8763
|
-
},
|
|
8764
8765
|
location: {
|
|
8765
8766
|
type: "object",
|
|
8766
8767
|
required: ["accuracy", "latitude", "longitude", "timestamp"],
|
|
@@ -8780,31 +8781,6 @@ var require_user = __commonJS({
|
|
|
8780
8781
|
}
|
|
8781
8782
|
}
|
|
8782
8783
|
},
|
|
8783
|
-
registeredDevices: {
|
|
8784
|
-
type: "array",
|
|
8785
|
-
items: {
|
|
8786
|
-
type: "object",
|
|
8787
|
-
properties: {
|
|
8788
|
-
userAgent: {
|
|
8789
|
-
type: "string"
|
|
8790
|
-
},
|
|
8791
|
-
fingerPrint: {
|
|
8792
|
-
type: "string"
|
|
8793
|
-
},
|
|
8794
|
-
ip: {
|
|
8795
|
-
type: "string"
|
|
8796
|
-
},
|
|
8797
|
-
registeredAt: {
|
|
8798
|
-
type: "string",
|
|
8799
|
-
format: "date-time"
|
|
8800
|
-
},
|
|
8801
|
-
expiresAt: {
|
|
8802
|
-
type: "string",
|
|
8803
|
-
format: "date-time"
|
|
8804
|
-
}
|
|
8805
|
-
}
|
|
8806
|
-
}
|
|
8807
|
-
},
|
|
8808
8784
|
createdAt: {
|
|
8809
8785
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
8810
8786
|
},
|
|
@@ -8812,7 +8788,10 @@ var require_user = __commonJS({
|
|
|
8812
8788
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
8813
8789
|
},
|
|
8814
8790
|
systemData: {
|
|
8815
|
-
|
|
8791
|
+
type: "array",
|
|
8792
|
+
items: {
|
|
8793
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
8794
|
+
}
|
|
8816
8795
|
}
|
|
8817
8796
|
}
|
|
8818
8797
|
};
|
|
@@ -8956,10 +8935,161 @@ var require_user2 = __commonJS({
|
|
|
8956
8935
|
return `${this.firstName} ${this.lastName}`;
|
|
8957
8936
|
}
|
|
8958
8937
|
});
|
|
8938
|
+
Object.defineProperty(User.prototype, "roles", {
|
|
8939
|
+
get: function() {
|
|
8940
|
+
const roles = /* @__PURE__ */ new Set();
|
|
8941
|
+
if (this.permissions) {
|
|
8942
|
+
for (const permission of this.permissions) {
|
|
8943
|
+
roles.add(permission.role);
|
|
8944
|
+
}
|
|
8945
|
+
}
|
|
8946
|
+
return Array.from(roles);
|
|
8947
|
+
}
|
|
8948
|
+
});
|
|
8959
8949
|
module.exports = User;
|
|
8960
8950
|
}
|
|
8961
8951
|
});
|
|
8962
8952
|
|
|
8953
|
+
// src/schemas/systemUser.json
|
|
8954
|
+
var require_systemUser = __commonJS({
|
|
8955
|
+
"src/schemas/systemUser.json"(exports, module) {
|
|
8956
|
+
module.exports = {
|
|
8957
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
8958
|
+
$id: "https://api.kohost.app/schemas/v3/systemUser.json",
|
|
8959
|
+
title: "System User",
|
|
8960
|
+
description: "A system user is a user that originated from an external 3rd party system.",
|
|
8961
|
+
type: "object",
|
|
8962
|
+
required: ["firstName", "lastName"],
|
|
8963
|
+
properties: {
|
|
8964
|
+
id: {
|
|
8965
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
8966
|
+
},
|
|
8967
|
+
type: {
|
|
8968
|
+
type: "string",
|
|
8969
|
+
default: "systemUser"
|
|
8970
|
+
},
|
|
8971
|
+
firstName: {
|
|
8972
|
+
type: "string"
|
|
8973
|
+
},
|
|
8974
|
+
lastName: {
|
|
8975
|
+
type: "string"
|
|
8976
|
+
},
|
|
8977
|
+
phone: {
|
|
8978
|
+
type: ["string", "null"],
|
|
8979
|
+
pattern: "^\\+[0-9]{1,14}$"
|
|
8980
|
+
},
|
|
8981
|
+
email: {
|
|
8982
|
+
type: ["string", "null"],
|
|
8983
|
+
format: "email"
|
|
8984
|
+
},
|
|
8985
|
+
address: {
|
|
8986
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/address"
|
|
8987
|
+
},
|
|
8988
|
+
photo: {
|
|
8989
|
+
type: "string"
|
|
8990
|
+
},
|
|
8991
|
+
jobTitle: {
|
|
8992
|
+
type: "string"
|
|
8993
|
+
},
|
|
8994
|
+
dob: {
|
|
8995
|
+
type: "string"
|
|
8996
|
+
},
|
|
8997
|
+
gender: {
|
|
8998
|
+
type: "string",
|
|
8999
|
+
enum: ["male", "female"]
|
|
9000
|
+
},
|
|
9001
|
+
roles: {
|
|
9002
|
+
type: "array",
|
|
9003
|
+
items: {
|
|
9004
|
+
type: "string",
|
|
9005
|
+
enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
|
|
9006
|
+
}
|
|
9007
|
+
},
|
|
9008
|
+
nationality: {
|
|
9009
|
+
type: "string",
|
|
9010
|
+
minLength: 2,
|
|
9011
|
+
maxLength: 2
|
|
9012
|
+
},
|
|
9013
|
+
notes: {
|
|
9014
|
+
type: "array",
|
|
9015
|
+
items: {
|
|
9016
|
+
type: "string"
|
|
9017
|
+
}
|
|
9018
|
+
},
|
|
9019
|
+
files: {
|
|
9020
|
+
type: "array",
|
|
9021
|
+
items: {
|
|
9022
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
9023
|
+
}
|
|
9024
|
+
},
|
|
9025
|
+
identifications: {
|
|
9026
|
+
type: "array",
|
|
9027
|
+
items: {
|
|
9028
|
+
$ref: "https://api.kohost.app/schemas/v3/identification.json#"
|
|
9029
|
+
}
|
|
9030
|
+
},
|
|
9031
|
+
payments: {
|
|
9032
|
+
type: "array",
|
|
9033
|
+
items: {
|
|
9034
|
+
$ref: "https://api.kohost.app/schemas/v3/payment.json#"
|
|
9035
|
+
}
|
|
9036
|
+
},
|
|
9037
|
+
createdAt: {
|
|
9038
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
9039
|
+
},
|
|
9040
|
+
updatedAt: {
|
|
9041
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
9042
|
+
},
|
|
9043
|
+
systemData: {
|
|
9044
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
9045
|
+
}
|
|
9046
|
+
}
|
|
9047
|
+
};
|
|
9048
|
+
}
|
|
9049
|
+
});
|
|
9050
|
+
|
|
9051
|
+
// src/Models/systemUser.js
|
|
9052
|
+
var require_systemUser2 = __commonJS({
|
|
9053
|
+
"src/Models/systemUser.js"(exports, module) {
|
|
9054
|
+
var schemas = require_schema();
|
|
9055
|
+
var schema = require_systemUser();
|
|
9056
|
+
var Kohost = require_kohost();
|
|
9057
|
+
schemas.add(schema);
|
|
9058
|
+
var validator = schemas.compile(schema);
|
|
9059
|
+
var SystemUser = class extends Kohost {
|
|
9060
|
+
constructor(data) {
|
|
9061
|
+
super(data);
|
|
9062
|
+
}
|
|
9063
|
+
static validatePhone(phoneNumber) {
|
|
9064
|
+
const regex = /^\+?[1-9]\d{1,14}$/;
|
|
9065
|
+
return regex.test(phoneNumber);
|
|
9066
|
+
}
|
|
9067
|
+
static validateEmail(email) {
|
|
9068
|
+
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,}))$/;
|
|
9069
|
+
return regex.test(email);
|
|
9070
|
+
}
|
|
9071
|
+
};
|
|
9072
|
+
__name(SystemUser, "SystemUser");
|
|
9073
|
+
Object.defineProperty(SystemUser.prototype, "schema", {
|
|
9074
|
+
value: schema
|
|
9075
|
+
});
|
|
9076
|
+
Object.defineProperty(SystemUser.prototype, "validator", {
|
|
9077
|
+
get: function() {
|
|
9078
|
+
return validator;
|
|
9079
|
+
}
|
|
9080
|
+
});
|
|
9081
|
+
Object.defineProperty(SystemUser, "validProperties", {
|
|
9082
|
+
value: Object.keys(schema.properties)
|
|
9083
|
+
});
|
|
9084
|
+
Object.defineProperty(SystemUser.prototype, "fullName", {
|
|
9085
|
+
get: function() {
|
|
9086
|
+
return `${this.firstName} ${this.lastName}`;
|
|
9087
|
+
}
|
|
9088
|
+
});
|
|
9089
|
+
module.exports = SystemUser;
|
|
9090
|
+
}
|
|
9091
|
+
});
|
|
9092
|
+
|
|
8963
9093
|
// src/schemas/courtesy.json
|
|
8964
9094
|
var require_courtesy = __commonJS({
|
|
8965
9095
|
"src/schemas/courtesy.json"(exports, module) {
|
|
@@ -8973,6 +9103,9 @@ var require_courtesy = __commonJS({
|
|
|
8973
9103
|
id: {
|
|
8974
9104
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
8975
9105
|
},
|
|
9106
|
+
name: {
|
|
9107
|
+
type: "string"
|
|
9108
|
+
},
|
|
8976
9109
|
type: {
|
|
8977
9110
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
8978
9111
|
},
|
|
@@ -10398,6 +10531,30 @@ var require_room2 = __commonJS({
|
|
|
10398
10531
|
return `${type}s`;
|
|
10399
10532
|
}
|
|
10400
10533
|
}
|
|
10534
|
+
static getDeviceTypeFromPath(path) {
|
|
10535
|
+
const validPaths = [
|
|
10536
|
+
"dimmers",
|
|
10537
|
+
"switches",
|
|
10538
|
+
"thermostats",
|
|
10539
|
+
"locks",
|
|
10540
|
+
"windowCoverings",
|
|
10541
|
+
"courtesy",
|
|
10542
|
+
"cameras",
|
|
10543
|
+
"sources",
|
|
10544
|
+
"motionSensors",
|
|
10545
|
+
"alarms"
|
|
10546
|
+
];
|
|
10547
|
+
if (!validPaths.includes(path))
|
|
10548
|
+
throw new Error("Invalid device path:" + path);
|
|
10549
|
+
switch (path) {
|
|
10550
|
+
case "courtesy":
|
|
10551
|
+
return path;
|
|
10552
|
+
case "switches":
|
|
10553
|
+
return "switch";
|
|
10554
|
+
default:
|
|
10555
|
+
return path.slice(0, -1);
|
|
10556
|
+
}
|
|
10557
|
+
}
|
|
10401
10558
|
get hasDimmer() {
|
|
10402
10559
|
return this.dimmers?.length > 0;
|
|
10403
10560
|
}
|
|
@@ -10544,14 +10701,40 @@ var require_reservation = __commonJS({
|
|
|
10544
10701
|
type: "string"
|
|
10545
10702
|
}
|
|
10546
10703
|
},
|
|
10704
|
+
spaceType: {
|
|
10705
|
+
type: "string"
|
|
10706
|
+
},
|
|
10547
10707
|
space: {
|
|
10548
10708
|
type: "string"
|
|
10549
10709
|
},
|
|
10550
10710
|
status: {
|
|
10551
10711
|
type: "string",
|
|
10552
|
-
enum: [
|
|
10712
|
+
enum: [
|
|
10713
|
+
"reserved",
|
|
10714
|
+
"checkedIn",
|
|
10715
|
+
"checkedOut",
|
|
10716
|
+
"cancelled",
|
|
10717
|
+
"noShow",
|
|
10718
|
+
"enquired",
|
|
10719
|
+
"requested",
|
|
10720
|
+
"optional"
|
|
10721
|
+
],
|
|
10553
10722
|
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)"
|
|
10554
10723
|
},
|
|
10724
|
+
mobileCheckInStatus: {
|
|
10725
|
+
type: "string",
|
|
10726
|
+
enum: [
|
|
10727
|
+
"ready",
|
|
10728
|
+
"blocked",
|
|
10729
|
+
"preArrivalStepsRequired",
|
|
10730
|
+
"spaceNotAssigned",
|
|
10731
|
+
"spaceNotReady",
|
|
10732
|
+
"checkInTimeNotStarted"
|
|
10733
|
+
]
|
|
10734
|
+
},
|
|
10735
|
+
mobileCheckInStatusMessage: {
|
|
10736
|
+
type: "string"
|
|
10737
|
+
},
|
|
10555
10738
|
confirmationNumber: {
|
|
10556
10739
|
type: "string"
|
|
10557
10740
|
},
|
|
@@ -10572,6 +10755,24 @@ var require_reservation = __commonJS({
|
|
|
10572
10755
|
type: "number",
|
|
10573
10756
|
default: 0
|
|
10574
10757
|
},
|
|
10758
|
+
revenue: {
|
|
10759
|
+
type: "array",
|
|
10760
|
+
items: {
|
|
10761
|
+
type: "object",
|
|
10762
|
+
properties: {
|
|
10763
|
+
date: {
|
|
10764
|
+
type: "string",
|
|
10765
|
+
format: "date"
|
|
10766
|
+
},
|
|
10767
|
+
amount: {
|
|
10768
|
+
type: "number"
|
|
10769
|
+
},
|
|
10770
|
+
type: {
|
|
10771
|
+
type: "string"
|
|
10772
|
+
}
|
|
10773
|
+
}
|
|
10774
|
+
}
|
|
10775
|
+
},
|
|
10575
10776
|
rateSuppressed: {
|
|
10576
10777
|
type: "boolean"
|
|
10577
10778
|
},
|
|
@@ -10616,6 +10817,15 @@ var require_reservation2 = __commonJS({
|
|
|
10616
10817
|
range(tz) {
|
|
10617
10818
|
const start = new Date(this.checkInDateTime);
|
|
10618
10819
|
const end = new Date(this.checkOutDateTime);
|
|
10820
|
+
if (start.getDate() === end.getDate() && start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
|
|
10821
|
+
return `${start.toLocaleString("default", {
|
|
10822
|
+
month: "short",
|
|
10823
|
+
timeZone: tz
|
|
10824
|
+
})} ${start.toLocaleString("default", {
|
|
10825
|
+
timeZone: tz,
|
|
10826
|
+
day: "numeric"
|
|
10827
|
+
})}`;
|
|
10828
|
+
}
|
|
10619
10829
|
if (start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
|
|
10620
10830
|
return `${start.toLocaleString("default", {
|
|
10621
10831
|
month: "short",
|
|
@@ -10753,6 +10963,9 @@ var require_space = __commonJS({
|
|
|
10753
10963
|
"other"
|
|
10754
10964
|
]
|
|
10755
10965
|
},
|
|
10966
|
+
subType: {
|
|
10967
|
+
type: "string"
|
|
10968
|
+
},
|
|
10756
10969
|
rooms: {
|
|
10757
10970
|
type: "array",
|
|
10758
10971
|
items: {
|
|
@@ -10884,9 +11097,6 @@ var require_space2 = __commonJS({
|
|
|
10884
11097
|
get hasCourtesy() {
|
|
10885
11098
|
return this.rooms.some((room) => room.hasCourtesy);
|
|
10886
11099
|
}
|
|
10887
|
-
get hasSceneController() {
|
|
10888
|
-
return this.rooms.some((room) => room.hasSceneController);
|
|
10889
|
-
}
|
|
10890
11100
|
get hasCamera() {
|
|
10891
11101
|
return this.rooms.some((room) => room.hasCamera);
|
|
10892
11102
|
}
|
|
@@ -10930,6 +11140,69 @@ var require_space2 = __commonJS({
|
|
|
10930
11140
|
}
|
|
10931
11141
|
});
|
|
10932
11142
|
|
|
11143
|
+
// src/schemas/spaceType.json
|
|
11144
|
+
var require_spaceType = __commonJS({
|
|
11145
|
+
"src/schemas/spaceType.json"(exports, module) {
|
|
11146
|
+
module.exports = {
|
|
11147
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
11148
|
+
$id: "https://api.kohost.app/schemas/v3/spaceType.json",
|
|
11149
|
+
title: "Space Type",
|
|
11150
|
+
type: "object",
|
|
11151
|
+
properties: {
|
|
11152
|
+
id: {
|
|
11153
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
11154
|
+
},
|
|
11155
|
+
type: {
|
|
11156
|
+
type: "string"
|
|
11157
|
+
},
|
|
11158
|
+
name: {
|
|
11159
|
+
type: "string",
|
|
11160
|
+
minLength: 1
|
|
11161
|
+
},
|
|
11162
|
+
description: {
|
|
11163
|
+
type: "string"
|
|
11164
|
+
},
|
|
11165
|
+
imageUrl: {
|
|
11166
|
+
format: "uri",
|
|
11167
|
+
pattern: "^https?://"
|
|
11168
|
+
},
|
|
11169
|
+
systemData: {
|
|
11170
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
11171
|
+
}
|
|
11172
|
+
}
|
|
11173
|
+
};
|
|
11174
|
+
}
|
|
11175
|
+
});
|
|
11176
|
+
|
|
11177
|
+
// src/Models/spaceType.js
|
|
11178
|
+
var require_spaceType2 = __commonJS({
|
|
11179
|
+
"src/Models/spaceType.js"(exports, module) {
|
|
11180
|
+
var schemas = require_schema();
|
|
11181
|
+
var schema = require_spaceType();
|
|
11182
|
+
var Kohost = require_kohost();
|
|
11183
|
+
schemas.add(schema);
|
|
11184
|
+
var validator = schemas.compile(schema);
|
|
11185
|
+
var SpaceType = class extends Kohost {
|
|
11186
|
+
constructor(data) {
|
|
11187
|
+
super(data);
|
|
11188
|
+
}
|
|
11189
|
+
};
|
|
11190
|
+
__name(SpaceType, "SpaceType");
|
|
11191
|
+
Object.defineProperty(SpaceType.prototype, "schema", {
|
|
11192
|
+
value: schema
|
|
11193
|
+
});
|
|
11194
|
+
Object.defineProperty(SpaceType.prototype, "validator", {
|
|
11195
|
+
get: function() {
|
|
11196
|
+
return validator;
|
|
11197
|
+
}
|
|
11198
|
+
});
|
|
11199
|
+
Object.defineProperty(SpaceType, "validProperties", {
|
|
11200
|
+
value: Object.keys(schema.properties)
|
|
11201
|
+
});
|
|
11202
|
+
module.exports = SpaceType;
|
|
11203
|
+
}
|
|
11204
|
+
});
|
|
11205
|
+
|
|
10933
11206
|
// src/schemas/ticket.json
|
|
10934
11207
|
var require_ticket = __commonJS({
|
|
10935
11208
|
"src/schemas/ticket.json"(exports, module) {
|
|
@@ -13234,7 +13507,7 @@ var require_product = __commonJS({
|
|
|
13234
13507
|
$id: "https://api.kohost.app/schemas/v3/product.json",
|
|
13235
13508
|
title: "Product",
|
|
13236
13509
|
type: "object",
|
|
13237
|
-
required: ["name", "
|
|
13510
|
+
required: ["name", "price", "currency"],
|
|
13238
13511
|
properties: {
|
|
13239
13512
|
id: {
|
|
13240
13513
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -13260,6 +13533,10 @@ var require_product = __commonJS({
|
|
|
13260
13533
|
image: {
|
|
13261
13534
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
13262
13535
|
},
|
|
13536
|
+
imageUrl: {
|
|
13537
|
+
format: "uri",
|
|
13538
|
+
pattern: "^https?://"
|
|
13539
|
+
},
|
|
13263
13540
|
systemData: {
|
|
13264
13541
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
13265
13542
|
}
|
|
@@ -13503,83 +13780,16 @@ var require_shortLink2 = __commonJS({
|
|
|
13503
13780
|
}
|
|
13504
13781
|
});
|
|
13505
13782
|
|
|
13506
|
-
// src/schemas/
|
|
13507
|
-
var require_customer = __commonJS({
|
|
13508
|
-
"src/schemas/admin/customer.json"(exports, module) {
|
|
13509
|
-
module.exports = {
|
|
13510
|
-
$schema: "http://json-schema.org/draft-07/schema",
|
|
13511
|
-
$id: "https://api.kohost.app/schemas/v3/admin/customer.json",
|
|
13512
|
-
title: "Customer",
|
|
13513
|
-
type: "object",
|
|
13514
|
-
description: "A Kohost customer",
|
|
13515
|
-
required: ["accountNumber", "name"],
|
|
13516
|
-
properties: {
|
|
13517
|
-
id: {
|
|
13518
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
13519
|
-
},
|
|
13520
|
-
accountNumber: {
|
|
13521
|
-
type: "number",
|
|
13522
|
-
minimum: 1e4
|
|
13523
|
-
},
|
|
13524
|
-
name: {
|
|
13525
|
-
type: "string"
|
|
13526
|
-
},
|
|
13527
|
-
properties: {
|
|
13528
|
-
type: "array",
|
|
13529
|
-
items: {
|
|
13530
|
-
type: "string"
|
|
13531
|
-
}
|
|
13532
|
-
},
|
|
13533
|
-
createdAt: {
|
|
13534
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
13535
|
-
},
|
|
13536
|
-
updatedAt: {
|
|
13537
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
13538
|
-
}
|
|
13539
|
-
}
|
|
13540
|
-
};
|
|
13541
|
-
}
|
|
13542
|
-
});
|
|
13543
|
-
|
|
13544
|
-
// src/Models/admin/customer.js
|
|
13545
|
-
var require_customer2 = __commonJS({
|
|
13546
|
-
"src/Models/admin/customer.js"(exports, module) {
|
|
13547
|
-
var schemas = require_schema();
|
|
13548
|
-
var schema = require_customer();
|
|
13549
|
-
var Kohost = require_kohost();
|
|
13550
|
-
schemas.add(schema);
|
|
13551
|
-
var validator = schemas.compile(schema);
|
|
13552
|
-
var Customer = class extends Kohost {
|
|
13553
|
-
constructor(data) {
|
|
13554
|
-
super(data);
|
|
13555
|
-
}
|
|
13556
|
-
};
|
|
13557
|
-
__name(Customer, "Customer");
|
|
13558
|
-
Object.defineProperty(Customer.prototype, "schema", {
|
|
13559
|
-
value: schema
|
|
13560
|
-
});
|
|
13561
|
-
Object.defineProperty(Customer.prototype, "validator", {
|
|
13562
|
-
get: function() {
|
|
13563
|
-
return validator;
|
|
13564
|
-
}
|
|
13565
|
-
});
|
|
13566
|
-
Object.defineProperty(Customer, "validProperties", {
|
|
13567
|
-
value: Object.keys(schema.properties)
|
|
13568
|
-
});
|
|
13569
|
-
module.exports = Customer;
|
|
13570
|
-
}
|
|
13571
|
-
});
|
|
13572
|
-
|
|
13573
|
-
// src/schemas/admin/property.json
|
|
13783
|
+
// src/schemas/property.json
|
|
13574
13784
|
var require_property = __commonJS({
|
|
13575
|
-
"src/schemas/
|
|
13785
|
+
"src/schemas/property.json"(exports, module) {
|
|
13576
13786
|
module.exports = {
|
|
13577
13787
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
13578
13788
|
$id: "https://api.kohost.app/schemas/v3/admin/property.json",
|
|
13579
13789
|
title: "Property",
|
|
13580
13790
|
type: "object",
|
|
13581
13791
|
description: "A property is a physical asset or building",
|
|
13582
|
-
required: ["id", "name", "type", "hostname"],
|
|
13792
|
+
required: ["id", "name", "type", "hostname", "organization"],
|
|
13583
13793
|
properties: {
|
|
13584
13794
|
id: {
|
|
13585
13795
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -13600,6 +13810,10 @@ var require_property = __commonJS({
|
|
|
13600
13810
|
hostname: {
|
|
13601
13811
|
type: "string"
|
|
13602
13812
|
},
|
|
13813
|
+
organization: {
|
|
13814
|
+
type: "string",
|
|
13815
|
+
description: "Reference to the organization that owns this property"
|
|
13816
|
+
},
|
|
13603
13817
|
address: {
|
|
13604
13818
|
type: "object",
|
|
13605
13819
|
properties: {
|
|
@@ -13755,9 +13969,9 @@ var require_property = __commonJS({
|
|
|
13755
13969
|
}
|
|
13756
13970
|
});
|
|
13757
13971
|
|
|
13758
|
-
// src/Models/
|
|
13972
|
+
// src/Models/property.js
|
|
13759
13973
|
var require_property2 = __commonJS({
|
|
13760
|
-
"src/Models/
|
|
13974
|
+
"src/Models/property.js"(exports, module) {
|
|
13761
13975
|
var schemas = require_schema();
|
|
13762
13976
|
var schema = require_property();
|
|
13763
13977
|
var Kohost = require_kohost();
|
|
@@ -13784,6 +13998,77 @@ var require_property2 = __commonJS({
|
|
|
13784
13998
|
}
|
|
13785
13999
|
});
|
|
13786
14000
|
|
|
14001
|
+
// src/schemas/organization.json
|
|
14002
|
+
var require_organization = __commonJS({
|
|
14003
|
+
"src/schemas/organization.json"(exports, module) {
|
|
14004
|
+
module.exports = {
|
|
14005
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
14006
|
+
$id: "https://api.kohost.app/schemas/v3/admin/organization.json",
|
|
14007
|
+
title: "Organization",
|
|
14008
|
+
type: "object",
|
|
14009
|
+
description: "An organization is a group or entity that subscribes to Kohost software.",
|
|
14010
|
+
required: ["accountNumber", "name"],
|
|
14011
|
+
properties: {
|
|
14012
|
+
id: {
|
|
14013
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
14014
|
+
},
|
|
14015
|
+
accountNumber: {
|
|
14016
|
+
type: "number",
|
|
14017
|
+
minimum: 1e4
|
|
14018
|
+
},
|
|
14019
|
+
name: {
|
|
14020
|
+
type: "string"
|
|
14021
|
+
},
|
|
14022
|
+
properties: {
|
|
14023
|
+
type: "array",
|
|
14024
|
+
items: {
|
|
14025
|
+
type: "string"
|
|
14026
|
+
}
|
|
14027
|
+
},
|
|
14028
|
+
credentials: {
|
|
14029
|
+
type: "object",
|
|
14030
|
+
additionalProperties: true
|
|
14031
|
+
},
|
|
14032
|
+
createdAt: {
|
|
14033
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
14034
|
+
},
|
|
14035
|
+
updatedAt: {
|
|
14036
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
14037
|
+
}
|
|
14038
|
+
}
|
|
14039
|
+
};
|
|
14040
|
+
}
|
|
14041
|
+
});
|
|
14042
|
+
|
|
14043
|
+
// src/Models/organization.js
|
|
14044
|
+
var require_organization2 = __commonJS({
|
|
14045
|
+
"src/Models/organization.js"(exports, module) {
|
|
14046
|
+
var schemas = require_schema();
|
|
14047
|
+
var schema = require_organization();
|
|
14048
|
+
var Kohost = require_kohost();
|
|
14049
|
+
schemas.add(schema);
|
|
14050
|
+
var validator = schemas.compile(schema);
|
|
14051
|
+
var Organization = class extends Kohost {
|
|
14052
|
+
constructor(data) {
|
|
14053
|
+
super(data);
|
|
14054
|
+
}
|
|
14055
|
+
};
|
|
14056
|
+
__name(Organization, "Organization");
|
|
14057
|
+
Object.defineProperty(Organization.prototype, "schema", {
|
|
14058
|
+
value: schema
|
|
14059
|
+
});
|
|
14060
|
+
Object.defineProperty(Organization.prototype, "validator", {
|
|
14061
|
+
get: function() {
|
|
14062
|
+
return validator;
|
|
14063
|
+
}
|
|
14064
|
+
});
|
|
14065
|
+
Object.defineProperty(Organization, "validProperties", {
|
|
14066
|
+
value: Object.keys(schema.properties)
|
|
14067
|
+
});
|
|
14068
|
+
module.exports = Organization;
|
|
14069
|
+
}
|
|
14070
|
+
});
|
|
14071
|
+
|
|
13787
14072
|
// src/Models/index.js
|
|
13788
14073
|
var require_Models = __commonJS({
|
|
13789
14074
|
"src/Models/index.js"(exports, module) {
|
|
@@ -13795,6 +14080,7 @@ var require_Models = __commonJS({
|
|
|
13795
14080
|
var WindowCovering = require_windowCovering2();
|
|
13796
14081
|
var Identification = require_identification2();
|
|
13797
14082
|
var User = require_user2();
|
|
14083
|
+
var SystemUser = require_systemUser2();
|
|
13798
14084
|
var Courtesy = require_courtesy2();
|
|
13799
14085
|
var Camera = require_camera2();
|
|
13800
14086
|
var MotionSensor = require_motionSensor2();
|
|
@@ -13803,6 +14089,7 @@ var require_Models = __commonJS({
|
|
|
13803
14089
|
var Reservation = require_reservation2();
|
|
13804
14090
|
var Application = require_application2();
|
|
13805
14091
|
var Space = require_space2();
|
|
14092
|
+
var SpaceType = require_spaceType2();
|
|
13806
14093
|
var Ticket = require_ticket2();
|
|
13807
14094
|
var Scene = require_scene2();
|
|
13808
14095
|
var Gateway = require_gateway2();
|
|
@@ -13810,13 +14097,11 @@ var require_Models = __commonJS({
|
|
|
13810
14097
|
var DiscoveredDevice = require_discoveredDevice2();
|
|
13811
14098
|
var Credential = require_credential2();
|
|
13812
14099
|
var ShortLink = require_shortLink2();
|
|
13813
|
-
var
|
|
13814
|
-
var
|
|
14100
|
+
var Property = require_property2();
|
|
14101
|
+
var Organization = require_organization2();
|
|
13815
14102
|
module.exports = {
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
Property: AdminProperty
|
|
13819
|
-
},
|
|
14103
|
+
Organization,
|
|
14104
|
+
Property,
|
|
13820
14105
|
Gateway,
|
|
13821
14106
|
Switch,
|
|
13822
14107
|
Alarm,
|
|
@@ -13831,9 +14116,11 @@ var require_Models = __commonJS({
|
|
|
13831
14116
|
Identification,
|
|
13832
14117
|
Product,
|
|
13833
14118
|
User,
|
|
14119
|
+
SystemUser,
|
|
13834
14120
|
Room,
|
|
13835
14121
|
Application,
|
|
13836
14122
|
Space,
|
|
14123
|
+
SpaceType,
|
|
13837
14124
|
Ticket,
|
|
13838
14125
|
Scene,
|
|
13839
14126
|
DiscoveredDevice,
|