hh-contracts 0.0.105 → 0.0.106
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.
- package/build/common/constants/array-splitter.constant.js +4 -0
- package/build/common/constants/icon.constants.js +1 -0
- package/build/common/constants/index.js +1 -0
- package/build/common/models/boolean-query-param.schema.js +0 -6
- package/build/common/models/uuid.schemas.js +5 -1
- package/build/roles/contracts/find-many-roles.contract.js +1 -1
- package/common/constants/array-splitter.constant.ts +1 -0
- package/common/constants/icon.constants.ts +1 -0
- package/common/constants/index.ts +1 -0
- package/common/models/boolean-query-param.schema.ts +0 -7
- package/common/models/uuid.schemas.ts +5 -0
- package/package.json +1 -1
- package/roles/contracts/find-many-roles.contract.ts +3 -2
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./app-ability.constant"), exports);
|
|
18
|
+
__exportStar(require("./array-splitter.constant"), exports);
|
|
18
19
|
__exportStar(require("./app-errors.constant"), exports);
|
|
19
20
|
__exportStar(require("./app-statuses.constant"), exports);
|
|
20
21
|
__exportStar(require("./default-pagination-config.constant"), exports);
|
|
@@ -35,12 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.BooleanQueryParamSchema = void 0;
|
|
37
37
|
const z = __importStar(require("zod"));
|
|
38
|
-
// export const BooleanQueryParamSchema = z
|
|
39
|
-
// .union([z.boolean(), z.enum(['true', 'false', '1', '0', 'yes', 'no'])])
|
|
40
|
-
// .transform(value => {
|
|
41
|
-
// if (typeof value === 'boolean') return value;
|
|
42
|
-
// return value === 'true' || value === '1' || value === 'yes';
|
|
43
|
-
// });
|
|
44
38
|
exports.BooleanQueryParamSchema = z.union([z.boolean(), z.string()]).transform(value => {
|
|
45
39
|
if (typeof value === 'boolean')
|
|
46
40
|
return value;
|
|
@@ -33,7 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.UuidArraySchema = exports.UuidSchema = void 0;
|
|
36
|
+
exports.UuidArrayQueryParamSchema = exports.UuidArraySchema = exports.UuidSchema = void 0;
|
|
37
37
|
const z = __importStar(require("zod"));
|
|
38
|
+
const constants_1 = require("../constants");
|
|
38
39
|
exports.UuidSchema = z.uuid();
|
|
39
40
|
exports.UuidArraySchema = z.array(exports.UuidSchema);
|
|
41
|
+
exports.UuidArrayQueryParamSchema = z
|
|
42
|
+
.union([z.string().transform(val => (val ? val.split(constants_1.ARRAY_SPLITTER) : [])), z.array(z.string())])
|
|
43
|
+
.pipe(exports.UuidArraySchema);
|
|
@@ -43,7 +43,7 @@ const BaseQuerySchema = role_models_1.RoleListItemSchema.pick({
|
|
|
43
43
|
})
|
|
44
44
|
.extend({
|
|
45
45
|
isActive: common_1.BooleanQueryParamSchema.optional(),
|
|
46
|
-
permissionIds: common_1.
|
|
46
|
+
permissionIds: common_1.UuidArrayQueryParamSchema.optional(),
|
|
47
47
|
})
|
|
48
48
|
.partial();
|
|
49
49
|
const OrderBySchema = role_models_1.RoleListItemSchema.omit({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ARRAY_SPLITTER = ',';
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
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
|
-
// });
|
|
9
|
-
|
|
10
3
|
export const BooleanQueryParamSchema = z.union([z.boolean(), z.string()]).transform(value => {
|
|
11
4
|
if (typeof value === 'boolean') return value;
|
|
12
5
|
const v = value.trim().toLowerCase();
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
+
import { ARRAY_SPLITTER } from '../constants';
|
|
2
3
|
|
|
3
4
|
export const UuidSchema = z.uuid();
|
|
4
5
|
export const UuidArraySchema = z.array(UuidSchema);
|
|
6
|
+
|
|
7
|
+
export const UuidArrayQueryParamSchema = z
|
|
8
|
+
.union([z.string().transform(val => (val ? val.split(ARRAY_SPLITTER) : [])), z.array(z.string())])
|
|
9
|
+
.pipe(UuidArraySchema);
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
PaginationResponseSchema,
|
|
6
6
|
UuidArraySchema,
|
|
7
7
|
BooleanQueryParamSchema,
|
|
8
|
+
UuidArrayQueryParamSchema,
|
|
8
9
|
} from '../../common';
|
|
9
10
|
import { RoleListItemSchema } from '../role.models';
|
|
10
11
|
import { ROLES_API, ROLES_CONTROLLER } from '../roles.api';
|
|
@@ -14,7 +15,7 @@ const BaseQuerySchema = RoleListItemSchema.pick({
|
|
|
14
15
|
})
|
|
15
16
|
.extend({
|
|
16
17
|
isActive: BooleanQueryParamSchema.optional(),
|
|
17
|
-
permissionIds:
|
|
18
|
+
permissionIds: UuidArrayQueryParamSchema.optional(),
|
|
18
19
|
})
|
|
19
20
|
.partial();
|
|
20
21
|
|
|
@@ -41,7 +42,7 @@ export namespace FindManyRolesContract {
|
|
|
41
42
|
export const httpMethod = HTTP_METHODS.get;
|
|
42
43
|
|
|
43
44
|
export const BaseFilterSchema = BaseQuerySchema;
|
|
44
|
-
export type TBaseFilter = z.
|
|
45
|
+
export type TBaseFilter = z.input<typeof BaseFilterSchema>;
|
|
45
46
|
|
|
46
47
|
export const SORTING_KEYS = OrderBySchema.options;
|
|
47
48
|
export type TSortingKey = z.infer<typeof OrderBySchema>;
|