@v-office/website-sdk 2.21.0 → 2.23.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,62 @@
1
+ # Changelog: 2.23.0
2
+
3
+ A search that the backend has not answered before is slow: the v9 backend prices
4
+ the rentals of one request one after another, about 40–75 ms per rental, and caches
5
+ only whole searches. A site that shows every result with its price on a map had to
6
+ request all of them in one call, which took 3–9 s for a portfolio of about 70
7
+ rentals on v9. Separate requests are priced in parallel, and a search that selects
8
+ no prices costs almost nothing. This release uses both, with the same API on v9 and
9
+ v10 so a site keeps its code when it switches backend: small portfolios get every
10
+ priced result in one call, large portfolios get a map search next to a paged list.
11
+
12
+ Measured against a v9 hub with 74 rentals, first request for a date range: 71
13
+ results in 8.6 s with one request, 2.1 s with `searchAllRentalsAtOnce`. A search
14
+ with few results gains nothing and costs the count request: 18 results in 1.4 s
15
+ before, 1.7 s now.
16
+
17
+ ## Added
18
+
19
+ - The `searchAllRentalsAtOnce` option (default `false`), on v9 and v10. With
20
+ `true`, `sdk.live.search.search` returns every result with its price in one call
21
+ and takes no `cursor` or `limit`. A search that matches more than
22
+ `SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS` (100) rentals, or a passed `cursor` or
23
+ `limit`, rejects with the `CoreSDKError` operation `search.allRentalsAtOnce`. The
24
+ whole call counts as one request for the search rate limit.
25
+ - v9: counts the matches without prices, then fetches the priced results as
26
+ parallel backend pages of ten, at most eight at a time. An oversized search is
27
+ refused before any price is requested. When a booking between the requests
28
+ shifts rentals across page boundaries, it asks for all results in one request
29
+ instead.
30
+ - v10: one request for 101 results; refused when the response total is above 100.
31
+ - `sdk.live.search.mapSearch({ locale, query })` in the default mode, on v9 and
32
+ v10: every rental the search matches, with `id` and `location`, plus
33
+ `totalCount`, `appliedFilters` and `unusedFilterKeys`, without prices. It
34
+ rejects with the operation `search.mapSearch` when the SDK was created with
35
+ `searchAllRentalsAtOnce: true`. v9 loads up to 1,000 matches per backend request;
36
+ v10 answers up to 1,000 matches, its result window.
37
+ - `pageInfo.totalCount` on every search output: the number of rentals the backend
38
+ matched over all pages.
39
+ - The types `WebsiteSDKAllRentalsAtOnce`, `WebsiteSDKV9AllRentalsAtOnce`,
40
+ `WebsiteSDKV10AllRentalsAtOnce` with their `...Live` types and
41
+ `V9SearchAllRentalsAtOnceInput`, and from `@v-office/sdk-core` 1.24.0
42
+ `SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS`, `SearchMapSearchInput`,
43
+ `SearchMapSearchOutput`, `SearchMapSearchOutputItem`,
44
+ `SearchAllRentalsAtOnceInput` and the matching schemas. `createWebsiteSDK`
45
+ returns an `...AllRentalsAtOnce` type when `searchAllRentalsAtOnce: true` is
46
+ written in the options; it has no `mapSearch` and no `cursor`/`limit`.
47
+
48
+ ## Changed
49
+
50
+ - `v9`: a search requests only the rental data the search output reads (`name`,
51
+ `address`, `regionName`, `images`, the attribute behind each configured rental
52
+ highlight, configured custom attributes and `rentalDataAttributes`) instead of
53
+ every known attribute: 56 instead of 450 attributes with the default highlights,
54
+ and a response of 52 KB instead of 164 KB gzipped (624 KB instead of 1,471 KB
55
+ uncompressed) for 71 rentals. The output is unchanged.
56
+ - Requires `@v-office/sdk-core` 1.24.0.
57
+
58
+ ## Unchanged
59
+
60
+ - A paged search in the default mode, on v9 and v10: same request per call, same
61
+ items, alternatives and prices; `pageInfo` gains `totalCount`. On v9 verified
62
+ against the hub with 2.22.0 side by side.
@@ -0,0 +1,33 @@
1
+ # Migration: 2.22.0 to 2.23.0
2
+
3
+ ## 1. Upgrade
4
+
5
+ ```sh
6
+ pnpm add @v-office/website-sdk@2.23.0
7
+ ```
8
+
9
+ No changes are required. The default mode searches as before, and the search
10
+ output only gains `pageInfo.totalCount`.
11
+
12
+ ## 2. Show every result with its price on list and map (up to 100 rentals)
13
+
14
+ Create the SDK with `searchAllRentalsAtOnce: true` and drop the pagination loop:
15
+ one `search` call returns every result with `pageInfo.hasNextPage: false`. Remove
16
+ `cursor` and `limit` from the input; the call rejects them. The same code works on
17
+ v9 and v10.
18
+
19
+ ```ts
20
+ const sdk = createWebsiteSDK({ config, options: { searchAllRentalsAtOnce: true } });
21
+ const { items, alternatives, pageInfo } = await sdk.live.search.search({ locale, query });
22
+ ```
23
+
24
+ ## 3. Map for a larger portfolio (default mode)
25
+
26
+ Load the map with `mapSearch` and page the list with `search`. Use `totalCount`
27
+ from `mapSearch` to load a search with few matches in one call and show its prices
28
+ on the map; see `search.md`, "All Rentals At Once Or Map Search".
29
+
30
+ ```ts
31
+ const map = await sdk.live.search.mapSearch({ locale, query });
32
+ // map.items: { id, location? }[] for every match; map.totalCount
33
+ ```
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": []
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/website-sdk",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "description": "Website-facing SDK facade backed by @v-office/sdk-core",
5
5
  "bin": {
6
6
  "website-sdk": "./dist/cli.mjs"
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@graphql-typed-document-node/core": "3.2.0",
45
- "@v-office/sdk-core": "1.23.0",
45
+ "@v-office/sdk-core": "1.24.0",
46
46
  "effect": "4.0.0-rc.115",
47
47
  "graphql": "17.0.2",
48
48
  "yaml": "^2.9.0"
@@ -69,7 +69,11 @@
69
69
  "build": "tsdown",
70
70
  "codegen:v9:properties": "node codegen/v9/heuristic-generation/generate/index.ts && oxfmt codegen/v9/heuristic-generation/v9-data.ts",
71
71
  "codegen:v9:graphql": "graphql-codegen --config codegen/v9/graphql-codegen/codegen.ts",
72
- "codegen": "pnpm run codegen:v9:properties && pnpm run codegen:v9:graphql",
72
+ "codegen:v9:v0:types": "pnpm --package=typescript@6.0.3 --package=openapi-typescript@7.13.0 dlx openapi-typescript codegen/v9/v0/openapi.yaml -o codegen/v9/v0/generated/openapi-types.ts && oxfmt codegen/v9/v0/generated/openapi-types.ts",
73
+ "codegen:v9:v0": "node codegen/v9/v0/generate/index.ts && oxfmt codegen/v9/v0/generated/v0-data.ts",
74
+ "codegen:v9:v1:types": "pnpm --package=typescript@6.0.3 --package=openapi-typescript@7.13.0 dlx openapi-typescript codegen/v9/v1/openapi.yaml -o codegen/v9/v1/generated/openapi-types.ts && oxfmt codegen/v9/v1/generated/openapi-types.ts",
75
+ "codegen:v9:v1": "node codegen/v9/v1/generate/index.ts && oxfmt codegen/v9/v1/generated/v1-data.ts",
76
+ "codegen": "pnpm run codegen:v9:properties && pnpm run codegen:v9:graphql && pnpm run codegen:v9:v0:types && pnpm run codegen:v9:v0 && pnpm run codegen:v9:v1:types && pnpm run codegen:v9:v1",
73
77
  "dev": "tsdown --watch",
74
78
  "typecheck": "tsc --noEmit",
75
79
  "lint": "oxlint .",