@veruna/api-contracts 1.0.33 → 1.0.34

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.
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * API Error Response Schema
4
+ *
5
+ * This is the standard error response format returned by the API.
6
+ * All errors follow this structure.
7
+ *
8
+ * @example
9
+ * {
10
+ * "code": "EMAIL_ALREADY_EXISTS",
11
+ * "requestId": "41572f77-891e-4d64-9887-6f31b952e0a1"
12
+ * }
13
+ *
14
+ * @example with details (validation errors)
15
+ * {
16
+ * "code": "VALIDATION_ERROR",
17
+ * "requestId": "41572f77-891e-4d64-9887-6f31b952e0a1",
18
+ * "details": {
19
+ * "email": ["Invalid email format"],
20
+ * "password": ["Password must be at least 8 characters"]
21
+ * }
22
+ * }
23
+ */
24
+ export declare const ApiErrorResponseSchema: z.ZodObject<{
25
+ code: z.ZodString;
26
+ requestId: z.ZodString;
27
+ details: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodString>, z.ZodString]>>;
28
+ }, z.core.$strip>;
29
+ export type ApiErrorResponse = z.infer<typeof ApiErrorResponseSchema>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiErrorResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * API Error Response Schema
7
+ *
8
+ * This is the standard error response format returned by the API.
9
+ * All errors follow this structure.
10
+ *
11
+ * @example
12
+ * {
13
+ * "code": "EMAIL_ALREADY_EXISTS",
14
+ * "requestId": "41572f77-891e-4d64-9887-6f31b952e0a1"
15
+ * }
16
+ *
17
+ * @example with details (validation errors)
18
+ * {
19
+ * "code": "VALIDATION_ERROR",
20
+ * "requestId": "41572f77-891e-4d64-9887-6f31b952e0a1",
21
+ * "details": {
22
+ * "email": ["Invalid email format"],
23
+ * "password": ["Password must be at least 8 characters"]
24
+ * }
25
+ * }
26
+ */
27
+ exports.ApiErrorResponseSchema = zod_1.z.object({
28
+ /** Error code for client-side localization and error handling */
29
+ code: zod_1.z.string(),
30
+ /** Unique request identifier for debugging and support */
31
+ requestId: zod_1.z.string().uuid(),
32
+ /** Optional error details (validation errors, additional context) */
33
+ details: zod_1.z.union([zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()), zod_1.z.array(zod_1.z.string()), zod_1.z.string()]).optional(),
34
+ });
@@ -1,5 +1,5 @@
1
1
  export * from './error-metadata';
2
- export * from './error-response.schema';
2
+ export * from './api-error-response.schema';
3
3
  export * from './pagination.schema';
4
4
  export * from './common.errors';
5
5
  export * from './regex';
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./error-metadata"), exports);
18
- __exportStar(require("./error-response.schema"), exports);
18
+ __exportStar(require("./api-error-response.schema"), exports);
19
19
  __exportStar(require("./pagination.schema"), exports);
20
20
  __exportStar(require("./common.errors"), exports);
21
21
  __exportStar(require("./regex"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veruna/api-contracts",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
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,25 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Base error response schema
4
- */
5
- export declare const ErrorResponseSchema: z.ZodObject<{
6
- statusCode: z.ZodNumber;
7
- message: z.ZodString;
8
- error: z.ZodString;
9
- code: z.ZodOptional<z.ZodString>;
10
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
11
- timestamp: z.ZodString;
12
- }, z.core.$strip>;
13
- export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
14
- /**
15
- * Validation error response schema
16
- */
17
- export declare const ValidationErrorResponseSchema: z.ZodObject<{
18
- statusCode: z.ZodNumber;
19
- message: z.ZodString;
20
- error: z.ZodString;
21
- timestamp: z.ZodString;
22
- code: z.ZodLiteral<"VALIDATION_ERROR">;
23
- details: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
24
- }, z.core.$strip>;
25
- export type ValidationErrorResponse = z.infer<typeof ValidationErrorResponseSchema>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValidationErrorResponseSchema = exports.ErrorResponseSchema = void 0;
4
- const zod_1 = require("zod");
5
- /**
6
- * Base error response schema
7
- */
8
- exports.ErrorResponseSchema = zod_1.z.object({
9
- statusCode: zod_1.z.number(),
10
- message: zod_1.z.string(),
11
- error: zod_1.z.string(),
12
- code: zod_1.z.string().optional(),
13
- details: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
14
- timestamp: zod_1.z.string(),
15
- });
16
- /**
17
- * Validation error response schema
18
- */
19
- exports.ValidationErrorResponseSchema = exports.ErrorResponseSchema.extend({
20
- code: zod_1.z.literal('VALIDATION_ERROR'),
21
- details: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())),
22
- });