@usync/oauth2 0.0.3 → 0.0.5
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/README.md +5 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +345 -911
- package/dist/providers/base.d.ts +14 -3
- package/dist/providers/index.d.ts +4 -4
- package/dist/types.d.ts +7 -5
- package/package.json +6 -5
package/dist/providers/base.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { IOAuth2Options } from "../types";
|
|
1
|
+
import type { IOAuth2Options, TokenData } from "../types";
|
|
2
2
|
export declare abstract class OAuth2Authorizer {
|
|
3
3
|
protected options: IOAuth2Options;
|
|
4
4
|
abstract buildAuthUrl(): Promise<string>;
|
|
5
5
|
abstract finishAuth(url: URL): Promise<string>;
|
|
6
6
|
abstract refreshToken(): Promise<string>;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
protected _accessToken: TokenData | null;
|
|
8
|
+
protected _refreshToken: TokenData | null;
|
|
9
|
+
constructor(options: IOAuth2Options, initialData?: {
|
|
10
|
+
accessToken?: TokenData;
|
|
11
|
+
refreshToken?: TokenData;
|
|
12
|
+
});
|
|
13
|
+
protected _getValidToken(value?: TokenData | null): string | undefined;
|
|
14
|
+
protected _updateAccessToken(value: TokenData | null): void;
|
|
15
|
+
protected _updateRefreshToken(value: TokenData | null): void;
|
|
16
|
+
getAccessToken(): string;
|
|
17
|
+
getRefreshToken(): string;
|
|
18
|
+
setAccessToken(value?: TokenData | null): void;
|
|
19
|
+
setRefreshToken(value?: TokenData | null): void;
|
|
9
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DropboxAuthorizer } from
|
|
2
|
-
import { GoogleAuthorizer } from
|
|
3
|
-
import { MicrosoftAuthorizer } from
|
|
4
|
-
export * from
|
|
1
|
+
import { DropboxAuthorizer } from "./dropbox";
|
|
2
|
+
import { GoogleAuthorizer } from "./google";
|
|
3
|
+
import { MicrosoftAuthorizer } from "./microsoft";
|
|
4
|
+
export * from "./base";
|
|
5
5
|
export { DropboxAuthorizer, GoogleAuthorizer, MicrosoftAuthorizer };
|
|
6
6
|
export declare const OAuth2Authorizers: {
|
|
7
7
|
dropbox: typeof DropboxAuthorizer;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { OAuth2Authorizers } from
|
|
2
|
-
export interface
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { OAuth2Authorizers } from "./providers";
|
|
2
|
+
export interface TokenData {
|
|
3
|
+
token: string;
|
|
4
|
+
expiresAt?: number;
|
|
5
|
+
scope?: string;
|
|
5
6
|
}
|
|
6
7
|
export interface IOAuth2Options {
|
|
7
8
|
clientId: string;
|
|
8
9
|
clientSecret: string;
|
|
9
10
|
redirectUrl: string;
|
|
10
|
-
storage: IStorage;
|
|
11
11
|
scope?: string;
|
|
12
|
+
onSetAccessToken?: (value: TokenData | null) => void;
|
|
13
|
+
onSetRefreshToken?: (value: TokenData | null) => void;
|
|
12
14
|
}
|
|
13
15
|
export interface IOAuth2Account {
|
|
14
16
|
provider: keyof typeof OAuth2Authorizers;
|
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usync/oauth2",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist"
|
|
6
|
+
],
|
|
4
7
|
"type": "module",
|
|
8
|
+
"sideEffects": false,
|
|
5
9
|
"exports": {
|
|
6
10
|
".": {
|
|
7
11
|
"import": "./dist/index.js",
|
|
8
12
|
"types": "./dist/index.d.ts"
|
|
9
13
|
}
|
|
10
14
|
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist"
|
|
13
|
-
],
|
|
14
15
|
"publishConfig": {
|
|
15
16
|
"access": "public",
|
|
16
17
|
"registry": "https://registry.npmjs.org/"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"nanoid": "^5.1.
|
|
20
|
+
"nanoid": "^5.1.11"
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
23
|
"clean": "del-cli dist tsconfig.tsbuildinfo",
|