@forklaunch/implementation-iam-base 0.6.4 → 0.7.1

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,5 +1,7 @@
1
1
  // services/organization.service.ts
2
- import { evaluateTelemetryOptions } from '@forklaunch/core/http';
2
+ import {
3
+ evaluateTelemetryOptions
4
+ } from "@forklaunch/core/http";
3
5
  var BaseOrganizationService = class {
4
6
  // protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
5
7
  evaluatedTelemetryOptions;
@@ -12,18 +14,16 @@ var BaseOrganizationService = class {
12
14
  this.openTelemetryCollector = openTelemetryCollector;
13
15
  this.schemaValidator = schemaValidator;
14
16
  this.mappers = mappers;
15
- this.evaluatedTelemetryOptions = options?.telemetry
16
- ? evaluateTelemetryOptions(options.telemetry).enabled
17
- : {
18
- logging: false,
19
- metrics: false,
20
- tracing: false
21
- };
17
+ this.evaluatedTelemetryOptions = options?.telemetry ? evaluateTelemetryOptions(options.telemetry).enabled : {
18
+ logging: false,
19
+ metrics: false,
20
+ tracing: false
21
+ };
22
22
  }
23
23
  async createOrganization(organizationDto, em, ...args) {
24
24
  if (this.evaluatedTelemetryOptions.logging) {
25
25
  this.openTelemetryCollector.info(
26
- 'Creating organization',
26
+ "Creating organization",
27
27
  organizationDto
28
28
  );
29
29
  }
@@ -41,30 +41,31 @@ var BaseOrganizationService = class {
41
41
  }
42
42
  async getOrganization(idDto, em) {
43
43
  if (this.evaluatedTelemetryOptions.logging) {
44
- this.openTelemetryCollector.info('Getting organization', idDto);
44
+ this.openTelemetryCollector.info("Getting organization", idDto);
45
45
  }
46
46
  const organization = await (em ?? this.em).findOneOrFail(
47
- 'Organization',
47
+ "Organization",
48
48
  idDto,
49
49
  {
50
- populate: ['id', '*']
50
+ populate: ["id", "*"]
51
51
  }
52
52
  );
53
- return this.mappers.OrganizationMapper.toDto(organization);
53
+ return this.mappers.OrganizationMapper.toDto(
54
+ organization
55
+ );
54
56
  }
55
57
  async updateOrganization(organizationDto, em, ...args) {
56
58
  if (this.evaluatedTelemetryOptions.logging) {
57
59
  this.openTelemetryCollector.info(
58
- 'Updating organization',
60
+ "Updating organization",
59
61
  organizationDto
60
62
  );
61
63
  }
62
- const updatedOrganization =
63
- await this.mappers.UpdateOrganizationMapper.toEntity(
64
- organizationDto,
65
- em ?? this.em,
66
- ...args
67
- );
64
+ const updatedOrganization = await this.mappers.UpdateOrganizationMapper.toEntity(
65
+ organizationDto,
66
+ em ?? this.em,
67
+ ...args
68
+ );
68
69
  if (em) {
69
70
  await em.persist(updatedOrganization);
70
71
  } else {
@@ -74,18 +75,20 @@ var BaseOrganizationService = class {
74
75
  }
75
76
  async deleteOrganization(idDto, em) {
76
77
  if (this.evaluatedTelemetryOptions.logging) {
77
- this.openTelemetryCollector.info('Deleting organization', idDto);
78
+ this.openTelemetryCollector.info("Deleting organization", idDto);
78
79
  }
79
80
  if (em) {
80
- await em.nativeDelete('Organization', idDto);
81
+ await em.nativeDelete("Organization", idDto);
81
82
  } else {
82
- await this.em.nativeDelete('Organization', idDto);
83
+ await this.em.nativeDelete("Organization", idDto);
83
84
  }
84
85
  }
85
86
  };
86
87
 
87
88
  // services/permission.service.ts
88
- import { evaluateTelemetryOptions as evaluateTelemetryOptions2 } from '@forklaunch/core/http';
89
+ import {
90
+ evaluateTelemetryOptions as evaluateTelemetryOptions2
91
+ } from "@forklaunch/core/http";
89
92
  var BasePermissionService = class {
90
93
  evaluatedTelemetryOptions;
91
94
  em;
@@ -93,26 +96,17 @@ var BasePermissionService = class {
93
96
  openTelemetryCollector;
94
97
  schemaValidator;
95
98
  mappers;
96
- constructor(
97
- em,
98
- roleServiceFactory,
99
- openTelemetryCollector,
100
- schemaValidator,
101
- mappers,
102
- options
103
- ) {
99
+ constructor(em, roleServiceFactory, openTelemetryCollector, schemaValidator, mappers, options) {
104
100
  this.em = em;
105
101
  this.roleServiceFactory = roleServiceFactory;
106
102
  this.openTelemetryCollector = openTelemetryCollector;
107
103
  this.schemaValidator = schemaValidator;
108
104
  this.mappers = mappers;
109
- this.evaluatedTelemetryOptions = options?.telemetry
110
- ? evaluateTelemetryOptions2(options.telemetry).enabled
111
- : {
112
- logging: false,
113
- metrics: false,
114
- tracing: false
115
- };
105
+ this.evaluatedTelemetryOptions = options?.telemetry ? evaluateTelemetryOptions2(options.telemetry).enabled : {
106
+ logging: false,
107
+ metrics: false,
108
+ tracing: false
109
+ };
116
110
  }
117
111
  // start: global helper functions
118
112
  async updateRolesWithPermissions(roles, permissions) {
@@ -126,32 +120,33 @@ var BasePermissionService = class {
126
120
  async removePermissionsFromRoles(roles, permissions) {
127
121
  return Promise.all(
128
122
  roles.map(async (role) => {
129
- permissions.forEach((permission) =>
130
- role.permissions.remove(permission)
123
+ permissions.forEach(
124
+ (permission) => role.permissions.remove(permission)
131
125
  );
132
126
  return role;
133
127
  })
134
128
  );
135
129
  }
136
130
  async getBatchRoles(roles, em) {
137
- return roles
138
- ? await Promise.all(
139
- (await this.roleServiceFactory().getBatchRoles(roles, em)).map(
140
- async (role) => {
141
- return (em ?? this.em).merge(
142
- await this.mappers.RoleEntityMapper.toEntity(
143
- role,
144
- em ?? this.em
145
- )
146
- );
147
- }
148
- )
149
- )
150
- : [];
131
+ return roles ? await Promise.all(
132
+ (await this.roleServiceFactory().getBatchRoles(roles, em)).map(
133
+ async (role) => {
134
+ return (em ?? this.em).merge(
135
+ await this.mappers.RoleEntityMapper.toEntity(
136
+ role,
137
+ em ?? this.em
138
+ )
139
+ );
140
+ }
141
+ )
142
+ ) : [];
151
143
  }
152
144
  // end: global helper functions
153
145
  // start: createPermission helper functions
154
- async createPermissionEntity({ permission, addToRoles }) {
146
+ async createPermissionEntity({
147
+ permission,
148
+ addToRoles
149
+ }) {
155
150
  let roles = [];
156
151
  if (addToRoles) {
157
152
  roles = await this.updateRolesWithPermissions(addToRoles, [permission]);
@@ -167,16 +162,14 @@ var BasePermissionService = class {
167
162
  ...args
168
163
  )
169
164
  ),
170
- addToRoles: permissionDto.addToRolesIds
171
- ? await this.getBatchRoles({ ids: permissionDto.addToRolesIds }, em)
172
- : []
165
+ addToRoles: permissionDto.addToRolesIds ? await this.getBatchRoles({ ids: permissionDto.addToRolesIds }, em) : []
173
166
  };
174
167
  }
175
168
  // end: createPermission helper functions
176
169
  async createPermission(createPermissionEntity, em, ...args) {
177
170
  if (this.evaluatedTelemetryOptions.logging) {
178
171
  this.openTelemetryCollector.info(
179
- 'Creating permission',
172
+ "Creating permission",
180
173
  createPermissionEntity
181
174
  );
182
175
  }
@@ -197,7 +190,7 @@ var BasePermissionService = class {
197
190
  async createBatchPermissions(permissionDtos, em) {
198
191
  if (this.evaluatedTelemetryOptions.logging) {
199
192
  this.openTelemetryCollector.info(
200
- 'Creating batch permissions',
193
+ "Creating batch permissions",
201
194
  permissionDtos
202
195
  );
203
196
  }
@@ -225,10 +218,7 @@ var BasePermissionService = class {
225
218
  })
226
219
  );
227
220
  roles.forEach((role) => {
228
- if (
229
- rolesCache[role.id] &&
230
- role.permissions !== rolesCache[role.id].permissions
231
- ) {
221
+ if (rolesCache[role.id] && role.permissions !== rolesCache[role.id].permissions) {
232
222
  role.permissions.getItems().forEach((permission2) => {
233
223
  if (!rolesCache[role.id].permissions.contains(permission2)) {
234
224
  rolesCache[role.id].permissions.add(permission2);
@@ -247,25 +237,29 @@ var BasePermissionService = class {
247
237
  await this.em.persistAndFlush(entities);
248
238
  }
249
239
  return Promise.all(
250
- permissions.map(async (permission) =>
251
- this.mappers.PermissionMapper.toDto(permission)
240
+ permissions.map(
241
+ async (permission) => this.mappers.PermissionMapper.toDto(permission)
252
242
  )
253
243
  );
254
244
  }
255
245
  async getPermission(idDto, em) {
256
246
  if (this.evaluatedTelemetryOptions.logging) {
257
- this.openTelemetryCollector.info('Getting permission', idDto);
247
+ this.openTelemetryCollector.info("Getting permission", idDto);
258
248
  }
259
- const permission = await (em ?? this.em).findOneOrFail('Permission', idDto);
260
- return this.mappers.PermissionMapper.toDto(permission);
249
+ const permission = await (em ?? this.em).findOneOrFail("Permission", idDto);
250
+ return this.mappers.PermissionMapper.toDto(
251
+ permission
252
+ );
261
253
  }
262
254
  async getBatchPermissions(idsDto, em) {
263
255
  if (this.evaluatedTelemetryOptions.logging) {
264
- this.openTelemetryCollector.info('Getting batch permissions', idsDto);
256
+ this.openTelemetryCollector.info("Getting batch permissions", idsDto);
265
257
  }
266
258
  return Promise.all(
267
- (await (em ?? this.em).find('Permission', idsDto)).map((permission) =>
268
- this.mappers.PermissionMapper.toDto(permission)
259
+ (await (em ?? this.em).find("Permission", idsDto)).map(
260
+ (permission) => this.mappers.PermissionMapper.toDto(
261
+ permission
262
+ )
269
263
  )
270
264
  );
271
265
  }
@@ -276,12 +270,8 @@ var BasePermissionService = class {
276
270
  em ?? this.em,
277
271
  ...args
278
272
  );
279
- const addToRoles = permissionDto.addToRolesIds
280
- ? await this.getBatchRoles({ ids: permissionDto.addToRolesIds }, em)
281
- : [];
282
- const removeFromRoles = permissionDto.removeFromRolesIds
283
- ? await this.getBatchRoles({ ids: permissionDto.removeFromRolesIds }, em)
284
- : [];
273
+ const addToRoles = permissionDto.addToRolesIds ? await this.getBatchRoles({ ids: permissionDto.addToRolesIds }, em) : [];
274
+ const removeFromRoles = permissionDto.removeFromRolesIds ? await this.getBatchRoles({ ids: permissionDto.removeFromRolesIds }, em) : [];
285
275
  let roles = [];
286
276
  roles = roles.concat(
287
277
  await this.updateRolesWithPermissions(addToRoles, [permission])
@@ -297,7 +287,7 @@ var BasePermissionService = class {
297
287
  // end: updatePermission helper functions
298
288
  async updatePermission(permissionDto, em) {
299
289
  if (this.evaluatedTelemetryOptions.logging) {
300
- this.openTelemetryCollector.info('Updating permission', permissionDto);
290
+ this.openTelemetryCollector.info("Updating permission", permissionDto);
301
291
  }
302
292
  const { permission, roles } = await this.updatePermissionDto(permissionDto);
303
293
  const entities = await (em ?? this.em).upsertMany([permission, ...roles]);
@@ -311,7 +301,7 @@ var BasePermissionService = class {
311
301
  async updateBatchPermissions(permissionDtos, em) {
312
302
  if (this.evaluatedTelemetryOptions.logging) {
313
303
  this.openTelemetryCollector.info(
314
- 'Updating batch permissions',
304
+ "Updating batch permissions",
315
305
  permissionDtos
316
306
  );
317
307
  }
@@ -319,13 +309,9 @@ var BasePermissionService = class {
319
309
  const permissions = [];
320
310
  await (em ?? this.em).transactional(async (em2) => {
321
311
  permissionDtos.map(async (updatePermissionDto) => {
322
- const { permission, roles } =
323
- await this.updatePermissionDto(updatePermissionDto);
312
+ const { permission, roles } = await this.updatePermissionDto(updatePermissionDto);
324
313
  roles.forEach((role) => {
325
- if (
326
- rolesCache[role.id] &&
327
- role.permissions !== rolesCache[role.id].permissions
328
- ) {
314
+ if (rolesCache[role.id] && role.permissions !== rolesCache[role.id].permissions) {
329
315
  role.permissions.getItems().forEach((permission2) => {
330
316
  if (!rolesCache[role.id].permissions.contains(permission2)) {
331
317
  rolesCache[role.id].permissions.add(permission2);
@@ -345,29 +331,31 @@ var BasePermissionService = class {
345
331
  }
346
332
  });
347
333
  return Promise.all(
348
- permissions.map((permission) =>
349
- this.mappers.PermissionMapper.toDto(permission)
334
+ permissions.map(
335
+ (permission) => this.mappers.PermissionMapper.toDto(permission)
350
336
  )
351
337
  );
352
338
  }
353
339
  async deletePermission(idDto, em) {
354
340
  if (this.evaluatedTelemetryOptions.logging) {
355
- this.openTelemetryCollector.info('Deleting permission', idDto);
341
+ this.openTelemetryCollector.info("Deleting permission", idDto);
356
342
  }
357
- await (em ?? this.em).nativeDelete('Permission', idDto);
343
+ await (em ?? this.em).nativeDelete("Permission", idDto);
358
344
  }
359
345
  async deleteBatchPermissions(idsDto, em) {
360
346
  if (this.evaluatedTelemetryOptions.logging) {
361
- this.openTelemetryCollector.info('Deleting batch permissions', idsDto);
347
+ this.openTelemetryCollector.info("Deleting batch permissions", idsDto);
362
348
  }
363
- await (em ?? this.em).nativeDelete('Permission', {
349
+ await (em ?? this.em).nativeDelete("Permission", {
364
350
  id: { $in: idsDto.ids }
365
351
  });
366
352
  }
367
353
  };
368
354
 
369
355
  // services/role.service.ts
370
- import { evaluateTelemetryOptions as evaluateTelemetryOptions3 } from '@forklaunch/core/http';
356
+ import {
357
+ evaluateTelemetryOptions as evaluateTelemetryOptions3
358
+ } from "@forklaunch/core/http";
371
359
  var BaseRoleService = class {
372
360
  evaluatedTelemetryOptions;
373
361
  em;
@@ -379,17 +367,15 @@ var BaseRoleService = class {
379
367
  this.openTelemetryCollector = openTelemetryCollector;
380
368
  this.schemaValidator = schemaValidator;
381
369
  this.mappers = mappers;
382
- this.evaluatedTelemetryOptions = options?.telemetry
383
- ? evaluateTelemetryOptions3(options.telemetry).enabled
384
- : {
385
- logging: false,
386
- metrics: false,
387
- tracing: false
388
- };
370
+ this.evaluatedTelemetryOptions = options?.telemetry ? evaluateTelemetryOptions3(options.telemetry).enabled : {
371
+ logging: false,
372
+ metrics: false,
373
+ tracing: false
374
+ };
389
375
  }
390
376
  async createRole(roleDto, em, ...args) {
391
377
  if (this.evaluatedTelemetryOptions.logging) {
392
- this.openTelemetryCollector.info('Creating role', roleDto);
378
+ this.openTelemetryCollector.info("Creating role", roleDto);
393
379
  }
394
380
  const role = await this.mappers.CreateRoleMapper.toEntity(
395
381
  roleDto,
@@ -405,11 +391,11 @@ var BaseRoleService = class {
405
391
  }
406
392
  async createBatchRoles(roleDtos, em, ...args) {
407
393
  if (this.evaluatedTelemetryOptions.logging) {
408
- this.openTelemetryCollector.info('Creating batch roles', roleDtos);
394
+ this.openTelemetryCollector.info("Creating batch roles", roleDtos);
409
395
  }
410
396
  const roles = await Promise.all(
411
- roleDtos.map(async (roleDto) =>
412
- this.mappers.CreateRoleMapper.toEntity(roleDto, em ?? this.em, ...args)
397
+ roleDtos.map(
398
+ async (roleDto) => this.mappers.CreateRoleMapper.toEntity(roleDto, em ?? this.em, ...args)
413
399
  )
414
400
  );
415
401
  if (em) {
@@ -423,34 +409,34 @@ var BaseRoleService = class {
423
409
  }
424
410
  async getRole({ id }, em) {
425
411
  if (this.evaluatedTelemetryOptions.logging) {
426
- this.openTelemetryCollector.info('Getting role', { id });
412
+ this.openTelemetryCollector.info("Getting role", { id });
427
413
  }
428
- const role = await (em ?? this.em).findOneOrFail('Role', id, {
429
- populate: ['id', '*']
414
+ const role = await (em ?? this.em).findOneOrFail("Role", id, {
415
+ populate: ["id", "*"]
430
416
  });
431
417
  return this.mappers.RoleMapper.toDto(role);
432
418
  }
433
419
  async getBatchRoles({ ids }, em) {
434
420
  if (this.evaluatedTelemetryOptions.logging) {
435
- this.openTelemetryCollector.info('Getting batch roles', { ids });
421
+ this.openTelemetryCollector.info("Getting batch roles", { ids });
436
422
  }
437
423
  return Promise.all(
438
- (
439
- await (em ?? this.em).find(
440
- 'Role',
441
- {
442
- id: { $in: ids }
443
- },
444
- {
445
- populate: ['id', '*']
446
- }
447
- )
448
- ).map((role) => this.mappers.RoleMapper.toDto(role))
424
+ (await (em ?? this.em).find(
425
+ "Role",
426
+ {
427
+ id: { $in: ids }
428
+ },
429
+ {
430
+ populate: ["id", "*"]
431
+ }
432
+ )).map(
433
+ (role) => this.mappers.RoleMapper.toDto(role)
434
+ )
449
435
  );
450
436
  }
451
437
  async updateRole(roleDto, em, ...args) {
452
438
  if (this.evaluatedTelemetryOptions.logging) {
453
- this.openTelemetryCollector.info('Updating role', roleDto);
439
+ this.openTelemetryCollector.info("Updating role", roleDto);
454
440
  }
455
441
  const role = await this.mappers.UpdateRoleMapper.toEntity(
456
442
  roleDto,
@@ -466,11 +452,11 @@ var BaseRoleService = class {
466
452
  }
467
453
  async updateBatchRoles(roleDtos, em, ...args) {
468
454
  if (this.evaluatedTelemetryOptions.logging) {
469
- this.openTelemetryCollector.info('Updating batch roles', roleDtos);
455
+ this.openTelemetryCollector.info("Updating batch roles", roleDtos);
470
456
  }
471
457
  const roles = await Promise.all(
472
- roleDtos.map(async (roleDto) =>
473
- this.mappers.UpdateRoleMapper.toEntity(roleDto, em ?? this.em, ...args)
458
+ roleDtos.map(
459
+ async (roleDto) => this.mappers.UpdateRoleMapper.toEntity(roleDto, em ?? this.em, ...args)
474
460
  )
475
461
  );
476
462
  if (em) {
@@ -479,25 +465,29 @@ var BaseRoleService = class {
479
465
  await this.em.persistAndFlush(roles);
480
466
  }
481
467
  return Promise.all(
482
- roles.map((role) => this.mappers.RoleMapper.toDto(role))
468
+ roles.map(
469
+ (role) => this.mappers.RoleMapper.toDto(role)
470
+ )
483
471
  );
484
472
  }
485
473
  async deleteRole(idDto, em) {
486
474
  if (this.evaluatedTelemetryOptions.logging) {
487
- this.openTelemetryCollector.info('Deleting role', idDto);
475
+ this.openTelemetryCollector.info("Deleting role", idDto);
488
476
  }
489
- await (em ?? this.em).nativeDelete('Role', idDto);
477
+ await (em ?? this.em).nativeDelete("Role", idDto);
490
478
  }
491
479
  async deleteBatchRoles(idsDto, em) {
492
480
  if (this.evaluatedTelemetryOptions.logging) {
493
- this.openTelemetryCollector.info('Deleting batch roles', idsDto);
481
+ this.openTelemetryCollector.info("Deleting batch roles", idsDto);
494
482
  }
495
- await (em ?? this.em).nativeDelete('Role', { id: { $in: idsDto.ids } });
483
+ await (em ?? this.em).nativeDelete("Role", { id: { $in: idsDto.ids } });
496
484
  }
497
485
  };
498
486
 
499
487
  // services/user.service.ts
500
- import { evaluateTelemetryOptions as evaluateTelemetryOptions4 } from '@forklaunch/core/http';
488
+ import {
489
+ evaluateTelemetryOptions as evaluateTelemetryOptions4
490
+ } from "@forklaunch/core/http";
501
491
  var BaseUserService = class {
502
492
  evaluatedTelemetryOptions;
503
493
  em;
@@ -506,32 +496,22 @@ var BaseUserService = class {
506
496
  openTelemetryCollector;
507
497
  schemaValidator;
508
498
  mappers;
509
- constructor(
510
- em,
511
- roleServiceFactory,
512
- organizationServiceFactory,
513
- openTelemetryCollector,
514
- schemaValidator,
515
- mappers,
516
- options
517
- ) {
499
+ constructor(em, roleServiceFactory, organizationServiceFactory, openTelemetryCollector, schemaValidator, mappers, options) {
518
500
  this.em = em;
519
501
  this.roleServiceFactory = roleServiceFactory;
520
502
  this.organizationServiceFactory = organizationServiceFactory;
521
503
  this.openTelemetryCollector = openTelemetryCollector;
522
504
  this.schemaValidator = schemaValidator;
523
505
  this.mappers = mappers;
524
- this.evaluatedTelemetryOptions = options?.telemetry
525
- ? evaluateTelemetryOptions4(options.telemetry).enabled
526
- : {
527
- logging: false,
528
- metrics: false,
529
- tracing: false
530
- };
506
+ this.evaluatedTelemetryOptions = options?.telemetry ? evaluateTelemetryOptions4(options.telemetry).enabled : {
507
+ logging: false,
508
+ metrics: false,
509
+ tracing: false
510
+ };
531
511
  }
532
512
  async createUser(userDto, em, ...args) {
533
513
  if (this.evaluatedTelemetryOptions.logging) {
534
- this.openTelemetryCollector.info('Creating user', userDto);
514
+ this.openTelemetryCollector.info("Creating user", userDto);
535
515
  }
536
516
  const user = await this.mappers.CreateUserMapper.toEntity(
537
517
  userDto,
@@ -547,11 +527,11 @@ var BaseUserService = class {
547
527
  }
548
528
  async createBatchUsers(userDtos, em, ...args) {
549
529
  if (this.evaluatedTelemetryOptions.logging) {
550
- this.openTelemetryCollector.info('Creating batch users', userDtos);
530
+ this.openTelemetryCollector.info("Creating batch users", userDtos);
551
531
  }
552
532
  const users = await Promise.all(
553
- userDtos.map(async (createUserDto) =>
554
- this.mappers.CreateUserMapper.toEntity(
533
+ userDtos.map(
534
+ async (createUserDto) => this.mappers.CreateUserMapper.toEntity(
555
535
  createUserDto,
556
536
  em ?? this.em,
557
537
  ...args
@@ -567,30 +547,36 @@ var BaseUserService = class {
567
547
  users.map((user) => this.mappers.UserMapper.toDto(user))
568
548
  );
569
549
  }
550
+ async getOrganizationIdByUserId(idDto, em) {
551
+ const user = await (em ?? this.em).findOneOrFail("User", idDto, {
552
+ populate: ["id", "organization"]
553
+ });
554
+ return user.organization?.id;
555
+ }
570
556
  async getUser(idDto, em) {
571
557
  if (this.evaluatedTelemetryOptions.logging) {
572
- this.openTelemetryCollector.info('Getting user', idDto);
558
+ this.openTelemetryCollector.info("Getting user", idDto);
573
559
  }
574
- const user = await (em ?? this.em).findOneOrFail('User', idDto, {
575
- populate: ['id', '*']
560
+ const user = await (em ?? this.em).findOneOrFail("User", idDto, {
561
+ populate: ["id", "*"]
576
562
  });
577
563
  return this.mappers.UserMapper.toDto(user);
578
564
  }
579
565
  async getBatchUsers(idsDto, em) {
580
566
  if (this.evaluatedTelemetryOptions.logging) {
581
- this.openTelemetryCollector.info('Getting batch users', idsDto);
567
+ this.openTelemetryCollector.info("Getting batch users", idsDto);
582
568
  }
583
569
  return Promise.all(
584
- (
585
- await (em ?? this.em).find('User', idsDto, {
586
- populate: ['id', '*']
587
- })
588
- ).map((user) => this.mappers.UserMapper.toDto(user))
570
+ (await (em ?? this.em).find("User", idsDto, {
571
+ populate: ["id", "*"]
572
+ })).map(
573
+ (user) => this.mappers.UserMapper.toDto(user)
574
+ )
589
575
  );
590
576
  }
591
577
  async updateUser(userDto, em, ...args) {
592
578
  if (this.evaluatedTelemetryOptions.logging) {
593
- this.openTelemetryCollector.info('Updating user', userDto);
579
+ this.openTelemetryCollector.info("Updating user", userDto);
594
580
  }
595
581
  const user = await this.mappers.UpdateUserMapper.toEntity(
596
582
  userDto,
@@ -606,11 +592,11 @@ var BaseUserService = class {
606
592
  }
607
593
  async updateBatchUsers(userDtos, em, ...args) {
608
594
  if (this.evaluatedTelemetryOptions.logging) {
609
- this.openTelemetryCollector.info('Updating batch users', userDtos);
595
+ this.openTelemetryCollector.info("Updating batch users", userDtos);
610
596
  }
611
597
  const users = await Promise.all(
612
- userDtos.map(async (updateUserDto) =>
613
- this.mappers.UpdateUserMapper.toEntity(
598
+ userDtos.map(
599
+ async (updateUserDto) => this.mappers.UpdateUserMapper.toEntity(
614
600
  updateUserDto,
615
601
  em ?? this.em,
616
602
  ...args
@@ -628,19 +614,19 @@ var BaseUserService = class {
628
614
  }
629
615
  async deleteUser(idDto, em) {
630
616
  if (this.evaluatedTelemetryOptions.logging) {
631
- this.openTelemetryCollector.info('Deleting user', idDto);
617
+ this.openTelemetryCollector.info("Deleting user", idDto);
632
618
  }
633
- await (em ?? this.em).nativeDelete('User', idDto);
619
+ await (em ?? this.em).nativeDelete("User", idDto);
634
620
  }
635
621
  async deleteBatchUsers(idsDto, em) {
636
622
  if (this.evaluatedTelemetryOptions.logging) {
637
- this.openTelemetryCollector.info('Deleting batch users', idsDto);
623
+ this.openTelemetryCollector.info("Deleting batch users", idsDto);
638
624
  }
639
- await (em ?? this.em).nativeDelete('User', idsDto);
625
+ await (em ?? this.em).nativeDelete("User", idsDto);
640
626
  }
641
627
  async surfaceRoles(idDto, em) {
642
628
  if (this.evaluatedTelemetryOptions.logging) {
643
- this.openTelemetryCollector.info('Surfacing user roles', {
629
+ this.openTelemetryCollector.info("Surfacing user roles", {
644
630
  idDto
645
631
  });
646
632
  }
@@ -649,7 +635,7 @@ var BaseUserService = class {
649
635
  }
650
636
  async surfacePermissions(idDto, em) {
651
637
  if (this.evaluatedTelemetryOptions.logging) {
652
- this.openTelemetryCollector.info('Surfacing user permissions', {
638
+ this.openTelemetryCollector.info("Surfacing user permissions", {
653
639
  idDto
654
640
  });
655
641
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-iam-base",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "description": "Billing basic implementation for forklaunch",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -36,21 +36,21 @@
36
36
  "lib/**"
37
37
  ],
38
38
  "dependencies": {
39
- "@forklaunch/common": "^0.6.7",
40
- "@forklaunch/core": "^0.14.9",
41
- "@forklaunch/internal": "^0.3.7",
42
- "@forklaunch/validator": "^0.10.7",
43
- "@mikro-orm/core": "^6.5.2",
39
+ "@forklaunch/common": "^0.6.13",
40
+ "@forklaunch/core": "^0.15.2",
41
+ "@forklaunch/internal": "^0.3.13",
42
+ "@forklaunch/validator": "^0.10.13",
43
+ "@mikro-orm/core": "^6.5.5",
44
44
  "@sinclair/typebox": "^0.34.41",
45
45
  "ajv": "^8.17.1",
46
- "zod": "^4.1.8",
47
- "@forklaunch/interfaces-iam": "0.6.4"
46
+ "zod": "^4.1.11",
47
+ "@forklaunch/interfaces-iam": "0.7.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@typescript/native-preview": "7.0.0-dev.20250911.1",
50
+ "@typescript/native-preview": "7.0.0-dev.20250924.1",
51
51
  "depcheck": "^1.4.7",
52
52
  "prettier": "^3.6.2",
53
- "typedoc": "^0.28.12"
53
+ "typedoc": "^0.28.13"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc --noEmit && tsup domain/schemas/index.ts services/index.ts domain/types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",