@ntcore-ts/client 1.0.0-beta.2

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 (56) hide show
  1. package/README.md +51 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.esm.js +4845 -0
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/lib/client.d.ts +262 -0
  7. package/dist/lib/client.d.ts.map +1 -0
  8. package/dist/lib/index.d.ts +8 -0
  9. package/dist/lib/index.d.ts.map +1 -0
  10. package/dist/lib/pubsub/base-topic.d.ts +104 -0
  11. package/dist/lib/pubsub/base-topic.d.ts.map +1 -0
  12. package/dist/lib/pubsub/index.d.ts +6 -0
  13. package/dist/lib/pubsub/index.d.ts.map +1 -0
  14. package/dist/lib/pubsub/json-topic.d.ts +50 -0
  15. package/dist/lib/pubsub/json-topic.d.ts.map +1 -0
  16. package/dist/lib/pubsub/prefix-topic.d.ts +45 -0
  17. package/dist/lib/pubsub/prefix-topic.d.ts.map +1 -0
  18. package/dist/lib/pubsub/protobuf-schema-manager.d.ts +96 -0
  19. package/dist/lib/pubsub/protobuf-schema-manager.d.ts.map +1 -0
  20. package/dist/lib/pubsub/protobuf-topic.d.ts +126 -0
  21. package/dist/lib/pubsub/protobuf-topic.d.ts.map +1 -0
  22. package/dist/lib/pubsub/pubsub.d.ts +134 -0
  23. package/dist/lib/pubsub/pubsub.d.ts.map +1 -0
  24. package/dist/lib/pubsub/struct-topic.d.ts +40 -0
  25. package/dist/lib/pubsub/struct-topic.d.ts.map +1 -0
  26. package/dist/lib/pubsub/topic.d.ts +134 -0
  27. package/dist/lib/pubsub/topic.d.ts.map +1 -0
  28. package/dist/lib/socket/messenger.d.ts +104 -0
  29. package/dist/lib/socket/messenger.d.ts.map +1 -0
  30. package/dist/lib/socket/socket.d.ts +193 -0
  31. package/dist/lib/socket/socket.d.ts.map +1 -0
  32. package/dist/lib/struct/built-in-schemas.d.ts +21 -0
  33. package/dist/lib/struct/built-in-schemas.d.ts.map +1 -0
  34. package/dist/lib/struct/geometry.d.ts +129 -0
  35. package/dist/lib/struct/geometry.d.ts.map +1 -0
  36. package/dist/lib/struct/index.d.ts +5 -0
  37. package/dist/lib/struct/index.d.ts.map +1 -0
  38. package/dist/lib/struct/struct-codec.d.ts +14 -0
  39. package/dist/lib/struct/struct-codec.d.ts.map +1 -0
  40. package/dist/lib/struct/struct-descriptor.d.ts +60 -0
  41. package/dist/lib/struct/struct-descriptor.d.ts.map +1 -0
  42. package/dist/lib/struct/struct-parser.d.ts +28 -0
  43. package/dist/lib/struct/struct-parser.d.ts.map +1 -0
  44. package/dist/lib/struct/struct-schema-manager.d.ts +41 -0
  45. package/dist/lib/struct/struct-schema-manager.d.ts.map +1 -0
  46. package/dist/lib/types/index.d.ts +2 -0
  47. package/dist/lib/types/index.d.ts.map +1 -0
  48. package/dist/lib/types/schemas.d.ts +269 -0
  49. package/dist/lib/types/schemas.d.ts.map +1 -0
  50. package/dist/lib/types/types.d.ts +66 -0
  51. package/dist/lib/types/types.d.ts.map +1 -0
  52. package/dist/lib/util/logger.d.ts +60 -0
  53. package/dist/lib/util/logger.d.ts.map +1 -0
  54. package/dist/lib/util/util.d.ts +68 -0
  55. package/dist/lib/util/util.d.ts.map +1 -0
  56. package/package.json +64 -0
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @ntcore-ts/client
2
+
3
+ TypeScript client for [WPILib's NetworkTables 4.1 protocol](https://github.com/wpilibsuite/allwpilib/blob/main/ntcore/doc/networktables4.adoc).
4
+
5
+ ## Documentation
6
+
7
+ Full guides and API reference: [https://ntcore.chrislawson.dev](https://ntcore.chrislawson.dev)
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install --save @ntcore-ts/client
13
+ ```
14
+
15
+ ```typescript
16
+ import { NetworkTables } from '@ntcore-ts/client';
17
+
18
+ const ntcore = NetworkTables.getInstanceByTeam(973);
19
+ const gyro = ntcore.getDoubleTopic('/MyTable/Gyro');
20
+ gyro.subscribe((value) => console.log(value));
21
+ ```
22
+
23
+ ## Building
24
+
25
+ Run `npm run build -w @ntcore-ts/client` (or `npx turbo run build --filter=@ntcore-ts/client`) to build the library.
26
+
27
+ ## Running unit tests
28
+
29
+ Run `npm run test -w @ntcore-ts/client` (or `npm test` from the repo root) to execute the unit tests via [Vitest](https://vitest.dev).
30
+
31
+ ## Benchmarks
32
+
33
+ Benchmarks measure how fast the client processes WebSocket messages. They are **not** run in the default test suite.
34
+
35
+ **How to run**
36
+
37
+ - From the repo root: `npm run bench`
38
+ - From the package: `npx vitest bench --run` (in `packages/client`)
39
+
40
+ **What is measured**
41
+
42
+ - **Tier 1 (hot path)**: Binary frame processing in isolation—decode (msgpack), schema parse, and callback. Benchmarks: one frame with 1, 10, or 100 messages.
43
+ - **Tier 2 (mock WebSocket)**: End-to-end from mock server send to `onTopicUpdate` callback—WebSocket event → `onMessage` → `handleBinaryFrame` → callback.
44
+
45
+ Both tiers use a mock server (no real NT server or robot). Results are reported as Hz (ops/sec), with min/max/mean and percentiles (e.g. p99).
46
+
47
+ **Findings**
48
+
49
+ - **Tier 1 (hot path)** on typical hardware: ~550k–875k single-message frames/sec; ~115k–146k frames/sec with 10 messages per frame (~1.15M–1.5M messages/sec); ~12k–16k frames/sec with 100 messages per frame (~1.2M–1.6M messages/sec). Mean latency per frame is in the **microseconds** (e.g. ~1.1 µs for one message, ~6–7 µs for 10, ~63–67 µs for 100).
50
+ - **Tier 2 (mock WebSocket)** exercises the full path from mock send to `onTopicUpdate`; throughput is in the same order of magnitude as Tier 1 for batched frames.
51
+ - **Conclusion**: For normal FRC/NetworkTables use (tens to low thousands of topic updates per second over the network), the client can process far more than real traffic. The bottleneck in practice is the **network** (latency, bandwidth) and the NT server, not this client’s message processing.
@@ -0,0 +1,2 @@
1
+ export * from './lib';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}