@vertz/db 0.2.0

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.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @vertz/db diagnostic utilities.
3
+ *
4
+ * Maps common error patterns to human-readable explanations.
5
+ * Useful for developers and LLMs understanding type errors and runtime exceptions.
6
+ *
7
+ * @module
8
+ */
9
+ interface DiagnosticResult {
10
+ /** Short identifier for the error pattern. */
11
+ readonly code: string;
12
+ /** Human-readable explanation of the error. */
13
+ readonly explanation: string;
14
+ /** Suggested fix or next step. */
15
+ readonly suggestion: string;
16
+ }
17
+ /**
18
+ * Analyzes an error message and returns a human-readable diagnostic.
19
+ *
20
+ * Works with both TypeScript type error messages (from the branded types)
21
+ * and runtime DbError messages.
22
+ *
23
+ * @param message - The error message string to analyze
24
+ * @returns A DiagnosticResult if the pattern is recognized, or null
25
+ */
26
+ declare function diagnoseError(message: string): DiagnosticResult | null;
27
+ /**
28
+ * Formats a diagnostic result as a multi-line string for display.
29
+ *
30
+ * @param diag - The diagnostic result to format
31
+ * @returns A formatted string with the error code, explanation, and suggestion
32
+ */
33
+ declare function formatDiagnostic(diag: DiagnosticResult): string;
34
+ /**
35
+ * Convenience: diagnose and format in one step.
36
+ *
37
+ * @param message - The error message to analyze
38
+ * @returns Formatted diagnostic string, or a fallback message
39
+ */
40
+ declare function explainError(message: string): string;
41
+ export { formatDiagnostic, explainError, diagnoseError, DiagnosticResult };
@@ -0,0 +1,10 @@
1
+ import {
2
+ diagnoseError,
3
+ explainError,
4
+ formatDiagnostic
5
+ } from "../shared/chunk-wj026daz.js";
6
+ export {
7
+ formatDiagnostic,
8
+ explainError,
9
+ diagnoseError
10
+ };