@v-office/website-sdk 1.0.0 → 1.1.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 +7 -1
- package/dist/cli.mjs +1 -1
- package/dist/{client-BbAfk-qa.mjs → client-CDJn8kOh.mjs} +187 -630
- package/dist/{custom-attribute-ChCbJKf_.mjs → custom-attribute-D5Kb1YHA.mjs} +1 -1
- package/dist/index.d.mts +839 -2
- package/dist/index.mjs +2 -1
- package/dist/{operations-BanW36PK.mjs → operations-B4IgNB3E.mjs} +28 -26
- package/dist/{operations-CHxEQ3jG.mjs → operations-Bxhb0jmN.mjs} +182 -1
- package/dist/quote-CRjV_lf-.mjs +609 -0
- package/dist/{quote-Vl6Nutaa.mjs → quote-Duya7n8v.mjs} +2 -2
- package/dist/{quote-C3HZsFua.mjs → quote-xpSX3Z58.mjs} +2 -2
- package/dist/{rentals-cQAg5TTW.mjs → rentals-CSp5vdZh.mjs} +4 -4
- package/dist/{rentals-BFmmp26v.mjs → rentals-DM-qBlym.mjs} +3 -3
- package/dist/{search-JqA3v_Fx.mjs → search-D-OKND5S.mjs} +24 -5
- package/dist/{to-rental-highlights-BcRa9Odv.mjs → to-rental-highlights-CYcylkuN.mjs} +3 -3
- package/package.json +21 -20
- package/dist/parser-D6UAf8Ld.mjs +0 -65
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as toUnusedFilterKeys, C as parseChildrenAges, D as parseQueryParameters, E as collectQueryParameters, L as parseVofficeUnitData, O as expandCustomAttributeFilterCompositions, T as toQueryString,
|
|
1
|
+
import { $t as toStableSearchInputParameterValues, A as toUnusedFilterKeys, C as parseChildrenAges, D as parseQueryParameters, E as collectQueryParameters, L as parseVofficeUnitData, O as expandCustomAttributeFilterCompositions, Qt as toStableSearchInputBackendQueryKeys, T as toQueryString, Xt as STABLE_SEARCH_INPUTS, en as toStableSearchInputQueryKeys, j as stable_filters_default, k as toCustomAttributeFilterLabel, w as parseOccupancyCount } from "./client-CDJn8kOh.mjs";
|
|
2
2
|
import { t as CMSError } from "./errors-2cuUGSvi.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as toAddress, t as toRentalHighlights } from "./to-rental-highlights-
|
|
3
|
+
import { C as daysBetweenLocalDates, _ as toFormattedSearchPrice, x as toIsoDateFromPeriodQueryDate } from "./quote-CRjV_lf-.mjs";
|
|
4
|
+
import { n as toAddress, t as toRentalHighlights } from "./to-rental-highlights-CYcylkuN.mjs";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
//#region src/adapters/v9/parser/search/input/filter/apply-voffice-filter-derived-basic-query-inputs.ts
|
|
7
7
|
const hasBasicQueryInput = ({ basicQueryInputs, key }) => basicQueryInputs.some((input) => input.key === key);
|
|
@@ -311,15 +311,29 @@ const toQueryInput = ({ query, customAttributeFilterDefinitions, locale, transla
|
|
|
311
311
|
return {
|
|
312
312
|
appliedFilters: [...compositionResult.appliedFilters, ...appliedFilters],
|
|
313
313
|
queryInput: {
|
|
314
|
-
vofficeData:
|
|
314
|
+
vofficeData: {
|
|
315
|
+
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
316
|
+
alternatives: true
|
|
317
|
+
},
|
|
315
318
|
basicQueryInputs
|
|
316
319
|
},
|
|
317
320
|
unusedFilterKeys: toUnusedFilterKeys(basicQueryResult.remainingQuery)
|
|
318
321
|
};
|
|
319
322
|
});
|
|
320
323
|
//#endregion
|
|
324
|
+
//#region src/adapters/v9/parser/search/output/to-formatted-price.ts
|
|
325
|
+
const DEFAULT_V9_SEARCH_CURRENCY = "EUR";
|
|
326
|
+
const toFormattedPrice = ({ locale, calc }) => {
|
|
327
|
+
if (calc?.total == null) return Effect.succeed(null);
|
|
328
|
+
return Effect.succeed(toFormattedSearchPrice({
|
|
329
|
+
amount: calc.total,
|
|
330
|
+
currency: DEFAULT_V9_SEARCH_CURRENCY,
|
|
331
|
+
locale
|
|
332
|
+
}));
|
|
333
|
+
};
|
|
334
|
+
//#endregion
|
|
321
335
|
//#region src/adapters/v9/parser/search/to-search-output-item.ts
|
|
322
|
-
const toSearchOutputItem = ({ locale, rentalHighlightPrioritization, customAttributeFilterDefinitions, rental, translations }) => Effect.gen(function* () {
|
|
336
|
+
const toSearchOutputItem = ({ locale, rentalHighlightPrioritization, customAttributeFilterDefinitions, rental, translations, includeFormattedTotal }) => Effect.gen(function* () {
|
|
323
337
|
const data = parseVofficeUnitData(rental.data);
|
|
324
338
|
const item = {
|
|
325
339
|
id: rental.voffice_id.toString(),
|
|
@@ -336,6 +350,11 @@ const toSearchOutputItem = ({ locale, rentalHighlightPrioritization, customAttri
|
|
|
336
350
|
attributes: data
|
|
337
351
|
});
|
|
338
352
|
if (highlights != null) item.highlights = highlights;
|
|
353
|
+
const formattedPrice = yield* toFormattedPrice({
|
|
354
|
+
locale,
|
|
355
|
+
calc: rental.additional_voffice_data?.calc
|
|
356
|
+
});
|
|
357
|
+
if (includeFormattedTotal && formattedPrice != null) item.formattedTotal = formattedPrice;
|
|
339
358
|
return item;
|
|
340
359
|
});
|
|
341
360
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as VofficeUnitDataPropertyMetadata } from "./client-
|
|
1
|
+
import { P as VofficeUnitDataPropertyMetadata } from "./client-CDJn8kOh.mjs";
|
|
2
2
|
import "./errors-2cuUGSvi.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { i as renderLabeledAttributeValue, t as renderCustomAttributeHighlight } from "./custom-attribute-
|
|
3
|
+
import { b as localeToLanguage, v as toCountry, y as makeTranslate } from "./quote-CRjV_lf-.mjs";
|
|
4
|
+
import { i as renderLabeledAttributeValue, t as renderCustomAttributeHighlight } from "./custom-attribute-D5Kb1YHA.mjs";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
//#region src/adapters/v9/parser/rentals/to-localized-string.ts
|
|
7
7
|
const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/website-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "SDK for the connection to PMS from the website",
|
|
5
5
|
"bin": {
|
|
6
6
|
"website-sdk": "./dist/cli.mjs"
|
|
@@ -19,26 +19,24 @@
|
|
|
19
19
|
"#services": "./src/services/index.ts",
|
|
20
20
|
"#shared-parsers": "./src/adapters/shared/parser/index.ts",
|
|
21
21
|
"#v10-codegen-types": "./scripts/v10/graphql-codegen/types.ts",
|
|
22
|
-
"#v10-metadata-search-filter": "./scripts/v10/metadata-generation/search-filter-metadata.ts",
|
|
23
|
-
"#v10-metadata-search-filter-category-keys": "./scripts/v10/metadata-generation/search-filter-category-keys.ts",
|
|
24
|
-
"#v10-metadata-rental": "./scripts/v10/metadata-generation/rental-metadata.ts",
|
|
25
|
-
"#v10-metadata-property": "./scripts/v10/metadata-generation/property-metadata.ts",
|
|
26
|
-
"#v10-generated": "./scripts/v10/graphql-codegen/generated/index.ts",
|
|
27
22
|
"#v10-generated-graphql": "./scripts/v10/graphql-codegen/generated/graphql.ts",
|
|
28
23
|
"#v10-operations": "./scripts/v10/graphql-codegen/operations/index.ts",
|
|
24
|
+
"#v10-metadata-rental": "./scripts/v10/metadata-generation/rental-metadata.ts",
|
|
25
|
+
"#v10-metadata-property": "./scripts/v10/metadata-generation/property-metadata.ts",
|
|
26
|
+
"#v10-metadata-search-filter": "./scripts/v10/metadata-generation/search-filter-metadata.ts",
|
|
27
|
+
"#v10-metadata-search-filter-category-keys": "./scripts/v10/metadata-generation/search-filter-category-keys.ts",
|
|
29
28
|
"#v9-data": "./scripts/v9/heuristic-generation/v9-data.ts",
|
|
30
29
|
"#v9-data-public": "./scripts/v9/heuristic-generation/public-api.ts",
|
|
30
|
+
"#v9-stable-filters": "./scripts/v9/graphql-codegen/stable-filters.json",
|
|
31
|
+
"#v9-search-filter-key-map": "./scripts/v9/graphql-codegen/search-filter-key-map.ts",
|
|
32
|
+
"#v9-operations": "./scripts/v9/graphql-codegen/operations/index.ts",
|
|
33
|
+
"#v9-generated-graphql": "./scripts/v9/graphql-codegen/generated/graphql.ts",
|
|
31
34
|
"#v9-v0-data": "./scripts/v9/v0/generated/v0-data.ts",
|
|
32
35
|
"#v9-v0-openapi-types": "./scripts/v9/v0/generated/openapi-types.ts",
|
|
33
36
|
"#v9-v0-public": "./scripts/v9/v0/public-api.ts",
|
|
34
37
|
"#v9-v1-data": "./scripts/v9/v1/generated/v1-data.ts",
|
|
35
38
|
"#v9-v1-openapi-types": "./scripts/v9/v1/generated/openapi-types.ts",
|
|
36
|
-
"#v9-v1-public": "./scripts/v9/v1/public-api.ts"
|
|
37
|
-
"#v9-generated": "./scripts/v9/graphql-codegen/generated/index.ts",
|
|
38
|
-
"#v9-generated-graphql": "./scripts/v9/graphql-codegen/generated/graphql.ts",
|
|
39
|
-
"#v9-operations": "./scripts/v9/graphql-codegen/operations/index.ts",
|
|
40
|
-
"#v9-stable-filters": "./scripts/v9/graphql-codegen/stable-filters.json",
|
|
41
|
-
"#v9-search-filter-key-map": "./scripts/v9/graphql-codegen/search-filter-key-map.ts"
|
|
39
|
+
"#v9-v1-public": "./scripts/v9/v1/public-api.ts"
|
|
42
40
|
},
|
|
43
41
|
"exports": {
|
|
44
42
|
".": "./dist/index.mjs",
|
|
@@ -49,23 +47,26 @@
|
|
|
49
47
|
"access": "public"
|
|
50
48
|
},
|
|
51
49
|
"dependencies": {
|
|
52
|
-
"effect": "4.0.0-beta.
|
|
53
|
-
"graphql": "16.14.
|
|
50
|
+
"effect": "4.0.0-beta.78",
|
|
51
|
+
"graphql": "16.14.1",
|
|
54
52
|
"yaml": "2.9.0"
|
|
55
53
|
},
|
|
56
54
|
"devDependencies": {
|
|
57
55
|
"@effect/language-service": "0.86.2",
|
|
58
|
-
"@graphql-codegen/cli": "7.1.
|
|
56
|
+
"@graphql-codegen/cli": "7.1.2",
|
|
59
57
|
"@graphql-codegen/client-preset": "6.0.1",
|
|
60
58
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
61
59
|
"@types/node": "25.9.1",
|
|
62
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
60
|
+
"@typescript/native-preview": "7.0.0-dev.20260604.1",
|
|
63
61
|
"openapi-typescript": "7.13.0",
|
|
64
|
-
"oxfmt": "0.
|
|
65
|
-
"oxlint": "1.
|
|
66
|
-
"tsdown": "0.22.
|
|
62
|
+
"oxfmt": "0.53.0",
|
|
63
|
+
"oxlint": "1.68.0",
|
|
64
|
+
"tsdown": "0.22.2",
|
|
67
65
|
"typescript": "6.0.3",
|
|
68
|
-
"vitest": "4.1.
|
|
66
|
+
"vitest": "4.1.8"
|
|
67
|
+
},
|
|
68
|
+
"inlinedDependencies": {
|
|
69
|
+
"@graphql-typed-document-node/core": "3.2.0"
|
|
69
70
|
},
|
|
70
71
|
"scripts": {
|
|
71
72
|
"p": "pnpm run build && node --env-file=.env playground.ts",
|
package/dist/parser-D6UAf8Ld.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { DateTime, Duration, Option } from "effect";
|
|
2
|
-
//#region src/adapters/shared/parser/local-date.ts
|
|
3
|
-
const ISO_LOCAL_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
4
|
-
const isLocalDateString = (value) => {
|
|
5
|
-
if (!ISO_LOCAL_DATE_PATTERN.test(value)) return false;
|
|
6
|
-
const date = DateTime.make(value);
|
|
7
|
-
return Option.isSome(date) && DateTime.formatIsoDateUtc(date.value) === value;
|
|
8
|
-
};
|
|
9
|
-
const daysBetweenLocalDates = ({ start, end }) => {
|
|
10
|
-
const startDate = DateTime.removeTime(DateTime.makeUnsafe(start));
|
|
11
|
-
const endDate = DateTime.removeTime(DateTime.makeUnsafe(end));
|
|
12
|
-
const duration = DateTime.toEpochMillis(endDate) - DateTime.toEpochMillis(startDate);
|
|
13
|
-
return Math.trunc(Duration.toDays(Duration.millis(duration)));
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/adapters/shared/parser/period-query-date.ts
|
|
17
|
-
const PREFERRED_QUERY_DATE_PATTERN = /^(\d{2})-(\d{2})-(\d{4})$/;
|
|
18
|
-
const ISO_QUERY_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
19
|
-
const QUERY_MONTH_PATTERN = /^(\d{2})-(\d{4})$/;
|
|
20
|
-
const toIsoDateFromPeriodQueryDate = (value) => {
|
|
21
|
-
const preferredMatch = PREFERRED_QUERY_DATE_PATTERN.exec(value);
|
|
22
|
-
const isoDate = preferredMatch == null ? ISO_QUERY_DATE_PATTERN.test(value) ? value : void 0 : `${preferredMatch[3]}-${preferredMatch[2]}-${preferredMatch[1]}`;
|
|
23
|
-
if (isoDate === void 0) return;
|
|
24
|
-
return isLocalDateString(isoDate) ? isoDate : void 0;
|
|
25
|
-
};
|
|
26
|
-
const toYearMonthFromPeriodQueryMonth = (value) => {
|
|
27
|
-
const match = QUERY_MONTH_PATTERN.exec(value);
|
|
28
|
-
if (!match) return;
|
|
29
|
-
const [, month, year] = match;
|
|
30
|
-
const monthNumber = Number.parseInt(month, 10);
|
|
31
|
-
return monthNumber >= 1 && monthNumber <= 12 ? {
|
|
32
|
-
year: Number.parseInt(year, 10),
|
|
33
|
-
month: monthNumber
|
|
34
|
-
} : void 0;
|
|
35
|
-
};
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/adapters/shared/parser/locale.ts
|
|
38
|
-
const localeToLanguage = (locale) => locale.split("-")[0] ?? locale;
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/adapters/shared/parser/translation.ts
|
|
41
|
-
const makeTranslate = (translations, locale) => (key, fallback) => translations.translate(locale, key, fallback);
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/adapters/shared/parser/to-country.ts
|
|
44
|
-
const toCountry = (country, locale) => {
|
|
45
|
-
const normalizedCountryCode = country.trim().toUpperCase();
|
|
46
|
-
if (!/^[A-Z]{2}$/.test(normalizedCountryCode)) return country;
|
|
47
|
-
return new Intl.DisplayNames([locale], { type: "region" }).of(normalizedCountryCode) ?? country;
|
|
48
|
-
};
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/adapters/shared/parser/to-night-count.ts
|
|
51
|
-
const toNightCount = (input) => {
|
|
52
|
-
const nights = daysBetweenLocalDates({
|
|
53
|
-
start: input.period.start,
|
|
54
|
-
end: input.period.end
|
|
55
|
-
});
|
|
56
|
-
return Math.max(1, nights);
|
|
57
|
-
};
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/adapters/shared/parser/unknown.ts
|
|
60
|
-
const asRecord = (value) => typeof value === "object" && value !== null ? value : {};
|
|
61
|
-
const asArray = (value) => Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
62
|
-
const firstString = (...values) => values.find((value) => typeof value === "string" && value.length > 0);
|
|
63
|
-
const firstNumber = (...values) => values.find((value) => typeof value === "number" && Number.isFinite(value));
|
|
64
|
-
//#endregion
|
|
65
|
-
export { toNightCount as a, localeToLanguage as c, daysBetweenLocalDates as d, firstString as i, toIsoDateFromPeriodQueryDate as l, asRecord as n, toCountry as o, firstNumber as r, makeTranslate as s, asArray as t, toYearMonthFromPeriodQueryMonth as u };
|