@revolugo/common 6.15.7-alpha.2 → 6.15.7-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 +3 -2
- package/src/schemas/hotel-offer.ts +2 -4
- package/src/schemas/list-polling-meta.ts +4 -0
- package/src/types/elements/booking-policy.ts +34 -0
- package/src/types/elements/index.ts +1 -0
- package/src/utils/get-hotel-room-offer-room-count.ts +7 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/transform-schema-keys.ts +11 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolugo/common",
|
|
3
|
-
"version": "6.15.7-alpha.
|
|
3
|
+
"version": "6.15.7-alpha.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Revolugo common",
|
|
6
6
|
"author": "Revolugo",
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"./utils": "./src/utils/index.ts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@asteasolutions/zod-to-openapi": "8.4.0",
|
|
32
33
|
"change-case": "5.4.4",
|
|
33
34
|
"dayjs": "1.11.19",
|
|
34
35
|
"ky": "1.14.2",
|
|
35
36
|
"slugify": "1.6.6",
|
|
36
|
-
"type-fest": "5.
|
|
37
|
+
"type-fest": "5.4.1",
|
|
37
38
|
"uuid": "13.0.0",
|
|
38
39
|
"zod": "4.3.5"
|
|
39
40
|
},
|
|
@@ -23,7 +23,7 @@ List of hotel images in various sizes featuring an indicator for the primary (he
|
|
|
23
23
|
hotel_room_offers: z.array(HOTEL_ROOM_OFFER_SCHEMA),
|
|
24
24
|
tags: TAGS_SCHEMA,
|
|
25
25
|
venues: VENUES_SCHEMA,
|
|
26
|
-
})
|
|
26
|
+
}).openapi('hotelOfferApi')
|
|
27
27
|
|
|
28
28
|
export const HOTEL_OFFERS_SCHEMA = z.array(HOTEL_OFFER_SCHEMA)
|
|
29
29
|
|
|
@@ -52,7 +52,5 @@ export const HOTEL_OFFERS_RESPONSE_SCHEMA = z.object({
|
|
|
52
52
|
}),
|
|
53
53
|
}),
|
|
54
54
|
event: z.any().optional(),
|
|
55
|
-
meta: LIST_POLLING_META_SCHEMA
|
|
56
|
-
total_count: z.number(),
|
|
57
|
-
}),
|
|
55
|
+
meta: LIST_POLLING_META_SCHEMA,
|
|
58
56
|
})
|
|
@@ -39,5 +39,9 @@ export const LIST_META_SCHEMA = z
|
|
|
39
39
|
|
|
40
40
|
export const LIST_POLLING_META_SCHEMA = LIST_META_SCHEMA.extend({
|
|
41
41
|
status: STATUS_SCHEMA,
|
|
42
|
+
total_count: z
|
|
43
|
+
.number()
|
|
44
|
+
.optional()
|
|
45
|
+
.openapi({ description: 'Total count of the response list.' }),
|
|
42
46
|
}).openapi('metaApiPollingResponse')
|
|
43
47
|
/* eslint-enable camelcase */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line no-restricted-imports
|
|
1
2
|
import type { PayLaterStatusApi } from '../booking.ts'
|
|
2
3
|
import type { CancellationPolicy } from './cancellation-policy.ts'
|
|
3
4
|
import type { CurrencyType } from './currency.ts'
|
|
@@ -86,3 +87,36 @@ export interface BookingPolicies {
|
|
|
86
87
|
|
|
87
88
|
paymentMethods?: PaymentMethodApi[]
|
|
88
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @export
|
|
94
|
+
* @interface BookingCreateApiGuestsListInner
|
|
95
|
+
*/
|
|
96
|
+
export interface BookingCreateApiGuestsListInner {
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* @type {Array<BookingCreateApiGuestsListInnerGuestsInner>}
|
|
100
|
+
* @memberof BookingCreateApiGuestsListInner
|
|
101
|
+
*/
|
|
102
|
+
guests: BookingCreateApiGuestsListInnerGuestsInner[]
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @type {string}
|
|
106
|
+
* @memberof BookingCreateApiGuestsListInner
|
|
107
|
+
*/
|
|
108
|
+
hotelRoomId: string
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @export
|
|
113
|
+
* @interface BookingCreateApiGuestsListInnerGuestsInner
|
|
114
|
+
*/
|
|
115
|
+
export interface BookingCreateApiGuestsListInnerGuestsInner {
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @type {string}
|
|
119
|
+
* @memberof BookingCreateApiGuestsListInnerGuestsInner
|
|
120
|
+
*/
|
|
121
|
+
fullname: string
|
|
122
|
+
}
|
|
@@ -2,6 +2,7 @@ export type * from './bed.ts'
|
|
|
2
2
|
export type * from './booking-flow.ts'
|
|
3
3
|
export type * from './booking-policy.ts'
|
|
4
4
|
export type * from './cancellation-policy.ts'
|
|
5
|
+
export type * from './currency.ts'
|
|
5
6
|
export * from './elements-events.ts'
|
|
6
7
|
export type * from './event-metadata.ts'
|
|
7
8
|
export type * from './hotel-image.ts'
|
package/src/utils/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from './generate-pseudo-random-string.ts'
|
|
|
21
21
|
export * from './generate-random-nearby-geolocation.ts'
|
|
22
22
|
export * from './get-guest-count.ts'
|
|
23
23
|
export * from './get-night-count.ts'
|
|
24
|
+
export * from './get-hotel-room-offer-room-count.ts'
|
|
24
25
|
export * from './get-random-element-from-array.ts'
|
|
25
26
|
export * from './get-random-hex-color.ts'
|
|
26
27
|
export * from './get-random-int.ts'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getOpenApiMetadata, getRefId } from '@asteasolutions/zod-to-openapi'
|
|
1
2
|
import { z } from 'zod'
|
|
2
3
|
|
|
3
4
|
import {
|
|
@@ -62,10 +63,12 @@ function transformSchemaKeysWithTransformer(
|
|
|
62
63
|
// Handle ZodDefault
|
|
63
64
|
else if (schema instanceof z.ZodDefault) {
|
|
64
65
|
const { defaultValue, innerType: innerSchema } = schema.def
|
|
66
|
+
const defaultValueValue =
|
|
67
|
+
typeof defaultValue === 'function' ? defaultValue() : defaultValue
|
|
65
68
|
result = transformSchemaKeysWithTransformer(
|
|
66
69
|
innerSchema as z.ZodType,
|
|
67
70
|
transformer,
|
|
68
|
-
).default(
|
|
71
|
+
).default(defaultValueValue)
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
// Handle ZodUnion
|
|
@@ -89,14 +92,15 @@ function transformSchemaKeysWithTransformer(
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
// Propagate openapi metadata
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
const openapiRefId = getRefId(schema)
|
|
96
|
+
|
|
97
|
+
const openapiMetadata = getOpenApiMetadata(schema)
|
|
98
|
+
|
|
99
|
+
if (openapiRefId) {
|
|
100
|
+
result = result.openapi(openapiRefId)
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
return result
|
|
103
|
+
return result.openapi(openapiMetadata)
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
/**
|