hh-contracts 0.0.55 → 0.0.57
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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TranslationsSchema = exports.TranslationsArraySchema = exports.TranslationItemSchema = exports.TranslationPersistedSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
// import { z } from 'zod/v4';
|
|
5
6
|
const language_keys_schema_1 = require("./language-keys.schema");
|
|
6
7
|
const translatable_field_constant_1 = require("../constants/translatable-field.constant");
|
|
7
8
|
const constants_1 = require("../constants");
|
|
@@ -19,13 +20,15 @@ exports.TranslationItemSchema = exports.TranslationPersistedSchema.omit({
|
|
|
19
20
|
});
|
|
20
21
|
exports.TranslationsArraySchema = zod_1.z
|
|
21
22
|
.array(exports.TranslationItemSchema)
|
|
22
|
-
.
|
|
23
|
+
.refine(items => items.length > 0, {
|
|
24
|
+
params: { translationKey: 'errors.validation.atLeastOneTranslationRequired' },
|
|
25
|
+
})
|
|
23
26
|
.refine(items => {
|
|
24
27
|
const langs = items.map(item => item.lang);
|
|
25
28
|
const uniqueLangs = new Set(langs);
|
|
26
29
|
return langs.length === uniqueLangs.size;
|
|
27
30
|
}, {
|
|
28
|
-
|
|
31
|
+
params: { translationKey: 'errors.validation.duplicateLanguagesNotAllowed' },
|
|
29
32
|
});
|
|
30
33
|
exports.TranslationsSchema = zod_1.z.object({
|
|
31
34
|
name: exports.TranslationsArraySchema,
|
|
@@ -18,7 +18,7 @@ exports.JsonConditionsSchema = zod_1.z
|
|
|
18
18
|
catch {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
-
}, {
|
|
21
|
+
}, { params: { translationKey: 'errors.validation.invalidJson' } });
|
|
22
22
|
exports.PermissionPersistedSchema = zod_1.z
|
|
23
23
|
.object({
|
|
24
24
|
id: zod_1.z.string().uuid(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
// import { z } from 'zod/v4';
|
|
2
3
|
import { LanguageKeysSchema } from './language-keys.schema';
|
|
3
4
|
import { TRANSLATABLE_FIELD_VALUES } from '../constants/translatable-field.constant';
|
|
4
5
|
import { ENTITY_VALUES } from '../constants';
|
|
@@ -21,7 +22,9 @@ export type TTranslationItem = z.infer<typeof TranslationItemSchema>;
|
|
|
21
22
|
|
|
22
23
|
export const TranslationsArraySchema = z
|
|
23
24
|
.array(TranslationItemSchema)
|
|
24
|
-
.
|
|
25
|
+
.refine(items => items.length > 0, {
|
|
26
|
+
params: { translationKey: 'errors.validation.atLeastOneTranslationRequired' },
|
|
27
|
+
})
|
|
25
28
|
.refine(
|
|
26
29
|
items => {
|
|
27
30
|
const langs = items.map(item => item.lang);
|
|
@@ -29,7 +32,7 @@ export const TranslationsArraySchema = z
|
|
|
29
32
|
return langs.length === uniqueLangs.size;
|
|
30
33
|
},
|
|
31
34
|
{
|
|
32
|
-
|
|
35
|
+
params: { translationKey: 'errors.validation.duplicateLanguagesNotAllowed' },
|
|
33
36
|
},
|
|
34
37
|
);
|
|
35
38
|
export type TTranslationsArray = z.infer<typeof TranslationsArraySchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hh-contracts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"zod": "^3.
|
|
13
|
+
"zod": "^3.25.51"
|
|
14
14
|
}
|
|
15
15
|
}
|