@goat-it/schemas 0.0.6 → 0.0.7-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/dist/question/index.d.mts +5 -3
- package/dist/question/index.mjs +5 -3
- package/dist/question-theme/index.d.mts +2 -2
- package/dist/question-theme/index.mjs +2 -2
- package/dist/shared/constants/index.d.mts +3 -0
- package/dist/shared/constants/index.mjs +3 -0
- package/dist/shared/error/index.d.mts +3 -0
- package/dist/shared/error/index.mjs +3 -0
- package/dist/src/contexts/question/application/dto/admin-question/admin-question.dto.shape.mjs +1 -0
- package/dist/src/contexts/question/application/dto/admin-question/admin-question.dto.shape.mjs.map +1 -1
- package/dist/src/contexts/question/application/dto/question/question.dto.shape.mjs +1 -0
- package/dist/src/contexts/question/application/dto/question/question.dto.shape.mjs.map +1 -1
- package/dist/src/contexts/question/application/dto/question-creation/question-creation.dto.shape.mjs +1 -0
- package/dist/src/contexts/question/application/dto/question-creation/question-creation.dto.shape.mjs.map +1 -1
- package/dist/src/contexts/question/application/dto/shared/zod/validators/question.dto.zod.validators.mjs +1 -0
- package/dist/src/contexts/question/application/dto/shared/zod/validators/question.dto.zod.validators.mjs.map +1 -1
- package/dist/src/contexts/question/domain/value-objects/question-author/question-author.constants.d.mts +4 -1
- package/dist/src/contexts/question/domain/value-objects/question-author/question-author.constants.mjs +3 -1
- package/dist/src/contexts/question/domain/value-objects/question-author/question-author.constants.mjs.map +1 -1
- package/dist/src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.d.mts +6 -0
- package/dist/src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.mjs +7 -0
- package/dist/src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.mjs.map +1 -0
- package/dist/src/contexts/question/domain/value-objects/question-status/question-status.constants.d.mts +6 -1
- package/dist/src/contexts/question/domain/value-objects/question-status/question-status.constants.mjs +11 -5
- package/dist/src/contexts/question/domain/value-objects/question-status/question-status.constants.mjs.map +1 -1
- package/dist/src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.d.mts +6 -0
- package/dist/src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.mjs +7 -0
- package/dist/src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.mjs.map +1 -0
- package/dist/src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.d.mts +3 -1
- package/dist/src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.mjs +5 -2
- package/dist/src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.mjs.map +1 -1
- package/dist/src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.d.mts +21 -0
- package/dist/src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.mjs +20 -0
- package/dist/src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.mjs.map +1 -0
- package/dist/src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.d.mts +27 -0
- package/dist/src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.mjs +14 -0
- package/dist/src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.mjs.map +1 -0
- package/dist/src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.d.mts +8 -0
- package/dist/src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.mjs +6 -1
- package/dist/src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.mjs.map +1 -1
- package/dist/src/shared/infrastructure/http/zod/validators/localization/localization.zod.validators.mjs +6 -3
- package/dist/src/shared/infrastructure/http/zod/validators/localization/localization.zod.validators.mjs.map +1 -1
- package/dist/src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.d.mts +6 -0
- package/dist/src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.mjs +3 -1
- package/dist/src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.mjs.map +1 -1
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ This package is a small, framework‑agnostic collection of DTO shapes, value‑
|
|
|
12
12
|
- `./question`
|
|
13
13
|
- `./question-theme`
|
|
14
14
|
- `./shared/locale`
|
|
15
|
+
- `./shared/error`
|
|
16
|
+
- `./shared/constants`
|
|
15
17
|
- Peer dependency: `zod` (match workspace version)
|
|
16
18
|
|
|
17
19
|
## 🔧 Usage
|
|
@@ -25,8 +27,18 @@ import type { QuestionDto } from "@goat-it/schemas/question";
|
|
|
25
27
|
// Importing Zod schemas
|
|
26
28
|
import { QUESTION_THEME_CREATION_DTO } from "@goat-it/schemas/question-theme";
|
|
27
29
|
|
|
28
|
-
// Importing constants
|
|
30
|
+
// Importing locale constants
|
|
29
31
|
import { LOCALES } from "@goat-it/schemas/shared/locale";
|
|
32
|
+
|
|
33
|
+
// Importing error DTOs and types
|
|
34
|
+
import { API_RESPONSE_EXCEPTION_DTO } from "@goat-it/schemas/shared/error";
|
|
35
|
+
import type { ApiResponseExceptionDto } from "@goat-it/schemas/shared/error";
|
|
36
|
+
|
|
37
|
+
// Importing shared constants
|
|
38
|
+
import { LOCALIZED_TEXT_ENTRY_MAX_LENGTH, SLUG_MIN_LENGTH } from "@goat-it/schemas/shared/constants";
|
|
39
|
+
|
|
40
|
+
// Importing question-specific constants
|
|
41
|
+
import { QUESTION_AUTHOR_NAME_MIN_LENGTH, QUESTION_STATUS_PENDING } from "@goat-it/schemas/question";
|
|
30
42
|
```
|
|
31
43
|
|
|
32
44
|
## 📝 Notes
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { QUESTION_COGNITIVE_DIFFICULTIES } from "../src/contexts/question/domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.constants.mjs";
|
|
2
2
|
import { QUESTION_CATEGORIES } from "../src/contexts/question/domain/value-objects/question-category/question-category.constants.mjs";
|
|
3
|
-
import { QUESTION_STATUSES } from "../src/contexts/question/domain/value-objects/question-status/question-status.constants.mjs";
|
|
4
|
-
import { QUESTION_AUTHOR_ROLES } from "../src/contexts/question/domain/value-objects/question-author/question-author.constants.mjs";
|
|
3
|
+
import { QUESTION_CREATION_STATUSES, QUESTION_STATUSES, QUESTION_STATUS_ACTIVE, QUESTION_STATUS_ARCHIVED, QUESTION_STATUS_PENDING, QUESTION_STATUS_REJECTED } from "../src/contexts/question/domain/value-objects/question-status/question-status.constants.mjs";
|
|
4
|
+
import { QUESTION_AUTHOR_NAME_MAX_LENGTH, QUESTION_AUTHOR_NAME_MIN_LENGTH, QUESTION_AUTHOR_ROLES, QUESTION_CREATION_AUTHOR_ROLES } from "../src/contexts/question/domain/value-objects/question-author/question-author.constants.mjs";
|
|
5
5
|
import { QUESTION_REJECTION_TYPES } from "../src/contexts/question/domain/value-objects/question-rejection/question-rejection.constants.mjs";
|
|
6
|
+
import { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from "../src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.mjs";
|
|
7
|
+
import { QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS } from "../src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.mjs";
|
|
6
8
|
import { QuestionCategory } from "../src/contexts/question/domain/value-objects/question-category/question-category.types.mjs";
|
|
7
9
|
import { QuestionCognitiveDifficulty } from "../src/contexts/question/domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.types.mjs";
|
|
8
10
|
import { QUESTION_CREATION_DTO, QuestionCreationDto } from "../src/contexts/question/application/dto/question-creation/question-creation.dto.shape.mjs";
|
|
@@ -12,4 +14,4 @@ import { QUESTION_DTO, QuestionDto } from "../src/contexts/question/application/
|
|
|
12
14
|
import { ADMIN_QUESTION_DTO, AdminQuestionDto } from "../src/contexts/question/application/dto/admin-question/admin-question.dto.shape.mjs";
|
|
13
15
|
import { QuestionAuthorRole } from "../src/contexts/question/domain/value-objects/question-author/question-author.types.mjs";
|
|
14
16
|
import { QuestionRejectionType } from "../src/contexts/question/domain/value-objects/question-rejection/question-rejection.types.mjs";
|
|
15
|
-
export { ADMIN_QUESTION_DTO, type AdminQuestionDto, QUESTION_AUTHOR_ROLES, QUESTION_CATEGORIES, QUESTION_COGNITIVE_DIFFICULTIES, QUESTION_CREATION_DTO, QUESTION_DTO, QUESTION_REJECTION_TYPES, QUESTION_STATUSES, QUESTION_THEME_ASSIGNMENT_CREATION_DTO, type QuestionAuthorRole, type QuestionCategory, type QuestionCognitiveDifficulty, type QuestionCreationDto, type QuestionDto, type QuestionRejectionType, type QuestionStatus, type QuestionThemeAssignmentCreationDto };
|
|
17
|
+
export { ADMIN_QUESTION_DTO, type AdminQuestionDto, QUESTION_AUTHOR_NAME_MAX_LENGTH, QUESTION_AUTHOR_NAME_MIN_LENGTH, QUESTION_AUTHOR_ROLES, QUESTION_CATEGORIES, QUESTION_COGNITIVE_DIFFICULTIES, QUESTION_CREATION_AUTHOR_ROLES, QUESTION_CREATION_DTO, QUESTION_CREATION_STATUSES, QUESTION_DTO, QUESTION_REJECTION_TYPES, QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS, QUESTION_STATUSES, QUESTION_STATUS_ACTIVE, QUESTION_STATUS_ARCHIVED, QUESTION_STATUS_PENDING, QUESTION_STATUS_REJECTED, QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS, QUESTION_THEME_ASSIGNMENT_CREATION_DTO, type QuestionAuthorRole, type QuestionCategory, type QuestionCognitiveDifficulty, type QuestionCreationDto, type QuestionDto, type QuestionRejectionType, type QuestionStatus, type QuestionThemeAssignmentCreationDto };
|
package/dist/question/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { QUESTION_COGNITIVE_DIFFICULTIES } from "../src/contexts/question/domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.constants.mjs";
|
|
2
2
|
import { QUESTION_CATEGORIES } from "../src/contexts/question/domain/value-objects/question-category/question-category.constants.mjs";
|
|
3
|
-
import { QUESTION_STATUSES } from "../src/contexts/question/domain/value-objects/question-status/question-status.constants.mjs";
|
|
4
|
-
import { QUESTION_AUTHOR_ROLES } from "../src/contexts/question/domain/value-objects/question-author/question-author.constants.mjs";
|
|
3
|
+
import { QUESTION_CREATION_STATUSES, QUESTION_STATUSES, QUESTION_STATUS_ACTIVE, QUESTION_STATUS_ARCHIVED, QUESTION_STATUS_PENDING, QUESTION_STATUS_REJECTED } from "../src/contexts/question/domain/value-objects/question-status/question-status.constants.mjs";
|
|
4
|
+
import { QUESTION_AUTHOR_NAME_MAX_LENGTH, QUESTION_AUTHOR_NAME_MIN_LENGTH, QUESTION_AUTHOR_ROLES, QUESTION_CREATION_AUTHOR_ROLES } from "../src/contexts/question/domain/value-objects/question-author/question-author.constants.mjs";
|
|
5
5
|
import { QUESTION_REJECTION_TYPES } from "../src/contexts/question/domain/value-objects/question-rejection/question-rejection.constants.mjs";
|
|
6
|
+
import { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from "../src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.mjs";
|
|
7
|
+
import { QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS } from "../src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.mjs";
|
|
6
8
|
import { QUESTION_THEME_ASSIGNMENT_CREATION_DTO } from "../src/contexts/question/application/dto/question-creation/question-theme-assignment-creation/question-theme-assignment-creation.dto.shape.mjs";
|
|
7
9
|
import { QUESTION_CREATION_DTO } from "../src/contexts/question/application/dto/question-creation/question-creation.dto.shape.mjs";
|
|
8
10
|
import { QUESTION_DTO } from "../src/contexts/question/application/dto/question/question.dto.shape.mjs";
|
|
9
11
|
import { ADMIN_QUESTION_DTO } from "../src/contexts/question/application/dto/admin-question/admin-question.dto.shape.mjs";
|
|
10
|
-
export { ADMIN_QUESTION_DTO, QUESTION_AUTHOR_ROLES, QUESTION_CATEGORIES, QUESTION_COGNITIVE_DIFFICULTIES, QUESTION_CREATION_DTO, QUESTION_DTO, QUESTION_REJECTION_TYPES, QUESTION_STATUSES, QUESTION_THEME_ASSIGNMENT_CREATION_DTO };
|
|
12
|
+
export { ADMIN_QUESTION_DTO, QUESTION_AUTHOR_NAME_MAX_LENGTH, QUESTION_AUTHOR_NAME_MIN_LENGTH, QUESTION_AUTHOR_ROLES, QUESTION_CATEGORIES, QUESTION_COGNITIVE_DIFFICULTIES, QUESTION_CREATION_AUTHOR_ROLES, QUESTION_CREATION_DTO, QUESTION_CREATION_STATUSES, QUESTION_DTO, QUESTION_REJECTION_TYPES, QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS, QUESTION_STATUSES, QUESTION_STATUS_ACTIVE, QUESTION_STATUS_ARCHIVED, QUESTION_STATUS_PENDING, QUESTION_STATUS_REJECTED, QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS, QUESTION_THEME_ASSIGNMENT_CREATION_DTO };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QUESTION_THEME_STATUSES } from "../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.mjs";
|
|
1
|
+
import { DEFAULT_QUESTION_THEME_STATUS, QUESTION_THEME_STATUSES, QUESTION_THEME_STATUS_ARCHIVED } from "../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.mjs";
|
|
2
2
|
import { QUESTION_THEME_CREATION_DTO, QuestionThemeCreationDto } from "../src/contexts/question/modules/question-theme/application/dto/question-theme-creation/question-theme-creation.dto.shape.mjs";
|
|
3
3
|
import { QUESTION_THEME_MODIFICATION_DTO, QuestionThemeModificationDto } from "../src/contexts/question/modules/question-theme/application/dto/question-theme-modification/question-theme-modification.dto.shape.mjs";
|
|
4
4
|
import { QUESTION_THEME_DTO, QuestionThemeDto } from "../src/contexts/question/modules/question-theme/application/dto/question-theme/question-theme.dto.shape.mjs";
|
|
5
5
|
import { ADMIN_QUESTION_THEME_DTO, AdminQuestionThemeDto } from "../src/contexts/question/modules/question-theme/application/dto/admin-question-theme/admin-question-theme.dto.shape.mjs";
|
|
6
6
|
import { QuestionThemeStatus } from "../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.types.mjs";
|
|
7
|
-
export { ADMIN_QUESTION_THEME_DTO, type AdminQuestionThemeDto, QUESTION_THEME_CREATION_DTO, QUESTION_THEME_DTO, QUESTION_THEME_MODIFICATION_DTO, QUESTION_THEME_STATUSES, type QuestionThemeCreationDto, type QuestionThemeDto, type QuestionThemeModificationDto, type QuestionThemeStatus };
|
|
7
|
+
export { ADMIN_QUESTION_THEME_DTO, type AdminQuestionThemeDto, DEFAULT_QUESTION_THEME_STATUS, QUESTION_THEME_CREATION_DTO, QUESTION_THEME_DTO, QUESTION_THEME_MODIFICATION_DTO, QUESTION_THEME_STATUSES, QUESTION_THEME_STATUS_ARCHIVED, type QuestionThemeCreationDto, type QuestionThemeDto, type QuestionThemeModificationDto, type QuestionThemeStatus };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { QUESTION_THEME_STATUSES } from "../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.mjs";
|
|
1
|
+
import { DEFAULT_QUESTION_THEME_STATUS, QUESTION_THEME_STATUSES, QUESTION_THEME_STATUS_ARCHIVED } from "../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.mjs";
|
|
2
2
|
import { QUESTION_THEME_DTO } from "../src/contexts/question/modules/question-theme/application/dto/question-theme/question-theme.dto.shape.mjs";
|
|
3
3
|
import { ADMIN_QUESTION_THEME_DTO } from "../src/contexts/question/modules/question-theme/application/dto/admin-question-theme/admin-question-theme.dto.shape.mjs";
|
|
4
4
|
import { QUESTION_THEME_CREATION_DTO } from "../src/contexts/question/modules/question-theme/application/dto/question-theme-creation/question-theme-creation.dto.shape.mjs";
|
|
5
5
|
import { QUESTION_THEME_MODIFICATION_DTO } from "../src/contexts/question/modules/question-theme/application/dto/question-theme-modification/question-theme-modification.dto.shape.mjs";
|
|
6
|
-
export { ADMIN_QUESTION_THEME_DTO, QUESTION_THEME_CREATION_DTO, QUESTION_THEME_DTO, QUESTION_THEME_MODIFICATION_DTO, QUESTION_THEME_STATUSES };
|
|
6
|
+
export { ADMIN_QUESTION_THEME_DTO, DEFAULT_QUESTION_THEME_STATUS, QUESTION_THEME_CREATION_DTO, QUESTION_THEME_DTO, QUESTION_THEME_MODIFICATION_DTO, QUESTION_THEME_STATUSES, QUESTION_THEME_STATUS_ARCHIVED };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH } from "../../src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.mjs";
|
|
2
|
+
import { SLUG_MAX_LENGTH, SLUG_MIN_LENGTH } from "../../src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.mjs";
|
|
3
|
+
export { LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH, SLUG_MAX_LENGTH, SLUG_MIN_LENGTH };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH } from "../../src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.mjs";
|
|
2
|
+
import { SLUG_MAX_LENGTH, SLUG_MIN_LENGTH } from "../../src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.mjs";
|
|
3
|
+
export { LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH, SLUG_MAX_LENGTH, SLUG_MIN_LENGTH };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { API_RESPONSE_EXCEPTION_DTO, ApiResponseExceptionDto } from "../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.mjs";
|
|
2
|
+
import { API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO, ApiResponseExceptionValidationDetailsDto } from "../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.mjs";
|
|
3
|
+
export { API_RESPONSE_EXCEPTION_DTO, API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO, type ApiResponseExceptionDto, type ApiResponseExceptionValidationDetailsDto };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO } from "../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.mjs";
|
|
2
|
+
import { API_RESPONSE_EXCEPTION_DTO } from "../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.mjs";
|
|
3
|
+
export { API_RESPONSE_EXCEPTION_DTO, API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO };
|
package/dist/src/contexts/question/application/dto/admin-question/admin-question.dto.shape.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../../../domain/value-objects/question-theme-assignment/question-theme-assignment.constants.mjs";
|
|
1
2
|
import { zIsoDateTime, zMongoId } from "../../../../../shared/infrastructure/http/zod/validators/string/string.zod.validators.mjs";
|
|
2
3
|
import { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls, zQuestionStatus } from "../shared/zod/validators/question.dto.zod.validators.mjs";
|
|
3
4
|
import { QUESTION_REJECTION_DTO } from "../shared/question-rejection/question-rejection.dto.shape.mjs";
|
package/dist/src/contexts/question/application/dto/admin-question/admin-question.dto.shape.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-question.dto.shape.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/application/dto/admin-question/admin-question.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { zIsoDateTime, zMongoId } from \"@shared/infrastructure/http/zod/validators/string/string.zod.validators\";\n\nimport { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from \"@question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants\";\nimport { ADMIN_QUESTION_THEME_ASSIGNMENT_DTO } from \"@question/application/dto/admin-question/admin-question-theme-assignment/admin-question-theme-assignment.dto.shape\";\nimport { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls, zQuestionStatus } from \"@question/application/dto/shared/zod/validators/question.dto.zod.validators\";\nimport { QUESTION_REJECTION_DTO } from \"@question/application/dto/shared/question-rejection/question-rejection.dto.shape\";\nimport { QUESTION_AUTHOR_DTO } from \"@question/application/dto/shared/question-author/question-author.dto.shape\";\nimport { ADMIN_QUESTION_CONTENT_DTO } from \"@question/application/dto/admin-question/admin-question-content/admin-question-content.dto.shape\";\n\nconst ADMIN_QUESTION_DTO = z.strictObject({\n id: zMongoId()\n .describe(\"Question's unique identifier\"),\n category: zQuestionCategory(),\n themes: z.array(ADMIN_QUESTION_THEME_ASSIGNMENT_DTO)\n .min(QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS)\n .max(QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS)\n .describe(\"Question's themes\"),\n content: ADMIN_QUESTION_CONTENT_DTO,\n cognitiveDifficulty: zQuestionCognitiveDifficulty(),\n author: QUESTION_AUTHOR_DTO,\n status: zQuestionStatus(),\n rejection: QUESTION_REJECTION_DTO\n .optional()\n .describe(\"Question's rejection details, if applicable\"),\n sourceUrls: zQuestionSourceUrls(),\n createdAt: zIsoDateTime()\n .describe(\"Question's creation date\"),\n updatedAt: zIsoDateTime()\n .describe(\"Question's last update date\"),\n});\n\nexport type AdminQuestionDto = z.infer<typeof ADMIN_QUESTION_DTO>;\n\nexport { ADMIN_QUESTION_DTO };"],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin-question.dto.shape.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/application/dto/admin-question/admin-question.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { zIsoDateTime, zMongoId } from \"@shared/infrastructure/http/zod/validators/string/string.zod.validators\";\n\nimport { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from \"@question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants\";\nimport { ADMIN_QUESTION_THEME_ASSIGNMENT_DTO } from \"@question/application/dto/admin-question/admin-question-theme-assignment/admin-question-theme-assignment.dto.shape\";\nimport { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls, zQuestionStatus } from \"@question/application/dto/shared/zod/validators/question.dto.zod.validators\";\nimport { QUESTION_REJECTION_DTO } from \"@question/application/dto/shared/question-rejection/question-rejection.dto.shape\";\nimport { QUESTION_AUTHOR_DTO } from \"@question/application/dto/shared/question-author/question-author.dto.shape\";\nimport { ADMIN_QUESTION_CONTENT_DTO } from \"@question/application/dto/admin-question/admin-question-content/admin-question-content.dto.shape\";\n\nconst ADMIN_QUESTION_DTO = z.strictObject({\n id: zMongoId()\n .describe(\"Question's unique identifier\"),\n category: zQuestionCategory(),\n themes: z.array(ADMIN_QUESTION_THEME_ASSIGNMENT_DTO)\n .min(QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS)\n .max(QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS)\n .describe(\"Question's themes\"),\n content: ADMIN_QUESTION_CONTENT_DTO,\n cognitiveDifficulty: zQuestionCognitiveDifficulty(),\n author: QUESTION_AUTHOR_DTO,\n status: zQuestionStatus(),\n rejection: QUESTION_REJECTION_DTO\n .optional()\n .describe(\"Question's rejection details, if applicable\"),\n sourceUrls: zQuestionSourceUrls(),\n createdAt: zIsoDateTime()\n .describe(\"Question's creation date\"),\n updatedAt: zIsoDateTime()\n .describe(\"Question's last update date\"),\n});\n\nexport type AdminQuestionDto = z.infer<typeof ADMIN_QUESTION_DTO>;\n\nexport { ADMIN_QUESTION_DTO };"],"mappings":";;;;;;;;;AAWA,MAAM,qBAAqB,EAAE,aAAa;CACxC,IAAI,UAAU,CACX,SAAS,+BAA+B;CAC3C,UAAU,mBAAmB;CAC7B,QAAQ,EAAE,MAAM,oCAAoC,CACjD,IAAA,EAAyC,CACzC,IAAA,EAAyC,CACzC,SAAS,oBAAoB;CAChC,SAAS;CACT,qBAAqB,8BAA8B;CACnD,QAAQ;CACR,QAAQ,iBAAiB;CACzB,WAAW,uBACR,UAAU,CACV,SAAS,8CAA8C;CAC1D,YAAY,qBAAqB;CACjC,WAAW,cAAc,CACtB,SAAS,2BAA2B;CACvC,WAAW,cAAc,CACtB,SAAS,8BAA8B;CAC3C,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../../../domain/value-objects/question-theme-assignment/question-theme-assignment.constants.mjs";
|
|
1
2
|
import { zIsoDateTime, zMongoId } from "../../../../../shared/infrastructure/http/zod/validators/string/string.zod.validators.mjs";
|
|
2
3
|
import { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls, zQuestionStatus } from "../shared/zod/validators/question.dto.zod.validators.mjs";
|
|
3
4
|
import { QUESTION_THEME_ASSIGNMENT_DTO } from "./question-theme-assignment/question-theme-assignment.dto.shape.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.dto.shape.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/application/dto/question/question.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { zIsoDateTime, zMongoId } from \"@shared/infrastructure/http/zod/validators/string/string.zod.validators\";\n\nimport { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from \"@question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants\";\nimport { QUESTION_THEME_ASSIGNMENT_DTO } from \"@question/application/dto/question/question-theme-assignment/question-theme-assignment.dto.shape\";\nimport { QUESTION_CONTENT_DTO } from \"@question/application/dto/question/question-content/question-content.dto.shape\";\nimport { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls, zQuestionStatus } from \"@question/application/dto/shared/zod/validators/question.dto.zod.validators\";\nimport { QUESTION_REJECTION_DTO } from \"@question/application/dto/shared/question-rejection/question-rejection.dto.shape\";\nimport { QUESTION_AUTHOR_DTO } from \"@question/application/dto/shared/question-author/question-author.dto.shape\";\n\nconst QUESTION_DTO = z.strictObject({\n id: zMongoId()\n .describe(\"Question's unique identifier\"),\n category: zQuestionCategory(),\n themes: z.array(QUESTION_THEME_ASSIGNMENT_DTO)\n .min(QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS)\n .max(QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS)\n .describe(\"Question's themes\"),\n content: QUESTION_CONTENT_DTO,\n cognitiveDifficulty: zQuestionCognitiveDifficulty(),\n author: QUESTION_AUTHOR_DTO,\n status: zQuestionStatus(),\n rejection: QUESTION_REJECTION_DTO\n .optional()\n .describe(\"Question's rejection details, if applicable\"),\n sourceUrls: zQuestionSourceUrls(),\n createdAt: zIsoDateTime()\n .describe(\"Question's creation date\"),\n updatedAt: zIsoDateTime()\n .describe(\"Question's last update date\"),\n});\n\nexport type QuestionDto = z.infer<typeof QUESTION_DTO>;\n\nexport { QUESTION_DTO };"],"mappings":"
|
|
1
|
+
{"version":3,"file":"question.dto.shape.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/application/dto/question/question.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { zIsoDateTime, zMongoId } from \"@shared/infrastructure/http/zod/validators/string/string.zod.validators\";\n\nimport { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from \"@question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants\";\nimport { QUESTION_THEME_ASSIGNMENT_DTO } from \"@question/application/dto/question/question-theme-assignment/question-theme-assignment.dto.shape\";\nimport { QUESTION_CONTENT_DTO } from \"@question/application/dto/question/question-content/question-content.dto.shape\";\nimport { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls, zQuestionStatus } from \"@question/application/dto/shared/zod/validators/question.dto.zod.validators\";\nimport { QUESTION_REJECTION_DTO } from \"@question/application/dto/shared/question-rejection/question-rejection.dto.shape\";\nimport { QUESTION_AUTHOR_DTO } from \"@question/application/dto/shared/question-author/question-author.dto.shape\";\n\nconst QUESTION_DTO = z.strictObject({\n id: zMongoId()\n .describe(\"Question's unique identifier\"),\n category: zQuestionCategory(),\n themes: z.array(QUESTION_THEME_ASSIGNMENT_DTO)\n .min(QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS)\n .max(QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS)\n .describe(\"Question's themes\"),\n content: QUESTION_CONTENT_DTO,\n cognitiveDifficulty: zQuestionCognitiveDifficulty(),\n author: QUESTION_AUTHOR_DTO,\n status: zQuestionStatus(),\n rejection: QUESTION_REJECTION_DTO\n .optional()\n .describe(\"Question's rejection details, if applicable\"),\n sourceUrls: zQuestionSourceUrls(),\n createdAt: zIsoDateTime()\n .describe(\"Question's creation date\"),\n updatedAt: zIsoDateTime()\n .describe(\"Question's last update date\"),\n});\n\nexport type QuestionDto = z.infer<typeof QUESTION_DTO>;\n\nexport { QUESTION_DTO };"],"mappings":";;;;;;;;;AAWA,MAAM,eAAe,EAAE,aAAa;CAClC,IAAI,UAAU,CACX,SAAS,+BAA+B;CAC3C,UAAU,mBAAmB;CAC7B,QAAQ,EAAE,MAAM,8BAA8B,CAC3C,IAAA,EAAyC,CACzC,IAAA,EAAyC,CACzC,SAAS,oBAAoB;CAChC,SAAS;CACT,qBAAqB,8BAA8B;CACnD,QAAQ;CACR,QAAQ,iBAAiB;CACzB,WAAW,uBACR,UAAU,CACV,SAAS,8CAA8C;CAC1D,YAAY,qBAAqB;CACjC,WAAW,cAAc,CACtB,SAAS,2BAA2B;CACvC,WAAW,cAAc,CACtB,SAAS,8BAA8B;CAC3C,CAAC"}
|
package/dist/src/contexts/question/application/dto/question-creation/question-creation.dto.shape.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../../../domain/value-objects/question-theme-assignment/question-theme-assignment.constants.mjs";
|
|
1
2
|
import { areValuesUniqueByKey, hasExactlyOneByKey } from "../../../../../shared/application/dto/zod/refinements/array/array.zod.refinements.mjs";
|
|
2
3
|
import { QUESTION_AUTHOR_CREATION_DTO } from "./question-author-creation/question-author-creation.dto.shape.mjs";
|
|
3
4
|
import { QUESTION_CONTENT_CREATION_DTO } from "./question-content-creation/question-content-creation.dto.shape.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question-creation.dto.shape.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/application/dto/question-creation/question-creation.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { areValuesUniqueByKey, hasExactlyOneByKey } from \"@shared/application/dto/zod/refinements/array/array.zod.refinements\";\n\nimport { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from \"@question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants\";\nimport { QUESTION_AUTHOR_CREATION_DTO } from \"@question/application/dto/question-creation/question-author-creation/question-author-creation.dto.shape\";\nimport { QUESTION_CONTENT_CREATION_DTO } from \"@question/application/dto/question-creation/question-content-creation/question-content-creation.dto.shape\";\nimport { QUESTION_THEME_ASSIGNMENT_CREATION_DTO } from \"@question/application/dto/question-creation/question-theme-assignment-creation/question-theme-assignment-creation.dto.shape\";\nimport { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls } from \"@question/application/dto/shared/zod/validators/question.dto.zod.validators\";\n\nconst QUESTION_CREATION_DTO = z.object({\n category: zQuestionCategory(),\n themes: z.array(QUESTION_THEME_ASSIGNMENT_CREATION_DTO)\n .min(QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS)\n .max(QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS)\n .refine(themes => areValuesUniqueByKey(themes, \"themeId\"), { message: \"Theme IDs must be unique\" })\n .refine(themes => hasExactlyOneByKey(themes, \"isPrimary\", true), { message: \"There must be exactly one primary theme\" })\n .describe(\"Question's themes\"),\n content: QUESTION_CONTENT_CREATION_DTO,\n cognitiveDifficulty: zQuestionCognitiveDifficulty(),\n author: QUESTION_AUTHOR_CREATION_DTO,\n sourceUrls: zQuestionSourceUrls(),\n});\n\nexport type QuestionCreationDto = z.infer<typeof QUESTION_CREATION_DTO>;\n\nexport { QUESTION_CREATION_DTO };"],"mappings":"
|
|
1
|
+
{"version":3,"file":"question-creation.dto.shape.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/application/dto/question-creation/question-creation.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { areValuesUniqueByKey, hasExactlyOneByKey } from \"@shared/application/dto/zod/refinements/array/array.zod.refinements\";\n\nimport { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS } from \"@question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants\";\nimport { QUESTION_AUTHOR_CREATION_DTO } from \"@question/application/dto/question-creation/question-author-creation/question-author-creation.dto.shape\";\nimport { QUESTION_CONTENT_CREATION_DTO } from \"@question/application/dto/question-creation/question-content-creation/question-content-creation.dto.shape\";\nimport { QUESTION_THEME_ASSIGNMENT_CREATION_DTO } from \"@question/application/dto/question-creation/question-theme-assignment-creation/question-theme-assignment-creation.dto.shape\";\nimport { zQuestionCategory, zQuestionCognitiveDifficulty, zQuestionSourceUrls } from \"@question/application/dto/shared/zod/validators/question.dto.zod.validators\";\n\nconst QUESTION_CREATION_DTO = z.object({\n category: zQuestionCategory(),\n themes: z.array(QUESTION_THEME_ASSIGNMENT_CREATION_DTO)\n .min(QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS)\n .max(QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS)\n .refine(themes => areValuesUniqueByKey(themes, \"themeId\"), { message: \"Theme IDs must be unique\" })\n .refine(themes => hasExactlyOneByKey(themes, \"isPrimary\", true), { message: \"There must be exactly one primary theme\" })\n .describe(\"Question's themes\"),\n content: QUESTION_CONTENT_CREATION_DTO,\n cognitiveDifficulty: zQuestionCognitiveDifficulty(),\n author: QUESTION_AUTHOR_CREATION_DTO,\n sourceUrls: zQuestionSourceUrls(),\n});\n\nexport type QuestionCreationDto = z.infer<typeof QUESTION_CREATION_DTO>;\n\nexport { QUESTION_CREATION_DTO };"],"mappings":";;;;;;;;AAUA,MAAM,wBAAwB,EAAE,OAAO;CACrC,UAAU,mBAAmB;CAC7B,QAAQ,EAAE,MAAM,uCAAuC,CACpD,IAAA,EAAyC,CACzC,IAAA,EAAyC,CACzC,QAAO,WAAU,qBAAqB,QAAQ,UAAU,EAAE,EAAE,SAAS,4BAA4B,CAAC,CAClG,QAAO,WAAU,mBAAmB,QAAQ,aAAa,KAAK,EAAE,EAAE,SAAS,2CAA2C,CAAC,CACvH,SAAS,oBAAoB;CAChC,SAAS;CACT,qBAAqB,8BAA8B;CACnD,QAAQ;CACR,YAAY,qBAAqB;CAClC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QUESTION_COGNITIVE_DIFFICULTIES } from "../../../../../domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.constants.mjs";
|
|
2
2
|
import { QUESTION_CATEGORIES } from "../../../../../domain/value-objects/question-category/question-category.constants.mjs";
|
|
3
3
|
import { QUESTION_STATUSES } from "../../../../../domain/value-objects/question-status/question-status.constants.mjs";
|
|
4
|
+
import "../../../../../domain/value-objects/question-source-urls/question-source-urls.constants.mjs";
|
|
4
5
|
import { areValuesUniqueFromStrings } from "../../../../../../../shared/application/dto/zod/refinements/array/array.zod.refinements.mjs";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
//#region ../../src/contexts/question/application/dto/shared/zod/validators/question.dto.zod.validators.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.dto.zod.validators.mjs","names":[],"sources":["../../../../../../../../../../../src/contexts/question/application/dto/shared/zod/validators/question.dto.zod.validators.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { areValuesUniqueFromStrings } from \"@shared/application/dto/zod/refinements/array/array.zod.refinements\";\n\nimport { QUESTION_CATEGORIES } from \"@question/domain/value-objects/question-category/question-category.constants\";\nimport { QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS } from \"@question/domain/value-objects/question-source-urls/question-source-urls.constants\";\nimport { QUESTION_STATUSES } from \"@question/domain/value-objects/question-status/question-status.constants\";\nimport { QUESTION_COGNITIVE_DIFFICULTIES } from \"@question/domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.constants\";\n\nimport type { ZodEnum, ZodURL, ZodArray } from \"zod\";\n\nimport type { QuestionCategoryEnum } from \"@question/domain/value-objects/question-category/question-category.types\";\nimport type { QuestionStatusEnum } from \"@question/domain/value-objects/question-status/question-status.types\";\nimport type { QuestionCognitiveDifficultyEnum } from \"@question/domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.types\";\n\nfunction zQuestionCognitiveDifficulty(): ZodEnum<QuestionCognitiveDifficultyEnum> {\n return z.enum(QUESTION_COGNITIVE_DIFFICULTIES)\n .describe(\"Question's cognitive difficulty level\");\n}\n\nfunction zQuestionStatus(): ZodEnum<QuestionStatusEnum> {\n return z.enum(QUESTION_STATUSES)\n .describe(\"Question's status\");\n}\n\nfunction zQuestionCategory(): ZodEnum<QuestionCategoryEnum> {\n return z.enum(QUESTION_CATEGORIES)\n .describe(\"Question's category\");\n}\n\nfunction zQuestionSourceUrls(): ZodArray<ZodURL> {\n return z.array(z.url())\n .min(QUESTION_SOURCE_URLS_MIN_ITEMS)\n .max(QUESTION_SOURCE_URLS_MAX_ITEMS)\n .refine(areValuesUniqueFromStrings, { message: \"Source URLs must be unique\" })\n .describe(\"List of unique source URLs for the question\")\n .meta({ example: [\"https://example.com/source1\", \"https://example.com/source2\"] });\n}\n\nexport {\n zQuestionCognitiveDifficulty,\n zQuestionStatus,\n zQuestionCategory,\n zQuestionSourceUrls,\n};"],"mappings":"
|
|
1
|
+
{"version":3,"file":"question.dto.zod.validators.mjs","names":[],"sources":["../../../../../../../../../../../src/contexts/question/application/dto/shared/zod/validators/question.dto.zod.validators.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { areValuesUniqueFromStrings } from \"@shared/application/dto/zod/refinements/array/array.zod.refinements\";\n\nimport { QUESTION_CATEGORIES } from \"@question/domain/value-objects/question-category/question-category.constants\";\nimport { QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS } from \"@question/domain/value-objects/question-source-urls/question-source-urls.constants\";\nimport { QUESTION_STATUSES } from \"@question/domain/value-objects/question-status/question-status.constants\";\nimport { QUESTION_COGNITIVE_DIFFICULTIES } from \"@question/domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.constants\";\n\nimport type { ZodEnum, ZodURL, ZodArray } from \"zod\";\n\nimport type { QuestionCategoryEnum } from \"@question/domain/value-objects/question-category/question-category.types\";\nimport type { QuestionStatusEnum } from \"@question/domain/value-objects/question-status/question-status.types\";\nimport type { QuestionCognitiveDifficultyEnum } from \"@question/domain/value-objects/question-cognitive-difficulty/question-cognitive-difficulty.types\";\n\nfunction zQuestionCognitiveDifficulty(): ZodEnum<QuestionCognitiveDifficultyEnum> {\n return z.enum(QUESTION_COGNITIVE_DIFFICULTIES)\n .describe(\"Question's cognitive difficulty level\");\n}\n\nfunction zQuestionStatus(): ZodEnum<QuestionStatusEnum> {\n return z.enum(QUESTION_STATUSES)\n .describe(\"Question's status\");\n}\n\nfunction zQuestionCategory(): ZodEnum<QuestionCategoryEnum> {\n return z.enum(QUESTION_CATEGORIES)\n .describe(\"Question's category\");\n}\n\nfunction zQuestionSourceUrls(): ZodArray<ZodURL> {\n return z.array(z.url())\n .min(QUESTION_SOURCE_URLS_MIN_ITEMS)\n .max(QUESTION_SOURCE_URLS_MAX_ITEMS)\n .refine(areValuesUniqueFromStrings, { message: \"Source URLs must be unique\" })\n .describe(\"List of unique source URLs for the question\")\n .meta({ example: [\"https://example.com/source1\", \"https://example.com/source2\"] });\n}\n\nexport {\n zQuestionCognitiveDifficulty,\n zQuestionStatus,\n zQuestionCategory,\n zQuestionSourceUrls,\n};"],"mappings":";;;;;;;AAeA,SAAS,+BAAyE;AAChF,QAAO,EAAE,KAAK,gCAAgC,CAC3C,SAAS,wCAAwC;;AAGtD,SAAS,kBAA+C;AACtD,QAAO,EAAE,KAAK,kBAAkB,CAC7B,SAAS,oBAAoB;;AAGlC,SAAS,oBAAmD;AAC1D,QAAO,EAAE,KAAK,oBAAoB,CAC/B,SAAS,sBAAsB;;AAGpC,SAAS,sBAAwC;AAC/C,QAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CACpB,IAAA,EAAmC,CACnC,IAAA,EAAmC,CACnC,OAAO,4BAA4B,EAAE,SAAS,8BAA8B,CAAC,CAC7E,SAAS,8CAA8C,CACvD,KAAK,EAAE,SAAS,CAAC,+BAA+B,8BAA8B,EAAE,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
//#region ../../src/contexts/question/domain/value-objects/question-author/question-author.constants.d.ts
|
|
2
2
|
declare const QUESTION_AUTHOR_ROLES: readonly ["admin", "game", "ai"];
|
|
3
|
+
declare const QUESTION_CREATION_AUTHOR_ROLES: readonly ["admin", "ai"];
|
|
4
|
+
declare const QUESTION_AUTHOR_NAME_MIN_LENGTH = 3;
|
|
5
|
+
declare const QUESTION_AUTHOR_NAME_MAX_LENGTH = 30;
|
|
3
6
|
//#endregion
|
|
4
|
-
export { QUESTION_AUTHOR_ROLES };
|
|
7
|
+
export { QUESTION_AUTHOR_NAME_MAX_LENGTH, QUESTION_AUTHOR_NAME_MIN_LENGTH, QUESTION_AUTHOR_ROLES, QUESTION_CREATION_AUTHOR_ROLES };
|
|
5
8
|
//# sourceMappingURL=question-author.constants.d.mts.map
|
|
@@ -6,7 +6,9 @@ const QUESTION_AUTHOR_ROLES = [
|
|
|
6
6
|
"ai"
|
|
7
7
|
];
|
|
8
8
|
const QUESTION_CREATION_AUTHOR_ROLES = [QUESTION_AUTHOR_ROLE_ADMIN, "ai"];
|
|
9
|
+
const QUESTION_AUTHOR_NAME_MIN_LENGTH = 3;
|
|
10
|
+
const QUESTION_AUTHOR_NAME_MAX_LENGTH = 30;
|
|
9
11
|
//#endregion
|
|
10
|
-
export { QUESTION_AUTHOR_ROLES, QUESTION_CREATION_AUTHOR_ROLES };
|
|
12
|
+
export { QUESTION_AUTHOR_NAME_MAX_LENGTH, QUESTION_AUTHOR_NAME_MIN_LENGTH, QUESTION_AUTHOR_ROLES, QUESTION_CREATION_AUTHOR_ROLES };
|
|
11
13
|
|
|
12
14
|
//# sourceMappingURL=question-author.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question-author.constants.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/domain/value-objects/question-author/question-author.constants.ts"],"sourcesContent":["const QUESTION_AUTHOR_ROLE_ADMIN = \"admin\";\nconst QUESTION_AUTHOR_ROLE_GAME = \"game\";\nconst QUESTION_AUTHOR_ROLE_AI = \"ai\";\n\nconst QUESTION_AUTHOR_ROLES = [\n QUESTION_AUTHOR_ROLE_ADMIN,\n QUESTION_AUTHOR_ROLE_GAME,\n QUESTION_AUTHOR_ROLE_AI,\n] as const satisfies readonly string[];\n\nconst QUESTION_CREATION_AUTHOR_ROLES = [\n QUESTION_AUTHOR_ROLE_ADMIN,\n QUESTION_AUTHOR_ROLE_AI,\n] as const satisfies readonly string[];\n\nconst QUESTION_AUTHOR_NAME_MIN_LENGTH = 3;\n\nconst QUESTION_AUTHOR_NAME_MAX_LENGTH = 30;\n\nexport {\n QUESTION_AUTHOR_ROLE_ADMIN,\n QUESTION_AUTHOR_ROLE_GAME,\n QUESTION_AUTHOR_ROLE_AI,\n QUESTION_AUTHOR_ROLES,\n QUESTION_CREATION_AUTHOR_ROLES,\n QUESTION_AUTHOR_NAME_MIN_LENGTH,\n QUESTION_AUTHOR_NAME_MAX_LENGTH,\n};"],"mappings":";AAAA,MAAM,6BAA6B;AAInC,MAAM,wBAAwB;CAC5B;CAJgC;;CAOjC;AAED,MAAM,iCAAiC,CACrC,4BAAA,KAED"}
|
|
1
|
+
{"version":3,"file":"question-author.constants.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/domain/value-objects/question-author/question-author.constants.ts"],"sourcesContent":["const QUESTION_AUTHOR_ROLE_ADMIN = \"admin\";\nconst QUESTION_AUTHOR_ROLE_GAME = \"game\";\nconst QUESTION_AUTHOR_ROLE_AI = \"ai\";\n\nconst QUESTION_AUTHOR_ROLES = [\n QUESTION_AUTHOR_ROLE_ADMIN,\n QUESTION_AUTHOR_ROLE_GAME,\n QUESTION_AUTHOR_ROLE_AI,\n] as const satisfies readonly string[];\n\nconst QUESTION_CREATION_AUTHOR_ROLES = [\n QUESTION_AUTHOR_ROLE_ADMIN,\n QUESTION_AUTHOR_ROLE_AI,\n] as const satisfies readonly string[];\n\nconst QUESTION_AUTHOR_NAME_MIN_LENGTH = 3;\n\nconst QUESTION_AUTHOR_NAME_MAX_LENGTH = 30;\n\nexport {\n QUESTION_AUTHOR_ROLE_ADMIN,\n QUESTION_AUTHOR_ROLE_GAME,\n QUESTION_AUTHOR_ROLE_AI,\n QUESTION_AUTHOR_ROLES,\n QUESTION_CREATION_AUTHOR_ROLES,\n QUESTION_AUTHOR_NAME_MIN_LENGTH,\n QUESTION_AUTHOR_NAME_MAX_LENGTH,\n};"],"mappings":";AAAA,MAAM,6BAA6B;AAInC,MAAM,wBAAwB;CAC5B;CAJgC;;CAOjC;AAED,MAAM,iCAAiC,CACrC,4BAAA,KAED;AAED,MAAM,kCAAkC;AAExC,MAAM,kCAAkC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region ../../src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.d.ts
|
|
2
|
+
declare const QUESTION_SOURCE_URLS_MIN_ITEMS = 1;
|
|
3
|
+
declare const QUESTION_SOURCE_URLS_MAX_ITEMS = 5;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS };
|
|
6
|
+
//# sourceMappingURL=question-source-urls.constants.d.mts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region ../../src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.ts
|
|
2
|
+
const QUESTION_SOURCE_URLS_MIN_ITEMS = 1;
|
|
3
|
+
const QUESTION_SOURCE_URLS_MAX_ITEMS = 5;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { QUESTION_SOURCE_URLS_MAX_ITEMS, QUESTION_SOURCE_URLS_MIN_ITEMS };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=question-source-urls.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-source-urls.constants.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/domain/value-objects/question-source-urls/question-source-urls.constants.ts"],"sourcesContent":["const QUESTION_SOURCE_URLS_MIN_ITEMS = 1;\n\nconst QUESTION_SOURCE_URLS_MAX_ITEMS = 5;\n\nexport {\n QUESTION_SOURCE_URLS_MIN_ITEMS,\n QUESTION_SOURCE_URLS_MAX_ITEMS,\n};"],"mappings":";AAAA,MAAM,iCAAiC;AAEvC,MAAM,iCAAiC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
//#region ../../src/contexts/question/domain/value-objects/question-status/question-status.constants.d.ts
|
|
2
|
+
declare const QUESTION_STATUS_PENDING = "pending";
|
|
3
|
+
declare const QUESTION_STATUS_ACTIVE = "active";
|
|
4
|
+
declare const QUESTION_STATUS_ARCHIVED = "archived";
|
|
5
|
+
declare const QUESTION_STATUS_REJECTED = "rejected";
|
|
2
6
|
declare const QUESTION_STATUSES: readonly ["pending", "active", "archived", "rejected"];
|
|
7
|
+
declare const QUESTION_CREATION_STATUSES: readonly ["pending", "active"];
|
|
3
8
|
//#endregion
|
|
4
|
-
export { QUESTION_STATUSES };
|
|
9
|
+
export { QUESTION_CREATION_STATUSES, QUESTION_STATUSES, QUESTION_STATUS_ACTIVE, QUESTION_STATUS_ARCHIVED, QUESTION_STATUS_PENDING, QUESTION_STATUS_REJECTED };
|
|
5
10
|
//# sourceMappingURL=question-status.constants.d.mts.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
//#region ../../src/contexts/question/domain/value-objects/question-status/question-status.constants.ts
|
|
2
|
+
const QUESTION_STATUS_PENDING = "pending";
|
|
3
|
+
const QUESTION_STATUS_ACTIVE = "active";
|
|
4
|
+
const QUESTION_STATUS_ARCHIVED = "archived";
|
|
5
|
+
const QUESTION_STATUS_REJECTED = "rejected";
|
|
1
6
|
const QUESTION_STATUSES = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
QUESTION_STATUS_PENDING,
|
|
8
|
+
QUESTION_STATUS_ACTIVE,
|
|
9
|
+
QUESTION_STATUS_ARCHIVED,
|
|
10
|
+
QUESTION_STATUS_REJECTED
|
|
6
11
|
];
|
|
12
|
+
const QUESTION_CREATION_STATUSES = [QUESTION_STATUS_PENDING, QUESTION_STATUS_ACTIVE];
|
|
7
13
|
//#endregion
|
|
8
|
-
export { QUESTION_STATUSES };
|
|
14
|
+
export { QUESTION_CREATION_STATUSES, QUESTION_STATUSES, QUESTION_STATUS_ACTIVE, QUESTION_STATUS_ARCHIVED, QUESTION_STATUS_PENDING, QUESTION_STATUS_REJECTED };
|
|
9
15
|
|
|
10
16
|
//# sourceMappingURL=question-status.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question-status.constants.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/domain/value-objects/question-status/question-status.constants.ts"],"sourcesContent":["const QUESTION_STATUS_PENDING = \"pending\";\nconst QUESTION_STATUS_ACTIVE = \"active\";\nconst QUESTION_STATUS_ARCHIVED = \"archived\";\nconst QUESTION_STATUS_REJECTED = \"rejected\";\n\nconst QUESTION_STATUSES = [\n QUESTION_STATUS_PENDING,\n QUESTION_STATUS_ACTIVE,\n QUESTION_STATUS_ARCHIVED,\n QUESTION_STATUS_REJECTED,\n] as const satisfies readonly string[];\n\nconst QUESTION_CREATION_STATUSES = [\n QUESTION_STATUS_PENDING,\n QUESTION_STATUS_ACTIVE,\n] as const satisfies readonly string[];\n\nexport {\n QUESTION_STATUS_PENDING,\n QUESTION_STATUS_ACTIVE,\n QUESTION_STATUS_ARCHIVED,\n QUESTION_STATUS_REJECTED,\n QUESTION_STATUSES,\n QUESTION_CREATION_STATUSES,\n};"],"mappings":"
|
|
1
|
+
{"version":3,"file":"question-status.constants.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/domain/value-objects/question-status/question-status.constants.ts"],"sourcesContent":["const QUESTION_STATUS_PENDING = \"pending\";\nconst QUESTION_STATUS_ACTIVE = \"active\";\nconst QUESTION_STATUS_ARCHIVED = \"archived\";\nconst QUESTION_STATUS_REJECTED = \"rejected\";\n\nconst QUESTION_STATUSES = [\n QUESTION_STATUS_PENDING,\n QUESTION_STATUS_ACTIVE,\n QUESTION_STATUS_ARCHIVED,\n QUESTION_STATUS_REJECTED,\n] as const satisfies readonly string[];\n\nconst QUESTION_CREATION_STATUSES = [\n QUESTION_STATUS_PENDING,\n QUESTION_STATUS_ACTIVE,\n] as const satisfies readonly string[];\n\nexport {\n QUESTION_STATUS_PENDING,\n QUESTION_STATUS_ACTIVE,\n QUESTION_STATUS_ARCHIVED,\n QUESTION_STATUS_REJECTED,\n QUESTION_STATUSES,\n QUESTION_CREATION_STATUSES,\n};"],"mappings":";AAAA,MAAM,0BAA0B;AAChC,MAAM,yBAAyB;AAC/B,MAAM,2BAA2B;AACjC,MAAM,2BAA2B;AAEjC,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACD;AAED,MAAM,6BAA6B,CACjC,yBACA,uBACD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region ../../src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.d.ts
|
|
2
|
+
declare const QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS = 1;
|
|
3
|
+
declare const QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS = 3;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS };
|
|
6
|
+
//# sourceMappingURL=question-theme-assignment.constants.d.mts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region ../../src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.ts
|
|
2
|
+
const QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS = 1;
|
|
3
|
+
const QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS = 3;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS, QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=question-theme-assignment.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-theme-assignment.constants.mjs","names":[],"sources":["../../../../../../../../../src/contexts/question/domain/value-objects/question-theme-assignment/question-theme-assignment.constants.ts"],"sourcesContent":["const QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS = 1;\n\nconst QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS = 3;\n\nexport {\n QUESTION_THEME_ASSIGNMENTS_MIN_ITEMS,\n QUESTION_THEME_ASSIGNMENTS_MAX_ITEMS,\n};"],"mappings":";AAAA,MAAM,uCAAuC;AAE7C,MAAM,uCAAuC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//#region ../../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.d.ts
|
|
2
|
+
declare const DEFAULT_QUESTION_THEME_STATUS = "active";
|
|
3
|
+
declare const QUESTION_THEME_STATUS_ARCHIVED = "archived";
|
|
2
4
|
declare const QUESTION_THEME_STATUSES: readonly ["active", "archived"];
|
|
3
5
|
//#endregion
|
|
4
|
-
export { QUESTION_THEME_STATUSES };
|
|
6
|
+
export { DEFAULT_QUESTION_THEME_STATUS, QUESTION_THEME_STATUSES, QUESTION_THEME_STATUS_ARCHIVED };
|
|
5
7
|
//# sourceMappingURL=question-theme-status.constants.d.mts.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.ts
|
|
2
|
+
const DEFAULT_QUESTION_THEME_STATUS = "active";
|
|
3
|
+
const QUESTION_THEME_STATUS_ARCHIVED = "archived";
|
|
4
|
+
const QUESTION_THEME_STATUSES = [DEFAULT_QUESTION_THEME_STATUS, QUESTION_THEME_STATUS_ARCHIVED];
|
|
2
5
|
//#endregion
|
|
3
|
-
export { QUESTION_THEME_STATUSES };
|
|
6
|
+
export { DEFAULT_QUESTION_THEME_STATUS, QUESTION_THEME_STATUSES, QUESTION_THEME_STATUS_ARCHIVED };
|
|
4
7
|
|
|
5
8
|
//# sourceMappingURL=question-theme-status.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question-theme-status.constants.mjs","names":[],"sources":["../../../../../../../../../../../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.ts"],"sourcesContent":["const DEFAULT_QUESTION_THEME_STATUS = \"active\";\n\nconst QUESTION_THEME_STATUS_ARCHIVED = \"archived\";\n\nconst QUESTION_THEME_STATUSES = [\n DEFAULT_QUESTION_THEME_STATUS,\n QUESTION_THEME_STATUS_ARCHIVED,\n] as const satisfies readonly string[];\n\nexport {\n QUESTION_THEME_STATUSES,\n DEFAULT_QUESTION_THEME_STATUS,\n QUESTION_THEME_STATUS_ARCHIVED,\n};"],"mappings":"
|
|
1
|
+
{"version":3,"file":"question-theme-status.constants.mjs","names":[],"sources":["../../../../../../../../../../../src/contexts/question/modules/question-theme/domain/value-objects/question-theme-status/question-theme-status.constants.ts"],"sourcesContent":["const DEFAULT_QUESTION_THEME_STATUS = \"active\";\n\nconst QUESTION_THEME_STATUS_ARCHIVED = \"archived\";\n\nconst QUESTION_THEME_STATUSES = [\n DEFAULT_QUESTION_THEME_STATUS,\n QUESTION_THEME_STATUS_ARCHIVED,\n] as const satisfies readonly string[];\n\nexport {\n QUESTION_THEME_STATUSES,\n DEFAULT_QUESTION_THEME_STATUS,\n QUESTION_THEME_STATUS_ARCHIVED,\n};"],"mappings":";AAAA,MAAM,gCAAgC;AAEtC,MAAM,iCAAiC;AAEvC,MAAM,0BAA0B,CAC9B,+BACA,+BACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region ../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.d.ts
|
|
4
|
+
declare const API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO: z.ZodObject<{
|
|
5
|
+
code: z.ZodString;
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
8
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
9
|
+
origin: z.ZodOptional<z.ZodString>;
|
|
10
|
+
format: z.ZodOptional<z.ZodString>;
|
|
11
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
12
|
+
minimum: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
maximum: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
inclusive: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
16
|
+
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
type ApiResponseExceptionValidationDetailsDto = z.infer<typeof API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO, ApiResponseExceptionValidationDetailsDto };
|
|
21
|
+
//# sourceMappingURL=api-response-exception-validation-details.dto.shape.d.mts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region ../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.ts
|
|
3
|
+
const API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO = z.strictObject({
|
|
4
|
+
code: z.string().describe("Validation error code").meta({ example: "type_error" }),
|
|
5
|
+
message: z.string().describe("Validation error message").meta({ example: "Expected type string but received type number" }),
|
|
6
|
+
path: z.array(z.union([z.string(), z.number()])).describe("Path to the invalid property").meta({ example: ["user", "age"] }),
|
|
7
|
+
expected: z.string().optional().describe("Expected type of the invalid property value when applicable").meta({ example: "string" }),
|
|
8
|
+
origin: z.string().optional().describe("Origin type of the invalid property value when applicable").meta({ example: "number" }),
|
|
9
|
+
format: z.string().optional().describe("Expected high-level value format (e.g. 'uuid', 'email') when applicable").meta({ example: "email" }),
|
|
10
|
+
pattern: z.string().optional().describe("Expected regex pattern when applicable").meta({ example: String.raw`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$` }),
|
|
11
|
+
minimum: z.number().optional().describe("Expected minimum value when applicable").meta({ example: 1 }),
|
|
12
|
+
maximum: z.number().optional().describe("Expected maximum value when applicable").meta({ example: 255 }),
|
|
13
|
+
inclusive: z.boolean().optional().describe("Whether the minimum or maximum value is inclusive when applicable").meta({ example: true }),
|
|
14
|
+
keys: z.array(z.string()).optional().describe("List unrecognized keys when applicable").meta({ example: ["unexpectedKey1", "unexpectedKey2"] }),
|
|
15
|
+
values: z.array(z.string()).optional().describe("List unrecognized values when applicable").meta({ example: ["unexpectedValue1", "unexpectedValue2"] })
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=api-response-exception-validation-details.dto.shape.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-response-exception-validation-details.dto.shape.mjs","names":[],"sources":["../../../../../../../../../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO = z.strictObject({\n code: z.string()\n .describe(\"Validation error code\")\n .meta({ example: \"type_error\" }),\n message: z.string()\n .describe(\"Validation error message\")\n .meta({ example: \"Expected type string but received type number\" }),\n path: z.array(z.union([z.string(), z.number()]))\n .describe(\"Path to the invalid property\")\n .meta({ example: [\"user\", \"age\"] }),\n expected: z.string()\n .optional()\n .describe(\"Expected type of the invalid property value when applicable\")\n .meta({ example: \"string\" }),\n origin: z.string()\n .optional()\n .describe(\"Origin type of the invalid property value when applicable\")\n .meta({ example: \"number\" }),\n format: z.string()\n .optional()\n .describe(\"Expected high-level value format (e.g. 'uuid', 'email') when applicable\")\n .meta({ example: \"email\" }),\n pattern: z.string()\n .optional()\n .describe(\"Expected regex pattern when applicable\")\n .meta({ example: String.raw`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$` }),\n minimum: z.number()\n .optional()\n .describe(\"Expected minimum value when applicable\")\n .meta({ example: 1 }),\n maximum: z.number()\n .optional()\n .describe(\"Expected maximum value when applicable\")\n .meta({ example: 255 }),\n inclusive: z.boolean()\n .optional()\n .describe(\"Whether the minimum or maximum value is inclusive when applicable\")\n .meta({ example: true }),\n keys: z.array(z.string())\n .optional()\n .describe(\"List unrecognized keys when applicable\")\n .meta({ example: [\"unexpectedKey1\", \"unexpectedKey2\"] }),\n values: z.array(z.string())\n .optional()\n .describe(\"List unrecognized values when applicable\")\n .meta({ example: [\"unexpectedValue1\", \"unexpectedValue2\"] }),\n});\n\nexport type ApiResponseExceptionValidationDetailsDto = z.infer<typeof API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO>;\n\nexport { API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO };"],"mappings":";;AAEA,MAAM,gDAAgD,EAAE,aAAa;CACnE,MAAM,EAAE,QAAQ,CACb,SAAS,wBAAwB,CACjC,KAAK,EAAE,SAAS,cAAc,CAAC;CAClC,SAAS,EAAE,QAAQ,CAChB,SAAS,2BAA2B,CACpC,KAAK,EAAE,SAAS,iDAAiD,CAAC;CACrE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,CAC7C,SAAS,+BAA+B,CACxC,KAAK,EAAE,SAAS,CAAC,QAAQ,MAAM,EAAE,CAAC;CACrC,UAAU,EAAE,QAAQ,CACjB,UAAU,CACV,SAAS,8DAA8D,CACvE,KAAK,EAAE,SAAS,UAAU,CAAC;CAC9B,QAAQ,EAAE,QAAQ,CACf,UAAU,CACV,SAAS,4DAA4D,CACrE,KAAK,EAAE,SAAS,UAAU,CAAC;CAC9B,QAAQ,EAAE,QAAQ,CACf,UAAU,CACV,SAAS,0EAA0E,CACnF,KAAK,EAAE,SAAS,SAAS,CAAC;CAC7B,SAAS,EAAE,QAAQ,CAChB,UAAU,CACV,SAAS,yCAAyC,CAClD,KAAK,EAAE,SAAS,OAAO,GAAG,qDAAqD,CAAC;CACnF,SAAS,EAAE,QAAQ,CAChB,UAAU,CACV,SAAS,yCAAyC,CAClD,KAAK,EAAE,SAAS,GAAG,CAAC;CACvB,SAAS,EAAE,QAAQ,CAChB,UAAU,CACV,SAAS,yCAAyC,CAClD,KAAK,EAAE,SAAS,KAAK,CAAC;CACzB,WAAW,EAAE,SAAS,CACnB,UAAU,CACV,SAAS,oEAAoE,CAC7E,KAAK,EAAE,SAAS,MAAM,CAAC;CAC1B,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CACtB,UAAU,CACV,SAAS,yCAAyC,CAClD,KAAK,EAAE,SAAS,CAAC,kBAAkB,iBAAiB,EAAE,CAAC;CAC1D,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CACxB,UAAU,CACV,SAAS,2CAA2C,CACpD,KAAK,EAAE,SAAS,CAAC,oBAAoB,mBAAmB,EAAE,CAAC;CAC/D,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region ../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.d.ts
|
|
4
|
+
declare const API_RESPONSE_EXCEPTION_DTO: z.ZodObject<{
|
|
5
|
+
statusCode: z.ZodNumber;
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
error: z.ZodString;
|
|
8
|
+
validationDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9
|
+
code: z.ZodString;
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
12
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
13
|
+
origin: z.ZodOptional<z.ZodString>;
|
|
14
|
+
format: z.ZodOptional<z.ZodString>;
|
|
15
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
16
|
+
minimum: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
maximum: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
inclusive: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
+
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
}, z.core.$strict>>>;
|
|
22
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
type ApiResponseExceptionDto = z.infer<typeof API_RESPONSE_EXCEPTION_DTO>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { API_RESPONSE_EXCEPTION_DTO, ApiResponseExceptionDto };
|
|
27
|
+
//# sourceMappingURL=api-response-exception.dto.shape.d.mts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO } from "./api-response-exception-validation-details/api-response-exception-validation-details.dto.shape.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region ../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.ts
|
|
4
|
+
const API_RESPONSE_EXCEPTION_DTO = z.strictObject({
|
|
5
|
+
statusCode: z.number().describe("HTTP status code of the error response").meta({ example: 400 }),
|
|
6
|
+
message: z.string().describe("Error message").meta({ example: "The request could not be understood by the server due to malformed syntax." }),
|
|
7
|
+
error: z.string().describe("Short description of the HTTP error").meta({ example: "Bad Request" }),
|
|
8
|
+
validationDetails: z.array(API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO).optional().describe("List of validation errors, when requested DTO validation fails"),
|
|
9
|
+
errorCode: z.string().optional().describe("Machine-readable error code for frontend mapping and localization").meta({ example: "question-theme-referenced-by-live-questions" })
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { API_RESPONSE_EXCEPTION_DTO };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=api-response-exception.dto.shape.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-response-exception.dto.shape.mjs","names":[],"sources":["../../../../../../../../../src/shared/infrastructure/http/dto/api-response-exception/api-response-exception.dto.shape.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO } from \"@shared/infrastructure/http/dto/api-response-exception/api-response-exception-validation-details/api-response-exception-validation-details.dto.shape\";\n\nconst API_RESPONSE_EXCEPTION_DTO = z.strictObject({\n statusCode: z.number()\n .describe(\"HTTP status code of the error response\")\n .meta({ example: 400 }),\n message: z.string()\n .describe(\"Error message\")\n .meta({ example: \"The request could not be understood by the server due to malformed syntax.\" }),\n error: z.string()\n .describe(\"Short description of the HTTP error\")\n .meta({ example: \"Bad Request\" }),\n validationDetails: z.array(API_RESPONSE_EXCEPTION_VALIDATION_DETAILS_DTO)\n .optional()\n .describe(\"List of validation errors, when requested DTO validation fails\"),\n errorCode: z.string()\n .optional()\n .describe(\"Machine-readable error code for frontend mapping and localization\")\n .meta({ example: \"question-theme-referenced-by-live-questions\" }),\n});\n\nexport type ApiResponseExceptionDto = z.infer<typeof API_RESPONSE_EXCEPTION_DTO>;\n\nexport { API_RESPONSE_EXCEPTION_DTO };"],"mappings":";;;AAIA,MAAM,6BAA6B,EAAE,aAAa;CAChD,YAAY,EAAE,QAAQ,CACnB,SAAS,yCAAyC,CAClD,KAAK,EAAE,SAAS,KAAK,CAAC;CACzB,SAAS,EAAE,QAAQ,CAChB,SAAS,gBAAgB,CACzB,KAAK,EAAE,SAAS,8EAA8E,CAAC;CAClG,OAAO,EAAE,QAAQ,CACd,SAAS,sCAAsC,CAC/C,KAAK,EAAE,SAAS,eAAe,CAAC;CACnC,mBAAmB,EAAE,MAAM,8CAA8C,CACtE,UAAU,CACV,SAAS,iEAAiE;CAC7E,WAAW,EAAE,QAAQ,CAClB,UAAU,CACV,SAAS,oEAAoE,CAC7E,KAAK,EAAE,SAAS,+CAA+C,CAAC;CACpE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region ../../src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.d.ts
|
|
2
|
+
declare const LOCALIZED_TEXT_ENTRY_MIN_LENGTH = 1;
|
|
3
|
+
declare const LOCALIZED_TEXT_ENTRY_MAX_LENGTH = 500;
|
|
4
|
+
declare const LOCALIZED_TEXTS_MIN_LENGTH = 1;
|
|
5
|
+
declare const LOCALIZED_TEXTS_MAX_LENGTH = 10;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH };
|
|
8
|
+
//# sourceMappingURL=localization.zod.validators.constants.d.mts.map
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
//#region ../../src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.ts
|
|
2
|
+
const LOCALIZED_TEXT_ENTRY_MIN_LENGTH = 1;
|
|
3
|
+
const LOCALIZED_TEXT_ENTRY_MAX_LENGTH = 500;
|
|
4
|
+
const LOCALIZED_TEXTS_MIN_LENGTH = 1;
|
|
5
|
+
const LOCALIZED_TEXTS_MAX_LENGTH = 10;
|
|
2
6
|
const LOCALE_EXAMPLES = {
|
|
3
7
|
en: "Example text in English.",
|
|
4
8
|
fr: "Exemple de texte en français.",
|
|
@@ -7,7 +11,8 @@ const LOCALE_EXAMPLES = {
|
|
|
7
11
|
it: "Testo di esempio in italiano.",
|
|
8
12
|
pt: "Texto de exemplo em português."
|
|
9
13
|
};
|
|
14
|
+
const LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE = "At least one locale must be provided";
|
|
10
15
|
//#endregion
|
|
11
|
-
export { LOCALE_EXAMPLES };
|
|
16
|
+
export { LOCALE_EXAMPLES, LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH, LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH };
|
|
12
17
|
|
|
13
18
|
//# sourceMappingURL=localization.zod.validators.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.zod.validators.constants.mjs","names":[],"sources":["../../../../../../../../../../../src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.ts"],"sourcesContent":["import type { Locale } from \"@shared/domain/value-objects/locale/locale.types\";\n\nconst LOCALIZED_TEXT_ENTRY_MIN_LENGTH = 1;\n\nconst LOCALIZED_TEXT_ENTRY_MAX_LENGTH = 500;\n\nconst LOCALIZED_TEXTS_MIN_LENGTH = 1;\n\nconst LOCALIZED_TEXTS_MAX_LENGTH = 10;\n\nconst LOCALE_EXAMPLES: Record<Locale, string> = {\n en: \"Example text in English.\",\n fr: \"Exemple de texte en français.\",\n es: \"Texto de ejemplo en español.\",\n de: \"Beispieltext auf Deutsch.\",\n it: \"Testo di esempio in italiano.\",\n pt: \"Texto de exemplo em português.\",\n} as const;\n\nexport {\n LOCALIZED_TEXT_ENTRY_MIN_LENGTH,\n LOCALIZED_TEXT_ENTRY_MAX_LENGTH,\n LOCALIZED_TEXTS_MIN_LENGTH,\n LOCALIZED_TEXTS_MAX_LENGTH,\n LOCALE_EXAMPLES,\n};"],"mappings":";
|
|
1
|
+
{"version":3,"file":"localization.zod.validators.constants.mjs","names":[],"sources":["../../../../../../../../../../../src/shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants.ts"],"sourcesContent":["import type { Locale } from \"@shared/domain/value-objects/locale/locale.types\";\n\nconst LOCALIZED_TEXT_ENTRY_MIN_LENGTH = 1;\n\nconst LOCALIZED_TEXT_ENTRY_MAX_LENGTH = 500;\n\nconst LOCALIZED_TEXTS_MIN_LENGTH = 1;\n\nconst LOCALIZED_TEXTS_MAX_LENGTH = 10;\n\nconst LOCALE_EXAMPLES: Record<Locale, string> = {\n en: \"Example text in English.\",\n fr: \"Exemple de texte en français.\",\n es: \"Texto de ejemplo en español.\",\n de: \"Beispieltext auf Deutsch.\",\n it: \"Testo di esempio in italiano.\",\n pt: \"Texto de exemplo em português.\",\n} as const;\n\nconst LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE = \"At least one locale must be provided\";\n\nexport {\n LOCALIZED_TEXT_ENTRY_MIN_LENGTH,\n LOCALIZED_TEXT_ENTRY_MAX_LENGTH,\n LOCALIZED_TEXTS_MIN_LENGTH,\n LOCALIZED_TEXTS_MAX_LENGTH,\n LOCALE_EXAMPLES,\n LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE,\n};"],"mappings":";AAEA,MAAM,kCAAkC;AAExC,MAAM,kCAAkC;AAExC,MAAM,6BAA6B;AAEnC,MAAM,6BAA6B;AAEnC,MAAM,kBAA0C;CAC9C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAED,MAAM,qCAAqC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { LOCALE_LABELS } from "../../../../../domain/value-objects/locale/locale.constants.mjs";
|
|
2
|
-
import { LOCALE_EXAMPLES } from "./constants/localization.zod.validators.constants.mjs";
|
|
2
|
+
import { LOCALE_EXAMPLES, LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE } from "./constants/localization.zod.validators.constants.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region ../../src/shared/infrastructure/http/zod/validators/localization/localization.zod.validators.ts
|
|
5
|
+
function hasAtLeastOneLocaleValue(object) {
|
|
6
|
+
return Object.values(object).some((value) => value !== void 0);
|
|
7
|
+
}
|
|
5
8
|
function createZLocaleEntries(entryFactory) {
|
|
6
9
|
return {
|
|
7
10
|
en: entryFactory("en"),
|
|
@@ -25,11 +28,11 @@ function zLocalizedTextsEntry(locale) {
|
|
|
25
28
|
}
|
|
26
29
|
function zLocalizedText() {
|
|
27
30
|
const localeEntries = createZLocaleEntries(zLocalizedTextEntry);
|
|
28
|
-
return z.strictObject(localeEntries).describe("Localized text object with translations for multiple languages");
|
|
31
|
+
return z.strictObject(localeEntries).describe("Localized text object with translations for multiple languages").refine((object) => hasAtLeastOneLocaleValue(object), { message: LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE });
|
|
29
32
|
}
|
|
30
33
|
function zLocalizedTexts() {
|
|
31
34
|
const localeEntries = createZLocaleEntries(zLocalizedTextsEntry);
|
|
32
|
-
return z.strictObject(localeEntries).describe("Localized texts object with translations for multiple languages");
|
|
35
|
+
return z.strictObject(localeEntries).describe("Localized texts object with translations for multiple languages").refine((object) => hasAtLeastOneLocaleValue(object), { message: LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE });
|
|
33
36
|
}
|
|
34
37
|
//#endregion
|
|
35
38
|
export { zLocalizedText, zLocalizedTexts };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.zod.validators.mjs","names":[],"sources":["../../../../../../../../../../src/shared/infrastructure/http/zod/validators/localization/localization.zod.validators.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { LOCALE_LABELS } from \"@shared/domain/value-objects/locale/locale.constants\";\nimport { LOCALE_EXAMPLES, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH, LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH } from \"@shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants\";\n\nimport type { ZodObject, ZodString, ZodOptional, ZodArray } from \"zod\";\n\nimport type { Locale } from \"@shared/domain/value-objects/locale/locale.types\";\n\nfunction createZLocaleEntries<T>(entryFactory: (locale: Locale) => T): Record<Locale, T> {\n return {\n en: entryFactory(\"en\"),\n fr: entryFactory(\"fr\"),\n es: entryFactory(\"es\"),\n de: entryFactory(\"de\"),\n it: entryFactory(\"it\"),\n pt: entryFactory(\"pt\"),\n };\n}\n\nfunction zLocalizedTextEntry(locale: Locale): ZodOptional<ZodString> {\n const localeLabel = LOCALE_LABELS[locale];\n const localeExample = LOCALE_EXAMPLES[locale];\n\n return z.string()\n .trim()\n .min(LOCALIZED_TEXT_ENTRY_MIN_LENGTH)\n .max(LOCALIZED_TEXT_ENTRY_MAX_LENGTH)\n .optional()\n .describe(`Text in ${localeLabel}`)\n .meta({ example: localeExample });\n}\n\nfunction zLocalizedTextsEntry(locale: Locale): ZodOptional<ZodArray<ZodString>> {\n const localeLabel = LOCALE_LABELS[locale];\n const localeExample = LOCALE_EXAMPLES[locale];\n\n const zLocalizedTextsValue = z.string()\n .trim()\n .min(LOCALIZED_TEXT_ENTRY_MIN_LENGTH)\n .max(LOCALIZED_TEXT_ENTRY_MAX_LENGTH);\n\n return z.array(zLocalizedTextsValue)\n .min(LOCALIZED_TEXTS_MIN_LENGTH)\n .max(LOCALIZED_TEXTS_MAX_LENGTH)\n .optional()\n .describe(`Texts in ${localeLabel}`)\n .meta({ example: [localeExample] });\n}\n\nfunction zLocalizedText(): ZodObject<Record<Locale, ZodOptional<ZodString>>> {\n const localeEntries: Record<Locale, ZodOptional<ZodString>> = createZLocaleEntries(zLocalizedTextEntry);\n\n return z.strictObject(localeEntries)\n .describe(\"Localized text object with translations for multiple languages\");\n}\n\nfunction zLocalizedTexts(): ZodObject<Record<Locale, ZodOptional<ZodArray<ZodString>>>> {\n const localeEntries: Record<Locale, ZodOptional<ZodArray<ZodString>>> = createZLocaleEntries(zLocalizedTextsEntry);\n\n return z.strictObject(localeEntries)\n .describe(\"Localized texts object with translations for multiple languages\");\n}\n\nexport {\n createZLocaleEntries,\n zLocalizedTextEntry,\n zLocalizedTextsEntry,\n zLocalizedText,\n zLocalizedTexts,\n};"],"mappings":";;;;AASA,SAAS,qBAAwB,cAAwD;AACvF,QAAO;EACL,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACvB;;AAGH,SAAS,oBAAoB,QAAwC;CACnE,MAAM,cAAc,cAAc;CAClC,MAAM,gBAAgB,gBAAgB;AAEtC,QAAO,EAAE,QAAQ,CACd,MAAM,CACN,IAAA,EAAoC,CACpC,IAAA,IAAoC,CACpC,UAAU,CACV,SAAS,WAAW,cAAc,CAClC,KAAK,EAAE,SAAS,eAAe,CAAC;;AAGrC,SAAS,qBAAqB,QAAkD;CAC9E,MAAM,cAAc,cAAc;CAClC,MAAM,gBAAgB,gBAAgB;CAEtC,MAAM,uBAAuB,EAAE,QAAQ,CACpC,MAAM,CACN,IAAA,EAAoC,CACpC,IAAA,IAAoC;AAEvC,QAAO,EAAE,MAAM,qBAAqB,CACjC,IAAA,EAA+B,CAC/B,IAAA,GAA+B,CAC/B,UAAU,CACV,SAAS,YAAY,cAAc,CACnC,KAAK,EAAE,SAAS,CAAC,cAAc,EAAE,CAAC;;AAGvC,SAAS,iBAAoE;CAC3E,MAAM,gBAAwD,qBAAqB,oBAAoB;AAEvG,QAAO,EAAE,aAAa,cAAc,CACjC,SAAS,iEAAiE;;
|
|
1
|
+
{"version":3,"file":"localization.zod.validators.mjs","names":[],"sources":["../../../../../../../../../../src/shared/infrastructure/http/zod/validators/localization/localization.zod.validators.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { LOCALE_LABELS } from \"@shared/domain/value-objects/locale/locale.constants\";\nimport { LOCALE_EXAMPLES, LOCALIZED_TEXT_ENTRY_MAX_LENGTH, LOCALIZED_TEXT_ENTRY_MIN_LENGTH, LOCALIZED_TEXTS_MAX_LENGTH, LOCALIZED_TEXTS_MIN_LENGTH, LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE } from \"@shared/infrastructure/http/zod/validators/localization/constants/localization.zod.validators.constants\";\n\nimport type { ZodObject, ZodString, ZodOptional, ZodArray } from \"zod\";\n\nimport type { Locale } from \"@shared/domain/value-objects/locale/locale.types\";\n\nfunction hasAtLeastOneLocaleValue(object: Record<string, unknown>): boolean {\n return Object.values(object).some(value => value !== undefined);\n}\n\nfunction createZLocaleEntries<T>(entryFactory: (locale: Locale) => T): Record<Locale, T> {\n return {\n en: entryFactory(\"en\"),\n fr: entryFactory(\"fr\"),\n es: entryFactory(\"es\"),\n de: entryFactory(\"de\"),\n it: entryFactory(\"it\"),\n pt: entryFactory(\"pt\"),\n };\n}\n\nfunction zLocalizedTextEntry(locale: Locale): ZodOptional<ZodString> {\n const localeLabel = LOCALE_LABELS[locale];\n const localeExample = LOCALE_EXAMPLES[locale];\n\n return z.string()\n .trim()\n .min(LOCALIZED_TEXT_ENTRY_MIN_LENGTH)\n .max(LOCALIZED_TEXT_ENTRY_MAX_LENGTH)\n .optional()\n .describe(`Text in ${localeLabel}`)\n .meta({ example: localeExample });\n}\n\nfunction zLocalizedTextsEntry(locale: Locale): ZodOptional<ZodArray<ZodString>> {\n const localeLabel = LOCALE_LABELS[locale];\n const localeExample = LOCALE_EXAMPLES[locale];\n\n const zLocalizedTextsValue = z.string()\n .trim()\n .min(LOCALIZED_TEXT_ENTRY_MIN_LENGTH)\n .max(LOCALIZED_TEXT_ENTRY_MAX_LENGTH);\n\n return z.array(zLocalizedTextsValue)\n .min(LOCALIZED_TEXTS_MIN_LENGTH)\n .max(LOCALIZED_TEXTS_MAX_LENGTH)\n .optional()\n .describe(`Texts in ${localeLabel}`)\n .meta({ example: [localeExample] });\n}\n\nfunction zLocalizedText(): ZodObject<Record<Locale, ZodOptional<ZodString>>> {\n const localeEntries: Record<Locale, ZodOptional<ZodString>> = createZLocaleEntries(zLocalizedTextEntry);\n\n return z.strictObject(localeEntries)\n .describe(\"Localized text object with translations for multiple languages\")\n .refine(\n object => hasAtLeastOneLocaleValue(object),\n { message: LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE },\n );\n}\n\nfunction zLocalizedTexts(): ZodObject<Record<Locale, ZodOptional<ZodArray<ZodString>>>> {\n const localeEntries: Record<Locale, ZodOptional<ZodArray<ZodString>>> = createZLocaleEntries(zLocalizedTextsEntry);\n\n return z.strictObject(localeEntries)\n .describe(\"Localized texts object with translations for multiple languages\")\n .refine(\n object => hasAtLeastOneLocaleValue(object),\n { message: LOCALIZED_TEXT_EMPTY_ERROR_MESSAGE },\n );\n}\n\nexport {\n createZLocaleEntries,\n hasAtLeastOneLocaleValue,\n zLocalizedTextEntry,\n zLocalizedTextsEntry,\n zLocalizedText,\n zLocalizedTexts,\n};"],"mappings":";;;;AASA,SAAS,yBAAyB,QAA0C;AAC1E,QAAO,OAAO,OAAO,OAAO,CAAC,MAAK,UAAS,UAAU,KAAA,EAAU;;AAGjE,SAAS,qBAAwB,cAAwD;AACvF,QAAO;EACL,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACtB,IAAI,aAAa,KAAK;EACvB;;AAGH,SAAS,oBAAoB,QAAwC;CACnE,MAAM,cAAc,cAAc;CAClC,MAAM,gBAAgB,gBAAgB;AAEtC,QAAO,EAAE,QAAQ,CACd,MAAM,CACN,IAAA,EAAoC,CACpC,IAAA,IAAoC,CACpC,UAAU,CACV,SAAS,WAAW,cAAc,CAClC,KAAK,EAAE,SAAS,eAAe,CAAC;;AAGrC,SAAS,qBAAqB,QAAkD;CAC9E,MAAM,cAAc,cAAc;CAClC,MAAM,gBAAgB,gBAAgB;CAEtC,MAAM,uBAAuB,EAAE,QAAQ,CACpC,MAAM,CACN,IAAA,EAAoC,CACpC,IAAA,IAAoC;AAEvC,QAAO,EAAE,MAAM,qBAAqB,CACjC,IAAA,EAA+B,CAC/B,IAAA,GAA+B,CAC/B,UAAU,CACV,SAAS,YAAY,cAAc,CACnC,KAAK,EAAE,SAAS,CAAC,cAAc,EAAE,CAAC;;AAGvC,SAAS,iBAAoE;CAC3E,MAAM,gBAAwD,qBAAqB,oBAAoB;AAEvG,QAAO,EAAE,aAAa,cAAc,CACjC,SAAS,iEAAiE,CAC1E,QACC,WAAU,yBAAyB,OAAO,EAC1C,EAAE,SAAS,oCAAoC,CAChD;;AAGL,SAAS,kBAA+E;CACtF,MAAM,gBAAkE,qBAAqB,qBAAqB;AAElH,QAAO,EAAE,aAAa,cAAc,CACjC,SAAS,kEAAkE,CAC3E,QACC,WAAU,yBAAyB,OAAO,EAC1C,EAAE,SAAS,oCAAoC,CAChD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region ../../src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.d.ts
|
|
2
|
+
declare const SLUG_MIN_LENGTH = 3;
|
|
3
|
+
declare const SLUG_MAX_LENGTH = 50;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { SLUG_MAX_LENGTH, SLUG_MIN_LENGTH };
|
|
6
|
+
//# sourceMappingURL=string.zod.validators.constants.d.mts.map
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
const SLUG_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/u;
|
|
3
3
|
const MONGO_ID_REGEX = /^[\da-f]{24}$/iu;
|
|
4
4
|
const HEX_COLOR_REGEX = /^#[\dA-Fa-f]{6}$/u;
|
|
5
|
+
const SLUG_MIN_LENGTH = 3;
|
|
6
|
+
const SLUG_MAX_LENGTH = 50;
|
|
5
7
|
const ISO_DATE_TIME_EXAMPLE = "2026-04-14T00:00:00.000Z";
|
|
6
8
|
const HEX_COLOR_EXAMPLE = "#FF5733";
|
|
7
9
|
//#endregion
|
|
8
|
-
export { HEX_COLOR_EXAMPLE, HEX_COLOR_REGEX, ISO_DATE_TIME_EXAMPLE, MONGO_ID_REGEX, SLUG_REGEX };
|
|
10
|
+
export { HEX_COLOR_EXAMPLE, HEX_COLOR_REGEX, ISO_DATE_TIME_EXAMPLE, MONGO_ID_REGEX, SLUG_MAX_LENGTH, SLUG_MIN_LENGTH, SLUG_REGEX };
|
|
9
11
|
|
|
10
12
|
//# sourceMappingURL=string.zod.validators.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.zod.validators.constants.mjs","names":[],"sources":["../../../../../../../../../../../src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.ts"],"sourcesContent":["const SLUG_REGEX = /^[\\da-z]+(?:-[\\da-z]+)*$/u;\n\nconst MONGO_ID_REGEX = /^[\\da-f]{24}$/iu;\n\nconst HEX_COLOR_REGEX = /^#[\\dA-Fa-f]{6}$/u;\n\nconst SLUG_MIN_LENGTH = 3;\n\nconst SLUG_MAX_LENGTH = 50;\n\nconst ISO_DATE_TIME_EXAMPLE = \"2026-04-14T00:00:00.000Z\";\n\nconst HEX_COLOR_EXAMPLE = \"#FF5733\";\n\nexport {\n SLUG_REGEX,\n MONGO_ID_REGEX,\n HEX_COLOR_REGEX,\n SLUG_MIN_LENGTH,\n SLUG_MAX_LENGTH,\n ISO_DATE_TIME_EXAMPLE,\n HEX_COLOR_EXAMPLE,\n};"],"mappings":";AAAA,MAAM,aAAa;AAEnB,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB;
|
|
1
|
+
{"version":3,"file":"string.zod.validators.constants.mjs","names":[],"sources":["../../../../../../../../../../../src/shared/infrastructure/http/zod/validators/string/constants/string.zod.validators.constants.ts"],"sourcesContent":["const SLUG_REGEX = /^[\\da-z]+(?:-[\\da-z]+)*$/u;\n\nconst MONGO_ID_REGEX = /^[\\da-f]{24}$/iu;\n\nconst HEX_COLOR_REGEX = /^#[\\dA-Fa-f]{6}$/u;\n\nconst SLUG_MIN_LENGTH = 3;\n\nconst SLUG_MAX_LENGTH = 50;\n\nconst ISO_DATE_TIME_EXAMPLE = \"2026-04-14T00:00:00.000Z\";\n\nconst HEX_COLOR_EXAMPLE = \"#FF5733\";\n\nexport {\n SLUG_REGEX,\n MONGO_ID_REGEX,\n HEX_COLOR_REGEX,\n SLUG_MIN_LENGTH,\n SLUG_MAX_LENGTH,\n ISO_DATE_TIME_EXAMPLE,\n HEX_COLOR_EXAMPLE,\n};"],"mappings":";AAAA,MAAM,aAAa;AAEnB,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB;AAExB,MAAM,kBAAkB;AAExB,MAAM,kBAAkB;AAExB,MAAM,wBAAwB;AAE9B,MAAM,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goat-it/schemas",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7-beta",
|
|
5
5
|
"description": "Shared types, constants and Zod schemas for the Goat It projects.",
|
|
6
6
|
"author": "Antoine ZANARDI",
|
|
7
7
|
"license": "MIT",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@arethetypeswrong/core": "^0.18.2",
|
|
15
|
-
"tsdown": "^0.21.
|
|
16
|
-
"typescript": "^
|
|
15
|
+
"tsdown": "^0.21.7",
|
|
16
|
+
"typescript": "^6.0.2",
|
|
17
17
|
"zod": "^4.3.6"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"./shared/locale": {
|
|
41
41
|
"types": "./dist/shared/locale/index.d.mts",
|
|
42
42
|
"import": "./dist/shared/locale/index.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./shared/error": {
|
|
45
|
+
"types": "./dist/shared/error/index.d.mts",
|
|
46
|
+
"import": "./dist/shared/error/index.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./shared/constants": {
|
|
49
|
+
"types": "./dist/shared/constants/index.d.mts",
|
|
50
|
+
"import": "./dist/shared/constants/index.mjs"
|
|
43
51
|
}
|
|
44
52
|
},
|
|
45
53
|
"dependencies": {
|