fossekall-interface 0.1.0 → 0.1.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.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # fossekall-interface
2
+
3
+ `fossekall-interface` provides generated TypeScript interfaces/schemas for
4
+ Fossekall data objects.
5
+
6
+ Current package exports are telemetry schemas and types from `ecu/telemetry`.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install fossekall-interface
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ Import from the package root:
17
+
18
+ ```ts
19
+ import {
20
+ STATE_NAME,
21
+ BLDCTelemetry,
22
+ type BLDCTelemetry as BLDCTelemetryType,
23
+ FsmTelemetry,
24
+ type FsmTelemetry as FsmTelemetryType,
25
+ SawWaveTelemetry,
26
+ type SawWaveTelemetry as SawWaveTelemetryType,
27
+ } from "fossekall-interface";
28
+ ```
29
+
30
+ `index.ts` currently re-exports:
31
+
32
+ - `./ecu/telemetry`
33
+
34
+ ### Current Generated API
35
+
36
+ - `STATE_NAME`
37
+ - `type STATE_NAME`
38
+ - `BLDCTelemetry`
39
+ - `type BLDCTelemetry`
40
+ - `FsmTelemetry`
41
+ - `type FsmTelemetry`
42
+ - `SawWaveTelemetry`
43
+ - `type SawWaveTelemetry`
44
+
45
+ ## What Gets Published
46
+
47
+ Only the compiled output in `dist/` is published to npm.
48
+
49
+ This package ships:
50
+
51
+ - JavaScript (`dist/**/*.js`)
52
+ - Type declarations (`dist/**/*.d.ts`)
53
+
54
+ ## Source Layout
55
+
56
+ - `index.ts`: package root exports
57
+ - `ecu/telemetry.ts`: generated telemetry schemas/types
58
+ - `dist/`: compiled output used by npm consumers
59
+
60
+ ## Development
61
+
62
+ Run from this directory (`generated/`):
63
+
64
+ ```bash
65
+ npm install
66
+ npm run build
67
+ ```
68
+
69
+ The build uses `tsc` and outputs to `dist/`.
70
+
71
+ ## Publishing
72
+
73
+ 1. Update version:
74
+
75
+ ```bash
76
+ npm version patch
77
+ ```
78
+
79
+ 2. Publish:
80
+
81
+ ```bash
82
+ npm publish --access public
83
+ ```
84
+
85
+ If you publish using a token, configure `.npmrc` with:
86
+
87
+ ```ini
88
+ //registry.npmjs.org/:_authToken=${NPM_TOKEN}
89
+ ```
90
+
91
+ and export `NPM_TOKEN` in your shell before publishing.
@@ -0,0 +1,49 @@
1
+ import bin, { MaxValue, Schema, type IMeasurer, type ISerialInput, type ISerialOutput } from 'typed-binary';
2
+ declare class UInt64Schema extends Schema<bigint> {
3
+ readonly maxSize = 8;
4
+ read(input: ISerialInput): bigint;
5
+ write(output: ISerialOutput, value: bigint): void;
6
+ measure(_: bigint | typeof MaxValue, measurer?: IMeasurer): IMeasurer;
7
+ }
8
+ export declare const STATE_NAME: {
9
+ readonly IDLE: 0;
10
+ readonly N2_FILL: 1;
11
+ readonly N2_FILL_HOLD: 2;
12
+ readonly PRESSURIZE: 3;
13
+ readonly RUN: 4;
14
+ readonly HOLD: 5;
15
+ readonly CALIBRATE: 6;
16
+ };
17
+ export type STATE_NAME = (typeof STATE_NAME)[keyof typeof STATE_NAME];
18
+ export declare const BLDCTelemetry: import("typed-binary").ObjectSchema<{
19
+ valve_position: import("typed-binary").Float32Schema;
20
+ motor_position: import("typed-binary").Float32Schema;
21
+ upstream_pressure: import("typed-binary").Float32Schema;
22
+ downstream_pressure: import("typed-binary").Float32Schema;
23
+ venturi_pressure: import("typed-binary").Float32Schema;
24
+ timestamp: UInt64Schema;
25
+ current_draw: import("typed-binary").Float32Schema;
26
+ u_p: import("typed-binary").Float32Schema;
27
+ u_i: import("typed-binary").Float32Schema;
28
+ u_d: import("typed-binary").Float32Schema;
29
+ u_pid: import("typed-binary").Float32Schema;
30
+ u_ff: import("typed-binary").Float32Schema;
31
+ u_set: import("typed-binary").Float32Schema;
32
+ u_total: import("typed-binary").Float32Schema;
33
+ position_raw: import("typed-binary").Float32Schema;
34
+ servo_encoder: import("typed-binary").Float32Schema;
35
+ calibrated: import("typed-binary").ByteSchema;
36
+ fsm_state: import("typed-binary").Uint16Schema;
37
+ }>;
38
+ export type BLDCTelemetry = bin.Parsed<typeof BLDCTelemetry>;
39
+ export declare const FsmTelemetry: import("typed-binary").ObjectSchema<{
40
+ currentState: import("typed-binary").Uint16Schema;
41
+ }>;
42
+ export type FsmTelemetry = bin.Parsed<typeof FsmTelemetry>;
43
+ export declare const SawWaveTelemetry: import("typed-binary").ObjectSchema<{
44
+ value: import("typed-binary").Float32Schema;
45
+ inverse: import("typed-binary").Float32Schema;
46
+ derivative: import("typed-binary").Float32Schema;
47
+ }>;
48
+ export type SawWaveTelemetry = bin.Parsed<typeof SawWaveTelemetry>;
49
+ export {};
@@ -0,0 +1,99 @@
1
+ import bin, { Measurer, Schema } from 'typed-binary';
2
+ // This file was generated by FRICC on 2026-03-05 14:48:28. Do not edit manually!
3
+ // The current version of typed-binary does not support 64-bit primitives.
4
+ // So for we'll implement our own schemas. :)
5
+ const __littleEndian = true;
6
+ class UInt64Schema extends Schema {
7
+ maxSize = 8;
8
+ read(input) {
9
+ const bytes = new Uint8Array(8);
10
+ input.readSlice(bytes, 0, 8);
11
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
12
+ return view.getBigUint64(0, __littleEndian);
13
+ }
14
+ write(output, value) {
15
+ const bytes = new Uint8Array(8);
16
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
17
+ view.setBigUint64(0, value, __littleEndian);
18
+ output.writeSlice(bytes);
19
+ }
20
+ measure(_, measurer = new Measurer()) {
21
+ return measurer.add(8);
22
+ }
23
+ }
24
+ class Int64Schema extends Schema {
25
+ maxSize = 8;
26
+ read(input) {
27
+ const bytes = new Uint8Array(8);
28
+ input.readSlice(bytes, 0, 8);
29
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
30
+ return view.getBigInt64(0, __littleEndian);
31
+ }
32
+ write(output, value) {
33
+ const bytes = new Uint8Array(8);
34
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
35
+ view.setBigInt64(0, value, __littleEndian);
36
+ output.writeSlice(bytes);
37
+ }
38
+ measure(_, measurer = new Measurer()) {
39
+ return measurer.add(8);
40
+ }
41
+ }
42
+ class Float64Schema extends Schema {
43
+ maxSize = 8;
44
+ read(input) {
45
+ const bytes = new Uint8Array(8);
46
+ input.readSlice(bytes, 0, 8);
47
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
48
+ return view.getFloat64(0, __littleEndian);
49
+ }
50
+ write(output, value) {
51
+ const bytes = new Uint8Array(8);
52
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
53
+ view.setFloat64(0, value, __littleEndian);
54
+ output.writeSlice(bytes);
55
+ }
56
+ measure(_, measurer = new Measurer()) {
57
+ return measurer.add(8);
58
+ }
59
+ }
60
+ const u64 = new UInt64Schema();
61
+ const i64 = new Int64Schema();
62
+ const f64 = new Float64Schema();
63
+ export const STATE_NAME = {
64
+ IDLE: 0,
65
+ N2_FILL: 1,
66
+ N2_FILL_HOLD: 2,
67
+ PRESSURIZE: 3,
68
+ RUN: 4,
69
+ HOLD: 5,
70
+ CALIBRATE: 6,
71
+ };
72
+ export const BLDCTelemetry = bin.object({
73
+ valve_position: bin.f32, // float
74
+ motor_position: bin.f32, // float
75
+ upstream_pressure: bin.f32, // float
76
+ downstream_pressure: bin.f32, // float
77
+ venturi_pressure: bin.f32, // float
78
+ timestamp: u64, // unsigned long long
79
+ current_draw: bin.f32, // float
80
+ u_p: bin.f32, // float
81
+ u_i: bin.f32, // float
82
+ u_d: bin.f32, // float
83
+ u_pid: bin.f32, // float
84
+ u_ff: bin.f32, // float
85
+ u_set: bin.f32, // float
86
+ u_total: bin.f32, // float
87
+ position_raw: bin.f32, // float
88
+ servo_encoder: bin.f32, // float
89
+ calibrated: bin.u8, // unsigned char
90
+ fsm_state: bin.u16, // STATE_NAME
91
+ });
92
+ export const FsmTelemetry = bin.object({
93
+ currentState: bin.u16, // STATE_NAME
94
+ });
95
+ export const SawWaveTelemetry = bin.object({
96
+ value: bin.f32, // float
97
+ inverse: bin.f32, // float
98
+ derivative: bin.f32, // float
99
+ });
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- export * from "./fc/anothertest";
2
- export * from "./ecu/test";
1
+ export * from "./ecu/telemetry";
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./fc/anothertest";
2
- export * from "./ecu/test";
1
+ export * from "./ecu/telemetry";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fossekall-interface",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "API contracts between client and server (rocket and GUI)",
5
5
  "license": "ISC",
6
6
  "author": "Propulse",
@@ -13,9 +13,13 @@
13
13
  "scripts": {
14
14
  "test": "echo \"Error: no test specified\" && exit 1",
15
15
  "build": "tsc -p tsconfig.json",
16
- "prepack": "npm run build"
16
+ "prepack": "npm run build",
17
+ "publish": "npm publish --access private"
17
18
  },
18
19
  "devDependencies": {
19
20
  "typescript": "^5.9.3"
21
+ },
22
+ "dependencies": {
23
+ "typed-binary": "^4.3.2"
20
24
  }
21
25
  }
@@ -1,4 +0,0 @@
1
- export declare const EcuTestObject: {
2
- name: string;
3
- description: string;
4
- };
package/dist/ecu/test.js DELETED
@@ -1,4 +0,0 @@
1
- export const EcuTestObject = {
2
- name: "Test object",
3
- description: "This is a test object for the ECU module.",
4
- };
@@ -1,4 +0,0 @@
1
- export declare const FcTestObject: {
2
- name: string;
3
- description: string;
4
- };
@@ -1,4 +0,0 @@
1
- export const FcTestObject = {
2
- name: "Test object",
3
- description: "This is a test object for the FC module.",
4
- };