@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.
Files changed (100) hide show
  1. package/README.md +358 -2
  2. package/dist/ccs-CU8XD5sl.d.cts +69 -0
  3. package/dist/ccs-CU8XD5sl.d.ts +69 -0
  4. package/dist/chunk-3JNSIJSX.js +31 -0
  5. package/dist/chunk-3JNSIJSX.js.map +1 -0
  6. package/dist/chunk-5ZIUSUHF.js +55 -0
  7. package/dist/chunk-5ZIUSUHF.js.map +1 -0
  8. package/dist/chunk-DMJ6T3RX.js +445 -0
  9. package/dist/chunk-DMJ6T3RX.js.map +1 -0
  10. package/dist/chunk-GPNR37CI.js +1915 -0
  11. package/dist/chunk-GPNR37CI.js.map +1 -0
  12. package/dist/chunk-JDO725KR.js +210 -0
  13. package/dist/chunk-JDO725KR.js.map +1 -0
  14. package/dist/chunk-JIYCTQXR.js +1 -0
  15. package/dist/chunk-JIYCTQXR.js.map +1 -0
  16. package/dist/chunk-JLUENXGS.js +48 -0
  17. package/dist/chunk-JLUENXGS.js.map +1 -0
  18. package/dist/chunk-JQAMNFAF.js +1 -0
  19. package/dist/chunk-JQAMNFAF.js.map +1 -0
  20. package/dist/chunk-LTPOAVGF.js +44 -0
  21. package/dist/chunk-LTPOAVGF.js.map +1 -0
  22. package/dist/chunk-ODBIFZN3.js +65 -0
  23. package/dist/chunk-ODBIFZN3.js.map +1 -0
  24. package/dist/chunk-OH2DOPKJ.js +107 -0
  25. package/dist/chunk-OH2DOPKJ.js.map +1 -0
  26. package/dist/chunk-QAA44UNO.js +1 -0
  27. package/dist/chunk-QAA44UNO.js.map +1 -0
  28. package/dist/chunk-RD7PYTIT.js +107 -0
  29. package/dist/chunk-RD7PYTIT.js.map +1 -0
  30. package/dist/chunk-UJC46NTA.js +13 -0
  31. package/dist/chunk-UJC46NTA.js.map +1 -0
  32. package/dist/chunk-UW6WTEPT.js +293 -0
  33. package/dist/chunk-UW6WTEPT.js.map +1 -0
  34. package/dist/chunk-W7DIDPTG.js +1 -0
  35. package/dist/chunk-W7DIDPTG.js.map +1 -0
  36. package/dist/core.cjs +2874 -0
  37. package/dist/core.cjs.map +1 -0
  38. package/dist/core.d.cts +996 -0
  39. package/dist/core.d.ts +996 -0
  40. package/dist/core.js +59 -0
  41. package/dist/core.js.map +1 -0
  42. package/dist/gateway.cjs +2937 -0
  43. package/dist/gateway.cjs.map +1 -0
  44. package/dist/gateway.d.cts +165 -0
  45. package/dist/gateway.d.ts +165 -0
  46. package/dist/gateway.js +21 -0
  47. package/dist/gateway.js.map +1 -0
  48. package/dist/geometry.cjs +98 -0
  49. package/dist/geometry.cjs.map +1 -0
  50. package/dist/geometry.d.cts +38 -0
  51. package/dist/geometry.d.ts +38 -0
  52. package/dist/geometry.js +14 -0
  53. package/dist/geometry.js.map +1 -0
  54. package/dist/identity-BGr2FJmC.d.cts +258 -0
  55. package/dist/identity-Bw8Dik5S.d.ts +258 -0
  56. package/dist/index.cjs +3327 -0
  57. package/dist/index.cjs.map +1 -0
  58. package/dist/index.d.cts +118 -0
  59. package/dist/index.d.ts +118 -0
  60. package/dist/index.js +193 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/schema.cjs +375 -0
  63. package/dist/schema.cjs.map +1 -0
  64. package/dist/schema.d.cts +28 -0
  65. package/dist/schema.d.ts +28 -0
  66. package/dist/schema.js +14 -0
  67. package/dist/schema.js.map +1 -0
  68. package/dist/session-RV32MFpV.d.cts +139 -0
  69. package/dist/session-ueiESY7Y.d.ts +139 -0
  70. package/dist/session.cjs +855 -0
  71. package/dist/session.cjs.map +1 -0
  72. package/dist/session.d.cts +94 -0
  73. package/dist/session.d.ts +94 -0
  74. package/dist/session.js +20 -0
  75. package/dist/session.js.map +1 -0
  76. package/dist/testing.cjs +205 -0
  77. package/dist/testing.cjs.map +1 -0
  78. package/dist/testing.d.cts +94 -0
  79. package/dist/testing.d.ts +94 -0
  80. package/dist/testing.js +169 -0
  81. package/dist/testing.js.map +1 -0
  82. package/dist/topics-BiVeZyTW.d.cts +43 -0
  83. package/dist/topics-BiVeZyTW.d.ts +43 -0
  84. package/dist/topics.cjs +134 -0
  85. package/dist/topics.cjs.map +1 -0
  86. package/dist/topics.d.cts +41 -0
  87. package/dist/topics.d.ts +41 -0
  88. package/dist/topics.js +30 -0
  89. package/dist/topics.js.map +1 -0
  90. package/dist/transport-BT4AjTn9.d.cts +61 -0
  91. package/dist/transport-BT4AjTn9.d.ts +61 -0
  92. package/dist/types.cjs +186 -0
  93. package/dist/types.cjs.map +1 -0
  94. package/dist/types.d.cts +83 -0
  95. package/dist/types.d.ts +83 -0
  96. package/dist/types.js +50 -0
  97. package/dist/types.js.map +1 -0
  98. package/dist/validators-Be0ce1b8.d.cts +29 -0
  99. package/dist/validators-Be0ce1b8.d.ts +29 -0
  100. package/package.json +48 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/gateway/janitor.ts","../src/gateway/fleetGateway.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 { Iso21423Session } from '../session/session.js';\n\n/**\n * ND-10: the sender clears its own retained request at terminal state. The gateway additionally\n * clears requests in its own namespaces that are still retained a grace period after the terminal\n * status it published — protection against crashed senders. Clearing an already-cleared topic is a\n * harmless no-op, so no \"is it still retained?\" probe is needed.\n */\nexport class RetainedRequestJanitor {\n private readonly timers = new Set<ReturnType<typeof setTimeout>>();\n\n constructor(\n private readonly session: Iso21423Session,\n private readonly graceMs: number,\n private readonly onCleared: (topic: string) => void,\n ) {}\n\n /** Schedules `requestTopic` to be force-cleared after the grace period; the clear itself is idempotent, so overlapping/duplicate `note()` calls are harmless. */\n note(requestTopic: string): void {\n const timer = setTimeout(() => {\n this.timers.delete(timer);\n void this.session.clearRetained(requestTopic).then(() => this.onCleared(requestTopic))\n // Idempotent retry: the next note() (or the sender's own ND-10 clear) will catch it up,\n // so a failed clear here is silently swallowed rather than an unhandled rejection.\n .catch(() => {});\n }, this.graceMs);\n timer.unref?.();\n this.timers.add(timer);\n }\n\n dispose(): void {\n for (const t of this.timers) clearTimeout(t);\n this.timers.clear();\n }\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\nimport type { MqttTransport } from '../session/transport.js';\nimport type { Uuid } from '../types/common.js';\nimport type { Request } from '../types/requests.js';\nimport { Iso21423Error } from '../errors.js';\nimport { Iso21423Client } from '../core/client.js';\nimport { EntityHandle } from '../core/entityHandle.js';\nimport type { ActionExecutor } from '../core/executor.js';\nimport type { DispatchTarget } from '../core/requestServer.js';\nimport type { ActionHandler, ExecutionPolicy, SecurityOptions } from '../core/types.js';\nimport type { SequenceStore } from '../core/sequence.js';\nimport { publishSelfCheck } from './selfCheck.js';\nimport { RetainedRequestJanitor } from './janitor.js';\n\nconst DEFAULT_JANITOR_GRACE_MS = 30_000;\n\n/** Options for {@link FleetGateway.connect}. */\nexport interface FleetGatewayOptions {\n transport?: MqttTransport;\n url?: string;\n security?: SecurityOptions;\n imrfm: {\n id: Uuid;\n manufacturerName: string;\n details?: Record<string, unknown>;\n accepts?: string[];\n provides?: string[];\n };\n janitor?: { enabled?: boolean; graceMs?: number };\n validateOutbound?: boolean;\n sequenceStore?: SequenceStore | null;\n requestTimeoutMs?: number;\n}\n\n/** Options for {@link FleetGateway.registerImr}. */\nexport interface ImrRegistration {\n id: Uuid;\n identity?: Record<string, unknown>;\n manufacturerName?: string;\n accepts?: string[];\n provides?: string[];\n executionPolicy?: ExecutionPolicy;\n}\n\n/**\n * Fleet-wide facade (ISO 21423 IMRFM role): owns one `Iso21423Client`, the IMRFM's own\n * `EntityHandle`, and every managed IMR's handle. Adds three things on top of `/core`: fleet-wide\n * `onRequest` handlers replayed onto current/future robots (controller ruling R6), the\n * empty-destination dispatch callback (ND-12), and a retained-request janitor + publish\n * self-check that both default ON (ND-10, ND-15).\n */\nexport class FleetGateway {\n private readonly imrHandles = new Map<Uuid, EntityHandle>();\n // Provenance tracking for R6: the core-level ActionExecutor only knows \"a handler for this type\n // exists or not\" — it has no notion of \"fleet-wide\" vs \"per-imr\" scope. These two maps let the\n // gateway apply its own override rule (same-scope re-registration needs override:true; a\n // per-imr registration shadowing a fleet-wide one never does) while always calling the\n // underlying `EntityHandle.onRequest` with `override: true` so the core-level guard never trips\n // on the gateway's own layering.\n private readonly fleetHandlers = new Map<string, ActionHandler>();\n private readonly perImrHandlerTypes = new Set<string>();\n private janitor?: RetainedRequestJanitor;\n private dispatchCb?: (request: Request, imrs: EntityHandle[]) => Uuid | null;\n\n private constructor(\n readonly client: Iso21423Client,\n readonly imrfm: EntityHandle,\n private readonly selfCheckEnabled: boolean,\n private readonly selfCheckTimeoutMs: number | undefined,\n ) {}\n\n /**\n * Connects the underlying client, registers the IMRFM's own identity (arming its Last Will,\n * decision 1), runs the gateway's own publish self-check (default on, ND-15) unless\n * `security.selfCheck` is false, and — unless `janitor.enabled` is false — starts the\n * retained-request janitor and wires the empty-destination dispatch interceptor (ND-12).\n */\n static async connect(opts: FleetGatewayOptions): Promise<FleetGateway> {\n const client = await Iso21423Client.connect({\n transport: opts.transport,\n url: opts.url,\n // Deliberately NOT forwarding security.selfCheck/selfCheckTimeoutMs: the gateway runs its\n // own self-check below (default ON) instead of the client's own (default OFF) — running\n // both would just double the identity-echo round trip.\n security: opts.security && {\n username: opts.security.username, password: opts.security.password, tls: opts.security.tls,\n },\n validateOutbound: opts.validateOutbound,\n sequenceStore: opts.sequenceStore,\n requestTimeoutMs: opts.requestTimeoutMs,\n });\n\n // First operation on the client (decision 1): arms the B.4 Last Will.\n const imrfm = await client.registerSelfEntity({\n entityUuid: opts.imrfm.id,\n entityType: 'IMRFM',\n manufacturerName: opts.imrfm.manufacturerName,\n details: opts.imrfm.details,\n capabilities: { provides: opts.imrfm.provides ?? [], accepts: opts.imrfm.accepts ?? [] },\n });\n\n const gateway = new FleetGateway(\n client, imrfm, opts.security?.selfCheck !== false, opts.security?.selfCheckTimeoutMs);\n\n if (gateway.selfCheckEnabled) {\n await publishSelfCheck(imrfm.ctx.session, imrfm.ctx.ref, gateway.selfCheckTimeoutMs);\n }\n\n if (opts.janitor?.enabled !== false) {\n const graceMs = opts.janitor?.graceMs ?? DEFAULT_JANITOR_GRACE_MS;\n gateway.janitor = new RetainedRequestJanitor(\n imrfm.ctx.session, graceMs,\n (topic) => imrfm.ctx.diagnostic('janitor-cleared', { topic }));\n await imrfm.onRequestSettled((topic) => gateway.janitor!.note(topic));\n }\n\n await imrfm.setDispatchInterceptor((request) => gateway.resolveDispatch(request));\n // ND-12: a dispatched request runs in the target robot's executor, not the IMRFM's own — a\n // cancelRequest for it must be resolvable there too (controller ruling).\n await imrfm.setManagedExecutorsHook(() => gateway.imrs()\n .map((h) => h.dispatchTarget()?.executor)\n .filter((e): e is ActionExecutor => e !== undefined));\n\n return gateway;\n }\n\n /**\n * Registers a new managed IMR under this IMRFM: creates its `EntityHandle`, wires it into the\n * janitor, replays every fleet-wide `onRequest` handler onto it, and (if the gateway's self-check\n * is enabled) publishes a self-check for it. On self-check failure, rolls back the local\n * bookkeeping (handle map and the manager's `manages` list) before rethrowing — nothing is\n * retained on the broker to undo, since a denied publish never lands there (ND-15).\n */\n async registerImr(reg: ImrRegistration): Promise<EntityHandle> {\n const handle = await this.client.registerManagedEntity(this.imrfm.entityUuid, {\n entityUuid: reg.id,\n entityType: 'IMR',\n manufacturerName: reg.manufacturerName ?? this.imrfm.identity().manufacturerName,\n details: reg.identity,\n capabilities: { accepts: reg.accepts ?? [], provides: reg.provides ?? [] },\n executionPolicy: reg.executionPolicy,\n });\n\n if (this.janitor) await handle.onRequestSettled((topic) => this.janitor!.note(topic));\n\n for (const [type, handler] of this.fleetHandlers) handle.onRequest(type, handler, { override: true });\n\n this.imrHandles.set(reg.id, handle);\n\n if (this.selfCheckEnabled) {\n try {\n await publishSelfCheck(handle.ctx.session, handle.ctx.ref, this.selfCheckTimeoutMs);\n } catch (err) {\n // Rollback (best-effort, local only): nothing is retained on the broker to clean up — a\n // denied publish never lands there in the first place (that's the whole point of ND-15)\n // — so undoing our own bookkeeping (the handle list and the manager's manages array) is\n // all there is to do before rethrowing.\n this.imrHandles.delete(reg.id);\n this.client.removeManagedEntity(this.imrfm.entityUuid, reg.id);\n const identity = this.imrfm.identity();\n const manages = (identity.capabilities.manages ?? []).filter((uuid) => uuid !== reg.id);\n await this.imrfm.updateIdentity({ capabilities: { ...identity.capabilities, manages } });\n throw err;\n }\n }\n\n return handle;\n }\n\n /** Unregisters and removes a managed IMR (no-op if unknown), and drops it from the IMRFM's `manages` list. */\n async unregisterImr(id: Uuid): Promise<void> {\n const handle = this.imrHandles.get(id);\n if (!handle) return;\n await handle.unregister();\n this.imrHandles.delete(id);\n const identity = this.imrfm.identity();\n const manages = (identity.capabilities.manages ?? []).filter((uuid) => uuid !== id);\n await this.imrfm.updateIdentity({ capabilities: { ...identity.capabilities, manages } });\n }\n\n imrs(): EntityHandle[] {\n return [...this.imrHandles.values()];\n }\n\n /**\n * Registers an action handler either fleet-wide (default: applied to every current and future\n * IMR, R6) or scoped to one `imr`, where it shadows a fleet-wide handler for the same type.\n * Re-registering the same scope for the same type throws unless `override: true` is passed.\n */\n onRequest<P = Record<string, unknown>>(\n type: string, handler: ActionHandler<P>, opts?: { imr?: Uuid; override?: true },\n ): void {\n const asHandler = handler as ActionHandler;\n if (opts?.imr) {\n const handle = this.imrHandles.get(opts.imr);\n if (!handle) throw new Iso21423Error(`FleetGateway.onRequest: unknown imr \"${opts.imr}\"`);\n const key = `${opts.imr}:${type}`;\n if (this.perImrHandlerTypes.has(key) && !opts.override) {\n throw new Iso21423Error(\n `FleetGateway.onRequest: a per-imr handler for \"${type}\" on \"${opts.imr}\" is already ` +\n `registered — pass { override: true } to replace it`);\n }\n this.perImrHandlerTypes.add(key);\n // Always override at the core level: this may be shadowing a fleet-wide handler already\n // registered on this same handle (R6) — the gateway's own provenance check above is the\n // real guard against a genuine same-scope duplicate registration.\n handle.onRequest(type, asHandler, { override: true });\n return;\n }\n if (this.fleetHandlers.has(type) && !opts?.override) {\n throw new Iso21423Error(\n `FleetGateway.onRequest: a fleet-wide handler for \"${type}\" is already registered — ` +\n `pass { override: true } to replace it`);\n }\n this.fleetHandlers.set(type, asHandler);\n this.imrfm.onRequest(type, asHandler, { override: true });\n // Registration order matters: this replay always uses override:true, so a fleet-wide\n // registration made AFTER a per-imr override for the same type replaces that override on\n // every current robot (a later per-imr call would still win back on that one robot).\n for (const handle of this.imrHandles.values()) handle.onRequest(type, asHandler, { override: true });\n }\n\n /** Sets the callback used to pick a target IMR for a request with an empty `destination` (ND-12); return `null` to decline dispatch. */\n onDispatch(cb: (request: Request, imrs: EntityHandle[]) => Uuid | null): void {\n this.dispatchCb = cb;\n }\n\n /** Graceful shutdown: managed handles are NOT unregistered — a fleet restart should not erase\n * the fleet's retained state; call `unregisterImr` explicitly for that. */\n async close(opts?: { timeout?: number }): Promise<void> {\n this.janitor?.dispose();\n await this.client.close(opts);\n }\n\n /** Invokes the `onDispatch` callback (if set) and resolves its chosen uuid to a live IMR's dispatch target. */\n private resolveDispatch(request: Request): DispatchTarget | null {\n if (!this.dispatchCb) return null;\n const uuid = this.dispatchCb(request, this.imrs());\n if (!uuid) return null;\n const handle = this.imrHandles.get(uuid);\n return handle?.dispatchTarget() ?? null;\n }\n}\n"],"mappings":";;;;;;;;;AAwBO,IAAM,yBAAN,MAA6B;AAAA,EAGlC,YACmB,SACA,SACA,WACjB;AAHiB;AACA;AACA;AAAA,EAChB;AAAA,EAHgB;AAAA,EACA;AAAA,EACA;AAAA,EALF,SAAS,oBAAI,IAAmC;AAAA;AAAA,EASjE,KAAK,cAA4B;AAC/B,UAAM,QAAQ,WAAW,MAAM;AAC7B,WAAK,OAAO,OAAO,KAAK;AACxB,WAAK,KAAK,QAAQ,cAAc,YAAY,EAAE,KAAK,MAAM,KAAK,UAAU,YAAY,CAAC,EAGlF,MAAM,MAAM;AAAA,MAAC,CAAC;AAAA,IACnB,GAAG,KAAK,OAAO;AACf,UAAM,QAAQ;AACd,SAAK,OAAO,IAAI,KAAK;AAAA,EACvB;AAAA,EAEA,UAAgB;AACd,eAAW,KAAK,KAAK,OAAQ,cAAa,CAAC;AAC3C,SAAK,OAAO,MAAM;AAAA,EACpB;AACF;;;ACrBA,IAAM,2BAA2B;AAqC1B,IAAM,eAAN,MAAM,cAAa;AAAA,EAahB,YACG,QACA,OACQ,kBACA,oBACjB;AAJS;AACA;AACQ;AACA;AAAA,EAChB;AAAA,EAJQ;AAAA,EACA;AAAA,EACQ;AAAA,EACA;AAAA,EAhBF,aAAa,oBAAI,IAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzC,gBAAgB,oBAAI,IAA2B;AAAA,EAC/C,qBAAqB,oBAAI,IAAY;AAAA,EAC9C;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeR,aAAa,QAAQ,MAAkD;AACrE,UAAM,SAAS,MAAM,eAAe,QAAQ;AAAA,MAC1C,WAAW,KAAK;AAAA,MAChB,KAAK,KAAK;AAAA;AAAA;AAAA;AAAA,MAIV,UAAU,KAAK,YAAY;AAAA,QACzB,UAAU,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,MAAM,MAAM,MAA4C;AACtD,SAAK,SAAS,QAAQ;AACtB,UAAM,KAAK,OAAO,MAAM,IAAI;AAAA,EAC9B;AAAA;AAAA,EAGQ,gBAAgB,SAAyC;AAC/D,QAAI,CAAC,KAAK,WAAY,QAAO;AAC7B,UAAM,OAAO,KAAK,WAAW,SAAS,KAAK,KAAK,CAAC;AACjD,QAAI,CAAC,KAAM,QAAO;AAClB,UAAM,SAAS,KAAK,WAAW,IAAI,IAAI;AACvC,WAAO,QAAQ,eAAe,KAAK;AAAA,EACrC;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-JIYCTQXR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,48 @@
1
+ // src/errors.ts
2
+ var Iso21423Error = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = new.target.name;
6
+ }
7
+ };
8
+ var ValidationError = class extends Iso21423Error {
9
+ constructor(message, errors) {
10
+ super(message);
11
+ this.errors = errors;
12
+ }
13
+ errors;
14
+ };
15
+ var RequestFailed = class extends Iso21423Error {
16
+ constructor(message, finalStatus) {
17
+ super(message);
18
+ this.finalStatus = finalStatus;
19
+ }
20
+ finalStatus;
21
+ };
22
+ var RequestTimeout = class extends Iso21423Error {
23
+ };
24
+ var BrokerUnavailable = class extends Iso21423Error {
25
+ };
26
+ var AuthorizationDenied = class extends Iso21423Error {
27
+ constructor(message, topic) {
28
+ super(message);
29
+ this.topic = topic;
30
+ }
31
+ topic;
32
+ };
33
+ var NotCapableError = class extends Iso21423Error {
34
+ };
35
+ var IllegalTransition = class extends Iso21423Error {
36
+ };
37
+
38
+ export {
39
+ Iso21423Error,
40
+ ValidationError,
41
+ RequestFailed,
42
+ RequestTimeout,
43
+ BrokerUnavailable,
44
+ AuthorizationDenied,
45
+ NotCapableError,
46
+ IllegalTransition
47
+ };
48
+ //# sourceMappingURL=chunk-JLUENXGS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.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\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"],"mappings":";AAiBO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO,WAAW;AAAA,EACzB;AACF;AAGO,IAAM,kBAAN,cAA8B,cAAc;AAAA,EACjD,YAAY,SAAiC,QAAmB;AAC9D,UAAM,OAAO;AAD8B;AAAA,EAE7C;AAAA,EAF6C;AAG/C;AAGO,IAAM,gBAAN,cAA4B,cAAc;AAAA,EAC/C,YAAY,SAAiC,aAAsB;AACjE,UAAM,OAAO;AAD8B;AAAA,EAE7C;AAAA,EAF6C;AAG/C;AAEO,IAAM,iBAAN,cAA6B,cAAc;AAAC;AAC5C,IAAM,oBAAN,cAAgC,cAAc;AAAC;AAG/C,IAAM,sBAAN,cAAkC,cAAc;AAAA,EACrD,YAAY,SAAiC,OAAe;AAC1D,UAAM,OAAO;AAD8B;AAAA,EAE7C;AAAA,EAF6C;AAG/C;AAEO,IAAM,kBAAN,cAA8B,cAAc;AAAC;AAE7C,IAAM,oBAAN,cAAgC,cAAc;AAAC;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-JQAMNFAF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,44 @@
1
+ import {
2
+ Iso21423Error
3
+ } from "./chunk-JLUENXGS.js";
4
+
5
+ // src/topics/resources.ts
6
+ var RESOURCE_CONFIG = {
7
+ identity: { qos: 1, retain: true },
8
+ status: { qos: 1, retain: true },
9
+ batteryStatus: { qos: 0, retain: true },
10
+ footprint: { qos: 1, retain: true },
11
+ odometry: { qos: 0, retain: false, minHz: 0.5, maxHz: 30 },
12
+ localTrajectory: { qos: 0, retain: false, minHz: 1, maxHz: 10 },
13
+ globalPath: { qos: 1, retain: true },
14
+ globalPlan: { qos: 1, retain: true },
15
+ request: { qos: 2, retain: true },
16
+ requestStatus: { qos: 2, retain: true },
17
+ activeRequestsStatus: { qos: 1, retain: true },
18
+ disconnection: { qos: 1, retain: true }
19
+ // B.4 LWT parameters
20
+ };
21
+ var STANDARD_RESOURCES = new Set(Object.keys(RESOURCE_CONFIG));
22
+ function isStandardResource(name) {
23
+ return STANDARD_RESOURCES.has(name);
24
+ }
25
+ function registerExtensionResource(name, config) {
26
+ if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(name)) {
27
+ throw new Iso21423Error(`invalid extension resource name "${name}"`);
28
+ }
29
+ if (STANDARD_RESOURCES.has(name)) {
30
+ throw new Iso21423Error(`"${name}" is a standard ISO 21423 resource and cannot be redefined`);
31
+ }
32
+ const existing = RESOURCE_CONFIG[name];
33
+ if (existing && (existing.qos !== config.qos || existing.retain !== config.retain || existing.minHz !== config.minHz || existing.maxHz !== config.maxHz)) {
34
+ throw new Iso21423Error(`extension resource "${name}" is already registered with a different config`);
35
+ }
36
+ RESOURCE_CONFIG[name] = { ...config };
37
+ }
38
+
39
+ export {
40
+ RESOURCE_CONFIG,
41
+ isStandardResource,
42
+ registerExtensionResource
43
+ };
44
+ //# sourceMappingURL=chunk-LTPOAVGF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../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\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`);\n }\n RESOURCE_CONFIG[name] = { ...config };\n}\n"],"mappings":";;;;;AAsBO,IAAM,kBAAkD;AAAA,EAC7D,UAAU,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EACjC,QAAQ,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EAC/B,eAAe,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EACtC,WAAW,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EAClC,UAAU,EAAE,KAAK,GAAG,QAAQ,OAAO,OAAO,KAAK,OAAO,GAAG;AAAA,EACzD,iBAAiB,EAAE,KAAK,GAAG,QAAQ,OAAO,OAAO,GAAG,OAAO,GAAG;AAAA,EAC9D,YAAY,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EACnC,YAAY,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EACnC,SAAS,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EAChC,eAAe,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EACtC,sBAAsB,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA,EAC7C,eAAe,EAAE,KAAK,GAAG,QAAQ,KAAK;AAAA;AACxC;AAEA,IAAM,qBAA0C,IAAI,IAAI,OAAO,KAAK,eAAe,CAAC;AAG7E,SAAS,mBAAmB,MAAuB;AACxD,SAAO,mBAAmB,IAAI,IAAI;AACpC;AAYO,SAAS,0BAA0B,MAAc,QAA8B;AACpF,MAAI,CAAC,2BAA2B,KAAK,IAAI,GAAG;AAC1C,UAAM,IAAI,cAAc,oCAAoC,IAAI,GAAG;AAAA,EACrE;AACA,MAAI,mBAAmB,IAAI,IAAI,GAAG;AAChC,UAAM,IAAI,cAAc,IAAI,IAAI,4DAA4D;AAAA,EAC9F;AACA,QAAM,WAAW,gBAAgB,IAAI;AACrC,MAAI,aAAa,SAAS,QAAQ,OAAO,OAAO,SAAS,WAAW,OAAO,UACpE,SAAS,UAAU,OAAO,SAAS,SAAS,UAAU,OAAO,QAAQ;AAC1E,UAAM,IAAI,cAAc,uBAAuB,IAAI,iDAAiD;AAAA,EACtG;AACA,kBAAgB,IAAI,IAAI,EAAE,GAAG,OAAO;AACtC;","names":[]}
@@ -0,0 +1,65 @@
1
+ import {
2
+ Iso21423Error
3
+ } from "./chunk-JLUENXGS.js";
4
+
5
+ // src/geometry/transform.ts
6
+ function fitTransform(from, to) {
7
+ if (from.length !== to.length) {
8
+ throw new Iso21423Error("fitTransform: point lists must have the same number of points");
9
+ }
10
+ if (from.length < 3) {
11
+ throw new Iso21423Error("fitTransform: at least 3 reference point pairs are required (Clause 4)");
12
+ }
13
+ const n = from.length;
14
+ let cfx = 0, cfy = 0, ctx = 0, cty = 0;
15
+ for (let i = 0; i < n; i++) {
16
+ cfx += from[i].x;
17
+ cfy += from[i].y;
18
+ ctx += to[i].x;
19
+ cty += to[i].y;
20
+ }
21
+ cfx /= n;
22
+ cfy /= n;
23
+ ctx /= n;
24
+ cty /= n;
25
+ let sumCross = 0, sumDot = 0;
26
+ for (let i = 0; i < n; i++) {
27
+ const fx = from[i].x - cfx, fy = from[i].y - cfy;
28
+ const tx = to[i].x - ctx, ty = to[i].y - cty;
29
+ sumCross += fx * ty - fy * tx;
30
+ sumDot += fx * tx + fy * ty;
31
+ }
32
+ const rotation = Math.atan2(sumCross, sumDot);
33
+ const cos = Math.cos(rotation), sin = Math.sin(rotation);
34
+ return {
35
+ rotation,
36
+ tx: ctx - (cos * cfx - sin * cfy),
37
+ ty: cty - (sin * cfx + cos * cfy)
38
+ };
39
+ }
40
+ function applyTransform(t, p) {
41
+ const cos = Math.cos(t.rotation), sin = Math.sin(t.rotation);
42
+ return { x: cos * p.x - sin * p.y + t.tx, y: sin * p.x + cos * p.y + t.ty };
43
+ }
44
+ function invertTransform(t) {
45
+ const cos = Math.cos(t.rotation), sin = Math.sin(t.rotation);
46
+ return {
47
+ rotation: -t.rotation,
48
+ tx: -(cos * t.tx + sin * t.ty),
49
+ ty: -(-sin * t.tx + cos * t.ty)
50
+ };
51
+ }
52
+ function transformYaw(t, yaw) {
53
+ let r = yaw + t.rotation;
54
+ while (r > Math.PI) r -= 2 * Math.PI;
55
+ while (r <= -Math.PI) r += 2 * Math.PI;
56
+ return r;
57
+ }
58
+
59
+ export {
60
+ fitTransform,
61
+ applyTransform,
62
+ invertTransform,
63
+ transformYaw
64
+ };
65
+ //# sourceMappingURL=chunk-ODBIFZN3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/geometry/transform.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 { Point } from '../types/ccs.js';\nimport { Iso21423Error } from '../errors.js';\n\n/** 2D rotation + translation: rotate by `rotation` radians, then translate by `(tx, ty)`. */\nexport interface RigidTransform2D { rotation: number; tx: number; ty: number }\n\n/**\n * Least-squares best-fit rigid transform mapping `from` points onto `to` points\n * (Kabsch/Umeyama for the 2D rotation+translation case, no scaling).\n * Requires at least 3 point pairs (Clause 4) and equal-length arrays; throws otherwise.\n */\nexport function fitTransform(from: Point[], to: Point[]): RigidTransform2D {\n if (from.length !== to.length) {\n throw new Iso21423Error('fitTransform: point lists must have the same number of points');\n }\n if (from.length < 3) {\n throw new Iso21423Error('fitTransform: at least 3 reference point pairs are required (Clause 4)');\n }\n const n = from.length;\n let cfx = 0, cfy = 0, ctx = 0, cty = 0;\n for (let i = 0; i < n; i++) {\n cfx += from[i]!.x; cfy += from[i]!.y;\n ctx += to[i]!.x; cty += to[i]!.y;\n }\n cfx /= n; cfy /= n; ctx /= n; cty /= n;\n\n let sumCross = 0, sumDot = 0;\n for (let i = 0; i < n; i++) {\n const fx = from[i]!.x - cfx, fy = from[i]!.y - cfy;\n const tx = to[i]!.x - ctx, ty = to[i]!.y - cty;\n sumCross += fx * ty - fy * tx;\n sumDot += fx * tx + fy * ty;\n }\n const rotation = Math.atan2(sumCross, sumDot);\n const cos = Math.cos(rotation), sin = Math.sin(rotation);\n return {\n rotation,\n tx: ctx - (cos * cfx - sin * cfy),\n ty: cty - (sin * cfx + cos * cfy),\n };\n}\n\n/** Applies the transform to a single point: rotate then translate. */\nexport function applyTransform(t: RigidTransform2D, p: Point): Point {\n const cos = Math.cos(t.rotation), sin = Math.sin(t.rotation);\n return { x: cos * p.x - sin * p.y + t.tx, y: sin * p.x + cos * p.y + t.ty };\n}\n\n/** Returns the inverse transform (undoes {@link applyTransform}). */\nexport function invertTransform(t: RigidTransform2D): RigidTransform2D {\n const cos = Math.cos(t.rotation), sin = Math.sin(t.rotation);\n return {\n rotation: -t.rotation,\n tx: -(cos * t.tx + sin * t.ty),\n ty: -(-sin * t.tx + cos * t.ty),\n };\n}\n\n/** Rotates a yaw angle by the transform and wraps the result to (-π, π]. */\nexport function transformYaw(t: RigidTransform2D, yaw: number): number {\n let r = yaw + t.rotation;\n while (r > Math.PI) r -= 2 * Math.PI;\n while (r <= -Math.PI) r += 2 * Math.PI;\n return r;\n}\n"],"mappings":";;;;;AA2BO,SAAS,aAAa,MAAe,IAA+B;AACzE,MAAI,KAAK,WAAW,GAAG,QAAQ;AAC7B,UAAM,IAAI,cAAc,+DAA+D;AAAA,EACzF;AACA,MAAI,KAAK,SAAS,GAAG;AACnB,UAAM,IAAI,cAAc,wEAAwE;AAAA,EAClG;AACA,QAAM,IAAI,KAAK;AACf,MAAI,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM;AACrC,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,WAAO,KAAK,CAAC,EAAG;AAAG,WAAO,KAAK,CAAC,EAAG;AACnC,WAAO,GAAG,CAAC,EAAG;AAAG,WAAO,GAAG,CAAC,EAAG;AAAA,EACjC;AACA,SAAO;AAAG,SAAO;AAAG,SAAO;AAAG,SAAO;AAErC,MAAI,WAAW,GAAG,SAAS;AAC3B,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,UAAM,KAAK,KAAK,CAAC,EAAG,IAAI,KAAK,KAAK,KAAK,CAAC,EAAG,IAAI;AAC/C,UAAM,KAAK,GAAG,CAAC,EAAG,IAAI,KAAK,KAAK,GAAG,CAAC,EAAG,IAAI;AAC3C,gBAAY,KAAK,KAAK,KAAK;AAC3B,cAAU,KAAK,KAAK,KAAK;AAAA,EAC3B;AACA,QAAM,WAAW,KAAK,MAAM,UAAU,MAAM;AAC5C,QAAM,MAAM,KAAK,IAAI,QAAQ,GAAG,MAAM,KAAK,IAAI,QAAQ;AACvD,SAAO;AAAA,IACL;AAAA,IACA,IAAI,OAAO,MAAM,MAAM,MAAM;AAAA,IAC7B,IAAI,OAAO,MAAM,MAAM,MAAM;AAAA,EAC/B;AACF;AAGO,SAAS,eAAe,GAAqB,GAAiB;AACnE,QAAM,MAAM,KAAK,IAAI,EAAE,QAAQ,GAAG,MAAM,KAAK,IAAI,EAAE,QAAQ;AAC3D,SAAO,EAAE,GAAG,MAAM,EAAE,IAAI,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG;AAC5E;AAGO,SAAS,gBAAgB,GAAuC;AACrE,QAAM,MAAM,KAAK,IAAI,EAAE,QAAQ,GAAG,MAAM,KAAK,IAAI,EAAE,QAAQ;AAC3D,SAAO;AAAA,IACL,UAAU,CAAC,EAAE;AAAA,IACb,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE;AAAA,IAC3B,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,MAAM,EAAE;AAAA,EAC9B;AACF;AAGO,SAAS,aAAa,GAAqB,KAAqB;AACrE,MAAI,IAAI,MAAM,EAAE;AAChB,SAAO,IAAI,KAAK,GAAI,MAAK,IAAI,KAAK;AAClC,SAAO,KAAK,CAAC,KAAK,GAAI,MAAK,IAAI,KAAK;AACpC,SAAO;AACT;","names":[]}
@@ -0,0 +1,107 @@
1
+ import {
2
+ ROOT_NAMESPACE
3
+ } from "./chunk-RD7PYTIT.js";
4
+
5
+ // src/core/filters.ts
6
+ var level = (v) => v ?? "+";
7
+ var EntityFilter = class _EntityFilter {
8
+ constructor(selectors) {
9
+ this.selectors = selectors;
10
+ }
11
+ selectors;
12
+ static all() {
13
+ return new _EntityFilter([{}]);
14
+ }
15
+ static ofType(entityType) {
16
+ return new _EntityFilter([{ entityType }]);
17
+ }
18
+ static entity(entityUuid) {
19
+ return new _EntityFilter([{ entityUuid }]);
20
+ }
21
+ /** Accepts uuids or nested filters; duplicate selectors collapse. */
22
+ static anyOf(items) {
23
+ const selectors = [];
24
+ const seen = /* @__PURE__ */ new Set();
25
+ for (const item of items) {
26
+ const part = typeof item === "string" ? _EntityFilter.entity(item) : item;
27
+ for (const s of part.selectors) {
28
+ const key = `${s.entityType ?? "+"}/${s.entityUuid ?? "+"}`;
29
+ if (seen.has(key)) continue;
30
+ seen.add(key);
31
+ selectors.push(s);
32
+ }
33
+ }
34
+ return new _EntityFilter(selectors);
35
+ }
36
+ /** One MQTT topic filter per selector, for subscribing to `resource` across every entity this filter selects. */
37
+ topicFiltersFor(resource) {
38
+ return this.selectors.map(
39
+ (s) => `${ROOT_NAMESPACE}/${level(s.entityType)}/${level(s.entityUuid)}/${resource}`
40
+ );
41
+ }
42
+ matches(ref) {
43
+ return this.selectors.some((s) => (s.entityType === void 0 || s.entityType === ref.entityType) && (s.entityUuid === void 0 || s.entityUuid === ref.entityUuid));
44
+ }
45
+ };
46
+ var TopicSetFilter = class {
47
+ constructor(selectors, suffix) {
48
+ this.selectors = selectors;
49
+ this.suffix = suffix;
50
+ }
51
+ selectors;
52
+ suffix;
53
+ topicFilters() {
54
+ return this.selectors.map(
55
+ (s) => `${ROOT_NAMESPACE}/${level(s.entityType)}/${level(s.entityUuid)}/${this.suffix}`
56
+ );
57
+ }
58
+ };
59
+ var RequestFilter = class _RequestFilter extends TopicSetFilter {
60
+ static all() {
61
+ return new _RequestFilter([{}], "request/+");
62
+ }
63
+ static toEntity(entityUuid) {
64
+ return new _RequestFilter([{ entityUuid }], "request/+");
65
+ }
66
+ static ofType(entityType) {
67
+ return new _RequestFilter([{ entityType }], "request/+");
68
+ }
69
+ };
70
+ var RequestStatusFilter = class _RequestStatusFilter extends TopicSetFilter {
71
+ static all() {
72
+ return new _RequestStatusFilter([{}], "request/+/status");
73
+ }
74
+ static ofEntity(entityUuid) {
75
+ return new _RequestStatusFilter([{ entityUuid }], "request/+/status");
76
+ }
77
+ static ofType(entityType) {
78
+ return new _RequestStatusFilter([{ entityType }], "request/+/status");
79
+ }
80
+ };
81
+ var RequestAcceptanceFilter = class _RequestAcceptanceFilter {
82
+ constructor(predicate) {
83
+ this.predicate = predicate;
84
+ }
85
+ predicate;
86
+ static all() {
87
+ return new _RequestAcceptanceFilter(() => true);
88
+ }
89
+ static actions(types) {
90
+ const wanted = new Set(types);
91
+ return new _RequestAcceptanceFilter((req) => req.details.some((d) => wanted.has(d.type)));
92
+ }
93
+ static fromSource(source) {
94
+ return new _RequestAcceptanceFilter((req) => req.source === source);
95
+ }
96
+ matches(req) {
97
+ return this.predicate(req);
98
+ }
99
+ };
100
+
101
+ export {
102
+ EntityFilter,
103
+ RequestFilter,
104
+ RequestStatusFilter,
105
+ RequestAcceptanceFilter
106
+ };
107
+ //# sourceMappingURL=chunk-OH2DOPKJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/filters.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 { ROOT_NAMESPACE } from '../types/constants.js';\nimport type { Uuid } from '../types/common.js';\nimport type { Request } from '../types/requests.js';\n\n/** One filter clause; an omitted field means \"any\" (compiles to an MQTT `+` wildcard). */\nexport interface EntitySelector { entityType?: string; entityUuid?: Uuid }\n\nconst level = (v?: string) => v ?? '+';\n\n/** Structured observer filter compiling to MQTT wildcard subscriptions (P-3, NP-3). */\nexport class EntityFilter {\n private constructor(readonly selectors: readonly EntitySelector[]) {}\n\n static all(): EntityFilter { return new EntityFilter([{}]); }\n static ofType(entityType: string): EntityFilter { return new EntityFilter([{ entityType }]); }\n static entity(entityUuid: Uuid): EntityFilter { return new EntityFilter([{ entityUuid }]); }\n\n /** Accepts uuids or nested filters; duplicate selectors collapse. */\n static anyOf(items: Array<Uuid | EntityFilter>): EntityFilter {\n const selectors: EntitySelector[] = [];\n const seen = new Set<string>();\n for (const item of items) {\n const part = typeof item === 'string' ? EntityFilter.entity(item) : item;\n for (const s of part.selectors) {\n const key = `${s.entityType ?? '+'}/${s.entityUuid ?? '+'}`;\n if (seen.has(key)) continue;\n seen.add(key);\n selectors.push(s);\n }\n }\n return new EntityFilter(selectors);\n }\n\n /** One MQTT topic filter per selector, for subscribing to `resource` across every entity this filter selects. */\n topicFiltersFor(resource: string): string[] {\n return this.selectors.map(\n (s) => `${ROOT_NAMESPACE}/${level(s.entityType)}/${level(s.entityUuid)}/${resource}`);\n }\n\n matches(ref: { entityType: string; entityUuid: string }): boolean {\n return this.selectors.some((s) =>\n (s.entityType === undefined || s.entityType === ref.entityType)\n && (s.entityUuid === undefined || s.entityUuid === ref.entityUuid));\n }\n}\n\n/** Shared base for filters that subscribe to a fixed topic suffix (e.g. `request/+`) across a set of entity selectors. */\nclass TopicSetFilter {\n protected constructor(\n protected readonly selectors: readonly EntitySelector[],\n private readonly suffix: string,\n ) {}\n topicFilters(): string[] {\n return this.selectors.map(\n (s) => `${ROOT_NAMESPACE}/${level(s.entityType)}/${level(s.entityUuid)}/${this.suffix}`);\n }\n}\n\n/** Observe requests addressed to entities (`…/request/<uuid>`). */\nexport class RequestFilter extends TopicSetFilter {\n static all(): RequestFilter { return new RequestFilter([{}], 'request/+'); }\n static toEntity(entityUuid: Uuid): RequestFilter {\n return new RequestFilter([{ entityUuid }], 'request/+');\n }\n static ofType(entityType: string): RequestFilter {\n return new RequestFilter([{ entityType }], 'request/+');\n }\n}\n\n/** Observe request status streams (`…/request/<uuid>/status`). */\nexport class RequestStatusFilter extends TopicSetFilter {\n static all(): RequestStatusFilter { return new RequestStatusFilter([{}], 'request/+/status'); }\n static ofEntity(entityUuid: Uuid): RequestStatusFilter {\n return new RequestStatusFilter([{ entityUuid }], 'request/+/status');\n }\n static ofType(entityType: string): RequestStatusFilter {\n return new RequestStatusFilter([{ entityType }], 'request/+/status');\n }\n}\n\n/** Local predicate over requests arriving on an entity's own request topic (ND-11.2). */\nexport class RequestAcceptanceFilter {\n private constructor(private readonly predicate: (req: Request) => boolean) {}\n static all(): RequestAcceptanceFilter { return new RequestAcceptanceFilter(() => true); }\n static actions(types: string[]): RequestAcceptanceFilter {\n const wanted = new Set(types);\n return new RequestAcceptanceFilter((req) => req.details.some((d) => wanted.has(d.type)));\n }\n static fromSource(source: Uuid): RequestAcceptanceFilter {\n return new RequestAcceptanceFilter((req) => req.source === source);\n }\n matches(req: Request): boolean { return this.predicate(req); }\n}\n"],"mappings":";;;;;AAuBA,IAAM,QAAQ,CAAC,MAAe,KAAK;AAG5B,IAAM,eAAN,MAAM,cAAa;AAAA,EAChB,YAAqB,WAAsC;AAAtC;AAAA,EAAuC;AAAA,EAAvC;AAAA,EAE7B,OAAO,MAAoB;AAAE,WAAO,IAAI,cAAa,CAAC,CAAC,CAAC,CAAC;AAAA,EAAG;AAAA,EAC5D,OAAO,OAAO,YAAkC;AAAE,WAAO,IAAI,cAAa,CAAC,EAAE,WAAW,CAAC,CAAC;AAAA,EAAG;AAAA,EAC7F,OAAO,OAAO,YAAgC;AAAE,WAAO,IAAI,cAAa,CAAC,EAAE,WAAW,CAAC,CAAC;AAAA,EAAG;AAAA;AAAA,EAG3F,OAAO,MAAM,OAAiD;AAC5D,UAAM,YAA8B,CAAC;AACrC,UAAM,OAAO,oBAAI,IAAY;AAC7B,eAAW,QAAQ,OAAO;AACxB,YAAM,OAAO,OAAO,SAAS,WAAW,cAAa,OAAO,IAAI,IAA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AAAA,EACxD;AACF;AAGO,IAAM,sBAAN,MAAM,6BAA4B,eAAe;AAAA,EACtD,OAAO,MAA2B;AAAE,WAAO,IAAI,qBAAoB,CAAC,CAAC,CAAC,GAAG,kBAAkB;AAAA,EAAG;AAAA,EAC9F,OAAO,SAAS,YAAuC;AACrD,WAAO,IAAI,qBAAoB,CAAC,EAAE,WAAW,CAAC,GAAG,kBAAkB;AAAA,EACrE;AAAA,EACA,OAAO,OAAO,YAAyC;AACrD,WAAO,IAAI,qBAAoB,CAAC,EAAE,WAAW,CAAC,GAAG,kBAAkB;AAAA,EACrE;AACF;AAGO,IAAM,0BAAN,MAAM,yBAAwB;AAAA,EAC3B,YAA6B,WAAsC;AAAtC;AAAA,EAAuC;AAAA,EAAvC;AAAA,EACrC,OAAO,MAA+B;AAAE,WAAO,IAAI,yBAAwB,MAAM,IAAI;AAAA,EAAG;AAAA,EACxF,OAAO,QAAQ,OAA0C;AACvD,UAAM,SAAS,IAAI,IAAI,KAAK;AAC5B,WAAO,IAAI,yBAAwB,CAAC,QAAQ,IAAI,QAAQ,KAAK,CAAC,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC,CAAC;AAAA,EACzF;AAAA,EACA,OAAO,WAAW,QAAuC;AACvD,WAAO,IAAI,yBAAwB,CAAC,QAAQ,IAAI,WAAW,MAAM;AAAA,EACnE;AAAA,EACA,QAAQ,KAAuB;AAAE,WAAO,KAAK,UAAU,GAAG;AAAA,EAAG;AAC/D;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-QAA44UNO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,107 @@
1
+ // src/types/constants.ts
2
+ var ROOT_NAMESPACE = "/ISO_21423/v1";
3
+ var PROTOCOL_VERSION = "1.0";
4
+ var ENTITY_TYPES = ["IMR", "IMRFM"];
5
+ var KNOWN_OPERATING_STATES = [
6
+ "STOP_CATEGORY_0",
7
+ "STOP_CATEGORY_1",
8
+ "STOP_CATEGORY_2",
9
+ "PAUSED",
10
+ "WAIT_FOR_RESET",
11
+ "MAPPING",
12
+ "LOST",
13
+ "WAIT_FOR_ATTACHMENT",
14
+ "WAIT_FOR_EVENT",
15
+ "BLOCKED",
16
+ "ATTACHMENT_ACTIVE",
17
+ "STOPPED",
18
+ "DOCKING",
19
+ "SLOWING",
20
+ "ACCELERATING",
21
+ "LEFT_TURN",
22
+ "RIGHT_TURN",
23
+ "REVERSE",
24
+ "FORWARD",
25
+ "LINE_FOLLOWING",
26
+ "CHARGING",
27
+ "LOW_BATTERY",
28
+ "IDLE",
29
+ "PARKED",
30
+ "OFFLINE",
31
+ "READY",
32
+ "NOT_READY",
33
+ "MODE_AUTO",
34
+ "MODE_SEMIAUTO",
35
+ "MODE_TELEOP",
36
+ "MODE_MANUAL",
37
+ "MODE_MAINTENANCE"
38
+ ];
39
+ var OPERATING_MODES = [
40
+ "MODE_AUTO",
41
+ "MODE_SEMIAUTO",
42
+ "MODE_TELEOP",
43
+ "MODE_MANUAL",
44
+ "MODE_MAINTENANCE"
45
+ ];
46
+ var LOST_CONNECTION_STATE = "LOST_CONNECTION";
47
+ var REQUEST_STATES = [
48
+ "RECEIVED",
49
+ "ACCEPTED",
50
+ "EXECUTING",
51
+ "CANCELED",
52
+ "SUCCEEDED",
53
+ "ABORTED",
54
+ "RECOVERY"
55
+ ];
56
+ var DETAIL_STATES = [
57
+ "RECEIVED",
58
+ "ACCEPTED",
59
+ "EXECUTING",
60
+ "CANCELED",
61
+ "SUCCEEDED",
62
+ "ABORTED"
63
+ ];
64
+ var KNOWN_REASON_CODES = [
65
+ "OK",
66
+ "GENERAL_FAILURE",
67
+ "TIMEOUT",
68
+ "VERSION_NOT_SUPPORTED",
69
+ "FORMAT_NOT_SUPPORTED",
70
+ "ACTION_NOT_IMPLEMENTED",
71
+ "REJECTED",
72
+ "MALFORMED_REQUEST",
73
+ "INVALID_IMR_STATE_FOR_ACTION"
74
+ ];
75
+ var BATTERY_HEALTH = [
76
+ "UNKNOWN",
77
+ "HEALTHY",
78
+ "OVERHEAT",
79
+ "DEAD",
80
+ "OVERVOLTAGE",
81
+ "FAILURE",
82
+ "COLD"
83
+ ];
84
+ var CHARGING_STATES = [
85
+ "UNKNOWN",
86
+ "CHARGING",
87
+ "DISCHARGING",
88
+ "NOT_CHARGING",
89
+ "FULL"
90
+ ];
91
+ var DOCK_ACTIONS = ["CHARGE", "DUMP", "FILL", "LOAD", "UNLOAD", "PICK", "DROP"];
92
+
93
+ export {
94
+ ROOT_NAMESPACE,
95
+ PROTOCOL_VERSION,
96
+ ENTITY_TYPES,
97
+ KNOWN_OPERATING_STATES,
98
+ OPERATING_MODES,
99
+ LOST_CONNECTION_STATE,
100
+ REQUEST_STATES,
101
+ DETAIL_STATES,
102
+ KNOWN_REASON_CODES,
103
+ BATTERY_HEALTH,
104
+ CHARGING_STATES,
105
+ DOCK_ACTIONS
106
+ };
107
+ //# sourceMappingURL=chunk-RD7PYTIT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/constants.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 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"],"mappings":";AAgBO,IAAM,iBAAiB;AACvB,IAAM,mBAAmB;AAEzB,IAAM,eAAe,CAAC,OAAO,OAAO;AAMpC,IAAM,yBAAyB;AAAA,EACpC;AAAA,EAAmB;AAAA,EAAmB;AAAA,EACtC;AAAA,EAAU;AAAA,EAAkB;AAAA,EAAW;AAAA,EACvC;AAAA,EAAuB;AAAA,EAAkB;AAAA,EAAW;AAAA,EACpD;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACjC;AAAA,EAAa;AAAA,EAAc;AAAA,EAAW;AAAA,EAAW;AAAA,EACjD;AAAA,EAAY;AAAA,EAAe;AAAA,EAAQ;AAAA,EAAU;AAAA,EAC7C;AAAA,EAAS;AAAA,EACT;AAAA,EAAa;AAAA,EAAiB;AAAA,EAAe;AAAA,EAAe;AAC9D;AAKO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EAAa;AAAA,EAAiB;AAAA,EAAe;AAAA,EAAe;AAC9D;AAGO,IAAM,wBAAwB;AAG9B,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EAAY;AAAA,EAAY;AAAA,EAAa;AAAA,EAAY;AAAA,EAAa;AAAA,EAAW;AAC3E;AAIO,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EAAY;AAAA,EAAY;AAAA,EAAa;AAAA,EAAY;AAAA,EAAa;AAChE;AAGO,IAAM,qBAAqB;AAAA,EAChC;AAAA,EAAM;AAAA,EAAmB;AAAA,EAAW;AAAA,EAAyB;AAAA,EAC7D;AAAA,EAA0B;AAAA,EAAY;AAAA,EAAqB;AAC7D;AAGO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EAAW;AAAA,EAAW;AAAA,EAAY;AAAA,EAAQ;AAAA,EAAe;AAAA,EAAW;AACtE;AAIO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EAAW;AAAA,EAAY;AAAA,EAAe;AAAA,EAAgB;AACxD;AAGO,IAAM,eAAe,CAAC,UAAU,QAAQ,QAAQ,QAAQ,UAAU,QAAQ,MAAM;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/types/common.ts
2
+ function nowTimestamp(date = /* @__PURE__ */ new Date()) {
3
+ return date.toISOString();
4
+ }
5
+ function parseTimestamp(ts) {
6
+ return new Date(ts.replace(",", "."));
7
+ }
8
+
9
+ export {
10
+ nowTimestamp,
11
+ parseTimestamp
12
+ };
13
+ //# sourceMappingURL=chunk-UJC46NTA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/common.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 type Uuid = string;\n/** ISO 8601-1 timestamp string, dot-decimal milliseconds, UTC. */\nexport type IsoTimestamp = string;\n\nexport function nowTimestamp(date: Date = new Date()): IsoTimestamp {\n return date.toISOString();\n}\n\n/** Accepts both dot and comma decimal separators (spec §3.1). */\nexport function parseTimestamp(ts: string): Date {\n return new Date(ts.replace(',', '.'));\n}\n"],"mappings":";AAoBO,SAAS,aAAa,OAAa,oBAAI,KAAK,GAAiB;AAClE,SAAO,KAAK,YAAY;AAC1B;AAGO,SAAS,eAAe,IAAkB;AAC/C,SAAO,IAAI,KAAK,GAAG,QAAQ,KAAK,GAAG,CAAC;AACtC;","names":[]}