gd-sprest 9.0.7 → 9.0.8
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/@types/lib/contextInfo.d.ts +5 -0
- package/build/lib/contextInfo.js +11 -2
- package/build/rest.js +1 -1
- package/dist/gd-sprest.d.ts +5 -0
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +1 -1
|
@@ -483,6 +483,11 @@ export interface IContextInformation {
|
|
|
483
483
|
*/
|
|
484
484
|
getWeb(url: string): IBaseExecution<{ GetContextWebInformation: ContextWebInformation }>;
|
|
485
485
|
|
|
486
|
+
/**
|
|
487
|
+
* Value in minutes, to refresh the token prior to it expiring
|
|
488
|
+
*/
|
|
489
|
+
refreshToken: number;
|
|
490
|
+
|
|
486
491
|
/**
|
|
487
492
|
* Sets the page context information for modern pages.
|
|
488
493
|
* @param spfxPageContext - The page context information variable from a SPFx project.
|
package/build/lib/contextInfo.js
CHANGED
|
@@ -778,6 +778,12 @@ var _ContextInfo = /** @class */ (function () {
|
|
|
778
778
|
});
|
|
779
779
|
}, 500);
|
|
780
780
|
};
|
|
781
|
+
Object.defineProperty(_ContextInfo, "refreshToken", {
|
|
782
|
+
get: function () { return this._refreshToken; },
|
|
783
|
+
set: function (value) { this._refreshToken = value; },
|
|
784
|
+
enumerable: false,
|
|
785
|
+
configurable: true
|
|
786
|
+
});
|
|
781
787
|
// Method to validate the token
|
|
782
788
|
_ContextInfo.validateToken = function (digestValue) {
|
|
783
789
|
if (digestValue === void 0) { digestValue = this._contextInfo.formDigestValue; }
|
|
@@ -789,8 +795,8 @@ var _ContextInfo = /** @class */ (function () {
|
|
|
789
795
|
var dtToken = new Date(digestValue.split(',')[1]);
|
|
790
796
|
var timeout = this.formDigestTimeoutSeconds || 0;
|
|
791
797
|
// Return true if it's still valid
|
|
792
|
-
// Time the token was granted + Timeout in seconds - 1 min (60000)
|
|
793
|
-
return Date.now() < dtToken.getTime() + timeout * 1000 - 60000;
|
|
798
|
+
// Time the token was granted + Timeout in seconds - (1 min (60000) * refresh token value)
|
|
799
|
+
return Date.now() < dtToken.getTime() + timeout * 1000 - (60000 * this.refreshToken);
|
|
794
800
|
};
|
|
795
801
|
var _a;
|
|
796
802
|
_a = _ContextInfo;
|
|
@@ -804,6 +810,9 @@ var _ContextInfo = /** @class */ (function () {
|
|
|
804
810
|
_a.enableRefreshToken();
|
|
805
811
|
};
|
|
806
812
|
_ContextInfo._loopId = null;
|
|
813
|
+
// Value in minutes to refresh the token
|
|
814
|
+
// Default is 5 minutes prior to it expiring
|
|
815
|
+
_ContextInfo._refreshToken = 5;
|
|
807
816
|
return _ContextInfo;
|
|
808
817
|
}());
|
|
809
818
|
exports.ContextInfo = _ContextInfo;
|
package/build/rest.js
CHANGED
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -978,6 +978,11 @@ declare module 'gd-sprest/lib/contextInfo' {
|
|
|
978
978
|
*/
|
|
979
979
|
getWeb(url: string): IBaseExecution<{ GetContextWebInformation: ContextWebInformation }>;
|
|
980
980
|
|
|
981
|
+
/**
|
|
982
|
+
* Value in minutes, to refresh the token prior to it expiring
|
|
983
|
+
*/
|
|
984
|
+
refreshToken: number;
|
|
985
|
+
|
|
981
986
|
/**
|
|
982
987
|
* Sets the page context information for modern pages.
|
|
983
988
|
* @param spfxPageContext - The page context information variable from a SPFx project.
|