nanodb-orm 0.0.1 โ 0.0.3
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 +221 -6
- package/dist/core/connection.d.ts +14 -2
- package/dist/core/connection.d.ts.map +1 -1
- package/dist/core/connection.js +36 -4
- package/dist/core/connection.js.map +1 -1
- package/dist/types/database.d.ts +74 -0
- package/dist/types/database.d.ts.map +1 -0
- package/dist/types/database.js +6 -0
- package/dist/types/database.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/error-handler.d.ts +36 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +93 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/migrations.d.ts.map +1 -1
- package/dist/utils/migrations.js +63 -46
- package/dist/utils/migrations.js.map +1 -1
- package/dist/utils/schema-introspection.d.ts +2 -6
- package/dist/utils/schema-introspection.d.ts.map +1 -1
- package/dist/utils/schema-introspection.js +7 -4
- package/dist/utils/schema-introspection.js.map +1 -1
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +6 -3
- package/dist/utils/seeds.js.map +1 -1
- package/dist/utils/sync.d.ts +3 -16
- package/dist/utils/sync.d.ts.map +1 -1
- package/dist/utils/sync.js +9 -8
- package/dist/utils/sync.js.map +1 -1
- package/dist/utils/transactions.d.ts +55 -0
- package/dist/utils/transactions.d.ts.map +1 -0
- package/dist/utils/transactions.js +159 -0
- package/dist/utils/transactions.js.map +1 -0
- package/llm.txt +336 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# nanodb-orm
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A production-ready, generic database package built on top of Drizzle ORM with automatic migrations, schema introspection, atomic transactions, and support for both local SQLite and remote Turso databases.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- ๐ **Auto-Migrations**: Automatically creates and updates database schemas from Drizzle table definitions
|
|
8
8
|
- ๐ **Schema Introspection**: Comprehensive schema analysis and validation
|
|
9
9
|
- ๐ **Multi-Database Support**: Works with local SQLite and remote Turso databases
|
|
10
|
-
-
|
|
10
|
+
- โก **Atomic Transactions**: Full transaction support with rollback protection
|
|
11
11
|
- ๐ก๏ธ **Type Safe**: Full TypeScript support with proper type inference
|
|
12
|
+
- ๐ **Security**: SQL injection protection and input validation
|
|
13
|
+
- ๐งต **Thread Safe**: Race condition fixes and concurrent access protection
|
|
14
|
+
- ๐ฆ **NPM Package Ready**: Designed to be used as a standalone npm package
|
|
12
15
|
- โ๏ธ **Configurable**: Flexible migration and seeding options
|
|
13
16
|
- ๐งช **Test Ready**: Built-in testing utilities and isolation
|
|
17
|
+
- ๐ง **Production Ready**: Enhanced error handling and reliability features
|
|
14
18
|
|
|
15
19
|
## Installation
|
|
16
20
|
|
|
@@ -20,16 +24,108 @@ npm install nanodb-orm
|
|
|
20
24
|
|
|
21
25
|
## Quick Start
|
|
22
26
|
|
|
27
|
+
### 1. Define Your Models with Drizzle
|
|
28
|
+
|
|
29
|
+
Create your Drizzle table definitions (e.g., `models/users.ts`):
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// models/users.ts
|
|
33
|
+
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
34
|
+
|
|
35
|
+
export const usersTable = sqliteTable('users', {
|
|
36
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
37
|
+
name: text('name').notNull(),
|
|
38
|
+
age: integer('age').notNull(),
|
|
39
|
+
email: text('email').unique().notNull(),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export type InsertUser = typeof usersTable.$inferInsert;
|
|
43
|
+
export type SelectUser = typeof usersTable.$inferSelect;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// models/posts.ts
|
|
48
|
+
import { sql } from 'drizzle-orm';
|
|
49
|
+
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
50
|
+
import { usersTable } from './users';
|
|
51
|
+
|
|
52
|
+
export const postsTable = sqliteTable('posts', {
|
|
53
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
54
|
+
title: text('title').notNull(),
|
|
55
|
+
content: text('content').notNull(),
|
|
56
|
+
userId: integer('user_id')
|
|
57
|
+
.notNull()
|
|
58
|
+
.references(() => usersTable.id, { onDelete: 'cascade' }),
|
|
59
|
+
createdAt: text('created_at')
|
|
60
|
+
.default(sql`(datetime('now'))`)
|
|
61
|
+
.notNull(),
|
|
62
|
+
updatedAt: text('updated_at').$onUpdate(() => new Date().toISOString()),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export type InsertPost = typeof postsTable.$inferInsert;
|
|
66
|
+
export type SelectPost = typeof postsTable.$inferSelect;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// models/categories.ts
|
|
71
|
+
import { sql } from 'drizzle-orm';
|
|
72
|
+
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
73
|
+
|
|
74
|
+
export const categoriesTable = sqliteTable('categories', {
|
|
75
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
76
|
+
name: text('name').notNull(),
|
|
77
|
+
description: text('description'),
|
|
78
|
+
color: text('color').notNull().default('#000000'),
|
|
79
|
+
isActive: integer('is_active').notNull().default(1),
|
|
80
|
+
createdAt: text('created_at')
|
|
81
|
+
.default(sql`(datetime('now'))`)
|
|
82
|
+
.notNull(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export type InsertCategory = typeof categoriesTable.$inferInsert;
|
|
86
|
+
export type SelectCategory = typeof categoriesTable.$inferSelect;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// models/index.ts
|
|
91
|
+
export * from './users';
|
|
92
|
+
export * from './posts';
|
|
93
|
+
export * from './categories';
|
|
94
|
+
|
|
95
|
+
// Import tables for aggregation
|
|
96
|
+
import { usersTable } from './users';
|
|
97
|
+
import { postsTable } from './posts';
|
|
98
|
+
import { categoriesTable } from './categories';
|
|
99
|
+
|
|
100
|
+
// Export aggregated tables for nanodb-orm
|
|
101
|
+
export const tables = {
|
|
102
|
+
users: usersTable,
|
|
103
|
+
posts: postsTable,
|
|
104
|
+
categories: categoriesTable,
|
|
105
|
+
} as const;
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2. Initialize and Setup Database
|
|
109
|
+
|
|
23
110
|
```typescript
|
|
24
111
|
import { initializeDatabase, DatabaseSync } from 'nanodb-orm';
|
|
25
|
-
import { tables } from './models';
|
|
112
|
+
import { tables } from './models';
|
|
26
113
|
|
|
27
|
-
// Initialize the database package
|
|
114
|
+
// Initialize the database package with your Drizzle tables
|
|
28
115
|
initializeDatabase({
|
|
29
116
|
tables,
|
|
30
117
|
seedData: {
|
|
31
118
|
users: [
|
|
32
|
-
{ name: 'John Doe', age: 30, email: 'john@example.com' }
|
|
119
|
+
{ name: 'John Doe', age: 30, email: 'john@example.com' },
|
|
120
|
+
{ name: 'Jane Smith', age: 25, email: 'jane@example.com' }
|
|
121
|
+
],
|
|
122
|
+
posts: [
|
|
123
|
+
{ title: 'Welcome Post', content: 'This is my first post!', userId: 1 },
|
|
124
|
+
{ title: 'Getting Started', content: 'Here are some tips...', userId: 2 }
|
|
125
|
+
],
|
|
126
|
+
categories: [
|
|
127
|
+
{ name: 'Technology', description: 'Tech-related posts', color: '#3B82F6' },
|
|
128
|
+
{ name: 'Lifestyle', description: 'Life and personal posts', color: '#10B981' }
|
|
33
129
|
]
|
|
34
130
|
}
|
|
35
131
|
});
|
|
@@ -38,6 +134,51 @@ initializeDatabase({
|
|
|
38
134
|
await DatabaseSync.setup();
|
|
39
135
|
```
|
|
40
136
|
|
|
137
|
+
### 3. Working with Drizzle Tables
|
|
138
|
+
|
|
139
|
+
nanodb-orm works seamlessly with Drizzle ORM table definitions. Here are the key Drizzle column types and methods:
|
|
140
|
+
|
|
141
|
+
#### Drizzle Column Types
|
|
142
|
+
- `integer()` - Integer numbers
|
|
143
|
+
- `text()` - Text strings
|
|
144
|
+
- `real()` - Floating point numbers
|
|
145
|
+
- `blob()` - Binary data
|
|
146
|
+
|
|
147
|
+
#### Drizzle Column Methods
|
|
148
|
+
- `.primaryKey({ autoIncrement: true })` - Primary key with auto-increment
|
|
149
|
+
- `.notNull()` - NOT NULL constraint
|
|
150
|
+
- `.unique()` - UNIQUE constraint
|
|
151
|
+
- `.default(value)` - Default value
|
|
152
|
+
- `.references(table.column)` - Foreign key reference
|
|
153
|
+
|
|
154
|
+
#### Example Drizzle Column Definitions
|
|
155
|
+
```typescript
|
|
156
|
+
// Primary key with auto-increment
|
|
157
|
+
id: integer('id').primaryKey({ autoIncrement: true })
|
|
158
|
+
|
|
159
|
+
// Required text field
|
|
160
|
+
name: text('name').notNull()
|
|
161
|
+
|
|
162
|
+
// Optional text field with default
|
|
163
|
+
color: text('color').notNull().default('#000000')
|
|
164
|
+
|
|
165
|
+
// Unique email field
|
|
166
|
+
email: text('email').unique().notNull()
|
|
167
|
+
|
|
168
|
+
// Boolean field (stored as integer)
|
|
169
|
+
isActive: integer('is_active').notNull().default(1)
|
|
170
|
+
|
|
171
|
+
// Timestamp field with SQL function
|
|
172
|
+
createdAt: text('created_at')
|
|
173
|
+
.default(sql`(datetime('now'))`)
|
|
174
|
+
.notNull()
|
|
175
|
+
|
|
176
|
+
// Foreign key reference
|
|
177
|
+
userId: integer('user_id')
|
|
178
|
+
.notNull()
|
|
179
|
+
.references(() => usersTable.id, { onDelete: 'cascade' })
|
|
180
|
+
```
|
|
181
|
+
|
|
41
182
|
## API Reference
|
|
42
183
|
|
|
43
184
|
### `initializeDatabase(schemaData: SchemaData)`
|
|
@@ -200,6 +341,71 @@ initializeDatabase({
|
|
|
200
341
|
});
|
|
201
342
|
```
|
|
202
343
|
|
|
344
|
+
### Transaction Support (NEW in v0.0.3)
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
import { TransactionManager } from 'nanodb-orm';
|
|
348
|
+
|
|
349
|
+
// Atomic operations
|
|
350
|
+
await TransactionManager.execute(async (db) => {
|
|
351
|
+
await db.run('INSERT INTO users (name, email) VALUES (?, ?)', ['John', 'john@example.com']);
|
|
352
|
+
await db.run('INSERT INTO posts (title, content, userId) VALUES (?, ?, ?)', ['Hello', 'World', 1]);
|
|
353
|
+
// All operations succeed or all fail
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// Batch operations
|
|
357
|
+
await TransactionManager.executeBatch([
|
|
358
|
+
async (db) => await db.run('INSERT INTO users ...'),
|
|
359
|
+
async (db) => await db.run('INSERT INTO posts ...'),
|
|
360
|
+
async (db) => await db.run('UPDATE stats ...')
|
|
361
|
+
]);
|
|
362
|
+
|
|
363
|
+
// Table recreation with transactions
|
|
364
|
+
await TransactionManager.recreateTable('users', async (db) => {
|
|
365
|
+
await db.run('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)');
|
|
366
|
+
});
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Enhanced Error Handling (NEW in v0.0.3)
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
import { ErrorHandler, DatabaseError } from 'nanodb-orm';
|
|
373
|
+
|
|
374
|
+
try {
|
|
375
|
+
await DatabaseSync.setup();
|
|
376
|
+
} catch (error) {
|
|
377
|
+
if (error instanceof DatabaseError) {
|
|
378
|
+
console.log('Operation:', error.operation);
|
|
379
|
+
console.log('Context:', error.message);
|
|
380
|
+
console.log('Original Error:', error.originalError);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Non-throwing error handling
|
|
385
|
+
const result = ErrorHandler.handleNonThrowingError(
|
|
386
|
+
someError,
|
|
387
|
+
'optional-operation',
|
|
388
|
+
'This operation is optional'
|
|
389
|
+
);
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Thread-Safe Connections (NEW in v0.0.3)
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
import { DatabaseConnection } from 'nanodb-orm';
|
|
396
|
+
|
|
397
|
+
// NEW: Async connection (recommended)
|
|
398
|
+
const db = await DatabaseConnection.getInstance();
|
|
399
|
+
|
|
400
|
+
// OLD: Synchronous connection (deprecated but still works)
|
|
401
|
+
const db = DatabaseConnection.getInstanceSync();
|
|
402
|
+
|
|
403
|
+
// Check connection status
|
|
404
|
+
if (DatabaseConnection.isConnected()) {
|
|
405
|
+
console.log('Database is connected');
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
203
409
|
### Schema Introspection
|
|
204
410
|
|
|
205
411
|
```typescript
|
|
@@ -279,7 +485,16 @@ MIT ยฉ Damilola Alao
|
|
|
279
485
|
|
|
280
486
|
## Changelog
|
|
281
487
|
|
|
282
|
-
###
|
|
488
|
+
### 0.0.2
|
|
489
|
+
- **Enhanced Documentation**: Added comprehensive Drizzle ORM integration examples
|
|
490
|
+
- **Real Model Examples**: Updated documentation with actual Drizzle table definitions
|
|
491
|
+
- **Schema Validation Fix**: Fixed table existence validation logic for proper health checks
|
|
492
|
+
- **LLM Documentation**: Added detailed `llm.txt` file for AI/LLM integration
|
|
493
|
+
- **Column Types Guide**: Added complete Drizzle column types and methods documentation
|
|
494
|
+
- **Foreign Key Support**: Documented foreign key relationships and cascade deletes
|
|
495
|
+
- **Type Safety**: Enhanced TypeScript integration examples with Drizzle's type inference
|
|
496
|
+
|
|
497
|
+
### 0.0.1
|
|
283
498
|
- Initial release
|
|
284
499
|
- Auto-migration system
|
|
285
500
|
- Schema introspection
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
+
import { drizzle } from 'drizzle-orm/libsql';
|
|
1
2
|
/**
|
|
2
3
|
* Database connection management
|
|
3
4
|
* Handles the creation and configuration of database connections
|
|
4
5
|
*/
|
|
5
6
|
export declare class DatabaseConnection {
|
|
6
7
|
private static instance;
|
|
8
|
+
private static isCreating;
|
|
9
|
+
private static creationPromise;
|
|
7
10
|
/**
|
|
8
|
-
* Get or create the database connection instance
|
|
11
|
+
* Get or create the database connection instance (thread-safe)
|
|
9
12
|
*/
|
|
10
|
-
static getInstance():
|
|
13
|
+
static getInstance(): Promise<ReturnType<typeof drizzle>>;
|
|
14
|
+
/**
|
|
15
|
+
* Synchronous getter for backward compatibility (deprecated)
|
|
16
|
+
* @deprecated Use getInstance() instead for thread safety
|
|
17
|
+
*/
|
|
18
|
+
static getInstanceSync(): import("drizzle-orm/libsql").LibSQLDatabase<Record<string, unknown>> & {
|
|
11
19
|
$client: import("@libsql/client").Client;
|
|
12
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Create a new database connection asynchronously
|
|
23
|
+
*/
|
|
24
|
+
private static createConnectionAsync;
|
|
13
25
|
/**
|
|
14
26
|
* Create a new database connection
|
|
15
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../core/connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../core/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAK7C;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2C;IAClE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAS;IAClC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAoD;IAElF;;OAEG;WACU,WAAW,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;IAqB/D;;;OAGG;IACH,MAAM,CAAC,eAAe;;;IAOtB;;OAEG;mBACkB,qBAAqB;IAI1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAmC/B;;OAEG;IACH,MAAM,CAAC,KAAK;IAMZ;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,OAAO;CAG9B;AAGD,eAAO,MAAM,EAAE;;CAAuC,CAAC"}
|
package/dist/core/connection.js
CHANGED
|
@@ -11,14 +11,42 @@ const errors_1 = require("../types/errors");
|
|
|
11
11
|
*/
|
|
12
12
|
class DatabaseConnection {
|
|
13
13
|
/**
|
|
14
|
-
* Get or create the database connection instance
|
|
14
|
+
* Get or create the database connection instance (thread-safe)
|
|
15
15
|
*/
|
|
16
|
-
static getInstance() {
|
|
16
|
+
static async getInstance() {
|
|
17
|
+
if (this.instance) {
|
|
18
|
+
return this.instance;
|
|
19
|
+
}
|
|
20
|
+
if (this.isCreating && this.creationPromise) {
|
|
21
|
+
return this.creationPromise;
|
|
22
|
+
}
|
|
23
|
+
this.isCreating = true;
|
|
24
|
+
this.creationPromise = this.createConnectionAsync();
|
|
25
|
+
try {
|
|
26
|
+
this.instance = await this.creationPromise;
|
|
27
|
+
return this.instance;
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
this.isCreating = false;
|
|
31
|
+
this.creationPromise = null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Synchronous getter for backward compatibility (deprecated)
|
|
36
|
+
* @deprecated Use getInstance() instead for thread safety
|
|
37
|
+
*/
|
|
38
|
+
static getInstanceSync() {
|
|
17
39
|
if (!this.instance) {
|
|
18
40
|
this.instance = this.createConnection();
|
|
19
41
|
}
|
|
20
42
|
return this.instance;
|
|
21
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a new database connection asynchronously
|
|
46
|
+
*/
|
|
47
|
+
static async createConnectionAsync() {
|
|
48
|
+
return this.createConnection();
|
|
49
|
+
}
|
|
22
50
|
/**
|
|
23
51
|
* Create a new database connection
|
|
24
52
|
*/
|
|
@@ -62,6 +90,8 @@ class DatabaseConnection {
|
|
|
62
90
|
*/
|
|
63
91
|
static reset() {
|
|
64
92
|
this.instance = null;
|
|
93
|
+
this.isCreating = false;
|
|
94
|
+
this.creationPromise = null;
|
|
65
95
|
}
|
|
66
96
|
/**
|
|
67
97
|
* Check if connection is established
|
|
@@ -72,6 +102,8 @@ class DatabaseConnection {
|
|
|
72
102
|
}
|
|
73
103
|
exports.DatabaseConnection = DatabaseConnection;
|
|
74
104
|
DatabaseConnection.instance = null;
|
|
75
|
-
|
|
76
|
-
|
|
105
|
+
DatabaseConnection.isCreating = false;
|
|
106
|
+
DatabaseConnection.creationPromise = null;
|
|
107
|
+
// Export the database instance for convenience (deprecated - use getInstance() instead)
|
|
108
|
+
exports.db = DatabaseConnection.getInstanceSync();
|
|
77
109
|
//# sourceMappingURL=connection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../core/connection.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAC7C,2CAA8C;AAC9C,qCAA6C;AAC7C,4CAAgD;AAEhD;;;GAGG;AACH,MAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../core/connection.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAC7C,2CAA8C;AAC9C,qCAA6C;AAC7C,4CAAgD;AAEhD;;;GAGG;AACH,MAAa,kBAAkB;IAK7B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW;QACtB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,qBA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/
|
|
4
|
+
export interface DatabaseClient {
|
|
5
|
+
run(query: string, params?: any[]): Promise<{
|
|
6
|
+
rows: any[];
|
|
7
|
+
}>;
|
|
8
|
+
$client?: {
|
|
9
|
+
sync?: () => Promise<void>;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface TableColumn {
|
|
14
|
+
name: string;
|
|
15
|
+
dataType: string;
|
|
16
|
+
primary?: boolean;
|
|
17
|
+
autoIncrement?: boolean;
|
|
18
|
+
notNull?: boolean;
|
|
19
|
+
unique?: boolean;
|
|
20
|
+
default?: any;
|
|
21
|
+
references?: {
|
|
22
|
+
table: string;
|
|
23
|
+
column: string;
|
|
24
|
+
onDelete?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface TableDefinition {
|
|
28
|
+
name: string;
|
|
29
|
+
columns: Record<string, TableColumn>;
|
|
30
|
+
primaryKey: string[];
|
|
31
|
+
foreignKeys: Array<{
|
|
32
|
+
column: string;
|
|
33
|
+
references: string;
|
|
34
|
+
table: string;
|
|
35
|
+
}>;
|
|
36
|
+
indexes: string[];
|
|
37
|
+
}
|
|
38
|
+
export interface DatabaseRow {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
export interface QueryResult {
|
|
42
|
+
rows: DatabaseRow[];
|
|
43
|
+
changes?: number;
|
|
44
|
+
lastInsertRowid?: number;
|
|
45
|
+
}
|
|
46
|
+
export interface MigrationResult {
|
|
47
|
+
success: boolean;
|
|
48
|
+
message: string;
|
|
49
|
+
tablesAffected: string[];
|
|
50
|
+
errors: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface SchemaValidationResult {
|
|
53
|
+
isValid: boolean;
|
|
54
|
+
missingTables: string[];
|
|
55
|
+
extraTables: string[];
|
|
56
|
+
errors: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface DatabaseInfoExtended {
|
|
59
|
+
tables: string[];
|
|
60
|
+
tableCounts: Record<string, number>;
|
|
61
|
+
totalRecords: number;
|
|
62
|
+
schemaValid: boolean;
|
|
63
|
+
syncSupported: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface HealthCheckResultExtended {
|
|
66
|
+
healthy: boolean;
|
|
67
|
+
tables: string[];
|
|
68
|
+
tableCounts: Record<string, number>;
|
|
69
|
+
totalRecords: number;
|
|
70
|
+
schemaValid: boolean;
|
|
71
|
+
syncSupported: boolean;
|
|
72
|
+
errors: string[];
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../types/database.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,UAAU,CAAC,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO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AO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../types/database.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -20,4 +20,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
__exportStar(require("./types"), exports);
|
|
22
22
|
__exportStar(require("./errors"), exports);
|
|
23
|
+
__exportStar(require("./database"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,2CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,2CAAyB;AACzB,6CAA2B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standardized error handling utilities for database operations
|
|
3
|
+
*/
|
|
4
|
+
import { DatabaseError } from '../types/errors';
|
|
5
|
+
export interface ErrorHandlerOptions {
|
|
6
|
+
operation: string;
|
|
7
|
+
context?: string | undefined;
|
|
8
|
+
throwError?: boolean;
|
|
9
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Standardized error handling for database operations
|
|
13
|
+
*/
|
|
14
|
+
export declare class ErrorHandler {
|
|
15
|
+
/**
|
|
16
|
+
* Handle database errors with consistent logging and error creation
|
|
17
|
+
*/
|
|
18
|
+
static handleError(error: unknown, options: ErrorHandlerOptions): DatabaseError | null;
|
|
19
|
+
/**
|
|
20
|
+
* Handle errors that should not throw (e.g., validation failures)
|
|
21
|
+
*/
|
|
22
|
+
static handleNonThrowingError(error: unknown, operation: string, context?: string): DatabaseError;
|
|
23
|
+
/**
|
|
24
|
+
* Handle errors that should be logged but not thrown (e.g., optional operations)
|
|
25
|
+
*/
|
|
26
|
+
static handleOptionalError(error: unknown, operation: string, context?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Wrap async operations with standardized error handling
|
|
29
|
+
*/
|
|
30
|
+
static wrapAsync<T>(operation: () => Promise<T>, options: ErrorHandlerOptions): Promise<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Wrap sync operations with standardized error handling
|
|
33
|
+
*/
|
|
34
|
+
static wrapSync<T>(operation: () => T, options: ErrorHandlerOptions): T;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../utils/error-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAChD;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,mBAAmB,GAC3B,aAAa,GAAG,IAAI;IAuCvB;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAC3B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,aAAa;IAUhB;;OAEG;IACH,MAAM,CAAC,mBAAmB,CACxB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI;IASP;;OAEG;WACU,SAAS,CAAC,CAAC,EACtB,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,CAAC,CAAC;IASb;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EACf,SAAS,EAAE,MAAM,CAAC,EAClB,OAAO,EAAE,mBAAmB,GAC3B,CAAC;CAQL"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Standardized error handling utilities for database operations
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ErrorHandler = void 0;
|
|
7
|
+
const logger_1 = require("./logger");
|
|
8
|
+
const errors_1 = require("../types/errors");
|
|
9
|
+
/**
|
|
10
|
+
* Standardized error handling for database operations
|
|
11
|
+
*/
|
|
12
|
+
class ErrorHandler {
|
|
13
|
+
/**
|
|
14
|
+
* Handle database errors with consistent logging and error creation
|
|
15
|
+
*/
|
|
16
|
+
static handleError(error, options) {
|
|
17
|
+
const { operation, context, throwError = true, logLevel = 'error' } = options;
|
|
18
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
19
|
+
const fullMessage = context
|
|
20
|
+
? `${context}: ${errorMessage}`
|
|
21
|
+
: errorMessage;
|
|
22
|
+
const dbError = new errors_1.DatabaseError(fullMessage, operation, error instanceof Error ? error : undefined);
|
|
23
|
+
// Log with appropriate level
|
|
24
|
+
switch (logLevel) {
|
|
25
|
+
case 'debug':
|
|
26
|
+
logger_1.logger.debug(dbError.message, dbError);
|
|
27
|
+
break;
|
|
28
|
+
case 'info':
|
|
29
|
+
logger_1.logger.info(dbError.message, dbError);
|
|
30
|
+
break;
|
|
31
|
+
case 'warn':
|
|
32
|
+
logger_1.logger.warn(dbError.message, dbError);
|
|
33
|
+
break;
|
|
34
|
+
case 'error':
|
|
35
|
+
default:
|
|
36
|
+
logger_1.logger.error(dbError.message, dbError);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
if (throwError) {
|
|
40
|
+
throw dbError;
|
|
41
|
+
}
|
|
42
|
+
return dbError;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Handle errors that should not throw (e.g., validation failures)
|
|
46
|
+
*/
|
|
47
|
+
static handleNonThrowingError(error, operation, context) {
|
|
48
|
+
const result = this.handleError(error, {
|
|
49
|
+
operation,
|
|
50
|
+
context,
|
|
51
|
+
throwError: false,
|
|
52
|
+
logLevel: 'warn'
|
|
53
|
+
});
|
|
54
|
+
return result; // We know it won't be null because throwError is false
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Handle errors that should be logged but not thrown (e.g., optional operations)
|
|
58
|
+
*/
|
|
59
|
+
static handleOptionalError(error, operation, context) {
|
|
60
|
+
this.handleError(error, {
|
|
61
|
+
operation,
|
|
62
|
+
context,
|
|
63
|
+
throwError: false,
|
|
64
|
+
logLevel: 'info'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Wrap async operations with standardized error handling
|
|
69
|
+
*/
|
|
70
|
+
static async wrapAsync(operation, options) {
|
|
71
|
+
try {
|
|
72
|
+
return await operation();
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
this.handleError(error, options);
|
|
76
|
+
throw error; // This will never be reached due to handleError throwing
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Wrap sync operations with standardized error handling
|
|
81
|
+
*/
|
|
82
|
+
static wrapSync(operation, options) {
|
|
83
|
+
try {
|
|
84
|
+
return operation();
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
this.handleError(error, options);
|
|
88
|
+
throw error; // This will never be reached due to handleError throwing
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.ErrorHandler = ErrorHandler;
|
|
93
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../utils/error-handler.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,qCAAkC;AAClC,4CAAgD;AAShD;;GAEG;AACH,MAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,KAAc,EACd,OAA4B;QAE5B,MAAM,EACJ,SAAS,EACT,OAAO,EACP,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,EACnB,GAAG,OAAO,CAAC;QAEZ,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,WAAW,GAAG,OAAO;YACzB,CAAC,CAAC,GAAG,OAAO,KAAK,YAAY,EAAE;YAC/B,CAAC,CAAC,YAAY,CAAC;QAEjB,MAAM,OAAO,GAAG,IAAI,sBAAa,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAEtG,6BAA6B;Q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,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjC,MAAM,KAAK,CAAC,CAAC,yDAAyD;QACxE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ,CACb,SAAkB,EAClB,OAA4B;QAE5B,IAAI,CAAC;YACH,OAAO,SAAS,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjC,MAAM,KAAK,CAAC,CAAC,yDAAyD;QACxE,CAAC;IACH,CAAC;CACF;AA5GD,oCA4GC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export { DatabaseMigrations } from './migrations';
|
|
|
7
7
|
export { DatabaseSeeds } from './seeds';
|
|
8
8
|
export { SchemaIntrospection } from './schema-introspection';
|
|
9
9
|
export { logger } from './logger';
|
|
10
|
+
export { ErrorHandler } from './error-handler';
|
|
11
|
+
export { TransactionManager } from './transactions';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|