@kohost/api-client 3.0.0-beta.4 → 3.0.0-beta.41

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.
Files changed (167) hide show
  1. package/README.md +71 -0
  2. package/dist/cjs/AMQPClient.js +425 -0
  3. package/dist/cjs/Client.js +1702 -1112
  4. package/dist/cjs/Commands.js +308 -93
  5. package/dist/cjs/Errors.js +24 -22
  6. package/dist/cjs/Events.js +225 -45
  7. package/dist/cjs/Models.js +1447 -555
  8. package/dist/cjs/SocketIoClient.js +66 -0
  9. package/dist/cjs/defs.js +37 -47
  10. package/dist/cjs/index.cjs.js +4 -0
  11. package/dist/cjs/utils.js +257 -15
  12. package/dist/esm/Client.js +1992 -1274
  13. package/dist/esm/Client.js.map +4 -4
  14. package/dist/esm/Commands.js +308 -93
  15. package/dist/esm/Commands.js.map +3 -3
  16. package/dist/esm/Errors.js +24 -22
  17. package/dist/esm/Errors.js.map +1 -1
  18. package/dist/esm/Events.js +225 -45
  19. package/dist/esm/Events.js.map +3 -3
  20. package/dist/esm/Models.js +2062 -551
  21. package/dist/esm/Models.js.map +4 -4
  22. package/dist/esm/SocketIoClient.js +4546 -0
  23. package/dist/esm/SocketIoClient.js.map +7 -0
  24. package/dist/esm/defs.js +394 -276
  25. package/dist/esm/defs.js.map +4 -4
  26. package/dist/esm/index.js +11 -10
  27. package/dist/esm/utils.js +640 -63
  28. package/dist/esm/utils.js.map +3 -3
  29. package/dist/useCases/AddDefaultScenesToRooms.js +2 -2
  30. package/dist/useCases/AddScenesToRoom.js +2 -2
  31. package/dist/useCases/AdminUpdateCustomer.js +32 -0
  32. package/dist/useCases/AssignSpaceToReservation.js +32 -0
  33. package/dist/useCases/BatchNotifyCheckIn.js +32 -0
  34. package/dist/useCases/BatchNotifyPreArrival.js +2 -2
  35. package/dist/useCases/CheckInReservation.js +2 -2
  36. package/dist/useCases/CheckVerificationCode.js +2 -2
  37. package/dist/useCases/CreateAlarm.js +2 -2
  38. package/dist/useCases/CreateCamera.js +2 -2
  39. package/dist/useCases/CreateCourtesy.js +2 -2
  40. package/dist/useCases/CreateDefaultScenes.js +2 -2
  41. package/dist/useCases/CreateDimmer.js +2 -2
  42. package/dist/useCases/CreateDiscoveredDevice.js +2 -2
  43. package/dist/useCases/CreateDiscoveredDeviceAssociation.js +2 -2
  44. package/dist/useCases/CreateImageUploadEndpoint.js +32 -0
  45. package/dist/useCases/CreateLock.js +2 -2
  46. package/dist/useCases/{CreateSource.js → CreateMediaSource.js} +3 -3
  47. package/dist/useCases/CreateOrganization.js +32 -0
  48. package/dist/useCases/{AdminCreateProperty.js → CreateProperty.js} +3 -3
  49. package/dist/useCases/CreateReservation.js +2 -2
  50. package/dist/useCases/CreateRoom.js +2 -2
  51. package/dist/useCases/CreateRoomInSpace.js +2 -2
  52. package/dist/useCases/CreateSpace.js +2 -2
  53. package/dist/useCases/{CreateIntegration.js → CreateSpaceType.js} +3 -3
  54. package/dist/useCases/CreateSwitch.js +2 -2
  55. package/dist/useCases/CreateThermostat.js +2 -2
  56. package/dist/useCases/CreateTicket.js +2 -2
  57. package/dist/useCases/CreateTicketMessage.js +2 -2
  58. package/dist/useCases/CreateUser.js +2 -2
  59. package/dist/useCases/CreateWindowCovering.js +2 -2
  60. package/dist/useCases/DeleteAlarm.js +2 -2
  61. package/dist/useCases/DeleteCamera.js +2 -2
  62. package/dist/useCases/DeleteCourtesy.js +2 -2
  63. package/dist/useCases/DeleteDimmer.js +2 -2
  64. package/dist/useCases/DeleteDiscoveredDevice.js +2 -2
  65. package/dist/useCases/DeleteLock.js +2 -2
  66. package/dist/useCases/DeleteMediaFile.js +32 -0
  67. package/dist/useCases/{DeleteSource.js → DeleteMediaSource.js} +3 -3
  68. package/dist/useCases/DeleteReservation.js +2 -2
  69. package/dist/useCases/DeleteRoom.js +2 -2
  70. package/dist/useCases/DeleteSpace.js +2 -2
  71. package/dist/useCases/DeleteSpaceType.js +32 -0
  72. package/dist/useCases/DeleteSwitch.js +2 -2
  73. package/dist/useCases/DeleteThermostat.js +2 -2
  74. package/dist/useCases/DeleteTicket.js +2 -2
  75. package/dist/useCases/DeleteUser.js +2 -2
  76. package/dist/useCases/DeleteWindowCovering.js +2 -2
  77. package/dist/useCases/DescribeAlarm.js +2 -2
  78. package/dist/useCases/DescribeCamera.js +2 -2
  79. package/dist/useCases/DescribeCourtesy.js +2 -2
  80. package/dist/useCases/DescribeDimmer.js +2 -2
  81. package/dist/useCases/DescribeDiscoveredDevice.js +2 -2
  82. package/dist/useCases/DescribeLock.js +2 -2
  83. package/dist/useCases/DescribeLockCredential.js +32 -0
  84. package/dist/useCases/{DescribeSource.js → DescribeMediaSource.js} +3 -3
  85. package/dist/useCases/DescribeMyAccessCredentials.js +32 -0
  86. package/dist/useCases/DescribeMyProperty.js +2 -2
  87. package/dist/useCases/DescribeOrganization.js +32 -0
  88. package/dist/useCases/{DescribeIntegration.js → DescribeProperty.js} +3 -3
  89. package/dist/useCases/DescribeReservation.js +2 -2
  90. package/dist/useCases/DescribeReservationCheckinStatus.js +2 -2
  91. package/dist/useCases/DescribeRoom.js +2 -2
  92. package/dist/useCases/DescribeSelf.js +2 -2
  93. package/dist/useCases/DescribeSpace.js +2 -2
  94. package/dist/useCases/{DeleteIntegration.js → DescribeSpaceType.js} +3 -3
  95. package/dist/useCases/DescribeSwitch.js +2 -2
  96. package/dist/useCases/DescribeThermostat.js +2 -2
  97. package/dist/useCases/DescribeTicket.js +2 -2
  98. package/dist/useCases/DescribeUser.js +2 -2
  99. package/dist/useCases/DescribeWindowCovering.js +2 -2
  100. package/dist/useCases/DiscoverReservations.js +2 -2
  101. package/dist/useCases/EmailUserAccountSetup.js +2 -2
  102. package/dist/useCases/ListAlarms.js +2 -2
  103. package/dist/useCases/ListCameras.js +2 -2
  104. package/dist/useCases/ListCourtesy.js +2 -2
  105. package/dist/useCases/ListDimmers.js +2 -2
  106. package/dist/useCases/ListDiscoveredDevices.js +2 -2
  107. package/dist/useCases/ListLocks.js +2 -2
  108. package/dist/useCases/{ListSources.js → ListMediaSources.js} +3 -3
  109. package/dist/useCases/ListMyReservations.js +2 -2
  110. package/dist/useCases/ListMySpaces.js +2 -2
  111. package/dist/useCases/ListMyTickets.js +32 -0
  112. package/dist/useCases/ListOrganizations.js +32 -0
  113. package/dist/useCases/{AdminListCustomers.js → ListProperties.js} +3 -3
  114. package/dist/useCases/ListReservations.js +2 -2
  115. package/dist/useCases/ListRooms.js +2 -2
  116. package/dist/useCases/ListRoomsInSpace.js +2 -2
  117. package/dist/useCases/{AdminListProperties.js → ListSpaceTypes.js} +3 -3
  118. package/dist/useCases/ListSpaces.js +2 -2
  119. package/dist/useCases/ListSwitches.js +2 -2
  120. package/dist/useCases/{ListIntegrations.js → ListTeam.js} +3 -3
  121. package/dist/useCases/ListThermostats.js +2 -2
  122. package/dist/useCases/ListTickets.js +2 -2
  123. package/dist/useCases/ListUserReservations.js +2 -2
  124. package/dist/useCases/{AdminDescribeProperty.js → ListUserSpaces.js} +3 -3
  125. package/dist/useCases/ListUsers.js +2 -2
  126. package/dist/useCases/ListWindowCoverings.js +2 -2
  127. package/dist/useCases/LoginUser.js +2 -2
  128. package/dist/useCases/{CreateIntegrationDeviceMapEntry.js → LogoutUser.js} +3 -3
  129. package/dist/useCases/MatchUserIdentification.js +2 -2
  130. package/dist/useCases/OCRDocument.js +2 -2
  131. package/dist/useCases/RefreshToken.js +2 -2
  132. package/dist/useCases/RequestLoginLink.js +3 -3
  133. package/dist/useCases/RequestMyKeyToken.js +32 -0
  134. package/dist/useCases/SendCheckInSMS.js +32 -0
  135. package/dist/useCases/SendPreArrivalEmail.js +2 -2
  136. package/dist/useCases/SendPreArrivalSMS.js +2 -2
  137. package/dist/useCases/SendVerificationCode.js +2 -2
  138. package/dist/useCases/SetCamera.js +2 -2
  139. package/dist/useCases/SetCourtesy.js +2 -2
  140. package/dist/useCases/{SetSource.js → SetDimmer.js} +3 -3
  141. package/dist/useCases/SetLock.js +2 -2
  142. package/dist/useCases/SetMediaSource.js +32 -0
  143. package/dist/useCases/SetSwitch.js +2 -2
  144. package/dist/useCases/SetThermostat.js +2 -2
  145. package/dist/useCases/SetWindowCovering.js +2 -2
  146. package/dist/useCases/UpdateAlarm.js +2 -2
  147. package/dist/useCases/UpdateCamera.js +2 -2
  148. package/dist/useCases/UpdateCourtesy.js +2 -2
  149. package/dist/useCases/UpdateDimmer.js +2 -2
  150. package/dist/useCases/UpdateDiscoveredDevice.js +2 -2
  151. package/dist/useCases/UpdateLock.js +2 -2
  152. package/dist/useCases/{UpdateSource.js → UpdateMediaSource.js} +3 -3
  153. package/dist/useCases/UpdateMessageReadStatus.js +2 -2
  154. package/dist/useCases/{AdminUpdateProperty.js → UpdateProperty.js} +3 -3
  155. package/dist/useCases/UpdateReservation.js +2 -2
  156. package/dist/useCases/UpdateRoom.js +2 -2
  157. package/dist/useCases/UpdateSelf.js +2 -2
  158. package/dist/useCases/UpdateSpace.js +2 -2
  159. package/dist/useCases/{UpdateIntegration.js → UpdateSpaceType.js} +3 -3
  160. package/dist/useCases/UpdateSwitch.js +2 -2
  161. package/dist/useCases/UpdateThermostat.js +2 -2
  162. package/dist/useCases/UpdateTicket.js +2 -2
  163. package/dist/useCases/UpdateTicketStatus.js +2 -2
  164. package/dist/useCases/UpdateUser.js +2 -2
  165. package/dist/useCases/UpdateWindowCovering.js +2 -2
  166. package/dist/useCases/UpsertDiscoveredDevice.js +2 -2
  167. package/package.json +14 -3
@@ -1,4 +1,6 @@
1
+ var __defProp = Object.defineProperty;
1
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
4
  var __commonJS = (cb, mod) => function __require() {
3
5
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
6
  };
@@ -8,10 +10,13 @@ var require_common = __commonJS({
8
10
  "src/schemas/definitions/common.json"(exports2, module2) {
9
11
  module2.exports = {
10
12
  $schema: "http://json-schema.org/draft-07/schema",
11
- $id: "https://api.kohost.app/schemas/v3/definitions/common.json",
13
+ $id: "https://api.kohost.io/schemas/v3/definitions/common.json",
12
14
  definitions: {
13
15
  id: {
14
- type: "string"
16
+ type: "string",
17
+ not: {
18
+ enum: ["global", "system"]
19
+ }
15
20
  },
16
21
  systemData: {
17
22
  type: "object",
@@ -21,6 +26,10 @@ var require_common = __commonJS({
21
26
  type: "object",
22
27
  default: {}
23
28
  },
29
+ date: {
30
+ type: ["string", "object"],
31
+ format: "date-time"
32
+ },
24
33
  createdAt: {
25
34
  type: ["string", "object"],
26
35
  format: "date-time"
@@ -77,6 +86,30 @@ var require_common = __commonJS({
77
86
  maxLength: 2
78
87
  }
79
88
  }
89
+ },
90
+ driver: {
91
+ type: "string",
92
+ enum: [
93
+ "aws-kinesis",
94
+ "butler",
95
+ "crestron",
96
+ "ecobee",
97
+ "igor",
98
+ "inncom",
99
+ "kohost-k7",
100
+ "kohost-pms",
101
+ "lg",
102
+ "lirc",
103
+ "mews",
104
+ "pelican-wireless",
105
+ "rebrandly",
106
+ "salto",
107
+ "salto-irn",
108
+ "se",
109
+ "sendgrid",
110
+ "stay-n-touch",
111
+ "twilio"
112
+ ]
80
113
  }
81
114
  }
82
115
  };
@@ -88,17 +121,18 @@ var require_device = __commonJS({
88
121
  "src/schemas/definitions/device.json"(exports2, module2) {
89
122
  module2.exports = {
90
123
  $schema: "http://json-schema.org/draft-07/schema",
91
- $id: "https://api.kohost.app/schemas/v3/definitions/device.json",
124
+ $id: "https://api.kohost.io/schemas/v3/definitions/device.json",
92
125
  definitions: {
93
126
  id: {
94
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
127
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
95
128
  },
96
129
  systemData: {
97
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
130
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
98
131
  },
99
132
  type: {
100
133
  type: "string",
101
134
  enum: [
135
+ "alarm",
102
136
  "dimmer",
103
137
  "switch",
104
138
  "motionSensor",
@@ -108,8 +142,13 @@ var require_device = __commonJS({
108
142
  "thermostat",
109
143
  "lock",
110
144
  "courtesy",
111
- "sceneController",
112
- "gateway"
145
+ "gateway",
146
+ "tv",
147
+ "dvr",
148
+ "appleTv",
149
+ "discPlayer",
150
+ "mediaPlayer",
151
+ "uncontrolledDevice"
113
152
  ]
114
153
  },
115
154
  name: {
@@ -138,7 +177,11 @@ var require_device = __commonJS({
138
177
  "softwareFailure",
139
178
  "hardwareFailureWithCode",
140
179
  "softwareFailureWithCode",
141
- "motionDetection"
180
+ "motionDetection",
181
+ "airFilterNeedsCleaned",
182
+ "smokeDetected",
183
+ "outsideSafeTemperatureRange",
184
+ "outsideSafeHumidityRange"
142
185
  ]
143
186
  }
144
187
  },
@@ -152,6 +195,9 @@ var require_device = __commonJS({
152
195
  timestamp: {
153
196
  type: "number",
154
197
  minimum: 1655907956593
198
+ },
199
+ description: {
200
+ type: "string"
155
201
  }
156
202
  }
157
203
  },
@@ -159,6 +205,10 @@ var require_device = __commonJS({
159
205
  type: "number",
160
206
  minimum: 0,
161
207
  maximum: 100
208
+ },
209
+ watts: {
210
+ type: "number",
211
+ minimum: 0
162
212
  }
163
213
  }
164
214
  };
@@ -184,12 +234,12 @@ var require_schema = __commonJS({
184
234
  ajv.addSchema(commonDefs);
185
235
  ajv.addSchema(deviceDefs);
186
236
  module2.exports = {
187
- add: function add(schema) {
237
+ add: /* @__PURE__ */ __name(function add(schema) {
188
238
  ajv.addSchema(schema);
189
- },
190
- compile: function compile(schema) {
239
+ }, "add"),
240
+ compile: /* @__PURE__ */ __name(function compile(schema) {
191
241
  return ajv.compile(schema);
192
- }
242
+ }, "compile")
193
243
  };
194
244
  }
195
245
  });
@@ -199,36 +249,45 @@ var require_switch = __commonJS({
199
249
  "src/schemas/switch.json"(exports2, module2) {
200
250
  module2.exports = {
201
251
  $schema: "http://json-schema.org/draft-07/schema",
202
- $id: "https://api.kohost.app/schemas/v3/switch.json",
252
+ $id: "https://api.kohost.io/schemas/v3/switch.json",
203
253
  title: "Switch",
204
254
  description: "Any smart switch",
205
255
  type: "object",
206
256
  properties: {
207
257
  id: {
208
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
258
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
259
+ },
260
+ name: {
261
+ type: "string"
209
262
  },
210
263
  type: {
211
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
264
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
212
265
  },
213
266
  subType: {
214
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
267
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
215
268
  },
216
269
  supportedNotifications: {
217
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
270
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
218
271
  },
219
272
  notification: {
220
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
273
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
274
+ },
275
+ driver: {
276
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
221
277
  },
222
278
  state: {
223
279
  type: "string",
224
280
  enum: ["on", "off"]
225
281
  },
226
282
  systemData: {
227
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
283
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
284
+ },
285
+ watts: {
286
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
228
287
  }
229
288
  },
230
289
  additionalProperties: false,
231
- required: ["id", "type", "systemData", "state"]
290
+ required: ["id", "type", "systemData", "state", "driver"]
232
291
  };
233
292
  }
234
293
  });
@@ -236,14 +295,14 @@ var require_switch = __commonJS({
236
295
  // src/Errors/AppError.js
237
296
  var require_AppError = __commonJS({
238
297
  "src/Errors/AppError.js"(exports2, module2) {
239
- module2.exports = class AppError extends Error {
298
+ module2.exports = /* @__PURE__ */ __name(class AppError extends Error {
240
299
  constructor(message = "Internal Server Error", options) {
241
300
  super(message, options);
242
301
  this.type = this.constructor.name;
243
302
  this.statusCode = 500;
244
303
  Object.setPrototypeOf(this, AppError.prototype);
245
304
  }
246
- };
305
+ }, "AppError");
247
306
  }
248
307
  });
249
308
 
@@ -251,13 +310,13 @@ var require_AppError = __commonJS({
251
310
  var require_AuthenticationError = __commonJS({
252
311
  "src/Errors/AuthenticationError.js"(exports2, module2) {
253
312
  var AppError = require_AppError();
254
- module2.exports = class AuthenticationError extends AppError {
313
+ module2.exports = /* @__PURE__ */ __name(class AuthenticationError extends AppError {
255
314
  constructor(message = "Authentication Error", options = {}) {
256
315
  super(message, options);
257
316
  this.statusCode = 401;
258
317
  Object.setPrototypeOf(this, AuthenticationError.prototype);
259
318
  }
260
- };
319
+ }, "AuthenticationError");
261
320
  }
262
321
  });
263
322
 
@@ -265,13 +324,13 @@ var require_AuthenticationError = __commonJS({
265
324
  var require_AuthorizationError = __commonJS({
266
325
  "src/Errors/AuthorizationError.js"(exports2, module2) {
267
326
  var AppError = require_AppError();
268
- module2.exports = class AuthorizationError extends AppError {
327
+ module2.exports = /* @__PURE__ */ __name(class AuthorizationError extends AppError {
269
328
  constructor(message = "Authorization Error", options = {}) {
270
329
  super(message, options);
271
330
  this.statusCode = 403;
272
331
  Object.setPrototypeOf(this, AuthorizationError.prototype);
273
332
  }
274
- };
333
+ }, "AuthorizationError");
275
334
  }
276
335
  });
277
336
 
@@ -279,13 +338,13 @@ var require_AuthorizationError = __commonJS({
279
338
  var require_DeviceCommError = __commonJS({
280
339
  "src/Errors/DeviceCommError.js"(exports2, module2) {
281
340
  var AppError = require_AppError();
282
- module2.exports = class DeviceCommError extends AppError {
341
+ module2.exports = /* @__PURE__ */ __name(class DeviceCommError extends AppError {
283
342
  constructor(message = "Device Communication Error", options = {}) {
284
343
  super(message, options);
285
344
  this.statusCode = 503;
286
345
  Object.setPrototypeOf(this, DeviceCommError.prototype);
287
346
  }
288
- };
347
+ }, "DeviceCommError");
289
348
  }
290
349
  });
291
350
 
@@ -293,13 +352,13 @@ var require_DeviceCommError = __commonJS({
293
352
  var require_LoginError = __commonJS({
294
353
  "src/Errors/LoginError.js"(exports2, module2) {
295
354
  var AppError = require_AppError();
296
- module2.exports = class LoginError extends AppError {
355
+ module2.exports = /* @__PURE__ */ __name(class LoginError extends AppError {
297
356
  constructor(message = "Invalid Login information provided", options = {}) {
298
357
  super(message, options);
299
358
  this.statusCode = 401;
300
359
  Object.setPrototypeOf(this, LoginError.prototype);
301
360
  }
302
- };
361
+ }, "LoginError");
303
362
  }
304
363
  });
305
364
 
@@ -307,13 +366,13 @@ var require_LoginError = __commonJS({
307
366
  var require_NotFoundError = __commonJS({
308
367
  "src/Errors/NotFoundError.js"(exports2, module2) {
309
368
  var AppError = require_AppError();
310
- module2.exports = class NotFoundError extends AppError {
369
+ module2.exports = /* @__PURE__ */ __name(class NotFoundError extends AppError {
311
370
  constructor(message = "Resource Not Found", options = {}) {
312
371
  super(message, options);
313
372
  this.statusCode = 404;
314
373
  Object.setPrototypeOf(this, NotFoundError.prototype);
315
374
  }
316
- };
375
+ }, "NotFoundError");
317
376
  }
318
377
  });
319
378
 
@@ -321,13 +380,13 @@ var require_NotFoundError = __commonJS({
321
380
  var require_RequestError = __commonJS({
322
381
  "src/Errors/RequestError.js"(exports2, module2) {
323
382
  var AppError = require_AppError();
324
- module2.exports = class RequestError extends AppError {
383
+ module2.exports = /* @__PURE__ */ __name(class RequestError extends AppError {
325
384
  constructor(message = "Bad Request", options = {}) {
326
385
  super(message, options);
327
386
  this.statusCode = 400;
328
387
  Object.setPrototypeOf(this, RequestError.prototype);
329
388
  }
330
- };
389
+ }, "RequestError");
331
390
  }
332
391
  });
333
392
 
@@ -335,13 +394,13 @@ var require_RequestError = __commonJS({
335
394
  var require_SystemCommError = __commonJS({
336
395
  "src/Errors/SystemCommError.js"(exports2, module2) {
337
396
  var AppError = require_AppError();
338
- module2.exports = class SystemCommError extends AppError {
397
+ module2.exports = /* @__PURE__ */ __name(class SystemCommError extends AppError {
339
398
  constructor(message = "System Communication Error", options = {}) {
340
399
  super(message, options);
341
400
  this.statusCode = 503;
342
401
  Object.setPrototypeOf(this, SystemCommError.prototype);
343
402
  }
344
- };
403
+ }, "SystemCommError");
345
404
  }
346
405
  });
347
406
 
@@ -349,13 +408,13 @@ var require_SystemCommError = __commonJS({
349
408
  var require_TokenExpiredError = __commonJS({
350
409
  "src/Errors/TokenExpiredError.js"(exports2, module2) {
351
410
  var AppError = require_AppError();
352
- module2.exports = class TokenExpiredError extends AppError {
411
+ module2.exports = /* @__PURE__ */ __name(class TokenExpiredError extends AppError {
353
412
  constructor(message = "Token Expired", options = {}) {
354
413
  super(message, options);
355
414
  this.statusCode = 401;
356
415
  Object.setPrototypeOf(this, TokenExpiredError.prototype);
357
416
  }
358
- };
417
+ }, "TokenExpiredError");
359
418
  }
360
419
  });
361
420
 
@@ -363,13 +422,13 @@ var require_TokenExpiredError = __commonJS({
363
422
  var require_UnprocessableRequestError = __commonJS({
364
423
  "src/Errors/UnprocessableRequestError.js"(exports2, module2) {
365
424
  var AppError = require_AppError();
366
- module2.exports = class UnprocessableRequestError extends AppError {
425
+ module2.exports = /* @__PURE__ */ __name(class UnprocessableRequestError extends AppError {
367
426
  constructor(message = "Unprocessable Request Error", options = {}) {
368
427
  super(message, options);
369
428
  this.statusCode = 422;
370
429
  Object.setPrototypeOf(this, UnprocessableRequestError.prototype);
371
430
  }
372
- };
431
+ }, "UnprocessableRequestError");
373
432
  }
374
433
  });
375
434
 
@@ -377,13 +436,13 @@ var require_UnprocessableRequestError = __commonJS({
377
436
  var require_ValidationError = __commonJS({
378
437
  "src/Errors/ValidationError.js"(exports2, module2) {
379
438
  var AppError = require_AppError();
380
- module2.exports = class ValidationError extends AppError {
439
+ module2.exports = /* @__PURE__ */ __name(class ValidationError extends AppError {
381
440
  constructor(message = "Validation Error", options = {}) {
382
441
  super(message, options);
383
442
  this.statusCode = 400;
384
443
  Object.setPrototypeOf(this, ValidationError.prototype);
385
444
  }
386
- };
445
+ }, "ValidationError");
387
446
  }
388
447
  });
389
448
 
@@ -420,7 +479,7 @@ var require_kohost = __commonJS({
420
479
  if (!this.validator) {
421
480
  throw new Error("Validator is not defined");
422
481
  }
423
- const isNew = (data == null ? void 0 : data.id) ? false : true;
482
+ const isNew = data?.id ? false : true;
424
483
  this._setId(data);
425
484
  this._validate(data);
426
485
  this._setProperties(data);
@@ -447,7 +506,7 @@ var require_kohost = __commonJS({
447
506
  });
448
507
  }
449
508
  _setTimestamps(isNew) {
450
- const now = new Date();
509
+ const now = /* @__PURE__ */ new Date();
451
510
  if (isNew && this.schemaProperties.includes("createdAt") && !this.createdAt) {
452
511
  this.createdAt = now;
453
512
  }
@@ -467,10 +526,9 @@ var require_kohost = __commonJS({
467
526
  return id;
468
527
  }
469
528
  static getActionDelta(old, _new) {
470
- var _a;
471
529
  const delta = {};
472
530
  for (const action in _new) {
473
- if ((_a = this.actionProperties) == null ? void 0 : _a.includes(action)) {
531
+ if (this.actionProperties?.includes(action)) {
474
532
  if (old[action] !== _new[action]) {
475
533
  delta[action] = 1;
476
534
  }
@@ -488,6 +546,7 @@ var require_kohost = __commonJS({
488
546
  return obj;
489
547
  }
490
548
  };
549
+ __name(Kohost, "Kohost");
491
550
  module2.exports = Kohost;
492
551
  }
493
552
  });
@@ -505,6 +564,7 @@ var require_switch2 = __commonJS({
505
564
  super(data);
506
565
  }
507
566
  };
567
+ __name(Switch2, "Switch");
508
568
  Object.defineProperty(Switch2.prototype, "schema", {
509
569
  value: schema
510
570
  });
@@ -528,25 +588,31 @@ var require_alarm = __commonJS({
528
588
  "src/schemas/alarm.json"(exports2, module2) {
529
589
  module2.exports = {
530
590
  $schema: "http://json-schema.org/draft-07/schema",
531
- $id: "https://api.kohost.app/schemas/v3/alarm.json",
591
+ $id: "https://api.kohost.io/schemas/v3/alarm.json",
532
592
  title: "Alarm",
533
593
  description: "Any smart alarm system",
534
594
  type: "object",
535
595
  properties: {
536
596
  id: {
537
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
597
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
598
+ },
599
+ name: {
600
+ type: "string"
538
601
  },
539
602
  type: {
540
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
603
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
541
604
  },
542
605
  systemData: {
543
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
606
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
544
607
  },
545
608
  supportedNotifications: {
546
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
609
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
547
610
  },
548
611
  notification: {
549
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
612
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
613
+ },
614
+ driver: {
615
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
550
616
  },
551
617
  areas: {
552
618
  type: "array",
@@ -606,6 +672,9 @@ var require_alarm = __commonJS({
606
672
  items: {
607
673
  $ref: "#/properties/supportedTroubles/items"
608
674
  }
675
+ },
676
+ watts: {
677
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
609
678
  }
610
679
  },
611
680
  additionalProperties: false,
@@ -616,7 +685,8 @@ var require_alarm = __commonJS({
616
685
  "areas",
617
686
  "zones",
618
687
  "supportedTroubles",
619
- "troubles"
688
+ "troubles",
689
+ "driver"
620
690
  ]
621
691
  };
622
692
  }
@@ -635,6 +705,7 @@ var require_alarm2 = __commonJS({
635
705
  super(data);
636
706
  }
637
707
  };
708
+ __name(Alarm2, "Alarm");
638
709
  Object.defineProperty(Alarm2.prototype, "schema", {
639
710
  value: schema
640
711
  });
@@ -655,25 +726,31 @@ var require_dimmer = __commonJS({
655
726
  "src/schemas/dimmer.json"(exports2, module2) {
656
727
  module2.exports = {
657
728
  $schema: "http://json-schema.org/draft-07/schema",
658
- $id: "https://api.kohost.app/schemas/v3/dimmer.json",
729
+ $id: "https://api.kohost.io/schemas/v3/dimmer.json",
659
730
  title: "Dimmer",
660
731
  description: "Any smart dimmer",
661
732
  type: "object",
662
733
  properties: {
663
734
  id: {
664
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
735
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
736
+ },
737
+ name: {
738
+ type: "string"
665
739
  },
666
740
  type: {
667
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
741
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
668
742
  },
669
743
  subType: {
670
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
744
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
671
745
  },
672
746
  supportedNotifications: {
673
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
747
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
674
748
  },
675
749
  notification: {
676
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
750
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
751
+ },
752
+ driver: {
753
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
677
754
  },
678
755
  level: {
679
756
  type: "number",
@@ -681,11 +758,14 @@ var require_dimmer = __commonJS({
681
758
  maximum: 100
682
759
  },
683
760
  systemData: {
684
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
761
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
762
+ },
763
+ watts: {
764
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
685
765
  }
686
766
  },
687
767
  additionalProperties: false,
688
- required: ["id", "type", "systemData", "level"]
768
+ required: ["id", "type", "systemData", "level", "driver"]
689
769
  };
690
770
  }
691
771
  });
@@ -703,10 +783,9 @@ var require_dimmer2 = __commonJS({
703
783
  super(data);
704
784
  }
705
785
  static getActionDelta(old, _new) {
706
- var _a;
707
786
  const delta = {};
708
787
  for (const action in _new) {
709
- if ((_a = this.actionProperties) == null ? void 0 : _a.includes(action)) {
788
+ if (this.actionProperties?.includes(action)) {
710
789
  if (action === "level") {
711
790
  const oldLevel = old[action];
712
791
  const newLevel = _new[action];
@@ -719,6 +798,7 @@ var require_dimmer2 = __commonJS({
719
798
  return delta;
720
799
  }
721
800
  };
801
+ __name(Dimmer2, "Dimmer");
722
802
  Object.defineProperty(Dimmer2.prototype, "schema", {
723
803
  value: schema
724
804
  });
@@ -742,39 +822,45 @@ var require_lock = __commonJS({
742
822
  "src/schemas/lock.json"(exports2, module2) {
743
823
  module2.exports = {
744
824
  $schema: "http://json-schema.org/draft-07/schema",
745
- $id: "https://api.kohost.app/schemas/v3/lock.json",
825
+ $id: "https://api.kohost.io/schemas/v3/lock.json",
746
826
  title: "Lock",
747
827
  description: "Any smart lock",
748
828
  type: "object",
749
829
  properties: {
750
830
  id: {
751
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
831
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
752
832
  },
753
833
  name: {
754
834
  type: "string"
755
835
  },
756
836
  type: {
757
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
758
- },
759
- subType: {
760
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
837
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
761
838
  },
762
839
  supportedNotifications: {
763
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
840
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
764
841
  },
765
842
  notification: {
766
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
843
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
844
+ },
845
+ driver: {
846
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
767
847
  },
768
848
  state: {
769
- type: "string",
770
- enum: ["locked", "unlocked"]
849
+ type: ["string", "null"],
850
+ enum: ["locked", "unlocked", null]
851
+ },
852
+ batteryLevel: {
853
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/batteryLevel"
771
854
  },
772
855
  systemData: {
773
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
856
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
857
+ },
858
+ watts: {
859
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
774
860
  }
775
861
  },
776
862
  additionalProperties: false,
777
- required: ["id", "type", "systemData", "state"]
863
+ required: ["id", "type", "systemData", "state", "driver"]
778
864
  };
779
865
  }
780
866
  });
@@ -792,6 +878,7 @@ var require_lock2 = __commonJS({
792
878
  super(data);
793
879
  }
794
880
  };
881
+ __name(Lock2, "Lock");
795
882
  Object.defineProperty(Lock2.prototype, "schema", {
796
883
  value: schema
797
884
  });
@@ -815,29 +902,32 @@ var require_thermostat = __commonJS({
815
902
  "src/schemas/thermostat.json"(exports2, module2) {
816
903
  module2.exports = {
817
904
  $schema: "http://json-schema.org/draft-07/schema",
818
- $id: "https://api.kohost.app/schemas/v3/thermostat.json",
905
+ $id: "https://api.kohost.io/schemas/v3/thermostat.json",
819
906
  title: "Thermostat",
820
907
  description: "Any smart thermostat",
821
908
  type: "object",
822
909
  properties: {
823
910
  id: {
824
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
911
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
825
912
  },
826
913
  name: {
827
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/name"
914
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/name"
828
915
  },
829
916
  type: {
830
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type",
917
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type",
831
918
  default: "thermostat"
832
919
  },
833
- subType: {
834
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
920
+ driver: {
921
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
922
+ },
923
+ offline: {
924
+ type: "boolean"
835
925
  },
836
926
  supportedNotifications: {
837
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
927
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
838
928
  },
839
929
  notification: {
840
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
930
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
841
931
  },
842
932
  currentTemperature: {
843
933
  type: "number"
@@ -852,16 +942,16 @@ var require_thermostat = __commonJS({
852
942
  $ref: "#/properties/supportedHvacModes/items"
853
943
  },
854
944
  hvacState: {
855
- type: "string",
856
- enum: ["cooling", "heating", "off"]
945
+ type: ["string", "null"],
946
+ enum: ["cooling", "heating", "off", null]
857
947
  },
858
948
  fanMode: {
859
949
  type: "string",
860
950
  $ref: "#/properties/supportedFanModes/items"
861
951
  },
862
952
  fanState: {
863
- type: "string",
864
- enum: ["off", "low", "medium", "high"]
953
+ type: ["string", "null"],
954
+ enum: ["off", "low", "medium", "high", "on", null]
865
955
  },
866
956
  temperatureScale: {
867
957
  type: "string",
@@ -884,7 +974,7 @@ var require_thermostat = __commonJS({
884
974
  type: "array",
885
975
  uniqueItems: true,
886
976
  items: {
887
- enum: ["auto", "low", "medium", "high", "off"]
977
+ enum: ["auto", "low", "medium", "high", "off", "on"]
888
978
  }
889
979
  },
890
980
  setpoints: {
@@ -902,12 +992,22 @@ var require_thermostat = __commonJS({
902
992
  }
903
993
  }
904
994
  },
995
+ minAutoDelta: {
996
+ type: "number",
997
+ default: 3
998
+ },
999
+ cycleRate: {
1000
+ type: "number"
1001
+ },
905
1002
  batteryLevel: {
906
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/batteryLevel"
1003
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/batteryLevel"
907
1004
  },
908
1005
  systemData: {
909
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData",
1006
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData",
910
1007
  default: {}
1008
+ },
1009
+ watts: {
1010
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
911
1011
  }
912
1012
  },
913
1013
  additionalProperties: false,
@@ -949,7 +1049,8 @@ var require_thermostat = __commonJS({
949
1049
  "setpoints",
950
1050
  "temperatureScale",
951
1051
  "supportedHvacModes",
952
- "supportedFanModes"
1052
+ "supportedFanModes",
1053
+ "driver"
953
1054
  ]
954
1055
  };
955
1056
  }
@@ -1009,6 +1110,7 @@ var require_thermostat2 = __commonJS({
1009
1110
  return delta;
1010
1111
  }
1011
1112
  };
1113
+ __name(Thermostat2, "Thermostat");
1012
1114
  Object.defineProperty(Thermostat2.prototype, "schema", {
1013
1115
  value: schema
1014
1116
  });
@@ -1032,25 +1134,31 @@ var require_windowCovering = __commonJS({
1032
1134
  "src/schemas/windowCovering.json"(exports2, module2) {
1033
1135
  module2.exports = {
1034
1136
  $schema: "http://json-schema.org/draft-07/schema",
1035
- $id: "https://api.kohost.app/schemas/v3/windowCovering.json",
1137
+ $id: "https://api.kohost.io/schemas/v3/windowCovering.json",
1036
1138
  title: "Window Covering",
1037
1139
  description: "Any smart window covering",
1038
1140
  type: "object",
1039
1141
  properties: {
1040
1142
  id: {
1041
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
1143
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
1144
+ },
1145
+ name: {
1146
+ type: "string"
1042
1147
  },
1043
1148
  type: {
1044
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
1149
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
1045
1150
  },
1046
1151
  subType: {
1047
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
1152
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
1048
1153
  },
1049
1154
  supportedNotifications: {
1050
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1155
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1051
1156
  },
1052
1157
  notification: {
1053
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
1158
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
1159
+ },
1160
+ driver: {
1161
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
1054
1162
  },
1055
1163
  position: {
1056
1164
  type: "number",
@@ -1058,11 +1166,14 @@ var require_windowCovering = __commonJS({
1058
1166
  maximum: 100
1059
1167
  },
1060
1168
  systemData: {
1061
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
1169
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
1170
+ },
1171
+ watts: {
1172
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
1062
1173
  }
1063
1174
  },
1064
1175
  additionalProperties: false,
1065
- required: ["id", "type", "systemData", "position"]
1176
+ required: ["id", "type", "systemData", "position", "driver"]
1066
1177
  };
1067
1178
  }
1068
1179
  });
@@ -1080,10 +1191,9 @@ var require_windowCovering2 = __commonJS({
1080
1191
  super(data);
1081
1192
  }
1082
1193
  static getActionDelta(old, _new) {
1083
- var _a;
1084
1194
  const delta = {};
1085
1195
  for (const action in _new) {
1086
- if ((_a = this.actionProperties) == null ? void 0 : _a.includes(action)) {
1196
+ if (this.actionProperties?.includes(action)) {
1087
1197
  if (action === "position") {
1088
1198
  const oldPos = old[action];
1089
1199
  const newPos = _new[action];
@@ -1096,6 +1206,7 @@ var require_windowCovering2 = __commonJS({
1096
1206
  return delta;
1097
1207
  }
1098
1208
  };
1209
+ __name(WindowCovering2, "WindowCovering");
1099
1210
  Object.defineProperty(WindowCovering2.prototype, "schema", {
1100
1211
  value: schema
1101
1212
  });
@@ -1119,13 +1230,13 @@ var require_identification = __commonJS({
1119
1230
  "src/schemas/identification.json"(exports2, module2) {
1120
1231
  module2.exports = {
1121
1232
  $schema: "http://json-schema.org/draft-07/schema",
1122
- $id: "https://api.kohost.app/schemas/v3/identification.json",
1233
+ $id: "https://api.kohost.io/schemas/v3/identification.json",
1123
1234
  title: "Identification",
1124
1235
  type: "object",
1125
- required: ["type", "number", "expires"],
1236
+ required: ["type", "number"],
1126
1237
  properties: {
1127
1238
  id: {
1128
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
1239
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
1129
1240
  },
1130
1241
  type: {
1131
1242
  type: "string",
@@ -1139,16 +1250,14 @@ var require_identification = __commonJS({
1139
1250
  format: "date-time"
1140
1251
  },
1141
1252
  expires: {
1142
- type: ["string", "object"],
1253
+ type: ["string", "object", "null"],
1143
1254
  format: "date-time"
1144
1255
  },
1145
1256
  verified: {
1146
- type: "boolean",
1147
- default: false
1257
+ type: "boolean"
1148
1258
  },
1149
1259
  matched: {
1150
- type: "boolean",
1151
- default: false
1260
+ type: "boolean"
1152
1261
  },
1153
1262
  firstName: {
1154
1263
  type: "string"
@@ -1162,7 +1271,7 @@ var require_identification = __commonJS({
1162
1271
  maxLength: 2
1163
1272
  },
1164
1273
  systemData: {
1165
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
1274
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
1166
1275
  }
1167
1276
  }
1168
1277
  };
@@ -1182,9 +1291,10 @@ var require_identification2 = __commonJS({
1182
1291
  super(data);
1183
1292
  }
1184
1293
  get isExpired() {
1185
- return new Date(this.expirationDate) < new Date();
1294
+ return new Date(this.expirationDate) < /* @__PURE__ */ new Date();
1186
1295
  }
1187
1296
  };
1297
+ __name(Identification2, "Identification");
1188
1298
  Object.defineProperty(Identification2.prototype, "schema", {
1189
1299
  value: schema
1190
1300
  });
@@ -1205,22 +1315,18 @@ var require_user = __commonJS({
1205
1315
  "src/schemas/user.json"(exports2, module2) {
1206
1316
  module2.exports = {
1207
1317
  $schema: "http://json-schema.org/draft-07/schema",
1208
- $id: "https://api.kohost.app/schemas/v3/user.json",
1318
+ $id: "https://api.kohost.io/schemas/v3/user.json",
1209
1319
  title: "User",
1210
1320
  type: "object",
1211
- required: ["active", "lastName", "roles"],
1321
+ required: ["firstName", "lastName"],
1212
1322
  properties: {
1213
1323
  id: {
1214
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
1324
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
1215
1325
  },
1216
1326
  type: {
1217
1327
  type: "string",
1218
1328
  default: "user"
1219
1329
  },
1220
- active: {
1221
- type: "boolean",
1222
- default: true
1223
- },
1224
1330
  firstName: {
1225
1331
  type: "string"
1226
1332
  },
@@ -1242,7 +1348,7 @@ var require_user = __commonJS({
1242
1348
  type: "boolean"
1243
1349
  },
1244
1350
  address: {
1245
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/address"
1351
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/address"
1246
1352
  },
1247
1353
  secretKey: {
1248
1354
  type: "string"
@@ -1265,63 +1371,56 @@ var require_user = __commonJS({
1265
1371
  minLength: 2,
1266
1372
  maxLength: 2
1267
1373
  },
1268
- notes: {
1374
+ permissions: {
1269
1375
  type: "array",
1376
+ default: [],
1270
1377
  items: {
1271
- type: "string"
1378
+ type: "object",
1379
+ required: ["organization", "property", "role"],
1380
+ properties: {
1381
+ organization: {
1382
+ type: "string",
1383
+ description: "The ID of the organization the permission is applies to."
1384
+ },
1385
+ property: {
1386
+ type: "string",
1387
+ description: "The ID of the property the permission is applies to."
1388
+ },
1389
+ role: {
1390
+ type: "string",
1391
+ enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
1392
+ },
1393
+ customPermissions: {
1394
+ type: "array",
1395
+ items: {
1396
+ type: "string"
1397
+ }
1398
+ }
1399
+ }
1272
1400
  }
1273
1401
  },
1274
- files: {
1402
+ notes: {
1275
1403
  type: "array",
1276
1404
  items: {
1277
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
1405
+ type: "string"
1278
1406
  }
1279
1407
  },
1280
- roles: {
1408
+ files: {
1281
1409
  type: "array",
1282
1410
  items: {
1283
- type: "string",
1284
- enum: [
1285
- "Guest",
1286
- "Staff",
1287
- "Faculty",
1288
- "Student",
1289
- "Visitor",
1290
- "Manager",
1291
- "Administrator",
1292
- "SuperAdmin"
1293
- ]
1411
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
1294
1412
  }
1295
1413
  },
1296
1414
  identifications: {
1297
1415
  type: "array",
1298
1416
  items: {
1299
- $ref: "https://api.kohost.app/schemas/v3/identification.json#"
1417
+ $ref: "https://api.kohost.io/schemas/v3/identification.json#"
1300
1418
  }
1301
1419
  },
1302
1420
  payments: {
1303
1421
  type: "array",
1304
1422
  items: {
1305
- $ref: "https://api.kohost.app/schemas/v3/payment.json#"
1306
- }
1307
- },
1308
- preferences: {
1309
- type: "object",
1310
- additionalProperties: false,
1311
- properties: {
1312
- notifications: {
1313
- type: "array",
1314
- items: {
1315
- type: "string"
1316
- },
1317
- examples: [["roomControl", "marketing"]]
1318
- },
1319
- location: {
1320
- title: "The location Schema",
1321
- type: "boolean",
1322
- default: false,
1323
- examples: [true]
1324
- }
1423
+ $ref: "https://api.kohost.io/schemas/v3/payment.json#"
1325
1424
  }
1326
1425
  },
1327
1426
  location: {
@@ -1343,39 +1442,17 @@ var require_user = __commonJS({
1343
1442
  }
1344
1443
  }
1345
1444
  },
1346
- registeredDevices: {
1347
- type: "array",
1348
- items: {
1349
- type: "object",
1350
- properties: {
1351
- userAgent: {
1352
- type: "string"
1353
- },
1354
- fingerPrint: {
1355
- type: "string"
1356
- },
1357
- ip: {
1358
- type: "string"
1359
- },
1360
- registeredAt: {
1361
- type: "string",
1362
- format: "date-time"
1363
- },
1364
- expiresAt: {
1365
- type: "string",
1366
- format: "date-time"
1367
- }
1368
- }
1369
- }
1370
- },
1371
1445
  createdAt: {
1372
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
1446
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
1373
1447
  },
1374
1448
  updatedAt: {
1375
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
1449
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
1376
1450
  },
1377
1451
  systemData: {
1378
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
1452
+ type: "array",
1453
+ items: {
1454
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
1455
+ }
1379
1456
  }
1380
1457
  }
1381
1458
  };
@@ -1387,13 +1464,13 @@ var require_payment = __commonJS({
1387
1464
  "src/schemas/payment.json"(exports2, module2) {
1388
1465
  module2.exports = {
1389
1466
  $schema: "http://json-schema.org/draft-07/schema",
1390
- $id: "https://api.kohost.app/schemas/v3/payment.json",
1467
+ $id: "https://api.kohost.io/schemas/v3/payment.json",
1391
1468
  title: "Payment",
1392
1469
  type: "object",
1393
1470
  required: ["type", "maskedNumber", "expires"],
1394
1471
  properties: {
1395
1472
  id: {
1396
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
1473
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
1397
1474
  },
1398
1475
  type: {
1399
1476
  type: "string",
@@ -1411,6 +1488,9 @@ var require_payment = __commonJS({
1411
1488
  "vpay"
1412
1489
  ]
1413
1490
  },
1491
+ storageData: {
1492
+ type: ["string", "null"]
1493
+ },
1414
1494
  maskedNumber: {
1415
1495
  string: "string"
1416
1496
  },
@@ -1421,7 +1501,7 @@ var require_payment = __commonJS({
1421
1501
  string: "string"
1422
1502
  },
1423
1503
  systemData: {
1424
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
1504
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
1425
1505
  }
1426
1506
  }
1427
1507
  };
@@ -1455,6 +1535,7 @@ var require_user2 = __commonJS({
1455
1535
  return await nanoid(len);
1456
1536
  }
1457
1537
  };
1538
+ __name(User2, "User");
1458
1539
  Object.defineProperty(User2.prototype, "schema", {
1459
1540
  value: schema
1460
1541
  });
@@ -1471,105 +1552,275 @@ var require_user2 = __commonJS({
1471
1552
  return `${this.firstName} ${this.lastName}`;
1472
1553
  }
1473
1554
  });
1555
+ Object.defineProperty(User2.prototype, "roles", {
1556
+ get: function() {
1557
+ const roles = /* @__PURE__ */ new Set();
1558
+ if (this.permissions) {
1559
+ for (const permission of this.permissions) {
1560
+ roles.add(permission.role);
1561
+ }
1562
+ }
1563
+ return Array.from(roles);
1564
+ }
1565
+ });
1474
1566
  module2.exports = User2;
1475
1567
  }
1476
1568
  });
1477
1569
 
1478
- // src/schemas/courtesy.json
1479
- var require_courtesy = __commonJS({
1480
- "src/schemas/courtesy.json"(exports2, module2) {
1570
+ // src/schemas/systemUser.json
1571
+ var require_systemUser = __commonJS({
1572
+ "src/schemas/systemUser.json"(exports2, module2) {
1481
1573
  module2.exports = {
1482
1574
  $schema: "http://json-schema.org/draft-07/schema",
1483
- $id: "https://api.kohost.app/schemas/v3/courtesy.json",
1484
- title: "Courtesy",
1485
- description: "Any smart courtesy system",
1575
+ $id: "https://api.kohost.io/schemas/v3/systemUser.json",
1576
+ title: "System User",
1577
+ description: "A system user is a user that originated from an external 3rd party system.",
1486
1578
  type: "object",
1579
+ required: ["firstName", "lastName"],
1487
1580
  properties: {
1488
1581
  id: {
1489
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
1582
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
1490
1583
  },
1491
1584
  type: {
1492
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
1585
+ type: "string",
1586
+ default: "systemUser"
1493
1587
  },
1494
- supportedNotifications: {
1495
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1588
+ driver: {
1589
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
1496
1590
  },
1497
- notification: {
1498
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
1591
+ firstName: {
1592
+ type: "string"
1499
1593
  },
1500
- supportedStates: {
1594
+ lastName: {
1595
+ type: "string"
1596
+ },
1597
+ phone: {
1598
+ type: ["string", "null"],
1599
+ pattern: "^\\+[0-9]{1,14}$"
1600
+ },
1601
+ email: {
1602
+ type: ["string", "null"],
1603
+ format: "email"
1604
+ },
1605
+ address: {
1606
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/address"
1607
+ },
1608
+ photo: {
1609
+ type: "string"
1610
+ },
1611
+ jobTitle: {
1612
+ type: "string"
1613
+ },
1614
+ dob: {
1615
+ type: "string"
1616
+ },
1617
+ gender: {
1618
+ type: "string",
1619
+ enum: ["male", "female"]
1620
+ },
1621
+ roles: {
1501
1622
  type: "array",
1502
- uniqueItems: true,
1503
1623
  items: {
1504
- enum: ["privacy", "service", "none"]
1624
+ type: "string",
1625
+ enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
1505
1626
  }
1506
1627
  },
1507
- state: {
1628
+ nationality: {
1508
1629
  type: "string",
1509
- $ref: "#/properties/supportedStates/items"
1630
+ minLength: 2,
1631
+ maxLength: 2
1632
+ },
1633
+ notes: {
1634
+ type: "array",
1635
+ items: {
1636
+ type: "string"
1637
+ }
1638
+ },
1639
+ files: {
1640
+ type: "array",
1641
+ items: {
1642
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
1643
+ }
1644
+ },
1645
+ identifications: {
1646
+ type: "array",
1647
+ items: {
1648
+ $ref: "https://api.kohost.io/schemas/v3/identification.json#"
1649
+ }
1650
+ },
1651
+ payments: {
1652
+ type: "array",
1653
+ items: {
1654
+ $ref: "https://api.kohost.io/schemas/v3/payment.json#"
1655
+ }
1656
+ },
1657
+ createdAt: {
1658
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
1659
+ },
1660
+ updatedAt: {
1661
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
1510
1662
  },
1511
1663
  systemData: {
1512
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
1664
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
1513
1665
  }
1514
- },
1515
- additionalProperties: false,
1516
- required: ["supportedStates", "state"]
1666
+ }
1517
1667
  };
1518
1668
  }
1519
1669
  });
1520
1670
 
1521
- // src/Models/courtesy.js
1522
- var require_courtesy2 = __commonJS({
1523
- "src/Models/courtesy.js"(exports2, module2) {
1671
+ // src/Models/systemUser.js
1672
+ var require_systemUser2 = __commonJS({
1673
+ "src/Models/systemUser.js"(exports2, module2) {
1524
1674
  var schemas = require_schema();
1525
- var schema = require_courtesy();
1675
+ var schema = require_systemUser();
1526
1676
  var Kohost = require_kohost();
1527
1677
  schemas.add(schema);
1528
1678
  var validator = schemas.compile(schema);
1529
- var Courtesy2 = class extends Kohost {
1679
+ var SystemUser2 = class extends Kohost {
1530
1680
  constructor(data) {
1531
1681
  super(data);
1532
1682
  }
1683
+ static validatePhone(phoneNumber) {
1684
+ const regex = /^\+?[1-9]\d{1,14}$/;
1685
+ return regex.test(phoneNumber);
1686
+ }
1687
+ static validateEmail(email) {
1688
+ 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,}))$/;
1689
+ return regex.test(email);
1690
+ }
1533
1691
  };
1534
- Object.defineProperty(Courtesy2.prototype, "schema", {
1692
+ __name(SystemUser2, "SystemUser");
1693
+ Object.defineProperty(SystemUser2.prototype, "schema", {
1535
1694
  value: schema
1536
1695
  });
1537
- Object.defineProperty(Courtesy2.prototype, "validator", {
1696
+ Object.defineProperty(SystemUser2.prototype, "validator", {
1538
1697
  get: function() {
1539
1698
  return validator;
1540
1699
  }
1541
1700
  });
1542
- Object.defineProperty(Courtesy2, "validProperties", {
1701
+ Object.defineProperty(SystemUser2, "validProperties", {
1543
1702
  value: Object.keys(schema.properties)
1544
1703
  });
1545
- Object.defineProperty(Courtesy2, "actionProperties", {
1546
- value: ["state"]
1704
+ Object.defineProperty(SystemUser2.prototype, "fullName", {
1705
+ get: function() {
1706
+ return `${this.firstName} ${this.lastName}`;
1707
+ }
1547
1708
  });
1548
- module2.exports = Courtesy2;
1709
+ module2.exports = SystemUser2;
1549
1710
  }
1550
1711
  });
1551
1712
 
1552
- // src/schemas/camera.json
1553
- var require_camera = __commonJS({
1713
+ // src/schemas/courtesy.json
1714
+ var require_courtesy = __commonJS({
1715
+ "src/schemas/courtesy.json"(exports2, module2) {
1716
+ module2.exports = {
1717
+ $schema: "http://json-schema.org/draft-07/schema",
1718
+ $id: "https://api.kohost.io/schemas/v3/courtesy.json",
1719
+ title: "Courtesy",
1720
+ description: "Any smart courtesy system",
1721
+ type: "object",
1722
+ properties: {
1723
+ id: {
1724
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
1725
+ },
1726
+ name: {
1727
+ type: "string"
1728
+ },
1729
+ type: {
1730
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
1731
+ },
1732
+ supportedNotifications: {
1733
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1734
+ },
1735
+ notification: {
1736
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
1737
+ },
1738
+ driver: {
1739
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
1740
+ },
1741
+ supportedStates: {
1742
+ type: "array",
1743
+ uniqueItems: true,
1744
+ items: {
1745
+ enum: ["privacy", "service", "none"]
1746
+ }
1747
+ },
1748
+ state: {
1749
+ type: "string",
1750
+ $ref: "#/properties/supportedStates/items"
1751
+ },
1752
+ systemData: {
1753
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
1754
+ },
1755
+ watts: {
1756
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
1757
+ }
1758
+ },
1759
+ additionalProperties: false,
1760
+ required: ["id", "type", "driver", "supportedStates", "state"]
1761
+ };
1762
+ }
1763
+ });
1764
+
1765
+ // src/Models/courtesy.js
1766
+ var require_courtesy2 = __commonJS({
1767
+ "src/Models/courtesy.js"(exports2, module2) {
1768
+ var schemas = require_schema();
1769
+ var schema = require_courtesy();
1770
+ var Kohost = require_kohost();
1771
+ schemas.add(schema);
1772
+ var validator = schemas.compile(schema);
1773
+ var Courtesy2 = class extends Kohost {
1774
+ constructor(data) {
1775
+ super(data);
1776
+ }
1777
+ };
1778
+ __name(Courtesy2, "Courtesy");
1779
+ Object.defineProperty(Courtesy2.prototype, "schema", {
1780
+ value: schema
1781
+ });
1782
+ Object.defineProperty(Courtesy2.prototype, "validator", {
1783
+ get: function() {
1784
+ return validator;
1785
+ }
1786
+ });
1787
+ Object.defineProperty(Courtesy2, "validProperties", {
1788
+ value: Object.keys(schema.properties)
1789
+ });
1790
+ Object.defineProperty(Courtesy2, "actionProperties", {
1791
+ value: ["state"]
1792
+ });
1793
+ module2.exports = Courtesy2;
1794
+ }
1795
+ });
1796
+
1797
+ // src/schemas/camera.json
1798
+ var require_camera = __commonJS({
1554
1799
  "src/schemas/camera.json"(exports2, module2) {
1555
1800
  module2.exports = {
1556
1801
  $schema: "http://json-schema.org/draft-07/schema",
1557
- $id: "https://api.kohost.app/schemas/v3/camera.json",
1802
+ $id: "https://api.kohost.io/schemas/v3/camera.json",
1558
1803
  title: "Camera",
1559
1804
  description: "Any smart camera",
1560
1805
  type: "object",
1561
1806
  properties: {
1562
1807
  id: {
1563
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
1808
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
1809
+ },
1810
+ name: {
1811
+ type: "string"
1564
1812
  },
1565
1813
  type: {
1566
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
1814
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
1567
1815
  },
1568
1816
  supportedNotifications: {
1569
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1817
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1570
1818
  },
1571
1819
  notification: {
1572
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
1820
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
1821
+ },
1822
+ driver: {
1823
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
1573
1824
  },
1574
1825
  streams: {
1575
1826
  type: "object",
@@ -1587,11 +1838,14 @@ var require_camera = __commonJS({
1587
1838
  }
1588
1839
  },
1589
1840
  systemData: {
1590
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
1841
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
1842
+ },
1843
+ watts: {
1844
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
1591
1845
  }
1592
1846
  },
1593
1847
  additionalProperties: false,
1594
- required: ["id", "type", "systemData", "streams"]
1848
+ required: ["id", "type", "systemData", "streams", "driver"]
1595
1849
  };
1596
1850
  }
1597
1851
  });
@@ -1609,6 +1863,7 @@ var require_camera2 = __commonJS({
1609
1863
  super(data);
1610
1864
  }
1611
1865
  };
1866
+ __name(Camera2, "Camera");
1612
1867
  Object.defineProperty(Camera2.prototype, "schema", {
1613
1868
  value: schema
1614
1869
  });
@@ -1629,29 +1884,35 @@ var require_motionSensor = __commonJS({
1629
1884
  "src/schemas/motionSensor.json"(exports2, module2) {
1630
1885
  module2.exports = {
1631
1886
  $schema: "http://json-schema.org/draft-07/schema",
1632
- $id: "https://api.kohost.app/schemas/v3/motionSensor.json",
1887
+ $id: "https://api.kohost.io/schemas/v3/motionSensor.json",
1633
1888
  title: "Motion Sensor",
1634
1889
  description: "Any smart motion sensor",
1635
1890
  type: "object",
1636
1891
  properties: {
1637
1892
  id: {
1638
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
1893
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
1639
1894
  },
1640
1895
  type: {
1641
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
1896
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
1897
+ },
1898
+ driver: {
1899
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
1642
1900
  },
1643
1901
  systemData: {
1644
- supportedNotifications: {
1645
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1646
- },
1647
- notification: {
1648
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
1649
- },
1650
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
1902
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
1903
+ },
1904
+ supportedNotifications: {
1905
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1906
+ },
1907
+ notification: {
1908
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
1909
+ },
1910
+ watts: {
1911
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
1651
1912
  }
1652
1913
  },
1653
1914
  additionalProperties: false,
1654
- required: ["id", "type", "systemData"]
1915
+ required: ["id", "type", "systemData", "driver"]
1655
1916
  };
1656
1917
  }
1657
1918
  });
@@ -1669,6 +1930,7 @@ var require_motionSensor2 = __commonJS({
1669
1930
  super(data);
1670
1931
  }
1671
1932
  };
1933
+ __name(MotionSensor2, "MotionSensor");
1672
1934
  Object.defineProperty(MotionSensor2.prototype, "schema", {
1673
1935
  value: schema
1674
1936
  });
@@ -1689,18 +1951,16 @@ var require_mediaSource = __commonJS({
1689
1951
  "src/schemas/mediaSource.json"(exports2, module2) {
1690
1952
  module2.exports = {
1691
1953
  $schema: "http://json-schema.org/draft-07/schema",
1692
- $id: "https://api.kohost.app/schemas/v3/mediaSource.json",
1954
+ $id: "https://api.kohost.io/schemas/v3/mediaSource.json",
1693
1955
  title: "Media Source",
1694
1956
  description: "Any media source",
1695
1957
  type: "object",
1958
+ required: ["id", "type", "systemData", "audio", "video", "driver"],
1696
1959
  properties: {
1697
1960
  id: {
1698
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
1961
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
1699
1962
  },
1700
1963
  type: {
1701
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
1702
- },
1703
- subType: {
1704
1964
  type: "string",
1705
1965
  enum: [
1706
1966
  "tv",
@@ -1711,6 +1971,9 @@ var require_mediaSource = __commonJS({
1711
1971
  "uncontrolledDevice"
1712
1972
  ]
1713
1973
  },
1974
+ driver: {
1975
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
1976
+ },
1714
1977
  audio: {
1715
1978
  type: "boolean"
1716
1979
  },
@@ -1723,6 +1986,27 @@ var require_mediaSource = __commonJS({
1723
1986
  volumeFeedback: {
1724
1987
  type: "boolean"
1725
1988
  },
1989
+ muted: {
1990
+ type: "boolean"
1991
+ },
1992
+ volume: {
1993
+ type: "number",
1994
+ minimum: 0,
1995
+ maximum: 100
1996
+ },
1997
+ power: {
1998
+ type: "string",
1999
+ enum: ["on", "off"]
2000
+ },
2001
+ input: {
2002
+ type: "string"
2003
+ },
2004
+ supportedInputs: {
2005
+ type: "array",
2006
+ items: {
2007
+ type: "string"
2008
+ }
2009
+ },
1726
2010
  command: {
1727
2011
  type: ["string", "null"],
1728
2012
  enum: [
@@ -1766,6 +2050,7 @@ var require_mediaSource = __commonJS({
1766
2050
  "input",
1767
2051
  "power",
1768
2052
  "enterChannel",
2053
+ "enterVolume",
1769
2054
  "number10",
1770
2055
  "number11",
1771
2056
  "number12",
@@ -1822,21 +2107,28 @@ var require_mediaSource = __commonJS({
1822
2107
  "hdmi2",
1823
2108
  "hdmi3",
1824
2109
  "cecDeviceList",
1825
- "mtsSap"
2110
+ "mtsSap",
2111
+ "red",
2112
+ "green",
2113
+ "yellow",
2114
+ "blue",
2115
+ "alert"
1826
2116
  ]
1827
2117
  },
1828
2118
  supportedNotifications: {
1829
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
2119
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
1830
2120
  },
1831
2121
  notification: {
1832
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
2122
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
1833
2123
  },
1834
2124
  systemData: {
1835
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
2125
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
2126
+ },
2127
+ watts: {
2128
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
1836
2129
  }
1837
2130
  },
1838
- additionalProperties: false,
1839
- required: ["id", "type", "systemData", "audio", "video"]
2131
+ additionalProperties: false
1840
2132
  };
1841
2133
  }
1842
2134
  });
@@ -1854,6 +2146,7 @@ var require_mediaSource2 = __commonJS({
1854
2146
  super(data);
1855
2147
  }
1856
2148
  };
2149
+ __name(MediaSource2, "MediaSource");
1857
2150
  Object.defineProperty(MediaSource2.prototype, "schema", {
1858
2151
  value: schema
1859
2152
  });
@@ -1874,13 +2167,13 @@ var require_room = __commonJS({
1874
2167
  "src/schemas/room.json"(exports2, module2) {
1875
2168
  module2.exports = {
1876
2169
  $schema: "http://json-schema.org/draft-07/schema",
1877
- $id: "https://api.kohost.app/schemas/v3/room.json",
2170
+ $id: "https://api.kohost.io/schemas/v3/room.json",
1878
2171
  title: "Room",
1879
2172
  description: "A room represents a physical space of controllable IoT devices",
1880
2173
  type: "object",
1881
2174
  properties: {
1882
2175
  id: {
1883
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2176
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
1884
2177
  },
1885
2178
  name: {
1886
2179
  type: "string"
@@ -1892,88 +2185,70 @@ var require_room = __commonJS({
1892
2185
  type: "array",
1893
2186
  default: [],
1894
2187
  items: {
1895
- $ref: "https://api.kohost.app/schemas/v3/dimmer.json"
2188
+ $ref: "https://api.kohost.io/schemas/v3/dimmer.json"
1896
2189
  }
1897
2190
  },
1898
2191
  switches: {
1899
2192
  type: "array",
1900
2193
  default: [],
1901
2194
  items: {
1902
- $ref: "https://api.kohost.app/schemas/v3/switch.json"
2195
+ $ref: "https://api.kohost.io/schemas/v3/switch.json"
1903
2196
  }
1904
2197
  },
1905
2198
  thermostats: {
1906
2199
  type: "array",
1907
2200
  default: [],
1908
2201
  items: {
1909
- $ref: "https://api.kohost.app/schemas/v3/thermostat.json"
2202
+ $ref: "https://api.kohost.io/schemas/v3/thermostat.json"
1910
2203
  }
1911
2204
  },
1912
2205
  locks: {
1913
2206
  type: "array",
1914
2207
  default: [],
1915
2208
  items: {
1916
- $ref: "https://api.kohost.app/schemas/v3/lock.json"
2209
+ $ref: "https://api.kohost.io/schemas/v3/lock.json"
1917
2210
  }
1918
2211
  },
1919
2212
  windowCoverings: {
1920
2213
  type: "array",
1921
2214
  default: [],
1922
2215
  items: {
1923
- $ref: "https://api.kohost.app/schemas/v3/windowCovering.json"
2216
+ $ref: "https://api.kohost.io/schemas/v3/windowCovering.json"
1924
2217
  }
1925
2218
  },
1926
2219
  courtesy: {
1927
2220
  type: "array",
1928
2221
  default: [],
1929
2222
  items: {
1930
- $ref: "https://api.kohost.app/schemas/v3/courtesy.json"
2223
+ $ref: "https://api.kohost.io/schemas/v3/courtesy.json"
1931
2224
  }
1932
2225
  },
1933
2226
  cameras: {
1934
2227
  type: "array",
1935
2228
  default: [],
1936
2229
  items: {
1937
- $ref: "https://api.kohost.app/schemas/v3/camera.json"
2230
+ $ref: "https://api.kohost.io/schemas/v3/camera.json"
1938
2231
  }
1939
2232
  },
1940
- sources: {
2233
+ mediaSources: {
1941
2234
  type: "array",
1942
2235
  default: [],
1943
2236
  items: {
1944
- $ref: "https://api.kohost.app/schemas/v3/mediaSource.json"
2237
+ $ref: "https://api.kohost.io/schemas/v3/mediaSource.json"
1945
2238
  }
1946
2239
  },
1947
2240
  motionSensors: {
1948
2241
  type: "array",
1949
2242
  default: [],
1950
2243
  items: {
1951
- $ref: "https://api.kohost.app/schemas/v3/motionSensor.json"
2244
+ $ref: "https://api.kohost.io/schemas/v3/motionSensor.json"
1952
2245
  }
1953
2246
  },
1954
2247
  alarms: {
1955
2248
  type: "array",
1956
2249
  default: [],
1957
2250
  items: {
1958
- $ref: "https://api.kohost.app/schemas/v3/alarm.json"
1959
- }
1960
- },
1961
- media: {
1962
- type: "object",
1963
- additionalProperties: false,
1964
- default: {
1965
- volume: 0,
1966
- currentSource: null
1967
- },
1968
- properties: {
1969
- volume: {
1970
- type: "number",
1971
- minimum: 0,
1972
- maximum: 100
1973
- },
1974
- currentSource: {
1975
- type: ["string", "null"]
1976
- }
2251
+ $ref: "https://api.kohost.io/schemas/v3/alarm.json"
1977
2252
  }
1978
2253
  },
1979
2254
  scenes: {
@@ -1983,22 +2258,22 @@ var require_room = __commonJS({
1983
2258
  description: "A list of scene IDs for later population, or entire scene objects",
1984
2259
  oneOf: [
1985
2260
  {
1986
- $ref: "https://api.kohost.app/schemas/v3/scene.json"
2261
+ $ref: "https://api.kohost.io/schemas/v3/scene.json"
1987
2262
  },
1988
2263
  {
1989
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2264
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
1990
2265
  }
1991
2266
  ]
1992
2267
  }
1993
2268
  },
1994
2269
  occupiedAt: {
1995
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
2270
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
1996
2271
  },
1997
2272
  createdAt: {
1998
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
2273
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
1999
2274
  },
2000
2275
  updatedAt: {
2001
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
2276
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
2002
2277
  }
2003
2278
  },
2004
2279
  additionalProperties: false
@@ -2011,13 +2286,13 @@ var require_scene = __commonJS({
2011
2286
  "src/schemas/scene.json"(exports2, module2) {
2012
2287
  module2.exports = {
2013
2288
  $schema: "http://json-schema.org/draft-07/schema",
2014
- $id: "https://api.kohost.app/schemas/v3/scene.json",
2289
+ $id: "https://api.kohost.io/schemas/v3/scene.json",
2015
2290
  title: "Scene",
2016
2291
  description: "A room represents a physical space of controllable IoT devices",
2017
2292
  type: "object",
2018
2293
  properties: {
2019
2294
  id: {
2020
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2295
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2021
2296
  },
2022
2297
  name: {
2023
2298
  type: "string"
@@ -2031,10 +2306,10 @@ var require_scene = __commonJS({
2031
2306
  type: "object",
2032
2307
  properties: {
2033
2308
  id: {
2034
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2309
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2035
2310
  },
2036
2311
  state: {
2037
- $ref: "https://api.kohost.app/schemas/v3/switch.json#/properties/state"
2312
+ $ref: "https://api.kohost.io/schemas/v3/switch.json#/properties/state"
2038
2313
  }
2039
2314
  },
2040
2315
  default: []
@@ -2046,10 +2321,10 @@ var require_scene = __commonJS({
2046
2321
  type: "object",
2047
2322
  properties: {
2048
2323
  id: {
2049
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2324
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2050
2325
  },
2051
2326
  level: {
2052
- $ref: "https://api.kohost.app/schemas/v3/dimmer.json#/properties/level"
2327
+ $ref: "https://api.kohost.io/schemas/v3/dimmer.json#/properties/level"
2053
2328
  }
2054
2329
  }
2055
2330
  },
@@ -2061,10 +2336,10 @@ var require_scene = __commonJS({
2061
2336
  type: "object",
2062
2337
  properties: {
2063
2338
  id: {
2064
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2339
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2065
2340
  },
2066
2341
  position: {
2067
- $ref: "https://api.kohost.app/schemas/v3/windowCovering.json#/properties/position"
2342
+ $ref: "https://api.kohost.io/schemas/v3/windowCovering.json#/properties/position"
2068
2343
  }
2069
2344
  }
2070
2345
  },
@@ -2076,16 +2351,16 @@ var require_scene = __commonJS({
2076
2351
  type: "object",
2077
2352
  properties: {
2078
2353
  id: {
2079
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2354
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2080
2355
  },
2081
2356
  hvacMode: {
2082
- $ref: "https://api.kohost.app/schemas/v3/thermostat.json#/properties/hvacMode"
2357
+ $ref: "https://api.kohost.io/schemas/v3/thermostat.json#/properties/hvacMode"
2083
2358
  },
2084
2359
  setpoints: {
2085
- $ref: "https://api.kohost.app/schemas/v3/thermostat.json#/properties/setpoints"
2360
+ $ref: "https://api.kohost.io/schemas/v3/thermostat.json#/properties/setpoints"
2086
2361
  },
2087
2362
  fanMode: {
2088
- $ref: "https://api.kohost.app/schemas/v3/thermostat.json#/properties/fanMode"
2363
+ $ref: "https://api.kohost.io/schemas/v3/thermostat.json#/properties/fanMode"
2089
2364
  }
2090
2365
  }
2091
2366
  },
@@ -2097,7 +2372,7 @@ var require_scene = __commonJS({
2097
2372
  type: "object",
2098
2373
  properties: {
2099
2374
  id: {
2100
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2375
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2101
2376
  },
2102
2377
  volume: {
2103
2378
  type: "number",
@@ -2143,6 +2418,7 @@ var require_scene2 = __commonJS({
2143
2418
  super(data);
2144
2419
  }
2145
2420
  };
2421
+ __name(Scene2, "Scene");
2146
2422
  Object.defineProperty(Scene2.prototype, "schema", {
2147
2423
  value: schema
2148
2424
  });
@@ -2163,6 +2439,7 @@ var require_room2 = __commonJS({
2163
2439
  "src/Models/room.js"(exports2, module2) {
2164
2440
  var schemas = require_schema();
2165
2441
  var schema = require_room();
2442
+ var deviceSchema = require_device();
2166
2443
  var Kohost = require_kohost();
2167
2444
  var cloneDeep = require("lodash.clonedeep");
2168
2445
  var Switch2 = require_switch2();
@@ -2173,7 +2450,7 @@ var require_room2 = __commonJS({
2173
2450
  var Courtesy2 = require_courtesy2();
2174
2451
  var Camera2 = require_camera2();
2175
2452
  var Alarm2 = require_alarm2();
2176
- var Source = require_mediaSource2();
2453
+ var MediaSource2 = require_mediaSource2();
2177
2454
  var MotionSensor2 = require_motionSensor2();
2178
2455
  var Scene2 = require_scene2();
2179
2456
  schemas.add(schema);
@@ -2184,21 +2461,18 @@ var require_room2 = __commonJS({
2184
2461
  super(roomData);
2185
2462
  }
2186
2463
  static getDevicePath(type) {
2187
- const validTypes = [
2188
- "dimmer",
2189
- "switch",
2190
- "thermostat",
2191
- "lock",
2192
- "windowCovering",
2193
- "courtesy",
2194
- "camera",
2195
- "source",
2196
- "motionSensor",
2197
- "alarm"
2198
- ];
2464
+ const validTypes = deviceSchema.definitions.type.enum;
2199
2465
  if (!validTypes.includes(type))
2200
2466
  throw new Error("Invalid device type:" + type);
2201
2467
  switch (type) {
2468
+ case "tv":
2469
+ case "dvr":
2470
+ case "appleTv":
2471
+ case "discPlayer":
2472
+ case "mediaPlayer":
2473
+ case "uncontrolledDevice":
2474
+ case "mediaSource":
2475
+ return "mediaSources";
2202
2476
  case "courtesy":
2203
2477
  return type;
2204
2478
  case "switch":
@@ -2207,49 +2481,77 @@ var require_room2 = __commonJS({
2207
2481
  return `${type}s`;
2208
2482
  }
2209
2483
  }
2484
+ static getDeviceTypeFromPath(path) {
2485
+ const validPaths = [
2486
+ "dimmers",
2487
+ "switches",
2488
+ "thermostats",
2489
+ "locks",
2490
+ "windowCoverings",
2491
+ "courtesy",
2492
+ "cameras",
2493
+ "mediaSources",
2494
+ "motionSensors",
2495
+ "alarms"
2496
+ ];
2497
+ if (!validPaths.includes(path))
2498
+ throw new Error("Invalid device path:" + path);
2499
+ switch (path) {
2500
+ case "courtesy":
2501
+ return path;
2502
+ case "switches":
2503
+ return "switch";
2504
+ default:
2505
+ return path.slice(0, -1);
2506
+ }
2507
+ }
2210
2508
  get hasDimmer() {
2211
- var _a;
2212
- return ((_a = this.dimmers) == null ? void 0 : _a.length) > 0;
2509
+ return this.dimmers?.length > 0;
2213
2510
  }
2214
2511
  get hasSwitch() {
2215
- var _a;
2216
- return ((_a = this.switches) == null ? void 0 : _a.length) > 0;
2512
+ return this.switches?.length > 0;
2217
2513
  }
2218
2514
  get hasWindowCovering() {
2219
- var _a;
2220
- return ((_a = this.windowCoverings) == null ? void 0 : _a.length) > 0;
2515
+ return this.windowCoverings?.length > 0;
2516
+ }
2517
+ get hasShade() {
2518
+ return this.hasWindowCovering;
2221
2519
  }
2222
2520
  get hasThermostat() {
2223
- var _a;
2224
- return ((_a = this.thermostats) == null ? void 0 : _a.length) > 0;
2521
+ return this.thermostats?.length > 0;
2522
+ }
2523
+ get hasClimate() {
2524
+ return this.hasThermostat;
2225
2525
  }
2226
2526
  get hasLock() {
2227
- var _a;
2228
- return ((_a = this.locks) == null ? void 0 : _a.length) > 0;
2527
+ return this.locks?.length > 0;
2229
2528
  }
2230
2529
  get hasCourtesy() {
2231
- var _a;
2232
- return ((_a = this.courtesy) == null ? void 0 : _a.length) > 0;
2530
+ return this.courtesy?.length > 0;
2233
2531
  }
2234
2532
  get hasCamera() {
2235
- var _a;
2236
- return ((_a = this.cameras) == null ? void 0 : _a.length) > 0;
2533
+ return this.cameras?.length > 0;
2237
2534
  }
2238
2535
  get hasAlarm() {
2239
- var _a;
2240
- return ((_a = this.alarms) == null ? void 0 : _a.length) > 0;
2536
+ return this.alarms?.length > 0;
2241
2537
  }
2242
2538
  get hasMedia() {
2243
- var _a;
2244
- return ((_a = this.sources) == null ? void 0 : _a.length) > 0;
2539
+ return this.mediaSources?.length > 0;
2540
+ }
2541
+ get hasLight() {
2542
+ const hasSubTypeLight = this.switches?.some((sw) => {
2543
+ return sw.subType === "light" || sw.subType === "fan";
2544
+ });
2545
+ return this.hasDimmer || hasSubTypeLight;
2245
2546
  }
2246
2547
  get occupied() {
2247
- const now = new Date();
2548
+ const now = /* @__PURE__ */ new Date();
2248
2549
  const lastOccupied = new Date(this.occupiedAt);
2249
2550
  const diff = now - lastOccupied;
2250
2551
  return diff < 60 * 60 * 1e3;
2251
2552
  }
2252
2553
  };
2554
+ __name(Room2, "Room");
2253
2555
  Object.defineProperty(Room2.prototype, "schema", {
2254
2556
  value: schema
2255
2557
  });
@@ -2262,69 +2564,68 @@ var require_room2 = __commonJS({
2262
2564
  value: Object.keys(schema.properties)
2263
2565
  });
2264
2566
  function mapRoomData(data) {
2265
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2266
2567
  const roomData = cloneDeep(data);
2267
- (_a = roomData.dimmers) == null ? void 0 : _a.map((dimmer) => {
2568
+ roomData.dimmers?.map((dimmer) => {
2268
2569
  if (dimmer instanceof Dimmer2)
2269
2570
  return dimmer;
2270
2571
  else
2271
2572
  return new Dimmer2(dimmer);
2272
2573
  });
2273
- (_b = roomData.switches) == null ? void 0 : _b.map((switch_) => {
2574
+ roomData.switches?.map((switch_) => {
2274
2575
  if (switch_ instanceof Switch2)
2275
2576
  return switch_;
2276
2577
  else
2277
2578
  return new Switch2(switch_);
2278
2579
  });
2279
- (_c = roomData.windowCoverings) == null ? void 0 : _c.map((windowCovering) => {
2580
+ roomData.windowCoverings?.map((windowCovering) => {
2280
2581
  if (windowCovering instanceof WindowCovering2)
2281
2582
  return windowCovering;
2282
2583
  else
2283
2584
  return new WindowCovering2(windowCovering);
2284
2585
  });
2285
- (_d = roomData.thermostats) == null ? void 0 : _d.map((thermostat) => {
2586
+ roomData.thermostats?.map((thermostat) => {
2286
2587
  if (thermostat instanceof Thermostat2)
2287
2588
  return thermostat;
2288
2589
  else
2289
2590
  return new Thermostat2(thermostat);
2290
2591
  });
2291
- (_e = roomData.locks) == null ? void 0 : _e.map((lock) => {
2592
+ roomData.locks?.map((lock) => {
2292
2593
  if (lock instanceof Lock2)
2293
2594
  return lock;
2294
2595
  else
2295
2596
  return new Lock2(lock);
2296
2597
  });
2297
- (_f = roomData.courtesy) == null ? void 0 : _f.map((courtesy) => {
2598
+ roomData.courtesy?.map((courtesy) => {
2298
2599
  if (courtesy instanceof Courtesy2)
2299
2600
  return courtesy;
2300
2601
  else
2301
2602
  return new Courtesy2(courtesy);
2302
2603
  });
2303
- (_g = roomData.sources) == null ? void 0 : _g.map((source) => {
2304
- if (source instanceof Source)
2604
+ roomData.mediaSources?.map((source) => {
2605
+ if (source instanceof MediaSource2)
2305
2606
  return source;
2306
2607
  else
2307
- return new Source(source);
2608
+ return new MediaSource2(source);
2308
2609
  });
2309
- (_h = roomData.cameras) == null ? void 0 : _h.map((camera) => {
2610
+ roomData.cameras?.map((camera) => {
2310
2611
  if (camera instanceof Camera2)
2311
2612
  return camera;
2312
2613
  else
2313
2614
  return new Camera2(camera);
2314
2615
  });
2315
- (_i = roomData.alarms) == null ? void 0 : _i.map((alarm) => {
2616
+ roomData.alarms?.map((alarm) => {
2316
2617
  if (alarm instanceof Alarm2)
2317
2618
  return alarm;
2318
2619
  else
2319
2620
  return new Alarm2(alarm);
2320
2621
  });
2321
- (_j = roomData.motionSensors) == null ? void 0 : _j.map((motionSensor) => {
2622
+ roomData.motionSensors?.map((motionSensor) => {
2322
2623
  if (motionSensor instanceof MotionSensor2)
2323
2624
  return motionSensor;
2324
2625
  else
2325
2626
  return new MotionSensor2(motionSensor);
2326
2627
  });
2327
- (_k = roomData.scenes) == null ? void 0 : _k.map((scene) => {
2628
+ roomData.scenes?.map((scene) => {
2328
2629
  if (scene instanceof Scene2)
2329
2630
  return scene;
2330
2631
  else
@@ -2332,6 +2633,7 @@ var require_room2 = __commonJS({
2332
2633
  });
2333
2634
  return roomData;
2334
2635
  }
2636
+ __name(mapRoomData, "mapRoomData");
2335
2637
  module2.exports = Room2;
2336
2638
  }
2337
2639
  });
@@ -2341,13 +2643,16 @@ var require_reservation = __commonJS({
2341
2643
  "src/schemas/reservation.json"(exports2, module2) {
2342
2644
  module2.exports = {
2343
2645
  $schema: "http://json-schema.org/draft-07/schema",
2344
- $id: "https://api.kohost.app/schemas/v3/reservation.json",
2646
+ $id: "https://api.kohost.io/schemas/v3/reservation.json",
2345
2647
  title: "Reservation",
2346
2648
  type: "object",
2347
2649
  required: ["type", "status", "checkInDateTime", "checkOutDateTime"],
2348
2650
  properties: {
2349
2651
  id: {
2350
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2652
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2653
+ },
2654
+ driver: {
2655
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
2351
2656
  },
2352
2657
  primaryGuest: {
2353
2658
  type: "string"
@@ -2361,14 +2666,40 @@ var require_reservation = __commonJS({
2361
2666
  type: "string"
2362
2667
  }
2363
2668
  },
2669
+ spaceType: {
2670
+ type: "string"
2671
+ },
2364
2672
  space: {
2365
2673
  type: "string"
2366
2674
  },
2367
2675
  status: {
2368
2676
  type: "string",
2369
- enum: ["reserved", "checkedIn", "checkedOut", "cancelled", "noShow", "enquired", "requested", "optional"],
2677
+ enum: [
2678
+ "reserved",
2679
+ "checkedIn",
2680
+ "checkedOut",
2681
+ "cancelled",
2682
+ "noShow",
2683
+ "enquired",
2684
+ "requested",
2685
+ "optional"
2686
+ ],
2370
2687
  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)"
2371
2688
  },
2689
+ mobileCheckInStatus: {
2690
+ type: "string",
2691
+ enum: [
2692
+ "ready",
2693
+ "blocked",
2694
+ "preArrivalStepsRequired",
2695
+ "spaceNotAssigned",
2696
+ "spaceNotReady",
2697
+ "checkInTimeNotStarted"
2698
+ ]
2699
+ },
2700
+ mobileCheckInStatusMessage: {
2701
+ type: "string"
2702
+ },
2372
2703
  confirmationNumber: {
2373
2704
  type: "string"
2374
2705
  },
@@ -2389,6 +2720,24 @@ var require_reservation = __commonJS({
2389
2720
  type: "number",
2390
2721
  default: 0
2391
2722
  },
2723
+ revenue: {
2724
+ type: "array",
2725
+ items: {
2726
+ type: "object",
2727
+ properties: {
2728
+ date: {
2729
+ type: "string",
2730
+ format: "date"
2731
+ },
2732
+ amount: {
2733
+ type: "number"
2734
+ },
2735
+ type: {
2736
+ type: "string"
2737
+ }
2738
+ }
2739
+ }
2740
+ },
2392
2741
  rateSuppressed: {
2393
2742
  type: "boolean"
2394
2743
  },
@@ -2402,10 +2751,10 @@ var require_reservation = __commonJS({
2402
2751
  type: "string"
2403
2752
  },
2404
2753
  systemData: {
2405
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
2754
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
2406
2755
  },
2407
2756
  metadata: {
2408
- ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/metadata"
2757
+ ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/metadata"
2409
2758
  }
2410
2759
  }
2411
2760
  };
@@ -2428,12 +2777,20 @@ var require_reservation2 = __commonJS({
2428
2777
  return this.adultCount + this.childCount;
2429
2778
  }
2430
2779
  get hasPayment() {
2431
- var _a;
2432
- return ((_a = this.paymentId) == null ? void 0 : _a.length) > 0;
2780
+ return this.paymentId?.length > 0;
2433
2781
  }
2434
2782
  range(tz) {
2435
2783
  const start = new Date(this.checkInDateTime);
2436
2784
  const end = new Date(this.checkOutDateTime);
2785
+ if (start.getDate() === end.getDate() && start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
2786
+ return `${start.toLocaleString("default", {
2787
+ month: "short",
2788
+ timeZone: tz
2789
+ })} ${start.toLocaleString("default", {
2790
+ timeZone: tz,
2791
+ day: "numeric"
2792
+ })}`;
2793
+ }
2437
2794
  if (start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
2438
2795
  return `${start.toLocaleString("default", {
2439
2796
  month: "short",
@@ -2469,6 +2826,7 @@ var require_reservation2 = __commonJS({
2469
2826
  });
2470
2827
  }
2471
2828
  };
2829
+ __name(Reservation2, "Reservation");
2472
2830
  Object.defineProperty(Reservation2.prototype, "schema", {
2473
2831
  value: schema
2474
2832
  });
@@ -2484,75 +2842,17 @@ var require_reservation2 = __commonJS({
2484
2842
  }
2485
2843
  });
2486
2844
 
2487
- // src/schemas/application.json
2488
- var require_application = __commonJS({
2489
- "src/schemas/application.json"(exports2, module2) {
2490
- module2.exports = {
2491
- $schema: "http://json-schema.org/draft-07/schema",
2492
- $id: "https://api.kohost.app/schemas/v3/application.json",
2493
- title: "Application",
2494
- type: "object",
2495
- required: ["id", "active", "name", "publicKey", "hashedPrivateKey"],
2496
- properties: {
2497
- id: {
2498
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2499
- },
2500
- active: {
2501
- type: "boolean"
2502
- },
2503
- name: {
2504
- type: "string"
2505
- },
2506
- publicKey: {
2507
- type: "string"
2508
- },
2509
- hashedPrivateKey: {
2510
- type: "string"
2511
- }
2512
- }
2513
- };
2514
- }
2515
- });
2516
-
2517
- // src/Models/application.js
2518
- var require_application2 = __commonJS({
2519
- "src/Models/application.js"(exports2, module2) {
2520
- var schemas = require_schema();
2521
- var schema = require_application();
2522
- var Kohost = require_kohost();
2523
- schemas.add(schema);
2524
- var validator = schemas.compile(schema);
2525
- var Application2 = class extends Kohost {
2526
- constructor(data) {
2527
- super(data);
2528
- }
2529
- };
2530
- Object.defineProperty(Application2.prototype, "schema", {
2531
- value: schema
2532
- });
2533
- Object.defineProperty(Application2.prototype, "validator", {
2534
- get: function() {
2535
- return validator;
2536
- }
2537
- });
2538
- Object.defineProperty(Application2, "validProperties", {
2539
- value: Object.keys(schema.properties)
2540
- });
2541
- module2.exports = Application2;
2542
- }
2543
- });
2544
-
2545
2845
  // src/schemas/space.json
2546
2846
  var require_space = __commonJS({
2547
2847
  "src/schemas/space.json"(exports2, module2) {
2548
2848
  module2.exports = {
2549
2849
  $schema: "http://json-schema.org/draft-07/schema",
2550
- $id: "https://api.kohost.app/schemas/v3/space.json",
2850
+ $id: "https://api.kohost.io/schemas/v3/space.json",
2551
2851
  title: "Space",
2552
2852
  type: "object",
2553
2853
  properties: {
2554
2854
  id: {
2555
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2855
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2556
2856
  },
2557
2857
  name: {
2558
2858
  type: "string",
@@ -2569,6 +2869,12 @@ var require_space = __commonJS({
2569
2869
  "other"
2570
2870
  ]
2571
2871
  },
2872
+ driver: {
2873
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
2874
+ },
2875
+ subType: {
2876
+ type: "string"
2877
+ },
2572
2878
  rooms: {
2573
2879
  type: "array",
2574
2880
  items: {
@@ -2622,7 +2928,7 @@ var require_space = __commonJS({
2622
2928
  enum: ["inService", "outOfOrder", "outOfService"]
2623
2929
  },
2624
2930
  systemData: {
2625
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
2931
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
2626
2932
  }
2627
2933
  },
2628
2934
  if: {
@@ -2700,9 +3006,6 @@ var require_space2 = __commonJS({
2700
3006
  get hasCourtesy() {
2701
3007
  return this.rooms.some((room) => room.hasCourtesy);
2702
3008
  }
2703
- get hasSceneController() {
2704
- return this.rooms.some((room) => room.hasSceneController);
2705
- }
2706
3009
  get hasCamera() {
2707
3010
  return this.rooms.some((room) => room.hasCamera);
2708
3011
  }
@@ -2716,6 +3019,7 @@ var require_space2 = __commonJS({
2716
3019
  return this.rooms.some((room) => room.occupied);
2717
3020
  }
2718
3021
  };
3022
+ __name(Space2, "Space");
2719
3023
  Object.defineProperty(Space2.prototype, "schema", {
2720
3024
  value: schema
2721
3025
  });
@@ -2728,9 +3032,8 @@ var require_space2 = __commonJS({
2728
3032
  value: Object.keys(schema.properties)
2729
3033
  });
2730
3034
  function mapSpaceData(data) {
2731
- var _a;
2732
3035
  const spaceData = cloneDeep(data);
2733
- if ((_a = spaceData.rooms) == null ? void 0 : _a.length) {
3036
+ if (spaceData.rooms?.length) {
2734
3037
  spaceData.rooms.map((room) => {
2735
3038
  if (typeof room === "string")
2736
3039
  return room;
@@ -2741,63 +3044,242 @@ var require_space2 = __commonJS({
2741
3044
  }
2742
3045
  return spaceData;
2743
3046
  }
3047
+ __name(mapSpaceData, "mapSpaceData");
2744
3048
  module2.exports = Space2;
2745
3049
  }
2746
3050
  });
2747
3051
 
2748
- // src/schemas/ticket.json
2749
- var require_ticket = __commonJS({
2750
- "src/schemas/ticket.json"(exports2, module2) {
3052
+ // src/schemas/spaceType.json
3053
+ var require_spaceType = __commonJS({
3054
+ "src/schemas/spaceType.json"(exports2, module2) {
2751
3055
  module2.exports = {
2752
3056
  $schema: "http://json-schema.org/draft-07/schema",
2753
- $id: "https://api.kohost.app/schemas/v3/ticket.json",
2754
- title: "Ticket",
2755
- description: "A ticket is a request for help from a user.",
3057
+ $id: "https://api.kohost.io/schemas/v3/spaceType.json",
3058
+ title: "Space Type",
2756
3059
  type: "object",
2757
3060
  properties: {
2758
3061
  id: {
2759
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
2760
- },
2761
- conversation: {
2762
- type: "array",
2763
- default: [],
2764
- items: {
2765
- type: "object",
2766
- additionalProperties: false,
2767
- properties: {
2768
- id: {
2769
- type: "string"
2770
- },
2771
- user: {
2772
- type: "string"
2773
- },
2774
- timestamp: {
2775
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
2776
- },
2777
- body: {
2778
- type: "string"
2779
- },
2780
- readBy: {
2781
- type: "array",
2782
- default: [],
2783
- items: {
2784
- type: "string"
2785
- }
2786
- }
2787
- },
2788
- required: ["user", "id", "timestamp", "body"]
2789
- }
3062
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2790
3063
  },
2791
- requester: {
3064
+ type: {
2792
3065
  type: "string"
2793
3066
  },
2794
- assignedTo: {
2795
- type: ["string", "null"]
2796
- },
2797
- status: {
3067
+ name: {
2798
3068
  type: "string",
2799
- enum: ["open", "pending", "solved", "closed"],
2800
- default: "open"
3069
+ minLength: 1
3070
+ },
3071
+ driver: {
3072
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
3073
+ },
3074
+ description: {
3075
+ type: "string"
3076
+ },
3077
+ imageUrl: {
3078
+ format: "uri",
3079
+ pattern: "^https?://"
3080
+ },
3081
+ systemData: {
3082
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
3083
+ }
3084
+ }
3085
+ };
3086
+ }
3087
+ });
3088
+
3089
+ // src/Models/spaceType.js
3090
+ var require_spaceType2 = __commonJS({
3091
+ "src/Models/spaceType.js"(exports2, module2) {
3092
+ var schemas = require_schema();
3093
+ var schema = require_spaceType();
3094
+ var Kohost = require_kohost();
3095
+ schemas.add(schema);
3096
+ var validator = schemas.compile(schema);
3097
+ var SpaceType2 = class extends Kohost {
3098
+ constructor(data) {
3099
+ super(data);
3100
+ }
3101
+ };
3102
+ __name(SpaceType2, "SpaceType");
3103
+ Object.defineProperty(SpaceType2.prototype, "schema", {
3104
+ value: schema
3105
+ });
3106
+ Object.defineProperty(SpaceType2.prototype, "validator", {
3107
+ get: function() {
3108
+ return validator;
3109
+ }
3110
+ });
3111
+ Object.defineProperty(SpaceType2, "validProperties", {
3112
+ value: Object.keys(schema.properties)
3113
+ });
3114
+ module2.exports = SpaceType2;
3115
+ }
3116
+ });
3117
+
3118
+ // src/schemas/mediaFile.json
3119
+ var require_mediaFile = __commonJS({
3120
+ "src/schemas/mediaFile.json"(exports2, module2) {
3121
+ module2.exports = {
3122
+ $schema: "http://json-schema.org/draft-07/schema",
3123
+ $id: "https://api.kohost.io/schemas/v3/mediaFile.json",
3124
+ title: "Media File",
3125
+ description: "Any media file",
3126
+ type: "object",
3127
+ properties: {
3128
+ id: {
3129
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3130
+ },
3131
+ type: {
3132
+ type: "string",
3133
+ default: "mediaFile"
3134
+ },
3135
+ fileHash: {
3136
+ type: "string"
3137
+ },
3138
+ mimeType: {
3139
+ type: "string",
3140
+ enum: [
3141
+ "image/*",
3142
+ "image/jpeg",
3143
+ "image/png",
3144
+ "image/gif",
3145
+ "image/webp",
3146
+ "image/avif",
3147
+ "image/svg+xml",
3148
+ "application/pdf"
3149
+ ]
3150
+ },
3151
+ url: {
3152
+ type: "string",
3153
+ format: "uri"
3154
+ },
3155
+ width: {
3156
+ type: "integer",
3157
+ minimum: 0
3158
+ },
3159
+ height: {
3160
+ type: "integer",
3161
+ minimum: 0
3162
+ },
3163
+ size: {
3164
+ type: "integer",
3165
+ minimum: 0,
3166
+ description: "Size in bytes"
3167
+ },
3168
+ uploadUrl: {
3169
+ type: "string",
3170
+ format: "uri"
3171
+ },
3172
+ uploadUrlExpires: {
3173
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
3174
+ },
3175
+ createdBy: {
3176
+ type: "string"
3177
+ },
3178
+ systemData: {
3179
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
3180
+ }
3181
+ },
3182
+ additionalProperties: false,
3183
+ required: ["id", "type"]
3184
+ };
3185
+ }
3186
+ });
3187
+
3188
+ // src/Models/mediaFile.js
3189
+ var require_mediaFile2 = __commonJS({
3190
+ "src/Models/mediaFile.js"(exports2, module2) {
3191
+ var schemas = require_schema();
3192
+ var schema = require_mediaFile();
3193
+ var Kohost = require_kohost();
3194
+ var { RequestError } = require_Errors();
3195
+ schemas.add(schema);
3196
+ var validator = schemas.compile(schema);
3197
+ var MediaFile2 = class extends Kohost {
3198
+ constructor(data) {
3199
+ super(data);
3200
+ }
3201
+ createImageVariant(params) {
3202
+ if (this.mimeType != "image/*")
3203
+ throw new RequestError("Only dynamic images can have variants");
3204
+ const query = Object.keys(params).map((key) => `${key}=${params[key]}`).join(",");
3205
+ return this.url.replace(/\/public$/, `/${query}`);
3206
+ }
3207
+ };
3208
+ __name(MediaFile2, "MediaFile");
3209
+ Object.defineProperty(MediaFile2.prototype, "schema", {
3210
+ value: schema
3211
+ });
3212
+ Object.defineProperty(MediaFile2.prototype, "validator", {
3213
+ get: function() {
3214
+ return validator;
3215
+ }
3216
+ });
3217
+ Object.defineProperty(MediaFile2, "validProperties", {
3218
+ value: Object.keys(schema.properties)
3219
+ });
3220
+ module2.exports = MediaFile2;
3221
+ }
3222
+ });
3223
+
3224
+ // src/schemas/ticket.json
3225
+ var require_ticket = __commonJS({
3226
+ "src/schemas/ticket.json"(exports2, module2) {
3227
+ module2.exports = {
3228
+ $schema: "http://json-schema.org/draft-07/schema",
3229
+ $id: "https://api.kohost.io/schemas/v3/ticket.json",
3230
+ title: "Ticket",
3231
+ description: "A ticket is a request for help from a user.",
3232
+ type: "object",
3233
+ properties: {
3234
+ id: {
3235
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3236
+ },
3237
+ conversation: {
3238
+ type: "array",
3239
+ default: [],
3240
+ items: {
3241
+ type: "object",
3242
+ additionalProperties: false,
3243
+ properties: {
3244
+ id: {
3245
+ type: "string"
3246
+ },
3247
+ userId: {
3248
+ type: "string"
3249
+ },
3250
+ userName: {
3251
+ type: "string"
3252
+ },
3253
+ timestamp: {
3254
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
3255
+ },
3256
+ body: {
3257
+ type: "string"
3258
+ },
3259
+ readBy: {
3260
+ type: "array",
3261
+ default: [],
3262
+ items: {
3263
+ type: "string"
3264
+ }
3265
+ },
3266
+ media: {
3267
+ $ref: "https://api.kohost.io/schemas/v3/mediaFile.json"
3268
+ }
3269
+ },
3270
+ required: ["userId", "id", "timestamp", "body"]
3271
+ }
3272
+ },
3273
+ requester: {
3274
+ type: "string"
3275
+ },
3276
+ assignedTo: {
3277
+ type: ["string", "null"]
3278
+ },
3279
+ status: {
3280
+ type: "string",
3281
+ enum: ["open", "pending", "solved", "closed"],
3282
+ default: "open"
2801
3283
  },
2802
3284
  tags: {
2803
3285
  type: "array",
@@ -2806,17 +3288,25 @@ var require_ticket = __commonJS({
2806
3288
  type: "string"
2807
3289
  }
2808
3290
  },
3291
+ rating: {
3292
+ type: "number",
3293
+ minimum: 0,
3294
+ maximum: 5
3295
+ },
3296
+ ratingComment: {
3297
+ type: "string"
3298
+ },
2809
3299
  createdAt: {
2810
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
3300
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
2811
3301
  },
2812
3302
  updatedAt: {
2813
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
3303
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
2814
3304
  },
2815
3305
  solvedAt: {
2816
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
3306
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
2817
3307
  },
2818
3308
  closedAt: {
2819
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
3309
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
2820
3310
  }
2821
3311
  },
2822
3312
  required: [
@@ -2839,19 +3329,23 @@ var require_ticket2 = __commonJS({
2839
3329
  var schemas = require_schema();
2840
3330
  var schema = require_ticket();
2841
3331
  var Kohost = require_kohost();
3332
+ var MediaFile2 = require_mediaFile2();
2842
3333
  var sortBy = require("lodash.sortby");
2843
3334
  var findLast = require("lodash.findlast");
2844
3335
  var { nanoid } = require("nanoid");
3336
+ var cloneDeep = require("lodash.clonedeep");
2845
3337
  schemas.add(schema);
2846
3338
  var validator = schemas.compile(schema);
2847
3339
  var Ticket2 = class extends Kohost {
2848
3340
  constructor(data) {
2849
- super(data);
3341
+ const ticketData = mapConversationData(data);
3342
+ super(ticketData);
2850
3343
  }
2851
3344
  static generateMessageId(len = 16) {
2852
3345
  return nanoid(len);
2853
3346
  }
2854
3347
  };
3348
+ __name(Ticket2, "Ticket");
2855
3349
  Object.defineProperty(Ticket2.prototype, "schema", {
2856
3350
  value: schema
2857
3351
  });
@@ -2875,8 +3369,8 @@ var require_ticket2 = __commonJS({
2875
3369
  return msg;
2876
3370
  });
2877
3371
  const sorted = sortBy(mapped, ["timestamp"]);
2878
- const firstMsg = sorted.find((entry) => entry.user === requester);
2879
- const firstResponse = sorted.find((entry) => entry.user !== requester);
3372
+ const firstMsg = sorted.find((entry) => entry.userId === requester);
3373
+ const firstResponse = sorted.find((entry) => entry.userId !== requester);
2880
3374
  if (firstMsg && firstResponse) {
2881
3375
  const firstMsgTime = firstMsg.timestamp.getTime() / 1e3;
2882
3376
  const firstResponseTime = firstResponse.timestamp.getTime() / 1e3;
@@ -2900,14 +3394,25 @@ var require_ticket2 = __commonJS({
2900
3394
  const requester = this.requester;
2901
3395
  const sorted = sortBy(conversation, ["timestamp"]);
2902
3396
  const lastFromNonRequester = findLast(sorted, function(c) {
2903
- return c.user !== requester;
3397
+ return c.userId !== requester;
2904
3398
  });
2905
3399
  if (!lastFromNonRequester)
2906
3400
  return null;
2907
3401
  else
2908
- return lastFromNonRequester.user;
3402
+ return lastFromNonRequester.userId;
2909
3403
  }
2910
3404
  });
3405
+ function mapConversationData(data) {
3406
+ const ticketData = cloneDeep(data);
3407
+ ticketData.conversation = ticketData.conversation.map((msg) => {
3408
+ if (msg.media) {
3409
+ msg.media = new MediaFile2(msg.media);
3410
+ }
3411
+ return msg;
3412
+ });
3413
+ return ticketData;
3414
+ }
3415
+ __name(mapConversationData, "mapConversationData");
2911
3416
  module2.exports = Ticket2;
2912
3417
  }
2913
3418
  });
@@ -2917,32 +3422,38 @@ var require_gateway = __commonJS({
2917
3422
  "src/schemas/gateway.json"(exports2, module2) {
2918
3423
  module2.exports = {
2919
3424
  $schema: "http://json-schema.org/draft-07/schema",
2920
- $id: "https://api.kohost.app/schemas/v3/iotGateway.json",
3425
+ $id: "https://api.kohost.io/schemas/v3/iotGateway.json",
2921
3426
  title: "IoT Gateway",
2922
3427
  description: "Any smart gateway that is an entrypoint for controlling devices",
2923
3428
  type: "object",
2924
3429
  properties: {
2925
3430
  id: {
2926
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
3431
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
2927
3432
  },
2928
3433
  type: {
2929
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
3434
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
2930
3435
  },
2931
3436
  supportedNotifications: {
2932
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
3437
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
2933
3438
  },
2934
3439
  notification: {
2935
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
3440
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
2936
3441
  },
2937
3442
  status: {
2938
3443
  type: "string"
2939
3444
  },
2940
3445
  systemData: {
2941
- $ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
3446
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
3447
+ },
3448
+ driver: {
3449
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
3450
+ },
3451
+ watts: {
3452
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
2942
3453
  }
2943
3454
  },
2944
3455
  additionalProperties: false,
2945
- required: ["id", "type", "systemData", "status"]
3456
+ required: ["id", "type", "systemData", "status", "driver"]
2946
3457
  };
2947
3458
  }
2948
3459
  });
@@ -2960,6 +3471,7 @@ var require_gateway2 = __commonJS({
2960
3471
  super(data);
2961
3472
  }
2962
3473
  };
3474
+ __name(Gateway2, "Gateway");
2963
3475
  Object.defineProperty(Gateway2.prototype, "schema", {
2964
3476
  value: schema
2965
3477
  });
@@ -2980,13 +3492,13 @@ var require_product = __commonJS({
2980
3492
  "src/schemas/product.json"(exports2, module2) {
2981
3493
  module2.exports = {
2982
3494
  $schema: "http://json-schema.org/draft-07/schema",
2983
- $id: "https://api.kohost.app/schemas/v3/product.json",
3495
+ $id: "https://api.kohost.io/schemas/v3/product.json",
2984
3496
  title: "Product",
2985
3497
  type: "object",
2986
- required: ["name", "description", "price", "currency"],
3498
+ required: ["name", "price", "currency", "driver"],
2987
3499
  properties: {
2988
3500
  id: {
2989
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
3501
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
2990
3502
  },
2991
3503
  type: {
2992
3504
  type: "string"
@@ -2994,6 +3506,9 @@ var require_product = __commonJS({
2994
3506
  name: {
2995
3507
  type: "string"
2996
3508
  },
3509
+ driver: {
3510
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
3511
+ },
2997
3512
  description: {
2998
3513
  string: "string"
2999
3514
  },
@@ -3007,10 +3522,14 @@ var require_product = __commonJS({
3007
3522
  maxLength: 3
3008
3523
  },
3009
3524
  image: {
3010
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
3525
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
3526
+ },
3527
+ imageUrl: {
3528
+ format: "uri",
3529
+ pattern: "^https?://"
3011
3530
  },
3012
3531
  systemData: {
3013
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
3532
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
3014
3533
  }
3015
3534
  }
3016
3535
  };
@@ -3030,6 +3549,7 @@ var require_product2 = __commonJS({
3030
3549
  super(data);
3031
3550
  }
3032
3551
  };
3552
+ __name(Product2, "Product");
3033
3553
  Object.defineProperty(Product2.prototype, "schema", {
3034
3554
  value: schema
3035
3555
  });
@@ -3050,14 +3570,14 @@ var require_discoveredDevice = __commonJS({
3050
3570
  "src/schemas/discoveredDevice.json"(exports2, module2) {
3051
3571
  module2.exports = {
3052
3572
  $schema: "http://json-schema.org/draft-07/schema",
3053
- $id: "https://api.kohost.app/schemas/v3/discoveredDevice.json",
3573
+ $id: "https://api.kohost.io/schemas/v3/discoveredDevice.json",
3054
3574
  title: "Discovered Device",
3055
3575
  description: "A device that has been discovered by Kohost, but not yet added to the Kohost system.",
3056
3576
  type: "object",
3057
- required: ["name", "deviceId", "driver", "deviceData"],
3577
+ required: ["name", "deviceId", "deviceData"],
3058
3578
  properties: {
3059
3579
  id: {
3060
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
3580
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3061
3581
  },
3062
3582
  name: {
3063
3583
  type: "string"
@@ -3066,28 +3586,16 @@ var require_discoveredDevice = __commonJS({
3066
3586
  type: "string"
3067
3587
  },
3068
3588
  type: {
3069
- type: "string",
3070
- enum: [
3071
- "dimmer",
3072
- "switch",
3073
- "motionSensor",
3074
- "thermostat",
3075
- "lock",
3076
- "camera",
3077
- "courtesy",
3078
- "source",
3079
- "alarm",
3080
- "windowCovering"
3081
- ]
3589
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
3082
3590
  },
3083
3591
  driver: {
3084
3592
  type: "string"
3085
3593
  },
3086
- integrationId: {
3087
- type: "string"
3088
- },
3089
3594
  deviceData: {
3090
3595
  type: "object"
3596
+ },
3597
+ ignore: {
3598
+ type: "boolean"
3091
3599
  }
3092
3600
  }
3093
3601
  };
@@ -3107,6 +3615,7 @@ var require_discoveredDevice2 = __commonJS({
3107
3615
  super(data);
3108
3616
  }
3109
3617
  };
3618
+ __name(DiscoveredDevice2, "DiscoveredDevice");
3110
3619
  Object.defineProperty(DiscoveredDevice2.prototype, "schema", {
3111
3620
  value: schema
3112
3621
  });
@@ -3127,17 +3636,17 @@ var require_credential = __commonJS({
3127
3636
  "src/schemas/credential.json"(exports2, module2) {
3128
3637
  module2.exports = {
3129
3638
  $schema: "http://json-schema.org/draft-07/schema",
3130
- $id: "https://api.kohost.app/schemas/v3/credential.json",
3639
+ $id: "https://api.kohost.io/schemas/v3/credential.json",
3131
3640
  title: "Credential",
3132
3641
  type: "object",
3133
3642
  required: ["type", "credential", "expires"],
3134
3643
  properties: {
3135
3644
  id: {
3136
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
3645
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3137
3646
  },
3138
3647
  type: {
3139
3648
  type: "string",
3140
- enum: ["verificationCode", "token"]
3649
+ enum: ["verificationCode", "token", "mobileKey"]
3141
3650
  },
3142
3651
  credential: {
3143
3652
  type: "string"
@@ -3150,6 +3659,9 @@ var require_credential = __commonJS({
3150
3659
  },
3151
3660
  expires: {
3152
3661
  string: "string"
3662
+ },
3663
+ systemData: {
3664
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
3153
3665
  }
3154
3666
  }
3155
3667
  };
@@ -3169,6 +3681,7 @@ var require_credential2 = __commonJS({
3169
3681
  super(data);
3170
3682
  }
3171
3683
  };
3684
+ __name(Credential2, "Credential");
3172
3685
  Object.defineProperty(Credential2.prototype, "schema", {
3173
3686
  value: schema
3174
3687
  });
@@ -3189,13 +3702,13 @@ var require_shortLink = __commonJS({
3189
3702
  "src/schemas/shortLink.json"(exports2, module2) {
3190
3703
  module2.exports = {
3191
3704
  $schema: "http://json-schema.org/draft-07/schema",
3192
- $id: "https://api.kohost.app/schemas/v3/shortLink.json",
3705
+ $id: "https://api.kohost.io/schemas/v3/shortLink.json",
3193
3706
  title: "Short Link",
3194
3707
  type: "object",
3195
3708
  required: ["destination", "url"],
3196
3709
  properties: {
3197
3710
  id: {
3198
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
3711
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3199
3712
  },
3200
3713
  type: {
3201
3714
  type: "string",
@@ -3213,7 +3726,7 @@ var require_shortLink = __commonJS({
3213
3726
  format: "uri"
3214
3727
  },
3215
3728
  systemData: {
3216
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
3729
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
3217
3730
  }
3218
3731
  }
3219
3732
  };
@@ -3233,6 +3746,7 @@ var require_shortLink2 = __commonJS({
3233
3746
  super(data);
3234
3747
  }
3235
3748
  };
3749
+ __name(ShortLink2, "ShortLink");
3236
3750
  Object.defineProperty(ShortLink2.prototype, "schema", {
3237
3751
  value: schema
3238
3752
  });
@@ -3248,85 +3762,343 @@ var require_shortLink2 = __commonJS({
3248
3762
  }
3249
3763
  });
3250
3764
 
3251
- // src/schemas/admin/customer.json
3252
- var require_customer = __commonJS({
3253
- "src/schemas/admin/customer.json"(exports2, module2) {
3765
+ // src/schemas/energyReportShard.json
3766
+ var require_energyReportShard = __commonJS({
3767
+ "src/schemas/energyReportShard.json"(exports2, module2) {
3254
3768
  module2.exports = {
3255
3769
  $schema: "http://json-schema.org/draft-07/schema",
3256
- $id: "https://api.kohost.app/schemas/v3/admin/customer.json",
3257
- title: "Customer",
3770
+ $id: "https://api.kohost.io/schemas/v3/energyReportShard.json",
3771
+ title: "Energy Report Shard",
3772
+ description: "Shard used for Energy Reports",
3258
3773
  type: "object",
3259
- description: "A Kohost customer",
3260
- required: ["accountNumber", "name"],
3774
+ required: [
3775
+ "id",
3776
+ "type",
3777
+ "roomId",
3778
+ "first",
3779
+ "last",
3780
+ "data",
3781
+ "ndata",
3782
+ "expires"
3783
+ ],
3261
3784
  properties: {
3262
3785
  id: {
3263
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
3786
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3264
3787
  },
3265
- accountNumber: {
3266
- type: "number",
3267
- minimum: 1e4
3788
+ type: {
3789
+ type: "string",
3790
+ enum: ["energyReportShard"],
3791
+ default: "energyReportShard"
3268
3792
  },
3269
- name: {
3270
- type: "string"
3793
+ roomId: {
3794
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3271
3795
  },
3272
- properties: {
3796
+ first: {
3797
+ type: ["string", "object"],
3798
+ format: "date-time"
3799
+ },
3800
+ last: {
3801
+ type: ["string", "object"],
3802
+ format: "date-time"
3803
+ },
3804
+ data: {
3273
3805
  type: "array",
3274
3806
  items: {
3275
- type: "string"
3807
+ type: "object",
3808
+ required: ["time", "watts", "id", "type", "value"],
3809
+ properties: {
3810
+ time: {
3811
+ type: ["string", "object"],
3812
+ format: "date-time"
3813
+ },
3814
+ watts: {
3815
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
3816
+ },
3817
+ id: {
3818
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3819
+ },
3820
+ type: {
3821
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
3822
+ },
3823
+ value: {
3824
+ type: "number",
3825
+ minimum: 0,
3826
+ maximum: 1
3827
+ }
3828
+ }
3276
3829
  }
3277
3830
  },
3831
+ ndata: {
3832
+ type: "integer",
3833
+ minimum: 0,
3834
+ maximum: 1e5,
3835
+ default: 0
3836
+ },
3837
+ expires: {
3838
+ type: ["string", "object"],
3839
+ format: "date-time"
3840
+ }
3841
+ }
3842
+ };
3843
+ }
3844
+ });
3845
+
3846
+ // src/Models/energyReportShard.js
3847
+ var require_energyReportShard2 = __commonJS({
3848
+ "src/Models/energyReportShard.js"(exports2, module2) {
3849
+ var schemas = require_schema();
3850
+ var schema = require_energyReportShard();
3851
+ var Kohost = require_kohost();
3852
+ schemas.add(schema);
3853
+ var validator = schemas.compile(schema);
3854
+ var EnergyReportShard2 = class extends Kohost {
3855
+ constructor(data) {
3856
+ super(data);
3857
+ }
3858
+ };
3859
+ __name(EnergyReportShard2, "EnergyReportShard");
3860
+ Object.defineProperty(EnergyReportShard2.prototype, "schema", {
3861
+ value: schema
3862
+ });
3863
+ Object.defineProperty(EnergyReportShard2.prototype, "validator", {
3864
+ get: function() {
3865
+ return validator;
3866
+ }
3867
+ });
3868
+ Object.defineProperty(EnergyReportShard2, "validProperties", {
3869
+ value: Object.keys(schema.properties)
3870
+ });
3871
+ module2.exports = EnergyReportShard2;
3872
+ }
3873
+ });
3874
+
3875
+ // src/schemas/energyReport.json
3876
+ var require_energyReport = __commonJS({
3877
+ "src/schemas/energyReport.json"(exports2, module2) {
3878
+ module2.exports = {
3879
+ $schema: "http://json-schema.org/draft-07/schema",
3880
+ $id: "https://api.kohost.io/schemas/v3/energyReport.json",
3881
+ title: "Energy Report Hourly",
3882
+ description: "Hourly Report for Energy based on energy report shards",
3883
+ type: "object",
3884
+ required: [
3885
+ "id",
3886
+ "type",
3887
+ "roomId",
3888
+ "first",
3889
+ "last",
3890
+ "consumption",
3891
+ "totals",
3892
+ "costPerKw"
3893
+ ],
3894
+ properties: {
3895
+ id: {
3896
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3897
+ },
3898
+ type: {
3899
+ type: "string",
3900
+ enum: ["energyReport"],
3901
+ default: "energyReport"
3902
+ },
3903
+ reportTime: {
3904
+ time: "string",
3905
+ enum: ["hourly", "daily", "monthly"]
3906
+ },
3907
+ roomId: {
3908
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3909
+ },
3910
+ first: {
3911
+ type: ["string", "object"],
3912
+ format: "date-time"
3913
+ },
3914
+ last: {
3915
+ type: ["string", "object"],
3916
+ format: "date-time"
3917
+ },
3918
+ consumption: {
3919
+ type: "array",
3920
+ items: {
3921
+ type: "object",
3922
+ required: ["id", "type", "kwh"],
3923
+ properties: {
3924
+ id: {
3925
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3926
+ },
3927
+ type: {
3928
+ $ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
3929
+ },
3930
+ kwh: {
3931
+ type: "number",
3932
+ minimum: 0
3933
+ }
3934
+ }
3935
+ }
3936
+ },
3937
+ totals: {
3938
+ type: "array",
3939
+ items: {
3940
+ type: "object",
3941
+ required: ["lights", "climate", "media"],
3942
+ properties: {
3943
+ lights: {
3944
+ type: "number",
3945
+ minimum: 0
3946
+ },
3947
+ climate: {
3948
+ type: "number",
3949
+ minimum: 0
3950
+ },
3951
+ media: {
3952
+ type: "number",
3953
+ minimum: 0
3954
+ }
3955
+ }
3956
+ }
3957
+ },
3958
+ costPerKw: {
3959
+ type: "number",
3960
+ minimum: 0
3961
+ }
3962
+ }
3963
+ };
3964
+ }
3965
+ });
3966
+
3967
+ // src/Models/energyReport.js
3968
+ var require_energyReport2 = __commonJS({
3969
+ "src/Models/energyReport.js"(exports2, module2) {
3970
+ var schemas = require_schema();
3971
+ var schema = require_energyReport();
3972
+ var Kohost = require_kohost();
3973
+ schemas.add(schema);
3974
+ var validator = schemas.compile(schema);
3975
+ var EnergyReport2 = class extends Kohost {
3976
+ constructor(data) {
3977
+ super(data);
3978
+ }
3979
+ };
3980
+ __name(EnergyReport2, "EnergyReport");
3981
+ Object.defineProperty(EnergyReport2.prototype, "schema", {
3982
+ value: schema
3983
+ });
3984
+ Object.defineProperty(EnergyReport2.prototype, "validator", {
3985
+ get: function() {
3986
+ return validator;
3987
+ }
3988
+ });
3989
+ Object.defineProperty(EnergyReport2, "validProperties", {
3990
+ value: Object.keys(schema.properties)
3991
+ });
3992
+ module2.exports = EnergyReport2;
3993
+ }
3994
+ });
3995
+
3996
+ // src/schemas/smsMessage.json
3997
+ var require_smsMessage = __commonJS({
3998
+ "src/schemas/smsMessage.json"(exports2, module2) {
3999
+ module2.exports = {
4000
+ $schema: "http://json-schema.org/draft-07/schema",
4001
+ $id: "https://api.kohost.io/schemas/v3/smsMessage.json",
4002
+ title: "SMS Message",
4003
+ type: "object",
4004
+ required: ["to", "from", "body", "status"],
4005
+ properties: {
4006
+ id: {
4007
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
4008
+ },
4009
+ type: {
4010
+ type: "string",
4011
+ default: "smsMessage"
4012
+ },
4013
+ to: {
4014
+ type: "string",
4015
+ pattern: "^\\+[0-9]{1,14}$"
4016
+ },
4017
+ from: {
4018
+ type: "string",
4019
+ pattern: "^\\+[0-9]{1,14}$"
4020
+ },
4021
+ media: {
4022
+ type: "string",
4023
+ format: "uri"
4024
+ },
4025
+ status: {
4026
+ type: "string",
4027
+ enum: [
4028
+ "queued",
4029
+ "accepted",
4030
+ "sending",
4031
+ "sent",
4032
+ "failed",
4033
+ "delivered",
4034
+ "undelivered",
4035
+ "receiving",
4036
+ "received",
4037
+ "read"
4038
+ ]
4039
+ },
4040
+ body: {
4041
+ type: "string"
4042
+ },
4043
+ driver: {
4044
+ type: "string"
4045
+ },
3278
4046
  createdAt: {
3279
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
4047
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
3280
4048
  },
3281
4049
  updatedAt: {
3282
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
4050
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/date"
4051
+ },
4052
+ systemData: {
4053
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
3283
4054
  }
3284
4055
  }
3285
4056
  };
3286
4057
  }
3287
4058
  });
3288
4059
 
3289
- // src/Models/admin/customer.js
3290
- var require_customer2 = __commonJS({
3291
- "src/Models/admin/customer.js"(exports2, module2) {
4060
+ // src/Models/smsMessage.js
4061
+ var require_smsMessage2 = __commonJS({
4062
+ "src/Models/smsMessage.js"(exports2, module2) {
3292
4063
  var schemas = require_schema();
3293
- var schema = require_customer();
4064
+ var schema = require_smsMessage();
3294
4065
  var Kohost = require_kohost();
3295
4066
  schemas.add(schema);
3296
4067
  var validator = schemas.compile(schema);
3297
- var Customer = class extends Kohost {
4068
+ var SMSMessage2 = class extends Kohost {
3298
4069
  constructor(data) {
3299
4070
  super(data);
3300
4071
  }
3301
4072
  };
3302
- Object.defineProperty(Customer.prototype, "schema", {
4073
+ __name(SMSMessage2, "SMSMessage");
4074
+ Object.defineProperty(SMSMessage2.prototype, "schema", {
3303
4075
  value: schema
3304
4076
  });
3305
- Object.defineProperty(Customer.prototype, "validator", {
4077
+ Object.defineProperty(SMSMessage2.prototype, "validator", {
3306
4078
  get: function() {
3307
4079
  return validator;
3308
4080
  }
3309
4081
  });
3310
- Object.defineProperty(Customer, "validProperties", {
4082
+ Object.defineProperty(SMSMessage2, "validProperties", {
3311
4083
  value: Object.keys(schema.properties)
3312
4084
  });
3313
- module2.exports = Customer;
4085
+ module2.exports = SMSMessage2;
3314
4086
  }
3315
4087
  });
3316
4088
 
3317
- // src/schemas/admin/property.json
4089
+ // src/schemas/property.json
3318
4090
  var require_property = __commonJS({
3319
- "src/schemas/admin/property.json"(exports2, module2) {
4091
+ "src/schemas/property.json"(exports2, module2) {
3320
4092
  module2.exports = {
3321
4093
  $schema: "http://json-schema.org/draft-07/schema",
3322
- $id: "https://api.kohost.app/schemas/v3/admin/property.json",
4094
+ $id: "https://api.kohost.io/schemas/v3/admin/property.json",
3323
4095
  title: "Property",
3324
4096
  type: "object",
3325
4097
  description: "A property is a physical asset or building",
3326
- required: ["id", "name", "type", "hostname"],
4098
+ required: ["id", "name", "type", "hostname", "organization"],
3327
4099
  properties: {
3328
4100
  id: {
3329
- $ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
4101
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
3330
4102
  },
3331
4103
  name: {
3332
4104
  type: "string"
@@ -3344,6 +4116,10 @@ var require_property = __commonJS({
3344
4116
  hostname: {
3345
4117
  type: "string"
3346
4118
  },
4119
+ organization: {
4120
+ type: "string",
4121
+ description: "Reference (id) to the organization that owns this property"
4122
+ },
3347
4123
  address: {
3348
4124
  type: "object",
3349
4125
  properties: {
@@ -3482,6 +4258,42 @@ var require_property = __commonJS({
3482
4258
  CheckIn: {},
3483
4259
  CheckOut: {},
3484
4260
  Concierge: {},
4261
+ DigitalKey: {
4262
+ type: "object",
4263
+ properties: {
4264
+ system: {
4265
+ type: "string",
4266
+ enum: ["salto"]
4267
+ },
4268
+ branding: {
4269
+ type: "object",
4270
+ properties: {
4271
+ logo: {
4272
+ type: "string",
4273
+ format: "uri"
4274
+ },
4275
+ gradient: {
4276
+ type: "array",
4277
+ items: {
4278
+ type: "string",
4279
+ pattern: "^(?!#ffffff)(#[0-9a-fA-F]{6})$"
4280
+ },
4281
+ minItems: 2,
4282
+ maxItems: 2
4283
+ },
4284
+ highlightedGradient: {
4285
+ type: "array",
4286
+ items: {
4287
+ type: "string",
4288
+ pattern: "^(?!#ffffff)(#[0-9a-fA-F]{6})$"
4289
+ },
4290
+ minItems: 2,
4291
+ maxItems: 3
4292
+ }
4293
+ }
4294
+ }
4295
+ }
4296
+ },
3485
4297
  Elevator: {}
3486
4298
  },
3487
4299
  additionalProperties: false,
@@ -3499,31 +4311,103 @@ var require_property = __commonJS({
3499
4311
  }
3500
4312
  });
3501
4313
 
3502
- // src/Models/admin/property.js
4314
+ // src/Models/property.js
3503
4315
  var require_property2 = __commonJS({
3504
- "src/Models/admin/property.js"(exports2, module2) {
4316
+ "src/Models/property.js"(exports2, module2) {
3505
4317
  var schemas = require_schema();
3506
4318
  var schema = require_property();
3507
4319
  var Kohost = require_kohost();
3508
4320
  schemas.add(schema);
3509
4321
  var validator = schemas.compile(schema);
3510
- var Property = class extends Kohost {
4322
+ var Property2 = class extends Kohost {
4323
+ constructor(data) {
4324
+ super(data);
4325
+ }
4326
+ };
4327
+ __name(Property2, "Property");
4328
+ Object.defineProperty(Property2.prototype, "schema", {
4329
+ value: schema
4330
+ });
4331
+ Object.defineProperty(Property2.prototype, "validator", {
4332
+ get: function() {
4333
+ return validator;
4334
+ }
4335
+ });
4336
+ Object.defineProperty(Property2, "validProperties", {
4337
+ value: Object.keys(schema.properties)
4338
+ });
4339
+ module2.exports = Property2;
4340
+ }
4341
+ });
4342
+
4343
+ // src/schemas/organization.json
4344
+ var require_organization = __commonJS({
4345
+ "src/schemas/organization.json"(exports2, module2) {
4346
+ module2.exports = {
4347
+ $schema: "http://json-schema.org/draft-07/schema",
4348
+ $id: "https://api.kohost.io/schemas/v3/admin/organization.json",
4349
+ title: "Organization",
4350
+ type: "object",
4351
+ description: "An organization is a group or entity that subscribes to Kohost software.",
4352
+ required: ["accountNumber", "name"],
4353
+ properties: {
4354
+ id: {
4355
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
4356
+ },
4357
+ accountNumber: {
4358
+ type: "number",
4359
+ minimum: 1e4
4360
+ },
4361
+ name: {
4362
+ type: "string"
4363
+ },
4364
+ properties: {
4365
+ type: "array",
4366
+ items: {
4367
+ type: "string"
4368
+ }
4369
+ },
4370
+ credentials: {
4371
+ type: "object",
4372
+ additionalProperties: true
4373
+ },
4374
+ createdAt: {
4375
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
4376
+ },
4377
+ updatedAt: {
4378
+ $ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
4379
+ }
4380
+ }
4381
+ };
4382
+ }
4383
+ });
4384
+
4385
+ // src/Models/organization.js
4386
+ var require_organization2 = __commonJS({
4387
+ "src/Models/organization.js"(exports2, module2) {
4388
+ var schemas = require_schema();
4389
+ var schema = require_organization();
4390
+ var Kohost = require_kohost();
4391
+ schemas.add(schema);
4392
+ var validator = schemas.compile(schema);
4393
+ var Organization2 = class extends Kohost {
3511
4394
  constructor(data) {
3512
4395
  super(data);
3513
4396
  }
3514
4397
  };
3515
- Object.defineProperty(Property.prototype, "schema", {
4398
+ __name(Organization2, "Organization");
4399
+ Object.defineProperty(Organization2.prototype, "schema", {
3516
4400
  value: schema
3517
4401
  });
3518
- Object.defineProperty(Property.prototype, "validator", {
4402
+ Object.defineProperty(Organization2.prototype, "validator", {
3519
4403
  get: function() {
3520
4404
  return validator;
3521
4405
  }
3522
4406
  });
3523
- Object.defineProperty(Property, "validProperties", {
4407
+ Object.defineProperty(Organization2, "validProperties", {
3524
4408
  value: Object.keys(schema.properties)
3525
4409
  });
3526
- module2.exports = Property;
4410
+ module2.exports = Organization2;
3527
4411
  }
3528
4412
  });
3529
4413
 
@@ -3536,14 +4420,16 @@ var Thermostat = require_thermostat2();
3536
4420
  var WindowCovering = require_windowCovering2();
3537
4421
  var Identification = require_identification2();
3538
4422
  var User = require_user2();
4423
+ var SystemUser = require_systemUser2();
3539
4424
  var Courtesy = require_courtesy2();
3540
4425
  var Camera = require_camera2();
3541
4426
  var MotionSensor = require_motionSensor2();
3542
4427
  var MediaSource = require_mediaSource2();
3543
4428
  var Room = require_room2();
3544
4429
  var Reservation = require_reservation2();
3545
- var Application = require_application2();
3546
4430
  var Space = require_space2();
4431
+ var SpaceType = require_spaceType2();
4432
+ var MediaFile = require_mediaFile2();
3547
4433
  var Ticket = require_ticket2();
3548
4434
  var Scene = require_scene2();
3549
4435
  var Gateway = require_gateway2();
@@ -3551,13 +4437,14 @@ var Product = require_product2();
3551
4437
  var DiscoveredDevice = require_discoveredDevice2();
3552
4438
  var Credential = require_credential2();
3553
4439
  var ShortLink = require_shortLink2();
3554
- var AdminCustomer = require_customer2();
3555
- var AdminProperty = require_property2();
4440
+ var EnergyReportShard = require_energyReportShard2();
4441
+ var EnergyReport = require_energyReport2();
4442
+ var SMSMessage = require_smsMessage2();
4443
+ var Property = require_property2();
4444
+ var Organization = require_organization2();
3556
4445
  module.exports = {
3557
- Admin: {
3558
- Customer: AdminCustomer,
3559
- Property: AdminProperty
3560
- },
4446
+ Organization,
4447
+ Property,
3561
4448
  Gateway,
3562
4449
  Switch,
3563
4450
  Alarm,
@@ -3572,13 +4459,18 @@ module.exports = {
3572
4459
  Identification,
3573
4460
  Product,
3574
4461
  User,
4462
+ SystemUser,
3575
4463
  Room,
3576
- Application,
3577
4464
  Space,
4465
+ SpaceType,
3578
4466
  Ticket,
3579
4467
  Scene,
3580
4468
  DiscoveredDevice,
3581
4469
  Reservation,
3582
4470
  Credential,
3583
- ShortLink
4471
+ ShortLink,
4472
+ EnergyReportShard,
4473
+ EnergyReport,
4474
+ SMSMessage,
4475
+ MediaFile
3584
4476
  };