@kohost/api-client 1.0.0-beta.5 → 3.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Client.js +666 -383
- package/dist/cjs/Commands.js +100 -25
- package/dist/cjs/Errors.js +24 -22
- package/dist/cjs/Events.js +26 -14
- package/dist/cjs/Models.js +68 -40
- package/dist/cjs/defs.js +4 -1
- package/dist/cjs/utils.js +8 -4
- package/dist/esm/Client.js +954 -587
- package/dist/esm/Client.js.map +3 -3
- package/dist/esm/Commands.js +100 -25
- 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 +26 -14
- package/dist/esm/Events.js.map +2 -2
- package/dist/esm/Models.js +742 -110
- package/dist/esm/Models.js.map +2 -2
- package/dist/esm/defs.js +292 -205
- package/dist/esm/defs.js.map +2 -2
- package/dist/esm/index.js +10 -10
- package/dist/esm/utils.js +390 -51
- package/dist/esm/utils.js.map +2 -2
- package/dist/useCases/AddDefaultScenesToRooms.js +2 -2
- package/dist/useCases/AddScenesToRoom.js +2 -2
- package/dist/useCases/AdminCreateAdminUser.js +32 -0
- package/dist/useCases/AdminCreateCustomer.js +32 -0
- package/dist/useCases/AdminCreateProperty.js +2 -2
- package/dist/useCases/AdminDescribeCustomer.js +32 -0
- package/dist/useCases/AdminDescribeProperty.js +2 -2
- package/dist/useCases/AdminListAdminUsers.js +32 -0
- package/dist/useCases/AdminListCustomers.js +2 -2
- package/dist/useCases/AdminListProperties.js +2 -2
- package/dist/useCases/{LoginGateway.js → AdminLoginUser.js} +3 -3
- package/dist/useCases/AdminRefreshToken.js +32 -0
- package/dist/useCases/AdminRequestLoginLink.js +32 -0
- package/dist/useCases/AdminUpdateCustomer.js +32 -0
- package/dist/useCases/AdminUpdateProperty.js +2 -2
- 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/CreateIntegration.js +2 -2
- package/dist/useCases/CreateIntegrationDeviceMapEntry.js +2 -2
- package/dist/useCases/CreateLock.js +2 -2
- package/dist/useCases/CreateReservation.js +2 -2
- package/dist/useCases/CreateRoom.js +2 -2
- package/dist/useCases/CreateRoomInSpace.js +2 -2
- package/dist/useCases/CreateSource.js +2 -2
- package/dist/useCases/CreateSpace.js +2 -2
- 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/DeleteIntegration.js +2 -2
- package/dist/useCases/DeleteLock.js +2 -2
- package/dist/useCases/DeleteReservation.js +2 -2
- package/dist/useCases/DeleteRoom.js +2 -2
- package/dist/useCases/DeleteSource.js +2 -2
- package/dist/useCases/DeleteSpace.js +2 -2
- 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/DescribeIntegration.js +2 -2
- package/dist/useCases/DescribeLock.js +2 -2
- package/dist/useCases/DescribeMyProperty.js +2 -2
- 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/DescribeSource.js +2 -2
- package/dist/useCases/DescribeSpace.js +2 -2
- 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/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/ListIntegrations.js +2 -2
- package/dist/useCases/ListLocks.js +2 -2
- package/dist/useCases/ListMyReservations.js +2 -2
- package/dist/useCases/ListMySpaces.js +2 -2
- package/dist/useCases/ListReservations.js +2 -2
- package/dist/useCases/ListRooms.js +2 -2
- package/dist/useCases/ListRoomsInSpace.js +2 -2
- package/dist/useCases/ListSources.js +2 -2
- package/dist/useCases/ListSpaces.js +2 -2
- package/dist/useCases/ListSwitches.js +2 -2
- 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/MatchUserIdentification.js +2 -2
- package/dist/useCases/OCRDocument.js +2 -2
- package/dist/useCases/RefreshToken.js +2 -2
- package/dist/useCases/RequestLoginLink.js +2 -2
- 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/SetLock.js +2 -2
- package/dist/useCases/SetSource.js +2 -2
- 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/UpdateIntegration.js +2 -2
- package/dist/useCases/UpdateLock.js +2 -2
- package/dist/useCases/UpdateMessageReadStatus.js +2 -2
- package/dist/useCases/UpdateReservation.js +2 -2
- package/dist/useCases/UpdateRoom.js +2 -2
- package/dist/useCases/UpdateSelf.js +2 -2
- package/dist/useCases/UpdateSource.js +2 -2
- package/dist/useCases/UpdateSpace.js +2 -2
- 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 +2 -1
package/dist/cjs/Events.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
|
};
|
|
@@ -14,26 +16,20 @@ var require_Event = __commonJS({
|
|
|
14
16
|
throw new Error("Event data is required");
|
|
15
17
|
if (typeof data !== "object")
|
|
16
18
|
throw new Error("Event data must be an object");
|
|
17
|
-
if (!data.name)
|
|
18
|
-
this.data.name = this.name;
|
|
19
|
-
if (!data.type)
|
|
20
|
-
this.data.type = this.type;
|
|
21
19
|
for (const key in data) {
|
|
22
20
|
this.data[key] = data[key];
|
|
23
21
|
}
|
|
24
|
-
if (data.eventData) {
|
|
25
|
-
for (const key in data.eventData) {
|
|
26
|
-
this.data[key] = data.eventData[key];
|
|
27
|
-
}
|
|
28
|
-
delete this.data.eventData;
|
|
29
|
-
}
|
|
30
22
|
if (context) {
|
|
31
23
|
for (const key in context) {
|
|
32
24
|
this.context[key] = context[key];
|
|
33
25
|
}
|
|
34
26
|
}
|
|
35
|
-
if (!this.data.timestamp)
|
|
36
|
-
this.data.timestamp = new Date();
|
|
27
|
+
if (this.data.eventData && !this.data.eventData.timestamp)
|
|
28
|
+
this.data.eventData.timestamp = /* @__PURE__ */ new Date();
|
|
29
|
+
if (this.data.eventData && !this.data.eventData.name)
|
|
30
|
+
this.data.eventData.name = this.name;
|
|
31
|
+
if (this.data.eventData && !this.data.eventData.type)
|
|
32
|
+
this.data.eventData.type = this.type;
|
|
37
33
|
}
|
|
38
34
|
get name() {
|
|
39
35
|
throw new Error("Event name is required");
|
|
@@ -51,6 +47,7 @@ var require_Event = __commonJS({
|
|
|
51
47
|
return { data: { ...this.data } };
|
|
52
48
|
}
|
|
53
49
|
};
|
|
50
|
+
__name(Event, "Event");
|
|
54
51
|
module2.exports = Event;
|
|
55
52
|
}
|
|
56
53
|
});
|
|
@@ -70,6 +67,7 @@ var require_SystemThermostatUpdatedEvent = __commonJS({
|
|
|
70
67
|
return `thermostat.${this.data.id}.updated`;
|
|
71
68
|
}
|
|
72
69
|
};
|
|
70
|
+
__name(SystemThermostatUpdatedEvent2, "SystemThermostatUpdatedEvent");
|
|
73
71
|
module2.exports = SystemThermostatUpdatedEvent2;
|
|
74
72
|
}
|
|
75
73
|
});
|
|
@@ -89,6 +87,7 @@ var require_SystemDimmerUpdatedEvent = __commonJS({
|
|
|
89
87
|
return `dimmer.${this.data.id}.updated`;
|
|
90
88
|
}
|
|
91
89
|
};
|
|
90
|
+
__name(SystemDimmerUpdatedEvent2, "SystemDimmerUpdatedEvent");
|
|
92
91
|
module2.exports = SystemDimmerUpdatedEvent2;
|
|
93
92
|
}
|
|
94
93
|
});
|
|
@@ -108,6 +107,7 @@ var require_SystemSwitchUpdatedEvent = __commonJS({
|
|
|
108
107
|
return `switch.${this.data.id}.updated`;
|
|
109
108
|
}
|
|
110
109
|
};
|
|
110
|
+
__name(SystemSwitchUpdatedEvent2, "SystemSwitchUpdatedEvent");
|
|
111
111
|
module2.exports = SystemSwitchUpdatedEvent2;
|
|
112
112
|
}
|
|
113
113
|
});
|
|
@@ -127,6 +127,7 @@ var require_SystemLockUpdatedEvent = __commonJS({
|
|
|
127
127
|
return `lock.${this.data.id}.updated`;
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
+
__name(SystemLockUpdatedEvent2, "SystemLockUpdatedEvent");
|
|
130
131
|
module2.exports = SystemLockUpdatedEvent2;
|
|
131
132
|
}
|
|
132
133
|
});
|
|
@@ -146,6 +147,7 @@ var require_SystemCameraUpdatedEvent = __commonJS({
|
|
|
146
147
|
return `camera.${this.data.id}.updated`;
|
|
147
148
|
}
|
|
148
149
|
};
|
|
150
|
+
__name(SystemCameraUpdatedEvent2, "SystemCameraUpdatedEvent");
|
|
149
151
|
module2.exports = SystemCameraUpdatedEvent2;
|
|
150
152
|
}
|
|
151
153
|
});
|
|
@@ -165,6 +167,7 @@ var require_SystemSceneControllerUpdatedEvent = __commonJS({
|
|
|
165
167
|
return `sceneController.${this.data.id}.updated`;
|
|
166
168
|
}
|
|
167
169
|
};
|
|
170
|
+
__name(SystemSceneControllerUpdatedEvent2, "SystemSceneControllerUpdatedEvent");
|
|
168
171
|
module2.exports = SystemSceneControllerUpdatedEvent2;
|
|
169
172
|
}
|
|
170
173
|
});
|
|
@@ -184,6 +187,7 @@ var require_SystemWindowCoveringUpdatedEvent = __commonJS({
|
|
|
184
187
|
return `windowCovering.${this.data.id}.updated`;
|
|
185
188
|
}
|
|
186
189
|
};
|
|
190
|
+
__name(SystemWindowCoveringUpdatedEvent2, "SystemWindowCoveringUpdatedEvent");
|
|
187
191
|
module2.exports = SystemWindowCoveringUpdatedEvent2;
|
|
188
192
|
}
|
|
189
193
|
});
|
|
@@ -203,6 +207,7 @@ var require_SystemSourceUpdatedEvent = __commonJS({
|
|
|
203
207
|
return `source.${this.data.id}.updated`;
|
|
204
208
|
}
|
|
205
209
|
};
|
|
210
|
+
__name(SystemSourceUpdatedEvent2, "SystemSourceUpdatedEvent");
|
|
206
211
|
module2.exports = SystemSourceUpdatedEvent2;
|
|
207
212
|
}
|
|
208
213
|
});
|
|
@@ -222,6 +227,7 @@ var require_SystemCourtesyUpdatedEvent = __commonJS({
|
|
|
222
227
|
return `courtesy.${this.data.id}.updated`;
|
|
223
228
|
}
|
|
224
229
|
};
|
|
230
|
+
__name(SystemCourtesyUpdatedEvent2, "SystemCourtesyUpdatedEvent");
|
|
225
231
|
module2.exports = SystemCourtesyUpdatedEvent2;
|
|
226
232
|
}
|
|
227
233
|
});
|
|
@@ -231,8 +237,8 @@ var require_SystemUserUpdatedEvent = __commonJS({
|
|
|
231
237
|
"src/Events/SystemUserUpdatedEvent.js"(exports2, module2) {
|
|
232
238
|
var Event = require_Event();
|
|
233
239
|
var SystemUserUpdatedEvent2 = class extends Event {
|
|
234
|
-
constructor(
|
|
235
|
-
super(
|
|
240
|
+
constructor(user) {
|
|
241
|
+
super(user);
|
|
236
242
|
}
|
|
237
243
|
get name() {
|
|
238
244
|
return "SystemUserUpdated";
|
|
@@ -241,6 +247,7 @@ var require_SystemUserUpdatedEvent = __commonJS({
|
|
|
241
247
|
return `user.${this.data.id}.updated`;
|
|
242
248
|
}
|
|
243
249
|
};
|
|
250
|
+
__name(SystemUserUpdatedEvent2, "SystemUserUpdatedEvent");
|
|
244
251
|
module2.exports = SystemUserUpdatedEvent2;
|
|
245
252
|
}
|
|
246
253
|
});
|
|
@@ -260,6 +267,7 @@ var require_SystemSpaceUpdatedEvent = __commonJS({
|
|
|
260
267
|
return `space.${this.data.id}.updated`;
|
|
261
268
|
}
|
|
262
269
|
};
|
|
270
|
+
__name(SystemSpaceUpdatedEvent2, "SystemSpaceUpdatedEvent");
|
|
263
271
|
module2.exports = SystemSpaceUpdatedEvent2;
|
|
264
272
|
}
|
|
265
273
|
});
|
|
@@ -279,6 +287,7 @@ var require_SystemReservationUpdatedEvent = __commonJS({
|
|
|
279
287
|
return `reservation.${this.data.id}.updated`;
|
|
280
288
|
}
|
|
281
289
|
};
|
|
290
|
+
__name(SystemReservationUpdatedEvent2, "SystemReservationUpdatedEvent");
|
|
282
291
|
module2.exports = SystemReservationUpdatedEvent2;
|
|
283
292
|
}
|
|
284
293
|
});
|
|
@@ -298,6 +307,7 @@ var require_SMSSentEvent = __commonJS({
|
|
|
298
307
|
return "comm.sms.sent";
|
|
299
308
|
}
|
|
300
309
|
};
|
|
310
|
+
__name(SMSSentEvent2, "SMSSentEvent");
|
|
301
311
|
module2.exports = SMSSentEvent2;
|
|
302
312
|
}
|
|
303
313
|
});
|
|
@@ -317,6 +327,7 @@ var require_EmailSentEvent = __commonJS({
|
|
|
317
327
|
return "comm.email.sent";
|
|
318
328
|
}
|
|
319
329
|
};
|
|
330
|
+
__name(EmailSentEvent2, "EmailSentEvent");
|
|
320
331
|
module2.exports = EmailSentEvent2;
|
|
321
332
|
}
|
|
322
333
|
});
|
|
@@ -336,6 +347,7 @@ var require_ShortLinkCreatedEvent = __commonJS({
|
|
|
336
347
|
return `shortlink.${this.data.id}.created`;
|
|
337
348
|
}
|
|
338
349
|
};
|
|
350
|
+
__name(ShortLinkCreatedEvent2, "ShortLinkCreatedEvent");
|
|
339
351
|
module2.exports = ShortLinkCreatedEvent2;
|
|
340
352
|
}
|
|
341
353
|
});
|
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
|
};
|
|
@@ -184,12 +186,12 @@ var require_schema = __commonJS({
|
|
|
184
186
|
ajv.addSchema(commonDefs);
|
|
185
187
|
ajv.addSchema(deviceDefs);
|
|
186
188
|
module2.exports = {
|
|
187
|
-
add: function add(schema) {
|
|
189
|
+
add: /* @__PURE__ */ __name(function add(schema) {
|
|
188
190
|
ajv.addSchema(schema);
|
|
189
|
-
},
|
|
190
|
-
compile: function compile(schema) {
|
|
191
|
+
}, "add"),
|
|
192
|
+
compile: /* @__PURE__ */ __name(function compile(schema) {
|
|
191
193
|
return ajv.compile(schema);
|
|
192
|
-
}
|
|
194
|
+
}, "compile")
|
|
193
195
|
};
|
|
194
196
|
}
|
|
195
197
|
});
|
|
@@ -236,14 +238,14 @@ var require_switch = __commonJS({
|
|
|
236
238
|
// src/Errors/AppError.js
|
|
237
239
|
var require_AppError = __commonJS({
|
|
238
240
|
"src/Errors/AppError.js"(exports2, module2) {
|
|
239
|
-
module2.exports = class AppError extends Error {
|
|
241
|
+
module2.exports = /* @__PURE__ */ __name(class AppError extends Error {
|
|
240
242
|
constructor(message = "Internal Server Error", options) {
|
|
241
243
|
super(message, options);
|
|
242
244
|
this.type = this.constructor.name;
|
|
243
245
|
this.statusCode = 500;
|
|
244
246
|
Object.setPrototypeOf(this, AppError.prototype);
|
|
245
247
|
}
|
|
246
|
-
};
|
|
248
|
+
}, "AppError");
|
|
247
249
|
}
|
|
248
250
|
});
|
|
249
251
|
|
|
@@ -251,13 +253,13 @@ var require_AppError = __commonJS({
|
|
|
251
253
|
var require_AuthenticationError = __commonJS({
|
|
252
254
|
"src/Errors/AuthenticationError.js"(exports2, module2) {
|
|
253
255
|
var AppError = require_AppError();
|
|
254
|
-
module2.exports = class AuthenticationError extends AppError {
|
|
256
|
+
module2.exports = /* @__PURE__ */ __name(class AuthenticationError extends AppError {
|
|
255
257
|
constructor(message = "Authentication Error", options = {}) {
|
|
256
258
|
super(message, options);
|
|
257
259
|
this.statusCode = 401;
|
|
258
260
|
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
259
261
|
}
|
|
260
|
-
};
|
|
262
|
+
}, "AuthenticationError");
|
|
261
263
|
}
|
|
262
264
|
});
|
|
263
265
|
|
|
@@ -265,13 +267,13 @@ var require_AuthenticationError = __commonJS({
|
|
|
265
267
|
var require_AuthorizationError = __commonJS({
|
|
266
268
|
"src/Errors/AuthorizationError.js"(exports2, module2) {
|
|
267
269
|
var AppError = require_AppError();
|
|
268
|
-
module2.exports = class AuthorizationError extends AppError {
|
|
270
|
+
module2.exports = /* @__PURE__ */ __name(class AuthorizationError extends AppError {
|
|
269
271
|
constructor(message = "Authorization Error", options = {}) {
|
|
270
272
|
super(message, options);
|
|
271
273
|
this.statusCode = 403;
|
|
272
274
|
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
273
275
|
}
|
|
274
|
-
};
|
|
276
|
+
}, "AuthorizationError");
|
|
275
277
|
}
|
|
276
278
|
});
|
|
277
279
|
|
|
@@ -279,13 +281,13 @@ var require_AuthorizationError = __commonJS({
|
|
|
279
281
|
var require_DeviceCommError = __commonJS({
|
|
280
282
|
"src/Errors/DeviceCommError.js"(exports2, module2) {
|
|
281
283
|
var AppError = require_AppError();
|
|
282
|
-
module2.exports = class DeviceCommError extends AppError {
|
|
284
|
+
module2.exports = /* @__PURE__ */ __name(class DeviceCommError extends AppError {
|
|
283
285
|
constructor(message = "Device Communication Error", options = {}) {
|
|
284
286
|
super(message, options);
|
|
285
287
|
this.statusCode = 503;
|
|
286
288
|
Object.setPrototypeOf(this, DeviceCommError.prototype);
|
|
287
289
|
}
|
|
288
|
-
};
|
|
290
|
+
}, "DeviceCommError");
|
|
289
291
|
}
|
|
290
292
|
});
|
|
291
293
|
|
|
@@ -293,13 +295,13 @@ var require_DeviceCommError = __commonJS({
|
|
|
293
295
|
var require_LoginError = __commonJS({
|
|
294
296
|
"src/Errors/LoginError.js"(exports2, module2) {
|
|
295
297
|
var AppError = require_AppError();
|
|
296
|
-
module2.exports = class LoginError extends AppError {
|
|
298
|
+
module2.exports = /* @__PURE__ */ __name(class LoginError extends AppError {
|
|
297
299
|
constructor(message = "Invalid Login information provided", options = {}) {
|
|
298
300
|
super(message, options);
|
|
299
301
|
this.statusCode = 401;
|
|
300
302
|
Object.setPrototypeOf(this, LoginError.prototype);
|
|
301
303
|
}
|
|
302
|
-
};
|
|
304
|
+
}, "LoginError");
|
|
303
305
|
}
|
|
304
306
|
});
|
|
305
307
|
|
|
@@ -307,13 +309,13 @@ var require_LoginError = __commonJS({
|
|
|
307
309
|
var require_NotFoundError = __commonJS({
|
|
308
310
|
"src/Errors/NotFoundError.js"(exports2, module2) {
|
|
309
311
|
var AppError = require_AppError();
|
|
310
|
-
module2.exports = class NotFoundError extends AppError {
|
|
312
|
+
module2.exports = /* @__PURE__ */ __name(class NotFoundError extends AppError {
|
|
311
313
|
constructor(message = "Resource Not Found", options = {}) {
|
|
312
314
|
super(message, options);
|
|
313
315
|
this.statusCode = 404;
|
|
314
316
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
315
317
|
}
|
|
316
|
-
};
|
|
318
|
+
}, "NotFoundError");
|
|
317
319
|
}
|
|
318
320
|
});
|
|
319
321
|
|
|
@@ -321,13 +323,13 @@ var require_NotFoundError = __commonJS({
|
|
|
321
323
|
var require_RequestError = __commonJS({
|
|
322
324
|
"src/Errors/RequestError.js"(exports2, module2) {
|
|
323
325
|
var AppError = require_AppError();
|
|
324
|
-
module2.exports = class RequestError extends AppError {
|
|
326
|
+
module2.exports = /* @__PURE__ */ __name(class RequestError extends AppError {
|
|
325
327
|
constructor(message = "Bad Request", options = {}) {
|
|
326
328
|
super(message, options);
|
|
327
329
|
this.statusCode = 400;
|
|
328
330
|
Object.setPrototypeOf(this, RequestError.prototype);
|
|
329
331
|
}
|
|
330
|
-
};
|
|
332
|
+
}, "RequestError");
|
|
331
333
|
}
|
|
332
334
|
});
|
|
333
335
|
|
|
@@ -335,13 +337,13 @@ var require_RequestError = __commonJS({
|
|
|
335
337
|
var require_SystemCommError = __commonJS({
|
|
336
338
|
"src/Errors/SystemCommError.js"(exports2, module2) {
|
|
337
339
|
var AppError = require_AppError();
|
|
338
|
-
module2.exports = class SystemCommError extends AppError {
|
|
340
|
+
module2.exports = /* @__PURE__ */ __name(class SystemCommError extends AppError {
|
|
339
341
|
constructor(message = "System Communication Error", options = {}) {
|
|
340
342
|
super(message, options);
|
|
341
343
|
this.statusCode = 503;
|
|
342
344
|
Object.setPrototypeOf(this, SystemCommError.prototype);
|
|
343
345
|
}
|
|
344
|
-
};
|
|
346
|
+
}, "SystemCommError");
|
|
345
347
|
}
|
|
346
348
|
});
|
|
347
349
|
|
|
@@ -349,13 +351,13 @@ var require_SystemCommError = __commonJS({
|
|
|
349
351
|
var require_TokenExpiredError = __commonJS({
|
|
350
352
|
"src/Errors/TokenExpiredError.js"(exports2, module2) {
|
|
351
353
|
var AppError = require_AppError();
|
|
352
|
-
module2.exports = class TokenExpiredError extends AppError {
|
|
354
|
+
module2.exports = /* @__PURE__ */ __name(class TokenExpiredError extends AppError {
|
|
353
355
|
constructor(message = "Token Expired", options = {}) {
|
|
354
356
|
super(message, options);
|
|
355
357
|
this.statusCode = 401;
|
|
356
358
|
Object.setPrototypeOf(this, TokenExpiredError.prototype);
|
|
357
359
|
}
|
|
358
|
-
};
|
|
360
|
+
}, "TokenExpiredError");
|
|
359
361
|
}
|
|
360
362
|
});
|
|
361
363
|
|
|
@@ -363,13 +365,13 @@ var require_TokenExpiredError = __commonJS({
|
|
|
363
365
|
var require_UnprocessableRequestError = __commonJS({
|
|
364
366
|
"src/Errors/UnprocessableRequestError.js"(exports2, module2) {
|
|
365
367
|
var AppError = require_AppError();
|
|
366
|
-
module2.exports = class UnprocessableRequestError extends AppError {
|
|
368
|
+
module2.exports = /* @__PURE__ */ __name(class UnprocessableRequestError extends AppError {
|
|
367
369
|
constructor(message = "Unprocessable Request Error", options = {}) {
|
|
368
370
|
super(message, options);
|
|
369
371
|
this.statusCode = 422;
|
|
370
372
|
Object.setPrototypeOf(this, UnprocessableRequestError.prototype);
|
|
371
373
|
}
|
|
372
|
-
};
|
|
374
|
+
}, "UnprocessableRequestError");
|
|
373
375
|
}
|
|
374
376
|
});
|
|
375
377
|
|
|
@@ -377,13 +379,13 @@ var require_UnprocessableRequestError = __commonJS({
|
|
|
377
379
|
var require_ValidationError = __commonJS({
|
|
378
380
|
"src/Errors/ValidationError.js"(exports2, module2) {
|
|
379
381
|
var AppError = require_AppError();
|
|
380
|
-
module2.exports = class ValidationError extends AppError {
|
|
382
|
+
module2.exports = /* @__PURE__ */ __name(class ValidationError extends AppError {
|
|
381
383
|
constructor(message = "Validation Error", options = {}) {
|
|
382
384
|
super(message, options);
|
|
383
385
|
this.statusCode = 400;
|
|
384
386
|
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
385
387
|
}
|
|
386
|
-
};
|
|
388
|
+
}, "ValidationError");
|
|
387
389
|
}
|
|
388
390
|
});
|
|
389
391
|
|
|
@@ -447,7 +449,7 @@ var require_kohost = __commonJS({
|
|
|
447
449
|
});
|
|
448
450
|
}
|
|
449
451
|
_setTimestamps(isNew) {
|
|
450
|
-
const now = new Date();
|
|
452
|
+
const now = /* @__PURE__ */ new Date();
|
|
451
453
|
if (isNew && this.schemaProperties.includes("createdAt") && !this.createdAt) {
|
|
452
454
|
this.createdAt = now;
|
|
453
455
|
}
|
|
@@ -488,6 +490,7 @@ var require_kohost = __commonJS({
|
|
|
488
490
|
return obj;
|
|
489
491
|
}
|
|
490
492
|
};
|
|
493
|
+
__name(Kohost, "Kohost");
|
|
491
494
|
module2.exports = Kohost;
|
|
492
495
|
}
|
|
493
496
|
});
|
|
@@ -505,6 +508,7 @@ var require_switch2 = __commonJS({
|
|
|
505
508
|
super(data);
|
|
506
509
|
}
|
|
507
510
|
};
|
|
511
|
+
__name(Switch2, "Switch");
|
|
508
512
|
Object.defineProperty(Switch2.prototype, "schema", {
|
|
509
513
|
value: schema
|
|
510
514
|
});
|
|
@@ -635,6 +639,7 @@ var require_alarm2 = __commonJS({
|
|
|
635
639
|
super(data);
|
|
636
640
|
}
|
|
637
641
|
};
|
|
642
|
+
__name(Alarm2, "Alarm");
|
|
638
643
|
Object.defineProperty(Alarm2.prototype, "schema", {
|
|
639
644
|
value: schema
|
|
640
645
|
});
|
|
@@ -719,6 +724,7 @@ var require_dimmer2 = __commonJS({
|
|
|
719
724
|
return delta;
|
|
720
725
|
}
|
|
721
726
|
};
|
|
727
|
+
__name(Dimmer2, "Dimmer");
|
|
722
728
|
Object.defineProperty(Dimmer2.prototype, "schema", {
|
|
723
729
|
value: schema
|
|
724
730
|
});
|
|
@@ -756,9 +762,6 @@ var require_lock = __commonJS({
|
|
|
756
762
|
type: {
|
|
757
763
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
758
764
|
},
|
|
759
|
-
subType: {
|
|
760
|
-
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
|
|
761
|
-
},
|
|
762
765
|
supportedNotifications: {
|
|
763
766
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
764
767
|
},
|
|
@@ -766,8 +769,11 @@ var require_lock = __commonJS({
|
|
|
766
769
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
767
770
|
},
|
|
768
771
|
state: {
|
|
769
|
-
type: "string",
|
|
770
|
-
enum: ["locked", "unlocked"]
|
|
772
|
+
type: ["string", "null"],
|
|
773
|
+
enum: ["locked", "unlocked", null]
|
|
774
|
+
},
|
|
775
|
+
batteryLevel: {
|
|
776
|
+
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/batteryLevel"
|
|
771
777
|
},
|
|
772
778
|
systemData: {
|
|
773
779
|
$ref: "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
@@ -792,6 +798,7 @@ var require_lock2 = __commonJS({
|
|
|
792
798
|
super(data);
|
|
793
799
|
}
|
|
794
800
|
};
|
|
801
|
+
__name(Lock2, "Lock");
|
|
795
802
|
Object.defineProperty(Lock2.prototype, "schema", {
|
|
796
803
|
value: schema
|
|
797
804
|
});
|
|
@@ -1009,6 +1016,7 @@ var require_thermostat2 = __commonJS({
|
|
|
1009
1016
|
return delta;
|
|
1010
1017
|
}
|
|
1011
1018
|
};
|
|
1019
|
+
__name(Thermostat2, "Thermostat");
|
|
1012
1020
|
Object.defineProperty(Thermostat2.prototype, "schema", {
|
|
1013
1021
|
value: schema
|
|
1014
1022
|
});
|
|
@@ -1096,6 +1104,7 @@ var require_windowCovering2 = __commonJS({
|
|
|
1096
1104
|
return delta;
|
|
1097
1105
|
}
|
|
1098
1106
|
};
|
|
1107
|
+
__name(WindowCovering2, "WindowCovering");
|
|
1099
1108
|
Object.defineProperty(WindowCovering2.prototype, "schema", {
|
|
1100
1109
|
value: schema
|
|
1101
1110
|
});
|
|
@@ -1122,7 +1131,7 @@ var require_identification = __commonJS({
|
|
|
1122
1131
|
$id: "https://api.kohost.app/schemas/v3/identification.json",
|
|
1123
1132
|
title: "Identification",
|
|
1124
1133
|
type: "object",
|
|
1125
|
-
required: ["type", "number"
|
|
1134
|
+
required: ["type", "number"],
|
|
1126
1135
|
properties: {
|
|
1127
1136
|
id: {
|
|
1128
1137
|
$ref: "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
@@ -1139,16 +1148,14 @@ var require_identification = __commonJS({
|
|
|
1139
1148
|
format: "date-time"
|
|
1140
1149
|
},
|
|
1141
1150
|
expires: {
|
|
1142
|
-
type: ["string", "object"],
|
|
1151
|
+
type: ["string", "object", "null"],
|
|
1143
1152
|
format: "date-time"
|
|
1144
1153
|
},
|
|
1145
1154
|
verified: {
|
|
1146
|
-
type: "boolean"
|
|
1147
|
-
default: false
|
|
1155
|
+
type: "boolean"
|
|
1148
1156
|
},
|
|
1149
1157
|
matched: {
|
|
1150
|
-
type: "boolean"
|
|
1151
|
-
default: false
|
|
1158
|
+
type: "boolean"
|
|
1152
1159
|
},
|
|
1153
1160
|
firstName: {
|
|
1154
1161
|
type: "string"
|
|
@@ -1182,9 +1189,10 @@ var require_identification2 = __commonJS({
|
|
|
1182
1189
|
super(data);
|
|
1183
1190
|
}
|
|
1184
1191
|
get isExpired() {
|
|
1185
|
-
return new Date(this.expirationDate) < new Date();
|
|
1192
|
+
return new Date(this.expirationDate) < /* @__PURE__ */ new Date();
|
|
1186
1193
|
}
|
|
1187
1194
|
};
|
|
1195
|
+
__name(Identification2, "Identification");
|
|
1188
1196
|
Object.defineProperty(Identification2.prototype, "schema", {
|
|
1189
1197
|
value: schema
|
|
1190
1198
|
});
|
|
@@ -1455,6 +1463,7 @@ var require_user2 = __commonJS({
|
|
|
1455
1463
|
return await nanoid(len);
|
|
1456
1464
|
}
|
|
1457
1465
|
};
|
|
1466
|
+
__name(User2, "User");
|
|
1458
1467
|
Object.defineProperty(User2.prototype, "schema", {
|
|
1459
1468
|
value: schema
|
|
1460
1469
|
});
|
|
@@ -1531,6 +1540,7 @@ var require_courtesy2 = __commonJS({
|
|
|
1531
1540
|
super(data);
|
|
1532
1541
|
}
|
|
1533
1542
|
};
|
|
1543
|
+
__name(Courtesy2, "Courtesy");
|
|
1534
1544
|
Object.defineProperty(Courtesy2.prototype, "schema", {
|
|
1535
1545
|
value: schema
|
|
1536
1546
|
});
|
|
@@ -1609,6 +1619,7 @@ var require_camera2 = __commonJS({
|
|
|
1609
1619
|
super(data);
|
|
1610
1620
|
}
|
|
1611
1621
|
};
|
|
1622
|
+
__name(Camera2, "Camera");
|
|
1612
1623
|
Object.defineProperty(Camera2.prototype, "schema", {
|
|
1613
1624
|
value: schema
|
|
1614
1625
|
});
|
|
@@ -1669,6 +1680,7 @@ var require_motionSensor2 = __commonJS({
|
|
|
1669
1680
|
super(data);
|
|
1670
1681
|
}
|
|
1671
1682
|
};
|
|
1683
|
+
__name(MotionSensor2, "MotionSensor");
|
|
1672
1684
|
Object.defineProperty(MotionSensor2.prototype, "schema", {
|
|
1673
1685
|
value: schema
|
|
1674
1686
|
});
|
|
@@ -1854,6 +1866,7 @@ var require_mediaSource2 = __commonJS({
|
|
|
1854
1866
|
super(data);
|
|
1855
1867
|
}
|
|
1856
1868
|
};
|
|
1869
|
+
__name(MediaSource2, "MediaSource");
|
|
1857
1870
|
Object.defineProperty(MediaSource2.prototype, "schema", {
|
|
1858
1871
|
value: schema
|
|
1859
1872
|
});
|
|
@@ -2143,6 +2156,7 @@ var require_scene2 = __commonJS({
|
|
|
2143
2156
|
super(data);
|
|
2144
2157
|
}
|
|
2145
2158
|
};
|
|
2159
|
+
__name(Scene2, "Scene");
|
|
2146
2160
|
Object.defineProperty(Scene2.prototype, "schema", {
|
|
2147
2161
|
value: schema
|
|
2148
2162
|
});
|
|
@@ -2244,12 +2258,13 @@ var require_room2 = __commonJS({
|
|
|
2244
2258
|
return ((_a = this.sources) == null ? void 0 : _a.length) > 0;
|
|
2245
2259
|
}
|
|
2246
2260
|
get occupied() {
|
|
2247
|
-
const now = new Date();
|
|
2261
|
+
const now = /* @__PURE__ */ new Date();
|
|
2248
2262
|
const lastOccupied = new Date(this.occupiedAt);
|
|
2249
2263
|
const diff = now - lastOccupied;
|
|
2250
2264
|
return diff < 60 * 60 * 1e3;
|
|
2251
2265
|
}
|
|
2252
2266
|
};
|
|
2267
|
+
__name(Room2, "Room");
|
|
2253
2268
|
Object.defineProperty(Room2.prototype, "schema", {
|
|
2254
2269
|
value: schema
|
|
2255
2270
|
});
|
|
@@ -2332,6 +2347,7 @@ var require_room2 = __commonJS({
|
|
|
2332
2347
|
});
|
|
2333
2348
|
return roomData;
|
|
2334
2349
|
}
|
|
2350
|
+
__name(mapRoomData, "mapRoomData");
|
|
2335
2351
|
module2.exports = Room2;
|
|
2336
2352
|
}
|
|
2337
2353
|
});
|
|
@@ -2469,6 +2485,7 @@ var require_reservation2 = __commonJS({
|
|
|
2469
2485
|
});
|
|
2470
2486
|
}
|
|
2471
2487
|
};
|
|
2488
|
+
__name(Reservation2, "Reservation");
|
|
2472
2489
|
Object.defineProperty(Reservation2.prototype, "schema", {
|
|
2473
2490
|
value: schema
|
|
2474
2491
|
});
|
|
@@ -2527,6 +2544,7 @@ var require_application2 = __commonJS({
|
|
|
2527
2544
|
super(data);
|
|
2528
2545
|
}
|
|
2529
2546
|
};
|
|
2547
|
+
__name(Application2, "Application");
|
|
2530
2548
|
Object.defineProperty(Application2.prototype, "schema", {
|
|
2531
2549
|
value: schema
|
|
2532
2550
|
});
|
|
@@ -2716,6 +2734,7 @@ var require_space2 = __commonJS({
|
|
|
2716
2734
|
return this.rooms.some((room) => room.occupied);
|
|
2717
2735
|
}
|
|
2718
2736
|
};
|
|
2737
|
+
__name(Space2, "Space");
|
|
2719
2738
|
Object.defineProperty(Space2.prototype, "schema", {
|
|
2720
2739
|
value: schema
|
|
2721
2740
|
});
|
|
@@ -2741,6 +2760,7 @@ var require_space2 = __commonJS({
|
|
|
2741
2760
|
}
|
|
2742
2761
|
return spaceData;
|
|
2743
2762
|
}
|
|
2763
|
+
__name(mapSpaceData, "mapSpaceData");
|
|
2744
2764
|
module2.exports = Space2;
|
|
2745
2765
|
}
|
|
2746
2766
|
});
|
|
@@ -2852,6 +2872,7 @@ var require_ticket2 = __commonJS({
|
|
|
2852
2872
|
return nanoid(len);
|
|
2853
2873
|
}
|
|
2854
2874
|
};
|
|
2875
|
+
__name(Ticket2, "Ticket");
|
|
2855
2876
|
Object.defineProperty(Ticket2.prototype, "schema", {
|
|
2856
2877
|
value: schema
|
|
2857
2878
|
});
|
|
@@ -2960,6 +2981,7 @@ var require_gateway2 = __commonJS({
|
|
|
2960
2981
|
super(data);
|
|
2961
2982
|
}
|
|
2962
2983
|
};
|
|
2984
|
+
__name(Gateway2, "Gateway");
|
|
2963
2985
|
Object.defineProperty(Gateway2.prototype, "schema", {
|
|
2964
2986
|
value: schema
|
|
2965
2987
|
});
|
|
@@ -3030,6 +3052,7 @@ var require_product2 = __commonJS({
|
|
|
3030
3052
|
super(data);
|
|
3031
3053
|
}
|
|
3032
3054
|
};
|
|
3055
|
+
__name(Product2, "Product");
|
|
3033
3056
|
Object.defineProperty(Product2.prototype, "schema", {
|
|
3034
3057
|
value: schema
|
|
3035
3058
|
});
|
|
@@ -3107,6 +3130,7 @@ var require_discoveredDevice2 = __commonJS({
|
|
|
3107
3130
|
super(data);
|
|
3108
3131
|
}
|
|
3109
3132
|
};
|
|
3133
|
+
__name(DiscoveredDevice2, "DiscoveredDevice");
|
|
3110
3134
|
Object.defineProperty(DiscoveredDevice2.prototype, "schema", {
|
|
3111
3135
|
value: schema
|
|
3112
3136
|
});
|
|
@@ -3169,6 +3193,7 @@ var require_credential2 = __commonJS({
|
|
|
3169
3193
|
super(data);
|
|
3170
3194
|
}
|
|
3171
3195
|
};
|
|
3196
|
+
__name(Credential2, "Credential");
|
|
3172
3197
|
Object.defineProperty(Credential2.prototype, "schema", {
|
|
3173
3198
|
value: schema
|
|
3174
3199
|
});
|
|
@@ -3233,6 +3258,7 @@ var require_shortLink2 = __commonJS({
|
|
|
3233
3258
|
super(data);
|
|
3234
3259
|
}
|
|
3235
3260
|
};
|
|
3261
|
+
__name(ShortLink2, "ShortLink");
|
|
3236
3262
|
Object.defineProperty(ShortLink2.prototype, "schema", {
|
|
3237
3263
|
value: schema
|
|
3238
3264
|
});
|
|
@@ -3299,6 +3325,7 @@ var require_customer2 = __commonJS({
|
|
|
3299
3325
|
super(data);
|
|
3300
3326
|
}
|
|
3301
3327
|
};
|
|
3328
|
+
__name(Customer, "Customer");
|
|
3302
3329
|
Object.defineProperty(Customer.prototype, "schema", {
|
|
3303
3330
|
value: schema
|
|
3304
3331
|
});
|
|
@@ -3512,6 +3539,7 @@ var require_property2 = __commonJS({
|
|
|
3512
3539
|
super(data);
|
|
3513
3540
|
}
|
|
3514
3541
|
};
|
|
3542
|
+
__name(Property, "Property");
|
|
3515
3543
|
Object.defineProperty(Property.prototype, "schema", {
|
|
3516
3544
|
value: schema
|
|
3517
3545
|
});
|
package/dist/cjs/defs.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
|
};
|
|
@@ -128,7 +130,7 @@ var require_Client = __commonJS({
|
|
|
128
130
|
}
|
|
129
131
|
if (expectedError && newTokensNeeded) {
|
|
130
132
|
return this.RefreshToken().then(() => {
|
|
131
|
-
return this.
|
|
133
|
+
return this._http(originalReq);
|
|
132
134
|
});
|
|
133
135
|
}
|
|
134
136
|
} catch (error2) {
|
|
@@ -159,6 +161,7 @@ var require_Client = __commonJS({
|
|
|
159
161
|
this.emit("LoginRequired");
|
|
160
162
|
}
|
|
161
163
|
};
|
|
164
|
+
__name(KohostApiClient, "KohostApiClient");
|
|
162
165
|
module2.exports = KohostApiClient;
|
|
163
166
|
}
|
|
164
167
|
});
|