mqtt 4.2.7 → 4.3.2

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.
@@ -1,46 +1,46 @@
1
- import {
2
- IStoreOptions
3
- } from './store-options'
4
-
5
- /**
6
- * In-memory implementation of the message store
7
- * This can actually be saved into files.
8
- *
9
- */
10
- declare class Store {
11
- /**
12
- * Store constructor
13
- *
14
- * @param {Object} [options] - store options
15
- */
16
- constructor (options: IStoreOptions)
17
-
18
- /**
19
- * Adds a packet to the store, a packet is
20
- * anything that has a messageId property.
21
- *
22
- */
23
- public put (packet: any, cb?: Function): this
24
-
25
- /**
26
- * Creates a stream with all the packets in the store
27
- *
28
- */
29
- public createStream (): any
30
-
31
- /**
32
- * deletes a packet from the store.
33
- */
34
- public del (packet: any, cb: Function): this
35
-
36
- /**
37
- * get a packet from the store.
38
- */
39
- public get (packet: any, cb: Function): this
40
-
41
- /**
42
- * Close the store
43
- */
44
- public close (cb: Function): void
45
- }
46
- export { Store }
1
+ import {
2
+ IStoreOptions
3
+ } from './store-options'
4
+
5
+ /**
6
+ * In-memory implementation of the message store
7
+ * This can actually be saved into files.
8
+ *
9
+ */
10
+ declare class Store {
11
+ /**
12
+ * Store constructor
13
+ *
14
+ * @param {Object} [options] - store options
15
+ */
16
+ constructor (options: IStoreOptions)
17
+
18
+ /**
19
+ * Adds a packet to the store, a packet is
20
+ * anything that has a messageId property.
21
+ *
22
+ */
23
+ public put (packet: any, cb?: Function): this
24
+
25
+ /**
26
+ * Creates a stream with all the packets in the store
27
+ *
28
+ */
29
+ public createStream (): any
30
+
31
+ /**
32
+ * deletes a packet from the store.
33
+ */
34
+ public del (packet: any, cb: Function): this
35
+
36
+ /**
37
+ * get a packet from the store.
38
+ */
39
+ public get (packet: any, cb: Function): this
40
+
41
+ /**
42
+ * Close the store
43
+ */
44
+ public close (cb: Function): void
45
+ }
46
+ export { Store }
@@ -0,0 +1,48 @@
1
+ import { IMessageIdProvider } from './message-id-provider'
2
+
3
+ /**
4
+ * UniqueMessageIdProvider
5
+ */
6
+ declare class UniqueMessageIdProvider implements IMessageIdProvider {
7
+ /**
8
+ * UniqueMessageIdProvider constructor.
9
+ * @constructor
10
+ */
11
+ constructor ()
12
+
13
+ /**
14
+ * Allocate the first vacant messageId. The messageId become occupied status.
15
+ * @return {Number} - The first vacant messageId. If all messageIds are occupied, return null.
16
+ */
17
+ public allocate (): Number | null
18
+
19
+ /**
20
+ * Get the last allocated messageId.
21
+ * @return {Number} - messageId.
22
+ */
23
+ public getLastAllocated (): Number | null
24
+
25
+ /**
26
+ * Register the messageId. The messageId become occupied status.
27
+ * If the messageId has already been occupied, then return false.
28
+ * @param {Number} num - The messageId to request use.
29
+ * @return {Boolean} - If `num` was not occupied, then return true, otherwise return false.
30
+ */
31
+ public register (num: Number): Boolean
32
+
33
+ /**
34
+ * Deallocate the messageId. The messageId become vacant status.
35
+ * @param {Number} num - The messageId to deallocate. The messageId must be occupied status.
36
+ * In other words, the messageId must be allocated by allocate() or
37
+ * occupied by register().
38
+ */
39
+ public deallocate (num: Number): void
40
+
41
+ /**
42
+ * Clear all occupied messageIds.
43
+ * The all messageIds are set to vacant status.
44
+ */
45
+ public clear (): void
46
+ }
47
+
48
+ export { UniqueMessageIdProvider }