nanodb-orm 0.0.3 → 0.0.5
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 +506 -333
- package/dist/cli.d.ts +96 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +348 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants/index.d.ts +7 -54
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +9 -61
- package/dist/constants/index.js.map +1 -1
- package/dist/core/config.d.ts +3 -13
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +5 -27
- package/dist/core/config.js.map +1 -1
- package/dist/core/connection.d.ts +16 -31
- package/dist/core/connection.d.ts.map +1 -1
- package/dist/core/connection.js +42 -78
- package/dist/core/connection.js.map +1 -1
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -18
- package/dist/core/index.js.map +1 -1
- package/dist/index.d.ts +235 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +252 -35
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +127 -18
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +280 -47
- package/dist/init.js.map +1 -1
- package/dist/jest.setup.d.ts +4 -0
- package/dist/jest.setup.d.ts.map +1 -0
- package/dist/jest.setup.js +40 -0
- package/dist/jest.setup.js.map +1 -0
- package/dist/types/errors.d.ts +30 -12
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +98 -23
- package/dist/types/errors.js.map +1 -1
- package/dist/types/index.d.ts +268 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +5 -4
- package/dist/types/index.js.map +1 -1
- package/dist/utils/error-handler.d.ts +6 -31
- package/dist/utils/error-handler.d.ts.map +1 -1
- package/dist/utils/error-handler.js +24 -81
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/index.d.ts +1 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -6
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logger.d.ts +6 -25
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +20 -38
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/migrations.d.ts +16 -90
- package/dist/utils/migrations.d.ts.map +1 -1
- package/dist/utils/migrations.js +220 -422
- package/dist/utils/migrations.js.map +1 -1
- package/dist/utils/schema-introspection.d.ts +30 -169
- package/dist/utils/schema-introspection.d.ts.map +1 -1
- package/dist/utils/schema-introspection.js +125 -462
- package/dist/utils/schema-introspection.js.map +1 -1
- package/dist/utils/seeds.d.ts +15 -48
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +108 -186
- package/dist/utils/seeds.js.map +1 -1
- package/dist/utils/sync.d.ts +16 -41
- package/dist/utils/sync.d.ts.map +1 -1
- package/dist/utils/sync.js +78 -172
- package/dist/utils/sync.js.map +1 -1
- package/dist/utils/transactions.d.ts +61 -44
- package/dist/utils/transactions.d.ts.map +1 -1
- package/dist/utils/transactions.js +103 -137
- package/dist/utils/transactions.js.map +1 -1
- package/package.json +29 -10
- package/dist/example.d.ts +0 -67
- package/dist/example.d.ts.map +0 -1
- package/dist/example.js +0 -86
- package/dist/example.js.map +0 -1
- package/dist/types/database.d.ts +0 -74
- package/dist/types/database.d.ts.map +0 -1
- package/dist/types/database.js +0 -6
- package/dist/types/database.js.map +0 -1
- package/dist/types/types.d.ts +0 -30
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -6
- package/dist/types/types.js.map +0 -1
- package/llm.txt +0 -336
|
@@ -1,159 +1,125 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Transaction utilities for atomic database operations
|
|
4
|
-
*/
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
3
|
+
exports.transaction = transaction;
|
|
4
|
+
exports.batch = batch;
|
|
5
|
+
exports.recreateTable = recreateTable;
|
|
6
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
7
7
|
const connection_1 = require("../core/connection");
|
|
8
8
|
const logger_1 = require("./logger");
|
|
9
|
-
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Public API
|
|
11
|
+
// ============================================================================
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
13
|
+
* Execute operations within a database transaction.
|
|
14
|
+
* Automatically commits on success, rolls back on failure.
|
|
15
|
+
*
|
|
16
|
+
* Uses Drizzle's native transaction when available (recommended for Turso),
|
|
17
|
+
* with fallback to manual BEGIN/COMMIT for local SQLite.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const result = await transaction(async (tx) => {
|
|
22
|
+
* await tx.run(sql`UPDATE users SET age = age + 1 WHERE id = ${userId}`);
|
|
23
|
+
* await tx.run(sql`INSERT INTO audit_log (action) VALUES ('age_updated')`);
|
|
24
|
+
* return { updated: true };
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* if (result.success) {
|
|
28
|
+
* console.log('Transaction committed:', result.result);
|
|
29
|
+
* } else {
|
|
30
|
+
* console.error('Transaction failed:', result.error);
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
12
33
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
static async execute(operation, options = {}) {
|
|
18
|
-
const db = await connection_1.DatabaseConnection.getInstance();
|
|
19
|
-
const client = db;
|
|
34
|
+
async function transaction(operation) {
|
|
35
|
+
const db = (await connection_1.DatabaseConnection.getInstance());
|
|
36
|
+
// Try to use Drizzle's native transaction (better for Turso/libSQL)
|
|
37
|
+
if (typeof db.transaction === 'function') {
|
|
20
38
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const result = await operation(client);
|
|
30
|
-
// Commit transaction
|
|
31
|
-
await client.run('COMMIT');
|
|
32
|
-
logger_1.logger.debug('Transaction committed successfully');
|
|
33
|
-
return {
|
|
34
|
-
success: true,
|
|
35
|
-
result
|
|
36
|
-
};
|
|
39
|
+
const result = await db.transaction(async (tx) => {
|
|
40
|
+
const client = {
|
|
41
|
+
run: (query) => tx.run(query),
|
|
42
|
+
};
|
|
43
|
+
return operation(client);
|
|
44
|
+
});
|
|
45
|
+
logger_1.logger.debug('Transaction committed (native)');
|
|
46
|
+
return { success: true, result };
|
|
37
47
|
}
|
|
38
48
|
catch (error) {
|
|
39
|
-
logger_1.logger.
|
|
40
|
-
try {
|
|
41
|
-
await client.run('ROLLBACK');
|
|
42
|
-
logger_1.logger.debug('Transaction rolled back successfully');
|
|
43
|
-
}
|
|
44
|
-
catch (rollbackError) {
|
|
45
|
-
logger_1.logger.error('Failed to rollback transaction:', rollbackError);
|
|
46
|
-
return {
|
|
47
|
-
success: false,
|
|
48
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
49
|
-
rollbackError: rollbackError instanceof Error ? rollbackError : new Error(String(rollbackError))
|
|
50
|
-
};
|
|
51
|
-
}
|
|
49
|
+
logger_1.logger.debug('Transaction rolled back (native)');
|
|
52
50
|
return {
|
|
53
51
|
success: false,
|
|
54
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
52
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
55
53
|
};
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return results;
|
|
69
|
-
}, options);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Execute a migration operation with transaction support
|
|
73
|
-
*/
|
|
74
|
-
static async executeMigration(migrationOperation, options = {}) {
|
|
75
|
-
return this.execute(async (db) => {
|
|
76
|
-
logger_1.logger.info('Executing migration within transaction');
|
|
77
|
-
await migrationOperation(db);
|
|
78
|
-
logger_1.logger.info('Migration completed successfully');
|
|
79
|
-
}, options);
|
|
56
|
+
// Fallback to manual transaction for local SQLite
|
|
57
|
+
const tx = {
|
|
58
|
+
run: (query) => db.run(query),
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
await db.run(drizzle_orm_1.sql.raw('BEGIN TRANSACTION'));
|
|
62
|
+
const result = await operation(tx);
|
|
63
|
+
await db.run(drizzle_orm_1.sql.raw('COMMIT'));
|
|
64
|
+
logger_1.logger.debug('Transaction committed');
|
|
65
|
+
return { success: true, result };
|
|
80
66
|
}
|
|
81
|
-
|
|
82
|
-
* Execute table recreation with transaction support
|
|
83
|
-
*/
|
|
84
|
-
static async recreateTable(tableName, createOperation, options = {}) {
|
|
85
|
-
return this.execute(async (db) => {
|
|
86
|
-
logger_1.logger.info(`Recreating table ${tableName} within transaction`);
|
|
87
|
-
// Drop table if exists
|
|
88
|
-
await db.run(`DROP TABLE IF EXISTS ${tableName}`);
|
|
89
|
-
logger_1.logger.debug(`Dropped table ${tableName}`);
|
|
90
|
-
// Create new table
|
|
91
|
-
await createOperation(db);
|
|
92
|
-
logger_1.logger.debug(`Created table ${tableName}`);
|
|
93
|
-
logger_1.logger.info(`Table ${tableName} recreated successfully`);
|
|
94
|
-
}, options);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Execute data seeding with transaction support
|
|
98
|
-
*/
|
|
99
|
-
static async seedData(seedOperation, options = {}) {
|
|
100
|
-
return this.execute(async (db) => {
|
|
101
|
-
logger_1.logger.info('Seeding data within transaction');
|
|
102
|
-
await seedOperation(db);
|
|
103
|
-
logger_1.logger.info('Data seeding completed successfully');
|
|
104
|
-
}, options);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Execute database reset with transaction support
|
|
108
|
-
*/
|
|
109
|
-
static async resetDatabase(resetOperation, options = {}) {
|
|
110
|
-
return this.execute(async (db) => {
|
|
111
|
-
logger_1.logger.warn('Resetting database within transaction');
|
|
112
|
-
await resetOperation(db);
|
|
113
|
-
logger_1.logger.info('Database reset completed successfully');
|
|
114
|
-
}, options);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if the database supports transactions
|
|
118
|
-
*/
|
|
119
|
-
static async supportsTransactions() {
|
|
67
|
+
catch (error) {
|
|
120
68
|
try {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// Try to start a transaction
|
|
124
|
-
await client.run('BEGIN TRANSACTION');
|
|
125
|
-
await client.run('ROLLBACK');
|
|
126
|
-
return true;
|
|
69
|
+
await db.run(drizzle_orm_1.sql.raw('ROLLBACK'));
|
|
70
|
+
logger_1.logger.debug('Transaction rolled back');
|
|
127
71
|
}
|
|
128
|
-
catch (
|
|
129
|
-
|
|
130
|
-
return false;
|
|
72
|
+
catch (rollbackError) {
|
|
73
|
+
logger_1.logger.error('Rollback failed', rollbackError);
|
|
131
74
|
}
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
78
|
+
};
|
|
132
79
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Execute a batch of SQL statements atomically.
|
|
83
|
+
* All statements succeed or all fail together.
|
|
84
|
+
*
|
|
85
|
+
* This is more efficient than individual transactions for multiple operations.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const result = await batch([
|
|
90
|
+
* sql`INSERT INTO users (name) VALUES ('Alice')`,
|
|
91
|
+
* sql`INSERT INTO users (name) VALUES ('Bob')`,
|
|
92
|
+
* sql`UPDATE settings SET value = 'done' WHERE key = 'migration'`,
|
|
93
|
+
* ]);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
async function batch(statements) {
|
|
97
|
+
return transaction(async (tx) => {
|
|
98
|
+
const results = [];
|
|
99
|
+
for (const stmt of statements) {
|
|
100
|
+
results.push(await tx.run(stmt));
|
|
155
101
|
}
|
|
156
|
-
|
|
102
|
+
return results;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Drop and recreate a table within a transaction.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const result = await recreateTable('users', `
|
|
111
|
+
* CREATE TABLE users (
|
|
112
|
+
* id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
113
|
+
* name TEXT NOT NULL
|
|
114
|
+
* )
|
|
115
|
+
* `);
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
async function recreateTable(tableName, createSql) {
|
|
119
|
+
return transaction(async (tx) => {
|
|
120
|
+
await tx.run(drizzle_orm_1.sql.raw(`DROP TABLE IF EXISTS "${tableName}"`));
|
|
121
|
+
await tx.run(drizzle_orm_1.sql.raw(createSql));
|
|
122
|
+
logger_1.logger.info(`Recreated table: ${tableName}`);
|
|
123
|
+
});
|
|
157
124
|
}
|
|
158
|
-
exports.TransactionManager = TransactionManager;
|
|
159
125
|
//# sourceMappingURL=transactions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../utils/transactions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../utils/transactions.ts"],"names":[],"mappings":";;AAiEA,kCAkDC;AAiBD,sBAUC;AAeD,sCASC;AAtKD,6CAA4C;AAC5C,mDAAwD;AACxD,qCAAkC;AAqClC,+E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AM,EAAE,CAAC,GAAG,CAAC,iBAAG,CAAC,GAAG,CAAC,yBAAyB,SAAS,GAAG,CAAC,CAAC,CAAC;QAC7D,MAAM,EAAE,CAAC,GAAG,CAAC,iBAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;QACjC,eAAM,CAAC,IAAI,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nanodb-orm",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Lightweight ORM wrapper for Drizzle with auto-migrations, schema introspection, and CLI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"nanodb": "./dist/cli.js"
|
|
9
|
+
},
|
|
7
10
|
"files": [
|
|
8
11
|
"dist/**/*",
|
|
9
12
|
"README.md",
|
|
10
|
-
"LICENSE"
|
|
11
|
-
"llm.txt"
|
|
13
|
+
"LICENSE"
|
|
12
14
|
],
|
|
13
15
|
"scripts": {
|
|
14
16
|
"build": "tsc",
|
|
@@ -16,7 +18,8 @@
|
|
|
16
18
|
"clean": "rm -rf dist",
|
|
17
19
|
"prepublishOnly": "npm run clean && npm run build",
|
|
18
20
|
"test": "jest",
|
|
19
|
-
"test:watch": "jest --watchAll"
|
|
21
|
+
"test:watch": "jest --watchAll",
|
|
22
|
+
"studio": "npx ts-node cli.ts studio"
|
|
20
23
|
},
|
|
21
24
|
"keywords": [
|
|
22
25
|
"database",
|
|
@@ -25,7 +28,9 @@
|
|
|
25
28
|
"turso",
|
|
26
29
|
"migrations",
|
|
27
30
|
"schema",
|
|
28
|
-
"orm"
|
|
31
|
+
"orm",
|
|
32
|
+
"cli",
|
|
33
|
+
"studio"
|
|
29
34
|
],
|
|
30
35
|
"author": "Damilola Alao",
|
|
31
36
|
"license": "MIT",
|
|
@@ -36,19 +41,33 @@
|
|
|
36
41
|
"devDependencies": {
|
|
37
42
|
"@types/jest": "^29.5.12",
|
|
38
43
|
"@types/node": "^22.15.21",
|
|
44
|
+
"drizzle-kit": "^0.31.8",
|
|
39
45
|
"jest": "^29.7.0",
|
|
40
46
|
"ts-jest": "^29.2.0",
|
|
41
47
|
"typescript": "^5.8.3"
|
|
42
48
|
},
|
|
43
49
|
"peerDependencies": {
|
|
44
|
-
"dotenv": "^17.2.1"
|
|
50
|
+
"dotenv": "^17.2.1",
|
|
51
|
+
"drizzle-kit": "^0.30.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"drizzle-kit": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"optionalDependencies": {
|
|
59
|
+
"@libsql/darwin-arm64": "^0.3.19",
|
|
60
|
+
"@libsql/darwin-x64": "^0.3.19",
|
|
61
|
+
"@libsql/linux-x64-gnu": "^0.3.19",
|
|
62
|
+
"@libsql/linux-arm64-gnu": "^0.3.19",
|
|
63
|
+
"@libsql/win32-x64-msvc": "^0.3.19"
|
|
45
64
|
},
|
|
46
65
|
"repository": {
|
|
47
66
|
"type": "git",
|
|
48
|
-
"url": "https://github.com/
|
|
67
|
+
"url": "https://github.com/Easy-Deploy-Dev/nanodb-orm.git"
|
|
49
68
|
},
|
|
50
69
|
"bugs": {
|
|
51
|
-
"url": "https://github.com/
|
|
70
|
+
"url": "https://github.com/Easy-Deploy-Dev/nanodb-orm/issues"
|
|
52
71
|
},
|
|
53
|
-
"homepage": "https://github.com/
|
|
72
|
+
"homepage": "https://github.com/Easy-Deploy-Dev/nanodb-orm#readme"
|
|
54
73
|
}
|
package/dist/example.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example usage of nanodb-orm package
|
|
3
|
-
* This file demonstrates how to use the database package in your application
|
|
4
|
-
*/
|
|
5
|
-
declare const exampleTables: {
|
|
6
|
-
users: {
|
|
7
|
-
id: {
|
|
8
|
-
dataType: string;
|
|
9
|
-
primary: boolean;
|
|
10
|
-
autoIncrement: boolean;
|
|
11
|
-
notNull: boolean;
|
|
12
|
-
};
|
|
13
|
-
name: {
|
|
14
|
-
dataType: string;
|
|
15
|
-
notNull: boolean;
|
|
16
|
-
};
|
|
17
|
-
age: {
|
|
18
|
-
dataType: string;
|
|
19
|
-
notNull: boolean;
|
|
20
|
-
};
|
|
21
|
-
email: {
|
|
22
|
-
dataType: string;
|
|
23
|
-
notNull: boolean;
|
|
24
|
-
unique: boolean;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
posts: {
|
|
28
|
-
id: {
|
|
29
|
-
dataType: string;
|
|
30
|
-
primary: boolean;
|
|
31
|
-
autoIncrement: boolean;
|
|
32
|
-
notNull: boolean;
|
|
33
|
-
};
|
|
34
|
-
title: {
|
|
35
|
-
dataType: string;
|
|
36
|
-
notNull: boolean;
|
|
37
|
-
};
|
|
38
|
-
content: {
|
|
39
|
-
dataType: string;
|
|
40
|
-
notNull: boolean;
|
|
41
|
-
};
|
|
42
|
-
userId: {
|
|
43
|
-
dataType: string;
|
|
44
|
-
notNull: boolean;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
declare const exampleSeedData: {
|
|
49
|
-
users: {
|
|
50
|
-
name: string;
|
|
51
|
-
age: number;
|
|
52
|
-
email: string;
|
|
53
|
-
}[];
|
|
54
|
-
posts: {
|
|
55
|
-
title: string;
|
|
56
|
-
content: string;
|
|
57
|
-
userId: number;
|
|
58
|
-
}[];
|
|
59
|
-
};
|
|
60
|
-
declare const exampleMigrationConfig: {
|
|
61
|
-
preserveData: boolean;
|
|
62
|
-
autoMigrate: boolean;
|
|
63
|
-
dropTables: boolean;
|
|
64
|
-
};
|
|
65
|
-
declare function example(): Promise<void>;
|
|
66
|
-
export { example, exampleTables, exampleSeedData, exampleMigrationConfig };
|
|
67
|
-
//# sourceMappingURL=example.d.ts.map
|
package/dist/example.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../example.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAalB,CAAC;AAGF,QAAA,MAAM,eAAe;;;;;;;;;;;CASpB,CAAC;AAGF,QAAA,MAAM,sBAAsB;;;;CAI3B,CAAC;AAEF,iBAAe,OAAO,kBA2CrB;AAOD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC"}
|
package/dist/example.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Example usage of nanodb-orm package
|
|
4
|
-
* This file demonstrates how to use the database package in your application
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.exampleMigrationConfig = exports.exampleSeedData = exports.exampleTables = void 0;
|
|
8
|
-
exports.example = example;
|
|
9
|
-
const index_1 = require("./index");
|
|
10
|
-
// Example: Define your Drizzle tables
|
|
11
|
-
const exampleTables = {
|
|
12
|
-
users: {
|
|
13
|
-
id: { dataType: 'integer', primary: true, autoIncrement: true, notNull: true },
|
|
14
|
-
name: { dataType: 'text', notNull: true },
|
|
15
|
-
age: { dataType: 'integer', notNull: true },
|
|
16
|
-
email: { dataType: 'text', notNull: true, unique: true }
|
|
17
|
-
},
|
|
18
|
-
posts: {
|
|
19
|
-
id: { dataType: 'integer', primary: true, autoIncrement: true, notNull: true },
|
|
20
|
-
title: { dataType: 'text', notNull: true },
|
|
21
|
-
content: { dataType: 'text', notNull: true },
|
|
22
|
-
userId: { dataType: 'integer', notNull: true }
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
exports.exampleTables = exampleTables;
|
|
26
|
-
// Example: Define seed data
|
|
27
|
-
const exampleSeedData = {
|
|
28
|
-
users: [
|
|
29
|
-
{ name: 'Alice Johnson', age: 28, email: 'alice@example.com' },
|
|
30
|
-
{ name: 'Bob Smith', age: 32, email: 'bob@example.com' }
|
|
31
|
-
],
|
|
32
|
-
posts: [
|
|
33
|
-
{ title: 'Welcome to our blog', content: 'This is our first post!', userId: 1 },
|
|
34
|
-
{ title: 'Getting started', content: 'Here are some tips for beginners.', userId: 2 }
|
|
35
|
-
]
|
|
36
|
-
};
|
|
37
|
-
exports.exampleSeedData = exampleSeedData;
|
|
38
|
-
// Example: Migration configuration
|
|
39
|
-
const exampleMigrationConfig = {
|
|
40
|
-
preserveData: true, // Always try to preserve existing data
|
|
41
|
-
autoMigrate: true, // Enable automatic migrations
|
|
42
|
-
dropTables: false // Don't drop tables by default
|
|
43
|
-
};
|
|
44
|
-
exports.exampleMigrationConfig = exampleMigrationConfig;
|
|
45
|
-
async function example() {
|
|
46
|
-
try {
|
|
47
|
-
console.log('🚀 Initializing database package...');
|
|
48
|
-
// Initialize the database package
|
|
49
|
-
(0, index_1.initializeDatabase)({
|
|
50
|
-
tables: exampleTables,
|
|
51
|
-
seedData: exampleSeedData,
|
|
52
|
-
migrationConfig: exampleMigrationConfig
|
|
53
|
-
});
|
|
54
|
-
console.log('✅ Database package initialized successfully!');
|
|
55
|
-
// Setup the database (create tables, run migrations, seed data)
|
|
56
|
-
console.log('🔧 Setting up database...');
|
|
57
|
-
await index_1.DatabaseSync.setup();
|
|
58
|
-
console.log('✅ Database setup completed!');
|
|
59
|
-
// Example: Schema introspection
|
|
60
|
-
console.log('🔍 Analyzing schema...');
|
|
61
|
-
const tableNames = index_1.SchemaIntrospection.getAllTableNames();
|
|
62
|
-
console.log('📊 Tables found:', tableNames);
|
|
63
|
-
const schemaStats = index_1.SchemaIntrospection.getSchemaStats();
|
|
64
|
-
console.log('📈 Schema statistics:', {
|
|
65
|
-
totalTables: schemaStats.totalTables,
|
|
66
|
-
tableNames: schemaStats.tableNames
|
|
67
|
-
});
|
|
68
|
-
// Example: Check database health
|
|
69
|
-
const healthCheck = await index_1.DatabaseSync.healthCheck();
|
|
70
|
-
console.log('🎯 Database health:', healthCheck.healthy);
|
|
71
|
-
console.log('📊 Database info:', {
|
|
72
|
-
tables: healthCheck.tables,
|
|
73
|
-
totalRecords: healthCheck.totalRecords,
|
|
74
|
-
schemaValid: healthCheck.schemaValid
|
|
75
|
-
});
|
|
76
|
-
console.log('🎉 Example completed successfully!');
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.error('❌ Error in example:', error);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Run the example if this file is executed directly
|
|
83
|
-
if (require.main === module) {
|
|
84
|
-
example();
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=example.js.map
|
package/dist/example.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","sourceRoot":"","sources":["../example.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyFM,0BAAO;AAvFhB,mCAAgF;AAEhF,sCAAsC;AACtC,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE;QACL,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;QAC9E,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;QACzC,GAAG,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;QAC3C,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;KACzD;IACD,KAAK,EAAE;QACL,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,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|
1
|
-
/**
|
|
2
|
-
* Database type definitions for better type safety
|
|
3
|
-
*/
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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AC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
package/dist/types/database.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../types/database.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database-related TypeScript interfaces and types
|
|
3
|
-
*/
|
|
4
|
-
export interface DatabaseInfo {
|
|
5
|
-
dbTables: string[];
|
|
6
|
-
schemaTables: string[];
|
|
7
|
-
tableCounts: Record<string, number>;
|
|
8
|
-
connectionUrl: string;
|
|
9
|
-
hasAuth: boolean;
|
|
10
|
-
isSchemaSynced: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface HealthCheckResult {
|
|
13
|
-
isHealthy: boolean;
|
|
14
|
-
missingTables: string[];
|
|
15
|
-
errors: string[];
|
|
16
|
-
}
|
|
17
|
-
export interface SeedData {
|
|
18
|
-
[tableName: string]: Array<Record<string, any>>;
|
|
19
|
-
}
|
|
20
|
-
export interface SyncResult {
|
|
21
|
-
success: boolean;
|
|
22
|
-
message: string;
|
|
23
|
-
timestamp: Date;
|
|
24
|
-
}
|
|
25
|
-
export interface TableInfo {
|
|
26
|
-
name: string;
|
|
27
|
-
exists: boolean;
|
|
28
|
-
rowCount: number;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|