@usync/oauth2 0.1.3 → 0.1.4

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { OAuth2Authorizer } from "./providers";
2
- import type { IOAuth2Account, IOAuth2Options } from "./types";
2
+ import type { IOAuth2Account, OAuth2AuthorizerOptions } from "./types";
3
3
  export * from "./common";
4
4
  export * from "./providers";
5
5
  export * from "./types";
6
- export declare function getAuthorizer(options: IOAuth2Options, auth: IOAuth2Account): import("./providers").DropboxAuthorizer | import("./providers").GoogleAuthorizer | import("./providers").MicrosoftAuthorizer;
6
+ export declare function getAuthorizer(options: OAuth2AuthorizerOptions, auth: IOAuth2Account): import("./providers").DropboxAuthorizer | import("./providers").GoogleAuthorizer | import("./providers").MicrosoftAuthorizer;
7
7
  export declare function ensureAccessToken(authorizer: OAuth2Authorizer, handleOAuth2?: (url: string) => Promise<string>): Promise<string>;
@@ -1,6 +1,6 @@
1
- import type { IOAuth2Options, TokenData } from "../types";
1
+ import type { OAuth2AuthorizerOptions, TokenData } from "../types";
2
2
  export declare abstract class OAuth2Authorizer {
3
- protected options: IOAuth2Options;
3
+ protected options: OAuth2AuthorizerOptions;
4
4
  abstract buildAuthUrl(): Promise<string>;
5
5
  abstract finishAuth(url: URL): Promise<string>;
6
6
  abstract refreshToken(): Promise<string>;
@@ -10,7 +10,7 @@ export declare abstract class OAuth2Authorizer {
10
10
  state: string;
11
11
  codeVerifier: string;
12
12
  } | undefined;
13
- constructor(options: IOAuth2Options, initialData?: {
13
+ constructor(options: OAuth2AuthorizerOptions, initialData?: {
14
14
  accessToken?: TokenData;
15
15
  refreshToken?: TokenData;
16
16
  session?: {
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@ export interface TokenData {
4
4
  expiresAt?: number;
5
5
  scope?: string;
6
6
  }
7
- export interface IOAuth2Options {
7
+ export interface OAuth2Config {
8
8
  clientId: string;
9
9
  /** clientSecret may be absent for client-side apps. */
10
10
  clientSecret?: string;
@@ -21,6 +21,8 @@ export interface IOAuth2Options {
21
21
  accountType?: "common" | "consumers";
22
22
  };
23
23
  };
24
+ }
25
+ export interface OAuth2AuthorizerOptions extends OAuth2Config {
24
26
  onSetAccessToken?: (value: TokenData | null) => void;
25
27
  onSetRefreshToken?: (value: TokenData | null) => void;
26
28
  }
package/package.json CHANGED
@@ -1,7 +1,13 @@
1
1
  {
2
2
  "name": "@usync/oauth2",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "ISC",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/usync-dev/usync.git",
8
+ "directory": "packages/oauth2"
9
+ },
10
+ "homepage": "https://github.com/usync-dev/usync/tree/main/packages/oauth2",
5
11
  "files": [
6
12
  "dist"
7
13
  ],