hh-contracts 0.0.51 → 0.0.52

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.
@@ -10,7 +10,7 @@ exports.TranslationPersistedSchema = zod_1.z.object({
10
10
  entityId: zod_1.z.string(),
11
11
  lang: language_keys_schema_1.LanguageKeysSchema,
12
12
  field: zod_1.z.enum(translatable_field_constant_1.TRANSLATABLE_FIELD_VALUES),
13
- text: zod_1.z.string().min(1, { message: 'translationRequired' }),
13
+ text: zod_1.z.string().min(1),
14
14
  });
15
15
  exports.TranslationItemSchema = exports.TranslationPersistedSchema.omit({
16
16
  entityId: true,
@@ -19,13 +19,11 @@ exports.TranslationItemSchema = exports.TranslationPersistedSchema.omit({
19
19
  });
20
20
  exports.TranslationsArraySchema = zod_1.z
21
21
  .array(exports.TranslationItemSchema)
22
- .min(1, { message: 'translationAtLeastOneMustBeExists' })
22
+ .min(1)
23
23
  .refine(items => {
24
24
  const langs = items.map(item => item.lang);
25
25
  const uniqueLangs = new Set(langs);
26
26
  return langs.length === uniqueLangs.size;
27
- }, {
28
- message: 'duplicateLanguagesNotAllowed',
29
27
  });
30
28
  exports.TranslationsSchema = zod_1.z.object({
31
29
  name: exports.TranslationsArraySchema,
@@ -18,18 +18,12 @@ exports.JsonConditionsSchema = zod_1.z
18
18
  catch {
19
19
  return false;
20
20
  }
21
- }, { message: 'invalidJson' });
21
+ });
22
22
  exports.PermissionPersistedSchema = zod_1.z
23
23
  .object({
24
- id: zod_1.z.string().uuid({ message: 'idInvalidUuid' }),
25
- action: zod_1.z.nativeEnum(common_1.AppAbility.ACTIONS, {
26
- invalid_type_error: 'actionInvalid',
27
- required_error: 'actionRequired',
28
- }),
29
- subject: zod_1.z.nativeEnum(common_1.AppAbility.SUBJECTS, {
30
- invalid_type_error: 'subjectInvalid',
31
- required_error: 'subjectRequired',
32
- }),
24
+ id: zod_1.z.string().uuid(),
25
+ action: zod_1.z.nativeEnum(common_1.AppAbility.ACTIONS),
26
+ subject: zod_1.z.nativeEnum(common_1.AppAbility.SUBJECTS),
33
27
  conditions: exports.JsonConditionsSchema,
34
28
  })
35
29
  .merge(common_1.TimestampSchema);
@@ -8,7 +8,7 @@ export const TranslationPersistedSchema = z.object({
8
8
  entityId: z.string(),
9
9
  lang: LanguageKeysSchema,
10
10
  field: z.enum(TRANSLATABLE_FIELD_VALUES),
11
- text: z.string().min(1, { message: 'translationRequired' }),
11
+ text: z.string().min(1),
12
12
  });
13
13
  export type TTranslationPersisted = z.infer<typeof TranslationPersistedSchema>;
14
14
 
@@ -21,16 +21,16 @@ export type TTranslationItem = z.infer<typeof TranslationItemSchema>;
21
21
 
22
22
  export const TranslationsArraySchema = z
23
23
  .array(TranslationItemSchema)
24
- .min(1, { message: 'translationAtLeastOneMustBeExists' })
24
+ .min(1)
25
25
  .refine(
26
26
  items => {
27
27
  const langs = items.map(item => item.lang);
28
28
  const uniqueLangs = new Set(langs);
29
29
  return langs.length === uniqueLangs.size;
30
30
  },
31
- {
32
- message: 'duplicateLanguagesNotAllowed',
33
- },
31
+ // {
32
+ // message: 'duplicateLanguagesNotAllowed',
33
+ // },
34
34
  );
35
35
  export type TTranslationsArray = z.infer<typeof TranslationsArraySchema>;
36
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-contracts",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -16,21 +16,15 @@ export const JsonConditionsSchema = z
16
16
  return false;
17
17
  }
18
18
  },
19
- { message: 'invalidJson' },
19
+ // { message: 'invalidJson' },
20
20
  );
21
21
 
22
22
  export const PermissionPersistedSchema = z
23
23
  .object({
24
- id: z.string().uuid({ message: 'idInvalidUuid' }),
24
+ id: z.string().uuid(),
25
25
 
26
- action: z.nativeEnum(AppAbility.ACTIONS, {
27
- invalid_type_error: 'actionInvalid',
28
- required_error: 'actionRequired',
29
- }),
30
- subject: z.nativeEnum(AppAbility.SUBJECTS, {
31
- invalid_type_error: 'subjectInvalid',
32
- required_error: 'subjectRequired',
33
- }),
26
+ action: z.nativeEnum(AppAbility.ACTIONS),
27
+ subject: z.nativeEnum(AppAbility.SUBJECTS),
34
28
  conditions: JsonConditionsSchema,
35
29
  })
36
30
  .merge(TimestampSchema);