@classytic/stage 0.3.0 → 0.4.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.
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/atomic/aufbau.d.mts +144 -0
- package/dist/atomic/aufbau.mjs +384 -0
- package/dist/atomic/elements.d.mts +67 -0
- package/dist/atomic/elements.mjs +785 -0
- package/dist/atomic/emission.d.mts +112 -0
- package/dist/atomic/emission.mjs +179 -0
- package/dist/atomic/index.d.mts +8 -0
- package/dist/atomic/index.mjs +9 -0
- package/dist/atomic/periodic.d.mts +82 -0
- package/dist/atomic/periodic.mjs +231 -0
- package/dist/atomic/properties.d.mts +100 -0
- package/dist/atomic/properties.mjs +574 -0
- package/dist/atomic/shells.d.mts +137 -0
- package/dist/atomic/shells.mjs +170 -0
- package/dist/atomic/trends.d.mts +148 -0
- package/dist/atomic/trends.mjs +225 -0
- package/dist/chem/chromatography.d.mts +66 -0
- package/dist/chem/chromatography.mjs +63 -0
- package/dist/chem/complex.d.mts +114 -0
- package/dist/chem/complex.mjs +234 -0
- package/dist/chem/cycle.d.mts +75 -0
- package/dist/chem/cycle.mjs +145 -0
- package/dist/chem/equation.d.mts +86 -0
- package/dist/chem/equation.mjs +168 -0
- package/dist/chem/formula.d.mts +90 -0
- package/dist/chem/formula.mjs +201 -0
- package/dist/chem/functional-groups.d.mts +31 -0
- package/dist/chem/functional-groups.mjs +187 -0
- package/dist/chem/hazard.d.mts +94 -0
- package/dist/chem/hazard.mjs +329 -0
- package/dist/chem/index.d.mts +34 -33
- package/dist/chem/index.mjs +34 -28
- package/dist/chem/ionic.d.mts +98 -0
- package/dist/chem/ionic.mjs +156 -0
- package/dist/chem/layout.d.mts +46 -0
- package/dist/chem/layout.mjs +342 -0
- package/dist/chem/lewis.d.mts +79 -0
- package/dist/chem/lewis.mjs +163 -0
- package/dist/chem/molecular-orbital.d.mts +114 -0
- package/dist/chem/molecular-orbital.mjs +201 -0
- package/dist/chem/molecule.d.mts +154 -0
- package/dist/chem/molecule.mjs +282 -0
- package/dist/chem/nmr.d.mts +153 -0
- package/dist/chem/nmr.mjs +165 -0
- package/dist/chem/polymer.d.mts +65 -0
- package/dist/chem/polymer.mjs +179 -0
- package/dist/chem/redox.d.mts +138 -0
- package/dist/chem/redox.mjs +328 -0
- package/dist/chem/relations.d.mts +183 -0
- package/dist/chem/relations.mjs +299 -0
- package/dist/chem/skeleton.d.mts +51 -0
- package/dist/chem/skeleton.mjs +186 -0
- package/dist/chem/solution.d.mts +116 -0
- package/dist/chem/solution.mjs +186 -0
- package/dist/chem/species.d.mts +47 -0
- package/dist/chem/species.mjs +128 -0
- package/dist/chem/stereo.d.mts +108 -0
- package/dist/chem/stereo.mjs +286 -0
- package/dist/chem/stoichiometry.d.mts +95 -0
- package/dist/chem/stoichiometry.mjs +145 -0
- package/dist/chem/synthesis.d.mts +113 -0
- package/dist/chem/synthesis.mjs +281 -0
- package/dist/chem/vsepr.d.mts +80 -0
- package/dist/chem/vsepr.mjs +247 -0
- package/dist/circuit/ac.d.mts +163 -0
- package/dist/circuit/ac.mjs +452 -0
- package/dist/circuit/dc.d.mts +92 -0
- package/dist/circuit/dc.mjs +333 -0
- package/dist/circuit/index.d.mts +5 -92
- package/dist/circuit/index.mjs +5 -332
- package/dist/circuit/network.d.mts +99 -0
- package/dist/circuit/network.mjs +440 -0
- package/dist/circuit/topology.d.mts +102 -0
- package/dist/circuit/topology.mjs +143 -0
- package/dist/colour/absorption.d.mts +79 -0
- package/dist/colour/absorption.mjs +137 -0
- package/dist/colour/index.d.mts +6 -0
- package/dist/colour/index.mjs +7 -0
- package/dist/colour/name.d.mts +14 -0
- package/dist/colour/name.mjs +76 -0
- package/dist/colour/observer.d.mts +31 -0
- package/dist/colour/observer.mjs +46 -0
- package/dist/colour/spectrum.d.mts +61 -0
- package/dist/colour/spectrum.mjs +108 -0
- package/dist/colour/srgb.d.mts +49 -0
- package/dist/colour/srgb.mjs +108 -0
- package/dist/core/constants.d.mts +138 -0
- package/dist/core/constants.mjs +139 -0
- package/dist/core/index.d.mts +3 -1
- package/dist/core/index.mjs +3 -1
- package/dist/core/vec3.d.mts +94 -0
- package/dist/core/vec3.mjs +123 -0
- package/dist/core/worked.d.mts +35 -0
- package/dist/core/worked.mjs +44 -0
- package/dist/electro/cell.d.mts +102 -0
- package/dist/electro/cell.mjs +170 -0
- package/dist/electro/conductivity.d.mts +157 -0
- package/dist/electro/conductivity.mjs +156 -0
- package/dist/electro/couples.d.mts +114 -0
- package/dist/electro/couples.mjs +334 -0
- package/dist/electro/electrolysis.d.mts +96 -0
- package/dist/electro/electrolysis.mjs +274 -0
- package/dist/electro/faraday.d.mts +150 -0
- package/dist/electro/faraday.mjs +118 -0
- package/dist/electro/index.d.mts +6 -0
- package/dist/electro/index.mjs +7 -0
- package/dist/finance/accounting/adjustments.d.mts +17 -0
- package/dist/finance/accounting/adjustments.mjs +202 -0
- package/dist/finance/accounting/analysis.d.mts +8 -0
- package/dist/finance/accounting/analysis.mjs +205 -0
- package/dist/finance/accounting/clubs.d.mts +21 -0
- package/dist/finance/accounting/clubs.mjs +217 -0
- package/dist/finance/accounting/company-statements.d.mts +7 -0
- package/dist/finance/accounting/company-statements.mjs +150 -0
- package/dist/finance/accounting/harness.d.mts +7 -0
- package/dist/finance/accounting/harness.mjs +45 -0
- package/dist/finance/accounting/index.d.mts +18 -0
- package/dist/finance/accounting/index.mjs +18 -0
- package/dist/finance/accounting/journalize.d.mts +16 -0
- package/dist/finance/accounting/journalize.mjs +128 -0
- package/dist/finance/accounting/manufacturing.d.mts +8 -0
- package/dist/finance/accounting/manufacturing.mjs +236 -0
- package/dist/finance/accounting/partnership.d.mts +7 -0
- package/dist/finance/accounting/partnership.mjs +152 -0
- package/dist/finance/accounting/period-case.d.mts +6 -0
- package/dist/finance/accounting/period-case.mjs +71 -0
- package/dist/finance/accounting/post.d.mts +9 -0
- package/dist/finance/accounting/post.mjs +84 -0
- package/dist/finance/accounting/precision.d.mts +9 -0
- package/dist/finance/accounting/precision.mjs +15 -0
- package/dist/finance/accounting/rules.d.mts +21 -0
- package/dist/finance/accounting/rules.mjs +37 -0
- package/dist/finance/accounting/solve.d.mts +28 -0
- package/dist/finance/accounting/solve.mjs +92 -0
- package/dist/finance/accounting/statements.d.mts +7 -0
- package/dist/finance/accounting/statements.mjs +142 -0
- package/dist/finance/accounting/types.d.mts +649 -0
- package/dist/finance/accounting/validate.d.mts +7 -0
- package/dist/finance/accounting/validate.mjs +67 -0
- package/dist/finance/accounting/verification.d.mts +24 -0
- package/dist/finance/accounting/verification.mjs +386 -0
- package/dist/finance/bizsim.d.mts +21 -39
- package/dist/finance/bizsim.mjs +276 -97
- package/dist/finance/index.d.mts +20 -43
- package/dist/finance/index.mjs +19 -77
- package/dist/finance/investment-math.d.mts +7 -0
- package/dist/finance/investment-math.mjs +18 -0
- package/dist/finance/management-accounting/budgeting.d.mts +7 -0
- package/dist/finance/management-accounting/budgeting.mjs +189 -0
- package/dist/finance/management-accounting/cash-budget.d.mts +7 -0
- package/dist/finance/management-accounting/cash-budget.mjs +154 -0
- package/dist/finance/management-accounting/costing.d.mts +8 -0
- package/dist/finance/management-accounting/costing.mjs +175 -0
- package/dist/finance/management-accounting/decisions.d.mts +8 -0
- package/dist/finance/management-accounting/decisions.mjs +164 -0
- package/dist/finance/management-accounting/index.d.mts +13 -0
- package/dist/finance/management-accounting/index.mjs +13 -0
- package/dist/finance/management-accounting/integrated-budget.d.mts +8 -0
- package/dist/finance/management-accounting/integrated-budget.mjs +67 -0
- package/dist/finance/management-accounting/inventory-costing.d.mts +7 -0
- package/dist/finance/management-accounting/inventory-costing.mjs +173 -0
- package/dist/finance/management-accounting/investment-appraisal.d.mts +7 -0
- package/dist/finance/management-accounting/investment-appraisal.mjs +148 -0
- package/dist/finance/management-accounting/management-case.d.mts +8 -0
- package/dist/finance/management-accounting/management-case.mjs +91 -0
- package/dist/finance/management-accounting/master-budget.d.mts +7 -0
- package/dist/finance/management-accounting/master-budget.mjs +137 -0
- package/dist/finance/management-accounting/production-costing.d.mts +8 -0
- package/dist/finance/management-accounting/production-costing.mjs +214 -0
- package/dist/finance/management-accounting/types.d.mts +644 -0
- package/dist/finance/management-accounting/variances.d.mts +7 -0
- package/dist/finance/management-accounting/variances.mjs +150 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/math/analysis.d.mts +61 -0
- package/dist/math/analysis.mjs +187 -0
- package/dist/math/answer-check.d.mts +50 -0
- package/dist/math/answer-check.mjs +106 -0
- package/dist/math/calculus.d.mts +4 -9
- package/dist/math/calculus.mjs +216 -7
- package/dist/math/complex.d.mts +93 -0
- package/dist/math/complex.mjs +239 -0
- package/dist/math/expr.d.mts +23 -0
- package/dist/math/expr.mjs +36 -0
- package/dist/math/index.d.mts +8 -22
- package/dist/math/index.mjs +8 -37
- package/dist/math/latex.mjs +2 -1
- package/dist/math/parse.mjs +1 -1
- package/dist/math/poly.d.mts +55 -0
- package/dist/math/poly.mjs +273 -0
- package/dist/math/rearrange.d.mts +14 -0
- package/dist/math/rearrange.mjs +125 -0
- package/dist/math/solve.d.mts +21 -0
- package/dist/math/solve.mjs +75 -0
- package/dist/networking/addressing.d.mts +26 -0
- package/dist/networking/addressing.mjs +33 -0
- package/dist/networking/cloud/access.d.mts +36 -0
- package/dist/networking/cloud/access.mjs +95 -0
- package/dist/networking/cloud/containers.d.mts +43 -0
- package/dist/networking/cloud/containers.mjs +54 -0
- package/dist/networking/cloud/edge.d.mts +17 -0
- package/dist/networking/cloud/edge.mjs +31 -0
- package/dist/networking/cloud/failure-domains.d.mts +19 -0
- package/dist/networking/cloud/failure-domains.mjs +22 -0
- package/dist/networking/cloud/geo-routing.d.mts +22 -0
- package/dist/networking/cloud/geo-routing.mjs +64 -0
- package/dist/networking/cloud/index.d.mts +18 -0
- package/dist/networking/cloud/index.mjs +19 -0
- package/dist/networking/cloud/inference-reliability.d.mts +30 -0
- package/dist/networking/cloud/inference-reliability.mjs +76 -0
- package/dist/networking/cloud/inference.d.mts +118 -0
- package/dist/networking/cloud/inference.mjs +179 -0
- package/dist/networking/cloud/infrastructure.d.mts +45 -0
- package/dist/networking/cloud/infrastructure.mjs +96 -0
- package/dist/networking/cloud/observability.d.mts +24 -0
- package/dist/networking/cloud/observability.mjs +34 -0
- package/dist/networking/cloud/orchestration.d.mts +32 -0
- package/dist/networking/cloud/orchestration.mjs +38 -0
- package/dist/networking/cloud/recovery.d.mts +21 -0
- package/dist/networking/cloud/recovery.mjs +27 -0
- package/dist/networking/cloud/releases.d.mts +42 -0
- package/dist/networking/cloud/releases.mjs +135 -0
- package/dist/networking/cloud/scaling.d.mts +25 -0
- package/dist/networking/cloud/scaling.mjs +65 -0
- package/dist/networking/cloud/secrets.d.mts +39 -0
- package/dist/networking/cloud/secrets.mjs +68 -0
- package/dist/networking/cloud/server-deployment.d.mts +29 -0
- package/dist/networking/cloud/server-deployment.mjs +72 -0
- package/dist/networking/cloud/storage.d.mts +16 -0
- package/dist/networking/cloud/storage.mjs +58 -0
- package/dist/networking/cloud/vpc.d.mts +18 -0
- package/dist/networking/cloud/vpc.mjs +100 -0
- package/dist/networking/delivery.d.mts +34 -0
- package/dist/networking/delivery.mjs +52 -0
- package/dist/networking/index.d.mts +47 -0
- package/dist/networking/index.mjs +47 -0
- package/dist/networking/ipv6.d.mts +28 -0
- package/dist/networking/ipv6.mjs +17 -0
- package/dist/networking/journeys.d.mts +83 -0
- package/dist/networking/journeys.mjs +161 -0
- package/dist/networking/models/airtime.d.mts +87 -0
- package/dist/networking/models/airtime.mjs +130 -0
- package/dist/networking/models/cellular.d.mts +157 -0
- package/dist/networking/models/cellular.mjs +252 -0
- package/dist/networking/models/encapsulation.d.mts +98 -0
- package/dist/networking/models/encapsulation.mjs +132 -0
- package/dist/networking/models/handover.d.mts +116 -0
- package/dist/networking/models/handover.mjs +209 -0
- package/dist/networking/models/handshake.d.mts +90 -0
- package/dist/networking/models/handshake.mjs +122 -0
- package/dist/networking/models/index.d.mts +14 -0
- package/dist/networking/models/index.mjs +15 -0
- package/dist/networking/models/media.d.mts +82 -0
- package/dist/networking/models/media.mjs +188 -0
- package/dist/networking/models/satellite.d.mts +86 -0
- package/dist/networking/models/satellite.mjs +121 -0
- package/dist/networking/models/spectrum.d.mts +83 -0
- package/dist/networking/models/spectrum.mjs +235 -0
- package/dist/networking/models/switch.d.mts +80 -0
- package/dist/networking/models/switch.mjs +155 -0
- package/dist/networking/models/vlan.d.mts +62 -0
- package/dist/networking/models/vlan.mjs +100 -0
- package/dist/networking/models/vpn.d.mts +66 -0
- package/dist/networking/models/vpn.mjs +125 -0
- package/dist/networking/models/wifi-privacy.d.mts +82 -0
- package/dist/networking/models/wifi-privacy.mjs +130 -0
- package/dist/networking/models/wifi.d.mts +240 -0
- package/dist/networking/models/wifi.mjs +562 -0
- package/dist/networking/nat-traversal.d.mts +24 -0
- package/dist/networking/nat-traversal.mjs +38 -0
- package/dist/networking/protocols.d.mts +17 -0
- package/dist/networking/protocols.mjs +57 -0
- package/dist/networking/queue.d.mts +12 -0
- package/dist/networking/queue.mjs +18 -0
- package/dist/networking/route-learning.d.mts +23 -0
- package/dist/networking/route-learning.mjs +43 -0
- package/dist/networking/routing.d.mts +11 -0
- package/dist/networking/routing.mjs +25 -0
- package/dist/networking/signals.d.mts +26 -0
- package/dist/networking/signals.mjs +35 -0
- package/dist/networking/subnet.d.mts +49 -0
- package/dist/networking/subnet.mjs +89 -0
- package/dist/networking/tcp-reliability.d.mts +24 -0
- package/dist/networking/tcp-reliability.mjs +38 -0
- package/dist/networking/topology/contract.d.mts +123 -0
- package/dist/networking/topology/index.d.mts +4 -0
- package/dist/networking/topology/index.mjs +4 -0
- package/dist/networking/topology/presets.d.mts +7 -0
- package/dist/networking/topology/presets.mjs +302 -0
- package/dist/networking/topology/simulation.d.mts +8 -0
- package/dist/networking/topology/simulation.mjs +179 -0
- package/dist/networking/wireless.d.mts +11 -0
- package/dist/networking/wireless.mjs +17 -0
- package/dist/optics/imaging.d.mts +218 -0
- package/dist/optics/imaging.mjs +276 -0
- package/dist/optics/index.d.mts +7 -0
- package/dist/optics/index.mjs +8 -0
- package/dist/optics/laws.d.mts +70 -0
- package/dist/optics/laws.mjs +195 -0
- package/dist/optics/prism.d.mts +148 -0
- package/dist/optics/prism.mjs +197 -0
- package/dist/optics/refraction.d.mts +201 -0
- package/dist/optics/refraction.mjs +270 -0
- package/dist/optics/wave-optics.d.mts +171 -0
- package/dist/optics/wave-optics.mjs +259 -0
- package/dist/physics/ac/index.d.mts +183 -0
- package/dist/physics/ac/index.mjs +203 -0
- package/dist/physics/dynamics/forces.d.mts +98 -0
- package/dist/physics/dynamics/forces.mjs +153 -0
- package/dist/physics/dynamics/friction.d.mts +76 -0
- package/dist/physics/dynamics/friction.mjs +119 -0
- package/dist/physics/dynamics/system.d.mts +68 -0
- package/dist/physics/dynamics/system.mjs +125 -0
- package/dist/physics/electrostatics/index.d.mts +169 -0
- package/dist/physics/electrostatics/index.mjs +249 -0
- package/dist/physics/energy/centre-of-mass.d.mts +115 -0
- package/dist/physics/energy/centre-of-mass.mjs +180 -0
- package/dist/physics/energy/conservation.d.mts +81 -0
- package/dist/physics/energy/conservation.mjs +129 -0
- package/dist/physics/energy/power.d.mts +90 -0
- package/dist/physics/energy/power.mjs +167 -0
- package/dist/physics/energy/spring.d.mts +73 -0
- package/dist/physics/energy/spring.mjs +129 -0
- package/dist/physics/energy/store.d.mts +63 -0
- package/dist/physics/energy/store.mjs +108 -0
- package/dist/physics/energy/theorem.d.mts +65 -0
- package/dist/physics/energy/theorem.mjs +113 -0
- package/dist/physics/energy/work.d.mts +114 -0
- package/dist/physics/energy/work.mjs +219 -0
- package/dist/physics/gravitation/body.d.mts +85 -0
- package/dist/physics/gravitation/body.mjs +168 -0
- package/dist/physics/gravitation/kepler.d.mts +127 -0
- package/dist/physics/gravitation/kepler.mjs +216 -0
- package/dist/physics/gravitation/law.d.mts +117 -0
- package/dist/physics/gravitation/law.mjs +175 -0
- package/dist/physics/gravitation/orbit.d.mts +119 -0
- package/dist/physics/gravitation/orbit.mjs +202 -0
- package/dist/physics/gravitation/potential.d.mts +114 -0
- package/dist/physics/gravitation/potential.mjs +202 -0
- package/dist/physics/gravitation/variation.d.mts +97 -0
- package/dist/physics/gravitation/variation.mjs +175 -0
- package/dist/physics/index.d.mts +35 -0
- package/dist/physics/index.mjs +36 -0
- package/dist/physics/integral-sweep.d.mts +63 -0
- package/dist/physics/integral-sweep.mjs +126 -0
- package/dist/physics/kinematics/equations.d.mts +47 -0
- package/dist/physics/kinematics/equations.mjs +126 -0
- package/dist/physics/kinematics/free-fall.d.mts +53 -0
- package/dist/physics/kinematics/free-fall.mjs +71 -0
- package/dist/physics/kinematics/given.d.mts +16 -0
- package/dist/physics/kinematics/given.mjs +55 -0
- package/dist/physics/kinematics/roots.d.mts +41 -0
- package/dist/physics/kinematics/roots.mjs +72 -0
- package/dist/physics/kinematics/solve.d.mts +52 -0
- package/dist/physics/kinematics/solve.mjs +172 -0
- package/dist/physics/magnetism/biot-savart.d.mts +161 -0
- package/dist/physics/magnetism/biot-savart.mjs +353 -0
- package/dist/physics/magnetism/flux.d.mts +94 -0
- package/dist/physics/magnetism/flux.mjs +313 -0
- package/dist/physics/magnetism/geomagnetism.d.mts +151 -0
- package/dist/physics/magnetism/geomagnetism.mjs +184 -0
- package/dist/physics/magnetism/index.d.mts +12 -0
- package/dist/physics/magnetism/index.mjs +74 -0
- package/dist/physics/magnetism/lorentz.d.mts +28 -0
- package/dist/physics/magnetism/lorentz.mjs +88 -0
- package/dist/physics/magnetism/magnetic-force.d.mts +102 -0
- package/dist/physics/magnetism/magnetic-force.mjs +169 -0
- package/dist/physics/momentum/collide.d.mts +77 -0
- package/dist/physics/momentum/collide.mjs +115 -0
- package/dist/physics/momentum/impulse.d.mts +89 -0
- package/dist/physics/momentum/impulse.mjs +159 -0
- package/dist/physics/momentum/planar.d.mts +60 -0
- package/dist/physics/momentum/planar.mjs +110 -0
- package/dist/physics/projectile.d.mts +107 -0
- package/dist/physics/projectile.mjs +185 -0
- package/dist/physics/rotation/angular.d.mts +85 -0
- package/dist/physics/rotation/angular.mjs +130 -0
- package/dist/physics/rotation/circular.d.mts +79 -0
- package/dist/physics/rotation/circular.mjs +131 -0
- package/dist/physics/rotation/inertia.d.mts +164 -0
- package/dist/physics/rotation/inertia.mjs +332 -0
- package/dist/physics/rotation/torque.d.mts +65 -0
- package/dist/physics/rotation/torque.mjs +134 -0
- package/dist/physics/vectors.d.mts +64 -0
- package/dist/physics/vectors.mjs +114 -0
- package/dist/quantity/index.d.mts +119 -0
- package/dist/quantity/index.mjs +417 -0
- package/dist/relation/derive.d.mts +74 -0
- package/dist/relation/derive.mjs +73 -0
- package/dist/relation/index.d.mts +56 -0
- package/dist/relation/index.mjs +234 -0
- package/dist/scene/evaluators.mjs +1 -1
- package/dist/sim/thermal.mjs +45 -20
- package/dist/thermo/calorimetry.d.mts +207 -0
- package/dist/thermo/calorimetry.mjs +345 -0
- package/dist/thermo/cycles.d.mts +142 -0
- package/dist/thermo/cycles.mjs +256 -0
- package/dist/thermo/entropy.d.mts +87 -0
- package/dist/thermo/entropy.mjs +140 -0
- package/dist/thermo/expansion.d.mts +130 -0
- package/dist/thermo/expansion.mjs +178 -0
- package/dist/thermo/gas.d.mts +197 -0
- package/dist/thermo/gas.mjs +279 -0
- package/dist/thermo/heat-transfer.d.mts +164 -0
- package/dist/thermo/heat-transfer.mjs +217 -0
- package/dist/thermo/index.d.mts +9 -82
- package/dist/thermo/index.mjs +9 -132
- package/dist/thermo/processes.d.mts +95 -0
- package/dist/thermo/processes.mjs +154 -0
- package/dist/thermo/temperature.d.mts +174 -0
- package/dist/thermo/temperature.mjs +236 -0
- package/dist/waves/damping.d.mts +224 -0
- package/dist/waves/damping.mjs +317 -0
- package/dist/waves/doppler.d.mts +72 -0
- package/dist/waves/doppler.mjs +125 -0
- package/dist/waves/index.d.mts +10 -0
- package/dist/waves/index.mjs +10 -0
- package/dist/waves/pendulum.d.mts +130 -0
- package/dist/waves/pendulum.mjs +211 -0
- package/dist/waves/pitch.d.mts +125 -0
- package/dist/waves/pitch.mjs +158 -0
- package/dist/waves/shm.d.mts +170 -0
- package/dist/waves/shm.mjs +279 -0
- package/dist/waves/springs.d.mts +103 -0
- package/dist/waves/springs.mjs +176 -0
- package/dist/waves/superposition.d.mts +124 -0
- package/dist/waves/superposition.mjs +196 -0
- package/dist/waves/wave.d.mts +154 -0
- package/dist/waves/wave.mjs +178 -0
- package/package.json +74 -2
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
//#region src/finance/accounting/types.d.ts
|
|
2
|
+
type AccountCategory = 'Asset' | 'Liability' | 'Equity' | 'Income' | 'Expense';
|
|
3
|
+
type PostingSide = 'debit' | 'credit';
|
|
4
|
+
type AccountRole = 'cash' | 'bank' | 'capital' | 'drawings' | 'revenue' | 'expense' | 'inventory' | 'equipment' | 'loan' | 'receivable' | 'payable' | 'cost-of-sales';
|
|
5
|
+
interface AccountDefinition {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
category: AccountCategory;
|
|
9
|
+
role?: AccountRole;
|
|
10
|
+
}
|
|
11
|
+
interface JournalLine {
|
|
12
|
+
accountId: string;
|
|
13
|
+
side: PostingSide;
|
|
14
|
+
amount: number;
|
|
15
|
+
}
|
|
16
|
+
interface JournalEntry {
|
|
17
|
+
id: string;
|
|
18
|
+
narration: string;
|
|
19
|
+
lines: readonly JournalLine[];
|
|
20
|
+
date?: string;
|
|
21
|
+
source?: string;
|
|
22
|
+
}
|
|
23
|
+
interface AccountingPolicy {
|
|
24
|
+
decimalPlaces: number;
|
|
25
|
+
}
|
|
26
|
+
interface AccountingDiagnostic {
|
|
27
|
+
code: 'duplicate-account' | 'duplicate-entry' | 'unknown-account' | 'invalid-amount' | 'missing-debit' | 'missing-credit' | 'unbalanced-entry' | 'missing-role' | 'ambiguous-role' | 'invalid-adjustment' | 'invalid-analysis';
|
|
28
|
+
severity: 'error' | 'warning';
|
|
29
|
+
message: string;
|
|
30
|
+
entryId?: string;
|
|
31
|
+
accountId?: string;
|
|
32
|
+
}
|
|
33
|
+
interface ExplanationStep {
|
|
34
|
+
id: string;
|
|
35
|
+
kind: 'classify' | 'journalize' | 'validate' | 'post' | 'derive' | 'check';
|
|
36
|
+
rule: string;
|
|
37
|
+
working: string;
|
|
38
|
+
result: number | string | boolean;
|
|
39
|
+
}
|
|
40
|
+
interface LedgerPosting {
|
|
41
|
+
entryId: string;
|
|
42
|
+
contraAccountIds: readonly string[];
|
|
43
|
+
side: PostingSide;
|
|
44
|
+
amount: number;
|
|
45
|
+
narration: string;
|
|
46
|
+
}
|
|
47
|
+
interface LedgerAccount extends AccountDefinition {
|
|
48
|
+
postings: readonly LedgerPosting[];
|
|
49
|
+
debitTotal: number;
|
|
50
|
+
creditTotal: number;
|
|
51
|
+
balance: number;
|
|
52
|
+
balanceSide: PostingSide | 'zero';
|
|
53
|
+
normalBalance: number;
|
|
54
|
+
}
|
|
55
|
+
interface TrialBalanceLine {
|
|
56
|
+
accountId: string;
|
|
57
|
+
name: string;
|
|
58
|
+
debit: number;
|
|
59
|
+
credit: number;
|
|
60
|
+
}
|
|
61
|
+
interface TrialBalance {
|
|
62
|
+
lines: readonly TrialBalanceLine[];
|
|
63
|
+
debitTotal: number;
|
|
64
|
+
creditTotal: number;
|
|
65
|
+
balances: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface AccountingEquation {
|
|
68
|
+
assets: number;
|
|
69
|
+
liabilities: number;
|
|
70
|
+
contributedEquity: number;
|
|
71
|
+
income: number;
|
|
72
|
+
expenses: number;
|
|
73
|
+
profit: number;
|
|
74
|
+
equity: number;
|
|
75
|
+
left: number;
|
|
76
|
+
right: number;
|
|
77
|
+
balances: boolean;
|
|
78
|
+
}
|
|
79
|
+
interface FinancialStatements {
|
|
80
|
+
incomeStatement: {
|
|
81
|
+
income: number;
|
|
82
|
+
expenses: number;
|
|
83
|
+
profit: number;
|
|
84
|
+
};
|
|
85
|
+
statementOfFinancialPosition: {
|
|
86
|
+
assets: number;
|
|
87
|
+
liabilities: number;
|
|
88
|
+
equity: number;
|
|
89
|
+
balances: boolean;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
interface StatementLine {
|
|
93
|
+
id: string;
|
|
94
|
+
label: string;
|
|
95
|
+
amount: number;
|
|
96
|
+
kind: 'detail' | 'subtotal' | 'total';
|
|
97
|
+
treatment?: 'add' | 'subtract' | 'result';
|
|
98
|
+
}
|
|
99
|
+
interface StatementSection {
|
|
100
|
+
id: string;
|
|
101
|
+
title: string;
|
|
102
|
+
lines: readonly StatementLine[];
|
|
103
|
+
}
|
|
104
|
+
interface SoleTraderStatementFacts {
|
|
105
|
+
revenue: number;
|
|
106
|
+
costOfSales: number;
|
|
107
|
+
expenses: number;
|
|
108
|
+
otherIncome?: number;
|
|
109
|
+
nonCurrentAssets: number;
|
|
110
|
+
inventory: number;
|
|
111
|
+
cash: number;
|
|
112
|
+
otherCurrentAssets?: number;
|
|
113
|
+
openingCapital: number;
|
|
114
|
+
capitalIntroduced?: number;
|
|
115
|
+
drawings?: number;
|
|
116
|
+
loan: number;
|
|
117
|
+
currentLiabilities: number;
|
|
118
|
+
}
|
|
119
|
+
interface SoleTraderStatementResult {
|
|
120
|
+
incomeStatement: readonly StatementSection[];
|
|
121
|
+
statementOfFinancialPosition: readonly StatementSection[];
|
|
122
|
+
values: {
|
|
123
|
+
grossProfit: number;
|
|
124
|
+
netProfit: number;
|
|
125
|
+
closingCapital: number;
|
|
126
|
+
totalAssets: number;
|
|
127
|
+
totalLiabilities: number;
|
|
128
|
+
totalEquityAndLiabilities: number;
|
|
129
|
+
balanceDifference: number;
|
|
130
|
+
netMargin: number;
|
|
131
|
+
};
|
|
132
|
+
balances: boolean;
|
|
133
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
134
|
+
trace: readonly ExplanationStep[];
|
|
135
|
+
}
|
|
136
|
+
interface PartnershipAgreement {
|
|
137
|
+
profit: number;
|
|
138
|
+
interestOnCapitalPct: number;
|
|
139
|
+
interestOnDrawingsPct: number;
|
|
140
|
+
}
|
|
141
|
+
interface PartnerFacts {
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
capital: number;
|
|
145
|
+
drawings: number;
|
|
146
|
+
salary: number;
|
|
147
|
+
share: number;
|
|
148
|
+
openingCurrentBalance?: number;
|
|
149
|
+
openingCurrentSide?: PostingSide;
|
|
150
|
+
}
|
|
151
|
+
interface PartnerAppropriation {
|
|
152
|
+
id: string;
|
|
153
|
+
name: string;
|
|
154
|
+
interestOnCapital: number;
|
|
155
|
+
salary: number;
|
|
156
|
+
interestOnDrawings: number;
|
|
157
|
+
shareOfResidual: number;
|
|
158
|
+
totalAppropriation: number;
|
|
159
|
+
currentAccountMovements: readonly {
|
|
160
|
+
label: string;
|
|
161
|
+
side: PostingSide;
|
|
162
|
+
amount: number;
|
|
163
|
+
}[];
|
|
164
|
+
closingCurrentBalance: number;
|
|
165
|
+
closingCurrentSide: PostingSide | 'zero';
|
|
166
|
+
}
|
|
167
|
+
interface PartnershipResult {
|
|
168
|
+
totalInterestOnCapital: number;
|
|
169
|
+
totalSalaries: number;
|
|
170
|
+
totalInterestOnDrawings: number;
|
|
171
|
+
residualProfit: number;
|
|
172
|
+
partners: readonly PartnerAppropriation[];
|
|
173
|
+
spread: number;
|
|
174
|
+
appropriatesExactly: boolean;
|
|
175
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
176
|
+
trace: readonly ExplanationStep[];
|
|
177
|
+
}
|
|
178
|
+
interface LimitedCompanyStatementFacts {
|
|
179
|
+
revenue: number;
|
|
180
|
+
costOfSales: number;
|
|
181
|
+
operatingExpenses: number;
|
|
182
|
+
financeCosts: number;
|
|
183
|
+
taxExpense: number;
|
|
184
|
+
openingRetainedEarnings: number;
|
|
185
|
+
dividendsDeclared: number;
|
|
186
|
+
ordinaryShareCapital: number;
|
|
187
|
+
sharePremium?: number;
|
|
188
|
+
generalReserve?: number;
|
|
189
|
+
debentures: number;
|
|
190
|
+
currentLiabilities: number;
|
|
191
|
+
nonCurrentAssets: number;
|
|
192
|
+
currentAssets: number;
|
|
193
|
+
}
|
|
194
|
+
interface LimitedCompanyStatementResult {
|
|
195
|
+
incomeStatement: readonly StatementSection[];
|
|
196
|
+
statementOfChangesInEquity: readonly StatementSection[];
|
|
197
|
+
statementOfFinancialPosition: readonly StatementSection[];
|
|
198
|
+
values: {
|
|
199
|
+
grossProfit: number;
|
|
200
|
+
operatingProfit: number;
|
|
201
|
+
profitBeforeTax: number;
|
|
202
|
+
profitForYear: number;
|
|
203
|
+
closingRetainedEarnings: number;
|
|
204
|
+
totalEquity: number;
|
|
205
|
+
totalLiabilities: number;
|
|
206
|
+
totalAssets: number;
|
|
207
|
+
totalEquityAndLiabilities: number;
|
|
208
|
+
balanceDifference: number;
|
|
209
|
+
};
|
|
210
|
+
balances: boolean;
|
|
211
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
212
|
+
trace: readonly ExplanationStep[];
|
|
213
|
+
}
|
|
214
|
+
type ClubMemberState = 'paid' | 'arrearsSettled' | 'prepaidLastYear' | 'owesThisYear' | 'prepaidNextYear';
|
|
215
|
+
interface ClubMember {
|
|
216
|
+
name: string;
|
|
217
|
+
state: ClubMemberState;
|
|
218
|
+
}
|
|
219
|
+
interface ClubMemberTiming {
|
|
220
|
+
belongsTo: -1 | 0 | 1;
|
|
221
|
+
arrived: -1 | 0 | 1 | null;
|
|
222
|
+
}
|
|
223
|
+
interface ClubSubscriptionResult {
|
|
224
|
+
members: number;
|
|
225
|
+
cashReceived: number;
|
|
226
|
+
subscriptionIncome: number;
|
|
227
|
+
gap: number;
|
|
228
|
+
accruedIncome: number;
|
|
229
|
+
prepaidIncome: number;
|
|
230
|
+
arrearsSettled: number;
|
|
231
|
+
broughtForwardPrepaid: number;
|
|
232
|
+
accountRows: readonly {
|
|
233
|
+
label: string;
|
|
234
|
+
debit?: number;
|
|
235
|
+
credit?: number;
|
|
236
|
+
from?: ClubMemberState;
|
|
237
|
+
}[];
|
|
238
|
+
accountDebitTotal: number;
|
|
239
|
+
accountCreditTotal: number;
|
|
240
|
+
accountBalances: boolean;
|
|
241
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
242
|
+
trace: readonly ExplanationStep[];
|
|
243
|
+
}
|
|
244
|
+
interface ClubStatementFacts {
|
|
245
|
+
openingAssets: number;
|
|
246
|
+
openingLiabilities: number;
|
|
247
|
+
subscriptionIncome: number;
|
|
248
|
+
otherIncome: number;
|
|
249
|
+
expenses: number;
|
|
250
|
+
closingAssets: number;
|
|
251
|
+
closingLiabilities: number;
|
|
252
|
+
}
|
|
253
|
+
interface ClubStatementResult {
|
|
254
|
+
openingAccumulatedFund: number;
|
|
255
|
+
surplus: number;
|
|
256
|
+
expectedClosingFund: number;
|
|
257
|
+
closingNetAssets: number;
|
|
258
|
+
difference: number;
|
|
259
|
+
reconciles: boolean;
|
|
260
|
+
incomeAndExpenditure: readonly StatementSection[];
|
|
261
|
+
statementOfFinancialPosition: readonly StatementSection[];
|
|
262
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
263
|
+
trace: readonly ExplanationStep[];
|
|
264
|
+
}
|
|
265
|
+
interface ManufacturingAccountFacts {
|
|
266
|
+
openingRawMaterials: number;
|
|
267
|
+
purchasesOfRawMaterials: number;
|
|
268
|
+
closingRawMaterials: number;
|
|
269
|
+
directLabour: number;
|
|
270
|
+
directExpenses: number;
|
|
271
|
+
factoryOverheads: number;
|
|
272
|
+
openingWorkInProgress: number;
|
|
273
|
+
closingWorkInProgress: number;
|
|
274
|
+
}
|
|
275
|
+
interface ManufacturingFlowStage {
|
|
276
|
+
key: 'materials' | 'labour' | 'direct-expenses' | 'overheads' | 'opening-wip' | 'closing-wip';
|
|
277
|
+
label: string;
|
|
278
|
+
amount: number;
|
|
279
|
+
direction: 'in' | 'out';
|
|
280
|
+
reaches?: 'prime-cost' | 'total-factory-cost' | 'cost-of-production';
|
|
281
|
+
}
|
|
282
|
+
interface ManufacturingAccountResult {
|
|
283
|
+
materialsConsumed: number;
|
|
284
|
+
primeCost: number;
|
|
285
|
+
totalFactoryCost: number;
|
|
286
|
+
costOfProduction: number;
|
|
287
|
+
invertedClosingWipResult: number;
|
|
288
|
+
inversionDifference: number;
|
|
289
|
+
stages: readonly ManufacturingFlowStage[];
|
|
290
|
+
statement: readonly StatementSection[];
|
|
291
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
292
|
+
trace: readonly ExplanationStep[];
|
|
293
|
+
}
|
|
294
|
+
interface ManufacturingTradingFacts extends ManufacturingAccountFacts {
|
|
295
|
+
openingFinishedGoods: number;
|
|
296
|
+
closingFinishedGoods: number;
|
|
297
|
+
revenue: number;
|
|
298
|
+
}
|
|
299
|
+
interface ManufacturingTradingResult {
|
|
300
|
+
manufacturing: ManufacturingAccountResult;
|
|
301
|
+
goodsAvailableForSale: number;
|
|
302
|
+
costOfSales: number;
|
|
303
|
+
grossProfit: number;
|
|
304
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
305
|
+
trace: readonly ExplanationStep[];
|
|
306
|
+
}
|
|
307
|
+
interface SoleTraderPeriodCase {
|
|
308
|
+
accounts: readonly AccountDefinition[];
|
|
309
|
+
unadjustedEntries: readonly JournalEntry[];
|
|
310
|
+
adjustments: readonly AdjustmentFact[];
|
|
311
|
+
}
|
|
312
|
+
interface SoleTraderPeriodResult {
|
|
313
|
+
unadjusted: AccountingSolution;
|
|
314
|
+
adjustmentResults: readonly AdjustmentResult[];
|
|
315
|
+
adjusted: AccountingSolution;
|
|
316
|
+
statements: SoleTraderStatementResult;
|
|
317
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
318
|
+
trace: readonly ExplanationStep[];
|
|
319
|
+
}
|
|
320
|
+
type FinancialRatioKey = 'current' | 'quick' | 'inventoryDependence' | 'grossMargin' | 'markup' | 'netMargin' | 'roce' | 'gearing' | 'inventoryTurnover' | 'inventoryDays' | 'receivablesDays' | 'payablesDays';
|
|
321
|
+
type FinancialRatioFamily = 'liquidity' | 'profitability' | 'capital' | 'efficiency';
|
|
322
|
+
interface FinancialAnalysisFacts {
|
|
323
|
+
currentAssets: number;
|
|
324
|
+
inventory: number;
|
|
325
|
+
currentLiabilities: number;
|
|
326
|
+
nonCurrentLiabilities: number;
|
|
327
|
+
equity: number;
|
|
328
|
+
revenue: number;
|
|
329
|
+
costOfSales: number;
|
|
330
|
+
expenses?: number;
|
|
331
|
+
grossProfit?: number;
|
|
332
|
+
netProfit?: number;
|
|
333
|
+
capitalEmployed?: number;
|
|
334
|
+
averageInventory?: number;
|
|
335
|
+
tradeReceivables?: number;
|
|
336
|
+
creditRevenue?: number;
|
|
337
|
+
tradePayables?: number;
|
|
338
|
+
creditPurchases?: number;
|
|
339
|
+
daysInPeriod?: number;
|
|
340
|
+
}
|
|
341
|
+
interface FinancialRatioMetric {
|
|
342
|
+
key: FinancialRatioKey;
|
|
343
|
+
label: string;
|
|
344
|
+
family: FinancialRatioFamily;
|
|
345
|
+
value: number | null;
|
|
346
|
+
unit: 'ratio' | 'percent' | 'times' | 'days';
|
|
347
|
+
numerator: number;
|
|
348
|
+
denominator: number;
|
|
349
|
+
formula: string;
|
|
350
|
+
}
|
|
351
|
+
interface FinancialAnalysisResult {
|
|
352
|
+
values: {
|
|
353
|
+
workingCapital: number;
|
|
354
|
+
grossProfit: number;
|
|
355
|
+
netProfit: number;
|
|
356
|
+
capitalEmployed: number;
|
|
357
|
+
};
|
|
358
|
+
metrics: readonly FinancialRatioMetric[];
|
|
359
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
360
|
+
trace: readonly ExplanationStep[];
|
|
361
|
+
}
|
|
362
|
+
interface FinancialAnalysisComparison {
|
|
363
|
+
current: FinancialAnalysisResult;
|
|
364
|
+
prior: FinancialAnalysisResult;
|
|
365
|
+
deltas: readonly {
|
|
366
|
+
key: FinancialRatioKey;
|
|
367
|
+
current: number | null;
|
|
368
|
+
prior: number | null;
|
|
369
|
+
absolute: number | null;
|
|
370
|
+
}[];
|
|
371
|
+
}
|
|
372
|
+
interface FinancialRatioBenchmark {
|
|
373
|
+
key: FinancialRatioKey;
|
|
374
|
+
minimum?: number;
|
|
375
|
+
maximum?: number;
|
|
376
|
+
}
|
|
377
|
+
interface FinancialRatioAssessment {
|
|
378
|
+
key: FinancialRatioKey;
|
|
379
|
+
value: number | null;
|
|
380
|
+
passes: boolean;
|
|
381
|
+
benchmark: FinancialRatioBenchmark;
|
|
382
|
+
}
|
|
383
|
+
interface AccountingSolution {
|
|
384
|
+
acceptedEntries: readonly JournalEntry[];
|
|
385
|
+
rejectedEntries: readonly JournalEntry[];
|
|
386
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
387
|
+
ledger: readonly LedgerAccount[];
|
|
388
|
+
trialBalance: TrialBalance;
|
|
389
|
+
equation: AccountingEquation;
|
|
390
|
+
statements: FinancialStatements;
|
|
391
|
+
trace: readonly ExplanationStep[];
|
|
392
|
+
}
|
|
393
|
+
interface AccountingExpectation {
|
|
394
|
+
acceptedEntries?: number;
|
|
395
|
+
rejectedEntries?: number;
|
|
396
|
+
trialBalanceTotal?: number;
|
|
397
|
+
profit?: number;
|
|
398
|
+
assets?: number;
|
|
399
|
+
liabilities?: number;
|
|
400
|
+
equity?: number;
|
|
401
|
+
diagnosticCodes?: readonly AccountingDiagnostic['code'][];
|
|
402
|
+
}
|
|
403
|
+
interface AccountingCase {
|
|
404
|
+
id: string;
|
|
405
|
+
title: string;
|
|
406
|
+
accounts: readonly AccountDefinition[];
|
|
407
|
+
events?: readonly BusinessEvent[];
|
|
408
|
+
entries?: readonly JournalEntry[];
|
|
409
|
+
policy?: AccountingPolicy;
|
|
410
|
+
expect: AccountingExpectation;
|
|
411
|
+
}
|
|
412
|
+
interface AccountingCheck {
|
|
413
|
+
name: string;
|
|
414
|
+
passed: boolean;
|
|
415
|
+
expected: number | string | readonly string[];
|
|
416
|
+
actual: number | string | readonly string[];
|
|
417
|
+
}
|
|
418
|
+
interface AccountingCaseResult {
|
|
419
|
+
caseId: string;
|
|
420
|
+
passed: boolean;
|
|
421
|
+
checks: readonly AccountingCheck[];
|
|
422
|
+
solution: AccountingSolution;
|
|
423
|
+
}
|
|
424
|
+
type AdjustmentFact = {
|
|
425
|
+
id: string;
|
|
426
|
+
type: 'expense-period-end';
|
|
427
|
+
expenseAccountId: string;
|
|
428
|
+
accrualAccountId: string;
|
|
429
|
+
prepaymentAccountId: string;
|
|
430
|
+
recognizedExpense: number;
|
|
431
|
+
recordedExpense: number;
|
|
432
|
+
narration?: string;
|
|
433
|
+
} | {
|
|
434
|
+
id: string;
|
|
435
|
+
type: 'depreciation';
|
|
436
|
+
expenseAccountId: string;
|
|
437
|
+
accumulatedDepreciationAccountId: string;
|
|
438
|
+
method: 'straight-line';
|
|
439
|
+
cost: number;
|
|
440
|
+
residualValue: number;
|
|
441
|
+
usefulLifeYears: number;
|
|
442
|
+
periodFraction?: number;
|
|
443
|
+
narration?: string;
|
|
444
|
+
} | {
|
|
445
|
+
id: string;
|
|
446
|
+
type: 'depreciation';
|
|
447
|
+
expenseAccountId: string;
|
|
448
|
+
accumulatedDepreciationAccountId: string;
|
|
449
|
+
method: 'reducing-balance';
|
|
450
|
+
openingBookValue: number;
|
|
451
|
+
rate: number;
|
|
452
|
+
periodFraction?: number;
|
|
453
|
+
narration?: string;
|
|
454
|
+
} | {
|
|
455
|
+
id: string;
|
|
456
|
+
type: 'irrecoverable-debt';
|
|
457
|
+
expenseAccountId: string;
|
|
458
|
+
receivableAccountId: string;
|
|
459
|
+
amount: number;
|
|
460
|
+
narration?: string;
|
|
461
|
+
} | {
|
|
462
|
+
id: string;
|
|
463
|
+
type: 'allowance-change';
|
|
464
|
+
expenseAccountId: string;
|
|
465
|
+
allowanceAccountId: string;
|
|
466
|
+
openingAllowance: number;
|
|
467
|
+
requiredAllowance: number;
|
|
468
|
+
narration?: string;
|
|
469
|
+
} | {
|
|
470
|
+
id: string;
|
|
471
|
+
type: 'closing-inventory';
|
|
472
|
+
inventoryAccountId: string;
|
|
473
|
+
costOfSalesAccountId: string;
|
|
474
|
+
currentInventory: number;
|
|
475
|
+
requiredInventory: number;
|
|
476
|
+
narration?: string;
|
|
477
|
+
} | {
|
|
478
|
+
id: string;
|
|
479
|
+
type: 'correct-entry';
|
|
480
|
+
wrongEntry: JournalEntry;
|
|
481
|
+
correctEntry: JournalEntry;
|
|
482
|
+
narration?: string;
|
|
483
|
+
};
|
|
484
|
+
interface AdjustmentResult {
|
|
485
|
+
factId: string;
|
|
486
|
+
entries: readonly JournalEntry[];
|
|
487
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
488
|
+
trace: readonly ExplanationStep[];
|
|
489
|
+
values: Readonly<Record<string, number | string>>;
|
|
490
|
+
}
|
|
491
|
+
type BankReconciliationItem = {
|
|
492
|
+
id: string;
|
|
493
|
+
type: 'deposit-in-transit' | 'unpresented-cheque';
|
|
494
|
+
amount: number;
|
|
495
|
+
label?: string;
|
|
496
|
+
} | {
|
|
497
|
+
id: string;
|
|
498
|
+
type: 'bank-credit' | 'bank-debit';
|
|
499
|
+
amount: number;
|
|
500
|
+
label?: string;
|
|
501
|
+
} | {
|
|
502
|
+
id: string;
|
|
503
|
+
type: 'cashbook-correction';
|
|
504
|
+
amount: number;
|
|
505
|
+
direction: 'increase' | 'decrease';
|
|
506
|
+
label?: string;
|
|
507
|
+
};
|
|
508
|
+
interface BankReconciliationResult {
|
|
509
|
+
adjustedCashBookBalance: number;
|
|
510
|
+
reconciledBankStatementBalance: number;
|
|
511
|
+
difference: number;
|
|
512
|
+
reconciles: boolean;
|
|
513
|
+
cashBookAdjustments: readonly {
|
|
514
|
+
id: string;
|
|
515
|
+
label: string;
|
|
516
|
+
amount: number;
|
|
517
|
+
}[];
|
|
518
|
+
timingDifferences: readonly {
|
|
519
|
+
id: string;
|
|
520
|
+
label: string;
|
|
521
|
+
amount: number;
|
|
522
|
+
}[];
|
|
523
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
524
|
+
trace: readonly ExplanationStep[];
|
|
525
|
+
}
|
|
526
|
+
interface ControlAccountFacts {
|
|
527
|
+
kind: 'receivables' | 'payables';
|
|
528
|
+
openingBalance: number;
|
|
529
|
+
creditTransactions: number;
|
|
530
|
+
cashSettled: number;
|
|
531
|
+
returns: number;
|
|
532
|
+
discounts: number;
|
|
533
|
+
contra: number;
|
|
534
|
+
writeOffs?: number;
|
|
535
|
+
dishonouredPayments?: number;
|
|
536
|
+
otherCharges?: number;
|
|
537
|
+
expectedClosingBalance?: number;
|
|
538
|
+
}
|
|
539
|
+
interface ControlAccountResult {
|
|
540
|
+
closingBalance: number;
|
|
541
|
+
expectedClosingBalance?: number;
|
|
542
|
+
difference?: number;
|
|
543
|
+
agrees?: boolean;
|
|
544
|
+
movements: readonly {
|
|
545
|
+
label: string;
|
|
546
|
+
side: PostingSide;
|
|
547
|
+
amount: number;
|
|
548
|
+
}[];
|
|
549
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
550
|
+
trace: readonly ExplanationStep[];
|
|
551
|
+
}
|
|
552
|
+
type TrialBalanceErrorType = 'complete-omission' | 'commission' | 'principle' | 'original-entry' | 'complete-reversal' | 'compensating' | 'one-sided-entry' | 'unequal-entry' | 'casting-error' | 'balance-omitted';
|
|
553
|
+
interface TrialBalanceErrorDiagnosis {
|
|
554
|
+
type: TrialBalanceErrorType;
|
|
555
|
+
affectsAgreement: boolean;
|
|
556
|
+
requiresSuspense: boolean;
|
|
557
|
+
reason: string;
|
|
558
|
+
}
|
|
559
|
+
interface SuspenseCorrectionFact {
|
|
560
|
+
id: string;
|
|
561
|
+
suspenseAccountId: string;
|
|
562
|
+
affectedAccountId: string;
|
|
563
|
+
missingSide: PostingSide;
|
|
564
|
+
amount: number;
|
|
565
|
+
narration?: string;
|
|
566
|
+
}
|
|
567
|
+
type SuspenseDiscoveredError = Omit<SuspenseCorrectionFact, 'suspenseAccountId'> & {
|
|
568
|
+
errorType: TrialBalanceErrorType;
|
|
569
|
+
label?: string;
|
|
570
|
+
};
|
|
571
|
+
interface SuspenseReconstructionFacts {
|
|
572
|
+
trialBalanceDebitTotal: number;
|
|
573
|
+
trialBalanceCreditTotal: number;
|
|
574
|
+
suspenseAccountId: string;
|
|
575
|
+
errors: readonly SuspenseDiscoveredError[];
|
|
576
|
+
}
|
|
577
|
+
interface SuspenseMovement {
|
|
578
|
+
id: string;
|
|
579
|
+
label: string;
|
|
580
|
+
side: PostingSide;
|
|
581
|
+
amount: number;
|
|
582
|
+
}
|
|
583
|
+
interface SuspenseReconstructionResult {
|
|
584
|
+
openingBalance: {
|
|
585
|
+
side: PostingSide | 'zero';
|
|
586
|
+
amount: number;
|
|
587
|
+
};
|
|
588
|
+
corrections: readonly JournalEntry[];
|
|
589
|
+
movements: readonly SuspenseMovement[];
|
|
590
|
+
closingBalance: {
|
|
591
|
+
side: PostingSide | 'zero';
|
|
592
|
+
amount: number;
|
|
593
|
+
};
|
|
594
|
+
clears: boolean;
|
|
595
|
+
diagnostics: readonly AccountingDiagnostic[];
|
|
596
|
+
trace: readonly ExplanationStep[];
|
|
597
|
+
}
|
|
598
|
+
type BusinessEvent = {
|
|
599
|
+
id: string;
|
|
600
|
+
type: 'owner-investment';
|
|
601
|
+
amount: number;
|
|
602
|
+
narration?: string;
|
|
603
|
+
} | {
|
|
604
|
+
id: string;
|
|
605
|
+
type: 'borrow';
|
|
606
|
+
amount: number;
|
|
607
|
+
narration?: string;
|
|
608
|
+
} | {
|
|
609
|
+
id: string;
|
|
610
|
+
type: 'buy-equipment';
|
|
611
|
+
amount: number;
|
|
612
|
+
settlement: 'cash' | 'credit';
|
|
613
|
+
narration?: string;
|
|
614
|
+
} | {
|
|
615
|
+
id: string;
|
|
616
|
+
type: 'buy-inventory';
|
|
617
|
+
amount: number;
|
|
618
|
+
settlement: 'cash' | 'credit';
|
|
619
|
+
narration?: string;
|
|
620
|
+
} | {
|
|
621
|
+
id: string;
|
|
622
|
+
type: 'sale';
|
|
623
|
+
amount: number;
|
|
624
|
+
settlement: 'cash' | 'credit';
|
|
625
|
+
cost?: number;
|
|
626
|
+
narration?: string;
|
|
627
|
+
} | {
|
|
628
|
+
id: string;
|
|
629
|
+
type: 'pay-expense';
|
|
630
|
+
amount: number;
|
|
631
|
+
narration?: string;
|
|
632
|
+
} | {
|
|
633
|
+
id: string;
|
|
634
|
+
type: 'owner-drawings';
|
|
635
|
+
amount: number;
|
|
636
|
+
narration?: string;
|
|
637
|
+
} | {
|
|
638
|
+
id: string;
|
|
639
|
+
type: 'collect-receivable';
|
|
640
|
+
amount: number;
|
|
641
|
+
narration?: string;
|
|
642
|
+
} | {
|
|
643
|
+
id: string;
|
|
644
|
+
type: 'pay-payable';
|
|
645
|
+
amount: number;
|
|
646
|
+
narration?: string;
|
|
647
|
+
};
|
|
648
|
+
//#endregion
|
|
649
|
+
export { AccountCategory, AccountDefinition, AccountRole, AccountingCase, AccountingCaseResult, AccountingCheck, AccountingDiagnostic, AccountingEquation, AccountingExpectation, AccountingPolicy, AccountingSolution, AdjustmentFact, AdjustmentResult, BankReconciliationItem, BankReconciliationResult, BusinessEvent, ClubMember, ClubMemberState, ClubMemberTiming, ClubStatementFacts, ClubStatementResult, ClubSubscriptionResult, ControlAccountFacts, ControlAccountResult, ExplanationStep, FinancialAnalysisComparison, FinancialAnalysisFacts, FinancialAnalysisResult, FinancialRatioAssessment, FinancialRatioBenchmark, FinancialRatioFamily, FinancialRatioKey, FinancialRatioMetric, FinancialStatements, JournalEntry, JournalLine, LedgerAccount, LedgerPosting, LimitedCompanyStatementFacts, LimitedCompanyStatementResult, ManufacturingAccountFacts, ManufacturingAccountResult, ManufacturingFlowStage, ManufacturingTradingFacts, ManufacturingTradingResult, PartnerAppropriation, PartnerFacts, PartnershipAgreement, PartnershipResult, PostingSide, SoleTraderPeriodCase, SoleTraderPeriodResult, SoleTraderStatementFacts, SoleTraderStatementResult, StatementLine, StatementSection, SuspenseCorrectionFact, SuspenseDiscoveredError, SuspenseMovement, SuspenseReconstructionFacts, SuspenseReconstructionResult, TrialBalance, TrialBalanceErrorDiagnosis, TrialBalanceErrorType, TrialBalanceLine };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AccountDefinition, AccountingDiagnostic, AccountingPolicy, JournalEntry } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/finance/accounting/validate.d.ts
|
|
4
|
+
declare function validateChart(accounts: readonly AccountDefinition[]): AccountingDiagnostic[];
|
|
5
|
+
declare function validateJournalEntry(entry: JournalEntry, accounts: readonly AccountDefinition[], policy: AccountingPolicy): AccountingDiagnostic[];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { validateChart, validateJournalEntry };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { toMinor } from "./precision.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/finance/accounting/validate.ts
|
|
4
|
+
function validateChart(accounts) {
|
|
5
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6
|
+
const diagnostics = [];
|
|
7
|
+
for (const account of accounts) {
|
|
8
|
+
if (seen.has(account.id)) diagnostics.push({
|
|
9
|
+
code: "duplicate-account",
|
|
10
|
+
severity: "error",
|
|
11
|
+
accountId: account.id,
|
|
12
|
+
message: `Account ${account.id} is declared more than once.`
|
|
13
|
+
});
|
|
14
|
+
seen.add(account.id);
|
|
15
|
+
}
|
|
16
|
+
return diagnostics;
|
|
17
|
+
}
|
|
18
|
+
function validateJournalEntry(entry, accounts, policy) {
|
|
19
|
+
const known = new Set(accounts.map((account) => account.id));
|
|
20
|
+
const diagnostics = [];
|
|
21
|
+
let debits = 0, credits = 0, hasDebit = false, hasCredit = false;
|
|
22
|
+
for (const line of entry.lines) {
|
|
23
|
+
if (!known.has(line.accountId)) diagnostics.push({
|
|
24
|
+
code: "unknown-account",
|
|
25
|
+
severity: "error",
|
|
26
|
+
entryId: entry.id,
|
|
27
|
+
accountId: line.accountId,
|
|
28
|
+
message: `Entry ${entry.id} refers to unknown account ${line.accountId}.`
|
|
29
|
+
});
|
|
30
|
+
if (!Number.isFinite(line.amount) || line.amount <= 0) diagnostics.push({
|
|
31
|
+
code: "invalid-amount",
|
|
32
|
+
severity: "error",
|
|
33
|
+
entryId: entry.id,
|
|
34
|
+
accountId: line.accountId,
|
|
35
|
+
message: `Entry ${entry.id} has a non-positive or non-finite amount.`
|
|
36
|
+
});
|
|
37
|
+
if (line.side === "debit") {
|
|
38
|
+
hasDebit = true;
|
|
39
|
+
debits += toMinor(line.amount, policy);
|
|
40
|
+
} else {
|
|
41
|
+
hasCredit = true;
|
|
42
|
+
credits += toMinor(line.amount, policy);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!hasDebit) diagnostics.push({
|
|
46
|
+
code: "missing-debit",
|
|
47
|
+
severity: "error",
|
|
48
|
+
entryId: entry.id,
|
|
49
|
+
message: `Entry ${entry.id} has no debit line.`
|
|
50
|
+
});
|
|
51
|
+
if (!hasCredit) diagnostics.push({
|
|
52
|
+
code: "missing-credit",
|
|
53
|
+
severity: "error",
|
|
54
|
+
entryId: entry.id,
|
|
55
|
+
message: `Entry ${entry.id} has no credit line.`
|
|
56
|
+
});
|
|
57
|
+
if (debits !== credits) diagnostics.push({
|
|
58
|
+
code: "unbalanced-entry",
|
|
59
|
+
severity: "error",
|
|
60
|
+
entryId: entry.id,
|
|
61
|
+
message: `Entry ${entry.id} debits and credits differ.`
|
|
62
|
+
});
|
|
63
|
+
return diagnostics;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { validateChart, validateJournalEntry };
|