@ethlete/query 0.1.0-next.18 → 0.1.0-next.19

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.
@@ -57,6 +57,11 @@ export interface BearerRefreshConfig<T extends AnyQueryCreator> {
57
57
  * The cookie name where the refresh token is stored
58
58
  */
59
59
  cookieName?: string;
60
+ /**
61
+ * Enable or disable the cookie
62
+ * @default true
63
+ */
64
+ cookieEnabled?: boolean;
60
65
  /**
61
66
  * The time in milliseconds before the token expires when the refresh should be triggered.
62
67
  * @default 300000 (5 minutes)
@@ -76,7 +81,10 @@ export interface BearerRefreshConfig<T extends AnyQueryCreator> {
76
81
  * Adapter function used to build the request body for the refresh request.
77
82
  * @default { body: { refreshToken: "refreshToken" } }
78
83
  */
79
- requestArgsAdapter?: (tokens: TokenResponse) => QueryCreatorArgs<T>;
84
+ requestArgsAdapter?: (tokens: {
85
+ token: string | null;
86
+ refreshToken: string;
87
+ }) => QueryCreatorArgs<T>;
80
88
  /**
81
89
  * Adapter function used to extract the token and refreshToken from the response.
82
90
  * @default { token: "token", refreshToken: "refreshToken" }
@@ -86,6 +94,7 @@ export interface BearerRefreshConfig<T extends AnyQueryCreator> {
86
94
  export declare const enum AuthBearerRefreshStrategy {
87
95
  /**
88
96
  * Automatically refresh the token 5 minutes before expiration.
97
+ * The time can be configured with the `refreshBuffer` property.
89
98
  */
90
99
  BeforeExpiration = "beforeExpiration"
91
100
  }
@@ -14,6 +14,8 @@ export declare class BearerAuthProvider<T extends AnyQueryCreator> implements Au
14
14
  get currentRefreshQuery(): ReturnType<T["prepare"]> | null;
15
15
  constructor(_config: AuthProviderBearerConfig<T>);
16
16
  cleanUp(): void;
17
+ enableCookie(): void;
18
+ disableCookie(): void;
17
19
  private _prepareForRefresh;
18
20
  private _refreshQuery;
19
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/query",
3
- "version": "0.1.0-next.18",
3
+ "version": "0.1.0-next.19",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0"
6
6
  },