npm.io
6.0.5 • Published 4 months ago

@royalschedule/input-verifier

Licence
—
Version
6.0.5
Deps
3
Size
519 kB
Vulns
0
Weekly
0

Input verifier

A script that verifies the structure of the json input to be processed by the scheduling algorithm.

Active migration note: event-mass-distribution-analysis-migration.md

Time Units At The Native Boundary

The native C++ analyses use two time surfaces:

  • Internal typed analysis models stay in discretized schedule units.
  • Wasm and JSON payloads scale those values to real-time minutes at serialization.

This now applies consistently to both start-time feasibility and event-mass distribution. The rule of thumb is:

  • builder, solver, cache, and intermediate result types use discretized units
  • serializer code is responsible for converting those values to real time

The shared serialization helpers for this boundary live in cpp/src/json-serialization-utils.h.

Installation

npm i -S @royalschedule/input-verifier

Usage

import { verify } from '@royalschedule/input-verifier';

// analyze the json input
const result = verify({ ... });

if (result.valid) {
  console.log('Valid input 🎉');
} else {
  console.log(`${result.errors.length} error(s) found`);
}