@basictech/nextjs 0.7.0-beta.2 → 0.7.0-beta.4
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/CHANGELOG.md +7 -0
- package/package.json +2 -2
- package/dist/client.d.mts +0 -1
- package/dist/client.d.ts +0 -1
- package/dist/index.d.mts +0 -83
- package/dist/index.d.ts +0 -83
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basictech/nextjs",
|
|
3
|
-
"version": "0.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"author": "",
|
|
39
39
|
"license": "ISC",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@basictech/react": "0.8.0-beta.
|
|
41
|
+
"@basictech/react": "0.8.0-beta.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@repo/typescript-config": "*",
|
package/dist/client.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AuthConfig, AuthError, AuthResult, BasicContextType, BasicDB, BasicDevToolbar, BasicDevToolbarProps, BasicProvider, BasicProviderProps, BasicSchemaDevInfo, BasicStorage, Collection, DBMode, LocalStorageAdapter, NotAuthenticatedError, RemoteCollection, RemoteDB, RemoteDBConfig, RemoteDBError, STORAGE_KEYS, useBasic, useQuery } from '@basictech/react';
|
package/dist/client.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AuthConfig, AuthError, AuthResult, BasicContextType, BasicDB, BasicDevToolbar, BasicDevToolbarProps, BasicProvider, BasicProviderProps, BasicSchemaDevInfo, BasicStorage, Collection, DBMode, LocalStorageAdapter, NotAuthenticatedError, RemoteCollection, RemoteDB, RemoteDBConfig, RemoteDBError, STORAGE_KEYS, useBasic, useQuery } from '@basictech/react';
|
package/dist/index.d.mts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export { AuthConfig, AuthError, AuthResult, BasicContextType, BasicDB, BasicProviderProps, BasicStorage, Collection, DBMode, LocalStorageAdapter, RemoteDBConfig } from '@basictech/react';
|
|
2
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Configuration options for the Basic auth middleware
|
|
6
|
-
*/
|
|
7
|
-
interface BasicMiddlewareConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Routes that require authentication
|
|
10
|
-
* Supports glob patterns like '/dashboard/*', '/api/protected/*'
|
|
11
|
-
*/
|
|
12
|
-
protectedRoutes?: string[];
|
|
13
|
-
/**
|
|
14
|
-
* Routes that are always public (bypass auth check)
|
|
15
|
-
* Useful for login pages, public APIs, etc.
|
|
16
|
-
*/
|
|
17
|
-
publicRoutes?: string[];
|
|
18
|
-
/**
|
|
19
|
-
* Where to redirect unauthenticated users
|
|
20
|
-
* @default '/login'
|
|
21
|
-
*/
|
|
22
|
-
signInUrl?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Where to redirect after successful sign-in
|
|
25
|
-
* @default '/'
|
|
26
|
-
*/
|
|
27
|
-
afterSignInUrl?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Cookie name for the access token
|
|
30
|
-
* @default 'basic_access_token'
|
|
31
|
-
*/
|
|
32
|
-
tokenCookieName?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Cookie name for the full token object
|
|
35
|
-
* @default 'basic_token'
|
|
36
|
-
*/
|
|
37
|
-
fullTokenCookieName?: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get auth info from cookies
|
|
41
|
-
*/
|
|
42
|
-
declare function getAuthFromRequest(request: NextRequest, config?: Partial<BasicMiddlewareConfig>): {
|
|
43
|
-
isAuthenticated: boolean;
|
|
44
|
-
token: string | null;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Create a Basic auth middleware for NextJS
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* // In middleware.ts at the root of your NextJS app:
|
|
51
|
-
* import { createBasicMiddleware } from '@basictech/nextjs'
|
|
52
|
-
*
|
|
53
|
-
* export const middleware = createBasicMiddleware({
|
|
54
|
-
* protectedRoutes: ['/dashboard/*', '/settings/*'],
|
|
55
|
-
* publicRoutes: ['/login', '/signup', '/'],
|
|
56
|
-
* signInUrl: '/login'
|
|
57
|
-
* })
|
|
58
|
-
*
|
|
59
|
-
* export const config = {
|
|
60
|
-
* matcher: ['/((?!_next/static|_next/image|favicon.ico).*)']
|
|
61
|
-
* }
|
|
62
|
-
*/
|
|
63
|
-
declare function createBasicMiddleware(config?: BasicMiddlewareConfig): (request: NextRequest) => NextResponse;
|
|
64
|
-
/**
|
|
65
|
-
* Simple auth check middleware - redirects unauthenticated users
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* // In middleware.ts
|
|
69
|
-
* import { withBasicAuth } from '@basictech/nextjs'
|
|
70
|
-
*
|
|
71
|
-
* export const middleware = withBasicAuth
|
|
72
|
-
*
|
|
73
|
-
* export const config = {
|
|
74
|
-
* matcher: ['/dashboard/:path*', '/settings/:path*']
|
|
75
|
-
* }
|
|
76
|
-
*/
|
|
77
|
-
declare function withBasicAuth(request: NextRequest): NextResponse;
|
|
78
|
-
/**
|
|
79
|
-
* Helper to get the return URL from search params
|
|
80
|
-
*/
|
|
81
|
-
declare function getReturnUrl(request: NextRequest, defaultUrl?: string): string;
|
|
82
|
-
|
|
83
|
-
export { type BasicMiddlewareConfig, createBasicMiddleware, getAuthFromRequest, getReturnUrl, withBasicAuth };
|
package/dist/index.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export { AuthConfig, AuthError, AuthResult, BasicContextType, BasicDB, BasicProviderProps, BasicStorage, Collection, DBMode, LocalStorageAdapter, RemoteDBConfig } from '@basictech/react';
|
|
2
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Configuration options for the Basic auth middleware
|
|
6
|
-
*/
|
|
7
|
-
interface BasicMiddlewareConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Routes that require authentication
|
|
10
|
-
* Supports glob patterns like '/dashboard/*', '/api/protected/*'
|
|
11
|
-
*/
|
|
12
|
-
protectedRoutes?: string[];
|
|
13
|
-
/**
|
|
14
|
-
* Routes that are always public (bypass auth check)
|
|
15
|
-
* Useful for login pages, public APIs, etc.
|
|
16
|
-
*/
|
|
17
|
-
publicRoutes?: string[];
|
|
18
|
-
/**
|
|
19
|
-
* Where to redirect unauthenticated users
|
|
20
|
-
* @default '/login'
|
|
21
|
-
*/
|
|
22
|
-
signInUrl?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Where to redirect after successful sign-in
|
|
25
|
-
* @default '/'
|
|
26
|
-
*/
|
|
27
|
-
afterSignInUrl?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Cookie name for the access token
|
|
30
|
-
* @default 'basic_access_token'
|
|
31
|
-
*/
|
|
32
|
-
tokenCookieName?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Cookie name for the full token object
|
|
35
|
-
* @default 'basic_token'
|
|
36
|
-
*/
|
|
37
|
-
fullTokenCookieName?: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get auth info from cookies
|
|
41
|
-
*/
|
|
42
|
-
declare function getAuthFromRequest(request: NextRequest, config?: Partial<BasicMiddlewareConfig>): {
|
|
43
|
-
isAuthenticated: boolean;
|
|
44
|
-
token: string | null;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Create a Basic auth middleware for NextJS
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* // In middleware.ts at the root of your NextJS app:
|
|
51
|
-
* import { createBasicMiddleware } from '@basictech/nextjs'
|
|
52
|
-
*
|
|
53
|
-
* export const middleware = createBasicMiddleware({
|
|
54
|
-
* protectedRoutes: ['/dashboard/*', '/settings/*'],
|
|
55
|
-
* publicRoutes: ['/login', '/signup', '/'],
|
|
56
|
-
* signInUrl: '/login'
|
|
57
|
-
* })
|
|
58
|
-
*
|
|
59
|
-
* export const config = {
|
|
60
|
-
* matcher: ['/((?!_next/static|_next/image|favicon.ico).*)']
|
|
61
|
-
* }
|
|
62
|
-
*/
|
|
63
|
-
declare function createBasicMiddleware(config?: BasicMiddlewareConfig): (request: NextRequest) => NextResponse;
|
|
64
|
-
/**
|
|
65
|
-
* Simple auth check middleware - redirects unauthenticated users
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* // In middleware.ts
|
|
69
|
-
* import { withBasicAuth } from '@basictech/nextjs'
|
|
70
|
-
*
|
|
71
|
-
* export const middleware = withBasicAuth
|
|
72
|
-
*
|
|
73
|
-
* export const config = {
|
|
74
|
-
* matcher: ['/dashboard/:path*', '/settings/:path*']
|
|
75
|
-
* }
|
|
76
|
-
*/
|
|
77
|
-
declare function withBasicAuth(request: NextRequest): NextResponse;
|
|
78
|
-
/**
|
|
79
|
-
* Helper to get the return URL from search params
|
|
80
|
-
*/
|
|
81
|
-
declare function getReturnUrl(request: NextRequest, defaultUrl?: string): string;
|
|
82
|
-
|
|
83
|
-
export { type BasicMiddlewareConfig, createBasicMiddleware, getAuthFromRequest, getReturnUrl, withBasicAuth };
|