@nextlyhq/adapter-drizzle 0.0.2-alpha.68 → 0.0.2-alpha.69

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 (63) hide show
  1. package/dist/adapter-BypoOEEN.d.cts +1166 -0
  2. package/dist/adapter-CSP-Ek-L.d.ts +1166 -0
  3. package/dist/index-BYb6cDli.d.ts +1168 -0
  4. package/dist/index-C4HJsfwA.d.cts +1168 -0
  5. package/dist/index.cjs +2258 -2183
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +5 -10
  8. package/dist/index.d.ts +5 -10
  9. package/dist/index.mjs +2257 -2181
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/migrations.cjs +345 -146
  12. package/dist/migrations.cjs.map +1 -1
  13. package/dist/migrations.d.cts +93 -110
  14. package/dist/migrations.d.ts +93 -110
  15. package/dist/migrations.mjs +344 -144
  16. package/dist/migrations.mjs.map +1 -1
  17. package/dist/schema/index.cjs +21 -6
  18. package/dist/schema/index.cjs.map +1 -1
  19. package/dist/schema/index.d.cts +5 -116
  20. package/dist/schema/index.d.ts +5 -116
  21. package/dist/schema/index.mjs +20 -4
  22. package/dist/schema/index.mjs.map +1 -1
  23. package/dist/schema-Bkkr3JMC.d.cts +264 -0
  24. package/dist/schema-Bkkr3JMC.d.ts +264 -0
  25. package/dist/schema-name.cjs +34 -12
  26. package/dist/schema-name.cjs.map +1 -1
  27. package/dist/schema-name.d.cts +3 -15
  28. package/dist/schema-name.d.ts +3 -15
  29. package/dist/schema-name.mjs +33 -10
  30. package/dist/schema-name.mjs.map +1 -1
  31. package/dist/text-match.cjs +42 -8
  32. package/dist/text-match.cjs.map +1 -1
  33. package/dist/text-match.d.cts +4 -16
  34. package/dist/text-match.d.ts +4 -16
  35. package/dist/text-match.mjs +41 -6
  36. package/dist/text-match.mjs.map +1 -1
  37. package/dist/types/index.cjs +8 -69
  38. package/dist/types/index.d.cts +3 -225
  39. package/dist/types/index.d.ts +3 -225
  40. package/dist/types/index.mjs +1 -64
  41. package/dist/types-CNyA1oIm.cjs +185 -0
  42. package/dist/types-CNyA1oIm.cjs.map +1 -0
  43. package/dist/types-CaF_5jNk.mjs +150 -0
  44. package/dist/types-CaF_5jNk.mjs.map +1 -0
  45. package/dist/version-check.cjs +116 -133
  46. package/dist/version-check.cjs.map +1 -1
  47. package/dist/version-check.d.cts +46 -47
  48. package/dist/version-check.d.ts +46 -47
  49. package/dist/version-check.mjs +115 -131
  50. package/dist/version-check.mjs.map +1 -1
  51. package/package.json +12 -16
  52. package/dist/adapter-bUAaPzjV.d.cts +0 -1143
  53. package/dist/adapter-iJ5hbUvL.d.ts +0 -1143
  54. package/dist/core-CVO7WYDj.d.cts +0 -74
  55. package/dist/core-CVO7WYDj.d.ts +0 -74
  56. package/dist/error-BrdknH2s.d.cts +0 -122
  57. package/dist/error-BrdknH2s.d.ts +0 -122
  58. package/dist/migration-BqHebSwM.d.ts +0 -831
  59. package/dist/migration-Bu0WLdX4.d.cts +0 -831
  60. package/dist/schema-BDn8WfSL.d.cts +0 -200
  61. package/dist/schema-BIQ0YQZ_.d.ts +0 -200
  62. package/dist/types/index.cjs.map +0 -1
  63. package/dist/types/index.mjs.map +0 -1
@@ -1,74 +0,0 @@
1
- /**
2
- * Core type definitions for the Nextly database adapter system.
3
- *
4
- * These types are the foundation for all database operations and are designed
5
- * to be database-agnostic while supporting dialect-specific features.
6
- *
7
- * @packageDocumentation
8
- */
9
- /**
10
- * Supported database dialects.
11
- *
12
- * @remarks
13
- * These are the database systems that Nextly officially supports through
14
- * dedicated adapter packages.
15
- *
16
- * @public
17
- */
18
- type SupportedDialect = "postgresql" | "mysql" | "sqlite";
19
- /**
20
- * SQL parameter types that are safe to use across all database dialects.
21
- *
22
- * @remarks
23
- * - `undefined` is included for optional parameters
24
- * - `Date` objects will be converted to appropriate format per dialect
25
- * - `null` represents SQL NULL
26
- *
27
- * @public
28
- */
29
- type SqlParam = string | number | boolean | Date | null | undefined;
30
- /**
31
- * JSON value types that can be stored in JSON/JSONB columns.
32
- *
33
- * @remarks
34
- * Represents the valid JSON value types as defined by the JSON specification.
35
- * This is a recursive type to support nested objects and arrays.
36
- *
37
- * @public
38
- */
39
- type JsonValue = string | number | boolean | null | JsonValue[] | {
40
- [key: string]: JsonValue;
41
- };
42
- /**
43
- * JSON object type for structured data.
44
- *
45
- * @remarks
46
- * Useful for typed JSON column data where the structure is known.
47
- *
48
- * @public
49
- */
50
- type JsonObject = {
51
- [key: string]: JsonValue;
52
- };
53
- /**
54
- * JSON array type.
55
- *
56
- * @public
57
- */
58
- type JsonArray = JsonValue[];
59
- /**
60
- * Interface for resolving table names to Drizzle table objects.
61
- *
62
- * @remarks
63
- * When a TableResolver is set on the adapter via `setTableResolver()`,
64
- * CRUD methods will use Drizzle's query API instead of raw SQL string building.
65
- * The nextly SchemaRegistry implements this interface.
66
- *
67
- * @public
68
- */
69
- interface TableResolver {
70
- /** Look up a Drizzle table object by table name. Returns null if not found. */
71
- getTable(tableName: string): unknown;
72
- }
73
-
74
- export type { JsonArray as J, SupportedDialect as S, TableResolver as T, SqlParam as a, JsonObject as b, JsonValue as c };
@@ -1,74 +0,0 @@
1
- /**
2
- * Core type definitions for the Nextly database adapter system.
3
- *
4
- * These types are the foundation for all database operations and are designed
5
- * to be database-agnostic while supporting dialect-specific features.
6
- *
7
- * @packageDocumentation
8
- */
9
- /**
10
- * Supported database dialects.
11
- *
12
- * @remarks
13
- * These are the database systems that Nextly officially supports through
14
- * dedicated adapter packages.
15
- *
16
- * @public
17
- */
18
- type SupportedDialect = "postgresql" | "mysql" | "sqlite";
19
- /**
20
- * SQL parameter types that are safe to use across all database dialects.
21
- *
22
- * @remarks
23
- * - `undefined` is included for optional parameters
24
- * - `Date` objects will be converted to appropriate format per dialect
25
- * - `null` represents SQL NULL
26
- *
27
- * @public
28
- */
29
- type SqlParam = string | number | boolean | Date | null | undefined;
30
- /**
31
- * JSON value types that can be stored in JSON/JSONB columns.
32
- *
33
- * @remarks
34
- * Represents the valid JSON value types as defined by the JSON specification.
35
- * This is a recursive type to support nested objects and arrays.
36
- *
37
- * @public
38
- */
39
- type JsonValue = string | number | boolean | null | JsonValue[] | {
40
- [key: string]: JsonValue;
41
- };
42
- /**
43
- * JSON object type for structured data.
44
- *
45
- * @remarks
46
- * Useful for typed JSON column data where the structure is known.
47
- *
48
- * @public
49
- */
50
- type JsonObject = {
51
- [key: string]: JsonValue;
52
- };
53
- /**
54
- * JSON array type.
55
- *
56
- * @public
57
- */
58
- type JsonArray = JsonValue[];
59
- /**
60
- * Interface for resolving table names to Drizzle table objects.
61
- *
62
- * @remarks
63
- * When a TableResolver is set on the adapter via `setTableResolver()`,
64
- * CRUD methods will use Drizzle's query API instead of raw SQL string building.
65
- * The nextly SchemaRegistry implements this interface.
66
- *
67
- * @public
68
- */
69
- interface TableResolver {
70
- /** Look up a Drizzle table object by table name. Returns null if not found. */
71
- getTable(tableName: string): unknown;
72
- }
73
-
74
- export type { JsonArray as J, SupportedDialect as S, TableResolver as T, SqlParam as a, JsonObject as b, JsonValue as c };
@@ -1,122 +0,0 @@
1
- /**
2
- * Database error type definitions.
3
- *
4
- * @packageDocumentation
5
- */
6
- /**
7
- * Database error classification.
8
- *
9
- * @remarks
10
- * Categorizes database errors for consistent error handling across adapters.
11
- * Each adapter translates database-specific error codes to these kinds.
12
- *
13
- * @public
14
- */
15
- type DatabaseErrorKind = "connection" | "query" | "constraint" | "unique_violation" | "foreign_key_violation" | "check_violation" | "not_null_violation" | "deadlock" | "timeout" | "serialization_failure" | "unsupported_version" | "unknown";
16
- /**
17
- * Enhanced database error interface.
18
- *
19
- * @remarks
20
- * Extends the standard Error interface with database-specific context.
21
- * Adapters should throw errors implementing this interface for consistent
22
- * error handling.
23
- *
24
- * @example
25
- * ```typescript
26
- * try {
27
- * await adapter.insert('users', { email: 'duplicate@example.com' });
28
- * } catch (error) {
29
- * if (isDatabaseError(error) && error.kind === 'unique_violation') {
30
- * console.log(`Duplicate ${error.column} in ${error.table}`);
31
- * }
32
- * }
33
- * ```
34
- *
35
- * @public
36
- */
37
- interface DatabaseError extends Error {
38
- /** Error classification */
39
- kind: DatabaseErrorKind;
40
- /** Database-specific error code (e.g., "23505" for PostgreSQL unique violation) */
41
- code?: string;
42
- /** Constraint name that was violated (if applicable) */
43
- constraint?: string;
44
- /** Table name involved in the error */
45
- table?: string;
46
- /** Column name involved in the error */
47
- column?: string;
48
- /** Detailed error description from the database */
49
- detail?: string;
50
- /** Hint for resolving the error */
51
- hint?: string;
52
- /** Original error from the database driver */
53
- cause?: Error;
54
- }
55
- /**
56
- * Type guard for DatabaseError.
57
- *
58
- * @remarks
59
- * Checks if an error is a DatabaseError with proper typing.
60
- *
61
- * @param error - Error to check
62
- * @returns True if error is a DatabaseError
63
- *
64
- * @public
65
- */
66
- declare function isDatabaseError(error: unknown): error is DatabaseError;
67
- /**
68
- * Whether an error is the application's verdict rather than the database's
69
- * failure.
70
- *
71
- * Work running inside a transaction may throw to roll the write back — a
72
- * refused value, a permission denial — and such an error is not something the
73
- * driver produced. Classifying it as a database error replaces its code and its
74
- * payload with a generic one, so a caller that asked for a refusal is handed an
75
- * unexplained failure instead, and per-field validation detail is lost on the
76
- * way out.
77
- *
78
- * @param error - Error to check
79
- * @returns True if the error was raised by application code
80
- *
81
- * @public
82
- */
83
- declare function isApplicationError(error: unknown): boolean;
84
- /**
85
- * Database error constructor options.
86
- *
87
- * @public
88
- */
89
- interface DatabaseErrorOptions {
90
- /** Error classification */
91
- kind: DatabaseErrorKind;
92
- /** Error message */
93
- message: string;
94
- /** Database-specific error code */
95
- code?: string;
96
- /** Constraint name */
97
- constraint?: string;
98
- /** Table name */
99
- table?: string;
100
- /** Column name */
101
- column?: string;
102
- /** Detailed description */
103
- detail?: string;
104
- /** Resolution hint */
105
- hint?: string;
106
- /** Original error */
107
- cause?: Error;
108
- }
109
- /**
110
- * Create a DatabaseError instance.
111
- *
112
- * @remarks
113
- * Helper function to create properly structured DatabaseError objects.
114
- *
115
- * @param options - Error options
116
- * @returns DatabaseError instance
117
- *
118
- * @public
119
- */
120
- declare function createDatabaseError(options: DatabaseErrorOptions): DatabaseError;
121
-
122
- export { type DatabaseErrorKind as D, type DatabaseError as a, type DatabaseErrorOptions as b, createDatabaseError as c, isDatabaseError as d, isApplicationError as i };
@@ -1,122 +0,0 @@
1
- /**
2
- * Database error type definitions.
3
- *
4
- * @packageDocumentation
5
- */
6
- /**
7
- * Database error classification.
8
- *
9
- * @remarks
10
- * Categorizes database errors for consistent error handling across adapters.
11
- * Each adapter translates database-specific error codes to these kinds.
12
- *
13
- * @public
14
- */
15
- type DatabaseErrorKind = "connection" | "query" | "constraint" | "unique_violation" | "foreign_key_violation" | "check_violation" | "not_null_violation" | "deadlock" | "timeout" | "serialization_failure" | "unsupported_version" | "unknown";
16
- /**
17
- * Enhanced database error interface.
18
- *
19
- * @remarks
20
- * Extends the standard Error interface with database-specific context.
21
- * Adapters should throw errors implementing this interface for consistent
22
- * error handling.
23
- *
24
- * @example
25
- * ```typescript
26
- * try {
27
- * await adapter.insert('users', { email: 'duplicate@example.com' });
28
- * } catch (error) {
29
- * if (isDatabaseError(error) && error.kind === 'unique_violation') {
30
- * console.log(`Duplicate ${error.column} in ${error.table}`);
31
- * }
32
- * }
33
- * ```
34
- *
35
- * @public
36
- */
37
- interface DatabaseError extends Error {
38
- /** Error classification */
39
- kind: DatabaseErrorKind;
40
- /** Database-specific error code (e.g., "23505" for PostgreSQL unique violation) */
41
- code?: string;
42
- /** Constraint name that was violated (if applicable) */
43
- constraint?: string;
44
- /** Table name involved in the error */
45
- table?: string;
46
- /** Column name involved in the error */
47
- column?: string;
48
- /** Detailed error description from the database */
49
- detail?: string;
50
- /** Hint for resolving the error */
51
- hint?: string;
52
- /** Original error from the database driver */
53
- cause?: Error;
54
- }
55
- /**
56
- * Type guard for DatabaseError.
57
- *
58
- * @remarks
59
- * Checks if an error is a DatabaseError with proper typing.
60
- *
61
- * @param error - Error to check
62
- * @returns True if error is a DatabaseError
63
- *
64
- * @public
65
- */
66
- declare function isDatabaseError(error: unknown): error is DatabaseError;
67
- /**
68
- * Whether an error is the application's verdict rather than the database's
69
- * failure.
70
- *
71
- * Work running inside a transaction may throw to roll the write back — a
72
- * refused value, a permission denial — and such an error is not something the
73
- * driver produced. Classifying it as a database error replaces its code and its
74
- * payload with a generic one, so a caller that asked for a refusal is handed an
75
- * unexplained failure instead, and per-field validation detail is lost on the
76
- * way out.
77
- *
78
- * @param error - Error to check
79
- * @returns True if the error was raised by application code
80
- *
81
- * @public
82
- */
83
- declare function isApplicationError(error: unknown): boolean;
84
- /**
85
- * Database error constructor options.
86
- *
87
- * @public
88
- */
89
- interface DatabaseErrorOptions {
90
- /** Error classification */
91
- kind: DatabaseErrorKind;
92
- /** Error message */
93
- message: string;
94
- /** Database-specific error code */
95
- code?: string;
96
- /** Constraint name */
97
- constraint?: string;
98
- /** Table name */
99
- table?: string;
100
- /** Column name */
101
- column?: string;
102
- /** Detailed description */
103
- detail?: string;
104
- /** Resolution hint */
105
- hint?: string;
106
- /** Original error */
107
- cause?: Error;
108
- }
109
- /**
110
- * Create a DatabaseError instance.
111
- *
112
- * @remarks
113
- * Helper function to create properly structured DatabaseError objects.
114
- *
115
- * @param options - Error options
116
- * @returns DatabaseError instance
117
- *
118
- * @public
119
- */
120
- declare function createDatabaseError(options: DatabaseErrorOptions): DatabaseError;
121
-
122
- export { type DatabaseErrorKind as D, type DatabaseError as a, type DatabaseErrorOptions as b, createDatabaseError as c, isDatabaseError as d, isApplicationError as i };