@forklaunch/implementation-iam-base 0.1.11 → 0.1.13

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 +135 -235
  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 +146 -357
  7. package/lib/schemas/organization.schema.js +1 -4
  8. package/lib/schemas/permission.schema.d.ts +34 -88
  9. package/lib/schemas/permission.schema.js +1 -4
  10. package/lib/schemas/role.schema.d.ts +48 -137
  11. package/lib/schemas/role.schema.js +1 -4
  12. package/lib/schemas/typebox/organization.schema.d.ts +103 -405
  13. package/lib/schemas/typebox/organization.schema.js +17 -27
  14. package/lib/schemas/typebox/permission.schema.d.ts +38 -122
  15. package/lib/schemas/typebox/permission.schema.js +17 -24
  16. package/lib/schemas/typebox/role.schema.d.ts +50 -190
  17. package/lib/schemas/typebox/role.schema.js +17 -24
  18. package/lib/schemas/typebox/user.schema.d.ts +94 -330
  19. package/lib/schemas/typebox/user.schema.js +32 -40
  20. package/lib/schemas/user.schema.d.ts +114 -260
  21. package/lib/schemas/user.schema.js +1 -4
  22. package/lib/schemas/zod/organization.schema.d.ts +211 -301
  23. package/lib/schemas/zod/organization.schema.js +17 -27
  24. package/lib/schemas/zod/permission.schema.d.ts +38 -54
  25. package/lib/schemas/zod/permission.schema.js +17 -24
  26. package/lib/schemas/zod/role.schema.d.ts +64 -94
  27. package/lib/schemas/zod/role.schema.js +17 -24
  28. package/lib/schemas/zod/user.schema.d.ts +138 -184
  29. package/lib/schemas/zod/user.schema.js +32 -40
  30. package/lib/services/index.d.ts +1 -1
  31. package/lib/services/organization.service.d.ts +33 -106
  32. package/lib/services/organization.service.js +32 -47
  33. package/lib/services/permission.service.d.ts +41 -117
  34. package/lib/services/permission.service.js +149 -193
  35. package/lib/services/role.service.d.ts +35 -104
  36. package/lib/services/role.service.js +54 -70
  37. package/lib/services/user.service.d.ts +37 -121
  38. package/lib/services/user.service.js +80 -121
  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 +5 -5
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=schemaEquality.test.d.ts.map
2
+ //# sourceMappingURL=schemaEquality.test.d.ts.map
@@ -1,50 +1,18 @@
1
1
  import { isTrue } from '@forklaunch/common';
2
2
  import { DummyEnum, testSchemaEquality } from '@forklaunch/core/test';
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';
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';
43
11
  const zodUpdatePermissionSchema = ZodUpdatePermissionSchema({
44
- uuidId: false
12
+ uuidId: false
45
13
  });
46
14
  const typeboxUpdatePermissionSchema = TypeboxUpdatePermissionSchema({
47
- uuidId: false
15
+ uuidId: false
48
16
  });
49
17
  const zodPermissionSchema = ZodPermissionSchema({ uuidId: false });
50
18
  const typeboxPermissionSchema = TypeboxPermissionSchema({ uuidId: false });
@@ -57,227 +25,159 @@ const typeboxUpdateUserSchema = TypeboxUpdateUserSchema({ uuidId: false });
57
25
  const zodUserSchema = ZodUserSchema({ uuidId: false });
58
26
  const typeboxUserSchema = TypeboxUserSchema({ uuidId: false });
59
27
  const zodUpdateOrganizationSchema = ZodUpdateOrganizationSchema({
60
- uuidId: false
28
+ uuidId: false
61
29
  });
62
30
  const typeboxUpdateOrganizationSchema = TypeboxUpdateOrganizationSchema({
63
- uuidId: false
31
+ uuidId: false
64
32
  });
65
- const zodOrganizationSchema = ZodOrganizationSchema({ uuidId: false })(
66
- DummyEnum
67
- );
68
- const typeboxOrganizationSchema = TypeboxOrganizationSchema({ uuidId: false })(
69
- DummyEnum
70
- );
33
+ const zodOrganizationSchema = ZodOrganizationSchema({ uuidId: false })(DummyEnum);
34
+ const typeboxOrganizationSchema = TypeboxOrganizationSchema({ uuidId: false })(DummyEnum);
71
35
  describe('schema equality', () => {
72
- it('should be equal for permission', () => {
73
- expect(
74
- isTrue(
75
- testSchemaEquality(
76
- ZodCreatePermissionSchema,
77
- TypeboxCreatePermissionSchema,
78
- {
36
+ it('should be equal for permission', () => {
37
+ expect(isTrue(testSchemaEquality(ZodCreatePermissionSchema, TypeboxCreatePermissionSchema, {
79
38
  slug: 'test',
80
39
  addToRolesIds: ['test'],
81
40
  extraFields: {
82
- test: 'test'
41
+ test: 'test'
83
42
  }
84
- }
85
- )
86
- )
87
- ).toBeTruthy();
88
- expect(
89
- isTrue(
90
- testSchemaEquality(
91
- zodUpdatePermissionSchema,
92
- typeboxUpdatePermissionSchema,
93
- {
43
+ }))).toBeTruthy();
44
+ expect(isTrue(testSchemaEquality(zodUpdatePermissionSchema, typeboxUpdatePermissionSchema, {
94
45
  id: 'test',
95
46
  slug: 'test',
96
47
  addToRolesIds: ['test'],
97
48
  removeFromRolesIds: ['test'],
98
49
  extraFields: {
99
- test: 'test'
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'
100
89
  }
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' }
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'
151
104
  }
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: {
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: {
208
116
  test: 'test'
209
- }
210
117
  }
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
- {
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, {
228
143
  name: 'test',
229
144
  domain: 'test',
230
145
  subscription: 'test',
231
146
  logoUrl: 'test',
232
147
  extraFields: { test: 'test' }
233
- }
234
- )
235
- )
236
- ).toBeTruthy();
237
- expect(
238
- isTrue(
239
- testSchemaEquality(
240
- zodUpdateOrganizationSchema,
241
- typeboxUpdateOrganizationSchema,
242
- {
148
+ }))).toBeTruthy();
149
+ expect(isTrue(testSchemaEquality(zodUpdateOrganizationSchema, typeboxUpdateOrganizationSchema, {
243
150
  id: 'test',
244
151
  name: 'test',
245
152
  domain: 'test',
246
153
  subscription: 'test',
247
154
  logoUrl: 'test',
248
155
  extraFields: { test: 'test' }
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: [
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: [
270
166
  {
271
- id: 'test',
272
- name: 'test',
273
- permissions: [{ id: 'test', slug: 'test' }],
274
- extraFields: { test: 'test' }
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
+ ]
275
179
  }
276
- ]
277
- }
278
- ]
279
- })
280
- )
281
- ).toBeTruthy();
282
- });
180
+ ]
181
+ }))).toBeTruthy();
182
+ });
283
183
  });
@@ -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