@vendit-dev/thirdparty-adapters 0.3.23 → 0.3.24

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.
@@ -51,7 +51,7 @@ export default class SmartAccessAdapter {
51
51
  }) => Promise<boolean>;
52
52
  getAccommodationAuthInfo: ({ accommodationId }: {
53
53
  accommodationId: string;
54
- }) => Promise<OAuthTokenResponse>;
54
+ }) => Promise<OAuthTokenResponse | boolean>;
55
55
  getAccommodationAccessToken: (accommodationId: string) => Promise<string>;
56
56
  callSmartAccessApi: ({ route, accommodationId, params, method, headers, }: {
57
57
  route: string;
@@ -160,15 +160,19 @@ var SmartAccessAdapter = /** @class */ (function () {
160
160
  case 5:
161
161
  newAuth = _b.sent();
162
162
  console.log('AUTH 4', newAuth);
163
- if (!!newAuth) return [3 /*break*/, 7];
163
+ if (!(!newAuth || !(newAuth === null || newAuth === void 0 ? void 0 : newAuth.credential))) return [3 /*break*/, 7];
164
164
  return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
165
165
  case 6:
166
166
  _b.sent();
167
167
  throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
168
168
  case 7:
169
169
  console.log('AUTH 5', existingAuth);
170
+ if (!existingAuth && !newAuth.credential && !newAuth.scope) {
171
+ console.log('AUTH 6', existingAuth);
172
+ return [2 /*return*/, false];
173
+ }
170
174
  parsedCredential = this.parseJSONSafe(newAuth.credential);
171
- console.log('AUTH 6', parsedCredential);
175
+ console.log('AUTH 7', parsedCredential);
172
176
  return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), newAuth.credential, 'EX', 60 * 5)];
173
177
  case 8:
174
178
  _b.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendit-dev/thirdparty-adapters",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {