@kohost/api-client 3.0.0-beta.5 → 3.0.0-beta.7
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 +570 -247
- package/dist/cjs/Commands.js +39 -22
- package/dist/cjs/Errors.js +24 -22
- package/dist/cjs/Events.js +26 -14
- package/dist/cjs/Models.js +57 -27
- package/dist/cjs/defs.js +4 -1
- package/dist/cjs/utils.js +8 -4
- package/dist/esm/Client.js +858 -451
- package/dist/esm/Client.js.map +3 -3
- package/dist/esm/Commands.js +39 -22
- package/dist/esm/Commands.js.map +1 -1
- 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 +720 -96
- 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/utils.js +379 -50
- package/dist/esm/utils.js.map +1 -1
- package/dist/useCases/AdminCreateAdminUser.js +32 -0
- package/dist/useCases/AdminCreateCustomer.js +32 -0
- package/dist/useCases/AdminDescribeCustomer.js +32 -0
- package/dist/useCases/AdminListAdminUsers.js +32 -0
- package/dist/useCases/{LoginGateway.js → AdminLoginUser.js} +2 -2
- package/dist/useCases/AdminRefreshToken.js +32 -0
- package/dist/useCases/AdminRequestLoginLink.js +32 -0
- package/dist/useCases/AdminUpdateCustomer.js +32 -0
- package/package.json +1 -1
package/dist/cjs/Commands.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
|
};
|
|
@@ -36,6 +38,7 @@ var require_Command = __commonJS({
|
|
|
36
38
|
return { data: { ...this.data } };
|
|
37
39
|
}
|
|
38
40
|
};
|
|
41
|
+
__name(Command, "Command");
|
|
39
42
|
module2.exports = Command;
|
|
40
43
|
}
|
|
41
44
|
});
|
|
@@ -58,6 +61,7 @@ var require_SetAlarmCommand = __commonJS({
|
|
|
58
61
|
return "system.response.devices";
|
|
59
62
|
}
|
|
60
63
|
};
|
|
64
|
+
__name(SetAlarmCommand2, "SetAlarmCommand");
|
|
61
65
|
module2.exports = SetAlarmCommand2;
|
|
62
66
|
}
|
|
63
67
|
});
|
|
@@ -80,6 +84,7 @@ var require_SetDimmerCommand = __commonJS({
|
|
|
80
84
|
return "system.response.devices";
|
|
81
85
|
}
|
|
82
86
|
};
|
|
87
|
+
__name(SetDimmerCommand2, "SetDimmerCommand");
|
|
83
88
|
module2.exports = SetDimmerCommand2;
|
|
84
89
|
}
|
|
85
90
|
});
|
|
@@ -102,6 +107,7 @@ var require_SetSwitchCommand = __commonJS({
|
|
|
102
107
|
return "system.response.devices";
|
|
103
108
|
}
|
|
104
109
|
};
|
|
110
|
+
__name(SetSwitchCommand2, "SetSwitchCommand");
|
|
105
111
|
module2.exports = SetSwitchCommand2;
|
|
106
112
|
}
|
|
107
113
|
});
|
|
@@ -124,6 +130,7 @@ var require_SetThermostatCommand = __commonJS({
|
|
|
124
130
|
return "system.response.devices";
|
|
125
131
|
}
|
|
126
132
|
};
|
|
133
|
+
__name(SetThermostatCommand2, "SetThermostatCommand");
|
|
127
134
|
module2.exports = SetThermostatCommand2;
|
|
128
135
|
}
|
|
129
136
|
});
|
|
@@ -146,6 +153,7 @@ var require_SetLockCommand = __commonJS({
|
|
|
146
153
|
return "system.response.devices";
|
|
147
154
|
}
|
|
148
155
|
};
|
|
156
|
+
__name(SetLockCommand2, "SetLockCommand");
|
|
149
157
|
module2.exports = SetLockCommand2;
|
|
150
158
|
}
|
|
151
159
|
});
|
|
@@ -168,6 +176,7 @@ var require_SetSceneControllerCommand = __commonJS({
|
|
|
168
176
|
return "system.response.devices";
|
|
169
177
|
}
|
|
170
178
|
};
|
|
179
|
+
__name(SetSceneControllerCommand2, "SetSceneControllerCommand");
|
|
171
180
|
module2.exports = SetSceneControllerCommand2;
|
|
172
181
|
}
|
|
173
182
|
});
|
|
@@ -190,6 +199,7 @@ var require_SetWindowCoveringCommand = __commonJS({
|
|
|
190
199
|
return "system.response.devices";
|
|
191
200
|
}
|
|
192
201
|
};
|
|
202
|
+
__name(SetWindowCoveringCommand2, "SetWindowCoveringCommand");
|
|
193
203
|
module2.exports = SetWindowCoveringCommand2;
|
|
194
204
|
}
|
|
195
205
|
});
|
|
@@ -212,6 +222,7 @@ var require_SetCourtesyCommand = __commonJS({
|
|
|
212
222
|
return "system.response.devices";
|
|
213
223
|
}
|
|
214
224
|
};
|
|
225
|
+
__name(SetCourtesyCommand2, "SetCourtesyCommand");
|
|
215
226
|
module2.exports = SetCourtesyCommand2;
|
|
216
227
|
}
|
|
217
228
|
});
|
|
@@ -234,6 +245,7 @@ var require_DiscoverUsersCommand = __commonJS({
|
|
|
234
245
|
return "system.response.users";
|
|
235
246
|
}
|
|
236
247
|
};
|
|
248
|
+
__name(DiscoverUsersCommand2, "DiscoverUsersCommand");
|
|
237
249
|
module2.exports = DiscoverUsersCommand2;
|
|
238
250
|
}
|
|
239
251
|
});
|
|
@@ -241,14 +253,14 @@ var require_DiscoverUsersCommand = __commonJS({
|
|
|
241
253
|
// src/Errors/AppError.js
|
|
242
254
|
var require_AppError = __commonJS({
|
|
243
255
|
"src/Errors/AppError.js"(exports2, module2) {
|
|
244
|
-
module2.exports = class AppError extends Error {
|
|
256
|
+
module2.exports = /* @__PURE__ */ __name(class AppError extends Error {
|
|
245
257
|
constructor(message = "Internal Server Error", options) {
|
|
246
258
|
super(message, options);
|
|
247
259
|
this.type = this.constructor.name;
|
|
248
260
|
this.statusCode = 500;
|
|
249
261
|
Object.setPrototypeOf(this, AppError.prototype);
|
|
250
262
|
}
|
|
251
|
-
};
|
|
263
|
+
}, "AppError");
|
|
252
264
|
}
|
|
253
265
|
});
|
|
254
266
|
|
|
@@ -256,13 +268,13 @@ var require_AppError = __commonJS({
|
|
|
256
268
|
var require_RequestError = __commonJS({
|
|
257
269
|
"src/Errors/RequestError.js"(exports2, module2) {
|
|
258
270
|
var AppError = require_AppError();
|
|
259
|
-
module2.exports = class RequestError extends AppError {
|
|
271
|
+
module2.exports = /* @__PURE__ */ __name(class RequestError extends AppError {
|
|
260
272
|
constructor(message = "Bad Request", options = {}) {
|
|
261
273
|
super(message, options);
|
|
262
274
|
this.statusCode = 400;
|
|
263
275
|
Object.setPrototypeOf(this, RequestError.prototype);
|
|
264
276
|
}
|
|
265
|
-
};
|
|
277
|
+
}, "RequestError");
|
|
266
278
|
}
|
|
267
279
|
});
|
|
268
280
|
|
|
@@ -286,6 +298,7 @@ var require_OCRDocumentCommand = __commonJS({
|
|
|
286
298
|
return `document.${this.data.type}.ocr`;
|
|
287
299
|
}
|
|
288
300
|
};
|
|
301
|
+
__name(OCRDocumentCommand2, "OCRDocumentCommand");
|
|
289
302
|
module2.exports = OCRDocumentCommand2;
|
|
290
303
|
}
|
|
291
304
|
});
|
|
@@ -311,6 +324,7 @@ var require_CheckInReservationCommand = __commonJS({
|
|
|
311
324
|
return "system.response.reservations";
|
|
312
325
|
}
|
|
313
326
|
};
|
|
327
|
+
__name(CheckInReservationCommand2, "CheckInReservationCommand");
|
|
314
328
|
module2.exports = CheckInReservationCommand2;
|
|
315
329
|
}
|
|
316
330
|
});
|
|
@@ -337,6 +351,7 @@ var require_SendSMSCommand = __commonJS({
|
|
|
337
351
|
return "comm.sms.send";
|
|
338
352
|
}
|
|
339
353
|
};
|
|
354
|
+
__name(SendSMSCommand2, "SendSMSCommand");
|
|
340
355
|
module2.exports = SendSMSCommand2;
|
|
341
356
|
}
|
|
342
357
|
});
|
|
@@ -345,13 +360,13 @@ var require_SendSMSCommand = __commonJS({
|
|
|
345
360
|
var require_AuthenticationError = __commonJS({
|
|
346
361
|
"src/Errors/AuthenticationError.js"(exports2, module2) {
|
|
347
362
|
var AppError = require_AppError();
|
|
348
|
-
module2.exports = class AuthenticationError extends AppError {
|
|
363
|
+
module2.exports = /* @__PURE__ */ __name(class AuthenticationError extends AppError {
|
|
349
364
|
constructor(message = "Authentication Error", options = {}) {
|
|
350
365
|
super(message, options);
|
|
351
366
|
this.statusCode = 401;
|
|
352
367
|
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
353
368
|
}
|
|
354
|
-
};
|
|
369
|
+
}, "AuthenticationError");
|
|
355
370
|
}
|
|
356
371
|
});
|
|
357
372
|
|
|
@@ -359,13 +374,13 @@ var require_AuthenticationError = __commonJS({
|
|
|
359
374
|
var require_AuthorizationError = __commonJS({
|
|
360
375
|
"src/Errors/AuthorizationError.js"(exports2, module2) {
|
|
361
376
|
var AppError = require_AppError();
|
|
362
|
-
module2.exports = class AuthorizationError extends AppError {
|
|
377
|
+
module2.exports = /* @__PURE__ */ __name(class AuthorizationError extends AppError {
|
|
363
378
|
constructor(message = "Authorization Error", options = {}) {
|
|
364
379
|
super(message, options);
|
|
365
380
|
this.statusCode = 403;
|
|
366
381
|
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
367
382
|
}
|
|
368
|
-
};
|
|
383
|
+
}, "AuthorizationError");
|
|
369
384
|
}
|
|
370
385
|
});
|
|
371
386
|
|
|
@@ -373,13 +388,13 @@ var require_AuthorizationError = __commonJS({
|
|
|
373
388
|
var require_DeviceCommError = __commonJS({
|
|
374
389
|
"src/Errors/DeviceCommError.js"(exports2, module2) {
|
|
375
390
|
var AppError = require_AppError();
|
|
376
|
-
module2.exports = class DeviceCommError extends AppError {
|
|
391
|
+
module2.exports = /* @__PURE__ */ __name(class DeviceCommError extends AppError {
|
|
377
392
|
constructor(message = "Device Communication Error", options = {}) {
|
|
378
393
|
super(message, options);
|
|
379
394
|
this.statusCode = 503;
|
|
380
395
|
Object.setPrototypeOf(this, DeviceCommError.prototype);
|
|
381
396
|
}
|
|
382
|
-
};
|
|
397
|
+
}, "DeviceCommError");
|
|
383
398
|
}
|
|
384
399
|
});
|
|
385
400
|
|
|
@@ -387,13 +402,13 @@ var require_DeviceCommError = __commonJS({
|
|
|
387
402
|
var require_LoginError = __commonJS({
|
|
388
403
|
"src/Errors/LoginError.js"(exports2, module2) {
|
|
389
404
|
var AppError = require_AppError();
|
|
390
|
-
module2.exports = class LoginError extends AppError {
|
|
405
|
+
module2.exports = /* @__PURE__ */ __name(class LoginError extends AppError {
|
|
391
406
|
constructor(message = "Invalid Login information provided", options = {}) {
|
|
392
407
|
super(message, options);
|
|
393
408
|
this.statusCode = 401;
|
|
394
409
|
Object.setPrototypeOf(this, LoginError.prototype);
|
|
395
410
|
}
|
|
396
|
-
};
|
|
411
|
+
}, "LoginError");
|
|
397
412
|
}
|
|
398
413
|
});
|
|
399
414
|
|
|
@@ -401,13 +416,13 @@ var require_LoginError = __commonJS({
|
|
|
401
416
|
var require_NotFoundError = __commonJS({
|
|
402
417
|
"src/Errors/NotFoundError.js"(exports2, module2) {
|
|
403
418
|
var AppError = require_AppError();
|
|
404
|
-
module2.exports = class NotFoundError extends AppError {
|
|
419
|
+
module2.exports = /* @__PURE__ */ __name(class NotFoundError extends AppError {
|
|
405
420
|
constructor(message = "Resource Not Found", options = {}) {
|
|
406
421
|
super(message, options);
|
|
407
422
|
this.statusCode = 404;
|
|
408
423
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
409
424
|
}
|
|
410
|
-
};
|
|
425
|
+
}, "NotFoundError");
|
|
411
426
|
}
|
|
412
427
|
});
|
|
413
428
|
|
|
@@ -415,13 +430,13 @@ var require_NotFoundError = __commonJS({
|
|
|
415
430
|
var require_SystemCommError = __commonJS({
|
|
416
431
|
"src/Errors/SystemCommError.js"(exports2, module2) {
|
|
417
432
|
var AppError = require_AppError();
|
|
418
|
-
module2.exports = class SystemCommError extends AppError {
|
|
433
|
+
module2.exports = /* @__PURE__ */ __name(class SystemCommError extends AppError {
|
|
419
434
|
constructor(message = "System Communication Error", options = {}) {
|
|
420
435
|
super(message, options);
|
|
421
436
|
this.statusCode = 503;
|
|
422
437
|
Object.setPrototypeOf(this, SystemCommError.prototype);
|
|
423
438
|
}
|
|
424
|
-
};
|
|
439
|
+
}, "SystemCommError");
|
|
425
440
|
}
|
|
426
441
|
});
|
|
427
442
|
|
|
@@ -429,13 +444,13 @@ var require_SystemCommError = __commonJS({
|
|
|
429
444
|
var require_TokenExpiredError = __commonJS({
|
|
430
445
|
"src/Errors/TokenExpiredError.js"(exports2, module2) {
|
|
431
446
|
var AppError = require_AppError();
|
|
432
|
-
module2.exports = class TokenExpiredError extends AppError {
|
|
447
|
+
module2.exports = /* @__PURE__ */ __name(class TokenExpiredError extends AppError {
|
|
433
448
|
constructor(message = "Token Expired", options = {}) {
|
|
434
449
|
super(message, options);
|
|
435
450
|
this.statusCode = 401;
|
|
436
451
|
Object.setPrototypeOf(this, TokenExpiredError.prototype);
|
|
437
452
|
}
|
|
438
|
-
};
|
|
453
|
+
}, "TokenExpiredError");
|
|
439
454
|
}
|
|
440
455
|
});
|
|
441
456
|
|
|
@@ -443,13 +458,13 @@ var require_TokenExpiredError = __commonJS({
|
|
|
443
458
|
var require_UnprocessableRequestError = __commonJS({
|
|
444
459
|
"src/Errors/UnprocessableRequestError.js"(exports2, module2) {
|
|
445
460
|
var AppError = require_AppError();
|
|
446
|
-
module2.exports = class UnprocessableRequestError extends AppError {
|
|
461
|
+
module2.exports = /* @__PURE__ */ __name(class UnprocessableRequestError extends AppError {
|
|
447
462
|
constructor(message = "Unprocessable Request Error", options = {}) {
|
|
448
463
|
super(message, options);
|
|
449
464
|
this.statusCode = 422;
|
|
450
465
|
Object.setPrototypeOf(this, UnprocessableRequestError.prototype);
|
|
451
466
|
}
|
|
452
|
-
};
|
|
467
|
+
}, "UnprocessableRequestError");
|
|
453
468
|
}
|
|
454
469
|
});
|
|
455
470
|
|
|
@@ -457,13 +472,13 @@ var require_UnprocessableRequestError = __commonJS({
|
|
|
457
472
|
var require_ValidationError = __commonJS({
|
|
458
473
|
"src/Errors/ValidationError.js"(exports2, module2) {
|
|
459
474
|
var AppError = require_AppError();
|
|
460
|
-
module2.exports = class ValidationError extends AppError {
|
|
475
|
+
module2.exports = /* @__PURE__ */ __name(class ValidationError extends AppError {
|
|
461
476
|
constructor(message = "Validation Error", options = {}) {
|
|
462
477
|
super(message, options);
|
|
463
478
|
this.statusCode = 400;
|
|
464
479
|
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
465
480
|
}
|
|
466
|
-
};
|
|
481
|
+
}, "ValidationError");
|
|
467
482
|
}
|
|
468
483
|
});
|
|
469
484
|
|
|
@@ -509,6 +524,7 @@ var require_DiscoverReservationsCommand = __commonJS({
|
|
|
509
524
|
return "system.response.reservations";
|
|
510
525
|
}
|
|
511
526
|
};
|
|
527
|
+
__name(DiscoverReservationsCommand2, "DiscoverReservationsCommand");
|
|
512
528
|
module2.exports = DiscoverReservationsCommand2;
|
|
513
529
|
}
|
|
514
530
|
});
|
|
@@ -531,6 +547,7 @@ var require_DiscoverRoomsCommand = __commonJS({
|
|
|
531
547
|
return "system.response.users";
|
|
532
548
|
}
|
|
533
549
|
};
|
|
550
|
+
__name(DiscoverRoomsCommand2, "DiscoverRoomsCommand");
|
|
534
551
|
module2.exports = DiscoverRoomsCommand2;
|
|
535
552
|
}
|
|
536
553
|
});
|
package/dist/cjs/Errors.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
|
};
|
|
@@ -6,14 +8,14 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
6
8
|
// src/Errors/AppError.js
|
|
7
9
|
var require_AppError = __commonJS({
|
|
8
10
|
"src/Errors/AppError.js"(exports2, module2) {
|
|
9
|
-
module2.exports = class AppError extends Error {
|
|
11
|
+
module2.exports = /* @__PURE__ */ __name(class AppError extends Error {
|
|
10
12
|
constructor(message = "Internal Server Error", options) {
|
|
11
13
|
super(message, options);
|
|
12
14
|
this.type = this.constructor.name;
|
|
13
15
|
this.statusCode = 500;
|
|
14
16
|
Object.setPrototypeOf(this, AppError.prototype);
|
|
15
17
|
}
|
|
16
|
-
};
|
|
18
|
+
}, "AppError");
|
|
17
19
|
}
|
|
18
20
|
});
|
|
19
21
|
|
|
@@ -21,13 +23,13 @@ var require_AppError = __commonJS({
|
|
|
21
23
|
var require_AuthenticationError = __commonJS({
|
|
22
24
|
"src/Errors/AuthenticationError.js"(exports2, module2) {
|
|
23
25
|
var AppError = require_AppError();
|
|
24
|
-
module2.exports = class AuthenticationError extends AppError {
|
|
26
|
+
module2.exports = /* @__PURE__ */ __name(class AuthenticationError extends AppError {
|
|
25
27
|
constructor(message = "Authentication Error", options = {}) {
|
|
26
28
|
super(message, options);
|
|
27
29
|
this.statusCode = 401;
|
|
28
30
|
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
29
31
|
}
|
|
30
|
-
};
|
|
32
|
+
}, "AuthenticationError");
|
|
31
33
|
}
|
|
32
34
|
});
|
|
33
35
|
|
|
@@ -35,13 +37,13 @@ var require_AuthenticationError = __commonJS({
|
|
|
35
37
|
var require_AuthorizationError = __commonJS({
|
|
36
38
|
"src/Errors/AuthorizationError.js"(exports2, module2) {
|
|
37
39
|
var AppError = require_AppError();
|
|
38
|
-
module2.exports = class AuthorizationError extends AppError {
|
|
40
|
+
module2.exports = /* @__PURE__ */ __name(class AuthorizationError extends AppError {
|
|
39
41
|
constructor(message = "Authorization Error", options = {}) {
|
|
40
42
|
super(message, options);
|
|
41
43
|
this.statusCode = 403;
|
|
42
44
|
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
43
45
|
}
|
|
44
|
-
};
|
|
46
|
+
}, "AuthorizationError");
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
49
|
|
|
@@ -49,13 +51,13 @@ var require_AuthorizationError = __commonJS({
|
|
|
49
51
|
var require_DeviceCommError = __commonJS({
|
|
50
52
|
"src/Errors/DeviceCommError.js"(exports2, module2) {
|
|
51
53
|
var AppError = require_AppError();
|
|
52
|
-
module2.exports = class DeviceCommError extends AppError {
|
|
54
|
+
module2.exports = /* @__PURE__ */ __name(class DeviceCommError extends AppError {
|
|
53
55
|
constructor(message = "Device Communication Error", options = {}) {
|
|
54
56
|
super(message, options);
|
|
55
57
|
this.statusCode = 503;
|
|
56
58
|
Object.setPrototypeOf(this, DeviceCommError.prototype);
|
|
57
59
|
}
|
|
58
|
-
};
|
|
60
|
+
}, "DeviceCommError");
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
63
|
|
|
@@ -63,13 +65,13 @@ var require_DeviceCommError = __commonJS({
|
|
|
63
65
|
var require_LoginError = __commonJS({
|
|
64
66
|
"src/Errors/LoginError.js"(exports2, module2) {
|
|
65
67
|
var AppError = require_AppError();
|
|
66
|
-
module2.exports = class LoginError extends AppError {
|
|
68
|
+
module2.exports = /* @__PURE__ */ __name(class LoginError extends AppError {
|
|
67
69
|
constructor(message = "Invalid Login information provided", options = {}) {
|
|
68
70
|
super(message, options);
|
|
69
71
|
this.statusCode = 401;
|
|
70
72
|
Object.setPrototypeOf(this, LoginError.prototype);
|
|
71
73
|
}
|
|
72
|
-
};
|
|
74
|
+
}, "LoginError");
|
|
73
75
|
}
|
|
74
76
|
});
|
|
75
77
|
|
|
@@ -77,13 +79,13 @@ var require_LoginError = __commonJS({
|
|
|
77
79
|
var require_NotFoundError = __commonJS({
|
|
78
80
|
"src/Errors/NotFoundError.js"(exports2, module2) {
|
|
79
81
|
var AppError = require_AppError();
|
|
80
|
-
module2.exports = class NotFoundError extends AppError {
|
|
82
|
+
module2.exports = /* @__PURE__ */ __name(class NotFoundError extends AppError {
|
|
81
83
|
constructor(message = "Resource Not Found", options = {}) {
|
|
82
84
|
super(message, options);
|
|
83
85
|
this.statusCode = 404;
|
|
84
86
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
85
87
|
}
|
|
86
|
-
};
|
|
88
|
+
}, "NotFoundError");
|
|
87
89
|
}
|
|
88
90
|
});
|
|
89
91
|
|
|
@@ -91,13 +93,13 @@ var require_NotFoundError = __commonJS({
|
|
|
91
93
|
var require_RequestError = __commonJS({
|
|
92
94
|
"src/Errors/RequestError.js"(exports2, module2) {
|
|
93
95
|
var AppError = require_AppError();
|
|
94
|
-
module2.exports = class RequestError extends AppError {
|
|
96
|
+
module2.exports = /* @__PURE__ */ __name(class RequestError extends AppError {
|
|
95
97
|
constructor(message = "Bad Request", options = {}) {
|
|
96
98
|
super(message, options);
|
|
97
99
|
this.statusCode = 400;
|
|
98
100
|
Object.setPrototypeOf(this, RequestError.prototype);
|
|
99
101
|
}
|
|
100
|
-
};
|
|
102
|
+
}, "RequestError");
|
|
101
103
|
}
|
|
102
104
|
});
|
|
103
105
|
|
|
@@ -105,13 +107,13 @@ var require_RequestError = __commonJS({
|
|
|
105
107
|
var require_SystemCommError = __commonJS({
|
|
106
108
|
"src/Errors/SystemCommError.js"(exports2, module2) {
|
|
107
109
|
var AppError = require_AppError();
|
|
108
|
-
module2.exports = class SystemCommError extends AppError {
|
|
110
|
+
module2.exports = /* @__PURE__ */ __name(class SystemCommError extends AppError {
|
|
109
111
|
constructor(message = "System Communication Error", options = {}) {
|
|
110
112
|
super(message, options);
|
|
111
113
|
this.statusCode = 503;
|
|
112
114
|
Object.setPrototypeOf(this, SystemCommError.prototype);
|
|
113
115
|
}
|
|
114
|
-
};
|
|
116
|
+
}, "SystemCommError");
|
|
115
117
|
}
|
|
116
118
|
});
|
|
117
119
|
|
|
@@ -119,13 +121,13 @@ var require_SystemCommError = __commonJS({
|
|
|
119
121
|
var require_TokenExpiredError = __commonJS({
|
|
120
122
|
"src/Errors/TokenExpiredError.js"(exports2, module2) {
|
|
121
123
|
var AppError = require_AppError();
|
|
122
|
-
module2.exports = class TokenExpiredError extends AppError {
|
|
124
|
+
module2.exports = /* @__PURE__ */ __name(class TokenExpiredError extends AppError {
|
|
123
125
|
constructor(message = "Token Expired", options = {}) {
|
|
124
126
|
super(message, options);
|
|
125
127
|
this.statusCode = 401;
|
|
126
128
|
Object.setPrototypeOf(this, TokenExpiredError.prototype);
|
|
127
129
|
}
|
|
128
|
-
};
|
|
130
|
+
}, "TokenExpiredError");
|
|
129
131
|
}
|
|
130
132
|
});
|
|
131
133
|
|
|
@@ -133,13 +135,13 @@ var require_TokenExpiredError = __commonJS({
|
|
|
133
135
|
var require_UnprocessableRequestError = __commonJS({
|
|
134
136
|
"src/Errors/UnprocessableRequestError.js"(exports2, module2) {
|
|
135
137
|
var AppError = require_AppError();
|
|
136
|
-
module2.exports = class UnprocessableRequestError extends AppError {
|
|
138
|
+
module2.exports = /* @__PURE__ */ __name(class UnprocessableRequestError extends AppError {
|
|
137
139
|
constructor(message = "Unprocessable Request Error", options = {}) {
|
|
138
140
|
super(message, options);
|
|
139
141
|
this.statusCode = 422;
|
|
140
142
|
Object.setPrototypeOf(this, UnprocessableRequestError.prototype);
|
|
141
143
|
}
|
|
142
|
-
};
|
|
144
|
+
}, "UnprocessableRequestError");
|
|
143
145
|
}
|
|
144
146
|
});
|
|
145
147
|
|
|
@@ -147,13 +149,13 @@ var require_UnprocessableRequestError = __commonJS({
|
|
|
147
149
|
var require_ValidationError = __commonJS({
|
|
148
150
|
"src/Errors/ValidationError.js"(exports2, module2) {
|
|
149
151
|
var AppError = require_AppError();
|
|
150
|
-
module2.exports = class ValidationError extends AppError {
|
|
152
|
+
module2.exports = /* @__PURE__ */ __name(class ValidationError extends AppError {
|
|
151
153
|
constructor(message = "Validation Error", options = {}) {
|
|
152
154
|
super(message, options);
|
|
153
155
|
this.statusCode = 400;
|
|
154
156
|
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
155
157
|
}
|
|
156
|
-
};
|
|
158
|
+
}, "ValidationError");
|
|
157
159
|
}
|
|
158
160
|
});
|
|
159
161
|
|
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 = /* @__PURE__ */ 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
|
});
|