@orchestr-sh/orchestr 1.3.0 → 1.4.2
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 +181 -36
- 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/Foundation/Http/FormRequest.d.ts +119 -0
- package/dist/Foundation/Http/FormRequest.d.ts.map +1 -0
- package/dist/Foundation/Http/FormRequest.js +180 -0
- package/dist/Foundation/Http/FormRequest.js.map +1 -0
- package/dist/Foundation/Http/ValidationException.d.ts +39 -0
- package/dist/Foundation/Http/ValidationException.d.ts.map +1 -0
- package/dist/Foundation/Http/ValidationException.js +59 -0
- package/dist/Foundation/Http/ValidationException.js.map +1 -0
- package/dist/Foundation/Http/Validator.d.ts +80 -0
- package/dist/Foundation/Http/Validator.d.ts.map +1 -0
- package/dist/Foundation/Http/Validator.js +325 -0
- package/dist/Foundation/Http/Validator.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -12,9 +12,10 @@ Built from the ground up with Laravel's core components:
|
|
|
12
12
|
- **Request/Response** - Elegant HTTP abstractions
|
|
13
13
|
- **Middleware** - Global and route-level middleware pipeline
|
|
14
14
|
- **Controllers** - MVC architecture support
|
|
15
|
+
- **FormRequest** - Laravel-style validation and authorization
|
|
15
16
|
- **Facades** - Static proxy access to services (Route, DB)
|
|
16
17
|
- **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
|
|
18
|
+
- **Ensemble ORM** - ActiveRecord ORM (Laravel's Eloquent equivalent) with relationships (HasOne, HasMany, BelongsTo), eager/lazy loading, soft deletes, and more
|
|
18
19
|
- **Database Manager** - Multi-connection database management
|
|
19
20
|
- **Application Lifecycle** - Complete Laravel bootstrap process
|
|
20
21
|
|
|
@@ -26,11 +27,6 @@ npm install @orchestr-sh/orchestr reflect-metadata
|
|
|
26
27
|
|
|
27
28
|
**Note**: `reflect-metadata` is required for dependency injection to work.
|
|
28
29
|
|
|
29
|
-
## Documentation
|
|
30
|
-
|
|
31
|
-
- **[Dependency Injection Guide](./DEPENDENCY_INJECTION.md)** - Complete guide to using DI with troubleshooting
|
|
32
|
-
- **[DI Example](./examples/dependency-injection/)** - Working example with services and controllers
|
|
33
|
-
|
|
34
30
|
## Quick Start
|
|
35
31
|
|
|
36
32
|
```typescript
|
|
@@ -253,6 +249,64 @@ const authMiddleware = async (req, res, next) => {
|
|
|
253
249
|
Route.get('/profile', handler).addMiddleware(authMiddleware);
|
|
254
250
|
```
|
|
255
251
|
|
|
252
|
+
### FormRequest Validation
|
|
253
|
+
|
|
254
|
+
Laravel-style FormRequest for clean validation and authorization:
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
import { FormRequest, ValidationRules, ValidationException, Route, Request, Response } from 'orchestr';
|
|
258
|
+
|
|
259
|
+
// Create a FormRequest class
|
|
260
|
+
export class StoreUserRequest extends FormRequest {
|
|
261
|
+
// Authorize the request
|
|
262
|
+
protected authorize(): boolean {
|
|
263
|
+
return this.request.header('authorization') !== undefined;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Define validation rules
|
|
267
|
+
protected rules(): ValidationRules {
|
|
268
|
+
return {
|
|
269
|
+
name: 'required|string|min:3|max:255',
|
|
270
|
+
email: 'required|email',
|
|
271
|
+
password: 'required|string|min:8|confirmed',
|
|
272
|
+
age: 'numeric|min:18|max:120',
|
|
273
|
+
role: 'required|in:user,admin,moderator',
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Custom error messages
|
|
278
|
+
protected messages(): Record<string, string> {
|
|
279
|
+
return {
|
|
280
|
+
'name.required': 'Please provide your full name.',
|
|
281
|
+
'email.email': 'Please provide a valid email address.',
|
|
282
|
+
'password.min': 'Password must be at least 8 characters.',
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Use in routes
|
|
288
|
+
Route.post('/users', async (req: Request, res: Response) => {
|
|
289
|
+
try {
|
|
290
|
+
// Validate request (checks authorization AND validation)
|
|
291
|
+
const formRequest = await StoreUserRequest.validate(StoreUserRequest, req, res);
|
|
292
|
+
|
|
293
|
+
// Get validated data only
|
|
294
|
+
const validated = formRequest.validated();
|
|
295
|
+
|
|
296
|
+
// Create user with safe, validated data
|
|
297
|
+
const user = await User.create(validated);
|
|
298
|
+
|
|
299
|
+
return res.status(201).json({ user });
|
|
300
|
+
} catch (error) {
|
|
301
|
+
// Validation/authorization errors already handled
|
|
302
|
+
if (error instanceof ValidationException) return;
|
|
303
|
+
throw error;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**See [FORM_REQUESTS.md](./FORM_REQUESTS.md) for complete documentation.**
|
|
309
|
+
|
|
256
310
|
### Controllers
|
|
257
311
|
|
|
258
312
|
MVC pattern with base controller and dependency injection:
|
|
@@ -454,9 +508,9 @@ await DB.table('users')
|
|
|
454
508
|
ActiveRecord ORM (Eloquent equivalent) with relationships and advanced features:
|
|
455
509
|
|
|
456
510
|
```typescript
|
|
457
|
-
import { Ensemble,
|
|
511
|
+
import { Ensemble, HasOne, HasMany, BelongsTo, softDeletes } from 'orchestr';
|
|
458
512
|
|
|
459
|
-
// Define
|
|
513
|
+
// Define models with relationships
|
|
460
514
|
class User extends Ensemble {
|
|
461
515
|
protected table = 'users';
|
|
462
516
|
protected fillable = ['name', 'email', 'password'];
|
|
@@ -465,12 +519,73 @@ class User extends Ensemble {
|
|
|
465
519
|
email_verified_at: 'datetime',
|
|
466
520
|
is_admin: 'boolean'
|
|
467
521
|
};
|
|
522
|
+
|
|
523
|
+
// One-to-One: User has one profile
|
|
524
|
+
profile(): HasOne<Profile, User> {
|
|
525
|
+
return this.hasOne(Profile);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// One-to-Many: User has many posts
|
|
529
|
+
posts(): HasMany<Post, User> {
|
|
530
|
+
return this.hasMany(Post);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
class Profile extends Ensemble {
|
|
535
|
+
protected table = 'profiles';
|
|
536
|
+
|
|
537
|
+
// Belongs To: Profile belongs to user
|
|
538
|
+
user(): BelongsTo<User, Profile> {
|
|
539
|
+
return this.belongsTo(User);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
class Post extends Ensemble {
|
|
544
|
+
protected table = 'posts';
|
|
545
|
+
|
|
546
|
+
// Belongs To: Post belongs to author (user)
|
|
547
|
+
author(): BelongsTo<User, Post> {
|
|
548
|
+
return this.belongsTo(User, 'user_id');
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// One-to-Many: Post has many comments
|
|
552
|
+
comments(): HasMany<Comment, Post> {
|
|
553
|
+
return this.hasMany(Comment);
|
|
554
|
+
}
|
|
468
555
|
}
|
|
469
556
|
|
|
470
557
|
// Query using the model
|
|
471
558
|
const users = await User.query().where('active', true).get();
|
|
472
559
|
const user = await User.query().find(1);
|
|
473
560
|
|
|
561
|
+
// Lazy loading relationships
|
|
562
|
+
await user.load('posts');
|
|
563
|
+
await user.load(['posts', 'profile']);
|
|
564
|
+
const posts = user.getRelation('posts');
|
|
565
|
+
|
|
566
|
+
// Eager loading (solves N+1 problem)
|
|
567
|
+
const users = await User.query()
|
|
568
|
+
.with(['posts.comments', 'profile'])
|
|
569
|
+
.get();
|
|
570
|
+
|
|
571
|
+
// Eager load with constraints
|
|
572
|
+
const users = await User.query()
|
|
573
|
+
.with({
|
|
574
|
+
posts: (query) => query.where('published', '=', true)
|
|
575
|
+
})
|
|
576
|
+
.get();
|
|
577
|
+
|
|
578
|
+
// Create related models
|
|
579
|
+
const post = await user.posts().create({
|
|
580
|
+
title: 'My Post',
|
|
581
|
+
content: 'Content here'
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
// Associate/dissociate (BelongsTo)
|
|
585
|
+
const post = new Post();
|
|
586
|
+
post.author().associate(user);
|
|
587
|
+
await post.save();
|
|
588
|
+
|
|
474
589
|
// Create
|
|
475
590
|
const user = new User();
|
|
476
591
|
user.name = 'John Doe';
|
|
@@ -491,37 +606,29 @@ await user.save();
|
|
|
491
606
|
// Delete
|
|
492
607
|
await user.delete();
|
|
493
608
|
|
|
494
|
-
// Mass assignment
|
|
495
|
-
await User.query().create({
|
|
496
|
-
name: 'John',
|
|
497
|
-
email: 'john@example.com'
|
|
498
|
-
});
|
|
499
|
-
|
|
500
609
|
// Soft deletes
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
class Post extends softDeletes(Ensemble) {
|
|
504
|
-
protected table = 'posts';
|
|
610
|
+
class Article extends softDeletes(Ensemble) {
|
|
611
|
+
protected table = 'articles';
|
|
505
612
|
}
|
|
506
613
|
|
|
507
|
-
const
|
|
508
|
-
await
|
|
509
|
-
await
|
|
510
|
-
await
|
|
614
|
+
const article = await Article.query().find(1);
|
|
615
|
+
await article.delete(); // Soft delete
|
|
616
|
+
await article.restore(); // Restore
|
|
617
|
+
await article.forceDelete(); // Permanent delete
|
|
511
618
|
|
|
512
619
|
// Query only non-deleted
|
|
513
|
-
const
|
|
620
|
+
const articles = await Article.query().get();
|
|
514
621
|
|
|
515
622
|
// Query with trashed
|
|
516
|
-
const
|
|
623
|
+
const allArticles = await Article.query().withTrashed().get();
|
|
517
624
|
|
|
518
625
|
// Query only trashed
|
|
519
|
-
const
|
|
626
|
+
const trashedArticles = await Article.query().onlyTrashed().get();
|
|
520
627
|
|
|
521
628
|
// Timestamps
|
|
522
629
|
// Automatically manages created_at and updated_at
|
|
523
|
-
class
|
|
524
|
-
protected table = '
|
|
630
|
+
class Post extends Ensemble {
|
|
631
|
+
protected table = 'posts';
|
|
525
632
|
public timestamps = true; // enabled by default
|
|
526
633
|
}
|
|
527
634
|
|
|
@@ -550,6 +657,8 @@ console.log(user.full_name); // Uses accessor
|
|
|
550
657
|
user.password = 'secret123'; // Uses mutator
|
|
551
658
|
```
|
|
552
659
|
|
|
660
|
+
**See [RELATIONSHIPS.md](./RELATIONSHIPS.md) for complete relationship documentation.**
|
|
661
|
+
|
|
553
662
|
### Database Setup
|
|
554
663
|
|
|
555
664
|
Configure multiple database connections:
|
|
@@ -621,7 +730,8 @@ kernel.listen(3000);
|
|
|
621
730
|
|
|
622
731
|
**app/Models/User.ts**
|
|
623
732
|
```typescript
|
|
624
|
-
import { Ensemble, softDeletes } from 'orchestr';
|
|
733
|
+
import { Ensemble, HasMany, softDeletes } from 'orchestr';
|
|
734
|
+
import { Post } from './Post';
|
|
625
735
|
|
|
626
736
|
export class User extends softDeletes(Ensemble) {
|
|
627
737
|
protected table = 'users';
|
|
@@ -632,6 +742,26 @@ export class User extends softDeletes(Ensemble) {
|
|
|
632
742
|
email_verified_at: 'datetime',
|
|
633
743
|
is_admin: 'boolean'
|
|
634
744
|
};
|
|
745
|
+
|
|
746
|
+
// Define relationship
|
|
747
|
+
posts(): HasMany<Post, User> {
|
|
748
|
+
return this.hasMany(Post);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
**app/Models/Post.ts**
|
|
754
|
+
```typescript
|
|
755
|
+
import { Ensemble, BelongsTo } from 'orchestr';
|
|
756
|
+
import { User } from './User';
|
|
757
|
+
|
|
758
|
+
export class Post extends Ensemble {
|
|
759
|
+
protected table = 'posts';
|
|
760
|
+
protected fillable = ['user_id', 'title', 'content', 'published_at'];
|
|
761
|
+
|
|
762
|
+
author(): BelongsTo<User, Post> {
|
|
763
|
+
return this.belongsTo(User, 'user_id');
|
|
764
|
+
}
|
|
635
765
|
}
|
|
636
766
|
```
|
|
637
767
|
|
|
@@ -651,15 +781,17 @@ Route.group({ prefix: 'api' }, () => {
|
|
|
651
781
|
return res.json({ users });
|
|
652
782
|
});
|
|
653
783
|
|
|
654
|
-
// Using Ensemble ORM
|
|
784
|
+
// Using Ensemble ORM with eager loading
|
|
655
785
|
Route.get('/users/:id', async (req, res) => {
|
|
656
|
-
const user = await User.query()
|
|
786
|
+
const user = await User.query()
|
|
787
|
+
.with('posts')
|
|
788
|
+
.find(req.routeParam('id'));
|
|
657
789
|
|
|
658
790
|
if (!user) {
|
|
659
791
|
return res.status(404).json({ message: 'User not found' });
|
|
660
792
|
}
|
|
661
793
|
|
|
662
|
-
return res.json({ user });
|
|
794
|
+
return res.json({ user: user.toObject() });
|
|
663
795
|
});
|
|
664
796
|
|
|
665
797
|
Route.post('/users', async (req, res) => {
|
|
@@ -709,9 +841,15 @@ src/
|
|
|
709
841
|
│ │ ├── EnsembleBuilder.ts # Model query builder
|
|
710
842
|
│ │ ├── EnsembleCollection.ts # Model collection
|
|
711
843
|
│ │ ├── SoftDeletes.ts # Soft delete trait
|
|
844
|
+
│ │ ├── Relations/
|
|
845
|
+
│ │ │ ├── Relation.ts # Base relation class
|
|
846
|
+
│ │ │ ├── HasOne.ts # One-to-one relationship
|
|
847
|
+
│ │ │ ├── HasMany.ts # One-to-many relationship
|
|
848
|
+
│ │ │ └── BelongsTo.ts # Inverse relationship
|
|
712
849
|
│ │ └── Concerns/
|
|
713
850
|
│ │ ├── HasAttributes.ts # Attribute handling & casting
|
|
714
|
-
│ │
|
|
851
|
+
│ │ ├── HasTimestamps.ts # Timestamp management
|
|
852
|
+
│ │ └── HasRelationships.ts # Relationship functionality
|
|
715
853
|
│ ├── Adapters/
|
|
716
854
|
│ │ └── DrizzleAdapter.ts # Drizzle ORM adapter
|
|
717
855
|
│ └── DatabaseServiceProvider.ts
|
|
@@ -751,10 +889,14 @@ Core components completed and in progress:
|
|
|
751
889
|
- [x] Multi-connection Database Manager
|
|
752
890
|
- [x] Soft Deletes
|
|
753
891
|
- [x] Model Attributes & Casting
|
|
754
|
-
- [
|
|
892
|
+
- [x] Model Relationships (HasOne, HasMany, BelongsTo)
|
|
893
|
+
- [x] Eager/Lazy Loading
|
|
894
|
+
- [x] FormRequest Validation & Authorization
|
|
895
|
+
- [ ] Many-to-Many Relationships (BelongsToMany)
|
|
896
|
+
- [ ] Relationship Queries (has, whereHas, withCount)
|
|
897
|
+
- [ ] Polymorphic Relationships
|
|
755
898
|
- [ ] Database Migrations
|
|
756
899
|
- [ ] Database Seeding
|
|
757
|
-
- [ ] Validation System
|
|
758
900
|
- [ ] Authentication & Authorization
|
|
759
901
|
- [ ] Queue System
|
|
760
902
|
- [ ] Events & Listeners
|
|
@@ -781,10 +923,13 @@ Core components completed and in progress:
|
|
|
781
923
|
| Soft Deletes | ✅ | ✅ |
|
|
782
924
|
| Timestamps | ✅ | ✅ |
|
|
783
925
|
| Attribute Casting | ✅ | ✅ |
|
|
784
|
-
|
|
|
926
|
+
| Basic Relationships | ✅ | ✅ |
|
|
927
|
+
| Eager/Lazy Loading | ✅ | ✅ |
|
|
928
|
+
| Many-to-Many | ✅ | 🚧 |
|
|
929
|
+
| Polymorphic Relations | ✅ | 🚧 |
|
|
785
930
|
| Migrations | ✅ | 🚧 |
|
|
786
931
|
| Seeding | ✅ | 🚧 |
|
|
787
|
-
| Validation | ✅ |
|
|
932
|
+
| FormRequest Validation | ✅ | ✅ |
|
|
788
933
|
| Authentication | ✅ | 🚧 |
|
|
789
934
|
| Authorization | ✅ | 🚧 |
|
|
790
935
|
| Events | ✅ | 🚧 |
|
|
@@ -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,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ides 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,sDA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B,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/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