@forklaunch/implementation-iam-base 0.1.4 → 0.1.5
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/__test__/schemaEquality.test.js +6 -6
- package/lib/eject/schemas/index.ts +4 -0
- package/lib/eject/schemas/organization.schema.ts +14 -12
- package/lib/eject/schemas/permission.schema.ts +7 -1
- package/lib/eject/schemas/role.schema.ts +17 -16
- package/lib/eject/schemas/user.schema.ts +21 -20
- package/lib/eject/services/index.ts +4 -0
- package/lib/eject/services/organization.service.ts +6 -6
- package/lib/eject/services/permission.service.ts +9 -6
- package/lib/eject/services/role.service.ts +6 -6
- package/lib/eject/services/user.service.ts +11 -9
- package/lib/schemas/index.d.ts +5 -0
- package/lib/schemas/index.d.ts.map +1 -0
- package/lib/schemas/index.js +4 -0
- package/lib/schemas/organization.schema.d.ts +140 -6
- package/lib/schemas/organization.schema.d.ts.map +1 -1
- package/lib/schemas/organization.schema.js +2 -12
- package/lib/schemas/permission.schema.d.ts.map +1 -1
- package/lib/schemas/permission.schema.js +2 -12
- package/lib/schemas/role.schema.d.ts +28 -4
- package/lib/schemas/role.schema.d.ts.map +1 -1
- package/lib/schemas/role.schema.js +2 -12
- package/lib/schemas/typebox/organization.schema.d.ts +81 -5
- package/lib/schemas/typebox/organization.schema.d.ts.map +1 -1
- package/lib/schemas/typebox/organization.schema.js +9 -3
- package/lib/schemas/typebox/permission.schema.d.ts +21 -0
- package/lib/schemas/typebox/permission.schema.d.ts.map +1 -1
- package/lib/schemas/typebox/permission.schema.js +5 -0
- package/lib/schemas/typebox/role.schema.d.ts +35 -4
- package/lib/schemas/typebox/role.schema.d.ts.map +1 -1
- package/lib/schemas/typebox/role.schema.js +8 -2
- package/lib/schemas/typebox/user.schema.d.ts +64 -4
- package/lib/schemas/typebox/user.schema.d.ts.map +1 -1
- package/lib/schemas/typebox/user.schema.js +8 -2
- package/lib/schemas/user.schema.d.ts +68 -4
- package/lib/schemas/user.schema.d.ts.map +1 -1
- package/lib/schemas/user.schema.js +2 -12
- package/lib/schemas/zod/organization.schema.d.ts +253 -5
- package/lib/schemas/zod/organization.schema.d.ts.map +1 -1
- package/lib/schemas/zod/organization.schema.js +9 -3
- package/lib/schemas/zod/permission.schema.d.ts +21 -0
- package/lib/schemas/zod/permission.schema.d.ts.map +1 -1
- package/lib/schemas/zod/permission.schema.js +5 -0
- package/lib/schemas/zod/role.schema.d.ts +59 -4
- package/lib/schemas/zod/role.schema.d.ts.map +1 -1
- package/lib/schemas/zod/role.schema.js +8 -2
- package/lib/schemas/zod/user.schema.d.ts +140 -4
- package/lib/schemas/zod/user.schema.d.ts.map +1 -1
- package/lib/schemas/zod/user.schema.js +8 -2
- package/lib/services/index.d.ts +5 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +4 -0
- package/lib/services/organization.service.d.ts +2 -1
- package/lib/services/organization.service.d.ts.map +1 -1
- package/lib/services/permission.service.d.ts +2 -1
- package/lib/services/permission.service.d.ts.map +1 -1
- package/lib/services/role.service.d.ts +2 -1
- package/lib/services/role.service.d.ts.map +1 -1
- package/lib/services/user.service.d.ts +3 -3
- package/lib/services/user.service.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -8
- package/lib/eject/schemas/zod/organization.schema.ts +0 -49
- package/lib/eject/schemas/zod/permission.schema.ts +0 -30
- package/lib/eject/schemas/zod/role.schema.ts +0 -36
- package/lib/eject/schemas/zod/user.schema.ts +0 -52
- package/lib/eject/services/services/organization.service.ts +0 -146
- package/lib/eject/services/services/permission.service.ts +0 -349
- package/lib/eject/services/services/role.service.ts +0 -182
- package/lib/eject/services/services/user.service.ts +0 -225
- package/lib/index.d.ts +0 -9
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -8
|
@@ -14,16 +14,16 @@ const zodPermissionSchema = ZodPermissionSchema(false);
|
|
|
14
14
|
const typeboxPermissionSchema = TypeboxPermissionSchema(false);
|
|
15
15
|
const zodUpdateRoleSchema = ZodUpdateRoleSchema(false);
|
|
16
16
|
const typeboxUpdateRoleSchema = TypeboxUpdateRoleSchema(false);
|
|
17
|
-
const zodRoleSchema = ZodRoleSchema(false)
|
|
18
|
-
const typeboxRoleSchema = TypeboxRoleSchema(false)
|
|
17
|
+
const zodRoleSchema = ZodRoleSchema(false);
|
|
18
|
+
const typeboxRoleSchema = TypeboxRoleSchema(false);
|
|
19
19
|
const zodUpdateUserSchema = ZodUpdateUserSchema(false);
|
|
20
20
|
const typeboxUpdateUserSchema = TypeboxUpdateUserSchema(false);
|
|
21
|
-
const zodUserSchema = ZodUserSchema(false)
|
|
22
|
-
const typeboxUserSchema = TypeboxUserSchema(false)
|
|
21
|
+
const zodUserSchema = ZodUserSchema(false);
|
|
22
|
+
const typeboxUserSchema = TypeboxUserSchema(false);
|
|
23
23
|
const zodUpdateOrganizationSchema = ZodUpdateOrganizationSchema(false);
|
|
24
24
|
const typeboxUpdateOrganizationSchema = TypeboxUpdateOrganizationSchema(false);
|
|
25
|
-
const zodOrganizationSchema = ZodOrganizationSchema(false)(
|
|
26
|
-
const typeboxOrganizationSchema = TypeboxOrganizationSchema(false)(
|
|
25
|
+
const zodOrganizationSchema = ZodOrganizationSchema(false)(DummyEnum);
|
|
26
|
+
const typeboxOrganizationSchema = TypeboxOrganizationSchema(false)(DummyEnum);
|
|
27
27
|
describe('schema equality', () => {
|
|
28
28
|
it('should be equal for permission', () => {
|
|
29
29
|
expect(isTrue(testSchemaEquality(ZodCreatePermissionSchema, TypeboxCreatePermissionSchema, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LiteralSchema } from '@forklaunch/validator';
|
|
2
2
|
import {
|
|
3
3
|
array,
|
|
4
4
|
date,
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
optional,
|
|
7
7
|
string,
|
|
8
8
|
unknown,
|
|
9
|
-
uuid
|
|
10
|
-
|
|
11
|
-
} from '
|
|
9
|
+
uuid
|
|
10
|
+
} from '@{{app_name}}/core';
|
|
11
|
+
import { UserSchema } from './user.schema';
|
|
12
12
|
|
|
13
13
|
export const CreateOrganizationSchema = {
|
|
14
14
|
name: string,
|
|
@@ -29,21 +29,23 @@ export const UpdateOrganizationSchema = (uuidId: boolean) => ({
|
|
|
29
29
|
|
|
30
30
|
export const OrganizationSchema =
|
|
31
31
|
(uuidId: boolean) =>
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
OrganizationStatus extends Record<string, LiteralSchema>
|
|
35
|
-
>(
|
|
36
|
-
UserDtoSchema: UserDtoSchema,
|
|
37
|
-
OrganizationStatus: OrganizationStatus
|
|
32
|
+
<OrganizationStatus extends Record<string, LiteralSchema>>(
|
|
33
|
+
organizationStatus: OrganizationStatus
|
|
38
34
|
) => ({
|
|
39
35
|
id: uuidId ? uuid : string,
|
|
40
36
|
name: string,
|
|
41
|
-
users: array(
|
|
37
|
+
users: array(UserSchema(uuidId)),
|
|
42
38
|
domain: string,
|
|
43
39
|
subscription: string,
|
|
44
|
-
status: enum_(
|
|
40
|
+
status: enum_(organizationStatus),
|
|
45
41
|
logoUrl: optional(string),
|
|
46
42
|
extraFields: optional(unknown),
|
|
47
43
|
createdAt: optional(date),
|
|
48
44
|
updatedAt: optional(date)
|
|
49
45
|
});
|
|
46
|
+
|
|
47
|
+
export const BaseOrganizationServiceSchemas = (uuidId: boolean) => ({
|
|
48
|
+
CreateOrganizationSchema,
|
|
49
|
+
UpdateOrganizationSchema: UpdateOrganizationSchema(uuidId),
|
|
50
|
+
OrganizationSchema: OrganizationSchema(uuidId)
|
|
51
|
+
});
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
string,
|
|
6
6
|
unknown,
|
|
7
7
|
uuid
|
|
8
|
-
} from '@
|
|
8
|
+
} from '@{{app_name}}/core';
|
|
9
9
|
|
|
10
10
|
export const CreatePermissionSchema = {
|
|
11
11
|
slug: string,
|
|
@@ -28,3 +28,9 @@ export const PermissionSchema = (uuidId: boolean) => ({
|
|
|
28
28
|
createdAt: optional(date),
|
|
29
29
|
updatedAt: optional(date)
|
|
30
30
|
});
|
|
31
|
+
|
|
32
|
+
export const BasePermissionServiceSchemas = (uuidId: boolean) => ({
|
|
33
|
+
CreatePermissionSchema,
|
|
34
|
+
UpdatePermissionSchema: UpdatePermissionSchema(uuidId),
|
|
35
|
+
PermissionSchema: PermissionSchema(uuidId)
|
|
36
|
+
});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { IdiomaticSchema } from '@forklaunch/validator';
|
|
2
1
|
import {
|
|
3
2
|
array,
|
|
4
3
|
date,
|
|
5
4
|
optional,
|
|
6
5
|
string,
|
|
7
6
|
unknown,
|
|
8
|
-
uuid
|
|
9
|
-
|
|
10
|
-
} from '
|
|
7
|
+
uuid
|
|
8
|
+
} from '@{{app_name}}/core';
|
|
9
|
+
import { PermissionSchema } from './permission.schema';
|
|
11
10
|
|
|
12
11
|
export const CreateRoleSchema = {
|
|
13
12
|
name: string,
|
|
@@ -22,15 +21,17 @@ export const UpdateRoleSchema = (uuidId: boolean) => ({
|
|
|
22
21
|
extraFields: optional(unknown)
|
|
23
22
|
});
|
|
24
23
|
|
|
25
|
-
export const RoleSchema =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
export const RoleSchema = (uuidId: boolean) => ({
|
|
25
|
+
id: uuidId ? uuid : string,
|
|
26
|
+
name: string,
|
|
27
|
+
permissions: array(PermissionSchema(uuidId)),
|
|
28
|
+
extraFields: optional(unknown),
|
|
29
|
+
createdAt: optional(date),
|
|
30
|
+
updatedAt: optional(date)
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const BaseRoleServiceSchemas = (uuidId: boolean) => ({
|
|
34
|
+
CreateRoleSchema,
|
|
35
|
+
UpdateRoleSchema: UpdateRoleSchema(uuidId),
|
|
36
|
+
RoleSchema: RoleSchema(uuidId)
|
|
37
|
+
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IdiomaticSchema } from '@forklaunch/validator';
|
|
2
1
|
import {
|
|
3
2
|
array,
|
|
4
3
|
date,
|
|
@@ -6,9 +5,9 @@ import {
|
|
|
6
5
|
optional,
|
|
7
6
|
string,
|
|
8
7
|
unknown,
|
|
9
|
-
uuid
|
|
10
|
-
|
|
11
|
-
} from '
|
|
8
|
+
uuid
|
|
9
|
+
} from '@{{app_name}}/core';
|
|
10
|
+
import { RoleSchema } from './role.schema';
|
|
12
11
|
|
|
13
12
|
export const CreateUserSchema = {
|
|
14
13
|
email: email,
|
|
@@ -34,19 +33,21 @@ export const UpdateUserSchema = (uuidId: boolean) => ({
|
|
|
34
33
|
extraFields: optional(unknown)
|
|
35
34
|
});
|
|
36
35
|
|
|
37
|
-
export const UserSchema =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
export const UserSchema = (uuidId: boolean) => ({
|
|
37
|
+
id: uuidId ? uuid : string,
|
|
38
|
+
email: email,
|
|
39
|
+
firstName: string,
|
|
40
|
+
lastName: string,
|
|
41
|
+
roles: array(RoleSchema(uuidId)),
|
|
42
|
+
phoneNumber: optional(string),
|
|
43
|
+
subscription: optional(string),
|
|
44
|
+
extraFields: optional(unknown),
|
|
45
|
+
createdAt: optional(date),
|
|
46
|
+
updatedAt: optional(date)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const BaseUserServiceSchemas = (uuidId: boolean) => ({
|
|
50
|
+
CreateUserSchema,
|
|
51
|
+
UpdateUserSchema: UpdateUserSchema(uuidId),
|
|
52
|
+
UserSchema: UserSchema(uuidId)
|
|
53
|
+
});
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateOrganizationDto,
|
|
3
|
-
OrganizationDto,
|
|
4
|
-
OrganizationService,
|
|
5
|
-
UpdateOrganizationDto
|
|
6
|
-
} from '@forklaunch/interfaces-iam';
|
|
7
1
|
import { IdDto, InstanceTypeRecord } from '@forklaunch/common';
|
|
8
2
|
import {
|
|
9
3
|
InternalDtoMapper,
|
|
@@ -16,6 +10,12 @@ import {
|
|
|
16
10
|
OpenTelemetryCollector
|
|
17
11
|
} from '@forklaunch/core/http';
|
|
18
12
|
import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
|
|
13
|
+
import { OrganizationService } from '@forklaunch/interfaces-iam/interfaces';
|
|
14
|
+
import {
|
|
15
|
+
CreateOrganizationDto,
|
|
16
|
+
OrganizationDto,
|
|
17
|
+
UpdateOrganizationDto
|
|
18
|
+
} from '@forklaunch/interfaces-iam/types';
|
|
19
19
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
20
20
|
import { EntityManager } from '@mikro-orm/core';
|
|
21
21
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CreatePermissionDto,
|
|
3
|
-
PermissionDto,
|
|
4
2
|
PermissionService,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '@forklaunch/interfaces-iam';
|
|
3
|
+
RoleService
|
|
4
|
+
} from '@forklaunch/interfaces-iam/interfaces';
|
|
5
|
+
|
|
9
6
|
import { IdDto, IdsDto, InstanceTypeRecord } from '@forklaunch/common';
|
|
10
7
|
import {
|
|
11
8
|
InternalDtoMapper,
|
|
@@ -18,6 +15,12 @@ import {
|
|
|
18
15
|
OpenTelemetryCollector
|
|
19
16
|
} from '@forklaunch/core/http';
|
|
20
17
|
import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
|
|
18
|
+
import {
|
|
19
|
+
CreatePermissionDto,
|
|
20
|
+
PermissionDto,
|
|
21
|
+
RoleDto,
|
|
22
|
+
UpdatePermissionDto
|
|
23
|
+
} from '@forklaunch/interfaces-iam/types';
|
|
21
24
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
22
25
|
import { EntityManager } from '@mikro-orm/core';
|
|
23
26
|
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateRoleDto,
|
|
3
|
-
RoleDto,
|
|
4
|
-
RoleService,
|
|
5
|
-
UpdateRoleDto
|
|
6
|
-
} from '@forklaunch/interfaces-iam';
|
|
7
1
|
import {
|
|
8
2
|
MetricsDefinition,
|
|
9
3
|
OpenTelemetryCollector
|
|
10
4
|
} from '@forklaunch/core/http';
|
|
5
|
+
import { RoleService } from '@forklaunch/interfaces-iam/interfaces';
|
|
11
6
|
import { EntityManager } from '@mikro-orm/core';
|
|
12
7
|
|
|
13
8
|
import { IdDto, IdsDto, InstanceTypeRecord } from '@forklaunch/common';
|
|
@@ -18,6 +13,11 @@ import {
|
|
|
18
13
|
transformIntoInternalDtoMapper
|
|
19
14
|
} from '@forklaunch/core/dtoMapper';
|
|
20
15
|
import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
|
|
16
|
+
import {
|
|
17
|
+
CreateRoleDto,
|
|
18
|
+
RoleDto,
|
|
19
|
+
UpdateRoleDto
|
|
20
|
+
} from '@forklaunch/interfaces-iam/types';
|
|
21
21
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
22
22
|
|
|
23
23
|
export class BaseRoleService<
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
OrganizationService,
|
|
3
3
|
RoleService,
|
|
4
|
-
UpdateUserDto,
|
|
5
|
-
UserDto,
|
|
6
4
|
UserService
|
|
7
|
-
} from '@forklaunch/interfaces-iam';
|
|
8
|
-
import {
|
|
9
|
-
MetricsDefinition,
|
|
10
|
-
OpenTelemetryCollector
|
|
11
|
-
} from '@forklaunch/core/http';
|
|
5
|
+
} from '@forklaunch/interfaces-iam/interfaces';
|
|
12
6
|
|
|
13
|
-
import { OrganizationService } from '@forklaunch/interfaces-iam';
|
|
14
7
|
import { IdDto, IdsDto, InstanceTypeRecord } from '@forklaunch/common';
|
|
15
8
|
import {
|
|
16
9
|
InternalDtoMapper,
|
|
@@ -18,7 +11,16 @@ import {
|
|
|
18
11
|
ResponseDtoMapperConstructor,
|
|
19
12
|
transformIntoInternalDtoMapper
|
|
20
13
|
} from '@forklaunch/core/dtoMapper';
|
|
14
|
+
import {
|
|
15
|
+
MetricsDefinition,
|
|
16
|
+
OpenTelemetryCollector
|
|
17
|
+
} from '@forklaunch/core/http';
|
|
21
18
|
import { MapNestedDtoArraysToCollections } from '@forklaunch/core/services';
|
|
19
|
+
import {
|
|
20
|
+
CreateUserDto,
|
|
21
|
+
UpdateUserDto,
|
|
22
|
+
UserDto
|
|
23
|
+
} from '@forklaunch/interfaces-iam/types';
|
|
22
24
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
23
25
|
import { EntityManager } from '@mikro-orm/core';
|
|
24
26
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|