fastify-txstate 3.2.3 → 3.2.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/lib/index.d.ts CHANGED
@@ -77,7 +77,7 @@ export interface FastifyTxStateOptions extends Partial<FastifyServerOptions> {
77
77
  *
78
78
  * If this function throws, the client will receive a 401 response.
79
79
  */
80
- authenticate?: <T extends FastifyTxStateAuthInfo>(req: FastifyRequest) => Promise<T | undefined>;
80
+ authenticate?: (req: FastifyRequest) => Promise<FastifyTxStateAuthInfo | undefined>;
81
81
  }
82
82
  declare module 'fastify' {
83
83
  interface FastifyRequest {
@@ -58,5 +58,5 @@ declare class TxStateUAuthContext extends Context {
58
58
  authFromPayload(payload: JWTPayload): Promise<FastifyTxStateAuthInfo>;
59
59
  }
60
60
  export declare function unifiedAuthenticate(req: FastifyRequest, ContextClass?: typeof TxStateUAuthContext): Promise<FastifyTxStateAuthInfo | undefined>;
61
- export declare function unifiedAuthenticateAll(req: FastifyRequest, ContextClass?: typeof TxStateUAuthContext): Promise<void>;
61
+ export declare function unifiedAuthenticateAll(req: FastifyRequest, ContextClass?: typeof TxStateUAuthContext): Promise<FastifyTxStateAuthInfo>;
62
62
  export {};
@@ -141,5 +141,6 @@ async function unifiedAuthenticateAll(req, ContextClass = TxStateUAuthContext) {
141
141
  const auth = await ctx.waitForAuth();
142
142
  if (!(auth === null || auth === void 0 ? void 0 : auth.username.length))
143
143
  throw new Error('All requests require authentication.');
144
+ return auth;
144
145
  }
145
146
  exports.unifiedAuthenticateAll = unifiedAuthenticateAll;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.2.3",
3
+ "version": "3.2.5",
4
4
  "description": "A small wrapper for fastify providing a set of common conventions & utility functions we use.",
5
5
  "exports": {
6
6
  ".": {