Skip to content

Commit b9191ca

Browse files
committed
chore: bump to 0.3.3 and add explicit types
Bump @mayrlabs/auth and @mayrlabs/auth-nextjs to 0.3.3 and synchronize dependency versions. Add explicit NextClientAuth and NextIssuerAuth interfaces in auth-nextjs types to prevent the `setup` object from being inferred as `any`, and update createNextClientAuth/createNextIssuerAuth signatures to return those types. Update CHANGELOGs with the 0.3.3 entries.
1 parent 8f9a578 commit b9191ca

7 files changed

Lines changed: 48 additions & 7 deletions

File tree

packages/auth-nextjs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# @mayrlabs/auth-nextjs
22

3+
## 0.3.3
4+
5+
Resolved typing issues where the `setup` object was being inferred as `any` by defining explicit return interfaces.
6+
37
## 0.3.2
48

59
Resolved typing issues where the `setup` object was being inferred as `any`.

packages/auth-nextjs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mayrlabs/auth-nextjs",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"description": "The official Next.js App Router integration for @mayrlabs/auth featuring Middleware guards, Server Actions utilities, and React Context bindings.",
55
"keywords": [
66
"nextjs",
@@ -116,7 +116,7 @@
116116
"react-dom": "^18.0.0 || ^19.0.0 || ^20.0.0"
117117
},
118118
"dependencies": {
119-
"@mayrlabs/auth": "^0.3.2"
119+
"@mayrlabs/auth": "^0.3.3"
120120
},
121121
"devDependencies": {
122122
"@types/react-dom": "^19.0.0",

packages/auth-nextjs/src/client/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ import { redirect } from "next/navigation";
88
import { type NextRequest, NextResponse } from "next/server";
99
import type React from "react";
1010
import { redirectTo } from "../_utils";
11-
import type { NextAuthOptions } from "../types";
11+
import type { NextAuthOptions, NextClientAuth } from "../types";
1212
import { AuthClientProvider } from "./provider";
1313

1414
/**
1515
* Creates Next.js specific client auth utilities.
1616
* Automatically handles environment variables and validation.
1717
*/
18-
export function createNextClientAuth(options: NextAuthOptions = {}) {
18+
export function createNextClientAuth(
19+
options: NextAuthOptions = {},
20+
): NextClientAuth {
1921
const publicKey = process.env.MAYRLABS_AUTH_PUBLIC_JWK;
2022
const clientId = process.env.MAYRLABS_CLIENT_ID;
2123
const clientSecret = process.env.MAYRLABS_CLIENT_SECRET;

packages/auth-nextjs/src/issuer/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import {
66
import { cookies } from "next/headers";
77
import type { NextRequest } from "next/server";
88
import { redirectTo } from "../_utils";
9-
import type { NextIssuerAuthOptions } from "../types";
9+
import type { NextIssuerAuth, NextIssuerAuthOptions } from "../types";
1010

1111
/**
1212
* Creates Next.js specific issuer auth utilities.
1313
* Automatically handles environment variables and validation.
1414
*/
15-
export function createNextIssuerAuth(options: NextIssuerAuthOptions = {}) {
15+
export function createNextIssuerAuth(
16+
options: NextIssuerAuthOptions = {},
17+
): NextIssuerAuth {
1618
const privateKey = process.env.MAYRLABS_AUTH_PRIVATE_JWK;
1719
const publicKey = process.env.MAYRLABS_AUTH_PUBLIC_JWK;
1820
const issuer = process.env.MAYRLABS_AUTH_ISSUER;

packages/auth-nextjs/src/types.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import type {
2+
ClientAuthSetup,
3+
IssuerAuthSetup,
4+
MayRLabsAuthUserPayload,
5+
} from "@mayrlabs/auth";
6+
import type { NextRequest, NextResponse } from "next/server";
7+
import type React from "react";
8+
19
export interface NextAuthOptions {
210
redirects?: Partial<{ error: string; success: string }>;
311
session?: Partial<{ key: string }>;
@@ -7,3 +15,24 @@ export interface NextIssuerAuthOptions {
715
session?: Partial<{ key: string }>;
816
redirects?: Partial<{ error: string }>;
917
}
18+
19+
export interface NextIssuerAuth {
20+
setup: IssuerAuthSetup;
21+
getUser: () => Promise<MayRLabsAuthUserPayload | null>;
22+
getUserOrThrow: () => Promise<MayRLabsAuthUserPayload>;
23+
logoutHandler: (request: NextRequest) => Promise<NextResponse>;
24+
}
25+
26+
export interface NextClientAuth {
27+
setup: ClientAuthSetup;
28+
handleCallback: (request: NextRequest) => Promise<NextResponse>;
29+
getUser: () => Promise<MayRLabsAuthUserPayload | null>;
30+
getUserOrThrow: () => Promise<MayRLabsAuthUserPayload>;
31+
getUserOrRedirect: () => Promise<MayRLabsAuthUserPayload>;
32+
authProxy: (request: NextRequest) => Promise<NextResponse>;
33+
logoutHandler: (request: NextRequest) => Promise<NextResponse>;
34+
redirectToLogin: (request: NextRequest) => NextResponse;
35+
AuthProvider: (props: {
36+
children: React.ReactNode;
37+
}) => Promise<React.JSX.Element | null>;
38+
}

packages/auth/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# @mayrlabs/auth
22

3+
## 0.3.3
4+
5+
Minor bump for version synchronization with nextjs package.
6+
37
## 0.3.2
48

59
Exported `BaseAuthSetup` to resolve typing issues in consuming packages.

packages/auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mayrlabs/auth",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"description": "A strictly typed, universal JWT and M2M authentication core library powering the MayR Labs ecosystem.",
55
"keywords": [
66
"auth",

0 commit comments

Comments
 (0)