@v-office/website-sdk 2.4.3 → 2.5.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 +34 -14
- package/dist/{client-BORwUo4_.mjs → client-Cnf-pbry.mjs} +4 -2
- package/dist/index.d.mts +18 -4
- package/dist/index.mjs +3 -3
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/README.md +5 -2
- package/dist/instructions/availability.md +2 -1
- package/dist/instructions/booking.md +1 -1
- package/dist/instructions/contact.md +1 -1
- package/dist/instructions/creation.md +44 -0
- package/dist/instructions/filter.md +2 -1
- package/dist/instructions/quote.md +1 -1
- package/dist/instructions/rentals.md +2 -1
- package/dist/instructions/search.md +115 -2
- package/dist/instructions/versions/2.5.0/CHANGELOG.md +43 -0
- package/dist/instructions/versions/2.5.0/MIGRATION.md +135 -0
- package/dist/{search-Ckz48lwV.mjs → search-D1_b2t11.mjs} +14 -3
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/README.md +5 -2
- package/instructions/availability.md +2 -1
- package/instructions/booking.md +1 -1
- package/instructions/contact.md +1 -1
- package/instructions/creation.md +44 -0
- package/instructions/filter.md +2 -1
- package/instructions/quote.md +1 -1
- package/instructions/rentals.md +2 -1
- package/instructions/search.md +115 -2
- package/instructions/versions/2.5.0/CHANGELOG.md +43 -0
- package/instructions/versions/2.5.0/MIGRATION.md +135 -0
- package/package.json +2 -2
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Migration: 2.4.3 to 2.5.0
|
|
2
|
+
|
|
3
|
+
This guide covers upgrading `@v-office/website-sdk` from 2.4.3 to 2.5.0.
|
|
4
|
+
|
|
5
|
+
2.5.0 keeps `createWebsiteSDK({ config, options })`, the flat `WebsiteSDKConfig`, and existing SDK calls. v10 search now runs against the dedicated REST search backend, which requires one new config field and, for custom-attribute search, one new option. Search input also gains optional sorting, and static v10 rental loading uses the full Rental APIs internally. Existing calls and output types remain compatible.
|
|
6
|
+
|
|
7
|
+
## Required: v10 searchEndpoint
|
|
8
|
+
|
|
9
|
+
v10 config now requires `searchEndpoint`, the full REST search URL including the `/search` path:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const sdk = createWebsiteSDK({
|
|
13
|
+
config: {
|
|
14
|
+
backend: "v10",
|
|
15
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
16
|
+
searchEndpoint: "https://search.example.com/search",
|
|
17
|
+
accessToken: "...",
|
|
18
|
+
imageBaseUrl: "https://images.example.com",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Provide the same value wherever v10 config is built:
|
|
24
|
+
|
|
25
|
+
- CLI config files add a `searchEndpoint` string field.
|
|
26
|
+
- Environment-based CLI usage reads `VOFFICE_SEARCH_ENDPOINT`.
|
|
27
|
+
|
|
28
|
+
`apiEndpoint` is still required: v10 rentals, filters, quote, availability, booking, and contact continue to use GraphQL. `searchEndpoint` is a separate host and should be configured explicitly rather than derived from `apiEndpoint`.
|
|
29
|
+
|
|
30
|
+
## Static Rental Loading (v10)
|
|
31
|
+
|
|
32
|
+
`sdk.static.rentals.getRentals(...)` keeps the same input, output, rental ordering, image ordering, and localization behavior. Internally, 2.5.0:
|
|
33
|
+
|
|
34
|
+
- Loads rentals from `rentals_listRental` instead of `rentals_listRentalSummary`.
|
|
35
|
+
- Batch-loads uploaded rental images from `rentals_listRentalImage`.
|
|
36
|
+
- Derives room counts and occupancy summaries from rooms and beds.
|
|
37
|
+
- Uses validated serial keyset pagination for rentals and images instead of offset pagination.
|
|
38
|
+
|
|
39
|
+
Most consumers require no changes. If your v10 access token uses a custom role or restricted operation allowlist, grant access to both `rentals_listRental` and `rentals_listRentalImage`. A token that can only call `rentals_listRentalSummary` will no longer be sufficient for `getRentals`.
|
|
40
|
+
|
|
41
|
+
## Custom Attribute Manifest
|
|
42
|
+
|
|
43
|
+
The REST search backend filters and returns custom attributes by definition ID, while SDK configuration and query strings use keys. Because definition IDs are workspace/environment specific, the SDK no longer looks them up at search time. To use searchable custom-attribute filters or to surface custom-attribute highlights on v10 search results, provide a `customAttributeDefinitionManifest` that maps keys to IDs:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const options = defineWebsiteSDKOptions({
|
|
47
|
+
customAttributeDefinitionManifest: {
|
|
48
|
+
byKey: {
|
|
49
|
+
region: { id: "def-1", key: "region", type: "OPTION", visibility: "PUBLIC" },
|
|
50
|
+
},
|
|
51
|
+
byId: {
|
|
52
|
+
"def-1": { id: "def-1", key: "region", type: "OPTION", visibility: "PUBLIC" },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Generate the manifest at build time from your definitions source, and pass a separate manifest per workspace/environment because IDs are not portable. Without a manifest:
|
|
59
|
+
|
|
60
|
+
- Custom-attribute query keys are left in `unusedFilterKeys` rather than applied.
|
|
61
|
+
- Custom-attribute highlights are not added to search items.
|
|
62
|
+
- All other search behavior (period, occupancy, catalog filters, voucher, pagination) is unchanged.
|
|
63
|
+
|
|
64
|
+
Definitions with `visibility` of `PUBLIC` (or `null`) are surfaced as highlights; others are ignored.
|
|
65
|
+
|
|
66
|
+
## Optional Search Sorting
|
|
67
|
+
|
|
68
|
+
`SearchSearchInput` now accepts an optional discriminated sort:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
type SearchSearchSort =
|
|
72
|
+
| { by: "price"; direction: "ASC" | "DESC" }
|
|
73
|
+
| { by: "random" }
|
|
74
|
+
| { by: "rating" }
|
|
75
|
+
| { by: "field"; orderBy: SearchSearchFieldOrderBy };
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Existing searches require no change. When adopting sorting:
|
|
79
|
+
|
|
80
|
+
- Price, random, and rating inputs are source-compatible between v9 and v10.
|
|
81
|
+
- v9 price sorting maps to `price_asc`/`price_desc`; random and rating are forwarded to the v9 backend.
|
|
82
|
+
- v10 price sorting maps to `totalOrderBy`. It requires a fixed-period or flexible-date pricing query with occupancy and fails validation before transport when either is missing.
|
|
83
|
+
- v10 random and rating currently select the default backend order.
|
|
84
|
+
- The closed `field` contract maps supported name, room-summary, square-meter, and distance fields to v10 `rentalSummaryOrderBy`; it is excluded from `V9SearchSearchSort`.
|
|
85
|
+
- v9 may retain promoted results before the requested order. v10 price results are ordered by backend boost first and total second.
|
|
86
|
+
|
|
87
|
+
Examples:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
await sdk.live.search.search({
|
|
91
|
+
locale: "de-DE",
|
|
92
|
+
query: "start=01-08-2026&end=08-08-2026&adults=2",
|
|
93
|
+
sort: { by: "price", direction: "ASC" },
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
await sdk.live.search.search({
|
|
97
|
+
locale: "de-DE",
|
|
98
|
+
query: "adults=2",
|
|
99
|
+
sort: { by: "field", orderBy: { label: "ASC" } }, // v10 only
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The CLI accepts the same schema as JSON:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
website-sdk --backend v10 search --locale de-DE --query "start=01-08-2026&end=08-08-2026&adults=2" --sort '{"by":"price","direction":"ASC"}'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
See `../../search.md` for all variants, supported field-order examples, backend behavior, and CLI usage.
|
|
110
|
+
|
|
111
|
+
## Search Result Changes (v10)
|
|
112
|
+
|
|
113
|
+
The public output type is unchanged, but v10 search cards now reflect the REST projection:
|
|
114
|
+
|
|
115
|
+
- At most five images per item; search images no longer include `category`.
|
|
116
|
+
- `property` is the minimal `{ id, nameOrLabel }` shape. Hydrate `property.location`, `property.images`, or `property.address` from `sdk.static.rentals.getRentals(...)` when a search card needs them.
|
|
117
|
+
- Exact-period matches are returned in `items` with `formattedTotal`; nearby suggestions are returned in root-level `alternatives`, unchanged.
|
|
118
|
+
|
|
119
|
+
## Backend Behavior
|
|
120
|
+
|
|
121
|
+
- Fixed-period and flexible searches are priced by the REST backend; occupancy is required for priced searches.
|
|
122
|
+
- Pagination uses `from`/`size` with the existing opaque `cursor`; a cursor is never advertised beyond the 1,000-result window.
|
|
123
|
+
- Requests remain rate-limited to one backend request per second with a queue size of five.
|
|
124
|
+
- Existing v9 search calls remain compatible; sorting is the only added v9 search capability.
|
|
125
|
+
|
|
126
|
+
## Recommended Steps
|
|
127
|
+
|
|
128
|
+
1. Upgrade to `@v-office/website-sdk` 2.5.0.
|
|
129
|
+
2. Add `searchEndpoint` to every v10 `WebsiteSDKConfig` and set `VOFFICE_SEARCH_ENDPOINT` for environment/CLI runs.
|
|
130
|
+
3. If you use custom-attribute search filters or highlights, generate and pass `customAttributeDefinitionManifest`.
|
|
131
|
+
4. Update any search-card UI that reads `property.location`, `property.images`, or `property.address` to hydrate from rentals.
|
|
132
|
+
5. Cap rendered search images at five and stop relying on image `category` for v10 search cards.
|
|
133
|
+
6. If adopting sorting, use only shared variants for code that can run against v9, and keep field ordering in v10-narrowed code.
|
|
134
|
+
7. Confirm the v10 access token permits `rentals_listRental` and `rentals_listRentalImage`, then smoke-test `sdk.static.rentals.getRentals`.
|
|
135
|
+
8. Smoke-test unpriced, fixed-period, and flexible v10 searches, including pagination and any requested ordering.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/website-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Website-facing SDK facade backed by @v-office/sdk-core",
|
|
5
5
|
"bin": {
|
|
6
6
|
"website-sdk": "./dist/cli.mjs"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
44
|
-
"@v-office/sdk-core": "^1.
|
|
44
|
+
"@v-office/sdk-core": "^1.6.0",
|
|
45
45
|
"effect": "4.0.0-beta.85",
|
|
46
46
|
"graphql": "16.14.2",
|
|
47
47
|
"yaml": "^2.9.0"
|