tsvesync 1.3.0 → 1.3.1

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.
@@ -403,11 +403,10 @@ class Helpers {
403
403
  // Check for token expiration or auth invalidation
404
404
  const httpStatus = error.response.status;
405
405
  const msg = responseData === null || responseData === void 0 ? void 0 : responseData.msg;
406
- if ((responseData === null || responseData === void 0 ? void 0 : responseData.code) === 4001004 ||
407
- msg === 'token expired' ||
408
- httpStatus === 401 ||
406
+ if (httpStatus === 401 ||
409
407
  httpStatus === 419 ||
410
- (typeof msg === 'string' && /token|login/i.test(msg))) {
408
+ (responseData === null || responseData === void 0 ? void 0 : responseData.code) === 4001004 ||
409
+ (typeof msg === 'string' && /token\s*expired/i.test(msg))) {
411
410
  logger_1.logger.debug('Token expired, attempting to re-login...');
412
411
  // Re-login
413
412
  if (await manager.login()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A TypeScript library for interacting with VeSync smart home devices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -495,11 +495,10 @@ export class Helpers {
495
495
  const httpStatus = error.response.status;
496
496
  const msg: string | undefined = responseData?.msg;
497
497
  if (
498
- responseData?.code === 4001004 ||
499
- msg === 'token expired' ||
500
498
  httpStatus === 401 ||
501
499
  httpStatus === 419 ||
502
- (typeof msg === 'string' && /token|login/i.test(msg))
500
+ responseData?.code === 4001004 ||
501
+ (typeof msg === 'string' && /token\s*expired/i.test(msg))
503
502
  ) {
504
503
  logger.debug('Token expired, attempting to re-login...');
505
504