@vendit-dev/thirdparty-adapters 0.3.27 → 0.3.29
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 +9 -6
- package/package.json +1 -1
package/lib/adapters/themrIoT.js
CHANGED
|
@@ -108,12 +108,13 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
108
108
|
this.getAccommodationAuthInfo = function (_a) {
|
|
109
109
|
var accommodationId = _a.accommodationId;
|
|
110
110
|
return __awaiter(_this, void 0, void 0, function () {
|
|
111
|
-
var existingAuth, lockId, lockHash, newAuth, err_1;
|
|
111
|
+
var existingAuth, lockId, lockHash, newAuth, parsedCredential, err_1;
|
|
112
112
|
return __generator(this, function (_b) {
|
|
113
113
|
switch (_b.label) {
|
|
114
114
|
case 0: return [4 /*yield*/, this.redis.get(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }))];
|
|
115
115
|
case 1:
|
|
116
116
|
existingAuth = _b.sent();
|
|
117
|
+
console.log('AUTH 1', existingAuth);
|
|
117
118
|
if (existingAuth) {
|
|
118
119
|
if (existingAuth === 'NOT_FOUND') {
|
|
119
120
|
return [2 /*return*/, false];
|
|
@@ -127,10 +128,12 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
127
128
|
return [4 /*yield*/, this.redis.get(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }))];
|
|
128
129
|
case 3:
|
|
129
130
|
existingAuth = _b.sent();
|
|
131
|
+
console.log('AUTH 2', existingAuth);
|
|
130
132
|
_b.label = 4;
|
|
131
133
|
case 4:
|
|
132
134
|
_b.trys.push([4, 9, 10, 12]);
|
|
133
135
|
if (existingAuth) {
|
|
136
|
+
console.log('AUTH 3', this.parseJSONSafe(existingAuth));
|
|
134
137
|
return [2 /*return*/, this.parseJSONSafe(existingAuth)];
|
|
135
138
|
}
|
|
136
139
|
return [4 /*yield*/, this.authenticator.getThirdPartyCredential({
|
|
@@ -139,19 +142,19 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
139
142
|
})];
|
|
140
143
|
case 5:
|
|
141
144
|
newAuth = _b.sent();
|
|
145
|
+
console.log('AUTH 4', newAuth);
|
|
142
146
|
if (!(!newAuth || !(newAuth === null || newAuth === void 0 ? void 0 : newAuth.credential))) return [3 /*break*/, 7];
|
|
143
147
|
return [4 /*yield*/, this.redis.set(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 10)];
|
|
144
148
|
case 6:
|
|
145
149
|
_b.sent();
|
|
146
150
|
return [2 /*return*/, false];
|
|
147
151
|
case 7:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return [4 /*yield*/, this.redis.set(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }),
|
|
152
|
+
parsedCredential = this.parseJSONSafe(newAuth.credential);
|
|
153
|
+
console.log('AUTH 4', parsedCredential);
|
|
154
|
+
return [4 /*yield*/, this.redis.set(ThemrIoTAdapter.indexAccommodation({ accommodationId: accommodationId }), newAuth.credential, 'EX', 60 * 10)];
|
|
151
155
|
case 8:
|
|
152
156
|
_b.sent();
|
|
153
|
-
|
|
154
|
-
return [2 /*return*/, newAuth];
|
|
157
|
+
return [2 /*return*/, parsedCredential];
|
|
155
158
|
case 9:
|
|
156
159
|
err_1 = _b.sent();
|
|
157
160
|
console.log(err_1);
|