UNPKG

1.21 kBTypeScriptView Raw
1/**
2 * @publicApi
3 */
4export interface MqttRecordOptions {
5 /**
6 * The QoS
7 */
8 qos?: 0 | 1 | 2;
9 /**
10 * The retain flag
11 */
12 retain?: boolean;
13 /**
14 * Whether or not mark a message as duplicate
15 */
16 dup?: boolean;
17 properties?: {
18 payloadFormatIndicator?: number;
19 messageExpiryInterval?: number;
20 topicAlias?: string;
21 responseTopic?: string;
22 correlationData?: Buffer;
23 userProperties?: Record<string, string | string[]>;
24 subscriptionIdentifier?: number;
25 contentType?: string;
26 };
27}
28/**
29 * @publicApi
30 */
31export declare class MqttRecord<TData = any> {
32 readonly data: TData;
33 options?: MqttRecordOptions;
34 constructor(data: TData, options?: MqttRecordOptions);
35}
36/**
37 * @publicApi
38 */
39export declare class MqttRecordBuilder<TData> {
40 private data?;
41 private options?;
42 constructor(data?: TData);
43 setData(data: TData): this;
44 setQoS(qos: MqttRecordOptions['qos']): this;
45 setRetain(retain: MqttRecordOptions['retain']): this;
46 setDup(dup: MqttRecordOptions['dup']): this;
47 setProperties(properties: MqttRecordOptions['properties']): this;
48 build(): MqttRecord;
49}