@forklaunch/implementation-iam-base 0.1.13 → 0.1.15
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.d.ts +1 -1
- package/lib/__test__/schemaEquality.test.js +235 -135
- package/lib/jest.config.d.ts +1 -1
- package/lib/jest.config.js +16 -16
- package/lib/schemas/index.d.ts +1 -1
- package/lib/schemas/organization.schema.d.ts +375 -152
- package/lib/schemas/organization.schema.js +4 -1
- package/lib/schemas/permission.schema.d.ts +88 -34
- package/lib/schemas/permission.schema.js +4 -1
- package/lib/schemas/role.schema.d.ts +139 -50
- package/lib/schemas/role.schema.js +4 -1
- package/lib/schemas/typebox/organization.schema.d.ts +373 -103
- package/lib/schemas/typebox/organization.schema.js +27 -17
- package/lib/schemas/typebox/permission.schema.d.ts +114 -38
- package/lib/schemas/typebox/permission.schema.js +24 -17
- package/lib/schemas/typebox/role.schema.d.ts +174 -50
- package/lib/schemas/typebox/role.schema.js +24 -17
- package/lib/schemas/typebox/user.schema.d.ts +306 -94
- package/lib/schemas/typebox/user.schema.js +40 -32
- package/lib/schemas/user.schema.d.ts +270 -116
- package/lib/schemas/user.schema.js +4 -1
- package/lib/schemas/zod/organization.schema.d.ts +355 -221
- package/lib/schemas/zod/organization.schema.js +27 -17
- package/lib/schemas/zod/permission.schema.d.ts +62 -38
- package/lib/schemas/zod/permission.schema.js +24 -17
- package/lib/schemas/zod/role.schema.d.ts +112 -66
- package/lib/schemas/zod/role.schema.js +24 -17
- package/lib/schemas/zod/user.schema.d.ts +214 -144
- package/lib/schemas/zod/user.schema.js +40 -32
- package/lib/services/index.d.ts +1 -1
- package/lib/services/organization.service.d.ts +106 -33
- package/lib/services/organization.service.js +47 -32
- package/lib/services/permission.service.d.ts +117 -41
- package/lib/services/permission.service.js +193 -149
- package/lib/services/role.service.d.ts +104 -35
- package/lib/services/role.service.js +70 -54
- package/lib/services/user.service.d.ts +121 -37
- package/lib/services/user.service.js +121 -80
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/vitest.config.d.ts +2 -2
- package/lib/vitest.config.js +4 -4
- 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 {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
44
|
+
uuidId: false
|
|
13
45
|
});
|
|
14
46
|
const typeboxUpdatePermissionSchema = TypeboxUpdatePermissionSchema({
|
|
15
|
-
|
|
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
|
-
|
|
60
|
+
uuidId: false
|
|
29
61
|
});
|
|
30
62
|
const typeboxUpdateOrganizationSchema = TypeboxUpdateOrganizationSchema({
|
|
31
|
-
|
|
63
|
+
uuidId: false
|
|
32
64
|
});
|
|
33
|
-
const zodOrganizationSchema = ZodOrganizationSchema({ uuidId: false })(
|
|
34
|
-
|
|
65
|
+
const zodOrganizationSchema = ZodOrganizationSchema({ uuidId: false })(
|
|
66
|
+
DummyEnum
|
|
67
|
+
);
|
|
68
|
+
const typeboxOrganizationSchema = TypeboxOrganizationSchema({ uuidId: false })(
|
|
69
|
+
DummyEnum
|
|
70
|
+
);
|
|
35
71
|
describe('schema equality', () => {
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
82
|
+
test: 'test'
|
|
42
83
|
}
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
149
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
182
|
-
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
})
|
|
280
|
+
)
|
|
281
|
+
).toBeTruthy();
|
|
282
|
+
});
|
|
183
283
|
});
|
package/lib/jest.config.d.ts
CHANGED
package/lib/jest.config.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
const jestConfig = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
package/lib/schemas/index.d.ts
CHANGED