@lara-node/db 0.1.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.
- package/dist/MakeMigration.cjs +215 -0
- package/dist/MakeMigration.js +215 -0
- package/dist/MakeMigration.js.map +1 -0
- package/dist/chunk.cjs +43 -0
- package/dist/connection.cjs +286 -0
- package/dist/connection.js +226 -0
- package/dist/connection.js.map +1 -0
- package/dist/index.cjs +7790 -0
- package/dist/index.d.cts +1635 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +1635 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7732 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1635 @@
|
|
|
1
|
+
import mysql, { Pool, PoolConnection } from "mysql2/promise";
|
|
2
|
+
import { ClientSession, Collection, Db, Document } from "mongodb";
|
|
3
|
+
import util from "util";
|
|
4
|
+
import { ServiceProvider } from "@lara-node/core";
|
|
5
|
+
|
|
6
|
+
//#region src/connection.d.ts
|
|
7
|
+
declare function getDbType(): "mysql" | "mongodb";
|
|
8
|
+
declare function query<T = any>(sql: string, params?: any[]): Promise<T[]>;
|
|
9
|
+
declare function initDatabase(): Promise<void>;
|
|
10
|
+
declare function getPool(): mysql.Pool;
|
|
11
|
+
declare function getMongoDb(): Db;
|
|
12
|
+
declare function collection(name: string): Collection<Document>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/DB.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* Base transaction interface with common methods
|
|
17
|
+
*/
|
|
18
|
+
interface ITransaction {
|
|
19
|
+
commit(): Promise<void>;
|
|
20
|
+
rollback(): Promise<void>;
|
|
21
|
+
isActive(): boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* MySQL Transaction interface
|
|
25
|
+
*/
|
|
26
|
+
interface IMysqlTransaction extends ITransaction {
|
|
27
|
+
query<T = any>(sql: string, bindings?: any[]): Promise<T[]>;
|
|
28
|
+
select<T = any>(sql: string, bindings?: any[]): Promise<T[]>;
|
|
29
|
+
insert(sql: string, bindings?: any[]): Promise<number>;
|
|
30
|
+
update(sql: string, bindings?: any[]): Promise<number>;
|
|
31
|
+
delete(sql: string, bindings?: any[]): Promise<number>;
|
|
32
|
+
statement(sql: string, bindings?: any[]): Promise<boolean>;
|
|
33
|
+
getConnection(): PoolConnection;
|
|
34
|
+
release(): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* MongoDB Transaction interface
|
|
38
|
+
*/
|
|
39
|
+
interface IMongoTransaction extends ITransaction {
|
|
40
|
+
collection<T extends Document = Document>(name: string): Collection<T>;
|
|
41
|
+
getSession(): ClientSession;
|
|
42
|
+
endSession(): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Transaction class for managing MySQL database transactions
|
|
46
|
+
*/
|
|
47
|
+
declare class Transaction implements IMysqlTransaction {
|
|
48
|
+
private connection;
|
|
49
|
+
private committed;
|
|
50
|
+
private rolledBack;
|
|
51
|
+
constructor(connection: PoolConnection);
|
|
52
|
+
query<T = any>(sql: string, bindings?: any[]): Promise<T[]>;
|
|
53
|
+
select<T = any>(sql: string, bindings?: any[]): Promise<T[]>;
|
|
54
|
+
insert(sql: string, bindings?: any[]): Promise<number>;
|
|
55
|
+
update(sql: string, bindings?: any[]): Promise<number>;
|
|
56
|
+
delete(sql: string, bindings?: any[]): Promise<number>;
|
|
57
|
+
statement(sql: string, bindings?: any[]): Promise<boolean>;
|
|
58
|
+
getConnection(): PoolConnection;
|
|
59
|
+
commit(): Promise<void>;
|
|
60
|
+
rollback(): Promise<void>;
|
|
61
|
+
isActive(): boolean;
|
|
62
|
+
release(): void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* MongoDB Transaction class
|
|
66
|
+
*/
|
|
67
|
+
declare class MongoTransaction implements IMongoTransaction {
|
|
68
|
+
private session;
|
|
69
|
+
private db;
|
|
70
|
+
private committed;
|
|
71
|
+
private rolledBack;
|
|
72
|
+
constructor(session: ClientSession, db: Db);
|
|
73
|
+
collection<T extends Document = Document>(name: string): Collection<T>;
|
|
74
|
+
getSession(): ClientSession;
|
|
75
|
+
commit(): Promise<void>;
|
|
76
|
+
rollback(): Promise<void>;
|
|
77
|
+
isActive(): boolean;
|
|
78
|
+
endSession(): void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Unified Transaction type
|
|
82
|
+
*/
|
|
83
|
+
type UnifiedTransaction = Transaction | MongoTransaction;
|
|
84
|
+
/**
|
|
85
|
+
* Transaction callback types
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
type MysqlTransactionCallback<T> = (trx: IMysqlTransaction) => Promise<T>;
|
|
89
|
+
type MongoTransactionCallback<T> = (trx: IMongoTransaction) => Promise<T>;
|
|
90
|
+
type UnifiedTransactionCallback<T> = (trx: UnifiedTransaction) => Promise<T>;
|
|
91
|
+
/**
|
|
92
|
+
* Query binding types
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* DB Facade - Main entry point for database operations
|
|
97
|
+
* Automatically handles both MySQL and MongoDB based on configuration
|
|
98
|
+
*
|
|
99
|
+
* Supports Laravel-style transactions where Model operations automatically
|
|
100
|
+
* use the active transaction:
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* await DB.beginTransaction();
|
|
104
|
+
* try {
|
|
105
|
+
* await User.create({ name: 'John' }); // Uses the transaction
|
|
106
|
+
* await user.save(); // Uses the transaction
|
|
107
|
+
* await DB.commit();
|
|
108
|
+
* } catch (e) {
|
|
109
|
+
* await DB.rollback();
|
|
110
|
+
* }
|
|
111
|
+
*/
|
|
112
|
+
declare class DB {
|
|
113
|
+
private static currentMysqlTransaction;
|
|
114
|
+
private static currentMongoTransaction;
|
|
115
|
+
private static transactionLevel;
|
|
116
|
+
/**
|
|
117
|
+
* Execute a query using the current transaction if one exists, otherwise use the pool.
|
|
118
|
+
* Emits a `db:query` event via the application EventDispatcher so Telescope and
|
|
119
|
+
* other listeners can observe all database activity without modifying call sites.
|
|
120
|
+
*/
|
|
121
|
+
static executeQuery<T = any>(sql: string, params?: any[]): Promise<T[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Execute a raw SQL query (MySQL only)
|
|
124
|
+
*/
|
|
125
|
+
static query<T = any>(sql: string, bindings?: any[]): Promise<T[]>;
|
|
126
|
+
/**
|
|
127
|
+
* Execute a raw SELECT query (MySQL only)
|
|
128
|
+
*/
|
|
129
|
+
static select<T = any>(sql: string, bindings?: any[]): Promise<T[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Execute a raw INSERT query (MySQL only)
|
|
132
|
+
*/
|
|
133
|
+
static insert(sql: string, bindings?: any[]): Promise<number>;
|
|
134
|
+
/**
|
|
135
|
+
* Execute a raw UPDATE query (MySQL only)
|
|
136
|
+
*/
|
|
137
|
+
static update(sql: string, bindings?: any[]): Promise<number>;
|
|
138
|
+
/**
|
|
139
|
+
* Execute a raw DELETE query (MySQL only)
|
|
140
|
+
*/
|
|
141
|
+
static delete(sql: string, bindings?: any[]): Promise<number>;
|
|
142
|
+
/**
|
|
143
|
+
* Execute a statement (for DDL or other non-returning queries) - MySQL only
|
|
144
|
+
*/
|
|
145
|
+
static statement(sql: string, bindings?: any[]): Promise<boolean>;
|
|
146
|
+
/**
|
|
147
|
+
* Execute an unprepared query (without parameter binding) - MySQL only
|
|
148
|
+
*/
|
|
149
|
+
static unprepared(sql: string): Promise<boolean>;
|
|
150
|
+
/**
|
|
151
|
+
* Start a query on a table - returns EloquentBuilder for the table
|
|
152
|
+
* Note: For raw table queries without a Model, use DB.query() with raw SQL
|
|
153
|
+
*/
|
|
154
|
+
static table(name: string): {
|
|
155
|
+
where: (column: string, operatorOrValue: any, value?: any) => any;
|
|
156
|
+
insert: (data: Record<string, any>) => Promise<number>;
|
|
157
|
+
update: (data: Record<string, any>) => Promise<number>;
|
|
158
|
+
delete: () => Promise<number>;
|
|
159
|
+
get: () => Promise<any[]>;
|
|
160
|
+
first: () => Promise<any>;
|
|
161
|
+
count: () => Promise<number>;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Get a MongoDB collection (MongoDB only).
|
|
165
|
+
* The returned collection is transparently proxied so every operation
|
|
166
|
+
* (find, insertOne, updateMany, aggregate, …) emits a `db:query` event
|
|
167
|
+
* that Telescope's QueryWatcher captures.
|
|
168
|
+
*/
|
|
169
|
+
static collection<T extends Document = Document>(name: string): Collection<T>;
|
|
170
|
+
/**
|
|
171
|
+
/** Delegates to the shared QueryInstrumentation proxy (same logic as db.config.ts:collection). */
|
|
172
|
+
private static instrumentMongoCollection;
|
|
173
|
+
/**
|
|
174
|
+
* Get the current MongoDB session options for use in queries
|
|
175
|
+
* Returns an object with { session } if in a transaction, or empty object
|
|
176
|
+
* This allows MongoDB operations to automatically use the transaction
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* const collection = DB.collection('users');
|
|
180
|
+
* await collection.insertOne({ name: 'John' }, DB.getSessionOptions());
|
|
181
|
+
*/
|
|
182
|
+
static getSessionOptions(): {
|
|
183
|
+
session?: ClientSession;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Execute a MongoDB operation with the current transaction session if available
|
|
187
|
+
* This is the main method that Models should use for MongoDB operations
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* await DB.withSession(async (sessionOpts) => {
|
|
191
|
+
* await collection.insertOne({ name: 'John' }, sessionOpts);
|
|
192
|
+
* });
|
|
193
|
+
*/
|
|
194
|
+
static withSession<T>(callback: (sessionOptions: {
|
|
195
|
+
session?: ClientSession;
|
|
196
|
+
}) => Promise<T>): Promise<T>;
|
|
197
|
+
/**
|
|
198
|
+
* Begin a database transaction (auto-detects database type)
|
|
199
|
+
*/
|
|
200
|
+
static beginTransaction(): Promise<UnifiedTransaction>;
|
|
201
|
+
/**
|
|
202
|
+
* Alias for beginTransaction
|
|
203
|
+
*/
|
|
204
|
+
static begin(): Promise<UnifiedTransaction>;
|
|
205
|
+
/**
|
|
206
|
+
* Commit the current transaction
|
|
207
|
+
*/
|
|
208
|
+
static commit(): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Rollback the current transaction
|
|
211
|
+
*/
|
|
212
|
+
static rollback(): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Execute a callback within a transaction (auto-detects database type)
|
|
215
|
+
* Automatically commits on success, rolls back on error
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* // Models automatically use the active transaction
|
|
219
|
+
* await DB.transaction(async () => {
|
|
220
|
+
* await User.create({ name: 'John' });
|
|
221
|
+
* await Invoice.create({ user_id: 1, amount: 100 });
|
|
222
|
+
* });
|
|
223
|
+
*/
|
|
224
|
+
static transaction<T>(callback: UnifiedTransactionCallback<T> | (() => Promise<T>)): Promise<T>;
|
|
225
|
+
/**
|
|
226
|
+
* Execute a callback within a MySQL transaction (type-safe)
|
|
227
|
+
*/
|
|
228
|
+
static mysqlTransaction<T>(callback: MysqlTransactionCallback<T>): Promise<T>;
|
|
229
|
+
/**
|
|
230
|
+
* Execute a callback within a MongoDB transaction (type-safe)
|
|
231
|
+
*/
|
|
232
|
+
static mongoTransaction<T>(callback: MongoTransactionCallback<T>): Promise<T>;
|
|
233
|
+
/**
|
|
234
|
+
* Get the current transaction level
|
|
235
|
+
*/
|
|
236
|
+
static getTransactionLevel(): number;
|
|
237
|
+
/**
|
|
238
|
+
* Check if currently in a transaction
|
|
239
|
+
*/
|
|
240
|
+
static inTransaction(): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Get the current active transaction (if any)
|
|
243
|
+
*/
|
|
244
|
+
static getCurrentTransaction(): UnifiedTransaction | null;
|
|
245
|
+
/**
|
|
246
|
+
* Get the current MySQL transaction (type-safe)
|
|
247
|
+
*/
|
|
248
|
+
static getMysqlTransaction(): Transaction | null;
|
|
249
|
+
/**
|
|
250
|
+
* Get the current MongoDB transaction (type-safe)
|
|
251
|
+
*/
|
|
252
|
+
static getMongoTransaction(): MongoTransaction | null;
|
|
253
|
+
/**
|
|
254
|
+
* Get the current MySQL connection (from transaction or null)
|
|
255
|
+
*/
|
|
256
|
+
static getActiveConnection(): PoolConnection | null;
|
|
257
|
+
/**
|
|
258
|
+
* Get the current MongoDB session (from transaction or null)
|
|
259
|
+
*/
|
|
260
|
+
static getActiveSession(): ClientSession | null;
|
|
261
|
+
/**
|
|
262
|
+
* Check if a value is a MySQL Transaction
|
|
263
|
+
*/
|
|
264
|
+
static isTransaction(trx: any): trx is Transaction;
|
|
265
|
+
/**
|
|
266
|
+
* Check if a value is a MongoDB Transaction
|
|
267
|
+
*/
|
|
268
|
+
static isMongoTransaction(trx: any): trx is MongoTransaction;
|
|
269
|
+
/**
|
|
270
|
+
* Get the database type (mysql or mongodb)
|
|
271
|
+
*/
|
|
272
|
+
static getType(): "mysql" | "mongodb";
|
|
273
|
+
/**
|
|
274
|
+
* Check if using MySQL
|
|
275
|
+
*/
|
|
276
|
+
static isMysql(): boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Check if using MongoDB
|
|
279
|
+
*/
|
|
280
|
+
static isMongo(): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Get the underlying connection pool (MySQL only)
|
|
283
|
+
*/
|
|
284
|
+
static getPool(): Pool;
|
|
285
|
+
/**
|
|
286
|
+
* Get the MongoDB database instance
|
|
287
|
+
*/
|
|
288
|
+
static getMongoDb(): Db;
|
|
289
|
+
/**
|
|
290
|
+
* Create a raw expression (to use raw SQL in queries)
|
|
291
|
+
*/
|
|
292
|
+
static raw(value: string): {
|
|
293
|
+
__raw: true;
|
|
294
|
+
value: string;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Escape a value for safe use in queries (MySQL only)
|
|
298
|
+
*/
|
|
299
|
+
static escape(value: any): string;
|
|
300
|
+
/**
|
|
301
|
+
* Quote a table or column name (MySQL only)
|
|
302
|
+
*/
|
|
303
|
+
static quoteName(name: string): string;
|
|
304
|
+
/**
|
|
305
|
+
* Listen for query events (placeholder for query logging)
|
|
306
|
+
*/
|
|
307
|
+
static listen(_callback: (query: {
|
|
308
|
+
sql: string;
|
|
309
|
+
bindings: any[];
|
|
310
|
+
time: number;
|
|
311
|
+
}) => void): void;
|
|
312
|
+
}
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/EloquentBuilder.d.ts
|
|
315
|
+
declare class EloquentBuilder<T extends Model> {
|
|
316
|
+
private model;
|
|
317
|
+
private withRelations;
|
|
318
|
+
private nestedRelations;
|
|
319
|
+
private relationPathOptions;
|
|
320
|
+
private relationTree;
|
|
321
|
+
private whereClauses;
|
|
322
|
+
private havingClauses;
|
|
323
|
+
private joinClauses;
|
|
324
|
+
private limitValue?;
|
|
325
|
+
private offsetValue?;
|
|
326
|
+
private orderByColumn?;
|
|
327
|
+
private orderByDirection;
|
|
328
|
+
private groupByColumns;
|
|
329
|
+
private hasConditions;
|
|
330
|
+
private selectedColumns?;
|
|
331
|
+
private distinctValue;
|
|
332
|
+
private includeTrashed;
|
|
333
|
+
private appliedSoftDeleteFilter;
|
|
334
|
+
private onlyTrashedFlag;
|
|
335
|
+
private columnQualifier?;
|
|
336
|
+
private appliedScopes;
|
|
337
|
+
private removedScopes;
|
|
338
|
+
constructor(model: typeof Model);
|
|
339
|
+
/**
|
|
340
|
+
* Execute a SQL query using the active transaction if available
|
|
341
|
+
* This ensures all EloquentBuilder queries are transaction-aware
|
|
342
|
+
*/
|
|
343
|
+
private runQuery;
|
|
344
|
+
/**
|
|
345
|
+
* Get MongoDB session options for transaction support
|
|
346
|
+
* Returns { session } if in a transaction, or empty object
|
|
347
|
+
*/
|
|
348
|
+
private getMongoSessionOptions;
|
|
349
|
+
getRelationTree(): Record<string, any>;
|
|
350
|
+
withTrashed(): this;
|
|
351
|
+
/**
|
|
352
|
+
* Apply a named scope
|
|
353
|
+
*/
|
|
354
|
+
namedScope(name: string, ...args: any[]): this;
|
|
355
|
+
/**
|
|
356
|
+
* Alias for namedScope
|
|
357
|
+
*/
|
|
358
|
+
scope(name: string, ...args: any[]): this;
|
|
359
|
+
/**
|
|
360
|
+
* Apply multiple scopes
|
|
361
|
+
*/
|
|
362
|
+
scopes(scopes: {
|
|
363
|
+
[name: string]: any[];
|
|
364
|
+
}): this;
|
|
365
|
+
/**
|
|
366
|
+
* Get applied scopes
|
|
367
|
+
*/
|
|
368
|
+
getAppliedScopes(): string[];
|
|
369
|
+
/**
|
|
370
|
+
* Check if a scope has been applied
|
|
371
|
+
*/
|
|
372
|
+
hasScope(name: string): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Remove a scope
|
|
375
|
+
*/
|
|
376
|
+
withoutScope(name: string): this;
|
|
377
|
+
withThrashed(): this;
|
|
378
|
+
withoutTrashed(): this;
|
|
379
|
+
withoutThrashed(): this;
|
|
380
|
+
onlyTrashed(): this;
|
|
381
|
+
onlyThrashed(): this;
|
|
382
|
+
with(relations: string | string[] | Record<string, any>): this;
|
|
383
|
+
select(columns: string[] | string): this;
|
|
384
|
+
addSelect(columns: string[] | string): this;
|
|
385
|
+
distinct(): this;
|
|
386
|
+
where(column: string | ((builder: EloquentBuilder<T>) => void), operator?: any, value?: any): this;
|
|
387
|
+
orWhere(column: string | ((builder: EloquentBuilder<T>) => void), operator?: any, value?: any): this;
|
|
388
|
+
whereIn(column: string, values: any[]): this;
|
|
389
|
+
whereNotIn(column: string, values: any[]): this;
|
|
390
|
+
whereNull(column: string): this;
|
|
391
|
+
whereNotNull(column: string): this;
|
|
392
|
+
whereBetween(column: string, range: [any, any]): this;
|
|
393
|
+
whereNotBetween(column: string, range: [any, any]): this;
|
|
394
|
+
whereHas(relation: string, callback?: (query: EloquentBuilder<any>) => void, operator?: string, count?: number): this;
|
|
395
|
+
orWhereHas(relation: string, callback?: (query: EloquentBuilder<any>) => void, operator?: string, count?: number): this;
|
|
396
|
+
whereDoesntHave(relation: string, callback?: (query: EloquentBuilder<any>) => void): this;
|
|
397
|
+
join(table: string, first: string, operator: string, second: string, type?: "inner" | "left" | "right" | "cross"): this;
|
|
398
|
+
leftJoin(table: string, first: string, operator: string, second: string): this;
|
|
399
|
+
groupBy(columns: string | string[]): this;
|
|
400
|
+
having(column: string, operator: string, value: any): this;
|
|
401
|
+
limit(limit: number): this;
|
|
402
|
+
offset(offset: number): this;
|
|
403
|
+
orderBy(column: string, direction?: "asc" | "desc"): this;
|
|
404
|
+
latest(column?: string): this;
|
|
405
|
+
oldest(column?: string): this;
|
|
406
|
+
rightJoin(table: string, first: string, operator: string, second: string): this;
|
|
407
|
+
crossJoin(table: string): this;
|
|
408
|
+
orWhereNull(column: string): this;
|
|
409
|
+
orWhereNotNull(column: string): this;
|
|
410
|
+
orWhereIn(column: string, values: any[]): this;
|
|
411
|
+
orWhereNotIn(column: string, values: any[]): this;
|
|
412
|
+
orWhereBetween(column: string, range: [any, any]): this;
|
|
413
|
+
orWhereNotBetween(column: string, range: [any, any]): this;
|
|
414
|
+
whereLike(column: string, value: string): this;
|
|
415
|
+
whereNotLike(column: string, value: string): this;
|
|
416
|
+
orWhereLike(column: string, value: string): this;
|
|
417
|
+
orWhereNotLike(column: string, value: string): this;
|
|
418
|
+
whereRaw(sql: string, bindings?: any[]): this;
|
|
419
|
+
orWhereRaw(sql: string, bindings?: any[]): this;
|
|
420
|
+
/** Apply callback only when condition is truthy. */
|
|
421
|
+
when<V = boolean>(condition: V, callback: (builder: this, value: NonNullable<V>) => void, elseCallback?: (builder: this) => void): this;
|
|
422
|
+
/** Apply callback only when condition is falsy (inverse of when). */
|
|
423
|
+
unless<V = boolean>(condition: V, callback: (builder: this) => void): this;
|
|
424
|
+
/** Inspect the builder without interrupting the chain. */
|
|
425
|
+
tap(callback: (builder: this) => void): this;
|
|
426
|
+
/** Return a deep copy of this builder so mutations don't affect the original. */
|
|
427
|
+
clone(): EloquentBuilder<T>;
|
|
428
|
+
/** Shorthand for .where(column, op?, value).first() */
|
|
429
|
+
firstWhere(column: string | ((builder: EloquentBuilder<T>) => void), operator?: any, value?: any): Promise<T | null>;
|
|
430
|
+
/** Retrieve a single column value from the first matching row. */
|
|
431
|
+
value(column: string): Promise<any>;
|
|
432
|
+
/**
|
|
433
|
+
* Return the only record matching the query.
|
|
434
|
+
* Throws if zero or more than one records are found.
|
|
435
|
+
*/
|
|
436
|
+
sole(): Promise<T>;
|
|
437
|
+
/** Pluck a single column into an array, optionally keyed by another column. */
|
|
438
|
+
pluck(column: string, key?: string): Promise<any[] | Record<string, any>>;
|
|
439
|
+
/**
|
|
440
|
+
* Process matching records in chunks to avoid loading everything into memory.
|
|
441
|
+
* Callback receives a page of records; return false to stop early.
|
|
442
|
+
*/
|
|
443
|
+
chunk(size: number, callback: (rows: T[], page: number) => boolean | void | Promise<boolean | void>): Promise<void>;
|
|
444
|
+
/**
|
|
445
|
+
* Like chunk() but advances via the primary key for stability on live tables.
|
|
446
|
+
*/
|
|
447
|
+
chunkById(size: number, callback: (rows: T[], page: number) => boolean | void | Promise<boolean | void>, column?: string): Promise<void>;
|
|
448
|
+
/** Async generator that yields results one at a time without holding all in memory. */
|
|
449
|
+
cursor(): AsyncGenerator<T>;
|
|
450
|
+
/** Return the SQL string (with ? placeholders) without executing the query. */
|
|
451
|
+
toSql(): string;
|
|
452
|
+
/**
|
|
453
|
+
* Return the MongoDB query descriptor without executing — the Mongo equivalent of toSql().
|
|
454
|
+
*
|
|
455
|
+
* Returns:
|
|
456
|
+
* collection — collection name derived from the model's table
|
|
457
|
+
* filter — MongoDB filter document (the full $and/$or object)
|
|
458
|
+
* sort — e.g. { created_at: -1 } (only present when orderBy is set)
|
|
459
|
+
* limit — cursor limit (only present when limit() was called)
|
|
460
|
+
* skip — cursor skip offset (only present when offset() was called)
|
|
461
|
+
* projection — { col: 1 } map (only present when select() was called)
|
|
462
|
+
*/
|
|
463
|
+
toMongo(): {
|
|
464
|
+
collection: string;
|
|
465
|
+
filter: Record<string, any>;
|
|
466
|
+
sort?: Record<string, 1 | -1>;
|
|
467
|
+
limit?: number;
|
|
468
|
+
skip?: number;
|
|
469
|
+
projection?: Record<string, 1>;
|
|
470
|
+
};
|
|
471
|
+
get(): Promise<T[]>;
|
|
472
|
+
toArray(): Promise<any[]>;
|
|
473
|
+
first(): Promise<T | null>;
|
|
474
|
+
firstOrFail(): Promise<T>;
|
|
475
|
+
paginate(perPage?: number, page?: number): Promise<QueryResult<T>>;
|
|
476
|
+
count(column?: string): Promise<number>;
|
|
477
|
+
max(column: string): Promise<number>;
|
|
478
|
+
min(column: string): Promise<number>;
|
|
479
|
+
avg(column: string): Promise<number>;
|
|
480
|
+
sum(column: string): Promise<number>;
|
|
481
|
+
exists(): Promise<boolean>;
|
|
482
|
+
doesntExist(): Promise<boolean>;
|
|
483
|
+
find(id: number | string): Promise<T | null>;
|
|
484
|
+
findOrFail(id: number | string): Promise<T>;
|
|
485
|
+
all(): Promise<T[]>;
|
|
486
|
+
create(attributes: Record<string, any>): Promise<T>;
|
|
487
|
+
createMany(rows: Array<Record<string, any>>): Promise<T[]>;
|
|
488
|
+
/**
|
|
489
|
+
* Find a model matching the current query conditions or create a new one, then update with values
|
|
490
|
+
* @param values - The values to update or create the model with
|
|
491
|
+
* @param createAttributes - Additional attributes to use when creating a new record
|
|
492
|
+
* @returns The model instance (existing or newly created)
|
|
493
|
+
*/
|
|
494
|
+
updateOrCreate(values?: Record<string, any>, createAttributes?: Record<string, any>): Promise<T>;
|
|
495
|
+
/**
|
|
496
|
+
* Alias for updateOrCreate method
|
|
497
|
+
* @param values - The values to update or create the model with
|
|
498
|
+
* @param createAttributes - Additional attributes to use when creating a new record
|
|
499
|
+
* @returns The model instance (existing or newly created)
|
|
500
|
+
*/
|
|
501
|
+
createOrUpdate(values?: Record<string, any>, createAttributes?: Record<string, any>): Promise<T>;
|
|
502
|
+
update(values: Partial<Record<string, any>>): Promise<number>;
|
|
503
|
+
increment(column: string, amount?: number): Promise<number>;
|
|
504
|
+
decrement(column: string, amount?: number): Promise<number>;
|
|
505
|
+
delete(): Promise<number>;
|
|
506
|
+
insert(rows: Array<Record<string, any>>): Promise<number>;
|
|
507
|
+
insertGetId(row: Record<string, any>): Promise<number>;
|
|
508
|
+
has(relation: string, operator?: string, count?: number): this;
|
|
509
|
+
doesntHave(relation: string): this;
|
|
510
|
+
withCount(relations: string | string[]): this;
|
|
511
|
+
private aggregate;
|
|
512
|
+
private buildWhereClause;
|
|
513
|
+
private buildNestedWhere;
|
|
514
|
+
private getWhereClauses;
|
|
515
|
+
private buildHasConditionsSQL;
|
|
516
|
+
private applyHasConditionsMongo;
|
|
517
|
+
private executeQuery;
|
|
518
|
+
private getCount;
|
|
519
|
+
private loadRelationships;
|
|
520
|
+
private loadRelationTree;
|
|
521
|
+
private setRelation;
|
|
522
|
+
loadRelationship(models: T[], relation: string, options?: EagerLoadOptions): Promise<void>;
|
|
523
|
+
private loadHasOne;
|
|
524
|
+
private loadHasMany;
|
|
525
|
+
private loadBelongsTo;
|
|
526
|
+
private loadBelongsToMany;
|
|
527
|
+
private loadBelongsToManyMongo;
|
|
528
|
+
private loadMorphRelations;
|
|
529
|
+
private normalizeField;
|
|
530
|
+
private coerceId;
|
|
531
|
+
private isIdLikeField;
|
|
532
|
+
private coerceForField;
|
|
533
|
+
private expandIdForms;
|
|
534
|
+
/**
|
|
535
|
+
* Check if a document matches a MongoDB filter object in memory.
|
|
536
|
+
* Used for OR hasConditions where we need to verify if a doc matched the original where filter.
|
|
537
|
+
*/
|
|
538
|
+
private docMatchesMongoFilter;
|
|
539
|
+
private buildMongoFilter;
|
|
540
|
+
private executeQueryMongo;
|
|
541
|
+
private updateMongo;
|
|
542
|
+
private deleteMongo;
|
|
543
|
+
private insertMongoMany;
|
|
544
|
+
private countMongo;
|
|
545
|
+
private aggregateMongo;
|
|
546
|
+
private loadHasOneMongo;
|
|
547
|
+
private loadHasManyMongo;
|
|
548
|
+
private loadBelongsToMongo;
|
|
549
|
+
private loadBelongsToManyMongo_;
|
|
550
|
+
private loadMorphRelationsMongo;
|
|
551
|
+
}
|
|
552
|
+
//# sourceMappingURL=EloquentBuilder.d.ts.map
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region src/types.d.ts
|
|
555
|
+
interface ModelAttributes {
|
|
556
|
+
[key: string]: any;
|
|
557
|
+
}
|
|
558
|
+
interface RelationshipConfig {
|
|
559
|
+
type: "hasOne" | "hasMany" | "belongsTo" | "belongsToMany" | "morphOne" | "morphMany" | "hasOneThrough" | "hasManyThrough";
|
|
560
|
+
model: typeof Model;
|
|
561
|
+
foreignKey?: string;
|
|
562
|
+
localKey?: string;
|
|
563
|
+
ownerKey?: string;
|
|
564
|
+
relatedKey?: string;
|
|
565
|
+
morphName?: string;
|
|
566
|
+
table?: string;
|
|
567
|
+
through?: typeof Model;
|
|
568
|
+
pivotModel?: typeof Model;
|
|
569
|
+
secondKey?: string;
|
|
570
|
+
secondLocalKey?: string;
|
|
571
|
+
}
|
|
572
|
+
interface Casts {
|
|
573
|
+
[key: string]: string | Function;
|
|
574
|
+
}
|
|
575
|
+
interface QueryResult<T> {
|
|
576
|
+
data: T[];
|
|
577
|
+
total?: number;
|
|
578
|
+
pagination?: {
|
|
579
|
+
currentPage: number;
|
|
580
|
+
perPage: number;
|
|
581
|
+
total: number;
|
|
582
|
+
lastPage: number;
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
interface EagerLoadOptions {
|
|
586
|
+
constraints?: (builder: EloquentBuilder<any>) => void;
|
|
587
|
+
columns?: string[];
|
|
588
|
+
}
|
|
589
|
+
//# sourceMappingURL=types.d.ts.map
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/relationships.d.ts
|
|
592
|
+
declare abstract class Relation<T extends Model> {
|
|
593
|
+
protected builder: EloquentBuilder<T>;
|
|
594
|
+
protected parent: Model;
|
|
595
|
+
protected related: typeof Model;
|
|
596
|
+
constructor(related: typeof Model, parent: Model);
|
|
597
|
+
abstract getResults(): Promise<T | T[] | null>;
|
|
598
|
+
then<TResult1 = T | T[] | null, TResult2 = never>(onfulfilled?: ((value: T | T[] | null) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
599
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | T[] | null | TResult>;
|
|
600
|
+
finally(onfinally?: (() => void) | null): Promise<T | T[] | null>;
|
|
601
|
+
protected applyConstraints(): boolean;
|
|
602
|
+
/**
|
|
603
|
+
* Return the underlying EloquentBuilder with the FK constraint pre-applied.
|
|
604
|
+
* Use this to chain additional builder methods before executing:
|
|
605
|
+
* user.posts().query().where('published', 1).orderBy('created_at').get()
|
|
606
|
+
*/
|
|
607
|
+
query(): EloquentBuilder<T>;
|
|
608
|
+
/**
|
|
609
|
+
* Execute the relation query and return all matching model instances.
|
|
610
|
+
* await user.posts().get()
|
|
611
|
+
* await user.posts().where('published', 1).get()
|
|
612
|
+
*/
|
|
613
|
+
get(): Promise<T[]>;
|
|
614
|
+
first(): Promise<T | null>;
|
|
615
|
+
firstOrFail(): Promise<T>;
|
|
616
|
+
paginate(perPage?: number, page?: number): Promise<QueryResult<T>>;
|
|
617
|
+
pluck(column: string, key?: string): Promise<any[] | Record<string, any>>;
|
|
618
|
+
value(column: string): Promise<any>;
|
|
619
|
+
sole(): Promise<T>;
|
|
620
|
+
count(): Promise<number>;
|
|
621
|
+
exists(): Promise<boolean>;
|
|
622
|
+
doesntExist(): Promise<boolean>;
|
|
623
|
+
where(column: string, operator?: any, value?: any): this;
|
|
624
|
+
orWhere(column: string, operator?: any, value?: any): this;
|
|
625
|
+
whereIn(column: string, values: any[]): this;
|
|
626
|
+
whereNotIn(column: string, values: any[]): this;
|
|
627
|
+
whereNull(column: string): this;
|
|
628
|
+
whereNotNull(column: string): this;
|
|
629
|
+
orderBy(column: string, direction?: "asc" | "desc"): this;
|
|
630
|
+
latest(column?: string): this;
|
|
631
|
+
oldest(column?: string): this;
|
|
632
|
+
limit(limit: number): this;
|
|
633
|
+
offset(offset: number): this;
|
|
634
|
+
with(relations: string | string[] | Record<string, any>): this;
|
|
635
|
+
select(columns: string[] | string): this;
|
|
636
|
+
getQuery(): EloquentBuilder<T>;
|
|
637
|
+
}
|
|
638
|
+
declare class HasOne<T extends Model> extends Relation<T> {
|
|
639
|
+
protected relatedModel: typeof Model;
|
|
640
|
+
protected foreignKey: string;
|
|
641
|
+
protected localKey: string;
|
|
642
|
+
private defaultAttributes?;
|
|
643
|
+
private fkApplied;
|
|
644
|
+
constructor(relatedModel: typeof Model, foreignKey: string, localKey: string | undefined, parent: Model);
|
|
645
|
+
/**
|
|
646
|
+
* Apply the FK constraint exactly once; subsequent calls are no-ops.
|
|
647
|
+
* This prevents duplicate WHERE clauses when getResults()/first() are
|
|
648
|
+
* called more than once on the same relation instance.
|
|
649
|
+
*/
|
|
650
|
+
protected applyFk(): boolean;
|
|
651
|
+
protected applyConstraints(): boolean;
|
|
652
|
+
getResults(): Promise<T | null>;
|
|
653
|
+
first(): Promise<T | null>;
|
|
654
|
+
/**
|
|
655
|
+
* Provide a default model when the relation returns null.
|
|
656
|
+
* Pass `true` for an empty instance, or a plain object for pre-filled attributes.
|
|
657
|
+
*
|
|
658
|
+
* @example user.profile().withDefault({ gender: 'unknown' })
|
|
659
|
+
*/
|
|
660
|
+
withDefault(attributes?: Record<string, any> | true): this;
|
|
661
|
+
private resolveDefault;
|
|
662
|
+
create(attributes: Record<string, any>): Promise<T>;
|
|
663
|
+
update(attributes: Record<string, any>): Promise<number>;
|
|
664
|
+
save(model: T): Promise<T>;
|
|
665
|
+
associate(model: T | null): Promise<void>;
|
|
666
|
+
dissociate(): Promise<void>;
|
|
667
|
+
}
|
|
668
|
+
declare class HasMany<T extends Model> extends Relation<T> {
|
|
669
|
+
protected relatedModel: typeof Model;
|
|
670
|
+
protected foreignKey: string;
|
|
671
|
+
protected localKey: string;
|
|
672
|
+
private fkApplied;
|
|
673
|
+
constructor(relatedModel: typeof Model, foreignKey: string, localKey: string | undefined, parent: Model);
|
|
674
|
+
protected applyFk(): boolean;
|
|
675
|
+
protected applyConstraints(): boolean;
|
|
676
|
+
getResults(): Promise<T[]>;
|
|
677
|
+
first(): Promise<T | null>;
|
|
678
|
+
create(attributes: Record<string, any>): Promise<T>;
|
|
679
|
+
createMany(rows: Array<Record<string, any>>): Promise<T[]>;
|
|
680
|
+
save(model: T): Promise<T>;
|
|
681
|
+
attach(model: T | number | string): Promise<void>;
|
|
682
|
+
detach(model?: T | number | string): Promise<number>;
|
|
683
|
+
sync(models: (T | number | string)[], detaching?: boolean): Promise<{
|
|
684
|
+
attached: any[];
|
|
685
|
+
detached: any[];
|
|
686
|
+
updated: any[];
|
|
687
|
+
}>;
|
|
688
|
+
}
|
|
689
|
+
declare class BelongsTo<T extends Model> extends Relation<T> {
|
|
690
|
+
private relatedModel;
|
|
691
|
+
private foreignKey;
|
|
692
|
+
private ownerKey;
|
|
693
|
+
private defaultAttributes?;
|
|
694
|
+
private fkApplied;
|
|
695
|
+
constructor(relatedModel: typeof Model, foreignKey: string, ownerKey: string | undefined, parent: Model);
|
|
696
|
+
protected applyFk(): boolean;
|
|
697
|
+
protected applyConstraints(): boolean;
|
|
698
|
+
getResults(): Promise<T | null>;
|
|
699
|
+
first(): Promise<T | null>;
|
|
700
|
+
withDefault(attributes?: Record<string, any> | true): this;
|
|
701
|
+
private resolveDefault;
|
|
702
|
+
associate(model: T | number | string | null): Promise<void>;
|
|
703
|
+
dissociate(): Promise<void>;
|
|
704
|
+
update(attributes: Record<string, any>): Promise<number>;
|
|
705
|
+
}
|
|
706
|
+
declare class BelongsToMany<T extends Model> extends Relation<T> {
|
|
707
|
+
private relatedModel;
|
|
708
|
+
private pivotTable;
|
|
709
|
+
private foreignPivotKey;
|
|
710
|
+
private relatedPivotKey;
|
|
711
|
+
private parentPrimaryKey;
|
|
712
|
+
private relatedPrimaryKey;
|
|
713
|
+
pivotModel?: typeof Model | undefined;
|
|
714
|
+
private pivotColumns;
|
|
715
|
+
private pivotWheres;
|
|
716
|
+
constructor(relatedModel: typeof Model, pivotTable: string, foreignPivotKey: string, relatedPivotKey: string, parentPrimaryKey: string | undefined, relatedPrimaryKey: string | undefined, parent: Model, pivotModel?: typeof Model | undefined);
|
|
717
|
+
/** Returns true when the pivot model has the SoftDeletes trait applied */
|
|
718
|
+
private get pivotSoftDeletes();
|
|
719
|
+
/**
|
|
720
|
+
* Build the extra WHERE conditions from the pivot model's soft deletes + global scopes (SQL).
|
|
721
|
+
* Returns { sql, params } where sql is a fragment like ' AND deleted_at IS NULL AND ...'
|
|
722
|
+
*/
|
|
723
|
+
private buildPivotModelFiltersSQL;
|
|
724
|
+
/**
|
|
725
|
+
* Build the extra filter conditions from the pivot model's soft deletes + global scopes (MongoDB).
|
|
726
|
+
*/
|
|
727
|
+
private buildPivotModelFiltersMongo;
|
|
728
|
+
getResults(): Promise<T[]>;
|
|
729
|
+
get(): Promise<T[]>;
|
|
730
|
+
withPivot(...columns: string[]): this;
|
|
731
|
+
wherePivot(column: string, operator: any, value?: any): this;
|
|
732
|
+
attach(relatedId: number | string | Record<string, any> | (number | string | Record<string, any>)[], extra?: Record<string, any>): Promise<void>;
|
|
733
|
+
detach(relatedIds?: (number | string)[]): Promise<number>;
|
|
734
|
+
sync(relatedIds: (number | string | Record<string, any>)[], detaching?: boolean): Promise<{
|
|
735
|
+
attached: any[];
|
|
736
|
+
detached: any[];
|
|
737
|
+
updated: any[];
|
|
738
|
+
}>;
|
|
739
|
+
toggle(relatedIds: (number | string)[]): Promise<{
|
|
740
|
+
attached: any[];
|
|
741
|
+
detached: any[];
|
|
742
|
+
}>;
|
|
743
|
+
updateExistingPivot(relatedId: number | string, attributes: Record<string, any>): Promise<number>;
|
|
744
|
+
private createPivot;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* HasOneThrough — reach a distant model through an intermediate one.
|
|
748
|
+
*
|
|
749
|
+
* Example: User hasOneThrough(Insurance, Policy, 'user_id', 'policy_id', 'id', 'id')
|
|
750
|
+
* users → policies (via policies.user_id) → insurances (via insurances.policy_id)
|
|
751
|
+
*/
|
|
752
|
+
declare class HasOneThrough<T extends Model> extends Relation<T> {
|
|
753
|
+
protected relatedModel: typeof Model;
|
|
754
|
+
protected throughModel: typeof Model;
|
|
755
|
+
protected firstKey: string;
|
|
756
|
+
protected secondKey: string;
|
|
757
|
+
protected localKey: string;
|
|
758
|
+
protected secondLocalKey: string;
|
|
759
|
+
constructor(relatedModel: typeof Model, throughModel: typeof Model, firstKey: string, secondKey: string, localKey: string | undefined, secondLocalKey: string | undefined, parent: Model);
|
|
760
|
+
getResults(): Promise<T | null>;
|
|
761
|
+
get(): Promise<T[]>;
|
|
762
|
+
first(): Promise<T | null>;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* HasManyThrough — reach many distant models through an intermediate one.
|
|
766
|
+
*
|
|
767
|
+
* Example: Country hasManyThrough(Post, User, 'country_id', 'user_id', 'id', 'id')
|
|
768
|
+
* countries → users (via users.country_id) → posts (via posts.user_id)
|
|
769
|
+
*/
|
|
770
|
+
declare class HasManyThrough<T extends Model> extends Relation<T> {
|
|
771
|
+
protected relatedModel: typeof Model;
|
|
772
|
+
protected throughModel: typeof Model;
|
|
773
|
+
protected firstKey: string;
|
|
774
|
+
protected secondKey: string;
|
|
775
|
+
protected localKey: string;
|
|
776
|
+
protected secondLocalKey: string;
|
|
777
|
+
constructor(relatedModel: typeof Model, throughModel: typeof Model, firstKey: string, secondKey: string, localKey: string | undefined, secondLocalKey: string | undefined, parent: Model);
|
|
778
|
+
getResults(): Promise<T[]>;
|
|
779
|
+
get(): Promise<T[]>;
|
|
780
|
+
first(): Promise<T | null>;
|
|
781
|
+
}
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/interfaces.d.ts
|
|
784
|
+
interface ModelEvents {
|
|
785
|
+
creating: ((model: Model) => void | Promise<void>)[];
|
|
786
|
+
created: ((model: Model) => void | Promise<void>)[];
|
|
787
|
+
updating: ((model: Model) => void | Promise<void>)[];
|
|
788
|
+
updated: ((model: Model) => void | Promise<void>)[];
|
|
789
|
+
saving: ((model: Model) => void | Promise<void>)[];
|
|
790
|
+
saved: ((model: Model) => void | Promise<void>)[];
|
|
791
|
+
deleting: ((model: Model) => void | Promise<void>)[];
|
|
792
|
+
deleted: ((model: Model) => void | Promise<void>)[];
|
|
793
|
+
restoring: ((model: Model) => void | Promise<void>)[];
|
|
794
|
+
restored: ((model: Model) => void | Promise<void>)[];
|
|
795
|
+
retrieved: ((model: Model) => void | Promise<void>)[];
|
|
796
|
+
}
|
|
797
|
+
interface ToJSONOptions {
|
|
798
|
+
maxDepth?: number;
|
|
799
|
+
currentDepth?: number;
|
|
800
|
+
visited?: WeakSet<any>;
|
|
801
|
+
include?: string[];
|
|
802
|
+
exclude?: string[];
|
|
803
|
+
withRelations?: boolean;
|
|
804
|
+
includeMetadata?: boolean;
|
|
805
|
+
relationTree?: any;
|
|
806
|
+
withAccessors?: boolean;
|
|
807
|
+
onlyAppended?: boolean;
|
|
808
|
+
}
|
|
809
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
810
|
+
//#endregion
|
|
811
|
+
//#region src/Traits/traits.d.ts
|
|
812
|
+
interface ScopeMethod<T extends Model> {
|
|
813
|
+
(builder: EloquentBuilder<T>, ...args: any[]): void;
|
|
814
|
+
}
|
|
815
|
+
interface ClassBasedTrait {
|
|
816
|
+
new (): any;
|
|
817
|
+
boot?(model: typeof Model): void;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Register a trait globally by name
|
|
821
|
+
*/
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Apply traits to a model class (supports both string names and classes)
|
|
825
|
+
*/
|
|
826
|
+
declare function applyTraits(modelClass: typeof Model, traitNamesOrClasses: Array<string | ClassBasedTrait>): void;
|
|
827
|
+
/**
|
|
828
|
+
* Define a scope trait
|
|
829
|
+
*/
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/Traits/helper.d.ts
|
|
832
|
+
/** Merges the static/instance surface of all applied trait classes onto MClass. */
|
|
833
|
+
type AttachTraits<MClass, Traits extends readonly any[]> = Traits extends readonly [infer Head, ...infer Tail] ? AttachTraits<MClass & (Head extends (new (...args: any[]) => infer I) ? I : Head), Tail> : MClass;
|
|
834
|
+
//# sourceMappingURL=helper.d.ts.map
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/Observers/Observer.d.ts
|
|
837
|
+
declare abstract class Observer<T extends object> {
|
|
838
|
+
creating?(model: T): void | Promise<void>;
|
|
839
|
+
created?(model: T): void | Promise<void>;
|
|
840
|
+
updating?(model: T): void | Promise<void>;
|
|
841
|
+
updated?(model: T): void | Promise<void>;
|
|
842
|
+
saving?(model: T): void | Promise<void>;
|
|
843
|
+
saved?(model: T): void | Promise<void>;
|
|
844
|
+
deleting?(model: T): void | Promise<void>;
|
|
845
|
+
deleted?(model: T): void | Promise<void>;
|
|
846
|
+
restoring?(model: T): void | Promise<void>;
|
|
847
|
+
restored?(model: T): void | Promise<void>;
|
|
848
|
+
retrieved?(model: T): void | Promise<void>;
|
|
849
|
+
}
|
|
850
|
+
//# sourceMappingURL=Observer.d.ts.map
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region src/Model.d.ts
|
|
853
|
+
type ObserverConstructor<T extends object> = new () => Observer<T>;
|
|
854
|
+
declare function use<Traits extends readonly any[]>(...traitClasses: Traits): <MClass extends new (...args: any) => Model>(ctor: MClass) => AttachTraits<MClass, Traits>;
|
|
855
|
+
declare abstract class Model {
|
|
856
|
+
[key: string]: any;
|
|
857
|
+
static table: string;
|
|
858
|
+
static primaryKey: string;
|
|
859
|
+
static fillable: string[];
|
|
860
|
+
static guarded: string[];
|
|
861
|
+
static hidden: string[];
|
|
862
|
+
static appends: string[];
|
|
863
|
+
static casts: Casts;
|
|
864
|
+
static timestamps: boolean;
|
|
865
|
+
static softDeletes: boolean;
|
|
866
|
+
static relationships: {
|
|
867
|
+
[key: string]: RelationshipConfig;
|
|
868
|
+
};
|
|
869
|
+
static autoIncrement: boolean;
|
|
870
|
+
private static observers;
|
|
871
|
+
static traits: string[];
|
|
872
|
+
static localScopes: {
|
|
873
|
+
[name: string]: ScopeMethod<any>;
|
|
874
|
+
};
|
|
875
|
+
static globalScopes: {
|
|
876
|
+
[name: string]: (builder: EloquentBuilder<any>) => void;
|
|
877
|
+
};
|
|
878
|
+
static withoutGlobalScopes: string[];
|
|
879
|
+
static eventListeners: { [K in keyof ModelEvents]: ((model: Model) => boolean | void | Promise<boolean | void>)[] };
|
|
880
|
+
static _use?: ClassBasedTrait[];
|
|
881
|
+
private static _accessors;
|
|
882
|
+
private static _mutators;
|
|
883
|
+
static __traitClasses: ClassBasedTrait[];
|
|
884
|
+
id?: number | string;
|
|
885
|
+
created_at?: Date;
|
|
886
|
+
updated_at?: Date;
|
|
887
|
+
deleted_at?: Date | null;
|
|
888
|
+
protected attributes: ModelAttributes;
|
|
889
|
+
protected original: ModelAttributes;
|
|
890
|
+
protected relationshipsLoaded: {
|
|
891
|
+
[key: string]: any;
|
|
892
|
+
};
|
|
893
|
+
protected __exists: boolean;
|
|
894
|
+
protected __isGettingAttribute: boolean;
|
|
895
|
+
protected __attributeCache: Map<string, any>;
|
|
896
|
+
constructor(attributes?: ModelAttributes);
|
|
897
|
+
static getFillables(): string[];
|
|
898
|
+
/**
|
|
899
|
+
* Apply traits to instance (after static traits have been applied)
|
|
900
|
+
*/
|
|
901
|
+
private applyTraitsToInstance;
|
|
902
|
+
/**
|
|
903
|
+
* Add a local scope to the model
|
|
904
|
+
*/
|
|
905
|
+
static addLocalScope(name: string, scope: ScopeMethod<any>): void;
|
|
906
|
+
/**
|
|
907
|
+
* Add a global scope to the model
|
|
908
|
+
*/
|
|
909
|
+
static addGlobalScope(name: string, scope: (builder: EloquentBuilder<any>) => void): void;
|
|
910
|
+
/**
|
|
911
|
+
* Remove a global scope
|
|
912
|
+
*/
|
|
913
|
+
static removeGlobalScope(name: string): void;
|
|
914
|
+
/**
|
|
915
|
+
* Get all global scopes
|
|
916
|
+
*/
|
|
917
|
+
static getGlobalScopes(): {
|
|
918
|
+
[name: string]: (builder: EloquentBuilder<any>) => void;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* Apply scopes to a query builder
|
|
922
|
+
*/
|
|
923
|
+
static applyScopes(builder: EloquentBuilder<any>): EloquentBuilder<any>;
|
|
924
|
+
/**
|
|
925
|
+
* Register a scope method (similar to Laravel's scope naming convention)
|
|
926
|
+
*/
|
|
927
|
+
static registerScopeMethod(name: string, scope: ScopeMethod<any>): void;
|
|
928
|
+
/**
|
|
929
|
+
* Query with a local scope
|
|
930
|
+
*/
|
|
931
|
+
static scope<T extends typeof Model>(this: T, name: string, ...args: any[]): EloquentBuilder<InstanceType<T>>;
|
|
932
|
+
/**
|
|
933
|
+
* Query without global scopes
|
|
934
|
+
*/
|
|
935
|
+
static withoutGlobalScope<T extends typeof Model>(this: T, ...scopes: string[]): EloquentBuilder<InstanceType<T>>;
|
|
936
|
+
/**
|
|
937
|
+
* Query without any global scopes
|
|
938
|
+
*/
|
|
939
|
+
static withoutGlobalScopes_<T extends typeof Model>(this: T): EloquentBuilder<InstanceType<T>>;
|
|
940
|
+
/**
|
|
941
|
+
* Register an event listener
|
|
942
|
+
*/
|
|
943
|
+
addEventListener(event: keyof ModelEvents, callback: (model: Model) => boolean | void | Promise<boolean | void>): void;
|
|
944
|
+
/**
|
|
945
|
+
* Static method to register an event listener (chainable alternative to addEventListener)
|
|
946
|
+
* @param event The event name to listen to
|
|
947
|
+
* @param callback The callback function to execute when the event is triggered
|
|
948
|
+
* @returns The Model class for chaining
|
|
949
|
+
*/
|
|
950
|
+
static on(event: keyof ModelEvents, callback: (model: Model) => boolean | void | Promise<boolean | void>): typeof Model;
|
|
951
|
+
static observe<T extends Model>(observer: ObserverConstructor<T>): typeof Model;
|
|
952
|
+
/**
|
|
953
|
+
* Dispatch an event
|
|
954
|
+
*/
|
|
955
|
+
static dispatchEvent(event: keyof ModelEvents, model: Model): Promise<void>;
|
|
956
|
+
/**
|
|
957
|
+
* Fire model events (similar to Laravel's fireModelEvent)
|
|
958
|
+
*/
|
|
959
|
+
static fireModelEvent(event: keyof ModelEvents, model: Model, halt?: boolean): Promise<boolean>;
|
|
960
|
+
/**
|
|
961
|
+
* Boot the model (similar to Laravel's boot method)
|
|
962
|
+
*/
|
|
963
|
+
static boot(): void;
|
|
964
|
+
/**
|
|
965
|
+
* Ensure traits and static containers are initialized once per subclass.
|
|
966
|
+
* This runs automatically on first static call (e.g., query/ scope).
|
|
967
|
+
*/
|
|
968
|
+
static ensureBooted(): void;
|
|
969
|
+
/**
|
|
970
|
+
* Check if model uses a trait
|
|
971
|
+
*/
|
|
972
|
+
static usesTrait(traitName: string): boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Add traits to the model
|
|
975
|
+
*/
|
|
976
|
+
static addTraits(...traitNames: string[]): void;
|
|
977
|
+
/**
|
|
978
|
+
* Boot all traits (similar to Laravel's bootTraits)
|
|
979
|
+
*/
|
|
980
|
+
static bootTraits(): void;
|
|
981
|
+
/**
|
|
982
|
+
* Add a macro to the model class
|
|
983
|
+
*/
|
|
984
|
+
static macro(name: string, macro: Function): void;
|
|
985
|
+
/**
|
|
986
|
+
* Check if a macro exists
|
|
987
|
+
*/
|
|
988
|
+
static hasMacro(name: string): boolean;
|
|
989
|
+
/**
|
|
990
|
+
* Mixin traits/macros from another class
|
|
991
|
+
*/
|
|
992
|
+
static mixin(traitClass: any): void;
|
|
993
|
+
private static toStudlyCase;
|
|
994
|
+
private static buildMethodName;
|
|
995
|
+
/**
|
|
996
|
+
* Get raw attribute value (bypasses accessors)
|
|
997
|
+
*/
|
|
998
|
+
getRawAttribute(key: string): any;
|
|
999
|
+
/**
|
|
1000
|
+
* Set raw attribute value (bypasses mutators)
|
|
1001
|
+
*/
|
|
1002
|
+
setRawAttribute(key: string, value: any): void;
|
|
1003
|
+
/**
|
|
1004
|
+
* Get property with support for direct field access
|
|
1005
|
+
*/
|
|
1006
|
+
getProperty(prop: string): any;
|
|
1007
|
+
/**
|
|
1008
|
+
* Get an attribute with accessor support (sync/async)
|
|
1009
|
+
* @param key Attribute name
|
|
1010
|
+
* @param onlyAppended If true, only return value if it's in appends array
|
|
1011
|
+
*/
|
|
1012
|
+
getAttributeAsync<T = any>(key: string, onlyAppended?: boolean): Promise<T>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Get an attribute with accessor support (sync)
|
|
1015
|
+
* @param key Attribute name
|
|
1016
|
+
* @param onlyAppended If true, only return value if it's in appends array
|
|
1017
|
+
*/
|
|
1018
|
+
getAttribute<T = any>(key: string, onlyAppended?: boolean): T;
|
|
1019
|
+
/**
|
|
1020
|
+
* Create a context for accessors that allows direct field access
|
|
1021
|
+
*/
|
|
1022
|
+
private createAccessorContext;
|
|
1023
|
+
/**
|
|
1024
|
+
* Get attribute with accessor for proxy/getter
|
|
1025
|
+
*/
|
|
1026
|
+
private getAttributeWithAccessor;
|
|
1027
|
+
/**
|
|
1028
|
+
* Set attribute with mutator support
|
|
1029
|
+
*/
|
|
1030
|
+
setAttributeWithMutator(key: string, value: any): boolean;
|
|
1031
|
+
/**
|
|
1032
|
+
* Get all appended attributes with their values
|
|
1033
|
+
*/
|
|
1034
|
+
getAppendedAttributesAsync(): Promise<ModelAttributes>;
|
|
1035
|
+
/**
|
|
1036
|
+
* Get all appended attributes with their values (sync)
|
|
1037
|
+
*/
|
|
1038
|
+
getAppendedAttributes(): ModelAttributes;
|
|
1039
|
+
/**
|
|
1040
|
+
* Register a synchronous accessor
|
|
1041
|
+
*/
|
|
1042
|
+
static registerAccessor(key: string, fn: (value: any, instance: Model) => any): void;
|
|
1043
|
+
/**
|
|
1044
|
+
* Register an asynchronous accessor
|
|
1045
|
+
*/
|
|
1046
|
+
static registerAsyncAccessor(key: string, fn: (value: any, instance: Model) => Promise<any>): void;
|
|
1047
|
+
/**
|
|
1048
|
+
* Register a synchronous mutator
|
|
1049
|
+
*/
|
|
1050
|
+
static registerMutator(key: string, fn: (value: any, instance: Model) => any): void;
|
|
1051
|
+
/**
|
|
1052
|
+
* Register an asynchronous mutator
|
|
1053
|
+
*/
|
|
1054
|
+
static registerAsyncMutator(key: string, fn: (value: any, instance: Model) => Promise<any>): void;
|
|
1055
|
+
/**
|
|
1056
|
+
* Add attributes to appends array
|
|
1057
|
+
*/
|
|
1058
|
+
static addAppends(...attributes: string[]): void;
|
|
1059
|
+
/**
|
|
1060
|
+
* Get a field value (alias for this.field_name in accessors)
|
|
1061
|
+
*/
|
|
1062
|
+
getField(fieldName: string): any;
|
|
1063
|
+
/**
|
|
1064
|
+
* Get relationship count (for use in accessors)
|
|
1065
|
+
*/
|
|
1066
|
+
getRelationshipCount(relationshipName: string): Promise<number>;
|
|
1067
|
+
/**
|
|
1068
|
+
* Get relationship query (for use in accessors)
|
|
1069
|
+
*/
|
|
1070
|
+
getRelationshipQuery(relationshipName: string): any;
|
|
1071
|
+
toJSONAsync(options?: ToJSONOptions): Promise<any>;
|
|
1072
|
+
toJSON(options?: ToJSONOptions & {
|
|
1073
|
+
relationTree?: Record<string, any>;
|
|
1074
|
+
}): any;
|
|
1075
|
+
/**
|
|
1076
|
+
* Get attributes for array conversion (excludes hidden fields)
|
|
1077
|
+
*/
|
|
1078
|
+
get attributesToArray(): ModelAttributes;
|
|
1079
|
+
/**
|
|
1080
|
+
* Get all attributes including appended ones
|
|
1081
|
+
*/
|
|
1082
|
+
getAttributesWithAppends(): ModelAttributes;
|
|
1083
|
+
/**
|
|
1084
|
+
* Get all attributes including appended ones (async)
|
|
1085
|
+
*/
|
|
1086
|
+
getAttributesWithAppendsAsync(): Promise<ModelAttributes>;
|
|
1087
|
+
private serializeRelationshipsAsync;
|
|
1088
|
+
private serializeRelationships;
|
|
1089
|
+
setAttribute(key: string, value: any): void;
|
|
1090
|
+
hydrate(attributes: ModelAttributes): this;
|
|
1091
|
+
fill(attributes: ModelAttributes): this;
|
|
1092
|
+
getAttributes(): ModelAttributes;
|
|
1093
|
+
getOriginal(key?: string): any;
|
|
1094
|
+
isDirty(key?: string): boolean;
|
|
1095
|
+
getDirty(): ModelAttributes;
|
|
1096
|
+
syncOriginal(): this;
|
|
1097
|
+
/**
|
|
1098
|
+
* Get relationship configuration for a given relation name
|
|
1099
|
+
* Supports both static relationships and instance method relationships
|
|
1100
|
+
*/
|
|
1101
|
+
protected getRelationship(relation: string): RelationshipConfig | null;
|
|
1102
|
+
/**
|
|
1103
|
+
* Convert a relation instance to a RelationshipConfig
|
|
1104
|
+
*/
|
|
1105
|
+
private convertRelationToConfig;
|
|
1106
|
+
/**
|
|
1107
|
+
* Get all defined relationships (both static and instance)
|
|
1108
|
+
*/
|
|
1109
|
+
protected getAllRelationships(): {
|
|
1110
|
+
[key: string]: RelationshipConfig;
|
|
1111
|
+
};
|
|
1112
|
+
private getRelationSerializationOptions;
|
|
1113
|
+
private applyAttributeFilters;
|
|
1114
|
+
private addMetadata;
|
|
1115
|
+
setLoadedRelation(name: string, value: any): void;
|
|
1116
|
+
unsetRelation(name: string): void;
|
|
1117
|
+
relationLoaded(name: string): boolean;
|
|
1118
|
+
hasOne<T extends Model>(this: any, model: new () => T, foreignKey?: string, localKey?: string): HasOne<T>;
|
|
1119
|
+
hasMany<T extends Model>(this: any, model: new () => T, foreignKey?: string, localKey?: string): HasMany<T>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Define a has-one-through relationship.
|
|
1122
|
+
*
|
|
1123
|
+
* @param model The distant (target) model
|
|
1124
|
+
* @param through The intermediate model
|
|
1125
|
+
* @param firstKey FK on the intermediate table pointing to the parent (default: parent_table_id)
|
|
1126
|
+
* @param secondKey FK on the target table pointing to the intermediate (default: through_table_id)
|
|
1127
|
+
* @param localKey PK on the parent (default: id)
|
|
1128
|
+
* @param secondLocalKey PK on the intermediate (default: id)
|
|
1129
|
+
*/
|
|
1130
|
+
hasOneThrough<T extends Model>(this: any, model: new () => T, through: new () => Model, firstKey?: string, secondKey?: string, localKey?: string, secondLocalKey?: string): HasOneThrough<T>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Define a has-many-through relationship.
|
|
1133
|
+
*
|
|
1134
|
+
* @param model The distant (target) model
|
|
1135
|
+
* @param through The intermediate model
|
|
1136
|
+
* @param firstKey FK on the intermediate table pointing to the parent
|
|
1137
|
+
* @param secondKey FK on the target table pointing to the intermediate
|
|
1138
|
+
* @param localKey PK on the parent (default: id)
|
|
1139
|
+
* @param secondLocalKey PK on the intermediate (default: id)
|
|
1140
|
+
*/
|
|
1141
|
+
hasManyThrough<T extends Model>(this: any, model: new () => T, through: new () => Model, firstKey?: string, secondKey?: string, localKey?: string, secondLocalKey?: string): HasManyThrough<T>;
|
|
1142
|
+
belongsTo<T extends Model>(this: any, model: new () => T, foreignKey?: string, ownerKey?: string): BelongsTo<T>;
|
|
1143
|
+
belongsToMany<T extends Model>(this: any, model: new () => T, table?: string | (new (...args: any[]) => Model) | typeof Model, foreignPivotKey?: string, relatedPivotKey?: string): BelongsToMany<T>;
|
|
1144
|
+
morphOne<T extends Model>(this: any, model: new () => T, name: string): HasOne<T>;
|
|
1145
|
+
morphMany<T extends Model>(this: any, model: new () => T, name: string): HasMany<T>;
|
|
1146
|
+
morphTo<T extends Model = Model>(this: any, name: string): BelongsTo<T>;
|
|
1147
|
+
save(options?: {
|
|
1148
|
+
force?: boolean;
|
|
1149
|
+
}): Promise<this>;
|
|
1150
|
+
delete(force?: boolean): Promise<boolean>;
|
|
1151
|
+
restore(): Promise<boolean>;
|
|
1152
|
+
update(attributes: ModelAttributes): Promise<this>;
|
|
1153
|
+
delete_(force?: boolean): Promise<boolean>;
|
|
1154
|
+
restore_(): Promise<boolean>;
|
|
1155
|
+
forceDelete(): Promise<boolean>;
|
|
1156
|
+
refresh(): Promise<this>;
|
|
1157
|
+
replicate(except?: string[]): this;
|
|
1158
|
+
static create<M extends typeof Model>(this: M, attributes: ModelAttributes): Promise<InstanceType<M>>;
|
|
1159
|
+
static createMany<M extends typeof Model>(this: M, rows: Array<ModelAttributes>): Promise<InstanceType<M>[]>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Find a model matching the attributes or create a new one, then update with values
|
|
1162
|
+
* @param attributes - The attributes to find the model by
|
|
1163
|
+
* @param values - The values to update or create the model with
|
|
1164
|
+
* @returns The model instance (existing or newly created)
|
|
1165
|
+
*/
|
|
1166
|
+
static updateOrCreate<M extends typeof Model>(this: M, attributes: ModelAttributes, values?: ModelAttributes): Promise<InstanceType<M>>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Alias for updateOrCreate method
|
|
1169
|
+
* @param attributes - The attributes to find the model by
|
|
1170
|
+
* @param values - The values to update or create the model with
|
|
1171
|
+
* @returns The model instance (existing or newly created)
|
|
1172
|
+
*/
|
|
1173
|
+
static createOrUpdate<M extends typeof Model>(this: M, attributes: ModelAttributes, values?: ModelAttributes): Promise<InstanceType<M>>;
|
|
1174
|
+
static query_<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1175
|
+
static query<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1176
|
+
static with<M extends typeof Model>(this: M, relationships: string[]): EloquentBuilder<InstanceType<M>>;
|
|
1177
|
+
static withTrashed<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1178
|
+
static withThrashed<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1179
|
+
static withoutTrashed<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1180
|
+
static withoutThrashed<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1181
|
+
static onlyTrashed<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1182
|
+
static onlyThrashed<M extends typeof Model>(this: M): EloquentBuilder<InstanceType<M>>;
|
|
1183
|
+
static where<M extends typeof Model>(this: M, column: string, operator: any, value?: any): EloquentBuilder<InstanceType<M>>;
|
|
1184
|
+
static find<M extends typeof Model>(this: M, id: number | string): Promise<InstanceType<M> | null>;
|
|
1185
|
+
static findOrFail<M extends typeof Model>(this: M, id: number | string): Promise<InstanceType<M>>;
|
|
1186
|
+
static all<M extends typeof Model>(this: M): Promise<InstanceType<M>[]>;
|
|
1187
|
+
static first<M extends typeof Model>(this: M): Promise<InstanceType<M> | null>;
|
|
1188
|
+
static getTable(): string;
|
|
1189
|
+
private castAttribute;
|
|
1190
|
+
protected getPrimaryKey(): string;
|
|
1191
|
+
private static pluralize;
|
|
1192
|
+
private static looksPlural;
|
|
1193
|
+
[util.inspect.custom](depth: number, options: any): any;
|
|
1194
|
+
load(relations: string[] | string): Promise<this>;
|
|
1195
|
+
loadMissing(relations: string[] | string): Promise<this>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Structured changes report comparing current attributes to original snapshot
|
|
1198
|
+
*/
|
|
1199
|
+
changes(): {
|
|
1200
|
+
before: ModelAttributes;
|
|
1201
|
+
after: ModelAttributes;
|
|
1202
|
+
keys: string[];
|
|
1203
|
+
count: number;
|
|
1204
|
+
};
|
|
1205
|
+
static use<T1 extends ClassBasedTrait>(this: typeof Model, trait1: T1): AugmentedModel<typeof Model, [T1]>;
|
|
1206
|
+
static use<T1 extends ClassBasedTrait, T2 extends ClassBasedTrait>(this: typeof Model, trait1: T1, trait2: T2): AugmentedModel<typeof Model, [T1, T2]>;
|
|
1207
|
+
static use<T1 extends ClassBasedTrait, T2 extends ClassBasedTrait, T3 extends ClassBasedTrait>(this: typeof Model, trait1: T1, trait2: T2, trait3: T3): AugmentedModel<typeof Model, [T1, T2, T3]>;
|
|
1208
|
+
static use<T1 extends ClassBasedTrait, T2 extends ClassBasedTrait, T3 extends ClassBasedTrait, T4 extends ClassBasedTrait>(this: typeof Model, trait1: T1, trait2: T2, trait3: T3, trait4: T4): AugmentedModel<typeof Model, [T1, T2, T3, T4]>;
|
|
1209
|
+
static use<T1 extends ClassBasedTrait, T2 extends ClassBasedTrait, T3 extends ClassBasedTrait, T4 extends ClassBasedTrait, T5 extends ClassBasedTrait>(this: typeof Model, trait1: T1, trait2: T2, trait3: T3, trait4: T4, trait5: T5): AugmentedModel<typeof Model, [T1, T2, T3, T4, T5]>;
|
|
1210
|
+
}
|
|
1211
|
+
type TraitInstance<T extends ClassBasedTrait> = Omit<InstanceType<T>, "constructor">;
|
|
1212
|
+
type TraitStatics<T extends ClassBasedTrait> = Omit<T, "prototype">;
|
|
1213
|
+
type MergeInstances<Traits extends readonly ClassBasedTrait[]> = Traits extends [infer A, ...infer Rest] ? A extends ClassBasedTrait ? Rest extends readonly ClassBasedTrait[] ? TraitInstance<A> & MergeInstances<Rest> : TraitInstance<A> : {} : {};
|
|
1214
|
+
type MergeStatics<Traits extends readonly ClassBasedTrait[]> = Traits extends [infer A, ...infer Rest] ? A extends ClassBasedTrait ? Rest extends readonly ClassBasedTrait[] ? TraitStatics<A> & MergeStatics<Rest> : TraitStatics<A> : {} : {};
|
|
1215
|
+
type AugmentedModel<C extends typeof Model, Traits extends readonly ClassBasedTrait[]> = {
|
|
1216
|
+
new (...args: ConstructorParameters<C>): InstanceType<C> & MergeInstances<Traits>;
|
|
1217
|
+
} & C & MergeStatics<Traits>;
|
|
1218
|
+
//#endregion
|
|
1219
|
+
//#region src/Traits/built-ins.d.ts
|
|
1220
|
+
/**
|
|
1221
|
+
* SoftDeletes trait as a class (Laravel style)
|
|
1222
|
+
* Usage: use SoftDeletes;
|
|
1223
|
+
*/
|
|
1224
|
+
declare class SoftDeletes {
|
|
1225
|
+
/**
|
|
1226
|
+
* Determine if the model has been soft-deleted
|
|
1227
|
+
*/
|
|
1228
|
+
trashed(): boolean;
|
|
1229
|
+
/**
|
|
1230
|
+
* Determine if the model is not soft-deleted
|
|
1231
|
+
*/
|
|
1232
|
+
isNotTrashed(): boolean;
|
|
1233
|
+
/**
|
|
1234
|
+
* Force delete the model (bypass soft delete)
|
|
1235
|
+
*/
|
|
1236
|
+
forceDelete(): Promise<boolean>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Restore a soft-deleted model
|
|
1239
|
+
*/
|
|
1240
|
+
restore(): Promise<boolean>;
|
|
1241
|
+
/**
|
|
1242
|
+
* Boot method for the trait
|
|
1243
|
+
*/
|
|
1244
|
+
static boot(modelClass: typeof Model): void;
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Timestamps trait (auto-manages created_at and updated_at)
|
|
1248
|
+
* Usage: use Timestamps;
|
|
1249
|
+
*/
|
|
1250
|
+
declare class Timestamps {
|
|
1251
|
+
/**
|
|
1252
|
+
* Touch the model's timestamps
|
|
1253
|
+
*/
|
|
1254
|
+
touch(): Promise<void>;
|
|
1255
|
+
/**
|
|
1256
|
+
* Disable timestamps for the current operation
|
|
1257
|
+
*/
|
|
1258
|
+
withoutTimestamps(callback: Function): any;
|
|
1259
|
+
static boot(modelClass: typeof Model): void;
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Sluggable trait for generating slugs
|
|
1263
|
+
* Usage: use Sluggable;
|
|
1264
|
+
*/
|
|
1265
|
+
declare class Sluggable {
|
|
1266
|
+
/**
|
|
1267
|
+
* Generate a slug from a given string
|
|
1268
|
+
*/
|
|
1269
|
+
generateSlug(text: string): string;
|
|
1270
|
+
/**
|
|
1271
|
+
* Set slug from attribute
|
|
1272
|
+
*/
|
|
1273
|
+
setSlugFrom(sourceField?: string): void;
|
|
1274
|
+
/**
|
|
1275
|
+
* Scope: Find by slug
|
|
1276
|
+
*/
|
|
1277
|
+
static scopeFindBySlug(builder: EloquentBuilder<any>, slug: string): EloquentBuilder<any>;
|
|
1278
|
+
static boot(modelClass: typeof Model): void;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Sortable trait for ordering
|
|
1282
|
+
* Usage: use Sortable;
|
|
1283
|
+
*/
|
|
1284
|
+
declare class Sortable {
|
|
1285
|
+
/**
|
|
1286
|
+
* Reorder models
|
|
1287
|
+
*/
|
|
1288
|
+
static reorder(ids: number[]): Promise<void>;
|
|
1289
|
+
static latest(this: typeof Model): EloquentBuilder<Model>;
|
|
1290
|
+
static oldest(this: typeof Model): EloquentBuilder<Model>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Move model up in order
|
|
1293
|
+
*/
|
|
1294
|
+
moveUp(): Promise<void>;
|
|
1295
|
+
/**
|
|
1296
|
+
* Move model down in order
|
|
1297
|
+
*/
|
|
1298
|
+
moveDown(): Promise<void>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Scope: Order by order column
|
|
1301
|
+
*/
|
|
1302
|
+
static scopeOrdered(builder: EloquentBuilder<any>, direction?: "asc" | "desc"): EloquentBuilder<any>;
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Searchable trait for full-text search
|
|
1306
|
+
* Usage: use Searchable;
|
|
1307
|
+
*/
|
|
1308
|
+
declare class Searchable {
|
|
1309
|
+
/**
|
|
1310
|
+
* Scope: Search in specified fields
|
|
1311
|
+
*/
|
|
1312
|
+
static scopeSearch(builder: EloquentBuilder<any>, query: string, fields?: string[]): EloquentBuilder<any>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Scope: Advanced search with filters
|
|
1315
|
+
*/
|
|
1316
|
+
static scopeAdvancedSearch(builder: EloquentBuilder<any>, params: any): EloquentBuilder<any>;
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Cacheable trait for caching queries
|
|
1320
|
+
* Usage: use Cacheable;
|
|
1321
|
+
*/
|
|
1322
|
+
declare class Cacheable {
|
|
1323
|
+
/**
|
|
1324
|
+
* Cache a query result
|
|
1325
|
+
*/
|
|
1326
|
+
static cached(callback: Function, key: string, ttl?: number): any;
|
|
1327
|
+
/**
|
|
1328
|
+
* Clear model cache
|
|
1329
|
+
*/
|
|
1330
|
+
static clearCache(): void;
|
|
1331
|
+
/**
|
|
1332
|
+
* Get with cache
|
|
1333
|
+
*/
|
|
1334
|
+
static getCached(id: number): any;
|
|
1335
|
+
}
|
|
1336
|
+
//# sourceMappingURL=built-ins.d.ts.map
|
|
1337
|
+
//#endregion
|
|
1338
|
+
//#region src/Database/MigrationRunner.d.ts
|
|
1339
|
+
declare function run$1(inputArgs?: {
|
|
1340
|
+
command?: "up" | "down";
|
|
1341
|
+
step?: number;
|
|
1342
|
+
force?: boolean;
|
|
1343
|
+
forceConfirm?: boolean;
|
|
1344
|
+
lockName?: string;
|
|
1345
|
+
lockTimeout?: number;
|
|
1346
|
+
lockRetries?: number;
|
|
1347
|
+
lockBackoffMs?: number;
|
|
1348
|
+
}): Promise<void>;
|
|
1349
|
+
//#endregion
|
|
1350
|
+
//#region src/Database/Schema.d.ts
|
|
1351
|
+
interface MigrationSchema {
|
|
1352
|
+
createTable(name: string, callback: (table: TableBuilder) => void): any;
|
|
1353
|
+
alterTable(name: string, callback: (table: TableBuilder) => void): any;
|
|
1354
|
+
dropTable(name: string): any;
|
|
1355
|
+
dropTableIfExists(name: string): any;
|
|
1356
|
+
rename(from: string, to: string): any;
|
|
1357
|
+
hasTable(name: string): Promise<boolean>;
|
|
1358
|
+
hasColumn(table: string, column: string): Promise<boolean>;
|
|
1359
|
+
hasColumns(table: string, columns: string[]): Promise<boolean>;
|
|
1360
|
+
getColumnType(table: string, column: string): Promise<string | null>;
|
|
1361
|
+
getColumnListing(table: string): Promise<string[]>;
|
|
1362
|
+
dropColumns(table: string, columns: string[]): any;
|
|
1363
|
+
renameColumn(table: string, from: string, to: string): any;
|
|
1364
|
+
}
|
|
1365
|
+
type DefaultValue = string | number | boolean | null | RawExpression;
|
|
1366
|
+
declare class RawExpression {
|
|
1367
|
+
value: string;
|
|
1368
|
+
constructor(value: string);
|
|
1369
|
+
toString(): string;
|
|
1370
|
+
}
|
|
1371
|
+
declare class Column {
|
|
1372
|
+
name: string;
|
|
1373
|
+
type: string;
|
|
1374
|
+
length?: number;
|
|
1375
|
+
enumValues?: string[];
|
|
1376
|
+
nullableFlag: boolean;
|
|
1377
|
+
defaultValue?: DefaultValue;
|
|
1378
|
+
unsignedFlag: boolean;
|
|
1379
|
+
uniqueFlag: boolean;
|
|
1380
|
+
primaryFlag: boolean;
|
|
1381
|
+
autoIncrementFlag: boolean;
|
|
1382
|
+
commentText?: string;
|
|
1383
|
+
decimalPlaces?: number;
|
|
1384
|
+
afterColumn?: string;
|
|
1385
|
+
firstFlag: boolean;
|
|
1386
|
+
virtualAsExpr?: string;
|
|
1387
|
+
storedAsExpr?: string;
|
|
1388
|
+
useCurrent__: boolean;
|
|
1389
|
+
useCurrentOnUpdate__: boolean;
|
|
1390
|
+
charset__?: string;
|
|
1391
|
+
collation?: string;
|
|
1392
|
+
invisibleFlag: boolean;
|
|
1393
|
+
generatedAs__?: string;
|
|
1394
|
+
alwaysAs?: string;
|
|
1395
|
+
constructor(name: string, type: string, length?: number, decimalPlaces?: number);
|
|
1396
|
+
enum(values: string[]): this;
|
|
1397
|
+
nullable(): this;
|
|
1398
|
+
notNullable(): this;
|
|
1399
|
+
default(val: DefaultValue): this;
|
|
1400
|
+
unsigned(): this;
|
|
1401
|
+
unique(): this;
|
|
1402
|
+
primary(): this;
|
|
1403
|
+
increments(): this;
|
|
1404
|
+
comment(text: string): this;
|
|
1405
|
+
after(column: string): this;
|
|
1406
|
+
first(): this;
|
|
1407
|
+
useCurrent(): this;
|
|
1408
|
+
useCurrentOnUpdate(): this;
|
|
1409
|
+
charset(charset: string): this;
|
|
1410
|
+
collate(collation: string): this;
|
|
1411
|
+
invisible(): this;
|
|
1412
|
+
virtualAs(expression: string): this;
|
|
1413
|
+
storedAs(expression: string): this;
|
|
1414
|
+
generatedAs(expression: string): this;
|
|
1415
|
+
always(): this;
|
|
1416
|
+
from(startingValue: number): this;
|
|
1417
|
+
index(name?: string): this;
|
|
1418
|
+
toSQL(omitName?: boolean): string;
|
|
1419
|
+
}
|
|
1420
|
+
declare class TableBuilder {
|
|
1421
|
+
name: string;
|
|
1422
|
+
columns: Column[];
|
|
1423
|
+
primaryKeys: string[];
|
|
1424
|
+
uniques: string[];
|
|
1425
|
+
engine: string;
|
|
1426
|
+
charset: string;
|
|
1427
|
+
indexes: {
|
|
1428
|
+
columns: string[];
|
|
1429
|
+
name?: string;
|
|
1430
|
+
unique?: boolean;
|
|
1431
|
+
}[];
|
|
1432
|
+
foreignKeys: {
|
|
1433
|
+
columns: string[];
|
|
1434
|
+
refTable: string;
|
|
1435
|
+
refColumns: string[];
|
|
1436
|
+
name?: string;
|
|
1437
|
+
onDelete?: string;
|
|
1438
|
+
onUpdate?: string;
|
|
1439
|
+
}[];
|
|
1440
|
+
dropIndexes: string[];
|
|
1441
|
+
dropForeignKeys: string[];
|
|
1442
|
+
lastForeignKeyIndex: number | null;
|
|
1443
|
+
pendingForeign?: {
|
|
1444
|
+
columns: string[];
|
|
1445
|
+
refTable?: string;
|
|
1446
|
+
refColumns?: string[];
|
|
1447
|
+
name?: string;
|
|
1448
|
+
onDelete?: string;
|
|
1449
|
+
onUpdate?: string;
|
|
1450
|
+
};
|
|
1451
|
+
drops: string[];
|
|
1452
|
+
changes: {
|
|
1453
|
+
oldName: string;
|
|
1454
|
+
col: Column;
|
|
1455
|
+
}[];
|
|
1456
|
+
renames: {
|
|
1457
|
+
from: string;
|
|
1458
|
+
to: string;
|
|
1459
|
+
}[];
|
|
1460
|
+
mode: "create" | "alter";
|
|
1461
|
+
constructor(name: string, mode?: "create" | "alter");
|
|
1462
|
+
column(type: string, name: string, length?: number): Column;
|
|
1463
|
+
foreign(columns: string[] | string): this;
|
|
1464
|
+
references(refColumns: string[] | string): this;
|
|
1465
|
+
inTable(tableName: string, opts?: {
|
|
1466
|
+
name?: string;
|
|
1467
|
+
}): this;
|
|
1468
|
+
enum(name: string, values: string[]): Column;
|
|
1469
|
+
set(name: string, values: string[]): Column;
|
|
1470
|
+
increments(name?: string): Column;
|
|
1471
|
+
bigIncrements(name?: string): Column;
|
|
1472
|
+
mediumIncrements(name?: string): Column;
|
|
1473
|
+
smallIncrements(name?: string): Column;
|
|
1474
|
+
tinyIncrements(name?: string): Column;
|
|
1475
|
+
uuid(name?: string): Column;
|
|
1476
|
+
ulid(name?: string): Column;
|
|
1477
|
+
id(name?: string): Column;
|
|
1478
|
+
foreignId(name: string): Column;
|
|
1479
|
+
foreignUuid(name: string): Column;
|
|
1480
|
+
foreignUlid(name: string): Column;
|
|
1481
|
+
integer(name: string, length?: number): Column;
|
|
1482
|
+
unsignedInteger(name: string): Column;
|
|
1483
|
+
tinyInteger(name: string): Column;
|
|
1484
|
+
unsignedTinyInteger(name: string): Column;
|
|
1485
|
+
smallInteger(name: string): Column;
|
|
1486
|
+
unsignedSmallInteger(name: string): Column;
|
|
1487
|
+
mediumInteger(name: string): Column;
|
|
1488
|
+
unsignedMediumInteger(name: string): Column;
|
|
1489
|
+
bigInteger(name: string): Column;
|
|
1490
|
+
unsignedBigInteger(name: string): Column;
|
|
1491
|
+
boolean(name: string): Column;
|
|
1492
|
+
string(name: string, length?: number): Column;
|
|
1493
|
+
char(name: string, length?: number): Column;
|
|
1494
|
+
text(name: string): Column;
|
|
1495
|
+
tinyText(name: string): Column;
|
|
1496
|
+
mediumText(name: string): Column;
|
|
1497
|
+
longText(name: string): Column;
|
|
1498
|
+
decimal(name: string, precision?: number, scale?: number): Column;
|
|
1499
|
+
unsignedDecimal(name: string, precision?: number, scale?: number): Column;
|
|
1500
|
+
float(name: string, precision?: number, scale?: number): Column;
|
|
1501
|
+
unsignedFloat(name: string, precision?: number, scale?: number): Column;
|
|
1502
|
+
double(name: string, precision?: number, scale?: number): Column;
|
|
1503
|
+
unsignedDouble(name: string, precision?: number, scale?: number): Column;
|
|
1504
|
+
datetime(name: string, precision?: number): Column;
|
|
1505
|
+
date(name: string): Column;
|
|
1506
|
+
time(name: string, precision?: number): Column;
|
|
1507
|
+
timestamp(name: string, precision?: number): Column;
|
|
1508
|
+
timestampTz(name: string, precision?: number): Column;
|
|
1509
|
+
datetimeTz(name: string, precision?: number): Column;
|
|
1510
|
+
timeTz(name: string, precision?: number): Column;
|
|
1511
|
+
year(name: string): Column;
|
|
1512
|
+
timestamps(precision?: number): this;
|
|
1513
|
+
timestampsTz(precision?: number): this;
|
|
1514
|
+
nullableTimestamps(precision?: number): this;
|
|
1515
|
+
softDeletes(column?: string, precision?: number): this;
|
|
1516
|
+
softDeletesTz(column?: string, precision?: number): this;
|
|
1517
|
+
binary(name: string, length?: number): Column;
|
|
1518
|
+
json(name: string): Column;
|
|
1519
|
+
jsonb(name: string): Column;
|
|
1520
|
+
geometry(name: string): Column;
|
|
1521
|
+
point(name: string): Column;
|
|
1522
|
+
lineString(name: string): Column;
|
|
1523
|
+
polygon(name: string): Column;
|
|
1524
|
+
geometryCollection(name: string): Column;
|
|
1525
|
+
multiPoint(name: string): Column;
|
|
1526
|
+
multiLineString(name: string): Column;
|
|
1527
|
+
multiPolygon(name: string): Column;
|
|
1528
|
+
ipAddress(name?: string): Column;
|
|
1529
|
+
macAddress(name?: string): Column;
|
|
1530
|
+
rememberToken(): Column;
|
|
1531
|
+
morphs(name: string, indexName?: string): this;
|
|
1532
|
+
nullableMorphs(name: string, indexName?: string): this;
|
|
1533
|
+
uuidMorphs(name: string, indexName?: string): this;
|
|
1534
|
+
nullableUuidMorphs(name: string, indexName?: string): this;
|
|
1535
|
+
ulidMorphs(name: string, indexName?: string): this;
|
|
1536
|
+
nullableUlidMorphs(name: string, indexName?: string): this;
|
|
1537
|
+
unique(name: string): this;
|
|
1538
|
+
primary(name: string): this;
|
|
1539
|
+
index(columns: string[] | string, name?: string): this;
|
|
1540
|
+
uniqueIndex(columns: string[] | string, name?: string): this;
|
|
1541
|
+
dropIndex(name: string): this;
|
|
1542
|
+
dropForeignKey(name: string): this;
|
|
1543
|
+
foreignKey(columns: string[] | string, refTable: string, refColumns: string[] | string, opts?: {
|
|
1544
|
+
name?: string;
|
|
1545
|
+
onDelete?: string;
|
|
1546
|
+
onUpdate?: string;
|
|
1547
|
+
}): this;
|
|
1548
|
+
onDelete(action: string): this;
|
|
1549
|
+
onUpdate(action: string): this;
|
|
1550
|
+
dropColumn(name: string): this;
|
|
1551
|
+
renameColumn(from: string, to: string): this;
|
|
1552
|
+
changeColumn(oldName: string, cb: (col: Column) => Column): this;
|
|
1553
|
+
toSQL(): string;
|
|
1554
|
+
}
|
|
1555
|
+
declare class Schema implements MigrationSchema {
|
|
1556
|
+
private queryFn?;
|
|
1557
|
+
constructor(queryFn?: (sql: string, params?: any[]) => Promise<any>);
|
|
1558
|
+
createTable(name: string, callback: (table: TableBuilder) => void): string;
|
|
1559
|
+
alterTable(name: string, callback: (table: TableBuilder) => void): string;
|
|
1560
|
+
dropTable(name: string): string;
|
|
1561
|
+
dropTableIfExists(name: string): string;
|
|
1562
|
+
rename(from: string, to: string): string;
|
|
1563
|
+
hasTable(name: string): Promise<boolean>;
|
|
1564
|
+
hasColumn(table: string, column: string): Promise<boolean>;
|
|
1565
|
+
hasColumns(table: string, columns: string[]): Promise<boolean>;
|
|
1566
|
+
getColumnType(table: string, column: string): Promise<string | null>;
|
|
1567
|
+
getColumnListing(table: string): Promise<string[]>;
|
|
1568
|
+
dropColumns(table: string, columns: string[]): string;
|
|
1569
|
+
renameColumn(table: string, from: string, to: string): string;
|
|
1570
|
+
createDatabase(name: string): string;
|
|
1571
|
+
dropDatabaseIfExists(name: string): string;
|
|
1572
|
+
enableForeignKeyConstraints(): string;
|
|
1573
|
+
disableForeignKeyConstraints(): string;
|
|
1574
|
+
getAllTables(): Promise<string[]>;
|
|
1575
|
+
getAllViews(): Promise<string[]>;
|
|
1576
|
+
}
|
|
1577
|
+
//#endregion
|
|
1578
|
+
//#region src/Database/SeederRunner.d.ts
|
|
1579
|
+
interface SeederOptions {
|
|
1580
|
+
class?: string;
|
|
1581
|
+
force?: boolean;
|
|
1582
|
+
}
|
|
1583
|
+
declare function run$2(inputOptions?: SeederOptions): Promise<void>;
|
|
1584
|
+
//#endregion
|
|
1585
|
+
//#region src/Database/MigrateFresh.d.ts
|
|
1586
|
+
interface MigrateFreshOptions {
|
|
1587
|
+
force?: boolean;
|
|
1588
|
+
seed?: boolean;
|
|
1589
|
+
seederClass?: string;
|
|
1590
|
+
}
|
|
1591
|
+
declare function run(inputArgs?: MigrateFreshOptions): Promise<void>;
|
|
1592
|
+
//#endregion
|
|
1593
|
+
//#region src/Database/index.d.ts
|
|
1594
|
+
declare function rollbackMigrations(options?: {
|
|
1595
|
+
step?: number;
|
|
1596
|
+
}): Promise<void>;
|
|
1597
|
+
declare function makeMigration(name: string, options?: {
|
|
1598
|
+
table?: string;
|
|
1599
|
+
alter?: boolean;
|
|
1600
|
+
}): Promise<void>;
|
|
1601
|
+
//# sourceMappingURL=index.d.ts.map
|
|
1602
|
+
//#endregion
|
|
1603
|
+
//#region src/QueryInstrumentation.d.ts
|
|
1604
|
+
interface QueryEventPayload {
|
|
1605
|
+
sql: string;
|
|
1606
|
+
bindings?: any[];
|
|
1607
|
+
duration: number;
|
|
1608
|
+
rows?: number;
|
|
1609
|
+
error?: string;
|
|
1610
|
+
connection: string;
|
|
1611
|
+
collection?: string;
|
|
1612
|
+
}
|
|
1613
|
+
/** Called by @lara-node/telescope or @lara-node/events to wire up query event emission. */
|
|
1614
|
+
declare function setQueryEventHook(hook: (payload: QueryEventPayload) => Promise<void>): void;
|
|
1615
|
+
/** Emit a query event via the registered hook (no-op if none registered). */
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Wraps a MongoCollection in a Proxy that times every operation and calls
|
|
1619
|
+
* emitQueryEvent() so Telescope captures it regardless of which process runs it.
|
|
1620
|
+
*/
|
|
1621
|
+
declare function createMongoQueryProxy<T extends object>(collectionName: string, col: T): T;
|
|
1622
|
+
/** The Cache key pattern used for cross-process query entries. */
|
|
1623
|
+
declare const TELESCOPE_QUERY_CACHE_KEY: string;
|
|
1624
|
+
//# sourceMappingURL=QueryInstrumentation.d.ts.map
|
|
1625
|
+
//#endregion
|
|
1626
|
+
//#region src/DatabaseServiceProvider.d.ts
|
|
1627
|
+
declare class DatabaseServiceProvider extends ServiceProvider {
|
|
1628
|
+
register(): void;
|
|
1629
|
+
boot(): Promise<void>;
|
|
1630
|
+
}
|
|
1631
|
+
//# sourceMappingURL=DatabaseServiceProvider.d.ts.map
|
|
1632
|
+
|
|
1633
|
+
//#endregion
|
|
1634
|
+
export { BelongsTo, BelongsToMany, Cacheable, type Casts, DB, DatabaseServiceProvider, EloquentBuilder, HasMany, HasManyThrough, HasOne, HasOneThrough, type IMysqlTransaction, type ITransaction, type MigrationSchema, Model, type ModelAttributes, Observer, type QueryResult, type RelationshipConfig, Schema, Searchable, Sluggable, SoftDeletes, Sortable, TELESCOPE_QUERY_CACHE_KEY, TableBuilder, Timestamps, applyTraits, collection, createMongoQueryProxy, getDbType, getMongoDb, getPool, initDatabase, makeMigration, run as migrateFresh, query, rollbackMigrations, run$1 as runMigrations, run$2 as runSeeders, setQueryEventHook, use };
|
|
1635
|
+
//# sourceMappingURL=index.d.ts.map
|