hazo_auth 9.0.0 → 9.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 -5
- package/SETUP_CHECKLIST.md +29 -0
- package/cli-src/lib/config/config_loader.server.ts +41 -3
- package/cli-src/lib/config/hazo_auth_core_config.ts +1 -1
- package/cli-src/lib/hazo_connect_setup.server.ts +20 -2
- package/config/hazo_auth_config.example.ini +3 -1
- package/dist/components/ui/input-otp.d.ts +2 -2
- package/dist/lib/config/config_loader.server.d.ts.map +1 -1
- package/dist/lib/config/config_loader.server.js +38 -3
- package/dist/lib/config/hazo_auth_core_config.js +1 -1
- package/dist/lib/hazo_connect_setup.server.d.ts +1 -0
- package/dist/lib/hazo_connect_setup.server.d.ts.map +1 -1
- package/dist/lib/hazo_connect_setup.server.js +15 -2
- package/dist/server/routes/user_management_users.d.ts +1 -1
- package/dist/server_pages/otp.js +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
A reusable authentication UI component package powered by Next.js, TailwindCSS, and shadcn. It integrates `hazo_config` for configuration management and `hazo_connect` for data access, enabling future components to stay aligned with platform conventions.
|
|
4
4
|
|
|
5
|
+
### What's New in v9.1.1 🔧
|
|
6
|
+
|
|
7
|
+
**Dev-server noise fixes for Next.js 16 + Turbopack**
|
|
8
|
+
|
|
9
|
+
- `next.config.mjs`: `hazo_core` and `hazo_config` added to `serverExternalPackages`. Turbopack was bundling hazo_config and breaking `ini.parse()` CJS interop, causing every config-section read to throw and producing `config_loader_read_section_failed` ×9 + `me_endpoint_error` per request.
|
|
10
|
+
- `config/hazo_auth_config.ini`: renamed `[log.overrides]` → `[log_overrides]`. The `ini` v4 library parses dots in section names as nesting separators, creating null-prototype objects that hazo_config cannot stringify. Dotted section names must be avoided.
|
|
11
|
+
- `src/lib/config/config_loader.server.ts`: `HazoConfig` instances are now memoized per resolved file path — one INI parse per server process instead of one per getter call.
|
|
12
|
+
- Companion fixes in hazo_core@1.0.3 (registerSingleton moved to module level, hazo_debug probe → lazy import) and hazo_config@2.1.9 (hazo_core/errors probe → lazy import, graceful skip of null-prototype nested objects in refresh()).
|
|
13
|
+
|
|
14
|
+
> **Action required if you use `[log.overrides]` in your app's config:** rename it to `[log_overrides]` (or any non-dotted name). This applies to any hazo_config-backed INI file, not just hazo_auth.
|
|
15
|
+
|
|
5
16
|
### What's New in v8.0.1 🔧
|
|
6
17
|
|
|
7
18
|
**Auto-test and middleware bug fixes**
|
|
@@ -207,7 +218,7 @@ See [CHANGE_LOG.md](./CHANGE_LOG.md) for detailed migration guide, rationale, an
|
|
|
207
218
|
|
|
208
219
|
```bash
|
|
209
220
|
# Install hazo_auth and required peer dependencies
|
|
210
|
-
npm install hazo_auth hazo_config hazo_connect hazo_logs next react react-dom next-auth
|
|
221
|
+
npm install hazo_auth hazo_core hazo_config hazo_connect hazo_logs next react react-dom next-auth
|
|
211
222
|
|
|
212
223
|
# UI peer dependencies (required if using hazo_auth UI components)
|
|
213
224
|
npm install hazo_ui lucide-react sonner next-themes @radix-ui/react-accordion @radix-ui/react-alert-dialog @radix-ui/react-avatar @radix-ui/react-checkbox @radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-hover-card @radix-ui/react-label @radix-ui/react-select @radix-ui/react-separator @radix-ui/react-slot @radix-ui/react-switch @radix-ui/react-tabs @radix-ui/react-tooltip
|
|
@@ -231,7 +242,7 @@ The fastest way to get started is using the CLI commands:
|
|
|
231
242
|
|
|
232
243
|
```bash
|
|
233
244
|
# 1. Install the package and peer dependencies
|
|
234
|
-
npm install hazo_auth hazo_config hazo_connect hazo_logs next react react-dom next-auth
|
|
245
|
+
npm install hazo_auth hazo_core hazo_config hazo_connect hazo_logs next react react-dom next-auth
|
|
235
246
|
|
|
236
247
|
# 2. Initialize your project (directories, config, database, images)
|
|
237
248
|
npx hazo_auth init
|
|
@@ -425,7 +436,7 @@ import { hazo_get_auth } from "hazo_auth/lib/auth/hazo_get_auth.server";
|
|
|
425
436
|
|
|
426
437
|
**Peer Dependencies (Required):**
|
|
427
438
|
```bash
|
|
428
|
-
npm install hazo_config hazo_connect hazo_logs
|
|
439
|
+
npm install hazo_core hazo_config hazo_connect hazo_logs
|
|
429
440
|
```
|
|
430
441
|
|
|
431
442
|
**UI Components:** All shadcn/ui components are bundled with hazo_auth. You do NOT need to install them separately.
|
|
@@ -2879,8 +2890,7 @@ Retrieves basic profile information for multiple users in a single batch call.
|
|
|
2879
2890
|
**Location:** `src/lib/services/user_profiles_service.ts`
|
|
2880
2891
|
|
|
2881
2892
|
```typescript
|
|
2882
|
-
import { hazo_get_user_profiles } from "hazo_auth/lib
|
|
2883
|
-
import { get_hazo_connect_instance } from "hazo_auth/server/hazo_connect_instance.server";
|
|
2893
|
+
import { hazo_get_user_profiles, get_hazo_connect_instance } from "hazo_auth/server-lib";
|
|
2884
2894
|
|
|
2885
2895
|
export async function GET(request: NextRequest) {
|
|
2886
2896
|
const adapter = get_hazo_connect_instance();
|
package/SETUP_CHECKLIST.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
This checklist provides step-by-step instructions for setting up the `hazo_auth` package in your Next.js project. AI assistants can follow this guide to ensure complete and correct setup.
|
|
4
4
|
|
|
5
|
+
## v9.1.1 — Next.js 16 / Turbopack setup (new installs and migrations)
|
|
6
|
+
|
|
7
|
+
### Add to `serverExternalPackages`
|
|
8
|
+
|
|
9
|
+
hazo_core and hazo_config use CJS dependencies (`ini`, optional peer probes) that Turbopack cannot bundle cleanly. Add them to the external packages list in `next.config.mjs` / `next.config.js`:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
const nextConfig = {
|
|
13
|
+
serverExternalPackages: [
|
|
14
|
+
"hazo_notify", "argon2",
|
|
15
|
+
"hazo_core", "hazo_config", // required for Next 16 + Turbopack
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Avoid dotted section names in INI config files
|
|
21
|
+
|
|
22
|
+
`ini` v4 parses dots in section headers as nesting separators (`[log.overrides]` becomes `parsed.log.overrides`). hazo_config uses flat sections — use underscores instead:
|
|
23
|
+
|
|
24
|
+
```ini
|
|
25
|
+
# Bad: creates a nested null-prototype object that hazo_config cannot stringify
|
|
26
|
+
[log.overrides]
|
|
27
|
+
|
|
28
|
+
# Good:
|
|
29
|
+
[log_overrides]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
5
34
|
## v8.0.0 Migration (from v7.x)
|
|
6
35
|
|
|
7
36
|
### Breaking changes
|
|
@@ -11,6 +11,15 @@ import { create_app_logger } from "../app_logger.js";
|
|
|
11
11
|
// section: constants
|
|
12
12
|
const DEFAULT_CONFIG_FILE = "config/hazo_auth_config.ini";
|
|
13
13
|
|
|
14
|
+
// section: config_instance_cache
|
|
15
|
+
// Cache HazoConfig instances by resolved file path so we never construct (and re-parse)
|
|
16
|
+
// more than one instance per config file per server process. This prevents repeated
|
|
17
|
+
// warnings when multiple getters read the same file in a single request, and eliminates
|
|
18
|
+
// redundant synchronous file I/O.
|
|
19
|
+
const _config_instance_cache = new Map<string, HazoConfig>();
|
|
20
|
+
// Track paths that failed to construct so we don't retry and warn repeatedly.
|
|
21
|
+
const _config_failed_paths = new Set<string>();
|
|
22
|
+
|
|
14
23
|
// section: helpers
|
|
15
24
|
/**
|
|
16
25
|
* Gets the default config file path
|
|
@@ -24,6 +33,35 @@ function get_config_file_path(custom_path?: string): string {
|
|
|
24
33
|
return path.resolve(process.cwd(), DEFAULT_CONFIG_FILE);
|
|
25
34
|
}
|
|
26
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Returns a cached HazoConfig instance for the given path, constructing one if needed.
|
|
38
|
+
* Returns null if construction fails (logs the error once on first failure).
|
|
39
|
+
*/
|
|
40
|
+
function get_config_instance(
|
|
41
|
+
config_path: string,
|
|
42
|
+
logger: ReturnType<typeof create_app_logger>,
|
|
43
|
+
): HazoConfig | null {
|
|
44
|
+
const cached = _config_instance_cache.get(config_path);
|
|
45
|
+
if (cached) return cached;
|
|
46
|
+
if (_config_failed_paths.has(config_path)) return null;
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const instance = new HazoConfig({ filePath: config_path });
|
|
50
|
+
_config_instance_cache.set(config_path, instance);
|
|
51
|
+
return instance;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
_config_failed_paths.add(config_path);
|
|
54
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
55
|
+
logger.warn("config_loader_construct_failed", {
|
|
56
|
+
filename: "config_loader.server.ts",
|
|
57
|
+
line_number: 0,
|
|
58
|
+
config_path,
|
|
59
|
+
error: error_message,
|
|
60
|
+
});
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
27
65
|
/**
|
|
28
66
|
* Reads a section from the config file
|
|
29
67
|
* @param section_name - Name of the section to read (e.g., "hazo_auth__register_layout")
|
|
@@ -41,10 +79,10 @@ export function read_config_section(
|
|
|
41
79
|
return undefined;
|
|
42
80
|
}
|
|
43
81
|
|
|
82
|
+
const hazo_config = get_config_instance(config_path, logger);
|
|
83
|
+
if (!hazo_config) return undefined;
|
|
84
|
+
|
|
44
85
|
try {
|
|
45
|
-
const hazo_config = new HazoConfig({
|
|
46
|
-
filePath: config_path,
|
|
47
|
-
});
|
|
48
86
|
return hazo_config.getSection(section_name);
|
|
49
87
|
} catch (error) {
|
|
50
88
|
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// file_description: Zod-validated config loader for hazo_auth core settings.
|
|
2
|
-
// Covers server-critical sections ([hazo_auth__tokens], [hazo_auth__cookies], [hazo_auth__rate_limit], [
|
|
2
|
+
// Covers server-critical sections ([hazo_auth__tokens], [hazo_auth__cookies], [hazo_auth__rate_limit], [log_overrides]).
|
|
3
3
|
// UI sections (login_layout, register_layout, etc.) are still handled by config_loader.server.ts.
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { loadConfig } from 'hazo_core';
|
|
@@ -22,6 +22,7 @@ import { read_config_section } from "./config/config_loader.server.js";
|
|
|
22
22
|
function get_hazo_connect_config(): {
|
|
23
23
|
type: "sqlite" | "postgrest";
|
|
24
24
|
sqlitePath?: string;
|
|
25
|
+
sqliteDriver?: "sql.js" | "better-sqlite3";
|
|
25
26
|
enableAdminUi: boolean;
|
|
26
27
|
readOnly?: boolean;
|
|
27
28
|
postgrestUrl?: string;
|
|
@@ -89,9 +90,19 @@ function get_hazo_connect_config(): {
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
// SQLite driver: 'sql.js' (default, WAL-unaware WASM) or 'better-sqlite3' (native, WAL-aware).
|
|
94
|
+
// Forwarded to hazo_connect's factory as sqlite.driver. Defaults to undefined so hazo_connect
|
|
95
|
+
// keeps its own default ('sql.js') when unset — no behavior change.
|
|
96
|
+
const sqlite_driver_raw =
|
|
97
|
+
hazo_connect_section?.sqlite_driver || process.env.HAZO_CONNECT_SQLITE_DRIVER;
|
|
98
|
+
const sqliteDriver: "sql.js" | "better-sqlite3" | undefined =
|
|
99
|
+
sqlite_driver_raw === "better-sqlite3" || sqlite_driver_raw === "sql.js"
|
|
100
|
+
? sqlite_driver_raw
|
|
101
|
+
: undefined;
|
|
102
|
+
|
|
92
103
|
// Validate config keys for typos
|
|
93
104
|
if (hazo_connect_section) {
|
|
94
|
-
const known_keys = ["type", "sqlite_path", "enable_admin_ui", "read_only", "postgrest_url"];
|
|
105
|
+
const known_keys = ["type", "sqlite_path", "sqlite_driver", "enable_admin_ui", "read_only", "postgrest_url"];
|
|
95
106
|
for (const key of Object.keys(hazo_connect_section)) {
|
|
96
107
|
if (!known_keys.includes(key)) {
|
|
97
108
|
// Simple similarity check for common typos
|
|
@@ -117,6 +128,7 @@ function get_hazo_connect_config(): {
|
|
|
117
128
|
return {
|
|
118
129
|
type: "sqlite",
|
|
119
130
|
sqlitePath: sqlite_path,
|
|
131
|
+
sqliteDriver,
|
|
120
132
|
enableAdminUi,
|
|
121
133
|
readOnly,
|
|
122
134
|
};
|
|
@@ -169,8 +181,12 @@ export function create_sqlite_hazo_connect_server() {
|
|
|
169
181
|
if (config.type === "sqlite") {
|
|
170
182
|
return createHazoConnect({
|
|
171
183
|
type: "sqlite",
|
|
172
|
-
database: config.sqlitePath!,
|
|
173
184
|
enable_admin_ui: config.enableAdminUi,
|
|
185
|
+
sqlite: {
|
|
186
|
+
database_path: config.sqlitePath!,
|
|
187
|
+
read_only: config.readOnly,
|
|
188
|
+
driver: config.sqliteDriver,
|
|
189
|
+
},
|
|
174
190
|
});
|
|
175
191
|
}
|
|
176
192
|
|
|
@@ -196,6 +212,7 @@ export function create_sqlite_hazo_connect_server() {
|
|
|
196
212
|
export function get_hazo_connect_config_options(): {
|
|
197
213
|
type?: "sqlite" | "postgrest";
|
|
198
214
|
sqlitePath?: string;
|
|
215
|
+
sqliteDriver?: "sql.js" | "better-sqlite3";
|
|
199
216
|
enableAdminUi?: boolean;
|
|
200
217
|
readOnly?: boolean;
|
|
201
218
|
baseUrl?: string;
|
|
@@ -207,6 +224,7 @@ export function get_hazo_connect_config_options(): {
|
|
|
207
224
|
return {
|
|
208
225
|
type: "sqlite",
|
|
209
226
|
sqlitePath: config.sqlitePath,
|
|
227
|
+
sqliteDriver: config.sqliteDriver,
|
|
210
228
|
enableAdminUi: config.enableAdminUi,
|
|
211
229
|
readOnly: config.readOnly,
|
|
212
230
|
};
|
|
@@ -732,6 +732,8 @@ company_name = My Company
|
|
|
732
732
|
; ── Log level overrides (per hazo_logs D-015) ────────────────────────────────
|
|
733
733
|
; Uncomment to tune log verbosity for specific namespaces.
|
|
734
734
|
; Format: namespace = TRACE | DEBUG | INFO | WARN | ERROR
|
|
735
|
-
[log.overrides]
|
|
735
|
+
; NOTE: use [log_overrides] not [log.overrides] — the ini library parses dots as
|
|
736
|
+
; nesting separators and would create a nested object that hazo_config cannot flatten.
|
|
737
|
+
[log_overrides]
|
|
736
738
|
; hazo_auth = DEBUG
|
|
737
739
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
2
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
3
3
|
value?: string;
|
|
4
4
|
onChange?: (newValue: string) => unknown;
|
|
5
5
|
maxLength: number;
|
|
@@ -12,7 +12,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
12
12
|
} & {
|
|
13
13
|
render: (props: import("input-otp").RenderProps) => React.ReactNode;
|
|
14
14
|
children?: never;
|
|
15
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
15
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
16
16
|
value?: string;
|
|
17
17
|
onChange?: (newValue: string) => unknown;
|
|
18
18
|
maxLength: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config_loader.server.d.ts","sourceRoot":"","sources":["../../../src/lib/config/config_loader.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config_loader.server.d.ts","sourceRoot":"","sources":["../../../src/lib/config/config_loader.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AA8DrB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAwBpC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAQR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAMR;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,OAAO,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAeR;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EAAE,EACvB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,EAAE,CAcV"}
|
|
@@ -8,6 +8,14 @@ import fs from "fs";
|
|
|
8
8
|
import { create_app_logger } from "../app_logger.js";
|
|
9
9
|
// section: constants
|
|
10
10
|
const DEFAULT_CONFIG_FILE = "config/hazo_auth_config.ini";
|
|
11
|
+
// section: config_instance_cache
|
|
12
|
+
// Cache HazoConfig instances by resolved file path so we never construct (and re-parse)
|
|
13
|
+
// more than one instance per config file per server process. This prevents repeated
|
|
14
|
+
// warnings when multiple getters read the same file in a single request, and eliminates
|
|
15
|
+
// redundant synchronous file I/O.
|
|
16
|
+
const _config_instance_cache = new Map();
|
|
17
|
+
// Track paths that failed to construct so we don't retry and warn repeatedly.
|
|
18
|
+
const _config_failed_paths = new Set();
|
|
11
19
|
// section: helpers
|
|
12
20
|
/**
|
|
13
21
|
* Gets the default config file path
|
|
@@ -20,6 +28,33 @@ function get_config_file_path(custom_path) {
|
|
|
20
28
|
}
|
|
21
29
|
return path.resolve(process.cwd(), DEFAULT_CONFIG_FILE);
|
|
22
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns a cached HazoConfig instance for the given path, constructing one if needed.
|
|
33
|
+
* Returns null if construction fails (logs the error once on first failure).
|
|
34
|
+
*/
|
|
35
|
+
function get_config_instance(config_path, logger) {
|
|
36
|
+
const cached = _config_instance_cache.get(config_path);
|
|
37
|
+
if (cached)
|
|
38
|
+
return cached;
|
|
39
|
+
if (_config_failed_paths.has(config_path))
|
|
40
|
+
return null;
|
|
41
|
+
try {
|
|
42
|
+
const instance = new HazoConfig({ filePath: config_path });
|
|
43
|
+
_config_instance_cache.set(config_path, instance);
|
|
44
|
+
return instance;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
_config_failed_paths.add(config_path);
|
|
48
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
49
|
+
logger.warn("config_loader_construct_failed", {
|
|
50
|
+
filename: "config_loader.server.ts",
|
|
51
|
+
line_number: 0,
|
|
52
|
+
config_path,
|
|
53
|
+
error: error_message,
|
|
54
|
+
});
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
23
58
|
/**
|
|
24
59
|
* Reads a section from the config file
|
|
25
60
|
* @param section_name - Name of the section to read (e.g., "hazo_auth__register_layout")
|
|
@@ -32,10 +67,10 @@ export function read_config_section(section_name, file_path) {
|
|
|
32
67
|
if (!fs.existsSync(config_path)) {
|
|
33
68
|
return undefined;
|
|
34
69
|
}
|
|
70
|
+
const hazo_config = get_config_instance(config_path, logger);
|
|
71
|
+
if (!hazo_config)
|
|
72
|
+
return undefined;
|
|
35
73
|
try {
|
|
36
|
-
const hazo_config = new HazoConfig({
|
|
37
|
-
filePath: config_path,
|
|
38
|
-
});
|
|
39
74
|
return hazo_config.getSection(section_name);
|
|
40
75
|
}
|
|
41
76
|
catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// file_description: Zod-validated config loader for hazo_auth core settings.
|
|
2
|
-
// Covers server-critical sections ([hazo_auth__tokens], [hazo_auth__cookies], [hazo_auth__rate_limit], [
|
|
2
|
+
// Covers server-critical sections ([hazo_auth__tokens], [hazo_auth__cookies], [hazo_auth__rate_limit], [log_overrides]).
|
|
3
3
|
// UI sections (login_layout, register_layout, etc.) are still handled by config_loader.server.ts.
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { loadConfig } from 'hazo_core';
|
|
@@ -13,6 +13,7 @@ export declare function create_sqlite_hazo_connect_server(): import("hazo_connec
|
|
|
13
13
|
export declare function get_hazo_connect_config_options(): {
|
|
14
14
|
type?: "sqlite" | "postgrest";
|
|
15
15
|
sqlitePath?: string;
|
|
16
|
+
sqliteDriver?: "sql.js" | "better-sqlite3";
|
|
16
17
|
enableAdminUi?: boolean;
|
|
17
18
|
readOnly?: boolean;
|
|
18
19
|
baseUrl?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hazo_connect_setup.server.d.ts","sourceRoot":"","sources":["../../src/lib/hazo_connect_setup.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"hazo_connect_setup.server.d.ts","sourceRoot":"","sources":["../../src/lib/hazo_connect_setup.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AA0KrB;;;;GAIG;AACH,wBAAgB,iCAAiC,8CA2BhD;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI;IACjD,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IAC3C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAuBA"}
|
|
@@ -60,9 +60,16 @@ function get_hazo_connect_config() {
|
|
|
60
60
|
"or set HAZO_CONNECT_SQLITE_PATH environment variable.",
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
+
// SQLite driver: 'sql.js' (default, WAL-unaware WASM) or 'better-sqlite3' (native, WAL-aware).
|
|
64
|
+
// Forwarded to hazo_connect's factory as sqlite.driver. Defaults to undefined so hazo_connect
|
|
65
|
+
// keeps its own default ('sql.js') when unset — no behavior change.
|
|
66
|
+
const sqlite_driver_raw = (hazo_connect_section === null || hazo_connect_section === void 0 ? void 0 : hazo_connect_section.sqlite_driver) || process.env.HAZO_CONNECT_SQLITE_DRIVER;
|
|
67
|
+
const sqliteDriver = sqlite_driver_raw === "better-sqlite3" || sqlite_driver_raw === "sql.js"
|
|
68
|
+
? sqlite_driver_raw
|
|
69
|
+
: undefined;
|
|
63
70
|
// Validate config keys for typos
|
|
64
71
|
if (hazo_connect_section) {
|
|
65
|
-
const known_keys = ["type", "sqlite_path", "enable_admin_ui", "read_only", "postgrest_url"];
|
|
72
|
+
const known_keys = ["type", "sqlite_path", "sqlite_driver", "enable_admin_ui", "read_only", "postgrest_url"];
|
|
66
73
|
for (const key of Object.keys(hazo_connect_section)) {
|
|
67
74
|
if (!known_keys.includes(key)) {
|
|
68
75
|
// Simple similarity check for common typos
|
|
@@ -86,6 +93,7 @@ function get_hazo_connect_config() {
|
|
|
86
93
|
return {
|
|
87
94
|
type: "sqlite",
|
|
88
95
|
sqlitePath: sqlite_path,
|
|
96
|
+
sqliteDriver,
|
|
89
97
|
enableAdminUi,
|
|
90
98
|
readOnly,
|
|
91
99
|
};
|
|
@@ -130,8 +138,12 @@ export function create_sqlite_hazo_connect_server() {
|
|
|
130
138
|
if (config.type === "sqlite") {
|
|
131
139
|
return createHazoConnect({
|
|
132
140
|
type: "sqlite",
|
|
133
|
-
database: config.sqlitePath,
|
|
134
141
|
enable_admin_ui: config.enableAdminUi,
|
|
142
|
+
sqlite: {
|
|
143
|
+
database_path: config.sqlitePath,
|
|
144
|
+
read_only: config.readOnly,
|
|
145
|
+
driver: config.sqliteDriver,
|
|
146
|
+
},
|
|
135
147
|
});
|
|
136
148
|
}
|
|
137
149
|
if (config.type === "postgrest") {
|
|
@@ -156,6 +168,7 @@ export function get_hazo_connect_config_options() {
|
|
|
156
168
|
return {
|
|
157
169
|
type: "sqlite",
|
|
158
170
|
sqlitePath: config.sqlitePath,
|
|
171
|
+
sqliteDriver: config.sqliteDriver,
|
|
159
172
|
enableAdminUi: config.enableAdminUi,
|
|
160
173
|
readOnly: config.readOnly,
|
|
161
174
|
};
|
|
@@ -26,7 +26,7 @@ export declare function GET(request: NextRequest): Promise<NextResponse<{
|
|
|
26
26
|
profile_source: {} | null;
|
|
27
27
|
user_type: string | null;
|
|
28
28
|
app_user_data: Record<string, unknown> | null;
|
|
29
|
-
legal_acceptance_status: "
|
|
29
|
+
legal_acceptance_status: "none" | "current" | "outdated";
|
|
30
30
|
}[];
|
|
31
31
|
}>>;
|
|
32
32
|
/**
|
package/dist/server_pages/otp.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
// file_description: Zero-config OTPPage server component - drop in and use with no configuration required
|
|
3
3
|
// section: server-only-guard
|
|
4
4
|
import "server-only";
|
|
5
|
-
import { OTPLayout } from "../components/layouts/otp.js";
|
|
5
|
+
import { OTPLayout } from "../components/layouts/otp/index.js";
|
|
6
6
|
import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
|
|
7
7
|
import { DEFAULT_STRINGS, readStrings } from "../strings.js";
|
|
8
8
|
// section: component
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_auth",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.1",
|
|
4
4
|
"description": "Zero-config authentication UI components for Next.js with RBAC, OAuth, scope-based multi-tenancy, and invitations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -253,12 +253,12 @@
|
|
|
253
253
|
"@radix-ui/react-tabs": "^1.1.0",
|
|
254
254
|
"@radix-ui/react-tooltip": "^1.2.0",
|
|
255
255
|
"hazo_api": "^2.1.0",
|
|
256
|
-
"hazo_config": "^2.1.
|
|
257
|
-
"hazo_connect": "^3.
|
|
256
|
+
"hazo_config": "^2.1.6",
|
|
257
|
+
"hazo_connect": "^3.2.0",
|
|
258
258
|
"hazo_core": "^1.0.0",
|
|
259
|
-
"hazo_logs": "^2.0.
|
|
260
|
-
"hazo_notify": "^6.
|
|
261
|
-
"hazo_ui": "^3.1.
|
|
259
|
+
"hazo_logs": "^2.0.2",
|
|
260
|
+
"hazo_notify": "^6.1.0",
|
|
261
|
+
"hazo_ui": "^3.1.3",
|
|
262
262
|
"input-otp": "^1.4.0",
|
|
263
263
|
"lucide-react": "^0.553.0",
|
|
264
264
|
"next": "^14.0.0",
|
|
@@ -388,13 +388,13 @@
|
|
|
388
388
|
"eslint": "^9.39.1",
|
|
389
389
|
"eslint-config-next": "^16.0.4",
|
|
390
390
|
"eslint-plugin-storybook": "^10.0.6",
|
|
391
|
-
"hazo_api": "^2.
|
|
392
|
-
"hazo_config": "^2.1.
|
|
393
|
-
"hazo_connect": "^3.
|
|
394
|
-
"hazo_core": "^1.0.
|
|
395
|
-
"hazo_logs": "^2.0.
|
|
396
|
-
"hazo_notify": "^6.
|
|
397
|
-
"hazo_ui": "^3.1
|
|
391
|
+
"hazo_api": "^2.3.0",
|
|
392
|
+
"hazo_config": "^2.1.9",
|
|
393
|
+
"hazo_connect": "^3.2.0",
|
|
394
|
+
"hazo_core": "^1.0.3",
|
|
395
|
+
"hazo_logs": "^2.0.3",
|
|
396
|
+
"hazo_notify": "^6.1.3",
|
|
397
|
+
"hazo_ui": "^3.2.1",
|
|
398
398
|
"input-otp": "^1.4.0",
|
|
399
399
|
"jest": "^30.2.0",
|
|
400
400
|
"jest-environment-jsdom": "^30.0.0",
|