io-ts-fuzzer
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -5,9 +5,9 @@ import * as t from 'io-ts'; | ||
/** | ||
* context for the next . | ||
* context for the next level of recursion. | ||
*/ | ||
deeper(): FuzzContext; | ||
recursed(): FuzzContext; | ||
/** | ||
* false iff the fuzzer should not recurse deeper. | ||
*/ | ||
shouldGoDeeper(): boolean; | ||
mayRecurse(): boolean; | ||
} | ||
@@ -31,2 +31,3 @@ export interface Fuzzer<T = unknown, C extends t.Decoder<unknown, T> = t.Decoder<unknown, T>> { | ||
} | ||
export declare function concreteFuzzerByName<T, C extends t.Decoder<unknown, T>>(func: ConcreteFuzzer<T>['func'], name: C['name']): Fuzzer<T, C>; | ||
export declare type fuzzGenerator<T, C extends t.Decoder<unknown, T>> = (b: C) => ConcreteFuzzer<T>; | ||
@@ -49,4 +50,3 @@ export declare type ContextOpts = Partial<typeof defaultContextOpt>; | ||
export declare function exampleGenerator<T>(r: Registry, d: t.Decoder<unknown, T>): ExampleGenerator<T>; | ||
export declare const defaultMaxRecursionHint = 5; | ||
export declare function exampleOf<T>(d: t.Decoder<unknown, T>, r: Registry, a: number, maxRecursionHint?: number): T; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function concreteFuzzerByName(func, name) { | ||
return { | ||
impl: { | ||
type: 'fuzzer', | ||
func, | ||
mightRecurse: false, | ||
}, | ||
id: name, | ||
idType: 'name', | ||
}; | ||
} | ||
exports.concreteFuzzerByName = concreteFuzzerByName; | ||
const defaultContextOpt = { | ||
@@ -8,10 +20,10 @@ maxRecursionHint: 4, | ||
class FC { | ||
constructor(mrh) { | ||
this.mrh = mrh; | ||
constructor(maxRecursionHint) { | ||
this.maxRecursionHint = maxRecursionHint; | ||
} | ||
deeper() { | ||
return new FC(this.mrh - 1); | ||
recursed() { | ||
return new FC(this.maxRecursionHint - 1); | ||
} | ||
shouldGoDeeper() { | ||
return this.mrh > 0; | ||
mayRecurse() { | ||
return this.maxRecursionHint > 0; | ||
} | ||
@@ -31,3 +43,3 @@ } | ||
return (a) => { | ||
return k.func(k.mightRecurse ? a[1].deeper() : a[1], a[0], ...children); | ||
return k.func(k.mightRecurse ? a[1].recursed() : a[1], a[0], ...children); | ||
}; | ||
@@ -77,4 +89,3 @@ } | ||
exports.exampleGenerator = exampleGenerator; | ||
exports.defaultMaxRecursionHint = 5; | ||
function exampleOf(d, r, a, maxRecursionHint = exports.defaultMaxRecursionHint) { | ||
function exampleOf(d, r, a, maxRecursionHint) { | ||
return exampleGenerator(r, d).encode([a, fuzzContext({ maxRecursionHint })]); | ||
@@ -81,0 +92,0 @@ } |
@@ -25,2 +25,4 @@ /*! | ||
export * from './fuzzer'; | ||
export * from './core/'; | ||
export * from './extras'; | ||
import * as core from './core'; | ||
export { core }; |
@@ -30,3 +30,5 @@ "use strict"; | ||
__export(require("./fuzzer")); | ||
__export(require("./core/")); | ||
__export(require("./extras")); | ||
const core = require("./core"); | ||
exports.core = core; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fuzzer_1 = require("./fuzzer"); | ||
const core_1 = require("./core/"); | ||
const core_2 = require("./core/core"); | ||
const core_1 = require("./core"); | ||
class FluentifiedRegistry { | ||
@@ -21,3 +20,3 @@ constructor(pimpl) { | ||
withUnknownFuzzer(codec) { | ||
this.register(core_2.unknownFuzzer(codec)); | ||
this.register(core_1.unknownFuzzer(codec)); | ||
return this; | ||
@@ -30,15 +29,15 @@ } | ||
withAnyArrayFuzzer(maxLength) { | ||
this.register(core_2.anyArrayFuzzer(maxLength)); | ||
this.register(core_1.anyArrayFuzzer(maxLength)); | ||
return this; | ||
} | ||
withReadonlyArrayFuzzer(maxLength) { | ||
this.register(core_2.readonlyArrayFuzzer(maxLength)); | ||
this.register(core_1.readonlyArrayFuzzer(maxLength)); | ||
return this; | ||
} | ||
withPartialFuzzer(extra) { | ||
this.register(core_2.partialFuzzer(extra)); | ||
this.register(core_1.partialFuzzer(extra)); | ||
return this; | ||
} | ||
withInterfaceFuzzer(extra) { | ||
this.register(core_2.interfaceFuzzer(extra)); | ||
this.register(core_1.interfaceFuzzer(extra)); | ||
return this; | ||
@@ -45,0 +44,0 @@ } |
@@ -0,1 +1,15 @@ | ||
# [3.0.0](https://github.com/holvonix-open/io-ts-fuzzer/compare/v2.0.0...v3.0.0) (2019-08-07) | ||
### 🌟🚀 Features | ||
* support `date` from io-ts-types. This new dependency is added as a peer -- code using it is only imported on calling `loadIoTsTypesFuzzers()` ([#11](https://github.com/holvonix-open/io-ts-fuzzer/issues/11)) ([4384326](https://github.com/holvonix-open/io-ts-fuzzer/commit/4384326)) | ||
### ⚠️ BREAKING CHANGES | ||
* `core` exports re-organized; some removed. From here on, | ||
only breaking changes to exports from `index.ts` will be deemed breaking | ||
changes for the package. | ||
# [2.0.0](https://github.com/holvonix-open/io-ts-fuzzer/compare/v1.10.2...v2.0.0) (2019-08-07) | ||
@@ -2,0 +16,0 @@ |
{ | ||
"name": "io-ts-fuzzer", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Fuzzing for io-ts codecs and types", | ||
@@ -118,7 +118,13 @@ "repository": { | ||
"husky": "^3.0.2", | ||
"io-ts-types": "^0.5.0", | ||
"mocha": "^6.2.0", | ||
"monocle-ts": "^2.0.0", | ||
"nyc": "^14.1.1", | ||
"ts-mocha": "^6.0.0", | ||
"typescript": "~3.5.0" | ||
}, | ||
"peerDependencies": { | ||
"io-ts-types": "^0.5.0", | ||
"monocle-ts": "^2.0.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # io-ts-fuzzer - Fuzzing for io-ts codecs and types | ||
After `yarn add io-ts io-ts-fuzzer`... | ||
After `yarn add fp-ts io-ts io-ts-fuzzer`... | ||
@@ -35,3 +35,3 @@ ````typescript | ||
Currently supports (and their nested closure): | ||
Currently supports (along with their nested closure): | ||
@@ -60,2 +60,6 @@ * `t.array` | ||
If you additionally do `yarn add monocle-ts io-ts-types` and register | ||
the `io-ts-types` extra fuzzers via `r.register(...await loadIoTsTypesFuzzers)`, the following additional types will be supported: | ||
* `date` | ||
## Use Cases | ||
@@ -62,0 +66,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19
127
53549
5
17
686
1
1