hh-contracts 0.0.1 → 0.0.3

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.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavigationItemType = void 0;
4
- exports.NavigationItemType = {
3
+ exports.NavigationItemTypes = void 0;
4
+ exports.NavigationItemTypes = {
5
5
  section: 'section',
6
6
  group: 'group',
7
- navLink: 'navLink',
7
+ link: 'link',
8
8
  };
@@ -7,7 +7,7 @@ const GetAppMenuQueryRequestSchema = zod_1.z.object({
7
7
  userUuid: zod_1.z.string().uuid(),
8
8
  });
9
9
  const GetAppMenuQueryResponseSchema = zod_1.z.object({
10
- appMenu: zod_1.z.array(models_1.NavigationItemSchema),
10
+ appMenu: zod_1.z.array(models_1.NavigationBaseSchema),
11
11
  });
12
12
  var GetAppMenuQuery;
13
13
  (function (GetAppMenuQuery) {
@@ -1,19 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavigationItemSchema = void 0;
3
+ exports.NavigationBaseSchema = exports.NavigationItemEntityWithChildrenSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../constants");
6
6
  const constants_2 = require("../constants");
7
- const NavigationItemBaseSchema = zod_1.z.object({
7
+ const NavigationItemEntitySchema = zod_1.z.object({
8
8
  id: zod_1.z.number().int().positive(),
9
+ parentId: zod_1.z.nullable(zod_1.z.number().int().positive()),
9
10
  label: zod_1.z.string().min(1),
10
- icon: zod_1.z.nullable(zod_1.z.nativeEnum(constants_1.IconKeys)),
11
+ description: zod_1.z.nullable(zod_1.z.string().min(1)),
12
+ iconKey: zod_1.z.nullable(zod_1.z.nativeEnum(constants_1.IconKeys)),
11
13
  link: zod_1.z.nullable(zod_1.z.string().min(1)),
12
- routeComponent: zod_1.z.nullable(zod_1.z.nativeEnum(constants_1.RouteComponentKeys)),
13
- type: zod_1.z.nativeEnum(constants_2.NavigationItemType),
14
+ routeComponentKey: zod_1.z.nullable(zod_1.z.nativeEnum(constants_1.RouteComponentKeys)),
15
+ type: zod_1.z.nativeEnum(constants_2.NavigationItemTypes),
14
16
  disabled: zod_1.z.boolean().default(false),
15
- tooltip: zod_1.z.nullable(zod_1.z.string().min(1)),
17
+ order: zod_1.z.number().int().positive(),
16
18
  });
17
- exports.NavigationItemSchema = NavigationItemBaseSchema.extend({
18
- children: zod_1.z.array(NavigationItemBaseSchema).optional(),
19
+ exports.NavigationItemEntityWithChildrenSchema = NavigationItemEntitySchema.extend({
20
+ children: zod_1.z.array(NavigationItemEntitySchema).optional(),
19
21
  });
22
+ exports.NavigationBaseSchema = exports.NavigationItemEntityWithChildrenSchema.omit({
23
+ parentId: true,
24
+ order: true,
25
+ }).partial({ description: true, link: true, iconKey: true, routeComponentKey: true });
@@ -3,4 +3,4 @@ export const IconKeys = {
3
3
  EyeSlashIcon: 'EyeSlashIcon',
4
4
  } as const;
5
5
 
6
- export type TIconKeys = (typeof IconKeys)[keyof typeof IconKeys];
6
+ export type TIconKey = (typeof IconKeys)[keyof typeof IconKeys];
@@ -1,6 +1,6 @@
1
- export const NavigationItemType = {
1
+ export const NavigationItemTypes = {
2
2
  section: 'section',
3
3
  group: 'group',
4
- navLink: 'navLink',
4
+ link: 'link',
5
5
  } as const;
6
- export type TNavigationItemType = (typeof NavigationItemType)[keyof typeof NavigationItemType];
6
+ export type TNavigationItemType = (typeof NavigationItemTypes)[keyof typeof NavigationItemTypes];
@@ -2,4 +2,4 @@ export const RouteComponentKeys = {
2
2
  NavigationItem: 'navigation-item',
3
3
  } as const;
4
4
 
5
- export type TRouteComponentKeys = (typeof RouteComponentKeys)[keyof typeof RouteComponentKeys];
5
+ export type TRouteComponentKey = (typeof RouteComponentKeys)[keyof typeof RouteComponentKeys];
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { NavigationItemSchema } from '../../models';
2
+ import { NavigationBaseSchema } from '../../models';
3
3
 
4
4
  const GetAppMenuQueryRequestSchema = z.object({
5
5
  userUuid: z.string().uuid(),
6
6
  });
7
7
  const GetAppMenuQueryResponseSchema = z.object({
8
- appMenu: z.array(NavigationItemSchema),
8
+ appMenu: z.array(NavigationBaseSchema),
9
9
  });
10
10
 
11
11
  export namespace GetAppMenuQuery {
@@ -1,20 +1,29 @@
1
1
  import { z } from 'zod';
2
2
  import { IconKeys, RouteComponentKeys } from '../constants';
3
- import { NavigationItemType } from '../constants';
3
+ import { NavigationItemTypes } from '../constants';
4
4
 
5
- const NavigationItemBaseSchema = z.object({
5
+ const NavigationItemEntitySchema = z.object({
6
6
  id: z.number().int().positive(),
7
+ parentId: z.nullable(z.number().int().positive()),
7
8
  label: z.string().min(1),
8
- icon: z.nullable(z.nativeEnum(IconKeys)),
9
+ description: z.nullable(z.string().min(1)),
10
+ iconKey: z.nullable(z.nativeEnum(IconKeys)),
9
11
  link: z.nullable(z.string().min(1)),
10
- routeComponent: z.nullable(z.nativeEnum(RouteComponentKeys)),
11
- type: z.nativeEnum(NavigationItemType),
12
+ routeComponentKey: z.nullable(z.nativeEnum(RouteComponentKeys)),
13
+ type: z.nativeEnum(NavigationItemTypes),
12
14
  disabled: z.boolean().default(false),
13
- tooltip: z.nullable(z.string().min(1)),
15
+ order: z.number().int().positive(),
14
16
  });
15
17
 
16
- export const NavigationItemSchema = NavigationItemBaseSchema.extend({
17
- children: z.array(NavigationItemBaseSchema).optional(),
18
+ export const NavigationItemEntityWithChildrenSchema = NavigationItemEntitySchema.extend({
19
+ children: z.array(NavigationItemEntitySchema).optional(),
18
20
  });
19
21
 
20
- export type TNavigationItem = z.infer<typeof NavigationItemSchema>;
22
+ export const NavigationBaseSchema = NavigationItemEntityWithChildrenSchema.omit({
23
+ parentId: true,
24
+ order: true,
25
+ }).partial({ description: true, link: true, iconKey: true, routeComponentKey: true });
26
+
27
+ export type TNavigationItemEntity = z.infer<typeof NavigationItemEntitySchema>;
28
+ export type TNavigationItemWithChildren = z.infer<typeof NavigationItemEntityWithChildrenSchema>;
29
+ export type TNavigationBase = z.infer<typeof NavigationBaseSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-contracts",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {