@vendit-dev/thirdparty-adapters 0.3.14 → 0.3.15
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/lib/adapters/themrIoT.js +0 -11
- package/package.json +1 -1
package/lib/adapters/themrIoT.js
CHANGED
|
@@ -114,42 +114,31 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
114
114
|
return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
|
|
115
115
|
case 2:
|
|
116
116
|
lockHash = _b.sent();
|
|
117
|
-
console.log('THIRD', existingAuth);
|
|
118
117
|
return [4 /*yield*/, this.redis.get(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }))];
|
|
119
118
|
case 3:
|
|
120
119
|
existingAuth = _b.sent();
|
|
121
|
-
console.log('FOURTH', existingAuth);
|
|
122
120
|
_b.label = 4;
|
|
123
121
|
case 4:
|
|
124
122
|
_b.trys.push([4, 9, 10, 12]);
|
|
125
123
|
if (existingAuth) {
|
|
126
|
-
if (existingAuth === 'NOT_FOUND') {
|
|
127
|
-
throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
128
|
-
}
|
|
129
124
|
return [2 /*return*/, JSON.parse(existingAuth)];
|
|
130
125
|
}
|
|
131
|
-
console.log('FIFTH', existingAuth);
|
|
132
|
-
console.log('PROVIDER_KEY', this.PROVIDER_KEY);
|
|
133
126
|
return [4 /*yield*/, this.authenticator.getThirdPartyCredential({
|
|
134
127
|
accommodationId: accommodationId,
|
|
135
128
|
provider: this.PROVIDER_KEY,
|
|
136
129
|
})];
|
|
137
130
|
case 5:
|
|
138
131
|
newAuth = _b.sent();
|
|
139
|
-
console.log('SIXTH', newAuth);
|
|
140
132
|
if (!!newAuth) return [3 /*break*/, 7];
|
|
141
133
|
return [4 /*yield*/, this.redis.set(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 10)];
|
|
142
134
|
case 6:
|
|
143
135
|
_b.sent();
|
|
144
136
|
throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
145
137
|
case 7:
|
|
146
|
-
console.log('SEVENTH', newAuth);
|
|
147
138
|
newAuth.credential = JSON.parse(newAuth.credential);
|
|
148
|
-
console.log('EIGHTH', newAuth);
|
|
149
139
|
return [4 /*yield*/, this.redis.set(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }), JSON.stringify(newAuth), 'EX', 60 * 10)];
|
|
150
140
|
case 8:
|
|
151
141
|
_b.sent();
|
|
152
|
-
console.log('NINETH', newAuth);
|
|
153
142
|
return [2 /*return*/, newAuth];
|
|
154
143
|
case 9:
|
|
155
144
|
err_1 = _b.sent();
|