hh-contracts 0.0.100 → 0.0.102

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.
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BooleanQueryParamSchema = void 0;
37
+ const z = __importStar(require("zod"));
38
+ exports.BooleanQueryParamSchema = z
39
+ .union([z.boolean(), z.enum(['true', 'false', '1', '0', 'yes', 'no'])])
40
+ .transform(value => {
41
+ if (typeof value === 'boolean')
42
+ return value;
43
+ return value === 'true' || value === '1' || value === 'yes';
44
+ });
@@ -14,6 +14,7 @@ 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("./boolean-query-param.schema"), exports);
17
18
  __exportStar(require("./common-query-params.schema"), exports);
18
19
  __exportStar(require("./icon-key.schema"), exports);
19
20
  __exportStar(require("./info.schema"), exports);
@@ -42,7 +42,7 @@ const BaseQuerySchema = permission_models_1.PermissionListItemSchema.pick({
42
42
  subject: true,
43
43
  action: true,
44
44
  }).partial();
45
- const OrderBySchema = permission_models_1.PermissionListItemSchema.keyof();
45
+ const OrderBySchema = permission_models_1.PermissionListItemSchema.omit({ conditions: true }).keyof();
46
46
  const FindManyPermissionsContractRequestSchema = BaseQuerySchema.extend({
47
47
  ...common_1.CommonQueryParamsSchema.shape,
48
48
  orderBy: OrderBySchema.optional(),
@@ -40,9 +40,11 @@ const role_models_1 = require("../role.models");
40
40
  const roles_api_1 = require("../roles.api");
41
41
  const BaseQuerySchema = role_models_1.RoleListItemSchema.pick({
42
42
  type: true,
43
- isActive: true,
44
43
  })
45
- .extend({ permissionIds: z.array(z.uuid()).optional() })
44
+ .extend({
45
+ isActive: common_1.BooleanQueryParamSchema.optional(),
46
+ permissionIds: common_1.UuidArraySchema.optional(),
47
+ })
46
48
  .partial();
47
49
  const OrderBySchema = role_models_1.RoleListItemSchema.omit({
48
50
  id: true,
@@ -0,0 +1,8 @@
1
+ import * as z from 'zod';
2
+
3
+ export const BooleanQueryParamSchema = z
4
+ .union([z.boolean(), z.enum(['true', 'false', '1', '0', 'yes', 'no'])])
5
+ .transform(value => {
6
+ if (typeof value === 'boolean') return value;
7
+ return value === 'true' || value === '1' || value === 'yes';
8
+ });
@@ -1,3 +1,4 @@
1
+ export * from './boolean-query-param.schema';
1
2
  export * from './common-query-params.schema';
2
3
  export * from './icon-key.schema';
3
4
  export * from './info.schema';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-contracts",
3
- "version": "0.0.100",
3
+ "version": "0.0.102",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@ const BaseQuerySchema = PermissionListItemSchema.pick({
8
8
  action: true,
9
9
  }).partial();
10
10
 
11
- const OrderBySchema = PermissionListItemSchema.keyof();
11
+ const OrderBySchema = PermissionListItemSchema.omit({ conditions: true }).keyof();
12
12
 
13
13
  const FindManyPermissionsContractRequestSchema = BaseQuerySchema.extend({
14
14
  ...CommonQueryParamsSchema.shape,
@@ -1,13 +1,21 @@
1
1
  import * as z from 'zod';
2
- import { HTTP_METHODS, CommonQueryParamsSchema, PaginationResponseSchema } from '../../common';
2
+ import {
3
+ HTTP_METHODS,
4
+ CommonQueryParamsSchema,
5
+ PaginationResponseSchema,
6
+ UuidArraySchema,
7
+ BooleanQueryParamSchema,
8
+ } from '../../common';
3
9
  import { RoleListItemSchema } from '../role.models';
4
10
  import { ROLES_API, ROLES_CONTROLLER } from '../roles.api';
5
11
 
6
12
  const BaseQuerySchema = RoleListItemSchema.pick({
7
13
  type: true,
8
- isActive: true,
9
14
  })
10
- .extend({ permissionIds: z.array(z.uuid()).optional() })
15
+ .extend({
16
+ isActive: BooleanQueryParamSchema.optional(),
17
+ permissionIds: UuidArraySchema.optional(),
18
+ })
11
19
  .partial();
12
20
 
13
21
  const OrderBySchema = RoleListItemSchema.omit({