@ethlete/query 6.0.0-next.30 → 6.0.0-next.32

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/query",
3
- "version": "6.0.0-next.30",
3
+ "version": "6.0.0-next.32",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -70,6 +70,8 @@ type AuthTestSetupConfig<TLoginArgs extends {
70
70
  accessToken: string;
71
71
  refreshToken: string;
72
72
  };
73
+ /** Builds the refresh request from the refresh token. See TokenRefreshQueryConfig for details */
74
+ buildRefreshArgs?: TokenRefreshQueryConfig<TRefreshArgs>['buildArgs'];
73
75
  /** Feature builders for additional auth functionality */
74
76
  features?: [...TFeatures];
75
77
  /** Custom bearer decrypt function for testing */
@@ -3449,6 +3449,19 @@ type AuthQueryConfig<TArgs extends QueryArgs> = {
3449
3449
  extractTokens?: (response: ResponseType<TArgs>) => BearerAuthProviderTokens;
3450
3450
  };
3451
3451
  type TokenRefreshQueryConfig<TArgs extends QueryArgs> = AuthQueryConfig<TArgs> & {
3452
+ /**
3453
+ * Builds the request the refresh query sends for the current refresh token. Set it whenever the
3454
+ * API names that field anything other than `token`.
3455
+ *
3456
+ * @default (refreshToken) => ({ body: { token: refreshToken } })
3457
+ *
3458
+ * @example
3459
+ * withRefreshQuery('refresh', {
3460
+ * queryCreator: refresh,
3461
+ * buildArgs: (refreshToken) => ({ body: { refresh_token: refreshToken } }),
3462
+ * });
3463
+ */
3464
+ buildArgs?: (refreshToken: string) => RequestArgs<TArgs>;
3452
3465
  /**
3453
3466
  * The property name in the decoded JWT that contains the expiration time (in seconds).
3454
3467
  * @default 'exp'