@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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @basictech/nextjs@0.6.0 build
3
+ > @basictech/nextjs@0.7.0-beta.1 build
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: src/client.ts, src/index.ts
@@ -11,20 +11,20 @@
11
11
  CLI Cleaning output folder
12
12
  CJS Build start
13
13
  ESM Build start
14
- ESM dist/client.mjs 375.00 B
15
- ESM dist/index.mjs 2.22 KB
16
- ESM dist/client.mjs.map 933.00 B
17
- ESM dist/index.mjs.map 6.68 KB
18
- ESM ⚡️ Build success in 11ms
19
- CJS dist/client.js 1.60 KB
14
+ CJS dist/client.js 1.67 KB
20
15
  CJS dist/index.js 3.43 KB
21
- CJS dist/client.js.map 927.00 B
16
+ CJS dist/client.js.map 1000.00 B
22
17
  CJS dist/index.js.map 7.77 KB
23
- CJS ⚡️ Build success in 11ms
18
+ CJS ⚡️ Build success in 23ms
19
+ ESM dist/index.mjs 2.22 KB
20
+ ESM dist/client.mjs 413.00 B
21
+ ESM dist/index.mjs.map 6.68 KB
22
+ ESM dist/client.mjs.map 1011.00 B
23
+ ESM ⚡️ Build success in 23ms
24
24
  DTS Build start
25
- DTS ⚡️ Build success in 1193ms
26
- DTS dist/client.d.ts 303.00 B
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 303.00 B
28
+ DTS dist/client.d.mts 362.00 B
29
29
  DTS dist/index.d.mts 2.48 KB
30
30
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @basictech/nextjs
2
2
 
3
+ ## 0.7.0-beta.2
4
+
5
+ ### Minor Changes
6
+
7
+ - added debug bar
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @basictech/react@0.8.0-beta.2
13
+
3
14
  ## 0.7.0-beta.1
4
15
 
5
16
  ### Minor Changes
@@ -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';
@@ -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,
@@ -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,mBASO;","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":";;;;;;;;;;;;;;;;;;;;;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,
@@ -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":[]}
@@ -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 };
@@ -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.1",
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.1"
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,