@helioslx/core 0.2.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/CONTRIBUTING.md +83 -0
  3. package/LICENSE +256 -0
  4. package/README.md +159 -0
  5. package/SECURITY.md +67 -0
  6. package/dist/contracts-C4kpAdZq.d.ts +265 -0
  7. package/dist/contracts-C4kpAdZq.d.ts.map +1 -0
  8. package/dist/http.d.ts +643 -0
  9. package/dist/http.d.ts.map +1 -0
  10. package/dist/http.js +670 -0
  11. package/dist/http.js.map +1 -0
  12. package/dist/index.d.ts +40 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +270 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/node.d.ts +114 -0
  17. package/dist/node.d.ts.map +1 -0
  18. package/dist/node.js +334 -0
  19. package/dist/node.js.map +1 -0
  20. package/dist/redis.d.ts +46 -0
  21. package/dist/redis.d.ts.map +1 -0
  22. package/dist/redis.js +174 -0
  23. package/dist/redis.js.map +1 -0
  24. package/dist/source-DB1oq2GT.js +884 -0
  25. package/dist/source-DB1oq2GT.js.map +1 -0
  26. package/dist/source-D_XNWXS9.d.ts +76 -0
  27. package/dist/source-D_XNWXS9.d.ts.map +1 -0
  28. package/dist/testing.d.ts +38 -0
  29. package/dist/testing.d.ts.map +1 -0
  30. package/dist/testing.js +98 -0
  31. package/dist/testing.js.map +1 -0
  32. package/dist/validation-BdsVeyAE.js +151 -0
  33. package/dist/validation-BdsVeyAE.js.map +1 -0
  34. package/examples/embedded-elysia-http.ts +30 -0
  35. package/examples/full-frame-fade.ts +25 -0
  36. package/examples/graceful-shutdown.ts +19 -0
  37. package/examples/quickstart.ts +30 -0
  38. package/examples/redis.ts +30 -0
  39. package/examples/sparse-channels.ts +23 -0
  40. package/examples/viewer-subscription.ts +38 -0
  41. package/examples/viewer-tui.ts +201 -0
  42. package/package.json +108 -0
  43. package/src/contracts.ts +302 -0
  44. package/src/http.ts +1101 -0
  45. package/src/index.ts +61 -0
  46. package/src/memory-store.ts +45 -0
  47. package/src/node.ts +578 -0
  48. package/src/output-engine.ts +778 -0
  49. package/src/redis.ts +258 -0
  50. package/src/source.ts +502 -0
  51. package/src/testing.ts +139 -0
  52. package/src/validation.ts +328 -0
  53. package/src/viewer.ts +368 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
6
+ and the project follows [Semantic Versioning](https://semver.org/), with the
7
+ pre-1.0 policy described in
8
+ [versioning](https://github.com/helioslx/docs/blob/main/content/docs/core/guides/versioning.mdx).
9
+
10
+ ## 0.2.0 - 2026-07-13
11
+
12
+ ### Changed
13
+
14
+ - Renamed the public output facade from `SacnController` to `SacnSource` with
15
+ cached `Universe` handles (`setChannels` maps, `fadeChannels`, `transition`,
16
+ `write`).
17
+ - Split lifecycle into `start` / `stop` (pause) / `close` (teardown), with
18
+ implicit start on output mutations and optional `onStart` / `onStop` /
19
+ `onClose` hooks.
20
+ - Node `createSacnSource` replaces `createNodeSacnController` and registers
21
+ sources for one-time `SIGINT` / `SIGTERM` / `beforeExit` auto-close.
22
+ - HTTP adapter now takes `source` and uses `durationMs` (maps or channel arrays).
23
+
24
+ ### Added
25
+
26
+ - Comprehensive public API, architecture, networking, safety, persistence, and
27
+ release documentation.
28
+ - Runnable TypeScript examples for output, viewing, Redis, HTTP, and shutdown.
29
+ - Open-source governance, contribution, security, conduct, support, and
30
+ trademark policies.
31
+ - Node/macOS, Node/Linux, Bun, dependency review, and provenance release
32
+ automation.
33
+
34
+ ## 0.1.0 - 2026-07-12
35
+
36
+ ### Added
37
+
38
+ - Runtime-neutral controller contracts, validated full-frame and sparse channel
39
+ writes, linear fades, scheduling, cancellation, persistence, and telemetry.
40
+ - Node sACN sender and receiver adapters.
41
+ - Memory and Redis output/viewer stores.
42
+ - Viewer callbacks and bounded/coalescing async streams.
43
+ - Embedded Elysia REST, OpenAPI, and WebSocket adapter.
44
+ - Deterministic testing utilities.
@@ -0,0 +1,83 @@
1
+ # Contributing
2
+
3
+ Thanks for helping improve `@helioslx/core`.
4
+
5
+ Community expectations and project policy live in the
6
+ [Helios docs](https://github.com/helioslx/docs) (code of conduct, governance,
7
+ support, trademark).
8
+
9
+ ## Before opening work
10
+
11
+ Use a discussion or issue for behavior changes, new public API, persistence
12
+ format changes, or substantial architecture work. For defects, include the
13
+ package version, Node/Bun version, operating system, minimal reproduction,
14
+ expected behavior, and actual behavior. Remove credentials, network addresses,
15
+ venue details, and other sensitive data.
16
+
17
+ Security vulnerabilities must be reported privately under
18
+ [SECURITY.md](SECURITY.md), not in a public issue.
19
+
20
+ ## Development
21
+
22
+ Requirements:
23
+
24
+ - Node.js 22+
25
+ - npm
26
+ - optional local Redis for persistence integration work
27
+ - a safe, isolated network for UDP integration work
28
+
29
+ Install and verify:
30
+
31
+ ```sh
32
+ npm ci
33
+ npm run typecheck
34
+ npm test
35
+ npm run test:coverage
36
+ npm run build
37
+ npm pack --dry-run
38
+ ```
39
+
40
+ Do not run network tests against a live lighting rig. Follow
41
+ [live-lighting safety](https://github.com/helioslx/docs/blob/main/content/docs/core/guides/safety.mdx).
42
+
43
+ ## Pull requests
44
+
45
+ Keep changes focused and explain the user-visible reason for them. Add or
46
+ update tests for behavior changes and documentation/examples for public API
47
+ changes. Call out:
48
+
49
+ - breaking API or error-code changes
50
+ - lifecycle and ownership changes
51
+ - new network behavior or safety impact
52
+ - stored-data compatibility and migration requirements
53
+ - optional peer dependency changes
54
+
55
+ All checks must pass on supported Node platforms and Bun compatibility jobs.
56
+ Generated output, local environment files, credentials, and packed tarballs
57
+ must not be committed.
58
+
59
+ Contributors retain copyright in their contributions. Unless explicitly stated
60
+ otherwise, intentionally submitted contributions are provided under Apache-2.0
61
+ as described in section 5 of the license. Do not submit code or assets you do
62
+ not have the right to contribute.
63
+
64
+ ## Style and compatibility
65
+
66
+ - Keep the root module runtime-neutral and free of import-time I/O.
67
+ - Keep Node, Redis, HTTP, and test integrations in explicit subpaths.
68
+ - Preserve strict TypeScript and immutable public snapshots.
69
+ - Validate all public inputs independently of transport or HTTP schemas.
70
+ - Keep bounded queues and explicit dependency ownership.
71
+ - Avoid expanding the core domain into fixtures, personalities, scenes, or
72
+ product licensing.
73
+
74
+ Public changes follow
75
+ [versioning](https://github.com/helioslx/docs/blob/main/content/docs/core/guides/versioning.mdx).
76
+ Update [CHANGELOG.md](CHANGELOG.md) under `Unreleased` for user-visible
77
+ changes.
78
+
79
+ ## Review
80
+
81
+ Maintainers may request changes for correctness, safety, scope, API stability,
82
+ tests, documentation, licensing, or maintainability. Approval does not
83
+ guarantee immediate release.
package/LICENSE ADDED
@@ -0,0 +1,256 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 The Helios Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+ Apache License
203
+
204
+ Version 2.0, January 2004
205
+
206
+ http://www.apache.org/licenses/
207
+
208
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
209
+
210
+ 1. Definitions.
211
+
212
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
213
+
214
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
215
+
216
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
217
+
218
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
219
+
220
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
221
+
222
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
223
+
224
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
225
+
226
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
227
+
228
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
229
+
230
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
231
+
232
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
233
+
234
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
235
+
236
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
237
+
238
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
239
+
240
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
241
+
242
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
243
+
244
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
245
+
246
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
247
+
248
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
249
+
250
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
251
+
252
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
253
+
254
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
255
+
256
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # Helios Core
2
+
3
+ [![npm](https://img.shields.io/npm/v/@helioslx/core)](https://www.npmjs.com/package/@helioslx/core)
4
+ [![CI](https://img.shields.io/github/actions/workflow/status/helioslx/core/ci.yml?branch=main&label=CI)](https://github.com/helioslx/core/actions/workflows/ci.yml)
5
+ [![Coverage](https://img.shields.io/codecov/c/github/helioslx/core)](https://codecov.io/gh/helioslx/core)
6
+ [![Node](https://img.shields.io/node/v/@helioslx/core)](https://nodejs.org)
7
+ [![License](https://img.shields.io/github/license/helioslx/core)](LICENSE)
8
+
9
+ `@helioslx/core` is a TypeScript toolkit for sending and observing sACN (E1.31)
10
+ from Node.js. Validated 512-slot DMX frames, sparse channel writes, fades,
11
+ optional persistence, and packet viewing — without fixture, personality, scene,
12
+ or show concepts.
13
+
14
+ > **Live-lighting warning:** Test with disconnected fixtures or a closed test
15
+ > network first. Incorrect values, universes, priorities, or interface
16
+ > selection can move equipment, trigger strobes, or black out a venue. See
17
+ > [live-lighting safety](https://github.com/helioslx/docs/blob/main/content/docs/core/guides/safety.mdx)
18
+ > before connecting to a live rig.
19
+
20
+ ## Requirements
21
+
22
+ - Node.js 22 or newer for the supported UDP runtime
23
+ - An IPv4 interface that can reach the sACN network
24
+ - TypeScript/ESM recommended
25
+ - Bun is compatibility-tested, but Node.js is the supported production network
26
+ runtime
27
+
28
+ The root module is runtime-neutral. UDP, Redis, and HTTP support are isolated in
29
+ optional subpaths, so install only the peers you use.
30
+
31
+ ## Quick start
32
+
33
+ ```sh
34
+ npm install @helioslx/core sacn
35
+ ```
36
+
37
+ ```ts
38
+ import { createSacnSource } from "@helioslx/core/node";
39
+
40
+ const source = createSacnSource({
41
+ name: "My lighting app",
42
+ transportOptions: {
43
+ // Set iface when the host has more than one network interface.
44
+ iface: "192.168.10.20",
45
+ },
46
+ });
47
+
48
+ const universe = source.universe(1, {
49
+ priority: 100,
50
+ sourceName: "Dimmers",
51
+ });
52
+
53
+ await universe.fadeChannels(
54
+ {
55
+ 1: 255,
56
+ 2: 128,
57
+ },
58
+ { durationMs: 1_000 },
59
+ );
60
+
61
+ // Node sources install SIGINT/SIGTERM/beforeExit handlers that call close().
62
+ ```
63
+
64
+ Public channels are one-based (`1..512`); values are integers from `0..255`.
65
+ Universes are `1..63999`, priorities are `0..200`, and priority defaults to
66
+ `100`. A full frame must contain exactly 512 values.
67
+
68
+ Mutations auto-start the scheduler. Reads (`get`, `listUniverses`) do not.
69
+ Awaiting a mutation means the write is scheduled and persisted, not that a fade
70
+ has finished.
71
+
72
+ See the complete [quick-start example](examples/quickstart.ts).
73
+
74
+ ## Common operations
75
+
76
+ Snap channels immediately:
77
+
78
+ ```ts
79
+ await universe.setChannels({ 1: 255, 2: 128 });
80
+ ```
81
+
82
+ Fade several channels with one shared duration:
83
+
84
+ ```ts
85
+ await universe.fadeChannels({ 1: 0, 2: 0 }, { durationMs: 1_000 });
86
+ ```
87
+
88
+ Per-channel durations:
89
+
90
+ ```ts
91
+ await universe.transition([
92
+ { channel: 1, value: 0, durationMs: 500 },
93
+ { channel: 10, value: 255, durationMs: 2_000 },
94
+ ]);
95
+ ```
96
+
97
+ Write a complete frame:
98
+
99
+ ```ts
100
+ const frame = new Uint8Array(512);
101
+ frame[0] = 255;
102
+ frame[1] = 128;
103
+ await universe.write(frame, { durationMs: 2_000 });
104
+ ```
105
+
106
+ Later writes win for channels already fading. Unmentioned channels retain their
107
+ current transitions and targets.
108
+
109
+ Inspect and clear output:
110
+
111
+ ```ts
112
+ const output = await universe.get();
113
+ const outputs = await source.listUniverses();
114
+ const removed = await universe.clear();
115
+ ```
116
+
117
+ ## Optional adapters
118
+
119
+ | Import | Peer dependency | Purpose |
120
+ | --- | --- | --- |
121
+ | `@helioslx/core/node` | `sacn` | Node UDP sender, receiver, process handlers, and runtime telemetry |
122
+ | `@helioslx/core/redis` | `redis` | Versioned output and viewer persistence |
123
+ | `@helioslx/core/http` | `elysia`, `@elysiajs/node`, `@elysiajs/openapi` | Unbound REST, OpenAPI, and viewer WebSocket routes |
124
+ | `@helioslx/core/testing` | none | Fake clock/receiver and recording transport |
125
+
126
+ The HTTP adapter does not bind a port, configure CORS, rate limit requests, or
127
+ choose an authentication policy. The host application owns those decisions.
128
+
129
+ ## Lifecycle and ownership
130
+
131
+ 1. Construct a source (and optional universe handles).
132
+ 2. Mutate output — the first output-demanding op restores state and starts
133
+ scheduling — or call `start()` explicitly.
134
+ 3. Await mutations; they are ordered with persistence.
135
+ 4. Call `stop()` to pause the scheduler while keeping state, or `close()` for
136
+ final teardown. Repeated `close()` calls are safe.
137
+
138
+ Root sources and viewers do not close injected transports, receivers, or stores
139
+ by default. Set the corresponding ownership option when transferring ownership.
140
+ `createSacnSource` from `@helioslx/core/node` creates and owns its transport and
141
+ registers for process-signal teardown (opt out with
142
+ `installProcessHandlers: false`). Default memory stores and internally-created
143
+ Redis clients are also owned.
144
+
145
+ Universe mutators accept `signal`. A timed-out send remains serialized until
146
+ the underlying transport promise settles, preventing overlapping sends even
147
+ when a transport ignores cancellation. Source transport shutdown is bounded by
148
+ `shutdownTimeoutMs` (2 seconds by default).
149
+
150
+ ## Documentation
151
+
152
+ Guides, API reference, examples, and community policies:
153
+ [helioslx/docs](https://github.com/helioslx/docs).
154
+
155
+ Runnable samples also live in [`examples/`](examples/).
156
+
157
+ ## License
158
+
159
+ Apache-2.0. See [LICENSE](LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,67 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Before `1.0`, security fixes are provided for the latest published minor
6
+ release. After `1.0`, the latest major release receives security fixes; older
7
+ branches may receive fixes at maintainer discretion.
8
+
9
+ | Version | Supported |
10
+ | --- | --- |
11
+ | Latest published release | Yes |
12
+ | Older releases | No |
13
+
14
+ ## Reporting a vulnerability
15
+
16
+ Do not open a public issue, discussion, or pull request for a suspected
17
+ vulnerability.
18
+
19
+ Use GitHub's private vulnerability reporting feature from the repository
20
+ **Security** tab. Include:
21
+
22
+ - affected versions and export subpaths
23
+ - impact and realistic threat model
24
+ - minimal reproduction or proof of concept
25
+ - required configuration and runtime
26
+ - suggested mitigation, if known
27
+ - whether details have been shared elsewhere
28
+
29
+ Remove production credentials, personal data, venue identifiers, and unsafe
30
+ live-lighting instructions. Use synthetic data and an isolated environment.
31
+
32
+ Maintainers aim to acknowledge a complete report within five business days.
33
+ They will validate impact, coordinate a fix and advisory, and provide status
34
+ updates when practical. Timelines depend on severity and release coordination.
35
+ Please allow a reasonable remediation period before disclosure.
36
+
37
+ ## Scope
38
+
39
+ Relevant reports include authentication-boundary mistakes in the adapter,
40
+ unsafe parsing or resource exhaustion, dependency compromise, Redis record
41
+ trust issues, network-originated crashes, provenance/release compromise, and
42
+ vulnerabilities in package code.
43
+
44
+ The following are generally out of scope unless they demonstrate a package
45
+ defect:
46
+
47
+ - exposed applications that did not configure the documented authentication,
48
+ binding, CORS, TLS, or rate limits
49
+ - denial of service requiring unrestricted access intentionally granted by the
50
+ host
51
+ - issues only in unsupported Node versions, browsers, or edge runtimes
52
+ - social engineering, physical attacks, and scanner-only reports without
53
+ demonstrated impact
54
+ - vulnerabilities exclusively in a dependency that should be reported to that
55
+ dependency first
56
+
57
+ Operational safety incidents are important but are not automatically security
58
+ vulnerabilities. Follow
59
+ [live-lighting safety](https://github.com/helioslx/docs/blob/main/content/docs/core/guides/safety.mdx)
60
+ immediately and use private reporting if an attacker can trigger the behavior.
61
+
62
+ ## Disclosure
63
+
64
+ The project follows coordinated disclosure. Confirmed issues may receive a
65
+ GitHub security advisory, CVE where appropriate, patched release with npm
66
+ provenance, changelog entry, and remediation guidance. Reporters may be
67
+ credited with permission.