@arikajs/database 0.0.1

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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +333 -0
  3. package/dist/Connections/MySQLConnection.d.ts +39 -0
  4. package/dist/Connections/MySQLConnection.d.ts.map +1 -0
  5. package/dist/Connections/MySQLConnection.js +91 -0
  6. package/dist/Connections/MySQLConnection.js.map +1 -0
  7. package/dist/Connections/PostgreSQLConnection.d.ts +39 -0
  8. package/dist/Connections/PostgreSQLConnection.d.ts.map +1 -0
  9. package/dist/Connections/PostgreSQLConnection.js +85 -0
  10. package/dist/Connections/PostgreSQLConnection.js.map +1 -0
  11. package/dist/Connections/SQLiteConnection.d.ts +51 -0
  12. package/dist/Connections/SQLiteConnection.d.ts.map +1 -0
  13. package/dist/Connections/SQLiteConnection.js +111 -0
  14. package/dist/Connections/SQLiteConnection.js.map +1 -0
  15. package/dist/Contracts/Database.d.ts +131 -0
  16. package/dist/Contracts/Database.d.ts.map +1 -0
  17. package/dist/Contracts/Database.js +3 -0
  18. package/dist/Contracts/Database.js.map +1 -0
  19. package/dist/Contracts/Schema.d.ts +124 -0
  20. package/dist/Contracts/Schema.d.ts.map +1 -0
  21. package/dist/Contracts/Schema.js +3 -0
  22. package/dist/Contracts/Schema.js.map +1 -0
  23. package/dist/Database.d.ts +38 -0
  24. package/dist/Database.d.ts.map +1 -0
  25. package/dist/Database.js +55 -0
  26. package/dist/Database.js.map +1 -0
  27. package/dist/DatabaseManager.d.ts +36 -0
  28. package/dist/DatabaseManager.d.ts.map +1 -0
  29. package/dist/DatabaseManager.js +126 -0
  30. package/dist/DatabaseManager.js.map +1 -0
  31. package/dist/Migrations/Migration.d.ts +17 -0
  32. package/dist/Migrations/Migration.d.ts.map +1 -0
  33. package/dist/Migrations/Migration.js +10 -0
  34. package/dist/Migrations/Migration.js.map +1 -0
  35. package/dist/Migrations/Migrator.d.ts +51 -0
  36. package/dist/Migrations/Migrator.d.ts.map +1 -0
  37. package/dist/Migrations/Migrator.js +166 -0
  38. package/dist/Migrations/Migrator.js.map +1 -0
  39. package/dist/Model/Model.d.ts +309 -0
  40. package/dist/Model/Model.d.ts.map +1 -0
  41. package/dist/Model/Model.js +607 -0
  42. package/dist/Model/Model.js.map +1 -0
  43. package/dist/Model/Relations.d.ts +53 -0
  44. package/dist/Model/Relations.d.ts.map +1 -0
  45. package/dist/Model/Relations.js +124 -0
  46. package/dist/Model/Relations.js.map +1 -0
  47. package/dist/Model/SoftDeletes.d.ts +24 -0
  48. package/dist/Model/SoftDeletes.d.ts.map +1 -0
  49. package/dist/Model/SoftDeletes.js +95 -0
  50. package/dist/Model/SoftDeletes.js.map +1 -0
  51. package/dist/Query/QueryBuilder.d.ts +94 -0
  52. package/dist/Query/QueryBuilder.d.ts.map +1 -0
  53. package/dist/Query/QueryBuilder.js +276 -0
  54. package/dist/Query/QueryBuilder.js.map +1 -0
  55. package/dist/Schema/Grammars/Grammar.d.ts +27 -0
  56. package/dist/Schema/Grammars/Grammar.d.ts.map +1 -0
  57. package/dist/Schema/Grammars/Grammar.js +25 -0
  58. package/dist/Schema/Grammars/Grammar.js.map +1 -0
  59. package/dist/Schema/Grammars/MySQLGrammar.d.ts +13 -0
  60. package/dist/Schema/Grammars/MySQLGrammar.d.ts.map +1 -0
  61. package/dist/Schema/Grammars/MySQLGrammar.js +78 -0
  62. package/dist/Schema/Grammars/MySQLGrammar.js.map +1 -0
  63. package/dist/Schema/Grammars/PostgreSQLGrammar.d.ts +13 -0
  64. package/dist/Schema/Grammars/PostgreSQLGrammar.d.ts.map +1 -0
  65. package/dist/Schema/Grammars/PostgreSQLGrammar.js +57 -0
  66. package/dist/Schema/Grammars/PostgreSQLGrammar.js.map +1 -0
  67. package/dist/Schema/Grammars/SQLiteGrammar.d.ts +13 -0
  68. package/dist/Schema/Grammars/SQLiteGrammar.d.ts.map +1 -0
  69. package/dist/Schema/Grammars/SQLiteGrammar.js +53 -0
  70. package/dist/Schema/Grammars/SQLiteGrammar.js.map +1 -0
  71. package/dist/Schema/Schema.d.ts +120 -0
  72. package/dist/Schema/Schema.d.ts.map +1 -0
  73. package/dist/Schema/Schema.js +226 -0
  74. package/dist/Schema/Schema.js.map +1 -0
  75. package/dist/Schema/SchemaBuilder.d.ts +24 -0
  76. package/dist/Schema/SchemaBuilder.d.ts.map +1 -0
  77. package/dist/Schema/SchemaBuilder.js +49 -0
  78. package/dist/Schema/SchemaBuilder.js.map +1 -0
  79. package/dist/Seeders/SeedRunner.d.ts +22 -0
  80. package/dist/Seeders/SeedRunner.d.ts.map +1 -0
  81. package/dist/Seeders/SeedRunner.js +72 -0
  82. package/dist/Seeders/SeedRunner.js.map +1 -0
  83. package/dist/Seeders/Seeder.d.ts +11 -0
  84. package/dist/Seeders/Seeder.d.ts.map +1 -0
  85. package/dist/Seeders/Seeder.js +10 -0
  86. package/dist/Seeders/Seeder.js.map +1 -0
  87. package/dist/index.d.ts +19 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +52 -0
  90. package/dist/index.js.map +1 -0
  91. package/package.json +53 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Base Migration class
3
+ */
4
+ export declare abstract class Migration {
5
+ /**
6
+ * Run the migrations.
7
+ */
8
+ /**
9
+ * Run the migrations.
10
+ */
11
+ abstract up(schema?: any): Promise<void>;
12
+ /**
13
+ * Reverse the migrations.
14
+ */
15
+ abstract down(schema?: any): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=Migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration.d.ts","sourceRoot":"","sources":["../../src/Migrations/Migration.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,8BAAsB,SAAS;IAC3B;;OAEG;IACH;;OAEG;aACa,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAE/C;;OAEG;aACa,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CACpD"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration = void 0;
4
+ /**
5
+ * Base Migration class
6
+ */
7
+ class Migration {
8
+ }
9
+ exports.Migration = Migration;
10
+ //# sourceMappingURL=Migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration.js","sourceRoot":"","sources":["../../src/Migrations/Migration.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACH,MAAsB,SAAS;CAa9B;AAbD,8BAaC"}
@@ -0,0 +1,51 @@
1
+ import { DatabaseManager } from '../DatabaseManager';
2
+ /**
3
+ * Migrator class for handling database migrations
4
+ */
5
+ export declare class Migrator {
6
+ private db;
7
+ private migrationsPath;
8
+ private tableName;
9
+ constructor(db: DatabaseManager, migrationsPath: string);
10
+ /**
11
+ * Run all pending migrations
12
+ */
13
+ migrate(): Promise<void>;
14
+ /**
15
+ * Rollback the last batch of migrations
16
+ */
17
+ rollback(): Promise<void>;
18
+ /**
19
+ * Ensure the migrations table exists
20
+ */
21
+ private ensureMigrationsTable;
22
+ /**
23
+ * Get all ran migrations
24
+ */
25
+ private getRan;
26
+ /**
27
+ * Get all migration files in the directory
28
+ */
29
+ private getMigrationFiles;
30
+ /**
31
+ * Resolve a migration file to a Migration instance
32
+ */
33
+ private resolve;
34
+ /**
35
+ * Log a migration as ran
36
+ */
37
+ private logMigration;
38
+ /**
39
+ * Delete a migration from the log
40
+ */
41
+ private deleteMigration;
42
+ /**
43
+ * Get the next batch number
44
+ */
45
+ private getNextBatchNumber;
46
+ /**
47
+ * Get all migrations from the last batch
48
+ */
49
+ private getLastBatch;
50
+ }
51
+ //# sourceMappingURL=Migrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migrator.d.ts","sourceRoot":"","sources":["../../src/Migrations/Migrator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,qBAAa,QAAQ;IAIb,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,cAAc;IAJ1B,OAAO,CAAC,SAAS,CAAgB;gBAGrB,EAAE,EAAE,eAAe,EACnB,cAAc,EAAE,MAAM;IAGlC;;OAEG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA8BrC;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBtC;;OAEG;YACW,qBAAqB;IAgBnC;;OAEG;YACW,MAAM;IAKpB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;OAEG;YACW,OAAO;IA6BrB;;OAEG;YACW,YAAY;IAO1B;;OAEG;YACW,eAAe;IAI7B;;OAEG;YACW,kBAAkB;IAKhC;;OAEG;YACW,YAAY;CAM7B"}
@@ -0,0 +1,166 @@
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.Migrator = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ /**
10
+ * Migrator class for handling database migrations
11
+ */
12
+ class Migrator {
13
+ constructor(db, migrationsPath) {
14
+ this.db = db;
15
+ this.migrationsPath = migrationsPath;
16
+ this.tableName = 'migrations';
17
+ }
18
+ /**
19
+ * Run all pending migrations
20
+ */
21
+ async migrate() {
22
+ await this.ensureMigrationsTable();
23
+ const ran = await this.getRan();
24
+ const files = this.getMigrationFiles();
25
+ const pending = files.filter(file => !ran.includes(file));
26
+ if (pending.length === 0) {
27
+ console.log('\x1b[32mNothing to migrate.\x1b[0m');
28
+ return;
29
+ }
30
+ const batch = await this.getNextBatchNumber();
31
+ for (const file of pending) {
32
+ console.log(`\x1b[33mMigrating: ${file}\x1b[0m`);
33
+ try {
34
+ const migration = await this.resolve(file);
35
+ await migration.up(this.db.schema());
36
+ await this.logMigration(file, batch);
37
+ console.log(`\x1b[32mMigrated: ${file}\x1b[0m`);
38
+ }
39
+ catch (error) {
40
+ console.error(`\x1b[31mMigration failed: ${file}\x1b[0m`);
41
+ console.error(error.message);
42
+ throw error;
43
+ }
44
+ }
45
+ }
46
+ /**
47
+ * Rollback the last batch of migrations
48
+ */
49
+ async rollback() {
50
+ await this.ensureMigrationsTable();
51
+ const lastBatch = await this.getLastBatch();
52
+ if (lastBatch.length === 0) {
53
+ console.log('\x1b[32mNothing to rollback.\x1b[0m');
54
+ return;
55
+ }
56
+ for (const migrationData of lastBatch) {
57
+ console.log(`\x1b[33mRolling back: ${migrationData.migration}\x1b[0m`);
58
+ try {
59
+ const migration = await this.resolve(migrationData.migration);
60
+ await migration.down(this.db.schema());
61
+ await this.deleteMigration(migrationData.migration);
62
+ console.log(`\x1b[32mRolled back: ${migrationData.migration}\x1b[0m`);
63
+ }
64
+ catch (error) {
65
+ console.error(`\x1b[31mRollback failed: ${migrationData.migration}\x1b[0m`);
66
+ console.error(error.message);
67
+ throw error;
68
+ }
69
+ }
70
+ }
71
+ /**
72
+ * Ensure the migrations table exists
73
+ */
74
+ async ensureMigrationsTable() {
75
+ const connection = await this.db.connection();
76
+ const grammar = connection.getSchemaGrammar().constructor.name;
77
+ let createSql = '';
78
+ if (grammar === 'MySQLGrammar') {
79
+ createSql = `CREATE TABLE IF NOT EXISTS ${this.tableName} (id INT AUTO_INCREMENT PRIMARY KEY, migration VARCHAR(255), batch INT) ENGINE=InnoDB`;
80
+ }
81
+ else if (grammar === 'PostgreSQLGrammar') {
82
+ createSql = `CREATE TABLE IF NOT EXISTS ${this.tableName} (id SERIAL PRIMARY KEY, migration VARCHAR(255), batch INT)`;
83
+ }
84
+ else {
85
+ createSql = `CREATE TABLE IF NOT EXISTS ${this.tableName} (id INTEGER PRIMARY KEY AUTOINCREMENT, migration TEXT, batch INTEGER)`;
86
+ }
87
+ await connection.query(createSql);
88
+ }
89
+ /**
90
+ * Get all ran migrations
91
+ */
92
+ async getRan() {
93
+ const rows = await this.db.table(this.tableName).select('migration').get();
94
+ return rows.map((row) => row.migration);
95
+ }
96
+ /**
97
+ * Get all migration files in the directory
98
+ */
99
+ getMigrationFiles() {
100
+ if (!fs_1.default.existsSync(this.migrationsPath))
101
+ return [];
102
+ return fs_1.default.readdirSync(this.migrationsPath)
103
+ .filter(file => (file.endsWith('.ts') || file.endsWith('.js')) && !file.endsWith('.d.ts'))
104
+ .sort();
105
+ }
106
+ /**
107
+ * Resolve a migration file to a Migration instance
108
+ */
109
+ async resolve(file) {
110
+ const fullPath = path_1.default.resolve(this.migrationsPath, file);
111
+ // In Node.js, we can use dynamic import
112
+ // If we are running in TS-Node environment, it will work for .ts files
113
+ const module = require(fullPath);
114
+ // Check for default export or named export
115
+ let MigrationClass = module.default || module;
116
+ // If it's still an object and has multiple exports, look for one that looks like a migration
117
+ if (typeof MigrationClass !== 'function' && typeof MigrationClass === 'object') {
118
+ MigrationClass = Object.values(MigrationClass).find(v => typeof v === 'function');
119
+ }
120
+ if (typeof MigrationClass !== 'function') {
121
+ // Handle case where it's an exported function up/down (Knex style)
122
+ if (module.up && module.down) {
123
+ return {
124
+ up: () => module.up(this.db.schema()),
125
+ down: () => module.down(this.db.schema())
126
+ };
127
+ }
128
+ throw new Error(`Migration ${file} does not export a valid Migration class or up/down functions.`);
129
+ }
130
+ return new MigrationClass();
131
+ }
132
+ /**
133
+ * Log a migration as ran
134
+ */
135
+ async logMigration(file, batch) {
136
+ await this.db.table(this.tableName).insert({
137
+ migration: file,
138
+ batch
139
+ });
140
+ }
141
+ /**
142
+ * Delete a migration from the log
143
+ */
144
+ async deleteMigration(file) {
145
+ await this.db.table(this.tableName).where('migration', file).delete();
146
+ }
147
+ /**
148
+ * Get the next batch number
149
+ */
150
+ async getNextBatchNumber() {
151
+ const rows = await this.db.table(this.tableName).select('batch').orderBy('batch', 'desc').limit(1).get();
152
+ return rows.length > 0 ? rows[0].batch + 1 : 1;
153
+ }
154
+ /**
155
+ * Get all migrations from the last batch
156
+ */
157
+ async getLastBatch() {
158
+ const rows = await this.db.table(this.tableName).select('batch').orderBy('batch', 'desc').limit(1).get();
159
+ if (rows.length === 0)
160
+ return [];
161
+ const batch = rows[0].batch;
162
+ return await this.db.table(this.tableName).where('batch', batch).orderBy('migration', 'desc').get();
163
+ }
164
+ }
165
+ exports.Migrator = Migrator;
166
+ //# sourceMappingURL=Migrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migrator.js","sourceRoot":"","sources":["../../src/Migrations/Migrator.ts"],"names":[],"mappings":";;;;;;AACA,4CAAoB;AACpB,gDAAwB;AAGxB;;GAEG;AACH,MAAa,QAAQ;IAGjB,YACY,EAAmB,EACnB,cAAsB;QADtB,OAAE,GAAF,EAAE,CAAiB;QACnB,mBAAc,GAAd,cAAc,CAAQ;QAJ1B,cAAS,GAAG,YAAY,CAAC;IAK7B,CAAC;IAEL;;OAEG;IACI,KAAK,CAAC,OAAO;QAChB,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAEnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAEvC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAE1D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;YAClD,OAAO;QACX,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE9C,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,SAAS,CAAC,CAAC;YACjD,IAAI,CAAC;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AAC;YAAE,OAAO,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5B,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;IACxG,CAAC;CACJ;AA3KD,4BA2KC"}
@@ -0,0 +1,309 @@
1
+ import { QueryBuilder } from '../Query/QueryBuilder';
2
+ import { HasOne, HasMany, BelongsTo, BelongsToMany } from './Relations';
3
+ /**
4
+ * Base Model class for Active Record pattern
5
+ */
6
+ export declare class Model {
7
+ /**
8
+ * The table associated with the model
9
+ */
10
+ protected static table: string;
11
+ /**
12
+ * Instance table name (for backward compatibility)
13
+ */
14
+ protected table: string;
15
+ /**
16
+ * The connection name for the model
17
+ */
18
+ protected static connection?: string;
19
+ /**
20
+ * Instance connection (for backward compatibility)
21
+ */
22
+ protected connection?: string;
23
+ /**
24
+ * The primary key for the model
25
+ */
26
+ protected static primaryKey: string;
27
+ /**
28
+ * Instance primary key (for backward compatibility)
29
+ */
30
+ protected primaryKey: string;
31
+ /**
32
+ * Indicates if the model exists in the database
33
+ */
34
+ protected exists: boolean;
35
+ /**
36
+ * The model's original attributes (for dirty checking)
37
+ */
38
+ protected original: Record<string, any>;
39
+ /**
40
+ * The model's attributes
41
+ */
42
+ protected attributes: Record<string, any>;
43
+ /**
44
+ * Loaded relationships
45
+ */
46
+ protected relations: Record<string, any>;
47
+ /**
48
+ * Create a new query builder for the model
49
+ */
50
+ static query<T extends Model>(this: typeof Model): ModelQueryBuilder<T>;
51
+ /**
52
+ * Find a record by ID
53
+ */
54
+ static find<T extends Model>(this: typeof Model, id: any): Promise<T | null>;
55
+ /**
56
+ * Find a record by ID or throw an error
57
+ */
58
+ static findOrFail<T extends Model>(this: typeof Model, id: any): Promise<T>;
59
+ /**
60
+ * Get all records
61
+ */
62
+ static all<T extends Model>(this: typeof Model): Promise<T[]>;
63
+ /**
64
+ * Add a where clause
65
+ */
66
+ static where<T extends Model>(this: typeof Model, column: string, operator: any, value?: any): ModelQueryBuilder<T>;
67
+ /**
68
+ * Add an OR where clause
69
+ */
70
+ static orWhere<T extends Model>(this: typeof Model, column: string, operator: any, value?: any): ModelQueryBuilder<T>;
71
+ /**
72
+ * Add a where in clause
73
+ */
74
+ static whereIn<T extends Model>(this: typeof Model, column: string, values: any[]): ModelQueryBuilder<T>;
75
+ /**
76
+ * Add a where not in clause
77
+ */
78
+ static whereNotIn<T extends Model>(this: typeof Model, column: string, values: any[]): ModelQueryBuilder<T>;
79
+ /**
80
+ * Add a where null clause
81
+ */
82
+ static whereNull<T extends Model>(this: typeof Model, column: string): ModelQueryBuilder<T>;
83
+ /**
84
+ * Add a where not null clause
85
+ */
86
+ static whereNotNull<T extends Model>(this: typeof Model, column: string): ModelQueryBuilder<T>;
87
+ /**
88
+ * Add an order by clause
89
+ */
90
+ static orderBy<T extends Model>(this: typeof Model, column: string, direction?: 'asc' | 'desc'): ModelQueryBuilder<T>;
91
+ /**
92
+ * Add a limit clause
93
+ */
94
+ static limit<T extends Model>(this: typeof Model, limit: number): ModelQueryBuilder<T>;
95
+ /**
96
+ * Add an offset clause
97
+ */
98
+ static offset<T extends Model>(this: typeof Model, offset: number): ModelQueryBuilder<T>;
99
+ /**
100
+ * Create a new record
101
+ */
102
+ static create<T extends Model>(this: typeof Model, data: Record<string, any>): Promise<T>;
103
+ /**
104
+ * Get the first record
105
+ */
106
+ static first<T extends Model>(this: typeof Model): Promise<T | null>;
107
+ /**
108
+ * Get records
109
+ */
110
+ static get<T extends Model>(this: typeof Model): Promise<T[]>;
111
+ /**
112
+ * Get the count of records
113
+ */
114
+ static count(this: typeof Model, column?: string): Promise<number>;
115
+ /**
116
+ * Eager load relationships
117
+ */
118
+ static with<T extends Model>(this: typeof Model, relations: string | string[] | Record<string, (q: QueryBuilder) => void>): ModelQueryBuilder<T>;
119
+ /**
120
+ * Delete a record by ID
121
+ */
122
+ static delete(id: any): Promise<number>;
123
+ /**
124
+ * Get the table name
125
+ */
126
+ protected static getTableName(): string;
127
+ /**
128
+ * Get the connection name
129
+ */
130
+ protected static getConnectionName(): string | undefined;
131
+ /**
132
+ * Get the primary key
133
+ */
134
+ protected static getPrimaryKeyName(): string;
135
+ /**
136
+ * Get the table name (instance method)
137
+ */
138
+ protected getTable(): string;
139
+ /**
140
+ * Get the connection name (instance method)
141
+ */
142
+ protected getConnection(): string | undefined;
143
+ /**
144
+ * Get the primary key (instance method)
145
+ */
146
+ protected getPrimaryKey(): string;
147
+ /**
148
+ * Get an attribute value
149
+ */
150
+ getAttribute(key: string): any;
151
+ /**
152
+ * Set an attribute value
153
+ */
154
+ setAttribute(key: string, value: any): void;
155
+ /**
156
+ * Fill the model with an array of attributes
157
+ */
158
+ fill(attributes: Record<string, any>): this;
159
+ /**
160
+ * Save the model to the database
161
+ */
162
+ save(): Promise<boolean>;
163
+ /**
164
+ * Delete the model from the database
165
+ */
166
+ deleteInstance(): Promise<boolean>;
167
+ /**
168
+ * Refresh the model from the database
169
+ */
170
+ refresh(): Promise<this>;
171
+ /**
172
+ * Get the attributes that have been changed since last sync
173
+ */
174
+ getDirty(): Record<string, any>;
175
+ /**
176
+ * Check if the model or specific attribute is dirty
177
+ */
178
+ isDirty(attribute?: string): boolean;
179
+ /**
180
+ * Sync the original attributes with the current attributes
181
+ */
182
+ protected syncOriginal(): void;
183
+ /**
184
+ * Mark the model as existing
185
+ */
186
+ setExists(exists: boolean): this;
187
+ /**
188
+ * Convert the model to a plain object
189
+ */
190
+ toJSON(): Record<string, any>;
191
+ /**
192
+ * Define a has-one relationship
193
+ */
194
+ protected hasOne<T extends Model>(related: typeof Model, foreignKey?: string, localKey?: string): HasOne<T>;
195
+ /**
196
+ * Define a has-many relationship
197
+ */
198
+ protected hasMany<T extends Model>(related: typeof Model, foreignKey?: string, localKey?: string): HasMany<T>;
199
+ /**
200
+ * Define a belongs-to relationship
201
+ */
202
+ protected belongsTo<T extends Model>(related: typeof Model, foreignKey?: string, ownerKey?: string): BelongsTo<T>;
203
+ /**
204
+ * Define a belongs-to-many relationship
205
+ */
206
+ protected belongsToMany<T extends Model>(related: typeof Model, pivotTable?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string): BelongsToMany<T>;
207
+ /**
208
+ * Get a relationship value
209
+ */
210
+ getRelation(name: string): any;
211
+ /**
212
+ * Set a relationship value
213
+ */
214
+ setRelation(name: string, value: any): this;
215
+ /**
216
+ * Load a relationship
217
+ */
218
+ load(relation: string): Promise<this>;
219
+ }
220
+ /**
221
+ * Model query builder wrapper
222
+ */
223
+ export declare class ModelQueryBuilder<T extends Model> {
224
+ private queryBuilder;
225
+ private modelClass;
226
+ private eagerLoad;
227
+ constructor(queryBuilder: QueryBuilder, modelClass: new () => T);
228
+ /**
229
+ * Get all records
230
+ */
231
+ all(): Promise<T[]>;
232
+ /**
233
+ * Find a record by ID
234
+ */
235
+ find(id: any): Promise<T | null>;
236
+ /**
237
+ * Create a new record
238
+ */
239
+ create(data: Record<string, any>): Promise<T>;
240
+ /**
241
+ * Add a where clause
242
+ */
243
+ where(column: string, operator: any, value?: any): this;
244
+ /**
245
+ * Add an OR where clause
246
+ */
247
+ orWhere(column: string, operator: any, value?: any): this;
248
+ /**
249
+ * Add a where in clause
250
+ */
251
+ whereIn(column: string, values: any[]): this;
252
+ /**
253
+ * Add a where not in clause
254
+ */
255
+ whereNotIn(column: string, values: any[]): this;
256
+ /**
257
+ * Add a where null clause
258
+ */
259
+ whereNull(column: string): this;
260
+ /**
261
+ * Add a where not null clause
262
+ */
263
+ whereNotNull(column: string): this;
264
+ /**
265
+ * Add an order by clause
266
+ */
267
+ orderBy(column: string, direction?: 'asc' | 'desc'): this;
268
+ /**
269
+ * Add a limit clause
270
+ */
271
+ limit(limit: number): this;
272
+ /**
273
+ * Add an offset clause
274
+ */
275
+ offset(offset: number): this;
276
+ /**
277
+ * Update records
278
+ */
279
+ update(data: Record<string, any>): Promise<number>;
280
+ /**
281
+ * Delete a record by ID
282
+ */
283
+ delete(id?: any): Promise<number>;
284
+ /**
285
+ * Get the first record
286
+ */
287
+ first(): Promise<T | null>;
288
+ /**
289
+ * Get records
290
+ */
291
+ get(): Promise<T[]>;
292
+ /**
293
+ * Get the count of records
294
+ */
295
+ count(column?: string): Promise<number>;
296
+ /**
297
+ * Eager load relationships
298
+ */
299
+ with(relations: string | string[] | Record<string, (q: QueryBuilder) => void>): this;
300
+ /**
301
+ * Hydrate a model instance from data
302
+ */
303
+ private hydrate;
304
+ /**
305
+ * Load eager loaded relationships
306
+ */
307
+ private loadRelations;
308
+ }
309
+ //# sourceMappingURL=Model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/Model/Model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAExE;;GAEG;AACH,qBAAa,KAAK;IACd;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAM;IAEpC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAM;IAE7B;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAQ;IAE3C;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,CAAQ;IAEpC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAS;IAElC;;OAEG;IACH,SAAS,CAAC,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