@veruna/api-contracts 1.0.13 → 1.0.14

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 (70) hide show
  1. package/build/index.d.ts +3 -1
  2. package/build/index.js +3 -1
  3. package/build/locales/en.d.ts +5 -0
  4. package/build/locales/en.js +6 -0
  5. package/build/locales/index.d.ts +10 -0
  6. package/build/locales/ru.d.ts +5 -0
  7. package/build/locales/ru.js +6 -0
  8. package/build/shared/common.errors.d.ts +8 -0
  9. package/build/shared/common.errors.js +28 -0
  10. package/build/shared/device-type.enum.d.ts +11 -0
  11. package/build/shared/device-type.enum.js +15 -0
  12. package/build/shared/error-metadata.d.ts +9 -0
  13. package/build/shared/index.d.ts +4 -0
  14. package/build/shared/index.js +4 -0
  15. package/build/v1/auth/auth.errors.d.ts +4 -1
  16. package/build/v1/auth/auth.errors.js +30 -1
  17. package/build/v1/auth/commands/signin.command.d.ts +2 -0
  18. package/build/v1/auth/commands/signup.command.d.ts +2 -0
  19. package/build/v1/auth/commands/signup.command.js +4 -4
  20. package/build/v1/auth/index.d.ts +0 -2
  21. package/build/v1/auth/index.js +0 -2
  22. package/build/v1/auth/queries/get-sessions.query.d.ts +2 -0
  23. package/build/v1/auth/schemas/auth-response.schema.d.ts +4 -0
  24. package/build/v1/auth/schemas/session-response.schema.d.ts +3 -0
  25. package/build/v1/auth/schemas/session-response.schema.js +6 -4
  26. package/build/v1/blog/index.d.ts +0 -2
  27. package/build/v1/blog/index.js +0 -2
  28. package/build/v1/email/email.errors.d.ts +15 -0
  29. package/build/v1/email/email.errors.js +63 -0
  30. package/build/v1/email/index.d.ts +1 -0
  31. package/build/v1/email/index.js +17 -0
  32. package/build/v1/index.d.ts +2 -0
  33. package/build/v1/index.js +2 -0
  34. package/build/v1/notifications/index.d.ts +2 -0
  35. package/build/v1/notifications/index.js +18 -0
  36. package/build/v1/notifications/notifications.errors.d.ts +26 -0
  37. package/build/v1/notifications/notifications.errors.js +101 -0
  38. package/build/v1/notifications/schemas/email-template.enum.d.ts +12 -0
  39. package/build/v1/notifications/schemas/email-template.enum.js +20 -0
  40. package/build/v1/notifications/schemas/index.d.ts +3 -0
  41. package/build/v1/notifications/schemas/index.js +19 -0
  42. package/build/v1/notifications/schemas/notification-status.enum.d.ts +11 -0
  43. package/build/v1/notifications/schemas/notification-status.enum.js +15 -0
  44. package/build/v1/notifications/schemas/notification-type.enum.d.ts +8 -0
  45. package/build/v1/notifications/schemas/notification-type.enum.js +14 -0
  46. package/build/v1/unregistered-users/index.d.ts +1 -5
  47. package/build/v1/unregistered-users/index.js +1 -9
  48. package/build/v1/unregistered-users/unregistered-users.errors.d.ts +8 -9
  49. package/build/v1/unregistered-users/unregistered-users.errors.js +18 -9
  50. package/build/v1/users/index.d.ts +1 -2
  51. package/build/v1/users/index.js +1 -2
  52. package/build/v1/users/users.errors.d.ts +18 -0
  53. package/build/v1/users/users.errors.js +51 -0
  54. package/package.json +1 -1
  55. package/build/v1/auth/auth.paths.d.ts +0 -17
  56. package/build/v1/auth/auth.paths.js +0 -20
  57. package/build/v1/auth/auth.types.d.ts +0 -8
  58. package/build/v1/auth/auth.types.js +0 -6
  59. package/build/v1/blog/blog.paths.d.ts +0 -36
  60. package/build/v1/blog/blog.paths.js +0 -47
  61. package/build/v1/blog/blog.types.d.ts +0 -12
  62. package/build/v1/blog/blog.types.js +0 -7
  63. package/build/v1/unregistered-users/unregistered-users.paths.d.ts +0 -15
  64. package/build/v1/unregistered-users/unregistered-users.paths.js +0 -18
  65. package/build/v1/unregistered-users/unregistered-users.types.d.ts +0 -9
  66. package/build/v1/unregistered-users/unregistered-users.types.js +0 -8
  67. package/build/v1/users/users.paths.d.ts +0 -11
  68. package/build/v1/users/users.paths.js +0 -14
  69. package/build/v1/users/users.types.d.ts +0 -11
  70. /package/build/{v1/users/users.types.js → shared/error-metadata.js} +0 -0
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NOTIFICATION_ERRORS = exports.NotificationErrorCode = void 0;
4
+ /**
5
+ * Notification Error Codes
6
+ * Covers both general notification errors and specific provider errors
7
+ */
8
+ var NotificationErrorCode;
9
+ (function (NotificationErrorCode) {
10
+ // General notification errors
11
+ NotificationErrorCode["NOTIFICATION_NOT_FOUND"] = "NOTIFICATION_NOT_FOUND";
12
+ NotificationErrorCode["NOTIFICATION_ALREADY_SENT"] = "NOTIFICATION_ALREADY_SENT";
13
+ NotificationErrorCode["NOTIFICATION_MAX_ATTEMPTS_REACHED"] = "NOTIFICATION_MAX_ATTEMPTS_REACHED";
14
+ NotificationErrorCode["NOTIFICATION_INVALID_USER"] = "NOTIFICATION_INVALID_USER";
15
+ NotificationErrorCode["NOTIFICATION_INVALID_TYPE"] = "NOTIFICATION_INVALID_TYPE";
16
+ NotificationErrorCode["NOTIFICATION_INVALID_TEMPLATE"] = "NOTIFICATION_INVALID_TEMPLATE";
17
+ NotificationErrorCode["NOTIFICATION_INVALID_STATE_TRANSITION"] = "NOTIFICATION_INVALID_STATE_TRANSITION";
18
+ // Template and rendering errors
19
+ NotificationErrorCode["NOTIFICATION_TEMPLATE_NOT_FOUND"] = "NOTIFICATION_TEMPLATE_NOT_FOUND";
20
+ NotificationErrorCode["NOTIFICATION_TEMPLATE_RENDER_FAILED"] = "NOTIFICATION_TEMPLATE_RENDER_FAILED";
21
+ NotificationErrorCode["NOTIFICATION_INVALID_TEMPLATE_DATA"] = "NOTIFICATION_INVALID_TEMPLATE_DATA";
22
+ // Sending errors
23
+ NotificationErrorCode["NOTIFICATION_SEND_FAILED"] = "NOTIFICATION_SEND_FAILED";
24
+ NotificationErrorCode["NOTIFICATION_PROVIDER_ERROR"] = "NOTIFICATION_PROVIDER_ERROR";
25
+ NotificationErrorCode["NOTIFICATION_RATE_LIMIT_EXCEEDED"] = "NOTIFICATION_RATE_LIMIT_EXCEEDED";
26
+ // Recipient errors
27
+ NotificationErrorCode["NOTIFICATION_RECIPIENT_NOT_FOUND"] = "NOTIFICATION_RECIPIENT_NOT_FOUND";
28
+ NotificationErrorCode["NOTIFICATION_RECIPIENT_UNSUBSCRIBED"] = "NOTIFICATION_RECIPIENT_UNSUBSCRIBED";
29
+ })(NotificationErrorCode || (exports.NotificationErrorCode = NotificationErrorCode = {}));
30
+ /**
31
+ * Error mappings for HTTP status codes
32
+ */
33
+ exports.NOTIFICATION_ERRORS = {
34
+ // 404 - Not Found
35
+ [NotificationErrorCode.NOTIFICATION_NOT_FOUND]: {
36
+ code: NotificationErrorCode.NOTIFICATION_NOT_FOUND,
37
+ statusCode: 404,
38
+ },
39
+ [NotificationErrorCode.NOTIFICATION_TEMPLATE_NOT_FOUND]: {
40
+ code: NotificationErrorCode.NOTIFICATION_TEMPLATE_NOT_FOUND,
41
+ statusCode: 404,
42
+ },
43
+ [NotificationErrorCode.NOTIFICATION_RECIPIENT_NOT_FOUND]: {
44
+ code: NotificationErrorCode.NOTIFICATION_RECIPIENT_NOT_FOUND,
45
+ statusCode: 404,
46
+ },
47
+ // 400 - Bad Request
48
+ [NotificationErrorCode.NOTIFICATION_INVALID_USER]: {
49
+ code: NotificationErrorCode.NOTIFICATION_INVALID_USER,
50
+ statusCode: 400,
51
+ },
52
+ [NotificationErrorCode.NOTIFICATION_INVALID_TEMPLATE_DATA]: {
53
+ code: NotificationErrorCode.NOTIFICATION_INVALID_TEMPLATE_DATA,
54
+ statusCode: 400,
55
+ },
56
+ [NotificationErrorCode.NOTIFICATION_INVALID_TYPE]: {
57
+ code: NotificationErrorCode.NOTIFICATION_INVALID_TYPE,
58
+ statusCode: 400,
59
+ },
60
+ [NotificationErrorCode.NOTIFICATION_INVALID_TEMPLATE]: {
61
+ code: NotificationErrorCode.NOTIFICATION_INVALID_TEMPLATE,
62
+ statusCode: 400,
63
+ },
64
+ [NotificationErrorCode.NOTIFICATION_INVALID_STATE_TRANSITION]: {
65
+ code: NotificationErrorCode.NOTIFICATION_INVALID_STATE_TRANSITION,
66
+ statusCode: 400,
67
+ },
68
+ // 409 - Conflict
69
+ [NotificationErrorCode.NOTIFICATION_ALREADY_SENT]: {
70
+ code: NotificationErrorCode.NOTIFICATION_ALREADY_SENT,
71
+ statusCode: 409,
72
+ },
73
+ // 422 - Unprocessable Entity
74
+ [NotificationErrorCode.NOTIFICATION_MAX_ATTEMPTS_REACHED]: {
75
+ code: NotificationErrorCode.NOTIFICATION_MAX_ATTEMPTS_REACHED,
76
+ statusCode: 422,
77
+ },
78
+ [NotificationErrorCode.NOTIFICATION_RECIPIENT_UNSUBSCRIBED]: {
79
+ code: NotificationErrorCode.NOTIFICATION_RECIPIENT_UNSUBSCRIBED,
80
+ statusCode: 422,
81
+ },
82
+ // 429 - Too Many Requests
83
+ [NotificationErrorCode.NOTIFICATION_RATE_LIMIT_EXCEEDED]: {
84
+ code: NotificationErrorCode.NOTIFICATION_RATE_LIMIT_EXCEEDED,
85
+ statusCode: 429,
86
+ },
87
+ // 500 - Internal Server Error
88
+ [NotificationErrorCode.NOTIFICATION_TEMPLATE_RENDER_FAILED]: {
89
+ code: NotificationErrorCode.NOTIFICATION_TEMPLATE_RENDER_FAILED,
90
+ statusCode: 500,
91
+ },
92
+ [NotificationErrorCode.NOTIFICATION_SEND_FAILED]: {
93
+ code: NotificationErrorCode.NOTIFICATION_SEND_FAILED,
94
+ statusCode: 500,
95
+ },
96
+ // 503 - Service Unavailable
97
+ [NotificationErrorCode.NOTIFICATION_PROVIDER_ERROR]: {
98
+ code: NotificationErrorCode.NOTIFICATION_PROVIDER_ERROR,
99
+ statusCode: 503,
100
+ },
101
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Email Template enum
3
+ * Defines available email templates
4
+ */
5
+ export declare enum EmailTemplate {
6
+ WELCOME = "WELCOME",
7
+ EMAIL_VERIFICATION = "EMAIL_VERIFICATION",
8
+ PASSWORD_RESET = "PASSWORD_RESET",
9
+ PASSWORD_CHANGED = "PASSWORD_CHANGED",
10
+ LOGIN_FROM_NEW_DEVICE = "LOGIN_FROM_NEW_DEVICE",
11
+ SUSPICIOUS_ACTIVITY = "SUSPICIOUS_ACTIVITY"
12
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmailTemplate = void 0;
4
+ /**
5
+ * Email Template enum
6
+ * Defines available email templates
7
+ */
8
+ var EmailTemplate;
9
+ (function (EmailTemplate) {
10
+ // User lifecycle templates
11
+ EmailTemplate["WELCOME"] = "WELCOME";
12
+ EmailTemplate["EMAIL_VERIFICATION"] = "EMAIL_VERIFICATION";
13
+ EmailTemplate["PASSWORD_RESET"] = "PASSWORD_RESET";
14
+ EmailTemplate["PASSWORD_CHANGED"] = "PASSWORD_CHANGED";
15
+ // Account activity templates
16
+ EmailTemplate["LOGIN_FROM_NEW_DEVICE"] = "LOGIN_FROM_NEW_DEVICE";
17
+ EmailTemplate["SUSPICIOUS_ACTIVITY"] = "SUSPICIOUS_ACTIVITY";
18
+ // Notification templates
19
+ // Can be extended with marketing, transactional emails, etc.
20
+ })(EmailTemplate || (exports.EmailTemplate = EmailTemplate = {}));
@@ -0,0 +1,3 @@
1
+ export * from './notification-type.enum';
2
+ export * from './notification-status.enum';
3
+ export * from './email-template.enum';
@@ -0,0 +1,19 @@
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("./notification-type.enum"), exports);
18
+ __exportStar(require("./notification-status.enum"), exports);
19
+ __exportStar(require("./email-template.enum"), exports);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Notification Status enum
3
+ * Defines the lifecycle states of a notification in the outbox pattern
4
+ */
5
+ export declare enum NotificationStatus {
6
+ PENDING = "PENDING",// Created, waiting to be sent
7
+ PROCESSING = "PROCESSING",// Worker has picked it up
8
+ SENT = "SENT",// Successfully sent
9
+ ERROR = "ERROR",// Error occurred, but can retry (attempts < maxAttempts)
10
+ FAILED = "FAILED"
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationStatus = void 0;
4
+ /**
5
+ * Notification Status enum
6
+ * Defines the lifecycle states of a notification in the outbox pattern
7
+ */
8
+ var NotificationStatus;
9
+ (function (NotificationStatus) {
10
+ NotificationStatus["PENDING"] = "PENDING";
11
+ NotificationStatus["PROCESSING"] = "PROCESSING";
12
+ NotificationStatus["SENT"] = "SENT";
13
+ NotificationStatus["ERROR"] = "ERROR";
14
+ NotificationStatus["FAILED"] = "FAILED";
15
+ })(NotificationStatus || (exports.NotificationStatus = NotificationStatus = {}));
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Notification Type enum
3
+ * Defines supported notification channels
4
+ */
5
+ export declare enum NotificationType {
6
+ EMAIL = "EMAIL",
7
+ TELEGRAM = "TELEGRAM"
8
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationType = void 0;
4
+ /**
5
+ * Notification Type enum
6
+ * Defines supported notification channels
7
+ */
8
+ var NotificationType;
9
+ (function (NotificationType) {
10
+ NotificationType["EMAIL"] = "EMAIL";
11
+ NotificationType["TELEGRAM"] = "TELEGRAM";
12
+ // PUSH = 'PUSH', // can be added later
13
+ // SMS = 'SMS', // can be added later
14
+ })(NotificationType || (exports.NotificationType = NotificationType = {}));
@@ -1,7 +1,3 @@
1
+ export * from './commands';
1
2
  export * from './schemas';
2
- export * from './unregistered-users.types';
3
- export * from './unregistered-users.paths';
4
3
  export * from './unregistered-users.errors';
5
- export * from './commands';
6
- export { UNREG_USERS_CONTROLLER } from '../../controllers';
7
- export { UNREG_USERS_ROUTES } from '../../routes';
@@ -14,14 +14,6 @@ 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
- exports.UNREG_USERS_ROUTES = exports.UNREG_USERS_CONTROLLER = void 0;
17
+ __exportStar(require("./commands"), exports);
18
18
  __exportStar(require("./schemas"), exports);
19
- __exportStar(require("./unregistered-users.types"), exports);
20
- __exportStar(require("./unregistered-users.paths"), exports);
21
19
  __exportStar(require("./unregistered-users.errors"), exports);
22
- __exportStar(require("./commands"), exports);
23
- // Re-export from centralized locations
24
- var controllers_1 = require("../../controllers");
25
- Object.defineProperty(exports, "UNREG_USERS_CONTROLLER", { enumerable: true, get: function () { return controllers_1.UNREG_USERS_CONTROLLER; } });
26
- var routes_1 = require("../../routes");
27
- Object.defineProperty(exports, "UNREG_USERS_ROUTES", { enumerable: true, get: function () { return routes_1.UNREG_USERS_ROUTES; } });
@@ -1,15 +1,14 @@
1
- /**
2
- * Unregistered User error codes
3
- */
1
+ import { ErrorMetadata } from '../../shared/error-metadata';
4
2
  export declare enum UnregUserErrorCode {
5
- /** Invalid JWT token */
6
3
  INVALID_TOKEN = "INVALID_TOKEN",
7
- /** Token expired or invalidated */
8
4
  TOKEN_EXPIRED = "TOKEN_EXPIRED",
9
- /** IP mismatch - token bound to different IP */
10
5
  IP_MISMATCH = "IP_MISMATCH",
11
- /** User marked as fraud */
12
6
  FRAUD_DETECTED = "FRAUD_DETECTED",
13
- /** Token version mismatch */
14
- TOKEN_VERSION_MISMATCH = "TOKEN_VERSION_MISMATCH"
7
+ TOKEN_VERSION_MISMATCH = "TOKEN_VERSION_MISMATCH",
8
+ CANNOT_RESET_FRAUD_USER = "CANNOT_RESET_FRAUD_USER",
9
+ USER_ALREADY_FRAUD = "USER_ALREADY_FRAUD",
10
+ USER_ALREADY_MIGRATED = "USER_ALREADY_MIGRATED",
11
+ CANNOT_MIGRATE_FRAUD_USER = "CANNOT_MIGRATE_FRAUD_USER",
12
+ INVALID_USER_DATA = "INVALID_USER_DATA"
15
13
  }
14
+ export declare const UNREG_USER_ERRORS: Record<UnregUserErrorCode, ErrorMetadata>;
@@ -1,19 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnregUserErrorCode = void 0;
4
- /**
5
- * Unregistered User error codes
6
- */
3
+ exports.UNREG_USER_ERRORS = exports.UnregUserErrorCode = void 0;
7
4
  var UnregUserErrorCode;
8
5
  (function (UnregUserErrorCode) {
9
- /** Invalid JWT token */
10
6
  UnregUserErrorCode["INVALID_TOKEN"] = "INVALID_TOKEN";
11
- /** Token expired or invalidated */
12
7
  UnregUserErrorCode["TOKEN_EXPIRED"] = "TOKEN_EXPIRED";
13
- /** IP mismatch - token bound to different IP */
14
8
  UnregUserErrorCode["IP_MISMATCH"] = "IP_MISMATCH";
15
- /** User marked as fraud */
16
9
  UnregUserErrorCode["FRAUD_DETECTED"] = "FRAUD_DETECTED";
17
- /** Token version mismatch */
18
10
  UnregUserErrorCode["TOKEN_VERSION_MISMATCH"] = "TOKEN_VERSION_MISMATCH";
11
+ UnregUserErrorCode["CANNOT_RESET_FRAUD_USER"] = "CANNOT_RESET_FRAUD_USER";
12
+ UnregUserErrorCode["USER_ALREADY_FRAUD"] = "USER_ALREADY_FRAUD";
13
+ UnregUserErrorCode["USER_ALREADY_MIGRATED"] = "USER_ALREADY_MIGRATED";
14
+ UnregUserErrorCode["CANNOT_MIGRATE_FRAUD_USER"] = "CANNOT_MIGRATE_FRAUD_USER";
15
+ UnregUserErrorCode["INVALID_USER_DATA"] = "INVALID_USER_DATA";
19
16
  })(UnregUserErrorCode || (exports.UnregUserErrorCode = UnregUserErrorCode = {}));
17
+ exports.UNREG_USER_ERRORS = {
18
+ [UnregUserErrorCode.INVALID_TOKEN]: { code: UnregUserErrorCode.INVALID_TOKEN, statusCode: 401 },
19
+ [UnregUserErrorCode.TOKEN_EXPIRED]: { code: UnregUserErrorCode.TOKEN_EXPIRED, statusCode: 401 },
20
+ [UnregUserErrorCode.IP_MISMATCH]: { code: UnregUserErrorCode.IP_MISMATCH, statusCode: 403 },
21
+ [UnregUserErrorCode.FRAUD_DETECTED]: { code: UnregUserErrorCode.FRAUD_DETECTED, statusCode: 403 },
22
+ [UnregUserErrorCode.TOKEN_VERSION_MISMATCH]: { code: UnregUserErrorCode.TOKEN_VERSION_MISMATCH, statusCode: 401 },
23
+ [UnregUserErrorCode.CANNOT_RESET_FRAUD_USER]: { code: UnregUserErrorCode.CANNOT_RESET_FRAUD_USER, statusCode: 400 },
24
+ [UnregUserErrorCode.USER_ALREADY_FRAUD]: { code: UnregUserErrorCode.USER_ALREADY_FRAUD, statusCode: 400 },
25
+ [UnregUserErrorCode.USER_ALREADY_MIGRATED]: { code: UnregUserErrorCode.USER_ALREADY_MIGRATED, statusCode: 400 },
26
+ [UnregUserErrorCode.CANNOT_MIGRATE_FRAUD_USER]: { code: UnregUserErrorCode.CANNOT_MIGRATE_FRAUD_USER, statusCode: 400 },
27
+ [UnregUserErrorCode.INVALID_USER_DATA]: { code: UnregUserErrorCode.INVALID_USER_DATA, statusCode: 400 },
28
+ };
@@ -1,6 +1,5 @@
1
1
  export * from './schemas';
2
- export * from './users.types';
3
- export * from './users.paths';
2
+ export * from './users.errors';
4
3
  export * from './commands';
5
4
  export * from './queries';
6
5
  export { USERS_CONTROLLER } from '../../controllers';
@@ -16,8 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.USERS_ROUTES = exports.USERS_CONTROLLER = void 0;
18
18
  __exportStar(require("./schemas"), exports);
19
- __exportStar(require("./users.types"), exports);
20
- __exportStar(require("./users.paths"), exports);
19
+ __exportStar(require("./users.errors"), exports);
21
20
  __exportStar(require("./commands"), exports);
22
21
  __exportStar(require("./queries"), exports);
23
22
  // Re-export from centralized locations
@@ -0,0 +1,18 @@
1
+ import { ErrorMetadata } from '../../shared';
2
+ export declare enum UserErrorCode {
3
+ USER_NOT_FOUND = "USER_NOT_FOUND",
4
+ INCORRECT_PASSWORD = "INCORRECT_PASSWORD",
5
+ USER_DELETED = "USER_DELETED",
6
+ EMAIL_ALREADY_EXISTS = "EMAIL_ALREADY_EXISTS",
7
+ INVALID_EMAIL_FORMAT = "INVALID_EMAIL_FORMAT",
8
+ INVALID_PASSWORD_FORMAT = "INVALID_PASSWORD_FORMAT",
9
+ WEAK_PASSWORD = "WEAK_PASSWORD",
10
+ INVALID_USER_ROLE = "INVALID_USER_ROLE",
11
+ PASSWORD_MISMATCH = "PASSWORD_MISMATCH",
12
+ SAME_PASSWORD = "SAME_PASSWORD",
13
+ INVALID_USER_DATA = "INVALID_USER_DATA",
14
+ USER_CREATION_FAILED = "USER_CREATION_FAILED",
15
+ USER_UPDATE_FAILED = "USER_UPDATE_FAILED",
16
+ PASSWORD_CHANGE_FAILED = "PASSWORD_CHANGE_FAILED"
17
+ }
18
+ export declare const USER_ERRORS: Record<UserErrorCode, ErrorMetadata>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_ERRORS = exports.UserErrorCode = void 0;
4
+ var UserErrorCode;
5
+ (function (UserErrorCode) {
6
+ UserErrorCode["USER_NOT_FOUND"] = "USER_NOT_FOUND";
7
+ UserErrorCode["INCORRECT_PASSWORD"] = "INCORRECT_PASSWORD";
8
+ UserErrorCode["USER_DELETED"] = "USER_DELETED";
9
+ UserErrorCode["EMAIL_ALREADY_EXISTS"] = "EMAIL_ALREADY_EXISTS";
10
+ UserErrorCode["INVALID_EMAIL_FORMAT"] = "INVALID_EMAIL_FORMAT";
11
+ UserErrorCode["INVALID_PASSWORD_FORMAT"] = "INVALID_PASSWORD_FORMAT";
12
+ UserErrorCode["WEAK_PASSWORD"] = "WEAK_PASSWORD";
13
+ UserErrorCode["INVALID_USER_ROLE"] = "INVALID_USER_ROLE";
14
+ UserErrorCode["PASSWORD_MISMATCH"] = "PASSWORD_MISMATCH";
15
+ UserErrorCode["SAME_PASSWORD"] = "SAME_PASSWORD";
16
+ UserErrorCode["INVALID_USER_DATA"] = "INVALID_USER_DATA";
17
+ UserErrorCode["USER_CREATION_FAILED"] = "USER_CREATION_FAILED";
18
+ UserErrorCode["USER_UPDATE_FAILED"] = "USER_UPDATE_FAILED";
19
+ UserErrorCode["PASSWORD_CHANGE_FAILED"] = "PASSWORD_CHANGE_FAILED";
20
+ })(UserErrorCode || (exports.UserErrorCode = UserErrorCode = {}));
21
+ exports.USER_ERRORS = {
22
+ [UserErrorCode.USER_NOT_FOUND]: { code: UserErrorCode.USER_NOT_FOUND, statusCode: 404 },
23
+ [UserErrorCode.INCORRECT_PASSWORD]: { code: UserErrorCode.INCORRECT_PASSWORD, statusCode: 401 },
24
+ [UserErrorCode.USER_DELETED]: { code: UserErrorCode.USER_DELETED, statusCode: 401 },
25
+ [UserErrorCode.EMAIL_ALREADY_EXISTS]: {
26
+ code: UserErrorCode.EMAIL_ALREADY_EXISTS,
27
+ statusCode: 409,
28
+ },
29
+ [UserErrorCode.INVALID_EMAIL_FORMAT]: {
30
+ code: UserErrorCode.INVALID_EMAIL_FORMAT,
31
+ statusCode: 400,
32
+ },
33
+ [UserErrorCode.INVALID_PASSWORD_FORMAT]: {
34
+ code: UserErrorCode.INVALID_PASSWORD_FORMAT,
35
+ statusCode: 400,
36
+ },
37
+ [UserErrorCode.WEAK_PASSWORD]: { code: UserErrorCode.WEAK_PASSWORD, statusCode: 400 },
38
+ [UserErrorCode.INVALID_USER_ROLE]: { code: UserErrorCode.INVALID_USER_ROLE, statusCode: 400 },
39
+ [UserErrorCode.PASSWORD_MISMATCH]: { code: UserErrorCode.PASSWORD_MISMATCH, statusCode: 400 },
40
+ [UserErrorCode.SAME_PASSWORD]: { code: UserErrorCode.SAME_PASSWORD, statusCode: 400 },
41
+ [UserErrorCode.INVALID_USER_DATA]: { code: UserErrorCode.INVALID_USER_DATA, statusCode: 400 },
42
+ [UserErrorCode.USER_CREATION_FAILED]: {
43
+ code: UserErrorCode.USER_CREATION_FAILED,
44
+ statusCode: 500,
45
+ },
46
+ [UserErrorCode.USER_UPDATE_FAILED]: { code: UserErrorCode.USER_UPDATE_FAILED, statusCode: 500 },
47
+ [UserErrorCode.PASSWORD_CHANGE_FAILED]: {
48
+ code: UserErrorCode.PASSWORD_CHANGE_FAILED,
49
+ statusCode: 500,
50
+ },
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veruna/api-contracts",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "API contracts for Veruna project - Zod schemas, types, and paths",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1,17 +0,0 @@
1
- export declare const AUTH_PATHS: {
2
- readonly BASE: "v1/auth";
3
- readonly SIGNUP: "signup";
4
- readonly SIGNIN: "signin";
5
- readonly LOGOUT: "logout";
6
- readonly LOGOUT_ALL: "logout-all";
7
- readonly SESSIONS: "sessions";
8
- readonly SESSION_BY_ID: "sessions/:id";
9
- };
10
- export declare const AUTH_API_PATHS: {
11
- readonly SIGNUP: "/api/v1/auth/signup";
12
- readonly SIGNIN: "/api/v1/auth/signin";
13
- readonly LOGOUT: "/api/v1/auth/logout";
14
- readonly LOGOUT_ALL: "/api/v1/auth/logout-all";
15
- readonly SESSIONS: "/api/v1/auth/sessions";
16
- readonly SESSION_BY_ID: (id: string) => string;
17
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AUTH_API_PATHS = exports.AUTH_PATHS = void 0;
4
- exports.AUTH_PATHS = {
5
- BASE: 'v1/auth',
6
- SIGNUP: 'signup',
7
- SIGNIN: 'signin',
8
- LOGOUT: 'logout',
9
- LOGOUT_ALL: 'logout-all',
10
- SESSIONS: 'sessions',
11
- SESSION_BY_ID: 'sessions/:id',
12
- };
13
- exports.AUTH_API_PATHS = {
14
- SIGNUP: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.SIGNUP}`,
15
- SIGNIN: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.SIGNIN}`,
16
- LOGOUT: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.LOGOUT}`,
17
- LOGOUT_ALL: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.LOGOUT_ALL}`,
18
- SESSIONS: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.SESSIONS}`,
19
- SESSION_BY_ID: (id) => `/api/${exports.AUTH_PATHS.BASE}/sessions/${id}`,
20
- };
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
- import { SignUpRequestSchema, SignInRequestSchema, SessionResponseSchema, AuthResponseSchema, SessionsListResponseSchema } from './schemas';
3
- export { UserRole } from './schemas/user-role.enum';
4
- export type SignUpRequest = z.infer<typeof SignUpRequestSchema>;
5
- export type SignInRequest = z.infer<typeof SignInRequestSchema>;
6
- export type SessionResponse = z.infer<typeof SessionResponseSchema>;
7
- export type AuthResponse = z.infer<typeof AuthResponseSchema>;
8
- export type SessionsListResponse = z.infer<typeof SessionsListResponseSchema>;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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; } });
@@ -1,36 +0,0 @@
1
- /**
2
- * Blog Admin API Paths (UUID-based, requires admin role)
3
- */
4
- export declare const BLOG_ADMIN_PATHS: {
5
- readonly BASE: "v1/admin/blog";
6
- readonly CATEGORIES: "categories";
7
- readonly CATEGORY_BY_UUID: "categories/:uuid";
8
- readonly POSTS: "posts";
9
- readonly POST_BY_UUID: "posts/:uuid";
10
- };
11
- /**
12
- * Blog Public API Paths (alias-based, public access)
13
- */
14
- export declare const BLOG_PUBLIC_PATHS: {
15
- readonly BASE: "v1/blog";
16
- readonly CATEGORIES: "categories";
17
- readonly POSTS: "posts";
18
- readonly POST_BY_ALIAS: "posts/:alias";
19
- };
20
- /**
21
- * Full Admin API URLs
22
- */
23
- export declare const BLOG_ADMIN_API_PATHS: {
24
- readonly CATEGORIES: "/api/v1/admin/blog/categories";
25
- readonly CATEGORY_BY_UUID: (uuid: string) => string;
26
- readonly POSTS: "/api/v1/admin/blog/posts";
27
- readonly POST_BY_UUID: (uuid: string) => string;
28
- };
29
- /**
30
- * Full Public API URLs
31
- */
32
- export declare const BLOG_PUBLIC_API_PATHS: {
33
- readonly CATEGORIES: "/api/v1/blog/categories";
34
- readonly POSTS: "/api/v1/blog/posts";
35
- readonly POST_BY_ALIAS: (alias: string) => string;
36
- };
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BLOG_PUBLIC_API_PATHS = exports.BLOG_ADMIN_API_PATHS = exports.BLOG_PUBLIC_PATHS = exports.BLOG_ADMIN_PATHS = void 0;
4
- /**
5
- * Blog Admin API Paths (UUID-based, requires admin role)
6
- */
7
- exports.BLOG_ADMIN_PATHS = {
8
- BASE: 'v1/admin/blog',
9
- // Categories
10
- CATEGORIES: 'categories',
11
- CATEGORY_BY_UUID: 'categories/:uuid',
12
- // Posts
13
- POSTS: 'posts',
14
- POST_BY_UUID: 'posts/:uuid',
15
- };
16
- /**
17
- * Blog Public API Paths (alias-based, public access)
18
- */
19
- exports.BLOG_PUBLIC_PATHS = {
20
- BASE: 'v1/blog',
21
- // Categories
22
- CATEGORIES: 'categories',
23
- // Posts
24
- POSTS: 'posts',
25
- POST_BY_ALIAS: 'posts/:alias',
26
- };
27
- /**
28
- * Full Admin API URLs
29
- */
30
- exports.BLOG_ADMIN_API_PATHS = {
31
- // Categories
32
- CATEGORIES: `/api/${exports.BLOG_ADMIN_PATHS.BASE}/${exports.BLOG_ADMIN_PATHS.CATEGORIES}`,
33
- CATEGORY_BY_UUID: (uuid) => `/api/${exports.BLOG_ADMIN_PATHS.BASE}/categories/${uuid}`,
34
- // Posts
35
- POSTS: `/api/${exports.BLOG_ADMIN_PATHS.BASE}/${exports.BLOG_ADMIN_PATHS.POSTS}`,
36
- POST_BY_UUID: (uuid) => `/api/${exports.BLOG_ADMIN_PATHS.BASE}/posts/${uuid}`,
37
- };
38
- /**
39
- * Full Public API URLs
40
- */
41
- exports.BLOG_PUBLIC_API_PATHS = {
42
- // Categories
43
- CATEGORIES: `/api/${exports.BLOG_PUBLIC_PATHS.BASE}/${exports.BLOG_PUBLIC_PATHS.CATEGORIES}`,
44
- // Posts
45
- POSTS: `/api/${exports.BLOG_PUBLIC_PATHS.BASE}/${exports.BLOG_PUBLIC_PATHS.POSTS}`,
46
- POST_BY_ALIAS: (alias) => `/api/${exports.BLOG_PUBLIC_PATHS.BASE}/posts/${alias}`,
47
- };
@@ -1,12 +0,0 @@
1
- import { z } from 'zod';
2
- import { CategoryResponseSchema, CreateCategoryRequestSchema, UpdateCategoryRequestSchema, PostResponseSchema, CreatePostRequestSchema, UpdatePostRequestSchema, GetPostsQueryAdminSchema, GetPostsQueryPublicSchema } from './schemas';
3
- export { BlogCategoryStatus } from './schemas/blog-category-status.enum';
4
- export { BlogPostStatus } from './schemas/blog-post-status.enum';
5
- export type CategoryResponse = z.infer<typeof CategoryResponseSchema>;
6
- export type CreateCategoryRequest = z.infer<typeof CreateCategoryRequestSchema>;
7
- export type UpdateCategoryRequest = z.infer<typeof UpdateCategoryRequestSchema>;
8
- export type PostResponse = z.infer<typeof PostResponseSchema>;
9
- export type CreatePostRequest = z.infer<typeof CreatePostRequestSchema>;
10
- export type UpdatePostRequest = z.infer<typeof UpdatePostRequestSchema>;
11
- export type GetPostsQueryAdmin = z.infer<typeof GetPostsQueryAdminSchema>;
12
- export type GetPostsQueryPublic = z.infer<typeof GetPostsQueryPublicSchema>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BlogPostStatus = exports.BlogCategoryStatus = void 0;
4
- var blog_category_status_enum_1 = require("./schemas/blog-category-status.enum");
5
- Object.defineProperty(exports, "BlogCategoryStatus", { enumerable: true, get: function () { return blog_category_status_enum_1.BlogCategoryStatus; } });
6
- var blog_post_status_enum_1 = require("./schemas/blog-post-status.enum");
7
- Object.defineProperty(exports, "BlogPostStatus", { enumerable: true, get: function () { return blog_post_status_enum_1.BlogPostStatus; } });
@@ -1,15 +0,0 @@
1
- /**
2
- * Unregistered Users API paths
3
- */
4
- export declare const UNREG_USERS_PATHS: {
5
- /** Base path for unregistered users controller */
6
- readonly BASE: "v1/unreg";
7
- /** Authenticate unregistered user - PUT /api/v1/unreg */
8
- readonly AUTHENTICATE: "";
9
- };
10
- /**
11
- * Full API paths (with /api prefix)
12
- */
13
- export declare const UNREG_USERS_API_PATHS: {
14
- readonly AUTHENTICATE: "/api/v1/unreg";
15
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UNREG_USERS_API_PATHS = exports.UNREG_USERS_PATHS = void 0;
4
- /**
5
- * Unregistered Users API paths
6
- */
7
- exports.UNREG_USERS_PATHS = {
8
- /** Base path for unregistered users controller */
9
- BASE: 'v1/unreg',
10
- /** Authenticate unregistered user - PUT /api/v1/unreg */
11
- AUTHENTICATE: '',
12
- };
13
- /**
14
- * Full API paths (with /api prefix)
15
- */
16
- exports.UNREG_USERS_API_PATHS = {
17
- AUTHENTICATE: `/api/${exports.UNREG_USERS_PATHS.BASE}`,
18
- };
@@ -1,9 +0,0 @@
1
- import { z } from 'zod';
2
- import { AuthenticateUnregUserRequestSchema, AuthenticateUnregUserResponseSchema } from './schemas';
3
- export { UnregUserStatus } from './schemas/unreg-user-status.enum';
4
- export { UnregUserStatus as UnregUserStatusContract } from './schemas/unreg-user-status.enum';
5
- /**
6
- * Request/Response Types
7
- */
8
- export type AuthenticateUnregUserRequest = z.infer<typeof AuthenticateUnregUserRequestSchema>;
9
- export type AuthenticateUnregUserResponse = z.infer<typeof AuthenticateUnregUserResponseSchema>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnregUserStatusContract = exports.UnregUserStatus = void 0;
4
- var unreg_user_status_enum_1 = require("./schemas/unreg-user-status.enum");
5
- Object.defineProperty(exports, "UnregUserStatus", { enumerable: true, get: function () { return unreg_user_status_enum_1.UnregUserStatus; } });
6
- // Backward compatibility
7
- var unreg_user_status_enum_2 = require("./schemas/unreg-user-status.enum");
8
- Object.defineProperty(exports, "UnregUserStatusContract", { enumerable: true, get: function () { return unreg_user_status_enum_2.UnregUserStatus; } });
@@ -1,11 +0,0 @@
1
- export declare const USERS_PATHS: {
2
- readonly BASE: "v1/users";
3
- readonly ME: "me";
4
- readonly ME_MARKETING_CONSENT: "me/marketing-consent";
5
- readonly ME_PASSWORD: "me/password";
6
- };
7
- export declare const USERS_API_PATHS: {
8
- readonly ME: "/api/v1/users/me";
9
- readonly ME_MARKETING_CONSENT: "/api/v1/users/me/marketing-consent";
10
- readonly ME_PASSWORD: "/api/v1/users/me/password";
11
- };