@usetransactional/auth-next 0.1.0 → 0.1.1
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/README.md +15 -15
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.d.ts +1 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/{types-D3JPYyLl.d.mts → types-f5YahDTL.d.mts} +1 -1
- package/dist/{types-D3JPYyLl.d.ts → types-f5YahDTL.d.ts} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @usetransactional/auth-next
|
|
2
2
|
|
|
3
3
|
Next.js SDK for Transactional Auth - OpenID Connect authentication with full support for App Router, Server Components, and Middleware.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install @usetransactional/auth-next
|
|
9
9
|
# or
|
|
10
|
-
yarn add
|
|
10
|
+
yarn add @usetransactional/auth-next
|
|
11
11
|
# or
|
|
12
|
-
pnpm add
|
|
12
|
+
pnpm add @usetransactional/auth-next
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
handleCallback,
|
|
35
35
|
handleLogout,
|
|
36
36
|
handleSession,
|
|
37
|
-
} from '
|
|
37
|
+
} from '@usetransactional/auth-next/server';
|
|
38
38
|
import { NextRequest } from 'next/server';
|
|
39
39
|
|
|
40
40
|
export async function GET(
|
|
@@ -62,7 +62,7 @@ export async function GET(
|
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
64
|
// app/layout.tsx
|
|
65
|
-
import { TransactionalAuthProvider } from '
|
|
65
|
+
import { TransactionalAuthProvider } from '@usetransactional/auth-next/client';
|
|
66
66
|
|
|
67
67
|
export default function RootLayout({
|
|
68
68
|
children,
|
|
@@ -85,7 +85,7 @@ export default function RootLayout({
|
|
|
85
85
|
|
|
86
86
|
```tsx
|
|
87
87
|
// app/page.tsx
|
|
88
|
-
import { getSession, getUser } from '
|
|
88
|
+
import { getSession, getUser } from '@usetransactional/auth-next/server';
|
|
89
89
|
|
|
90
90
|
export default async function Page() {
|
|
91
91
|
const session = await getSession();
|
|
@@ -109,7 +109,7 @@ export default async function Page() {
|
|
|
109
109
|
// components/login-button.tsx
|
|
110
110
|
'use client';
|
|
111
111
|
|
|
112
|
-
import { useAuth } from '
|
|
112
|
+
import { useAuth } from '@usetransactional/auth-next/client';
|
|
113
113
|
|
|
114
114
|
export function LoginButton() {
|
|
115
115
|
const { user, isLoading, login, logout } = useAuth();
|
|
@@ -135,7 +135,7 @@ export function LoginButton() {
|
|
|
135
135
|
|
|
136
136
|
```ts
|
|
137
137
|
// middleware.ts
|
|
138
|
-
import { createAuthMiddleware } from '
|
|
138
|
+
import { createAuthMiddleware } from '@usetransactional/auth-next/middleware';
|
|
139
139
|
|
|
140
140
|
export default createAuthMiddleware({
|
|
141
141
|
protectedPaths: ['/dashboard/*', '/settings/*', '/api/protected/*'],
|
|
@@ -151,7 +151,7 @@ export const config = {
|
|
|
151
151
|
|
|
152
152
|
```ts
|
|
153
153
|
// app/api/protected/route.ts
|
|
154
|
-
import { withAuth } from '
|
|
154
|
+
import { withAuth } from '@usetransactional/auth-next/middleware';
|
|
155
155
|
import { NextRequest } from 'next/server';
|
|
156
156
|
|
|
157
157
|
export const GET = withAuth(async (request, session) => {
|
|
@@ -164,7 +164,7 @@ export const GET = withAuth(async (request, session) => {
|
|
|
164
164
|
|
|
165
165
|
## API Reference
|
|
166
166
|
|
|
167
|
-
### Server Functions (
|
|
167
|
+
### Server Functions (`@usetransactional/auth-next/server`)
|
|
168
168
|
|
|
169
169
|
#### `getSession()`
|
|
170
170
|
|
|
@@ -207,7 +207,7 @@ const authenticated = await isAuthenticated();
|
|
|
207
207
|
- `handleLogout(options?)` - Logs out user
|
|
208
208
|
- `handleSession()` - Returns current session as JSON
|
|
209
209
|
|
|
210
|
-
### Client Functions (
|
|
210
|
+
### Client Functions (`@usetransactional/auth-next/client`)
|
|
211
211
|
|
|
212
212
|
#### `TransactionalAuthProvider`
|
|
213
213
|
|
|
@@ -235,7 +235,7 @@ Hook for just user data.
|
|
|
235
235
|
const { user, isLoading } = useUser();
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
### Middleware (
|
|
238
|
+
### Middleware (`@usetransactional/auth-next/middleware`)
|
|
239
239
|
|
|
240
240
|
#### `createAuthMiddleware(config)`
|
|
241
241
|
|
|
@@ -275,7 +275,7 @@ export const GET = withAuth(async (request, session) => {
|
|
|
275
275
|
### Programmatic Configuration
|
|
276
276
|
|
|
277
277
|
```ts
|
|
278
|
-
import { initTransactionalAuth } from '
|
|
278
|
+
import { initTransactionalAuth } from '@usetransactional/auth-next';
|
|
279
279
|
|
|
280
280
|
initTransactionalAuth({
|
|
281
281
|
domain: 'auth.usetransactional.com',
|
|
@@ -304,7 +304,7 @@ import type {
|
|
|
304
304
|
Session,
|
|
305
305
|
LoginOptions,
|
|
306
306
|
LogoutOptions,
|
|
307
|
-
} from '
|
|
307
|
+
} from '@usetransactional/auth-next';
|
|
308
308
|
```
|
|
309
309
|
|
|
310
310
|
## License
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { b as TransactionalAuthUser } from '../types-f5YahDTL.mjs';
|
|
4
4
|
|
|
5
5
|
interface AuthContextValue {
|
|
6
6
|
user: TransactionalAuthUser | null;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { b as TransactionalAuthUser } from '../types-f5YahDTL.js';
|
|
4
4
|
|
|
5
5
|
interface AuthContextValue {
|
|
6
6
|
user: TransactionalAuthUser | null;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TransactionalAuthConfig } from './types-
|
|
2
|
-
export { L as LoginOptions,
|
|
1
|
+
import { T as TransactionalAuthConfig } from './types-f5YahDTL.mjs';
|
|
2
|
+
export { L as LoginOptions, a as LogoutOptions, S as Session, b as TransactionalAuthUser } from './types-f5YahDTL.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Transactional Auth Next - Configuration
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TransactionalAuthConfig } from './types-
|
|
2
|
-
export { L as LoginOptions,
|
|
1
|
+
import { T as TransactionalAuthConfig } from './types-f5YahDTL.js';
|
|
2
|
+
export { L as LoginOptions, a as LogoutOptions, S as Session, b as TransactionalAuthUser } from './types-f5YahDTL.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Transactional Auth Next - Configuration
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Session,
|
|
1
|
+
import { S as Session, b as TransactionalAuthUser, L as LoginOptions, a as LogoutOptions } from '../types-f5YahDTL.mjs';
|
|
2
2
|
import { NextRequest, NextResponse } from 'next/server';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Session,
|
|
1
|
+
import { S as Session, b as TransactionalAuthUser, L as LoginOptions, a as LogoutOptions } from '../types-f5YahDTL.js';
|
|
2
2
|
import { NextRequest, NextResponse } from 'next/server';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -54,4 +54,4 @@ interface LogoutOptions {
|
|
|
54
54
|
returnTo?: string;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export type { LoginOptions as L, Session as S, TransactionalAuthConfig as T,
|
|
57
|
+
export type { LoginOptions as L, Session as S, TransactionalAuthConfig as T, LogoutOptions as a, TransactionalAuthUser as b };
|
|
@@ -54,4 +54,4 @@ interface LogoutOptions {
|
|
|
54
54
|
returnTo?: string;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export type { LoginOptions as L, Session as S, TransactionalAuthConfig as T,
|
|
57
|
+
export type { LoginOptions as L, Session as S, TransactionalAuthConfig as T, LogoutOptions as a, TransactionalAuthUser as b };
|
package/package.json
CHANGED