@revolugo/common 7.1.1 → 7.2.0-rc.1
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/cancellation-policies.ts +1 -1
- package/src/constants/hotel-room-offer.ts +0 -5
- package/src/constants/poller.ts +8 -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 +51 -0
- package/src/schemas/breakfast.ts +33 -0
- package/src/schemas/cancellation-policies.ts +18 -13
- package/src/schemas/currency.ts +3 -1
- package/src/schemas/global.ts +120 -0
- package/src/schemas/hotel-offer.ts +40 -28
- package/src/schemas/hotel-room-offer.ts +31 -30
- package/src/schemas/hotel.ts +225 -258
- package/src/schemas/index.ts +3 -1
- package/src/schemas/list-polling-meta.ts +7 -2
- package/src/schemas/tag.ts +22 -8
- package/src/schemas/taxes.ts +4 -2
- package/src/types/elements/booking-policy.ts +1 -1
- package/src/types/elements/booking.ts +1 -1
- package/src/types/elements/contact-person.ts +4 -4
- package/src/types/elements/hotel-offer.ts +1 -1
- package/src/types/elements/hotel-room-offer-request.ts +1 -0
- package/src/types/elements/hotel-room-offer.ts +2 -2
- package/src/types/elements/hotel.ts +1 -1
- package/src/types/elements/index.ts +1 -1
- package/src/utils/case-transformers.ts +1 -1
- package/src/utils/dayjs.ts +2 -2
- package/src/utils/omit.ts +2 -0
- package/src/utils/pick.ts +2 -0
- package/src/utils/shake.ts +1 -0
- package/src/schemas/hotel-offer-request.ts +0 -43
|
@@ -163,10 +163,6 @@ export interface PrebookFormValues {
|
|
|
163
163
|
firstName: ContactPerson['firstName']
|
|
164
164
|
lastName: ContactPerson['lastName']
|
|
165
165
|
nationality: ContactPerson['nationality']
|
|
166
|
-
phoneCountry: CountryIso2Code
|
|
167
|
-
phoneNumber: string
|
|
168
|
-
salutation: ContactPerson['salutation']
|
|
169
|
-
specialRequests: ContactPerson['remarks']
|
|
170
166
|
organizationAddress?: string
|
|
171
167
|
organizationCity?: string
|
|
172
168
|
organizationCountry?: string
|
|
@@ -174,4 +170,8 @@ export interface PrebookFormValues {
|
|
|
174
170
|
organizationState?: string
|
|
175
171
|
organizationVatNumber?: string
|
|
176
172
|
organizationZipCode?: string
|
|
173
|
+
phoneCountry: CountryIso2Code
|
|
174
|
+
phoneNumber: string
|
|
175
|
+
salutation: ContactPerson['salutation']
|
|
176
|
+
specialRequests: ContactPerson['remarks']
|
|
177
177
|
}
|
|
@@ -128,7 +128,7 @@ export interface HotelRoomOffer {
|
|
|
128
128
|
count?: number | null
|
|
129
129
|
/**
|
|
130
130
|
*
|
|
131
|
-
* @type {
|
|
131
|
+
* @type {CurrencyClient}
|
|
132
132
|
* @memberof HotelRoomOffer
|
|
133
133
|
*/
|
|
134
134
|
currency: CurrencyType
|
|
@@ -259,7 +259,7 @@ export interface HotelRoomOfferResponse {
|
|
|
259
259
|
children?: string | null
|
|
260
260
|
/**
|
|
261
261
|
*
|
|
262
|
-
* @type {
|
|
262
|
+
* @type {CurrencyClient}
|
|
263
263
|
* @memberof HotelRoomOfferResponse
|
|
264
264
|
*/
|
|
265
265
|
currency: CurrencyType
|
|
@@ -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
|
|
package/src/utils/omit.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export function omit<T extends object, K extends keyof T>(
|
|
7
7
|
object: T | null | undefined,
|
|
8
8
|
keys: readonly K[] | K,
|
|
9
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
9
10
|
): Omit<T, K> {
|
|
10
11
|
if (object === null || object === undefined) {
|
|
11
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -35,5 +36,6 @@ export function omit<T extends object, K extends keyof T>(
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
38
40
|
return result as Omit<T, K>
|
|
39
41
|
}
|
package/src/utils/pick.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export function pick<T extends object, K extends keyof T>(
|
|
2
2
|
obj: T,
|
|
3
3
|
keys: readonly K[],
|
|
4
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
4
5
|
): Pick<T, K> {
|
|
6
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
5
7
|
const result = {} as Pick<T, K>
|
|
6
8
|
for (const key of keys) {
|
|
7
9
|
if (Object.hasOwn(obj, key)) {
|
package/src/utils/shake.ts
CHANGED
|
@@ -7,6 +7,7 @@ export function shake<RemovedKeys extends string, T>(
|
|
|
7
7
|
obj: T,
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
filter: (value: any) => boolean = x => x === undefined,
|
|
10
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
10
11
|
): Omit<T, RemovedKeys> {
|
|
11
12
|
if (!obj) {
|
|
12
13
|
return {} as T
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
import { CountryIso2Code } from '../constants/index.ts'
|
|
4
|
-
|
|
5
|
-
export const ADULT_COUNT_SCHEMA = z.number().int().min(1).max(200).openapi({
|
|
6
|
-
description:
|
|
7
|
-
'The total number of adults who will be staying in the property.',
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export const CHECK_IN_DATE_SCHEMA = z
|
|
11
|
-
.string()
|
|
12
|
-
.regex(/^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$/u)
|
|
13
|
-
.openapi({ description: 'Date of check-in formatted as YYYY-MM-DD.' })
|
|
14
|
-
|
|
15
|
-
export const CHECK_OUT_DATE_SCHEMA = z
|
|
16
|
-
.string()
|
|
17
|
-
.regex(/^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$/u)
|
|
18
|
-
.openapi({ description: 'Date of check-out formatted as YYYY-MM-DD.' })
|
|
19
|
-
|
|
20
|
-
export const CHILDREN_SCHEMA = z
|
|
21
|
-
.string()
|
|
22
|
-
.regex(/^(([0-9]{1})|(1[0-7]){1})(,(([0-9]{1})|(1[0-7]){1}))*$|^$/u)
|
|
23
|
-
.openapi({
|
|
24
|
-
description:
|
|
25
|
-
'A comma-separated list of child ages (0 up to 17). e.g.: "3,7" represents 2 children respectively 3 and 7 years old.',
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export const COUNTRY_ISO2_CODE_SCHEMA = z
|
|
29
|
-
.enum(CountryIso2Code)
|
|
30
|
-
.refine(check => Object.values(CountryIso2Code).includes(check), {
|
|
31
|
-
message: 'Invalid ISO Alpha-2 country code.',
|
|
32
|
-
})
|
|
33
|
-
.openapi({
|
|
34
|
-
description: 'ISO Alpha-2 country code.',
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
export const SOURCE_MARKET_SCHEMA = COUNTRY_ISO2_CODE_SCHEMA.openapi(
|
|
38
|
-
'sourceMarket',
|
|
39
|
-
{
|
|
40
|
-
description:
|
|
41
|
-
'For sourcing availability within certain markets, a source market option may be used to get more accurate prices. You may use any valid ISO Alpha-2 country code, e.g. JP.',
|
|
42
|
-
},
|
|
43
|
-
)
|