@kohost/api-client 3.2.13 → 3.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/cjs/AMQPClient/index.js +1 -45
  2. package/dist/cjs/Commands/{CheckInReservationCommand.js → CheckInReservation.js} +2 -6
  3. package/dist/cjs/Commands/{CheckOutReservationCommand.js → CheckOutReservation.js} +2 -6
  4. package/dist/cjs/Commands/Command.js +5 -7
  5. package/dist/cjs/Commands/{CreateImageUploadEndpointCommand.js → CreateImageUploadEndpoint.js} +2 -6
  6. package/dist/cjs/Commands/{CreateShortLinkCommand.js → CreateShortLink.js} +0 -4
  7. package/dist/cjs/Commands/GetCategories.js +13 -0
  8. package/dist/cjs/Commands/{GetMobileKeyCommand.js → GetMobileKey.js} +2 -6
  9. package/dist/cjs/Commands/GetProducts.js +13 -0
  10. package/dist/cjs/Commands/GetReservationSpaceCategoryAvailabilities.js +16 -0
  11. package/dist/cjs/Commands/{DiscoverReservationsCommand.js → GetReservations.js} +3 -7
  12. package/dist/cjs/Commands/{DiscoverRoomsCommand.js → GetRooms.js} +3 -9
  13. package/dist/cjs/Commands/GetUsers.js +13 -0
  14. package/dist/cjs/Commands/{OCRDocumentCommand.js → OCRDocument.js} +2 -2
  15. package/dist/cjs/Commands/{SellProductsCommand.js → SellProducts.js} +2 -6
  16. package/dist/cjs/Commands/{SendEmailCommand.js → SendEmail.js} +2 -6
  17. package/dist/cjs/Commands/{SendSMSCommand.js → SendSMS.js} +2 -6
  18. package/dist/cjs/Commands/{SetAlarmCommand.js → SetAlarm.js} +2 -6
  19. package/dist/cjs/Commands/{SetCourtesyCommand.js → SetCourtesy.js} +2 -6
  20. package/dist/cjs/Commands/{SetDimmerCommand.js → SetDimmer.js} +2 -6
  21. package/dist/cjs/Commands/{SetLockCommand.js → SetLock.js} +2 -6
  22. package/dist/cjs/Commands/{SetMediaCommand.js → SetMedia.js} +2 -6
  23. package/dist/cjs/Commands/{SetSceneCommand.js → SetScene.js} +2 -6
  24. package/dist/cjs/Commands/{SetSwitchCommand.js → SetSwitch.js} +2 -6
  25. package/dist/cjs/Commands/{SetThermostatCommand.js → SetThermostat.js} +2 -6
  26. package/dist/cjs/Commands/{SetWindowCoveringCommand.js → SetWindowCovering.js} +2 -6
  27. package/dist/cjs/Commands/{UpdateReservationCommand.js → UpdateReservation.js} +2 -6
  28. package/dist/cjs/Commands/{UpdateUserCommand.js → UpdateUser.js} +2 -6
  29. package/dist/cjs/Commands/{UploadImageCommand.js → UploadImage.js} +2 -6
  30. package/dist/cjs/Commands/index.js +56 -54
  31. package/dist/cjs/Events/ApplicationInUse.js +22 -0
  32. package/dist/cjs/Events/ApplicationOutOfUse.js +22 -0
  33. package/dist/cjs/Events/EmailEvent.js +3 -4
  34. package/dist/cjs/Events/Event.js +17 -28
  35. package/dist/cjs/Events/ReservationCheckedIn.js +17 -0
  36. package/dist/cjs/Events/ReservationCheckedOut.js +17 -0
  37. package/dist/cjs/Events/SMSEvent.js +3 -4
  38. package/dist/cjs/Events/SceneSet.js +17 -0
  39. package/dist/cjs/Events/ShortLinkCreated.js +17 -0
  40. package/dist/cjs/Events/SystemAlarmUpdated.js +17 -0
  41. package/dist/cjs/Events/SystemCameraUpdated.js +17 -0
  42. package/dist/cjs/Events/SystemCategoryUpdated.js +17 -0
  43. package/dist/cjs/Events/SystemCourtesyUpdated.js +17 -0
  44. package/dist/cjs/Events/SystemCredentialUpdated.js +17 -0
  45. package/dist/cjs/Events/SystemDimmerUpdated.js +17 -0
  46. package/dist/cjs/Events/SystemEntityDeleted.js +17 -0
  47. package/dist/cjs/Events/SystemGatewayUpdated.js +17 -0
  48. package/dist/cjs/Events/SystemLockUpdated.js +17 -0
  49. package/dist/cjs/Events/SystemMediaSourceUpdated.js +17 -0
  50. package/dist/cjs/Events/SystemMotionSensorUpdated.js +17 -0
  51. package/dist/cjs/Events/SystemOrganizationUpdated.js +17 -0
  52. package/dist/cjs/Events/SystemProductUpdated.js +17 -0
  53. package/dist/cjs/Events/SystemPropertyUpdated.js +17 -0
  54. package/dist/cjs/Events/SystemReservationUpdated.js +17 -0
  55. package/dist/cjs/Events/SystemSpaceUpdated.js +17 -0
  56. package/dist/cjs/Events/SystemSwitchUpdated.js +17 -0
  57. package/dist/cjs/Events/SystemThermostatUpdated.js +17 -0
  58. package/dist/cjs/Events/SystemUserUpdated.js +17 -0
  59. package/dist/cjs/Events/SystemWindowCoveringUpdated.js +17 -0
  60. package/dist/cjs/Events/index.js +53 -55
  61. package/dist/cjs/defs/amqpExchanges.js +46 -0
  62. package/dist/cjs/schemas/AlarmSchema.d.ts +1 -0
  63. package/dist/cjs/schemas/CameraSchema.d.ts +1 -0
  64. package/dist/cjs/schemas/CategorySchema.d.ts +1 -0
  65. package/dist/cjs/schemas/CourtesySchema.d.ts +1 -0
  66. package/dist/cjs/schemas/CredentialSchema.d.ts +1 -0
  67. package/dist/cjs/schemas/DimmerSchema.d.ts +1 -0
  68. package/dist/cjs/schemas/GatewaySchema.d.ts +1 -0
  69. package/dist/cjs/schemas/LockSchema.d.ts +1 -0
  70. package/dist/cjs/schemas/MediaSourceSchema.d.ts +1 -0
  71. package/dist/cjs/schemas/MotionSensorSchema.d.ts +1 -0
  72. package/dist/cjs/schemas/ProductSchema.d.ts +2 -0
  73. package/dist/cjs/schemas/ReservationSchema.d.ts +1 -0
  74. package/dist/cjs/schemas/RoomSchema.d.ts +10 -0
  75. package/dist/cjs/schemas/SpaceSchema.d.ts +1 -0
  76. package/dist/cjs/schemas/SwitchSchema.d.ts +1 -0
  77. package/dist/cjs/schemas/SystemUserSchema.d.ts +1 -0
  78. package/dist/cjs/schemas/ThermostatSchema.d.ts +1 -0
  79. package/dist/cjs/schemas/UserSchema.d.ts +1 -0
  80. package/dist/cjs/schemas/WindowCoveringSchema.d.ts +1 -0
  81. package/dist/cjs/schemas/definitions.json +1 -0
  82. package/dist/cjs/schemas/product.json +3 -0
  83. package/dist/esm/Commands.js +276 -324
  84. package/dist/esm/Commands.js.map +3 -3
  85. package/dist/esm/Events.js +387 -472
  86. package/dist/esm/Events.js.map +3 -3
  87. package/dist/esm/Models.js +24 -10
  88. package/dist/esm/Models.js.map +3 -3
  89. package/dist/esm/SocketIoClient.js +18 -18
  90. package/dist/esm/SocketIoClient.js.map +3 -3
  91. package/dist/esm/utils.js +24 -10
  92. package/dist/esm/utils.js.map +3 -3
  93. package/package.json +1 -1
  94. package/dist/cjs/Commands/DiscoverCategoriesCommand.js +0 -20
  95. package/dist/cjs/Commands/DiscoverProductsCommand.js +0 -27
  96. package/dist/cjs/Commands/DiscoverReservationSpaceCategoryAvailabilitiesCommand.js +0 -20
  97. package/dist/cjs/Commands/DiscoverUsersCommand.js +0 -19
  98. package/dist/cjs/Events/ApplicationInUseEvent.js +0 -25
  99. package/dist/cjs/Events/ApplicationOutOfUseEvent.js +0 -25
  100. package/dist/cjs/Events/ReservationCheckInEvent.js +0 -23
  101. package/dist/cjs/Events/ReservationCheckOutEvent.js +0 -23
  102. package/dist/cjs/Events/SMSSentEvent.js +0 -17
  103. package/dist/cjs/Events/SceneSetEvent.js +0 -17
  104. package/dist/cjs/Events/ShortLinkCreatedEvent.js +0 -17
  105. package/dist/cjs/Events/SystemAlarmUpdatedEvent.js +0 -17
  106. package/dist/cjs/Events/SystemCameraUpdatedEvent.js +0 -17
  107. package/dist/cjs/Events/SystemCategoryUpdatedEvent.js +0 -17
  108. package/dist/cjs/Events/SystemCourtesyUpdatedEvent.js +0 -17
  109. package/dist/cjs/Events/SystemCredentialUpdatedEvent.js +0 -17
  110. package/dist/cjs/Events/SystemDimmerUpdatedEvent.js +0 -17
  111. package/dist/cjs/Events/SystemEntityDeletedEvent.js +0 -17
  112. package/dist/cjs/Events/SystemGatewayUpdatedEvent.js +0 -17
  113. package/dist/cjs/Events/SystemLockUpdatedEvent.js +0 -17
  114. package/dist/cjs/Events/SystemMediaSourceUpdatedEvent.js +0 -17
  115. package/dist/cjs/Events/SystemMotionSensorUpdatedEvent.js +0 -17
  116. package/dist/cjs/Events/SystemOrganizationUpdatedEvent.js +0 -17
  117. package/dist/cjs/Events/SystemProductUpdatedEvent.js +0 -17
  118. package/dist/cjs/Events/SystemPropertyUpdatedEvent.js +0 -17
  119. package/dist/cjs/Events/SystemReservationUpdatedEvent.js +0 -17
  120. package/dist/cjs/Events/SystemSceneControllerUpdatedEvent.js +0 -17
  121. package/dist/cjs/Events/SystemSpaceUpdatedEvent.js +0 -17
  122. package/dist/cjs/Events/SystemSwitchUpdatedEvent.js +0 -17
  123. package/dist/cjs/Events/SystemThermostatUpdatedEvent.js +0 -17
  124. package/dist/cjs/Events/SystemUserUpdatedEvent.js +0 -17
  125. package/dist/cjs/Events/SystemWindowCoveringUpdatedEvent.js +0 -17
@@ -1,6 +1,7 @@
1
1
  const Errors = require("../Errors");
2
2
  const amqp = require("amqplib");
3
3
  const crypto = require("crypto");
4
+ const exchanges = require("../defs/amqpExchanges");
4
5
  const isFatalError = require("amqplib/lib/connection").isFatalError;
5
6
  const debug = require("debug")("kohost:amqp-client");
6
7
 
@@ -10,51 +11,6 @@ const HEADER_KEY_DRIVER = "X-Driver";
10
11
  const HEADER_KEY_COMMAND_NAME = "X-Command-Name";
11
12
  const HEADER_KEY_EVENT_NAME = "X-Event-Name";
12
13
 
13
- const exchanges = {
14
- // routes commands based on `command-name` header and in many cases `property-id` header
15
- Commands: {
16
- name: "kohost.commands",
17
- type: "headers",
18
- options: {
19
- durable: true,
20
- },
21
- },
22
- // routes events based on routing keys
23
- DriverEvents: {
24
- name: "kohost.events.drivers",
25
- type: "topic",
26
- options: {
27
- durable: true,
28
- },
29
- },
30
- AppEvents: {
31
- name: "kohost.events.app",
32
- type: "topic",
33
- options: {
34
- durable: true,
35
- },
36
- },
37
- Direct: {
38
- name: "kohost.direct",
39
- type: "direct",
40
- options: {
41
- durable: true,
42
- },
43
- },
44
- Replies: {
45
- name: "kohost.replies",
46
- type: "topic",
47
- options: {
48
- durable: true,
49
- },
50
- },
51
- // dead letter exchange
52
- dlx: {
53
- name: "kohost.dlx",
54
- type: "direct",
55
- },
56
- };
57
-
58
14
  class KohostAMQPClient {
59
15
  static get Message() {
60
16
  return Message;
@@ -1,7 +1,7 @@
1
1
  const Command = require("./Command");
2
2
  const RequestError = require("../Errors/RequestError");
3
3
 
4
- class CheckInReservationCommand extends Command {
4
+ class CheckInReservation extends Command {
5
5
  constructor({ id, ...rest }) {
6
6
  if (!id) throw new RequestError("reservation id is required");
7
7
  super({ id, ...rest });
@@ -10,10 +10,6 @@ class CheckInReservationCommand extends Command {
10
10
  get name() {
11
11
  return "CheckInReservation";
12
12
  }
13
-
14
- get routingKey() {
15
- return `reservation.${this.data.id}.checkin`;
16
- }
17
13
  }
18
14
 
19
- module.exports = CheckInReservationCommand;
15
+ module.exports = CheckInReservation;
@@ -1,7 +1,7 @@
1
1
  const Command = require("./Command");
2
2
  const RequestError = require("../Errors/RequestError");
3
3
 
4
- class CheckOutReservationCommand extends Command {
4
+ class CheckOutReservation extends Command {
5
5
  constructor({ reservationId, userId, ...rest }) {
6
6
  if (!reservationId) throw new RequestError("reservation id is required");
7
7
  if (!userId) throw new RequestError("user id is required");
@@ -11,10 +11,6 @@ class CheckOutReservationCommand extends Command {
11
11
  get name() {
12
12
  return "CheckOutReservation";
13
13
  }
14
-
15
- get routingKey() {
16
- return `reservation.${this.data.id}.checkout`;
17
- }
18
14
  }
19
15
 
20
- module.exports = CheckOutReservationCommand;
16
+ module.exports = CheckOutReservation;
@@ -1,3 +1,5 @@
1
+ const exchanges = require("../defs/amqpExchanges");
2
+
1
3
  class Command {
2
4
  constructor(data) {
3
5
  this.data = {};
@@ -14,16 +16,12 @@ class Command {
14
16
  throw new Error("Command name is required");
15
17
  }
16
18
 
17
- get type() {
19
+ static get type() {
18
20
  return "Command";
19
21
  }
20
22
 
21
- get routingKey() {
22
- return "";
23
- }
24
-
25
- get exchange() {
26
- return "Commands";
23
+ static get exchange() {
24
+ return exchanges.Commands.name;
27
25
  }
28
26
 
29
27
  build() {
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class CreateImageUploadEndpointCommand extends Command {
3
+ class CreateImageUploadEndpoint extends Command {
4
4
  constructor({ id, expires, ...rest }) {
5
5
  super({ id, expires, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class CreateImageUploadEndpointCommand extends Command {
8
8
  get name() {
9
9
  return "CreateImageUploadEndpoint";
10
10
  }
11
-
12
- get routingKey() {
13
- return "image.createUploadEndpoint";
14
- }
15
11
  }
16
12
 
17
- module.exports = CreateImageUploadEndpointCommand;
13
+ module.exports = CreateImageUploadEndpoint;
@@ -11,10 +11,6 @@ class CreateShortLinkCommand extends Command {
11
11
  get name() {
12
12
  return "CreateShortLink";
13
13
  }
14
-
15
- get routingKey() {
16
- return "comm.shortlink.create";
17
- }
18
14
  }
19
15
 
20
16
  module.exports = CreateShortLinkCommand;
@@ -0,0 +1,13 @@
1
+ const Command = require("./Command");
2
+
3
+ class GetCategories extends Command {
4
+ constructor({ id, ...rest }) {
5
+ super({ id, ...rest });
6
+ }
7
+
8
+ get name() {
9
+ return "GetCategories";
10
+ }
11
+ }
12
+
13
+ module.exports = GetCategories;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class GetMobileKeyCommand extends Command {
3
+ class GetMobileKey extends Command {
4
4
  constructor({
5
5
  id,
6
6
  phone,
@@ -15,10 +15,6 @@ class GetMobileKeyCommand extends Command {
15
15
  get name() {
16
16
  return "GetMobileKey";
17
17
  }
18
-
19
- get routingKey() {
20
- return `lock.${this.data.id}.set`;
21
- }
22
18
  }
23
19
 
24
- module.exports = GetMobileKeyCommand;
20
+ module.exports = GetMobileKey;
@@ -0,0 +1,13 @@
1
+ const Command = require("./Command");
2
+
3
+ class GetProducts extends Command {
4
+ constructor({ id, externalSystemId, ...rest }) {
5
+ super({ id, externalSystemId, ...rest });
6
+ }
7
+
8
+ get name() {
9
+ return "GetProducts";
10
+ }
11
+ }
12
+
13
+ module.exports = GetProducts;
@@ -0,0 +1,16 @@
1
+ const { RequestError } = require("../Errors");
2
+ const Command = require("./Command");
3
+
4
+ class GetReservationSpaceCategoryAvailabilities extends Command {
5
+ constructor(options) {
6
+ if (!options) throw new RequestError("options are required");
7
+ const { id, ...rest } = options;
8
+ super({ id, ...rest });
9
+ }
10
+
11
+ get name() {
12
+ return "GetReservationSpaceCategoryAvailabilities";
13
+ }
14
+ }
15
+
16
+ module.exports = GetReservationSpaceCategoryAvailabilities;
@@ -1,7 +1,7 @@
1
1
  const { RequestError } = require("../Errors");
2
2
  const Command = require("./Command");
3
3
 
4
- class DiscoverReservationsCommand extends Command {
4
+ class GetReservations extends Command {
5
5
  constructor(options) {
6
6
  if (!options) throw new RequestError("options are required");
7
7
  const { id, startDate, endDate, status, ...rest } = options;
@@ -9,12 +9,8 @@ class DiscoverReservationsCommand extends Command {
9
9
  }
10
10
 
11
11
  get name() {
12
- return "DiscoverReservations";
13
- }
14
-
15
- get routingKey() {
16
- return "reservation.discover";
12
+ return "GetReservations";
17
13
  }
18
14
  }
19
15
 
20
- module.exports = DiscoverReservationsCommand;
16
+ module.exports = GetReservations;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class DiscoverRoomsCommand extends Command {
3
+ class GetRooms extends Command {
4
4
  constructor({
5
5
  id,
6
6
  types,
@@ -24,14 +24,8 @@ class DiscoverRoomsCommand extends Command {
24
24
  }
25
25
 
26
26
  get name() {
27
- return "DiscoverRooms";
28
- }
29
-
30
- get routingKey() {
31
- if (typeof this.data.id === "string") return `rooms.${this.data.id}.get`;
32
- if (Array.isArray(this.data.id)) return "rooms.batch.get";
33
- return "rooms.get";
27
+ return "GetRooms";
34
28
  }
35
29
  }
36
30
 
37
- module.exports = DiscoverRoomsCommand;
31
+ module.exports = GetRooms;
@@ -0,0 +1,13 @@
1
+ const Command = require("./Command");
2
+
3
+ class GetUsers extends Command {
4
+ constructor({ id, ...rest }) {
5
+ super({ id, ...rest });
6
+ }
7
+
8
+ get name() {
9
+ return "GetUsers";
10
+ }
11
+ }
12
+
13
+ module.exports = GetUsers;
@@ -1,7 +1,7 @@
1
1
  const Command = require("./Command");
2
2
  const RequestError = require("../Errors/RequestError");
3
3
 
4
- class OCRDocumentCommand extends Command {
4
+ class OCRDocument extends Command {
5
5
  constructor({ type, image, ...rest }) {
6
6
  if (!image) throw new RequestError("document image is required");
7
7
  super({ type, image, ...rest });
@@ -12,4 +12,4 @@ class OCRDocumentCommand extends Command {
12
12
  }
13
13
  }
14
14
 
15
- module.exports = OCRDocumentCommand;
15
+ module.exports = OCRDocument;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SellProductsCommand extends Command {
3
+ class SellProducts extends Command {
4
4
  constructor({ reservationId, userId, products, ...rest }) {
5
5
  super({ reservationId, userId, products, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SellProductsCommand extends Command {
8
8
  get name() {
9
9
  return "SellProducts";
10
10
  }
11
-
12
- get routingKey() {
13
- return `product.${this.data.id}.sell`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SellProductsCommand;
13
+ module.exports = SellProducts;
@@ -1,7 +1,7 @@
1
1
  const Command = require("./Command");
2
2
  const RequestError = require("../Errors/RequestError");
3
3
 
4
- class SendEmailCommand extends Command {
4
+ class SendEmail extends Command {
5
5
  constructor({ text, html, to, from, subject, ...rest }) {
6
6
  if (!to) throw new RequestError("email to is required");
7
7
  if (!from) throw new RequestError("email from is required");
@@ -15,10 +15,6 @@ class SendEmailCommand extends Command {
15
15
  get name() {
16
16
  return "SendEmail";
17
17
  }
18
-
19
- get routingKey() {
20
- return "comm.email.send";
21
- }
22
18
  }
23
19
 
24
- module.exports = SendEmailCommand;
20
+ module.exports = SendEmail;
@@ -1,7 +1,7 @@
1
1
  const Command = require("./Command");
2
2
  const RequestError = require("../Errors/RequestError");
3
3
 
4
- class SendSMSCommand extends Command {
4
+ class SendSMS extends Command {
5
5
  constructor({ id, body, to, from, media, ...rest }) {
6
6
  if (!body && !media)
7
7
  throw new RequestError("sms body or media is required");
@@ -13,10 +13,6 @@ class SendSMSCommand extends Command {
13
13
  get name() {
14
14
  return "SendSMS";
15
15
  }
16
-
17
- get routingKey() {
18
- return "comm.sms.send";
19
- }
20
16
  }
21
17
 
22
- module.exports = SendSMSCommand;
18
+ module.exports = SendSMS;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetAlarmCommand extends Command {
3
+ class SetAlarm extends Command {
4
4
  constructor({ id, zones, areas, code, ...rest }) {
5
5
  super({ id, zones, areas, code, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetAlarmCommand extends Command {
8
8
  get name() {
9
9
  return "SetAlarm";
10
10
  }
11
-
12
- get routingKey() {
13
- return `alarm.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetAlarmCommand;
13
+ module.exports = SetAlarm;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetCourtesyCommand extends Command {
3
+ class SetCourtesy extends Command {
4
4
  constructor({ id, state, ...rest }) {
5
5
  super({ id, state, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetCourtesyCommand extends Command {
8
8
  get name() {
9
9
  return "SetCourtesy";
10
10
  }
11
-
12
- get routingKey() {
13
- return `courtesy.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetCourtesyCommand;
13
+ module.exports = SetCourtesy;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetDimmerCommand extends Command {
3
+ class SetDimmer extends Command {
4
4
  constructor({ id, level, ...rest }) {
5
5
  super({ id, level, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetDimmerCommand extends Command {
8
8
  get name() {
9
9
  return "SetDimmer";
10
10
  }
11
-
12
- get routingKey() {
13
- return `dimmer.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetDimmerCommand;
13
+ module.exports = SetDimmer;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetLockCommand extends Command {
3
+ class SetLock extends Command {
4
4
  constructor({ id, state, ...rest }) {
5
5
  super({ id, state, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetLockCommand extends Command {
8
8
  get name() {
9
9
  return "SetLock";
10
10
  }
11
-
12
- get routingKey() {
13
- return `lock.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetLockCommand;
13
+ module.exports = SetLock;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetMediaCommand extends Command {
3
+ class SetMedia extends Command {
4
4
  constructor({ id, command, ...rest }) {
5
5
  super({ id, command, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetMediaCommand extends Command {
8
8
  get name() {
9
9
  return "SetMedia";
10
10
  }
11
-
12
- get routingKey() {
13
- return `mediaSource.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetMediaCommand;
13
+ module.exports = SetMedia;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetSceneCommand extends Command {
3
+ class SetScene extends Command {
4
4
  constructor({ id, devices, ...rest }) {
5
5
  super({ id, devices, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetSceneCommand extends Command {
8
8
  get name() {
9
9
  return "SetScene";
10
10
  }
11
-
12
- get routingKey() {
13
- return `scene.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetSceneCommand;
13
+ module.exports = SetScene;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetSwitchCommand extends Command {
3
+ class SetSwitch extends Command {
4
4
  constructor({ id, state, ...rest }) {
5
5
  super({ id, state, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetSwitchCommand extends Command {
8
8
  get name() {
9
9
  return "SetSwitch";
10
10
  }
11
-
12
- get routingKey() {
13
- return `switch.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetSwitchCommand;
13
+ module.exports = SetSwitch;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetThermostatCommand extends Command {
3
+ class SetThermostat extends Command {
4
4
  constructor({ id, setpoints, hvacMode, fanMode, ...rest }) {
5
5
  super({ id, setpoints, hvacMode, fanMode, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetThermostatCommand extends Command {
8
8
  get name() {
9
9
  return "SetThermostat";
10
10
  }
11
-
12
- get routingKey() {
13
- return `thermostat.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetThermostatCommand;
13
+ module.exports = SetThermostat;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class SetWindowCoveringCommand extends Command {
3
+ class SetWindowCovering extends Command {
4
4
  constructor({ id, position, ...rest }) {
5
5
  super({ id, position, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class SetWindowCoveringCommand extends Command {
8
8
  get name() {
9
9
  return "SetWindowCovering";
10
10
  }
11
-
12
- get routingKey() {
13
- return `windowCovering.${this.data.id}.set`;
14
- }
15
11
  }
16
12
 
17
- module.exports = SetWindowCoveringCommand;
13
+ module.exports = SetWindowCovering;
@@ -1,7 +1,7 @@
1
1
  const Command = require("./Command");
2
2
  const RequestError = require("../Errors/RequestError");
3
3
 
4
- class UpdateReservationCommand extends Command {
4
+ class UpdateReservation extends Command {
5
5
  constructor({ id, ...rest }) {
6
6
  if (!id) throw new RequestError("document type is required");
7
7
  super({ id, ...rest });
@@ -10,10 +10,6 @@ class UpdateReservationCommand extends Command {
10
10
  get name() {
11
11
  return "UpdateReservation";
12
12
  }
13
-
14
- get routingKey() {
15
- return `reservation.${this.data.id}.update`;
16
- }
17
13
  }
18
14
 
19
- module.exports = UpdateReservationCommand;
15
+ module.exports = UpdateReservation;
@@ -1,7 +1,7 @@
1
1
  const Command = require("./Command");
2
2
  const RequestError = require("../Errors/RequestError");
3
3
 
4
- class UpdateUserCommand extends Command {
4
+ class UpdateUser extends Command {
5
5
  constructor({
6
6
  id,
7
7
  email,
@@ -32,10 +32,6 @@ class UpdateUserCommand extends Command {
32
32
  get name() {
33
33
  return "UpdateUser";
34
34
  }
35
-
36
- get routingKey() {
37
- return `user.${this.data.id}.update`;
38
- }
39
35
  }
40
36
 
41
- module.exports = UpdateUserCommand;
37
+ module.exports = UpdateUser;
@@ -1,6 +1,6 @@
1
1
  const Command = require("./Command");
2
2
 
3
- class UploadImageCommand extends Command {
3
+ class UploadImage extends Command {
4
4
  constructor({ id, url, file, ...rest }) {
5
5
  super({ id, url, file, ...rest });
6
6
  }
@@ -8,10 +8,6 @@ class UploadImageCommand extends Command {
8
8
  get name() {
9
9
  return "UploadImage";
10
10
  }
11
-
12
- get routingKey() {
13
- return `image.${this.data.id}.upload`;
14
- }
15
11
  }
16
12
 
17
- module.exports = UploadImageCommand;
13
+ module.exports = UploadImage;