hh-contracts 0.0.92 → 0.0.93

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.
@@ -33,14 +33,14 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.makeTranslationsByLang = void 0;
36
+ exports.makeTranslations = void 0;
37
37
  const z = __importStar(require("zod"));
38
38
  const language_keys_schema_1 = require("./language-keys.schema");
39
- const makeTranslationsByLang = (schema) => z
39
+ const makeTranslations = (schema) => z
40
40
  .partialRecord(language_keys_schema_1.LanguageKeysSchema, schema)
41
41
  .refine(translations => Object.keys(translations).length > 0, {
42
42
  params: {
43
43
  messageKey: 'zod.translations.must_not_be_empty',
44
44
  },
45
45
  });
46
- exports.makeTranslationsByLang = makeTranslationsByLang;
46
+ exports.makeTranslations = makeTranslations;
@@ -52,7 +52,7 @@ exports.PageLangTranslationSchema = z.object({
52
52
  .default({}),
53
53
  blocks: blocks_1.BlocksTranslationSchema.default({}),
54
54
  });
55
- const TranslationsSchema = (0, common_1.makeTranslationsByLang)(exports.PageLangTranslationSchema);
55
+ const TranslationsSchema = (0, common_1.makeTranslations)(exports.PageLangTranslationSchema);
56
56
  exports.PageSchema = z.object({
57
57
  meta: MetaSchema,
58
58
  blocks: z.array(blocks_1.BlockSchema),
@@ -66,7 +66,7 @@ exports.PermissionTranslationsSchema = z.object({
66
66
  description: z.string().optional(),
67
67
  });
68
68
  exports.PermissionWithTranslationsSchema = exports.PermissionPersistedSchema.extend({
69
- translations: (0, common_1.makeTranslationsByLang)(exports.PermissionTranslationsSchema),
69
+ translations: (0, common_1.makeTranslations)(exports.PermissionTranslationsSchema),
70
70
  });
71
71
  exports.PermissionListItemSchema = exports.PermissionPersistedSchema.extend({
72
72
  name: z.string().nullable(),
@@ -53,7 +53,7 @@ exports.RoleTranslationsSchema = z.object({
53
53
  description: z.string().optional(),
54
54
  });
55
55
  exports.RoleWithTranslationsSchema = exports.RoleWithPermissionsSchema.extend({
56
- translations: (0, common_1.makeTranslationsByLang)(exports.RoleTranslationsSchema),
56
+ translations: (0, common_1.makeTranslations)(exports.RoleTranslationsSchema),
57
57
  });
58
58
  exports.RoleListItemSchema = exports.RolePersistedSchema.extend({
59
59
  name: z.string().nullable(),
@@ -1,7 +1,7 @@
1
1
  import * as z from 'zod';
2
2
  import { LanguageKeysSchema } from './language-keys.schema';
3
3
 
4
- export const makeTranslationsByLang = <T extends z.ZodObject>(schema: T) =>
4
+ export const makeTranslations = <T extends z.ZodObject>(schema: T) =>
5
5
  z
6
6
  .partialRecord(LanguageKeysSchema, schema)
7
7
  .refine(translations => Object.keys(translations).length > 0, {
@@ -9,6 +9,6 @@ export const makeTranslationsByLang = <T extends z.ZodObject>(schema: T) =>
9
9
  messageKey: 'zod.translations.must_not_be_empty',
10
10
  },
11
11
  });
12
- export type TranslationsByLang<T extends object> = Partial<
12
+ export type TTranslations<T extends object> = Partial<
13
13
  Record<z.infer<typeof LanguageKeysSchema>, T>
14
14
  >;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-contracts",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod';
2
- import { AppStatuses, LanguageKeysSchema, makeTranslationsByLang, SlugSchema } from '../../common';
2
+ import { AppStatuses, LanguageKeysSchema, makeTranslations, SlugSchema } from '../../common';
3
3
  import { BlocksTranslationSchema, BlockSchema } from './blocks';
4
4
 
5
5
  const MetaSchema = z.object({
@@ -18,7 +18,7 @@ export const PageLangTranslationSchema = z.object({
18
18
  .default({}),
19
19
  blocks: BlocksTranslationSchema.default({}),
20
20
  });
21
- const TranslationsSchema = makeTranslationsByLang(PageLangTranslationSchema);
21
+ const TranslationsSchema = makeTranslations(PageLangTranslationSchema);
22
22
 
23
23
  export const PageSchema = z.object({
24
24
  meta: MetaSchema,
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod';
2
- import { AppAbility, TimestampSchema, makeTranslationsByLang } from '../common';
2
+ import { AppAbility, TimestampSchema, makeTranslations } from '../common';
3
3
 
4
4
  export const JsonConditionsSchema = z
5
5
  .string()
@@ -39,7 +39,7 @@ export const PermissionTranslationsSchema = z.object({
39
39
  export type TPermissionTranslations = z.infer<typeof PermissionTranslationsSchema>;
40
40
 
41
41
  export const PermissionWithTranslationsSchema = PermissionPersistedSchema.extend({
42
- translations: makeTranslationsByLang(PermissionTranslationsSchema),
42
+ translations: makeTranslations(PermissionTranslationsSchema),
43
43
  });
44
44
  export type TPermissionWithTranslations = z.infer<typeof PermissionWithTranslationsSchema>;
45
45
 
@@ -1,10 +1,5 @@
1
1
  import * as z from 'zod';
2
- import {
3
- ROLE_TYPE_VALUES,
4
- TimestampSchema,
5
- UuidArraySchema,
6
- makeTranslationsByLang,
7
- } from '../common';
2
+ import { ROLE_TYPE_VALUES, TimestampSchema, UuidArraySchema, makeTranslations } from '../common';
8
3
  import { PermissionListItemSchema } from '../permissions';
9
4
 
10
5
  export const RolePersistedSchema = z
@@ -29,7 +24,7 @@ export const RoleTranslationsSchema = z.object({
29
24
  export type TRoleTranslations = z.infer<typeof RoleTranslationsSchema>;
30
25
 
31
26
  export const RoleWithTranslationsSchema = RoleWithPermissionsSchema.extend({
32
- translations: makeTranslationsByLang(RoleTranslationsSchema),
27
+ translations: makeTranslations(RoleTranslationsSchema),
33
28
  });
34
29
  export type TRoleWithTranslations = z.infer<typeof RoleWithTranslationsSchema>;
35
30