mqtt-plus 1.4.13 → 1.4.15
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/AGENTS.md +0 -1
- package/CHANGELOG.md +18 -0
- package/dst-stage1/mqtt-plus-api.js +1 -0
- package/dst-stage1/mqtt-plus-api.js.map +1 -0
- package/dst-stage1/mqtt-plus-auth.js +1 -0
- package/dst-stage1/mqtt-plus-auth.js.map +1 -0
- package/dst-stage1/mqtt-plus-base.js +1 -0
- package/dst-stage1/mqtt-plus-base.js.map +1 -0
- package/dst-stage1/mqtt-plus-codec.js +1 -0
- package/dst-stage1/mqtt-plus-codec.js.map +1 -0
- package/dst-stage1/mqtt-plus-encode.js +1 -0
- package/dst-stage1/mqtt-plus-encode.js.map +1 -0
- package/dst-stage1/mqtt-plus-error.js +1 -0
- package/dst-stage1/mqtt-plus-error.js.map +1 -0
- package/dst-stage1/mqtt-plus-event.js +1 -0
- package/dst-stage1/mqtt-plus-event.js.map +1 -0
- package/dst-stage1/mqtt-plus-info.js +1 -0
- package/dst-stage1/mqtt-plus-info.js.map +1 -0
- package/dst-stage1/mqtt-plus-meta.js +1 -0
- package/dst-stage1/mqtt-plus-meta.js.map +1 -0
- package/dst-stage1/mqtt-plus-msg.js +1 -0
- package/dst-stage1/mqtt-plus-msg.js.map +1 -0
- package/dst-stage1/mqtt-plus-options.js +1 -0
- package/dst-stage1/mqtt-plus-options.js.map +1 -0
- package/dst-stage1/mqtt-plus-service.js +1 -0
- package/dst-stage1/mqtt-plus-service.js.map +1 -0
- package/dst-stage1/mqtt-plus-sink.js +14 -2
- package/dst-stage1/mqtt-plus-sink.js.map +1 -0
- package/dst-stage1/mqtt-plus-source.js +27 -16
- package/dst-stage1/mqtt-plus-source.js.map +1 -0
- package/dst-stage1/mqtt-plus-subscription.js +1 -0
- package/dst-stage1/mqtt-plus-subscription.js.map +1 -0
- package/dst-stage1/mqtt-plus-timer.js +1 -0
- package/dst-stage1/mqtt-plus-timer.js.map +1 -0
- package/dst-stage1/mqtt-plus-trace.js +1 -0
- package/dst-stage1/mqtt-plus-trace.js.map +1 -0
- package/dst-stage1/mqtt-plus-util.js +1 -0
- package/dst-stage1/mqtt-plus-util.js.map +1 -0
- package/dst-stage1/mqtt-plus-version.d.ts +1 -1
- package/dst-stage1/mqtt-plus-version.js +3 -1
- package/dst-stage1/mqtt-plus-version.js.map +1 -0
- package/dst-stage1/mqtt-plus.js +1 -0
- package/dst-stage1/mqtt-plus.js.map +1 -0
- package/dst-stage2/mqtt-plus.cjs.js +1972 -2161
- package/dst-stage2/mqtt-plus.esm.js +1934 -2131
- package/dst-stage2/mqtt-plus.umd.js +13 -14
- package/etc/c8.json +16 -0
- package/etc/knip.jsonc +7 -1
- package/etc/stx.conf +36 -4
- package/etc/tsc.json +1 -1
- package/etc/vite.mts +11 -5
- package/package.d/vite+8.0.0.patch +12 -0
- package/package.json +12 -3
- package/src/mqtt-plus-sink.ts +14 -2
- package/src/mqtt-plus-source.ts +27 -16
- package/src/mqtt-plus-version.ts +2 -3
- package/tst/.c8/base.css +224 -0
- package/tst/.c8/block-navigation.js +87 -0
- package/tst/.c8/favicon.png +0 -0
- package/tst/.c8/index.html +371 -0
- package/tst/.c8/mqtt-plus-auth.ts.html +538 -0
- package/tst/.c8/mqtt-plus-base.ts.html +826 -0
- package/tst/.c8/mqtt-plus-codec.ts.html +457 -0
- package/tst/.c8/mqtt-plus-encode.ts.html +310 -0
- package/tst/.c8/mqtt-plus-error.ts.html +1186 -0
- package/tst/.c8/mqtt-plus-event.ts.html +733 -0
- package/tst/.c8/mqtt-plus-meta.ts.html +271 -0
- package/tst/.c8/mqtt-plus-msg.ts.html +1693 -0
- package/tst/.c8/mqtt-plus-options.ts.html +319 -0
- package/tst/.c8/mqtt-plus-service.ts.html +865 -0
- package/tst/.c8/mqtt-plus-sink.ts.html +1645 -0
- package/tst/.c8/mqtt-plus-source.ts.html +1585 -0
- package/tst/.c8/mqtt-plus-subscription.ts.html +706 -0
- package/tst/.c8/mqtt-plus-timer.ts.html +286 -0
- package/tst/.c8/mqtt-plus-trace.ts.html +463 -0
- package/tst/.c8/mqtt-plus-util.ts.html +823 -0
- package/tst/.c8/mqtt-plus-version.ts.html +205 -0
- package/tst/.c8/mqtt-plus.ts.html +193 -0
- package/tst/.c8/prettify.css +1 -0
- package/tst/.c8/prettify.js +2 -0
- package/tst/.c8/sort-arrow-sprite.png +0 -0
- package/tst/.c8/sorter.js +210 -0
- package/tst/.c8/tmp/coverage-6577-1773528098323-2.json +1 -0
- package/tst/.c8/tmp/coverage-6577-1773528098331-1.json +1 -0
- package/tst/.c8/tmp/coverage-6577-1773528098353-0.json +1 -0
- package/tst/.c8/tmp/coverage-6578-1773528089194-0.json +1 -0
- package/tst/mqtt-plus-2-event.spec.ts +29 -0
- package/tst/mqtt-plus-6-misc.spec.ts +79 -2
- package/tst/mqtt-plus-7-spool.spec.ts +101 -0
- package/tst/mqtt-plus-8-run.spec.ts +115 -0
- package/tst/{tsc.json → tsc.cov.json} +4 -3
- package/tst/tsc.std.json +31 -0
|
@@ -38,6 +38,7 @@ import MQTT from "mqtt"
|
|
|
38
38
|
import MQTTp from "mqtt-plus"
|
|
39
39
|
import { ctx } from "./mqtt-plus-0-fixture"
|
|
40
40
|
import type { API } from "./mqtt-plus-0-fixture"
|
|
41
|
+
import { makeMutuallyExclusiveFields } from "../src/mqtt-plus-util"
|
|
41
42
|
|
|
42
43
|
/* setup test suite infrastructure */
|
|
43
44
|
chai.config.includeStack = true
|
|
@@ -107,11 +108,41 @@ describe("MQTT+ Miscellaneous", function () {
|
|
|
107
108
|
.to.be.deep.equal([ "open", "close" ])
|
|
108
109
|
})
|
|
109
110
|
|
|
111
|
+
/* test case: JSON Codec */
|
|
112
|
+
it("MQTT+ JSON Codec", async function () {
|
|
113
|
+
/* setup */
|
|
114
|
+
this.slow(2000)
|
|
115
|
+
this.timeout(2000)
|
|
116
|
+
const spy = sinon.spy()
|
|
117
|
+
|
|
118
|
+
/* create JSON codec API instances on existing MQTT connections */
|
|
119
|
+
const apiJsonS = new MQTTp<API>(ctx.mqttS, { id: "json-server", codec: "json", timeout: 500 })
|
|
120
|
+
const apiJsonC = new MQTTp<API>(ctx.mqttC, { id: "json-client", codec: "json", timeout: 500 })
|
|
121
|
+
|
|
122
|
+
/* register event handler */
|
|
123
|
+
const registration = await apiJsonS.event("example/server/sample", (str: string, num: number) => {
|
|
124
|
+
spy("event", str, num)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
/* emit event via JSON codec */
|
|
128
|
+
apiJsonC.emit("example/server/sample", "hello", 99)
|
|
129
|
+
await new Promise((resolve) => { setTimeout(resolve, 100) })
|
|
130
|
+
|
|
131
|
+
/* verify round-trip */
|
|
132
|
+
expect(spy.getCalls().length).to.equal(1)
|
|
133
|
+
expect(spy.getCalls()[0].args).to.deep.equal([ "event", "hello", 99 ])
|
|
134
|
+
|
|
135
|
+
/* cleanup */
|
|
136
|
+
await registration.destroy()
|
|
137
|
+
apiJsonS.destroy()
|
|
138
|
+
apiJsonC.destroy()
|
|
139
|
+
})
|
|
140
|
+
|
|
110
141
|
/* test case: Authentication */
|
|
111
142
|
it("MQTT+ Authentication", async function () {
|
|
112
143
|
/* setup */
|
|
113
|
-
this.slow(
|
|
114
|
-
this.timeout(
|
|
144
|
+
this.slow(4000)
|
|
145
|
+
this.timeout(4000)
|
|
115
146
|
const spy = sinon.spy()
|
|
116
147
|
|
|
117
148
|
/* credentials */
|
|
@@ -190,5 +221,51 @@ describe("MQTT+ Miscellaneous", function () {
|
|
|
190
221
|
await registration.destroy()
|
|
191
222
|
await registration2.destroy()
|
|
192
223
|
})
|
|
224
|
+
|
|
225
|
+
/* test case: Unit: arr2buf/buf2arr */
|
|
226
|
+
it("MQTT+ Unit: arr2buf/buf2arr", function () {
|
|
227
|
+
/* create a dry-run MQTTp instance for accessing encode methods */
|
|
228
|
+
const mqttp = new MQTTp(null)
|
|
229
|
+
|
|
230
|
+
/* arr2buf with Int8Array */
|
|
231
|
+
const src = new Int8Array([ 1, -2, 3 ])
|
|
232
|
+
const buf = mqttp.arr2buf(src)
|
|
233
|
+
expect(buf).to.be.instanceOf(Uint8Array)
|
|
234
|
+
expect(buf.byteLength).to.equal(3)
|
|
235
|
+
|
|
236
|
+
/* arr2buf with Buffer */
|
|
237
|
+
const src2 = Buffer.from([ 10, 20, 30 ])
|
|
238
|
+
const buf2 = mqttp.arr2buf(src2)
|
|
239
|
+
expect(buf2).to.be.instanceOf(Uint8Array)
|
|
240
|
+
expect(buf2.byteLength).to.equal(3)
|
|
241
|
+
|
|
242
|
+
/* buf2arr with Int8Array */
|
|
243
|
+
const src3 = new Uint8Array([ 1, 2, 3 ])
|
|
244
|
+
const arr = mqttp.buf2arr(src3, Int8Array)
|
|
245
|
+
expect(arr).to.be.instanceOf(Int8Array)
|
|
246
|
+
expect(arr.byteLength).to.equal(3)
|
|
247
|
+
|
|
248
|
+
/* buf2arr with Float32Array throws */
|
|
249
|
+
const src4 = new Uint8Array([ 1, 2, 3, 4 ])
|
|
250
|
+
expect(() => mqttp.buf2arr(src4, Float32Array as any)).to.throw("invalid data type")
|
|
251
|
+
|
|
252
|
+
/* cleanup */
|
|
253
|
+
mqttp.destroy()
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
/* test case: Unit: makeMutuallyExclusiveFields */
|
|
257
|
+
it("MQTT+ Unit: makeMutuallyExclusiveFields", function () {
|
|
258
|
+
/* accessing f1 after f2 consumed throws */
|
|
259
|
+
const obj1 = { a: 1, b: 2 }
|
|
260
|
+
makeMutuallyExclusiveFields(obj1, "a", "b")
|
|
261
|
+
void obj1.b
|
|
262
|
+
expect(() => obj1.a).to.throw(/mutually exclusive/)
|
|
263
|
+
|
|
264
|
+
/* accessing f2 after f1 consumed throws */
|
|
265
|
+
const obj2 = { a: 1, b: 2 }
|
|
266
|
+
makeMutuallyExclusiveFields(obj2, "a", "b")
|
|
267
|
+
void obj2.a
|
|
268
|
+
expect(() => obj2.b).to.throw(/mutually exclusive/)
|
|
269
|
+
})
|
|
193
270
|
})
|
|
194
271
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** MQTT+ -- MQTT Communication Patterns
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
|
+
**
|
|
5
|
+
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
** a copy of this software and associated documentation files (the
|
|
7
|
+
** "Software"), to deal in the Software without restriction, including
|
|
8
|
+
** without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
** distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
** permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
** the following conditions:
|
|
12
|
+
**
|
|
13
|
+
** The above copyright notice and this permission notice shall be included
|
|
14
|
+
** in all copies or substantial portions of the Software.
|
|
15
|
+
**
|
|
16
|
+
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/* external dependencies (test suite) */
|
|
26
|
+
import { describe, it } from "mocha"
|
|
27
|
+
import * as chai from "chai"
|
|
28
|
+
|
|
29
|
+
/* internal dependencies */
|
|
30
|
+
import { Spool } from "../src/mqtt-plus-error"
|
|
31
|
+
|
|
32
|
+
/* setup test suite infrastructure */
|
|
33
|
+
chai.config.includeStack = true
|
|
34
|
+
const { expect } = chai
|
|
35
|
+
|
|
36
|
+
/* test suite */
|
|
37
|
+
describe("MQTT+ Spool", function () {
|
|
38
|
+
/* test case: Spool: unroll runs multiple async cleanups in reverse order */
|
|
39
|
+
it("MQTT+ Spool: unroll chains multiple async cleanups in reverse order", async function () {
|
|
40
|
+
const order: number[] = []
|
|
41
|
+
const spool = new Spool()
|
|
42
|
+
spool.roll(() => { order.push(1) })
|
|
43
|
+
spool.roll(() => { order.push(2) })
|
|
44
|
+
spool.roll(() => Promise.resolve().then(() => { order.push(3) }))
|
|
45
|
+
await spool.unroll()
|
|
46
|
+
expect(order).to.deep.equal([ 3, 2, 1 ])
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
/* test case: Spool: unroll with suppress swallows rejected promise */
|
|
50
|
+
it("MQTT+ Spool: unroll with suppress swallows rejected promise", async function () {
|
|
51
|
+
const spool = new Spool()
|
|
52
|
+
spool.roll(() => Promise.reject(new Error("boom")))
|
|
53
|
+
await spool.unroll()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
/* test case: Spool: unroll with suppress propagates rejected promise */
|
|
57
|
+
it("MQTT+ Spool: unroll propagates rejected promise", async function () {
|
|
58
|
+
const spool = new Spool()
|
|
59
|
+
spool.roll(() => Promise.reject(new Error("boom")))
|
|
60
|
+
try {
|
|
61
|
+
await spool.unroll(false)
|
|
62
|
+
expect.fail("should have thrown")
|
|
63
|
+
}
|
|
64
|
+
catch (err: any) {
|
|
65
|
+
expect(err.message).to.equal("boom")
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
/* test case: Spool: unroll with suppress swallows synchronous throw */
|
|
70
|
+
it("MQTT+ Spool: unroll with suppress swallows synchronous throw", function () {
|
|
71
|
+
const spool = new Spool()
|
|
72
|
+
spool.roll(() => { throw new Error("sync boom") })
|
|
73
|
+
spool.unroll()
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
/* test case: Spool: unroll re-throws synchronous error */
|
|
77
|
+
it("MQTT+ Spool: unroll re-throws synchronous error", function () {
|
|
78
|
+
const spool = new Spool()
|
|
79
|
+
spool.roll(() => { throw new Error("sync boom") })
|
|
80
|
+
try {
|
|
81
|
+
spool.unroll(false)
|
|
82
|
+
expect.fail("should have thrown")
|
|
83
|
+
}
|
|
84
|
+
catch (err: any) {
|
|
85
|
+
expect(err.message).to.equal("sync boom")
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
/* test case: Spool: sub-spool is unrolled recursively */
|
|
90
|
+
it("MQTT+ Spool: sub-spool is unrolled recursively", async function () {
|
|
91
|
+
const order: string[] = []
|
|
92
|
+
const spool = new Spool()
|
|
93
|
+
spool.roll(() => { order.push("outer-1") })
|
|
94
|
+
const sub = spool.sub()
|
|
95
|
+
sub.roll(() => { order.push("inner-1") })
|
|
96
|
+
sub.roll(() => Promise.resolve().then(() => { order.push("inner-2") }))
|
|
97
|
+
spool.roll(() => { order.push("outer-2") })
|
|
98
|
+
await spool.unroll()
|
|
99
|
+
expect(order).to.deep.equal([ "outer-2", "inner-2", "inner-1", "outer-1" ])
|
|
100
|
+
})
|
|
101
|
+
})
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** MQTT+ -- MQTT Communication Patterns
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
|
+
**
|
|
5
|
+
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
** a copy of this software and associated documentation files (the
|
|
7
|
+
** "Software"), to deal in the Software without restriction, including
|
|
8
|
+
** without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
** distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
** permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
** the following conditions:
|
|
12
|
+
**
|
|
13
|
+
** The above copyright notice and this permission notice shall be included
|
|
14
|
+
** in all copies or substantial portions of the Software.
|
|
15
|
+
**
|
|
16
|
+
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/* external dependencies (test suite) */
|
|
26
|
+
import { describe, it } from "mocha"
|
|
27
|
+
import * as chai from "chai"
|
|
28
|
+
|
|
29
|
+
/* internal dependencies */
|
|
30
|
+
import { Spool, run } from "../src/mqtt-plus-error"
|
|
31
|
+
|
|
32
|
+
/* setup test suite infrastructure */
|
|
33
|
+
chai.config.includeStack = true
|
|
34
|
+
const { expect } = chai
|
|
35
|
+
|
|
36
|
+
/* test suite */
|
|
37
|
+
describe("MQTT+ Run", function () {
|
|
38
|
+
/* test case: MQTT+ Run: sync action throws and oncatch recovers */
|
|
39
|
+
it("MQTT+ Run: sync action throws and oncatch recovers", function () {
|
|
40
|
+
const result = run(
|
|
41
|
+
() => { throw new Error("fail") },
|
|
42
|
+
(_err: Error) => "recovered"
|
|
43
|
+
)
|
|
44
|
+
expect(result).to.equal("recovered")
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
/* test case: MQTT+ Run: sync action throws and oncatch also throws */
|
|
48
|
+
it("MQTT+ Run: sync action throws and oncatch also throws", function () {
|
|
49
|
+
try {
|
|
50
|
+
run(
|
|
51
|
+
() => { throw new Error("fail") },
|
|
52
|
+
(_err: Error) => { throw new Error("oncatch-fail") }
|
|
53
|
+
)
|
|
54
|
+
expect.fail("should have thrown")
|
|
55
|
+
}
|
|
56
|
+
catch (err: any) {
|
|
57
|
+
expect(err.message).to.match(/oncatch-fail/)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
/* test case: MQTT+ Run: async action rejects and oncatch recovers */
|
|
62
|
+
it("MQTT+ Run: async action rejects and oncatch recovers", async function () {
|
|
63
|
+
const result = await run(
|
|
64
|
+
() => Promise.reject(new Error("async-fail")),
|
|
65
|
+
(_err: Error) => Promise.resolve("async-recovered")
|
|
66
|
+
)
|
|
67
|
+
expect(result).to.equal("async-recovered")
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
/* test case: MQTT+ Run: async action rejects and oncatch also throws */
|
|
71
|
+
it("MQTT+ Run: async action rejects and oncatch also throws", async function () {
|
|
72
|
+
try {
|
|
73
|
+
await run(
|
|
74
|
+
() => Promise.reject(new Error("async-fail")),
|
|
75
|
+
(_err: Error) => { throw new Error("oncatch-async-fail") }
|
|
76
|
+
)
|
|
77
|
+
expect.fail("should have thrown")
|
|
78
|
+
}
|
|
79
|
+
catch (err: any) {
|
|
80
|
+
expect(err.message).to.match(/oncatch-async-fail/)
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
/* test case: MQTT+ Run: sync success with spool and oncleanup */
|
|
85
|
+
it("MQTT+ Run: sync success with spool and oncleanup", function () {
|
|
86
|
+
const spool = new Spool()
|
|
87
|
+
const cleanups: string[] = []
|
|
88
|
+
run<string, string>(
|
|
89
|
+
spool,
|
|
90
|
+
() => "resource-val",
|
|
91
|
+
undefined,
|
|
92
|
+
undefined,
|
|
93
|
+
(val: string) => { cleanups.push(val) }
|
|
94
|
+
)
|
|
95
|
+
spool.unroll()
|
|
96
|
+
expect(cleanups).to.deep.equal([ "resource-val" ])
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
/* test case: MQTT+ Run: oncleanup without spool throws */
|
|
100
|
+
it("MQTT+ Run: oncleanup without spool throws", function () {
|
|
101
|
+
try {
|
|
102
|
+
run(
|
|
103
|
+
() => "ok",
|
|
104
|
+
undefined,
|
|
105
|
+
undefined,
|
|
106
|
+
(_val: string) => {}
|
|
107
|
+
)
|
|
108
|
+
expect.fail("should have thrown")
|
|
109
|
+
}
|
|
110
|
+
catch (err: any) {
|
|
111
|
+
expect(err.message).to.equal("oncleanup requires a spool")
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
|
|
@@ -11,14 +11,15 @@
|
|
|
11
11
|
"resolveJsonModule": false,
|
|
12
12
|
"isolatedModules": false,
|
|
13
13
|
"esModuleInterop": false,
|
|
14
|
-
"lib": [ "es2022"
|
|
14
|
+
"lib": [ "es2022" ],
|
|
15
15
|
"skipLibCheck": true,
|
|
16
16
|
"declaration": true,
|
|
17
17
|
"noEmit": true,
|
|
18
|
-
"
|
|
18
|
+
"allowImportingTsExtensions": true,
|
|
19
|
+
"rootDir": "..",
|
|
19
20
|
"baseUrl": "..",
|
|
20
21
|
"paths": {
|
|
21
|
-
"mqtt-plus":
|
|
22
|
+
"mqtt-plus": [ "src/mqtt-plus" ]
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
"include": [
|
package/tst/tsc.std.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "../dst-stage1",
|
|
4
|
+
"target": "es2022",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"useDefineForClassFields": false,
|
|
8
|
+
"composite": false,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"strictFunctionTypes": true,
|
|
11
|
+
"resolveJsonModule": false,
|
|
12
|
+
"isolatedModules": false,
|
|
13
|
+
"esModuleInterop": false,
|
|
14
|
+
"lib": [ "es2022" ],
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"declaration": true,
|
|
17
|
+
"noEmit": true,
|
|
18
|
+
"allowImportingTsExtensions": true,
|
|
19
|
+
"rootDir": "..",
|
|
20
|
+
"baseUrl": "..",
|
|
21
|
+
"paths": {
|
|
22
|
+
"mqtt-plus": [ "dst-stage1/mqtt-plus" ]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"*.ts"
|
|
27
|
+
],
|
|
28
|
+
"exclude": [
|
|
29
|
+
"../node_modules"
|
|
30
|
+
]
|
|
31
|
+
}
|