Registry / serialization / ord-schema-protobufjs

ord-schema-protobufjs

JSON →
library0.5.1jsnpmunverified

Compiled protobuf definitions for the Open Reaction Database, a structured format for capturing organic reaction data. This npm package (v0.5.1) provides the generated protobuf messages (e.g., Reaction, Compound) for Node.js and browser via protobuf.js. Updated irregularly alongside the ORD schema. Key differentiator: enables programmatic access to the standardized ORD schema for reaction data interchange, supporting datasets, conditions, outcomes, and analyses. Used for reading/writing reaction records, validating against the ORD spec, and integrating with ORD-compatible datasets. Ships TypeScript declarations.

npm install ord-schema-protobufjs
INSTALL
IMPORT
SIG · ORD-SCHEMA-PROTOBU
O
ord-schema-protobufjs
serializationjavascriptv0.5.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Reaction
import { Reaction } from 'ord-schema-protobufjs'
const { Reaction } = require('ord-schema-protobufjs')
Package uses protobuf.js static code generation; ESM import is preferred in Node 12+.
Compound
import { Compound } from 'ord-schema-protobufjs'
import * as ord from 'ord-schema-protobufjs'; const Compound = ord.Compound
Named exports are available directly; no need for namespace import.
ordSchema
import ordSchema from 'ord-schema-protobufjs'
const ordSchema = require('ord-schema-protobufjs')
Default export gives access to the root protobuf object; use for loading descriptors or custom usage.

Creates a simple reaction with SMILES identifiers, conditions, and demonstrates encode/decode round-trip.

import { Reaction, Compound } from 'ord-schema-protobufjs'; // Create a new Reaction message const reaction = Reaction.create({ identifiers: [{ value: 'OCCO', type: Compound.CompoundIdentifier.SMILES }], inputs: { 'substrate': { components: [{ substance: { identifiers: [{ value: 'CCO', type: Compound.CompoundIdentifier.SMILES }] } }] } }, conditions: { temperature: { setpoint: { value: 80, units: 'CELSIUS' } }, time: { duration: { value: 2, units: 'HOUR' } } } }); // Verify the message const err = Reaction.verify(reaction); if (err) throw Error(err); // Encode to binary const buffer = Reaction.encode(reaction).finish(); console.log('Encoded length:', buffer.length); // Decode back const decoded = Reaction.decode(buffer); console.log('Decoded reaction temperature:', decoded.conditions?.temperature?.setpoint?.value);
Debug
Known issues
breakingIn v0.5.0, the 'write_dataset' function signature changed from (dataset, path) to (dataset, path, options).
fix
Update calls to write_dataset(..., { format: 'parquet' }) to match new signature.
affects: >=0.5.0
deprecatedThe 'Dataset' message may be replaced by 'DatasetView' in future versions; use DatasetView for new code.
fix
Migrate to DatasetView and write_dataset for Parquet support.
affects: >=0.5.0
gotchaCompound.CompoundIdentifier enumeration values are integers; using string literals will fail validation.
fix
Always reference enum fields like Compound.CompoundIdentifier.SMILES instead of 'SMILES'.
affects: *
gotchaThe Reaction message requires nested objects to match proto schema exactly; extra fields will be ignored or throw in strict mode.
fix
Use Reaction.create() to ensure correct structure; avoid raw object assignment.
affects: *
Errors
Common errors & fixes
Error: Invalid type: expected Message, got Object
Passing a plain JavaScript object to a method that expects a protobuf message instance.
fix
Use the .create() static method to construct the message: Reaction.create(obj) instead of plain obj.
TypeError: Reaction.verify is not a function
Importing the package incorrectly (e.g., using namespace import instead of named import).
fix
Use named import: import { Reaction } from 'ord-schema-protobufjs'.
Error: Value for field 'units' is not a valid enum value.
Using a string that does not match the exact enum value (e.g., 'CELSIUS' vs 'CELCIUS' typo).
fix
Use the numeric enum value from the generated constants, e.g., Temperature.TemperatureUnit.CELSIUS.
Module not found: Can't resolve 'ord-schema-protobufjs'
Missing dependency or incorrect npm install.
fix
Run: npm install ord-schema-protobufjs --save
Upgrade
Version history
0.5.1latest on npm
Audit
Dependencies
protobufjsrequiredRuntime dependency for protobuf message serialization/deserialization
longoptionalNeeded for 64-bit integer support in protobuf.js in certain environments
Agent activity
4 hits · last 30 days
node
4
Resources
ord-schema-protobufjs — npm install ord-schema-protobufjs · libregistry