@twurple/auth
Advanced tools
Comparing version 5.0.0-pre.9 to 5.0.0-pre.10
@@ -30,3 +30,3 @@ import type { AccessToken } from '../AccessToken'; | ||
*/ | ||
getAccessToken(scopes?: string | string[]): Promise<AccessToken>; | ||
getAccessToken(scopes?: string[]): Promise<AccessToken>; | ||
/** | ||
@@ -33,0 +33,0 @@ * Retrieves a new app access token. |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (scopes && scopes.length > 0) { | ||
throw new Error(`Scope ${typeof scopes === 'string' ? scopes : scopes.join(', ')} requested but the client credentials flow does not support scopes`); | ||
throw new Error(`Scope ${scopes.join(', ')} requested but the client credentials flow does not support scopes`); | ||
} | ||
@@ -41,0 +41,0 @@ if (!this._token || AccessToken_1.accessTokenIsExpired(this._token)) { |
@@ -0,1 +1,2 @@ | ||
import { DataObject } from '@twurple/common'; | ||
export interface TokenInfoData { | ||
@@ -11,5 +12,4 @@ client_id: string; | ||
*/ | ||
export declare class TokenInfo { | ||
export declare class TokenInfo extends DataObject<TokenInfoData> { | ||
private readonly _obtainmentDate; | ||
private readonly _data; | ||
/** @private */ | ||
@@ -16,0 +16,0 @@ constructor(data: TokenInfoData); |
@@ -11,6 +11,6 @@ "use strict"; | ||
*/ | ||
let TokenInfo = class TokenInfo { | ||
let TokenInfo = class TokenInfo extends common_1.DataObject { | ||
/** @private */ | ||
constructor(data) { | ||
this._data = data; | ||
super(data); | ||
this._obtainmentDate = new Date(); | ||
@@ -22,3 +22,3 @@ } | ||
get clientId() { | ||
return this._data.client_id; | ||
return this[common_1.rawDataSymbol].client_id; | ||
} | ||
@@ -30,3 +30,3 @@ /** | ||
var _a; | ||
return (_a = this._data.user_id) !== null && _a !== void 0 ? _a : null; | ||
return (_a = this[common_1.rawDataSymbol].user_id) !== null && _a !== void 0 ? _a : null; | ||
} | ||
@@ -38,3 +38,3 @@ /** | ||
var _a; | ||
return (_a = this._data.login) !== null && _a !== void 0 ? _a : null; | ||
return (_a = this[common_1.rawDataSymbol].login) !== null && _a !== void 0 ? _a : null; | ||
} | ||
@@ -45,3 +45,3 @@ /** | ||
get scopes() { | ||
return this._data.scopes; | ||
return this[common_1.rawDataSymbol].scopes; | ||
} | ||
@@ -54,11 +54,5 @@ /** | ||
get expiryDate() { | ||
if (!this._data.expires_in) { | ||
return null; | ||
} | ||
return new Date(this._obtainmentDate.getTime() + this._data.expires_in * 1000); | ||
return shared_utils_1.mapNullable(this[common_1.rawDataSymbol].expires_in, v => new Date(this._obtainmentDate.getTime() + v * 1000)); | ||
} | ||
}; | ||
tslib_1.__decorate([ | ||
shared_utils_1.Enumerable(false) | ||
], TokenInfo.prototype, "_data", void 0); | ||
TokenInfo = tslib_1.__decorate([ | ||
@@ -65,0 +59,0 @@ common_1.rtfm('auth', 'TokenInfo', 'clientId') |
{ | ||
"name": "@twurple/auth", | ||
"version": "5.0.0-pre.9", | ||
"version": "5.0.0-pre.10", | ||
"publishConfig": { | ||
@@ -37,4 +37,4 @@ "access": "public" | ||
"@d-fischer/shared-utils": "^3.2.0", | ||
"@twurple/api-call": "^5.0.0-pre.9", | ||
"@twurple/common": "^5.0.0-pre.9", | ||
"@twurple/api-call": "^5.0.0-pre.10", | ||
"@twurple/common": "^5.0.0-pre.10", | ||
"tslib": "^2.0.3" | ||
@@ -53,3 +53,3 @@ }, | ||
}, | ||
"gitHead": "2fe959f62af1e89ef6040816033b5128c272e131" | ||
"gitHead": "d363fb5edfd93c682aaa0a6a8bdb5bff03bf0347" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62176
1548