Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

41 type information #42

Merged
merged 9 commits into from
Apr 19, 2017
Merged

41 type information #42

merged 9 commits into from
Apr 19, 2017

Conversation

Retro64
Copy link
Collaborator

@Retro64 Retro64 commented Apr 19, 2017

close #41

@Retro64
Copy link
Collaborator Author

Retro64 commented Apr 19, 2017

👍

README.md Outdated
@@ -30,7 +30,7 @@ import {
} from 'lib-oauth-tooling';
```

#### TokenCache(tokenConfig: any, oauthConfig: any)
#### TokenCache(tokenConfig: { [key : string]: string[] }, oauthConfig: OAuthConfig)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: should we move the signature out of the headline?

@@ -83,17 +83,17 @@ describe('mock tooling', () => {

// when
let promise = getTokenInfo(tokeninfoEndpoint, 'foo')
.then((token: any) => {
.then((token: TokenInfo) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const + indent

@@ -199,7 +199,7 @@ describe('getAccessToken', () => {
const responseObject = { 'access_token': '4b70510f-be1d-4f0f-b4cb-edbca2c79d41' };

nock(host)
.post('/access_token?realm=/services', (body) => {
.post('/access_token?realm=/services', (body: any) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

package.json Outdated
},
"dependencies": {
"body-parser": "^1.16.0",
"body-parser": "^1.17.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we switch to non ^ ~ versions for the library?

@@ -57,8 +52,8 @@ class TokenCache {
* @param {string} The key configured on the tokenCache instance
* @return {Promise<string>} the resolved access_token
*/
public resolveAccessTokenFactory(key: string): () => Promise<string> {
return () => this
public resolveAccessTokenFactory(key : string) : () => Promise < string > {
Copy link
Collaborator

@ISO50 ISO50 Apr 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public resolveAccessTokenFactory(key: string): () => Promise<string> {

public resolveAccessTokenFactory(key: string): () => Promise<string> {
return () => this
public resolveAccessTokenFactory(key : string) : () => Promise < string > {
return() => this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return ()

@@ -70,36 +65,32 @@ class TokenCache {
* @param tokenName
* @returns {Promise<T>}
*/
get(tokenName: string): Promise<any> {
get(tokenName : string) : Promise <TokenInfo> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get(tokenName: string): Promise<TokenInfo>

})
.then((tokenInfo: any) => {
return getTokenInfo(this.oauthConfig.tokenInfoEndpoint, token.access_token);
}).then((tokenInfo : TokenInfo) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

})
.then

*/
refreshToken(tokenName: string): Promise<any> {
refreshToken(tokenName : string) : Promise <TokenInfo> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces

@@ -127,13 +118,17 @@ class TokenCache {
*
* @returns {Promise<T>}
*/
refreshAllTokens(): Promise<any> {
refreshAllTokens() : Promise <{ [key : string]: TokenInfo }> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces

});
return getTokenInfo(this.oauthConfig.tokenInfoEndpoint, token.access_token).then(validatedToken => {
return Promise.resolve(validatedToken);
}).catch(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n

@@ -144,7 +139,7 @@ class TokenCache {
* @param tokenName
* @returns {Promise<T>}
*/
private validateToken(tokenName: string): Promise<any> {
private validateToken(tokenName : string) : Promise <TokenInfo> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces

export {
TokenCache
};
export {TokenCache};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like it was or

export { TokenCache };

@@ -77,7 +77,7 @@ function handleOAuthRequestMiddleware(options: any) {
return function(req: any, res: any, next: Function) {

// Skip OAuth validation for paths marked as public
if (options.publicEndpoints && match(req.originalUrl, options.publicEndpoints)) {
if (options.publicEndpoints && match(req.originalUrl, new Set(options.publicEndpoints))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

expect(token).to.equal(validAuthToken);
return getTokenInfo(tokeninfoEndpoint, 'foo');
})
.then((token : TokenInfo) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space

const userData = JSON.parse(credentials[0]);
const clientData = JSON.parse(credentials[1]);

let bodyParameters: any;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe create new issue for new type

@ISO50
Copy link
Collaborator

ISO50 commented Apr 19, 2017

👍

@Retro64
Copy link
Collaborator Author

Retro64 commented Apr 19, 2017

👍

@Retro64 Retro64 merged commit 8423689 into master Apr 19, 2017
@Retro64 Retro64 deleted the 41-type-information branch January 4, 2018 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide valuable type information
4 participants