@spoot/hostfully-api 1.0.0

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.
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PropertiesApi = void 0;
4
+ const zod_1 = require("zod");
5
+ const rx_1 = require("@spoot/rx");
6
+ const pagination_1 = require("./pagination");
7
+ const PropertySchema = zod_1.z.object({
8
+ name: zod_1.z.string(),
9
+ isActive: zod_1.z.boolean(),
10
+ uid: zod_1.z.string().uuid(),
11
+ showPropertyExactLocation: zod_1.z.boolean(),
12
+ cancellationPolicy: zod_1.z.string().nullable(),
13
+ availability: zod_1.z.object({
14
+ allowBookingRequestsAboveMaximumStay: zod_1.z.boolean().nullable(),
15
+ allowBookingRequestWhenOutOfLeadTime: zod_1.z.boolean().nullable(),
16
+ baseGuests: zod_1.z.number(),
17
+ bookingLeadTime: zod_1.z.number().nullable(),
18
+ bookingWindow: zod_1.z.number().nullable(),
19
+ checkInTimeEnd: zod_1.z.number().nullable(),
20
+ checkInTimeEndFlexible: zod_1.z.boolean().nullable(),
21
+ checkInTimeStart: zod_1.z.number().nullable(),
22
+ checkOutTime: zod_1.z.number().nullable(),
23
+ daysOfTheWeekToCheckInOn: zod_1.z.array(zod_1.z.string()),
24
+ maxGuests: zod_1.z.number(),
25
+ maximumStay: zod_1.z.number().nullable(),
26
+ minimumStay: zod_1.z.number().nullable(),
27
+ minimumWeekendStay: zod_1.z.number().nullable(),
28
+ turnOverDays: zod_1.z.number().nullable(),
29
+ }),
30
+ address: zod_1.z.object({
31
+ address: zod_1.z.string().nullable(),
32
+ address2: zod_1.z.string().nullable(),
33
+ city: zod_1.z.string().nullable(),
34
+ state: zod_1.z.string().nullable(),
35
+ zipCode: zod_1.z.string().nullable(),
36
+ }),
37
+ pricing: zod_1.z.object({
38
+ taxRate: zod_1.z.number().nullable(),
39
+ ignoreTaxRateChargeOverXDays: zod_1.z.boolean().nullable(),
40
+ daysOverWhichTaxRateChargeShouldBeIgnored: zod_1.z.number().nullable(),
41
+ cleaningFeeTaxRate: zod_1.z.number().nullable(),
42
+ extraGuestFee: zod_1.z.number(),
43
+ }),
44
+ });
45
+ const PropertyDescriptionsSchema = zod_1.z.object({
46
+ name: zod_1.z.string().nullable(),
47
+ shortSummary: zod_1.z.string().nullable(),
48
+ summary: zod_1.z.string().nullable(),
49
+ notes: zod_1.z.string().nullable(),
50
+ access: zod_1.z.string().nullable(),
51
+ transit: zod_1.z.string().nullable(),
52
+ interaction: zod_1.z.string().nullable(),
53
+ neighbourhood: zod_1.z.string().nullable(),
54
+ space: zod_1.z.string().nullable(),
55
+ houseManual: zod_1.z.string().nullable(),
56
+ locale: zod_1.z.string(),
57
+ });
58
+ class PropertiesApi {
59
+ api;
60
+ constructor(api) {
61
+ this.api = api;
62
+ }
63
+ async list() {
64
+ return await rx_1.Rx.firstValueFrom(rx_1.Rx.defer(() => (0, pagination_1.scan)(async (cursor) => await this.api.transport.fetch({
65
+ method: "GET",
66
+ path: "/api/v3.1/properties",
67
+ query: {
68
+ agencyUid: this.api.agencyUid,
69
+ _cursor: cursor,
70
+ _limit: "100",
71
+ },
72
+ response: zod_1.z.object({
73
+ properties: zod_1.z.array(PropertySchema),
74
+ _paging: pagination_1.PagingSchema,
75
+ }),
76
+ }))).pipe(rx_1.Rx.mergeMap((resp) => resp.properties), rx_1.Rx.toArray()));
77
+ }
78
+ async patch(property, update) {
79
+ await this.api.transport.fetch({
80
+ path: `/api/v3.1/properties/${property.uid}`,
81
+ method: "PATCH",
82
+ body: update,
83
+ response: null,
84
+ });
85
+ }
86
+ async getCustomData(property) {
87
+ const fields = await this.api.transport.fetch({
88
+ method: "GET",
89
+ path: "/api/v3.1/custom-data",
90
+ query: {
91
+ propertyUid: property.uid,
92
+ },
93
+ response: zod_1.z.object({
94
+ customData: zod_1.z.array(zod_1.z.object({
95
+ propertyUid: zod_1.z.string().nullable(),
96
+ leadUid: zod_1.z.string().nullable(),
97
+ unitUid: zod_1.z.string().nullable(),
98
+ text: zod_1.z.string(),
99
+ customDataField: zod_1.z.object({
100
+ agencyUid: zod_1.z.string(),
101
+ uid: zod_1.z.string(),
102
+ type: zod_1.z.enum(["TEXT", "LONG_TEXT"]),
103
+ name: zod_1.z.string(),
104
+ variable: zod_1.z.string(),
105
+ index: zod_1.z.number(),
106
+ }),
107
+ })),
108
+ _metadata: zod_1.z.object({
109
+ count: zod_1.z.number(),
110
+ }),
111
+ }),
112
+ });
113
+ return new Map(fields.customData.flatMap((d) => {
114
+ if (!d.propertyUid) {
115
+ return [];
116
+ }
117
+ return [[d.customDataField.uid, d.text]];
118
+ }));
119
+ }
120
+ async setCustomData(property, fieldUid, value) {
121
+ await this.api.transport.fetch({
122
+ method: "POST",
123
+ path: "/api/v3.1/custom-data",
124
+ body: {
125
+ propertyUid: property.uid,
126
+ customDataFieldUid: fieldUid,
127
+ text: value,
128
+ },
129
+ response: null,
130
+ });
131
+ }
132
+ async deleteCustomData(property, fieldUid) {
133
+ await this.api.transport.fetch({
134
+ method: "DELETE",
135
+ path: "/api/v3.1/custom-data",
136
+ query: {
137
+ propertyUid: property.uid,
138
+ customDataFieldUid: fieldUid,
139
+ },
140
+ response: null,
141
+ });
142
+ }
143
+ async getDescriptions(property) {
144
+ const resp = await this.api.transport.fetch({
145
+ method: "GET",
146
+ path: "/api/v3.1/property-descriptions",
147
+ query: { propertyUid: property.uid },
148
+ response: zod_1.z.object({
149
+ propertyDescriptions: zod_1.z.array(PropertyDescriptionsSchema),
150
+ }),
151
+ });
152
+ if (resp.propertyDescriptions.length !== 1) {
153
+ throw new Error(`expected to get exactly one set of property descriptions for "${property.name}", got ${resp.propertyDescriptions.length}`);
154
+ }
155
+ return resp.propertyDescriptions[0];
156
+ }
157
+ async updateDescriptions(property, updates) {
158
+ const current = await this.getDescriptions(property);
159
+ await this.api.transport.fetch({
160
+ method: "PUT",
161
+ path: `/api/v3.1/property-descriptions/${property.uid}`,
162
+ body: {
163
+ locale: current.locale,
164
+ name: "name" in updates ? updates.name : current.name,
165
+ shortSummary: "shortSummary" in updates
166
+ ? updates.shortSummary
167
+ : current.shortSummary,
168
+ summary: "summary" in updates ? updates.summary : current.summary,
169
+ notes: "notes" in updates ? updates.notes : current.notes,
170
+ access: "access" in updates ? updates.access : current.access,
171
+ transit: "transit" in updates ? updates.transit : current.transit,
172
+ interaction: "interaction" in updates ? updates.interaction : current.interaction,
173
+ neighbourhood: "neighbourhood" in updates
174
+ ? updates.neighbourhood
175
+ : current.neighbourhood,
176
+ space: "space" in updates ? updates.space : current.space,
177
+ houseManual: "houseManual" in updates ? updates.houseManual : current.houseManual,
178
+ },
179
+ response: null,
180
+ });
181
+ }
182
+ }
183
+ exports.PropertiesApi = PropertiesApi;
@@ -0,0 +1,6 @@
1
+ export declare class RateLimiting {
2
+ private remainingRequests;
3
+ private decriment;
4
+ take(): Promise<void>;
5
+ onResponse(respHeaders: Record<string, string>): void;
6
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RateLimiting = void 0;
4
+ const promises_1 = require("timers/promises");
5
+ const rx_1 = require("@spoot/rx");
6
+ class RateLimiting {
7
+ // the starting value will be replaced very quickly, but to avoid slowing down the first request we assume that all of our capacity is available
8
+ remainingRequests = new rx_1.Rx.BehaviorSubject(10000);
9
+ decriment() {
10
+ this.remainingRequests.next(this.remainingRequests.getValue() - 1);
11
+ }
12
+ async take() {
13
+ for (let remaining = this.remainingRequests.getValue(); true; remaining = this.remainingRequests.getValue()) {
14
+ if (remaining > 1000) {
15
+ this.decriment();
16
+ return;
17
+ }
18
+ if (remaining > 700) {
19
+ console.log("Running low on requests, slowing down to avoid hitting limit");
20
+ await (0, promises_1.setTimeout)(1000);
21
+ this.decriment();
22
+ return;
23
+ }
24
+ if (remaining > 500) {
25
+ console.log("Running very low on requests, delaying request by 5 seconds to avoid hitting limit");
26
+ await (0, promises_1.setTimeout)(5000);
27
+ this.decriment();
28
+ return;
29
+ }
30
+ if (remaining > 100) {
31
+ console.log("Running critically low on requests, delaying request by 1 minute to avoid hitting limit");
32
+ await (0, promises_1.setTimeout)(60000);
33
+ this.decriment();
34
+ return;
35
+ }
36
+ console.log("Ran out of requests, waiting for more");
37
+ await this.remainingRequests.pipe(rx_1.Rx.filter((n) => n > 0)).toPromise();
38
+ }
39
+ }
40
+ onResponse(respHeaders) {
41
+ const remaining = respHeaders["x-ratelimit-remaining"];
42
+ if (remaining) {
43
+ const n = Number(remaining);
44
+ if (!Number.isNaN(n)) {
45
+ this.remainingRequests.next(n);
46
+ }
47
+ }
48
+ }
49
+ }
50
+ exports.RateLimiting = RateLimiting;
@@ -0,0 +1,13 @@
1
+ import { GqlQuery } from "@spoot/gql";
2
+ import { z } from "zod";
3
+ export interface FetchOptions<Response> {
4
+ path: string;
5
+ query?: Record<string, string | undefined | null>;
6
+ method: string;
7
+ body?: object;
8
+ response: z.Schema<Response> | null;
9
+ }
10
+ export interface Transport {
11
+ fetchGql<Response>(query: GqlQuery, schema: z.Schema<Response>): Promise<Response>;
12
+ fetch<Response>(options: FetchOptions<Response>): Promise<Response>;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const LeadStatusSchema: z.ZodEnum<["BLOCKED", "NEW", "ON_HOLD", "CLOSED", "PENDING", "DECLINED", "BOOKED", "CANCELLED", "IGNORED", "DUPLICATE", "SAMPLE"]>;
3
+ export declare const VrboFeeTypeSchema: z.ZodEnum<["ADDITIONAL_BED", "ADMINISTRATIVE", "AIR_CONDITIONING", "ARRIVAL_EARLY", "ARRIVAL_LATE", "ASSOCIATION_PROPERTY", "BABY_BED", "BOOKING_EARLY", "BOOKING_LATE", "CLASS", "CLUB", "CONCIERGE", "DEPARTURE_EARLY", "DEPARTURE_LATE", "ELECTRICITY", "EQUIPMENT", "FOOD", "GARDENING", "GAS", "HEATING", "HIGH_CHAIR", "HOT_TUB", "INTERNET", "LABOR", "LAUNDRY", "LINENS", "LINENS_BATH", "LINENS_BED", "MANAGEMENT", "OIL", "ON_SITE_PAYMENT_METHOD", "PARKING", "PET", "PHONE", "POOL", "POOL_HEATING", "RENT", "RESORT", "SPA", "TAX", "TOILETRIES", "TOUR", "TRANSPORTATION", "UTENSILS_CLEANING", "UTENSILS_FOOD", "VEHICLE", "WAIVER_DAMAGE", "WATER", "WATER_CRAFT", "WATER_CRAFT_MOORING", "WATER_DRINKING", "WOOD"]>;
4
+ export declare const MarriottFeeTypeSchema: z.ZodEnum<["ADMINISTRATIVE_FEE", "BOOKING_FEE", "CLEANING_FEE", "DOCK_FEE", "GUEST_REGISTRATION", "HOA_FEE", "HOTEL_TAX", "HOT_TUB_FEE", "MANAGEMENT_FEE", "MISCELLANEOUS_FEE", "OCCUPANCY_TAX", "PARKING_FEE", "PER_EXTRA_PERSON_FEE", "POOL_FEE", "POOL_HEATING_FEE", "RESORT_FEE", "SECURITY_DEPOSIT_FEE", "SERVICE_FEE", "UTILITY_FEE", "VAT_TAX", "WAIVER_DAMAGE_FEE", "PET_FEE"]>;
5
+ export declare const BookingDotComFeeTypeSchema: z.ZodEnum<["AIRPORT_SHUTTLE_FEE", "AIR_CONDITIONING_FEE", "CITY_TAX", "CLUB_CARD_FEE", "CONSERVATION_FEE", "CREDIT_CARD_FEE", "DESTINATION_FEE", "ELECTRICITY_FEE", "ENVIRONMENT_FEE", "FINAL_CLEANING_FEE", "GAS_FEE", "GOODS_AND_SERVICES_TAX", "GOVERNMENT_TAX", "HEATING_FEE", "HERITAGE_FEE", "HOT_SPRING_TAX", "HOUSEKEEPING_FEE", "KITCHEN_LINEN_FEE", "LINEN_FEE", "LINEN_PACKAGE_FEE", "LOCAL_COUNCIL_TAX", "MUNICIPALITY_FEE", "OIL_FEE", "PETS_FEE", "RESIDENTIAL_TAX", "RESORT_FEE", "SAUNA_FITNESS_FACILITIES_TAX", "SEA_PLANE_FEE", "SERVICE_CHARGE_FEE", "SHUTTLE_BOAT_FEE", "SKI_PASS_FEE", "SPA_TAX", "TOWEL_FEE", "TRANSFER_FEE", "TRANSIT_FEE", "VAT", "VISA_SUPPORT_FEE", "WATER_FEE", "WATER_PARK_FEE", "WOOD_FEE", "WRISTBAND_FEE"]>;
6
+ export declare const AirbnbFeeTypeSchema: z.ZodEnum<["PASS_THROUGH_RESORT_FEE", "PASS_THROUGH_MANAGEMENT_FEE", "PASS_THROUGH_COMMUNITY_FEE", "PASS_THROUGH_LINEN_FEE", "PASS_THROUGH_ELECTRICITY_FEE", "PASS_THROUGH_WATER_FEE", "PASS_THROUGH_HEATING_FEE", "PASS_THROUGH_AIR_CONDITIONING_FEE", "PASS_THROUGH_UTILITY_FEE", "PASS_THROUGH_PET_FEE", "PASS_THROUGH_CLEANING_FEE", "PASS_THROUGH_SHORT_TERM_CLEANING_FEE", "PASS_THROUGH_SECURITY_DEPOSIT", "PASS_THROUGH_HOTEL_TAX", "PASS_THROUGH_LODGING_TAX", "PASS_THROUGH_ROOM_TAX", "PASS_THROUGH_TOURIST_TAX", "PASS_THROUGH_TRANSIENT_OCCUPANCY_TAX", "PASS_THROUGH_SALES_TAX", "PASS_THROUGH_VAT_TAX", "PASS_THROUGH_TOURISM_ASSESSMENT_FEE", "AIRBNB_COLLECTED_TAX"]>;
7
+ export declare const AirbnbFeeUnitTypeSchema: z.ZodEnum<["PER_CUBIC_METER", "PER_KILOWATT_HOUR", "PER_LITER"]>;
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AirbnbFeeUnitTypeSchema = exports.AirbnbFeeTypeSchema = exports.BookingDotComFeeTypeSchema = exports.MarriottFeeTypeSchema = exports.VrboFeeTypeSchema = exports.LeadStatusSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.LeadStatusSchema = zod_1.z.enum([
6
+ "BLOCKED",
7
+ "NEW",
8
+ "ON_HOLD",
9
+ "CLOSED",
10
+ "PENDING",
11
+ "DECLINED",
12
+ "BOOKED",
13
+ "CANCELLED",
14
+ "IGNORED",
15
+ "DUPLICATE",
16
+ "SAMPLE",
17
+ ]);
18
+ exports.VrboFeeTypeSchema = zod_1.z.enum([
19
+ "ADDITIONAL_BED",
20
+ "ADMINISTRATIVE",
21
+ "AIR_CONDITIONING",
22
+ "ARRIVAL_EARLY",
23
+ "ARRIVAL_LATE",
24
+ "ASSOCIATION_PROPERTY",
25
+ "BABY_BED",
26
+ "BOOKING_EARLY",
27
+ "BOOKING_LATE",
28
+ "CLASS",
29
+ "CLUB",
30
+ "CONCIERGE",
31
+ "DEPARTURE_EARLY",
32
+ "DEPARTURE_LATE",
33
+ "ELECTRICITY",
34
+ "EQUIPMENT",
35
+ "FOOD",
36
+ "GARDENING",
37
+ "GAS",
38
+ "HEATING",
39
+ "HIGH_CHAIR",
40
+ "HOT_TUB",
41
+ "INTERNET",
42
+ "LABOR",
43
+ "LAUNDRY",
44
+ "LINENS",
45
+ "LINENS_BATH",
46
+ "LINENS_BED",
47
+ "MANAGEMENT",
48
+ "OIL",
49
+ "ON_SITE_PAYMENT_METHOD",
50
+ "PARKING",
51
+ "PET",
52
+ "PHONE",
53
+ "POOL",
54
+ "POOL_HEATING",
55
+ "RENT",
56
+ "RESORT",
57
+ "SPA",
58
+ "TAX",
59
+ "TOILETRIES",
60
+ "TOUR",
61
+ "TRANSPORTATION",
62
+ "UTENSILS_CLEANING",
63
+ "UTENSILS_FOOD",
64
+ "VEHICLE",
65
+ "WAIVER_DAMAGE",
66
+ "WATER",
67
+ "WATER_CRAFT",
68
+ "WATER_CRAFT_MOORING",
69
+ "WATER_DRINKING",
70
+ "WOOD",
71
+ ]);
72
+ exports.MarriottFeeTypeSchema = zod_1.z.enum([
73
+ "ADMINISTRATIVE_FEE",
74
+ "BOOKING_FEE",
75
+ "CLEANING_FEE",
76
+ "DOCK_FEE",
77
+ "GUEST_REGISTRATION",
78
+ "HOA_FEE",
79
+ "HOTEL_TAX",
80
+ "HOT_TUB_FEE",
81
+ "MANAGEMENT_FEE",
82
+ "MISCELLANEOUS_FEE",
83
+ "OCCUPANCY_TAX",
84
+ "PARKING_FEE",
85
+ "PER_EXTRA_PERSON_FEE",
86
+ "POOL_FEE",
87
+ "POOL_HEATING_FEE",
88
+ "RESORT_FEE",
89
+ "SECURITY_DEPOSIT_FEE",
90
+ "SERVICE_FEE",
91
+ "UTILITY_FEE",
92
+ "VAT_TAX",
93
+ "WAIVER_DAMAGE_FEE",
94
+ "PET_FEE",
95
+ ]);
96
+ exports.BookingDotComFeeTypeSchema = zod_1.z.enum([
97
+ "AIRPORT_SHUTTLE_FEE",
98
+ "AIR_CONDITIONING_FEE",
99
+ "CITY_TAX",
100
+ "CLUB_CARD_FEE",
101
+ "CONSERVATION_FEE",
102
+ "CREDIT_CARD_FEE",
103
+ "DESTINATION_FEE",
104
+ "ELECTRICITY_FEE",
105
+ "ENVIRONMENT_FEE",
106
+ "FINAL_CLEANING_FEE",
107
+ "GAS_FEE",
108
+ "GOODS_AND_SERVICES_TAX",
109
+ "GOVERNMENT_TAX",
110
+ "HEATING_FEE",
111
+ "HERITAGE_FEE",
112
+ "HOT_SPRING_TAX",
113
+ "HOUSEKEEPING_FEE",
114
+ "KITCHEN_LINEN_FEE",
115
+ "LINEN_FEE",
116
+ "LINEN_PACKAGE_FEE",
117
+ "LOCAL_COUNCIL_TAX",
118
+ "MUNICIPALITY_FEE",
119
+ "OIL_FEE",
120
+ "PETS_FEE",
121
+ "RESIDENTIAL_TAX",
122
+ "RESORT_FEE",
123
+ "SAUNA_FITNESS_FACILITIES_TAX",
124
+ "SEA_PLANE_FEE",
125
+ "SERVICE_CHARGE_FEE",
126
+ "SHUTTLE_BOAT_FEE",
127
+ "SKI_PASS_FEE",
128
+ "SPA_TAX",
129
+ "TOWEL_FEE",
130
+ "TRANSFER_FEE",
131
+ "TRANSIT_FEE",
132
+ "VAT",
133
+ "VISA_SUPPORT_FEE",
134
+ "WATER_FEE",
135
+ "WATER_PARK_FEE",
136
+ "WOOD_FEE",
137
+ "WRISTBAND_FEE",
138
+ ]);
139
+ exports.AirbnbFeeTypeSchema = zod_1.z.enum([
140
+ "PASS_THROUGH_RESORT_FEE",
141
+ "PASS_THROUGH_MANAGEMENT_FEE",
142
+ "PASS_THROUGH_COMMUNITY_FEE",
143
+ "PASS_THROUGH_LINEN_FEE",
144
+ "PASS_THROUGH_ELECTRICITY_FEE",
145
+ "PASS_THROUGH_WATER_FEE",
146
+ "PASS_THROUGH_HEATING_FEE",
147
+ "PASS_THROUGH_AIR_CONDITIONING_FEE",
148
+ "PASS_THROUGH_UTILITY_FEE",
149
+ "PASS_THROUGH_PET_FEE",
150
+ "PASS_THROUGH_CLEANING_FEE",
151
+ "PASS_THROUGH_SHORT_TERM_CLEANING_FEE",
152
+ "PASS_THROUGH_SECURITY_DEPOSIT",
153
+ "PASS_THROUGH_HOTEL_TAX",
154
+ "PASS_THROUGH_LODGING_TAX",
155
+ "PASS_THROUGH_ROOM_TAX",
156
+ "PASS_THROUGH_TOURIST_TAX",
157
+ "PASS_THROUGH_TRANSIENT_OCCUPANCY_TAX",
158
+ "PASS_THROUGH_SALES_TAX",
159
+ "PASS_THROUGH_VAT_TAX",
160
+ "PASS_THROUGH_TOURISM_ASSESSMENT_FEE",
161
+ "AIRBNB_COLLECTED_TAX",
162
+ ]);
163
+ exports.AirbnbFeeUnitTypeSchema = zod_1.z.enum([
164
+ "PER_CUBIC_METER",
165
+ "PER_KILOWATT_HOUR",
166
+ "PER_LITER",
167
+ ]);
@@ -0,0 +1,12 @@
1
+ export * from "./HostfullyApi";
2
+ export * from "./PropertiesApi";
3
+ export * from "./FeesApi";
4
+ export * from "./PricingApi";
5
+ export * from "./LeadsApi";
6
+ export * from "./MessagesApi";
7
+ export * from "./AgenciesApi";
8
+ export * from "./pagination";
9
+ export * from "./OrderApi";
10
+ export * from "./Transport";
11
+ export * from "./FetchTransport";
12
+ export * from "./AmenitiesApi";
@@ -0,0 +1,28 @@
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("./HostfullyApi"), exports);
18
+ __exportStar(require("./PropertiesApi"), exports);
19
+ __exportStar(require("./FeesApi"), exports);
20
+ __exportStar(require("./PricingApi"), exports);
21
+ __exportStar(require("./LeadsApi"), exports);
22
+ __exportStar(require("./MessagesApi"), exports);
23
+ __exportStar(require("./AgenciesApi"), exports);
24
+ __exportStar(require("./pagination"), exports);
25
+ __exportStar(require("./OrderApi"), exports);
26
+ __exportStar(require("./Transport"), exports);
27
+ __exportStar(require("./FetchTransport"), exports);
28
+ __exportStar(require("./AmenitiesApi"), exports);
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ export declare const PagingSchema: z.ZodObject<{
3
+ _limit: z.ZodNumber;
4
+ _nextCursor: z.ZodNullable<z.ZodString>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ _limit: number;
7
+ _nextCursor: string | null;
8
+ }, {
9
+ _limit: number;
10
+ _nextCursor: string | null;
11
+ }>;
12
+ export type Paging = z.infer<typeof PagingSchema>;
13
+ export declare function scan<Result extends {
14
+ _paging: Paging;
15
+ }>(fn: (cursor: string | undefined) => Promise<Result>): AsyncGenerator<Result, void, unknown>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PagingSchema = void 0;
4
+ exports.scan = scan;
5
+ const zod_1 = require("zod");
6
+ exports.PagingSchema = zod_1.z.object({
7
+ _limit: zod_1.z.number(),
8
+ _nextCursor: zod_1.z.string().nullable(),
9
+ });
10
+ async function* scan(fn) {
11
+ let cursor = undefined;
12
+ let done = false;
13
+ while (!done) {
14
+ const result = await fn(cursor ?? undefined);
15
+ yield result;
16
+ cursor = result._paging._nextCursor;
17
+ done = cursor == null;
18
+ }
19
+ }