@vendit-dev/thirdparty-adapters 0.3.20 → 0.3.22

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.
@@ -137,6 +137,7 @@ var SmartAccessAdapter = /** @class */ (function () {
137
137
  if (existingAuth === 'NOT_FOUND') {
138
138
  throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
139
139
  }
140
+ console.log('AUTH 1', existingAuth);
140
141
  return [2 /*return*/, this.parseJSONSafe(existingAuth)];
141
142
  }
142
143
  lockId = "SMARTACCESS-HKEY|" + accommodationId;
@@ -150,6 +151,7 @@ var SmartAccessAdapter = /** @class */ (function () {
150
151
  case 4:
151
152
  _b.trys.push([4, 9, 10, 12]);
152
153
  if (existingAuth) {
154
+ console.log('AUTH 2', existingAuth);
153
155
  return [2 /*return*/, this.parseJSONSafe(existingAuth)];
154
156
  }
155
157
  return [4 /*yield*/, this.authenticator.getThirdPartyCredential({ accommodationId: accommodationId, provider: this.PROVIDER_KEY })];
@@ -161,7 +163,8 @@ var SmartAccessAdapter = /** @class */ (function () {
161
163
  _b.sent();
162
164
  throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
163
165
  case 7:
164
- parsedCredential = JSON.parse(newAuth.credential);
166
+ console.log('AUTH 3', existingAuth);
167
+ parsedCredential = this.parseJSONSafe(newAuth.credential);
165
168
  return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), newAuth.credential, 'EX', 60 * 5)];
166
169
  case 8:
167
170
  _b.sent();
@@ -168,7 +168,7 @@ var ThemrIoTAdapter = /** @class */ (function () {
168
168
  this.doorlockList = function (_a) {
169
169
  var accommodationId = _a.accommodationId, _b = _a.roomAlias, roomAlias = _b === void 0 ? '' : _b;
170
170
  return __awaiter(_this, void 0, void 0, function () {
171
- var authInfo, credential, data, doorLockList, foundDoorLock;
171
+ var authInfo, credential, data, doorLockList;
172
172
  return __generator(this, function (_c) {
173
173
  switch (_c.label) {
174
174
  case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
@@ -182,10 +182,7 @@ var ThemrIoTAdapter = /** @class */ (function () {
182
182
  case 2:
183
183
  data = _c.sent();
184
184
  doorLockList = (data === null || data === void 0 ? void 0 : data.list) || [];
185
- foundDoorLock = doorLockList.filter(function (doorlock) { return doorlock.roomAlias === roomAlias; });
186
- console.log('doorLockList', doorLockList);
187
- console.log('foundDoorLock', foundDoorLock);
188
- if (data.code !== 0 || !doorLockList.length || !foundDoorLock.length) {
185
+ if (data.code !== 0 || !doorLockList.length) {
189
186
  throw new Error('ERR_DOOR_LOCK_LIST_NOT_LOAD');
190
187
  }
191
188
  return [2 /*return*/, data];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendit-dev/thirdparty-adapters",
3
- "version": "0.3.20",
3
+ "version": "0.3.22",
4
4
  "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {