@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.
@@ -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
 
@@ -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
  });
@@ -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
  });
@@ -1139,7 +1148,7 @@ 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: {
@@ -1183,6 +1192,7 @@ var require_identification2 = __commonJS({
1183
1192
  return new Date(this.expirationDate) < /* @__PURE__ */ new Date();
1184
1193
  }
1185
1194
  };
1195
+ __name(Identification2, "Identification");
1186
1196
  Object.defineProperty(Identification2.prototype, "schema", {
1187
1197
  value: schema
1188
1198
  });
@@ -1453,6 +1463,7 @@ var require_user2 = __commonJS({
1453
1463
  return await nanoid(len);
1454
1464
  }
1455
1465
  };
1466
+ __name(User2, "User");
1456
1467
  Object.defineProperty(User2.prototype, "schema", {
1457
1468
  value: schema
1458
1469
  });
@@ -1529,6 +1540,7 @@ var require_courtesy2 = __commonJS({
1529
1540
  super(data);
1530
1541
  }
1531
1542
  };
1543
+ __name(Courtesy2, "Courtesy");
1532
1544
  Object.defineProperty(Courtesy2.prototype, "schema", {
1533
1545
  value: schema
1534
1546
  });
@@ -1607,6 +1619,7 @@ var require_camera2 = __commonJS({
1607
1619
  super(data);
1608
1620
  }
1609
1621
  };
1622
+ __name(Camera2, "Camera");
1610
1623
  Object.defineProperty(Camera2.prototype, "schema", {
1611
1624
  value: schema
1612
1625
  });
@@ -1667,6 +1680,7 @@ var require_motionSensor2 = __commonJS({
1667
1680
  super(data);
1668
1681
  }
1669
1682
  };
1683
+ __name(MotionSensor2, "MotionSensor");
1670
1684
  Object.defineProperty(MotionSensor2.prototype, "schema", {
1671
1685
  value: schema
1672
1686
  });
@@ -1852,6 +1866,7 @@ var require_mediaSource2 = __commonJS({
1852
1866
  super(data);
1853
1867
  }
1854
1868
  };
1869
+ __name(MediaSource2, "MediaSource");
1855
1870
  Object.defineProperty(MediaSource2.prototype, "schema", {
1856
1871
  value: schema
1857
1872
  });
@@ -2141,6 +2156,7 @@ var require_scene2 = __commonJS({
2141
2156
  super(data);
2142
2157
  }
2143
2158
  };
2159
+ __name(Scene2, "Scene");
2144
2160
  Object.defineProperty(Scene2.prototype, "schema", {
2145
2161
  value: schema
2146
2162
  });
@@ -2248,6 +2264,7 @@ var require_room2 = __commonJS({
2248
2264
  return diff < 60 * 60 * 1e3;
2249
2265
  }
2250
2266
  };
2267
+ __name(Room2, "Room");
2251
2268
  Object.defineProperty(Room2.prototype, "schema", {
2252
2269
  value: schema
2253
2270
  });
@@ -2330,6 +2347,7 @@ var require_room2 = __commonJS({
2330
2347
  });
2331
2348
  return roomData;
2332
2349
  }
2350
+ __name(mapRoomData, "mapRoomData");
2333
2351
  module2.exports = Room2;
2334
2352
  }
2335
2353
  });
@@ -2467,6 +2485,7 @@ var require_reservation2 = __commonJS({
2467
2485
  });
2468
2486
  }
2469
2487
  };
2488
+ __name(Reservation2, "Reservation");
2470
2489
  Object.defineProperty(Reservation2.prototype, "schema", {
2471
2490
  value: schema
2472
2491
  });
@@ -2525,6 +2544,7 @@ var require_application2 = __commonJS({
2525
2544
  super(data);
2526
2545
  }
2527
2546
  };
2547
+ __name(Application2, "Application");
2528
2548
  Object.defineProperty(Application2.prototype, "schema", {
2529
2549
  value: schema
2530
2550
  });
@@ -2714,6 +2734,7 @@ var require_space2 = __commonJS({
2714
2734
  return this.rooms.some((room) => room.occupied);
2715
2735
  }
2716
2736
  };
2737
+ __name(Space2, "Space");
2717
2738
  Object.defineProperty(Space2.prototype, "schema", {
2718
2739
  value: schema
2719
2740
  });
@@ -2739,6 +2760,7 @@ var require_space2 = __commonJS({
2739
2760
  }
2740
2761
  return spaceData;
2741
2762
  }
2763
+ __name(mapSpaceData, "mapSpaceData");
2742
2764
  module2.exports = Space2;
2743
2765
  }
2744
2766
  });
@@ -2850,6 +2872,7 @@ var require_ticket2 = __commonJS({
2850
2872
  return nanoid(len);
2851
2873
  }
2852
2874
  };
2875
+ __name(Ticket2, "Ticket");
2853
2876
  Object.defineProperty(Ticket2.prototype, "schema", {
2854
2877
  value: schema
2855
2878
  });
@@ -2958,6 +2981,7 @@ var require_gateway2 = __commonJS({
2958
2981
  super(data);
2959
2982
  }
2960
2983
  };
2984
+ __name(Gateway2, "Gateway");
2961
2985
  Object.defineProperty(Gateway2.prototype, "schema", {
2962
2986
  value: schema
2963
2987
  });
@@ -3028,6 +3052,7 @@ var require_product2 = __commonJS({
3028
3052
  super(data);
3029
3053
  }
3030
3054
  };
3055
+ __name(Product2, "Product");
3031
3056
  Object.defineProperty(Product2.prototype, "schema", {
3032
3057
  value: schema
3033
3058
  });
@@ -3105,6 +3130,7 @@ var require_discoveredDevice2 = __commonJS({
3105
3130
  super(data);
3106
3131
  }
3107
3132
  };
3133
+ __name(DiscoveredDevice2, "DiscoveredDevice");
3108
3134
  Object.defineProperty(DiscoveredDevice2.prototype, "schema", {
3109
3135
  value: schema
3110
3136
  });
@@ -3167,6 +3193,7 @@ var require_credential2 = __commonJS({
3167
3193
  super(data);
3168
3194
  }
3169
3195
  };
3196
+ __name(Credential2, "Credential");
3170
3197
  Object.defineProperty(Credential2.prototype, "schema", {
3171
3198
  value: schema
3172
3199
  });
@@ -3231,6 +3258,7 @@ var require_shortLink2 = __commonJS({
3231
3258
  super(data);
3232
3259
  }
3233
3260
  };
3261
+ __name(ShortLink2, "ShortLink");
3234
3262
  Object.defineProperty(ShortLink2.prototype, "schema", {
3235
3263
  value: schema
3236
3264
  });
@@ -3297,6 +3325,7 @@ var require_customer2 = __commonJS({
3297
3325
  super(data);
3298
3326
  }
3299
3327
  };
3328
+ __name(Customer, "Customer");
3300
3329
  Object.defineProperty(Customer.prototype, "schema", {
3301
3330
  value: schema
3302
3331
  });
@@ -3510,6 +3539,7 @@ var require_property2 = __commonJS({
3510
3539
  super(data);
3511
3540
  }
3512
3541
  };
3542
+ __name(Property, "Property");
3513
3543
  Object.defineProperty(Property.prototype, "schema", {
3514
3544
  value: schema
3515
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.http(originalReq);
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
  });
package/dist/cjs/utils.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
  };
@@ -9,6 +11,7 @@ var require_getFormalDeviceType = __commonJS({
9
11
  function getFormalDeviceType2(deviceType) {
10
12
  return deviceType.charAt(0).toUpperCase() + deviceType.slice(1);
11
13
  }
14
+ __name(getFormalDeviceType2, "getFormalDeviceType");
12
15
  module2.exports = getFormalDeviceType2;
13
16
  }
14
17
  });
@@ -40,6 +43,7 @@ var require_getDeviceTypes = __commonJS({
40
43
  function getDeviceTypes2() {
41
44
  return deviceTypes;
42
45
  }
46
+ __name(getDeviceTypes2, "getDeviceTypes");
43
47
  module2.exports = getDeviceTypes2;
44
48
  }
45
49
  });
@@ -225,12 +229,12 @@ var require_schema = __commonJS({
225
229
  ajv.addSchema(commonDefs);
226
230
  ajv.addSchema(deviceDefs);
227
231
  module2.exports = {
228
- add: function add(schema2) {
232
+ add: /* @__PURE__ */ __name(function add(schema2) {
229
233
  ajv.addSchema(schema2);
230
- },
231
- compile: function compile(schema2) {
234
+ }, "add"),
235
+ compile: /* @__PURE__ */ __name(function compile(schema2) {
232
236
  return ajv.compile(schema2);
233
- }
237
+ }, "compile")
234
238
  };
235
239
  }
236
240
  });