@revolugo/common 7.1.1-alpha.2 → 7.1.1-alpha.20
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/package.json +8 -8
- package/src/constants/hotel-room-offer.ts +0 -5
- package/src/constants/poller.ts +2 -0
- package/src/countries/index.ts +1 -0
- package/src/currencies/utils.ts +8 -7
- package/src/models/paginated-queries.ts +2 -2
- package/src/schemas/booking-policy.ts +2 -2
- package/src/schemas/breakfast.ts +33 -0
- package/src/schemas/currency.ts +2 -0
- package/src/schemas/global.ts +1 -20
- package/src/schemas/hotel-room-offer.ts +11 -24
- package/src/schemas/index.ts +1 -0
- package/src/types/elements/index.ts +1 -1
- package/src/utils/case-transformers.ts +1 -1
- package/src/utils/dayjs.ts +2 -2
package/package.json
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolugo/common",
|
|
3
|
-
"version": "7.1.1-alpha.
|
|
3
|
+
"version": "7.1.1-alpha.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Revolugo common",
|
|
6
6
|
"author": "Revolugo",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"engines": {
|
|
9
|
-
"node": ">=20.18.1 <25"
|
|
10
|
-
},
|
|
11
|
-
"volta": {
|
|
12
|
-
"extends": "../../package.json"
|
|
13
|
-
},
|
|
14
7
|
"files": [
|
|
15
8
|
"src"
|
|
16
9
|
],
|
|
10
|
+
"type": "module",
|
|
17
11
|
"exports": {
|
|
18
12
|
"./amenities": "./src/amenities/index.ts",
|
|
19
13
|
"./cancellation-policies": "./src/cancellation-policies.ts",
|
|
@@ -38,6 +32,12 @@
|
|
|
38
32
|
"uuid": "13.0.0",
|
|
39
33
|
"zod": "4.3.6"
|
|
40
34
|
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=20.18.1 <25"
|
|
37
|
+
},
|
|
38
|
+
"volta": {
|
|
39
|
+
"extends": "../../package.json"
|
|
40
|
+
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"test": "vitest"
|
|
43
43
|
}
|
package/src/constants/poller.ts
CHANGED
package/src/countries/index.ts
CHANGED
package/src/currencies/utils.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CURRENCIES } from './currencies.ts'
|
|
2
2
|
|
|
3
3
|
import type { CurrencyCode } from './constants.ts'
|
|
4
|
+
import type { CurrencyType } from '../types/index.ts'
|
|
4
5
|
|
|
5
|
-
export function getCurrencySymbol(currency:
|
|
6
|
+
export function getCurrencySymbol(currency: CurrencyType): string {
|
|
6
7
|
const symbol = CURRENCIES[currency]?.symbol
|
|
7
8
|
|
|
8
9
|
if (!symbol) {
|
|
@@ -12,7 +13,7 @@ export function getCurrencySymbol(currency: CurrencyCode): string {
|
|
|
12
13
|
return symbol
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export function isZeroDecimal(currency:
|
|
16
|
+
export function isZeroDecimal(currency: CurrencyType): boolean {
|
|
16
17
|
return (CURRENCIES[currency] && CURRENCIES[currency].zeroDecimal) || false
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -27,7 +28,7 @@ export function normalizeAmount({
|
|
|
27
28
|
currency,
|
|
28
29
|
}: {
|
|
29
30
|
amount: number
|
|
30
|
-
currency:
|
|
31
|
+
currency: CurrencyType
|
|
31
32
|
}): number {
|
|
32
33
|
if (isZeroDecimal(currency)) {
|
|
33
34
|
return amount
|
|
@@ -41,7 +42,7 @@ export function denormalizeAmount({
|
|
|
41
42
|
currency,
|
|
42
43
|
}: {
|
|
43
44
|
amount: number
|
|
44
|
-
currency:
|
|
45
|
+
currency: CurrencyType
|
|
45
46
|
}): number {
|
|
46
47
|
if (isZeroDecimal(currency)) {
|
|
47
48
|
return amount
|
|
@@ -81,7 +82,7 @@ export function formatAmount({
|
|
|
81
82
|
|
|
82
83
|
export class MoneyCalculator {
|
|
83
84
|
private amount: number
|
|
84
|
-
private currency:
|
|
85
|
+
private currency: CurrencyType
|
|
85
86
|
private isNormalized: boolean
|
|
86
87
|
|
|
87
88
|
constructor({
|
|
@@ -90,7 +91,7 @@ export class MoneyCalculator {
|
|
|
90
91
|
isNormalized = false,
|
|
91
92
|
}: {
|
|
92
93
|
amount: number
|
|
93
|
-
currency:
|
|
94
|
+
currency: CurrencyType
|
|
94
95
|
isNormalized?: boolean
|
|
95
96
|
}) {
|
|
96
97
|
this.amount = amount
|
|
@@ -108,7 +109,7 @@ export class MoneyCalculator {
|
|
|
108
109
|
currency,
|
|
109
110
|
exchangeRate,
|
|
110
111
|
}: {
|
|
111
|
-
currency:
|
|
112
|
+
currency: CurrencyType
|
|
112
113
|
exchangeRate: number
|
|
113
114
|
}): this {
|
|
114
115
|
if (this.currency === currency || this.amount === 0) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IPaginatedQueriesConfig } from '../types/index.ts'
|
|
2
2
|
|
|
3
3
|
/* @__PURE__ */
|
|
4
|
-
export const PAGINATED_QUERY_DEFAULT_CONFIG
|
|
4
|
+
export const PAGINATED_QUERY_DEFAULT_CONFIG = {
|
|
5
5
|
defaultScope: {
|
|
6
6
|
limit: 20,
|
|
7
7
|
order: 'DESC',
|
|
8
8
|
orderBy: 'createdAt',
|
|
9
9
|
},
|
|
10
|
-
}
|
|
10
|
+
} satisfies Required<IPaginatedQueriesConfig>
|
|
@@ -22,9 +22,9 @@ export const BOOKING_POLICY_SCHEMA = z
|
|
|
22
22
|
}),
|
|
23
23
|
check_in_date: CHECK_IN_DATE_SCHEMA,
|
|
24
24
|
check_out_date: CHECK_OUT_DATE_SCHEMA,
|
|
25
|
-
children: CHILDREN_SCHEMA.
|
|
25
|
+
children: CHILDREN_SCHEMA.nullish(),
|
|
26
26
|
currency: CURRENCY_SCHEMA,
|
|
27
|
-
expires_at: z.coerce.date().openapi({
|
|
27
|
+
expires_at: z.coerce.date().nullable().openapi({
|
|
28
28
|
description:
|
|
29
29
|
'Expiration date for this **Booking Policy**.\n\nThe returned **Booking Policy** (price and cancellation policies) is valid bookable policy up to this **expires_at** date, while it may be valid for a longer period in the case of some suppliers, this API call is equivalent to an availability check and it is important not to let long periods between retrieval of this policy and the booking confirmation call itself as this will often reduce the likelihood of a **Hotel Room Offer** being successfully booked.',
|
|
30
30
|
}),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
import { BreakfastOption } from '../constants/index.ts'
|
|
4
|
+
import { HotelRoomOfferTypeEnum } from '../types/index.ts'
|
|
5
|
+
|
|
6
|
+
export const BREAKFAST_OPTION_DESCRIPTION = `This parameter describes the breakfast option for the given **Hotel Room Offer**:
|
|
7
|
+
- **breakfast_option = "${BreakfastOption.Included}"**:
|
|
8
|
+
1. When **HotelRoomOffer.type = "${HotelRoomOfferTypeEnum.Package}"**:
|
|
9
|
+
the returned **Hotel Room Offer** includes breakfast for the requested **guest count (adult_count + children over 3)**, you cannot choose otherwise, and the returned **price** already includes it,
|
|
10
|
+
2. When **HotelRoomOffer.type = "${HotelRoomOfferTypeEnum.HotelRoom}"**:
|
|
11
|
+
the returned **Hotel Room Offer** includes breakfast for the **Hotel Room Offer** maximum occupancy, you cannot choose otherwise, and the returned **price** already includes it,
|
|
12
|
+
-**breakfast_option = "${BreakfastOption.Optional}"**: the returned **Hotel Room Offer** does not include by default the breakfast and so does the returned **price**, but you'll be able to let your customers choose to add it to their booking. In that case, a **breakfast_price_per_guest_per_night** expressed in the requested **currency** will be available in the returned data, and you'll be to perform one of the two following actions: \n - Call **[Create Hotel Room Offer endpoint](/v1/documentation#operation/postV1Hotel_room_offers)** and get a fresh **Hotel Room Offer** with updated price \n - Compute and display the total price of the **Hotel Room Offer** related to the guest_count and night count requested including extra breafasts.,
|
|
13
|
+
- **breakfast_option = "${BreakfastOption.NotIncluded}"**: the returned **Hotel Room Offer** does not include breakfast and you cannot choose otherwise through API. Guest may still be able to add extra breakfast option(s) at the time of check-in directly at the hotel's reception.`
|
|
14
|
+
|
|
15
|
+
export const BREAKFAST_OPTION_SCHEMA = z
|
|
16
|
+
.enum(BreakfastOption)
|
|
17
|
+
.openapi('BreakfastOption', { description: BREAKFAST_OPTION_DESCRIPTION })
|
|
18
|
+
|
|
19
|
+
export type BreakfastOptionSchema = z.infer<typeof BREAKFAST_OPTION_SCHEMA>
|
|
20
|
+
|
|
21
|
+
export const ADD_BREAKFAST_SCHEMA = z
|
|
22
|
+
.boolean()
|
|
23
|
+
.nullish()
|
|
24
|
+
.openapi('addBreakfast', {
|
|
25
|
+
description: `This parameter allows to add breakfast to the booking as long as every requested Hotel Room Offers **breakfast_option = ${BreakfastOption.Optional}** .\n\nThe final breakfast count that will be included in the Hotel Room Offer will be returned in the response and is calculated as follows: \n\n - If the returned Hotel Room Offer **total room count** > **hotel_room_offer_request.adult_count** then **breakfast_count** will be equal to the **total room count** of the returned Hotel Room Offer, \n\n - Otherwise **breakfast_count** will be equal to the minimum value between related **hotel_room_offer_request.adult_count** and returned Hotel Room Offer **total occupancy**. \n\n <div style="background-color: #ffffef; padding: 20px; border: 1px solid lightgrey; border-radius: 5px;"><b style="color: red; margin-top: 10px;">🛑 DEPRECATED.</b>\n\n <b style="color: orange;">If you already use this field, don't worry as we still support it with the following behaviour:</b>\n- <span style="color: orange;">When **add_breakfast = true** then **breakfast_count = MIN(guest count, total offer occupancy)** where **guest count** is the total number of adult and children over 3.</span>\n- <span style="color: orange;">Otherwise **breakfast_count = 0**.</span></div>`,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export const BREAKFAST_COUNT = z
|
|
29
|
+
.number()
|
|
30
|
+
.optional()
|
|
31
|
+
.openapi('breakfastCount', {
|
|
32
|
+
description: `This parameter describes the quantity of breakfast / night that should be included in the **Booking**. When **breakfast_option = ${BreakfastOption.Optional}**, valid **breakfast_count** lower bound is **room count** and upper bound is **guest count**, where **guest count** is the number of adult and children over 3.\n\n⚠️ The actual breakfast count that will be included in the **Booking** is the one that is returned in the response of this endpoint and might be different from this **breakfast_count** paramater in some cases. Please, make sure to check the actual breakfast count included in the **Hotel Room Offer** returned in the response of this endpoint.`,
|
|
33
|
+
})
|
package/src/schemas/currency.ts
CHANGED
package/src/schemas/global.ts
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
BreakfastOption,
|
|
6
|
-
CountryIso2Code,
|
|
7
|
-
Locale,
|
|
8
|
-
Status,
|
|
9
|
-
} from '../constants/index.ts'
|
|
4
|
+
import { CountryIso2Code, Locale, Status } from '../constants/index.ts'
|
|
10
5
|
|
|
11
6
|
export const validStringDate = (): z.ZodString =>
|
|
12
7
|
z
|
|
13
8
|
.string()
|
|
14
9
|
.regex(/^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$/u)
|
|
15
10
|
|
|
16
|
-
export const ADD_BREAKFAST_SCHEMA = z
|
|
17
|
-
.boolean()
|
|
18
|
-
.nullish()
|
|
19
|
-
.openapi('addBreakfast', {
|
|
20
|
-
description: `This parameter allows to add breakfast to the booking as long as every requested Hotel Room Offers **breakfast_option = ${BreakfastOption.Optional}** .\n\nThe final breakfast count that will be included in the Hotel Room Offer will be returned in the response and is calculated as follows: \n\n - If the returned Hotel Room Offer **total room count** > **hotel_room_offer_request.adult_count** then **breakfast_count** will be equal to the **total room count** of the returned Hotel Room Offer, \n\n - Otherwise **breakfast_count** will be equal to the minimum value between related **hotel_room_offer_request.adult_count** and returned Hotel Room Offer **total occupancy**. \n\n <div style="background-color: #ffffef; padding: 20px; border: 1px solid lightgrey; border-radius: 5px;"><b style="color: red; margin-top: 10px;">🛑 DEPRECATED.</b>\n\n <b style="color: orange;">If you already use this field, don't worry as we still support it with the following behaviour:</b>\n- <span style="color: orange;">When **add_breakfast = true** then **breakfast_count = MIN(guest count, total offer occupancy)** where **guest count** is the total number of adult and children over 3.</span>\n- <span style="color: orange;">Otherwise **breakfast_count = 0**.</span></div>`,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
11
|
export const ADULT_COUNT_SCHEMA = z
|
|
24
12
|
.number()
|
|
25
13
|
.int()
|
|
@@ -30,13 +18,6 @@ export const ADULT_COUNT_SCHEMA = z
|
|
|
30
18
|
'The total number of adults who will be staying in the property.',
|
|
31
19
|
})
|
|
32
20
|
|
|
33
|
-
export const BREAKFAST_COUNT = z
|
|
34
|
-
.number()
|
|
35
|
-
.optional()
|
|
36
|
-
.openapi('breakfastCount', {
|
|
37
|
-
description: `This parameter describes the quantity of breakfast / night that should be included in the **Booking**. When **breakfast_option = ${BreakfastOption.Optional}**, valid **breakfast_count** lower bound is **room count** and upper bound is **guest count**, where **guest count** is the number of adult and children over 3.\n\n⚠️ The actual breakfast count that will be included in the **Booking** is the one that is returned in the response of this endpoint and might be different from this **breakfast_count** paramater in some cases. Please, make sure to check the actual breakfast count included in the **Hotel Room Offer** returned in the response of this endpoint.`,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
21
|
export const CHECK_IN_DATE_SCHEMA = validStringDate().openapi('checkInDate', {
|
|
41
22
|
description: 'Date of check-in formatted as YYYY-MM-DD.',
|
|
42
23
|
})
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
HotelRoomOfferType,
|
|
7
|
-
PackageType,
|
|
8
|
-
StayTaxesInfoEnum,
|
|
9
|
-
} from '../constants/index.ts'
|
|
4
|
+
import { PackageType, StayTaxesInfoEnum } from '../constants/index.ts'
|
|
5
|
+
import { HotelRoomOfferTypeEnum } from '../types/elements/hotel-room-offer-type.ts'
|
|
10
6
|
|
|
7
|
+
import { BREAKFAST_OPTION_SCHEMA } from './breakfast.ts'
|
|
11
8
|
import { CANCELLATION_POLICY_SCHEMA } from './cancellation-policies.ts'
|
|
12
9
|
import { CURRENCY_SCHEMA } from './currency.ts'
|
|
13
10
|
import { SOURCE_MARKET_SCHEMA } from './global.ts'
|
|
@@ -21,16 +18,8 @@ export const HOTEL_ROOM_OFFERS_IMAGES = z.array(z.array(HOTEL_IMAGE)).openapi({
|
|
|
21
18
|
description:
|
|
22
19
|
'List of hotel room offer images in various sizes featuring an indicator for the primary (hero) image',
|
|
23
20
|
})
|
|
24
|
-
export const BREAKFAST_OPTION_DESCRIPTION = `This parameter describes the breakfast option for the given **Hotel Room Offer**:
|
|
25
|
-
- **breakfast_option = "${BreakfastOption.Included}"**:
|
|
26
|
-
1. When **HotelRoomOffer.type = "${HotelRoomOfferType.Package}"**:
|
|
27
|
-
the returned **Hotel Room Offer** includes breakfast for the requested **guest count (adult_count + children over 3)**, you cannot choose otherwise, and the returned **price** already includes it,
|
|
28
|
-
2. When **HotelRoomOffer.type = "${HotelRoomOfferType.HotelRoom}"**:
|
|
29
|
-
the returned **Hotel Room Offer** includes breakfast for the **Hotel Room Offer** maximum occupancy, you cannot choose otherwise, and the returned **price** already includes it,
|
|
30
|
-
-**breakfast_option = "${BreakfastOption.Optional}"**: the returned **Hotel Room Offer** does not include by default the breakfast and so does the returned **price**, but you'll be able to let your customers choose to add it to their booking. In that case, a **breakfast_price_per_guest_per_night** expressed in the requested **currency** will be available in the returned data, and you'll be to perform one of the two following actions: \n - Call **[Create Hotel Room Offer endpoint](/v1/documentation#operation/postV1Hotel_room_offers)** and get a fresh **Hotel Room Offer** with updated price \n - Compute and display the total price of the **Hotel Room Offer** related to the guest_count and night count requested including extra breafasts.,
|
|
31
|
-
- **breakfast_option = "${BreakfastOption.NotIncluded}"**: the returned **Hotel Room Offer** does not include breakfast and you cannot choose otherwise through API. Guest may still be able to add extra breakfast option(s) at the time of check-in directly at the hotel's reception.`
|
|
32
21
|
|
|
33
|
-
export const PACKAGE_TYPES_DESCRIPTION = `An **Hotel Room Offer** of type **${
|
|
22
|
+
export const PACKAGE_TYPES_DESCRIPTION = `An **Hotel Room Offer** of type **${HotelRoomOfferTypeEnum.Package}** can be of **4 types**, described by **package_type** parameter: \n\n - **${PackageType.Cheapest}** : The cheapest combination of hotel rooms that can accommodate the requested guest count. Note that it may not match the requested room count (e.g., 4 guests and 2 rooms requested may return an hotel room package including only 1 room with an occupancy of 4). \n\n -**${PackageType.MatchingRoomCount}** : the cheapest hotel room package that can accommodate the given guest count and that matches exactly the room count given. \n\n -**${PackageType.BestMatch}** : The cheapest hotel room package that matches the given room and guest count with a balanced distribution of guests across the rooms (e.g.; 8 guests and 3 rooms requested may return an **Hotel Room Offer** package including 2 rooms with an occupancy of 3 on each one and 1 room with an occupancy of 2). \n\n -**${PackageType.Regular}** : any other available package.`
|
|
34
23
|
|
|
35
24
|
export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
36
25
|
.object({
|
|
@@ -38,9 +27,7 @@ export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
|
38
27
|
description:
|
|
39
28
|
'Quantity of breakfast per night included in the given **Hotel Room Offer**',
|
|
40
29
|
}),
|
|
41
|
-
breakfast_option:
|
|
42
|
-
description: BREAKFAST_OPTION_DESCRIPTION,
|
|
43
|
-
}),
|
|
30
|
+
breakfast_option: BREAKFAST_OPTION_SCHEMA,
|
|
44
31
|
breakfast_price_per_guest_per_night: z.number().nullish().openapi({
|
|
45
32
|
description:
|
|
46
33
|
'Price of breakfast per guest per night for the given **Hotel Room Offer**, expressed in the requested **currency**, when applicable.\n\n <div style="background-color: #ffffef; padding: 20px; border: 1px solid lightgrey; border-radius: 5px;"><b style="color: red; margin-top: 10px;">🛑 DEPRECATED.</b>\n\n <b style="color: orange;">Field renamed to "breakfast_unit_price"</div>',
|
|
@@ -59,8 +46,8 @@ export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
|
59
46
|
.number()
|
|
60
47
|
.nullish()
|
|
61
48
|
.openapi({
|
|
62
|
-
description: `When **type = ${
|
|
63
|
-
When **type = ${
|
|
49
|
+
description: `When **type = ${HotelRoomOfferTypeEnum.HotelRoom}**: this parameters represents the available quantity for the given **Hotel Room Offer**.
|
|
50
|
+
When **type = ${HotelRoomOfferTypeEnum.Package}**: count = 1 always.`,
|
|
64
51
|
}),
|
|
65
52
|
currency: CURRENCY_SCHEMA,
|
|
66
53
|
hotel_id: z
|
|
@@ -69,7 +56,7 @@ export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
|
69
56
|
hotel_rooms: HOTEL_ROOMS_SCHEMA.openapi({
|
|
70
57
|
description: 'List of Hotel Rooms included in the Hotel Room Offer.',
|
|
71
58
|
}),
|
|
72
|
-
id: z.string().openapi({ description: 'Hotel Room Offer id.' })
|
|
59
|
+
id: z.string().optional().openapi({ description: 'Hotel Room Offer id.' }),
|
|
73
60
|
package_type: z
|
|
74
61
|
.enum(PackageType)
|
|
75
62
|
.openapi({
|
|
@@ -86,13 +73,13 @@ export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
|
86
73
|
.openapi({ description: 'Either INCLUDED, NOT_INCLUDED or UNKNOWN' }),
|
|
87
74
|
tags: TAGS_SCHEMA,
|
|
88
75
|
tax_included_price: z.number().openapi({
|
|
89
|
-
description: `Price of the given **Hotel Room Offer** including breakfast(s) when applicable, and including all taxes from returned **taxes** list parameter expressed in the requested **currency**.\n\nThis data is not returned for a **Hotel Room Offer** of type **${
|
|
76
|
+
description: `Price of the given **Hotel Room Offer** including breakfast(s) when applicable, and including all taxes from returned **taxes** list parameter expressed in the requested **currency**.\n\nThis data is not returned for a **Hotel Room Offer** of type **${HotelRoomOfferTypeEnum.HotelRoom}**, you'll need to compute and display the actual tax included price of the final **Hotel Room** package corresponding to the guest count and night count requested, or make a call to the **[Create Hotel Room Offer](/v1/documentation#operation/postV1Hotel_room_offers)** endpoint in order to get a valid and bookable **Hotel Room Offer** where **type = ${HotelRoomOfferTypeEnum.Package}** based on a packaged list of **Hotel Room Offers** of type **${HotelRoomOfferTypeEnum.HotelRoom}**.`,
|
|
90
77
|
}),
|
|
91
78
|
taxes: TAXES_SCHEMA,
|
|
92
79
|
type: z
|
|
93
|
-
.enum(
|
|
80
|
+
.enum(HotelRoomOfferTypeEnum)
|
|
94
81
|
.openapi({
|
|
95
|
-
description: `Hotel Room Offer type.\n\n **Hotel Room Offers** with **type = "${
|
|
82
|
+
description: `Hotel Room Offer type.\n\n **Hotel Room Offers** with **type = "${HotelRoomOfferTypeEnum.Package}"** are **Hotel Room Offers** that are already bookable and you'll be able to follow the next step of the **Booking Flow** calling **[Create Booking Policies endpoint](/v1/documentation#operation/postV1Booking_policies)**. \n\n Otherwise, you'll be able to create a new **Hotel Room Offer** with **type = "${HotelRoomOfferTypeEnum.Package}"** from multiple **Hotel Room Offers** with **type = "${HotelRoomOfferTypeEnum.HotelRoom}"**. See **[Create Hotel Room Offer endpoint](/v1/documentation#operation/postV1Hotel_room_offers)** for details.`,
|
|
96
83
|
})
|
|
97
84
|
.optional(),
|
|
98
85
|
})
|
package/src/schemas/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from './hotel-room-offer-type.ts'
|
|
|
14
14
|
export * from './hotel-room-offer-package-type.ts'
|
|
15
15
|
export type * from './hotel-room-offer-request.ts'
|
|
16
16
|
export type * from './hotel-room.ts'
|
|
17
|
-
export
|
|
17
|
+
export * from './source-market.ts'
|
|
18
18
|
export type * from './tag.ts'
|
|
19
19
|
export * from './tax.ts'
|
|
20
20
|
export * from './booking.ts'
|
|
@@ -79,7 +79,7 @@ export function keysChangeCase<T>(
|
|
|
79
79
|
|
|
80
80
|
options: { deep?: boolean; exclude?: (string | RegExp)[] } = { deep: true },
|
|
81
81
|
): unknown {
|
|
82
|
-
if (isObject(obj)) {
|
|
82
|
+
if (isObject(obj) && !(obj instanceof Date)) {
|
|
83
83
|
return Object.keys(obj).reduce<any>((result, key) => {
|
|
84
84
|
// Check if key should be excluded from the transformation
|
|
85
85
|
const transformedKey =
|
package/src/utils/dayjs.ts
CHANGED
|
@@ -17,7 +17,7 @@ import 'dayjs/locale/fr.js'
|
|
|
17
17
|
import 'dayjs/locale/en.js'
|
|
18
18
|
/* eslint-enable no-restricted-syntax, import/no-unassigned-import */
|
|
19
19
|
|
|
20
|
-
/* eslint-disable import
|
|
20
|
+
/* eslint-disable import/no-named-as-default-member */
|
|
21
21
|
dayjs.extend(advancedFormat)
|
|
22
22
|
dayjs.extend(isBetween)
|
|
23
23
|
dayjs.extend(isSameOrAfter)
|
|
@@ -28,7 +28,7 @@ dayjs.extend(minMax)
|
|
|
28
28
|
dayjs.extend(relativeTime)
|
|
29
29
|
dayjs.extend(timezone)
|
|
30
30
|
dayjs.extend(utc)
|
|
31
|
-
/* eslint-enable import
|
|
31
|
+
/* eslint-enable import/no-named-as-default-member */
|
|
32
32
|
|
|
33
33
|
export { dayjs }
|
|
34
34
|
|