Skip to content

Commit

Permalink
fix(twitch-auth): update to newer passport-twitch package
Browse files Browse the repository at this point in the history
  • Loading branch information
Chifilly committed Jul 30, 2022
1 parent 026aec5 commit 3168d49
Show file tree
Hide file tree
Showing 7 changed files with 9,657 additions and 9,210 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Expand Up @@ -2,5 +2,6 @@
"trailingComma": "es5",
"semi": true,
"singleQuote": true,
"arrowParens": "avoid"
"arrowParens": "avoid",
"endOfLine": "crlf"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -10,7 +10,7 @@
"test": "lerna run test --",
"build": "lerna run build",
"prepublish": "lerna run prepublish",
"format": "prettier --write 'website/src/**/*.{ts,tsx,js,jsx,md,mdx}' 'website/docs/**/*.{md,mdx}' 'packages/*/src/**/*' 'README.md'",
"format": "prettier --write website/src/**/*.{ts,tsx,js,jsx,md,mdx} website/docs/**/*.{md,mdx} packages/*/src/**/* README.md",
"changeset": "changeset",
"release": "changeset publish",
"postinstall": "husky install",
Expand Down
5 changes: 2 additions & 3 deletions packages/nestjs-hybrid-auth-twitch/package.json
Expand Up @@ -42,10 +42,9 @@
"prepublish": "npm run build"
},
"dependencies": {
"@hewmen/passport-twitch": "^1.0.4",
"@nestjs-hybrid-auth/core": "^1.0.0",
"@types/lodash": "^4.14.174",
"@types/passport-twitch-latest": "^1.0.1",
"lodash": "^4.17.21",
"passport-twitch-latest": "^1.0.0"
"lodash": "^4.17.21"
}
}
2 changes: 1 addition & 1 deletion packages/nestjs-hybrid-auth-twitch/src/twitch.strategy.ts
@@ -1,6 +1,6 @@
import { Injectable, Inject } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-twitch-latest';
import { Strategy } from '@hewmen/passport-twitch';
import { merge } from 'lodash';
import { TwitchAuthModuleOptions, TwitchAuthResult } from './twitch.types';
import { TWITCH_HYBRID_AUTH_OPTIONS } from './twitch.constants';
Expand Down
34 changes: 29 additions & 5 deletions packages/nestjs-hybrid-auth-twitch/src/twitch.types.ts
@@ -1,9 +1,18 @@
import { Request } from 'express';
import {
StrategyOptions,
StrategyOptionsWithRequest,
TwitchProfile,
} from 'passport-twitch-latest';

import * as PassportOauth2 from 'passport-oauth2';

type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;

type StrategyOptions = Optional<
PassportOauth2.StrategyOptions,
'authorizationURL' | 'tokenURL'
>;

type StrategyOptionsWithRequest = Optional<
PassportOauth2.StrategyOptionsWithRequest,
'authorizationURL' | 'tokenURL'
>;

type TwitchAuthStrategyOptionsWithoutRequest = {
[K in keyof StrategyOptions]: StrategyOptions[K];
Expand All @@ -30,6 +39,21 @@ export interface TwitchAuthModuleOptionsFactory {
| TwitchAuthModuleOptions;
}

interface TwitchProfile {
broadcaster_type: 'partner' | 'affiliate' | '';
description: string;
display_name: string;
id: string;
login: string;
offline_image_url: string;
profile_image_url: string;
type: 'staff' | 'admin' | 'global_mod' | '';
view_count: number;
email?: string;
created_at: string;
provider: string;
}

export interface TwitchAuthResult {
originalRequest: Request;
accessToken: string;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -5,6 +5,6 @@
"allowJs": false,
"baseUrl": ".",
"typeRoots": ["./node_modules/@types", "./types"],
"types": ["passport-twitch-latest"]
"types": []
}
}
18,819 changes: 9,621 additions & 9,198 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 3168d49

Please sign in to comment.