1 | import { Count, DataObject, Entity, EntityCrudRepository, Filter, Getter, Options, TypeResolver, Where } from '../..';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export interface HasManyThroughRepository<Target extends Entity, TargetID, Through extends Entity> {
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | create(targetModelData: DataObject<Target>, options?: Options & {
|
18 | throughData?: DataObject<Through>;
|
19 | throughOptions?: Options;
|
20 | } & {
|
21 | polymorphicType?: string;
|
22 | }): Promise<Target>;
|
23 | |
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | find(filter?: Filter<Target>, options?: Options & {
|
35 | throughOptions?: Options & {
|
36 | discriminator?: string;
|
37 | };
|
38 | } & {
|
39 | polymorphicType?: string | string[];
|
40 | }): Promise<Target[]>;
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | delete(where?: Where<Target>, options?: Options & {
|
53 | throughOptions?: Options & {
|
54 | discriminator?: string;
|
55 | };
|
56 | } & {
|
57 | polymorphicType?: string | string[];
|
58 | }): Promise<Count>;
|
59 | |
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | patch(dataObject: DataObject<Target> | {
|
69 | [polymorphicType: string]: DataObject<Target>;
|
70 | }, where?: Where<Target>, options?: Options & {
|
71 | throughOptions?: Options & {
|
72 | discriminator?: string;
|
73 | };
|
74 | } & {
|
75 | isPolymorphic?: boolean;
|
76 | }): Promise<Count>;
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | link(targetModelId: TargetID, options?: Options & {
|
84 | throughData?: DataObject<Through>;
|
85 | throughOptions?: Options;
|
86 | }): Promise<void>;
|
87 | |
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | unlink(targetModelId: TargetID, options?: Options & {
|
94 | throughOptions?: Options;
|
95 | }): Promise<void>;
|
96 | |
97 |
|
98 |
|
99 |
|
100 |
|
101 | unlinkAll(options?: Options & {
|
102 | throughOptions?: Options;
|
103 | }): Promise<void>;
|
104 | }
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 | export declare class DefaultHasManyThroughRepository<TargetEntity extends Entity, TargetID, TargetRepository extends EntityCrudRepository<TargetEntity, TargetID>, ThroughEntity extends Entity, ThroughID, ThroughRepository extends EntityCrudRepository<ThroughEntity, ThroughID>> implements HasManyThroughRepository<TargetEntity, TargetID, ThroughEntity> {
|
113 | getTargetRepository: Getter<TargetRepository> | {
|
114 | [repoType: string]: Getter<TargetRepository>;
|
115 | };
|
116 | getThroughRepository: Getter<ThroughRepository>;
|
117 | getTargetConstraintFromThroughModels: (throughInstances: ThroughEntity[]) => DataObject<TargetEntity>;
|
118 | getTargetKeys: (throughInstances: ThroughEntity[]) => TargetID[];
|
119 | getThroughConstraintFromSource: () => DataObject<ThroughEntity>;
|
120 | getTargetIds: (targetInstances: TargetEntity[]) => TargetID[];
|
121 | getThroughConstraintFromTarget: (targetID: TargetID[]) => DataObject<ThroughEntity>;
|
122 | targetResolver: TypeResolver<Entity, typeof Entity>;
|
123 | throughResolver: TypeResolver<Entity, typeof Entity>;
|
124 | constructor(getTargetRepository: Getter<TargetRepository> | {
|
125 | [repoType: string]: Getter<TargetRepository>;
|
126 | }, getThroughRepository: Getter<ThroughRepository>, getTargetConstraintFromThroughModels: (throughInstances: ThroughEntity[]) => DataObject<TargetEntity>, getTargetKeys: (throughInstances: ThroughEntity[]) => TargetID[], getThroughConstraintFromSource: () => DataObject<ThroughEntity>, getTargetIds: (targetInstances: TargetEntity[]) => TargetID[], getThroughConstraintFromTarget: (targetID: TargetID[]) => DataObject<ThroughEntity>, targetResolver: TypeResolver<Entity, typeof Entity>, throughResolver: TypeResolver<Entity, typeof Entity>);
|
127 | getTargetRepositoryDict: {
|
128 | [repoType: string]: Getter<TargetRepository>;
|
129 | };
|
130 | create(targetModelData: DataObject<TargetEntity>, options?: Options & {
|
131 | throughData?: DataObject<ThroughEntity>;
|
132 | throughOptions?: Options;
|
133 | } & {
|
134 | polymorphicType?: string;
|
135 | }): Promise<TargetEntity>;
|
136 | find(filter?: Filter<TargetEntity>, options?: Options & {
|
137 | throughOptions?: Options & {
|
138 | discriminator?: string;
|
139 | };
|
140 | } & {
|
141 | polymorphicType?: string | string[];
|
142 | }): Promise<TargetEntity[]>;
|
143 | delete(where?: Where<TargetEntity>, options?: Options & {
|
144 | throughOptions?: Options & {
|
145 | discriminator?: string;
|
146 | };
|
147 | } & {
|
148 | polymorphicType?: string | string[];
|
149 | }): Promise<Count>;
|
150 | patch(dataObject: DataObject<TargetEntity> | {
|
151 | [polymorphicType: string]: DataObject<TargetEntity>;
|
152 | }, where?: Where<TargetEntity>, options?: Options & {
|
153 | throughOptions?: Options & {
|
154 | discriminator?: string;
|
155 | };
|
156 | } & {
|
157 | isPolymorphic?: boolean;
|
158 | }): Promise<Count>;
|
159 | link(targetId: TargetID, options?: Options & {
|
160 | throughData?: DataObject<ThroughEntity>;
|
161 | throughOptions?: Options;
|
162 | }): Promise<void>;
|
163 | unlink(targetId: TargetID, options?: Options & {
|
164 | throughOptions?: Options;
|
165 | }): Promise<void>;
|
166 | unlinkAll(options?: Options & {
|
167 | throughOptions?: Options;
|
168 | }): Promise<void>;
|
169 | }
|