@veruna/api-contracts 1.0.3 → 1.0.7

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 (187) hide show
  1. package/build/index.d.ts +4 -3
  2. package/build/index.js +4 -3
  3. package/build/locales/en.d.ts +31 -0
  4. package/build/locales/en.js +38 -0
  5. package/build/locales/index.d.ts +66 -0
  6. package/build/locales/index.js +22 -0
  7. package/build/locales/ru.d.ts +30 -0
  8. package/build/locales/ru.js +38 -0
  9. package/build/rest-api.d.ts +52 -0
  10. package/build/rest-api.js +67 -0
  11. package/build/shared/common-schemas.d.ts +12 -0
  12. package/build/shared/common-schemas.js +15 -0
  13. package/build/shared/error-response.schema.d.ts +25 -0
  14. package/build/shared/error-response.schema.js +22 -0
  15. package/build/shared/index.d.ts +2 -0
  16. package/build/shared/index.js +18 -0
  17. package/build/shared/pagination.schema.d.ts +35 -0
  18. package/build/shared/pagination.schema.js +30 -0
  19. package/build/shared/regex.d.ts +8 -0
  20. package/build/shared/regex.js +16 -0
  21. package/build/utils/index.d.ts +1 -0
  22. package/build/utils/index.js +17 -0
  23. package/build/utils/path-builder.d.ts +20 -0
  24. package/build/utils/path-builder.js +46 -0
  25. package/build/v1/auth/auth.types.d.ts +2 -1
  26. package/build/v1/auth/auth.types.js +4 -1
  27. package/build/v1/auth/commands/delete-session.command.d.ts +11 -0
  28. package/build/v1/auth/commands/delete-session.command.js +18 -0
  29. package/build/v1/auth/commands/index.d.ts +2 -0
  30. package/build/v1/auth/commands/index.js +2 -0
  31. package/build/v1/auth/commands/login.command.d.ts +3 -5
  32. package/build/v1/auth/commands/login.command.js +10 -7
  33. package/build/v1/auth/commands/logout-all.command.d.ts +11 -0
  34. package/build/v1/auth/commands/logout-all.command.js +18 -0
  35. package/build/v1/auth/commands/logout.command.d.ts +2 -4
  36. package/build/v1/auth/commands/logout.command.js +9 -5
  37. package/build/v1/auth/commands/signup.command.d.ts +3 -5
  38. package/build/v1/auth/commands/signup.command.js +10 -7
  39. package/build/v1/auth/controllers.d.ts +4 -0
  40. package/build/v1/auth/controllers.js +7 -0
  41. package/build/v1/auth/index.d.ts +4 -1
  42. package/build/v1/auth/index.js +4 -1
  43. package/build/v1/auth/queries/get-sessions.query.d.ts +20 -0
  44. package/build/v1/auth/queries/get-sessions.query.js +18 -0
  45. package/build/v1/auth/queries/index.d.ts +1 -0
  46. package/build/v1/auth/queries/index.js +17 -0
  47. package/build/v1/auth/routes/auth.routes.d.ts +12 -0
  48. package/build/v1/auth/routes/auth.routes.js +15 -0
  49. package/build/v1/auth/schemas/auth-response.schema.d.ts +36 -0
  50. package/build/v1/auth/schemas/auth-response.schema.js +20 -0
  51. package/build/v1/auth/schemas/index.d.ts +5 -0
  52. package/build/v1/auth/schemas/index.js +21 -0
  53. package/build/v1/auth/schemas/login-request.schema.d.ts +9 -0
  54. package/build/v1/auth/schemas/login-request.schema.js +13 -0
  55. package/build/v1/auth/schemas/session-response.schema.d.ts +13 -0
  56. package/build/v1/auth/schemas/session-response.schema.js +17 -0
  57. package/build/v1/auth/schemas/signup-request.schema.d.ts +28 -0
  58. package/build/v1/auth/schemas/signup-request.schema.js +26 -0
  59. package/build/v1/auth/schemas/user-role.enum.d.ts +7 -0
  60. package/build/v1/auth/schemas/user-role.enum.js +11 -0
  61. package/build/v1/blog/admin/commands/create-category.command.d.ts +24 -0
  62. package/build/v1/blog/admin/commands/create-category.command.js +15 -0
  63. package/build/v1/blog/admin/commands/create-post.command.d.ts +43 -0
  64. package/build/v1/blog/admin/commands/create-post.command.js +15 -0
  65. package/build/v1/blog/admin/commands/delete-category.command.d.ts +11 -0
  66. package/build/v1/blog/admin/commands/delete-category.command.js +16 -0
  67. package/build/v1/blog/admin/commands/delete-post.command.d.ts +11 -0
  68. package/build/v1/blog/admin/commands/delete-post.command.js +16 -0
  69. package/build/v1/blog/admin/commands/index.d.ts +6 -0
  70. package/build/v1/blog/admin/commands/index.js +22 -0
  71. package/build/v1/blog/admin/commands/update-category.command.d.ts +24 -0
  72. package/build/v1/blog/admin/commands/update-category.command.js +15 -0
  73. package/build/v1/blog/admin/commands/update-post.command.d.ts +43 -0
  74. package/build/v1/blog/admin/commands/update-post.command.js +15 -0
  75. package/build/v1/blog/admin/queries/get-categories.query.d.ts +24 -0
  76. package/build/v1/blog/admin/queries/get-categories.query.js +22 -0
  77. package/build/v1/blog/admin/queries/get-category.query.d.ts +19 -0
  78. package/build/v1/blog/admin/queries/get-category.query.js +16 -0
  79. package/build/v1/blog/admin/queries/get-post.query.d.ts +33 -0
  80. package/build/v1/blog/admin/queries/get-post.query.js +16 -0
  81. package/build/v1/blog/admin/queries/get-posts.query.d.ts +48 -0
  82. package/build/v1/blog/admin/queries/get-posts.query.js +21 -0
  83. package/build/v1/blog/admin/queries/index.d.ts +4 -0
  84. package/build/v1/blog/admin/queries/index.js +20 -0
  85. package/build/v1/blog/blog.paths.d.ts +36 -0
  86. package/build/v1/blog/blog.paths.js +47 -0
  87. package/build/v1/blog/blog.types.d.ts +12 -0
  88. package/build/v1/blog/blog.types.js +7 -0
  89. package/build/v1/blog/controllers.d.ts +7 -0
  90. package/build/v1/blog/controllers.js +10 -0
  91. package/build/v1/blog/index.d.ts +8 -0
  92. package/build/v1/blog/index.js +24 -0
  93. package/build/v1/blog/public/queries/get-categories.query.d.ts +21 -0
  94. package/build/v1/blog/public/queries/get-categories.query.js +19 -0
  95. package/build/v1/blog/public/queries/get-post-by-alias.query.d.ts +33 -0
  96. package/build/v1/blog/public/queries/get-post-by-alias.query.js +16 -0
  97. package/build/v1/blog/public/queries/get-posts.query.d.ts +47 -0
  98. package/build/v1/blog/public/queries/get-posts.query.js +21 -0
  99. package/build/v1/blog/public/queries/index.d.ts +3 -0
  100. package/build/v1/blog/public/queries/index.js +19 -0
  101. package/build/v1/blog/routes/blog-admin-categories.routes.d.ts +11 -0
  102. package/build/v1/blog/routes/blog-admin-categories.routes.js +14 -0
  103. package/build/v1/blog/routes/blog-admin-posts.routes.d.ts +10 -0
  104. package/build/v1/blog/routes/blog-admin-posts.routes.js +13 -0
  105. package/build/v1/blog/routes/blog-public.routes.d.ts +10 -0
  106. package/build/v1/blog/routes/blog-public.routes.js +13 -0
  107. package/build/v1/blog/routes/index.d.ts +3 -0
  108. package/build/v1/blog/routes/index.js +19 -0
  109. package/build/v1/blog/schemas/blog-category-status.enum.d.ts +8 -0
  110. package/build/v1/blog/schemas/blog-category-status.enum.js +12 -0
  111. package/build/v1/blog/schemas/blog-post-status.enum.d.ts +8 -0
  112. package/build/v1/blog/schemas/blog-post-status.enum.js +12 -0
  113. package/build/v1/blog/schemas/category-response.schema.d.ts +14 -0
  114. package/build/v1/blog/schemas/category-response.schema.js +18 -0
  115. package/build/v1/blog/schemas/create-category-request.schema.d.ts +8 -0
  116. package/build/v1/blog/schemas/create-category-request.schema.js +12 -0
  117. package/build/v1/blog/schemas/create-post-request.schema.d.ts +13 -0
  118. package/build/v1/blog/schemas/create-post-request.schema.js +17 -0
  119. package/build/v1/blog/schemas/get-posts-query.schema.d.ts +13 -0
  120. package/build/v1/blog/schemas/get-posts-query.schema.js +13 -0
  121. package/build/v1/blog/schemas/index.d.ts +9 -0
  122. package/build/v1/blog/schemas/index.js +25 -0
  123. package/build/v1/blog/schemas/post-response.schema.d.ts +28 -0
  124. package/build/v1/blog/schemas/post-response.schema.js +25 -0
  125. package/build/v1/blog/schemas/update-category-request.schema.d.ts +8 -0
  126. package/build/v1/blog/schemas/update-category-request.schema.js +12 -0
  127. package/build/v1/blog/schemas/update-post-request.schema.d.ts +13 -0
  128. package/build/v1/blog/schemas/update-post-request.schema.js +17 -0
  129. package/build/v1/unregistered-users/commands/authenticate.command.d.ts +18 -0
  130. package/build/v1/unregistered-users/commands/authenticate.command.js +15 -0
  131. package/build/v1/unregistered-users/commands/index.d.ts +1 -0
  132. package/build/v1/unregistered-users/commands/index.js +17 -0
  133. package/build/v1/unregistered-users/controllers.d.ts +4 -0
  134. package/build/v1/unregistered-users/controllers.js +7 -0
  135. package/build/v1/unregistered-users/index.d.ts +2 -1
  136. package/build/v1/unregistered-users/index.js +2 -1
  137. package/build/v1/unregistered-users/routes/unreg-users.routes.d.ts +6 -0
  138. package/build/v1/unregistered-users/routes/unreg-users.routes.js +9 -0
  139. package/build/v1/unregistered-users/schemas/authenticate-request.schema.d.ts +7 -0
  140. package/build/v1/unregistered-users/schemas/authenticate-request.schema.js +10 -0
  141. package/build/v1/unregistered-users/schemas/authenticate-response.schema.d.ts +11 -0
  142. package/build/v1/unregistered-users/schemas/authenticate-response.schema.js +15 -0
  143. package/build/v1/unregistered-users/schemas/index.d.ts +3 -0
  144. package/build/v1/unregistered-users/schemas/index.js +19 -0
  145. package/build/v1/unregistered-users/schemas/unreg-user-status.enum.d.ts +8 -0
  146. package/build/v1/unregistered-users/schemas/unreg-user-status.enum.js +12 -0
  147. package/build/v1/unregistered-users/unregistered-users.types.d.ts +3 -1
  148. package/build/v1/unregistered-users/unregistered-users.types.js +6 -0
  149. package/build/v1/users/commands/change-password.command.d.ts +2 -4
  150. package/build/v1/users/commands/change-password.command.js +8 -5
  151. package/build/v1/users/commands/delete-account.command.d.ts +11 -0
  152. package/build/v1/users/commands/delete-account.command.js +16 -0
  153. package/build/v1/users/commands/index.d.ts +2 -0
  154. package/build/v1/users/commands/index.js +2 -0
  155. package/build/v1/users/commands/toggle-marketing-consent.command.d.ts +13 -0
  156. package/build/v1/users/commands/toggle-marketing-consent.command.js +16 -0
  157. package/build/v1/users/commands/update-profile.command.d.ts +2 -4
  158. package/build/v1/users/commands/update-profile.command.js +8 -5
  159. package/build/v1/users/controllers.d.ts +4 -0
  160. package/build/v1/users/controllers.js +7 -0
  161. package/build/v1/users/index.d.ts +3 -1
  162. package/build/v1/users/index.js +3 -1
  163. package/build/v1/users/queries/get-current-user.query.d.ts +3 -5
  164. package/build/v1/users/queries/get-current-user.query.js +7 -5
  165. package/build/v1/users/routes/users.routes.d.ts +9 -0
  166. package/build/v1/users/routes/users.routes.js +12 -0
  167. package/build/v1/users/schemas/change-password-request.schema.d.ts +10 -0
  168. package/build/v1/users/schemas/change-password-request.schema.js +14 -0
  169. package/build/v1/users/schemas/delete-account-request.schema.d.ts +5 -0
  170. package/build/v1/users/schemas/delete-account-request.schema.js +8 -0
  171. package/build/v1/users/schemas/index.d.ts +6 -0
  172. package/build/v1/users/schemas/index.js +22 -0
  173. package/build/v1/users/{users.schemas.d.ts → schemas/response-unions.schema.d.ts} +0 -42
  174. package/build/v1/users/schemas/response-unions.schema.js +14 -0
  175. package/build/v1/users/schemas/toggle-marketing-consent-request.schema.d.ts +7 -0
  176. package/build/v1/users/schemas/toggle-marketing-consent-request.schema.js +10 -0
  177. package/build/v1/users/schemas/update-profile-request.schema.d.ts +8 -0
  178. package/build/v1/users/schemas/update-profile-request.schema.js +11 -0
  179. package/build/v1/users/schemas/user-response.schema.d.ts +12 -0
  180. package/build/v1/users/schemas/user-response.schema.js +16 -0
  181. package/build/v1/users/users.types.d.ts +2 -4
  182. package/package.json +1 -1
  183. package/build/v1/auth/auth.schemas.d.ts +0 -87
  184. package/build/v1/auth/auth.schemas.js +0 -69
  185. package/build/v1/unregistered-users/unregistered-users.schemas.d.ts +0 -24
  186. package/build/v1/unregistered-users/unregistered-users.schemas.js +0 -28
  187. package/build/v1/users/users.schemas.js +0 -58
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildPath = buildPath;
4
+ exports.buildUrl = buildUrl;
5
+ exports.buildFullUrl = buildFullUrl;
6
+ /**
7
+ * Build URL path with parameters
8
+ * @example
9
+ * buildPath('/users/:id', { id: '123' }) // '/users/123'
10
+ * buildPath('/users/:id/posts/:postId', { id: '1', postId: '2' }) // '/users/1/posts/2'
11
+ */
12
+ function buildPath(pattern, params) {
13
+ if (!params) {
14
+ return pattern;
15
+ }
16
+ let path = pattern;
17
+ for (const [key, value] of Object.entries(params)) {
18
+ path = path.replace(`:${key}`, String(value));
19
+ }
20
+ return path;
21
+ }
22
+ /**
23
+ * Build URL with query parameters
24
+ * @example
25
+ * buildUrl('/users', { page: 1, limit: 10 }) // '/users?page=1&limit=10'
26
+ */
27
+ function buildUrl(path, queryParams) {
28
+ if (!queryParams || Object.keys(queryParams).length === 0) {
29
+ return path;
30
+ }
31
+ const query = Object.entries(queryParams)
32
+ .filter(([_, value]) => value !== undefined && value !== null)
33
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)
34
+ .join('&');
35
+ return query ? `${path}?${query}` : path;
36
+ }
37
+ /**
38
+ * Build full URL with path params and query params
39
+ * @example
40
+ * buildFullUrl('/users/:id', { id: '123' }, { include: 'posts' })
41
+ * // '/users/123?include=posts'
42
+ */
43
+ function buildFullUrl(pattern, pathParams, queryParams) {
44
+ const path = buildPath(pattern, pathParams);
45
+ return buildUrl(path, queryParams);
46
+ }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { SignUpRequestSchema, LoginRequestSchema, SessionResponseSchema, AuthResponseSchema, SessionsListResponseSchema, UtmSchema } from './auth.schemas';
2
+ import { SignUpRequestSchema, LoginRequestSchema, SessionResponseSchema, AuthResponseSchema, SessionsListResponseSchema, UtmSchema } from './schemas';
3
+ export { UserRole } from './schemas/user-role.enum';
3
4
  export type SignUpRequest = z.infer<typeof SignUpRequestSchema>;
4
5
  export type LoginRequest = z.infer<typeof LoginRequestSchema>;
5
6
  export type SessionResponse = z.infer<typeof SessionResponseSchema>;
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // Note: UserResponse is exported from users module
3
+ exports.UserRole = void 0;
4
+ // Re-export UserRole enum
5
+ var user_role_enum_1 = require("./schemas/user-role.enum");
6
+ Object.defineProperty(exports, "UserRole", { enumerable: true, get: function () { return user_role_enum_1.UserRole; } });
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace AuthDeleteSessionCommand {
4
+ const Request: z.ZodObject<{}, z.core.$strip>;
5
+ const Response: z.ZodObject<{}, z.core.$strip>;
6
+ const PATH: "sessions/:id";
7
+ const URL: (id: string) => string;
8
+ const METHOD = HttpMethod.DELETE;
9
+ type RequestType = z.infer<typeof Request>;
10
+ type ResponseType = z.infer<typeof Response>;
11
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthDeleteSessionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const auth_routes_1 = require("../routes/auth.routes");
6
+ const rest_api_1 = require("../../../rest-api");
7
+ const http_method_1 = require("../../../shared/http-method");
8
+ const common_schemas_1 = require("../../../shared/common-schemas");
9
+ var AuthDeleteSessionCommand;
10
+ (function (AuthDeleteSessionCommand) {
11
+ // Request/Response
12
+ AuthDeleteSessionCommand.Request = zod_1.z.object({});
13
+ AuthDeleteSessionCommand.Response = common_schemas_1.EmptyResponseSchema;
14
+ // Path/URL/Method
15
+ AuthDeleteSessionCommand.PATH = auth_routes_1.AUTH_ROUTES.SESSION_BY_ID;
16
+ AuthDeleteSessionCommand.URL = (id) => rest_api_1.REST_API.V1.AUTH.SESSION_BY_ID(id);
17
+ AuthDeleteSessionCommand.METHOD = http_method_1.HttpMethod.DELETE;
18
+ })(AuthDeleteSessionCommand || (exports.AuthDeleteSessionCommand = AuthDeleteSessionCommand = {}));
@@ -1,3 +1,5 @@
1
1
  export * from './signup.command';
2
2
  export * from './login.command';
3
3
  export * from './logout.command';
4
+ export * from './logout-all.command';
5
+ export * from './delete-session.command';
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./signup.command"), exports);
18
18
  __exportStar(require("./login.command"), exports);
19
19
  __exportStar(require("./logout.command"), exports);
20
+ __exportStar(require("./logout-all.command"), exports);
21
+ __exportStar(require("./delete-session.command"), exports);
@@ -5,7 +5,7 @@ export declare namespace AuthLoginCommand {
5
5
  email: z.ZodString;
6
6
  password: z.ZodString;
7
7
  }, z.core.$strip>;
8
- const Response: z.ZodUnion<readonly [z.ZodObject<{
8
+ const Response: z.ZodObject<{
9
9
  user: z.ZodObject<{
10
10
  uuid: z.ZodString;
11
11
  email: z.ZodString;
@@ -23,10 +23,8 @@ export declare namespace AuthLoginCommand {
23
23
  createdAt: z.ZodString;
24
24
  lastUsedAt: z.ZodString;
25
25
  }, z.core.$strip>;
26
- }, z.core.$strip>, z.ZodObject<{
27
- code: z.ZodString;
28
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
29
- }, z.core.$strip>]>;
26
+ }, z.core.$strip>;
27
+ const PATH: "login";
30
28
  const URL: "/api/v1/auth/login";
31
29
  const METHOD = HttpMethod.POST;
32
30
  type RequestType = z.infer<typeof Request>;
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthLoginCommand = void 0;
4
- const zod_1 = require("zod");
5
- const auth_schemas_1 = require("../auth.schemas");
6
- const auth_paths_1 = require("../auth.paths");
4
+ const login_request_schema_1 = require("../schemas/login-request.schema");
5
+ const auth_response_schema_1 = require("../schemas/auth-response.schema");
6
+ const auth_routes_1 = require("../routes/auth.routes");
7
+ const rest_api_1 = require("../../../rest-api");
7
8
  const http_method_1 = require("../../../shared/http-method");
8
- const users_schemas_1 = require("../../users/users.schemas");
9
9
  var AuthLoginCommand;
10
10
  (function (AuthLoginCommand) {
11
- AuthLoginCommand.Request = auth_schemas_1.LoginRequestSchema;
12
- AuthLoginCommand.Response = zod_1.z.union([auth_schemas_1.AuthResponseSchema, users_schemas_1.ErrorResponseSchema]);
13
- AuthLoginCommand.URL = auth_paths_1.AUTH_API_PATHS.LOGIN;
11
+ // Request/Response
12
+ AuthLoginCommand.Request = login_request_schema_1.LoginRequestSchema;
13
+ AuthLoginCommand.Response = auth_response_schema_1.AuthResponseSchema;
14
+ // Path/URL/Method
15
+ AuthLoginCommand.PATH = auth_routes_1.AUTH_ROUTES.LOGIN;
16
+ AuthLoginCommand.URL = rest_api_1.REST_API.V1.AUTH.LOGIN;
14
17
  AuthLoginCommand.METHOD = http_method_1.HttpMethod.POST;
15
18
  })(AuthLoginCommand || (exports.AuthLoginCommand = AuthLoginCommand = {}));
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace AuthLogoutAllCommand {
4
+ const Request: z.ZodObject<{}, z.core.$strip>;
5
+ const Response: z.ZodObject<{}, z.core.$strip>;
6
+ const PATH: "logout-all";
7
+ const URL: "/api/v1/auth/logout-all";
8
+ const METHOD = HttpMethod.POST;
9
+ type RequestType = z.infer<typeof Request>;
10
+ type ResponseType = z.infer<typeof Response>;
11
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthLogoutAllCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const auth_routes_1 = require("../routes/auth.routes");
6
+ const rest_api_1 = require("../../../rest-api");
7
+ const http_method_1 = require("../../../shared/http-method");
8
+ const common_schemas_1 = require("../../../shared/common-schemas");
9
+ var AuthLogoutAllCommand;
10
+ (function (AuthLogoutAllCommand) {
11
+ // Request/Response
12
+ AuthLogoutAllCommand.Request = zod_1.z.object({});
13
+ AuthLogoutAllCommand.Response = common_schemas_1.EmptyResponseSchema;
14
+ // Path/URL/Method
15
+ AuthLogoutAllCommand.PATH = auth_routes_1.AUTH_ROUTES.LOGOUT_ALL;
16
+ AuthLogoutAllCommand.URL = rest_api_1.REST_API.V1.AUTH.LOGOUT_ALL;
17
+ AuthLogoutAllCommand.METHOD = http_method_1.HttpMethod.POST;
18
+ })(AuthLogoutAllCommand || (exports.AuthLogoutAllCommand = AuthLogoutAllCommand = {}));
@@ -2,10 +2,8 @@ import { z } from 'zod';
2
2
  import { HttpMethod } from '../../../shared/http-method';
3
3
  export declare namespace AuthLogoutCommand {
4
4
  const Request: z.ZodObject<{}, z.core.$strip>;
5
- const Response: z.ZodUnion<readonly [z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
6
- code: z.ZodString;
7
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
8
- }, z.core.$strip>]>;
5
+ const Response: z.ZodObject<{}, z.core.$strip>;
6
+ const PATH: "logout";
9
7
  const URL: "/api/v1/auth/logout";
10
8
  const METHOD = HttpMethod.POST;
11
9
  type RequestType = z.infer<typeof Request>;
@@ -2,13 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthLogoutCommand = void 0;
4
4
  const zod_1 = require("zod");
5
- const auth_paths_1 = require("../auth.paths");
5
+ const auth_routes_1 = require("../routes/auth.routes");
6
+ const rest_api_1 = require("../../../rest-api");
6
7
  const http_method_1 = require("../../../shared/http-method");
7
- const users_schemas_1 = require("../../users/users.schemas");
8
+ const common_schemas_1 = require("../../../shared/common-schemas");
8
9
  var AuthLogoutCommand;
9
10
  (function (AuthLogoutCommand) {
10
- AuthLogoutCommand.Request = zod_1.z.object({}); // No request body
11
- AuthLogoutCommand.Response = zod_1.z.union([users_schemas_1.EmptyResponseSchema, users_schemas_1.ErrorResponseSchema]);
12
- AuthLogoutCommand.URL = auth_paths_1.AUTH_API_PATHS.LOGOUT;
11
+ // Request/Response
12
+ AuthLogoutCommand.Request = zod_1.z.object({});
13
+ AuthLogoutCommand.Response = common_schemas_1.EmptyResponseSchema;
14
+ // Path/URL/Method
15
+ AuthLogoutCommand.PATH = auth_routes_1.AUTH_ROUTES.LOGOUT;
16
+ AuthLogoutCommand.URL = rest_api_1.REST_API.V1.AUTH.LOGOUT;
13
17
  AuthLogoutCommand.METHOD = http_method_1.HttpMethod.POST;
14
18
  })(AuthLogoutCommand || (exports.AuthLogoutCommand = AuthLogoutCommand = {}));
@@ -14,7 +14,7 @@ export declare namespace AuthSignupCommand {
14
14
  utmTerm: z.ZodOptional<z.ZodString>;
15
15
  }, z.core.$strip>>;
16
16
  }, z.core.$strip>;
17
- const Response: z.ZodUnion<readonly [z.ZodObject<{
17
+ const Response: z.ZodObject<{
18
18
  user: z.ZodObject<{
19
19
  uuid: z.ZodString;
20
20
  email: z.ZodString;
@@ -32,10 +32,8 @@ export declare namespace AuthSignupCommand {
32
32
  createdAt: z.ZodString;
33
33
  lastUsedAt: z.ZodString;
34
34
  }, z.core.$strip>;
35
- }, z.core.$strip>, z.ZodObject<{
36
- code: z.ZodString;
37
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
38
- }, z.core.$strip>]>;
35
+ }, z.core.$strip>;
36
+ const PATH: "signup";
39
37
  const URL: "/api/v1/auth/signup";
40
38
  const METHOD = HttpMethod.POST;
41
39
  type RequestType = z.infer<typeof Request>;
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthSignupCommand = void 0;
4
- const zod_1 = require("zod");
5
- const auth_schemas_1 = require("../auth.schemas");
6
- const auth_paths_1 = require("../auth.paths");
4
+ const signup_request_schema_1 = require("../schemas/signup-request.schema");
5
+ const auth_response_schema_1 = require("../schemas/auth-response.schema");
6
+ const auth_routes_1 = require("../routes/auth.routes");
7
+ const rest_api_1 = require("../../../rest-api");
7
8
  const http_method_1 = require("../../../shared/http-method");
8
- const users_schemas_1 = require("../../users/users.schemas");
9
9
  var AuthSignupCommand;
10
10
  (function (AuthSignupCommand) {
11
- AuthSignupCommand.Request = auth_schemas_1.SignUpRequestSchema;
12
- AuthSignupCommand.Response = zod_1.z.union([auth_schemas_1.AuthResponseSchema, users_schemas_1.ErrorResponseSchema]);
13
- AuthSignupCommand.URL = auth_paths_1.AUTH_API_PATHS.SIGNUP;
11
+ // Request/Response
12
+ AuthSignupCommand.Request = signup_request_schema_1.SignUpRequestSchema;
13
+ AuthSignupCommand.Response = auth_response_schema_1.AuthResponseSchema;
14
+ // Path/URL/Method
15
+ AuthSignupCommand.PATH = auth_routes_1.AUTH_ROUTES.SIGNUP;
16
+ AuthSignupCommand.URL = rest_api_1.REST_API.V1.AUTH.SIGNUP;
14
17
  AuthSignupCommand.METHOD = http_method_1.HttpMethod.POST;
15
18
  })(AuthSignupCommand || (exports.AuthSignupCommand = AuthSignupCommand = {}));
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Auth Controller paths for NestJS @Controller decorator
3
+ */
4
+ export declare const AUTH_CONTROLLER: "v1/auth";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AUTH_CONTROLLER = void 0;
4
+ /**
5
+ * Auth Controller paths for NestJS @Controller decorator
6
+ */
7
+ exports.AUTH_CONTROLLER = 'v1/auth';
@@ -1,5 +1,8 @@
1
- export * from './auth.schemas';
1
+ export * from './schemas';
2
2
  export * from './auth.types';
3
3
  export * from './auth.paths';
4
4
  export * from './auth.errors';
5
+ export * from './controllers';
6
+ export * from './routes/auth.routes';
5
7
  export * from './commands';
8
+ export * from './queries';
@@ -14,8 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./auth.schemas"), exports);
17
+ __exportStar(require("./schemas"), exports);
18
18
  __exportStar(require("./auth.types"), exports);
19
19
  __exportStar(require("./auth.paths"), exports);
20
20
  __exportStar(require("./auth.errors"), exports);
21
+ __exportStar(require("./controllers"), exports);
22
+ __exportStar(require("./routes/auth.routes"), exports);
21
23
  __exportStar(require("./commands"), exports);
24
+ __exportStar(require("./queries"), exports);
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace AuthGetSessionsQuery {
4
+ const Request: z.ZodObject<{}, z.core.$strip>;
5
+ const Response: z.ZodObject<{
6
+ sessions: z.ZodArray<z.ZodObject<{
7
+ uuid: z.ZodString;
8
+ deviceName: z.ZodString;
9
+ ip: z.ZodString;
10
+ isCurrent: z.ZodBoolean;
11
+ createdAt: z.ZodString;
12
+ lastUsedAt: z.ZodString;
13
+ }, z.core.$strip>>;
14
+ }, z.core.$strip>;
15
+ const PATH: "sessions";
16
+ const URL: "/api/v1/auth/sessions";
17
+ const METHOD = HttpMethod.GET;
18
+ type RequestType = z.infer<typeof Request>;
19
+ type ResponseType = z.infer<typeof Response>;
20
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthGetSessionsQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const auth_response_schema_1 = require("../schemas/auth-response.schema");
6
+ const auth_routes_1 = require("../routes/auth.routes");
7
+ const rest_api_1 = require("../../../rest-api");
8
+ const http_method_1 = require("../../../shared/http-method");
9
+ var AuthGetSessionsQuery;
10
+ (function (AuthGetSessionsQuery) {
11
+ // Request/Response
12
+ AuthGetSessionsQuery.Request = zod_1.z.object({});
13
+ AuthGetSessionsQuery.Response = auth_response_schema_1.SessionsListResponseSchema;
14
+ // Path/URL/Method
15
+ AuthGetSessionsQuery.PATH = auth_routes_1.AUTH_ROUTES.SESSIONS;
16
+ AuthGetSessionsQuery.URL = rest_api_1.REST_API.V1.AUTH.SESSIONS;
17
+ AuthGetSessionsQuery.METHOD = http_method_1.HttpMethod.GET;
18
+ })(AuthGetSessionsQuery || (exports.AuthGetSessionsQuery = AuthGetSessionsQuery = {}));
@@ -0,0 +1 @@
1
+ export * from './get-sessions.query';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-sessions.query"), exports);
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Auth Routes
3
+ * For NestJS method decorators (@Get, @Post, etc.)
4
+ */
5
+ export declare const AUTH_ROUTES: {
6
+ readonly SIGNUP: "signup";
7
+ readonly LOGIN: "login";
8
+ readonly LOGOUT: "logout";
9
+ readonly LOGOUT_ALL: "logout-all";
10
+ readonly SESSIONS: "sessions";
11
+ readonly SESSION_BY_ID: "sessions/:id";
12
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AUTH_ROUTES = void 0;
4
+ /**
5
+ * Auth Routes
6
+ * For NestJS method decorators (@Get, @Post, etc.)
7
+ */
8
+ exports.AUTH_ROUTES = {
9
+ SIGNUP: 'signup',
10
+ LOGIN: 'login',
11
+ LOGOUT: 'logout',
12
+ LOGOUT_ALL: 'logout-all',
13
+ SESSIONS: 'sessions',
14
+ SESSION_BY_ID: 'sessions/:id',
15
+ };
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Auth Response Schema (signup/login)
4
+ */
5
+ export declare const AuthResponseSchema: z.ZodObject<{
6
+ user: z.ZodObject<{
7
+ uuid: z.ZodString;
8
+ email: z.ZodString;
9
+ name: z.ZodString;
10
+ role: z.ZodString;
11
+ marketingConsent: z.ZodBoolean;
12
+ createdAt: z.ZodString;
13
+ }, z.core.$strip>;
14
+ accessToken: z.ZodString;
15
+ session: z.ZodObject<{
16
+ uuid: z.ZodString;
17
+ deviceName: z.ZodString;
18
+ ip: z.ZodString;
19
+ isCurrent: z.ZodBoolean;
20
+ createdAt: z.ZodString;
21
+ lastUsedAt: z.ZodString;
22
+ }, z.core.$strip>;
23
+ }, z.core.$strip>;
24
+ /**
25
+ * Sessions List Response Schema
26
+ */
27
+ export declare const SessionsListResponseSchema: z.ZodObject<{
28
+ sessions: z.ZodArray<z.ZodObject<{
29
+ uuid: z.ZodString;
30
+ deviceName: z.ZodString;
31
+ ip: z.ZodString;
32
+ isCurrent: z.ZodBoolean;
33
+ createdAt: z.ZodString;
34
+ lastUsedAt: z.ZodString;
35
+ }, z.core.$strip>>;
36
+ }, z.core.$strip>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionsListResponseSchema = exports.AuthResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const user_response_schema_1 = require("../../users/schemas/user-response.schema");
6
+ const session_response_schema_1 = require("./session-response.schema");
7
+ /**
8
+ * Auth Response Schema (signup/login)
9
+ */
10
+ exports.AuthResponseSchema = zod_1.z.object({
11
+ user: user_response_schema_1.UserResponseSchema,
12
+ accessToken: zod_1.z.string(),
13
+ session: session_response_schema_1.SessionResponseSchema,
14
+ });
15
+ /**
16
+ * Sessions List Response Schema
17
+ */
18
+ exports.SessionsListResponseSchema = zod_1.z.object({
19
+ sessions: zod_1.z.array(session_response_schema_1.SessionResponseSchema),
20
+ });
@@ -0,0 +1,5 @@
1
+ export * from './user-role.enum';
2
+ export * from './signup-request.schema';
3
+ export * from './login-request.schema';
4
+ export * from './session-response.schema';
5
+ export * from './auth-response.schema';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./user-role.enum"), exports);
18
+ __exportStar(require("./signup-request.schema"), exports);
19
+ __exportStar(require("./login-request.schema"), exports);
20
+ __exportStar(require("./session-response.schema"), exports);
21
+ __exportStar(require("./auth-response.schema"), exports);
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Login Request Schema
4
+ * Error messages are in locales (en.ts, ru.ts)
5
+ */
6
+ export declare const LoginRequestSchema: z.ZodObject<{
7
+ email: z.ZodString;
8
+ password: z.ZodString;
9
+ }, z.core.$strip>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoginRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const regex_1 = require("../../../shared/regex");
6
+ /**
7
+ * Login Request Schema
8
+ * Error messages are in locales (en.ts, ru.ts)
9
+ */
10
+ exports.LoginRequestSchema = zod_1.z.object({
11
+ email: zod_1.z.string().regex(regex_1.EMAIL_REGEX),
12
+ password: zod_1.z.string().min(1),
13
+ });
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Session Response Schema
4
+ * Error messages are in locales (en.ts, ru.ts)
5
+ */
6
+ export declare const SessionResponseSchema: z.ZodObject<{
7
+ uuid: z.ZodString;
8
+ deviceName: z.ZodString;
9
+ ip: z.ZodString;
10
+ isCurrent: z.ZodBoolean;
11
+ createdAt: z.ZodString;
12
+ lastUsedAt: z.ZodString;
13
+ }, z.core.$strip>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const regex_1 = require("../../../shared/regex");
6
+ /**
7
+ * Session Response Schema
8
+ * Error messages are in locales (en.ts, ru.ts)
9
+ */
10
+ exports.SessionResponseSchema = zod_1.z.object({
11
+ uuid: zod_1.z.string().regex(regex_1.UUID_REGEX),
12
+ deviceName: zod_1.z.string(),
13
+ ip: zod_1.z.string(),
14
+ isCurrent: zod_1.z.boolean(),
15
+ createdAt: zod_1.z.string().regex(regex_1.DATETIME_REGEX),
16
+ lastUsedAt: zod_1.z.string().regex(regex_1.DATETIME_REGEX),
17
+ });
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * UTM Schema
4
+ */
5
+ export declare const UtmSchema: z.ZodObject<{
6
+ utmSource: z.ZodOptional<z.ZodString>;
7
+ utmMedium: z.ZodOptional<z.ZodString>;
8
+ utmCampaign: z.ZodOptional<z.ZodString>;
9
+ utmContent: z.ZodOptional<z.ZodString>;
10
+ utmTerm: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ /**
13
+ * Sign Up Request Schema
14
+ * Error messages are in locales (en.ts, ru.ts)
15
+ */
16
+ export declare const SignUpRequestSchema: z.ZodObject<{
17
+ email: z.ZodString;
18
+ password: z.ZodString;
19
+ name: z.ZodString;
20
+ marketingConsent: z.ZodDefault<z.ZodBoolean>;
21
+ utm: z.ZodOptional<z.ZodObject<{
22
+ utmSource: z.ZodOptional<z.ZodString>;
23
+ utmMedium: z.ZodOptional<z.ZodString>;
24
+ utmCampaign: z.ZodOptional<z.ZodString>;
25
+ utmContent: z.ZodOptional<z.ZodString>;
26
+ utmTerm: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strip>>;
28
+ }, z.core.$strip>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SignUpRequestSchema = exports.UtmSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const regex_1 = require("../../../shared/regex");
6
+ /**
7
+ * UTM Schema
8
+ */
9
+ exports.UtmSchema = zod_1.z.object({
10
+ utmSource: zod_1.z.string().optional(),
11
+ utmMedium: zod_1.z.string().optional(),
12
+ utmCampaign: zod_1.z.string().optional(),
13
+ utmContent: zod_1.z.string().optional(),
14
+ utmTerm: zod_1.z.string().optional(),
15
+ });
16
+ /**
17
+ * Sign Up Request Schema
18
+ * Error messages are in locales (en.ts, ru.ts)
19
+ */
20
+ exports.SignUpRequestSchema = zod_1.z.object({
21
+ email: zod_1.z.string().regex(regex_1.EMAIL_REGEX),
22
+ password: zod_1.z.string().min(8).max(128).regex(regex_1.PASSWORD_STRENGTH_REGEX),
23
+ name: zod_1.z.string().min(2),
24
+ marketingConsent: zod_1.z.boolean().default(false),
25
+ utm: exports.UtmSchema.optional(),
26
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * User Role enum
3
+ */
4
+ export declare enum UserRole {
5
+ USER = "user",
6
+ ADMIN = "admin"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserRole = void 0;
4
+ /**
5
+ * User Role enum
6
+ */
7
+ var UserRole;
8
+ (function (UserRole) {
9
+ UserRole["USER"] = "user";
10
+ UserRole["ADMIN"] = "admin";
11
+ })(UserRole || (exports.UserRole = UserRole = {}));