@atzentis/booking-sdk 0.1.7 → 0.1.9
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 +712 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1696 -40
- package/dist/index.d.ts +1696 -40
- package/dist/index.js +704 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37,18 +37,26 @@ __export(index_exports, {
|
|
|
37
37
|
CategoriesService: () => CategoriesService,
|
|
38
38
|
ConflictError: () => ConflictError,
|
|
39
39
|
DEFAULT_MODULES: () => DEFAULT_MODULES,
|
|
40
|
+
DistributionService: () => DistributionService,
|
|
41
|
+
FinanceService: () => FinanceService,
|
|
40
42
|
ForbiddenError: () => ForbiddenError,
|
|
43
|
+
GroupsService: () => GroupsService,
|
|
41
44
|
GuestsService: () => GuestsService,
|
|
45
|
+
HousekeepingService: () => HousekeepingService,
|
|
42
46
|
HttpClient: () => HttpClient,
|
|
47
|
+
NightAuditService: () => NightAuditService,
|
|
43
48
|
NotFoundError: () => NotFoundError,
|
|
44
49
|
PROPERTY_MODULES: () => PROPERTY_MODULES,
|
|
45
50
|
PaymentError: () => PaymentError,
|
|
51
|
+
PaymentsService: () => PaymentsService,
|
|
46
52
|
PropertiesService: () => PropertiesService,
|
|
47
53
|
RateLimitError: () => RateLimitError,
|
|
54
|
+
RatePlansService: () => RatePlansService,
|
|
48
55
|
SPACE_STATUSES: () => SPACE_STATUSES,
|
|
49
56
|
SPACE_TYPES: () => SPACE_TYPES,
|
|
50
57
|
ServerError: () => ServerError,
|
|
51
58
|
SpacesService: () => SpacesService,
|
|
59
|
+
StaffService: () => StaffService,
|
|
52
60
|
TimeoutError: () => TimeoutError,
|
|
53
61
|
VERSION: () => VERSION,
|
|
54
62
|
ValidationError: () => ValidationError,
|
|
@@ -1092,6 +1100,327 @@ var CategoriesService = class extends BaseService {
|
|
|
1092
1100
|
}
|
|
1093
1101
|
};
|
|
1094
1102
|
|
|
1103
|
+
// src/services/distribution.ts
|
|
1104
|
+
var DistributionService = class extends BaseService {
|
|
1105
|
+
constructor() {
|
|
1106
|
+
super(...arguments);
|
|
1107
|
+
this.basePath = "/distribution/v1";
|
|
1108
|
+
}
|
|
1109
|
+
// ---------------------------------------------------------------------------
|
|
1110
|
+
// Channel CRUD
|
|
1111
|
+
// ---------------------------------------------------------------------------
|
|
1112
|
+
/** Create a new distribution channel */
|
|
1113
|
+
createChannel(input) {
|
|
1114
|
+
return this._post(this._buildPath("channels"), input);
|
|
1115
|
+
}
|
|
1116
|
+
/** Get a channel by ID */
|
|
1117
|
+
getChannel(channelId) {
|
|
1118
|
+
return this._get(this._buildPath("channels", channelId));
|
|
1119
|
+
}
|
|
1120
|
+
/** List channels with optional filters */
|
|
1121
|
+
listChannels(params) {
|
|
1122
|
+
if (!params) return this._get(this._buildPath("channels"));
|
|
1123
|
+
const query = {};
|
|
1124
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1125
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1126
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1127
|
+
if (params.enabled !== void 0) query.enabled = params.enabled;
|
|
1128
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1129
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1130
|
+
return this._get(this._buildPath("channels"), query);
|
|
1131
|
+
}
|
|
1132
|
+
/** Update a channel */
|
|
1133
|
+
updateChannel(channelId, input) {
|
|
1134
|
+
return this._patch(this._buildPath("channels", channelId), input);
|
|
1135
|
+
}
|
|
1136
|
+
/** Delete a channel */
|
|
1137
|
+
deleteChannel(channelId) {
|
|
1138
|
+
return this._delete(this._buildPath("channels", channelId));
|
|
1139
|
+
}
|
|
1140
|
+
// ---------------------------------------------------------------------------
|
|
1141
|
+
// Mapping management
|
|
1142
|
+
// ---------------------------------------------------------------------------
|
|
1143
|
+
/** Create a mapping between a local category and OTA room type/rate plan */
|
|
1144
|
+
createMapping(channelId, input) {
|
|
1145
|
+
return this._post(this._buildPath("channels", channelId, "mappings"), input);
|
|
1146
|
+
}
|
|
1147
|
+
/** List mappings for a channel */
|
|
1148
|
+
listMappings(channelId, params) {
|
|
1149
|
+
if (!params) {
|
|
1150
|
+
return this._get(this._buildPath("channels", channelId, "mappings"));
|
|
1151
|
+
}
|
|
1152
|
+
const query = {};
|
|
1153
|
+
if (params.localCategoryId !== void 0) query.localCategoryId = params.localCategoryId;
|
|
1154
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1155
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1156
|
+
return this._get(this._buildPath("channels", channelId, "mappings"), query);
|
|
1157
|
+
}
|
|
1158
|
+
/** Delete a mapping */
|
|
1159
|
+
deleteMapping(channelId, mappingId) {
|
|
1160
|
+
return this._delete(this._buildPath("channels", channelId, "mappings", mappingId));
|
|
1161
|
+
}
|
|
1162
|
+
// ---------------------------------------------------------------------------
|
|
1163
|
+
// Push/pull sync
|
|
1164
|
+
// ---------------------------------------------------------------------------
|
|
1165
|
+
/** Push availability and rates to a channel */
|
|
1166
|
+
push(channelId, input) {
|
|
1167
|
+
return this._post(this._buildPath("channels", channelId, "push"), input ?? {});
|
|
1168
|
+
}
|
|
1169
|
+
/** Pull reservations from a channel */
|
|
1170
|
+
pull(channelId, input) {
|
|
1171
|
+
return this._post(this._buildPath("channels", channelId, "pull"), input ?? {});
|
|
1172
|
+
}
|
|
1173
|
+
/** Get sync operation log for a channel */
|
|
1174
|
+
getSyncLog(channelId, params) {
|
|
1175
|
+
if (!params) {
|
|
1176
|
+
return this._get(this._buildPath("channels", channelId, "sync-log"));
|
|
1177
|
+
}
|
|
1178
|
+
const query = {};
|
|
1179
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1180
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1181
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1182
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1183
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1184
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1185
|
+
return this._get(this._buildPath("channels", channelId, "sync-log"), query);
|
|
1186
|
+
}
|
|
1187
|
+
// ---------------------------------------------------------------------------
|
|
1188
|
+
// iCal import/export
|
|
1189
|
+
// ---------------------------------------------------------------------------
|
|
1190
|
+
/** Import availability from an external iCal feed */
|
|
1191
|
+
icalImport(input) {
|
|
1192
|
+
return this._post(this._buildPath("ical", "import"), input);
|
|
1193
|
+
}
|
|
1194
|
+
/** Get iCal export URL for a space */
|
|
1195
|
+
icalExport(spaceId) {
|
|
1196
|
+
return this._get(this._buildPath("ical", "export", spaceId));
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
// src/services/finance.ts
|
|
1201
|
+
var FinanceService = class extends BaseService {
|
|
1202
|
+
constructor() {
|
|
1203
|
+
super(...arguments);
|
|
1204
|
+
this.basePath = "/finance/v1";
|
|
1205
|
+
}
|
|
1206
|
+
// ---------------------------------------------------------------------------
|
|
1207
|
+
// Folio CRUD and lifecycle
|
|
1208
|
+
// ---------------------------------------------------------------------------
|
|
1209
|
+
/** Create a new folio for a booking */
|
|
1210
|
+
createFolio(input) {
|
|
1211
|
+
return this._post(this._buildPath("folios"), input);
|
|
1212
|
+
}
|
|
1213
|
+
/** Get a folio by ID */
|
|
1214
|
+
getFolio(folioId) {
|
|
1215
|
+
return this._get(this._buildPath("folios", folioId));
|
|
1216
|
+
}
|
|
1217
|
+
/** List folios with optional filters */
|
|
1218
|
+
listFolios(params) {
|
|
1219
|
+
if (!params) return this._get(this._buildPath("folios"));
|
|
1220
|
+
const query = {};
|
|
1221
|
+
if (params.bookingId !== void 0) query.bookingId = params.bookingId;
|
|
1222
|
+
if (params.guestId !== void 0) query.guestId = params.guestId;
|
|
1223
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1224
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1225
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1226
|
+
return this._get(this._buildPath("folios"), query);
|
|
1227
|
+
}
|
|
1228
|
+
/** Update a folio */
|
|
1229
|
+
updateFolio(folioId, input) {
|
|
1230
|
+
return this._patch(this._buildPath("folios", folioId), input);
|
|
1231
|
+
}
|
|
1232
|
+
/** Close a folio (no more charges can be added) */
|
|
1233
|
+
closeFolio(folioId) {
|
|
1234
|
+
return this._post(this._buildPath("folios", folioId, "close"), {});
|
|
1235
|
+
}
|
|
1236
|
+
/** Settle a folio (mark as fully paid) */
|
|
1237
|
+
settleFolio(folioId) {
|
|
1238
|
+
return this._post(this._buildPath("folios", folioId, "settle"), {});
|
|
1239
|
+
}
|
|
1240
|
+
// ---------------------------------------------------------------------------
|
|
1241
|
+
// Charge operations
|
|
1242
|
+
// ---------------------------------------------------------------------------
|
|
1243
|
+
/** Create a charge on a folio */
|
|
1244
|
+
createCharge(folioId, input) {
|
|
1245
|
+
return this._post(this._buildPath("folios", folioId, "charges"), input);
|
|
1246
|
+
}
|
|
1247
|
+
/** List charges on a folio */
|
|
1248
|
+
listCharges(folioId, params) {
|
|
1249
|
+
if (!params) {
|
|
1250
|
+
return this._get(this._buildPath("folios", folioId, "charges"));
|
|
1251
|
+
}
|
|
1252
|
+
const query = {};
|
|
1253
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1254
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1255
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1256
|
+
return this._get(this._buildPath("folios", folioId, "charges"), query);
|
|
1257
|
+
}
|
|
1258
|
+
/** Create a transitory (non-billable) charge on a folio */
|
|
1259
|
+
createTransitoryCharge(folioId, input) {
|
|
1260
|
+
return this._post(
|
|
1261
|
+
this._buildPath("folios", folioId, "charges", "transitory"),
|
|
1262
|
+
input
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
/** Move charges from one folio to another */
|
|
1266
|
+
moveCharges(folioId, input) {
|
|
1267
|
+
return this._post(
|
|
1268
|
+
this._buildPath("folios", folioId, "charges", "move"),
|
|
1269
|
+
input
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
// ---------------------------------------------------------------------------
|
|
1273
|
+
// Folio payment operations
|
|
1274
|
+
// ---------------------------------------------------------------------------
|
|
1275
|
+
/** Record a payment on a folio */
|
|
1276
|
+
createFolioPayment(folioId, input) {
|
|
1277
|
+
return this._post(this._buildPath("folios", folioId, "payments"), input);
|
|
1278
|
+
}
|
|
1279
|
+
/** List payments on a folio */
|
|
1280
|
+
listFolioPayments(folioId, params) {
|
|
1281
|
+
if (!params) {
|
|
1282
|
+
return this._get(this._buildPath("folios", folioId, "payments"));
|
|
1283
|
+
}
|
|
1284
|
+
const query = {};
|
|
1285
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1286
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1287
|
+
return this._get(this._buildPath("folios", folioId, "payments"), query);
|
|
1288
|
+
}
|
|
1289
|
+
// ---------------------------------------------------------------------------
|
|
1290
|
+
// Invoice operations
|
|
1291
|
+
// ---------------------------------------------------------------------------
|
|
1292
|
+
/** Generate an invoice for a folio */
|
|
1293
|
+
generateInvoice(folioId, input) {
|
|
1294
|
+
return this._post(this._buildPath("folios", folioId, "invoice"), input ?? {});
|
|
1295
|
+
}
|
|
1296
|
+
/** Get an invoice by ID */
|
|
1297
|
+
getInvoice(invoiceId) {
|
|
1298
|
+
return this._get(this._buildPath("invoices", invoiceId));
|
|
1299
|
+
}
|
|
1300
|
+
/** Get invoice as PDF binary data */
|
|
1301
|
+
getInvoicePdf(invoiceId) {
|
|
1302
|
+
return this._get(this._buildPath("invoices", invoiceId, "pdf"));
|
|
1303
|
+
}
|
|
1304
|
+
// ---------------------------------------------------------------------------
|
|
1305
|
+
// Accounting reports
|
|
1306
|
+
// ---------------------------------------------------------------------------
|
|
1307
|
+
/** Get daily accounting report */
|
|
1308
|
+
getDailyReport(params) {
|
|
1309
|
+
if (!params) return this._get(this._buildPath("accounting", "daily"));
|
|
1310
|
+
const query = {};
|
|
1311
|
+
if (params.date !== void 0) query.date = params.date;
|
|
1312
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1313
|
+
return this._get(this._buildPath("accounting", "daily"), query);
|
|
1314
|
+
}
|
|
1315
|
+
/** Get revenue report by charge type */
|
|
1316
|
+
getRevenueReport(params) {
|
|
1317
|
+
if (!params)
|
|
1318
|
+
return this._get(this._buildPath("accounting", "revenue"));
|
|
1319
|
+
const query = {};
|
|
1320
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1321
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1322
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1323
|
+
return this._get(this._buildPath("accounting", "revenue"), query);
|
|
1324
|
+
}
|
|
1325
|
+
/** Get VAT accounting report */
|
|
1326
|
+
getVatReport(params) {
|
|
1327
|
+
if (!params) return this._get(this._buildPath("accounting", "vat"));
|
|
1328
|
+
const query = {};
|
|
1329
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1330
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1331
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1332
|
+
return this._get(this._buildPath("accounting", "vat"), query);
|
|
1333
|
+
}
|
|
1334
|
+
// ---------------------------------------------------------------------------
|
|
1335
|
+
// POS Bridge operations (P13)
|
|
1336
|
+
// ---------------------------------------------------------------------------
|
|
1337
|
+
/** Post a POS charge to a guest folio */
|
|
1338
|
+
folioPost(input) {
|
|
1339
|
+
return this._post(this._buildPath("folio-post"), input);
|
|
1340
|
+
}
|
|
1341
|
+
/** List POS charges on a folio */
|
|
1342
|
+
listFolioPostCharges(folioId, params) {
|
|
1343
|
+
if (!params) {
|
|
1344
|
+
return this._get(this._buildPath("folio-post", folioId));
|
|
1345
|
+
}
|
|
1346
|
+
const query = {};
|
|
1347
|
+
if (params.posTerminalId !== void 0) query.posTerminalId = params.posTerminalId;
|
|
1348
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1349
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1350
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1351
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1352
|
+
return this._get(this._buildPath("folio-post", folioId), query);
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
// src/services/groups.ts
|
|
1357
|
+
var GroupsService = class extends BaseService {
|
|
1358
|
+
constructor() {
|
|
1359
|
+
super(...arguments);
|
|
1360
|
+
this.basePath = "/booking/v1/groups";
|
|
1361
|
+
}
|
|
1362
|
+
// ---------------------------------------------------------------------------
|
|
1363
|
+
// Group CRUD
|
|
1364
|
+
// ---------------------------------------------------------------------------
|
|
1365
|
+
/** Create a group booking */
|
|
1366
|
+
create(input) {
|
|
1367
|
+
return this._post(this.basePath, input);
|
|
1368
|
+
}
|
|
1369
|
+
/** Get a group booking by ID */
|
|
1370
|
+
get(groupId) {
|
|
1371
|
+
return this._get(this._buildPath(groupId));
|
|
1372
|
+
}
|
|
1373
|
+
/** List group bookings with filters */
|
|
1374
|
+
list(params) {
|
|
1375
|
+
const query = {};
|
|
1376
|
+
query.propertyId = params.propertyId;
|
|
1377
|
+
if (params.status !== void 0) {
|
|
1378
|
+
query.status = Array.isArray(params.status) ? params.status.join(",") : params.status;
|
|
1379
|
+
}
|
|
1380
|
+
if (params.type !== void 0) {
|
|
1381
|
+
query.type = Array.isArray(params.type) ? params.type.join(",") : params.type;
|
|
1382
|
+
}
|
|
1383
|
+
if (params.search !== void 0) query.search = params.search;
|
|
1384
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1385
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1386
|
+
return this._get(this.basePath, query);
|
|
1387
|
+
}
|
|
1388
|
+
/** Update a group booking */
|
|
1389
|
+
update(groupId, input) {
|
|
1390
|
+
return this._patch(this._buildPath(groupId), input);
|
|
1391
|
+
}
|
|
1392
|
+
/** Delete a group booking */
|
|
1393
|
+
delete(groupId) {
|
|
1394
|
+
return this._delete(this._buildPath(groupId));
|
|
1395
|
+
}
|
|
1396
|
+
// ---------------------------------------------------------------------------
|
|
1397
|
+
// Block management
|
|
1398
|
+
// ---------------------------------------------------------------------------
|
|
1399
|
+
/** Create a room block for a group */
|
|
1400
|
+
createBlock(groupId, input) {
|
|
1401
|
+
return this._post(this._buildPath(groupId, "blocks"), input);
|
|
1402
|
+
}
|
|
1403
|
+
/** List blocks for a group */
|
|
1404
|
+
listBlocks(groupId) {
|
|
1405
|
+
return this._get(this._buildPath(groupId, "blocks"));
|
|
1406
|
+
}
|
|
1407
|
+
// ---------------------------------------------------------------------------
|
|
1408
|
+
// Pickup, release, and folio
|
|
1409
|
+
// ---------------------------------------------------------------------------
|
|
1410
|
+
/** Get pickup tracking data for a group */
|
|
1411
|
+
getPickup(groupId) {
|
|
1412
|
+
return this._get(this._buildPath(groupId, "pickup"));
|
|
1413
|
+
}
|
|
1414
|
+
/** Release blocks back to inventory */
|
|
1415
|
+
release(groupId, input) {
|
|
1416
|
+
return this._post(this._buildPath(groupId, "release"), input ?? {});
|
|
1417
|
+
}
|
|
1418
|
+
/** Create a master folio for a group */
|
|
1419
|
+
createFolio(groupId, input) {
|
|
1420
|
+
return this._post(this._buildPath(groupId, "folio"), input ?? {});
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1095
1424
|
// src/services/guests.ts
|
|
1096
1425
|
var GuestsService = class extends BaseService {
|
|
1097
1426
|
constructor() {
|
|
@@ -1371,6 +1700,184 @@ var GuestsService = class extends BaseService {
|
|
|
1371
1700
|
}
|
|
1372
1701
|
};
|
|
1373
1702
|
|
|
1703
|
+
// src/services/housekeeping.ts
|
|
1704
|
+
var HousekeepingService = class extends BaseService {
|
|
1705
|
+
constructor() {
|
|
1706
|
+
super(...arguments);
|
|
1707
|
+
this.basePath = "/operations/v1/housekeeping";
|
|
1708
|
+
}
|
|
1709
|
+
// ---------------------------------------------------------------------------
|
|
1710
|
+
// Board and space status
|
|
1711
|
+
// ---------------------------------------------------------------------------
|
|
1712
|
+
/** Get the housekeeping board with optional filters */
|
|
1713
|
+
getBoard(params) {
|
|
1714
|
+
if (!params) return this._get(this._buildPath("board"));
|
|
1715
|
+
const query = {};
|
|
1716
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1717
|
+
if (params.floor !== void 0) query.floor = params.floor;
|
|
1718
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1719
|
+
if (params.assignedTo !== void 0) query.assignedTo = params.assignedTo;
|
|
1720
|
+
return this._get(this._buildPath("board"), query);
|
|
1721
|
+
}
|
|
1722
|
+
/** Update the housekeeping status of a space */
|
|
1723
|
+
updateSpaceStatus(spaceId, input) {
|
|
1724
|
+
return this._patch(this._buildPath("spaces", spaceId), input);
|
|
1725
|
+
}
|
|
1726
|
+
// ---------------------------------------------------------------------------
|
|
1727
|
+
// Task CRUD
|
|
1728
|
+
// ---------------------------------------------------------------------------
|
|
1729
|
+
/** Create a housekeeping task */
|
|
1730
|
+
createTask(input) {
|
|
1731
|
+
return this._post(this._buildPath("tasks"), input);
|
|
1732
|
+
}
|
|
1733
|
+
/** List housekeeping tasks with optional filters */
|
|
1734
|
+
listTasks(params) {
|
|
1735
|
+
if (!params) return this._get(this._buildPath("tasks"));
|
|
1736
|
+
const query = {};
|
|
1737
|
+
if (params.spaceId !== void 0) query.spaceId = params.spaceId;
|
|
1738
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1739
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1740
|
+
if (params.assignedTo !== void 0) query.assignedTo = params.assignedTo;
|
|
1741
|
+
if (params.priority !== void 0) query.priority = params.priority;
|
|
1742
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1743
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1744
|
+
return this._get(this._buildPath("tasks"), query);
|
|
1745
|
+
}
|
|
1746
|
+
/** Update a housekeeping task */
|
|
1747
|
+
updateTask(taskId, input) {
|
|
1748
|
+
return this._patch(this._buildPath("tasks", taskId), input);
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
// src/services/night-audit.ts
|
|
1753
|
+
var NightAuditService = class extends BaseService {
|
|
1754
|
+
constructor() {
|
|
1755
|
+
super(...arguments);
|
|
1756
|
+
this.basePath = "/operations/v1/night-audit";
|
|
1757
|
+
}
|
|
1758
|
+
// ---------------------------------------------------------------------------
|
|
1759
|
+
// Run and history
|
|
1760
|
+
// ---------------------------------------------------------------------------
|
|
1761
|
+
/** Run a night audit for a property */
|
|
1762
|
+
run(input) {
|
|
1763
|
+
return this._post(this._buildPath("run"), input);
|
|
1764
|
+
}
|
|
1765
|
+
/** Get night audit history with optional filters */
|
|
1766
|
+
getHistory(params) {
|
|
1767
|
+
if (!params) return this._get(this._buildPath("history"));
|
|
1768
|
+
const query = {};
|
|
1769
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1770
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1771
|
+
if (params.fromDate !== void 0) query.fromDate = params.fromDate;
|
|
1772
|
+
if (params.toDate !== void 0) query.toDate = params.toDate;
|
|
1773
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1774
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1775
|
+
return this._get(this._buildPath("history"), query);
|
|
1776
|
+
}
|
|
1777
|
+
// ---------------------------------------------------------------------------
|
|
1778
|
+
// Report
|
|
1779
|
+
// ---------------------------------------------------------------------------
|
|
1780
|
+
/** Get the detailed report for a completed night audit */
|
|
1781
|
+
getReport(auditId) {
|
|
1782
|
+
return this._get(this._buildPath(auditId, "report"));
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
// src/services/payments.ts
|
|
1787
|
+
var PaymentsService = class extends BaseService {
|
|
1788
|
+
constructor() {
|
|
1789
|
+
super(...arguments);
|
|
1790
|
+
this.basePath = "/payment/v1";
|
|
1791
|
+
}
|
|
1792
|
+
// ---------------------------------------------------------------------------
|
|
1793
|
+
// Process and refund
|
|
1794
|
+
// ---------------------------------------------------------------------------
|
|
1795
|
+
/** Process a payment for a booking */
|
|
1796
|
+
process(input) {
|
|
1797
|
+
return this._post(this._buildPath("payments"), input);
|
|
1798
|
+
}
|
|
1799
|
+
/** Refund a payment (full or partial) */
|
|
1800
|
+
refund(paymentId, input) {
|
|
1801
|
+
return this._post(this._buildPath("payments", paymentId, "refund"), input ?? {});
|
|
1802
|
+
}
|
|
1803
|
+
// ---------------------------------------------------------------------------
|
|
1804
|
+
// Transactions
|
|
1805
|
+
// ---------------------------------------------------------------------------
|
|
1806
|
+
/** Get a transaction by ID */
|
|
1807
|
+
getTransaction(transactionId) {
|
|
1808
|
+
return this._get(this._buildPath("transactions", transactionId));
|
|
1809
|
+
}
|
|
1810
|
+
/** List transactions with optional filters */
|
|
1811
|
+
listTransactions(params) {
|
|
1812
|
+
if (!params) return this._get(this._buildPath("transactions"));
|
|
1813
|
+
const query = {};
|
|
1814
|
+
if (params.bookingId !== void 0) query.bookingId = params.bookingId;
|
|
1815
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1816
|
+
if (params.provider !== void 0) query.provider = params.provider;
|
|
1817
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1818
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1819
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1820
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1821
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1822
|
+
return this._get(this._buildPath("transactions"), query);
|
|
1823
|
+
}
|
|
1824
|
+
// ---------------------------------------------------------------------------
|
|
1825
|
+
// Payment accounts (stored cards)
|
|
1826
|
+
// ---------------------------------------------------------------------------
|
|
1827
|
+
/** Create a payment account (store a card on file) */
|
|
1828
|
+
createAccount(input) {
|
|
1829
|
+
return this._post(this._buildPath("accounts"), input);
|
|
1830
|
+
}
|
|
1831
|
+
/** Get a payment account by ID */
|
|
1832
|
+
getAccount(accountId) {
|
|
1833
|
+
return this._get(this._buildPath("accounts", accountId));
|
|
1834
|
+
}
|
|
1835
|
+
/** List payment accounts with optional filters */
|
|
1836
|
+
listAccounts(params) {
|
|
1837
|
+
if (!params) return this._get(this._buildPath("accounts"));
|
|
1838
|
+
const query = {};
|
|
1839
|
+
if (params.bookingId !== void 0) query.bookingId = params.bookingId;
|
|
1840
|
+
if (params.guestId !== void 0) query.guestId = params.guestId;
|
|
1841
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1842
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1843
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1844
|
+
return this._get(this._buildPath("accounts"), query);
|
|
1845
|
+
}
|
|
1846
|
+
/** Delete a payment account */
|
|
1847
|
+
deleteAccount(accountId) {
|
|
1848
|
+
return this._delete(this._buildPath("accounts", accountId));
|
|
1849
|
+
}
|
|
1850
|
+
// ---------------------------------------------------------------------------
|
|
1851
|
+
// Authorize and capture
|
|
1852
|
+
// ---------------------------------------------------------------------------
|
|
1853
|
+
/** Authorize a hold on a stored card */
|
|
1854
|
+
authorize(accountId, input) {
|
|
1855
|
+
return this._post(this._buildPath("accounts", accountId, "authorize"), input);
|
|
1856
|
+
}
|
|
1857
|
+
/** Capture a previously authorized hold */
|
|
1858
|
+
capture(accountId, input) {
|
|
1859
|
+
return this._post(this._buildPath("accounts", accountId, "capture"), input);
|
|
1860
|
+
}
|
|
1861
|
+
// ---------------------------------------------------------------------------
|
|
1862
|
+
// Terminal operations
|
|
1863
|
+
// ---------------------------------------------------------------------------
|
|
1864
|
+
/** Initiate a POS terminal payment authorization */
|
|
1865
|
+
terminalAuthorize(input) {
|
|
1866
|
+
return this._post(this._buildPath("terminal", "authorize"), input);
|
|
1867
|
+
}
|
|
1868
|
+
// ---------------------------------------------------------------------------
|
|
1869
|
+
// IRIS operations
|
|
1870
|
+
// ---------------------------------------------------------------------------
|
|
1871
|
+
/** Initiate an IRIS instant bank transfer */
|
|
1872
|
+
irisInitiate(input) {
|
|
1873
|
+
return this._post(this._buildPath("iris", "initiate"), input);
|
|
1874
|
+
}
|
|
1875
|
+
/** Get the status of an IRIS transfer */
|
|
1876
|
+
irisStatus(transferId) {
|
|
1877
|
+
return this._get(this._buildPath("iris", transferId));
|
|
1878
|
+
}
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1374
1881
|
// src/services/properties.ts
|
|
1375
1882
|
var PropertiesService = class extends BaseService {
|
|
1376
1883
|
constructor() {
|
|
@@ -1444,6 +1951,100 @@ var PropertiesService = class extends BaseService {
|
|
|
1444
1951
|
}
|
|
1445
1952
|
};
|
|
1446
1953
|
|
|
1954
|
+
// src/services/rate-plans.ts
|
|
1955
|
+
var RatePlansService = class extends BaseService {
|
|
1956
|
+
constructor() {
|
|
1957
|
+
super(...arguments);
|
|
1958
|
+
this.basePath = "/rate/v1";
|
|
1959
|
+
}
|
|
1960
|
+
// ---------------------------------------------------------------------------
|
|
1961
|
+
// Rate plan CRUD
|
|
1962
|
+
// ---------------------------------------------------------------------------
|
|
1963
|
+
/** List rate plans with optional filters */
|
|
1964
|
+
list(params) {
|
|
1965
|
+
if (!params) return this._get(this._buildPath("plans"));
|
|
1966
|
+
const query = {};
|
|
1967
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
1968
|
+
if (params.categoryId !== void 0) query.categoryId = params.categoryId;
|
|
1969
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1970
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1971
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1972
|
+
return this._get(this._buildPath("plans"), query);
|
|
1973
|
+
}
|
|
1974
|
+
/** Get a rate plan by ID */
|
|
1975
|
+
get(planId) {
|
|
1976
|
+
return this._get(this._buildPath("plans", planId));
|
|
1977
|
+
}
|
|
1978
|
+
/** Create a new rate plan */
|
|
1979
|
+
create(input) {
|
|
1980
|
+
return this._post(this._buildPath("plans"), input);
|
|
1981
|
+
}
|
|
1982
|
+
/** Update a rate plan */
|
|
1983
|
+
update(planId, input) {
|
|
1984
|
+
return this._patch(this._buildPath("plans", planId), input);
|
|
1985
|
+
}
|
|
1986
|
+
/** Delete a rate plan */
|
|
1987
|
+
delete(planId) {
|
|
1988
|
+
return this._delete(this._buildPath("plans", planId));
|
|
1989
|
+
}
|
|
1990
|
+
// ---------------------------------------------------------------------------
|
|
1991
|
+
// Rate period management
|
|
1992
|
+
// ---------------------------------------------------------------------------
|
|
1993
|
+
/** List rate periods for a plan */
|
|
1994
|
+
listPeriods(planId, params) {
|
|
1995
|
+
if (!params) {
|
|
1996
|
+
return this._get(this._buildPath("plans", planId, "periods"));
|
|
1997
|
+
}
|
|
1998
|
+
const query = {};
|
|
1999
|
+
if (params.fromDate !== void 0) query.fromDate = params.fromDate;
|
|
2000
|
+
if (params.toDate !== void 0) query.toDate = params.toDate;
|
|
2001
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2002
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2003
|
+
return this._get(this._buildPath("plans", planId, "periods"), query);
|
|
2004
|
+
}
|
|
2005
|
+
/** Get a rate period by ID */
|
|
2006
|
+
getPeriod(planId, periodId) {
|
|
2007
|
+
return this._get(this._buildPath("plans", planId, "periods", periodId));
|
|
2008
|
+
}
|
|
2009
|
+
/** Create a rate period */
|
|
2010
|
+
createPeriod(planId, input) {
|
|
2011
|
+
return this._post(this._buildPath("plans", planId, "periods"), input);
|
|
2012
|
+
}
|
|
2013
|
+
/** Update a rate period */
|
|
2014
|
+
updatePeriod(planId, periodId, input) {
|
|
2015
|
+
return this._patch(this._buildPath("plans", planId, "periods", periodId), input);
|
|
2016
|
+
}
|
|
2017
|
+
// ---------------------------------------------------------------------------
|
|
2018
|
+
// Restrictions
|
|
2019
|
+
// ---------------------------------------------------------------------------
|
|
2020
|
+
/** Get restrictions for a rate plan */
|
|
2021
|
+
getRestrictions(planId) {
|
|
2022
|
+
return this._get(this._buildPath("plans", planId, "restrictions"));
|
|
2023
|
+
}
|
|
2024
|
+
/** Update restrictions for a rate plan */
|
|
2025
|
+
updateRestrictions(planId, input) {
|
|
2026
|
+
return this._patch(this._buildPath("plans", planId, "restrictions"), input);
|
|
2027
|
+
}
|
|
2028
|
+
// ---------------------------------------------------------------------------
|
|
2029
|
+
// Price calculation
|
|
2030
|
+
// ---------------------------------------------------------------------------
|
|
2031
|
+
/** Calculate price for a stay */
|
|
2032
|
+
calculate(input) {
|
|
2033
|
+
return this._post(this._buildPath("calculate"), input);
|
|
2034
|
+
}
|
|
2035
|
+
// ---------------------------------------------------------------------------
|
|
2036
|
+
// Portfolio operations
|
|
2037
|
+
// ---------------------------------------------------------------------------
|
|
2038
|
+
/** Push rates to portfolio properties */
|
|
2039
|
+
pushToPortfolio(input) {
|
|
2040
|
+
return this._post(this._buildPath("portfolio", "push"), input);
|
|
2041
|
+
}
|
|
2042
|
+
/** Compare rates across portfolio properties */
|
|
2043
|
+
comparePortfolioRates(input) {
|
|
2044
|
+
return this._post(this._buildPath("portfolio", "compare"), input);
|
|
2045
|
+
}
|
|
2046
|
+
};
|
|
2047
|
+
|
|
1447
2048
|
// src/services/spaces.ts
|
|
1448
2049
|
var SpacesService = class extends BaseService {
|
|
1449
2050
|
constructor() {
|
|
@@ -1573,6 +2174,69 @@ var SpacesService = class extends BaseService {
|
|
|
1573
2174
|
}
|
|
1574
2175
|
};
|
|
1575
2176
|
|
|
2177
|
+
// src/services/staff.ts
|
|
2178
|
+
var StaffService = class extends BaseService {
|
|
2179
|
+
constructor() {
|
|
2180
|
+
super(...arguments);
|
|
2181
|
+
this.basePath = "/operations/v1/staff";
|
|
2182
|
+
}
|
|
2183
|
+
// ---------------------------------------------------------------------------
|
|
2184
|
+
// Staff CRUD
|
|
2185
|
+
// ---------------------------------------------------------------------------
|
|
2186
|
+
/** Create a staff member */
|
|
2187
|
+
create(input) {
|
|
2188
|
+
return this._post(this.basePath, input);
|
|
2189
|
+
}
|
|
2190
|
+
/** Get a staff member by ID */
|
|
2191
|
+
get(staffId) {
|
|
2192
|
+
return this._get(this._buildPath(staffId));
|
|
2193
|
+
}
|
|
2194
|
+
/** List staff members with optional filters */
|
|
2195
|
+
list(params) {
|
|
2196
|
+
const query = {};
|
|
2197
|
+
query.propertyId = params.propertyId;
|
|
2198
|
+
if (params.department !== void 0) {
|
|
2199
|
+
query.department = Array.isArray(params.department) ? params.department.join(",") : params.department;
|
|
2200
|
+
}
|
|
2201
|
+
if (params.role !== void 0) {
|
|
2202
|
+
query.role = Array.isArray(params.role) ? params.role.join(",") : params.role;
|
|
2203
|
+
}
|
|
2204
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2205
|
+
if (params.search !== void 0) query.search = params.search;
|
|
2206
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2207
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2208
|
+
return this._get(this.basePath, query);
|
|
2209
|
+
}
|
|
2210
|
+
/** Update a staff member */
|
|
2211
|
+
update(staffId, input) {
|
|
2212
|
+
return this._patch(this._buildPath(staffId), input);
|
|
2213
|
+
}
|
|
2214
|
+
/** Delete a staff member */
|
|
2215
|
+
delete(staffId) {
|
|
2216
|
+
return this._delete(this._buildPath(staffId));
|
|
2217
|
+
}
|
|
2218
|
+
// ---------------------------------------------------------------------------
|
|
2219
|
+
// Shift management
|
|
2220
|
+
// ---------------------------------------------------------------------------
|
|
2221
|
+
/** Create a shift for a staff member */
|
|
2222
|
+
createShift(staffId, input) {
|
|
2223
|
+
return this._post(this._buildPath(staffId, "shifts"), input);
|
|
2224
|
+
}
|
|
2225
|
+
/** List shifts for a staff member */
|
|
2226
|
+
listShifts(staffId, params) {
|
|
2227
|
+
if (!params) return this._get(this._buildPath(staffId, "shifts"));
|
|
2228
|
+
const query = {};
|
|
2229
|
+
if (params.startDate !== void 0) query.startDate = params.startDate;
|
|
2230
|
+
if (params.endDate !== void 0) query.endDate = params.endDate;
|
|
2231
|
+
if (params.shiftType !== void 0) {
|
|
2232
|
+
query.shiftType = Array.isArray(params.shiftType) ? params.shiftType.join(",") : params.shiftType;
|
|
2233
|
+
}
|
|
2234
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2235
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2236
|
+
return this._get(this._buildPath(staffId, "shifts"), query);
|
|
2237
|
+
}
|
|
2238
|
+
};
|
|
2239
|
+
|
|
1576
2240
|
// src/client.ts
|
|
1577
2241
|
var BookingClient = class {
|
|
1578
2242
|
constructor(config) {
|
|
@@ -1600,16 +2264,51 @@ var BookingClient = class {
|
|
|
1600
2264
|
this._bookings ?? (this._bookings = new BookingsService(this.httpClient));
|
|
1601
2265
|
return this._bookings;
|
|
1602
2266
|
}
|
|
2267
|
+
/** Distribution service — lazy-initialized on first access */
|
|
2268
|
+
get distribution() {
|
|
2269
|
+
this._distribution ?? (this._distribution = new DistributionService(this.httpClient));
|
|
2270
|
+
return this._distribution;
|
|
2271
|
+
}
|
|
2272
|
+
/** Finance service — lazy-initialized on first access */
|
|
2273
|
+
get finance() {
|
|
2274
|
+
this._finance ?? (this._finance = new FinanceService(this.httpClient));
|
|
2275
|
+
return this._finance;
|
|
2276
|
+
}
|
|
2277
|
+
/** Groups service — lazy-initialized on first access */
|
|
2278
|
+
get groups() {
|
|
2279
|
+
this._groups ?? (this._groups = new GroupsService(this.httpClient));
|
|
2280
|
+
return this._groups;
|
|
2281
|
+
}
|
|
1603
2282
|
/** Guests service — lazy-initialized on first access */
|
|
1604
2283
|
get guests() {
|
|
1605
2284
|
this._guests ?? (this._guests = new GuestsService(this.httpClient));
|
|
1606
2285
|
return this._guests;
|
|
1607
2286
|
}
|
|
2287
|
+
/** Housekeeping service — lazy-initialized on first access */
|
|
2288
|
+
get housekeeping() {
|
|
2289
|
+
this._housekeeping ?? (this._housekeeping = new HousekeepingService(this.httpClient));
|
|
2290
|
+
return this._housekeeping;
|
|
2291
|
+
}
|
|
2292
|
+
/** Night audit service — lazy-initialized on first access */
|
|
2293
|
+
get nightAudit() {
|
|
2294
|
+
this._nightAudit ?? (this._nightAudit = new NightAuditService(this.httpClient));
|
|
2295
|
+
return this._nightAudit;
|
|
2296
|
+
}
|
|
2297
|
+
/** Payments service — lazy-initialized on first access */
|
|
2298
|
+
get payments() {
|
|
2299
|
+
this._payments ?? (this._payments = new PaymentsService(this.httpClient));
|
|
2300
|
+
return this._payments;
|
|
2301
|
+
}
|
|
1608
2302
|
/** Properties service — lazy-initialized on first access */
|
|
1609
2303
|
get properties() {
|
|
1610
2304
|
this._properties ?? (this._properties = new PropertiesService(this.httpClient));
|
|
1611
2305
|
return this._properties;
|
|
1612
2306
|
}
|
|
2307
|
+
/** Rate plans service — lazy-initialized on first access */
|
|
2308
|
+
get ratePlans() {
|
|
2309
|
+
this._ratePlans ?? (this._ratePlans = new RatePlansService(this.httpClient));
|
|
2310
|
+
return this._ratePlans;
|
|
2311
|
+
}
|
|
1613
2312
|
/** Categories service — lazy-initialized on first access */
|
|
1614
2313
|
get categories() {
|
|
1615
2314
|
this._categories ?? (this._categories = new CategoriesService(this.httpClient));
|
|
@@ -1620,6 +2319,11 @@ var BookingClient = class {
|
|
|
1620
2319
|
this._spaces ?? (this._spaces = new SpacesService(this.httpClient));
|
|
1621
2320
|
return this._spaces;
|
|
1622
2321
|
}
|
|
2322
|
+
/** Staff service — lazy-initialized on first access */
|
|
2323
|
+
get staff() {
|
|
2324
|
+
this._staff ?? (this._staff = new StaffService(this.httpClient));
|
|
2325
|
+
return this._staff;
|
|
2326
|
+
}
|
|
1623
2327
|
setApiKey(key) {
|
|
1624
2328
|
if (!key || key.trim().length === 0) {
|
|
1625
2329
|
throw new Error("apiKey must be a non-empty string");
|
|
@@ -1738,18 +2442,26 @@ var VERSION = "0.1.0";
|
|
|
1738
2442
|
CategoriesService,
|
|
1739
2443
|
ConflictError,
|
|
1740
2444
|
DEFAULT_MODULES,
|
|
2445
|
+
DistributionService,
|
|
2446
|
+
FinanceService,
|
|
1741
2447
|
ForbiddenError,
|
|
2448
|
+
GroupsService,
|
|
1742
2449
|
GuestsService,
|
|
2450
|
+
HousekeepingService,
|
|
1743
2451
|
HttpClient,
|
|
2452
|
+
NightAuditService,
|
|
1744
2453
|
NotFoundError,
|
|
1745
2454
|
PROPERTY_MODULES,
|
|
1746
2455
|
PaymentError,
|
|
2456
|
+
PaymentsService,
|
|
1747
2457
|
PropertiesService,
|
|
1748
2458
|
RateLimitError,
|
|
2459
|
+
RatePlansService,
|
|
1749
2460
|
SPACE_STATUSES,
|
|
1750
2461
|
SPACE_TYPES,
|
|
1751
2462
|
ServerError,
|
|
1752
2463
|
SpacesService,
|
|
2464
|
+
StaffService,
|
|
1753
2465
|
TimeoutError,
|
|
1754
2466
|
VERSION,
|
|
1755
2467
|
ValidationError,
|