@esb-market-contracts/admin-backend 1.6.3 → 1.7.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.
package/api.d.ts CHANGED
@@ -34,7 +34,7 @@ declare const authRouter: import("hono/hono-base").HonoBase<{}, {
34
34
  $post: {
35
35
  input: {};
36
36
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
37
- accessToken: string;
37
+ sessionToken: string;
38
38
  }>;
39
39
  outputFormat: "json";
40
40
  status: 200;
@@ -42,11 +42,17 @@ declare const authRouter: import("hono/hono-base").HonoBase<{}, {
42
42
  };
43
43
  }, "/iam/authentication", "/iam/authentication/refresh">;
44
44
  export type AuthRouter = typeof authRouter;
45
- declare const accessTokenPayloadSchema: z.ZodObject<{
45
+ declare const sessionPayloadSchema: z.ZodObject<{
46
46
  employee: z.ZodObject<{
47
47
  id: z.ZodInt;
48
48
  email: z.ZodString;
49
49
  fullName: z.ZodString;
50
+ status: z.ZodEnum<{
51
+ active: "active";
52
+ suspended: "suspended";
53
+ }>;
54
+ updatedAt: z.ZodNullable<z.ZodDate>;
55
+ createdAt: z.ZodDate;
50
56
  }, {
51
57
  out: {};
52
58
  in: {};
@@ -57,21 +63,31 @@ declare const accessTokenPayloadSchema: z.ZodObject<{
57
63
  "employee.update": "employee.update";
58
64
  }>>;
59
65
  }, z.core.$strip>;
60
- export type AccessTokenPayload = z.infer<typeof accessTokenPayloadSchema>;
61
- /** Variables available in the context after successful Bearer authentication. */
66
+ export type SessionPayload = z.infer<typeof sessionPayloadSchema>;
62
67
  export type VariablesWithActor = {
63
- actor: AccessTokenPayload;
68
+ actorSession: SessionPayload;
64
69
  };
65
70
  declare const managementRouter: import("hono/hono-base").HonoBase<{
66
71
  Variables: VariablesWithActor;
67
- } & {
68
- Variables: VariablesWithActor;
69
72
  }, {
70
- "/iam/management/employee": {
73
+ "/iam/management/permissions": {
74
+ $get: {
75
+ input: {};
76
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
77
+ permissions: readonly ("employee.create" | "employee.read" | "employee.update")[];
78
+ }>;
79
+ outputFormat: "json";
80
+ status: 200;
81
+ };
82
+ };
83
+ } & {
84
+ "/iam/management/employees/get": {
71
85
  $get: {
72
86
  input: {
73
87
  query: {
74
88
  id: string | string[];
89
+ } | {
90
+ email: string | string[];
75
91
  };
76
92
  };
77
93
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -90,7 +106,7 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
90
106
  };
91
107
  };
92
108
  } & {
93
- "/iam/management/employees": {
109
+ "/iam/management/employees/list": {
94
110
  $get: {
95
111
  input: {};
96
112
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -98,8 +114,8 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
98
114
  id: number;
99
115
  email: string;
100
116
  fullName: string;
101
- status: "active" | "suspended";
102
117
  passwordDigest: string;
118
+ status: "active" | "suspended";
103
119
  updatedAt: string | null;
104
120
  createdAt: string;
105
121
  } | null)[];
@@ -109,25 +125,14 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
109
125
  };
110
126
  };
111
127
  } & {
112
- "/iam/management/employees/permissions": {
113
- $get: {
114
- input: {};
115
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
116
- permissions: readonly ("employee.create" | "employee.read" | "employee.update")[];
117
- }>;
118
- outputFormat: "json";
119
- status: 200;
120
- };
121
- };
122
- } & {
123
- "/iam/management/employees/create": {
128
+ "/iam/management/employees/insert": {
124
129
  $post: {
125
130
  input: {
126
131
  json: {
127
132
  email: string;
128
133
  fullName: string;
129
134
  password: string;
130
- permissions: ("employee.create" | "employee.read" | "employee.update")[];
135
+ permissions?: ("employee.create" | "employee.read" | "employee.update")[] | undefined;
131
136
  };
132
137
  };
133
138
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -142,7 +147,9 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
142
147
  $post: {
143
148
  input: {
144
149
  json: {
145
- id: unknown;
150
+ id: number;
151
+ } | {
152
+ email: string;
146
153
  };
147
154
  };
148
155
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -153,11 +160,13 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
153
160
  };
154
161
  };
155
162
  } & {
156
- "/iam/management/employees/reactivate": {
163
+ "/iam/management/employees/activate": {
157
164
  $post: {
158
165
  input: {
159
166
  json: {
160
- id: unknown;
167
+ id: number;
168
+ } | {
169
+ email: string;
161
170
  };
162
171
  };
163
172
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -172,8 +181,8 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
172
181
  $post: {
173
182
  input: {
174
183
  json: {
175
- id: unknown;
176
- newPassword: string;
184
+ employeeId: unknown;
185
+ password: string;
177
186
  };
178
187
  };
179
188
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
package/enums.d.ts CHANGED
@@ -1,19 +1,20 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- declare const pbacPermissionsArray: readonly [
3
+ declare const employeesPermissionsArray: readonly [
4
4
  "employee.create",
5
5
  "employee.read",
6
6
  "employee.update"
7
7
  ];
8
- export declare const pbacPermissions: {
8
+ declare const employeesPermissionsRecord: {
9
9
  "EMPLOYEE.CREATE": "employee.create";
10
10
  "EMPLOYEE.READ": "employee.read";
11
11
  "EMPLOYEE.UPDATE": "employee.update";
12
12
  };
13
- export type PBACPermission = (typeof pbacPermissionsArray)[number];
13
+ type EmployeesPermission = (typeof employeesPermissionsArray)[number];
14
14
 
15
15
  export {
16
- pbacPermissions as permissions,
16
+ EmployeesPermission as Permission,
17
+ employeesPermissionsRecord as permissions,
17
18
  };
18
19
 
19
20
  export {};
package/enums.js CHANGED
@@ -1,12 +1,15 @@
1
+ // src/app/domain/(iam)/employees-permissions/employees-permissions.enums.ts
2
+ import z from "zod";
3
+
1
4
  // src/utilities/enums.utilities.ts
2
5
  function createStringEnumRecord(values) {
3
6
  return Object.fromEntries(values.map((value) => [value.toUpperCase(), value]));
4
7
  }
5
8
 
6
9
  // src/app/domain/(iam)/employees-permissions/employees-permissions.enums.ts
7
- var pbacPermissionsArray = ["employee.create", "employee.read", "employee.update"];
8
- var pbacPermissions = createStringEnumRecord(pbacPermissionsArray);
10
+ var employeesPermissionsArray = ["employee.create", "employee.read", "employee.update"];
11
+ var employeesPermissionsZodArray = z.array(z.enum(employeesPermissionsArray));
12
+ var employeesPermissionsRecord = createStringEnumRecord(employeesPermissionsArray);
9
13
  export {
10
- pbacPermissions,
11
- pbacPermissions as permissions
14
+ employeesPermissionsRecord as permissions
12
15
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@esb-market-contracts/admin-backend",
3
3
  "description": "Shared TypeScript contract definitions for admin-backend.",
4
- "version": "1.6.3",
4
+ "version": "1.7.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": false,
package/types.d.ts CHANGED
@@ -4,15 +4,21 @@ import { SerializeDates } from '@kalutskii/foundation';
4
4
  import z from 'zod';
5
5
  import { z } from 'zod';
6
6
 
7
- declare const authorizeRequestSchema: z.ZodObject<{
7
+ declare const signinRequestSchema: z.ZodObject<{
8
8
  email: z.ZodEmail;
9
9
  password: z.ZodString;
10
10
  }, z.core.$strip>;
11
- declare const accessTokenPayloadSchema: z.ZodObject<{
11
+ declare const sessionPayloadSchema: z.ZodObject<{
12
12
  employee: z.ZodObject<{
13
13
  id: z.ZodInt;
14
14
  email: z.ZodString;
15
15
  fullName: z.ZodString;
16
+ status: z.ZodEnum<{
17
+ active: "active";
18
+ suspended: "suspended";
19
+ }>;
20
+ updatedAt: z.ZodNullable<z.ZodDate>;
21
+ createdAt: z.ZodDate;
16
22
  }, {
17
23
  out: {};
18
24
  in: {};
@@ -23,12 +29,30 @@ declare const accessTokenPayloadSchema: z.ZodObject<{
23
29
  "employee.update": "employee.update";
24
30
  }>>;
25
31
  }, z.core.$strip>;
26
- export type AuthorizeRequest = z.infer<typeof authorizeRequestSchema>;
27
- export type AccessTokenPayload = z.infer<typeof accessTokenPayloadSchema>;
28
- declare const selectEmployeeRequestSchema: z.ZodObject<{
29
- id: z.ZodPreprocess<z.ZodNumber>;
30
- }, z.core.$strip>;
31
- declare const safeEmployeeResponseSchema: z.ZodObject<{
32
+ export type SigninRequest = z.infer<typeof signinRequestSchema>;
33
+ export type SessionPayload = z.infer<typeof sessionPayloadSchema>;
34
+ declare const employeeSelectRequestSchema: z.ZodUnion<readonly [
35
+ z.ZodObject<{
36
+ id: z.ZodInt;
37
+ }, z.core.$strict>,
38
+ z.ZodObject<{
39
+ email: z.ZodString;
40
+ }, z.core.$strict>
41
+ ]>;
42
+ declare const employeeInsertRequestSchema: z.ZodObject<{
43
+ email: z.ZodString;
44
+ fullName: z.ZodString;
45
+ password: z.ZodString;
46
+ permissions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
47
+ "employee.create": "employee.create";
48
+ "employee.read": "employee.read";
49
+ "employee.update": "employee.update";
50
+ }>>>;
51
+ }, {
52
+ out: {};
53
+ in: {};
54
+ }>;
55
+ declare const employeeRecordSchema: z.ZodObject<{
32
56
  id: z.ZodInt;
33
57
  email: z.ZodString;
34
58
  fullName: z.ZodString;
@@ -47,23 +71,13 @@ declare const safeEmployeeResponseSchema: z.ZodObject<{
47
71
  out: {};
48
72
  in: {};
49
73
  }>;
50
- declare const createEmployeeRequestSchema: z.ZodObject<{
51
- email: z.ZodEmail;
52
- fullName: z.ZodString;
74
+ declare const employeePasswordUpdateRequestSchema: z.ZodObject<{
75
+ employeeId: z.ZodCoercedNumber<unknown>;
53
76
  password: z.ZodString;
54
- permissions: z.ZodArray<z.ZodEnum<{
55
- "employee.create": "employee.create";
56
- "employee.read": "employee.read";
57
- "employee.update": "employee.update";
58
- }>>;
59
- }, z.core.$strip>;
60
- declare const updateEmployeePasswordRequestSchema: z.ZodObject<{
61
- id: z.ZodPreprocess<z.ZodNumber>;
62
- newPassword: z.ZodString;
63
77
  }, z.core.$strip>;
64
- export type SelectEmployeeRequest = z.infer<typeof selectEmployeeRequestSchema>;
65
- export type SafeEmployeeResponse = SerializeDates<z.infer<typeof safeEmployeeResponseSchema>>;
66
- export type CreateEmployeeRequest = z.infer<typeof createEmployeeRequestSchema>;
67
- export type UpdateEmployeePasswordRequest = z.infer<typeof updateEmployeePasswordRequestSchema>;
78
+ export type EmployeeSelectRequest = z.infer<typeof employeeSelectRequestSchema>;
79
+ export type EmployeeInsertRequest = z.infer<typeof employeeInsertRequestSchema>;
80
+ export type EmployeeRecord = SerializeDates<z.infer<typeof employeeRecordSchema>>;
81
+ export type EmployeePasswordUpdateRequest = z.infer<typeof employeePasswordUpdateRequestSchema>;
68
82
 
69
83
  export {};