Docs

Library

npm install epcis.dev and import. The barrel exports are the exact functions the CLI verbs run — one engine, no second SDK, so anything you verify at the command line holds in your process, byte for byte. Everything runs in-process: no network, no account, no service.

The barrel

exportwhat it is
translateEPCIS 1.1/1.2/2.0 XML → 2.0 JSON-LD with a per-job round-trip fidelity report
TranslationErrorthe typed translation failure
validateEpcisverdict against the pinned official GS1 EPCIS 2.0.1 JSON schema
getEpcisValidatorthe compiled document/event validator
getQueryValidatorthe compiled query-schema validator
eventHashthe CBV 2.0 §8.9 standardized event hash (OpenEPCIS-vector compatible)
canonicalJsonthe §8.9 canonicalization step, exposed
preHashStringthe §8.9 pre-hash string, exposed
projectproject(event) — the conformant EPCIS 2.0 projection; always validates against the pinned schema
PINSsha256 pins of the vendored official GS1 artefacts
getPinone pin by artefact name
ARTEFACT_NAMESthe pinned artefact names
gatewaythe worker gateway (capture/query/translate/MCP doors) — mount or drive in-process
ALL_CHECKSthe advisory 18-check conformance suite
runSuiterun the advisory suite against a target
buildEvidenceBundlethe evidence bundle of a run (hash tree over full transcripts)
rejudgeEvidenceBundleoffline replay of a recorded bundle
verifyEvidenceBundleoffline hash-tree verification of a bundle
createReferenceTargetthe built-in hermetic reference implementation
REFERENCE_TARGET_DESCRIPTORthe reference target's descriptor

Shapes worth knowing before you code:

  • validateEpcis(doc) returns { valid, errors } — the schema provenance (artefact, version, sha256) is available from PINS; the CLI's validate --json assembles both for you.
  • eventHash, preHashString and canonicalJson are async — they return promises; await them.
  • The tarball ships its fixtures: node_modules/epcis.dev/golden-corpus/ is importable test data for your own suite, and node_modules/epcis.dev/AGENTS.md is the operating manual, greppable where you already are.

Proof — five lines, run

Executed against the published epcis.dev@0.1.0, with a fixture from the tarball:

// check.mjs
import { validateEpcis, eventHash } from "epcis.dev";
import { readFileSync } from "node:fs";

const doc = JSON.parse(readFileSync(process.argv[2], "utf8"));
console.log(validateEpcis(doc));
console.log(await eventHash(doc.epcisBody.eventList[0]));
$ node check.mjs \
    node_modules/epcis.dev/golden-corpus/valid-standard/object-event-shipping.json
{ valid: true, errors: [] }
ni:///sha-256;e5624abcce4b2fc226743e8891f69c12a07ad508953749d9b9ede6771424f91e?ver=CBV2.0
$ echo $?
0

The same fixture POSTed to the hosted doors returns the same verdict and the same ni URI — see Validate & hash. One engine, every face.

We answer in writing. We take at most five conversations a month, only when you ask for one, and only after you already have the written read.