@basictech/nextjs 0.6.0-beta.7 → 0.7.0-beta.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/.turbo/turbo-build.log +14 -13
- package/CHANGELOG.md +44 -2
- package/dist/index.js +3 -3
- package/package.json +4 -5
- 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/src/components.tsx +0 -85
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @basictech/nextjs@0.6.0
|
|
3
|
+
> @basictech/nextjs@0.6.0 build
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
|
-
[34mCLI[39m Building entry: src/
|
|
6
|
+
[34mCLI[39m Building entry: src/client.ts, src/index.ts
|
|
7
7
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
-
[34mCLI[39m tsup
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
9
|
[34mCLI[39m Using tsup config: /Users/raz/codebook/basic/libs/client-ts/packages/nextjs/tsup.config.ts
|
|
10
10
|
[34mCLI[39m Target: es2022
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m2.22 KB[39m
|
|
15
14
|
[32mESM[39m [1mdist/client.mjs [22m[32m375.00 B[39m
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m2.22 KB[39m
|
|
17
16
|
[32mESM[39m [1mdist/client.mjs.map [22m[32m933.00 B[39m
|
|
18
|
-
[32mESM[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m6.68 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 11ms
|
|
19
19
|
[32mCJS[39m [1mdist/client.js [22m[32m1.60 KB[39m
|
|
20
20
|
[32mCJS[39m [1mdist/index.js [22m[32m3.43 KB[39m
|
|
21
21
|
[32mCJS[39m [1mdist/client.js.map [22m[32m927.00 B[39m
|
|
22
22
|
[32mCJS[39m [1mdist/index.js.map [22m[32m7.77 KB[39m
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 11ms
|
|
24
|
+
DTS Build start
|
|
25
|
+
DTS ⚡️ Build success in 1193ms
|
|
26
|
+
DTS dist/client.d.ts 303.00 B
|
|
27
|
+
DTS dist/index.d.ts 2.48 KB
|
|
28
|
+
DTS dist/client.d.mts 303.00 B
|
|
29
|
+
DTS dist/index.d.mts 2.48 KB
|
|
30
|
+
⠙[1G[0K
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @basictech/nextjs
|
|
2
2
|
|
|
3
|
+
## 0.7.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- uth updates
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @basictech/react@0.8.0-beta.1
|
|
13
|
+
|
|
14
|
+
## 0.6.1-beta.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @basictech/react@0.8.0-beta.0
|
|
20
|
+
|
|
21
|
+
## 0.6.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- 6a506e9: api improvements, react refactor, nextjs update
|
|
26
|
+
- e45744e: storage adapater update
|
|
27
|
+
- update apis, add remote db + sync db
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- cdf7123: refresh token patch
|
|
32
|
+
- 7e68aa3: add oauth settings
|
|
33
|
+
- 841839f: fix: provider props
|
|
34
|
+
- 7e68aa3: update token endpoint
|
|
35
|
+
- 4f11b3e: config server url & token patch
|
|
36
|
+
- Updated dependencies [cdf7123]
|
|
37
|
+
- Updated dependencies [7e68aa3]
|
|
38
|
+
- Updated dependencies [6a506e9]
|
|
39
|
+
- Updated dependencies [841839f]
|
|
40
|
+
- Updated dependencies [e45744e]
|
|
41
|
+
- Updated dependencies [e45744e]
|
|
42
|
+
- Updated dependencies [7e68aa3]
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
- Updated dependencies [4f11b3e]
|
|
45
|
+
- @basictech/react@0.7.0
|
|
46
|
+
|
|
3
47
|
## 0.6.0-beta.7
|
|
4
48
|
|
|
5
49
|
### Minor Changes
|
|
@@ -235,7 +279,6 @@
|
|
|
235
279
|
- 96e0156: update schema validation
|
|
236
280
|
- cda3d16: add schema validation
|
|
237
281
|
- 2c898ae: update useQuery hook
|
|
238
|
-
|
|
239
282
|
- no need to pass param as a function, can now enter query directly
|
|
240
283
|
- defaults to empty array when loading
|
|
241
284
|
|
|
@@ -316,7 +359,6 @@
|
|
|
316
359
|
### Minor Changes
|
|
317
360
|
|
|
318
361
|
- update useQuery hook
|
|
319
|
-
|
|
320
362
|
- no need to pass param as a function, can now enter query directly
|
|
321
363
|
- defaults to empty array when loading
|
|
322
364
|
|
package/dist/index.js
CHANGED
|
@@ -18,14 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
createBasicMiddleware: () => createBasicMiddleware,
|
|
24
24
|
getAuthFromRequest: () => getAuthFromRequest,
|
|
25
25
|
getReturnUrl: () => getReturnUrl,
|
|
26
26
|
withBasicAuth: () => withBasicAuth
|
|
27
27
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
30
30
|
// src/middleware.ts
|
|
31
31
|
var import_server = require("next/server");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basictech/nextjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -38,14 +38,13 @@
|
|
|
38
38
|
"author": "",
|
|
39
39
|
"license": "ISC",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@basictech/react": "0.
|
|
42
|
-
"@radix-ui/react-avatar": "^1.1.1",
|
|
43
|
-
"@radix-ui/react-popover": "^1.1.2"
|
|
41
|
+
"@basictech/react": "0.8.0-beta.1"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
44
|
"@repo/typescript-config": "*",
|
|
47
45
|
"@types/uuid": "^10.0.0",
|
|
48
|
-
"
|
|
46
|
+
"next": "^14.2.0",
|
|
47
|
+
"tsup": "^8.0.0",
|
|
49
48
|
"typescript": "^5.0.0"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
package/dist/client.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AuthConfig, AuthError, AuthResult, BasicContextType, BasicDB, BasicProvider, BasicProviderProps, 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, BasicProvider, BasicProviderProps, 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 { 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 { BasicMiddlewareConfig, createBasicMiddleware, getAuthFromRequest, getReturnUrl, withBasicAuth };
|
package/src/components.tsx
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as Avatar from '@radix-ui/react-avatar';
|
|
3
|
-
import * as Popover from '@radix-ui/react-popover';
|
|
4
|
-
|
|
5
|
-
const LoginButton = () => {
|
|
6
|
-
return (
|
|
7
|
-
<Popover.Root>
|
|
8
|
-
{/* Trigger: Avatar that will be clicked */}
|
|
9
|
-
<Popover.Trigger asChild>
|
|
10
|
-
<Avatar.Root style={avatarContainerStyle}>
|
|
11
|
-
<Avatar.Image
|
|
12
|
-
src="https://via.placeholder.com/150"
|
|
13
|
-
alt="User Avatar"
|
|
14
|
-
style={avatarImageStyle}
|
|
15
|
-
/>
|
|
16
|
-
<Avatar.Fallback delayMs={600} style={avatarFallbackStyle}>
|
|
17
|
-
U
|
|
18
|
-
</Avatar.Fallback>
|
|
19
|
-
</Avatar.Root>
|
|
20
|
-
</Popover.Trigger>
|
|
21
|
-
|
|
22
|
-
{/* Popover content */}
|
|
23
|
-
<Popover.Portal>
|
|
24
|
-
<Popover.Content style={popoverContentStyle} sideOffset={10}>
|
|
25
|
-
<p style={{ marginBottom: '10px' }}>Hello, User!</p>
|
|
26
|
-
<button style={buttonStyle}>Logout</button>
|
|
27
|
-
<Popover.Arrow style={popoverArrowStyle} />
|
|
28
|
-
</Popover.Content>
|
|
29
|
-
</Popover.Portal>
|
|
30
|
-
</Popover.Root>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// Basic styles
|
|
35
|
-
const avatarContainerStyle: React.CSSProperties = {
|
|
36
|
-
display: 'inline-flex',
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
justifyContent: 'center',
|
|
39
|
-
width: '40px',
|
|
40
|
-
height: '40px',
|
|
41
|
-
borderRadius: '100%',
|
|
42
|
-
backgroundColor: '#ccc',
|
|
43
|
-
cursor: 'pointer',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const avatarImageStyle: React.CSSProperties = {
|
|
47
|
-
width: '100%',
|
|
48
|
-
height: '100%',
|
|
49
|
-
borderRadius: '100%',
|
|
50
|
-
objectFit: 'cover',
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const avatarFallbackStyle: React.CSSProperties = {
|
|
54
|
-
width: '100%',
|
|
55
|
-
height: '100%',
|
|
56
|
-
borderRadius: '100%',
|
|
57
|
-
backgroundColor: '#007bff',
|
|
58
|
-
color: 'white',
|
|
59
|
-
display: 'flex',
|
|
60
|
-
alignItems: 'center',
|
|
61
|
-
justifyContent: 'center',
|
|
62
|
-
fontSize: '20px',
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const popoverContentStyle: React.CSSProperties = {
|
|
66
|
-
padding: '20px',
|
|
67
|
-
borderRadius: '8px',
|
|
68
|
-
backgroundColor: 'white',
|
|
69
|
-
boxShadow: '0 2px 10px rgba(0, 0, 0, 0.2)',
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const buttonStyle: React.CSSProperties = {
|
|
73
|
-
padding: '8px 16px',
|
|
74
|
-
backgroundColor: '#007bff',
|
|
75
|
-
color: '#fff',
|
|
76
|
-
border: 'none',
|
|
77
|
-
borderRadius: '4px',
|
|
78
|
-
cursor: 'pointer',
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const popoverArrowStyle: React.CSSProperties = {
|
|
82
|
-
fill: 'white',
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default LoginButton;
|