@v-office/website-sdk 2.25.0 → 2.26.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.
- package/dist/cli.mjs +2 -2
- package/dist/{client-0Lgv-Gb_.mjs → client--T_tQSjV.mjs} +156 -54
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +1 -1
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/README.md +1 -1
- package/dist/instructions/search.md +48 -3
- package/dist/instructions/versions/2.26.0/CHANGELOG.md +33 -0
- package/dist/instructions/versions/2.26.0/MIGRATION.md +31 -0
- package/dist/{rentals-Dn0-kGWD.mjs → rentals-D4wmqjzL.mjs} +1 -1
- package/dist/{search-BLTTQAsG.mjs → search-DtBtzIGf.mjs} +2 -2
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/README.md +1 -1
- package/instructions/search.md +48 -3
- package/instructions/versions/2.26.0/CHANGELOG.md +33 -0
- package/instructions/versions/2.26.0/MIGRATION.md +31 -0
- package/instructions/versions/2.26.0/release.json +3 -0
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Ht as defineWebsiteSDKOptions, Wt as defineV9PropertyHighlightSourcesFromUnknown, c as makeV9GraphQLClient, d as makeV0OpenApiClientFetchLive, l as V0OpenApiClient, t as createWebsiteSDK } from "./client
|
|
2
|
+
import { Ht as defineWebsiteSDKOptions, Wt as defineV9PropertyHighlightSourcesFromUnknown, c as makeV9GraphQLClient, d as makeV0OpenApiClientFetchLive, l as V0OpenApiClient, t as createWebsiteSDK } from "./client--T_tQSjV.mjs";
|
|
3
3
|
import { c as parseVofficeRatingData } from "./v9-data-C3SWtDGs.mjs";
|
|
4
4
|
import { s as rentalsAllWithoutFeedbacksQuery } from "./operations-DwURbo0b.mjs";
|
|
5
5
|
import { SearchSearchSortSchema, defineCustomAttributesFromUnknown } from "@v-office/sdk-core";
|
|
@@ -18,7 +18,7 @@ var CLICheckFailed = class extends Error {
|
|
|
18
18
|
const toCLIError = (message, cause) => cause instanceof Error ? new CLICheckFailed(`${message}: ${cause.message}`, { cause }) : new CLICheckFailed(message, { cause });
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region package.json
|
|
21
|
-
var version = "2.
|
|
21
|
+
var version = "2.26.0";
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/cli/output.ts
|
|
24
24
|
const toJson = (value) => Effect.try({
|
|
@@ -533,7 +533,7 @@ const getTermsAndPrivacyPolicyEffect = (input) => Effect.gen(function* () {
|
|
|
533
533
|
const getBankTransferDetailsEffect = () => Effect.gen(function* () {
|
|
534
534
|
const service = yield* BookingService;
|
|
535
535
|
if (service.getBankTransferDetails === void 0) return yield* Effect.fail(new CoreSDKError({
|
|
536
|
-
source: "
|
|
536
|
+
source: "core",
|
|
537
537
|
operation: "booking.getBankTransferDetails",
|
|
538
538
|
message: "BookingService.getBankTransferDetails is not provided by the core runtime."
|
|
539
539
|
}));
|
|
@@ -545,7 +545,7 @@ const searchEffect = (input) => Effect.gen(function* () {
|
|
|
545
545
|
const mapSearchEffect = (input) => Effect.gen(function* () {
|
|
546
546
|
const service = yield* SearchService;
|
|
547
547
|
if (service.mapSearch === void 0) return yield* Effect.fail(new CoreSDKError({
|
|
548
|
-
source: "
|
|
548
|
+
source: "core",
|
|
549
549
|
operation: "search.mapSearch",
|
|
550
550
|
message: "SearchService.mapSearch is not provided by the core runtime."
|
|
551
551
|
}));
|
|
@@ -3121,7 +3121,7 @@ const toVofficeUnitId$2 = (input) => {
|
|
|
3121
3121
|
const unitId = Number(input.rentalId);
|
|
3122
3122
|
if (Number.isInteger(unitId)) return Effect.succeed(unitId);
|
|
3123
3123
|
return Effect.fail(new CoreSDKError({
|
|
3124
|
-
source: "
|
|
3124
|
+
source: "v9",
|
|
3125
3125
|
operation: "v9.availability",
|
|
3126
3126
|
message: `Expected rentalId to be a vOffice unit ID, received "${input.rentalId}".`
|
|
3127
3127
|
}));
|
|
@@ -3140,7 +3140,7 @@ const makeV9AvailabilityApi = ({ config, options }) => {
|
|
|
3140
3140
|
path: { voffice_unit: unitId },
|
|
3141
3141
|
query: { lang: localeToLanguage(input.locale) }
|
|
3142
3142
|
}).pipe(Effect.mapError((cause) => new CoreSDKError({
|
|
3143
|
-
source: "
|
|
3143
|
+
source: "v9",
|
|
3144
3144
|
operation: "v9.availability",
|
|
3145
3145
|
message: "Failed to load v9 availability from the v1 OpenAPI client.",
|
|
3146
3146
|
cause
|
|
@@ -4469,14 +4469,14 @@ const toV9BookingServiceLines = (quote) => {
|
|
|
4469
4469
|
const toVofficeUnitId$1 = (input) => {
|
|
4470
4470
|
const context = getGuestQuoteBackendContext(input.quote);
|
|
4471
4471
|
if (context?.backend !== "v9") return Effect.fail(new CoreSDKError({
|
|
4472
|
-
source: "
|
|
4472
|
+
source: "v9",
|
|
4473
4473
|
operation: "v9.booking",
|
|
4474
4474
|
message: "Expected a v9 quote for v9 booking."
|
|
4475
4475
|
}));
|
|
4476
4476
|
const unitId = Number(context.input.rentalId);
|
|
4477
4477
|
if (Number.isInteger(unitId)) return Effect.succeed(unitId);
|
|
4478
4478
|
return Effect.fail(new CoreSDKError({
|
|
4479
|
-
source: "
|
|
4479
|
+
source: "v9",
|
|
4480
4480
|
operation: "v9.booking",
|
|
4481
4481
|
message: `Expected rentalId to be a vOffice unit ID, received "${context.input.rentalId}".`
|
|
4482
4482
|
}));
|
|
@@ -4497,7 +4497,7 @@ const toBookingInput = ({ input }) => Effect.gen(function* () {
|
|
|
4497
4497
|
const context = getGuestQuoteBackendContext(input.quote);
|
|
4498
4498
|
const unitId = yield* toVofficeUnitId$1(input);
|
|
4499
4499
|
if (context?.backend !== "v9") return yield* Effect.fail(new CoreSDKError({
|
|
4500
|
-
source: "
|
|
4500
|
+
source: "v9",
|
|
4501
4501
|
operation: "v9.booking",
|
|
4502
4502
|
message: "Expected a v9 quote for v9 booking."
|
|
4503
4503
|
}));
|
|
@@ -4809,7 +4809,7 @@ const toStripeReturnUrls = ({ redirectUrl }) => Effect.try({
|
|
|
4809
4809
|
};
|
|
4810
4810
|
},
|
|
4811
4811
|
catch: (cause) => new CoreSDKError({
|
|
4812
|
-
source: "
|
|
4812
|
+
source: "v9",
|
|
4813
4813
|
operation: "v9.booking",
|
|
4814
4814
|
message: "v9 Stripe payment URLs require an absolute relativeRedirectUrl or a browser window origin so rootUrl, successUrlBase, and cancelUrlBase can be created.",
|
|
4815
4815
|
cause
|
|
@@ -4819,7 +4819,7 @@ const toStripePaymentInput = ({ bookResponse, input, paymentScheduleOption, stri
|
|
|
4819
4819
|
const reservationId = bookResponse.reservation?.id;
|
|
4820
4820
|
const reservationNumber = bookResponse.reservation?.nr;
|
|
4821
4821
|
if (reservationId === void 0 || reservationNumber === void 0 || stripePaymentMethod.id === void 0) return yield* Effect.fail(new CoreSDKError({
|
|
4822
|
-
source: "
|
|
4822
|
+
source: "v9",
|
|
4823
4823
|
operation: "v9.booking",
|
|
4824
4824
|
message: "vOffice booking response did not contain enough data to initialize Stripe payment."
|
|
4825
4825
|
}));
|
|
@@ -4856,20 +4856,20 @@ const book = ({ client, input, translations }) => Effect.gen(function* () {
|
|
|
4856
4856
|
data: JSON.stringify(bookingInput),
|
|
4857
4857
|
lang: language
|
|
4858
4858
|
} }).pipe(Effect.mapError((cause) => new CoreSDKError({
|
|
4859
|
-
source: "
|
|
4859
|
+
source: "v9",
|
|
4860
4860
|
operation: "v9.booking",
|
|
4861
4861
|
message: "Failed to create v9 booking through the v0 OpenAPI client.",
|
|
4862
4862
|
cause
|
|
4863
4863
|
})));
|
|
4864
4864
|
const bookResponse = result.raw;
|
|
4865
4865
|
if (bookResponse.ok === false) return yield* Effect.fail(new CoreSDKError({
|
|
4866
|
-
source: "
|
|
4866
|
+
source: "v9",
|
|
4867
4867
|
operation: "v9.booking",
|
|
4868
4868
|
message: "vOffice rejected the v9 booking request.",
|
|
4869
4869
|
cause: result.raw
|
|
4870
4870
|
}));
|
|
4871
4871
|
if (bookResponse.reservation?.id === void 0 || bookResponse.reservation.nr === void 0) return yield* Effect.fail(new CoreSDKError({
|
|
4872
|
-
source: "
|
|
4872
|
+
source: "v9",
|
|
4873
4873
|
operation: "v9.booking",
|
|
4874
4874
|
message: "vOffice booking response did not contain a reservation id and number.",
|
|
4875
4875
|
cause: result.raw
|
|
@@ -4887,7 +4887,7 @@ const book = ({ client, input, translations }) => Effect.gen(function* () {
|
|
|
4887
4887
|
if (!paymentScheduleOption.payableNow) return { paymentScheduleOption };
|
|
4888
4888
|
if (stripePaymentMethod === void 0) return { paymentScheduleOption };
|
|
4889
4889
|
if (stripePaymentKey === void 0) return yield* Effect.fail(new CoreSDKError({
|
|
4890
|
-
source: "
|
|
4890
|
+
source: "v9",
|
|
4891
4891
|
operation: "v9.booking",
|
|
4892
4892
|
message: "vOffice booking response did not contain a guest token for v9 Stripe payment initialization."
|
|
4893
4893
|
}));
|
|
@@ -4905,14 +4905,14 @@ const book = ({ client, input, translations }) => Effect.gen(function* () {
|
|
|
4905
4905
|
lang: language
|
|
4906
4906
|
}
|
|
4907
4907
|
}).pipe(Effect.mapError((cause) => new CoreSDKError({
|
|
4908
|
-
source: "
|
|
4908
|
+
source: "v9",
|
|
4909
4909
|
operation: "v9.booking",
|
|
4910
4910
|
message: "Failed to initialize v9 Stripe payment.",
|
|
4911
4911
|
cause
|
|
4912
4912
|
})));
|
|
4913
4913
|
const stripeResponse = stripeResult.raw;
|
|
4914
4914
|
if (stripeResponse.ok === false) return yield* Effect.fail(new CoreSDKError({
|
|
4915
|
-
source: "
|
|
4915
|
+
source: "v9",
|
|
4916
4916
|
operation: "v9.booking",
|
|
4917
4917
|
message: "vOffice rejected the v9 Stripe payment initialization.",
|
|
4918
4918
|
cause: stripeResult.raw
|
|
@@ -4955,7 +4955,7 @@ const makeV9BookingApi = ({ config, options }) => {
|
|
|
4955
4955
|
interval: "1 second",
|
|
4956
4956
|
maxQueueSize: 5,
|
|
4957
4957
|
onQueueFull: (maxQueueSize) => new CoreSDKError({
|
|
4958
|
-
source: "
|
|
4958
|
+
source: "v9",
|
|
4959
4959
|
operation: "v9.booking",
|
|
4960
4960
|
message: `v9 booking rate limit queue is full (${maxQueueSize} total request(s)).`
|
|
4961
4961
|
})
|
|
@@ -5027,13 +5027,13 @@ const submit = ({ client, input }) => Effect.gen(function* () {
|
|
|
5027
5027
|
data: JSON.stringify(contactInput),
|
|
5028
5028
|
lang: localeToLanguage(input.locale ?? "de-DE")
|
|
5029
5029
|
} }).pipe(Effect.mapError((cause) => new CoreSDKError({
|
|
5030
|
-
source: "
|
|
5030
|
+
source: "v9",
|
|
5031
5031
|
operation: "v9.contact",
|
|
5032
5032
|
message: "Failed to submit v9 contact request through the v0 OpenAPI client.",
|
|
5033
5033
|
cause
|
|
5034
5034
|
})));
|
|
5035
5035
|
if (result.raw.ok === false) return yield* Effect.fail(new CoreSDKError({
|
|
5036
|
-
source: "
|
|
5036
|
+
source: "v9",
|
|
5037
5037
|
operation: "v9.contact",
|
|
5038
5038
|
message: "vOffice rejected the v9 contact request.",
|
|
5039
5039
|
cause: result.raw
|
|
@@ -5048,7 +5048,7 @@ const makeV9ContactApi = ({ config, options }) => {
|
|
|
5048
5048
|
interval: "1 second",
|
|
5049
5049
|
maxQueueSize: 5,
|
|
5050
5050
|
onQueueFull: (maxQueueSize) => new CoreSDKError({
|
|
5051
|
-
source: "
|
|
5051
|
+
source: "v9",
|
|
5052
5052
|
operation: "v9.contact",
|
|
5053
5053
|
message: `v9 contact rate limit queue is full (${maxQueueSize} total request(s)).`
|
|
5054
5054
|
})
|
|
@@ -5171,13 +5171,13 @@ const selectedInsuranceOption = (quote) => {
|
|
|
5171
5171
|
//#endregion
|
|
5172
5172
|
//#region src/legacy-v9/live/quote-insurance.ts
|
|
5173
5173
|
const toInsuranceError = (message) => (cause) => new CoreSDKError({
|
|
5174
|
-
source: "
|
|
5174
|
+
source: "v9",
|
|
5175
5175
|
operation: "v9.insurance",
|
|
5176
5176
|
message,
|
|
5177
5177
|
cause
|
|
5178
5178
|
});
|
|
5179
5179
|
const failInsurance = (message) => Effect.fail(new CoreSDKError({
|
|
5180
|
-
source: "
|
|
5180
|
+
source: "v9",
|
|
5181
5181
|
operation: "v9.insurance",
|
|
5182
5182
|
message
|
|
5183
5183
|
}));
|
|
@@ -5380,7 +5380,7 @@ const createV9InsurancePreContract = ({ quote, customerInformation, v1Client })
|
|
|
5380
5380
|
const result = yield* v1Client.execute("createErgoPreContract", { body }).pipe(Effect.mapError(toInsuranceError("Failed to create ERGO pre-contract information.")));
|
|
5381
5381
|
const preContract = toInsurancePreContractOutput(result.raw);
|
|
5382
5382
|
if (preContract.kind !== "created") return yield* Effect.fail(new CoreSDKError({
|
|
5383
|
-
source: "
|
|
5383
|
+
source: "v9",
|
|
5384
5384
|
operation: "v9.insurance",
|
|
5385
5385
|
message: "ERGO pre-contract response did not contain a pre-contract ID.",
|
|
5386
5386
|
cause: result.raw
|
|
@@ -5425,7 +5425,7 @@ const bookV9Insurance = ({ quote, bookingNumber, guestToken, v1Client }) => Effe
|
|
|
5425
5425
|
const result = yield* v1Client.execute("bookErgoTravelCancellationInsurance", { body }).pipe(Effect.mapError(toInsuranceError("Failed to book ERGO insurance.")));
|
|
5426
5426
|
const bookingOutput = toInsuranceBookingOutput(result.raw);
|
|
5427
5427
|
if (bookingOutput.kind !== "booked") return yield* Effect.fail(new CoreSDKError({
|
|
5428
|
-
source: "
|
|
5428
|
+
source: "v9",
|
|
5429
5429
|
operation: "v9.insurance",
|
|
5430
5430
|
message: "ERGO insurance booking response did not contain a policy number.",
|
|
5431
5431
|
cause: result.raw
|
|
@@ -5447,7 +5447,7 @@ const loadQuoteRuntime = Effect.tryPromise({
|
|
|
5447
5447
|
return { toGuestQuote: (await import("./quote-cjFdLn0m.mjs")).toGuestQuote };
|
|
5448
5448
|
},
|
|
5449
5449
|
catch: (cause) => new CoreSDKError({
|
|
5450
|
-
source: "
|
|
5450
|
+
source: "v9",
|
|
5451
5451
|
operation: "v9.quote",
|
|
5452
5452
|
message: "Failed to load v9 quote runtime.",
|
|
5453
5453
|
cause
|
|
@@ -5457,7 +5457,7 @@ const toVofficeUnitId = (input) => {
|
|
|
5457
5457
|
const unitId = Number(input.rentalId);
|
|
5458
5458
|
if (Number.isInteger(unitId)) return Effect.succeed(unitId);
|
|
5459
5459
|
return Effect.fail(new CoreSDKError({
|
|
5460
|
-
source: "
|
|
5460
|
+
source: "v9",
|
|
5461
5461
|
operation: "v9.quote",
|
|
5462
5462
|
message: `Expected rentalId to be a vOffice unit ID, received "${input.rentalId}".`
|
|
5463
5463
|
}));
|
|
@@ -5478,7 +5478,7 @@ const quote = (client, v0Client, translations, limitQuote, input, shouldAddPropo
|
|
|
5478
5478
|
...input.voucher === void 0 ? {} : { voucherCode: input.voucher }
|
|
5479
5479
|
}
|
|
5480
5480
|
}).pipe(Effect.mapError((cause) => new CoreSDKError({
|
|
5481
|
-
source: "
|
|
5481
|
+
source: "v9",
|
|
5482
5482
|
operation: "v9.quote",
|
|
5483
5483
|
message: "Failed to load v9 quote prices from the v1 OpenAPI client.",
|
|
5484
5484
|
cause
|
|
@@ -5503,7 +5503,7 @@ const makeV9QuoteApi = ({ config, options }) => {
|
|
|
5503
5503
|
interval: "1 second",
|
|
5504
5504
|
maxQueueSize: 5,
|
|
5505
5505
|
onQueueFull: (maxQueueSize) => new CoreSDKError({
|
|
5506
|
-
source: "
|
|
5506
|
+
source: "v9",
|
|
5507
5507
|
operation: "v9.quote",
|
|
5508
5508
|
message: `v9 quote rate limit queue is full (${maxQueueSize} total request(s)).`
|
|
5509
5509
|
})
|
|
@@ -5684,20 +5684,20 @@ const makeV9GraphQLClient = (config) => ({ execute: (document, variables) => Eff
|
|
|
5684
5684
|
return body;
|
|
5685
5685
|
},
|
|
5686
5686
|
catch: (cause) => new CoreSDKError({
|
|
5687
|
-
source: "
|
|
5687
|
+
source: "v9",
|
|
5688
5688
|
operation: "v9.graphql.transport",
|
|
5689
5689
|
message: "v9 GraphQL transport request failed.",
|
|
5690
5690
|
cause
|
|
5691
5691
|
})
|
|
5692
5692
|
}).pipe(Effect.flatMap((body) => {
|
|
5693
5693
|
if (body.errors?.length) return Effect.fail(new CoreSDKError({
|
|
5694
|
-
source: "
|
|
5694
|
+
source: "v9",
|
|
5695
5695
|
operation: "v9.graphql.decode",
|
|
5696
5696
|
message: "v9 GraphQL response contained errors.",
|
|
5697
5697
|
cause: body.errors
|
|
5698
5698
|
}));
|
|
5699
5699
|
if (body.data === void 0) return Effect.fail(new CoreSDKError({
|
|
5700
|
-
source: "
|
|
5700
|
+
source: "v9",
|
|
5701
5701
|
operation: "v9.graphql.decode",
|
|
5702
5702
|
message: "v9 GraphQL response did not include data."
|
|
5703
5703
|
}));
|
|
@@ -5733,7 +5733,7 @@ const toV9PropertyScope = (scope) => {
|
|
|
5733
5733
|
const validateV9RentalScope = (scope) => {
|
|
5734
5734
|
if (toV9PropertyScope(scope).kind !== "invalid") return;
|
|
5735
5735
|
throw new CoreSDKError({
|
|
5736
|
-
source: "
|
|
5736
|
+
source: "v9",
|
|
5737
5737
|
operation: "v9.config",
|
|
5738
5738
|
message: `Expected rentalScope.propertyId to be a vOffice property ID, received "${scope.propertyId}".`
|
|
5739
5739
|
});
|
|
@@ -5770,39 +5770,41 @@ const V9_SEARCH_CURSOR_PREFIX = "page:";
|
|
|
5770
5770
|
*/
|
|
5771
5771
|
const ALL_RENTALS_PAGE_SIZE = 10;
|
|
5772
5772
|
const ALL_RENTALS_CONCURRENCY = 8;
|
|
5773
|
+
/** The hub silently leaves every rental after the 128th of a request unpriced. */
|
|
5774
|
+
const MAX_PRICED_PAGE_SIZE = 128;
|
|
5773
5775
|
/** A map search prices nothing; the hub answers 1000 matches in one request. */
|
|
5774
5776
|
const MAP_SEARCH_PAGE_SIZE = 1e3;
|
|
5775
5777
|
const toV9SearchCursor = (page) => `${V9_SEARCH_CURSOR_PREFIX}${page}`;
|
|
5776
5778
|
const parseV9SearchCursor = (cursor) => Effect.gen(function* () {
|
|
5777
5779
|
if (!cursor.startsWith(V9_SEARCH_CURSOR_PREFIX)) return yield* Effect.fail(new CoreSDKError({
|
|
5778
|
-
source: "
|
|
5780
|
+
source: "v9",
|
|
5779
5781
|
operation: "v9.search",
|
|
5780
5782
|
message: "Invalid v9 search cursor."
|
|
5781
5783
|
}));
|
|
5782
5784
|
const page = Number(cursor.slice(5));
|
|
5783
5785
|
if (!Number.isInteger(page) || page < 1) return yield* Effect.fail(new CoreSDKError({
|
|
5784
|
-
source: "
|
|
5786
|
+
source: "v9",
|
|
5785
5787
|
operation: "v9.search",
|
|
5786
5788
|
message: "Invalid v9 search cursor."
|
|
5787
5789
|
}));
|
|
5788
5790
|
return page;
|
|
5789
5791
|
});
|
|
5790
5792
|
const loadV9SearchRuntime = Effect.tryPromise({
|
|
5791
|
-
try: () => import("./search-
|
|
5793
|
+
try: () => import("./search-DtBtzIGf.mjs"),
|
|
5792
5794
|
catch: (cause) => new CoreSDKError({
|
|
5793
|
-
source: "
|
|
5795
|
+
source: "v9",
|
|
5794
5796
|
operation: "v9.search.runtime",
|
|
5795
5797
|
message: "Failed to load v9 live search runtime.",
|
|
5796
5798
|
cause
|
|
5797
5799
|
})
|
|
5798
5800
|
});
|
|
5799
5801
|
const failSearch = ({ operation, message }) => Effect.runPromise(Effect.fail(new CoreSDKError({
|
|
5800
|
-
source: "
|
|
5802
|
+
source: "v9",
|
|
5801
5803
|
operation,
|
|
5802
5804
|
message
|
|
5803
5805
|
})));
|
|
5804
5806
|
const tooManyRentals = (totalCount) => new CoreSDKError({
|
|
5805
|
-
source: "
|
|
5807
|
+
source: "v9",
|
|
5806
5808
|
operation: "search.allRentalsAtOnce",
|
|
5807
5809
|
message: `The search matches ${totalCount} rentals; searchAllRentalsAtOnce supports at most ${SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS}. Use paged search and mapSearch instead.`
|
|
5808
5810
|
});
|
|
@@ -5815,6 +5817,19 @@ const uniqueById = (entries, toId) => {
|
|
|
5815
5817
|
return true;
|
|
5816
5818
|
});
|
|
5817
5819
|
};
|
|
5820
|
+
const splitEntries = (entries) => ({
|
|
5821
|
+
items: entries.flatMap((entry) => entry.type === "item" ? [entry.item] : []),
|
|
5822
|
+
alternatives: entries.flatMap((entry) => entry.type === "alternative" ? [entry.alternative] : [])
|
|
5823
|
+
});
|
|
5824
|
+
const toUniqueResults = (entries) => {
|
|
5825
|
+
const split = splitEntries(entries);
|
|
5826
|
+
const items = uniqueById(split.items, (item) => item.id);
|
|
5827
|
+
const itemIds = new Set(items.map((item) => item.id));
|
|
5828
|
+
return {
|
|
5829
|
+
items,
|
|
5830
|
+
alternatives: uniqueById(split.alternatives, (alternative) => alternative.item.id).filter((alternative) => !itemIds.has(alternative.item.id))
|
|
5831
|
+
};
|
|
5832
|
+
};
|
|
5818
5833
|
const makeV9SearchApi = ({ config, options }) => {
|
|
5819
5834
|
const graphql = makeV9GraphQLClient(config);
|
|
5820
5835
|
const translations = makeV9TranslationService(options.translationOverrides);
|
|
@@ -5823,7 +5838,7 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
5823
5838
|
interval: "1 second",
|
|
5824
5839
|
maxQueueSize: 5,
|
|
5825
5840
|
onQueueFull: (maxQueueSize) => new CoreSDKError({
|
|
5826
|
-
source: "
|
|
5841
|
+
source: "v9",
|
|
5827
5842
|
operation: "v9.search",
|
|
5828
5843
|
message: `v9 search rate limit queue is full (${maxQueueSize} total request(s)).`
|
|
5829
5844
|
})
|
|
@@ -5902,11 +5917,49 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
5902
5917
|
};
|
|
5903
5918
|
})));
|
|
5904
5919
|
return {
|
|
5905
|
-
|
|
5906
|
-
|
|
5920
|
+
...splitEntries(entries),
|
|
5921
|
+
entries,
|
|
5907
5922
|
paginatorInfo: data.search.paginatorInfo
|
|
5908
5923
|
};
|
|
5909
5924
|
});
|
|
5925
|
+
const countMatches = ({ input, runtime, scopedQueryInput }) => graphql.execute(runtime.mapSearchQuery, {
|
|
5926
|
+
first: 1,
|
|
5927
|
+
page: 1,
|
|
5928
|
+
language: localeToLanguage(input.locale),
|
|
5929
|
+
...scopedQueryInput
|
|
5930
|
+
}).pipe(Effect.map((data) => data.search.paginatorInfo.total));
|
|
5931
|
+
const searchPricedWindow = ({ input, runtime, scopedQueryInput, page, limit }) => Effect.gen(function* () {
|
|
5932
|
+
const fetchWindow = Effect.gen(function* () {
|
|
5933
|
+
const totalCount = yield* countMatches({
|
|
5934
|
+
input,
|
|
5935
|
+
runtime,
|
|
5936
|
+
scopedQueryInput
|
|
5937
|
+
});
|
|
5938
|
+
const start = (page - 1) * limit;
|
|
5939
|
+
const end = Math.min(start + limit, totalCount);
|
|
5940
|
+
const firstBackendPage = Math.floor(start / MAX_PRICED_PAGE_SIZE) + 1;
|
|
5941
|
+
const lastBackendPage = Math.ceil(end / MAX_PRICED_PAGE_SIZE);
|
|
5942
|
+
const pages = yield* Effect.all(Array.from({ length: Math.max(0, lastBackendPage - firstBackendPage + 1) }, (_, index) => searchPage({
|
|
5943
|
+
input,
|
|
5944
|
+
runtime,
|
|
5945
|
+
scopedQueryInput,
|
|
5946
|
+
page: firstBackendPage + index,
|
|
5947
|
+
first: MAX_PRICED_PAGE_SIZE
|
|
5948
|
+
})), { concurrency: ALL_RENTALS_CONCURRENCY });
|
|
5949
|
+
const offset = start - (firstBackendPage - 1) * MAX_PRICED_PAGE_SIZE;
|
|
5950
|
+
const entries = pages.flatMap((backendPage) => backendPage.entries).slice(offset, offset + limit);
|
|
5951
|
+
const { items, alternatives } = toUniqueResults(entries);
|
|
5952
|
+
return {
|
|
5953
|
+
items,
|
|
5954
|
+
alternatives,
|
|
5955
|
+
hasNextPage: start + limit < totalCount,
|
|
5956
|
+
totalCount,
|
|
5957
|
+
isConsistent: pages.every((backendPage) => backendPage.paginatorInfo.total === totalCount) && items.length + alternatives.length === Math.max(0, end - start)
|
|
5958
|
+
};
|
|
5959
|
+
});
|
|
5960
|
+
const window = yield* fetchWindow;
|
|
5961
|
+
return window.isConsistent ? window : yield* fetchWindow;
|
|
5962
|
+
});
|
|
5910
5963
|
const searchOnePage = (input) => Effect.runPromise(limitSearch(Effect.gen(function* () {
|
|
5911
5964
|
const { runtime, appliedFilters, unusedFilterKeys, scopedQueryInput } = yield* toScopedQuery(input);
|
|
5912
5965
|
if (scopedQueryInput === void 0) return {
|
|
@@ -5919,12 +5972,33 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
5919
5972
|
}
|
|
5920
5973
|
};
|
|
5921
5974
|
const page = input.cursor === void 0 ? 1 : yield* parseV9SearchCursor(input.cursor);
|
|
5975
|
+
const limit = input.limit ?? DEFAULT_SEARCH_LIMIT;
|
|
5976
|
+
if (limit > MAX_PRICED_PAGE_SIZE) {
|
|
5977
|
+
const { items, alternatives, hasNextPage, totalCount } = yield* searchPricedWindow({
|
|
5978
|
+
input,
|
|
5979
|
+
runtime,
|
|
5980
|
+
scopedQueryInput,
|
|
5981
|
+
page,
|
|
5982
|
+
limit
|
|
5983
|
+
});
|
|
5984
|
+
return {
|
|
5985
|
+
items,
|
|
5986
|
+
...alternatives.length > 0 ? { alternatives } : {},
|
|
5987
|
+
appliedFilters,
|
|
5988
|
+
unusedFilterKeys,
|
|
5989
|
+
pageInfo: {
|
|
5990
|
+
hasNextPage,
|
|
5991
|
+
...hasNextPage ? { nextCursor: toV9SearchCursor(page + 1) } : {},
|
|
5992
|
+
totalCount
|
|
5993
|
+
}
|
|
5994
|
+
};
|
|
5995
|
+
}
|
|
5922
5996
|
const { items, alternatives, paginatorInfo } = yield* searchPage({
|
|
5923
5997
|
input,
|
|
5924
5998
|
runtime,
|
|
5925
5999
|
scopedQueryInput,
|
|
5926
6000
|
page,
|
|
5927
|
-
first:
|
|
6001
|
+
first: limit
|
|
5928
6002
|
});
|
|
5929
6003
|
return {
|
|
5930
6004
|
items,
|
|
@@ -5952,12 +6026,11 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
5952
6026
|
totalCount: 0
|
|
5953
6027
|
}
|
|
5954
6028
|
};
|
|
5955
|
-
const totalCount =
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
})).search.paginatorInfo.total;
|
|
6029
|
+
const totalCount = yield* countMatches({
|
|
6030
|
+
input,
|
|
6031
|
+
runtime,
|
|
6032
|
+
scopedQueryInput
|
|
6033
|
+
});
|
|
5961
6034
|
if (totalCount > SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS) return yield* Effect.fail(tooManyRentals(totalCount));
|
|
5962
6035
|
const pages = yield* Effect.all(Array.from({ length: Math.ceil(totalCount / ALL_RENTALS_PAGE_SIZE) }, (_, index) => searchPage({
|
|
5963
6036
|
input,
|
|
@@ -5966,9 +6039,7 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
5966
6039
|
page: index + 1,
|
|
5967
6040
|
first: ALL_RENTALS_PAGE_SIZE
|
|
5968
6041
|
})), { concurrency: ALL_RENTALS_CONCURRENCY });
|
|
5969
|
-
const items =
|
|
5970
|
-
const itemIds = new Set(items.map((item) => item.id));
|
|
5971
|
-
const alternatives = uniqueById(pages.flatMap((page) => page.alternatives), (alternative) => alternative.item.id).filter((alternative) => !itemIds.has(alternative.item.id));
|
|
6042
|
+
const { items, alternatives } = toUniqueResults(pages.flatMap((page) => page.entries));
|
|
5972
6043
|
const toOutput = (result) => ({
|
|
5973
6044
|
items: result.items,
|
|
5974
6045
|
...result.alternatives.length > 0 ? { alternatives: result.alternatives } : {},
|
|
@@ -6037,9 +6108,39 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
6037
6108
|
unusedFilterKeys
|
|
6038
6109
|
};
|
|
6039
6110
|
})));
|
|
6111
|
+
async function* searchPages(input) {
|
|
6112
|
+
if (options.searchAllRentalsAtOnce) return await failSearch({
|
|
6113
|
+
operation: "search.searchPages",
|
|
6114
|
+
message: "searchPages is not available with searchAllRentalsAtOnce; search already returns every result."
|
|
6115
|
+
});
|
|
6116
|
+
const { cursor: _cursor, limit: _limit, ...searchInput } = input;
|
|
6117
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
6118
|
+
let cursor;
|
|
6119
|
+
for (let pageCount = 1;; pageCount++) {
|
|
6120
|
+
const { alternatives: pageAlternatives = [], ...output } = await searchOnePage({
|
|
6121
|
+
...searchInput,
|
|
6122
|
+
limit: MAX_PRICED_PAGE_SIZE,
|
|
6123
|
+
...cursor === void 0 ? {} : { cursor }
|
|
6124
|
+
});
|
|
6125
|
+
const items = output.items.filter((item) => !seenIds.has(item.id));
|
|
6126
|
+
const alternatives = pageAlternatives.filter((alternative) => !seenIds.has(alternative.item.id));
|
|
6127
|
+
if (pageCount > 1 && items.length + alternatives.length === 0) return;
|
|
6128
|
+
for (const item of items) seenIds.add(item.id);
|
|
6129
|
+
for (const alternative of alternatives) seenIds.add(alternative.item.id);
|
|
6130
|
+
yield {
|
|
6131
|
+
...output,
|
|
6132
|
+
items,
|
|
6133
|
+
...alternatives.length > 0 ? { alternatives } : {}
|
|
6134
|
+
};
|
|
6135
|
+
const { hasNextPage, nextCursor, totalCount } = output.pageInfo;
|
|
6136
|
+
if (!hasNextPage || nextCursor === void 0 || nextCursor === cursor || pageCount >= Math.ceil(totalCount / MAX_PRICED_PAGE_SIZE)) return;
|
|
6137
|
+
cursor = nextCursor;
|
|
6138
|
+
}
|
|
6139
|
+
}
|
|
6040
6140
|
return {
|
|
6041
6141
|
search: (input) => options.searchAllRentalsAtOnce ? searchAllRentals(input) : searchOnePage(input),
|
|
6042
|
-
mapSearch
|
|
6142
|
+
mapSearch,
|
|
6143
|
+
searchPages
|
|
6043
6144
|
};
|
|
6044
6145
|
};
|
|
6045
6146
|
//#endregion
|
|
@@ -6336,9 +6437,9 @@ const orderRentalsById = ({ rentalIds, rentals }) => {
|
|
|
6336
6437
|
});
|
|
6337
6438
|
};
|
|
6338
6439
|
const loadV9RentalsRuntime = Effect.tryPromise({
|
|
6339
|
-
try: () => import("./rentals-
|
|
6440
|
+
try: () => import("./rentals-D4wmqjzL.mjs"),
|
|
6340
6441
|
catch: (cause) => new CoreSDKError({
|
|
6341
|
-
source: "
|
|
6442
|
+
source: "v9",
|
|
6342
6443
|
operation: "v9.rentals.runtime",
|
|
6343
6444
|
message: "Failed to load v9 rentals runtime.",
|
|
6344
6445
|
cause
|
|
@@ -6490,7 +6591,8 @@ function createWebsiteSDK({ config, options }) {
|
|
|
6490
6591
|
contact: { submit: contact.submit },
|
|
6491
6592
|
search: {
|
|
6492
6593
|
search: search.search,
|
|
6493
|
-
mapSearch: search.mapSearch
|
|
6594
|
+
mapSearch: search.mapSearch,
|
|
6595
|
+
searchPages: search.searchPages
|
|
6494
6596
|
},
|
|
6495
6597
|
availability: {
|
|
6496
6598
|
getInitialAvailability: availability.getInitialAvailability,
|
package/dist/index.d.mts
CHANGED
|
@@ -97,6 +97,10 @@ type V9SearchSearchInput = Omit<SearchSearchInput$1, "rentalIdsIn" | "voucher" |
|
|
|
97
97
|
readonly voucher?: never;
|
|
98
98
|
readonly sort?: V9SearchSearchSort;
|
|
99
99
|
};
|
|
100
|
+
type V9SearchPagesInput = Omit<V9SearchSearchInput, "cursor" | "limit"> & {
|
|
101
|
+
readonly cursor?: never;
|
|
102
|
+
readonly limit?: never;
|
|
103
|
+
};
|
|
100
104
|
/** `search` input with `searchAllRentalsAtOnce: true`: one call returns every result, so there are no pages. */
|
|
101
105
|
type V9SearchAllRentalsAtOnceInput = Omit<V9SearchSearchInput, "cursor" | "limit"> & {
|
|
102
106
|
readonly cursor?: never;
|
|
@@ -179,6 +183,7 @@ type WebsiteSDKV9Live = Omit<WebsiteSDKSharedLive, "search"> & {
|
|
|
179
183
|
readonly search: {
|
|
180
184
|
readonly search: (input: V9SearchSearchInput) => Promise<V9SearchSearchOutput>;
|
|
181
185
|
readonly mapSearch: WebsiteSDKSharedLive["search"]["mapSearch"];
|
|
186
|
+
readonly searchPages: (input: V9SearchPagesInput) => AsyncIterable<V9SearchSearchOutput>;
|
|
182
187
|
};
|
|
183
188
|
};
|
|
184
189
|
/** `live` of a v9 SDK created with `searchAllRentalsAtOnce: true`. */
|
|
@@ -7612,4 +7617,4 @@ export type RentalRentalsOutput = RentalGetRentalsOutput$1[number];
|
|
|
7612
7617
|
export type RentalSearchInput = SearchSearchInput$1;
|
|
7613
7618
|
export type RentalSearchOutput = SearchSearchOutput$1;
|
|
7614
7619
|
//#endregion
|
|
7615
|
-
export { AdditionalServiceLimitExceeded, type AvailabilityGetInitialAvailabilityInput, type AvailabilityGetInitialAvailabilityOutput, type AvailabilityGetStartDateSelectedAvailabilityInput, type AvailabilityGetStartDateSelectedAvailabilityOutput, type BackendKind, type BookingBankTransferDetails, type BookingBookInput, type BookingBookOutput, type BookingPayment, type BookingPaymentAlternative, type BookingPaymentOption, type BookingPaymentScheduleItem, type BookingPaymentScheduleKind, type BookingPaymentScheduleLine, CMSError, type ContactSubmitInput, type ContactSubmitOutput, type ContactSubmitValidationIssue, type ContactSubmitValidationIssueCode, CoreSDKError, type CustomAttributeCatalog, type CustomAttributeCatalogDefinitionInput, type CustomAttributeCatalogInput, CustomAttributeCatalogSchema, type CustomAttributeCategoryKey, type CustomAttributeFilterCategoryKey, type CustomAttributeFilterDefinition, type CustomAttributeFilterExpression, type CustomAttributeFilterLabel, type CustomAttributeFilterNumericBounds, type CustomAttributeFilterOption, type CustomAttributeOverridesInput, type CustomAttributeRegistry, type CustomAttributeRegistrySnapshot, type CustomAttributeSelection, type CustomDataAttribute, type DataAttribute, type DocumentsGetTermsAndPrivacyPolicyInput, type DocumentsGetTermsAndPrivacyPolicyOutput, type FilterGetFiltersInput, type FilterGetFiltersOutput, type GeoLocation, type GuestQuote, type GuestQuoteInput, type GuestQuoteInsurance, type GuestQuoteResult, GuestQuoteSchema, type GuestQuoteSelectionResult, type GuestQuoteVoucher, type ImageData, type InsuranceBookingOutput, type InsuranceCustomerInformationInput, type InsurancePaymentInformationInput, type InsurancePaymentOptionOutput, type InsurancePreContractOutput, InvalidAdditionalServiceQuantity, type KnownVofficeFacilityData, type KnownVofficeFacilityDataAttribute, type KnownVofficeFeedbackData, type KnownVofficeFeedbackDataAttribute, type KnownVofficeImageData, type KnownVofficeImageDataAttribute, type KnownVofficeOfferData, type KnownVofficeOfferDataAttribute, type KnownVofficePriceData, type KnownVofficePriceDataAttribute, type KnownVofficeRatingData, type KnownVofficeRatingDataAttribute, type KnownVofficeServiceData, type KnownVofficeServiceDataAttribute, type KnownVofficeTotalRatingData, type KnownVofficeTotalRatingDataAttribute, type KnownVofficeUnitData, type KnownVofficeUnitDataAttribute, type Locale, LocaleSchema, type ParsedJsonData, type ParsedVofficeFacilityData, type ParsedVofficeFeedbackData, type ParsedVofficeImageData, type ParsedVofficeOfferData, type ParsedVofficePriceData, type ParsedVofficeRatingData, type ParsedVofficeServiceData, type ParsedVofficeTotalRatingData, type ParsedVofficeUnitData, type QuoteQuoteInput, type QuoteQuoteOutput, type RentalGetRentalsInput, type RentalGetRentalsOutput, type RentalHighlightPrioritizationKey, type RentalPropertyHighlightPrioritizationKey, type ResolvedCustomAttribute, type ResolvedV9PropertyHighlightSource, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, type SearchAllRentalsAtOnceInput, type SearchMapSearchInput, SearchMapSearchInputSchema, type SearchMapSearchOutput, type SearchMapSearchOutputItem, SearchMapSearchOutputSchema, type SearchSearchFieldOrderBy, SearchSearchFieldOrderBySchema, type SearchSearchFieldSort, SearchSearchFieldSortSchema, type SearchSearchInput, SearchSearchInputSchema, type SearchSearchOutput, SearchSearchOutputSchema, type SearchSearchPriceSort, SearchSearchPriceSortSchema, type SearchSearchRandomSort, SearchSearchRandomSortSchema, type SearchSearchRatingSort, SearchSearchRatingSortSchema, type SearchSearchSort, SearchSearchSortSchema, type SearchSortDirection, SearchSortDirectionSchema, type SelectableInsuranceOptionOutput, type SelectedInsuranceInformationInput, type SubmittableBookingPaymentOption, type TranslationOverrides, UnknownAdditionalService, type V0OpenApiClientOptions, type V0OpenApiOperationId, type V0OpenApiOperationRequest, type V0OpenApiOperationResponse, type V1OpenApiClientOptions, type components as V1OpenApiComponents, type V1OpenApiOperationId, type V1OpenApiOperationRequest, type V1OpenApiOperationResponse, type operations as V1OpenApiOperations, type paths as V1OpenApiPaths, type V9OnlyCustomAttributeInput, type V9PropertyHighlightDataAttribute, type V9PropertyHighlightSourceInput, type V9PropertyHighlightSourceRegistry, type V9PropertyHighlightSourcesInput, type V9ReviewCriterion, type V9ReviewCriterionDataAttribute, type V9ReviewsOptions, type V9SearchAllRentalsAtOnceInput, type V9SearchSearchInput, type V9SearchSearchOutput, type V9SearchSearchOutputItem, type V9SearchSearchSort, type VofficeFacilityDataAttribute, type VofficeFacilityDataAttributes, type VofficeFeedbackDataAttribute, type VofficeFeedbackDataAttributes, type VofficeImageDataAttribute, type VofficeImageDataAttributes, type VofficeOfferDataAttribute, type VofficeOfferDataAttributes, type VofficePriceDataAttribute, type VofficePriceDataAttributes, type VofficeRatingDataAttribute, type VofficeRatingDataAttributes, type VofficeServiceDataAttribute, type VofficeServiceDataAttributes, type VofficeTotalRatingDataAttribute, type VofficeTotalRatingDataAttributes, type VofficeUnitDataAttribute, type VofficeUnitDataAttributes, type WebsiteSDK, type WebsiteSDKAllRentalsAtOnce, type WebsiteSDKConfig, type WebsiteSDKOptions, type WebsiteSDKSharedLive, type WebsiteSDKSharedStatic, type WebsiteSDKV10, type WebsiteSDKV10AllRentalsAtOnce, type WebsiteSDKV10AllRentalsAtOnceLive, type WebsiteSDKV10Live, type WebsiteSDKV10Static, type WebsiteSDKV9, type WebsiteSDKV9AllRentalsAtOnce, type WebsiteSDKV9AllRentalsAtOnceLive, type WebsiteSDKV9Live, defineWebsiteSDKOptions as defineCMSSDKOptions, defineCustomAttributes, defineCustomAttributesFromUnknown, fetchCustomAttributeCatalog, parseCustomAttributeCatalog, validateContactSubmitInput };
|
|
7620
|
+
export { AdditionalServiceLimitExceeded, type AvailabilityGetInitialAvailabilityInput, type AvailabilityGetInitialAvailabilityOutput, type AvailabilityGetStartDateSelectedAvailabilityInput, type AvailabilityGetStartDateSelectedAvailabilityOutput, type BackendKind, type BookingBankTransferDetails, type BookingBookInput, type BookingBookOutput, type BookingPayment, type BookingPaymentAlternative, type BookingPaymentOption, type BookingPaymentScheduleItem, type BookingPaymentScheduleKind, type BookingPaymentScheduleLine, CMSError, type ContactSubmitInput, type ContactSubmitOutput, type ContactSubmitValidationIssue, type ContactSubmitValidationIssueCode, CoreSDKError, type CustomAttributeCatalog, type CustomAttributeCatalogDefinitionInput, type CustomAttributeCatalogInput, CustomAttributeCatalogSchema, type CustomAttributeCategoryKey, type CustomAttributeFilterCategoryKey, type CustomAttributeFilterDefinition, type CustomAttributeFilterExpression, type CustomAttributeFilterLabel, type CustomAttributeFilterNumericBounds, type CustomAttributeFilterOption, type CustomAttributeOverridesInput, type CustomAttributeRegistry, type CustomAttributeRegistrySnapshot, type CustomAttributeSelection, type CustomDataAttribute, type DataAttribute, type DocumentsGetTermsAndPrivacyPolicyInput, type DocumentsGetTermsAndPrivacyPolicyOutput, type FilterGetFiltersInput, type FilterGetFiltersOutput, type GeoLocation, type GuestQuote, type GuestQuoteInput, type GuestQuoteInsurance, type GuestQuoteResult, GuestQuoteSchema, type GuestQuoteSelectionResult, type GuestQuoteVoucher, type ImageData, type InsuranceBookingOutput, type InsuranceCustomerInformationInput, type InsurancePaymentInformationInput, type InsurancePaymentOptionOutput, type InsurancePreContractOutput, InvalidAdditionalServiceQuantity, type KnownVofficeFacilityData, type KnownVofficeFacilityDataAttribute, type KnownVofficeFeedbackData, type KnownVofficeFeedbackDataAttribute, type KnownVofficeImageData, type KnownVofficeImageDataAttribute, type KnownVofficeOfferData, type KnownVofficeOfferDataAttribute, type KnownVofficePriceData, type KnownVofficePriceDataAttribute, type KnownVofficeRatingData, type KnownVofficeRatingDataAttribute, type KnownVofficeServiceData, type KnownVofficeServiceDataAttribute, type KnownVofficeTotalRatingData, type KnownVofficeTotalRatingDataAttribute, type KnownVofficeUnitData, type KnownVofficeUnitDataAttribute, type Locale, LocaleSchema, type ParsedJsonData, type ParsedVofficeFacilityData, type ParsedVofficeFeedbackData, type ParsedVofficeImageData, type ParsedVofficeOfferData, type ParsedVofficePriceData, type ParsedVofficeRatingData, type ParsedVofficeServiceData, type ParsedVofficeTotalRatingData, type ParsedVofficeUnitData, type QuoteQuoteInput, type QuoteQuoteOutput, type RentalGetRentalsInput, type RentalGetRentalsOutput, type RentalHighlightPrioritizationKey, type RentalPropertyHighlightPrioritizationKey, type ResolvedCustomAttribute, type ResolvedV9PropertyHighlightSource, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, type SearchAllRentalsAtOnceInput, type SearchMapSearchInput, SearchMapSearchInputSchema, type SearchMapSearchOutput, type SearchMapSearchOutputItem, SearchMapSearchOutputSchema, type SearchSearchFieldOrderBy, SearchSearchFieldOrderBySchema, type SearchSearchFieldSort, SearchSearchFieldSortSchema, type SearchSearchInput, SearchSearchInputSchema, type SearchSearchOutput, SearchSearchOutputSchema, type SearchSearchPriceSort, SearchSearchPriceSortSchema, type SearchSearchRandomSort, SearchSearchRandomSortSchema, type SearchSearchRatingSort, SearchSearchRatingSortSchema, type SearchSearchSort, SearchSearchSortSchema, type SearchSortDirection, SearchSortDirectionSchema, type SelectableInsuranceOptionOutput, type SelectedInsuranceInformationInput, type SubmittableBookingPaymentOption, type TranslationOverrides, UnknownAdditionalService, type V0OpenApiClientOptions, type V0OpenApiOperationId, type V0OpenApiOperationRequest, type V0OpenApiOperationResponse, type V1OpenApiClientOptions, type components as V1OpenApiComponents, type V1OpenApiOperationId, type V1OpenApiOperationRequest, type V1OpenApiOperationResponse, type operations as V1OpenApiOperations, type paths as V1OpenApiPaths, type V9OnlyCustomAttributeInput, type V9PropertyHighlightDataAttribute, type V9PropertyHighlightSourceInput, type V9PropertyHighlightSourceRegistry, type V9PropertyHighlightSourcesInput, type V9ReviewCriterion, type V9ReviewCriterionDataAttribute, type V9ReviewsOptions, type V9SearchAllRentalsAtOnceInput, type V9SearchPagesInput, type V9SearchSearchInput, type V9SearchSearchOutput, type V9SearchSearchOutputItem, type V9SearchSearchSort, type VofficeFacilityDataAttribute, type VofficeFacilityDataAttributes, type VofficeFeedbackDataAttribute, type VofficeFeedbackDataAttributes, type VofficeImageDataAttribute, type VofficeImageDataAttributes, type VofficeOfferDataAttribute, type VofficeOfferDataAttributes, type VofficePriceDataAttribute, type VofficePriceDataAttributes, type VofficeRatingDataAttribute, type VofficeRatingDataAttributes, type VofficeServiceDataAttribute, type VofficeServiceDataAttributes, type VofficeTotalRatingDataAttribute, type VofficeTotalRatingDataAttributes, type VofficeUnitDataAttribute, type VofficeUnitDataAttributes, type WebsiteSDK, type WebsiteSDKAllRentalsAtOnce, type WebsiteSDKConfig, type WebsiteSDKOptions, type WebsiteSDKSharedLive, type WebsiteSDKSharedStatic, type WebsiteSDKV10, type WebsiteSDKV10AllRentalsAtOnce, type WebsiteSDKV10AllRentalsAtOnceLive, type WebsiteSDKV10Live, type WebsiteSDKV10Static, type WebsiteSDKV9, type WebsiteSDKV9AllRentalsAtOnce, type WebsiteSDKV9AllRentalsAtOnceLive, type WebsiteSDKV9Live, defineWebsiteSDKOptions as defineCMSSDKOptions, defineCustomAttributes, defineCustomAttributesFromUnknown, fetchCustomAttributeCatalog, parseCustomAttributeCatalog, validateContactSubmitInput };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SearchPropertiesResponseSchema, A as ErgoBankSchema, At as getStartDateSelectedAvailabilityEffect, B as OnOfficeUnitCollectionResponseSchema, Bt as submitPaymentOption, C as DocumentResourceResponseSchema, Ct as bookInsuranceEffect, D as DocumentSummarySchema, Dt as getFiltersEffect, E as DocumentStatusUpdateRequestSchema, Et as getBankTransferDetailsEffect, F as ErgoPlanSearchRequestSchema, Ft as searchEffect, G as QuotePricesPayloadSchema, H as PaymentScheduleItemSchema, Ht as defineWebsiteSDKOptions, I as ErgoPolicyNumberRequestSchema, It as selectCancellationPolicyEffect, J as QuoteServiceSchema, K as QuotePricesResponseSchema, L as ErgoReadPreContractRequestSchema, Lt as selectInsuranceEffect, M as ErgoCommonFieldsSchema, Mt as mapSearchEffect, N as ErgoCreatePreContractRequestSchema, Nt as quoteEffect, O as DocumentTypeSchema, Ot as getInitialAvailabilityEffect, P as ErgoPersonSchema, Pt as removeAdditionalServiceEffect, Q as RoomImageSchema, R as ErgoTripAndCustomerRequestSchema, Rt as selectInsurancePaymentEffect, S as DocumentCollectionResponseSchema, St as bookEffect, T as DocumentStatusSchema, Tt as createInsurancePreContractEffect, U as PaymentScheduleSchema, Ut as defineV9PropertyHighlightSources, V as OnOfficeUnitSchema, Vt as submitPaymentOptionEffect, W as QuoteLineSchema, Wt as defineV9PropertyHighlightSourcesFromUnknown, X as RawVofficeObjectSchema, Y as RawObjectResponseSchema, Z as RegionListResponseSchema, _ as ApiEnvelopeBaseSchema, _t as V1_BASE_URL, at as SetupResponseSchema, b as CurrentMemberResponseSchema, bt as decodeV1OperationResponse, ct as TileTagSchema, d as makeV0OpenApiClientFetchLive, dt as UnitIdsResponseSchema, et as ServiceBeonDataSchema, f as makeV0OpenApiClientLive, ft as UnitListItemSchema, g as makeV1OpenApiClientLive, gt as UnitServicePriceSchema, h as makeV1OpenApiClientFetchLive, ht as UnitResponseSchema, it as SetupDataSchema, j as ErgoBookRequestSchema, jt as getTermsAndPrivacyPolicyEffect, k as ErgoAddressSchema, kt as getRentalsEffect, l as V0OpenApiClient, lt as TravelInsuranceBookingSchema, m as V1OpenApiClientError, mt as UnitOfferSchema, nt as ServiceLimitSchema, ot as TileCollectionResponseSchema, p as V1OpenApiClient, pt as UnitListResponseSchema, q as QuoteSchema, rt as ServiceListResponseSchema, st as TileSchema, t as createWebsiteSDK, tt as ServiceImageSchema, u as V0OpenApiClientError, ut as TravelInsuranceBookingStoreRequestSchema, v as CalendarDaySchema, vt as V1_OPERATIONS, w as DocumentResourceSchema, wt as clearAdditionalServicesEffect, x as CustomerUnitSummarySchema, xt as addAdditionalServiceEffect, y as CalendarResponseSchema, yt as VideoResponseSchema, z as FacilityListResponseSchema, zt as submitContactEffect } from "./client
|
|
1
|
+
import { $ as SearchPropertiesResponseSchema, A as ErgoBankSchema, At as getStartDateSelectedAvailabilityEffect, B as OnOfficeUnitCollectionResponseSchema, Bt as submitPaymentOption, C as DocumentResourceResponseSchema, Ct as bookInsuranceEffect, D as DocumentSummarySchema, Dt as getFiltersEffect, E as DocumentStatusUpdateRequestSchema, Et as getBankTransferDetailsEffect, F as ErgoPlanSearchRequestSchema, Ft as searchEffect, G as QuotePricesPayloadSchema, H as PaymentScheduleItemSchema, Ht as defineWebsiteSDKOptions, I as ErgoPolicyNumberRequestSchema, It as selectCancellationPolicyEffect, J as QuoteServiceSchema, K as QuotePricesResponseSchema, L as ErgoReadPreContractRequestSchema, Lt as selectInsuranceEffect, M as ErgoCommonFieldsSchema, Mt as mapSearchEffect, N as ErgoCreatePreContractRequestSchema, Nt as quoteEffect, O as DocumentTypeSchema, Ot as getInitialAvailabilityEffect, P as ErgoPersonSchema, Pt as removeAdditionalServiceEffect, Q as RoomImageSchema, R as ErgoTripAndCustomerRequestSchema, Rt as selectInsurancePaymentEffect, S as DocumentCollectionResponseSchema, St as bookEffect, T as DocumentStatusSchema, Tt as createInsurancePreContractEffect, U as PaymentScheduleSchema, Ut as defineV9PropertyHighlightSources, V as OnOfficeUnitSchema, Vt as submitPaymentOptionEffect, W as QuoteLineSchema, Wt as defineV9PropertyHighlightSourcesFromUnknown, X as RawVofficeObjectSchema, Y as RawObjectResponseSchema, Z as RegionListResponseSchema, _ as ApiEnvelopeBaseSchema, _t as V1_BASE_URL, at as SetupResponseSchema, b as CurrentMemberResponseSchema, bt as decodeV1OperationResponse, ct as TileTagSchema, d as makeV0OpenApiClientFetchLive, dt as UnitIdsResponseSchema, et as ServiceBeonDataSchema, f as makeV0OpenApiClientLive, ft as UnitListItemSchema, g as makeV1OpenApiClientLive, gt as UnitServicePriceSchema, h as makeV1OpenApiClientFetchLive, ht as UnitResponseSchema, it as SetupDataSchema, j as ErgoBookRequestSchema, jt as getTermsAndPrivacyPolicyEffect, k as ErgoAddressSchema, kt as getRentalsEffect, l as V0OpenApiClient, lt as TravelInsuranceBookingSchema, m as V1OpenApiClientError, mt as UnitOfferSchema, nt as ServiceLimitSchema, ot as TileCollectionResponseSchema, p as V1OpenApiClient, pt as UnitListResponseSchema, q as QuoteSchema, rt as ServiceListResponseSchema, st as TileSchema, t as createWebsiteSDK, tt as ServiceImageSchema, u as V0OpenApiClientError, ut as TravelInsuranceBookingStoreRequestSchema, v as CalendarDaySchema, vt as V1_OPERATIONS, w as DocumentResourceSchema, wt as clearAdditionalServicesEffect, x as CustomerUnitSummarySchema, xt as addAdditionalServiceEffect, y as CalendarResponseSchema, yt as VideoResponseSchema, z as FacilityListResponseSchema, zt as submitContactEffect } from "./client--T_tQSjV.mjs";
|
|
2
2
|
import { AdditionalServiceLimitExceeded, CoreSDKError, CoreSDKError as CMSError, CustomAttributeCatalogSchema, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchMapSearchInputSchema, SearchMapSearchOutputSchema, SearchSearchFieldOrderBySchema, SearchSearchFieldSortSchema, SearchSearchInputSchema, SearchSearchOutputSchema, SearchSearchPriceSortSchema, SearchSearchRandomSortSchema, SearchSearchRatingSortSchema, SearchSearchSortSchema, SearchSortDirectionSchema, UnknownAdditionalService, defineCustomAttributes, defineCustomAttributesFromUnknown, fetchCustomAttributeCatalog, parseCustomAttributeCatalog, validateContactSubmitInput } from "@v-office/sdk-core";
|
|
3
3
|
//#region codegen/v9/heuristic-generation/public-api.ts
|
|
4
4
|
const customDataAttribute = (name) => name;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Release notes of `@v-office/website-sdk`, newest first. Each version has its own directory.
|
|
6
6
|
|
|
7
|
+
- `versions/2.26.0/CHANGELOG.md`: release notes for 2.26.0
|
|
7
8
|
- `versions/2.25.0/CHANGELOG.md`: release notes for 2.25.0
|
|
8
9
|
- `versions/2.24.1/CHANGELOG.md`: release notes for 2.24.1
|
|
9
10
|
- `versions/2.24.0/CHANGELOG.md`: release notes for 2.24.0
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Migration guides of `@v-office/website-sdk`, newest first. Apply them in order when skipping versions.
|
|
6
6
|
|
|
7
|
+
- `versions/2.26.0/MIGRATION.md`: Migration: 2.25.0 to 2.26.0
|
|
7
8
|
- `versions/2.25.0/MIGRATION.md`: Migration: 2.24.1 to 2.25.0
|
|
8
9
|
- `versions/2.24.1/MIGRATION.md`: Migration: 2.24.0 to 2.24.1
|
|
9
10
|
- `versions/2.24.0/MIGRATION.md`: Migration: 2.23.0 to 2.24.0
|
|
@@ -10,7 +10,7 @@ Use this directory as the consumer-facing reference for the package:
|
|
|
10
10
|
- `rentals.md`: `sdk.static.rentals.getRentals`.
|
|
11
11
|
- `filter.md`: `sdk.static.filter.getFilters`.
|
|
12
12
|
- `custom-attributes.md`: custom attribute catalog, configuration, per-backend behaviour, and the v9-to-v10 move.
|
|
13
|
-
- `search.md`: `sdk.live.search.search`.
|
|
13
|
+
- `search.md`: `sdk.live.search.search` and, on v9, `sdk.live.search.searchPages`.
|
|
14
14
|
- `availability.md`: date-picker availability flows.
|
|
15
15
|
- `quote.md`: quote booking-card modifiers, additional services, cancellation policy, and insurance flows.
|
|
16
16
|
- `booking.md`: booking, payment option submission, and
|
|
@@ -207,7 +207,49 @@ Use `rentalIdsIn` to restrict results to specific rental IDs. This option is cur
|
|
|
207
207
|
Use `voucher` to price v10 search results with a voucher code. This option is currently supported by `v10` only.
|
|
208
208
|
For v10, `pets` is a mapped BooleanFilter exposed by `getFilters` and maps to one pet; use `petsCount` for an exact count and do not send both keys in one query.
|
|
209
209
|
|
|
210
|
-
`limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged
|
|
210
|
+
`limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged,
|
|
211
|
+
with the same `limit` as the call that returned it: the cursor points into pages of that size.
|
|
212
|
+
|
|
213
|
+
### v9: at most 128 priced results per request
|
|
214
|
+
|
|
215
|
+
The v9 hub prices at most the first 128 results of one request. It answers a larger
|
|
216
|
+
`limit` without an error, but every result past position 128 comes back without
|
|
217
|
+
`formattedTotal` and without `discount`. The SDK handles this for you:
|
|
218
|
+
|
|
219
|
+
- `limit` up to 128: one request, as before.
|
|
220
|
+
- `limit` above 128: the SDK splits the call into hub requests of 128 each, up to
|
|
221
|
+
eight of them in parallel. The promise resolves once every request has answered,
|
|
222
|
+
with all results merged and priced. `search({ limit: 1500 })` is one unpriced
|
|
223
|
+
count request plus up to 13 priced requests of 128 (12 for the first page; later
|
|
224
|
+
pages start mid-way into a hub page) and returns up to 1,500 priced results. If a
|
|
225
|
+
booking shifts the results while the requests run, the SDK fetches the call once
|
|
226
|
+
more. `pageInfo` and `nextCursor` behave as for any other `limit`. For the search
|
|
227
|
+
rate limit the whole call counts as one request.
|
|
228
|
+
|
|
229
|
+
To show the first results while the rest still loads, use `searchPages` (v9 only). It
|
|
230
|
+
yields the search page by page, 128 priced results per page, and ends after the last
|
|
231
|
+
page:
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
|
|
235
|
+
renderCards(page.items, page.alternatives);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
- An SDK whose config can be v9 or v10 has `searchPages` only after
|
|
240
|
+
`if (sdk.backend === "v9")`.
|
|
241
|
+
- The input is the `search` input without `cursor` and `limit`; the SDK pages itself.
|
|
242
|
+
- Every page is one `search` call and counts as one request for the rate limit, so
|
|
243
|
+
the SDK starts at most one page per second.
|
|
244
|
+
- A rental appears on one page only, even when a booking moves it between two pages.
|
|
245
|
+
- Each page carries its own `pageInfo`; `pageInfo.totalCount` is the total over all
|
|
246
|
+
pages.
|
|
247
|
+
- Not available with `searchAllRentalsAtOnce: true`; the loop then rejects with a
|
|
248
|
+
`CoreSDKError` whose `operation` is `search.searchPages`.
|
|
249
|
+
|
|
250
|
+
Use `search` with a large `limit` when the page needs every result before it renders
|
|
251
|
+
(a sorted list, a map with prices). Use `searchPages` when the first cards should
|
|
252
|
+
appear before the last page is priced.
|
|
211
253
|
|
|
212
254
|
## Sorting
|
|
213
255
|
|
|
@@ -486,7 +528,8 @@ if (map.totalCount <= SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS) {
|
|
|
486
528
|
}
|
|
487
529
|
```
|
|
488
530
|
|
|
489
|
-
In this mode a `search` call is one backend request, whatever its `limit
|
|
531
|
+
In this mode a `search` call is one backend request, whatever its `limit`, except on
|
|
532
|
+
v9 above a `limit` of 128 (see [v9: at most 128 priced results per request](#v9-at-most-128-priced-results-per-request)).
|
|
490
533
|
|
|
491
534
|
### How each backend does it
|
|
492
535
|
|
|
@@ -497,7 +540,9 @@ In this mode a `search` call is one backend request, whatever its `limit`.
|
|
|
497
540
|
requested. When a booking between the requests moves rentals across page
|
|
498
541
|
boundaries, the pages disagree with the count; the SDK then asks for all results in
|
|
499
542
|
one request, a consistent snapshot, instead of returning a set with a gap. `mapSearch` selects no prices and loads up to 1,000 matches per request,
|
|
500
|
-
as many requests as the matches need.
|
|
543
|
+
as many requests as the matches need. A paged `search` above a `limit` of 128 counts
|
|
544
|
+
the matches without prices first, then fetches the window as requests of 128, at
|
|
545
|
+
most eight at a time.
|
|
501
546
|
- v10 answers the whole result set in one request. `searchAllRentalsAtOnce` asks for
|
|
502
547
|
101 results and refuses the search when the response total is above 100.
|
|
503
548
|
`mapSearch` is one request without prices that returns only the location, for up
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog: 2.26.0
|
|
2
|
+
|
|
3
|
+
A v9 search with a `limit` above 128 now returns every result with its price. The v9 hub
|
|
4
|
+
prices at most the first 128 results of one request and returns the rest without a price and
|
|
5
|
+
without an error, so a search with `limit: 1000` showed prices and discounts for 128 rentals
|
|
6
|
+
only.
|
|
7
|
+
|
|
8
|
+
## Added
|
|
9
|
+
|
|
10
|
+
- `sdk.live.search.searchPages(input)` on v9: an `AsyncIterable` that yields the search page
|
|
11
|
+
by page, 128 priced results per page, so a list can show the first cards while the next
|
|
12
|
+
page loads. The input is the `search` input without `cursor` and `limit`. A rental appears
|
|
13
|
+
on one page only. Every page counts as one request for the search rate limit. Not available
|
|
14
|
+
with `searchAllRentalsAtOnce: true`; the loop then rejects with the `operation`
|
|
15
|
+
`search.searchPages`.
|
|
16
|
+
- Type `V9SearchPagesInput`.
|
|
17
|
+
|
|
18
|
+
## Fixed
|
|
19
|
+
|
|
20
|
+
- v9 `sdk.live.search.search` with a `limit` above 128 prices every result. The SDK fetches
|
|
21
|
+
the results as hub requests of 128, up to eight in parallel, and returns them merged, each
|
|
22
|
+
rental once. If a booking shifts the results while the requests run, the SDK fetches the
|
|
23
|
+
call once more. `pageInfo` and `nextCursor` behave as for any other `limit`: the cursor
|
|
24
|
+
continues with the same `limit`. The call counts as one request for the search rate limit.
|
|
25
|
+
- Errors from the v9 backend code report `source: "v9"`: every error from the hub and the v9
|
|
26
|
+
errors of search, rentals, quote, booking, availability, contact and config. Most of them
|
|
27
|
+
reported `source: "v10"`. Errors from code both backends share, such as payment
|
|
28
|
+
submission, keep `source: "core"`. The two errors for a service the SDK runtime does not
|
|
29
|
+
provide, with the `operation` `booking.getBankTransferDetails` or `search.mapSearch`, now
|
|
30
|
+
report `source: "core"` as well.
|
|
31
|
+
|
|
32
|
+
A v9 search with a `limit` up to 128 is unchanged: one request, the same cursor. Search on v10
|
|
33
|
+
is unchanged.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Migration: 2.25.0 to 2.26.0
|
|
2
|
+
|
|
3
|
+
## 1. Upgrade
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @v-office/website-sdk@2.26.0
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
No changes are required, except for code that checks `error.source` on a v9 site (below).
|
|
10
|
+
On a v9 site, a search with a `limit` above 128 now returns prices and discounts for every
|
|
11
|
+
result instead of the first 128. A site that worked around this by paging with a `limit` of
|
|
12
|
+
128 or less can keep doing so.
|
|
13
|
+
|
|
14
|
+
Errors from the v9 backend code, such as every error from the hub, now report `source: "v9"`
|
|
15
|
+
instead of `"v10"`. Code that recognizes them by `error.source === "v10"` checks `"v9"`
|
|
16
|
+
instead. Errors from code both backends share, such as payment submission, still report
|
|
17
|
+
`source: "core"`; leave checks for `"core"` as they are.
|
|
18
|
+
|
|
19
|
+
## 2. Optional: show the first results sooner on a v9 site
|
|
20
|
+
|
|
21
|
+
A search with a large `limit` answers once every result is priced. To render the first cards
|
|
22
|
+
earlier, loop over `searchPages` instead:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
|
|
26
|
+
renderCards(page.items, page.alternatives);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Keep `search` with a large `limit` where the page needs every result before it renders, for
|
|
31
|
+
example a list sorted on the client or a map with prices.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client
|
|
1
|
+
import { Gt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client--T_tQSjV.mjs";
|
|
2
2
|
import { i as VofficeUnitDataPropertyMetadata, l as parseVofficeUnitData, n as VofficeUnitDataPropertyCategoryLabelKeys, o as parseVofficeFacilityData, r as VofficeUnitDataPropertyCategoryValues, s as parseVofficeFeedbackData, t as VofficeUnitDataFieldSchemas } from "./v9-data-C3SWtDGs.mjs";
|
|
3
3
|
import { a as rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, i as rentalIdsQuery, o as rentalsAllFeedbacksQuery, r as rentalFacilitiesForObjectGroupRelationQuery, s as rentalsAllWithoutFeedbacksQuery } from "./operations-DwURbo0b.mjs";
|
|
4
4
|
import { a as toFacilityImages, c as toLocalizedString, i as toLocation, o as toImages, r as renderVofficePropertyAttribute, s as toAddress, t as toRentalHighlights } from "./to-rental-highlights-BL5m3Uen.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as parseQueryParameters, i as collectQueryParameters, n as makeV9CustomAttributeFilterCapabilities, o as toQueryString, r as toBasicQueryInputs, s as applyVofficeFilterDerivedBasicQueryInputs } from "./client
|
|
1
|
+
import { a as parseQueryParameters, i as collectQueryParameters, n as makeV9CustomAttributeFilterCapabilities, o as toQueryString, r as toBasicQueryInputs, s as applyVofficeFilterDerivedBasicQueryInputs } from "./client--T_tQSjV.mjs";
|
|
2
2
|
import { l as parseVofficeUnitData } from "./v9-data-C3SWtDGs.mjs";
|
|
3
3
|
import { n as searchQuery, t as mapSearchQuery } from "./operations-DwURbo0b.mjs";
|
|
4
4
|
import { i as toLocation, n as toV9RentalHighlightKey, o as toImages, s as toAddress, t as toRentalHighlights } from "./to-rental-highlights-BL5m3Uen.mjs";
|
|
@@ -6,7 +6,7 @@ import { CoreSDKError, STABLE_SEARCH_INPUTS, daysBetweenLocalDates, expandCustom
|
|
|
6
6
|
import { Effect } from "effect";
|
|
7
7
|
//#region src/legacy-v9/parser/search/input/search-input-error.ts
|
|
8
8
|
const failInvalidV9SearchInput = (message) => Effect.fail(new CoreSDKError({
|
|
9
|
-
source: "
|
|
9
|
+
source: "v9",
|
|
10
10
|
operation: "v9.search",
|
|
11
11
|
message
|
|
12
12
|
}));
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Release notes of `@v-office/website-sdk`, newest first. Each version has its own directory.
|
|
6
6
|
|
|
7
|
+
- `versions/2.26.0/CHANGELOG.md`: release notes for 2.26.0
|
|
7
8
|
- `versions/2.25.0/CHANGELOG.md`: release notes for 2.25.0
|
|
8
9
|
- `versions/2.24.1/CHANGELOG.md`: release notes for 2.24.1
|
|
9
10
|
- `versions/2.24.0/CHANGELOG.md`: release notes for 2.24.0
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Migration guides of `@v-office/website-sdk`, newest first. Apply them in order when skipping versions.
|
|
6
6
|
|
|
7
|
+
- `versions/2.26.0/MIGRATION.md`: Migration: 2.25.0 to 2.26.0
|
|
7
8
|
- `versions/2.25.0/MIGRATION.md`: Migration: 2.24.1 to 2.25.0
|
|
8
9
|
- `versions/2.24.1/MIGRATION.md`: Migration: 2.24.0 to 2.24.1
|
|
9
10
|
- `versions/2.24.0/MIGRATION.md`: Migration: 2.23.0 to 2.24.0
|
package/instructions/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Use this directory as the consumer-facing reference for the package:
|
|
|
10
10
|
- `rentals.md`: `sdk.static.rentals.getRentals`.
|
|
11
11
|
- `filter.md`: `sdk.static.filter.getFilters`.
|
|
12
12
|
- `custom-attributes.md`: custom attribute catalog, configuration, per-backend behaviour, and the v9-to-v10 move.
|
|
13
|
-
- `search.md`: `sdk.live.search.search`.
|
|
13
|
+
- `search.md`: `sdk.live.search.search` and, on v9, `sdk.live.search.searchPages`.
|
|
14
14
|
- `availability.md`: date-picker availability flows.
|
|
15
15
|
- `quote.md`: quote booking-card modifiers, additional services, cancellation policy, and insurance flows.
|
|
16
16
|
- `booking.md`: booking, payment option submission, and
|
package/instructions/search.md
CHANGED
|
@@ -207,7 +207,49 @@ Use `rentalIdsIn` to restrict results to specific rental IDs. This option is cur
|
|
|
207
207
|
Use `voucher` to price v10 search results with a voucher code. This option is currently supported by `v10` only.
|
|
208
208
|
For v10, `pets` is a mapped BooleanFilter exposed by `getFilters` and maps to one pet; use `petsCount` for an exact count and do not send both keys in one query.
|
|
209
209
|
|
|
210
|
-
`limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged
|
|
210
|
+
`limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged,
|
|
211
|
+
with the same `limit` as the call that returned it: the cursor points into pages of that size.
|
|
212
|
+
|
|
213
|
+
### v9: at most 128 priced results per request
|
|
214
|
+
|
|
215
|
+
The v9 hub prices at most the first 128 results of one request. It answers a larger
|
|
216
|
+
`limit` without an error, but every result past position 128 comes back without
|
|
217
|
+
`formattedTotal` and without `discount`. The SDK handles this for you:
|
|
218
|
+
|
|
219
|
+
- `limit` up to 128: one request, as before.
|
|
220
|
+
- `limit` above 128: the SDK splits the call into hub requests of 128 each, up to
|
|
221
|
+
eight of them in parallel. The promise resolves once every request has answered,
|
|
222
|
+
with all results merged and priced. `search({ limit: 1500 })` is one unpriced
|
|
223
|
+
count request plus up to 13 priced requests of 128 (12 for the first page; later
|
|
224
|
+
pages start mid-way into a hub page) and returns up to 1,500 priced results. If a
|
|
225
|
+
booking shifts the results while the requests run, the SDK fetches the call once
|
|
226
|
+
more. `pageInfo` and `nextCursor` behave as for any other `limit`. For the search
|
|
227
|
+
rate limit the whole call counts as one request.
|
|
228
|
+
|
|
229
|
+
To show the first results while the rest still loads, use `searchPages` (v9 only). It
|
|
230
|
+
yields the search page by page, 128 priced results per page, and ends after the last
|
|
231
|
+
page:
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
|
|
235
|
+
renderCards(page.items, page.alternatives);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
- An SDK whose config can be v9 or v10 has `searchPages` only after
|
|
240
|
+
`if (sdk.backend === "v9")`.
|
|
241
|
+
- The input is the `search` input without `cursor` and `limit`; the SDK pages itself.
|
|
242
|
+
- Every page is one `search` call and counts as one request for the rate limit, so
|
|
243
|
+
the SDK starts at most one page per second.
|
|
244
|
+
- A rental appears on one page only, even when a booking moves it between two pages.
|
|
245
|
+
- Each page carries its own `pageInfo`; `pageInfo.totalCount` is the total over all
|
|
246
|
+
pages.
|
|
247
|
+
- Not available with `searchAllRentalsAtOnce: true`; the loop then rejects with a
|
|
248
|
+
`CoreSDKError` whose `operation` is `search.searchPages`.
|
|
249
|
+
|
|
250
|
+
Use `search` with a large `limit` when the page needs every result before it renders
|
|
251
|
+
(a sorted list, a map with prices). Use `searchPages` when the first cards should
|
|
252
|
+
appear before the last page is priced.
|
|
211
253
|
|
|
212
254
|
## Sorting
|
|
213
255
|
|
|
@@ -486,7 +528,8 @@ if (map.totalCount <= SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS) {
|
|
|
486
528
|
}
|
|
487
529
|
```
|
|
488
530
|
|
|
489
|
-
In this mode a `search` call is one backend request, whatever its `limit
|
|
531
|
+
In this mode a `search` call is one backend request, whatever its `limit`, except on
|
|
532
|
+
v9 above a `limit` of 128 (see [v9: at most 128 priced results per request](#v9-at-most-128-priced-results-per-request)).
|
|
490
533
|
|
|
491
534
|
### How each backend does it
|
|
492
535
|
|
|
@@ -497,7 +540,9 @@ In this mode a `search` call is one backend request, whatever its `limit`.
|
|
|
497
540
|
requested. When a booking between the requests moves rentals across page
|
|
498
541
|
boundaries, the pages disagree with the count; the SDK then asks for all results in
|
|
499
542
|
one request, a consistent snapshot, instead of returning a set with a gap. `mapSearch` selects no prices and loads up to 1,000 matches per request,
|
|
500
|
-
as many requests as the matches need.
|
|
543
|
+
as many requests as the matches need. A paged `search` above a `limit` of 128 counts
|
|
544
|
+
the matches without prices first, then fetches the window as requests of 128, at
|
|
545
|
+
most eight at a time.
|
|
501
546
|
- v10 answers the whole result set in one request. `searchAllRentalsAtOnce` asks for
|
|
502
547
|
101 results and refuses the search when the response total is above 100.
|
|
503
548
|
`mapSearch` is one request without prices that returns only the location, for up
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog: 2.26.0
|
|
2
|
+
|
|
3
|
+
A v9 search with a `limit` above 128 now returns every result with its price. The v9 hub
|
|
4
|
+
prices at most the first 128 results of one request and returns the rest without a price and
|
|
5
|
+
without an error, so a search with `limit: 1000` showed prices and discounts for 128 rentals
|
|
6
|
+
only.
|
|
7
|
+
|
|
8
|
+
## Added
|
|
9
|
+
|
|
10
|
+
- `sdk.live.search.searchPages(input)` on v9: an `AsyncIterable` that yields the search page
|
|
11
|
+
by page, 128 priced results per page, so a list can show the first cards while the next
|
|
12
|
+
page loads. The input is the `search` input without `cursor` and `limit`. A rental appears
|
|
13
|
+
on one page only. Every page counts as one request for the search rate limit. Not available
|
|
14
|
+
with `searchAllRentalsAtOnce: true`; the loop then rejects with the `operation`
|
|
15
|
+
`search.searchPages`.
|
|
16
|
+
- Type `V9SearchPagesInput`.
|
|
17
|
+
|
|
18
|
+
## Fixed
|
|
19
|
+
|
|
20
|
+
- v9 `sdk.live.search.search` with a `limit` above 128 prices every result. The SDK fetches
|
|
21
|
+
the results as hub requests of 128, up to eight in parallel, and returns them merged, each
|
|
22
|
+
rental once. If a booking shifts the results while the requests run, the SDK fetches the
|
|
23
|
+
call once more. `pageInfo` and `nextCursor` behave as for any other `limit`: the cursor
|
|
24
|
+
continues with the same `limit`. The call counts as one request for the search rate limit.
|
|
25
|
+
- Errors from the v9 backend code report `source: "v9"`: every error from the hub and the v9
|
|
26
|
+
errors of search, rentals, quote, booking, availability, contact and config. Most of them
|
|
27
|
+
reported `source: "v10"`. Errors from code both backends share, such as payment
|
|
28
|
+
submission, keep `source: "core"`. The two errors for a service the SDK runtime does not
|
|
29
|
+
provide, with the `operation` `booking.getBankTransferDetails` or `search.mapSearch`, now
|
|
30
|
+
report `source: "core"` as well.
|
|
31
|
+
|
|
32
|
+
A v9 search with a `limit` up to 128 is unchanged: one request, the same cursor. Search on v10
|
|
33
|
+
is unchanged.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Migration: 2.25.0 to 2.26.0
|
|
2
|
+
|
|
3
|
+
## 1. Upgrade
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @v-office/website-sdk@2.26.0
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
No changes are required, except for code that checks `error.source` on a v9 site (below).
|
|
10
|
+
On a v9 site, a search with a `limit` above 128 now returns prices and discounts for every
|
|
11
|
+
result instead of the first 128. A site that worked around this by paging with a `limit` of
|
|
12
|
+
128 or less can keep doing so.
|
|
13
|
+
|
|
14
|
+
Errors from the v9 backend code, such as every error from the hub, now report `source: "v9"`
|
|
15
|
+
instead of `"v10"`. Code that recognizes them by `error.source === "v10"` checks `"v9"`
|
|
16
|
+
instead. Errors from code both backends share, such as payment submission, still report
|
|
17
|
+
`source: "core"`; leave checks for `"core"` as they are.
|
|
18
|
+
|
|
19
|
+
## 2. Optional: show the first results sooner on a v9 site
|
|
20
|
+
|
|
21
|
+
A search with a large `limit` answers once every result is priced. To render the first cards
|
|
22
|
+
earlier, loop over `searchPages` instead:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
|
|
26
|
+
renderCards(page.items, page.alternatives);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Keep `search` with a large `limit` where the page needs every result before it renders, for
|
|
31
|
+
example a list sorted on the client or a map with prices.
|