
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
constraints-engine
Advanced tools
Constraint: A Constraint is an entity with 2 related domains of Constrained Entities. The Constraint expresses which Constrained Entities are consistent with each other. The Constraint has a Constraint Name.
Constrained Entity: An entity that is related to a Constraint.
Constraint Relationship: A Constraint is linked to Constrained Entities through a specific Constraint Relationship.
Consistency: Entities are consistent if
Inconsistency: Entities are inconsistent if
Selecting: The act of identifying a selected Constrained Entity for each of the Constraint Relationships is referred to as Selecting.
Satisfied Constrained Entity: A Constrained Entity is Satisfied when all the Constraints it is associated with have been Selected.
The diagram belows has a visual representation of constraints.
Semantically the first constraints has the following meaning.
The UFB Available constraint expresses
the Auckland and Christchurch locations are UFB available sites and
that Fixed Access and Site Mobile Access depend upon a location which is UFB available.

Define some constraints as an array of relationships from Constraint to Constrained Entity.
Each object in the array represents a link from the Constraint (source) to the Constrained Entity (target)
The source is always the Constraint.
The type value is used to split the Constrained Entities into the distinct sets.
var singleConstraint = [
{
source: "Constraint Id",
sourcename: "Constraint Name",
target: "Constrainee Reference",
type: "Association"
},
{
source: "Constraint Id",
sourcename: "Constraint Name",
target: "Constrainer id",
type: "Dependency"
}
]
Build the constraint engine passing the constraint data array.
var constraintEngine = constraints.compile(singleConstraint);
Then it is possible to query if nodes are consistent according to the constraints.
var consistencyCheck = constraintEngine.getConsistencyCheck("Entity1","Entity2").
Run npm-watch to run the mocha test suite and look at the test.spec.js which has the following output when run successfully.
Given a constraint engine
When there is a single constraint
√ Then there is a single constraint indexed
√ Then the constrained nodes are consistent
√ Then the constrainted nodes are consistent the other way around
√ Then unconstrainted nodes are consistent
√ Then constrained and unconstrainted nodes are not consistent
When there is are 2 constraint
√ Then there is 2 constraints indexed
√ Then the constrained nodes are consistent
√ Then the constrainted nodes are consistent the other way around
√ Then entities which dont satisfy both constraints are inconsistent
When there is are 3 constraints which make all combinations invalid
√ Then consistent combinations are identified
√ Then inconsistent combinations are identified
FAQs
A library of utilities for working with constraints
The npm package constraints-engine receives a total of 28 weekly downloads. As such, constraints-engine popularity was classified as not popular.
We found that constraints-engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.