measur-tools-suite 1.2.1-beta.4 → 1.2.1-beta.5

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 (99) hide show
  1. package/.claude/CLAUDE.md +12 -28
  2. package/AGENTS.md +113 -22
  3. package/ARCHITECTURE.md +147 -1
  4. package/bin/README.md +140 -0
  5. package/bin/package.json +1 -1
  6. package/bin/ts_def_modules/binding/registered_vectors.d.ts +2 -2
  7. package/bin/ts_def_modules/compressedAir/compressedAir.d.ts +58 -23
  8. package/bin/ts_def_modules/compressedAir/compressorsCalc.d.ts +329 -234
  9. package/bin/ts_def_modules/compressedAir/dryer_operating_cost.d.ts +26 -7
  10. package/bin/ts_def_modules/compressedAir/leak_survey/bag_method.d.ts +5 -0
  11. package/bin/ts_def_modules/compressedAir/leak_survey/compressed_air_leak_survey.d.ts +14 -0
  12. package/bin/ts_def_modules/compressedAir/leak_survey/decibels_method.d.ts +13 -0
  13. package/bin/ts_def_modules/compressedAir/leak_survey/estimate_method.d.ts +3 -0
  14. package/bin/ts_def_modules/compressedAir/leak_survey/orifice_method.d.ts +14 -0
  15. package/bin/ts_def_modules/compressedAir/operating_cost.d.ts +13 -2
  16. package/bin/ts_def_modules/compressedAir/pipe_sizing.d.ts +6 -0
  17. package/bin/ts_def_modules/compressedAir/pneumatic_air_requirement.d.ts +12 -0
  18. package/bin/ts_def_modules/compressedAir/pneumatic_valve.d.ts +7 -0
  19. package/bin/ts_def_modules/compressedAir/receiver_tank.d.ts +36 -0
  20. package/bin/ts_def_modules/databases/default_data.d.ts +1 -1
  21. package/bin/ts_def_modules/motorDriven/fans/fan.d.ts +180 -107
  22. package/bin/ts_def_modules/motorDriven/fans/fan_affinity_laws.d.ts +8 -10
  23. package/bin/ts_def_modules/motorDriven/motor/motor.d.ts +65 -62
  24. package/bin/ts_def_modules/motorDriven/motor/motorEnum.d.ts +1 -1
  25. package/bin/ts_def_modules/motorDriven/pump/pump.d.ts +36 -36
  26. package/bin/ts_def_modules/motorDriven/pump/pump_valve_power_loss.d.ts +4 -4
  27. package/bin/ts_def_modules/motorDriven/pumpFan/pumpFan.d.ts +23 -23
  28. package/bin/ts_def_modules/other/chp.d.ts +1 -1
  29. package/bin/ts_def_modules/other/lighting_data.d.ts +16 -16
  30. package/bin/ts_def_modules/other/powerFactor.d.ts +17 -17
  31. package/bin/ts_def_modules/physics/gas_compositions.d.ts +2 -2
  32. package/bin/ts_def_modules/processCooling/chillers.d.ts +2 -2
  33. package/bin/ts_def_modules/processCooling/process_cooling.d.ts +17 -17
  34. package/bin/ts_def_modules/processHeat/air_heating_using_exhaust.d.ts +4 -4
  35. package/bin/ts_def_modules/processHeat/flow_calculations_energy_use.d.ts +1 -1
  36. package/bin/ts_def_modules/processHeat/losses/leakage_heat_loss.d.ts +1 -1
  37. package/bin/ts_def_modules/steam/steam_leak_survey.d.ts +33 -32
  38. package/bin/ts_def_modules/steam/water_heating_using_steam.d.ts +3 -3
  39. package/bin/ts_def_modules/steamModeler/ssmt.d.ts +44 -41
  40. package/bin/ts_def_modules/steamModeler/ssmtModeler.d.ts +16 -16
  41. package/bin/ts_def_modules/treasureHunt/compressed_air_pressure_reduction.d.ts +2 -2
  42. package/bin/ts_def_modules/treasureHunt/compressed_air_reduction.d.ts +11 -11
  43. package/bin/ts_def_modules/treasureHunt/electricity_reduction.d.ts +16 -16
  44. package/bin/ts_def_modules/treasureHunt/insulated_pipe_reduction.d.ts +4 -4
  45. package/bin/ts_def_modules/treasureHunt/insulated_tank_reduction.d.ts +8 -8
  46. package/bin/ts_def_modules/treasureHunt/natural_gas_reduction.d.ts +6 -6
  47. package/bin/ts_def_modules/treasureHunt/steam_reduction.d.ts +5 -5
  48. package/bin/ts_def_modules/treasureHunt/water_reduction.d.ts +6 -6
  49. package/bin/ts_def_modules/wasteWater/svi.d.ts +9 -9
  50. package/bin/ts_def_modules/wasteWater/wasteWater.d.ts +150 -61
  51. package/bin/ts_def_modules/water/waterAssessment.d.ts +66 -66
  52. package/package.json +1 -1
  53. package/ts_def/README.md +140 -0
  54. package/ts_def/ts_def_modules/binding/registered_vectors.d.ts +2 -2
  55. package/ts_def/ts_def_modules/compressedAir/compressedAir.d.ts +58 -23
  56. package/ts_def/ts_def_modules/compressedAir/compressorsCalc.d.ts +329 -234
  57. package/ts_def/ts_def_modules/compressedAir/dryer_operating_cost.d.ts +26 -7
  58. package/ts_def/ts_def_modules/compressedAir/leak_survey/bag_method.d.ts +5 -0
  59. package/ts_def/ts_def_modules/compressedAir/leak_survey/compressed_air_leak_survey.d.ts +14 -0
  60. package/ts_def/ts_def_modules/compressedAir/leak_survey/decibels_method.d.ts +13 -0
  61. package/ts_def/ts_def_modules/compressedAir/leak_survey/estimate_method.d.ts +3 -0
  62. package/ts_def/ts_def_modules/compressedAir/leak_survey/orifice_method.d.ts +14 -0
  63. package/ts_def/ts_def_modules/compressedAir/operating_cost.d.ts +13 -2
  64. package/ts_def/ts_def_modules/compressedAir/pipe_sizing.d.ts +6 -0
  65. package/ts_def/ts_def_modules/compressedAir/pneumatic_air_requirement.d.ts +12 -0
  66. package/ts_def/ts_def_modules/compressedAir/pneumatic_valve.d.ts +7 -0
  67. package/ts_def/ts_def_modules/compressedAir/receiver_tank.d.ts +36 -0
  68. package/ts_def/ts_def_modules/databases/default_data.d.ts +1 -1
  69. package/ts_def/ts_def_modules/motorDriven/fans/fan.d.ts +180 -107
  70. package/ts_def/ts_def_modules/motorDriven/fans/fan_affinity_laws.d.ts +8 -10
  71. package/ts_def/ts_def_modules/motorDriven/motor/motor.d.ts +65 -62
  72. package/ts_def/ts_def_modules/motorDriven/motor/motorEnum.d.ts +1 -1
  73. package/ts_def/ts_def_modules/motorDriven/pump/pump.d.ts +36 -36
  74. package/ts_def/ts_def_modules/motorDriven/pump/pump_valve_power_loss.d.ts +4 -4
  75. package/ts_def/ts_def_modules/motorDriven/pumpFan/pumpFan.d.ts +23 -23
  76. package/ts_def/ts_def_modules/other/chp.d.ts +1 -1
  77. package/ts_def/ts_def_modules/other/lighting_data.d.ts +16 -16
  78. package/ts_def/ts_def_modules/other/powerFactor.d.ts +17 -17
  79. package/ts_def/ts_def_modules/physics/gas_compositions.d.ts +2 -2
  80. package/ts_def/ts_def_modules/processCooling/chillers.d.ts +2 -2
  81. package/ts_def/ts_def_modules/processCooling/process_cooling.d.ts +17 -17
  82. package/ts_def/ts_def_modules/processHeat/air_heating_using_exhaust.d.ts +4 -4
  83. package/ts_def/ts_def_modules/processHeat/flow_calculations_energy_use.d.ts +1 -1
  84. package/ts_def/ts_def_modules/processHeat/losses/leakage_heat_loss.d.ts +1 -1
  85. package/ts_def/ts_def_modules/steam/steam_leak_survey.d.ts +33 -32
  86. package/ts_def/ts_def_modules/steam/water_heating_using_steam.d.ts +3 -3
  87. package/ts_def/ts_def_modules/steamModeler/ssmt.d.ts +44 -41
  88. package/ts_def/ts_def_modules/steamModeler/ssmtModeler.d.ts +16 -16
  89. package/ts_def/ts_def_modules/treasureHunt/compressed_air_pressure_reduction.d.ts +2 -2
  90. package/ts_def/ts_def_modules/treasureHunt/compressed_air_reduction.d.ts +11 -11
  91. package/ts_def/ts_def_modules/treasureHunt/electricity_reduction.d.ts +16 -16
  92. package/ts_def/ts_def_modules/treasureHunt/insulated_pipe_reduction.d.ts +4 -4
  93. package/ts_def/ts_def_modules/treasureHunt/insulated_tank_reduction.d.ts +8 -8
  94. package/ts_def/ts_def_modules/treasureHunt/natural_gas_reduction.d.ts +6 -6
  95. package/ts_def/ts_def_modules/treasureHunt/steam_reduction.d.ts +5 -5
  96. package/ts_def/ts_def_modules/treasureHunt/water_reduction.d.ts +6 -6
  97. package/ts_def/ts_def_modules/wasteWater/svi.d.ts +9 -9
  98. package/ts_def/ts_def_modules/wasteWater/wasteWater.d.ts +150 -61
  99. package/ts_def/ts_def_modules/water/waterAssessment.d.ts +66 -66
package/.claude/CLAUDE.md CHANGED
@@ -1,33 +1,17 @@
1
- # Project Memory
1
+ # Claude Project Guidance
2
2
 
3
- When generating code, always follow the coding standards and conventions in the [Style Guide](../contributing/style-guide.md). When documenting code, always follow the documentation standards in [Documentation](../contributing/documentation.md). If either linked file is not available in context, ask the user to provide it before proceeding.
3
+ Follow the canonical repository instructions in [../AGENTS.md](../AGENTS.md). Do not duplicate long-form policy here; update `AGENTS.md` when project-wide agent guidance changes.
4
4
 
5
- When tasked to refactor code using namespaces, follow these phases in order. In all phases, maintain a **one file per logical module** rule: each .h/.cpp pair produces exactly one corresponding binding file, one C++ test file, and one wasm test file.
5
+ ## Quick Orientation
6
6
 
7
- **Phase 1 — Headers and Source**
8
- Update the .h and .cpp files to reflect the new structure.
7
+ - Read [../ARCHITECTURE.md](../ARCHITECTURE.md) before broad edits.
8
+ - Read [../BUILD.md](../BUILD.md) before changing build, package, WASM, or test workflows.
9
+ - Follow [../contributing/style-guide.md](../contributing/style-guide.md) and [../contributing/documentation.md](../contributing/documentation.md).
10
+ - For TypeScript WASM tests, follow [../tests/wasm-mocha/README.md](../tests/wasm-mocha/README.md).
9
11
 
10
- **Phase 2 — WebAssembly Bindings**
11
- For each .h/.cpp pair, create or update exactly one binding file in bindings-wasm/ (one binding file per logical module, matching its .h and .cpp filenames). If no existing binding file exists for a given pair, create one from scratch following the structure used in processHeat/bindings-wasm/.
12
+ ## Claude Workflow Notes
12
13
 
13
- **Phase 3 — C++ Unit Tests**
14
- Update the .cpp unit tests in tests/cpp to reflect the new structure. Each .cpp file must have its own dedicated test file. If an existing test file covers multiple classes that are being split into separate .cpp files, split the test file accordingly.
15
-
16
- **Phase 4 — WebAssembly Unit Tests**
17
- Update or add a unit test in tests/wasm-mocha for each binding file (one test file per binding file). Move old unit tests from tests/wasm to tests/wasm-mocha and update them to reflect the new structure. Once a test has been successfully migrated, delete the original file from tests/wasm.
18
-
19
- **Phase 5 — Documentation**
20
- Update the documentation in the docs/dox-content directory. Organize the content logically following the pattern that has already been established.
21
-
22
- **Reference example:** refer to processHeat/ as the canonical example of how to structure the code, WebAssembly bindings, unit tests, and documentation.
23
-
24
- **Checklist (verify before finishing):**
25
- - [ ] Phase 1: All .h and .cpp files updated
26
- - [ ] Phase 2: One binding file per .h/.cpp pair; new files created where none existed
27
- - [ ] Phase 3: One C++ test file per .cpp file; split if needed
28
- - [ ] Phase 4: One wasm test file per binding file; old tests/wasm files migrated and deleted
29
- - [ ] Phase 5: Documentation updated and organized
30
-
31
- ## Context
32
-
33
- The MEASUR Tools Suite is a collection of industrial efficiency calculations written in C++ with WebAssembly bindings for browser and Node.js environments. The suite provides computational engines for the [MEASUR](https://github.com/ORNL-AMO/AMO-Tools-Desktop) (Manufacturing Energy Assessment Suite for Utility Reduction) application ecosystem.
14
+ - Make a short plan for multi-file or cross-layer changes.
15
+ - Inspect related C++ source, WASM bindings, `ts_def` declarations, and tests before editing.
16
+ - Keep the one-module rule from `AGENTS.md`: source, binding, declaration, tests, and docs should move together.
17
+ - Report exactly which validation commands were run and which were not.
package/AGENTS.md CHANGED
@@ -1,33 +1,124 @@
1
- # Project Memory
1
+ # Agent Development Guide
2
2
 
3
- When generating code, always follow the coding standards and conventions in the [Style Guide](../contributing/style-guide.md). When documenting code, always follow the documentation standards in [Documentation](../contributing/documentation.md). If either linked file is not available in context, ask the user to provide it before proceeding.
3
+ This is the canonical repository guidance for AI agents and automation tools. Tool-specific files such as `.claude/CLAUDE.md` and `.github/copilot-instructions.md` should stay thin and point back here instead of duplicating policy.
4
4
 
5
- When tasked to refactor code using namespaces, follow these phases in order. In all phases, maintain a **one file per logical module** rule: each .h/.cpp pair produces exactly one corresponding binding file, one C++ test file, and one wasm test file.
5
+ ## Start Here
6
6
 
7
- **Phase 1 — Headers and Source**
8
- Update the .h and .cpp files to reflect the new structure.
7
+ Before changing code, read the relevant project guidance:
9
8
 
10
- **Phase 2 — WebAssembly Bindings**
11
- For each .h/.cpp pair, create or update exactly one binding file in bindings-wasm/ (one binding file per logical module, matching its .h and .cpp filenames). If no existing binding file exists for a given pair, create one from scratch following the structure used in processHeat/bindings-wasm/.
9
+ - [ARCHITECTURE.md](ARCHITECTURE.md) for repository layout, module boundaries, and the C++ to WebAssembly to TypeScript flow.
10
+ - [BUILD.md](BUILD.md) for build, test, WebAssembly, package, and Docker commands.
11
+ - [contributing/style-guide.md](contributing/style-guide.md) for C++ style and naming.
12
+ - [contributing/documentation.md](contributing/documentation.md) for Doxygen and `.dox` documentation standards.
13
+ - [ts_def/README.md](ts_def/README.md) when adding or correcting TypeScript declarations.
14
+ - [tests/wasm-mocha/README.md](tests/wasm-mocha/README.md) when adding or migrating WebAssembly Mocha tests.
12
15
 
13
- **Phase 3 — C++ Unit Tests**
14
- Update the .cpp unit tests in tests/cpp to reflect the new structure. Each .cpp file must have its own dedicated test file. If an existing test file covers multiple classes that are being split into separate .cpp files, split the test file accordingly.
16
+ If any referenced file is unavailable in context, ask the user for it before proceeding.
15
17
 
16
- **Phase 4 — WebAssembly Unit Tests**
17
- Update or add a unit test in tests/wasm-mocha for each binding file (one test file per binding file). Move old unit tests from tests/wasm to tests/wasm-mocha and update them to reflect the new structure. Once a test has been successfully migrated, delete the original file from tests/wasm.
18
+ ## Repository Context
18
19
 
19
- **Phase 5 — Documentation**
20
- Update the documentation in the docs/dox-content directory. Organize the content logically following the pattern that has already been established.
20
+ MEASUR Tools Suite is a C++ calculation library with WebAssembly bindings for browser and Node.js use. The project exposes computational engines for the MEASUR / AMO-Tools-Desktop ecosystem.
21
21
 
22
- **Reference example:** refer to processHeat/ as the canonical example of how to structure the code, WebAssembly bindings, unit tests, and documentation.
22
+ The core development pattern is:
23
23
 
24
- **Checklist (verify before finishing):**
25
- - [ ] Phase 1: All .h and .cpp files updated
26
- - [ ] Phase 2: One binding file per .h/.cpp pair; new files created where none existed
27
- - [ ] Phase 3: One C++ test file per .cpp file; split if needed
28
- - [ ] Phase 4: One wasm test file per binding file; old tests/wasm files migrated and deleted
29
- - [ ] Phase 5: Documentation updated and organized
24
+ ```text
25
+ include/ public C++ headers
26
+ src/ C++ implementations
27
+ bindings-wasm/ embind WebAssembly bindings
28
+ ts_def/ TypeScript declaration files for the WASM package
29
+ tests/cpp/ C++ unit tests
30
+ tests/wasm-mocha/ browser-based WebAssembly tests
31
+ docs/dox-content/ calculation documentation
32
+ ```
30
33
 
31
- ## Context
34
+ ## Agent Operating Principles
32
35
 
33
- The MEASUR Tools Suite is a collection of industrial efficiency calculations written in C++ with WebAssembly bindings for browser and Node.js environments. The suite provides computational engines for the [MEASUR](https://github.com/ORNL-AMO/AMO-Tools-Desktop) (Manufacturing Energy Assessment Suite for Utility Reduction) application ecosystem.
36
+ - Prefer small, reviewable changes that preserve existing module boundaries.
37
+ - Read nearby implementation, bindings, declarations, and tests before editing.
38
+ - Keep source, binding, TypeScript declaration, tests, and documentation in sync.
39
+ - Do not invent new abstractions unless they reduce real duplication or match an established local pattern.
40
+ - Preserve public API compatibility unless the user explicitly requests a breaking change. When a breaking change is necessary, document the old-to-new migration.
41
+ - Do not revert or overwrite unrelated user changes in a dirty worktree.
42
+ - Use structured tools and parsers when available. Avoid brittle ad hoc text rewrites for structured data.
43
+
44
+ ## One Module Rule
45
+
46
+ Maintain one file per logical module whenever refactoring or adding calculations:
47
+
48
+ - One `.h`/`.cpp` pair for the C++ module.
49
+ - One matching binding file in `bindings-wasm/`.
50
+ - One C++ test file for each C++ module where applicable.
51
+ - One WebAssembly Mocha test file for each binding file.
52
+ - One TypeScript declaration file for each public binding surface.
53
+ - Documentation organized under `docs/dox-content/` following nearby examples.
54
+
55
+ Use `processHeat/` as the canonical structural example when in doubt.
56
+
57
+ ## Namespace or Module Refactor Phases
58
+
59
+ When asked to refactor code using namespaces or to split modules, work in this order:
60
+
61
+ 1. **Headers and Source**: Update `.h` and `.cpp` files first.
62
+ 2. **WebAssembly Bindings**: Create or update exactly one binding file in `bindings-wasm/` for each logical module.
63
+ 3. **C++ Unit Tests**: Update `tests/cpp/`; split tests when one old test covered multiple new modules.
64
+ 4. **WebAssembly Unit Tests**: Update or add `tests/wasm-mocha/` tests. Move successfully migrated tests from `tests/wasm/` and delete the obsolete originals.
65
+ 5. **TypeScript Declarations**: Update `ts_def/` to match the exact embind runtime surface and follow [ts_def/README.md](ts_def/README.md).
66
+ 6. **Documentation**: Update `docs/dox-content/` and related docs if public behavior, formulas, usage, or module organization changed.
67
+
68
+ ## WebAssembly and TypeScript Rules
69
+
70
+ Match declarations to embind bindings:
71
+
72
+ - `class_<T>("Name")` is a runtime class. Declare it as `export declare class Name` and include `delete(): void`.
73
+ - `value_object<T>("Name")` is passed as a plain object. Declare it as an `interface`; do not require `delete()`.
74
+ - `register_vector<T>("Name")` is a constructible runtime vector. Expose a constructor through the module type and clean instances up with `delete()`.
75
+ - `enum_<T>("Name")` is a runtime enum. Add it to the module type only when the binding file exposes it.
76
+ - Module types should include runtime properties only. Export type-only interfaces, but do not list them as module properties.
77
+ - Document all public declarations. At minimum, every numeric property, parameter, and return value needs units or explicit dimensionless/unitless status.
78
+ - Prefer importing from the package entrypoint in TypeScript tests:
79
+
80
+ ```ts
81
+ import createModule, { type MeasurToolsSuite } from 'measur-tools-suite';
82
+ ```
83
+
84
+ ## Testing Expectations
85
+
86
+ Choose verification based on the changed surface:
87
+
88
+ - C++ source or headers: build and run relevant C++ tests.
89
+ - WASM bindings or TypeScript declarations: run `./node_modules/.bin/tsc --noEmit` and relevant `npm run tests`.
90
+ - Browser-facing changes: verify `bin/client.js` and `bin/client.wasm` are built and served correctly.
91
+ - Documentation-only changes: run markdown or whitespace checks when available, and ensure links are correct.
92
+
93
+ Common commands:
94
+
95
+ ```bash
96
+ cmake -S . -B build-cpp
97
+ cmake --build build-cpp
98
+ ./build-cpp/bin/cpp_tests
99
+ emcmake cmake -S . -B build-wasm -DBUILD_WASM=ON
100
+ emmake make -C build-wasm
101
+ ./node_modules/.bin/tsc --noEmit
102
+ npm run tests
103
+ git diff --check
104
+ ```
105
+
106
+ Do not claim tests passed unless you ran them. If a command cannot run in the environment, report that plainly with the reason.
107
+
108
+ ## Documentation Expectations
109
+
110
+ - Use Doxygen comments for public C++ classes, structs, functions, enums, and files.
111
+ - Use `.dox` files for calculation-level documentation aimed at engineering users.
112
+ - Keep formulas, units, and symbol tables consistent with [contributing/documentation.md](contributing/documentation.md).
113
+ - Update examples when public WebAssembly or TypeScript usage changes.
114
+
115
+ ## Completion Checklist
116
+
117
+ Before handing work back, verify:
118
+
119
+ - [ ] Source changes match the existing module pattern.
120
+ - [ ] Bindings match headers and runtime names exactly.
121
+ - [ ] TypeScript declarations match embind semantics.
122
+ - [ ] C++ and WASM tests cover the changed public behavior.
123
+ - [ ] Documentation and examples are updated for public changes.
124
+ - [ ] Formatting, whitespace, and generated artifacts are intentional.
package/ARCHITECTURE.md CHANGED
@@ -1,3 +1,149 @@
1
1
  # Architecture Overview
2
2
 
3
- TODO: Add architecture overview content here.
3
+ MEASUR Tools Suite is a layered calculation library. The authoritative calculations are implemented in C++, exposed to browser and Node.js consumers through Emscripten WebAssembly bindings, and described for TypeScript consumers through declaration files.
4
+
5
+ ## Layers
6
+
7
+ ```text
8
+ Engineering formulas and data
9
+ |
10
+ v
11
+ Public C++ headers include/<domain>/
12
+ C++ implementations src/<domain>/
13
+ C++ tests tests/cpp/
14
+ |
15
+ v
16
+ WebAssembly bindings bindings-wasm/<domain>/
17
+ Browser WASM tests tests/wasm-mocha/<domain>/
18
+ TypeScript declarations ts_def/ts_def_modules/<domain>/
19
+ |
20
+ v
21
+ Package entrypoint bin/client.js + bin/client.wasm
22
+ TypeScript entrypoint ts_def/client.d.ts
23
+ ```
24
+
25
+ The public npm package exposes the WebAssembly module factory from `bin/client.js` and TypeScript declarations from `ts_def/client.d.ts`.
26
+
27
+ ## Repository Map
28
+
29
+ | Path | Purpose |
30
+ | --- | --- |
31
+ | `include/` | Public C++ headers and module contracts. |
32
+ | `src/` | C++ implementations. |
33
+ | `bindings-wasm/` | Emscripten embind bindings that define the JavaScript/WASM runtime API. |
34
+ | `ts_def/` | TypeScript declarations mirroring the runtime API. See [ts_def/README.md](ts_def/README.md). |
35
+ | `tests/cpp/` | Catch2 C++ unit tests. |
36
+ | `tests/wasm-mocha/` | Browser-based Mocha tests for the WebAssembly package. |
37
+ | `tests/wasm/` | Legacy WASM tests; migrate active tests to `tests/wasm-mocha/`. |
38
+ | `docs/dox-content/` | Doxygen calculation documentation for engineering users. |
39
+ | `contributing/` | Style, documentation, formatting, and commit guidance. |
40
+ | `BUILD.md` | Build, test, packaging, WebAssembly, and Docker workflows. |
41
+ | `AGENTS.md` | Canonical guidance for AI agents and automation. |
42
+
43
+ ## Domain Modules
44
+
45
+ Top-level domains are mirrored across `include/`, `src/`, `bindings-wasm/`, `ts_def/`, and tests where applicable:
46
+
47
+ - `compressedAir`
48
+ - `databases`
49
+ - `motorDriven`
50
+ - `other`
51
+ - `physics`
52
+ - `processCooling`
53
+ - `processHeat`
54
+ - `steam`
55
+ - `steamModeler`
56
+ - `treasureHunt`
57
+ - `wasteWater`
58
+ - `water`
59
+
60
+ When adding or refactoring a calculation, keep the same logical module name across layers. For example, a new `src/processHeat/foo.cpp` should have a matching public header, binding file, declaration file, tests, and documentation where appropriate.
61
+
62
+ ## C++ Layer
63
+
64
+ The C++ layer owns calculation behavior. Headers in `include/` define public data structures and calculator APIs. Implementations in `src/` should follow the project style guide:
65
+
66
+ - Prefer explicit, named structs for passive data.
67
+ - Use namespaces that match the module path.
68
+ - Keep declarations and implementations paired.
69
+ - Use `const` and references intentionally to avoid unnecessary copies.
70
+ - Include what you use.
71
+
72
+ Unit tests should exercise formulas and edge cases at the C++ layer when behavior changes independent of WebAssembly.
73
+
74
+ ## WebAssembly Binding Layer
75
+
76
+ Bindings in `bindings-wasm/` define the JavaScript runtime surface. Treat binding names as public API:
77
+
78
+ - `class_<T>("Name")` exposes a runtime constructor and embind instance methods.
79
+ - `value_object<T>("Name")` accepts and returns plain JavaScript objects.
80
+ - `register_vector<T>("Name")` exposes a runtime vector with `size()`, `get()`, `push_back()`, and `delete()`.
81
+ - `enum_<T>("Name")` exposes a runtime enum object.
82
+
83
+ Keep one binding file per logical C++ module. Avoid grouping unrelated modules into one binding file because it makes tests, declarations, and downstream migration harder.
84
+
85
+ ## TypeScript Declaration Layer
86
+
87
+ Declarations in `ts_def/` describe the WebAssembly runtime API. They should match embind semantics exactly:
88
+
89
+ - Runtime classes are `export declare class` declarations with `delete(): void`.
90
+ - Value objects are `interface` declarations and should not require cleanup.
91
+ - Registered vectors extend the shared `RegisteredVector<T>` type and are exposed through `RegisteredVectorsModule`.
92
+ - Module type aliases should include only properties that exist on the initialized WebAssembly module.
93
+ - `ts_def/client.d.ts` re-exports all module declarations and defines `MeasurToolsSuite`, the typed initialized module instance.
94
+
95
+ Declaration comments are part of the public developer experience. Every numeric public property, constructor parameter, function parameter, and numeric return value should document units or explicitly say `dimensionless`, `unitless`, or `count`. Follow [ts_def/README.md](ts_def/README.md) for the full typing documentation checklist.
96
+
97
+ When a TypeScript test needs casts such as `as any`, check the binding and declaration first; the declaration is often wrong or incomplete.
98
+
99
+ ## WebAssembly Test Layer
100
+
101
+ `tests/wasm-mocha/` tests run in Karma/Chrome against `bin/client.js` and `bin/client.wasm`. New tests should use the typed package entrypoint:
102
+
103
+ ```ts
104
+ import createModule, { type MeasurToolsSuite } from 'measur-tools-suite';
105
+ ```
106
+
107
+ Follow [tests/wasm-mocha/README.md](tests/wasm-mocha/README.md) for migration details. Clean up embind classes and vectors with `delete()`. Do not call `delete()` on value-object results.
108
+
109
+ ## Documentation Layer
110
+
111
+ Use Doxygen comments for public C++ APIs and `.dox` files for calculation narratives. Documentation should explain engineering intent, units, formulas, and assumptions, not just repeat code structure.
112
+
113
+ Follow [contributing/documentation.md](contributing/documentation.md) for Doxygen commands, formula syntax, and symbol tables.
114
+
115
+ ## Build and Packaging
116
+
117
+ Common build products:
118
+
119
+ - Native C++ build: `build-cpp/`
120
+ - WebAssembly build: `build-wasm/`
121
+ - Runtime package artifacts: `bin/client.js` and `bin/client.wasm`
122
+
123
+ Use separate build directories for native and WebAssembly builds to avoid stale CMake cache state. See [BUILD.md](BUILD.md) for full commands.
124
+
125
+ ## Development Workflow
126
+
127
+ For calculation changes, work from the core outward:
128
+
129
+ 1. Update C++ headers and source.
130
+ 2. Update or add C++ tests.
131
+ 3. Update WebAssembly bindings.
132
+ 4. Update TypeScript declarations.
133
+ 5. Update WASM Mocha tests.
134
+ 6. Update documentation and examples.
135
+ 7. Run the narrowest useful validation first, then broader tests before handoff.
136
+
137
+ For declaration-only or test migration work, still inspect the matching binding file before changing types. The binding file is the runtime source of truth for TypeScript declarations.
138
+
139
+ ## Validation Matrix
140
+
141
+ | Change | Minimum validation |
142
+ | --- | --- |
143
+ | C++ formula or data model | Build C++; run relevant `tests/cpp` or `cpp_tests`. |
144
+ | WASM binding | Rebuild WASM; run affected `tests/wasm-mocha` tests. |
145
+ | TypeScript declarations | `./node_modules/.bin/tsc --noEmit`; run affected WASM tests. |
146
+ | Packaging | Build package or inspect packed contents for `client.js`, `client.wasm`, and declarations. |
147
+ | Documentation | Check links, Doxygen syntax, and `git diff --check`. |
148
+
149
+ Prefer adding focused tests near the changed module instead of relying only on large integration coverage.
package/bin/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # TypeScript Declaration Authoring Guide
2
+
3
+ This directory contains the public TypeScript declarations for the WebAssembly package. Declarations are part of the user-facing API and should be maintained with the same care as C++ headers and embind bindings.
4
+
5
+ ## Source of Truth
6
+
7
+ Use the matching `bindings-wasm/` file as the runtime source of truth, then use C++ headers, implementations, tests, and docs to fill in semantics and units.
8
+
9
+ ```text
10
+ bindings-wasm/<domain>/<module>.cpp runtime names and embind kind
11
+ include/<domain>/<module>.h public C++ inputs, outputs, and units
12
+ src/<domain>/<module>.cpp formulas and default behavior
13
+ tests/wasm-mocha/<domain>/ expected JavaScript usage
14
+ docs/dox-content/ calculation intent, equations, and units
15
+ ```
16
+
17
+ Do not add a type because it seems useful downstream unless the initialized WebAssembly module actually exposes that runtime property.
18
+
19
+ ## Required Documentation
20
+
21
+ Every public declaration file should include:
22
+
23
+ - A top-level module summary describing the calculator or data group.
24
+ - JSDoc/TSDoc comments for every exported enum, interface, class, and function.
25
+ - Per-member comments for every public property.
26
+ - Constructor parameter comments for every public class constructor.
27
+ - Function `@param` and `@returns` comments for every exported function.
28
+ - Cleanup guidance on embind classes and vectors that require `delete()`.
29
+
30
+ Comments should explain user-facing meaning, not just restate the property name.
31
+
32
+ ## Units Requirement
33
+
34
+ At minimum, every numeric property, constructor parameter, function parameter, and numeric return value must document units.
35
+
36
+ Use one of these forms consistently:
37
+
38
+ - `units kWh/year`
39
+ - `units degF`
40
+ - `units scfm`
41
+ - `units $/kWh`
42
+ - `dimensionless`
43
+ - `dimensionless, 0-1`
44
+ - `unitless enum`
45
+ - `count`
46
+
47
+ For booleans, strings, enums, and nested objects, document meaning instead of units. For example, `true when using nameplate data` or `enum selecting the measurement method`.
48
+
49
+ Do not guess units. If bindings and C++ sources do not make units clear, inspect tests, documentation, and downstream usage. If units still cannot be established, call this out in the PR or handoff and avoid presenting a guessed unit as fact.
50
+
51
+ ## Embind Mapping Rules
52
+
53
+ Match declarations to embind exactly:
54
+
55
+ - `class_<T>("Name")`: declare `export declare class Name`. Include constructors, methods, public properties, and `delete(): void`.
56
+ - `value_object<T>("Name")`: declare an `interface`. Use plain object shapes. Do not include `delete(): void`.
57
+ - `register_vector<T>("Name")`: declare an interface extending `RegisteredVector<T>` and expose a constructor in `RegisteredVectorsModule`.
58
+ - `enum_<T>("Name")`: declare an enum and expose it on the module type.
59
+ - `function("name", ...)`: declare an exported function and expose it on the matching module type.
60
+
61
+ Module type aliases should include only runtime properties that exist on the initialized module: classes, functions, enums, and registered vector constructors. Type-only interfaces should be exported, but should not appear as module properties.
62
+
63
+ ## File Structure
64
+
65
+ Use this order unless a nearby module has a stronger established pattern:
66
+
67
+ 1. File-level summary.
68
+ 2. Imports, using `import type` for type-only imports.
69
+ 3. Enums.
70
+ 4. Input and output interfaces or classes.
71
+ 5. Calculator functions.
72
+ 6. Module type alias.
73
+
74
+ Keep names aligned with embind runtime names. Do not rename declaration symbols independently of the binding surface.
75
+
76
+ ## Example Value Object
77
+
78
+ ```ts
79
+ /**
80
+ * Input data for pipe sizing.
81
+ *
82
+ * @property airflow Airflow through the pipe, units scfm
83
+ * @property airlinePressure Airline pressure, units psig
84
+ * @property designVelocity Target design velocity, units ft/s
85
+ * @property atmosphericPressure Atmospheric pressure, units psia
86
+ */
87
+ export interface PipeSizingInput {
88
+ /** Airflow through the pipe, units scfm */
89
+ airflow: number;
90
+ /** Airline pressure, units psig */
91
+ airlinePressure: number;
92
+ /** Target design velocity, units ft/s */
93
+ designVelocity: number;
94
+ /** Atmospheric pressure, units psia */
95
+ atmosphericPressure: number;
96
+ }
97
+ ```
98
+
99
+ Because this is a `value_object`, callers pass a plain object and do not call `delete()`.
100
+
101
+ ## Example Runtime Class
102
+
103
+ ```ts
104
+ /**
105
+ * Dryer operating cost calculator.
106
+ */
107
+ export declare class DryerOperatingCost {
108
+ /**
109
+ * @param airflow Dryer airflow, units scfm
110
+ * @param inletPressure Inlet pressure, units psig
111
+ * @param averageSystemDemand Average system demand, units %
112
+ */
113
+ constructor(airflow: number, inletPressure: number, averageSystemDemand: number);
114
+
115
+ /**
116
+ * Calculate dryer operating cost for the selected dryer type.
117
+ * @param dryerType Dryer type enum.
118
+ * @returns Annual dryer operating cost results.
119
+ */
120
+ calculate(dryerType: DryerType): DryerOperatingCostOutput;
121
+
122
+ /** Frees the underlying embind resource. Call when finished with the instance. */
123
+ delete(): void;
124
+ }
125
+ ```
126
+
127
+ Because this is a `class_`, callers must clean up instances and class outputs with `delete()`.
128
+
129
+ ## Validation Checklist
130
+
131
+ Before finishing declaration work:
132
+
133
+ - [ ] The matching `bindings-wasm/` file was inspected.
134
+ - [ ] Each runtime class, function, enum, and vector is present in the module type.
135
+ - [ ] Type-only interfaces are not listed as runtime module properties.
136
+ - [ ] Every numeric public field, parameter, and return documents units or dimensionless status.
137
+ - [ ] Cleanup requirements match embind semantics.
138
+ - [ ] `ts_def/client.d.ts` exports the new declaration file and includes its module type in `MeasurToolsSuite`.
139
+ - [ ] A typed WASM Mocha test exercises the declaration through `createModule`.
140
+ - [ ] `./node_modules/.bin/tsc --noEmit` passes.
package/bin/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "measur-tools-suite",
3
- "version": "1.2.1-beta.4",
3
+ "version": "1.2.1-beta.5",
4
4
  "engines": {
5
5
  "node": "20.19.4",
6
6
  "npm": "10.8.2"
@@ -27,12 +27,12 @@ export declare abstract class RegisteredVector<T> {
27
27
  /** Constructor for creating an array of elements of type <T> */
28
28
  constructor();
29
29
 
30
- /** Returns the number of elements or size or length */
30
+ /** @returns Vector size, count. */
31
31
  size(): number;
32
32
 
33
33
  /**
34
34
  * Resizes and adds x elements of <T>
35
- * @param size new size of the vector
35
+ * @param size new vector size, count
36
36
  * @param elementOfTypeT element of type <T> to add if the vector is resized to be larger than the current size; optional parameter, default value is determined by the implementation
37
37
  */
38
38
  resize(size: number, elementOfTypeT?: T): void;