@kohost/api-client 3.0.0-beta.6 → 3.0.0-beta.8
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 +70 -22
- package/dist/cjs/Errors.js +24 -22
- package/dist/cjs/Events.js +26 -14
- package/dist/cjs/Models.js +56 -26
- 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 +70 -22
- 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 +719 -95
- package/dist/esm/Models.js.map +1 -1
- 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,10 +324,40 @@ 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
|
});
|
|
317
331
|
|
|
332
|
+
// src/Commands/SendEmailCommand.js
|
|
333
|
+
var require_SendEmailCommand = __commonJS({
|
|
334
|
+
"src/Commands/SendEmailCommand.js"(exports2, module2) {
|
|
335
|
+
var Command = require_Command();
|
|
336
|
+
var RequestError = require_RequestError();
|
|
337
|
+
var SendEmailCommand2 = class extends Command {
|
|
338
|
+
constructor({ text, html, to, from, subject, eventData }) {
|
|
339
|
+
if (!to)
|
|
340
|
+
throw new RequestError("email to is required");
|
|
341
|
+
if (!from)
|
|
342
|
+
throw new RequestError("email from is required");
|
|
343
|
+
if (!subject)
|
|
344
|
+
throw new RequestError("email subject is required");
|
|
345
|
+
if (!text && !html)
|
|
346
|
+
throw new RequestError("email text or html is required");
|
|
347
|
+
super({ text, html, to, from, subject, eventData });
|
|
348
|
+
}
|
|
349
|
+
get name() {
|
|
350
|
+
return "SendEmail";
|
|
351
|
+
}
|
|
352
|
+
get routingKey() {
|
|
353
|
+
return "comm.email.send";
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
__name(SendEmailCommand2, "SendEmailCommand");
|
|
357
|
+
module2.exports = SendEmailCommand2;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
|
|
318
361
|
// src/Commands/SendSMSCommand.js
|
|
319
362
|
var require_SendSMSCommand = __commonJS({
|
|
320
363
|
"src/Commands/SendSMSCommand.js"(exports2, module2) {
|
|
@@ -337,6 +380,7 @@ var require_SendSMSCommand = __commonJS({
|
|
|
337
380
|
return "comm.sms.send";
|
|
338
381
|
}
|
|
339
382
|
};
|
|
383
|
+
__name(SendSMSCommand2, "SendSMSCommand");
|
|
340
384
|
module2.exports = SendSMSCommand2;
|
|
341
385
|
}
|
|
342
386
|
});
|
|
@@ -345,13 +389,13 @@ var require_SendSMSCommand = __commonJS({
|
|
|
345
389
|
var require_AuthenticationError = __commonJS({
|
|
346
390
|
"src/Errors/AuthenticationError.js"(exports2, module2) {
|
|
347
391
|
var AppError = require_AppError();
|
|
348
|
-
module2.exports = class AuthenticationError extends AppError {
|
|
392
|
+
module2.exports = /* @__PURE__ */ __name(class AuthenticationError extends AppError {
|
|
349
393
|
constructor(message = "Authentication Error", options = {}) {
|
|
350
394
|
super(message, options);
|
|
351
395
|
this.statusCode = 401;
|
|
352
396
|
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
353
397
|
}
|
|
354
|
-
};
|
|
398
|
+
}, "AuthenticationError");
|
|
355
399
|
}
|
|
356
400
|
});
|
|
357
401
|
|
|
@@ -359,13 +403,13 @@ var require_AuthenticationError = __commonJS({
|
|
|
359
403
|
var require_AuthorizationError = __commonJS({
|
|
360
404
|
"src/Errors/AuthorizationError.js"(exports2, module2) {
|
|
361
405
|
var AppError = require_AppError();
|
|
362
|
-
module2.exports = class AuthorizationError extends AppError {
|
|
406
|
+
module2.exports = /* @__PURE__ */ __name(class AuthorizationError extends AppError {
|
|
363
407
|
constructor(message = "Authorization Error", options = {}) {
|
|
364
408
|
super(message, options);
|
|
365
409
|
this.statusCode = 403;
|
|
366
410
|
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
367
411
|
}
|
|
368
|
-
};
|
|
412
|
+
}, "AuthorizationError");
|
|
369
413
|
}
|
|
370
414
|
});
|
|
371
415
|
|
|
@@ -373,13 +417,13 @@ var require_AuthorizationError = __commonJS({
|
|
|
373
417
|
var require_DeviceCommError = __commonJS({
|
|
374
418
|
"src/Errors/DeviceCommError.js"(exports2, module2) {
|
|
375
419
|
var AppError = require_AppError();
|
|
376
|
-
module2.exports = class DeviceCommError extends AppError {
|
|
420
|
+
module2.exports = /* @__PURE__ */ __name(class DeviceCommError extends AppError {
|
|
377
421
|
constructor(message = "Device Communication Error", options = {}) {
|
|
378
422
|
super(message, options);
|
|
379
423
|
this.statusCode = 503;
|
|
380
424
|
Object.setPrototypeOf(this, DeviceCommError.prototype);
|
|
381
425
|
}
|
|
382
|
-
};
|
|
426
|
+
}, "DeviceCommError");
|
|
383
427
|
}
|
|
384
428
|
});
|
|
385
429
|
|
|
@@ -387,13 +431,13 @@ var require_DeviceCommError = __commonJS({
|
|
|
387
431
|
var require_LoginError = __commonJS({
|
|
388
432
|
"src/Errors/LoginError.js"(exports2, module2) {
|
|
389
433
|
var AppError = require_AppError();
|
|
390
|
-
module2.exports = class LoginError extends AppError {
|
|
434
|
+
module2.exports = /* @__PURE__ */ __name(class LoginError extends AppError {
|
|
391
435
|
constructor(message = "Invalid Login information provided", options = {}) {
|
|
392
436
|
super(message, options);
|
|
393
437
|
this.statusCode = 401;
|
|
394
438
|
Object.setPrototypeOf(this, LoginError.prototype);
|
|
395
439
|
}
|
|
396
|
-
};
|
|
440
|
+
}, "LoginError");
|
|
397
441
|
}
|
|
398
442
|
});
|
|
399
443
|
|
|
@@ -401,13 +445,13 @@ var require_LoginError = __commonJS({
|
|
|
401
445
|
var require_NotFoundError = __commonJS({
|
|
402
446
|
"src/Errors/NotFoundError.js"(exports2, module2) {
|
|
403
447
|
var AppError = require_AppError();
|
|
404
|
-
module2.exports = class NotFoundError extends AppError {
|
|
448
|
+
module2.exports = /* @__PURE__ */ __name(class NotFoundError extends AppError {
|
|
405
449
|
constructor(message = "Resource Not Found", options = {}) {
|
|
406
450
|
super(message, options);
|
|
407
451
|
this.statusCode = 404;
|
|
408
452
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
409
453
|
}
|
|
410
|
-
};
|
|
454
|
+
}, "NotFoundError");
|
|
411
455
|
}
|
|
412
456
|
});
|
|
413
457
|
|
|
@@ -415,13 +459,13 @@ var require_NotFoundError = __commonJS({
|
|
|
415
459
|
var require_SystemCommError = __commonJS({
|
|
416
460
|
"src/Errors/SystemCommError.js"(exports2, module2) {
|
|
417
461
|
var AppError = require_AppError();
|
|
418
|
-
module2.exports = class SystemCommError extends AppError {
|
|
462
|
+
module2.exports = /* @__PURE__ */ __name(class SystemCommError extends AppError {
|
|
419
463
|
constructor(message = "System Communication Error", options = {}) {
|
|
420
464
|
super(message, options);
|
|
421
465
|
this.statusCode = 503;
|
|
422
466
|
Object.setPrototypeOf(this, SystemCommError.prototype);
|
|
423
467
|
}
|
|
424
|
-
};
|
|
468
|
+
}, "SystemCommError");
|
|
425
469
|
}
|
|
426
470
|
});
|
|
427
471
|
|
|
@@ -429,13 +473,13 @@ var require_SystemCommError = __commonJS({
|
|
|
429
473
|
var require_TokenExpiredError = __commonJS({
|
|
430
474
|
"src/Errors/TokenExpiredError.js"(exports2, module2) {
|
|
431
475
|
var AppError = require_AppError();
|
|
432
|
-
module2.exports = class TokenExpiredError extends AppError {
|
|
476
|
+
module2.exports = /* @__PURE__ */ __name(class TokenExpiredError extends AppError {
|
|
433
477
|
constructor(message = "Token Expired", options = {}) {
|
|
434
478
|
super(message, options);
|
|
435
479
|
this.statusCode = 401;
|
|
436
480
|
Object.setPrototypeOf(this, TokenExpiredError.prototype);
|
|
437
481
|
}
|
|
438
|
-
};
|
|
482
|
+
}, "TokenExpiredError");
|
|
439
483
|
}
|
|
440
484
|
});
|
|
441
485
|
|
|
@@ -443,13 +487,13 @@ var require_TokenExpiredError = __commonJS({
|
|
|
443
487
|
var require_UnprocessableRequestError = __commonJS({
|
|
444
488
|
"src/Errors/UnprocessableRequestError.js"(exports2, module2) {
|
|
445
489
|
var AppError = require_AppError();
|
|
446
|
-
module2.exports = class UnprocessableRequestError extends AppError {
|
|
490
|
+
module2.exports = /* @__PURE__ */ __name(class UnprocessableRequestError extends AppError {
|
|
447
491
|
constructor(message = "Unprocessable Request Error", options = {}) {
|
|
448
492
|
super(message, options);
|
|
449
493
|
this.statusCode = 422;
|
|
450
494
|
Object.setPrototypeOf(this, UnprocessableRequestError.prototype);
|
|
451
495
|
}
|
|
452
|
-
};
|
|
496
|
+
}, "UnprocessableRequestError");
|
|
453
497
|
}
|
|
454
498
|
});
|
|
455
499
|
|
|
@@ -457,13 +501,13 @@ var require_UnprocessableRequestError = __commonJS({
|
|
|
457
501
|
var require_ValidationError = __commonJS({
|
|
458
502
|
"src/Errors/ValidationError.js"(exports2, module2) {
|
|
459
503
|
var AppError = require_AppError();
|
|
460
|
-
module2.exports = class ValidationError extends AppError {
|
|
504
|
+
module2.exports = /* @__PURE__ */ __name(class ValidationError extends AppError {
|
|
461
505
|
constructor(message = "Validation Error", options = {}) {
|
|
462
506
|
super(message, options);
|
|
463
507
|
this.statusCode = 400;
|
|
464
508
|
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
465
509
|
}
|
|
466
|
-
};
|
|
510
|
+
}, "ValidationError");
|
|
467
511
|
}
|
|
468
512
|
});
|
|
469
513
|
|
|
@@ -509,6 +553,7 @@ var require_DiscoverReservationsCommand = __commonJS({
|
|
|
509
553
|
return "system.response.reservations";
|
|
510
554
|
}
|
|
511
555
|
};
|
|
556
|
+
__name(DiscoverReservationsCommand2, "DiscoverReservationsCommand");
|
|
512
557
|
module2.exports = DiscoverReservationsCommand2;
|
|
513
558
|
}
|
|
514
559
|
});
|
|
@@ -531,6 +576,7 @@ var require_DiscoverRoomsCommand = __commonJS({
|
|
|
531
576
|
return "system.response.users";
|
|
532
577
|
}
|
|
533
578
|
};
|
|
579
|
+
__name(DiscoverRoomsCommand2, "DiscoverRoomsCommand");
|
|
534
580
|
module2.exports = DiscoverRoomsCommand2;
|
|
535
581
|
}
|
|
536
582
|
});
|
|
@@ -547,6 +593,7 @@ var SetCourtesyCommand = require_SetCourtesyCommand();
|
|
|
547
593
|
var DiscoverUsersCommand = require_DiscoverUsersCommand();
|
|
548
594
|
var OCRDocumentCommand = require_OCRDocumentCommand();
|
|
549
595
|
var CheckInReservationCommand = require_CheckInReservationCommand();
|
|
596
|
+
var SendEmailCommand = require_SendEmailCommand();
|
|
550
597
|
var SendSMSCommand = require_SendSMSCommand();
|
|
551
598
|
var DiscoverReservationsCommand = require_DiscoverReservationsCommand();
|
|
552
599
|
var DiscoverRoomsCommand = require_DiscoverRoomsCommand();
|
|
@@ -563,6 +610,7 @@ module.exports = {
|
|
|
563
610
|
DiscoverUsersCommand,
|
|
564
611
|
CheckInReservationCommand,
|
|
565
612
|
SendSMSCommand,
|
|
613
|
+
SendEmailCommand,
|
|
566
614
|
DiscoverReservationsCommand,
|
|
567
615
|
DiscoverRoomsCommand
|
|
568
616
|
};
|
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
|
});
|