@atzentis/booking-sdk 0.1.8 → 0.1.10
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/index.cjs +669 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1736 -63
- package/dist/index.d.ts +1736 -63
- package/dist/index.js +660 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37,21 +37,30 @@ __export(index_exports, {
|
|
|
37
37
|
CategoriesService: () => CategoriesService,
|
|
38
38
|
ConflictError: () => ConflictError,
|
|
39
39
|
DEFAULT_MODULES: () => DEFAULT_MODULES,
|
|
40
|
+
DiscountsService: () => DiscountsService,
|
|
40
41
|
DistributionService: () => DistributionService,
|
|
41
42
|
FinanceService: () => FinanceService,
|
|
42
43
|
ForbiddenError: () => ForbiddenError,
|
|
44
|
+
GroupsService: () => GroupsService,
|
|
43
45
|
GuestsService: () => GuestsService,
|
|
46
|
+
HousekeepingService: () => HousekeepingService,
|
|
44
47
|
HttpClient: () => HttpClient,
|
|
48
|
+
NightAuditService: () => NightAuditService,
|
|
45
49
|
NotFoundError: () => NotFoundError,
|
|
46
50
|
PROPERTY_MODULES: () => PROPERTY_MODULES,
|
|
47
51
|
PaymentError: () => PaymentError,
|
|
48
52
|
PaymentsService: () => PaymentsService,
|
|
49
53
|
PropertiesService: () => PropertiesService,
|
|
50
54
|
RateLimitError: () => RateLimitError,
|
|
55
|
+
RatePlansService: () => RatePlansService,
|
|
56
|
+
ReviewsService: () => ReviewsService,
|
|
51
57
|
SPACE_STATUSES: () => SPACE_STATUSES,
|
|
52
58
|
SPACE_TYPES: () => SPACE_TYPES,
|
|
53
59
|
ServerError: () => ServerError,
|
|
54
60
|
SpacesService: () => SpacesService,
|
|
61
|
+
StaffService: () => StaffService,
|
|
62
|
+
SupplyService: () => SupplyService,
|
|
63
|
+
TasksService: () => TasksService,
|
|
55
64
|
TimeoutError: () => TimeoutError,
|
|
56
65
|
VERSION: () => VERSION,
|
|
57
66
|
ValidationError: () => ValidationError,
|
|
@@ -1095,6 +1104,78 @@ var CategoriesService = class extends BaseService {
|
|
|
1095
1104
|
}
|
|
1096
1105
|
};
|
|
1097
1106
|
|
|
1107
|
+
// src/services/discounts.ts
|
|
1108
|
+
var DiscountsService = class extends BaseService {
|
|
1109
|
+
constructor() {
|
|
1110
|
+
super(...arguments);
|
|
1111
|
+
this.basePath = "/guest/v1";
|
|
1112
|
+
}
|
|
1113
|
+
// ---------------------------------------------------------------------------
|
|
1114
|
+
// Rule CRUD
|
|
1115
|
+
// ---------------------------------------------------------------------------
|
|
1116
|
+
/** Create a discount rule */
|
|
1117
|
+
createRule(input) {
|
|
1118
|
+
return this._post(this._buildPath("discounts"), input);
|
|
1119
|
+
}
|
|
1120
|
+
/** Get a discount rule by ID */
|
|
1121
|
+
getRule(ruleId) {
|
|
1122
|
+
return this._get(this._buildPath("discounts", ruleId));
|
|
1123
|
+
}
|
|
1124
|
+
/** List discount rules with optional filters */
|
|
1125
|
+
listRules(params) {
|
|
1126
|
+
const query = {};
|
|
1127
|
+
query.propertyId = params.propertyId;
|
|
1128
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1129
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1130
|
+
if (params.enabled !== void 0) query.enabled = params.enabled;
|
|
1131
|
+
if (params.validOn !== void 0) query.validOn = params.validOn;
|
|
1132
|
+
if (params.sortBy !== void 0) query.sortBy = params.sortBy;
|
|
1133
|
+
if (params.sortOrder !== void 0) query.sortOrder = params.sortOrder;
|
|
1134
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1135
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1136
|
+
return this._get(this._buildPath("discounts"), query);
|
|
1137
|
+
}
|
|
1138
|
+
/** Update a discount rule */
|
|
1139
|
+
updateRule(ruleId, input) {
|
|
1140
|
+
return this._patch(this._buildPath("discounts", ruleId), input);
|
|
1141
|
+
}
|
|
1142
|
+
/** Delete a discount rule */
|
|
1143
|
+
deleteRule(ruleId) {
|
|
1144
|
+
return this._delete(this._buildPath("discounts", ruleId));
|
|
1145
|
+
}
|
|
1146
|
+
// ---------------------------------------------------------------------------
|
|
1147
|
+
// Coupons
|
|
1148
|
+
// ---------------------------------------------------------------------------
|
|
1149
|
+
/** Generate coupon codes for a discount rule */
|
|
1150
|
+
generateCoupons(ruleId, input) {
|
|
1151
|
+
return this._post(this._buildPath("discounts", ruleId, "coupons"), input ?? {});
|
|
1152
|
+
}
|
|
1153
|
+
/** Validate a coupon code against booking context */
|
|
1154
|
+
validateCoupon(input) {
|
|
1155
|
+
return this._post(this._buildPath("discounts", "validate"), input);
|
|
1156
|
+
}
|
|
1157
|
+
// ---------------------------------------------------------------------------
|
|
1158
|
+
// Application
|
|
1159
|
+
// ---------------------------------------------------------------------------
|
|
1160
|
+
/** Apply a discount to a booking */
|
|
1161
|
+
applyDiscount(input) {
|
|
1162
|
+
return this._post(this._buildPath("discounts", "apply"), input);
|
|
1163
|
+
}
|
|
1164
|
+
// ---------------------------------------------------------------------------
|
|
1165
|
+
// Usage tracking
|
|
1166
|
+
// ---------------------------------------------------------------------------
|
|
1167
|
+
/** Get usage statistics and redemption history for a discount rule */
|
|
1168
|
+
getUsage(ruleId, params) {
|
|
1169
|
+
if (!params) return this._get(this._buildPath("discounts", ruleId, "usage"));
|
|
1170
|
+
const query = {};
|
|
1171
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1172
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1173
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1174
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1175
|
+
return this._get(this._buildPath("discounts", ruleId, "usage"), query);
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
|
|
1098
1179
|
// src/services/distribution.ts
|
|
1099
1180
|
var DistributionService = class extends BaseService {
|
|
1100
1181
|
constructor() {
|
|
@@ -1326,6 +1407,94 @@ var FinanceService = class extends BaseService {
|
|
|
1326
1407
|
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1327
1408
|
return this._get(this._buildPath("accounting", "vat"), query);
|
|
1328
1409
|
}
|
|
1410
|
+
// ---------------------------------------------------------------------------
|
|
1411
|
+
// POS Bridge operations (P13)
|
|
1412
|
+
// ---------------------------------------------------------------------------
|
|
1413
|
+
/** Post a POS charge to a guest folio */
|
|
1414
|
+
folioPost(input) {
|
|
1415
|
+
return this._post(this._buildPath("folio-post"), input);
|
|
1416
|
+
}
|
|
1417
|
+
/** List POS charges on a folio */
|
|
1418
|
+
listFolioPostCharges(folioId, params) {
|
|
1419
|
+
if (!params) {
|
|
1420
|
+
return this._get(this._buildPath("folio-post", folioId));
|
|
1421
|
+
}
|
|
1422
|
+
const query = {};
|
|
1423
|
+
if (params.posTerminalId !== void 0) query.posTerminalId = params.posTerminalId;
|
|
1424
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1425
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1426
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1427
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1428
|
+
return this._get(this._buildPath("folio-post", folioId), query);
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// src/services/groups.ts
|
|
1433
|
+
var GroupsService = class extends BaseService {
|
|
1434
|
+
constructor() {
|
|
1435
|
+
super(...arguments);
|
|
1436
|
+
this.basePath = "/booking/v1/groups";
|
|
1437
|
+
}
|
|
1438
|
+
// ---------------------------------------------------------------------------
|
|
1439
|
+
// Group CRUD
|
|
1440
|
+
// ---------------------------------------------------------------------------
|
|
1441
|
+
/** Create a group booking */
|
|
1442
|
+
create(input) {
|
|
1443
|
+
return this._post(this.basePath, input);
|
|
1444
|
+
}
|
|
1445
|
+
/** Get a group booking by ID */
|
|
1446
|
+
get(groupId) {
|
|
1447
|
+
return this._get(this._buildPath(groupId));
|
|
1448
|
+
}
|
|
1449
|
+
/** List group bookings with filters */
|
|
1450
|
+
list(params) {
|
|
1451
|
+
const query = {};
|
|
1452
|
+
query.propertyId = params.propertyId;
|
|
1453
|
+
if (params.status !== void 0) {
|
|
1454
|
+
query.status = Array.isArray(params.status) ? params.status.join(",") : params.status;
|
|
1455
|
+
}
|
|
1456
|
+
if (params.type !== void 0) {
|
|
1457
|
+
query.type = Array.isArray(params.type) ? params.type.join(",") : params.type;
|
|
1458
|
+
}
|
|
1459
|
+
if (params.search !== void 0) query.search = params.search;
|
|
1460
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1461
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1462
|
+
return this._get(this.basePath, query);
|
|
1463
|
+
}
|
|
1464
|
+
/** Update a group booking */
|
|
1465
|
+
update(groupId, input) {
|
|
1466
|
+
return this._patch(this._buildPath(groupId), input);
|
|
1467
|
+
}
|
|
1468
|
+
/** Delete a group booking */
|
|
1469
|
+
delete(groupId) {
|
|
1470
|
+
return this._delete(this._buildPath(groupId));
|
|
1471
|
+
}
|
|
1472
|
+
// ---------------------------------------------------------------------------
|
|
1473
|
+
// Block management
|
|
1474
|
+
// ---------------------------------------------------------------------------
|
|
1475
|
+
/** Create a room block for a group */
|
|
1476
|
+
createBlock(groupId, input) {
|
|
1477
|
+
return this._post(this._buildPath(groupId, "blocks"), input);
|
|
1478
|
+
}
|
|
1479
|
+
/** List blocks for a group */
|
|
1480
|
+
listBlocks(groupId) {
|
|
1481
|
+
return this._get(this._buildPath(groupId, "blocks"));
|
|
1482
|
+
}
|
|
1483
|
+
// ---------------------------------------------------------------------------
|
|
1484
|
+
// Pickup, release, and folio
|
|
1485
|
+
// ---------------------------------------------------------------------------
|
|
1486
|
+
/** Get pickup tracking data for a group */
|
|
1487
|
+
getPickup(groupId) {
|
|
1488
|
+
return this._get(this._buildPath(groupId, "pickup"));
|
|
1489
|
+
}
|
|
1490
|
+
/** Release blocks back to inventory */
|
|
1491
|
+
release(groupId, input) {
|
|
1492
|
+
return this._post(this._buildPath(groupId, "release"), input ?? {});
|
|
1493
|
+
}
|
|
1494
|
+
/** Create a master folio for a group */
|
|
1495
|
+
createFolio(groupId, input) {
|
|
1496
|
+
return this._post(this._buildPath(groupId, "folio"), input ?? {});
|
|
1497
|
+
}
|
|
1329
1498
|
};
|
|
1330
1499
|
|
|
1331
1500
|
// src/services/guests.ts
|
|
@@ -1607,6 +1776,89 @@ var GuestsService = class extends BaseService {
|
|
|
1607
1776
|
}
|
|
1608
1777
|
};
|
|
1609
1778
|
|
|
1779
|
+
// src/services/housekeeping.ts
|
|
1780
|
+
var HousekeepingService = class extends BaseService {
|
|
1781
|
+
constructor() {
|
|
1782
|
+
super(...arguments);
|
|
1783
|
+
this.basePath = "/operations/v1/housekeeping";
|
|
1784
|
+
}
|
|
1785
|
+
// ---------------------------------------------------------------------------
|
|
1786
|
+
// Board and space status
|
|
1787
|
+
// ---------------------------------------------------------------------------
|
|
1788
|
+
/** Get the housekeeping board with optional filters */
|
|
1789
|
+
getBoard(params) {
|
|
1790
|
+
if (!params) return this._get(this._buildPath("board"));
|
|
1791
|
+
const query = {};
|
|
1792
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1793
|
+
if (params.floor !== void 0) query.floor = params.floor;
|
|
1794
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1795
|
+
if (params.assignedTo !== void 0) query.assignedTo = params.assignedTo;
|
|
1796
|
+
return this._get(this._buildPath("board"), query);
|
|
1797
|
+
}
|
|
1798
|
+
/** Update the housekeeping status of a space */
|
|
1799
|
+
updateSpaceStatus(spaceId, input) {
|
|
1800
|
+
return this._patch(this._buildPath("spaces", spaceId), input);
|
|
1801
|
+
}
|
|
1802
|
+
// ---------------------------------------------------------------------------
|
|
1803
|
+
// Task CRUD
|
|
1804
|
+
// ---------------------------------------------------------------------------
|
|
1805
|
+
/** Create a housekeeping task */
|
|
1806
|
+
createTask(input) {
|
|
1807
|
+
return this._post(this._buildPath("tasks"), input);
|
|
1808
|
+
}
|
|
1809
|
+
/** List housekeeping tasks with optional filters */
|
|
1810
|
+
listTasks(params) {
|
|
1811
|
+
if (!params) return this._get(this._buildPath("tasks"));
|
|
1812
|
+
const query = {};
|
|
1813
|
+
if (params.spaceId !== void 0) query.spaceId = params.spaceId;
|
|
1814
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1815
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1816
|
+
if (params.assignedTo !== void 0) query.assignedTo = params.assignedTo;
|
|
1817
|
+
if (params.priority !== void 0) query.priority = params.priority;
|
|
1818
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1819
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1820
|
+
return this._get(this._buildPath("tasks"), query);
|
|
1821
|
+
}
|
|
1822
|
+
/** Update a housekeeping task */
|
|
1823
|
+
updateTask(taskId, input) {
|
|
1824
|
+
return this._patch(this._buildPath("tasks", taskId), input);
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
|
|
1828
|
+
// src/services/night-audit.ts
|
|
1829
|
+
var NightAuditService = class extends BaseService {
|
|
1830
|
+
constructor() {
|
|
1831
|
+
super(...arguments);
|
|
1832
|
+
this.basePath = "/operations/v1/night-audit";
|
|
1833
|
+
}
|
|
1834
|
+
// ---------------------------------------------------------------------------
|
|
1835
|
+
// Run and history
|
|
1836
|
+
// ---------------------------------------------------------------------------
|
|
1837
|
+
/** Run a night audit for a property */
|
|
1838
|
+
run(input) {
|
|
1839
|
+
return this._post(this._buildPath("run"), input);
|
|
1840
|
+
}
|
|
1841
|
+
/** Get night audit history with optional filters */
|
|
1842
|
+
getHistory(params) {
|
|
1843
|
+
if (!params) return this._get(this._buildPath("history"));
|
|
1844
|
+
const query = {};
|
|
1845
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1846
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1847
|
+
if (params.fromDate !== void 0) query.fromDate = params.fromDate;
|
|
1848
|
+
if (params.toDate !== void 0) query.toDate = params.toDate;
|
|
1849
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1850
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1851
|
+
return this._get(this._buildPath("history"), query);
|
|
1852
|
+
}
|
|
1853
|
+
// ---------------------------------------------------------------------------
|
|
1854
|
+
// Report
|
|
1855
|
+
// ---------------------------------------------------------------------------
|
|
1856
|
+
/** Get the detailed report for a completed night audit */
|
|
1857
|
+
getReport(auditId) {
|
|
1858
|
+
return this._get(this._buildPath(auditId, "report"));
|
|
1859
|
+
}
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1610
1862
|
// src/services/payments.ts
|
|
1611
1863
|
var PaymentsService = class extends BaseService {
|
|
1612
1864
|
constructor() {
|
|
@@ -1775,6 +2027,185 @@ var PropertiesService = class extends BaseService {
|
|
|
1775
2027
|
}
|
|
1776
2028
|
};
|
|
1777
2029
|
|
|
2030
|
+
// src/services/rate-plans.ts
|
|
2031
|
+
var RatePlansService = class extends BaseService {
|
|
2032
|
+
constructor() {
|
|
2033
|
+
super(...arguments);
|
|
2034
|
+
this.basePath = "/rate/v1";
|
|
2035
|
+
}
|
|
2036
|
+
// ---------------------------------------------------------------------------
|
|
2037
|
+
// Rate plan CRUD
|
|
2038
|
+
// ---------------------------------------------------------------------------
|
|
2039
|
+
/** List rate plans with optional filters */
|
|
2040
|
+
list(params) {
|
|
2041
|
+
if (!params) return this._get(this._buildPath("plans"));
|
|
2042
|
+
const query = {};
|
|
2043
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
2044
|
+
if (params.categoryId !== void 0) query.categoryId = params.categoryId;
|
|
2045
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2046
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2047
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2048
|
+
return this._get(this._buildPath("plans"), query);
|
|
2049
|
+
}
|
|
2050
|
+
/** Get a rate plan by ID */
|
|
2051
|
+
get(planId) {
|
|
2052
|
+
return this._get(this._buildPath("plans", planId));
|
|
2053
|
+
}
|
|
2054
|
+
/** Create a new rate plan */
|
|
2055
|
+
create(input) {
|
|
2056
|
+
return this._post(this._buildPath("plans"), input);
|
|
2057
|
+
}
|
|
2058
|
+
/** Update a rate plan */
|
|
2059
|
+
update(planId, input) {
|
|
2060
|
+
return this._patch(this._buildPath("plans", planId), input);
|
|
2061
|
+
}
|
|
2062
|
+
/** Delete a rate plan */
|
|
2063
|
+
delete(planId) {
|
|
2064
|
+
return this._delete(this._buildPath("plans", planId));
|
|
2065
|
+
}
|
|
2066
|
+
// ---------------------------------------------------------------------------
|
|
2067
|
+
// Rate period management
|
|
2068
|
+
// ---------------------------------------------------------------------------
|
|
2069
|
+
/** List rate periods for a plan */
|
|
2070
|
+
listPeriods(planId, params) {
|
|
2071
|
+
if (!params) {
|
|
2072
|
+
return this._get(this._buildPath("plans", planId, "periods"));
|
|
2073
|
+
}
|
|
2074
|
+
const query = {};
|
|
2075
|
+
if (params.fromDate !== void 0) query.fromDate = params.fromDate;
|
|
2076
|
+
if (params.toDate !== void 0) query.toDate = params.toDate;
|
|
2077
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2078
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2079
|
+
return this._get(this._buildPath("plans", planId, "periods"), query);
|
|
2080
|
+
}
|
|
2081
|
+
/** Get a rate period by ID */
|
|
2082
|
+
getPeriod(planId, periodId) {
|
|
2083
|
+
return this._get(this._buildPath("plans", planId, "periods", periodId));
|
|
2084
|
+
}
|
|
2085
|
+
/** Create a rate period */
|
|
2086
|
+
createPeriod(planId, input) {
|
|
2087
|
+
return this._post(this._buildPath("plans", planId, "periods"), input);
|
|
2088
|
+
}
|
|
2089
|
+
/** Update a rate period */
|
|
2090
|
+
updatePeriod(planId, periodId, input) {
|
|
2091
|
+
return this._patch(this._buildPath("plans", planId, "periods", periodId), input);
|
|
2092
|
+
}
|
|
2093
|
+
// ---------------------------------------------------------------------------
|
|
2094
|
+
// Restrictions
|
|
2095
|
+
// ---------------------------------------------------------------------------
|
|
2096
|
+
/** Get restrictions for a rate plan */
|
|
2097
|
+
getRestrictions(planId) {
|
|
2098
|
+
return this._get(this._buildPath("plans", planId, "restrictions"));
|
|
2099
|
+
}
|
|
2100
|
+
/** Update restrictions for a rate plan */
|
|
2101
|
+
updateRestrictions(planId, input) {
|
|
2102
|
+
return this._patch(this._buildPath("plans", planId, "restrictions"), input);
|
|
2103
|
+
}
|
|
2104
|
+
// ---------------------------------------------------------------------------
|
|
2105
|
+
// Price calculation
|
|
2106
|
+
// ---------------------------------------------------------------------------
|
|
2107
|
+
/** Calculate price for a stay */
|
|
2108
|
+
calculate(input) {
|
|
2109
|
+
return this._post(this._buildPath("calculate"), input);
|
|
2110
|
+
}
|
|
2111
|
+
// ---------------------------------------------------------------------------
|
|
2112
|
+
// Portfolio operations
|
|
2113
|
+
// ---------------------------------------------------------------------------
|
|
2114
|
+
/** Push rates to portfolio properties */
|
|
2115
|
+
pushToPortfolio(input) {
|
|
2116
|
+
return this._post(this._buildPath("portfolio", "push"), input);
|
|
2117
|
+
}
|
|
2118
|
+
/** Compare rates across portfolio properties */
|
|
2119
|
+
comparePortfolioRates(input) {
|
|
2120
|
+
return this._post(this._buildPath("portfolio", "compare"), input);
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
|
|
2124
|
+
// src/services/reviews.ts
|
|
2125
|
+
var ReviewsService = class extends BaseService {
|
|
2126
|
+
constructor() {
|
|
2127
|
+
super(...arguments);
|
|
2128
|
+
this.basePath = "/guest/v1";
|
|
2129
|
+
}
|
|
2130
|
+
// ---------------------------------------------------------------------------
|
|
2131
|
+
// Review CRUD
|
|
2132
|
+
// ---------------------------------------------------------------------------
|
|
2133
|
+
/** Create a review */
|
|
2134
|
+
createReview(input) {
|
|
2135
|
+
return this._post(this._buildPath("reviews"), input);
|
|
2136
|
+
}
|
|
2137
|
+
/** Get a review by ID */
|
|
2138
|
+
getReview(reviewId) {
|
|
2139
|
+
return this._get(this._buildPath("reviews", reviewId));
|
|
2140
|
+
}
|
|
2141
|
+
/** List reviews with optional filters */
|
|
2142
|
+
listReviews(params) {
|
|
2143
|
+
const query = {};
|
|
2144
|
+
query.propertyId = params.propertyId;
|
|
2145
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2146
|
+
if (params.guestId !== void 0) query.guestId = params.guestId;
|
|
2147
|
+
if (params.bookingId !== void 0) query.bookingId = params.bookingId;
|
|
2148
|
+
if (params.minRating !== void 0) query.minRating = params.minRating;
|
|
2149
|
+
if (params.maxRating !== void 0) query.maxRating = params.maxRating;
|
|
2150
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2151
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2152
|
+
if (params.sortBy !== void 0) query.sortBy = params.sortBy;
|
|
2153
|
+
if (params.sortOrder !== void 0) query.sortOrder = params.sortOrder;
|
|
2154
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2155
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2156
|
+
return this._get(this._buildPath("reviews"), query);
|
|
2157
|
+
}
|
|
2158
|
+
/** Update a review */
|
|
2159
|
+
updateReview(reviewId, input) {
|
|
2160
|
+
return this._patch(this._buildPath("reviews", reviewId), input);
|
|
2161
|
+
}
|
|
2162
|
+
/** Delete a review */
|
|
2163
|
+
deleteReview(reviewId) {
|
|
2164
|
+
return this._delete(this._buildPath("reviews", reviewId));
|
|
2165
|
+
}
|
|
2166
|
+
// ---------------------------------------------------------------------------
|
|
2167
|
+
// Moderation
|
|
2168
|
+
// ---------------------------------------------------------------------------
|
|
2169
|
+
/** Moderate a review (approve, reject, or flag) */
|
|
2170
|
+
moderateReview(reviewId, input) {
|
|
2171
|
+
return this._post(this._buildPath("reviews", reviewId, "moderate"), input);
|
|
2172
|
+
}
|
|
2173
|
+
// ---------------------------------------------------------------------------
|
|
2174
|
+
// Owner responses
|
|
2175
|
+
// ---------------------------------------------------------------------------
|
|
2176
|
+
/** Create an owner response to a review */
|
|
2177
|
+
createResponse(reviewId, input) {
|
|
2178
|
+
return this._post(this._buildPath("reviews", reviewId, "response"), input);
|
|
2179
|
+
}
|
|
2180
|
+
/** Update an owner response */
|
|
2181
|
+
updateResponse(reviewId, input) {
|
|
2182
|
+
return this._patch(this._buildPath("reviews", reviewId, "response"), input);
|
|
2183
|
+
}
|
|
2184
|
+
/** Delete an owner response */
|
|
2185
|
+
deleteResponse(reviewId) {
|
|
2186
|
+
return this._delete(this._buildPath("reviews", reviewId, "response"));
|
|
2187
|
+
}
|
|
2188
|
+
// ---------------------------------------------------------------------------
|
|
2189
|
+
// Analytics
|
|
2190
|
+
// ---------------------------------------------------------------------------
|
|
2191
|
+
/** Get review analytics for a property */
|
|
2192
|
+
getAnalytics(params) {
|
|
2193
|
+
const query = {};
|
|
2194
|
+
query.propertyId = params.propertyId;
|
|
2195
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2196
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2197
|
+
if (params.period !== void 0) query.period = params.period;
|
|
2198
|
+
return this._get(this._buildPath("reviews", "analytics"), query);
|
|
2199
|
+
}
|
|
2200
|
+
// ---------------------------------------------------------------------------
|
|
2201
|
+
// Review requests
|
|
2202
|
+
// ---------------------------------------------------------------------------
|
|
2203
|
+
/** Send a review request to a guest */
|
|
2204
|
+
sendReviewRequest(input) {
|
|
2205
|
+
return this._post(this._buildPath("reviews", "request"), input);
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
|
|
1778
2209
|
// src/services/spaces.ts
|
|
1779
2210
|
var SpacesService = class extends BaseService {
|
|
1780
2211
|
constructor() {
|
|
@@ -1904,6 +2335,190 @@ var SpacesService = class extends BaseService {
|
|
|
1904
2335
|
}
|
|
1905
2336
|
};
|
|
1906
2337
|
|
|
2338
|
+
// src/services/staff.ts
|
|
2339
|
+
var StaffService = class extends BaseService {
|
|
2340
|
+
constructor() {
|
|
2341
|
+
super(...arguments);
|
|
2342
|
+
this.basePath = "/operations/v1/staff";
|
|
2343
|
+
}
|
|
2344
|
+
// ---------------------------------------------------------------------------
|
|
2345
|
+
// Staff CRUD
|
|
2346
|
+
// ---------------------------------------------------------------------------
|
|
2347
|
+
/** Create a staff member */
|
|
2348
|
+
create(input) {
|
|
2349
|
+
return this._post(this.basePath, input);
|
|
2350
|
+
}
|
|
2351
|
+
/** Get a staff member by ID */
|
|
2352
|
+
get(staffId) {
|
|
2353
|
+
return this._get(this._buildPath(staffId));
|
|
2354
|
+
}
|
|
2355
|
+
/** List staff members with optional filters */
|
|
2356
|
+
list(params) {
|
|
2357
|
+
const query = {};
|
|
2358
|
+
query.propertyId = params.propertyId;
|
|
2359
|
+
if (params.department !== void 0) {
|
|
2360
|
+
query.department = Array.isArray(params.department) ? params.department.join(",") : params.department;
|
|
2361
|
+
}
|
|
2362
|
+
if (params.role !== void 0) {
|
|
2363
|
+
query.role = Array.isArray(params.role) ? params.role.join(",") : params.role;
|
|
2364
|
+
}
|
|
2365
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2366
|
+
if (params.search !== void 0) query.search = params.search;
|
|
2367
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2368
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2369
|
+
return this._get(this.basePath, query);
|
|
2370
|
+
}
|
|
2371
|
+
/** Update a staff member */
|
|
2372
|
+
update(staffId, input) {
|
|
2373
|
+
return this._patch(this._buildPath(staffId), input);
|
|
2374
|
+
}
|
|
2375
|
+
/** Delete a staff member */
|
|
2376
|
+
delete(staffId) {
|
|
2377
|
+
return this._delete(this._buildPath(staffId));
|
|
2378
|
+
}
|
|
2379
|
+
// ---------------------------------------------------------------------------
|
|
2380
|
+
// Shift management
|
|
2381
|
+
// ---------------------------------------------------------------------------
|
|
2382
|
+
/** Create a shift for a staff member */
|
|
2383
|
+
createShift(staffId, input) {
|
|
2384
|
+
return this._post(this._buildPath(staffId, "shifts"), input);
|
|
2385
|
+
}
|
|
2386
|
+
/** List shifts for a staff member */
|
|
2387
|
+
listShifts(staffId, params) {
|
|
2388
|
+
if (!params) return this._get(this._buildPath(staffId, "shifts"));
|
|
2389
|
+
const query = {};
|
|
2390
|
+
if (params.startDate !== void 0) query.startDate = params.startDate;
|
|
2391
|
+
if (params.endDate !== void 0) query.endDate = params.endDate;
|
|
2392
|
+
if (params.shiftType !== void 0) {
|
|
2393
|
+
query.shiftType = Array.isArray(params.shiftType) ? params.shiftType.join(",") : params.shiftType;
|
|
2394
|
+
}
|
|
2395
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2396
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2397
|
+
return this._get(this._buildPath(staffId, "shifts"), query);
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
|
|
2401
|
+
// src/services/supply.ts
|
|
2402
|
+
var SupplyService = class extends BaseService {
|
|
2403
|
+
constructor() {
|
|
2404
|
+
super(...arguments);
|
|
2405
|
+
this.basePath = "/operations/v1";
|
|
2406
|
+
}
|
|
2407
|
+
// ---------------------------------------------------------------------------
|
|
2408
|
+
// Item CRUD
|
|
2409
|
+
// ---------------------------------------------------------------------------
|
|
2410
|
+
/** Create a supply item */
|
|
2411
|
+
createItem(input) {
|
|
2412
|
+
return this._post(this._buildPath("supply-items"), input);
|
|
2413
|
+
}
|
|
2414
|
+
/** Get a supply item by ID */
|
|
2415
|
+
getItem(itemId) {
|
|
2416
|
+
return this._get(this._buildPath("supply-items", itemId));
|
|
2417
|
+
}
|
|
2418
|
+
/** List supply items with optional filters */
|
|
2419
|
+
listItems(params) {
|
|
2420
|
+
const query = {};
|
|
2421
|
+
query.propertyId = params.propertyId;
|
|
2422
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2423
|
+
if (params.search !== void 0) query.search = params.search;
|
|
2424
|
+
if (params.lowStockOnly !== void 0) query.lowStockOnly = params.lowStockOnly;
|
|
2425
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2426
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2427
|
+
return this._get(this._buildPath("supply-items"), query);
|
|
2428
|
+
}
|
|
2429
|
+
/** Update a supply item */
|
|
2430
|
+
updateItem(itemId, input) {
|
|
2431
|
+
return this._patch(this._buildPath("supply-items", itemId), input);
|
|
2432
|
+
}
|
|
2433
|
+
/** Delete a supply item */
|
|
2434
|
+
deleteItem(itemId) {
|
|
2435
|
+
return this._delete(this._buildPath("supply-items", itemId));
|
|
2436
|
+
}
|
|
2437
|
+
// ---------------------------------------------------------------------------
|
|
2438
|
+
// Stock levels
|
|
2439
|
+
// ---------------------------------------------------------------------------
|
|
2440
|
+
/** Get the current stock level for a supply item */
|
|
2441
|
+
getLevel(itemId) {
|
|
2442
|
+
return this._get(this._buildPath("supply-levels", itemId));
|
|
2443
|
+
}
|
|
2444
|
+
/** List stock levels with optional filters */
|
|
2445
|
+
listLevels(params) {
|
|
2446
|
+
const query = {};
|
|
2447
|
+
query.propertyId = params.propertyId;
|
|
2448
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2449
|
+
if (params.lowStockOnly !== void 0) query.lowStockOnly = params.lowStockOnly;
|
|
2450
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2451
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2452
|
+
return this._get(this._buildPath("supply-levels"), query);
|
|
2453
|
+
}
|
|
2454
|
+
/** Update a stock level manually */
|
|
2455
|
+
updateLevel(itemId, input) {
|
|
2456
|
+
return this._patch(this._buildPath("supply-levels", itemId), input);
|
|
2457
|
+
}
|
|
2458
|
+
// ---------------------------------------------------------------------------
|
|
2459
|
+
// Movements
|
|
2460
|
+
// ---------------------------------------------------------------------------
|
|
2461
|
+
/** Record a stock movement */
|
|
2462
|
+
createMovement(input) {
|
|
2463
|
+
return this._post(this._buildPath("supply-movements"), input);
|
|
2464
|
+
}
|
|
2465
|
+
/** List supply movements with optional filters */
|
|
2466
|
+
listMovements(params) {
|
|
2467
|
+
const query = {};
|
|
2468
|
+
query.propertyId = params.propertyId;
|
|
2469
|
+
if (params.itemId !== void 0) query.itemId = params.itemId;
|
|
2470
|
+
if (params.type !== void 0) query.type = params.type;
|
|
2471
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2472
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2473
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2474
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2475
|
+
return this._get(this._buildPath("supply-movements"), query);
|
|
2476
|
+
}
|
|
2477
|
+
// ---------------------------------------------------------------------------
|
|
2478
|
+
// Low-stock alerts
|
|
2479
|
+
// ---------------------------------------------------------------------------
|
|
2480
|
+
/** List items whose stock is at or below reorder threshold */
|
|
2481
|
+
listLowStock(params) {
|
|
2482
|
+
const query = {};
|
|
2483
|
+
query.propertyId = params.propertyId;
|
|
2484
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2485
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2486
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2487
|
+
return this._get(this._buildPath("supply-items", "low-stock"), query);
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
|
|
2491
|
+
// src/services/tasks.ts
|
|
2492
|
+
var TasksService = class extends BaseService {
|
|
2493
|
+
constructor() {
|
|
2494
|
+
super(...arguments);
|
|
2495
|
+
this.basePath = "/operations/v1/tasks";
|
|
2496
|
+
}
|
|
2497
|
+
/** Create an operational task */
|
|
2498
|
+
create(input) {
|
|
2499
|
+
return this._post(this.basePath, input);
|
|
2500
|
+
}
|
|
2501
|
+
/** List operational tasks with optional filters */
|
|
2502
|
+
list(params) {
|
|
2503
|
+
if (!params) return this._get(this.basePath);
|
|
2504
|
+
const query = {};
|
|
2505
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
2506
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2507
|
+
if (params.priority !== void 0) query.priority = params.priority;
|
|
2508
|
+
if (params.assignedTo !== void 0) query.assignedTo = params.assignedTo;
|
|
2509
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2510
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2511
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2512
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2513
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2514
|
+
return this._get(this.basePath, query);
|
|
2515
|
+
}
|
|
2516
|
+
/** Update an operational task */
|
|
2517
|
+
update(taskId, input) {
|
|
2518
|
+
return this._patch(this._buildPath(taskId), input);
|
|
2519
|
+
}
|
|
2520
|
+
};
|
|
2521
|
+
|
|
1907
2522
|
// src/client.ts
|
|
1908
2523
|
var BookingClient = class {
|
|
1909
2524
|
constructor(config) {
|
|
@@ -1941,11 +2556,26 @@ var BookingClient = class {
|
|
|
1941
2556
|
this._finance ?? (this._finance = new FinanceService(this.httpClient));
|
|
1942
2557
|
return this._finance;
|
|
1943
2558
|
}
|
|
2559
|
+
/** Groups service — lazy-initialized on first access */
|
|
2560
|
+
get groups() {
|
|
2561
|
+
this._groups ?? (this._groups = new GroupsService(this.httpClient));
|
|
2562
|
+
return this._groups;
|
|
2563
|
+
}
|
|
1944
2564
|
/** Guests service — lazy-initialized on first access */
|
|
1945
2565
|
get guests() {
|
|
1946
2566
|
this._guests ?? (this._guests = new GuestsService(this.httpClient));
|
|
1947
2567
|
return this._guests;
|
|
1948
2568
|
}
|
|
2569
|
+
/** Housekeeping service — lazy-initialized on first access */
|
|
2570
|
+
get housekeeping() {
|
|
2571
|
+
this._housekeeping ?? (this._housekeeping = new HousekeepingService(this.httpClient));
|
|
2572
|
+
return this._housekeeping;
|
|
2573
|
+
}
|
|
2574
|
+
/** Night audit service — lazy-initialized on first access */
|
|
2575
|
+
get nightAudit() {
|
|
2576
|
+
this._nightAudit ?? (this._nightAudit = new NightAuditService(this.httpClient));
|
|
2577
|
+
return this._nightAudit;
|
|
2578
|
+
}
|
|
1949
2579
|
/** Payments service — lazy-initialized on first access */
|
|
1950
2580
|
get payments() {
|
|
1951
2581
|
this._payments ?? (this._payments = new PaymentsService(this.httpClient));
|
|
@@ -1956,16 +2586,46 @@ var BookingClient = class {
|
|
|
1956
2586
|
this._properties ?? (this._properties = new PropertiesService(this.httpClient));
|
|
1957
2587
|
return this._properties;
|
|
1958
2588
|
}
|
|
2589
|
+
/** Rate plans service — lazy-initialized on first access */
|
|
2590
|
+
get ratePlans() {
|
|
2591
|
+
this._ratePlans ?? (this._ratePlans = new RatePlansService(this.httpClient));
|
|
2592
|
+
return this._ratePlans;
|
|
2593
|
+
}
|
|
1959
2594
|
/** Categories service — lazy-initialized on first access */
|
|
1960
2595
|
get categories() {
|
|
1961
2596
|
this._categories ?? (this._categories = new CategoriesService(this.httpClient));
|
|
1962
2597
|
return this._categories;
|
|
1963
2598
|
}
|
|
2599
|
+
/** Discounts service — lazy-initialized on first access */
|
|
2600
|
+
get discounts() {
|
|
2601
|
+
this._discounts ?? (this._discounts = new DiscountsService(this.httpClient));
|
|
2602
|
+
return this._discounts;
|
|
2603
|
+
}
|
|
2604
|
+
/** Reviews service — lazy-initialized on first access */
|
|
2605
|
+
get reviews() {
|
|
2606
|
+
this._reviews ?? (this._reviews = new ReviewsService(this.httpClient));
|
|
2607
|
+
return this._reviews;
|
|
2608
|
+
}
|
|
1964
2609
|
/** Spaces service — lazy-initialized on first access */
|
|
1965
2610
|
get spaces() {
|
|
1966
2611
|
this._spaces ?? (this._spaces = new SpacesService(this.httpClient));
|
|
1967
2612
|
return this._spaces;
|
|
1968
2613
|
}
|
|
2614
|
+
/** Staff service — lazy-initialized on first access */
|
|
2615
|
+
get staff() {
|
|
2616
|
+
this._staff ?? (this._staff = new StaffService(this.httpClient));
|
|
2617
|
+
return this._staff;
|
|
2618
|
+
}
|
|
2619
|
+
/** Supply service — lazy-initialized on first access */
|
|
2620
|
+
get supply() {
|
|
2621
|
+
this._supply ?? (this._supply = new SupplyService(this.httpClient));
|
|
2622
|
+
return this._supply;
|
|
2623
|
+
}
|
|
2624
|
+
/** Tasks service — lazy-initialized on first access */
|
|
2625
|
+
get tasks() {
|
|
2626
|
+
this._tasks ?? (this._tasks = new TasksService(this.httpClient));
|
|
2627
|
+
return this._tasks;
|
|
2628
|
+
}
|
|
1969
2629
|
setApiKey(key) {
|
|
1970
2630
|
if (!key || key.trim().length === 0) {
|
|
1971
2631
|
throw new Error("apiKey must be a non-empty string");
|
|
@@ -2084,21 +2744,30 @@ var VERSION = "0.1.0";
|
|
|
2084
2744
|
CategoriesService,
|
|
2085
2745
|
ConflictError,
|
|
2086
2746
|
DEFAULT_MODULES,
|
|
2747
|
+
DiscountsService,
|
|
2087
2748
|
DistributionService,
|
|
2088
2749
|
FinanceService,
|
|
2089
2750
|
ForbiddenError,
|
|
2751
|
+
GroupsService,
|
|
2090
2752
|
GuestsService,
|
|
2753
|
+
HousekeepingService,
|
|
2091
2754
|
HttpClient,
|
|
2755
|
+
NightAuditService,
|
|
2092
2756
|
NotFoundError,
|
|
2093
2757
|
PROPERTY_MODULES,
|
|
2094
2758
|
PaymentError,
|
|
2095
2759
|
PaymentsService,
|
|
2096
2760
|
PropertiesService,
|
|
2097
2761
|
RateLimitError,
|
|
2762
|
+
RatePlansService,
|
|
2763
|
+
ReviewsService,
|
|
2098
2764
|
SPACE_STATUSES,
|
|
2099
2765
|
SPACE_TYPES,
|
|
2100
2766
|
ServerError,
|
|
2101
2767
|
SpacesService,
|
|
2768
|
+
StaffService,
|
|
2769
|
+
SupplyService,
|
|
2770
|
+
TasksService,
|
|
2102
2771
|
TimeoutError,
|
|
2103
2772
|
VERSION,
|
|
2104
2773
|
ValidationError,
|