@esb-market-contracts/admin-backend 1.6.3 → 1.7.1

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,25 +63,35 @@ 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<{
78
- safeEmployee: {
94
+ employee: {
79
95
  id: number;
80
96
  email: string;
81
97
  fullName: string;
@@ -90,44 +106,32 @@ 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<{
97
- employees: ({
113
+ employees: {
98
114
  id: number;
99
115
  email: string;
100
116
  fullName: string;
101
117
  status: "active" | "suspended";
102
- passwordDigest: string;
103
118
  updatedAt: string | null;
104
119
  createdAt: string;
105
- } | null)[];
120
+ }[];
106
121
  }>;
107
122
  outputFormat: "json";
108
123
  status: 200;
109
124
  };
110
125
  };
111
126
  } & {
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": {
127
+ "/iam/management/employees/insert": {
124
128
  $post: {
125
129
  input: {
126
130
  json: {
127
131
  email: string;
128
132
  fullName: string;
129
133
  password: string;
130
- permissions: ("employee.create" | "employee.read" | "employee.update")[];
134
+ permissions?: ("employee.create" | "employee.read" | "employee.update")[] | undefined;
131
135
  };
132
136
  };
133
137
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -143,6 +147,8 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
143
147
  input: {
144
148
  json: {
145
149
  id: unknown;
150
+ } | {
151
+ email: string;
146
152
  };
147
153
  };
148
154
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -153,11 +159,13 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
153
159
  };
154
160
  };
155
161
  } & {
156
- "/iam/management/employees/reactivate": {
162
+ "/iam/management/employees/activate": {
157
163
  $post: {
158
164
  input: {
159
165
  json: {
160
166
  id: unknown;
167
+ } | {
168
+ email: string;
161
169
  };
162
170
  };
163
171
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
@@ -172,8 +180,8 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
172
180
  $post: {
173
181
  input: {
174
182
  json: {
175
- id: unknown;
176
- newPassword: string;
183
+ employeeId: unknown;
184
+ password: string;
177
185
  };
178
186
  };
179
187
  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.1",
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.ZodCoercedNumber<unknown>;
37
+ }, z.core.$strip>,
38
+ z.ZodObject<{
39
+ email: z.ZodString;
40
+ }, z.core.$strip>
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 {};