@openrobops/iso21423 0.0.0-stage → 0.1.3
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/README.md +358 -2
- package/dist/ccs-CU8XD5sl.d.cts +69 -0
- package/dist/ccs-CU8XD5sl.d.ts +69 -0
- package/dist/chunk-3JNSIJSX.js +31 -0
- package/dist/chunk-3JNSIJSX.js.map +1 -0
- package/dist/chunk-5ZIUSUHF.js +55 -0
- package/dist/chunk-5ZIUSUHF.js.map +1 -0
- package/dist/chunk-DMJ6T3RX.js +445 -0
- package/dist/chunk-DMJ6T3RX.js.map +1 -0
- package/dist/chunk-GPNR37CI.js +1915 -0
- package/dist/chunk-GPNR37CI.js.map +1 -0
- package/dist/chunk-JDO725KR.js +210 -0
- package/dist/chunk-JDO725KR.js.map +1 -0
- package/dist/chunk-JIYCTQXR.js +1 -0
- package/dist/chunk-JIYCTQXR.js.map +1 -0
- package/dist/chunk-JLUENXGS.js +48 -0
- package/dist/chunk-JLUENXGS.js.map +1 -0
- package/dist/chunk-JQAMNFAF.js +1 -0
- package/dist/chunk-JQAMNFAF.js.map +1 -0
- package/dist/chunk-LTPOAVGF.js +44 -0
- package/dist/chunk-LTPOAVGF.js.map +1 -0
- package/dist/chunk-ODBIFZN3.js +65 -0
- package/dist/chunk-ODBIFZN3.js.map +1 -0
- package/dist/chunk-OH2DOPKJ.js +107 -0
- package/dist/chunk-OH2DOPKJ.js.map +1 -0
- package/dist/chunk-QAA44UNO.js +1 -0
- package/dist/chunk-QAA44UNO.js.map +1 -0
- package/dist/chunk-RD7PYTIT.js +107 -0
- package/dist/chunk-RD7PYTIT.js.map +1 -0
- package/dist/chunk-UJC46NTA.js +13 -0
- package/dist/chunk-UJC46NTA.js.map +1 -0
- package/dist/chunk-UW6WTEPT.js +293 -0
- package/dist/chunk-UW6WTEPT.js.map +1 -0
- package/dist/chunk-W7DIDPTG.js +1 -0
- package/dist/chunk-W7DIDPTG.js.map +1 -0
- package/dist/core.cjs +2874 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +996 -0
- package/dist/core.d.ts +996 -0
- package/dist/core.js +59 -0
- package/dist/core.js.map +1 -0
- package/dist/gateway.cjs +2937 -0
- package/dist/gateway.cjs.map +1 -0
- package/dist/gateway.d.cts +165 -0
- package/dist/gateway.d.ts +165 -0
- package/dist/gateway.js +21 -0
- package/dist/gateway.js.map +1 -0
- package/dist/geometry.cjs +98 -0
- package/dist/geometry.cjs.map +1 -0
- package/dist/geometry.d.cts +38 -0
- package/dist/geometry.d.ts +38 -0
- package/dist/geometry.js +14 -0
- package/dist/geometry.js.map +1 -0
- package/dist/identity-BGr2FJmC.d.cts +258 -0
- package/dist/identity-Bw8Dik5S.d.ts +258 -0
- package/dist/index.cjs +3327 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +118 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +193 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.cjs +375 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +28 -0
- package/dist/schema.d.ts +28 -0
- package/dist/schema.js +14 -0
- package/dist/schema.js.map +1 -0
- package/dist/session-RV32MFpV.d.cts +139 -0
- package/dist/session-ueiESY7Y.d.ts +139 -0
- package/dist/session.cjs +855 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +94 -0
- package/dist/session.d.ts +94 -0
- package/dist/session.js +20 -0
- package/dist/session.js.map +1 -0
- package/dist/testing.cjs +205 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +94 -0
- package/dist/testing.d.ts +94 -0
- package/dist/testing.js +169 -0
- package/dist/testing.js.map +1 -0
- package/dist/topics-BiVeZyTW.d.cts +43 -0
- package/dist/topics-BiVeZyTW.d.ts +43 -0
- package/dist/topics.cjs +134 -0
- package/dist/topics.cjs.map +1 -0
- package/dist/topics.d.cts +41 -0
- package/dist/topics.d.ts +41 -0
- package/dist/topics.js +30 -0
- package/dist/topics.js.map +1 -0
- package/dist/transport-BT4AjTn9.d.cts +61 -0
- package/dist/transport-BT4AjTn9.d.ts +61 -0
- package/dist/types.cjs +186 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +83 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +50 -0
- package/dist/types.js.map +1 -0
- package/dist/validators-Be0ce1b8.d.cts +29 -0
- package/dist/validators-Be0ce1b8.d.ts +29 -0
- package/package.json +48 -4
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { M as MqttTransport, T as TransportConnectOptions, a as TransportMessage, C as ConnectionState } from './transport-BT4AjTn9.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2026 InOrbit, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* In-process stand-in for an MQTT broker: routes published messages to matching subscribers,
|
|
21
|
+
* stores retained messages, and can simulate a denied subscription or a dropped connection.
|
|
22
|
+
* Pairs with {@link MemoryTransport} to test the SDK without a real broker.
|
|
23
|
+
*/
|
|
24
|
+
declare class MemoryBroker {
|
|
25
|
+
private clients;
|
|
26
|
+
private retained;
|
|
27
|
+
private deniedFilters;
|
|
28
|
+
private log;
|
|
29
|
+
createTransport(): MemoryTransport;
|
|
30
|
+
/** Makes future `subscribe()` calls for exactly this filter string report `granted: false`, for testing subscription-denied paths. */
|
|
31
|
+
denySubscribe(filterPattern: string): void;
|
|
32
|
+
isDenied(filter: string): boolean;
|
|
33
|
+
/** Current retained payload for `topic`, if any — mirrors what a newly-subscribing client would receive. */
|
|
34
|
+
retainedOn(topic: string): Buffer | undefined;
|
|
35
|
+
/** All messages ever routed to exactly `topic`, in publish order (test assertion helper). */
|
|
36
|
+
messagesOn(topic: string): TransportMessage[];
|
|
37
|
+
/** Every logged message whose topic starts with `prefix` (test convenience). */
|
|
38
|
+
messagesUnder(prefix: string): TransportMessage[];
|
|
39
|
+
/** Logs `msg`, updates the retained-message store (empty payload clears it), and delivers it to every connected client. */
|
|
40
|
+
route(msg: TransportMessage): void;
|
|
41
|
+
/** Asynchronously (next tick) delivers every retained message matching `filter` to `to`, mimicking a real broker's SUBSCRIBE-time redelivery. */
|
|
42
|
+
deliverRetained(to: MemoryTransport, filter: string): void;
|
|
43
|
+
/** Routes a client's LWT if the disconnect was ungraceful and a will was armed; a graceful `end()` never fires the will. */
|
|
44
|
+
disconnected(t: MemoryTransport, ungraceful: boolean): void;
|
|
45
|
+
/** Every live subscription across all clients — for lazy-subscribe and QoS assertions. */
|
|
46
|
+
subscriptions(): Array<{
|
|
47
|
+
clientId: string;
|
|
48
|
+
filter: string;
|
|
49
|
+
qos: 0 | 1 | 2;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
/** {@link MqttTransport} implementation backed by a {@link MemoryBroker}, for broker-free tests. */
|
|
53
|
+
declare class MemoryTransport implements MqttTransport {
|
|
54
|
+
private readonly broker;
|
|
55
|
+
will: TransportConnectOptions['will'];
|
|
56
|
+
clientId: string;
|
|
57
|
+
private subs;
|
|
58
|
+
private messageCbs;
|
|
59
|
+
private stateCbs;
|
|
60
|
+
private connected;
|
|
61
|
+
private reconnectTimer;
|
|
62
|
+
constructor(broker: MemoryBroker);
|
|
63
|
+
connect(opts: TransportConnectOptions): Promise<void>;
|
|
64
|
+
publish(topic: string, payload: string | Buffer, opts: {
|
|
65
|
+
qos: 0 | 1 | 2;
|
|
66
|
+
retain: boolean;
|
|
67
|
+
}): Promise<void>;
|
|
68
|
+
/** Subscribes (unless the broker has denied this filter) and triggers retained-message redelivery for it. */
|
|
69
|
+
subscribe(filter: string, opts: {
|
|
70
|
+
qos: 0 | 1 | 2;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
granted: boolean;
|
|
73
|
+
}>;
|
|
74
|
+
unsubscribe(filter: string): Promise<void>;
|
|
75
|
+
subscriptions(): ReadonlyArray<{
|
|
76
|
+
filter: string;
|
|
77
|
+
qos: 0 | 1 | 2;
|
|
78
|
+
}>;
|
|
79
|
+
onMessage(cb: (m: TransportMessage) => void): void;
|
|
80
|
+
onConnectionState(cb: (s: ConnectionState) => void): void;
|
|
81
|
+
/**
|
|
82
|
+
* Delivers `msg` to this client's message callbacks if it's currently connected and either
|
|
83
|
+
* `viaFilter` is given (a targeted retained redelivery, always delivered) or the topic matches
|
|
84
|
+
* one of this client's live subscriptions. Isolates each callback's exceptions so one bad
|
|
85
|
+
* handler can't break delivery to the others.
|
|
86
|
+
*/
|
|
87
|
+
deliver(msg: TransportMessage, viaFilter?: string): void;
|
|
88
|
+
/** Simulate ungraceful TCP loss: will fires, then auto-reconnect. */
|
|
89
|
+
dropConnection(): void;
|
|
90
|
+
end(): Promise<void>;
|
|
91
|
+
private emitState;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { MemoryBroker, MemoryTransport };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { M as MqttTransport, T as TransportConnectOptions, a as TransportMessage, C as ConnectionState } from './transport-BT4AjTn9.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2026 InOrbit, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* In-process stand-in for an MQTT broker: routes published messages to matching subscribers,
|
|
21
|
+
* stores retained messages, and can simulate a denied subscription or a dropped connection.
|
|
22
|
+
* Pairs with {@link MemoryTransport} to test the SDK without a real broker.
|
|
23
|
+
*/
|
|
24
|
+
declare class MemoryBroker {
|
|
25
|
+
private clients;
|
|
26
|
+
private retained;
|
|
27
|
+
private deniedFilters;
|
|
28
|
+
private log;
|
|
29
|
+
createTransport(): MemoryTransport;
|
|
30
|
+
/** Makes future `subscribe()` calls for exactly this filter string report `granted: false`, for testing subscription-denied paths. */
|
|
31
|
+
denySubscribe(filterPattern: string): void;
|
|
32
|
+
isDenied(filter: string): boolean;
|
|
33
|
+
/** Current retained payload for `topic`, if any — mirrors what a newly-subscribing client would receive. */
|
|
34
|
+
retainedOn(topic: string): Buffer | undefined;
|
|
35
|
+
/** All messages ever routed to exactly `topic`, in publish order (test assertion helper). */
|
|
36
|
+
messagesOn(topic: string): TransportMessage[];
|
|
37
|
+
/** Every logged message whose topic starts with `prefix` (test convenience). */
|
|
38
|
+
messagesUnder(prefix: string): TransportMessage[];
|
|
39
|
+
/** Logs `msg`, updates the retained-message store (empty payload clears it), and delivers it to every connected client. */
|
|
40
|
+
route(msg: TransportMessage): void;
|
|
41
|
+
/** Asynchronously (next tick) delivers every retained message matching `filter` to `to`, mimicking a real broker's SUBSCRIBE-time redelivery. */
|
|
42
|
+
deliverRetained(to: MemoryTransport, filter: string): void;
|
|
43
|
+
/** Routes a client's LWT if the disconnect was ungraceful and a will was armed; a graceful `end()` never fires the will. */
|
|
44
|
+
disconnected(t: MemoryTransport, ungraceful: boolean): void;
|
|
45
|
+
/** Every live subscription across all clients — for lazy-subscribe and QoS assertions. */
|
|
46
|
+
subscriptions(): Array<{
|
|
47
|
+
clientId: string;
|
|
48
|
+
filter: string;
|
|
49
|
+
qos: 0 | 1 | 2;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
/** {@link MqttTransport} implementation backed by a {@link MemoryBroker}, for broker-free tests. */
|
|
53
|
+
declare class MemoryTransport implements MqttTransport {
|
|
54
|
+
private readonly broker;
|
|
55
|
+
will: TransportConnectOptions['will'];
|
|
56
|
+
clientId: string;
|
|
57
|
+
private subs;
|
|
58
|
+
private messageCbs;
|
|
59
|
+
private stateCbs;
|
|
60
|
+
private connected;
|
|
61
|
+
private reconnectTimer;
|
|
62
|
+
constructor(broker: MemoryBroker);
|
|
63
|
+
connect(opts: TransportConnectOptions): Promise<void>;
|
|
64
|
+
publish(topic: string, payload: string | Buffer, opts: {
|
|
65
|
+
qos: 0 | 1 | 2;
|
|
66
|
+
retain: boolean;
|
|
67
|
+
}): Promise<void>;
|
|
68
|
+
/** Subscribes (unless the broker has denied this filter) and triggers retained-message redelivery for it. */
|
|
69
|
+
subscribe(filter: string, opts: {
|
|
70
|
+
qos: 0 | 1 | 2;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
granted: boolean;
|
|
73
|
+
}>;
|
|
74
|
+
unsubscribe(filter: string): Promise<void>;
|
|
75
|
+
subscriptions(): ReadonlyArray<{
|
|
76
|
+
filter: string;
|
|
77
|
+
qos: 0 | 1 | 2;
|
|
78
|
+
}>;
|
|
79
|
+
onMessage(cb: (m: TransportMessage) => void): void;
|
|
80
|
+
onConnectionState(cb: (s: ConnectionState) => void): void;
|
|
81
|
+
/**
|
|
82
|
+
* Delivers `msg` to this client's message callbacks if it's currently connected and either
|
|
83
|
+
* `viaFilter` is given (a targeted retained redelivery, always delivered) or the topic matches
|
|
84
|
+
* one of this client's live subscriptions. Isolates each callback's exceptions so one bad
|
|
85
|
+
* handler can't break delivery to the others.
|
|
86
|
+
*/
|
|
87
|
+
deliver(msg: TransportMessage, viaFilter?: string): void;
|
|
88
|
+
/** Simulate ungraceful TCP loss: will fires, then auto-reconnect. */
|
|
89
|
+
dropConnection(): void;
|
|
90
|
+
end(): Promise<void>;
|
|
91
|
+
private emitState;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { MemoryBroker, MemoryTransport };
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import {
|
|
2
|
+
topicFilterMatches
|
|
3
|
+
} from "./chunk-5ZIUSUHF.js";
|
|
4
|
+
import "./chunk-RD7PYTIT.js";
|
|
5
|
+
|
|
6
|
+
// src/testing/memoryTransport.ts
|
|
7
|
+
var MemoryBroker = class {
|
|
8
|
+
clients = /* @__PURE__ */ new Set();
|
|
9
|
+
retained = /* @__PURE__ */ new Map();
|
|
10
|
+
deniedFilters = [];
|
|
11
|
+
log = [];
|
|
12
|
+
createTransport() {
|
|
13
|
+
const t = new MemoryTransport(this);
|
|
14
|
+
this.clients.add(t);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
/** Makes future `subscribe()` calls for exactly this filter string report `granted: false`, for testing subscription-denied paths. */
|
|
18
|
+
denySubscribe(filterPattern) {
|
|
19
|
+
this.deniedFilters.push(filterPattern);
|
|
20
|
+
}
|
|
21
|
+
isDenied(filter) {
|
|
22
|
+
return this.deniedFilters.includes(filter);
|
|
23
|
+
}
|
|
24
|
+
/** Current retained payload for `topic`, if any — mirrors what a newly-subscribing client would receive. */
|
|
25
|
+
retainedOn(topic) {
|
|
26
|
+
return this.retained.get(topic)?.payload;
|
|
27
|
+
}
|
|
28
|
+
/** All messages ever routed to exactly `topic`, in publish order (test assertion helper). */
|
|
29
|
+
messagesOn(topic) {
|
|
30
|
+
return this.log.filter((m) => m.topic === topic);
|
|
31
|
+
}
|
|
32
|
+
/** Every logged message whose topic starts with `prefix` (test convenience). */
|
|
33
|
+
messagesUnder(prefix) {
|
|
34
|
+
return this.log.filter((m) => m.topic.startsWith(prefix));
|
|
35
|
+
}
|
|
36
|
+
/** Logs `msg`, updates the retained-message store (empty payload clears it), and delivers it to every connected client. */
|
|
37
|
+
route(msg) {
|
|
38
|
+
this.log.push(msg);
|
|
39
|
+
if (msg.retain) {
|
|
40
|
+
if (msg.payload.length === 0) this.retained.delete(msg.topic);
|
|
41
|
+
else this.retained.set(msg.topic, msg);
|
|
42
|
+
}
|
|
43
|
+
for (const c of this.clients) {
|
|
44
|
+
c.deliver(msg);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Asynchronously (next tick) delivers every retained message matching `filter` to `to`, mimicking a real broker's SUBSCRIBE-time redelivery. */
|
|
48
|
+
deliverRetained(to, filter) {
|
|
49
|
+
for (const msg of this.retained.values()) {
|
|
50
|
+
if (topicFilterMatches(filter, msg.topic)) {
|
|
51
|
+
setImmediate(() => to.deliver(msg, filter));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Routes a client's LWT if the disconnect was ungraceful and a will was armed; a graceful `end()` never fires the will. */
|
|
56
|
+
disconnected(t, ungraceful) {
|
|
57
|
+
if (ungraceful && t.will) {
|
|
58
|
+
this.route({
|
|
59
|
+
topic: t.will.topic,
|
|
60
|
+
payload: Buffer.from(t.will.payload),
|
|
61
|
+
qos: t.will.qos,
|
|
62
|
+
retain: t.will.retain
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Every live subscription across all clients — for lazy-subscribe and QoS assertions. */
|
|
67
|
+
subscriptions() {
|
|
68
|
+
return [...this.clients].flatMap((c) => c.subscriptions().map((s) => ({ clientId: c.clientId, ...s })));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var MemoryTransport = class {
|
|
72
|
+
constructor(broker) {
|
|
73
|
+
this.broker = broker;
|
|
74
|
+
}
|
|
75
|
+
broker;
|
|
76
|
+
will;
|
|
77
|
+
clientId = "";
|
|
78
|
+
subs = [];
|
|
79
|
+
messageCbs = [];
|
|
80
|
+
stateCbs = [];
|
|
81
|
+
connected = false;
|
|
82
|
+
reconnectTimer = null;
|
|
83
|
+
async connect(opts) {
|
|
84
|
+
this.will = opts.will;
|
|
85
|
+
this.clientId = opts.clientId;
|
|
86
|
+
this.connected = true;
|
|
87
|
+
this.emitState("connected");
|
|
88
|
+
}
|
|
89
|
+
async publish(topic, payload, opts) {
|
|
90
|
+
this.broker.route({
|
|
91
|
+
topic,
|
|
92
|
+
payload: Buffer.isBuffer(payload) ? payload : Buffer.from(payload),
|
|
93
|
+
qos: opts.qos,
|
|
94
|
+
retain: opts.retain
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/** Subscribes (unless the broker has denied this filter) and triggers retained-message redelivery for it. */
|
|
98
|
+
async subscribe(filter, opts) {
|
|
99
|
+
if (this.broker.isDenied(filter)) return { granted: false };
|
|
100
|
+
if (!this.subs.some((s) => s.filter === filter && s.qos === opts.qos)) {
|
|
101
|
+
this.subs.push({ filter, qos: opts.qos });
|
|
102
|
+
}
|
|
103
|
+
this.broker.deliverRetained(this, filter);
|
|
104
|
+
return { granted: true };
|
|
105
|
+
}
|
|
106
|
+
async unsubscribe(filter) {
|
|
107
|
+
this.subs = this.subs.filter((s) => s.filter !== filter);
|
|
108
|
+
}
|
|
109
|
+
subscriptions() {
|
|
110
|
+
return [...this.subs];
|
|
111
|
+
}
|
|
112
|
+
onMessage(cb) {
|
|
113
|
+
this.messageCbs.push(cb);
|
|
114
|
+
}
|
|
115
|
+
onConnectionState(cb) {
|
|
116
|
+
this.stateCbs.push(cb);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Delivers `msg` to this client's message callbacks if it's currently connected and either
|
|
120
|
+
* `viaFilter` is given (a targeted retained redelivery, always delivered) or the topic matches
|
|
121
|
+
* one of this client's live subscriptions. Isolates each callback's exceptions so one bad
|
|
122
|
+
* handler can't break delivery to the others.
|
|
123
|
+
*/
|
|
124
|
+
deliver(msg, viaFilter) {
|
|
125
|
+
if (!this.connected) return;
|
|
126
|
+
const matched = viaFilter !== void 0 || this.subs.some((s) => topicFilterMatches(s.filter, msg.topic));
|
|
127
|
+
if (matched) {
|
|
128
|
+
for (const cb of this.messageCbs) {
|
|
129
|
+
try {
|
|
130
|
+
cb(msg);
|
|
131
|
+
} catch (err) {
|
|
132
|
+
console.error("[MemoryTransport] subscriber callback threw:", err);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Simulate ungraceful TCP loss: will fires, then auto-reconnect. */
|
|
138
|
+
dropConnection() {
|
|
139
|
+
this.connected = false;
|
|
140
|
+
if (this.reconnectTimer) clearImmediate(this.reconnectTimer);
|
|
141
|
+
this.emitState("reconnecting");
|
|
142
|
+
this.broker.disconnected(this, true);
|
|
143
|
+
this.reconnectTimer = setImmediate(() => {
|
|
144
|
+
this.reconnectTimer = null;
|
|
145
|
+
this.connected = true;
|
|
146
|
+
this.emitState("connected");
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
async end() {
|
|
150
|
+
if (this.reconnectTimer) clearImmediate(this.reconnectTimer);
|
|
151
|
+
this.connected = false;
|
|
152
|
+
this.broker.disconnected(this, false);
|
|
153
|
+
this.emitState("closed");
|
|
154
|
+
}
|
|
155
|
+
emitState(s) {
|
|
156
|
+
for (const cb of this.stateCbs) {
|
|
157
|
+
try {
|
|
158
|
+
cb(s);
|
|
159
|
+
} catch (err) {
|
|
160
|
+
console.error("[MemoryTransport] subscriber callback threw:", err);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
export {
|
|
166
|
+
MemoryBroker,
|
|
167
|
+
MemoryTransport
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/testing/memoryTransport.ts"],"sourcesContent":["/**\n * Copyright 2026 InOrbit, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n MqttTransport, TransportConnectOptions, TransportMessage, ConnectionState,\n} from '../session/transport.js';\nimport { topicFilterMatches } from '../topics/topics.js';\n\ninterface Sub { filter: string; qos: 0 | 1 | 2 }\n\n/**\n * In-process stand-in for an MQTT broker: routes published messages to matching subscribers,\n * stores retained messages, and can simulate a denied subscription or a dropped connection.\n * Pairs with {@link MemoryTransport} to test the SDK without a real broker.\n */\nexport class MemoryBroker {\n private clients = new Set<MemoryTransport>();\n private retained = new Map<string, TransportMessage>();\n private deniedFilters: string[] = [];\n private log: TransportMessage[] = [];\n\n createTransport(): MemoryTransport {\n const t = new MemoryTransport(this);\n this.clients.add(t);\n return t;\n }\n\n /** Makes future `subscribe()` calls for exactly this filter string report `granted: false`, for testing subscription-denied paths. */\n denySubscribe(filterPattern: string): void {\n this.deniedFilters.push(filterPattern);\n }\n\n isDenied(filter: string): boolean {\n // ponytail: exact-filter match only; make wildcard-aware if a test ever needs prefix denial\n return this.deniedFilters.includes(filter);\n }\n\n /** Current retained payload for `topic`, if any — mirrors what a newly-subscribing client would receive. */\n retainedOn(topic: string): Buffer | undefined {\n return this.retained.get(topic)?.payload;\n }\n\n /** All messages ever routed to exactly `topic`, in publish order (test assertion helper). */\n messagesOn(topic: string): TransportMessage[] {\n return this.log.filter((m) => m.topic === topic);\n }\n\n /** Every logged message whose topic starts with `prefix` (test convenience). */\n messagesUnder(prefix: string): TransportMessage[] {\n return this.log.filter((m) => m.topic.startsWith(prefix));\n }\n\n /** Logs `msg`, updates the retained-message store (empty payload clears it), and delivers it to every connected client. */\n route(msg: TransportMessage): void {\n this.log.push(msg);\n if (msg.retain) {\n if (msg.payload.length === 0) this.retained.delete(msg.topic);\n else this.retained.set(msg.topic, msg);\n }\n for (const c of this.clients) {\n c.deliver(msg); // deliver() isolates callback exceptions internally, never throws\n }\n }\n\n /** Asynchronously (next tick) delivers every retained message matching `filter` to `to`, mimicking a real broker's SUBSCRIBE-time redelivery. */\n deliverRetained(to: MemoryTransport, filter: string): void {\n for (const msg of this.retained.values()) {\n if (topicFilterMatches(filter, msg.topic)) {\n setImmediate(() => to.deliver(msg, filter));\n }\n }\n }\n\n /** Routes a client's LWT if the disconnect was ungraceful and a will was armed; a graceful `end()` never fires the will. */\n disconnected(t: MemoryTransport, ungraceful: boolean): void {\n if (ungraceful && t.will) {\n this.route({\n topic: t.will.topic,\n payload: Buffer.from(t.will.payload),\n qos: t.will.qos,\n retain: t.will.retain,\n });\n }\n }\n\n /** Every live subscription across all clients — for lazy-subscribe and QoS assertions. */\n subscriptions(): Array<{ clientId: string; filter: string; qos: 0 | 1 | 2 }> {\n return [...this.clients].flatMap((c) =>\n c.subscriptions().map((s) => ({ clientId: c.clientId, ...s })));\n }\n}\n\n/** {@link MqttTransport} implementation backed by a {@link MemoryBroker}, for broker-free tests. */\nexport class MemoryTransport implements MqttTransport {\n will: TransportConnectOptions['will'];\n clientId = '';\n private subs: Sub[] = [];\n private messageCbs: Array<(m: TransportMessage) => void> = [];\n private stateCbs: Array<(s: ConnectionState) => void> = [];\n private connected = false;\n private reconnectTimer: NodeJS.Immediate | null = null;\n\n constructor(private readonly broker: MemoryBroker) {}\n\n async connect(opts: TransportConnectOptions): Promise<void> {\n this.will = opts.will;\n this.clientId = opts.clientId;\n this.connected = true;\n this.emitState('connected');\n }\n\n async publish(topic: string, payload: string | Buffer, opts: { qos: 0 | 1 | 2; retain: boolean }): Promise<void> {\n this.broker.route({\n topic,\n payload: Buffer.isBuffer(payload) ? payload : Buffer.from(payload),\n qos: opts.qos,\n retain: opts.retain,\n });\n }\n\n /** Subscribes (unless the broker has denied this filter) and triggers retained-message redelivery for it. */\n async subscribe(filter: string, opts: { qos: 0 | 1 | 2 }): Promise<{ granted: boolean }> {\n if (this.broker.isDenied(filter)) return { granted: false };\n // Re-subscribing the same (filter, qos) pair replaces the entry, as on a real broker.\n if (!this.subs.some((s) => s.filter === filter && s.qos === opts.qos)) {\n this.subs.push({ filter, qos: opts.qos });\n }\n this.broker.deliverRetained(this, filter);\n return { granted: true };\n }\n\n async unsubscribe(filter: string): Promise<void> {\n this.subs = this.subs.filter((s) => s.filter !== filter);\n }\n\n subscriptions(): ReadonlyArray<{ filter: string; qos: 0 | 1 | 2 }> {\n return [...this.subs];\n }\n\n onMessage(cb: (m: TransportMessage) => void): void {\n this.messageCbs.push(cb);\n }\n\n onConnectionState(cb: (s: ConnectionState) => void): void {\n this.stateCbs.push(cb);\n }\n\n /**\n * Delivers `msg` to this client's message callbacks if it's currently connected and either\n * `viaFilter` is given (a targeted retained redelivery, always delivered) or the topic matches\n * one of this client's live subscriptions. Isolates each callback's exceptions so one bad\n * handler can't break delivery to the others.\n */\n deliver(msg: TransportMessage, viaFilter?: string): void {\n if (!this.connected) return;\n const matched = viaFilter !== undefined\n || this.subs.some((s) => topicFilterMatches(s.filter, msg.topic));\n if (matched) {\n for (const cb of this.messageCbs) {\n try {\n cb(msg);\n } catch (err) {\n console.error('[MemoryTransport] subscriber callback threw:', err);\n }\n }\n }\n }\n\n /** Simulate ungraceful TCP loss: will fires, then auto-reconnect. */\n dropConnection(): void {\n this.connected = false;\n if (this.reconnectTimer) clearImmediate(this.reconnectTimer);\n this.emitState('reconnecting');\n this.broker.disconnected(this, true);\n this.reconnectTimer = setImmediate(() => {\n this.reconnectTimer = null;\n this.connected = true;\n this.emitState('connected');\n });\n }\n\n async end(): Promise<void> {\n if (this.reconnectTimer) clearImmediate(this.reconnectTimer);\n this.connected = false;\n this.broker.disconnected(this, false);\n this.emitState('closed');\n }\n\n private emitState(s: ConnectionState): void {\n for (const cb of this.stateCbs) {\n try {\n cb(s);\n } catch (err) {\n console.error('[MemoryTransport] subscriber callback threw:', err);\n }\n }\n }\n}\n"],"mappings":";;;;;;AA4BO,IAAM,eAAN,MAAmB;AAAA,EAChB,UAAU,oBAAI,IAAqB;AAAA,EACnC,WAAW,oBAAI,IAA8B;AAAA,EAC7C,gBAA0B,CAAC;AAAA,EAC3B,MAA0B,CAAC;AAAA,EAEnC,kBAAmC;AACjC,UAAM,IAAI,IAAI,gBAAgB,IAAI;AAClC,SAAK,QAAQ,IAAI,CAAC;AAClB,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,cAAc,eAA6B;AACzC,SAAK,cAAc,KAAK,aAAa;AAAA,EACvC;AAAA,EAEA,SAAS,QAAyB;AAEhC,WAAO,KAAK,cAAc,SAAS,MAAM;AAAA,EAC3C;AAAA;AAAA,EAGA,WAAW,OAAmC;AAC5C,WAAO,KAAK,SAAS,IAAI,KAAK,GAAG;AAAA,EACnC;AAAA;AAAA,EAGA,WAAW,OAAmC;AAC5C,WAAO,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,UAAU,KAAK;AAAA,EACjD;AAAA;AAAA,EAGA,cAAc,QAAoC;AAChD,WAAO,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,MAAM,WAAW,MAAM,CAAC;AAAA,EAC1D;AAAA;AAAA,EAGA,MAAM,KAA6B;AACjC,SAAK,IAAI,KAAK,GAAG;AACjB,QAAI,IAAI,QAAQ;AACd,UAAI,IAAI,QAAQ,WAAW,EAAG,MAAK,SAAS,OAAO,IAAI,KAAK;AAAA,UACvD,MAAK,SAAS,IAAI,IAAI,OAAO,GAAG;AAAA,IACvC;AACA,eAAW,KAAK,KAAK,SAAS;AAC5B,QAAE,QAAQ,GAAG;AAAA,IACf;AAAA,EACF;AAAA;AAAA,EAGA,gBAAgB,IAAqB,QAAsB;AACzD,eAAW,OAAO,KAAK,SAA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,YAAY;AACjB,WAAK,UAAU,WAAW;AAAA,IAC5B,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAqB;AACzB,QAAI,KAAK,eAAgB,gBAAe,KAAK,cAAc;AAC3D,SAAK,YAAY;AACjB,SAAK,OAAO,aAAa,MAAM,KAAK;AACpC,SAAK,UAAU,QAAQ;AAAA,EACzB;AAAA,EAEQ,UAAU,GAA0B;AAC1C,eAAW,MAAM,KAAK,UAAU;AAC9B,UAAI;AACF,WAAG,CAAC;AAAA,MACN,SAAS,KAAK;AACZ,gBAAQ,MAAM,gDAAgD,GAAG;AAAA,MACnE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 InOrbit, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/** Identifies an entity for topic-building purposes: its ISO type ("IMR"/"IMRFM") and its uuid. */
|
|
17
|
+
interface EntityRef {
|
|
18
|
+
entityType: string;
|
|
19
|
+
entityUuid: string;
|
|
20
|
+
}
|
|
21
|
+
/** Decomposed form of an ISO 21423 topic string, as produced by {@link parseTopic}. */
|
|
22
|
+
interface ParsedTopic {
|
|
23
|
+
entityType: string;
|
|
24
|
+
entityUuid: string;
|
|
25
|
+
resource: string;
|
|
26
|
+
requestUuid?: string;
|
|
27
|
+
isRequestStatus: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare function topicFor(ref: EntityRef, resource: string): string;
|
|
30
|
+
declare function requestTopic(ref: EntityRef, requestUuid: string): string;
|
|
31
|
+
declare function requestStatusTopic(ref: EntityRef, requestUuid: string): string;
|
|
32
|
+
declare function disconnectionTopic(ref: EntityRef): string;
|
|
33
|
+
/** MQTT wildcard subscription matching every entity's identity topic, used to build the fleet-wide entity cache. */
|
|
34
|
+
declare function identityWildcard(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Splits a concrete topic string into its parts, or returns `null` if it doesn't
|
|
37
|
+
* live under {@link ROOT_NAMESPACE} or has an unrecognized shape (e.g. extra path segments).
|
|
38
|
+
*/
|
|
39
|
+
declare function parseTopic(topic: string): ParsedTopic | null;
|
|
40
|
+
/** MQTT 3.1.1 topic filter matching (+ single level, # multi level). */
|
|
41
|
+
declare function topicFilterMatches(filter: string, topic: string): boolean;
|
|
42
|
+
|
|
43
|
+
export { type EntityRef as E, type ParsedTopic as P, requestTopic as a, topicFor as b, disconnectionTopic as d, identityWildcard as i, parseTopic as p, requestStatusTopic as r, topicFilterMatches as t };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 InOrbit, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/** Identifies an entity for topic-building purposes: its ISO type ("IMR"/"IMRFM") and its uuid. */
|
|
17
|
+
interface EntityRef {
|
|
18
|
+
entityType: string;
|
|
19
|
+
entityUuid: string;
|
|
20
|
+
}
|
|
21
|
+
/** Decomposed form of an ISO 21423 topic string, as produced by {@link parseTopic}. */
|
|
22
|
+
interface ParsedTopic {
|
|
23
|
+
entityType: string;
|
|
24
|
+
entityUuid: string;
|
|
25
|
+
resource: string;
|
|
26
|
+
requestUuid?: string;
|
|
27
|
+
isRequestStatus: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare function topicFor(ref: EntityRef, resource: string): string;
|
|
30
|
+
declare function requestTopic(ref: EntityRef, requestUuid: string): string;
|
|
31
|
+
declare function requestStatusTopic(ref: EntityRef, requestUuid: string): string;
|
|
32
|
+
declare function disconnectionTopic(ref: EntityRef): string;
|
|
33
|
+
/** MQTT wildcard subscription matching every entity's identity topic, used to build the fleet-wide entity cache. */
|
|
34
|
+
declare function identityWildcard(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Splits a concrete topic string into its parts, or returns `null` if it doesn't
|
|
37
|
+
* live under {@link ROOT_NAMESPACE} or has an unrecognized shape (e.g. extra path segments).
|
|
38
|
+
*/
|
|
39
|
+
declare function parseTopic(topic: string): ParsedTopic | null;
|
|
40
|
+
/** MQTT 3.1.1 topic filter matching (+ single level, # multi level). */
|
|
41
|
+
declare function topicFilterMatches(filter: string, topic: string): boolean;
|
|
42
|
+
|
|
43
|
+
export { type EntityRef as E, type ParsedTopic as P, requestTopic as a, topicFor as b, disconnectionTopic as d, identityWildcard as i, parseTopic as p, requestStatusTopic as r, topicFilterMatches as t };
|
package/dist/topics.cjs
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/topics/index.ts
|
|
21
|
+
var topics_exports = {};
|
|
22
|
+
__export(topics_exports, {
|
|
23
|
+
RESOURCE_CONFIG: () => RESOURCE_CONFIG,
|
|
24
|
+
disconnectionTopic: () => disconnectionTopic,
|
|
25
|
+
identityWildcard: () => identityWildcard,
|
|
26
|
+
isStandardResource: () => isStandardResource,
|
|
27
|
+
parseTopic: () => parseTopic,
|
|
28
|
+
registerExtensionResource: () => registerExtensionResource,
|
|
29
|
+
requestStatusTopic: () => requestStatusTopic,
|
|
30
|
+
requestTopic: () => requestTopic,
|
|
31
|
+
topicFilterMatches: () => topicFilterMatches,
|
|
32
|
+
topicFor: () => topicFor
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(topics_exports);
|
|
35
|
+
|
|
36
|
+
// src/types/constants.ts
|
|
37
|
+
var ROOT_NAMESPACE = "/ISO_21423/v1";
|
|
38
|
+
|
|
39
|
+
// src/topics/topics.ts
|
|
40
|
+
function topicFor(ref, resource) {
|
|
41
|
+
return `${ROOT_NAMESPACE}/${ref.entityType}/${ref.entityUuid}/${resource}`;
|
|
42
|
+
}
|
|
43
|
+
function requestTopic(ref, requestUuid) {
|
|
44
|
+
return `${topicFor(ref, "request")}/${requestUuid}`;
|
|
45
|
+
}
|
|
46
|
+
function requestStatusTopic(ref, requestUuid) {
|
|
47
|
+
return `${requestTopic(ref, requestUuid)}/status`;
|
|
48
|
+
}
|
|
49
|
+
function disconnectionTopic(ref) {
|
|
50
|
+
return topicFor(ref, "disconnection");
|
|
51
|
+
}
|
|
52
|
+
function identityWildcard() {
|
|
53
|
+
return `${ROOT_NAMESPACE}/+/+/identity`;
|
|
54
|
+
}
|
|
55
|
+
function parseTopic(topic) {
|
|
56
|
+
if (!topic.startsWith(`${ROOT_NAMESPACE}/`)) return null;
|
|
57
|
+
const rest = topic.slice(ROOT_NAMESPACE.length + 1).split("/");
|
|
58
|
+
const [entityType, entityUuid, resource, ...tail] = rest;
|
|
59
|
+
if (!entityType || !entityUuid || !resource) return null;
|
|
60
|
+
if (resource === "request" && tail.length >= 1) {
|
|
61
|
+
const [requestUuid, maybeStatus] = tail;
|
|
62
|
+
if (!requestUuid || maybeStatus !== void 0 && maybeStatus !== "status" || tail.length > 2) return null;
|
|
63
|
+
return { entityType, entityUuid, resource, requestUuid, isRequestStatus: maybeStatus === "status" };
|
|
64
|
+
}
|
|
65
|
+
if (tail.length > 0) return null;
|
|
66
|
+
return { entityType, entityUuid, resource, isRequestStatus: false };
|
|
67
|
+
}
|
|
68
|
+
function topicFilterMatches(filter, topic) {
|
|
69
|
+
const f = filter.split("/");
|
|
70
|
+
const t = topic.split("/");
|
|
71
|
+
for (let i = 0; i < f.length; i++) {
|
|
72
|
+
const seg = f[i];
|
|
73
|
+
if (seg === "#") return true;
|
|
74
|
+
if (i >= t.length) return false;
|
|
75
|
+
if (seg !== "+" && seg !== t[i]) return false;
|
|
76
|
+
}
|
|
77
|
+
return f.length === t.length;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/errors.ts
|
|
81
|
+
var Iso21423Error = class extends Error {
|
|
82
|
+
constructor(message) {
|
|
83
|
+
super(message);
|
|
84
|
+
this.name = new.target.name;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/topics/resources.ts
|
|
89
|
+
var RESOURCE_CONFIG = {
|
|
90
|
+
identity: { qos: 1, retain: true },
|
|
91
|
+
status: { qos: 1, retain: true },
|
|
92
|
+
batteryStatus: { qos: 0, retain: true },
|
|
93
|
+
footprint: { qos: 1, retain: true },
|
|
94
|
+
odometry: { qos: 0, retain: false, minHz: 0.5, maxHz: 30 },
|
|
95
|
+
localTrajectory: { qos: 0, retain: false, minHz: 1, maxHz: 10 },
|
|
96
|
+
globalPath: { qos: 1, retain: true },
|
|
97
|
+
globalPlan: { qos: 1, retain: true },
|
|
98
|
+
request: { qos: 2, retain: true },
|
|
99
|
+
requestStatus: { qos: 2, retain: true },
|
|
100
|
+
activeRequestsStatus: { qos: 1, retain: true },
|
|
101
|
+
disconnection: { qos: 1, retain: true }
|
|
102
|
+
// B.4 LWT parameters
|
|
103
|
+
};
|
|
104
|
+
var STANDARD_RESOURCES = new Set(Object.keys(RESOURCE_CONFIG));
|
|
105
|
+
function isStandardResource(name) {
|
|
106
|
+
return STANDARD_RESOURCES.has(name);
|
|
107
|
+
}
|
|
108
|
+
function registerExtensionResource(name, config) {
|
|
109
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(name)) {
|
|
110
|
+
throw new Iso21423Error(`invalid extension resource name "${name}"`);
|
|
111
|
+
}
|
|
112
|
+
if (STANDARD_RESOURCES.has(name)) {
|
|
113
|
+
throw new Iso21423Error(`"${name}" is a standard ISO 21423 resource and cannot be redefined`);
|
|
114
|
+
}
|
|
115
|
+
const existing = RESOURCE_CONFIG[name];
|
|
116
|
+
if (existing && (existing.qos !== config.qos || existing.retain !== config.retain || existing.minHz !== config.minHz || existing.maxHz !== config.maxHz)) {
|
|
117
|
+
throw new Iso21423Error(`extension resource "${name}" is already registered with a different config`);
|
|
118
|
+
}
|
|
119
|
+
RESOURCE_CONFIG[name] = { ...config };
|
|
120
|
+
}
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
123
|
+
RESOURCE_CONFIG,
|
|
124
|
+
disconnectionTopic,
|
|
125
|
+
identityWildcard,
|
|
126
|
+
isStandardResource,
|
|
127
|
+
parseTopic,
|
|
128
|
+
registerExtensionResource,
|
|
129
|
+
requestStatusTopic,
|
|
130
|
+
requestTopic,
|
|
131
|
+
topicFilterMatches,
|
|
132
|
+
topicFor
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=topics.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/topics/index.ts","../src/types/constants.ts","../src/topics/topics.ts","../src/errors.ts","../src/topics/resources.ts"],"sourcesContent":["/**\n * Copyright 2026 InOrbit, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './topics.js';\nexport * from './resources.js';\n","/**\n * Copyright 2026 InOrbit, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ROOT_NAMESPACE = '/ISO_21423/v1';\nexport const PROTOCOL_VERSION = '1.0';\n\nexport const ENTITY_TYPES = ['IMR', 'IMRFM'] as const;\nexport type KnownEntityType = (typeof ENTITY_TYPES)[number];\n/** Widened to allow vendor-defined entity types beyond the two the spec names, while still autocompleting the known ones. */\nexport type EntityType = KnownEntityType | (string & {});\n\n/** All operating states the spec defines: stop categories, motion states, and MODE_* (mutually-exclusive mode markers) mixed together. */\nexport const KNOWN_OPERATING_STATES = [\n 'STOP_CATEGORY_0', 'STOP_CATEGORY_1', 'STOP_CATEGORY_2',\n 'PAUSED', 'WAIT_FOR_RESET', 'MAPPING', 'LOST',\n 'WAIT_FOR_ATTACHMENT', 'WAIT_FOR_EVENT', 'BLOCKED', 'ATTACHMENT_ACTIVE',\n 'STOPPED', 'DOCKING', 'SLOWING', 'ACCELERATING',\n 'LEFT_TURN', 'RIGHT_TURN', 'REVERSE', 'FORWARD', 'LINE_FOLLOWING',\n 'CHARGING', 'LOW_BATTERY', 'IDLE', 'PARKED', 'OFFLINE',\n 'READY', 'NOT_READY',\n 'MODE_AUTO', 'MODE_SEMIAUTO', 'MODE_TELEOP', 'MODE_MANUAL', 'MODE_MAINTENANCE',\n] as const;\nexport type KnownOperatingState = (typeof KNOWN_OPERATING_STATES)[number];\nexport type OperatingState = KnownOperatingState | (string & {});\n\n/** Subset of {@link KNOWN_OPERATING_STATES} that are the mutually-exclusive MODE_* markers. */\nexport const OPERATING_MODES = [\n 'MODE_AUTO', 'MODE_SEMIAUTO', 'MODE_TELEOP', 'MODE_MANUAL', 'MODE_MAINTENANCE',\n] as const;\n\n/** LWT state published by the broker on ungraceful disconnect (B.4). */\nexport const LOST_CONNECTION_STATE = 'LOST_CONNECTION';\n\n/** Overall lifecycle states for a whole {@link Request} (its `RECOVERY` state has no per-detail equivalent — see {@link DetailState}). */\nexport const REQUEST_STATES = [\n 'RECEIVED', 'ACCEPTED', 'EXECUTING', 'CANCELED', 'SUCCEEDED', 'ABORTED', 'RECOVERY',\n] as const;\nexport type RequestState = (typeof REQUEST_STATES)[number];\n\n/** Lifecycle states for a single detail/action within a request. */\nexport const DETAIL_STATES = [\n 'RECEIVED', 'ACCEPTED', 'EXECUTING', 'CANCELED', 'SUCCEEDED', 'ABORTED',\n] as const;\nexport type DetailState = (typeof DETAIL_STATES)[number];\n\nexport const KNOWN_REASON_CODES = [\n 'OK', 'GENERAL_FAILURE', 'TIMEOUT', 'VERSION_NOT_SUPPORTED', 'FORMAT_NOT_SUPPORTED',\n 'ACTION_NOT_IMPLEMENTED', 'REJECTED', 'MALFORMED_REQUEST', 'INVALID_IMR_STATE_FOR_ACTION',\n] as const;\nexport type ReasonCode = (typeof KNOWN_REASON_CODES)[number] | (string & {});\n\nexport const BATTERY_HEALTH = [\n 'UNKNOWN', 'HEALTHY', 'OVERHEAT', 'DEAD', 'OVERVOLTAGE', 'FAILURE', 'COLD',\n] as const;\nexport type BatteryHealth = (typeof BATTERY_HEALTH)[number] | (string & {});\n\n/** Charging state as distinct from {@link BatteryHealth} — this is about current/direction of charge flow, not battery condition. */\nexport const CHARGING_STATES = [\n 'UNKNOWN', 'CHARGING', 'DISCHARGING', 'NOT_CHARGING', 'FULL',\n] as const;\nexport type ChargingState = (typeof CHARGING_STATES)[number] | (string & {});\n\nexport const DOCK_ACTIONS = ['CHARGE', 'DUMP', 'FILL', 'LOAD', 'UNLOAD', 'PICK', 'DROP'] as const;\nexport type DockAction = (typeof DOCK_ACTIONS)[number] | (string & {});\n","/**\n * Copyright 2026 InOrbit, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ROOT_NAMESPACE } from '../types/constants.js';\n\n/** Identifies an entity for topic-building purposes: its ISO type (\"IMR\"/\"IMRFM\") and its uuid. */\nexport interface EntityRef { entityType: string; entityUuid: string }\n\n/** Decomposed form of an ISO 21423 topic string, as produced by {@link parseTopic}. */\nexport interface ParsedTopic {\n entityType: string;\n entityUuid: string;\n resource: string;\n requestUuid?: string;\n isRequestStatus: boolean;\n}\n\nexport function topicFor(ref: EntityRef, resource: string): string {\n return `${ROOT_NAMESPACE}/${ref.entityType}/${ref.entityUuid}/${resource}`;\n}\n\nexport function requestTopic(ref: EntityRef, requestUuid: string): string {\n return `${topicFor(ref, 'request')}/${requestUuid}`;\n}\n\nexport function requestStatusTopic(ref: EntityRef, requestUuid: string): string {\n return `${requestTopic(ref, requestUuid)}/status`;\n}\n\nexport function disconnectionTopic(ref: EntityRef): string {\n return topicFor(ref, 'disconnection');\n}\n\n/** MQTT wildcard subscription matching every entity's identity topic, used to build the fleet-wide entity cache. */\nexport function identityWildcard(): string {\n return `${ROOT_NAMESPACE}/+/+/identity`;\n}\n\n/**\n * Splits a concrete topic string into its parts, or returns `null` if it doesn't\n * live under {@link ROOT_NAMESPACE} or has an unrecognized shape (e.g. extra path segments).\n */\nexport function parseTopic(topic: string): ParsedTopic | null {\n if (!topic.startsWith(`${ROOT_NAMESPACE}/`)) return null;\n const rest = topic.slice(ROOT_NAMESPACE.length + 1).split('/');\n const [entityType, entityUuid, resource, ...tail] = rest;\n if (!entityType || !entityUuid || !resource) return null;\n if (resource === 'request' && tail.length >= 1) {\n const [requestUuid, maybeStatus] = tail;\n if (!requestUuid || (maybeStatus !== undefined && maybeStatus !== 'status') || tail.length > 2) return null;\n return { entityType, entityUuid, resource, requestUuid, isRequestStatus: maybeStatus === 'status' };\n }\n if (tail.length > 0) return null;\n return { entityType, entityUuid, resource, isRequestStatus: false };\n}\n\n/** MQTT 3.1.1 topic filter matching (+ single level, # multi level). */\nexport function topicFilterMatches(filter: string, topic: string): boolean {\n const f = filter.split('/');\n const t = topic.split('/');\n for (let i = 0; i < f.length; i++) {\n const seg = f[i];\n if (seg === '#') return true;\n if (i >= t.length) return false;\n if (seg !== '+' && seg !== t[i]) return false;\n }\n return f.length === t.length;\n}\n","/**\n * Copyright 2026 InOrbit, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** Base class for all errors this SDK throws; `name` is set to the concrete subclass name so it survives serialization. */\nexport class Iso21423Error extends Error {\n constructor(message: string) {\n super(message);\n this.name = new.target.name;\n }\n}\n\n/** Thrown when a payload fails ISO 21423 JSON Schema validation; `errors` holds the raw Ajv error list. */\nexport class ValidationError extends Iso21423Error {\n constructor(message: string, public readonly errors: unknown[]) {\n super(message);\n }\n}\n\n/** Thrown when a request/detail reaches a terminal failure state; `finalStatus` carries the last status received. */\nexport class RequestFailed extends Iso21423Error {\n constructor(message: string, public readonly finalStatus: unknown) {\n super(message);\n }\n}\n\nexport class RequestTimeout extends Iso21423Error {}\nexport class BrokerUnavailable extends Iso21423Error {}\n\n/** Thrown when a broker/ACL rejects a publish or subscribe; `topic` names the topic that was denied. */\nexport class AuthorizationDenied extends Iso21423Error {\n constructor(message: string, public readonly topic: string) {\n super(message);\n }\n}\n\nexport class NotCapableError extends Iso21423Error {}\n/** Thrown by {@link Lifecycle.transition} when the requested state change isn't allowed from the current state. */\nexport class IllegalTransition extends Iso21423Error {}\n","/**\n * Copyright 2026 InOrbit, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Iso21423Error } from '../errors.js';\n\n/** Normative publish settings for a resource; `minHz`/`maxHz` bound the allowed publish rate where the spec constrains it. */\nexport interface ResourceConfig { qos: 0 | 1 | 2; retain: boolean; minHz?: number; maxHz?: number }\n\n/** Table B.1 — resources and their normative QoS / retain / rate configuration. */\nexport const RESOURCE_CONFIG: Record<string, ResourceConfig> = {\n identity: { qos: 1, retain: true },\n status: { qos: 1, retain: true },\n batteryStatus: { qos: 0, retain: true },\n footprint: { qos: 1, retain: true },\n odometry: { qos: 0, retain: false, minHz: 0.5, maxHz: 30 },\n localTrajectory: { qos: 0, retain: false, minHz: 1, maxHz: 10 },\n globalPath: { qos: 1, retain: true },\n globalPlan: { qos: 1, retain: true },\n request: { qos: 2, retain: true },\n requestStatus: { qos: 2, retain: true },\n activeRequestsStatus: { qos: 1, retain: true },\n disconnection: { qos: 1, retain: true }, // B.4 LWT parameters\n};\n\nconst STANDARD_RESOURCES: ReadonlySet<string> = new Set(Object.keys(RESOURCE_CONFIG));\n\n/** True for the resources Table B.1 defines; false for deployment-defined extension resources. */\nexport function isStandardResource(name: string): boolean {\n return STANDARD_RESOURCES.has(name);\n}\n\n/**\n * Registers a deployment-defined resource (ISO 21423 leaves the resource catalog open — see the\n * standard's extension clause) so entities can publish it via `EntityHandle.publishExtension` and\n * clients can `subscribeResource` to it. Extension resources carry no schema: subscribers receive\n * the raw payload text, exactly like `footprint`.\n *\n * Process-wide (the resource table is a module singleton): both ends of a deployment must\n * register the same name with the same config. Re-registering with an identical config is a\n * no-op; a different config throws, as does a name that collides with a standard resource.\n */\nexport function registerExtensionResource(name: string, config: ResourceConfig): void {\n if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(name)) {\n throw new Iso21423Error(`invalid extension resource name \"${name}\"`);\n }\n if (STANDARD_RESOURCES.has(name)) {\n throw new Iso21423Error(`\"${name}\" is a standard ISO 21423 resource and cannot be redefined`);\n }\n const existing = RESOURCE_CONFIG[name];\n if (existing && (existing.qos !== config.qos || existing.retain !== config.retain\n || existing.minHz !== config.minHz || existing.maxHz !== config.maxHz)) {\n throw new Iso21423Error(`extension resource \"${name}\" is already registered with a different config`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