@kohost/api-client 3.0.0-beta.4 → 3.0.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/cjs/AMQPClient.js +425 -0
- package/dist/cjs/Client.js +1187 -757
- package/dist/cjs/Commands.js +264 -93
- package/dist/cjs/Errors.js +24 -22
- package/dist/cjs/Events.js +200 -43
- package/dist/cjs/Models.js +1180 -520
- package/dist/cjs/SocketIoClient.js +66 -0
- package/dist/cjs/defs.js +37 -47
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/utils.js +253 -15
- package/dist/esm/Client.js +1490 -940
- package/dist/esm/Client.js.map +4 -4
- package/dist/esm/Commands.js +264 -93
- package/dist/esm/Commands.js.map +3 -3
- package/dist/esm/Errors.js +24 -22
- package/dist/esm/Errors.js.map +1 -1
- package/dist/esm/Events.js +200 -43
- package/dist/esm/Events.js.map +3 -3
- package/dist/esm/Models.js +1809 -530
- package/dist/esm/Models.js.map +4 -4
- package/dist/esm/SocketIoClient.js +4533 -0
- package/dist/esm/SocketIoClient.js.map +7 -0
- package/dist/esm/defs.js +383 -273
- package/dist/esm/defs.js.map +4 -4
- package/dist/esm/index.js +11 -10
- package/dist/esm/utils.js +636 -63
- package/dist/esm/utils.js.map +3 -3
- package/dist/useCases/AddDefaultScenesToRooms.js +2 -2
- package/dist/useCases/AddScenesToRoom.js +2 -2
- package/dist/useCases/AdminUpdateCustomer.js +32 -0
- package/dist/useCases/AssignSpaceToReservation.js +32 -0
- package/dist/useCases/BatchNotifyCheckIn.js +32 -0
- package/dist/useCases/BatchNotifyPreArrival.js +2 -2
- package/dist/useCases/CheckInReservation.js +2 -2
- package/dist/useCases/CheckVerificationCode.js +2 -2
- package/dist/useCases/CreateAlarm.js +2 -2
- package/dist/useCases/CreateCamera.js +2 -2
- package/dist/useCases/CreateCourtesy.js +2 -2
- package/dist/useCases/CreateDefaultScenes.js +2 -2
- package/dist/useCases/CreateDimmer.js +2 -2
- package/dist/useCases/CreateDiscoveredDevice.js +2 -2
- package/dist/useCases/CreateDiscoveredDeviceAssociation.js +2 -2
- package/dist/useCases/CreateLock.js +2 -2
- package/dist/useCases/{CreateSource.js → CreateMediaSource.js} +3 -3
- package/dist/useCases/CreateOrganization.js +32 -0
- package/dist/useCases/{AdminCreateProperty.js → CreateProperty.js} +3 -3
- package/dist/useCases/CreateReservation.js +2 -2
- package/dist/useCases/CreateRoom.js +2 -2
- package/dist/useCases/CreateRoomInSpace.js +2 -2
- package/dist/useCases/CreateSpace.js +2 -2
- package/dist/useCases/{CreateIntegration.js → CreateSpaceType.js} +3 -3
- package/dist/useCases/CreateSwitch.js +2 -2
- package/dist/useCases/CreateThermostat.js +2 -2
- package/dist/useCases/CreateTicket.js +2 -2
- package/dist/useCases/CreateTicketMessage.js +2 -2
- package/dist/useCases/CreateUser.js +2 -2
- package/dist/useCases/CreateWindowCovering.js +2 -2
- package/dist/useCases/DeleteAlarm.js +2 -2
- package/dist/useCases/DeleteCamera.js +2 -2
- package/dist/useCases/DeleteCourtesy.js +2 -2
- package/dist/useCases/DeleteDimmer.js +2 -2
- package/dist/useCases/DeleteDiscoveredDevice.js +2 -2
- package/dist/useCases/DeleteLock.js +2 -2
- package/dist/useCases/{DeleteSource.js → DeleteMediaSource.js} +3 -3
- package/dist/useCases/DeleteReservation.js +2 -2
- package/dist/useCases/DeleteRoom.js +2 -2
- package/dist/useCases/DeleteSpace.js +2 -2
- package/dist/useCases/DeleteSpaceType.js +32 -0
- package/dist/useCases/DeleteSwitch.js +2 -2
- package/dist/useCases/DeleteThermostat.js +2 -2
- package/dist/useCases/DeleteTicket.js +2 -2
- package/dist/useCases/DeleteUser.js +2 -2
- package/dist/useCases/DeleteWindowCovering.js +2 -2
- package/dist/useCases/DescribeAlarm.js +2 -2
- package/dist/useCases/DescribeCamera.js +2 -2
- package/dist/useCases/DescribeCourtesy.js +2 -2
- package/dist/useCases/DescribeDimmer.js +2 -2
- package/dist/useCases/DescribeDiscoveredDevice.js +2 -2
- package/dist/useCases/DescribeLock.js +2 -2
- package/dist/useCases/{DescribeSource.js → DescribeMediaSource.js} +3 -3
- package/dist/useCases/DescribeMyProperty.js +2 -2
- package/dist/useCases/{DeleteIntegration.js → DescribeOrganization.js} +3 -3
- package/dist/useCases/{DescribeIntegration.js → DescribeProperty.js} +3 -3
- package/dist/useCases/DescribeReservation.js +2 -2
- package/dist/useCases/DescribeReservationCheckinStatus.js +2 -2
- package/dist/useCases/DescribeRoom.js +2 -2
- package/dist/useCases/DescribeSelf.js +2 -2
- package/dist/useCases/DescribeSpace.js +2 -2
- package/dist/useCases/{AdminDescribeProperty.js → DescribeSpaceType.js} +3 -3
- package/dist/useCases/DescribeSwitch.js +2 -2
- package/dist/useCases/DescribeThermostat.js +2 -2
- package/dist/useCases/DescribeTicket.js +2 -2
- package/dist/useCases/DescribeUser.js +2 -2
- package/dist/useCases/DescribeWindowCovering.js +2 -2
- package/dist/useCases/DiscoverReservations.js +2 -2
- package/dist/useCases/EmailUserAccountSetup.js +2 -2
- package/dist/useCases/GetMobileKey.js +32 -0
- package/dist/useCases/ListAlarms.js +2 -2
- package/dist/useCases/ListCameras.js +2 -2
- package/dist/useCases/ListCourtesy.js +2 -2
- package/dist/useCases/ListDimmers.js +2 -2
- package/dist/useCases/ListDiscoveredDevices.js +2 -2
- package/dist/useCases/ListLocks.js +2 -2
- package/dist/useCases/{ListSources.js → ListMediaSources.js} +3 -3
- package/dist/useCases/ListMyReservations.js +2 -2
- package/dist/useCases/ListMySpaces.js +2 -2
- package/dist/useCases/ListMyTickets.js +32 -0
- package/dist/useCases/ListOrganizations.js +32 -0
- package/dist/useCases/{AdminListCustomers.js → ListProperties.js} +3 -3
- package/dist/useCases/ListReservations.js +2 -2
- package/dist/useCases/ListRooms.js +2 -2
- package/dist/useCases/ListRoomsInSpace.js +2 -2
- package/dist/useCases/{AdminListProperties.js → ListSpaceTypes.js} +3 -3
- package/dist/useCases/ListSpaces.js +2 -2
- package/dist/useCases/ListSwitches.js +2 -2
- package/dist/useCases/{ListIntegrations.js → ListTeam.js} +3 -3
- package/dist/useCases/ListThermostats.js +2 -2
- package/dist/useCases/ListTickets.js +2 -2
- package/dist/useCases/ListUserReservations.js +2 -2
- package/dist/useCases/ListUsers.js +2 -2
- package/dist/useCases/ListWindowCoverings.js +2 -2
- package/dist/useCases/LoginUser.js +2 -2
- package/dist/useCases/{CreateIntegrationDeviceMapEntry.js → LogoutUser.js} +3 -3
- package/dist/useCases/MatchUserIdentification.js +2 -2
- package/dist/useCases/OCRDocument.js +2 -2
- package/dist/useCases/RefreshToken.js +2 -2
- package/dist/useCases/RequestLoginLink.js +3 -3
- package/dist/useCases/RequestMyKeyToken.js +32 -0
- package/dist/useCases/SendCheckInSMS.js +32 -0
- package/dist/useCases/SendPreArrivalEmail.js +2 -2
- package/dist/useCases/SendPreArrivalSMS.js +2 -2
- package/dist/useCases/SendVerificationCode.js +2 -2
- package/dist/useCases/SetCamera.js +2 -2
- package/dist/useCases/SetCourtesy.js +2 -2
- package/dist/useCases/{SetSource.js → SetDimmer.js} +3 -3
- package/dist/useCases/SetLock.js +2 -2
- package/dist/useCases/SetMediaSource.js +32 -0
- package/dist/useCases/SetSwitch.js +2 -2
- package/dist/useCases/SetThermostat.js +2 -2
- package/dist/useCases/SetWindowCovering.js +2 -2
- package/dist/useCases/UpdateAlarm.js +2 -2
- package/dist/useCases/UpdateCamera.js +2 -2
- package/dist/useCases/UpdateCourtesy.js +2 -2
- package/dist/useCases/UpdateDimmer.js +2 -2
- package/dist/useCases/UpdateDiscoveredDevice.js +2 -2
- package/dist/useCases/UpdateLock.js +2 -2
- package/dist/useCases/{UpdateSource.js → UpdateMediaSource.js} +3 -3
- package/dist/useCases/UpdateMessageReadStatus.js +2 -2
- package/dist/useCases/{AdminUpdateProperty.js → UpdateProperty.js} +3 -3
- package/dist/useCases/UpdateReservation.js +2 -2
- package/dist/useCases/UpdateRoom.js +2 -2
- package/dist/useCases/UpdateSelf.js +2 -2
- package/dist/useCases/UpdateSpace.js +2 -2
- package/dist/useCases/{UpdateIntegration.js → UpdateSpaceType.js} +3 -3
- package/dist/useCases/UpdateSwitch.js +2 -2
- package/dist/useCases/UpdateThermostat.js +2 -2
- package/dist/useCases/UpdateTicket.js +2 -2
- package/dist/useCases/UpdateTicketStatus.js +2 -2
- package/dist/useCases/UpdateUser.js +2 -2
- package/dist/useCases/UpdateWindowCovering.js +2 -2
- package/dist/useCases/UpsertDiscoveredDevice.js +2 -2
- package/package.json +14 -3
package/dist/cjs/Models.js
CHANGED
|
@@ -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.
|
|
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",
|
|
@@ -77,6 +82,30 @@ var require_common = __commonJS({
|
|
|
77
82
|
maxLength: 2
|
|
78
83
|
}
|
|
79
84
|
}
|
|
85
|
+
},
|
|
86
|
+
driver: {
|
|
87
|
+
type: "string",
|
|
88
|
+
enum: [
|
|
89
|
+
"aws-kinesis",
|
|
90
|
+
"butler",
|
|
91
|
+
"crestron",
|
|
92
|
+
"ecobee",
|
|
93
|
+
"igor",
|
|
94
|
+
"inncom",
|
|
95
|
+
"kohost-k7",
|
|
96
|
+
"kohost-pms",
|
|
97
|
+
"lg",
|
|
98
|
+
"lirc",
|
|
99
|
+
"mews",
|
|
100
|
+
"pelican-wireless",
|
|
101
|
+
"rebrandly",
|
|
102
|
+
"salto",
|
|
103
|
+
"salto-irn",
|
|
104
|
+
"se",
|
|
105
|
+
"sendgrid",
|
|
106
|
+
"stay-n-touch",
|
|
107
|
+
"twilio"
|
|
108
|
+
]
|
|
80
109
|
}
|
|
81
110
|
}
|
|
82
111
|
};
|
|
@@ -88,17 +117,18 @@ var require_device = __commonJS({
|
|
|
88
117
|
"src/schemas/definitions/device.json"(exports2, module2) {
|
|
89
118
|
module2.exports = {
|
|
90
119
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
91
|
-
$id: "https://api.kohost.
|
|
120
|
+
$id: "https://api.kohost.io/schemas/v3/definitions/device.json",
|
|
92
121
|
definitions: {
|
|
93
122
|
id: {
|
|
94
|
-
$ref: "https://api.kohost.
|
|
123
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
95
124
|
},
|
|
96
125
|
systemData: {
|
|
97
|
-
$ref: "https://api.kohost.
|
|
126
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
98
127
|
},
|
|
99
128
|
type: {
|
|
100
129
|
type: "string",
|
|
101
130
|
enum: [
|
|
131
|
+
"alarm",
|
|
102
132
|
"dimmer",
|
|
103
133
|
"switch",
|
|
104
134
|
"motionSensor",
|
|
@@ -108,8 +138,13 @@ var require_device = __commonJS({
|
|
|
108
138
|
"thermostat",
|
|
109
139
|
"lock",
|
|
110
140
|
"courtesy",
|
|
111
|
-
"
|
|
112
|
-
"
|
|
141
|
+
"gateway",
|
|
142
|
+
"tv",
|
|
143
|
+
"dvr",
|
|
144
|
+
"appleTv",
|
|
145
|
+
"discPlayer",
|
|
146
|
+
"mediaPlayer",
|
|
147
|
+
"uncontrolledDevice"
|
|
113
148
|
]
|
|
114
149
|
},
|
|
115
150
|
name: {
|
|
@@ -138,7 +173,11 @@ var require_device = __commonJS({
|
|
|
138
173
|
"softwareFailure",
|
|
139
174
|
"hardwareFailureWithCode",
|
|
140
175
|
"softwareFailureWithCode",
|
|
141
|
-
"motionDetection"
|
|
176
|
+
"motionDetection",
|
|
177
|
+
"airFilterNeedsCleaned",
|
|
178
|
+
"smokeDetected",
|
|
179
|
+
"outsideSafeTemperatureRange",
|
|
180
|
+
"outsideSafeHumidityRange"
|
|
142
181
|
]
|
|
143
182
|
}
|
|
144
183
|
},
|
|
@@ -152,6 +191,9 @@ var require_device = __commonJS({
|
|
|
152
191
|
timestamp: {
|
|
153
192
|
type: "number",
|
|
154
193
|
minimum: 1655907956593
|
|
194
|
+
},
|
|
195
|
+
description: {
|
|
196
|
+
type: "string"
|
|
155
197
|
}
|
|
156
198
|
}
|
|
157
199
|
},
|
|
@@ -159,6 +201,10 @@ var require_device = __commonJS({
|
|
|
159
201
|
type: "number",
|
|
160
202
|
minimum: 0,
|
|
161
203
|
maximum: 100
|
|
204
|
+
},
|
|
205
|
+
watts: {
|
|
206
|
+
type: "number",
|
|
207
|
+
minimum: 0
|
|
162
208
|
}
|
|
163
209
|
}
|
|
164
210
|
};
|
|
@@ -184,12 +230,12 @@ var require_schema = __commonJS({
|
|
|
184
230
|
ajv.addSchema(commonDefs);
|
|
185
231
|
ajv.addSchema(deviceDefs);
|
|
186
232
|
module2.exports = {
|
|
187
|
-
add: function add(schema) {
|
|
233
|
+
add: /* @__PURE__ */ __name(function add(schema) {
|
|
188
234
|
ajv.addSchema(schema);
|
|
189
|
-
},
|
|
190
|
-
compile: function compile(schema) {
|
|
235
|
+
}, "add"),
|
|
236
|
+
compile: /* @__PURE__ */ __name(function compile(schema) {
|
|
191
237
|
return ajv.compile(schema);
|
|
192
|
-
}
|
|
238
|
+
}, "compile")
|
|
193
239
|
};
|
|
194
240
|
}
|
|
195
241
|
});
|
|
@@ -199,36 +245,45 @@ var require_switch = __commonJS({
|
|
|
199
245
|
"src/schemas/switch.json"(exports2, module2) {
|
|
200
246
|
module2.exports = {
|
|
201
247
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
202
|
-
$id: "https://api.kohost.
|
|
248
|
+
$id: "https://api.kohost.io/schemas/v3/switch.json",
|
|
203
249
|
title: "Switch",
|
|
204
250
|
description: "Any smart switch",
|
|
205
251
|
type: "object",
|
|
206
252
|
properties: {
|
|
207
253
|
id: {
|
|
208
|
-
$ref: "https://api.kohost.
|
|
254
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
255
|
+
},
|
|
256
|
+
name: {
|
|
257
|
+
type: "string"
|
|
209
258
|
},
|
|
210
259
|
type: {
|
|
211
|
-
$ref: "https://api.kohost.
|
|
260
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
212
261
|
},
|
|
213
262
|
subType: {
|
|
214
|
-
$ref: "https://api.kohost.
|
|
263
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
|
|
215
264
|
},
|
|
216
265
|
supportedNotifications: {
|
|
217
|
-
$ref: "https://api.kohost.
|
|
266
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
218
267
|
},
|
|
219
268
|
notification: {
|
|
220
|
-
$ref: "https://api.kohost.
|
|
269
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
270
|
+
},
|
|
271
|
+
driver: {
|
|
272
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
221
273
|
},
|
|
222
274
|
state: {
|
|
223
275
|
type: "string",
|
|
224
276
|
enum: ["on", "off"]
|
|
225
277
|
},
|
|
226
278
|
systemData: {
|
|
227
|
-
$ref: "https://api.kohost.
|
|
279
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
280
|
+
},
|
|
281
|
+
watts: {
|
|
282
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
228
283
|
}
|
|
229
284
|
},
|
|
230
285
|
additionalProperties: false,
|
|
231
|
-
required: ["id", "type", "systemData", "state"]
|
|
286
|
+
required: ["id", "type", "systemData", "state", "driver"]
|
|
232
287
|
};
|
|
233
288
|
}
|
|
234
289
|
});
|
|
@@ -236,14 +291,14 @@ var require_switch = __commonJS({
|
|
|
236
291
|
// src/Errors/AppError.js
|
|
237
292
|
var require_AppError = __commonJS({
|
|
238
293
|
"src/Errors/AppError.js"(exports2, module2) {
|
|
239
|
-
module2.exports = class AppError extends Error {
|
|
294
|
+
module2.exports = /* @__PURE__ */ __name(class AppError extends Error {
|
|
240
295
|
constructor(message = "Internal Server Error", options) {
|
|
241
296
|
super(message, options);
|
|
242
297
|
this.type = this.constructor.name;
|
|
243
298
|
this.statusCode = 500;
|
|
244
299
|
Object.setPrototypeOf(this, AppError.prototype);
|
|
245
300
|
}
|
|
246
|
-
};
|
|
301
|
+
}, "AppError");
|
|
247
302
|
}
|
|
248
303
|
});
|
|
249
304
|
|
|
@@ -251,13 +306,13 @@ var require_AppError = __commonJS({
|
|
|
251
306
|
var require_AuthenticationError = __commonJS({
|
|
252
307
|
"src/Errors/AuthenticationError.js"(exports2, module2) {
|
|
253
308
|
var AppError = require_AppError();
|
|
254
|
-
module2.exports = class AuthenticationError extends AppError {
|
|
309
|
+
module2.exports = /* @__PURE__ */ __name(class AuthenticationError extends AppError {
|
|
255
310
|
constructor(message = "Authentication Error", options = {}) {
|
|
256
311
|
super(message, options);
|
|
257
312
|
this.statusCode = 401;
|
|
258
313
|
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
259
314
|
}
|
|
260
|
-
};
|
|
315
|
+
}, "AuthenticationError");
|
|
261
316
|
}
|
|
262
317
|
});
|
|
263
318
|
|
|
@@ -265,13 +320,13 @@ var require_AuthenticationError = __commonJS({
|
|
|
265
320
|
var require_AuthorizationError = __commonJS({
|
|
266
321
|
"src/Errors/AuthorizationError.js"(exports2, module2) {
|
|
267
322
|
var AppError = require_AppError();
|
|
268
|
-
module2.exports = class AuthorizationError extends AppError {
|
|
323
|
+
module2.exports = /* @__PURE__ */ __name(class AuthorizationError extends AppError {
|
|
269
324
|
constructor(message = "Authorization Error", options = {}) {
|
|
270
325
|
super(message, options);
|
|
271
326
|
this.statusCode = 403;
|
|
272
327
|
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
273
328
|
}
|
|
274
|
-
};
|
|
329
|
+
}, "AuthorizationError");
|
|
275
330
|
}
|
|
276
331
|
});
|
|
277
332
|
|
|
@@ -279,13 +334,13 @@ var require_AuthorizationError = __commonJS({
|
|
|
279
334
|
var require_DeviceCommError = __commonJS({
|
|
280
335
|
"src/Errors/DeviceCommError.js"(exports2, module2) {
|
|
281
336
|
var AppError = require_AppError();
|
|
282
|
-
module2.exports = class DeviceCommError extends AppError {
|
|
337
|
+
module2.exports = /* @__PURE__ */ __name(class DeviceCommError extends AppError {
|
|
283
338
|
constructor(message = "Device Communication Error", options = {}) {
|
|
284
339
|
super(message, options);
|
|
285
340
|
this.statusCode = 503;
|
|
286
341
|
Object.setPrototypeOf(this, DeviceCommError.prototype);
|
|
287
342
|
}
|
|
288
|
-
};
|
|
343
|
+
}, "DeviceCommError");
|
|
289
344
|
}
|
|
290
345
|
});
|
|
291
346
|
|
|
@@ -293,13 +348,13 @@ var require_DeviceCommError = __commonJS({
|
|
|
293
348
|
var require_LoginError = __commonJS({
|
|
294
349
|
"src/Errors/LoginError.js"(exports2, module2) {
|
|
295
350
|
var AppError = require_AppError();
|
|
296
|
-
module2.exports = class LoginError extends AppError {
|
|
351
|
+
module2.exports = /* @__PURE__ */ __name(class LoginError extends AppError {
|
|
297
352
|
constructor(message = "Invalid Login information provided", options = {}) {
|
|
298
353
|
super(message, options);
|
|
299
354
|
this.statusCode = 401;
|
|
300
355
|
Object.setPrototypeOf(this, LoginError.prototype);
|
|
301
356
|
}
|
|
302
|
-
};
|
|
357
|
+
}, "LoginError");
|
|
303
358
|
}
|
|
304
359
|
});
|
|
305
360
|
|
|
@@ -307,13 +362,13 @@ var require_LoginError = __commonJS({
|
|
|
307
362
|
var require_NotFoundError = __commonJS({
|
|
308
363
|
"src/Errors/NotFoundError.js"(exports2, module2) {
|
|
309
364
|
var AppError = require_AppError();
|
|
310
|
-
module2.exports = class NotFoundError extends AppError {
|
|
365
|
+
module2.exports = /* @__PURE__ */ __name(class NotFoundError extends AppError {
|
|
311
366
|
constructor(message = "Resource Not Found", options = {}) {
|
|
312
367
|
super(message, options);
|
|
313
368
|
this.statusCode = 404;
|
|
314
369
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
315
370
|
}
|
|
316
|
-
};
|
|
371
|
+
}, "NotFoundError");
|
|
317
372
|
}
|
|
318
373
|
});
|
|
319
374
|
|
|
@@ -321,13 +376,13 @@ var require_NotFoundError = __commonJS({
|
|
|
321
376
|
var require_RequestError = __commonJS({
|
|
322
377
|
"src/Errors/RequestError.js"(exports2, module2) {
|
|
323
378
|
var AppError = require_AppError();
|
|
324
|
-
module2.exports = class RequestError extends AppError {
|
|
379
|
+
module2.exports = /* @__PURE__ */ __name(class RequestError extends AppError {
|
|
325
380
|
constructor(message = "Bad Request", options = {}) {
|
|
326
381
|
super(message, options);
|
|
327
382
|
this.statusCode = 400;
|
|
328
383
|
Object.setPrototypeOf(this, RequestError.prototype);
|
|
329
384
|
}
|
|
330
|
-
};
|
|
385
|
+
}, "RequestError");
|
|
331
386
|
}
|
|
332
387
|
});
|
|
333
388
|
|
|
@@ -335,13 +390,13 @@ var require_RequestError = __commonJS({
|
|
|
335
390
|
var require_SystemCommError = __commonJS({
|
|
336
391
|
"src/Errors/SystemCommError.js"(exports2, module2) {
|
|
337
392
|
var AppError = require_AppError();
|
|
338
|
-
module2.exports = class SystemCommError extends AppError {
|
|
393
|
+
module2.exports = /* @__PURE__ */ __name(class SystemCommError extends AppError {
|
|
339
394
|
constructor(message = "System Communication Error", options = {}) {
|
|
340
395
|
super(message, options);
|
|
341
396
|
this.statusCode = 503;
|
|
342
397
|
Object.setPrototypeOf(this, SystemCommError.prototype);
|
|
343
398
|
}
|
|
344
|
-
};
|
|
399
|
+
}, "SystemCommError");
|
|
345
400
|
}
|
|
346
401
|
});
|
|
347
402
|
|
|
@@ -349,13 +404,13 @@ var require_SystemCommError = __commonJS({
|
|
|
349
404
|
var require_TokenExpiredError = __commonJS({
|
|
350
405
|
"src/Errors/TokenExpiredError.js"(exports2, module2) {
|
|
351
406
|
var AppError = require_AppError();
|
|
352
|
-
module2.exports = class TokenExpiredError extends AppError {
|
|
407
|
+
module2.exports = /* @__PURE__ */ __name(class TokenExpiredError extends AppError {
|
|
353
408
|
constructor(message = "Token Expired", options = {}) {
|
|
354
409
|
super(message, options);
|
|
355
410
|
this.statusCode = 401;
|
|
356
411
|
Object.setPrototypeOf(this, TokenExpiredError.prototype);
|
|
357
412
|
}
|
|
358
|
-
};
|
|
413
|
+
}, "TokenExpiredError");
|
|
359
414
|
}
|
|
360
415
|
});
|
|
361
416
|
|
|
@@ -363,13 +418,13 @@ var require_TokenExpiredError = __commonJS({
|
|
|
363
418
|
var require_UnprocessableRequestError = __commonJS({
|
|
364
419
|
"src/Errors/UnprocessableRequestError.js"(exports2, module2) {
|
|
365
420
|
var AppError = require_AppError();
|
|
366
|
-
module2.exports = class UnprocessableRequestError extends AppError {
|
|
421
|
+
module2.exports = /* @__PURE__ */ __name(class UnprocessableRequestError extends AppError {
|
|
367
422
|
constructor(message = "Unprocessable Request Error", options = {}) {
|
|
368
423
|
super(message, options);
|
|
369
424
|
this.statusCode = 422;
|
|
370
425
|
Object.setPrototypeOf(this, UnprocessableRequestError.prototype);
|
|
371
426
|
}
|
|
372
|
-
};
|
|
427
|
+
}, "UnprocessableRequestError");
|
|
373
428
|
}
|
|
374
429
|
});
|
|
375
430
|
|
|
@@ -377,13 +432,13 @@ var require_UnprocessableRequestError = __commonJS({
|
|
|
377
432
|
var require_ValidationError = __commonJS({
|
|
378
433
|
"src/Errors/ValidationError.js"(exports2, module2) {
|
|
379
434
|
var AppError = require_AppError();
|
|
380
|
-
module2.exports = class ValidationError extends AppError {
|
|
435
|
+
module2.exports = /* @__PURE__ */ __name(class ValidationError extends AppError {
|
|
381
436
|
constructor(message = "Validation Error", options = {}) {
|
|
382
437
|
super(message, options);
|
|
383
438
|
this.statusCode = 400;
|
|
384
439
|
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
385
440
|
}
|
|
386
|
-
};
|
|
441
|
+
}, "ValidationError");
|
|
387
442
|
}
|
|
388
443
|
});
|
|
389
444
|
|
|
@@ -420,7 +475,7 @@ var require_kohost = __commonJS({
|
|
|
420
475
|
if (!this.validator) {
|
|
421
476
|
throw new Error("Validator is not defined");
|
|
422
477
|
}
|
|
423
|
-
const isNew =
|
|
478
|
+
const isNew = data?.id ? false : true;
|
|
424
479
|
this._setId(data);
|
|
425
480
|
this._validate(data);
|
|
426
481
|
this._setProperties(data);
|
|
@@ -447,7 +502,7 @@ var require_kohost = __commonJS({
|
|
|
447
502
|
});
|
|
448
503
|
}
|
|
449
504
|
_setTimestamps(isNew) {
|
|
450
|
-
const now = new Date();
|
|
505
|
+
const now = /* @__PURE__ */ new Date();
|
|
451
506
|
if (isNew && this.schemaProperties.includes("createdAt") && !this.createdAt) {
|
|
452
507
|
this.createdAt = now;
|
|
453
508
|
}
|
|
@@ -467,10 +522,9 @@ var require_kohost = __commonJS({
|
|
|
467
522
|
return id;
|
|
468
523
|
}
|
|
469
524
|
static getActionDelta(old, _new) {
|
|
470
|
-
var _a;
|
|
471
525
|
const delta = {};
|
|
472
526
|
for (const action in _new) {
|
|
473
|
-
if (
|
|
527
|
+
if (this.actionProperties?.includes(action)) {
|
|
474
528
|
if (old[action] !== _new[action]) {
|
|
475
529
|
delta[action] = 1;
|
|
476
530
|
}
|
|
@@ -488,6 +542,7 @@ var require_kohost = __commonJS({
|
|
|
488
542
|
return obj;
|
|
489
543
|
}
|
|
490
544
|
};
|
|
545
|
+
__name(Kohost, "Kohost");
|
|
491
546
|
module2.exports = Kohost;
|
|
492
547
|
}
|
|
493
548
|
});
|
|
@@ -505,6 +560,7 @@ var require_switch2 = __commonJS({
|
|
|
505
560
|
super(data);
|
|
506
561
|
}
|
|
507
562
|
};
|
|
563
|
+
__name(Switch2, "Switch");
|
|
508
564
|
Object.defineProperty(Switch2.prototype, "schema", {
|
|
509
565
|
value: schema
|
|
510
566
|
});
|
|
@@ -528,25 +584,31 @@ var require_alarm = __commonJS({
|
|
|
528
584
|
"src/schemas/alarm.json"(exports2, module2) {
|
|
529
585
|
module2.exports = {
|
|
530
586
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
531
|
-
$id: "https://api.kohost.
|
|
587
|
+
$id: "https://api.kohost.io/schemas/v3/alarm.json",
|
|
532
588
|
title: "Alarm",
|
|
533
589
|
description: "Any smart alarm system",
|
|
534
590
|
type: "object",
|
|
535
591
|
properties: {
|
|
536
592
|
id: {
|
|
537
|
-
$ref: "https://api.kohost.
|
|
593
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
594
|
+
},
|
|
595
|
+
name: {
|
|
596
|
+
type: "string"
|
|
538
597
|
},
|
|
539
598
|
type: {
|
|
540
|
-
$ref: "https://api.kohost.
|
|
599
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
541
600
|
},
|
|
542
601
|
systemData: {
|
|
543
|
-
$ref: "https://api.kohost.
|
|
602
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
544
603
|
},
|
|
545
604
|
supportedNotifications: {
|
|
546
|
-
$ref: "https://api.kohost.
|
|
605
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
547
606
|
},
|
|
548
607
|
notification: {
|
|
549
|
-
$ref: "https://api.kohost.
|
|
608
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
609
|
+
},
|
|
610
|
+
driver: {
|
|
611
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
550
612
|
},
|
|
551
613
|
areas: {
|
|
552
614
|
type: "array",
|
|
@@ -606,6 +668,9 @@ var require_alarm = __commonJS({
|
|
|
606
668
|
items: {
|
|
607
669
|
$ref: "#/properties/supportedTroubles/items"
|
|
608
670
|
}
|
|
671
|
+
},
|
|
672
|
+
watts: {
|
|
673
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
609
674
|
}
|
|
610
675
|
},
|
|
611
676
|
additionalProperties: false,
|
|
@@ -616,7 +681,8 @@ var require_alarm = __commonJS({
|
|
|
616
681
|
"areas",
|
|
617
682
|
"zones",
|
|
618
683
|
"supportedTroubles",
|
|
619
|
-
"troubles"
|
|
684
|
+
"troubles",
|
|
685
|
+
"driver"
|
|
620
686
|
]
|
|
621
687
|
};
|
|
622
688
|
}
|
|
@@ -635,6 +701,7 @@ var require_alarm2 = __commonJS({
|
|
|
635
701
|
super(data);
|
|
636
702
|
}
|
|
637
703
|
};
|
|
704
|
+
__name(Alarm2, "Alarm");
|
|
638
705
|
Object.defineProperty(Alarm2.prototype, "schema", {
|
|
639
706
|
value: schema
|
|
640
707
|
});
|
|
@@ -655,25 +722,31 @@ var require_dimmer = __commonJS({
|
|
|
655
722
|
"src/schemas/dimmer.json"(exports2, module2) {
|
|
656
723
|
module2.exports = {
|
|
657
724
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
658
|
-
$id: "https://api.kohost.
|
|
725
|
+
$id: "https://api.kohost.io/schemas/v3/dimmer.json",
|
|
659
726
|
title: "Dimmer",
|
|
660
727
|
description: "Any smart dimmer",
|
|
661
728
|
type: "object",
|
|
662
729
|
properties: {
|
|
663
730
|
id: {
|
|
664
|
-
$ref: "https://api.kohost.
|
|
731
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
732
|
+
},
|
|
733
|
+
name: {
|
|
734
|
+
type: "string"
|
|
665
735
|
},
|
|
666
736
|
type: {
|
|
667
|
-
$ref: "https://api.kohost.
|
|
737
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
668
738
|
},
|
|
669
739
|
subType: {
|
|
670
|
-
$ref: "https://api.kohost.
|
|
740
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
|
|
671
741
|
},
|
|
672
742
|
supportedNotifications: {
|
|
673
|
-
$ref: "https://api.kohost.
|
|
743
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
674
744
|
},
|
|
675
745
|
notification: {
|
|
676
|
-
$ref: "https://api.kohost.
|
|
746
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
747
|
+
},
|
|
748
|
+
driver: {
|
|
749
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
677
750
|
},
|
|
678
751
|
level: {
|
|
679
752
|
type: "number",
|
|
@@ -681,11 +754,14 @@ var require_dimmer = __commonJS({
|
|
|
681
754
|
maximum: 100
|
|
682
755
|
},
|
|
683
756
|
systemData: {
|
|
684
|
-
$ref: "https://api.kohost.
|
|
757
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
758
|
+
},
|
|
759
|
+
watts: {
|
|
760
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
685
761
|
}
|
|
686
762
|
},
|
|
687
763
|
additionalProperties: false,
|
|
688
|
-
required: ["id", "type", "systemData", "level"]
|
|
764
|
+
required: ["id", "type", "systemData", "level", "driver"]
|
|
689
765
|
};
|
|
690
766
|
}
|
|
691
767
|
});
|
|
@@ -703,10 +779,9 @@ var require_dimmer2 = __commonJS({
|
|
|
703
779
|
super(data);
|
|
704
780
|
}
|
|
705
781
|
static getActionDelta(old, _new) {
|
|
706
|
-
var _a;
|
|
707
782
|
const delta = {};
|
|
708
783
|
for (const action in _new) {
|
|
709
|
-
if (
|
|
784
|
+
if (this.actionProperties?.includes(action)) {
|
|
710
785
|
if (action === "level") {
|
|
711
786
|
const oldLevel = old[action];
|
|
712
787
|
const newLevel = _new[action];
|
|
@@ -719,6 +794,7 @@ var require_dimmer2 = __commonJS({
|
|
|
719
794
|
return delta;
|
|
720
795
|
}
|
|
721
796
|
};
|
|
797
|
+
__name(Dimmer2, "Dimmer");
|
|
722
798
|
Object.defineProperty(Dimmer2.prototype, "schema", {
|
|
723
799
|
value: schema
|
|
724
800
|
});
|
|
@@ -742,39 +818,45 @@ var require_lock = __commonJS({
|
|
|
742
818
|
"src/schemas/lock.json"(exports2, module2) {
|
|
743
819
|
module2.exports = {
|
|
744
820
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
745
|
-
$id: "https://api.kohost.
|
|
821
|
+
$id: "https://api.kohost.io/schemas/v3/lock.json",
|
|
746
822
|
title: "Lock",
|
|
747
823
|
description: "Any smart lock",
|
|
748
824
|
type: "object",
|
|
749
825
|
properties: {
|
|
750
826
|
id: {
|
|
751
|
-
$ref: "https://api.kohost.
|
|
827
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
752
828
|
},
|
|
753
829
|
name: {
|
|
754
830
|
type: "string"
|
|
755
831
|
},
|
|
756
832
|
type: {
|
|
757
|
-
$ref: "https://api.kohost.
|
|
758
|
-
},
|
|
759
|
-
subType: {
|
|
760
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
|
|
833
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
761
834
|
},
|
|
762
835
|
supportedNotifications: {
|
|
763
|
-
$ref: "https://api.kohost.
|
|
836
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
764
837
|
},
|
|
765
838
|
notification: {
|
|
766
|
-
$ref: "https://api.kohost.
|
|
839
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
840
|
+
},
|
|
841
|
+
driver: {
|
|
842
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
767
843
|
},
|
|
768
844
|
state: {
|
|
769
|
-
type: "string",
|
|
770
|
-
enum: ["locked", "unlocked"]
|
|
845
|
+
type: ["string", "null"],
|
|
846
|
+
enum: ["locked", "unlocked", null]
|
|
847
|
+
},
|
|
848
|
+
batteryLevel: {
|
|
849
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/batteryLevel"
|
|
771
850
|
},
|
|
772
851
|
systemData: {
|
|
773
|
-
$ref: "https://api.kohost.
|
|
852
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
853
|
+
},
|
|
854
|
+
watts: {
|
|
855
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
774
856
|
}
|
|
775
857
|
},
|
|
776
858
|
additionalProperties: false,
|
|
777
|
-
required: ["id", "type", "systemData", "state"]
|
|
859
|
+
required: ["id", "type", "systemData", "state", "driver"]
|
|
778
860
|
};
|
|
779
861
|
}
|
|
780
862
|
});
|
|
@@ -792,6 +874,7 @@ var require_lock2 = __commonJS({
|
|
|
792
874
|
super(data);
|
|
793
875
|
}
|
|
794
876
|
};
|
|
877
|
+
__name(Lock2, "Lock");
|
|
795
878
|
Object.defineProperty(Lock2.prototype, "schema", {
|
|
796
879
|
value: schema
|
|
797
880
|
});
|
|
@@ -815,29 +898,32 @@ var require_thermostat = __commonJS({
|
|
|
815
898
|
"src/schemas/thermostat.json"(exports2, module2) {
|
|
816
899
|
module2.exports = {
|
|
817
900
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
818
|
-
$id: "https://api.kohost.
|
|
901
|
+
$id: "https://api.kohost.io/schemas/v3/thermostat.json",
|
|
819
902
|
title: "Thermostat",
|
|
820
903
|
description: "Any smart thermostat",
|
|
821
904
|
type: "object",
|
|
822
905
|
properties: {
|
|
823
906
|
id: {
|
|
824
|
-
$ref: "https://api.kohost.
|
|
907
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
825
908
|
},
|
|
826
909
|
name: {
|
|
827
|
-
$ref: "https://api.kohost.
|
|
910
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/name"
|
|
828
911
|
},
|
|
829
912
|
type: {
|
|
830
|
-
$ref: "https://api.kohost.
|
|
913
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type",
|
|
831
914
|
default: "thermostat"
|
|
832
915
|
},
|
|
833
|
-
|
|
834
|
-
$ref: "https://api.kohost.
|
|
916
|
+
driver: {
|
|
917
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
918
|
+
},
|
|
919
|
+
offline: {
|
|
920
|
+
type: "boolean"
|
|
835
921
|
},
|
|
836
922
|
supportedNotifications: {
|
|
837
|
-
$ref: "https://api.kohost.
|
|
923
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
838
924
|
},
|
|
839
925
|
notification: {
|
|
840
|
-
$ref: "https://api.kohost.
|
|
926
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
841
927
|
},
|
|
842
928
|
currentTemperature: {
|
|
843
929
|
type: "number"
|
|
@@ -852,16 +938,16 @@ var require_thermostat = __commonJS({
|
|
|
852
938
|
$ref: "#/properties/supportedHvacModes/items"
|
|
853
939
|
},
|
|
854
940
|
hvacState: {
|
|
855
|
-
type: "string",
|
|
856
|
-
enum: ["cooling", "heating", "off"]
|
|
941
|
+
type: ["string", "null"],
|
|
942
|
+
enum: ["cooling", "heating", "off", null]
|
|
857
943
|
},
|
|
858
944
|
fanMode: {
|
|
859
945
|
type: "string",
|
|
860
946
|
$ref: "#/properties/supportedFanModes/items"
|
|
861
947
|
},
|
|
862
948
|
fanState: {
|
|
863
|
-
type: "string",
|
|
864
|
-
enum: ["off", "low", "medium", "high"]
|
|
949
|
+
type: ["string", "null"],
|
|
950
|
+
enum: ["off", "low", "medium", "high", "on", null]
|
|
865
951
|
},
|
|
866
952
|
temperatureScale: {
|
|
867
953
|
type: "string",
|
|
@@ -884,7 +970,7 @@ var require_thermostat = __commonJS({
|
|
|
884
970
|
type: "array",
|
|
885
971
|
uniqueItems: true,
|
|
886
972
|
items: {
|
|
887
|
-
enum: ["auto", "low", "medium", "high", "off"]
|
|
973
|
+
enum: ["auto", "low", "medium", "high", "off", "on"]
|
|
888
974
|
}
|
|
889
975
|
},
|
|
890
976
|
setpoints: {
|
|
@@ -902,12 +988,22 @@ var require_thermostat = __commonJS({
|
|
|
902
988
|
}
|
|
903
989
|
}
|
|
904
990
|
},
|
|
991
|
+
minAutoDelta: {
|
|
992
|
+
type: "number",
|
|
993
|
+
default: 3
|
|
994
|
+
},
|
|
995
|
+
cycleRate: {
|
|
996
|
+
type: "number"
|
|
997
|
+
},
|
|
905
998
|
batteryLevel: {
|
|
906
|
-
$ref: "https://api.kohost.
|
|
999
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/batteryLevel"
|
|
907
1000
|
},
|
|
908
1001
|
systemData: {
|
|
909
|
-
$ref: "https://api.kohost.
|
|
1002
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData",
|
|
910
1003
|
default: {}
|
|
1004
|
+
},
|
|
1005
|
+
watts: {
|
|
1006
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
911
1007
|
}
|
|
912
1008
|
},
|
|
913
1009
|
additionalProperties: false,
|
|
@@ -949,7 +1045,8 @@ var require_thermostat = __commonJS({
|
|
|
949
1045
|
"setpoints",
|
|
950
1046
|
"temperatureScale",
|
|
951
1047
|
"supportedHvacModes",
|
|
952
|
-
"supportedFanModes"
|
|
1048
|
+
"supportedFanModes",
|
|
1049
|
+
"driver"
|
|
953
1050
|
]
|
|
954
1051
|
};
|
|
955
1052
|
}
|
|
@@ -1009,6 +1106,7 @@ var require_thermostat2 = __commonJS({
|
|
|
1009
1106
|
return delta;
|
|
1010
1107
|
}
|
|
1011
1108
|
};
|
|
1109
|
+
__name(Thermostat2, "Thermostat");
|
|
1012
1110
|
Object.defineProperty(Thermostat2.prototype, "schema", {
|
|
1013
1111
|
value: schema
|
|
1014
1112
|
});
|
|
@@ -1032,25 +1130,31 @@ var require_windowCovering = __commonJS({
|
|
|
1032
1130
|
"src/schemas/windowCovering.json"(exports2, module2) {
|
|
1033
1131
|
module2.exports = {
|
|
1034
1132
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1035
|
-
$id: "https://api.kohost.
|
|
1133
|
+
$id: "https://api.kohost.io/schemas/v3/windowCovering.json",
|
|
1036
1134
|
title: "Window Covering",
|
|
1037
1135
|
description: "Any smart window covering",
|
|
1038
1136
|
type: "object",
|
|
1039
1137
|
properties: {
|
|
1040
1138
|
id: {
|
|
1041
|
-
$ref: "https://api.kohost.
|
|
1139
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
1140
|
+
},
|
|
1141
|
+
name: {
|
|
1142
|
+
type: "string"
|
|
1042
1143
|
},
|
|
1043
1144
|
type: {
|
|
1044
|
-
$ref: "https://api.kohost.
|
|
1145
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
1045
1146
|
},
|
|
1046
1147
|
subType: {
|
|
1047
|
-
$ref: "https://api.kohost.
|
|
1148
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/subType"
|
|
1048
1149
|
},
|
|
1049
1150
|
supportedNotifications: {
|
|
1050
|
-
$ref: "https://api.kohost.
|
|
1151
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
1051
1152
|
},
|
|
1052
1153
|
notification: {
|
|
1053
|
-
$ref: "https://api.kohost.
|
|
1154
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
1155
|
+
},
|
|
1156
|
+
driver: {
|
|
1157
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
1054
1158
|
},
|
|
1055
1159
|
position: {
|
|
1056
1160
|
type: "number",
|
|
@@ -1058,11 +1162,14 @@ var require_windowCovering = __commonJS({
|
|
|
1058
1162
|
maximum: 100
|
|
1059
1163
|
},
|
|
1060
1164
|
systemData: {
|
|
1061
|
-
$ref: "https://api.kohost.
|
|
1165
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
1166
|
+
},
|
|
1167
|
+
watts: {
|
|
1168
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
1062
1169
|
}
|
|
1063
1170
|
},
|
|
1064
1171
|
additionalProperties: false,
|
|
1065
|
-
required: ["id", "type", "systemData", "position"]
|
|
1172
|
+
required: ["id", "type", "systemData", "position", "driver"]
|
|
1066
1173
|
};
|
|
1067
1174
|
}
|
|
1068
1175
|
});
|
|
@@ -1080,10 +1187,9 @@ var require_windowCovering2 = __commonJS({
|
|
|
1080
1187
|
super(data);
|
|
1081
1188
|
}
|
|
1082
1189
|
static getActionDelta(old, _new) {
|
|
1083
|
-
var _a;
|
|
1084
1190
|
const delta = {};
|
|
1085
1191
|
for (const action in _new) {
|
|
1086
|
-
if (
|
|
1192
|
+
if (this.actionProperties?.includes(action)) {
|
|
1087
1193
|
if (action === "position") {
|
|
1088
1194
|
const oldPos = old[action];
|
|
1089
1195
|
const newPos = _new[action];
|
|
@@ -1096,6 +1202,7 @@ var require_windowCovering2 = __commonJS({
|
|
|
1096
1202
|
return delta;
|
|
1097
1203
|
}
|
|
1098
1204
|
};
|
|
1205
|
+
__name(WindowCovering2, "WindowCovering");
|
|
1099
1206
|
Object.defineProperty(WindowCovering2.prototype, "schema", {
|
|
1100
1207
|
value: schema
|
|
1101
1208
|
});
|
|
@@ -1119,13 +1226,13 @@ var require_identification = __commonJS({
|
|
|
1119
1226
|
"src/schemas/identification.json"(exports2, module2) {
|
|
1120
1227
|
module2.exports = {
|
|
1121
1228
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1122
|
-
$id: "https://api.kohost.
|
|
1229
|
+
$id: "https://api.kohost.io/schemas/v3/identification.json",
|
|
1123
1230
|
title: "Identification",
|
|
1124
1231
|
type: "object",
|
|
1125
|
-
required: ["type", "number"
|
|
1232
|
+
required: ["type", "number"],
|
|
1126
1233
|
properties: {
|
|
1127
1234
|
id: {
|
|
1128
|
-
$ref: "https://api.kohost.
|
|
1235
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
1129
1236
|
},
|
|
1130
1237
|
type: {
|
|
1131
1238
|
type: "string",
|
|
@@ -1139,16 +1246,14 @@ var require_identification = __commonJS({
|
|
|
1139
1246
|
format: "date-time"
|
|
1140
1247
|
},
|
|
1141
1248
|
expires: {
|
|
1142
|
-
type: ["string", "object"],
|
|
1249
|
+
type: ["string", "object", "null"],
|
|
1143
1250
|
format: "date-time"
|
|
1144
1251
|
},
|
|
1145
1252
|
verified: {
|
|
1146
|
-
type: "boolean"
|
|
1147
|
-
default: false
|
|
1253
|
+
type: "boolean"
|
|
1148
1254
|
},
|
|
1149
1255
|
matched: {
|
|
1150
|
-
type: "boolean"
|
|
1151
|
-
default: false
|
|
1256
|
+
type: "boolean"
|
|
1152
1257
|
},
|
|
1153
1258
|
firstName: {
|
|
1154
1259
|
type: "string"
|
|
@@ -1162,7 +1267,7 @@ var require_identification = __commonJS({
|
|
|
1162
1267
|
maxLength: 2
|
|
1163
1268
|
},
|
|
1164
1269
|
systemData: {
|
|
1165
|
-
$ref: "https://api.kohost.
|
|
1270
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1166
1271
|
}
|
|
1167
1272
|
}
|
|
1168
1273
|
};
|
|
@@ -1182,9 +1287,10 @@ var require_identification2 = __commonJS({
|
|
|
1182
1287
|
super(data);
|
|
1183
1288
|
}
|
|
1184
1289
|
get isExpired() {
|
|
1185
|
-
return new Date(this.expirationDate) < new Date();
|
|
1290
|
+
return new Date(this.expirationDate) < /* @__PURE__ */ new Date();
|
|
1186
1291
|
}
|
|
1187
1292
|
};
|
|
1293
|
+
__name(Identification2, "Identification");
|
|
1188
1294
|
Object.defineProperty(Identification2.prototype, "schema", {
|
|
1189
1295
|
value: schema
|
|
1190
1296
|
});
|
|
@@ -1205,22 +1311,18 @@ var require_user = __commonJS({
|
|
|
1205
1311
|
"src/schemas/user.json"(exports2, module2) {
|
|
1206
1312
|
module2.exports = {
|
|
1207
1313
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1208
|
-
$id: "https://api.kohost.
|
|
1314
|
+
$id: "https://api.kohost.io/schemas/v3/user.json",
|
|
1209
1315
|
title: "User",
|
|
1210
1316
|
type: "object",
|
|
1211
|
-
required: ["
|
|
1317
|
+
required: ["firstName", "lastName"],
|
|
1212
1318
|
properties: {
|
|
1213
1319
|
id: {
|
|
1214
|
-
$ref: "https://api.kohost.
|
|
1320
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
1215
1321
|
},
|
|
1216
1322
|
type: {
|
|
1217
1323
|
type: "string",
|
|
1218
1324
|
default: "user"
|
|
1219
1325
|
},
|
|
1220
|
-
active: {
|
|
1221
|
-
type: "boolean",
|
|
1222
|
-
default: true
|
|
1223
|
-
},
|
|
1224
1326
|
firstName: {
|
|
1225
1327
|
type: "string"
|
|
1226
1328
|
},
|
|
@@ -1242,7 +1344,7 @@ var require_user = __commonJS({
|
|
|
1242
1344
|
type: "boolean"
|
|
1243
1345
|
},
|
|
1244
1346
|
address: {
|
|
1245
|
-
$ref: "https://api.kohost.
|
|
1347
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/address"
|
|
1246
1348
|
},
|
|
1247
1349
|
secretKey: {
|
|
1248
1350
|
type: "string"
|
|
@@ -1265,63 +1367,56 @@ var require_user = __commonJS({
|
|
|
1265
1367
|
minLength: 2,
|
|
1266
1368
|
maxLength: 2
|
|
1267
1369
|
},
|
|
1268
|
-
|
|
1370
|
+
permissions: {
|
|
1269
1371
|
type: "array",
|
|
1372
|
+
default: [],
|
|
1270
1373
|
items: {
|
|
1271
|
-
type: "
|
|
1374
|
+
type: "object",
|
|
1375
|
+
required: ["organization", "property", "role"],
|
|
1376
|
+
properties: {
|
|
1377
|
+
organization: {
|
|
1378
|
+
type: "string",
|
|
1379
|
+
description: "The ID of the organization the permission is applies to."
|
|
1380
|
+
},
|
|
1381
|
+
property: {
|
|
1382
|
+
type: "string",
|
|
1383
|
+
description: "The ID of the property the permission is applies to."
|
|
1384
|
+
},
|
|
1385
|
+
role: {
|
|
1386
|
+
type: "string",
|
|
1387
|
+
enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
|
|
1388
|
+
},
|
|
1389
|
+
customPermissions: {
|
|
1390
|
+
type: "array",
|
|
1391
|
+
items: {
|
|
1392
|
+
type: "string"
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1272
1396
|
}
|
|
1273
1397
|
},
|
|
1274
|
-
|
|
1398
|
+
notes: {
|
|
1275
1399
|
type: "array",
|
|
1276
1400
|
items: {
|
|
1277
|
-
|
|
1401
|
+
type: "string"
|
|
1278
1402
|
}
|
|
1279
1403
|
},
|
|
1280
|
-
|
|
1404
|
+
files: {
|
|
1281
1405
|
type: "array",
|
|
1282
1406
|
items: {
|
|
1283
|
-
|
|
1284
|
-
enum: [
|
|
1285
|
-
"Guest",
|
|
1286
|
-
"Staff",
|
|
1287
|
-
"Faculty",
|
|
1288
|
-
"Student",
|
|
1289
|
-
"Visitor",
|
|
1290
|
-
"Manager",
|
|
1291
|
-
"Administrator",
|
|
1292
|
-
"SuperAdmin"
|
|
1293
|
-
]
|
|
1407
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
|
|
1294
1408
|
}
|
|
1295
1409
|
},
|
|
1296
1410
|
identifications: {
|
|
1297
1411
|
type: "array",
|
|
1298
1412
|
items: {
|
|
1299
|
-
$ref: "https://api.kohost.
|
|
1413
|
+
$ref: "https://api.kohost.io/schemas/v3/identification.json#"
|
|
1300
1414
|
}
|
|
1301
1415
|
},
|
|
1302
1416
|
payments: {
|
|
1303
1417
|
type: "array",
|
|
1304
1418
|
items: {
|
|
1305
|
-
$ref: "https://api.kohost.
|
|
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
|
-
}
|
|
1419
|
+
$ref: "https://api.kohost.io/schemas/v3/payment.json#"
|
|
1325
1420
|
}
|
|
1326
1421
|
},
|
|
1327
1422
|
location: {
|
|
@@ -1343,39 +1438,17 @@ var require_user = __commonJS({
|
|
|
1343
1438
|
}
|
|
1344
1439
|
}
|
|
1345
1440
|
},
|
|
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
1441
|
createdAt: {
|
|
1372
|
-
$ref: "https://api.kohost.
|
|
1442
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1373
1443
|
},
|
|
1374
1444
|
updatedAt: {
|
|
1375
|
-
$ref: "https://api.kohost.
|
|
1445
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
1376
1446
|
},
|
|
1377
1447
|
systemData: {
|
|
1378
|
-
|
|
1448
|
+
type: "array",
|
|
1449
|
+
items: {
|
|
1450
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1451
|
+
}
|
|
1379
1452
|
}
|
|
1380
1453
|
}
|
|
1381
1454
|
};
|
|
@@ -1387,13 +1460,13 @@ var require_payment = __commonJS({
|
|
|
1387
1460
|
"src/schemas/payment.json"(exports2, module2) {
|
|
1388
1461
|
module2.exports = {
|
|
1389
1462
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1390
|
-
$id: "https://api.kohost.
|
|
1463
|
+
$id: "https://api.kohost.io/schemas/v3/payment.json",
|
|
1391
1464
|
title: "Payment",
|
|
1392
1465
|
type: "object",
|
|
1393
1466
|
required: ["type", "maskedNumber", "expires"],
|
|
1394
1467
|
properties: {
|
|
1395
1468
|
id: {
|
|
1396
|
-
$ref: "https://api.kohost.
|
|
1469
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
1397
1470
|
},
|
|
1398
1471
|
type: {
|
|
1399
1472
|
type: "string",
|
|
@@ -1411,6 +1484,9 @@ var require_payment = __commonJS({
|
|
|
1411
1484
|
"vpay"
|
|
1412
1485
|
]
|
|
1413
1486
|
},
|
|
1487
|
+
storageData: {
|
|
1488
|
+
type: ["string", "null"]
|
|
1489
|
+
},
|
|
1414
1490
|
maskedNumber: {
|
|
1415
1491
|
string: "string"
|
|
1416
1492
|
},
|
|
@@ -1421,7 +1497,7 @@ var require_payment = __commonJS({
|
|
|
1421
1497
|
string: "string"
|
|
1422
1498
|
},
|
|
1423
1499
|
systemData: {
|
|
1424
|
-
$ref: "https://api.kohost.
|
|
1500
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1425
1501
|
}
|
|
1426
1502
|
}
|
|
1427
1503
|
};
|
|
@@ -1455,6 +1531,7 @@ var require_user2 = __commonJS({
|
|
|
1455
1531
|
return await nanoid(len);
|
|
1456
1532
|
}
|
|
1457
1533
|
};
|
|
1534
|
+
__name(User2, "User");
|
|
1458
1535
|
Object.defineProperty(User2.prototype, "schema", {
|
|
1459
1536
|
value: schema
|
|
1460
1537
|
});
|
|
@@ -1471,105 +1548,275 @@ var require_user2 = __commonJS({
|
|
|
1471
1548
|
return `${this.firstName} ${this.lastName}`;
|
|
1472
1549
|
}
|
|
1473
1550
|
});
|
|
1551
|
+
Object.defineProperty(User2.prototype, "roles", {
|
|
1552
|
+
get: function() {
|
|
1553
|
+
const roles = /* @__PURE__ */ new Set();
|
|
1554
|
+
if (this.permissions) {
|
|
1555
|
+
for (const permission of this.permissions) {
|
|
1556
|
+
roles.add(permission.role);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return Array.from(roles);
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1474
1562
|
module2.exports = User2;
|
|
1475
1563
|
}
|
|
1476
1564
|
});
|
|
1477
1565
|
|
|
1478
|
-
// src/schemas/
|
|
1479
|
-
var
|
|
1480
|
-
"src/schemas/
|
|
1566
|
+
// src/schemas/systemUser.json
|
|
1567
|
+
var require_systemUser = __commonJS({
|
|
1568
|
+
"src/schemas/systemUser.json"(exports2, module2) {
|
|
1481
1569
|
module2.exports = {
|
|
1482
1570
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1483
|
-
$id: "https://api.kohost.
|
|
1484
|
-
title: "
|
|
1485
|
-
description: "
|
|
1571
|
+
$id: "https://api.kohost.io/schemas/v3/systemUser.json",
|
|
1572
|
+
title: "System User",
|
|
1573
|
+
description: "A system user is a user that originated from an external 3rd party system.",
|
|
1486
1574
|
type: "object",
|
|
1575
|
+
required: ["firstName", "lastName"],
|
|
1487
1576
|
properties: {
|
|
1488
1577
|
id: {
|
|
1489
|
-
$ref: "https://api.kohost.
|
|
1578
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
1490
1579
|
},
|
|
1491
1580
|
type: {
|
|
1492
|
-
|
|
1581
|
+
type: "string",
|
|
1582
|
+
default: "systemUser"
|
|
1493
1583
|
},
|
|
1494
|
-
|
|
1495
|
-
$ref: "https://api.kohost.
|
|
1584
|
+
driver: {
|
|
1585
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
1496
1586
|
},
|
|
1497
|
-
|
|
1498
|
-
|
|
1587
|
+
firstName: {
|
|
1588
|
+
type: "string"
|
|
1499
1589
|
},
|
|
1500
|
-
|
|
1590
|
+
lastName: {
|
|
1591
|
+
type: "string"
|
|
1592
|
+
},
|
|
1593
|
+
phone: {
|
|
1594
|
+
type: ["string", "null"],
|
|
1595
|
+
pattern: "^\\+[0-9]{1,14}$"
|
|
1596
|
+
},
|
|
1597
|
+
email: {
|
|
1598
|
+
type: ["string", "null"],
|
|
1599
|
+
format: "email"
|
|
1600
|
+
},
|
|
1601
|
+
address: {
|
|
1602
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/address"
|
|
1603
|
+
},
|
|
1604
|
+
photo: {
|
|
1605
|
+
type: "string"
|
|
1606
|
+
},
|
|
1607
|
+
jobTitle: {
|
|
1608
|
+
type: "string"
|
|
1609
|
+
},
|
|
1610
|
+
dob: {
|
|
1611
|
+
type: "string"
|
|
1612
|
+
},
|
|
1613
|
+
gender: {
|
|
1614
|
+
type: "string",
|
|
1615
|
+
enum: ["male", "female"]
|
|
1616
|
+
},
|
|
1617
|
+
roles: {
|
|
1501
1618
|
type: "array",
|
|
1502
|
-
uniqueItems: true,
|
|
1503
1619
|
items: {
|
|
1504
|
-
|
|
1620
|
+
type: "string",
|
|
1621
|
+
enum: ["Guest", "User", "Manager", "Administrator", "SuperAdmin"]
|
|
1505
1622
|
}
|
|
1506
1623
|
},
|
|
1507
|
-
|
|
1624
|
+
nationality: {
|
|
1508
1625
|
type: "string",
|
|
1509
|
-
|
|
1626
|
+
minLength: 2,
|
|
1627
|
+
maxLength: 2
|
|
1628
|
+
},
|
|
1629
|
+
notes: {
|
|
1630
|
+
type: "array",
|
|
1631
|
+
items: {
|
|
1632
|
+
type: "string"
|
|
1633
|
+
}
|
|
1634
|
+
},
|
|
1635
|
+
files: {
|
|
1636
|
+
type: "array",
|
|
1637
|
+
items: {
|
|
1638
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
|
|
1639
|
+
}
|
|
1640
|
+
},
|
|
1641
|
+
identifications: {
|
|
1642
|
+
type: "array",
|
|
1643
|
+
items: {
|
|
1644
|
+
$ref: "https://api.kohost.io/schemas/v3/identification.json#"
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
payments: {
|
|
1648
|
+
type: "array",
|
|
1649
|
+
items: {
|
|
1650
|
+
$ref: "https://api.kohost.io/schemas/v3/payment.json#"
|
|
1651
|
+
}
|
|
1652
|
+
},
|
|
1653
|
+
createdAt: {
|
|
1654
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1655
|
+
},
|
|
1656
|
+
updatedAt: {
|
|
1657
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
1510
1658
|
},
|
|
1511
1659
|
systemData: {
|
|
1512
|
-
$ref: "https://api.kohost.
|
|
1660
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
1513
1661
|
}
|
|
1514
|
-
}
|
|
1515
|
-
additionalProperties: false,
|
|
1516
|
-
required: ["supportedStates", "state"]
|
|
1662
|
+
}
|
|
1517
1663
|
};
|
|
1518
1664
|
}
|
|
1519
1665
|
});
|
|
1520
1666
|
|
|
1521
|
-
// src/Models/
|
|
1522
|
-
var
|
|
1523
|
-
"src/Models/
|
|
1667
|
+
// src/Models/systemUser.js
|
|
1668
|
+
var require_systemUser2 = __commonJS({
|
|
1669
|
+
"src/Models/systemUser.js"(exports2, module2) {
|
|
1524
1670
|
var schemas = require_schema();
|
|
1525
|
-
var schema =
|
|
1671
|
+
var schema = require_systemUser();
|
|
1526
1672
|
var Kohost = require_kohost();
|
|
1527
1673
|
schemas.add(schema);
|
|
1528
1674
|
var validator = schemas.compile(schema);
|
|
1529
|
-
var
|
|
1675
|
+
var SystemUser2 = class extends Kohost {
|
|
1530
1676
|
constructor(data) {
|
|
1531
1677
|
super(data);
|
|
1532
1678
|
}
|
|
1679
|
+
static validatePhone(phoneNumber) {
|
|
1680
|
+
const regex = /^\+?[1-9]\d{1,14}$/;
|
|
1681
|
+
return regex.test(phoneNumber);
|
|
1682
|
+
}
|
|
1683
|
+
static validateEmail(email) {
|
|
1684
|
+
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,}))$/;
|
|
1685
|
+
return regex.test(email);
|
|
1686
|
+
}
|
|
1533
1687
|
};
|
|
1534
|
-
|
|
1688
|
+
__name(SystemUser2, "SystemUser");
|
|
1689
|
+
Object.defineProperty(SystemUser2.prototype, "schema", {
|
|
1535
1690
|
value: schema
|
|
1536
1691
|
});
|
|
1537
|
-
Object.defineProperty(
|
|
1692
|
+
Object.defineProperty(SystemUser2.prototype, "validator", {
|
|
1538
1693
|
get: function() {
|
|
1539
1694
|
return validator;
|
|
1540
1695
|
}
|
|
1541
1696
|
});
|
|
1542
|
-
Object.defineProperty(
|
|
1697
|
+
Object.defineProperty(SystemUser2, "validProperties", {
|
|
1543
1698
|
value: Object.keys(schema.properties)
|
|
1544
1699
|
});
|
|
1545
|
-
Object.defineProperty(
|
|
1546
|
-
|
|
1700
|
+
Object.defineProperty(SystemUser2.prototype, "fullName", {
|
|
1701
|
+
get: function() {
|
|
1702
|
+
return `${this.firstName} ${this.lastName}`;
|
|
1703
|
+
}
|
|
1547
1704
|
});
|
|
1548
|
-
module2.exports =
|
|
1705
|
+
module2.exports = SystemUser2;
|
|
1549
1706
|
}
|
|
1550
1707
|
});
|
|
1551
1708
|
|
|
1552
|
-
// src/schemas/
|
|
1553
|
-
var
|
|
1554
|
-
"src/schemas/
|
|
1555
|
-
module2.exports = {
|
|
1556
|
-
$schema: "http://json-schema.org/draft-07/schema",
|
|
1557
|
-
$id: "https://api.kohost.
|
|
1709
|
+
// src/schemas/courtesy.json
|
|
1710
|
+
var require_courtesy = __commonJS({
|
|
1711
|
+
"src/schemas/courtesy.json"(exports2, module2) {
|
|
1712
|
+
module2.exports = {
|
|
1713
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
1714
|
+
$id: "https://api.kohost.io/schemas/v3/courtesy.json",
|
|
1715
|
+
title: "Courtesy",
|
|
1716
|
+
description: "Any smart courtesy system",
|
|
1717
|
+
type: "object",
|
|
1718
|
+
properties: {
|
|
1719
|
+
id: {
|
|
1720
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
1721
|
+
},
|
|
1722
|
+
name: {
|
|
1723
|
+
type: "string"
|
|
1724
|
+
},
|
|
1725
|
+
type: {
|
|
1726
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
1727
|
+
},
|
|
1728
|
+
supportedNotifications: {
|
|
1729
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
1730
|
+
},
|
|
1731
|
+
notification: {
|
|
1732
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
1733
|
+
},
|
|
1734
|
+
driver: {
|
|
1735
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
1736
|
+
},
|
|
1737
|
+
supportedStates: {
|
|
1738
|
+
type: "array",
|
|
1739
|
+
uniqueItems: true,
|
|
1740
|
+
items: {
|
|
1741
|
+
enum: ["privacy", "service", "none"]
|
|
1742
|
+
}
|
|
1743
|
+
},
|
|
1744
|
+
state: {
|
|
1745
|
+
type: "string",
|
|
1746
|
+
$ref: "#/properties/supportedStates/items"
|
|
1747
|
+
},
|
|
1748
|
+
systemData: {
|
|
1749
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
1750
|
+
},
|
|
1751
|
+
watts: {
|
|
1752
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
1753
|
+
}
|
|
1754
|
+
},
|
|
1755
|
+
additionalProperties: false,
|
|
1756
|
+
required: ["id", "type", "driver", "supportedStates", "state"]
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
});
|
|
1760
|
+
|
|
1761
|
+
// src/Models/courtesy.js
|
|
1762
|
+
var require_courtesy2 = __commonJS({
|
|
1763
|
+
"src/Models/courtesy.js"(exports2, module2) {
|
|
1764
|
+
var schemas = require_schema();
|
|
1765
|
+
var schema = require_courtesy();
|
|
1766
|
+
var Kohost = require_kohost();
|
|
1767
|
+
schemas.add(schema);
|
|
1768
|
+
var validator = schemas.compile(schema);
|
|
1769
|
+
var Courtesy2 = class extends Kohost {
|
|
1770
|
+
constructor(data) {
|
|
1771
|
+
super(data);
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
__name(Courtesy2, "Courtesy");
|
|
1775
|
+
Object.defineProperty(Courtesy2.prototype, "schema", {
|
|
1776
|
+
value: schema
|
|
1777
|
+
});
|
|
1778
|
+
Object.defineProperty(Courtesy2.prototype, "validator", {
|
|
1779
|
+
get: function() {
|
|
1780
|
+
return validator;
|
|
1781
|
+
}
|
|
1782
|
+
});
|
|
1783
|
+
Object.defineProperty(Courtesy2, "validProperties", {
|
|
1784
|
+
value: Object.keys(schema.properties)
|
|
1785
|
+
});
|
|
1786
|
+
Object.defineProperty(Courtesy2, "actionProperties", {
|
|
1787
|
+
value: ["state"]
|
|
1788
|
+
});
|
|
1789
|
+
module2.exports = Courtesy2;
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
|
|
1793
|
+
// src/schemas/camera.json
|
|
1794
|
+
var require_camera = __commonJS({
|
|
1795
|
+
"src/schemas/camera.json"(exports2, module2) {
|
|
1796
|
+
module2.exports = {
|
|
1797
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
1798
|
+
$id: "https://api.kohost.io/schemas/v3/camera.json",
|
|
1558
1799
|
title: "Camera",
|
|
1559
1800
|
description: "Any smart camera",
|
|
1560
1801
|
type: "object",
|
|
1561
1802
|
properties: {
|
|
1562
1803
|
id: {
|
|
1563
|
-
$ref: "https://api.kohost.
|
|
1804
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
1805
|
+
},
|
|
1806
|
+
name: {
|
|
1807
|
+
type: "string"
|
|
1564
1808
|
},
|
|
1565
1809
|
type: {
|
|
1566
|
-
$ref: "https://api.kohost.
|
|
1810
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
1567
1811
|
},
|
|
1568
1812
|
supportedNotifications: {
|
|
1569
|
-
$ref: "https://api.kohost.
|
|
1813
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
1570
1814
|
},
|
|
1571
1815
|
notification: {
|
|
1572
|
-
$ref: "https://api.kohost.
|
|
1816
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
1817
|
+
},
|
|
1818
|
+
driver: {
|
|
1819
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
1573
1820
|
},
|
|
1574
1821
|
streams: {
|
|
1575
1822
|
type: "object",
|
|
@@ -1587,11 +1834,14 @@ var require_camera = __commonJS({
|
|
|
1587
1834
|
}
|
|
1588
1835
|
},
|
|
1589
1836
|
systemData: {
|
|
1590
|
-
$ref: "https://api.kohost.
|
|
1837
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
1838
|
+
},
|
|
1839
|
+
watts: {
|
|
1840
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
1591
1841
|
}
|
|
1592
1842
|
},
|
|
1593
1843
|
additionalProperties: false,
|
|
1594
|
-
required: ["id", "type", "systemData", "streams"]
|
|
1844
|
+
required: ["id", "type", "systemData", "streams", "driver"]
|
|
1595
1845
|
};
|
|
1596
1846
|
}
|
|
1597
1847
|
});
|
|
@@ -1609,6 +1859,7 @@ var require_camera2 = __commonJS({
|
|
|
1609
1859
|
super(data);
|
|
1610
1860
|
}
|
|
1611
1861
|
};
|
|
1862
|
+
__name(Camera2, "Camera");
|
|
1612
1863
|
Object.defineProperty(Camera2.prototype, "schema", {
|
|
1613
1864
|
value: schema
|
|
1614
1865
|
});
|
|
@@ -1629,29 +1880,35 @@ var require_motionSensor = __commonJS({
|
|
|
1629
1880
|
"src/schemas/motionSensor.json"(exports2, module2) {
|
|
1630
1881
|
module2.exports = {
|
|
1631
1882
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1632
|
-
$id: "https://api.kohost.
|
|
1883
|
+
$id: "https://api.kohost.io/schemas/v3/motionSensor.json",
|
|
1633
1884
|
title: "Motion Sensor",
|
|
1634
1885
|
description: "Any smart motion sensor",
|
|
1635
1886
|
type: "object",
|
|
1636
1887
|
properties: {
|
|
1637
1888
|
id: {
|
|
1638
|
-
$ref: "https://api.kohost.
|
|
1889
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
1639
1890
|
},
|
|
1640
1891
|
type: {
|
|
1641
|
-
$ref: "https://api.kohost.
|
|
1892
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
1893
|
+
},
|
|
1894
|
+
driver: {
|
|
1895
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
1642
1896
|
},
|
|
1643
1897
|
systemData: {
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
$ref: "https://api.kohost.
|
|
1898
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
1899
|
+
},
|
|
1900
|
+
supportedNotifications: {
|
|
1901
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
1902
|
+
},
|
|
1903
|
+
notification: {
|
|
1904
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
1905
|
+
},
|
|
1906
|
+
watts: {
|
|
1907
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
1651
1908
|
}
|
|
1652
1909
|
},
|
|
1653
1910
|
additionalProperties: false,
|
|
1654
|
-
required: ["id", "type", "systemData"]
|
|
1911
|
+
required: ["id", "type", "systemData", "driver"]
|
|
1655
1912
|
};
|
|
1656
1913
|
}
|
|
1657
1914
|
});
|
|
@@ -1669,6 +1926,7 @@ var require_motionSensor2 = __commonJS({
|
|
|
1669
1926
|
super(data);
|
|
1670
1927
|
}
|
|
1671
1928
|
};
|
|
1929
|
+
__name(MotionSensor2, "MotionSensor");
|
|
1672
1930
|
Object.defineProperty(MotionSensor2.prototype, "schema", {
|
|
1673
1931
|
value: schema
|
|
1674
1932
|
});
|
|
@@ -1689,18 +1947,16 @@ var require_mediaSource = __commonJS({
|
|
|
1689
1947
|
"src/schemas/mediaSource.json"(exports2, module2) {
|
|
1690
1948
|
module2.exports = {
|
|
1691
1949
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1692
|
-
$id: "https://api.kohost.
|
|
1950
|
+
$id: "https://api.kohost.io/schemas/v3/mediaSource.json",
|
|
1693
1951
|
title: "Media Source",
|
|
1694
1952
|
description: "Any media source",
|
|
1695
1953
|
type: "object",
|
|
1954
|
+
required: ["id", "type", "systemData", "audio", "video", "driver"],
|
|
1696
1955
|
properties: {
|
|
1697
1956
|
id: {
|
|
1698
|
-
$ref: "https://api.kohost.
|
|
1957
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
1699
1958
|
},
|
|
1700
1959
|
type: {
|
|
1701
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
1702
|
-
},
|
|
1703
|
-
subType: {
|
|
1704
1960
|
type: "string",
|
|
1705
1961
|
enum: [
|
|
1706
1962
|
"tv",
|
|
@@ -1711,6 +1967,9 @@ var require_mediaSource = __commonJS({
|
|
|
1711
1967
|
"uncontrolledDevice"
|
|
1712
1968
|
]
|
|
1713
1969
|
},
|
|
1970
|
+
driver: {
|
|
1971
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
1972
|
+
},
|
|
1714
1973
|
audio: {
|
|
1715
1974
|
type: "boolean"
|
|
1716
1975
|
},
|
|
@@ -1723,6 +1982,27 @@ var require_mediaSource = __commonJS({
|
|
|
1723
1982
|
volumeFeedback: {
|
|
1724
1983
|
type: "boolean"
|
|
1725
1984
|
},
|
|
1985
|
+
muted: {
|
|
1986
|
+
type: "boolean"
|
|
1987
|
+
},
|
|
1988
|
+
volume: {
|
|
1989
|
+
type: "number",
|
|
1990
|
+
minimum: 0,
|
|
1991
|
+
maximum: 100
|
|
1992
|
+
},
|
|
1993
|
+
power: {
|
|
1994
|
+
type: "string",
|
|
1995
|
+
enum: ["on", "off"]
|
|
1996
|
+
},
|
|
1997
|
+
input: {
|
|
1998
|
+
type: "string"
|
|
1999
|
+
},
|
|
2000
|
+
supportedInputs: {
|
|
2001
|
+
type: "array",
|
|
2002
|
+
items: {
|
|
2003
|
+
type: "string"
|
|
2004
|
+
}
|
|
2005
|
+
},
|
|
1726
2006
|
command: {
|
|
1727
2007
|
type: ["string", "null"],
|
|
1728
2008
|
enum: [
|
|
@@ -1766,6 +2046,7 @@ var require_mediaSource = __commonJS({
|
|
|
1766
2046
|
"input",
|
|
1767
2047
|
"power",
|
|
1768
2048
|
"enterChannel",
|
|
2049
|
+
"enterVolume",
|
|
1769
2050
|
"number10",
|
|
1770
2051
|
"number11",
|
|
1771
2052
|
"number12",
|
|
@@ -1822,21 +2103,28 @@ var require_mediaSource = __commonJS({
|
|
|
1822
2103
|
"hdmi2",
|
|
1823
2104
|
"hdmi3",
|
|
1824
2105
|
"cecDeviceList",
|
|
1825
|
-
"mtsSap"
|
|
2106
|
+
"mtsSap",
|
|
2107
|
+
"red",
|
|
2108
|
+
"green",
|
|
2109
|
+
"yellow",
|
|
2110
|
+
"blue",
|
|
2111
|
+
"alert"
|
|
1826
2112
|
]
|
|
1827
2113
|
},
|
|
1828
2114
|
supportedNotifications: {
|
|
1829
|
-
$ref: "https://api.kohost.
|
|
2115
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
1830
2116
|
},
|
|
1831
2117
|
notification: {
|
|
1832
|
-
$ref: "https://api.kohost.
|
|
2118
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
1833
2119
|
},
|
|
1834
2120
|
systemData: {
|
|
1835
|
-
$ref: "https://api.kohost.
|
|
2121
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
2122
|
+
},
|
|
2123
|
+
watts: {
|
|
2124
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
1836
2125
|
}
|
|
1837
2126
|
},
|
|
1838
|
-
additionalProperties: false
|
|
1839
|
-
required: ["id", "type", "systemData", "audio", "video"]
|
|
2127
|
+
additionalProperties: false
|
|
1840
2128
|
};
|
|
1841
2129
|
}
|
|
1842
2130
|
});
|
|
@@ -1854,6 +2142,7 @@ var require_mediaSource2 = __commonJS({
|
|
|
1854
2142
|
super(data);
|
|
1855
2143
|
}
|
|
1856
2144
|
};
|
|
2145
|
+
__name(MediaSource2, "MediaSource");
|
|
1857
2146
|
Object.defineProperty(MediaSource2.prototype, "schema", {
|
|
1858
2147
|
value: schema
|
|
1859
2148
|
});
|
|
@@ -1874,13 +2163,13 @@ var require_room = __commonJS({
|
|
|
1874
2163
|
"src/schemas/room.json"(exports2, module2) {
|
|
1875
2164
|
module2.exports = {
|
|
1876
2165
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
1877
|
-
$id: "https://api.kohost.
|
|
2166
|
+
$id: "https://api.kohost.io/schemas/v3/room.json",
|
|
1878
2167
|
title: "Room",
|
|
1879
2168
|
description: "A room represents a physical space of controllable IoT devices",
|
|
1880
2169
|
type: "object",
|
|
1881
2170
|
properties: {
|
|
1882
2171
|
id: {
|
|
1883
|
-
$ref: "https://api.kohost.
|
|
2172
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
1884
2173
|
},
|
|
1885
2174
|
name: {
|
|
1886
2175
|
type: "string"
|
|
@@ -1892,88 +2181,70 @@ var require_room = __commonJS({
|
|
|
1892
2181
|
type: "array",
|
|
1893
2182
|
default: [],
|
|
1894
2183
|
items: {
|
|
1895
|
-
$ref: "https://api.kohost.
|
|
2184
|
+
$ref: "https://api.kohost.io/schemas/v3/dimmer.json"
|
|
1896
2185
|
}
|
|
1897
2186
|
},
|
|
1898
2187
|
switches: {
|
|
1899
2188
|
type: "array",
|
|
1900
2189
|
default: [],
|
|
1901
2190
|
items: {
|
|
1902
|
-
$ref: "https://api.kohost.
|
|
2191
|
+
$ref: "https://api.kohost.io/schemas/v3/switch.json"
|
|
1903
2192
|
}
|
|
1904
2193
|
},
|
|
1905
2194
|
thermostats: {
|
|
1906
2195
|
type: "array",
|
|
1907
2196
|
default: [],
|
|
1908
2197
|
items: {
|
|
1909
|
-
$ref: "https://api.kohost.
|
|
2198
|
+
$ref: "https://api.kohost.io/schemas/v3/thermostat.json"
|
|
1910
2199
|
}
|
|
1911
2200
|
},
|
|
1912
2201
|
locks: {
|
|
1913
2202
|
type: "array",
|
|
1914
2203
|
default: [],
|
|
1915
2204
|
items: {
|
|
1916
|
-
$ref: "https://api.kohost.
|
|
2205
|
+
$ref: "https://api.kohost.io/schemas/v3/lock.json"
|
|
1917
2206
|
}
|
|
1918
2207
|
},
|
|
1919
2208
|
windowCoverings: {
|
|
1920
2209
|
type: "array",
|
|
1921
2210
|
default: [],
|
|
1922
2211
|
items: {
|
|
1923
|
-
$ref: "https://api.kohost.
|
|
2212
|
+
$ref: "https://api.kohost.io/schemas/v3/windowCovering.json"
|
|
1924
2213
|
}
|
|
1925
2214
|
},
|
|
1926
2215
|
courtesy: {
|
|
1927
2216
|
type: "array",
|
|
1928
2217
|
default: [],
|
|
1929
2218
|
items: {
|
|
1930
|
-
$ref: "https://api.kohost.
|
|
2219
|
+
$ref: "https://api.kohost.io/schemas/v3/courtesy.json"
|
|
1931
2220
|
}
|
|
1932
2221
|
},
|
|
1933
2222
|
cameras: {
|
|
1934
2223
|
type: "array",
|
|
1935
2224
|
default: [],
|
|
1936
2225
|
items: {
|
|
1937
|
-
$ref: "https://api.kohost.
|
|
2226
|
+
$ref: "https://api.kohost.io/schemas/v3/camera.json"
|
|
1938
2227
|
}
|
|
1939
2228
|
},
|
|
1940
|
-
|
|
2229
|
+
mediaSources: {
|
|
1941
2230
|
type: "array",
|
|
1942
2231
|
default: [],
|
|
1943
2232
|
items: {
|
|
1944
|
-
$ref: "https://api.kohost.
|
|
2233
|
+
$ref: "https://api.kohost.io/schemas/v3/mediaSource.json"
|
|
1945
2234
|
}
|
|
1946
2235
|
},
|
|
1947
2236
|
motionSensors: {
|
|
1948
2237
|
type: "array",
|
|
1949
2238
|
default: [],
|
|
1950
2239
|
items: {
|
|
1951
|
-
$ref: "https://api.kohost.
|
|
2240
|
+
$ref: "https://api.kohost.io/schemas/v3/motionSensor.json"
|
|
1952
2241
|
}
|
|
1953
2242
|
},
|
|
1954
2243
|
alarms: {
|
|
1955
2244
|
type: "array",
|
|
1956
2245
|
default: [],
|
|
1957
2246
|
items: {
|
|
1958
|
-
$ref: "https://api.kohost.
|
|
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
|
-
}
|
|
2247
|
+
$ref: "https://api.kohost.io/schemas/v3/alarm.json"
|
|
1977
2248
|
}
|
|
1978
2249
|
},
|
|
1979
2250
|
scenes: {
|
|
@@ -1983,22 +2254,22 @@ var require_room = __commonJS({
|
|
|
1983
2254
|
description: "A list of scene IDs for later population, or entire scene objects",
|
|
1984
2255
|
oneOf: [
|
|
1985
2256
|
{
|
|
1986
|
-
$ref: "https://api.kohost.
|
|
2257
|
+
$ref: "https://api.kohost.io/schemas/v3/scene.json"
|
|
1987
2258
|
},
|
|
1988
2259
|
{
|
|
1989
|
-
$ref: "https://api.kohost.
|
|
2260
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
1990
2261
|
}
|
|
1991
2262
|
]
|
|
1992
2263
|
}
|
|
1993
2264
|
},
|
|
1994
2265
|
occupiedAt: {
|
|
1995
|
-
$ref: "https://api.kohost.
|
|
2266
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1996
2267
|
},
|
|
1997
2268
|
createdAt: {
|
|
1998
|
-
$ref: "https://api.kohost.
|
|
2269
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
1999
2270
|
},
|
|
2000
2271
|
updatedAt: {
|
|
2001
|
-
$ref: "https://api.kohost.
|
|
2272
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
2002
2273
|
}
|
|
2003
2274
|
},
|
|
2004
2275
|
additionalProperties: false
|
|
@@ -2011,13 +2282,13 @@ var require_scene = __commonJS({
|
|
|
2011
2282
|
"src/schemas/scene.json"(exports2, module2) {
|
|
2012
2283
|
module2.exports = {
|
|
2013
2284
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
2014
|
-
$id: "https://api.kohost.
|
|
2285
|
+
$id: "https://api.kohost.io/schemas/v3/scene.json",
|
|
2015
2286
|
title: "Scene",
|
|
2016
2287
|
description: "A room represents a physical space of controllable IoT devices",
|
|
2017
2288
|
type: "object",
|
|
2018
2289
|
properties: {
|
|
2019
2290
|
id: {
|
|
2020
|
-
$ref: "https://api.kohost.
|
|
2291
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2021
2292
|
},
|
|
2022
2293
|
name: {
|
|
2023
2294
|
type: "string"
|
|
@@ -2031,10 +2302,10 @@ var require_scene = __commonJS({
|
|
|
2031
2302
|
type: "object",
|
|
2032
2303
|
properties: {
|
|
2033
2304
|
id: {
|
|
2034
|
-
$ref: "https://api.kohost.
|
|
2305
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2035
2306
|
},
|
|
2036
2307
|
state: {
|
|
2037
|
-
$ref: "https://api.kohost.
|
|
2308
|
+
$ref: "https://api.kohost.io/schemas/v3/switch.json#/properties/state"
|
|
2038
2309
|
}
|
|
2039
2310
|
},
|
|
2040
2311
|
default: []
|
|
@@ -2046,10 +2317,10 @@ var require_scene = __commonJS({
|
|
|
2046
2317
|
type: "object",
|
|
2047
2318
|
properties: {
|
|
2048
2319
|
id: {
|
|
2049
|
-
$ref: "https://api.kohost.
|
|
2320
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2050
2321
|
},
|
|
2051
2322
|
level: {
|
|
2052
|
-
$ref: "https://api.kohost.
|
|
2323
|
+
$ref: "https://api.kohost.io/schemas/v3/dimmer.json#/properties/level"
|
|
2053
2324
|
}
|
|
2054
2325
|
}
|
|
2055
2326
|
},
|
|
@@ -2061,10 +2332,10 @@ var require_scene = __commonJS({
|
|
|
2061
2332
|
type: "object",
|
|
2062
2333
|
properties: {
|
|
2063
2334
|
id: {
|
|
2064
|
-
$ref: "https://api.kohost.
|
|
2335
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2065
2336
|
},
|
|
2066
2337
|
position: {
|
|
2067
|
-
$ref: "https://api.kohost.
|
|
2338
|
+
$ref: "https://api.kohost.io/schemas/v3/windowCovering.json#/properties/position"
|
|
2068
2339
|
}
|
|
2069
2340
|
}
|
|
2070
2341
|
},
|
|
@@ -2076,16 +2347,16 @@ var require_scene = __commonJS({
|
|
|
2076
2347
|
type: "object",
|
|
2077
2348
|
properties: {
|
|
2078
2349
|
id: {
|
|
2079
|
-
$ref: "https://api.kohost.
|
|
2350
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2080
2351
|
},
|
|
2081
2352
|
hvacMode: {
|
|
2082
|
-
$ref: "https://api.kohost.
|
|
2353
|
+
$ref: "https://api.kohost.io/schemas/v3/thermostat.json#/properties/hvacMode"
|
|
2083
2354
|
},
|
|
2084
2355
|
setpoints: {
|
|
2085
|
-
$ref: "https://api.kohost.
|
|
2356
|
+
$ref: "https://api.kohost.io/schemas/v3/thermostat.json#/properties/setpoints"
|
|
2086
2357
|
},
|
|
2087
2358
|
fanMode: {
|
|
2088
|
-
$ref: "https://api.kohost.
|
|
2359
|
+
$ref: "https://api.kohost.io/schemas/v3/thermostat.json#/properties/fanMode"
|
|
2089
2360
|
}
|
|
2090
2361
|
}
|
|
2091
2362
|
},
|
|
@@ -2097,7 +2368,7 @@ var require_scene = __commonJS({
|
|
|
2097
2368
|
type: "object",
|
|
2098
2369
|
properties: {
|
|
2099
2370
|
id: {
|
|
2100
|
-
$ref: "https://api.kohost.
|
|
2371
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2101
2372
|
},
|
|
2102
2373
|
volume: {
|
|
2103
2374
|
type: "number",
|
|
@@ -2143,6 +2414,7 @@ var require_scene2 = __commonJS({
|
|
|
2143
2414
|
super(data);
|
|
2144
2415
|
}
|
|
2145
2416
|
};
|
|
2417
|
+
__name(Scene2, "Scene");
|
|
2146
2418
|
Object.defineProperty(Scene2.prototype, "schema", {
|
|
2147
2419
|
value: schema
|
|
2148
2420
|
});
|
|
@@ -2163,6 +2435,7 @@ var require_room2 = __commonJS({
|
|
|
2163
2435
|
"src/Models/room.js"(exports2, module2) {
|
|
2164
2436
|
var schemas = require_schema();
|
|
2165
2437
|
var schema = require_room();
|
|
2438
|
+
var deviceSchema = require_device();
|
|
2166
2439
|
var Kohost = require_kohost();
|
|
2167
2440
|
var cloneDeep = require("lodash.clonedeep");
|
|
2168
2441
|
var Switch2 = require_switch2();
|
|
@@ -2173,7 +2446,7 @@ var require_room2 = __commonJS({
|
|
|
2173
2446
|
var Courtesy2 = require_courtesy2();
|
|
2174
2447
|
var Camera2 = require_camera2();
|
|
2175
2448
|
var Alarm2 = require_alarm2();
|
|
2176
|
-
var
|
|
2449
|
+
var MediaSource2 = require_mediaSource2();
|
|
2177
2450
|
var MotionSensor2 = require_motionSensor2();
|
|
2178
2451
|
var Scene2 = require_scene2();
|
|
2179
2452
|
schemas.add(schema);
|
|
@@ -2184,21 +2457,18 @@ var require_room2 = __commonJS({
|
|
|
2184
2457
|
super(roomData);
|
|
2185
2458
|
}
|
|
2186
2459
|
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
|
-
];
|
|
2460
|
+
const validTypes = deviceSchema.definitions.type.enum;
|
|
2199
2461
|
if (!validTypes.includes(type))
|
|
2200
2462
|
throw new Error("Invalid device type:" + type);
|
|
2201
2463
|
switch (type) {
|
|
2464
|
+
case "tv":
|
|
2465
|
+
case "dvr":
|
|
2466
|
+
case "appleTv":
|
|
2467
|
+
case "discPlayer":
|
|
2468
|
+
case "mediaPlayer":
|
|
2469
|
+
case "uncontrolledDevice":
|
|
2470
|
+
case "mediaSource":
|
|
2471
|
+
return "mediaSources";
|
|
2202
2472
|
case "courtesy":
|
|
2203
2473
|
return type;
|
|
2204
2474
|
case "switch":
|
|
@@ -2207,49 +2477,77 @@ var require_room2 = __commonJS({
|
|
|
2207
2477
|
return `${type}s`;
|
|
2208
2478
|
}
|
|
2209
2479
|
}
|
|
2480
|
+
static getDeviceTypeFromPath(path) {
|
|
2481
|
+
const validPaths = [
|
|
2482
|
+
"dimmers",
|
|
2483
|
+
"switches",
|
|
2484
|
+
"thermostats",
|
|
2485
|
+
"locks",
|
|
2486
|
+
"windowCoverings",
|
|
2487
|
+
"courtesy",
|
|
2488
|
+
"cameras",
|
|
2489
|
+
"mediaSources",
|
|
2490
|
+
"motionSensors",
|
|
2491
|
+
"alarms"
|
|
2492
|
+
];
|
|
2493
|
+
if (!validPaths.includes(path))
|
|
2494
|
+
throw new Error("Invalid device path:" + path);
|
|
2495
|
+
switch (path) {
|
|
2496
|
+
case "courtesy":
|
|
2497
|
+
return path;
|
|
2498
|
+
case "switches":
|
|
2499
|
+
return "switch";
|
|
2500
|
+
default:
|
|
2501
|
+
return path.slice(0, -1);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2210
2504
|
get hasDimmer() {
|
|
2211
|
-
|
|
2212
|
-
return ((_a = this.dimmers) == null ? void 0 : _a.length) > 0;
|
|
2505
|
+
return this.dimmers?.length > 0;
|
|
2213
2506
|
}
|
|
2214
2507
|
get hasSwitch() {
|
|
2215
|
-
|
|
2216
|
-
return ((_a = this.switches) == null ? void 0 : _a.length) > 0;
|
|
2508
|
+
return this.switches?.length > 0;
|
|
2217
2509
|
}
|
|
2218
2510
|
get hasWindowCovering() {
|
|
2219
|
-
|
|
2220
|
-
|
|
2511
|
+
return this.windowCoverings?.length > 0;
|
|
2512
|
+
}
|
|
2513
|
+
get hasShade() {
|
|
2514
|
+
return this.hasWindowCovering;
|
|
2221
2515
|
}
|
|
2222
2516
|
get hasThermostat() {
|
|
2223
|
-
|
|
2224
|
-
|
|
2517
|
+
return this.thermostats?.length > 0;
|
|
2518
|
+
}
|
|
2519
|
+
get hasClimate() {
|
|
2520
|
+
return this.hasThermostat;
|
|
2225
2521
|
}
|
|
2226
2522
|
get hasLock() {
|
|
2227
|
-
|
|
2228
|
-
return ((_a = this.locks) == null ? void 0 : _a.length) > 0;
|
|
2523
|
+
return this.locks?.length > 0;
|
|
2229
2524
|
}
|
|
2230
2525
|
get hasCourtesy() {
|
|
2231
|
-
|
|
2232
|
-
return ((_a = this.courtesy) == null ? void 0 : _a.length) > 0;
|
|
2526
|
+
return this.courtesy?.length > 0;
|
|
2233
2527
|
}
|
|
2234
2528
|
get hasCamera() {
|
|
2235
|
-
|
|
2236
|
-
return ((_a = this.cameras) == null ? void 0 : _a.length) > 0;
|
|
2529
|
+
return this.cameras?.length > 0;
|
|
2237
2530
|
}
|
|
2238
2531
|
get hasAlarm() {
|
|
2239
|
-
|
|
2240
|
-
return ((_a = this.alarms) == null ? void 0 : _a.length) > 0;
|
|
2532
|
+
return this.alarms?.length > 0;
|
|
2241
2533
|
}
|
|
2242
2534
|
get hasMedia() {
|
|
2243
|
-
|
|
2244
|
-
|
|
2535
|
+
return this.mediaSources?.length > 0;
|
|
2536
|
+
}
|
|
2537
|
+
get hasLight() {
|
|
2538
|
+
const hasSubTypeLight = this.switches?.some((sw) => {
|
|
2539
|
+
return sw.subType === "light" || sw.subType === "fan";
|
|
2540
|
+
});
|
|
2541
|
+
return this.hasDimmer || hasSubTypeLight;
|
|
2245
2542
|
}
|
|
2246
2543
|
get occupied() {
|
|
2247
|
-
const now = new Date();
|
|
2544
|
+
const now = /* @__PURE__ */ new Date();
|
|
2248
2545
|
const lastOccupied = new Date(this.occupiedAt);
|
|
2249
2546
|
const diff = now - lastOccupied;
|
|
2250
2547
|
return diff < 60 * 60 * 1e3;
|
|
2251
2548
|
}
|
|
2252
2549
|
};
|
|
2550
|
+
__name(Room2, "Room");
|
|
2253
2551
|
Object.defineProperty(Room2.prototype, "schema", {
|
|
2254
2552
|
value: schema
|
|
2255
2553
|
});
|
|
@@ -2262,69 +2560,68 @@ var require_room2 = __commonJS({
|
|
|
2262
2560
|
value: Object.keys(schema.properties)
|
|
2263
2561
|
});
|
|
2264
2562
|
function mapRoomData(data) {
|
|
2265
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2266
2563
|
const roomData = cloneDeep(data);
|
|
2267
|
-
|
|
2564
|
+
roomData.dimmers?.map((dimmer) => {
|
|
2268
2565
|
if (dimmer instanceof Dimmer2)
|
|
2269
2566
|
return dimmer;
|
|
2270
2567
|
else
|
|
2271
2568
|
return new Dimmer2(dimmer);
|
|
2272
2569
|
});
|
|
2273
|
-
|
|
2570
|
+
roomData.switches?.map((switch_) => {
|
|
2274
2571
|
if (switch_ instanceof Switch2)
|
|
2275
2572
|
return switch_;
|
|
2276
2573
|
else
|
|
2277
2574
|
return new Switch2(switch_);
|
|
2278
2575
|
});
|
|
2279
|
-
|
|
2576
|
+
roomData.windowCoverings?.map((windowCovering) => {
|
|
2280
2577
|
if (windowCovering instanceof WindowCovering2)
|
|
2281
2578
|
return windowCovering;
|
|
2282
2579
|
else
|
|
2283
2580
|
return new WindowCovering2(windowCovering);
|
|
2284
2581
|
});
|
|
2285
|
-
|
|
2582
|
+
roomData.thermostats?.map((thermostat) => {
|
|
2286
2583
|
if (thermostat instanceof Thermostat2)
|
|
2287
2584
|
return thermostat;
|
|
2288
2585
|
else
|
|
2289
2586
|
return new Thermostat2(thermostat);
|
|
2290
2587
|
});
|
|
2291
|
-
|
|
2588
|
+
roomData.locks?.map((lock) => {
|
|
2292
2589
|
if (lock instanceof Lock2)
|
|
2293
2590
|
return lock;
|
|
2294
2591
|
else
|
|
2295
2592
|
return new Lock2(lock);
|
|
2296
2593
|
});
|
|
2297
|
-
|
|
2594
|
+
roomData.courtesy?.map((courtesy) => {
|
|
2298
2595
|
if (courtesy instanceof Courtesy2)
|
|
2299
2596
|
return courtesy;
|
|
2300
2597
|
else
|
|
2301
2598
|
return new Courtesy2(courtesy);
|
|
2302
2599
|
});
|
|
2303
|
-
|
|
2304
|
-
if (source instanceof
|
|
2600
|
+
roomData.mediaSources?.map((source) => {
|
|
2601
|
+
if (source instanceof MediaSource2)
|
|
2305
2602
|
return source;
|
|
2306
2603
|
else
|
|
2307
|
-
return new
|
|
2604
|
+
return new MediaSource2(source);
|
|
2308
2605
|
});
|
|
2309
|
-
|
|
2606
|
+
roomData.cameras?.map((camera) => {
|
|
2310
2607
|
if (camera instanceof Camera2)
|
|
2311
2608
|
return camera;
|
|
2312
2609
|
else
|
|
2313
2610
|
return new Camera2(camera);
|
|
2314
2611
|
});
|
|
2315
|
-
|
|
2612
|
+
roomData.alarms?.map((alarm) => {
|
|
2316
2613
|
if (alarm instanceof Alarm2)
|
|
2317
2614
|
return alarm;
|
|
2318
2615
|
else
|
|
2319
2616
|
return new Alarm2(alarm);
|
|
2320
2617
|
});
|
|
2321
|
-
|
|
2618
|
+
roomData.motionSensors?.map((motionSensor) => {
|
|
2322
2619
|
if (motionSensor instanceof MotionSensor2)
|
|
2323
2620
|
return motionSensor;
|
|
2324
2621
|
else
|
|
2325
2622
|
return new MotionSensor2(motionSensor);
|
|
2326
2623
|
});
|
|
2327
|
-
|
|
2624
|
+
roomData.scenes?.map((scene) => {
|
|
2328
2625
|
if (scene instanceof Scene2)
|
|
2329
2626
|
return scene;
|
|
2330
2627
|
else
|
|
@@ -2332,6 +2629,7 @@ var require_room2 = __commonJS({
|
|
|
2332
2629
|
});
|
|
2333
2630
|
return roomData;
|
|
2334
2631
|
}
|
|
2632
|
+
__name(mapRoomData, "mapRoomData");
|
|
2335
2633
|
module2.exports = Room2;
|
|
2336
2634
|
}
|
|
2337
2635
|
});
|
|
@@ -2341,13 +2639,16 @@ var require_reservation = __commonJS({
|
|
|
2341
2639
|
"src/schemas/reservation.json"(exports2, module2) {
|
|
2342
2640
|
module2.exports = {
|
|
2343
2641
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
2344
|
-
$id: "https://api.kohost.
|
|
2642
|
+
$id: "https://api.kohost.io/schemas/v3/reservation.json",
|
|
2345
2643
|
title: "Reservation",
|
|
2346
2644
|
type: "object",
|
|
2347
2645
|
required: ["type", "status", "checkInDateTime", "checkOutDateTime"],
|
|
2348
2646
|
properties: {
|
|
2349
2647
|
id: {
|
|
2350
|
-
$ref: "https://api.kohost.
|
|
2648
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2649
|
+
},
|
|
2650
|
+
driver: {
|
|
2651
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
2351
2652
|
},
|
|
2352
2653
|
primaryGuest: {
|
|
2353
2654
|
type: "string"
|
|
@@ -2361,14 +2662,40 @@ var require_reservation = __commonJS({
|
|
|
2361
2662
|
type: "string"
|
|
2362
2663
|
}
|
|
2363
2664
|
},
|
|
2665
|
+
spaceType: {
|
|
2666
|
+
type: "string"
|
|
2667
|
+
},
|
|
2364
2668
|
space: {
|
|
2365
2669
|
type: "string"
|
|
2366
2670
|
},
|
|
2367
2671
|
status: {
|
|
2368
2672
|
type: "string",
|
|
2369
|
-
enum: [
|
|
2673
|
+
enum: [
|
|
2674
|
+
"reserved",
|
|
2675
|
+
"checkedIn",
|
|
2676
|
+
"checkedOut",
|
|
2677
|
+
"cancelled",
|
|
2678
|
+
"noShow",
|
|
2679
|
+
"enquired",
|
|
2680
|
+
"requested",
|
|
2681
|
+
"optional"
|
|
2682
|
+
],
|
|
2370
2683
|
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
2684
|
},
|
|
2685
|
+
mobileCheckInStatus: {
|
|
2686
|
+
type: "string",
|
|
2687
|
+
enum: [
|
|
2688
|
+
"ready",
|
|
2689
|
+
"blocked",
|
|
2690
|
+
"preArrivalStepsRequired",
|
|
2691
|
+
"spaceNotAssigned",
|
|
2692
|
+
"spaceNotReady",
|
|
2693
|
+
"checkInTimeNotStarted"
|
|
2694
|
+
]
|
|
2695
|
+
},
|
|
2696
|
+
mobileCheckInStatusMessage: {
|
|
2697
|
+
type: "string"
|
|
2698
|
+
},
|
|
2372
2699
|
confirmationNumber: {
|
|
2373
2700
|
type: "string"
|
|
2374
2701
|
},
|
|
@@ -2389,6 +2716,24 @@ var require_reservation = __commonJS({
|
|
|
2389
2716
|
type: "number",
|
|
2390
2717
|
default: 0
|
|
2391
2718
|
},
|
|
2719
|
+
revenue: {
|
|
2720
|
+
type: "array",
|
|
2721
|
+
items: {
|
|
2722
|
+
type: "object",
|
|
2723
|
+
properties: {
|
|
2724
|
+
date: {
|
|
2725
|
+
type: "string",
|
|
2726
|
+
format: "date"
|
|
2727
|
+
},
|
|
2728
|
+
amount: {
|
|
2729
|
+
type: "number"
|
|
2730
|
+
},
|
|
2731
|
+
type: {
|
|
2732
|
+
type: "string"
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
},
|
|
2392
2737
|
rateSuppressed: {
|
|
2393
2738
|
type: "boolean"
|
|
2394
2739
|
},
|
|
@@ -2402,10 +2747,10 @@ var require_reservation = __commonJS({
|
|
|
2402
2747
|
type: "string"
|
|
2403
2748
|
},
|
|
2404
2749
|
systemData: {
|
|
2405
|
-
$ref: "https://api.kohost.
|
|
2750
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
2406
2751
|
},
|
|
2407
2752
|
metadata: {
|
|
2408
|
-
ref: "https://api.kohost.
|
|
2753
|
+
ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/metadata"
|
|
2409
2754
|
}
|
|
2410
2755
|
}
|
|
2411
2756
|
};
|
|
@@ -2428,12 +2773,20 @@ var require_reservation2 = __commonJS({
|
|
|
2428
2773
|
return this.adultCount + this.childCount;
|
|
2429
2774
|
}
|
|
2430
2775
|
get hasPayment() {
|
|
2431
|
-
|
|
2432
|
-
return ((_a = this.paymentId) == null ? void 0 : _a.length) > 0;
|
|
2776
|
+
return this.paymentId?.length > 0;
|
|
2433
2777
|
}
|
|
2434
2778
|
range(tz) {
|
|
2435
2779
|
const start = new Date(this.checkInDateTime);
|
|
2436
2780
|
const end = new Date(this.checkOutDateTime);
|
|
2781
|
+
if (start.getDate() === end.getDate() && start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
|
|
2782
|
+
return `${start.toLocaleString("default", {
|
|
2783
|
+
month: "short",
|
|
2784
|
+
timeZone: tz
|
|
2785
|
+
})} ${start.toLocaleString("default", {
|
|
2786
|
+
timeZone: tz,
|
|
2787
|
+
day: "numeric"
|
|
2788
|
+
})}`;
|
|
2789
|
+
}
|
|
2437
2790
|
if (start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
|
|
2438
2791
|
return `${start.toLocaleString("default", {
|
|
2439
2792
|
month: "short",
|
|
@@ -2469,6 +2822,7 @@ var require_reservation2 = __commonJS({
|
|
|
2469
2822
|
});
|
|
2470
2823
|
}
|
|
2471
2824
|
};
|
|
2825
|
+
__name(Reservation2, "Reservation");
|
|
2472
2826
|
Object.defineProperty(Reservation2.prototype, "schema", {
|
|
2473
2827
|
value: schema
|
|
2474
2828
|
});
|
|
@@ -2484,75 +2838,17 @@ var require_reservation2 = __commonJS({
|
|
|
2484
2838
|
}
|
|
2485
2839
|
});
|
|
2486
2840
|
|
|
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
2841
|
// src/schemas/space.json
|
|
2546
2842
|
var require_space = __commonJS({
|
|
2547
2843
|
"src/schemas/space.json"(exports2, module2) {
|
|
2548
2844
|
module2.exports = {
|
|
2549
2845
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
2550
|
-
$id: "https://api.kohost.
|
|
2846
|
+
$id: "https://api.kohost.io/schemas/v3/space.json",
|
|
2551
2847
|
title: "Space",
|
|
2552
2848
|
type: "object",
|
|
2553
2849
|
properties: {
|
|
2554
2850
|
id: {
|
|
2555
|
-
$ref: "https://api.kohost.
|
|
2851
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2556
2852
|
},
|
|
2557
2853
|
name: {
|
|
2558
2854
|
type: "string",
|
|
@@ -2569,6 +2865,12 @@ var require_space = __commonJS({
|
|
|
2569
2865
|
"other"
|
|
2570
2866
|
]
|
|
2571
2867
|
},
|
|
2868
|
+
driver: {
|
|
2869
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
2870
|
+
},
|
|
2871
|
+
subType: {
|
|
2872
|
+
type: "string"
|
|
2873
|
+
},
|
|
2572
2874
|
rooms: {
|
|
2573
2875
|
type: "array",
|
|
2574
2876
|
items: {
|
|
@@ -2622,7 +2924,7 @@ var require_space = __commonJS({
|
|
|
2622
2924
|
enum: ["inService", "outOfOrder", "outOfService"]
|
|
2623
2925
|
},
|
|
2624
2926
|
systemData: {
|
|
2625
|
-
$ref: "https://api.kohost.
|
|
2927
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
2626
2928
|
}
|
|
2627
2929
|
},
|
|
2628
2930
|
if: {
|
|
@@ -2700,9 +3002,6 @@ var require_space2 = __commonJS({
|
|
|
2700
3002
|
get hasCourtesy() {
|
|
2701
3003
|
return this.rooms.some((room) => room.hasCourtesy);
|
|
2702
3004
|
}
|
|
2703
|
-
get hasSceneController() {
|
|
2704
|
-
return this.rooms.some((room) => room.hasSceneController);
|
|
2705
|
-
}
|
|
2706
3005
|
get hasCamera() {
|
|
2707
3006
|
return this.rooms.some((room) => room.hasCamera);
|
|
2708
3007
|
}
|
|
@@ -2716,6 +3015,7 @@ var require_space2 = __commonJS({
|
|
|
2716
3015
|
return this.rooms.some((room) => room.occupied);
|
|
2717
3016
|
}
|
|
2718
3017
|
};
|
|
3018
|
+
__name(Space2, "Space");
|
|
2719
3019
|
Object.defineProperty(Space2.prototype, "schema", {
|
|
2720
3020
|
value: schema
|
|
2721
3021
|
});
|
|
@@ -2728,9 +3028,8 @@ var require_space2 = __commonJS({
|
|
|
2728
3028
|
value: Object.keys(schema.properties)
|
|
2729
3029
|
});
|
|
2730
3030
|
function mapSpaceData(data) {
|
|
2731
|
-
var _a;
|
|
2732
3031
|
const spaceData = cloneDeep(data);
|
|
2733
|
-
if (
|
|
3032
|
+
if (spaceData.rooms?.length) {
|
|
2734
3033
|
spaceData.rooms.map((room) => {
|
|
2735
3034
|
if (typeof room === "string")
|
|
2736
3035
|
return room;
|
|
@@ -2741,22 +3040,89 @@ var require_space2 = __commonJS({
|
|
|
2741
3040
|
}
|
|
2742
3041
|
return spaceData;
|
|
2743
3042
|
}
|
|
3043
|
+
__name(mapSpaceData, "mapSpaceData");
|
|
2744
3044
|
module2.exports = Space2;
|
|
2745
3045
|
}
|
|
2746
3046
|
});
|
|
2747
3047
|
|
|
3048
|
+
// src/schemas/spaceType.json
|
|
3049
|
+
var require_spaceType = __commonJS({
|
|
3050
|
+
"src/schemas/spaceType.json"(exports2, module2) {
|
|
3051
|
+
module2.exports = {
|
|
3052
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
3053
|
+
$id: "https://api.kohost.io/schemas/v3/spaceType.json",
|
|
3054
|
+
title: "Space Type",
|
|
3055
|
+
type: "object",
|
|
3056
|
+
properties: {
|
|
3057
|
+
id: {
|
|
3058
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3059
|
+
},
|
|
3060
|
+
type: {
|
|
3061
|
+
type: "string"
|
|
3062
|
+
},
|
|
3063
|
+
name: {
|
|
3064
|
+
type: "string",
|
|
3065
|
+
minLength: 1
|
|
3066
|
+
},
|
|
3067
|
+
driver: {
|
|
3068
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
3069
|
+
},
|
|
3070
|
+
description: {
|
|
3071
|
+
type: "string"
|
|
3072
|
+
},
|
|
3073
|
+
imageUrl: {
|
|
3074
|
+
format: "uri",
|
|
3075
|
+
pattern: "^https?://"
|
|
3076
|
+
},
|
|
3077
|
+
systemData: {
|
|
3078
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
};
|
|
3082
|
+
}
|
|
3083
|
+
});
|
|
3084
|
+
|
|
3085
|
+
// src/Models/spaceType.js
|
|
3086
|
+
var require_spaceType2 = __commonJS({
|
|
3087
|
+
"src/Models/spaceType.js"(exports2, module2) {
|
|
3088
|
+
var schemas = require_schema();
|
|
3089
|
+
var schema = require_spaceType();
|
|
3090
|
+
var Kohost = require_kohost();
|
|
3091
|
+
schemas.add(schema);
|
|
3092
|
+
var validator = schemas.compile(schema);
|
|
3093
|
+
var SpaceType2 = class extends Kohost {
|
|
3094
|
+
constructor(data) {
|
|
3095
|
+
super(data);
|
|
3096
|
+
}
|
|
3097
|
+
};
|
|
3098
|
+
__name(SpaceType2, "SpaceType");
|
|
3099
|
+
Object.defineProperty(SpaceType2.prototype, "schema", {
|
|
3100
|
+
value: schema
|
|
3101
|
+
});
|
|
3102
|
+
Object.defineProperty(SpaceType2.prototype, "validator", {
|
|
3103
|
+
get: function() {
|
|
3104
|
+
return validator;
|
|
3105
|
+
}
|
|
3106
|
+
});
|
|
3107
|
+
Object.defineProperty(SpaceType2, "validProperties", {
|
|
3108
|
+
value: Object.keys(schema.properties)
|
|
3109
|
+
});
|
|
3110
|
+
module2.exports = SpaceType2;
|
|
3111
|
+
}
|
|
3112
|
+
});
|
|
3113
|
+
|
|
2748
3114
|
// src/schemas/ticket.json
|
|
2749
3115
|
var require_ticket = __commonJS({
|
|
2750
3116
|
"src/schemas/ticket.json"(exports2, module2) {
|
|
2751
3117
|
module2.exports = {
|
|
2752
3118
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
2753
|
-
$id: "https://api.kohost.
|
|
3119
|
+
$id: "https://api.kohost.io/schemas/v3/ticket.json",
|
|
2754
3120
|
title: "Ticket",
|
|
2755
3121
|
description: "A ticket is a request for help from a user.",
|
|
2756
3122
|
type: "object",
|
|
2757
3123
|
properties: {
|
|
2758
3124
|
id: {
|
|
2759
|
-
$ref: "https://api.kohost.
|
|
3125
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2760
3126
|
},
|
|
2761
3127
|
conversation: {
|
|
2762
3128
|
type: "array",
|
|
@@ -2768,11 +3134,14 @@ var require_ticket = __commonJS({
|
|
|
2768
3134
|
id: {
|
|
2769
3135
|
type: "string"
|
|
2770
3136
|
},
|
|
2771
|
-
|
|
3137
|
+
userId: {
|
|
3138
|
+
type: "string"
|
|
3139
|
+
},
|
|
3140
|
+
userName: {
|
|
2772
3141
|
type: "string"
|
|
2773
3142
|
},
|
|
2774
3143
|
timestamp: {
|
|
2775
|
-
$ref: "https://api.kohost.
|
|
3144
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
2776
3145
|
},
|
|
2777
3146
|
body: {
|
|
2778
3147
|
type: "string"
|
|
@@ -2785,7 +3154,7 @@ var require_ticket = __commonJS({
|
|
|
2785
3154
|
}
|
|
2786
3155
|
}
|
|
2787
3156
|
},
|
|
2788
|
-
required: ["
|
|
3157
|
+
required: ["userId", "id", "timestamp", "body"]
|
|
2789
3158
|
}
|
|
2790
3159
|
},
|
|
2791
3160
|
requester: {
|
|
@@ -2807,16 +3176,16 @@ var require_ticket = __commonJS({
|
|
|
2807
3176
|
}
|
|
2808
3177
|
},
|
|
2809
3178
|
createdAt: {
|
|
2810
|
-
$ref: "https://api.kohost.
|
|
3179
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
2811
3180
|
},
|
|
2812
3181
|
updatedAt: {
|
|
2813
|
-
$ref: "https://api.kohost.
|
|
3182
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
2814
3183
|
},
|
|
2815
3184
|
solvedAt: {
|
|
2816
|
-
$ref: "https://api.kohost.
|
|
3185
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
2817
3186
|
},
|
|
2818
3187
|
closedAt: {
|
|
2819
|
-
$ref: "https://api.kohost.
|
|
3188
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
2820
3189
|
}
|
|
2821
3190
|
},
|
|
2822
3191
|
required: [
|
|
@@ -2852,6 +3221,7 @@ var require_ticket2 = __commonJS({
|
|
|
2852
3221
|
return nanoid(len);
|
|
2853
3222
|
}
|
|
2854
3223
|
};
|
|
3224
|
+
__name(Ticket2, "Ticket");
|
|
2855
3225
|
Object.defineProperty(Ticket2.prototype, "schema", {
|
|
2856
3226
|
value: schema
|
|
2857
3227
|
});
|
|
@@ -2875,8 +3245,8 @@ var require_ticket2 = __commonJS({
|
|
|
2875
3245
|
return msg;
|
|
2876
3246
|
});
|
|
2877
3247
|
const sorted = sortBy(mapped, ["timestamp"]);
|
|
2878
|
-
const firstMsg = sorted.find((entry) => entry.
|
|
2879
|
-
const firstResponse = sorted.find((entry) => entry.
|
|
3248
|
+
const firstMsg = sorted.find((entry) => entry.userId === requester);
|
|
3249
|
+
const firstResponse = sorted.find((entry) => entry.userId !== requester);
|
|
2880
3250
|
if (firstMsg && firstResponse) {
|
|
2881
3251
|
const firstMsgTime = firstMsg.timestamp.getTime() / 1e3;
|
|
2882
3252
|
const firstResponseTime = firstResponse.timestamp.getTime() / 1e3;
|
|
@@ -2900,12 +3270,12 @@ var require_ticket2 = __commonJS({
|
|
|
2900
3270
|
const requester = this.requester;
|
|
2901
3271
|
const sorted = sortBy(conversation, ["timestamp"]);
|
|
2902
3272
|
const lastFromNonRequester = findLast(sorted, function(c) {
|
|
2903
|
-
return c.
|
|
3273
|
+
return c.userId !== requester;
|
|
2904
3274
|
});
|
|
2905
3275
|
if (!lastFromNonRequester)
|
|
2906
3276
|
return null;
|
|
2907
3277
|
else
|
|
2908
|
-
return lastFromNonRequester.
|
|
3278
|
+
return lastFromNonRequester.userId;
|
|
2909
3279
|
}
|
|
2910
3280
|
});
|
|
2911
3281
|
module2.exports = Ticket2;
|
|
@@ -2917,32 +3287,38 @@ var require_gateway = __commonJS({
|
|
|
2917
3287
|
"src/schemas/gateway.json"(exports2, module2) {
|
|
2918
3288
|
module2.exports = {
|
|
2919
3289
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
2920
|
-
$id: "https://api.kohost.
|
|
3290
|
+
$id: "https://api.kohost.io/schemas/v3/iotGateway.json",
|
|
2921
3291
|
title: "IoT Gateway",
|
|
2922
3292
|
description: "Any smart gateway that is an entrypoint for controlling devices",
|
|
2923
3293
|
type: "object",
|
|
2924
3294
|
properties: {
|
|
2925
3295
|
id: {
|
|
2926
|
-
$ref: "https://api.kohost.
|
|
3296
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/id"
|
|
2927
3297
|
},
|
|
2928
3298
|
type: {
|
|
2929
|
-
$ref: "https://api.kohost.
|
|
3299
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
2930
3300
|
},
|
|
2931
3301
|
supportedNotifications: {
|
|
2932
|
-
$ref: "https://api.kohost.
|
|
3302
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
2933
3303
|
},
|
|
2934
3304
|
notification: {
|
|
2935
|
-
$ref: "https://api.kohost.
|
|
3305
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/notification"
|
|
2936
3306
|
},
|
|
2937
3307
|
status: {
|
|
2938
3308
|
type: "string"
|
|
2939
3309
|
},
|
|
2940
3310
|
systemData: {
|
|
2941
|
-
$ref: "https://api.kohost.
|
|
3311
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
3312
|
+
},
|
|
3313
|
+
driver: {
|
|
3314
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
3315
|
+
},
|
|
3316
|
+
watts: {
|
|
3317
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
2942
3318
|
}
|
|
2943
3319
|
},
|
|
2944
3320
|
additionalProperties: false,
|
|
2945
|
-
required: ["id", "type", "systemData", "status"]
|
|
3321
|
+
required: ["id", "type", "systemData", "status", "driver"]
|
|
2946
3322
|
};
|
|
2947
3323
|
}
|
|
2948
3324
|
});
|
|
@@ -2960,6 +3336,7 @@ var require_gateway2 = __commonJS({
|
|
|
2960
3336
|
super(data);
|
|
2961
3337
|
}
|
|
2962
3338
|
};
|
|
3339
|
+
__name(Gateway2, "Gateway");
|
|
2963
3340
|
Object.defineProperty(Gateway2.prototype, "schema", {
|
|
2964
3341
|
value: schema
|
|
2965
3342
|
});
|
|
@@ -2980,13 +3357,13 @@ var require_product = __commonJS({
|
|
|
2980
3357
|
"src/schemas/product.json"(exports2, module2) {
|
|
2981
3358
|
module2.exports = {
|
|
2982
3359
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
2983
|
-
$id: "https://api.kohost.
|
|
3360
|
+
$id: "https://api.kohost.io/schemas/v3/product.json",
|
|
2984
3361
|
title: "Product",
|
|
2985
3362
|
type: "object",
|
|
2986
|
-
required: ["name", "
|
|
3363
|
+
required: ["name", "price", "currency", "driver"],
|
|
2987
3364
|
properties: {
|
|
2988
3365
|
id: {
|
|
2989
|
-
$ref: "https://api.kohost.
|
|
3366
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
2990
3367
|
},
|
|
2991
3368
|
type: {
|
|
2992
3369
|
type: "string"
|
|
@@ -2994,6 +3371,9 @@ var require_product = __commonJS({
|
|
|
2994
3371
|
name: {
|
|
2995
3372
|
type: "string"
|
|
2996
3373
|
},
|
|
3374
|
+
driver: {
|
|
3375
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/driver"
|
|
3376
|
+
},
|
|
2997
3377
|
description: {
|
|
2998
3378
|
string: "string"
|
|
2999
3379
|
},
|
|
@@ -3007,10 +3387,14 @@ var require_product = __commonJS({
|
|
|
3007
3387
|
maxLength: 3
|
|
3008
3388
|
},
|
|
3009
3389
|
image: {
|
|
3010
|
-
$ref: "https://api.kohost.
|
|
3390
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/file"
|
|
3391
|
+
},
|
|
3392
|
+
imageUrl: {
|
|
3393
|
+
format: "uri",
|
|
3394
|
+
pattern: "^https?://"
|
|
3011
3395
|
},
|
|
3012
3396
|
systemData: {
|
|
3013
|
-
$ref: "https://api.kohost.
|
|
3397
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3014
3398
|
}
|
|
3015
3399
|
}
|
|
3016
3400
|
};
|
|
@@ -3030,6 +3414,7 @@ var require_product2 = __commonJS({
|
|
|
3030
3414
|
super(data);
|
|
3031
3415
|
}
|
|
3032
3416
|
};
|
|
3417
|
+
__name(Product2, "Product");
|
|
3033
3418
|
Object.defineProperty(Product2.prototype, "schema", {
|
|
3034
3419
|
value: schema
|
|
3035
3420
|
});
|
|
@@ -3050,14 +3435,14 @@ var require_discoveredDevice = __commonJS({
|
|
|
3050
3435
|
"src/schemas/discoveredDevice.json"(exports2, module2) {
|
|
3051
3436
|
module2.exports = {
|
|
3052
3437
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3053
|
-
$id: "https://api.kohost.
|
|
3438
|
+
$id: "https://api.kohost.io/schemas/v3/discoveredDevice.json",
|
|
3054
3439
|
title: "Discovered Device",
|
|
3055
3440
|
description: "A device that has been discovered by Kohost, but not yet added to the Kohost system.",
|
|
3056
3441
|
type: "object",
|
|
3057
|
-
required: ["name", "deviceId", "
|
|
3442
|
+
required: ["name", "deviceId", "deviceData"],
|
|
3058
3443
|
properties: {
|
|
3059
3444
|
id: {
|
|
3060
|
-
$ref: "https://api.kohost.
|
|
3445
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3061
3446
|
},
|
|
3062
3447
|
name: {
|
|
3063
3448
|
type: "string"
|
|
@@ -3066,28 +3451,16 @@ var require_discoveredDevice = __commonJS({
|
|
|
3066
3451
|
type: "string"
|
|
3067
3452
|
},
|
|
3068
3453
|
type: {
|
|
3069
|
-
|
|
3070
|
-
enum: [
|
|
3071
|
-
"dimmer",
|
|
3072
|
-
"switch",
|
|
3073
|
-
"motionSensor",
|
|
3074
|
-
"thermostat",
|
|
3075
|
-
"lock",
|
|
3076
|
-
"camera",
|
|
3077
|
-
"courtesy",
|
|
3078
|
-
"source",
|
|
3079
|
-
"alarm",
|
|
3080
|
-
"windowCovering"
|
|
3081
|
-
]
|
|
3454
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
3082
3455
|
},
|
|
3083
3456
|
driver: {
|
|
3084
3457
|
type: "string"
|
|
3085
3458
|
},
|
|
3086
|
-
integrationId: {
|
|
3087
|
-
type: "string"
|
|
3088
|
-
},
|
|
3089
3459
|
deviceData: {
|
|
3090
3460
|
type: "object"
|
|
3461
|
+
},
|
|
3462
|
+
ignore: {
|
|
3463
|
+
type: "boolean"
|
|
3091
3464
|
}
|
|
3092
3465
|
}
|
|
3093
3466
|
};
|
|
@@ -3107,6 +3480,7 @@ var require_discoveredDevice2 = __commonJS({
|
|
|
3107
3480
|
super(data);
|
|
3108
3481
|
}
|
|
3109
3482
|
};
|
|
3483
|
+
__name(DiscoveredDevice2, "DiscoveredDevice");
|
|
3110
3484
|
Object.defineProperty(DiscoveredDevice2.prototype, "schema", {
|
|
3111
3485
|
value: schema
|
|
3112
3486
|
});
|
|
@@ -3127,17 +3501,17 @@ var require_credential = __commonJS({
|
|
|
3127
3501
|
"src/schemas/credential.json"(exports2, module2) {
|
|
3128
3502
|
module2.exports = {
|
|
3129
3503
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3130
|
-
$id: "https://api.kohost.
|
|
3504
|
+
$id: "https://api.kohost.io/schemas/v3/credential.json",
|
|
3131
3505
|
title: "Credential",
|
|
3132
3506
|
type: "object",
|
|
3133
3507
|
required: ["type", "credential", "expires"],
|
|
3134
3508
|
properties: {
|
|
3135
3509
|
id: {
|
|
3136
|
-
$ref: "https://api.kohost.
|
|
3510
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3137
3511
|
},
|
|
3138
3512
|
type: {
|
|
3139
3513
|
type: "string",
|
|
3140
|
-
enum: ["verificationCode", "token"]
|
|
3514
|
+
enum: ["verificationCode", "token", "mobileKey"]
|
|
3141
3515
|
},
|
|
3142
3516
|
credential: {
|
|
3143
3517
|
type: "string"
|
|
@@ -3150,6 +3524,9 @@ var require_credential = __commonJS({
|
|
|
3150
3524
|
},
|
|
3151
3525
|
expires: {
|
|
3152
3526
|
string: "string"
|
|
3527
|
+
},
|
|
3528
|
+
systemData: {
|
|
3529
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3153
3530
|
}
|
|
3154
3531
|
}
|
|
3155
3532
|
};
|
|
@@ -3169,6 +3546,7 @@ var require_credential2 = __commonJS({
|
|
|
3169
3546
|
super(data);
|
|
3170
3547
|
}
|
|
3171
3548
|
};
|
|
3549
|
+
__name(Credential2, "Credential");
|
|
3172
3550
|
Object.defineProperty(Credential2.prototype, "schema", {
|
|
3173
3551
|
value: schema
|
|
3174
3552
|
});
|
|
@@ -3189,13 +3567,13 @@ var require_shortLink = __commonJS({
|
|
|
3189
3567
|
"src/schemas/shortLink.json"(exports2, module2) {
|
|
3190
3568
|
module2.exports = {
|
|
3191
3569
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3192
|
-
$id: "https://api.kohost.
|
|
3570
|
+
$id: "https://api.kohost.io/schemas/v3/shortLink.json",
|
|
3193
3571
|
title: "Short Link",
|
|
3194
3572
|
type: "object",
|
|
3195
3573
|
required: ["destination", "url"],
|
|
3196
3574
|
properties: {
|
|
3197
3575
|
id: {
|
|
3198
|
-
$ref: "https://api.kohost.
|
|
3576
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3199
3577
|
},
|
|
3200
3578
|
type: {
|
|
3201
3579
|
type: "string",
|
|
@@ -3213,7 +3591,7 @@ var require_shortLink = __commonJS({
|
|
|
3213
3591
|
format: "uri"
|
|
3214
3592
|
},
|
|
3215
3593
|
systemData: {
|
|
3216
|
-
$ref: "https://api.kohost.
|
|
3594
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
3217
3595
|
}
|
|
3218
3596
|
}
|
|
3219
3597
|
};
|
|
@@ -3233,6 +3611,7 @@ var require_shortLink2 = __commonJS({
|
|
|
3233
3611
|
super(data);
|
|
3234
3612
|
}
|
|
3235
3613
|
};
|
|
3614
|
+
__name(ShortLink2, "ShortLink");
|
|
3236
3615
|
Object.defineProperty(ShortLink2.prototype, "schema", {
|
|
3237
3616
|
value: schema
|
|
3238
3617
|
});
|
|
@@ -3248,85 +3627,250 @@ var require_shortLink2 = __commonJS({
|
|
|
3248
3627
|
}
|
|
3249
3628
|
});
|
|
3250
3629
|
|
|
3251
|
-
// src/schemas/
|
|
3252
|
-
var
|
|
3253
|
-
"src/schemas/
|
|
3630
|
+
// src/schemas/energyReportShard.json
|
|
3631
|
+
var require_energyReportShard = __commonJS({
|
|
3632
|
+
"src/schemas/energyReportShard.json"(exports2, module2) {
|
|
3254
3633
|
module2.exports = {
|
|
3255
3634
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3256
|
-
$id: "https://api.kohost.
|
|
3257
|
-
title: "
|
|
3635
|
+
$id: "https://api.kohost.io/schemas/v3/energyReportShard.json",
|
|
3636
|
+
title: "Energy Report Shard",
|
|
3637
|
+
description: "Shard used for Energy Reports",
|
|
3258
3638
|
type: "object",
|
|
3259
|
-
|
|
3260
|
-
|
|
3639
|
+
required: [
|
|
3640
|
+
"id",
|
|
3641
|
+
"type",
|
|
3642
|
+
"roomId",
|
|
3643
|
+
"first",
|
|
3644
|
+
"last",
|
|
3645
|
+
"data",
|
|
3646
|
+
"ndata",
|
|
3647
|
+
"expires"
|
|
3648
|
+
],
|
|
3261
3649
|
properties: {
|
|
3262
3650
|
id: {
|
|
3263
|
-
$ref: "https://api.kohost.
|
|
3651
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3264
3652
|
},
|
|
3265
|
-
|
|
3266
|
-
type: "
|
|
3267
|
-
|
|
3653
|
+
type: {
|
|
3654
|
+
type: "string",
|
|
3655
|
+
enum: ["energyReportShard"],
|
|
3656
|
+
default: "energyReportShard"
|
|
3268
3657
|
},
|
|
3269
|
-
|
|
3270
|
-
|
|
3658
|
+
roomId: {
|
|
3659
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3271
3660
|
},
|
|
3272
|
-
|
|
3661
|
+
first: {
|
|
3662
|
+
type: ["string", "object"],
|
|
3663
|
+
format: "date-time"
|
|
3664
|
+
},
|
|
3665
|
+
last: {
|
|
3666
|
+
type: ["string", "object"],
|
|
3667
|
+
format: "date-time"
|
|
3668
|
+
},
|
|
3669
|
+
data: {
|
|
3273
3670
|
type: "array",
|
|
3274
3671
|
items: {
|
|
3275
|
-
type: "
|
|
3672
|
+
type: "object",
|
|
3673
|
+
required: ["time", "watts", "id", "type", "value"],
|
|
3674
|
+
properties: {
|
|
3675
|
+
time: {
|
|
3676
|
+
type: ["string", "object"],
|
|
3677
|
+
format: "date-time"
|
|
3678
|
+
},
|
|
3679
|
+
watts: {
|
|
3680
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/watts"
|
|
3681
|
+
},
|
|
3682
|
+
id: {
|
|
3683
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3684
|
+
},
|
|
3685
|
+
type: {
|
|
3686
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
3687
|
+
},
|
|
3688
|
+
value: {
|
|
3689
|
+
type: "number",
|
|
3690
|
+
minimum: 0,
|
|
3691
|
+
maximum: 1
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3276
3694
|
}
|
|
3277
3695
|
},
|
|
3278
|
-
|
|
3279
|
-
|
|
3696
|
+
ndata: {
|
|
3697
|
+
type: "integer",
|
|
3698
|
+
minimum: 0,
|
|
3699
|
+
maximum: 1e5,
|
|
3700
|
+
default: 0
|
|
3280
3701
|
},
|
|
3281
|
-
|
|
3282
|
-
|
|
3702
|
+
expires: {
|
|
3703
|
+
type: ["string", "object"],
|
|
3704
|
+
format: "date-time"
|
|
3283
3705
|
}
|
|
3284
3706
|
}
|
|
3285
3707
|
};
|
|
3286
3708
|
}
|
|
3287
3709
|
});
|
|
3288
3710
|
|
|
3289
|
-
// src/Models/
|
|
3290
|
-
var
|
|
3291
|
-
"src/Models/
|
|
3711
|
+
// src/Models/energyReportShard.js
|
|
3712
|
+
var require_energyReportShard2 = __commonJS({
|
|
3713
|
+
"src/Models/energyReportShard.js"(exports2, module2) {
|
|
3292
3714
|
var schemas = require_schema();
|
|
3293
|
-
var schema =
|
|
3715
|
+
var schema = require_energyReportShard();
|
|
3294
3716
|
var Kohost = require_kohost();
|
|
3295
3717
|
schemas.add(schema);
|
|
3296
3718
|
var validator = schemas.compile(schema);
|
|
3297
|
-
var
|
|
3719
|
+
var EnergyReportShard2 = class extends Kohost {
|
|
3298
3720
|
constructor(data) {
|
|
3299
3721
|
super(data);
|
|
3300
3722
|
}
|
|
3301
3723
|
};
|
|
3302
|
-
|
|
3724
|
+
__name(EnergyReportShard2, "EnergyReportShard");
|
|
3725
|
+
Object.defineProperty(EnergyReportShard2.prototype, "schema", {
|
|
3303
3726
|
value: schema
|
|
3304
3727
|
});
|
|
3305
|
-
Object.defineProperty(
|
|
3728
|
+
Object.defineProperty(EnergyReportShard2.prototype, "validator", {
|
|
3306
3729
|
get: function() {
|
|
3307
3730
|
return validator;
|
|
3308
3731
|
}
|
|
3309
3732
|
});
|
|
3310
|
-
Object.defineProperty(
|
|
3733
|
+
Object.defineProperty(EnergyReportShard2, "validProperties", {
|
|
3311
3734
|
value: Object.keys(schema.properties)
|
|
3312
3735
|
});
|
|
3313
|
-
module2.exports =
|
|
3736
|
+
module2.exports = EnergyReportShard2;
|
|
3314
3737
|
}
|
|
3315
3738
|
});
|
|
3316
3739
|
|
|
3317
|
-
// src/schemas/
|
|
3740
|
+
// src/schemas/energyReport.json
|
|
3741
|
+
var require_energyReport = __commonJS({
|
|
3742
|
+
"src/schemas/energyReport.json"(exports2, module2) {
|
|
3743
|
+
module2.exports = {
|
|
3744
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
3745
|
+
$id: "https://api.kohost.io/schemas/v3/energyReport.json",
|
|
3746
|
+
title: "Energy Report Hourly",
|
|
3747
|
+
description: "Hourly Report for Energy based on energy report shards",
|
|
3748
|
+
type: "object",
|
|
3749
|
+
required: [
|
|
3750
|
+
"id",
|
|
3751
|
+
"type",
|
|
3752
|
+
"roomId",
|
|
3753
|
+
"first",
|
|
3754
|
+
"last",
|
|
3755
|
+
"consumption",
|
|
3756
|
+
"totals",
|
|
3757
|
+
"costPerKw"
|
|
3758
|
+
],
|
|
3759
|
+
properties: {
|
|
3760
|
+
id: {
|
|
3761
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3762
|
+
},
|
|
3763
|
+
type: {
|
|
3764
|
+
type: "string",
|
|
3765
|
+
enum: ["energyReport"],
|
|
3766
|
+
default: "energyReport"
|
|
3767
|
+
},
|
|
3768
|
+
reportTime: {
|
|
3769
|
+
time: "string",
|
|
3770
|
+
enum: ["hourly", "daily", "monthly"]
|
|
3771
|
+
},
|
|
3772
|
+
roomId: {
|
|
3773
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3774
|
+
},
|
|
3775
|
+
first: {
|
|
3776
|
+
type: ["string", "object"],
|
|
3777
|
+
format: "date-time"
|
|
3778
|
+
},
|
|
3779
|
+
last: {
|
|
3780
|
+
type: ["string", "object"],
|
|
3781
|
+
format: "date-time"
|
|
3782
|
+
},
|
|
3783
|
+
consumption: {
|
|
3784
|
+
type: "array",
|
|
3785
|
+
items: {
|
|
3786
|
+
type: "object",
|
|
3787
|
+
required: ["id", "type", "kwh"],
|
|
3788
|
+
properties: {
|
|
3789
|
+
id: {
|
|
3790
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3791
|
+
},
|
|
3792
|
+
type: {
|
|
3793
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/device.json#/definitions/type"
|
|
3794
|
+
},
|
|
3795
|
+
kwh: {
|
|
3796
|
+
type: "number",
|
|
3797
|
+
minimum: 0
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
},
|
|
3802
|
+
totals: {
|
|
3803
|
+
type: "array",
|
|
3804
|
+
items: {
|
|
3805
|
+
type: "object",
|
|
3806
|
+
required: ["lights", "climate", "media"],
|
|
3807
|
+
properties: {
|
|
3808
|
+
lights: {
|
|
3809
|
+
type: "number",
|
|
3810
|
+
minimum: 0
|
|
3811
|
+
},
|
|
3812
|
+
climate: {
|
|
3813
|
+
type: "number",
|
|
3814
|
+
minimum: 0
|
|
3815
|
+
},
|
|
3816
|
+
media: {
|
|
3817
|
+
type: "number",
|
|
3818
|
+
minimum: 0
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
},
|
|
3823
|
+
costPerKw: {
|
|
3824
|
+
type: "number",
|
|
3825
|
+
minimum: 0
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3829
|
+
}
|
|
3830
|
+
});
|
|
3831
|
+
|
|
3832
|
+
// src/Models/energyReport.js
|
|
3833
|
+
var require_energyReport2 = __commonJS({
|
|
3834
|
+
"src/Models/energyReport.js"(exports2, module2) {
|
|
3835
|
+
var schemas = require_schema();
|
|
3836
|
+
var schema = require_energyReport();
|
|
3837
|
+
var Kohost = require_kohost();
|
|
3838
|
+
schemas.add(schema);
|
|
3839
|
+
var validator = schemas.compile(schema);
|
|
3840
|
+
var EnergyReport2 = class extends Kohost {
|
|
3841
|
+
constructor(data) {
|
|
3842
|
+
super(data);
|
|
3843
|
+
}
|
|
3844
|
+
};
|
|
3845
|
+
__name(EnergyReport2, "EnergyReport");
|
|
3846
|
+
Object.defineProperty(EnergyReport2.prototype, "schema", {
|
|
3847
|
+
value: schema
|
|
3848
|
+
});
|
|
3849
|
+
Object.defineProperty(EnergyReport2.prototype, "validator", {
|
|
3850
|
+
get: function() {
|
|
3851
|
+
return validator;
|
|
3852
|
+
}
|
|
3853
|
+
});
|
|
3854
|
+
Object.defineProperty(EnergyReport2, "validProperties", {
|
|
3855
|
+
value: Object.keys(schema.properties)
|
|
3856
|
+
});
|
|
3857
|
+
module2.exports = EnergyReport2;
|
|
3858
|
+
}
|
|
3859
|
+
});
|
|
3860
|
+
|
|
3861
|
+
// src/schemas/property.json
|
|
3318
3862
|
var require_property = __commonJS({
|
|
3319
|
-
"src/schemas/
|
|
3863
|
+
"src/schemas/property.json"(exports2, module2) {
|
|
3320
3864
|
module2.exports = {
|
|
3321
3865
|
$schema: "http://json-schema.org/draft-07/schema",
|
|
3322
|
-
$id: "https://api.kohost.
|
|
3866
|
+
$id: "https://api.kohost.io/schemas/v3/admin/property.json",
|
|
3323
3867
|
title: "Property",
|
|
3324
3868
|
type: "object",
|
|
3325
3869
|
description: "A property is a physical asset or building",
|
|
3326
|
-
required: ["id", "name", "type", "hostname"],
|
|
3870
|
+
required: ["id", "name", "type", "hostname", "organization"],
|
|
3327
3871
|
properties: {
|
|
3328
3872
|
id: {
|
|
3329
|
-
$ref: "https://api.kohost.
|
|
3873
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
3330
3874
|
},
|
|
3331
3875
|
name: {
|
|
3332
3876
|
type: "string"
|
|
@@ -3344,6 +3888,10 @@ var require_property = __commonJS({
|
|
|
3344
3888
|
hostname: {
|
|
3345
3889
|
type: "string"
|
|
3346
3890
|
},
|
|
3891
|
+
organization: {
|
|
3892
|
+
type: "string",
|
|
3893
|
+
description: "Reference (id) to the organization that owns this property"
|
|
3894
|
+
},
|
|
3347
3895
|
address: {
|
|
3348
3896
|
type: "object",
|
|
3349
3897
|
properties: {
|
|
@@ -3482,6 +4030,42 @@ var require_property = __commonJS({
|
|
|
3482
4030
|
CheckIn: {},
|
|
3483
4031
|
CheckOut: {},
|
|
3484
4032
|
Concierge: {},
|
|
4033
|
+
DigitalKey: {
|
|
4034
|
+
type: "object",
|
|
4035
|
+
properties: {
|
|
4036
|
+
system: {
|
|
4037
|
+
type: "string",
|
|
4038
|
+
enum: ["salto"]
|
|
4039
|
+
},
|
|
4040
|
+
branding: {
|
|
4041
|
+
type: "object",
|
|
4042
|
+
properties: {
|
|
4043
|
+
logo: {
|
|
4044
|
+
type: "string",
|
|
4045
|
+
format: "uri"
|
|
4046
|
+
},
|
|
4047
|
+
gradient: {
|
|
4048
|
+
type: "array",
|
|
4049
|
+
items: {
|
|
4050
|
+
type: "string",
|
|
4051
|
+
pattern: "^(?!#ffffff)(#[0-9a-fA-F]{6})$"
|
|
4052
|
+
},
|
|
4053
|
+
minItems: 2,
|
|
4054
|
+
maxItems: 2
|
|
4055
|
+
},
|
|
4056
|
+
highlightedGradient: {
|
|
4057
|
+
type: "array",
|
|
4058
|
+
items: {
|
|
4059
|
+
type: "string",
|
|
4060
|
+
pattern: "^(?!#ffffff)(#[0-9a-fA-F]{6})$"
|
|
4061
|
+
},
|
|
4062
|
+
minItems: 2,
|
|
4063
|
+
maxItems: 3
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
},
|
|
3485
4069
|
Elevator: {}
|
|
3486
4070
|
},
|
|
3487
4071
|
additionalProperties: false,
|
|
@@ -3499,31 +4083,103 @@ var require_property = __commonJS({
|
|
|
3499
4083
|
}
|
|
3500
4084
|
});
|
|
3501
4085
|
|
|
3502
|
-
// src/Models/
|
|
4086
|
+
// src/Models/property.js
|
|
3503
4087
|
var require_property2 = __commonJS({
|
|
3504
|
-
"src/Models/
|
|
4088
|
+
"src/Models/property.js"(exports2, module2) {
|
|
3505
4089
|
var schemas = require_schema();
|
|
3506
4090
|
var schema = require_property();
|
|
3507
4091
|
var Kohost = require_kohost();
|
|
3508
4092
|
schemas.add(schema);
|
|
3509
4093
|
var validator = schemas.compile(schema);
|
|
3510
|
-
var
|
|
4094
|
+
var Property2 = class extends Kohost {
|
|
4095
|
+
constructor(data) {
|
|
4096
|
+
super(data);
|
|
4097
|
+
}
|
|
4098
|
+
};
|
|
4099
|
+
__name(Property2, "Property");
|
|
4100
|
+
Object.defineProperty(Property2.prototype, "schema", {
|
|
4101
|
+
value: schema
|
|
4102
|
+
});
|
|
4103
|
+
Object.defineProperty(Property2.prototype, "validator", {
|
|
4104
|
+
get: function() {
|
|
4105
|
+
return validator;
|
|
4106
|
+
}
|
|
4107
|
+
});
|
|
4108
|
+
Object.defineProperty(Property2, "validProperties", {
|
|
4109
|
+
value: Object.keys(schema.properties)
|
|
4110
|
+
});
|
|
4111
|
+
module2.exports = Property2;
|
|
4112
|
+
}
|
|
4113
|
+
});
|
|
4114
|
+
|
|
4115
|
+
// src/schemas/organization.json
|
|
4116
|
+
var require_organization = __commonJS({
|
|
4117
|
+
"src/schemas/organization.json"(exports2, module2) {
|
|
4118
|
+
module2.exports = {
|
|
4119
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
4120
|
+
$id: "https://api.kohost.io/schemas/v3/admin/organization.json",
|
|
4121
|
+
title: "Organization",
|
|
4122
|
+
type: "object",
|
|
4123
|
+
description: "An organization is a group or entity that subscribes to Kohost software.",
|
|
4124
|
+
required: ["accountNumber", "name"],
|
|
4125
|
+
properties: {
|
|
4126
|
+
id: {
|
|
4127
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/id"
|
|
4128
|
+
},
|
|
4129
|
+
accountNumber: {
|
|
4130
|
+
type: "number",
|
|
4131
|
+
minimum: 1e4
|
|
4132
|
+
},
|
|
4133
|
+
name: {
|
|
4134
|
+
type: "string"
|
|
4135
|
+
},
|
|
4136
|
+
properties: {
|
|
4137
|
+
type: "array",
|
|
4138
|
+
items: {
|
|
4139
|
+
type: "string"
|
|
4140
|
+
}
|
|
4141
|
+
},
|
|
4142
|
+
credentials: {
|
|
4143
|
+
type: "object",
|
|
4144
|
+
additionalProperties: true
|
|
4145
|
+
},
|
|
4146
|
+
createdAt: {
|
|
4147
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
4148
|
+
},
|
|
4149
|
+
updatedAt: {
|
|
4150
|
+
$ref: "https://api.kohost.io/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
};
|
|
4154
|
+
}
|
|
4155
|
+
});
|
|
4156
|
+
|
|
4157
|
+
// src/Models/organization.js
|
|
4158
|
+
var require_organization2 = __commonJS({
|
|
4159
|
+
"src/Models/organization.js"(exports2, module2) {
|
|
4160
|
+
var schemas = require_schema();
|
|
4161
|
+
var schema = require_organization();
|
|
4162
|
+
var Kohost = require_kohost();
|
|
4163
|
+
schemas.add(schema);
|
|
4164
|
+
var validator = schemas.compile(schema);
|
|
4165
|
+
var Organization2 = class extends Kohost {
|
|
3511
4166
|
constructor(data) {
|
|
3512
4167
|
super(data);
|
|
3513
4168
|
}
|
|
3514
4169
|
};
|
|
3515
|
-
|
|
4170
|
+
__name(Organization2, "Organization");
|
|
4171
|
+
Object.defineProperty(Organization2.prototype, "schema", {
|
|
3516
4172
|
value: schema
|
|
3517
4173
|
});
|
|
3518
|
-
Object.defineProperty(
|
|
4174
|
+
Object.defineProperty(Organization2.prototype, "validator", {
|
|
3519
4175
|
get: function() {
|
|
3520
4176
|
return validator;
|
|
3521
4177
|
}
|
|
3522
4178
|
});
|
|
3523
|
-
Object.defineProperty(
|
|
4179
|
+
Object.defineProperty(Organization2, "validProperties", {
|
|
3524
4180
|
value: Object.keys(schema.properties)
|
|
3525
4181
|
});
|
|
3526
|
-
module2.exports =
|
|
4182
|
+
module2.exports = Organization2;
|
|
3527
4183
|
}
|
|
3528
4184
|
});
|
|
3529
4185
|
|
|
@@ -3536,14 +4192,15 @@ var Thermostat = require_thermostat2();
|
|
|
3536
4192
|
var WindowCovering = require_windowCovering2();
|
|
3537
4193
|
var Identification = require_identification2();
|
|
3538
4194
|
var User = require_user2();
|
|
4195
|
+
var SystemUser = require_systemUser2();
|
|
3539
4196
|
var Courtesy = require_courtesy2();
|
|
3540
4197
|
var Camera = require_camera2();
|
|
3541
4198
|
var MotionSensor = require_motionSensor2();
|
|
3542
4199
|
var MediaSource = require_mediaSource2();
|
|
3543
4200
|
var Room = require_room2();
|
|
3544
4201
|
var Reservation = require_reservation2();
|
|
3545
|
-
var Application = require_application2();
|
|
3546
4202
|
var Space = require_space2();
|
|
4203
|
+
var SpaceType = require_spaceType2();
|
|
3547
4204
|
var Ticket = require_ticket2();
|
|
3548
4205
|
var Scene = require_scene2();
|
|
3549
4206
|
var Gateway = require_gateway2();
|
|
@@ -3551,13 +4208,13 @@ var Product = require_product2();
|
|
|
3551
4208
|
var DiscoveredDevice = require_discoveredDevice2();
|
|
3552
4209
|
var Credential = require_credential2();
|
|
3553
4210
|
var ShortLink = require_shortLink2();
|
|
3554
|
-
var
|
|
3555
|
-
var
|
|
4211
|
+
var EnergyReportShard = require_energyReportShard2();
|
|
4212
|
+
var EnergyReport = require_energyReport2();
|
|
4213
|
+
var Property = require_property2();
|
|
4214
|
+
var Organization = require_organization2();
|
|
3556
4215
|
module.exports = {
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
Property: AdminProperty
|
|
3560
|
-
},
|
|
4216
|
+
Organization,
|
|
4217
|
+
Property,
|
|
3561
4218
|
Gateway,
|
|
3562
4219
|
Switch,
|
|
3563
4220
|
Alarm,
|
|
@@ -3572,13 +4229,16 @@ module.exports = {
|
|
|
3572
4229
|
Identification,
|
|
3573
4230
|
Product,
|
|
3574
4231
|
User,
|
|
4232
|
+
SystemUser,
|
|
3575
4233
|
Room,
|
|
3576
|
-
Application,
|
|
3577
4234
|
Space,
|
|
4235
|
+
SpaceType,
|
|
3578
4236
|
Ticket,
|
|
3579
4237
|
Scene,
|
|
3580
4238
|
DiscoveredDevice,
|
|
3581
4239
|
Reservation,
|
|
3582
4240
|
Credential,
|
|
3583
|
-
ShortLink
|
|
4241
|
+
ShortLink,
|
|
4242
|
+
EnergyReportShard,
|
|
4243
|
+
EnergyReport
|
|
3584
4244
|
};
|