@lumiastream/tapo-cove 3.0.15 → 3.0.16

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/index.d.ts CHANGED
@@ -96,6 +96,7 @@ declare class TapoApi {
96
96
  };
97
97
  state: LightState;
98
98
  fetchConfig?: {
99
+ useAxios: boolean;
99
100
  shouldWait: boolean;
100
101
  };
101
102
  }) => Promise<any>;
package/dist/index.js CHANGED
@@ -386,6 +386,7 @@ var TapoApi = class {
386
386
  });
387
387
  // Change state using lightstate
388
388
  this.sendState = (config) => {
389
+ var _a;
389
390
  const deviceKey = this._devices.get(config.device.id);
390
391
  let shouldWait = false;
391
392
  if (config.fetchConfig && config.fetchConfig.shouldWait) {
@@ -407,17 +408,30 @@ var TapoApi = class {
407
408
  request: encryptedRequest
408
409
  }
409
410
  };
410
- return (0, import_fetch_cove.fetchWork)({
411
- url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
412
- data: {
413
- method: "POST",
414
- body: securePassthroughRequest,
415
- headers: {
416
- Cookie: deviceKey.sessionCookie
411
+ if ((_a = config.fetchConfig) == null ? void 0 : _a.useAxios) {
412
+ return (0, import_axios2.default)({
413
+ url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
414
+ data: {
415
+ method: "POST",
416
+ body: securePassthroughRequest,
417
+ headers: {
418
+ Cookie: deviceKey.sessionCookie
419
+ }
417
420
  }
418
- },
419
- shouldWait
420
- });
421
+ });
422
+ } else {
423
+ return (0, import_fetch_cove.fetchWork)({
424
+ url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
425
+ data: {
426
+ method: "POST",
427
+ body: securePassthroughRequest,
428
+ headers: {
429
+ Cookie: deviceKey.sessionCookie
430
+ }
431
+ },
432
+ shouldWait
433
+ });
434
+ }
421
435
  };
422
436
  this.sendPower = (config) => {
423
437
  this.sendState({ device: config.device, state: new LightState({ on: config.power }) });
package/dist/index.mjs CHANGED
@@ -354,6 +354,7 @@ var TapoApi = class {
354
354
  });
355
355
  // Change state using lightstate
356
356
  this.sendState = (config) => {
357
+ var _a;
357
358
  const deviceKey = this._devices.get(config.device.id);
358
359
  let shouldWait = false;
359
360
  if (config.fetchConfig && config.fetchConfig.shouldWait) {
@@ -375,17 +376,30 @@ var TapoApi = class {
375
376
  request: encryptedRequest
376
377
  }
377
378
  };
378
- return fetchWork({
379
- url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
380
- data: {
381
- method: "POST",
382
- body: securePassthroughRequest,
383
- headers: {
384
- Cookie: deviceKey.sessionCookie
379
+ if ((_a = config.fetchConfig) == null ? void 0 : _a.useAxios) {
380
+ return axios2({
381
+ url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
382
+ data: {
383
+ method: "POST",
384
+ body: securePassthroughRequest,
385
+ headers: {
386
+ Cookie: deviceKey.sessionCookie
387
+ }
385
388
  }
386
- },
387
- shouldWait
388
- });
389
+ });
390
+ } else {
391
+ return fetchWork({
392
+ url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
393
+ data: {
394
+ method: "POST",
395
+ body: securePassthroughRequest,
396
+ headers: {
397
+ Cookie: deviceKey.sessionCookie
398
+ }
399
+ },
400
+ shouldWait
401
+ });
402
+ }
389
403
  };
390
404
  this.sendPower = (config) => {
391
405
  this.sendState({ device: config.device, state: new LightState({ on: config.power }) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/tapo-cove",
3
- "version": "3.0.15",
3
+ "version": "3.0.16",
4
4
  "private": false,
5
5
  "license": "GPL",
6
6
  "main": "dist/index.js",
@@ -23,5 +23,5 @@
23
23
  "tsup": "*",
24
24
  "typescript": "*"
25
25
  },
26
- "gitHead": "cb9dc8d025597cc9a92ae7b3b0cba1eb73b4d71b"
26
+ "gitHead": "eca53cb985b927ddc7e3c886fd2be02e0f2b4bdb"
27
27
  }