hh-contracts 0.0.72 → 0.0.74
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/app-menu/get.query.ts +4 -4
- package/build/app-menu/get.query.js +39 -6
- package/build/common/constants/app-statuses.constant.js +25 -0
- package/build/common/constants/{icon-keys.constant.js → icon.constants.js} +8 -1
- package/build/common/constants/index.js +6 -3
- package/build/common/constants/kind-of-app.constant.js +8 -0
- package/build/common/constants/locales.constant.js +3 -3
- package/build/common/constants/slug.constant.js +8 -0
- package/build/common/constants/zod-error-mapping.constant.js +41 -17
- package/build/common/index.js +1 -1
- package/build/common/models/common-query-params.schema.js +4 -1
- package/build/common/models/icon-key.schema.js +35 -2
- package/build/common/models/index.js +2 -1
- package/build/common/models/info.schema.js +37 -4
- package/build/common/models/language-keys.schema.js +35 -2
- package/build/common/models/navigation-item.schemas.js +47 -14
- package/build/common/models/order.schema.js +37 -4
- package/build/common/models/pagination.schema.js +41 -8
- package/build/common/models/search.schema.js +36 -3
- package/build/common/models/slug.schema.js +45 -0
- package/build/common/models/timestamp.schemas.js +38 -5
- package/build/common/models/translations.schemas.js +41 -8
- package/build/common/models/uuid-array.schema.js +38 -0
- package/build/common/transforms/index.js +1 -16
- package/build/common/transforms/navigation-item.transform.js +26 -16
- package/build/common/types/index.js +0 -1
- package/build/companies/company.models.js +45 -0
- package/build/companies/index.js +17 -0
- package/build/hotels/contracts/index.js +1 -1
- package/build/hotels/hotel.model.js +50 -0
- package/build/hotels/hotels.api.js +3 -1
- package/build/hotels/index.js +3 -1
- package/build/hotels/sites/contracts/find-hotel-site-page-by-lang.contract.js +56 -0
- package/build/hotels/sites/contracts/index.js +17 -0
- package/build/hotels/sites/index.js +17 -0
- package/build/hotels/themes/contracts/find-hotel-theme.contract.js +13 -0
- package/build/hotels/themes/contracts/index.js +17 -0
- package/build/hotels/themes/index.js +1 -0
- package/build/hotels/themes/theme.models.js +40 -7
- package/build/index.js +3 -0
- package/build/pages/constants/block-type.constant.js +11 -0
- package/build/pages/constants/cta-actions.constant.js +7 -0
- package/build/pages/constants/hero.constants.js +15 -0
- package/build/pages/constants/image-loading.constant.js +8 -0
- package/build/pages/constants/index.js +21 -0
- package/build/pages/constants/media.constants.js +17 -0
- package/build/pages/index.js +18 -0
- package/build/pages/models/blocks/base-block.schema.js +44 -0
- package/build/pages/models/blocks/block.schemas.js +69 -0
- package/build/pages/models/blocks/cta.schema.js +80 -0
- package/build/pages/models/blocks/hero-block.schema.js +58 -0
- package/build/pages/models/blocks/html-block.schema.js +46 -0
- package/build/pages/models/blocks/index.js +22 -0
- package/build/pages/models/blocks/media.schemas.js +84 -0
- package/build/pages/models/index.js +18 -0
- package/build/pages/models/page.schema.js +62 -0
- package/build/permissions/contracts/find-all-permission.contract.js +35 -2
- package/build/permissions/contracts/find-many-permission.contract.js +41 -5
- package/build/permissions/permission.models.js +41 -8
- package/build/roles/contracts/find-many-roles.contract.js +40 -6
- package/build/roles/role.models.js +44 -11
- package/build/tenants/contracts/index.js +17 -0
- package/build/tenants/contracts/resolve-tenant.contract.js +29 -0
- package/build/tenants/index.js +19 -0
- package/build/tenants/tenant.model.js +51 -0
- package/build/tenants/tenants.api.js +11 -0
- package/build/translate/contracts/batch-translate.contract.js +40 -7
- package/common/constants/app-errors.constant.ts +1 -3
- package/common/constants/app-statuses.constant.ts +26 -0
- package/common/constants/{icon-keys.constant.ts → icon.constants.ts} +9 -1
- package/common/constants/index.ts +6 -3
- package/common/constants/kind-of-app.constant.ts +7 -0
- package/common/constants/locales.constant.ts +1 -1
- package/common/constants/slug.constant.ts +7 -0
- package/common/constants/zod-error-mapping.constant.ts +9 -18
- package/common/index.ts +1 -1
- package/common/models/common-query-params.schema.ts +5 -3
- package/common/models/icon-key.schema.ts +3 -3
- package/common/models/index.ts +2 -1
- package/common/models/info.schema.ts +1 -1
- package/common/models/language-keys.schema.ts +1 -1
- package/common/models/navigation-item.schemas.ts +4 -4
- package/common/models/order.schema.ts +3 -3
- package/common/models/pagination.schema.ts +1 -1
- package/common/models/search.schema.ts +1 -1
- package/common/models/slug.schema.ts +10 -0
- package/common/models/timestamp.schemas.ts +1 -1
- package/common/models/translations.schemas.ts +1 -1
- package/common/models/uuid-array.schema.ts +3 -0
- package/common/transforms/index.ts +1 -1
- package/common/transforms/navigation-item.transform.ts +26 -26
- package/common/types/index.ts +0 -1
- package/companies/company.models.ts +11 -0
- package/companies/index.ts +1 -0
- package/hotels/contracts/find-hotel.contract.ts +1 -0
- package/hotels/contracts/index.ts +1 -1
- package/hotels/hotel.model.ts +16 -0
- package/hotels/hotels.api.ts +3 -1
- package/hotels/index.ts +3 -1
- package/hotels/sites/contracts/find-hotel-site-page-by-lang.contract.ts +26 -0
- package/hotels/sites/contracts/index.ts +1 -0
- package/hotels/sites/index.ts +1 -0
- package/hotels/{contracts/find-theme.contract.ts → themes/contracts/find-hotel-theme.contract.ts} +5 -5
- package/hotels/themes/contracts/index.ts +1 -0
- package/hotels/themes/index.ts +1 -0
- package/hotels/themes/theme.models.ts +3 -3
- package/index.ts +3 -0
- package/package.json +2 -2
- package/pages/constants/block-type.constant.ts +11 -0
- package/pages/constants/cta-actions.constant.ts +5 -0
- package/pages/constants/hero.constants.ts +18 -0
- package/pages/constants/image-loading.constant.ts +8 -0
- package/pages/constants/index.ts +5 -0
- package/pages/constants/media.constants.ts +20 -0
- package/pages/index.ts +2 -0
- package/pages/models/blocks/base-block.schema.ts +11 -0
- package/pages/models/blocks/block.schemas.ts +57 -0
- package/pages/models/blocks/cta.schema.ts +58 -0
- package/pages/models/blocks/hero-block.schema.ts +27 -0
- package/pages/models/blocks/html-block.schema.ts +14 -0
- package/pages/models/blocks/index.ts +6 -0
- package/pages/models/blocks/media.schemas.ts +66 -0
- package/pages/models/index.ts +2 -0
- package/pages/models/page.schema.ts +31 -0
- package/permissions/contracts/create-permission.contract.ts +1 -1
- package/permissions/contracts/delete-permission.contract.ts +1 -1
- package/permissions/contracts/find-all-permission.contract.ts +2 -2
- package/permissions/contracts/find-many-permission.contract.ts +6 -5
- package/permissions/contracts/find-permission.contract.ts +1 -1
- package/permissions/contracts/update-permission.contract.ts +1 -1
- package/permissions/permission.models.ts +5 -5
- package/roles/contracts/create-role.contract.ts +1 -1
- package/roles/contracts/delete-role.contract.ts +1 -1
- package/roles/contracts/find-many-roles.contract.ts +5 -4
- package/roles/contracts/find-role.contract.ts +1 -1
- package/roles/contracts/update-role.contract.ts +1 -1
- package/roles/role.models.ts +5 -5
- package/tenants/contracts/index.ts +1 -0
- package/tenants/contracts/resolve-tenant.contract.ts +32 -0
- package/tenants/index.ts +3 -0
- package/tenants/tenant.model.ts +19 -0
- package/tenants/tenants.api.ts +10 -0
- package/translate/contracts/batch-translate.contract.ts +1 -1
- package/build/common/models/json.schema.js +0 -6
- package/build/hotels/contracts/find-theme.contract.js +0 -13
- package/common/models/json.schema.ts +0 -8
- package/common/types/zod.type.ts +0 -2
- /package/build/{common/types/zod.type.js → hotels/contracts/find-hotel.contract.js} +0 -0
|
@@ -1,7 +1,40 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.FindManyPermissionsContract = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const common_1 = require("../../common");
|
|
6
39
|
const permission_models_1 = require("../permission.models");
|
|
7
40
|
const permissions_api_1 = require("../permissions.api");
|
|
@@ -10,12 +43,15 @@ const BaseQuerySchema = permission_models_1.PermissionListItemSchema.pick({
|
|
|
10
43
|
action: true,
|
|
11
44
|
}).partial();
|
|
12
45
|
const OrderBySchema = permission_models_1.PermissionListItemSchema.keyof();
|
|
13
|
-
const FindManyPermissionsContractRequestSchema = BaseQuerySchema.
|
|
14
|
-
|
|
46
|
+
const FindManyPermissionsContractRequestSchema = BaseQuerySchema.extend({
|
|
47
|
+
...common_1.CommonQueryParamsSchema.shape,
|
|
48
|
+
orderBy: OrderBySchema.optional(),
|
|
49
|
+
});
|
|
50
|
+
const FindManyPermissionsContractResponseSchema = z
|
|
15
51
|
.object({
|
|
16
|
-
permissions:
|
|
52
|
+
permissions: z.array(permission_models_1.PermissionListItemSchema),
|
|
17
53
|
})
|
|
18
|
-
.
|
|
54
|
+
.extend(common_1.PaginationResponseSchema.shape);
|
|
19
55
|
var FindManyPermissionsContract;
|
|
20
56
|
(function (FindManyPermissionsContract) {
|
|
21
57
|
FindManyPermissionsContract.getUrl = permissions_api_1.PERMISSIONS_API.findMany;
|
|
@@ -1,9 +1,42 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.PermissionListItemSchema = exports.PermissionWithTranslationsSchema = exports.PermissionPersistedSchema = exports.JsonConditionsSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const common_1 = require("../common");
|
|
6
|
-
exports.JsonConditionsSchema =
|
|
39
|
+
exports.JsonConditionsSchema = z
|
|
7
40
|
.string()
|
|
8
41
|
.transform(val => (val === '' ? undefined : val))
|
|
9
42
|
.optional()
|
|
@@ -19,19 +52,19 @@ exports.JsonConditionsSchema = zod_1.z
|
|
|
19
52
|
return false;
|
|
20
53
|
}
|
|
21
54
|
}, { params: { translationKey: 'errors.validation.invalidJson' } });
|
|
22
|
-
exports.PermissionPersistedSchema =
|
|
55
|
+
exports.PermissionPersistedSchema = z
|
|
23
56
|
.object({
|
|
24
|
-
id:
|
|
25
|
-
action:
|
|
26
|
-
subject:
|
|
57
|
+
id: z.uuid(),
|
|
58
|
+
action: z.enum(common_1.AppAbility.ACTION_VALUES),
|
|
59
|
+
subject: z.enum(common_1.AppAbility.SUBJECT_VALUES),
|
|
27
60
|
conditions: exports.JsonConditionsSchema,
|
|
28
61
|
})
|
|
29
|
-
.
|
|
62
|
+
.extend(common_1.TimestampSchema.shape);
|
|
30
63
|
exports.PermissionWithTranslationsSchema = exports.PermissionPersistedSchema.extend({
|
|
31
64
|
translations: common_1.TranslationsSchema.pick({ name: true, description: true }).partial({
|
|
32
65
|
description: true,
|
|
33
66
|
}),
|
|
34
67
|
});
|
|
35
68
|
exports.PermissionListItemSchema = exports.PermissionPersistedSchema.extend({
|
|
36
|
-
name:
|
|
69
|
+
name: z.string().nullable(),
|
|
37
70
|
});
|
|
@@ -1,7 +1,40 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.FindManyRolesContract = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const common_1 = require("../../common");
|
|
6
39
|
const role_models_1 = require("../role.models");
|
|
7
40
|
const roles_api_1 = require("../roles.api");
|
|
@@ -9,21 +42,22 @@ const BaseQuerySchema = role_models_1.RoleListItemSchema.pick({
|
|
|
9
42
|
type: true,
|
|
10
43
|
isActive: true,
|
|
11
44
|
})
|
|
12
|
-
.extend({ permissionIds:
|
|
45
|
+
.extend({ permissionIds: z.array(z.uuid()).optional() })
|
|
13
46
|
.partial();
|
|
14
47
|
const OrderBySchema = role_models_1.RoleListItemSchema.omit({
|
|
15
48
|
id: true,
|
|
16
49
|
permissions: true,
|
|
17
50
|
description: true,
|
|
18
51
|
}).keyof();
|
|
19
|
-
const FindManyRolesContractRequestSchema = BaseQuerySchema.
|
|
52
|
+
const FindManyRolesContractRequestSchema = BaseQuerySchema.extend({
|
|
53
|
+
...common_1.CommonQueryParamsSchema.shape,
|
|
20
54
|
orderBy: OrderBySchema.optional(),
|
|
21
55
|
});
|
|
22
|
-
const FindManyRolesContractResponseSchema =
|
|
56
|
+
const FindManyRolesContractResponseSchema = z
|
|
23
57
|
.object({
|
|
24
|
-
roles:
|
|
58
|
+
roles: z.array(role_models_1.RoleListItemSchema),
|
|
25
59
|
})
|
|
26
|
-
.
|
|
60
|
+
.extend(common_1.PaginationResponseSchema.shape);
|
|
27
61
|
var FindManyRolesContract;
|
|
28
62
|
(function (FindManyRolesContract) {
|
|
29
63
|
FindManyRolesContract.getUrl = roles_api_1.ROLES_API.findMany;
|
|
@@ -1,19 +1,52 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.RoleListItemSchema = exports.RoleWithTranslationsSchema = exports.RoleWithPermissionsSchema = exports.RolePersistedSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const common_1 = require("../common");
|
|
6
39
|
const permissions_1 = require("../permissions");
|
|
7
|
-
exports.RolePersistedSchema =
|
|
40
|
+
exports.RolePersistedSchema = z
|
|
8
41
|
.object({
|
|
9
|
-
id:
|
|
10
|
-
type:
|
|
11
|
-
isActive:
|
|
12
|
-
isDefault:
|
|
42
|
+
id: z.uuid(),
|
|
43
|
+
type: z.enum(common_1.ROLE_TYPE_VALUES),
|
|
44
|
+
isActive: z.boolean().default(true),
|
|
45
|
+
isDefault: z.boolean().default(false),
|
|
13
46
|
})
|
|
14
|
-
.
|
|
47
|
+
.extend(common_1.TimestampSchema.shape);
|
|
15
48
|
exports.RoleWithPermissionsSchema = exports.RolePersistedSchema.extend({
|
|
16
|
-
permissionIds:
|
|
49
|
+
permissionIds: common_1.UuidArraySchema.optional(),
|
|
17
50
|
});
|
|
18
51
|
exports.RoleWithTranslationsSchema = exports.RoleWithPermissionsSchema.extend({
|
|
19
52
|
translations: common_1.TranslationsSchema.pick({
|
|
@@ -22,9 +55,9 @@ exports.RoleWithTranslationsSchema = exports.RoleWithPermissionsSchema.extend({
|
|
|
22
55
|
}).partial({ description: true }),
|
|
23
56
|
});
|
|
24
57
|
exports.RoleListItemSchema = exports.RolePersistedSchema.extend({
|
|
25
|
-
name:
|
|
26
|
-
description:
|
|
27
|
-
permissions:
|
|
58
|
+
name: z.string().nullable(),
|
|
59
|
+
description: z.string().nullable(),
|
|
60
|
+
permissions: z.array(permissions_1.PermissionListItemSchema.pick({
|
|
28
61
|
id: true,
|
|
29
62
|
name: true,
|
|
30
63
|
})),
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./resolve-tenant.contract"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResolveTenantContract = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
5
|
+
const tenants_api_1 = require("../tenants.api");
|
|
6
|
+
const tenant_model_1 = require("../tenant.model");
|
|
7
|
+
const hotels_1 = require("../../hotels");
|
|
8
|
+
const ResolveTenantRequestSchema = tenant_model_1.TenantPersistedSchema.pick({ host: true });
|
|
9
|
+
const ResolveTenantResponseSchema = tenant_model_1.TenantPersistedSchema.omit({
|
|
10
|
+
id: true,
|
|
11
|
+
createdAt: true,
|
|
12
|
+
updatedAt: true,
|
|
13
|
+
}).extend({
|
|
14
|
+
...hotels_1.HotelPersistedSchema.pick({
|
|
15
|
+
slug: true,
|
|
16
|
+
hasServices: true,
|
|
17
|
+
defaultLang: true,
|
|
18
|
+
availableLangs: true,
|
|
19
|
+
}).shape,
|
|
20
|
+
canonical: tenant_model_1.CanonicalSchema.nullable().optional(),
|
|
21
|
+
});
|
|
22
|
+
var ResolveTenantContract;
|
|
23
|
+
(function (ResolveTenantContract) {
|
|
24
|
+
ResolveTenantContract.getUrl = tenants_api_1.TENANTS_API.resolve;
|
|
25
|
+
ResolveTenantContract.endpoint = tenants_api_1.TENANTS_CONTROLLER.endpoints.resolve;
|
|
26
|
+
ResolveTenantContract.httpMethod = common_1.HTTP_METHODS.get;
|
|
27
|
+
ResolveTenantContract.RequestSchema = ResolveTenantRequestSchema;
|
|
28
|
+
ResolveTenantContract.ResponseSchema = ResolveTenantResponseSchema;
|
|
29
|
+
})(ResolveTenantContract || (exports.ResolveTenantContract = ResolveTenantContract = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./contracts"), exports);
|
|
18
|
+
__exportStar(require("./tenant.model"), exports);
|
|
19
|
+
__exportStar(require("./tenants.api"), exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
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.CanonicalSchema = exports.TenantPersistedSchema = void 0;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
const common_1 = require("../common");
|
|
39
|
+
exports.TenantPersistedSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
id: z.uuid(),
|
|
42
|
+
hotelId: z.uuid(),
|
|
43
|
+
host: z.string().trim().toLowerCase().min(3),
|
|
44
|
+
kindOfApp: z.enum(common_1.KIND_OF_APP_VALUES),
|
|
45
|
+
isPrimary: z.boolean(),
|
|
46
|
+
})
|
|
47
|
+
.extend(common_1.TimestampSchema.shape);
|
|
48
|
+
exports.CanonicalSchema = z.object({
|
|
49
|
+
site: z.string().nullable(),
|
|
50
|
+
services: z.string().nullable(),
|
|
51
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TENANTS_API = exports.TENANTS_CONTROLLER = void 0;
|
|
4
|
+
const utils_1 = require("../common/utils");
|
|
5
|
+
exports.TENANTS_CONTROLLER = {
|
|
6
|
+
prefix: 'tenants',
|
|
7
|
+
endpoints: {
|
|
8
|
+
resolve: 'resolve',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
exports.TENANTS_API = (0, utils_1.createApi)(exports.TENANTS_CONTROLLER);
|
|
@@ -1,18 +1,51 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.BatchTranslateContract = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const common_1 = require("../../common");
|
|
6
39
|
const translate_api_1 = require("../translate.api");
|
|
7
|
-
const BatchTranslateContractRequestSchema =
|
|
8
|
-
text:
|
|
40
|
+
const BatchTranslateContractRequestSchema = z.object({
|
|
41
|
+
text: z.string().min(1),
|
|
9
42
|
fromLang: common_1.LanguageKeysSchema,
|
|
10
|
-
toLangs:
|
|
43
|
+
toLangs: z.array(common_1.LanguageKeysSchema).min(1),
|
|
11
44
|
});
|
|
12
|
-
const TranslationsSchema =
|
|
13
|
-
.object(Object.fromEntries(common_1.LANGUAGE_KEYS.map(l => [l,
|
|
45
|
+
const TranslationsSchema = z
|
|
46
|
+
.object(Object.fromEntries(common_1.LANGUAGE_KEYS.map(l => [l, z.string().min(1).nullable()])))
|
|
14
47
|
.partial();
|
|
15
|
-
const BatchTranslateContractResponseSchema =
|
|
48
|
+
const BatchTranslateContractResponseSchema = z.object({
|
|
16
49
|
translations: TranslationsSchema,
|
|
17
50
|
});
|
|
18
51
|
var BatchTranslateContract;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { TZodErorrKey } from './zod-error-mapping.constant';
|
|
2
|
-
|
|
3
1
|
export const APP_ERRORS = {
|
|
4
2
|
common: {
|
|
5
3
|
validation: {
|
|
@@ -174,7 +172,7 @@ export type TMappedErrors<T extends Record<string, unknown>> = {
|
|
|
174
172
|
}[keyof T];
|
|
175
173
|
export type TAppError = TMappedErrors<typeof APP_ERRORS>;
|
|
176
174
|
export type TAppErrorCode = TAppError['code'];
|
|
177
|
-
export type TAppErrorMessageKey = TAppError['messageKey']
|
|
175
|
+
export type TAppErrorMessageKey = TAppError['messageKey'];
|
|
178
176
|
|
|
179
177
|
// type StringLeafPaths<T, K extends keyof T = keyof T> = K extends string
|
|
180
178
|
// ? T[K] extends string
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export namespace AppStatuses {
|
|
2
|
+
export const COMMON = {
|
|
3
|
+
active: 'active',
|
|
4
|
+
disabled: 'disabled',
|
|
5
|
+
} as const;
|
|
6
|
+
export type TCommon = (typeof COMMON)[keyof typeof COMMON];
|
|
7
|
+
export const COMMON_VALUES = Object.values(COMMON) as [TCommon];
|
|
8
|
+
|
|
9
|
+
export const HOTEL = {
|
|
10
|
+
...COMMON,
|
|
11
|
+
pending: 'pending',
|
|
12
|
+
maintenance: 'maintenance',
|
|
13
|
+
archived: 'archived',
|
|
14
|
+
} as const;
|
|
15
|
+
export type THotel = (typeof HOTEL)[keyof typeof HOTEL];
|
|
16
|
+
export const HOTEL_VALUES = Object.values(HOTEL) as [THotel];
|
|
17
|
+
|
|
18
|
+
export const PAGE = {
|
|
19
|
+
...COMMON,
|
|
20
|
+
draft: 'draft',
|
|
21
|
+
scheduled: 'scheduled',
|
|
22
|
+
archived: 'archived',
|
|
23
|
+
} as const;
|
|
24
|
+
export type TPage = (typeof PAGE)[keyof typeof PAGE];
|
|
25
|
+
export const PAGE_VALUES = Object.values(PAGE) as [TPage];
|
|
26
|
+
}
|
|
@@ -20,6 +20,7 @@ export const ICON_KEYS = {
|
|
|
20
20
|
search: 'search',
|
|
21
21
|
language: 'language',
|
|
22
22
|
magic: 'magic',
|
|
23
|
+
play: 'play',
|
|
23
24
|
// close: 'close',
|
|
24
25
|
// check: 'check',
|
|
25
26
|
|
|
@@ -28,5 +29,12 @@ export const ICON_KEYS = {
|
|
|
28
29
|
flagGB: 'flagGB',
|
|
29
30
|
flagRU: 'flagRU',
|
|
30
31
|
} as const;
|
|
31
|
-
|
|
32
32
|
export type TIconKey = (typeof ICON_KEYS)[keyof typeof ICON_KEYS];
|
|
33
|
+
export const ICON_KEY_VALUES = Object.values(ICON_KEYS) as [TIconKey];
|
|
34
|
+
|
|
35
|
+
export const ICON_POSITION = {
|
|
36
|
+
start: 'start',
|
|
37
|
+
end: 'end',
|
|
38
|
+
} as const;
|
|
39
|
+
export type TIconPosition = (typeof ICON_POSITION)[keyof typeof ICON_POSITION];
|
|
40
|
+
export const ICON_POSITION_VALUES = Object.values(ICON_POSITION) as [TIconPosition];
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
export * from './app-ability.constant';
|
|
2
2
|
export * from './app-errors.constant';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './app-statuses.constant';
|
|
4
4
|
export * from './default-pagination-config.constant';
|
|
5
|
-
export * from './http-method.constant';
|
|
6
|
-
export * from './icon-keys.constant';
|
|
7
5
|
export * from './entity.constant';
|
|
6
|
+
export * from './http-method.constant';
|
|
7
|
+
export * from './icon.constants';
|
|
8
|
+
export * from './kind-of-app.constant';
|
|
9
|
+
export * from './locales.constant';
|
|
8
10
|
export * from './navigation-item-type.constant';
|
|
9
11
|
export * from './order-direction.constant';
|
|
10
12
|
export * from './role-types.constant';
|
|
11
13
|
export * from './route-component-key.constants';
|
|
14
|
+
export * from './slug.constant';
|
|
12
15
|
export * from './translatable-field.constant';
|
|
13
16
|
export * from './zod-error-mapping.constant';
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod';
|
|
2
2
|
|
|
3
3
|
export const ZOD_ERROR_MAPPING = {
|
|
4
|
-
[ZodIssueCode.invalid_type]: 'errors.validation.invalidType',
|
|
5
|
-
[ZodIssueCode.
|
|
6
|
-
[ZodIssueCode.
|
|
7
|
-
[ZodIssueCode.
|
|
8
|
-
[ZodIssueCode.
|
|
9
|
-
[ZodIssueCode.
|
|
10
|
-
[ZodIssueCode.
|
|
11
|
-
|
|
12
|
-
[ZodIssueCode.invalid_return_type]: 'errors.validation.invalidReturnType',
|
|
13
|
-
[ZodIssueCode.invalid_date]: 'errors.validation.invalidDate',
|
|
14
|
-
[ZodIssueCode.invalid_string]: 'errors.validation.invalidString',
|
|
15
|
-
[ZodIssueCode.too_small]: 'errors.validation.tooSmall',
|
|
16
|
-
[ZodIssueCode.too_big]: 'errors.validation.tooBig',
|
|
17
|
-
[ZodIssueCode.invalid_intersection_types]: 'errors.validation.invalidIntersectionTypes',
|
|
18
|
-
[ZodIssueCode.not_multiple_of]: 'errors.validation.notMultipleOf',
|
|
19
|
-
[ZodIssueCode.not_finite]: 'errors.validation.notFinite',
|
|
20
|
-
} as const satisfies Record<ZodIssueCode, string>;
|
|
4
|
+
[z.ZodIssueCode.invalid_type]: 'errors.validation.invalidType',
|
|
5
|
+
[z.ZodIssueCode.custom]: 'errors.validation.custom',
|
|
6
|
+
[z.ZodIssueCode.invalid_union]: 'errors.validation.invalidUnion',
|
|
7
|
+
[z.ZodIssueCode.unrecognized_keys]: 'errors.validation.unrecognizedKeys',
|
|
8
|
+
[z.ZodIssueCode.too_small]: 'errors.validation.tooSmall',
|
|
9
|
+
[z.ZodIssueCode.too_big]: 'errors.validation.tooBig',
|
|
10
|
+
[z.ZodIssueCode.not_multiple_of]: 'errors.validation.notMultipleOf',
|
|
11
|
+
};
|
|
21
12
|
|
|
22
13
|
export type TZodErorrKey = (typeof ZOD_ERROR_MAPPING)[keyof typeof ZOD_ERROR_MAPPING];
|
package/common/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod';
|
|
2
2
|
import { OrderSchema } from './order.schema';
|
|
3
3
|
import { PaginationRequestSchema } from './pagination.schema';
|
|
4
4
|
import { SearchSchema } from './search.schema';
|
|
5
5
|
|
|
6
|
-
export const CommonQueryParamsSchema =
|
|
7
|
-
|
|
6
|
+
export const CommonQueryParamsSchema = OrderSchema.extend({
|
|
7
|
+
...SearchSchema.shape,
|
|
8
|
+
...PaginationRequestSchema.shape,
|
|
9
|
+
});
|
|
8
10
|
export type TCommonQueryParams = z.infer<typeof CommonQueryParamsSchema>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { ICON_KEY_VALUES } from '../constants';
|
|
3
3
|
|
|
4
|
-
export const IconKeySchema = z.
|
|
4
|
+
export const IconKeySchema = z.enum(ICON_KEY_VALUES);
|