@vendit-dev/thirdparty-adapters 0.3.23 → 0.3.25

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;
@@ -136,7 +136,8 @@ var SmartAccessAdapter = /** @class */ (function () {
136
136
  console.log('AUTH 0', existingAuth);
137
137
  if (existingAuth) {
138
138
  if (existingAuth === 'NOT_FOUND') {
139
- throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
139
+ // throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
140
+ return [2 /*return*/, false];
140
141
  }
141
142
  console.log('AUTH 1', existingAuth);
142
143
  return [2 /*return*/, this.parseJSONSafe(existingAuth)];
@@ -160,11 +161,12 @@ var SmartAccessAdapter = /** @class */ (function () {
160
161
  case 5:
161
162
  newAuth = _b.sent();
162
163
  console.log('AUTH 4', newAuth);
163
- if (!!newAuth) return [3 /*break*/, 7];
164
+ if (!(!newAuth || !(newAuth === null || newAuth === void 0 ? void 0 : newAuth.credential))) return [3 /*break*/, 7];
164
165
  return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
165
166
  case 6:
166
167
  _b.sent();
167
- throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
168
+ // throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
169
+ return [2 /*return*/, false];
168
170
  case 7:
169
171
  console.log('AUTH 5', existingAuth);
170
172
  parsedCredential = this.parseJSONSafe(newAuth.credential);
@@ -193,6 +195,8 @@ var SmartAccessAdapter = /** @class */ (function () {
193
195
  case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
194
196
  case 1:
195
197
  authInfo = _a.sent();
198
+ if (!(authInfo === null || authInfo === void 0 ? void 0 : authInfo.accessToken))
199
+ throw new Error('THIRDPARTH_AUTH_NOT_FOUND');
196
200
  return [2 /*return*/, authInfo.accessToken];
197
201
  }
198
202
  });
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.25",
4
4
  "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {