hh-contracts 0.0.59 → 0.0.61

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.
@@ -3,7 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LanguageKeysSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../constants");
6
- exports.LanguageKeysSchema = zod_1.z.enum(constants_1.LANGUAGE_KEYS, {
7
- invalid_type_error: 'languageInvalid',
8
- required_error: 'languageRequired',
9
- });
6
+ exports.LanguageKeysSchema = zod_1.z.enum(constants_1.LANGUAGE_KEYS);
@@ -2,7 +2,6 @@
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';
6
5
  const language_keys_schema_1 = require("./language-keys.schema");
7
6
  const translatable_field_constant_1 = require("../constants/translatable-field.constant");
8
7
  const constants_1 = require("../constants");
@@ -9,8 +9,11 @@ const BatchTranslateContractRequestSchema = zod_1.z.object({
9
9
  fromLang: common_1.LanguageKeysSchema,
10
10
  toLangs: zod_1.z.array(common_1.LanguageKeysSchema),
11
11
  });
12
+ const TranslationsSchema = zod_1.z
13
+ .object(Object.fromEntries(common_1.LANGUAGE_KEYS.map(l => [l, zod_1.z.string().min(1)])))
14
+ .partial();
12
15
  const BatchTranslateContractResponseSchema = zod_1.z.object({
13
- translations: zod_1.z.record(common_1.LanguageKeysSchema, zod_1.z.string()),
16
+ translations: TranslationsSchema,
14
17
  });
15
18
  var BatchTranslateContract;
16
19
  (function (BatchTranslateContract) {
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./get-translate.contract"), exports);
17
+ __exportStar(require("./batch-translate.contract"), exports);
@@ -1,7 +1,4 @@
1
1
  import { z } from 'zod';
2
2
  import { LANGUAGE_KEYS } from '../constants';
3
3
 
4
- export const LanguageKeysSchema = z.enum(LANGUAGE_KEYS, {
5
- invalid_type_error: 'languageInvalid',
6
- required_error: 'languageRequired',
7
- });
4
+ export const LanguageKeysSchema = z.enum(LANGUAGE_KEYS);
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- // import { z } from 'zod/v4';
3
2
  import { LanguageKeysSchema } from './language-keys.schema';
4
3
  import { TRANSLATABLE_FIELD_VALUES } from '../constants/translatable-field.constant';
5
4
  import { ENTITY_VALUES } from '../constants';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-contracts",
3
- "version": "0.0.59",
3
+ "version": "0.0.61",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { HTTP_METHODS, LanguageKeysSchema } from '../../common';
2
+ import { HTTP_METHODS, LanguageKeysSchema, LANGUAGE_KEYS } from '../../common';
3
3
  import { TRANSLATE_API, TRANSLATE_CONTROLLER } from '../translate.api';
4
4
 
5
5
  const BatchTranslateContractRequestSchema = z.object({
@@ -8,8 +8,12 @@ const BatchTranslateContractRequestSchema = z.object({
8
8
  toLangs: z.array(LanguageKeysSchema),
9
9
  });
10
10
 
11
+ const TranslationsSchema = z
12
+ .object(Object.fromEntries(LANGUAGE_KEYS.map(l => [l, z.string().min(1)])))
13
+ .partial();
14
+
11
15
  const BatchTranslateContractResponseSchema = z.object({
12
- translations: z.record(LanguageKeysSchema, z.string()),
16
+ translations: TranslationsSchema,
13
17
  });
14
18
 
15
19
  export namespace BatchTranslateContract {
@@ -1 +1 @@
1
- export * from './get-translate.contract';
1
+ export * from './batch-translate.contract';