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