@v-office/website-sdk 2.7.0 → 2.8.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/README.md +28 -1
- package/dist/cli.mjs +25 -4
- package/dist/{client-45_ofP_d.mjs → client-BNbBfJtO.mjs} +385 -187
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +3 -3
- package/dist/instructions/CHANGELOG.md +3 -1
- package/dist/instructions/MIGRATION.md +3 -1
- package/dist/instructions/README.md +8 -3
- package/dist/instructions/creation.md +65 -64
- package/dist/instructions/custom-attributes.md +556 -0
- package/dist/instructions/filter.md +51 -23
- package/dist/instructions/rentals.md +26 -2
- package/dist/instructions/search.md +29 -3
- package/dist/instructions/versions/2.5.0/MIGRATION.md +5 -0
- package/dist/instructions/versions/2.6.0/CHANGELOG.md +3 -25
- package/dist/instructions/versions/2.6.0/MIGRATION.md +4 -72
- package/dist/instructions/versions/2.7.0/CHANGELOG.md +44 -0
- package/dist/instructions/versions/2.7.0/MIGRATION.md +79 -0
- package/dist/instructions/versions/2.8.0/CHANGELOG.md +63 -0
- package/dist/instructions/versions/2.8.0/MIGRATION.md +252 -0
- package/dist/{rentals-Lw1qUKIj.mjs → rentals-cCejb_2d.mjs} +21 -21
- package/dist/{search-wcoZw2rt.mjs → search-Dzzra6IW.mjs} +16 -133
- package/dist/{to-rental-highlights-CxWlq76f.mjs → to-rental-highlights-OvNe9ZQS.mjs} +8 -6
- package/dist/translations/v10/de-DE/core.json +2 -0
- package/dist/translations/v10/en-US/core.json +2 -0
- package/instructions/CHANGELOG.md +3 -1
- package/instructions/MIGRATION.md +3 -1
- package/instructions/README.md +8 -3
- package/instructions/creation.md +65 -64
- package/instructions/custom-attributes.md +556 -0
- package/instructions/filter.md +51 -23
- package/instructions/rentals.md +26 -2
- package/instructions/search.md +29 -3
- package/instructions/versions/2.5.0/MIGRATION.md +5 -0
- package/instructions/versions/2.6.0/CHANGELOG.md +3 -25
- package/instructions/versions/2.6.0/MIGRATION.md +4 -72
- package/instructions/versions/2.7.0/CHANGELOG.md +44 -0
- package/instructions/versions/2.7.0/MIGRATION.md +79 -0
- package/instructions/versions/2.8.0/CHANGELOG.md +63 -0
- package/instructions/versions/2.8.0/MIGRATION.md +252 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Website-facing SDK facade for vOffice backends.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The 2.8.0 line adds the catalog-backed custom-attribute registry, backend-aware
|
|
6
|
+
atomic filter compositions, and consistent custom-attribute display and highlight
|
|
7
|
+
behavior.
|
|
8
|
+
See `instructions/CHANGELOG.md` for the complete release history.
|
|
6
9
|
|
|
7
10
|
## Install
|
|
8
11
|
|
|
@@ -25,6 +28,7 @@ const sdk = createWebsiteSDK({
|
|
|
25
28
|
config: {
|
|
26
29
|
backend: "v10",
|
|
27
30
|
apiEndpoint: "https://api.example.com/graphql",
|
|
31
|
+
searchEndpoint: "https://search.example.com/search",
|
|
28
32
|
accessToken: "...",
|
|
29
33
|
imageBaseUrl: "https://images.example.com",
|
|
30
34
|
},
|
|
@@ -106,6 +110,7 @@ website-sdk --backend v10 --config ./website-sdk-config.json --options ./website
|
|
|
106
110
|
For v10, environment configuration uses:
|
|
107
111
|
|
|
108
112
|
- `VOFFICE_API_ENDPOINT`
|
|
113
|
+
- `VOFFICE_SEARCH_ENDPOINT`
|
|
109
114
|
- `VOFFICE_LOCAL_DEV_ACCESS_TOKEN`
|
|
110
115
|
- `VOFFICE_IMAGE_BASE_URL`
|
|
111
116
|
|
|
@@ -127,4 +132,26 @@ The 2.0.0 line was the breaking migration from the legacy SDK API. If you are st
|
|
|
127
132
|
- The error model now comes from `@v-office/sdk-core`.
|
|
128
133
|
- CLI config JSON uses the new flat config shape.
|
|
129
134
|
|
|
135
|
+
Custom attributes are configured by joining a v10 catalog with authored site policy:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { defineCustomAttributes } from "@v-office/website-sdk";
|
|
139
|
+
|
|
140
|
+
const customAttributes = defineCustomAttributes({
|
|
141
|
+
catalog,
|
|
142
|
+
select: {
|
|
143
|
+
region: {
|
|
144
|
+
label: { "de-DE": "Region", "en-US": "Region" },
|
|
145
|
+
filter: true,
|
|
146
|
+
optionLabels: {
|
|
147
|
+
north: { "de-DE": "Norden", "en-US": "North" },
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
See `instructions/custom-attributes.md` before migrating an older
|
|
155
|
+
`customAttributeDefinitionManifest` configuration.
|
|
156
|
+
|
|
130
157
|
See `instructions/` for the full consumer documentation. Version-specific release notes and migration details live under `instructions/versions/`, with indexes at `instructions/CHANGELOG.md` and `instructions/MIGRATION.md`.
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { SearchSearchSortSchema } from "@v-office/sdk-core";
|
|
2
|
+
import { t as createWebsiteSDK, zt as defineWebsiteSDKOptions } from "./client-BNbBfJtO.mjs";
|
|
3
|
+
import { SearchSearchSortSchema, defineCustomAttributesFromUnknown } from "@v-office/sdk-core";
|
|
4
4
|
import { Console, Effect, FileSystem, Layer, Option, Path, Schema, Stdio, Terminal } from "effect";
|
|
5
5
|
import { Command, Flag } from "effect/unstable/cli";
|
|
6
6
|
import { inspect } from "node:util";
|
|
@@ -16,7 +16,7 @@ var CLICheckFailed = class extends Error {
|
|
|
16
16
|
const toCLIError = (message, cause) => cause instanceof Error ? new CLICheckFailed(`${message}: ${cause.message}`, { cause }) : new CLICheckFailed(message, { cause });
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region package.json
|
|
19
|
-
var version = "2.
|
|
19
|
+
var version = "2.8.0";
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/cli/output.ts
|
|
22
22
|
const toJson = (value) => Effect.try({
|
|
@@ -80,7 +80,28 @@ const WebsiteV10CLIConfigSchema = Schema.Struct({
|
|
|
80
80
|
const WebsiteSDKCLIConfigSchema = Schema.Union([WebsiteV9CLIConfigSchema, WebsiteV10CLIConfigSchema]);
|
|
81
81
|
const decodeCLIConfig = (input, path) => Schema.decodeUnknownEffect(WebsiteSDKCLIConfigSchema)(input).pipe(Effect.mapError((cause) => toCLIError(`Invalid Website SDK config file at ${path}. Expected a complete v9 or v10 config`, cause)));
|
|
82
82
|
const getRequiredEnv = (name) => Effect.sync(() => process.env[name]).pipe(Effect.flatMap((value) => value === void 0 || value.trim().length === 0 ? Effect.fail(new CLICheckFailed(`Missing required environment variable ${name}.`)) : Effect.succeed(value)));
|
|
83
|
-
|
|
83
|
+
/**
|
|
84
|
+
* `customAttributes` in the options file holds the *inputs* to
|
|
85
|
+
* `defineCustomAttributes` — a catalog plus product policy — not a finished
|
|
86
|
+
* registry. A registry is the output of validation, so taking one verbatim from
|
|
87
|
+
* JSON would mean trusting a shape nothing checked. Running the join here applies
|
|
88
|
+
* every invariant to the CLI path exactly as to the TypeScript path.
|
|
89
|
+
*/
|
|
90
|
+
const toWebsiteSDKOptions = (input, path) => Effect.try({
|
|
91
|
+
try: () => {
|
|
92
|
+
const { customAttributes, ...rest } = input ?? {};
|
|
93
|
+
return defineWebsiteSDKOptions(customAttributes === void 0 ? rest : {
|
|
94
|
+
...rest,
|
|
95
|
+
customAttributes: defineCustomAttributesFromUnknown(customAttributes)
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
catch: (cause) => toCLIError(`Invalid Website SDK options file at ${path}`, cause)
|
|
99
|
+
});
|
|
100
|
+
const readOptions = (root, fallback) => {
|
|
101
|
+
if (Option.isNone(root.options)) return Effect.succeed(fallback);
|
|
102
|
+
const path = root.options.value;
|
|
103
|
+
return readJsonFile(path, "Website SDK options").pipe(Effect.flatMap((input) => toWebsiteSDKOptions(input, path)));
|
|
104
|
+
};
|
|
84
105
|
const fromConfigFile = (root) => {
|
|
85
106
|
if (Option.isNone(root.config)) return fromEnvironment(root);
|
|
86
107
|
const path = root.config.value;
|