node-red-contrib-join-wait 0.5.3 → 0.6.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,181 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.6.0] - 2026-05-08
8
+
9
+ ### Added
10
+
11
+ - **Modern Node-RED `(msg, send, done)` input handler signature.** The
12
+ runtime now gets a proper `done()` / `done(err)` signal for every
13
+ message — meaningful for async-message tracking and graceful
14
+ shutdown. The async input handler previously relied on auto-completion,
15
+ which fired before any awaited work resolved.
16
+ - **Smarter status indicator.** A single-group node shows progress toward
17
+ completion (e.g. `2/3 received`) rather than the raw queue depth.
18
+ Multi-group nodes still show aggregate counts.
19
+ - Two more shipped example flows: `04-regex.json` (regex path matching)
20
+ and `05-exact-order.json` (exact-order with a repeated step).
21
+ - **Editor UX overhaul.** Wait paths and reset paths now use Node-RED's
22
+ `editableList` widget — add/remove/reorder rows instead of typing JSON
23
+ arrays into a text box. Each row now validates inline (empty / invalid
24
+ regex are flagged red with a tooltip). Pressing <kbd>Enter</kbd> in a
25
+ row adds the next one.
26
+ - **Persist store as a dropdown.** A new `/join-wait/stores` admin route
27
+ exposes the configured context stores; the editor populates the
28
+ Persist store field as a `<select>` showing each store's resolved
29
+ module (e.g. `file (localfilesystem)`). Eliminates typos and surfaces
30
+ available stores.
31
+ - **Tooltips on every field label.** Hover-discoverable explanations
32
+ (`title` attributes) for every form row.
33
+ - **Inline output-shape preview.** Under Wait paths, a small monospace
34
+ line shows what the merged success message looks like
35
+ (`→ msg.topic = { path_1: …, path_2: … }`), updating as the list
36
+ changes.
37
+ - **Smart timeout warning.** When the resolved timeout is under 50 ms,
38
+ a yellow tip surfaces the README guidance about padding evaluation
39
+ overhead.
40
+ - **Inline jsonata validation on Group by.** When the field type is
41
+ `jsonata`, the expression is parsed at edit-time and the field marks
42
+ invalid before the first message even arrives.
43
+ - **Quick "Open example flows" button** in the editor opens the import
44
+ dialog directly.
45
+ - Path-row placeholders changed from generic `path name` to a worked
46
+ example (`e.g. sensor_1`, `e.g. abort`) so empty rows hint at intent.
47
+ - **Status-indicator error states.** Validation, regex compile, and
48
+ correlator-evaluation failures now show a red ring on the node with a
49
+ short reason in addition to the usual `node.error` log entry.
50
+ - **Unhandled-rejection guard** around the async input handler so a future
51
+ bug or upstream throw can't escape without being logged.
52
+ - End-to-end smoke test for **all five** shipped example flows, plus a
53
+ static config-shape sanity test on `join-wait.html` to catch drift
54
+ between the editor defaults and the runtime fields.
55
+ - **Advanced settings** are collapsed under a single `<details>` group so
56
+ the editor presents the common options first.
57
+ - **`msg.reset`** — sending `msg.reset = true` silently drains the queue
58
+ for the current correlation group with no output.
59
+ - **`node.status()`** indicator showing the number of queued messages.
60
+ - **Examples** — the package now ships three ready-made flows
61
+ (`Quickstart`, `Correlation`, `Reset paths`) discoverable via
62
+ **Menu → Import → Examples → join-wait**.
63
+ - **Per-instance persistence store** — new `Persist store` field selects a
64
+ named context store from `settings.js` for restart-survival.
65
+ - Unit-test specs for the `lib/config`, `lib/matcher`, and `lib/persist`
66
+ modules.
67
+
68
+ ### Changed
69
+
70
+ - **Renames for clarity.** Internal-only — config keys and runtime
71
+ behavior are unchanged for existing flows. `node.paths` → `node.queues`;
72
+ `node.topic` / `node.topicType` → `node.correlator` /
73
+ `node.correlatorType`; `node.pathTopic` / `node.pathTopicType` →
74
+ `node.pathField` / `node.pathFieldType`; `node.disableComplete` →
75
+ `node.ignoreMsgComplete`; `node.persistOnRestart` → `node.persistQueue`;
76
+ `node.firstMsg` → `node.useFirstAsBase`. The `clearQueue*` family →
77
+ `dropQueue` / `flushQueueAsExpired` / `flushOnMsgComplete` /
78
+ `flushTimedOutEntries` / `flushTrailingEntries`. Magic
79
+ `'_join-wait-node'` → `DEFAULT_GROUP` constant. `pickArrayOverride` →
80
+ `arrayOrFallback`.
81
+ - **`drainQueue` now takes an options object** (`{ sendExpired,
82
+ expireByTime, keep }`) instead of three positional booleans + a count.
83
+ - **`findAllPaths{AnyOrder,ExactOrder}` return shape** changed from
84
+ `null | number` to `{ matched: true } | { matched: false, keep: number }`
85
+ for self-documenting call sites. Lib functions are not part of the
86
+ public API.
87
+ - **`asBool()` helper** accepts both `'true'`/`'false'` strings (from the
88
+ HTML `<select>`) and real booleans (programmatic flow construction).
89
+ Removes a class of subtle defaults-bug for non-editor-built flows.
90
+ - **`countPathsAnyOrder`** now uses a `Set` to track used indices
91
+ (O(1) check vs the previous O(n) `Array.indexOf`).
92
+ - **Comment around `flushOnMsgComplete`** documents the deliberately
93
+ partial behavior: `msg.complete` short-circuits a partial queue but
94
+ never overrides a successful match.
95
+ - **`node:` prefix on core imports** in test files (`node:fs`,
96
+ `node:os`, `node:path`).
97
+ - **Expired output now uses the configured `Path field`** for the merged
98
+ data (matching the success output). Previously hardcoded to `msg.paths`
99
+ even when a different `pathTopic` was configured. Existing flows that
100
+ use the default `paths` setting see no change.
101
+ - **Persistence rewritten on top of Node-RED's context store** (replacing
102
+ the `node-persist` singleton, which raced when multiple `join-wait` nodes
103
+ were deployed in the same flow). Default in-memory store keeps queues
104
+ across deploys; a configured persistent store keeps them across full
105
+ restarts.
106
+ - **`Preserve queue` defaults to on** for new nodes. Partial joins now
107
+ survive a redeploy out of the box. Existing 0.5.x flows keep their
108
+ original `persistOnRestart: false` until re-saved.
109
+ - **`Persist store` is no longer required** for restart persistence.
110
+ If `localfilesystem` (or similar) is set as the **default** context
111
+ store in `settings.js`, every join-wait node uses it automatically.
112
+ - **Auto-pick of a persistent named store.** When `Preserve queue` is
113
+ on, `Persist store` is empty, and the configured default store is
114
+ memory, the node auto-selects the first non-memory named store from
115
+ `settings.js` (with a `node.log` line so it's discoverable). If the
116
+ user has both `default: memory` and (say) `file: localfilesystem`
117
+ configured, they get restart persistence for free without setting
118
+ `Persist store` on every node. Setting `Persist store` explicitly
119
+ always wins.
120
+ - **British → American spellings.** `normalisePaths` → `normalizePaths`,
121
+ `serialisable` → `serializable`, `behaviour` → `behavior` in code +
122
+ docs for consistency with the wider JS / npm ecosystem.
123
+ - **`msg.pathsToWait`, `msg.pathsToExpire`, `msg.useRegex` are now one-shot
124
+ overrides** — they apply only to the current message instead of
125
+ permanently mutating the node's stored config.
126
+ - **Code split** into `lib/config.js`, `lib/matcher.js`, and `lib/persist.js`
127
+ — `join-wait.js` is now a thin orchestrator. The input handler is broken
128
+ into discrete named phases for readability.
129
+ - **`mapPayload` no longer mutates the caller's `pathTopic` object** —
130
+ incoming messages are left untouched.
131
+ - **jsonata bumped to v2** (`evaluate()` is now properly awaited).
132
+ - **Node-RED bumped to ≥ 3.0**, **Node.js ≥ 18**.
133
+ - **`engines.node`, `files`** added to `package.json`; deprecated
134
+ `licenses` array removed.
135
+ - Source labels in the editor renamed for clarity:
136
+ - "Paths topic" → **Path field**
137
+ - "Paths (Wait)" / "Paths (Expire)" → **Wait paths** / **Reset paths**
138
+ - "Sequence order" → **Match order**
139
+ - "Base message" → **Output base**
140
+ - "Merged data" → **Merge values**
141
+ - README rewritten — quickstart first, technical details after.
142
+
143
+ ### Fixed
144
+
145
+ - **`node.error` / `node.warn` second argument now correctly passes the
146
+ originating `msg`** (was wrongly passed as `[msg, null]`, a 2-output
147
+ send array, since 0.5.x). Catch nodes downstream now receive the real
148
+ message instead of an array.
149
+ - **Close handler always calls `done`**, even when the context-store
150
+ write rejects, so a transient persistence failure can't hold up
151
+ Node-RED shutdown.
152
+ - Empty `<b></b>` tag in the help text.
153
+ - Stale `ignoreUnmatched` references in older example flows.
154
+ - Possible race when multiple `join-wait` nodes shared the global
155
+ `node-persist` singleton (now uses an isolated context-store entry per
156
+ node).
157
+
158
+ ### Tooling
159
+
160
+ - GitHub Actions CI replaces Travis (matrix on Node 20/22/24, publishing
161
+ on Node 24). CI + release now live in a single workflow; the publish
162
+ job is gated by `needs: [quality, test]` so a tag push only ships once
163
+ lint, format, spellcheck, and the full test matrix have all passed.
164
+ - Workflow steps pinned to current `actions/checkout@v6`,
165
+ `actions/setup-node@v6`, `actions/upload-artifact@v6`.
166
+ - `prettier --check` enforced in CI to catch unformatted files.
167
+ - `engines.node` bumped to `>=20` (Node 18 EOL'd 2025-04-30).
168
+ - Automated npm publish workflow with provenance on tag push.
169
+ - Dependabot configured for monthly npm + GitHub Actions updates.
170
+ - ESLint upgraded to v9 with flat config (`eslint.config.js`).
171
+ - Prettier upgraded to v3.
172
+ - Coverage moved from `nyc` to `c8` (native V8 coverage).
173
+ - Spellcheck moved from the unmaintained `markdown-spellcheck` to `cspell`.
174
+ - `node-red-node-test-helper` bumped from 0.2.x to 0.3.6.
175
+ - Test suite expanded from 32 to 97 cases — including dedicated specs
176
+ for each `lib/` module, the editor HTML, and end-to-end runs of every
177
+ shipped example flow.
178
+
179
+ ## [0.5.3] and earlier
180
+
181
+ See the [git log](https://github.com/dxdc/node-red-contrib-join-wait/commits/master).