@orchestr-sh/orchestr 1.2.1 → 1.4.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/README.md +176 -34
- package/dist/Database/Ensemble/Concerns/HasRelationships.d.ts +96 -0
- package/dist/Database/Ensemble/Concerns/HasRelationships.d.ts.map +1 -0
- package/dist/Database/Ensemble/Concerns/HasRelationships.js +145 -0
- package/dist/Database/Ensemble/Concerns/HasRelationships.js.map +1 -0
- package/dist/Database/Ensemble/Ensemble.d.ts +18 -1
- package/dist/Database/Ensemble/Ensemble.d.ts.map +1 -1
- package/dist/Database/Ensemble/Ensemble.js +45 -1
- package/dist/Database/Ensemble/Ensemble.js.map +1 -1
- package/dist/Database/Ensemble/EnsembleBuilder.d.ts +19 -2
- package/dist/Database/Ensemble/EnsembleBuilder.d.ts.map +1 -1
- package/dist/Database/Ensemble/EnsembleBuilder.js +105 -4
- package/dist/Database/Ensemble/EnsembleBuilder.js.map +1 -1
- package/dist/Database/Ensemble/Relations/BelongsTo.d.ts +92 -0
- package/dist/Database/Ensemble/Relations/BelongsTo.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/BelongsTo.js +174 -0
- package/dist/Database/Ensemble/Relations/BelongsTo.js.map +1 -0
- package/dist/Database/Ensemble/Relations/HasMany.d.ts +100 -0
- package/dist/Database/Ensemble/Relations/HasMany.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/HasMany.js +199 -0
- package/dist/Database/Ensemble/Relations/HasMany.js.map +1 -0
- package/dist/Database/Ensemble/Relations/HasOne.d.ts +76 -0
- package/dist/Database/Ensemble/Relations/HasOne.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/HasOne.js +142 -0
- package/dist/Database/Ensemble/Relations/HasOne.js.map +1 -0
- package/dist/Database/Ensemble/Relations/Relation.d.ts +114 -0
- package/dist/Database/Ensemble/Relations/Relation.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/Relation.js +137 -0
- package/dist/Database/Ensemble/Relations/Relation.js.map +1 -0
- package/dist/Database/Ensemble/Relations/index.d.ts +10 -0
- package/dist/Database/Ensemble/Relations/index.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/index.js +17 -0
- package/dist/Database/Ensemble/Relations/index.js.map +1 -0
- package/dist/Support/Injectable.d.ts +21 -0
- package/dist/Support/Injectable.d.ts.map +1 -0
- package/dist/Support/Injectable.js +30 -0
- package/dist/Support/Injectable.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Built from the ground up with Laravel's core components:
|
|
|
14
14
|
- **Controllers** - MVC architecture support
|
|
15
15
|
- **Facades** - Static proxy access to services (Route, DB)
|
|
16
16
|
- **Query Builder** - Fluent database query builder with full Laravel API
|
|
17
|
-
- **Ensemble ORM** - ActiveRecord ORM (Laravel's Eloquent equivalent) with relationships, soft deletes, and more
|
|
17
|
+
- **Ensemble ORM** - ActiveRecord ORM (Laravel's Eloquent equivalent) with relationships (HasOne, HasMany, BelongsTo), eager/lazy loading, soft deletes, and more
|
|
18
18
|
- **Database Manager** - Multi-connection database management
|
|
19
19
|
- **Application Lifecycle** - Complete Laravel bootstrap process
|
|
20
20
|
|
|
@@ -78,6 +78,45 @@ app.singleton('Database', () => new Database());
|
|
|
78
78
|
const userService = app.make('UserService');
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
### Dependency Injection
|
|
82
|
+
|
|
83
|
+
Orchestr supports automatic constructor-based dependency injection using TypeScript's reflection:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { Injectable, Controller, Request, Response } from 'orchestr';
|
|
87
|
+
|
|
88
|
+
// Define a service
|
|
89
|
+
export class UserService {
|
|
90
|
+
getUsers() {
|
|
91
|
+
return [{ id: 1, name: 'John' }];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Use @Injectable() decorator to enable DI
|
|
96
|
+
@Injectable()
|
|
97
|
+
export class UserController extends Controller {
|
|
98
|
+
// Dependencies are automatically injected
|
|
99
|
+
constructor(private userService: UserService) {
|
|
100
|
+
super();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async index(req: Request, res: Response) {
|
|
104
|
+
const users = this.userService.getUsers();
|
|
105
|
+
return res.json({ users });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Register the service in a provider
|
|
110
|
+
class AppServiceProvider extends ServiceProvider {
|
|
111
|
+
register(): void {
|
|
112
|
+
// Bind the service to the container
|
|
113
|
+
this.app.singleton(UserService, () => new UserService());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Important**: The `@Injectable()` decorator is required for dependency injection to work. It triggers TypeScript to emit metadata about constructor parameters.
|
|
119
|
+
|
|
81
120
|
### Service Providers
|
|
82
121
|
|
|
83
122
|
Organize service registration and bootstrapping:
|
|
@@ -211,19 +250,28 @@ Route.get('/profile', handler).addMiddleware(authMiddleware);
|
|
|
211
250
|
|
|
212
251
|
### Controllers
|
|
213
252
|
|
|
214
|
-
MVC pattern with base controller:
|
|
253
|
+
MVC pattern with base controller and dependency injection:
|
|
215
254
|
|
|
216
255
|
```typescript
|
|
217
|
-
import { Controller, Request, Response, Route } from 'orchestr';
|
|
256
|
+
import { Injectable, Controller, Request, Response, Route } from 'orchestr';
|
|
218
257
|
|
|
258
|
+
// Use @Injectable() when injecting dependencies
|
|
259
|
+
@Injectable()
|
|
219
260
|
class UserController extends Controller {
|
|
261
|
+
// Services are automatically injected
|
|
262
|
+
constructor(private userService: UserService) {
|
|
263
|
+
super();
|
|
264
|
+
}
|
|
265
|
+
|
|
220
266
|
async index(req: Request, res: Response) {
|
|
221
|
-
|
|
267
|
+
const users = await this.userService.getAll();
|
|
268
|
+
return res.json({ users });
|
|
222
269
|
}
|
|
223
270
|
|
|
224
271
|
async show(req: Request, res: Response) {
|
|
225
272
|
const id = req.routeParam('id');
|
|
226
|
-
|
|
273
|
+
const user = await this.userService.findById(id);
|
|
274
|
+
return res.json({ user });
|
|
227
275
|
}
|
|
228
276
|
|
|
229
277
|
async store(req: Request, res: Response) {
|
|
@@ -231,7 +279,8 @@ class UserController extends Controller {
|
|
|
231
279
|
name: 'required',
|
|
232
280
|
email: 'required|email',
|
|
233
281
|
});
|
|
234
|
-
|
|
282
|
+
const user = await this.userService.create(validated);
|
|
283
|
+
return res.status(201).json({ user });
|
|
235
284
|
}
|
|
236
285
|
}
|
|
237
286
|
|
|
@@ -241,6 +290,8 @@ Route.get('/users/:id', [UserController, 'show']);
|
|
|
241
290
|
Route.post('/users', [UserController, 'store']);
|
|
242
291
|
```
|
|
243
292
|
|
|
293
|
+
**Note**: The `@Injectable()` decorator must be used on any class that needs constructor dependency injection. Without it, TypeScript won't emit the metadata needed for automatic resolution.
|
|
294
|
+
|
|
244
295
|
### Request
|
|
245
296
|
|
|
246
297
|
Powerful request helper methods:
|
|
@@ -398,9 +449,9 @@ await DB.table('users')
|
|
|
398
449
|
ActiveRecord ORM (Eloquent equivalent) with relationships and advanced features:
|
|
399
450
|
|
|
400
451
|
```typescript
|
|
401
|
-
import { Ensemble,
|
|
452
|
+
import { Ensemble, HasOne, HasMany, BelongsTo, softDeletes } from 'orchestr';
|
|
402
453
|
|
|
403
|
-
// Define
|
|
454
|
+
// Define models with relationships
|
|
404
455
|
class User extends Ensemble {
|
|
405
456
|
protected table = 'users';
|
|
406
457
|
protected fillable = ['name', 'email', 'password'];
|
|
@@ -409,12 +460,73 @@ class User extends Ensemble {
|
|
|
409
460
|
email_verified_at: 'datetime',
|
|
410
461
|
is_admin: 'boolean'
|
|
411
462
|
};
|
|
463
|
+
|
|
464
|
+
// One-to-One: User has one profile
|
|
465
|
+
profile(): HasOne<Profile, User> {
|
|
466
|
+
return this.hasOne(Profile);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// One-to-Many: User has many posts
|
|
470
|
+
posts(): HasMany<Post, User> {
|
|
471
|
+
return this.hasMany(Post);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
class Profile extends Ensemble {
|
|
476
|
+
protected table = 'profiles';
|
|
477
|
+
|
|
478
|
+
// Belongs To: Profile belongs to user
|
|
479
|
+
user(): BelongsTo<User, Profile> {
|
|
480
|
+
return this.belongsTo(User);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
class Post extends Ensemble {
|
|
485
|
+
protected table = 'posts';
|
|
486
|
+
|
|
487
|
+
// Belongs To: Post belongs to author (user)
|
|
488
|
+
author(): BelongsTo<User, Post> {
|
|
489
|
+
return this.belongsTo(User, 'user_id');
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// One-to-Many: Post has many comments
|
|
493
|
+
comments(): HasMany<Comment, Post> {
|
|
494
|
+
return this.hasMany(Comment);
|
|
495
|
+
}
|
|
412
496
|
}
|
|
413
497
|
|
|
414
498
|
// Query using the model
|
|
415
499
|
const users = await User.query().where('active', true).get();
|
|
416
500
|
const user = await User.query().find(1);
|
|
417
501
|
|
|
502
|
+
// Lazy loading relationships
|
|
503
|
+
await user.load('posts');
|
|
504
|
+
await user.load(['posts', 'profile']);
|
|
505
|
+
const posts = user.getRelation('posts');
|
|
506
|
+
|
|
507
|
+
// Eager loading (solves N+1 problem)
|
|
508
|
+
const users = await User.query()
|
|
509
|
+
.with(['posts.comments', 'profile'])
|
|
510
|
+
.get();
|
|
511
|
+
|
|
512
|
+
// Eager load with constraints
|
|
513
|
+
const users = await User.query()
|
|
514
|
+
.with({
|
|
515
|
+
posts: (query) => query.where('published', '=', true)
|
|
516
|
+
})
|
|
517
|
+
.get();
|
|
518
|
+
|
|
519
|
+
// Create related models
|
|
520
|
+
const post = await user.posts().create({
|
|
521
|
+
title: 'My Post',
|
|
522
|
+
content: 'Content here'
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
// Associate/dissociate (BelongsTo)
|
|
526
|
+
const post = new Post();
|
|
527
|
+
post.author().associate(user);
|
|
528
|
+
await post.save();
|
|
529
|
+
|
|
418
530
|
// Create
|
|
419
531
|
const user = new User();
|
|
420
532
|
user.name = 'John Doe';
|
|
@@ -435,37 +547,29 @@ await user.save();
|
|
|
435
547
|
// Delete
|
|
436
548
|
await user.delete();
|
|
437
549
|
|
|
438
|
-
// Mass assignment
|
|
439
|
-
await User.query().create({
|
|
440
|
-
name: 'John',
|
|
441
|
-
email: 'john@example.com'
|
|
442
|
-
});
|
|
443
|
-
|
|
444
550
|
// Soft deletes
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
class Post extends softDeletes(Ensemble) {
|
|
448
|
-
protected table = 'posts';
|
|
551
|
+
class Article extends softDeletes(Ensemble) {
|
|
552
|
+
protected table = 'articles';
|
|
449
553
|
}
|
|
450
554
|
|
|
451
|
-
const
|
|
452
|
-
await
|
|
453
|
-
await
|
|
454
|
-
await
|
|
555
|
+
const article = await Article.query().find(1);
|
|
556
|
+
await article.delete(); // Soft delete
|
|
557
|
+
await article.restore(); // Restore
|
|
558
|
+
await article.forceDelete(); // Permanent delete
|
|
455
559
|
|
|
456
560
|
// Query only non-deleted
|
|
457
|
-
const
|
|
561
|
+
const articles = await Article.query().get();
|
|
458
562
|
|
|
459
563
|
// Query with trashed
|
|
460
|
-
const
|
|
564
|
+
const allArticles = await Article.query().withTrashed().get();
|
|
461
565
|
|
|
462
566
|
// Query only trashed
|
|
463
|
-
const
|
|
567
|
+
const trashedArticles = await Article.query().onlyTrashed().get();
|
|
464
568
|
|
|
465
569
|
// Timestamps
|
|
466
570
|
// Automatically manages created_at and updated_at
|
|
467
|
-
class
|
|
468
|
-
protected table = '
|
|
571
|
+
class Post extends Ensemble {
|
|
572
|
+
protected table = 'posts';
|
|
469
573
|
public timestamps = true; // enabled by default
|
|
470
574
|
}
|
|
471
575
|
|
|
@@ -494,6 +598,8 @@ console.log(user.full_name); // Uses accessor
|
|
|
494
598
|
user.password = 'secret123'; // Uses mutator
|
|
495
599
|
```
|
|
496
600
|
|
|
601
|
+
**See [RELATIONSHIPS.md](./RELATIONSHIPS.md) for complete relationship documentation.**
|
|
602
|
+
|
|
497
603
|
### Database Setup
|
|
498
604
|
|
|
499
605
|
Configure multiple database connections:
|
|
@@ -565,7 +671,8 @@ kernel.listen(3000);
|
|
|
565
671
|
|
|
566
672
|
**app/Models/User.ts**
|
|
567
673
|
```typescript
|
|
568
|
-
import { Ensemble, softDeletes } from 'orchestr';
|
|
674
|
+
import { Ensemble, HasMany, softDeletes } from 'orchestr';
|
|
675
|
+
import { Post } from './Post';
|
|
569
676
|
|
|
570
677
|
export class User extends softDeletes(Ensemble) {
|
|
571
678
|
protected table = 'users';
|
|
@@ -576,6 +683,26 @@ export class User extends softDeletes(Ensemble) {
|
|
|
576
683
|
email_verified_at: 'datetime',
|
|
577
684
|
is_admin: 'boolean'
|
|
578
685
|
};
|
|
686
|
+
|
|
687
|
+
// Define relationship
|
|
688
|
+
posts(): HasMany<Post, User> {
|
|
689
|
+
return this.hasMany(Post);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
**app/Models/Post.ts**
|
|
695
|
+
```typescript
|
|
696
|
+
import { Ensemble, BelongsTo } from 'orchestr';
|
|
697
|
+
import { User } from './User';
|
|
698
|
+
|
|
699
|
+
export class Post extends Ensemble {
|
|
700
|
+
protected table = 'posts';
|
|
701
|
+
protected fillable = ['user_id', 'title', 'content', 'published_at'];
|
|
702
|
+
|
|
703
|
+
author(): BelongsTo<User, Post> {
|
|
704
|
+
return this.belongsTo(User, 'user_id');
|
|
705
|
+
}
|
|
579
706
|
}
|
|
580
707
|
```
|
|
581
708
|
|
|
@@ -595,15 +722,17 @@ Route.group({ prefix: 'api' }, () => {
|
|
|
595
722
|
return res.json({ users });
|
|
596
723
|
});
|
|
597
724
|
|
|
598
|
-
// Using Ensemble ORM
|
|
725
|
+
// Using Ensemble ORM with eager loading
|
|
599
726
|
Route.get('/users/:id', async (req, res) => {
|
|
600
|
-
const user = await User.query()
|
|
727
|
+
const user = await User.query()
|
|
728
|
+
.with('posts')
|
|
729
|
+
.find(req.routeParam('id'));
|
|
601
730
|
|
|
602
731
|
if (!user) {
|
|
603
732
|
return res.status(404).json({ message: 'User not found' });
|
|
604
733
|
}
|
|
605
734
|
|
|
606
|
-
return res.json({ user });
|
|
735
|
+
return res.json({ user: user.toObject() });
|
|
607
736
|
});
|
|
608
737
|
|
|
609
738
|
Route.post('/users', async (req, res) => {
|
|
@@ -653,9 +782,15 @@ src/
|
|
|
653
782
|
│ │ ├── EnsembleBuilder.ts # Model query builder
|
|
654
783
|
│ │ ├── EnsembleCollection.ts # Model collection
|
|
655
784
|
│ │ ├── SoftDeletes.ts # Soft delete trait
|
|
785
|
+
│ │ ├── Relations/
|
|
786
|
+
│ │ │ ├── Relation.ts # Base relation class
|
|
787
|
+
│ │ │ ├── HasOne.ts # One-to-one relationship
|
|
788
|
+
│ │ │ ├── HasMany.ts # One-to-many relationship
|
|
789
|
+
│ │ │ └── BelongsTo.ts # Inverse relationship
|
|
656
790
|
│ │ └── Concerns/
|
|
657
791
|
│ │ ├── HasAttributes.ts # Attribute handling & casting
|
|
658
|
-
│ │
|
|
792
|
+
│ │ ├── HasTimestamps.ts # Timestamp management
|
|
793
|
+
│ │ └── HasRelationships.ts # Relationship functionality
|
|
659
794
|
│ ├── Adapters/
|
|
660
795
|
│ │ └── DrizzleAdapter.ts # Drizzle ORM adapter
|
|
661
796
|
│ └── DatabaseServiceProvider.ts
|
|
@@ -695,7 +830,11 @@ Core components completed and in progress:
|
|
|
695
830
|
- [x] Multi-connection Database Manager
|
|
696
831
|
- [x] Soft Deletes
|
|
697
832
|
- [x] Model Attributes & Casting
|
|
698
|
-
- [
|
|
833
|
+
- [x] Model Relationships (HasOne, HasMany, BelongsTo)
|
|
834
|
+
- [x] Eager/Lazy Loading
|
|
835
|
+
- [ ] Many-to-Many Relationships (BelongsToMany)
|
|
836
|
+
- [ ] Relationship Queries (has, whereHas, withCount)
|
|
837
|
+
- [ ] Polymorphic Relationships
|
|
699
838
|
- [ ] Database Migrations
|
|
700
839
|
- [ ] Database Seeding
|
|
701
840
|
- [ ] Validation System
|
|
@@ -725,7 +864,10 @@ Core components completed and in progress:
|
|
|
725
864
|
| Soft Deletes | ✅ | ✅ |
|
|
726
865
|
| Timestamps | ✅ | ✅ |
|
|
727
866
|
| Attribute Casting | ✅ | ✅ |
|
|
728
|
-
|
|
|
867
|
+
| Basic Relationships | ✅ | ✅ |
|
|
868
|
+
| Eager/Lazy Loading | ✅ | ✅ |
|
|
869
|
+
| Many-to-Many | ✅ | 🚧 |
|
|
870
|
+
| Polymorphic Relations | ✅ | 🚧 |
|
|
729
871
|
| Migrations | ✅ | 🚧 |
|
|
730
872
|
| Seeding | ✅ | 🚧 |
|
|
731
873
|
| Validation | ✅ | 🚧 |
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HasRelationships Concern
|
|
3
|
+
*
|
|
4
|
+
* Provides relationship functionality to Ensemble models
|
|
5
|
+
*/
|
|
6
|
+
import { Ensemble } from '../Ensemble';
|
|
7
|
+
import { EnsembleBuilder } from '../EnsembleBuilder';
|
|
8
|
+
import { HasOne } from '../Relations/HasOne';
|
|
9
|
+
import { HasMany } from '../Relations/HasMany';
|
|
10
|
+
import { BelongsTo } from '../Relations/BelongsTo';
|
|
11
|
+
export interface RelationshipConfig {
|
|
12
|
+
type: 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany' | 'hasOneThrough' | 'hasManyThrough' | 'morphTo' | 'morphMany' | 'morphOne' | 'morphToMany' | 'morphedByMany';
|
|
13
|
+
related: string;
|
|
14
|
+
foreignKey?: string;
|
|
15
|
+
localKey?: string;
|
|
16
|
+
relation?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare abstract class HasRelationshipsMixin {
|
|
19
|
+
/**
|
|
20
|
+
* The loaded relationships for the model
|
|
21
|
+
*/
|
|
22
|
+
protected relations: Record<string, any>;
|
|
23
|
+
/**
|
|
24
|
+
* Define a one-to-one relationship
|
|
25
|
+
*/
|
|
26
|
+
protected hasOne<TRelated extends Ensemble>(related: new () => TRelated, foreignKey?: string, localKey?: string): HasOne<TRelated, any>;
|
|
27
|
+
/**
|
|
28
|
+
* Define a one-to-many relationship
|
|
29
|
+
*/
|
|
30
|
+
protected hasMany<TRelated extends Ensemble>(related: new () => TRelated, foreignKey?: string, localKey?: string): HasMany<TRelated, any>;
|
|
31
|
+
/**
|
|
32
|
+
* Define an inverse one-to-one or many relationship
|
|
33
|
+
*/
|
|
34
|
+
protected belongsTo<TRelated extends Ensemble>(related: new () => TRelated, foreignKey?: string, ownerKey?: string, relation?: string): BelongsTo<TRelated, any>;
|
|
35
|
+
/**
|
|
36
|
+
* Get the default foreign key name for the model
|
|
37
|
+
*/
|
|
38
|
+
protected getForeignKey(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get a relationship value from a method
|
|
41
|
+
*/
|
|
42
|
+
protected getRelationshipFromMethod(method: string): any;
|
|
43
|
+
/**
|
|
44
|
+
* Get a relationship instance by name
|
|
45
|
+
*/
|
|
46
|
+
getRelation(relation: string): any;
|
|
47
|
+
/**
|
|
48
|
+
* Set the given relationship on the model
|
|
49
|
+
*/
|
|
50
|
+
setRelation(relation: string, value: any): this;
|
|
51
|
+
/**
|
|
52
|
+
* Unset a loaded relationship
|
|
53
|
+
*/
|
|
54
|
+
unsetRelation(relation: string): this;
|
|
55
|
+
/**
|
|
56
|
+
* Get all the loaded relations for the instance
|
|
57
|
+
*/
|
|
58
|
+
getRelations(): Record<string, any>;
|
|
59
|
+
/**
|
|
60
|
+
* Set the entire relations array on the model
|
|
61
|
+
*/
|
|
62
|
+
setRelations(relations: Record<string, any>): this;
|
|
63
|
+
/**
|
|
64
|
+
* Determine if the given relation is loaded
|
|
65
|
+
*/
|
|
66
|
+
relationLoaded(key: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Load a relationship if it hasn't been loaded yet
|
|
69
|
+
*/
|
|
70
|
+
load(relations: string | string[]): Promise<this>;
|
|
71
|
+
/**
|
|
72
|
+
* Eager load relations on the model
|
|
73
|
+
*/
|
|
74
|
+
loadMissing(relations: string | string[]): Promise<this>;
|
|
75
|
+
/**
|
|
76
|
+
* Touch the owning relations of the model
|
|
77
|
+
*/
|
|
78
|
+
touch(): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* Create a new model query instance for the model
|
|
81
|
+
*/
|
|
82
|
+
protected abstract newQuery(): EnsembleBuilder<any>;
|
|
83
|
+
/**
|
|
84
|
+
* Get the table name (from Ensemble)
|
|
85
|
+
*/
|
|
86
|
+
protected abstract getTable(): string;
|
|
87
|
+
/**
|
|
88
|
+
* Get the primary key name (from Ensemble)
|
|
89
|
+
*/
|
|
90
|
+
protected abstract getKeyName(): string;
|
|
91
|
+
/**
|
|
92
|
+
* Convert a string to snake case
|
|
93
|
+
*/
|
|
94
|
+
protected snake(value: string): string;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=HasRelationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HasRelationships.d.ts","sourceRoot":"","sources":["../../../../src/Database/Ensemble/Concerns/HasRelationships.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,eAAe,GAAG,eAAe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GAAG,IAAI;IAKtD;;OAEG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAK5C;;OAEG;IACI,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI1C;;OAEG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAKzD;;OAEG;IACI,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI3C;;OAEG;IACU,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAa9D;;OAEG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrE;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;IAKtC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,eAAe,CAAC,GAAG,CAAC;IAEnD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAErC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAEvC;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAMvC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* HasRelationships Concern
|
|
4
|
+
*
|
|
5
|
+
* Provides relationship functionality to Ensemble models
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.HasRelationshipsMixin = void 0;
|
|
9
|
+
const Relation_1 = require("../Relations/Relation");
|
|
10
|
+
const HasOne_1 = require("../Relations/HasOne");
|
|
11
|
+
const HasMany_1 = require("../Relations/HasMany");
|
|
12
|
+
const BelongsTo_1 = require("../Relations/BelongsTo");
|
|
13
|
+
class HasRelationshipsMixin {
|
|
14
|
+
/**
|
|
15
|
+
* The loaded relationships for the model
|
|
16
|
+
*/
|
|
17
|
+
relations = {};
|
|
18
|
+
/**
|
|
19
|
+
* Define a one-to-one relationship
|
|
20
|
+
*/
|
|
21
|
+
hasOne(related, foreignKey, localKey) {
|
|
22
|
+
const instance = new related();
|
|
23
|
+
const finalForeignKey = foreignKey || this.getForeignKey();
|
|
24
|
+
const finalLocalKey = localKey || this.getKeyName();
|
|
25
|
+
return new HasOne_1.HasOne(instance.newQuery(), this, finalForeignKey, finalLocalKey);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Define a one-to-many relationship
|
|
29
|
+
*/
|
|
30
|
+
hasMany(related, foreignKey, localKey) {
|
|
31
|
+
const instance = new related();
|
|
32
|
+
const finalForeignKey = foreignKey || this.getForeignKey();
|
|
33
|
+
const finalLocalKey = localKey || this.getKeyName();
|
|
34
|
+
return new HasMany_1.HasMany(instance.newQuery(), this, finalForeignKey, finalLocalKey);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Define an inverse one-to-one or many relationship
|
|
38
|
+
*/
|
|
39
|
+
belongsTo(related, foreignKey, ownerKey, relation) {
|
|
40
|
+
const instance = new related();
|
|
41
|
+
const relationName = relation || this.snake(instance.constructor.name);
|
|
42
|
+
if (!foreignKey) {
|
|
43
|
+
foreignKey = this.snake(relationName) + '_' + instance.getKeyName();
|
|
44
|
+
}
|
|
45
|
+
const finalOwnerKey = ownerKey || instance.getKeyName();
|
|
46
|
+
return new BelongsTo_1.BelongsTo(instance.newQuery(), this, foreignKey, finalOwnerKey, relationName);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the default foreign key name for the model
|
|
50
|
+
*/
|
|
51
|
+
getForeignKey() {
|
|
52
|
+
return this.snake(this.constructor.name) + '_' + this.getKeyName();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get a relationship value from a method
|
|
56
|
+
*/
|
|
57
|
+
getRelationshipFromMethod(method) {
|
|
58
|
+
const relation = this[method]();
|
|
59
|
+
if (!(relation instanceof Relation_1.Relation)) {
|
|
60
|
+
throw new Error(`Relationship method must return an object of type Relation (${method})`);
|
|
61
|
+
}
|
|
62
|
+
return relation;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get a relationship instance by name
|
|
66
|
+
*/
|
|
67
|
+
getRelation(relation) {
|
|
68
|
+
return this.relations[relation];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Set the given relationship on the model
|
|
72
|
+
*/
|
|
73
|
+
setRelation(relation, value) {
|
|
74
|
+
this.relations[relation] = value;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Unset a loaded relationship
|
|
79
|
+
*/
|
|
80
|
+
unsetRelation(relation) {
|
|
81
|
+
delete this.relations[relation];
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get all the loaded relations for the instance
|
|
86
|
+
*/
|
|
87
|
+
getRelations() {
|
|
88
|
+
return this.relations;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Set the entire relations array on the model
|
|
92
|
+
*/
|
|
93
|
+
setRelations(relations) {
|
|
94
|
+
this.relations = relations;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Determine if the given relation is loaded
|
|
99
|
+
*/
|
|
100
|
+
relationLoaded(key) {
|
|
101
|
+
return key in this.relations;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Load a relationship if it hasn't been loaded yet
|
|
105
|
+
*/
|
|
106
|
+
async load(relations) {
|
|
107
|
+
const relationArray = Array.isArray(relations) ? relations : [relations];
|
|
108
|
+
for (const relation of relationArray) {
|
|
109
|
+
if (!this.relationLoaded(relation)) {
|
|
110
|
+
const results = await this.getRelationshipFromMethod(relation).getResults();
|
|
111
|
+
this.setRelation(relation, results);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Eager load relations on the model
|
|
118
|
+
*/
|
|
119
|
+
async loadMissing(relations) {
|
|
120
|
+
const relationArray = Array.isArray(relations) ? relations : [relations];
|
|
121
|
+
const missing = relationArray.filter(relation => !this.relationLoaded(relation));
|
|
122
|
+
if (missing.length > 0) {
|
|
123
|
+
await this.load(missing);
|
|
124
|
+
}
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Touch the owning relations of the model
|
|
129
|
+
*/
|
|
130
|
+
async touch() {
|
|
131
|
+
// TODO: Implement when we have timestamps
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Convert a string to snake case
|
|
136
|
+
*/
|
|
137
|
+
snake(value) {
|
|
138
|
+
return value
|
|
139
|
+
.replace(/([A-Z])/g, '_$1')
|
|
140
|
+
.toLowerCase()
|
|
141
|
+
.replace(/^_/, '');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.HasRelationshipsMixin = HasRelationshipsMixin;
|
|
145
|
+
//# sourceMappingURL=HasRelationships.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HasRelationships.js","sourceRoot":"","sources":["../../../../src/Database/Ensemble/Concerns/HasRelationships.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,oDAAiD;AACjD,gDAA6C;AAC7C,kDAA+C;AAC/C,sDAAmD;AAUnD,MAAsB,qBAAqB;IACzC;;OAEG;IACO,SAAS,GAAwB,EAAE,CAAC;IAE9C;;OAEG;IACO,MAAM,CACd,OAA2B,EAC3B,UAAmB,EACnB,QAAiB;QAEjB,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAE,CAAC;QAE/B,MAAM,eAAe,GAAG,UAAU,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QAC3D,MAAM,aAAa,GAAG,Q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Q,CAAC,EAAE,CAAC;gBACnC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,CAAC;gBAC5E,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QAED,OAAO,IAAW,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,SAA4B;QACnD,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACzE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEjF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QAED,OAAO,IAAW,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,KAAK;QAChB,0CAA0C;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAiBD;;OAEG;IACO,KAAK,CAAC,KAAa;QAC3B,OAAO,KAAK;aACT,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;aAC1B,WAAW,EAAE;aACb,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvB,CAAC;CACF;AA5MD,sDA4MC"}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import { DatabaseManager } from '../DatabaseManager';
|
|
8
8
|
import { Connection } from '../Connection';
|
|
9
9
|
import { EnsembleBuilder } from './EnsembleBuilder';
|
|
10
|
-
|
|
10
|
+
import { HasRelationshipsMixin } from './Concerns/HasRelationships';
|
|
11
|
+
export declare abstract class Ensemble extends HasRelationshipsMixin {
|
|
11
12
|
/**
|
|
12
13
|
* The connection resolver instance
|
|
13
14
|
*/
|
|
@@ -262,5 +263,21 @@ export declare abstract class Ensemble {
|
|
|
262
263
|
* Pluralize a string (simple implementation)
|
|
263
264
|
*/
|
|
264
265
|
protected pluralize(value: string): string;
|
|
266
|
+
/**
|
|
267
|
+
* Create a new query instance for the model
|
|
268
|
+
*/
|
|
269
|
+
newQuery(): EnsembleBuilder<any>;
|
|
270
|
+
/**
|
|
271
|
+
* Create a new instance of the given model
|
|
272
|
+
*/
|
|
273
|
+
newInstance(attributes?: Record<string, any>, exists?: boolean): this;
|
|
274
|
+
/**
|
|
275
|
+
* Get the name of the "updated at" column
|
|
276
|
+
*/
|
|
277
|
+
getUpdatedAtColumn(): string | null;
|
|
278
|
+
/**
|
|
279
|
+
* Get the name of the "created at" column
|
|
280
|
+
*/
|
|
281
|
+
getCreatedAtColumn(): string | null;
|
|
265
282
|
}
|
|
266
283
|
//# sourceMappingURL=Ensemble.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ensemble.d.ts","sourceRoot":"","sources":["../../../src/Database/Ensemble/Ensemble.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Ensemble.d.ts","sourceRoot":"","sources":["../../../src/Database/Ensemble/Ensemble.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,8BAAsB,QAAS,SAAQ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