@spfn/core 0.1.0-alpha.8 → 0.1.0-alpha.82

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.
Files changed (61) hide show
  1. package/README.md +169 -195
  2. package/dist/auto-loader-JFaZ9gON.d.ts +80 -0
  3. package/dist/cache/index.d.ts +211 -0
  4. package/dist/cache/index.js +1013 -0
  5. package/dist/cache/index.js.map +1 -0
  6. package/dist/client/index.d.ts +131 -92
  7. package/dist/client/index.js +93 -85
  8. package/dist/client/index.js.map +1 -1
  9. package/dist/codegen/generators/index.d.ts +19 -0
  10. package/dist/codegen/generators/index.js +1521 -0
  11. package/dist/codegen/generators/index.js.map +1 -0
  12. package/dist/codegen/index.d.ts +76 -60
  13. package/dist/codegen/index.js +1506 -735
  14. package/dist/codegen/index.js.map +1 -1
  15. package/dist/database-errors-BNNmLTJE.d.ts +86 -0
  16. package/dist/db/index.d.ts +844 -44
  17. package/dist/db/index.js +1281 -1307
  18. package/dist/db/index.js.map +1 -1
  19. package/dist/env/index.d.ts +508 -0
  20. package/dist/env/index.js +1127 -0
  21. package/dist/env/index.js.map +1 -0
  22. package/dist/errors/index.d.ts +136 -0
  23. package/dist/errors/index.js +172 -0
  24. package/dist/errors/index.js.map +1 -0
  25. package/dist/index-DHiAqhKv.d.ts +101 -0
  26. package/dist/index.d.ts +3 -374
  27. package/dist/index.js +2424 -2178
  28. package/dist/index.js.map +1 -1
  29. package/dist/logger/index.d.ts +94 -0
  30. package/dist/logger/index.js +795 -0
  31. package/dist/logger/index.js.map +1 -0
  32. package/dist/middleware/index.d.ts +60 -0
  33. package/dist/middleware/index.js +918 -0
  34. package/dist/middleware/index.js.map +1 -0
  35. package/dist/route/index.d.ts +21 -53
  36. package/dist/route/index.js +1259 -219
  37. package/dist/route/index.js.map +1 -1
  38. package/dist/server/index.d.ts +18 -0
  39. package/dist/server/index.js +2419 -2059
  40. package/dist/server/index.js.map +1 -1
  41. package/dist/types/index.d.ts +121 -0
  42. package/dist/types/index.js +38 -0
  43. package/dist/types/index.js.map +1 -0
  44. package/dist/types-BXibIEyj.d.ts +60 -0
  45. package/package.json +67 -17
  46. package/dist/auto-loader-C44TcLmM.d.ts +0 -125
  47. package/dist/bind-pssq1NRT.d.ts +0 -34
  48. package/dist/postgres-errors-CY_Es8EJ.d.ts +0 -1703
  49. package/dist/scripts/index.d.ts +0 -24
  50. package/dist/scripts/index.js +0 -1201
  51. package/dist/scripts/index.js.map +0 -1
  52. package/dist/scripts/templates/api-index.template.txt +0 -10
  53. package/dist/scripts/templates/api-tag.template.txt +0 -11
  54. package/dist/scripts/templates/contract.template.txt +0 -87
  55. package/dist/scripts/templates/entity-type.template.txt +0 -31
  56. package/dist/scripts/templates/entity.template.txt +0 -19
  57. package/dist/scripts/templates/index.template.txt +0 -10
  58. package/dist/scripts/templates/repository.template.txt +0 -37
  59. package/dist/scripts/templates/routes-id.template.txt +0 -59
  60. package/dist/scripts/templates/routes-index.template.txt +0 -44
  61. package/dist/types-SlzTr8ZO.d.ts +0 -143
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Database Error Classes
3
+ *
4
+ * Type-safe error handling with custom error class hierarchy
5
+ * Mapped to HTTP status codes for API responses
6
+ */
7
+ /**
8
+ * Base Database Error
9
+ *
10
+ * Base class for all database-related errors
11
+ */
12
+ declare class DatabaseError<TDetails extends Record<string, unknown> = Record<string, unknown>> extends Error {
13
+ readonly statusCode: number;
14
+ readonly details?: TDetails;
15
+ readonly timestamp: Date;
16
+ constructor(message: string, statusCode?: number, details?: TDetails);
17
+ /**
18
+ * Serialize error for API response
19
+ */
20
+ toJSON(): {
21
+ name: string;
22
+ message: string;
23
+ statusCode: number;
24
+ details: TDetails | undefined;
25
+ timestamp: string;
26
+ };
27
+ }
28
+ /**
29
+ * Connection Error (503 Service Unavailable)
30
+ *
31
+ * Database connection failure, connection pool exhaustion, etc.
32
+ */
33
+ declare class ConnectionError extends DatabaseError {
34
+ constructor(message: string, details?: Record<string, any>);
35
+ }
36
+ /**
37
+ * Query Error (500 Internal Server Error)
38
+ *
39
+ * SQL query execution failure, syntax errors, etc.
40
+ */
41
+ declare class QueryError extends DatabaseError {
42
+ constructor(message: string, statusCode?: number, details?: Record<string, any>);
43
+ }
44
+ /**
45
+ * Entity Not Found Error (404 Not Found)
46
+ *
47
+ * Database entity does not exist
48
+ */
49
+ declare class EntityNotFoundError extends QueryError {
50
+ constructor(resource: string, id: string | number);
51
+ }
52
+ /**
53
+ * Constraint Violation Error (400 Bad Request)
54
+ *
55
+ * Database constraint violation (NOT NULL, CHECK, FOREIGN KEY, etc.)
56
+ * This is different from HTTP ValidationError which validates request input
57
+ */
58
+ declare class ConstraintViolationError extends QueryError {
59
+ constructor(message: string, details?: Record<string, any>);
60
+ }
61
+ /**
62
+ * Transaction Error (500 Internal Server Error)
63
+ *
64
+ * Transaction start/commit/rollback failure
65
+ */
66
+ declare class TransactionError extends DatabaseError {
67
+ constructor(message: string, statusCode?: number, details?: Record<string, any>);
68
+ }
69
+ /**
70
+ * Deadlock Error (409 Conflict)
71
+ *
72
+ * Database deadlock detected
73
+ */
74
+ declare class DeadlockError extends TransactionError {
75
+ constructor(message: string, details?: Record<string, any>);
76
+ }
77
+ /**
78
+ * Duplicate Entry Error (409 Conflict)
79
+ *
80
+ * Unique constraint violation (e.g., duplicate email)
81
+ */
82
+ declare class DuplicateEntryError extends QueryError {
83
+ constructor(field: string, value: string | number);
84
+ }
85
+
86
+ export { ConnectionError as C, DatabaseError as D, EntityNotFoundError as E, QueryError as Q, TransactionError as T, ConstraintViolationError as a, DeadlockError as b, DuplicateEntryError as c };