UNPKG

1.1 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.MqttRecordBuilder = exports.MqttRecord = void 0;
4class MqttRecord {
5 constructor(data, options) {
6 this.data = data;
7 this.options = options;
8 }
9}
10exports.MqttRecord = MqttRecord;
11class MqttRecordBuilder {
12 constructor(data) {
13 this.data = data;
14 }
15 setData(data) {
16 this.data = data;
17 return this;
18 }
19 setQoS(qos) {
20 this.options = {
21 ...this.options,
22 qos,
23 };
24 return this;
25 }
26 setRetain(retain) {
27 this.options = {
28 ...this.options,
29 retain,
30 };
31 return this;
32 }
33 setDup(dup) {
34 this.options = {
35 ...this.options,
36 dup,
37 };
38 return this;
39 }
40 setProperties(properties) {
41 this.options = {
42 ...this.options,
43 properties,
44 };
45 return this;
46 }
47 build() {
48 return new MqttRecord(this.data, this.options);
49 }
50}
51exports.MqttRecordBuilder = MqttRecordBuilder;