@forklaunch/implementation-iam-base 0.1.13 → 0.1.14

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.
Files changed (42) hide show
  1. package/lib/__test__/schemaEquality.test.d.ts +1 -1
  2. package/lib/__test__/schemaEquality.test.js +235 -135
  3. package/lib/jest.config.d.ts +1 -1
  4. package/lib/jest.config.js +16 -16
  5. package/lib/schemas/index.d.ts +1 -1
  6. package/lib/schemas/organization.schema.d.ts +357 -146
  7. package/lib/schemas/organization.schema.js +4 -1
  8. package/lib/schemas/permission.schema.d.ts +88 -34
  9. package/lib/schemas/permission.schema.js +4 -1
  10. package/lib/schemas/role.schema.d.ts +137 -48
  11. package/lib/schemas/role.schema.js +4 -1
  12. package/lib/schemas/typebox/organization.schema.d.ts +405 -103
  13. package/lib/schemas/typebox/organization.schema.js +27 -17
  14. package/lib/schemas/typebox/permission.schema.d.ts +122 -38
  15. package/lib/schemas/typebox/permission.schema.js +24 -17
  16. package/lib/schemas/typebox/role.schema.d.ts +190 -50
  17. package/lib/schemas/typebox/role.schema.js +24 -17
  18. package/lib/schemas/typebox/user.schema.d.ts +330 -94
  19. package/lib/schemas/typebox/user.schema.js +40 -32
  20. package/lib/schemas/user.schema.d.ts +260 -114
  21. package/lib/schemas/user.schema.js +4 -1
  22. package/lib/schemas/zod/organization.schema.d.ts +301 -211
  23. package/lib/schemas/zod/organization.schema.js +27 -17
  24. package/lib/schemas/zod/permission.schema.d.ts +54 -38
  25. package/lib/schemas/zod/permission.schema.js +24 -17
  26. package/lib/schemas/zod/role.schema.d.ts +94 -64
  27. package/lib/schemas/zod/role.schema.js +24 -17
  28. package/lib/schemas/zod/user.schema.d.ts +184 -138
  29. package/lib/schemas/zod/user.schema.js +40 -32
  30. package/lib/services/index.d.ts +1 -1
  31. package/lib/services/organization.service.d.ts +106 -33
  32. package/lib/services/organization.service.js +47 -32
  33. package/lib/services/permission.service.d.ts +117 -41
  34. package/lib/services/permission.service.js +193 -149
  35. package/lib/services/role.service.d.ts +104 -35
  36. package/lib/services/role.service.js +70 -54
  37. package/lib/services/user.service.d.ts +121 -37
  38. package/lib/services/user.service.js +121 -80
  39. package/lib/tsconfig.tsbuildinfo +1 -1
  40. package/lib/vitest.config.d.ts +2 -2
  41. package/lib/vitest.config.js +4 -4
  42. package/package.json +8 -8
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=schemaEquality.test.d.ts.map
2
+ //# sourceMappingURL=schemaEquality.test.d.ts.map
@@ -1,18 +1,50 @@
1
1
  import { isTrue } from '@forklaunch/common';
2
2
  import { DummyEnum, testSchemaEquality } from '@forklaunch/core/test';
3
- import { CreateOrganizationSchema as TypeboxCreateOrganizationSchema, OrganizationSchema as TypeboxOrganizationSchema, UpdateOrganizationSchema as TypeboxUpdateOrganizationSchema } from '../schemas/typebox/organization.schema';
4
- import { CreatePermissionSchema as TypeboxCreatePermissionSchema, PermissionSchema as TypeboxPermissionSchema, UpdatePermissionSchema as TypeboxUpdatePermissionSchema } from '../schemas/typebox/permission.schema';
5
- import { CreateRoleSchema as TypeboxCreateRoleSchema, RoleSchema as TypeboxRoleSchema, UpdateRoleSchema as TypeboxUpdateRoleSchema } from '../schemas/typebox/role.schema';
6
- import { CreateUserSchema as TypeboxCreateUserSchema, UpdateUserSchema as TypeboxUpdateUserSchema, UserSchema as TypeboxUserSchema } from '../schemas/typebox/user.schema';
7
- import { CreateOrganizationSchema as ZodCreateOrganizationSchema, OrganizationSchema as ZodOrganizationSchema, UpdateOrganizationSchema as ZodUpdateOrganizationSchema } from '../schemas/zod/organization.schema';
8
- import { CreatePermissionSchema as ZodCreatePermissionSchema, PermissionSchema as ZodPermissionSchema, UpdatePermissionSchema as ZodUpdatePermissionSchema } from '../schemas/zod/permission.schema';
9
- import { CreateRoleSchema as ZodCreateRoleSchema, RoleSchema as ZodRoleSchema, UpdateRoleSchema as ZodUpdateRoleSchema } from '../schemas/zod/role.schema';
10
- import { CreateUserSchema as ZodCreateUserSchema, UpdateUserSchema as ZodUpdateUserSchema, UserSchema as ZodUserSchema } from '../schemas/zod/user.schema';
3
+ import {
4
+ CreateOrganizationSchema as TypeboxCreateOrganizationSchema,
5
+ OrganizationSchema as TypeboxOrganizationSchema,
6
+ UpdateOrganizationSchema as TypeboxUpdateOrganizationSchema
7
+ } from '../schemas/typebox/organization.schema';
8
+ import {
9
+ CreatePermissionSchema as TypeboxCreatePermissionSchema,
10
+ PermissionSchema as TypeboxPermissionSchema,
11
+ UpdatePermissionSchema as TypeboxUpdatePermissionSchema
12
+ } from '../schemas/typebox/permission.schema';
13
+ import {
14
+ CreateRoleSchema as TypeboxCreateRoleSchema,
15
+ RoleSchema as TypeboxRoleSchema,
16
+ UpdateRoleSchema as TypeboxUpdateRoleSchema
17
+ } from '../schemas/typebox/role.schema';
18
+ import {
19
+ CreateUserSchema as TypeboxCreateUserSchema,
20
+ UpdateUserSchema as TypeboxUpdateUserSchema,
21
+ UserSchema as TypeboxUserSchema
22
+ } from '../schemas/typebox/user.schema';
23
+ import {
24
+ CreateOrganizationSchema as ZodCreateOrganizationSchema,
25
+ OrganizationSchema as ZodOrganizationSchema,
26
+ UpdateOrganizationSchema as ZodUpdateOrganizationSchema
27
+ } from '../schemas/zod/organization.schema';
28
+ import {
29
+ CreatePermissionSchema as ZodCreatePermissionSchema,
30
+ PermissionSchema as ZodPermissionSchema,
31
+ UpdatePermissionSchema as ZodUpdatePermissionSchema
32
+ } from '../schemas/zod/permission.schema';
33
+ import {
34
+ CreateRoleSchema as ZodCreateRoleSchema,
35
+ RoleSchema as ZodRoleSchema,
36
+ UpdateRoleSchema as ZodUpdateRoleSchema
37
+ } from '../schemas/zod/role.schema';
38
+ import {
39
+ CreateUserSchema as ZodCreateUserSchema,
40
+ UpdateUserSchema as ZodUpdateUserSchema,
41
+ UserSchema as ZodUserSchema
42
+ } from '../schemas/zod/user.schema';
11
43
  const zodUpdatePermissionSchema = ZodUpdatePermissionSchema({
12
- uuidId: false
44
+ uuidId: false
13
45
  });
14
46
  const typeboxUpdatePermissionSchema = TypeboxUpdatePermissionSchema({
15
- uuidId: false
47
+ uuidId: false
16
48
  });
17
49
  const zodPermissionSchema = ZodPermissionSchema({ uuidId: false });
18
50
  const typeboxPermissionSchema = TypeboxPermissionSchema({ uuidId: false });
@@ -25,159 +57,227 @@ const typeboxUpdateUserSchema = TypeboxUpdateUserSchema({ uuidId: false });
25
57
  const zodUserSchema = ZodUserSchema({ uuidId: false });
26
58
  const typeboxUserSchema = TypeboxUserSchema({ uuidId: false });
27
59
  const zodUpdateOrganizationSchema = ZodUpdateOrganizationSchema({
28
- uuidId: false
60
+ uuidId: false
29
61
  });
30
62
  const typeboxUpdateOrganizationSchema = TypeboxUpdateOrganizationSchema({
31
- uuidId: false
63
+ uuidId: false
32
64
  });
33
- const zodOrganizationSchema = ZodOrganizationSchema({ uuidId: false })(DummyEnum);
34
- const typeboxOrganizationSchema = TypeboxOrganizationSchema({ uuidId: false })(DummyEnum);
65
+ const zodOrganizationSchema = ZodOrganizationSchema({ uuidId: false })(
66
+ DummyEnum
67
+ );
68
+ const typeboxOrganizationSchema = TypeboxOrganizationSchema({ uuidId: false })(
69
+ DummyEnum
70
+ );
35
71
  describe('schema equality', () => {
36
- it('should be equal for permission', () => {
37
- expect(isTrue(testSchemaEquality(ZodCreatePermissionSchema, TypeboxCreatePermissionSchema, {
72
+ it('should be equal for permission', () => {
73
+ expect(
74
+ isTrue(
75
+ testSchemaEquality(
76
+ ZodCreatePermissionSchema,
77
+ TypeboxCreatePermissionSchema,
78
+ {
38
79
  slug: 'test',
39
80
  addToRolesIds: ['test'],
40
81
  extraFields: {
41
- test: 'test'
82
+ test: 'test'
42
83
  }
43
- }))).toBeTruthy();
44
- expect(isTrue(testSchemaEquality(zodUpdatePermissionSchema, typeboxUpdatePermissionSchema, {
84
+ }
85
+ )
86
+ )
87
+ ).toBeTruthy();
88
+ expect(
89
+ isTrue(
90
+ testSchemaEquality(
91
+ zodUpdatePermissionSchema,
92
+ typeboxUpdatePermissionSchema,
93
+ {
45
94
  id: 'test',
46
95
  slug: 'test',
47
96
  addToRolesIds: ['test'],
48
97
  removeFromRolesIds: ['test'],
49
98
  extraFields: {
50
- test: 'test'
51
- }
52
- }))).toBeTruthy();
53
- expect(isTrue(testSchemaEquality(zodPermissionSchema, typeboxPermissionSchema, {
54
- id: 'test',
55
- slug: 'test',
56
- extraFields: {
57
- test: 'test'
58
- }
59
- }))).toBeTruthy();
60
- });
61
- it('should be equal for role', () => {
62
- expect(isTrue(testSchemaEquality(ZodCreateRoleSchema, TypeboxCreateRoleSchema, {
63
- name: 'test',
64
- permissionIds: ['test'],
65
- extraFields: {
66
- test: 'test'
67
- }
68
- }))).toBeTruthy();
69
- expect(isTrue(testSchemaEquality(zodUpdateRoleSchema, typeboxUpdateRoleSchema, {
70
- id: 'test',
71
- name: 'test',
72
- permissionIds: ['test'],
73
- extraFields: {
74
- test: 'test'
75
- }
76
- }))).toBeTruthy();
77
- expect(isTrue(testSchemaEquality(zodRoleSchema, typeboxRoleSchema, {
78
- id: 'test',
79
- name: 'test',
80
- permissions: [
81
- {
82
- id: 'test',
83
- slug: 'test',
84
- extraFields: { test: 'test' }
85
- }
86
- ],
87
- extraFields: {
88
- test: 'test'
99
+ test: 'test'
89
100
  }
90
- }))).toBeTruthy();
91
- });
92
- it('should be equal for user', () => {
93
- expect(isTrue(testSchemaEquality(ZodCreateUserSchema, TypeboxCreateUserSchema, {
94
- email: 'test@test.com',
95
- password: 'test',
96
- firstName: 'test',
97
- lastName: 'test',
98
- organizationId: 'test',
99
- roleIds: ['test'],
100
- phoneNumber: 'test',
101
- subscription: 'test',
102
- extraFields: {
103
- test: 'test'
101
+ }
102
+ )
103
+ )
104
+ ).toBeTruthy();
105
+ expect(
106
+ isTrue(
107
+ testSchemaEquality(zodPermissionSchema, typeboxPermissionSchema, {
108
+ id: 'test',
109
+ slug: 'test',
110
+ extraFields: {
111
+ test: 'test'
112
+ }
113
+ })
114
+ )
115
+ ).toBeTruthy();
116
+ });
117
+ it('should be equal for role', () => {
118
+ expect(
119
+ isTrue(
120
+ testSchemaEquality(ZodCreateRoleSchema, TypeboxCreateRoleSchema, {
121
+ name: 'test',
122
+ permissionIds: ['test'],
123
+ extraFields: {
124
+ test: 'test'
125
+ }
126
+ })
127
+ )
128
+ ).toBeTruthy();
129
+ expect(
130
+ isTrue(
131
+ testSchemaEquality(zodUpdateRoleSchema, typeboxUpdateRoleSchema, {
132
+ id: 'test',
133
+ name: 'test',
134
+ permissionIds: ['test'],
135
+ extraFields: {
136
+ test: 'test'
137
+ }
138
+ })
139
+ )
140
+ ).toBeTruthy();
141
+ expect(
142
+ isTrue(
143
+ testSchemaEquality(zodRoleSchema, typeboxRoleSchema, {
144
+ id: 'test',
145
+ name: 'test',
146
+ permissions: [
147
+ {
148
+ id: 'test',
149
+ slug: 'test',
150
+ extraFields: { test: 'test' }
104
151
  }
105
- }))).toBeTruthy();
106
- expect(isTrue(testSchemaEquality(zodUpdateUserSchema, typeboxUpdateUserSchema, {
107
- id: 'test',
108
- email: 'test@test.com',
109
- password: 'test',
110
- firstName: 'test',
111
- lastName: 'test',
112
- roleIds: ['test'],
113
- phoneNumber: 'test',
114
- subscription: 'test',
115
- extraFields: {
152
+ ],
153
+ extraFields: {
154
+ test: 'test'
155
+ }
156
+ })
157
+ )
158
+ ).toBeTruthy();
159
+ });
160
+ it('should be equal for user', () => {
161
+ expect(
162
+ isTrue(
163
+ testSchemaEquality(ZodCreateUserSchema, TypeboxCreateUserSchema, {
164
+ email: 'test@test.com',
165
+ password: 'test',
166
+ firstName: 'test',
167
+ lastName: 'test',
168
+ organizationId: 'test',
169
+ roleIds: ['test'],
170
+ phoneNumber: 'test',
171
+ subscription: 'test',
172
+ extraFields: {
173
+ test: 'test'
174
+ }
175
+ })
176
+ )
177
+ ).toBeTruthy();
178
+ expect(
179
+ isTrue(
180
+ testSchemaEquality(zodUpdateUserSchema, typeboxUpdateUserSchema, {
181
+ id: 'test',
182
+ email: 'test@test.com',
183
+ password: 'test',
184
+ firstName: 'test',
185
+ lastName: 'test',
186
+ roleIds: ['test'],
187
+ phoneNumber: 'test',
188
+ subscription: 'test',
189
+ extraFields: {
190
+ test: 'test'
191
+ }
192
+ })
193
+ )
194
+ ).toBeTruthy();
195
+ expect(
196
+ isTrue(
197
+ testSchemaEquality(zodUserSchema, typeboxUserSchema, {
198
+ id: 'test',
199
+ email: 'test@test.com',
200
+ firstName: 'test',
201
+ lastName: 'test',
202
+ roles: [
203
+ {
204
+ id: 'test',
205
+ name: 'test',
206
+ permissions: [{ id: 'test', slug: 'test' }],
207
+ extraFields: {
116
208
  test: 'test'
209
+ }
117
210
  }
118
- }))).toBeTruthy();
119
- expect(isTrue(testSchemaEquality(zodUserSchema, typeboxUserSchema, {
120
- id: 'test',
121
- email: 'test@test.com',
122
- firstName: 'test',
123
- lastName: 'test',
124
- roles: [
125
- {
126
- id: 'test',
127
- name: 'test',
128
- permissions: [{ id: 'test', slug: 'test' }],
129
- extraFields: {
130
- test: 'test'
131
- }
132
- }
133
- ],
134
- phoneNumber: 'test',
135
- subscription: 'test',
136
- extraFields: {
137
- test: 'test'
138
- }
139
- }))).toBeTruthy();
140
- });
141
- it('should be equal for organization', () => {
142
- expect(isTrue(testSchemaEquality(ZodCreateOrganizationSchema, TypeboxCreateOrganizationSchema, {
211
+ ],
212
+ phoneNumber: 'test',
213
+ subscription: 'test',
214
+ extraFields: {
215
+ test: 'test'
216
+ }
217
+ })
218
+ )
219
+ ).toBeTruthy();
220
+ });
221
+ it('should be equal for organization', () => {
222
+ expect(
223
+ isTrue(
224
+ testSchemaEquality(
225
+ ZodCreateOrganizationSchema,
226
+ TypeboxCreateOrganizationSchema,
227
+ {
143
228
  name: 'test',
144
229
  domain: 'test',
145
230
  subscription: 'test',
146
231
  logoUrl: 'test',
147
232
  extraFields: { test: 'test' }
148
- }))).toBeTruthy();
149
- expect(isTrue(testSchemaEquality(zodUpdateOrganizationSchema, typeboxUpdateOrganizationSchema, {
233
+ }
234
+ )
235
+ )
236
+ ).toBeTruthy();
237
+ expect(
238
+ isTrue(
239
+ testSchemaEquality(
240
+ zodUpdateOrganizationSchema,
241
+ typeboxUpdateOrganizationSchema,
242
+ {
150
243
  id: 'test',
151
244
  name: 'test',
152
245
  domain: 'test',
153
246
  subscription: 'test',
154
247
  logoUrl: 'test',
155
248
  extraFields: { test: 'test' }
156
- }))).toBeTruthy();
157
- expect(isTrue(testSchemaEquality(zodOrganizationSchema, typeboxOrganizationSchema, {
158
- id: 'test',
159
- name: 'test',
160
- domain: 'test',
161
- subscription: 'test',
162
- logoUrl: 'test',
163
- extraFields: { test: 'test' },
164
- status: DummyEnum.A,
165
- users: [
249
+ }
250
+ )
251
+ )
252
+ ).toBeTruthy();
253
+ expect(
254
+ isTrue(
255
+ testSchemaEquality(zodOrganizationSchema, typeboxOrganizationSchema, {
256
+ id: 'test',
257
+ name: 'test',
258
+ domain: 'test',
259
+ subscription: 'test',
260
+ logoUrl: 'test',
261
+ extraFields: { test: 'test' },
262
+ status: DummyEnum.A,
263
+ users: [
264
+ {
265
+ id: 'test',
266
+ email: 'test@test.com',
267
+ firstName: 'test',
268
+ lastName: 'test',
269
+ roles: [
166
270
  {
167
- id: 'test',
168
- email: 'test@test.com',
169
- firstName: 'test',
170
- lastName: 'test',
171
- roles: [
172
- {
173
- id: 'test',
174
- name: 'test',
175
- permissions: [{ id: 'test', slug: 'test' }],
176
- extraFields: { test: 'test' }
177
- }
178
- ]
271
+ id: 'test',
272
+ name: 'test',
273
+ permissions: [{ id: 'test', slug: 'test' }],
274
+ extraFields: { test: 'test' }
179
275
  }
180
- ]
181
- }))).toBeTruthy();
182
- });
276
+ ]
277
+ }
278
+ ]
279
+ })
280
+ )
281
+ ).toBeTruthy();
282
+ });
183
283
  });
@@ -1,4 +1,4 @@
1
1
  import type { JestConfigWithTsJest } from 'ts-jest';
2
2
  declare const jestConfig: JestConfigWithTsJest;
3
3
  export default jestConfig;
4
- //# sourceMappingURL=jest.config.d.ts.map
4
+ //# sourceMappingURL=jest.config.d.ts.map
@@ -1,19 +1,19 @@
1
1
  const jestConfig = {
2
- preset: 'ts-jest/presets/default-esm', // or other ESM presets
3
- moduleNameMapper: {
4
- '^(\\.{1,2}/.*)\\.js$': '$1'
5
- },
6
- transform: {
7
- // '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
8
- // '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
9
- '^.+\\.[tj]sx?$': [
10
- 'ts-jest',
11
- {
12
- useESM: true
13
- }
14
- ],
15
- '^.+\\.js$': 'babel-jest'
16
- },
17
- testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
2
+ preset: 'ts-jest/presets/default-esm', // or other ESM presets
3
+ moduleNameMapper: {
4
+ '^(\\.{1,2}/.*)\\.js$': '$1'
5
+ },
6
+ transform: {
7
+ // '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
8
+ // '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
9
+ '^.+\\.[tj]sx?$': [
10
+ 'ts-jest',
11
+ {
12
+ useESM: true
13
+ }
14
+ ],
15
+ '^.+\\.js$': 'babel-jest'
16
+ },
17
+ testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
18
18
  };
19
19
  export default jestConfig;
@@ -2,4 +2,4 @@ export * from './organization.schema';
2
2
  export * from './permission.schema';
3
3
  export * from './role.schema';
4
4
  export * from './user.schema';
5
- //# sourceMappingURL=index.d.ts.map
5
+ //# sourceMappingURL=index.d.ts.map