@forklaunch/implementation-iam-base 0.2.3 → 0.3.0

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 (69) hide show
  1. package/lib/schemas/index.d.mts +474 -0
  2. package/lib/schemas/index.d.ts +474 -5
  3. package/lib/schemas/index.js +339 -4
  4. package/lib/schemas/index.mjs +369 -0
  5. package/lib/services/index.d.mts +203 -0
  6. package/lib/services/index.d.ts +203 -5
  7. package/lib/services/index.js +666 -4
  8. package/lib/services/index.mjs +652 -0
  9. package/package.json +6 -5
  10. package/lib/__test__/schemaEquality.test.d.ts +0 -2
  11. package/lib/__test__/schemaEquality.test.d.ts.map +0 -1
  12. package/lib/__test__/schemaEquality.test.js +0 -283
  13. package/lib/jest.config.d.ts +0 -4
  14. package/lib/jest.config.d.ts.map +0 -1
  15. package/lib/jest.config.js +0 -19
  16. package/lib/schemas/index.d.ts.map +0 -1
  17. package/lib/schemas/organization.schema.d.ts +0 -423
  18. package/lib/schemas/organization.schema.d.ts.map +0 -1
  19. package/lib/schemas/organization.schema.js +0 -7
  20. package/lib/schemas/permission.schema.d.ts +0 -104
  21. package/lib/schemas/permission.schema.d.ts.map +0 -1
  22. package/lib/schemas/permission.schema.js +0 -7
  23. package/lib/schemas/role.schema.d.ts +0 -163
  24. package/lib/schemas/role.schema.d.ts.map +0 -1
  25. package/lib/schemas/role.schema.js +0 -7
  26. package/lib/schemas/typebox/organization.schema.d.ts +0 -382
  27. package/lib/schemas/typebox/organization.schema.d.ts.map +0 -1
  28. package/lib/schemas/typebox/organization.schema.js +0 -44
  29. package/lib/schemas/typebox/permission.schema.d.ts +0 -123
  30. package/lib/schemas/typebox/permission.schema.d.ts.map +0 -1
  31. package/lib/schemas/typebox/permission.schema.js +0 -32
  32. package/lib/schemas/typebox/role.schema.d.ts +0 -183
  33. package/lib/schemas/typebox/role.schema.d.ts.map +0 -1
  34. package/lib/schemas/typebox/role.schema.js +0 -33
  35. package/lib/schemas/typebox/user.schema.d.ts +0 -315
  36. package/lib/schemas/typebox/user.schema.d.ts.map +0 -1
  37. package/lib/schemas/typebox/user.schema.js +0 -49
  38. package/lib/schemas/user.schema.d.ts +0 -298
  39. package/lib/schemas/user.schema.d.ts.map +0 -1
  40. package/lib/schemas/user.schema.js +0 -7
  41. package/lib/schemas/zod/organization.schema.d.ts +0 -418
  42. package/lib/schemas/zod/organization.schema.d.ts.map +0 -1
  43. package/lib/schemas/zod/organization.schema.js +0 -44
  44. package/lib/schemas/zod/permission.schema.d.ts +0 -71
  45. package/lib/schemas/zod/permission.schema.d.ts.map +0 -1
  46. package/lib/schemas/zod/permission.schema.js +0 -32
  47. package/lib/schemas/zod/role.schema.d.ts +0 -129
  48. package/lib/schemas/zod/role.schema.d.ts.map +0 -1
  49. package/lib/schemas/zod/role.schema.js +0 -33
  50. package/lib/schemas/zod/user.schema.d.ts +0 -249
  51. package/lib/schemas/zod/user.schema.d.ts.map +0 -1
  52. package/lib/schemas/zod/user.schema.js +0 -49
  53. package/lib/services/index.d.ts.map +0 -1
  54. package/lib/services/organization.service.d.ts +0 -123
  55. package/lib/services/organization.service.d.ts.map +0 -1
  56. package/lib/services/organization.service.js +0 -88
  57. package/lib/services/permission.service.d.ts +0 -149
  58. package/lib/services/permission.service.d.ts.map +0 -1
  59. package/lib/services/permission.service.js +0 -264
  60. package/lib/services/role.service.d.ts +0 -123
  61. package/lib/services/role.service.d.ts.map +0 -1
  62. package/lib/services/role.service.js +0 -139
  63. package/lib/services/user.service.d.ts +0 -134
  64. package/lib/services/user.service.d.ts.map +0 -1
  65. package/lib/services/user.service.js +0 -185
  66. package/lib/tsconfig.tsbuildinfo +0 -1
  67. package/lib/vitest.config.d.ts +0 -3
  68. package/lib/vitest.config.d.ts.map +0 -1
  69. package/lib/vitest.config.js +0 -7
@@ -1,283 +0,0 @@
1
- import { isTrue } from '@forklaunch/common';
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';
43
- const zodUpdatePermissionSchema = ZodUpdatePermissionSchema({
44
- uuidId: false
45
- });
46
- const typeboxUpdatePermissionSchema = TypeboxUpdatePermissionSchema({
47
- uuidId: false
48
- });
49
- const zodPermissionSchema = ZodPermissionSchema({ uuidId: false });
50
- const typeboxPermissionSchema = TypeboxPermissionSchema({ uuidId: false });
51
- const zodUpdateRoleSchema = ZodUpdateRoleSchema({ uuidId: false });
52
- const typeboxUpdateRoleSchema = TypeboxUpdateRoleSchema({ uuidId: false });
53
- const zodRoleSchema = ZodRoleSchema({ uuidId: false });
54
- const typeboxRoleSchema = TypeboxRoleSchema({ uuidId: false });
55
- const zodUpdateUserSchema = ZodUpdateUserSchema({ uuidId: false });
56
- const typeboxUpdateUserSchema = TypeboxUpdateUserSchema({ uuidId: false });
57
- const zodUserSchema = ZodUserSchema({ uuidId: false });
58
- const typeboxUserSchema = TypeboxUserSchema({ uuidId: false });
59
- const zodUpdateOrganizationSchema = ZodUpdateOrganizationSchema({
60
- uuidId: false
61
- });
62
- const typeboxUpdateOrganizationSchema = TypeboxUpdateOrganizationSchema({
63
- uuidId: false
64
- });
65
- const zodOrganizationSchema = ZodOrganizationSchema({ uuidId: false })(
66
- DummyEnum
67
- );
68
- const typeboxOrganizationSchema = TypeboxOrganizationSchema({ uuidId: false })(
69
- DummyEnum
70
- );
71
- describe('schema equality', () => {
72
- it('should be equal for permission', () => {
73
- expect(
74
- isTrue(
75
- testSchemaEquality(
76
- ZodCreatePermissionSchema,
77
- TypeboxCreatePermissionSchema,
78
- {
79
- slug: 'test',
80
- addToRolesIds: ['test'],
81
- extraFields: {
82
- test: 'test'
83
- }
84
- }
85
- )
86
- )
87
- ).toBeTruthy();
88
- expect(
89
- isTrue(
90
- testSchemaEquality(
91
- zodUpdatePermissionSchema,
92
- typeboxUpdatePermissionSchema,
93
- {
94
- id: 'test',
95
- slug: 'test',
96
- addToRolesIds: ['test'],
97
- removeFromRolesIds: ['test'],
98
- extraFields: {
99
- test: 'test'
100
- }
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' }
151
- }
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: {
208
- test: 'test'
209
- }
210
- }
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
- {
228
- name: 'test',
229
- domain: 'test',
230
- subscription: 'test',
231
- logoUrl: 'test',
232
- extraFields: { test: 'test' }
233
- }
234
- )
235
- )
236
- ).toBeTruthy();
237
- expect(
238
- isTrue(
239
- testSchemaEquality(
240
- zodUpdateOrganizationSchema,
241
- typeboxUpdateOrganizationSchema,
242
- {
243
- id: 'test',
244
- name: 'test',
245
- domain: 'test',
246
- subscription: 'test',
247
- logoUrl: 'test',
248
- 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: [
270
- {
271
- id: 'test',
272
- name: 'test',
273
- permissions: [{ id: 'test', slug: 'test' }],
274
- extraFields: { test: 'test' }
275
- }
276
- ]
277
- }
278
- ]
279
- })
280
- )
281
- ).toBeTruthy();
282
- });
283
- });
@@ -1,4 +0,0 @@
1
- import type { JestConfigWithTsJest } from 'ts-jest';
2
- declare const jestConfig: JestConfigWithTsJest;
3
- export default jestConfig;
4
- //# sourceMappingURL=jest.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,oBAiBjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,19 +0,0 @@
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/']
18
- };
19
- export default jestConfig;
@@ -1 +0,0 @@
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"}