Skip to content

Commit

Permalink
Remove skhema as dependency
Browse files Browse the repository at this point in the history
This moves the isValid method from the [skhema module](https://github.com/balena-io-modules/skhema)
into an internal json-schema module since skhema is not being maintained
or used anywhere else.

Change-type: minor
Depends-on: #74
  • Loading branch information
pipex committed Dec 16, 2024
1 parent d9a37b5 commit ff7bf78
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 9 deletions.
14 changes: 7 additions & 7 deletions lib/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import range from 'lodash/range';
import reduce from 'lodash/reduce';
import some from 'lodash/some';
import uniqWith from 'lodash/uniqWith';
import { isValid } from 'skhema';
import { bigCombination } from 'js-combinatorics';
import { compare, satisfies, valid, validRange } from 'semver';

import { isValid } from './json-schema';
import ObjectSet from './object-set';
import MatcherCache from './matcher-cache';
import { hashObject } from './hash';
Expand Down Expand Up @@ -180,7 +180,7 @@ export default class Contract {
* const contract = new Contract({ ... })
* contract.interpolate()
*/
interpolate(options: object = { rehash: Boolean }): Contract {
interpolate(options: object = { rehash: Boolean }): this {
// TODO: Find a way to keep track of whether the contract
// has already been fully templated, and if so, avoid
// running this function.
Expand Down Expand Up @@ -384,7 +384,7 @@ export default class Contract {
* const contract = new Contract({ ... })
* contract.addChild(new Contract({ ... }))
*/
addChild(contract: Contract, options: object = {}): Contract {
addChild(contract: Contract, options: object = {}): this {
const type = contract.getType();
if (this.metadata.children.map[contract.metadata.hash]) {
return this;
Expand Down Expand Up @@ -433,7 +433,7 @@ export default class Contract {
* contract.addChild(child)
* contract.removeChild(child)
*/
removeChild(contract: Contract, options: object = {}): Contract {
removeChild(contract: Contract, options: object = {}): this {
defaults(options, {
rehash: true,
});
Expand Down Expand Up @@ -486,7 +486,7 @@ export default class Contract {
* new Contract({ ... })
* ])
*/
addChildren(contracts: Contract[] = [], options: object = {}): Contract {
addChildren(contracts: Contract[] = [], options: object = {}): this {
if (!contracts) {
return this;
}
Expand Down Expand Up @@ -1029,7 +1029,7 @@ export default class Contract {
(accumulator, value: Contract[][]) => {
return accumulator.concat(intersectionWith(...value, Contract.isEqual));

Check failure on line 1030 in lib/contract.ts

View workflow job for this annotation

GitHub Actions / Flowzone / Test npm (20.x)

No overload matches this call.

Check failure on line 1030 in lib/contract.ts

View workflow job for this annotation

GitHub Actions / Flowzone / Test npm (22.x)

No overload matches this call.
},
[] as Contract[],
[],
);
}
/**
Expand Down Expand Up @@ -1515,7 +1515,7 @@ export default class Contract {
contracts.push(new Contract(obj));
return accumulator.concat(contracts);

Check failure on line 1516 in lib/contract.ts

View workflow job for this annotation

GitHub Actions / Flowzone / Test npm (20.x)

No overload matches this call.

Check failure on line 1516 in lib/contract.ts

View workflow job for this annotation

GitHub Actions / Flowzone / Test npm (22.x)

No overload matches this call.
},
[] as Contract[],
[],
);
}
}
Loading

0 comments on commit ff7bf78

Please sign in to comment.