@onurege3467/zerohelper 10.2.6 → 11.0.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.
Files changed (79) hide show
  1. package/README.md +9 -704
  2. package/dist/index.js +19 -44
  3. package/package.json +21 -70
  4. package/dist/bin/commands/cache.d.ts +0 -2
  5. package/dist/bin/commands/cache.js +0 -92
  6. package/dist/bin/commands/db-backup.d.ts +0 -3
  7. package/dist/bin/commands/db-backup.js +0 -118
  8. package/dist/bin/commands/db.d.ts +0 -2
  9. package/dist/bin/commands/db.js +0 -334
  10. package/dist/bin/commands/import-export.d.ts +0 -3
  11. package/dist/bin/commands/import-export.js +0 -123
  12. package/dist/bin/commands/init.d.ts +0 -2
  13. package/dist/bin/commands/init.js +0 -85
  14. package/dist/bin/commands/migrate.d.ts +0 -3
  15. package/dist/bin/commands/migrate.js +0 -167
  16. package/dist/bin/commands/repl.d.ts +0 -2
  17. package/dist/bin/commands/repl.js +0 -96
  18. package/dist/bin/commands/seed.d.ts +0 -2
  19. package/dist/bin/commands/seed.js +0 -76
  20. package/dist/bin/commands/zpack.d.ts +0 -2
  21. package/dist/bin/commands/zpack.js +0 -36
  22. package/dist/bin/index.d.ts +0 -2
  23. package/dist/bin/index.js +0 -28
  24. package/dist/bin/types.d.ts +0 -22
  25. package/dist/bin/types.js +0 -2
  26. package/dist/bin/utils/config.d.ts +0 -3
  27. package/dist/bin/utils/config.js +0 -78
  28. package/dist/bin/utils/prompts.d.ts +0 -3
  29. package/dist/bin/utils/prompts.js +0 -115
  30. package/dist/bin/zero.d.ts +0 -2
  31. package/dist/bin/zero.js +0 -849
  32. package/dist/database/IDatabase.d.ts +0 -71
  33. package/dist/database/IDatabase.js +0 -48
  34. package/dist/database/cacheWrapper.d.ts +0 -34
  35. package/dist/database/cacheWrapper.js +0 -214
  36. package/dist/database/index.d.ts +0 -12
  37. package/dist/database/index.js +0 -100
  38. package/dist/database/json.d.ts +0 -32
  39. package/dist/database/json.js +0 -208
  40. package/dist/database/migration.d.ts +0 -21
  41. package/dist/database/migration.js +0 -97
  42. package/dist/database/mongodb.d.ts +0 -26
  43. package/dist/database/mongodb.js +0 -145
  44. package/dist/database/mysql.d.ts +0 -29
  45. package/dist/database/mysql.js +0 -282
  46. package/dist/database/pg.d.ts +0 -28
  47. package/dist/database/pg.js +0 -200
  48. package/dist/database/redis.d.ts +0 -31
  49. package/dist/database/redis.js +0 -176
  50. package/dist/database/seeder.d.ts +0 -20
  51. package/dist/database/seeder.js +0 -37
  52. package/dist/database/sqlite.d.ts +0 -26
  53. package/dist/database/sqlite.js +0 -211
  54. package/dist/database/telemetry.d.ts +0 -35
  55. package/dist/database/telemetry.js +0 -41
  56. package/dist/database/toon.d.ts +0 -33
  57. package/dist/database/toon.js +0 -244
  58. package/dist/database/types.d.ts +0 -71
  59. package/dist/database/types.js +0 -2
  60. package/dist/database/zpack.d.ts +0 -75
  61. package/dist/database/zpack.js +0 -616
  62. package/dist/functions/index.d.ts +0 -199
  63. package/dist/functions/index.js +0 -682
  64. package/dist/functions/security.d.ts +0 -15
  65. package/dist/functions/security.js +0 -46
  66. package/dist/functions/toon.d.ts +0 -10
  67. package/dist/functions/toon.js +0 -214
  68. package/dist/functions/worker.d.ts +0 -5
  69. package/dist/functions/worker.js +0 -35
  70. package/dist/index.d.ts +0 -8
  71. package/dist/migrations/1767521950635_test_migration.d.ts +0 -3
  72. package/dist/migrations/1767521950635_test_migration.js +0 -11
  73. package/dist/migrations/1767522158826_create_users_table.d.ts +0 -2
  74. package/dist/migrations/1767522158826_create_users_table.js +0 -11
  75. package/dist/package.json +0 -79
  76. package/dist/tests/test.d.ts +0 -1
  77. package/dist/tests/test.js +0 -26
  78. package/dist/zero.config.d.ts +0 -10
  79. package/dist/zero.config.js +0 -13
@@ -1,208 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.JsonDatabase = void 0;
7
- const IDatabase_1 = require("./IDatabase");
8
- const promises_1 = __importDefault(require("fs/promises"));
9
- const fs_1 = require("fs");
10
- const path_1 = __importDefault(require("path"));
11
- class JsonDatabase extends IDatabase_1.IDatabase {
12
- constructor(config) {
13
- super();
14
- this.db = {};
15
- this.isDirty = false;
16
- this.isWriting = false;
17
- this.writeQueue = [];
18
- this.saveDebounceTimeout = null;
19
- if (!config || !config.path)
20
- throw new Error('JsonDB: "path" gereklidir.');
21
- this.filePath = config.path;
22
- this.saveInterval = config.saveInterval || 500;
23
- process.on('exit', () => this.flushSync());
24
- this.initPromise = this._load();
25
- }
26
- async _execute(op, table, fn) {
27
- const start = Date.now();
28
- const res = await fn();
29
- this.recordMetric(op, table, Date.now() - start);
30
- return res;
31
- }
32
- async _load() {
33
- try {
34
- const dir = path_1.default.dirname(this.filePath);
35
- await promises_1.default.mkdir(dir, { recursive: true });
36
- const fileContent = await promises_1.default.readFile(this.filePath, 'utf-8');
37
- this.db = JSON.parse(fileContent);
38
- }
39
- catch (error) {
40
- if (error.code === 'ENOENT') {
41
- this.db = {};
42
- await this._saveNow();
43
- }
44
- else {
45
- this.db = {};
46
- }
47
- }
48
- }
49
- _queueRequest(operation) {
50
- return new Promise((resolve, reject) => {
51
- this.writeQueue.push({ operation, resolve, reject });
52
- this._processQueue();
53
- });
54
- }
55
- async _processQueue() {
56
- if (this.isWriting || this.writeQueue.length === 0)
57
- return;
58
- this.isWriting = true;
59
- const item = this.writeQueue.shift();
60
- if (item) {
61
- try {
62
- const result = item.operation();
63
- this.isDirty = true;
64
- this._scheduleSave();
65
- item.resolve(result);
66
- }
67
- catch (error) {
68
- item.reject(error);
69
- }
70
- finally {
71
- this.isWriting = false;
72
- this._processQueue();
73
- }
74
- }
75
- }
76
- _scheduleSave() {
77
- if (this.saveDebounceTimeout)
78
- clearTimeout(this.saveDebounceTimeout);
79
- this.saveDebounceTimeout = setTimeout(() => this._saveNow(), this.saveInterval);
80
- }
81
- async _saveNow() {
82
- if (!this.isDirty)
83
- return;
84
- if (this.saveDebounceTimeout)
85
- clearTimeout(this.saveDebounceTimeout);
86
- this.saveDebounceTimeout = null;
87
- try {
88
- await promises_1.default.writeFile(this.filePath, JSON.stringify(this.db, null, 2));
89
- this.isDirty = false;
90
- }
91
- catch (error) {
92
- console.error("JsonDB save error:", error);
93
- }
94
- }
95
- flushSync() {
96
- if (this.isDirty) {
97
- try {
98
- (0, fs_1.writeFileSync)(this.filePath, JSON.stringify(this.db, null, 2));
99
- this.isDirty = false;
100
- }
101
- catch (error) { }
102
- }
103
- }
104
- async ensureTable(table) {
105
- await this.initPromise;
106
- if (!this.db[table]) {
107
- return this._queueRequest(() => { this.db[table] = []; });
108
- }
109
- }
110
- async insert(table, data) {
111
- await this.runHooks('beforeInsert', table, data);
112
- return this._execute('insert', table, async () => {
113
- await this.ensureTable(table);
114
- return this._queueRequest(() => {
115
- const maxId = this.db[table].reduce((max, row) => (row._id > max ? row._id : max), 0);
116
- const newId = maxId + 1;
117
- const newRow = { _id: newId, ...data };
118
- this.db[table].push(newRow);
119
- this.runHooks('afterInsert', table, newRow);
120
- return newId;
121
- });
122
- });
123
- }
124
- async update(table, data, where) {
125
- await this.runHooks('beforeUpdate', table, { data, where });
126
- return this._execute('update', table, async () => {
127
- await this.ensureTable(table);
128
- return this._queueRequest(() => {
129
- let affected = 0;
130
- this.db[table].forEach(row => {
131
- if (Object.keys(where).every(k => String(row[k]) === String(where[k]))) {
132
- Object.assign(row, data);
133
- affected++;
134
- }
135
- });
136
- this.runHooks('afterUpdate', table, { affected });
137
- return affected;
138
- });
139
- });
140
- }
141
- async delete(table, where) {
142
- await this.runHooks('beforeDelete', table, where);
143
- return this._execute('delete', table, async () => {
144
- await this.ensureTable(table);
145
- return this._queueRequest(() => {
146
- const initial = this.db[table].length;
147
- this.db[table] = this.db[table].filter(row => !Object.keys(where).every(k => String(row[k]) === String(where[k])));
148
- const affected = initial - this.db[table].length;
149
- this.runHooks('afterDelete', table, { affected });
150
- return affected;
151
- });
152
- });
153
- }
154
- async select(table, where = null) {
155
- return this._execute('select', table, async () => {
156
- await this.initPromise;
157
- const results = where && Object.keys(where).length > 0
158
- ? (this.db[table] || []).filter(row => Object.keys(where).every(k => String(row[k]) === String(where[k])))
159
- : (this.db[table] || []);
160
- return JSON.parse(JSON.stringify(results));
161
- });
162
- }
163
- async selectOne(table, where = null) {
164
- const res = await this.select(table, where);
165
- return res[0] || null;
166
- }
167
- async set(table, data, where) {
168
- const ex = await this.selectOne(table, where);
169
- return ex ? this.update(table, data, where) : this.insert(table, { ...where, ...data });
170
- }
171
- async bulkInsert(table, dataArray) {
172
- return this._execute('bulkInsert', table, async () => {
173
- if (!dataArray.length)
174
- return 0;
175
- await this.ensureTable(table);
176
- return this._queueRequest(() => {
177
- let maxId = this.db[table].reduce((max, row) => (row._id > max ? row._id : max), 0);
178
- dataArray.forEach(data => { maxId++; this.db[table].push({ _id: maxId, ...data }); });
179
- return dataArray.length;
180
- });
181
- });
182
- }
183
- async increment(table, incs, where = {}) {
184
- return this._execute('increment', table, async () => {
185
- await this.ensureTable(table);
186
- return this._queueRequest(() => {
187
- let affected = 0;
188
- this.db[table].forEach(row => {
189
- if (Object.keys(where).every(k => String(row[k]) === String(where[k]))) {
190
- for (const [f, v] of Object.entries(incs))
191
- row[f] = (Number(row[f]) || 0) + v;
192
- affected++;
193
- }
194
- });
195
- return affected;
196
- });
197
- });
198
- }
199
- async decrement(table, decs, where = {}) {
200
- const incs = {};
201
- for (const k in decs)
202
- incs[k] = -decs[k];
203
- return this.increment(table, incs, where);
204
- }
205
- async close() { await this._saveNow(); }
206
- }
207
- exports.JsonDatabase = JsonDatabase;
208
- exports.default = JsonDatabase;
@@ -1,21 +0,0 @@
1
- import { IDatabase } from './IDatabase';
2
- export interface MigrationFile {
3
- name: string;
4
- path: string;
5
- }
6
- export declare class MigrationManager {
7
- private db;
8
- private migrationsDir;
9
- private migrationsTable;
10
- constructor(database: IDatabase, options?: any);
11
- private ensureMigrationsDir;
12
- ensureMigrationsTable(): Promise<void>;
13
- createMigration(name: string, description?: string): string;
14
- getMigrationFiles(): MigrationFile[];
15
- getExecutedMigrations(): Promise<string[]>;
16
- getPendingMigrations(): Promise<MigrationFile[]>;
17
- runMigration(migrationFile: MigrationFile, direction?: 'up' | 'down'): Promise<boolean>;
18
- migrate(): Promise<void>;
19
- rollback(steps?: number): Promise<void>;
20
- }
21
- export default MigrationManager;
@@ -1,97 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MigrationManager = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- class MigrationManager {
10
- constructor(database, options = {}) {
11
- this.db = database;
12
- this.migrationsDir = options.migrationsDir || './migrations';
13
- this.migrationsTable = options.migrationsTable || 'migrations';
14
- this.ensureMigrationsDir();
15
- }
16
- ensureMigrationsDir() {
17
- if (!fs_1.default.existsSync(this.migrationsDir)) {
18
- fs_1.default.mkdirSync(this.migrationsDir, { recursive: true });
19
- }
20
- }
21
- async ensureMigrationsTable() {
22
- try {
23
- await this.db.selectOne(this.migrationsTable, {});
24
- }
25
- catch (error) {
26
- if (this.db.constructor.name === 'MySQLDatabase') {
27
- await this.db.query(`CREATE TABLE IF NOT EXISTS ${this.migrationsTable} (id INTEGER PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL UNIQUE, executed_at DATETIME DEFAULT CURRENT_TIMESTAMP)`);
28
- }
29
- else if (this.db.constructor.name === 'PostgreSQLDatabase') {
30
- await this.db.query(`CREATE TABLE IF NOT EXISTS ${this.migrationsTable} (id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL UNIQUE, executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)`);
31
- }
32
- else {
33
- await this.db.query(`CREATE TABLE IF NOT EXISTS ${this.migrationsTable} (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) NOT NULL UNIQUE, executed_at DATETIME DEFAULT CURRENT_TIMESTAMP)`);
34
- }
35
- }
36
- }
37
- createMigration(name, description = '') {
38
- const timestamp = Date.now();
39
- const filename = `${timestamp}_${name}.ts`;
40
- const filePath = path_1.default.join(this.migrationsDir, filename);
41
- const template = `import { IDatabase } from "../database/IDatabase";\n\nexport const up = async (db: IDatabase) => {\n // Migration logic here\n};\n\nexport const down = async (db: IDatabase) => {\n // Rollback logic here\n};\n`;
42
- fs_1.default.writeFileSync(filePath, template);
43
- return filename;
44
- }
45
- getMigrationFiles() {
46
- return fs_1.default.readdirSync(this.migrationsDir)
47
- .filter(file => file.endsWith('.ts') || file.endsWith('.js'))
48
- .sort()
49
- .map(file => ({ name: file, path: path_1.default.join(this.migrationsDir, file) }));
50
- }
51
- async getExecutedMigrations() {
52
- await this.ensureMigrationsTable();
53
- try {
54
- const executed = await this.db.select(this.migrationsTable, {});
55
- return executed.map((row) => row.name);
56
- }
57
- catch {
58
- return [];
59
- }
60
- }
61
- async getPendingMigrations() {
62
- const all = this.getMigrationFiles();
63
- const executed = await this.getExecutedMigrations();
64
- return all.filter(m => !executed.includes(m.name));
65
- }
66
- async runMigration(migrationFile, direction = 'up') {
67
- try {
68
- const migration = require(path_1.default.resolve(migrationFile.path));
69
- if (typeof migration[direction] !== 'function')
70
- throw new Error(`Migration ${migrationFile.name} has no ${direction} method`);
71
- await migration[direction](this.db);
72
- if (direction === 'up')
73
- await this.db.insert(this.migrationsTable, { name: migrationFile.name });
74
- else
75
- await this.db.delete(this.migrationsTable, { name: migrationFile.name });
76
- return true;
77
- }
78
- catch (error) {
79
- console.error(`Migration ${migrationFile.name} error:`, error);
80
- throw error;
81
- }
82
- }
83
- async migrate() {
84
- const pending = await this.getPendingMigrations();
85
- for (const m of pending)
86
- await this.runMigration(m, 'up');
87
- }
88
- async rollback(steps = 1) {
89
- const executed = await this.getExecutedMigrations();
90
- const all = this.getMigrationFiles();
91
- const toRollback = executed.slice(-steps).reverse().map(name => all.find(m => m.name === name)).filter((m) => !!m);
92
- for (const m of toRollback)
93
- await this.runMigration(m, 'down');
94
- }
95
- }
96
- exports.MigrationManager = MigrationManager;
97
- exports.default = MigrationManager;
@@ -1,26 +0,0 @@
1
- import { IDatabase } from './IDatabase';
2
- import { MongoDBConfig } from './types';
3
- export declare class MongoDBDatabase extends IDatabase {
4
- private client;
5
- private db;
6
- private _isConnected;
7
- private _queue;
8
- constructor(config: MongoDBConfig);
9
- private _connect;
10
- private _flushQueue;
11
- private _flushQueueWithError;
12
- private _execute;
13
- insert(collection: string, data: any): Promise<string>;
14
- update(collection: string, data: any, where: any): Promise<number>;
15
- delete(collection: string, where: any): Promise<number>;
16
- select<T = any>(collection: string, where?: any): Promise<T[]>;
17
- selectOne<T = any>(collection: string, where?: any): Promise<T | null>;
18
- set(collection: string, data: any, where: any): Promise<any>;
19
- bulkInsert(collection: string, dataArray: any[]): Promise<number>;
20
- increment(collection: string, incs: Record<string, number>, where?: any): Promise<number>;
21
- decrement(collection: string, decs: Record<string, number>, where?: any): Promise<number>;
22
- close(): Promise<void>;
23
- private _formatQuery;
24
- private _serialize;
25
- }
26
- export default MongoDBDatabase;
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MongoDBDatabase = void 0;
4
- const IDatabase_1 = require("./IDatabase");
5
- const mongodb_1 = require("mongodb");
6
- class MongoDBDatabase extends IDatabase_1.IDatabase {
7
- constructor(config) {
8
- super();
9
- this.db = null;
10
- this._isConnected = false;
11
- this._queue = [];
12
- const uri = config.url || (config.uri ?? `mongodb://${config.host || 'localhost'}:${config.port || 27017}`);
13
- this.client = new mongodb_1.MongoClient(uri, {
14
- serverSelectionTimeoutMS: 5000, // Fail fast if no server
15
- connectTimeoutMS: 5000
16
- });
17
- this._connect(config.database || 'test');
18
- }
19
- async _connect(dbName) {
20
- try {
21
- await this.client.connect();
22
- this.db = this.client.db(dbName);
23
- this._isConnected = true;
24
- this._flushQueue();
25
- }
26
- catch (error) {
27
- this._flushQueueWithError(error);
28
- // Opsiyonel: Yeniden bağlanma mantığı buraya eklenebilir,
29
- // ama testler için fail-fast daha iyidir.
30
- }
31
- }
32
- _flushQueue() {
33
- while (this._queue.length > 0) {
34
- const item = this._queue.shift();
35
- if (item) {
36
- item.operation().then(item.resolve).catch(item.reject);
37
- }
38
- }
39
- }
40
- _flushQueueWithError(error) {
41
- while (this._queue.length > 0) {
42
- const item = this._queue.shift();
43
- if (item)
44
- item.reject(error);
45
- }
46
- }
47
- async _execute(fn) {
48
- if (this._isConnected) {
49
- return fn();
50
- }
51
- return new Promise((resolve, reject) => {
52
- this._queue.push({ operation: fn, resolve, reject });
53
- });
54
- }
55
- // --- Implementations ---
56
- async insert(collection, data) {
57
- await this.runHooks('beforeInsert', collection, data);
58
- return this._execute(async () => {
59
- const res = await this.db.collection(collection).insertOne(data);
60
- const newId = res.insertedId.toString();
61
- const finalData = { _id: newId, ...data };
62
- await this.runHooks('afterInsert', collection, finalData);
63
- return newId;
64
- });
65
- }
66
- async update(collection, data, where) {
67
- await this.runHooks('beforeUpdate', collection, { data, where });
68
- const formattedWhere = this._formatQuery(where);
69
- return this._execute(async () => {
70
- const res = await this.db.collection(collection).updateMany(formattedWhere, { $set: data });
71
- return res.modifiedCount;
72
- });
73
- }
74
- async delete(collection, where) {
75
- await this.runHooks('beforeDelete', collection, where);
76
- const formattedWhere = this._formatQuery(where);
77
- return this._execute(async () => {
78
- const res = await this.db.collection(collection).deleteMany(formattedWhere);
79
- return res.deletedCount;
80
- });
81
- }
82
- async select(collection, where = {}) {
83
- const formattedWhere = this._formatQuery(where);
84
- return this._execute(async () => {
85
- const docs = await this.db.collection(collection).find(formattedWhere).toArray();
86
- return docs.map(doc => this._serialize(doc));
87
- });
88
- }
89
- async selectOne(collection, where = {}) {
90
- const formattedWhere = this._formatQuery(where);
91
- return this._execute(async () => {
92
- const doc = await this.db.collection(collection).findOne(formattedWhere);
93
- return doc ? this._serialize(doc) : null;
94
- });
95
- }
96
- async set(collection, data, where) {
97
- const ex = await this.selectOne(collection, where);
98
- return ex ? this.update(collection, data, where) : this.insert(collection, { ...where, ...data });
99
- }
100
- async bulkInsert(collection, dataArray) {
101
- if (!dataArray.length)
102
- return 0;
103
- return this._execute(async () => {
104
- const res = await this.db.collection(collection).insertMany(dataArray);
105
- return res.insertedCount;
106
- });
107
- }
108
- async increment(collection, incs, where = {}) {
109
- const formattedWhere = this._formatQuery(where);
110
- return this._execute(async () => {
111
- const res = await this.db.collection(collection).updateMany(formattedWhere, { $inc: incs });
112
- return res.modifiedCount;
113
- });
114
- }
115
- async decrement(collection, decs, where = {}) {
116
- const incs = {};
117
- for (const k in decs)
118
- incs[k] = -decs[k];
119
- return this.increment(collection, incs, where);
120
- }
121
- async close() {
122
- if (this.client)
123
- await this.client.close();
124
- this._isConnected = false;
125
- }
126
- // Helper: _id handling and query formatting
127
- _formatQuery(where) {
128
- if (!where)
129
- return {};
130
- const query = { ...where };
131
- if (query._id && typeof query._id === 'string' && mongodb_1.ObjectId.isValid(query._id)) {
132
- query._id = new mongodb_1.ObjectId(query._id);
133
- }
134
- return query;
135
- }
136
- _serialize(doc) {
137
- if (!doc)
138
- return doc;
139
- const { _id, ...rest } = doc;
140
- // _id'yi string olarak döndür, ZeroHelper standardı
141
- return { _id: _id.toString(), ...rest };
142
- }
143
- }
144
- exports.MongoDBDatabase = MongoDBDatabase;
145
- exports.default = MongoDBDatabase;
@@ -1,29 +0,0 @@
1
- import { IDatabase } from './IDatabase';
2
- import { MySQLConfig } from './types';
3
- export declare class MySQLDatabase extends IDatabase {
4
- private config;
5
- private pool;
6
- private _queue;
7
- private _connected;
8
- private _connectionPromise;
9
- constructor(config: MySQLConfig);
10
- private _execute;
11
- private _processQueue;
12
- query(sql: string, params?: any[]): Promise<any>;
13
- private _ensureMissingColumns;
14
- ensureTable(table: string, data?: any): Promise<void>;
15
- insert(table: string, data: Record<string, any>): Promise<number>;
16
- update(table: string, data: Record<string, any>, where: Record<string, any>): Promise<number>;
17
- delete(table: string, where: Record<string, any>): Promise<number>;
18
- select<T = any>(table: string, where?: Record<string, any> | null): Promise<T[]>;
19
- selectOne<T = any>(table: string, where?: Record<string, any> | null): Promise<T | null>;
20
- set(table: string, data: Record<string, any>, where: Record<string, any>): Promise<any>;
21
- bulkInsert(table: string, dataArray: Record<string, any>[]): Promise<number>;
22
- increment(table: string, incs: Record<string, number>, where: Record<string, any>): Promise<number>;
23
- decrement(table: string, decs: Record<string, number>, where: Record<string, any>): Promise<number>;
24
- close(): Promise<void>;
25
- private _getColumnType;
26
- private _serializeValue;
27
- private _buildWhereClause;
28
- }
29
- export default MySQLDatabase;