@forklaunch/implementation-iam-base 0.6.3 → 0.6.4
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/lib/domain/schemas/index.d.mts +733 -334
- package/lib/domain/schemas/index.d.ts +733 -334
- package/lib/domain/schemas/index.js +90 -58
- package/lib/domain/schemas/index.mjs +40 -36
- package/lib/domain/types/index.d.mts +166 -71
- package/lib/domain/types/index.d.ts +166 -71
- package/lib/domain/types/index.js +8 -4
- package/lib/eject/services/user.service.ts +16 -30
- package/lib/services/index.d.mts +250 -81
- package/lib/services/index.d.ts +250 -81
- package/lib/services/index.js +192 -171
- package/lib/services/index.mjs +177 -169
- package/package.json +8 -8
|
@@ -1,100 +1,195 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
OrganizationDto,
|
|
3
|
+
CreateOrganizationDto,
|
|
4
|
+
UpdateOrganizationDto,
|
|
5
|
+
PermissionDto,
|
|
6
|
+
CreatePermissionDto,
|
|
7
|
+
UpdatePermissionDto,
|
|
8
|
+
UpdateRoleDto,
|
|
9
|
+
RoleDto,
|
|
10
|
+
CreateRoleDto,
|
|
11
|
+
UserDto,
|
|
12
|
+
CreateUserDto,
|
|
13
|
+
UpdateUserDto
|
|
14
|
+
} from '@forklaunch/interfaces-iam/types';
|
|
2
15
|
import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
|
|
3
16
|
import { EntityManager } from '@mikro-orm/core';
|
|
4
17
|
|
|
5
18
|
type OrganizationDtos<OrganizationStatus> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
OrganizationMapper: OrganizationDto<OrganizationStatus>;
|
|
20
|
+
CreateOrganizationMapper: CreateOrganizationDto;
|
|
21
|
+
UpdateOrganizationMapper: UpdateOrganizationDto;
|
|
9
22
|
};
|
|
10
23
|
type PermissionDtos = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
PermissionMapper: PermissionDto;
|
|
25
|
+
CreatePermissionMapper: CreatePermissionDto;
|
|
26
|
+
UpdatePermissionMapper: UpdatePermissionDto;
|
|
27
|
+
RoleEntityMapper: UpdateRoleDto;
|
|
15
28
|
};
|
|
16
29
|
type RoleDtos = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
RoleMapper: RoleDto;
|
|
31
|
+
CreateRoleMapper: CreateRoleDto;
|
|
32
|
+
UpdateRoleMapper: UpdateRoleDto;
|
|
20
33
|
};
|
|
21
34
|
type UserDtos = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
UserMapper: UserDto;
|
|
36
|
+
CreateUserMapper: CreateUserDto;
|
|
37
|
+
UpdateUserMapper: UpdateUserDto;
|
|
25
38
|
};
|
|
26
39
|
|
|
27
40
|
type OrganizationEntities<OrganizationStatus> = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
OrganizationMapper: MapNestedDtoArraysToCollections<
|
|
42
|
+
OrganizationDto<OrganizationStatus>,
|
|
43
|
+
'users'
|
|
44
|
+
>;
|
|
45
|
+
CreateOrganizationMapper: MapNestedDtoArraysToCollections<
|
|
46
|
+
OrganizationDto<OrganizationStatus>,
|
|
47
|
+
'users'
|
|
48
|
+
>;
|
|
49
|
+
UpdateOrganizationMapper: MapNestedDtoArraysToCollections<
|
|
50
|
+
OrganizationDto<OrganizationStatus>,
|
|
51
|
+
'users'
|
|
52
|
+
>;
|
|
31
53
|
};
|
|
32
54
|
type PermissionEntities = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
PermissionMapper: PermissionDto;
|
|
56
|
+
CreatePermissionMapper: PermissionDto;
|
|
57
|
+
UpdatePermissionMapper: PermissionDto;
|
|
58
|
+
RoleEntityMapper: MapNestedDtoArraysToCollections<
|
|
59
|
+
UpdateRoleDto,
|
|
60
|
+
'permissions'
|
|
61
|
+
>;
|
|
37
62
|
};
|
|
38
63
|
type RoleEntities = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
RoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
|
|
65
|
+
CreateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
|
|
66
|
+
UpdateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
|
|
42
67
|
};
|
|
43
68
|
type UserEntities = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
69
|
+
UserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
|
|
70
|
+
CreateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
|
|
71
|
+
UpdateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
|
|
47
72
|
};
|
|
48
73
|
|
|
49
|
-
type OrganizationMappers<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
type OrganizationMappers<
|
|
75
|
+
OrganizationStatus,
|
|
76
|
+
MapperEntities extends OrganizationEntities<OrganizationStatus>,
|
|
77
|
+
MapperDomains extends OrganizationDtos<OrganizationStatus>
|
|
78
|
+
> = {
|
|
79
|
+
OrganizationMapper: {
|
|
80
|
+
toDto: (
|
|
81
|
+
entity: MapperEntities['OrganizationMapper']
|
|
82
|
+
) => Promise<MapperDomains['OrganizationMapper']>;
|
|
83
|
+
};
|
|
84
|
+
CreateOrganizationMapper: {
|
|
85
|
+
toEntity: (
|
|
86
|
+
dto: MapperDomains['CreateOrganizationMapper'],
|
|
87
|
+
em: EntityManager,
|
|
88
|
+
...args: unknown[]
|
|
89
|
+
) => Promise<MapperEntities['CreateOrganizationMapper']>;
|
|
90
|
+
};
|
|
91
|
+
UpdateOrganizationMapper: {
|
|
92
|
+
toEntity: (
|
|
93
|
+
dto: MapperDomains['UpdateOrganizationMapper'],
|
|
94
|
+
em: EntityManager,
|
|
95
|
+
...args: unknown[]
|
|
96
|
+
) => Promise<MapperEntities['UpdateOrganizationMapper']>;
|
|
97
|
+
};
|
|
59
98
|
};
|
|
60
99
|
|
|
61
|
-
type PermissionMappers<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
type PermissionMappers<
|
|
101
|
+
MapperEntities extends PermissionEntities,
|
|
102
|
+
MapperDomains extends PermissionDtos
|
|
103
|
+
> = {
|
|
104
|
+
PermissionMapper: {
|
|
105
|
+
toDto: (
|
|
106
|
+
entity: MapperEntities['PermissionMapper']
|
|
107
|
+
) => Promise<MapperDomains['PermissionMapper']>;
|
|
108
|
+
};
|
|
109
|
+
CreatePermissionMapper: {
|
|
110
|
+
toEntity: (
|
|
111
|
+
dto: MapperDomains['CreatePermissionMapper'],
|
|
112
|
+
em: EntityManager,
|
|
113
|
+
...args: unknown[]
|
|
114
|
+
) => Promise<MapperEntities['CreatePermissionMapper']>;
|
|
115
|
+
};
|
|
116
|
+
UpdatePermissionMapper: {
|
|
117
|
+
toEntity: (
|
|
118
|
+
dto: MapperDomains['UpdatePermissionMapper'],
|
|
119
|
+
em: EntityManager,
|
|
120
|
+
...args: unknown[]
|
|
121
|
+
) => Promise<MapperEntities['UpdatePermissionMapper']>;
|
|
122
|
+
};
|
|
123
|
+
RoleEntityMapper: {
|
|
124
|
+
toEntity: (
|
|
125
|
+
dto: MapperDomains['RoleEntityMapper'],
|
|
126
|
+
em: EntityManager,
|
|
127
|
+
...args: unknown[]
|
|
128
|
+
) => Promise<MapperEntities['RoleEntityMapper']>;
|
|
129
|
+
};
|
|
74
130
|
};
|
|
75
131
|
|
|
76
|
-
type RoleMappers<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
132
|
+
type RoleMappers<
|
|
133
|
+
MapperEntities extends RoleEntities,
|
|
134
|
+
MapperDomains extends RoleDtos
|
|
135
|
+
> = {
|
|
136
|
+
RoleMapper: {
|
|
137
|
+
toDto: (
|
|
138
|
+
entity: MapperEntities['RoleMapper']
|
|
139
|
+
) => Promise<MapperDomains['RoleMapper']>;
|
|
140
|
+
};
|
|
141
|
+
CreateRoleMapper: {
|
|
142
|
+
toEntity: (
|
|
143
|
+
dto: MapperDomains['CreateRoleMapper'],
|
|
144
|
+
em: EntityManager,
|
|
145
|
+
...args: unknown[]
|
|
146
|
+
) => Promise<MapperEntities['CreateRoleMapper']>;
|
|
147
|
+
};
|
|
148
|
+
UpdateRoleMapper: {
|
|
149
|
+
toEntity: (
|
|
150
|
+
dto: MapperDomains['UpdateRoleMapper'],
|
|
151
|
+
em: EntityManager,
|
|
152
|
+
...args: unknown[]
|
|
153
|
+
) => Promise<MapperEntities['UpdateRoleMapper']>;
|
|
154
|
+
};
|
|
86
155
|
};
|
|
87
156
|
|
|
88
|
-
type UserMappers<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
157
|
+
type UserMappers<
|
|
158
|
+
MapperEntities extends UserEntities,
|
|
159
|
+
MapperDomains extends UserDtos
|
|
160
|
+
> = {
|
|
161
|
+
UserMapper: {
|
|
162
|
+
toDto: (
|
|
163
|
+
entity: MapperEntities['UserMapper']
|
|
164
|
+
) => Promise<MapperDomains['UserMapper']>;
|
|
165
|
+
};
|
|
166
|
+
CreateUserMapper: {
|
|
167
|
+
toEntity: (
|
|
168
|
+
dto: MapperDomains['CreateUserMapper'],
|
|
169
|
+
em: EntityManager,
|
|
170
|
+
...args: unknown[]
|
|
171
|
+
) => Promise<MapperEntities['CreateUserMapper']>;
|
|
172
|
+
};
|
|
173
|
+
UpdateUserMapper: {
|
|
174
|
+
toEntity: (
|
|
175
|
+
dto: MapperDomains['UpdateUserMapper'],
|
|
176
|
+
em: EntityManager,
|
|
177
|
+
...args: unknown[]
|
|
178
|
+
) => Promise<MapperEntities['UpdateUserMapper']>;
|
|
179
|
+
};
|
|
98
180
|
};
|
|
99
181
|
|
|
100
|
-
export type {
|
|
182
|
+
export type {
|
|
183
|
+
OrganizationDtos,
|
|
184
|
+
OrganizationEntities,
|
|
185
|
+
OrganizationMappers,
|
|
186
|
+
PermissionDtos,
|
|
187
|
+
PermissionEntities,
|
|
188
|
+
PermissionMappers,
|
|
189
|
+
RoleDtos,
|
|
190
|
+
RoleEntities,
|
|
191
|
+
RoleMappers,
|
|
192
|
+
UserDtos,
|
|
193
|
+
UserEntities,
|
|
194
|
+
UserMappers
|
|
195
|
+
};
|
|
@@ -1,100 +1,195 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
OrganizationDto,
|
|
3
|
+
CreateOrganizationDto,
|
|
4
|
+
UpdateOrganizationDto,
|
|
5
|
+
PermissionDto,
|
|
6
|
+
CreatePermissionDto,
|
|
7
|
+
UpdatePermissionDto,
|
|
8
|
+
UpdateRoleDto,
|
|
9
|
+
RoleDto,
|
|
10
|
+
CreateRoleDto,
|
|
11
|
+
UserDto,
|
|
12
|
+
CreateUserDto,
|
|
13
|
+
UpdateUserDto
|
|
14
|
+
} from '@forklaunch/interfaces-iam/types';
|
|
2
15
|
import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
|
|
3
16
|
import { EntityManager } from '@mikro-orm/core';
|
|
4
17
|
|
|
5
18
|
type OrganizationDtos<OrganizationStatus> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
OrganizationMapper: OrganizationDto<OrganizationStatus>;
|
|
20
|
+
CreateOrganizationMapper: CreateOrganizationDto;
|
|
21
|
+
UpdateOrganizationMapper: UpdateOrganizationDto;
|
|
9
22
|
};
|
|
10
23
|
type PermissionDtos = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
PermissionMapper: PermissionDto;
|
|
25
|
+
CreatePermissionMapper: CreatePermissionDto;
|
|
26
|
+
UpdatePermissionMapper: UpdatePermissionDto;
|
|
27
|
+
RoleEntityMapper: UpdateRoleDto;
|
|
15
28
|
};
|
|
16
29
|
type RoleDtos = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
RoleMapper: RoleDto;
|
|
31
|
+
CreateRoleMapper: CreateRoleDto;
|
|
32
|
+
UpdateRoleMapper: UpdateRoleDto;
|
|
20
33
|
};
|
|
21
34
|
type UserDtos = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
UserMapper: UserDto;
|
|
36
|
+
CreateUserMapper: CreateUserDto;
|
|
37
|
+
UpdateUserMapper: UpdateUserDto;
|
|
25
38
|
};
|
|
26
39
|
|
|
27
40
|
type OrganizationEntities<OrganizationStatus> = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
OrganizationMapper: MapNestedDtoArraysToCollections<
|
|
42
|
+
OrganizationDto<OrganizationStatus>,
|
|
43
|
+
'users'
|
|
44
|
+
>;
|
|
45
|
+
CreateOrganizationMapper: MapNestedDtoArraysToCollections<
|
|
46
|
+
OrganizationDto<OrganizationStatus>,
|
|
47
|
+
'users'
|
|
48
|
+
>;
|
|
49
|
+
UpdateOrganizationMapper: MapNestedDtoArraysToCollections<
|
|
50
|
+
OrganizationDto<OrganizationStatus>,
|
|
51
|
+
'users'
|
|
52
|
+
>;
|
|
31
53
|
};
|
|
32
54
|
type PermissionEntities = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
PermissionMapper: PermissionDto;
|
|
56
|
+
CreatePermissionMapper: PermissionDto;
|
|
57
|
+
UpdatePermissionMapper: PermissionDto;
|
|
58
|
+
RoleEntityMapper: MapNestedDtoArraysToCollections<
|
|
59
|
+
UpdateRoleDto,
|
|
60
|
+
'permissions'
|
|
61
|
+
>;
|
|
37
62
|
};
|
|
38
63
|
type RoleEntities = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
RoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
|
|
65
|
+
CreateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
|
|
66
|
+
UpdateRoleMapper: MapNestedDtoArraysToCollections<RoleDto, 'permissions'>;
|
|
42
67
|
};
|
|
43
68
|
type UserEntities = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
69
|
+
UserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
|
|
70
|
+
CreateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
|
|
71
|
+
UpdateUserMapper: MapNestedDtoArraysToCollections<UserDto, 'roles'>;
|
|
47
72
|
};
|
|
48
73
|
|
|
49
|
-
type OrganizationMappers<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
type OrganizationMappers<
|
|
75
|
+
OrganizationStatus,
|
|
76
|
+
MapperEntities extends OrganizationEntities<OrganizationStatus>,
|
|
77
|
+
MapperDomains extends OrganizationDtos<OrganizationStatus>
|
|
78
|
+
> = {
|
|
79
|
+
OrganizationMapper: {
|
|
80
|
+
toDto: (
|
|
81
|
+
entity: MapperEntities['OrganizationMapper']
|
|
82
|
+
) => Promise<MapperDomains['OrganizationMapper']>;
|
|
83
|
+
};
|
|
84
|
+
CreateOrganizationMapper: {
|
|
85
|
+
toEntity: (
|
|
86
|
+
dto: MapperDomains['CreateOrganizationMapper'],
|
|
87
|
+
em: EntityManager,
|
|
88
|
+
...args: unknown[]
|
|
89
|
+
) => Promise<MapperEntities['CreateOrganizationMapper']>;
|
|
90
|
+
};
|
|
91
|
+
UpdateOrganizationMapper: {
|
|
92
|
+
toEntity: (
|
|
93
|
+
dto: MapperDomains['UpdateOrganizationMapper'],
|
|
94
|
+
em: EntityManager,
|
|
95
|
+
...args: unknown[]
|
|
96
|
+
) => Promise<MapperEntities['UpdateOrganizationMapper']>;
|
|
97
|
+
};
|
|
59
98
|
};
|
|
60
99
|
|
|
61
|
-
type PermissionMappers<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
type PermissionMappers<
|
|
101
|
+
MapperEntities extends PermissionEntities,
|
|
102
|
+
MapperDomains extends PermissionDtos
|
|
103
|
+
> = {
|
|
104
|
+
PermissionMapper: {
|
|
105
|
+
toDto: (
|
|
106
|
+
entity: MapperEntities['PermissionMapper']
|
|
107
|
+
) => Promise<MapperDomains['PermissionMapper']>;
|
|
108
|
+
};
|
|
109
|
+
CreatePermissionMapper: {
|
|
110
|
+
toEntity: (
|
|
111
|
+
dto: MapperDomains['CreatePermissionMapper'],
|
|
112
|
+
em: EntityManager,
|
|
113
|
+
...args: unknown[]
|
|
114
|
+
) => Promise<MapperEntities['CreatePermissionMapper']>;
|
|
115
|
+
};
|
|
116
|
+
UpdatePermissionMapper: {
|
|
117
|
+
toEntity: (
|
|
118
|
+
dto: MapperDomains['UpdatePermissionMapper'],
|
|
119
|
+
em: EntityManager,
|
|
120
|
+
...args: unknown[]
|
|
121
|
+
) => Promise<MapperEntities['UpdatePermissionMapper']>;
|
|
122
|
+
};
|
|
123
|
+
RoleEntityMapper: {
|
|
124
|
+
toEntity: (
|
|
125
|
+
dto: MapperDomains['RoleEntityMapper'],
|
|
126
|
+
em: EntityManager,
|
|
127
|
+
...args: unknown[]
|
|
128
|
+
) => Promise<MapperEntities['RoleEntityMapper']>;
|
|
129
|
+
};
|
|
74
130
|
};
|
|
75
131
|
|
|
76
|
-
type RoleMappers<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
132
|
+
type RoleMappers<
|
|
133
|
+
MapperEntities extends RoleEntities,
|
|
134
|
+
MapperDomains extends RoleDtos
|
|
135
|
+
> = {
|
|
136
|
+
RoleMapper: {
|
|
137
|
+
toDto: (
|
|
138
|
+
entity: MapperEntities['RoleMapper']
|
|
139
|
+
) => Promise<MapperDomains['RoleMapper']>;
|
|
140
|
+
};
|
|
141
|
+
CreateRoleMapper: {
|
|
142
|
+
toEntity: (
|
|
143
|
+
dto: MapperDomains['CreateRoleMapper'],
|
|
144
|
+
em: EntityManager,
|
|
145
|
+
...args: unknown[]
|
|
146
|
+
) => Promise<MapperEntities['CreateRoleMapper']>;
|
|
147
|
+
};
|
|
148
|
+
UpdateRoleMapper: {
|
|
149
|
+
toEntity: (
|
|
150
|
+
dto: MapperDomains['UpdateRoleMapper'],
|
|
151
|
+
em: EntityManager,
|
|
152
|
+
...args: unknown[]
|
|
153
|
+
) => Promise<MapperEntities['UpdateRoleMapper']>;
|
|
154
|
+
};
|
|
86
155
|
};
|
|
87
156
|
|
|
88
|
-
type UserMappers<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
157
|
+
type UserMappers<
|
|
158
|
+
MapperEntities extends UserEntities,
|
|
159
|
+
MapperDomains extends UserDtos
|
|
160
|
+
> = {
|
|
161
|
+
UserMapper: {
|
|
162
|
+
toDto: (
|
|
163
|
+
entity: MapperEntities['UserMapper']
|
|
164
|
+
) => Promise<MapperDomains['UserMapper']>;
|
|
165
|
+
};
|
|
166
|
+
CreateUserMapper: {
|
|
167
|
+
toEntity: (
|
|
168
|
+
dto: MapperDomains['CreateUserMapper'],
|
|
169
|
+
em: EntityManager,
|
|
170
|
+
...args: unknown[]
|
|
171
|
+
) => Promise<MapperEntities['CreateUserMapper']>;
|
|
172
|
+
};
|
|
173
|
+
UpdateUserMapper: {
|
|
174
|
+
toEntity: (
|
|
175
|
+
dto: MapperDomains['UpdateUserMapper'],
|
|
176
|
+
em: EntityManager,
|
|
177
|
+
...args: unknown[]
|
|
178
|
+
) => Promise<MapperEntities['UpdateUserMapper']>;
|
|
179
|
+
};
|
|
98
180
|
};
|
|
99
181
|
|
|
100
|
-
export type {
|
|
182
|
+
export type {
|
|
183
|
+
OrganizationDtos,
|
|
184
|
+
OrganizationEntities,
|
|
185
|
+
OrganizationMappers,
|
|
186
|
+
PermissionDtos,
|
|
187
|
+
PermissionEntities,
|
|
188
|
+
PermissionMappers,
|
|
189
|
+
RoleDtos,
|
|
190
|
+
RoleEntities,
|
|
191
|
+
RoleMappers,
|
|
192
|
+
UserDtos,
|
|
193
|
+
UserEntities,
|
|
194
|
+
UserMappers
|
|
195
|
+
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from ===
|
|
7
|
+
if ((from && typeof from === 'object') || typeof from === 'function') {
|
|
8
8
|
for (let key of __getOwnPropNames(from))
|
|
9
9
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, {
|
|
10
|
+
__defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
11
14
|
}
|
|
12
15
|
return to;
|
|
13
16
|
};
|
|
14
|
-
var __toCommonJS = (mod) =>
|
|
17
|
+
var __toCommonJS = (mod) =>
|
|
18
|
+
__copyProps(__defProp({}, '__esModule', { value: true }), mod);
|
|
15
19
|
|
|
16
20
|
// domain/types/index.ts
|
|
17
21
|
var types_exports = {};
|
|
@@ -31,7 +31,6 @@ export class BaseUserService<
|
|
|
31
31
|
tracing?: boolean;
|
|
32
32
|
};
|
|
33
33
|
public em: EntityManager;
|
|
34
|
-
protected passwordEncryptionPublicKeyPath: string;
|
|
35
34
|
protected roleServiceFactory: () => RoleService;
|
|
36
35
|
protected organizationServiceFactory: () => OrganizationService<OrganizationStatus>;
|
|
37
36
|
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
@@ -40,7 +39,6 @@ export class BaseUserService<
|
|
|
40
39
|
|
|
41
40
|
constructor(
|
|
42
41
|
em: EntityManager,
|
|
43
|
-
passwordEncryptionPublicKeyPath: string,
|
|
44
42
|
roleServiceFactory: () => RoleService,
|
|
45
43
|
organizationServiceFactory: () => OrganizationService<OrganizationStatus>,
|
|
46
44
|
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
@@ -51,7 +49,6 @@ export class BaseUserService<
|
|
|
51
49
|
}
|
|
52
50
|
) {
|
|
53
51
|
this.em = em;
|
|
54
|
-
this.passwordEncryptionPublicKeyPath = passwordEncryptionPublicKeyPath;
|
|
55
52
|
this.roleServiceFactory = roleServiceFactory;
|
|
56
53
|
this.organizationServiceFactory = organizationServiceFactory;
|
|
57
54
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
@@ -222,40 +219,29 @@ export class BaseUserService<
|
|
|
222
219
|
await (em ?? this.em).nativeDelete('User', idsDto);
|
|
223
220
|
}
|
|
224
221
|
|
|
225
|
-
async
|
|
222
|
+
async surfaceRoles(
|
|
223
|
+
idDto: IdDto,
|
|
224
|
+
em?: EntityManager
|
|
225
|
+
): Promise<MapperDomains['UserMapper']['roles']> {
|
|
226
226
|
if (this.evaluatedTelemetryOptions.logging) {
|
|
227
|
-
this.openTelemetryCollector.info('
|
|
228
|
-
idDto
|
|
229
|
-
roleId
|
|
227
|
+
this.openTelemetryCollector.info('Surfacing user roles', {
|
|
228
|
+
idDto
|
|
230
229
|
});
|
|
231
230
|
}
|
|
232
|
-
const user = await this.getUser(idDto);
|
|
233
|
-
|
|
234
|
-
user.roles.filter((role) => {
|
|
235
|
-
return roleId == role.id;
|
|
236
|
-
}).length === 0
|
|
237
|
-
) {
|
|
238
|
-
throw new Error(`User ${idDto.id} does not have role ${roleId}`);
|
|
239
|
-
}
|
|
231
|
+
const user = await this.getUser(idDto, em);
|
|
232
|
+
return user.roles;
|
|
240
233
|
}
|
|
241
234
|
|
|
242
|
-
async
|
|
235
|
+
async surfacePermissions(
|
|
236
|
+
idDto: IdDto,
|
|
237
|
+
em?: EntityManager
|
|
238
|
+
): Promise<MapperDomains['UserMapper']['roles'][0]['permissions']> {
|
|
243
239
|
if (this.evaluatedTelemetryOptions.logging) {
|
|
244
|
-
this.openTelemetryCollector.info('
|
|
245
|
-
idDto
|
|
246
|
-
permissionId
|
|
240
|
+
this.openTelemetryCollector.info('Surfacing user permissions', {
|
|
241
|
+
idDto
|
|
247
242
|
});
|
|
248
243
|
}
|
|
249
|
-
const user = await this.getUser(idDto);
|
|
250
|
-
|
|
251
|
-
user.roles
|
|
252
|
-
.map((role) => role.permissions.map((permission) => permission.id))
|
|
253
|
-
.flat()
|
|
254
|
-
.filter((id) => id == permissionId).length === 0
|
|
255
|
-
) {
|
|
256
|
-
throw new Error(
|
|
257
|
-
`User ${idDto.id} does not have permission ${permissionId}`
|
|
258
|
-
);
|
|
259
|
-
}
|
|
244
|
+
const user = await this.getUser(idDto, em);
|
|
245
|
+
return user.roles.map((role) => role.permissions).flat();
|
|
260
246
|
}
|
|
261
247
|
}
|