@veruna/api-contracts 1.0.40 → 1.0.41

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 (62) hide show
  1. package/build/controllers/index.d.ts +2 -0
  2. package/build/controllers/index.js +5 -1
  3. package/build/controllers/sitemap.controllers.d.ts +1 -0
  4. package/build/controllers/sitemap.controllers.js +4 -0
  5. package/build/controllers/wallet.controllers.d.ts +7 -0
  6. package/build/controllers/wallet.controllers.js +10 -0
  7. package/build/rest-api.d.ts +3 -0
  8. package/build/rest-api.js +4 -0
  9. package/build/routes/index.d.ts +2 -0
  10. package/build/routes/index.js +5 -1
  11. package/build/routes/sitemap.routes.d.ts +3 -0
  12. package/build/routes/sitemap.routes.js +6 -0
  13. package/build/routes/wallet.routes.d.ts +11 -0
  14. package/build/routes/wallet.routes.js +14 -0
  15. package/build/shared/common-schemas.d.ts +5 -0
  16. package/build/shared/common-schemas.js +9 -4
  17. package/build/shared/regex.d.ts +1 -0
  18. package/build/shared/regex.js +3 -1
  19. package/build/v1/blog/admin/commands/create-post.command.d.ts +2 -0
  20. package/build/v1/blog/admin/commands/update-post.command.d.ts +2 -0
  21. package/build/v1/blog/admin/queries/get-post.query.d.ts +1 -0
  22. package/build/v1/blog/admin/queries/get-posts.query.d.ts +1 -0
  23. package/build/v1/blog/public/queries/get-post-by-alias.query.d.ts +1 -0
  24. package/build/v1/blog/public/queries/get-posts.query.d.ts +1 -0
  25. package/build/v1/blog/schemas/create-post-request.schema.d.ts +1 -0
  26. package/build/v1/blog/schemas/create-post-request.schema.js +1 -0
  27. package/build/v1/blog/schemas/post-response.schema.d.ts +1 -0
  28. package/build/v1/blog/schemas/post-response.schema.js +1 -0
  29. package/build/v1/blog/schemas/public-post-response.schema.d.ts +1 -0
  30. package/build/v1/blog/schemas/update-post-request.schema.d.ts +1 -0
  31. package/build/v1/blog/schemas/update-post-request.schema.js +1 -0
  32. package/build/v1/index.d.ts +2 -0
  33. package/build/v1/index.js +2 -0
  34. package/build/v1/sitemap/index.d.ts +1 -0
  35. package/build/v1/sitemap/index.js +5 -0
  36. package/build/v1/sitemap/sitemap-changefreq.enum.d.ts +9 -0
  37. package/build/v1/sitemap/sitemap-changefreq.enum.js +13 -0
  38. package/build/v1/wallet/index.d.ts +5 -0
  39. package/build/v1/wallet/index.js +25 -0
  40. package/build/v1/wallet/queries/get-balance-summary.query.d.ts +29 -0
  41. package/build/v1/wallet/queries/get-balance-summary.query.js +18 -0
  42. package/build/v1/wallet/queries/index.d.ts +1 -0
  43. package/build/v1/wallet/queries/index.js +5 -0
  44. package/build/v1/wallet/schemas/balance-response.schema.d.ts +40 -0
  45. package/build/v1/wallet/schemas/balance-response.schema.js +32 -0
  46. package/build/v1/wallet/schemas/balance-status.enum.d.ts +11 -0
  47. package/build/v1/wallet/schemas/balance-status.enum.js +15 -0
  48. package/build/v1/wallet/schemas/hold-status.enum.d.ts +10 -0
  49. package/build/v1/wallet/schemas/hold-status.enum.js +14 -0
  50. package/build/v1/wallet/schemas/index.d.ts +7 -0
  51. package/build/v1/wallet/schemas/index.js +25 -0
  52. package/build/v1/wallet/schemas/initiator-type.enum.d.ts +12 -0
  53. package/build/v1/wallet/schemas/initiator-type.enum.js +16 -0
  54. package/build/v1/wallet/schemas/metadata.schema.d.ts +29 -0
  55. package/build/v1/wallet/schemas/metadata.schema.js +105 -0
  56. package/build/v1/wallet/schemas/source-type.enum.d.ts +13 -0
  57. package/build/v1/wallet/schemas/source-type.enum.js +17 -0
  58. package/build/v1/wallet/schemas/transaction-type.enum.d.ts +17 -0
  59. package/build/v1/wallet/schemas/transaction-type.enum.js +21 -0
  60. package/build/v1/wallet/wallet.errors.d.ts +37 -0
  61. package/build/v1/wallet/wallet.errors.js +171 -0
  62. package/package.json +1 -1
@@ -13,3 +13,5 @@ export { CHAT_PROJECT_CONTROLLER } from './chat-project.controllers';
13
13
  export { CHAT_UNREG_CONTROLLER, CHAT_REG_CONTROLLER, CHAT_HISTORY_CONTROLLER, } from './chat.controllers';
14
14
  export { MESSAGE_UNREG_CONTROLLER, MESSAGE_REG_CONTROLLER } from './message.controllers';
15
15
  export { VERIFICATION_CONTROLLER } from './verification.controllers';
16
+ export { SITEMAP_CONTROLLER } from './sitemap.controllers';
17
+ export { WALLET_CONTROLLER } from './wallet.controllers';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VERIFICATION_CONTROLLER = exports.MESSAGE_REG_CONTROLLER = exports.MESSAGE_UNREG_CONTROLLER = exports.CHAT_HISTORY_CONTROLLER = exports.CHAT_REG_CONTROLLER = exports.CHAT_UNREG_CONTROLLER = exports.CHAT_PROJECT_CONTROLLER = exports.FILE_CONTROLLER = exports.AI_MODEL_PUBLIC_CONTROLLER = exports.AI_MODEL_ADMIN_CONTROLLER = exports.AI_PROVIDER_PUBLIC_CONTROLLER = exports.AI_PROVIDER_ADMIN_CONTROLLER = exports.SEO_PAGES_PUBLIC_CONTROLLER = exports.SEO_PAGES_ADMIN_CONTROLLER = exports.BLOG_PUBLIC_POSTS_CONTROLLER = exports.BLOG_PUBLIC_CATEGORIES_CONTROLLER = exports.BLOG_ADMIN_POSTS_CONTROLLER = exports.BLOG_ADMIN_CATEGORIES_CONTROLLER = exports.UNREG_USERS_CONTROLLER = exports.USERS_CONTROLLER = exports.AUTH_CONTROLLER = void 0;
3
+ exports.WALLET_CONTROLLER = exports.SITEMAP_CONTROLLER = exports.VERIFICATION_CONTROLLER = exports.MESSAGE_REG_CONTROLLER = exports.MESSAGE_UNREG_CONTROLLER = exports.CHAT_HISTORY_CONTROLLER = exports.CHAT_REG_CONTROLLER = exports.CHAT_UNREG_CONTROLLER = exports.CHAT_PROJECT_CONTROLLER = exports.FILE_CONTROLLER = exports.AI_MODEL_PUBLIC_CONTROLLER = exports.AI_MODEL_ADMIN_CONTROLLER = exports.AI_PROVIDER_PUBLIC_CONTROLLER = exports.AI_PROVIDER_ADMIN_CONTROLLER = exports.SEO_PAGES_PUBLIC_CONTROLLER = exports.SEO_PAGES_ADMIN_CONTROLLER = exports.BLOG_PUBLIC_POSTS_CONTROLLER = exports.BLOG_PUBLIC_CATEGORIES_CONTROLLER = exports.BLOG_ADMIN_POSTS_CONTROLLER = exports.BLOG_ADMIN_CATEGORIES_CONTROLLER = exports.UNREG_USERS_CONTROLLER = exports.USERS_CONTROLLER = exports.AUTH_CONTROLLER = void 0;
4
4
  /**
5
5
  * Centralized exports for all controllers
6
6
  */
@@ -37,3 +37,7 @@ Object.defineProperty(exports, "MESSAGE_UNREG_CONTROLLER", { enumerable: true, g
37
37
  Object.defineProperty(exports, "MESSAGE_REG_CONTROLLER", { enumerable: true, get: function () { return message_controllers_1.MESSAGE_REG_CONTROLLER; } });
38
38
  var verification_controllers_1 = require("./verification.controllers");
39
39
  Object.defineProperty(exports, "VERIFICATION_CONTROLLER", { enumerable: true, get: function () { return verification_controllers_1.VERIFICATION_CONTROLLER; } });
40
+ var sitemap_controllers_1 = require("./sitemap.controllers");
41
+ Object.defineProperty(exports, "SITEMAP_CONTROLLER", { enumerable: true, get: function () { return sitemap_controllers_1.SITEMAP_CONTROLLER; } });
42
+ var wallet_controllers_1 = require("./wallet.controllers");
43
+ Object.defineProperty(exports, "WALLET_CONTROLLER", { enumerable: true, get: function () { return wallet_controllers_1.WALLET_CONTROLLER; } });
@@ -0,0 +1 @@
1
+ export declare const SITEMAP_CONTROLLER: "xml/sitemap";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SITEMAP_CONTROLLER = void 0;
4
+ exports.SITEMAP_CONTROLLER = 'xml/sitemap';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Wallet Controller path for NestJS @Controller decorator
3
+ *
4
+ * Only public controller for user balance viewing.
5
+ * All wallet operations (Credit, Debit, Hold) are internal service calls.
6
+ */
7
+ export declare const WALLET_CONTROLLER: "v1/wallet";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WALLET_CONTROLLER = void 0;
4
+ /**
5
+ * Wallet Controller path for NestJS @Controller decorator
6
+ *
7
+ * Only public controller for user balance viewing.
8
+ * All wallet operations (Credit, Debit, Hold) are internal service calls.
9
+ */
10
+ exports.WALLET_CONTROLLER = 'v1/wallet';
@@ -152,5 +152,8 @@ export declare const REST_API: {
152
152
  readonly ACTIVE: "/api/v1/verification/active";
153
153
  readonly CANCEL: (requestId: string) => string;
154
154
  };
155
+ readonly WALLET: {
156
+ readonly BALANCE: "/api/v1/wallet/balance";
157
+ };
155
158
  };
156
159
  };
package/build/rest-api.js CHANGED
@@ -169,5 +169,9 @@ exports.REST_API = {
169
169
  ACTIVE: `${exports.ROOT}/${controllers_1.VERIFICATION_CONTROLLER}/${routes_1.VERIFICATION_ROUTES.ACTIVE}`,
170
170
  CANCEL: (requestId) => `${exports.ROOT}/${controllers_1.VERIFICATION_CONTROLLER}/${requestId}/cancel`,
171
171
  },
172
+ // Wallet module (only public balance endpoint)
173
+ WALLET: {
174
+ BALANCE: `${exports.ROOT}/${controllers_1.WALLET_CONTROLLER}/${routes_1.WALLET_ROUTES.BALANCE}`,
175
+ },
172
176
  },
173
177
  };
@@ -18,3 +18,5 @@ export { CHAT_PROJECT_ROUTES } from './chat-project.routes';
18
18
  export { CHAT_UNREG_ROUTES, CHAT_REG_ROUTES, CHAT_HISTORY_ROUTES } from './chat.routes';
19
19
  export { MESSAGE_UNREG_ROUTES, MESSAGE_REG_ROUTES } from './message.routes';
20
20
  export { VERIFICATION_ROUTES } from './verification.routes';
21
+ export { SITEMAP_ROUTES } from './sitemap.routes';
22
+ export { WALLET_ROUTES } from './wallet.routes';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VERIFICATION_ROUTES = exports.MESSAGE_REG_ROUTES = exports.MESSAGE_UNREG_ROUTES = exports.CHAT_HISTORY_ROUTES = exports.CHAT_REG_ROUTES = exports.CHAT_UNREG_ROUTES = exports.CHAT_PROJECT_ROUTES = exports.FILE_ROUTES = exports.AI_MODEL_PUBLIC_ROUTES = exports.AI_MODEL_ADMIN_ROUTES = exports.AI_PROVIDER_PUBLIC_ROUTES = exports.AI_PROVIDER_ADMIN_ROUTES = exports.SEO_PAGES_PUBLIC_ROUTES = exports.SEO_PAGES_ADMIN_ROUTES = exports.BLOG_PUBLIC_POSTS_ROUTES = exports.BLOG_PUBLIC_CATEGORIES_ROUTES = exports.BLOG_ADMIN_POSTS_ROUTES = exports.BLOG_ADMIN_CATEGORIES_ROUTES = exports.UNREG_USERS_ROUTES = exports.USERS_ROUTES = exports.AUTH_ROUTES = void 0;
3
+ exports.WALLET_ROUTES = exports.SITEMAP_ROUTES = exports.VERIFICATION_ROUTES = exports.MESSAGE_REG_ROUTES = exports.MESSAGE_UNREG_ROUTES = exports.CHAT_HISTORY_ROUTES = exports.CHAT_REG_ROUTES = exports.CHAT_UNREG_ROUTES = exports.CHAT_PROJECT_ROUTES = exports.FILE_ROUTES = exports.AI_MODEL_PUBLIC_ROUTES = exports.AI_MODEL_ADMIN_ROUTES = exports.AI_PROVIDER_PUBLIC_ROUTES = exports.AI_PROVIDER_ADMIN_ROUTES = exports.SEO_PAGES_PUBLIC_ROUTES = exports.SEO_PAGES_ADMIN_ROUTES = exports.BLOG_PUBLIC_POSTS_ROUTES = exports.BLOG_PUBLIC_CATEGORIES_ROUTES = exports.BLOG_ADMIN_POSTS_ROUTES = exports.BLOG_ADMIN_CATEGORIES_ROUTES = exports.UNREG_USERS_ROUTES = exports.USERS_ROUTES = exports.AUTH_ROUTES = void 0;
4
4
  /**
5
5
  * Centralized exports for all routes
6
6
  */
@@ -42,3 +42,7 @@ Object.defineProperty(exports, "MESSAGE_UNREG_ROUTES", { enumerable: true, get:
42
42
  Object.defineProperty(exports, "MESSAGE_REG_ROUTES", { enumerable: true, get: function () { return message_routes_1.MESSAGE_REG_ROUTES; } });
43
43
  var verification_routes_1 = require("./verification.routes");
44
44
  Object.defineProperty(exports, "VERIFICATION_ROUTES", { enumerable: true, get: function () { return verification_routes_1.VERIFICATION_ROUTES; } });
45
+ var sitemap_routes_1 = require("./sitemap.routes");
46
+ Object.defineProperty(exports, "SITEMAP_ROUTES", { enumerable: true, get: function () { return sitemap_routes_1.SITEMAP_ROUTES; } });
47
+ var wallet_routes_1 = require("./wallet.routes");
48
+ Object.defineProperty(exports, "WALLET_ROUTES", { enumerable: true, get: function () { return wallet_routes_1.WALLET_ROUTES; } });
@@ -0,0 +1,3 @@
1
+ export declare const SITEMAP_ROUTES: {
2
+ readonly GET: "";
3
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SITEMAP_ROUTES = void 0;
4
+ exports.SITEMAP_ROUTES = {
5
+ GET: '',
6
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Wallet Routes
3
+ * For NestJS method decorators (@Get, @Post, etc.)
4
+ *
5
+ * Only public route for getting balance.
6
+ * All other operations (Credit, Debit, Hold) are internal service calls,
7
+ * not exposed via HTTP endpoints.
8
+ */
9
+ export declare const WALLET_ROUTES: {
10
+ readonly BALANCE: "balance";
11
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WALLET_ROUTES = void 0;
4
+ /**
5
+ * Wallet Routes
6
+ * For NestJS method decorators (@Get, @Post, etc.)
7
+ *
8
+ * Only public route for getting balance.
9
+ * All other operations (Credit, Debit, Hold) are internal service calls,
10
+ * not exposed via HTTP endpoints.
11
+ */
12
+ exports.WALLET_ROUTES = {
13
+ BALANCE: 'balance',
14
+ };
@@ -15,3 +15,8 @@ export declare const EmptyResponseSchema: z.ZodObject<{}, z.core.$strip>;
15
15
  export declare const DeleteResponseSchema: z.ZodObject<{
16
16
  uuid: z.ZodString;
17
17
  }, z.core.$strip>;
18
+ /**
19
+ * BigInt as string schema (for JSON serialization of bigint values)
20
+ * Validates that string contains only digits (non-negative integer)
21
+ */
22
+ export declare const BigIntStringSchema: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeleteResponseSchema = exports.EmptyResponseSchema = exports.queryArraySchema = void 0;
3
+ exports.BigIntStringSchema = exports.DeleteResponseSchema = exports.EmptyResponseSchema = exports.queryArraySchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const regex_1 = require("./regex");
6
6
  /**
@@ -9,9 +9,7 @@ const regex_1 = require("./regex");
9
9
  * Usage: queryArraySchema() for optional, queryArraySchema(false) for required
10
10
  */
11
11
  const queryArraySchema = (optional = true) => {
12
- const schema = zod_1.z
13
- .union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())])
14
- .transform((val) => {
12
+ const schema = zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).transform((val) => {
15
13
  if (Array.isArray(val))
16
14
  return val;
17
15
  return [val];
@@ -29,3 +27,10 @@ exports.EmptyResponseSchema = zod_1.z.object({});
29
27
  exports.DeleteResponseSchema = zod_1.z.object({
30
28
  uuid: zod_1.z.string().regex(regex_1.UUID_REGEX),
31
29
  });
30
+ /**
31
+ * BigInt as string schema (for JSON serialization of bigint values)
32
+ * Validates that string contains only digits (non-negative integer)
33
+ */
34
+ exports.BigIntStringSchema = zod_1.z
35
+ .string()
36
+ .regex(regex_1.BIGINT_STRING_REGEX, 'Must be a non-negative integer string');
@@ -7,3 +7,4 @@ export declare const DATETIME_REGEX: RegExp;
7
7
  export declare const PASSWORD_STRENGTH_REGEX: RegExp;
8
8
  export declare const SLUG_REGEX: RegExp;
9
9
  export declare const HEX_COLOR_REGEX: RegExp;
10
+ export declare const BIGINT_STRING_REGEX: RegExp;
@@ -3,7 +3,7 @@
3
3
  * Common regex patterns for validation
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HEX_COLOR_REGEX = exports.SLUG_REGEX = exports.PASSWORD_STRENGTH_REGEX = exports.DATETIME_REGEX = exports.UUID_REGEX = exports.EMAIL_REGEX = void 0;
6
+ exports.BIGINT_STRING_REGEX = exports.HEX_COLOR_REGEX = exports.SLUG_REGEX = exports.PASSWORD_STRENGTH_REGEX = exports.DATETIME_REGEX = exports.UUID_REGEX = exports.EMAIL_REGEX = void 0;
7
7
  // RFC 5322 email regex (simplified)
8
8
  exports.EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
9
9
  // UUID v4 regex
@@ -16,3 +16,5 @@ exports.PASSWORD_STRENGTH_REGEX = /[0-9!@#$%^&*(),.?":{}|<>]/;
16
16
  exports.SLUG_REGEX = /^[a-z0-9-]+$/;
17
17
  // Hex color regex: #RRGGBB
18
18
  exports.HEX_COLOR_REGEX = /^#[0-9A-Fa-f]{6}$/;
19
+ // BigInt string regex (non-negative integer as string)
20
+ exports.BIGINT_STRING_REGEX = /^\d+$/;
@@ -4,6 +4,7 @@ export declare namespace AdminBlogCreatePostCommand {
4
4
  const Request: z.ZodObject<{
5
5
  alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
6
6
  title: z.ZodString;
7
+ description: z.ZodString;
7
8
  metaTitle: z.ZodString;
8
9
  metaDescription: z.ZodString;
9
10
  content: z.ZodString;
@@ -20,6 +21,7 @@ export declare namespace AdminBlogCreatePostCommand {
20
21
  uuid: z.ZodString;
21
22
  alias: z.ZodString;
22
23
  title: z.ZodString;
24
+ description: z.ZodString;
23
25
  metaTitle: z.ZodString;
24
26
  metaDescription: z.ZodString;
25
27
  content: z.ZodString;
@@ -4,6 +4,7 @@ export declare namespace AdminBlogUpdatePostCommand {
4
4
  const Request: z.ZodObject<{
5
5
  alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
6
6
  title: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodOptional<z.ZodString>;
7
8
  metaTitle: z.ZodOptional<z.ZodString>;
8
9
  metaDescription: z.ZodOptional<z.ZodString>;
9
10
  content: z.ZodOptional<z.ZodString>;
@@ -20,6 +21,7 @@ export declare namespace AdminBlogUpdatePostCommand {
20
21
  uuid: z.ZodString;
21
22
  alias: z.ZodString;
22
23
  title: z.ZodString;
24
+ description: z.ZodString;
23
25
  metaTitle: z.ZodString;
24
26
  metaDescription: z.ZodString;
25
27
  content: z.ZodString;
@@ -8,6 +8,7 @@ export declare namespace AdminBlogGetPostQuery {
8
8
  uuid: z.ZodString;
9
9
  alias: z.ZodString;
10
10
  title: z.ZodString;
11
+ description: z.ZodString;
11
12
  metaTitle: z.ZodString;
12
13
  metaDescription: z.ZodString;
13
14
  content: z.ZodString;
@@ -12,6 +12,7 @@ export declare namespace AdminBlogGetPostsQuery {
12
12
  uuid: z.ZodString;
13
13
  alias: z.ZodString;
14
14
  title: z.ZodString;
15
+ description: z.ZodString;
15
16
  metaTitle: z.ZodString;
16
17
  metaDescription: z.ZodString;
17
18
  content: z.ZodString;
@@ -8,6 +8,7 @@ export declare namespace BlogGetPostByAliasQuery {
8
8
  uuid: z.ZodString;
9
9
  alias: z.ZodString;
10
10
  title: z.ZodString;
11
+ description: z.ZodString;
11
12
  metaTitle: z.ZodString;
12
13
  metaDescription: z.ZodString;
13
14
  content: z.ZodString;
@@ -11,6 +11,7 @@ export declare namespace BlogGetPostsQuery {
11
11
  uuid: z.ZodString;
12
12
  alias: z.ZodString;
13
13
  title: z.ZodString;
14
+ description: z.ZodString;
14
15
  metaTitle: z.ZodString;
15
16
  metaDescription: z.ZodString;
16
17
  content: z.ZodString;
@@ -4,6 +4,7 @@ import { BlogPostMark } from './blog-post-mark.enum';
4
4
  export declare const CreatePostRequestSchema: z.ZodObject<{
5
5
  alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
6
6
  title: z.ZodString;
7
+ description: z.ZodString;
7
8
  metaTitle: z.ZodString;
8
9
  metaDescription: z.ZodString;
9
10
  content: z.ZodString;
@@ -14,6 +14,7 @@ exports.CreatePostRequestSchema = zod_1.z
14
14
  .regex(shared_1.SLUG_REGEX)
15
15
  .transform((val) => val.toLowerCase().trim()),
16
16
  title: zod_1.z.string().min(1).max(300),
17
+ description: zod_1.z.string().max(1000),
17
18
  metaTitle: zod_1.z.string().min(1).max(100),
18
19
  metaDescription: zod_1.z.string().min(1).max(200),
19
20
  content: zod_1.z.string().min(1).max(1000000),
@@ -8,6 +8,7 @@ export declare const PostResponseSchema: z.ZodObject<{
8
8
  uuid: z.ZodString;
9
9
  alias: z.ZodString;
10
10
  title: z.ZodString;
11
+ description: z.ZodString;
11
12
  metaTitle: z.ZodString;
12
13
  metaDescription: z.ZodString;
13
14
  content: z.ZodString;
@@ -13,6 +13,7 @@ exports.PostResponseSchema = zod_1.z.object({
13
13
  uuid: zod_1.z.string().regex(regex_1.UUID_REGEX),
14
14
  alias: zod_1.z.string(),
15
15
  title: zod_1.z.string(),
16
+ description: zod_1.z.string(),
16
17
  metaTitle: zod_1.z.string(),
17
18
  metaDescription: zod_1.z.string(),
18
19
  content: zod_1.z.string(),
@@ -14,6 +14,7 @@ export declare const PublicPostResponseSchema: z.ZodObject<{
14
14
  uuid: z.ZodString;
15
15
  alias: z.ZodString;
16
16
  title: z.ZodString;
17
+ description: z.ZodString;
17
18
  metaTitle: z.ZodString;
18
19
  metaDescription: z.ZodString;
19
20
  content: z.ZodString;
@@ -4,6 +4,7 @@ import { BlogPostMark } from './blog-post-mark.enum';
4
4
  export declare const UpdatePostRequestSchema: z.ZodObject<{
5
5
  alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
6
6
  title: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodOptional<z.ZodString>;
7
8
  metaTitle: z.ZodOptional<z.ZodString>;
8
9
  metaDescription: z.ZodOptional<z.ZodString>;
9
10
  content: z.ZodOptional<z.ZodString>;
@@ -15,6 +15,7 @@ exports.UpdatePostRequestSchema = zod_1.z
15
15
  .transform((val) => val.toLowerCase().trim())
16
16
  .optional(),
17
17
  title: zod_1.z.string().min(1).max(300).optional(),
18
+ description: zod_1.z.string().max(1000).optional(),
18
19
  metaTitle: zod_1.z.string().min(1).max(100).optional(),
19
20
  metaDescription: zod_1.z.string().min(1).max(200).optional(),
20
21
  content: zod_1.z.string().min(1).max(1000000).optional(),
@@ -12,3 +12,5 @@ export * from './chat';
12
12
  export * from './message';
13
13
  export * from './ai';
14
14
  export * from './verification';
15
+ export * from './sitemap';
16
+ export * from './wallet';
package/build/v1/index.js CHANGED
@@ -28,3 +28,5 @@ __exportStar(require("./chat"), exports);
28
28
  __exportStar(require("./message"), exports);
29
29
  __exportStar(require("./ai"), exports);
30
30
  __exportStar(require("./verification"), exports);
31
+ __exportStar(require("./sitemap"), exports);
32
+ __exportStar(require("./wallet"), exports);
@@ -0,0 +1 @@
1
+ export { SitemapChangefreq } from './sitemap-changefreq.enum';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SitemapChangefreq = void 0;
4
+ var sitemap_changefreq_enum_1 = require("./sitemap-changefreq.enum");
5
+ Object.defineProperty(exports, "SitemapChangefreq", { enumerable: true, get: function () { return sitemap_changefreq_enum_1.SitemapChangefreq; } });
@@ -0,0 +1,9 @@
1
+ export declare enum SitemapChangefreq {
2
+ ALWAYS = "always",
3
+ HOURLY = "hourly",
4
+ DAILY = "daily",
5
+ WEEKLY = "weekly",
6
+ MONTHLY = "monthly",
7
+ YEARLY = "yearly",
8
+ NEVER = "never"
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SitemapChangefreq = void 0;
4
+ var SitemapChangefreq;
5
+ (function (SitemapChangefreq) {
6
+ SitemapChangefreq["ALWAYS"] = "always";
7
+ SitemapChangefreq["HOURLY"] = "hourly";
8
+ SitemapChangefreq["DAILY"] = "daily";
9
+ SitemapChangefreq["WEEKLY"] = "weekly";
10
+ SitemapChangefreq["MONTHLY"] = "monthly";
11
+ SitemapChangefreq["YEARLY"] = "yearly";
12
+ SitemapChangefreq["NEVER"] = "never";
13
+ })(SitemapChangefreq || (exports.SitemapChangefreq = SitemapChangefreq = {}));
@@ -0,0 +1,5 @@
1
+ export * from './schemas';
2
+ export * from './wallet.errors';
3
+ export * from './queries';
4
+ export { WALLET_CONTROLLER } from '../../controllers';
5
+ export { WALLET_ROUTES } from '../../routes';
@@ -0,0 +1,25 @@
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
+ exports.WALLET_ROUTES = exports.WALLET_CONTROLLER = void 0;
18
+ __exportStar(require("./schemas"), exports);
19
+ __exportStar(require("./wallet.errors"), exports);
20
+ __exportStar(require("./queries"), exports);
21
+ // Re-export from centralized locations
22
+ var controllers_1 = require("../../controllers");
23
+ Object.defineProperty(exports, "WALLET_CONTROLLER", { enumerable: true, get: function () { return controllers_1.WALLET_CONTROLLER; } });
24
+ var routes_1 = require("../../routes");
25
+ Object.defineProperty(exports, "WALLET_ROUTES", { enumerable: true, get: function () { return routes_1.WALLET_ROUTES; } });
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ /**
4
+ * Get Balance Summary Query
5
+ * Public API - returns user's balance summary
6
+ */
7
+ export declare namespace GetBalanceSummaryQuery {
8
+ const Request: z.ZodObject<{}, z.core.$strip>;
9
+ const Response: z.ZodObject<{
10
+ userId: z.ZodString;
11
+ totalAvailable: z.ZodString;
12
+ totalHeld: z.ZodString;
13
+ balances: z.ZodArray<z.ZodObject<{
14
+ id: z.ZodString;
15
+ typeCode: z.ZodString;
16
+ typeName: z.ZodString;
17
+ amount: z.ZodString;
18
+ held: z.ZodString;
19
+ available: z.ZodString;
20
+ status: z.ZodEnum<typeof import("../schemas").BalanceStatus>;
21
+ expiresAt: z.ZodNullable<z.ZodString>;
22
+ createdAt: z.ZodString;
23
+ }, z.core.$strip>>;
24
+ }, z.core.$strip>;
25
+ const URL: "/api/v1/wallet/balance";
26
+ const METHOD = HttpMethod.GET;
27
+ type RequestType = z.infer<typeof Request>;
28
+ type ResponseType = z.infer<typeof Response>;
29
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetBalanceSummaryQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../schemas");
6
+ const rest_api_1 = require("../../../rest-api");
7
+ const http_method_1 = require("../../../shared/http-method");
8
+ /**
9
+ * Get Balance Summary Query
10
+ * Public API - returns user's balance summary
11
+ */
12
+ var GetBalanceSummaryQuery;
13
+ (function (GetBalanceSummaryQuery) {
14
+ GetBalanceSummaryQuery.Request = zod_1.z.object({});
15
+ GetBalanceSummaryQuery.Response = schemas_1.BalanceSummaryResponseSchema;
16
+ GetBalanceSummaryQuery.URL = rest_api_1.REST_API.V1.WALLET.BALANCE;
17
+ GetBalanceSummaryQuery.METHOD = http_method_1.HttpMethod.GET;
18
+ })(GetBalanceSummaryQuery || (exports.GetBalanceSummaryQuery = GetBalanceSummaryQuery = {}));
@@ -0,0 +1 @@
1
+ export { GetBalanceSummaryQuery } from './get-balance-summary.query';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetBalanceSummaryQuery = void 0;
4
+ var get_balance_summary_query_1 = require("./get-balance-summary.query");
5
+ Object.defineProperty(exports, "GetBalanceSummaryQuery", { enumerable: true, get: function () { return get_balance_summary_query_1.GetBalanceSummaryQuery; } });
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { BalanceStatus } from './balance-status.enum';
3
+ /**
4
+ * Single Balance Item Response Schema
5
+ * Note: amount, held, available are strings to preserve BigInt precision
6
+ */
7
+ export declare const BalanceItemResponseSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ typeCode: z.ZodString;
10
+ typeName: z.ZodString;
11
+ amount: z.ZodString;
12
+ held: z.ZodString;
13
+ available: z.ZodString;
14
+ status: z.ZodEnum<typeof BalanceStatus>;
15
+ expiresAt: z.ZodNullable<z.ZodString>;
16
+ createdAt: z.ZodString;
17
+ }, z.core.$strip>;
18
+ /**
19
+ * Balance Summary Response Schema
20
+ * See WALLET_API.md section 4.6
21
+ * Note: totalAvailable, totalHeld are strings to preserve BigInt precision
22
+ */
23
+ export declare const BalanceSummaryResponseSchema: z.ZodObject<{
24
+ userId: z.ZodString;
25
+ totalAvailable: z.ZodString;
26
+ totalHeld: z.ZodString;
27
+ balances: z.ZodArray<z.ZodObject<{
28
+ id: z.ZodString;
29
+ typeCode: z.ZodString;
30
+ typeName: z.ZodString;
31
+ amount: z.ZodString;
32
+ held: z.ZodString;
33
+ available: z.ZodString;
34
+ status: z.ZodEnum<typeof BalanceStatus>;
35
+ expiresAt: z.ZodNullable<z.ZodString>;
36
+ createdAt: z.ZodString;
37
+ }, z.core.$strip>>;
38
+ }, z.core.$strip>;
39
+ export type BalanceItemResponse = z.infer<typeof BalanceItemResponseSchema>;
40
+ export type BalanceSummaryResponse = z.infer<typeof BalanceSummaryResponseSchema>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BalanceSummaryResponseSchema = exports.BalanceItemResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const shared_1 = require("../../../shared");
6
+ const balance_status_enum_1 = require("./balance-status.enum");
7
+ /**
8
+ * Single Balance Item Response Schema
9
+ * Note: amount, held, available are strings to preserve BigInt precision
10
+ */
11
+ exports.BalanceItemResponseSchema = zod_1.z.object({
12
+ id: zod_1.z.string().uuid(),
13
+ typeCode: zod_1.z.string(),
14
+ typeName: zod_1.z.string(),
15
+ amount: shared_1.BigIntStringSchema,
16
+ held: shared_1.BigIntStringSchema,
17
+ available: shared_1.BigIntStringSchema,
18
+ status: zod_1.z.nativeEnum(balance_status_enum_1.BalanceStatus),
19
+ expiresAt: zod_1.z.string().datetime().nullable(),
20
+ createdAt: zod_1.z.string().datetime(),
21
+ });
22
+ /**
23
+ * Balance Summary Response Schema
24
+ * See WALLET_API.md section 4.6
25
+ * Note: totalAvailable, totalHeld are strings to preserve BigInt precision
26
+ */
27
+ exports.BalanceSummaryResponseSchema = zod_1.z.object({
28
+ userId: zod_1.z.string().uuid(),
29
+ totalAvailable: shared_1.BigIntStringSchema,
30
+ totalHeld: shared_1.BigIntStringSchema,
31
+ balances: zod_1.z.array(exports.BalanceItemResponseSchema),
32
+ });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Balance Status Enum
3
+ * See WALLET_API.md section 2.2
4
+ */
5
+ export declare enum BalanceStatus {
6
+ ACTIVE = "ACTIVE",
7
+ DEPLETED = "DEPLETED",
8
+ EXPIRED = "EXPIRED",
9
+ CANCELLED = "CANCELLED",
10
+ SUSPENDED = "SUSPENDED"
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BalanceStatus = void 0;
4
+ /**
5
+ * Balance Status Enum
6
+ * See WALLET_API.md section 2.2
7
+ */
8
+ var BalanceStatus;
9
+ (function (BalanceStatus) {
10
+ BalanceStatus["ACTIVE"] = "ACTIVE";
11
+ BalanceStatus["DEPLETED"] = "DEPLETED";
12
+ BalanceStatus["EXPIRED"] = "EXPIRED";
13
+ BalanceStatus["CANCELLED"] = "CANCELLED";
14
+ BalanceStatus["SUSPENDED"] = "SUSPENDED";
15
+ })(BalanceStatus || (exports.BalanceStatus = BalanceStatus = {}));
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Hold Status Enum
3
+ * See WALLET_API.md section 2.3
4
+ */
5
+ export declare enum HoldStatus {
6
+ PENDING = "PENDING",
7
+ CONFIRMED = "CONFIRMED",
8
+ RELEASED = "RELEASED",
9
+ EXPIRED = "EXPIRED"
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HoldStatus = void 0;
4
+ /**
5
+ * Hold Status Enum
6
+ * See WALLET_API.md section 2.3
7
+ */
8
+ var HoldStatus;
9
+ (function (HoldStatus) {
10
+ HoldStatus["PENDING"] = "PENDING";
11
+ HoldStatus["CONFIRMED"] = "CONFIRMED";
12
+ HoldStatus["RELEASED"] = "RELEASED";
13
+ HoldStatus["EXPIRED"] = "EXPIRED";
14
+ })(HoldStatus || (exports.HoldStatus = HoldStatus = {}));
@@ -0,0 +1,7 @@
1
+ export { BalanceStatus } from './balance-status.enum';
2
+ export { HoldStatus } from './hold-status.enum';
3
+ export { TransactionType } from './transaction-type.enum';
4
+ export { SourceType } from './source-type.enum';
5
+ export { InitiatorType } from './initiator-type.enum';
6
+ export { BalanceItemResponseSchema, BalanceSummaryResponseSchema, type BalanceItemResponse, type BalanceSummaryResponse, } from './balance-response.schema';
7
+ export { MetadataSchema, validateMetadata, MAX_METADATA_SIZE, MAX_NESTING_DEPTH, MAX_METADATA_KEYS, type Metadata, } from './metadata.schema';
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_METADATA_KEYS = exports.MAX_NESTING_DEPTH = exports.MAX_METADATA_SIZE = exports.validateMetadata = exports.MetadataSchema = exports.BalanceSummaryResponseSchema = exports.BalanceItemResponseSchema = exports.InitiatorType = exports.SourceType = exports.TransactionType = exports.HoldStatus = exports.BalanceStatus = void 0;
4
+ // Enums
5
+ var balance_status_enum_1 = require("./balance-status.enum");
6
+ Object.defineProperty(exports, "BalanceStatus", { enumerable: true, get: function () { return balance_status_enum_1.BalanceStatus; } });
7
+ var hold_status_enum_1 = require("./hold-status.enum");
8
+ Object.defineProperty(exports, "HoldStatus", { enumerable: true, get: function () { return hold_status_enum_1.HoldStatus; } });
9
+ var transaction_type_enum_1 = require("./transaction-type.enum");
10
+ Object.defineProperty(exports, "TransactionType", { enumerable: true, get: function () { return transaction_type_enum_1.TransactionType; } });
11
+ var source_type_enum_1 = require("./source-type.enum");
12
+ Object.defineProperty(exports, "SourceType", { enumerable: true, get: function () { return source_type_enum_1.SourceType; } });
13
+ var initiator_type_enum_1 = require("./initiator-type.enum");
14
+ Object.defineProperty(exports, "InitiatorType", { enumerable: true, get: function () { return initiator_type_enum_1.InitiatorType; } });
15
+ // Response schemas
16
+ var balance_response_schema_1 = require("./balance-response.schema");
17
+ Object.defineProperty(exports, "BalanceItemResponseSchema", { enumerable: true, get: function () { return balance_response_schema_1.BalanceItemResponseSchema; } });
18
+ Object.defineProperty(exports, "BalanceSummaryResponseSchema", { enumerable: true, get: function () { return balance_response_schema_1.BalanceSummaryResponseSchema; } });
19
+ // Metadata validation
20
+ var metadata_schema_1 = require("./metadata.schema");
21
+ Object.defineProperty(exports, "MetadataSchema", { enumerable: true, get: function () { return metadata_schema_1.MetadataSchema; } });
22
+ Object.defineProperty(exports, "validateMetadata", { enumerable: true, get: function () { return metadata_schema_1.validateMetadata; } });
23
+ Object.defineProperty(exports, "MAX_METADATA_SIZE", { enumerable: true, get: function () { return metadata_schema_1.MAX_METADATA_SIZE; } });
24
+ Object.defineProperty(exports, "MAX_NESTING_DEPTH", { enumerable: true, get: function () { return metadata_schema_1.MAX_NESTING_DEPTH; } });
25
+ Object.defineProperty(exports, "MAX_METADATA_KEYS", { enumerable: true, get: function () { return metadata_schema_1.MAX_METADATA_KEYS; } });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Type of entity that initiated the wallet operation
3
+ * Used for audit tracking
4
+ */
5
+ export declare enum InitiatorType {
6
+ /** Operation initiated by end user */
7
+ USER = "user",
8
+ /** Operation initiated by system (background jobs, automated processes) */
9
+ SYSTEM = "system",
10
+ /** Operation initiated by admin */
11
+ ADMIN = "admin"
12
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InitiatorType = void 0;
4
+ /**
5
+ * Type of entity that initiated the wallet operation
6
+ * Used for audit tracking
7
+ */
8
+ var InitiatorType;
9
+ (function (InitiatorType) {
10
+ /** Operation initiated by end user */
11
+ InitiatorType["USER"] = "user";
12
+ /** Operation initiated by system (background jobs, automated processes) */
13
+ InitiatorType["SYSTEM"] = "system";
14
+ /** Operation initiated by admin */
15
+ InitiatorType["ADMIN"] = "admin";
16
+ })(InitiatorType || (exports.InitiatorType = InitiatorType = {}));
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Maximum size of metadata JSON in bytes
4
+ */
5
+ export declare const MAX_METADATA_SIZE = 4096;
6
+ /**
7
+ * Maximum nesting depth for metadata objects
8
+ */
9
+ export declare const MAX_NESTING_DEPTH = 3;
10
+ /**
11
+ * Maximum number of keys in metadata
12
+ */
13
+ export declare const MAX_METADATA_KEYS = 20;
14
+ /**
15
+ * Metadata schema with all security validations
16
+ */
17
+ export declare const MetadataSchema: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>>;
18
+ export type Metadata = z.infer<typeof MetadataSchema>;
19
+ /**
20
+ * Validate metadata and return sanitized version or null
21
+ * Use this function in services before storing metadata
22
+ */
23
+ export declare function validateMetadata(metadata: unknown): {
24
+ valid: true;
25
+ data: Record<string, unknown> | null;
26
+ } | {
27
+ valid: false;
28
+ error: string;
29
+ };
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetadataSchema = exports.MAX_METADATA_KEYS = exports.MAX_NESTING_DEPTH = exports.MAX_METADATA_SIZE = void 0;
4
+ exports.validateMetadata = validateMetadata;
5
+ const zod_1 = require("zod");
6
+ /**
7
+ * Maximum size of metadata JSON in bytes
8
+ */
9
+ exports.MAX_METADATA_SIZE = 4096; // 4KB
10
+ /**
11
+ * Maximum nesting depth for metadata objects
12
+ */
13
+ exports.MAX_NESTING_DEPTH = 3;
14
+ /**
15
+ * Maximum number of keys in metadata
16
+ */
17
+ exports.MAX_METADATA_KEYS = 20;
18
+ /**
19
+ * Forbidden keys that could be used for prototype pollution
20
+ */
21
+ const FORBIDDEN_KEYS = ['__proto__', 'constructor', 'prototype'];
22
+ /**
23
+ * Validate key names - alphanumeric, underscore, dash, starting with letter or underscore
24
+ */
25
+ const SafeKeySchema = zod_1.z.string().regex(/^[a-zA-Z_][a-zA-Z0-9_-]{0,63}$/);
26
+ /**
27
+ * Recursive schema for metadata values
28
+ */
29
+ const MetadataValueSchema = zod_1.z.lazy(() => zod_1.z.union([
30
+ zod_1.z.string().max(1000),
31
+ zod_1.z.number(),
32
+ zod_1.z.boolean(),
33
+ zod_1.z.null(),
34
+ zod_1.z.array(MetadataValueSchema).max(50),
35
+ zod_1.z.record(SafeKeySchema, MetadataValueSchema),
36
+ ]));
37
+ /**
38
+ * Check if object contains forbidden keys (prototype pollution protection)
39
+ * Note: Depth check is handled separately by getDepth(), so we just stop recursion here
40
+ */
41
+ function hasForbiddenKeys(obj, depth = 0) {
42
+ if (depth > exports.MAX_NESTING_DEPTH)
43
+ return false; // Stop recursion, let getDepth() handle depth validation
44
+ if (typeof obj !== 'object' || obj === null)
45
+ return false;
46
+ if (Array.isArray(obj)) {
47
+ return obj.some((item) => hasForbiddenKeys(item, depth + 1));
48
+ }
49
+ for (const key of Object.keys(obj)) {
50
+ if (FORBIDDEN_KEYS.includes(key))
51
+ return true;
52
+ const value = obj[key];
53
+ if (hasForbiddenKeys(value, depth + 1))
54
+ return true;
55
+ }
56
+ return false;
57
+ }
58
+ /**
59
+ * Calculate nesting depth of an object
60
+ */
61
+ function getDepth(obj, currentDepth = 0) {
62
+ if (currentDepth > exports.MAX_NESTING_DEPTH + 1)
63
+ return currentDepth;
64
+ if (typeof obj !== 'object' || obj === null)
65
+ return currentDepth;
66
+ if (Array.isArray(obj)) {
67
+ return Math.max(currentDepth, ...obj.map((item) => getDepth(item, currentDepth + 1)));
68
+ }
69
+ const depths = Object.values(obj).map((value) => getDepth(value, currentDepth + 1));
70
+ return Math.max(currentDepth, ...depths);
71
+ }
72
+ /**
73
+ * Metadata schema with all security validations
74
+ */
75
+ exports.MetadataSchema = zod_1.z
76
+ .record(SafeKeySchema, MetadataValueSchema)
77
+ .refine((obj) => JSON.stringify(obj).length <= exports.MAX_METADATA_SIZE, {
78
+ message: `Metadata must be less than ${exports.MAX_METADATA_SIZE} bytes`,
79
+ })
80
+ .refine((obj) => Object.keys(obj).length <= exports.MAX_METADATA_KEYS, {
81
+ message: `Metadata must have at most ${exports.MAX_METADATA_KEYS} keys`,
82
+ })
83
+ .refine((obj) => !hasForbiddenKeys(obj), {
84
+ message: 'Metadata contains forbidden keys',
85
+ })
86
+ .refine((obj) => getDepth(obj) <= exports.MAX_NESTING_DEPTH, {
87
+ message: `Metadata nesting depth must not exceed ${exports.MAX_NESTING_DEPTH}`,
88
+ })
89
+ .optional()
90
+ .nullable();
91
+ /**
92
+ * Validate metadata and return sanitized version or null
93
+ * Use this function in services before storing metadata
94
+ */
95
+ function validateMetadata(metadata) {
96
+ var _a, _b;
97
+ if (metadata === undefined || metadata === null) {
98
+ return { valid: true, data: null };
99
+ }
100
+ const result = exports.MetadataSchema.safeParse(metadata);
101
+ if (!result.success) {
102
+ return { valid: false, error: (_b = (_a = result.error.issues[0]) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : 'Invalid metadata' };
103
+ }
104
+ return { valid: true, data: result.data };
105
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Source Type Enum
3
+ * Indicates the origin of balance credit
4
+ * See WALLET_API.md section 2.2
5
+ */
6
+ export declare enum SourceType {
7
+ PURCHASE = "purchase",
8
+ PROMO = "promo",
9
+ REFERRAL = "referral",
10
+ ADMIN = "admin",
11
+ SUBSCRIPTION = "subscription",
12
+ REFUND = "refund"
13
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SourceType = void 0;
4
+ /**
5
+ * Source Type Enum
6
+ * Indicates the origin of balance credit
7
+ * See WALLET_API.md section 2.2
8
+ */
9
+ var SourceType;
10
+ (function (SourceType) {
11
+ SourceType["PURCHASE"] = "purchase";
12
+ SourceType["PROMO"] = "promo";
13
+ SourceType["REFERRAL"] = "referral";
14
+ SourceType["ADMIN"] = "admin";
15
+ SourceType["SUBSCRIPTION"] = "subscription";
16
+ SourceType["REFUND"] = "refund";
17
+ })(SourceType || (exports.SourceType = SourceType = {}));
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Transaction Type Enum
3
+ * See WALLET_API.md section 2.5
4
+ */
5
+ export declare enum TransactionType {
6
+ CREDIT = "CREDIT",
7
+ DEBIT = "DEBIT",
8
+ HOLD_CREATE = "HOLD_CREATE",
9
+ HOLD_CONFIRM = "HOLD_CONFIRM",
10
+ HOLD_RELEASE = "HOLD_RELEASE",
11
+ HOLD_EXPIRE = "HOLD_EXPIRE",
12
+ BALANCE_EXPIRE = "BALANCE_EXPIRE",
13
+ REFUND = "REFUND",
14
+ ADJUSTMENT = "ADJUSTMENT",
15
+ TRANSFER_OUT = "TRANSFER_OUT",
16
+ TRANSFER_IN = "TRANSFER_IN"
17
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionType = void 0;
4
+ /**
5
+ * Transaction Type Enum
6
+ * See WALLET_API.md section 2.5
7
+ */
8
+ var TransactionType;
9
+ (function (TransactionType) {
10
+ TransactionType["CREDIT"] = "CREDIT";
11
+ TransactionType["DEBIT"] = "DEBIT";
12
+ TransactionType["HOLD_CREATE"] = "HOLD_CREATE";
13
+ TransactionType["HOLD_CONFIRM"] = "HOLD_CONFIRM";
14
+ TransactionType["HOLD_RELEASE"] = "HOLD_RELEASE";
15
+ TransactionType["HOLD_EXPIRE"] = "HOLD_EXPIRE";
16
+ TransactionType["BALANCE_EXPIRE"] = "BALANCE_EXPIRE";
17
+ TransactionType["REFUND"] = "REFUND";
18
+ TransactionType["ADJUSTMENT"] = "ADJUSTMENT";
19
+ TransactionType["TRANSFER_OUT"] = "TRANSFER_OUT";
20
+ TransactionType["TRANSFER_IN"] = "TRANSFER_IN";
21
+ })(TransactionType || (exports.TransactionType = TransactionType = {}));
@@ -0,0 +1,37 @@
1
+ import { ErrorMetadata } from '../../shared';
2
+ /**
3
+ * Wallet Error Codes
4
+ * See WALLET_API.md section 7 for error specifications
5
+ */
6
+ export declare enum WalletErrorCode {
7
+ INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
8
+ BALANCE_NOT_FOUND = "BALANCE_NOT_FOUND",
9
+ BALANCE_TYPE_NOT_FOUND = "BALANCE_TYPE_NOT_FOUND",
10
+ BALANCE_NOT_ACTIVE = "BALANCE_NOT_ACTIVE",
11
+ BALANCE_HAS_PENDING_HOLD = "BALANCE_HAS_PENDING_HOLD",
12
+ HOLD_NOT_FOUND = "HOLD_NOT_FOUND",
13
+ HOLD_ALREADY_PROCESSED = "HOLD_ALREADY_PROCESSED",
14
+ HOLD_NOT_PENDING = "HOLD_NOT_PENDING",
15
+ HOLD_EXPIRED = "HOLD_EXPIRED",
16
+ DUPLICATE_HOLD = "DUPLICATE_HOLD",
17
+ INSUFFICIENT_AVAILABLE_BALANCE = "INSUFFICIENT_AVAILABLE_BALANCE",
18
+ BALANCE_STATE_CHANGED = "BALANCE_STATE_CHANGED",
19
+ INVALID_AMOUNT = "INVALID_AMOUNT",
20
+ AMOUNT_OVERFLOW = "AMOUNT_OVERFLOW",
21
+ INVALID_TTL = "INVALID_TTL",
22
+ INVALID_METADATA = "INVALID_METADATA",
23
+ INVALID_INITIATOR_TYPE = "INVALID_INITIATOR_TYPE",
24
+ INVALID_BALANCE_STATUS = "INVALID_BALANCE_STATUS",
25
+ INVALID_HOLD_STATUS = "INVALID_HOLD_STATUS",
26
+ INVALID_TRANSACTION_TYPE = "INVALID_TRANSACTION_TYPE",
27
+ INVALID_SOURCE_TYPE = "INVALID_SOURCE_TYPE",
28
+ INVALID_VERSION = "INVALID_VERSION",
29
+ INVALID_OPERATION_TYPE = "INVALID_OPERATION_TYPE",
30
+ INVALID_OPERATION_ID = "INVALID_OPERATION_ID",
31
+ INVALID_HOLD_ID = "INVALID_HOLD_ID",
32
+ INVALID_BALANCE_ID = "INVALID_BALANCE_ID",
33
+ DATA_INTEGRITY_ERROR = "DATA_INTEGRITY_ERROR",
34
+ CONCURRENT_MODIFICATION = "CONCURRENT_MODIFICATION",
35
+ DUPLICATE_IDEMPOTENCY_KEY = "DUPLICATE_IDEMPOTENCY_KEY"
36
+ }
37
+ export declare const WALLET_ERRORS: Record<WalletErrorCode, ErrorMetadata>;
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WALLET_ERRORS = exports.WalletErrorCode = void 0;
4
+ /**
5
+ * Wallet Error Codes
6
+ * See WALLET_API.md section 7 for error specifications
7
+ */
8
+ var WalletErrorCode;
9
+ (function (WalletErrorCode) {
10
+ // Balance errors
11
+ WalletErrorCode["INSUFFICIENT_BALANCE"] = "INSUFFICIENT_BALANCE";
12
+ WalletErrorCode["BALANCE_NOT_FOUND"] = "BALANCE_NOT_FOUND";
13
+ WalletErrorCode["BALANCE_TYPE_NOT_FOUND"] = "BALANCE_TYPE_NOT_FOUND";
14
+ WalletErrorCode["BALANCE_NOT_ACTIVE"] = "BALANCE_NOT_ACTIVE";
15
+ WalletErrorCode["BALANCE_HAS_PENDING_HOLD"] = "BALANCE_HAS_PENDING_HOLD";
16
+ // Hold errors
17
+ WalletErrorCode["HOLD_NOT_FOUND"] = "HOLD_NOT_FOUND";
18
+ WalletErrorCode["HOLD_ALREADY_PROCESSED"] = "HOLD_ALREADY_PROCESSED";
19
+ WalletErrorCode["HOLD_NOT_PENDING"] = "HOLD_NOT_PENDING";
20
+ WalletErrorCode["HOLD_EXPIRED"] = "HOLD_EXPIRED";
21
+ WalletErrorCode["DUPLICATE_HOLD"] = "DUPLICATE_HOLD";
22
+ // Available balance errors
23
+ WalletErrorCode["INSUFFICIENT_AVAILABLE_BALANCE"] = "INSUFFICIENT_AVAILABLE_BALANCE";
24
+ WalletErrorCode["BALANCE_STATE_CHANGED"] = "BALANCE_STATE_CHANGED";
25
+ // Validation errors
26
+ WalletErrorCode["INVALID_AMOUNT"] = "INVALID_AMOUNT";
27
+ WalletErrorCode["AMOUNT_OVERFLOW"] = "AMOUNT_OVERFLOW";
28
+ WalletErrorCode["INVALID_TTL"] = "INVALID_TTL";
29
+ WalletErrorCode["INVALID_METADATA"] = "INVALID_METADATA";
30
+ WalletErrorCode["INVALID_INITIATOR_TYPE"] = "INVALID_INITIATOR_TYPE";
31
+ WalletErrorCode["INVALID_BALANCE_STATUS"] = "INVALID_BALANCE_STATUS";
32
+ WalletErrorCode["INVALID_HOLD_STATUS"] = "INVALID_HOLD_STATUS";
33
+ WalletErrorCode["INVALID_TRANSACTION_TYPE"] = "INVALID_TRANSACTION_TYPE";
34
+ WalletErrorCode["INVALID_SOURCE_TYPE"] = "INVALID_SOURCE_TYPE";
35
+ WalletErrorCode["INVALID_VERSION"] = "INVALID_VERSION";
36
+ WalletErrorCode["INVALID_OPERATION_TYPE"] = "INVALID_OPERATION_TYPE";
37
+ WalletErrorCode["INVALID_OPERATION_ID"] = "INVALID_OPERATION_ID";
38
+ WalletErrorCode["INVALID_HOLD_ID"] = "INVALID_HOLD_ID";
39
+ WalletErrorCode["INVALID_BALANCE_ID"] = "INVALID_BALANCE_ID";
40
+ // Data integrity errors
41
+ WalletErrorCode["DATA_INTEGRITY_ERROR"] = "DATA_INTEGRITY_ERROR";
42
+ // Concurrency errors
43
+ WalletErrorCode["CONCURRENT_MODIFICATION"] = "CONCURRENT_MODIFICATION";
44
+ // Idempotency
45
+ WalletErrorCode["DUPLICATE_IDEMPOTENCY_KEY"] = "DUPLICATE_IDEMPOTENCY_KEY";
46
+ })(WalletErrorCode || (exports.WalletErrorCode = WalletErrorCode = {}));
47
+ exports.WALLET_ERRORS = {
48
+ // Balance errors - 4xx
49
+ [WalletErrorCode.INSUFFICIENT_BALANCE]: {
50
+ code: WalletErrorCode.INSUFFICIENT_BALANCE,
51
+ statusCode: 402,
52
+ },
53
+ [WalletErrorCode.BALANCE_NOT_FOUND]: {
54
+ code: WalletErrorCode.BALANCE_NOT_FOUND,
55
+ statusCode: 404,
56
+ },
57
+ [WalletErrorCode.BALANCE_TYPE_NOT_FOUND]: {
58
+ code: WalletErrorCode.BALANCE_TYPE_NOT_FOUND,
59
+ statusCode: 400,
60
+ },
61
+ [WalletErrorCode.BALANCE_NOT_ACTIVE]: {
62
+ code: WalletErrorCode.BALANCE_NOT_ACTIVE,
63
+ statusCode: 409,
64
+ },
65
+ [WalletErrorCode.BALANCE_HAS_PENDING_HOLD]: {
66
+ code: WalletErrorCode.BALANCE_HAS_PENDING_HOLD,
67
+ statusCode: 409,
68
+ },
69
+ // Hold errors
70
+ [WalletErrorCode.HOLD_NOT_FOUND]: {
71
+ code: WalletErrorCode.HOLD_NOT_FOUND,
72
+ statusCode: 404,
73
+ },
74
+ [WalletErrorCode.HOLD_ALREADY_PROCESSED]: {
75
+ code: WalletErrorCode.HOLD_ALREADY_PROCESSED,
76
+ statusCode: 409,
77
+ },
78
+ [WalletErrorCode.HOLD_NOT_PENDING]: {
79
+ code: WalletErrorCode.HOLD_NOT_PENDING,
80
+ statusCode: 409,
81
+ },
82
+ [WalletErrorCode.HOLD_EXPIRED]: {
83
+ code: WalletErrorCode.HOLD_EXPIRED,
84
+ statusCode: 410,
85
+ },
86
+ [WalletErrorCode.DUPLICATE_HOLD]: {
87
+ code: WalletErrorCode.DUPLICATE_HOLD,
88
+ statusCode: 409,
89
+ },
90
+ // Available balance errors
91
+ [WalletErrorCode.INSUFFICIENT_AVAILABLE_BALANCE]: {
92
+ code: WalletErrorCode.INSUFFICIENT_AVAILABLE_BALANCE,
93
+ statusCode: 402,
94
+ },
95
+ [WalletErrorCode.BALANCE_STATE_CHANGED]: {
96
+ code: WalletErrorCode.BALANCE_STATE_CHANGED,
97
+ statusCode: 409,
98
+ },
99
+ // Validation errors
100
+ [WalletErrorCode.INVALID_AMOUNT]: {
101
+ code: WalletErrorCode.INVALID_AMOUNT,
102
+ statusCode: 400,
103
+ },
104
+ [WalletErrorCode.AMOUNT_OVERFLOW]: {
105
+ code: WalletErrorCode.AMOUNT_OVERFLOW,
106
+ statusCode: 400,
107
+ },
108
+ [WalletErrorCode.INVALID_TTL]: {
109
+ code: WalletErrorCode.INVALID_TTL,
110
+ statusCode: 400,
111
+ },
112
+ [WalletErrorCode.INVALID_METADATA]: {
113
+ code: WalletErrorCode.INVALID_METADATA,
114
+ statusCode: 400,
115
+ },
116
+ // Concurrency errors
117
+ [WalletErrorCode.CONCURRENT_MODIFICATION]: {
118
+ code: WalletErrorCode.CONCURRENT_MODIFICATION,
119
+ statusCode: 409,
120
+ },
121
+ // Idempotency
122
+ [WalletErrorCode.DUPLICATE_IDEMPOTENCY_KEY]: {
123
+ code: WalletErrorCode.DUPLICATE_IDEMPOTENCY_KEY,
124
+ statusCode: 409,
125
+ },
126
+ // Value Object validation errors
127
+ [WalletErrorCode.INVALID_INITIATOR_TYPE]: {
128
+ code: WalletErrorCode.INVALID_INITIATOR_TYPE,
129
+ statusCode: 400,
130
+ },
131
+ [WalletErrorCode.INVALID_BALANCE_STATUS]: {
132
+ code: WalletErrorCode.INVALID_BALANCE_STATUS,
133
+ statusCode: 400,
134
+ },
135
+ [WalletErrorCode.INVALID_HOLD_STATUS]: {
136
+ code: WalletErrorCode.INVALID_HOLD_STATUS,
137
+ statusCode: 400,
138
+ },
139
+ [WalletErrorCode.INVALID_TRANSACTION_TYPE]: {
140
+ code: WalletErrorCode.INVALID_TRANSACTION_TYPE,
141
+ statusCode: 400,
142
+ },
143
+ [WalletErrorCode.INVALID_SOURCE_TYPE]: {
144
+ code: WalletErrorCode.INVALID_SOURCE_TYPE,
145
+ statusCode: 400,
146
+ },
147
+ [WalletErrorCode.INVALID_VERSION]: {
148
+ code: WalletErrorCode.INVALID_VERSION,
149
+ statusCode: 400,
150
+ },
151
+ [WalletErrorCode.INVALID_OPERATION_TYPE]: {
152
+ code: WalletErrorCode.INVALID_OPERATION_TYPE,
153
+ statusCode: 400,
154
+ },
155
+ [WalletErrorCode.INVALID_OPERATION_ID]: {
156
+ code: WalletErrorCode.INVALID_OPERATION_ID,
157
+ statusCode: 400,
158
+ },
159
+ [WalletErrorCode.INVALID_HOLD_ID]: {
160
+ code: WalletErrorCode.INVALID_HOLD_ID,
161
+ statusCode: 400,
162
+ },
163
+ [WalletErrorCode.INVALID_BALANCE_ID]: {
164
+ code: WalletErrorCode.INVALID_BALANCE_ID,
165
+ statusCode: 400,
166
+ },
167
+ [WalletErrorCode.DATA_INTEGRITY_ERROR]: {
168
+ code: WalletErrorCode.DATA_INTEGRITY_ERROR,
169
+ statusCode: 500,
170
+ },
171
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veruna/api-contracts",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
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",