@vrplatform/api 1.2.33-951 → 1.2.33-955

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.
Files changed (41) hide show
  1. package/build/main/generated/v1.d.ts +14 -14
  2. package/build/main/generated/v1.js.map +1 -1
  3. package/build/main/index.d.ts +4 -4
  4. package/build/main/index.js +0 -1
  5. package/build/main/index.js.map +1 -1
  6. package/build/main/ingest/index.d.ts +0 -1
  7. package/build/main/ingest/index.js.map +1 -1
  8. package/build/main/tsconfig.main.tsbuildinfo +1 -1
  9. package/build/module/generated/v1.d.ts +14 -14
  10. package/build/module/generated/v1.js.map +1 -1
  11. package/build/module/index.d.ts +4 -4
  12. package/build/module/index.js +0 -1
  13. package/build/module/index.js.map +1 -1
  14. package/build/module/ingest/index.d.ts +0 -1
  15. package/build/module/ingest/index.js.map +1 -1
  16. package/build/module/tsconfig.esm.tsbuildinfo +1 -1
  17. package/package.json +1 -1
  18. package/src/generated/v1.ts +14 -14
  19. package/src/index.ts +5 -10
  20. package/src/ingest/index.ts +0 -2
  21. package/build/main/ingest-compat/index.d.ts +0 -13
  22. package/build/main/ingest-compat/index.js +0 -92
  23. package/build/main/ingest-compat/index.js.map +0 -1
  24. package/build/main/ingest-compat/map.d.ts +0 -6
  25. package/build/main/ingest-compat/map.js +0 -67
  26. package/build/main/ingest-compat/map.js.map +0 -1
  27. package/build/main/ingest-compat/types.d.ts +0 -7
  28. package/build/main/ingest-compat/types.js +0 -3
  29. package/build/main/ingest-compat/types.js.map +0 -1
  30. package/build/module/ingest-compat/index.d.ts +0 -13
  31. package/build/module/ingest-compat/index.js +0 -75
  32. package/build/module/ingest-compat/index.js.map +0 -1
  33. package/build/module/ingest-compat/map.d.ts +0 -6
  34. package/build/module/ingest-compat/map.js +0 -64
  35. package/build/module/ingest-compat/map.js.map +0 -1
  36. package/build/module/ingest-compat/types.d.ts +0 -7
  37. package/build/module/ingest-compat/types.js +0 -2
  38. package/build/module/ingest-compat/types.js.map +0 -1
  39. package/src/ingest-compat/index.ts +0 -98
  40. package/src/ingest-compat/map.ts +0 -111
  41. package/src/ingest-compat/types.ts +0 -9
@@ -1,64 +0,0 @@
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
@@ -1 +0,0 @@
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,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,EAAE,EACV,QAAQ,EAAE,GAAG,GACI,EAAqB,EAAE,CAAC,CAAC;QAC1C,EAAE;QACF,SAAS;QACT,WAAW;QACX,MAAM,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;QAC7C,SAAS,EACP,mBAAmB,EAAE,QAAQ,EAAE,IAAI,oBAAoB,EAAE,QAAQ,EAAE;QACrE,SAAS;QACT,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,eAAe;QACf,gBAAgB;QAChB,UAAU;QACV,MAAM;QACN,gBAAgB;QAChB,KAAK,EACF,YAAsB,EAAE,GAAG,CAE1B,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACX,IAAI,EAAE,IAAI,CAAC,KAAM;YACjB,MAAM,EAAE,IAAI,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,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,O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AAe;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"]}
@@ -1,7 +0,0 @@
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];
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
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"]}
@@ -1,98 +0,0 @@
1
- import {
2
- type IngestArg,
3
- type IngestFnArg,
4
- type PartialBy,
5
- type Source,
6
- usePostSources,
7
- } from '../ingest';
8
- import type { ApiClient } from '../types';
9
- import { mapTransform } from './map';
10
- import type { ListingInput, PaymentInput, ReservationInput } from './types';
11
-
12
- export * from './map';
13
- export * from './types';
14
-
15
- export function useIngestCompat(api: ApiClient, config: IngestArg) {
16
- const post = usePostSources(api, config);
17
- return {
18
- api,
19
- get sessionId() {
20
- return api.sessionId;
21
- },
22
- async sources(changes: Source[], configOverwrites?: IngestFnArg) {
23
- if (!changes.length) return undefined;
24
- return await post(changes, configOverwrites);
25
- },
26
- async reservations(
27
- changes: PartialBy<Source<ReservationInput>, 'type'>[],
28
- configOverwrites?: IngestFnArg
29
- ) {
30
- if (!changes.length) return [];
31
- return await post<ReservationInput>(
32
- changes.map(({ transform, ...source }) => {
33
- const data = mapTransform.reservation(transform.data);
34
- return {
35
- ...source,
36
- type: source.type || 'reservation',
37
- description: source.description || data.confirmationCode,
38
- uniqueRef: source.uniqueRef || data.uniqueRef!,
39
- date: source.date || data.bookedAt,
40
- status: source.status || 'active',
41
- transform: {
42
- data,
43
- type: 'reservation',
44
- },
45
- };
46
- }),
47
- configOverwrites
48
- );
49
- },
50
- async payments(
51
- changes: PartialBy<Source<PaymentInput>, 'type'>[],
52
- configOverwrites?: IngestFnArg
53
- ) {
54
- if (!changes.length) return undefined;
55
- return await post<PaymentInput>(
56
- changes.map(({ transform, ...source }) => {
57
- const data = mapTransform.payment(transform.data);
58
- return {
59
- ...source,
60
- type: source.type || 'payment',
61
- description: source.description || data.description,
62
- uniqueRef: source.uniqueRef || data.uniqueRef!,
63
- date: source.date || data.paidAt,
64
- status: source.status || 'active',
65
- transform: {
66
- data,
67
- type: 'payment',
68
- },
69
- };
70
- }),
71
- configOverwrites
72
- );
73
- },
74
- async listings(
75
- changes: PartialBy<Source<ListingInput>, 'type'>[],
76
- configOverwrites?: IngestFnArg
77
- ) {
78
- if (!changes.length) return undefined;
79
- return await post<ListingInput>(
80
- changes.map(({ transform, ...source }) => {
81
- const data = mapTransform.listing(transform.data);
82
- return {
83
- ...source,
84
- type: source.type || 'listing',
85
- description: source.description || data.name,
86
- uniqueRef: source.uniqueRef || data.uniqueRef!,
87
- status: source.status || 'active',
88
- transform: {
89
- data,
90
- type: 'listing',
91
- },
92
- };
93
- }),
94
- configOverwrites
95
- );
96
- },
97
- };
98
- }
@@ -1,111 +0,0 @@
1
- import type { RequestBody } from '../types';
2
- import type {
3
- ListingInput,
4
- ListingOutput,
5
- PaymentInput,
6
- PaymentOutput,
7
- ReservationInput,
8
- ReservationOutput,
9
- } from './types';
10
-
11
- export const mapTransform = {
12
- reservation: ({
13
- id,
14
- uniqueRef,
15
- cancelledAt,
16
- status,
17
- listingConnectionId,
18
- listingConnectionRef,
19
- guestName,
20
- checkIn,
21
- checkOut,
22
- metadata,
23
- currency,
24
- bookedAt,
25
- bookingPlatform,
26
- pmsReferenceCode,
27
- bookerName,
28
- guests,
29
- confirmationCode,
30
- paymentLines,
31
- centTotal: _,
32
- nights: __,
33
- sourceId: ___,
34
- }: ReservationInput): ReservationOutput => ({
35
- id,
36
- uniqueRef,
37
- cancelledAt,
38
- status: status === 'inactive' ? null : status,
39
- listingId:
40
- listingConnectionId?.toString() || listingConnectionRef?.toString(),
41
- guestName,
42
- checkIn,
43
- checkOut,
44
- metadata,
45
- currency,
46
- bookedAt,
47
- bookingPlatform,
48
- pmsReferenceCode,
49
- bookerName,
50
- guests,
51
- confirmationCode,
52
- lines:
53
- (paymentLines as any[])?.map<
54
- RequestBody<'post:/reservations/batch'>['data'][0]['lines'][0]
55
- >((line) => ({
56
- type: line.type2!,
57
- amount: line.centTotal || 0,
58
- uniqueRef: line.uniqueRef,
59
- description: line.description,
60
- metadata: line.metadata,
61
- })) || [],
62
- }),
63
- payment: ({
64
- currency,
65
- description,
66
- uniqueRef,
67
- payedAt,
68
- etaAt,
69
- metadata,
70
- lines,
71
- }: PaymentInput): PaymentOutput => ({
72
- uniqueRef,
73
- metadata,
74
- currency,
75
- paidAt: payedAt,
76
- etaAt,
77
- description: description ?? 'Payment',
78
- lines:
79
- (lines as any[])?.map<
80
- RequestBody<'post:/payments/batch'>['data'][0]['lines'][0]
81
- >((line) => ({
82
- type: line.type2!,
83
- amount: line.centTotal || 0,
84
- uniqueRef: line.uniqueRef,
85
- description: line.description,
86
- metadata: line.metadata,
87
- })) || [],
88
- }),
89
- listing: (item: ListingInput): ListingOutput => {
90
- let status =
91
- item.status === 'disabled'
92
- ? 'inactive'
93
- : item.status === 'enabled'
94
- ? 'active'
95
- : item.status;
96
- if (!item.status && item.pmsStatus) {
97
- status =
98
- item.pmsStatus === 'disabled' || item.pmsStatus === 'inactive'
99
- ? 'inactive'
100
- : item.pmsStatus === 'enabled' || item.pmsStatus === 'active'
101
- ? 'active'
102
- : null;
103
- }
104
- return {
105
- name: `${item.name}`,
106
- status: status || 'active',
107
- uniqueRef: item.uniqueRef,
108
- defaultCurrency: item.defaultCurrency,
109
- };
110
- },
111
- };
@@ -1,9 +0,0 @@
1
- import type { RequestBody } from '../types';
2
-
3
- export type ReservationInput = Record<string, any>;
4
- export type ReservationOutput =
5
- RequestBody<'post:/reservations/batch'>['data'][0];
6
- export type PaymentInput = Record<string, any>;
7
- export type PaymentOutput = RequestBody<'post:/payments/batch'>['data'][0];
8
- export type ListingInput = Record<string, any>;
9
- export type ListingOutput = RequestBody<'post:/listings/batch'>['data'][0];