@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/dist/http.d.ts ADDED
@@ -0,0 +1,643 @@
1
+ import { F as ViewerPacket, O as SacnSourceContract, R as ViewerServiceContract, b as OutputSnapshot, c as EngineTelemetry } from "./contracts-C4kpAdZq.js";
2
+ import { Elysia } from "elysia";
3
+ //#region src/http.d.ts
4
+ interface HttpAuthContext {
5
+ readonly request: Request;
6
+ }
7
+ type HttpAuthHook = (context: HttpAuthContext) => boolean | Response | void | Promise<boolean | Response | void>;
8
+ interface SacnHttpAdapterOptions {
9
+ readonly source: SacnSourceContract;
10
+ readonly viewer?: ViewerServiceContract;
11
+ /** Defaults to `/sacn`. */
12
+ readonly prefix?: string;
13
+ /** Authentication hook; returning false produces 401, and Response is forwarded. */
14
+ readonly auth?: HttpAuthHook;
15
+ /** Called for every normalized viewer packet; useful for WebSocket/SSE bridges. */
16
+ readonly onViewerPacket?: (packet: ViewerPacket) => void;
17
+ /** Value used by deprecated compatibility routes. */
18
+ readonly sunset?: string;
19
+ /** OpenAPI document path. Defaults to `/openapi`. */
20
+ readonly openapiPath?: string;
21
+ /** Maximum concurrent viewer WebSocket clients. Defaults to 64. */
22
+ readonly maxWebSocketClients?: number;
23
+ /** Coalesced packet queue per WebSocket client. Defaults to 32 universes. */
24
+ readonly webSocketQueueCapacity?: number;
25
+ }
26
+ /**
27
+ * Creates an unbound Elysia route plugin. CORS and server binding deliberately
28
+ * remain the host application's responsibility.
29
+ */
30
+ declare const createSacnHttpAdapter: (options: SacnHttpAdapterOptions) => Elysia<string, {
31
+ decorator: {};
32
+ store: {};
33
+ derive: {};
34
+ resolve: {};
35
+ }, {
36
+ typebox: {};
37
+ error: {};
38
+ } & {
39
+ typebox: {};
40
+ error: {};
41
+ }, {
42
+ schema: {};
43
+ standaloneSchema: {};
44
+ macro: {};
45
+ macroFn: {};
46
+ parser: {};
47
+ response: {};
48
+ } & {
49
+ schema: {};
50
+ standaloneSchema: {};
51
+ macro: {};
52
+ macroFn: {};
53
+ parser: {};
54
+ response: {};
55
+ }, {
56
+ [x: string]: {};
57
+ } & {
58
+ [x: string]: {
59
+ health: {
60
+ live: {
61
+ get: {
62
+ body: unknown;
63
+ params: {};
64
+ query: unknown;
65
+ headers: unknown;
66
+ response: {
67
+ 200: {
68
+ status: "ok";
69
+ };
70
+ 422: {
71
+ type: 'validation';
72
+ on: string;
73
+ summary?: string;
74
+ message?: string;
75
+ found?: unknown;
76
+ property?: string;
77
+ expected?: string;
78
+ };
79
+ };
80
+ };
81
+ };
82
+ };
83
+ };
84
+ } & {
85
+ [x: string]: {
86
+ health: {
87
+ ready: {
88
+ get: {
89
+ body: unknown;
90
+ params: {};
91
+ query: unknown;
92
+ headers: unknown;
93
+ response: {
94
+ 200: {
95
+ status: "ready";
96
+ };
97
+ 422: {
98
+ type: 'validation';
99
+ on: string;
100
+ summary?: string;
101
+ message?: string;
102
+ found?: unknown;
103
+ property?: string;
104
+ expected?: string;
105
+ };
106
+ 503: {
107
+ status: "not-ready";
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
113
+ };
114
+ } & {
115
+ [x: string]: {
116
+ universes: {
117
+ get: {
118
+ body: unknown;
119
+ params: {};
120
+ query: unknown;
121
+ headers: unknown;
122
+ response: {
123
+ 200: readonly OutputSnapshot[] | Response | {
124
+ error: string;
125
+ } | {
126
+ error: string;
127
+ };
128
+ };
129
+ };
130
+ };
131
+ };
132
+ } & {
133
+ [x: string]: {
134
+ engine: {
135
+ telemetry: {
136
+ get: {
137
+ body: unknown;
138
+ params: {};
139
+ query: unknown;
140
+ headers: unknown;
141
+ response: {
142
+ 200: EngineTelemetry | Response | {
143
+ error: string;
144
+ } | {
145
+ error: string;
146
+ };
147
+ };
148
+ };
149
+ };
150
+ };
151
+ };
152
+ } & {
153
+ [x: string]: {
154
+ universes: {
155
+ ":universe": {
156
+ priorities: {
157
+ ":priority": {
158
+ get: {
159
+ body: unknown;
160
+ params: {
161
+ universe: string;
162
+ priority: string;
163
+ };
164
+ query: unknown;
165
+ headers: unknown;
166
+ response: {
167
+ 200: OutputSnapshot | Response | {
168
+ error: string;
169
+ } | {
170
+ error: string;
171
+ };
172
+ 422: {
173
+ type: 'validation';
174
+ on: string;
175
+ summary?: string;
176
+ message?: string;
177
+ found?: unknown;
178
+ property?: string;
179
+ expected?: string;
180
+ };
181
+ };
182
+ };
183
+ };
184
+ };
185
+ };
186
+ };
187
+ };
188
+ } & {
189
+ [x: string]: {
190
+ universes: {
191
+ ":universe": {
192
+ priorities: {
193
+ ":priority": {
194
+ put: {
195
+ body: {
196
+ cid?: string;
197
+ idleFps?: number;
198
+ sourceName?: string;
199
+ initialValues?: number[];
200
+ values?: number[];
201
+ durationMs?: number;
202
+ };
203
+ params: {
204
+ universe: string;
205
+ priority: string;
206
+ };
207
+ query: unknown;
208
+ headers: unknown;
209
+ response: {
210
+ 200: OutputSnapshot | Response | {
211
+ error: string;
212
+ } | {
213
+ error: string;
214
+ };
215
+ 422: {
216
+ type: 'validation';
217
+ on: string;
218
+ summary?: string;
219
+ message?: string;
220
+ found?: unknown;
221
+ property?: string;
222
+ expected?: string;
223
+ };
224
+ };
225
+ };
226
+ };
227
+ };
228
+ };
229
+ };
230
+ };
231
+ } & {
232
+ [x: string]: {
233
+ universes: {
234
+ ":universe": {
235
+ priorities: {
236
+ ":priority": {
237
+ channels: {
238
+ post: {
239
+ body: {
240
+ cid?: string;
241
+ idleFps?: number;
242
+ sourceName?: string;
243
+ channels: {
244
+ channel: number;
245
+ value: number;
246
+ durationMs?: number;
247
+ }[] | {
248
+ [x: string]: number;
249
+ };
250
+ durationMs?: number;
251
+ } | {
252
+ cid?: string;
253
+ idleFps?: number;
254
+ sourceName?: string;
255
+ changes: {
256
+ channel: number;
257
+ value: number;
258
+ durationMs?: number;
259
+ }[];
260
+ durationMs?: number;
261
+ };
262
+ params: {
263
+ universe: string;
264
+ priority: string;
265
+ };
266
+ query: unknown;
267
+ headers: unknown;
268
+ response: {
269
+ 200: OutputSnapshot | Response | {
270
+ error: string;
271
+ } | {
272
+ error: string;
273
+ };
274
+ 422: {
275
+ type: 'validation';
276
+ on: string;
277
+ summary?: string;
278
+ message?: string;
279
+ found?: unknown;
280
+ property?: string;
281
+ expected?: string;
282
+ };
283
+ };
284
+ };
285
+ };
286
+ };
287
+ };
288
+ };
289
+ };
290
+ };
291
+ } & {
292
+ [x: string]: {
293
+ universes: {
294
+ ":universe": {
295
+ priorities: {
296
+ ":priority": {
297
+ frame: {
298
+ post: {
299
+ body: {
300
+ cid?: string;
301
+ idleFps?: number;
302
+ sourceName?: string;
303
+ values: number[];
304
+ durationMs?: number;
305
+ };
306
+ params: {
307
+ universe: string;
308
+ priority: string;
309
+ };
310
+ query: unknown;
311
+ headers: unknown;
312
+ response: {
313
+ 200: OutputSnapshot | Response | {
314
+ error: string;
315
+ } | {
316
+ error: string;
317
+ };
318
+ 422: {
319
+ type: 'validation';
320
+ on: string;
321
+ summary?: string;
322
+ message?: string;
323
+ found?: unknown;
324
+ property?: string;
325
+ expected?: string;
326
+ };
327
+ };
328
+ };
329
+ };
330
+ };
331
+ };
332
+ };
333
+ };
334
+ };
335
+ } & {
336
+ [x: string]: {
337
+ universes: {
338
+ ":universe": {
339
+ priorities: {
340
+ ":priority": {
341
+ delete: {
342
+ body: unknown;
343
+ params: {
344
+ universe: string;
345
+ priority: string;
346
+ };
347
+ query: unknown;
348
+ headers: unknown;
349
+ response: {
350
+ 200: Response | {
351
+ error: string;
352
+ } | {
353
+ error: string;
354
+ } | {
355
+ ok: true;
356
+ };
357
+ 422: {
358
+ type: 'validation';
359
+ on: string;
360
+ summary?: string;
361
+ message?: string;
362
+ found?: unknown;
363
+ property?: string;
364
+ expected?: string;
365
+ };
366
+ };
367
+ };
368
+ };
369
+ };
370
+ };
371
+ };
372
+ };
373
+ } & {
374
+ [x: string]: {
375
+ outputs: {
376
+ get: {
377
+ body: unknown;
378
+ params: {};
379
+ query: unknown;
380
+ headers: unknown;
381
+ response: {
382
+ 200: readonly OutputSnapshot[] | Response | {
383
+ error: string;
384
+ } | {
385
+ error: string;
386
+ };
387
+ };
388
+ };
389
+ };
390
+ };
391
+ } & {
392
+ [x: string]: {
393
+ telemetry: {
394
+ get: {
395
+ body: unknown;
396
+ params: {};
397
+ query: unknown;
398
+ headers: unknown;
399
+ response: {
400
+ 200: EngineTelemetry | Response | {
401
+ error: string;
402
+ } | {
403
+ error: string;
404
+ };
405
+ };
406
+ };
407
+ };
408
+ };
409
+ } & {
410
+ [x: string]: {
411
+ outputs: {
412
+ ":universe": {
413
+ ":priority": {
414
+ get: {
415
+ body: unknown;
416
+ params: {
417
+ universe: string;
418
+ priority: string;
419
+ };
420
+ query: unknown;
421
+ headers: unknown;
422
+ response: {
423
+ 200: OutputSnapshot | Response | {
424
+ error: string;
425
+ } | {
426
+ error: string;
427
+ };
428
+ 422: {
429
+ type: 'validation';
430
+ on: string;
431
+ summary?: string;
432
+ message?: string;
433
+ found?: unknown;
434
+ property?: string;
435
+ expected?: string;
436
+ };
437
+ };
438
+ };
439
+ };
440
+ };
441
+ };
442
+ };
443
+ } & {
444
+ [x: string]: {
445
+ outputs: {
446
+ ":universe": {
447
+ ":priority": {
448
+ put: {
449
+ body: {
450
+ cid?: string;
451
+ idleFps?: number;
452
+ sourceName?: string;
453
+ initialValues?: number[];
454
+ values?: number[];
455
+ durationMs?: number;
456
+ };
457
+ params: {
458
+ universe: string;
459
+ priority: string;
460
+ };
461
+ query: unknown;
462
+ headers: unknown;
463
+ response: {
464
+ 200: OutputSnapshot | Response | {
465
+ error: string;
466
+ } | {
467
+ error: string;
468
+ };
469
+ 422: {
470
+ type: 'validation';
471
+ on: string;
472
+ summary?: string;
473
+ message?: string;
474
+ found?: unknown;
475
+ property?: string;
476
+ expected?: string;
477
+ };
478
+ };
479
+ };
480
+ };
481
+ };
482
+ };
483
+ };
484
+ } & {
485
+ [x: string]: {
486
+ outputs: {
487
+ ":universe": {
488
+ ":priority": {
489
+ channels: {
490
+ post: {
491
+ body: {
492
+ cid?: string;
493
+ idleFps?: number;
494
+ sourceName?: string;
495
+ channels: {
496
+ channel: number;
497
+ value: number;
498
+ durationMs?: number;
499
+ }[] | {
500
+ [x: string]: number;
501
+ };
502
+ durationMs?: number;
503
+ } | {
504
+ cid?: string;
505
+ idleFps?: number;
506
+ sourceName?: string;
507
+ changes: {
508
+ channel: number;
509
+ value: number;
510
+ durationMs?: number;
511
+ }[];
512
+ durationMs?: number;
513
+ };
514
+ params: {
515
+ universe: string;
516
+ priority: string;
517
+ };
518
+ query: unknown;
519
+ headers: unknown;
520
+ response: {
521
+ 200: OutputSnapshot | Response | {
522
+ error: string;
523
+ } | {
524
+ error: string;
525
+ };
526
+ 422: {
527
+ type: 'validation';
528
+ on: string;
529
+ summary?: string;
530
+ message?: string;
531
+ found?: unknown;
532
+ property?: string;
533
+ expected?: string;
534
+ };
535
+ };
536
+ };
537
+ };
538
+ };
539
+ };
540
+ };
541
+ };
542
+ } & {
543
+ [x: string]: {
544
+ outputs: {
545
+ ":universe": {
546
+ ":priority": {
547
+ frame: {
548
+ post: {
549
+ body: {
550
+ cid?: string;
551
+ idleFps?: number;
552
+ sourceName?: string;
553
+ values: number[];
554
+ durationMs?: number;
555
+ };
556
+ params: {
557
+ universe: string;
558
+ priority: string;
559
+ };
560
+ query: unknown;
561
+ headers: unknown;
562
+ response: {
563
+ 200: OutputSnapshot | Response | {
564
+ error: string;
565
+ } | {
566
+ error: string;
567
+ };
568
+ 422: {
569
+ type: 'validation';
570
+ on: string;
571
+ summary?: string;
572
+ message?: string;
573
+ found?: unknown;
574
+ property?: string;
575
+ expected?: string;
576
+ };
577
+ };
578
+ };
579
+ };
580
+ };
581
+ };
582
+ };
583
+ };
584
+ } & {
585
+ [x: string]: {
586
+ outputs: {
587
+ ":universe": {
588
+ ":priority": {
589
+ delete: {
590
+ body: unknown;
591
+ params: {
592
+ universe: string;
593
+ priority: string;
594
+ };
595
+ query: unknown;
596
+ headers: unknown;
597
+ response: {
598
+ 200: Response | {
599
+ error: string;
600
+ } | {
601
+ error: string;
602
+ } | {
603
+ ok: true;
604
+ };
605
+ 422: {
606
+ type: 'validation';
607
+ on: string;
608
+ summary?: string;
609
+ message?: string;
610
+ found?: unknown;
611
+ property?: string;
612
+ expected?: string;
613
+ };
614
+ };
615
+ };
616
+ };
617
+ };
618
+ };
619
+ };
620
+ }, {
621
+ derive: {};
622
+ resolve: {};
623
+ schema: {};
624
+ standaloneSchema: {};
625
+ response: {};
626
+ }, {
627
+ derive: {};
628
+ resolve: {};
629
+ schema: {};
630
+ standaloneSchema: {};
631
+ response: {
632
+ 200: Response | {
633
+ error: string;
634
+ } | {
635
+ error: string;
636
+ };
637
+ };
638
+ }>;
639
+ /** Connects viewer packets to a host-owned WebSocket or SSE implementation. */
640
+ declare const subscribeViewerPackets: (viewer: ViewerServiceContract, listener: (packet: ViewerPacket) => void) => (() => void);
641
+ //#endregion
642
+ export { HttpAuthContext, HttpAuthHook, SacnHttpAdapterOptions, createSacnHttpAdapter, subscribeViewerPackets };
643
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","names":[],"sources":["../src/http.ts"],"mappings":";;;UAqBiB;WACN,SAAS;;KAGR,gBACV,SAAS,8BACI,kBAAkB,kBAAkB;UAElC;WACN,QAAQ;WACR,SAAS;;WAET;;WAEA,OAAO;;WAEP,kBAAkB,QAAQ;;WAE1B;;WAEA;;WAEA;;WAEA;;;;;;cAsXE,wBAAqB,SAAa,2BAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsqBlC,yBAAsB,QACzB,uBAAqB,WAClB,QAAQ"}