@esb-market-contracts/admin-backend 1.8.3 → 1.8.5

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
@@ -1,7 +1,5 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { z } from 'zod';
4
-
5
3
  declare const authRouter: import("hono/hono-base").HonoBase<{}, {
6
4
  "/iam/authentication/signin": {
7
5
  $post: {
@@ -18,17 +16,6 @@ declare const authRouter: import("hono/hono-base").HonoBase<{}, {
18
16
  status: 200;
19
17
  };
20
18
  };
21
- } & {
22
- "/iam/authentication/logout": {
23
- $post: {
24
- input: {};
25
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
26
- [x: string]: never;
27
- }>;
28
- outputFormat: "json";
29
- status: 200;
30
- };
31
- };
32
19
  } & {
33
20
  "/iam/authentication/refresh": {
34
21
  $post: {
@@ -40,166 +27,10 @@ declare const authRouter: import("hono/hono-base").HonoBase<{}, {
40
27
  status: 200;
41
28
  };
42
29
  };
43
- }, "/iam/authentication", "/iam/authentication/refresh">;
44
- export type AuthRouter = typeof authRouter;
45
- declare const sessionPayloadSchema: z.ZodObject<{
46
- employee: z.ZodObject<{
47
- id: z.ZodInt;
48
- email: z.ZodString;
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;
56
- }, {
57
- out: {};
58
- in: {};
59
- }>;
60
- permissions: z.ZodArray<z.ZodEnum<{
61
- "employee.create": "employee.create";
62
- "employee.read": "employee.read";
63
- "employee.update": "employee.update";
64
- }>>;
65
- }, z.core.$strip>;
66
- export type SessionPayload = z.infer<typeof sessionPayloadSchema>;
67
- export type VariablesWithActor = {
68
- actorSession: SessionPayload;
69
- };
70
- declare const managementRouter: import("hono/hono-base").HonoBase<{
71
- Variables: VariablesWithActor;
72
- }, {
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": {
85
- $get: {
86
- input: {
87
- query: {
88
- id: string | string[];
89
- } | {
90
- email: string | string[];
91
- };
92
- };
93
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
94
- employee: {
95
- id: number;
96
- email: string;
97
- fullName: string;
98
- status: "active" | "suspended";
99
- updatedAt: string | null;
100
- createdAt: string;
101
- permissions: ("employee.create" | "employee.read" | "employee.update")[];
102
- };
103
- }>;
104
- outputFormat: "json";
105
- status: 200;
106
- };
107
- };
108
- } & {
109
- "/iam/management/employees/list": {
110
- $get: {
111
- input: {};
112
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
113
- employees: {
114
- id: number;
115
- email: string;
116
- fullName: string;
117
- status: "active" | "suspended";
118
- updatedAt: string | null;
119
- createdAt: string;
120
- }[];
121
- }>;
122
- outputFormat: "json";
123
- status: 200;
124
- };
125
- };
126
30
  } & {
127
- "/iam/management/employees/insert": {
128
- $post: {
129
- input: {
130
- json: {
131
- email: string;
132
- fullName: string;
133
- password: string;
134
- permissions?: ("employee.create" | "employee.read" | "employee.update")[] | undefined;
135
- };
136
- };
137
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
138
- id: number;
139
- }>;
140
- outputFormat: "json";
141
- status: 201;
142
- };
143
- };
144
- } & {
145
- "/iam/management/employees/suspend": {
146
- $post: {
147
- input: {
148
- json: {
149
- id: unknown;
150
- } | {
151
- email: string;
152
- };
153
- };
154
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
155
- [x: string]: never;
156
- }>;
157
- outputFormat: "json";
158
- status: 200;
159
- };
160
- };
161
- } & {
162
- "/iam/management/employees/activate": {
163
- $post: {
164
- input: {
165
- json: {
166
- id: unknown;
167
- } | {
168
- email: string;
169
- };
170
- };
171
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
172
- [x: string]: never;
173
- }>;
174
- outputFormat: "json";
175
- status: 200;
176
- };
177
- };
178
- } & {
179
- "/iam/management/employees/update-password": {
180
- $post: {
181
- input: {
182
- json: {
183
- employeeId: unknown;
184
- password: string;
185
- };
186
- };
187
- output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
188
- [x: string]: never;
189
- }>;
190
- outputFormat: "json";
191
- status: 200;
192
- };
193
- };
194
- } & {
195
- "/iam/management/employees/update-permissions": {
31
+ "/iam/authentication/logout": {
196
32
  $post: {
197
- input: {
198
- json: {
199
- employeeId: unknown;
200
- permissions: ("employee.create" | "employee.read" | "employee.update")[];
201
- };
202
- };
33
+ input: {};
203
34
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
204
35
  [x: string]: never;
205
36
  }>;
@@ -207,7 +38,7 @@ declare const managementRouter: import("hono/hono-base").HonoBase<{
207
38
  status: 200;
208
39
  };
209
40
  };
210
- }, "/iam/management", "/iam/management/employees/update-permissions">;
211
- export type ManagementRouter = typeof managementRouter;
41
+ }, "/iam/authentication", "/iam/authentication/logout">;
42
+ export type AuthRouter = typeof authRouter;
212
43
 
213
44
  export {};
package/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/app/flows/authentication/authentication.constants.ts
2
- var SESSION_TOKEN_TTL_SECONDS = 60 * 15;
3
- var REFRESH_TOKEN_TTL_SECONDS = 60 * 60 * 24 * 7;
2
+ var SESSION_TOKEN_TTL_MS = 60 * 15 * 1e3;
3
+ var REFRESH_TOKEN_TTL_MS = 60 * 60 * 24 * 7 * 1e3;
4
4
  var AUTH_TIMEOUT_STATUS_CODE = 440;
5
5
  var INVALID_SESSION_STATUS_CODE = 498;
6
6
  export {
package/enums.d.ts CHANGED
@@ -1,20 +1,15 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- declare const employeesPermissionsArray: readonly [
3
+ declare const grantsArray: readonly [
4
4
  "employee.create",
5
5
  "employee.read",
6
6
  "employee.update"
7
7
  ];
8
- declare const employeesPermissionsRecord: {
9
- "EMPLOYEE.CREATE": "employee.create";
10
- "EMPLOYEE.READ": "employee.read";
11
- "EMPLOYEE.UPDATE": "employee.update";
12
- };
13
- type EmployeesPermission = (typeof employeesPermissionsArray)[number];
8
+ declare const grantsRecord: Record<"EMPLOYEE_CREATE" | "EMPLOYEE_READ" | "EMPLOYEE_UPDATE", "employee.create" | "employee.read" | "employee.update">;
9
+ export type Grant = (typeof grantsArray)[number];
14
10
 
15
11
  export {
16
- EmployeesPermission as Permission,
17
- employeesPermissionsRecord as permissions,
12
+ grantsRecord as grants,
18
13
  };
19
14
 
20
15
  export {};
package/enums.js CHANGED
@@ -1,15 +1,15 @@
1
- // src/app/domain/(iam)/employees-permissions/employees-permissions.enums.ts
1
+ // src/app/domain/(iam)/permissions/permissions.enums.ts
2
2
  import z from "zod";
3
3
 
4
4
  // src/utilities/enums.utilities.ts
5
5
  function createStringEnumRecord(values) {
6
- return Object.fromEntries(values.map((value) => [value.toUpperCase(), value]));
6
+ return Object.fromEntries(values.map((v) => [v.replace(/\./g, "_").toUpperCase(), v]));
7
7
  }
8
8
 
9
- // src/app/domain/(iam)/employees-permissions/employees-permissions.enums.ts
10
- var employeesPermissionsArray = ["employee.create", "employee.read", "employee.update"];
11
- var employeesPermissionsZodArray = z.array(z.enum(employeesPermissionsArray));
12
- var employeesPermissionsRecord = createStringEnumRecord(employeesPermissionsArray);
9
+ // src/app/domain/(iam)/permissions/permissions.enums.ts
10
+ var grantsArray = ["employee.create", "employee.read", "employee.update"];
11
+ var grantsZodArray = z.array(z.enum(grantsArray));
12
+ var grantsRecord = createStringEnumRecord(grantsArray);
13
13
  export {
14
- employeesPermissionsRecord as permissions
14
+ grantsRecord as grants
15
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.8.3",
4
+ "version": "1.8.5",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": false,
package/types.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { AsQuery, SerializeDates } from '@kalutskii/foundation';
4
- import z from 'zod';
5
3
  import { z } from 'zod';
6
4
 
7
- declare const signinRequestSchema: z.ZodObject<{
5
+ declare const signinPayloadSchema: z.ZodObject<{
8
6
  email: z.ZodEmail;
9
7
  password: z.ZodString;
10
- }, z.core.$strip>;
8
+ }, z.core.$strict>;
11
9
  declare const sessionPayloadSchema: z.ZodObject<{
12
10
  employee: z.ZodObject<{
13
11
  id: z.ZodInt;
@@ -19,74 +17,17 @@ declare const sessionPayloadSchema: z.ZodObject<{
19
17
  }>;
20
18
  updatedAt: z.ZodNullable<z.ZodDate>;
21
19
  createdAt: z.ZodDate;
20
+ grants: z.ZodArray<z.ZodEnum<{
21
+ "employee.create": "employee.create";
22
+ "employee.read": "employee.read";
23
+ "employee.update": "employee.update";
24
+ }>>;
22
25
  }, {
23
26
  out: {};
24
27
  in: {};
25
28
  }>;
26
- permissions: z.ZodArray<z.ZodEnum<{
27
- "employee.create": "employee.create";
28
- "employee.read": "employee.read";
29
- "employee.update": "employee.update";
30
- }>>;
31
29
  }, z.core.$strip>;
32
- export type SigninRequest = z.infer<typeof signinRequestSchema>;
30
+ export type SigninPayload = z.infer<typeof signinPayloadSchema>;
33
31
  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 employeeRecordSchema: z.ZodObject<{
43
- id: z.ZodInt;
44
- email: z.ZodString;
45
- fullName: z.ZodString;
46
- status: z.ZodEnum<{
47
- active: "active";
48
- suspended: "suspended";
49
- }>;
50
- updatedAt: z.ZodNullable<z.ZodDate>;
51
- createdAt: z.ZodDate;
52
- permissions: z.ZodArray<z.ZodEnum<{
53
- "employee.create": "employee.create";
54
- "employee.read": "employee.read";
55
- "employee.update": "employee.update";
56
- }>>;
57
- }, {
58
- out: {};
59
- in: {};
60
- }>;
61
- declare const employeeInsertRequestSchema: z.ZodObject<{
62
- email: z.ZodString;
63
- fullName: z.ZodString;
64
- password: z.ZodString;
65
- permissions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
66
- "employee.create": "employee.create";
67
- "employee.read": "employee.read";
68
- "employee.update": "employee.update";
69
- }>>>;
70
- }, {
71
- out: {};
72
- in: {};
73
- }>;
74
- declare const employeePasswordUpdateRequestSchema: z.ZodObject<{
75
- employeeId: z.ZodCoercedNumber<unknown>;
76
- password: z.ZodString;
77
- }, z.core.$strip>;
78
- declare const employeePermissionsUpdateRequestSchema: z.ZodObject<{
79
- employeeId: z.ZodCoercedNumber<unknown>;
80
- permissions: z.ZodArray<z.ZodEnum<{
81
- "employee.create": "employee.create";
82
- "employee.read": "employee.read";
83
- "employee.update": "employee.update";
84
- }>>;
85
- }, z.core.$strip>;
86
- export type EmployeeSelectRequest = AsQuery<z.infer<typeof employeeSelectRequestSchema>>;
87
- export type EmployeeRecord = SerializeDates<z.infer<typeof employeeRecordSchema>>;
88
- export type EmployeeInsertRequest = z.infer<typeof employeeInsertRequestSchema>;
89
- export type EmployeePasswordUpdateRequest = z.infer<typeof employeePasswordUpdateRequestSchema>;
90
- export type EmployeePermissionsUpdateRequest = z.infer<typeof employeePermissionsUpdateRequestSchema>;
91
32
 
92
33
  export {};