roomzin-js 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +68 -0
- package/README.md +467 -0
- package/dist/api/client.d.ts +86 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +3 -0
- package/dist/api/client.js.map +1 -0
- package/dist/cluster/api.d.ts +34 -0
- package/dist/cluster/api.d.ts.map +1 -0
- package/dist/cluster/api.js +250 -0
- package/dist/cluster/api.js.map +1 -0
- package/dist/cluster/config.d.ts +30 -0
- package/dist/cluster/config.d.ts.map +1 -0
- package/dist/cluster/config.js +86 -0
- package/dist/cluster/config.js.map +1 -0
- package/dist/cluster/index.d.ts +3 -0
- package/dist/cluster/index.d.ts.map +1 -0
- package/dist/cluster/index.js +21 -0
- package/dist/cluster/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cluster/handler.d.ts +60 -0
- package/dist/internal/cluster/handler.d.ts.map +1 -0
- package/dist/internal/cluster/handler.js +589 -0
- package/dist/internal/cluster/handler.js.map +1 -0
- package/dist/internal/cluster/httputil.d.ts +25 -0
- package/dist/internal/cluster/httputil.d.ts.map +1 -0
- package/dist/internal/cluster/httputil.js +193 -0
- package/dist/internal/cluster/httputil.js.map +1 -0
- package/dist/internal/command/dec_room_avl.d.ts +5 -0
- package/dist/internal/command/dec_room_avl.d.ts.map +1 -0
- package/dist/internal/command/dec_room_avl.js +49 -0
- package/dist/internal/command/dec_room_avl.js.map +1 -0
- package/dist/internal/command/del_prop.d.ts +4 -0
- package/dist/internal/command/del_prop.d.ts.map +1 -0
- package/dist/internal/command/del_prop.js +43 -0
- package/dist/internal/command/del_prop.js.map +1 -0
- package/dist/internal/command/del_prop_day.d.ts +5 -0
- package/dist/internal/command/del_prop_day.d.ts.map +1 -0
- package/dist/internal/command/del_prop_day.js +47 -0
- package/dist/internal/command/del_prop_day.js.map +1 -0
- package/dist/internal/command/del_prop_room.d.ts +5 -0
- package/dist/internal/command/del_prop_room.d.ts.map +1 -0
- package/dist/internal/command/del_prop_room.js +46 -0
- package/dist/internal/command/del_prop_room.js.map +1 -0
- package/dist/internal/command/del_room_day.d.ts +5 -0
- package/dist/internal/command/del_room_day.d.ts.map +1 -0
- package/dist/internal/command/del_room_day.js +47 -0
- package/dist/internal/command/del_room_day.js.map +1 -0
- package/dist/internal/command/del_segment.d.ts +4 -0
- package/dist/internal/command/del_segment.d.ts.map +1 -0
- package/dist/internal/command/del_segment.js +43 -0
- package/dist/internal/command/del_segment.js.map +1 -0
- package/dist/internal/command/get_codecs.d.ts +5 -0
- package/dist/internal/command/get_codecs.d.ts.map +1 -0
- package/dist/internal/command/get_codecs.js +38 -0
- package/dist/internal/command/get_codecs.js.map +1 -0
- package/dist/internal/command/get_prop_room_day.d.ts +7 -0
- package/dist/internal/command/get_prop_room_day.d.ts.map +1 -0
- package/dist/internal/command/get_prop_room_day.js +59 -0
- package/dist/internal/command/get_prop_room_day.js.map +1 -0
- package/dist/internal/command/get_segments.d.ts +5 -0
- package/dist/internal/command/get_segments.d.ts.map +1 -0
- package/dist/internal/command/get_segments.js +47 -0
- package/dist/internal/command/get_segments.js.map +1 -0
- package/dist/internal/command/inc_room_avl.d.ts +5 -0
- package/dist/internal/command/inc_room_avl.d.ts.map +1 -0
- package/dist/internal/command/inc_room_avl.js +46 -0
- package/dist/internal/command/inc_room_avl.js.map +1 -0
- package/dist/internal/command/index.d.ts +20 -0
- package/dist/internal/command/index.d.ts.map +1 -0
- package/dist/internal/command/index.js +61 -0
- package/dist/internal/command/index.js.map +1 -0
- package/dist/internal/command/prop_exist.d.ts +4 -0
- package/dist/internal/command/prop_exist.d.ts.map +1 -0
- package/dist/internal/command/prop_exist.js +43 -0
- package/dist/internal/command/prop_exist.js.map +1 -0
- package/dist/internal/command/prop_room_date_list.d.ts +5 -0
- package/dist/internal/command/prop_room_date_list.d.ts.map +1 -0
- package/dist/internal/command/prop_room_date_list.js +50 -0
- package/dist/internal/command/prop_room_date_list.js.map +1 -0
- package/dist/internal/command/prop_room_exist.d.ts +5 -0
- package/dist/internal/command/prop_room_exist.d.ts.map +1 -0
- package/dist/internal/command/prop_room_exist.js +44 -0
- package/dist/internal/command/prop_room_exist.js.map +1 -0
- package/dist/internal/command/prop_room_list.d.ts +4 -0
- package/dist/internal/command/prop_room_list.d.ts.map +1 -0
- package/dist/internal/command/prop_room_list.js +45 -0
- package/dist/internal/command/prop_room_list.js.map +1 -0
- package/dist/internal/command/search_avail.d.ts +7 -0
- package/dist/internal/command/search_avail.d.ts.map +1 -0
- package/dist/internal/command/search_avail.js +129 -0
- package/dist/internal/command/search_avail.js.map +1 -0
- package/dist/internal/command/search_prop.d.ts +5 -0
- package/dist/internal/command/search_prop.d.ts.map +1 -0
- package/dist/internal/command/search_prop.js +73 -0
- package/dist/internal/command/search_prop.js.map +1 -0
- package/dist/internal/command/set_prop.d.ts +5 -0
- package/dist/internal/command/set_prop.d.ts.map +1 -0
- package/dist/internal/command/set_prop.js +47 -0
- package/dist/internal/command/set_prop.js.map +1 -0
- package/dist/internal/command/set_room_avl.d.ts +5 -0
- package/dist/internal/command/set_room_avl.d.ts.map +1 -0
- package/dist/internal/command/set_room_avl.js +46 -0
- package/dist/internal/command/set_room_avl.js.map +1 -0
- package/dist/internal/command/set_room_pkg.d.ts +5 -0
- package/dist/internal/command/set_room_pkg.d.ts.map +1 -0
- package/dist/internal/command/set_room_pkg.js +76 -0
- package/dist/internal/command/set_room_pkg.js.map +1 -0
- package/dist/internal/err.d.ts +16 -0
- package/dist/internal/err.d.ts.map +1 -0
- package/dist/internal/err.js +39 -0
- package/dist/internal/err.js.map +1 -0
- package/dist/internal/protocol/frame.d.ts +6 -0
- package/dist/internal/protocol/frame.d.ts.map +1 -0
- package/dist/internal/protocol/frame.js +118 -0
- package/dist/internal/protocol/frame.js.map +1 -0
- package/dist/internal/protocol/helpers.d.ts +8 -0
- package/dist/internal/protocol/helpers.d.ts.map +1 -0
- package/dist/internal/protocol/helpers.js +101 -0
- package/dist/internal/protocol/helpers.js.map +1 -0
- package/dist/internal/protocol/login.d.ts +2 -0
- package/dist/internal/protocol/login.d.ts.map +1 -0
- package/dist/internal/protocol/login.js +30 -0
- package/dist/internal/protocol/login.js.map +1 -0
- package/dist/internal/protocol/types.d.ts +19 -0
- package/dist/internal/protocol/types.d.ts.map +1 -0
- package/dist/internal/protocol/types.js +8 -0
- package/dist/internal/protocol/types.js.map +1 -0
- package/dist/internal/single/handler.d.ts +30 -0
- package/dist/internal/single/handler.d.ts.map +1 -0
- package/dist/internal/single/handler.js +197 -0
- package/dist/internal/single/handler.js.map +1 -0
- package/dist/single/api.d.ts +38 -0
- package/dist/single/api.d.ts.map +1 -0
- package/dist/single/api.js +240 -0
- package/dist/single/api.js.map +1 -0
- package/dist/single/config.d.ts +21 -0
- package/dist/single/config.d.ts.map +1 -0
- package/dist/single/config.js +64 -0
- package/dist/single/config.js.map +1 -0
- package/dist/single/index.d.ts +3 -0
- package/dist/single/index.d.ts.map +1 -0
- package/dist/single/index.js +21 -0
- package/dist/single/index.js.map +1 -0
- package/dist/types/codecs.d.ts +5 -0
- package/dist/types/codecs.d.ts.map +1 -0
- package/dist/types/codecs.js +16 -0
- package/dist/types/codecs.js.map +1 -0
- package/dist/types/discovery.d.ts +7 -0
- package/dist/types/discovery.d.ts.map +1 -0
- package/dist/types/discovery.js +3 -0
- package/dist/types/discovery.js.map +1 -0
- package/dist/types/err.d.ts +20 -0
- package/dist/types/err.d.ts.map +1 -0
- package/dist/types/err.js +38 -0
- package/dist/types/err.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/request.d.ts +94 -0
- package/dist/types/request.d.ts.map +1 -0
- package/dist/types/request.js +207 -0
- package/dist/types/request.js.map +1 -0
- package/dist/types/response.d.ts +22 -0
- package/dist/types/response.d.ts.map +1 -0
- package/dist/types/response.js +3 -0
- package/dist/types/response.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GetRoomDayRequest } from '../../types/request';
|
|
2
|
+
import { GetRoomDayResult } from '../../types/response';
|
|
3
|
+
import { Field } from '../protocol/types';
|
|
4
|
+
import { Codecs } from '../../types/codecs';
|
|
5
|
+
export declare function buildGetPropRoomDayPayload(p: GetRoomDayRequest): Buffer;
|
|
6
|
+
export declare function parseGetPropRoomDayResp(codecs: Codecs | null, status: string, fields: Field[]): GetRoomDayResult;
|
|
7
|
+
//# sourceMappingURL=get_prop_room_day.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_prop_room_day.d.ts","sourceRoot":"","sources":["../../../src/internal/command/get_prop_room_day.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI5C,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAiCvE;AAED,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,EAAE,GAChB,gBAAgB,CA4BlB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildGetPropRoomDayPayload = buildGetPropRoomDayPayload;
|
|
4
|
+
exports.parseGetPropRoomDayResp = parseGetPropRoomDayResp;
|
|
5
|
+
const helpers_1 = require("../protocol/helpers");
|
|
6
|
+
const err_1 = require("../err");
|
|
7
|
+
function buildGetPropRoomDayPayload(p) {
|
|
8
|
+
const cmdName = 'GETPROPROOMDAY';
|
|
9
|
+
const fields = [
|
|
10
|
+
{ id: 0x01, type: 0x01, data: Buffer.from(p.propertyID) },
|
|
11
|
+
{ id: 0x02, type: 0x01, data: Buffer.from(p.roomType) },
|
|
12
|
+
{ id: 0x03, type: 0x01, data: Buffer.from(p.date) },
|
|
13
|
+
];
|
|
14
|
+
let size = 1 + cmdName.length + 2; // cmd_len + cmd + field_count
|
|
15
|
+
for (const f of fields) {
|
|
16
|
+
size += 2 + 1 + 4 + f.data.length;
|
|
17
|
+
}
|
|
18
|
+
const buf = Buffer.alloc(size);
|
|
19
|
+
let offset = 0;
|
|
20
|
+
buf[offset++] = cmdName.length;
|
|
21
|
+
offset += buf.write(cmdName, offset);
|
|
22
|
+
buf.writeUInt16LE(fields.length, offset);
|
|
23
|
+
offset += 2;
|
|
24
|
+
for (const f of fields) {
|
|
25
|
+
buf.writeUInt16LE(f.id, offset);
|
|
26
|
+
offset += 2;
|
|
27
|
+
buf[offset++] = f.type;
|
|
28
|
+
buf.writeUInt32LE(f.data.length, offset);
|
|
29
|
+
offset += 4;
|
|
30
|
+
f.data.copy(buf, offset);
|
|
31
|
+
offset += f.data.length;
|
|
32
|
+
}
|
|
33
|
+
return buf;
|
|
34
|
+
}
|
|
35
|
+
function parseGetPropRoomDayResp(codecs, status, fields) {
|
|
36
|
+
if (status !== 'SUCCESS') {
|
|
37
|
+
const msg = fields.length > 0 && fields[0].fieldType === 0x01
|
|
38
|
+
? fields[0].data.toString('utf8')
|
|
39
|
+
: '';
|
|
40
|
+
throw (0, err_1.RzError)(msg);
|
|
41
|
+
}
|
|
42
|
+
if (fields.length < 5) {
|
|
43
|
+
throw (0, err_1.RzError)(`expected 5 response fields, got ${fields.length}`);
|
|
44
|
+
}
|
|
45
|
+
const [f0, f1, f2, f3, f4] = fields;
|
|
46
|
+
// Validate rate_feature field length (now u32 = 4 bytes)
|
|
47
|
+
if (f4.data.length !== 4) {
|
|
48
|
+
throw (0, err_1.RzError)(`invalid rate_feature field length: expected 4 bytes, got ${f4.data.length}`);
|
|
49
|
+
}
|
|
50
|
+
const rateFeatureMask = f4.data.readUInt32LE(0);
|
|
51
|
+
return {
|
|
52
|
+
propertyID: f0.data.toString('utf8'),
|
|
53
|
+
date: f1.data.toString('utf8'),
|
|
54
|
+
availability: f2.data[0],
|
|
55
|
+
finalPrice: f3.data.readUInt32LE(0),
|
|
56
|
+
rateFeature: (0, helpers_1.bitmaskToRateFeatureStrings)(codecs, rateFeatureMask),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=get_prop_room_day.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_prop_room_day.js","sourceRoot":"","sources":["../../../src/internal/command/get_prop_room_day.ts"],"names":[],"mappings":";;AAQA,gEAiCC;AAED,0DAgCC;AAtED,iDAAkE;AAClE,gCAAiC;AAEjC,SAAgB,0BAA0B,CAAC,CAAoB;IAC3D,MAAM,OAAO,GAAG,gBAAgB,CAAC;IAEjC,MAAM,MAAM,GAAG;QACX,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE;QACzD,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE;QACvD,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE;KACtD,CAAC;IAEF,IAAI,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,8BAA8B;IACjE,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAA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C,MAAM,CAAC;YACjC,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,IAAA,aAAO,EAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAA,aAAO,EAAC,mCAAmC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC;IAEpC,yDAAyD;IACzD,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAA,aAAO,EAAC,4DAA4D,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,MAAM,eAAe,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAEhD,OAAO;QACH,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QACpC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC9B,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACxB,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACnC,WAAW,EAAE,IAAA,qCAA2B,EAAC,MAAM,EAAE,eAAe,CAAC;KACpE,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SegmentInfo } from '../../types/response';
|
|
2
|
+
import { Field } from '../protocol/types';
|
|
3
|
+
export declare function buildGetSegmentsPayload(): Buffer;
|
|
4
|
+
export declare function parseGetSegmentsResp(status: string, fields: Field[]): SegmentInfo[];
|
|
5
|
+
//# sourceMappingURL=get_segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_segments.d.ts","sourceRoot":"","sources":["../../../src/internal/command/get_segments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,uBAAuB,IAAI,MAAM,CAYhD;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,CAsCnF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildGetSegmentsPayload = buildGetSegmentsPayload;
|
|
4
|
+
exports.parseGetSegmentsResp = parseGetSegmentsResp;
|
|
5
|
+
const err_1 = require("../err");
|
|
6
|
+
function buildGetSegmentsPayload() {
|
|
7
|
+
const cmdName = 'GETSEGMENTS';
|
|
8
|
+
const size = 1 + cmdName.length + 2; // cmd_len + cmd + field_count(0)
|
|
9
|
+
const buf = Buffer.alloc(size);
|
|
10
|
+
let offset = 0;
|
|
11
|
+
buf[offset++] = cmdName.length;
|
|
12
|
+
offset += buf.write(cmdName, offset);
|
|
13
|
+
buf.writeUInt16LE(0, offset); // 0 fields
|
|
14
|
+
return buf;
|
|
15
|
+
}
|
|
16
|
+
function parseGetSegmentsResp(status, fields) {
|
|
17
|
+
if (status !== 'SUCCESS') {
|
|
18
|
+
const msg = fields.length > 0 && fields[0].fieldType === 0x01
|
|
19
|
+
? fields[0].data.toString('utf8')
|
|
20
|
+
: 'unknown error';
|
|
21
|
+
throw (0, err_1.RzError)(msg);
|
|
22
|
+
}
|
|
23
|
+
if (fields.length % 2 !== 0) {
|
|
24
|
+
throw (0, err_1.RzError)('invalid field count: expected pairs of segment and propCount');
|
|
25
|
+
}
|
|
26
|
+
const list = [];
|
|
27
|
+
for (let i = 0; i < fields.length; i += 2) {
|
|
28
|
+
const segmentField = fields[i];
|
|
29
|
+
const countField = fields[i + 1];
|
|
30
|
+
// Field i: segment string (type 0x01)
|
|
31
|
+
if (segmentField.fieldType !== 0x01) {
|
|
32
|
+
throw (0, err_1.RzError)(`expected string segment at field ${i}, got type ${segmentField.fieldType}`);
|
|
33
|
+
}
|
|
34
|
+
const segment = segmentField.data.toString('utf8');
|
|
35
|
+
// Field i+1: propCount u32 (type 0x03, 4 bytes)
|
|
36
|
+
if (countField.fieldType !== 0x03) {
|
|
37
|
+
throw (0, err_1.RzError)(`expected u32 propCount at field ${i + 1}, got type ${countField.fieldType}`);
|
|
38
|
+
}
|
|
39
|
+
if (countField.data.length !== 4) {
|
|
40
|
+
throw (0, err_1.RzError)(`invalid propCount length: expected 4 bytes, got ${countField.data.length}`);
|
|
41
|
+
}
|
|
42
|
+
const propCount = countField.data.readUInt32LE(0);
|
|
43
|
+
list.push({ segment, propCount });
|
|
44
|
+
}
|
|
45
|
+
return list;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=get_segments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_segments.js","sourceRoot":"","sources":["../../../src/internal/command/get_segments.ts"],"names":[],"mappings":";;AAKA,0DAYC;AAED,oDAsCC;AAvDD,gCAAiC;AAGjC,SAAgB,uBAAuB;IACnC,MAAM,OAAO,GAAG,aAAa,CAAC;IAE9B,MAAM,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,iCAAiC;IACtE,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/B,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrC,GAAG,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC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CAAC;QACD,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAA,aAAO,EAAC,mDAAmD,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,CAAC;QAED,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UpdRoomAvlPayload } from '../../types/request';
|
|
2
|
+
import { Field } from '../protocol/types';
|
|
3
|
+
export declare function buildIncRoomAvlPayload(p: UpdRoomAvlPayload): Buffer;
|
|
4
|
+
export declare function parseIncRoomAvlResp(status: string, fields: Field[]): number;
|
|
5
|
+
//# sourceMappingURL=inc_room_avl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inc_room_avl.d.ts","sourceRoot":"","sources":["../../../src/internal/command/inc_room_avl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAkCnE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAW3E"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildIncRoomAvlPayload = buildIncRoomAvlPayload;
|
|
4
|
+
exports.parseIncRoomAvlResp = parseIncRoomAvlResp;
|
|
5
|
+
const err_1 = require("../err");
|
|
6
|
+
function buildIncRoomAvlPayload(p) {
|
|
7
|
+
const cmdName = 'INCROOMAVL';
|
|
8
|
+
const fields = [
|
|
9
|
+
{ id: 0x01, type: 0x01, data: Buffer.from(p.propertyID) },
|
|
10
|
+
{ id: 0x02, type: 0x01, data: Buffer.from(p.roomType) },
|
|
11
|
+
{ id: 0x03, type: 0x01, data: Buffer.from(p.date) },
|
|
12
|
+
{ id: 0x04, type: 0x02, data: Buffer.from([p.amount]) },
|
|
13
|
+
];
|
|
14
|
+
let size = 1 + cmdName.length + 2; // cmd_len + cmd + field_count
|
|
15
|
+
for (const f of fields) {
|
|
16
|
+
size += 2 + 1 + 4 + f.data.length; // id + type + len + data
|
|
17
|
+
}
|
|
18
|
+
const buf = Buffer.alloc(size);
|
|
19
|
+
let offset = 0;
|
|
20
|
+
buf[offset++] = cmdName.length;
|
|
21
|
+
offset += buf.write(cmdName, offset);
|
|
22
|
+
buf.writeUInt16LE(fields.length, offset);
|
|
23
|
+
offset += 2;
|
|
24
|
+
for (const f of fields) {
|
|
25
|
+
buf.writeUInt16LE(f.id, offset);
|
|
26
|
+
offset += 2;
|
|
27
|
+
buf[offset++] = f.type;
|
|
28
|
+
buf.writeUInt32LE(f.data.length, offset);
|
|
29
|
+
offset += 4;
|
|
30
|
+
f.data.copy(buf, offset);
|
|
31
|
+
offset += f.data.length;
|
|
32
|
+
}
|
|
33
|
+
return buf;
|
|
34
|
+
}
|
|
35
|
+
function parseIncRoomAvlResp(status, fields) {
|
|
36
|
+
if (status === 'SUCCESS') {
|
|
37
|
+
const b = fields[0]?.data;
|
|
38
|
+
if (!b || b.length !== 1) {
|
|
39
|
+
throw (0, err_1.RzError)('missing or invalid scalar value');
|
|
40
|
+
}
|
|
41
|
+
return b[0];
|
|
42
|
+
}
|
|
43
|
+
const msg = fields[0]?.data.toString('utf8') ?? 'unknown error';
|
|
44
|
+
throw (0, err_1.RzError)(`${msg}`);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=inc_room_avl.js.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odecsPayload, parseGetCodecsResp } from './get_codecs';
|
|
2
|
+
export { buildSetPropPayload, parseSetPropResp } from './set_prop';
|
|
3
|
+
export { buildSearchPropPayload, parseSearchPropResp } from './search_prop';
|
|
4
|
+
export { buildSearchAvailPayload, parseSearchAvailResp } from './search_avail';
|
|
5
|
+
export { buildSetRoomPkgPayload, parseSetRoomPkgResp } from './set_room_pkg';
|
|
6
|
+
export { buildSetRoomAvlPayload, parseSetRoomAvlResp } from './set_room_avl';
|
|
7
|
+
export { buildIncRoomAvlPayload, parseIncRoomAvlResp } from './inc_room_avl';
|
|
8
|
+
export { buildDecRoomAvlPayload, parseDecRoomAvlResp } from './dec_room_avl';
|
|
9
|
+
export { buildPropExistPayload, parsePropExistResp } from './prop_exist';
|
|
10
|
+
export { buildPropRoomExistPayload, parsePropRoomExistResp } from './prop_room_exist';
|
|
11
|
+
export { buildPropRoomListPayload, parsePropRoomListResp } from './prop_room_list';
|
|
12
|
+
export { buildPropRoomDateListPayload, parsePropRoomDateListResp } from './prop_room_date_list';
|
|
13
|
+
export { buildDelPropPayload, parseDelPropResp } from './del_prop';
|
|
14
|
+
export { buildDelSegmentPayload, parseDelSegmentResp } from './del_segment';
|
|
15
|
+
export { buildDelPropDayPayload, parseDelPropDayResp } from './del_prop_day';
|
|
16
|
+
export { buildDelPropRoomPayload, parseDelPropRoomResp } from './del_prop_room';
|
|
17
|
+
export { buildDelRoomDayPayload, parseDelRoomDayResp } from './del_room_day';
|
|
18
|
+
export { buildGetPropRoomDayPayload, parseGetPropRoomDayResp } from './get_prop_room_day';
|
|
19
|
+
export { buildGetSegmentsPayload, parseGetSegmentsResp } from './get_segments';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC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 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseGetSegmentsResp = exports.buildGetSegmentsPayload = exports.parseGetPropRoomDayResp = exports.buildGetPropRoomDayPayload = exports.parseDelRoomDayResp = exports.buildDelRoomDayPayload = exports.parseDelPropRoomResp = exports.buildDelPropRoomPayload = exports.parseDelPropDayResp = exports.buildDelPropDayPayload = exports.parseDelSegmentResp = exports.buildDelSegmentPayload = exports.parseDelPropResp = exports.buildDelPropPayload = exports.parsePropRoomDateListResp = exports.buildPropRoomDateListPayload = exports.parsePropRoomListResp = exports.buildPropRoomListPayload = exports.parsePropRoomExistResp = exports.buildPropRoomExistPayload = exports.parsePropExistResp = exports.buildPropExistPayload = exports.parseDecRoomAvlResp = exports.buildDecRoomAvlPayload = exports.parseIncRoomAvlResp = exports.buildIncRoomAvlPayload = exports.parseSetRoomAvlResp = exports.buildSetRoomAvlPayload = exports.parseSetRoomPkgResp = exports.buildSetRoomPkgPayload = exports.parseSearchAvailResp = exports.buildSearchAvailPayload = exports.parseSearchPropResp = exports.buildSearchPropPayload = exports.parseSetPropResp = exports.buildSetPropPayload = exports.parseGetCodecsResp = exports.buildGetCodecsPayload = void 0;
|
|
4
|
+
var get_codecs_1 = require("./get_codecs");
|
|
5
|
+
Object.defineProperty(exports, "buildGetCodecsPayload", { enumerable: true, get: function () { return get_codecs_1.buildGetCodecsPayload; } });
|
|
6
|
+
Object.defineProperty(exports, "parseGetCodecsResp", { enumerable: true, get: function () { return get_codecs_1.parseGetCodecsResp; } });
|
|
7
|
+
var set_prop_1 = require("./set_prop");
|
|
8
|
+
Object.defineProperty(exports, "buildSetPropPayload", { enumerable: true, get: function () { return set_prop_1.buildSetPropPayload; } });
|
|
9
|
+
Object.defineProperty(exports, "parseSetPropResp", { enumerable: true, get: function () { return set_prop_1.parseSetPropResp; } });
|
|
10
|
+
var search_prop_1 = require("./search_prop");
|
|
11
|
+
Object.defineProperty(exports, "buildSearchPropPayload", { enumerable: true, get: function () { return search_prop_1.buildSearchPropPayload; } });
|
|
12
|
+
Object.defineProperty(exports, "parseSearchPropResp", { enumerable: true, get: function () { return search_prop_1.parseSearchPropResp; } });
|
|
13
|
+
var search_avail_1 = require("./search_avail");
|
|
14
|
+
Object.defineProperty(exports, "buildSearchAvailPayload", { enumerable: true, get: function () { return search_avail_1.buildSearchAvailPayload; } });
|
|
15
|
+
Object.defineProperty(exports, "parseSearchAvailResp", { enumerable: true, get: function () { return search_avail_1.parseSearchAvailResp; } });
|
|
16
|
+
var set_room_pkg_1 = require("./set_room_pkg");
|
|
17
|
+
Object.defineProperty(exports, "buildSetRoomPkgPayload", { enumerable: true, get: function () { return set_room_pkg_1.buildSetRoomPkgPayload; } });
|
|
18
|
+
Object.defineProperty(exports, "parseSetRoomPkgResp", { enumerable: true, get: function () { return set_room_pkg_1.parseSetRoomPkgResp; } });
|
|
19
|
+
var set_room_avl_1 = require("./set_room_avl");
|
|
20
|
+
Object.defineProperty(exports, "buildSetRoomAvlPayload", { enumerable: true, get: function () { return set_room_avl_1.buildSetRoomAvlPayload; } });
|
|
21
|
+
Object.defineProperty(exports, "parseSetRoomAvlResp", { enumerable: true, get: function () { return set_room_avl_1.parseSetRoomAvlResp; } });
|
|
22
|
+
var inc_room_avl_1 = require("./inc_room_avl");
|
|
23
|
+
Object.defineProperty(exports, "buildIncRoomAvlPayload", { enumerable: true, get: function () { return inc_room_avl_1.buildIncRoomAvlPayload; } });
|
|
24
|
+
Object.defineProperty(exports, "parseIncRoomAvlResp", { enumerable: true, get: function () { return inc_room_avl_1.parseIncRoomAvlResp; } });
|
|
25
|
+
var dec_room_avl_1 = require("./dec_room_avl");
|
|
26
|
+
Object.defineProperty(exports, "buildDecRoomAvlPayload", { enumerable: true, get: function () { return dec_room_avl_1.buildDecRoomAvlPayload; } });
|
|
27
|
+
Object.defineProperty(exports, "parseDecRoomAvlResp", { enumerable: true, get: function () { return dec_room_avl_1.parseDecRoomAvlResp; } });
|
|
28
|
+
var prop_exist_1 = require("./prop_exist");
|
|
29
|
+
Object.defineProperty(exports, "buildPropExistPayload", { enumerable: true, get: function () { return prop_exist_1.buildPropExistPayload; } });
|
|
30
|
+
Object.defineProperty(exports, "parsePropExistResp", { enumerable: true, get: function () { return prop_exist_1.parsePropExistResp; } });
|
|
31
|
+
var prop_room_exist_1 = require("./prop_room_exist");
|
|
32
|
+
Object.defineProperty(exports, "buildPropRoomExistPayload", { enumerable: true, get: function () { return prop_room_exist_1.buildPropRoomExistPayload; } });
|
|
33
|
+
Object.defineProperty(exports, "parsePropRoomExistResp", { enumerable: true, get: function () { return prop_room_exist_1.parsePropRoomExistResp; } });
|
|
34
|
+
var prop_room_list_1 = require("./prop_room_list");
|
|
35
|
+
Object.defineProperty(exports, "buildPropRoomListPayload", { enumerable: true, get: function () { return prop_room_list_1.buildPropRoomListPayload; } });
|
|
36
|
+
Object.defineProperty(exports, "parsePropRoomListResp", { enumerable: true, get: function () { return prop_room_list_1.parsePropRoomListResp; } });
|
|
37
|
+
var prop_room_date_list_1 = require("./prop_room_date_list");
|
|
38
|
+
Object.defineProperty(exports, "buildPropRoomDateListPayload", { enumerable: true, get: function () { return prop_room_date_list_1.buildPropRoomDateListPayload; } });
|
|
39
|
+
Object.defineProperty(exports, "parsePropRoomDateListResp", { enumerable: true, get: function () { return prop_room_date_list_1.parsePropRoomDateListResp; } });
|
|
40
|
+
var del_prop_1 = require("./del_prop");
|
|
41
|
+
Object.defineProperty(exports, "buildDelPropPayload", { enumerable: true, get: function () { return del_prop_1.buildDelPropPayload; } });
|
|
42
|
+
Object.defineProperty(exports, "parseDelPropResp", { enumerable: true, get: function () { return del_prop_1.parseDelPropResp; } });
|
|
43
|
+
var del_segment_1 = require("./del_segment");
|
|
44
|
+
Object.defineProperty(exports, "buildDelSegmentPayload", { enumerable: true, get: function () { return del_segment_1.buildDelSegmentPayload; } });
|
|
45
|
+
Object.defineProperty(exports, "parseDelSegmentResp", { enumerable: true, get: function () { return del_segment_1.parseDelSegmentResp; } });
|
|
46
|
+
var del_prop_day_1 = require("./del_prop_day");
|
|
47
|
+
Object.defineProperty(exports, "buildDelPropDayPayload", { enumerable: true, get: function () { return del_prop_day_1.buildDelPropDayPayload; } });
|
|
48
|
+
Object.defineProperty(exports, "parseDelPropDayResp", { enumerable: true, get: function () { return del_prop_day_1.parseDelPropDayResp; } });
|
|
49
|
+
var del_prop_room_1 = require("./del_prop_room");
|
|
50
|
+
Object.defineProperty(exports, "buildDelPropRoomPayload", { enumerable: true, get: function () { return del_prop_room_1.buildDelPropRoomPayload; } });
|
|
51
|
+
Object.defineProperty(exports, "parseDelPropRoomResp", { enumerable: true, get: function () { return del_prop_room_1.parseDelPropRoomResp; } });
|
|
52
|
+
var del_room_day_1 = require("./del_room_day");
|
|
53
|
+
Object.defineProperty(exports, "buildDelRoomDayPayload", { enumerable: true, get: function () { return del_room_day_1.buildDelRoomDayPayload; } });
|
|
54
|
+
Object.defineProperty(exports, "parseDelRoomDayResp", { enumerable: true, get: function () { return del_room_day_1.parseDelRoomDayResp; } });
|
|
55
|
+
var get_prop_room_day_1 = require("./get_prop_room_day");
|
|
56
|
+
Object.defineProperty(exports, "buildGetPropRoomDayPayload", { enumerable: true, get: function () { return get_prop_room_day_1.buildGetPropRoomDayPayload; } });
|
|
57
|
+
Object.defineProperty(exports, "parseGetPropRoomDayResp", { enumerable: true, get: function () { return get_prop_room_day_1.parseGetPropRoomDayResp; } });
|
|
58
|
+
var get_segments_1 = require("./get_segments");
|
|
59
|
+
Object.defineProperty(exports, "buildGetSegmentsPayload", { enumerable: true, get: function () { return get_segments_1.buildGetSegmentsPayload; } });
|
|
60
|
+
Object.defineProperty(exports, "parseGetSegmentsResp", { enumerable: true, get: function () { return get_segments_1.parseGetSegmentsResp; } });
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/command/index.ts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0F;AAAjF,+HAAA,0BAA0B,OAAA;AAAE,4HAAA,uBAAuB,OAAA;AAC5D,+CAA+E;AAAtE,uHAAA,uBAAuB,OAAA;AAAE,oHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_exist.d.ts","sourceRoot":"","sources":["../../../src/internal/command/prop_exist.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA6BhE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAY3E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPropExistPayload = buildPropExistPayload;
|
|
4
|
+
exports.parsePropExistResp = parsePropExistResp;
|
|
5
|
+
// src/internal/command/prop_exist.ts
|
|
6
|
+
const err_1 = require("../err");
|
|
7
|
+
function buildPropExistPayload(propertyID) {
|
|
8
|
+
const cmdName = 'PROPEXIST';
|
|
9
|
+
const fields = [
|
|
10
|
+
{ id: 0x01, type: 0x01, data: Buffer.from(propertyID) },
|
|
11
|
+
];
|
|
12
|
+
let size = 1 + cmdName.length + 2; // cmd_len + cmd + field_count
|
|
13
|
+
for (const f of fields) {
|
|
14
|
+
size += 2 + 1 + 4 + f.data.length; // id + type + len + data
|
|
15
|
+
}
|
|
16
|
+
const buf = Buffer.alloc(size);
|
|
17
|
+
let offset = 0;
|
|
18
|
+
buf[offset++] = cmdName.length;
|
|
19
|
+
offset += buf.write(cmdName, offset);
|
|
20
|
+
buf.writeUInt16LE(fields.length, offset);
|
|
21
|
+
offset += 2;
|
|
22
|
+
// Single field: PropertyID (string)
|
|
23
|
+
buf.writeUInt16LE(0x01, offset);
|
|
24
|
+
offset += 2;
|
|
25
|
+
buf[offset++] = 0x01; // type = string
|
|
26
|
+
buf.writeUInt32LE(fields[0].data.length, offset);
|
|
27
|
+
offset += 4;
|
|
28
|
+
fields[0].data.copy(buf, offset);
|
|
29
|
+
return buf;
|
|
30
|
+
}
|
|
31
|
+
function parsePropExistResp(status, fields) {
|
|
32
|
+
if (status === 'SUCCESS') {
|
|
33
|
+
// SUCCESS → field[0] is a single byte: 1 = exists, 0 = not exists
|
|
34
|
+
if (!fields[0]?.data || fields[0].data.length < 1) {
|
|
35
|
+
throw (0, err_1.RzError)('invalid PROPEXIST response: missing boolean byte');
|
|
36
|
+
}
|
|
37
|
+
return fields[0].data[0] === 1;
|
|
38
|
+
}
|
|
39
|
+
// Error path
|
|
40
|
+
const msg = fields[0]?.data.toString('utf8') ?? 'unknown error';
|
|
41
|
+
throw (0, err_1.RzError)(`${msg}`);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=prop_exist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_exist.js","sourceRoot":"","sources":["../../../src/internal/command/prop_exist.ts"],"names":[],"mappings":";;AAIA,sDA6BC;AAED,gDAYC;AA/CD,qCAAqC;AACrC,gCAAiC;AAGjC,SAAgB,qBAAqB,CAAC,UAAkB;IACpD,MAAM,OAAO,GAAG,WAAW,CAAC;IAE5B,MAAM,MAAM,GAAG;QACX,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;KAC1D,CAAC;IAEF,IAAI,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,8BAA8B;IACjE,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACrB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,yBAAyB;IAChE,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,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,eAAe,CAAC;IAChE,MAAM,IAAA,aAAO,EAAC,GAAG,GAAG,EAAE,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropRoomDateListPayload } from '../../types/request';
|
|
2
|
+
import { Field } from '../protocol/types';
|
|
3
|
+
export declare function buildPropRoomDateListPayload(p: PropRoomDateListPayload): Buffer;
|
|
4
|
+
export declare function parsePropRoomDateListResp(status: string, fields: Field[]): string[];
|
|
5
|
+
//# sourceMappingURL=prop_room_date_list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_room_date_list.d.ts","sourceRoot":"","sources":["../../../src/internal/command/prop_room_date_list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAgC/E;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,CAoBnF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPropRoomDateListPayload = buildPropRoomDateListPayload;
|
|
4
|
+
exports.parsePropRoomDateListResp = parsePropRoomDateListResp;
|
|
5
|
+
const err_1 = require("../err");
|
|
6
|
+
function buildPropRoomDateListPayload(p) {
|
|
7
|
+
const cmdName = 'PROPROOMDATELIST';
|
|
8
|
+
const fields = [
|
|
9
|
+
{ id: 0x01, type: 0x01, data: Buffer.from(p.propertyID) },
|
|
10
|
+
{ id: 0x02, type: 0x01, data: Buffer.from(p.roomType) },
|
|
11
|
+
];
|
|
12
|
+
let size = 1 + cmdName.length + 2; // cmd_len + cmd + field_count
|
|
13
|
+
for (const f of fields) {
|
|
14
|
+
size += 2 + 1 + 4 + f.data.length; // id + type + len + data
|
|
15
|
+
}
|
|
16
|
+
const buf = Buffer.alloc(size);
|
|
17
|
+
let offset = 0;
|
|
18
|
+
buf[offset++] = cmdName.length;
|
|
19
|
+
offset += buf.write(cmdName, offset);
|
|
20
|
+
buf.writeUInt16LE(fields.length, offset);
|
|
21
|
+
offset += 2;
|
|
22
|
+
for (const f of fields) {
|
|
23
|
+
buf.writeUInt16LE(f.id, offset);
|
|
24
|
+
offset += 2;
|
|
25
|
+
buf[offset++] = f.type;
|
|
26
|
+
buf.writeUInt32LE(f.data.length, offset);
|
|
27
|
+
offset += 4;
|
|
28
|
+
f.data.copy(buf, offset);
|
|
29
|
+
offset += f.data.length;
|
|
30
|
+
}
|
|
31
|
+
return buf;
|
|
32
|
+
}
|
|
33
|
+
function parsePropRoomDateListResp(status, fields) {
|
|
34
|
+
if (status !== 'SUCCESS') {
|
|
35
|
+
const msg = fields.length > 0 && fields[0].fieldType === 0x01
|
|
36
|
+
? fields[0].data.toString('utf8')
|
|
37
|
+
: '';
|
|
38
|
+
throw (0, err_1.RzError)(msg);
|
|
39
|
+
}
|
|
40
|
+
const out = [];
|
|
41
|
+
for (const field of fields) {
|
|
42
|
+
const s = field.data.toString('utf8');
|
|
43
|
+
if (s !== '') {
|
|
44
|
+
out.push(s);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
out.sort();
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=prop_room_date_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_room_date_list.js","sourceRoot":"","sources":["../../../src/internal/command/prop_room_date_list.ts"],"names":[],"mappings":";;AAKA,oEAgCC;AAED,8DAoBC;AAzDD,gCAAiC;AAGjC,SAAgB,4BAA4B,CAAC,CAA0B;IACnE,MAAM,OAAO,GAAG,kBAA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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACzB,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAgB,yBAAyB,CAAC,MAAc,EAAE,MAAe;IACrE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,IAAI;YACzD,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YACjC,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,IAAA,aAAO,EAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YACX,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACL,CAAC;IAED,GAAG,CAAC,IAAI,EAAE,CAAC;IAEX,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropRoomExistPayload } from '../../types/request';
|
|
2
|
+
import { Field } from '../protocol/types';
|
|
3
|
+
export declare function buildPropRoomExistPayload(p: PropRoomExistPayload): Buffer;
|
|
4
|
+
export declare function parsePropRoomExistResp(status: string, fields: Field[]): boolean;
|
|
5
|
+
//# sourceMappingURL=prop_room_exist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_room_exist.d.ts","sourceRoot":"","sources":["../../../src/internal/command/prop_room_exist.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAgCzE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAW/E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPropRoomExistPayload = buildPropRoomExistPayload;
|
|
4
|
+
exports.parsePropRoomExistResp = parsePropRoomExistResp;
|
|
5
|
+
const err_1 = require("../err");
|
|
6
|
+
function buildPropRoomExistPayload(p) {
|
|
7
|
+
const cmdName = 'PROPROOMEXIST';
|
|
8
|
+
const fields = [
|
|
9
|
+
{ id: 0x01, type: 0x01, data: Buffer.from(p.propertyID) },
|
|
10
|
+
{ id: 0x02, type: 0x01, data: Buffer.from(p.roomType) },
|
|
11
|
+
];
|
|
12
|
+
let size = 1 + cmdName.length + 2; // cmd_len + cmd + field_count
|
|
13
|
+
for (const f of fields) {
|
|
14
|
+
size += 2 + 1 + 4 + f.data.length; // id + type + len + data
|
|
15
|
+
}
|
|
16
|
+
const buf = Buffer.alloc(size);
|
|
17
|
+
let offset = 0;
|
|
18
|
+
buf[offset++] = cmdName.length;
|
|
19
|
+
offset += buf.write(cmdName, offset);
|
|
20
|
+
buf.writeUInt16LE(fields.length, offset);
|
|
21
|
+
offset += 2;
|
|
22
|
+
for (const f of fields) {
|
|
23
|
+
buf.writeUInt16LE(f.id, offset);
|
|
24
|
+
offset += 2;
|
|
25
|
+
buf[offset++] = f.type;
|
|
26
|
+
buf.writeUInt32LE(f.data.length, offset);
|
|
27
|
+
offset += 4;
|
|
28
|
+
f.data.copy(buf, offset);
|
|
29
|
+
offset += f.data.length;
|
|
30
|
+
}
|
|
31
|
+
return buf;
|
|
32
|
+
}
|
|
33
|
+
function parsePropRoomExistResp(status, fields) {
|
|
34
|
+
if (status === 'SUCCESS') {
|
|
35
|
+
// SUCCESS → first field is a single byte: 1 = exists, 0 = does not exist
|
|
36
|
+
if (!fields[0]?.data || fields[0].data.length === 0) {
|
|
37
|
+
throw (0, err_1.RzError)('invalid PROPROOMEXIST response: missing boolean byte');
|
|
38
|
+
}
|
|
39
|
+
return fields[0].data[0] === 1;
|
|
40
|
+
}
|
|
41
|
+
// On error (including "not found")
|
|
42
|
+
throw (0, err_1.RzError)('');
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=prop_room_exist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_room_exist.js","sourceRoot":"","sources":["../../../src/internal/command/prop_room_exist.ts"],"names":[],"mappings":";;AAKA,8DAgCC;AAED,wDAWC;AAhDD,gCAAiC;AAGjC,SAAgB,yBAAyB,CAAC,CAAuB;IAC7D,MAAM,OAAO,GAAG,eAAe,CAAC;IAEhC,MAAM,MAAM,GAAG;QACX,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE;QACzD,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE;KAC1D,CAAC;IAEF,IAAI,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,8BAA8B;IACjE,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACrB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,yBAAyB;IAChE,CAAC;IAED,MAAM,GAAG,GA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mC;IACnC,MAAM,IAAA,aAAO,EAAC,EAAE,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_room_list.d.ts","sourceRoot":"","sources":["../../../src/internal/command/prop_room_list.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA6BnE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,CAe/E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPropRoomListPayload = buildPropRoomListPayload;
|
|
4
|
+
exports.parsePropRoomListResp = parsePropRoomListResp;
|
|
5
|
+
// src/internal/command/prop_room_list.ts
|
|
6
|
+
const err_1 = require("../err");
|
|
7
|
+
function buildPropRoomListPayload(propertyID) {
|
|
8
|
+
const cmdName = 'PROPROOMLIST';
|
|
9
|
+
const fields = [
|
|
10
|
+
{ id: 0x01, type: 0x01, data: Buffer.from(propertyID) },
|
|
11
|
+
];
|
|
12
|
+
let size = 1 + cmdName.length + 2; // cmd_len + cmd + field_count
|
|
13
|
+
for (const f of fields) {
|
|
14
|
+
size += 2 + 1 + 4 + f.data.length; // id + type + len + data
|
|
15
|
+
}
|
|
16
|
+
const buf = Buffer.alloc(size);
|
|
17
|
+
let offset = 0;
|
|
18
|
+
buf[offset++] = cmdName.length;
|
|
19
|
+
offset += buf.write(cmdName, offset);
|
|
20
|
+
buf.writeUInt16LE(fields.length, offset);
|
|
21
|
+
offset += 2;
|
|
22
|
+
// Single field: PropertyID (string)
|
|
23
|
+
buf.writeUInt16LE(0x01, offset);
|
|
24
|
+
offset += 2;
|
|
25
|
+
buf[offset++] = 0x01; // type = string
|
|
26
|
+
buf.writeUInt32LE(fields[0].data.length, offset);
|
|
27
|
+
offset += 4;
|
|
28
|
+
fields[0].data.copy(buf, offset);
|
|
29
|
+
return buf;
|
|
30
|
+
}
|
|
31
|
+
function parsePropRoomListResp(status, fields) {
|
|
32
|
+
if (status !== 'SUCCESS') {
|
|
33
|
+
const msg = fields.length > 0 && fields[0].fieldType === 0x01
|
|
34
|
+
? fields[0].data.toString('utf8')
|
|
35
|
+
: '';
|
|
36
|
+
throw (0, err_1.RzError)(msg);
|
|
37
|
+
}
|
|
38
|
+
// SUCCESS → all fields are room type strings
|
|
39
|
+
const list = [];
|
|
40
|
+
for (const field of fields) {
|
|
41
|
+
list.push(field.data.toString('utf8'));
|
|
42
|
+
}
|
|
43
|
+
return list;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=prop_room_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop_room_list.js","sourceRoot":"","sources":["../../../src/internal/command/prop_room_list.ts"],"names":[],"mappings":";;AAIA,4DA6BC;AAED,sDAeC;AAlDD,yCAAyC;AACzC,gCAAiC;AAGjC,SAAgB,wBAAwB,CAAC,UAAkB;IACvD,MAAM,OAAO,GAAG,cAAc,CAAC;IAE/B,MAAM,MAAM,GAAG;QACX,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;KAC1D,CAAC;IAEF,IAAI,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,8BAA8B;IACjE,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACrB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,yBAAyB;IAChE,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC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AAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SearchAvailPayload } from '../../types/request';
|
|
2
|
+
import { PropertyAvail } from '../../types/response';
|
|
3
|
+
import { Field } from '../protocol/types';
|
|
4
|
+
import { Codecs } from '../../types/codecs';
|
|
5
|
+
export declare function buildSearchAvailPayload(p: SearchAvailPayload): Buffer;
|
|
6
|
+
export declare function parseSearchAvailResp(codecs: Codecs | null, status: string, fields: Field[]): PropertyAvail[];
|
|
7
|
+
//# sourceMappingURL=search_avail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search_avail.d.ts","sourceRoot":"","sources":["../../../src/internal/command/search_avail.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAY,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAW5C,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,kBAAkB,GAAG,MAAM,CA+CrE;AAED,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,EAAE,GAChB,aAAa,EAAE,CAyEjB"}
|