an object describing the query using a set of cardinality operators
contract skeleton for the returned contexts
an iterable over the valid contexts
This method will generate a set of contexts that consist of every possible valid combination that matches the blueprint layout. It uses depth first search to calculate the product of contract combinations and returns the results as an iterable. This allows to reduce the memory usage when dealing with a large universe of contracts.
import {query, Contract} from 'contrato';
const contract = new Contract({ ... })
contract.addChildren([ ... ])
const contexts = query(contract, {
'hw.device-type': 1,
'arch.sw': {
cardinality: 1,
filter: { type: 'object', properties: { slug: { const: 'armv7hf' } } },
},
});
for (const context of contexts) {
console.log(context.toJSON());
}
composite contract