@forklaunch/implementation-iam-base 0.8.24 → 1.0.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.
@@ -1,6 +1,7 @@
1
1
  import { OrganizationDto, CreateOrganizationDto, UpdateOrganizationDto, PermissionDto, CreatePermissionDto, UpdatePermissionDto, UpdateRoleDto, RoleDto, CreateRoleDto, UserDto, CreateUserDto, UpdateUserDto } from '@forklaunch/interfaces-iam/types';
2
- import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
3
- import { EntityManager } from '@mikro-orm/core';
2
+ import * as _forklaunch_core_persistence from '@forklaunch/core/persistence';
3
+ import * as _mikro_orm_core from '@mikro-orm/core';
4
+ import { InferEntity, EntityManager } from '@mikro-orm/core';
4
5
 
5
6
  type OrganizationDtos<OrganizationStatus> = {
6
7
  OrganizationMapper: OrganizationDto<OrganizationStatus>;
@@ -24,76 +25,294 @@ type UserDtos = {
24
25
  UpdateUserMapper: UpdateUserDto;
25
26
  };
26
27
 
28
+ declare const Organization: _mikro_orm_core.EntitySchemaWithMeta<"Organization", string, _mikro_orm_core.InferEntityFromProperties<{
29
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
30
+ primary: true;
31
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
32
+ primary: true;
33
+ }>;
34
+ readonly status: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.PropertyChain<any, _mikro_orm_core.EmptyOptions & {
35
+ kind: "enum";
36
+ }>, any, _mikro_orm_core.EmptyOptions & {
37
+ kind: "enum";
38
+ }>;
39
+ }, undefined, never, never, false>, never, {
40
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
41
+ primary: true;
42
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
43
+ primary: true;
44
+ }>;
45
+ readonly status: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.PropertyChain<any, _mikro_orm_core.EmptyOptions & {
46
+ kind: "enum";
47
+ }>, any, _mikro_orm_core.EmptyOptions & {
48
+ kind: "enum";
49
+ }>;
50
+ }, _mikro_orm_core.EntityCtor<_mikro_orm_core.InferEntityFromProperties<{
51
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
52
+ primary: true;
53
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
54
+ primary: true;
55
+ }>;
56
+ readonly status: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.PropertyChain<any, _mikro_orm_core.EmptyOptions & {
57
+ kind: "enum";
58
+ }>, any, _mikro_orm_core.EmptyOptions & {
59
+ kind: "enum";
60
+ }>;
61
+ }, undefined, never, never, false>>>;
62
+ declare const Role: _mikro_orm_core.EntitySchemaWithMeta<"Role", string, _mikro_orm_core.InferEntityFromProperties<{
63
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
64
+ primary: true;
65
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
66
+ primary: true;
67
+ }>;
68
+ readonly permissions: () => _mikro_orm_core.PropertyChain<_mikro_orm_core.InferEntityFromProperties<{
69
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
70
+ primary: true;
71
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
72
+ primary: true;
73
+ }>;
74
+ readonly slug: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, _mikro_orm_core.EmptyOptions, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, _mikro_orm_core.EmptyOptions>;
75
+ }, undefined, never, never, false>, _mikro_orm_core.EmptyOptions & {
76
+ kind: "m:n";
77
+ }>;
78
+ }, undefined, never, never, false>, never, {
79
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
80
+ primary: true;
81
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
82
+ primary: true;
83
+ }>;
84
+ readonly permissions: () => _mikro_orm_core.PropertyChain<_mikro_orm_core.InferEntityFromProperties<{
85
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
86
+ primary: true;
87
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
88
+ primary: true;
89
+ }>;
90
+ readonly slug: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, _mikro_orm_core.EmptyOptions, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, _mikro_orm_core.EmptyOptions>;
91
+ }, undefined, never, never, false>, _mikro_orm_core.EmptyOptions & {
92
+ kind: "m:n";
93
+ }>;
94
+ }, _mikro_orm_core.EntityCtor<_mikro_orm_core.InferEntityFromProperties<{
95
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
96
+ primary: true;
97
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
98
+ primary: true;
99
+ }>;
100
+ readonly permissions: () => _mikro_orm_core.PropertyChain<_mikro_orm_core.InferEntityFromProperties<{
101
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
102
+ primary: true;
103
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
104
+ primary: true;
105
+ }>;
106
+ readonly slug: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, _mikro_orm_core.EmptyOptions, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, _mikro_orm_core.EmptyOptions>;
107
+ }, undefined, never, never, false>, _mikro_orm_core.EmptyOptions & {
108
+ kind: "m:n";
109
+ }>;
110
+ }, undefined, never, never, false>>>;
111
+ declare const Permission: _mikro_orm_core.EntitySchemaWithMeta<"Permission", string, _mikro_orm_core.InferEntityFromProperties<{
112
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
113
+ primary: true;
114
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
115
+ primary: true;
116
+ }>;
117
+ readonly slug: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, _mikro_orm_core.EmptyOptions, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, _mikro_orm_core.EmptyOptions>;
118
+ }, undefined, never, never, false>, never, {
119
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
120
+ primary: true;
121
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
122
+ primary: true;
123
+ }>;
124
+ readonly slug: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, _mikro_orm_core.EmptyOptions, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, _mikro_orm_core.EmptyOptions>;
125
+ }, _mikro_orm_core.EntityCtor<_mikro_orm_core.InferEntityFromProperties<{
126
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
127
+ primary: true;
128
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
129
+ primary: true;
130
+ }>;
131
+ readonly slug: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, _mikro_orm_core.EmptyOptions, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, _mikro_orm_core.EmptyOptions>;
132
+ }, undefined, never, never, false>>>;
133
+ declare const User: _mikro_orm_core.EntitySchemaWithMeta<"User", string, _mikro_orm_core.InferEntityFromProperties<{
134
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
135
+ primary: true;
136
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
137
+ primary: true;
138
+ }>;
139
+ readonly organization: () => _mikro_orm_core.PropertyChain<_mikro_orm_core.InferEntityFromProperties<{
140
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
141
+ primary: true;
142
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
143
+ primary: true;
144
+ }>;
145
+ readonly status: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.PropertyChain<any, _mikro_orm_core.EmptyOptions & {
146
+ kind: "enum";
147
+ }>, any, _mikro_orm_core.EmptyOptions & {
148
+ kind: "enum";
149
+ }>;
150
+ }, undefined, never, never, false>, Omit<_mikro_orm_core.EmptyOptions & {
151
+ kind: "m:1";
152
+ }, "nullable"> & {
153
+ nullable: true;
154
+ }>;
155
+ }, undefined, never, never, false>, never, {
156
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
157
+ primary: true;
158
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
159
+ primary: true;
160
+ }>;
161
+ readonly organization: () => _mikro_orm_core.PropertyChain<_mikro_orm_core.InferEntityFromProperties<{
162
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
163
+ primary: true;
164
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
165
+ primary: true;
166
+ }>;
167
+ readonly status: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.PropertyChain<any, _mikro_orm_core.EmptyOptions & {
168
+ kind: "enum";
169
+ }>, any, _mikro_orm_core.EmptyOptions & {
170
+ kind: "enum";
171
+ }>;
172
+ }, undefined, never, never, false>, Omit<_mikro_orm_core.EmptyOptions & {
173
+ kind: "m:1";
174
+ }, "nullable"> & {
175
+ nullable: true;
176
+ }>;
177
+ }, _mikro_orm_core.EntityCtor<_mikro_orm_core.InferEntityFromProperties<{
178
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
179
+ primary: true;
180
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
181
+ primary: true;
182
+ }>;
183
+ readonly organization: () => _mikro_orm_core.PropertyChain<_mikro_orm_core.InferEntityFromProperties<{
184
+ readonly id: _forklaunch_core_persistence.ClassifiedProperty<Pick<_mikro_orm_core.UniversalPropertyOptionsBuilder<string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
185
+ primary: true;
186
+ }, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, keyof _mikro_orm_core.PropertyOptions<any> | ("~options" | "~type" | "$type" | "strictNullable")>, string, Omit<_mikro_orm_core.EmptyOptions, "primary"> & {
187
+ primary: true;
188
+ }>;
189
+ readonly status: _forklaunch_core_persistence.ClassifiedProperty<_mikro_orm_core.PropertyChain<any, _mikro_orm_core.EmptyOptions & {
190
+ kind: "enum";
191
+ }>, any, _mikro_orm_core.EmptyOptions & {
192
+ kind: "enum";
193
+ }>;
194
+ }, undefined, never, never, false>, Omit<_mikro_orm_core.EmptyOptions & {
195
+ kind: "m:1";
196
+ }, "nullable"> & {
197
+ nullable: true;
198
+ }>;
199
+ }, undefined, never, never, false>>>;
200
+
27
201
  type OrganizationEntities<OrganizationStatus> = {
28
- OrganizationMapper: MapNestedDtoArraysToCollections<OrganizationDto<OrganizationStatus>, 'users'>;
29
- CreateOrganizationMapper: MapNestedDtoArraysToCollections<OrganizationDto<OrganizationStatus>, 'users'>;
30
- UpdateOrganizationMapper: MapNestedDtoArraysToCollections<OrganizationDto<OrganizationStatus>, 'users'>;
202
+ OrganizationMapper: {
203
+ '~entity': (typeof Organization)['~entity'] & {
204
+ status: OrganizationStatus[keyof OrganizationStatus];
205
+ };
206
+ };
207
+ CreateOrganizationMapper: {
208
+ '~entity': (typeof Organization)['~entity'] & {
209
+ status: OrganizationStatus[keyof OrganizationStatus];
210
+ };
211
+ };
212
+ UpdateOrganizationMapper: {
213
+ '~entity': (typeof Organization)['~entity'] & {
214
+ status: OrganizationStatus[keyof OrganizationStatus];
215
+ };
216
+ };
31
217
  };
32
218
  type PermissionEntities = {
33
- PermissionMapper: PermissionDto;
34
- CreatePermissionMapper: PermissionDto;
35
- UpdatePermissionMapper: PermissionDto;
36
- RoleEntityMapper: MapNestedDtoArraysToCollections<UpdateRoleDto, 'permissions'>;
219
+ PermissionMapper: {
220
+ '~entity': (typeof Permission)['~entity'];
221
+ };
222
+ CreatePermissionMapper: {
223
+ '~entity': (typeof Permission)['~entity'];
224
+ };
225
+ UpdatePermissionMapper: {
226
+ '~entity': (typeof Permission)['~entity'];
227
+ };
228
+ RoleEntityMapper: {
229
+ '~entity': (typeof Role)['~entity'];
230
+ };
37
231
  };
38
232
  type RoleEntities = {
39
- RoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
40
- CreateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
41
- UpdateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
233
+ RoleMapper: {
234
+ '~entity': (typeof Role)['~entity'];
235
+ };
236
+ CreateRoleMapper: {
237
+ '~entity': (typeof Role)['~entity'];
238
+ };
239
+ UpdateRoleMapper: {
240
+ '~entity': (typeof Role)['~entity'];
241
+ };
42
242
  };
43
243
  type UserEntities = {
44
- UserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
45
- CreateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
46
- UpdateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
244
+ UserMapper: {
245
+ '~entity': (typeof User)['~entity'];
246
+ };
247
+ CreateUserMapper: {
248
+ '~entity': (typeof User)['~entity'];
249
+ };
250
+ UpdateUserMapper: {
251
+ '~entity': (typeof User)['~entity'];
252
+ };
47
253
  };
48
254
 
49
255
  type OrganizationMappers<OrganizationStatus, MapperEntities extends OrganizationEntities<OrganizationStatus>, MapperDomains extends OrganizationDtos<OrganizationStatus>> = {
50
256
  OrganizationMapper: {
51
- toDto: (entity: MapperEntities['OrganizationMapper']) => Promise<MapperDomains['OrganizationMapper']>;
257
+ entity: MapperEntities['OrganizationMapper'];
258
+ toDto: (entity: InferEntity<MapperEntities['OrganizationMapper']>) => Promise<MapperDomains['OrganizationMapper']>;
52
259
  };
53
260
  CreateOrganizationMapper: {
54
- toEntity: (dto: MapperDomains['CreateOrganizationMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateOrganizationMapper']>;
261
+ entity: MapperEntities['CreateOrganizationMapper'];
262
+ toEntity: (dto: MapperDomains['CreateOrganizationMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['CreateOrganizationMapper']>>;
55
263
  };
56
264
  UpdateOrganizationMapper: {
57
- toEntity: (dto: MapperDomains['UpdateOrganizationMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateOrganizationMapper']>;
265
+ entity: MapperEntities['UpdateOrganizationMapper'];
266
+ toEntity: (dto: MapperDomains['UpdateOrganizationMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['UpdateOrganizationMapper']>>;
58
267
  };
59
268
  };
60
269
 
61
270
  type PermissionMappers<MapperEntities extends PermissionEntities, MapperDomains extends PermissionDtos> = {
62
271
  PermissionMapper: {
63
- toDto: (entity: MapperEntities['PermissionMapper']) => Promise<MapperDomains['PermissionMapper']>;
272
+ entity: MapperEntities['PermissionMapper'];
273
+ toDto: (entity: InferEntity<MapperEntities['PermissionMapper']>) => Promise<MapperDomains['PermissionMapper']>;
64
274
  };
65
275
  CreatePermissionMapper: {
66
- toEntity: (dto: MapperDomains['CreatePermissionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreatePermissionMapper']>;
276
+ entity: MapperEntities['CreatePermissionMapper'];
277
+ toEntity: (dto: MapperDomains['CreatePermissionMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['CreatePermissionMapper']>>;
67
278
  };
68
279
  UpdatePermissionMapper: {
69
- toEntity: (dto: MapperDomains['UpdatePermissionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdatePermissionMapper']>;
280
+ entity: MapperEntities['UpdatePermissionMapper'];
281
+ toEntity: (dto: MapperDomains['UpdatePermissionMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['UpdatePermissionMapper']>>;
70
282
  };
71
283
  RoleEntityMapper: {
72
- toEntity: (dto: MapperDomains['RoleEntityMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['RoleEntityMapper']>;
284
+ entity: MapperEntities['RoleEntityMapper'];
285
+ toEntity: (dto: MapperDomains['RoleEntityMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['RoleEntityMapper']>>;
73
286
  };
74
287
  };
75
288
 
76
289
  type RoleMappers<MapperEntities extends RoleEntities, MapperDomains extends RoleDtos> = {
77
290
  RoleMapper: {
78
- toDto: (entity: MapperEntities['RoleMapper']) => Promise<MapperDomains['RoleMapper']>;
291
+ entity: MapperEntities['RoleMapper'];
292
+ toDto: (entity: InferEntity<MapperEntities['RoleMapper']>) => Promise<MapperDomains['RoleMapper']>;
79
293
  };
80
294
  CreateRoleMapper: {
81
- toEntity: (dto: MapperDomains['CreateRoleMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateRoleMapper']>;
295
+ entity: MapperEntities['CreateRoleMapper'];
296
+ toEntity: (dto: MapperDomains['CreateRoleMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['CreateRoleMapper']>>;
82
297
  };
83
298
  UpdateRoleMapper: {
84
- toEntity: (dto: MapperDomains['UpdateRoleMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateRoleMapper']>;
299
+ entity: MapperEntities['UpdateRoleMapper'];
300
+ toEntity: (dto: MapperDomains['UpdateRoleMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['UpdateRoleMapper']>>;
85
301
  };
86
302
  };
87
303
 
88
304
  type UserMappers<MapperEntities extends UserEntities, MapperDomains extends UserDtos> = {
89
305
  UserMapper: {
90
- toDto: (entity: MapperEntities['UserMapper']) => Promise<MapperDomains['UserMapper']>;
306
+ entity: MapperEntities['UserMapper'];
307
+ toDto: (entity: InferEntity<MapperEntities['UserMapper']>) => Promise<MapperDomains['UserMapper']>;
91
308
  };
92
309
  CreateUserMapper: {
93
- toEntity: (dto: MapperDomains['CreateUserMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateUserMapper']>;
310
+ entity: MapperEntities['CreateUserMapper'];
311
+ toEntity: (dto: MapperDomains['CreateUserMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['CreateUserMapper']>>;
94
312
  };
95
313
  UpdateUserMapper: {
96
- toEntity: (dto: MapperDomains['UpdateUserMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateUserMapper']>;
314
+ entity: MapperEntities['UpdateUserMapper'];
315
+ toEntity: (dto: MapperDomains['UpdateUserMapper'], em: EntityManager, ...args: unknown[]) => Promise<InferEntity<MapperEntities['UpdateUserMapper']>>;
97
316
  };
98
317
  };
99
318
 
@@ -14,7 +14,7 @@ export const CreateUserSchema = {
14
14
  password: string,
15
15
  firstName: string,
16
16
  lastName: string,
17
- organization: string,
17
+ organization: optional(string),
18
18
  roles: array(string),
19
19
  phoneNumber: optional(string),
20
20
  subscription: optional(string),
@@ -38,6 +38,7 @@ export const UserSchema = ({ uuidId }: { uuidId: boolean }) => ({
38
38
  email: email,
39
39
  firstName: string,
40
40
  lastName: string,
41
+ organization: optional(string),
41
42
  roles: array(RoleSchema({ uuidId })),
42
43
  phoneNumber: optional(string),
43
44
  subscription: optional(string),
@@ -1,49 +1,67 @@
1
- import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
2
1
  import {
3
- OrganizationDto,
4
- PermissionDto,
5
- RoleDto,
6
- UpdateRoleDto,
7
- UserDto
8
- } from '@forklaunch/interfaces-iam/types';
2
+ Organization,
3
+ Permission,
4
+ Role,
5
+ User
6
+ } from '../../persistence/entities';
9
7
 
10
- // organization
8
+ // organization entity mapper types
11
9
  export type OrganizationEntities<OrganizationStatus> = {
12
- OrganizationMapper: MapNestedDtoArraysToCollections<
13
- OrganizationDto<OrganizationStatus>,
14
- 'users'
15
- >;
16
- CreateOrganizationMapper: MapNestedDtoArraysToCollections<
17
- OrganizationDto<OrganizationStatus>,
18
- 'users'
19
- >;
20
- UpdateOrganizationMapper: MapNestedDtoArraysToCollections<
21
- OrganizationDto<OrganizationStatus>,
22
- 'users'
23
- >;
10
+ OrganizationMapper: {
11
+ '~entity': (typeof Organization)['~entity'] & {
12
+ status: OrganizationStatus[keyof OrganizationStatus];
13
+ };
14
+ };
15
+ CreateOrganizationMapper: {
16
+ '~entity': (typeof Organization)['~entity'] & {
17
+ status: OrganizationStatus[keyof OrganizationStatus];
18
+ };
19
+ };
20
+ UpdateOrganizationMapper: {
21
+ '~entity': (typeof Organization)['~entity'] & {
22
+ status: OrganizationStatus[keyof OrganizationStatus];
23
+ };
24
+ };
24
25
  };
25
26
 
26
- // permission
27
+ // permission entity mapper types
27
28
  export type PermissionEntities = {
28
- PermissionMapper: PermissionDto;
29
- CreatePermissionMapper: PermissionDto;
30
- UpdatePermissionMapper: PermissionDto;
31
- RoleEntityMapper: MapNestedDtoArraysToCollections<
32
- UpdateRoleDto,
33
- 'permissions'
34
- >;
29
+ PermissionMapper: {
30
+ '~entity': (typeof Permission)['~entity'];
31
+ };
32
+ CreatePermissionMapper: {
33
+ '~entity': (typeof Permission)['~entity'];
34
+ };
35
+ UpdatePermissionMapper: {
36
+ '~entity': (typeof Permission)['~entity'];
37
+ };
38
+ RoleEntityMapper: {
39
+ '~entity': (typeof Role)['~entity'];
40
+ };
35
41
  };
36
42
 
37
- // role
43
+ // role entity mapper types
38
44
  export type RoleEntities = {
39
- RoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
40
- CreateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
41
- UpdateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
45
+ RoleMapper: {
46
+ '~entity': (typeof Role)['~entity'];
47
+ };
48
+ CreateRoleMapper: {
49
+ '~entity': (typeof Role)['~entity'];
50
+ };
51
+ UpdateRoleMapper: {
52
+ '~entity': (typeof Role)['~entity'];
53
+ };
42
54
  };
43
55
 
44
- // user
56
+ // user entity mapper types
45
57
  export type UserEntities = {
46
- UserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
47
- CreateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
48
- UpdateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
58
+ UserMapper: {
59
+ '~entity': (typeof User)['~entity'];
60
+ };
61
+ CreateUserMapper: {
62
+ '~entity': (typeof User)['~entity'];
63
+ };
64
+ UpdateUserMapper: {
65
+ '~entity': (typeof User)['~entity'];
66
+ };
49
67
  };
@@ -1,4 +1,4 @@
1
- import { EntityManager } from '@mikro-orm/core';
1
+ import { EntityManager, InferEntity } from '@mikro-orm/core';
2
2
  import { OrganizationDtos } from './iamDto.types';
3
3
  import { OrganizationEntities } from './iamEntities.types';
4
4
 
@@ -8,22 +8,25 @@ export type OrganizationMappers<
8
8
  MapperDomains extends OrganizationDtos<OrganizationStatus>
9
9
  > = {
10
10
  OrganizationMapper: {
11
+ entity: MapperEntities['OrganizationMapper'];
11
12
  toDto: (
12
- entity: MapperEntities['OrganizationMapper']
13
+ entity: InferEntity<MapperEntities['OrganizationMapper']>
13
14
  ) => Promise<MapperDomains['OrganizationMapper']>;
14
15
  };
15
16
  CreateOrganizationMapper: {
17
+ entity: MapperEntities['CreateOrganizationMapper'];
16
18
  toEntity: (
17
19
  dto: MapperDomains['CreateOrganizationMapper'],
18
20
  em: EntityManager,
19
21
  ...args: unknown[]
20
- ) => Promise<MapperEntities['CreateOrganizationMapper']>;
22
+ ) => Promise<InferEntity<MapperEntities['CreateOrganizationMapper']>>;
21
23
  };
22
24
  UpdateOrganizationMapper: {
25
+ entity: MapperEntities['UpdateOrganizationMapper'];
23
26
  toEntity: (
24
27
  dto: MapperDomains['UpdateOrganizationMapper'],
25
28
  em: EntityManager,
26
29
  ...args: unknown[]
27
- ) => Promise<MapperEntities['UpdateOrganizationMapper']>;
30
+ ) => Promise<InferEntity<MapperEntities['UpdateOrganizationMapper']>>;
28
31
  };
29
32
  };
@@ -1,4 +1,4 @@
1
- import { EntityManager } from '@mikro-orm/core';
1
+ import { EntityManager, InferEntity } from '@mikro-orm/core';
2
2
  import { PermissionDtos } from './iamDto.types';
3
3
  import { PermissionEntities } from './iamEntities.types';
4
4
 
@@ -7,29 +7,33 @@ export type PermissionMappers<
7
7
  MapperDomains extends PermissionDtos
8
8
  > = {
9
9
  PermissionMapper: {
10
+ entity: MapperEntities['PermissionMapper'];
10
11
  toDto: (
11
- entity: MapperEntities['PermissionMapper']
12
+ entity: InferEntity<MapperEntities['PermissionMapper']>
12
13
  ) => Promise<MapperDomains['PermissionMapper']>;
13
14
  };
14
15
  CreatePermissionMapper: {
16
+ entity: MapperEntities['CreatePermissionMapper'];
15
17
  toEntity: (
16
18
  dto: MapperDomains['CreatePermissionMapper'],
17
19
  em: EntityManager,
18
20
  ...args: unknown[]
19
- ) => Promise<MapperEntities['CreatePermissionMapper']>;
21
+ ) => Promise<InferEntity<MapperEntities['CreatePermissionMapper']>>;
20
22
  };
21
23
  UpdatePermissionMapper: {
24
+ entity: MapperEntities['UpdatePermissionMapper'];
22
25
  toEntity: (
23
26
  dto: MapperDomains['UpdatePermissionMapper'],
24
27
  em: EntityManager,
25
28
  ...args: unknown[]
26
- ) => Promise<MapperEntities['UpdatePermissionMapper']>;
29
+ ) => Promise<InferEntity<MapperEntities['UpdatePermissionMapper']>>;
27
30
  };
28
31
  RoleEntityMapper: {
32
+ entity: MapperEntities['RoleEntityMapper'];
29
33
  toEntity: (
30
34
  dto: MapperDomains['RoleEntityMapper'],
31
35
  em: EntityManager,
32
36
  ...args: unknown[]
33
- ) => Promise<MapperEntities['RoleEntityMapper']>;
37
+ ) => Promise<InferEntity<MapperEntities['RoleEntityMapper']>>;
34
38
  };
35
39
  };
@@ -1,4 +1,4 @@
1
- import { EntityManager } from '@mikro-orm/core';
1
+ import { EntityManager, InferEntity } from '@mikro-orm/core';
2
2
  import { RoleDtos } from './iamDto.types';
3
3
  import { RoleEntities } from './iamEntities.types';
4
4
 
@@ -7,22 +7,25 @@ export type RoleMappers<
7
7
  MapperDomains extends RoleDtos
8
8
  > = {
9
9
  RoleMapper: {
10
+ entity: MapperEntities['RoleMapper'];
10
11
  toDto: (
11
- entity: MapperEntities['RoleMapper']
12
+ entity: InferEntity<MapperEntities['RoleMapper']>
12
13
  ) => Promise<MapperDomains['RoleMapper']>;
13
14
  };
14
15
  CreateRoleMapper: {
16
+ entity: MapperEntities['CreateRoleMapper'];
15
17
  toEntity: (
16
18
  dto: MapperDomains['CreateRoleMapper'],
17
19
  em: EntityManager,
18
20
  ...args: unknown[]
19
- ) => Promise<MapperEntities['CreateRoleMapper']>;
21
+ ) => Promise<InferEntity<MapperEntities['CreateRoleMapper']>>;
20
22
  };
21
23
  UpdateRoleMapper: {
24
+ entity: MapperEntities['UpdateRoleMapper'];
22
25
  toEntity: (
23
26
  dto: MapperDomains['UpdateRoleMapper'],
24
27
  em: EntityManager,
25
28
  ...args: unknown[]
26
- ) => Promise<MapperEntities['UpdateRoleMapper']>;
29
+ ) => Promise<InferEntity<MapperEntities['UpdateRoleMapper']>>;
27
30
  };
28
31
  };
@@ -1,4 +1,4 @@
1
- import { EntityManager } from '@mikro-orm/core';
1
+ import { EntityManager, InferEntity } from '@mikro-orm/core';
2
2
  import { UserDtos } from './iamDto.types';
3
3
  import { UserEntities } from './iamEntities.types';
4
4
 
@@ -7,22 +7,25 @@ export type UserMappers<
7
7
  MapperDomains extends UserDtos
8
8
  > = {
9
9
  UserMapper: {
10
+ entity: MapperEntities['UserMapper'];
10
11
  toDto: (
11
- entity: MapperEntities['UserMapper']
12
+ entity: InferEntity<MapperEntities['UserMapper']>
12
13
  ) => Promise<MapperDomains['UserMapper']>;
13
14
  };
14
15
  CreateUserMapper: {
16
+ entity: MapperEntities['CreateUserMapper'];
15
17
  toEntity: (
16
18
  dto: MapperDomains['CreateUserMapper'],
17
19
  em: EntityManager,
18
20
  ...args: unknown[]
19
- ) => Promise<MapperEntities['CreateUserMapper']>;
21
+ ) => Promise<InferEntity<MapperEntities['CreateUserMapper']>>;
20
22
  };
21
23
  UpdateUserMapper: {
24
+ entity: MapperEntities['UpdateUserMapper'];
22
25
  toEntity: (
23
26
  dto: MapperDomains['UpdateUserMapper'],
24
27
  em: EntityManager,
25
28
  ...args: unknown[]
26
- ) => Promise<MapperEntities['UpdateUserMapper']>;
29
+ ) => Promise<InferEntity<MapperEntities['UpdateUserMapper']>>;
27
30
  };
28
31
  };