@vrplatform/api 1.2.40-stage.1070 → 1.3.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/build/main/generated/v1.d.ts +49 -14
- package/build/main/generated/v1.js.map +1 -1
- package/build/main/ingest-compat/index.d.ts +13 -0
- package/build/main/ingest-compat/index.js +92 -0
- package/build/main/ingest-compat/index.js.map +1 -0
- package/build/main/ingest-compat/map.d.ts +6 -0
- package/build/main/ingest-compat/map.js +67 -0
- package/build/main/ingest-compat/map.js.map +1 -0
- package/build/main/ingest-compat/types.d.ts +7 -0
- package/build/main/ingest-compat/types.js +3 -0
- package/build/main/ingest-compat/types.js.map +1 -0
- package/build/module/generated/v1.d.ts +49 -14
- package/build/module/generated/v1.js.map +1 -1
- package/build/module/ingest-compat/index.d.ts +13 -0
- package/build/module/ingest-compat/index.js +75 -0
- package/build/module/ingest-compat/index.js.map +1 -0
- package/build/module/ingest-compat/map.d.ts +6 -0
- package/build/module/ingest-compat/map.js +64 -0
- package/build/module/ingest-compat/map.js.map +1 -0
- package/build/module/ingest-compat/types.d.ts +7 -0
- package/build/module/ingest-compat/types.js +2 -0
- package/build/module/ingest-compat/types.js.map +1 -0
- package/package.json +2 -2
- package/src/generated/v1.ts +49 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type IngestArg, type IngestFnArg, type PartialBy, type Source } from '../ingest';
|
|
2
|
+
import type { ApiClient } from '../types';
|
|
3
|
+
import type { ListingInput, PaymentInput, ReservationInput } from './types';
|
|
4
|
+
export * from './map';
|
|
5
|
+
export * from './types';
|
|
6
|
+
export declare function useIngestCompat(api: ApiClient, config: IngestArg): {
|
|
7
|
+
api: ApiClient;
|
|
8
|
+
readonly sessionId: string;
|
|
9
|
+
sources(changes: Source[], configOverwrites?: IngestFnArg): Promise<import("../ingest").TypedResponseData<undefined>[] | undefined>;
|
|
10
|
+
reservations(changes: PartialBy<Source<ReservationInput>, "type">[], configOverwrites?: IngestFnArg): Promise<import("../ingest").TypedResponseData<ReservationInput>[]>;
|
|
11
|
+
payments(changes: PartialBy<Source<PaymentInput>, "type">[], configOverwrites?: IngestFnArg): Promise<import("../ingest").TypedResponseData<PaymentInput>[] | undefined>;
|
|
12
|
+
listings(changes: PartialBy<Source<ListingInput>, "type">[], configOverwrites?: IngestFnArg): Promise<import("../ingest").TypedResponseData<ListingInput>[] | undefined>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { usePostSources, } from '../ingest';
|
|
2
|
+
import { mapTransform } from './map';
|
|
3
|
+
export * from './map';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export function useIngestCompat(api, config) {
|
|
6
|
+
const post = usePostSources(api, config);
|
|
7
|
+
return {
|
|
8
|
+
api,
|
|
9
|
+
get sessionId() {
|
|
10
|
+
return api.sessionId;
|
|
11
|
+
},
|
|
12
|
+
async sources(changes, configOverwrites) {
|
|
13
|
+
if (!changes.length)
|
|
14
|
+
return undefined;
|
|
15
|
+
return await post(changes, configOverwrites);
|
|
16
|
+
},
|
|
17
|
+
async reservations(changes, configOverwrites) {
|
|
18
|
+
if (!changes.length)
|
|
19
|
+
return [];
|
|
20
|
+
return await post(changes.map(({ transform, ...source }) => {
|
|
21
|
+
const data = mapTransform.reservation(transform.data);
|
|
22
|
+
return {
|
|
23
|
+
...source,
|
|
24
|
+
type: source.type || 'reservation',
|
|
25
|
+
description: source.description || data.confirmationCode,
|
|
26
|
+
uniqueRef: source.uniqueRef || data.uniqueRef,
|
|
27
|
+
date: source.date || data.bookedAt,
|
|
28
|
+
status: source.status || 'active',
|
|
29
|
+
transform: {
|
|
30
|
+
data,
|
|
31
|
+
type: 'reservation',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}), configOverwrites);
|
|
35
|
+
},
|
|
36
|
+
async payments(changes, configOverwrites) {
|
|
37
|
+
if (!changes.length)
|
|
38
|
+
return undefined;
|
|
39
|
+
return await post(changes.map(({ transform, ...source }) => {
|
|
40
|
+
const data = mapTransform.payment(transform.data);
|
|
41
|
+
return {
|
|
42
|
+
...source,
|
|
43
|
+
type: source.type || 'payment',
|
|
44
|
+
description: source.description || data.description,
|
|
45
|
+
uniqueRef: source.uniqueRef || data.uniqueRef,
|
|
46
|
+
date: source.date || data.paidAt,
|
|
47
|
+
status: source.status || 'active',
|
|
48
|
+
transform: {
|
|
49
|
+
data,
|
|
50
|
+
type: 'payment',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}), configOverwrites);
|
|
54
|
+
},
|
|
55
|
+
async listings(changes, configOverwrites) {
|
|
56
|
+
if (!changes.length)
|
|
57
|
+
return undefined;
|
|
58
|
+
return await post(changes.map(({ transform, ...source }) => {
|
|
59
|
+
const data = mapTransform.listing(transform.data);
|
|
60
|
+
return {
|
|
61
|
+
...source,
|
|
62
|
+
type: source.type || 'listing',
|
|
63
|
+
description: source.description || data.name,
|
|
64
|
+
uniqueRef: source.uniqueRef || data.uniqueRef,
|
|
65
|
+
status: source.status || 'active',
|
|
66
|
+
transform: {
|
|
67
|
+
data,
|
|
68
|
+
type: 'listing',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}), configOverwrites);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["ingest-compat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAExB,MAAM,UAAU,eAAe,CAAC,GAAc,EAAE,MAAiB;IAC/D,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACzC,OAAO;QACL,GAAG;QACH,IAAI,SAAS;YACX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,\n type IngestFnArg,\n type PartialBy,\n type Source,\n usePostSources,\n} from '../ingest';\nimport type { ApiClient } from '../types';\nimport { mapTransform } from './map';\nimport type { ListingInput, PaymentInput, ReservationInput } from './types';\n\nexport * from './map';\nexport * from './types';\n\nexport function useIngestCompat(api: ApiClient, config: IngestArg) {\n const post = usePostSources(api, config);\n return {\n api,\n get sessionId() {\n return api.sessionId;\n },\n async sources(changes: Source[], configOverwrites?: IngestFnArg) {\n if (!changes.length) return undefined;\n return await post(changes, configOverwrites);\n },\n async reservations(\n changes: PartialBy<Source<ReservationInput>, 'type'>[],\n configOverwrites?: IngestFnArg\n ) {\n if (!changes.length) return [];\n return await post<ReservationInput>(\n changes.map(({ transform, ...source }) => {\n const data = mapTransform.reservation(transform.data);\n return {\n ...source,\n type: source.type || 'reservation',\n description: source.description || data.confirmationCode,\n uniqueRef: source.uniqueRef || data.uniqueRef!,\n date: source.date || data.bookedAt,\n status: source.status || 'active',\n transform: {\n data,\n type: 'reservation',\n },\n };\n }),\n configOverwrites\n );\n },\n async payments(\n changes: PartialBy<Source<PaymentInput>, 'type'>[],\n configOverwrites?: IngestFnArg\n ) {\n if (!changes.length) return undefined;\n return await post<PaymentInput>(\n changes.map(({ transform, ...source }) => {\n const data = mapTransform.payment(transform.data);\n return {\n ...source,\n type: source.type || 'payment',\n description: source.description || data.description,\n uniqueRef: source.uniqueRef || data.uniqueRef!,\n date: source.date || data.paidAt,\n status: source.status || 'active',\n transform: {\n data,\n type: 'payment',\n },\n };\n }),\n configOverwrites\n );\n },\n async listings(\n changes: PartialBy<Source<ListingInput>, 'type'>[],\n configOverwrites?: IngestFnArg\n ) {\n if (!changes.length) return undefined;\n return await post<ListingInput>(\n changes.map(({ transform, ...source }) => {\n const data = mapTransform.listing(transform.data);\n return {\n ...source,\n type: source.type || 'listing',\n description: source.description || data.name,\n uniqueRef: source.uniqueRef || data.uniqueRef!,\n status: source.status || 'active',\n transform: {\n data,\n type: 'listing',\n },\n };\n }),\n configOverwrites\n );\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ListingInput, ListingOutput, PaymentInput, PaymentOutput, ReservationInput, ReservationOutput } from './types';
|
|
2
|
+
export declare const mapTransform: {
|
|
3
|
+
reservation: ({ id, uniqueRef, cancelledAt, status, listingConnectionId, listingConnectionRef, guestName, checkIn, checkOut, metadata, currency, bookedAt, bookingPlatform, pmsReferenceCode, bookerName, guests, confirmationCode, paymentLines, centTotal: _, nights: __, sourceId: ___, }: ReservationInput) => ReservationOutput;
|
|
4
|
+
payment: ({ currency, description, uniqueRef, payedAt, etaAt, metadata, lines, }: PaymentInput) => PaymentOutput;
|
|
5
|
+
listing: (item: ListingInput) => ListingOutput;
|
|
6
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export const mapTransform = {
|
|
2
|
+
reservation: ({ id, uniqueRef, cancelledAt, status, listingConnectionId, listingConnectionRef, guestName, checkIn, checkOut, metadata, currency, bookedAt, bookingPlatform, pmsReferenceCode, bookerName, guests, confirmationCode, paymentLines, centTotal: _, nights: __, sourceId: ___, }) => ({
|
|
3
|
+
id,
|
|
4
|
+
uniqueRef,
|
|
5
|
+
cancelledAt,
|
|
6
|
+
status: status === 'inactive' ? null : status,
|
|
7
|
+
listingId: listingConnectionId?.toString() || listingConnectionRef?.toString(),
|
|
8
|
+
guestName,
|
|
9
|
+
checkIn,
|
|
10
|
+
checkOut,
|
|
11
|
+
metadata,
|
|
12
|
+
currency,
|
|
13
|
+
bookedAt,
|
|
14
|
+
bookingPlatform,
|
|
15
|
+
pmsReferenceCode,
|
|
16
|
+
bookerName,
|
|
17
|
+
guests,
|
|
18
|
+
confirmationCode,
|
|
19
|
+
lines: paymentLines?.map((line) => ({
|
|
20
|
+
type: line.type2,
|
|
21
|
+
amount: line.centTotal || 0,
|
|
22
|
+
uniqueRef: line.uniqueRef,
|
|
23
|
+
description: line.description,
|
|
24
|
+
metadata: line.metadata,
|
|
25
|
+
})) || [],
|
|
26
|
+
}),
|
|
27
|
+
payment: ({ currency, description, uniqueRef, payedAt, etaAt, metadata, lines, }) => ({
|
|
28
|
+
uniqueRef,
|
|
29
|
+
metadata,
|
|
30
|
+
currency,
|
|
31
|
+
paidAt: payedAt,
|
|
32
|
+
etaAt,
|
|
33
|
+
description: description ?? 'Payment',
|
|
34
|
+
lines: lines?.map((line) => ({
|
|
35
|
+
type: line.type2,
|
|
36
|
+
amount: line.centTotal || 0,
|
|
37
|
+
uniqueRef: line.uniqueRef,
|
|
38
|
+
description: line.description,
|
|
39
|
+
metadata: line.metadata,
|
|
40
|
+
})) || [],
|
|
41
|
+
}),
|
|
42
|
+
listing: (item) => {
|
|
43
|
+
let status = item.status === 'disabled'
|
|
44
|
+
? 'inactive'
|
|
45
|
+
: item.status === 'enabled'
|
|
46
|
+
? 'active'
|
|
47
|
+
: item.status;
|
|
48
|
+
if (!item.status && item.pmsStatus) {
|
|
49
|
+
status =
|
|
50
|
+
item.pmsStatus === 'disabled' || item.pmsStatus === 'inactive'
|
|
51
|
+
? 'inactive'
|
|
52
|
+
: item.pmsStatus === 'enabled' || item.pmsStatus === 'active'
|
|
53
|
+
? 'active'
|
|
54
|
+
: null;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
name: `${item.name}`,
|
|
58
|
+
status: status || 'active',
|
|
59
|
+
uniqueRef: item.uniqueRef,
|
|
60
|
+
defaultCurrency: item.defaultCurrency,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","sourceRoot":"src/","sources":["ingest-compat/map.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,WAAW,EAAE,CAAC,EACZ,EAAE,EACF,SAAS,EACT,WAAW,EACX,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,OAAO,EACP,QAAQ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CAAC,SAAS,IAAI,CAAC;YAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC,IAAI,EAAE;KACZ,CAAC;IACF,OAAO,EAAE,CAAC,IAAkB,EAAiB,EAAE;QAC7C,IAAI,MAAM,GACR,IAAI,CAAC,MAAM,KAAK,UAAU;YACxB,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS;gBACzB,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM;gBACJ,IAAI,CAAC,SAAS,KAAK,UAAU,IAAI,IAAI,CAAC,SAAS,KAAK,UAAU;oBAC5D,CAAC,CAAC,UAAU;oBACZ,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ;wBAC3D,CAAC,CAAC,QAAQ;wBACV,CAAC,CAAC,IAAI,CAAC;QACf,CAAC;QACD,OAAO;YACL,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE;YACpB,MAAM,EAAE,MAAM,IAAI,QAAQ;YAC1B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import type { RequestBody } from '../types';\nimport type {\n ListingInput,\n ListingOutput,\n PaymentInput,\n PaymentOutput,\n ReservationInput,\n ReservationOutput,\n} from './types';\n\nexport const mapTransform = {\n reservation: ({\n id,\n uniqueRef,\n cancelledAt,\n status,\n listingConnectionId,\n listingConnectionRef,\n guestName,\n checkIn,\n checkOut,\n metadata,\n currency,\n bookedAt,\n bookingPlatform,\n pmsReferenceCode,\n bookerName,\n guests,\n confirmationCode,\n paymentLines,\n centTotal: _,\n nights: __,\n sourceId: ___,\n }: ReservationInput): ReservationOutput => ({\n id,\n uniqueRef,\n cancelledAt,\n status: status === 'inactive' ? null : status,\n listingId:\n listingConnectionId?.toString() || listingConnectionRef?.toString(),\n guestName,\n checkIn,\n checkOut,\n metadata,\n currency,\n bookedAt,\n bookingPlatform,\n pmsReferenceCode,\n bookerName,\n guests,\n confirmationCode,\n lines:\n (paymentLines as any[])?.map<\n RequestBody<'post:/reservations/batch'>['data'][0]['lines'][0]\n >((line) => ({\n type: line.type2!,\n amount: line.centTotal || 0,\n uniqueRef: line.uniqueRef,\n description: line.description,\n metadata: line.metadata,\n })) || [],\n }),\n payment: ({\n currency,\n description,\n uniqueRef,\n payedAt,\n etaAt,\n metadata,\n lines,\n }: PaymentInput): PaymentOutput => ({\n uniqueRef,\n metadata,\n currency,\n paidAt: payedAt,\n etaAt,\n description: description ?? 'Payment',\n lines:\n (lines as any[])?.map<\n RequestBody<'post:/payments/batch'>['data'][0]['lines'][0]\n >((line) => ({\n type: line.type2!,\n amount: line.centTotal || 0,\n uniqueRef: line.uniqueRef,\n description: line.description,\n metadata: line.metadata,\n })) || [],\n }),\n listing: (item: ListingInput): ListingOutput => {\n let status =\n item.status === 'disabled'\n ? 'inactive'\n : item.status === 'enabled'\n ? 'active'\n : item.status;\n if (!item.status && item.pmsStatus) {\n status =\n item.pmsStatus === 'disabled' || item.pmsStatus === 'inactive'\n ? 'inactive'\n : item.pmsStatus === 'enabled' || item.pmsStatus === 'active'\n ? 'active'\n : null;\n }\n return {\n name: `${item.name}`,\n status: status || 'active',\n uniqueRef: item.uniqueRef,\n defaultCurrency: item.defaultCurrency,\n };\n },\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RequestBody } from '../types';
|
|
2
|
+
export type ReservationInput = Record<string, any>;
|
|
3
|
+
export type ReservationOutput = RequestBody<'post:/reservations/batch'>['data'][0];
|
|
4
|
+
export type PaymentInput = Record<string, any>;
|
|
5
|
+
export type PaymentOutput = RequestBody<'post:/payments/batch'>['data'][0];
|
|
6
|
+
export type ListingInput = Record<string, any>;
|
|
7
|
+
export type ListingOutput = RequestBody<'post:/listings/batch'>['data'][0];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"src/","sources":["ingest-compat/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RequestBody } from '../types';\n\nexport type ReservationInput = Record<string, any>;\nexport type ReservationOutput =\n RequestBody<'post:/reservations/batch'>['data'][0];\nexport type PaymentInput = Record<string, any>;\nexport type PaymentOutput = RequestBody<'post:/payments/batch'>['data'][0];\nexport type ListingInput = Record<string, any>;\nexport type ListingOutput = RequestBody<'post:/listings/batch'>['data'][0];\n"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.3.0",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "build/main/index.js",
|
|
9
9
|
"module": "build/module/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"LICENSE"
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
|
-
"pub": "bunx bumpp --no-commit --no-git-check --no-verify --ignore-scripts --no-tag -p=false",
|
|
34
|
+
"pub": "bunx bumpp --no-commit --no-git-check --no-verify --ignore-scripts --no-tag -p=false && bun run npmpub",
|
|
35
35
|
"npmpub": "bun run build && bunx vrp-deploy --prefix npmpub",
|
|
36
36
|
"npmpub:main": "pnpm publish --no-git-checks --tag staging",
|
|
37
37
|
"npmpub:release": "pnpm publish --no-git-checks",
|
package/src/generated/v1.ts
CHANGED
|
@@ -4141,6 +4141,12 @@ export interface operations {
|
|
|
4141
4141
|
/** @enum {string} */
|
|
4142
4142
|
severity: "warning";
|
|
4143
4143
|
context: Record<string, never>;
|
|
4144
|
+
} | {
|
|
4145
|
+
/** @enum {string} */
|
|
4146
|
+
code: "guestTotalsZero";
|
|
4147
|
+
/** @enum {string} */
|
|
4148
|
+
severity: "warning";
|
|
4149
|
+
context: Record<string, never>;
|
|
4144
4150
|
})[];
|
|
4145
4151
|
connection?: {
|
|
4146
4152
|
/** Format: uuid */
|
|
@@ -4159,6 +4165,7 @@ export interface operations {
|
|
|
4159
4165
|
tax: number;
|
|
4160
4166
|
manager: number;
|
|
4161
4167
|
owner: number;
|
|
4168
|
+
reservation: number;
|
|
4162
4169
|
expense: number;
|
|
4163
4170
|
deposit: number;
|
|
4164
4171
|
guest: number;
|
|
@@ -4517,6 +4524,12 @@ export interface operations {
|
|
|
4517
4524
|
/** @enum {string} */
|
|
4518
4525
|
severity: "warning";
|
|
4519
4526
|
context: Record<string, never>;
|
|
4527
|
+
} | {
|
|
4528
|
+
/** @enum {string} */
|
|
4529
|
+
code: "guestTotalsZero";
|
|
4530
|
+
/** @enum {string} */
|
|
4531
|
+
severity: "warning";
|
|
4532
|
+
context: Record<string, never>;
|
|
4520
4533
|
})[];
|
|
4521
4534
|
connection?: {
|
|
4522
4535
|
/** Format: uuid */
|
|
@@ -4535,6 +4548,7 @@ export interface operations {
|
|
|
4535
4548
|
tax: number;
|
|
4536
4549
|
manager: number;
|
|
4537
4550
|
owner: number;
|
|
4551
|
+
reservation: number;
|
|
4538
4552
|
expense: number;
|
|
4539
4553
|
deposit: number;
|
|
4540
4554
|
guest: number;
|
|
@@ -4973,6 +4987,12 @@ export interface operations {
|
|
|
4973
4987
|
/** @enum {string} */
|
|
4974
4988
|
severity: "warning";
|
|
4975
4989
|
context: Record<string, never>;
|
|
4990
|
+
} | {
|
|
4991
|
+
/** @enum {string} */
|
|
4992
|
+
code: "guestTotalsZero";
|
|
4993
|
+
/** @enum {string} */
|
|
4994
|
+
severity: "warning";
|
|
4995
|
+
context: Record<string, never>;
|
|
4976
4996
|
})[];
|
|
4977
4997
|
connection?: {
|
|
4978
4998
|
/** Format: uuid */
|
|
@@ -4991,6 +5011,7 @@ export interface operations {
|
|
|
4991
5011
|
tax: number;
|
|
4992
5012
|
manager: number;
|
|
4993
5013
|
owner: number;
|
|
5014
|
+
reservation: number;
|
|
4994
5015
|
expense: number;
|
|
4995
5016
|
deposit: number;
|
|
4996
5017
|
guest: number;
|
|
@@ -5367,6 +5388,12 @@ export interface operations {
|
|
|
5367
5388
|
/** @enum {string} */
|
|
5368
5389
|
severity: "warning";
|
|
5369
5390
|
context: Record<string, never>;
|
|
5391
|
+
} | {
|
|
5392
|
+
/** @enum {string} */
|
|
5393
|
+
code: "guestTotalsZero";
|
|
5394
|
+
/** @enum {string} */
|
|
5395
|
+
severity: "warning";
|
|
5396
|
+
context: Record<string, never>;
|
|
5370
5397
|
})[];
|
|
5371
5398
|
connection?: {
|
|
5372
5399
|
/** Format: uuid */
|
|
@@ -5644,6 +5671,12 @@ export interface operations {
|
|
|
5644
5671
|
/** @enum {string} */
|
|
5645
5672
|
severity: "warning";
|
|
5646
5673
|
context: Record<string, never>;
|
|
5674
|
+
} | {
|
|
5675
|
+
/** @enum {string} */
|
|
5676
|
+
code: "guestTotalsZero";
|
|
5677
|
+
/** @enum {string} */
|
|
5678
|
+
severity: "warning";
|
|
5679
|
+
context: Record<string, never>;
|
|
5647
5680
|
})[];
|
|
5648
5681
|
connection?: {
|
|
5649
5682
|
/** Format: uuid */
|
|
@@ -5662,6 +5695,7 @@ export interface operations {
|
|
|
5662
5695
|
tax: number;
|
|
5663
5696
|
manager: number;
|
|
5664
5697
|
owner: number;
|
|
5698
|
+
reservation: number;
|
|
5665
5699
|
expense: number;
|
|
5666
5700
|
deposit: number;
|
|
5667
5701
|
guest: number;
|
|
@@ -5875,7 +5909,7 @@ export interface operations {
|
|
|
5875
5909
|
data: {
|
|
5876
5910
|
/** Format: uuid */
|
|
5877
5911
|
listingId: string;
|
|
5878
|
-
/** @default 2025-11-
|
|
5912
|
+
/** @default 2025-11-15 */
|
|
5879
5913
|
startAt: string;
|
|
5880
5914
|
endAt?: string | null;
|
|
5881
5915
|
setListingInactive?: boolean | null;
|
|
@@ -5957,7 +5991,7 @@ export interface operations {
|
|
|
5957
5991
|
"application/json": {
|
|
5958
5992
|
/** Format: uuid */
|
|
5959
5993
|
listingId: string;
|
|
5960
|
-
/** @default 2025-11-
|
|
5994
|
+
/** @default 2025-11-15 */
|
|
5961
5995
|
startAt?: string;
|
|
5962
5996
|
endAt?: string | null;
|
|
5963
5997
|
members: {
|
|
@@ -5991,7 +6025,7 @@ export interface operations {
|
|
|
5991
6025
|
"application/json": {
|
|
5992
6026
|
/** Format: uuid */
|
|
5993
6027
|
listingId: string;
|
|
5994
|
-
/** @default 2025-11-
|
|
6028
|
+
/** @default 2025-11-15 */
|
|
5995
6029
|
startAt: string;
|
|
5996
6030
|
endAt?: string | null;
|
|
5997
6031
|
setListingInactive?: boolean | null;
|
|
@@ -6071,7 +6105,7 @@ export interface operations {
|
|
|
6071
6105
|
"application/json": {
|
|
6072
6106
|
/** Format: uuid */
|
|
6073
6107
|
listingId: string;
|
|
6074
|
-
/** @default 2025-11-
|
|
6108
|
+
/** @default 2025-11-15 */
|
|
6075
6109
|
startAt: string;
|
|
6076
6110
|
endAt?: string | null;
|
|
6077
6111
|
setListingInactive?: boolean | null;
|
|
@@ -6154,7 +6188,7 @@ export interface operations {
|
|
|
6154
6188
|
"application/json": {
|
|
6155
6189
|
/** Format: uuid */
|
|
6156
6190
|
listingId?: string;
|
|
6157
|
-
/** @default 2025-11-
|
|
6191
|
+
/** @default 2025-11-15 */
|
|
6158
6192
|
startAt?: string;
|
|
6159
6193
|
endAt?: string | null;
|
|
6160
6194
|
members?: {
|
|
@@ -6188,7 +6222,7 @@ export interface operations {
|
|
|
6188
6222
|
"application/json": {
|
|
6189
6223
|
/** Format: uuid */
|
|
6190
6224
|
listingId: string;
|
|
6191
|
-
/** @default 2025-11-
|
|
6225
|
+
/** @default 2025-11-15 */
|
|
6192
6226
|
startAt: string;
|
|
6193
6227
|
endAt?: string | null;
|
|
6194
6228
|
setListingInactive?: boolean | null;
|
|
@@ -6374,7 +6408,7 @@ export interface operations {
|
|
|
6374
6408
|
/** Format: uuid */
|
|
6375
6409
|
sourceId?: string | null;
|
|
6376
6410
|
initialOwnership?: {
|
|
6377
|
-
/** @default 2025-11-
|
|
6411
|
+
/** @default 2025-11-15 */
|
|
6378
6412
|
startAt?: string;
|
|
6379
6413
|
endAt?: string | null;
|
|
6380
6414
|
members: {
|
|
@@ -6432,7 +6466,7 @@ export interface operations {
|
|
|
6432
6466
|
status: "active" | "inactive";
|
|
6433
6467
|
defaultCurrency?: string | null;
|
|
6434
6468
|
activeOwnership?: {
|
|
6435
|
-
/** @default 2025-11-
|
|
6469
|
+
/** @default 2025-11-15 */
|
|
6436
6470
|
startAt: string;
|
|
6437
6471
|
endAt?: string | null;
|
|
6438
6472
|
setListingInactive?: boolean | null;
|
|
@@ -6673,7 +6707,7 @@ export interface operations {
|
|
|
6673
6707
|
status: "active" | "inactive";
|
|
6674
6708
|
defaultCurrency?: string | null;
|
|
6675
6709
|
activeOwnership?: {
|
|
6676
|
-
/** @default 2025-11-
|
|
6710
|
+
/** @default 2025-11-15 */
|
|
6677
6711
|
startAt: string;
|
|
6678
6712
|
endAt?: string | null;
|
|
6679
6713
|
setListingInactive?: boolean | null;
|
|
@@ -6812,7 +6846,7 @@ export interface operations {
|
|
|
6812
6846
|
/** Format: uuid */
|
|
6813
6847
|
sourceId?: string | null;
|
|
6814
6848
|
initialOwnership?: {
|
|
6815
|
-
/** @default 2025-11-
|
|
6849
|
+
/** @default 2025-11-15 */
|
|
6816
6850
|
startAt?: string;
|
|
6817
6851
|
endAt?: string | null;
|
|
6818
6852
|
members: {
|
|
@@ -6866,7 +6900,7 @@ export interface operations {
|
|
|
6866
6900
|
status: "active" | "inactive";
|
|
6867
6901
|
defaultCurrency?: string | null;
|
|
6868
6902
|
activeOwnership?: {
|
|
6869
|
-
/** @default 2025-11-
|
|
6903
|
+
/** @default 2025-11-15 */
|
|
6870
6904
|
startAt: string;
|
|
6871
6905
|
endAt?: string | null;
|
|
6872
6906
|
setListingInactive?: boolean | null;
|
|
@@ -7083,7 +7117,7 @@ export interface operations {
|
|
|
7083
7117
|
status: "active" | "inactive";
|
|
7084
7118
|
defaultCurrency?: string | null;
|
|
7085
7119
|
activeOwnership?: {
|
|
7086
|
-
/** @default 2025-11-
|
|
7120
|
+
/** @default 2025-11-15 */
|
|
7087
7121
|
startAt: string;
|
|
7088
7122
|
endAt?: string | null;
|
|
7089
7123
|
setListingInactive?: boolean | null;
|
|
@@ -7230,7 +7264,7 @@ export interface operations {
|
|
|
7230
7264
|
/** Format: uuid */
|
|
7231
7265
|
sourceId?: string | null;
|
|
7232
7266
|
initialOwnership?: {
|
|
7233
|
-
/** @default 2025-11-
|
|
7267
|
+
/** @default 2025-11-15 */
|
|
7234
7268
|
startAt?: string;
|
|
7235
7269
|
endAt?: string | null;
|
|
7236
7270
|
members: {
|
|
@@ -7284,7 +7318,7 @@ export interface operations {
|
|
|
7284
7318
|
status: "active" | "inactive";
|
|
7285
7319
|
defaultCurrency?: string | null;
|
|
7286
7320
|
activeOwnership?: {
|
|
7287
|
-
/** @default 2025-11-
|
|
7321
|
+
/** @default 2025-11-15 */
|
|
7288
7322
|
startAt: string;
|
|
7289
7323
|
endAt?: string | null;
|
|
7290
7324
|
setListingInactive?: boolean | null;
|
|
@@ -9018,6 +9052,7 @@ export interface operations {
|
|
|
9018
9052
|
tax: number;
|
|
9019
9053
|
manager: number;
|
|
9020
9054
|
owner: number;
|
|
9055
|
+
reservation: number;
|
|
9021
9056
|
expense: number;
|
|
9022
9057
|
deposit: number;
|
|
9023
9058
|
guest: number;
|