@basictech/nextjs 0.7.0-beta.1 → 0.7.0-beta.2
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/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +11 -0
- package/dist/client.d.mts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +2 -0
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +83 -0
- package/dist/index.d.ts +83 -0
- package/package.json +2 -2
- package/src/client.ts +3 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @basictech/nextjs@0.
|
|
3
|
+
> @basictech/nextjs@0.7.0-beta.1 build
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/client.ts, src/index.ts
|
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m2.22 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/client.mjs.map [22m[32m933.00 B[39m
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m6.68 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in 11ms
|
|
19
|
-
[32mCJS[39m [1mdist/client.js [22m[32m1.60 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/client.js [22m[32m1.67 KB[39m
|
|
20
15
|
[32mCJS[39m [1mdist/index.js [22m[32m3.43 KB[39m
|
|
21
|
-
[32mCJS[39m [1mdist/client.js.map [22m[
|
|
16
|
+
[32mCJS[39m [1mdist/client.js.map [22m[32m1000.00 B[39m
|
|
22
17
|
[32mCJS[39m [1mdist/index.js.map [22m[32m7.77 KB[39m
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 23ms
|
|
19
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m2.22 KB[39m
|
|
20
|
+
[32mESM[39m [1mdist/client.mjs [22m[32m413.00 B[39m
|
|
21
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m6.68 KB[39m
|
|
22
|
+
[32mESM[39m [1mdist/client.mjs.map [22m[32m1011.00 B[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 23ms
|
|
24
24
|
DTS Build start
|
|
25
|
-
DTS ⚡️ Build success in
|
|
26
|
-
DTS dist/client.d.ts
|
|
25
|
+
DTS ⚡️ Build success in 1156ms
|
|
26
|
+
DTS dist/client.d.ts 362.00 B
|
|
27
27
|
DTS dist/index.d.ts 2.48 KB
|
|
28
|
-
DTS dist/client.d.mts
|
|
28
|
+
DTS dist/client.d.mts 362.00 B
|
|
29
29
|
DTS dist/index.d.mts 2.48 KB
|
|
30
30
|
⠙[1G[0K
|
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
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.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/client.ts
|
|
22
22
|
var client_exports = {};
|
|
23
23
|
__export(client_exports, {
|
|
24
|
+
BasicDevToolbar: () => import_react.BasicDevToolbar,
|
|
24
25
|
BasicProvider: () => import_react.BasicProvider,
|
|
25
26
|
NotAuthenticatedError: () => import_react.NotAuthenticatedError,
|
|
26
27
|
RemoteCollection: () => import_react.RemoteCollection,
|
|
@@ -34,6 +35,7 @@ module.exports = __toCommonJS(client_exports);
|
|
|
34
35
|
var import_react = require("@basictech/react");
|
|
35
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
37
|
0 && (module.exports = {
|
|
38
|
+
BasicDevToolbar,
|
|
37
39
|
BasicProvider,
|
|
38
40
|
NotAuthenticatedError,
|
|
39
41
|
RemoteCollection,
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["'use client'\n\n// @basictech/nextjs/client - Client-side exports for Next.js\n// Use this in client components (files with 'use client' directive)\n\n// Re-export everything from @basictech/react for client-side use\nexport {\n useBasic,\n BasicProvider,\n useQuery,\n RemoteDB,\n RemoteCollection,\n RemoteDBError,\n NotAuthenticatedError,\n STORAGE_KEYS\n} from \"@basictech/react\"\n\n// Re-export types (DBMode is also a type)\nexport type {\n AuthConfig,\n BasicStorage,\n LocalStorageAdapter,\n BasicProviderProps,\n BasicContextType,\n AuthResult,\n BasicDB,\n Collection,\n RemoteDBConfig,\n AuthError\n} from \"@basictech/react\"\n\n// DBMode is a type-only export\nexport type { DBMode } from \"@basictech/react\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["'use client'\n\n// @basictech/nextjs/client - Client-side exports for Next.js\n// Use this in client components (files with 'use client' directive)\n\n// Re-export everything from @basictech/react for client-side use\nexport {\n useBasic,\n BasicProvider,\n BasicDevToolbar,\n useQuery,\n RemoteDB,\n RemoteCollection,\n RemoteDBError,\n NotAuthenticatedError,\n STORAGE_KEYS\n} from \"@basictech/react\"\n\n// Re-export types (DBMode is also a type)\nexport type {\n AuthConfig,\n BasicStorage,\n LocalStorageAdapter,\n BasicProviderProps,\n BasicContextType,\n BasicSchemaDevInfo,\n BasicDevToolbarProps,\n AuthResult,\n BasicDB,\n Collection,\n RemoteDBConfig,\n AuthError\n} from \"@basictech/react\"\n\n// DBMode is a type-only export\nexport type { DBMode } from \"@basictech/react\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAUO;","names":[]}
|
package/dist/client.mjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import {
|
|
5
5
|
useBasic,
|
|
6
6
|
BasicProvider,
|
|
7
|
+
BasicDevToolbar,
|
|
7
8
|
useQuery,
|
|
8
9
|
RemoteDB,
|
|
9
10
|
RemoteCollection,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
STORAGE_KEYS
|
|
13
14
|
} from "@basictech/react";
|
|
14
15
|
export {
|
|
16
|
+
BasicDevToolbar,
|
|
15
17
|
BasicProvider,
|
|
16
18
|
NotAuthenticatedError,
|
|
17
19
|
RemoteCollection,
|
package/dist/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["'use client'\n\n// @basictech/nextjs/client - Client-side exports for Next.js\n// Use this in client components (files with 'use client' directive)\n\n// Re-export everything from @basictech/react for client-side use\nexport {\n useBasic,\n BasicProvider,\n useQuery,\n RemoteDB,\n RemoteCollection,\n RemoteDBError,\n NotAuthenticatedError,\n STORAGE_KEYS\n} from \"@basictech/react\"\n\n// Re-export types (DBMode is also a type)\nexport type {\n AuthConfig,\n BasicStorage,\n LocalStorageAdapter,\n BasicProviderProps,\n BasicContextType,\n AuthResult,\n BasicDB,\n Collection,\n RemoteDBConfig,\n AuthError\n} from \"@basictech/react\"\n\n// DBMode is a type-only export\nexport type { DBMode } from \"@basictech/react\"\n"],"mappings":";;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["'use client'\n\n// @basictech/nextjs/client - Client-side exports for Next.js\n// Use this in client components (files with 'use client' directive)\n\n// Re-export everything from @basictech/react for client-side use\nexport {\n useBasic,\n BasicProvider,\n BasicDevToolbar,\n useQuery,\n RemoteDB,\n RemoteCollection,\n RemoteDBError,\n NotAuthenticatedError,\n STORAGE_KEYS\n} from \"@basictech/react\"\n\n// Re-export types (DBMode is also a type)\nexport type {\n AuthConfig,\n BasicStorage,\n LocalStorageAdapter,\n BasicProviderProps,\n BasicContextType,\n BasicSchemaDevInfo,\n BasicDevToolbarProps,\n AuthResult,\n BasicDB,\n Collection,\n RemoteDBConfig,\n AuthError\n} from \"@basictech/react\"\n\n// DBMode is a type-only export\nexport type { DBMode } from \"@basictech/react\"\n"],"mappings":";;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
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/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.2",
|
|
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.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@repo/typescript-config": "*",
|
package/src/client.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export {
|
|
8
8
|
useBasic,
|
|
9
9
|
BasicProvider,
|
|
10
|
+
BasicDevToolbar,
|
|
10
11
|
useQuery,
|
|
11
12
|
RemoteDB,
|
|
12
13
|
RemoteCollection,
|
|
@@ -22,6 +23,8 @@ export type {
|
|
|
22
23
|
LocalStorageAdapter,
|
|
23
24
|
BasicProviderProps,
|
|
24
25
|
BasicContextType,
|
|
26
|
+
BasicSchemaDevInfo,
|
|
27
|
+
BasicDevToolbarProps,
|
|
25
28
|
AuthResult,
|
|
26
29
|
BasicDB,
|
|
27
30
|
Collection,
|