@como/como-client 0.7.81 → 0.7.83
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/como.js +5 -42
- package/lib/utils/comoExternalUrlTranslator.js +1 -1
- package/package.json +1 -1
- package/src/como.js +4 -11
package/lib/como.js
CHANGED
|
@@ -174,7 +174,8 @@ var Como = function () {
|
|
|
174
174
|
installationId: installationId,
|
|
175
175
|
locationId: locationId,
|
|
176
176
|
source: source,
|
|
177
|
-
env_params: (0, _extends3.default)({}, INITIAL_COMO_DATA.env[environmentId])
|
|
177
|
+
env_params: (0, _extends3.default)({}, INITIAL_COMO_DATA.env[environmentId]),
|
|
178
|
+
tempTokenData: {}
|
|
178
179
|
});
|
|
179
180
|
|
|
180
181
|
updateCredentials = function updateCredentials(creds) {
|
|
@@ -407,7 +408,9 @@ var Como = function () {
|
|
|
407
408
|
case 11:
|
|
408
409
|
translatedData = _context3.sent;
|
|
409
410
|
|
|
410
|
-
|
|
411
|
+
if (translatedData.tempTokenData.temporaryToken) {
|
|
412
|
+
this.comoData.tempTokenData[translatedData.tempTokenData.temporaryToken] = translatedData.tempTokenData.expirationDate;
|
|
413
|
+
}
|
|
411
414
|
return _context3.abrupt('return', translatedData);
|
|
412
415
|
|
|
413
416
|
case 14:
|
|
@@ -2381,46 +2384,6 @@ var Como = function () {
|
|
|
2381
2384
|
|
|
2382
2385
|
return api.getAllTranslations(locationId);
|
|
2383
2386
|
}
|
|
2384
|
-
|
|
2385
|
-
/**
|
|
2386
|
-
* generate temporary token
|
|
2387
|
-
* @param {Number} timeToLive - The time in seconds till the expiration
|
|
2388
|
-
*/
|
|
2389
|
-
|
|
2390
|
-
}, {
|
|
2391
|
-
key: 'generateTemporaryTokenWithExpiryDate',
|
|
2392
|
-
value: function () {
|
|
2393
|
-
var _ref44 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee43(timeToLive) {
|
|
2394
|
-
var _comoData45, api, locationId, token, env_params, _ref45, ExpirationDate, TemporaryToken;
|
|
2395
|
-
|
|
2396
|
-
return _regenerator2.default.wrap(function _callee43$(_context43) {
|
|
2397
|
-
while (1) {
|
|
2398
|
-
switch (_context43.prev = _context43.next) {
|
|
2399
|
-
case 0:
|
|
2400
|
-
_comoData45 = this.comoData, api = _comoData45.api, locationId = _comoData45.locationId, token = _comoData45.token, env_params = _comoData45.env_params;
|
|
2401
|
-
_context43.next = 3;
|
|
2402
|
-
return api.generateTemporaryToken(env_params.services_root, locationId, token, timeToLive);
|
|
2403
|
-
|
|
2404
|
-
case 3:
|
|
2405
|
-
_ref45 = _context43.sent;
|
|
2406
|
-
ExpirationDate = _ref45.ExpirationDate;
|
|
2407
|
-
TemporaryToken = _ref45.TemporaryToken;
|
|
2408
|
-
return _context43.abrupt('return', { ExpirationDate: ExpirationDate, TemporaryToken: TemporaryToken });
|
|
2409
|
-
|
|
2410
|
-
case 7:
|
|
2411
|
-
case 'end':
|
|
2412
|
-
return _context43.stop();
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
}, _callee43, this);
|
|
2416
|
-
}));
|
|
2417
|
-
|
|
2418
|
-
function generateTemporaryTokenWithExpiryDate(_x69) {
|
|
2419
|
-
return _ref44.apply(this, arguments);
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
return generateTemporaryTokenWithExpiryDate;
|
|
2423
|
-
}()
|
|
2424
2387
|
}]);
|
|
2425
2388
|
return Como;
|
|
2426
2389
|
}();
|
|
@@ -134,7 +134,7 @@ var translateElements = function () {
|
|
|
134
134
|
tempToken = _context2.sent;
|
|
135
135
|
|
|
136
136
|
item.replaceWith = tempToken && tempToken.TemporaryToken || '';
|
|
137
|
-
tempTokenData = tempToken;
|
|
137
|
+
tempTokenData = { temporaryToken: tempToken.TemporaryToken, expirationDate: tempToken.ExpirationDate };
|
|
138
138
|
return _context2.abrupt('break', 53);
|
|
139
139
|
|
|
140
140
|
case 17:
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -84,6 +84,7 @@ class Como {
|
|
|
84
84
|
env_params: {
|
|
85
85
|
...INITIAL_COMO_DATA.env[environmentId],
|
|
86
86
|
},
|
|
87
|
+
tempTokenData: {},
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
const updateCredentials = (creds, isNew = false) => {
|
|
@@ -201,7 +202,9 @@ class Como {
|
|
|
201
202
|
locationId, token, membership, locationData, assets, gpsData, assetID, accessibilityData,
|
|
202
203
|
};
|
|
203
204
|
const translatedData = await comoExternalUrlTranslator.translateUrl(externalUrl, apiObjects, dataToUse);
|
|
204
|
-
|
|
205
|
+
if (translatedData.tempTokenData.temporaryToken) {
|
|
206
|
+
this.comoData.tempTokenData[translatedData.tempTokenData.temporaryToken] = translatedData.tempTokenData.expirationDate;
|
|
207
|
+
}
|
|
205
208
|
return translatedData;
|
|
206
209
|
}
|
|
207
210
|
|
|
@@ -988,16 +991,6 @@ class Como {
|
|
|
988
991
|
const { api, locationId } = this.comoData;
|
|
989
992
|
return api.getAllTranslations(locationId);
|
|
990
993
|
}
|
|
991
|
-
|
|
992
|
-
/**
|
|
993
|
-
* generate temporary token
|
|
994
|
-
* @param {Number} timeToLive - The time in seconds till the expiration
|
|
995
|
-
*/
|
|
996
|
-
async generateTemporaryTokenWithExpiryDate(timeToLive) {
|
|
997
|
-
const { api, locationId, token, env_params } = this.comoData;
|
|
998
|
-
const { ExpirationDate, TemporaryToken } = await api.generateTemporaryToken(env_params.services_root, locationId, token, timeToLive);
|
|
999
|
-
return { ExpirationDate, TemporaryToken };
|
|
1000
|
-
}
|
|
1001
994
|
}
|
|
1002
995
|
|
|
1003
996
|
module.exports = Como;
|