From 047316fdf0ef0ca77efa7f5b60a9d06ff94c7ab5 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 4 Apr 2020 11:44:08 +0200 Subject: [PATCH 001/222] upgrade to latest: docs-ts, prettier, typescript --- .prettierrc | 3 +- docs/modules/PathReporter.ts.md | 6 +- docs/modules/index.ts.md | 690 ++++++--- package-lock.json | 2321 ++++++++++++++++--------------- package.json | 6 +- src/ThrowReporter.ts | 2 +- src/index.ts | 173 ++- test/PathReporter.ts | 2 +- test/TypeClass.ts | 2 +- test/exact.ts | 6 +- test/helpers.ts | 14 +- test/readonly.ts | 4 +- test/readonlyArray.ts | 4 +- test/record.ts | 2 +- test/recursion.ts | 12 +- test/refinement.ts | 8 +- test/taggedUnion.ts | 2 +- test/type.ts | 2 +- test/union.ts | 6 +- 19 files changed, 1889 insertions(+), 1376 deletions(-) diff --git a/.prettierrc b/.prettierrc index 31ba22d84..86c4be005 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,6 @@ { "semi": false, "singleQuote": true, - "printWidth": 120 + "printWidth": 120, + "trailingComma": "none" } diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 46e42443f..f7ac7398c 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -23,7 +23,7 @@ Added in v1.0.0 **Signature** ```ts -export const PathReporter: Reporter> = ... +export declare const PathReporter: Reporter ``` Added in v1.0.0 @@ -33,7 +33,7 @@ Added in v1.0.0 **Signature** ```ts -export function failure(es: Array): Array { ... } +export declare function failure(es: Array): Array ``` Added in v1.0.0 @@ -43,7 +43,7 @@ Added in v1.0.0 **Signature** ```ts -export function success(): Array { ... } +export declare function success(): Array ``` Added in v1.0.0 diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 059a48025..d1dbde41f 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -86,40 +86,73 @@ Added in v1.0.0 - [Validation (type alias)](#validation-type-alias) - [~~mixed~~ (type alias)](#mixed-type-alias) - [AnyArrayType (class)](#anyarraytype-class) + - [\_tag (property)](#_tag-property) - [AnyDictionaryType (class)](#anydictionarytype-class) + - [\_tag (property)](#_tag-property-1) - [~~AnyType~~ (class)](#anytype-class) + - [\_tag (property)](#_tag-property-2) - [ArrayType (class)](#arraytype-class) + - [\_tag (property)](#_tag-property-3) - [BigIntType (class)](#biginttype-class) + - [\_tag (property)](#_tag-property-4) - [BooleanType (class)](#booleantype-class) + - [\_tag (property)](#_tag-property-5) - [DictionaryType (class)](#dictionarytype-class) + - [\_tag (property)](#_tag-property-6) - [ExactType (class)](#exacttype-class) + - [\_tag (property)](#_tag-property-7) - [~~FunctionType~~ (class)](#functiontype-class) + - [\_tag (property)](#_tag-property-8) - [InterfaceType (class)](#interfacetype-class) + - [\_tag (property)](#_tag-property-9) - [IntersectionType (class)](#intersectiontype-class) + - [\_tag (property)](#_tag-property-10) - [KeyofType (class)](#keyoftype-class) + - [\_tag (property)](#_tag-property-11) - [LiteralType (class)](#literaltype-class) + - [\_tag (property)](#_tag-property-12) - [~~NeverType~~ (class)](#nevertype-class) + - [\_tag (property)](#_tag-property-13) - [NullType (class)](#nulltype-class) + - [\_tag (property)](#_tag-property-14) - [NumberType (class)](#numbertype-class) + - [\_tag (property)](#_tag-property-15) - [~~ObjectType~~ (class)](#objecttype-class) + - [\_tag (property)](#_tag-property-16) - [PartialType (class)](#partialtype-class) + - [\_tag (property)](#_tag-property-17) - [ReadonlyArrayType (class)](#readonlyarraytype-class) + - [\_tag (property)](#_tag-property-18) - [ReadonlyType (class)](#readonlytype-class) + - [\_tag (property)](#_tag-property-19) - [RecursiveType (class)](#recursivetype-class) + - [\_tag (property)](#_tag-property-20) + - [type (property)](#type-property) - [RefinementType (class)](#refinementtype-class) + - [\_tag (property)](#_tag-property-21) - [~~StrictType~~ (class)](#stricttype-class) + - [\_tag (property)](#_tag-property-22) - [StringType (class)](#stringtype-class) + - [\_tag (property)](#_tag-property-23) - [~~TaggedUnionType~~ (class)](#taggeduniontype-class) - [TupleType (class)](#tupletype-class) + - [\_tag (property)](#_tag-property-24) - [Type (class)](#type-class) - [pipe (method)](#pipe-method) - [asDecoder (method)](#asdecoder-method) - [asEncoder (method)](#asencoder-method) - [decode (method)](#decode-method) + - [\_A (property)](#_a-property) + - [\_O (property)](#_o-property) + - [\_I (property)](#_i-property) - [UndefinedType (class)](#undefinedtype-class) + - [\_tag (property)](#_tag-property-25) - [UnionType (class)](#uniontype-class) + - [\_tag (property)](#_tag-property-26) - [UnknownType (class)](#unknowntype-class) + - [\_tag (property)](#_tag-property-27) - [VoidType (class)](#voidtype-class) + - [\_tag (property)](#_tag-property-28) - [Int](#int) - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) @@ -1053,91 +1086,145 @@ Added in v1.0.0 **Signature** ```ts -export class AnyArrayType { - constructor() { ... } - ... +export declare class AnyArrayType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "AnyArrayType" +``` + +Added in v1.0.0 + # AnyDictionaryType (class) **Signature** ```ts -export class AnyDictionaryType { - constructor() { ... } - ... +export declare class AnyDictionaryType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "AnyDictionaryType" +``` + +Added in v1.0.0 + # ~~AnyType~~ (class) **Signature** ```ts -export class AnyType { - constructor() { ... } - ... +export declare class AnyType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "AnyType" +``` + +Added in v1.0.0 + # ArrayType (class) **Signature** ```ts -export class ArrayType { +export declare class ArrayType { constructor( name: string, is: ArrayType['is'], validate: ArrayType['validate'], encode: ArrayType['encode'], readonly type: C - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "ArrayType" +``` + +Added in v1.0.0 + # BigIntType (class) **Signature** ```ts -export class BigIntType { - constructor() { ... } - ... +export declare class BigIntType { + constructor() } ``` Added in v2.1.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "BigIntType" +``` + +Added in v1.0.0 + # BooleanType (class) **Signature** ```ts -export class BooleanType { - constructor() { ... } - ... +export declare class BooleanType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "BooleanType" +``` + +Added in v1.0.0 + # DictionaryType (class) **Signature** ```ts -export class DictionaryType { +export declare class DictionaryType { constructor( name: string, is: DictionaryType['is'], @@ -1145,255 +1232,400 @@ export class DictionaryType { encode: DictionaryType['encode'], readonly domain: D, readonly codomain: C - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "DictionaryType" +``` + +Added in v1.0.0 + # ExactType (class) **Signature** ```ts -export class ExactType { +export declare class ExactType { constructor( name: string, is: ExactType['is'], validate: ExactType['validate'], encode: ExactType['encode'], readonly type: C - ) { ... } - ... + ) } ``` Added in v1.1.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "ExactType" +``` + +Added in v1.0.0 + # ~~FunctionType~~ (class) **Signature** ```ts -export class FunctionType { - constructor() { ... } - ... +export declare class FunctionType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "FunctionType" +``` + +Added in v1.0.0 + # InterfaceType (class) **Signature** ```ts -export class InterfaceType { +export declare class InterfaceType { constructor( name: string, is: InterfaceType['is'], validate: InterfaceType['validate'], encode: InterfaceType['encode'], readonly props: P - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "InterfaceType" +``` + +Added in v1.0.0 + # IntersectionType (class) **Signature** ```ts -export class IntersectionType { +export declare class IntersectionType { constructor( name: string, is: IntersectionType['is'], validate: IntersectionType['validate'], encode: IntersectionType['encode'], readonly types: CS - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "IntersectionType" +``` + +Added in v1.0.0 + # KeyofType (class) **Signature** ```ts -export class KeyofType { +export declare class KeyofType { constructor( name: string, is: KeyofType['is'], validate: KeyofType['validate'], encode: KeyofType['encode'], readonly keys: D - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "KeyofType" +``` + +Added in v1.0.0 + # LiteralType (class) **Signature** ```ts -export class LiteralType { +export declare class LiteralType { constructor( name: string, is: LiteralType['is'], validate: LiteralType['validate'], encode: LiteralType['encode'], readonly value: V - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "LiteralType" +``` + +Added in v1.0.0 + # ~~NeverType~~ (class) **Signature** ```ts -export class NeverType { - constructor() { ... } - ... +export declare class NeverType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "NeverType" +``` + +Added in v1.0.0 + # NullType (class) **Signature** ```ts -export class NullType { - constructor() { ... } - ... +export declare class NullType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "NullType" +``` + +Added in v1.0.0 + # NumberType (class) **Signature** ```ts -export class NumberType { - constructor() { ... } - ... +export declare class NumberType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "NumberType" +``` + +Added in v1.0.0 + # ~~ObjectType~~ (class) **Signature** ```ts -export class ObjectType { - constructor() { ... } - ... +export declare class ObjectType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "ObjectType" +``` + +Added in v1.0.0 + # PartialType (class) **Signature** ```ts -export class PartialType { +export declare class PartialType { constructor( name: string, is: PartialType['is'], validate: PartialType['validate'], encode: PartialType['encode'], readonly props: P - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "PartialType" +``` + +Added in v1.0.0 + # ReadonlyArrayType (class) **Signature** ```ts -export class ReadonlyArrayType { +export declare class ReadonlyArrayType { constructor( name: string, is: ReadonlyArrayType['is'], validate: ReadonlyArrayType['validate'], encode: ReadonlyArrayType['encode'], readonly type: C - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "ReadonlyArrayType" +``` + +Added in v1.0.0 + # ReadonlyType (class) **Signature** ```ts -export class ReadonlyType { +export declare class ReadonlyType { constructor( name: string, is: ReadonlyType['is'], validate: ReadonlyType['validate'], encode: ReadonlyType['encode'], readonly type: C - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "ReadonlyType" +``` + +Added in v1.0.0 + # RecursiveType (class) **Signature** ```ts -export class RecursiveType { +export declare class RecursiveType { constructor( name: string, is: RecursiveType['is'], validate: RecursiveType['validate'], encode: RecursiveType['encode'], public runDefinition: () => C - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "RecursiveType" +``` + +Added in v1.0.0 + +## type (property) + +**Signature** + +```ts +readonly type: C +``` + +Added in v1.0.0 + # RefinementType (class) **Signature** ```ts -export class RefinementType { +export declare class RefinementType { constructor( name: string, is: RefinementType['is'], @@ -1401,19 +1633,28 @@ export class RefinementType { encode: RefinementType['encode'], readonly type: C, readonly predicate: Predicate - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "RefinementType" +``` + +Added in v1.0.0 + # ~~StrictType~~ (class) **Signature** ```ts -export class StrictType { +export declare class StrictType { constructor( name: string, // tslint:disable-next-line: deprecation @@ -1423,32 +1664,50 @@ export class StrictType { // tslint:disable-next-line: deprecation encode: StrictType['encode'], readonly props: P - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "StrictType" +``` + +Added in v1.0.0 + # StringType (class) **Signature** ```ts -export class StringType { - constructor() { ... } - ... +export declare class StringType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "StringType" +``` + +Added in v1.0.0 + # ~~TaggedUnionType~~ (class) **Signature** ```ts -export class TaggedUnionType { +export declare class TaggedUnionType { constructor( name: string, // tslint:disable-next-line: deprecation @@ -1459,8 +1718,7 @@ export class TaggedUnionType { encode: TaggedUnionType['encode'], codecs: CS, readonly tag: Tag - ) { ... } - ... + ) } ``` @@ -1471,26 +1729,35 @@ Added in v1.3.0 **Signature** ```ts -export class TupleType { +export declare class TupleType { constructor( name: string, is: TupleType['is'], validate: TupleType['validate'], encode: TupleType['encode'], readonly types: CS - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "TupleType" +``` + +Added in v1.0.0 + # Type (class) **Signature** ```ts -export class Type { +export declare class Type { constructor( /** a unique name for this codec */ readonly name: string, @@ -1500,8 +1767,7 @@ export class Type { readonly validate: Validate, /** converts a value of type A to a value of type O */ readonly encode: Encode - ) { ... } - ... + ) } ``` @@ -1516,7 +1782,7 @@ pipe( this: Type, ab: Type, name: string = `pipe(${this.name}, ${ab.name})` - ): Type { ... } + ): Type ``` Added in v1.0.0 @@ -1526,7 +1792,7 @@ Added in v1.0.0 **Signature** ```ts -asDecoder(): Decoder { ... } +asDecoder(): Decoder ``` Added in v1.0.0 @@ -1536,7 +1802,7 @@ Added in v1.0.0 **Signature** ```ts -asEncoder(): Encoder { ... } +asEncoder(): Encoder ``` Added in v1.0.0 @@ -1548,7 +1814,37 @@ a version of `validate` with a default context **Signature** ```ts -decode(i: I): Validation { ... } +decode(i: I): Validation +``` + +Added in v1.0.0 + +## \_A (property) + +**Signature** + +```ts +readonly _A: A +``` + +Added in v1.0.0 + +## \_O (property) + +**Signature** + +```ts +readonly _O: O +``` + +Added in v1.0.0 + +## \_I (property) + +**Signature** + +```ts +readonly _I: I ``` Added in v1.0.0 @@ -1558,59 +1854,95 @@ Added in v1.0.0 **Signature** ```ts -export class UndefinedType { - constructor() { ... } - ... +export declare class UndefinedType { + constructor() } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "UndefinedType" +``` + +Added in v1.0.0 + # UnionType (class) **Signature** ```ts -export class UnionType { +export declare class UnionType { constructor( name: string, is: UnionType['is'], validate: UnionType['validate'], encode: UnionType['encode'], readonly types: CS - ) { ... } - ... + ) } ``` Added in v1.0.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "UnionType" +``` + +Added in v1.0.0 + # UnknownType (class) **Signature** ```ts -export class UnknownType { - constructor() { ... } - ... +export declare class UnknownType { + constructor() } ``` Added in v1.5.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "UnknownType" +``` + +Added in v1.0.0 + # VoidType (class) **Signature** ```ts -export class VoidType { - constructor() { ... } - ... +export declare class VoidType { + constructor() } ``` Added in v1.2.0 +## \_tag (property) + +**Signature** + +```ts +readonly _tag: "VoidType" +``` + +Added in v1.0.0 + # Int A branded codec representing an integer @@ -1618,7 +1950,7 @@ A branded codec representing an integer **Signature** ```ts -export const Int: BrandC = ... +export declare const Int: BrandC ``` Added in v1.8.1 @@ -1628,7 +1960,7 @@ Added in v1.8.1 **Signature** ```ts -export const UnknownArray: UnknownArrayC = ... +export declare const UnknownArray: UnknownArrayC ``` Added in v1.7.1 @@ -1638,7 +1970,7 @@ Added in v1.7.1 **Signature** ```ts -export const UnknownRecord: UnknownRecordC = ... +export declare const UnknownRecord: UnknownRecordC ``` Added in v1.7.1 @@ -1648,7 +1980,7 @@ Added in v1.7.1 **Signature** ```ts -export const appendContext = (c: Context, key: string, decoder: Decoder, actual?: unknown): Context => ... +export declare const appendContext: (c: Context, key: string, decoder: Decoder, actual?: unknown) => Context ``` Added in v1.0.0 @@ -1658,12 +1990,7 @@ Added in v1.0.0 **Signature** ```ts -export const array = (codec: C, name: string = `Array<${codec.name}>`): ArrayC => - new ArrayType( - name, - (u): u is Array> => UnknownArray.is(u) && u.every(codec.is), - (u, c) => - chain(UnknownArray.validate(u, c), us => ... +export declare const array: (codec: C, name?: string) => ArrayC ``` Added in v1.0.0 @@ -1673,7 +2000,7 @@ Added in v1.0.0 **Signature** ```ts -export const bigint: BigIntC = ... +export declare const bigint: BigIntC ``` Added in v2.1.0 @@ -1683,7 +2010,7 @@ Added in v2.1.0 **Signature** ```ts -export const boolean: BooleanC = ... +export declare const boolean: BooleanC ``` Added in v1.0.0 @@ -1693,11 +2020,11 @@ Added in v1.0.0 **Signature** ```ts -export const brand = ( +export declare const brand: ( codec: C, - predicate: Refinement, Branded, B>>, + predicate: Refinement>, name: N -): BrandC => ... +) => BrandC ``` Added in v1.8.1 @@ -1709,7 +2036,7 @@ Strips additional properties **Signature** ```ts -export const exact = (codec: C, name: string = getExactTypeName(codec)): ExactC => ... +export declare const exact: (codec: C, name?: string) => ExactC ``` Added in v1.1.0 @@ -1719,7 +2046,7 @@ Added in v1.1.0 **Signature** ```ts -export const failure = (value: unknown, context: Context, message?: string): Validation => ... +export declare const failure: (value: unknown, context: Context, message?: string) => Either ``` Added in v1.0.0 @@ -1729,7 +2056,7 @@ Added in v1.0.0 **Signature** ```ts -export const failures: (errors: Errors) => Validation = ... +export declare const failures: (errors: Errors) => Either ``` Added in v1.0.0 @@ -1739,7 +2066,7 @@ Added in v1.0.0 **Signature** ```ts -export const getContextEntry = (key: string, decoder: Decoder): ContextEntry => ... +export declare const getContextEntry: (key: string, decoder: Decoder) => ContextEntry ``` Added in v1.0.0 @@ -1749,7 +2076,7 @@ Added in v1.0.0 **Signature** ```ts -export const getFunctionName = (f: Function): string => ... +export declare const getFunctionName: (f: Function) => string ``` Added in v1.0.0 @@ -1759,7 +2086,7 @@ Added in v1.0.0 **Signature** ```ts -export const identity = (a: A): A => ... +export declare const identity: (a: A) => A ``` Added in v1.0.0 @@ -1769,19 +2096,25 @@ Added in v1.0.0 **Signature** ```ts -export function intersection( - codecs: [A, B, C, D, E], - name?: string -): IntersectionC<[A, B, C, D, E]> -export function intersection( +export declare function intersection< + A extends Mixed, + B extends Mixed, + C extends Mixed, + D extends Mixed, + E extends Mixed +>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> +export declare function intersection( codecs: [A, B, C, D], name?: string ): IntersectionC<[A, B, C, D]> -export function intersection( +export declare function intersection( codecs: [A, B, C], name?: string ): IntersectionC<[A, B, C]> -export function intersection(codecs: [A, B], name?: string): IntersectionC<[A, B]> { ... } +export declare function intersection( + codecs: [A, B], + name?: string +): IntersectionC<[A, B]> ``` Added in v1.0.0 @@ -1791,12 +2124,7 @@ Added in v1.0.0 **Signature** ```ts -export const keyof = ( - keys: D, - name: string = Object.keys(keys) - .map(k => JSON.stringify(k)) - .join(' | ') -): KeyofC => ... +export declare const keyof: (keys: D, name?: string) => KeyofC ``` Added in v1.0.0 @@ -1806,7 +2134,7 @@ Added in v1.0.0 **Signature** ```ts -export const literal = (value: V, name: string = JSON.stringify(value)): LiteralC => ... +export declare const literal: (value: V, name?: string) => LiteralC ``` Added in v1.0.0 @@ -1816,7 +2144,7 @@ Added in v1.0.0 **Signature** ```ts -NullC +export declare const null: NullC ``` Added in v1.0.0 @@ -1826,7 +2154,7 @@ Added in v1.0.0 **Signature** ```ts -export const nullType: NullC = ... +export declare const nullType: NullC ``` Added in v1.0.0 @@ -1836,7 +2164,7 @@ Added in v1.0.0 **Signature** ```ts -export const number: NumberC = ... +export declare const number: NumberC ``` Added in v1.0.0 @@ -1846,10 +2174,7 @@ Added in v1.0.0 **Signature** ```ts -export const partial =

( - props: P, - name: string = getPartialTypeName(getInterfaceTypeName(props)) -): PartialC

=> ... +export declare const partial:

(props: P, name?: string) => PartialC

``` Added in v1.0.0 @@ -1859,7 +2184,7 @@ Added in v1.0.0 **Signature** ```ts -export const readonly = (codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC => ... +export declare const readonly: (codec: C, name?: string) => ReadonlyC ``` Added in v1.0.0 @@ -1869,10 +2194,7 @@ Added in v1.0.0 **Signature** ```ts -export const readonlyArray = ( - codec: C, - name: string = `ReadonlyArray<${codec.name}>` -): ReadonlyArrayC => ... +export declare const readonlyArray: (codec: C, name?: string) => ReadonlyArrayC ``` Added in v1.0.0 @@ -1882,7 +2204,7 @@ Added in v1.0.0 **Signature** ```ts -export function record(domain: D, codomain: C, name?: string): RecordC { ... } +export declare function record(domain: D, codomain: C, name?: string): RecordC ``` Added in v1.7.1 @@ -1892,10 +2214,10 @@ Added in v1.7.1 **Signature** ```ts -export const recursion = = Type>( +export declare const recursion: = Type>( name: string, definition: (self: C) => C -): RecursiveType => ... +) => RecursiveType ``` Added in v1.0.0 @@ -1907,7 +2229,7 @@ Strips additional properties **Signature** ```ts -export const strict =

(props: P, name?: string): ExactC> => ... +export declare const strict:

(props: P, name?: string) => ExactC> ``` Added in v1.0.0 @@ -1917,7 +2239,7 @@ Added in v1.0.0 **Signature** ```ts -export const string: StringC = ... +export declare const string: StringC ``` Added in v1.0.0 @@ -1927,7 +2249,7 @@ Added in v1.0.0 **Signature** ```ts -export const success: (value: T) => Validation = ... +export declare const success: (value: T) => Either ``` Added in v1.0.0 @@ -1937,20 +2259,20 @@ Added in v1.0.0 **Signature** ```ts -export function tuple( +export declare function tuple( codecs: [A, B, C, D, E], name?: string ): TupleC<[A, B, C, D, E]> -export function tuple( +export declare function tuple( codecs: [A, B, C, D], name?: string ): TupleC<[A, B, C, D]> -export function tuple( +export declare function tuple( codecs: [A, B, C], name?: string ): TupleC<[A, B, C]> -export function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> -export function tuple(codecs: [A], name?: string): TupleC<[A]> { ... } +export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> +export declare function tuple(codecs: [A], name?: string): TupleC<[A]> ``` Added in v1.0.0 @@ -1960,7 +2282,7 @@ Added in v1.0.0 **Signature** ```ts -export const type =

(props: P, name: string = getInterfaceTypeName(props)): TypeC

=> ... +export declare const type:

(props: P, name?: string) => TypeC

``` Added in v1.0.0 @@ -1970,7 +2292,7 @@ Added in v1.0.0 **Signature** ```ts -UndefinedC +export declare const undefined: UndefinedC ``` Added in v1.0.0 @@ -1980,10 +2302,7 @@ Added in v1.0.0 **Signature** ```ts -export const union = ]>( - codecs: CS, - name: string = getUnionName(codecs) -): UnionC => ... +export declare const union: (codecs: CS, name?: string) => UnionC ``` Added in v1.0.0 @@ -1993,7 +2312,7 @@ Added in v1.0.0 **Signature** ```ts -export const unknown: UnknownC = ... +export declare const unknown: UnknownC ``` Added in v1.5.0 @@ -2003,7 +2322,7 @@ Added in v1.5.0 **Signature** ```ts -VoidC +export declare const void: VoidC ``` Added in v1.0.0 @@ -2013,7 +2332,7 @@ Added in v1.0.0 **Signature** ```ts -export const voidType: VoidC = ... +export declare const voidType: VoidC ``` Added in v1.2.0 @@ -2025,7 +2344,7 @@ Use `UnknownArray` instead **Signature** ```ts -UnknownArrayC +export declare const Array: UnknownArrayC ``` Added in v1.0.0 @@ -2037,7 +2356,7 @@ Use `UnknownRecord` instead **Signature** ```ts -export const Dictionary: UnknownRecordC = ... +export declare const Dictionary: UnknownRecordC ``` Added in v1.0.0 @@ -2047,7 +2366,7 @@ Added in v1.0.0 **Signature** ```ts -export const Function: FunctionC = ... +export declare const Function: FunctionC ``` Added in v1.0.0 @@ -2059,7 +2378,7 @@ Use `Int` instead **Signature** ```ts -export const Integer: RefinementC = ... +export declare const Integer: RefinementC ``` Added in v1.0.0 @@ -2071,7 +2390,7 @@ Keeps the codec "kind" **Signature** ```ts -export function alias( +export declare function alias( codec: PartialType ): < // tslint:disable-next-line: deprecation @@ -2082,7 +2401,7 @@ export function alias( PP extends Exact = P, II extends I = I >() => PartialType -export function alias( +export declare function alias( // tslint:disable-next-line: deprecation codec: StrictType ): < @@ -2095,7 +2414,7 @@ export function alias( II extends I = I >() => // tslint:disable-next-line: deprecation StrictType -export function alias( +export declare function alias( codec: InterfaceType ): < // tslint:disable-next-line: deprecation @@ -2105,7 +2424,7 @@ export function alias( // tslint:disable-next-line: deprecation PP extends Exact = P, II extends I = I ->() => InterfaceType { ... } +>() => InterfaceType ``` Added in v1.1.0 @@ -2117,7 +2436,7 @@ Use `unknown` instead **Signature** ```ts -export const any: AnyC = ... +export declare const any: AnyC ``` Added in v1.0.0 @@ -2129,7 +2448,7 @@ Drops the codec "kind" **Signature** ```ts -export function clean(codec: Type): Type { ... } +export declare function clean(codec: Type): Type ``` Added in v1.1.0 @@ -2141,7 +2460,7 @@ Use `record` instead **Signature** ```ts -export const dictionary: typeof record = ... +export declare const dictionary: typeof record ``` Added in v1.0.0 @@ -2151,7 +2470,7 @@ Added in v1.0.0 **Signature** ```ts -export const getDefaultContext /* istanbul ignore next */ = (decoder: Decoder): Context => ... +export declare const getDefaultContext: (decoder: Decoder) => Context ``` Added in v1.0.0 @@ -2161,7 +2480,7 @@ Added in v1.0.0 **Signature** ```ts -export const getValidationError /* istanbul ignore next */ = (value: unknown, context: Context): ValidationError => ... +export declare const getValidationError: (value: unknown, context: Context) => ValidationError ``` Added in v1.0.0 @@ -2173,7 +2492,7 @@ Use `type` instead **Signature** ```ts -

(props: P, name?: string) => TypeC

+export declare const interface:

(props: P, name?: string) => TypeC

``` Added in v1.0.0 @@ -2183,7 +2502,7 @@ Added in v1.0.0 **Signature** ```ts -export const never: NeverC = ... +export declare const never: NeverC ``` Added in v1.0.0 @@ -2195,7 +2514,7 @@ Use `UnknownRecord` instead **Signature** ```ts -export const object: ObjectC = ... +export declare const object: ObjectC ``` Added in v1.0.0 @@ -2207,12 +2526,12 @@ Use `brand` instead **Signature** ```ts -export function refinement( +export declare function refinement( codec: C, predicate: Predicate>, name: string = `(${codec.name} | ${getFunctionName(predicate)})` ): // tslint:disable-next-line: deprecation -RefinementC { ... } +RefinementC ``` Added in v1.0.0 @@ -2224,12 +2543,11 @@ Use `union` instead **Signature** ```ts -export const taggedUnion = ]>( +export declare const taggedUnion: ( tag: Tag, codecs: CS, - name: string = getUnionName(codecs) - // tslint:disable-next-line: deprecation -): TaggedUnionC => ... + name?: string +) => TaggedUnionC ``` Added in v1.3.0 diff --git a/package-lock.json b/package-lock.json index e65d96633..177cddce9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.0.6", + "version": "2.1.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -14,27 +14,49 @@ } }, "@babel/core": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.4.5.tgz", - "integrity": "sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.4", - "@babel/helpers": "^7.4.4", - "@babel/parser": "^7.4.5", - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.4.5", - "@babel/types": "^7.4.4", - "convert-source-map": "^1.1.0", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.0.tgz", + "integrity": "sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.9.0", + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helpers": "^7.9.0", + "@babel/parser": "^7.9.0", + "@babel/template": "^7.8.6", + "@babel/traverse": "^7.9.0", + "@babel/types": "^7.9.0", + "convert-source-map": "^1.7.0", "debug": "^4.1.0", - "json5": "^2.1.0", - "lodash": "^4.17.11", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.13", "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" }, "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/highlight": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.9.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -44,6 +66,15 @@ "ms": "^2.1.1" } }, + "json5": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.2.tgz", + "integrity": "sha512-MoUOQ4WdiN3yxhm7NEVJSJrieAo5hNSLQ5sj05OTRHPL9HOBy8u4Bu88jsC1jvqAdN+E1bJmsUcZH+1HQxliqQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -59,16 +90,15 @@ } }, "@babel/generator": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", - "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", + "version": "7.9.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.4.tgz", + "integrity": "sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA==", "dev": true, "requires": { - "@babel/types": "^7.4.4", + "@babel/types": "^7.9.0", "jsesc": "^2.5.1", - "lodash": "^4.17.11", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" + "lodash": "^4.17.13", + "source-map": "^0.5.0" }, "dependencies": { "source-map": { @@ -80,49 +110,119 @@ } }, "@babel/helper-function-name": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", - "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", + "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" } }, "@babel/helper-get-function-arity": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", - "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", + "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", "dev": true, "requires": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", + "integrity": "sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-module-imports": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", + "integrity": "sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-module-transforms": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz", + "integrity": "sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.6", + "@babel/helper-simple-access": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/template": "^7.8.6", + "@babel/types": "^7.9.0", + "lodash": "^4.17.13" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", + "integrity": "sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" } }, "@babel/helper-plugin-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", - "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", + "integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==", "dev": true }, + "@babel/helper-replace-supers": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz", + "integrity": "sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/traverse": "^7.8.6", + "@babel/types": "^7.8.6" + } + }, + "@babel/helper-simple-access": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", + "integrity": "sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw==", + "dev": true, + "requires": { + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, "@babel/helper-split-export-declaration": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", - "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", + "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", "dev": true, "requires": { - "@babel/types": "^7.4.4" + "@babel/types": "^7.8.3" } }, + "@babel/helper-validator-identifier": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz", + "integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==", + "dev": true + }, "@babel/helpers": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.4.4.tgz", - "integrity": "sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A==", + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.9.2.tgz", + "integrity": "sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA==", "dev": true, "requires": { - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.4.4" + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.9.0", + "@babel/types": "^7.9.0" } }, "@babel/highlight": { @@ -137,48 +237,90 @@ } }, "@babel/parser": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.5.tgz", - "integrity": "sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew==", + "version": "7.9.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", + "integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==", "dev": true }, "@babel/plugin-syntax-object-rest-spread": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz", - "integrity": "sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.0" } }, "@babel/template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", - "integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", + "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", "dev": true, "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4" + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.6", + "@babel/types": "^7.8.6" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/highlight": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.9.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + } } }, "@babel/traverse": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.5.tgz", - "integrity": "sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.0.tgz", + "integrity": "sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w==", "dev": true, "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.4", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.4.5", - "@babel/types": "^7.4.4", + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.9.0", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.9.0", + "@babel/types": "^7.9.0", "debug": "^4.1.0", "globals": "^11.1.0", - "lodash": "^4.17.11" + "lodash": "^4.17.13" }, "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/highlight": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.9.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -197,20 +339,20 @@ } }, "@babel/types": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", - "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", + "integrity": "sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng==", "dev": true, "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.11", + "@babel/helper-validator-identifier": "^7.9.0", + "lodash": "^4.17.13", "to-fast-properties": "^2.0.0" } }, "@cnakazawa/watch": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz", - "integrity": "sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", + "integrity": "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==", "dev": true, "requires": { "exec-sh": "^0.3.2", @@ -228,12 +370,12 @@ } }, "@jest/console": { - "version": "24.7.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.7.1.tgz", - "integrity": "sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", + "integrity": "sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ==", "dev": true, "requires": { - "@jest/source-map": "^24.3.0", + "@jest/source-map": "^24.9.0", "chalk": "^2.0.1", "slash": "^2.0.0" }, @@ -246,74 +388,39 @@ } } }, - "@jest/core": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.8.0.tgz", - "integrity": "sha512-R9rhAJwCBQzaRnrRgAdVfnglUuATXdwTRsYqs6NMdVcAl5euG8LtWDe+fVkN27YfKVBW61IojVsXKaOmSnqd/A==", - "dev": true, - "requires": { - "@jest/console": "^24.7.1", - "@jest/reporters": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "graceful-fs": "^4.1.15", - "jest-changed-files": "^24.8.0", - "jest-config": "^24.8.0", - "jest-haste-map": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-regex-util": "^24.3.0", - "jest-resolve-dependencies": "^24.8.0", - "jest-runner": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-snapshot": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", - "jest-watcher": "^24.8.0", - "micromatch": "^3.1.10", - "p-each-series": "^1.0.0", - "pirates": "^4.0.1", - "realpath-native": "^1.1.0", - "rimraf": "^2.5.4", - "strip-ansi": "^5.0.0" - } - }, "@jest/environment": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.8.0.tgz", - "integrity": "sha512-vlGt2HLg7qM+vtBrSkjDxk9K0YtRBi7HfRFaDxoRtyi+DyVChzhF20duvpdAnKVBV6W5tym8jm0U9EfXbDk1tw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.9.0.tgz", + "integrity": "sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==", "dev": true, "requires": { - "@jest/fake-timers": "^24.8.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", - "jest-mock": "^24.8.0" + "@jest/fake-timers": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0" } }, "@jest/fake-timers": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.8.0.tgz", - "integrity": "sha512-2M4d5MufVXwi6VzZhJ9f5S/wU4ud2ck0kxPof1Iz3zWx6Y+V2eJrES9jEktB6O3o/oEyk+il/uNu9PvASjWXQw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.9.0.tgz", + "integrity": "sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A==", "dev": true, "requires": { - "@jest/types": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-mock": "^24.8.0" + "@jest/types": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0" } }, "@jest/reporters": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.8.0.tgz", - "integrity": "sha512-eZ9TyUYpyIIXfYCrw0UHUWUvE35vx5I92HGMgS93Pv7du+GHIzl+/vh8Qj9MCWFK/4TqyttVBPakWMOfZRIfxw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.9.0.tgz", + "integrity": "sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw==", "dev": true, "requires": { - "@jest/environment": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", "exit": "^0.1.2", "glob": "^7.1.2", @@ -321,13 +428,13 @@ "istanbul-lib-instrument": "^3.0.1", "istanbul-lib-report": "^2.0.4", "istanbul-lib-source-maps": "^3.0.1", - "istanbul-reports": "^2.1.1", - "jest-haste-map": "^24.8.0", - "jest-resolve": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-util": "^24.8.0", + "istanbul-reports": "^2.2.6", + "jest-haste-map": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", "jest-worker": "^24.6.0", - "node-notifier": "^5.2.1", + "node-notifier": "^5.4.2", "slash": "^2.0.0", "source-map": "^0.6.0", "string-length": "^2.0.0" @@ -342,9 +449,9 @@ } }, "@jest/source-map": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.3.0.tgz", - "integrity": "sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.9.0.tgz", + "integrity": "sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg==", "dev": true, "requires": { "callsites": "^3.0.0", @@ -353,45 +460,46 @@ } }, "@jest/test-result": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.8.0.tgz", - "integrity": "sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz", + "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==", "dev": true, "requires": { - "@jest/console": "^24.7.1", - "@jest/types": "^24.8.0", + "@jest/console": "^24.9.0", + "@jest/types": "^24.9.0", "@types/istanbul-lib-coverage": "^2.0.0" } }, "@jest/test-sequencer": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz", - "integrity": "sha512-OzL/2yHyPdCHXEzhoBuq37CE99nkme15eHkAzXRVqthreWZamEMA0WoetwstsQBCXABhczpK03JNbc4L01vvLg==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz", + "integrity": "sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A==", "dev": true, "requires": { - "@jest/test-result": "^24.8.0", - "jest-haste-map": "^24.8.0", - "jest-runner": "^24.8.0", - "jest-runtime": "^24.8.0" + "@jest/test-result": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0" } }, "@jest/transform": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.8.0.tgz", - "integrity": "sha512-xBMfFUP7TortCs0O+Xtez2W7Zu1PLH9bvJgtraN1CDST6LBM/eTOZ9SfwS/lvV8yOfcDpFmwf9bq5cYbXvqsvA==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.9.0.tgz", + "integrity": "sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "babel-plugin-istanbul": "^5.1.0", "chalk": "^2.0.1", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.1.15", - "jest-haste-map": "^24.8.0", - "jest-regex-util": "^24.3.0", - "jest-util": "^24.8.0", + "jest-haste-map": "^24.9.0", + "jest-regex-util": "^24.9.0", + "jest-util": "^24.9.0", "micromatch": "^3.1.10", + "pirates": "^4.0.1", "realpath-native": "^1.1.0", "slash": "^2.0.0", "source-map": "^0.6.1", @@ -407,14 +515,14 @@ } }, "@jest/types": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.8.0.tgz", - "integrity": "sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", + "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", "dev": true, "requires": { "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^12.0.9" + "@types/yargs": "^13.0.0" } }, "@nodelib/fs.scandir": { @@ -489,13 +597,19 @@ "jsonfile": "^4.0.0", "universalify": "^0.1.0" } + }, + "typescript": { + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", + "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "dev": true } } }, "@types/babel__core": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.2.tgz", - "integrity": "sha512-cfCCrFmiGY/yq0NuKNxIQvZFy9kY/1immpSpTngOnyIbD4+eJOG5mxphhHDv3CHL9GltO4GcKr54kGBg3RNdbg==", + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.7.tgz", + "integrity": "sha512-RL62NqSFPCDK2FM1pSDH0scHpJvsXtZNiYlMB73DgPBaG1E38ZYVL+ei5EkWRbr+KC4YNiAUNBnRj+bgwpgjMw==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -506,9 +620,9 @@ } }, "@types/babel__generator": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.0.2.tgz", - "integrity": "sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ==", + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz", + "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==", "dev": true, "requires": { "@babel/types": "^7.0.0" @@ -525,9 +639,9 @@ } }, "@types/babel__traverse": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.7.tgz", - "integrity": "sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw==", + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.9.tgz", + "integrity": "sha512-jEFQ8L1tuvPjOI8lnpaf73oCJe+aoxL6ygqSy6c8LcW98zaC+4mzWuQIRCEvKeCOu+lbqdXcg4Uqmm1S8AP1tw==", "dev": true, "requires": { "@babel/types": "^7.3.0" @@ -569,9 +683,9 @@ "dev": true }, "@types/istanbul-lib-report": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", - "integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", "dev": true, "requires": { "@types/istanbul-lib-coverage": "*" @@ -612,27 +726,36 @@ "dev": true }, "@types/yargs": { - "version": "12.0.12", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-12.0.12.tgz", - "integrity": "sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==", + "version": "13.0.8", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.8.tgz", + "integrity": "sha512-XAvHLwG7UQ+8M4caKIH0ZozIOYay5fQkAgyIXegXT9jPtdIGdhga+sUEdAr1CiG46aB+c64xQEYyEzlwWVTNzA==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", "dev": true }, "abab": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz", - "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", "dev": true }, "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "version": "5.7.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", + "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", "dev": true }, "acorn-globals": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.2.tgz", - "integrity": "sha512-BbzvZhVtZP+Bs1J1HcwrQe8ycfO0wStkSGxuul3He3GkHOIZ6eTqOkPuw9IP1X3+IkOo4wiJmwkobzXYz4wewQ==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", "dev": true, "requires": { "acorn": "^6.0.1", @@ -640,26 +763,26 @@ }, "dependencies": { "acorn": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz", - "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true } } }, "acorn-walk": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.1.1.tgz", - "integrity": "sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", "dev": true }, "ajv": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", - "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", "dev": true, "requires": { - "fast-deep-equal": "^2.0.1", + "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" @@ -811,9 +934,9 @@ "dev": true }, "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", "dev": true }, "asynckit": { @@ -844,22 +967,22 @@ "dev": true }, "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", "dev": true }, "babel-jest": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.8.0.tgz", - "integrity": "sha512-+5/kaZt4I9efoXzPlZASyK/lN9qdRKmmUav9smVc0ruPQD7IsfucQ87gpOE8mn2jbDuS6M/YOW6n3v9ZoIfgnw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz", + "integrity": "sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw==", "dev": true, "requires": { - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", "@types/babel__core": "^7.1.0", "babel-plugin-istanbul": "^5.1.0", - "babel-preset-jest": "^24.6.0", + "babel-preset-jest": "^24.9.0", "chalk": "^2.4.2", "slash": "^2.0.0" }, @@ -873,33 +996,34 @@ } }, "babel-plugin-istanbul": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.4.tgz", - "integrity": "sha512-dySz4VJMH+dpndj0wjJ8JPs/7i1TdSPb1nRrn56/92pKOF9VKC1FMFJmMXjzlGGusnCAqujP6PBCiKq0sVA+YQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz", + "integrity": "sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw==", "dev": true, "requires": { + "@babel/helper-plugin-utils": "^7.0.0", "find-up": "^3.0.0", "istanbul-lib-instrument": "^3.3.0", "test-exclude": "^5.2.3" } }, "babel-plugin-jest-hoist": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.6.0.tgz", - "integrity": "sha512-3pKNH6hMt9SbOv0F3WVmy5CWQ4uogS3k0GY5XLyQHJ9EGpAT9XWkFd2ZiXXtkwFHdAHa5j7w7kfxSP5lAIwu7w==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz", + "integrity": "sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==", "dev": true, "requires": { "@types/babel__traverse": "^7.0.6" } }, "babel-preset-jest": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.6.0.tgz", - "integrity": "sha512-pdZqLEdmy1ZK5kyRUfvBb2IfTPb2BUvIJczlPspS8fWmBQslNNDBqVfh7BW5leOVJMDZKzjD8XEyABTk6gQ5yw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz", + "integrity": "sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg==", "dev": true, "requires": { "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^24.6.0" + "babel-plugin-jest-hoist": "^24.9.0" } }, "bail": { @@ -974,9 +1098,9 @@ "dev": true }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true } } @@ -1000,6 +1124,16 @@ "platform": "^1.3.3" } }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "boundary": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/boundary/-/boundary-1.0.1.tgz", @@ -1064,9 +1198,9 @@ } }, "browser-process-hrtime": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", - "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", + "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", "dev": true }, "browser-resolve": { @@ -1102,9 +1236,9 @@ } }, "bser": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.0.tgz", - "integrity": "sha512-8zsjWrQkkBoLK6uxASk1nJ2SKv97ltiGDo6A3wA0/yRPz+CwmEyDo0hUrhIuukG2JHpAl3bvFIixw2/3Hi0DOg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", "dev": true, "requires": { "node-int64": "^0.4.0" @@ -1239,31 +1373,14 @@ } }, "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" } }, "co": { @@ -1278,12 +1395,6 @@ "integrity": "sha512-RG9hpXtWFeUWhuUav1YuP/vGcyncW+t90yJLk9fNZs1De2OuHTHKAKThVCokt29PYq5RoJ0QSZaIZ+rvPO23hA==", "dev": true }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, "coffee-script": { "version": "1.12.7", "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", @@ -1370,9 +1481,9 @@ } }, "convert-source-map": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", - "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", "dev": true, "requires": { "safe-buffer": "~5.1.1" @@ -1404,18 +1515,18 @@ } }, "cssom": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.6.tgz", - "integrity": "sha512-DtUeseGk9/GBW0hl0vVPpU22iHL6YB5BUX7ml1hB+GMpo0NX5G4voX3kdWiMSEguFtcW3Vh3djqNF4aIe6ne0A==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", "dev": true }, "cssstyle": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.3.0.tgz", - "integrity": "sha512-wXsoRfsRfsLVNaVzoKdqvEmK/5PFaEXNspVT22Ots6K/cnJdpoDKuQFw+qlMiXnmaif1OgeC466X1zISgAOcGg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", + "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", "dev": true, "requires": { - "cssom": "~0.3.6" + "cssom": "0.3.x" } }, "dashdash": { @@ -1439,9 +1550,9 @@ }, "dependencies": { "whatwg-url": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", - "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", "dev": true, "requires": { "lodash.sortby": "^4.7.0", @@ -1533,9 +1644,9 @@ "dev": true }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true } } @@ -1565,9 +1676,9 @@ "dev": true }, "diff-sequences": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.3.0.tgz", - "integrity": "sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz", + "integrity": "sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==", "dev": true }, "dir-glob": { @@ -1588,9 +1699,9 @@ } }, "docs-ts": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.3.4.tgz", - "integrity": "sha512-FYtLfQ5eUSLoTzBa/ACUoxVGzEQaw71T+XhWu0TwRM03S3AR5tygWe8jnsSiAg4FUNsrdkjv/PTmkPmyaPr0eA==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.4.0.tgz", + "integrity": "sha512-hH41W9xfny0HfTySTiLYHwjdUEiSWcAQKdmdentdOCTFCJrCedUCxMLK70oSeOdwHCAhlK+p5ApmdINA2Bsg9w==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -1605,9 +1716,9 @@ }, "dependencies": { "fp-ts": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.4.4.tgz", - "integrity": "sha512-J5wFa/BzT57A+DIvwAYS5LTsbRiXsvF9hsefP3ZfzsHLuWGjtHAheG1WscG1tX3og1PDZyv6mZAUTlpH1MmHhA==", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.3.tgz", + "integrity": "sha512-lQd+hahLd8cygNoXbEHDjH/cbF6XVWlEPb8h5GXXlozjCSDxWgclvkpOoTRfBA0P+r69l9VvW1nEsSGIJRQpWw==", "dev": true }, "rimraf": { @@ -1620,9 +1731,9 @@ } }, "ts-node": { - "version": "8.6.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.6.2.tgz", - "integrity": "sha512-4mZEbofxGqLL2RImpe3zMJukvEvcO1XP8bj8ozBPySdCUXEcU5cIRwR0aM3R+VoZq7iXc8N86NC0FspGRqP4gg==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.1.tgz", + "integrity": "sha512-10DE9ONho06QORKAaCBpPiFCdW+tZJuY/84tyypGtl6r+/C7Asq0dhqbRZURuUlLQtZxxDvT8eoj8cGW0ha6Bg==", "dev": true, "requires": { "arg": "^4.1.0", @@ -1710,7 +1821,7 @@ } }, "dtslint": { - "version": "github:gcanti/dtslint#fc1e289597786080ce559b4f8cc8798bb537080e", + "version": "github:gcanti/dtslint#e2f11f84997dbbd4aff3f867cda0a5a400931c87", "from": "github:gcanti/dtslint", "dev": true, "requires": { @@ -1757,9 +1868,9 @@ "dev": true }, "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "dev": true, "requires": { "once": "^1.4.0" @@ -1781,23 +1892,28 @@ } }, "es-abstract": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", - "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", "dev": true, "requires": { - "es-to-primitive": "^1.2.0", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-keys": "^1.0.12" + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "requires": { "is-callable": "^1.1.4", @@ -1812,24 +1928,16 @@ "dev": true }, "escodegen": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.1.tgz", - "integrity": "sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", + "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", "dev": true, "requires": { - "esprima": "^3.1.3", + "esprima": "^4.0.1", "estraverse": "^4.2.0", "esutils": "^2.0.2", "optionator": "^0.8.1", "source-map": "~0.6.1" - }, - "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - } } }, "esprima": { @@ -1839,9 +1947,9 @@ "dev": true }, "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, "esutils": { @@ -1851,9 +1959,9 @@ "dev": true }, "exec-sh": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.2.tgz", - "integrity": "sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz", + "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==", "dev": true }, "execa": { @@ -1913,17 +2021,17 @@ } }, "expect": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-24.8.0.tgz", - "integrity": "sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-24.9.0.tgz", + "integrity": "sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q==", "dev": true, "requires": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "ansi-styles": "^3.2.0", - "jest-get-type": "^24.8.0", - "jest-matcher-utils": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-regex-util": "^24.3.0" + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.9.0" } }, "extend": { @@ -1996,9 +2104,9 @@ } }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true } } @@ -2010,22 +2118,23 @@ "dev": true }, "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", "dev": true }, "fast-glob": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.1.1.tgz", - "integrity": "sha512-nTCREpBY8w8r+boyFYAx21iL6faSsQynliPHM4Uf56SbkyohCNxpVPEH9xrF5TXKy+IsjkPUHDKiUkzBVRXn9g==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.2.tgz", + "integrity": "sha512-UDV82o4uQyljznxwMxyVRJgZZt3O5wENYojjzbaGEGZgeOxkLFf+V4cnUD+krzb2F72E18RhamkMZ7AdeggF7A==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.0", "merge2": "^1.3.0", - "micromatch": "^4.0.2" + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" }, "dependencies": { "braces": { @@ -2086,12 +2195,12 @@ "dev": true }, "fastq": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.6.0.tgz", - "integrity": "sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.7.0.tgz", + "integrity": "sha512-YOadQRnHd5q6PogvAR/x62BGituF2ufiEA6s8aavQANw5YKHERI4AREboX6KotzP8oX2klxYF2wcV/7bn1clfQ==", "dev": true, "requires": { - "reusify": "^1.0.0" + "reusify": "^1.0.4" } }, "fault": { @@ -2104,14 +2213,21 @@ } }, "fb-watchman": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", - "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", + "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", "dev": true, "requires": { - "bser": "^2.0.0" + "bser": "2.1.1" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fill-range": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", @@ -2196,40 +2312,37 @@ "dev": true }, "fsevents": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", - "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==", + "version": "1.2.12", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz", + "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==", "dev": true, "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1", - "node-pre-gyp": "^0.12.0" + "node-pre-gyp": "*" }, "dependencies": { "abbrev": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "bundled": true, "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "bundled": true, "dev": true }, "aproba": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "bundled": true, "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2239,14 +2352,12 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "bundled": true, "dev": true }, "brace-expansion": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "bundled": true, "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -2254,41 +2365,35 @@ } }, "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "version": "1.1.4", + "bundled": true, "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "bundled": true, "dev": true }, "concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "bundled": true, "dev": true }, "console-control-strings": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "bundled": true, "dev": true }, "core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "bundled": true, "dev": true, "optional": true }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "3.2.6", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2297,46 +2402,40 @@ }, "deep-extend": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "bundled": true, "dev": true, "optional": true }, "delegates": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "bundled": true, "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "bundled": true, "dev": true, "optional": true }, "fs-minipass": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", - "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", + "version": "1.2.7", + "bundled": true, "dev": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "^2.6.0" } }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "bundled": true, "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2351,9 +2450,8 @@ } }, "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.1.6", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2367,15 +2465,13 @@ }, "has-unicode": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "bundled": true, "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2383,9 +2479,8 @@ } }, "ignore-walk": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", - "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "version": "3.0.3", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2394,8 +2489,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2404,22 +2498,19 @@ } }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "version": "2.0.4", + "bundled": true, "dev": true }, "ini": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "bundled": true, "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "bundled": true, "dev": true, "requires": { "number-is-nan": "^1.0.0" @@ -2427,30 +2518,26 @@ }, "isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "bundled": true, "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "bundled": true, "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "version": "1.2.5", + "bundled": true, "dev": true }, "minipass": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", - "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "version": "2.9.0", + "bundled": true, "dev": true, "requires": { "safe-buffer": "^5.1.2", @@ -2458,47 +2545,42 @@ } }, "minizlib": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", - "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "version": "1.3.3", + "bundled": true, "dev": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "^2.9.0" } }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.3", + "bundled": true, "dev": true, "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.5" } }, "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "version": "2.1.2", + "bundled": true, "dev": true, "optional": true }, "needle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.0.tgz", - "integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==", + "version": "2.3.3", + "bundled": true, "dev": true, "optional": true, "requires": { - "debug": "^4.1.0", + "debug": "^3.2.6", "iconv-lite": "^0.4.4", "sax": "^1.2.4" } }, "node-pre-gyp": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz", - "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==", + "version": "0.14.0", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2511,13 +2593,12 @@ "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", - "tar": "^4" + "tar": "^4.4.2" } }, "nopt": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "version": "4.0.3", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2526,27 +2607,33 @@ } }, "npm-bundled": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", - "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", + "version": "1.1.1", + "bundled": true, "dev": true, - "optional": true + "optional": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "bundled": true, + "dev": true }, "npm-packlist": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz", - "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", + "version": "1.4.8", + "bundled": true, "dev": true, "optional": true, "requires": { "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" } }, "npmlog": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2558,21 +2645,18 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "bundled": true, "dev": true }, "object-assign": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "bundled": true, "dev": true, "optional": true }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "bundled": true, "dev": true, "requires": { "wrappy": "1" @@ -2580,22 +2664,19 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "bundled": true, "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "bundled": true, "dev": true, "optional": true }, "osenv": { "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2605,22 +2686,19 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "bundled": true, "dev": true, "optional": true }, "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "version": "2.0.1", + "bundled": true, "dev": true, "optional": true }, "rc": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2628,21 +2706,11 @@ "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true, - "optional": true - } } }, "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "version": "2.3.7", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2656,9 +2724,8 @@ } }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "2.7.1", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2667,49 +2734,42 @@ }, "safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "bundled": true, "dev": true }, "safer-buffer": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "bundled": true, "dev": true, "optional": true }, "sax": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "bundled": true, "dev": true, "optional": true }, "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "version": "5.7.1", + "bundled": true, "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "bundled": true, "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "bundled": true, "dev": true, "optional": true }, "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "bundled": true, "dev": true, "requires": { "code-point-at": "^1.0.0", @@ -2719,8 +2779,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2729,8 +2788,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "bundled": true, "dev": true, "requires": { "ansi-regex": "^2.0.0" @@ -2738,38 +2796,34 @@ }, "strip-json-comments": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "bundled": true, "dev": true, "optional": true }, "tar": { - "version": "4.4.8", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", - "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", + "version": "4.4.13", + "bundled": true, "dev": true, "optional": true, "requires": { "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", "mkdirp": "^0.5.0", "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" + "yallist": "^3.0.3" } }, "util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "bundled": true, "dev": true, "optional": true }, "wide-align": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2778,14 +2832,12 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "bundled": true, "dev": true }, "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", + "version": "3.1.1", + "bundled": true, "dev": true } } @@ -2796,10 +2848,16 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true + }, "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, "get-stream": { @@ -2841,9 +2899,9 @@ } }, "glob-parent": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", - "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "dev": true, "requires": { "is-glob": "^4.0.1" @@ -2913,18 +2971,6 @@ "through2": "^2.0.0" } }, - "handlebars": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", - "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==", - "dev": true, - "requires": { - "neo-async": "^2.6.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" - } - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -2957,9 +3003,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, "has-value": { @@ -3029,9 +3075,9 @@ "dev": true }, "hosted-git-info": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", - "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, "html-encoding-sniffer": { @@ -3043,6 +3089,12 @@ "whatwg-encoding": "^1.0.1" } }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, "htmlparser2": { "version": "3.9.2", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", @@ -3199,12 +3251,6 @@ "loose-envify": "^1.0.0" } }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", - "dev": true - }, "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -3253,9 +3299,9 @@ "dev": true }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", "dev": true }, "is-ci": { @@ -3277,9 +3323,9 @@ } }, "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, "is-decimal": { @@ -3385,12 +3431,12 @@ } }, "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", "dev": true, "requires": { - "has": "^1.0.1" + "has": "^1.0.3" } }, "is-relative": { @@ -3409,12 +3455,12 @@ "dev": true }, "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "dev": true, "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.1" } }, "is-typedarray": { @@ -3505,9 +3551,9 @@ }, "dependencies": { "semver": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz", - "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -3563,9 +3609,9 @@ "dev": true }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "requires": { "glob": "^7.1.3" @@ -3574,12 +3620,12 @@ } }, "istanbul-reports": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz", - "integrity": "sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA==", + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", + "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", "dev": true, "requires": { - "handlebars": "^4.1.2" + "html-escaper": "^2.0.0" } }, "jest": { @@ -3593,205 +3639,383 @@ }, "dependencies": { "jest-cli": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.8.0.tgz", - "integrity": "sha512-+p6J00jSMPQ116ZLlHJJvdf8wbjNbZdeSX9ptfHX06/MSNaXmKihQzx5vQcw0q2G6JsdVkUIdWbOWtSnaYs3yA==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.9.0.tgz", + "integrity": "sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg==", "dev": true, "requires": { - "@jest/core": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/core": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", "exit": "^0.1.2", "import-local": "^2.0.0", "is-ci": "^2.0.0", - "jest-config": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", + "jest-config": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", "prompts": "^2.0.1", "realpath-native": "^1.1.0", - "yargs": "^12.0.2" - } + "yargs": "^13.3.0" + }, + "dependencies": { + "@jest/core": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.9.0.tgz", + "integrity": "sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A==", + "dev": true, + "requires": { + "@jest/console": "^24.7.1", + "@jest/reporters": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "graceful-fs": "^4.1.15", + "jest-changed-files": "^24.9.0", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-resolve-dependencies": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "jest-watcher": "^24.9.0", + "micromatch": "^3.1.10", + "p-each-series": "^1.0.0", + "realpath-native": "^1.1.0", + "rimraf": "^2.5.4", + "slash": "^2.0.0", + "strip-ansi": "^5.0.0" + } + }, + "@jest/test-result": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz", + "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==", + "dev": true, + "requires": { + "@jest/console": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/istanbul-lib-coverage": "^2.0.0" + } + }, + "@jest/types": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", + "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^13.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "jest-config": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz", + "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^24.9.0", + "@jest/types": "^24.9.0", + "babel-jest": "^24.9.0", + "chalk": "^2.0.1", + "glob": "^7.1.1", + "jest-environment-jsdom": "^24.9.0", + "jest-environment-node": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "micromatch": "^3.1.10", + "pretty-format": "^24.9.0", + "realpath-native": "^1.1.0" + } + }, + "jest-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz", + "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==", + "dev": true, + "requires": { + "@jest/console": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/source-map": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "callsites": "^3.0.0", + "chalk": "^2.0.1", + "graceful-fs": "^4.1.15", + "is-ci": "^2.0.0", + "mkdirp": "^0.5.1", + "slash": "^2.0.0", + "source-map": "^0.6.0" + } + }, + "jest-validate": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", + "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "camelcase": "^5.3.1", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "leven": "^3.1.0", + "pretty-format": "^24.9.0" + } + }, + "prompts": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", + "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.4" + } + }, + "realpath-native": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.1.0.tgz", + "integrity": "sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA==", + "dev": true, + "requires": { + "util.promisify": "^1.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + } + } + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true } } }, "jest-changed-files": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.8.0.tgz", - "integrity": "sha512-qgANC1Yrivsq+UrLXsvJefBKVoCsKB0Hv+mBb6NMjjZ90wwxCDmU3hsCXBya30cH+LnPYjwgcU65i6yJ5Nfuug==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz", + "integrity": "sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg==", "dev": true, "requires": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "execa": "^1.0.0", "throat": "^4.0.0" } }, "jest-config": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.8.0.tgz", - "integrity": "sha512-Czl3Nn2uEzVGsOeaewGWoDPD8GStxCpAe0zOYs2x2l0fZAgPbCr3uwUkgNKV3LwE13VXythM946cd5rdGkkBZw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz", + "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^24.8.0", - "@jest/types": "^24.8.0", - "babel-jest": "^24.8.0", + "@jest/test-sequencer": "^24.9.0", + "@jest/types": "^24.9.0", + "babel-jest": "^24.9.0", "chalk": "^2.0.1", "glob": "^7.1.1", - "jest-environment-jsdom": "^24.8.0", - "jest-environment-node": "^24.8.0", - "jest-get-type": "^24.8.0", - "jest-jasmine2": "^24.8.0", + "jest-environment-jsdom": "^24.9.0", + "jest-environment-node": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-jasmine2": "^24.9.0", "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", + "jest-resolve": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", "micromatch": "^3.1.10", - "pretty-format": "^24.8.0", + "pretty-format": "^24.9.0", "realpath-native": "^1.1.0" } }, "jest-diff": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.8.0.tgz", - "integrity": "sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz", + "integrity": "sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==", "dev": true, "requires": { "chalk": "^2.0.1", - "diff-sequences": "^24.3.0", - "jest-get-type": "^24.8.0", - "pretty-format": "^24.8.0" + "diff-sequences": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" } }, "jest-docblock": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.3.0.tgz", - "integrity": "sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.9.0.tgz", + "integrity": "sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA==", "dev": true, "requires": { "detect-newline": "^2.1.0" } }, "jest-each": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.8.0.tgz", - "integrity": "sha512-NrwK9gaL5+XgrgoCsd9svsoWdVkK4gnvyhcpzd6m487tXHqIdYeykgq3MKI1u4I+5Zf0tofr70at9dWJDeb+BA==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.9.0.tgz", + "integrity": "sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog==", "dev": true, "requires": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", - "jest-get-type": "^24.8.0", - "jest-util": "^24.8.0", - "pretty-format": "^24.8.0" + "jest-get-type": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0" } }, "jest-environment-jsdom": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.8.0.tgz", - "integrity": "sha512-qbvgLmR7PpwjoFjM/sbuqHJt/NCkviuq9vus9NBn/76hhSidO+Z6Bn9tU8friecegbJL8gzZQEMZBQlFWDCwAQ==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz", + "integrity": "sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA==", "dev": true, "requires": { - "@jest/environment": "^24.8.0", - "@jest/fake-timers": "^24.8.0", - "@jest/types": "^24.8.0", - "jest-mock": "^24.8.0", - "jest-util": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0", "jsdom": "^11.5.1" } }, "jest-environment-node": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.8.0.tgz", - "integrity": "sha512-vIGUEScd1cdDgR6sqn2M08sJTRLQp6Dk/eIkCeO4PFHxZMOgy+uYLPMC4ix3PEfM5Au/x3uQ/5Tl0DpXXZsJ/Q==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.9.0.tgz", + "integrity": "sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA==", "dev": true, "requires": { - "@jest/environment": "^24.8.0", - "@jest/fake-timers": "^24.8.0", - "@jest/types": "^24.8.0", - "jest-mock": "^24.8.0", - "jest-util": "^24.8.0" + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0" } }, "jest-get-type": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.8.0.tgz", - "integrity": "sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz", + "integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==", "dev": true }, "jest-haste-map": { - "version": "24.8.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.8.1.tgz", - "integrity": "sha512-SwaxMGVdAZk3ernAx2Uv2sorA7jm3Kx+lR0grp6rMmnY06Kn/urtKx1LPN2mGTea4fCT38impYT28FfcLUhX0g==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.9.0.tgz", + "integrity": "sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ==", "dev": true, "requires": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "anymatch": "^2.0.0", "fb-watchman": "^2.0.0", "fsevents": "^1.2.7", "graceful-fs": "^4.1.15", "invariant": "^2.2.4", - "jest-serializer": "^24.4.0", - "jest-util": "^24.8.0", - "jest-worker": "^24.6.0", + "jest-serializer": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.9.0", "micromatch": "^3.1.10", "sane": "^4.0.3", "walker": "^1.0.7" } }, "jest-jasmine2": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.8.0.tgz", - "integrity": "sha512-cEky88npEE5LKd5jPpTdDCLvKkdyklnaRycBXL6GNmpxe41F0WN44+i7lpQKa/hcbXaQ+rc9RMaM4dsebrYong==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz", + "integrity": "sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==", "dev": true, "requires": { "@babel/traverse": "^7.1.0", - "@jest/environment": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", "co": "^4.6.0", - "expect": "^24.8.0", + "expect": "^24.9.0", "is-generator-fn": "^2.0.0", - "jest-each": "^24.8.0", - "jest-matcher-utils": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-snapshot": "^24.8.0", - "jest-util": "^24.8.0", - "pretty-format": "^24.8.0", + "jest-each": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0", "throat": "^4.0.0" } }, "jest-leak-detector": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.8.0.tgz", - "integrity": "sha512-cG0yRSK8A831LN8lIHxI3AblB40uhv0z+SsQdW3GoMMVcK+sJwrIIyax5tu3eHHNJ8Fu6IMDpnLda2jhn2pD/g==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz", + "integrity": "sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==", "dev": true, "requires": { - "pretty-format": "^24.8.0" + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" } }, "jest-matcher-utils": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz", - "integrity": "sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz", + "integrity": "sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==", "dev": true, "requires": { "chalk": "^2.0.1", - "jest-diff": "^24.8.0", - "jest-get-type": "^24.8.0", - "pretty-format": "^24.8.0" + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" } }, "jest-message-util": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.8.0.tgz", - "integrity": "sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.9.0.tgz", + "integrity": "sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "@types/stack-utils": "^1.0.1", "chalk": "^2.0.1", "micromatch": "^3.1.10", @@ -3808,12 +4032,12 @@ } }, "jest-mock": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.8.0.tgz", - "integrity": "sha512-6kWugwjGjJw+ZkK4mDa0Df3sDlUTsV47MSrT0nGQ0RBWJbpODDQ8MHDVtGtUYBne3IwZUhtB7elxHspU79WH3A==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.9.0.tgz", + "integrity": "sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w==", "dev": true, "requires": { - "@jest/types": "^24.8.0" + "@jest/types": "^24.9.0" } }, "jest-pnp-resolver": { @@ -3823,18 +4047,18 @@ "dev": true }, "jest-regex-util": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.3.0.tgz", - "integrity": "sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.9.0.tgz", + "integrity": "sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA==", "dev": true }, "jest-resolve": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.8.0.tgz", - "integrity": "sha512-+hjSzi1PoRvnuOICoYd5V/KpIQmkAsfjFO71458hQ2Whi/yf1GDeBOFj8Gxw4LrApHsVJvn5fmjcPdmoUHaVKw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.9.0.tgz", + "integrity": "sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ==", "dev": true, "requires": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "browser-resolve": "^1.11.3", "chalk": "^2.0.1", "jest-pnp-resolver": "^1.2.1", @@ -3842,72 +4066,72 @@ } }, "jest-resolve-dependencies": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.8.0.tgz", - "integrity": "sha512-hyK1qfIf/krV+fSNyhyJeq3elVMhK9Eijlwy+j5jqmZ9QsxwKBiP6qukQxaHtK8k6zql/KYWwCTQ+fDGTIJauw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz", + "integrity": "sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g==", "dev": true, "requires": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "jest-regex-util": "^24.3.0", - "jest-snapshot": "^24.8.0" + "jest-snapshot": "^24.9.0" } }, "jest-runner": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.8.0.tgz", - "integrity": "sha512-utFqC5BaA3JmznbissSs95X1ZF+d+4WuOWwpM9+Ak356YtMhHE/GXUondZdcyAAOTBEsRGAgH/0TwLzfI9h7ow==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.9.0.tgz", + "integrity": "sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg==", "dev": true, "requires": { "@jest/console": "^24.7.1", - "@jest/environment": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.4.2", "exit": "^0.1.2", "graceful-fs": "^4.1.15", - "jest-config": "^24.8.0", + "jest-config": "^24.9.0", "jest-docblock": "^24.3.0", - "jest-haste-map": "^24.8.0", - "jest-jasmine2": "^24.8.0", - "jest-leak-detector": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-resolve": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-util": "^24.8.0", + "jest-haste-map": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-leak-detector": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", "jest-worker": "^24.6.0", "source-map-support": "^0.5.6", "throat": "^4.0.0" } }, "jest-runtime": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.8.0.tgz", - "integrity": "sha512-Mq0aIXhvO/3bX44ccT+czU1/57IgOMyy80oM0XR/nyD5zgBcesF84BPabZi39pJVA6UXw+fY2Q1N+4BiVUBWOA==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.9.0.tgz", + "integrity": "sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==", "dev": true, "requires": { "@jest/console": "^24.7.1", - "@jest/environment": "^24.8.0", + "@jest/environment": "^24.9.0", "@jest/source-map": "^24.3.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", - "@types/yargs": "^12.0.2", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", "chalk": "^2.0.1", "exit": "^0.1.2", "glob": "^7.1.3", "graceful-fs": "^4.1.15", - "jest-config": "^24.8.0", - "jest-haste-map": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-mock": "^24.8.0", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0", "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.8.0", - "jest-snapshot": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", + "jest-resolve": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", "realpath-native": "^1.1.0", "slash": "^2.0.0", "strip-bom": "^3.0.0", - "yargs": "^12.0.2" + "yargs": "^13.3.0" }, "dependencies": { "slash": { @@ -3919,42 +4143,51 @@ } }, "jest-serializer": { - "version": "24.4.0", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-24.4.0.tgz", - "integrity": "sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-24.9.0.tgz", + "integrity": "sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==", "dev": true }, "jest-snapshot": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.8.0.tgz", - "integrity": "sha512-5ehtWoc8oU9/cAPe6fez6QofVJLBKyqkY2+TlKTOf0VllBB/mqUNdARdcjlZrs9F1Cv+/HKoCS/BknT0+tmfPg==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.9.0.tgz", + "integrity": "sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew==", "dev": true, "requires": { "@babel/types": "^7.0.0", - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", - "expect": "^24.8.0", - "jest-diff": "^24.8.0", - "jest-matcher-utils": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-resolve": "^24.8.0", + "expect": "^24.9.0", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "pretty-format": "^24.8.0", - "semver": "^5.5.0" + "pretty-format": "^24.9.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, "jest-util": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.8.0.tgz", - "integrity": "sha512-DYZeE+XyAnbNt0BG1OQqKy/4GVLPtzwGx5tsnDrFcax36rVE3lTA5fbvgmbVPUZf9w77AJ8otqR4VBbfFJkUZA==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz", + "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==", "dev": true, "requires": { - "@jest/console": "^24.7.1", - "@jest/fake-timers": "^24.8.0", - "@jest/source-map": "^24.3.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/console": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/source-map": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "callsites": "^3.0.0", "chalk": "^2.0.1", "graceful-fs": "^4.1.15", @@ -3973,41 +4206,41 @@ } }, "jest-validate": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.8.0.tgz", - "integrity": "sha512-+/N7VOEMW1Vzsrk3UWBDYTExTPwf68tavEPKDnJzrC6UlHtUDU/fuEdXqFoHzv9XnQ+zW6X3qMZhJ3YexfeLDA==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", + "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", "dev": true, "requires": { - "@jest/types": "^24.8.0", - "camelcase": "^5.0.0", + "@jest/types": "^24.9.0", + "camelcase": "^5.3.1", "chalk": "^2.0.1", - "jest-get-type": "^24.8.0", - "leven": "^2.1.0", - "pretty-format": "^24.8.0" + "jest-get-type": "^24.9.0", + "leven": "^3.1.0", + "pretty-format": "^24.9.0" } }, "jest-watcher": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.8.0.tgz", - "integrity": "sha512-SBjwHt5NedQoVu54M5GEx7cl7IGEFFznvd/HNT8ier7cCAx/Qgu9ZMlaTQkvK22G1YOpcWBLQPFSImmxdn3DAw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.9.0.tgz", + "integrity": "sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw==", "dev": true, "requires": { - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", - "@types/yargs": "^12.0.9", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", "ansi-escapes": "^3.0.0", "chalk": "^2.0.1", - "jest-util": "^24.8.0", + "jest-util": "^24.9.0", "string-length": "^2.0.0" } }, "jest-worker": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.6.0.tgz", - "integrity": "sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", + "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", "dev": true, "requires": { - "merge-stream": "^1.0.1", + "merge-stream": "^2.0.0", "supports-color": "^6.1.0" }, "dependencies": { @@ -4162,15 +4395,6 @@ "set-getter": "^0.1.0" } }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, "left-pad": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", @@ -4178,9 +4402,9 @@ "dev": true }, "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "dev": true }, "levn": { @@ -4306,15 +4530,6 @@ "tmpl": "1.0.x" } }, - "map-age-cleaner": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", - "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "dev": true, - "requires": { - "p-defer": "^1.0.0" - } - }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -4368,25 +4583,11 @@ "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", "dev": true }, - "mem": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", - "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", - "dev": true, - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - } - }, "merge-stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", - "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true }, "merge2": { "version": "1.3.0", @@ -4435,34 +4636,28 @@ } }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true } } }, "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", "dev": true }, "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", "dev": true, "requires": { - "mime-db": "1.40.0" + "mime-db": "1.43.0" } }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -4473,9 +4668,9 @@ } }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mixin-deep": { @@ -4500,20 +4695,12 @@ } }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } + "minimist": "^1.2.5" } }, "mocha": { @@ -4570,6 +4757,21 @@ "path-is-absolute": "^1.0.0" } }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -4654,9 +4856,9 @@ } }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true } } @@ -4667,12 +4869,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "neo-async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", - "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", - "dev": true - }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -4692,9 +4888,9 @@ "dev": true }, "node-notifier": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.0.tgz", - "integrity": "sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz", + "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==", "dev": true, "requires": { "growly": "^1.3.0", @@ -4734,16 +4930,10 @@ "path-key": "^2.0.0" } }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, "nwsapi": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.4.tgz", - "integrity": "sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", + "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", "dev": true }, "oauth-sign": { @@ -4774,6 +4964,12 @@ } } }, + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "dev": true + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -4797,14 +4993,26 @@ } } }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "dev": true, "requires": { "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" } }, "object.pick": { @@ -4833,63 +5041,20 @@ "wrappy": "1" } }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - } - } - }, "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, "requires": { "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", + "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - }, - "dependencies": { - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - } - } - }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" + "word-wrap": "~1.2.3" } }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", - "dev": true - }, "p-each-series": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-1.0.0.tgz", @@ -4905,12 +5070,6 @@ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, - "p-is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", - "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", - "dev": true - }, "p-limit": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", @@ -5023,9 +5182,9 @@ "dev": true }, "picomatch": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz", - "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, "pify": { @@ -5077,18 +5236,18 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz", + "integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==", "dev": true }, "pretty-format": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.8.0.tgz", - "integrity": "sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw==", + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz", + "integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==", "dev": true, "requires": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0", "react-is": "^16.8.4" @@ -5100,20 +5259,10 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, - "prompts": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.1.0.tgz", - "integrity": "sha512-+x5TozgqYdOwWsQFZizE/Tra3fKvAoy037kOyU6cgz84n8f6zxngLOV4O32kTwt9FcLCxAqw0P/c8rOr9y+Gfg==", - "dev": true, - "requires": { - "kleur": "^3.0.2", - "sisteransi": "^1.0.0" - } - }, "psl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz", - "integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "dev": true }, "pump": { @@ -5164,9 +5313,9 @@ } }, "react-is": { - "version": "16.8.6", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", - "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==", + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, "read-pkg": { @@ -5313,9 +5462,9 @@ "dev": true }, "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -5325,7 +5474,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.0", + "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", @@ -5335,45 +5484,27 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", + "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - } } }, "request-promise-core": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", - "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", "dev": true, "requires": { - "lodash": "^4.17.11" + "lodash": "^4.17.15" } }, "request-promise-native": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", - "integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", "dev": true, "requires": { - "request-promise-core": "1.1.2", + "request-promise-core": "1.1.3", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" } @@ -5552,15 +5683,15 @@ "dev": true }, "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, "sisteransi": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.0.tgz", - "integrity": "sha512-N+z4pHB4AmUv0SjveWRd6q1Nj5w62m5jodv+GD8lvmbY/83T/rpbJGZOnK5T149OldDj4Db07BSv9xY4K6NTPQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", "dev": true }, "slash": { @@ -5658,9 +5789,9 @@ "dev": true }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true } } @@ -5681,12 +5812,12 @@ "dev": true }, "source-map-resolve": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", - "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", "dev": true, "requires": { - "atob": "^2.1.1", + "atob": "^2.1.2", "decode-uri-component": "^0.2.0", "resolve-url": "^0.2.1", "source-map-url": "^0.4.0", @@ -5736,9 +5867,9 @@ } }, "spdx-license-ids": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz", - "integrity": "sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", "dev": true }, "split-string": { @@ -5861,32 +5992,66 @@ } }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { + "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "strip-ansi": "^5.1.0" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } } } }, + "string.prototype.trimend": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz", + "integrity": "sha512-EEJnGqa/xNfIg05SxiPSqRS7S9qwDhYts1TSLR1BQfYUfPe1stofgGKvwERK9+9yf+PpfBMlpBaCHucXGPQfUA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string.prototype.trimleft": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", + "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimstart": "^1.0.0" + } + }, + "string.prototype.trimright": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", + "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimend": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.0.tgz", + "integrity": "sha512-iCP8g01NFYiiBOnwG1Xc3WZLyoo+RuBymwIlWncShXDDJYWN6DbnM3odslBJdgCdRlq94B5s63NWAZlcn2CS4w==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -6093,12 +6258,6 @@ "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", "dev": true }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, "trim-trailing-lines": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.2.tgz", @@ -6320,31 +6479,11 @@ "dev": true }, "typescript": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", - "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", "dev": true }, - "uglify-js": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz", - "integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==", - "dev": true, - "optional": true, - "requires": { - "commander": "~2.20.3", - "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true, - "optional": true - } - } - }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -6512,19 +6651,21 @@ "dev": true }, "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", + "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.2", + "has-symbols": "^1.0.1", + "object.getownpropertydescriptors": "^2.1.0" } }, "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "dev": true }, "validate-npm-package-license": { @@ -6576,12 +6717,12 @@ } }, "w3c-hr-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", - "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", "dev": true, "requires": { - "browser-process-hrtime": "^0.1.2" + "browser-process-hrtime": "^1.0.0" } }, "walker": { @@ -6640,57 +6781,21 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" } }, "wrappy": { @@ -6744,37 +6849,27 @@ "dev": true }, "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", "dev": true, "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", + "cliui": "^5.0.0", "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", + "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", + "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", - "string-width": "^2.0.0", + "string-width": "^3.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - }, - "dependencies": { - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - } + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" } }, "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "requires": { "camelcase": "^5.0.0", diff --git a/package.json b/package.json index 6860f3857..073431da0 100644 --- a/package.json +++ b/package.json @@ -46,20 +46,20 @@ "@types/jest": "^23.3.8", "@types/node": "7.0.4", "benchmark": "2.1.4", - "docs-ts": "^0.3.4", + "docs-ts": "^0.4.0", "doctoc": "^1.4.0", "dtslint": "github:gcanti/dtslint", "fp-ts": "^2.0.0", "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "^24.8.0", "mocha": "^5.2.0", - "prettier": "^1.19.1", + "prettier": "^2.0.2", "rimraf": "2.6.2", "ts-jest": "^24.0.2", "ts-node": "^7.0.1", "tslint": "^5.11.0", "tslint-config-standard": "^8.0.1", - "typescript": "^3.7.4" + "typescript": "^3.8.3" }, "tags": [ "typescript", diff --git a/src/ThrowReporter.ts b/src/ThrowReporter.ts index 3de0c1438..544b1f396 100644 --- a/src/ThrowReporter.ts +++ b/src/ThrowReporter.ts @@ -11,7 +11,7 @@ import { isLeft } from 'fp-ts/lib/Either' * @deprecated */ export const ThrowReporter: Reporter = { - report: validation => { + report: (validation) => { if (isLeft(validation)) { throw new Error(PathReporter.report(validation).join('\n')) } diff --git a/src/index.ts b/src/index.ts index 875709457..0af62149d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -109,8 +109,17 @@ export interface Encoder { * @since 1.0.0 */ export class Type implements Decoder, Encoder { + /** + * @since 1.0.0 + */ readonly _A!: A + /** + * @since 1.0.0 + */ readonly _O!: O + /** + * @since 1.0.0 + */ readonly _I!: I constructor( /** a unique name for this codec */ @@ -136,8 +145,8 @@ export class Type implements Decoder, Encoder return new Type( name, ab.is, - (i, c) => chain(this.validate(i, c), a => ab.validate(a, c)), - this.encode === identity && ab.encode === identity ? (identity as any) : b => this.encode(ab.encode(b)) + (i, c) => chain(this.validate(i, c), (a) => ab.validate(a, c)), + this.encode === identity && ab.encode === identity ? (identity as any) : (b) => this.encode(ab.encode(b)) ) } /** @@ -221,6 +230,9 @@ const pushAll = (xs: Array, ys: Array): void => { * @since 1.0.0 */ export class NullType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'NullType' = 'NullType' constructor() { super( @@ -246,6 +258,9 @@ export const nullType: NullC = new NullType() * @since 1.0.0 */ export class UndefinedType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'UndefinedType' = 'UndefinedType' constructor() { super( @@ -268,6 +283,9 @@ const undefinedType: UndefinedC = new UndefinedType() * @since 1.2.0 */ export class VoidType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'VoidType' = 'VoidType' constructor() { super('void', undefinedType.is, undefinedType.validate, identity) @@ -288,6 +306,9 @@ export const voidType: VoidC = new VoidType() * @since 1.5.0 */ export class UnknownType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'UnknownType' = 'UnknownType' constructor() { super('unknown', (_): _ is unknown => true, success, identity) @@ -308,6 +329,9 @@ export const unknown: UnknownC = new UnknownType() * @since 1.0.0 */ export class StringType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'StringType' = 'StringType' constructor() { super( @@ -333,6 +357,9 @@ export const string: StringC = new StringType() * @since 1.0.0 */ export class NumberType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'NumberType' = 'NumberType' constructor() { super( @@ -358,6 +385,9 @@ export const number: NumberC = new NumberType() * @since 2.1.0 */ export class BigIntType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'BigIntType' = 'BigIntType' constructor() { super( @@ -384,6 +414,9 @@ export const bigint: BigIntC = new BigIntType() * @since 1.0.0 */ export class BooleanType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'BooleanType' = 'BooleanType' constructor() { super( @@ -409,6 +442,9 @@ export const boolean: BooleanC = new BooleanType() * @since 1.0.0 */ export class AnyArrayType extends Type> { + /** + * @since 1.0.0 + */ readonly _tag: 'AnyArrayType' = 'AnyArrayType' constructor() { super('UnknownArray', Array.isArray, (u, c) => (this.is(u) ? success(u) : failure(u, c)), identity) @@ -429,6 +465,9 @@ export const UnknownArray: UnknownArrayC = new AnyArrayType() * @since 1.0.0 */ export class AnyDictionaryType extends Type<{ [key: string]: unknown }> { + /** + * @since 1.0.0 + */ readonly _tag: 'AnyDictionaryType' = 'AnyDictionaryType' constructor() { super( @@ -458,6 +497,9 @@ export interface UnknownRecordC extends AnyDictionaryType {} * @deprecated */ export class FunctionType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'FunctionType' = 'FunctionType' constructor() { super( @@ -488,6 +530,9 @@ export const Function: FunctionC = new FunctionType() * @since 1.0.0 */ export class RefinementType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'RefinementType' = 'RefinementType' constructor( name: string, @@ -556,6 +601,9 @@ type LiteralValue = string | number | boolean * @since 1.0.0 */ export class LiteralType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'LiteralType' = 'LiteralType' constructor( name: string, @@ -585,6 +633,9 @@ export const literal = (value: V, name: string = JSON.st * @since 1.0.0 */ export class KeyofType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'KeyofType' = 'KeyofType' constructor( name: string, @@ -610,7 +661,7 @@ export interface KeyofC extends KeyofType< export const keyof = ( keys: D, name: string = Object.keys(keys) - .map(k => JSON.stringify(k)) + .map((k) => JSON.stringify(k)) .join(' | ') ): KeyofC => { const is = (u: unknown): u is keyof D => string.is(u) && hasOwnProperty.call(keys, u) @@ -621,6 +672,9 @@ export const keyof = ( * @since 1.0.0 */ export class RecursiveType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'RecursiveType' = 'RecursiveType' constructor( name: string, @@ -631,11 +685,14 @@ export class RecursiveType extends T ) { super(name, is, validate, encode) } + /** + * @since 1.0.0 + */ readonly type!: C } Object.defineProperty(RecursiveType.prototype, 'type', { - get: function() { + get: function () { return this.runDefinition() }, enumerable: true, @@ -661,7 +718,7 @@ export const recursion = = Type< name, (u): u is A => runDefinition().is(u), (u, c) => runDefinition().validate(u, c), - a => runDefinition().encode(a), + (a) => runDefinition().encode(a), runDefinition ) return Self @@ -671,6 +728,9 @@ export const recursion = = Type< * @since 1.0.0 */ export class ArrayType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'ArrayType' = 'ArrayType' constructor( name: string, @@ -696,7 +756,7 @@ export const array = (codec: C, name: string = `Array<${codec.n name, (u): u is Array> => UnknownArray.is(u) && u.every(codec.is), (u, c) => - chain(UnknownArray.validate(u, c), us => { + chain(UnknownArray.validate(u, c), (us) => { const len = us.length let as: Array> = us const errors: Errors = [] @@ -717,7 +777,7 @@ export const array = (codec: C, name: string = `Array<${codec.n } return errors.length > 0 ? failures(errors) : success(as) }), - codec.encode === identity ? identity : a => a.map(codec.encode), + codec.encode === identity ? identity : (a) => a.map(codec.encode), codec ) @@ -725,6 +785,9 @@ export const array = (codec: C, name: string = `Array<${codec.n * @since 1.0.0 */ export class InterfaceType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'InterfaceType' = 'InterfaceType' constructor( name: string, @@ -746,7 +809,7 @@ export interface AnyProps { const getNameFromProps = (props: Props): string => Object.keys(props) - .map(k => `${k}: ${props[k].name}`) + .map((k) => `${k}: ${props[k].name}`) .join(', ') const useIdentity = (codecs: Array): boolean => { @@ -790,7 +853,7 @@ const getInterfaceTypeName = (props: Props): string => { */ export const type =

(props: P, name: string = getInterfaceTypeName(props)): TypeC

=> { const keys = Object.keys(props) - const types = keys.map(key => props[key]) + const types = keys.map((key) => props[key]) const len = keys.length return new InterfaceType( name, @@ -808,7 +871,7 @@ export const type =

(props: P, name: string = getInterfaceTypeN return false }, (u, c) => - chain(UnknownRecord.validate(u, c), o => { + chain(UnknownRecord.validate(u, c), (o) => { let a = o const errors: Errors = [] for (let i = 0; i < len; i++) { @@ -833,7 +896,7 @@ export const type =

(props: P, name: string = getInterfaceTypeN }), useIdentity(types) ? identity - : a => { + : (a) => { const s: { [x: string]: any } = { ...a } for (let i = 0; i < len; i++) { const k = keys[i] @@ -852,6 +915,9 @@ export const type =

(props: P, name: string = getInterfaceTypeN * @since 1.0.0 */ export class PartialType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'PartialType' = 'PartialType' constructor( name: string, @@ -892,7 +958,7 @@ export const partial =

( name: string = getPartialTypeName(getInterfaceTypeName(props)) ): PartialC

=> { const keys = Object.keys(props) - const types = keys.map(key => props[key]) + const types = keys.map((key) => props[key]) const len = keys.length return new PartialType( name, @@ -910,7 +976,7 @@ export const partial =

( return false }, (u, c) => - chain(UnknownRecord.validate(u, c), o => { + chain(UnknownRecord.validate(u, c), (o) => { let a = o const errors: Errors = [] for (let i = 0; i < len; i++) { @@ -937,7 +1003,7 @@ export const partial =

( }), useIdentity(types) ? identity - : a => { + : (a) => { const s: { [key: string]: any } = { ...a } for (let i = 0; i < len; i++) { const k = keys[i] @@ -956,6 +1022,9 @@ export const partial =

( * @since 1.0.0 */ export class DictionaryType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'DictionaryType' = 'DictionaryType' constructor( name: string, @@ -994,9 +1063,9 @@ function enumerableRecord( const len = keys.length return new DictionaryType( name, - (u): u is { [K in TypeOf]: TypeOf } => UnknownRecord.is(u) && keys.every(k => codomain.is(u[k])), + (u): u is { [K in TypeOf]: TypeOf } => UnknownRecord.is(u) && keys.every((k) => codomain.is(u[k])), (u, c) => - chain(UnknownRecord.validate(u, c), o => { + chain(UnknownRecord.validate(u, c), (o) => { const a: { [key: string]: any } = {} const errors: Errors = [] let changed: boolean = false @@ -1041,7 +1110,7 @@ export function getDomainKeys(domain: D): Record getDomainKeys(type)) + const keys = domain.types.map((type) => getDomainKeys(type)) return keys.some(undefinedType.is) ? undefined : Object.assign({}, ...keys) } return undefined @@ -1056,7 +1125,7 @@ function nonEnumerableRecord( name, (u): u is { [K in TypeOf]: TypeOf } => { if (UnknownRecord.is(u)) { - return Object.keys(u).every(k => domain.is(k) && codomain.is(u[k])) + return Object.keys(u).every((k) => domain.is(k) && codomain.is(u[k])) } return isAnyC(codomain) && Array.isArray(u) }, @@ -1096,7 +1165,7 @@ function nonEnumerableRecord( }, domain.encode === identity && codomain.encode === identity ? identity - : a => { + : (a) => { const s: { [key: string]: any } = {} const keys = Object.keys(a) const len = keys.length @@ -1125,6 +1194,9 @@ export function record(domain: D, codomain: C, * @since 1.0.0 */ export class UnionType, A = any, O = A, I = unknown> extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'UnionType' = 'UnionType' constructor( name: string, @@ -1144,7 +1216,7 @@ export interface UnionC]> extends UnionType, OutputOf, unknown> {} const getUnionName = ]>(codecs: CS): string => { - return '(' + codecs.map(type => type.name).join(' | ') + ')' + return '(' + codecs.map((type) => type.name).join(' | ') + ')' } /** @@ -1177,7 +1249,7 @@ export const union = ]>( return false }, (u, c) => - chain(UnknownRecord.validate(u, c), r => { + chain(UnknownRecord.validate(u, c), (r) => { const i = find(r[tag]) if (i === undefined) { return failure(u, c) @@ -1187,7 +1259,7 @@ export const union = ]>( }), useIdentity(codecs) ? identity - : a => { + : (a) => { const i = find(a[tag]) if (i === undefined) { // https://github.com/gcanti/io-ts/pull/305 @@ -1202,7 +1274,7 @@ export const union = ]>( } else { return new UnionType( name, - (u): u is TypeOf => codecs.some(type => type.is(u)), + (u): u is TypeOf => codecs.some((type) => type.is(u)), (u, c) => { const errors: Errors = [] for (let i = 0; i < codecs.length; i++) { @@ -1218,7 +1290,7 @@ export const union = ]>( }, useIdentity(codecs) ? identity - : a => { + : (a) => { for (const codec of codecs) { if (codec.is(a)) { return codec.encode(a) @@ -1236,6 +1308,9 @@ export const union = ]>( * @since 1.0.0 */ export class IntersectionType, A = any, O = A, I = unknown> extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'IntersectionType' = 'IntersectionType' constructor( name: string, @@ -1320,12 +1395,12 @@ export function intersection( export function intersection(codecs: [A, B], name?: string): IntersectionC<[A, B]> export function intersection]>( codecs: CS, - name: string = `(${codecs.map(type => type.name).join(' & ')})` + name: string = `(${codecs.map((type) => type.name).join(' & ')})` ): IntersectionC { const len = codecs.length return new IntersectionType( name, - (u: unknown): u is any => codecs.every(type => type.is(u)), + (u: unknown): u is any => codecs.every((type) => type.is(u)), codecs.length === 0 ? success : (u, c) => { @@ -1344,10 +1419,10 @@ export function intersection]>( }, codecs.length === 0 ? identity - : a => + : (a) => mergeAll( a, - codecs.map(codec => codec.encode(a)) + codecs.map((codec) => codec.encode(a)) ), codecs ) @@ -1357,6 +1432,9 @@ export function intersection]>( * @since 1.0.0 */ export class TupleType, A = any, O = A, I = unknown> extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'TupleType' = 'TupleType' constructor( name: string, @@ -1419,14 +1497,14 @@ export function tuple(codecs: [A, B], name?: s export function tuple(codecs: [A], name?: string): TupleC<[A]> export function tuple]>( codecs: CS, - name: string = `[${codecs.map(type => type.name).join(', ')}]` + name: string = `[${codecs.map((type) => type.name).join(', ')}]` ): TupleC { const len = codecs.length return new TupleType( name, (u): u is any => UnknownArray.is(u) && u.length === len && codecs.every((type, i) => type.is(u[i])), (u, c) => - chain(UnknownArray.validate(u, c), us => { + chain(UnknownArray.validate(u, c), (us) => { let as: Array = us.length > len ? us.slice(0, len) : us // strip additional components const errors: Errors = [] for (let i = 0; i < len; i++) { @@ -1448,7 +1526,7 @@ export function tuple]>( } return errors.length > 0 ? failures(errors) : success(as) }), - useIdentity(codecs) ? identity : a => codecs.map((type, i) => type.encode(a[i])), + useIdentity(codecs) ? identity : (a) => codecs.map((type, i) => type.encode(a[i])), codecs ) } @@ -1457,6 +1535,9 @@ export function tuple]>( * @since 1.0.0 */ export class ReadonlyType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'ReadonlyType' = 'ReadonlyType' constructor( name: string, @@ -1488,7 +1569,7 @@ export const readonly = (codec: C, name: string = `Readonly<${c name, codec.is, (u, c) => - map(codec.validate(u, c), x => { + map(codec.validate(u, c), (x) => { if (process.env.NODE_ENV !== 'production') { return Object.freeze(x) } @@ -1503,6 +1584,9 @@ export const readonly = (codec: C, name: string = `Readonly<${c * @since 1.0.0 */ export class ReadonlyArrayType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'ReadonlyArrayType' = 'ReadonlyArrayType' constructor( name: string, @@ -1533,7 +1617,7 @@ export const readonlyArray = ( name, arrayType.is, (u, c) => - map(arrayType.validate(u, c), x => { + map(arrayType.validate(u, c), (x) => { if (process.env.NODE_ENV !== 'production') { return Object.freeze(x) } @@ -1612,6 +1696,9 @@ export const taggedUnion = extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'ExactType' = 'ExactType' constructor( name: string, @@ -1700,8 +1787,8 @@ export const exact = (codec: C, name: string = getExactTypeN return new ExactType( name, codec.is, - (u, c) => chain(UnknownRecord.validate(u, c), () => map(codec.validate(u, c), a => stripKeys(a, props))), - a => codec.encode(stripKeys(a, props)), + (u, c) => chain(UnknownRecord.validate(u, c), () => map(codec.validate(u, c), (a) => stripKeys(a, props))), + (a) => codec.encode(stripKeys(a, props)), codec ) } @@ -1777,6 +1864,9 @@ export const getDefaultContext /* istanbul ignore next */ = (decoder: Decoder { + /** + * @since 1.0.0 + */ readonly _tag: 'NeverType' = 'NeverType' constructor() { super( @@ -1810,6 +1900,9 @@ export const never: NeverC = new NeverType() * @deprecated */ export class AnyType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'AnyType' = 'AnyType' constructor() { super('any', (_): _ is any => true, success, identity) @@ -1843,6 +1936,9 @@ export const Dictionary: UnknownRecordC = UnknownRecord * @deprecated */ export class ObjectType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'ObjectType' = 'ObjectType' constructor() { super( @@ -1890,7 +1986,7 @@ RefinementC { return new RefinementType( name, (u): u is TypeOf => codec.is(u) && predicate(u), - (i, c) => chain(codec.validate(i, c), a => (predicate(a) ? success(a) : failure(a, c))), + (i, c) => chain(codec.validate(i, c), (a) => (predicate(a) ? success(a) : failure(a, c))), codec.encode, codec, predicate @@ -1924,6 +2020,9 @@ export type Compact = { [K in keyof A]: A[K] } * @deprecated */ export class StrictType extends Type { + /** + * @since 1.0.0 + */ readonly _tag: 'StrictType' = 'StrictType' constructor( name: string, @@ -2266,7 +2365,7 @@ export function getIndex(codecs: NonEmptyArray): [string, NonEmptyArray all.indexOf(v) !== -1)) { + if (values.some((v) => all.indexOf(v) !== -1)) { continue keys } else { all.push(...values) diff --git a/test/PathReporter.ts b/test/PathReporter.ts index 142178696..844818718 100644 --- a/test/PathReporter.ts +++ b/test/PathReporter.ts @@ -6,7 +6,7 @@ import { NumberFromString } from './helpers' describe('PathReporter', () => { it('should use the function name as error message', () => { // tslint:disable-next-line: no-empty - assert.deepStrictEqual(PathReporter.report(t.number.decode(function() {})), [ + assert.deepStrictEqual(PathReporter.report(t.number.decode(function () {})), [ 'Invalid value supplied to : number' ]) // tslint:disable-next-line: no-empty diff --git a/test/TypeClass.ts b/test/TypeClass.ts index 68ec2b1b9..0a37d0cd1 100644 --- a/test/TypeClass.ts +++ b/test/TypeClass.ts @@ -11,7 +11,7 @@ const BAA = new t.Type( const n = parseFloat(s) return isNaN(n) ? t.failure(s, c) : t.success(n) }, - n => String(n) + (n) => String(n) ) const BAI = t.string.pipe(BAA, 'T') diff --git a/test/exact.ts b/test/exact.ts index b0b6bed03..9d75ae81d 100644 --- a/test/exact.ts +++ b/test/exact.ts @@ -53,7 +53,7 @@ describe('exact', () => { it('should succeed validating a valid value (refinement)', () => { // tslint:disable-next-line: deprecation - const T = t.exact(t.refinement(t.type({ foo: t.string }), p => p.foo.length > 2)) + const T = t.exact(t.refinement(t.type({ foo: t.string }), (p) => p.foo.length > 2)) assertSuccess(T.decode({ foo: 'foo' })) }) @@ -108,14 +108,14 @@ describe('exact', () => { it('should fail validating an invalid value (refinement)', () => { // tslint:disable-next-line: deprecation - const T = t.exact(t.refinement(t.type({ foo: t.string }), p => p.foo.length > 2)) + const T = t.exact(t.refinement(t.type({ foo: t.string }), (p) => p.foo.length > 2)) assertFailure(T, null, ['Invalid value null supplied to : Exact<({ foo: string } | )>']) assertFailure(T, { foo: 'a' }, ['Invalid value {"foo":"a"} supplied to : Exact<({ foo: string } | )>']) }) it('should strip additional properties (refinement)', () => { // tslint:disable-next-line: deprecation - const T = t.exact(t.refinement(t.type({ foo: t.string }), p => p.foo.length > 2)) + const T = t.exact(t.refinement(t.type({ foo: t.string }), (p) => p.foo.length > 2)) assertSuccess(T.decode({ foo: 'foo', bar: 1 }), { foo: 'foo' }) }) diff --git a/test/helpers.ts b/test/helpers.ts index 539adcd29..2b66804ac 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -12,7 +12,7 @@ export function assertStrictEqual(result: t.Validation, expected: any): vo () => { throw new Error(`${result} is not a right`) }, - a => { + (a) => { assert.deepStrictEqual(a, expected) } ) @@ -27,7 +27,7 @@ export function assertSuccess(result: t.Validation, expected?: T): void { () => { throw new Error(`${result} is not a right`) }, - a => { + (a) => { if (expected !== undefined) { assert.deepStrictEqual(a, expected) } @@ -44,7 +44,7 @@ export function assertStrictSuccess(result: t.Validation, expected: T): vo () => { throw new Error(`${result} is not a right`) }, - a => { + (a) => { /* istanbul ignore next */ if (expected !== undefined) { assert.strictEqual(a, expected) @@ -74,7 +74,7 @@ export const NumberFromString = new t.Type( 'NumberFromString', t.number.is, (u, c) => - either.chain(t.string.validate(u, c), s => { + either.chain(t.string.validate(u, c), (s) => { const n = +s return isNaN(n) ? t.failure(u, c, 'cannot parse to a number') : t.success(n) }), @@ -85,14 +85,14 @@ export const HyphenatedString = new t.Type( 'HyphenatedString', (v): v is string => t.string.is(v) && v.length === 3 && v[1] === '-', (u, c) => - either.chain(t.string.validate(u, c), s => { + either.chain(t.string.validate(u, c), (s) => { if (s.length === 2) { return right(s[0] + '-' + s[1]) } else { return t.failure(s, c) } }), - a => a[0] + a[2] + (a) => a[0] + a[2] ) // tslint:disable-next-line: deprecation @@ -105,7 +105,7 @@ export function withDefault( return new t.Type( `withDefault(${type.name}, ${JSON.stringify(defaultValue)})`, type.is, - v => type.decode(v != null ? v : defaultValue), + (v) => type.decode(v != null ? v : defaultValue), type.encode ) } diff --git a/test/readonly.ts b/test/readonly.ts index 88b45f8ba..f077ba738 100644 --- a/test/readonly.ts +++ b/test/readonly.ts @@ -45,14 +45,14 @@ describe('readonly', () => { it('should freeze the value', () => { const T = t.readonly(t.type({ a: t.number })) - either.map(T.decode({ a: 1 }), x => assert.ok(Object.isFrozen(x))) + either.map(T.decode({ a: 1 }), (x) => assert.ok(Object.isFrozen(x))) }) it('should not freeze in production', () => { const env = process.env.NODE_ENV process.env.NODE_ENV = 'production' const T = t.readonly(t.type({ a: t.number })) - either.map(T.decode({ a: 1 }), x => assert.ok(!Object.isFrozen(x))) + either.map(T.decode({ a: 1 }), (x) => assert.ok(!Object.isFrozen(x))) process.env.NODE_ENV = env }) }) diff --git a/test/readonlyArray.ts b/test/readonlyArray.ts index 44ecf6807..991ce2d83 100644 --- a/test/readonlyArray.ts +++ b/test/readonlyArray.ts @@ -47,14 +47,14 @@ describe('readonlyArray', () => { it('should freeze the value', () => { const T = t.readonlyArray(t.number) - either.map(T.decode([1]), x => assert.ok(Object.isFrozen(x))) + either.map(T.decode([1]), (x) => assert.ok(Object.isFrozen(x))) }) it('should not freeze in production', () => { const env = process.env.NODE_ENV process.env.NODE_ENV = 'production' const T = t.readonlyArray(t.number) - either.map(T.decode([1]), x => assert.ok(!Object.isFrozen(x))) + either.map(T.decode([1]), (x) => assert.ok(!Object.isFrozen(x))) process.env.NODE_ENV = env }) }) diff --git a/test/record.ts b/test/record.ts index 67d00017c..b93df4f76 100644 --- a/test/record.ts +++ b/test/record.ts @@ -159,7 +159,7 @@ describe('record', () => { assertStrictEqual(T1.decode(value1), value1) const T2 = t.record( // tslint:disable-next-line: deprecation - t.refinement(t.string, s => s.length >= 2), + t.refinement(t.string, (s) => s.length >= 2), t.number ) const value2 = { aa: 1 } diff --git a/test/recursion.ts b/test/recursion.ts index db17c3149..537c474c4 100644 --- a/test/recursion.ts +++ b/test/recursion.ts @@ -6,7 +6,7 @@ type T = { a: number b: T | undefined | null } -const T: t.Type = t.recursion('T', self => +const T: t.Type = t.recursion('T', (self) => t.type({ a: t.number, b: t.union([self, t.undefined, t.null]) @@ -20,7 +20,7 @@ describe('recursion', () => { a: number b: A | null } - const T: t.Type = t.recursion('T', self => + const T: t.Type = t.recursion('T', (self) => t.type({ a: t.number, b: t.union([self, t.null]) @@ -39,7 +39,7 @@ describe('recursion', () => { a: string b: O | null } - const T: t.Type = t.recursion('T', self => + const T: t.Type = t.recursion('T', (self) => t.type({ a: NumberFromString, b: t.union([self, t.null]) @@ -61,7 +61,7 @@ describe('recursion', () => { a: number b: T | null | undefined } - const T: t.Type = t.recursion('T', self => + const T: t.Type = t.recursion('T', (self) => t.type({ a: t.number, b: t.union([self, t.undefined, t.null]) @@ -92,7 +92,7 @@ describe('recursion', () => { a: string b: O | null } - const T: t.Type = t.recursion('T', self => + const T: t.Type = t.recursion('T', (self) => t.type({ a: NumberFromString, b: t.union([self, t.null]) @@ -108,7 +108,7 @@ describe('recursion', () => { a: number b: T | null } - const T = t.recursion('T', self => + const T = t.recursion('T', (self) => t.type({ a: t.number, b: t.union([self, t.null]) diff --git a/test/refinement.ts b/test/refinement.ts index 82533fec0..596a342d5 100644 --- a/test/refinement.ts +++ b/test/refinement.ts @@ -6,13 +6,13 @@ describe('refinement', () => { describe('name', () => { it('should assign a default name', () => { // tslint:disable-next-line: deprecation - const T = t.refinement(t.number, n => n >= 0) + const T = t.refinement(t.number, (n) => n >= 0) assert.strictEqual(T.name, '(number | )') }) it('should accept a name', () => { // tslint:disable-next-line: deprecation - const T = t.refinement(t.number, n => n >= 0, 'T') + const T = t.refinement(t.number, (n) => n >= 0, 'T') assert.strictEqual(T.name, 'T') }) }) @@ -28,7 +28,7 @@ describe('refinement', () => { it('should check a prismatic value', () => { // tslint:disable-next-line: deprecation - const T = t.refinement(NumberFromString, n => n % 1 === 0) + const T = t.refinement(NumberFromString, (n) => n % 1 === 0) assert.strictEqual(T.is(1.2), false) assert.strictEqual(T.is('a'), false) assert.strictEqual(T.is(1), true) @@ -38,7 +38,7 @@ describe('refinement', () => { describe('decode', () => { it('should succeed validating a valid value', () => { // tslint:disable-next-line: deprecation - const T = t.refinement(t.number, n => n >= 0) + const T = t.refinement(t.number, (n) => n >= 0) assertSuccess(T.decode(0)) assertSuccess(T.decode(1)) }) diff --git a/test/taggedUnion.ts b/test/taggedUnion.ts index ae5646de9..95e6388d8 100644 --- a/test/taggedUnion.ts +++ b/test/taggedUnion.ts @@ -73,7 +73,7 @@ describe('taggedUnion', () => { type: 'B' forest: Array } - const B = t.recursion('B', Self => + const B = t.recursion('B', (Self) => t.type({ type: t.literal('B'), forest: t.array(Self) diff --git a/test/type.ts b/test/type.ts index fe06b5b8a..813dbb8a6 100644 --- a/test/type.ts +++ b/test/type.ts @@ -130,7 +130,7 @@ describe('type', () => { () => { assert.ok(false) }, - a => { + (a) => { assert.deepStrictEqual(a, { a: 's', b: 1 }) } ) diff --git a/test/union.ts b/test/union.ts index 7f7e9e448..0ca2a3c3e 100644 --- a/test/union.ts +++ b/test/union.ts @@ -50,7 +50,7 @@ describe('union', () => { it('should handle refinements', () => { const A = t.type({ type: t.literal('A'), a: t.number }) // tslint:disable-next-line: deprecation - const B = t.refinement(A, x => x.a > 0) + const B = t.refinement(A, (x) => x.a > 0) const T = t.union([B, A]) assertSuccess(T.decode({ type: 'A', a: -1 })) }) @@ -113,8 +113,8 @@ describe('union', () => { super( 'DateT', (u): u is Date => u instanceof Date, - (u, c) => either.map(t.number.validate(u, c), n => new Date(n)), - a => a.valueOf() + (u, c) => either.map(t.number.validate(u, c), (n) => new Date(n)), + (a) => a.valueOf() ) } } From 4a0413cda4948c510ee135c35f0181b6ec85be02 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 6 Apr 2020 12:00:03 +0200 Subject: [PATCH 002/222] switch to node 12, closes #437 --- .travis.yml | 2 +- package-lock.json | 5185 +++++++++++++++++++++++++++------------------ package.json | 28 +- 3 files changed, 3103 insertions(+), 2112 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2442b69e..afb9d6d99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: node_js node_js: - - '10' + - '12' diff --git a/package-lock.json b/package-lock.json index 177cddce9..b76a574d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,12 +5,12 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", - "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", "dev": true, "requires": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.8.3" } }, "@babel/core": { @@ -37,26 +37,6 @@ "source-map": "^0.5.0" }, "dependencies": { - "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.8.3" - } - }, - "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.9.0", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -66,15 +46,6 @@ "ms": "^2.1.1" } }, - "json5": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.2.tgz", - "integrity": "sha512-MoUOQ4WdiN3yxhm7NEVJSJrieAo5hNSLQ5sj05OTRHPL9HOBy8u4Bu88jsC1jvqAdN+E1bJmsUcZH+1HQxliqQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -226,13 +197,13 @@ } }, "@babel/highlight": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", - "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", "dev": true, "requires": { + "@babel/helper-validator-identifier": "^7.9.0", "chalk": "^2.0.0", - "esutils": "^2.0.2", "js-tokens": "^4.0.0" } }, @@ -242,6 +213,15 @@ "integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==", "dev": true }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, "@babel/plugin-syntax-object-rest-spread": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", @@ -260,28 +240,6 @@ "@babel/code-frame": "^7.8.3", "@babel/parser": "^7.8.6", "@babel/types": "^7.8.6" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.8.3" - } - }, - "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.9.0", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - } } }, "@babel/traverse": { @@ -301,26 +259,6 @@ "lodash": "^4.17.13" }, "dependencies": { - "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.8.3" - } - }, - "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.9.0", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -349,6 +287,12 @@ "to-fast-properties": "^2.0.0" } }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, "@cnakazawa/watch": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", @@ -369,162 +313,479 @@ "is-negated-glob": "^1.0.0" } }, + "@istanbuljs/load-nyc-config": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", + "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + } + }, + "@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "dev": true + }, "@jest/console": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", - "integrity": "sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-25.2.6.tgz", + "integrity": "sha512-bGp+0PicZVCEhb+ifnW9wpKWONNdkhtJsRE7ap729hiAfTvCN6VhGx0s/l/V/skA2pnyqq+N/7xl9ZWfykDpsg==", "dev": true, "requires": { - "@jest/source-map": "^24.9.0", - "chalk": "^2.0.1", - "slash": "^2.0.0" + "@jest/source-map": "^25.2.6", + "chalk": "^3.0.0", + "jest-util": "^25.2.6", + "slash": "^3.0.0" }, "dependencies": { - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/core": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-25.2.7.tgz", + "integrity": "sha512-Nd6ELJyR+j0zlwhzkfzY70m04hAur0VnMwJXVe4VmmD/SaQ6DEyal++ERQ1sgyKIKKEqRuui6k/R0wHLez4P+g==", + "dev": true, + "requires": { + "@jest/console": "^25.2.6", + "@jest/reporters": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.3", + "jest-changed-files": "^25.2.6", + "jest-config": "^25.2.7", + "jest-haste-map": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-resolve-dependencies": "^25.2.7", + "jest-runner": "^25.2.7", + "jest-runtime": "^25.2.7", + "jest-snapshot": "^25.2.7", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "jest-watcher": "^25.2.7", + "micromatch": "^4.0.2", + "p-each-series": "^2.1.0", + "realpath-native": "^2.0.0", + "rimraf": "^3.0.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, "@jest/environment": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.9.0.tgz", - "integrity": "sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.2.6.tgz", + "integrity": "sha512-17WIw+wCb9drRNFw1hi8CHah38dXVdOk7ga9exThhGtXlZ9mK8xH4DjSB9uGDGXIWYSHmrxoyS6KJ7ywGr7bzg==", "dev": true, "requires": { - "@jest/fake-timers": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0" + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6" } }, "@jest/fake-timers": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.9.0.tgz", - "integrity": "sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", + "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-mock": "^24.9.0" + "@jest/types": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "lolex": "^5.0.0" } }, "@jest/reporters": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.9.0.tgz", - "integrity": "sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", + "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", "dev": true, "requires": { - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.2", - "istanbul-lib-coverage": "^2.0.2", - "istanbul-lib-instrument": "^3.0.1", - "istanbul-lib-report": "^2.0.4", - "istanbul-lib-source-maps": "^3.0.1", - "istanbul-reports": "^2.2.6", - "jest-haste-map": "^24.9.0", - "jest-resolve": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.6.0", - "node-notifier": "^5.4.2", - "slash": "^2.0.0", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.0", + "jest-haste-map": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "node-notifier": "^6.0.0", + "slash": "^3.0.0", "source-map": "^0.6.0", - "string-length": "^2.0.0" + "string-length": "^3.1.0", + "terminal-link": "^2.0.0", + "v8-to-istanbul": "^4.0.1" }, "dependencies": { - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, "@jest/source-map": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.9.0.tgz", - "integrity": "sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", + "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", "dev": true, "requires": { "callsites": "^3.0.0", - "graceful-fs": "^4.1.15", + "graceful-fs": "^4.2.3", "source-map": "^0.6.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + } } }, "@jest/test-result": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz", - "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", + "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", "dev": true, "requires": { - "@jest/console": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/istanbul-lib-coverage": "^2.0.0" + "@jest/console": "^25.2.6", + "@jest/types": "^25.2.6", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" } }, "@jest/test-sequencer": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz", - "integrity": "sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", + "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", "dev": true, "requires": { - "@jest/test-result": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-runner": "^24.9.0", - "jest-runtime": "^24.9.0" + "@jest/test-result": "^25.2.6", + "jest-haste-map": "^25.2.6", + "jest-runner": "^25.2.7", + "jest-runtime": "^25.2.7" } }, "@jest/transform": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.9.0.tgz", - "integrity": "sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "@jest/types": "^24.9.0", - "babel-plugin-istanbul": "^5.1.0", - "chalk": "^2.0.1", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.1.15", - "jest-haste-map": "^24.9.0", - "jest-regex-util": "^24.9.0", - "jest-util": "^24.9.0", - "micromatch": "^3.1.10", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-util": "^25.2.6", + "micromatch": "^4.0.2", "pirates": "^4.0.1", - "realpath-native": "^1.1.0", - "slash": "^2.0.0", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", "source-map": "^0.6.1", - "write-file-atomic": "2.4.1" + "write-file-atomic": "^3.0.0" }, "dependencies": { - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true - } - } - }, - "@jest/types": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", - "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" - } - }, + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "@nodelib/fs.scandir": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", @@ -551,6 +812,15 @@ "fastq": "^1.6.0" } }, + "@sinonjs/commons": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", + "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, "@textlint/ast-node-types": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-4.2.2.tgz", @@ -702,10 +972,14 @@ } }, "@types/jest": { - "version": "23.3.14", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-23.3.14.tgz", - "integrity": "sha512-Q5hTcfdudEL2yOmluA1zaSyPbzWPmJ3XfSWeP3RyoYvS9hnje1ZyagrZOuQ6+1nQC1Gw+7gap3pLNL3xL6UBug==", - "dev": true + "version": "25.2.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.1.tgz", + "integrity": "sha512-msra1bCaAeEdkSyA0CZ6gW1ukMIvZ5YoJkdXw/qhQdsuuDlFTcEUrUw8CLCPt2rVRUfXlClVvK2gvPs9IokZaA==", + "dev": true, + "requires": { + "jest-diff": "^25.2.1", + "pretty-format": "^25.2.1" + } }, "@types/minimatch": { "version": "3.0.3", @@ -714,9 +988,15 @@ "dev": true }, "@types/node": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.4.tgz", - "integrity": "sha1-mqvBNZed7TgzJXSfUIiUxmKUjIs=", + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.0.tgz", + "integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==", + "dev": true + }, + "@types/prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==", "dev": true }, "@types/stack-utils": { @@ -726,9 +1006,9 @@ "dev": true }, "@types/yargs": { - "version": "13.0.8", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.8.tgz", - "integrity": "sha512-XAvHLwG7UQ+8M4caKIH0ZozIOYay5fQkAgyIXegXT9jPtdIGdhga+sUEdAr1CiG46aB+c64xQEYyEzlwWVTNzA==", + "version": "15.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.4.tgz", + "integrity": "sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -747,9 +1027,9 @@ "dev": true }, "acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true }, "acorn-globals": { @@ -797,12 +1077,21 @@ "emoji-regex": "~6.1.0" } }, - "ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", "dev": true }, + "ansi-escapes": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "requires": { + "type-fest": "^0.11.0" + } + }, "ansi-red": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", @@ -813,9 +1102,9 @@ } }, "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, "ansi-styles": { @@ -834,13 +1123,13 @@ "dev": true }, "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", "dev": true, "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" } }, "arg": { @@ -900,12 +1189,6 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -933,12 +1216,6 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", - "dev": true - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -973,57 +1250,103 @@ "dev": true }, "babel-jest": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz", - "integrity": "sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.2.6.tgz", + "integrity": "sha512-MDJOAlwtIeIQiGshyX0d2PxTbV73xZMpNji40ivVTPQOm59OdRR9nYCkffqI7ugtsK4JR98HgNKbDbuVf4k5QQ==", "dev": true, "requires": { - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", "@types/babel__core": "^7.1.0", - "babel-plugin-istanbul": "^5.1.0", - "babel-preset-jest": "^24.9.0", - "chalk": "^2.4.2", - "slash": "^2.0.0" + "babel-plugin-istanbul": "^6.0.0", + "babel-preset-jest": "^25.2.6", + "chalk": "^3.0.0", + "slash": "^3.0.0" }, "dependencies": { - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, "babel-plugin-istanbul": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz", - "integrity": "sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz", + "integrity": "sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "find-up": "^3.0.0", - "istanbul-lib-instrument": "^3.3.0", - "test-exclude": "^5.2.3" + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^4.0.0", + "test-exclude": "^6.0.0" } }, "babel-plugin-jest-hoist": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz", - "integrity": "sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.2.6.tgz", + "integrity": "sha512-qE2xjMathybYxjiGFJg0mLFrz0qNp83aNZycWDY/SuHiZNq+vQfRQtuINqyXyue1ELd8Rd+1OhFSLjms8msMbw==", "dev": true, "requires": { "@types/babel__traverse": "^7.0.6" } }, "babel-preset-jest": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz", - "integrity": "sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.2.6.tgz", + "integrity": "sha512-Xh2eEAwaLY9+SyMt/xmGZDnXTW/7pSaBPG0EMo7EuhvosFKVWYB6CqwYD31DaEQuoTL090oDZ0FEqygffGRaSQ==", "dev": true, "requires": { + "@babel/plugin-syntax-bigint": "^7.0.0", "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^24.9.0" + "babel-plugin-jest-hoist": "^25.2.6" } }, "bail": { @@ -1124,15 +1447,11 @@ "platform": "^1.3.3" } }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } + "binary-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "dev": true }, "boundary": { "version": "1.0.1", @@ -1151,49 +1470,22 @@ } }, "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" + "fill-range": "^7.0.1" }, "dependencies": { "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "requires": { - "kind-of": "^3.0.2" + "to-regex-range": "^5.0.1" } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true } } }, @@ -1337,6 +1629,22 @@ "integrity": "sha512-VOq6PRzQBam/8Jm6XBGk2fNEnHXAdGd6go0rtd4weAGECBamHDwwCQSOT12TACIYUZegUXnV6xBXqUssijtxIg==", "dev": true }, + "chokidar": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.2.0" + } + }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -1373,14 +1681,14 @@ } }, "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", "dev": true, "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" } }, "co": { @@ -1407,6 +1715,12 @@ "integrity": "sha512-703bOOmytCYAX9cXYqoikYIx6twmFCXsnzRQheBcTG3nzKYBR4P/+wkYeH+Mvj7qUz8zZDtdyzbxfnEi/kYzRQ==", "dev": true }, + "collect-v8-coverage": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", + "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "dev": true + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -1442,9 +1756,9 @@ } }, "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "component-emitter": { @@ -1512,21 +1826,40 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } } }, "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", "dev": true }, "cssstyle": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", - "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.2.0.tgz", + "integrity": "sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA==", "dev": true, "requires": { - "cssom": "0.3.x" + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + } } }, "dashdash": { @@ -1547,19 +1880,6 @@ "abab": "^2.0.0", "whatwg-mimetype": "^2.2.0", "whatwg-url": "^7.0.0" - }, - "dependencies": { - "whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - } } }, "debug": { @@ -1589,6 +1909,12 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1658,9 +1984,9 @@ "dev": true }, "detect-newline": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", - "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", "dev": true }, "diacritics-map": { @@ -1676,9 +2002,9 @@ "dev": true }, "diff-sequences": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz", - "integrity": "sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-25.2.6.tgz", + "integrity": "sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==", "dev": true }, "dir-glob": { @@ -1829,7 +2155,7 @@ "parsimmon": "^1.12.0", "strip-json-comments": "^2.0.1", "tslint": "^5.12.0", - "typescript": "^3.8.0-dev.20191105" + "typescript": "^3.9.0-dev.20200406" }, "dependencies": { "fs-extra": { @@ -1843,10 +2169,31 @@ "universalify": "^0.1.0" } }, + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + }, "typescript": { - "version": "3.8.0-dev.20191105", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.0-dev.20191105.tgz", - "integrity": "sha512-bKujrrC0aQRihwWPuavqvlCArHqwXqGmUTwzpyojkTiHBMbfuuVxqM5fYDYLALe6B1eRGm5bFeNtFF/d/8CpCQ==", + "version": "3.9.0-dev.20200406", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.0-dev.20200406.tgz", + "integrity": "sha512-oDw6MZnp1bMrifgsisvC0Ea3Op8Uyajq88/1EBCi5J8lxuPLDgVTKm3uqArGpcwiX6QphMIWA124ZH2OQx+dzw==", "dev": true } } @@ -1882,15 +2229,6 @@ "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, "es-abstract": { "version": "1.17.5", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", @@ -2021,33 +2359,60 @@ } }, "expect": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-24.9.0.tgz", - "integrity": "sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/expect/-/expect-25.2.7.tgz", + "integrity": "sha512-yA+U2Ph0MkMsJ9N8q5hs9WgWI6oJYfecdXta6LkP/alY/jZZL1MHlJ2wbLh60Ucqf3G+51ytbqV3mlGfmxkpNw==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "ansi-styles": "^3.2.0", - "jest-get-type": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-regex-util": "^24.9.0" - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } + "@jest/types": "^25.2.6", + "ansi-styles": "^4.0.0", + "jest-get-type": "^25.2.6", + "jest-matcher-utils": "^25.2.7", + "jest-message-util": "^25.2.6", + "jest-regex-util": "^25.2.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } }, "extglob": { "version": "2.0.4", @@ -2183,9 +2548,9 @@ } }, "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, "fast-levenshtein": { @@ -2221,13 +2586,6 @@ "bser": "2.1.1" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, "fill-range": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", @@ -2242,12 +2600,30 @@ } }, "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, + "requires": { + "is-buffer": "~2.0.3" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true + } } }, "for-in": { @@ -2280,9 +2656,9 @@ "dev": true }, "fp-ts": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.0.0.tgz", - "integrity": "sha512-oz8L+EZiztqGVLhgdL+63b4hpfdJkEKH/4vRoS/AuUwYqmn7vHAzWMu1jtoYfB0pPxo5UioWVT2XOuftyivUSQ==", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.3.tgz", + "integrity": "sha512-lQd+hahLd8cygNoXbEHDjH/cbF6XVWlEPb8h5GXXlozjCSDxWgclvkpOoTRfBA0P+r69l9VvW1nEsSGIJRQpWw==", "dev": true }, "fragment-cache": { @@ -2312,717 +2688,194 @@ "dev": true }, "fsevents": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz", - "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "globby": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz", + "integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "dev": true + }, + "gray-matter": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-2.1.1.tgz", + "integrity": "sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=", + "dev": true, + "requires": { + "ansi-red": "^0.1.1", + "coffee-script": "^1.12.4", + "extend-shallow": "^2.0.1", + "js-yaml": "^3.8.1", + "toml": "^2.3.2" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "dev": true, + "optional": true + }, + "gulp-header": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.12.tgz", + "integrity": "sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ==", + "dev": true, + "requires": { + "concat-with-sourcemaps": "*", + "lodash.template": "^4.4.0", + "through2": "^2.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "dev": true, + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "dev": true, - "optional": true, "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1", - "node-pre-gyp": "*" + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" }, "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "debug": { - "version": "3.2.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "^2.1.1" - } - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.6.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "bundled": true, - "dev": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "bundled": true, - "dev": true - }, - "minipass": { - "version": "2.9.0", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.3.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.9.0" - } - }, - "mkdirp": { - "version": "0.5.3", - "bundled": true, - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.3.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.14.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4.4.2" - } - }, - "nopt": { - "version": "4.0.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-normalize-package-bin": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "npm-packlist": { - "version": "1.4.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - } - }, - "readable-stream": { - "version": "2.3.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.7.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true, - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.7.1", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.13", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "yallist": { - "version": "3.1.1", - "bundled": true, - "dev": true - } - } - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "globby": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz", - "integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.0.3", - "glob": "^7.1.3", - "ignore": "^5.1.1", - "merge2": "^1.2.3", - "slash": "^3.0.0" - } - }, - "graceful-fs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", - "dev": true - }, - "gray-matter": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-2.1.1.tgz", - "integrity": "sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=", - "dev": true, - "requires": { - "ansi-red": "^0.1.1", - "coffee-script": "^1.12.4", - "extend-shallow": "^2.0.1", - "js-yaml": "^3.8.1", - "toml": "^2.3.2" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "growly": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", - "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true - }, - "gulp-header": { - "version": "1.8.12", - "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.12.tgz", - "integrity": "sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ==", - "dev": true, - "requires": { - "concat-with-sourcemaps": "*", - "lodash.template": "^4.4.0", - "through2": "^2.0.0" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "dev": true, - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true } } @@ -3069,15 +2922,9 @@ } }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "html-encoding-sniffer": { @@ -3120,6 +2967,12 @@ "sshpk": "^1.7.0" } }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3136,13 +2989,13 @@ "dev": true }, "import-local": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", - "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", + "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", "dev": true, "requires": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" } }, "import-path-rewrite": { @@ -3242,14 +3095,11 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } + "ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", + "dev": true }, "is-absolute": { "version": "1.0.0", @@ -3286,12 +3136,15 @@ "is-decimal": "^1.0.0" } }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -3366,9 +3219,9 @@ "dev": true }, "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "is-generator-fn": { @@ -3497,10 +3350,11 @@ "dev": true }, "is-wsl": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", - "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", - "dev": true + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.1.1.tgz", + "integrity": "sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog==", + "dev": true, + "optional": true }, "isarray": { "version": "1.0.0", @@ -3530,24 +3384,24 @@ "dev": true }, "istanbul-lib-coverage": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", - "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", "dev": true }, "istanbul-lib-instrument": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", - "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz", + "integrity": "sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg==", "dev": true, "requires": { - "@babel/generator": "^7.4.0", - "@babel/parser": "^7.4.3", - "@babel/template": "^7.4.0", - "@babel/traverse": "^7.4.3", - "@babel/types": "^7.4.0", - "istanbul-lib-coverage": "^2.0.5", - "semver": "^6.0.0" + "@babel/core": "^7.7.5", + "@babel/parser": "^7.7.5", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" }, "dependencies": { "semver": { @@ -3559,37 +3413,41 @@ } }, "istanbul-lib-report": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", - "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", "dev": true, "requires": { - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "supports-color": "^6.1.0" + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" }, "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } } } }, "istanbul-lib-source-maps": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", - "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", + "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", "dev": true, "requires": { "debug": "^4.1.1", - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "rimraf": "^2.6.3", + "istanbul-lib-coverage": "^3.0.0", "source-map": "^0.6.1" }, "dependencies": { @@ -3607,437 +3465,707 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } } } }, "istanbul-reports": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", - "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", + "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", "dev": true, "requires": { - "html-escaper": "^2.0.0" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" } }, "jest": { - "version": "24.8.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-24.8.0.tgz", - "integrity": "sha512-o0HM90RKFRNWmAWvlyV8i5jGZ97pFwkeVoGvPW1EtLTgJc2+jcuqcbbqcSZLE/3f2S5pt0y2ZBETuhpWNl1Reg==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest/-/jest-25.2.7.tgz", + "integrity": "sha512-XV1n/CE2McCikl4tfpCY950RytHYvxdo/wvtgmn/qwA8z1s16fuvgFL/KoPrrmkqJTaPMUlLVE58pwiaTX5TdA==", "dev": true, "requires": { - "import-local": "^2.0.0", - "jest-cli": "^24.8.0" + "@jest/core": "^25.2.7", + "import-local": "^3.0.2", + "jest-cli": "^25.2.7" }, "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "jest-cli": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.9.0.tgz", - "integrity": "sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.2.7.tgz", + "integrity": "sha512-OOAZwY4Jkd3r5WhVM5L3JeLNFaylvHUczMLxQDVLrrVyb1Cy+DNJ6MVsb5TLh6iBklB42m5TOP+IbOgKGGOtMw==", "dev": true, "requires": { - "@jest/core": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", + "@jest/core": "^25.2.7", + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", "exit": "^0.1.2", - "import-local": "^2.0.0", + "import-local": "^3.0.2", "is-ci": "^2.0.0", - "jest-config": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", + "jest-config": "^25.2.7", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", "prompts": "^2.0.1", - "realpath-native": "^1.1.0", - "yargs": "^13.3.0" - }, - "dependencies": { - "@jest/core": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.9.0.tgz", - "integrity": "sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A==", - "dev": true, - "requires": { - "@jest/console": "^24.7.1", - "@jest/reporters": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "graceful-fs": "^4.1.15", - "jest-changed-files": "^24.9.0", - "jest-config": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-resolve-dependencies": "^24.9.0", - "jest-runner": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "jest-watcher": "^24.9.0", - "micromatch": "^3.1.10", - "p-each-series": "^1.0.0", - "realpath-native": "^1.1.0", - "rimraf": "^2.5.4", - "slash": "^2.0.0", - "strip-ansi": "^5.0.0" - } - }, - "@jest/test-result": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz", - "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==", - "dev": true, - "requires": { - "@jest/console": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/istanbul-lib-coverage": "^2.0.0" - } - }, - "@jest/types": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", - "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", - "dev": true - }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "jest-config": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz", - "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^24.9.0", - "@jest/types": "^24.9.0", - "babel-jest": "^24.9.0", - "chalk": "^2.0.1", - "glob": "^7.1.1", - "jest-environment-jsdom": "^24.9.0", - "jest-environment-node": "^24.9.0", - "jest-get-type": "^24.9.0", - "jest-jasmine2": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "micromatch": "^3.1.10", - "pretty-format": "^24.9.0", - "realpath-native": "^1.1.0" - } - }, - "jest-util": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz", - "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==", - "dev": true, - "requires": { - "@jest/console": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/source-map": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "callsites": "^3.0.0", - "chalk": "^2.0.1", - "graceful-fs": "^4.1.15", - "is-ci": "^2.0.0", - "mkdirp": "^0.5.1", - "slash": "^2.0.0", - "source-map": "^0.6.0" - } - }, - "jest-validate": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", - "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "camelcase": "^5.3.1", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "leven": "^3.1.0", - "pretty-format": "^24.9.0" - } - }, - "prompts": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", - "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", - "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.4" - } - }, - "realpath-native": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.1.0.tgz", - "integrity": "sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA==", - "dev": true, - "requires": { - "util.promisify": "^1.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - } + "realpath-native": "^2.0.0", + "yargs": "^15.3.1" } }, - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, "jest-changed-files": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz", - "integrity": "sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.2.6.tgz", + "integrity": "sha512-F7l2m5n55jFnJj4ItB9XbAlgO+6umgvz/mdK76BfTd2NGkvGf9x96hUXP/15a1K0k14QtVOoutwpRKl360msvg==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "execa": "^1.0.0", - "throat": "^4.0.0" + "@jest/types": "^25.2.6", + "execa": "^3.2.0", + "throat": "^5.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", + "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "execa": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", + "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + } } }, "jest-config": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz", - "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.2.7.tgz", + "integrity": "sha512-rIdPPXR6XUxi+7xO4CbmXXkE6YWprvlKc4kg1SrkCL2YV5m/8MkHstq9gBZJ19Qoa3iz/GP+0sTG/PcIwkFojg==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^24.9.0", - "@jest/types": "^24.9.0", - "babel-jest": "^24.9.0", - "chalk": "^2.0.1", + "@jest/test-sequencer": "^25.2.7", + "@jest/types": "^25.2.6", + "babel-jest": "^25.2.6", + "chalk": "^3.0.0", + "deepmerge": "^4.2.2", "glob": "^7.1.1", - "jest-environment-jsdom": "^24.9.0", - "jest-environment-node": "^24.9.0", - "jest-get-type": "^24.9.0", - "jest-jasmine2": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "micromatch": "^3.1.10", - "pretty-format": "^24.9.0", - "realpath-native": "^1.1.0" + "jest-environment-jsdom": "^25.2.6", + "jest-environment-node": "^25.2.6", + "jest-get-type": "^25.2.6", + "jest-jasmine2": "^25.2.7", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "micromatch": "^4.0.2", + "pretty-format": "^25.2.6", + "realpath-native": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-diff": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz", - "integrity": "sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.2.6.tgz", + "integrity": "sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==", "dev": true, "requires": { - "chalk": "^2.0.1", - "diff-sequences": "^24.9.0", - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" + "chalk": "^3.0.0", + "diff-sequences": "^25.2.6", + "jest-get-type": "^25.2.6", + "pretty-format": "^25.2.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-docblock": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.9.0.tgz", - "integrity": "sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.2.6.tgz", + "integrity": "sha512-VAYrljEq0upq0oERfIaaNf28gC6p9gORndhHstCYF8NWGNQJnzoaU//S475IxfWMk4UjjVmS9rJKLe5Jjjbixw==", "dev": true, "requires": { - "detect-newline": "^2.1.0" + "detect-newline": "^3.0.0" } }, "jest-each": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.9.0.tgz", - "integrity": "sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.2.6.tgz", + "integrity": "sha512-OgQ01VINaRD6idWJOhCYwUc5EcgHBiFlJuw+ON2VgYr7HLtMFyCcuo+3mmBvuLUH4QudREZN7cDCZviknzsaJQ==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "jest-util": "^24.9.0", - "pretty-format": "^24.9.0" + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "jest-get-type": "^25.2.6", + "jest-util": "^25.2.6", + "pretty-format": "^25.2.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-environment-jsdom": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz", - "integrity": "sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.2.6.tgz", + "integrity": "sha512-/o7MZIhGmLGIEG5j7r5B5Az0umWLCHU+F5crwfbm0BzC4ybHTJZOQTFQWhohBg+kbTCNOuftMcqHlVkVduJCQQ==", "dev": true, "requires": { - "@jest/environment": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-util": "^24.9.0", - "jsdom": "^11.5.1" + "@jest/environment": "^25.2.6", + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "jsdom": "^15.2.1" } }, "jest-environment-node": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.9.0.tgz", - "integrity": "sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.2.6.tgz", + "integrity": "sha512-D1Ihj14fxZiMHGeTtU/LunhzSI+UeBvlr/rcXMTNyRMUMSz2PEhuqGbB78brBY6Dk3FhJDk7Ta+8reVaGjLWhA==", "dev": true, "requires": { - "@jest/environment": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-util": "^24.9.0" + "@jest/environment": "^25.2.6", + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, "jest-get-type": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz", - "integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-25.2.6.tgz", + "integrity": "sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==", "dev": true }, "jest-haste-map": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.9.0.tgz", - "integrity": "sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "anymatch": "^2.0.0", + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", - "fsevents": "^1.2.7", - "graceful-fs": "^4.1.15", - "invariant": "^2.2.4", - "jest-serializer": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.9.0", - "micromatch": "^3.1.10", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", "sane": "^4.0.3", - "walker": "^1.0.7" + "walker": "^1.0.7", + "which": "^2.0.2" + }, + "dependencies": { + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + } } }, "jest-jasmine2": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz", - "integrity": "sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.2.7.tgz", + "integrity": "sha512-HeQxEbonp8fUvik9jF0lkU9ab1u5TQdIb7YSU9Fj7SxWtqHNDGyCpF6ZZ3r/5yuertxi+R95Ba9eA91GMQ38eA==", "dev": true, "requires": { "@babel/traverse": "^7.1.0", - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", + "@jest/environment": "^25.2.6", + "@jest/source-map": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", "co": "^4.6.0", - "expect": "^24.9.0", + "expect": "^25.2.7", "is-generator-fn": "^2.0.0", - "jest-each": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "pretty-format": "^24.9.0", - "throat": "^4.0.0" + "jest-each": "^25.2.6", + "jest-matcher-utils": "^25.2.7", + "jest-message-util": "^25.2.6", + "jest-runtime": "^25.2.7", + "jest-snapshot": "^25.2.7", + "jest-util": "^25.2.6", + "pretty-format": "^25.2.6", + "throat": "^5.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-leak-detector": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz", - "integrity": "sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-25.2.6.tgz", + "integrity": "sha512-n+aJUM+j/x1kIaPVxzerMqhAUuqTU1PL5kup46rXh+l9SP8H6LqECT/qD1GrnylE1L463/0StSPkH4fUpkuEjA==", "dev": true, "requires": { - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" + "jest-get-type": "^25.2.6", + "pretty-format": "^25.2.6" } }, "jest-matcher-utils": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz", - "integrity": "sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-25.2.7.tgz", + "integrity": "sha512-jNYmKQPRyPO3ny0KY1I4f0XW4XnpJ3Nx5ovT4ik0TYDOYzuXJW40axqOyS61l/voWbVT9y9nZ1THL1DlpaBVpA==", "dev": true, "requires": { - "chalk": "^2.0.1", - "jest-diff": "^24.9.0", - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" + "chalk": "^3.0.0", + "jest-diff": "^25.2.6", + "jest-get-type": "^25.2.6", + "pretty-format": "^25.2.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-message-util": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.9.0.tgz", - "integrity": "sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-25.2.6.tgz", + "integrity": "sha512-Hgg5HbOssSqOuj+xU1mi7m3Ti2nwSQJQf/kxEkrz2r2rp2ZLO1pMeKkz2WiDUWgSR+APstqz0uMFcE5yc0qdcg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", + "@jest/types": "^25.2.6", "@types/stack-utils": "^1.0.1", - "chalk": "^2.0.1", - "micromatch": "^3.1.10", - "slash": "^2.0.0", + "chalk": "^3.0.0", + "micromatch": "^4.0.2", + "slash": "^3.0.0", "stack-utils": "^1.0.1" }, "dependencies": { - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, "jest-mock": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.9.0.tgz", - "integrity": "sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-25.2.6.tgz", + "integrity": "sha512-vc4nibavi2RGPdj/MyZy/azuDjZhpYZLvpfgq1fxkhbyTpKVdG7CgmRVKJ7zgLpY5kuMjTzDYA6QnRwhsCU+tA==", "dev": true, "requires": { - "@jest/types": "^24.9.0" + "@jest/types": "^25.2.6" } }, "jest-pnp-resolver": { @@ -4047,210 +4175,569 @@ "dev": true }, "jest-regex-util": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.9.0.tgz", - "integrity": "sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", "dev": true }, "jest-resolve": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.9.0.tgz", - "integrity": "sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-25.2.6.tgz", + "integrity": "sha512-7O61GVdcAXkLz/vNGKdF+00A80/fKEAA47AEXVNcZwj75vEjPfZbXDaWFmAQCyXj4oo9y9dC9D+CLA11t8ieGw==", "dev": true, "requires": { - "@jest/types": "^24.9.0", + "@jest/types": "^25.2.6", "browser-resolve": "^1.11.3", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "jest-pnp-resolver": "^1.2.1", - "realpath-native": "^1.1.0" + "realpath-native": "^2.0.0", + "resolve": "^1.15.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-resolve-dependencies": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz", - "integrity": "sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.2.7.tgz", + "integrity": "sha512-IrnMzCAh11Xd2gAOJL+ThEW6QO8DyqNdvNkQcaCticDrOAr9wtKT7yT6QBFFjqKFgjjvaVKDs59WdgUhgYnHnQ==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-snapshot": "^24.9.0" + "@jest/types": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-snapshot": "^25.2.7" } }, "jest-runner": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.9.0.tgz", - "integrity": "sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.2.7.tgz", + "integrity": "sha512-RFEr71nMrtNwcpoHzie5+fe1w3JQCGMyT2xzNwKe3f88+bK+frM2o1v24gEcPxQ2QqB3COMCe2+1EkElP+qqqQ==", "dev": true, "requires": { - "@jest/console": "^24.7.1", - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.4.2", + "@jest/console": "^25.2.6", + "@jest/environment": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", "exit": "^0.1.2", - "graceful-fs": "^4.1.15", - "jest-config": "^24.9.0", - "jest-docblock": "^24.3.0", - "jest-haste-map": "^24.9.0", - "jest-jasmine2": "^24.9.0", - "jest-leak-detector": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-resolve": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.6.0", + "graceful-fs": "^4.2.3", + "jest-config": "^25.2.7", + "jest-docblock": "^25.2.6", + "jest-haste-map": "^25.2.6", + "jest-jasmine2": "^25.2.7", + "jest-leak-detector": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-runtime": "^25.2.7", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", "source-map-support": "^0.5.6", - "throat": "^4.0.0" + "throat": "^5.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-runtime": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.9.0.tgz", - "integrity": "sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==", - "dev": true, - "requires": { - "@jest/console": "^24.7.1", - "@jest/environment": "^24.9.0", - "@jest/source-map": "^24.3.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/yargs": "^13.0.0", - "chalk": "^2.0.1", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.2.7.tgz", + "integrity": "sha512-Gw3X8KxTTFylu2T/iDSNKRUQXQiPIYUY0b66GwVYa7W8wySkUljKhibQHSq0VhmCAN7vRBEQjlVQ+NFGNmQeBw==", + "dev": true, + "requires": { + "@jest/console": "^25.2.6", + "@jest/environment": "^25.2.6", + "@jest/source-map": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0", + "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.3", - "graceful-fs": "^4.1.15", - "jest-config": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "realpath-native": "^1.1.0", - "slash": "^2.0.0", - "strip-bom": "^3.0.0", - "yargs": "^13.3.0" + "graceful-fs": "^4.2.3", + "jest-config": "^25.2.7", + "jest-haste-map": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-snapshot": "^25.2.7", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0", + "yargs": "^15.3.1" }, "dependencies": { - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, "jest-serializer": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-24.9.0.tgz", - "integrity": "sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", "dev": true }, "jest-snapshot": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.9.0.tgz", - "integrity": "sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew==", + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-25.2.7.tgz", + "integrity": "sha512-Rm8k7xpGM4tzmYhB6IeRjsOMkXaU8/FOz5XlU6oYwhy53mq6txVNqIKqN1VSiexzpC80oWVxVDfUDt71M6XPOA==", "dev": true, "requires": { "@babel/types": "^7.0.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "expect": "^24.9.0", - "jest-diff": "^24.9.0", - "jest-get-type": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-resolve": "^24.9.0", - "mkdirp": "^0.5.1", + "@jest/types": "^25.2.6", + "@types/prettier": "^1.19.0", + "chalk": "^3.0.0", + "expect": "^25.2.7", + "jest-diff": "^25.2.6", + "jest-get-type": "^25.2.6", + "jest-matcher-utils": "^25.2.7", + "jest-message-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "make-dir": "^3.0.0", "natural-compare": "^1.4.0", - "pretty-format": "^24.9.0", - "semver": "^6.2.0" + "pretty-format": "^25.2.6", + "semver": "^6.3.0" }, "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-validate": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-25.2.6.tgz", + "integrity": "sha512-a4GN7hYbqQ3Rt9iHsNLFqQz7HDV7KiRPCwPgo5nqtTIWNZw7gnT8KchG+Riwh+UTSn8REjFCodGp50KX/fRNgQ==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "camelcase": "^5.3.1", + "chalk": "^3.0.0", + "jest-get-type": "^25.2.6", + "leven": "^3.1.0", + "pretty-format": "^25.2.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, - "jest-util": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz", - "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==", + "jest-watcher": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-25.2.7.tgz", + "integrity": "sha512-RdHuW+f49tahWtluTnUdZ2iPliebleROI2L/J5phYrUS6DPC9RB3SuUtqYyYhGZJsbvRSuLMIlY/cICJ+PIecw==", "dev": true, "requires": { - "@jest/console": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/source-map": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "callsites": "^3.0.0", - "chalk": "^2.0.1", - "graceful-fs": "^4.1.15", - "is-ci": "^2.0.0", - "mkdirp": "^0.5.1", - "slash": "^2.0.0", - "source-map": "^0.6.0" + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "jest-util": "^25.2.6", + "string-length": "^3.1.0" }, "dependencies": { - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, - "jest-validate": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", - "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "camelcase": "^5.3.1", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "leven": "^3.1.0", - "pretty-format": "^24.9.0" - } - }, - "jest-watcher": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.9.0.tgz", - "integrity": "sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw==", - "dev": true, - "requires": { - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/yargs": "^13.0.0", - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "jest-util": "^24.9.0", - "string-length": "^2.0.0" - } - }, "jest-worker": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", - "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", "dev": true, "requires": { "merge-stream": "^2.0.0", - "supports-color": "^6.1.0" + "supports-color": "^7.0.0" }, "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } } } @@ -4278,36 +4765,36 @@ "dev": true }, "jsdom": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", - "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "version": "15.2.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", + "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", "dev": true, "requires": { "abab": "^2.0.0", - "acorn": "^5.5.3", - "acorn-globals": "^4.1.0", + "acorn": "^7.1.0", + "acorn-globals": "^4.3.2", "array-equal": "^1.0.0", - "cssom": ">= 0.3.2 < 0.4.0", - "cssstyle": "^1.0.0", - "data-urls": "^1.0.0", + "cssom": "^0.4.1", + "cssstyle": "^2.0.0", + "data-urls": "^1.1.0", "domexception": "^1.0.1", - "escodegen": "^1.9.1", + "escodegen": "^1.11.1", "html-encoding-sniffer": "^1.0.2", - "left-pad": "^1.3.0", - "nwsapi": "^2.0.7", - "parse5": "4.0.0", + "nwsapi": "^2.2.0", + "parse5": "5.1.0", "pn": "^1.1.0", - "request": "^2.87.0", - "request-promise-native": "^1.0.5", - "sax": "^1.2.4", + "request": "^2.88.0", + "request-promise-native": "^1.0.7", + "saxes": "^3.1.9", "symbol-tree": "^3.2.2", - "tough-cookie": "^2.3.4", + "tough-cookie": "^3.0.1", "w3c-hr-time": "^1.0.1", + "w3c-xmlserializer": "^1.1.2", "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.3", - "whatwg-mimetype": "^2.1.0", - "whatwg-url": "^6.4.1", - "ws": "^5.2.0", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^7.0.0", + "ws": "^7.0.0", "xml-name-validator": "^3.0.0" } }, @@ -4317,12 +4804,6 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -4342,12 +4823,12 @@ "dev": true }, "json5": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", - "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", "dev": true, "requires": { - "minimist": "^1.2.0" + "minimist": "^1.2.5" } }, "jsonfile": { @@ -4395,12 +4876,6 @@ "set-getter": "^0.1.0" } }, - "left-pad": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", - "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", - "dev": true - }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -4429,26 +4904,13 @@ "repeat-string": "^1.5.2" } }, - "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - } - }, "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" } }, "lodash": { @@ -4463,6 +4925,12 @@ "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", "dev": true }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", @@ -4488,29 +4956,37 @@ "lodash._reinterpolate": "^3.0.0" } }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2" + } + }, + "lolex": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", "dev": true, "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" + "@sinonjs/commons": "^1.7.0" } }, "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", "dev": true, "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" + "semver": "^6.0.0" }, "dependencies": { - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -4596,51 +5072,13 @@ "dev": true }, "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "dev": true, "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - } + "braces": "^3.0.1", + "picomatch": "^2.0.5" } }, "mime-db": { @@ -4658,6 +5096,12 @@ "mime-db": "1.43.0" } }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -4704,37 +5148,61 @@ } }, "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz", + "integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==", "dev": true, "requires": { + "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", + "chokidar": "3.3.0", + "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", - "glob": "7.1.2", + "find-up": "3.0.0", + "glob": "7.1.3", "growl": "1.10.5", - "he": "1.1.1", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "mkdirp": "0.5.3", + "ms": "2.1.1", + "node-environment-flags": "1.0.6", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" }, "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "diff": { @@ -4743,10 +5211,25 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -4757,29 +5240,128 @@ "path-is-absolute": "^1.0.0" } }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", + "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "minimist": "0.0.8" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" } }, "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", "dev": true, "requires": { "has-flag": "^3.0.0" } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, @@ -4810,13 +5392,6 @@ } } }, - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true - }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -4875,6 +5450,16 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-environment-flags": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -4888,38 +5473,43 @@ "dev": true }, "node-notifier": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz", - "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-6.0.0.tgz", + "integrity": "sha512-SVfQ/wMw+DesunOm5cKqr6yDcvUTDl/yc97ybGHMrteNEY6oekXpNpS3lZwgLlwz0FLgHoiW28ZpmBHUDg37cw==", "dev": true, + "optional": true, "requires": { "growly": "^1.3.0", - "is-wsl": "^1.1.0", - "semver": "^5.5.0", + "is-wsl": "^2.1.1", + "semver": "^6.3.0", "shellwords": "^0.1.1", - "which": "^1.3.0" - } - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" + "which": "^1.3.1" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "optional": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "optional": true, + "requires": { + "isexe": "^2.0.0" + } + } } }, "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true }, "npm-run-path": { "version": "2.0.2", @@ -5041,6 +5631,15 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -5056,13 +5655,10 @@ } }, "p-each-series": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-1.0.0.tgz", - "integrity": "sha1-kw89Et0fUOdDRFeiLNbwSsatf3E=", - "dev": true, - "requires": { - "p-reduce": "^1.0.0" - } + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", + "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==", + "dev": true }, "p-finally": { "version": "1.0.0", @@ -5071,29 +5667,23 @@ "dev": true }, "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "requires": { "p-try": "^2.0.0" } }, "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "requires": { - "p-limit": "^2.0.0" + "p-limit": "^2.2.0" } }, - "p-reduce": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz", - "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=", - "dev": true - }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -5114,20 +5704,10 @@ "is-hexadecimal": "^1.0.0" } }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, "parse5": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", - "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", + "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", "dev": true }, "parsimmon": { @@ -5143,9 +5723,9 @@ "dev": true }, "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, "path-is-absolute": { @@ -5166,15 +5746,6 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -5187,12 +5758,6 @@ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, "pirates": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", @@ -5203,12 +5768,12 @@ } }, "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "requires": { - "find-up": "^3.0.0" + "find-up": "^4.0.0" } }, "platform": { @@ -5236,21 +5801,48 @@ "dev": true }, "prettier": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz", - "integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.3.tgz", + "integrity": "sha512-5qpBDBHO9fpE0zruKiTZm8Gxmz7kknO+WlQR/ivV+RMwgDw/WjOgmxLDn66MPrxq/WZPx/EgEZzh87xJO5E6Fw==", "dev": true }, "pretty-format": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz", - "integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.2.6.tgz", + "integrity": "sha512-DEiWxLBaCHneffrIT4B+TpMvkV9RNvvJrd3lY9ew1CEQobDzEXmYT1mg0hJhljZty7kCc10z13ohOFAE8jrUDg==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "ansi-regex": "^4.0.0", - "ansi-styles": "^3.2.0", - "react-is": "^16.8.4" + "@jest/types": "^25.2.6", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^16.12.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } } }, "process-nextick-args": { @@ -5259,6 +5851,16 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "prompts": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", + "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.4" + } + }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -5318,27 +5920,6 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, - "read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - } - }, - "read-pkg-up": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", - "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", - "dev": true, - "requires": { - "find-up": "^3.0.0", - "read-pkg": "^3.0.0" - } - }, "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", @@ -5354,15 +5935,21 @@ "util-deprecate": "~1.0.1" } }, - "realpath-native": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.1.0.tgz", - "integrity": "sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA==", + "readdirp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", "dev": true, "requires": { - "util.promisify": "^1.0.0" + "picomatch": "^2.0.4" } }, + "realpath-native": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-2.0.0.tgz", + "integrity": "sha512-v1SEYUOXXdbBZK8ZuNgO4TBjamPsiSgcFr0aP+tEKpQZK8vooEUqV6nm6Cv502mX4NF2EfsnVqtNAHG+/6Ur1Q==", + "dev": true + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -5487,6 +6074,18 @@ "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" + }, + "dependencies": { + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } } }, "request-promise-core": { @@ -5507,6 +6106,18 @@ "request-promise-core": "1.1.3", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" + }, + "dependencies": { + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } } }, "require-directory": { @@ -5522,27 +6133,27 @@ "dev": true }, "resolve": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", - "integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", "dev": true, "requires": { "path-parse": "^1.0.6" } }, "resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", "dev": true, "requires": { - "resolve-from": "^3.0.0" + "resolve-from": "^5.0.0" } }, "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, "resolve-url": { @@ -5564,12 +6175,12 @@ "dev": true }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "rsvp": { @@ -5620,18 +6231,178 @@ "micromatch": "^3.1.4", "minimist": "^1.1.1", "walker": "~1.0.5" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } } }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true + "saxes": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", + "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", + "dev": true, + "requires": { + "xmlchars": "^2.1.1" + } }, "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "set-blocking": { @@ -5680,7 +6451,8 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true + "dev": true, + "optional": true }, "signal-exit": { "version": "3.0.3", @@ -5840,38 +6612,6 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, - "spdx-correct": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", - "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", - "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", - "dev": true - }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -5965,47 +6705,47 @@ "dev": true }, "string-length": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", - "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz", + "integrity": "sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA==", "dev": true, "requires": { "astral-regex": "^1.0.0", - "strip-ansi": "^4.0.0" + "strip-ansi": "^5.2.0" }, "dependencies": { "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "^4.1.0" } } } }, "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" }, "dependencies": { "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true } } @@ -6062,18 +6802,18 @@ } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" } }, "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true }, "strip-color": { @@ -6088,6 +6828,12 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -6112,28 +6858,64 @@ "has-flag": "^3.0.0" } }, + "supports-hyperlinks": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz", + "integrity": "sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA==", + "dev": true, + "requires": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "terminal-link": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", + "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "supports-hyperlinks": "^2.0.0" + } + }, "test-exclude": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", - "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, "requires": { - "glob": "^7.1.3", - "minimatch": "^3.0.4", - "read-pkg-up": "^4.0.0", - "require-main-filename": "^2.0.0" + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" } }, "throat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", - "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz", + "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", "dev": true }, "through2": { @@ -6201,23 +6983,19 @@ } }, "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" + "is-number": "^7.0.0" }, "dependencies": { "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true } } }, @@ -6228,11 +7006,12 @@ "dev": true }, "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", + "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", "dev": true, "requires": { + "ip-regex": "^2.1.0", "psl": "^1.1.28", "punycode": "^2.1.1" } @@ -6271,36 +7050,35 @@ "dev": true }, "ts-jest": { - "version": "24.0.2", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.0.2.tgz", - "integrity": "sha512-h6ZCZiA1EQgjczxq+uGLXQlNgeg02WWJBbeT8j6nyIBRQdglqbvzDoHahTEIiS6Eor6x8mK6PfZ7brQ9Q6tzHw==", + "version": "25.3.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.3.1.tgz", + "integrity": "sha512-O53FtKguoMUByalAJW+NWEv7c4tus5ckmhfa7/V0jBb2z8v5rDSLFC1Ate7wLknYPC1euuhY6eJjQq4FtOZrkg==", "dev": true, "requires": { "bs-logger": "0.x", "buffer-from": "1.x", "fast-json-stable-stringify": "2.x", "json5": "2.x", + "lodash.memoize": "4.x", "make-error": "1.x", - "mkdirp": "0.x", + "micromatch": "4.x", + "mkdirp": "1.x", "resolve": "1.x", - "semver": "^5.5", - "yargs-parser": "10.x" + "semver": "6.x", + "yargs-parser": "18.x" }, "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true }, - "yargs-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", - "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true } } }, @@ -6316,74 +7094,49 @@ } }, "ts-node": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", - "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz", + "integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==", "dev": true, "requires": { - "arrify": "^1.0.0", - "buffer-from": "^1.1.0", - "diff": "^3.1.0", + "arg": "^4.1.0", + "diff": "^4.0.1", "make-error": "^1.1.1", - "minimist": "^1.2.0", - "mkdirp": "^0.5.1", "source-map-support": "^0.5.6", - "yn": "^2.0.0" - }, - "dependencies": { - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "yn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", - "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", - "dev": true - } + "yn": "3.1.1" } }, "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", "dev": true }, "tslint": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.18.0.tgz", - "integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.1.tgz", + "integrity": "sha512-kd6AQ/IgPRpLn6g5TozqzPdGNZ0q0jtXW4//hRcj10qLYBaa3mTUU2y2MCG+RXZm8Zx+KZi0eA+YCrMyNlF4UA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", - "diff": "^3.2.0", + "diff": "^4.0.1", "glob": "^7.1.1", "js-yaml": "^3.13.1", "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", + "mkdirp": "^0.5.3", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.8.0", + "tslib": "^1.10.0", "tsutils": "^2.29.0" - }, - "dependencies": { - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - } } }, "tslint-config-standard": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/tslint-config-standard/-/tslint-config-standard-8.0.1.tgz", - "integrity": "sha512-OWG+NblgjQlVuUS/Dmq3ax2v5QDZwRx4L0kEuDi7qFY9UI6RJhhNfoCV1qI4el8Fw1c5a5BTrjQJP0/jhGXY/Q==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/tslint-config-standard/-/tslint-config-standard-9.0.0.tgz", + "integrity": "sha512-CAw9J743RnPMemQV/XQ4YyNreC+A1NItACfkm+cBedrOkz6CQfwlnbKn8anUXBfoa4Zo4tjAhblRbsMNcSLfSw==", "dev": true, "requires": { "tslint-eslint-rules": "^5.3.1" @@ -6429,9 +7182,9 @@ "dev": true }, "tsutils": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.14.0.tgz", - "integrity": "sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw==", + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -6472,12 +7225,33 @@ "prelude-ls": "~1.1.2" } }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, "typescript": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", @@ -6650,32 +7424,29 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "util.promisify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", - "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.2", - "has-symbols": "^1.0.1", - "object.getownpropertydescriptors": "^2.1.0" - } - }, "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "dev": true }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "v8-to-istanbul": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz", + "integrity": "sha512-sAjOC+Kki6aJVbUOXJbcR0MnbfjvBzwKZazEJymA2IX49uoOdEdk+4fBq5cXgYgiyKtAyrrJNtBZdOeDIF+Fng==", "dev": true, "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } } }, "verror": { @@ -6725,6 +7496,17 @@ "browser-process-hrtime": "^1.0.0" } }, + "w3c-xmlserializer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", + "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", + "dev": true, + "requires": { + "domexception": "^1.0.1", + "webidl-conversions": "^4.0.2", + "xml-name-validator": "^3.0.0" + } + }, "walker": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", @@ -6756,9 +7538,9 @@ "dev": true }, "whatwg-url": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", - "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", "dev": true, "requires": { "lodash.sortby": "^4.7.0", @@ -6767,9 +7549,9 @@ } }, "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -6781,6 +7563,48 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -6788,14 +7612,41 @@ "dev": true }, "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dev": true, "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } } }, "wrappy": { @@ -6805,24 +7656,22 @@ "dev": true }, "write-file-atomic": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.1.tgz", - "integrity": "sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, "requires": { - "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" } }, "ws": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", + "dev": true }, "x-is-string": { "version": "0.1.0", @@ -6836,6 +7685,12 @@ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true }, + "xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", @@ -6849,33 +7704,169 @@ "dev": true }, "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", + "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==", "dev": true, "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", - "string-width": "^3.0.0", + "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" + "yargs-parser": "^18.1.1" } }, "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "version": "18.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.2.tgz", + "integrity": "sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ==", "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, + "yargs-unparser": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.15", + "yargs": "^13.3.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index 073431da0..86e847569 100644 --- a/package.json +++ b/package.json @@ -43,23 +43,23 @@ }, "devDependencies": { "@types/benchmark": "1.0.31", - "@types/jest": "^23.3.8", - "@types/node": "7.0.4", + "@types/jest": "25.2.1", + "@types/node": "13.11.0", "benchmark": "2.1.4", - "docs-ts": "^0.4.0", - "doctoc": "^1.4.0", + "docs-ts": "0.4.0", + "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", - "fp-ts": "^2.0.0", + "fp-ts": "2.5.3", "import-path-rewrite": "github:gcanti/import-path-rewrite", - "jest": "^24.8.0", - "mocha": "^5.2.0", - "prettier": "^2.0.2", - "rimraf": "2.6.2", - "ts-jest": "^24.0.2", - "ts-node": "^7.0.1", - "tslint": "^5.11.0", - "tslint-config-standard": "^8.0.1", - "typescript": "^3.8.3" + "jest": "25.2.7", + "mocha": "7.1.1", + "prettier": "2.0.3", + "rimraf": "3.0.2", + "ts-jest": "25.3.1", + "ts-node": "8.8.2", + "tslint": "6.1.1", + "tslint-config-standard": "9.0.0", + "typescript": "3.8.3" }, "tags": [ "typescript", From e4291dfea8814e50072a25d983b177a8d513db5d Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 7 Apr 2020 08:50:02 +0200 Subject: [PATCH 003/222] downgrade to prettier@2.0.2 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index b76a574d9..c7d3109cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5801,9 +5801,9 @@ "dev": true }, "prettier": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.3.tgz", - "integrity": "sha512-5qpBDBHO9fpE0zruKiTZm8Gxmz7kknO+WlQR/ivV+RMwgDw/WjOgmxLDn66MPrxq/WZPx/EgEZzh87xJO5E6Fw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz", + "integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==", "dev": true }, "pretty-format": { diff --git a/package.json b/package.json index 86e847569..36c5d24cb 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", - "prettier": "2.0.3", + "prettier": "2.0.2", "rimraf": "3.0.2", "ts-jest": "25.3.1", "ts-node": "8.8.2", From af239bdf5af02e1c46d0ccc07292ac7ecd6ecd8a Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Thu, 16 Apr 2020 15:23:15 +0200 Subject: [PATCH 004/222] split Type into Decoder / Encoder, closes #336 --- CHANGELOG.md | 5 + Codec.md | 60 ++++ Decoder.md | 345 +++++++++++++++++++ Encoder.md | 41 +++ README.md | 572 +------------------------------- Schema.md | 23 ++ Type.md | 572 ++++++++++++++++++++++++++++++++ docs/modules/Codec.ts.md | 274 +++++++++++++++ docs/modules/Decoder.ts.md | 422 +++++++++++++++++++++++ docs/modules/Encoder.ts.md | 187 +++++++++++ docs/modules/Guard.ts.md | 266 +++++++++++++++ docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 51 +++ docs/modules/Schemable.ts.md | 83 +++++ docs/modules/Tree.ts.md | 27 ++ docs/modules/index.ts.md | 2 +- dtslint/ts3.5/Schemable.ts | 113 +++++++ package.json | 2 +- src/Codec.ts | 204 ++++++++++++ src/Decoder.ts | 519 +++++++++++++++++++++++++++++ src/Encoder.ts | 197 +++++++++++ src/Guard.ts | 244 ++++++++++++++ src/Schema.ts | 24 ++ src/Schemable.ts | 57 ++++ src/Tree.ts | 12 + test/Codec.ts | 532 +++++++++++++++++++++++++++++ test/Decoder.ts | 104 ++++++ test/Encoder.ts | 11 + test/Guard.ts | 208 ++++++++++++ test/Schema.ts | 33 ++ test/Tree.ts | 19 ++ 32 files changed, 4648 insertions(+), 565 deletions(-) create mode 100644 Codec.md create mode 100644 Decoder.md create mode 100644 Encoder.md create mode 100644 Schema.md create mode 100644 Type.md create mode 100644 docs/modules/Codec.ts.md create mode 100644 docs/modules/Decoder.ts.md create mode 100644 docs/modules/Encoder.ts.md create mode 100644 docs/modules/Guard.ts.md create mode 100644 docs/modules/Schema.ts.md create mode 100644 docs/modules/Schemable.ts.md create mode 100644 docs/modules/Tree.ts.md create mode 100644 dtslint/ts3.5/Schemable.ts create mode 100644 src/Codec.ts create mode 100644 src/Decoder.ts create mode 100644 src/Encoder.ts create mode 100644 src/Guard.ts create mode 100644 src/Schema.ts create mode 100644 src/Schemable.ts create mode 100644 src/Tree.ts create mode 100644 test/Codec.ts create mode 100644 test/Decoder.ts create mode 100644 test/Encoder.ts create mode 100644 test/Guard.ts create mode 100644 test/Schema.ts create mode 100644 test/Tree.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d520e5890..c0826cd51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.0 + +- **Experimental** + - add `Codec`, `Decoder`, `Encoder`, `Guard`, `Schema`, `Schemable`, `Tree` modules (@gcanti) + # 2.1.3 - **Polish** diff --git a/Codec.md b/Codec.md new file mode 100644 index 000000000..f3cf40de2 --- /dev/null +++ b/Codec.md @@ -0,0 +1,60 @@ + + + +- [Codec interface](#codec-interface) +- [Built-in primitive codecs](#built-in-primitive-codecs) +- [Combinators](#combinators) + + + +# Codec interface + +```ts +export interface Codec extends Decoder, Encoder {} +``` + +A codec is just a decoder and an encoder packed together. + +The following laws must hold + +1. `pipe(codec.decode(u), E.fold(() => u, codec.encode) = u` for all `u` in `unknown` +2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` + +You can build a new codec using the `make` helper + +**Example** + +```ts +import * as C from 'io-ts/lib/Codec' +import * as D from 'io-ts/lib/Decoder' +import { left, right } from 'fp-ts/lib/Either' + +const NumberFromString: C.Codec = C.make( + D.parse(D.string, (s) => { + const n = parseFloat(s) + return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`) : right(n) + }), + { encode: String } +) +``` + +# Built-in primitive codecs + +- `string: Decoder` +- `number: Decoder` +- `boolean: Decoder` +- `UnknownArray: Decoder>` +- `UnknownRecord: Decoder>` + +# Combinators + +- `literal` +- `nullable` +- `type` +- `partial` +- `record` +- `array` +- `tuple` +- `intersection` +- `sum` +- `lazy` diff --git a/Decoder.md b/Decoder.md new file mode 100644 index 000000000..19e5e3f7d --- /dev/null +++ b/Decoder.md @@ -0,0 +1,345 @@ + + + +- [Decoder interface](#decoder-interface) +- [Built-in primitive decoders](#built-in-primitive-decoders) +- [Combinators](#combinators) + - [The `literal` constructor](#the-literal-constructor) + - [The `nullable` combinator](#the-nullable-combinator) + - [The `type` combinator](#the-type-combinator) + - [The `partial` combinator](#the-partial-combinator) + - [The `record` combinator](#the-record-combinator) + - [The `array` combinator](#the-array-combinator) + - [The `tuple` combinator](#the-tuple-combinator) + - [The `intersection` combinator](#the-intersection-combinator) + - [The `sum` combinator](#the-sum-combinator) + - [The `lazy` combinator](#the-lazy-combinator) + - [The `refinement` combinator](#the-refinement-combinator) + - [The `parse` combinator](#the-parse-combinator) +- [Extracting static types from decoders](#extracting-static-types-from-decoders) +- [Built-in error reporter](#built-in-error-reporter) + + + +# Decoder interface + +```ts +export interface Decoder { + readonly decode: (u: unknown) => E.Either>, A> +} +``` + +**Example** + +A decoder representing `string` can be defined as + +```ts +import * as D from 'io-ts/lib/Decoder' + +export const string: D.Decoder = { + decode: (u) => + typeof u === 'string' ? D.success(u) : D.failure(`cannot decode ${JSON.stringify(u)}, should be string`) +} +``` + +and we can use it as follows: + +```ts +import { isRight } from 'fp-ts/lib/Either' + +console.log(isRight(string.decode('a'))) // => true +console.log(isRight(string.decode(null))) // => false +``` + +More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold-function) along with `pipe` (which is similar to the pipeline operator) + +```ts +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' + +console.log( + pipe( + string.decode(null), + fold( + // failure handler + (errors) => console.error(errors), + // success handler + (a) => console.log(a) + ) + ) +) +// => [ { value: 'cannot decode null, should be string', forest: [] } ] +``` + +# Built-in primitive decoders + +- `never: Decoder` +- `string: Decoder` +- `number: Decoder` +- `boolean: Decoder` +- `UnknownArray: Decoder>` +- `UnknownRecord: Decoder>` + +# Combinators + +We can combine these primitive decoders through _combinators_ to build composite types which represent entities like domain models, request payloads etc. in our applications. + +## The `literal` constructor + +The `literal` constructor describes one or more literals. + +```ts +export const MyLiteral: D.Decoder<'a'> = D.literal('a') +export const MyLiterals: D.Decoder<'a' | 'b'> = D.literal('a', 'b') +``` + +## The `nullable` combinator + +The `nullable` combinator describes a nullable value + +```ts +export const NullableString: D.Decoder = D.nullable(D.string) +``` + +## The `type` combinator + +The `type` combinator describes an object with required fields. + +```ts +export const Person = D.type({ + name: D.string, + age: D.number +}) + +console.log(isRight(Person.decode({ name: 'name', age: 42 }))) // => true +console.log(isRight(Person.decode({ name: 'name' }))) // => false +``` + +The `type` combinator will strip additional fields while decoding + +```ts +console.log(Person.decode({ name: 'name', age: 42, remeberMe: true })) +// => { _tag: 'Right', right: { name: 'name', age: 42 } } +``` + +## The `partial` combinator + +The `partial` combinator describes an object with optional fields. + +```ts +export const Person = D.partial({ + name: D.string, + age: D.number +}) + +console.log(isRight(Person.decode({ name: 'name', age: 42 }))) // => true +console.log(isRight(Person.decode({ name: 'name' }))) // => true +``` + +The `partial` combinator will strip additional fields while decoding + +```ts +console.log(Person.decode({ name: 'name', remeberMe: true })) +// => { _tag: 'Right', right: { name: 'name' } } +``` + +## The `record` combinator + +The `record` combinator describes a `Record` + +```ts +export const MyRecord: D.Decoder> = D.record(D.number) + +console.log(isRight(MyRecord.decode({ a: 1, b: 2 }))) // => true +``` + +## The `array` combinator + +The `array` combinator describes an array `Array` + +```ts +export const MyArray: D.Decoder> = D.array(D.number) + +console.log(isRight(MyArray.decode([1, 2, 3]))) // => true +``` + +## The `tuple` combinator + +The `tuple` combinator describes a `n`-tuple + +```ts +export const MyTuple: D.Decoder<[string, number]> = D.tuple(D.string, D.number) + +console.log(isRight(MyTuple.decode(['a', 1]))) // => true +``` + +The `tuple` combinator will strip additional components while decoding + +```ts +console.log(MyTuple.decode(['a', 1, true])) // => { _tag: 'Right', right: [ 'a', 1 ] } +``` + +## The `intersection` combinator + +The `intersection` combinator is useful in order to mix required and optional props + +```ts +export const Person = D.intersection( + D.type({ + name: D.string + }), + D.partial({ + age: D.number + }) +) + +console.log(isRight(Person.decode({ name: 'name' }))) // => true +console.log(isRight(Person.decode({}))) // => false +``` + +## The `sum` combinator + +The `sum` combinator describes tagged unions (aka sum types) + +```ts +export const MySum: D.Decoder< + | { + type: 'A' + a: string + } + | { + type: 'B' + b: number + } +> = D.sum('type')({ + A: D.type({ type: D.literal('A'), a: D.string }), + B: D.type({ type: D.literal('B'), b: D.number }) +}) +``` + +## The `lazy` combinator + +The `lazy` combinator allows to define recursive and mutually recursive decoders + +**Recursive** + +```ts +interface Category { + title: string + subcategory: null | Category +} + +const Category: D.Decoder = D.lazy('Category', () => + D.type({ + title: D.string, + subcategory: D.nullable(Category) + }) +) +``` + +**Mutually recursive** + +```ts +interface Foo { + foo: string + bar: null | Bar +} + +interface Bar { + bar: number + foo: null | Foo +} + +const Foo: D.Decoder = D.lazy('Foo', () => + D.type({ + foo: D.string, + bar: D.nullable(Bar) + }) +) + +const Bar: D.Decoder = D.lazy('Bar', () => + D.type({ + bar: D.number, + foo: D.nullable(Foo) + }) +) +``` + +## The `refinement` combinator + +The `refinement` combinator allows to define refinements, for example a branded type + +```ts +export interface PositiveBrand { + readonly Positive: unique symbol +} + +export type Positive = number & PositiveBrand + +export const Positive: D.Decoder = D.refinement(D.number, (n): n is Positive => n > 0, 'Positive') + +console.log(isRight(Positive.decode(1))) // => true +console.log(isRight(Positive.decode(-1))) // => false +``` + +## The `parse` combinator + +The `parse` combinator is more powerful than `refinement` in that you can change the output type + +```ts +import { left, right } from 'fp-ts/lib/Either' + +export const NumberFromString: D.Decoder = D.parse(D.string, (s) => { + const n = parseFloat(s) + return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be NumberFromString`) : right(n) +}) + +console.log(isRight(NumberFromString.decode('1'))) // => true +console.log(isRight(NumberFromString.decode('a'))) // => false +``` + +# Extracting static types from decoders + +Static types can be extracted from decoders using the `TypeOf` operator + +```ts +export const Person = D.type({ + name: D.string, + age: D.number +}) + +export type Person = D.TypeOf +/* +type Person = { + name: string; + age: number; +} +*/ +``` + +Note that you can define an `interface` instead of a type alias + +```ts +export interface Person extends D.TypeOf {} +``` + +# Built-in error reporter + +```ts +import { isLeft } from 'fp-ts/lib/Either' +import { draw } from 'io-ts/lib/Tree' + +export const Person = D.type({ + name: D.string, + age: D.number +}) + +const result = Person.decode({}) +if (isLeft(result)) { + console.log(draw(result.left)) +} +/* +required property "name" +└─ cannot decode undefined, should be string +*/ +``` diff --git a/Encoder.md b/Encoder.md new file mode 100644 index 000000000..bc63223ec --- /dev/null +++ b/Encoder.md @@ -0,0 +1,41 @@ + + + +- [Encoder interface](#encoder-interface) +- [Combinators](#combinators) + + + +# Encoder interface + +```ts +export interface Encoder { + readonly encode: (a: A) => unknown +} +``` + +**Example** + +An encoder representing a nullable value + +```ts +import * as E from 'io-ts/lib/Encoder' + +export function nullable(or: E.Encoder): E.Encoder { + return { + encode: (a) => (a === null ? a : or.encode(a)) + } +} +``` + +# Combinators + +- `nullable` +- `type` +- `partial` +- `record` +- `array` +- `tuple` +- `intersection` +- `sum` +- `lazy` diff --git a/README.md b/README.md index cf96605ba..a791eed9d 100644 --- a/README.md +++ b/README.md @@ -3,29 +3,11 @@ ![npm downloads](https://img.shields.io/npm/dm/io-ts.svg) [![Minified Size](https://badgen.net/bundlephobia/minzip/io-ts)](https://bundlephobia.com/result?p=io-ts) -Table of contents - - [Installation](#installation) -- [The idea](#the-idea) -- [TypeScript integration](#typescript-integration) -- [TypeScript compatibility](#typescript-compatibility) -- [Error reporters](#error-reporters) -- [Custom error messages](#custom-error-messages) -- [Implemented types / combinators](#implemented-types--combinators) -- [Recursive types](#recursive-types) - - [Mutually recursive types](#mutually-recursive-types) -- [Branded types / Refinements](#branded-types--refinements) -- [Exact types](#exact-types) -- [Mixing required and optional props](#mixing-required-and-optional-props) -- [Custom types](#custom-types) -- [Generic Types](#generic-types) -- [Piping](#piping) -- [Community](#community) -- [Tips and Tricks](#tips-and-tricks) - - [Union of string literals](#union-of-string-literals) +- [Documentation](#documentation) @@ -39,551 +21,19 @@ npm i io-ts fp-ts Note: [`fp-ts`](https://github.com/gcanti/fp-ts) is a peer dependency for `io-ts` -# The idea - -A value of type `Type` (called "codec") is the runtime representation of the static type `A`. - -A codec can: - -- decode inputs of type `I` (through `decode`) -- encode outputs of type `O` (through `encode`) -- be used as a custom [type guard](https://basarat.gitbooks.io/typescript/content/docs/types/typeGuard.html) (through `is`) - -```ts -class Type { - constructor( - /** a unique name for this codec */ - readonly name: string, - - /** a custom type guard */ - readonly is: (u: unknown) => u is A, - - /** succeeds if a value of type I can be decoded to a value of type A */ - readonly validate: (input: I, context: Context) => Either, - - /** converts a value of type A to a value of type O */ - readonly encode: (a: A) => O - ) {} - - /** a version of `validate` with a default context */ - decode(i: I): Either -} -``` - -The [`Either`](https://gcanti.github.io/fp-ts/modules/Either.ts.html) type returned by `decode` is defined in [fp-ts](https://github.com/gcanti/fp-ts), a library containing implementations of common algebraic types in TypeScript. - -The `Either` type represents a value of one of two possible types (a disjoint union). An instance of `Either` is either an instance of `Left` or `Right`: - -```ts -type Either = - | { - readonly _tag: 'Left' - readonly left: E - } - | { - readonly _tag: 'Right' - readonly right: A - } -``` - -Convention dictates that `Left` is used for **failure** and `Right` is used for **success**. - -**Example** - -A codec representing `string` can be defined as: - -```ts -import * as t from 'io-ts' - -const string = new t.Type( - 'string', - (input: unknown): input is string => typeof input === 'string', - // `t.success` and `t.failure` are helpers used to build `Either` instances - (input, context) => (typeof input === 'string' ? t.success(input) : t.failure(input, context)), - // `A` and `O` are the same, so `encode` is just the identity function - t.identity -) -``` - -and we can use it as follows: - -```ts -import { isRight } from 'fp-ts/lib/Either' - -isRight(string.decode('a string')) // true -isRight(string.decode(null)) // false -``` - -More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold-function) along with `pipe` (which is similar to the pipeline operator) - -```ts -import * as t from 'io-ts' -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' - -// failure handler -const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` - -// success handler -const onRight = (s: string) => `No errors: ${s}` - -pipe(t.string.decode('a string'), fold(onLeft, onRight)) -// => "No errors: a string" - -pipe(t.string.decode(null), fold(onLeft, onRight)) -// => "1 error(s) found" -``` - -We can combine these codecs through [combinators](#implemented-types--combinators) to build composite types which represent entities like domain models, request payloads etc. in our applications: - -```ts -import * as t from 'io-ts' - -const User = t.type({ - userId: t.number, - name: t.string -}) -``` - -So this is equivalent to defining something like: - -```ts -type User = { - userId: number - name: string -} -``` - -The advantage of using `io-ts` to define the runtime type is that we can validate the type at runtime, and we can also extract the corresponding static type, so we don’t have to define it twice. - -# TypeScript integration +# Documentation -Codecs can be inspected: +- [API Reference](https://gcanti.github.io/io-ts/modules/) -![instrospection](images/introspection.png) +## Usage -This library uses TypeScript extensively. Its API is defined in a way which automatically infers types for produced -values - -![inference](images/inference.png) - -Note that the type annotation isn't needed, TypeScript infers the type automatically based on a schema (and comments are preserved). - -Static types can be extracted from codecs using the `TypeOf` operator: - -```ts -type User = t.TypeOf - -// same as -type User = { - userId: number - name: string -} -``` - -# TypeScript compatibility - -The stable version is tested against TypeScript 3.5.2 - -| io-ts version | required TypeScript version | -| ------------- | --------------------------- | -| 2.x+ | 3.5.2+ | -| 1.6.x+ | 3.2.2+ | -| 1.5.3 | 3.0.1+ | -| 1.5.2- | 2.7.2+ | - -**Note**. This library is conceived, tested and is supposed to be consumed by TypeScript with the `strict` flag turned on. - -**Note**. If you are running `< typescript@3.0.1` you have to polyfill `unknown`. - -You can use [unknown-ts](https://github.com/gcanti/unknown-ts) as a polyfill. - -# Error reporters - -A reporter implements the following interface - -```ts -interface Reporter { - report: (validation: Validation) => A -} -``` - -This package exports a default `PathReporter` reporter - -Example - -```ts -import { PathReporter } from 'io-ts/lib/PathReporter' - -const result = User.decode({ name: 'Giulio' }) - -console.log(PathReporter.report(result)) -// => [ 'Invalid value undefined supplied to : { userId: number, name: string }/userId: number' ] -``` - -You can define your own reporter. `Errors` has the following type - -```ts -interface ContextEntry { - readonly key: string - readonly type: Decoder -} - -interface Context extends ReadonlyArray {} - -interface ValidationError { - readonly value: unknown - readonly context: Context -} - -interface Errors extends Array {} -``` - -Example - -```ts -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' - -const getPaths = (v: t.Validation): Array => { - return pipe( - v, - fold( - errors => errors.map(error => error.context.map(({ key }) => key).join('.')), - () => ['no errors'] - ) - ) -} - -console.log(getPaths(User.decode({}))) // => [ '.userId', '.name' ] -``` - -# Custom error messages - -You can set your own error message by providing a `message` argument to `failure` - -Example - -```ts -import { either } from 'fp-ts/lib/Either' - -const NumberFromString = new t.Type( - 'NumberFromString', - t.number.is, - (u, c) => - either.chain(t.string.validate(u, c), s => { - const n = +s - return isNaN(n) ? t.failure(u, c, 'cannot parse to a number') : t.success(n) - }), - String -) - -console.log(PathReporter.report(NumberFromString.decode('a'))) -// => ['cannot parse to a number'] -``` +**Experimental features** (version `2.2+`) -You can also use the [`withMessage`](https://gcanti.github.io/io-ts-types/modules/withMessage.ts.html) helper from [io-ts-types](https://github.com/gcanti/io-ts-types) +- [`Decoder`](Decoder.md) +- [`Encoder`](Encoder.md) +- [`Codec`](Codec.md) +- [`Schema` (advanced feature)](Schema.md) -# Implemented types / combinators +**Stable** (old) -| Type | TypeScript | codec / combinator | -| --------------------------- | --------------------------- | -------------------------------------------------------------------- | -| null | `null` | `t.null` or `t.nullType` | -| undefined | `undefined` | `t.undefined` | -| void | `void` | `t.void` or `t.voidType` | -| string | `string` | `t.string` | -| number | `number` | `t.number` | -| boolean | `boolean` | `t.boolean` | -| unknown | `unknown` | `t.unknown` | -| array of unknown | `Array` | `t.UnknownArray` | -| array of type | `Array` | `t.array(A)` | -| record of unknown | `Record` | `t.UnknownRecord` | -| record of type | `Record` | `t.record(K, A)` | -| function | `Function` | `t.Function` | -| literal | `'s'` | `t.literal('s')` | -| partial | `Partial<{ name: string }>` | `t.partial({ name: t.string })` | -| readonly | `Readonly` | `t.readonly(A)` | -| readonly array | `ReadonlyArray` | `t.readonlyArray(A)` | -| type alias | `type T = { name: A }` | `t.type({ name: A })` | -| tuple | `[ A, B ]` | `t.tuple([ A, B ])` | -| union | `A \| B` | `t.union([ A, B ])` | -| intersection | `A & B` | `t.intersection([ A, B ])` | -| keyof | `keyof M` | `t.keyof(M)` (**only supports string keys**) | -| recursive types | | `t.recursion(name, definition)` | -| branded types / refinements | ✘ | `t.brand(A, predicate, brand)` | -| integer | ✘ | `t.Int` (built-in branded codec) | -| exact types | ✘ | `t.exact(type)` | -| strict | ✘ | `t.strict({ name: A })` (an alias of `t.exact(t.type({ name: A })))` | - -# Recursive types - -Recursive types can't be inferred by TypeScript so you must provide the static type as a hint - -```ts -interface Category { - name: string - categories: Array -} - -const Category: t.Type = t.recursion('Category', () => - t.type({ - name: t.string, - categories: t.array(Category) - }) -) -``` - -## Mutually recursive types - -```ts -interface Foo { - type: 'Foo' - b: Bar | undefined -} - -interface Bar { - type: 'Bar' - a: Foo | undefined -} - -const Foo: t.Type = t.recursion('Foo', () => - t.type({ - type: t.literal('Foo'), - b: t.union([Bar, t.undefined]) - }) -) - -const Bar: t.Type = t.recursion('Bar', () => - t.type({ - type: t.literal('Bar'), - a: t.union([Foo, t.undefined]) - }) -) -``` - -# Branded types / Refinements - -You can brand / refine a codec (_any_ codec) using the `brand` combinator - -```ts -// a unique brand for positive numbers -interface PositiveBrand { - readonly Positive: unique symbol // use `unique symbol` here to ensure uniqueness across modules / packages -} - -const Positive = t.brand( - t.number, // a codec representing the type to be refined - (n): n is t.Branded => n >= 0, // a custom type guard using the build-in helper `Branded` - 'Positive' // the name must match the readonly field in the brand -) - -type Positive = t.TypeOf -/* -same as -type Positive = number & t.Brand -*/ -``` - -Branded codecs can be merged with `t.intersection` - -```ts -// t.Int is a built-in branded codec -const PositiveInt = t.intersection([t.Int, Positive]) - -type PositiveInt = t.TypeOf -/* -same as -type PositiveInt = number & t.Brand & t.Brand -*/ -``` - -# Exact types - -You can make a codec exact (which means that additional properties are stripped) using the `exact` combinator - -```ts -const ExactUser = t.exact(User) - -User.decode({ userId: 1, name: 'Giulio', age: 45 }) // ok, result is right({ userId: 1, name: 'Giulio', age: 45 }) -ExactUser.decode({ userId: 1, name: 'Giulio', age: 43 }) // ok but result is right({ userId: 1, name: 'Giulio' }) -``` - -# Mixing required and optional props - -You can mix required and optional props using an intersection - -```ts -const A = t.type({ - foo: t.string -}) - -const B = t.partial({ - bar: t.number -}) - -const C = t.intersection([A, B]) - -type C = t.TypeOf - -// same as -type C = { - foo: string -} & { - bar?: number | undefined -} -``` - -You can apply `partial` to an already defined codec via its `props` field - -```ts -const PartialUser = t.partial(User.props) - -type PartialUser = t.TypeOf - -// same as -type PartialUser = { - name?: string - age?: number -} -``` - -# Custom types - -You can define your own types. Let's see an example - -```ts -import { either } from 'fp-ts/lib/Either' - -// represents a Date from an ISO string -const DateFromString = new t.Type( - 'DateFromString', - (u): u is Date => u instanceof Date, - (u, c) => - either.chain(t.string.validate(u, c), s => { - const d = new Date(s) - return isNaN(d.getTime()) ? t.failure(u, c) : t.success(d) - }), - a => a.toISOString() -) - -const s = new Date(1973, 10, 30).toISOString() - -DateFromString.decode(s) -// right(new Date('1973-11-29T23:00:00.000Z')) - -DateFromString.decode('foo') -// left(errors...) -``` - -Note that you can **deserialize** while validating. - -# Generic Types - -Polymorphic codecs are represented using functions. -For example, the following typescript: - -```ts -interface ResponseBody { - result: T - _links: Links -} - -interface Links { - previous: string - next: string -} -``` - -Would be: - -```ts -// where `t.Mixed = t.Type` -const responseBody = (codec: C) => - t.type({ - result: codec, - _links: Links - }) - -const Links = t.type({ - previous: t.string, - next: t.string -}) -``` - -And used like: - -```ts -const UserModel = t.type({ - name: t.string -}) - -functionThatRequiresRuntimeType(responseBody(t.array(UserModel)), ...params) -``` - -# Piping - -You can pipe two codecs if their type parameters do align - -```ts -const NumberCodec = new t.Type( - 'NumberCodec', - t.number.is, - (s, c) => { - const n = parseFloat(s) - return isNaN(n) ? t.failure(s, c) : t.success(n) - }, - String -) - -const NumberFromString = t.string.pipe(NumberCodec, 'NumberFromString') -``` - -# Community -- `io-ts@2.x` - - [io-ts-types](https://github.com/gcanti/io-ts-types) - A collection of codecs and combinators for use with - io-ts - - [io-ts-reporters](https://github.com/OliverJAsh/io-ts-reporters) - Error reporters for io-ts - - [io-ts-promise](https://github.com/aeirola/io-ts-promise) - Convenience library for using io-ts with promise-based APIs -- `io-ts@1.x` - - [geojson-iots](https://github.com/pierremarc/geojson-iots) - codecs for GeoJSON as defined in rfc7946 made with - io-ts - - [graphql-to-io-ts](https://github.com/micimize/graphql-to-io-ts) - Generate typescript and corresponding io-ts types from a graphql schema - - -# Tips and Tricks - -## Union of string literals - -Use `keyof` instead of `union` when defining a union of string literals - -```ts -const Bad = t.union([ - t.literal('foo'), - t.literal('bar'), - t.literal('baz') - // etc... -]) - -const Good = t.keyof({ - foo: null, - bar: null, - baz: null - // etc... -}) -``` - -Benefits - -- unique check for free -- better performance, `O(log(n))` vs `O(n)` - -Beware that `keyof` is designed to work with objects containing string keys. If you intend to define a numbers enumeration, you have to use an `union` of number literals : - -```ts -const HttpCode = t.union([ - t.literal(200), - t.literal(201), - t.literal(202) - // etc... -]) -``` +- [`Type`](Type.md) diff --git a/Schema.md b/Schema.md new file mode 100644 index 000000000..b25172325 --- /dev/null +++ b/Schema.md @@ -0,0 +1,23 @@ +`Schema` allows to define (through the `make` constructor) a generic schema once and then derive multiple concrete instances. + +**Example** + +```ts +import * as S from 'io-ts/lib/Schema' +import * as D from 'io-ts/lib/Decoder' +import * as E from 'io-ts/lib/Encoder' +import * as C from 'io-ts/lib/Codec' +import * as G from 'io-ts/lib/Guard' + +export const Person = S.make((S) => + S.type({ + name: S.string, + age: S.number + }) +) + +export const PersonDecoder = Person(D.decoder) +export const PersonEncoder = Person(E.encoder) +export const PersonCodec = Person(C.codec) +export const PersonGuard = Person(G.guard) +``` diff --git a/Type.md b/Type.md new file mode 100644 index 000000000..864012600 --- /dev/null +++ b/Type.md @@ -0,0 +1,572 @@ + + + + +- [The idea](#the-idea) +- [TypeScript integration](#typescript-integration) +- [TypeScript compatibility](#typescript-compatibility) +- [Error reporters](#error-reporters) +- [Custom error messages](#custom-error-messages) +- [Implemented types / combinators](#implemented-types--combinators) +- [Recursive types](#recursive-types) + - [Mutually recursive types](#mutually-recursive-types) +- [Branded types / Refinements](#branded-types--refinements) +- [Exact types](#exact-types) +- [Mixing required and optional props](#mixing-required-and-optional-props) +- [Custom types](#custom-types) +- [Generic Types](#generic-types) +- [Piping](#piping) +- [Community](#community) +- [Tips and Tricks](#tips-and-tricks) + - [Union of string literals](#union-of-string-literals) + + + +# The idea + +A value of type `Type` (called "codec") is the runtime representation of the static type `A`. + +A codec can: + +- decode inputs of type `I` (through `decode`) +- encode outputs of type `O` (through `encode`) +- be used as a custom [type guard](https://basarat.gitbooks.io/typescript/content/docs/types/typeGuard.html) (through `is`) + +```ts +class Type { + constructor( + /** a unique name for this codec */ + readonly name: string, + + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: Context) => Either, + + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + + /** a version of `validate` with a default context */ + decode(i: I): Either +} +``` + +The [`Either`](https://gcanti.github.io/fp-ts/modules/Either.ts.html) type returned by `decode` is defined in [fp-ts](https://github.com/gcanti/fp-ts), a library containing implementations of common algebraic types in TypeScript. + +The `Either` type represents a value of one of two possible types (a disjoint union). An instance of `Either` is either an instance of `Left` or `Right`: + +```ts +type Either = + | { + readonly _tag: 'Left' + readonly left: E + } + | { + readonly _tag: 'Right' + readonly right: A + } +``` + +Convention dictates that `Left` is used for **failure** and `Right` is used for **success**. + +**Example** + +A codec representing `string` can be defined as: + +```ts +import * as t from 'io-ts' + +const string = new t.Type( + 'string', + (input: unknown): input is string => typeof input === 'string', + // `t.success` and `t.failure` are helpers used to build `Either` instances + (input, context) => (typeof input === 'string' ? t.success(input) : t.failure(input, context)), + // `A` and `O` are the same, so `encode` is just the identity function + t.identity +) +``` + +and we can use it as follows: + +```ts +import { isRight } from 'fp-ts/lib/Either' + +isRight(string.decode('a string')) // true +isRight(string.decode(null)) // false +``` + +More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold-function) along with `pipe` (which is similar to the pipeline operator) + +```ts +import * as t from 'io-ts' +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' + +// failure handler +const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` + +// success handler +const onRight = (s: string) => `No errors: ${s}` + +pipe(t.string.decode('a string'), fold(onLeft, onRight)) +// => "No errors: a string" + +pipe(t.string.decode(null), fold(onLeft, onRight)) +// => "1 error(s) found" +``` + +We can combine these codecs through [combinators](#implemented-types--combinators) to build composite types which represent entities like domain models, request payloads etc. in our applications: + +```ts +import * as t from 'io-ts' + +const User = t.type({ + userId: t.number, + name: t.string +}) +``` + +So this is equivalent to defining something like: + +```ts +type User = { + userId: number + name: string +} +``` + +The advantage of using `io-ts` to define the runtime type is that we can validate the type at runtime, and we can also extract the corresponding static type, so we don’t have to define it twice. + +# TypeScript integration + +Codecs can be inspected: + +![instrospection](images/introspection.png) + +This library uses TypeScript extensively. Its API is defined in a way which automatically infers types for produced +values + +![inference](images/inference.png) + +Note that the type annotation isn't needed, TypeScript infers the type automatically based on a schema (and comments are preserved). + +Static types can be extracted from codecs using the `TypeOf` operator: + +```ts +type User = t.TypeOf + +// same as +type User = { + userId: number + name: string +} +``` + +# TypeScript compatibility + +The stable version is tested against TypeScript 3.5.2 + +| io-ts version | required TypeScript version | +| ------------- | --------------------------- | +| 2.x+ | 3.5.2+ | +| 1.6.x+ | 3.2.2+ | +| 1.5.3 | 3.0.1+ | +| 1.5.2- | 2.7.2+ | + +**Note**. This library is conceived, tested and is supposed to be consumed by TypeScript with the `strict` flag turned on. + +**Note**. If you are running `< typescript@3.0.1` you have to polyfill `unknown`. + +You can use [unknown-ts](https://github.com/gcanti/unknown-ts) as a polyfill. + +# Error reporters + +A reporter implements the following interface + +```ts +interface Reporter { + report: (validation: Validation) => A +} +``` + +This package exports a default `PathReporter` reporter + +Example + +```ts +import { PathReporter } from 'io-ts/lib/PathReporter' + +const result = User.decode({ name: 'Giulio' }) + +console.log(PathReporter.report(result)) +// => [ 'Invalid value undefined supplied to : { userId: number, name: string }/userId: number' ] +``` + +You can define your own reporter. `Errors` has the following type + +```ts +interface ContextEntry { + readonly key: string + readonly type: Decoder +} + +interface Context extends ReadonlyArray {} + +interface ValidationError { + readonly value: unknown + readonly context: Context +} + +interface Errors extends Array {} +``` + +Example + +```ts +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' + +const getPaths = (v: t.Validation): Array => { + return pipe( + v, + fold( + (errors) => errors.map((error) => error.context.map(({ key }) => key).join('.')), + () => ['no errors'] + ) + ) +} + +console.log(getPaths(User.decode({}))) // => [ '.userId', '.name' ] +``` + +# Custom error messages + +You can set your own error message by providing a `message` argument to `failure` + +Example + +```ts +import { either } from 'fp-ts/lib/Either' + +const NumberFromString = new t.Type( + 'NumberFromString', + t.number.is, + (u, c) => + either.chain(t.string.validate(u, c), (s) => { + const n = +s + return isNaN(n) ? t.failure(u, c, 'cannot parse to a number') : t.success(n) + }), + String +) + +console.log(PathReporter.report(NumberFromString.decode('a'))) +// => ['cannot parse to a number'] +``` + +You can also use the [`withMessage`](https://gcanti.github.io/io-ts-types/modules/withMessage.ts.html) helper from [io-ts-types](https://github.com/gcanti/io-ts-types) + +# Implemented types / combinators + +| Type | TypeScript | codec / combinator | +| --------------------------- | --------------------------- | -------------------------------------------------------------------- | +| null | `null` | `t.null` or `t.nullType` | +| undefined | `undefined` | `t.undefined` | +| void | `void` | `t.void` or `t.voidType` | +| string | `string` | `t.string` | +| number | `number` | `t.number` | +| boolean | `boolean` | `t.boolean` | +| unknown | `unknown` | `t.unknown` | +| array of unknown | `Array` | `t.UnknownArray` | +| array of type | `Array` | `t.array(A)` | +| record of unknown | `Record` | `t.UnknownRecord` | +| record of type | `Record` | `t.record(K, A)` | +| function | `Function` | `t.Function` | +| literal | `'s'` | `t.literal('s')` | +| partial | `Partial<{ name: string }>` | `t.partial({ name: t.string })` | +| readonly | `Readonly` | `t.readonly(A)` | +| readonly array | `ReadonlyArray` | `t.readonlyArray(A)` | +| type alias | `type T = { name: A }` | `t.type({ name: A })` | +| tuple | `[ A, B ]` | `t.tuple([ A, B ])` | +| union | `A \| B` | `t.union([ A, B ])` | +| intersection | `A & B` | `t.intersection([ A, B ])` | +| keyof | `keyof M` | `t.keyof(M)` (**only supports string keys**) | +| recursive types | | `t.recursion(name, definition)` | +| branded types / refinements | ✘ | `t.brand(A, predicate, brand)` | +| integer | ✘ | `t.Int` (built-in branded codec) | +| exact types | ✘ | `t.exact(type)` | +| strict | ✘ | `t.strict({ name: A })` (an alias of `t.exact(t.type({ name: A })))` | + +# Recursive types + +Recursive types can't be inferred by TypeScript so you must provide the static type as a hint + +```ts +interface Category { + name: string + categories: Array +} + +const Category: t.Type = t.recursion('Category', () => + t.type({ + name: t.string, + categories: t.array(Category) + }) +) +``` + +## Mutually recursive types + +```ts +interface Foo { + type: 'Foo' + b: Bar | undefined +} + +interface Bar { + type: 'Bar' + a: Foo | undefined +} + +const Foo: t.Type = t.recursion('Foo', () => + t.type({ + type: t.literal('Foo'), + b: t.union([Bar, t.undefined]) + }) +) + +const Bar: t.Type = t.recursion('Bar', () => + t.type({ + type: t.literal('Bar'), + a: t.union([Foo, t.undefined]) + }) +) +``` + +# Branded types / Refinements + +You can brand / refine a codec (_any_ codec) using the `brand` combinator + +```ts +// a unique brand for positive numbers +interface PositiveBrand { + readonly Positive: unique symbol // use `unique symbol` here to ensure uniqueness across modules / packages +} + +const Positive = t.brand( + t.number, // a codec representing the type to be refined + (n): n is t.Branded => n >= 0, // a custom type guard using the build-in helper `Branded` + 'Positive' // the name must match the readonly field in the brand +) + +type Positive = t.TypeOf +/* +same as +type Positive = number & t.Brand +*/ +``` + +Branded codecs can be merged with `t.intersection` + +```ts +// t.Int is a built-in branded codec +const PositiveInt = t.intersection([t.Int, Positive]) + +type PositiveInt = t.TypeOf +/* +same as +type PositiveInt = number & t.Brand & t.Brand +*/ +``` + +# Exact types + +You can make a codec exact (which means that additional properties are stripped) using the `exact` combinator + +```ts +const ExactUser = t.exact(User) + +User.decode({ userId: 1, name: 'Giulio', age: 45 }) // ok, result is right({ userId: 1, name: 'Giulio', age: 45 }) +ExactUser.decode({ userId: 1, name: 'Giulio', age: 43 }) // ok but result is right({ userId: 1, name: 'Giulio' }) +``` + +# Mixing required and optional props + +You can mix required and optional props using an intersection + +```ts +const A = t.type({ + foo: t.string +}) + +const B = t.partial({ + bar: t.number +}) + +const C = t.intersection([A, B]) + +type C = t.TypeOf + +// same as +type C = { + foo: string +} & { + bar?: number | undefined +} +``` + +You can apply `partial` to an already defined codec via its `props` field + +```ts +const PartialUser = t.partial(User.props) + +type PartialUser = t.TypeOf + +// same as +type PartialUser = { + name?: string + age?: number +} +``` + +# Custom types + +You can define your own types. Let's see an example + +```ts +import { either } from 'fp-ts/lib/Either' + +// represents a Date from an ISO string +const DateFromString = new t.Type( + 'DateFromString', + (u): u is Date => u instanceof Date, + (u, c) => + either.chain(t.string.validate(u, c), (s) => { + const d = new Date(s) + return isNaN(d.getTime()) ? t.failure(u, c) : t.success(d) + }), + (a) => a.toISOString() +) + +const s = new Date(1973, 10, 30).toISOString() + +DateFromString.decode(s) +// right(new Date('1973-11-29T23:00:00.000Z')) + +DateFromString.decode('foo') +// left(errors...) +``` + +Note that you can **deserialize** while validating. + +# Generic Types + +Polymorphic codecs are represented using functions. +For example, the following typescript: + +```ts +interface ResponseBody { + result: T + _links: Links +} + +interface Links { + previous: string + next: string +} +``` + +Would be: + +```ts +// where `t.Mixed = t.Type` +const responseBody = (codec: C) => + t.type({ + result: codec, + _links: Links + }) + +const Links = t.type({ + previous: t.string, + next: t.string +}) +``` + +And used like: + +```ts +const UserModel = t.type({ + name: t.string +}) + +functionThatRequiresRuntimeType(responseBody(t.array(UserModel)), ...params) +``` + +# Piping + +You can pipe two codecs if their type parameters do align + +```ts +const NumberCodec = new t.Type( + 'NumberCodec', + t.number.is, + (s, c) => { + const n = parseFloat(s) + return isNaN(n) ? t.failure(s, c) : t.success(n) + }, + String +) + +const NumberFromString = t.string.pipe(NumberCodec, 'NumberFromString') +``` + +# Community + +- `io-ts@2.x` + - [io-ts-types](https://github.com/gcanti/io-ts-types) - A collection of codecs and combinators for use with + io-ts + - [io-ts-reporters](https://github.com/OliverJAsh/io-ts-reporters) - Error reporters for io-ts + - [io-ts-promise](https://github.com/aeirola/io-ts-promise) - Convenience library for using io-ts with promise-based APIs +- `io-ts@1.x` + - [geojson-iots](https://github.com/pierremarc/geojson-iots) - codecs for GeoJSON as defined in rfc7946 made with + io-ts + - [graphql-to-io-ts](https://github.com/micimize/graphql-to-io-ts) - Generate typescript and corresponding io-ts types from a graphql schema + +# Tips and Tricks + +## Union of string literals + +Use `keyof` instead of `union` when defining a union of string literals + +```ts +const Bad = t.union([ + t.literal('foo'), + t.literal('bar'), + t.literal('baz') + // etc... +]) + +const Good = t.keyof({ + foo: null, + bar: null, + baz: null + // etc... +}) +``` + +Benefits + +- unique check for free +- better performance, `O(log(n))` vs `O(n)` + +Beware that `keyof` is designed to work with objects containing string keys. If you intend to define a numbers enumeration, you have to use an `union` of number literals : + +```ts +const HttpCode = t.union([ + t.literal(200), + t.literal(201), + t.literal(202) + // etc... +]) +``` diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md new file mode 100644 index 000000000..64571bfce --- /dev/null +++ b/docs/modules/Codec.ts.md @@ -0,0 +1,274 @@ +--- +title: Codec.ts +nav_order: 1 +parent: Modules +--- + +# Codec overview + +Added in v2.2.0 + +--- + +

Table of contents

+ +- [Codec (interface)](#codec-interface) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [UnknownArray](#unknownarray) +- [UnknownRecord](#unknownrecord) +- [array](#array) +- [boolean](#boolean) +- [codec](#codec) +- [intersection](#intersection) +- [lazy](#lazy) +- [literal](#literal) +- [make](#make) +- [nullable](#nullable) +- [number](#number) +- [partial](#partial) +- [record](#record) +- [refinement](#refinement) +- [string](#string) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) +- [withExpected](#withexpected) + +--- + +# Codec (interface) + +Laws: + +1. `pipe(codec.decode(u), E.fold(() => u, codec.encode) = u` for all `u` in `unknown` +2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` + +**Signature** + +```ts +export interface Codec
extends D.Decoder, E.Encoder {} +``` + +Added in v2.2.0 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.0 + +# URI + +**Signature** + +```ts +export declare const URI: 'Codec' +``` + +Added in v2.2.0 + +# UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: Codec +``` + +Added in v2.2.0 + +# UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: Codec> +``` + +Added in v2.2.0 + +# array + +**Signature** + +```ts +export declare function array(items: Codec): Codec> +``` + +Added in v2.2.0 + +# boolean + +**Signature** + +```ts +export declare const boolean: Codec +``` + +Added in v2.2.0 + +# codec + +**Signature** + +```ts +export declare const codec: Invariant1<'Codec'> & Schemable<'Codec'> +``` + +Added in v2.2.0 + +# intersection + +**Signature** + +```ts +export declare function intersection(left: Codec, right: Codec): Codec +``` + +Added in v2.2.0 + +# lazy + +**Signature** + +```ts +export declare function lazy(id: string, f: () => Codec): Codec +``` + +Added in v2.2.0 + +# literal + +**Signature** + +```ts +export declare function literal>(...values: A): Codec +``` + +Added in v2.2.0 + +# make + +**Signature** + +```ts +export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec +``` + +Added in v2.2.0 + +# nullable + +**Signature** + +```ts +export declare function nullable(or: Codec): Codec +``` + +Added in v2.2.0 + +# number + +**Signature** + +```ts +export declare const number: Codec +``` + +Added in v2.2.0 + +# partial + +**Signature** + +```ts +export declare function partial(properties: { [K in keyof A]: Codec }): Codec> +``` + +Added in v2.2.0 + +# record + +**Signature** + +```ts +export declare function record(codomain: Codec): Codec> +``` + +Added in v2.2.0 + +# refinement + +**Signature** + +```ts +export declare function refinement( + from: Codec, + refinement: (a: A) => a is B, + expected: string +): Codec +``` + +Added in v2.2.0 + +# string + +**Signature** + +```ts +export declare const string: Codec +``` + +Added in v2.2.0 + +# sum + +**Signature** + +```ts +export declare function sum( + tag: T +): (members: { [K in keyof A]: Codec> }) => Codec +``` + +Added in v2.2.0 + +# tuple + +**Signature** + +```ts +export declare function tuple>( + ...components: { [K in keyof A]: Codec } +): Codec +``` + +Added in v2.2.0 + +# type + +**Signature** + +```ts +export declare function type(properties: { [K in keyof A]: Codec }): Codec +``` + +Added in v2.2.0 + +# withExpected + +**Signature** + +```ts +export declare function withExpected( + codec: Codec, + expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> +): Codec +``` + +Added in v2.2.0 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md new file mode 100644 index 000000000..1dcacbc83 --- /dev/null +++ b/docs/modules/Decoder.ts.md @@ -0,0 +1,422 @@ +--- +title: Decoder.ts +nav_order: 2 +parent: Modules +--- + +# Decoder overview + +Added in v2.2.0 + +--- + +

Table of contents

+ +- [Decoder (interface)](#decoder-interface) +- [TypeOf (type alias)](#typeof-type-alias) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [UnknownArray](#unknownarray) +- [UnknownRecord](#unknownrecord) +- [alt](#alt) +- [ap](#ap) +- [apFirst](#apfirst) +- [apSecond](#apsecond) +- [array](#array) +- [boolean](#boolean) +- [decoder](#decoder) +- [failure](#failure) +- [failures](#failures) +- [fromGuard](#fromguard) +- [intersection](#intersection) +- [lazy](#lazy) +- [literal](#literal) +- [map](#map) +- [never](#never) +- [nullable](#nullable) +- [number](#number) +- [parse](#parse) +- [partial](#partial) +- [record](#record) +- [refinement](#refinement) +- [string](#string) +- [success](#success) +- [sum](#sum) +- [tree](#tree) +- [tuple](#tuple) +- [type](#type) +- [union](#union) +- [withExpected](#withexpected) + +--- + +# Decoder (interface) + +**Signature** + +```ts +export interface Decoder
{ + readonly decode: (u: unknown) => Either>, A> +} +``` + +Added in v2.2.0 + +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = D extends Decoder ? A : never +``` + +Added in v2.2.0 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.0 + +# URI + +**Signature** + +```ts +export declare const URI: 'Decoder' +``` + +Added in v2.2.0 + +# UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: Decoder +``` + +Added in v2.2.0 + +# UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: Decoder> +``` + +Added in v2.2.0 + +# alt + +**Signature** + +```ts +export declare const alt: (that: () => Decoder) => (fa: Decoder) => Decoder +``` + +Added in v2.2.0 + +# ap + +**Signature** + +```ts +export declare const ap: (fa: Decoder) => (fab: Decoder<(a: A) => B>) => Decoder +``` + +Added in v2.2.0 + +# apFirst + +**Signature** + +```ts +export declare const apFirst: (fb: Decoder) => (fa: Decoder) => Decoder +``` + +Added in v2.2.0 + +# apSecond + +**Signature** + +```ts +export declare const apSecond: (fb: Decoder) => (fa: Decoder) => Decoder +``` + +Added in v2.2.0 + +# array + +**Signature** + +```ts +export declare function array(items: Decoder): Decoder> +``` + +Added in v2.2.0 + +# boolean + +**Signature** + +```ts +export declare const boolean: Decoder +``` + +Added in v2.2.0 + +# decoder + +**Signature** + +```ts +export declare const decoder: Applicative1<'Decoder'> & + Alternative1<'Decoder'> & + Schemable<'Decoder'> & + WithUnion<'Decoder'> +``` + +Added in v2.2.0 + +# failure + +**Signature** + +```ts +export declare function failure(message: string): Either>, A> +``` + +Added in v2.2.0 + +# failures + +**Signature** + +```ts +export declare function failures( + message: string, + errors: NonEmptyArray> +): Either>, A> +``` + +Added in v2.2.0 + +# fromGuard + +**Signature** + +```ts +export declare function fromGuard(guard: G.Guard, expected: string): Decoder +``` + +Added in v2.2.0 + +# intersection + +**Signature** + +```ts +export declare function intersection(left: Decoder, right: Decoder): Decoder +``` + +Added in v2.2.0 + +# lazy + +**Signature** + +```ts +export declare function lazy(id: string, f: () => Decoder): Decoder +``` + +Added in v2.2.0 + +# literal + +**Signature** + +```ts +export declare function literal>(...values: A): Decoder +``` + +Added in v2.2.0 + +# map + +**Signature** + +```ts +export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder +``` + +Added in v2.2.0 + +# never + +**Signature** + +```ts +export declare const never: Decoder +``` + +Added in v2.2.0 + +# nullable + +**Signature** + +```ts +export declare function nullable(or: Decoder): Decoder +``` + +Added in v2.2.0 + +# number + +**Signature** + +```ts +export declare const number: Decoder +``` + +Added in v2.2.0 + +# parse + +**Signature** + +```ts +export declare function parse(from: Decoder, parser: (a: A) => Either): Decoder +``` + +Added in v2.2.0 + +# partial + +**Signature** + +```ts +export declare function partial(properties: { [K in keyof A]: Decoder }): Decoder> +``` + +Added in v2.2.0 + +# record + +**Signature** + +```ts +export declare function record(codomain: Decoder): Decoder> +``` + +Added in v2.2.0 + +# refinement + +**Signature** + +```ts +export declare function refinement( + from: Decoder, + refinement: (a: A) => a is B, + expected: string +): Decoder +``` + +Added in v2.2.0 + +# string + +**Signature** + +```ts +export declare const string: Decoder +``` + +Added in v2.2.0 + +# success + +**Signature** + +```ts +export declare function success(a: A): Either>, A> +``` + +Added in v2.2.0 + +# sum + +**Signature** + +```ts +export declare function sum( + tag: T +): (members: { [K in keyof A]: Decoder> }) => Decoder +``` + +Added in v2.2.0 + +# tree + +**Signature** + +```ts +export declare function tree(value: A, forest: Forest = empty): Tree +``` + +Added in v2.2.0 + +# tuple + +**Signature** + +```ts +export declare function tuple>( + ...components: { [K in keyof A]: Decoder } +): Decoder +``` + +Added in v2.2.0 + +# type + +**Signature** + +```ts +export declare function type(properties: { [K in keyof A]: Decoder }): Decoder +``` + +Added in v2.2.0 + +# union + +**Signature** + +```ts +export declare function union>( + ...members: { [K in keyof A]: Decoder } +): Decoder +``` + +Added in v2.2.0 + +# withExpected + +**Signature** + +```ts +export declare function withExpected( + decoder: Decoder, + expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> +): Decoder +``` + +Added in v2.2.0 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md new file mode 100644 index 000000000..7450dd611 --- /dev/null +++ b/docs/modules/Encoder.ts.md @@ -0,0 +1,187 @@ +--- +title: Encoder.ts +nav_order: 3 +parent: Modules +--- + +# Encoder overview + +Added in v2.2.0 + +--- + +

Table of contents

+ +- [Encoder (interface)](#encoder-interface) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [array](#array) +- [contramap](#contramap) +- [encoder](#encoder) +- [id](#id) +- [intersection](#intersection) +- [lazy](#lazy) +- [nullable](#nullable) +- [partial](#partial) +- [record](#record) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) + +--- + +# Encoder (interface) + +**Signature** + +```ts +export interface Encoder
{ + readonly encode: (a: A) => unknown +} +``` + +Added in v2.2.0 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.0 + +# URI + +**Signature** + +```ts +export declare const URI: 'Encoder' +``` + +Added in v2.2.0 + +# array + +**Signature** + +```ts +export declare function array(items: Encoder): Encoder> +``` + +Added in v2.2.0 + +# contramap + +**Signature** + +```ts +export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder +``` + +Added in v2.2.0 + +# encoder + +**Signature** + +```ts +export declare const encoder: Contravariant1<'Encoder'> & Schemable<'Encoder'> +``` + +Added in v2.2.0 + +# id + +**Signature** + +```ts +export declare const id: Encoder +``` + +Added in v2.2.0 + +# intersection + +**Signature** + +```ts +export declare function intersection(left: Encoder, right: Encoder): Encoder +``` + +Added in v2.2.0 + +# lazy + +**Signature** + +```ts +export declare function lazy(f: () => Encoder): Encoder +``` + +Added in v2.2.0 + +# nullable + +**Signature** + +```ts +export declare function nullable(or: Encoder): Encoder +``` + +Added in v2.2.0 + +# partial + +**Signature** + +```ts +export declare function partial(properties: { [K in keyof A]: Encoder }): Encoder> +``` + +Added in v2.2.0 + +# record + +**Signature** + +```ts +export declare function record(codomain: Encoder): Encoder> +``` + +Added in v2.2.0 + +# sum + +**Signature** + +```ts +export declare function sum( + tag: T +): (members: { [K in keyof A]: Encoder> }) => Encoder +``` + +Added in v2.2.0 + +# tuple + +**Signature** + +```ts +export declare function tuple>( + ...components: { [K in keyof A]: Encoder } +): Encoder +``` + +Added in v2.2.0 + +# type + +**Signature** + +```ts +export declare function type(properties: { [K in keyof A]: Encoder }): Encoder +``` + +Added in v2.2.0 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md new file mode 100644 index 000000000..4bd61f1f4 --- /dev/null +++ b/docs/modules/Guard.ts.md @@ -0,0 +1,266 @@ +--- +title: Guard.ts +nav_order: 4 +parent: Modules +--- + +# Guard overview + +Added in v2.2.0 + +--- + +

Table of contents

+ +- [Guard (interface)](#guard-interface) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [UnknownArray](#unknownarray) +- [UnknownRecord](#unknownrecord) +- [array](#array) +- [boolean](#boolean) +- [guard](#guard) +- [intersection](#intersection) +- [lazy](#lazy) +- [literal](#literal) +- [never](#never) +- [nullable](#nullable) +- [number](#number) +- [partial](#partial) +- [record](#record) +- [refinement](#refinement) +- [string](#string) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) +- [union](#union) + +--- + +# Guard (interface) + +**Signature** + +```ts +export interface Guard
{ + is: (u: unknown) => u is A +} +``` + +Added in v2.2.0 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.0 + +# URI + +**Signature** + +```ts +export declare const URI: 'Guard' +``` + +Added in v2.2.0 + +# UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: Guard +``` + +Added in v2.2.0 + +# UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: Guard> +``` + +Added in v2.2.0 + +# array + +**Signature** + +```ts +export declare function array(items: Guard): Guard> +``` + +Added in v2.2.0 + +# boolean + +**Signature** + +```ts +export declare const boolean: Guard +``` + +Added in v2.2.0 + +# guard + +**Signature** + +```ts +export declare const guard: Schemable<'Guard'> & WithUnion<'Guard'> +``` + +Added in v2.2.0 + +# intersection + +**Signature** + +```ts +export declare function intersection(left: Guard, right: Guard): Guard +``` + +Added in v2.2.0 + +# lazy + +**Signature** + +```ts +export declare function lazy(f: () => Guard): Guard +``` + +Added in v2.2.0 + +# literal + +**Signature** + +```ts +export declare function literal>(...values: A): Guard +``` + +Added in v2.2.0 + +# never + +**Signature** + +```ts +export declare const never: Guard +``` + +Added in v2.2.0 + +# nullable + +**Signature** + +```ts +export declare function nullable(or: Guard): Guard +``` + +Added in v2.2.0 + +# number + +**Signature** + +```ts +export declare const number: Guard +``` + +Added in v2.2.0 + +# partial + +**Signature** + +```ts +export declare function partial(properties: { [K in keyof A]: Guard }): Guard> +``` + +Added in v2.2.0 + +# record + +**Signature** + +```ts +export declare function record(codomain: Guard): Guard> +``` + +Added in v2.2.0 + +# refinement + +**Signature** + +```ts +export declare function refinement(from: Guard, refinement: (a: A) => a is B): Guard +``` + +Added in v2.2.0 + +# string + +**Signature** + +```ts +export declare const string: Guard +``` + +Added in v2.2.0 + +# sum + +**Signature** + +```ts +export declare function sum( + tag: T +): (members: { [K in keyof A]: Guard> }) => Guard +``` + +Added in v2.2.0 + +# tuple + +**Signature** + +```ts +export declare function tuple>( + ...components: { [K in keyof A]: Guard } +): Guard +``` + +Added in v2.2.0 + +# type + +**Signature** + +```ts +export declare function type(properties: { [K in keyof A]: Guard }): Guard +``` + +Added in v2.2.0 + +# union + +**Signature** + +```ts +export declare function union>( + ...members: { [K in keyof A]: Guard } +): Guard +``` + +Added in v2.2.0 diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index f7ac7398c..4116f4410 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 2 +nav_order: 6 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 152c946ea..a76c04874 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 3 +nav_order: 7 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md new file mode 100644 index 000000000..6500e9c89 --- /dev/null +++ b/docs/modules/Schema.ts.md @@ -0,0 +1,51 @@ +--- +title: Schema.ts +nav_order: 8 +parent: Modules +--- + +# Schema overview + +Added in v2.2.0 + +--- + +

Table of contents

+ +- [Schema (interface)](#schema-interface) +- [TypeOf (type alias)](#typeof-type-alias) +- [make](#make) + +--- + +# Schema (interface) + +**Signature** + +```ts +export interface Schema
{ + (S: Schemable): Kind +} +``` + +Added in v2.2.0 + +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = S extends Schema ? A : never +``` + +Added in v2.2.0 + +# make + +**Signature** + +```ts +export declare function make(f: Schema): Schema +``` + +Added in v2.2.0 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md new file mode 100644 index 000000000..2c38c3deb --- /dev/null +++ b/docs/modules/Schemable.ts.md @@ -0,0 +1,83 @@ +--- +title: Schemable.ts +nav_order: 9 +parent: Modules +--- + +# Schemable overview + +Added in v2.2.0 + +--- + +

Table of contents

+ +- [Schemable (interface)](#schemable-interface) +- [WithUnion (interface)](#withunion-interface) +- [Literal (type alias)](#literal-type-alias) +- [memoize](#memoize) + +--- + +# Schemable (interface) + +**Signature** + +```ts +export interface Schemable { + readonly URI: S + readonly literal:
>(...values: A) => Kind + readonly string: Kind + readonly number: Kind + readonly boolean: Kind + readonly UnknownArray: Kind> + readonly UnknownRecord: Kind> + readonly nullable: (or: Kind) => Kind + readonly type: (properties: { [K in keyof A]: Kind }) => Kind + readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> + readonly record: (codomain: Kind) => Kind> + readonly array: (items: Kind) => Kind> + readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind + readonly intersection: (left: Kind, right: Kind) => Kind + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: Kind> }) => Kind + readonly lazy: (id: string, f: () => Kind) => Kind +} +``` + +Added in v2.2.0 + +# WithUnion (interface) + +**Signature** + +```ts +export interface WithUnion { + readonly union: >( + ...members: { [K in keyof A]: Kind } + ) => Kind +} +``` + +Added in v2.2.0 + +# Literal (type alias) + +**Signature** + +```ts +export type Literal = string | number | boolean | null +``` + +Added in v2.2.0 + +# memoize + +**Signature** + +```ts +export declare function memoize(f: (a: A) => B): (a: A) => B +``` + +Added in v2.2.0 diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md new file mode 100644 index 000000000..488a86be2 --- /dev/null +++ b/docs/modules/Tree.ts.md @@ -0,0 +1,27 @@ +--- +title: Tree.ts +nav_order: 10 +parent: Modules +--- + +# Tree overview + +Added in v2.2.0 + +--- + +

Table of contents

+ +- [draw](#draw) + +--- + +# draw + +**Signature** + +```ts +export declare function draw(es: NonEmptyArray>): string +``` + +Added in v2.2.0 diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index d1dbde41f..3bcd78e48 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 1 +nav_order: 5 parent: Modules --- diff --git a/dtslint/ts3.5/Schemable.ts b/dtslint/ts3.5/Schemable.ts new file mode 100644 index 000000000..d7578e41c --- /dev/null +++ b/dtslint/ts3.5/Schemable.ts @@ -0,0 +1,113 @@ +import * as D from '../../src/Decoder' +import { make, Schema } from '../../src/Schema' + +// +// literal +// +make((S) => S.literal('a')) // $ExpectType Schema<"a"> + +// +// string +// +make((S) => S.string) // $ExpectType Schema + +// +// number +// +make((S) => S.number) // $ExpectType Schema + +// +// boolean +// +make((S) => S.boolean) // $ExpectType Schema + +// +// UnknownArray +// +make((S) => S.UnknownArray) // $ExpectType Schema + +// +// UnknownRecord +// +make((S) => S.UnknownRecord) // $ExpectType Schema> + +// +// nullable +// +make((S) => S.nullable(S.string)) // $ExpectType Schema + +// +// type +// +make((S) => S.type({ a: S.string })) // $ExpectType Schema<{ a: string; }> + +// +// partial +// +make((S) => S.partial({ a: S.string })) // $ExpectType Schema> + +// +// record +// +make((S) => S.record(S.number)) // $ExpectType Schema> + +// +// array +// +make((S) => S.array(S.number)) // $ExpectType Schema + +// +// tuple +// +make((S) => S.tuple()) // $ExpectType Schema<[]> +make((S) => S.tuple(S.string)) // $ExpectType Schema<[string]> +make((S) => S.tuple(S.string, S.number)) // $ExpectType Schema<[string, number]> +make((S) => S.tuple(S.string, S.number, S.boolean)) // $ExpectType Schema<[string, number, boolean]> + +// +// intersection +// +make((S) => S.intersection(S.type({ a: S.string }), S.type({ b: S.number }))) // $ExpectType Schema<{ a: string; } & { b: number; }> + +// +// sum +// +const S1 = make((S) => S.type({ _tag: S.literal('A'), a: S.string })) +const S2 = make((S) => S.type({ _tag: S.literal('B'), b: S.number })) + +// $ExpectType Schema<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }> +make((S) => S.sum('_tag')({ A: S1(S), B: S2(S) })) + +// +// lazy +// +interface A { + a: string + bs: Array +} +interface B { + b: number + as: Array
+} +const A: Schema = make((S) => + S.lazy('A', () => + S.type({ + a: S.string, + bs: S.array(B(S)) + }) + ) +) +const B: Schema = make((S) => + S.lazy('B', () => + S.type({ + b: S.number, + as: S.array(A(S)) + }) + ) +) + +// +// union +// +D.union(D.string) // $ExpectType Decoder +D.union(D.string, D.number) // $ExpectType Decoder diff --git a/package.json b/package.json index 36c5d24cb..cd6aea181 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "dtslint": "dtslint dtslint", "declaration": "tsc -p declaration/tsconfig.json", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", - "doctoc": "doctoc README.md", + "doctoc": "doctoc README.md Type.md Decoder.md Encoder.md Codec.md", "docs": "docs-ts", "import-path-rewrite": "import-path-rewrite" }, diff --git a/src/Codec.ts b/src/Codec.ts new file mode 100644 index 000000000..61afdc388 --- /dev/null +++ b/src/Codec.ts @@ -0,0 +1,204 @@ +/** + * @since 2.2.0 + */ +import { Invariant1 } from 'fp-ts/lib/Invariant' +import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' +import { Tree } from 'fp-ts/lib/Tree' +import * as D from './Decoder' +import * as E from './Encoder' +import { Schemable, Literal } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * Laws: + * + * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode) = u` for all `u` in `unknown` + * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` + * + * @since 2.2.0 + */ +export interface Codec extends D.Decoder, E.Encoder {} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { + return { + decode: decoder.decode, + encode: encoder.encode + } +} + +/** + * @since 2.2.0 + */ +export function literal>(...values: A): Codec { + return make(D.decoder.literal(...values), E.encoder.literal(...values)) +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const string: Codec = make(D.decoder.string, E.encoder.string) + +/** + * @since 2.2.0 + */ +export const number: Codec = make(D.decoder.number, E.encoder.number) + +/** + * @since 2.2.0 + */ +export const boolean: Codec = make(D.decoder.boolean, E.encoder.boolean) + +/** + * @since 2.2.0 + */ +export const UnknownArray: Codec> = make(D.decoder.UnknownArray, E.encoder.UnknownArray) + +/** + * @since 2.2.0 + */ +export const UnknownRecord: Codec> = make(D.decoder.UnknownRecord, E.encoder.UnknownRecord) + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export function withExpected( + codec: Codec, + expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> +): Codec { + return make(D.withExpected(codec, expected), codec) +} + +/** + * @since 2.2.0 + */ +export function refinement(from: Codec, refinement: (a: A) => a is B, expected: string): Codec { + return make(D.refinement(from, refinement, expected), from) +} + +/** + * @since 2.2.0 + */ +export function nullable(or: Codec): Codec { + return make(D.decoder.nullable(or), E.encoder.nullable(or)) +} + +/** + * @since 2.2.0 + */ +export function type(properties: { [K in keyof A]: Codec }): Codec { + return make(D.decoder.type(properties), E.encoder.type(properties)) +} + +/** + * @since 2.2.0 + */ +export function partial(properties: { [K in keyof A]: Codec }): Codec> { + return make(D.decoder.partial(properties), E.encoder.partial(properties)) +} + +/** + * @since 2.2.0 + */ +export function record(codomain: Codec): Codec> { + return make(D.decoder.record(codomain), E.encoder.record(codomain)) +} + +/** + * @since 2.2.0 + */ +export function array(items: Codec): Codec> { + return make(D.decoder.array(items), E.encoder.array(items)) +} + +/** + * @since 2.2.0 + */ +export function tuple>(...components: { [K in keyof A]: Codec }): Codec { + return make(D.decoder.tuple(...(components as any)), E.encoder.tuple(...(components as any))) +} + +/** + * @since 2.2.0 + */ +export function intersection(left: Codec, right: Codec): Codec { + return make(D.decoder.intersection(left, right), E.encoder.intersection(left, right)) +} + +/** + * @since 2.2.0 + */ +export function sum( + tag: T +): (members: { [K in keyof A]: Codec> }) => Codec { + const sumD = D.decoder.sum(tag) + const sumE = E.encoder.sum(tag) + return (members) => make(sumD(members), sumE(members)) +} + +/** + * @since 2.2.0 + */ +export function lazy(id: string, f: () => Codec): Codec { + return make(D.decoder.lazy(id, f), E.encoder.lazy(id, f)) +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const URI = 'Codec' + +/** + * @since 2.2.0 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly Codec: Codec + } +} + +/** + * @since 2.2.0 + */ +export const codec: Invariant1 & Schemable = { + URI, + imap: (fa, f, g) => make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)), + literal, + string, + number, + boolean, + UnknownArray, + UnknownRecord, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable['tuple'], + intersection, + sum, + lazy +} diff --git a/src/Decoder.ts b/src/Decoder.ts new file mode 100644 index 000000000..99ef84c77 --- /dev/null +++ b/src/Decoder.ts @@ -0,0 +1,519 @@ +/** + * @since 2.2.0 + */ +import { Alternative1 } from 'fp-ts/lib/Alternative' +import { Applicative1 } from 'fp-ts/lib/Applicative' +import { Either, either, isLeft, isRight, left, mapLeft, right } from 'fp-ts/lib/Either' +import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' +import { pipe, pipeable } from 'fp-ts/lib/pipeable' +import { Tree, Forest } from 'fp-ts/lib/Tree' +import * as G from './Guard' +import { Schemable, memoize, WithUnion, Literal } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export interface Decoder { + readonly decode: (u: unknown) => Either>, A> +} + +/** + * @since 2.2.0 + */ +export type TypeOf = D extends Decoder ? A : never + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +const empty: Array = [] + +/** + * @since 2.2.0 + */ +export function tree(value: A, forest: Forest = empty): Tree { + return { + value, + forest + } +} + +/** + * @since 2.2.0 + */ +export function success(a: A): Either>, A> { + return right(a) +} + +/** + * @since 2.2.0 + */ +export function failure(message: string): Either>, A> { + return left([tree(message)]) +} + +/** + * @since 2.2.0 + */ +export function failures( + message: string, + errors: NonEmptyArray> +): Either>, A> { + return left([tree(message, errors)]) +} + +/** + * @since 2.2.0 + */ +export function fromGuard(guard: G.Guard, expected: string): Decoder { + return { + decode: (u) => (guard.is(u) ? success(u) : failure(`cannot decode ${JSON.stringify(u)}, should be ${expected}`)) + } +} + +/** + * @since 2.2.0 + */ +export function literal>(...values: A): Decoder { + if (values.length === 0) { + return never + } + const expected = values.map((value) => JSON.stringify(value)).join(' | ') + return fromGuard(G.guard.literal(...values), expected) +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const never: Decoder = fromGuard(G.never, 'never') + +/** + * @since 2.2.0 + */ +export const string: Decoder = fromGuard(G.string, 'string') + +/** + * @since 2.2.0 + */ +export const number: Decoder = fromGuard(G.number, 'number') + +/** + * @since 2.2.0 + */ +export const boolean: Decoder = fromGuard(G.boolean, 'boolean') + +/** + * @since 2.2.0 + */ +export const UnknownArray: Decoder> = fromGuard(G.UnknownArray, 'Array') + +/** + * @since 2.2.0 + */ +export const UnknownRecord: Decoder> = fromGuard(G.UnknownRecord, 'Record') + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export function withExpected( + decoder: Decoder, + expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> +): Decoder { + return { + decode: (u) => + pipe( + decoder.decode(u), + mapLeft((nea) => expected(u, nea)) + ) + } +} + +/** + * @since 2.2.0 + */ +export function refinement( + from: Decoder, + refinement: (a: A) => a is B, + expected: string +): Decoder { + return { + decode: (u) => { + const e = from.decode(u) + if (isLeft(e)) { + return e + } + const a = e.right + return refinement(a) ? success(a) : failure(`cannot refine ${JSON.stringify(u)}, should be ${expected}`) + } + } +} + +/** + * @since 2.2.0 + */ +export function parse(from: Decoder, parser: (a: A) => Either): Decoder { + return { + decode: (u) => { + const e = from.decode(u) + if (isLeft(e)) { + return e + } + const pe = parser(e.right) + if (isLeft(pe)) { + return failure(pe.left) + } + return pe + } + } +} + +/** + * @since 2.2.0 + */ +export function nullable(or: Decoder): Decoder { + return union(literal(null), or) +} + +/** + * @since 2.2.0 + */ +export function type(properties: { [K in keyof A]: Decoder }): Decoder { + return { + decode: (u) => { + const e = UnknownRecord.decode(u) + if (isLeft(e)) { + return e + } else { + const r = e.right + let a: Partial = {} + for (const k in properties) { + const e = properties[k].decode(r[k]) + if (isLeft(e)) { + return failures(`required property ${JSON.stringify(k)}`, e.left) + } else { + a[k] = e.right + } + } + return success(a as A) + } + } + } +} + +/** + * @since 2.2.0 + */ +export function partial(properties: { [K in keyof A]: Decoder }): Decoder> { + return { + decode: (u) => { + const e = UnknownRecord.decode(u) + if (isLeft(e)) { + return e + } else { + const r = e.right + let a: Partial = {} + for (const k in properties) { + // don't add missing properties + if (k in r) { + const rk = r[k] + // don't strip undefined properties + if (rk === undefined) { + a[k] = undefined + } else { + const e = properties[k].decode(rk) + if (isLeft(e)) { + return failures(`optional property ${JSON.stringify(k)}`, e.left) + } else { + a[k] = e.right + } + } + } + } + return success(a) + } + } + } +} + +/** + * @since 2.2.0 + */ +export function record(codomain: Decoder): Decoder> { + return { + decode: (u) => { + const e = UnknownRecord.decode(u) + if (isLeft(e)) { + return e + } else { + const r = e.right + let a: Record = {} + for (const k in r) { + const e = codomain.decode(r[k]) + if (isLeft(e)) { + return failures(`key ${JSON.stringify(k)}`, e.left) + } else { + a[k] = e.right + } + } + return success(a) + } + } + } +} + +/** + * @since 2.2.0 + */ +export function array(items: Decoder): Decoder> { + return { + decode: (u) => { + const e = UnknownArray.decode(u) + if (isLeft(e)) { + return e + } else { + const us = e.right + const len = us.length + const a: Array = new Array(len) + for (let i = 0; i < len; i++) { + const e = items.decode(us[i]) + if (isLeft(e)) { + return failures(`item ${i}`, e.left) + } else { + a[i] = e.right + } + } + return success(a) + } + } + } +} + +/** + * @since 2.2.0 + */ +export function tuple>(...components: { [K in keyof A]: Decoder }): Decoder { + return { + decode: (u) => { + const e = UnknownArray.decode(u) + if (isLeft(e)) { + return e + } + const us = e.right + const a: Array = [] + for (let i = 0; i < components.length; i++) { + const e = components[i].decode(us[i]) + if (isLeft(e)) { + return failures(`component ${i}`, e.left) + } else { + a.push(e.right) + } + } + return success(a as any) + } + } +} + +function typeOf(x: unknown): string { + return x === null ? 'null' : typeof x +} + +/** + * @internal + */ +export function intersect(a: A, b: B): A & B { + if (a !== undefined && b !== undefined) { + const tx = typeOf(a) + const ty = typeOf(b) + if (tx === 'object' || ty === 'object') { + return Object.assign({}, a, b) + } + } + return b as any +} + +/** + * @since 2.2.0 + */ +export function intersection(left: Decoder, right: Decoder): Decoder { + return { + decode: (u) => { + const ea = left.decode(u) + if (isLeft(ea)) { + return ea + } + const eb = right.decode(u) + if (isLeft(eb)) { + return eb + } + return success(intersect(ea.right, eb.right)) + } + } +} + +/** + * @since 2.2.0 + */ +export function lazy(id: string, f: () => Decoder): Decoder { + const get = memoize>(f) + return { + decode: (u) => + pipe( + get().decode(u), + mapLeft((nea) => [tree(id, nea)]) + ) + } +} + +/** + * @since 2.2.0 + */ +export function sum( + tag: T +): (members: { [K in keyof A]: Decoder> }) => Decoder { + return (members) => { + const keys = Object.keys(members) + if (keys.length === 0) { + return never + } + const expected = keys.map((k) => JSON.stringify(k)).join(' | ') + return { + decode: (u) => { + const e = UnknownRecord.decode(u) + if (isLeft(e)) { + return e + } + const v = e.right[tag] + if (G.string.is(v) && v in members) { + return (members as any)[v].decode(u) + } + return failures(`required property ${JSON.stringify(tag)}`, [ + tree(`cannot decode ${JSON.stringify(v)}, should be ${expected}`) + ]) + } + } + } +} + +/** + * @since 2.2.0 + */ +export function union>( + ...members: { [K in keyof A]: Decoder } +): Decoder { + const len = members.length + if (len === 0) { + return never + } + return { + decode: (u) => { + const e = members[0].decode(u) + if (isRight(e)) { + return e + } else { + const forest: NonEmptyArray> = [tree(`member 0`, e.left)] + for (let i = 1; i < len; i++) { + const e = members[i].decode(u) + if (isRight(e)) { + return e + } else { + forest.push(tree(`member ${i}`, e.left)) + } + } + return left(forest) + } + } + } +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const URI = 'Decoder' + +/** + * @since 2.2.0 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly Decoder: Decoder + } +} + +/** + * @since 2.2.0 + */ +export const decoder: Applicative1 & Alternative1 & Schemable & WithUnion = { + URI, + map: (fa, f) => ({ + decode: (u) => either.map(fa.decode(u), f) + }), + of: (a) => ({ + decode: () => success(a) + }), + ap: (fab, fa) => ({ + decode: (u) => either.ap(fab.decode(u), fa.decode(u)) + }), + alt: (fx, fy) => ({ + decode: (u) => either.alt(fx.decode(u), () => fy().decode(u)) + }), + zero: () => never, + literal, + string, + number, + boolean, + UnknownArray, + UnknownRecord, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable['tuple'], + intersection, + sum, + lazy, + union +} + +const { alt, ap, apFirst, apSecond, map } = pipeable(decoder) + +export { + /** + * @since 2.2.0 + */ + alt, + /** + * @since 2.2.0 + */ + ap, + /** + * @since 2.2.0 + */ + apFirst, + /** + * @since 2.2.0 + */ + apSecond, + /** + * @since 2.2.0 + */ + map +} diff --git a/src/Encoder.ts b/src/Encoder.ts new file mode 100644 index 000000000..907d292ad --- /dev/null +++ b/src/Encoder.ts @@ -0,0 +1,197 @@ +/** + * @since 2.2.0 + */ +import { Contravariant1 } from 'fp-ts/lib/Contravariant' +import { identity } from 'fp-ts/lib/function' +import { pipeable } from 'fp-ts/lib/pipeable' +import { Schemable, memoize } from './Schemable' +import { intersect } from './Decoder' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export interface Encoder { + readonly encode: (a: A) => unknown +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const id: Encoder = { + encode: identity +} + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export function nullable(or: Encoder): Encoder { + return { + encode: (a) => (a === null ? a : or.encode(a)) + } +} + +/** + * @since 2.2.0 + */ +export function type(properties: { [K in keyof A]: Encoder }): Encoder { + return { + encode: (a) => { + const o: Record = {} + for (const k in properties) { + o[k] = properties[k].encode(a[k]) + } + return o + } + } +} + +/** + * @since 2.2.0 + */ +export function partial(properties: { [K in keyof A]: Encoder }): Encoder> { + return { + encode: (a) => { + const o: Record = {} + for (const k in properties) { + const v: A[Extract] | undefined = a[k] + // don't add missing properties + if (k in a) { + // don't strip undefined properties + o[k] = v === undefined ? v : properties[k].encode(v) + } + } + return o + } + } +} + +/** + * @since 2.2.0 + */ +export function record(codomain: Encoder): Encoder> { + return { + encode: (r) => { + const o: Record = {} + for (const k in r) { + o[k] = codomain.encode(r[k]) + } + return o + } + } +} + +/** + * @since 2.2.0 + */ +export function array(items: Encoder): Encoder> { + return { + encode: (as) => as.map(items.encode) + } +} + +/** + * @since 2.2.0 + */ +export function tuple>(...components: { [K in keyof A]: Encoder }): Encoder { + return { + encode: (as) => components.map((c, i) => c.encode(as[i])) + } +} + +/** + * @since 2.2.0 + */ +export function intersection(left: Encoder, right: Encoder): Encoder { + return { + encode: (ab) => intersect(left.encode(ab), right.encode(ab)) + } +} + +/** + * @since 2.2.0 + */ +export function sum( + tag: T +): (members: { [K in keyof A]: Encoder> }) => Encoder { + return (members: Record>) => { + return { + encode: (a: Record) => members[a[tag]].encode(a) + } + } +} + +/** + * @since 2.2.0 + */ +export function lazy(f: () => Encoder): Encoder { + const get = memoize>(f) + return { + encode: (a) => get().encode(a) + } +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const URI = 'Encoder' + +/** + * @since 2.2.0 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly Encoder: Encoder + } +} + +/** + * @since 2.2.0 + */ +export const encoder: Contravariant1 & Schemable = { + URI, + contramap: (fa, f) => ({ + encode: (b) => fa.encode(f(b)) + }), + literal: () => id, + string: id, + number: id, + boolean: id, + UnknownArray: id, + UnknownRecord: id, + nullable, + type, + partial, + record, + array, + tuple, + intersection, + sum, + lazy: (_, f) => lazy(f) +} + +const { contramap } = pipeable(encoder) + +export { + /** + * @since 2.2.0 + */ + contramap +} diff --git a/src/Guard.ts b/src/Guard.ts new file mode 100644 index 000000000..e21c82787 --- /dev/null +++ b/src/Guard.ts @@ -0,0 +1,244 @@ +/** + * @since 2.2.0 + */ +import { Schemable, memoize, WithUnion, Literal } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export interface Guard { + is: (u: unknown) => u is A +} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export function literal>(...values: A): Guard { + return { + is: (u: unknown): u is A[number] => values.findIndex((a) => a === u) !== -1 + } +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const never: Guard = { + is: (_u): _u is never => false +} + +/** + * @since 2.2.0 + */ +export const string: Guard = { + is: (u: unknown): u is string => typeof u === 'string' +} + +/** + * @since 2.2.0 + */ +export const number: Guard = { + is: (u: unknown): u is number => typeof u === 'number' +} + +/** + * @since 2.2.0 + */ +export const boolean: Guard = { + is: (u: unknown): u is boolean => typeof u === 'boolean' +} + +/** + * @since 2.2.0 + */ +export const UnknownArray: Guard> = { + is: Array.isArray +} + +/** + * @since 2.2.0 + */ +export const UnknownRecord: Guard> = { + is: (u: unknown): u is Record => Object.prototype.toString.call(u) === '[object Object]' +} + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export function refinement(from: Guard, refinement: (a: A) => a is B): Guard { + return { + is: (u: unknown): u is B => from.is(u) && refinement(u) + } +} + +/** + * @since 2.2.0 + */ +export function nullable(or: Guard): Guard { + return { + is: (u): u is null | A => u === null || or.is(u) + } +} + +/** + * @since 2.2.0 + */ +export function type(properties: { [K in keyof A]: Guard }): Guard { + return refinement(UnknownRecord, (r): r is { + [K in keyof A]: A[K] + } => { + for (const k in properties) { + if (!(k in r) || !properties[k].is(r[k])) { + return false + } + } + return true + }) +} + +/** + * @since 2.2.0 + */ +export function partial(properties: { [K in keyof A]: Guard }): Guard> { + return refinement(UnknownRecord, (r): r is Partial => { + for (const k in properties) { + const v = r[k] + if (v !== undefined && !properties[k].is(v)) { + return false + } + } + return true + }) +} + +/** + * @since 2.2.0 + */ +export function record(codomain: Guard): Guard> { + return refinement(UnknownRecord, (r): r is Record => { + for (const k in r) { + if (!codomain.is(r[k])) { + return false + } + } + return true + }) +} + +/** + * @since 2.2.0 + */ +export function array(items: Guard): Guard> { + return refinement(UnknownArray, (us): us is Array => us.every(items.is)) +} + +/** + * @since 2.2.0 + */ +export function tuple>(...components: { [K in keyof A]: Guard }): Guard { + return { + is: (u): u is A => Array.isArray(u) && u.length === components.length && components.every((c, i) => c.is(u[i])) + } +} + +/** + * @since 2.2.0 + */ +export function intersection(left: Guard, right: Guard): Guard { + return { + is: (u: unknown): u is A & B => left.is(u) && right.is(u) + } +} + +/** + * @since 2.2.0 + */ +export function union>(...members: { [K in keyof A]: Guard }): Guard { + return { + is: (u: unknown): u is A | A[number] => members.some((m) => m.is(u)) + } +} + +/** + * @since 2.2.0 + */ +export function sum( + tag: T +): (members: { [K in keyof A]: Guard> }) => Guard { + return (members: { [K in keyof A]: Guard> }) => + refinement(UnknownRecord, (r): r is { [K in keyof A]: A[K] & Record }[keyof A] => { + const v = r[tag] + if (string.is(v) && v in members) { + return (members as any)[v].is(r) + } + return false + }) +} + +/** + * @since 2.2.0 + */ +export function lazy(f: () => Guard): Guard { + const get = memoize>(f) + return { + is: (u: unknown): u is A => get().is(u) + } +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const URI = 'Guard' + +/** + * @since 2.2.0 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly Guard: Guard + } +} + +/** + * @since 2.2.0 + */ +export const guard: Schemable & WithUnion = { + URI, + literal, + string, + number, + boolean, + UnknownArray, + UnknownRecord, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable['tuple'], + intersection, + sum, + lazy: (_, f) => lazy(f), + union +} diff --git a/src/Schema.ts b/src/Schema.ts new file mode 100644 index 000000000..30fd480e9 --- /dev/null +++ b/src/Schema.ts @@ -0,0 +1,24 @@ +/** + * @since 2.2.0 + */ +import { Kind, URIS } from 'fp-ts/lib/HKT' +import { Schemable, memoize } from './Schemable' + +/** + * @since 2.2.0 + */ +export interface Schema { + (S: Schemable): Kind +} + +/** + * @since 2.2.0 + */ +export type TypeOf = S extends Schema ? A : never + +/** + * @since 2.2.0 + */ +export function make(f: Schema): Schema { + return memoize(f) +} diff --git a/src/Schemable.ts b/src/Schemable.ts new file mode 100644 index 000000000..a4d615cd9 --- /dev/null +++ b/src/Schemable.ts @@ -0,0 +1,57 @@ +/** + * @since 2.2.0 + */ +import { Kind, URIS } from 'fp-ts/lib/HKT' + +/** + * @since 2.2.0 + */ +export type Literal = string | number | boolean | null + +/** + * @since 2.2.0 + */ +export interface Schemable { + readonly URI: S + readonly literal: >(...values: A) => Kind + readonly string: Kind + readonly number: Kind + readonly boolean: Kind + readonly UnknownArray: Kind> + readonly UnknownRecord: Kind> + readonly nullable: (or: Kind) => Kind + readonly type: (properties: { [K in keyof A]: Kind }) => Kind + readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> + readonly record: (codomain: Kind) => Kind> + readonly array: (items: Kind) => Kind> + readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind + readonly intersection: (left: Kind, right: Kind) => Kind + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: Kind> }) => Kind + readonly lazy: (id: string, f: () => Kind) => Kind +} + +/** + * @since 2.2.0 + */ +export interface WithUnion { + readonly union: >( + ...members: { [K in keyof A]: Kind } + ) => Kind +} + +/** + * @since 2.2.0 + */ +export function memoize(f: (a: A) => B): (a: A) => B { + let cache = new Map() + return (a) => { + if (!cache.has(a)) { + const b = f(a) + cache.set(a, b) + return b + } + return cache.get(a) + } +} diff --git a/src/Tree.ts b/src/Tree.ts new file mode 100644 index 000000000..79a38c17c --- /dev/null +++ b/src/Tree.ts @@ -0,0 +1,12 @@ +/** + * @since 2.2.0 + */ +import { drawTree, Tree } from 'fp-ts/lib/Tree' +import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' + +/** + * @since 2.2.0 + */ +export function draw(es: NonEmptyArray>): string { + return es.map(drawTree).join('\n') +} diff --git a/test/Codec.ts b/test/Codec.ts new file mode 100644 index 000000000..0e5d89dc3 --- /dev/null +++ b/test/Codec.ts @@ -0,0 +1,532 @@ +import * as assert from 'assert' +import { left, right } from 'fp-ts/lib/Either' +import * as C from '../src/Codec' +import * as D from '../src/Decoder' +import * as G from '../src/Guard' +import * as E from '../src/Encoder' + +const NumberFromString: C.Codec = C.make( + D.parse(D.string, (s) => { + const n = parseFloat(s) + return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`) : right(n) + }), + { encode: String } +) + +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: C.Codec = C.refinement(C.number, (n): n is Positive => n > 0, 'Positive') + +interface IntBrand { + readonly Int: unique symbol +} +type Int = number & IntBrand +const Int: C.Codec = C.refinement(C.number, (n): n is Int => Number.isInteger(n), 'Int') + +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: C.Codec = C.make(D.fromGuard(undefinedGuard, 'undefined'), E.id) + +describe('Codec', () => { + describe('codec', () => { + it('imap', () => { + const codec = C.codec.imap( + C.string, + (s) => ({ value: s }), + ({ value }) => value + ) + assert.deepStrictEqual(codec.decode('a'), right({ value: 'a' })) + assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') + }) + }) + + describe('withExpected', () => { + describe('decode', () => { + it('should, return the provided expected', () => { + const codec = C.withExpected(C.number, () => [D.tree(`not a number`)]) + assert.deepStrictEqual(codec.decode('a'), left([D.tree('not a number')])) + }) + }) + }) + + describe('string', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.string + assert.deepStrictEqual(codec.decode('a'), right('a')) + }) + + it('should reject an invalid input', () => { + const codec = C.string + assert.deepStrictEqual(codec.decode(null), left([D.tree('cannot decode null, should be string')])) + }) + }) + }) + + describe('number', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.number + assert.deepStrictEqual(codec.decode(1), right(1)) + }) + + it('should reject an invalid input', () => { + const codec = C.number + assert.deepStrictEqual(codec.decode(null), left([D.tree('cannot decode null, should be number')])) + }) + }) + }) + + describe('boolean', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.boolean + assert.deepStrictEqual(codec.decode(true), right(true)) + assert.deepStrictEqual(codec.decode(false), right(false)) + }) + + it('should reject an invalid input', () => { + const codec = C.boolean + assert.deepStrictEqual(codec.decode(null), left([D.tree('cannot decode null, should be boolean')])) + }) + }) + }) + + describe('literal', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(codec.decode('a'), right('a')) + assert.deepStrictEqual(codec.decode(null), right(null)) + }) + + it('should reject an invalid input', () => { + const codec = C.literal('a', null) + assert.deepStrictEqual(codec.decode('b'), left([D.tree('cannot decode "b", should be "a" | null')])) + }) + + it('should handle zero members', () => { + assert.deepStrictEqual(C.literal().decode({}), left([D.tree('cannot decode {}, should be never')])) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.literal('a') + assert.deepStrictEqual(codec.encode('a'), 'a') + }) + }) + }) + + describe('refinement', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.refinement(C.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(codec.decode('a'), right('a')) + }) + + it('should reject an invalid input', () => { + const codec = C.refinement(C.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(codec.decode(undefined), left([D.tree('cannot decode undefined, should be string')])) + assert.deepStrictEqual(codec.decode(''), left([D.tree('cannot refine "", should be NonEmptyString')])) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.refinement(C.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.strictEqual(codec.encode('a'), 'a') + }) + }) + }) + + describe('nullable', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.nullable(NumberFromString) + assert.deepStrictEqual(codec.decode(null), right(null)) + assert.deepStrictEqual(codec.decode('1'), right(1)) + }) + + it('should reject an invalid input', () => { + const codec = C.nullable(NumberFromString) + assert.deepStrictEqual( + codec.decode(undefined), + left([ + D.tree('member 0', [D.tree('cannot decode undefined, should be null')]), + D.tree('member 1', [D.tree('cannot decode undefined, should be string')]) + ]) + ) + assert.deepStrictEqual( + codec.decode('a'), + left([ + D.tree('member 0', [D.tree('cannot decode "a", should be null')]), + D.tree('member 1', [D.tree('cannot decode "a", should be parsable into a number')]) + ]) + ) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.nullable(NumberFromString) + assert.strictEqual(codec.encode(null), null) + assert.strictEqual(codec.encode(1), '1') + }) + }) + }) + + describe('type', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.type({ + a: C.string + }) + assert.deepStrictEqual(codec.decode({ a: 'a' }), right({ a: 'a' })) + }) + + it('should strip additional fields', () => { + const codec = C.type({ + a: C.string + }) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), right({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', () => { + const codec = C.type({ + a: undef + }) + assert.deepStrictEqual(codec.decode({}), right({ a: undefined })) + }) + + it('should reject an invalid input', () => { + const codec = C.type({ + a: C.string + }) + assert.deepStrictEqual( + codec.decode(undefined), + left([D.tree('cannot decode undefined, should be Record')]) + ) + assert.deepStrictEqual( + codec.decode({ a: 1 }), + left([D.tree('required property "a"', [D.tree('cannot decode 1, should be string')])]) + ) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.type({ a: NumberFromString }) + assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) + }) + + it('should strip additional fields', () => { + const codec = C.type({ a: C.number }) + const a = { a: 1, b: true } + assert.deepStrictEqual(codec.encode(a), { a: 1 }) + }) + }) + }) + + describe('partial', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.partial({ a: C.string }) + assert.deepStrictEqual(codec.decode({ a: 'a' }), right({ a: 'a' })) + assert.deepStrictEqual(codec.decode({}), right({})) + }) + + it('should strip additional fields', () => { + const codec = C.partial({ a: C.string }) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), right({ a: 'a' })) + }) + + it('should not add missing fields', () => { + const codec = C.partial({ a: C.string }) + assert.deepStrictEqual(codec.decode({}), right({})) + }) + + it('should not strip fields corresponding to undefined values', () => { + const codec = C.partial({ a: C.string }) + assert.deepStrictEqual(codec.decode({ a: undefined }), right({ a: undefined })) + }) + + it('should reject an invalid input', () => { + const codec = C.partial({ a: C.string }) + assert.deepStrictEqual( + codec.decode(undefined), + left([D.tree('cannot decode undefined, should be Record')]) + ) + assert.deepStrictEqual( + codec.decode({ a: 1 }), + left([D.tree('optional property "a"', [D.tree('cannot decode 1, should be string')])]) + ) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.partial({ a: NumberFromString }) + assert.deepStrictEqual(codec.encode({}), {}) + assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) + }) + + it('should strip additional fields', () => { + const codec = C.partial({ a: C.string }) + const a = { a: 'a', b: true } + assert.deepStrictEqual(codec.encode(a), { a: 'a' }) + }) + + it('should not add missing fields', () => { + const codec = C.partial({ a: C.string }) + assert.deepStrictEqual(codec.encode({}), {}) + }) + + it('should not strip fields corresponding to undefined values', () => { + const codec = C.partial({ a: C.string }) + assert.deepStrictEqual(codec.encode({ a: undefined }), { a: undefined }) + }) + }) + }) + + describe('record', () => { + describe('decode', () => { + it('should decode a valid value', () => { + const codec = C.record(C.number) + assert.deepStrictEqual(codec.decode({}), right({})) + assert.deepStrictEqual(codec.decode({ a: 1 }), right({ a: 1 })) + }) + + it('should reject an invalid value', () => { + const codec = C.record(C.number) + assert.deepStrictEqual( + codec.decode(undefined), + left([D.tree('cannot decode undefined, should be Record')]) + ) + assert.deepStrictEqual( + codec.decode({ a: 'a' }), + left([D.tree('key "a"', [D.tree('cannot decode "a", should be number')])]) + ) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.record(NumberFromString) + assert.deepStrictEqual(codec.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) + }) + }) + }) + + describe('array', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.array(C.string) + assert.deepStrictEqual(codec.decode([]), right([])) + assert.deepStrictEqual(codec.decode(['a']), right(['a'])) + }) + + it('should reject an invalid input', () => { + const codec = C.array(C.string) + assert.deepStrictEqual( + codec.decode(undefined), + left([D.tree('cannot decode undefined, should be Array')]) + ) + assert.deepStrictEqual( + codec.decode([1]), + left([D.tree('item 0', [D.tree('cannot decode 1, should be string')])]) + ) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.array(NumberFromString) + assert.deepStrictEqual(codec.encode([1, 2]), ['1', '2']) + }) + }) + }) + + describe('tuple', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.tuple(C.string, C.number) + assert.deepStrictEqual(codec.decode(['a', 1]), right(['a', 1])) + }) + + it('should handle zero components', () => { + assert.deepStrictEqual(C.tuple().decode([]), right([])) + }) + + it('should reject an invalid input', () => { + const codec = C.tuple(C.string, C.number) + assert.deepStrictEqual( + codec.decode(undefined), + left([D.tree('cannot decode undefined, should be Array')]) + ) + assert.deepStrictEqual( + codec.decode(['a']), + left([D.tree('component 1', [D.tree('cannot decode undefined, should be number')])]) + ) + assert.deepStrictEqual( + codec.decode([1, 2]), + left([D.tree('component 0', [D.tree('cannot decode 1, should be string')])]) + ) + }) + + it('should strip additional components', () => { + const codec = C.tuple(C.string, C.number) + assert.deepStrictEqual(codec.decode(['a', 1, true]), right(['a', 1])) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.tuple(NumberFromString, C.string) + assert.deepStrictEqual(codec.encode([1, 'a']), ['1', 'a']) + }) + }) + }) + + describe('intersection', () => { + describe('decode', () => { + it('should decode a valid input', () => { + const codec = C.intersection(C.type({ a: C.string }), C.type({ b: C.number })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), right({ a: 'a', b: 1 })) + }) + + it('should handle primitives', () => { + const codec = C.intersection(Int, Positive) + assert.deepStrictEqual(codec.decode(1), right(1)) + }) + + it('should reject an invalid input', () => { + const codec = C.intersection(C.type({ a: C.string }), C.type({ b: C.number })) + assert.deepStrictEqual( + codec.decode({ a: 'a' }), + left([D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')])]) + ) + assert.deepStrictEqual( + codec.decode({ b: 1 }), + left([D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')])]) + ) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const codec = C.intersection(C.type({ a: C.string }), C.type({ b: NumberFromString })) + assert.deepStrictEqual(codec.encode({ a: 'a', b: 1 }), { a: 'a', b: '1' }) + }) + + it('should handle primitives', () => { + const codec = C.intersection(Int, Positive) + assert.deepStrictEqual(codec.encode(1 as any), 1) + }) + }) + }) + + describe('sum', () => { + const sum = C.sum('_tag') + + describe('decode', () => { + it('should decode a valid input', () => { + const A = C.type({ _tag: C.literal('A'), a: C.string }) + const B = C.type({ _tag: C.literal('B'), b: C.number }) + const codec = sum({ A, B }) + assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), right({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), right({ _tag: 'B', b: 1 })) + }) + + it('should reject an invalid input', () => { + const A = C.type({ _tag: C.literal('A'), a: C.string }) + const B = C.type({ _tag: C.literal('B'), b: C.number }) + const codec = sum({ A, B }) + assert.deepStrictEqual( + codec.decode(null), + left([D.tree('cannot decode null, should be Record')]) + ) + assert.deepStrictEqual( + codec.decode({}), + left([D.tree('required property "_tag"', [D.tree('cannot decode undefined, should be "A" | "B"')])]) + ) + assert.deepStrictEqual( + codec.decode({ _tag: 'A', a: 1 }), + left([D.tree('required property "a"', [D.tree('cannot decode 1, should be string')])]) + ) + }) + + it('should handle zero members', () => { + assert.deepStrictEqual(C.sum('_tag')({}).decode({}), left([D.tree('cannot decode {}, should be never')])) + }) + + it('should support empty records', () => { + const decoder = sum({}) + assert.deepStrictEqual(decoder.decode({}), left([D.tree('cannot decode {}, should be never')])) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + const A = C.type({ _tag: C.literal('A'), a: C.string }) + const B = C.type({ _tag: C.literal('B'), b: NumberFromString }) + const codec = sum({ A, B }) + assert.deepStrictEqual(codec.encode({ _tag: 'A', a: 'a' }), { _tag: 'A', a: 'a' }) + assert.deepStrictEqual(codec.encode({ _tag: 'B', b: 1 }), { _tag: 'B', b: '1' }) + }) + }) + }) + + describe('lazy', () => { + interface A { + a: number + b?: A + } + + const codec: C.Codec = C.lazy('A', () => + C.intersection(C.type({ a: NumberFromString }), C.partial({ b: codec })) + ) + + describe('decode', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(codec.decode({ a: '1' }), right({ a: 1 })) + assert.deepStrictEqual(codec.decode({ a: '1', b: { a: '2' } }), right({ a: 1, b: { a: 2 } })) + }) + + it('should reject an invalid input', () => { + assert.deepStrictEqual( + codec.decode({ a: 1 }), + left([D.tree('A', [D.tree('required property "a"', [D.tree('cannot decode 1, should be string')])])]) + ) + assert.deepStrictEqual( + codec.decode({ a: 'a' }), + left([ + D.tree('A', [ + D.tree('required property "a"', [D.tree('cannot decode "a", should be parsable into a number')]) + ]) + ]) + ) + assert.deepStrictEqual( + codec.decode({ a: '1', b: {} }), + left([ + D.tree('A', [ + D.tree('optional property "b"', [ + D.tree('A', [D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')])]) + ]) + ]) + ]) + ) + }) + }) + + describe('encode', () => { + it('should encode a value', () => { + assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) + assert.deepStrictEqual(codec.encode({ a: 1, b: { a: 2 } }), { a: '1', b: { a: '2' } }) + }) + }) + }) +}) diff --git a/test/Decoder.ts b/test/Decoder.ts new file mode 100644 index 000000000..9471e7950 --- /dev/null +++ b/test/Decoder.ts @@ -0,0 +1,104 @@ +import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as D from '../src/Decoder' + +describe('Decoder', () => { + describe('decoder', () => { + it('map', () => { + const decoder = pipe( + D.string, + D.map((s) => s.length) + ) + assert.deepStrictEqual(decoder.decode('aaa'), E.right(3)) + }) + + it('of', () => { + const decoder = D.decoder.of(1) + assert.deepStrictEqual(decoder.decode(1), E.right(1)) + assert.deepStrictEqual(decoder.decode('a'), E.right(1)) + }) + + it('ap', () => { + const fab = D.decoder.of((s: string): number => s.length) + const fa = D.string + assert.deepStrictEqual(pipe(fab, D.ap(fa)).decode('aaa'), E.right(3)) + }) + + it('alt', () => { + const decoder = pipe( + D.string, + D.alt(() => pipe(D.number, D.map(String))) + ) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode(1), E.right('1')) + }) + + it('zero', () => { + const decoder = D.decoder.zero() + assert.deepStrictEqual(decoder.decode(null), E.left([D.tree('cannot decode null, should be never')])) + }) + }) + + describe('union', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(D.union(D.string).decode('a'), E.right('a')) + const decoder = D.union(D.string, D.number) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode(1), E.right(1)) + }) + + it('should reject an invalid input', () => { + const decoder = D.union(D.string, D.number) + assert.deepStrictEqual( + decoder.decode(true), + E.left([ + D.tree('member 0', [D.tree('cannot decode true, should be string')]), + D.tree('member 1', [D.tree('cannot decode true, should be number')]) + ]) + ) + }) + + it('should handle zero members', () => { + assert.deepStrictEqual(D.union().decode({}), E.left([D.tree('cannot decode {}, should be never')])) + }) + }) + + describe('intersect', () => { + it('should concat strings', () => { + assert.deepStrictEqual(D.intersect('a', 'b'), 'b') + }) + + it('should concat numbers', () => { + assert.deepStrictEqual(D.intersect(1, 2), 2) + }) + + it('should concat booleans', () => { + assert.deepStrictEqual(D.intersect(true, false), false) + }) + + it('should concat nulls', () => { + assert.deepStrictEqual(D.intersect(null, null), null) + }) + + it('should concat undefineds', () => { + assert.deepStrictEqual(D.intersect(undefined, undefined), undefined) + }) + + it('should concat objects', () => { + assert.deepStrictEqual(D.intersect({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) + }) + + it('should concat a string with an object', () => { + assert.deepStrictEqual(D.intersect('a', { a: 1 }), { 0: 'a', a: 1 }) + }) + + it('should concat a number with an object', () => { + assert.deepStrictEqual(D.intersect(1, { a: 1 }), { a: 1 }) + }) + + it('should concat a boolean with an object', () => { + assert.deepStrictEqual(D.intersect(true, { a: 1 }), { a: 1 }) + }) + }) +}) diff --git a/test/Encoder.ts b/test/Encoder.ts new file mode 100644 index 000000000..4d1f066d6 --- /dev/null +++ b/test/Encoder.ts @@ -0,0 +1,11 @@ +import * as assert from 'assert' +import * as E from '../src/Encoder' + +describe('Encoder', () => { + describe('encoder', () => { + it('contramap', () => { + const encoder = E.encoder.contramap(E.encoder.number, (s: string) => s.length) + assert.deepStrictEqual(encoder.encode('aaa'), 3) + }) + }) +}) diff --git a/test/Guard.ts b/test/Guard.ts new file mode 100644 index 000000000..1c65cf738 --- /dev/null +++ b/test/Guard.ts @@ -0,0 +1,208 @@ +import * as assert from 'assert' +import * as G from '../src/Guard' + +describe('Guard', () => { + describe('refinement', () => { + it('should accepts valid inputs', () => { + const guard = G.refinement(G.string, (s): s is string => s.length > 0) + assert.strictEqual(guard.is('a'), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.refinement(G.string, (s): s is string => s.length > 0) + assert.strictEqual(guard.is(undefined), false) + assert.strictEqual(guard.is(''), false) + }) + }) + + describe('nullable', () => { + it('should accepts valid inputs', () => { + const guard = G.nullable(G.string) + assert.strictEqual(guard.is(null), true) + assert.strictEqual(guard.is('a'), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.nullable(G.string) + assert.strictEqual(guard.is(1), false) + }) + }) + + describe('type', () => { + it('should accepts valid inputs', () => { + const guard = G.type({ a: G.string, b: G.number }) + assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) + }) + + it('should accepts additional fields', () => { + const guard = G.type({ a: G.string, b: G.number }) + assert.strictEqual(guard.is({ a: 'a', b: 1, c: true }), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.type({ a: G.string, b: G.number }) + assert.strictEqual(guard.is(undefined), false) + assert.strictEqual(guard.is({ a: 'a' }), false) + }) + + it('should check missing fields', () => { + const undef: G.Guard = { + is: (u): u is undefined => u === undefined + } + const guard = G.type({ a: undef }) + assert.strictEqual(guard.is({}), false) + }) + }) + + describe('partial', () => { + it('should accepts valid inputs', () => { + const guard = G.partial({ a: G.string, b: G.number }) + assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) + assert.strictEqual(guard.is({ a: 'a' }), true) + assert.strictEqual(guard.is({ b: 1 }), true) + assert.strictEqual(guard.is({}), true) + }) + + it('should accepts additional fields', () => { + const guard = G.partial({ a: G.string, b: G.number }) + assert.strictEqual(guard.is({ a: 'a', b: 1, c: true }), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.partial({ a: G.string, b: G.number }) + assert.strictEqual(guard.is(undefined), false) + assert.strictEqual(guard.is({ a: 'a', b: 'b' }), false) + }) + }) + + describe('record', () => { + it('should accepts valid inputs', () => { + const guard = G.record(G.string) + assert.strictEqual(guard.is({}), true) + assert.strictEqual(guard.is({ a: 'a', b: 'b' }), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.record(G.string) + assert.strictEqual(guard.is(undefined), false) + assert.strictEqual(guard.is({ a: 'a', b: 1 }), false) + }) + }) + + describe('array', () => { + it('should accepts valid inputs', () => { + const guard = G.array(G.number) + assert.strictEqual(guard.is([]), true) + assert.strictEqual(guard.is([1, 2, 3]), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.array(G.number) + assert.strictEqual(guard.is(undefined), false) + assert.strictEqual(guard.is(['a']), false) + }) + }) + + describe('tuple', () => { + it('should accepts valid inputs', () => { + const guard = G.tuple(G.string, G.number) + assert.strictEqual(guard.is(['a', 1]), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.tuple(G.string, G.number) + assert.strictEqual(guard.is([1, 2]), false) + }) + + it('should rejects additional fields', () => { + const guard = G.tuple(G.string, G.number) + assert.strictEqual(guard.is(['a', 1, true]), false) + }) + + it('should rejects missing fields', () => { + const guard = G.tuple(G.string, G.number) + assert.strictEqual(guard.is(['a']), false) + }) + }) + + describe('intersection', () => { + it('should accepts valid inputs', () => { + const guard = G.intersection(G.type({ a: G.string }), G.type({ b: G.number })) + assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.intersection(G.type({ a: G.string }), G.type({ b: G.number })) + assert.strictEqual(guard.is({ a: 'a' }), false) + }) + }) + + describe('union', () => { + it('should accepts valid inputs', () => { + const guard = G.union(G.string, G.number) + assert.strictEqual(guard.is('a'), true) + assert.strictEqual(guard.is(1), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.union(G.string, G.number) + assert.strictEqual(guard.is(undefined), false) + }) + + it('should handle zero members', () => { + assert.deepStrictEqual(G.union().is(null), false) + assert.deepStrictEqual(G.union().is({}), false) + }) + }) + + describe('lazy', () => { + interface A { + a: number + b: Array + } + + const guard: G.Guard = G.guard.lazy('A', () => + G.type({ + a: G.number, + b: G.array(guard) + }) + ) + + it('should accepts valid inputs', () => { + assert.strictEqual(guard.is({ a: 1, b: [] }), true) + assert.strictEqual(guard.is({ a: 1, b: [{ a: 2, b: [] }] }), true) + }) + + it('should rejects invalid inputs', () => { + const guard = G.union(G.string, G.number) + assert.strictEqual(guard.is(undefined), false) + }) + }) + + describe('sum', () => { + const sum = G.sum('_tag') + + it('should accepts valid inputs', () => { + const guard = sum({ + A: G.type({ _tag: G.literal('A'), a: G.string }), + B: G.type({ _tag: G.literal('B'), b: G.number }) + }) + assert.deepStrictEqual(guard.is({ _tag: 'A', a: 'a' }), true) + assert.deepStrictEqual(guard.is({ _tag: 'B', b: 1 }), true) + }) + + it('should rejects invalid inputs', () => { + const guard = sum({ + A: G.type({ _tag: G.literal('A'), a: G.string }), + B: G.type({ _tag: G.literal('B'), b: G.number }) + }) + assert.strictEqual(guard.is(undefined), false) + assert.strictEqual(guard.is({}), false) + }) + + it('should handle zero members', () => { + assert.deepStrictEqual(sum({}).is(null), false) + assert.deepStrictEqual(sum({}).is({}), false) + }) + }) +}) diff --git a/test/Schema.ts b/test/Schema.ts new file mode 100644 index 000000000..6b8f2a614 --- /dev/null +++ b/test/Schema.ts @@ -0,0 +1,33 @@ +import * as assert from 'assert' +import { right } from 'fp-ts/lib/Either' +import * as D from '../src/Decoder' +import * as S from '../src/Schema' +import * as E from '../src/Encoder' +import * as G from '../src/Guard' +import * as C from '../src/Codec' + +const Person = S.make((S) => + S.type({ + name: S.string, + age: S.number + }) +) + +describe('Schemable', () => { + it('should handle decoders', () => { + assert.deepStrictEqual(Person(D.decoder).decode({ name: 'name', age: 46 }), right({ name: 'name', age: 46 })) + }) + + it('should handle encoders', () => { + assert.deepStrictEqual(Person(E.encoder).encode({ name: 'name', age: 46 }), { name: 'name', age: 46 }) + }) + + it('should handle guards', () => { + assert.deepStrictEqual(Person(G.guard).is({ name: 'name', age: 46 }), true) + }) + + it('should handle codecs', () => { + assert.deepStrictEqual(Person(C.codec).decode({ name: 'name', age: 46 }), right({ name: 'name', age: 46 })) + assert.deepStrictEqual(Person(E.encoder).encode({ name: 'name', age: 46 }), { name: 'name', age: 46 }) + }) +}) diff --git a/test/Tree.ts b/test/Tree.ts new file mode 100644 index 000000000..c948360a8 --- /dev/null +++ b/test/Tree.ts @@ -0,0 +1,19 @@ +import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import * as D from '../src/Decoder' +import { draw } from '../src/Tree' +import { pipe } from 'fp-ts/lib/pipeable' + +describe('Tree', () => { + it('should draw a tree', () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual(pipe(codec.decode({ a: 'a' }), E.mapLeft(draw)), E.right({ a: 'a' })) + assert.deepStrictEqual( + pipe(codec.decode({ a: 1 }), E.mapLeft(draw)), + E.left(`required property "a" +└─ cannot decode 1, should be string`) + ) + }) +}) From 3b285f5200325d4b64d6a45320772a69f1c99aec Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 16 Apr 2020 15:27:09 +0200 Subject: [PATCH 005/222] version 2.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd6aea181..758c55292 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.1.3", + "version": "2.2.0", "description": "TypeScript compatible runtime type system for IO validation", "files": [ "lib", From 8cb18ae9a139119d222afeeb8c707fe76dee3989 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 16 Apr 2020 15:48:26 +0200 Subject: [PATCH 006/222] Docs: remove Type from index --- docs/index.md | 94 +-------------------------------------------------- 1 file changed, 1 insertion(+), 93 deletions(-) diff --git a/docs/index.md b/docs/index.md index 477de984c..62a28f1ec 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,96 +2,4 @@ title: Home --- - - -**Table of contents** - -- [The idea](#the-idea) -- [TypeScript compatibility](#typescript-compatibility) - - - -# The idea - -Blog post: ["Typescript and validations at runtime boundaries"](https://lorefnon.tech/2018/03/25/typescript-and-validations-at-runtime-boundaries/) by [@lorefnon](https://github.com/lorefnon) - -A value of type `Type` (called "codec") is the runtime representation of the static type `A`. - -Also a codec can - -- decode inputs of type `I` (through `decode`) -- encode outputs of type `O` (through `encode`) -- be used as a custom type guard (through `is`) - -```ts -class Type { - readonly _A: A - readonly _O: O - readonly _I: I - constructor( - /** a unique name for this codec */ - readonly name: string, - /** a custom type guard */ - readonly is: (u: unknown) => u is A, - /** succeeds if a value of type I can be decoded to a value of type A */ - readonly validate: (input: I, context: Context) => Either, - /** converts a value of type A to a value of type O */ - readonly encode: (a: A) => O - ) {} - /** a version of `validate` with a default context */ - decode(i: I): Either -} -``` - -Note. The `Either` type is defined in [fp-ts](https://github.com/gcanti/fp-ts), a library containing implementations of -common algebraic types in TypeScript. - -**Example** - -A codec representing `string` can be defined as - -```ts -import * as t from 'io-ts' - -const isString = (u: unknown): u is string => typeof u === 'string' - -const string = new t.Type( - 'string', - isString, - (u, c) => (isString(u) ? t.success(u) : t.failure(u, c)), - t.identity -) -``` - -A codec can be used to validate an object in memory (for example an API payload) - -```ts -import * as t from 'io-ts' - -const User = t.type({ - userId: t.number, - name: t.string -}) - -// validation succeeded -User.decode(JSON.parse('{"userId":1,"name":"Giulio"}')) // => Right({ userId: 1, name: "Giulio" }) - -// validation failed -User.decode(JSON.parse('{"name":"Giulio"}')) // => Left([...]) -``` - -# TypeScript compatibility - -The stable version is tested against TypeScript 3.2.4. - -| io-ts version | required TypeScript version | -| ------------- | --------------------------- | -| 1.6.x+ | 3.2.2+ | -| 1.5.3 | 3.0.1+ | -| 1.5.2- | 2.7.2+ | - -**Note**. This library is conceived, tested and is supposed to be consumed by TypeScript with the `strict` flag turned on. - -**Note**. If you are running `< typescript@3.0.1` you have to polyfill `unknown`. - -You can use [unknown-ts](https://github.com/gcanti/unknown-ts) as a polyfill. +# Runtime type system for IO decoding/encoding From f74d235d00402cd7a292e512954c1737b88077d4 Mon Sep 17 00:00:00 2001 From: Tarik Demirci Date: Thu, 16 Apr 2020 22:52:12 +0200 Subject: [PATCH 007/222] Fix broken link in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a791eed9d..35baa62a5 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Note: [`fp-ts`](https://github.com/gcanti/fp-ts) is a peer dependency for `io-ts # Documentation -- [API Reference](https://gcanti.github.io/io-ts/modules/) +- [API Reference](https://gcanti.github.io/io-ts/docs/modules) ## Usage From 052d2b6b1d7318162e1808ad84fa25040ab9cca5 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 20 Apr 2020 09:04:53 +0200 Subject: [PATCH 008/222] collect all errors while decoding, closes #449 --- CHANGELOG.md | 9 +++- Decoder.md | 2 + docs/modules/Decoder.ts.md | 14 ----- package.json | 20 +++---- perf/Decoder.ts | 108 +++++++++++++++++++++++++++++++++++++ perf/index.ts | 14 ++--- src/Decoder.ts | 47 ++++++++-------- test/Codec.ts | 61 +++++++++++++++++++++ test/record.ts | 5 -- 9 files changed, 219 insertions(+), 61 deletions(-) create mode 100644 perf/Decoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index c0826cd51..342a63321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,13 @@ > - [Experimental] > - [Deprecation] -**Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a -high state of flux, you're at risk of it changing without notice. +**Note**: Gaps between patch versions are faulty/broken releases. +**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. + +# 2.2.1 + +- **Experimental** + - collect all errors while decoding, closes #449 (@gcanti) # 2.2.0 diff --git a/Decoder.md b/Decoder.md index 19e5e3f7d..26851d574 100644 --- a/Decoder.md +++ b/Decoder.md @@ -341,5 +341,7 @@ if (isLeft(result)) { /* required property "name" └─ cannot decode undefined, should be string +required property "age" +└─ cannot decode undefined, should be number */ ``` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 1dcacbc83..2fe8c8b9f 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -26,7 +26,6 @@ Added in v2.2.0 - [boolean](#boolean) - [decoder](#decoder) - [failure](#failure) -- [failures](#failures) - [fromGuard](#fromguard) - [intersection](#intersection) - [lazy](#lazy) @@ -195,19 +194,6 @@ export declare function failure(message: string): Either( - message: string, - errors: NonEmptyArray> -): Either>, A> -``` - -Added in v2.2.0 - # fromGuard **Signature** diff --git a/package.json b/package.json index 758c55292..c454f0c83 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "io-ts", - "version": "2.2.0", - "description": "TypeScript compatible runtime type system for IO validation", + "version": "2.2.1", + "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", "es6" @@ -63,16 +63,16 @@ }, "tags": [ "typescript", - "validation", - "inference", - "types", - "runtime" + "runtime", + "decoder", + "encoder", + "schema" ], "keywords": [ "typescript", - "validation", - "inference", - "types", - "runtime" + "runtime", + "decoder", + "encoder", + "schema" ] } diff --git a/perf/Decoder.ts b/perf/Decoder.ts new file mode 100644 index 000000000..c7b78ea7c --- /dev/null +++ b/perf/Decoder.ts @@ -0,0 +1,108 @@ +import * as Benchmark from 'benchmark' +import * as t from '../src/Decoder' + +/* +space-object (good) x 662,359 ops/sec ±0.65% (88 runs sampled) +space-object (bad) x 379,528 ops/sec ±0.56% (89 runs sampled) +*/ + +const suite = new Benchmark.Suite() + +const Vector = t.tuple(t.number, t.number, t.number) + +const Asteroid = t.type({ + type: t.literal('asteroid'), + location: Vector, + mass: t.number +}) + +const Planet = t.type({ + type: t.literal('planet'), + location: Vector, + mass: t.number, + population: t.number, + habitable: t.boolean +}) + +const Rank = t.literal('captain', 'first mate', 'officer', 'ensign') + +const CrewMember = t.type({ + name: t.string, + age: t.number, + rank: Rank, + home: Planet +}) + +const Ship = t.type({ + type: t.literal('ship'), + location: Vector, + mass: t.number, + name: t.string, + crew: t.array(CrewMember) +}) + +const T = t.sum('type')({ + asteroid: Asteroid, + planet: Planet, + ship: Ship +}) + +const good = { + type: 'ship', + location: [1, 2, 3], + mass: 4, + name: 'foo', + crew: [ + { + name: 'bar', + age: 44, + rank: 'captain', + home: { + type: 'planet', + location: [5, 6, 7], + mass: 8, + population: 1000, + habitable: true + } + } + ] +} + +const bad = { + type: 'ship', + location: [1, 2, 'a'], + mass: 4, + name: 'foo', + crew: [ + { + name: 'bar', + age: 44, + rank: 'captain', + home: { + type: 'planet', + location: [5, 6, 7], + mass: 8, + population: 'a', + habitable: true + } + } + ] +} + +// console.log(T.decode(good)) +// console.log(T.decode(bad)) + +suite + .add('space-object (good)', function () { + T.decode(good) + }) + .add('space-object (bad)', function () { + T.decode(bad) + }) + .on('cycle', function (event: any) { + console.log(String(event.target)) + }) + .on('complete', function (this: any) { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) diff --git a/perf/index.ts b/perf/index.ts index a220dc208..b66c2cfb8 100644 --- a/perf/index.ts +++ b/perf/index.ts @@ -2,8 +2,8 @@ import * as Benchmark from 'benchmark' import * as t from '../src' /* -space-object (good) x 435,472 ops/sec ±0.61% (83 runs sampled) -space-object (bad) x 392,528 ops/sec ±2.39% (87 runs sampled) +space-object (good) x 476,424 ops/sec ±0.45% (92 runs sampled) +space-object (bad) x 434,563 ops/sec ±0.58% (87 runs sampled) */ const suite = new Benchmark.Suite() @@ -71,7 +71,7 @@ const good = { const bad = { type: 'ship', - location: [1, 2, 3], + location: [1, 2, 'a'], mass: 4, name: 'foo', crew: [ @@ -94,16 +94,16 @@ const bad = { // console.log(T.decode(bad)) suite - .add('space-object (good)', function() { + .add('space-object (good)', function () { T.decode(good) }) - .add('space-object (bad)', function() { + .add('space-object (bad)', function () { T.decode(bad) }) - .on('cycle', function(event: any) { + .on('cycle', function (event: any) { console.log(String(event.target)) }) - .on('complete', function(this: any) { + .on('complete', function (this: any) { console.log('Fastest is ' + this.filter('fastest').map('name')) }) .run({ async: true }) diff --git a/src/Decoder.ts b/src/Decoder.ts index 99ef84c77..524df45c1 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -56,14 +56,8 @@ export function failure(message: string): Either( - message: string, - errors: NonEmptyArray> -): Either>, A> { - return left([tree(message, errors)]) +function isNotEmpty(as: Array): as is NonEmptyArray { + return as.length > 0 } /** @@ -197,16 +191,17 @@ export function type(properties: { [K in keyof A]: Decoder }): Decoder< return e } else { const r = e.right - let a: Partial = {} + const a: Partial = {} + const errors: Array> = [] for (const k in properties) { const e = properties[k].decode(r[k]) if (isLeft(e)) { - return failures(`required property ${JSON.stringify(k)}`, e.left) + errors.push(tree(`required property ${JSON.stringify(k)}`, e.left)) } else { a[k] = e.right } } - return success(a as A) + return isNotEmpty(errors) ? left(errors) : success(a as A) } } } @@ -223,7 +218,8 @@ export function partial(properties: { [K in keyof A]: Decoder }): Decod return e } else { const r = e.right - let a: Partial = {} + const a: Partial = {} + const errors: Array> = [] for (const k in properties) { // don't add missing properties if (k in r) { @@ -234,14 +230,14 @@ export function partial(properties: { [K in keyof A]: Decoder }): Decod } else { const e = properties[k].decode(rk) if (isLeft(e)) { - return failures(`optional property ${JSON.stringify(k)}`, e.left) + errors.push(tree(`optional property ${JSON.stringify(k)}`, e.left)) } else { a[k] = e.right } } } } - return success(a) + return isNotEmpty(errors) ? left(errors) : success(a) } } } @@ -258,16 +254,17 @@ export function record(codomain: Decoder): Decoder> { return e } else { const r = e.right - let a: Record = {} + const a: Record = {} + const errors: Array> = [] for (const k in r) { const e = codomain.decode(r[k]) if (isLeft(e)) { - return failures(`key ${JSON.stringify(k)}`, e.left) + errors.push(tree(`key ${JSON.stringify(k)}`, e.left)) } else { a[k] = e.right } } - return success(a) + return isNotEmpty(errors) ? left(errors) : success(a) } } } @@ -286,15 +283,16 @@ export function array(items: Decoder): Decoder> { const us = e.right const len = us.length const a: Array = new Array(len) + const errors: Array> = [] for (let i = 0; i < len; i++) { const e = items.decode(us[i]) if (isLeft(e)) { - return failures(`item ${i}`, e.left) + errors.push(tree(`item ${i}`, e.left)) } else { a[i] = e.right } } - return success(a) + return isNotEmpty(errors) ? left(errors) : success(a) } } } @@ -312,15 +310,16 @@ export function tuple>(...components: { [K in k } const us = e.right const a: Array = [] + const errors: Array> = [] for (let i = 0; i < components.length; i++) { const e = components[i].decode(us[i]) if (isLeft(e)) { - return failures(`component ${i}`, e.left) + errors.push(tree(`component ${i}`, e.left)) } else { a.push(e.right) } } - return success(a as any) + return isNotEmpty(errors) ? left(errors) : success(a as any) } } } @@ -398,8 +397,10 @@ export function sum( if (G.string.is(v) && v in members) { return (members as any)[v].decode(u) } - return failures(`required property ${JSON.stringify(tag)}`, [ - tree(`cannot decode ${JSON.stringify(v)}, should be ${expected}`) + return left([ + tree(`required property ${JSON.stringify(tag)}`, [ + tree(`cannot decode ${JSON.stringify(v)}, should be ${expected}`) + ]) ]) } } diff --git a/test/Codec.ts b/test/Codec.ts index 0e5d89dc3..d2b96caa5 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -215,6 +215,20 @@ describe('Codec', () => { left([D.tree('required property "a"', [D.tree('cannot decode 1, should be string')])]) ) }) + + it('should collect all errors', () => { + const codec = C.type({ + a: C.string, + b: C.number + }) + assert.deepStrictEqual( + codec.decode({}), + left([ + D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')]), + D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')]) + ]) + ) + }) }) describe('encode', () => { @@ -265,6 +279,20 @@ describe('Codec', () => { left([D.tree('optional property "a"', [D.tree('cannot decode 1, should be string')])]) ) }) + + it('should collect all errors', () => { + const codec = C.partial({ + a: C.string, + b: C.number + }) + assert.deepStrictEqual( + codec.decode({ a: 1, b: 'b' }), + left([ + D.tree('optional property "a"', [D.tree('cannot decode 1, should be string')]), + D.tree('optional property "b"', [D.tree('cannot decode "b", should be number')]) + ]) + ) + }) }) describe('encode', () => { @@ -311,6 +339,17 @@ describe('Codec', () => { left([D.tree('key "a"', [D.tree('cannot decode "a", should be number')])]) ) }) + + it('should collect all errors', () => { + const codec = C.record(C.number) + assert.deepStrictEqual( + codec.decode({ a: 'a', b: 'b' }), + left([ + D.tree('key "a"', [D.tree('cannot decode "a", should be number')]), + D.tree('key "b"', [D.tree('cannot decode "b", should be number')]) + ]) + ) + }) }) describe('encode', () => { @@ -340,6 +379,17 @@ describe('Codec', () => { left([D.tree('item 0', [D.tree('cannot decode 1, should be string')])]) ) }) + + it('should collect all errors', () => { + const codec = C.array(C.string) + assert.deepStrictEqual( + codec.decode([1, 2]), + left([ + D.tree('item 0', [D.tree('cannot decode 1, should be string')]), + D.tree('item 1', [D.tree('cannot decode 2, should be string')]) + ]) + ) + }) }) describe('encode', () => { @@ -377,6 +427,17 @@ describe('Codec', () => { ) }) + it('should collect all errors', () => { + const codec = C.tuple(C.string, C.number) + assert.deepStrictEqual( + codec.decode([1, 'a']), + left([ + D.tree('component 0', [D.tree('cannot decode 1, should be string')]), + D.tree('component 1', [D.tree('cannot decode "a", should be number')]) + ]) + ) + }) + it('should strip additional components', () => { const codec = C.tuple(C.string, C.number) assert.deepStrictEqual(codec.decode(['a', 1, true]), right(['a', 1])) diff --git a/test/record.ts b/test/record.ts index b93df4f76..d0884fc3b 100644 --- a/test/record.ts +++ b/test/record.ts @@ -75,11 +75,6 @@ describe('record', () => { assertSuccess(T.decode({ a: 1 })) }) - it.skip('should strip additional properties', () => { - const T = t.record(t.string, t.number) - assertSuccess(T.decode({ a: 1, b: 'b' }), { a: 1 }) - }) - it('should return the same reference while decoding isomorphic values', () => { const T = t.record(t.string, t.number) const value1 = { a: 1 } From 970d2ca60d9006928ff0cd81c6c4b2f9478aeab9 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 20 Apr 2020 16:50:26 +0200 Subject: [PATCH 009/222] Docs: add link to 2.2 issues --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 35baa62a5..3971ad76b 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,15 @@ Note: [`fp-ts`](https://github.com/gcanti/fp-ts) is a peer dependency for `io-ts ## Usage +**Stable features** + +- [`Type`](Type.md) + **Experimental features** (version `2.2+`) +Experimental features are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + - [`Decoder`](Decoder.md) - [`Encoder`](Encoder.md) - [`Codec`](Codec.md) - [`Schema` (advanced feature)](Schema.md) - -**Stable** (old) - -- [`Type`](Type.md) From 20a6718fe6ed9796bec14c2429b1a8df9f43cbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eivind=20Lindbr=C3=A5ten?= Date: Thu, 23 Apr 2020 22:05:28 +0200 Subject: [PATCH 010/222] Fix spelling error remeberMe => rememberMe --- Decoder.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Decoder.md b/Decoder.md index 26851d574..4106567fc 100644 --- a/Decoder.md +++ b/Decoder.md @@ -118,7 +118,7 @@ console.log(isRight(Person.decode({ name: 'name' }))) // => false The `type` combinator will strip additional fields while decoding ```ts -console.log(Person.decode({ name: 'name', age: 42, remeberMe: true })) +console.log(Person.decode({ name: 'name', age: 42, rememberMe: true })) // => { _tag: 'Right', right: { name: 'name', age: 42 } } ``` @@ -139,7 +139,7 @@ console.log(isRight(Person.decode({ name: 'name' }))) // => true The `partial` combinator will strip additional fields while decoding ```ts -console.log(Person.decode({ name: 'name', remeberMe: true })) +console.log(Person.decode({ name: 'name', rememberMe: true })) // => { _tag: 'Right', right: { name: 'name' } } ``` From 4ec6b6c3993e8a98fd2e9d694ceb549182b47e38 Mon Sep 17 00:00:00 2001 From: Mikko Matilainen Date: Thu, 30 Apr 2020 21:47:34 +0300 Subject: [PATCH 011/222] Add closing parenthesis to codec law --- docs/modules/Codec.ts.md | 2 +- src/Codec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 64571bfce..b092f83a9 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -41,7 +41,7 @@ Added in v2.2.0 Laws: -1. `pipe(codec.decode(u), E.fold(() => u, codec.encode) = u` for all `u` in `unknown` +1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` **Signature** diff --git a/src/Codec.ts b/src/Codec.ts index 61afdc388..93f566699 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -15,7 +15,7 @@ import { Schemable, Literal } from './Schemable' /** * Laws: * - * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode) = u` for all `u` in `unknown` + * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` * * @since 2.2.0 From 8721bc978660449ed8db145b6403fc1e831ae365 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 25 Apr 2020 08:11:56 +0200 Subject: [PATCH 012/222] add `DecodeError` interface --- CHANGELOG.md | 9 ++- docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 30 +++++++-- docs/modules/Tree.ts.md | 2 +- package.json | 2 +- perf/typescript-runtime-type-benchmarks.ts | 71 ++++++++++++++++++++++ src/Codec.ts | 4 +- src/Decoder.ts | 24 +++++--- src/Tree.ts | 8 +-- 9 files changed, 129 insertions(+), 23 deletions(-) create mode 100644 perf/typescript-runtime-type-benchmarks.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 342a63321..00bbe4e4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,10 +14,17 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.2 + +- **Experimental** + - `Decoder` + - add `DecodeError` interface (@gcanti) + # 2.2.1 - **Experimental** - - collect all errors while decoding, closes #449 (@gcanti) + - `Decoder` + - collect all errors while decoding, closes #449 (@gcanti) # 2.2.0 diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index b092f83a9..6f827aa85 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -267,7 +267,7 @@ Added in v2.2.0 ```ts export declare function withExpected( codec: Codec, - expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> + expected: (actual: unknown, e: D.DecodeError) => D.DecodeError ): Codec ``` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 2fe8c8b9f..7b3aa5570 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -12,6 +12,7 @@ Added in v2.2.0

Table of contents

+- [DecodeError (interface)](#decodeerror-interface) - [Decoder (interface)](#decoder-interface) - [TypeOf (type alias)](#typeof-type-alias) - [URI (type alias)](#uri-type-alias) @@ -28,6 +29,7 @@ Added in v2.2.0 - [failure](#failure) - [fromGuard](#fromguard) - [intersection](#intersection) +- [isNotEmpty](#isnotempty) - [lazy](#lazy) - [literal](#literal) - [map](#map) @@ -49,13 +51,23 @@ Added in v2.2.0 --- +# DecodeError (interface) + +**Signature** + +```ts +export interface DecodeError extends NonEmptyArray> {} +``` + +Added in v2.2.2 + # Decoder (interface) **Signature** ```ts export interface Decoder
{ - readonly decode: (u: unknown) => Either>, A> + readonly decode: (u: unknown) => Either } ``` @@ -189,7 +201,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function failure(message: string): Either>, A> +export declare function failure(message: string): Either ``` Added in v2.2.0 @@ -214,6 +226,16 @@ export declare function intersection(left: Decoder, right: Decoder): Added in v2.2.0 +# isNotEmpty + +**Signature** + +```ts +export declare function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray +``` + +Added in v2.2.2 + # lazy **Signature** @@ -333,7 +355,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function success(a: A): Either>, A> +export declare function success(a: A): Either ``` Added in v2.2.0 @@ -401,7 +423,7 @@ Added in v2.2.0 ```ts export declare function withExpected( decoder: Decoder, - expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> + expected: (actual: unknown, e: DecodeError) => DecodeError ): Decoder ``` diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index 488a86be2..8a97417e3 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -21,7 +21,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function draw(es: NonEmptyArray>): string +export declare function draw(e: DecodeError): string ``` Added in v2.2.0 diff --git a/package.json b/package.json index c454f0c83..7cd921090 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.1", + "version": "2.2.2", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", diff --git a/perf/typescript-runtime-type-benchmarks.ts b/perf/typescript-runtime-type-benchmarks.ts new file mode 100644 index 000000000..6615d4b8c --- /dev/null +++ b/perf/typescript-runtime-type-benchmarks.ts @@ -0,0 +1,71 @@ +import * as Benchmark from 'benchmark' +import * as t from '../src/Decoder' +import * as G from '../src/Guard' + +/* +decode x 1,138,915 ops/sec ±0.44% (87 runs sampled) +is x 1,975,690 ops/sec ±0.44% (91 runs sampled) + */ + +const suite = new Benchmark.Suite() + +const decoder = t.type({ + number: t.number, + negNumber: t.number, + maxNumber: t.number, + string: t.string, + longString: t.string, + boolean: t.boolean, + deeplyNested: t.type({ + foo: t.string, + num: t.number, + bool: t.boolean + }) +}) + +const guard = G.type({ + number: G.number, + negNumber: G.number, + maxNumber: G.number, + string: G.string, + longString: G.string, + boolean: G.boolean, + deeplyNested: G.type({ + foo: G.string, + num: G.number, + bool: G.boolean + }) +}) + +export const good = { + number: 1, + negNumber: -1, + maxNumber: Number.MAX_VALUE, + string: 'string', + longString: + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Vivendum intellegat et qui, ei denique consequuntur vix. Semper aeterno percipit ut his, sea ex utinam referrentur repudiandae. No epicuri hendrerit consetetur sit, sit dicta adipiscing ex, in facete detracto deterruisset duo. Quot populo ad qui. Sit fugit nostrum et. Ad per diam dicant interesset, lorem iusto sensibus ut sed. No dicam aperiam vis. Pri posse graeco definitiones cu, id eam populo quaestio adipiscing, usu quod malorum te. Ex nam agam veri, dicunt efficiantur ad qui, ad legere adversarium sit. Commune platonem mel id, brute adipiscing duo an. Vivendum intellegat et qui, ei denique consequuntur vix. Offendit eleifend moderatius ex vix, quem odio mazim et qui, purto expetendis cotidieque quo cu, veri persius vituperata ei nec. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', + boolean: true, + deeplyNested: { + foo: 'bar', + num: 1, + bool: false + } +} + +// console.log(decoder.decode(good)) +// console.log(guard.is(good)) + +suite + .add('decode', function () { + decoder.decode(good) + }) + .add('is', function () { + guard.is(good) + }) + .on('cycle', function (event: any) { + console.log(String(event.target)) + }) + .on('complete', function (this: any) { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) diff --git a/src/Codec.ts b/src/Codec.ts index 93f566699..1f70d3d53 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -2,8 +2,6 @@ * @since 2.2.0 */ import { Invariant1 } from 'fp-ts/lib/Invariant' -import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' -import { Tree } from 'fp-ts/lib/Tree' import * as D from './Decoder' import * as E from './Encoder' import { Schemable, Literal } from './Schemable' @@ -81,7 +79,7 @@ export const UnknownRecord: Codec> = make(D.decoder.Unkn */ export function withExpected( codec: Codec, - expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> + expected: (actual: unknown, e: D.DecodeError) => D.DecodeError ): Codec { return make(D.withExpected(codec, expected), codec) } diff --git a/src/Decoder.ts b/src/Decoder.ts index 524df45c1..10858ea84 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -14,11 +14,16 @@ import { Schemable, memoize, WithUnion, Literal } from './Schemable' // model // ------------------------------------------------------------------------------------- +/** + * @since 2.2.2 + */ +export interface DecodeError extends NonEmptyArray> {} + /** * @since 2.2.0 */ export interface Decoder { - readonly decode: (u: unknown) => Either>, A> + readonly decode: (u: unknown) => Either } /** @@ -45,18 +50,21 @@ export function tree(value: A, forest: Forest = empty): Tree { /** * @since 2.2.0 */ -export function success(a: A): Either>, A> { +export function success(a: A): Either { return right(a) } /** * @since 2.2.0 */ -export function failure(message: string): Either>, A> { +export function failure(message: string): Either { return left([tree(message)]) } -function isNotEmpty(as: Array): as is NonEmptyArray { +/** + * @since 2.2.2 + */ +export function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray { return as.length > 0 } @@ -123,7 +131,7 @@ export const UnknownRecord: Decoder> = fromGuard(G.Unkno */ export function withExpected( decoder: Decoder, - expected: (actual: unknown, nea: NonEmptyArray>) => NonEmptyArray> + expected: (actual: unknown, e: DecodeError) => DecodeError ): Decoder { return { decode: (u) => @@ -423,16 +431,16 @@ export function union>( if (isRight(e)) { return e } else { - const forest: NonEmptyArray> = [tree(`member 0`, e.left)] + const errors: DecodeError = [tree(`member 0`, e.left)] for (let i = 1; i < len; i++) { const e = members[i].decode(u) if (isRight(e)) { return e } else { - forest.push(tree(`member ${i}`, e.left)) + errors.push(tree(`member ${i}`, e.left)) } } - return left(forest) + return left(errors) } } } diff --git a/src/Tree.ts b/src/Tree.ts index 79a38c17c..bd13b83fa 100644 --- a/src/Tree.ts +++ b/src/Tree.ts @@ -1,12 +1,12 @@ /** * @since 2.2.0 */ -import { drawTree, Tree } from 'fp-ts/lib/Tree' -import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' +import { drawTree } from 'fp-ts/lib/Tree' +import { DecodeError } from './Decoder' /** * @since 2.2.0 */ -export function draw(es: NonEmptyArray>): string { - return es.map(drawTree).join('\n') +export function draw(e: DecodeError): string { + return e.map(drawTree).join('\n') } From 163d9cecf382fc4e122d6990e44daa1f2462dc46 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 25 Apr 2020 08:21:04 +0200 Subject: [PATCH 013/222] add tests about getters --- test/Codec.ts | 26 ++++++++++++++++++++++++++ test/Guard.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/test/Codec.ts b/test/Codec.ts index d2b96caa5..20f1ec443 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -229,6 +229,19 @@ describe('Codec', () => { ]) ) }) + + it('should support getters', () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const codec = C.type({ a: C.string, b: C.string }) + assert.deepStrictEqual(codec.decode(new A()), right({ a: 'a', b: 'b' })) + }) }) describe('encode', () => { @@ -293,6 +306,19 @@ describe('Codec', () => { ]) ) }) + + it('should support getters', () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const codec = C.partial({ a: C.string, b: C.string }) + assert.deepStrictEqual(codec.decode(new A()), right({ a: 'a', b: 'b' })) + }) }) describe('encode', () => { diff --git a/test/Guard.ts b/test/Guard.ts index 1c65cf738..7d89a2193 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -52,6 +52,19 @@ describe('Guard', () => { const guard = G.type({ a: undef }) assert.strictEqual(guard.is({}), false) }) + + it('should support getters', () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const guard = G.type({ a: G.string, b: G.string }) + assert.deepStrictEqual(guard.is(new A()), true) + }) }) describe('partial', () => { @@ -73,6 +86,19 @@ describe('Guard', () => { assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is({ a: 'a', b: 'b' }), false) }) + + it('should support getters', () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const guard = G.partial({ a: G.string, b: G.string }) + assert.deepStrictEqual(guard.is(new A()), true) + }) }) describe('record', () => { From 478118b365d8c3ae022eaaace3da00892b8c86df Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 29 Apr 2020 09:11:40 +0200 Subject: [PATCH 014/222] move 2.1.x tests to its own folder --- declaration/index.ts | 179 ------------------ declaration/out/declaration/index.d.ts | 140 -------------- declaration/tsconfig.json | 12 -- package.json | 1 - test/{ => 2.1.x}/PathReporter.ts | 4 +- test/{ => 2.1.x}/ThrowReporter.ts | 4 +- test/{ => 2.1.x}/TypeClass.ts | 2 +- test/{ => 2.1.x}/array.ts | 2 +- test/{ => 2.1.x}/brand.ts | 2 +- test/{ => 2.1.x}/default-types.ts | 2 +- test/{ => 2.1.x}/exact.ts | 2 +- test/{ => 2.1.x}/helpers.ts | 4 +- test/{ => 2.1.x}/intersection.ts | 2 +- test/{ => 2.1.x}/keyof.ts | 2 +- test/{ => 2.1.x}/literal.ts | 2 +- test/{ => 2.1.x}/partial.ts | 2 +- test/{ => 2.1.x}/readonly.ts | 2 +- test/{ => 2.1.x}/readonlyArray.ts | 2 +- test/{ => 2.1.x}/record.ts | 2 +- test/{ => 2.1.x}/recursion.ts | 2 +- test/{ => 2.1.x}/refinement.ts | 2 +- test/{ => 2.1.x}/strict.ts | 2 +- .../strictInterfaceWithOptionals.ts | 2 +- test/{ => 2.1.x}/taggedUnion.ts | 2 +- test/{ => 2.1.x}/tuple.ts | 2 +- test/{ => 2.1.x}/type.ts | 2 +- test/{ => 2.1.x}/union.ts | 2 +- test/declaration.fixture | 140 -------------- test/declaration.ts | 11 -- 29 files changed, 26 insertions(+), 509 deletions(-) delete mode 100644 declaration/index.ts delete mode 100644 declaration/out/declaration/index.d.ts delete mode 100644 declaration/tsconfig.json rename test/{ => 2.1.x}/PathReporter.ts (94%) rename test/{ => 2.1.x}/ThrowReporter.ts (83%) rename test/{ => 2.1.x}/TypeClass.ts (98%) rename test/{ => 2.1.x}/array.ts (98%) rename test/{ => 2.1.x}/brand.ts (98%) rename test/{ => 2.1.x}/default-types.ts (99%) rename test/{ => 2.1.x}/exact.ts (99%) rename test/{ => 2.1.x}/helpers.ts (96%) rename test/{ => 2.1.x}/intersection.ts (99%) rename test/{ => 2.1.x}/keyof.ts (97%) rename test/{ => 2.1.x}/literal.ts (97%) rename test/{ => 2.1.x}/partial.ts (99%) rename test/{ => 2.1.x}/readonly.ts (98%) rename test/{ => 2.1.x}/readonlyArray.ts (98%) rename test/{ => 2.1.x}/record.ts (99%) rename test/{ => 2.1.x}/recursion.ts (99%) rename test/{ => 2.1.x}/refinement.ts (98%) rename test/{ => 2.1.x}/strict.ts (98%) rename test/{ => 2.1.x}/strictInterfaceWithOptionals.ts (98%) rename test/{ => 2.1.x}/taggedUnion.ts (99%) rename test/{ => 2.1.x}/tuple.ts (98%) rename test/{ => 2.1.x}/type.ts (99%) rename test/{ => 2.1.x}/union.ts (99%) delete mode 100644 test/declaration.fixture delete mode 100644 test/declaration.ts diff --git a/declaration/index.ts b/declaration/index.ts deleted file mode 100644 index 86231acb2..000000000 --- a/declaration/index.ts +++ /dev/null @@ -1,179 +0,0 @@ -import * as t from '../src' - -// -// interface -// - -const T1 = t.type({ - a: t.string -}) - -const T2 = t.type({ - b: T1 -}) - -const T3 = t.type({ - c: T2 -}) - -const T4 = t.type({ - d: T3 -}) - -export const T5 = t.type({ - e: T4 -}) - -// -// refinement -// - -export const R1 = t.refinement(T5, () => true) - -// -// recursion -// - -type R = { - a: number - b: R | undefined | null -} - -export const Rec1: t.Type = t.recursion('R1', self => - t.interface({ - a: t.number, - b: t.union([self, t.undefined, t.null]) - }) -) - -// -// array -// - -export const A1 = t.array(T5) - -// -// partial -// - -const P1 = t.partial({ - a: t.string -}) - -const P2 = t.partial({ - b: P1 -}) - -const P3 = t.partial({ - c: P2 -}) - -const P4 = t.partial({ - d: P3 -}) - -export const P5 = t.partial({ - e: P4 -}) - -// -// record -// - -const D1 = t.record(t.string, t.number) - -const D2 = t.record(t.string, D1) - -const D3 = t.record(t.string, D2) - -const D4 = t.record(t.string, D3) - -export const D5 = t.record(t.string, D4) - -// -// union -// - -export const U1 = t.union([T5, D5]) - -// -// intersection -// - -export const I1 = t.intersection([T5, D5]) - -// -// tuple -// - -export const Tu1 = t.tuple([T5, D5]) - -// -// readonly type -// - -export const RO1 = t.readonly(T5) - -// -// readonly array -// - -export const RA1 = t.readonlyArray(T5) - -// -// strict -// - -const S1 = t.strict({ - a: t.string -}) - -const S2 = t.strict({ - b: S1 -}) - -const S3 = t.strict({ - c: S2 -}) - -const S4 = t.strict({ - d: S3 -}) - -export const S5 = t.strict({ - e: S4 -}) - -// -// tagged union -// - -const TUMA = t.type({ - type: t.literal(true), - foo: t.string -}) - -const TUMB = t.type( - { - type: t.literal(false), - bar: t.number - }, - 'B' -) - -export const TU1 = t.taggedUnion('type', [TUMA, TUMB]) - -// -// exact -// - -export const E1 = t.exact(T5) - -// -// brand -// - -export const B1 = t.type({ - name: t.string, - age: t.Int -}) diff --git a/declaration/out/declaration/index.d.ts b/declaration/out/declaration/index.d.ts deleted file mode 100644 index 59398b990..000000000 --- a/declaration/out/declaration/index.d.ts +++ /dev/null @@ -1,140 +0,0 @@ -import * as t from '../src'; -export declare const T5: t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>; -export declare const R1: t.RefinementC; - }>; - }>; - }>; -}>>; -declare type R = { - a: number; - b: R | undefined | null; -}; -export declare const Rec1: t.Type; -export declare const A1: t.ArrayC; - }>; - }>; - }>; -}>>; -export declare const P5: t.PartialC<{ - e: t.PartialC<{ - d: t.PartialC<{ - c: t.PartialC<{ - b: t.PartialC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>; -export declare const D5: t.RecordC>>>>; -export declare const U1: t.UnionC<[t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>, t.RecordC>>>>]>; -export declare const I1: t.IntersectionC<[t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>, t.RecordC>>>>]>; -export declare const Tu1: t.TupleC<[t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>, t.RecordC>>>>]>; -export declare const RO1: t.ReadonlyC; - }>; - }>; - }>; -}>>; -export declare const RA1: t.ReadonlyArrayC; - }>; - }>; - }>; -}>>; -export declare const S5: t.ExactC>; - }>>; - }>>; - }>>; -}>>; -export declare const TU1: t.TaggedUnionC<"type", [t.TypeC<{ - type: t.LiteralC; - foo: t.StringC; -}>, t.TypeC<{ - type: t.LiteralC; - bar: t.NumberC; -}>]>; -export declare const E1: t.ExactC; - }>; - }>; - }>; -}>>; -export declare const B1: t.TypeC<{ - name: t.StringC; - age: t.BrandC; -}>; -export {}; diff --git a/declaration/tsconfig.json b/declaration/tsconfig.json deleted file mode 100644 index f08e871f8..000000000 --- a/declaration/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./out", - "declaration": true, - "module": "commonjs", - "strict": true, - "lib": ["es6"], - "emitDeclarationOnly": true, - "target": "es5" - }, - "include": ["./index.ts"] -} diff --git a/package.json b/package.json index 7cd921090..36ee0d90a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "prepublish": "npm run build", "perf": "ts-node perf/index", "dtslint": "dtslint dtslint", - "declaration": "tsc -p declaration/tsconfig.json", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", "doctoc": "doctoc README.md Type.md Decoder.md Encoder.md Codec.md", "docs": "docs-ts", diff --git a/test/PathReporter.ts b/test/2.1.x/PathReporter.ts similarity index 94% rename from test/PathReporter.ts rename to test/2.1.x/PathReporter.ts index 844818718..48b70cb65 100644 --- a/test/PathReporter.ts +++ b/test/2.1.x/PathReporter.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import * as t from '../src' -import { PathReporter } from '../src/PathReporter' +import * as t from '../../src' +import { PathReporter } from '../../src/PathReporter' import { NumberFromString } from './helpers' describe('PathReporter', () => { diff --git a/test/ThrowReporter.ts b/test/2.1.x/ThrowReporter.ts similarity index 83% rename from test/ThrowReporter.ts rename to test/2.1.x/ThrowReporter.ts index 1fbee867a..33ac2e3ed 100644 --- a/test/ThrowReporter.ts +++ b/test/2.1.x/ThrowReporter.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import * as t from '../src' -import { ThrowReporter } from '../src/ThrowReporter' +import * as t from '../../src' +import { ThrowReporter } from '../../src/ThrowReporter' describe('ThrowReporter', () => { it('should throw on invalid inputs', () => { diff --git a/test/TypeClass.ts b/test/2.1.x/TypeClass.ts similarity index 98% rename from test/TypeClass.ts rename to test/2.1.x/TypeClass.ts index 0a37d0cd1..c179b3e07 100644 --- a/test/TypeClass.ts +++ b/test/2.1.x/TypeClass.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import { Either, fold, right } from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertSuccess } from './helpers' const BAA = new t.Type( diff --git a/test/array.ts b/test/2.1.x/array.ts similarity index 98% rename from test/array.ts rename to test/2.1.x/array.ts index 0437ecb8a..e34a3079e 100644 --- a/test/array.ts +++ b/test/2.1.x/array.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertStrictSuccess, assertSuccess, NumberFromString } from './helpers' describe('array', () => { diff --git a/test/brand.ts b/test/2.1.x/brand.ts similarity index 98% rename from test/brand.ts rename to test/2.1.x/brand.ts index 2b70ada30..3c2e296f0 100644 --- a/test/brand.ts +++ b/test/2.1.x/brand.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' interface PositiveBrand { diff --git a/test/default-types.ts b/test/2.1.x/default-types.ts similarity index 99% rename from test/default-types.ts rename to test/2.1.x/default-types.ts index 2b4ca6baa..c9f34c6f4 100644 --- a/test/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure } from './helpers' describe('UnknownRecord', () => { diff --git a/test/exact.ts b/test/2.1.x/exact.ts similarity index 99% rename from test/exact.ts rename to test/2.1.x/exact.ts index 9d75ae81d..b4694e2d0 100644 --- a/test/exact.ts +++ b/test/2.1.x/exact.ts @@ -1,4 +1,4 @@ -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' import * as assert from 'assert' diff --git a/test/helpers.ts b/test/2.1.x/helpers.ts similarity index 96% rename from test/helpers.ts rename to test/2.1.x/helpers.ts index 2b66804ac..de7733520 100644 --- a/test/helpers.ts +++ b/test/2.1.x/helpers.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import { right, either, fold } from 'fp-ts/lib/Either' -import * as t from '../src/index' -import { PathReporter } from '../src/PathReporter' +import * as t from '../../src/index' +import { PathReporter } from '../../src/PathReporter' import { pipe } from 'fp-ts/lib/pipeable' export function assertStrictEqual(result: t.Validation, expected: any): void { diff --git a/test/intersection.ts b/test/2.1.x/intersection.ts similarity index 99% rename from test/intersection.ts rename to test/2.1.x/intersection.ts index 014c45ebb..5a0e2b2b8 100644 --- a/test/intersection.ts +++ b/test/2.1.x/intersection.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' describe('intersection', () => { diff --git a/test/keyof.ts b/test/2.1.x/keyof.ts similarity index 97% rename from test/keyof.ts rename to test/2.1.x/keyof.ts index 578e3c67c..736a89c08 100644 --- a/test/keyof.ts +++ b/test/2.1.x/keyof.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure } from './helpers' describe('keyof', () => { diff --git a/test/literal.ts b/test/2.1.x/literal.ts similarity index 97% rename from test/literal.ts rename to test/2.1.x/literal.ts index 058a78207..76b61a143 100644 --- a/test/literal.ts +++ b/test/2.1.x/literal.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure } from './helpers' describe('literal', () => { diff --git a/test/partial.ts b/test/2.1.x/partial.ts similarity index 99% rename from test/partial.ts rename to test/2.1.x/partial.ts index 60240005a..cfa811972 100644 --- a/test/partial.ts +++ b/test/2.1.x/partial.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, assertStrictEqual, withDefault, NumberFromString } from './helpers' describe('partial', () => { diff --git a/test/readonly.ts b/test/2.1.x/readonly.ts similarity index 98% rename from test/readonly.ts rename to test/2.1.x/readonly.ts index f077ba738..42f6100b9 100644 --- a/test/readonly.ts +++ b/test/2.1.x/readonly.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, NumberFromString } from './helpers' import { either } from 'fp-ts/lib/Either' diff --git a/test/readonlyArray.ts b/test/2.1.x/readonlyArray.ts similarity index 98% rename from test/readonlyArray.ts rename to test/2.1.x/readonlyArray.ts index 991ce2d83..71ccd09eb 100644 --- a/test/readonlyArray.ts +++ b/test/2.1.x/readonlyArray.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, NumberFromString } from './helpers' import { either } from 'fp-ts/lib/Either' diff --git a/test/record.ts b/test/2.1.x/record.ts similarity index 99% rename from test/record.ts rename to test/2.1.x/record.ts index d0884fc3b..f925e8be1 100644 --- a/test/record.ts +++ b/test/2.1.x/record.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertStrictEqual, diff --git a/test/recursion.ts b/test/2.1.x/recursion.ts similarity index 99% rename from test/recursion.ts rename to test/2.1.x/recursion.ts index 537c474c4..5a1001b1a 100644 --- a/test/recursion.ts +++ b/test/2.1.x/recursion.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' type T = { diff --git a/test/refinement.ts b/test/2.1.x/refinement.ts similarity index 98% rename from test/refinement.ts rename to test/2.1.x/refinement.ts index 596a342d5..8e303f9a9 100644 --- a/test/refinement.ts +++ b/test/2.1.x/refinement.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, assertStrictEqual, IntegerFromString, NumberFromString } from './helpers' describe('refinement', () => { diff --git a/test/strict.ts b/test/2.1.x/strict.ts similarity index 98% rename from test/strict.ts rename to test/2.1.x/strict.ts index 35a4cf7d4..0717e2b98 100644 --- a/test/strict.ts +++ b/test/2.1.x/strict.ts @@ -1,4 +1,4 @@ -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' import * as assert from 'assert' diff --git a/test/strictInterfaceWithOptionals.ts b/test/2.1.x/strictInterfaceWithOptionals.ts similarity index 98% rename from test/strictInterfaceWithOptionals.ts rename to test/2.1.x/strictInterfaceWithOptionals.ts index 836ebab73..50e9219a8 100644 --- a/test/strictInterfaceWithOptionals.ts +++ b/test/2.1.x/strictInterfaceWithOptionals.ts @@ -1,4 +1,4 @@ -import * as t from '../src/index' +import * as t from '../../src/index' import { assertSuccess, assertFailure, NumberFromString } from './helpers' import * as assert from 'assert' diff --git a/test/taggedUnion.ts b/test/2.1.x/taggedUnion.ts similarity index 99% rename from test/taggedUnion.ts rename to test/2.1.x/taggedUnion.ts index 95e6388d8..32e177ab3 100644 --- a/test/taggedUnion.ts +++ b/test/2.1.x/taggedUnion.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' // tslint:disable-next-line: deprecation diff --git a/test/tuple.ts b/test/2.1.x/tuple.ts similarity index 98% rename from test/tuple.ts rename to test/2.1.x/tuple.ts index 461ec151a..6f574b4af 100644 --- a/test/tuple.ts +++ b/test/2.1.x/tuple.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' describe('tuple', () => { diff --git a/test/type.ts b/test/2.1.x/type.ts similarity index 99% rename from test/type.ts rename to test/2.1.x/type.ts index 813dbb8a6..66be70f60 100644 --- a/test/type.ts +++ b/test/2.1.x/type.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import { fold } from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' describe('type', () => { diff --git a/test/union.ts b/test/2.1.x/union.ts similarity index 99% rename from test/union.ts rename to test/2.1.x/union.ts index 0ca2a3c3e..1410dfad4 100644 --- a/test/union.ts +++ b/test/2.1.x/union.ts @@ -1,5 +1,5 @@ import * as assert from 'assert' -import * as t from '../src/index' +import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' import { either } from 'fp-ts/lib/Either' diff --git a/test/declaration.fixture b/test/declaration.fixture deleted file mode 100644 index 59398b990..000000000 --- a/test/declaration.fixture +++ /dev/null @@ -1,140 +0,0 @@ -import * as t from '../src'; -export declare const T5: t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>; -export declare const R1: t.RefinementC; - }>; - }>; - }>; -}>>; -declare type R = { - a: number; - b: R | undefined | null; -}; -export declare const Rec1: t.Type; -export declare const A1: t.ArrayC; - }>; - }>; - }>; -}>>; -export declare const P5: t.PartialC<{ - e: t.PartialC<{ - d: t.PartialC<{ - c: t.PartialC<{ - b: t.PartialC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>; -export declare const D5: t.RecordC>>>>; -export declare const U1: t.UnionC<[t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>, t.RecordC>>>>]>; -export declare const I1: t.IntersectionC<[t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>, t.RecordC>>>>]>; -export declare const Tu1: t.TupleC<[t.TypeC<{ - e: t.TypeC<{ - d: t.TypeC<{ - c: t.TypeC<{ - b: t.TypeC<{ - a: t.StringC; - }>; - }>; - }>; - }>; -}>, t.RecordC>>>>]>; -export declare const RO1: t.ReadonlyC; - }>; - }>; - }>; -}>>; -export declare const RA1: t.ReadonlyArrayC; - }>; - }>; - }>; -}>>; -export declare const S5: t.ExactC>; - }>>; - }>>; - }>>; -}>>; -export declare const TU1: t.TaggedUnionC<"type", [t.TypeC<{ - type: t.LiteralC; - foo: t.StringC; -}>, t.TypeC<{ - type: t.LiteralC; - bar: t.NumberC; -}>]>; -export declare const E1: t.ExactC; - }>; - }>; - }>; -}>>; -export declare const B1: t.TypeC<{ - name: t.StringC; - age: t.BrandC; -}>; -export {}; diff --git a/test/declaration.ts b/test/declaration.ts deleted file mode 100644 index 1cad00dbc..000000000 --- a/test/declaration.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as assert from 'assert' -import { readFileSync } from 'fs' - -const actual = readFileSync('./declaration/out/declaration/index.d.ts').toString() -const expected = readFileSync('./test/declaration.fixture').toString() - -describe('emitted declaration file', () => { - it('should emit nested types', () => { - assert.strictEqual(actual, expected) - }) -}) From 4ece661cee4c60691e8eecaab6ca1a84308eb6c4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 29 Apr 2020 10:19:21 +0200 Subject: [PATCH 015/222] add property based tests --- jest.config.js | 2 +- package-lock.json | 18 ++++++- package.json | 3 +- test/Arbitrary.ts | 133 +++++++++++++++++++++++++++++++++++++++++++++ test/Schema.ts | 135 ++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 278 insertions(+), 13 deletions(-) create mode 100644 test/Arbitrary.ts diff --git a/jest.config.js b/jest.config.js index 247b38771..ea4cd8f60 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,5 +16,5 @@ module.exports = { statements: 100 } }, - modulePathIgnorePatterns: ['helpers.ts'] + modulePathIgnorePatterns: ['2.1.x/helpers.ts', 'Arbitrary.ts'] } diff --git a/package-lock.json b/package-lock.json index c7d3109cb..30d56f41c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.1.3", + "version": "2.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2482,6 +2482,16 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, + "fast-check": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-1.24.2.tgz", + "integrity": "sha512-ZL48cyZZLJnVsUj127Zi1mfFLM98yzw0LlSSH8CMeVmpL5RCfSRcZSZZ0kJWrRK4eOgNFnXXKNDbzuRb3Vsdhg==", + "dev": true, + "requires": { + "pure-rand": "^2.0.0", + "tslib": "^1.10.0" + } + }, "fast-deep-equal": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", @@ -5883,6 +5893,12 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "pure-rand": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-2.0.0.tgz", + "integrity": "sha512-mk98aayyd00xbfHgE3uEmAUGzz3jCdm8Mkf5DUXUhc7egmOaGG2D7qhVlynGenNe9VaNJZvzO9hkc8myuTkDgw==", + "dev": true + }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", diff --git a/package.json b/package.json index 36ee0d90a..287dbef9d 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "jest": "jest", "prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"", "fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples,exercises}/**/*.ts\"", - "test": "npm run prettier && npm run lint && npm run dtslint && npm run declaration && npm run jest && npm run docs", + "test": "npm run prettier && npm run lint && npm run dtslint && npm run jest && npm run docs", "clean": "rimraf lib/* es6/*", "build": "npm run clean && tsc && tsc -p tsconfig.es6.json && npm run import-path-rewrite", "prepublish": "npm run build", @@ -48,6 +48,7 @@ "docs-ts": "0.4.0", "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", + "fast-check": "^1.24.2", "fp-ts": "2.5.3", "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts new file mode 100644 index 000000000..bc2bf6c2a --- /dev/null +++ b/test/Arbitrary.ts @@ -0,0 +1,133 @@ +/** + * An instance of `Schemable` for `fast-check` arbitraries that emit valid values + */ +import * as fc from 'fast-check' +import * as S from '../src/Schemable' +import { intersect } from '../src/Decoder' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +export interface Arbitrary extends fc.Arbitrary {} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +export function literal>(...values: A): Arbitrary { + return fc.oneof(...values.map((v) => fc.constant(v))) +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +export const string: Arbitrary = fc.oneof( + fc.string(), + fc.asciiString(), + fc.fullUnicodeString(), + fc.hexaString(), + fc.lorem() +) + +export const number: Arbitrary = fc.oneof(fc.float(), fc.double(), fc.integer()) + +export const boolean: Arbitrary = fc.boolean() + +export const UnknownArray: Arbitrary> = fc.array(fc.anything()) + +export const UnknownRecord: Arbitrary> = fc.dictionary(string, fc.anything()) + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +export function nullable(or: Arbitrary): Arbitrary { + return fc.oneof(fc.constant(null), or) +} + +export function type(properties: { [K in keyof A]: Arbitrary }): Arbitrary { + return fc.record(properties) +} + +export function partial(properties: { [K in keyof A]: Arbitrary }): Arbitrary> { + const keys = fc.oneof(...Object.keys(properties).map((p) => fc.constant(p))) + return keys.chain((key) => { + const p: any = { ...properties } + delete p[key] + return fc.record(p) + }) +} + +export function record(codomain: Arbitrary): Arbitrary> { + return fc.dictionary(string, codomain) +} + +export function array(items: Arbitrary): Arbitrary> { + return fc.array(items) +} + +export function tuple>( + ...components: { [K in keyof A]: Arbitrary } +): Arbitrary { + if (components.length === 0) { + return fc.constant([]) as any + } + return (fc.tuple as any)(...components) +} + +export function intersection(left: Arbitrary, right: Arbitrary): Arbitrary { + return fc.tuple(left, right).map(([a, b]) => intersect(a, b)) +} + +export function sum( + _tag: T +): (members: { [K in keyof A]: Arbitrary> }) => Arbitrary { + return (members: Record>) => fc.oneof(...Object.keys(members).map((k) => members[k])) +} + +export function lazy(f: () => Arbitrary): Arbitrary { + const get = S.memoize>(f) + return fc.constant(null).chain(() => get()) +} + +export function union>( + ...members: { [K in keyof A]: Arbitrary } +): Arbitrary { + return fc.oneof(...members) +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +export const URI = 'Arbitrary' + +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly Arbitrary: Arbitrary + } +} + +export const arbitrary: S.Schemable & S.WithUnion = { + URI, + literal, + string, + number, + boolean, + UnknownArray, + UnknownRecord, + nullable, + type, + partial, + record, + array, + tuple: tuple as S.Schemable['tuple'], + intersection, + sum, + lazy: (_, f) => lazy(f), + union +} diff --git a/test/Schema.ts b/test/Schema.ts index 6b8f2a614..8724abbfc 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,19 +1,45 @@ -import * as assert from 'assert' -import { right } from 'fp-ts/lib/Either' +import { isRight, right } from 'fp-ts/lib/Either' +import { Schema, make } from '../src/Schema' +import * as G from '../src/Guard' import * as D from '../src/Decoder' -import * as S from '../src/Schema' import * as E from '../src/Encoder' -import * as G from '../src/Guard' import * as C from '../src/Codec' +import * as A from './Arbitrary' +import * as fc from 'fast-check' +import * as assert from 'assert' -const Person = S.make((S) => - S.type({ - name: S.string, - age: S.number - }) -) +function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { + try { + assert.deepStrictEqual(actual, expected) + return true + } catch { + return false + } +} +function check(schema: Schema): void { + const arb = schema(A.arbitrary) + const codec = schema(C.codec) + const guard = schema(G.guard) + // decoders and guards should be aligned + fc.assert(fc.property(arb, (a) => guard.is(a) && isRight(codec.decode(a)))) + // laws + fc.assert(fc.property(arb, (a) => isRight(codec.decode(codec.encode(a))))) + fc.assert( + fc.property(arb, (u) => { + const a = codec.decode(u) + return isRight(a) && isDeepStrictEqual(codec.encode(a.right), u) + }) + ) +} describe('Schemable', () => { + const Person = make((S) => + S.type({ + name: S.string, + age: S.number + }) + ) + it('should handle decoders', () => { assert.deepStrictEqual(Person(D.decoder).decode({ name: 'name', age: 46 }), right({ name: 'name', age: 46 })) }) @@ -30,4 +56,93 @@ describe('Schemable', () => { assert.deepStrictEqual(Person(C.codec).decode({ name: 'name', age: 46 }), right({ name: 'name', age: 46 })) assert.deepStrictEqual(Person(E.encoder).encode({ name: 'name', age: 46 }), { name: 'name', age: 46 }) }) + + it('string', () => { + check(make((S) => S.string)) + }) + + it('number', () => { + check(make((S) => S.number)) + }) + + it('boolean', () => { + check(make((S) => S.boolean)) + }) + + it('UnknownArray', () => { + check(make((S) => S.UnknownArray)) + }) + + it('UnknownRecord', () => { + check(make((S) => S.UnknownRecord)) + }) + + it('literal', () => { + check(make((S) => S.literal('a'))) + check(make((S) => S.literal('a', 1))) + check(make((S) => S.literal('a', null))) + }) + + it('nullable', () => { + check(make((S) => S.nullable(S.string))) + }) + + it('type', () => { + check( + make((S) => + S.type({ + name: S.string, + age: S.number + }) + ) + ) + }) + + it('partial', () => { + check( + make((S) => + S.partial({ + name: S.string, + age: S.number + }) + ) + ) + }) + + it('record', () => { + check(make((S) => S.record(S.string))) + }) + + it('array', () => { + check(make((S) => S.array(S.string))) + }) + + it('tuple', () => { + check(make((S) => S.tuple())) + check(make((S) => S.tuple(S.string))) + check(make((S) => S.tuple(S.string, S.number))) + }) + + it('intersection', () => { + check(make((S) => S.intersection(S.type({ a: S.string }), S.type({ b: S.number })))) + }) + + it('sum', () => { + const A = make((S) => S.type({ _tag: S.literal('A'), a: S.string })) + const B = make((S) => S.type({ _tag: S.literal('B'), b: S.number })) + check(make((S) => S.sum('_tag')({ A: A(S), B: B(S) }))) + }) + + it('lazy', () => { + interface A { + a: string + b?: A + c?: number + } + + const schema: Schema = make((S) => + S.lazy('A', () => S.intersection(S.type({ a: S.string }), S.partial({ b: schema(S), c: S.number }))) + ) + check(schema) + }) }) From 9fde17c3a61f90456ee57823915c55a52c202d4c Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 2 May 2020 14:05:24 +0200 Subject: [PATCH 016/222] add `Eq` experimental module --- CHANGELOG.md | 1 + Eq.md | 70 ++++++++++++ README.md | 2 + Schema.md | 2 + docs/modules/Eq.ts.md | 183 ++++++++++++++++++++++++++++++++ docs/modules/Guard.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/Tree.ts.md | 2 +- docs/modules/index.ts.md | 2 +- package.json | 2 +- src/Eq.ts | 163 ++++++++++++++++++++++++++++ test/Eq.ts | 81 ++++++++++++++ test/Schema.ts | 12 ++- 16 files changed, 519 insertions(+), 11 deletions(-) create mode 100644 Eq.md create mode 100644 docs/modules/Eq.ts.md create mode 100644 src/Eq.ts create mode 100644 test/Eq.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 00bbe4e4e..779270c41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ # 2.2.2 - **Experimental** + - add `Eq` module (@gcanti) - `Decoder` - add `DecodeError` interface (@gcanti) diff --git a/Eq.md b/Eq.md new file mode 100644 index 000000000..0a3828586 --- /dev/null +++ b/Eq.md @@ -0,0 +1,70 @@ + + + +- [Eq interface](#eq-interface) +- [Built-in primitive eqs](#built-in-primitive-eqs) +- [Combinators](#combinators) + + + +# Eq interface + +```ts +export interface Eq { + readonly equals: (x: A, y: A) => boolean +} +``` + +The `Eq` type class represents types which support decidable equality. + +Instances must satisfy the following laws: + +1. Reflexivity: `E.equals(a, a) === true` +2. Symmetry: `E.equals(a, b) === E.equals(b, a)` +3. Transitivity: if `E.equals(a, b) === true` and `E.equals(b, c) === true`, then `E.equals(a, c) === true` + +**Example** + +```ts +import { Eq } from 'fp-ts/lib/Eq' + +export const string: Eq = { + equals: (x, y) => x === y +} +``` + +# Built-in primitive eqs + +- `string: Eq` +- `number: Eq` +- `boolean: Eq` +- `UnknownArray: Eq>` +- `UnknownRecord: Eq>` + +# Combinators + +- `literal` +- `nullable` +- `type` +- `partial` +- `record` +- `array` +- `tuple` +- `intersection` +- `sum` +- `lazy` + +**Example** + +```ts +import * as E from 'io-ts/lib/Eq' + +const Person = E.type({ + name: E.string, + age: E.number +}) + +console.log(Person.equals({ name: 'a', age: 0 }, { name: 'a', age: 0 })) // => true +console.log(Person.equals({ name: 'a', age: 0 }, { name: '', age: 0 })) // => false +console.log(Person.equals({ name: 'a', age: 0 }, { name: 'a', age: 1 })) // => false +``` diff --git a/README.md b/README.md index 3971ad76b..5d9cb74f0 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ - [Installation](#installation) - [Documentation](#documentation) + - [Usage](#usage) @@ -38,4 +39,5 @@ Experimental features are published in order to get early feedback from the comm - [`Decoder`](Decoder.md) - [`Encoder`](Encoder.md) - [`Codec`](Codec.md) +- [`Eq`](Eq.md) - [`Schema` (advanced feature)](Schema.md) diff --git a/Schema.md b/Schema.md index b25172325..afc0546e7 100644 --- a/Schema.md +++ b/Schema.md @@ -8,6 +8,7 @@ import * as D from 'io-ts/lib/Decoder' import * as E from 'io-ts/lib/Encoder' import * as C from 'io-ts/lib/Codec' import * as G from 'io-ts/lib/Guard' +import * as Eq from 'io-ts/lib/Eq' export const Person = S.make((S) => S.type({ @@ -20,4 +21,5 @@ export const PersonDecoder = Person(D.decoder) export const PersonEncoder = Person(E.encoder) export const PersonCodec = Person(C.codec) export const PersonGuard = Person(G.guard) +export const PersonEq = Person(Eq.eq) ``` diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md new file mode 100644 index 000000000..dd505bb33 --- /dev/null +++ b/docs/modules/Eq.ts.md @@ -0,0 +1,183 @@ +--- +title: Eq.ts +nav_order: 4 +parent: Modules +--- + +# Eq overview + +Added in v2.2.2 + +--- + +

Table of contents

+ +- [UnknownArray](#unknownarray) +- [UnknownRecord](#unknownrecord) +- [array](#array) +- [boolean](#boolean) +- [eq](#eq) +- [intersection](#intersection) +- [lazy](#lazy) +- [nullable](#nullable) +- [number](#number) +- [partial](#partial) +- [record](#record) +- [string](#string) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) + +--- + +# UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: E.Eq +``` + +Added in v2.2.2 + +# UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: E.Eq> +``` + +Added in v2.2.2 + +# array + +**Signature** + +```ts +export declare const array:
(eq: E.Eq) => E.Eq +``` + +Added in v2.2.2 + +# boolean + +**Signature** + +```ts +export declare const boolean: E.Eq +``` + +Added in v2.2.2 + +# eq + +**Signature** + +```ts +export declare const eq: Contravariant1<'Eq'> & S.Schemable<'Eq'> +``` + +Added in v2.2.2 + +# intersection + +**Signature** + +```ts +export declare function intersection(left: Eq, right: Eq): Eq +``` + +Added in v2.2.2 + +# lazy + +**Signature** + +```ts +export declare function lazy(f: () => Eq): Eq +``` + +Added in v2.2.2 + +# nullable + +**Signature** + +```ts +export declare function nullable(or: Eq): Eq +``` + +Added in v2.2.2 + +# number + +**Signature** + +```ts +export declare const number: E.Eq +``` + +Added in v2.2.2 + +# partial + +**Signature** + +```ts +export declare function partial(properties: { [K in keyof A]: Eq }): Eq> +``` + +Added in v2.2.2 + +# record + +**Signature** + +```ts +export declare const record: (codomain: E.Eq) => E.Eq> +``` + +Added in v2.2.2 + +# string + +**Signature** + +```ts +export declare const string: E.Eq +``` + +Added in v2.2.2 + +# sum + +**Signature** + +```ts +export declare function sum( + tag: T +): (members: { [K in keyof A]: Eq> }) => Eq +``` + +Added in v2.2.2 + +# tuple + +**Signature** + +```ts +export declare const tuple: (...components: { [K in keyof A]: E.Eq }) => E.Eq +``` + +Added in v2.2.2 + +# type + +**Signature** + +```ts +export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq +``` + +Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 4bd61f1f4..96f5b3913 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -1,6 +1,6 @@ --- title: Guard.ts -nav_order: 4 +nav_order: 5 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 4116f4410..e46f4619e 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 6 +nav_order: 7 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index a76c04874..29f039bdc 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 7 +nav_order: 8 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 6500e9c89..634ad876e 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 8 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 2c38c3deb..afd53b2ed 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 9 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index 8a97417e3..4b880a000 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -1,6 +1,6 @@ --- title: Tree.ts -nav_order: 10 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 3bcd78e48..f3f3a66c9 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 5 +nav_order: 6 parent: Modules --- diff --git a/package.json b/package.json index 287dbef9d..0fe71f424 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "perf": "ts-node perf/index", "dtslint": "dtslint dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", - "doctoc": "doctoc README.md Type.md Decoder.md Encoder.md Codec.md", + "doctoc": "doctoc README.md Type.md Decoder.md Encoder.md Codec.md Eq.md", "docs": "docs-ts", "import-path-rewrite": "import-path-rewrite" }, diff --git a/src/Eq.ts b/src/Eq.ts new file mode 100644 index 000000000..e29ad77e5 --- /dev/null +++ b/src/Eq.ts @@ -0,0 +1,163 @@ +/** + * @since 2.2.2 + */ +import * as A from 'fp-ts/lib/Array' +import * as E from 'fp-ts/lib/Eq' +import * as R from 'fp-ts/lib/Record' +import * as S from './Schemable' +import Eq = E.Eq + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.2 + */ +export const string: Eq = E.eqString + +/** + * @since 2.2.2 + */ +export const number: Eq = E.eqNumber + +/** + * @since 2.2.2 + */ +export const boolean: Eq = E.eqBoolean + +/** + * @since 2.2.2 + */ +export const UnknownArray: Eq> = E.fromEquals((x, y) => x.length === y.length) + +/** + * @since 2.2.2 + */ +export const UnknownRecord: Eq> = E.fromEquals((x, y) => { + for (const k in x) { + if (!(k in y)) { + return false + } + } + for (const k in y) { + if (!(k in x)) { + return false + } + } + return true +}) + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.2 + */ +export function nullable(or: Eq): Eq { + return { + equals: (x, y) => (x === null || y === null ? x === y : or.equals(x, y)) + } +} + +/** + * @since 2.2.2 + */ +export const type: (eqs: { [K in keyof A]: Eq }) => Eq = E.getStructEq + +/** + * @since 2.2.2 + */ +export function partial(properties: { [K in keyof A]: Eq }): Eq> { + return { + equals: (x, y) => { + for (const k in properties) { + const xk = x[k] + const yk = y[k] + if (!(xk === undefined || yk === undefined ? xk === yk : properties[k].equals(xk!, yk!))) { + return false + } + } + return true + } + } +} + +/** + * @since 2.2.2 + */ +export const record: (codomain: Eq) => Eq> = R.getEq + +/** + * @since 2.2.2 + */ +export const array: (eq: Eq) => Eq> = A.getEq + +/** + * @since 2.2.2 + */ +export const tuple: >( + ...components: { [K in keyof A]: Eq } +) => Eq = E.getTupleEq as any + +/** + * @since 2.2.2 + */ +export function intersection(left: Eq, right: Eq): Eq { + return { + equals: (x, y) => left.equals(x, y) && right.equals(x, y) + } +} + +/** + * @since 2.2.2 + */ +export function sum( + tag: T +): (members: { [K in keyof A]: Eq> }) => Eq { + return (members: Record>) => { + return { + equals: (x: Record, y: Record) => { + const vx = x[tag] + const vy = y[tag] + if (vx !== vy) { + return false + } + return members[vx].equals(x, y) + } + } + } +} + +/** + * @since 2.2.2 + */ +export function lazy(f: () => Eq): Eq { + const get = S.memoize>(f) + return { + equals: (x, y) => get().equals(x, y) + } +} + +/** + * @since 2.2.2 + */ +export const eq: typeof E.eq & S.Schemable = { + ...E.eq, + literal: () => E.eqStrict, + string, + number, + boolean, + UnknownArray, + UnknownRecord, + nullable, + type, + partial, + record, + array, + tuple, + intersection, + sum, + lazy: (_, f) => lazy(f) +} diff --git a/test/Eq.ts b/test/Eq.ts new file mode 100644 index 000000000..2c9dbe0c9 --- /dev/null +++ b/test/Eq.ts @@ -0,0 +1,81 @@ +import * as assert from 'assert' +import * as E from '../src/Eq' +import { Eq } from 'fp-ts/lib/Eq' + +describe('Eq', () => { + it('literal', () => { + const eq = E.eq.literal('a', null) + assert.deepStrictEqual(eq.equals('a', 'a'), true) + assert.deepStrictEqual(eq.equals(null, null), true) + assert.deepStrictEqual(eq.equals('a', null), false) + }) + + it('UnknownArray', () => { + const eq = E.UnknownArray + assert.deepStrictEqual(eq.equals(['a'], ['a']), true) + assert.deepStrictEqual(eq.equals(['a'], ['b']), true) + assert.deepStrictEqual(eq.equals(['a'], ['a', 'b']), false) + }) + + it('UnknownRecord', () => { + const eq = E.UnknownRecord + assert.deepStrictEqual(eq.equals({}, {}), true) + assert.deepStrictEqual(eq.equals({ a: 1 }, { a: 1 }), true) + assert.deepStrictEqual(eq.equals({ a: 1 }, { a: 1, b: true }), false) + assert.deepStrictEqual(eq.equals({ a: 1, b: true }, { a: 1 }), false) + }) + + it('partial', () => { + const eq = E.partial({ a: E.number }) + assert.deepStrictEqual(eq.equals({ a: 1 }, { a: 1 }), true) + assert.deepStrictEqual(eq.equals({ a: undefined }, { a: undefined }), true) + assert.deepStrictEqual(eq.equals({}, { a: undefined }), true) + assert.deepStrictEqual(eq.equals({}, {}), true) + assert.deepStrictEqual(eq.equals({ a: 1 }, {}), false) + }) + + it('tuple', () => { + const eq = E.tuple(E.string, E.number) + assert.deepStrictEqual(eq.equals(['a', 1], ['a', 1]), true) + assert.deepStrictEqual(eq.equals(['a', 1], ['b', 1]), false) + assert.deepStrictEqual(eq.equals(['a', 1], ['a', 2]), false) + }) + + it('intersection', () => { + const eq = E.intersection(E.type({ a: E.string }), E.type({ b: E.number })) + assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'a', b: 1 }), true) + assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'c', b: 1 }), false) + assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'a', b: 2 }), false) + }) + + it('lazy', () => { + interface A { + a: number + b: Array + } + + const eq: Eq = E.eq.lazy('A', () => + E.type({ + a: E.number, + b: E.array(eq) + }) + ) + assert.strictEqual(eq.equals({ a: 1, b: [] }, { a: 1, b: [] }), true) + assert.strictEqual(eq.equals({ a: 1, b: [{ a: 2, b: [] }] }, { a: 1, b: [{ a: 2, b: [] }] }), true) + assert.strictEqual(eq.equals({ a: 1, b: [] }, { a: 2, b: [] }), false) + assert.strictEqual(eq.equals({ a: 1, b: [{ a: 2, b: [] }] }, { a: 1, b: [{ a: 3, b: [] }] }), false) + }) + + it('sum', () => { + const sum = E.sum('_tag') + const eq = sum({ + A: E.type({ _tag: E.eq.literal('A'), a: E.string }), + B: E.type({ _tag: E.eq.literal('B'), b: E.number }) + }) + assert.strictEqual(eq.equals({ _tag: 'A', a: 'a' }, { _tag: 'A', a: 'a' }), true) + assert.strictEqual(eq.equals({ _tag: 'B', b: 1 }, { _tag: 'B', b: 1 }), true) + assert.strictEqual(eq.equals({ _tag: 'A', a: 'a' }, { _tag: 'B', b: 1 }), false) + assert.strictEqual(eq.equals({ _tag: 'A', a: 'a' }, { _tag: 'A', a: 'b' }), false) + assert.strictEqual(eq.equals({ _tag: 'B', b: 1 }, { _tag: 'B', b: 2 }), false) + }) +}) diff --git a/test/Schema.ts b/test/Schema.ts index 8724abbfc..2db29baf3 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -4,6 +4,7 @@ import * as G from '../src/Guard' import * as D from '../src/Decoder' import * as E from '../src/Encoder' import * as C from '../src/Codec' +import * as Eq from '../src/Eq' import * as A from './Arbitrary' import * as fc from 'fast-check' import * as assert from 'assert' @@ -21,14 +22,19 @@ function check(schema: Schema): void { const arb = schema(A.arbitrary) const codec = schema(C.codec) const guard = schema(G.guard) - // decoders and guards should be aligned - fc.assert(fc.property(arb, (a) => guard.is(a) && isRight(codec.decode(a)))) + const eq = schema(Eq.eq) + // decoders, guards and eqs should be aligned + fc.assert(fc.property(arb, (a) => isRight(codec.decode(a)) && guard.is(a) && eq.equals(a, a))) // laws fc.assert(fc.property(arb, (a) => isRight(codec.decode(codec.encode(a))))) fc.assert( fc.property(arb, (u) => { const a = codec.decode(u) - return isRight(a) && isDeepStrictEqual(codec.encode(a.right), u) + if (isRight(a)) { + const o = a.right + return isDeepStrictEqual(codec.encode(o), u) && eq.equals(o, u) + } + return false }) ) } From 42a100095f21f01563f1f855e3527565e704e830 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sat, 2 May 2020 17:49:50 +0200 Subject: [PATCH 017/222] Update test/Eq.ts Co-authored-by: Misha Kaletsky <15040698+mmkal@users.noreply.github.com> --- test/Eq.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Eq.ts b/test/Eq.ts index 2c9dbe0c9..525fa3321 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -21,6 +21,7 @@ describe('Eq', () => { const eq = E.UnknownRecord assert.deepStrictEqual(eq.equals({}, {}), true) assert.deepStrictEqual(eq.equals({ a: 1 }, { a: 1 }), true) + assert.deepStrictEqual(eq.equals({ a: 1 }, { a: 2 }), true) assert.deepStrictEqual(eq.equals({ a: 1 }, { a: 1, b: true }), false) assert.deepStrictEqual(eq.equals({ a: 1, b: true }, { a: 1 }), false) }) From e9a608ee54485a8d6a44e49f22e682eb1fbea6eb Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 4 May 2020 09:04:29 +0200 Subject: [PATCH 018/222] add `TypeOf` operator to Codec, Encoder, Eq and Guard, closes #462 --- CHANGELOG.md | 6 ++++++ docs/modules/Codec.ts.md | 11 +++++++++++ docs/modules/Encoder.ts.md | 11 +++++++++++ docs/modules/Eq.ts.md | 11 +++++++++++ docs/modules/Guard.ts.md | 11 +++++++++++ src/Codec.ts | 5 +++++ src/Encoder.ts | 5 +++++ src/Eq.ts | 5 +++++ src/Guard.ts | 5 +++++ 9 files changed, 70 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 779270c41..dff067948 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,14 @@ - **Experimental** - add `Eq` module (@gcanti) + - `Codec` + - add `TypeOf` operator (@gcanti) - `Decoder` - add `DecodeError` interface (@gcanti) + - `Encoder` + - add `TypeOf` operator (@gcanti) + - `Guard` + - add `TypeOf` operator (@gcanti) # 2.2.1 diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 6f827aa85..18cde81a2 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -13,6 +13,7 @@ Added in v2.2.0

Table of contents

- [Codec (interface)](#codec-interface) +- [TypeOf (type alias)](#typeof-type-alias) - [URI (type alias)](#uri-type-alias) - [URI](#uri) - [UnknownArray](#unknownarray) @@ -52,6 +53,16 @@ export interface Codec
extends D.Decoder, E.Encoder {} Added in v2.2.0 +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = C extends Codec ? A : never +``` + +Added in v2.2.2 + # URI (type alias) **Signature** diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 7450dd611..efeb677eb 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -13,6 +13,7 @@ Added in v2.2.0

Table of contents

- [Encoder (interface)](#encoder-interface) +- [TypeOf (type alias)](#typeof-type-alias) - [URI (type alias)](#uri-type-alias) - [URI](#uri) - [array](#array) @@ -42,6 +43,16 @@ export interface Encoder
{ Added in v2.2.0 +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = E extends Encoder ? A : never +``` + +Added in v2.2.2 + # URI (type alias) **Signature** diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index dd505bb33..a55a06cb4 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -12,6 +12,7 @@ Added in v2.2.2

Table of contents

+- [TypeOf (type alias)](#typeof-type-alias) - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) - [array](#array) @@ -30,6 +31,16 @@ Added in v2.2.2 --- +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = E extends Eq ? A : never +``` + +Added in v2.2.2 + # UnknownArray **Signature** diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 96f5b3913..ebbd591a2 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -13,6 +13,7 @@ Added in v2.2.0

Table of contents

- [Guard (interface)](#guard-interface) +- [TypeOf (type alias)](#typeof-type-alias) - [URI (type alias)](#uri-type-alias) - [URI](#uri) - [UnknownArray](#unknownarray) @@ -49,6 +50,16 @@ export interface Guard
{ Added in v2.2.0 +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = G extends Guard ? A : never +``` + +Added in v2.2.2 + # URI (type alias) **Signature** diff --git a/src/Codec.ts b/src/Codec.ts index 1f70d3d53..9e52a0dc8 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -20,6 +20,11 @@ import { Schemable, Literal } from './Schemable' */ export interface Codec extends D.Decoder, E.Encoder {} +/** + * @since 2.2.2 + */ +export type TypeOf = C extends Codec ? A : never + // ------------------------------------------------------------------------------------- // constructors // ------------------------------------------------------------------------------------- diff --git a/src/Encoder.ts b/src/Encoder.ts index 907d292ad..33581b4ea 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -18,6 +18,11 @@ export interface Encoder { readonly encode: (a: A) => unknown } +/** + * @since 2.2.2 + */ +export type TypeOf = E extends Encoder ? A : never + // ------------------------------------------------------------------------------------- // primitives // ------------------------------------------------------------------------------------- diff --git a/src/Eq.ts b/src/Eq.ts index e29ad77e5..78ba937f1 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -7,6 +7,11 @@ import * as R from 'fp-ts/lib/Record' import * as S from './Schemable' import Eq = E.Eq +/** + * @since 2.2.2 + */ +export type TypeOf = E extends Eq ? A : never + // ------------------------------------------------------------------------------------- // primitives // ------------------------------------------------------------------------------------- diff --git a/src/Guard.ts b/src/Guard.ts index e21c82787..7a5feaeb0 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -14,6 +14,11 @@ export interface Guard { is: (u: unknown) => u is A } +/** + * @since 2.2.2 + */ +export type TypeOf = G extends Guard ? A : never + // ------------------------------------------------------------------------------------- // constructors // ------------------------------------------------------------------------------------- From 6b53a89dc4a2c6614342cbf61fcfe1317c8e91f4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 5 May 2020 07:43:21 +0200 Subject: [PATCH 019/222] Docs: how to extend the built-in `Schema` --- Schema.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 +- 2 files changed, 97 insertions(+), 6 deletions(-) diff --git a/Schema.md b/Schema.md index afc0546e7..e99d81435 100644 --- a/Schema.md +++ b/Schema.md @@ -1,3 +1,21 @@ + + + +**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_ + +- [Schema interface](#schema-interface) +- [How to extend the built-in `Schema`](#how-to-extend-the-built-in-schema) + + + +# Schema interface + +```ts +export interface Schema { + (S: Schemable): Kind +} +``` + `Schema` allows to define (through the `make` constructor) a generic schema once and then derive multiple concrete instances. **Example** @@ -17,9 +35,82 @@ export const Person = S.make((S) => }) ) -export const PersonDecoder = Person(D.decoder) -export const PersonEncoder = Person(E.encoder) -export const PersonCodec = Person(C.codec) -export const PersonGuard = Person(G.guard) -export const PersonEq = Person(Eq.eq) +export const decoderPerson = Person(D.decoder) +export const encoderPerson = Person(E.encoder) +export const codecPerson = Person(C.codec) +export const guardPerson = Person(G.guard) +export const eqPerson = Person(Eq.eq) +``` + +# How to extend the built-in `Schema` + +Let's say we want to add an `Int` capability to the default `Schemable` type class. + +First of all we must represent an integer at the type level, I'll make use of a branded type for this + +```ts +export interface IntBrand { + readonly Int: unique symbol +} + +export type Int = number & IntBrand +``` + +Now we must define a custom `MySchemable` type class containing a new member `Int`... + +```ts +import { Kind, URIS } from 'fp-ts/lib/HKT' +import * as S from 'io-ts/lib/Schemable' + +export interface MySchemable extends S.Schemable { + readonly Int: Kind +} +``` + +...and a `make` constructor for our extended schemas + +```ts +export interface MySchema { + (S: MySchemable): Kind +} + +export function make(f: MySchema): MySchema { + return S.memoize(f) +} +``` + +Finally we must define an instance of `MySchemable` for `Decoder` + +```ts +import * as D from 'io-ts/lib/Decoder' + +export const mydecoder: MySchemable = { + ...D.decoder, + Int: D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') +} +``` + +Now we can define a schema leveraging the new `Int` capability + +```ts +const Person = make((S) => + S.type({ + name: S.string, + age: S.Int + }) +) +/* +const Person: MySchema<{ + name: string; + age: Int; +}> +*/ + +const decoderPerson = Person(mydecoder) +/* +const decoderPerson: D.Decoder<{ + name: string; + age: Int; +}> +*/ ``` diff --git a/package.json b/package.json index 0fe71f424..d8cc24504 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "perf": "ts-node perf/index", "dtslint": "dtslint dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", - "doctoc": "doctoc README.md Type.md Decoder.md Encoder.md Codec.md Eq.md", + "doctoc": "doctoc README.md Type.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", "docs": "docs-ts", "import-path-rewrite": "import-path-rewrite" }, From d1c16b52984e07d3636696a94d9a1d671ba10768 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 5 May 2020 07:44:26 +0200 Subject: [PATCH 020/222] remove doctoc header --- Schema.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/Schema.md b/Schema.md index e99d81435..d2f1d0b2a 100644 --- a/Schema.md +++ b/Schema.md @@ -1,8 +1,6 @@ -**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_ - - [Schema interface](#schema-interface) - [How to extend the built-in `Schema`](#how-to-extend-the-built-in-schema) From a06553ee8fb739fe329b23e6a663bda893ed53f1 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 18 May 2020 17:13:46 +0200 Subject: [PATCH 021/222] Docs: better explain sum usage --- Decoder.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Decoder.md b/Decoder.md index 4106567fc..cefaced2b 100644 --- a/Decoder.md +++ b/Decoder.md @@ -211,8 +211,13 @@ export const MySum: D.Decoder< type: 'B' b: number } + // v--- tag name > = D.sum('type')({ + // +----- all union members in the dictionary must own a field named like the chosen tag ("type" in this case) + // | + // v v----- this value must be equal to its corresponding dictionary key ("A" in this case) A: D.type({ type: D.literal('A'), a: D.string }), + // v----- this value must be equal to its corresponding dictionary key ("B" in this case) B: D.type({ type: D.literal('B'), b: D.number }) }) ``` From ffe1429cbf1c363ecafaf22d15699a0a35049809 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 16 May 2020 07:59:43 +0200 Subject: [PATCH 022/222] upgrade to typescript@3.9.2, fix #467 --- CHANGELOG.md | 14 +++++++ Schema.md | 34 ++++++++++------ docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 4 +- docs/modules/Encoder.ts.md | 2 +- docs/modules/Eq.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/Schema.ts.md | 15 ++++++- docs/modules/Schemable.ts.md | 49 +++++++++++++++++++++-- dtslint/ts3.5/{Schemable.ts => Schema.ts} | 8 +++- package-lock.json | 16 ++++---- package.json | 4 +- src/Codec.ts | 6 +-- src/Decoder.ts | 6 +-- src/Encoder.ts | 4 +- src/Eq.ts | 2 +- src/Guard.ts | 6 +-- src/Schema.ts | 18 ++++++--- src/Schemable.ts | 39 ++++++++++++++++-- test/2.1.x/union.ts | 1 + test/Arbitrary.ts | 4 +- test/Schema.ts | 44 +++++--------------- 22 files changed, 189 insertions(+), 93 deletions(-) rename dtslint/ts3.5/{Schemable.ts => Schema.ts} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index dff067948..f9661a66d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,20 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.3 + +- **Experimental** + - `Schemable` + - rename `Schemable` interface to `Schemable1` (@gcanti) + - rename `WithUnion` interface to `WithUnion1` (@gcanti) + - add `Schemable` interface (@gcanti) + - add `WithUnion` interface (@gcanti) + - `Schema` + - refactoring with the new `Schemable` interface (@gcanti) + - add `interpreter` function (@gcanti) +- **Internal** + - upgrade to `typescript@3.9.2` (@gcanti) + # 2.2.2 - **Experimental** diff --git a/Schema.md b/Schema.md index d2f1d0b2a..c97ada1a5 100644 --- a/Schema.md +++ b/Schema.md @@ -33,11 +33,11 @@ export const Person = S.make((S) => }) ) -export const decoderPerson = Person(D.decoder) -export const encoderPerson = Person(E.encoder) -export const codecPerson = Person(C.codec) -export const guardPerson = Person(G.guard) -export const eqPerson = Person(Eq.eq) +export const decoderPerson = S.interpreter(D.decoder)(Person) +export const encoderPerson = S.interpreter(E.encoder)(Person) +export const codecPerson = S.interpreter(C.codec)(Person) +export const guardPerson = S.interpreter(G.guard)(Person) +export const eqPerson = S.interpreter(Eq.eq)(Person) ``` # How to extend the built-in `Schema` @@ -57,10 +57,13 @@ export type Int = number & IntBrand Now we must define a custom `MySchemable` type class containing a new member `Int`... ```ts -import { Kind, URIS } from 'fp-ts/lib/HKT' -import * as S from 'io-ts/lib/Schemable' +import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' -export interface MySchemable extends S.Schemable { +export interface MySchemable extends S.Schemable { + readonly Int: HKT +} + +export interface MySchemable1 extends S.Schemable1 { readonly Int: Kind } ``` @@ -69,7 +72,7 @@ export interface MySchemable extends S.Schemable { ```ts export interface MySchema { - (S: MySchemable): Kind + (S: MySchemable): HKT } export function make(f: MySchema): MySchema { @@ -77,21 +80,26 @@ export function make(f: MySchema): MySchema { } ``` -Finally we must define an instance of `MySchemable` for `Decoder` +Finally we must define an instance of `MySchemable1` for `Decoder` and an interpreter ```ts import * as D from 'io-ts/lib/Decoder' -export const mydecoder: MySchemable = { +export const mydecoder: MySchemable1 = { ...D.decoder, Int: D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') } + +export function interpreter(S: MySchemable1): (schema: MySchema) => Kind +export function interpreter(S: MySchemable): (schema: MySchema) => HKT { + return (schema) => schema(S) +} ``` Now we can define a schema leveraging the new `Int` capability ```ts -const Person = make((S) => +export const Person = make((S) => S.type({ name: S.string, age: S.Int @@ -104,7 +112,7 @@ const Person: MySchema<{ }> */ -const decoderPerson = Person(mydecoder) +export const decoderPerson = interpreter(mydecoder)(Person) /* const decoderPerson: D.Decoder<{ name: string; diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 18cde81a2..21cececf4 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -128,7 +128,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const codec: Invariant1<'Codec'> & Schemable<'Codec'> +export declare const codec: Invariant1<'Codec'> & Schemable1<'Codec'> ``` Added in v2.2.0 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 7b3aa5570..723d63ea5 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -190,8 +190,8 @@ Added in v2.2.0 ```ts export declare const decoder: Applicative1<'Decoder'> & Alternative1<'Decoder'> & - Schemable<'Decoder'> & - WithUnion<'Decoder'> + Schemable1<'Decoder'> & + WithUnion1<'Decoder'> ``` Added in v2.2.0 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index efeb677eb..0d29c471e 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -98,7 +98,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const encoder: Contravariant1<'Encoder'> & Schemable<'Encoder'> +export declare const encoder: Contravariant1<'Encoder'> & Schemable1<'Encoder'> ``` Added in v2.2.0 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index a55a06cb4..e9d7a3b33 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -86,7 +86,7 @@ Added in v2.2.2 **Signature** ```ts -export declare const eq: Contravariant1<'Eq'> & S.Schemable<'Eq'> +export declare const eq: Contravariant1<'Eq'> & S.Schemable1<'Eq'> ``` Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index ebbd591a2..3b808b8d5 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -125,7 +125,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const guard: Schemable<'Guard'> & WithUnion<'Guard'> +export declare const guard: Schemable1<'Guard'> & WithUnion1<'Guard'> ``` Added in v2.2.0 diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 634ad876e..183ea0db3 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -14,6 +14,7 @@ Added in v2.2.0 - [Schema (interface)](#schema-interface) - [TypeOf (type alias)](#typeof-type-alias) +- [interpreter](#interpreter) - [make](#make) --- @@ -24,7 +25,7 @@ Added in v2.2.0 ```ts export interface Schema { - (S: Schemable): Kind + (S: Schemable): HKT } ``` @@ -40,12 +41,22 @@ export type TypeOf = S extends Schema ? A : never Added in v2.2.0 +# interpreter + +**Signature** + +```ts +export declare function interpreter(S: Schemable1): (schema: Schema) => Kind +``` + +Added in v2.2.3 + # make **Signature** ```ts -export declare function make(f: Schema): Schema +export declare function make(schema: Schema): Schema ``` Added in v2.2.0 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index afd53b2ed..494f5d51c 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -13,7 +13,9 @@ Added in v2.2.0

Table of contents

- [Schemable (interface)](#schemable-interface) +- [Schemable1 (interface)](#schemable1-interface) - [WithUnion (interface)](#withunion-interface) +- [WithUnion1 (interface)](#withunion1-interface) - [Literal (type alias)](#literal-type-alias) - [memoize](#memoize) @@ -24,7 +26,36 @@ Added in v2.2.0 **Signature** ```ts -export interface Schemable { +export interface Schemable { + readonly URI: S + readonly literal:
>(...values: A) => HKT + readonly string: HKT + readonly number: HKT + readonly boolean: HKT + readonly UnknownArray: HKT> + readonly UnknownRecord: HKT> + readonly nullable: (or: HKT) => HKT + readonly type: (properties: { [K in keyof A]: HKT }) => HKT + readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> + readonly record: (codomain: HKT) => HKT> + readonly array: (items: HKT) => HKT> + readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT + readonly intersection: (left: HKT, right: HKT) => HKT + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: HKT> }) => HKT + readonly lazy: (id: string, f: () => HKT) => HKT +} +``` + +Added in v2.2.3 + +# Schemable1 (interface) + +**Signature** + +```ts +export interface Schemable1 { readonly URI: S readonly literal: >(...values: A) => Kind readonly string: Kind @@ -46,7 +77,7 @@ export interface Schemable { } ``` -Added in v2.2.0 +Added in v2.2.3 # WithUnion (interface) @@ -54,13 +85,25 @@ Added in v2.2.0 ```ts export interface WithUnion { + readonly union: >(...members: { [K in keyof A]: HKT }) => HKT +} +``` + +Added in v2.2.3 + +# WithUnion1 (interface) + +**Signature** + +```ts +export interface WithUnion1 { readonly union: >( ...members: { [K in keyof A]: Kind } ) => Kind } ``` -Added in v2.2.0 +Added in v2.2.3 # Literal (type alias) diff --git a/dtslint/ts3.5/Schemable.ts b/dtslint/ts3.5/Schema.ts similarity index 90% rename from dtslint/ts3.5/Schemable.ts rename to dtslint/ts3.5/Schema.ts index d7578e41c..dc43083ad 100644 --- a/dtslint/ts3.5/Schemable.ts +++ b/dtslint/ts3.5/Schema.ts @@ -1,5 +1,11 @@ import * as D from '../../src/Decoder' -import { make, Schema } from '../../src/Schema' +import { make, Schema, TypeOf } from '../../src/Schema' + +// +// TypeOf +// +export const Person = make((S) => S.type({ name: S.string, age: S.number })) +export type Person = TypeOf // $ExpectType { name: string; age: number; } // // literal diff --git a/package-lock.json b/package-lock.json index 30d56f41c..3b72cd23e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2147,7 +2147,7 @@ } }, "dtslint": { - "version": "github:gcanti/dtslint#e2f11f84997dbbd4aff3f867cda0a5a400931c87", + "version": "github:gcanti/dtslint#de9181e0f1069b16ea15da87f74d88ed9bc221b7", "from": "github:gcanti/dtslint", "dev": true, "requires": { @@ -2155,7 +2155,7 @@ "parsimmon": "^1.12.0", "strip-json-comments": "^2.0.1", "tslint": "^5.12.0", - "typescript": "^3.9.0-dev.20200406" + "typescript": "^4.0.0-dev.20200514" }, "dependencies": { "fs-extra": { @@ -2191,9 +2191,9 @@ } }, "typescript": { - "version": "3.9.0-dev.20200406", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.0-dev.20200406.tgz", - "integrity": "sha512-oDw6MZnp1bMrifgsisvC0Ea3Op8Uyajq88/1EBCi5J8lxuPLDgVTKm3uqArGpcwiX6QphMIWA124ZH2OQx+dzw==", + "version": "4.0.0-dev.20200514", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.0-dev.20200514.tgz", + "integrity": "sha512-o++Z0PwCL2iqEwTnoUVfDIAMo9xS+dvxm/6sl6n2VfxGGmVyaC9F6Naaylh+VZ5qG6Actdso0kJnzDxXVwY5fw==", "dev": true } } @@ -7269,9 +7269,9 @@ } }, "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", + "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", "dev": true }, "unc-path-regex": { diff --git a/package.json b/package.json index d8cc24504..3427708c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.2", + "version": "2.2.3", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", @@ -59,7 +59,7 @@ "ts-node": "8.8.2", "tslint": "6.1.1", "tslint-config-standard": "9.0.0", - "typescript": "3.8.3" + "typescript": "^3.9.2" }, "tags": [ "typescript", diff --git a/src/Codec.ts b/src/Codec.ts index 9e52a0dc8..0a60e2c70 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -4,7 +4,7 @@ import { Invariant1 } from 'fp-ts/lib/Invariant' import * as D from './Decoder' import * as E from './Encoder' -import { Schemable, Literal } from './Schemable' +import { Schemable1, Literal } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -186,7 +186,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const codec: Invariant1 & Schemable = { +export const codec: Invariant1 & Schemable1 = { URI, imap: (fa, f, g) => make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)), literal, @@ -200,7 +200,7 @@ export const codec: Invariant1 & Schemable = { partial, record, array, - tuple: tuple as Schemable['tuple'], + tuple: tuple as Schemable1['tuple'], intersection, sum, lazy diff --git a/src/Decoder.ts b/src/Decoder.ts index 10858ea84..6165b7be4 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -8,7 +8,7 @@ import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' import { pipe, pipeable } from 'fp-ts/lib/pipeable' import { Tree, Forest } from 'fp-ts/lib/Tree' import * as G from './Guard' -import { Schemable, memoize, WithUnion, Literal } from './Schemable' +import { Schemable1, memoize, WithUnion1, Literal } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -469,7 +469,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const decoder: Applicative1 & Alternative1 & Schemable & WithUnion = { +export const decoder: Applicative1 & Alternative1 & Schemable1 & WithUnion1 = { URI, map: (fa, f) => ({ decode: (u) => either.map(fa.decode(u), f) @@ -495,7 +495,7 @@ export const decoder: Applicative1 & Alternative1 & Schemable & W partial, record, array, - tuple: tuple as Schemable['tuple'], + tuple: tuple as Schemable1['tuple'], intersection, sum, lazy, diff --git a/src/Encoder.ts b/src/Encoder.ts index 33581b4ea..7f0f74414 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -4,7 +4,7 @@ import { Contravariant1 } from 'fp-ts/lib/Contravariant' import { identity } from 'fp-ts/lib/function' import { pipeable } from 'fp-ts/lib/pipeable' -import { Schemable, memoize } from './Schemable' +import { Schemable1, memoize } from './Schemable' import { intersect } from './Decoder' // ------------------------------------------------------------------------------------- @@ -170,7 +170,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const encoder: Contravariant1 & Schemable = { +export const encoder: Contravariant1 & Schemable1 = { URI, contramap: (fa, f) => ({ encode: (b) => fa.encode(f(b)) diff --git a/src/Eq.ts b/src/Eq.ts index 78ba937f1..8f29651ad 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -148,7 +148,7 @@ export function lazy(f: () => Eq): Eq { /** * @since 2.2.2 */ -export const eq: typeof E.eq & S.Schemable = { +export const eq: typeof E.eq & S.Schemable1 = { ...E.eq, literal: () => E.eqStrict, string, diff --git a/src/Guard.ts b/src/Guard.ts index 7a5feaeb0..e4a80854e 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -1,7 +1,7 @@ /** * @since 2.2.0 */ -import { Schemable, memoize, WithUnion, Literal } from './Schemable' +import { Schemable1, memoize, WithUnion1, Literal } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -228,7 +228,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const guard: Schemable & WithUnion = { +export const guard: Schemable1 & WithUnion1 = { URI, literal, string, @@ -241,7 +241,7 @@ export const guard: Schemable & WithUnion = { partial, record, array, - tuple: tuple as Schemable['tuple'], + tuple: tuple as Schemable1['tuple'], intersection, sum, lazy: (_, f) => lazy(f), diff --git a/src/Schema.ts b/src/Schema.ts index 30fd480e9..9e90daaeb 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -1,14 +1,14 @@ /** * @since 2.2.0 */ -import { Kind, URIS } from 'fp-ts/lib/HKT' -import { Schemable, memoize } from './Schemable' +import { HKT, URIS, Kind } from 'fp-ts/lib/HKT' +import { memoize, Schemable, Schemable1 } from './Schemable' /** * @since 2.2.0 */ export interface Schema { - (S: Schemable): Kind + (S: Schemable): HKT } /** @@ -19,6 +19,14 @@ export type TypeOf = S extends Schema ? A : never /** * @since 2.2.0 */ -export function make(f: Schema): Schema { - return memoize(f) +export function make(schema: Schema): Schema { + return memoize(schema) +} + +/** + * @since 2.2.3 + */ +export function interpreter(S: Schemable1): (schema: Schema) => Kind +export function interpreter(S: Schemable): (schema: Schema) => HKT { + return (schema) => schema(S) } diff --git a/src/Schemable.ts b/src/Schemable.ts index a4d615cd9..11cb4ee27 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -1,7 +1,7 @@ /** * @since 2.2.0 */ -import { Kind, URIS } from 'fp-ts/lib/HKT' +import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' /** * @since 2.2.0 @@ -9,9 +9,33 @@ import { Kind, URIS } from 'fp-ts/lib/HKT' export type Literal = string | number | boolean | null /** - * @since 2.2.0 + * @since 2.2.3 */ -export interface Schemable { +export interface Schemable { + readonly URI: S + readonly literal: >(...values: A) => HKT + readonly string: HKT + readonly number: HKT + readonly boolean: HKT + readonly UnknownArray: HKT> + readonly UnknownRecord: HKT> + readonly nullable: (or: HKT) => HKT + readonly type: (properties: { [K in keyof A]: HKT }) => HKT + readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> + readonly record: (codomain: HKT) => HKT> + readonly array: (items: HKT) => HKT> + readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT + readonly intersection: (left: HKT, right: HKT) => HKT + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: HKT> }) => HKT + readonly lazy: (id: string, f: () => HKT) => HKT +} + +/** + * @since 2.2.3 + */ +export interface Schemable1 { readonly URI: S readonly literal: >(...values: A) => Kind readonly string: Kind @@ -33,9 +57,16 @@ export interface Schemable { } /** - * @since 2.2.0 + * @since 2.2.3 */ export interface WithUnion { + readonly union: >(...members: { [K in keyof A]: HKT }) => HKT +} + +/** + * @since 2.2.3 + */ +export interface WithUnion1 { readonly union: >( ...members: { [K in keyof A]: Kind } ) => Kind diff --git a/test/2.1.x/union.ts b/test/2.1.x/union.ts index 1410dfad4..d340cba05 100644 --- a/test/2.1.x/union.ts +++ b/test/2.1.x/union.ts @@ -199,6 +199,7 @@ describe('union', () => { } ) assert.strictEqual( + // @ts-expect-error t.getTags(t.intersection([t.type({ a: t.literal('a') }), t.type({ a: t.literal('b') })])), t.emptyTags ) diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index bc2bf6c2a..7cdb059b2 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -112,7 +112,7 @@ declare module 'fp-ts/lib/HKT' { } } -export const arbitrary: S.Schemable & S.WithUnion = { +export const arbitrary: S.Schemable1 & S.WithUnion1 = { URI, literal, string, @@ -125,7 +125,7 @@ export const arbitrary: S.Schemable & S.WithUnion = { partial, record, array, - tuple: tuple as S.Schemable['tuple'], + tuple: tuple as S.Schemable1['tuple'], intersection, sum, lazy: (_, f) => lazy(f), diff --git a/test/Schema.ts b/test/Schema.ts index 2db29baf3..8191a3f81 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,13 +1,11 @@ -import { isRight, right } from 'fp-ts/lib/Either' -import { Schema, make } from '../src/Schema' -import * as G from '../src/Guard' -import * as D from '../src/Decoder' -import * as E from '../src/Encoder' +import * as assert from 'assert' +import * as fc from 'fast-check' +import { isRight } from 'fp-ts/lib/Either' import * as C from '../src/Codec' import * as Eq from '../src/Eq' +import * as G from '../src/Guard' +import { interpreter, make, Schema } from '../src/Schema' import * as A from './Arbitrary' -import * as fc from 'fast-check' -import * as assert from 'assert' function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { try { @@ -19,10 +17,10 @@ function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { } function check(schema: Schema): void { - const arb = schema(A.arbitrary) - const codec = schema(C.codec) - const guard = schema(G.guard) - const eq = schema(Eq.eq) + const arb = interpreter(A.arbitrary)(schema) + const codec = interpreter(C.codec)(schema) + const guard = interpreter(G.guard)(schema) + const eq = interpreter(Eq.eq)(schema) // decoders, guards and eqs should be aligned fc.assert(fc.property(arb, (a) => isRight(codec.decode(a)) && guard.is(a) && eq.equals(a, a))) // laws @@ -39,30 +37,6 @@ function check(schema: Schema): void { ) } describe('Schemable', () => { - const Person = make((S) => - S.type({ - name: S.string, - age: S.number - }) - ) - - it('should handle decoders', () => { - assert.deepStrictEqual(Person(D.decoder).decode({ name: 'name', age: 46 }), right({ name: 'name', age: 46 })) - }) - - it('should handle encoders', () => { - assert.deepStrictEqual(Person(E.encoder).encode({ name: 'name', age: 46 }), { name: 'name', age: 46 }) - }) - - it('should handle guards', () => { - assert.deepStrictEqual(Person(G.guard).is({ name: 'name', age: 46 }), true) - }) - - it('should handle codecs', () => { - assert.deepStrictEqual(Person(C.codec).decode({ name: 'name', age: 46 }), right({ name: 'name', age: 46 })) - assert.deepStrictEqual(Person(E.encoder).encode({ name: 'name', age: 46 }), { name: 'name', age: 46 }) - }) - it('string', () => { check(make((S) => S.string)) }) From e4301b314d4f216713a648f71d9693fb83415269 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 16 May 2020 08:00:44 +0200 Subject: [PATCH 023/222] re-export Eq's URI --- docs/modules/Eq.ts.md | 11 +++++++++++ src/Eq.ts | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index e9d7a3b33..ba22fd96d 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -13,6 +13,7 @@ Added in v2.2.2

Table of contents

- [TypeOf (type alias)](#typeof-type-alias) +- [URI (type alias)](#uri-type-alias) - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) - [array](#array) @@ -41,6 +42,16 @@ export type TypeOf = E extends Eq ? A : never Added in v2.2.2 +# URI (type alias) + +**Signature** + +```ts +export type URI = E.URI +``` + +Added in v2.2.3 + # UnknownArray **Signature** diff --git a/src/Eq.ts b/src/Eq.ts index 8f29651ad..acadc934d 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -7,6 +7,11 @@ import * as R from 'fp-ts/lib/Record' import * as S from './Schemable' import Eq = E.Eq +/** + * @since 2.2.3 + */ +export type URI = E.URI + /** * @since 2.2.2 */ From 6c05e8e786cd27e7b2ad8bc49c94e5898876cc8e Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 16 May 2020 08:09:28 +0200 Subject: [PATCH 024/222] add `WithRefinement` / `WithRefinement1` interfaces --- CHANGELOG.md | 1 + docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 3 ++- docs/modules/Eq.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/Schemable.ts.md | 26 ++++++++++++++++++++++++++ src/Codec.ts | 7 ++++--- src/Decoder.ts | 13 +++++++++---- src/Eq.ts | 9 +++++---- src/Guard.ts | 7 ++++--- src/Schemable.ts | 14 ++++++++++++++ test/Eq.ts | 12 ++++++++++++ 12 files changed, 80 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9661a66d..cbb17c000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - rename `WithUnion` interface to `WithUnion1` (@gcanti) - add `Schemable` interface (@gcanti) - add `WithUnion` interface (@gcanti) + - add `WithRefinement` / `WithRefinement1` interfaces (@gcanti) - `Schema` - refactoring with the new `Schemable` interface (@gcanti) - add `interpreter` function (@gcanti) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 21cececf4..958ab7a61 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -128,7 +128,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const codec: Invariant1<'Codec'> & Schemable1<'Codec'> +export declare const codec: Invariant1<'Codec'> & Schemable1<'Codec'> & WithRefinement1<'Codec'> ``` Added in v2.2.0 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 723d63ea5..0de769157 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -191,7 +191,8 @@ Added in v2.2.0 export declare const decoder: Applicative1<'Decoder'> & Alternative1<'Decoder'> & Schemable1<'Decoder'> & - WithUnion1<'Decoder'> + WithUnion1<'Decoder'> & + WithRefinement1<'Decoder'> ``` Added in v2.2.0 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index ba22fd96d..19dab4328 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -97,7 +97,7 @@ Added in v2.2.2 **Signature** ```ts -export declare const eq: Contravariant1<'Eq'> & S.Schemable1<'Eq'> +export declare const eq: Contravariant1<'Eq'> & Schemable1<'Eq'> & WithRefinement1<'Eq'> ``` Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 3b808b8d5..4c0945804 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -125,7 +125,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const guard: Schemable1<'Guard'> & WithUnion1<'Guard'> +export declare const guard: Schemable1<'Guard'> & WithUnion1<'Guard'> & WithRefinement1<'Guard'> ``` Added in v2.2.0 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 494f5d51c..b2a508695 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -14,6 +14,8 @@ Added in v2.2.0 - [Schemable (interface)](#schemable-interface) - [Schemable1 (interface)](#schemable1-interface) +- [WithRefinement (interface)](#withrefinement-interface) +- [WithRefinement1 (interface)](#withrefinement1-interface) - [WithUnion (interface)](#withunion-interface) - [WithUnion1 (interface)](#withunion1-interface) - [Literal (type alias)](#literal-type-alias) @@ -79,6 +81,30 @@ export interface Schemable1 { Added in v2.2.3 +# WithRefinement (interface) + +**Signature** + +```ts +export interface WithRefinement { + readonly refinement: (from: HKT, refinement: (a: A) => a is B, expected: string) => HKT +} +``` + +Added in v2.2.3 + +# WithRefinement1 (interface) + +**Signature** + +```ts +export interface WithRefinement1 { + readonly refinement: (from: Kind, refinement: (a: A) => a is B, expected: string) => Kind +} +``` + +Added in v2.2.3 + # WithUnion (interface) **Signature** diff --git a/src/Codec.ts b/src/Codec.ts index 0a60e2c70..261f2f98f 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -4,7 +4,7 @@ import { Invariant1 } from 'fp-ts/lib/Invariant' import * as D from './Decoder' import * as E from './Encoder' -import { Schemable1, Literal } from './Schemable' +import { Literal, Schemable1, WithRefinement1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -186,7 +186,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const codec: Invariant1 & Schemable1 = { +export const codec: Invariant1 & Schemable1 & WithRefinement1 = { URI, imap: (fa, f, g) => make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)), literal, @@ -203,5 +203,6 @@ export const codec: Invariant1 & Schemable1 = { tuple: tuple as Schemable1['tuple'], intersection, sum, - lazy + lazy, + refinement: refinement as WithRefinement1['refinement'] } diff --git a/src/Decoder.ts b/src/Decoder.ts index 6165b7be4..77613bdcf 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -6,9 +6,9 @@ import { Applicative1 } from 'fp-ts/lib/Applicative' import { Either, either, isLeft, isRight, left, mapLeft, right } from 'fp-ts/lib/Either' import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' import { pipe, pipeable } from 'fp-ts/lib/pipeable' -import { Tree, Forest } from 'fp-ts/lib/Tree' +import { Forest, Tree } from 'fp-ts/lib/Tree' import * as G from './Guard' -import { Schemable1, memoize, WithUnion1, Literal } from './Schemable' +import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -469,7 +469,11 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const decoder: Applicative1 & Alternative1 & Schemable1 & WithUnion1 = { +export const decoder: Applicative1 & + Alternative1 & + Schemable1 & + WithUnion1 & + WithRefinement1 = { URI, map: (fa, f) => ({ decode: (u) => either.map(fa.decode(u), f) @@ -499,7 +503,8 @@ export const decoder: Applicative1 & Alternative1 & Schemable1 & intersection, sum, lazy, - union + union, + refinement: refinement as WithRefinement1['refinement'] } const { alt, ap, apFirst, apSecond, map } = pipeable(decoder) diff --git a/src/Eq.ts b/src/Eq.ts index acadc934d..796999227 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -4,7 +4,7 @@ import * as A from 'fp-ts/lib/Array' import * as E from 'fp-ts/lib/Eq' import * as R from 'fp-ts/lib/Record' -import * as S from './Schemable' +import { memoize, Schemable1, WithRefinement1 } from './Schemable' import Eq = E.Eq /** @@ -144,7 +144,7 @@ export function sum( * @since 2.2.2 */ export function lazy
(f: () => Eq): Eq { - const get = S.memoize>(f) + const get = memoize>(f) return { equals: (x, y) => get().equals(x, y) } @@ -153,7 +153,7 @@ export function lazy(f: () => Eq): Eq { /** * @since 2.2.2 */ -export const eq: typeof E.eq & S.Schemable1 = { +export const eq: typeof E.eq & Schemable1 & WithRefinement1 = { ...E.eq, literal: () => E.eqStrict, string, @@ -169,5 +169,6 @@ export const eq: typeof E.eq & S.Schemable1 = { tuple, intersection, sum, - lazy: (_, f) => lazy(f) + lazy: (_, f) => lazy(f), + refinement: (from) => from } diff --git a/src/Guard.ts b/src/Guard.ts index e4a80854e..ee9518fd4 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -1,7 +1,7 @@ /** * @since 2.2.0 */ -import { Schemable1, memoize, WithUnion1, Literal } from './Schemable' +import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -228,7 +228,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const guard: Schemable1 & WithUnion1 = { +export const guard: Schemable1 & WithUnion1 & WithRefinement1 = { URI, literal, string, @@ -245,5 +245,6 @@ export const guard: Schemable1 & WithUnion1 = { intersection, sum, lazy: (_, f) => lazy(f), - union + union, + refinement: refinement as WithRefinement1['refinement'] } diff --git a/src/Schemable.ts b/src/Schemable.ts index 11cb4ee27..165945a7a 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -72,6 +72,20 @@ export interface WithUnion1 { ) => Kind } +/** + * @since 2.2.3 + */ +export interface WithRefinement { + readonly refinement: (from: HKT, refinement: (a: A) => a is B, expected: string) => HKT +} + +/** + * @since 2.2.3 + */ +export interface WithRefinement1 { + readonly refinement: (from: Kind, refinement: (a: A) => a is B, expected: string) => Kind +} + /** * @since 2.2.0 */ diff --git a/test/Eq.ts b/test/Eq.ts index 525fa3321..689c2b0fe 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -79,4 +79,16 @@ describe('Eq', () => { assert.strictEqual(eq.equals({ _tag: 'A', a: 'a' }, { _tag: 'A', a: 'b' }), false) assert.strictEqual(eq.equals({ _tag: 'B', b: 1 }, { _tag: 'B', b: 2 }), false) }) + + it('refinement', () => { + interface NonEmptyStringBrand { + readonly NonEmptyString: unique symbol + } + type NonEmptyString = string & NonEmptyStringBrand + const eq = E.eq.refinement(E.string, (s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + const a: NonEmptyString = 'a' as any + const b: NonEmptyString = 'b' as any + assert.deepStrictEqual(eq.equals(a, a), true) + assert.deepStrictEqual(eq.equals(a, b), false) + }) }) From 26c16958170b2b111aa092ed82c84361604704c4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 16 May 2020 08:18:47 +0200 Subject: [PATCH 025/222] add `Type` experimental module --- CHANGELOG.md | 1 + docs/modules/Schemable.ts.md | 4 +- docs/modules/Type.ts.md | 255 +++++++++++++++++++++++++++++++++++ src/Schemable.ts | 4 +- src/Type.ts | 182 +++++++++++++++++++++++++ test/Type.ts | 194 ++++++++++++++++++++++++++ 6 files changed, 636 insertions(+), 4 deletions(-) create mode 100644 docs/modules/Type.ts.md create mode 100644 src/Type.ts create mode 100644 test/Type.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index cbb17c000..2e430f703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ # 2.2.3 - **Experimental** + - add `Type` experimental module, #464 (@gcanti) - `Schemable` - rename `Schemable` interface to `Schemable1` (@gcanti) - rename `WithUnion` interface to `WithUnion1` (@gcanti) diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index b2a508695..9921d4543 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -86,7 +86,7 @@ Added in v2.2.3 **Signature** ```ts -export interface WithRefinement { +export interface WithRefinement { readonly refinement: (from: HKT, refinement: (a: A) => a is B, expected: string) => HKT } ``` @@ -110,7 +110,7 @@ Added in v2.2.3 **Signature** ```ts -export interface WithUnion { +export interface WithUnion { readonly union: >(...members: { [K in keyof A]: HKT }) => HKT } ``` diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md new file mode 100644 index 000000000..c08bf8029 --- /dev/null +++ b/docs/modules/Type.ts.md @@ -0,0 +1,255 @@ +--- +title: Type.ts +nav_order: 12 +parent: Modules +--- + +# Type overview + +Added in v2.2.3 + +--- + +

Table of contents

+ +- [Type (interface)](#type-interface) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [UnknownArray](#unknownarray) +- [UnknownRecord](#unknownrecord) +- [array](#array) +- [boolean](#boolean) +- [instance](#instance) +- [intersection](#intersection) +- [lazy](#lazy) +- [literal](#literal) +- [nullable](#nullable) +- [number](#number) +- [partial](#partial) +- [record](#record) +- [refinement](#refinement) +- [string](#string) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) +- [union](#union) + +--- + +# Type (interface) + +**Signature** + +```ts +export interface Type
extends t.Type {} +``` + +Added in v2.2.3 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.3 + +# URI + +**Signature** + +```ts +export declare const URI: 'Type' +``` + +Added in v2.2.3 + +# UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: Type +``` + +Added in v2.2.3 + +# UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: Type> +``` + +Added in v2.2.3 + +# array + +**Signature** + +```ts +export declare function array(items: Type): Type> +``` + +Added in v2.2.3 + +# boolean + +**Signature** + +```ts +export declare const boolean: Type +``` + +Added in v2.2.3 + +# instance + +**Signature** + +```ts +export declare const instance: Schemable1<'Type'> & WithUnion1<'Type'> & WithRefinement1<'Type'> +``` + +Added in v2.2.3 + +# intersection + +**Signature** + +```ts +export declare function intersection(left: Type, right: Type): Type +``` + +Added in v2.2.3 + +# lazy + +**Signature** + +```ts +export declare function lazy(id: string, f: () => Type): Type +``` + +Added in v2.2.3 + +# literal + +**Signature** + +```ts +export declare function literal>(...values: A): Type +``` + +Added in v2.2.3 + +# nullable + +**Signature** + +```ts +export declare function nullable(or: Type): Type +``` + +Added in v2.2.3 + +# number + +**Signature** + +```ts +export declare const number: Type +``` + +Added in v2.2.3 + +# partial + +**Signature** + +```ts +export declare function partial(properties: { [K in keyof A]: Type }): Type> +``` + +Added in v2.2.3 + +# record + +**Signature** + +```ts +export declare function record(codomain: Type): Type> +``` + +Added in v2.2.3 + +# refinement + +**Signature** + +```ts +export declare function refinement( + from: Type, + refinement: (a: A) => a is B, + expected: string +): Type +``` + +Added in v2.2.3 + +# string + +**Signature** + +```ts +export declare const string: Type +``` + +Added in v2.2.3 + +# sum + +**Signature** + +```ts +export declare function sum( + _tag: T +): (members: { [K in keyof A]: Type> }) => Type +``` + +Added in v2.2.3 + +# tuple + +**Signature** + +```ts +export declare function tuple>(...components: { [K in keyof A]: Type }): Type +``` + +Added in v2.2.3 + +# type + +**Signature** + +```ts +export declare function type(properties: { [K in keyof A]: Type }): Type +``` + +Added in v2.2.3 + +# union + +**Signature** + +```ts +export declare function union>( + ...members: { [K in keyof A]: Type } +): Type +``` + +Added in v2.2.3 diff --git a/src/Schemable.ts b/src/Schemable.ts index 165945a7a..60222498c 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -59,7 +59,7 @@ export interface Schemable1 { /** * @since 2.2.3 */ -export interface WithUnion { +export interface WithUnion { readonly union: >(...members: { [K in keyof A]: HKT }) => HKT } @@ -75,7 +75,7 @@ export interface WithUnion1 { /** * @since 2.2.3 */ -export interface WithRefinement { +export interface WithRefinement { readonly refinement: (from: HKT, refinement: (a: A) => a is B, expected: string) => HKT } diff --git a/src/Type.ts b/src/Type.ts new file mode 100644 index 000000000..c542de351 --- /dev/null +++ b/src/Type.ts @@ -0,0 +1,182 @@ +/** + * @since 2.2.3 + */ +import * as t from './index' +import { Literal, Schemable1, WithUnion1, WithRefinement1 } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export interface Type extends t.Type {} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export function literal>(...values: A): Type { + return t.union(values.map((v) => t.literal(v as any)) as any) +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const string: Type = t.string + +/** + * @since 2.2.3 + */ +export const number: Type = t.number + +/** + * @since 2.2.3 + */ +export const boolean: Type = t.boolean + +/** + * @since 2.2.3 + */ +export const UnknownArray: Type> = t.UnknownArray + +/** + * @since 2.2.3 + */ +export const UnknownRecord: Type> = t.UnknownRecord + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export function refinement(from: Type, refinement: (a: A) => a is B, expected: string): Type { + // tslint:disable-next-line: deprecation + return t.refinement(from, refinement, expected) as any +} + +/** + * @since 2.2.3 + */ +export function nullable(or: Type): Type { + return t.union([t.null, or]) +} + +/** + * @since 2.2.3 + */ +export function type(properties: { [K in keyof A]: Type }): Type { + return t.type(properties) as any +} + +/** + * @since 2.2.3 + */ +export function partial(properties: { [K in keyof A]: Type }): Type> { + return t.partial(properties) +} + +/** + * @since 2.2.3 + */ +export function record(codomain: Type): Type> { + return t.record(t.string, codomain) +} + +/** + * @since 2.2.3 + */ +export function array(items: Type): Type> { + return t.array(items) +} + +/** + * @since 2.2.3 + */ +export function tuple>(...components: { [K in keyof A]: Type }): Type { + return t.tuple(components as any) as any +} + +/** + * @since 2.2.3 + */ +export function intersection(left: Type, right: Type): Type { + return t.intersection([left, right]) +} + +/** + * @since 2.2.3 + */ +export function lazy(id: string, f: () => Type): Type { + return t.recursion(id, f) +} + +/** + * @since 2.2.3 + */ +export function sum( + _tag: T +): (members: { [K in keyof A]: Type> }) => Type { + return (members) => t.union(Object.values(members) as any) +} + +/** + * @since 2.2.3 + */ +export function union>(...members: { [K in keyof A]: Type }): Type { + return t.union(members as any) +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const URI = 'Type' + +/** + * @since 2.2.3 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly Type: Type + } +} + +/** + * @since 2.2.3 + */ +export const instance: Schemable1 & WithUnion1 & WithRefinement1 = { + URI, + literal, + string, + number, + boolean, + UnknownArray, + UnknownRecord, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable1['tuple'], + intersection, + sum, + lazy, + union, + refinement: refinement as WithRefinement1['refinement'] +} diff --git a/test/Type.ts b/test/Type.ts new file mode 100644 index 000000000..fc4199d33 --- /dev/null +++ b/test/Type.ts @@ -0,0 +1,194 @@ +import * as assert from 'assert' +import * as fc from 'fast-check' +import { isRight } from 'fp-ts/lib/Either' +import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' +import * as t from '../src' +import * as D from '../src/Decoder' +import * as G from '../src/Guard' +import { memoize, Schemable, WithUnion, Schemable1, WithUnion1 } from '../src/Schemable' +import * as T from '../src/Type' +import * as A from './Arbitrary' + +interface Schema { + (S: Schemable & WithUnion): HKT +} + +function make(f: Schema): Schema { + return memoize(f) +} + +function interpreter(S: Schemable1 & WithUnion1): (schema: Schema) => Kind +function interpreter(S: Schemable & WithUnion): (schema: Schema) => HKT { + return (schema) => schema(S) +} + +function check(schema: Schema, type: t.Type): void { + const arb = interpreter(A.arbitrary)(schema) + const decoder = interpreter(D.decoder)(schema) + const guard = interpreter(G.guard)(schema) + const itype = interpreter(T.instance)(schema) + // decoder and type should be aligned + fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) === isRight(type.decode(a)))) + // interpreted type and type should be aligned + fc.assert(fc.property(arb, (a) => isRight(itype.decode(a)) === isRight(type.decode(a)))) + // guard and `Type`'s `is` should be aligned + fc.assert(fc.property(arb, (a) => guard.is(a) === type.is(a))) +} + +describe('Type', () => { + it('string', () => { + check( + make((S) => S.string), + t.string + ) + }) + + it('number', () => { + check( + make((S) => S.number), + t.number + ) + }) + + it('boolean', () => { + check( + make((S) => S.boolean), + t.boolean + ) + }) + + it('UnknownArray', () => { + check( + make((S) => S.UnknownArray), + t.UnknownArray + ) + }) + + it('UnknownRecord', () => { + check( + make((S) => S.UnknownRecord), + t.UnknownRecord + ) + }) + + it('literal', () => { + check( + make((S) => S.literal('a', 'b')), + t.keyof({ a: null, b: null }) + ) + }) + + it('nullable', () => { + check( + make((S) => S.nullable(S.string)), + t.union([t.null, t.string]) + ) + }) + + it('type', () => { + check( + make((S) => + S.type({ + name: S.string, + age: S.number + }) + ), + t.type({ + name: t.string, + age: t.number + }) + ) + }) + + it('partial', () => { + check( + make((S) => + S.partial({ + name: S.string, + age: S.number + }) + ), + t.partial({ + name: t.string, + age: t.number + }) + ) + }) + + it('record', () => { + check( + make((S) => S.record(S.string)), + t.record(t.string, t.string) + ) + }) + + it('array', () => { + check( + make((S) => S.array(S.string)), + t.array(t.string) + ) + }) + + it('tuple', () => { + check( + make((S) => S.tuple(S.string)), + t.tuple([t.string]) + ) + check( + make((S) => S.tuple(S.string, S.number)), + t.tuple([t.string, t.number]) + ) + }) + + it('intersection', () => { + check( + make((S) => S.intersection(S.type({ a: S.string }), S.type({ b: S.number }))), + t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) + ) + }) + + it('sum', () => { + check( + make((S) => + S.sum('_tag')({ + A: S.type({ _tag: S.literal('A'), a: S.string }), + B: S.type({ _tag: S.literal('B'), b: S.number }) + }) + ), + t.union([t.type({ _tag: t.literal('A'), a: t.string }), t.type({ _tag: t.literal('B'), b: t.number })]) + ) + }) + + it('lazy', () => { + interface A { + a: string + b?: A + c?: number + } + + const schema: Schema = make((S) => + S.lazy('A', () => S.intersection(S.type({ a: S.string }), S.partial({ b: schema(S), c: S.number }))) + ) + const type: t.Type = t.recursion('A', () => + t.intersection([t.type({ a: t.string }), t.partial({ b: type, c: t.number })]) + ) + check(schema, type) + }) + + it('union', () => { + check( + make((S) => S.union(S.string, S.number)), + t.union([t.string, t.number]) + ) + }) + + it('refinement', () => { + interface NonEmptyStringBrand { + readonly NonEmptyString: unique symbol + } + type NonEmptyString = string & NonEmptyStringBrand + const type = T.refinement(T.string, (s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(isRight(type.decode('a')), true) + assert.deepStrictEqual(isRight(type.decode('')), false) + }) +}) From a1238e568d75ed53a84709239beabdd5fdf6ed22 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 18 May 2020 16:39:04 +0200 Subject: [PATCH 026/222] add `PEncoder` experimental module --- CHANGELOG.md | 1 + docs/modules/PEncoder.ts.md | 213 +++++++++++++++++++++++++++++++++++ docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/Tree.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- dtslint/ts3.5/PEconder.ts | 101 +++++++++++++++++ src/Encoder.ts | 4 +- src/PEncoder.ts | 200 ++++++++++++++++++++++++++++++++ test/PEncoder.ts | 106 +++++++++++++++++ 11 files changed, 628 insertions(+), 7 deletions(-) create mode 100644 docs/modules/PEncoder.ts.md create mode 100644 dtslint/ts3.5/PEconder.ts create mode 100644 src/PEncoder.ts create mode 100644 test/PEncoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e430f703..d673902eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - **Experimental** - add `Type` experimental module, #464 (@gcanti) + - add `PEncoder` experimental module, #469 (@gcanti) - `Schemable` - rename `Schemable` interface to `Schemable1` (@gcanti) - rename `WithUnion` interface to `WithUnion1` (@gcanti) diff --git a/docs/modules/PEncoder.ts.md b/docs/modules/PEncoder.ts.md new file mode 100644 index 000000000..2c76b5bae --- /dev/null +++ b/docs/modules/PEncoder.ts.md @@ -0,0 +1,213 @@ +--- +title: PEncoder.ts +nav_order: 8 +parent: Modules +--- + +# PEncoder overview + +Added in v2.2.3 + +--- + +

Table of contents

+ +- [PEncoder (interface)](#pencoder-interface) +- [OutputOf (type alias)](#outputof-type-alias) +- [TypeOf (type alias)](#typeof-type-alias) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [array](#array) +- [contramap](#contramap) +- [id](#id) +- [intersection](#intersection) +- [lazy](#lazy) +- [nullable](#nullable) +- [partial](#partial) +- [pencoder](#pencoder) +- [record](#record) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) + +--- + +# PEncoder (interface) + +**Signature** + +```ts +export interface PEncoder { + readonly encode: (a: A) => O +} +``` + +Added in v2.2.3 + +# OutputOf (type alias) + +**Signature** + +```ts +export type OutputOf = E extends PEncoder ? O : never +``` + +Added in v2.2.3 + +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = E extends PEncoder ? A : never +``` + +Added in v2.2.3 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.3 + +# URI + +**Signature** + +```ts +export declare const URI: 'PEncoder' +``` + +Added in v2.2.3 + +# array + +**Signature** + +```ts +export declare function array(items: PEncoder): PEncoder, Array
> +``` + +Added in v2.2.3 + +# contramap + +**Signature** + +```ts +export declare const contramap: (f: (b: B) => A) => (fa: PEncoder) => PEncoder +``` + +Added in v2.2.3 + +# id + +**Signature** + +```ts +export declare function id(): PEncoder +``` + +Added in v2.2.3 + +# intersection + +**Signature** + +```ts +export declare function intersection(left: PEncoder, right: PEncoder): PEncoder +``` + +Added in v2.2.3 + +# lazy + +**Signature** + +```ts +export declare function lazy(f: () => PEncoder): PEncoder +``` + +Added in v2.2.3 + +# nullable + +**Signature** + +```ts +export declare function nullable(or: PEncoder): PEncoder +``` + +Added in v2.2.3 + +# partial + +**Signature** + +```ts +export declare function partial

>>( + properties: P +): PEncoder }>, Partial<{ [K in keyof P]: TypeOf }>> +``` + +Added in v2.2.3 + +# pencoder + +**Signature** + +```ts +export declare const pencoder: Contravariant2<'PEncoder'> +``` + +Added in v2.2.3 + +# record + +**Signature** + +```ts +export declare function record(codomain: PEncoder): PEncoder, Record> +``` + +Added in v2.2.3 + +# sum + +**Signature** + +```ts +export declare function sum( + tag: T +): >>(members: M) => PEncoder, TypeOf> +``` + +Added in v2.2.3 + +# tuple + +**Signature** + +```ts +export declare function tuple>>( + ...components: C +): PEncoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> +``` + +Added in v2.2.3 + +# type + +**Signature** + +```ts +export declare function type

>>( + properties: P +): PEncoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +``` + +Added in v2.2.3 diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 29f039bdc..396d74cf6 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 8 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 183ea0db3..4063d084a 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 9 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 9921d4543..1ff8afb3f 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 10 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index 4b880a000..819ee92f5 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -1,6 +1,6 @@ --- title: Tree.ts -nav_order: 11 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index c08bf8029..67accb5b6 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 12 +nav_order: 13 parent: Modules --- diff --git a/dtslint/ts3.5/PEconder.ts b/dtslint/ts3.5/PEconder.ts new file mode 100644 index 000000000..6e6426aac --- /dev/null +++ b/dtslint/ts3.5/PEconder.ts @@ -0,0 +1,101 @@ +import * as PE from '../../src/PEncoder' + +const NumberToString: PE.PEncoder = { + encode: String +} + +const BooleanToNumber: PE.PEncoder = { + encode: (b) => (b ? 1 : 0) +} + +export const Person = PE.type({ name: PE.id(), age: NumberToString }) + +// +// TypeOf +// +export type Person = PE.TypeOf // $ExpectType { name: string; age: number; } + +// +// OutputOf +// +export type PersonOut = PE.OutputOf // $ExpectType { name: string; age: string; } + +// +// nullable +// +PE.nullable(NumberToString) // $ExpectType PEncoder + +// +// type +// +PE.type({ a: NumberToString }) // $ExpectType PEncoder<{ a: string; }, { a: number; }> + +// +// partial +// +PE.partial({ a: NumberToString }) // $ExpectType PEncoder, Partial<{ a: number; }>> + +// +// record +// +PE.record(NumberToString) // $ExpectType PEncoder, Record> + +// +// array +// +PE.array(NumberToString) // $ExpectType PEncoder + +// +// tuple +// +PE.tuple() // $ExpectType PEncoder<[], []> +PE.tuple(NumberToString) // $ExpectType PEncoder<[string], [number]> +PE.tuple(NumberToString, BooleanToNumber) // $ExpectType PEncoder<[string, number], [number, boolean]> + +// +// intersection +// +PE.intersection(PE.type({ a: NumberToString }), PE.type({ b: BooleanToNumber })) // $ExpectType PEncoder<{ a: string; } & { b: number; }, { a: number; } & { b: boolean; }> + +// +// sum +// +const S1 = PE.type({ _tag: PE.id<'A'>(), a: NumberToString }) +const S2 = PE.type({ _tag: PE.id<'B'>(), b: BooleanToNumber }) +const sum = PE.sum('_tag') + +// $ExpectType PEncoder<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }, { _tag: "A"; a: number; } | { _tag: "B"; b: boolean; }> +sum({ A: S1, B: S2 }) + +// +// lazy +// +interface A { + a: number + bs: Array +} +interface AOut { + a: string + bs: Array +} +interface B { + b: boolean + as: Array +} +interface BOut { + b: number + as: Array +} +const A: PE.PEncoder = PE.lazy(() => + PE.type({ + a: NumberToString, + bs: PE.array(B) + }) +) + +const B: PE.PEncoder = PE.lazy(() => + PE.type({ + b: BooleanToNumber, + as: PE.array(A) + }) +) diff --git a/src/Encoder.ts b/src/Encoder.ts index 7f0f74414..d2481e0f9 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -43,7 +43,7 @@ export const id: Encoder = { */ export function nullable(or: Encoder): Encoder { return { - encode: (a) => (a === null ? a : or.encode(a)) + encode: (a) => (a === null ? null : or.encode(a)) } } @@ -74,7 +74,7 @@ export function partial(properties: { [K in keyof A]: Encoder }): Encod // don't add missing properties if (k in a) { // don't strip undefined properties - o[k] = v === undefined ? v : properties[k].encode(v) + o[k] = v === undefined ? undefined : properties[k].encode(v) } } return o diff --git a/src/PEncoder.ts b/src/PEncoder.ts new file mode 100644 index 000000000..bb1d2c9ef --- /dev/null +++ b/src/PEncoder.ts @@ -0,0 +1,200 @@ +/** + * @since 2.2.3 + */ +import { Contravariant2 } from 'fp-ts/lib/Contravariant' +import { pipeable } from 'fp-ts/lib/pipeable' +import { intersect } from './Decoder' +import { memoize } from './Schemable' +import { identity } from 'fp-ts/lib/function' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export interface PEncoder { + readonly encode: (a: A) => O +} + +/** + * @since 2.2.3 + */ +export type TypeOf = E extends PEncoder ? A : never + +/** + * @since 2.2.3 + */ +export type OutputOf = E extends PEncoder ? O : never + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export function id(): PEncoder { + return { + encode: identity + } +} + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export function nullable(or: PEncoder): PEncoder { + return { + encode: (a) => (a === null ? null : or.encode(a)) + } +} + +/** + * @since 2.2.3 + */ +export function type

>>( + properties: P +): PEncoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { + return { + encode: (a) => { + const o: Record = {} as any + for (const k in properties) { + o[k] = properties[k].encode(a[k]) + } + return o + } + } +} + +/** + * @since 2.2.3 + */ +export function partial

>>( + properties: P +): PEncoder }>, Partial<{ [K in keyof P]: TypeOf }>> { + return { + encode: (a) => { + const o: Record = {} as any + for (const k in properties) { + const v = a[k] + // don't add missing properties + if (k in a) { + // don't strip undefined properties + o[k] = v === undefined ? undefined : properties[k].encode(v) + } + } + return o + } + } +} + +/** + * @since 2.2.3 + */ +export function record(codomain: PEncoder): PEncoder, Record> { + return { + encode: (r) => { + const o: Record = {} + for (const k in r) { + o[k] = codomain.encode(r[k]) + } + return o + } + } +} + +/** + * @since 2.2.3 + */ +export function array(items: PEncoder): PEncoder, Array> { + return { + encode: (as) => as.map(items.encode) + } +} + +/** + * @since 2.2.3 + */ +export function tuple>>( + ...components: C +): PEncoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> { + return { + encode: (as) => components.map((c, i) => c.encode(as[i])) as any + } +} + +/** + * @since 2.2.3 + */ +export function intersection(left: PEncoder, right: PEncoder): PEncoder { + return { + encode: (ab) => intersect(left.encode(ab), right.encode(ab)) + } +} + +/** + * @since 2.2.3 + */ +export function sum( + tag: T +): >>(members: M) => PEncoder, TypeOf> { + return (members: Record>) => { + return { + encode: (a: Record) => members[a[tag]].encode(a) + } + } +} + +/** + * @since 2.2.3 + */ +export function lazy(f: () => PEncoder): PEncoder { + const get = memoize>(f) + return { + encode: (a) => get().encode(a) + } +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const URI = 'PEncoder' + +/** + * @since 2.2.3 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind2 { + readonly PEncoder: PEncoder + } +} + +/** + * @since 2.2.3 + */ +export const pencoder: Contravariant2 = { + URI, + contramap: (fa, f) => ({ + encode: (b) => fa.encode(f(b)) + }) +} + +const { contramap } = pipeable(pencoder) + +export { + /** + * @since 2.2.3 + */ + contramap +} diff --git a/test/PEncoder.ts b/test/PEncoder.ts new file mode 100644 index 000000000..c18153764 --- /dev/null +++ b/test/PEncoder.ts @@ -0,0 +1,106 @@ +import * as assert from 'assert' +import * as PE from '../src/PEncoder' + +const NumberToString: PE.PEncoder = { + encode: String +} + +const BooleanToNumber: PE.PEncoder = { + encode: (b) => (b ? 1 : 0) +} + +describe('PEncoder', () => { + describe('pencoder', () => { + it('contramap', () => { + const encoder = PE.pencoder.contramap(NumberToString, (s: string) => s.length) + assert.deepStrictEqual(encoder.encode('aaa'), '3') + }) + }) + + it('nullable', () => { + const encoder = PE.nullable(NumberToString) + assert.deepStrictEqual(encoder.encode(1), '1') + assert.deepStrictEqual(encoder.encode(null), null) + }) + + it('type', () => { + const encoder = PE.type({ a: NumberToString, b: BooleanToNumber }) + assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) + }) + + it('partial', () => { + const encoder = PE.partial({ a: NumberToString, b: BooleanToNumber }) + assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) + assert.deepStrictEqual(encoder.encode({ a: 1 }), { a: '1' }) + assert.deepStrictEqual(encoder.encode({ a: 1, b: undefined }), { a: '1', b: undefined }) + assert.deepStrictEqual(encoder.encode({ b: true }), { b: 1 }) + assert.deepStrictEqual(encoder.encode({}), {}) + }) + + it('record', () => { + const encoder = PE.record(NumberToString) + assert.deepStrictEqual(encoder.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) + }) + + it('array', () => { + const encoder = PE.array(NumberToString) + assert.deepStrictEqual(encoder.encode([1, 2]), ['1', '2']) + }) + + it('tuple', () => { + const encoder = PE.tuple(NumberToString, BooleanToNumber) + assert.deepStrictEqual(encoder.encode([3, true]), ['3', 1]) + }) + + it('intersection', () => { + const encoder = PE.intersection(PE.type({ a: NumberToString }), PE.type({ b: BooleanToNumber })) + assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) + }) + + it('sum', () => { + const S1 = PE.type({ _tag: PE.id<'A'>(), a: NumberToString }) + const S2 = PE.type({ _tag: PE.id<'B'>(), b: BooleanToNumber }) + const sum = PE.sum('_tag') + const encoder = sum({ A: S1, B: S2 }) + assert.deepStrictEqual(encoder.encode({ _tag: 'A', a: 1 }), { _tag: 'A', a: '1' }) + assert.deepStrictEqual(encoder.encode({ _tag: 'B', b: true }), { _tag: 'B', b: 1 }) + }) + + it('lazy', () => { + interface A { + a: number + bs: Array + } + interface AOut { + a: string + bs: Array + } + interface B { + b: boolean + as: Array + } + interface BOut { + b: number + as: Array + } + const A: PE.PEncoder = PE.lazy(() => + PE.type({ + a: NumberToString, + bs: PE.array(B) + }) + ) + + const B: PE.PEncoder = PE.lazy(() => + PE.type({ + b: BooleanToNumber, + as: PE.array(A) + }) + ) + assert.deepStrictEqual(A.encode({ a: 1, bs: [] }), { a: '1', bs: [] }) + assert.deepStrictEqual(A.encode({ a: 1, bs: [{ b: true, as: [] }] }), { a: '1', bs: [{ b: 1, as: [] }] }) + assert.deepStrictEqual(A.encode({ a: 1, bs: [{ b: true, as: [{ a: 2, bs: [] }] }] }), { + a: '1', + bs: [{ b: 1, as: [{ a: '2', bs: [] }] }] + }) + }) +}) From fea04a078a17723be7e3e6897926468051e3ead0 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 18 May 2020 16:47:52 +0200 Subject: [PATCH 027/222] implement Encoder via PEncoder --- docs/modules/Encoder.ts.md | 22 ++++----- src/Encoder.ts | 92 +++++++------------------------------- 2 files changed, 26 insertions(+), 88 deletions(-) diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 0d29c471e..3fd8ea999 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -78,7 +78,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function array(items: Encoder): Encoder> +export declare const array: (items: Encoder) => Encoder ``` Added in v2.2.0 @@ -118,7 +118,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function intersection(left: Encoder, right: Encoder): Encoder +export declare const intersection: (left: Encoder, right: Encoder) => Encoder ``` Added in v2.2.0 @@ -128,7 +128,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function lazy(f: () => Encoder): Encoder +export declare const lazy: (f: () => Encoder) => Encoder ``` Added in v2.2.0 @@ -138,7 +138,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function nullable(or: Encoder): Encoder +export declare const nullable: (or: Encoder) => Encoder ``` Added in v2.2.0 @@ -148,7 +148,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Encoder }): Encoder> +export declare const partial: (properties: { [K in keyof A]: Encoder }) => Encoder> ``` Added in v2.2.0 @@ -158,7 +158,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function record(codomain: Encoder): Encoder> +export declare const record: (codomain: Encoder) => Encoder> ``` Added in v2.2.0 @@ -168,9 +168,9 @@ Added in v2.2.0 **Signature** ```ts -export declare function sum( +export declare const sum: ( tag: T -): (members: { [K in keyof A]: Encoder> }) => Encoder +) => (members: { [K in keyof A]: Encoder> }) => Encoder ``` Added in v2.2.0 @@ -180,9 +180,9 @@ Added in v2.2.0 **Signature** ```ts -export declare function tuple>( +export declare const tuple: ( ...components: { [K in keyof A]: Encoder } -): Encoder +) => Encoder ``` Added in v2.2.0 @@ -192,7 +192,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Encoder }): Encoder +export declare const type: (properties: { [K in keyof A]: Encoder }) => Encoder ``` Added in v2.2.0 diff --git a/src/Encoder.ts b/src/Encoder.ts index d2481e0f9..7d29955e2 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -4,8 +4,8 @@ import { Contravariant1 } from 'fp-ts/lib/Contravariant' import { identity } from 'fp-ts/lib/function' import { pipeable } from 'fp-ts/lib/pipeable' -import { Schemable1, memoize } from './Schemable' -import { intersect } from './Decoder' +import * as PE from './PEncoder' +import { Schemable1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -41,111 +41,51 @@ export const id: Encoder = { /** * @since 2.2.0 */ -export function nullable(or: Encoder): Encoder { - return { - encode: (a) => (a === null ? null : or.encode(a)) - } -} +export const nullable: (or: Encoder) => Encoder = PE.nullable /** * @since 2.2.0 */ -export function type(properties: { [K in keyof A]: Encoder }): Encoder { - return { - encode: (a) => { - const o: Record = {} - for (const k in properties) { - o[k] = properties[k].encode(a[k]) - } - return o - } - } -} +export const type: (properties: { [K in keyof A]: Encoder }) => Encoder = PE.type as any /** * @since 2.2.0 */ -export function partial(properties: { [K in keyof A]: Encoder }): Encoder> { - return { - encode: (a) => { - const o: Record = {} - for (const k in properties) { - const v: A[Extract] | undefined = a[k] - // don't add missing properties - if (k in a) { - // don't strip undefined properties - o[k] = v === undefined ? undefined : properties[k].encode(v) - } - } - return o - } - } -} +export const partial: (properties: { [K in keyof A]: Encoder }) => Encoder> = PE.partial as any /** * @since 2.2.0 */ -export function record(codomain: Encoder): Encoder> { - return { - encode: (r) => { - const o: Record = {} - for (const k in r) { - o[k] = codomain.encode(r[k]) - } - return o - } - } -} +export const record: (codomain: Encoder) => Encoder> = PE.record /** * @since 2.2.0 */ -export function array(items: Encoder): Encoder> { - return { - encode: (as) => as.map(items.encode) - } -} +export const array: (items: Encoder) => Encoder> = PE.array /** * @since 2.2.0 */ -export function tuple>(...components: { [K in keyof A]: Encoder }): Encoder { - return { - encode: (as) => components.map((c, i) => c.encode(as[i])) - } -} +export const tuple: >( + ...components: { [K in keyof A]: Encoder } +) => Encoder = PE.tuple as any /** * @since 2.2.0 */ -export function intersection(left: Encoder, right: Encoder): Encoder { - return { - encode: (ab) => intersect(left.encode(ab), right.encode(ab)) - } -} +export const intersection: (left: Encoder, right: Encoder) => Encoder = PE.intersection /** * @since 2.2.0 */ -export function sum( +export const sum: ( tag: T -): (members: { [K in keyof A]: Encoder> }) => Encoder { - return (members: Record>) => { - return { - encode: (a: Record) => members[a[tag]].encode(a) - } - } -} +) => (members: { [K in keyof A]: Encoder> }) => Encoder = PE.sum as any /** * @since 2.2.0 */ -export function lazy(f: () => Encoder): Encoder { - const get = memoize>(f) - return { - encode: (a) => get().encode(a) - } -} +export const lazy: (f: () => Encoder) => Encoder = PE.lazy // ------------------------------------------------------------------------------------- // instances @@ -172,9 +112,7 @@ declare module 'fp-ts/lib/HKT' { */ export const encoder: Contravariant1 & Schemable1 = { URI, - contramap: (fa, f) => ({ - encode: (b) => fa.encode(f(b)) - }), + contramap: PE.pencoder.contramap, literal: () => id, string: id, number: id, From cfe1817c7086bc7b00ae34c62c21e0512dc456d9 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 19 May 2020 09:46:45 +0200 Subject: [PATCH 028/222] add namespaces to io-ts URIs --- docs/modules/Codec.ts.md | 4 ++-- docs/modules/Decoder.ts.md | 12 ++++++------ docs/modules/Encoder.ts.md | 4 ++-- docs/modules/Guard.ts.md | 4 ++-- docs/modules/PEncoder.ts.md | 4 ++-- docs/modules/Type.ts.md | 4 ++-- src/Codec.ts | 4 ++-- src/Decoder.ts | 4 ++-- src/Encoder.ts | 4 ++-- src/Guard.ts | 4 ++-- src/PEncoder.ts | 4 ++-- src/Type.ts | 4 ++-- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 958ab7a61..00e56b0bc 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -78,7 +78,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const URI: 'Codec' +export declare const URI: 'io-ts/Codec' ``` Added in v2.2.0 @@ -128,7 +128,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const codec: Invariant1<'Codec'> & Schemable1<'Codec'> & WithRefinement1<'Codec'> +export declare const codec: Invariant1<'io-ts/Codec'> & Schemable1<'io-ts/Codec'> & WithRefinement1<'io-ts/Codec'> ``` Added in v2.2.0 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 0de769157..0d9a8f715 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -98,7 +98,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const URI: 'Decoder' +export declare const URI: 'io-ts/Decoder' ``` Added in v2.2.0 @@ -188,11 +188,11 @@ Added in v2.2.0 **Signature** ```ts -export declare const decoder: Applicative1<'Decoder'> & - Alternative1<'Decoder'> & - Schemable1<'Decoder'> & - WithUnion1<'Decoder'> & - WithRefinement1<'Decoder'> +export declare const decoder: Applicative1<'io-ts/Decoder'> & + Alternative1<'io-ts/Decoder'> & + Schemable1<'io-ts/Decoder'> & + WithUnion1<'io-ts/Decoder'> & + WithRefinement1<'io-ts/Decoder'> ``` Added in v2.2.0 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 3fd8ea999..69e1f1fa5 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -68,7 +68,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const URI: 'Encoder' +export declare const URI: 'io-ts/Encoder' ``` Added in v2.2.0 @@ -98,7 +98,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const encoder: Contravariant1<'Encoder'> & Schemable1<'Encoder'> +export declare const encoder: Contravariant1<'io-ts/Encoder'> & Schemable1<'io-ts/Encoder'> ``` Added in v2.2.0 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 4c0945804..a853f13a8 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -75,7 +75,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const URI: 'Guard' +export declare const URI: 'io-ts/Guard' ``` Added in v2.2.0 @@ -125,7 +125,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const guard: Schemable1<'Guard'> & WithUnion1<'Guard'> & WithRefinement1<'Guard'> +export declare const guard: Schemable1<'io-ts/Guard'> & WithUnion1<'io-ts/Guard'> & WithRefinement1<'io-ts/Guard'> ``` Added in v2.2.0 diff --git a/docs/modules/PEncoder.ts.md b/docs/modules/PEncoder.ts.md index 2c76b5bae..0abb4aeff 100644 --- a/docs/modules/PEncoder.ts.md +++ b/docs/modules/PEncoder.ts.md @@ -79,7 +79,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const URI: 'PEncoder' +export declare const URI: 'io-ts/PEncoder' ``` Added in v2.2.3 @@ -161,7 +161,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const pencoder: Contravariant2<'PEncoder'> +export declare const pencoder: Contravariant2<'io-ts/PEncoder'> ``` Added in v2.2.3 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 67accb5b6..bfb33c7db 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -61,7 +61,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const URI: 'Type' +export declare const URI: 'io-ts/Type' ``` Added in v2.2.3 @@ -111,7 +111,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const instance: Schemable1<'Type'> & WithUnion1<'Type'> & WithRefinement1<'Type'> +export declare const instance: Schemable1<'io-ts/Type'> & WithUnion1<'io-ts/Type'> & WithRefinement1<'io-ts/Type'> ``` Added in v2.2.3 diff --git a/src/Codec.ts b/src/Codec.ts index 261f2f98f..e2c724db7 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -170,7 +170,7 @@ export function lazy(id: string, f: () => Codec): Codec { /** * @since 2.2.0 */ -export const URI = 'Codec' +export const URI = 'io-ts/Codec' /** * @since 2.2.0 @@ -179,7 +179,7 @@ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind { - readonly Codec: Codec + readonly [URI]: Codec } } diff --git a/src/Decoder.ts b/src/Decoder.ts index 77613bdcf..99f2929c5 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -453,7 +453,7 @@ export function union>( /** * @since 2.2.0 */ -export const URI = 'Decoder' +export const URI = 'io-ts/Decoder' /** * @since 2.2.0 @@ -462,7 +462,7 @@ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind { - readonly Decoder: Decoder + readonly [URI]: Decoder } } diff --git a/src/Encoder.ts b/src/Encoder.ts index 7d29955e2..efe55612a 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -94,7 +94,7 @@ export const lazy: (f: () => Encoder) => Encoder = PE.lazy /** * @since 2.2.0 */ -export const URI = 'Encoder' +export const URI = 'io-ts/Encoder' /** * @since 2.2.0 @@ -103,7 +103,7 @@ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind { - readonly Encoder: Encoder + readonly [URI]: Encoder } } diff --git a/src/Guard.ts b/src/Guard.ts index ee9518fd4..780e7e315 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -212,7 +212,7 @@ export function lazy(f: () => Guard): Guard { /** * @since 2.2.0 */ -export const URI = 'Guard' +export const URI = 'io-ts/Guard' /** * @since 2.2.0 @@ -221,7 +221,7 @@ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind { - readonly Guard: Guard + readonly [URI]: Guard } } diff --git a/src/PEncoder.ts b/src/PEncoder.ts index bb1d2c9ef..3982a854e 100644 --- a/src/PEncoder.ts +++ b/src/PEncoder.ts @@ -167,7 +167,7 @@ export function lazy(f: () => PEncoder): PEncoder { /** * @since 2.2.3 */ -export const URI = 'PEncoder' +export const URI = 'io-ts/PEncoder' /** * @since 2.2.3 @@ -176,7 +176,7 @@ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind2 { - readonly PEncoder: PEncoder + readonly [URI]: PEncoder } } diff --git a/src/Type.ts b/src/Type.ts index c542de351..e1285117a 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -144,7 +144,7 @@ export function union>(...members: { [K in keyo /** * @since 2.2.3 */ -export const URI = 'Type' +export const URI = 'io-ts/Type' /** * @since 2.2.3 @@ -153,7 +153,7 @@ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind { - readonly Type: Type + readonly [URI]: Type } } From 2305368b34506aa414ff59805c5d57bea89c55e0 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 19 May 2020 11:17:01 +0200 Subject: [PATCH 029/222] simplify interpreter --- src/Schema.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Schema.ts b/src/Schema.ts index 9e90daaeb..8e5b424e7 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -26,7 +26,6 @@ export function make(schema: Schema): Schema { /** * @since 2.2.3 */ -export function interpreter(S: Schemable1): (schema: Schema) => Kind -export function interpreter(S: Schemable): (schema: Schema) => HKT { - return (schema) => schema(S) +export function interpreter(S: Schemable1): (schema: Schema) => Kind { + return (schema: any) => schema(S) } From bce5a4a0b45553cfef9ba4f8e1116c17913cd0ee Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 19 May 2020 13:19:25 +0200 Subject: [PATCH 030/222] add `JsonEncoder` experimental module --- CHANGELOG.md | 3 + docs/modules/Codec.ts.md | 5 +- docs/modules/Decoder.ts.md | 1 + docs/modules/Eq.ts.md | 2 +- docs/modules/Guard.ts.md | 5 +- docs/modules/JsonEncoder.ts.md | 231 ++++++++++++++++++++++++++++++++ docs/modules/PEncoder.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 34 ++++- docs/modules/Tree.ts.md | 2 +- docs/modules/Type.ts.md | 7 +- dtslint/ts3.5/Schema.ts | 46 +++++-- src/Codec.ts | 12 +- src/Decoder.ts | 7 +- src/Encoder.ts | 15 +-- src/Eq.ts | 8 +- src/Guard.ts | 8 +- src/JsonEncoder.ts | 150 +++++++++++++++++++++ src/PEncoder.ts | 14 +- src/Schemable.ts | 20 ++- src/Type.ts | 8 +- test/Arbitrary.ts | 16 ++- test/JsonEncoder.ts | 11 ++ test/PEncoder.ts | 5 + test/Schema.ts | 28 ++-- test/Type.ts | 19 ++- 28 files changed, 571 insertions(+), 94 deletions(-) create mode 100644 docs/modules/JsonEncoder.ts.md create mode 100644 src/JsonEncoder.ts create mode 100644 test/JsonEncoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d673902eb..57db1a9c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,12 +19,15 @@ - **Experimental** - add `Type` experimental module, #464 (@gcanti) - add `PEncoder` experimental module, #469 (@gcanti) + - add `JsonEncoder` experimental module (@gcanti) - `Schemable` - rename `Schemable` interface to `Schemable1` (@gcanti) - rename `WithUnion` interface to `WithUnion1` (@gcanti) - add `Schemable` interface (@gcanti) - add `WithUnion` interface (@gcanti) - add `WithRefinement` / `WithRefinement1` interfaces (@gcanti) + - add `WithUnknownContainers` / `WithUnknownContainers1` interfaces (@gcanti) + - move `UnknownArray` and `UnknownRecord` to `WithUnknownContainers` (@gcanti) - `Schema` - refactoring with the new `Schemable` interface (@gcanti) - add `interpreter` function (@gcanti) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 00e56b0bc..5e61fc1e6 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -128,7 +128,10 @@ Added in v2.2.0 **Signature** ```ts -export declare const codec: Invariant1<'io-ts/Codec'> & Schemable1<'io-ts/Codec'> & WithRefinement1<'io-ts/Codec'> +export declare const codec: Invariant1<'io-ts/Codec'> & + Schemable1<'io-ts/Codec'> & + WithUnknownContainers1<'io-ts/Codec'> & + WithRefinement1<'io-ts/Codec'> ``` Added in v2.2.0 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 0d9a8f715..7e91a17fb 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -191,6 +191,7 @@ Added in v2.2.0 export declare const decoder: Applicative1<'io-ts/Decoder'> & Alternative1<'io-ts/Decoder'> & Schemable1<'io-ts/Decoder'> & + WithUnknownContainers1<'io-ts/Decoder'> & WithUnion1<'io-ts/Decoder'> & WithRefinement1<'io-ts/Decoder'> ``` diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 19dab4328..e98893272 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -97,7 +97,7 @@ Added in v2.2.2 **Signature** ```ts -export declare const eq: Contravariant1<'Eq'> & Schemable1<'Eq'> & WithRefinement1<'Eq'> +export declare const eq: Contravariant1<'Eq'> & Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefinement1<'Eq'> ``` Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index a853f13a8..48a739912 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -125,7 +125,10 @@ Added in v2.2.0 **Signature** ```ts -export declare const guard: Schemable1<'io-ts/Guard'> & WithUnion1<'io-ts/Guard'> & WithRefinement1<'io-ts/Guard'> +export declare const guard: Schemable1<'io-ts/Guard'> & + WithUnknownContainers1<'io-ts/Guard'> & + WithUnion1<'io-ts/Guard'> & + WithRefinement1<'io-ts/Guard'> ``` Added in v2.2.0 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md new file mode 100644 index 000000000..d87741037 --- /dev/null +++ b/docs/modules/JsonEncoder.ts.md @@ -0,0 +1,231 @@ +--- +title: JsonEncoder.ts +nav_order: 7 +parent: Modules +--- + +# JsonEncoder overview + +Added in v2.2.3 + +--- + +

Table of contents

+ +- [JsonArray (interface)](#jsonarray-interface) +- [JsonEncoder (interface)](#jsonencoder-interface) +- [Json (type alias)](#json-type-alias) +- [JsonObject (type alias)](#jsonobject-type-alias) +- [TypeOf (type alias)](#typeof-type-alias) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [array](#array) +- [contramap](#contramap) +- [id](#id) +- [intersection](#intersection) +- [jsonEncoder](#jsonencoder) +- [lazy](#lazy) +- [nullable](#nullable) +- [partial](#partial) +- [record](#record) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) + +--- + +# JsonArray (interface) + +**Signature** + +```ts +export interface JsonArray extends Array {} +``` + +Added in v2.2.3 + +# JsonEncoder (interface) + +**Signature** + +```ts +export interface JsonEncoder { + readonly encode: (a: A) => Json +} +``` + +Added in v2.2.3 + +# Json (type alias) + +**Signature** + +```ts +export type Json = null | string | number | boolean | JsonObject | JsonArray +``` + +Added in v2.2.3 + +# JsonObject (type alias) + +**Signature** + +```ts +export type JsonObject = { [key: string]: Json } +``` + +Added in v2.2.3 + +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = E extends JsonEncoder ? A : never +``` + +Added in v2.2.3 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.3 + +# URI + +**Signature** + +```ts +export declare const URI: 'io-ts/JsonEncoder' +``` + +Added in v2.2.3 + +# array + +**Signature** + +```ts +export declare const array: (items: JsonEncoder) => JsonEncoder +``` + +Added in v2.2.3 + +# contramap + +**Signature** + +```ts +export declare const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder +``` + +Added in v2.2.3 + +# id + +**Signature** + +```ts +export declare const id: JsonEncoder +``` + +Added in v2.2.3 + +# intersection + +**Signature** + +```ts +export declare const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder +``` + +Added in v2.2.3 + +# jsonEncoder + +**Signature** + +```ts +export declare const jsonEncoder: Contravariant1<'io-ts/JsonEncoder'> & Schemable1<'io-ts/JsonEncoder'> +``` + +Added in v2.2.3 + +# lazy + +**Signature** + +```ts +export declare const lazy: (f: () => JsonEncoder) => JsonEncoder +``` + +Added in v2.2.3 + +# nullable + +**Signature** + +```ts +export declare const nullable: (or: JsonEncoder) => JsonEncoder +``` + +Added in v2.2.3 + +# partial + +**Signature** + +```ts +export declare const partial: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder> +``` + +Added in v2.2.3 + +# record + +**Signature** + +```ts +export declare const record: (codomain: JsonEncoder) => JsonEncoder> +``` + +Added in v2.2.3 + +# sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: JsonEncoder> }) => JsonEncoder +``` + +Added in v2.2.3 + +# tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: JsonEncoder } +) => JsonEncoder +``` + +Added in v2.2.3 + +# type + +**Signature** + +```ts +export declare const type: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder +``` + +Added in v2.2.3 diff --git a/docs/modules/PEncoder.ts.md b/docs/modules/PEncoder.ts.md index 0abb4aeff..00dd84149 100644 --- a/docs/modules/PEncoder.ts.md +++ b/docs/modules/PEncoder.ts.md @@ -1,6 +1,6 @@ --- title: PEncoder.ts -nav_order: 8 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index e46f4619e..c8212506f 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 7 +nav_order: 8 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 396d74cf6..a6d9e4fac 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 9 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 4063d084a..ecec5cb06 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 10 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 1ff8afb3f..902ba044b 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 11 +nav_order: 12 parent: Modules --- @@ -18,6 +18,8 @@ Added in v2.2.0 - [WithRefinement1 (interface)](#withrefinement1-interface) - [WithUnion (interface)](#withunion-interface) - [WithUnion1 (interface)](#withunion1-interface) +- [WithUnknownContainers (interface)](#withunknowncontainers-interface) +- [WithUnknownContainers1 (interface)](#withunknowncontainers1-interface) - [Literal (type alias)](#literal-type-alias) - [memoize](#memoize) @@ -34,8 +36,6 @@ export interface Schemable { readonly string: HKT readonly number: HKT readonly boolean: HKT - readonly UnknownArray: HKT> - readonly UnknownRecord: HKT> readonly nullable: (or: HKT) => HKT readonly type: (properties: { [K in keyof A]: HKT }) => HKT readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> @@ -63,8 +63,6 @@ export interface Schemable1 { readonly string: Kind readonly number: Kind readonly boolean: Kind - readonly UnknownArray: Kind> - readonly UnknownRecord: Kind> readonly nullable: (or: Kind) => Kind readonly type: (properties: { [K in keyof A]: Kind }) => Kind readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> @@ -131,6 +129,32 @@ export interface WithUnion1 { Added in v2.2.3 +# WithUnknownContainers (interface) + +**Signature** + +```ts +export interface WithUnknownContainers { + readonly UnknownArray: HKT> + readonly UnknownRecord: HKT> +} +``` + +Added in v2.2.3 + +# WithUnknownContainers1 (interface) + +**Signature** + +```ts +export interface WithUnknownContainers1 { + readonly UnknownArray: Kind> + readonly UnknownRecord: Kind> +} +``` + +Added in v2.2.3 + # Literal (type alias) **Signature** diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index 819ee92f5..bc531c728 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -1,6 +1,6 @@ --- title: Tree.ts -nav_order: 12 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index bfb33c7db..d1c31ac36 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 13 +nav_order: 14 parent: Modules --- @@ -111,7 +111,10 @@ Added in v2.2.3 **Signature** ```ts -export declare const instance: Schemable1<'io-ts/Type'> & WithUnion1<'io-ts/Type'> & WithRefinement1<'io-ts/Type'> +export declare const instance: Schemable1<'io-ts/Type'> & + WithUnknownContainers1<'io-ts/Type'> & + WithUnion1<'io-ts/Type'> & + WithRefinement1<'io-ts/Type'> ``` Added in v2.2.3 diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index dc43083ad..cc611935d 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -1,5 +1,16 @@ import * as D from '../../src/Decoder' -import { make, Schema, TypeOf } from '../../src/Schema' +import { Schemable, WithUnknownContainers, memoize, WithRefinement, WithUnion } from '../../src/Schemable' +import { HKT } from 'fp-ts/lib/HKT' + +interface Schema { + (S: Schemable & WithUnknownContainers & WithRefinement & WithUnion): HKT +} + +export type TypeOf = S extends Schema ? A : never + +function make(f: Schema): Schema { + return memoize(f) +} // // TypeOf @@ -27,16 +38,6 @@ make((S) => S.number) // $ExpectType Schema // make((S) => S.boolean) // $ExpectType Schema -// -// UnknownArray -// -make((S) => S.UnknownArray) // $ExpectType Schema - -// -// UnknownRecord -// -make((S) => S.UnknownRecord) // $ExpectType Schema> - // // nullable // @@ -112,8 +113,27 @@ const B: Schema = make((S) => ) ) +// +// UnknownArray +// +make((S) => S.UnknownArray) // $ExpectType Schema + +// +// UnknownRecord +// +make((S) => S.UnknownRecord) // $ExpectType Schema> + +// +// refinement +// +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +make((S) => S.refinement(S.number, (n): n is Positive => n > 0, 'Positive')) + // // union // -D.union(D.string) // $ExpectType Decoder -D.union(D.string, D.number) // $ExpectType Decoder +make((S) => S.union(S.string)) // $ExpectType Schema +make((S) => S.union(S.string, S.number)) // $ExpectType Schema diff --git a/src/Codec.ts b/src/Codec.ts index e2c724db7..0cabc6cfa 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -4,7 +4,7 @@ import { Invariant1 } from 'fp-ts/lib/Invariant' import * as D from './Decoder' import * as E from './Encoder' -import { Literal, Schemable1, WithRefinement1 } from './Schemable' +import { Literal, Schemable1, WithRefinement1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -68,12 +68,12 @@ export const boolean: Codec = make(D.decoder.boolean, E.encoder.boolean /** * @since 2.2.0 */ -export const UnknownArray: Codec> = make(D.decoder.UnknownArray, E.encoder.UnknownArray) +export const UnknownArray: Codec> = make(D.decoder.UnknownArray, E.id) /** * @since 2.2.0 */ -export const UnknownRecord: Codec> = make(D.decoder.UnknownRecord, E.encoder.UnknownRecord) +export const UnknownRecord: Codec> = make(D.decoder.UnknownRecord, E.id) // ------------------------------------------------------------------------------------- // combinators @@ -186,15 +186,13 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const codec: Invariant1 & Schemable1 & WithRefinement1 = { +export const codec: Invariant1 & Schemable1 & WithUnknownContainers1 & WithRefinement1 = { URI, imap: (fa, f, g) => make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)), literal, string, number, boolean, - UnknownArray, - UnknownRecord, nullable, type, partial, @@ -204,5 +202,7 @@ export const codec: Invariant1 & Schemable1 & WithRefinement1 = { intersection, sum, lazy, + UnknownArray, + UnknownRecord, refinement: refinement as WithRefinement1['refinement'] } diff --git a/src/Decoder.ts b/src/Decoder.ts index 99f2929c5..289d0d55f 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -8,7 +8,7 @@ import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' import { pipe, pipeable } from 'fp-ts/lib/pipeable' import { Forest, Tree } from 'fp-ts/lib/Tree' import * as G from './Guard' -import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1 } from './Schemable' +import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -472,6 +472,7 @@ declare module 'fp-ts/lib/HKT' { export const decoder: Applicative1 & Alternative1 & Schemable1 & + WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { URI, @@ -492,8 +493,6 @@ export const decoder: Applicative1 & string, number, boolean, - UnknownArray, - UnknownRecord, nullable, type, partial, @@ -503,6 +502,8 @@ export const decoder: Applicative1 & intersection, sum, lazy, + UnknownArray, + UnknownRecord, union, refinement: refinement as WithRefinement1['refinement'] } diff --git a/src/Encoder.ts b/src/Encoder.ts index efe55612a..554f5cc72 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -3,7 +3,6 @@ */ import { Contravariant1 } from 'fp-ts/lib/Contravariant' import { identity } from 'fp-ts/lib/function' -import { pipeable } from 'fp-ts/lib/pipeable' import * as PE from './PEncoder' import { Schemable1 } from './Schemable' @@ -117,8 +116,6 @@ export const encoder: Contravariant1 & Schemable1 = { string: id, number: id, boolean: id, - UnknownArray: id, - UnknownRecord: id, nullable, type, partial, @@ -130,11 +127,7 @@ export const encoder: Contravariant1 & Schemable1 = { lazy: (_, f) => lazy(f) } -const { contramap } = pipeable(encoder) - -export { - /** - * @since 2.2.0 - */ - contramap -} +/** + * @since 2.2.0 + */ +export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = PE.contramap diff --git a/src/Eq.ts b/src/Eq.ts index 796999227..2966f4ba0 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -4,7 +4,7 @@ import * as A from 'fp-ts/lib/Array' import * as E from 'fp-ts/lib/Eq' import * as R from 'fp-ts/lib/Record' -import { memoize, Schemable1, WithRefinement1 } from './Schemable' +import { memoize, Schemable1, WithRefinement1, WithUnknownContainers1 } from './Schemable' import Eq = E.Eq /** @@ -153,14 +153,12 @@ export function lazy(f: () => Eq): Eq { /** * @since 2.2.2 */ -export const eq: typeof E.eq & Schemable1 & WithRefinement1 = { +export const eq: typeof E.eq & Schemable1 & WithUnknownContainers1 & WithRefinement1 = { ...E.eq, literal: () => E.eqStrict, string, number, boolean, - UnknownArray, - UnknownRecord, nullable, type, partial, @@ -170,5 +168,7 @@ export const eq: typeof E.eq & Schemable1 & WithRefinement1 = { intersection, sum, lazy: (_, f) => lazy(f), + UnknownArray, + UnknownRecord, refinement: (from) => from } diff --git a/src/Guard.ts b/src/Guard.ts index 780e7e315..20bf499c0 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -1,7 +1,7 @@ /** * @since 2.2.0 */ -import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1 } from './Schemable' +import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -228,14 +228,12 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.0 */ -export const guard: Schemable1 & WithUnion1 & WithRefinement1 = { +export const guard: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { URI, literal, string, number, boolean, - UnknownArray, - UnknownRecord, nullable, type, partial, @@ -245,6 +243,8 @@ export const guard: Schemable1 & WithUnion1 & WithRefinement1 = { intersection, sum, lazy: (_, f) => lazy(f), + UnknownArray, + UnknownRecord, union, refinement: refinement as WithRefinement1['refinement'] } diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts new file mode 100644 index 000000000..65f579894 --- /dev/null +++ b/src/JsonEncoder.ts @@ -0,0 +1,150 @@ +/** + * @since 2.2.3 + */ +import { Contravariant1 } from 'fp-ts/lib/Contravariant' +import { identity } from 'fp-ts/lib/function' +import * as PE from './PEncoder' +import { Schemable1 } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export interface JsonArray extends Array {} + +/** + * @since 2.2.3 + */ +export type JsonObject = { [key: string]: Json } + +/** + * @since 2.2.3 + */ +export type Json = null | string | number | boolean | JsonObject | JsonArray + +/** + * @since 2.2.3 + */ +export interface JsonEncoder { + readonly encode: (a: A) => Json +} + +/** + * @since 2.2.3 + */ +export type TypeOf = E extends JsonEncoder ? A : never + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const id: JsonEncoder = { + encode: identity +} + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const nullable: (or: JsonEncoder) => JsonEncoder = PE.nullable + +/** + * @since 2.2.3 + */ +export const type: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder = PE.type as any + +/** + * @since 2.2.3 + */ +export const partial: ( + properties: { [K in keyof A]: JsonEncoder } +) => JsonEncoder> = PE.partial as any + +/** + * @since 2.2.3 + */ +export const record: (codomain: JsonEncoder) => JsonEncoder> = PE.record + +/** + * @since 2.2.3 + */ +export const array: (items: JsonEncoder) => JsonEncoder> = PE.array + +/** + * @since 2.2.3 + */ +export const tuple: >( + ...components: { [K in keyof A]: JsonEncoder } +) => JsonEncoder = PE.tuple as any + +/** + * @since 2.2.3 + */ +export const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder = PE.intersection + +/** + * @since 2.2.3 + */ +export const sum: ( + tag: T +) => (members: { [K in keyof A]: JsonEncoder> }) => JsonEncoder = PE.sum as any + +/** + * @since 2.2.3 + */ +export const lazy: (f: () => JsonEncoder) => JsonEncoder = PE.lazy + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const URI = 'io-ts/JsonEncoder' + +/** + * @since 2.2.3 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: JsonEncoder + } +} + +/** + * @since 2.2.3 + */ +export const jsonEncoder: Contravariant1 & Schemable1 = { + URI, + contramap: PE.pencoder.contramap, + literal: () => id, + string: id, + number: id, + boolean: id, + nullable, + type, + partial, + record, + array, + tuple, + intersection, + sum, + lazy: (_, f) => lazy(f) +} + +/** + * @since 2.2.3 + */ +export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder = PE.contramap diff --git a/src/PEncoder.ts b/src/PEncoder.ts index 3982a854e..98435917c 100644 --- a/src/PEncoder.ts +++ b/src/PEncoder.ts @@ -2,7 +2,6 @@ * @since 2.2.3 */ import { Contravariant2 } from 'fp-ts/lib/Contravariant' -import { pipeable } from 'fp-ts/lib/pipeable' import { intersect } from './Decoder' import { memoize } from './Schemable' import { identity } from 'fp-ts/lib/function' @@ -190,11 +189,8 @@ export const pencoder: Contravariant2 = { }) } -const { contramap } = pipeable(pencoder) - -export { - /** - * @since 2.2.3 - */ - contramap -} +/** + * @since 2.2.3 + */ +export const contramap: (f: (b: B) => A) => (fa: PEncoder) => PEncoder = (f) => (fa) => + pencoder.contramap(fa, f) diff --git a/src/Schemable.ts b/src/Schemable.ts index 60222498c..e7431329a 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -17,8 +17,6 @@ export interface Schemable { readonly string: HKT readonly number: HKT readonly boolean: HKT - readonly UnknownArray: HKT> - readonly UnknownRecord: HKT> readonly nullable: (or: HKT) => HKT readonly type: (properties: { [K in keyof A]: HKT }) => HKT readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> @@ -41,8 +39,6 @@ export interface Schemable1 { readonly string: Kind readonly number: Kind readonly boolean: Kind - readonly UnknownArray: Kind> - readonly UnknownRecord: Kind> readonly nullable: (or: Kind) => Kind readonly type: (properties: { [K in keyof A]: Kind }) => Kind readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> @@ -56,6 +52,22 @@ export interface Schemable1 { readonly lazy: (id: string, f: () => Kind) => Kind } +/** + * @since 2.2.3 + */ +export interface WithUnknownContainers { + readonly UnknownArray: HKT> + readonly UnknownRecord: HKT> +} + +/** + * @since 2.2.3 + */ +export interface WithUnknownContainers1 { + readonly UnknownArray: Kind> + readonly UnknownRecord: Kind> +} + /** * @since 2.2.3 */ diff --git a/src/Type.ts b/src/Type.ts index e1285117a..df95abc11 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -2,7 +2,7 @@ * @since 2.2.3 */ import * as t from './index' -import { Literal, Schemable1, WithUnion1, WithRefinement1 } from './Schemable' +import { Literal, Schemable1, WithUnion1, WithRefinement1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -160,14 +160,12 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.3 */ -export const instance: Schemable1 & WithUnion1 & WithRefinement1 = { +export const instance: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { URI, literal, string, number, boolean, - UnknownArray, - UnknownRecord, nullable, type, partial, @@ -177,6 +175,8 @@ export const instance: Schemable1 & WithUnion1 & WithRefinement1 intersection, sum, lazy, + UnknownArray, + UnknownRecord, union, refinement: refinement as WithRefinement1['refinement'] } diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 7cdb059b2..cd17e5517 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -43,6 +43,10 @@ export const UnknownRecord: Arbitrary> = fc.dictionary(s // combinators // ------------------------------------------------------------------------------------- +export function refinement(from: Arbitrary, refinement: (a: A) => a is B): Arbitrary { + return from.filter(refinement) +} + export function nullable(or: Arbitrary): Arbitrary { return fc.oneof(fc.constant(null), or) } @@ -112,14 +116,15 @@ declare module 'fp-ts/lib/HKT' { } } -export const arbitrary: S.Schemable1 & S.WithUnion1 = { +export const arbitrary: S.Schemable1 & + S.WithUnknownContainers1 & + S.WithUnion1 & + S.WithRefinement1 = { URI, literal, string, number, boolean, - UnknownArray, - UnknownRecord, nullable, type, partial, @@ -129,5 +134,8 @@ export const arbitrary: S.Schemable1 & S.WithUnion1 = { intersection, sum, lazy: (_, f) => lazy(f), - union + UnknownArray, + UnknownRecord, + union, + refinement: refinement as S.WithRefinement1['refinement'] } diff --git a/test/JsonEncoder.ts b/test/JsonEncoder.ts new file mode 100644 index 000000000..6ec2c0a7c --- /dev/null +++ b/test/JsonEncoder.ts @@ -0,0 +1,11 @@ +import * as assert from 'assert' +import * as JE from '../src/JsonEncoder' + +describe('Encoder', () => { + describe('JsonEncoder', () => { + it('contramap', () => { + const encoder = JE.jsonEncoder.contramap(JE.jsonEncoder.number, (s: string) => s.length) + assert.deepStrictEqual(encoder.encode('aaa'), 3) + }) + }) +}) diff --git a/test/PEncoder.ts b/test/PEncoder.ts index c18153764..a579e1218 100644 --- a/test/PEncoder.ts +++ b/test/PEncoder.ts @@ -17,6 +17,11 @@ describe('PEncoder', () => { }) }) + it('contramap', () => { + const encoder = PE.contramap((s: string) => s.length)(NumberToString) + assert.deepStrictEqual(encoder.encode('aaa'), '3') + }) + it('nullable', () => { const encoder = PE.nullable(NumberToString) assert.deepStrictEqual(encoder.encode(1), '1') diff --git a/test/Schema.ts b/test/Schema.ts index 8191a3f81..09780a845 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -4,8 +4,9 @@ import { isRight } from 'fp-ts/lib/Either' import * as C from '../src/Codec' import * as Eq from '../src/Eq' import * as G from '../src/Guard' -import { interpreter, make, Schema } from '../src/Schema' +import { Schema, interpreter, make } from '../src/Schema' import * as A from './Arbitrary' +import * as JE from '../src/JsonEncoder' function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { try { @@ -21,22 +22,25 @@ function check(schema: Schema): void { const codec = interpreter(C.codec)(schema) const guard = interpreter(G.guard)(schema) const eq = interpreter(Eq.eq)(schema) + const encoder = interpreter(JE.jsonEncoder)(schema) // decoders, guards and eqs should be aligned fc.assert(fc.property(arb, (a) => isRight(codec.decode(a)) && guard.is(a) && eq.equals(a, a))) // laws - fc.assert(fc.property(arb, (a) => isRight(codec.decode(codec.encode(a))))) + // 1. + fc.assert(fc.property(arb, (a) => isRight(codec.decode(codec.encode(a))) && isRight(codec.decode(encoder.encode(a))))) + // 2. fc.assert( fc.property(arb, (u) => { const a = codec.decode(u) if (isRight(a)) { const o = a.right - return isDeepStrictEqual(codec.encode(o), u) && eq.equals(o, u) + return isDeepStrictEqual(codec.encode(o), u) && isDeepStrictEqual(encoder.encode(o), u) && eq.equals(o, u) } return false }) ) } -describe('Schemable', () => { +describe('Schema', () => { it('string', () => { check(make((S) => S.string)) }) @@ -49,14 +53,6 @@ describe('Schemable', () => { check(make((S) => S.boolean)) }) - it('UnknownArray', () => { - check(make((S) => S.UnknownArray)) - }) - - it('UnknownRecord', () => { - check(make((S) => S.UnknownRecord)) - }) - it('literal', () => { check(make((S) => S.literal('a'))) check(make((S) => S.literal('a', 1))) @@ -125,4 +121,12 @@ describe('Schemable', () => { ) check(schema) }) + + // it('UnknownArray', () => { + // check(make((S) => S.UnknownArray)) + // }) + + // it('UnknownRecord', () => { + // check(make((S) => S.UnknownRecord)) + // }) }) diff --git a/test/Type.ts b/test/Type.ts index fc4199d33..3c0f04805 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -5,21 +5,30 @@ import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' import * as t from '../src' import * as D from '../src/Decoder' import * as G from '../src/Guard' -import { memoize, Schemable, WithUnion, Schemable1, WithUnion1 } from '../src/Schemable' +import { + memoize, + Schemable, + WithUnion, + Schemable1, + WithUnion1, + WithUnknownContainers, + WithUnknownContainers1 +} from '../src/Schemable' import * as T from '../src/Type' import * as A from './Arbitrary' interface Schema { - (S: Schemable & WithUnion): HKT + (S: Schemable & WithUnknownContainers & WithUnion): HKT } function make(f: Schema): Schema { return memoize(f) } -function interpreter(S: Schemable1 & WithUnion1): (schema: Schema) => Kind -function interpreter(S: Schemable & WithUnion): (schema: Schema) => HKT { - return (schema) => schema(S) +function interpreter( + S: Schemable1 & WithUnknownContainers1 & WithUnion1 +): (schema: Schema) => Kind { + return (schema: any) => schema(S) } function check(schema: Schema, type: t.Type): void { From 051e7afbd23b546d1c818fab062674839d528473 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 19 May 2020 14:50:43 +0200 Subject: [PATCH 031/222] refactor documentation --- README.md | 32 +++++----- docs/index.md | 140 ++++++++++++++++++++++++++++++++++++++++++++ Type.md => index.md | 0 3 files changed, 154 insertions(+), 18 deletions(-) rename Type.md => index.md (100%) diff --git a/README.md b/README.md index 5d9cb74f0..bc60435b5 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,39 @@ [![build status](https://img.shields.io/travis/gcanti/io-ts/master.svg?style=flat-square)](https://travis-ci.org/gcanti/io-ts) [![dependency status](https://img.shields.io/david/gcanti/io-ts.svg?style=flat-square)](https://david-dm.org/gcanti/io-ts) ![npm downloads](https://img.shields.io/npm/dm/io-ts.svg) -[![Minified Size](https://badgen.net/bundlephobia/minzip/io-ts)](https://bundlephobia.com/result?p=io-ts) - [Installation](#installation) -- [Documentation](#documentation) - - [Usage](#usage) +- [Usage](#usage) + - [Stable features](#stable-features) + - [Experimental features (version `2.2+`)](#experimental-features-version-22) # Installation -To install the stable version: +To install the stable version ```sh npm i io-ts fp-ts ``` -Note: [`fp-ts`](https://github.com/gcanti/fp-ts) is a peer dependency for `io-ts` +**Note**. [`fp-ts`](https://github.com/gcanti/fp-ts) is a peer dependency for `io-ts` -# Documentation +# Usage -- [API Reference](https://gcanti.github.io/io-ts/docs/modules) +## Stable features -## Usage +- [`index.ts` module](index.md) -**Stable features** - -- [`Type`](Type.md) - -**Experimental features** (version `2.2+`) +## Experimental features (version `2.2+`) Experimental features are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. -- [`Decoder`](Decoder.md) -- [`Encoder`](Encoder.md) -- [`Codec`](Codec.md) -- [`Eq`](Eq.md) -- [`Schema` (advanced feature)](Schema.md) +- [`Decoder.ts` module](Decoder.md) +- [`Encoder.ts` module](Encoder.md) +- [`Codec.ts` module](Codec.md) +- [`Eq.ts` module](Eq.md) +- [`Schema.ts` module (advanced feature)](Schema.md) diff --git a/docs/index.md b/docs/index.md index 62a28f1ec..c24f80555 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,3 +3,143 @@ title: Home --- # Runtime type system for IO decoding/encoding + +## The idea + +A value of type `Type` (called "codec") is the runtime representation of the static type `A`. + +A codec can: + +- decode inputs of type `I` (through `decode`) +- encode outputs of type `O` (through `encode`) +- be used as a custom [type guard](https://basarat.gitbooks.io/typescript/content/docs/types/typeGuard.html) (through `is`) + +```ts +class Type { + constructor( + /** a unique name for this codec */ + readonly name: string, + + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: Context) => Either, + + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + + /** a version of `validate` with a default context */ + decode(i: I): Either +} +``` + +The [`Either`](https://gcanti.github.io/fp-ts/modules/Either.ts.html) type returned by `decode` is defined in [fp-ts](https://github.com/gcanti/fp-ts), a library containing implementations of common algebraic types in TypeScript. + +The `Either` type represents a value of one of two possible types (a disjoint union). An instance of `Either` is either an instance of `Left` or `Right`: + +```ts +type Either = + | { + readonly _tag: 'Left' + readonly left: E + } + | { + readonly _tag: 'Right' + readonly right: A + } +``` + +Convention dictates that `Left` is used for **failure** and `Right` is used for **success**. + +**Example** + +A codec representing `string` can be defined as: + +```ts +import * as t from 'io-ts' + +const string = new t.Type( + 'string', + (input: unknown): input is string => typeof input === 'string', + // `t.success` and `t.failure` are helpers used to build `Either` instances + (input, context) => (typeof input === 'string' ? t.success(input) : t.failure(input, context)), + // `A` and `O` are the same, so `encode` is just the identity function + t.identity +) +``` + +and we can use it as follows: + +```ts +import { isRight } from 'fp-ts/lib/Either' + +isRight(string.decode('a string')) // true +isRight(string.decode(null)) // false +``` + +More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold-function) along with `pipe` (which is similar to the pipeline operator) + +```ts +import * as t from 'io-ts' +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' + +// failure handler +const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` + +// success handler +const onRight = (s: string) => `No errors: ${s}` + +pipe(t.string.decode('a string'), fold(onLeft, onRight)) +// => "No errors: a string" + +pipe(t.string.decode(null), fold(onLeft, onRight)) +// => "1 error(s) found" +``` + +We can combine these codecs through [combinators](#implemented-types--combinators) to build composite types which represent entities like domain models, request payloads etc. in our applications: + +```ts +import * as t from 'io-ts' + +const User = t.type({ + userId: t.number, + name: t.string +}) +``` + +So this is equivalent to defining something like: + +```ts +type User = { + userId: number + name: string +} +``` + +The advantage of using `io-ts` to define the runtime type is that we can validate the type at runtime, and we can also extract the corresponding static type, so we don’t have to define it twice. + +## Error reporters + +A reporter implements the following interface + +```ts +interface Reporter { + report: (validation: Validation) => A +} +``` + +This package exports a default `PathReporter` reporter + +Example + +```ts +import { PathReporter } from 'io-ts/lib/PathReporter' + +const result = User.decode({ name: 'Giulio' }) + +console.log(PathReporter.report(result)) +// => [ 'Invalid value undefined supplied to : { userId: number, name: string }/userId: number' ] +``` diff --git a/Type.md b/index.md similarity index 100% rename from Type.md rename to index.md From ef969be17820e619eb64356c947af0c6624920eb Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 19 May 2020 17:53:43 +0200 Subject: [PATCH 032/222] - rename Encoder to JsonEncoder and change its fixed output type to Json - rename PEncoder to Encoder - use Encoder in Codec - add JsonCodec --- CHANGELOG.md | 4 +- docs/modules/Codec.ts.md | 131 +++++++++------- docs/modules/Encoder.ts.md | 96 +++++++----- docs/modules/JsonCodec.ts.md | 265 ++++++++++++++++++++++++++++++++ docs/modules/JsonEncoder.ts.md | 4 +- docs/modules/PEncoder.ts.md | 213 ------------------------- docs/modules/PathReporter.ts.md | 2 +- dtslint/ts3.5/Econder.ts | 102 ++++++++++++ dtslint/ts3.5/PEconder.ts | 101 ------------ src/Codec.ts | 171 +++++++++++---------- src/Encoder.ts | 188 +++++++++++++++------- src/JsonCodec.ts | 172 +++++++++++++++++++++ src/JsonEncoder.ts | 26 ++-- src/PEncoder.ts | 196 ----------------------- test/Codec.ts | 15 +- test/Encoder.ts | 107 ++++++++++++- test/PEncoder.ts | 111 ------------- test/Schema.ts | 4 +- 18 files changed, 1033 insertions(+), 875 deletions(-) create mode 100644 docs/modules/JsonCodec.ts.md delete mode 100644 docs/modules/PEncoder.ts.md create mode 100644 dtslint/ts3.5/Econder.ts delete mode 100644 dtslint/ts3.5/PEconder.ts create mode 100644 src/JsonCodec.ts delete mode 100644 src/PEncoder.ts delete mode 100644 test/PEncoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 57db1a9c9..775cdaca8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,9 @@ - **Experimental** - add `Type` experimental module, #464 (@gcanti) - - add `PEncoder` experimental module, #469 (@gcanti) + - restore the `O` type parameter to `Encoder`, #469 (@gcanti) + - add the `O` type parameter to `Codec` (@gcanti) + - add `JsonCodec` experimental module (@gcanti) - add `JsonEncoder` experimental module (@gcanti) - `Schemable` - rename `Schemable` interface to `Schemable1` (@gcanti) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 5e61fc1e6..552b19be9 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -6,13 +6,14 @@ parent: Modules # Codec overview -Added in v2.2.0 +Added in v2.2.3 ---

Table of contents

- [Codec (interface)](#codec-interface) +- [OutputOf (type alias)](#outputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) - [URI (type alias)](#uri-type-alias) - [URI](#uri) @@ -21,6 +22,7 @@ Added in v2.2.0 - [array](#array) - [boolean](#boolean) - [codec](#codec) +- [fromDecoder](#fromdecoder) - [intersection](#intersection) - [lazy](#lazy) - [literal](#literal) @@ -48,20 +50,30 @@ Laws: **Signature** ```ts -export interface Codec
extends D.Decoder, E.Encoder {} +export interface Codec extends D.Decoder, E.Encoder {} ``` -Added in v2.2.0 +Added in v2.2.3 + +# OutputOf (type alias) + +**Signature** + +```ts +export type OutputOf = E.OutputOf +``` + +Added in v2.2.3 # TypeOf (type alias) **Signature** ```ts -export type TypeOf = C extends Codec ? A : never +export type TypeOf = E.TypeOf ``` -Added in v2.2.2 +Added in v2.2.3 # URI (type alias) @@ -71,7 +83,7 @@ Added in v2.2.2 export type URI = typeof URI ``` -Added in v2.2.0 +Added in v2.2.3 # URI @@ -81,164 +93,173 @@ Added in v2.2.0 export declare const URI: 'io-ts/Codec' ``` -Added in v2.2.0 +Added in v2.2.3 # UnknownArray **Signature** ```ts -export declare const UnknownArray: Codec +export declare const UnknownArray: Codec ``` -Added in v2.2.0 +Added in v2.2.3 # UnknownRecord **Signature** ```ts -export declare const UnknownRecord: Codec> +export declare const UnknownRecord: Codec, Record> ``` -Added in v2.2.0 +Added in v2.2.3 # array **Signature** ```ts -export declare function array(items: Codec): Codec> +export declare function array(items: Codec): Codec, Array> ``` -Added in v2.2.0 +Added in v2.2.3 # boolean **Signature** ```ts -export declare const boolean: Codec +export declare const boolean: Codec ``` -Added in v2.2.0 +Added in v2.2.3 # codec **Signature** ```ts -export declare const codec: Invariant1<'io-ts/Codec'> & - Schemable1<'io-ts/Codec'> & - WithUnknownContainers1<'io-ts/Codec'> & - WithRefinement1<'io-ts/Codec'> +export declare const codec: Invariant2<'io-ts/Codec'> +``` + +Added in v2.2.3 + +# fromDecoder + +**Signature** + +```ts +export declare function fromDecoder(decoder: D.Decoder): Codec ``` -Added in v2.2.0 +Added in v2.2.3 # intersection **Signature** ```ts -export declare function intersection(left: Codec, right: Codec): Codec +export declare function intersection(left: Codec, right: Codec): Codec ``` -Added in v2.2.0 +Added in v2.2.3 # lazy **Signature** ```ts -export declare function lazy(id: string, f: () => Codec): Codec +export declare function lazy(id: string, f: () => Codec): Codec ``` -Added in v2.2.0 +Added in v2.2.3 # literal **Signature** ```ts -export declare function literal>(...values: A): Codec +export declare function literal>(...values: A): Codec ``` -Added in v2.2.0 +Added in v2.2.3 # make **Signature** ```ts -export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec +export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec ``` -Added in v2.2.0 +Added in v2.2.3 # nullable **Signature** ```ts -export declare function nullable(or: Codec): Codec +export declare function nullable(or: Codec): Codec ``` -Added in v2.2.0 +Added in v2.2.3 # number **Signature** ```ts -export declare const number: Codec +export declare const number: Codec ``` -Added in v2.2.0 +Added in v2.2.3 # partial **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Codec }): Codec> +export declare function partial

>>( + properties: P +): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> ``` -Added in v2.2.0 +Added in v2.2.3 # record **Signature** ```ts -export declare function record(codomain: Codec): Codec> +export declare function record(codomain: Codec): Codec, Record> ``` -Added in v2.2.0 +Added in v2.2.3 # refinement **Signature** ```ts -export declare function refinement( - from: Codec, +export declare function refinement( + from: Codec, refinement: (a: A) => a is B, expected: string -): Codec +): Codec ``` -Added in v2.2.0 +Added in v2.2.3 # string **Signature** ```ts -export declare const string: Codec +export declare const string: Codec ``` -Added in v2.2.0 +Added in v2.2.3 # sum @@ -247,42 +268,44 @@ Added in v2.2.0 ```ts export declare function sum( tag: T -): (members: { [K in keyof A]: Codec> }) => Codec +): >>(members: M) => Codec, TypeOf> ``` -Added in v2.2.0 +Added in v2.2.3 # tuple **Signature** ```ts -export declare function tuple>( - ...components: { [K in keyof A]: Codec } -): Codec +export declare function tuple>>( + ...components: C +): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> ``` -Added in v2.2.0 +Added in v2.2.3 # type **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Codec }): Codec +export declare function type

>>( + properties: P +): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> ``` -Added in v2.2.0 +Added in v2.2.3 # withExpected **Signature** ```ts -export declare function withExpected( - codec: Codec, +export declare function withExpected( + codec: Codec, expected: (actual: unknown, e: D.DecodeError) => D.DecodeError -): Codec +): Codec ``` -Added in v2.2.0 +Added in v2.2.3 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 69e1f1fa5..67c80bfdd 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -6,17 +6,19 @@ parent: Modules # Encoder overview -Added in v2.2.0 +Added in v2.2.3 ---

Table of contents

- [Encoder (interface)](#encoder-interface) +- [OutputOf (type alias)](#outputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) - [URI (type alias)](#uri-type-alias) - [URI](#uri) - [array](#array) +- [compose](#compose) - [contramap](#contramap) - [encoder](#encoder) - [id](#id) @@ -36,22 +38,32 @@ Added in v2.2.0 **Signature** ```ts -export interface Encoder { - readonly encode: (a: A) => unknown +export interface Encoder { + readonly encode: (a: A) => O } ``` -Added in v2.2.0 +Added in v2.2.3 + +# OutputOf (type alias) + +**Signature** + +```ts +export type OutputOf = E extends Encoder ? O : never +``` + +Added in v2.2.3 # TypeOf (type alias) **Signature** ```ts -export type TypeOf = E extends Encoder ? A : never +export type TypeOf = E extends Encoder ? A : never ``` -Added in v2.2.2 +Added in v2.2.3 # URI (type alias) @@ -61,7 +73,7 @@ Added in v2.2.2 export type URI = typeof URI ``` -Added in v2.2.0 +Added in v2.2.3 # URI @@ -71,128 +83,142 @@ Added in v2.2.0 export declare const URI: 'io-ts/Encoder' ``` -Added in v2.2.0 +Added in v2.2.3 # array **Signature** ```ts -export declare const array: (items: Encoder) => Encoder +export declare function array(items: Encoder): Encoder, Array> +``` + +Added in v2.2.3 + +# compose + +**Signature** + +```ts +export declare const compose: (ea: Encoder) => (ab: Encoder) => Encoder ``` -Added in v2.2.0 +Added in v2.2.3 # contramap **Signature** ```ts -export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder +export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder ``` -Added in v2.2.0 +Added in v2.2.3 # encoder **Signature** ```ts -export declare const encoder: Contravariant1<'io-ts/Encoder'> & Schemable1<'io-ts/Encoder'> +export declare const encoder: Contravariant2<'io-ts/Encoder'> & Category2<'io-ts/Encoder'> ``` -Added in v2.2.0 +Added in v2.2.3 # id **Signature** ```ts -export declare const id: Encoder +export declare function id(): Encoder ``` -Added in v2.2.0 +Added in v2.2.3 # intersection **Signature** ```ts -export declare const intersection: (left: Encoder, right: Encoder) => Encoder +export declare function intersection(left: Encoder, right: Encoder): Encoder ``` -Added in v2.2.0 +Added in v2.2.3 # lazy **Signature** ```ts -export declare const lazy: (f: () => Encoder) => Encoder +export declare function lazy(f: () => Encoder): Encoder ``` -Added in v2.2.0 +Added in v2.2.3 # nullable **Signature** ```ts -export declare const nullable: (or: Encoder) => Encoder +export declare function nullable(or: Encoder): Encoder ``` -Added in v2.2.0 +Added in v2.2.3 # partial **Signature** ```ts -export declare const partial: (properties: { [K in keyof A]: Encoder }) => Encoder> +export declare function partial

>>( + properties: P +): Encoder }>, Partial<{ [K in keyof P]: TypeOf }>> ``` -Added in v2.2.0 +Added in v2.2.3 # record **Signature** ```ts -export declare const record: (codomain: Encoder) => Encoder> +export declare function record(codomain: Encoder): Encoder, Record> ``` -Added in v2.2.0 +Added in v2.2.3 # sum **Signature** ```ts -export declare const sum: ( +export declare function sum( tag: T -) => (members: { [K in keyof A]: Encoder> }) => Encoder +): >>(members: M) => Encoder, TypeOf> ``` -Added in v2.2.0 +Added in v2.2.3 # tuple **Signature** ```ts -export declare const tuple: ( - ...components: { [K in keyof A]: Encoder } -) => Encoder +export declare function tuple>>( + ...components: C +): Encoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> ``` -Added in v2.2.0 +Added in v2.2.3 # type **Signature** ```ts -export declare const type: (properties: { [K in keyof A]: Encoder }) => Encoder +export declare function type

>>( + properties: P +): Encoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> ``` -Added in v2.2.0 +Added in v2.2.3 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md new file mode 100644 index 000000000..d4d3ed9e6 --- /dev/null +++ b/docs/modules/JsonCodec.ts.md @@ -0,0 +1,265 @@ +--- +title: JsonCodec.ts +nav_order: 7 +parent: Modules +--- + +# JsonCodec overview + +Added in v2.2.3 + +--- + +

Table of contents

+ +- [JsonCodec (interface)](#jsoncodec-interface) +- [TypeOf (type alias)](#typeof-type-alias) +- [URI (type alias)](#uri-type-alias) +- [URI](#uri) +- [array](#array) +- [boolean](#boolean) +- [intersection](#intersection) +- [jsonCodec](#jsoncodec) +- [lazy](#lazy) +- [literal](#literal) +- [make](#make) +- [nullable](#nullable) +- [number](#number) +- [partial](#partial) +- [record](#record) +- [refinement](#refinement) +- [string](#string) +- [sum](#sum) +- [tuple](#tuple) +- [type](#type) +- [withExpected](#withexpected) + +--- + +# JsonCodec (interface) + +Laws: + +1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` +2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` + +**Signature** + +```ts +export interface JsonCodec extends C.Codec {} +``` + +Added in v2.2.3 + +# TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = JE.TypeOf +``` + +Added in v2.2.2 + +# URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.3 + +# URI + +**Signature** + +```ts +export declare const URI: 'io-ts/JsonCodec' +``` + +Added in v2.2.3 + +# array + +**Signature** + +```ts +export declare const array: (items: JsonCodec) => JsonCodec +``` + +Added in v2.2.3 + +# boolean + +**Signature** + +```ts +export declare const boolean: JsonCodec +``` + +Added in v2.2.3 + +# intersection + +**Signature** + +```ts +export declare const intersection: (left: JsonCodec, right: JsonCodec) => JsonCodec +``` + +Added in v2.2.3 + +# jsonCodec + +**Signature** + +```ts +export declare const jsonCodec: Invariant1<'io-ts/JsonCodec'> & + Schemable1<'io-ts/JsonCodec'> & + WithRefinement1<'io-ts/JsonCodec'> +``` + +Added in v2.2.3 + +# lazy + +**Signature** + +```ts +export declare const lazy: (id: string, f: () => JsonCodec) => JsonCodec +``` + +Added in v2.2.3 + +# literal + +**Signature** + +```ts +export declare const literal: (...values: A) => JsonCodec +``` + +Added in v2.2.3 + +# make + +**Signature** + +```ts +export declare const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec +``` + +Added in v2.2.3 + +# nullable + +**Signature** + +```ts +export declare const nullable: (or: JsonCodec) => JsonCodec +``` + +Added in v2.2.3 + +# number + +**Signature** + +```ts +export declare const number: JsonCodec +``` + +Added in v2.2.3 + +# partial + +**Signature** + +```ts +export declare const partial: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec> +``` + +Added in v2.2.3 + +# record + +**Signature** + +```ts +export declare const record: (codomain: JsonCodec) => JsonCodec> +``` + +Added in v2.2.3 + +# refinement + +**Signature** + +```ts +export declare const refinement: ( + from: JsonCodec, + refinement: (a: A) => a is B, + expected: string +) => JsonCodec +``` + +Added in v2.2.3 + +# string + +**Signature** + +```ts +export declare const string: JsonCodec +``` + +Added in v2.2.3 + +# sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: JsonCodec> }) => JsonCodec +``` + +Added in v2.2.3 + +# tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: JsonCodec } +) => JsonCodec +``` + +Added in v2.2.3 + +# type + +**Signature** + +```ts +export declare const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec +``` + +Added in v2.2.3 + +# withExpected + +**Signature** + +```ts +export declare const withExpected: ( + codec: JsonCodec, + expected: (actual: unknown, e: D.DecodeError) => D.DecodeError +) => JsonCodec +``` + +Added in v2.2.3 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index d87741037..e19a5828a 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 7 +nav_order: 8 parent: Modules --- @@ -81,7 +81,7 @@ Added in v2.2.3 **Signature** ```ts -export type TypeOf = E extends JsonEncoder ? A : never +export type TypeOf = E.TypeOf ``` Added in v2.2.3 diff --git a/docs/modules/PEncoder.ts.md b/docs/modules/PEncoder.ts.md deleted file mode 100644 index 00dd84149..000000000 --- a/docs/modules/PEncoder.ts.md +++ /dev/null @@ -1,213 +0,0 @@ ---- -title: PEncoder.ts -nav_order: 9 -parent: Modules ---- - -# PEncoder overview - -Added in v2.2.3 - ---- - -

Table of contents

- -- [PEncoder (interface)](#pencoder-interface) -- [OutputOf (type alias)](#outputof-type-alias) -- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [array](#array) -- [contramap](#contramap) -- [id](#id) -- [intersection](#intersection) -- [lazy](#lazy) -- [nullable](#nullable) -- [partial](#partial) -- [pencoder](#pencoder) -- [record](#record) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) - ---- - -# PEncoder (interface) - -**Signature** - -```ts -export interface PEncoder { - readonly encode: (a: A) => O -} -``` - -Added in v2.2.3 - -# OutputOf (type alias) - -**Signature** - -```ts -export type OutputOf = E extends PEncoder ? O : never -``` - -Added in v2.2.3 - -# TypeOf (type alias) - -**Signature** - -```ts -export type TypeOf = E extends PEncoder ? A : never -``` - -Added in v2.2.3 - -# URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.3 - -# URI - -**Signature** - -```ts -export declare const URI: 'io-ts/PEncoder' -``` - -Added in v2.2.3 - -# array - -**Signature** - -```ts -export declare function array(items: PEncoder): PEncoder, Array
> -``` - -Added in v2.2.3 - -# contramap - -**Signature** - -```ts -export declare const contramap: (f: (b: B) => A) => (fa: PEncoder) => PEncoder -``` - -Added in v2.2.3 - -# id - -**Signature** - -```ts -export declare function id(): PEncoder -``` - -Added in v2.2.3 - -# intersection - -**Signature** - -```ts -export declare function intersection(left: PEncoder, right: PEncoder): PEncoder -``` - -Added in v2.2.3 - -# lazy - -**Signature** - -```ts -export declare function lazy(f: () => PEncoder): PEncoder -``` - -Added in v2.2.3 - -# nullable - -**Signature** - -```ts -export declare function nullable(or: PEncoder): PEncoder -``` - -Added in v2.2.3 - -# partial - -**Signature** - -```ts -export declare function partial

>>( - properties: P -): PEncoder }>, Partial<{ [K in keyof P]: TypeOf }>> -``` - -Added in v2.2.3 - -# pencoder - -**Signature** - -```ts -export declare const pencoder: Contravariant2<'io-ts/PEncoder'> -``` - -Added in v2.2.3 - -# record - -**Signature** - -```ts -export declare function record(codomain: PEncoder): PEncoder, Record> -``` - -Added in v2.2.3 - -# sum - -**Signature** - -```ts -export declare function sum( - tag: T -): >>(members: M) => PEncoder, TypeOf> -``` - -Added in v2.2.3 - -# tuple - -**Signature** - -```ts -export declare function tuple>>( - ...components: C -): PEncoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> -``` - -Added in v2.2.3 - -# type - -**Signature** - -```ts -export declare function type

>>( - properties: P -): PEncoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> -``` - -Added in v2.2.3 diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index c8212506f..80e6dfafc 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 8 +nav_order: 9 parent: Modules --- diff --git a/dtslint/ts3.5/Econder.ts b/dtslint/ts3.5/Econder.ts new file mode 100644 index 000000000..e306e687d --- /dev/null +++ b/dtslint/ts3.5/Econder.ts @@ -0,0 +1,102 @@ +import * as E from '../../src/Encoder' +import { identity } from 'fp-ts/lib/function' + +const NumberToString: E.Encoder = { + encode: String +} + +const BooleanToNumber: E.Encoder = { + encode: (b) => (b ? 1 : 0) +} + +export const Person = E.type({ name: E.encoder.id(), age: NumberToString }) + +// +// TypeOf +// +export type Person = E.TypeOf // $ExpectType { name: string; age: number; } + +// +// OutputOf +// +export type PersonOut = E.OutputOf // $ExpectType { name: string; age: string; } + +// +// nullable +// +E.nullable(NumberToString) // $ExpectType Encoder + +// +// type +// +E.type({ a: NumberToString }) // $ExpectType Encoder<{ a: string; }, { a: number; }> + +// +// partial +// +E.partial({ a: NumberToString }) // $ExpectType Encoder, Partial<{ a: number; }>> + +// +// record +// +E.record(NumberToString) // $ExpectType Encoder, Record> + +// +// array +// +E.array(NumberToString) // $ExpectType Encoder + +// +// tuple +// +E.tuple() // $ExpectType Encoder<[], []> +E.tuple(NumberToString) // $ExpectType Encoder<[string], [number]> +E.tuple(NumberToString, BooleanToNumber) // $ExpectType Encoder<[string, number], [number, boolean]> + +// +// intersection +// +E.intersection(E.type({ a: NumberToString }), E.type({ b: BooleanToNumber })) // $ExpectType Encoder<{ a: string; } & { b: number; }, { a: number; } & { b: boolean; }> + +// +// sum +// +const S1 = E.type({ _tag: E.id<'A'>(), a: NumberToString }) +const S2 = E.type({ _tag: E.id<'B'>(), b: BooleanToNumber }) +const sum = E.sum('_tag') + +// $ExpectType Encoder<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }, { _tag: "A"; a: number; } | { _tag: "B"; b: boolean; }> +sum({ A: S1, B: S2 }) + +// +// lazy +// +interface A { + a: number + bs: Array +} +interface AOut { + a: string + bs: Array +} +interface B { + b: boolean + as: Array +} +interface BOut { + b: number + as: Array +} +const A: E.Encoder = E.lazy(() => + E.type({ + a: NumberToString, + bs: E.array(B) + }) +) + +const B: E.Encoder = E.lazy(() => + E.type({ + b: BooleanToNumber, + as: E.array(A) + }) +) diff --git a/dtslint/ts3.5/PEconder.ts b/dtslint/ts3.5/PEconder.ts deleted file mode 100644 index 6e6426aac..000000000 --- a/dtslint/ts3.5/PEconder.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as PE from '../../src/PEncoder' - -const NumberToString: PE.PEncoder = { - encode: String -} - -const BooleanToNumber: PE.PEncoder = { - encode: (b) => (b ? 1 : 0) -} - -export const Person = PE.type({ name: PE.id(), age: NumberToString }) - -// -// TypeOf -// -export type Person = PE.TypeOf // $ExpectType { name: string; age: number; } - -// -// OutputOf -// -export type PersonOut = PE.OutputOf // $ExpectType { name: string; age: string; } - -// -// nullable -// -PE.nullable(NumberToString) // $ExpectType PEncoder - -// -// type -// -PE.type({ a: NumberToString }) // $ExpectType PEncoder<{ a: string; }, { a: number; }> - -// -// partial -// -PE.partial({ a: NumberToString }) // $ExpectType PEncoder, Partial<{ a: number; }>> - -// -// record -// -PE.record(NumberToString) // $ExpectType PEncoder, Record> - -// -// array -// -PE.array(NumberToString) // $ExpectType PEncoder - -// -// tuple -// -PE.tuple() // $ExpectType PEncoder<[], []> -PE.tuple(NumberToString) // $ExpectType PEncoder<[string], [number]> -PE.tuple(NumberToString, BooleanToNumber) // $ExpectType PEncoder<[string, number], [number, boolean]> - -// -// intersection -// -PE.intersection(PE.type({ a: NumberToString }), PE.type({ b: BooleanToNumber })) // $ExpectType PEncoder<{ a: string; } & { b: number; }, { a: number; } & { b: boolean; }> - -// -// sum -// -const S1 = PE.type({ _tag: PE.id<'A'>(), a: NumberToString }) -const S2 = PE.type({ _tag: PE.id<'B'>(), b: BooleanToNumber }) -const sum = PE.sum('_tag') - -// $ExpectType PEncoder<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }, { _tag: "A"; a: number; } | { _tag: "B"; b: boolean; }> -sum({ A: S1, B: S2 }) - -// -// lazy -// -interface A { - a: number - bs: Array -} -interface AOut { - a: string - bs: Array -} -interface B { - b: boolean - as: Array -} -interface BOut { - b: number - as: Array -} -const A: PE.PEncoder = PE.lazy(() => - PE.type({ - a: NumberToString, - bs: PE.array(B) - }) -) - -const B: PE.PEncoder = PE.lazy(() => - PE.type({ - b: BooleanToNumber, - as: PE.array(A) - }) -) diff --git a/src/Codec.ts b/src/Codec.ts index 0cabc6cfa..e0de984ed 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -1,10 +1,11 @@ /** - * @since 2.2.0 + * @since 2.2.3 */ -import { Invariant1 } from 'fp-ts/lib/Invariant' +import { Invariant2 } from 'fp-ts/lib/Invariant' import * as D from './Decoder' import * as E from './Encoder' -import { Literal, Schemable1, WithRefinement1, WithUnknownContainers1 } from './Schemable' +import { Literal } from './Schemable' +import { identity } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- // model @@ -16,23 +17,28 @@ import { Literal, Schemable1, WithRefinement1, WithUnknownContainers1 } from './ * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` * - * @since 2.2.0 + * @since 2.2.3 */ -export interface Codec extends D.Decoder, E.Encoder {} +export interface Codec extends D.Decoder, E.Encoder {} /** - * @since 2.2.2 + * @since 2.2.3 */ -export type TypeOf = C extends Codec ? A : never +export type TypeOf = E.TypeOf + +/** + * @since 2.2.3 + */ +export type OutputOf = E.OutputOf // ------------------------------------------------------------------------------------- // constructors // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @since 2.2.3 */ -export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { +export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { return { decode: decoder.decode, encode: encoder.encode @@ -40,10 +46,20 @@ export function make(decoder: D.Decoder, encoder: E.Encoder): Codec } /** - * @since 2.2.0 + * @since 2.2.3 + */ +export function fromDecoder(decoder: D.Decoder): Codec { + return { + decode: decoder.decode, + encode: identity + } +} + +/** + * @since 2.2.3 */ -export function literal>(...values: A): Codec { - return make(D.decoder.literal(...values), E.encoder.literal(...values)) +export function literal>(...values: A): Codec { + return fromDecoder(D.literal(...values)) } // ------------------------------------------------------------------------------------- @@ -51,116 +67,129 @@ export function literal>(...values: A): Codec = make(D.decoder.string, E.encoder.string) +export const string: Codec = fromDecoder(D.string) /** - * @since 2.2.0 + * @since 2.2.3 */ -export const number: Codec = make(D.decoder.number, E.encoder.number) +export const number: Codec = fromDecoder(D.number) /** - * @since 2.2.0 + * @since 2.2.3 */ -export const boolean: Codec = make(D.decoder.boolean, E.encoder.boolean) +export const boolean: Codec = fromDecoder(D.boolean) /** - * @since 2.2.0 + * @since 2.2.3 */ -export const UnknownArray: Codec> = make(D.decoder.UnknownArray, E.id) +export const UnknownArray: Codec, Array> = fromDecoder(D.UnknownArray) /** - * @since 2.2.0 + * @since 2.2.3 */ -export const UnknownRecord: Codec> = make(D.decoder.UnknownRecord, E.id) +export const UnknownRecord: Codec, Record> = fromDecoder(D.UnknownRecord) // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @since 2.2.3 */ -export function withExpected( - codec: Codec, +export function withExpected( + codec: Codec, expected: (actual: unknown, e: D.DecodeError) => D.DecodeError -): Codec { +): Codec { return make(D.withExpected(codec, expected), codec) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function refinement(from: Codec, refinement: (a: A) => a is B, expected: string): Codec { +export function refinement( + from: Codec, + refinement: (a: A) => a is B, + expected: string +): Codec { return make(D.refinement(from, refinement, expected), from) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function nullable(or: Codec): Codec { - return make(D.decoder.nullable(or), E.encoder.nullable(or)) +export function nullable(or: Codec): Codec { + return make(D.nullable(or), E.nullable(or)) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function type(properties: { [K in keyof A]: Codec }): Codec { - return make(D.decoder.type(properties), E.encoder.type(properties)) +export function type

>>( + properties: P +): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { + const decoder: D.Decoder<{ [K in keyof P]: TypeOf }> = D.type(properties) as any + return make(decoder, E.type(properties)) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function partial(properties: { [K in keyof A]: Codec }): Codec> { - return make(D.decoder.partial(properties), E.encoder.partial(properties)) +export function partial

>>( + properties: P +): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> { + return make(D.partial(properties), E.partial(properties)) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function record(codomain: Codec): Codec> { - return make(D.decoder.record(codomain), E.encoder.record(codomain)) +export function record(codomain: Codec): Codec, Record> { + return make(D.record(codomain), E.record(codomain)) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function array(items: Codec): Codec> { - return make(D.decoder.array(items), E.encoder.array(items)) +export function array(items: Codec): Codec, Array> { + return make(D.array(items), E.array(items)) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function tuple>(...components: { [K in keyof A]: Codec }): Codec { - return make(D.decoder.tuple(...(components as any)), E.encoder.tuple(...(components as any))) +export function tuple>>( + ...components: C +): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> { + const decoder: D.Decoder<{ [K in keyof C]: TypeOf }> = D.tuple(...components) as any + const encoder = E.tuple(...components) + return make(decoder, encoder) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function intersection(left: Codec, right: Codec): Codec { - return make(D.decoder.intersection(left, right), E.encoder.intersection(left, right)) +export function intersection(left: Codec, right: Codec): Codec { + return make(D.intersection(left, right), E.intersection(left, right)) } /** - * @since 2.2.0 + * @since 2.2.3 */ export function sum( tag: T -): (members: { [K in keyof A]: Codec> }) => Codec { - const sumD = D.decoder.sum(tag) - const sumE = E.encoder.sum(tag) +): >>(members: M) => Codec, TypeOf> { + const sumD = D.sum(tag) + const sumE = E.sum(tag) return (members) => make(sumD(members), sumE(members)) } /** - * @since 2.2.0 + * @since 2.2.3 */ -export function lazy(id: string, f: () => Codec): Codec { - return make(D.decoder.lazy(id, f), E.encoder.lazy(id, f)) +export function lazy(id: string, f: () => Codec): Codec { + return make(D.lazy(id, f), E.lazy(f)) } // ------------------------------------------------------------------------------------- @@ -168,41 +197,25 @@ export function lazy(id: string, f: () => Codec): Codec { // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @since 2.2.3 */ export const URI = 'io-ts/Codec' /** - * @since 2.2.0 + * @since 2.2.3 */ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: Codec + interface URItoKind2 { + readonly [URI]: Codec } } /** - * @since 2.2.0 + * @since 2.2.3 */ -export const codec: Invariant1 & Schemable1 & WithUnknownContainers1 & WithRefinement1 = { +export const codec: Invariant2 = { URI, - imap: (fa, f, g) => make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)), - literal, - string, - number, - boolean, - nullable, - type, - partial, - record, - array, - tuple: tuple as Schemable1['tuple'], - intersection, - sum, - lazy, - UnknownArray, - UnknownRecord, - refinement: refinement as WithRefinement1['refinement'] + imap: (fa, f, g) => make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)) } diff --git a/src/Encoder.ts b/src/Encoder.ts index 554f5cc72..1d0591a59 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -1,36 +1,44 @@ /** - * @since 2.2.0 + * @since 2.2.3 */ -import { Contravariant1 } from 'fp-ts/lib/Contravariant' +import { Contravariant2 } from 'fp-ts/lib/Contravariant' +import { Category2 } from 'fp-ts/lib/Category' +import { intersect } from './Decoder' +import { memoize } from './Schemable' import { identity } from 'fp-ts/lib/function' -import * as PE from './PEncoder' -import { Schemable1 } from './Schemable' // ------------------------------------------------------------------------------------- // model // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @since 2.2.3 */ -export interface Encoder { - readonly encode: (a: A) => unknown +export interface Encoder { + readonly encode: (a: A) => O } /** - * @since 2.2.2 + * @since 2.2.3 */ -export type TypeOf = E extends Encoder ? A : never +export type TypeOf = E extends Encoder ? A : never + +/** + * @since 2.2.3 + */ +export type OutputOf = E extends Encoder ? O : never // ------------------------------------------------------------------------------------- -// primitives +// constructors // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @since 2.2.3 */ -export const id: Encoder = { - encode: identity +export function id(): Encoder { + return { + encode: identity + } } // ------------------------------------------------------------------------------------- @@ -38,96 +46,162 @@ export const id: Encoder = { // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @since 2.2.3 */ -export const nullable: (or: Encoder) => Encoder = PE.nullable +export function nullable(or: Encoder): Encoder { + return { + encode: (a) => (a === null ? null : or.encode(a)) + } +} /** - * @since 2.2.0 + * @since 2.2.3 */ -export const type: (properties: { [K in keyof A]: Encoder }) => Encoder = PE.type as any +export function type

>>( + properties: P +): Encoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { + return { + encode: (a) => { + const o: Record = {} as any + for (const k in properties) { + o[k] = properties[k].encode(a[k]) + } + return o + } + } +} /** - * @since 2.2.0 - */ -export const partial: (properties: { [K in keyof A]: Encoder }) => Encoder> = PE.partial as any + * @since 2.2.3 + */ +export function partial

>>( + properties: P +): Encoder }>, Partial<{ [K in keyof P]: TypeOf }>> { + return { + encode: (a) => { + const o: Record = {} as any + for (const k in properties) { + const v = a[k] + // don't add missing properties + if (k in a) { + // don't strip undefined properties + o[k] = v === undefined ? undefined : properties[k].encode(v) + } + } + return o + } + } +} /** - * @since 2.2.0 + * @since 2.2.3 */ -export const record: (codomain: Encoder) => Encoder> = PE.record +export function record(codomain: Encoder): Encoder, Record> { + return { + encode: (r) => { + const o: Record = {} + for (const k in r) { + o[k] = codomain.encode(r[k]) + } + return o + } + } +} /** - * @since 2.2.0 + * @since 2.2.3 */ -export const array: (items: Encoder) => Encoder> = PE.array +export function array(items: Encoder): Encoder, Array> { + return { + encode: (as) => as.map(items.encode) + } +} /** - * @since 2.2.0 + * @since 2.2.3 */ -export const tuple: >( - ...components: { [K in keyof A]: Encoder } -) => Encoder = PE.tuple as any +export function tuple>>( + ...components: C +): Encoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> { + return { + encode: (as) => components.map((c, i) => c.encode(as[i])) as any + } +} /** - * @since 2.2.0 + * @since 2.2.3 */ -export const intersection: (left: Encoder, right: Encoder) => Encoder = PE.intersection +export function intersection(left: Encoder, right: Encoder): Encoder { + return { + encode: (ab) => intersect(left.encode(ab), right.encode(ab)) + } +} /** - * @since 2.2.0 + * @since 2.2.3 */ -export const sum: ( +export function sum( tag: T -) => (members: { [K in keyof A]: Encoder> }) => Encoder = PE.sum as any +): >>(members: M) => Encoder, TypeOf> { + return (members: Record>) => { + return { + encode: (a: Record) => members[a[tag]].encode(a) + } + } +} /** - * @since 2.2.0 + * @since 2.2.3 */ -export const lazy: (f: () => Encoder) => Encoder = PE.lazy +export function lazy(f: () => Encoder): Encoder { + const get = memoize>(f) + return { + encode: (a) => get().encode(a) + } +} // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @since 2.2.3 */ export const URI = 'io-ts/Encoder' /** - * @since 2.2.0 + * @since 2.2.3 */ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: Encoder + interface URItoKind2 { + readonly [URI]: Encoder } } /** - * @since 2.2.0 + * @since 2.2.3 */ -export const encoder: Contravariant1 & Schemable1 = { +export const encoder: Contravariant2 & Category2 = { URI, - contramap: PE.pencoder.contramap, - literal: () => id, - string: id, - number: id, - boolean: id, - nullable, - type, - partial, - record, - array, - tuple, - intersection, - sum, - lazy: (_, f) => lazy(f) + contramap: (fa, f) => ({ + encode: (b) => fa.encode(f(b)) + }), + compose: (ab, ea) => ({ + encode: (b) => ea.encode(ab.encode(b)) + }), + id } /** - * @since 2.2.0 + * @since 2.2.3 + */ +export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = (f) => (fa) => + encoder.contramap(fa, f) + +/** + * @since 2.2.3 */ -export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = PE.contramap +export const compose: (ea: Encoder) => (ab: Encoder) => Encoder = (ea) => (ab) => + encoder.compose(ab, ea) diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts new file mode 100644 index 000000000..e37125291 --- /dev/null +++ b/src/JsonCodec.ts @@ -0,0 +1,172 @@ +/** + * @since 2.2.3 + */ +import { Invariant1 } from 'fp-ts/lib/Invariant' +import * as D from './Decoder' +import * as JE from './JsonEncoder' +import * as C from './Codec' +import { Literal, Schemable1, WithRefinement1 } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * Laws: + * + * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` + * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` + * + * @since 2.2.3 + */ +export interface JsonCodec extends C.Codec {} + +/** + * @since 2.2.2 + */ +export type TypeOf = JE.TypeOf + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec = C.make + +/** + * @since 2.2.3 + */ +export const literal: >(...values: A) => JsonCodec = C.literal + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const string: JsonCodec = C.string + +/** + * @since 2.2.3 + */ +export const number: JsonCodec = C.number + +/** + * @since 2.2.3 + */ +export const boolean: JsonCodec = C.boolean + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const withExpected: ( + codec: JsonCodec, + expected: (actual: unknown, e: D.DecodeError) => D.DecodeError +) => JsonCodec = C.withExpected + +/** + * @since 2.2.3 + */ +export const refinement: ( + from: JsonCodec, + refinement: (a: A) => a is B, + expected: string +) => JsonCodec = C.refinement + +/** + * @since 2.2.3 + */ +export const nullable: (or: JsonCodec) => JsonCodec = C.nullable + +/** + * @since 2.2.3 + */ +export const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec = C.type as any + +/** + * @since 2.2.3 + */ +export const partial: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec> = C.partial as any + +/** + * @since 2.2.3 + */ +export const record: (codomain: JsonCodec) => JsonCodec> = C.record + +/** + * @since 2.2.3 + */ +export const array: (items: JsonCodec) => JsonCodec> = C.array + +/** + * @since 2.2.3 + */ +export const tuple: >( + ...components: { [K in keyof A]: JsonCodec } +) => JsonCodec = C.tuple as any + +/** + * @since 2.2.3 + */ +export const intersection: (left: JsonCodec, right: JsonCodec) => JsonCodec = C.intersection + +/** + * @since 2.2.3 + */ +export const sum: ( + tag: T +) => (members: { [K in keyof A]: JsonCodec> }) => JsonCodec = C.sum as any + +/** + * @since 2.2.3 + */ +export const lazy: (id: string, f: () => JsonCodec) => JsonCodec = C.lazy + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const URI = 'io-ts/JsonCodec' + +/** + * @since 2.2.3 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: JsonCodec + } +} + +/** + * @since 2.2.3 + */ +export const jsonCodec: Invariant1 & Schemable1 & WithRefinement1 = { + URI, + imap: C.codec.imap, + literal, + string, + number, + boolean, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable1['tuple'], + intersection, + sum, + lazy, + refinement: refinement as WithRefinement1['refinement'] +} diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 65f579894..6fd7ce1e8 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -3,7 +3,7 @@ */ import { Contravariant1 } from 'fp-ts/lib/Contravariant' import { identity } from 'fp-ts/lib/function' -import * as PE from './PEncoder' +import * as E from './Encoder' import { Schemable1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -35,7 +35,7 @@ export interface JsonEncoder { /** * @since 2.2.3 */ -export type TypeOf = E extends JsonEncoder ? A : never +export type TypeOf = E.TypeOf // ------------------------------------------------------------------------------------- // primitives @@ -55,53 +55,53 @@ export const id: JsonEncoder = { /** * @since 2.2.3 */ -export const nullable: (or: JsonEncoder) => JsonEncoder = PE.nullable +export const nullable: (or: JsonEncoder) => JsonEncoder = E.nullable /** * @since 2.2.3 */ -export const type: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder = PE.type as any +export const type: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder = E.type as any /** * @since 2.2.3 */ export const partial: ( properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder> = PE.partial as any +) => JsonEncoder> = E.partial as any /** * @since 2.2.3 */ -export const record: (codomain: JsonEncoder) => JsonEncoder> = PE.record +export const record: (codomain: JsonEncoder) => JsonEncoder> = E.record /** * @since 2.2.3 */ -export const array: (items: JsonEncoder) => JsonEncoder> = PE.array +export const array: (items: JsonEncoder) => JsonEncoder> = E.array /** * @since 2.2.3 */ export const tuple: >( ...components: { [K in keyof A]: JsonEncoder } -) => JsonEncoder = PE.tuple as any +) => JsonEncoder = E.tuple as any /** * @since 2.2.3 */ -export const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder = PE.intersection +export const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder = E.intersection /** * @since 2.2.3 */ export const sum: ( tag: T -) => (members: { [K in keyof A]: JsonEncoder> }) => JsonEncoder = PE.sum as any +) => (members: { [K in keyof A]: JsonEncoder> }) => JsonEncoder = E.sum as any /** * @since 2.2.3 */ -export const lazy: (f: () => JsonEncoder) => JsonEncoder = PE.lazy +export const lazy: (f: () => JsonEncoder) => JsonEncoder = E.lazy // ------------------------------------------------------------------------------------- // instances @@ -128,7 +128,7 @@ declare module 'fp-ts/lib/HKT' { */ export const jsonEncoder: Contravariant1 & Schemable1 = { URI, - contramap: PE.pencoder.contramap, + contramap: E.encoder.contramap, literal: () => id, string: id, number: id, @@ -147,4 +147,4 @@ export const jsonEncoder: Contravariant1 & Schemable1 = { /** * @since 2.2.3 */ -export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder = PE.contramap +export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder = E.contramap diff --git a/src/PEncoder.ts b/src/PEncoder.ts deleted file mode 100644 index 98435917c..000000000 --- a/src/PEncoder.ts +++ /dev/null @@ -1,196 +0,0 @@ -/** - * @since 2.2.3 - */ -import { Contravariant2 } from 'fp-ts/lib/Contravariant' -import { intersect } from './Decoder' -import { memoize } from './Schemable' -import { identity } from 'fp-ts/lib/function' - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.3 - */ -export interface PEncoder { - readonly encode: (a: A) => O -} - -/** - * @since 2.2.3 - */ -export type TypeOf = E extends PEncoder ? A : never - -/** - * @since 2.2.3 - */ -export type OutputOf = E extends PEncoder ? O : never - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.3 - */ -export function id(): PEncoder { - return { - encode: identity - } -} - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.3 - */ -export function nullable(or: PEncoder): PEncoder { - return { - encode: (a) => (a === null ? null : or.encode(a)) - } -} - -/** - * @since 2.2.3 - */ -export function type

>>( - properties: P -): PEncoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { - return { - encode: (a) => { - const o: Record = {} as any - for (const k in properties) { - o[k] = properties[k].encode(a[k]) - } - return o - } - } -} - -/** - * @since 2.2.3 - */ -export function partial

>>( - properties: P -): PEncoder }>, Partial<{ [K in keyof P]: TypeOf }>> { - return { - encode: (a) => { - const o: Record = {} as any - for (const k in properties) { - const v = a[k] - // don't add missing properties - if (k in a) { - // don't strip undefined properties - o[k] = v === undefined ? undefined : properties[k].encode(v) - } - } - return o - } - } -} - -/** - * @since 2.2.3 - */ -export function record(codomain: PEncoder): PEncoder, Record> { - return { - encode: (r) => { - const o: Record = {} - for (const k in r) { - o[k] = codomain.encode(r[k]) - } - return o - } - } -} - -/** - * @since 2.2.3 - */ -export function array(items: PEncoder): PEncoder, Array> { - return { - encode: (as) => as.map(items.encode) - } -} - -/** - * @since 2.2.3 - */ -export function tuple>>( - ...components: C -): PEncoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> { - return { - encode: (as) => components.map((c, i) => c.encode(as[i])) as any - } -} - -/** - * @since 2.2.3 - */ -export function intersection(left: PEncoder, right: PEncoder): PEncoder { - return { - encode: (ab) => intersect(left.encode(ab), right.encode(ab)) - } -} - -/** - * @since 2.2.3 - */ -export function sum( - tag: T -): >>(members: M) => PEncoder, TypeOf> { - return (members: Record>) => { - return { - encode: (a: Record) => members[a[tag]].encode(a) - } - } -} - -/** - * @since 2.2.3 - */ -export function lazy(f: () => PEncoder): PEncoder { - const get = memoize>(f) - return { - encode: (a) => get().encode(a) - } -} - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.3 - */ -export const URI = 'io-ts/PEncoder' - -/** - * @since 2.2.3 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind2 { - readonly [URI]: PEncoder - } -} - -/** - * @since 2.2.3 - */ -export const pencoder: Contravariant2 = { - URI, - contramap: (fa, f) => ({ - encode: (b) => fa.encode(f(b)) - }) -} - -/** - * @since 2.2.3 - */ -export const contramap: (f: (b: B) => A) => (fa: PEncoder) => PEncoder = (f) => (fa) => - pencoder.contramap(fa, f) diff --git a/test/Codec.ts b/test/Codec.ts index 20f1ec443..2b9cbe406 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -3,9 +3,8 @@ import { left, right } from 'fp-ts/lib/Either' import * as C from '../src/Codec' import * as D from '../src/Decoder' import * as G from '../src/Guard' -import * as E from '../src/Encoder' -const NumberFromString: C.Codec = C.make( +const NumberFromString: C.Codec = C.make( D.parse(D.string, (s) => { const n = parseFloat(s) return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`) : right(n) @@ -17,18 +16,18 @@ interface PositiveBrand { readonly Positive: unique symbol } type Positive = number & PositiveBrand -const Positive: C.Codec = C.refinement(C.number, (n): n is Positive => n > 0, 'Positive') +const Positive: C.Codec = C.refinement(C.number, (n): n is Positive => n > 0, 'Positive') interface IntBrand { readonly Int: unique symbol } type Int = number & IntBrand -const Int: C.Codec = C.refinement(C.number, (n): n is Int => Number.isInteger(n), 'Int') +const Int: C.Codec = C.refinement(C.number, (n): n is Int => Number.isInteger(n), 'Int') const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } -const undef: C.Codec = C.make(D.fromGuard(undefinedGuard, 'undefined'), E.id) +const undef: C.Codec = C.fromDecoder(D.fromGuard(undefinedGuard, 'undefined')) describe('Codec', () => { describe('codec', () => { @@ -572,8 +571,12 @@ describe('Codec', () => { a: number b?: A } + interface AOut { + a: string + b?: AOut + } - const codec: C.Codec = C.lazy('A', () => + const codec: C.Codec = C.lazy('A', () => C.intersection(C.type({ a: NumberFromString }), C.partial({ b: codec })) ) diff --git a/test/Encoder.ts b/test/Encoder.ts index 4d1f066d6..77643ed5f 100644 --- a/test/Encoder.ts +++ b/test/Encoder.ts @@ -1,11 +1,110 @@ import * as assert from 'assert' import * as E from '../src/Encoder' +import { pipe } from 'fp-ts/lib/pipeable' + +const NumberToString: E.Encoder = { + encode: String +} + +const BooleanToNumber: E.Encoder = { + encode: (b) => (b ? 1 : 0) +} describe('Encoder', () => { - describe('encoder', () => { - it('contramap', () => { - const encoder = E.encoder.contramap(E.encoder.number, (s: string) => s.length) - assert.deepStrictEqual(encoder.encode('aaa'), 3) + it('contramap', () => { + const encoder = E.contramap((s: string) => s.length)(NumberToString) + assert.deepStrictEqual(encoder.encode('aaa'), '3') + }) + + it('compose', () => { + const encoder = pipe(BooleanToNumber, E.compose(NumberToString)) + assert.deepStrictEqual(encoder.encode(true), '1') + }) + + it('nullable', () => { + const encoder = E.nullable(NumberToString) + assert.deepStrictEqual(encoder.encode(1), '1') + assert.deepStrictEqual(encoder.encode(null), null) + }) + + it('type', () => { + const encoder = E.type({ a: NumberToString, b: BooleanToNumber }) + assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) + }) + + it('partial', () => { + const encoder = E.partial({ a: NumberToString, b: BooleanToNumber }) + assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) + assert.deepStrictEqual(encoder.encode({ a: 1 }), { a: '1' }) + assert.deepStrictEqual(encoder.encode({ a: 1, b: undefined }), { a: '1', b: undefined }) + assert.deepStrictEqual(encoder.encode({ b: true }), { b: 1 }) + assert.deepStrictEqual(encoder.encode({}), {}) + }) + + it('record', () => { + const encoder = E.record(NumberToString) + assert.deepStrictEqual(encoder.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) + }) + + it('array', () => { + const encoder = E.array(NumberToString) + assert.deepStrictEqual(encoder.encode([1, 2]), ['1', '2']) + }) + + it('tuple', () => { + const encoder = E.tuple(NumberToString, BooleanToNumber) + assert.deepStrictEqual(encoder.encode([3, true]), ['3', 1]) + }) + + it('intersection', () => { + const encoder = E.intersection(E.type({ a: NumberToString }), E.type({ b: BooleanToNumber })) + assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) + }) + + it('sum', () => { + const S1 = E.type({ _tag: E.id<'A'>(), a: NumberToString }) + const S2 = E.type({ _tag: E.id<'B'>(), b: BooleanToNumber }) + const sum = E.sum('_tag') + const encoder = sum({ A: S1, B: S2 }) + assert.deepStrictEqual(encoder.encode({ _tag: 'A', a: 1 }), { _tag: 'A', a: '1' }) + assert.deepStrictEqual(encoder.encode({ _tag: 'B', b: true }), { _tag: 'B', b: 1 }) + }) + + it('lazy', () => { + interface A { + a: number + bs: Array + } + interface AOut { + a: string + bs: Array + } + interface B { + b: boolean + as: Array + } + interface BOut { + b: number + as: Array + } + const A: E.Encoder = E.lazy(() => + E.type({ + a: NumberToString, + bs: E.array(B) + }) + ) + + const B: E.Encoder = E.lazy(() => + E.type({ + b: BooleanToNumber, + as: E.array(A) + }) + ) + assert.deepStrictEqual(A.encode({ a: 1, bs: [] }), { a: '1', bs: [] }) + assert.deepStrictEqual(A.encode({ a: 1, bs: [{ b: true, as: [] }] }), { a: '1', bs: [{ b: 1, as: [] }] }) + assert.deepStrictEqual(A.encode({ a: 1, bs: [{ b: true, as: [{ a: 2, bs: [] }] }] }), { + a: '1', + bs: [{ b: 1, as: [{ a: '2', bs: [] }] }] }) }) }) diff --git a/test/PEncoder.ts b/test/PEncoder.ts deleted file mode 100644 index a579e1218..000000000 --- a/test/PEncoder.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as assert from 'assert' -import * as PE from '../src/PEncoder' - -const NumberToString: PE.PEncoder = { - encode: String -} - -const BooleanToNumber: PE.PEncoder = { - encode: (b) => (b ? 1 : 0) -} - -describe('PEncoder', () => { - describe('pencoder', () => { - it('contramap', () => { - const encoder = PE.pencoder.contramap(NumberToString, (s: string) => s.length) - assert.deepStrictEqual(encoder.encode('aaa'), '3') - }) - }) - - it('contramap', () => { - const encoder = PE.contramap((s: string) => s.length)(NumberToString) - assert.deepStrictEqual(encoder.encode('aaa'), '3') - }) - - it('nullable', () => { - const encoder = PE.nullable(NumberToString) - assert.deepStrictEqual(encoder.encode(1), '1') - assert.deepStrictEqual(encoder.encode(null), null) - }) - - it('type', () => { - const encoder = PE.type({ a: NumberToString, b: BooleanToNumber }) - assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) - }) - - it('partial', () => { - const encoder = PE.partial({ a: NumberToString, b: BooleanToNumber }) - assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) - assert.deepStrictEqual(encoder.encode({ a: 1 }), { a: '1' }) - assert.deepStrictEqual(encoder.encode({ a: 1, b: undefined }), { a: '1', b: undefined }) - assert.deepStrictEqual(encoder.encode({ b: true }), { b: 1 }) - assert.deepStrictEqual(encoder.encode({}), {}) - }) - - it('record', () => { - const encoder = PE.record(NumberToString) - assert.deepStrictEqual(encoder.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) - }) - - it('array', () => { - const encoder = PE.array(NumberToString) - assert.deepStrictEqual(encoder.encode([1, 2]), ['1', '2']) - }) - - it('tuple', () => { - const encoder = PE.tuple(NumberToString, BooleanToNumber) - assert.deepStrictEqual(encoder.encode([3, true]), ['3', 1]) - }) - - it('intersection', () => { - const encoder = PE.intersection(PE.type({ a: NumberToString }), PE.type({ b: BooleanToNumber })) - assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) - }) - - it('sum', () => { - const S1 = PE.type({ _tag: PE.id<'A'>(), a: NumberToString }) - const S2 = PE.type({ _tag: PE.id<'B'>(), b: BooleanToNumber }) - const sum = PE.sum('_tag') - const encoder = sum({ A: S1, B: S2 }) - assert.deepStrictEqual(encoder.encode({ _tag: 'A', a: 1 }), { _tag: 'A', a: '1' }) - assert.deepStrictEqual(encoder.encode({ _tag: 'B', b: true }), { _tag: 'B', b: 1 }) - }) - - it('lazy', () => { - interface A { - a: number - bs: Array - } - interface AOut { - a: string - bs: Array - } - interface B { - b: boolean - as: Array - } - interface BOut { - b: number - as: Array - } - const A: PE.PEncoder = PE.lazy(() => - PE.type({ - a: NumberToString, - bs: PE.array(B) - }) - ) - - const B: PE.PEncoder = PE.lazy(() => - PE.type({ - b: BooleanToNumber, - as: PE.array(A) - }) - ) - assert.deepStrictEqual(A.encode({ a: 1, bs: [] }), { a: '1', bs: [] }) - assert.deepStrictEqual(A.encode({ a: 1, bs: [{ b: true, as: [] }] }), { a: '1', bs: [{ b: 1, as: [] }] }) - assert.deepStrictEqual(A.encode({ a: 1, bs: [{ b: true, as: [{ a: 2, bs: [] }] }] }), { - a: '1', - bs: [{ b: 1, as: [{ a: '2', bs: [] }] }] - }) - }) -}) diff --git a/test/Schema.ts b/test/Schema.ts index 09780a845..6abf8aab0 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import * as fc from 'fast-check' import { isRight } from 'fp-ts/lib/Either' -import * as C from '../src/Codec' +import * as JC from '../src/JsonCodec' import * as Eq from '../src/Eq' import * as G from '../src/Guard' import { Schema, interpreter, make } from '../src/Schema' @@ -19,7 +19,7 @@ function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { function check(schema: Schema): void { const arb = interpreter(A.arbitrary)(schema) - const codec = interpreter(C.codec)(schema) + const codec = interpreter(JC.jsonCodec)(schema) const guard = interpreter(G.guard)(schema) const eq = interpreter(Eq.eq)(schema) const encoder = interpreter(JE.jsonEncoder)(schema) From 77ea0968cdb01065d28e7ae69cda6fa9660129c8 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 20 May 2020 06:51:32 +0200 Subject: [PATCH 033/222] ts 3.9.3 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3b72cd23e..7e2497710 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.2", + "version": "2.2.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -7269,9 +7269,9 @@ } }, "typescript": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", - "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", "dev": true }, "unc-path-regex": { diff --git a/package.json b/package.json index 3427708c2..040aec16b 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "ts-node": "8.8.2", "tslint": "6.1.1", "tslint-config-standard": "9.0.0", - "typescript": "^3.9.2" + "typescript": "^3.9.3" }, "tags": [ "typescript", From c59dc2f21ea2e2da062c1b4d9f518d4501bd8ff6 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 20 May 2020 09:20:26 +0200 Subject: [PATCH 034/222] remove useless constraint --- docs/modules/Decoder.ts.md | 2 +- docs/modules/Eq.ts.md | 4 +--- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/Schemable.ts.md | 8 ++------ docs/modules/Type.ts.md | 4 +--- dtslint/ts3.5/Econder.ts | 2 ++ src/Decoder.ts | 4 +--- src/Encoder.ts | 4 ++-- src/Eq.ts | 4 +--- src/Guard.ts | 10 ++++------ src/JsonCodec.ts | 2 +- src/JsonEncoder.ts | 2 +- src/Schemable.ts | 8 ++------ src/Type.ts | 4 +--- test/Arbitrary.ts | 2 +- 17 files changed, 24 insertions(+), 42 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 7e91a17fb..231f4048e 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -369,7 +369,7 @@ Added in v2.2.0 ```ts export declare function sum( tag: T -): (members: { [K in keyof A]: Decoder> }) => Decoder +): (members: { [K in keyof A]: Decoder }) => Decoder ``` Added in v2.2.0 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index e98893272..a7b1df6e2 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -177,9 +177,7 @@ Added in v2.2.2 **Signature** ```ts -export declare function sum( - tag: T -): (members: { [K in keyof A]: Eq> }) => Eq +export declare function sum(tag: T): (members: { [K in keyof A]: Eq }) => Eq ``` Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 48a739912..0cccd13b3 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -240,7 +240,7 @@ Added in v2.2.0 ```ts export declare function sum( tag: T -): (members: { [K in keyof A]: Guard> }) => Guard +): (members: { [K in keyof A]: Guard }) => Guard ``` Added in v2.2.0 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index d4d3ed9e6..61f0bf87d 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -224,7 +224,7 @@ Added in v2.2.3 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: JsonCodec> }) => JsonCodec +) => (members: { [K in keyof A]: JsonCodec }) => JsonCodec ``` Added in v2.2.3 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index e19a5828a..6eceaf558 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -203,7 +203,7 @@ Added in v2.2.3 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: JsonEncoder> }) => JsonEncoder +) => (members: { [K in keyof A]: JsonEncoder }) => JsonEncoder ``` Added in v2.2.3 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 902ba044b..160adb010 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -43,9 +43,7 @@ export interface Schemable { readonly array: (items: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT readonly intersection: (left: HKT, right: HKT) => HKT - readonly sum: ( - tag: T - ) => (members: { [K in keyof A]: HKT> }) => HKT + readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT } ``` @@ -70,9 +68,7 @@ export interface Schemable1 { readonly array: (items: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind readonly intersection: (left: Kind, right: Kind) => Kind - readonly sum: ( - tag: T - ) => (members: { [K in keyof A]: Kind> }) => Kind + readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind } ``` diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index d1c31ac36..876b02f73 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -218,9 +218,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function sum( - _tag: T -): (members: { [K in keyof A]: Type> }) => Type +export declare function sum(_tag: T): (members: { [K in keyof A]: Type }) => Type ``` Added in v2.2.3 diff --git a/dtslint/ts3.5/Econder.ts b/dtslint/ts3.5/Econder.ts index e306e687d..89fc691e8 100644 --- a/dtslint/ts3.5/Econder.ts +++ b/dtslint/ts3.5/Econder.ts @@ -68,6 +68,8 @@ const sum = E.sum('_tag') // $ExpectType Encoder<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }, { _tag: "A"; a: number; } | { _tag: "B"; b: boolean; }> sum({ A: S1, B: S2 }) +const S3 = E.type({ _tag: E.id<'C'>(), c: E.id() }) + // // lazy // diff --git a/src/Decoder.ts b/src/Decoder.ts index 289d0d55f..b3c613aaa 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -386,9 +386,7 @@ export function lazy(id: string, f: () => Decoder): Decoder { /** * @since 2.2.0 */ -export function sum( - tag: T -): (members: { [K in keyof A]: Decoder> }) => Decoder { +export function sum(tag: T): (members: { [K in keyof A]: Decoder }) => Decoder { return (members) => { const keys = Object.keys(members) if (keys.length === 0) { diff --git a/src/Encoder.ts b/src/Encoder.ts index 1d0591a59..14c9dfcbe 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -143,9 +143,9 @@ export function intersection(left: Encoder, right: Encoder( tag: T ): >>(members: M) => Encoder, TypeOf> { - return (members: Record>) => { + return (members) => { return { - encode: (a: Record) => members[a[tag]].encode(a) + encode: (a) => members[a[tag]].encode(a) } } } diff --git a/src/Eq.ts b/src/Eq.ts index 2966f4ba0..2e2c99e71 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -123,9 +123,7 @@ export function intersection(left: Eq, right: Eq): Eq { /** * @since 2.2.2 */ -export function sum( - tag: T -): (members: { [K in keyof A]: Eq> }) => Eq { +export function sum(tag: T): (members: { [K in keyof A]: Eq }) => Eq { return (members: Record>) => { return { equals: (x: Record, y: Record) => { diff --git a/src/Guard.ts b/src/Guard.ts index 20bf499c0..d88cf65f7 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -182,14 +182,12 @@ export function union>(...members: { [K in keyo /** * @since 2.2.0 */ -export function sum( - tag: T -): (members: { [K in keyof A]: Guard> }) => Guard { - return (members: { [K in keyof A]: Guard> }) => - refinement(UnknownRecord, (r): r is { [K in keyof A]: A[K] & Record }[keyof A] => { +export function sum(tag: T): (members: { [K in keyof A]: Guard }) => Guard { + return (members: Record>) => + refinement(UnknownRecord, (r): r is any => { const v = r[tag] if (string.is(v) && v in members) { - return (members as any)[v].is(r) + return members[v].is(r) } return false }) diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index e37125291..4766f5c98 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -122,7 +122,7 @@ export const intersection: (left: JsonCodec, right: JsonCodec) => Js */ export const sum: ( tag: T -) => (members: { [K in keyof A]: JsonCodec> }) => JsonCodec = C.sum as any +) => (members: { [K in keyof A]: JsonCodec }) => JsonCodec = C.sum as any /** * @since 2.2.3 diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 6fd7ce1e8..1c553b2b7 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -96,7 +96,7 @@ export const intersection: (left: JsonEncoder, right: JsonEncoder) = */ export const sum: ( tag: T -) => (members: { [K in keyof A]: JsonEncoder> }) => JsonEncoder = E.sum as any +) => (members: { [K in keyof A]: JsonEncoder }) => JsonEncoder = E.sum as any /** * @since 2.2.3 diff --git a/src/Schemable.ts b/src/Schemable.ts index e7431329a..2f374e751 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -24,9 +24,7 @@ export interface Schemable { readonly array: (items: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT readonly intersection: (left: HKT, right: HKT) => HKT - readonly sum: ( - tag: T - ) => (members: { [K in keyof A]: HKT> }) => HKT + readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT } @@ -46,9 +44,7 @@ export interface Schemable1 { readonly array: (items: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind readonly intersection: (left: Kind, right: Kind) => Kind - readonly sum: ( - tag: T - ) => (members: { [K in keyof A]: Kind> }) => Kind + readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind } diff --git a/src/Type.ts b/src/Type.ts index df95abc11..d3912c645 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -124,9 +124,7 @@ export function lazy(id: string, f: () => Type): Type { /** * @since 2.2.3 */ -export function sum( - _tag: T -): (members: { [K in keyof A]: Type> }) => Type { +export function sum(_tag: T): (members: { [K in keyof A]: Type }) => Type { return (members) => t.union(Object.values(members) as any) } diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index cd17e5517..c046215aa 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -87,7 +87,7 @@ export function intersection(left: Arbitrary, right: Arbitrary): Arb export function sum( _tag: T -): (members: { [K in keyof A]: Arbitrary> }) => Arbitrary { +): (members: { [K in keyof A]: Arbitrary }) => Arbitrary { return (members: Record>) => fc.oneof(...Object.keys(members).map((k) => members[k])) } From f9ff107e19269334e84441cc16c129585802202a Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 20 May 2020 09:28:47 +0200 Subject: [PATCH 035/222] update docs --- Codec.md | 41 +++++++++++------------------------------ Encoder.md | 21 ++++----------------- 2 files changed, 15 insertions(+), 47 deletions(-) diff --git a/Codec.md b/Codec.md index f3cf40de2..9efabb53e 100644 --- a/Codec.md +++ b/Codec.md @@ -2,8 +2,6 @@ - [Codec interface](#codec-interface) -- [Built-in primitive codecs](#built-in-primitive-codecs) -- [Combinators](#combinators) @@ -27,34 +25,17 @@ You can build a new codec using the `make` helper ```ts import * as C from 'io-ts/lib/Codec' import * as D from 'io-ts/lib/Decoder' +import * as E from 'io-ts/lib/Encoder' import { left, right } from 'fp-ts/lib/Either' -const NumberFromString: C.Codec = C.make( - D.parse(D.string, (s) => { - const n = parseFloat(s) - return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`) : right(n) - }), - { encode: String } -) -``` +const decoder: D.Decoder = D.parse(D.string, (s) => { + const n = parseFloat(s) + return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`) : right(n) +}) + +const encoder: E.Encoder = { + encode: String +} -# Built-in primitive codecs - -- `string: Decoder` -- `number: Decoder` -- `boolean: Decoder` -- `UnknownArray: Decoder>` -- `UnknownRecord: Decoder>` - -# Combinators - -- `literal` -- `nullable` -- `type` -- `partial` -- `record` -- `array` -- `tuple` -- `intersection` -- `sum` -- `lazy` +export const NumberFromString: C.Codec = C.make(decoder, encoder) +``` diff --git a/Encoder.md b/Encoder.md index bc63223ec..cbeb0f4c0 100644 --- a/Encoder.md +++ b/Encoder.md @@ -2,15 +2,14 @@ - [Encoder interface](#encoder-interface) -- [Combinators](#combinators) # Encoder interface ```ts -export interface Encoder { - readonly encode: (a: A) => unknown +export interface Encoder { + readonly encode: (a: A) => O } ``` @@ -21,21 +20,9 @@ An encoder representing a nullable value ```ts import * as E from 'io-ts/lib/Encoder' -export function nullable(or: E.Encoder): E.Encoder { +export function nullable(or: E.Encoder): E.Encoder { return { - encode: (a) => (a === null ? a : or.encode(a)) + encode: (a) => (a === null ? null : or.encode(a)) } } ``` - -# Combinators - -- `nullable` -- `type` -- `partial` -- `record` -- `array` -- `tuple` -- `intersection` -- `sum` -- `lazy` From 6edd7272c83239c3ef13b988ad80d706d86ada55 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 20 May 2020 15:40:52 +0200 Subject: [PATCH 036/222] add pipeables --- CHANGELOG.md | 2 +- docs/modules/Codec.ts.md | 11 ++++++ docs/modules/Decoder.ts.md | 22 ------------ docs/modules/JsonCodec.ts.md | 11 ++++++ src/Codec.ts | 15 +++++++- src/Decoder.ts | 70 ++++++++++++++++++------------------ src/Encoder.ts | 44 +++++++++++++---------- src/Eq.ts | 4 +++ src/JsonCodec.ts | 9 +++++ src/JsonEncoder.ts | 14 +++++--- test/Codec.ts | 13 +++++++ 11 files changed, 133 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 775cdaca8..61839b666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ - refactoring with the new `Schemable` interface (@gcanti) - add `interpreter` function (@gcanti) - **Internal** - - upgrade to `typescript@3.9.2` (@gcanti) + - upgrade to `typescript@3.9.3` (@gcanti) # 2.2.2 diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 552b19be9..cfef8d239 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -23,6 +23,7 @@ Added in v2.2.3 - [boolean](#boolean) - [codec](#codec) - [fromDecoder](#fromdecoder) +- [imap](#imap) - [intersection](#intersection) - [lazy](#lazy) - [literal](#literal) @@ -155,6 +156,16 @@ export declare function fromDecoder(decoder: D.Decoder): Codec Added in v2.2.3 +# imap + +**Signature** + +```ts +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec +``` + +Added in v2.2.3 + # intersection **Signature** diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 231f4048e..9ac806432 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -21,8 +21,6 @@ Added in v2.2.0 - [UnknownRecord](#unknownrecord) - [alt](#alt) - [ap](#ap) -- [apFirst](#apfirst) -- [apSecond](#apsecond) - [array](#array) - [boolean](#boolean) - [decoder](#decoder) @@ -143,26 +141,6 @@ export declare const ap: (fa: Decoder) => (fab: Decoder<(a: A) => B>) = Added in v2.2.0 -# apFirst - -**Signature** - -```ts -export declare const apFirst: (fb: Decoder) => (fa: Decoder) => Decoder -``` - -Added in v2.2.0 - -# apSecond - -**Signature** - -```ts -export declare const apSecond: (fb: Decoder) => (fa: Decoder) => Decoder -``` - -Added in v2.2.0 - # array **Signature** diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 61f0bf87d..a5e9e0c3b 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -18,6 +18,7 @@ Added in v2.2.3 - [URI](#uri) - [array](#array) - [boolean](#boolean) +- [imap](#imap) - [intersection](#intersection) - [jsonCodec](#jsoncodec) - [lazy](#lazy) @@ -101,6 +102,16 @@ export declare const boolean: JsonCodec Added in v2.2.3 +# imap + +**Signature** + +```ts +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) => JsonCodec +``` + +Added in v2.2.3 + # intersection **Signature** diff --git a/src/Codec.ts b/src/Codec.ts index e0de984ed..9cad37599 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -192,6 +192,19 @@ export function lazy(id: string, f: () => Codec): Codec { return make(D.lazy(id, f), E.lazy(f)) } +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec = (f, g) => (fa) => + imap_(fa, f, g) + +const imap_: (fa: Codec, f: (a: A) => B, g: (b: B) => A) => Codec = (fa, f, g) => + make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)) + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -217,5 +230,5 @@ declare module 'fp-ts/lib/HKT' { */ export const codec: Invariant2 = { URI, - imap: (fa, f, g) => make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)) + imap: imap_ } diff --git a/src/Decoder.ts b/src/Decoder.ts index b3c613aaa..f4c832e4a 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -5,7 +5,7 @@ import { Alternative1 } from 'fp-ts/lib/Alternative' import { Applicative1 } from 'fp-ts/lib/Applicative' import { Either, either, isLeft, isRight, left, mapLeft, right } from 'fp-ts/lib/Either' import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' -import { pipe, pipeable } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' import { Forest, Tree } from 'fp-ts/lib/Tree' import * as G from './Guard' import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' @@ -444,6 +444,37 @@ export function union>( } } +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) + +const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) => ({ + decode: (u) => either.alt(fx.decode(u), () => fy().decode(u)) +}) + +/** + * @since 2.2.0 + */ +export const ap: (fa: Decoder) => (fab: Decoder<(a: A) => B>) => Decoder = (fa) => (fab) => ap_(fab, fa) + +const ap_: (fab: Decoder<(a: A) => B>, fa: Decoder) => Decoder = (fab, fa) => ({ + decode: (u) => either.ap(fab.decode(u), fa.decode(u)) +}) + +/** + * @since 2.2.0 + */ +export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) + +const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ + decode: (u) => either.map(fa.decode(u), f) +}) + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -474,18 +505,12 @@ export const decoder: Applicative1 & WithUnion1 & WithRefinement1 = { URI, - map: (fa, f) => ({ - decode: (u) => either.map(fa.decode(u), f) - }), + map: map_, of: (a) => ({ decode: () => success(a) }), - ap: (fab, fa) => ({ - decode: (u) => either.ap(fab.decode(u), fa.decode(u)) - }), - alt: (fx, fy) => ({ - decode: (u) => either.alt(fx.decode(u), () => fy().decode(u)) - }), + ap: ap_, + alt: alt_, zero: () => never, literal, string, @@ -505,28 +530,3 @@ export const decoder: Applicative1 & union, refinement: refinement as WithRefinement1['refinement'] } - -const { alt, ap, apFirst, apSecond, map } = pipeable(decoder) - -export { - /** - * @since 2.2.0 - */ - alt, - /** - * @since 2.2.0 - */ - ap, - /** - * @since 2.2.0 - */ - apFirst, - /** - * @since 2.2.0 - */ - apSecond, - /** - * @since 2.2.0 - */ - map -} diff --git a/src/Encoder.ts b/src/Encoder.ts index 14c9dfcbe..ab89531df 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -160,6 +160,30 @@ export function lazy(f: () => Encoder): Encoder { } } +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = (f) => (fa) => + encoder.contramap(fa, f) + +const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder = (fa, f) => ({ + encode: (b) => fa.encode(f(b)) +}) + +/** + * @since 2.2.3 + */ +export const compose: (ea: Encoder) => (ab: Encoder) => Encoder = (ea) => (ab) => + encoder.compose(ab, ea) + +const compose_: (ab: Encoder, la: Encoder) => Encoder = (ab, ea) => ({ + encode: (b) => ea.encode(ab.encode(b)) +}) + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -185,23 +209,7 @@ declare module 'fp-ts/lib/HKT' { */ export const encoder: Contravariant2 & Category2 = { URI, - contramap: (fa, f) => ({ - encode: (b) => fa.encode(f(b)) - }), - compose: (ab, ea) => ({ - encode: (b) => ea.encode(ab.encode(b)) - }), + contramap: contramap_, + compose: compose_, id } - -/** - * @since 2.2.3 - */ -export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = (f) => (fa) => - encoder.contramap(fa, f) - -/** - * @since 2.2.3 - */ -export const compose: (ea: Encoder) => (ab: Encoder) => Encoder = (ea) => (ab) => - encoder.compose(ab, ea) diff --git a/src/Eq.ts b/src/Eq.ts index 2e2c99e71..f04c0f7b5 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -148,6 +148,10 @@ export function lazy(f: () => Eq): Eq { } } +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + /** * @since 2.2.2 */ diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 4766f5c98..4b08b549b 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -129,6 +129,15 @@ export const sum: ( */ export const lazy: (id: string, f: () => JsonCodec) => JsonCodec = C.lazy +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) => JsonCodec = C.imap + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 1c553b2b7..36eac0f6b 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -103,6 +103,15 @@ export const sum: ( */ export const lazy: (f: () => JsonEncoder) => JsonEncoder = E.lazy +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder = E.contramap + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -143,8 +152,3 @@ export const jsonEncoder: Contravariant1 & Schemable1 = { sum, lazy: (_, f) => lazy(f) } - -/** - * @since 2.2.3 - */ -export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder = E.contramap diff --git a/test/Codec.ts b/test/Codec.ts index 2b9cbe406..b7d250362 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -3,6 +3,7 @@ import { left, right } from 'fp-ts/lib/Either' import * as C from '../src/Codec' import * as D from '../src/Decoder' import * as G from '../src/Guard' +import { pipe } from 'fp-ts/lib/pipeable' const NumberFromString: C.Codec = C.make( D.parse(D.string, (s) => { @@ -42,6 +43,18 @@ describe('Codec', () => { }) }) + it('imap', () => { + const codec = pipe( + C.string, + C.imap( + (s) => ({ value: s }), + ({ value }) => value + ) + ) + assert.deepStrictEqual(codec.decode('a'), right({ value: 'a' })) + assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') + }) + describe('withExpected', () => { describe('decode', () => { it('should, return the provided expected', () => { From 496ad677e089ac70f08e2bed7904da044058c2aa Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 20 May 2020 15:44:39 +0200 Subject: [PATCH 037/222] add top level `of` --- docs/modules/Decoder.ts.md | 11 +++++++++++ src/Decoder.ts | 21 ++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 9ac806432..5d46b8495 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -34,6 +34,7 @@ Added in v2.2.0 - [never](#never) - [nullable](#nullable) - [number](#number) +- [of](#of) - [parse](#parse) - [partial](#partial) - [record](#record) @@ -276,6 +277,16 @@ export declare const number: Decoder Added in v2.2.0 +# of + +**Signature** + +```ts +export declare function of(a: A): Decoder +``` + +Added in v2.2.3 + # parse **Signature** diff --git a/src/Decoder.ts b/src/Decoder.ts index f4c832e4a..6b34361f4 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -31,10 +31,6 @@ export interface Decoder { */ export type TypeOf = D extends Decoder ? A : never -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - const empty: Array = [] /** @@ -68,6 +64,19 @@ export function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray { return as.length > 0 } +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export function of(a: A): Decoder { + return { + decode: () => success(a) + } +} + /** * @since 2.2.0 */ @@ -506,9 +515,7 @@ export const decoder: Applicative1 & WithRefinement1 = { URI, map: map_, - of: (a) => ({ - decode: () => success(a) - }), + of, ap: ap_, alt: alt_, zero: () => never, From 61cd39284cc82962378be601a82dd549c1c4f995 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 21 May 2020 10:58:55 +0200 Subject: [PATCH 038/222] split instances --- CHANGELOG.md | 1 + Schema.md | 20 ++++----- docs/modules/Codec.ts.md | 18 ++++---- docs/modules/Decoder.ts.md | 79 ++++++++++++++++++++++++++++------ docs/modules/Encoder.ts.md | 17 ++++++-- docs/modules/Eq.ts.md | 22 +++++----- docs/modules/Guard.ts.md | 28 ++++++------ docs/modules/JsonCodec.ts.md | 19 +++++--- docs/modules/JsonEncoder.ts.md | 25 ++++++++--- docs/modules/Type.ts.md | 28 ++++++------ dtslint/ts3.5/Econder.ts | 2 +- src/Codec.ts | 4 +- src/Decoder.ts | 62 ++++++++++++++++++++++---- src/Encoder.ts | 15 +++++-- src/Eq.ts | 6 +-- src/Guard.ts | 4 +- src/JsonCodec.ts | 11 ++++- src/JsonEncoder.ts | 11 ++++- src/Type.ts | 2 +- test/Arbitrary.ts | 2 +- test/Codec.ts | 2 +- test/Decoder.ts | 6 +-- test/Eq.ts | 10 ++--- test/Guard.ts | 2 +- test/JsonEncoder.ts | 2 +- test/Schema.ts | 10 ++--- test/Type.ts | 8 ++-- 27 files changed, 283 insertions(+), 133 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61839b666..b89f4a448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ # 2.2.3 - **Experimental** + - split instances (@gcanti) - add `Type` experimental module, #464 (@gcanti) - restore the `O` type parameter to `Encoder`, #469 (@gcanti) - add the `O` type parameter to `Codec` (@gcanti) diff --git a/Schema.md b/Schema.md index c97ada1a5..879e80fb2 100644 --- a/Schema.md +++ b/Schema.md @@ -21,8 +21,8 @@ export interface Schema { ```ts import * as S from 'io-ts/lib/Schema' import * as D from 'io-ts/lib/Decoder' -import * as E from 'io-ts/lib/Encoder' -import * as C from 'io-ts/lib/Codec' +import * as JE from 'io-ts/lib/JsonEncoder' +import * as JC from 'io-ts/lib/JsonCodec' import * as G from 'io-ts/lib/Guard' import * as Eq from 'io-ts/lib/Eq' @@ -33,11 +33,11 @@ export const Person = S.make((S) => }) ) -export const decoderPerson = S.interpreter(D.decoder)(Person) -export const encoderPerson = S.interpreter(E.encoder)(Person) -export const codecPerson = S.interpreter(C.codec)(Person) -export const guardPerson = S.interpreter(G.guard)(Person) -export const eqPerson = S.interpreter(Eq.eq)(Person) +export const decoderPerson = S.interpreter(D.schemableDecoder)(Person) +export const encoderPerson = S.interpreter(JE.schemableJsonEncoder)(Person) +export const codecPerson = S.interpreter(JC.schemableJsonCodec)(Person) +export const guardPerson = S.interpreter(G.schemableGuard)(Person) +export const eqPerson = S.interpreter(Eq.schemableEq)(Person) ``` # How to extend the built-in `Schema` @@ -85,8 +85,8 @@ Finally we must define an instance of `MySchemable1` for `Decoder` and an interp ```ts import * as D from 'io-ts/lib/Decoder' -export const mydecoder: MySchemable1 = { - ...D.decoder, +export const mySchemable: MySchemable1 = { + ...D.schemableDecoder, Int: D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') } @@ -112,7 +112,7 @@ const Person: MySchema<{ }> */ -export const decoderPerson = interpreter(mydecoder)(Person) +export const decoderPerson = interpreter(mySchemable)(Person) /* const decoderPerson: D.Decoder<{ name: string; diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index cfef8d239..eccdb94d7 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -21,10 +21,10 @@ Added in v2.2.3 - [UnknownRecord](#unknownrecord) - [array](#array) - [boolean](#boolean) -- [codec](#codec) - [fromDecoder](#fromdecoder) - [imap](#imap) - [intersection](#intersection) +- [invariantCodec](#invariantcodec) - [lazy](#lazy) - [literal](#literal) - [make](#make) @@ -136,42 +136,42 @@ export declare const boolean: Codec Added in v2.2.3 -# codec +# fromDecoder **Signature** ```ts -export declare const codec: Invariant2<'io-ts/Codec'> +export declare function fromDecoder(decoder: D.Decoder): Codec ``` Added in v2.2.3 -# fromDecoder +# imap **Signature** ```ts -export declare function fromDecoder(decoder: D.Decoder): Codec +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec ``` Added in v2.2.3 -# imap +# intersection **Signature** ```ts -export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec +export declare function intersection(left: Codec, right: Codec): Codec ``` Added in v2.2.3 -# intersection +# invariantCodec **Signature** ```ts -export declare function intersection(left: Codec, right: Codec): Codec +export declare const invariantCodec: Invariant2<'io-ts/Codec'> ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 5d46b8495..5033359e8 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -20,12 +20,16 @@ Added in v2.2.0 - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) - [alt](#alt) +- [altDecoder](#altdecoder) +- [alternativeDecoder](#alternativedecoder) - [ap](#ap) +- [applicativeDecoder](#applicativedecoder) +- [applyDecoder](#applydecoder) - [array](#array) - [boolean](#boolean) -- [decoder](#decoder) - [failure](#failure) - [fromGuard](#fromguard) +- [functorDecoder](#functordecoder) - [intersection](#intersection) - [isNotEmpty](#isnotempty) - [lazy](#lazy) @@ -39,6 +43,7 @@ Added in v2.2.0 - [partial](#partial) - [record](#record) - [refinement](#refinement) +- [schemableDecoder](#schemabledecoder) - [string](#string) - [success](#success) - [sum](#sum) @@ -132,6 +137,26 @@ export declare const alt: (that: () => Decoder) => (fa: Decoder) => Dec Added in v2.2.0 +# altDecoder + +**Signature** + +```ts +export declare const altDecoder: Alt1<'io-ts/Decoder'> +``` + +Added in v2.2.3 + +# alternativeDecoder + +**Signature** + +```ts +export declare const alternativeDecoder: Alternative1<'io-ts/Decoder'> +``` + +Added in v2.2.3 + # ap **Signature** @@ -142,37 +167,42 @@ export declare const ap: (fa: Decoder) => (fab: Decoder<(a: A) => B>) = Added in v2.2.0 -# array +# applicativeDecoder **Signature** ```ts -export declare function array(items: Decoder): Decoder> +export declare const applicativeDecoder: Applicative1<'io-ts/Decoder'> ``` -Added in v2.2.0 +Added in v2.2.3 -# boolean +# applyDecoder **Signature** ```ts -export declare const boolean: Decoder +export declare const applyDecoder: Apply1<'io-ts/Decoder'> +``` + +Added in v2.2.3 + +# array + +**Signature** + +```ts +export declare function array(items: Decoder): Decoder> ``` Added in v2.2.0 -# decoder +# boolean **Signature** ```ts -export declare const decoder: Applicative1<'io-ts/Decoder'> & - Alternative1<'io-ts/Decoder'> & - Schemable1<'io-ts/Decoder'> & - WithUnknownContainers1<'io-ts/Decoder'> & - WithUnion1<'io-ts/Decoder'> & - WithRefinement1<'io-ts/Decoder'> +export declare const boolean: Decoder ``` Added in v2.2.0 @@ -197,6 +227,16 @@ export declare function fromGuard(guard: G.Guard, expected: string): Decod Added in v2.2.0 +# functorDecoder + +**Signature** + +```ts +export declare const functorDecoder: Functor1<'io-ts/Decoder'> +``` + +Added in v2.2.3 + # intersection **Signature** @@ -331,6 +371,19 @@ export declare function refinement( Added in v2.2.0 +# schemableDecoder + +**Signature** + +```ts +export declare const schemableDecoder: Schemable1<'io-ts/Decoder'> & + WithUnknownContainers1<'io-ts/Decoder'> & + WithUnion1<'io-ts/Decoder'> & + WithRefinement1<'io-ts/Decoder'> +``` + +Added in v2.2.3 + # string **Signature** diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 67c80bfdd..0c79914df 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -18,9 +18,10 @@ Added in v2.2.3 - [URI (type alias)](#uri-type-alias) - [URI](#uri) - [array](#array) +- [categoryEncoder](#categoryencoder) - [compose](#compose) - [contramap](#contramap) -- [encoder](#encoder) +- [contravariantEncoder](#contravariantencoder) - [id](#id) - [intersection](#intersection) - [lazy](#lazy) @@ -95,6 +96,16 @@ export declare function array(items: Encoder): Encoder, Arr Added in v2.2.3 +# categoryEncoder + +**Signature** + +```ts +export declare const categoryEncoder: Category2<'io-ts/Encoder'> +``` + +Added in v2.2.3 + # compose **Signature** @@ -115,12 +126,12 @@ export declare const contramap: (f: (b: B) => A) => (fa: Encoder) Added in v2.2.3 -# encoder +# contravariantEncoder **Signature** ```ts -export declare const encoder: Contravariant2<'io-ts/Encoder'> & Category2<'io-ts/Encoder'> +export declare const contravariantEncoder: Contravariant2<'io-ts/Encoder'> ``` Added in v2.2.3 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index a7b1df6e2..ee6152dd9 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -18,13 +18,13 @@ Added in v2.2.2 - [UnknownRecord](#unknownrecord) - [array](#array) - [boolean](#boolean) -- [eq](#eq) - [intersection](#intersection) - [lazy](#lazy) - [nullable](#nullable) - [number](#number) - [partial](#partial) - [record](#record) +- [schemableEq](#schemableeq) - [string](#string) - [sum](#sum) - [tuple](#tuple) @@ -92,16 +92,6 @@ export declare const boolean: E.Eq Added in v2.2.2 -# eq - -**Signature** - -```ts -export declare const eq: Contravariant1<'Eq'> & Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefinement1<'Eq'> -``` - -Added in v2.2.2 - # intersection **Signature** @@ -162,6 +152,16 @@ export declare const record: (codomain: E.Eq) => E.Eq> Added in v2.2.2 +# schemableEq + +**Signature** + +```ts +export declare const schemableEq: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefinement1<'Eq'> +``` + +Added in v2.2.3 + # string **Signature** diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 0cccd13b3..bc11d2561 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -20,7 +20,6 @@ Added in v2.2.0 - [UnknownRecord](#unknownrecord) - [array](#array) - [boolean](#boolean) -- [guard](#guard) - [intersection](#intersection) - [lazy](#lazy) - [literal](#literal) @@ -30,6 +29,7 @@ Added in v2.2.0 - [partial](#partial) - [record](#record) - [refinement](#refinement) +- [schemableGuard](#schemableguard) - [string](#string) - [sum](#sum) - [tuple](#tuple) @@ -120,19 +120,6 @@ export declare const boolean: Guard Added in v2.2.0 -# guard - -**Signature** - -```ts -export declare const guard: Schemable1<'io-ts/Guard'> & - WithUnknownContainers1<'io-ts/Guard'> & - WithUnion1<'io-ts/Guard'> & - WithRefinement1<'io-ts/Guard'> -``` - -Added in v2.2.0 - # intersection **Signature** @@ -223,6 +210,19 @@ export declare function refinement(from: Guard, refinement: ( Added in v2.2.0 +# schemableGuard + +**Signature** + +```ts +export declare const schemableGuard: Schemable1<'io-ts/Guard'> & + WithUnknownContainers1<'io-ts/Guard'> & + WithUnion1<'io-ts/Guard'> & + WithRefinement1<'io-ts/Guard'> +``` + +Added in v2.2.3 + # string **Signature** diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index a5e9e0c3b..843f758a7 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -20,7 +20,7 @@ Added in v2.2.3 - [boolean](#boolean) - [imap](#imap) - [intersection](#intersection) -- [jsonCodec](#jsoncodec) +- [invariantJsonCodec](#invariantjsoncodec) - [lazy](#lazy) - [literal](#literal) - [make](#make) @@ -29,6 +29,7 @@ Added in v2.2.3 - [partial](#partial) - [record](#record) - [refinement](#refinement) +- [schemableJsonCodec](#schemablejsoncodec) - [string](#string) - [sum](#sum) - [tuple](#tuple) @@ -122,14 +123,12 @@ export declare const intersection: (left: JsonCodec, right: JsonCodec & - Schemable1<'io-ts/JsonCodec'> & - WithRefinement1<'io-ts/JsonCodec'> +export declare const invariantJsonCodec: Invariant1<'io-ts/JsonCodec'> ``` Added in v2.2.3 @@ -218,6 +217,16 @@ export declare const refinement: ( Added in v2.2.3 +# schemableJsonCodec + +**Signature** + +```ts +export declare const schemableJsonCodec: Schemable1<'io-ts/JsonCodec'> & WithRefinement1<'io-ts/JsonCodec'> +``` + +Added in v2.2.3 + # string **Signature** diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 6eceaf558..8bb30632e 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -21,13 +21,14 @@ Added in v2.2.3 - [URI](#uri) - [array](#array) - [contramap](#contramap) +- [contravariantJsonEncoder](#contravariantjsonencoder) - [id](#id) - [intersection](#intersection) -- [jsonEncoder](#jsonencoder) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) - [record](#record) +- [schemableJsonEncoder](#schemablejsonencoder) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -126,32 +127,32 @@ export declare const contramap: (f: (b: B) => A) => (fa: JsonEncoder) = Added in v2.2.3 -# id +# contravariantJsonEncoder **Signature** ```ts -export declare const id: JsonEncoder +export declare const contravariantJsonEncoder: Contravariant1<'io-ts/JsonEncoder'> ``` Added in v2.2.3 -# intersection +# id **Signature** ```ts -export declare const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder +export declare const id: JsonEncoder ``` Added in v2.2.3 -# jsonEncoder +# intersection **Signature** ```ts -export declare const jsonEncoder: Contravariant1<'io-ts/JsonEncoder'> & Schemable1<'io-ts/JsonEncoder'> +export declare const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder ``` Added in v2.2.3 @@ -196,6 +197,16 @@ export declare const record: (codomain: JsonEncoder) => JsonEncoder +``` + +Added in v2.2.3 + # sum **Signature** diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 876b02f73..c6ce56634 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -19,7 +19,6 @@ Added in v2.2.3 - [UnknownRecord](#unknownrecord) - [array](#array) - [boolean](#boolean) -- [instance](#instance) - [intersection](#intersection) - [lazy](#lazy) - [literal](#literal) @@ -28,6 +27,7 @@ Added in v2.2.3 - [partial](#partial) - [record](#record) - [refinement](#refinement) +- [schemableType](#schemabletype) - [string](#string) - [sum](#sum) - [tuple](#tuple) @@ -106,19 +106,6 @@ export declare const boolean: Type Added in v2.2.3 -# instance - -**Signature** - -```ts -export declare const instance: Schemable1<'io-ts/Type'> & - WithUnknownContainers1<'io-ts/Type'> & - WithUnion1<'io-ts/Type'> & - WithRefinement1<'io-ts/Type'> -``` - -Added in v2.2.3 - # intersection **Signature** @@ -203,6 +190,19 @@ export declare function refinement( Added in v2.2.3 +# schemableType + +**Signature** + +```ts +export declare const schemableType: Schemable1<'io-ts/Type'> & + WithUnknownContainers1<'io-ts/Type'> & + WithUnion1<'io-ts/Type'> & + WithRefinement1<'io-ts/Type'> +``` + +Added in v2.2.3 + # string **Signature** diff --git a/dtslint/ts3.5/Econder.ts b/dtslint/ts3.5/Econder.ts index 89fc691e8..58fc90377 100644 --- a/dtslint/ts3.5/Econder.ts +++ b/dtslint/ts3.5/Econder.ts @@ -9,7 +9,7 @@ const BooleanToNumber: E.Encoder = { encode: (b) => (b ? 1 : 0) } -export const Person = E.type({ name: E.encoder.id(), age: NumberToString }) +export const Person = E.type({ name: E.categoryEncoder.id(), age: NumberToString }) // // TypeOf diff --git a/src/Codec.ts b/src/Codec.ts index 9cad37599..330dfe995 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -203,7 +203,7 @@ export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec imap_(fa, f, g) const imap_: (fa: Codec, f: (a: A) => B, g: (b: B) => A) => Codec = (fa, f, g) => - make(D.decoder.map(fa, f), E.encoder.contramap(fa, g)) + make(D.functorDecoder.map(fa, f), E.contravariantEncoder.contramap(fa, g)) // ------------------------------------------------------------------------------------- // instances @@ -228,7 +228,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.3 */ -export const codec: Invariant2 = { +export const invariantCodec: Invariant2 = { URI, imap: imap_ } diff --git a/src/Decoder.ts b/src/Decoder.ts index 6b34361f4..1d8f0373c 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -9,6 +9,9 @@ import { pipe } from 'fp-ts/lib/pipeable' import { Forest, Tree } from 'fp-ts/lib/Tree' import * as G from './Guard' import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import { Functor1 } from 'fp-ts/lib/Functor' +import { Alt1 } from 'fp-ts/lib/Alt' +import { Apply1 } from 'fp-ts/lib/Apply' // ------------------------------------------------------------------------------------- // model @@ -94,7 +97,7 @@ export function literal>(...values: A): Decoder return never } const expected = values.map((value) => JSON.stringify(value)).join(' | ') - return fromGuard(G.guard.literal(...values), expected) + return fromGuard(G.schemableGuard.literal(...values), expected) } // ------------------------------------------------------------------------------------- @@ -505,20 +508,61 @@ declare module 'fp-ts/lib/HKT' { } /** - * @since 2.2.0 + * @since 2.2.3 */ -export const decoder: Applicative1 & - Alternative1 & - Schemable1 & - WithUnknownContainers1 & - WithUnion1 & - WithRefinement1 = { +export const functorDecoder: Functor1 = { + URI, + map: map_ +} + +/** + * @since 2.2.3 + */ +export const applyDecoder: Apply1 = { + URI, + map: map_, + ap: ap_ +} + +/** + * @since 2.2.3 + */ +export const applicativeDecoder: Applicative1 = { + URI, + map: map_, + of, + ap: ap_ +} + +/** + * @since 2.2.3 + */ +export const altDecoder: Alt1 = { + URI, + map: map_, + alt: alt_ +} + +/** + * @since 2.2.3 + */ +export const alternativeDecoder: Alternative1 = { URI, map: map_, of, ap: ap_, alt: alt_, - zero: () => never, + zero: () => never +} + +/** + * @since 2.2.3 + */ +export const schemableDecoder: Schemable1 & + WithUnknownContainers1 & + WithUnion1 & + WithRefinement1 = { + URI, literal, string, number, diff --git a/src/Encoder.ts b/src/Encoder.ts index ab89531df..794b18b2d 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -168,7 +168,7 @@ export function lazy(f: () => Encoder): Encoder { * @since 2.2.3 */ export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = (f) => (fa) => - encoder.contramap(fa, f) + contramap_(fa, f) const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder = (fa, f) => ({ encode: (b) => fa.encode(f(b)) @@ -178,7 +178,7 @@ const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder * @since 2.2.3 */ export const compose: (ea: Encoder) => (ab: Encoder) => Encoder = (ea) => (ab) => - encoder.compose(ab, ea) + compose_(ab, ea) const compose_: (ab: Encoder, la: Encoder) => Encoder = (ab, ea) => ({ encode: (b) => ea.encode(ab.encode(b)) @@ -207,9 +207,16 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.3 */ -export const encoder: Contravariant2 & Category2 = { +export const contravariantEncoder: Contravariant2 = { + URI, + contramap: contramap_ +} + +/** + * @since 2.2.3 + */ +export const categoryEncoder: Category2 = { URI, - contramap: contramap_, compose: compose_, id } diff --git a/src/Eq.ts b/src/Eq.ts index f04c0f7b5..05fa45a2e 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -153,10 +153,10 @@ export function lazy(f: () => Eq): Eq { // ------------------------------------------------------------------------------------- /** - * @since 2.2.2 + * @since 2.2.3 */ -export const eq: typeof E.eq & Schemable1 & WithUnknownContainers1 & WithRefinement1 = { - ...E.eq, +export const schemableEq: Schemable1 & WithUnknownContainers1 & WithRefinement1 = { + URI: E.URI, literal: () => E.eqStrict, string, number, diff --git a/src/Guard.ts b/src/Guard.ts index d88cf65f7..8c5fd7dbf 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -224,9 +224,9 @@ declare module 'fp-ts/lib/HKT' { } /** - * @since 2.2.0 + * @since 2.2.3 */ -export const guard: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { +export const schemableGuard: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { URI, literal, string, diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 4b08b549b..8f94fd6d8 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -161,9 +161,16 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.3 */ -export const jsonCodec: Invariant1 & Schemable1 & WithRefinement1 = { +export const invariantJsonCodec: Invariant1 = { + URI, + imap: C.invariantCodec.imap +} + +/** + * @since 2.2.3 + */ +export const schemableJsonCodec: Schemable1 & WithRefinement1 = { URI, - imap: C.codec.imap, literal, string, number, diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 36eac0f6b..c0041d198 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -135,9 +135,16 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.3 */ -export const jsonEncoder: Contravariant1 & Schemable1 = { +export const contravariantJsonEncoder: Contravariant1 = { + URI, + contramap: E.contravariantEncoder.contramap +} + +/** + * @since 2.2.3 + */ +export const schemableJsonEncoder: Schemable1 = { URI, - contramap: E.encoder.contramap, literal: () => id, string: id, number: id, diff --git a/src/Type.ts b/src/Type.ts index d3912c645..24e720838 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -158,7 +158,7 @@ declare module 'fp-ts/lib/HKT' { /** * @since 2.2.3 */ -export const instance: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { +export const schemableType: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { URI, literal, string, diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index c046215aa..60e218f4d 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -116,7 +116,7 @@ declare module 'fp-ts/lib/HKT' { } } -export const arbitrary: S.Schemable1 & +export const schemableArbitrary: S.Schemable1 & S.WithUnknownContainers1 & S.WithUnion1 & S.WithRefinement1 = { diff --git a/test/Codec.ts b/test/Codec.ts index b7d250362..a23635245 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -33,7 +33,7 @@ const undef: C.Codec = C.fromDecoder(D.fromGuard(undefined describe('Codec', () => { describe('codec', () => { it('imap', () => { - const codec = C.codec.imap( + const codec = C.invariantCodec.imap( C.string, (s) => ({ value: s }), ({ value }) => value diff --git a/test/Decoder.ts b/test/Decoder.ts index 9471e7950..28080fac7 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -14,13 +14,13 @@ describe('Decoder', () => { }) it('of', () => { - const decoder = D.decoder.of(1) + const decoder = D.applicativeDecoder.of(1) assert.deepStrictEqual(decoder.decode(1), E.right(1)) assert.deepStrictEqual(decoder.decode('a'), E.right(1)) }) it('ap', () => { - const fab = D.decoder.of((s: string): number => s.length) + const fab = D.applicativeDecoder.of((s: string): number => s.length) const fa = D.string assert.deepStrictEqual(pipe(fab, D.ap(fa)).decode('aaa'), E.right(3)) }) @@ -35,7 +35,7 @@ describe('Decoder', () => { }) it('zero', () => { - const decoder = D.decoder.zero() + const decoder = D.alternativeDecoder.zero() assert.deepStrictEqual(decoder.decode(null), E.left([D.tree('cannot decode null, should be never')])) }) }) diff --git a/test/Eq.ts b/test/Eq.ts index 689c2b0fe..285a7b5d0 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -4,7 +4,7 @@ import { Eq } from 'fp-ts/lib/Eq' describe('Eq', () => { it('literal', () => { - const eq = E.eq.literal('a', null) + const eq = E.schemableEq.literal('a', null) assert.deepStrictEqual(eq.equals('a', 'a'), true) assert.deepStrictEqual(eq.equals(null, null), true) assert.deepStrictEqual(eq.equals('a', null), false) @@ -55,7 +55,7 @@ describe('Eq', () => { b: Array } - const eq: Eq = E.eq.lazy('A', () => + const eq: Eq = E.schemableEq.lazy('A', () => E.type({ a: E.number, b: E.array(eq) @@ -70,8 +70,8 @@ describe('Eq', () => { it('sum', () => { const sum = E.sum('_tag') const eq = sum({ - A: E.type({ _tag: E.eq.literal('A'), a: E.string }), - B: E.type({ _tag: E.eq.literal('B'), b: E.number }) + A: E.type({ _tag: E.schemableEq.literal('A'), a: E.string }), + B: E.type({ _tag: E.schemableEq.literal('B'), b: E.number }) }) assert.strictEqual(eq.equals({ _tag: 'A', a: 'a' }, { _tag: 'A', a: 'a' }), true) assert.strictEqual(eq.equals({ _tag: 'B', b: 1 }, { _tag: 'B', b: 1 }), true) @@ -85,7 +85,7 @@ describe('Eq', () => { readonly NonEmptyString: unique symbol } type NonEmptyString = string & NonEmptyStringBrand - const eq = E.eq.refinement(E.string, (s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + const eq = E.schemableEq.refinement(E.string, (s): s is NonEmptyString => s.length > 0, 'NonEmptyString') const a: NonEmptyString = 'a' as any const b: NonEmptyString = 'b' as any assert.deepStrictEqual(eq.equals(a, a), true) diff --git a/test/Guard.ts b/test/Guard.ts index 7d89a2193..4c910e758 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -187,7 +187,7 @@ describe('Guard', () => { b: Array } - const guard: G.Guard = G.guard.lazy('A', () => + const guard: G.Guard = G.schemableGuard.lazy('A', () => G.type({ a: G.number, b: G.array(guard) diff --git a/test/JsonEncoder.ts b/test/JsonEncoder.ts index 6ec2c0a7c..9228f9afc 100644 --- a/test/JsonEncoder.ts +++ b/test/JsonEncoder.ts @@ -4,7 +4,7 @@ import * as JE from '../src/JsonEncoder' describe('Encoder', () => { describe('JsonEncoder', () => { it('contramap', () => { - const encoder = JE.jsonEncoder.contramap(JE.jsonEncoder.number, (s: string) => s.length) + const encoder = JE.contravariantJsonEncoder.contramap(JE.schemableJsonEncoder.number, (s: string) => s.length) assert.deepStrictEqual(encoder.encode('aaa'), 3) }) }) diff --git a/test/Schema.ts b/test/Schema.ts index 6abf8aab0..1f9532466 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -18,11 +18,11 @@ function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { } function check(schema: Schema): void { - const arb = interpreter(A.arbitrary)(schema) - const codec = interpreter(JC.jsonCodec)(schema) - const guard = interpreter(G.guard)(schema) - const eq = interpreter(Eq.eq)(schema) - const encoder = interpreter(JE.jsonEncoder)(schema) + const arb = interpreter(A.schemableArbitrary)(schema) + const codec = interpreter(JC.schemableJsonCodec)(schema) + const guard = interpreter(G.schemableGuard)(schema) + const eq = interpreter(Eq.schemableEq)(schema) + const encoder = interpreter(JE.schemableJsonEncoder)(schema) // decoders, guards and eqs should be aligned fc.assert(fc.property(arb, (a) => isRight(codec.decode(a)) && guard.is(a) && eq.equals(a, a))) // laws diff --git a/test/Type.ts b/test/Type.ts index 3c0f04805..079b133dd 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -32,10 +32,10 @@ function interpreter( } function check(schema: Schema, type: t.Type): void { - const arb = interpreter(A.arbitrary)(schema) - const decoder = interpreter(D.decoder)(schema) - const guard = interpreter(G.guard)(schema) - const itype = interpreter(T.instance)(schema) + const arb = interpreter(A.schemableArbitrary)(schema) + const decoder = interpreter(D.schemableDecoder)(schema) + const guard = interpreter(G.schemableGuard)(schema) + const itype = interpreter(T.schemableType)(schema) // decoder and type should be aligned fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) === isRight(type.decode(a)))) // interpreted type and type should be aligned From 73d92a08c42dca3d874927d92c8e9ad30d0a11f5 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 21 May 2020 11:13:39 +0200 Subject: [PATCH 039/222] use the built-in `Readonly` type in `readonly` combinator, closes #472 --- CHANGELOG.md | 2 ++ docs/modules/index.ts.md | 7 +------ dtslint/ts3.5/index.ts | 18 +++++++++++------- src/index.ts | 7 +------ 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b89f4a448..7435b5f35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ # 2.2.3 +- **Polish** + - use the built-in `Readonly` type in `readonly` combinator, closes #472 (@gcanti) - **Experimental** - split instances (@gcanti) - add `Type` experimental module, #464 (@gcanti) diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index f3f3a66c9..696af9a8d 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -555,12 +555,7 @@ Added in v1.5.3 ```ts export interface ReadonlyC - extends ReadonlyType< - C, - { readonly [K in keyof TypeOf]: TypeOf[K] }, - { readonly [K in keyof OutputOf]: OutputOf[K] }, - unknown - > {} + extends ReadonlyType>, Readonly>, unknown> {} ``` Added in v1.5.3 diff --git a/dtslint/ts3.5/index.ts b/dtslint/ts3.5/index.ts index 69c1cbc19..8faac7e57 100644 --- a/dtslint/ts3.5/index.ts +++ b/dtslint/ts3.5/index.ts @@ -18,7 +18,7 @@ export const NumberFromString = new t.Type( 'NumberFromString', t.number.is, (u, c) => - either.chain(t.string.validate(u, c), s => { + either.chain(t.string.validate(u, c), (s) => { const n = parseFloat(s) return isNaN(n) ? t.failure(s, c) : t.success(n) }), @@ -63,11 +63,11 @@ type Keyof1OutputTest = t.OutputOf // $ExpectType "a" | "b" // refinement // -const Refinement1 = t.refinement(t.number, n => n % 2 === 0) // $ExpectType RefinementC +const Refinement1 = t.refinement(t.number, (n) => n % 2 === 0) // $ExpectType RefinementC type Refinement1TypeTest = t.TypeOf // $ExpectType number type Refinement1OutputTest = t.OutputOf // $ExpectType number -const Refinement2 = t.refinement(NumberFromString, n => n % 2 === 0) // $ExpectType RefinementC> +const Refinement2 = t.refinement(NumberFromString, (n) => n % 2 === 0) // $ExpectType RefinementC> type Refinement2TypeTest = t.TypeOf // $ExpectType number type Refinement2OutputTest = t.OutputOf // $ExpectType string @@ -266,6 +266,10 @@ const Readonly2 = t.readonly(t.type({ a: NumberFromString })) // $ExpectType Rea type Readonly2TypeTest = Equals, { readonly a: number }> // $ExpectType "T" type Readonly2OutputTest = Equals, { readonly a: string }> // $ExpectType "T" +const Readonly3 = t.readonly(t.tuple([t.string, NumberFromString])) +type Readonly3TypeTest = Equals, Readonly<[string, number]>> // $ExpectType "T" +type Readonly3OutputTest = Equals, Readonly<[string, string]>> // $ExpectType "T" + // // readonlyArray // @@ -316,14 +320,14 @@ interface TaggedUnion2_B { a: TaggedUnion2_A | undefined } -const TaggedUnion2_A: t.RecursiveType = t.recursion('TaggedUnion2_A', _ => +const TaggedUnion2_A: t.RecursiveType = t.recursion('TaggedUnion2_A', (_) => t.type({ type: t.literal('a'), b: t.union([TaggedUnion2_B, t.undefined]) }) ) -const TaggedUnion2_B: t.RecursiveType = t.recursion('TaggedUnion2_B', _ => +const TaggedUnion2_B: t.RecursiveType = t.recursion('TaggedUnion2_B', (_) => t.type({ type: t.literal('b'), a: t.union([TaggedUnion2_A, t.undefined]) @@ -432,7 +436,7 @@ function f(generable: Generable): string { switch (generable._tag) { case 'InterfaceType': return Object.keys(generable.props) - .map(k => f(generable.props[k])) + .map((k) => f(generable.props[k])) .join('/') case 'StringType': return 'StringC' @@ -497,7 +501,7 @@ interface Rec { b: Rec | undefined } -const Rec = t.recursion('T', self => +const Rec = t.recursion('T', (self) => t.type({ a: t.number, b: t.union([self, t.undefined]) diff --git a/src/index.ts b/src/index.ts index 0af62149d..8bafbfb02 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1554,12 +1554,7 @@ export class ReadonlyType extends Ty * @since 1.5.3 */ export interface ReadonlyC - extends ReadonlyType< - C, - { readonly [K in keyof TypeOf]: TypeOf[K] }, - { readonly [K in keyof OutputOf]: OutputOf[K] }, - unknown - > {} + extends ReadonlyType>, Readonly>, unknown> {} /** * @since 1.0.0 From 4a6543bd6007c03a66092c63e06ff64ee5611354 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 21 May 2020 11:44:45 +0200 Subject: [PATCH 040/222] make Decoder module more tree shaking friendly and remove applicative instance --- docs/modules/Decoder.ts.md | 44 ------------------------- src/Decoder.ts | 67 ++++++++++---------------------------- test/Codec.ts | 2 +- test/Decoder.ts | 27 +++++---------- test/JsonEncoder.ts | 2 +- 5 files changed, 28 insertions(+), 114 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 5033359e8..cd173c53a 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -21,10 +21,6 @@ Added in v2.2.0 - [UnknownRecord](#unknownrecord) - [alt](#alt) - [altDecoder](#altdecoder) -- [alternativeDecoder](#alternativedecoder) -- [ap](#ap) -- [applicativeDecoder](#applicativedecoder) -- [applyDecoder](#applydecoder) - [array](#array) - [boolean](#boolean) - [failure](#failure) @@ -147,46 +143,6 @@ export declare const altDecoder: Alt1<'io-ts/Decoder'> Added in v2.2.3 -# alternativeDecoder - -**Signature** - -```ts -export declare const alternativeDecoder: Alternative1<'io-ts/Decoder'> -``` - -Added in v2.2.3 - -# ap - -**Signature** - -```ts -export declare const ap: (fa: Decoder) => (fab: Decoder<(a: A) => B>) => Decoder -``` - -Added in v2.2.0 - -# applicativeDecoder - -**Signature** - -```ts -export declare const applicativeDecoder: Applicative1<'io-ts/Decoder'> -``` - -Added in v2.2.3 - -# applyDecoder - -**Signature** - -```ts -export declare const applyDecoder: Apply1<'io-ts/Decoder'> -``` - -Added in v2.2.3 - # array **Signature** diff --git a/src/Decoder.ts b/src/Decoder.ts index 1d8f0373c..a2da8727b 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -1,9 +1,7 @@ /** * @since 2.2.0 */ -import { Alternative1 } from 'fp-ts/lib/Alternative' -import { Applicative1 } from 'fp-ts/lib/Applicative' -import { Either, either, isLeft, isRight, left, mapLeft, right } from 'fp-ts/lib/Either' +import { Either, isLeft, isRight, left, mapLeft, right } from 'fp-ts/lib/Either' import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' import { Forest, Tree } from 'fp-ts/lib/Tree' @@ -11,7 +9,6 @@ import * as G from './Guard' import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' import { Functor1 } from 'fp-ts/lib/Functor' import { Alt1 } from 'fp-ts/lib/Alt' -import { Apply1 } from 'fp-ts/lib/Apply' // ------------------------------------------------------------------------------------- // model @@ -34,6 +31,10 @@ export interface Decoder { */ export type TypeOf = D extends Decoder ? A : never +// ------------------------------------------------------------------------------------- +// DecodeError +// ------------------------------------------------------------------------------------- + const empty: Array = [] /** @@ -463,28 +464,25 @@ export function union>( /** * @since 2.2.0 */ -export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) - -const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) => ({ - decode: (u) => either.alt(fx.decode(u), () => fy().decode(u)) -}) - -/** - * @since 2.2.0 - */ -export const ap: (fa: Decoder) => (fab: Decoder<(a: A) => B>) => Decoder = (fa) => (fab) => ap_(fab, fa) +export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) -const ap_: (fab: Decoder<(a: A) => B>, fa: Decoder) => Decoder = (fab, fa) => ({ - decode: (u) => either.ap(fab.decode(u), fa.decode(u)) +const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ + decode: (u) => { + const e = fa.decode(u) + return isLeft(e) ? e : right(f(e.right)) + } }) /** * @since 2.2.0 */ -export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) +export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) -const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ - decode: (u) => either.map(fa.decode(u), f) +const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) => ({ + decode: (u) => { + const e = fx.decode(u) + return isLeft(e) ? fy().decode(u) : e + } }) // ------------------------------------------------------------------------------------- @@ -515,25 +513,6 @@ export const functorDecoder: Functor1 = { map: map_ } -/** - * @since 2.2.3 - */ -export const applyDecoder: Apply1 = { - URI, - map: map_, - ap: ap_ -} - -/** - * @since 2.2.3 - */ -export const applicativeDecoder: Applicative1 = { - URI, - map: map_, - of, - ap: ap_ -} - /** * @since 2.2.3 */ @@ -543,18 +522,6 @@ export const altDecoder: Alt1 = { alt: alt_ } -/** - * @since 2.2.3 - */ -export const alternativeDecoder: Alternative1 = { - URI, - map: map_, - of, - ap: ap_, - alt: alt_, - zero: () => never -} - /** * @since 2.2.3 */ diff --git a/test/Codec.ts b/test/Codec.ts index a23635245..c9c30e14e 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -31,7 +31,7 @@ const undefinedGuard: G.Guard = { const undef: C.Codec = C.fromDecoder(D.fromGuard(undefinedGuard, 'undefined')) describe('Codec', () => { - describe('codec', () => { + describe('invariantCodec', () => { it('imap', () => { const codec = C.invariantCodec.imap( C.string, diff --git a/test/Decoder.ts b/test/Decoder.ts index 28080fac7..80ed42c95 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -4,27 +4,23 @@ import { pipe } from 'fp-ts/lib/pipeable' import * as D from '../src/Decoder' describe('Decoder', () => { - describe('decoder', () => { + it('of', () => { + const decoder = D.of(1) + assert.deepStrictEqual(decoder.decode('aaa'), E.right(1)) + }) + + describe('functorDecoder', () => { it('map', () => { const decoder = pipe( D.string, D.map((s) => s.length) ) + assert.deepStrictEqual(decoder.decode(null), E.left([D.tree('cannot decode null, should be string')])) assert.deepStrictEqual(decoder.decode('aaa'), E.right(3)) }) + }) - it('of', () => { - const decoder = D.applicativeDecoder.of(1) - assert.deepStrictEqual(decoder.decode(1), E.right(1)) - assert.deepStrictEqual(decoder.decode('a'), E.right(1)) - }) - - it('ap', () => { - const fab = D.applicativeDecoder.of((s: string): number => s.length) - const fa = D.string - assert.deepStrictEqual(pipe(fab, D.ap(fa)).decode('aaa'), E.right(3)) - }) - + describe('altDecoder', () => { it('alt', () => { const decoder = pipe( D.string, @@ -33,11 +29,6 @@ describe('Decoder', () => { assert.deepStrictEqual(decoder.decode('a'), E.right('a')) assert.deepStrictEqual(decoder.decode(1), E.right('1')) }) - - it('zero', () => { - const decoder = D.alternativeDecoder.zero() - assert.deepStrictEqual(decoder.decode(null), E.left([D.tree('cannot decode null, should be never')])) - }) }) describe('union', () => { diff --git a/test/JsonEncoder.ts b/test/JsonEncoder.ts index 9228f9afc..044f1de91 100644 --- a/test/JsonEncoder.ts +++ b/test/JsonEncoder.ts @@ -2,7 +2,7 @@ import * as assert from 'assert' import * as JE from '../src/JsonEncoder' describe('Encoder', () => { - describe('JsonEncoder', () => { + describe('contravariantJsonEncoder', () => { it('contramap', () => { const encoder = JE.contravariantJsonEncoder.contramap(JE.schemableJsonEncoder.number, (s: string) => s.length) assert.deepStrictEqual(encoder.encode('aaa'), 3) From 32fb3297cb256d7e848664fd7cdfbac0fc3df04a Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 27 May 2020 12:51:39 +0200 Subject: [PATCH 041/222] Docs: add missing TypeOf info --- docs/index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/index.md b/docs/index.md index c24f80555..de171af08 100644 --- a/docs/index.md +++ b/docs/index.md @@ -121,6 +121,18 @@ type User = { The advantage of using `io-ts` to define the runtime type is that we can validate the type at runtime, and we can also extract the corresponding static type, so we don’t have to define it twice. +Static types can be extracted from codecs using the `TypeOf` operator: + +```ts +type User = t.TypeOf + +// same as +type User = { + userId: number + name: string +} +``` + ## Error reporters A reporter implements the following interface From a1e46b46f706bda1ced0d40890a7916b70f6a146 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 27 May 2020 13:33:35 +0200 Subject: [PATCH 042/222] remove the dependency on the `either` instance as a mean of improving tree shaking --- CHANGELOG.md | 5 + package.json | 2 +- src/index.ts | 314 +++++++++++++++++++++++++------------------ test/2.1.x/record.ts | 1 + 4 files changed, 190 insertions(+), 132 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7435b5f35..aad54cbe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.4 + +- **Polish** + - remove the dependency on the `either` instance as a mean of improving tree shaking (@gcanti) + # 2.2.3 - **Polish** diff --git a/package.json b/package.json index 040aec16b..859c850e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.3", + "version": "2.2.4", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", diff --git a/src/index.ts b/src/index.ts index 8bafbfb02..fabe410f9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,9 @@ /** * @since 1.0.0 */ -import { Either, either, isLeft, left, right } from 'fp-ts/lib/Either' +import { Either, isLeft, left, right } from 'fp-ts/lib/Either' import { Predicate, Refinement } from 'fp-ts/lib/function' -const map = either.map -const chain = either.chain - /** * @since 1.0.0 */ @@ -145,7 +142,13 @@ export class Type implements Decoder, Encoder return new Type( name, ab.is, - (i, c) => chain(this.validate(i, c), (a) => ab.validate(a, c)), + (i, c) => { + const e = this.validate(i, c) + if (isLeft(e)) { + return e + } + return ab.validate(e.right, c) + }, this.encode === identity && ab.encode === identity ? (identity as any) : (b) => this.encode(ab.encode(b)) ) } @@ -755,28 +758,32 @@ export const array = (codec: C, name: string = `Array<${codec.n new ArrayType( name, (u): u is Array> => UnknownArray.is(u) && u.every(codec.is), - (u, c) => - chain(UnknownArray.validate(u, c), (us) => { - const len = us.length - let as: Array> = us - const errors: Errors = [] - for (let i = 0; i < len; i++) { - const ui = us[i] - const result = codec.validate(ui, appendContext(c, String(i), codec, ui)) - if (isLeft(result)) { - pushAll(errors, result.left) - } else { - const ai = result.right - if (ai !== ui) { - if (as === us) { - as = us.slice() - } - as[i] = ai + (u, c) => { + const e = UnknownArray.validate(u, c) + if (isLeft(e)) { + return e + } + const us = e.right + const len = us.length + let as: Array> = us + const errors: Errors = [] + for (let i = 0; i < len; i++) { + const ui = us[i] + const result = codec.validate(ui, appendContext(c, String(i), codec, ui)) + if (isLeft(result)) { + pushAll(errors, result.left) + } else { + const ai = result.right + if (ai !== ui) { + if (as === us) { + as = us.slice() } + as[i] = ai } } - return errors.length > 0 ? failures(errors) : success(as) - }), + } + return errors.length > 0 ? failures(errors) : success(as) + }, codec.encode === identity ? identity : (a) => a.map(codec.encode), codec ) @@ -870,30 +877,34 @@ export const type =

(props: P, name: string = getInterfaceTypeN } return false }, - (u, c) => - chain(UnknownRecord.validate(u, c), (o) => { - let a = o - const errors: Errors = [] - for (let i = 0; i < len; i++) { - const k = keys[i] - const ak = a[k] - const type = types[i] - const result = type.validate(ak, appendContext(c, k, type, ak)) - if (isLeft(result)) { - pushAll(errors, result.left) - } else { - const vak = result.right - if (vak !== ak || (vak === undefined && !hasOwnProperty.call(a, k))) { - /* istanbul ignore next */ - if (a === o) { - a = { ...o } - } - a[k] = vak + (u, c) => { + const e = UnknownRecord.validate(u, c) + if (isLeft(e)) { + return e + } + const o = e.right + let a = o + const errors: Errors = [] + for (let i = 0; i < len; i++) { + const k = keys[i] + const ak = a[k] + const type = types[i] + const result = type.validate(ak, appendContext(c, k, type, ak)) + if (isLeft(result)) { + pushAll(errors, result.left) + } else { + const vak = result.right + if (vak !== ak || (vak === undefined && !hasOwnProperty.call(a, k))) { + /* istanbul ignore next */ + if (a === o) { + a = { ...o } } + a[k] = vak } } - return errors.length > 0 ? failures(errors) : success(a as any) - }), + } + return errors.length > 0 ? failures(errors) : success(a as any) + }, useIdentity(types) ? identity : (a) => { @@ -975,32 +986,36 @@ export const partial =

( } return false }, - (u, c) => - chain(UnknownRecord.validate(u, c), (o) => { - let a = o - const errors: Errors = [] - for (let i = 0; i < len; i++) { - const k = keys[i] - const ak = a[k] - const type = props[k] - const result = type.validate(ak, appendContext(c, k, type, ak)) - if (isLeft(result)) { - if (ak !== undefined) { - pushAll(errors, result.left) - } - } else { - const vak = result.right - if (vak !== ak) { - /* istanbul ignore next */ - if (a === o) { - a = { ...o } - } - a[k] = vak + (u, c) => { + const e = UnknownRecord.validate(u, c) + if (isLeft(e)) { + return e + } + const o = e.right + let a = o + const errors: Errors = [] + for (let i = 0; i < len; i++) { + const k = keys[i] + const ak = a[k] + const type = props[k] + const result = type.validate(ak, appendContext(c, k, type, ak)) + if (isLeft(result)) { + if (ak !== undefined) { + pushAll(errors, result.left) + } + } else { + const vak = result.right + if (vak !== ak) { + /* istanbul ignore next */ + if (a === o) { + a = { ...o } } + a[k] = vak } } - return errors.length > 0 ? failures(errors) : success(a as any) - }), + } + return errors.length > 0 ? failures(errors) : success(a as any) + }, useIdentity(types) ? identity : (a) => { @@ -1064,25 +1079,29 @@ function enumerableRecord( return new DictionaryType( name, (u): u is { [K in TypeOf]: TypeOf } => UnknownRecord.is(u) && keys.every((k) => codomain.is(u[k])), - (u, c) => - chain(UnknownRecord.validate(u, c), (o) => { - const a: { [key: string]: any } = {} - const errors: Errors = [] - let changed: boolean = false - for (let i = 0; i < len; i++) { - const k = keys[i] - const ok = o[k] - const codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)) - if (isLeft(codomainResult)) { - pushAll(errors, codomainResult.left) - } else { - const vok = codomainResult.right - changed = changed || vok !== ok - a[k] = vok - } + (u, c) => { + const e = UnknownRecord.validate(u, c) + if (isLeft(e)) { + return e + } + const o = e.right + const a: { [key: string]: any } = {} + const errors: Errors = [] + let changed: boolean = false + for (let i = 0; i < len; i++) { + const k = keys[i] + const ok = o[k] + const codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)) + if (isLeft(codomainResult)) { + pushAll(errors, codomainResult.left) + } else { + const vok = codomainResult.right + changed = changed || vok !== ok + a[k] = vok } - return errors.length > 0 ? failures(errors) : success((changed || Object.keys(o).length !== len ? a : o) as any) - }), + } + return errors.length > 0 ? failures(errors) : success((changed || Object.keys(o).length !== len ? a : o) as any) + }, codomain.encode === identity ? identity : (a: any) => { @@ -1248,15 +1267,19 @@ export const union = ]>( } return false }, - (u, c) => - chain(UnknownRecord.validate(u, c), (r) => { - const i = find(r[tag]) - if (i === undefined) { - return failure(u, c) - } - const codec = codecs[i] - return codec.validate(r, appendContext(c, String(i), codec, r)) - }), + (u, c) => { + const e = UnknownRecord.validate(u, c) + if (isLeft(e)) { + return e + } + const r = e.right + const i = find(r[tag]) + if (i === undefined) { + return failure(u, c) + } + const codec = codecs[i] + return codec.validate(r, appendContext(c, String(i), codec, r)) + }, useIdentity(codecs) ? identity : (a) => { @@ -1503,29 +1526,33 @@ export function tuple]>( return new TupleType( name, (u): u is any => UnknownArray.is(u) && u.length === len && codecs.every((type, i) => type.is(u[i])), - (u, c) => - chain(UnknownArray.validate(u, c), (us) => { - let as: Array = us.length > len ? us.slice(0, len) : us // strip additional components - const errors: Errors = [] - for (let i = 0; i < len; i++) { - const a = us[i] - const type = codecs[i] - const result = type.validate(a, appendContext(c, String(i), type, a)) - if (isLeft(result)) { - pushAll(errors, result.left) - } else { - const va = result.right - if (va !== a) { - /* istanbul ignore next */ - if (as === us) { - as = us.slice() - } - as[i] = va + (u, c) => { + const e = UnknownArray.validate(u, c) + if (isLeft(e)) { + return e + } + const us = e.right + let as: Array = us.length > len ? us.slice(0, len) : us // strip additional components + const errors: Errors = [] + for (let i = 0; i < len; i++) { + const a = us[i] + const type = codecs[i] + const result = type.validate(a, appendContext(c, String(i), type, a)) + if (isLeft(result)) { + pushAll(errors, result.left) + } else { + const va = result.right + if (va !== a) { + /* istanbul ignore next */ + if (as === us) { + as = us.slice() } + as[i] = va } } - return errors.length > 0 ? failures(errors) : success(as) - }), + } + return errors.length > 0 ? failures(errors) : success(as) + }, useIdentity(codecs) ? identity : (a) => codecs.map((type, i) => type.encode(a[i])), codecs ) @@ -1563,13 +1590,17 @@ export const readonly = (codec: C, name: string = `Readonly<${c return new ReadonlyType( name, codec.is, - (u, c) => - map(codec.validate(u, c), (x) => { - if (process.env.NODE_ENV !== 'production') { - return Object.freeze(x) - } - return x - }), + (u, c) => { + const e = codec.validate(u, c) + if (isLeft(e)) { + return e + } + const x = e.right + if (process.env.NODE_ENV !== 'production') { + return right(Object.freeze(x)) + } + return right(x) + }, codec.encode === identity ? identity : codec.encode, codec ) @@ -1611,13 +1642,17 @@ export const readonlyArray = ( return new ReadonlyArrayType( name, arrayType.is, - (u, c) => - map(arrayType.validate(u, c), (x) => { - if (process.env.NODE_ENV !== 'production') { - return Object.freeze(x) - } - return x - }), + (u, c) => { + const e = arrayType.validate(u, c) + if (isLeft(e)) { + return e + } + const x = e.right + if (process.env.NODE_ENV !== 'production') { + return right(Object.freeze(x)) + } + return right(x) + }, arrayType.encode as any, codec ) @@ -1782,7 +1817,17 @@ export const exact = (codec: C, name: string = getExactTypeN return new ExactType( name, codec.is, - (u, c) => chain(UnknownRecord.validate(u, c), () => map(codec.validate(u, c), (a) => stripKeys(a, props))), + (u, c) => { + const e = UnknownRecord.validate(u, c) + if (isLeft(e)) { + return e + } + const ce = codec.validate(u, c) + if (isLeft(ce)) { + return ce + } + return right(stripKeys(ce.right, props)) + }, (a) => codec.encode(stripKeys(a, props)), codec ) @@ -1981,7 +2026,14 @@ RefinementC { return new RefinementType( name, (u): u is TypeOf => codec.is(u) && predicate(u), - (i, c) => chain(codec.validate(i, c), (a) => (predicate(a) ? success(a) : failure(a, c))), + (i, c) => { + const e = codec.validate(i, c) + if (isLeft(e)) { + return e + } + const a = e.right + return predicate(a) ? success(a) : failure(a, c) + }, codec.encode, codec, predicate diff --git a/test/2.1.x/record.ts b/test/2.1.x/record.ts index f925e8be1..e03581cc9 100644 --- a/test/2.1.x/record.ts +++ b/test/2.1.x/record.ts @@ -216,6 +216,7 @@ describe('record', () => { const T = t.record(t.literal('a'), t.string) assertSuccess(T.decode({ a: 'a' }), { a: 'a' }) assertSuccess(T.decode({ a: 'a', b: 1 }), { a: 'a' }) + assertFailure(T, null, ['Invalid value null supplied to : { [K in "a"]: string }']) assertFailure(T, {}, ['Invalid value undefined supplied to : { [K in "a"]: string }/a: string']) assertFailure(T, { a: 1 }, ['Invalid value 1 supplied to : { [K in "a"]: string }/a: string']) }) From 2aa88a861ed2dfbcbfb321128f69231c4c1481e4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 14 Jun 2020 17:37:59 +0200 Subject: [PATCH 043/222] fix type information lost from nested decoder types, closes #479 --- CHANGELOG.md | 7 +++++++ docs/modules/Decoder.ts.md | 6 ++++-- docs/modules/Eq.ts.md | 4 ++-- docs/modules/Guard.ts.md | 6 ++++-- docs/modules/JsonCodec.ts.md | 6 ++++-- docs/modules/JsonEncoder.ts.md | 12 ++++++++---- docs/modules/Schemable.ts.md | 8 ++++---- docs/modules/Type.ts.md | 4 ++-- dtslint/ts3.5/Codec.ts | 17 +++++++++++++++++ dtslint/ts3.5/Decoder.ts | 17 +++++++++++++++++ dtslint/ts3.5/{Econder.ts => Encoder.ts} | 11 +++++------ dtslint/ts3.5/Eq.ts | 17 +++++++++++++++++ dtslint/ts3.5/Guard.ts | 17 +++++++++++++++++ dtslint/ts3.5/JsonCodec.ts | 17 +++++++++++++++++ dtslint/ts3.5/JsonEncoder.ts | 17 +++++++++++++++++ dtslint/ts3.5/Schema.ts | 9 ++++----- dtslint/ts3.5/Type.ts | 17 +++++++++++++++++ package.json | 2 +- src/Codec.ts | 4 +++- src/Decoder.ts | 4 ++-- src/Eq.ts | 4 ++-- src/Guard.ts | 4 ++-- src/JsonCodec.ts | 8 ++++++-- src/JsonEncoder.ts | 22 +++++++++++++--------- src/Schemable.ts | 8 ++++---- src/Type.ts | 4 ++-- 26 files changed, 198 insertions(+), 54 deletions(-) create mode 100644 dtslint/ts3.5/Codec.ts create mode 100644 dtslint/ts3.5/Decoder.ts rename dtslint/ts3.5/{Econder.ts => Encoder.ts} (76%) create mode 100644 dtslint/ts3.5/Eq.ts create mode 100644 dtslint/ts3.5/Guard.ts create mode 100644 dtslint/ts3.5/JsonCodec.ts create mode 100644 dtslint/ts3.5/JsonEncoder.ts create mode 100644 dtslint/ts3.5/Type.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index aad54cbe8..c108d1d15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,13 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.5 + +- **Experimental** + - fix type information lost from nested decoder types, #479 (@gcanti) + - `JsonEncoder` + - change `id` signature (@gcanti) + # 2.2.4 - **Polish** diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index cd173c53a..07ac5ea0f 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -298,7 +298,9 @@ Added in v2.2.0 **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Decoder }): Decoder> +export declare function partial( + properties: { [K in keyof A]: Decoder } +): Decoder> ``` Added in v2.2.0 @@ -399,7 +401,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Decoder }): Decoder +export declare function type(properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> ``` Added in v2.2.0 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index ee6152dd9..5ab857396 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -137,7 +137,7 @@ Added in v2.2.2 **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Eq }): Eq> +export declare function partial(properties: { [K in keyof A]: Eq }): Eq> ``` Added in v2.2.2 @@ -197,7 +197,7 @@ Added in v2.2.2 **Signature** ```ts -export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq +export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K in keyof A]: A[K] }> ``` Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index bc11d2561..dcc9181f0 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -185,7 +185,9 @@ Added in v2.2.0 **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Guard }): Guard> +export declare function partial( + properties: { [K in keyof A]: Guard } +): Guard> ``` Added in v2.2.0 @@ -262,7 +264,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Guard }): Guard +export declare function type(properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> ``` Added in v2.2.0 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 843f758a7..85168f4f3 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -188,7 +188,9 @@ Added in v2.2.3 **Signature** ```ts -export declare const partial: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec> +export declare const partial: ( + properties: { [K in keyof A]: JsonCodec } +) => JsonCodec> ``` Added in v2.2.3 @@ -266,7 +268,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec +export declare const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 8bb30632e..aba7714db 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -142,10 +142,10 @@ Added in v2.2.3 **Signature** ```ts -export declare const id: JsonEncoder +export declare function id(): JsonEncoder ``` -Added in v2.2.3 +Added in v2.2.5 # intersection @@ -182,7 +182,9 @@ Added in v2.2.3 **Signature** ```ts -export declare const partial: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder> +export declare const partial: ( + properties: { [K in keyof A]: JsonEncoder } +) => JsonEncoder> ``` Added in v2.2.3 @@ -236,7 +238,9 @@ Added in v2.2.3 **Signature** ```ts -export declare const type: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder +export declare const type: ( + properties: { [K in keyof A]: JsonEncoder } +) => JsonEncoder<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 160adb010..cf95b9e54 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -37,8 +37,8 @@ export interface Schemable { readonly number: HKT readonly boolean: HKT readonly nullable: (or: HKT) => HKT - readonly type: (properties: { [K in keyof A]: HKT }) => HKT - readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> + readonly type: (properties: { [K in keyof A]: HKT }) => HKT + readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> readonly record: (codomain: HKT) => HKT> readonly array: (items: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT @@ -62,8 +62,8 @@ export interface Schemable1 { readonly number: Kind readonly boolean: Kind readonly nullable: (or: Kind) => Kind - readonly type: (properties: { [K in keyof A]: Kind }) => Kind - readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> + readonly type: (properties: { [K in keyof A]: Kind }) => Kind + readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> readonly record: (codomain: Kind) => Kind> readonly array: (items: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index c6ce56634..1b801bb55 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -161,7 +161,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Type }): Type> +export declare function partial(properties: { [K in keyof A]: Type }): Type> ``` Added in v2.2.3 @@ -238,7 +238,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Type }): Type +export declare function type(properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 diff --git a/dtslint/ts3.5/Codec.ts b/dtslint/ts3.5/Codec.ts new file mode 100644 index 000000000..c978244df --- /dev/null +++ b/dtslint/ts3.5/Codec.ts @@ -0,0 +1,17 @@ +import * as _ from '../../src/Codec' + +// $ExpectType Codec<{ a: string; b: { c: number; }; }, { a: string; b: { c: number; }; }> +_.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType Codec; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts new file mode 100644 index 000000000..7fefac185 --- /dev/null +++ b/dtslint/ts3.5/Decoder.ts @@ -0,0 +1,17 @@ +import * as _ from '../../src/Decoder' + +// $ExpectType Decoder<{ a: string; b: { c: number; }; }> +_.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType Decoder; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) diff --git a/dtslint/ts3.5/Econder.ts b/dtslint/ts3.5/Encoder.ts similarity index 76% rename from dtslint/ts3.5/Econder.ts rename to dtslint/ts3.5/Encoder.ts index 58fc90377..43c2c829a 100644 --- a/dtslint/ts3.5/Econder.ts +++ b/dtslint/ts3.5/Encoder.ts @@ -1,5 +1,4 @@ import * as E from '../../src/Encoder' -import { identity } from 'fp-ts/lib/function' const NumberToString: E.Encoder = { encode: String @@ -9,17 +8,17 @@ const BooleanToNumber: E.Encoder = { encode: (b) => (b ? 1 : 0) } -export const Person = E.type({ name: E.categoryEncoder.id(), age: NumberToString }) +export const OfTest = E.type({ a: E.id(), b: E.type({ c: NumberToString }) }) // // TypeOf // -export type Person = E.TypeOf // $ExpectType { name: string; age: number; } +export type OfTest = E.TypeOf // $ExpectType { a: string; b: { c: number; }; } // // OutputOf // -export type PersonOut = E.OutputOf // $ExpectType { name: string; age: string; } +export type OfTestOutput = E.OutputOf // $ExpectType { a: string; b: { c: string; }; } // // nullable @@ -29,12 +28,12 @@ E.nullable(NumberToString) // $ExpectType Encoder // // type // -E.type({ a: NumberToString }) // $ExpectType Encoder<{ a: string; }, { a: number; }> +E.type({ a: E.type({ b: NumberToString }) }) // $ExpectType Encoder<{ a: { b: string; }; }, { a: { b: number; }; }> // // partial // -E.partial({ a: NumberToString }) // $ExpectType Encoder, Partial<{ a: number; }>> +E.partial({ a: E.partial({ b: NumberToString }) }) // $ExpectType Encoder; }>, Partial<{ a: Partial<{ b: number; }>; }>> // // record diff --git a/dtslint/ts3.5/Eq.ts b/dtslint/ts3.5/Eq.ts new file mode 100644 index 000000000..f41f379ac --- /dev/null +++ b/dtslint/ts3.5/Eq.ts @@ -0,0 +1,17 @@ +import * as _ from '../../src/Eq' + +// $ExpectType Eq<{ a: string; b: { c: number; }; }> +_.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType Eq; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) diff --git a/dtslint/ts3.5/Guard.ts b/dtslint/ts3.5/Guard.ts new file mode 100644 index 000000000..1f78f6b1c --- /dev/null +++ b/dtslint/ts3.5/Guard.ts @@ -0,0 +1,17 @@ +import * as _ from '../../src/Guard' + +// $ExpectType Guard<{ a: string; b: { c: number; }; }> +_.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType Guard; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) diff --git a/dtslint/ts3.5/JsonCodec.ts b/dtslint/ts3.5/JsonCodec.ts new file mode 100644 index 000000000..b07200189 --- /dev/null +++ b/dtslint/ts3.5/JsonCodec.ts @@ -0,0 +1,17 @@ +import * as _ from '../../src/JsonCodec' + +// $ExpectType JsonCodec<{ a: string; b: { c: number; }; }> +_.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType JsonCodec; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) diff --git a/dtslint/ts3.5/JsonEncoder.ts b/dtslint/ts3.5/JsonEncoder.ts new file mode 100644 index 000000000..1ef67cab2 --- /dev/null +++ b/dtslint/ts3.5/JsonEncoder.ts @@ -0,0 +1,17 @@ +import * as _ from '../../src/JsonEncoder' + +// $ExpectType JsonEncoder<{ a: string; b: { c: number; }; }> +_.type({ + a: _.id(), + b: _.type({ + c: _.id() + }) +}) + +// $ExpectType JsonEncoder; }>> +_.partial({ + a: _.id(), + b: _.partial({ + c: _.id() + }) +}) diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index cc611935d..4725e72e4 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -1,4 +1,3 @@ -import * as D from '../../src/Decoder' import { Schemable, WithUnknownContainers, memoize, WithRefinement, WithUnion } from '../../src/Schemable' import { HKT } from 'fp-ts/lib/HKT' @@ -15,8 +14,8 @@ function make(f: Schema): Schema { // // TypeOf // -export const Person = make((S) => S.type({ name: S.string, age: S.number })) -export type Person = TypeOf // $ExpectType { name: string; age: number; } +export const OfTest = make((S) => S.type({ a: S.string, b: S.type({ c: S.number }) })) +export type OfTest = TypeOf // $ExpectType { a: string; b: { c: number; }; } // // literal @@ -46,12 +45,12 @@ make((S) => S.nullable(S.string)) // $ExpectType Schema // // type // -make((S) => S.type({ a: S.string })) // $ExpectType Schema<{ a: string; }> +make((S) => S.type({ a: S.string, b: S.type({ c: S.number }) })) // $ExpectType Schema<{ a: string; b: { c: number; }; }> // // partial // -make((S) => S.partial({ a: S.string })) // $ExpectType Schema> +make((S) => S.partial({ a: S.string, b: S.partial({ c: S.number }) })) // $ExpectType Schema; }>> // // record diff --git a/dtslint/ts3.5/Type.ts b/dtslint/ts3.5/Type.ts new file mode 100644 index 000000000..cf7aec6f3 --- /dev/null +++ b/dtslint/ts3.5/Type.ts @@ -0,0 +1,17 @@ +import * as _ from '../../src/Type' + +// $ExpectType Type<{ a: string; b: { c: number; }; }> +_.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType Type; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) diff --git a/package.json b/package.json index 859c850e8..2d2aa3e45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.4", + "version": "2.2.5", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", diff --git a/src/Codec.ts b/src/Codec.ts index 330dfe995..1dcd712e2 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -139,7 +139,9 @@ export function type

>>( export function partial

>>( properties: P ): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> { - return make(D.partial(properties), E.partial(properties)) + // these tow `any`s are required to make typescript@3.5 compile + // vvvvvv vvvvvv + return make(D.partial(properties as any), E.partial(properties)) as any } /** diff --git a/src/Decoder.ts b/src/Decoder.ts index a2da8727b..7a74c4843 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -204,7 +204,7 @@ export function nullable(or: Decoder): Decoder { /** * @since 2.2.0 */ -export function type(properties: { [K in keyof A]: Decoder }): Decoder { +export function type(properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> { return { decode: (u) => { const e = UnknownRecord.decode(u) @@ -231,7 +231,7 @@ export function type(properties: { [K in keyof A]: Decoder }): Decoder< /** * @since 2.2.0 */ -export function partial(properties: { [K in keyof A]: Decoder }): Decoder> { +export function partial(properties: { [K in keyof A]: Decoder }): Decoder> { return { decode: (u) => { const e = UnknownRecord.decode(u) diff --git a/src/Eq.ts b/src/Eq.ts index 05fa45a2e..8ad005060 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -74,12 +74,12 @@ export function nullable(or: Eq): Eq { /** * @since 2.2.2 */ -export const type: (eqs: { [K in keyof A]: Eq }) => Eq = E.getStructEq +export const type: (eqs: { [K in keyof A]: Eq }) => Eq<{ [K in keyof A]: A[K] }> = E.getStructEq /** * @since 2.2.2 */ -export function partial(properties: { [K in keyof A]: Eq }): Eq> { +export function partial(properties: { [K in keyof A]: Eq }): Eq> { return { equals: (x, y) => { for (const k in properties) { diff --git a/src/Guard.ts b/src/Guard.ts index 8c5fd7dbf..f7b24d46c 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -103,7 +103,7 @@ export function nullable(or: Guard): Guard { /** * @since 2.2.0 */ -export function type(properties: { [K in keyof A]: Guard }): Guard { +export function type(properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> { return refinement(UnknownRecord, (r): r is { [K in keyof A]: A[K] } => { @@ -119,7 +119,7 @@ export function type(properties: { [K in keyof A]: Guard }): Guard { /** * @since 2.2.0 */ -export function partial(properties: { [K in keyof A]: Guard }): Guard> { +export function partial(properties: { [K in keyof A]: Guard }): Guard> { return refinement(UnknownRecord, (r): r is Partial => { for (const k in properties) { const v = r[k] diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 8f94fd6d8..e191a4d94 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -88,12 +88,16 @@ export const nullable: (or: JsonCodec) => JsonCodec = C.nullable /** * @since 2.2.3 */ -export const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec = C.type as any +export const type: ( + properties: { [K in keyof A]: JsonCodec } +) => JsonCodec<{ [K in keyof A]: A[K] }> = C.type as any /** * @since 2.2.3 */ -export const partial: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec> = C.partial as any +export const partial: ( + properties: { [K in keyof A]: JsonCodec } +) => JsonCodec> = C.partial as any /** * @since 2.2.3 diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index c0041d198..e6f049fec 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -42,10 +42,12 @@ export type TypeOf = E.TypeOf // ------------------------------------------------------------------------------------- /** - * @since 2.2.3 + * @since 2.2.5 */ -export const id: JsonEncoder = { - encode: identity +export function id(): JsonEncoder { + return { + encode: identity + } } // ------------------------------------------------------------------------------------- @@ -60,14 +62,16 @@ export const nullable: (or: JsonEncoder) => JsonEncoder = E.null /** * @since 2.2.3 */ -export const type: (properties: { [K in keyof A]: JsonEncoder }) => JsonEncoder = E.type as any +export const type: ( + properties: { [K in keyof A]: JsonEncoder } +) => JsonEncoder<{ [K in keyof A]: A[K] }> = E.type as any /** * @since 2.2.3 */ export const partial: ( properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder> = E.partial as any +) => JsonEncoder> = E.partial as any /** * @since 2.2.3 @@ -145,10 +149,10 @@ export const contravariantJsonEncoder: Contravariant1 = { */ export const schemableJsonEncoder: Schemable1 = { URI, - literal: () => id, - string: id, - number: id, - boolean: id, + literal: () => id(), + string: id(), + number: id(), + boolean: id(), nullable, type, partial, diff --git a/src/Schemable.ts b/src/Schemable.ts index 2f374e751..20796e754 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -18,8 +18,8 @@ export interface Schemable { readonly number: HKT readonly boolean: HKT readonly nullable: (or: HKT) => HKT - readonly type: (properties: { [K in keyof A]: HKT }) => HKT - readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> + readonly type: (properties: { [K in keyof A]: HKT }) => HKT + readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> readonly record: (codomain: HKT) => HKT> readonly array: (items: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT @@ -38,8 +38,8 @@ export interface Schemable1 { readonly number: Kind readonly boolean: Kind readonly nullable: (or: Kind) => Kind - readonly type: (properties: { [K in keyof A]: Kind }) => Kind - readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> + readonly type: (properties: { [K in keyof A]: Kind }) => Kind + readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> readonly record: (codomain: Kind) => Kind> readonly array: (items: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind diff --git a/src/Type.ts b/src/Type.ts index 24e720838..9c4bf8862 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -75,14 +75,14 @@ export function nullable(or: Type): Type { /** * @since 2.2.3 */ -export function type(properties: { [K in keyof A]: Type }): Type { +export function type(properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> { return t.type(properties) as any } /** * @since 2.2.3 */ -export function partial(properties: { [K in keyof A]: Type }): Type> { +export function partial(properties: { [K in keyof A]: Type }): Type> { return t.partial(properties) } From baca458749951a57027e080b2fcb6e2af175666b Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 15 Jun 2020 08:29:49 +0200 Subject: [PATCH 044/222] upgrade to latest docs-ts --- docs/modules/Codec.ts.md | 217 ++-- docs/modules/Decoder.ts.md | 291 +++-- docs/modules/Encoder.ts.md | 157 ++- docs/modules/Eq.ts.md | 124 +- docs/modules/Guard.ts.md | 192 +-- docs/modules/JsonCodec.ts.md | 197 +-- docs/modules/JsonEncoder.ts.md | 164 +-- docs/modules/PathReporter.ts.md | 17 +- docs/modules/Reporter.ts.md | 9 +- docs/modules/Schema.ts.md | 43 +- docs/modules/Schemable.ts.md | 63 +- docs/modules/Tree.ts.md | 9 +- docs/modules/Type.ts.md | 161 +-- docs/modules/index.ts.md | 2161 ++++++++++++++++--------------- package-lock.json | 133 +- package.json | 2 +- src/Codec.ts | 30 +- src/Decoder.ts | 49 +- src/Encoder.ts | 21 + src/Eq.ts | 19 + src/Guard.ts | 26 + src/JsonCodec.ts | 26 + src/JsonEncoder.ts | 23 + src/Schema.ts | 22 +- src/ThrowReporter.ts | 1 + src/Type.ts | 21 + src/index.ts | 110 +- 27 files changed, 2365 insertions(+), 1923 deletions(-) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index eccdb94d7..0c352a7d5 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -4,7 +4,7 @@ nav_order: 1 parent: Modules --- -# Codec overview +## Codec overview Added in v2.2.3 @@ -12,311 +12,332 @@ Added in v2.2.3

Table of contents

-- [Codec (interface)](#codec-interface) -- [OutputOf (type alias)](#outputof-type-alias) -- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [UnknownArray](#unknownarray) -- [UnknownRecord](#unknownrecord) -- [array](#array) -- [boolean](#boolean) -- [fromDecoder](#fromdecoder) -- [imap](#imap) -- [intersection](#intersection) -- [invariantCodec](#invariantcodec) -- [lazy](#lazy) -- [literal](#literal) -- [make](#make) -- [nullable](#nullable) -- [number](#number) -- [partial](#partial) -- [record](#record) -- [refinement](#refinement) -- [string](#string) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) -- [withExpected](#withexpected) +- [Invariant](#invariant) + - [imap](#imap) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [partial](#partial) + - [record](#record) + - [refinement](#refinement) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [withExpected](#withexpected) +- [constructors](#constructors) + - [fromDecoder](#fromdecoder) + - [literal](#literal) + - [make](#make) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [invariantCodec](#invariantcodec) +- [model](#model) + - [Codec (interface)](#codec-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [OutputOf (type alias)](#outputof-type-alias) + - [TypeOf (type alias)](#typeof-type-alias) --- -# Codec (interface) +# Invariant -Laws: - -1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` -2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` +## imap **Signature** ```ts -export interface Codec extends D.Decoder, E.Encoder {} +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec ``` Added in v2.2.3 -# OutputOf (type alias) +# combinators + +## array **Signature** ```ts -export type OutputOf = E.OutputOf +export declare function array(items: Codec): Codec, Array> ``` Added in v2.2.3 -# TypeOf (type alias) +## intersection **Signature** ```ts -export type TypeOf = E.TypeOf +export declare function intersection(left: Codec, right: Codec): Codec ``` Added in v2.2.3 -# URI (type alias) +## lazy **Signature** ```ts -export type URI = typeof URI +export declare function lazy(id: string, f: () => Codec): Codec ``` Added in v2.2.3 -# URI +## nullable **Signature** ```ts -export declare const URI: 'io-ts/Codec' +export declare function nullable(or: Codec): Codec ``` Added in v2.2.3 -# UnknownArray +## partial **Signature** ```ts -export declare const UnknownArray: Codec +export declare function partial

>>( + properties: P +): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> ``` Added in v2.2.3 -# UnknownRecord +## record **Signature** ```ts -export declare const UnknownRecord: Codec, Record> +export declare function record(codomain: Codec): Codec, Record> ``` Added in v2.2.3 -# array +## refinement **Signature** ```ts -export declare function array(items: Codec): Codec, Array> +export declare function refinement( + from: Codec, + refinement: (a: A) => a is B, + expected: string +): Codec ``` Added in v2.2.3 -# boolean +## sum **Signature** ```ts -export declare const boolean: Codec +export declare function sum( + tag: T +): >>(members: M) => Codec, TypeOf> ``` Added in v2.2.3 -# fromDecoder +## tuple **Signature** ```ts -export declare function fromDecoder(decoder: D.Decoder): Codec +export declare function tuple>>( + ...components: C +): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> ``` Added in v2.2.3 -# imap +## type **Signature** ```ts -export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec +export declare function type

>>( + properties: P +): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> ``` Added in v2.2.3 -# intersection +## withExpected **Signature** ```ts -export declare function intersection(left: Codec, right: Codec): Codec +export declare function withExpected( + codec: Codec, + expected: (actual: unknown, e: D.DecodeError) => D.DecodeError +): Codec ``` Added in v2.2.3 -# invariantCodec +# constructors + +## fromDecoder **Signature** ```ts -export declare const invariantCodec: Invariant2<'io-ts/Codec'> +export declare function fromDecoder(decoder: D.Decoder): Codec ``` Added in v2.2.3 -# lazy +## literal **Signature** ```ts -export declare function lazy(id: string, f: () => Codec): Codec +export declare function literal>(...values: A): Codec ``` Added in v2.2.3 -# literal +## make **Signature** ```ts -export declare function literal>(...values: A): Codec +export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec ``` Added in v2.2.3 -# make +# instances + +## URI **Signature** ```ts -export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec +export declare const URI: 'io-ts/Codec' ``` Added in v2.2.3 -# nullable +## URI (type alias) **Signature** ```ts -export declare function nullable(or: Codec): Codec +export type URI = typeof URI ``` Added in v2.2.3 -# number +## invariantCodec **Signature** ```ts -export declare const number: Codec +export declare const invariantCodec: Invariant2<'io-ts/Codec'> ``` Added in v2.2.3 -# partial +# model + +## Codec (interface) + +Laws: + +1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` +2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` **Signature** ```ts -export declare function partial

>>( - properties: P -): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> +export interface Codec extends D.Decoder, E.Encoder {} ``` Added in v2.2.3 -# record +# primitives + +## UnknownArray **Signature** ```ts -export declare function record(codomain: Codec): Codec, Record> +export declare const UnknownArray: Codec ``` Added in v2.2.3 -# refinement +## UnknownRecord **Signature** ```ts -export declare function refinement( - from: Codec, - refinement: (a: A) => a is B, - expected: string -): Codec +export declare const UnknownRecord: Codec, Record> ``` Added in v2.2.3 -# string +## boolean **Signature** ```ts -export declare const string: Codec +export declare const boolean: Codec ``` Added in v2.2.3 -# sum +## number **Signature** ```ts -export declare function sum( - tag: T -): >>(members: M) => Codec, TypeOf> +export declare const number: Codec ``` Added in v2.2.3 -# tuple +## string **Signature** ```ts -export declare function tuple>>( - ...components: C -): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> +export declare const string: Codec ``` Added in v2.2.3 -# type +# utils + +## OutputOf (type alias) **Signature** ```ts -export declare function type

>>( - properties: P -): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +export type OutputOf = E.OutputOf ``` Added in v2.2.3 -# withExpected +## TypeOf (type alias) **Signature** ```ts -export declare function withExpected( - codec: Codec, - expected: (actual: unknown, e: D.DecodeError) => D.DecodeError -): Codec +export type TypeOf = E.TypeOf ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 07ac5ea0f..b22247d0a 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -4,7 +4,7 @@ nav_order: 2 parent: Modules --- -# Decoder overview +## Decoder overview Added in v2.2.0 @@ -12,268 +12,300 @@ Added in v2.2.0

Table of contents

-- [DecodeError (interface)](#decodeerror-interface) -- [Decoder (interface)](#decoder-interface) -- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [UnknownArray](#unknownarray) -- [UnknownRecord](#unknownrecord) -- [alt](#alt) -- [altDecoder](#altdecoder) -- [array](#array) -- [boolean](#boolean) -- [failure](#failure) -- [fromGuard](#fromguard) -- [functorDecoder](#functordecoder) -- [intersection](#intersection) -- [isNotEmpty](#isnotempty) -- [lazy](#lazy) -- [literal](#literal) -- [map](#map) -- [never](#never) -- [nullable](#nullable) -- [number](#number) -- [of](#of) -- [parse](#parse) -- [partial](#partial) -- [record](#record) -- [refinement](#refinement) -- [schemableDecoder](#schemabledecoder) -- [string](#string) -- [success](#success) -- [sum](#sum) -- [tree](#tree) -- [tuple](#tuple) -- [type](#type) -- [union](#union) -- [withExpected](#withexpected) +- [Alt](#alt) + - [alt](#alt) +- [DecodeError](#decodeerror) + - [DecodeError (interface)](#decodeerror-interface) + - [failure](#failure) + - [isNotEmpty](#isnotempty) + - [success](#success) + - [tree](#tree) +- [Functor](#functor) + - [map](#map) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [parse](#parse) + - [partial](#partial) + - [record](#record) + - [refinement](#refinement) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) + - [withExpected](#withexpected) +- [constructors](#constructors) + - [fromGuard](#fromguard) + - [literal](#literal) + - [of](#of) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [altDecoder](#altdecoder) + - [functorDecoder](#functordecoder) + - [schemableDecoder](#schemabledecoder) +- [model](#model) + - [Decoder (interface)](#decoder-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [never](#never) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) --- -# DecodeError (interface) +# Alt + +## alt **Signature** ```ts -export interface DecodeError extends NonEmptyArray> {} +export declare const alt: (that: () => Decoder) => (fa: Decoder) => Decoder ``` -Added in v2.2.2 +Added in v2.2.0 + +# DecodeError -# Decoder (interface) +## DecodeError (interface) **Signature** ```ts -export interface Decoder { - readonly decode: (u: unknown) => Either -} +export interface DecodeError extends NonEmptyArray> {} ``` -Added in v2.2.0 +Added in v2.2.2 -# TypeOf (type alias) +## failure **Signature** ```ts -export type TypeOf = D extends Decoder ? A : never +export declare function failure(message: string): Either ``` Added in v2.2.0 -# URI (type alias) +## isNotEmpty **Signature** ```ts -export type URI = typeof URI +export declare function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray ``` -Added in v2.2.0 +Added in v2.2.2 -# URI +## success **Signature** ```ts -export declare const URI: 'io-ts/Decoder' +export declare function success(a: A): Either ``` Added in v2.2.0 -# UnknownArray +## tree **Signature** ```ts -export declare const UnknownArray: Decoder +export declare function tree(value: A, forest: Forest = empty): Tree ``` Added in v2.2.0 -# UnknownRecord +# Functor + +## map **Signature** ```ts -export declare const UnknownRecord: Decoder> +export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder ``` Added in v2.2.0 -# alt +# combinators + +## array **Signature** ```ts -export declare const alt: (that: () => Decoder) => (fa: Decoder) => Decoder +export declare function array(items: Decoder): Decoder> ``` Added in v2.2.0 -# altDecoder +## intersection **Signature** ```ts -export declare const altDecoder: Alt1<'io-ts/Decoder'> +export declare function intersection(left: Decoder, right: Decoder): Decoder ``` -Added in v2.2.3 +Added in v2.2.0 -# array +## lazy **Signature** ```ts -export declare function array(items: Decoder): Decoder> +export declare function lazy(id: string, f: () => Decoder): Decoder ``` Added in v2.2.0 -# boolean +## nullable **Signature** ```ts -export declare const boolean: Decoder +export declare function nullable(or: Decoder): Decoder ``` Added in v2.2.0 -# failure +## parse **Signature** ```ts -export declare function failure(message: string): Either +export declare function parse(from: Decoder, parser: (a: A) => Either): Decoder ``` Added in v2.2.0 -# fromGuard +## partial **Signature** ```ts -export declare function fromGuard(guard: G.Guard, expected: string): Decoder +export declare function partial( + properties: { [K in keyof A]: Decoder } +): Decoder> ``` Added in v2.2.0 -# functorDecoder +## record **Signature** ```ts -export declare const functorDecoder: Functor1<'io-ts/Decoder'> +export declare function record(codomain: Decoder): Decoder> ``` -Added in v2.2.3 +Added in v2.2.0 -# intersection +## refinement **Signature** ```ts -export declare function intersection(left: Decoder, right: Decoder): Decoder +export declare function refinement( + from: Decoder, + refinement: (a: A) => a is B, + expected: string +): Decoder ``` Added in v2.2.0 -# isNotEmpty +## sum **Signature** ```ts -export declare function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray +export declare function sum( + tag: T +): (members: { [K in keyof A]: Decoder }) => Decoder ``` -Added in v2.2.2 +Added in v2.2.0 -# lazy +## tuple **Signature** ```ts -export declare function lazy(id: string, f: () => Decoder): Decoder +export declare function tuple>( + ...components: { [K in keyof A]: Decoder } +): Decoder ``` Added in v2.2.0 -# literal +## type **Signature** ```ts -export declare function literal>(...values: A): Decoder +export declare function type(properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> ``` Added in v2.2.0 -# map +## union **Signature** ```ts -export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder +export declare function union>( + ...members: { [K in keyof A]: Decoder } +): Decoder ``` Added in v2.2.0 -# never +## withExpected **Signature** ```ts -export declare const never: Decoder +export declare function withExpected( + decoder: Decoder, + expected: (actual: unknown, e: DecodeError) => DecodeError +): Decoder ``` Added in v2.2.0 -# nullable +# constructors + +## fromGuard **Signature** ```ts -export declare function nullable(or: Decoder): Decoder +export declare function fromGuard(guard: G.Guard, expected: string): Decoder ``` Added in v2.2.0 -# number +## literal **Signature** ```ts -export declare const number: Decoder +export declare function literal>(...values: A): Decoder ``` Added in v2.2.0 -# of +## of **Signature** @@ -283,53 +315,49 @@ export declare function of(a: A): Decoder Added in v2.2.3 -# parse +# instances + +## URI **Signature** ```ts -export declare function parse(from: Decoder, parser: (a: A) => Either): Decoder +export declare const URI: 'io-ts/Decoder' ``` Added in v2.2.0 -# partial +## URI (type alias) **Signature** ```ts -export declare function partial( - properties: { [K in keyof A]: Decoder } -): Decoder> +export type URI = typeof URI ``` Added in v2.2.0 -# record +## altDecoder **Signature** ```ts -export declare function record(codomain: Decoder): Decoder> +export declare const altDecoder: Alt1<'io-ts/Decoder'> ``` -Added in v2.2.0 +Added in v2.2.3 -# refinement +## functorDecoder **Signature** ```ts -export declare function refinement( - from: Decoder, - refinement: (a: A) => a is B, - expected: string -): Decoder +export declare const functorDecoder: Functor1<'io-ts/Decoder'> ``` -Added in v2.2.0 +Added in v2.2.3 -# schemableDecoder +## schemableDecoder **Signature** @@ -342,91 +370,90 @@ export declare const schemableDecoder: Schemable1<'io-ts/Decoder'> & Added in v2.2.3 -# string +# model + +## Decoder (interface) **Signature** ```ts -export declare const string: Decoder +export interface Decoder { + readonly decode: (u: unknown) => Either +} ``` Added in v2.2.0 -# success +# primitives + +## UnknownArray **Signature** ```ts -export declare function success(a: A): Either +export declare const UnknownArray: Decoder ``` Added in v2.2.0 -# sum +## UnknownRecord **Signature** ```ts -export declare function sum( - tag: T -): (members: { [K in keyof A]: Decoder }) => Decoder +export declare const UnknownRecord: Decoder> ``` Added in v2.2.0 -# tree +## boolean **Signature** ```ts -export declare function tree(value: A, forest: Forest = empty): Tree +export declare const boolean: Decoder ``` Added in v2.2.0 -# tuple +## never **Signature** ```ts -export declare function tuple>( - ...components: { [K in keyof A]: Decoder } -): Decoder +export declare const never: Decoder ``` Added in v2.2.0 -# type +## number **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> +export declare const number: Decoder ``` Added in v2.2.0 -# union +## string **Signature** ```ts -export declare function union>( - ...members: { [K in keyof A]: Decoder } -): Decoder +export declare const string: Decoder ``` Added in v2.2.0 -# withExpected +# utils + +## TypeOf (type alias) **Signature** ```ts -export declare function withExpected( - decoder: Decoder, - expected: (actual: unknown, e: DecodeError) => DecodeError -): Decoder +export type TypeOf = D extends Decoder ? A : never ``` Added in v2.2.0 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 0c79914df..cd256ba27 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -4,7 +4,7 @@ nav_order: 3 parent: Modules --- -# Encoder overview +## Encoder overview Added in v2.2.3 @@ -12,224 +12,245 @@ Added in v2.2.3

Table of contents

-- [Encoder (interface)](#encoder-interface) -- [OutputOf (type alias)](#outputof-type-alias) -- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [array](#array) -- [categoryEncoder](#categoryencoder) -- [compose](#compose) -- [contramap](#contramap) -- [contravariantEncoder](#contravariantencoder) -- [id](#id) -- [intersection](#intersection) -- [lazy](#lazy) -- [nullable](#nullable) -- [partial](#partial) -- [record](#record) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) +- [Contravariant](#contravariant) + - [contramap](#contramap) +- [Semigroupoid](#semigroupoid) + - [compose](#compose) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [partial](#partial) + - [record](#record) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) +- [constructors](#constructors) + - [id](#id) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [categoryEncoder](#categoryencoder) + - [contravariantEncoder](#contravariantencoder) +- [model](#model) + - [Encoder (interface)](#encoder-interface) +- [utils](#utils) + - [OutputOf (type alias)](#outputof-type-alias) + - [TypeOf (type alias)](#typeof-type-alias) --- -# Encoder (interface) +# Contravariant + +## contramap **Signature** ```ts -export interface Encoder { - readonly encode: (a: A) => O -} +export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder ``` Added in v2.2.3 -# OutputOf (type alias) +# Semigroupoid + +## compose **Signature** ```ts -export type OutputOf = E extends Encoder ? O : never +export declare const compose: (ea: Encoder) => (ab: Encoder) => Encoder ``` Added in v2.2.3 -# TypeOf (type alias) +# combinators + +## array **Signature** ```ts -export type TypeOf = E extends Encoder ? A : never +export declare function array(items: Encoder): Encoder, Array
> ``` Added in v2.2.3 -# URI (type alias) +## intersection **Signature** ```ts -export type URI = typeof URI +export declare function intersection(left: Encoder, right: Encoder): Encoder ``` Added in v2.2.3 -# URI +## lazy **Signature** ```ts -export declare const URI: 'io-ts/Encoder' +export declare function lazy(f: () => Encoder): Encoder ``` Added in v2.2.3 -# array +## nullable **Signature** ```ts -export declare function array(items: Encoder): Encoder, Array> +export declare function nullable(or: Encoder): Encoder ``` Added in v2.2.3 -# categoryEncoder +## partial **Signature** ```ts -export declare const categoryEncoder: Category2<'io-ts/Encoder'> +export declare function partial

>>( + properties: P +): Encoder }>, Partial<{ [K in keyof P]: TypeOf }>> ``` Added in v2.2.3 -# compose +## record **Signature** ```ts -export declare const compose: (ea: Encoder) => (ab: Encoder) => Encoder +export declare function record(codomain: Encoder): Encoder, Record> ``` Added in v2.2.3 -# contramap +## sum **Signature** ```ts -export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder +export declare function sum( + tag: T +): >>(members: M) => Encoder, TypeOf> ``` Added in v2.2.3 -# contravariantEncoder +## tuple **Signature** ```ts -export declare const contravariantEncoder: Contravariant2<'io-ts/Encoder'> +export declare function tuple>>( + ...components: C +): Encoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> ``` Added in v2.2.3 -# id +## type **Signature** ```ts -export declare function id(): Encoder +export declare function type

>>( + properties: P +): Encoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> ``` Added in v2.2.3 -# intersection +# constructors + +## id **Signature** ```ts -export declare function intersection(left: Encoder, right: Encoder): Encoder +export declare function id(): Encoder ``` Added in v2.2.3 -# lazy +# instances + +## URI **Signature** ```ts -export declare function lazy(f: () => Encoder): Encoder +export declare const URI: 'io-ts/Encoder' ``` Added in v2.2.3 -# nullable +## URI (type alias) **Signature** ```ts -export declare function nullable(or: Encoder): Encoder +export type URI = typeof URI ``` Added in v2.2.3 -# partial +## categoryEncoder **Signature** ```ts -export declare function partial

>>( - properties: P -): Encoder }>, Partial<{ [K in keyof P]: TypeOf }>> +export declare const categoryEncoder: Category2<'io-ts/Encoder'> ``` Added in v2.2.3 -# record +## contravariantEncoder **Signature** ```ts -export declare function record(codomain: Encoder): Encoder, Record> +export declare const contravariantEncoder: Contravariant2<'io-ts/Encoder'> ``` Added in v2.2.3 -# sum +# model + +## Encoder (interface) **Signature** ```ts -export declare function sum( - tag: T -): >>(members: M) => Encoder, TypeOf> +export interface Encoder { + readonly encode: (a: A) => O +} ``` Added in v2.2.3 -# tuple +# utils + +## OutputOf (type alias) **Signature** ```ts -export declare function tuple>>( - ...components: C -): Encoder<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> +export type OutputOf = E extends Encoder ? O : never ``` Added in v2.2.3 -# type +## TypeOf (type alias) **Signature** ```ts -export declare function type

>>( - properties: P -): Encoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +export type TypeOf = E extends Encoder ? A : never ``` Added in v2.2.3 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 5ab857396..3bc87ee98 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -4,7 +4,7 @@ nav_order: 4 parent: Modules --- -# Eq overview +## Eq overview Added in v2.2.2 @@ -12,192 +12,204 @@ Added in v2.2.2

Table of contents

-- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [UnknownArray](#unknownarray) -- [UnknownRecord](#unknownrecord) -- [array](#array) -- [boolean](#boolean) -- [intersection](#intersection) -- [lazy](#lazy) -- [nullable](#nullable) -- [number](#number) -- [partial](#partial) -- [record](#record) -- [schemableEq](#schemableeq) -- [string](#string) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [partial](#partial) + - [record](#record) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) +- [instances](#instances) + - [schemableEq](#schemableeq) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) + - [URI (type alias)](#uri-type-alias) --- -# TypeOf (type alias) +# combinators + +## array **Signature** ```ts -export type TypeOf = E extends Eq ? A : never +export declare const array: (eq: E.Eq) => E.Eq ``` Added in v2.2.2 -# URI (type alias) +## intersection **Signature** ```ts -export type URI = E.URI +export declare function intersection(left: Eq, right: Eq): Eq ``` -Added in v2.2.3 +Added in v2.2.2 -# UnknownArray +## lazy **Signature** ```ts -export declare const UnknownArray: E.Eq +export declare function lazy(f: () => Eq): Eq ``` Added in v2.2.2 -# UnknownRecord +## nullable **Signature** ```ts -export declare const UnknownRecord: E.Eq> +export declare function nullable(or: Eq): Eq ``` Added in v2.2.2 -# array +## partial **Signature** ```ts -export declare const array: (eq: E.Eq) => E.Eq +export declare function partial(properties: { [K in keyof A]: Eq }): Eq> ``` Added in v2.2.2 -# boolean +## record **Signature** ```ts -export declare const boolean: E.Eq +export declare const record: (codomain: E.Eq) => E.Eq> ``` Added in v2.2.2 -# intersection +## sum **Signature** ```ts -export declare function intersection(left: Eq, right: Eq): Eq +export declare function sum(tag: T): (members: { [K in keyof A]: Eq }) => Eq ``` Added in v2.2.2 -# lazy +## tuple **Signature** ```ts -export declare function lazy(f: () => Eq): Eq +export declare const tuple: (...components: { [K in keyof A]: E.Eq }) => E.Eq ``` Added in v2.2.2 -# nullable +## type **Signature** ```ts -export declare function nullable(or: Eq): Eq +export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K in keyof A]: A[K] }> ``` Added in v2.2.2 -# number +# instances + +## schemableEq **Signature** ```ts -export declare const number: E.Eq +export declare const schemableEq: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefinement1<'Eq'> ``` -Added in v2.2.2 +Added in v2.2.3 -# partial +# primitives + +## UnknownArray **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Eq }): Eq> +export declare const UnknownArray: E.Eq ``` Added in v2.2.2 -# record +## UnknownRecord **Signature** ```ts -export declare const record: (codomain: E.Eq) => E.Eq> +export declare const UnknownRecord: E.Eq> ``` Added in v2.2.2 -# schemableEq +## boolean **Signature** ```ts -export declare const schemableEq: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefinement1<'Eq'> +export declare const boolean: E.Eq ``` -Added in v2.2.3 +Added in v2.2.2 -# string +## number **Signature** ```ts -export declare const string: E.Eq +export declare const number: E.Eq ``` Added in v2.2.2 -# sum +## string **Signature** ```ts -export declare function sum(tag: T): (members: { [K in keyof A]: Eq }) => Eq +export declare const string: E.Eq ``` Added in v2.2.2 -# tuple +# utils + +## TypeOf (type alias) **Signature** ```ts -export declare const tuple: (...components: { [K in keyof A]: E.Eq }) => E.Eq +export type TypeOf = E extends Eq ? A : never ``` Added in v2.2.2 -# type +## URI (type alias) **Signature** ```ts -export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K in keyof A]: A[K] }> +export type URI = E.URI ``` -Added in v2.2.2 +Added in v2.2.3 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index dcc9181f0..7537b4c6c 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -4,7 +4,7 @@ nav_order: 5 parent: Modules --- -# Guard overview +## Guard overview Added in v2.2.0 @@ -12,271 +12,289 @@ Added in v2.2.0

Table of contents

-- [Guard (interface)](#guard-interface) -- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [UnknownArray](#unknownarray) -- [UnknownRecord](#unknownrecord) -- [array](#array) -- [boolean](#boolean) -- [intersection](#intersection) -- [lazy](#lazy) -- [literal](#literal) -- [never](#never) -- [nullable](#nullable) -- [number](#number) -- [partial](#partial) -- [record](#record) -- [refinement](#refinement) -- [schemableGuard](#schemableguard) -- [string](#string) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) -- [union](#union) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [partial](#partial) + - [record](#record) + - [refinement](#refinement) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [constructors](#constructors) + - [literal](#literal) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [schemableGuard](#schemableguard) +- [model](#model) + - [Guard (interface)](#guard-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [never](#never) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) --- -# Guard (interface) +# combinators + +## array **Signature** ```ts -export interface Guard
{ - is: (u: unknown) => u is A -} +export declare function array(items: Guard): Guard> ``` Added in v2.2.0 -# TypeOf (type alias) +## intersection **Signature** ```ts -export type TypeOf = G extends Guard ? A : never +export declare function intersection(left: Guard, right: Guard): Guard ``` -Added in v2.2.2 +Added in v2.2.0 -# URI (type alias) +## lazy **Signature** ```ts -export type URI = typeof URI +export declare function lazy(f: () => Guard): Guard ``` Added in v2.2.0 -# URI +## nullable **Signature** ```ts -export declare const URI: 'io-ts/Guard' +export declare function nullable(or: Guard): Guard ``` Added in v2.2.0 -# UnknownArray +## partial **Signature** ```ts -export declare const UnknownArray: Guard +export declare function partial( + properties: { [K in keyof A]: Guard } +): Guard> ``` Added in v2.2.0 -# UnknownRecord +## record **Signature** ```ts -export declare const UnknownRecord: Guard> +export declare function record(codomain: Guard): Guard> ``` Added in v2.2.0 -# array +## refinement **Signature** ```ts -export declare function array(items: Guard): Guard> +export declare function refinement(from: Guard, refinement: (a: A) => a is B): Guard ``` Added in v2.2.0 -# boolean +## sum **Signature** ```ts -export declare const boolean: Guard +export declare function sum( + tag: T +): (members: { [K in keyof A]: Guard }) => Guard ``` Added in v2.2.0 -# intersection +## tuple **Signature** ```ts -export declare function intersection(left: Guard, right: Guard): Guard +export declare function tuple>( + ...components: { [K in keyof A]: Guard } +): Guard ``` Added in v2.2.0 -# lazy +## type **Signature** ```ts -export declare function lazy(f: () => Guard): Guard +export declare function type(properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> ``` Added in v2.2.0 -# literal +## union **Signature** ```ts -export declare function literal>(...values: A): Guard +export declare function union>( + ...members: { [K in keyof A]: Guard } +): Guard ``` Added in v2.2.0 -# never +# constructors + +## literal **Signature** ```ts -export declare const never: Guard +export declare function literal>(...values: A): Guard ``` Added in v2.2.0 -# nullable +# instances + +## URI **Signature** ```ts -export declare function nullable(or: Guard): Guard +export declare const URI: 'io-ts/Guard' ``` Added in v2.2.0 -# number +## URI (type alias) **Signature** ```ts -export declare const number: Guard +export type URI = typeof URI ``` Added in v2.2.0 -# partial +## schemableGuard **Signature** ```ts -export declare function partial( - properties: { [K in keyof A]: Guard } -): Guard> +export declare const schemableGuard: Schemable1<'io-ts/Guard'> & + WithUnknownContainers1<'io-ts/Guard'> & + WithUnion1<'io-ts/Guard'> & + WithRefinement1<'io-ts/Guard'> ``` -Added in v2.2.0 +Added in v2.2.3 -# record +# model + +## Guard (interface) **Signature** ```ts -export declare function record(codomain: Guard): Guard> +export interface Guard { + is: (u: unknown) => u is A +} ``` Added in v2.2.0 -# refinement +# primitives + +## UnknownArray **Signature** ```ts -export declare function refinement(from: Guard, refinement: (a: A) => a is B): Guard +export declare const UnknownArray: Guard ``` Added in v2.2.0 -# schemableGuard +## UnknownRecord **Signature** ```ts -export declare const schemableGuard: Schemable1<'io-ts/Guard'> & - WithUnknownContainers1<'io-ts/Guard'> & - WithUnion1<'io-ts/Guard'> & - WithRefinement1<'io-ts/Guard'> +export declare const UnknownRecord: Guard> ``` -Added in v2.2.3 +Added in v2.2.0 -# string +## boolean **Signature** ```ts -export declare const string: Guard +export declare const boolean: Guard ``` Added in v2.2.0 -# sum +## never **Signature** ```ts -export declare function sum( - tag: T -): (members: { [K in keyof A]: Guard }) => Guard +export declare const never: Guard ``` Added in v2.2.0 -# tuple +## number **Signature** ```ts -export declare function tuple>( - ...components: { [K in keyof A]: Guard } -): Guard +export declare const number: Guard ``` Added in v2.2.0 -# type +## string **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> +export declare const string: Guard ``` Added in v2.2.0 -# union +# utils + +## TypeOf (type alias) **Signature** ```ts -export declare function union>( - ...members: { [K in keyof A]: Guard } -): Guard +export type TypeOf = G extends Guard ? A : never ``` -Added in v2.2.0 +Added in v2.2.2 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 85168f4f3..732cf2148 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -4,7 +4,7 @@ nav_order: 7 parent: Modules --- -# JsonCodec overview +## JsonCodec overview Added in v2.2.3 @@ -12,214 +12,231 @@ Added in v2.2.3

Table of contents

-- [JsonCodec (interface)](#jsoncodec-interface) -- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [array](#array) -- [boolean](#boolean) -- [imap](#imap) -- [intersection](#intersection) -- [invariantJsonCodec](#invariantjsoncodec) -- [lazy](#lazy) -- [literal](#literal) -- [make](#make) -- [nullable](#nullable) -- [number](#number) -- [partial](#partial) -- [record](#record) -- [refinement](#refinement) -- [schemableJsonCodec](#schemablejsoncodec) -- [string](#string) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) -- [withExpected](#withexpected) +- [Contravariant](#contravariant) + - [imap](#imap) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [partial](#partial) + - [record](#record) + - [refinement](#refinement) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [withExpected](#withexpected) +- [constructors](#constructors) + - [literal](#literal) + - [make](#make) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [invariantJsonCodec](#invariantjsoncodec) + - [schemableJsonCodec](#schemablejsoncodec) +- [model](#model) + - [JsonCodec (interface)](#jsoncodec-interface) +- [primitives](#primitives) + - [boolean](#boolean) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) --- -# JsonCodec (interface) +# Contravariant -Laws: - -1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` -2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` +## imap **Signature** ```ts -export interface JsonCodec
extends C.Codec {} +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) => JsonCodec ``` Added in v2.2.3 -# TypeOf (type alias) +# combinators + +## array **Signature** ```ts -export type TypeOf = JE.TypeOf +export declare const array: (items: JsonCodec) => JsonCodec ``` -Added in v2.2.2 +Added in v2.2.3 -# URI (type alias) +## intersection **Signature** ```ts -export type URI = typeof URI +export declare const intersection: (left: JsonCodec, right: JsonCodec) => JsonCodec ``` Added in v2.2.3 -# URI +## lazy **Signature** ```ts -export declare const URI: 'io-ts/JsonCodec' +export declare const lazy: (id: string, f: () => JsonCodec) => JsonCodec ``` Added in v2.2.3 -# array +## nullable **Signature** ```ts -export declare const array: (items: JsonCodec) => JsonCodec +export declare const nullable: (or: JsonCodec) => JsonCodec ``` Added in v2.2.3 -# boolean +## partial **Signature** ```ts -export declare const boolean: JsonCodec +export declare const partial: ( + properties: { [K in keyof A]: JsonCodec } +) => JsonCodec> ``` Added in v2.2.3 -# imap +## record **Signature** ```ts -export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) => JsonCodec +export declare const record: (codomain: JsonCodec) => JsonCodec> ``` Added in v2.2.3 -# intersection +## refinement **Signature** ```ts -export declare const intersection: (left: JsonCodec, right: JsonCodec) => JsonCodec +export declare const refinement: ( + from: JsonCodec, + refinement: (a: A) => a is B, + expected: string +) => JsonCodec ``` Added in v2.2.3 -# invariantJsonCodec +## sum **Signature** ```ts -export declare const invariantJsonCodec: Invariant1<'io-ts/JsonCodec'> +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: JsonCodec }) => JsonCodec ``` Added in v2.2.3 -# lazy +## tuple **Signature** ```ts -export declare const lazy: (id: string, f: () => JsonCodec) => JsonCodec +export declare const tuple: ( + ...components: { [K in keyof A]: JsonCodec } +) => JsonCodec ``` Added in v2.2.3 -# literal +## type **Signature** ```ts -export declare const literal: (...values: A) => JsonCodec +export declare const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 -# make +## withExpected **Signature** ```ts -export declare const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec +export declare const withExpected: ( + codec: JsonCodec, + expected: (actual: unknown, e: D.DecodeError) => D.DecodeError +) => JsonCodec ``` Added in v2.2.3 -# nullable +# constructors + +## literal **Signature** ```ts -export declare const nullable: (or: JsonCodec) => JsonCodec +export declare const literal: (...values: A) => JsonCodec ``` Added in v2.2.3 -# number +## make **Signature** ```ts -export declare const number: JsonCodec +export declare const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec ``` Added in v2.2.3 -# partial +# instances + +## URI **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: JsonCodec } -) => JsonCodec> +export declare const URI: 'io-ts/JsonCodec' ``` Added in v2.2.3 -# record +## URI (type alias) **Signature** ```ts -export declare const record: (codomain: JsonCodec) => JsonCodec> +export type URI = typeof URI ``` Added in v2.2.3 -# refinement +## invariantJsonCodec **Signature** ```ts -export declare const refinement: ( - from: JsonCodec, - refinement: (a: A) => a is B, - expected: string -) => JsonCodec +export declare const invariantJsonCodec: Invariant1<'io-ts/JsonCodec'> ``` Added in v2.2.3 -# schemableJsonCodec +## schemableJsonCodec **Signature** @@ -229,59 +246,63 @@ export declare const schemableJsonCodec: Schemable1<'io-ts/JsonCodec'> & WithRef Added in v2.2.3 -# string +# model + +## JsonCodec (interface) + +Laws: + +1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` +2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` **Signature** ```ts -export declare const string: JsonCodec +export interface JsonCodec extends C.Codec {} ``` Added in v2.2.3 -# sum +# primitives + +## boolean **Signature** ```ts -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: JsonCodec }) => JsonCodec +export declare const boolean: JsonCodec ``` Added in v2.2.3 -# tuple +## number **Signature** ```ts -export declare const tuple: ( - ...components: { [K in keyof A]: JsonCodec } -) => JsonCodec +export declare const number: JsonCodec ``` Added in v2.2.3 -# type +## string **Signature** ```ts -export declare const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec<{ [K in keyof A]: A[K] }> +export declare const string: JsonCodec ``` Added in v2.2.3 -# withExpected +# utils + +## TypeOf (type alias) **Signature** ```ts -export declare const withExpected: ( - codec: JsonCodec, - expected: (actual: unknown, e: D.DecodeError) => D.DecodeError -) => JsonCodec +export type TypeOf = JE.TypeOf ``` -Added in v2.2.3 +Added in v2.2.2 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index aba7714db..92f1ace90 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -4,7 +4,7 @@ nav_order: 8 parent: Modules --- -# JsonEncoder overview +## JsonEncoder overview Added in v2.2.3 @@ -12,235 +12,253 @@ Added in v2.2.3

Table of contents

-- [JsonArray (interface)](#jsonarray-interface) -- [JsonEncoder (interface)](#jsonencoder-interface) -- [Json (type alias)](#json-type-alias) -- [JsonObject (type alias)](#jsonobject-type-alias) -- [TypeOf (type alias)](#typeof-type-alias) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [array](#array) -- [contramap](#contramap) -- [contravariantJsonEncoder](#contravariantjsonencoder) -- [id](#id) -- [intersection](#intersection) -- [lazy](#lazy) -- [nullable](#nullable) -- [partial](#partial) -- [record](#record) -- [schemableJsonEncoder](#schemablejsonencoder) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) +- [Contravariant](#contravariant) + - [contramap](#contramap) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [partial](#partial) + - [record](#record) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [contravariantJsonEncoder](#contravariantjsonencoder) + - [schemableJsonEncoder](#schemablejsonencoder) +- [model](#model) + - [Json (type alias)](#json-type-alias) + - [JsonArray (interface)](#jsonarray-interface) + - [JsonEncoder (interface)](#jsonencoder-interface) + - [JsonObject (type alias)](#jsonobject-type-alias) +- [primitives](#primitives) + - [id](#id) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) --- -# JsonArray (interface) +# Contravariant + +## contramap **Signature** ```ts -export interface JsonArray extends Array {} +export declare const contramap: (f: (b: B) => A) => (fa: JsonEncoder
) => JsonEncoder ``` Added in v2.2.3 -# JsonEncoder (interface) +# combinators + +## array **Signature** ```ts -export interface JsonEncoder { - readonly encode: (a: A) => Json -} +export declare const array: (items: JsonEncoder) => JsonEncoder ``` Added in v2.2.3 -# Json (type alias) +## intersection **Signature** ```ts -export type Json = null | string | number | boolean | JsonObject | JsonArray +export declare const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder ``` Added in v2.2.3 -# JsonObject (type alias) +## lazy **Signature** ```ts -export type JsonObject = { [key: string]: Json } +export declare const lazy: (f: () => JsonEncoder) => JsonEncoder ``` Added in v2.2.3 -# TypeOf (type alias) +## nullable **Signature** ```ts -export type TypeOf = E.TypeOf +export declare const nullable: (or: JsonEncoder) => JsonEncoder ``` Added in v2.2.3 -# URI (type alias) +## partial **Signature** ```ts -export type URI = typeof URI +export declare const partial: ( + properties: { [K in keyof A]: JsonEncoder } +) => JsonEncoder> ``` Added in v2.2.3 -# URI +## record **Signature** ```ts -export declare const URI: 'io-ts/JsonEncoder' +export declare const record: (codomain: JsonEncoder) => JsonEncoder> ``` Added in v2.2.3 -# array +## sum **Signature** ```ts -export declare const array: (items: JsonEncoder) => JsonEncoder +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: JsonEncoder }) => JsonEncoder ``` Added in v2.2.3 -# contramap +## tuple **Signature** ```ts -export declare const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder +export declare const tuple: ( + ...components: { [K in keyof A]: JsonEncoder } +) => JsonEncoder ``` Added in v2.2.3 -# contravariantJsonEncoder +## type **Signature** ```ts -export declare const contravariantJsonEncoder: Contravariant1<'io-ts/JsonEncoder'> +export declare const type: ( + properties: { [K in keyof A]: JsonEncoder } +) => JsonEncoder<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 -# id +# instances + +## URI **Signature** ```ts -export declare function id(): JsonEncoder +export declare const URI: 'io-ts/JsonEncoder' ``` -Added in v2.2.5 +Added in v2.2.3 -# intersection +## URI (type alias) **Signature** ```ts -export declare const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder +export type URI = typeof URI ``` Added in v2.2.3 -# lazy +## contravariantJsonEncoder **Signature** ```ts -export declare const lazy: (f: () => JsonEncoder) => JsonEncoder +export declare const contravariantJsonEncoder: Contravariant1<'io-ts/JsonEncoder'> ``` Added in v2.2.3 -# nullable +## schemableJsonEncoder **Signature** ```ts -export declare const nullable: (or: JsonEncoder) => JsonEncoder +export declare const schemableJsonEncoder: Schemable1<'io-ts/JsonEncoder'> ``` Added in v2.2.3 -# partial +# model + +## Json (type alias) **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder> +export type Json = null | string | number | boolean | JsonObject | JsonArray ``` Added in v2.2.3 -# record +## JsonArray (interface) **Signature** ```ts -export declare const record: (codomain: JsonEncoder) => JsonEncoder> +export interface JsonArray extends Array {} ``` Added in v2.2.3 -# schemableJsonEncoder +## JsonEncoder (interface) **Signature** ```ts -export declare const schemableJsonEncoder: Schemable1<'io-ts/JsonEncoder'> +export interface JsonEncoder { + readonly encode: (a: A) => Json +} ``` Added in v2.2.3 -# sum +## JsonObject (type alias) **Signature** ```ts -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: JsonEncoder }) => JsonEncoder +export type JsonObject = { [key: string]: Json } ``` Added in v2.2.3 -# tuple +# primitives + +## id **Signature** ```ts -export declare const tuple: ( - ...components: { [K in keyof A]: JsonEncoder } -) => JsonEncoder +export declare function id(): JsonEncoder ``` -Added in v2.2.3 +Added in v2.2.5 + +# utils -# type +## TypeOf (type alias) **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder<{ [K in keyof A]: A[K] }> +export type TypeOf = E.TypeOf ``` Added in v2.2.3 diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 80e6dfafc..a6a32698e 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -4,7 +4,7 @@ nav_order: 9 parent: Modules --- -# PathReporter overview +## PathReporter overview Added in v1.0.0 @@ -12,13 +12,16 @@ Added in v1.0.0

Table of contents

-- [PathReporter](#pathreporter) -- [failure](#failure) -- [success](#success) +- [utils](#utils) + - [PathReporter](#pathreporter) + - [failure](#failure) + - [success](#success) --- -# PathReporter +# utils + +## PathReporter **Signature** @@ -28,7 +31,7 @@ export declare const PathReporter: Reporter Added in v1.0.0 -# failure +## failure **Signature** @@ -38,7 +41,7 @@ export declare function failure(es: Array): Array Added in v1.0.0 -# success +## success **Signature** diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index a6d9e4fac..a765eca60 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -4,7 +4,7 @@ nav_order: 10 parent: Modules --- -# Reporter overview +## Reporter overview Added in v1.0.0 @@ -12,11 +12,14 @@ Added in v1.0.0

Table of contents

-- [Reporter (interface)](#reporter-interface) +- [utils](#utils) + - [Reporter (interface)](#reporter-interface) --- -# Reporter (interface) +# utils + +## Reporter (interface) **Signature** diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index ecec5cb06..2a34ea3f8 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -4,7 +4,7 @@ nav_order: 11 parent: Modules --- -# Schema overview +## Schema overview Added in v2.2.0 @@ -12,51 +12,60 @@ Added in v2.2.0

Table of contents

-- [Schema (interface)](#schema-interface) -- [TypeOf (type alias)](#typeof-type-alias) -- [interpreter](#interpreter) -- [make](#make) +- [constructors](#constructors) + - [make](#make) +- [model](#model) + - [Schema (interface)](#schema-interface) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) + - [interpreter](#interpreter) --- -# Schema (interface) +# constructors + +## make **Signature** ```ts -export interface Schema
{ - (S: Schemable): HKT -} +export declare function make(schema: Schema): Schema ``` Added in v2.2.0 -# TypeOf (type alias) +# model + +## Schema (interface) **Signature** ```ts -export type TypeOf = S extends Schema ? A : never +export interface Schema { + (S: Schemable): HKT +} ``` Added in v2.2.0 -# interpreter +# utils + +## TypeOf (type alias) **Signature** ```ts -export declare function interpreter(S: Schemable1): (schema: Schema) => Kind +export type TypeOf = S extends Schema ? A : never ``` -Added in v2.2.3 +Added in v2.2.0 -# make +## interpreter **Signature** ```ts -export declare function make(schema: Schema): Schema +export declare function interpreter(S: Schemable1): (schema: Schema) => Kind ``` -Added in v2.2.0 +Added in v2.2.3 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index cf95b9e54..75b14285e 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -4,7 +4,7 @@ nav_order: 12 parent: Modules --- -# Schemable overview +## Schemable overview Added in v2.2.0 @@ -12,20 +12,33 @@ Added in v2.2.0

Table of contents

-- [Schemable (interface)](#schemable-interface) -- [Schemable1 (interface)](#schemable1-interface) -- [WithRefinement (interface)](#withrefinement-interface) -- [WithRefinement1 (interface)](#withrefinement1-interface) -- [WithUnion (interface)](#withunion-interface) -- [WithUnion1 (interface)](#withunion1-interface) -- [WithUnknownContainers (interface)](#withunknowncontainers-interface) -- [WithUnknownContainers1 (interface)](#withunknowncontainers1-interface) -- [Literal (type alias)](#literal-type-alias) -- [memoize](#memoize) +- [utils](#utils) + - [Literal (type alias)](#literal-type-alias) + - [Schemable (interface)](#schemable-interface) + - [Schemable1 (interface)](#schemable1-interface) + - [WithRefinement (interface)](#withrefinement-interface) + - [WithRefinement1 (interface)](#withrefinement1-interface) + - [WithUnion (interface)](#withunion-interface) + - [WithUnion1 (interface)](#withunion1-interface) + - [WithUnknownContainers (interface)](#withunknowncontainers-interface) + - [WithUnknownContainers1 (interface)](#withunknowncontainers1-interface) + - [memoize](#memoize) --- -# Schemable (interface) +# utils + +## Literal (type alias) + +**Signature** + +```ts +export type Literal = string | number | boolean | null +``` + +Added in v2.2.0 + +## Schemable (interface) **Signature** @@ -50,7 +63,7 @@ export interface Schemable { Added in v2.2.3 -# Schemable1 (interface) +## Schemable1 (interface) **Signature** @@ -75,7 +88,7 @@ export interface Schemable1 { Added in v2.2.3 -# WithRefinement (interface) +## WithRefinement (interface) **Signature** @@ -87,7 +100,7 @@ export interface WithRefinement { Added in v2.2.3 -# WithRefinement1 (interface) +## WithRefinement1 (interface) **Signature** @@ -99,7 +112,7 @@ export interface WithRefinement1 { Added in v2.2.3 -# WithUnion (interface) +## WithUnion (interface) **Signature** @@ -111,7 +124,7 @@ export interface WithUnion { Added in v2.2.3 -# WithUnion1 (interface) +## WithUnion1 (interface) **Signature** @@ -125,7 +138,7 @@ export interface WithUnion1 { Added in v2.2.3 -# WithUnknownContainers (interface) +## WithUnknownContainers (interface) **Signature** @@ -138,7 +151,7 @@ export interface WithUnknownContainers { Added in v2.2.3 -# WithUnknownContainers1 (interface) +## WithUnknownContainers1 (interface) **Signature** @@ -151,17 +164,7 @@ export interface WithUnknownContainers1 { Added in v2.2.3 -# Literal (type alias) - -**Signature** - -```ts -export type Literal = string | number | boolean | null -``` - -Added in v2.2.0 - -# memoize +## memoize **Signature** diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index bc531c728..0362f33e6 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -4,7 +4,7 @@ nav_order: 13 parent: Modules --- -# Tree overview +## Tree overview Added in v2.2.0 @@ -12,11 +12,14 @@ Added in v2.2.0

Table of contents

-- [draw](#draw) +- [utils](#utils) + - [draw](#draw) --- -# draw +# utils + +## draw **Signature** diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 1b801bb55..dfe598061 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -4,7 +4,7 @@ nav_order: 14 parent: Modules --- -# Type overview +## Type overview Added in v2.2.3 @@ -12,245 +12,260 @@ Added in v2.2.3

Table of contents

-- [Type (interface)](#type-interface) -- [URI (type alias)](#uri-type-alias) -- [URI](#uri) -- [UnknownArray](#unknownarray) -- [UnknownRecord](#unknownrecord) -- [array](#array) -- [boolean](#boolean) -- [intersection](#intersection) -- [lazy](#lazy) -- [literal](#literal) -- [nullable](#nullable) -- [number](#number) -- [partial](#partial) -- [record](#record) -- [refinement](#refinement) -- [schemableType](#schemabletype) -- [string](#string) -- [sum](#sum) -- [tuple](#tuple) -- [type](#type) -- [union](#union) +- [combinators](#combinators) + - [array](#array) + - [intersection](#intersection) + - [lazy](#lazy) + - [nullable](#nullable) + - [partial](#partial) + - [record](#record) + - [refinement](#refinement) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [constructors](#constructors) + - [literal](#literal) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [schemableType](#schemabletype) +- [model](#model) + - [Type (interface)](#type-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) --- -# Type (interface) +# combinators + +## array **Signature** ```ts -export interface Type
extends t.Type {} +export declare function array(items: Type): Type> ``` Added in v2.2.3 -# URI (type alias) +## intersection **Signature** ```ts -export type URI = typeof URI +export declare function intersection(left: Type, right: Type): Type ``` Added in v2.2.3 -# URI +## lazy **Signature** ```ts -export declare const URI: 'io-ts/Type' +export declare function lazy(id: string, f: () => Type): Type ``` Added in v2.2.3 -# UnknownArray +## nullable **Signature** ```ts -export declare const UnknownArray: Type +export declare function nullable(or: Type): Type ``` Added in v2.2.3 -# UnknownRecord +## partial **Signature** ```ts -export declare const UnknownRecord: Type> +export declare function partial(properties: { [K in keyof A]: Type }): Type> ``` Added in v2.2.3 -# array +## record **Signature** ```ts -export declare function array(items: Type): Type> +export declare function record(codomain: Type): Type> ``` Added in v2.2.3 -# boolean +## refinement **Signature** ```ts -export declare const boolean: Type +export declare function refinement( + from: Type, + refinement: (a: A) => a is B, + expected: string +): Type ``` Added in v2.2.3 -# intersection +## sum **Signature** ```ts -export declare function intersection(left: Type, right: Type): Type +export declare function sum(_tag: T): (members: { [K in keyof A]: Type }) => Type ``` Added in v2.2.3 -# lazy +## tuple **Signature** ```ts -export declare function lazy(id: string, f: () => Type): Type +export declare function tuple>(...components: { [K in keyof A]: Type }): Type ``` Added in v2.2.3 -# literal +## type **Signature** ```ts -export declare function literal>(...values: A): Type +export declare function type(properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 -# nullable +## union **Signature** ```ts -export declare function nullable(or: Type): Type +export declare function union>( + ...members: { [K in keyof A]: Type } +): Type ``` Added in v2.2.3 -# number +# constructors + +## literal **Signature** ```ts -export declare const number: Type +export declare function literal>(...values: A): Type ``` Added in v2.2.3 -# partial +# instances + +## URI **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Type }): Type> +export declare const URI: 'io-ts/Type' ``` Added in v2.2.3 -# record +## URI (type alias) **Signature** ```ts -export declare function record(codomain: Type): Type> +export type URI = typeof URI ``` Added in v2.2.3 -# refinement +## schemableType **Signature** ```ts -export declare function refinement( - from: Type, - refinement: (a: A) => a is B, - expected: string -): Type +export declare const schemableType: Schemable1<'io-ts/Type'> & + WithUnknownContainers1<'io-ts/Type'> & + WithUnion1<'io-ts/Type'> & + WithRefinement1<'io-ts/Type'> ``` Added in v2.2.3 -# schemableType +# model + +## Type (interface) **Signature** ```ts -export declare const schemableType: Schemable1<'io-ts/Type'> & - WithUnknownContainers1<'io-ts/Type'> & - WithUnion1<'io-ts/Type'> & - WithRefinement1<'io-ts/Type'> +export interface Type extends t.Type {} ``` Added in v2.2.3 -# string +# primitives + +## UnknownArray **Signature** ```ts -export declare const string: Type +export declare const UnknownArray: Type ``` Added in v2.2.3 -# sum +## UnknownRecord **Signature** ```ts -export declare function sum(_tag: T): (members: { [K in keyof A]: Type }) => Type +export declare const UnknownRecord: Type> ``` Added in v2.2.3 -# tuple +## boolean **Signature** ```ts -export declare function tuple>(...components: { [K in keyof A]: Type }): Type +export declare const boolean: Type ``` Added in v2.2.3 -# type +## number **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> +export declare const number: Type ``` Added in v2.2.3 -# union +## string **Signature** ```ts -export declare function union>( - ...members: { [K in keyof A]: Type } -): Type +export declare const string: Type ``` Added in v2.2.3 diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 696af9a8d..7dd95a5ce 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -4,7 +4,7 @@ nav_order: 6 parent: Modules --- -# index overview +## index overview Added in v1.0.0 @@ -12,949 +12,992 @@ Added in v1.0.0

Table of contents

-- [Any (interface)](#any-interface) -- [~~AnyC~~ (interface)](#anyc-interface) -- [AnyProps (interface)](#anyprops-interface) -- [ArrayC (interface)](#arrayc-interface) -- [BigIntC (interface)](#bigintc-interface) -- [BooleanC (interface)](#booleanc-interface) -- [Brand (interface)](#brand-interface) -- [BrandC (interface)](#brandc-interface) -- [Context (interface)](#context-interface) -- [ContextEntry (interface)](#contextentry-interface) -- [Decoder (interface)](#decoder-interface) -- [Encoder (interface)](#encoder-interface) -- [Errors (interface)](#errors-interface) -- [ExactC (interface)](#exactc-interface) -- [~~FunctionC~~ (interface)](#functionc-interface) -- [HasPropsIntersection (interface)](#haspropsintersection-interface) -- [HasPropsReadonly (interface)](#haspropsreadonly-interface) -- [HasPropsRefinement (interface)](#haspropsrefinement-interface) -- [IntBrand (interface)](#intbrand-interface) -- [IntersectionC (interface)](#intersectionc-interface) -- [KeyofC (interface)](#keyofc-interface) -- [LiteralC (interface)](#literalc-interface) -- [Mixed (interface)](#mixed-interface) -- [~~NeverC~~ (interface)](#neverc-interface) -- [NullC (interface)](#nullc-interface) -- [NumberC (interface)](#numberc-interface) -- [~~ObjectC~~ (interface)](#objectc-interface) -- [PartialC (interface)](#partialc-interface) -- [Props (interface)](#props-interface) -- [ReadonlyArrayC (interface)](#readonlyarrayc-interface) -- [ReadonlyC (interface)](#readonlyc-interface) -- [RecordC (interface)](#recordc-interface) -- [~~RefinementC~~ (interface)](#refinementc-interface) -- [~~StrictC~~ (interface)](#strictc-interface) -- [StringC (interface)](#stringc-interface) -- [~~TaggedExact~~ (interface)](#taggedexact-interface) -- [~~TaggedIntersection~~ (interface)](#taggedintersection-interface) -- [~~TaggedRefinement~~ (interface)](#taggedrefinement-interface) -- [~~TaggedUnion~~ (interface)](#taggedunion-interface) -- [~~TaggedUnionC~~ (interface)](#taggedunionc-interface) -- [TupleC (interface)](#tuplec-interface) -- [TypeC (interface)](#typec-interface) -- [UndefinedC (interface)](#undefinedc-interface) -- [UnionC (interface)](#unionc-interface) -- [UnknownArrayC (interface)](#unknownarrayc-interface) -- [UnknownC (interface)](#unknownc-interface) -- [UnknownRecordC (interface)](#unknownrecordc-interface) -- [ValidationError (interface)](#validationerror-interface) -- [VoidC (interface)](#voidc-interface) -- [Branded (type alias)](#branded-type-alias) -- [~~Compact~~ (type alias)](#compact-type-alias) -- [Decode (type alias)](#decode-type-alias) -- [Encode (type alias)](#encode-type-alias) -- [~~Exact~~ (type alias)](#exact-type-alias) -- [HasProps (type alias)](#hasprops-type-alias) -- [InputOf (type alias)](#inputof-type-alias) -- [Int (type alias)](#int-type-alias) -- [Is (type alias)](#is-type-alias) -- [OutputOf (type alias)](#outputof-type-alias) -- [OutputOfDictionary (type alias)](#outputofdictionary-type-alias) -- [OutputOfPartialProps (type alias)](#outputofpartialprops-type-alias) -- [OutputOfProps (type alias)](#outputofprops-type-alias) -- [~~PropsOf~~ (type alias)](#propsof-type-alias) -- [~~Tagged~~ (type alias)](#tagged-type-alias) -- [~~TaggedIntersectionArgument~~ (type alias)](#taggedintersectionargument-type-alias) -- [~~TaggedProps~~ (type alias)](#taggedprops-type-alias) -- [TypeOf (type alias)](#typeof-type-alias) -- [TypeOfDictionary (type alias)](#typeofdictionary-type-alias) -- [TypeOfPartialProps (type alias)](#typeofpartialprops-type-alias) -- [TypeOfProps (type alias)](#typeofprops-type-alias) -- [Validate (type alias)](#validate-type-alias) -- [Validation (type alias)](#validation-type-alias) -- [~~mixed~~ (type alias)](#mixed-type-alias) -- [AnyArrayType (class)](#anyarraytype-class) - - [\_tag (property)](#_tag-property) -- [AnyDictionaryType (class)](#anydictionarytype-class) - - [\_tag (property)](#_tag-property-1) -- [~~AnyType~~ (class)](#anytype-class) - - [\_tag (property)](#_tag-property-2) -- [ArrayType (class)](#arraytype-class) - - [\_tag (property)](#_tag-property-3) -- [BigIntType (class)](#biginttype-class) - - [\_tag (property)](#_tag-property-4) -- [BooleanType (class)](#booleantype-class) - - [\_tag (property)](#_tag-property-5) -- [DictionaryType (class)](#dictionarytype-class) - - [\_tag (property)](#_tag-property-6) -- [ExactType (class)](#exacttype-class) - - [\_tag (property)](#_tag-property-7) -- [~~FunctionType~~ (class)](#functiontype-class) - - [\_tag (property)](#_tag-property-8) -- [InterfaceType (class)](#interfacetype-class) - - [\_tag (property)](#_tag-property-9) -- [IntersectionType (class)](#intersectiontype-class) - - [\_tag (property)](#_tag-property-10) -- [KeyofType (class)](#keyoftype-class) - - [\_tag (property)](#_tag-property-11) -- [LiteralType (class)](#literaltype-class) - - [\_tag (property)](#_tag-property-12) -- [~~NeverType~~ (class)](#nevertype-class) - - [\_tag (property)](#_tag-property-13) -- [NullType (class)](#nulltype-class) - - [\_tag (property)](#_tag-property-14) -- [NumberType (class)](#numbertype-class) - - [\_tag (property)](#_tag-property-15) -- [~~ObjectType~~ (class)](#objecttype-class) - - [\_tag (property)](#_tag-property-16) -- [PartialType (class)](#partialtype-class) - - [\_tag (property)](#_tag-property-17) -- [ReadonlyArrayType (class)](#readonlyarraytype-class) - - [\_tag (property)](#_tag-property-18) -- [ReadonlyType (class)](#readonlytype-class) - - [\_tag (property)](#_tag-property-19) -- [RecursiveType (class)](#recursivetype-class) - - [\_tag (property)](#_tag-property-20) - - [type (property)](#type-property) -- [RefinementType (class)](#refinementtype-class) - - [\_tag (property)](#_tag-property-21) -- [~~StrictType~~ (class)](#stricttype-class) - - [\_tag (property)](#_tag-property-22) -- [StringType (class)](#stringtype-class) - - [\_tag (property)](#_tag-property-23) -- [~~TaggedUnionType~~ (class)](#taggeduniontype-class) -- [TupleType (class)](#tupletype-class) - - [\_tag (property)](#_tag-property-24) -- [Type (class)](#type-class) - - [pipe (method)](#pipe-method) - - [asDecoder (method)](#asdecoder-method) - - [asEncoder (method)](#asencoder-method) - - [decode (method)](#decode-method) - - [\_A (property)](#_a-property) - - [\_O (property)](#_o-property) - - [\_I (property)](#_i-property) -- [UndefinedType (class)](#undefinedtype-class) - - [\_tag (property)](#_tag-property-25) -- [UnionType (class)](#uniontype-class) - - [\_tag (property)](#_tag-property-26) -- [UnknownType (class)](#unknowntype-class) - - [\_tag (property)](#_tag-property-27) -- [VoidType (class)](#voidtype-class) - - [\_tag (property)](#_tag-property-28) -- [Int](#int) -- [UnknownArray](#unknownarray) -- [UnknownRecord](#unknownrecord) -- [appendContext](#appendcontext) -- [array](#array) -- [bigint](#bigint) -- [boolean](#boolean) -- [brand](#brand) -- [exact](#exact) -- [failure](#failure) -- [failures](#failures) -- [getContextEntry](#getcontextentry) -- [getFunctionName](#getfunctionname) -- [identity](#identity) -- [intersection](#intersection) -- [keyof](#keyof) -- [literal](#literal) -- [null](#null) -- [nullType](#nulltype) -- [number](#number) -- [partial](#partial) -- [readonly](#readonly) -- [readonlyArray](#readonlyarray) -- [record](#record) -- [recursion](#recursion) -- [strict](#strict) -- [string](#string) -- [success](#success) -- [tuple](#tuple) -- [type](#type) -- [undefined](#undefined) -- [union](#union) -- [unknown](#unknown) -- [void](#void) -- [voidType](#voidtype) -- [~~Array~~](#array) -- [~~Dictionary~~](#dictionary) -- [~~Function~~](#function) -- [~~Integer~~](#integer) -- [~~alias~~](#alias) -- [~~any~~](#any) -- [~~clean~~](#clean) -- [~~dictionary~~](#dictionary) -- [~~getDefaultContext~~](#getdefaultcontext) -- [~~getValidationError~~](#getvalidationerror) -- [~~interface~~](#interface) -- [~~never~~](#never) -- [~~object~~](#object) -- [~~refinement~~](#refinement) -- [~~taggedUnion~~](#taggedunion) +- [Combinators](#combinators) + - [array](#array) + - [brand](#brand) + - [intersection](#intersection) + - [keyof](#keyof) + - [literal](#literal) + - [partial](#partial) + - [readonly](#readonly) + - [readonlyArray](#readonlyarray) + - [record](#record) + - [recursion](#recursion) + - [strict](#strict) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [Model](#model) + - [Context (interface)](#context-interface) + - [ContextEntry (interface)](#contextentry-interface) + - [Decode (type alias)](#decode-type-alias) + - [Decoder (interface)](#decoder-interface) + - [Encode (type alias)](#encode-type-alias) + - [Encoder (interface)](#encoder-interface) + - [Errors (interface)](#errors-interface) + - [Is (type alias)](#is-type-alias) + - [Type (class)](#type-class) + - [pipe (method)](#pipe-method) + - [asDecoder (method)](#asdecoder-method) + - [asEncoder (method)](#asencoder-method) + - [decode (method)](#decode-method) + - [\_A (property)](#_a-property) + - [\_O (property)](#_o-property) + - [\_I (property)](#_i-property) + - [Validate (type alias)](#validate-type-alias) + - [Validation (type alias)](#validation-type-alias) + - [ValidationError (interface)](#validationerror-interface) +- [Primitives](#primitives) + - [Int](#int) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [bigint](#bigint) + - [boolean](#boolean) + - [nullType](#nulltype) + - [number](#number) + - [string](#string) + - [unknown](#unknown) + - [voidType](#voidtype) +- [deprecated](#deprecated) + - [~~AnyC~~ (interface)](#anyc-interface) + - [~~AnyType~~ (class)](#anytype-class) + - [\_tag (property)](#_tag-property) + - [~~Array~~](#array) + - [~~Compact~~ (type alias)](#compact-type-alias) + - [~~Dictionary~~](#dictionary) + - [~~Exact~~ (type alias)](#exact-type-alias) + - [~~FunctionC~~ (interface)](#functionc-interface) + - [~~FunctionType~~ (class)](#functiontype-class) + - [\_tag (property)](#_tag-property-1) + - [~~Function~~](#function) + - [~~Integer~~](#integer) + - [~~NeverC~~ (interface)](#neverc-interface) + - [~~NeverType~~ (class)](#nevertype-class) + - [\_tag (property)](#_tag-property-2) + - [~~ObjectC~~ (interface)](#objectc-interface) + - [~~ObjectType~~ (class)](#objecttype-class) + - [\_tag (property)](#_tag-property-3) + - [~~PropsOf~~ (type alias)](#propsof-type-alias) + - [~~RefinementC~~ (interface)](#refinementc-interface) + - [~~StrictC~~ (interface)](#strictc-interface) + - [~~StrictType~~ (class)](#stricttype-class) + - [\_tag (property)](#_tag-property-4) + - [~~TaggedExact~~ (interface)](#taggedexact-interface) + - [~~TaggedIntersectionArgument~~ (type alias)](#taggedintersectionargument-type-alias) + - [~~TaggedIntersection~~ (interface)](#taggedintersection-interface) + - [~~TaggedProps~~ (type alias)](#taggedprops-type-alias) + - [~~TaggedRefinement~~ (interface)](#taggedrefinement-interface) + - [~~TaggedUnionC~~ (interface)](#taggedunionc-interface) + - [~~TaggedUnionType~~ (class)](#taggeduniontype-class) + - [~~TaggedUnion~~ (interface)](#taggedunion-interface) + - [~~Tagged~~ (type alias)](#tagged-type-alias) + - [~~alias~~](#alias) + - [~~any~~](#any) + - [~~clean~~](#clean) + - [~~dictionary~~](#dictionary) + - [~~getDefaultContext~~](#getdefaultcontext) + - [~~getValidationError~~](#getvalidationerror) + - [~~interface~~](#interface) + - [~~mixed~~ (type alias)](#mixed-type-alias) + - [~~never~~](#never) + - [~~object~~](#object) + - [~~refinement~~](#refinement) + - [~~taggedUnion~~](#taggedunion) +- [utils](#utils) + - [Any (interface)](#any-interface) + - [AnyArrayType (class)](#anyarraytype-class) + - [\_tag (property)](#_tag-property-5) + - [AnyDictionaryType (class)](#anydictionarytype-class) + - [\_tag (property)](#_tag-property-6) + - [AnyProps (interface)](#anyprops-interface) + - [ArrayC (interface)](#arrayc-interface) + - [ArrayType (class)](#arraytype-class) + - [\_tag (property)](#_tag-property-7) + - [BigIntC (interface)](#bigintc-interface) + - [BigIntType (class)](#biginttype-class) + - [\_tag (property)](#_tag-property-8) + - [BooleanC (interface)](#booleanc-interface) + - [BooleanType (class)](#booleantype-class) + - [\_tag (property)](#_tag-property-9) + - [Brand (interface)](#brand-interface) + - [BrandC (interface)](#brandc-interface) + - [Branded (type alias)](#branded-type-alias) + - [DictionaryType (class)](#dictionarytype-class) + - [\_tag (property)](#_tag-property-10) + - [ExactC (interface)](#exactc-interface) + - [ExactType (class)](#exacttype-class) + - [\_tag (property)](#_tag-property-11) + - [HasProps (type alias)](#hasprops-type-alias) + - [HasPropsIntersection (interface)](#haspropsintersection-interface) + - [HasPropsReadonly (interface)](#haspropsreadonly-interface) + - [HasPropsRefinement (interface)](#haspropsrefinement-interface) + - [InputOf (type alias)](#inputof-type-alias) + - [Int (type alias)](#int-type-alias) + - [IntBrand (interface)](#intbrand-interface) + - [InterfaceType (class)](#interfacetype-class) + - [\_tag (property)](#_tag-property-12) + - [IntersectionC (interface)](#intersectionc-interface) + - [IntersectionType (class)](#intersectiontype-class) + - [\_tag (property)](#_tag-property-13) + - [KeyofC (interface)](#keyofc-interface) + - [KeyofType (class)](#keyoftype-class) + - [\_tag (property)](#_tag-property-14) + - [LiteralC (interface)](#literalc-interface) + - [LiteralType (class)](#literaltype-class) + - [\_tag (property)](#_tag-property-15) + - [Mixed (interface)](#mixed-interface) + - [NullC (interface)](#nullc-interface) + - [NullType (class)](#nulltype-class) + - [\_tag (property)](#_tag-property-16) + - [NumberC (interface)](#numberc-interface) + - [NumberType (class)](#numbertype-class) + - [\_tag (property)](#_tag-property-17) + - [OutputOf (type alias)](#outputof-type-alias) + - [OutputOfDictionary (type alias)](#outputofdictionary-type-alias) + - [OutputOfPartialProps (type alias)](#outputofpartialprops-type-alias) + - [OutputOfProps (type alias)](#outputofprops-type-alias) + - [PartialC (interface)](#partialc-interface) + - [PartialType (class)](#partialtype-class) + - [\_tag (property)](#_tag-property-18) + - [Props (interface)](#props-interface) + - [ReadonlyArrayC (interface)](#readonlyarrayc-interface) + - [ReadonlyArrayType (class)](#readonlyarraytype-class) + - [\_tag (property)](#_tag-property-19) + - [ReadonlyC (interface)](#readonlyc-interface) + - [ReadonlyType (class)](#readonlytype-class) + - [\_tag (property)](#_tag-property-20) + - [RecordC (interface)](#recordc-interface) + - [RecursiveType (class)](#recursivetype-class) + - [\_tag (property)](#_tag-property-21) + - [type (property)](#type-property) + - [RefinementType (class)](#refinementtype-class) + - [\_tag (property)](#_tag-property-22) + - [StringC (interface)](#stringc-interface) + - [StringType (class)](#stringtype-class) + - [\_tag (property)](#_tag-property-23) + - [TupleC (interface)](#tuplec-interface) + - [TupleType (class)](#tupletype-class) + - [\_tag (property)](#_tag-property-24) + - [TypeC (interface)](#typec-interface) + - [TypeOf (type alias)](#typeof-type-alias) + - [TypeOfDictionary (type alias)](#typeofdictionary-type-alias) + - [TypeOfPartialProps (type alias)](#typeofpartialprops-type-alias) + - [TypeOfProps (type alias)](#typeofprops-type-alias) + - [UndefinedC (interface)](#undefinedc-interface) + - [UndefinedType (class)](#undefinedtype-class) + - [\_tag (property)](#_tag-property-25) + - [UnionC (interface)](#unionc-interface) + - [UnionType (class)](#uniontype-class) + - [\_tag (property)](#_tag-property-26) + - [UnknownArrayC (interface)](#unknownarrayc-interface) + - [UnknownC (interface)](#unknownc-interface) + - [UnknownRecordC (interface)](#unknownrecordc-interface) + - [UnknownType (class)](#unknowntype-class) + - [\_tag (property)](#_tag-property-27) + - [VoidC (interface)](#voidc-interface) + - [VoidType (class)](#voidtype-class) + - [\_tag (property)](#_tag-property-28) + - [appendContext](#appendcontext) + - [exact](#exact) + - [failure](#failure) + - [failures](#failures) + - [getContextEntry](#getcontextentry) + - [getFunctionName](#getfunctionname) + - [identity](#identity) + - [null](#null) + - [success](#success) + - [undefined](#undefined) + - [void](#void) --- -# Any (interface) +# Combinators + +## array **Signature** ```ts -export interface Any extends Type {} +export declare const array: (codec: C, name?: string) => ArrayC ``` Added in v1.0.0 -# ~~AnyC~~ (interface) +## brand **Signature** ```ts -export interface AnyC extends AnyType {} +export declare const brand: ( + codec: C, + predicate: Refinement>, + name: N +) => BrandC ``` -Added in v1.5.3 +Added in v1.8.1 -# AnyProps (interface) +## intersection **Signature** ```ts -export interface AnyProps { - [key: string]: Any -} +export declare function intersection< + A extends Mixed, + B extends Mixed, + C extends Mixed, + D extends Mixed, + E extends Mixed +>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> +export declare function intersection
( + codecs: [A, B, C, D], + name?: string +): IntersectionC<[A, B, C, D]> +export declare function intersection( + codecs: [A, B, C], + name?: string +): IntersectionC<[A, B, C]> +export declare function intersection( + codecs: [A, B], + name?: string +): IntersectionC<[A, B]> ``` Added in v1.0.0 -# ArrayC (interface) +## keyof **Signature** ```ts -export interface ArrayC extends ArrayType>, Array>, unknown> {} +export declare const keyof: (keys: D, name?: string) => KeyofC ``` -Added in v1.5.3 +Added in v1.0.0 -# BigIntC (interface) +## literal **Signature** ```ts -export interface BigIntC extends BigIntType {} +export declare const literal: (value: V, name?: string) => LiteralC ``` -Added in v2.1.0 +Added in v1.0.0 -# BooleanC (interface) +## partial **Signature** ```ts -export interface BooleanC extends BooleanType {} +export declare const partial:

(props: P, name?: string) => PartialC

``` -Added in v1.5.3 +Added in v1.0.0 -# Brand (interface) +## readonly **Signature** ```ts -export interface Brand { - readonly [_brand]: B -} +export declare const readonly: (codec: C, name?: string) => ReadonlyC ``` -Added in v1.8.1 +Added in v1.0.0 -# BrandC (interface) +## readonlyArray **Signature** ```ts -export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} +export declare const readonlyArray: (codec: C, name?: string) => ReadonlyArrayC ``` -Added in v1.8.1 +Added in v1.0.0 -# Context (interface) +## record **Signature** ```ts -export interface Context extends ReadonlyArray {} +export declare function record(domain: D, codomain: C, name?: string): RecordC +``` + +Added in v1.7.1 + +## recursion + +**Signature** + +```ts +export declare const recursion: = Type>( + name: string, + definition: (self: C) => C +) => RecursiveType ``` Added in v1.0.0 -# ContextEntry (interface) +## strict + +Strips additional properties **Signature** ```ts -export interface ContextEntry { - readonly key: string - readonly type: Decoder - /** the input data */ - readonly actual?: unknown -} +export declare const strict:

(props: P, name?: string) => ExactC> ``` Added in v1.0.0 -# Decoder (interface) +## tuple **Signature** ```ts -export interface Decoder { - readonly name: string - readonly validate: Validate - readonly decode: Decode -} +export declare function tuple( + codecs: [A, B, C, D, E], + name?: string +): TupleC<[A, B, C, D, E]> +export declare function tuple( + codecs: [A, B, C, D], + name?: string +): TupleC<[A, B, C, D]> +export declare function tuple( + codecs: [A, B, C], + name?: string +): TupleC<[A, B, C]> +export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> +export declare function tuple(codecs: [A], name?: string): TupleC<[A]> ``` Added in v1.0.0 -# Encoder (interface) +## type **Signature** ```ts -export interface Encoder { - readonly encode: Encode -} +export declare const type:

(props: P, name?: string) => TypeC

``` Added in v1.0.0 -# Errors (interface) +## union **Signature** ```ts -export interface Errors extends Array {} +export declare const union: (codecs: CS, name?: string) => UnionC ``` Added in v1.0.0 -# ExactC (interface) +# Model + +## Context (interface) **Signature** ```ts -export interface ExactC extends ExactType, OutputOf, InputOf> {} +export interface Context extends ReadonlyArray {} ``` -Added in v1.5.3 +Added in v1.0.0 -# ~~FunctionC~~ (interface) +## ContextEntry (interface) **Signature** ```ts -export interface FunctionC extends FunctionType {} +export interface ContextEntry { + readonly key: string + readonly type: Decoder + /** the input data */ + readonly actual?: unknown +} ``` -Added in v1.5.3 +Added in v1.0.0 -# HasPropsIntersection (interface) +## Decode (type alias) **Signature** ```ts -export interface HasPropsIntersection extends IntersectionType, any, any, any> {} +export type Decode = (i: I) => Validation ``` -Added in v1.1.0 +Added in v1.0.0 -# HasPropsReadonly (interface) +## Decoder (interface) **Signature** ```ts -export interface HasPropsReadonly extends ReadonlyType {} +export interface Decoder { + readonly name: string + readonly validate: Validate + readonly decode: Decode +} ``` -Added in v1.1.0 +Added in v1.0.0 -# HasPropsRefinement (interface) +## Encode (type alias) **Signature** ```ts -export interface HasPropsRefinement extends RefinementType {} +export type Encode = (a: A) => O ``` -Added in v1.1.0 +Added in v1.0.0 -# IntBrand (interface) +## Encoder (interface) **Signature** ```ts -export interface IntBrand { - readonly Int: unique symbol +export interface Encoder { + readonly encode: Encode } ``` -Added in v1.8.1 +Added in v1.0.0 -# IntersectionC (interface) +## Errors (interface) **Signature** ```ts -export interface IntersectionC]> - extends IntersectionType< - CS, - CS extends { length: 2 } - ? TypeOf & TypeOf - : CS extends { length: 3 } - ? TypeOf & TypeOf & TypeOf - : CS extends { length: 4 } - ? TypeOf & TypeOf & TypeOf & TypeOf - : CS extends { length: 5 } - ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf - : unknown, - CS extends { length: 2 } - ? OutputOf & OutputOf - : CS extends { length: 3 } - ? OutputOf & OutputOf & OutputOf - : CS extends { length: 4 } - ? OutputOf & OutputOf & OutputOf & OutputOf - : CS extends { length: 5 } - ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf - : unknown, - unknown - > {} +export interface Errors extends Array {} ``` -Added in v1.5.3 +Added in v1.0.0 -# KeyofC (interface) +## Is (type alias) **Signature** ```ts -export interface KeyofC extends KeyofType {} +export type Is = (u: unknown) => u is A ``` -Added in v1.5.3 +Added in v1.0.0 -# LiteralC (interface) +## Type (class) **Signature** ```ts -export interface LiteralC extends LiteralType {} +export declare class Type { + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: Is, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: Validate, + /** converts a value of type A to a value of type O */ + readonly encode: Encode + ) +} ``` -Added in v1.5.3 +Added in v1.0.0 -# Mixed (interface) +### pipe (method) **Signature** ```ts -export interface Mixed extends Type {} +pipe( + this: Type, + ab: Type, + name: string = `pipe(${this.name}, ${ab.name})` + ): Type ``` Added in v1.0.0 -# ~~NeverC~~ (interface) +### asDecoder (method) **Signature** ```ts -export interface NeverC extends NeverType {} +asDecoder(): Decoder ``` -Added in v1.5.3 +Added in v1.0.0 -# NullC (interface) +### asEncoder (method) **Signature** ```ts -export interface NullC extends NullType {} +asEncoder(): Encoder ``` -Added in v1.5.3 +Added in v1.0.0 -# NumberC (interface) +### decode (method) + +a version of `validate` with a default context **Signature** ```ts -export interface NumberC extends NumberType {} +decode(i: I): Validation ``` -Added in v1.5.3 +Added in v1.0.0 -# ~~ObjectC~~ (interface) +### \_A (property) **Signature** ```ts -export interface ObjectC extends ObjectType {} +readonly _A: A ``` -Added in v1.5.3 +Added in v1.0.0 -# PartialC (interface) +### \_O (property) **Signature** ```ts -export interface PartialC

- extends PartialType }, { [K in keyof P]?: OutputOf }, unknown> {} +readonly _O: O ``` -Added in v1.5.3 +Added in v1.0.0 -# Props (interface) +### \_I (property) **Signature** ```ts -export interface Props { - [key: string]: Mixed -} +readonly _I: I ``` Added in v1.0.0 -# ReadonlyArrayC (interface) +## Validate (type alias) **Signature** ```ts -export interface ReadonlyArrayC - extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} +export type Validate = (i: I, context: Context) => Validation ``` -Added in v1.5.3 +Added in v1.0.0 -# ReadonlyC (interface) +## Validation (type alias) **Signature** ```ts -export interface ReadonlyC - extends ReadonlyType>, Readonly>, unknown> {} +export type Validation = Either ``` -Added in v1.5.3 +Added in v1.0.0 -# RecordC (interface) +## ValidationError (interface) **Signature** ```ts -export interface RecordC - extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} +export interface ValidationError { + /** the offending (sub)value */ + readonly value: unknown + /** where the error originated */ + readonly context: Context + /** optional custom error message */ + readonly message?: string +} ``` -Added in v1.5.3 +Added in v1.0.0 -# ~~RefinementC~~ (interface) +# Primitives -Use `BrandC` instead +## Int + +A branded codec representing an integer **Signature** ```ts -export interface RefinementC extends RefinementType, OutputOf, InputOf> {} +export declare const Int: BrandC ``` -Added in v1.5.3 +Added in v1.8.1 -# ~~StrictC~~ (interface) +## UnknownArray **Signature** ```ts -export interface StrictC

// tslint:disable-next-line: deprecation - extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} +export declare const UnknownArray: UnknownArrayC ``` -Added in v1.5.3 +Added in v1.7.1 -# StringC (interface) +## UnknownRecord **Signature** ```ts -export interface StringC extends StringType {} +export declare const UnknownRecord: UnknownRecordC ``` -Added in v1.5.3 +Added in v1.7.1 -# ~~TaggedExact~~ (interface) +## bigint **Signature** ```ts -export interface TaggedExact extends ExactType, A, O> {} +export declare const bigint: BigIntC ``` -Added in v1.3.0 +Added in v2.1.0 -# ~~TaggedIntersection~~ (interface) +## boolean **Signature** ```ts -export interface TaggedIntersection // tslint:disable-next-line: deprecation - extends IntersectionType, A, O> {} +export declare const boolean: BooleanC ``` -Added in v1.3.0 +Added in v1.0.0 -# ~~TaggedRefinement~~ (interface) +## nullType **Signature** ```ts -export interface TaggedRefinement extends RefinementType, A, O> {} +export declare const nullType: NullC ``` -Added in v1.3.0 +Added in v1.0.0 -# ~~TaggedUnion~~ (interface) +## number **Signature** ```ts -export interface TaggedUnion extends UnionType>, A, O> {} +export declare const number: NumberC ``` -Added in v1.3.0 +Added in v1.0.0 -# ~~TaggedUnionC~~ (interface) +## string **Signature** ```ts -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation - extends TaggedUnionType, OutputOf, unknown> {} +export declare const string: StringC ``` -Added in v1.5.3 +Added in v1.0.0 -# TupleC (interface) +## unknown **Signature** ```ts -export interface TupleC]> - extends TupleType< - CS, - CS extends { length: 1 } - ? [TypeOf] - : CS extends { length: 2 } - ? [TypeOf, TypeOf] - : CS extends { length: 3 } - ? [TypeOf, TypeOf, TypeOf] - : CS extends { length: 4 } - ? [TypeOf, TypeOf, TypeOf, TypeOf] - : CS extends { length: 5 } - ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] - : unknown, - CS extends { length: 1 } - ? [OutputOf] - : CS extends { length: 2 } - ? [OutputOf, OutputOf] - : CS extends { length: 3 } - ? [OutputOf, OutputOf, OutputOf] - : CS extends { length: 4 } - ? [OutputOf, OutputOf, OutputOf, OutputOf] - : CS extends { length: 5 } - ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] - : unknown, - unknown - > {} +export declare const unknown: UnknownC ``` -Added in v1.5.3 +Added in v1.5.0 -# TypeC (interface) +## voidType **Signature** ```ts -export interface TypeC

- extends InterfaceType }, { [K in keyof P]: OutputOf }, unknown> {} +export declare const voidType: VoidC ``` -Added in v1.5.3 +Added in v1.2.0 + +# deprecated -# UndefinedC (interface) +## ~~AnyC~~ (interface) **Signature** ```ts -export interface UndefinedC extends UndefinedType {} +export interface AnyC extends AnyType {} ``` Added in v1.5.3 -# UnionC (interface) +## ~~AnyType~~ (class) **Signature** ```ts -export interface UnionC]> - extends UnionType, OutputOf, unknown> {} +export declare class AnyType { + constructor() +} ``` -Added in v1.5.3 +Added in v1.0.0 -# UnknownArrayC (interface) +### \_tag (property) **Signature** ```ts -export interface UnknownArrayC extends AnyArrayType {} +readonly _tag: "AnyType" ``` -Added in v1.5.3 +Added in v1.0.0 + +## ~~Array~~ -# UnknownC (interface) +Use `UnknownArray` instead **Signature** ```ts -export interface UnknownC extends UnknownType {} +export declare const Array: UnknownArrayC ``` -Added in v1.5.3 +Added in v1.0.0 + +## ~~Compact~~ (type alias) -# UnknownRecordC (interface) +used in `intersection` as a workaround for #234 **Signature** ```ts -export interface UnknownRecordC extends AnyDictionaryType {} +export type Compact = { [K in keyof A]: A[K] } ``` -Added in v1.5.3 +Added in v1.4.2 -# ValidationError (interface) +## ~~Dictionary~~ + +Use `UnknownRecord` instead **Signature** ```ts -export interface ValidationError { - /** the offending (sub)value */ - readonly value: unknown - /** where the error originated */ - readonly context: Context - /** optional custom error message */ - readonly message?: string -} +export declare const Dictionary: UnknownRecordC ``` Added in v1.0.0 -# VoidC (interface) +## ~~Exact~~ (type alias) **Signature** ```ts -export interface VoidC extends VoidType {} +export type Exact = T & + { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } +``` + +Added in v1.1.0 + +## ~~FunctionC~~ (interface) + +**Signature** + +```ts +export interface FunctionC extends FunctionType {} ``` Added in v1.5.3 -# Branded (type alias) +## ~~FunctionType~~ (class) **Signature** ```ts -export type Branded = A & Brand +export declare class FunctionType { + constructor() +} ``` -Added in v1.8.1 - -# ~~Compact~~ (type alias) +Added in v1.0.0 -used in `intersection` as a workaround for #234 +### \_tag (property) **Signature** ```ts -export type Compact = { [K in keyof A]: A[K] } +readonly _tag: "FunctionType" ``` -Added in v1.4.2 +Added in v1.0.0 -# Decode (type alias) +## ~~Function~~ **Signature** ```ts -export type Decode = (i: I) => Validation +export declare const Function: FunctionC ``` Added in v1.0.0 -# Encode (type alias) +## ~~Integer~~ + +Use `Int` instead **Signature** ```ts -export type Encode = (a: A) => O +export declare const Integer: RefinementC ``` Added in v1.0.0 -# ~~Exact~~ (type alias) +## ~~NeverC~~ (interface) **Signature** ```ts -export type Exact = T & - { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } +export interface NeverC extends NeverType {} ``` -Added in v1.1.0 +Added in v1.5.3 -# HasProps (type alias) +## ~~NeverType~~ (class) **Signature** ```ts -export type HasProps = - | HasPropsRefinement - | HasPropsReadonly - | HasPropsIntersection - | InterfaceType - // tslint:disable-next-line: deprecation - | StrictType - | PartialType +export declare class NeverType { + constructor() +} ``` -Added in v1.1.0 +Added in v1.0.0 -# InputOf (type alias) +### \_tag (property) **Signature** ```ts -export type InputOf = C['_I'] +readonly _tag: "NeverType" ``` Added in v1.0.0 -# Int (type alias) +## ~~ObjectC~~ (interface) **Signature** ```ts -export type Int = Branded +export interface ObjectC extends ObjectType {} ``` -Added in v1.8.1 +Added in v1.5.3 -# Is (type alias) +## ~~ObjectType~~ (class) **Signature** ```ts -export type Is = (u: unknown) => u is A +export declare class ObjectType { + constructor() +} ``` Added in v1.0.0 -# OutputOf (type alias) +### \_tag (property) **Signature** ```ts -export type OutputOf = C['_O'] +readonly _tag: "ObjectType" ``` Added in v1.0.0 -# OutputOfDictionary (type alias) +## ~~PropsOf~~ (type alias) **Signature** ```ts -export type OutputOfDictionary = { [K in OutputOf]: OutputOf } +export type PropsOf = T['props'] ``` Added in v1.0.0 -# OutputOfPartialProps (type alias) +## ~~RefinementC~~ (interface) + +Use `BrandC` instead **Signature** ```ts -export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } +export interface RefinementC extends RefinementType, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# OutputOfProps (type alias) +## ~~StrictC~~ (interface) **Signature** ```ts -export type OutputOfProps

= { [K in keyof P]: OutputOf } +export interface StrictC

// tslint:disable-next-line: deprecation + extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} +``` + +Added in v1.5.3 + +## ~~StrictType~~ (class) + +**Signature** + +```ts +export declare class StrictType { + constructor( + name: string, + // tslint:disable-next-line: deprecation + is: StrictType['is'], + // tslint:disable-next-line: deprecation + validate: StrictType['validate'], + // tslint:disable-next-line: deprecation + encode: StrictType['encode'], + readonly props: P + ) +} ``` Added in v1.0.0 -# ~~PropsOf~~ (type alias) +### \_tag (property) **Signature** ```ts -export type PropsOf = T['props'] +readonly _tag: "StrictType" ``` Added in v1.0.0 -# ~~Tagged~~ (type alias) +## ~~TaggedExact~~ (interface) **Signature** ```ts -export type Tagged = - // tslint:disable-next-line: deprecation - | InterfaceType, A, O> - // tslint:disable-next-line: deprecation - | StrictType, A, O> - // tslint:disable-next-line: deprecation - | TaggedRefinement - // tslint:disable-next-line: deprecation - | TaggedUnion - // tslint:disable-next-line: deprecation - | TaggedIntersection - // tslint:disable-next-line: deprecation - | TaggedExact - | RecursiveType +export interface TaggedExact extends ExactType, A, O> {} ``` Added in v1.3.0 -# ~~TaggedIntersectionArgument~~ (type alias) +## ~~TaggedIntersectionArgument~~ (type alias) **Signature** @@ -994,1555 +1037,1527 @@ export type TaggedIntersectionArgument = Added in v1.3.0 -# ~~TaggedProps~~ (type alias) +## ~~TaggedIntersection~~ (interface) **Signature** ```ts -export type TaggedProps = { [K in Tag]: LiteralType } +export interface TaggedIntersection // tslint:disable-next-line: deprecation + extends IntersectionType, A, O> {} ``` Added in v1.3.0 -# TypeOf (type alias) +## ~~TaggedProps~~ (type alias) **Signature** ```ts -export type TypeOf = C['_A'] +export type TaggedProps = { [K in Tag]: LiteralType } ``` -Added in v1.0.0 +Added in v1.3.0 -# TypeOfDictionary (type alias) +## ~~TaggedRefinement~~ (interface) **Signature** ```ts -export type TypeOfDictionary = { [K in TypeOf]: TypeOf } +export interface TaggedRefinement extends RefinementType, A, O> {} ``` -Added in v1.0.0 +Added in v1.3.0 -# TypeOfPartialProps (type alias) +## ~~TaggedUnionC~~ (interface) **Signature** ```ts -export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation + extends TaggedUnionType, OutputOf, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# TypeOfProps (type alias) +## ~~TaggedUnionType~~ (class) **Signature** ```ts -export type TypeOfProps

= { [K in keyof P]: TypeOf } +export declare class TaggedUnionType { + constructor( + name: string, + // tslint:disable-next-line: deprecation + is: TaggedUnionType['is'], + // tslint:disable-next-line: deprecation + validate: TaggedUnionType['validate'], + // tslint:disable-next-line: deprecation + encode: TaggedUnionType['encode'], + codecs: CS, + readonly tag: Tag + ) +} ``` -Added in v1.0.0 +Added in v1.3.0 -# Validate (type alias) +## ~~TaggedUnion~~ (interface) **Signature** ```ts -export type Validate = (i: I, context: Context) => Validation +export interface TaggedUnion extends UnionType>, A, O> {} ``` -Added in v1.0.0 +Added in v1.3.0 -# Validation (type alias) +## ~~Tagged~~ (type alias) **Signature** ```ts -export type Validation = Either +export type Tagged = + // tslint:disable-next-line: deprecation + | InterfaceType, A, O> + // tslint:disable-next-line: deprecation + | StrictType, A, O> + // tslint:disable-next-line: deprecation + | TaggedRefinement + // tslint:disable-next-line: deprecation + | TaggedUnion + // tslint:disable-next-line: deprecation + | TaggedIntersection + // tslint:disable-next-line: deprecation + | TaggedExact + | RecursiveType ``` -Added in v1.0.0 +Added in v1.3.0 -# ~~mixed~~ (type alias) +## ~~alias~~ -Use `unknown` instead +Keeps the codec "kind" **Signature** ```ts -export type mixed = unknown +export declare function alias( + codec: PartialType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => PartialType +export declare function alias( + // tslint:disable-next-line: deprecation + codec: StrictType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => // tslint:disable-next-line: deprecation +StrictType +export declare function alias( + codec: InterfaceType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => InterfaceType ``` -Added in v1.0.0 - -# AnyArrayType (class) - -**Signature** - -```ts -export declare class AnyArrayType { - constructor() -} -``` +Added in v1.1.0 -Added in v1.0.0 +## ~~any~~ -## \_tag (property) +Use `unknown` instead **Signature** ```ts -readonly _tag: "AnyArrayType" +export declare const any: AnyC ``` Added in v1.0.0 -# AnyDictionaryType (class) - -**Signature** - -```ts -export declare class AnyDictionaryType { - constructor() -} -``` - -Added in v1.0.0 +## ~~clean~~ -## \_tag (property) +Drops the codec "kind" **Signature** ```ts -readonly _tag: "AnyDictionaryType" +export declare function clean(codec: Type): Type ``` -Added in v1.0.0 - -# ~~AnyType~~ (class) - -**Signature** - -```ts -export declare class AnyType { - constructor() -} -``` +Added in v1.1.0 -Added in v1.0.0 +## ~~dictionary~~ -## \_tag (property) +Use `record` instead **Signature** ```ts -readonly _tag: "AnyType" +export declare const dictionary: typeof record ``` Added in v1.0.0 -# ArrayType (class) +## ~~getDefaultContext~~ **Signature** ```ts -export declare class ArrayType { - constructor( - name: string, - is: ArrayType['is'], - validate: ArrayType['validate'], - encode: ArrayType['encode'], - readonly type: C - ) -} +export declare const getDefaultContext: (decoder: Decoder) => Context ``` Added in v1.0.0 -## \_tag (property) +## ~~getValidationError~~ **Signature** ```ts -readonly _tag: "ArrayType" +export declare const getValidationError: (value: unknown, context: Context) => ValidationError ``` Added in v1.0.0 -# BigIntType (class) - -**Signature** - -```ts -export declare class BigIntType { - constructor() -} -``` - -Added in v2.1.0 +## ~~interface~~ -## \_tag (property) +Use `type` instead **Signature** ```ts -readonly _tag: "BigIntType" +export declare const interface:

(props: P, name?: string) => TypeC

``` Added in v1.0.0 -# BooleanType (class) +## ~~mixed~~ (type alias) + +Use `unknown` instead **Signature** ```ts -export declare class BooleanType { - constructor() -} +export type mixed = unknown ``` Added in v1.0.0 -## \_tag (property) +## ~~never~~ **Signature** ```ts -readonly _tag: "BooleanType" +export declare const never: NeverC ``` Added in v1.0.0 -# DictionaryType (class) +## ~~object~~ + +Use `UnknownRecord` instead **Signature** ```ts -export declare class DictionaryType { - constructor( - name: string, - is: DictionaryType['is'], - validate: DictionaryType['validate'], - encode: DictionaryType['encode'], - readonly domain: D, - readonly codomain: C - ) -} +export declare const object: ObjectC ``` Added in v1.0.0 -## \_tag (property) +## ~~refinement~~ + +Use `brand` instead **Signature** ```ts -readonly _tag: "DictionaryType" +export declare function refinement( + codec: C, + predicate: Predicate>, + name: string = `(${codec.name} | ${getFunctionName(predicate)})` +): // tslint:disable-next-line: deprecation +RefinementC ``` Added in v1.0.0 -# ExactType (class) +## ~~taggedUnion~~ + +Use `union` instead **Signature** ```ts -export declare class ExactType { - constructor( - name: string, - is: ExactType['is'], - validate: ExactType['validate'], - encode: ExactType['encode'], - readonly type: C - ) -} +export declare const taggedUnion: ( + tag: Tag, + codecs: CS, + name?: string +) => TaggedUnionC ``` -Added in v1.1.0 +Added in v1.3.0 + +# utils -## \_tag (property) +## Any (interface) **Signature** ```ts -readonly _tag: "ExactType" +export interface Any extends Type {} ``` Added in v1.0.0 -# ~~FunctionType~~ (class) +## AnyArrayType (class) **Signature** ```ts -export declare class FunctionType { +export declare class AnyArrayType { constructor() } ``` Added in v1.0.0 -## \_tag (property) +### \_tag (property) **Signature** ```ts -readonly _tag: "FunctionType" +readonly _tag: "AnyArrayType" ``` Added in v1.0.0 -# InterfaceType (class) +## AnyDictionaryType (class) **Signature** ```ts -export declare class InterfaceType { - constructor( - name: string, - is: InterfaceType['is'], - validate: InterfaceType['validate'], - encode: InterfaceType['encode'], - readonly props: P - ) +export declare class AnyDictionaryType { + constructor() } ``` Added in v1.0.0 -## \_tag (property) +### \_tag (property) **Signature** ```ts -readonly _tag: "InterfaceType" +readonly _tag: "AnyDictionaryType" ``` Added in v1.0.0 -# IntersectionType (class) +## AnyProps (interface) **Signature** ```ts -export declare class IntersectionType { - constructor( - name: string, - is: IntersectionType['is'], - validate: IntersectionType['validate'], - encode: IntersectionType['encode'], - readonly types: CS - ) +export interface AnyProps { + [key: string]: Any } ``` Added in v1.0.0 -## \_tag (property) +## ArrayC (interface) **Signature** ```ts -readonly _tag: "IntersectionType" +export interface ArrayC extends ArrayType>, Array>, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# KeyofType (class) +## ArrayType (class) **Signature** ```ts -export declare class KeyofType { +export declare class ArrayType { constructor( name: string, - is: KeyofType['is'], - validate: KeyofType['validate'], - encode: KeyofType['encode'], - readonly keys: D + is: ArrayType['is'], + validate: ArrayType['validate'], + encode: ArrayType['encode'], + readonly type: C ) } ``` Added in v1.0.0 -## \_tag (property) +### \_tag (property) **Signature** ```ts -readonly _tag: "KeyofType" +readonly _tag: "ArrayType" ``` Added in v1.0.0 -# LiteralType (class) +## BigIntC (interface) **Signature** ```ts -export declare class LiteralType { - constructor( - name: string, - is: LiteralType['is'], - validate: LiteralType['validate'], - encode: LiteralType['encode'], - readonly value: V - ) -} +export interface BigIntC extends BigIntType {} ``` -Added in v1.0.0 +Added in v2.1.0 -## \_tag (property) +## BigIntType (class) **Signature** ```ts -readonly _tag: "LiteralType" +export declare class BigIntType { + constructor() +} ``` -Added in v1.0.0 +Added in v2.1.0 -# ~~NeverType~~ (class) +### \_tag (property) **Signature** ```ts -export declare class NeverType { - constructor() -} +readonly _tag: "BigIntType" ``` Added in v1.0.0 -## \_tag (property) +## BooleanC (interface) **Signature** ```ts -readonly _tag: "NeverType" +export interface BooleanC extends BooleanType {} ``` -Added in v1.0.0 +Added in v1.5.3 -# NullType (class) +## BooleanType (class) **Signature** ```ts -export declare class NullType { +export declare class BooleanType { constructor() } ``` Added in v1.0.0 -## \_tag (property) +### \_tag (property) **Signature** ```ts -readonly _tag: "NullType" +readonly _tag: "BooleanType" ``` Added in v1.0.0 -# NumberType (class) +## Brand (interface) **Signature** ```ts -export declare class NumberType { - constructor() +export interface Brand { + readonly [_brand]: B } ``` -Added in v1.0.0 +Added in v1.8.1 -## \_tag (property) +## BrandC (interface) **Signature** ```ts -readonly _tag: "NumberType" +export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.8.1 -# ~~ObjectType~~ (class) +## Branded (type alias) **Signature** ```ts -export declare class ObjectType { - constructor() -} +export type Branded = A & Brand ``` -Added in v1.0.0 +Added in v1.8.1 -## \_tag (property) +## DictionaryType (class) **Signature** ```ts -readonly _tag: "ObjectType" +export declare class DictionaryType { + constructor( + name: string, + is: DictionaryType['is'], + validate: DictionaryType['validate'], + encode: DictionaryType['encode'], + readonly domain: D, + readonly codomain: C + ) +} ``` Added in v1.0.0 -# PartialType (class) +### \_tag (property) **Signature** ```ts -export declare class PartialType { - constructor( - name: string, - is: PartialType['is'], - validate: PartialType['validate'], - encode: PartialType['encode'], - readonly props: P - ) -} +readonly _tag: "DictionaryType" ``` Added in v1.0.0 -## \_tag (property) +## ExactC (interface) **Signature** ```ts -readonly _tag: "PartialType" +export interface ExactC extends ExactType, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# ReadonlyArrayType (class) +## ExactType (class) **Signature** ```ts -export declare class ReadonlyArrayType { +export declare class ExactType { constructor( name: string, - is: ReadonlyArrayType['is'], - validate: ReadonlyArrayType['validate'], - encode: ReadonlyArrayType['encode'], + is: ExactType['is'], + validate: ExactType['validate'], + encode: ExactType['encode'], readonly type: C ) } ``` -Added in v1.0.0 +Added in v1.1.0 -## \_tag (property) +### \_tag (property) **Signature** ```ts -readonly _tag: "ReadonlyArrayType" +readonly _tag: "ExactType" ``` Added in v1.0.0 -# ReadonlyType (class) +## HasProps (type alias) **Signature** ```ts -export declare class ReadonlyType { - constructor( - name: string, - is: ReadonlyType['is'], - validate: ReadonlyType['validate'], - encode: ReadonlyType['encode'], - readonly type: C - ) -} +export type HasProps = + | HasPropsRefinement + | HasPropsReadonly + | HasPropsIntersection + | InterfaceType + // tslint:disable-next-line: deprecation + | StrictType + | PartialType ``` -Added in v1.0.0 +Added in v1.1.0 -## \_tag (property) +## HasPropsIntersection (interface) **Signature** ```ts -readonly _tag: "ReadonlyType" +export interface HasPropsIntersection extends IntersectionType, any, any, any> {} ``` -Added in v1.0.0 +Added in v1.1.0 -# RecursiveType (class) +## HasPropsReadonly (interface) **Signature** ```ts -export declare class RecursiveType { - constructor( - name: string, - is: RecursiveType['is'], - validate: RecursiveType['validate'], - encode: RecursiveType['encode'], - public runDefinition: () => C - ) -} +export interface HasPropsReadonly extends ReadonlyType {} ``` -Added in v1.0.0 +Added in v1.1.0 -## \_tag (property) +## HasPropsRefinement (interface) **Signature** ```ts -readonly _tag: "RecursiveType" +export interface HasPropsRefinement extends RefinementType {} ``` -Added in v1.0.0 +Added in v1.1.0 -## type (property) +## InputOf (type alias) **Signature** ```ts -readonly type: C +export type InputOf = C['_I'] ``` Added in v1.0.0 -# RefinementType (class) +## Int (type alias) **Signature** ```ts -export declare class RefinementType { - constructor( - name: string, - is: RefinementType['is'], - validate: RefinementType['validate'], - encode: RefinementType['encode'], - readonly type: C, - readonly predicate: Predicate - ) -} +export type Int = Branded ``` -Added in v1.0.0 +Added in v1.8.1 -## \_tag (property) +## IntBrand (interface) **Signature** ```ts -readonly _tag: "RefinementType" +export interface IntBrand { + readonly Int: unique symbol +} ``` -Added in v1.0.0 +Added in v1.8.1 -# ~~StrictType~~ (class) +## InterfaceType (class) **Signature** ```ts -export declare class StrictType { +export declare class InterfaceType { constructor( name: string, - // tslint:disable-next-line: deprecation - is: StrictType['is'], - // tslint:disable-next-line: deprecation - validate: StrictType['validate'], - // tslint:disable-next-line: deprecation - encode: StrictType['encode'], + is: InterfaceType['is'], + validate: InterfaceType['validate'], + encode: InterfaceType['encode'], readonly props: P ) -} -``` - -Added in v1.0.0 - -## \_tag (property) - -**Signature** - -```ts -readonly _tag: "StrictType" +} ``` Added in v1.0.0 -# StringType (class) +### \_tag (property) **Signature** ```ts -export declare class StringType { - constructor() -} +readonly _tag: "InterfaceType" ``` Added in v1.0.0 -## \_tag (property) +## IntersectionC (interface) **Signature** ```ts -readonly _tag: "StringType" +export interface IntersectionC]> + extends IntersectionType< + CS, + CS extends { length: 2 } + ? TypeOf & TypeOf + : CS extends { length: 3 } + ? TypeOf & TypeOf & TypeOf + : CS extends { length: 4 } + ? TypeOf & TypeOf & TypeOf & TypeOf + : CS extends { length: 5 } + ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf + : unknown, + CS extends { length: 2 } + ? OutputOf & OutputOf + : CS extends { length: 3 } + ? OutputOf & OutputOf & OutputOf + : CS extends { length: 4 } + ? OutputOf & OutputOf & OutputOf & OutputOf + : CS extends { length: 5 } + ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf + : unknown, + unknown + > {} ``` -Added in v1.0.0 +Added in v1.5.3 -# ~~TaggedUnionType~~ (class) +## IntersectionType (class) **Signature** ```ts -export declare class TaggedUnionType { +export declare class IntersectionType { constructor( name: string, - // tslint:disable-next-line: deprecation - is: TaggedUnionType['is'], - // tslint:disable-next-line: deprecation - validate: TaggedUnionType['validate'], - // tslint:disable-next-line: deprecation - encode: TaggedUnionType['encode'], - codecs: CS, - readonly tag: Tag + is: IntersectionType['is'], + validate: IntersectionType['validate'], + encode: IntersectionType['encode'], + readonly types: CS ) } ``` -Added in v1.3.0 +Added in v1.0.0 -# TupleType (class) +### \_tag (property) **Signature** ```ts -export declare class TupleType { - constructor( - name: string, - is: TupleType['is'], - validate: TupleType['validate'], - encode: TupleType['encode'], - readonly types: CS - ) -} +readonly _tag: "IntersectionType" ``` Added in v1.0.0 -## \_tag (property) +## KeyofC (interface) **Signature** ```ts -readonly _tag: "TupleType" +export interface KeyofC extends KeyofType {} ``` -Added in v1.0.0 +Added in v1.5.3 -# Type (class) +## KeyofType (class) **Signature** ```ts -export declare class Type { +export declare class KeyofType { constructor( - /** a unique name for this codec */ - readonly name: string, - /** a custom type guard */ - readonly is: Is, - /** succeeds if a value of type I can be decoded to a value of type A */ - readonly validate: Validate, - /** converts a value of type A to a value of type O */ - readonly encode: Encode + name: string, + is: KeyofType['is'], + validate: KeyofType['validate'], + encode: KeyofType['encode'], + readonly keys: D ) } ``` Added in v1.0.0 -## pipe (method) +### \_tag (property) **Signature** ```ts -pipe( - this: Type, - ab: Type, - name: string = `pipe(${this.name}, ${ab.name})` - ): Type +readonly _tag: "KeyofType" ``` Added in v1.0.0 -## asDecoder (method) +## LiteralC (interface) **Signature** ```ts -asDecoder(): Decoder +export interface LiteralC extends LiteralType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## asEncoder (method) +## LiteralType (class) **Signature** ```ts -asEncoder(): Encoder +export declare class LiteralType { + constructor( + name: string, + is: LiteralType['is'], + validate: LiteralType['validate'], + encode: LiteralType['encode'], + readonly value: V + ) +} ``` Added in v1.0.0 -## decode (method) - -a version of `validate` with a default context +### \_tag (property) **Signature** ```ts -decode(i: I): Validation +readonly _tag: "LiteralType" ``` Added in v1.0.0 -## \_A (property) +## Mixed (interface) **Signature** ```ts -readonly _A: A +export interface Mixed extends Type {} ``` Added in v1.0.0 -## \_O (property) +## NullC (interface) **Signature** ```ts -readonly _O: O +export interface NullC extends NullType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## \_I (property) +## NullType (class) **Signature** ```ts -readonly _I: I +export declare class NullType { + constructor() +} ``` Added in v1.0.0 -# UndefinedType (class) +### \_tag (property) **Signature** ```ts -export declare class UndefinedType { - constructor() -} +readonly _tag: "NullType" ``` Added in v1.0.0 -## \_tag (property) +## NumberC (interface) **Signature** ```ts -readonly _tag: "UndefinedType" +export interface NumberC extends NumberType {} ``` -Added in v1.0.0 +Added in v1.5.3 -# UnionType (class) +## NumberType (class) **Signature** ```ts -export declare class UnionType { - constructor( - name: string, - is: UnionType['is'], - validate: UnionType['validate'], - encode: UnionType['encode'], - readonly types: CS - ) +export declare class NumberType { + constructor() } ``` Added in v1.0.0 -## \_tag (property) +### \_tag (property) **Signature** ```ts -readonly _tag: "UnionType" +readonly _tag: "NumberType" ``` Added in v1.0.0 -# UnknownType (class) +## OutputOf (type alias) **Signature** ```ts -export declare class UnknownType { - constructor() -} +export type OutputOf = C['_O'] ``` -Added in v1.5.0 +Added in v1.0.0 -## \_tag (property) +## OutputOfDictionary (type alias) **Signature** ```ts -readonly _tag: "UnknownType" +export type OutputOfDictionary = { [K in OutputOf]: OutputOf } ``` Added in v1.0.0 -# VoidType (class) +## OutputOfPartialProps (type alias) **Signature** ```ts -export declare class VoidType { - constructor() -} +export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } ``` -Added in v1.2.0 +Added in v1.0.0 -## \_tag (property) +## OutputOfProps (type alias) **Signature** ```ts -readonly _tag: "VoidType" +export type OutputOfProps

= { [K in keyof P]: OutputOf } ``` Added in v1.0.0 -# Int - -A branded codec representing an integer +## PartialC (interface) **Signature** ```ts -export declare const Int: BrandC +export interface PartialC

+ extends PartialType }, { [K in keyof P]?: OutputOf }, unknown> {} ``` -Added in v1.8.1 +Added in v1.5.3 -# UnknownArray +## PartialType (class) **Signature** ```ts -export declare const UnknownArray: UnknownArrayC +export declare class PartialType { + constructor( + name: string, + is: PartialType['is'], + validate: PartialType['validate'], + encode: PartialType['encode'], + readonly props: P + ) +} ``` -Added in v1.7.1 +Added in v1.0.0 -# UnknownRecord +### \_tag (property) **Signature** ```ts -export declare const UnknownRecord: UnknownRecordC +readonly _tag: "PartialType" ``` -Added in v1.7.1 +Added in v1.0.0 -# appendContext +## Props (interface) **Signature** ```ts -export declare const appendContext: (c: Context, key: string, decoder: Decoder, actual?: unknown) => Context +export interface Props { + [key: string]: Mixed +} ``` Added in v1.0.0 -# array +## ReadonlyArrayC (interface) **Signature** ```ts -export declare const array: (codec: C, name?: string) => ArrayC +export interface ReadonlyArrayC + extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# bigint +## ReadonlyArrayType (class) **Signature** ```ts -export declare const bigint: BigIntC +export declare class ReadonlyArrayType { + constructor( + name: string, + is: ReadonlyArrayType['is'], + validate: ReadonlyArrayType['validate'], + encode: ReadonlyArrayType['encode'], + readonly type: C + ) +} ``` -Added in v2.1.0 +Added in v1.0.0 -# boolean +### \_tag (property) **Signature** ```ts -export declare const boolean: BooleanC +readonly _tag: "ReadonlyArrayType" ``` Added in v1.0.0 -# brand +## ReadonlyC (interface) **Signature** ```ts -export declare const brand: ( - codec: C, - predicate: Refinement>, - name: N -) => BrandC +export interface ReadonlyC + extends ReadonlyType>, Readonly>, unknown> {} ``` -Added in v1.8.1 - -# exact +Added in v1.5.3 -Strips additional properties +## ReadonlyType (class) **Signature** ```ts -export declare const exact: (codec: C, name?: string) => ExactC +export declare class ReadonlyType { + constructor( + name: string, + is: ReadonlyType['is'], + validate: ReadonlyType['validate'], + encode: ReadonlyType['encode'], + readonly type: C + ) +} ``` -Added in v1.1.0 +Added in v1.0.0 -# failure +### \_tag (property) **Signature** ```ts -export declare const failure: (value: unknown, context: Context, message?: string) => Either +readonly _tag: "ReadonlyType" ``` Added in v1.0.0 -# failures +## RecordC (interface) **Signature** ```ts -export declare const failures: (errors: Errors) => Either +export interface RecordC + extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# getContextEntry +## RecursiveType (class) **Signature** ```ts -export declare const getContextEntry: (key: string, decoder: Decoder) => ContextEntry +export declare class RecursiveType { + constructor( + name: string, + is: RecursiveType['is'], + validate: RecursiveType['validate'], + encode: RecursiveType['encode'], + public runDefinition: () => C + ) +} ``` Added in v1.0.0 -# getFunctionName +### \_tag (property) **Signature** ```ts -export declare const getFunctionName: (f: Function) => string +readonly _tag: "RecursiveType" ``` Added in v1.0.0 -# identity +### type (property) **Signature** ```ts -export declare const identity: (a: A) => A +readonly type: C ``` Added in v1.0.0 -# intersection +## RefinementType (class) **Signature** ```ts -export declare function intersection< - A extends Mixed, - B extends Mixed, - C extends Mixed, - D extends Mixed, - E extends Mixed ->(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> -export declare function intersection( - codecs: [A, B, C, D], - name?: string -): IntersectionC<[A, B, C, D]> -export declare function intersection( - codecs: [A, B, C], - name?: string -): IntersectionC<[A, B, C]> -export declare function intersection( - codecs: [A, B], - name?: string -): IntersectionC<[A, B]> +export declare class RefinementType { + constructor( + name: string, + is: RefinementType['is'], + validate: RefinementType['validate'], + encode: RefinementType['encode'], + readonly type: C, + readonly predicate: Predicate + ) +} ``` Added in v1.0.0 -# keyof +### \_tag (property) **Signature** ```ts -export declare const keyof: (keys: D, name?: string) => KeyofC +readonly _tag: "RefinementType" ``` Added in v1.0.0 -# literal +## StringC (interface) **Signature** ```ts -export declare const literal: (value: V, name?: string) => LiteralC +export interface StringC extends StringType {} ``` -Added in v1.0.0 +Added in v1.5.3 -# null +## StringType (class) **Signature** ```ts -export declare const null: NullC +export declare class StringType { + constructor() +} ``` Added in v1.0.0 -# nullType +### \_tag (property) **Signature** ```ts -export declare const nullType: NullC +readonly _tag: "StringType" ``` Added in v1.0.0 -# number +## TupleC (interface) **Signature** ```ts -export declare const number: NumberC +export interface TupleC]> + extends TupleType< + CS, + CS extends { length: 1 } + ? [TypeOf] + : CS extends { length: 2 } + ? [TypeOf, TypeOf] + : CS extends { length: 3 } + ? [TypeOf, TypeOf, TypeOf] + : CS extends { length: 4 } + ? [TypeOf, TypeOf, TypeOf, TypeOf] + : CS extends { length: 5 } + ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] + : unknown, + CS extends { length: 1 } + ? [OutputOf] + : CS extends { length: 2 } + ? [OutputOf, OutputOf] + : CS extends { length: 3 } + ? [OutputOf, OutputOf, OutputOf] + : CS extends { length: 4 } + ? [OutputOf, OutputOf, OutputOf, OutputOf] + : CS extends { length: 5 } + ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] + : unknown, + unknown + > {} ``` -Added in v1.0.0 +Added in v1.5.3 -# partial +## TupleType (class) **Signature** ```ts -export declare const partial:

(props: P, name?: string) => PartialC

+export declare class TupleType { + constructor( + name: string, + is: TupleType['is'], + validate: TupleType['validate'], + encode: TupleType['encode'], + readonly types: CS + ) +} ``` Added in v1.0.0 -# readonly +### \_tag (property) **Signature** ```ts -export declare const readonly: (codec: C, name?: string) => ReadonlyC +readonly _tag: "TupleType" ``` Added in v1.0.0 -# readonlyArray +## TypeC (interface) **Signature** ```ts -export declare const readonlyArray: (codec: C, name?: string) => ReadonlyArrayC +export interface TypeC

+ extends InterfaceType }, { [K in keyof P]: OutputOf }, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# record +## TypeOf (type alias) **Signature** ```ts -export declare function record(domain: D, codomain: C, name?: string): RecordC +export type TypeOf = C['_A'] ``` -Added in v1.7.1 +Added in v1.0.0 -# recursion +## TypeOfDictionary (type alias) **Signature** ```ts -export declare const recursion: = Type>( - name: string, - definition: (self: C) => C -) => RecursiveType +export type TypeOfDictionary = { [K in TypeOf]: TypeOf } ``` Added in v1.0.0 -# strict - -Strips additional properties +## TypeOfPartialProps (type alias) **Signature** ```ts -export declare const strict:

(props: P, name?: string) => ExactC> +export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } ``` Added in v1.0.0 -# string +## TypeOfProps (type alias) **Signature** ```ts -export declare const string: StringC +export type TypeOfProps

= { [K in keyof P]: TypeOf } ``` Added in v1.0.0 -# success +## UndefinedC (interface) **Signature** ```ts -export declare const success: (value: T) => Either +export interface UndefinedC extends UndefinedType {} ``` -Added in v1.0.0 +Added in v1.5.3 -# tuple +## UndefinedType (class) **Signature** ```ts -export declare function tuple( - codecs: [A, B, C, D, E], - name?: string -): TupleC<[A, B, C, D, E]> -export declare function tuple( - codecs: [A, B, C, D], - name?: string -): TupleC<[A, B, C, D]> -export declare function tuple( - codecs: [A, B, C], - name?: string -): TupleC<[A, B, C]> -export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> -export declare function tuple(codecs: [A], name?: string): TupleC<[A]> +export declare class UndefinedType { + constructor() +} ``` Added in v1.0.0 -# type +### \_tag (property) **Signature** ```ts -export declare const type:

(props: P, name?: string) => TypeC

+readonly _tag: "UndefinedType" ``` Added in v1.0.0 -# undefined +## UnionC (interface) **Signature** ```ts -export declare const undefined: UndefinedC +export interface UnionC]> + extends UnionType, OutputOf, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -# union +## UnionType (class) **Signature** ```ts -export declare const union: (codecs: CS, name?: string) => UnionC +export declare class UnionType { + constructor( + name: string, + is: UnionType['is'], + validate: UnionType['validate'], + encode: UnionType['encode'], + readonly types: CS + ) +} ``` Added in v1.0.0 -# unknown +### \_tag (property) **Signature** ```ts -export declare const unknown: UnknownC +readonly _tag: "UnionType" ``` -Added in v1.5.0 +Added in v1.0.0 -# void +## UnknownArrayC (interface) **Signature** ```ts -export declare const void: VoidC +export interface UnknownArrayC extends AnyArrayType {} ``` -Added in v1.0.0 +Added in v1.5.3 -# voidType +## UnknownC (interface) **Signature** ```ts -export declare const voidType: VoidC +export interface UnknownC extends UnknownType {} ``` -Added in v1.2.0 - -# ~~Array~~ +Added in v1.5.3 -Use `UnknownArray` instead +## UnknownRecordC (interface) **Signature** ```ts -export declare const Array: UnknownArrayC +export interface UnknownRecordC extends AnyDictionaryType {} ``` -Added in v1.0.0 - -# ~~Dictionary~~ +Added in v1.5.3 -Use `UnknownRecord` instead +## UnknownType (class) **Signature** ```ts -export declare const Dictionary: UnknownRecordC +export declare class UnknownType { + constructor() +} ``` -Added in v1.0.0 +Added in v1.5.0 -# ~~Function~~ +### \_tag (property) **Signature** ```ts -export declare const Function: FunctionC +readonly _tag: "UnknownType" ``` Added in v1.0.0 -# ~~Integer~~ - -Use `Int` instead +## VoidC (interface) **Signature** ```ts -export declare const Integer: RefinementC +export interface VoidC extends VoidType {} ``` -Added in v1.0.0 - -# ~~alias~~ +Added in v1.5.3 -Keeps the codec "kind" +## VoidType (class) **Signature** ```ts -export declare function alias( - codec: PartialType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => PartialType -export declare function alias( - // tslint:disable-next-line: deprecation - codec: StrictType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => // tslint:disable-next-line: deprecation -StrictType -export declare function alias( - codec: InterfaceType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => InterfaceType +export declare class VoidType { + constructor() +} ``` -Added in v1.1.0 +Added in v1.2.0 -# ~~any~~ +### \_tag (property) -Use `unknown` instead +**Signature** + +```ts +readonly _tag: "VoidType" +``` + +Added in v1.0.0 + +## appendContext **Signature** ```ts -export declare const any: AnyC +export declare const appendContext: (c: Context, key: string, decoder: Decoder, actual?: unknown) => Context ``` Added in v1.0.0 -# ~~clean~~ +## exact -Drops the codec "kind" +Strips additional properties **Signature** ```ts -export declare function clean(codec: Type): Type +export declare const exact: (codec: C, name?: string) => ExactC ``` Added in v1.1.0 -# ~~dictionary~~ - -Use `record` instead +## failure **Signature** ```ts -export declare const dictionary: typeof record +export declare const failure: (value: unknown, context: Context, message?: string) => Either ``` Added in v1.0.0 -# ~~getDefaultContext~~ +## failures **Signature** ```ts -export declare const getDefaultContext: (decoder: Decoder) => Context +export declare const failures: (errors: Errors) => Either ``` Added in v1.0.0 -# ~~getValidationError~~ +## getContextEntry **Signature** ```ts -export declare const getValidationError: (value: unknown, context: Context) => ValidationError +export declare const getContextEntry: (key: string, decoder: Decoder) => ContextEntry ``` Added in v1.0.0 -# ~~interface~~ - -Use `type` instead +## getFunctionName **Signature** ```ts -export declare const interface:

(props: P, name?: string) => TypeC

+export declare const getFunctionName: (f: Function) => string ``` Added in v1.0.0 -# ~~never~~ +## identity **Signature** ```ts -export declare const never: NeverC +export declare const identity: (a: A) => A ``` Added in v1.0.0 -# ~~object~~ - -Use `UnknownRecord` instead +## null **Signature** ```ts -export declare const object: ObjectC +export declare const null: NullC ``` Added in v1.0.0 -# ~~refinement~~ - -Use `brand` instead +## success **Signature** ```ts -export declare function refinement( - codec: C, - predicate: Predicate>, - name: string = `(${codec.name} | ${getFunctionName(predicate)})` -): // tslint:disable-next-line: deprecation -RefinementC +export declare const success: (value: T) => Either ``` Added in v1.0.0 -# ~~taggedUnion~~ +## undefined -Use `union` instead +**Signature** + +```ts +export declare const undefined: UndefinedC +``` + +Added in v1.0.0 + +## void **Signature** ```ts -export declare const taggedUnion: ( - tag: Tag, - codecs: CS, - name?: string -) => TaggedUnionC +export declare const void: VoidC ``` -Added in v1.3.0 +Added in v1.0.0 diff --git a/package-lock.json b/package-lock.json index 7e2497710..0856ba63b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.3", + "version": "2.2.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -929,19 +929,12 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, - "@types/events": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", - "dev": true - }, "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==", "dev": true, "requires": { - "@types/events": "*", "@types/minimatch": "*", "@types/node": "*" } @@ -1189,6 +1182,12 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -2014,25 +2013,17 @@ "dev": true, "requires": { "path-type": "^4.0.0" - }, - "dependencies": { - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - } } }, "docs-ts": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.4.0.tgz", - "integrity": "sha512-hH41W9xfny0HfTySTiLYHwjdUEiSWcAQKdmdentdOCTFCJrCedUCxMLK70oSeOdwHCAhlK+p5ApmdINA2Bsg9w==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.5.1.tgz", + "integrity": "sha512-zdBt4P6X7h577/Vku0YHAw/RR1+zpKklK+DOzed1HJltwAAciQG14qy18TzcMbVUFxrnT9OO4Y1K/lQLdX1i/Q==", "dev": true, "requires": { "chalk": "^2.4.2", "doctrine": "^3.0.0", - "fp-ts": "^2.0.2", + "fp-ts": "^2.6.2", "fs-extra": "^7.0.1", "glob": "^7.1.3", "markdown-toc": "^1.2.0", @@ -2042,9 +2033,9 @@ }, "dependencies": { "fp-ts": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.3.tgz", - "integrity": "sha512-lQd+hahLd8cygNoXbEHDjH/cbF6XVWlEPb8h5GXXlozjCSDxWgclvkpOoTRfBA0P+r69l9VvW1nEsSGIJRQpWw==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.6.5.tgz", + "integrity": "sha512-lQNzOMJj98b623+UZLQ+tnN/8qtNXz/vRoR9k7L/9OlUIyYH3qVzSUVZBDXYsAd7nOWzzdQALCX1ZqcF70altQ==", "dev": true }, "rimraf": { @@ -2055,19 +2046,6 @@ "requires": { "glob": "^7.1.3" } - }, - "ts-node": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.1.tgz", - "integrity": "sha512-10DE9ONho06QORKAaCBpPiFCdW+tZJuY/84tyypGtl6r+/C7Asq0dhqbRZURuUlLQtZxxDvT8eoj8cGW0ha6Bg==", - "dev": true, - "requires": { - "arg": "^4.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.6", - "yn": "3.1.1" - } } } }, @@ -2510,51 +2488,6 @@ "merge2": "^1.3.0", "micromatch": "^4.0.2", "picomatch": "^2.2.1" - }, - "dependencies": { - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - } } }, "fast-json-stable-stringify": { @@ -2570,9 +2503,9 @@ "dev": true }, "fastq": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.7.0.tgz", - "integrity": "sha512-YOadQRnHd5q6PogvAR/x62BGituF2ufiEA6s8aavQANw5YKHERI4AREboX6KotzP8oX2klxYF2wcV/7bn1clfQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -2993,9 +2926,9 @@ } }, "ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "dev": true }, "import-local": { @@ -5076,9 +5009,9 @@ "dev": true }, "merge2": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", - "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, "micromatch": { @@ -5392,14 +5325,6 @@ "array-union": "^2.1.0", "arrify": "^2.0.1", "minimatch": "^3.0.4" - }, - "dependencies": { - "arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "dev": true - } } }, "nanomatch": { @@ -5756,6 +5681,12 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", diff --git a/package.json b/package.json index 2d2aa3e45..a53acf29a 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@types/jest": "25.2.1", "@types/node": "13.11.0", "benchmark": "2.1.4", - "docs-ts": "0.4.0", + "docs-ts": "^0.5.1", "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", "fast-check": "^1.24.2", diff --git a/src/Codec.ts b/src/Codec.ts index 1dcd712e2..eff3267c4 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -17,10 +17,15 @@ import { identity } from 'fp-ts/lib/function' * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` * + * @category model * @since 2.2.3 */ export interface Codec extends D.Decoder, E.Encoder {} +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + /** * @since 2.2.3 */ @@ -36,6 +41,7 @@ export type OutputOf = E.OutputOf // ------------------------------------------------------------------------------------- /** + * @category constructors * @since 2.2.3 */ export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { @@ -46,6 +52,7 @@ export function make(decoder: D.Decoder, encoder: E.Encoder): Cod } /** + * @category constructors * @since 2.2.3 */ export function fromDecoder(decoder: D.Decoder): Codec { @@ -56,6 +63,7 @@ export function fromDecoder(decoder: D.Decoder): Codec { } /** + * @category constructors * @since 2.2.3 */ export function literal>(...values: A): Codec { @@ -67,26 +75,31 @@ export function literal>(...values: A): Codec = fromDecoder(D.string) /** + * @category primitives * @since 2.2.3 */ export const number: Codec = fromDecoder(D.number) /** + * @category primitives * @since 2.2.3 */ export const boolean: Codec = fromDecoder(D.boolean) /** + * @category primitives * @since 2.2.3 */ export const UnknownArray: Codec, Array> = fromDecoder(D.UnknownArray) /** + * @category primitives * @since 2.2.3 */ export const UnknownRecord: Codec, Record> = fromDecoder(D.UnknownRecord) @@ -96,6 +109,7 @@ export const UnknownRecord: Codec, Record( @@ -106,6 +120,7 @@ export function withExpected( } /** + * @category combinators * @since 2.2.3 */ export function refinement( @@ -117,6 +132,7 @@ export function refinement( } /** + * @category combinators * @since 2.2.3 */ export function nullable(or: Codec): Codec { @@ -124,6 +140,7 @@ export function nullable(or: Codec): Codec { } /** + * @category combinators * @since 2.2.3 */ export function type

>>( @@ -134,17 +151,19 @@ export function type

>>( } /** + * @category combinators * @since 2.2.3 */ export function partial

>>( properties: P ): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> { - // these tow `any`s are required to make typescript@3.5 compile + // these two `any`s are required to make typescript@3.5 compile // vvvvvv vvvvvv return make(D.partial(properties as any), E.partial(properties)) as any } /** + * @category combinators * @since 2.2.3 */ export function record(codomain: Codec): Codec, Record> { @@ -152,6 +171,7 @@ export function record(codomain: Codec): Codec, Re } /** + * @category combinators * @since 2.2.3 */ export function array(items: Codec): Codec, Array> { @@ -159,6 +179,7 @@ export function array(items: Codec): Codec, Array> { } /** + * @category combinators * @since 2.2.3 */ export function tuple>>( @@ -170,6 +191,7 @@ export function tuple>>( } /** + * @category combinators * @since 2.2.3 */ export function intersection(left: Codec, right: Codec): Codec { @@ -177,6 +199,7 @@ export function intersection(left: Codec, right: Codec): } /** + * @category combinators * @since 2.2.3 */ export function sum( @@ -188,6 +211,7 @@ export function sum( } /** + * @category combinators * @since 2.2.3 */ export function lazy(id: string, f: () => Codec): Codec { @@ -199,6 +223,7 @@ export function lazy(id: string, f: () => Codec): Codec { // ------------------------------------------------------------------------------------- /** + * @category Invariant * @since 2.2.3 */ export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec = (f, g) => (fa) => @@ -212,11 +237,13 @@ const imap_: (fa: Codec, f: (a: A) => B, g: (b: B) => A) => Codec // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.3 */ export const URI = 'io-ts/Codec' /** + * @category instances * @since 2.2.3 */ export type URI = typeof URI @@ -228,6 +255,7 @@ declare module 'fp-ts/lib/HKT' { } /** + * @category instances * @since 2.2.3 */ export const invariantCodec: Invariant2 = { diff --git a/src/Decoder.ts b/src/Decoder.ts index 7a74c4843..910fb1090 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -15,17 +15,17 @@ import { Alt1 } from 'fp-ts/lib/Alt' // ------------------------------------------------------------------------------------- /** - * @since 2.2.2 - */ -export interface DecodeError extends NonEmptyArray> {} - -/** + * @category model * @since 2.2.0 */ export interface Decoder { readonly decode: (u: unknown) => Either } +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + /** * @since 2.2.0 */ @@ -35,9 +35,16 @@ export type TypeOf = D extends Decoder ? A : never // DecodeError // ------------------------------------------------------------------------------------- +/** + * @category DecodeError + * @since 2.2.2 + */ +export interface DecodeError extends NonEmptyArray> {} + const empty: Array = [] /** + * @category DecodeError * @since 2.2.0 */ export function tree(value: A, forest: Forest = empty): Tree { @@ -48,6 +55,7 @@ export function tree(value: A, forest: Forest = empty): Tree { } /** + * @category DecodeError * @since 2.2.0 */ export function success(a: A): Either { @@ -55,6 +63,7 @@ export function success(a: A): Either { } /** + * @category DecodeError * @since 2.2.0 */ export function failure(message: string): Either { @@ -62,6 +71,7 @@ export function failure(message: string): Either { } /** + * @category DecodeError * @since 2.2.2 */ export function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray { @@ -73,6 +83,7 @@ export function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray { // ------------------------------------------------------------------------------------- /** + * @category constructors * @since 2.2.3 */ export function of(a: A): Decoder { @@ -82,6 +93,7 @@ export function of(a: A): Decoder { } /** + * @category constructors * @since 2.2.0 */ export function fromGuard(guard: G.Guard, expected: string): Decoder { @@ -91,6 +103,7 @@ export function fromGuard(guard: G.Guard, expected: string): Decoder { } /** + * @category constructors * @since 2.2.0 */ export function literal>(...values: A): Decoder { @@ -106,31 +119,37 @@ export function literal>(...values: A): Decoder // ------------------------------------------------------------------------------------- /** + * @category primitives * @since 2.2.0 */ export const never: Decoder = fromGuard(G.never, 'never') /** + * @category primitives * @since 2.2.0 */ export const string: Decoder = fromGuard(G.string, 'string') /** + * @category primitives * @since 2.2.0 */ export const number: Decoder = fromGuard(G.number, 'number') /** + * @category primitives * @since 2.2.0 */ export const boolean: Decoder = fromGuard(G.boolean, 'boolean') /** + * @category primitives * @since 2.2.0 */ export const UnknownArray: Decoder> = fromGuard(G.UnknownArray, 'Array') /** + * @category primitives * @since 2.2.0 */ export const UnknownRecord: Decoder> = fromGuard(G.UnknownRecord, 'Record') @@ -140,6 +159,7 @@ export const UnknownRecord: Decoder> = fromGuard(G.Unkno // ------------------------------------------------------------------------------------- /** + * @category combinators * @since 2.2.0 */ export function withExpected( @@ -156,6 +176,7 @@ export function withExpected( } /** + * @category combinators * @since 2.2.0 */ export function refinement( @@ -176,6 +197,7 @@ export function refinement( } /** + * @category combinators * @since 2.2.0 */ export function parse(from: Decoder, parser: (a: A) => Either): Decoder { @@ -195,6 +217,7 @@ export function parse(from: Decoder, parser: (a: A) => Either(or: Decoder): Decoder { @@ -202,6 +225,7 @@ export function nullable(or: Decoder): Decoder { } /** + * @category combinators * @since 2.2.0 */ export function type(properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> { @@ -229,6 +253,7 @@ export function type(properties: { [K in keyof A]: Decoder }): Decoder< } /** + * @category combinators * @since 2.2.0 */ export function partial(properties: { [K in keyof A]: Decoder }): Decoder> { @@ -265,6 +290,7 @@ export function partial(properties: { [K in keyof A]: Decoder }): Decod } /** + * @category combinators * @since 2.2.0 */ export function record(codomain: Decoder): Decoder> { @@ -292,6 +318,7 @@ export function record(codomain: Decoder): Decoder> { } /** + * @category combinators * @since 2.2.0 */ export function array(items: Decoder): Decoder> { @@ -320,6 +347,7 @@ export function array(items: Decoder): Decoder> { } /** + * @category combinators * @since 2.2.0 */ export function tuple>(...components: { [K in keyof A]: Decoder }): Decoder { @@ -364,6 +392,7 @@ export function intersect(a: A, b: B): A & B { } /** + * @category combinators * @since 2.2.0 */ export function intersection(left: Decoder, right: Decoder): Decoder { @@ -383,6 +412,7 @@ export function intersection(left: Decoder, right: Decoder): Decoder } /** + * @category combinators * @since 2.2.0 */ export function lazy(id: string, f: () => Decoder): Decoder { @@ -397,6 +427,7 @@ export function lazy(id: string, f: () => Decoder): Decoder { } /** + * @category combinators * @since 2.2.0 */ export function sum(tag: T): (members: { [K in keyof A]: Decoder }) => Decoder { @@ -427,6 +458,7 @@ export function sum(tag: T): (members: { [K in keyof A]: De } /** + * @category combinators * @since 2.2.0 */ export function union>( @@ -462,6 +494,7 @@ export function union>( // ------------------------------------------------------------------------------------- /** + * @category Functor * @since 2.2.0 */ export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) @@ -474,6 +507,7 @@ const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ }) /** + * @category Alt * @since 2.2.0 */ export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) @@ -490,11 +524,13 @@ const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) = // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.0 */ export const URI = 'io-ts/Decoder' /** + * @category instances * @since 2.2.0 */ export type URI = typeof URI @@ -506,6 +542,7 @@ declare module 'fp-ts/lib/HKT' { } /** + * @category instances * @since 2.2.3 */ export const functorDecoder: Functor1 = { @@ -514,6 +551,7 @@ export const functorDecoder: Functor1 = { } /** + * @category instances * @since 2.2.3 */ export const altDecoder: Alt1 = { @@ -523,6 +561,7 @@ export const altDecoder: Alt1 = { } /** + * @category instances * @since 2.2.3 */ export const schemableDecoder: Schemable1 & diff --git a/src/Encoder.ts b/src/Encoder.ts index 794b18b2d..0da14a0da 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -12,12 +12,17 @@ import { identity } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- /** + * @category model * @since 2.2.3 */ export interface Encoder { readonly encode: (a: A) => O } +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + /** * @since 2.2.3 */ @@ -33,6 +38,7 @@ export type OutputOf = E extends Encoder ? O : never // ------------------------------------------------------------------------------------- /** + * @category constructors * @since 2.2.3 */ export function id(): Encoder { @@ -46,6 +52,7 @@ export function id(): Encoder { // ------------------------------------------------------------------------------------- /** + * @category combinators * @since 2.2.3 */ export function nullable(or: Encoder): Encoder { @@ -55,6 +62,7 @@ export function nullable(or: Encoder): Encoder { } /** + * @category combinators * @since 2.2.3 */ export function type

>>( @@ -72,6 +80,7 @@ export function type

>>( } /** + * @category combinators * @since 2.2.3 */ export function partial

>>( @@ -94,6 +103,7 @@ export function partial

>>( } /** + * @category combinators * @since 2.2.3 */ export function record(codomain: Encoder): Encoder, Record> { @@ -109,6 +119,7 @@ export function record(codomain: Encoder): Encoder } /** + * @category combinators * @since 2.2.3 */ export function array(items: Encoder): Encoder, Array> { @@ -118,6 +129,7 @@ export function array(items: Encoder): Encoder, Array> { } /** + * @category combinators * @since 2.2.3 */ export function tuple>>( @@ -129,6 +141,7 @@ export function tuple>>( } /** + * @category combinators * @since 2.2.3 */ export function intersection(left: Encoder, right: Encoder): Encoder { @@ -138,6 +151,7 @@ export function intersection(left: Encoder, right: Encoder( @@ -151,6 +165,7 @@ export function sum( } /** + * @category combinators * @since 2.2.3 */ export function lazy(f: () => Encoder): Encoder { @@ -165,6 +180,7 @@ export function lazy(f: () => Encoder): Encoder { // ------------------------------------------------------------------------------------- /** + * @category Contravariant * @since 2.2.3 */ export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = (f) => (fa) => @@ -175,6 +191,7 @@ const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder }) /** + * @category Semigroupoid * @since 2.2.3 */ export const compose: (ea: Encoder) => (ab: Encoder) => Encoder = (ea) => (ab) => @@ -189,11 +206,13 @@ const compose_: (ab: Encoder, la: Encoder) => Encoder // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.3 */ export const URI = 'io-ts/Encoder' /** + * @category instances * @since 2.2.3 */ export type URI = typeof URI @@ -205,6 +224,7 @@ declare module 'fp-ts/lib/HKT' { } /** + * @category instances * @since 2.2.3 */ export const contravariantEncoder: Contravariant2 = { @@ -213,6 +233,7 @@ export const contravariantEncoder: Contravariant2 = { } /** + * @category instances * @since 2.2.3 */ export const categoryEncoder: Category2 = { diff --git a/src/Eq.ts b/src/Eq.ts index 8ad005060..cd58591dc 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -7,6 +7,10 @@ import * as R from 'fp-ts/lib/Record' import { memoize, Schemable1, WithRefinement1, WithUnknownContainers1 } from './Schemable' import Eq = E.Eq +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + /** * @since 2.2.3 */ @@ -22,26 +26,31 @@ export type TypeOf = E extends Eq ? A : never // ------------------------------------------------------------------------------------- /** + * @category primitives * @since 2.2.2 */ export const string: Eq = E.eqString /** + * @category primitives * @since 2.2.2 */ export const number: Eq = E.eqNumber /** + * @category primitives * @since 2.2.2 */ export const boolean: Eq = E.eqBoolean /** + * @category primitives * @since 2.2.2 */ export const UnknownArray: Eq> = E.fromEquals((x, y) => x.length === y.length) /** + * @category primitives * @since 2.2.2 */ export const UnknownRecord: Eq> = E.fromEquals((x, y) => { @@ -63,6 +72,7 @@ export const UnknownRecord: Eq> = E.fromEquals((x, y) => // ------------------------------------------------------------------------------------- /** + * @category combinators * @since 2.2.2 */ export function nullable(or: Eq): Eq { @@ -72,11 +82,13 @@ export function nullable(or: Eq): Eq { } /** + * @category combinators * @since 2.2.2 */ export const type: (eqs: { [K in keyof A]: Eq }) => Eq<{ [K in keyof A]: A[K] }> = E.getStructEq /** + * @category combinators * @since 2.2.2 */ export function partial(properties: { [K in keyof A]: Eq }): Eq> { @@ -95,16 +107,19 @@ export function partial(properties: { [K in keyof A]: Eq }): Eq(codomain: Eq) => Eq> = R.getEq /** + * @category combinators * @since 2.2.2 */ export const array: (eq: Eq) => Eq> = A.getEq /** + * @category combinators * @since 2.2.2 */ export const tuple: >( @@ -112,6 +127,7 @@ export const tuple: >( ) => Eq = E.getTupleEq as any /** + * @category combinators * @since 2.2.2 */ export function intersection(left: Eq, right: Eq): Eq { @@ -121,6 +137,7 @@ export function intersection(left: Eq, right: Eq): Eq { } /** + * @category combinators * @since 2.2.2 */ export function sum(tag: T): (members: { [K in keyof A]: Eq }) => Eq { @@ -139,6 +156,7 @@ export function sum(tag: T): (members: { [K in keyof A]: Eq } /** + * @category combinators * @since 2.2.2 */ export function lazy(f: () => Eq): Eq { @@ -153,6 +171,7 @@ export function lazy(f: () => Eq): Eq { // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.3 */ export const schemableEq: Schemable1 & WithUnknownContainers1 & WithRefinement1 = { diff --git a/src/Guard.ts b/src/Guard.ts index f7b24d46c..e735c3198 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -8,12 +8,17 @@ import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownC // ------------------------------------------------------------------------------------- /** + * @category model * @since 2.2.0 */ export interface Guard { is: (u: unknown) => u is A } +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + /** * @since 2.2.2 */ @@ -24,6 +29,7 @@ export type TypeOf = G extends Guard ? A : never // ------------------------------------------------------------------------------------- /** + * @category constructors * @since 2.2.0 */ export function literal>(...values: A): Guard { @@ -37,6 +43,7 @@ export function literal>(...values: A): Guard = { @@ -44,6 +51,7 @@ export const never: Guard = { } /** + * @category primitives * @since 2.2.0 */ export const string: Guard = { @@ -51,6 +59,7 @@ export const string: Guard = { } /** + * @category primitives * @since 2.2.0 */ export const number: Guard = { @@ -58,6 +67,7 @@ export const number: Guard = { } /** + * @category primitives * @since 2.2.0 */ export const boolean: Guard = { @@ -65,6 +75,7 @@ export const boolean: Guard = { } /** + * @category primitives * @since 2.2.0 */ export const UnknownArray: Guard> = { @@ -72,6 +83,7 @@ export const UnknownArray: Guard> = { } /** + * @category primitives * @since 2.2.0 */ export const UnknownRecord: Guard> = { @@ -83,6 +95,7 @@ export const UnknownRecord: Guard> = { // ------------------------------------------------------------------------------------- /** + * @category combinators * @since 2.2.0 */ export function refinement(from: Guard, refinement: (a: A) => a is B): Guard { @@ -92,6 +105,7 @@ export function refinement(from: Guard, refinement: (a: A) => } /** + * @category combinators * @since 2.2.0 */ export function nullable(or: Guard): Guard { @@ -101,6 +115,7 @@ export function nullable(or: Guard): Guard { } /** + * @category combinators * @since 2.2.0 */ export function type(properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> { @@ -117,6 +132,7 @@ export function type(properties: { [K in keyof A]: Guard }): Guard<{ [K } /** + * @category combinators * @since 2.2.0 */ export function partial(properties: { [K in keyof A]: Guard }): Guard> { @@ -132,6 +148,7 @@ export function partial(properties: { [K in keyof A]: Guard }): Guard

(codomain: Guard): Guard> { @@ -146,6 +163,7 @@ export function record(codomain: Guard): Guard> { } /** + * @category combinators * @since 2.2.0 */ export function array(items: Guard): Guard> { @@ -153,6 +171,7 @@ export function array(items: Guard): Guard> { } /** + * @category combinators * @since 2.2.0 */ export function tuple>(...components: { [K in keyof A]: Guard }): Guard { @@ -162,6 +181,7 @@ export function tuple>(...components: { [K in k } /** + * @category combinators * @since 2.2.0 */ export function intersection(left: Guard, right: Guard): Guard { @@ -171,6 +191,7 @@ export function intersection(left: Guard, right: Guard): Guard>(...members: { [K in keyof A]: Guard }): Guard { @@ -180,6 +201,7 @@ export function union>(...members: { [K in keyo } /** + * @category combinators * @since 2.2.0 */ export function sum(tag: T): (members: { [K in keyof A]: Guard }) => Guard { @@ -194,6 +216,7 @@ export function sum(tag: T): (members: { [K in keyof A]: Gu } /** + * @category combinators * @since 2.2.0 */ export function lazy(f: () => Guard): Guard { @@ -208,11 +231,13 @@ export function lazy(f: () => Guard): Guard { // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.0 */ export const URI = 'io-ts/Guard' /** + * @category instances * @since 2.2.0 */ export type URI = typeof URI @@ -224,6 +249,7 @@ declare module 'fp-ts/lib/HKT' { } /** + * @category instances * @since 2.2.3 */ export const schemableGuard: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index e191a4d94..47e2dd9b4 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -17,10 +17,15 @@ import { Literal, Schemable1, WithRefinement1 } from './Schemable' * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` * + * @category model * @since 2.2.3 */ export interface JsonCodec extends C.Codec {} +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + /** * @since 2.2.2 */ @@ -31,11 +36,13 @@ export type TypeOf = JE.TypeOf // ------------------------------------------------------------------------------------- /** + * @category constructors * @since 2.2.3 */ export const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec = C.make /** + * @category constructors * @since 2.2.3 */ export const literal: >(...values: A) => JsonCodec = C.literal @@ -45,16 +52,19 @@ export const literal: >(...values: A) => JsonCo // ------------------------------------------------------------------------------------- /** + * @category primitives * @since 2.2.3 */ export const string: JsonCodec = C.string /** + * @category primitives * @since 2.2.3 */ export const number: JsonCodec = C.number /** + * @category primitives * @since 2.2.3 */ export const boolean: JsonCodec = C.boolean @@ -64,6 +74,7 @@ export const boolean: JsonCodec = C.boolean // ------------------------------------------------------------------------------------- /** + * @category combinators * @since 2.2.3 */ export const withExpected: ( @@ -72,6 +83,7 @@ export const withExpected: ( ) => JsonCodec = C.withExpected /** + * @category combinators * @since 2.2.3 */ export const refinement: ( @@ -81,11 +93,13 @@ export const refinement: ( ) => JsonCodec = C.refinement /** + * @category combinators * @since 2.2.3 */ export const nullable: (or: JsonCodec) => JsonCodec = C.nullable /** + * @category combinators * @since 2.2.3 */ export const type: ( @@ -93,6 +107,7 @@ export const type: ( ) => JsonCodec<{ [K in keyof A]: A[K] }> = C.type as any /** + * @category combinators * @since 2.2.3 */ export const partial: ( @@ -100,16 +115,19 @@ export const partial: ( ) => JsonCodec> = C.partial as any /** + * @category combinators * @since 2.2.3 */ export const record: (codomain: JsonCodec) => JsonCodec> = C.record /** + * @category combinators * @since 2.2.3 */ export const array: (items: JsonCodec) => JsonCodec> = C.array /** + * @category combinators * @since 2.2.3 */ export const tuple: >( @@ -117,11 +135,13 @@ export const tuple: >( ) => JsonCodec = C.tuple as any /** + * @category combinators * @since 2.2.3 */ export const intersection: (left: JsonCodec, right: JsonCodec) => JsonCodec = C.intersection /** + * @category combinators * @since 2.2.3 */ export const sum: ( @@ -129,6 +149,7 @@ export const sum: ( ) => (members: { [K in keyof A]: JsonCodec }) => JsonCodec = C.sum as any /** + * @category combinators * @since 2.2.3 */ export const lazy: (id: string, f: () => JsonCodec) => JsonCodec = C.lazy @@ -138,6 +159,7 @@ export const lazy: (id: string, f: () => JsonCodec) => JsonCodec = C.la // ------------------------------------------------------------------------------------- /** + * @category Contravariant * @since 2.2.3 */ export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) => JsonCodec = C.imap @@ -147,11 +169,13 @@ export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.3 */ export const URI = 'io-ts/JsonCodec' /** + * @category instances * @since 2.2.3 */ export type URI = typeof URI @@ -163,6 +187,7 @@ declare module 'fp-ts/lib/HKT' { } /** + * @category instances * @since 2.2.3 */ export const invariantJsonCodec: Invariant1 = { @@ -171,6 +196,7 @@ export const invariantJsonCodec: Invariant1 = { } /** + * @category instances * @since 2.2.3 */ export const schemableJsonCodec: Schemable1 & WithRefinement1 = { diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index e6f049fec..321186f80 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -11,27 +11,35 @@ import { Schemable1 } from './Schemable' // ------------------------------------------------------------------------------------- /** + * @category model * @since 2.2.3 */ export interface JsonArray extends Array {} /** + * @category model * @since 2.2.3 */ export type JsonObject = { [key: string]: Json } /** + * @category model * @since 2.2.3 */ export type Json = null | string | number | boolean | JsonObject | JsonArray /** + * @category model * @since 2.2.3 */ export interface JsonEncoder { readonly encode: (a: A) => Json } +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + /** * @since 2.2.3 */ @@ -42,6 +50,7 @@ export type TypeOf = E.TypeOf // ------------------------------------------------------------------------------------- /** + * @category primitives * @since 2.2.5 */ export function id(): JsonEncoder { @@ -55,11 +64,13 @@ export function id(): JsonEncoder { // ------------------------------------------------------------------------------------- /** + * @category combinators * @since 2.2.3 */ export const nullable: (or: JsonEncoder) => JsonEncoder = E.nullable /** + * @category combinators * @since 2.2.3 */ export const type: ( @@ -67,6 +78,7 @@ export const type: ( ) => JsonEncoder<{ [K in keyof A]: A[K] }> = E.type as any /** + * @category combinators * @since 2.2.3 */ export const partial: ( @@ -74,16 +86,19 @@ export const partial: ( ) => JsonEncoder> = E.partial as any /** + * @category combinators * @since 2.2.3 */ export const record: (codomain: JsonEncoder) => JsonEncoder> = E.record /** + * @category combinators * @since 2.2.3 */ export const array: (items: JsonEncoder) => JsonEncoder> = E.array /** + * @category combinators * @since 2.2.3 */ export const tuple: >( @@ -91,11 +106,13 @@ export const tuple: >( ) => JsonEncoder = E.tuple as any /** + * @category combinators * @since 2.2.3 */ export const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder = E.intersection /** + * @category combinators * @since 2.2.3 */ export const sum: ( @@ -103,6 +120,7 @@ export const sum: ( ) => (members: { [K in keyof A]: JsonEncoder }) => JsonEncoder = E.sum as any /** + * @category combinators * @since 2.2.3 */ export const lazy: (f: () => JsonEncoder) => JsonEncoder = E.lazy @@ -112,6 +130,7 @@ export const lazy: (f: () => JsonEncoder) => JsonEncoder = E.lazy // ------------------------------------------------------------------------------------- /** + * @category Contravariant * @since 2.2.3 */ export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder = E.contramap @@ -121,11 +140,13 @@ export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEn // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.3 */ export const URI = 'io-ts/JsonEncoder' /** + * @category instances * @since 2.2.3 */ export type URI = typeof URI @@ -137,6 +158,7 @@ declare module 'fp-ts/lib/HKT' { } /** + * @category instances * @since 2.2.3 */ export const contravariantJsonEncoder: Contravariant1 = { @@ -145,6 +167,7 @@ export const contravariantJsonEncoder: Contravariant1 = { } /** + * @category instances * @since 2.2.3 */ export const schemableJsonEncoder: Schemable1 = { diff --git a/src/Schema.ts b/src/Schema.ts index 8e5b424e7..e85a59eac 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -4,25 +4,39 @@ import { HKT, URIS, Kind } from 'fp-ts/lib/HKT' import { memoize, Schemable, Schemable1 } from './Schemable' +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + /** + * @category model * @since 2.2.0 */ export interface Schema { (S: Schemable): HKT } -/** - * @since 2.2.0 - */ -export type TypeOf = S extends Schema ? A : never +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- /** + * @category constructors * @since 2.2.0 */ export function make(schema: Schema): Schema { return memoize(schema) } +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.0 + */ +export type TypeOf = S extends Schema ? A : never + /** * @since 2.2.3 */ diff --git a/src/ThrowReporter.ts b/src/ThrowReporter.ts index 544b1f396..8d991a992 100644 --- a/src/ThrowReporter.ts +++ b/src/ThrowReporter.ts @@ -7,6 +7,7 @@ import { PathReporter } from './PathReporter' import { isLeft } from 'fp-ts/lib/Either' /** + * @category deprecated * @since 1.0.0 * @deprecated */ diff --git a/src/Type.ts b/src/Type.ts index 9c4bf8862..1b44f37b2 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -9,6 +9,7 @@ import { Literal, Schemable1, WithUnion1, WithRefinement1, WithUnknownContainers // ------------------------------------------------------------------------------------- /** + * @category model * @since 2.2.3 */ export interface Type extends t.Type {} @@ -18,6 +19,7 @@ export interface Type extends t.Type {} // ------------------------------------------------------------------------------------- /** + * @category constructors * @since 2.2.3 */ export function literal>(...values: A): Type { @@ -29,26 +31,31 @@ export function literal>(...values: A): Type = t.string /** + * @category primitives * @since 2.2.3 */ export const number: Type = t.number /** + * @category primitives * @since 2.2.3 */ export const boolean: Type = t.boolean /** + * @category primitives * @since 2.2.3 */ export const UnknownArray: Type> = t.UnknownArray /** + * @category primitives * @since 2.2.3 */ export const UnknownRecord: Type> = t.UnknownRecord @@ -58,6 +65,7 @@ export const UnknownRecord: Type> = t.UnknownRecord // ------------------------------------------------------------------------------------- /** + * @category combinators * @since 2.2.3 */ export function refinement(from: Type, refinement: (a: A) => a is B, expected: string): Type { @@ -66,6 +74,7 @@ export function refinement(from: Type, refinement: (a: A) => } /** + * @category combinators * @since 2.2.3 */ export function nullable(or: Type): Type { @@ -73,6 +82,7 @@ export function nullable(or: Type): Type { } /** + * @category combinators * @since 2.2.3 */ export function type(properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> { @@ -80,6 +90,7 @@ export function type(properties: { [K in keyof A]: Type }): Type<{ [K i } /** + * @category combinators * @since 2.2.3 */ export function partial(properties: { [K in keyof A]: Type }): Type> { @@ -87,6 +98,7 @@ export function partial(properties: { [K in keyof A]: Type }): Type(codomain: Type): Type> { @@ -94,6 +106,7 @@ export function record(codomain: Type): Type> { } /** + * @category combinators * @since 2.2.3 */ export function array(items: Type): Type> { @@ -101,6 +114,7 @@ export function array(items: Type): Type> { } /** + * @category combinators * @since 2.2.3 */ export function tuple>(...components: { [K in keyof A]: Type }): Type { @@ -108,6 +122,7 @@ export function tuple>(...components: { [K in k } /** + * @category combinators * @since 2.2.3 */ export function intersection(left: Type, right: Type): Type { @@ -115,6 +130,7 @@ export function intersection(left: Type, right: Type): Type { } /** + * @category combinators * @since 2.2.3 */ export function lazy(id: string, f: () => Type): Type { @@ -122,6 +138,7 @@ export function lazy(id: string, f: () => Type): Type { } /** + * @category combinators * @since 2.2.3 */ export function sum(_tag: T): (members: { [K in keyof A]: Type }) => Type { @@ -129,6 +146,7 @@ export function sum(_tag: T): (members: { [K in keyof A]: T } /** + * @category combinators * @since 2.2.3 */ export function union>(...members: { [K in keyof A]: Type }): Type { @@ -140,11 +158,13 @@ export function union>(...members: { [K in keyo // ------------------------------------------------------------------------------------- /** + * @category instances * @since 2.2.3 */ export const URI = 'io-ts/Type' /** + * @category instances * @since 2.2.3 */ export type URI = typeof URI @@ -156,6 +176,7 @@ declare module 'fp-ts/lib/HKT' { } /** + * @category instances * @since 2.2.3 */ export const schemableType: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { diff --git a/src/index.ts b/src/index.ts index fabe410f9..09af4c6a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,12 @@ import { Either, isLeft, left, right } from 'fp-ts/lib/Either' import { Predicate, Refinement } from 'fp-ts/lib/function' +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + /** + * @category Model * @since 1.0.0 */ export interface ContextEntry { @@ -15,11 +20,13 @@ export interface ContextEntry { } /** + * @category Model * @since 1.0.0 */ export interface Context extends ReadonlyArray {} /** + * @category Model * @since 1.0.0 */ export interface ValidationError { @@ -32,31 +39,37 @@ export interface ValidationError { } /** + * @category Model * @since 1.0.0 */ export interface Errors extends Array {} /** + * @category Model * @since 1.0.0 */ export type Validation = Either /** + * @category Model * @since 1.0.0 */ export type Is = (u: unknown) => u is A /** + * @category Model * @since 1.0.0 */ export type Validate = (i: I, context: Context) => Validation /** + * @category Model * @since 1.0.0 */ export type Decode = (i: I) => Validation /** + * @category Model * @since 1.0.0 */ export type Encode = (a: A) => O @@ -87,6 +100,7 @@ export type InputOf = C['_I'] export type OutputOf = C['_O'] /** + * @category Model * @since 1.0.0 */ export interface Decoder { @@ -96,6 +110,7 @@ export interface Decoder { } /** + * @category Model * @since 1.0.0 */ export interface Encoder { @@ -103,6 +118,7 @@ export interface Encoder { } /** + * @category Model * @since 1.0.0 */ export class Type implements Decoder, Encoder { @@ -225,9 +241,9 @@ const pushAll = (xs: Array, ys: Array): void => { } } -// -// basic types -// +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- /** * @since 1.0.0 @@ -253,6 +269,7 @@ export class NullType extends Type { export interface NullC extends NullType {} /** + * @category Primitives * @since 1.0.0 */ export const nullType: NullC = new NullType() @@ -301,6 +318,7 @@ export class VoidType extends Type { export interface VoidC extends VoidType {} /** + * @category Primitives * @since 1.2.0 */ export const voidType: VoidC = new VoidType() @@ -324,6 +342,7 @@ export class UnknownType extends Type { export interface UnknownC extends UnknownType {} /** + * @category Primitives * @since 1.5.0 */ export const unknown: UnknownC = new UnknownType() @@ -352,6 +371,7 @@ export class StringType extends Type { export interface StringC extends StringType {} /** + * @category Primitives * @since 1.0.0 */ export const string: StringC = new StringType() @@ -380,6 +400,7 @@ export class NumberType extends Type { export interface NumberC extends NumberType {} /** + * @category Primitives * @since 1.0.0 */ export const number: NumberC = new NumberType() @@ -409,6 +430,7 @@ export class BigIntType extends Type { export interface BigIntC extends BigIntType {} /** + * @category Primitives * @since 2.1.0 */ export const bigint: BigIntC = new BigIntType() @@ -437,6 +459,7 @@ export class BooleanType extends Type { export interface BooleanC extends BooleanType {} /** + * @category Primitives * @since 1.0.0 */ export const boolean: BooleanC = new BooleanType() @@ -460,6 +483,7 @@ export class AnyArrayType extends Type> { export interface UnknownArrayC extends AnyArrayType {} /** + * @category Primitives * @since 1.7.1 */ export const UnknownArray: UnknownArrayC = new AnyArrayType() @@ -486,6 +510,7 @@ export class AnyDictionaryType extends Type<{ [key: string]: unknown }> { } /** + * @category Primitives * @since 1.7.1 */ export const UnknownRecord: UnknownRecordC = new AnyDictionaryType() @@ -496,6 +521,7 @@ export const UnknownRecord: UnknownRecordC = new AnyDictionaryType() export interface UnknownRecordC extends AnyDictionaryType {} /** + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -516,6 +542,7 @@ export class FunctionType extends Type { } /** + * @category deprecated * @since 1.5.3 * @deprecated */ @@ -523,6 +550,7 @@ export class FunctionType extends Type { export interface FunctionC extends FunctionType {} /** + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -568,7 +596,12 @@ export type Branded = A & Brand */ export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + /** + * @category Combinators * @since 1.8.1 */ export const brand = ( @@ -589,6 +622,8 @@ export interface IntBrand { /** * A branded codec representing an integer + * + * @category Primitives * @since 1.8.1 */ export const Int = brand(number, (n): n is Branded => Number.isInteger(n), 'Int') @@ -625,6 +660,7 @@ export class LiteralType extends Type { export interface LiteralC extends LiteralType {} /** + * @category Combinators * @since 1.0.0 */ export const literal = (value: V, name: string = JSON.stringify(value)): LiteralC => { @@ -659,6 +695,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty export interface KeyofC extends KeyofType {} /** + * @category Combinators * @since 1.0.0 */ export const keyof = ( @@ -703,6 +740,7 @@ Object.defineProperty(RecursiveType.prototype, 'type', { }) /** + * @category Combinators * @since 1.0.0 */ export const recursion = = Type>( @@ -752,6 +790,7 @@ export class ArrayType extends Type< export interface ArrayC extends ArrayType>, Array>, unknown> {} /** + * @category Combinators * @since 1.0.0 */ export const array = (codec: C, name: string = `Array<${codec.name}>`): ArrayC => @@ -856,6 +895,7 @@ const getInterfaceTypeName = (props: Props): string => { } /** + * @category Combinators * @since 1.0.0 */ export const type =

(props: P, name: string = getInterfaceTypeName(props)): TypeC

=> { @@ -962,6 +1002,7 @@ const getPartialTypeName = (inner: string): string => { } /** + * @category Combinators * @since 1.0.0 */ export const partial =

( @@ -1200,6 +1241,7 @@ function nonEnumerableRecord( } /** + * @category Combinators * @since 1.7.1 */ export function record(domain: D, codomain: C, name?: string): RecordC { @@ -1239,6 +1281,7 @@ const getUnionName = ]>(codecs: CS): s } /** + * @category Combinators * @since 1.0.0 */ export const union = ]>( @@ -1401,6 +1444,7 @@ const mergeAll = (base: any, us: Array): any => { } /** + * @category Combinators * @since 1.0.0 */ export function intersection( @@ -1502,6 +1546,7 @@ export interface TupleC]> > {} /** + * @category Combinators * @since 1.0.0 */ export function tuple( @@ -1584,6 +1629,7 @@ export interface ReadonlyC extends ReadonlyType>, Readonly>, unknown> {} /** + * @category Combinators * @since 1.0.0 */ export const readonly = (codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC => { @@ -1632,6 +1678,7 @@ export interface ReadonlyArrayC extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} /** + * @category Combinators * @since 1.0.0 */ export const readonlyArray = ( @@ -1660,6 +1707,8 @@ export const readonlyArray = ( /** * Strips additional properties + * + * @category Combinators * @since 1.0.0 */ export const strict =

(props: P, name?: string): ExactC> => { @@ -1667,6 +1716,7 @@ export const strict =

(props: P, name?: string): ExactC { } /** + * @category deprecated * @since 1.5.3 * @deprecated */ @@ -1929,6 +1991,7 @@ export class NeverType extends Type { export interface NeverC extends NeverType {} /** + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -1936,6 +1999,7 @@ export interface NeverC extends NeverType {} export const never: NeverC = new NeverType() /** + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -1950,6 +2014,7 @@ export class AnyType extends Type { } /** + * @category deprecated * @since 1.5.3 * @deprecated */ @@ -1958,6 +2023,8 @@ export interface AnyC extends AnyType {} /** * Use `unknown` instead + * + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -1966,12 +2033,15 @@ export const any: AnyC = new AnyType() /** * Use `UnknownRecord` instead + * + * @category deprecated * @since 1.0.0 * @deprecated */ export const Dictionary: UnknownRecordC = UnknownRecord /** + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -1991,6 +2061,7 @@ export class ObjectType extends Type { } /** + * @category deprecated * @since 1.5.3 * @deprecated */ @@ -1999,6 +2070,8 @@ export interface ObjectC extends ObjectType {} /** * Use `UnknownRecord` instead + * + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2007,6 +2080,8 @@ export const object: ObjectC = new ObjectType() /** * Use `BrandC` instead + * + * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2014,6 +2089,8 @@ export interface RefinementC extends RefinementType, /** * Use `brand` instead + * + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2042,6 +2119,8 @@ RefinementC { /** * Use `Int` instead + * + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2050,6 +2129,8 @@ export const Integer = refinement(number, Number.isInteger, 'Integer') /** * Use `record` instead + * + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2057,12 +2138,15 @@ export const dictionary: typeof record = record /** * used in `intersection` as a workaround for #234 + * + * @category deprecated * @since 1.4.2 * @deprecated */ export type Compact = { [K in keyof A]: A[K] } /** + * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2086,6 +2170,7 @@ export class StrictType extends Type { } /** + * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2093,23 +2178,30 @@ export interface StrictC

// tslint:disable-next-line: deprecat extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} /** + * @category deprecated * @since 1.3.0 * @deprecated */ export type TaggedProps = { [K in Tag]: LiteralType } + /** + * @category deprecated * @since 1.3.0 * @deprecated */ // tslint:disable-next-line: deprecation export interface TaggedRefinement extends RefinementType, A, O> {} + /** + * @category deprecated * @since 1.3.0 * @deprecated */ // tslint:disable-next-line: deprecation export interface TaggedUnion extends UnionType>, A, O> {} + /** + * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2144,19 +2236,25 @@ export type TaggedIntersectionArgument = | [Mixed, Mixed, Mixed, Tagged, Mixed] // tslint:disable-next-line: deprecation | [Mixed, Mixed, Mixed, Mixed, Tagged] + /** + * @category deprecated * @since 1.3.0 * @deprecated */ export interface TaggedIntersection // tslint:disable-next-line: deprecation extends IntersectionType, A, O> {} + /** + * @category deprecated * @since 1.3.0 * @deprecated */ // tslint:disable-next-line: deprecation export interface TaggedExact extends ExactType, A, O> {} + /** + * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2177,6 +2275,8 @@ export type Tagged = /** * Drops the codec "kind" + * + * @category deprecated * @since 1.1.0 * @deprecated */ @@ -2185,12 +2285,14 @@ export function clean(codec: Type): Type = T['props'] /** + * @category deprecated * @since 1.1.0 * @deprecated */ @@ -2199,6 +2301,8 @@ export type Exact = T & /** * Keeps the codec "kind" + * + * @category deprecated * @since 1.1.0 * @deprecated */ From 6526525a0f2bd4eff0c7853ffa63888d1b52f9e5 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 16 Jun 2020 12:23:55 +0200 Subject: [PATCH 045/222] add support for non-`string` tag values to `sum`, closes #481 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/Decoder.ts | 8 ++++---- src/Guard.ts | 6 +++--- test/Decoder.ts | 15 +++++++++++++++ test/Guard.ts | 10 ++++++++++ test/Schema.ts | 8 -------- 7 files changed, 39 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c108d1d15..b9bf62958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.6 + +- **Experimental** + - `Decoder` + - add support for non-`string` tag values to `sum`, closes #481 (@gcanti) + # 2.2.5 - **Experimental** diff --git a/package.json b/package.json index a53acf29a..6f0ce9136 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.5", + "version": "2.2.6", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", diff --git a/src/Decoder.ts b/src/Decoder.ts index 910fb1090..ed478d7d0 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -431,7 +431,7 @@ export function lazy(id: string, f: () => Decoder): Decoder { * @since 2.2.0 */ export function sum(tag: T): (members: { [K in keyof A]: Decoder }) => Decoder { - return (members) => { + return (members: { [K in keyof A]: Decoder }) => { const keys = Object.keys(members) if (keys.length === 0) { return never @@ -443,9 +443,9 @@ export function sum(tag: T): (members: { [K in keyof A]: De if (isLeft(e)) { return e } - const v = e.right[tag] - if (G.string.is(v) && v in members) { - return (members as any)[v].decode(u) + const v = e.right[tag] as keyof A + if (v in members) { + return members[v].decode(u) } return left([ tree(`required property ${JSON.stringify(tag)}`, [ diff --git a/src/Guard.ts b/src/Guard.ts index e735c3198..da54a2780 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -205,10 +205,10 @@ export function union>(...members: { [K in keyo * @since 2.2.0 */ export function sum(tag: T): (members: { [K in keyof A]: Guard }) => Guard { - return (members: Record>) => + return (members: { [K in keyof A]: Guard }) => refinement(UnknownRecord, (r): r is any => { - const v = r[tag] - if (string.is(v) && v in members) { + const v = r[tag] as keyof A + if (v in members) { return members[v].is(r) } return false diff --git a/test/Decoder.ts b/test/Decoder.ts index 80ed42c95..a04636b3b 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -55,6 +55,21 @@ describe('Decoder', () => { }) }) + describe('sum', () => { + it('should support non-`string` tag values', () => { + const decoder = D.sum('_tag')({ + true: D.type({ _tag: D.literal(true), a: D.string }), + false: D.type({ _tag: D.literal(false), b: D.number }) + }) + assert.deepStrictEqual(decoder.decode({ _tag: true, a: 'a' }), E.right({ _tag: true, a: 'a' })) + assert.deepStrictEqual(decoder.decode({ _tag: false, b: 1 }), E.right({ _tag: false, b: 1 })) + assert.deepStrictEqual( + decoder.decode({ _tag: false, b: 'a' }), + E.left([D.tree('required property "b"', [D.tree('cannot decode "a", should be number')])]) + ) + }) + }) + describe('intersect', () => { it('should concat strings', () => { assert.deepStrictEqual(D.intersect('a', 'b'), 'b') diff --git a/test/Guard.ts b/test/Guard.ts index 4c910e758..6847264ce 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -230,5 +230,15 @@ describe('Guard', () => { assert.deepStrictEqual(sum({}).is(null), false) assert.deepStrictEqual(sum({}).is({}), false) }) + + it('should support non-`string` tag values', () => { + const guard = G.sum('_tag')({ + true: G.type({ _tag: G.literal(true), a: G.string }), + false: G.type({ _tag: G.literal(false), b: G.number }) + }) + assert.deepStrictEqual(guard.is({ _tag: true, a: 'a' }), true) + assert.deepStrictEqual(guard.is({ _tag: false, b: 1 }), true) + assert.deepStrictEqual(guard.is({ _tag: false, b: 'a' }), false) + }) }) }) diff --git a/test/Schema.ts b/test/Schema.ts index 1f9532466..027e35a2b 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -121,12 +121,4 @@ describe('Schema', () => { ) check(schema) }) - - // it('UnknownArray', () => { - // check(make((S) => S.UnknownArray)) - // }) - - // it('UnknownRecord', () => { - // check(make((S) => S.UnknownRecord)) - // }) }) From 8ae6b3686878ce4db23e9327c336f03c6752c01d Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 16 Jun 2020 13:04:38 +0200 Subject: [PATCH 046/222] `intersection` should accumulate all errors --- CHANGELOG.md | 1 + src/Decoder.ts | 70 +++++++++++++++++++++++++------------------------ test/Codec.ts | 12 --------- test/Decoder.ts | 21 +++++++++++++++ 4 files changed, 58 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9bf62958..e8a37c2d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - **Experimental** - `Decoder` - add support for non-`string` tag values to `sum`, closes #481 (@gcanti) + - `intersection` should accumulate all errors (@gcanti) # 2.2.5 diff --git a/src/Decoder.ts b/src/Decoder.ts index ed478d7d0..f92eb4fbf 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -1,7 +1,7 @@ /** * @since 2.2.0 */ -import { Either, isLeft, isRight, left, mapLeft, right } from 'fp-ts/lib/Either' +import * as E from 'fp-ts/lib/Either' import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' import { Forest, Tree } from 'fp-ts/lib/Tree' @@ -14,6 +14,8 @@ import { Alt1 } from 'fp-ts/lib/Alt' // model // ------------------------------------------------------------------------------------- +import Either = E.Either + /** * @category model * @since 2.2.0 @@ -59,7 +61,7 @@ export function tree(value: A, forest: Forest = empty): Tree { * @since 2.2.0 */ export function success(a: A): Either { - return right(a) + return E.right(a) } /** @@ -67,7 +69,7 @@ export function success(a: A): Either { * @since 2.2.0 */ export function failure(message: string): Either { - return left([tree(message)]) + return E.left([tree(message)]) } /** @@ -170,7 +172,7 @@ export function withExpected( decode: (u) => pipe( decoder.decode(u), - mapLeft((nea) => expected(u, nea)) + E.mapLeft((nea) => expected(u, nea)) ) } } @@ -187,7 +189,7 @@ export function refinement( return { decode: (u) => { const e = from.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } const a = e.right @@ -204,11 +206,11 @@ export function parse(from: Decoder, parser: (a: A) => Either { const e = from.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } const pe = parser(e.right) - if (isLeft(pe)) { + if (E.isLeft(pe)) { return failure(pe.left) } return pe @@ -232,7 +234,7 @@ export function type(properties: { [K in keyof A]: Decoder }): Decoder< return { decode: (u) => { const e = UnknownRecord.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } else { const r = e.right @@ -240,13 +242,13 @@ export function type(properties: { [K in keyof A]: Decoder }): Decoder< const errors: Array> = [] for (const k in properties) { const e = properties[k].decode(r[k]) - if (isLeft(e)) { + if (E.isLeft(e)) { errors.push(tree(`required property ${JSON.stringify(k)}`, e.left)) } else { a[k] = e.right } } - return isNotEmpty(errors) ? left(errors) : success(a as A) + return isNotEmpty(errors) ? E.left(errors) : success(a as A) } } } @@ -260,7 +262,7 @@ export function partial(properties: { [K in keyof A]: Decoder }): Decod return { decode: (u) => { const e = UnknownRecord.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } else { const r = e.right @@ -275,7 +277,7 @@ export function partial(properties: { [K in keyof A]: Decoder }): Decod a[k] = undefined } else { const e = properties[k].decode(rk) - if (isLeft(e)) { + if (E.isLeft(e)) { errors.push(tree(`optional property ${JSON.stringify(k)}`, e.left)) } else { a[k] = e.right @@ -283,7 +285,7 @@ export function partial(properties: { [K in keyof A]: Decoder }): Decod } } } - return isNotEmpty(errors) ? left(errors) : success(a) + return isNotEmpty(errors) ? E.left(errors) : success(a) } } } @@ -297,7 +299,7 @@ export function record(codomain: Decoder): Decoder> { return { decode: (u) => { const e = UnknownRecord.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } else { const r = e.right @@ -305,13 +307,13 @@ export function record(codomain: Decoder): Decoder> { const errors: Array> = [] for (const k in r) { const e = codomain.decode(r[k]) - if (isLeft(e)) { + if (E.isLeft(e)) { errors.push(tree(`key ${JSON.stringify(k)}`, e.left)) } else { a[k] = e.right } } - return isNotEmpty(errors) ? left(errors) : success(a) + return isNotEmpty(errors) ? E.left(errors) : success(a) } } } @@ -325,7 +327,7 @@ export function array(items: Decoder): Decoder> { return { decode: (u) => { const e = UnknownArray.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } else { const us = e.right @@ -334,13 +336,13 @@ export function array(items: Decoder): Decoder> { const errors: Array> = [] for (let i = 0; i < len; i++) { const e = items.decode(us[i]) - if (isLeft(e)) { + if (E.isLeft(e)) { errors.push(tree(`item ${i}`, e.left)) } else { a[i] = e.right } } - return isNotEmpty(errors) ? left(errors) : success(a) + return isNotEmpty(errors) ? E.left(errors) : success(a) } } } @@ -354,7 +356,7 @@ export function tuple>(...components: { [K in k return { decode: (u) => { const e = UnknownArray.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } const us = e.right @@ -362,13 +364,13 @@ export function tuple>(...components: { [K in k const errors: Array> = [] for (let i = 0; i < components.length; i++) { const e = components[i].decode(us[i]) - if (isLeft(e)) { + if (E.isLeft(e)) { errors.push(tree(`component ${i}`, e.left)) } else { a.push(e.right) } } - return isNotEmpty(errors) ? left(errors) : success(a as any) + return isNotEmpty(errors) ? E.left(errors) : success(a as any) } } } @@ -399,11 +401,11 @@ export function intersection(left: Decoder, right: Decoder): Decoder return { decode: (u) => { const ea = left.decode(u) - if (isLeft(ea)) { - return ea - } const eb = right.decode(u) - if (isLeft(eb)) { + if (E.isLeft(ea)) { + return E.isLeft(eb) ? E.left(ea.left.concat(eb.left) as DecodeError) : ea + } + if (E.isLeft(eb)) { return eb } return success(intersect(ea.right, eb.right)) @@ -421,7 +423,7 @@ export function lazy(id: string, f: () => Decoder): Decoder { decode: (u) => pipe( get().decode(u), - mapLeft((nea) => [tree(id, nea)]) + E.mapLeft((nea) => [tree(id, nea)]) ) } } @@ -440,14 +442,14 @@ export function sum(tag: T): (members: { [K in keyof A]: De return { decode: (u) => { const e = UnknownRecord.decode(u) - if (isLeft(e)) { + if (E.isLeft(e)) { return e } const v = e.right[tag] as keyof A if (v in members) { return members[v].decode(u) } - return left([ + return E.left([ tree(`required property ${JSON.stringify(tag)}`, [ tree(`cannot decode ${JSON.stringify(v)}, should be ${expected}`) ]) @@ -471,19 +473,19 @@ export function union>( return { decode: (u) => { const e = members[0].decode(u) - if (isRight(e)) { + if (E.isRight(e)) { return e } else { const errors: DecodeError = [tree(`member 0`, e.left)] for (let i = 1; i < len; i++) { const e = members[i].decode(u) - if (isRight(e)) { + if (E.isRight(e)) { return e } else { errors.push(tree(`member ${i}`, e.left)) } } - return left(errors) + return E.left(errors) } } } @@ -502,7 +504,7 @@ export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ decode: (u) => { const e = fa.decode(u) - return isLeft(e) ? e : right(f(e.right)) + return E.isLeft(e) ? e : E.right(f(e.right)) } }) @@ -515,7 +517,7 @@ export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) => ({ decode: (u) => { const e = fx.decode(u) - return isLeft(e) ? fy().decode(u) : e + return E.isLeft(e) ? fy().decode(u) : e } }) diff --git a/test/Codec.ts b/test/Codec.ts index c9c30e14e..7b3809e56 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -501,18 +501,6 @@ describe('Codec', () => { const codec = C.intersection(Int, Positive) assert.deepStrictEqual(codec.decode(1), right(1)) }) - - it('should reject an invalid input', () => { - const codec = C.intersection(C.type({ a: C.string }), C.type({ b: C.number })) - assert.deepStrictEqual( - codec.decode({ a: 'a' }), - left([D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')])]) - ) - assert.deepStrictEqual( - codec.decode({ b: 1 }), - left([D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')])]) - ) - }) }) describe('encode', () => { diff --git a/test/Decoder.ts b/test/Decoder.ts index a04636b3b..81f762e74 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -70,6 +70,27 @@ describe('Decoder', () => { }) }) + describe('intersection', () => { + it('should accumulate all errors', () => { + const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + assert.deepStrictEqual( + decoder.decode({}), + E.left([ + D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')]), + D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')]) + ]) + ) + assert.deepStrictEqual( + decoder.decode({ b: 1 }), + E.left([D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')])]) + ) + assert.deepStrictEqual( + decoder.decode({ a: 'a' }), + E.left([D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')])]) + ) + }) + }) + describe('intersect', () => { it('should concat strings', () => { assert.deepStrictEqual(D.intersect('a', 'b'), 'b') From b4c89afcef9b41375f9867185c360fde901495b6 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 20 Jun 2020 11:54:35 +0200 Subject: [PATCH 047/222] POC DecoderT --- package.json | 2 +- src/DecoderT.ts | 103 +++++++++++++++++++++++++++++++++++++++++++++++ test/DecoderT.ts | 76 ++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 src/DecoderT.ts create mode 100644 test/DecoderT.ts diff --git a/package.json b/package.json index 6f0ce9136..cebb3cc34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.6", + "version": "2.2.7", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", diff --git a/src/DecoderT.ts b/src/DecoderT.ts new file mode 100644 index 000000000..929ad3b51 --- /dev/null +++ b/src/DecoderT.ts @@ -0,0 +1,103 @@ +/** + * @since 2.2.7 + */ +import { Applicative2C } from 'fp-ts/lib/Applicative' +import * as A from 'fp-ts/lib/Array' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import { Kind2, URIS2 } from 'fp-ts/lib/HKT' +import { Monad2C } from 'fp-ts/lib/Monad' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import { pipe } from 'fp-ts/lib/pipeable' +import * as G from './Guard' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface DecoderT { + readonly decode: (u: unknown) => Kind2 +} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (M: MonadThrow2C) => ( + guard: G.Guard, + onError: (u: unknown) => E +): DecoderT => { + return { + decode: (u) => (guard.is(u) ? M.of(u) : M.throwError(onError(u))) + } +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @category primitives + * @since 2.2.7 + */ +export const string = (M: MonadThrow2C) => ( + onError: (u: unknown) => E +): DecoderT => { + return fromGuard(M)(G.string, onError) +} + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownArray = (M: MonadThrow2C) => ( + onError: (u: unknown) => E +): DecoderT> => { + return fromGuard(M)(G.UnknownArray, onError) +} + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +const traverseWithIndex = (M: Applicative2C) => ( + ta: Array, + f: (i: number, a: A) => Kind2 +): Kind2> => { + return pipe( + ta, + A.reduceWithIndex(M.of>([]), (i, fbs, a) => + M.ap( + M.map(fbs, (bs) => (b: B) => { + bs.push(b) + return bs + }), + f(i, a) + ) + ) + ) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export const array = (M: Monad2C & Bifunctor2) => ( + UnknownArray: DecoderT>, + onItemError: (i: number, e: E) => E +) => (items: DecoderT): DecoderT> => { + const traverseWithIndexM = traverseWithIndex(M) + return { + decode: (u) => + M.chain(UnknownArray.decode(u), (us) => + traverseWithIndexM(us, (i, u) => M.mapLeft(items.decode(u), (e) => onItemError(i, e))) + ) + } +} diff --git a/test/DecoderT.ts b/test/DecoderT.ts new file mode 100644 index 000000000..e1ec08823 --- /dev/null +++ b/test/DecoderT.ts @@ -0,0 +1,76 @@ +import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import * as NEA from 'fp-ts/lib/NonEmptyArray' +import * as DT from '../src/DecoderT' +import { pipe } from 'fp-ts/lib/pipeable' +import * as TE from 'fp-ts/lib/TaskEither' +import * as T from 'fp-ts/lib/Tree' +import { draw } from '../src/Tree' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' + +describe('DecoderT', () => { + it('should support synchronous decoders', () => { + const M = E.getValidation(NEA.getSemigroup()) + const UnknownArray = DT.UnknownArray(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be Array`]) + const array = DT.array(M)(UnknownArray, (i, e) => + pipe( + e, + NEA.map((s) => `item ${i}: ${s}`) + ) + ) + const string = DT.string(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be string`]) + const decoder = array(string) + assert.deepStrictEqual(decoder.decode(['a', 'b']), E.right(['a', 'b'])) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left(['item 0: cannot decode 1, should be string', 'item 1: cannot decode 2, should be string']) + ) + }) + + it('should support asynchronous decoders', async () => { + const M = TE.getTaskValidation(NEA.getSemigroup()) + const UnknownArray = DT.UnknownArray(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be Array`]) + const array = DT.array(M)(UnknownArray, (i, e) => + pipe( + e, + NEA.map((s) => `item ${i}: ${s}`) + ) + ) + const string = DT.string(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be string`]) + const decoder = array(string) + assert.deepStrictEqual(await decoder.decode(['a', 'b'])(), E.right(['a', 'b'])) + assert.deepStrictEqual( + await decoder.decode([1, 2])(), + E.left(['item 0: cannot decode 1, should be string', 'item 1: cannot decode 2, should be string']) + ) + }) + + it('should support fail fast decoders', () => { + const M: MonadThrow2C & Bifunctor2 = E.either as any + const UnknownArray = DT.UnknownArray(M)((u) => `cannot decode ${JSON.stringify(u)}, should be Array`) + const array = DT.array(M)(UnknownArray, (i, e) => `item ${i}: ${e}`) + const string = DT.string(M)((u) => `cannot decode ${JSON.stringify(u)}, should be string`) + const decoder = array(string) + assert.deepStrictEqual(decoder.decode(['a', 'b']), E.right(['a', 'b'])) + assert.deepStrictEqual(decoder.decode([1, 2]), E.left('item 0: cannot decode 1, should be string')) + }) + + it('should support default DecoderError', () => { + const M = E.getValidation(NEA.getSemigroup>()) + const UnknownArray = DT.UnknownArray(M)((u) => [ + T.make(`cannot decode ${JSON.stringify(u)}, should be Array`) + ]) + const array = DT.array(M)(UnknownArray, (i, e) => [T.make(`item ${i}`, e)]) + const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) + const decoder = array(string) + assert.deepStrictEqual(decoder.decode(['a', 'b']), E.right(['a', 'b'])) + assert.deepStrictEqual( + pipe(decoder.decode([1, 2]), E.mapLeft(draw)), + E.left(`item 0 +└─ cannot decode 1, should be string +item 1 +└─ cannot decode 2, should be string`) + ) + }) +}) From 969d5ce257d08e66738d65978b500fd8abb7dcfe Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 20 Jun 2020 19:15:49 +0200 Subject: [PATCH 048/222] DecoderT: add more combinators --- docs/modules/DecoderT.ts.md | 183 +++++++++++++++++++++++++++++++ docs/modules/Encoder.ts.md | 2 +- docs/modules/Eq.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/Tree.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 2 +- src/DecoderT.ts | 185 ++++++++++++++++++++++++++++---- test/DecoderT.ts | 133 +++++++++++++++++------ 15 files changed, 459 insertions(+), 66 deletions(-) create mode 100644 docs/modules/DecoderT.ts.md diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md new file mode 100644 index 000000000..bf299d489 --- /dev/null +++ b/docs/modules/DecoderT.ts.md @@ -0,0 +1,183 @@ +--- +title: DecoderT.ts +nav_order: 3 +parent: Modules +--- + +## DecoderT overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [combinators](#combinators) + - [array](#array) + - [partial](#partial) + - [record](#record) + - [type](#type) +- [constructors](#constructors) + - [fromGuard](#fromguard) +- [model](#model) + - [DecoderT (interface)](#decodert-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) + +--- + +# combinators + +## array + +**Signature** + +```ts +export declare function array( + M: Monad2C & Bifunctor2 +): ( + UnknownArray: DecoderT>, + onItemError: (i: number, e: E) => E +) => (items: DecoderT) => DecoderT> +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare function partial( + M: Monad2C & Bifunctor2 +): ( + UnknownRecord: DecoderT>, + onKeyError: (k: string, e: E) => E +) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare function record( + M: Monad2C & Bifunctor2 +): ( + UnknownRecord: DecoderT>, + onKeyError: (k: string, e: E) => E +) => (codomain: DecoderT) => DecoderT> +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare function type( + M: Monad2C & Bifunctor2 +): ( + UnknownRecord: DecoderT>, + onKeyError: (k: string, e: E) => E +) => (properties: { [K in keyof A]: DecoderT }) => DecoderT +``` + +Added in v2.2.7 + +# constructors + +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: ( + M: MonadThrow2C +) => (guard: G.Guard, onError: (u: unknown) => E) => DecoderT +``` + +Added in v2.2.7 + +# model + +## DecoderT (interface) + +**Signature** + +```ts +export interface DecoderT { + readonly decode: (u: unknown) => Kind2 +} +``` + +Added in v2.2.7 + +# primitives + +## UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: ( + M: MonadThrow2C +) => (onError: (u: unknown) => E) => DecoderT +``` + +Added in v2.2.7 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: ( + M: MonadThrow2C +) => (onError: (u: unknown) => E) => DecoderT> +``` + +Added in v2.2.7 + +## boolean + +**Signature** + +```ts +export declare const boolean: ( + M: MonadThrow2C +) => (onError: (u: unknown) => E) => DecoderT +``` + +Added in v2.2.7 + +## number + +**Signature** + +```ts +export declare const number: ( + M: MonadThrow2C +) => (onError: (u: unknown) => E) => DecoderT +``` + +Added in v2.2.7 + +## string + +**Signature** + +```ts +export declare const string: ( + M: MonadThrow2C +) => (onError: (u: unknown) => E) => DecoderT +``` + +Added in v2.2.7 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index cd256ba27..3fbead376 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -1,6 +1,6 @@ --- title: Encoder.ts -nav_order: 3 +nav_order: 4 parent: Modules --- diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 3bc87ee98..da2131a3d 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -1,6 +1,6 @@ --- title: Eq.ts -nav_order: 4 +nav_order: 5 parent: Modules --- diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 7537b4c6c..6a16d5636 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -1,6 +1,6 @@ --- title: Guard.ts -nav_order: 5 +nav_order: 6 parent: Modules --- diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 732cf2148..6deceb8a1 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -1,6 +1,6 @@ --- title: JsonCodec.ts -nav_order: 7 +nav_order: 8 parent: Modules --- diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 92f1ace90..345da476c 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 8 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index a6a32698e..215c43320 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 9 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index a765eca60..893dd233c 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 10 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 2a34ea3f8..efa60a67f 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 11 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 75b14285e..358fbe08f 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 12 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index 0362f33e6..45e213636 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -1,6 +1,6 @@ --- title: Tree.ts -nav_order: 13 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index dfe598061..2a2fc3b36 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 14 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 7dd95a5ce..797e1b789 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 6 +nav_order: 7 parent: Modules --- diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 929ad3b51..a16563dd1 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -2,13 +2,12 @@ * @since 2.2.7 */ import { Applicative2C } from 'fp-ts/lib/Applicative' -import * as A from 'fp-ts/lib/Array' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import { pipe } from 'fp-ts/lib/pipeable' import * as G from './Guard' +import * as E from 'fp-ts/lib/Either' // ------------------------------------------------------------------------------------- // model @@ -53,6 +52,26 @@ export const string = (M: MonadThrow2C) => ( return fromGuard(M)(G.string, onError) } +/** + * @category primitives + * @since 2.2.7 + */ +export const number = (M: MonadThrow2C) => ( + onError: (u: unknown) => E +): DecoderT => { + return fromGuard(M)(G.number, onError) +} + +/** + * @category primitives + * @since 2.2.7 + */ +export const boolean = (M: MonadThrow2C) => ( + onError: (u: unknown) => E +): DecoderT => { + return fromGuard(M)(G.boolean, onError) +} + /** * @category primitives * @since 2.2.7 @@ -63,41 +82,161 @@ export const UnknownArray = (M: MonadThrow2C) => ( return fromGuard(M)(G.UnknownArray, onError) } +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownRecord = (M: MonadThrow2C) => ( + onError: (u: unknown) => E +): DecoderT> => { + return fromGuard(M)(G.UnknownRecord, onError) +} + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- -const traverseWithIndex = (M: Applicative2C) => ( - ta: Array, - f: (i: number, a: A) => Kind2 -): Kind2> => { - return pipe( - ta, - A.reduceWithIndex(M.of>([]), (i, fbs, a) => - M.ap( - M.map(fbs, (bs) => (b: B) => { - bs.push(b) - return bs - }), - f(i, a) - ) - ) - ) +/** + * @category combinators + * @since 2.2.7 + */ +export function type( + M: Monad2C & Bifunctor2 +): ( + UnknownRecord: DecoderT>, + onKeyError: (k: string, e: E) => E +) => (properties: { [K in keyof A]: DecoderT }) => DecoderT { + const traverse = traverseRecordWithIndex(M) + return (UnknownRecord, onKeyError) => (properties) => ({ + decode: (u) => + M.chain(UnknownRecord.decode(u), (r) => + traverse(properties as Record>, (k, decoder) => + M.mapLeft(decoder.decode(r[k]), (e) => onKeyError(k, e)) + ) + ) as any + }) } /** * @category combinators * @since 2.2.7 */ -export const array = (M: Monad2C & Bifunctor2) => ( +export function partial( + M: Monad2C & Bifunctor2 +): ( + UnknownRecord: DecoderT>, + onKeyError: (k: string, e: E) => E +) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> { + const traverse = traverseRecordWithIndex(M) + const skip = M.of>(E.left(undefined)) + return (UnknownRecord, onKeyError) => (properties) => ({ + decode: (u) => + M.map( + M.chain(UnknownRecord.decode(u), (r) => + traverse(properties as Record>, (k, decoder) => { + const rk = r[k] + if (rk === undefined) { + return skip + } + return M.bimap( + decoder.decode(rk), + (e) => onKeyError(k, e), + (a) => E.right(a) + ) + }) + ), + compactRecord + ) as any + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export function array( + M: Monad2C & Bifunctor2 +): ( UnknownArray: DecoderT>, onItemError: (i: number, e: E) => E -) => (items: DecoderT): DecoderT> => { - const traverseWithIndexM = traverseWithIndex(M) - return { +) => (items: DecoderT) => DecoderT> { + const traverse = traverseArrayWithIndex(M) + return (UnknownArray, onItemError) => (items) => ({ decode: (u) => M.chain(UnknownArray.decode(u), (us) => - traverseWithIndexM(us, (i, u) => M.mapLeft(items.decode(u), (e) => onItemError(i, e))) + traverse(us, (i, u) => M.mapLeft(items.decode(u), (e) => onItemError(i, e))) + ) + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export function record( + M: Monad2C & Bifunctor2 +): ( + UnknownRecord: DecoderT>, + onKeyError: (k: string, e: E) => E +) => (codomain: DecoderT) => DecoderT> { + const traverse = traverseRecordWithIndex(M) + return (UnknownRecord, onKeyError) => (codomain) => ({ + decode: (u) => + M.chain(UnknownRecord.decode(u), (r) => + traverse(r, (k, u) => M.mapLeft(codomain.decode(u), (e) => onKeyError(k, e))) ) + }) +} + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +const traverseArrayWithIndex = (M: Applicative2C) => ( + as: Array, + f: (i: number, a: A) => Kind2 +): Kind2> => { + return as.reduce( + (mbs, a, i) => + M.ap( + M.map(mbs, (bs) => (b: B) => { + bs.push(b) + return bs + }), + f(i, a) + ), + M.of>([]) + ) +} + +const traverseRecordWithIndex = (M: Applicative2C) => ( + r: Record, + f: (k: string, a: A) => Kind2 +): Kind2> => { + const ks = Object.keys(r).sort() + if (ks.length === 0) { + return M.of({}) + } + let fr: Kind2> = M.of({}) + for (const key of ks) { + fr = M.ap( + M.map(fr, (r) => (b: B) => { + r[key] = b + return r + }), + f(key, r[key]) + ) + } + return fr +} + +const compactRecord = (r: Record>): Record => { + const out: Record = {} + for (const k in r) { + const rk = r[k] + if (E.isRight(rk)) { + out[k] = rk.right + } } + return out } diff --git a/test/DecoderT.ts b/test/DecoderT.ts index e1ec08823..9c1802d03 100644 --- a/test/DecoderT.ts +++ b/test/DecoderT.ts @@ -5,29 +5,25 @@ import * as DT from '../src/DecoderT' import { pipe } from 'fp-ts/lib/pipeable' import * as TE from 'fp-ts/lib/TaskEither' import * as T from 'fp-ts/lib/Tree' -import { draw } from '../src/Tree' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -describe('DecoderT', () => { - it('should support synchronous decoders', () => { - const M = E.getValidation(NEA.getSemigroup()) - const UnknownArray = DT.UnknownArray(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be Array`]) - const array = DT.array(M)(UnknownArray, (i, e) => - pipe( - e, - NEA.map((s) => `item ${i}: ${s}`) - ) - ) - const string = DT.string(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be string`]) - const decoder = array(string) - assert.deepStrictEqual(decoder.decode(['a', 'b']), E.right(['a', 'b'])) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left(['item 0: cannot decode 1, should be string', 'item 1: cannot decode 2, should be string']) - ) - }) +const M = E.getValidation(NEA.getSemigroup>()) +const UnknownArray = DT.UnknownArray(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be Array`)]) +const UnknownRecord = DT.UnknownRecord(M)((u) => [ + T.make(`cannot decode ${JSON.stringify(u)}, should be Record`) +]) +export const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) +export const number = DT.number(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be number`)]) +export const boolean = DT.boolean(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be boolean`)]) +export const type = DT.type(M)(UnknownRecord, (k, e) => + pipe( + e, + NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) + ) +) +describe('DecoderT', () => { it('should support asynchronous decoders', async () => { const M = TE.getTaskValidation(NEA.getSemigroup()) const UnknownArray = DT.UnknownArray(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be Array`]) @@ -56,21 +52,96 @@ describe('DecoderT', () => { assert.deepStrictEqual(decoder.decode([1, 2]), E.left('item 0: cannot decode 1, should be string')) }) - it('should support default DecoderError', () => { - const M = E.getValidation(NEA.getSemigroup>()) - const UnknownArray = DT.UnknownArray(M)((u) => [ - T.make(`cannot decode ${JSON.stringify(u)}, should be Array`) - ]) - const array = DT.array(M)(UnknownArray, (i, e) => [T.make(`item ${i}`, e)]) - const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) + it('boolean', () => { + assert.deepStrictEqual(boolean.decode(true), E.right(true)) + assert.deepStrictEqual(boolean.decode(false), E.right(false)) + assert.deepStrictEqual(boolean.decode(null), E.left([T.make('cannot decode null, should be boolean')])) + }) + + it('array', () => { + const array = DT.array(M)(UnknownArray, (i, e) => + pipe( + e, + NEA.map((e) => T.make(`item ${i}`, [e])) + ) + ) const decoder = array(string) assert.deepStrictEqual(decoder.decode(['a', 'b']), E.right(['a', 'b'])) + assert.deepStrictEqual(decoder.decode(null), E.left([T.make('cannot decode null, should be Array')])) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left([ + T.make('item 0', [T.make('cannot decode 1, should be string')]), + T.make('item 1', [T.make('cannot decode 2, should be string')]) + ]) + ) + }) + + it('record', () => { + const record = DT.record(M)(UnknownRecord, (k, e) => + pipe( + e, + NEA.map((e) => T.make(`key ${JSON.stringify(k)}`, [e])) + ) + ) + const decoder = record(string) + assert.deepStrictEqual(decoder.decode({}), E.right({})) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) + assert.deepStrictEqual( + decoder.decode(null), + E.left([T.make('cannot decode null, should be Record')]) + ) + assert.deepStrictEqual( + decoder.decode({ a: 1, b: 2 }), + E.left([ + T.make('key "a"', [T.make('cannot decode 1, should be string')]), + T.make('key "b"', [T.make('cannot decode 2, should be string')]) + ]) + ) + }) + + it('type', () => { + const decoder = type({ + name: string, + age: number + }) + assert.deepStrictEqual(decoder.decode({ name: 'name', age: 18 }), E.right({ name: 'name', age: 18 })) + assert.deepStrictEqual( + decoder.decode(null), + E.left([T.make('cannot decode null, should be Record')]) + ) + assert.deepStrictEqual( + decoder.decode({}), + E.left([ + T.make('required property "age"', [T.make('cannot decode undefined, should be number')]), + T.make('required property "name"', [T.make('cannot decode undefined, should be string')]) + ]) + ) + }) + + it('partial', () => { + const partial = DT.partial(M)(UnknownRecord, (k, e) => + pipe( + e, + NEA.map((e) => T.make(`optional property ${JSON.stringify(k)}`, [e])) + ) + ) + const decoder = partial({ + name: string, + age: number + }) + assert.deepStrictEqual(decoder.decode({ name: 'name', age: 18 }), E.right({ name: 'name', age: 18 })) + assert.deepStrictEqual(decoder.decode({}), E.right({})) + assert.deepStrictEqual( + decoder.decode(null), + E.left([T.make('cannot decode null, should be Record')]) + ) assert.deepStrictEqual( - pipe(decoder.decode([1, 2]), E.mapLeft(draw)), - E.left(`item 0 -└─ cannot decode 1, should be string -item 1 -└─ cannot decode 2, should be string`) + decoder.decode({ name: 1, age: 'a' }), + E.left([ + T.make('optional property "age"', [T.make('cannot decode "a", should be number')]), + T.make('optional property "name"', [T.make('cannot decode 1, should be string')]) + ]) ) }) }) From 29d3c3881741eede0d4aa215ab074d19021e7b05 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 20 Jun 2020 20:22:47 +0200 Subject: [PATCH 049/222] DecoderT: add perf --- perf/DecoderT.ts | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ src/DecoderT.ts | 2 +- test/DecoderT.ts | 8 +++--- 3 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 perf/DecoderT.ts diff --git a/perf/DecoderT.ts b/perf/DecoderT.ts new file mode 100644 index 000000000..64e829d6e --- /dev/null +++ b/perf/DecoderT.ts @@ -0,0 +1,72 @@ +import * as Benchmark from 'benchmark' +import * as E from 'fp-ts/lib/Either' +import * as NEA from 'fp-ts/lib/NonEmptyArray' +import { pipe } from 'fp-ts/lib/pipeable' +import * as T from 'fp-ts/lib/Tree' +import * as D from '../src/Decoder' +import * as DT from '../src/DecoderT' + +/* + +Decoder (good) x 4,979,890 ops/sec ±0.75% (89 runs sampled) +DecoderT (good) x 2,391,887 ops/sec ±0.56% (89 runs sampled) +Decoder (bad) x 1,251,694 ops/sec ±0.45% (91 runs sampled) +DecoderT (bad) x 715,112 ops/sec ±0.45% (87 runs sampled) + +*/ + +const decoder = D.type({ + name: D.string, + age: D.number +}) + +const M = E.getValidation(NEA.getSemigroup>()) +const UnknownRecord = DT.UnknownRecord(M)((u) => [ + T.make(`cannot decode ${JSON.stringify(u)}, should be Record`) +]) +const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) +const number = DT.number(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be number`)]) +const type = DT.type(M)(UnknownRecord, (k, e) => + pipe( + e, + NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) + ) +) + +const decoderT = type({ + name: string, + age: number +}) + +const good = { + name: 'name', + age: 18 +} + +const bad = {} + +// console.log(decoder.decode(bad)) +// console.log(decoderT.decode(bad)) + +const suite = new Benchmark.Suite() + +suite + .add('Decoder (good)', function () { + decoder.decode(good) + }) + .add('DecoderT (good)', function () { + decoderT.decode(good) + }) + .add('Decoder (bad)', function () { + decoder.decode(bad) + }) + .add('DecoderT (bad)', function () { + decoderT.decode(bad) + }) + .on('cycle', function (event: any) { + console.log(String(event.target)) + }) + .on('complete', function (this: any) { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) diff --git a/src/DecoderT.ts b/src/DecoderT.ts index a16563dd1..1077a1c2a 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -213,7 +213,7 @@ const traverseRecordWithIndex = (M: Applicative2C) => r: Record, f: (k: string, a: A) => Kind2 ): Kind2> => { - const ks = Object.keys(r).sort() + const ks = Object.keys(r) if (ks.length === 0) { return M.of({}) } diff --git a/test/DecoderT.ts b/test/DecoderT.ts index 9c1802d03..dd895a5b9 100644 --- a/test/DecoderT.ts +++ b/test/DecoderT.ts @@ -113,8 +113,8 @@ describe('DecoderT', () => { assert.deepStrictEqual( decoder.decode({}), E.left([ - T.make('required property "age"', [T.make('cannot decode undefined, should be number')]), - T.make('required property "name"', [T.make('cannot decode undefined, should be string')]) + T.make('required property "name"', [T.make('cannot decode undefined, should be string')]), + T.make('required property "age"', [T.make('cannot decode undefined, should be number')]) ]) ) }) @@ -139,8 +139,8 @@ describe('DecoderT', () => { assert.deepStrictEqual( decoder.decode({ name: 1, age: 'a' }), E.left([ - T.make('optional property "age"', [T.make('cannot decode "a", should be number')]), - T.make('optional property "name"', [T.make('cannot decode 1, should be string')]) + T.make('optional property "name"', [T.make('cannot decode 1, should be string')]), + T.make('optional property "age"', [T.make('cannot decode "a", should be number')]) ]) ) }) From b2b52ecae97ccd55625097dff99f444acbeda1c4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 21 Jun 2020 12:47:43 +0200 Subject: [PATCH 050/222] POC: FreeDecoder --- docs/modules/DecoderError.ts.md | 116 +++++++++++++++++++++++++++++++ docs/modules/DecoderT.ts.md | 2 +- docs/modules/Encoder.ts.md | 2 +- docs/modules/Eq.ts.md | 2 +- docs/modules/FreeDecoder.ts.md | 87 +++++++++++++++++++++++ docs/modules/FreeSemigroup.ts.md | 115 ++++++++++++++++++++++++++++++ docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/Tree.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 2 +- perf/DecoderT.ts | 89 +++++++++++++++++++----- src/DecoderError.ts | 74 ++++++++++++++++++++ src/FreeDecoder.ts | 55 +++++++++++++++ src/FreeSemigroup.ts | 68 ++++++++++++++++++ test/FreeDecoder.ts | 49 +++++++++++++ 21 files changed, 648 insertions(+), 31 deletions(-) create mode 100644 docs/modules/DecoderError.ts.md create mode 100644 docs/modules/FreeDecoder.ts.md create mode 100644 docs/modules/FreeSemigroup.ts.md create mode 100644 src/DecoderError.ts create mode 100644 src/FreeDecoder.ts create mode 100644 src/FreeSemigroup.ts create mode 100644 test/FreeDecoder.ts diff --git a/docs/modules/DecoderError.ts.md b/docs/modules/DecoderError.ts.md new file mode 100644 index 000000000..59aaece09 --- /dev/null +++ b/docs/modules/DecoderError.ts.md @@ -0,0 +1,116 @@ +--- +title: DecoderError.ts +nav_order: 3 +parent: Modules +--- + +## DecoderError overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [constructors](#constructors) + - [leaf](#leaf) + - [required](#required) +- [destructors](#destructors) + - [fold](#fold) +- [instances](#instances) + - [getSemigroup](#getsemigroup) +- [model](#model) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [Leaf (interface)](#leaf-interface) + - [Required (interface)](#required-interface) + +--- + +# constructors + +## leaf + +**Signature** + +```ts +export declare const leaf: (input: unknown, error: string) => DecodeError +``` + +Added in v2.2.7 + +## required + +**Signature** + +```ts +export declare const required: (key: string, errors: FS.FreeSemigroup) => DecodeError +``` + +Added in v2.2.7 + +# destructors + +## fold + +**Signature** + +```ts +export declare const fold: (patterns: { + Leaf: (input: unknown, error: string) => R + Required: (k: string, errors: FS.FreeSemigroup) => R +}) => (e: DecodeError) => R +``` + +Added in v2.2.7 + +# instances + +## getSemigroup + +**Signature** + +```ts +export declare function getSemigroup(): Semigroup> +``` + +Added in v2.2.7 + +# model + +## DecodeError (type alias) + +**Signature** + +```ts +export type DecodeError = Leaf | Required +``` + +Added in v2.2.7 + +## Leaf (interface) + +**Signature** + +```ts +export interface Leaf { + readonly _tag: 'Leaf' + readonly input: unknown + readonly error: string +} +``` + +Added in v2.2.7 + +## Required (interface) + +**Signature** + +```ts +export interface Required { + readonly _tag: 'Required' + readonly key: string + readonly errors: FS.FreeSemigroup +} +``` + +Added in v2.2.7 diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index bf299d489..f750e4e51 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -1,6 +1,6 @@ --- title: DecoderT.ts -nav_order: 3 +nav_order: 4 parent: Modules --- diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 3fbead376..de4e7002e 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -1,6 +1,6 @@ --- title: Encoder.ts -nav_order: 4 +nav_order: 5 parent: Modules --- diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index da2131a3d..fde6772bc 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -1,6 +1,6 @@ --- title: Eq.ts -nav_order: 5 +nav_order: 6 parent: Modules --- diff --git a/docs/modules/FreeDecoder.ts.md b/docs/modules/FreeDecoder.ts.md new file mode 100644 index 000000000..53cd5be3d --- /dev/null +++ b/docs/modules/FreeDecoder.ts.md @@ -0,0 +1,87 @@ +--- +title: FreeDecoder.ts +nav_order: 7 +parent: Modules +--- + +## FreeDecoder overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [utils](#utils) + - [FreeDecoder (interface)](#freedecoder-interface) + - [UnknownRecord](#unknownrecord) + - [number](#number) + - [string](#string) + - [toForest](#toforest) + - [type](#type) + +--- + +# utils + +## FreeDecoder (interface) + +**Signature** + +```ts +export interface FreeDecoder
extends DT.DecoderT, A> {} +``` + +Added in v2.2.7 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: FreeDecoder> +``` + +Added in v2.2.7 + +## number + +**Signature** + +```ts +export declare const number: FreeDecoder +``` + +Added in v2.2.7 + +## string + +**Signature** + +```ts +export declare const string: FreeDecoder +``` + +Added in v2.2.7 + +## toForest + +**Signature** + +```ts +export declare function toForest(s: FS.FreeSemigroup): NEA.NonEmptyArray> +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: FreeDecoder } +) => FreeDecoder<{ [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 diff --git a/docs/modules/FreeSemigroup.ts.md b/docs/modules/FreeSemigroup.ts.md new file mode 100644 index 000000000..a34b55770 --- /dev/null +++ b/docs/modules/FreeSemigroup.ts.md @@ -0,0 +1,115 @@ +--- +title: FreeSemigroup.ts +nav_order: 8 +parent: Modules +--- + +## FreeSemigroup overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [consrtuctors](#consrtuctors) + - [concat](#concat) + - [of](#of) +- [destructors](#destructors) + - [fold](#fold) +- [instances](#instances) + - [getSemigroup](#getsemigroup) +- [model](#model) + - [Concat (interface)](#concat-interface) + - [FreeSemigroup (type alias)](#freesemigroup-type-alias) + - [Of (interface)](#of-interface) + +--- + +# consrtuctors + +## concat + +**Signature** + +```ts +export declare const concat:
(left: FreeSemigroup, right: FreeSemigroup) => FreeSemigroup +``` + +Added in v2.2.7 + +## of + +**Signature** + +```ts +export declare const of: (a: A) => FreeSemigroup +``` + +Added in v2.2.7 + +# destructors + +## fold + +**Signature** + +```ts +export declare const fold: ( + onOf: (value: A) => R, + onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R +) => (f: FreeSemigroup) => R +``` + +Added in v2.2.7 + +# instances + +## getSemigroup + +**Signature** + +```ts +export declare function getSemigroup(): Semigroup> +``` + +Added in v2.2.7 + +# model + +## Concat (interface) + +**Signature** + +```ts +export interface Concat { + readonly _tag: 'Concat' + readonly left: FreeSemigroup + readonly right: FreeSemigroup +} +``` + +Added in v2.2.7 + +## FreeSemigroup (type alias) + +**Signature** + +```ts +export type FreeSemigroup = Of | Concat +``` + +Added in v2.2.7 + +## Of (interface) + +**Signature** + +```ts +export interface Of { + readonly _tag: 'Of' + readonly value: A +} +``` + +Added in v2.2.7 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 6a16d5636..46472c9cb 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -1,6 +1,6 @@ --- title: Guard.ts -nav_order: 6 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 6deceb8a1..4f0c02095 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -1,6 +1,6 @@ --- title: JsonCodec.ts -nav_order: 8 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 345da476c..f84480379 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 9 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 215c43320..1db8dde68 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 10 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 893dd233c..175cf05b2 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 11 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index efa60a67f..d9068def7 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 12 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 358fbe08f..113c1df7e 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 13 +nav_order: 16 parent: Modules --- diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index 45e213636..58a5de8cb 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -1,6 +1,6 @@ --- title: Tree.ts -nav_order: 14 +nav_order: 17 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 2a2fc3b36..7d8420445 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 15 +nav_order: 18 parent: Modules --- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 797e1b789..5e3daa009 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 7 +nav_order: 10 parent: Modules --- diff --git a/perf/DecoderT.ts b/perf/DecoderT.ts index 64e829d6e..68fc80671 100644 --- a/perf/DecoderT.ts +++ b/perf/DecoderT.ts @@ -5,13 +5,23 @@ import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Tree' import * as D from '../src/Decoder' import * as DT from '../src/DecoderT' +import * as FD from '../src/FreeDecoder' +import { draw } from '../src/Tree' +import * as G from '../src/Guard' /* -Decoder (good) x 4,979,890 ops/sec ±0.75% (89 runs sampled) -DecoderT (good) x 2,391,887 ops/sec ±0.56% (89 runs sampled) -Decoder (bad) x 1,251,694 ops/sec ±0.45% (91 runs sampled) -DecoderT (bad) x 715,112 ops/sec ±0.45% (87 runs sampled) +Guard (good) x 36,532,824 ops/sec ±1.24% (85 runs sampled) +Decoder (good) x 4,814,205 ops/sec ±0.72% (88 runs sampled) +DecoderT (good) x 2,401,887 ops/sec ±0.53% (89 runs sampled) +FreeDecoder (good) x 2,188,382 ops/sec ±0.55% (87 runs sampled) +Guard (bad) x 35,652,287 ops/sec ±1.48% (84 runs sampled) +Decoder (bad) x 1,231,770 ops/sec ±0.52% (89 runs sampled) +DecoderT (bad) x 742,324 ops/sec ±2.24% (88 runs sampled) +FreeDecoder (bad) x 1,877,380 ops/sec ±0.69% (86 runs sampled) +Decoder (draw) x 593,043 ops/sec ±0.53% (90 runs sampled) +DecoderT (draw) x 455,839 ops/sec ±0.52% (88 runs sampled) +FreeDecoder (draw) x 375,678 ops/sec ±0.50% (86 runs sampled) */ @@ -20,22 +30,40 @@ const decoder = D.type({ age: D.number }) -const M = E.getValidation(NEA.getSemigroup>()) -const UnknownRecord = DT.UnknownRecord(M)((u) => [ - T.make(`cannot decode ${JSON.stringify(u)}, should be Record`) -]) -const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) -const number = DT.number(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be number`)]) -const type = DT.type(M)(UnknownRecord, (k, e) => - pipe( - e, - NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) +function getDecoderT() { + const M = E.getValidation(NEA.getSemigroup>()) + const UnknownRecord = DT.UnknownRecord(M)((u) => [ + T.make(`cannot decode ${JSON.stringify(u)}, should be Record`) + ]) + const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) + const number = DT.number(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be number`)]) + const type = DT.type(M)(UnknownRecord, (k, e) => + pipe( + e, + NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) + ) ) -) -const decoderT = type({ - name: string, - age: number + return type({ + name: string, + age: number + }) +} + +const decoderT = getDecoderT() + +function getFreeDecoder() { + return FD.type({ + name: FD.string, + age: FD.number + }) +} + +const freeDecoder = getFreeDecoder() + +const guard = G.type({ + name: G.string, + age: G.number }) const good = { @@ -47,22 +75,47 @@ const bad = {} // console.log(decoder.decode(bad)) // console.log(decoderT.decode(bad)) +// console.log(JSON.stringify(freeDecoder.decode(bad), null, 2)) const suite = new Benchmark.Suite() suite + .add('Guard (good)', function () { + guard.is(bad) + }) .add('Decoder (good)', function () { decoder.decode(good) }) .add('DecoderT (good)', function () { decoderT.decode(good) }) + .add('FreeDecoder (good)', function () { + freeDecoder.decode(good) + }) + .add('Guard (bad)', function () { + guard.is(bad) + }) .add('Decoder (bad)', function () { decoder.decode(bad) }) .add('DecoderT (bad)', function () { decoderT.decode(bad) }) + .add('FreeDecoder (bad)', function () { + freeDecoder.decode(bad) + }) + .add('Decoder (draw)', function () { + pipe(decoder.decode(bad), E.mapLeft(draw)) + }) + .add('DecoderT (draw)', function () { + pipe(decoderT.decode(bad), E.mapLeft(draw)) + }) + .add('FreeDecoder (draw)', function () { + pipe( + freeDecoder.decode(bad), + E.mapLeft((e) => draw(FD.toForest(e))) + ) + }) .on('cycle', function (event: any) { console.log(String(event.target)) }) diff --git a/src/DecoderError.ts b/src/DecoderError.ts new file mode 100644 index 000000000..3a3c2d37e --- /dev/null +++ b/src/DecoderError.ts @@ -0,0 +1,74 @@ +/** + * @since 2.2.7 + */ +import { Semigroup } from 'fp-ts/lib/Semigroup' +import * as FS from './FreeSemigroup' + +/** + * @category model + * @since 2.2.7 + */ +export interface Leaf { + readonly _tag: 'Leaf' + readonly input: unknown + readonly error: string +} + +/** + * @category model + * @since 2.2.7 + */ +export interface Required { + readonly _tag: 'Required' + readonly key: string + readonly errors: FS.FreeSemigroup +} + +/** + * @category model + * @since 2.2.7 + */ +export type DecodeError = Leaf | Required + +/** + * @category constructors + * @since 2.2.7 + */ +export const leaf = (input: unknown, error: string): DecodeError => ({ _tag: 'Leaf', input, error }) + +/** + * @category constructors + * @since 2.2.7 + */ +export const required = (key: string, errors: FS.FreeSemigroup): DecodeError => ({ + _tag: 'Required', + key, + errors +}) + +/** + * @category destructors + * @since 2.2.7 + */ +export const fold = (patterns: { + Leaf: (input: unknown, error: string) => R + Required: (k: string, errors: FS.FreeSemigroup) => R +}): ((e: DecodeError) => R) => { + const f = (e: DecodeError): R => { + switch (e._tag) { + case 'Leaf': + return patterns.Leaf(e.input, e.error) + case 'Required': + return patterns.Required(e.key, e.errors) + } + } + return f +} + +/** + * @category instances + * @since 2.2.7 + */ +export function getSemigroup(): Semigroup> { + return FS.getSemigroup() +} diff --git a/src/FreeDecoder.ts b/src/FreeDecoder.ts new file mode 100644 index 000000000..4c034b0c0 --- /dev/null +++ b/src/FreeDecoder.ts @@ -0,0 +1,55 @@ +/** + * @since 2.2.7 + */ +import * as FS from './FreeSemigroup' +import * as DE from './DecoderError' +import * as DT from './DecoderT' +import * as E from 'fp-ts/lib/Either' +import * as T from 'fp-ts/lib/Tree' +import * as NEA from 'fp-ts/lib/NonEmptyArray' + +const M = E.getValidation(DE.getSemigroup()) + +/** + * @since 2.2.7 + */ +export interface FreeDecoder extends DT.DecoderT, A> {} + +/** + * @since 2.2.7 + */ +export const UnknownRecord: FreeDecoder> = DT.UnknownRecord(M)((u) => + FS.of(DE.leaf(u, 'Record')) +) + +/** + * @since 2.2.7 + */ +export const string: FreeDecoder = DT.string(M)((u) => FS.of(DE.leaf(u, 'string'))) + +/** + * @since 2.2.7 + */ +export const number: FreeDecoder = DT.number(M)((u) => FS.of(DE.leaf(u, 'number'))) + +/** + * @since 2.2.7 + */ +export const type: ( + properties: { [K in keyof A]: FreeDecoder } +) => FreeDecoder<{ [K in keyof A]: A[K] }> = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.required(k, e))) + +/** + * @since 2.2.7 + */ +export function toForest(s: FS.FreeSemigroup): NEA.NonEmptyArray> { + const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ + Leaf: (input, expected) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${expected}`), + Required: (key, errors) => T.make(`required property ${JSON.stringify(key)}`, toForest(errors)) + }) + const toForest: (f: FS.FreeSemigroup) => NEA.NonEmptyArray> = FS.fold( + (value) => [toTree(value)], + (left, right) => NEA.concat(toForest(left), toForest(right)) + ) + return toForest(s) +} diff --git a/src/FreeSemigroup.ts b/src/FreeSemigroup.ts new file mode 100644 index 000000000..483520c92 --- /dev/null +++ b/src/FreeSemigroup.ts @@ -0,0 +1,68 @@ +/** + * @since 2.2.7 + */ +import { Semigroup } from 'fp-ts/lib/Semigroup' + +/** + * @category model + * @since 2.2.7 + */ +export interface Of { + readonly _tag: 'Of' + readonly value: A +} + +/** + * @category model + * @since 2.2.7 + */ +export interface Concat { + readonly _tag: 'Concat' + readonly left: FreeSemigroup + readonly right: FreeSemigroup +} + +/** + * @category model + * @since 2.2.7 + */ +export type FreeSemigroup = Of | Concat + +/** + * @category consrtuctors + * @since 2.2.7 + */ +export const of = (a: A): FreeSemigroup => ({ _tag: 'Of', value: a }) + +/** + * @category consrtuctors + * @since 2.2.7 + */ +export const concat = (left: FreeSemigroup, right: FreeSemigroup): FreeSemigroup => ({ + _tag: 'Concat', + left, + right +}) + +/** + * @category destructors + * @since 2.2.7 + */ +export const fold = (onOf: (value: A) => R, onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R) => ( + f: FreeSemigroup +): R => { + switch (f._tag) { + case 'Of': + return onOf(f.value) + case 'Concat': + return onConcat(f.left, f.right) + } +} + +/** + * @category instances + * @since 2.2.7 + */ +export function getSemigroup(): Semigroup> { + return { concat } +} diff --git a/test/FreeDecoder.ts b/test/FreeDecoder.ts new file mode 100644 index 000000000..093efca8c --- /dev/null +++ b/test/FreeDecoder.ts @@ -0,0 +1,49 @@ +import * as assert from 'assert' +import * as DE from '../src/DecoderError' +import * as FD from '../src/FreeDecoder' +import * as FS from '../src/FreeSemigroup' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import { drawTree } from 'fp-ts/lib/Tree' + +describe('FreeDecoder', () => { + it('type', () => { + const decoder = FD.type({ + name: FD.string, + age: FD.number + }) + assert.deepStrictEqual(decoder.decode({ name: 'name', age: 18 }), E.right({ name: 'name', age: 18 })) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual( + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.required('name', FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.required('age', FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('toForest', () => { + const decoder = FD.type({ + name: FD.string, + age: FD.number + }) + const s = pipe( + decoder.decode({}), + E.mapLeft(FD.toForest), + E.fold( + (forest) => forest.map(drawTree).join('\n'), + () => '' + ) + ) + assert.deepStrictEqual( + s, + `required property \"name\" +└─ cannot decode undefined, should be string +required property \"age\" +└─ cannot decode undefined, should be number` + ) + }) +}) From fe1c3f70d0434d0a19f400ae28e4c16bbb546f48 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 21 Jun 2020 13:56:58 +0200 Subject: [PATCH 051/222] make DecodeError polymorphic --- CHANGELOG.md | 8 ++++++ perf/DecoderT.ts | 62 +++++++++++++-------------------------------- src/Decoder.ts | 31 ++++++++++++++++++++--- src/DecoderError.ts | 26 +++++++++---------- src/FreeDecoder.ts | 28 ++++++++++---------- test/Decoder.ts | 14 ++++++++++ test/FreeDecoder.ts | 25 +++++++++++++----- 7 files changed, 113 insertions(+), 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a37c2d9..2fa8713d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,14 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.7 + +- **Experimental** + - add `DecodeError` module (@gcanti) + - add `DecoderT` module (@gcanti) + - add `FreeSemigroup` module (@gcanti) + - remove `Tree` module (@gcanti) + # 2.2.6 - **Experimental** diff --git a/perf/DecoderT.ts b/perf/DecoderT.ts index 68fc80671..40d070c33 100644 --- a/perf/DecoderT.ts +++ b/perf/DecoderT.ts @@ -1,27 +1,24 @@ import * as Benchmark from 'benchmark' import * as E from 'fp-ts/lib/Either' -import * as NEA from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' -import * as T from 'fp-ts/lib/Tree' import * as D from '../src/Decoder' +import * as DE from '../src/DecoderError' import * as DT from '../src/DecoderT' import * as FD from '../src/FreeDecoder' -import { draw } from '../src/Tree' +import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' +import { draw } from '../src/Tree' /* -Guard (good) x 36,532,824 ops/sec ±1.24% (85 runs sampled) -Decoder (good) x 4,814,205 ops/sec ±0.72% (88 runs sampled) -DecoderT (good) x 2,401,887 ops/sec ±0.53% (89 runs sampled) -FreeDecoder (good) x 2,188,382 ops/sec ±0.55% (87 runs sampled) -Guard (bad) x 35,652,287 ops/sec ±1.48% (84 runs sampled) -Decoder (bad) x 1,231,770 ops/sec ±0.52% (89 runs sampled) -DecoderT (bad) x 742,324 ops/sec ±2.24% (88 runs sampled) -FreeDecoder (bad) x 1,877,380 ops/sec ±0.69% (86 runs sampled) -Decoder (draw) x 593,043 ops/sec ±0.53% (90 runs sampled) -DecoderT (draw) x 455,839 ops/sec ±0.52% (88 runs sampled) -FreeDecoder (draw) x 375,678 ops/sec ±0.50% (86 runs sampled) +Guard (good) x 35,369,047 ops/sec ±1.50% (86 runs sampled) +Decoder (good) x 4,653,320 ops/sec ±0.76% (87 runs sampled) +DecoderT (good) x 2,295,214 ops/sec ±1.10% (88 runs sampled) +Guard (bad) x 35,062,516 ops/sec ±1.48% (82 runs sampled) +Decoder (bad) x 1,225,890 ops/sec ±0.74% (89 runs sampled) +DecoderT (bad) x 2,011,330 ops/sec ±0.60% (86 runs sampled) +Decoder (draw) x 568,278 ops/sec ±2.85% (84 runs sampled) +DecoderT (draw) x 376,532 ops/sec ±1.78% (85 runs sampled) */ @@ -31,18 +28,11 @@ const decoder = D.type({ }) function getDecoderT() { - const M = E.getValidation(NEA.getSemigroup>()) - const UnknownRecord = DT.UnknownRecord(M)((u) => [ - T.make(`cannot decode ${JSON.stringify(u)}, should be Record`) - ]) - const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) - const number = DT.number(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be number`)]) - const type = DT.type(M)(UnknownRecord, (k, e) => - pipe( - e, - NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) - ) - ) + const M = E.getValidation(DE.getSemigroup()) + const UnknownRecord = DT.UnknownRecord(M)((u) => FS.of(DE.leaf(u, 'Record'))) + const string = DT.string(M)((u) => FS.of(DE.leaf(u, 'string'))) + const number = DT.number(M)((u) => FS.of(DE.leaf(u, 'number'))) + const type = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.required(k, e))) return type({ name: string, @@ -52,15 +42,6 @@ function getDecoderT() { const decoderT = getDecoderT() -function getFreeDecoder() { - return FD.type({ - name: FD.string, - age: FD.number - }) -} - -const freeDecoder = getFreeDecoder() - const guard = G.type({ name: G.string, age: G.number @@ -89,9 +70,6 @@ suite .add('DecoderT (good)', function () { decoderT.decode(good) }) - .add('FreeDecoder (good)', function () { - freeDecoder.decode(good) - }) .add('Guard (bad)', function () { guard.is(bad) }) @@ -101,18 +79,12 @@ suite .add('DecoderT (bad)', function () { decoderT.decode(bad) }) - .add('FreeDecoder (bad)', function () { - freeDecoder.decode(bad) - }) .add('Decoder (draw)', function () { pipe(decoder.decode(bad), E.mapLeft(draw)) }) .add('DecoderT (draw)', function () { - pipe(decoderT.decode(bad), E.mapLeft(draw)) - }) - .add('FreeDecoder (draw)', function () { pipe( - freeDecoder.decode(bad), + decoderT.decode(bad), E.mapLeft((e) => draw(FD.toForest(e))) ) }) diff --git a/src/Decoder.ts b/src/Decoder.ts index f92eb4fbf..abc826b5f 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -1,14 +1,14 @@ /** * @since 2.2.0 */ +import { Alt1 } from 'fp-ts/lib/Alt' import * as E from 'fp-ts/lib/Either' +import { Functor1 } from 'fp-ts/lib/Functor' import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' -import { Forest, Tree } from 'fp-ts/lib/Tree' +import { drawTree, Forest, Tree } from 'fp-ts/lib/Tree' import * as G from './Guard' import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' -import { Functor1 } from 'fp-ts/lib/Functor' -import { Alt1 } from 'fp-ts/lib/Alt' // ------------------------------------------------------------------------------------- // model @@ -589,3 +589,28 @@ export const schemableDecoder: Schemable1 & union, refinement: refinement as WithRefinement1['refinement'] } + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.7 + */ +export const toForest = (e: DecodeError): NonEmptyArray> => { + return e + // const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ + // Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + // Required: (key, errors) => T.make(`required property ${JSON.stringify(key)}`, toForest(errors)) + // }) + // const toForest: (f: FS.FreeSemigroup>) => NEA.NonEmptyArray> = FS.fold( + // (value) => [toTree(value)], + // (left, right) => NEA.concat(toForest(left), toForest(right)) + // ) + // return toForest(s) +} + +/** + * @since 2.2.7 + */ +export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') diff --git a/src/DecoderError.ts b/src/DecoderError.ts index 3a3c2d37e..a54798b97 100644 --- a/src/DecoderError.ts +++ b/src/DecoderError.ts @@ -8,39 +8,39 @@ import * as FS from './FreeSemigroup' * @category model * @since 2.2.7 */ -export interface Leaf { +export interface Leaf { readonly _tag: 'Leaf' readonly input: unknown - readonly error: string + readonly error: E } /** * @category model * @since 2.2.7 */ -export interface Required { +export interface Required { readonly _tag: 'Required' readonly key: string - readonly errors: FS.FreeSemigroup + readonly errors: FS.FreeSemigroup> } /** * @category model * @since 2.2.7 */ -export type DecodeError = Leaf | Required +export type DecodeError = Leaf | Required /** * @category constructors * @since 2.2.7 */ -export const leaf = (input: unknown, error: string): DecodeError => ({ _tag: 'Leaf', input, error }) +export const leaf = (input: unknown, error: E): DecodeError => ({ _tag: 'Leaf', input, error }) /** * @category constructors * @since 2.2.7 */ -export const required = (key: string, errors: FS.FreeSemigroup): DecodeError => ({ +export const required = (key: string, errors: FS.FreeSemigroup>): DecodeError => ({ _tag: 'Required', key, errors @@ -50,11 +50,11 @@ export const required = (key: string, errors: FS.FreeSemigroup): De * @category destructors * @since 2.2.7 */ -export const fold = (patterns: { - Leaf: (input: unknown, error: string) => R - Required: (k: string, errors: FS.FreeSemigroup) => R -}): ((e: DecodeError) => R) => { - const f = (e: DecodeError): R => { +export const fold = (patterns: { + Leaf: (input: unknown, error: E) => R + Required: (k: string, errors: FS.FreeSemigroup>) => R +}): ((e: DecodeError) => R) => { + const f = (e: DecodeError): R => { switch (e._tag) { case 'Leaf': return patterns.Leaf(e.input, e.error) @@ -69,6 +69,6 @@ export const fold = (patterns: { * @category instances * @since 2.2.7 */ -export function getSemigroup(): Semigroup> { +export function getSemigroup(): Semigroup>> { return FS.getSemigroup() } diff --git a/src/FreeDecoder.ts b/src/FreeDecoder.ts index 4c034b0c0..b363e1b95 100644 --- a/src/FreeDecoder.ts +++ b/src/FreeDecoder.ts @@ -8,46 +8,46 @@ import * as E from 'fp-ts/lib/Either' import * as T from 'fp-ts/lib/Tree' import * as NEA from 'fp-ts/lib/NonEmptyArray' -const M = E.getValidation(DE.getSemigroup()) +const M = E.getValidation(DE.getSemigroup()) /** * @since 2.2.7 */ -export interface FreeDecoder extends DT.DecoderT, A> {} +export interface FreeDecoder extends DT.DecoderT>, A> {} /** * @since 2.2.7 */ -export const UnknownRecord: FreeDecoder> = DT.UnknownRecord(M)((u) => - FS.of(DE.leaf(u, 'Record')) -) +export const UnknownRecord = (e: E): FreeDecoder> => + DT.UnknownRecord(M)((u) => FS.of(DE.leaf(u, e))) /** * @since 2.2.7 */ -export const string: FreeDecoder = DT.string(M)((u) => FS.of(DE.leaf(u, 'string'))) +export const string = (e: E): FreeDecoder => DT.string(M)((u) => FS.of(DE.leaf(u, e))) /** * @since 2.2.7 */ -export const number: FreeDecoder = DT.number(M)((u) => FS.of(DE.leaf(u, 'number'))) +export const number = (e: E): FreeDecoder => DT.number(M)((u) => FS.of(DE.leaf(u, e))) /** * @since 2.2.7 */ -export const type: ( - properties: { [K in keyof A]: FreeDecoder } -) => FreeDecoder<{ [K in keyof A]: A[K] }> = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.required(k, e))) +export const type = ( + UnknownRecord: FreeDecoder> +): ((properties: { [K in keyof A]: FreeDecoder }) => FreeDecoder) => + DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.required(k, e))) /** * @since 2.2.7 */ -export function toForest(s: FS.FreeSemigroup): NEA.NonEmptyArray> { - const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ - Leaf: (input, expected) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${expected}`), +export function toForest(s: FS.FreeSemigroup>): NEA.NonEmptyArray> { + const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ + Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), Required: (key, errors) => T.make(`required property ${JSON.stringify(key)}`, toForest(errors)) }) - const toForest: (f: FS.FreeSemigroup) => NEA.NonEmptyArray> = FS.fold( + const toForest: (f: FS.FreeSemigroup>) => NEA.NonEmptyArray> = FS.fold( (value) => [toTree(value)], (left, right) => NEA.concat(toForest(left), toForest(right)) ) diff --git a/test/Decoder.ts b/test/Decoder.ts index 81f762e74..abfbef400 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -128,4 +128,18 @@ describe('Decoder', () => { assert.deepStrictEqual(D.intersect(true, { a: 1 }), { a: 1 }) }) }) + + describe('draw', () => { + it('should draw a tree', () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual(pipe(codec.decode({ a: 'a' }), E.mapLeft(D.draw)), E.right({ a: 'a' })) + assert.deepStrictEqual( + pipe(codec.decode({ a: 1 }), E.mapLeft(D.draw)), + E.left(`required property "a" +└─ cannot decode 1, should be string`) + ) + }) + }) }) diff --git a/test/FreeDecoder.ts b/test/FreeDecoder.ts index 093efca8c..bd11e46d7 100644 --- a/test/FreeDecoder.ts +++ b/test/FreeDecoder.ts @@ -6,11 +6,24 @@ import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import { drawTree } from 'fp-ts/lib/Tree' +const UnknownRecord = FD.UnknownRecord('Record') +const string = FD.string('string') +const number = FD.number('number') +const type = FD.type(UnknownRecord) + describe('FreeDecoder', () => { + it('string', () => { + assert.deepStrictEqual(string.decode('a'), E.right('a')) + }) + + it('number', () => { + assert.deepStrictEqual(number.decode(1), E.right(1)) + }) + it('type', () => { - const decoder = FD.type({ - name: FD.string, - age: FD.number + const decoder = type({ + name: string, + age: number }) assert.deepStrictEqual(decoder.decode({ name: 'name', age: 18 }), E.right({ name: 'name', age: 18 })) assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) @@ -26,9 +39,9 @@ describe('FreeDecoder', () => { }) it('toForest', () => { - const decoder = FD.type({ - name: FD.string, - age: FD.number + const decoder = type({ + name: string, + age: number }) const s = pipe( decoder.decode({}), From 2302447023a91e1bdc26e0775205f908bac776fa Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 21 Jun 2020 13:59:28 +0200 Subject: [PATCH 052/222] remove Tree module --- docs/modules/Decoder.ts.md | 22 ++++++++++++++++++++++ docs/modules/DecoderError.ts.md | 24 ++++++++++++------------ docs/modules/FreeDecoder.ts.md | 16 ++++++++-------- docs/modules/Tree.ts.md | 30 ------------------------------ docs/modules/Type.ts.md | 2 +- perf/DecoderT.ts | 5 ++--- src/Tree.ts | 12 ------------ test/Tree.ts | 19 ------------------- 8 files changed, 45 insertions(+), 85 deletions(-) delete mode 100644 docs/modules/Tree.ts.md delete mode 100644 src/Tree.ts delete mode 100644 test/Tree.ts diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index b22247d0a..f65c30ae0 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -57,6 +57,8 @@ Added in v2.2.0 - [string](#string) - [utils](#utils) - [TypeOf (type alias)](#typeof-type-alias) + - [draw](#draw) + - [toForest](#toforest) --- @@ -457,3 +459,23 @@ export type TypeOf = D extends Decoder ? A : never ``` Added in v2.2.0 + +## draw + +**Signature** + +```ts +export declare const draw: (e: DecodeError) => string +``` + +Added in v2.2.7 + +## toForest + +**Signature** + +```ts +export declare const toForest: (e: DecodeError) => NonEmptyArray> +``` + +Added in v2.2.7 diff --git a/docs/modules/DecoderError.ts.md b/docs/modules/DecoderError.ts.md index 59aaece09..d11ce3da9 100644 --- a/docs/modules/DecoderError.ts.md +++ b/docs/modules/DecoderError.ts.md @@ -33,7 +33,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const leaf: (input: unknown, error: string) => DecodeError +export declare const leaf: (input: unknown, error: E) => DecodeError ``` Added in v2.2.7 @@ -43,7 +43,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const required: (key: string, errors: FS.FreeSemigroup) => DecodeError +export declare const required: (key: string, errors: FS.FreeSemigroup>) => DecodeError ``` Added in v2.2.7 @@ -55,10 +55,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const fold: (patterns: { - Leaf: (input: unknown, error: string) => R - Required: (k: string, errors: FS.FreeSemigroup) => R -}) => (e: DecodeError) => R +export declare const fold: (patterns: { + Leaf: (input: unknown, error: E) => R + Required: (k: string, errors: FS.FreeSemigroup>) => R +}) => (e: DecodeError) => R ``` Added in v2.2.7 @@ -70,7 +70,7 @@ Added in v2.2.7 **Signature** ```ts -export declare function getSemigroup(): Semigroup> +export declare function getSemigroup(): Semigroup>> ``` Added in v2.2.7 @@ -82,7 +82,7 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = Leaf | Required +export type DecodeError = Leaf | Required ``` Added in v2.2.7 @@ -92,10 +92,10 @@ Added in v2.2.7 **Signature** ```ts -export interface Leaf { +export interface Leaf { readonly _tag: 'Leaf' readonly input: unknown - readonly error: string + readonly error: E } ``` @@ -106,10 +106,10 @@ Added in v2.2.7 **Signature** ```ts -export interface Required { +export interface Required { readonly _tag: 'Required' readonly key: string - readonly errors: FS.FreeSemigroup + readonly errors: FS.FreeSemigroup> } ``` diff --git a/docs/modules/FreeDecoder.ts.md b/docs/modules/FreeDecoder.ts.md index 53cd5be3d..f529010eb 100644 --- a/docs/modules/FreeDecoder.ts.md +++ b/docs/modules/FreeDecoder.ts.md @@ -29,7 +29,7 @@ Added in v2.2.7 **Signature** ```ts -export interface FreeDecoder extends DT.DecoderT, A> {} +export interface FreeDecoder extends DT.DecoderT>, A> {} ``` Added in v2.2.7 @@ -39,7 +39,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const UnknownRecord: FreeDecoder> +export declare const UnknownRecord: (e: E) => FreeDecoder> ``` Added in v2.2.7 @@ -49,7 +49,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const number: FreeDecoder +export declare const number: (e: E) => FreeDecoder ``` Added in v2.2.7 @@ -59,7 +59,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const string: FreeDecoder +export declare const string: (e: E) => FreeDecoder ``` Added in v2.2.7 @@ -69,7 +69,7 @@ Added in v2.2.7 **Signature** ```ts -export declare function toForest(s: FS.FreeSemigroup): NEA.NonEmptyArray> +export declare function toForest(s: FS.FreeSemigroup>): NEA.NonEmptyArray> ``` Added in v2.2.7 @@ -79,9 +79,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: FreeDecoder } -) => FreeDecoder<{ [K in keyof A]: A[K] }> +export declare const type: ( + UnknownRecord: FreeDecoder> +) => (properties: { [K in keyof A]: FreeDecoder }) => FreeDecoder ``` Added in v2.2.7 diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md deleted file mode 100644 index 58a5de8cb..000000000 --- a/docs/modules/Tree.ts.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Tree.ts -nav_order: 17 -parent: Modules ---- - -## Tree overview - -Added in v2.2.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [draw](#draw) - ---- - -# utils - -## draw - -**Signature** - -```ts -export declare function draw(e: DecodeError): string -``` - -Added in v2.2.0 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 7d8420445..279f12f55 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 18 +nav_order: 17 parent: Modules --- diff --git a/perf/DecoderT.ts b/perf/DecoderT.ts index 40d070c33..7178a7a25 100644 --- a/perf/DecoderT.ts +++ b/perf/DecoderT.ts @@ -7,7 +7,6 @@ import * as DT from '../src/DecoderT' import * as FD from '../src/FreeDecoder' import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' -import { draw } from '../src/Tree' /* @@ -80,12 +79,12 @@ suite decoderT.decode(bad) }) .add('Decoder (draw)', function () { - pipe(decoder.decode(bad), E.mapLeft(draw)) + pipe(decoder.decode(bad), E.mapLeft(D.draw)) }) .add('DecoderT (draw)', function () { pipe( decoderT.decode(bad), - E.mapLeft((e) => draw(FD.toForest(e))) + E.mapLeft((e) => D.draw(FD.toForest(e))) ) }) .on('cycle', function (event: any) { diff --git a/src/Tree.ts b/src/Tree.ts deleted file mode 100644 index bd13b83fa..000000000 --- a/src/Tree.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @since 2.2.0 - */ -import { drawTree } from 'fp-ts/lib/Tree' -import { DecodeError } from './Decoder' - -/** - * @since 2.2.0 - */ -export function draw(e: DecodeError): string { - return e.map(drawTree).join('\n') -} diff --git a/test/Tree.ts b/test/Tree.ts deleted file mode 100644 index c948360a8..000000000 --- a/test/Tree.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import * as D from '../src/Decoder' -import { draw } from '../src/Tree' -import { pipe } from 'fp-ts/lib/pipeable' - -describe('Tree', () => { - it('should draw a tree', () => { - const codec = D.type({ - a: D.string - }) - assert.deepStrictEqual(pipe(codec.decode({ a: 'a' }), E.mapLeft(draw)), E.right({ a: 'a' })) - assert.deepStrictEqual( - pipe(codec.decode({ a: 1 }), E.mapLeft(draw)), - E.left(`required property "a" -└─ cannot decode 1, should be string`) - ) - }) -}) From b4dacd92df82ec6a8af4f1d359e8b176fc369bba Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 21 Jun 2020 14:11:19 +0200 Subject: [PATCH 053/222] remove FreeDecoder module --- .../{DecoderError.ts.md => DecodeError.ts.md} | 6 +- docs/modules/Decoder.ts.md | 2 +- docs/modules/FreeDecoder.ts.md | 87 ------------------- docs/modules/FreeSemigroup.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 2 +- jest.config.js | 2 +- perf/DecoderT.ts | 35 +++++--- src/{DecoderError.ts => DecodeError.ts} | 0 src/FreeDecoder.ts | 55 ------------ test/FreeDecoder.ts | 62 ------------- 18 files changed, 39 insertions(+), 230 deletions(-) rename docs/modules/{DecoderError.ts.md => DecodeError.ts.md} (96%) delete mode 100644 docs/modules/FreeDecoder.ts.md rename src/{DecoderError.ts => DecodeError.ts} (100%) delete mode 100644 src/FreeDecoder.ts delete mode 100644 test/FreeDecoder.ts diff --git a/docs/modules/DecoderError.ts.md b/docs/modules/DecodeError.ts.md similarity index 96% rename from docs/modules/DecoderError.ts.md rename to docs/modules/DecodeError.ts.md index d11ce3da9..bd47ae0b0 100644 --- a/docs/modules/DecoderError.ts.md +++ b/docs/modules/DecodeError.ts.md @@ -1,10 +1,10 @@ --- -title: DecoderError.ts -nav_order: 3 +title: DecodeError.ts +nav_order: 2 parent: Modules --- -## DecoderError overview +## DecodeError overview Added in v2.2.7 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index f65c30ae0..e2c572343 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -1,6 +1,6 @@ --- title: Decoder.ts -nav_order: 2 +nav_order: 3 parent: Modules --- diff --git a/docs/modules/FreeDecoder.ts.md b/docs/modules/FreeDecoder.ts.md deleted file mode 100644 index f529010eb..000000000 --- a/docs/modules/FreeDecoder.ts.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: FreeDecoder.ts -nav_order: 7 -parent: Modules ---- - -## FreeDecoder overview - -Added in v2.2.7 - ---- - -

Table of contents

- -- [utils](#utils) - - [FreeDecoder (interface)](#freedecoder-interface) - - [UnknownRecord](#unknownrecord) - - [number](#number) - - [string](#string) - - [toForest](#toforest) - - [type](#type) - ---- - -# utils - -## FreeDecoder (interface) - -**Signature** - -```ts -export interface FreeDecoder extends DT.DecoderT>, A> {} -``` - -Added in v2.2.7 - -## UnknownRecord - -**Signature** - -```ts -export declare const UnknownRecord: (e: E) => FreeDecoder> -``` - -Added in v2.2.7 - -## number - -**Signature** - -```ts -export declare const number: (e: E) => FreeDecoder -``` - -Added in v2.2.7 - -## string - -**Signature** - -```ts -export declare const string: (e: E) => FreeDecoder -``` - -Added in v2.2.7 - -## toForest - -**Signature** - -```ts -export declare function toForest(s: FS.FreeSemigroup>): NEA.NonEmptyArray> -``` - -Added in v2.2.7 - -## type - -**Signature** - -```ts -export declare const type: ( - UnknownRecord: FreeDecoder> -) =>
(properties: { [K in keyof A]: FreeDecoder }) => FreeDecoder -``` - -Added in v2.2.7 diff --git a/docs/modules/FreeSemigroup.ts.md b/docs/modules/FreeSemigroup.ts.md index a34b55770..bca13657a 100644 --- a/docs/modules/FreeSemigroup.ts.md +++ b/docs/modules/FreeSemigroup.ts.md @@ -1,6 +1,6 @@ --- title: FreeSemigroup.ts -nav_order: 8 +nav_order: 7 parent: Modules --- diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 46472c9cb..956f58423 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -1,6 +1,6 @@ --- title: Guard.ts -nav_order: 9 +nav_order: 8 parent: Modules --- diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 4f0c02095..8f30252b0 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -1,6 +1,6 @@ --- title: JsonCodec.ts -nav_order: 11 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index f84480379..06b3a14b6 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 12 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 1db8dde68..2abc64ffe 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 13 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 175cf05b2..5aea2ce60 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 14 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index d9068def7..ec28e2aad 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 15 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 113c1df7e..2aa2386fc 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 16 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 279f12f55..cc33e2cf7 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 17 +nav_order: 16 parent: Modules --- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 5e3daa009..2ae3aaed3 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 10 +nav_order: 9 parent: Modules --- diff --git a/jest.config.js b/jest.config.js index ea4cd8f60..8228f2456 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,7 +2,7 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', collectCoverage: true, - collectCoverageFrom: ['src/**/*.ts'], + collectCoverageFrom: ['src/**/*.ts', '!src/DecodeError.ts', '!src/FreeSemigroup.ts'], transform: { '^.+\\.tsx?$': 'ts-jest' }, diff --git a/perf/DecoderT.ts b/perf/DecoderT.ts index 7178a7a25..74c7d6222 100644 --- a/perf/DecoderT.ts +++ b/perf/DecoderT.ts @@ -2,22 +2,23 @@ import * as Benchmark from 'benchmark' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import * as D from '../src/Decoder' -import * as DE from '../src/DecoderError' +import * as DE from '../src/DecodeError' import * as DT from '../src/DecoderT' -import * as FD from '../src/FreeDecoder' import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' +import * as T from 'fp-ts/lib/Tree' +import * as NEA from 'fp-ts/lib/NonEmptyArray' /* -Guard (good) x 35,369,047 ops/sec ±1.50% (86 runs sampled) -Decoder (good) x 4,653,320 ops/sec ±0.76% (87 runs sampled) -DecoderT (good) x 2,295,214 ops/sec ±1.10% (88 runs sampled) -Guard (bad) x 35,062,516 ops/sec ±1.48% (82 runs sampled) -Decoder (bad) x 1,225,890 ops/sec ±0.74% (89 runs sampled) -DecoderT (bad) x 2,011,330 ops/sec ±0.60% (86 runs sampled) -Decoder (draw) x 568,278 ops/sec ±2.85% (84 runs sampled) -DecoderT (draw) x 376,532 ops/sec ±1.78% (85 runs sampled) +Guard (good) x 34,238,300 ops/sec ±1.99% (82 runs sampled) +Decoder (good) x 4,617,403 ops/sec ±0.87% (88 runs sampled) +DecoderT (good) x 2,334,698 ops/sec ±1.04% (87 runs sampled) +Guard (bad) x 35,743,005 ops/sec ±1.31% (82 runs sampled) +Decoder (bad) x 1,239,790 ops/sec ±0.65% (91 runs sampled) +DecoderT (bad) x 1,980,574 ops/sec ±0.51% (88 runs sampled) +Decoder (draw) x 589,953 ops/sec ±2.11% (87 runs sampled) +DecoderT (draw) x 380,337 ops/sec ±0.36% (85 runs sampled) */ @@ -39,6 +40,18 @@ function getDecoderT() { }) } +function toForest(s: FS.FreeSemigroup>): NEA.NonEmptyArray> { + const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ + Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Required: (key, errors) => T.make(`required property ${JSON.stringify(key)}`, toForest(errors)) + }) + const toForest: (f: FS.FreeSemigroup>) => NEA.NonEmptyArray> = FS.fold( + (value) => NEA.of(toTree(value)), + (left, right) => NEA.concat(toForest(left), toForest(right)) + ) + return toForest(s) +} + const decoderT = getDecoderT() const guard = G.type({ @@ -84,7 +97,7 @@ suite .add('DecoderT (draw)', function () { pipe( decoderT.decode(bad), - E.mapLeft((e) => D.draw(FD.toForest(e))) + E.mapLeft((e) => D.draw(toForest(e))) ) }) .on('cycle', function (event: any) { diff --git a/src/DecoderError.ts b/src/DecodeError.ts similarity index 100% rename from src/DecoderError.ts rename to src/DecodeError.ts diff --git a/src/FreeDecoder.ts b/src/FreeDecoder.ts deleted file mode 100644 index b363e1b95..000000000 --- a/src/FreeDecoder.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @since 2.2.7 - */ -import * as FS from './FreeSemigroup' -import * as DE from './DecoderError' -import * as DT from './DecoderT' -import * as E from 'fp-ts/lib/Either' -import * as T from 'fp-ts/lib/Tree' -import * as NEA from 'fp-ts/lib/NonEmptyArray' - -const M = E.getValidation(DE.getSemigroup()) - -/** - * @since 2.2.7 - */ -export interface FreeDecoder extends DT.DecoderT>, A> {} - -/** - * @since 2.2.7 - */ -export const UnknownRecord = (e: E): FreeDecoder> => - DT.UnknownRecord(M)((u) => FS.of(DE.leaf(u, e))) - -/** - * @since 2.2.7 - */ -export const string = (e: E): FreeDecoder => DT.string(M)((u) => FS.of(DE.leaf(u, e))) - -/** - * @since 2.2.7 - */ -export const number = (e: E): FreeDecoder => DT.number(M)((u) => FS.of(DE.leaf(u, e))) - -/** - * @since 2.2.7 - */ -export const type = ( - UnknownRecord: FreeDecoder> -): ((properties: { [K in keyof A]: FreeDecoder }) => FreeDecoder) => - DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.required(k, e))) - -/** - * @since 2.2.7 - */ -export function toForest(s: FS.FreeSemigroup>): NEA.NonEmptyArray> { - const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ - Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Required: (key, errors) => T.make(`required property ${JSON.stringify(key)}`, toForest(errors)) - }) - const toForest: (f: FS.FreeSemigroup>) => NEA.NonEmptyArray> = FS.fold( - (value) => [toTree(value)], - (left, right) => NEA.concat(toForest(left), toForest(right)) - ) - return toForest(s) -} diff --git a/test/FreeDecoder.ts b/test/FreeDecoder.ts deleted file mode 100644 index bd11e46d7..000000000 --- a/test/FreeDecoder.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as assert from 'assert' -import * as DE from '../src/DecoderError' -import * as FD from '../src/FreeDecoder' -import * as FS from '../src/FreeSemigroup' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import { drawTree } from 'fp-ts/lib/Tree' - -const UnknownRecord = FD.UnknownRecord('Record') -const string = FD.string('string') -const number = FD.number('number') -const type = FD.type(UnknownRecord) - -describe('FreeDecoder', () => { - it('string', () => { - assert.deepStrictEqual(string.decode('a'), E.right('a')) - }) - - it('number', () => { - assert.deepStrictEqual(number.decode(1), E.right(1)) - }) - - it('type', () => { - const decoder = type({ - name: string, - age: number - }) - assert.deepStrictEqual(decoder.decode({ name: 'name', age: 18 }), E.right({ name: 'name', age: 18 })) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) - assert.deepStrictEqual( - decoder.decode({}), - E.left( - FS.concat( - FS.of(DE.required('name', FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.required('age', FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - - it('toForest', () => { - const decoder = type({ - name: string, - age: number - }) - const s = pipe( - decoder.decode({}), - E.mapLeft(FD.toForest), - E.fold( - (forest) => forest.map(drawTree).join('\n'), - () => '' - ) - ) - assert.deepStrictEqual( - s, - `required property \"name\" -└─ cannot decode undefined, should be string -required property \"age\" -└─ cannot decode undefined, should be number` - ) - }) -}) From 635bc8db69f17ade4778ce8b674237f15e3ed16c Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 21 Jun 2020 16:40:59 +0200 Subject: [PATCH 054/222] add TaskDecoder module --- CHANGELOG.md | 1 + docs/modules/DecodeError.ts.md | 92 ++++++++-- docs/modules/DecoderT.ts.md | 94 ++-------- docs/modules/TaskDecoder.ts.md | 240 +++++++++++++++++++++++++ docs/modules/Type.ts.md | 2 +- jest.config.js | 2 +- perf/DecoderT.ts | 38 ++-- src/DecodeError.ts | 67 +++++-- src/Decoder.ts | 12 +- src/DecoderT.ts | 103 +++-------- src/TaskDecoder.ts | 183 +++++++++++++++++++ test/Codec.ts | 14 +- test/DecoderT.ts | 69 ++------ test/TaskDecoder.ts | 313 +++++++++++++++++++++++++++++++++ 14 files changed, 968 insertions(+), 262 deletions(-) create mode 100644 docs/modules/TaskDecoder.ts.md create mode 100644 src/TaskDecoder.ts create mode 100644 test/TaskDecoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fa8713d2..0d5bfa471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - add `DecodeError` module (@gcanti) - add `DecoderT` module (@gcanti) - add `FreeSemigroup` module (@gcanti) + - add `TaskDecoder` module (@gcanti) - remove `Tree` module (@gcanti) # 2.2.6 diff --git a/docs/modules/DecodeError.ts.md b/docs/modules/DecodeError.ts.md index bd47ae0b0..67892bf81 100644 --- a/docs/modules/DecodeError.ts.md +++ b/docs/modules/DecodeError.ts.md @@ -13,37 +13,52 @@ Added in v2.2.7

Table of contents

- [constructors](#constructors) + - [index](#index) + - [key](#key) - [leaf](#leaf) - - [required](#required) - [destructors](#destructors) - [fold](#fold) - [instances](#instances) - [getSemigroup](#getsemigroup) - [model](#model) - [DecodeError (type alias)](#decodeerror-type-alias) + - [Index (interface)](#index-interface) + - [Key (interface)](#key-interface) + - [Kind (type alias)](#kind-type-alias) - [Leaf (interface)](#leaf-interface) - - [Required (interface)](#required-interface) + - [optional](#optional) + - [required](#required) --- # constructors -## leaf +## index **Signature** ```ts -export declare const leaf: (input: unknown, error: E) => DecodeError +export declare const index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError ``` Added in v2.2.7 -## required +## key + +**Signature** + +```ts +export declare const key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError +``` + +Added in v2.2.7 + +## leaf **Signature** ```ts -export declare const required: (key: string, errors: FS.FreeSemigroup>) => DecodeError +export declare const leaf: (actual: unknown, error: E) => DecodeError ``` Added in v2.2.7 @@ -57,7 +72,8 @@ Added in v2.2.7 ```ts export declare const fold: (patterns: { Leaf: (input: unknown, error: E) => R - Required: (k: string, errors: FS.FreeSemigroup>) => R + Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R + Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R }) => (e: DecodeError) => R ``` @@ -82,7 +98,47 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = Leaf | Required +export type DecodeError = Leaf | Key | Index +``` + +Added in v2.2.7 + +## Index (interface) + +**Signature** + +```ts +export interface Index { + readonly _tag: 'Index' + readonly index: number + readonly kind: Kind + readonly errors: FS.FreeSemigroup> +} +``` + +Added in v2.2.7 + +## Key (interface) + +**Signature** + +```ts +export interface Key { + readonly _tag: 'Key' + readonly key: string + readonly kind: Kind + readonly errors: FS.FreeSemigroup> +} +``` + +Added in v2.2.7 + +## Kind (type alias) + +**Signature** + +```ts +export type Kind = 'required' | 'optional' ``` Added in v2.2.7 @@ -94,23 +150,29 @@ Added in v2.2.7 ```ts export interface Leaf { readonly _tag: 'Leaf' - readonly input: unknown + readonly actual: unknown readonly error: E } ``` Added in v2.2.7 -## Required (interface) +## optional **Signature** ```ts -export interface Required { - readonly _tag: 'Required' - readonly key: string - readonly errors: FS.FreeSemigroup> -} +export declare const optional: 'optional' +``` + +Added in v2.2.7 + +## required + +**Signature** + +```ts +export declare const required: 'required' ``` Added in v2.2.7 diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index f750e4e51..906568f8d 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -16,17 +16,10 @@ Added in v2.2.7 - [array](#array) - [partial](#partial) - [record](#record) + - [tuple](#tuple) - [type](#type) -- [constructors](#constructors) - - [fromGuard](#fromguard) - [model](#model) - [DecoderT (interface)](#decodert-interface) -- [primitives](#primitives) - - [UnknownArray](#unknownarray) - - [UnknownRecord](#unknownrecord) - - [boolean](#boolean) - - [number](#number) - - [string](#string) --- @@ -77,31 +70,32 @@ export declare function record( Added in v2.2.7 -## type +## tuple **Signature** ```ts -export declare function type( +export declare function tuple( M: Monad2C & Bifunctor2 ): ( - UnknownRecord: DecoderT>, - onKeyError: (k: string, e: E) => E -) =>
(properties: { [K in keyof A]: DecoderT }) => DecoderT + UnknownArray: DecoderT>, + onIndexError: (i: number, e: E) => E +) => >(...components: { [K in keyof A]: DecoderT }) => DecoderT ``` Added in v2.2.7 -# constructors - -## fromGuard +## type **Signature** ```ts -export declare const fromGuard: ( - M: MonadThrow2C -) => (guard: G.Guard, onError: (u: unknown) => E) => DecoderT +export declare function type( + M: Monad2C & Bifunctor2 +): ( + UnknownRecord: DecoderT>, + onKeyError: (k: string, e: E) => E +) => (properties: { [K in keyof A]: DecoderT }) => DecoderT ``` Added in v2.2.7 @@ -119,65 +113,3 @@ export interface DecoderT { ``` Added in v2.2.7 - -# primitives - -## UnknownArray - -**Signature** - -```ts -export declare const UnknownArray: ( - M: MonadThrow2C -) => (onError: (u: unknown) => E) => DecoderT -``` - -Added in v2.2.7 - -## UnknownRecord - -**Signature** - -```ts -export declare const UnknownRecord: ( - M: MonadThrow2C -) => (onError: (u: unknown) => E) => DecoderT> -``` - -Added in v2.2.7 - -## boolean - -**Signature** - -```ts -export declare const boolean: ( - M: MonadThrow2C -) => (onError: (u: unknown) => E) => DecoderT -``` - -Added in v2.2.7 - -## number - -**Signature** - -```ts -export declare const number: ( - M: MonadThrow2C -) => (onError: (u: unknown) => E) => DecoderT -``` - -Added in v2.2.7 - -## string - -**Signature** - -```ts -export declare const string: ( - M: MonadThrow2C -) => (onError: (u: unknown) => E) => DecoderT -``` - -Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md new file mode 100644 index 000000000..ba5db8cf3 --- /dev/null +++ b/docs/modules/TaskDecoder.ts.md @@ -0,0 +1,240 @@ +--- +title: TaskDecoder.ts +nav_order: 16 +parent: Modules +--- + +## TaskDecoder overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [DecodeError](#decodeerror) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [failure](#failure) + - [success](#success) +- [combinators](#combinators) + - [array](#array) + - [literal](#literal) + - [partial](#partial) + - [record](#record) + - [tuple](#tuple) + - [type](#type) +- [constructors](#constructors) + - [fromGuard](#fromguard) +- [model](#model) + - [TaskDecoder (interface)](#taskdecoder-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [never](#never) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [draw](#draw) + +--- + +# DecodeError + +## DecodeError (type alias) + +**Signature** + +```ts +export type DecodeError = FS.FreeSemigroup> +``` + +Added in v2.2.7 + +## failure + +**Signature** + +```ts +export declare function failure
(actual: unknown, message: string): TE.TaskEither +``` + +Added in v2.2.7 + +## success + +**Signature** + +```ts +export declare function success(a: A): TE.TaskEither +``` + +Added in v2.2.7 + +# combinators + +## array + +**Signature** + +```ts +export declare const array: (items: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare const literal: (...values: A) => TaskDecoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare const record: (codomain: TaskDecoder) => TaskDecoder> +``` + +Added in v2.2.7 + +## tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: TaskDecoder } +) => TaskDecoder +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder<{ [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 + +# constructors + +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder +``` + +Added in v2.2.7 + +# model + +## TaskDecoder (interface) + +**Signature** + +```ts +export interface TaskDecoder { + readonly decode: (u: unknown) => TE.TaskEither +} +``` + +Added in v2.2.7 + +# primitives + +## UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: TaskDecoder +``` + +Added in v2.2.7 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: TaskDecoder> +``` + +Added in v2.2.7 + +## boolean + +**Signature** + +```ts +export declare const boolean: TaskDecoder +``` + +Added in v2.2.7 + +## never + +**Signature** + +```ts +export declare const never: TaskDecoder +``` + +Added in v2.2.7 + +## number + +**Signature** + +```ts +export declare const number: TaskDecoder +``` + +Added in v2.2.7 + +## string + +**Signature** + +```ts +export declare const string: TaskDecoder +``` + +Added in v2.2.7 + +# utils + +## draw + +**Signature** + +```ts +export declare const draw: (e: FS.FreeSemigroup>) => string +``` + +Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index cc33e2cf7..279f12f55 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 16 +nav_order: 17 parent: Modules --- diff --git a/jest.config.js b/jest.config.js index 8228f2456..ea4cd8f60 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,7 +2,7 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', collectCoverage: true, - collectCoverageFrom: ['src/**/*.ts', '!src/DecodeError.ts', '!src/FreeSemigroup.ts'], + collectCoverageFrom: ['src/**/*.ts'], transform: { '^.+\\.tsx?$': 'ts-jest' }, diff --git a/perf/DecoderT.ts b/perf/DecoderT.ts index 74c7d6222..5d0826ae9 100644 --- a/perf/DecoderT.ts +++ b/perf/DecoderT.ts @@ -11,14 +11,14 @@ import * as NEA from 'fp-ts/lib/NonEmptyArray' /* -Guard (good) x 34,238,300 ops/sec ±1.99% (82 runs sampled) -Decoder (good) x 4,617,403 ops/sec ±0.87% (88 runs sampled) -DecoderT (good) x 2,334,698 ops/sec ±1.04% (87 runs sampled) -Guard (bad) x 35,743,005 ops/sec ±1.31% (82 runs sampled) -Decoder (bad) x 1,239,790 ops/sec ±0.65% (91 runs sampled) -DecoderT (bad) x 1,980,574 ops/sec ±0.51% (88 runs sampled) -Decoder (draw) x 589,953 ops/sec ±2.11% (87 runs sampled) -DecoderT (draw) x 380,337 ops/sec ±0.36% (85 runs sampled) +Guard (good) x 35,343,457 ops/sec ±1.74% (82 runs sampled) +Decoder (good) x 4,830,970 ops/sec ±0.67% (87 runs sampled) +DecoderT (good) x 2,335,998 ops/sec ±0.78% (88 runs sampled) +Guard (bad) x 34,999,708 ops/sec ±1.77% (80 runs sampled) +Decoder (bad) x 1,225,579 ops/sec ±0.76% (89 runs sampled) +DecoderT (bad) x 2,048,515 ops/sec ±0.59% (87 runs sampled) +Decoder (draw) x 584,376 ops/sec ±2.17% (90 runs sampled) +DecoderT (draw) x 368,724 ops/sec ±0.66% (84 runs sampled) */ @@ -28,11 +28,18 @@ const decoder = D.type({ }) function getDecoderT() { - const M = E.getValidation(DE.getSemigroup()) - const UnknownRecord = DT.UnknownRecord(M)((u) => FS.of(DE.leaf(u, 'Record'))) - const string = DT.string(M)((u) => FS.of(DE.leaf(u, 'string'))) - const number = DT.number(M)((u) => FS.of(DE.leaf(u, 'number'))) - const type = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.required(k, e))) + type E = string + const M = E.getValidation(DE.getSemigroup()) + function fromGuard(guard: G.Guard, expected: E): DT.DecoderT>, A> { + return { + decode: (u) => (guard.is(u) ? E.right(u) : E.left(FS.of(DE.leaf(u, expected)))) + } + } + + const UnknownRecord = fromGuard(G.UnknownRecord, 'Record') + const string = fromGuard(G.string, 'string') + const number = fromGuard(G.number, 'number') + const type = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) return type({ name: string, @@ -43,7 +50,10 @@ function getDecoderT() { function toForest(s: FS.FreeSemigroup>): NEA.NonEmptyArray> { const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Required: (key, errors) => T.make(`required property ${JSON.stringify(key)}`, toForest(errors)) + Key: (key, required, errors) => + T.make(`${required ? 'required' : 'optional'} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (key, required, errors) => + T.make(`${required ? 'required' : 'optional'} index ${JSON.stringify(key)}`, toForest(errors)) }) const toForest: (f: FS.FreeSemigroup>) => NEA.NonEmptyArray> = FS.fold( (value) => NEA.of(toTree(value)), diff --git a/src/DecodeError.ts b/src/DecodeError.ts index a54798b97..1a4d71ef4 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -10,7 +10,7 @@ import * as FS from './FreeSemigroup' */ export interface Leaf { readonly _tag: 'Leaf' - readonly input: unknown + readonly actual: unknown readonly error: E } @@ -18,9 +18,28 @@ export interface Leaf { * @category model * @since 2.2.7 */ -export interface Required { - readonly _tag: 'Required' +export const required: 'required' = 'required' + +/** + * @category model + * @since 2.2.7 + */ +export const optional: 'optional' = 'optional' + +/** + * @category model + * @since 2.2.7 + */ +export type Kind = 'required' | 'optional' + +/** + * @category model + * @since 2.2.7 + */ +export interface Key { + readonly _tag: 'Key' readonly key: string + readonly kind: Kind readonly errors: FS.FreeSemigroup> } @@ -28,21 +47,44 @@ export interface Required { * @category model * @since 2.2.7 */ -export type DecodeError = Leaf | Required +export interface Index { + readonly _tag: 'Index' + readonly index: number + readonly kind: Kind + readonly errors: FS.FreeSemigroup> +} + +/** + * @category model + * @since 2.2.7 + */ +export type DecodeError = Leaf | Key | Index /** * @category constructors * @since 2.2.7 */ -export const leaf = (input: unknown, error: E): DecodeError => ({ _tag: 'Leaf', input, error }) +export const leaf = (actual: unknown, error: E): DecodeError => ({ _tag: 'Leaf', actual, error }) /** * @category constructors * @since 2.2.7 */ -export const required = (key: string, errors: FS.FreeSemigroup>): DecodeError => ({ - _tag: 'Required', +export const key = (key: string, kind: Kind, errors: FS.FreeSemigroup>): DecodeError => ({ + _tag: 'Key', key, + kind, + errors +}) + +/** + * @category constructors + * @since 2.2.7 + */ +export const index = (index: number, kind: Kind, errors: FS.FreeSemigroup>): DecodeError => ({ + _tag: 'Index', + index, + kind, errors }) @@ -52,14 +94,17 @@ export const required = (key: string, errors: FS.FreeSemigroup */ export const fold = (patterns: { Leaf: (input: unknown, error: E) => R - Required: (k: string, errors: FS.FreeSemigroup>) => R + Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R + Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R }): ((e: DecodeError) => R) => { const f = (e: DecodeError): R => { switch (e._tag) { case 'Leaf': - return patterns.Leaf(e.input, e.error) - case 'Required': - return patterns.Required(e.key, e.errors) + return patterns.Leaf(e.actual, e.error) + case 'Key': + return patterns.Key(e.key, e.kind, e.errors) + case 'Index': + return patterns.Index(e.index, e.kind, e.errors) } } return f diff --git a/src/Decoder.ts b/src/Decoder.ts index abc826b5f..3c6aa3b1b 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -109,11 +109,9 @@ export function fromGuard(guard: G.Guard, expected: string): Decoder { * @since 2.2.0 */ export function literal>(...values: A): Decoder { - if (values.length === 0) { - return never - } - const expected = values.map((value) => JSON.stringify(value)).join(' | ') - return fromGuard(G.schemableGuard.literal(...values), expected) + return values.length === 0 + ? never + : fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) } // ------------------------------------------------------------------------------------- @@ -337,7 +335,7 @@ export function array(items: Decoder): Decoder> { for (let i = 0; i < len; i++) { const e = items.decode(us[i]) if (E.isLeft(e)) { - errors.push(tree(`item ${i}`, e.left)) + errors.push(tree(`optional index ${i}`, e.left)) } else { a[i] = e.right } @@ -365,7 +363,7 @@ export function tuple>(...components: { [K in k for (let i = 0; i < components.length; i++) { const e = components[i].decode(us[i]) if (E.isLeft(e)) { - errors.push(tree(`component ${i}`, e.left)) + errors.push(tree(`required index ${i}`, e.left)) } else { a.push(e.right) } diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 1077a1c2a..1906b5337 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -3,11 +3,9 @@ */ import { Applicative2C } from 'fp-ts/lib/Applicative' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import * as E from 'fp-ts/lib/Either' import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import * as G from './Guard' -import * as E from 'fp-ts/lib/Either' // ------------------------------------------------------------------------------------- // model @@ -21,77 +19,6 @@ export interface DecoderT { readonly decode: (u: unknown) => Kind2 } -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromGuard = (M: MonadThrow2C) => ( - guard: G.Guard, - onError: (u: unknown) => E -): DecoderT => { - return { - decode: (u) => (guard.is(u) ? M.of(u) : M.throwError(onError(u))) - } -} - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.7 - */ -export const string = (M: MonadThrow2C) => ( - onError: (u: unknown) => E -): DecoderT => { - return fromGuard(M)(G.string, onError) -} - -/** - * @category primitives - * @since 2.2.7 - */ -export const number = (M: MonadThrow2C) => ( - onError: (u: unknown) => E -): DecoderT => { - return fromGuard(M)(G.number, onError) -} - -/** - * @category primitives - * @since 2.2.7 - */ -export const boolean = (M: MonadThrow2C) => ( - onError: (u: unknown) => E -): DecoderT => { - return fromGuard(M)(G.boolean, onError) -} - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownArray = (M: MonadThrow2C) => ( - onError: (u: unknown) => E -): DecoderT> => { - return fromGuard(M)(G.UnknownArray, onError) -} - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownRecord = (M: MonadThrow2C) => ( - onError: (u: unknown) => E -): DecoderT> => { - return fromGuard(M)(G.UnknownRecord, onError) -} - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -129,6 +56,7 @@ export function partial( ) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> { const traverse = traverseRecordWithIndex(M) const skip = M.of>(E.left(undefined)) + const undef = M.of>(E.right(undefined)) return (UnknownRecord, onKeyError) => (properties) => ({ decode: (u) => M.map( @@ -136,7 +64,11 @@ export function partial( traverse(properties as Record>, (k, decoder) => { const rk = r[k] if (rk === undefined) { - return skip + return k in r + ? // don't strip undefined properties + undef + : // don't add missing properties + skip } return M.bimap( decoder.decode(rk), @@ -188,6 +120,27 @@ export function record( }) } +/** + * @category combinators + * @since 2.2.7 + */ +export function tuple( + M: Monad2C & Bifunctor2 +): ( + UnknownArray: DecoderT>, + onIndexError: (i: number, e: E) => E +) => >(...components: { [K in keyof A]: DecoderT }) => DecoderT { + const traverse = traverseArrayWithIndex(M) + return (UnknownArray, onIndexError) => (...components) => ({ + decode: (u) => + M.chain(UnknownArray.decode(u), (us) => + traverse((components as unknown) as Array>, (i, decoder) => + M.mapLeft(decoder.decode(us[i]), (e) => onIndexError(i, e)) + ) + ) as any + }) +} + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts new file mode 100644 index 000000000..96003145a --- /dev/null +++ b/src/TaskDecoder.ts @@ -0,0 +1,183 @@ +/** + * @since 2.2.7 + */ +import * as TE from 'fp-ts/lib/TaskEither' +import * as DE from './DecodeError' +import * as DT from './DecoderT' +import * as FS from '../src/FreeSemigroup' +import * as G from './Guard' +import * as NEA from 'fp-ts/lib/NonEmptyArray' +import * as T from 'fp-ts/lib/Tree' +import { Literal } from './Schemable' + +const M = TE.getTaskValidation(DE.getSemigroup()) + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface TaskDecoder { + readonly decode: (u: unknown) => TE.TaskEither +} + +// ------------------------------------------------------------------------------------- +// DecodeError +// ------------------------------------------------------------------------------------- + +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = FS.FreeSemigroup> + +/** + * @category DecodeError + * @since 2.2.7 + */ +export function success(a: A): TE.TaskEither { + return TE.right(a) +} + +/** + * @category DecodeError + * @since 2.2.7 + */ +export function failure(actual: unknown, message: string): TE.TaskEither { + return TE.left(FS.of(DE.leaf(actual, message))) +} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => ({ + decode: (u) => (guard.is(u) ? success(u) : failure(u, expected)) +}) + +// TODO: add fromDecoder: (decoder: D.Decoder) => TaskDecoder + +/** + * @category combinators + * @since 2.2.7 + */ +export const literal = >(...values: A): TaskDecoder => + values.length === 0 + ? never + : fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @category primitives + * @since 2.2.7 + */ +export const never: TaskDecoder = fromGuard(G.never, 'never') + +/** + * @category primitives + * @since 2.2.7 + */ +export const string: TaskDecoder = fromGuard(G.string, 'string') + +/** + * @category primitives + * @since 2.2.7 + */ +export const number: TaskDecoder = fromGuard(G.number, 'number') + +/** + * @category primitives + * @since 2.2.7 + */ +export const boolean: TaskDecoder = fromGuard(G.boolean, 'boolean') + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownArray: TaskDecoder> = fromGuard(G.UnknownArray, 'Array') + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownRecord: TaskDecoder> = fromGuard(G.UnknownRecord, 'Record') + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @category combinators + * @since 2.2.7 + */ +export const type: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder<{ [K in keyof A]: A[K] }> = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const partial: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder> = DT.partial(M)(UnknownRecord, (k, e) => + FS.of(DE.key(k, DE.optional, e)) +) + +/** + * @category combinators + * @since 2.2.7 + */ +export const array: (items: TaskDecoder) => TaskDecoder> = DT.array(M)(UnknownArray, (i, e) => + FS.of(DE.index(i, DE.optional, e)) +) + +/** + * @category combinators + * @since 2.2.7 + */ +export const record: (codomain: TaskDecoder) => TaskDecoder> = DT.record(M)( + UnknownRecord, + (k, e) => FS.of(DE.key(k, DE.optional, e)) +) + +/** + * @category combinators + * @since 2.2.7 + */ +export const tuple: >( + ...components: { [K in keyof A]: TaskDecoder } +) => TaskDecoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +const toForest = (e: DecodeError): NEA.NonEmptyArray> => { + const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ + Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)) + }) + const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( + (value) => [toTree(value)], + (left, right) => NEA.concat(toForest(left), toForest(right)) + ) + return toForest(e) +} + +/** + * @since 2.2.7 + */ +export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') diff --git a/test/Codec.ts b/test/Codec.ts index 7b3809e56..204a8ed58 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -414,7 +414,7 @@ describe('Codec', () => { ) assert.deepStrictEqual( codec.decode([1]), - left([D.tree('item 0', [D.tree('cannot decode 1, should be string')])]) + left([D.tree('optional index 0', [D.tree('cannot decode 1, should be string')])]) ) }) @@ -423,8 +423,8 @@ describe('Codec', () => { assert.deepStrictEqual( codec.decode([1, 2]), left([ - D.tree('item 0', [D.tree('cannot decode 1, should be string')]), - D.tree('item 1', [D.tree('cannot decode 2, should be string')]) + D.tree('optional index 0', [D.tree('cannot decode 1, should be string')]), + D.tree('optional index 1', [D.tree('cannot decode 2, should be string')]) ]) ) }) @@ -457,11 +457,11 @@ describe('Codec', () => { ) assert.deepStrictEqual( codec.decode(['a']), - left([D.tree('component 1', [D.tree('cannot decode undefined, should be number')])]) + left([D.tree('required index 1', [D.tree('cannot decode undefined, should be number')])]) ) assert.deepStrictEqual( codec.decode([1, 2]), - left([D.tree('component 0', [D.tree('cannot decode 1, should be string')])]) + left([D.tree('required index 0', [D.tree('cannot decode 1, should be string')])]) ) }) @@ -470,8 +470,8 @@ describe('Codec', () => { assert.deepStrictEqual( codec.decode([1, 'a']), left([ - D.tree('component 0', [D.tree('cannot decode 1, should be string')]), - D.tree('component 1', [D.tree('cannot decode "a", should be number')]) + D.tree('required index 0', [D.tree('cannot decode 1, should be string')]), + D.tree('required index 1', [D.tree('cannot decode "a", should be number')]) ]) ) }) diff --git a/test/DecoderT.ts b/test/DecoderT.ts index dd895a5b9..ded0e2fd9 100644 --- a/test/DecoderT.ts +++ b/test/DecoderT.ts @@ -1,63 +1,26 @@ import * as assert from 'assert' import * as E from 'fp-ts/lib/Either' import * as NEA from 'fp-ts/lib/NonEmptyArray' -import * as DT from '../src/DecoderT' import { pipe } from 'fp-ts/lib/pipeable' -import * as TE from 'fp-ts/lib/TaskEither' import * as T from 'fp-ts/lib/Tree' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import * as DT from '../src/DecoderT' +import * as G from '../src/Guard' const M = E.getValidation(NEA.getSemigroup>()) -const UnknownArray = DT.UnknownArray(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be Array`)]) -const UnknownRecord = DT.UnknownRecord(M)((u) => [ - T.make(`cannot decode ${JSON.stringify(u)}, should be Record`) -]) -export const string = DT.string(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be string`)]) -export const number = DT.number(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be number`)]) -export const boolean = DT.boolean(M)((u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be boolean`)]) -export const type = DT.type(M)(UnknownRecord, (k, e) => - pipe( - e, - NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) - ) -) - -describe('DecoderT', () => { - it('should support asynchronous decoders', async () => { - const M = TE.getTaskValidation(NEA.getSemigroup()) - const UnknownArray = DT.UnknownArray(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be Array`]) - const array = DT.array(M)(UnknownArray, (i, e) => - pipe( - e, - NEA.map((s) => `item ${i}: ${s}`) - ) - ) - const string = DT.string(M)((u) => [`cannot decode ${JSON.stringify(u)}, should be string`]) - const decoder = array(string) - assert.deepStrictEqual(await decoder.decode(['a', 'b'])(), E.right(['a', 'b'])) - assert.deepStrictEqual( - await decoder.decode([1, 2])(), - E.left(['item 0: cannot decode 1, should be string', 'item 1: cannot decode 2, should be string']) - ) - }) - it('should support fail fast decoders', () => { - const M: MonadThrow2C & Bifunctor2 = E.either as any - const UnknownArray = DT.UnknownArray(M)((u) => `cannot decode ${JSON.stringify(u)}, should be Array`) - const array = DT.array(M)(UnknownArray, (i, e) => `item ${i}: ${e}`) - const string = DT.string(M)((u) => `cannot decode ${JSON.stringify(u)}, should be string`) - const decoder = array(string) - assert.deepStrictEqual(decoder.decode(['a', 'b']), E.right(['a', 'b'])) - assert.deepStrictEqual(decoder.decode([1, 2]), E.left('item 0: cannot decode 1, should be string')) - }) +function fromGuard(guard: G.Guard, expected: string): DT.DecoderT>, A> { + return { + decode: (u) => + guard.is(u) ? E.right(u) : E.left([T.make(`cannot decode ${JSON.stringify(u)}, should be ${expected}`)]) + } +} - it('boolean', () => { - assert.deepStrictEqual(boolean.decode(true), E.right(true)) - assert.deepStrictEqual(boolean.decode(false), E.right(false)) - assert.deepStrictEqual(boolean.decode(null), E.left([T.make('cannot decode null, should be boolean')])) - }) +const UnknownArray = fromGuard(G.UnknownArray, 'Array') +const UnknownRecord = fromGuard(G.UnknownRecord, 'Record') +const string = fromGuard(G.string, 'string') +const number = fromGuard(G.number, 'number') +describe('DecoderT', () => { it('array', () => { const array = DT.array(M)(UnknownArray, (i, e) => pipe( @@ -101,6 +64,12 @@ describe('DecoderT', () => { }) it('type', () => { + const type = DT.type(M)(UnknownRecord, (k, e) => + pipe( + e, + NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) + ) + ) const decoder = type({ name: string, age: number diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts new file mode 100644 index 000000000..343a16213 --- /dev/null +++ b/test/TaskDecoder.ts @@ -0,0 +1,313 @@ +import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as TE from 'fp-ts/lib/TaskEither' +import * as DE from '../src/DecodeError' +import * as FS from '../src/FreeSemigroup' +import * as G from '../src/Guard' +import * as D from '../src/TaskDecoder' + +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: D.TaskDecoder = D.fromGuard(undefinedGuard, 'undefined') + +describe('TaskDecoder', () => { + it('string', async () => { + assert.deepStrictEqual(await D.string.decode('a')(), E.right('a')) + assert.deepStrictEqual(await D.string.decode(null)(), E.left(FS.of(DE.leaf(null, 'string')))) + }) + + it('number', async () => { + assert.deepStrictEqual(await D.number.decode(1)(), E.right(1)) + assert.deepStrictEqual(await D.number.decode(null)(), E.left(FS.of(DE.leaf(null, 'number')))) + }) + + it('boolean', async () => { + assert.deepStrictEqual(await D.boolean.decode(true)(), E.right(true)) + assert.deepStrictEqual(await D.boolean.decode(null)(), E.left(FS.of(DE.leaf(null, 'boolean')))) + }) + + it('UnknownArray', async () => { + assert.deepStrictEqual(await D.UnknownArray.decode([1, 'a'])(), E.right([1, 'a'])) + assert.deepStrictEqual(await D.UnknownArray.decode(null)(), E.left(FS.of(DE.leaf(null, 'Array')))) + }) + + it('UnknownRecord', async () => { + assert.deepStrictEqual(await D.UnknownRecord.decode({ a: 1, b: 'b' })(), E.right({ a: 1, b: 'b' })) + assert.deepStrictEqual( + await D.UnknownRecord.decode(null)(), + E.left(FS.of(DE.leaf(null, 'Record'))) + ) + }) + + describe('literal', () => { + it('should decode a valid input', async () => { + const codec = D.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(await codec.decode('a')(), E.right('a')) + assert.deepStrictEqual(await codec.decode(null)(), E.right(null)) + }) + + it('should reject an invalid input', async () => { + const codec = D.literal('a', null) + assert.deepStrictEqual(await codec.decode('b')(), E.left(FS.of(DE.leaf('b', '"a" | null')))) + }) + + it('should handle zero members', async () => { + assert.deepStrictEqual(await D.literal().decode({})(), E.left(FS.of(DE.leaf({}, 'never')))) + }) + }) + + describe('type', () => { + it('should decode a valid input', async () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual(await codec.decode({ a: 'a' })(), E.right({ a: 'a' })) + }) + + it('should strip additional fields', async () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual(await codec.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const codec = D.type({ + a: undef + }) + assert.deepStrictEqual(await codec.decode({})(), E.right({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual( + await codec.decode(undefined)(), + E.left(FS.of(DE.leaf(undefined, 'Record'))) + ) + assert.deepStrictEqual( + await codec.decode({ a: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.type({ + a: D.string, + b: D.number + }) + assert.deepStrictEqual( + await codec.decode({})(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const codec = D.type({ a: D.string, b: D.string }) + assert.deepStrictEqual(await codec.decode(new A())(), E.right({ a: 'a', b: 'b' })) + }) + }) + + describe('partial', () => { + it('should decode a valid input', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(await codec.decode({ a: 'a' })(), E.right({ a: 'a' })) + assert.deepStrictEqual(await codec.decode({})(), E.right({})) + }) + + it('should strip additional fields', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(await codec.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) + }) + + it('should not add missing fields', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(await codec.decode({})(), E.right({})) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(await codec.decode({ a: undefined })(), E.right({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual( + await codec.decode(undefined)(), + E.left(FS.of(DE.leaf(undefined, 'Record'))) + ) + assert.deepStrictEqual( + await codec.decode({ a: 1 })(), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.partial({ + a: D.string, + b: D.number + }) + assert.deepStrictEqual( + await codec.decode({ a: 1, b: 'b' })(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const codec = D.partial({ a: D.string, b: D.string }) + assert.deepStrictEqual(await codec.decode(new A())(), E.right({ a: 'a', b: 'b' })) + }) + }) + + describe('array', () => { + it('should decode a valid input', async () => { + const codec = D.array(D.string) + assert.deepStrictEqual(await codec.decode([])(), E.right([])) + assert.deepStrictEqual(await codec.decode(['a'])(), E.right(['a'])) + }) + + it('should reject an invalid input', async () => { + const codec = D.array(D.string) + assert.deepStrictEqual(await codec.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual( + await codec.decode([1])(), + E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.array(D.string) + assert.deepStrictEqual( + await codec.decode([1, 2])(), + E.left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) + ) + }) + }) + + describe('record', () => { + it('should decode a valid value', async () => { + const codec = D.record(D.number) + assert.deepStrictEqual(await codec.decode({})(), E.right({})) + assert.deepStrictEqual(await codec.decode({ a: 1 })(), E.right({ a: 1 })) + }) + + it('should reject an invalid value', async () => { + const codec = D.record(D.number) + assert.deepStrictEqual( + await codec.decode(undefined)(), + E.left(FS.of(DE.leaf(undefined, 'Record'))) + ) + assert.deepStrictEqual( + await codec.decode({ a: 'a' })(), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.record(D.number) + assert.deepStrictEqual( + await codec.decode({ a: 'a', b: 'b' })(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + }) + + describe('tuple', () => { + it('should decode a valid input', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual(await codec.decode(['a', 1])(), E.right(['a', 1])) + }) + + it('should handle zero components', async () => { + assert.deepStrictEqual(await D.tuple().decode([])(), E.right([])) + }) + + it('should reject an invalid input', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual(await codec.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual( + await codec.decode(['a'])(), + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + await codec.decode([1, 2])(), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual( + await codec.decode([1, 'a'])(), + E.left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) + ) + }) + + it('should strip additional components', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual(await codec.decode(['a', 1, true])(), E.right(['a', 1])) + }) + }) + + it('draw', async () => { + const decoder = D.type({ + a: D.string, + b: D.number, + c: D.array(D.boolean) + }) + assert.deepStrictEqual( + await pipe(decoder.decode({ c: [1] }), TE.mapLeft(D.draw))(), + E.left(`required property "a" +└─ cannot decode undefined, should be string +required property "b" +└─ cannot decode undefined, should be number +required property "c" +└─ optional index 0 + └─ cannot decode 1, should be boolean`) + ) + }) +}) From a56b46eb9527d9edea1caf0f6bf87348b387a176 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 21 Jun 2020 19:39:01 +0200 Subject: [PATCH 055/222] better `literal` signature --- CHANGELOG.md | 2 ++ docs/modules/Codec.ts.md | 4 +++- docs/modules/Decoder.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/Schemable.ts.md | 4 ++-- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 2 +- dtslint/ts3.5/Schema.ts | 4 ++++ src/Codec.ts | 2 +- src/Decoder.ts | 7 ++----- src/DecoderT.ts | 15 +++++++++++++++ src/Guard.ts | 2 +- src/JsonCodec.ts | 3 ++- src/Schemable.ts | 4 ++-- src/TaskDecoder.ts | 6 ++---- src/Type.ts | 2 +- test/Codec.ts | 4 ---- test/TaskDecoder.ts | 4 ---- 20 files changed, 43 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d5bfa471..239f44b01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ - add `FreeSemigroup` module (@gcanti) - add `TaskDecoder` module (@gcanti) - remove `Tree` module (@gcanti) + - `Schemable` + - better `literal` signature (@gcanti) # 2.2.6 diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 0c352a7d5..fcd3d6f3a 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -204,7 +204,9 @@ Added in v2.2.3 **Signature** ```ts -export declare function literal>(...values: A): Codec +export declare function literal]>( + ...values: A +): Codec ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index e2c572343..8772a17e7 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -302,7 +302,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function literal>(...values: A): Decoder +export declare const literal: (...values: A) => Decoder ``` Added in v2.2.0 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 956f58423..637535ff9 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -171,7 +171,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function literal>(...values: A): Guard +export declare function literal]>(...values: A): Guard ``` Added in v2.2.0 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 8f30252b0..c3a0ef9e0 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -189,7 +189,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const literal: (...values: A) => JsonCodec +export declare const literal: (...values: A) => JsonCodec ``` Added in v2.2.3 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 2aa2386fc..556179d86 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -45,7 +45,7 @@ Added in v2.2.0 ```ts export interface Schemable { readonly URI: S - readonly literal: >(...values: A) => HKT + readonly literal: ]>(...values: A) => HKT readonly string: HKT readonly number: HKT readonly boolean: HKT @@ -70,7 +70,7 @@ Added in v2.2.3 ```ts export interface Schemable1 { readonly URI: S - readonly literal: >(...values: A) => Kind + readonly literal: ]>(...values: A) => Kind readonly string: Kind readonly number: Kind readonly boolean: Kind diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index ba5db8cf3..e6ad0e396 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -88,7 +88,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: (...values: A) => TaskDecoder +export declare const literal: (...values: A) => TaskDecoder ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 279f12f55..070926799 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -166,7 +166,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function literal>(...values: A): Type +export declare function literal]>(...values: A): Type ``` Added in v2.2.3 diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 2ae3aaed3..0ee2410e8 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -280,7 +280,7 @@ Added in v1.0.0 **Signature** ```ts -export declare const literal: (value: V, name?: string) => LiteralC +export declare const literal: (value: V, name?: string) => LiteralC ``` Added in v1.0.0 diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index 4725e72e4..771135868 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -20,7 +20,11 @@ export type OfTest = TypeOf // $ExpectType { a: string; b: { c: n // // literal // + +// $ExpectError +make((S) => S.literal()) make((S) => S.literal('a')) // $ExpectType Schema<"a"> +make((S) => S.literal('a', 'b', null)) // $ExpectType Schema<"a" | "b" | null> // // string diff --git a/src/Codec.ts b/src/Codec.ts index eff3267c4..3bb43806b 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -66,7 +66,7 @@ export function fromDecoder(decoder: D.Decoder): Codec { * @category constructors * @since 2.2.3 */ -export function literal>(...values: A): Codec { +export function literal]>(...values: A): Codec { return fromDecoder(D.literal(...values)) } diff --git a/src/Decoder.ts b/src/Decoder.ts index 3c6aa3b1b..d463dd100 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -108,11 +108,8 @@ export function fromGuard(guard: G.Guard, expected: string): Decoder { * @category constructors * @since 2.2.0 */ -export function literal>(...values: A): Decoder { - return values.length === 0 - ? never - : fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) -} +export const literal = ]>(...values: A): Decoder => + fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) // ------------------------------------------------------------------------------------- // primitives diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 1906b5337..96ab095c5 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -19,6 +19,21 @@ export interface DecoderT { readonly decode: (u: unknown) => Kind2 } +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +// TODO +// /** +// * @category constructors +// * @since 2.2.7 +// */ +// export function literal( +// M: Monad2C & Bifunctor2 +// ): ]>(...values: A) => DecoderT { +// return null as any +// } + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- diff --git a/src/Guard.ts b/src/Guard.ts index da54a2780..8700045fb 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -32,7 +32,7 @@ export type TypeOf = G extends Guard ? A : never * @category constructors * @since 2.2.0 */ -export function literal>(...values: A): Guard { +export function literal]>(...values: A): Guard { return { is: (u: unknown): u is A[number] => values.findIndex((a) => a === u) !== -1 } diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 47e2dd9b4..35a49f8a0 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -45,7 +45,8 @@ export const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => Jso * @category constructors * @since 2.2.3 */ -export const literal: >(...values: A) => JsonCodec = C.literal +export const literal: ]>(...values: A) => JsonCodec = + C.literal // ------------------------------------------------------------------------------------- // primitives diff --git a/src/Schemable.ts b/src/Schemable.ts index 20796e754..f1553a75b 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -13,7 +13,7 @@ export type Literal = string | number | boolean | null */ export interface Schemable { readonly URI: S - readonly literal: >(...values: A) => HKT + readonly literal: ]>(...values: A) => HKT readonly string: HKT readonly number: HKT readonly boolean: HKT @@ -33,7 +33,7 @@ export interface Schemable { */ export interface Schemable1 { readonly URI: S - readonly literal: >(...values: A) => Kind + readonly literal: ]>(...values: A) => Kind readonly string: Kind readonly number: Kind readonly boolean: Kind diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 96003145a..d8353f728 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -68,10 +68,8 @@ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder>(...values: A): TaskDecoder => - values.length === 0 - ? never - : fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) +export const literal = ]>(...values: A): TaskDecoder => + fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) // ------------------------------------------------------------------------------------- // primitives diff --git a/src/Type.ts b/src/Type.ts index 1b44f37b2..e7bb32687 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -22,7 +22,7 @@ export interface Type extends t.Type {} * @category constructors * @since 2.2.3 */ -export function literal>(...values: A): Type { +export function literal]>(...values: A): Type { return t.union(values.map((v) => t.literal(v as any)) as any) } diff --git a/test/Codec.ts b/test/Codec.ts index 204a8ed58..9cc655db0 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -119,10 +119,6 @@ describe('Codec', () => { const codec = C.literal('a', null) assert.deepStrictEqual(codec.decode('b'), left([D.tree('cannot decode "b", should be "a" | null')])) }) - - it('should handle zero members', () => { - assert.deepStrictEqual(C.literal().decode({}), left([D.tree('cannot decode {}, should be never')])) - }) }) describe('encode', () => { diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 343a16213..6f2a61f02 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -52,10 +52,6 @@ describe('TaskDecoder', () => { const codec = D.literal('a', null) assert.deepStrictEqual(await codec.decode('b')(), E.left(FS.of(DE.leaf('b', '"a" | null')))) }) - - it('should handle zero members', async () => { - assert.deepStrictEqual(await D.literal().decode({})(), E.left(FS.of(DE.leaf({}, 'never')))) - }) }) describe('type', () => { From ead054d495b720cd5b6f371cc0fab7df611ef85e Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Jun 2020 07:01:15 +0200 Subject: [PATCH 056/222] add Decoder2 module --- docs/modules/Decoder2.ts.md | 238 +++++++++++++++++++++++++ docs/modules/DecoderT.ts.md | 33 +++- docs/modules/Encoder.ts.md | 2 +- docs/modules/Eq.ts.md | 2 +- docs/modules/FreeSemigroup.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 2 +- perf/Decoder2.ts | 80 +++++++++ perf/DecoderT.ts | 119 ------------- src/Decoder2.ts | 187 ++++++++++++++++++++ src/DecoderT.ts | 50 ++++-- test/Decoder2.ts | 290 +++++++++++++++++++++++++++++++ test/DecoderT.ts | 113 ++---------- 21 files changed, 893 insertions(+), 243 deletions(-) create mode 100644 docs/modules/Decoder2.ts.md create mode 100644 perf/Decoder2.ts delete mode 100644 perf/DecoderT.ts create mode 100644 src/Decoder2.ts create mode 100644 test/Decoder2.ts diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md new file mode 100644 index 000000000..ec5f4400f --- /dev/null +++ b/docs/modules/Decoder2.ts.md @@ -0,0 +1,238 @@ +--- +title: Decoder2.ts +nav_order: 4 +parent: Modules +--- + +## Decoder2 overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [DecodeError](#decodeerror) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [failure](#failure) + - [success](#success) +- [combinators](#combinators) + - [array](#array) + - [partial](#partial) + - [record](#record) + - [tuple](#tuple) + - [type](#type) +- [constructors](#constructors) + - [fromGuard](#fromguard) + - [literal](#literal) +- [model](#model) + - [Decoder (interface)](#decoder-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [never](#never) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [draw](#draw) + +--- + +# DecodeError + +## DecodeError (type alias) + +**Signature** + +```ts +export type DecodeError = FS.FreeSemigroup> +``` + +Added in v2.2.7 + +## failure + +**Signature** + +```ts +export declare function failure
(actual: unknown, message: string): E.Either +``` + +Added in v2.2.7 + +## success + +**Signature** + +```ts +export declare function success(a: A): E.Either +``` + +Added in v2.2.7 + +# combinators + +## array + +**Signature** + +```ts +export declare const array: (items: Decoder) => Decoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: Decoder } +) => Decoder> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare const record: (codomain: Decoder) => Decoder> +``` + +Added in v2.2.7 + +## tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: Decoder } +) => Decoder +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 + +# constructors + +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare const literal: (...values: A) => Decoder +``` + +Added in v2.2.7 + +# model + +## Decoder (interface) + +**Signature** + +```ts +export interface Decoder { + readonly decode: (u: unknown) => E.Either +} +``` + +Added in v2.2.7 + +# primitives + +## UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: Decoder +``` + +Added in v2.2.7 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: Decoder> +``` + +Added in v2.2.7 + +## boolean + +**Signature** + +```ts +export declare const boolean: Decoder +``` + +Added in v2.2.7 + +## never + +**Signature** + +```ts +export declare const never: Decoder +``` + +Added in v2.2.7 + +## number + +**Signature** + +```ts +export declare const number: Decoder +``` + +Added in v2.2.7 + +## string + +**Signature** + +```ts +export declare const string: Decoder +``` + +Added in v2.2.7 + +# utils + +## draw + +**Signature** + +```ts +export declare const draw: (e: FS.FreeSemigroup>) => string +``` + +Added in v2.2.7 diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 906568f8d..d4117f298 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -1,6 +1,6 @@ --- title: DecoderT.ts -nav_order: 4 +nav_order: 5 parent: Modules --- @@ -18,6 +18,9 @@ Added in v2.2.7 - [record](#record) - [tuple](#tuple) - [type](#type) +- [constructors](#constructors) + - [fromGuard](#fromguard) + - [literal](#literal) - [model](#model) - [DecoderT (interface)](#decodert-interface) @@ -100,6 +103,34 @@ export declare function type( Added in v2.2.7 +# constructors + +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: ( + M: MonadThrow2C +) => (guard: G.Guard, onError: (u: unknown) => E) => DecoderT +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare function literal( + M: MonadThrow2C +): ( + onError: (u: unknown, values: readonly [Literal, ...Array]) => E +) => ]>(...values: A) => DecoderT +``` + +Added in v2.2.7 + # model ## DecoderT (interface) diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index de4e7002e..dd049938b 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -1,6 +1,6 @@ --- title: Encoder.ts -nav_order: 5 +nav_order: 6 parent: Modules --- diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index fde6772bc..88a8aaa41 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -1,6 +1,6 @@ --- title: Eq.ts -nav_order: 6 +nav_order: 7 parent: Modules --- diff --git a/docs/modules/FreeSemigroup.ts.md b/docs/modules/FreeSemigroup.ts.md index bca13657a..a34b55770 100644 --- a/docs/modules/FreeSemigroup.ts.md +++ b/docs/modules/FreeSemigroup.ts.md @@ -1,6 +1,6 @@ --- title: FreeSemigroup.ts -nav_order: 7 +nav_order: 8 parent: Modules --- diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 637535ff9..ead0e5b72 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -1,6 +1,6 @@ --- title: Guard.ts -nav_order: 8 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index c3a0ef9e0..f32934d48 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -1,6 +1,6 @@ --- title: JsonCodec.ts -nav_order: 10 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 06b3a14b6..f84480379 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 11 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 2abc64ffe..1db8dde68 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 12 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 5aea2ce60..175cf05b2 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 13 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index ec28e2aad..d9068def7 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 14 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 556179d86..5f9f44c62 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 15 +nav_order: 16 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index e6ad0e396..14eb3384e 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 16 +nav_order: 17 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 070926799..c56c214d9 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 17 +nav_order: 18 parent: Modules --- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 0ee2410e8..91cf925cc 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 9 +nav_order: 10 parent: Modules --- diff --git a/perf/Decoder2.ts b/perf/Decoder2.ts new file mode 100644 index 000000000..3000106ac --- /dev/null +++ b/perf/Decoder2.ts @@ -0,0 +1,80 @@ +import * as Benchmark from 'benchmark' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as D from '../src/Decoder' +import * as D2 from '../src/Decoder2' +import * as G from '../src/Guard' + +/* + +Guard (good) x 35,916,863 ops/sec ±1.28% (86 runs sampled) +Decoder (good) x 4,855,216 ops/sec ±0.83% (89 runs sampled) +Decoder2 (good) x 2,397,112 ops/sec ±0.53% (87 runs sampled) +Guard (bad) x 35,685,300 ops/sec ±1.45% (85 runs sampled) +Decoder (bad) x 1,255,976 ops/sec ±0.60% (90 runs sampled) +Decoder2 (bad) x 2,054,836 ops/sec ±0.73% (85 runs sampled) +Decoder (draw) x 584,770 ops/sec ±1.83% (87 runs sampled) +Decoder2 (draw) x 368,364 ops/sec ±0.45% (84 runs sampled) + +*/ + +const decoder = D.type({ + name: D.string, + age: D.number +}) + +const decoder2 = D2.type({ + name: D2.string, + age: D2.number +}) + +const guard = G.type({ + name: G.string, + age: G.number +}) + +const good = { + name: 'name', + age: 18 +} + +const bad = {} + +// console.log(decoder.decode(bad)) +// console.log(decoder2.decode(bad)) +// console.log(JSON.stringify(freeDecoder.decode(bad), null, 2)) + +const suite = new Benchmark.Suite() + +suite + .add('Guard (good)', function () { + guard.is(bad) + }) + .add('Decoder (good)', function () { + decoder.decode(good) + }) + .add('Decoder2 (good)', function () { + decoder2.decode(good) + }) + .add('Guard (bad)', function () { + guard.is(bad) + }) + .add('Decoder (bad)', function () { + decoder.decode(bad) + }) + .add('Decoder2 (bad)', function () { + decoder2.decode(bad) + }) + .add('Decoder (draw)', function () { + pipe(decoder.decode(bad), E.mapLeft(D.draw)) + }) + .add('Decoder2 (draw)', function () { + pipe(decoder2.decode(bad), E.mapLeft(D2.draw)) + }) + .on('cycle', function (event: any) { + console.log(String(event.target)) + }) + .on('complete', function (this: any) { + console.log('Fastest is ' + this.filter('fastest').map('name')) + }) + .run({ async: true }) diff --git a/perf/DecoderT.ts b/perf/DecoderT.ts deleted file mode 100644 index 5d0826ae9..000000000 --- a/perf/DecoderT.ts +++ /dev/null @@ -1,119 +0,0 @@ -import * as Benchmark from 'benchmark' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import * as D from '../src/Decoder' -import * as DE from '../src/DecodeError' -import * as DT from '../src/DecoderT' -import * as FS from '../src/FreeSemigroup' -import * as G from '../src/Guard' -import * as T from 'fp-ts/lib/Tree' -import * as NEA from 'fp-ts/lib/NonEmptyArray' - -/* - -Guard (good) x 35,343,457 ops/sec ±1.74% (82 runs sampled) -Decoder (good) x 4,830,970 ops/sec ±0.67% (87 runs sampled) -DecoderT (good) x 2,335,998 ops/sec ±0.78% (88 runs sampled) -Guard (bad) x 34,999,708 ops/sec ±1.77% (80 runs sampled) -Decoder (bad) x 1,225,579 ops/sec ±0.76% (89 runs sampled) -DecoderT (bad) x 2,048,515 ops/sec ±0.59% (87 runs sampled) -Decoder (draw) x 584,376 ops/sec ±2.17% (90 runs sampled) -DecoderT (draw) x 368,724 ops/sec ±0.66% (84 runs sampled) - -*/ - -const decoder = D.type({ - name: D.string, - age: D.number -}) - -function getDecoderT() { - type E = string - const M = E.getValidation(DE.getSemigroup()) - function fromGuard(guard: G.Guard, expected: E): DT.DecoderT>, A> { - return { - decode: (u) => (guard.is(u) ? E.right(u) : E.left(FS.of(DE.leaf(u, expected)))) - } - } - - const UnknownRecord = fromGuard(G.UnknownRecord, 'Record') - const string = fromGuard(G.string, 'string') - const number = fromGuard(G.number, 'number') - const type = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) - - return type({ - name: string, - age: number - }) -} - -function toForest(s: FS.FreeSemigroup>): NEA.NonEmptyArray> { - const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ - Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Key: (key, required, errors) => - T.make(`${required ? 'required' : 'optional'} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (key, required, errors) => - T.make(`${required ? 'required' : 'optional'} index ${JSON.stringify(key)}`, toForest(errors)) - }) - const toForest: (f: FS.FreeSemigroup>) => NEA.NonEmptyArray> = FS.fold( - (value) => NEA.of(toTree(value)), - (left, right) => NEA.concat(toForest(left), toForest(right)) - ) - return toForest(s) -} - -const decoderT = getDecoderT() - -const guard = G.type({ - name: G.string, - age: G.number -}) - -const good = { - name: 'name', - age: 18 -} - -const bad = {} - -// console.log(decoder.decode(bad)) -// console.log(decoderT.decode(bad)) -// console.log(JSON.stringify(freeDecoder.decode(bad), null, 2)) - -const suite = new Benchmark.Suite() - -suite - .add('Guard (good)', function () { - guard.is(bad) - }) - .add('Decoder (good)', function () { - decoder.decode(good) - }) - .add('DecoderT (good)', function () { - decoderT.decode(good) - }) - .add('Guard (bad)', function () { - guard.is(bad) - }) - .add('Decoder (bad)', function () { - decoder.decode(bad) - }) - .add('DecoderT (bad)', function () { - decoderT.decode(bad) - }) - .add('Decoder (draw)', function () { - pipe(decoder.decode(bad), E.mapLeft(D.draw)) - }) - .add('DecoderT (draw)', function () { - pipe( - decoderT.decode(bad), - E.mapLeft((e) => D.draw(toForest(e))) - ) - }) - .on('cycle', function (event: any) { - console.log(String(event.target)) - }) - .on('complete', function (this: any) { - console.log('Fastest is ' + this.filter('fastest').map('name')) - }) - .run({ async: true }) diff --git a/src/Decoder2.ts b/src/Decoder2.ts new file mode 100644 index 000000000..fab86e618 --- /dev/null +++ b/src/Decoder2.ts @@ -0,0 +1,187 @@ +/** + * @since 2.2.7 + */ +import * as E from 'fp-ts/lib/Either' +import * as DE from './DecodeError' +import * as DT from './DecoderT' +import * as FS from '../src/FreeSemigroup' +import * as G from './Guard' +import * as NEA from 'fp-ts/lib/NonEmptyArray' +import * as T from 'fp-ts/lib/Tree' +import { Literal } from './Schemable' + +const M = E.getValidation(DE.getSemigroup()) + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface Decoder { + readonly decode: (u: unknown) => E.Either +} + +// ------------------------------------------------------------------------------------- +// DecodeError +// ------------------------------------------------------------------------------------- + +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = FS.FreeSemigroup> + +/** + * @category DecodeError + * @since 2.2.7 + */ +export function success(a: A): E.Either { + return E.right(a) +} + +/** + * @category DecodeError + * @since 2.2.7 + */ +export function failure(actual: unknown, message: string): E.Either { + return E.left(FS.of(DE.leaf(actual, message))) +} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (guard: G.Guard, expected: string): Decoder => ({ + decode: (u) => (guard.is(u) ? success(u) : failure(u, expected)) +}) + +/** + * @category constructors + * @since 2.2.7 + */ +export const literal = ]>(...values: A): Decoder => + fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @category primitives + * @since 2.2.7 + */ +export const never: Decoder = fromGuard(G.never, 'never') + +/** + * @category primitives + * @since 2.2.7 + */ +export const string: Decoder = fromGuard(G.string, 'string') + +/** + * @category primitives + * @since 2.2.7 + */ +export const number: Decoder = fromGuard(G.number, 'number') + +/** + * @category primitives + * @since 2.2.7 + */ +export const boolean: Decoder = fromGuard(G.boolean, 'boolean') + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownArray: Decoder> = fromGuard(G.UnknownArray, 'Array') + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownRecord: Decoder> = fromGuard(G.UnknownRecord, 'Record') + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +// TODO +/** + * @category combinators + * @since 2.2.0 + */ +// export function nullable(or: Decoder): Decoder { +// return union(literal(null), or) +// } + +/** + * @category combinators + * @since 2.2.7 + */ +export const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> = DT.type( + M +)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const partial: ( + properties: { [K in keyof A]: Decoder } +) => Decoder> = DT.partial(M)(UnknownRecord, (k, e) => + FS.of(DE.key(k, DE.optional, e)) +) + +/** + * @category combinators + * @since 2.2.7 + */ +export const array: (items: Decoder) => Decoder> = DT.array(M)(UnknownArray, (i, e) => + FS.of(DE.index(i, DE.optional, e)) +) + +/** + * @category combinators + * @since 2.2.7 + */ +export const record: (codomain: Decoder) => Decoder> = DT.record(M)(UnknownRecord, (k, e) => + FS.of(DE.key(k, DE.optional, e)) +) + +/** + * @category combinators + * @since 2.2.7 + */ +export const tuple: >( + ...components: { [K in keyof A]: Decoder } +) => Decoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +const toForest = (e: DecodeError): NEA.NonEmptyArray> => { + const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ + Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)) + }) + const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( + (value) => [toTree(value)], + (left, right) => NEA.concat(toForest(left), toForest(right)) + ) + return toForest(e) +} + +/** + * @since 2.2.7 + */ +export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 96ab095c5..444c8a046 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -6,6 +6,9 @@ import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import * as E from 'fp-ts/lib/Either' import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' +import { Literal } from './Schemable' +import * as G from './Guard' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' // ------------------------------------------------------------------------------------- // model @@ -23,21 +26,48 @@ export interface DecoderT { // constructors // ------------------------------------------------------------------------------------- -// TODO -// /** -// * @category constructors -// * @since 2.2.7 -// */ -// export function literal( -// M: Monad2C & Bifunctor2 -// ): ]>(...values: A) => DecoderT { -// return null as any -// } +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (M: MonadThrow2C) => ( + guard: G.Guard, + onError: (u: unknown) => E +): DecoderT => ({ + decode: (u) => (guard.is(u) ? M.of(u) : M.throwError(onError(u))) +}) + +/** + * @category constructors + * @since 2.2.7 + */ +export function literal( + M: MonadThrow2C +): ( + onError: (u: unknown, values: readonly [Literal, ...Array]) => E +) => ]>(...values: A) => DecoderT { + return (onError) => (...values) => ({ + decode: (u) => (G.literal(...values).is(u) ? M.of(u) : M.throwError(onError(u, values))) + }) +} // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- +// TODO +/** + * @category combinators + * @since 2.2.7 + */ +// export function nullable( +// M: MonadThrow2C +// ): (or: DecoderT) => DecoderT { +// return (or) => ({ +// decode: (u) => (u === null ? M.of(u) : or.decode(u)) +// }) +// } + /** * @category combinators * @since 2.2.7 diff --git a/test/Decoder2.ts b/test/Decoder2.ts new file mode 100644 index 000000000..6a9db9f34 --- /dev/null +++ b/test/Decoder2.ts @@ -0,0 +1,290 @@ +import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from '../src/DecodeError' +import * as FS from '../src/FreeSemigroup' +import * as G from '../src/Guard' +import * as D from '../src/Decoder2' + +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: D.Decoder = D.fromGuard(undefinedGuard, 'undefined') + +describe('Decoder', () => { + it('string', async () => { + assert.deepStrictEqual(D.string.decode('a'), E.right('a')) + assert.deepStrictEqual(D.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) + }) + + it('number', async () => { + assert.deepStrictEqual(D.number.decode(1), E.right(1)) + assert.deepStrictEqual(D.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) + }) + + it('boolean', async () => { + assert.deepStrictEqual(D.boolean.decode(true), E.right(true)) + assert.deepStrictEqual(D.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) + }) + + it('UnknownArray', async () => { + assert.deepStrictEqual(D.UnknownArray.decode([1, 'a']), E.right([1, 'a'])) + assert.deepStrictEqual(D.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) + }) + + it('UnknownRecord', async () => { + assert.deepStrictEqual(D.UnknownRecord.decode({ a: 1, b: 'b' }), E.right({ a: 1, b: 'b' })) + assert.deepStrictEqual(D.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + }) + + describe('literal', () => { + it('should decode a valid input', async () => { + const codec = D.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(codec.decode('a'), E.right('a')) + assert.deepStrictEqual(codec.decode(null), E.right(null)) + }) + + it('should reject an invalid input', async () => { + const codec = D.literal('a', null) + assert.deepStrictEqual(codec.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) + }) + }) + + describe('type', () => { + it('should decode a valid input', async () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual(codec.decode({ a: 'a' }), E.right({ a: 'a' })) + }) + + it('should strip additional fields', async () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const codec = D.type({ + a: undef + }) + assert.deepStrictEqual(codec.decode({}), E.right({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const codec = D.type({ + a: D.string + }) + assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + codec.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.type({ + a: D.string, + b: D.number + }) + assert.deepStrictEqual( + codec.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const codec = D.type({ a: D.string, b: D.string }) + assert.deepStrictEqual(codec.decode(new A()), E.right({ a: 'a', b: 'b' })) + }) + }) + + describe('partial', () => { + it('should decode a valid input', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(codec.decode({ a: 'a' }), E.right({ a: 'a' })) + assert.deepStrictEqual(codec.decode({}), E.right({})) + }) + + it('should strip additional fields', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + }) + + it('should not add missing fields', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(codec.decode({}), E.right({})) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(codec.decode({ a: undefined }), E.right({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const codec = D.partial({ a: D.string }) + assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + codec.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.partial({ + a: D.string, + b: D.number + }) + assert.deepStrictEqual( + codec.decode({ a: 1, b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const codec = D.partial({ a: D.string, b: D.string }) + assert.deepStrictEqual(codec.decode(new A()), E.right({ a: 'a', b: 'b' })) + }) + }) + + describe('array', () => { + it('should decode a valid input', async () => { + const codec = D.array(D.string) + assert.deepStrictEqual(codec.decode([]), E.right([])) + assert.deepStrictEqual(codec.decode(['a']), E.right(['a'])) + }) + + it('should reject an invalid input', async () => { + const codec = D.array(D.string) + assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual(codec.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) + }) + + it('should collect all errors', async () => { + const codec = D.array(D.string) + assert.deepStrictEqual( + codec.decode([1, 2]), + E.left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) + ) + }) + }) + + describe('record', () => { + it('should decode a valid value', async () => { + const codec = D.record(D.number) + assert.deepStrictEqual(codec.decode({}), E.right({})) + assert.deepStrictEqual(codec.decode({ a: 1 }), E.right({ a: 1 })) + }) + + it('should reject an invalid value', async () => { + const codec = D.record(D.number) + assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + codec.decode({ a: 'a' }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + ) + }) + + it('should collect all errors', async () => { + const codec = D.record(D.number) + assert.deepStrictEqual( + codec.decode({ a: 'a', b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + }) + + describe('tuple', () => { + it('should decode a valid input', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual(codec.decode(['a', 1]), E.right(['a', 1])) + }) + + it('should handle zero components', async () => { + assert.deepStrictEqual(D.tuple().decode([]), E.right([])) + }) + + it('should reject an invalid input', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual( + codec.decode(['a']), + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual(codec.decode([1, 2]), E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))))) + }) + + it('should collect all errors', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual( + codec.decode([1, 'a']), + E.left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) + ) + }) + + it('should strip additional components', async () => { + const codec = D.tuple(D.string, D.number) + assert.deepStrictEqual(codec.decode(['a', 1, true]), E.right(['a', 1])) + }) + }) + + it('draw', async () => { + const decoder = D.type({ + a: D.string, + b: D.number, + c: D.array(D.boolean) + }) + assert.deepStrictEqual( + pipe(decoder.decode({ c: [1] }), E.mapLeft(D.draw)), + E.left(`required property "a" +└─ cannot decode undefined, should be string +required property "b" +└─ cannot decode undefined, should be number +required property "c" +└─ optional index 0 + └─ cannot decode 1, should be boolean`) + ) + }) +}) diff --git a/test/DecoderT.ts b/test/DecoderT.ts index ded0e2fd9..f243adbd3 100644 --- a/test/DecoderT.ts +++ b/test/DecoderT.ts @@ -1,116 +1,29 @@ import * as assert from 'assert' import * as E from 'fp-ts/lib/Either' import * as NEA from 'fp-ts/lib/NonEmptyArray' -import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Tree' import * as DT from '../src/DecoderT' import * as G from '../src/Guard' const M = E.getValidation(NEA.getSemigroup>()) -function fromGuard(guard: G.Guard, expected: string): DT.DecoderT>, A> { - return { - decode: (u) => - guard.is(u) ? E.right(u) : E.left([T.make(`cannot decode ${JSON.stringify(u)}, should be ${expected}`)]) - } -} - -const UnknownArray = fromGuard(G.UnknownArray, 'Array') -const UnknownRecord = fromGuard(G.UnknownRecord, 'Record') -const string = fromGuard(G.string, 'string') -const number = fromGuard(G.number, 'number') - describe('DecoderT', () => { - it('array', () => { - const array = DT.array(M)(UnknownArray, (i, e) => - pipe( - e, - NEA.map((e) => T.make(`item ${i}`, [e])) - ) - ) - const decoder = array(string) - assert.deepStrictEqual(decoder.decode(['a', 'b']), E.right(['a', 'b'])) - assert.deepStrictEqual(decoder.decode(null), E.left([T.make('cannot decode null, should be Array')])) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left([ - T.make('item 0', [T.make('cannot decode 1, should be string')]), - T.make('item 1', [T.make('cannot decode 2, should be string')]) - ]) - ) - }) + it('fromGuard', () => { + const fromGuard = (guard: G.Guard, expected: string) => + DT.fromGuard(M)(guard, (u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be ${expected}`)]) - it('record', () => { - const record = DT.record(M)(UnknownRecord, (k, e) => - pipe( - e, - NEA.map((e) => T.make(`key ${JSON.stringify(k)}`, [e])) - ) - ) - const decoder = record(string) - assert.deepStrictEqual(decoder.decode({}), E.right({})) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) - assert.deepStrictEqual( - decoder.decode(null), - E.left([T.make('cannot decode null, should be Record')]) - ) - assert.deepStrictEqual( - decoder.decode({ a: 1, b: 2 }), - E.left([ - T.make('key "a"', [T.make('cannot decode 1, should be string')]), - T.make('key "b"', [T.make('cannot decode 2, should be string')]) - ]) - ) - }) - - it('type', () => { - const type = DT.type(M)(UnknownRecord, (k, e) => - pipe( - e, - NEA.map((e) => T.make(`required property ${JSON.stringify(k)}`, [e])) - ) - ) - const decoder = type({ - name: string, - age: number - }) - assert.deepStrictEqual(decoder.decode({ name: 'name', age: 18 }), E.right({ name: 'name', age: 18 })) - assert.deepStrictEqual( - decoder.decode(null), - E.left([T.make('cannot decode null, should be Record')]) - ) - assert.deepStrictEqual( - decoder.decode({}), - E.left([ - T.make('required property "name"', [T.make('cannot decode undefined, should be string')]), - T.make('required property "age"', [T.make('cannot decode undefined, should be number')]) - ]) - ) + const string = fromGuard(G.string, 'string') + assert.deepStrictEqual(string.decode('a'), E.right('a')) + assert.deepStrictEqual(string.decode(null), E.left([T.make('cannot decode null, should be string')])) }) - it('partial', () => { - const partial = DT.partial(M)(UnknownRecord, (k, e) => - pipe( - e, - NEA.map((e) => T.make(`optional property ${JSON.stringify(k)}`, [e])) + it('literal', () => { + const literal = DT.literal(M)((u, values) => [ + T.make( + `cannot decode ${JSON.stringify(u)}, should be ${values.map((value) => JSON.stringify(value)).join(' | ')}` ) - ) - const decoder = partial({ - name: string, - age: number - }) - assert.deepStrictEqual(decoder.decode({ name: 'name', age: 18 }), E.right({ name: 'name', age: 18 })) - assert.deepStrictEqual(decoder.decode({}), E.right({})) - assert.deepStrictEqual( - decoder.decode(null), - E.left([T.make('cannot decode null, should be Record')]) - ) - assert.deepStrictEqual( - decoder.decode({ name: 1, age: 'a' }), - E.left([ - T.make('optional property "name"', [T.make('cannot decode 1, should be string')]), - T.make('optional property "age"', [T.make('cannot decode "a", should be number')]) - ]) - ) + ]) + assert.deepStrictEqual(literal('a').decode('a'), E.right('a')) + assert.deepStrictEqual(literal('a').decode('b'), E.left([T.make('cannot decode "b", should be "a"')])) }) }) From 17e9a9a44ab79161128588f93a4a9a631af37c4b Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Jun 2020 08:16:52 +0200 Subject: [PATCH 057/222] handle nullable combinator --- docs/modules/DecodeError.ts.md | 29 ++++++++++++++++++- docs/modules/Decoder2.ts.md | 11 ++++++++ docs/modules/DecoderT.ts.md | 13 +++++++++ docs/modules/TaskDecoder.ts.md | 17 ++++++++++-- dtslint/ts3.5/Schema.ts | 2 ++ src/DecodeError.ts | 25 ++++++++++++++++- src/Decoder2.ts | 12 ++++---- src/DecoderT.ts | 38 ++++++++++++++++++------- src/TaskDecoder.ts | 13 +++++++-- test/Codec.ts | 4 --- test/Decoder2.ts | 51 ++++++++++++++++++++++++++++++++-- test/Guard.ts | 10 ------- test/TaskDecoder.ts | 51 ++++++++++++++++++++++++++++++++-- 13 files changed, 235 insertions(+), 41 deletions(-) diff --git a/docs/modules/DecodeError.ts.md b/docs/modules/DecodeError.ts.md index 67892bf81..efdb1b210 100644 --- a/docs/modules/DecodeError.ts.md +++ b/docs/modules/DecodeError.ts.md @@ -16,6 +16,7 @@ Added in v2.2.7 - [index](#index) - [key](#key) - [leaf](#leaf) + - [member](#member) - [destructors](#destructors) - [fold](#fold) - [instances](#instances) @@ -26,6 +27,7 @@ Added in v2.2.7 - [Key (interface)](#key-interface) - [Kind (type alias)](#kind-type-alias) - [Leaf (interface)](#leaf-interface) + - [Member (interface)](#member-interface) - [optional](#optional) - [required](#required) @@ -63,6 +65,16 @@ export declare const leaf: (actual: unknown, error: E) => DecodeError Added in v2.2.7 +## member + +**Signature** + +```ts +export declare const member: (index: number, errors: FS.FreeSemigroup>) => DecodeError +``` + +Added in v2.2.7 + # destructors ## fold @@ -74,6 +86,7 @@ export declare const fold: (patterns: { Leaf: (input: unknown, error: E) => R Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R + Member: (index: number, errors: FS.FreeSemigroup>) => R }) => (e: DecodeError) => R ``` @@ -98,7 +111,7 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = Leaf | Key | Index +export type DecodeError = Leaf | Key | Index | Member ``` Added in v2.2.7 @@ -157,6 +170,20 @@ export interface Leaf { Added in v2.2.7 +## Member (interface) + +**Signature** + +```ts +export interface Member { + readonly _tag: 'Member' + readonly index: number + readonly errors: FS.FreeSemigroup> +} +``` + +Added in v2.2.7 + ## optional **Signature** diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index ec5f4400f..b973dfff3 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -18,6 +18,7 @@ Added in v2.2.7 - [success](#success) - [combinators](#combinators) - [array](#array) + - [nullable](#nullable) - [partial](#partial) - [record](#record) - [tuple](#tuple) @@ -83,6 +84,16 @@ export declare const array: (items: Decoder) => Decoder Added in v2.2.7 +## nullable + +**Signature** + +```ts +export declare const nullable: (or: Decoder) => Decoder +``` + +Added in v2.2.7 + ## partial **Signature** diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index d4117f298..2ec0dd438 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -14,6 +14,7 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) + - [nullable](#nullable) - [partial](#partial) - [record](#record) - [tuple](#tuple) @@ -43,6 +44,18 @@ export declare function array( Added in v2.2.7 +## nullable + +**Signature** + +```ts +export declare const nullable: ( + M: MonadThrow2C & Bifunctor2 +) => (onError: (u: unknown, e: E) => E) => (or: DecoderT) => DecoderT +``` + +Added in v2.2.7 + ## partial **Signature** diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 14eb3384e..0619dec02 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -18,13 +18,14 @@ Added in v2.2.7 - [success](#success) - [combinators](#combinators) - [array](#array) - - [literal](#literal) + - [nullable](#nullable) - [partial](#partial) - [record](#record) - [tuple](#tuple) - [type](#type) - [constructors](#constructors) - [fromGuard](#fromguard) + - [literal](#literal) - [model](#model) - [TaskDecoder (interface)](#taskdecoder-interface) - [primitives](#primitives) @@ -83,12 +84,12 @@ export declare const array: (items: TaskDecoder) => TaskDecoder Added in v2.2.7 -## literal +## nullable **Signature** ```ts -export declare const literal: (...values: A) => TaskDecoder +export declare const nullable: (or: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -151,6 +152,16 @@ export declare const fromGuard: (guard: G.Guard, expected: string) => Task Added in v2.2.7 +## literal + +**Signature** + +```ts +export declare const literal: (...values: A) => TaskDecoder +``` + +Added in v2.2.7 + # model ## TaskDecoder (interface) diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index 771135868..76a20b1b2 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -138,5 +138,7 @@ make((S) => S.refinement(S.number, (n): n is Positive => n > 0, 'Positive')) // // union // + +make((S) => S.union()) // $ExpectType Schema make((S) => S.union(S.string)) // $ExpectType Schema make((S) => S.union(S.string, S.number)) // $ExpectType Schema diff --git a/src/DecodeError.ts b/src/DecodeError.ts index 1a4d71ef4..e03a2e351 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -58,7 +58,17 @@ export interface Index { * @category model * @since 2.2.7 */ -export type DecodeError = Leaf | Key | Index +export interface Member { + readonly _tag: 'Member' + readonly index: number + readonly errors: FS.FreeSemigroup> +} + +/** + * @category model + * @since 2.2.7 + */ +export type DecodeError = Leaf | Key | Index | Member /** * @category constructors @@ -88,6 +98,16 @@ export const index = (index: number, kind: Kind, errors: FS.FreeSemigroup(index: number, errors: FS.FreeSemigroup>): DecodeError => ({ + _tag: 'Member', + index, + errors +}) + /** * @category destructors * @since 2.2.7 @@ -96,6 +116,7 @@ export const fold = (patterns: { Leaf: (input: unknown, error: E) => R Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R + Member: (index: number, errors: FS.FreeSemigroup>) => R }): ((e: DecodeError) => R) => { const f = (e: DecodeError): R => { switch (e._tag) { @@ -105,6 +126,8 @@ export const fold = (patterns: { return patterns.Key(e.key, e.kind, e.errors) case 'Index': return patterns.Index(e.index, e.kind, e.errors) + case 'Member': + return patterns.Member(e.index, e.errors) } } return f diff --git a/src/Decoder2.ts b/src/Decoder2.ts index fab86e618..384f62780 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -113,14 +113,13 @@ export const UnknownRecord: Decoder> = fromGuard(G.Unkno // combinators // ------------------------------------------------------------------------------------- -// TODO /** * @category combinators - * @since 2.2.0 + * @since 2.2.7 */ -// export function nullable(or: Decoder): Decoder { -// return union(literal(null), or) -// } +export const nullable: (or: Decoder) => Decoder = DT.nullable(M)((u, e) => + FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e))) +) /** * @category combinators @@ -172,7 +171,8 @@ const toForest = (e: DecodeError): NEA.NonEmptyArray> => { const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)) + Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), + Member: (index, errors) => T.make(`member ${index}`, toForest(errors)) }) const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( (value) => [toTree(value)], diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 444c8a046..961687b94 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -6,9 +6,9 @@ import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import * as E from 'fp-ts/lib/Either' import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' -import { Literal } from './Schemable' -import * as G from './Guard' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import * as G from './Guard' +import { Literal } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -55,18 +55,22 @@ export function literal( // combinators // ------------------------------------------------------------------------------------- -// TODO /** * @category combinators * @since 2.2.7 */ -// export function nullable( -// M: MonadThrow2C -// ): (or: DecoderT) => DecoderT { -// return (or) => ({ -// decode: (u) => (u === null ? M.of(u) : or.decode(u)) -// }) -// } +export const nullable = (M: MonadThrow2C & Bifunctor2) => ( + onError: (u: unknown, e: E) => E +) => (or: DecoderT): DecoderT => ({ + decode: (u) => + u === null + ? M.of(u) + : M.bimap( + or.decode(u), + (e) => onError(u, e), + (a): A | null => a + ) +}) /** * @category combinators @@ -186,6 +190,20 @@ export function tuple( }) } +/** + * @category combinators + * @since 2.2.7 + */ +// export function union( +// _M: Monad2C & Bifunctor2 +// ): ( +// onMemberError: (i: number, e: E) => E +// ) => >( +// ...members: { [K in keyof A]: DecoderT } +// ) => DecoderT { +// return null as any +// } + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index d8353f728..86dd3147e 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -65,7 +65,7 @@ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder(decoder: D.Decoder) => TaskDecoder /** - * @category combinators + * @category constructors * @since 2.2.7 */ export const literal = ]>(...values: A): TaskDecoder => @@ -115,6 +115,14 @@ export const UnknownRecord: TaskDecoder> = fromGuard(G.U // combinators // ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export const nullable: (or: TaskDecoder) => TaskDecoder = DT.nullable(M)((u, e) => + FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e))) +) + /** * @category combinators * @since 2.2.7 @@ -166,7 +174,8 @@ const toForest = (e: DecodeError): NEA.NonEmptyArray> => { const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)) + Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), + Member: (index, errors) => T.make(`member ${index}`, toForest(errors)) }) const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( (value) => [toTree(value)], diff --git a/test/Codec.ts b/test/Codec.ts index 9cc655db0..50907a5b3 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -542,10 +542,6 @@ describe('Codec', () => { ) }) - it('should handle zero members', () => { - assert.deepStrictEqual(C.sum('_tag')({}).decode({}), left([D.tree('cannot decode {}, should be never')])) - }) - it('should support empty records', () => { const decoder = sum({}) assert.deepStrictEqual(decoder.decode({}), left([D.tree('cannot decode {}, should be never')])) diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 6a9db9f34..7ce98b1b1 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -11,6 +11,17 @@ const undefinedGuard: G.Guard = { } const undef: D.Decoder = D.fromGuard(undefinedGuard, 'undefined') +const NumberFromString: D.Decoder = { + decode: (u) => + pipe( + D.string.decode(u), + E.chain((s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(u, 'parsable to a number') : D.success(n) + }) + ) +} + describe('Decoder', () => { it('string', async () => { assert.deepStrictEqual(D.string.decode('a'), E.right('a')) @@ -50,6 +61,36 @@ describe('Decoder', () => { }) }) + describe('nullable', () => { + it('should decode a valid input', () => { + const codec = D.nullable(NumberFromString) + assert.deepStrictEqual(codec.decode(null), E.right(null)) + assert.deepStrictEqual(codec.decode('1'), E.right(1)) + }) + + it('should reject an invalid input', () => { + const codec = D.nullable(NumberFromString) + assert.deepStrictEqual( + codec.decode(undefined), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) + ) + assert.deepStrictEqual( + codec.decode('a'), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) + ) + }) + }) + describe('type', () => { it('should decode a valid input', async () => { const codec = D.type({ @@ -274,7 +315,8 @@ describe('Decoder', () => { const decoder = D.type({ a: D.string, b: D.number, - c: D.array(D.boolean) + c: D.array(D.boolean), + d: D.nullable(D.string) }) assert.deepStrictEqual( pipe(decoder.decode({ c: [1] }), E.mapLeft(D.draw)), @@ -284,7 +326,12 @@ required property "b" └─ cannot decode undefined, should be number required property "c" └─ optional index 0 - └─ cannot decode 1, should be boolean`) + └─ cannot decode 1, should be boolean +required property "d" +├─ member 0 +│ └─ cannot decode undefined, should be null +└─ member 1 + └─ cannot decode undefined, should be string`) ) }) }) diff --git a/test/Guard.ts b/test/Guard.ts index 6847264ce..af60affad 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -174,11 +174,6 @@ describe('Guard', () => { const guard = G.union(G.string, G.number) assert.strictEqual(guard.is(undefined), false) }) - - it('should handle zero members', () => { - assert.deepStrictEqual(G.union().is(null), false) - assert.deepStrictEqual(G.union().is({}), false) - }) }) describe('lazy', () => { @@ -226,11 +221,6 @@ describe('Guard', () => { assert.strictEqual(guard.is({}), false) }) - it('should handle zero members', () => { - assert.deepStrictEqual(sum({}).is(null), false) - assert.deepStrictEqual(sum({}).is({}), false) - }) - it('should support non-`string` tag values', () => { const guard = G.sum('_tag')({ true: G.type({ _tag: G.literal(true), a: G.string }), diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 6f2a61f02..ab08b5335 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -12,6 +12,17 @@ const undefinedGuard: G.Guard = { } const undef: D.TaskDecoder = D.fromGuard(undefinedGuard, 'undefined') +const NumberFromString: D.TaskDecoder = { + decode: (u) => + pipe( + D.string.decode(u), + TE.chain((s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(u, 'parsable to a number') : D.success(n) + }) + ) +} + describe('TaskDecoder', () => { it('string', async () => { assert.deepStrictEqual(await D.string.decode('a')(), E.right('a')) @@ -54,6 +65,36 @@ describe('TaskDecoder', () => { }) }) + describe('nullable', () => { + it('should decode a valid input', async () => { + const codec = D.nullable(NumberFromString) + assert.deepStrictEqual(await codec.decode(null)(), E.right(null)) + assert.deepStrictEqual(await codec.decode('1')(), E.right(1)) + }) + + it('should reject an invalid input', async () => { + const codec = D.nullable(NumberFromString) + assert.deepStrictEqual( + await codec.decode(undefined)(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) + ) + assert.deepStrictEqual( + await codec.decode('a')(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) + ) + }) + }) + describe('type', () => { it('should decode a valid input', async () => { const codec = D.type({ @@ -293,7 +334,8 @@ describe('TaskDecoder', () => { const decoder = D.type({ a: D.string, b: D.number, - c: D.array(D.boolean) + c: D.array(D.boolean), + d: D.nullable(D.string) }) assert.deepStrictEqual( await pipe(decoder.decode({ c: [1] }), TE.mapLeft(D.draw))(), @@ -303,7 +345,12 @@ required property "b" └─ cannot decode undefined, should be number required property "c" └─ optional index 0 - └─ cannot decode 1, should be boolean`) + └─ cannot decode 1, should be boolean +required property "d" +├─ member 0 +│ └─ cannot decode undefined, should be null +└─ member 1 + └─ cannot decode undefined, should be string`) ) }) }) From 6f48433a7278aa8221df6d524b85a84ef1a1ed8f Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Jun 2020 15:05:18 +0200 Subject: [PATCH 058/222] better `union` signature, add union, intersection and refinement combinators --- CHANGELOG.md | 1 + docs/modules/Decoder.ts.md | 2 +- docs/modules/Decoder2.ts.md | 39 ++++++++++++++ docs/modules/DecoderT.ts.md | 49 ++++++++++++++++- docs/modules/Guard.ts.md | 2 +- docs/modules/Schemable.ts.md | 6 ++- docs/modules/TaskDecoder.ts.md | 39 ++++++++++++++ docs/modules/Type.ts.md | 2 +- dtslint/ts3.5/Schema.ts | 24 ++++++++- src/Decoder.ts | 7 +-- src/Decoder2.ts | 40 ++++++++++++-- src/DecoderT.ts | 80 ++++++++++++++++++++++++---- src/Guard.ts | 6 ++- src/Schemable.ts | 6 ++- src/TaskDecoder.ts | 46 +++++++++++++--- src/Type.ts | 6 ++- test/Arbitrary.ts | 2 +- test/Decoder.ts | 4 -- test/Decoder2.ts | 96 ++++++++++++++++++++++++++++++++++ test/DecoderT.ts | 55 +++++++++++-------- test/TaskDecoder.ts | 96 ++++++++++++++++++++++++++++++++++ 21 files changed, 544 insertions(+), 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 239f44b01..c865935b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - remove `Tree` module (@gcanti) - `Schemable` - better `literal` signature (@gcanti) + - better `union` signature (@gcanti) # 2.2.6 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 8772a17e7..8bac5a68c 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -265,7 +265,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function union>( +export declare function union]>( ...members: { [K in keyof A]: Decoder } ): Decoder ``` diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index b973dfff3..9b129e8cc 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -18,11 +18,14 @@ Added in v2.2.7 - [success](#success) - [combinators](#combinators) - [array](#array) + - [intersection](#intersection) - [nullable](#nullable) - [partial](#partial) - [record](#record) + - [refinement](#refinement) - [tuple](#tuple) - [type](#type) + - [union](#union) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -84,6 +87,16 @@ export declare const array: (items: Decoder) => Decoder Added in v2.2.7 +## intersection + +**Signature** + +```ts +export declare const intersection: (left: Decoder, right: Decoder) => Decoder +``` + +Added in v2.2.7 + ## nullable **Signature** @@ -116,6 +129,20 @@ export declare const record: (codomain: Decoder) => Decoder( + from: Decoder, + refinement: (a: A) => a is B, + expected: string +) => Decoder +``` + +Added in v2.2.7 + ## tuple **Signature** @@ -138,6 +165,18 @@ export declare const type: (properties: { [K in keyof A]: Decoder }) => Added in v2.2.7 +## union + +**Signature** + +```ts +export declare const union: ( + ...members: { [K in keyof A]: Decoder } +) => Decoder +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 2ec0dd438..a93840976 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -14,11 +14,14 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) + - [intersection](#intersection) - [nullable](#nullable) - [partial](#partial) - [record](#record) + - [refinement](#refinement) - [tuple](#tuple) - [type](#type) + - [union](#union) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -44,13 +47,25 @@ export declare function array( Added in v2.2.7 +## intersection + +**Signature** + +```ts +export declare function intersection( + M: Apply2C +): (left: DecoderT, right: DecoderT) => DecoderT +``` + +Added in v2.2.7 + ## nullable **Signature** ```ts export declare const nullable: ( - M: MonadThrow2C & Bifunctor2 + M: Applicative2C & Bifunctor2 ) => (onError: (u: unknown, e: E) => E) => (or: DecoderT) => DecoderT ``` @@ -86,6 +101,22 @@ export declare function record( Added in v2.2.7 +## refinement + +**Signature** + +```ts +export declare function refinement( + M: MonadThrow2C & Bifunctor2 +): ( + from: DecoderT, + refinement: (a: A) => a is B, + onError: (u: unknown) => E +) => DecoderT +``` + +Added in v2.2.7 + ## tuple **Signature** @@ -116,6 +147,22 @@ export declare function type( Added in v2.2.7 +## union + +**Signature** + +```ts +export declare function union( + M: Alt2C & Bifunctor2 +): ( + onMemberError: (i: number, e: E) => E +) => ]>( + ...members: { [K in keyof A]: DecoderT } +) => DecoderT +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index ead0e5b72..86806212d 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -157,7 +157,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function union>( +export declare function union]>( ...members: { [K in keyof A]: Guard } ): Guard ``` diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 5f9f44c62..ed496b7ef 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -118,7 +118,9 @@ Added in v2.2.3 ```ts export interface WithUnion { - readonly union: >(...members: { [K in keyof A]: HKT }) => HKT + readonly union: ]>( + ...members: { [K in keyof A]: HKT } + ) => HKT } ``` @@ -130,7 +132,7 @@ Added in v2.2.3 ```ts export interface WithUnion1 { - readonly union: >( + readonly union: ]>( ...members: { [K in keyof A]: Kind } ) => Kind } diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 0619dec02..55ab4e8cd 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -18,11 +18,14 @@ Added in v2.2.7 - [success](#success) - [combinators](#combinators) - [array](#array) + - [intersection](#intersection) - [nullable](#nullable) - [partial](#partial) - [record](#record) + - [refinement](#refinement) - [tuple](#tuple) - [type](#type) + - [union](#union) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -84,6 +87,16 @@ export declare const array: (items: TaskDecoder) => TaskDecoder Added in v2.2.7 +## intersection + +**Signature** + +```ts +export declare const intersection: (left: TaskDecoder, right: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + ## nullable **Signature** @@ -116,6 +129,20 @@ export declare const record: (codomain: TaskDecoder) => TaskDecoder( + from: TaskDecoder, + refinement: (a: A) => a is B, + expected: string +) => TaskDecoder +``` + +Added in v2.2.7 + ## tuple **Signature** @@ -140,6 +167,18 @@ export declare const type: ( Added in v2.2.7 +## union + +**Signature** + +```ts +export declare const union: ( + ...members: { [K in keyof A]: TaskDecoder } +) => TaskDecoder +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index c56c214d9..922fa622e 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -152,7 +152,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function union>( +export declare function union]>( ...members: { [K in keyof A]: Type } ): Type ``` diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index 76a20b1b2..eb1c68bc1 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -14,6 +14,7 @@ function make(f: Schema): Schema { // // TypeOf // + export const OfTest = make((S) => S.type({ a: S.string, b: S.type({ c: S.number }) })) export type OfTest = TypeOf // $ExpectType { a: string; b: { c: number; }; } @@ -29,46 +30,55 @@ make((S) => S.literal('a', 'b', null)) // $ExpectType Schema<"a" | "b" | null> // // string // + make((S) => S.string) // $ExpectType Schema // // number // + make((S) => S.number) // $ExpectType Schema // // boolean // + make((S) => S.boolean) // $ExpectType Schema // // nullable // + make((S) => S.nullable(S.string)) // $ExpectType Schema // // type // + make((S) => S.type({ a: S.string, b: S.type({ c: S.number }) })) // $ExpectType Schema<{ a: string; b: { c: number; }; }> // // partial // + make((S) => S.partial({ a: S.string, b: S.partial({ c: S.number }) })) // $ExpectType Schema; }>> // // record // + make((S) => S.record(S.number)) // $ExpectType Schema> // // array // + make((S) => S.array(S.number)) // $ExpectType Schema // // tuple // + make((S) => S.tuple()) // $ExpectType Schema<[]> make((S) => S.tuple(S.string)) // $ExpectType Schema<[string]> make((S) => S.tuple(S.string, S.number)) // $ExpectType Schema<[string, number]> @@ -77,11 +87,13 @@ make((S) => S.tuple(S.string, S.number, S.boolean)) // $ExpectType Schema<[strin // // intersection // + make((S) => S.intersection(S.type({ a: S.string }), S.type({ b: S.number }))) // $ExpectType Schema<{ a: string; } & { b: number; }> // // sum // + const S1 = make((S) => S.type({ _tag: S.literal('A'), a: S.string })) const S2 = make((S) => S.type({ _tag: S.literal('B'), b: S.number })) @@ -91,14 +103,17 @@ make((S) => S.sum('_tag')({ A: S1(S), B: S2(S) })) // // lazy // + interface A { a: string bs: Array } + interface B { b: number as: Array } + const A: Schema = make((S) => S.lazy('A', () => S.type({ @@ -107,6 +122,7 @@ const A: Schema = make((S) => }) ) ) + const B: Schema = make((S) => S.lazy('B', () => S.type({ @@ -119,26 +135,32 @@ const B: Schema = make((S) => // // UnknownArray // + make((S) => S.UnknownArray) // $ExpectType Schema // // UnknownRecord // + make((S) => S.UnknownRecord) // $ExpectType Schema> // // refinement // + interface PositiveBrand { readonly Positive: unique symbol } + type Positive = number & PositiveBrand + make((S) => S.refinement(S.number, (n): n is Positive => n > 0, 'Positive')) // // union // -make((S) => S.union()) // $ExpectType Schema +// $ExpectError +make((S) => S.union()) make((S) => S.union(S.string)) // $ExpectType Schema make((S) => S.union(S.string, S.number)) // $ExpectType Schema diff --git a/src/Decoder.ts b/src/Decoder.ts index d463dd100..14c97cb0c 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -458,13 +458,10 @@ export function sum(tag: T): (members: { [K in keyof A]: De * @category combinators * @since 2.2.0 */ -export function union>( +export function union]>( ...members: { [K in keyof A]: Decoder } ): Decoder { const len = members.length - if (len === 0) { - return never - } return { decode: (u) => { const e = members[0].decode(u) @@ -581,7 +578,7 @@ export const schemableDecoder: Schemable1 & lazy, UnknownArray, UnknownRecord, - union, + union: union as WithUnion1['union'], refinement: refinement as WithRefinement1['refinement'] } diff --git a/src/Decoder2.ts b/src/Decoder2.ts index 384f62780..3e4f743c9 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -10,7 +10,16 @@ import * as NEA from 'fp-ts/lib/NonEmptyArray' import * as T from 'fp-ts/lib/Tree' import { Literal } from './Schemable' +// ------------------------------------------------------------------------------------- +// config +// ------------------------------------------------------------------------------------- + const M = E.getValidation(DE.getSemigroup()) +const fromGuardM = DT.fromGuard(M) +const literalM = DT.literal(M)((u, values) => + FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) +) +const refinementM = DT.refinement(M) // ------------------------------------------------------------------------------------- // model @@ -58,16 +67,15 @@ export function failure(actual: unknown, message: string): E.Either(guard: G.Guard, expected: string): Decoder => ({ - decode: (u) => (guard.is(u) ? success(u) : failure(u, expected)) -}) +export const fromGuard = (guard: G.Guard, expected: string): Decoder => + fromGuardM(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors * @since 2.2.7 */ export const literal = ]>(...values: A): Decoder => - fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) + literalM(...values) // ------------------------------------------------------------------------------------- // primitives @@ -113,6 +121,16 @@ export const UnknownRecord: Decoder> = fromGuard(G.Unkno // combinators // ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export const refinement = ( + from: Decoder, + refinement: (a: A) => a is B, + expected: string +): Decoder => refinementM(from, refinement, (u) => FS.of(DE.leaf(u, expected))) + /** * @category combinators * @since 2.2.7 @@ -163,6 +181,20 @@ export const tuple: >( ...components: { [K in keyof A]: Decoder } ) => Decoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any +/** + * @category combinators + * @since 2.2.7 + */ +export const union: ]>( + ...members: { [K in keyof A]: Decoder } +) => Decoder = DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const intersection: (left: Decoder, right: Decoder) => Decoder = DT.intersection(M) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 961687b94..c524ea88d 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -9,6 +9,8 @@ import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' import { Literal } from './Schemable' +import { Alt2C } from 'fp-ts/lib/Alt' +import { Apply2C } from 'fp-ts/lib/Apply' // ------------------------------------------------------------------------------------- // model @@ -59,7 +61,23 @@ export function literal( * @category combinators * @since 2.2.7 */ -export const nullable = (M: MonadThrow2C & Bifunctor2) => ( +export function refinement( + M: MonadThrow2C & Bifunctor2 +): ( + from: DecoderT, + refinement: (a: A) => a is B, + onError: (u: unknown) => E +) => DecoderT { + return (from, refinement, onError) => ({ + decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(u)))) + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export const nullable = (M: Applicative2C & Bifunctor2) => ( onError: (u: unknown, e: E) => E ) => (or: DecoderT): DecoderT => ({ decode: (u) => @@ -194,15 +212,57 @@ export function tuple( * @category combinators * @since 2.2.7 */ -// export function union( -// _M: Monad2C & Bifunctor2 -// ): ( -// onMemberError: (i: number, e: E) => E -// ) => >( -// ...members: { [K in keyof A]: DecoderT } -// ) => DecoderT { -// return null as any -// } +export function union( + M: Alt2C & Bifunctor2 +): ( + onMemberError: (i: number, e: E) => E +) => ]>( + ...members: { [K in keyof A]: DecoderT } +) => DecoderT { + return (onMemberError) => (...members) => ({ + decode: (u) => { + let out: Kind2 = M.mapLeft(members[0].decode(u), (e) => onMemberError(0, e)) + for (let i = 1; i < members.length; i++) { + out = M.alt(out, () => M.mapLeft(members[i].decode(u), (e) => onMemberError(i, e))) + } + return out + } + }) +} + +function typeOf(x: unknown): string { + return x === null ? 'null' : typeof x +} + +/** + * @internal + */ +export function intersect(a: A, b: B): A & B { + if (a !== undefined && b !== undefined) { + const tx = typeOf(a) + const ty = typeOf(b) + if (tx === 'object' || ty === 'object') { + return Object.assign({}, a, b) + } + } + return b as any +} + +/** + * @category combinators + * @since 2.2.7 + */ +export function intersection( + M: Apply2C +): (left: DecoderT, right: DecoderT) => DecoderT { + return (left: DecoderT, right: DecoderT) => ({ + decode: (u) => + M.ap( + M.map(left.decode(u), (a: A) => (b: B) => intersect(a, b)), + right.decode(u) + ) + }) +} // ------------------------------------------------------------------------------------- // utils diff --git a/src/Guard.ts b/src/Guard.ts index 8700045fb..00d6cfc9d 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -194,7 +194,9 @@ export function intersection(left: Guard, right: Guard): Guard>(...members: { [K in keyof A]: Guard }): Guard { +export function union]>( + ...members: { [K in keyof A]: Guard } +): Guard { return { is: (u: unknown): u is A | A[number] => members.some((m) => m.is(u)) } @@ -269,6 +271,6 @@ export const schemableGuard: Schemable1 & WithUnknownContainers1 & Wit lazy: (_, f) => lazy(f), UnknownArray, UnknownRecord, - union, + union: union as WithUnion1['union'], refinement: refinement as WithRefinement1['refinement'] } diff --git a/src/Schemable.ts b/src/Schemable.ts index f1553a75b..6d4e9f0cd 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -68,14 +68,16 @@ export interface WithUnknownContainers1 { * @since 2.2.3 */ export interface WithUnion { - readonly union: >(...members: { [K in keyof A]: HKT }) => HKT + readonly union: ]>( + ...members: { [K in keyof A]: HKT } + ) => HKT } /** * @since 2.2.3 */ export interface WithUnion1 { - readonly union: >( + readonly union: ]>( ...members: { [K in keyof A]: Kind } ) => Kind } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 86dd3147e..8111e8238 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -10,7 +10,16 @@ import * as NEA from 'fp-ts/lib/NonEmptyArray' import * as T from 'fp-ts/lib/Tree' import { Literal } from './Schemable' +// ------------------------------------------------------------------------------------- +// config +// ------------------------------------------------------------------------------------- + const M = TE.getTaskValidation(DE.getSemigroup()) +const fromGuardM = DT.fromGuard(M) +const literalM = DT.literal(M)((u, values) => + FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) +) +const refinementM = DT.refinement(M) // ------------------------------------------------------------------------------------- // model @@ -54,22 +63,21 @@ export function failure(actual: unknown, message: string): TE.TaskEit // constructors // ------------------------------------------------------------------------------------- +// TODO: add fromDecoder: (decoder: D.Decoder) => TaskDecoder + /** * @category constructors * @since 2.2.7 */ -export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => ({ - decode: (u) => (guard.is(u) ? success(u) : failure(u, expected)) -}) - -// TODO: add fromDecoder: (decoder: D.Decoder) => TaskDecoder +export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => + fromGuardM(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors * @since 2.2.7 */ export const literal = ]>(...values: A): TaskDecoder => - fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) + literalM(...values) // ------------------------------------------------------------------------------------- // primitives @@ -115,6 +123,16 @@ export const UnknownRecord: TaskDecoder> = fromGuard(G.U // combinators // ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export const refinement = ( + from: TaskDecoder, + refinement: (a: A) => a is B, + expected: string +): TaskDecoder => refinementM(from, refinement, (u) => FS.of(DE.leaf(u, expected))) + /** * @category combinators * @since 2.2.7 @@ -166,6 +184,22 @@ export const tuple: >( ...components: { [K in keyof A]: TaskDecoder } ) => TaskDecoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any +/** + * @category combinators + * @since 2.2.7 + */ +export const union: ]>( + ...members: { [K in keyof A]: TaskDecoder } +) => TaskDecoder = DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const intersection: (left: TaskDecoder, right: TaskDecoder) => TaskDecoder = DT.intersection( + M +) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/src/Type.ts b/src/Type.ts index e7bb32687..0597f1f78 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -149,7 +149,9 @@ export function sum(_tag: T): (members: { [K in keyof A]: T * @category combinators * @since 2.2.3 */ -export function union>(...members: { [K in keyof A]: Type }): Type { +export function union]>( + ...members: { [K in keyof A]: Type } +): Type { return t.union(members as any) } @@ -196,6 +198,6 @@ export const schemableType: Schemable1 & WithUnknownContainers1 & With lazy, UnknownArray, UnknownRecord, - union, + union: union as WithUnion1['union'], refinement: refinement as WithRefinement1['refinement'] } diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 60e218f4d..ad6d717e7 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -136,6 +136,6 @@ export const schemableArbitrary: S.Schemable1 & lazy: (_, f) => lazy(f), UnknownArray, UnknownRecord, - union, + union: union as S.WithUnion1['union'], refinement: refinement as S.WithRefinement1['refinement'] } diff --git a/test/Decoder.ts b/test/Decoder.ts index abfbef400..68c56365e 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -49,10 +49,6 @@ describe('Decoder', () => { ]) ) }) - - it('should handle zero members', () => { - assert.deepStrictEqual(D.union().decode({}), E.left([D.tree('cannot decode {}, should be never')])) - }) }) describe('sum', () => { diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 7ce98b1b1..e88586617 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -22,7 +22,23 @@ const NumberFromString: D.Decoder = { ) } +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: D.Decoder = D.refinement(D.number, (n): n is Positive => n > 0, 'Positive') + +interface IntBrand { + readonly Int: unique symbol +} +type Int = number & IntBrand +const Int: D.Decoder = D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') + describe('Decoder', () => { + // ------------------------------------------------------------------------------------- + // primitives + // ------------------------------------------------------------------------------------- + it('string', async () => { assert.deepStrictEqual(D.string.decode('a'), E.right('a')) assert.deepStrictEqual(D.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) @@ -48,6 +64,10 @@ describe('Decoder', () => { assert.deepStrictEqual(D.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) }) + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- + describe('literal', () => { it('should decode a valid input', async () => { const codec = D.literal('a', null, 'b', 1, true) @@ -61,6 +81,10 @@ describe('Decoder', () => { }) }) + // ------------------------------------------------------------------------------------- + // combinators + // ------------------------------------------------------------------------------------- + describe('nullable', () => { it('should decode a valid input', () => { const codec = D.nullable(NumberFromString) @@ -311,6 +335,78 @@ describe('Decoder', () => { }) }) + describe('union', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(D.union(D.string).decode('a'), E.right('a')) + const decoder = D.union(D.string, D.number) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode(1), E.right(1)) + }) + + it('should reject an invalid input', () => { + const decoder = D.union(D.string, D.number) + assert.deepStrictEqual( + decoder.decode(true), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), + FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) + ) + ) + ) + }) + }) + + describe('refinement', () => { + it('should decode a valid input', () => { + const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(codec.decode('a'), E.right('a')) + }) + + it('should reject an invalid input', () => { + const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(codec.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) + }) + }) + + describe('intersection', () => { + it('should decode a valid input', () => { + const codec = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), E.right({ a: 'a', b: 1 })) + }) + + it('should handle primitives', () => { + const codec = D.intersection(Int, Positive) + assert.deepStrictEqual(codec.decode(1), E.right(1)) + }) + + it('should accumulate all errors', () => { + const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + assert.deepStrictEqual( + decoder.decode({ a: 'a' }), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + decoder.decode({ b: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) + ) + assert.deepStrictEqual( + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + }) + + // ------------------------------------------------------------------------------------- + // utils + // ------------------------------------------------------------------------------------- + it('draw', async () => { const decoder = D.type({ a: D.string, diff --git a/test/DecoderT.ts b/test/DecoderT.ts index f243adbd3..241510cea 100644 --- a/test/DecoderT.ts +++ b/test/DecoderT.ts @@ -1,29 +1,42 @@ import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import * as NEA from 'fp-ts/lib/NonEmptyArray' -import * as T from 'fp-ts/lib/Tree' import * as DT from '../src/DecoderT' -import * as G from '../src/Guard' - -const M = E.getValidation(NEA.getSemigroup>()) describe('DecoderT', () => { - it('fromGuard', () => { - const fromGuard = (guard: G.Guard, expected: string) => - DT.fromGuard(M)(guard, (u) => [T.make(`cannot decode ${JSON.stringify(u)}, should be ${expected}`)]) + describe('intersect', () => { + it('should concat strings', () => { + assert.deepStrictEqual(DT.intersect('a', 'b'), 'b') + }) - const string = fromGuard(G.string, 'string') - assert.deepStrictEqual(string.decode('a'), E.right('a')) - assert.deepStrictEqual(string.decode(null), E.left([T.make('cannot decode null, should be string')])) - }) + it('should concat numbers', () => { + assert.deepStrictEqual(DT.intersect(1, 2), 2) + }) + + it('should concat booleans', () => { + assert.deepStrictEqual(DT.intersect(true, false), false) + }) + + it('should concat nulls', () => { + assert.deepStrictEqual(DT.intersect(null, null), null) + }) + + it('should concat undefineds', () => { + assert.deepStrictEqual(DT.intersect(undefined, undefined), undefined) + }) + + it('should concat objects', () => { + assert.deepStrictEqual(DT.intersect({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) + }) + + it('should concat a string with an object', () => { + assert.deepStrictEqual(DT.intersect('a', { a: 1 }), { 0: 'a', a: 1 }) + }) + + it('should concat a number with an object', () => { + assert.deepStrictEqual(DT.intersect(1, { a: 1 }), { a: 1 }) + }) - it('literal', () => { - const literal = DT.literal(M)((u, values) => [ - T.make( - `cannot decode ${JSON.stringify(u)}, should be ${values.map((value) => JSON.stringify(value)).join(' | ')}` - ) - ]) - assert.deepStrictEqual(literal('a').decode('a'), E.right('a')) - assert.deepStrictEqual(literal('a').decode('b'), E.left([T.make('cannot decode "b", should be "a"')])) + it('should concat a boolean with an object', () => { + assert.deepStrictEqual(DT.intersect(true, { a: 1 }), { a: 1 }) + }) }) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index ab08b5335..f9b32246c 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -23,7 +23,23 @@ const NumberFromString: D.TaskDecoder = { ) } +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: D.TaskDecoder = D.refinement(D.number, (n): n is Positive => n > 0, 'Positive') + +interface IntBrand { + readonly Int: unique symbol +} +type Int = number & IntBrand +const Int: D.TaskDecoder = D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') + describe('TaskDecoder', () => { + // ------------------------------------------------------------------------------------- + // primitives + // ------------------------------------------------------------------------------------- + it('string', async () => { assert.deepStrictEqual(await D.string.decode('a')(), E.right('a')) assert.deepStrictEqual(await D.string.decode(null)(), E.left(FS.of(DE.leaf(null, 'string')))) @@ -52,6 +68,10 @@ describe('TaskDecoder', () => { ) }) + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- + describe('literal', () => { it('should decode a valid input', async () => { const codec = D.literal('a', null, 'b', 1, true) @@ -65,6 +85,10 @@ describe('TaskDecoder', () => { }) }) + // ------------------------------------------------------------------------------------- + // combinators + // ------------------------------------------------------------------------------------- + describe('nullable', () => { it('should decode a valid input', async () => { const codec = D.nullable(NumberFromString) @@ -330,6 +354,78 @@ describe('TaskDecoder', () => { }) }) + describe('union', () => { + it('should decode a valid input', async () => { + assert.deepStrictEqual(await D.union(D.string).decode('a')(), E.right('a')) + const decoder = D.union(D.string, D.number) + assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) + assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) + }) + + it('should reject an invalid input', async () => { + const decoder = D.union(D.string, D.number) + assert.deepStrictEqual( + await decoder.decode(true)(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), + FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) + ) + ) + ) + }) + }) + + describe('refinement', () => { + it('should decode a valid input', async () => { + const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(await codec.decode('a')(), E.right('a')) + }) + + it('should reject an invalid input', async () => { + const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(await codec.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(await codec.decode('')(), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) + }) + }) + + describe('intersection', () => { + it('should decode a valid input', async () => { + const codec = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + assert.deepStrictEqual(await codec.decode({ a: 'a', b: 1 })(), E.right({ a: 'a', b: 1 })) + }) + + it('should handle primitives', async () => { + const codec = D.intersection(Int, Positive) + assert.deepStrictEqual(await codec.decode(1)(), E.right(1)) + }) + + it('should accumulate all errors', async () => { + const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + assert.deepStrictEqual( + await decoder.decode({ a: 'a' })(), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + await decoder.decode({ b: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) + ) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + }) + + // ------------------------------------------------------------------------------------- + // utils + // ------------------------------------------------------------------------------------- + it('draw', async () => { const decoder = D.type({ a: D.string, From b4e5e8e01ca6916e5546fb9536421c855fc14058 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Jun 2020 17:36:11 +0200 Subject: [PATCH 059/222] DecoderT: add sum combinator --- docs/modules/Decoder2.ts.md | 13 +++++++++++++ docs/modules/DecoderT.ts.md | 16 ++++++++++++++++ docs/modules/TaskDecoder.ts.md | 13 +++++++++++++ src/Decoder2.ts | 12 ++++++++++++ src/DecoderT.ts | 29 +++++++++++++++++++++++++++++ src/TaskDecoder.ts | 12 ++++++++++++ test/Codec.ts | 1 + test/Decoder2.ts | 27 +++++++++++++++++++++++++++ test/TaskDecoder.ts | 27 +++++++++++++++++++++++++++ 9 files changed, 150 insertions(+) diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index 9b129e8cc..9b52b08f1 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -23,6 +23,7 @@ Added in v2.2.7 - [partial](#partial) - [record](#record) - [refinement](#refinement) + - [sum](#sum) - [tuple](#tuple) - [type](#type) - [union](#union) @@ -143,6 +144,18 @@ export declare const refinement: ( Added in v2.2.7 +## sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: Decoder }) => Decoder +``` + +Added in v2.2.7 + ## tuple **Signature** diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index a93840976..519e21fd8 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -19,6 +19,7 @@ Added in v2.2.7 - [partial](#partial) - [record](#record) - [refinement](#refinement) + - [sum](#sum) - [tuple](#tuple) - [type](#type) - [union](#union) @@ -117,6 +118,21 @@ export declare function refinement( Added in v2.2.7 +## sum + +**Signature** + +```ts +export declare function sum( + M: MonadThrow2C +): ( + UnknownRecord: DecoderT>, + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => (tag: T) => (members: { [K in keyof A]: DecoderT }) => DecoderT +``` + +Added in v2.2.7 + ## tuple **Signature** diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 55ab4e8cd..91cc6fced 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -23,6 +23,7 @@ Added in v2.2.7 - [partial](#partial) - [record](#record) - [refinement](#refinement) + - [sum](#sum) - [tuple](#tuple) - [type](#type) - [union](#union) @@ -143,6 +144,18 @@ export declare const refinement: ( Added in v2.2.7 +## sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder +``` + +Added in v2.2.7 + ## tuple **Signature** diff --git a/src/Decoder2.ts b/src/Decoder2.ts index 3e4f743c9..b7b1ebec7 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -195,6 +195,18 @@ export const union: ]>( */ export const intersection: (left: Decoder, right: Decoder) => Decoder = DT.intersection(M) +/** + * @category combinators + * @since 2.2.7 + */ +export const sum: ( + tag: T +) => (members: { [K in keyof A]: Decoder }) => Decoder = DT.sum(M)( + UnknownRecord, + (tag, value, keys) => + FS.of(DE.key(tag, DE.required, FS.of(DE.leaf(value, keys.map((k) => JSON.stringify(k)).join(' | '))))) +) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/src/DecoderT.ts b/src/DecoderT.ts index c524ea88d..18af1d21c 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -264,6 +264,35 @@ export function intersection( }) } +/** + * @category combinators + * @since 2.2.7 + */ +export function sum( + M: MonadThrow2C +): ( + UnknownRecord: DecoderT>, + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +) => (members: { [K in keyof A]: DecoderT }) => DecoderT { + return (UnknownRecord, onTagError) => (tag) => ( + members: { [K in keyof A]: DecoderT } + ): DecoderT => { + const keys = Object.keys(members) + return { + decode: (u) => + M.chain(UnknownRecord.decode(u), (r) => { + const v = r[tag] as keyof A + if (v in members) { + return members[v].decode(u) + } + return M.throwError(onTagError(tag, v, keys)) + }) + } + } +} + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 8111e8238..e21afa241 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -200,6 +200,18 @@ export const intersection: (left: TaskDecoder, right: TaskDecoder) = M ) +/** + * @category combinators + * @since 2.2.7 + */ +export const sum: ( + tag: T +) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder = DT.sum(M)( + UnknownRecord, + (tag, value, keys) => + FS.of(DE.key(tag, DE.required, FS.of(DE.leaf(value, keys.map((k) => JSON.stringify(k)).join(' | '))))) +) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/test/Codec.ts b/test/Codec.ts index 50907a5b3..e1e5de32b 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -542,6 +542,7 @@ describe('Codec', () => { ) }) + // TODO: make this an error it('should support empty records', () => { const decoder = sum({}) assert.deepStrictEqual(decoder.decode({}), left([D.tree('cannot decode {}, should be never')])) diff --git a/test/Decoder2.ts b/test/Decoder2.ts index e88586617..c6189e608 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -403,6 +403,33 @@ describe('Decoder', () => { }) }) + describe('sum', () => { + const sum = D.sum('_tag') + + it('should decode a valid input', () => { + const A = D.type({ _tag: D.literal('A'), a: D.string }) + const B = D.type({ _tag: D.literal('B'), b: D.number }) + const codec = sum({ A, B }) + assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), E.right({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), E.right({ _tag: 'B', b: 1 })) + }) + + it('should reject an invalid input', () => { + const A = D.type({ _tag: D.literal('A'), a: D.string }) + const B = D.type({ _tag: D.literal('B'), b: D.number }) + const codec = sum({ A, B }) + assert.deepStrictEqual(codec.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual( + codec.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + ) + assert.deepStrictEqual( + codec.decode({ _tag: 'A', a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + }) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index f9b32246c..b6cf51d4a 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -422,6 +422,33 @@ describe('TaskDecoder', () => { }) }) + describe('sum', () => { + const sum = D.sum('_tag') + + it('should decode a valid input', async () => { + const A = D.type({ _tag: D.literal('A'), a: D.string }) + const B = D.type({ _tag: D.literal('B'), b: D.number }) + const codec = sum({ A, B }) + assert.deepStrictEqual(await codec.decode({ _tag: 'A', a: 'a' })(), E.right({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(await codec.decode({ _tag: 'B', b: 1 })(), E.right({ _tag: 'B', b: 1 })) + }) + + it('should reject an invalid input', async () => { + const A = D.type({ _tag: D.literal('A'), a: D.string }) + const B = D.type({ _tag: D.literal('B'), b: D.number }) + const codec = sum({ A, B }) + assert.deepStrictEqual(await codec.decode(null)(), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual( + await codec.decode({})(), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + ) + assert.deepStrictEqual( + await codec.decode({ _tag: 'A', a: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + }) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- From 02fe8a6f9fcaa55be99cef9b868c89158b0156f6 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Jun 2020 18:17:49 +0200 Subject: [PATCH 060/222] DecoderT: add lazy combinator --- docs/modules/DecodeError.ts.md | 29 ++++++++++++- docs/modules/Decoder2.ts.md | 11 +++++ docs/modules/DecoderT.ts.md | 32 ++++++++++---- docs/modules/TaskDecoder.ts.md | 11 +++++ src/DecodeError.ts | 25 ++++++++++- src/Decoder2.ts | 9 +++- src/DecoderT.ts | 76 ++++++++++++++++---------------- src/TaskDecoder.ts | 11 ++++- test/Decoder2.ts | 79 +++++++++++++++++++++++++++++----- test/TaskDecoder.ts | 79 +++++++++++++++++++++++++++++----- 10 files changed, 292 insertions(+), 70 deletions(-) diff --git a/docs/modules/DecodeError.ts.md b/docs/modules/DecodeError.ts.md index efdb1b210..f01519543 100644 --- a/docs/modules/DecodeError.ts.md +++ b/docs/modules/DecodeError.ts.md @@ -15,6 +15,7 @@ Added in v2.2.7 - [constructors](#constructors) - [index](#index) - [key](#key) + - [lazy](#lazy) - [leaf](#leaf) - [member](#member) - [destructors](#destructors) @@ -26,6 +27,7 @@ Added in v2.2.7 - [Index (interface)](#index-interface) - [Key (interface)](#key-interface) - [Kind (type alias)](#kind-type-alias) + - [Lazy (interface)](#lazy-interface) - [Leaf (interface)](#leaf-interface) - [Member (interface)](#member-interface) - [optional](#optional) @@ -55,6 +57,16 @@ export declare const key: (key: string, kind: Kind, errors: FS.FreeSemigroup< Added in v2.2.7 +## lazy + +**Signature** + +```ts +export declare const lazy: (id: string, errors: FS.FreeSemigroup>) => DecodeError +``` + +Added in v2.2.7 + ## leaf **Signature** @@ -87,6 +99,7 @@ export declare const fold: (patterns: { Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R Member: (index: number, errors: FS.FreeSemigroup>) => R + Lazy: (id: string, errors: FS.FreeSemigroup>) => R }) => (e: DecodeError) => R ``` @@ -111,7 +124,7 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = Leaf | Key | Index | Member +export type DecodeError = Leaf | Key | Index | Member | Lazy ``` Added in v2.2.7 @@ -156,6 +169,20 @@ export type Kind = 'required' | 'optional' Added in v2.2.7 +## Lazy (interface) + +**Signature** + +```ts +export interface Lazy { + readonly _tag: 'Lazy' + readonly id: string + readonly errors: FS.FreeSemigroup> +} +``` + +Added in v2.2.7 + ## Leaf (interface) **Signature** diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index 9b52b08f1..8a9a3f15e 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -19,6 +19,7 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) - [intersection](#intersection) + - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) - [record](#record) @@ -98,6 +99,16 @@ export declare const intersection: (left: Decoder, right: Decoder) = Added in v2.2.7 +## lazy + +**Signature** + +```ts +export declare const lazy: (id: string, f: () => Decoder) => Decoder +``` + +Added in v2.2.7 + ## nullable **Signature** diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 519e21fd8..49b11d982 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -15,6 +15,7 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) - [intersection](#intersection) + - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) - [record](#record) @@ -53,9 +54,24 @@ Added in v2.2.7 **Signature** ```ts -export declare function intersection( +export declare const intersection: < + M extends 'io-ts/Codec' | 'io-ts/Encoder' | 'Either' | 'IOEither' | 'TaskEither', + E +>( M: Apply2C -): (left: DecoderT, right: DecoderT) => DecoderT +) => (left: DecoderT, right: DecoderT) => DecoderT +``` + +Added in v2.2.7 + +## lazy + +**Signature** + +```ts +export declare const lazy: ( + M: MonadThrow2C & Bifunctor2 +) => (onError: (id: string, e: E) => E) => (id: string, f: () => DecoderT) => DecoderT ``` Added in v2.2.7 @@ -123,11 +139,11 @@ Added in v2.2.7 **Signature** ```ts -export declare function sum( +export declare const sum: ( M: MonadThrow2C -): ( +) => ( UnknownRecord: DecoderT>, - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E + onTagError: (tag: string, value: unknown, tags: readonly string[]) => E ) => (tag: T) => (members: { [K in keyof A]: DecoderT }) => DecoderT ``` @@ -168,11 +184,11 @@ Added in v2.2.7 **Signature** ```ts -export declare function union( +export declare const union: ( M: Alt2C & Bifunctor2 -): ( +) => ( onMemberError: (i: number, e: E) => E -) => ]>( +) => ( ...members: { [K in keyof A]: DecoderT } ) => DecoderT ``` diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 91cc6fced..711e31e34 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -19,6 +19,7 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) - [intersection](#intersection) + - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) - [record](#record) @@ -98,6 +99,16 @@ export declare const intersection: (left: TaskDecoder, right: TaskDecod Added in v2.2.7 +## lazy + +**Signature** + +```ts +export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + ## nullable **Signature** diff --git a/src/DecodeError.ts b/src/DecodeError.ts index e03a2e351..f8b7b2ec5 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -68,7 +68,17 @@ export interface Member { * @category model * @since 2.2.7 */ -export type DecodeError = Leaf | Key | Index | Member +export interface Lazy { + readonly _tag: 'Lazy' + readonly id: string + readonly errors: FS.FreeSemigroup> +} + +/** + * @category model + * @since 2.2.7 + */ +export type DecodeError = Leaf | Key | Index | Member | Lazy /** * @category constructors @@ -108,6 +118,16 @@ export const member = (index: number, errors: FS.FreeSemigroup errors }) +/** + * @category constructors + * @since 2.2.7 + */ +export const lazy = (id: string, errors: FS.FreeSemigroup>): DecodeError => ({ + _tag: 'Lazy', + id, + errors +}) + /** * @category destructors * @since 2.2.7 @@ -117,6 +137,7 @@ export const fold = (patterns: { Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R Member: (index: number, errors: FS.FreeSemigroup>) => R + Lazy: (id: string, errors: FS.FreeSemigroup>) => R }): ((e: DecodeError) => R) => { const f = (e: DecodeError): R => { switch (e._tag) { @@ -128,6 +149,8 @@ export const fold = (patterns: { return patterns.Index(e.index, e.kind, e.errors) case 'Member': return patterns.Member(e.index, e.errors) + case 'Lazy': + return patterns.Lazy(e.id, e.errors) } } return f diff --git a/src/Decoder2.ts b/src/Decoder2.ts index b7b1ebec7..ea543a268 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -207,6 +207,12 @@ export const sum: ( FS.of(DE.key(tag, DE.required, FS.of(DE.leaf(value, keys.map((k) => JSON.stringify(k)).join(' | '))))) ) +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy: (id: string, f: () => Decoder) => Decoder = DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- @@ -216,7 +222,8 @@ const toForest = (e: DecodeError): NEA.NonEmptyArray> => { Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => T.make(`member ${index}`, toForest(errors)) + Member: (index, errors) => T.make(`member ${index}`, toForest(errors)), + Lazy: (id, errors) => T.make(`lazy type ${id}`, toForest(errors)) }) const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( (value) => [toTree(value)], diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 18af1d21c..c93e4d39d 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -8,7 +8,7 @@ import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' -import { Literal } from './Schemable' +import { Literal, memoize } from './Schemable' import { Alt2C } from 'fp-ts/lib/Alt' import { Apply2C } from 'fp-ts/lib/Apply' @@ -212,32 +212,26 @@ export function tuple( * @category combinators * @since 2.2.7 */ -export function union( - M: Alt2C & Bifunctor2 -): ( +export const union = (M: Alt2C & Bifunctor2) => ( onMemberError: (i: number, e: E) => E ) => ]>( ...members: { [K in keyof A]: DecoderT } -) => DecoderT { - return (onMemberError) => (...members) => ({ - decode: (u) => { - let out: Kind2 = M.mapLeft(members[0].decode(u), (e) => onMemberError(0, e)) - for (let i = 1; i < members.length; i++) { - out = M.alt(out, () => M.mapLeft(members[i].decode(u), (e) => onMemberError(i, e))) - } - return out +): DecoderT => ({ + decode: (u) => { + let out: Kind2 = M.mapLeft(members[0].decode(u), (e) => onMemberError(0, e)) + for (let i = 1; i < members.length; i++) { + out = M.alt(out, () => M.mapLeft(members[i].decode(u), (e) => onMemberError(i, e))) } - }) -} + return out + } +}) -function typeOf(x: unknown): string { - return x === null ? 'null' : typeof x -} +const typeOf = (x: unknown): string => (x === null ? 'null' : typeof x) /** * @internal */ -export function intersect(a: A, b: B): A & B { +export const intersect = (a: A, b: B): A & B => { if (a !== undefined && b !== undefined) { const tx = typeOf(a) const ty = typeOf(b) @@ -252,33 +246,28 @@ export function intersect(a: A, b: B): A & B { * @category combinators * @since 2.2.7 */ -export function intersection( - M: Apply2C -): (left: DecoderT, right: DecoderT) => DecoderT { - return (left: DecoderT, right: DecoderT) => ({ - decode: (u) => - M.ap( - M.map(left.decode(u), (a: A) => (b: B) => intersect(a, b)), - right.decode(u) - ) - }) -} +export const intersection = (M: Apply2C) => ( + left: DecoderT, + right: DecoderT +): DecoderT => ({ + decode: (u) => + M.ap( + M.map(left.decode(u), (a: A) => (b: B) => intersect(a, b)), + right.decode(u) + ) +}) /** * @category combinators * @since 2.2.7 */ -export function sum( - M: MonadThrow2C -): ( +export const sum = (M: MonadThrow2C) => ( UnknownRecord: DecoderT>, onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E ) => ( tag: T -) => (members: { [K in keyof A]: DecoderT }) => DecoderT { - return (UnknownRecord, onTagError) => (tag) => ( - members: { [K in keyof A]: DecoderT } - ): DecoderT => { +): ((members: { [K in keyof A]: DecoderT }) => DecoderT) => { + return (members: { [K in keyof A]: DecoderT }): DecoderT => { const keys = Object.keys(members) return { decode: (u) => @@ -293,6 +282,21 @@ export function sum( } } +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy = (M: MonadThrow2C & Bifunctor2) => ( + onError: (id: string, e: E) => E +): ((id: string, f: () => DecoderT) => DecoderT) => { + return (id: string, f: () => DecoderT): DecoderT => { + const get = memoize>(f) + return { + decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) + } + } +} + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index e21afa241..9875d0dbe 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -212,6 +212,14 @@ export const sum: ( FS.of(DE.key(tag, DE.required, FS.of(DE.leaf(value, keys.map((k) => JSON.stringify(k)).join(' | '))))) ) +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = DT.lazy(M)((id, e) => + FS.of(DE.lazy(id, e)) +) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- @@ -221,7 +229,8 @@ const toForest = (e: DecodeError): NEA.NonEmptyArray> => { Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => T.make(`member ${index}`, toForest(errors)) + Member: (index, errors) => T.make(`member ${index}`, toForest(errors)), + Lazy: (id, errors) => T.make(`lazy type ${id}`, toForest(errors)) }) const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( (value) => [toTree(value)], diff --git a/test/Decoder2.ts b/test/Decoder2.ts index c6189e608..f5f374d1c 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -430,20 +430,65 @@ describe('Decoder', () => { }) }) + interface A { + a: number + b?: A + } + + const lazyDecoder: D.Decoder = D.lazy('A', () => + D.intersection(D.type({ a: NumberFromString }), D.partial({ b: lazyDecoder })) + ) + + describe('lazy', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), E.right({ a: 1 })) + assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), E.right({ a: 1, b: { a: 2 } })) + }) + + it('should reject an invalid input', () => { + assert.deepStrictEqual( + lazyDecoder.decode({ a: 1 }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: 'a' }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: '1', b: {} }), + E.left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) + ) + }) + }) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- - it('draw', async () => { - const decoder = D.type({ - a: D.string, - b: D.number, - c: D.array(D.boolean), - d: D.nullable(D.string) - }) - assert.deepStrictEqual( - pipe(decoder.decode({ c: [1] }), E.mapLeft(D.draw)), - E.left(`required property "a" + describe('draw', () => { + it('draw', () => { + const decoder = D.type({ + a: D.string, + b: D.number, + c: D.array(D.boolean), + d: D.nullable(D.string) + }) + assert.deepStrictEqual( + pipe(decoder.decode({ c: [1] }), E.mapLeft(D.draw)), + E.left(`required property "a" └─ cannot decode undefined, should be string required property "b" └─ cannot decode undefined, should be number @@ -455,6 +500,18 @@ required property "d" │ └─ cannot decode undefined, should be null └─ member 1 └─ cannot decode undefined, should be string`) - ) + ) + }) + + it('should support lazy combinators', () => { + assert.deepStrictEqual( + pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(D.draw)), + E.left(`lazy type A +└─ optional property \"b\" + └─ lazy type A + └─ required property \"a\" + └─ cannot decode undefined, should be string`) + ) + }) }) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index b6cf51d4a..79a19815c 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -449,20 +449,65 @@ describe('TaskDecoder', () => { }) }) + interface A { + a: number + b?: A + } + + const lazyDecoder: D.TaskDecoder = D.lazy('A', () => + D.intersection(D.type({ a: NumberFromString }), D.partial({ b: lazyDecoder })) + ) + + describe('lazy', () => { + it('should decode a valid input', async () => { + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), E.right({ a: 1 })) + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), E.right({ a: 1, b: { a: 2 } })) + }) + + it('should reject an invalid input', async () => { + assert.deepStrictEqual( + await lazyDecoder.decode({ a: 1 })(), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + ) + assert.deepStrictEqual( + await lazyDecoder.decode({ a: 'a' })(), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + ) + assert.deepStrictEqual( + await lazyDecoder.decode({ a: '1', b: {} })(), + E.left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) + ) + }) + }) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- - it('draw', async () => { - const decoder = D.type({ - a: D.string, - b: D.number, - c: D.array(D.boolean), - d: D.nullable(D.string) - }) - assert.deepStrictEqual( - await pipe(decoder.decode({ c: [1] }), TE.mapLeft(D.draw))(), - E.left(`required property "a" + describe('draw', () => { + it('draw', async () => { + const decoder = D.type({ + a: D.string, + b: D.number, + c: D.array(D.boolean), + d: D.nullable(D.string) + }) + assert.deepStrictEqual( + await pipe(decoder.decode({ c: [1] }), TE.mapLeft(D.draw))(), + E.left(`required property "a" └─ cannot decode undefined, should be string required property "b" └─ cannot decode undefined, should be number @@ -474,6 +519,18 @@ required property "d" │ └─ cannot decode undefined, should be null └─ member 1 └─ cannot decode undefined, should be string`) - ) + ) + }) + + it('should support lazy combinators', async () => { + assert.deepStrictEqual( + await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(D.draw))(), + E.left(`lazy type A +└─ optional property \"b\" + └─ lazy type A + └─ required property \"a\" + └─ cannot decode undefined, should be string`) + ) + }) }) }) From 37d4e9e3ab72f6cbc59ab51a5cd38d0318ea9665 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Jun 2020 18:31:01 +0200 Subject: [PATCH 061/222] remove useless `never`s decoders --- docs/modules/Decoder2.ts.md | 11 ----------- docs/modules/TaskDecoder.ts.md | 11 ----------- src/Decoder2.ts | 6 ------ src/TaskDecoder.ts | 6 ------ 4 files changed, 34 deletions(-) diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index 8a9a3f15e..8b7fa54d0 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -37,7 +37,6 @@ Added in v2.2.7 - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - - [never](#never) - [number](#number) - [string](#string) - [utils](#utils) @@ -269,16 +268,6 @@ export declare const boolean: Decoder Added in v2.2.7 -## never - -**Signature** - -```ts -export declare const never: Decoder -``` - -Added in v2.2.7 - ## number **Signature** diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 711e31e34..bfb5c3923 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -37,7 +37,6 @@ Added in v2.2.7 - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - - [never](#never) - [number](#number) - [string](#string) - [utils](#utils) @@ -271,16 +270,6 @@ export declare const boolean: TaskDecoder Added in v2.2.7 -## never - -**Signature** - -```ts -export declare const never: TaskDecoder -``` - -Added in v2.2.7 - ## number **Signature** diff --git a/src/Decoder2.ts b/src/Decoder2.ts index ea543a268..5fa25fd03 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -81,12 +81,6 @@ export const literal = ]>(...valu // primitives // ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.7 - */ -export const never: Decoder = fromGuard(G.never, 'never') - /** * @category primitives * @since 2.2.7 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 9875d0dbe..b12a84ec4 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -83,12 +83,6 @@ export const literal = ]>(...valu // primitives // ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.7 - */ -export const never: TaskDecoder = fromGuard(G.never, 'never') - /** * @category primitives * @since 2.2.7 From e46ddccdea95d0d5b83b3d49e2c825181d3c7b3d Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Jun 2020 20:40:11 +0200 Subject: [PATCH 062/222] fix typo --- src/FreeSemigroup.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FreeSemigroup.ts b/src/FreeSemigroup.ts index 483520c92..a227e5a8c 100644 --- a/src/FreeSemigroup.ts +++ b/src/FreeSemigroup.ts @@ -29,13 +29,13 @@ export interface Concat { export type FreeSemigroup = Of | Concat /** - * @category consrtuctors + * @category constructors * @since 2.2.7 */ export const of = (a: A): FreeSemigroup => ({ _tag: 'Of', value: a }) /** - * @category consrtuctors + * @category constructors * @since 2.2.7 */ export const concat = (left: FreeSemigroup, right: FreeSemigroup): FreeSemigroup => ({ From b3460febe9955a7e05be1a54e4487dada977ddc4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 07:02:20 +0200 Subject: [PATCH 063/222] remove never primitives --- CHANGELOG.md | 4 ++++ docs/modules/Decoder.ts.md | 11 ----------- docs/modules/FreeSemigroup.ts.md | 4 ++-- docs/modules/Guard.ts.md | 11 ----------- src/Decoder.ts | 11 +---------- src/Decoder2.ts | 8 +++++++- src/Guard.ts | 8 -------- src/TaskDecoder.ts | 8 +++++++- test/Codec.ts | 6 ++++-- test/Decoder2.ts | 8 ++++++++ test/TaskDecoder.ts | 8 ++++++++ 11 files changed, 41 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c865935b9..d8464a0c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ - add `FreeSemigroup` module (@gcanti) - add `TaskDecoder` module (@gcanti) - remove `Tree` module (@gcanti) + - `Decoder` + - remove `never` (@gcanti) + - `Guard` + - remove `never` (@gcanti) - `Schemable` - better `literal` signature (@gcanti) - better `union` signature (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 8bac5a68c..085ed26ac 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -52,7 +52,6 @@ Added in v2.2.0 - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - - [never](#never) - [number](#number) - [string](#string) - [utils](#utils) @@ -418,16 +417,6 @@ export declare const boolean: Decoder Added in v2.2.0 -## never - -**Signature** - -```ts -export declare const never: Decoder -``` - -Added in v2.2.0 - ## number **Signature** diff --git a/docs/modules/FreeSemigroup.ts.md b/docs/modules/FreeSemigroup.ts.md index a34b55770..d89229887 100644 --- a/docs/modules/FreeSemigroup.ts.md +++ b/docs/modules/FreeSemigroup.ts.md @@ -12,7 +12,7 @@ Added in v2.2.7

Table of contents

-- [consrtuctors](#consrtuctors) +- [constructors](#constructors) - [concat](#concat) - [of](#of) - [destructors](#destructors) @@ -26,7 +26,7 @@ Added in v2.2.7 --- -# consrtuctors +# constructors ## concat diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 86806212d..885af020d 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -36,7 +36,6 @@ Added in v2.2.0 - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - - [never](#never) - [number](#number) - [string](#string) - [utils](#utils) @@ -257,16 +256,6 @@ export declare const boolean: Guard Added in v2.2.0 -## never - -**Signature** - -```ts -export declare const never: Guard -``` - -Added in v2.2.0 - ## number **Signature** diff --git a/src/Decoder.ts b/src/Decoder.ts index 14c97cb0c..3e3343d07 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -115,12 +115,6 @@ export const literal =
]>(...valu // primitives // ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.0 - */ -export const never: Decoder = fromGuard(G.never, 'never') - /** * @category primitives * @since 2.2.0 @@ -430,10 +424,7 @@ export function lazy(id: string, f: () => Decoder): Decoder { export function sum(tag: T): (members: { [K in keyof A]: Decoder }) => Decoder { return (members: { [K in keyof A]: Decoder }) => { const keys = Object.keys(members) - if (keys.length === 0) { - return never - } - const expected = keys.map((k) => JSON.stringify(k)).join(' | ') + const expected = keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ') return { decode: (u) => { const e = UnknownRecord.decode(u) diff --git a/src/Decoder2.ts b/src/Decoder2.ts index 5fa25fd03..c3cd3ee88 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -198,7 +198,13 @@ export const sum: ( ) => (members: { [K in keyof A]: Decoder }) => Decoder = DT.sum(M)( UnknownRecord, (tag, value, keys) => - FS.of(DE.key(tag, DE.required, FS.of(DE.leaf(value, keys.map((k) => JSON.stringify(k)).join(' | '))))) + FS.of( + DE.key( + tag, + DE.required, + FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) + ) + ) ) /** diff --git a/src/Guard.ts b/src/Guard.ts index 00d6cfc9d..26133babe 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -42,14 +42,6 @@ export function literal]>(...valu // primitives // ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.0 - */ -export const never: Guard = { - is: (_u): _u is never => false -} - /** * @category primitives * @since 2.2.0 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index b12a84ec4..18cefe76a 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -203,7 +203,13 @@ export const sum: ( ) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder = DT.sum(M)( UnknownRecord, (tag, value, keys) => - FS.of(DE.key(tag, DE.required, FS.of(DE.leaf(value, keys.map((k) => JSON.stringify(k)).join(' | '))))) + FS.of( + DE.key( + tag, + DE.required, + FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) + ) + ) ) /** diff --git a/test/Codec.ts b/test/Codec.ts index e1e5de32b..08652da5d 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -542,10 +542,12 @@ describe('Codec', () => { ) }) - // TODO: make this an error it('should support empty records', () => { const decoder = sum({}) - assert.deepStrictEqual(decoder.decode({}), left([D.tree('cannot decode {}, should be never')])) + assert.deepStrictEqual( + decoder.decode({}), + left([D.tree('required property "_tag"', [D.tree('cannot decode undefined, should be never')])]) + ) }) }) diff --git a/test/Decoder2.ts b/test/Decoder2.ts index f5f374d1c..28e4a7139 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -428,6 +428,14 @@ describe('Decoder', () => { E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) + + it('should support empty records', () => { + const decoder = sum({}) + assert.deepStrictEqual( + decoder.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + ) + }) }) interface A { diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 79a19815c..f1329addd 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -447,6 +447,14 @@ describe('TaskDecoder', () => { E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) + + it('should support empty records', async () => { + const decoder = sum({}) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + ) + }) }) interface A { From 4fd7dabfbdd3f512ecc76d67ad47ccd80cb52a22 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 07:12:24 +0200 Subject: [PATCH 064/222] DecoderT: add withExpected --- docs/modules/Decoder2.ts.md | 14 ++++++++++++++ docs/modules/DecoderT.ts.md | 16 ++++++++++++++++ docs/modules/TaskDecoder.ts.md | 14 ++++++++++++++ src/Decoder2.ts | 9 +++++++++ src/DecoderT.ts | 11 +++++++++++ src/TaskDecoder.ts | 9 +++++++++ test/Decoder2.ts | 5 +++++ test/TaskDecoder.ts | 5 +++++ 8 files changed, 83 insertions(+) diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index 8b7fa54d0..f63915b57 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -28,6 +28,7 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) + - [withExpected](#withexpected) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -200,6 +201,19 @@ export declare const union: ( Added in v2.2.7 +## withExpected + +**Signature** + +```ts +export declare const withExpected: ( + decoder: Decoder, + expected: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => Decoder +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 49b11d982..20008f585 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -24,6 +24,7 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) + - [withExpected](#withexpected) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -195,6 +196,21 @@ export declare const union: ( + M: Monad2C & Bifunctor2 +) => (decoder: DecoderT, expected: (actual: unknown, e: E) => E) => DecoderT +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index bfb5c3923..58330e3dc 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -28,6 +28,7 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) + - [withExpected](#withexpected) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -202,6 +203,19 @@ export declare const union: ( Added in v2.2.7 +## withExpected + +**Signature** + +```ts +export declare const withExpected: ( + decoder: TaskDecoder, + expected: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => TaskDecoder +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/src/Decoder2.ts b/src/Decoder2.ts index c3cd3ee88..b1a6f2d0d 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -115,6 +115,15 @@ export const UnknownRecord: Decoder> = fromGuard(G.Unkno // combinators // ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export const withExpected: ( + decoder: Decoder, + expected: (actual: unknown, e: DecodeError) => DecodeError +) => Decoder = DT.withExpected(M) + /** * @category combinators * @since 2.2.7 diff --git a/src/DecoderT.ts b/src/DecoderT.ts index c93e4d39d..ea09cd334 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -57,6 +57,17 @@ export function literal( // combinators // ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export const withExpected = (M: Monad2C & Bifunctor2) => ( + decoder: DecoderT, + expected: (actual: unknown, e: E) => E +): DecoderT => ({ + decode: (u) => M.mapLeft(decoder.decode(u), (e) => expected(u, e)) +}) + /** * @category combinators * @since 2.2.7 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 18cefe76a..1044a1802 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -117,6 +117,15 @@ export const UnknownRecord: TaskDecoder> = fromGuard(G.U // combinators // ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export const withExpected: ( + decoder: TaskDecoder, + expected: (actual: unknown, e: DecodeError) => DecodeError +) => TaskDecoder = DT.withExpected(M) + /** * @category combinators * @since 2.2.7 diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 28e4a7139..3e3949241 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -85,6 +85,11 @@ describe('Decoder', () => { // combinators // ------------------------------------------------------------------------------------- + it('withExpected', () => { + const decoder = D.withExpected(D.number, (u) => FS.of(DE.leaf(u, 'not a number'))) + assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) + }) + describe('nullable', () => { it('should decode a valid input', () => { const codec = D.nullable(NumberFromString) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index f1329addd..51de4eacf 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -89,6 +89,11 @@ describe('TaskDecoder', () => { // combinators // ------------------------------------------------------------------------------------- + it('withExpected', async () => { + const decoder = D.withExpected(D.number, (u) => FS.of(DE.leaf(u, 'not a number'))) + assert.deepStrictEqual(await decoder.decode('a')(), E.left(FS.of(DE.leaf('a', 'not a number')))) + }) + describe('nullable', () => { it('should decode a valid input', async () => { const codec = D.nullable(NumberFromString) From 7f295fa185405aa994527d0d82869813e50c9afe Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 07:33:12 +0200 Subject: [PATCH 065/222] DecoderT: add parse combinator --- CHANGELOG.md | 1 + docs/modules/Decoder.ts.md | 2 +- docs/modules/Decoder2.ts.md | 14 ++++++++++++++ docs/modules/DecoderT.ts.md | 17 +++++++++++++++-- docs/modules/TaskDecoder.ts.md | 14 ++++++++++++++ src/Decoder.ts | 8 ++------ src/Decoder2.ts | 6 ++++++ src/DecoderT.ts | 23 +++++++++++++++-------- src/TaskDecoder.ts | 9 +++++++++ test/Codec.ts | 2 +- test/Decoder2.ts | 14 ++++---------- test/TaskDecoder.ts | 14 ++++---------- 12 files changed, 86 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8464a0c9..d2cc79006 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - remove `Tree` module (@gcanti) - `Decoder` - remove `never` (@gcanti) + - change `parse` signature (@gcanti) - `Guard` - remove `never` (@gcanti) - `Schemable` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 085ed26ac..3e91a7711 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -184,7 +184,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function parse(from: Decoder, parser: (a: A) => Either): Decoder +export declare function parse(from: Decoder, parser: (a: A) => Either): Decoder ``` Added in v2.2.0 diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index f63915b57..9854eaac8 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -21,6 +21,7 @@ Added in v2.2.7 - [intersection](#intersection) - [lazy](#lazy) - [nullable](#nullable) + - [parse](#parse) - [partial](#partial) - [record](#record) - [refinement](#refinement) @@ -119,6 +120,19 @@ export declare const nullable: (or: Decoder) => Decoder Added in v2.2.7 +## parse + +**Signature** + +```ts +export declare const parse: ( + from: Decoder, + parser: (a: A) => E.Either>, B> +) => Decoder +``` + +Added in v2.2.7 + ## partial **Signature** diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 20008f585..b5975c7b9 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -17,6 +17,7 @@ Added in v2.2.7 - [intersection](#intersection) - [lazy](#lazy) - [nullable](#nullable) + - [parse](#parse) - [partial](#partial) - [record](#record) - [refinement](#refinement) @@ -89,6 +90,18 @@ export declare const nullable: ( + M: MonadThrow2C & Bifunctor2 +) => (from: DecoderT, parser: (a: A) => Kind2) => DecoderT +``` + +Added in v2.2.7 + ## partial **Signature** @@ -124,9 +137,9 @@ Added in v2.2.7 **Signature** ```ts -export declare function refinement( +export declare const refinement: ( M: MonadThrow2C & Bifunctor2 -): ( +) => ( from: DecoderT, refinement: (a: A) => a is B, onError: (u: unknown) => E diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 58330e3dc..f265ff747 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -21,6 +21,7 @@ Added in v2.2.7 - [intersection](#intersection) - [lazy](#lazy) - [nullable](#nullable) + - [parse](#parse) - [partial](#partial) - [record](#record) - [refinement](#refinement) @@ -119,6 +120,19 @@ export declare const nullable: (or: TaskDecoder) => TaskDecoder Added in v2.2.7 +## parse + +**Signature** + +```ts +export declare const parse: ( + from: TaskDecoder, + parser: (a: A) => TE.TaskEither>, B> +) => TaskDecoder +``` + +Added in v2.2.7 + ## partial **Signature** diff --git a/src/Decoder.ts b/src/Decoder.ts index 3e3343d07..e12338f74 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -191,18 +191,14 @@ export function refinement( * @category combinators * @since 2.2.0 */ -export function parse(from: Decoder, parser: (a: A) => Either): Decoder { +export function parse(from: Decoder, parser: (a: A) => Either): Decoder { return { decode: (u) => { const e = from.decode(u) if (E.isLeft(e)) { return e } - const pe = parser(e.right) - if (E.isLeft(pe)) { - return failure(pe.left) - } - return pe + return parser(e.right) } } } diff --git a/src/Decoder2.ts b/src/Decoder2.ts index b1a6f2d0d..f2f28f3be 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -134,6 +134,12 @@ export const refinement = ( expected: string ): Decoder => refinementM(from, refinement, (u) => FS.of(DE.leaf(u, expected))) +/** + * @category combinators + * @since 2.2.7 + */ +export const parse: (from: Decoder, parser: (a: A) => E.Either) => Decoder = DT.parse(M) + /** * @category combinators * @since 2.2.7 diff --git a/src/DecoderT.ts b/src/DecoderT.ts index ea09cd334..5f06c80e0 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -72,17 +72,24 @@ export const withExpected = (M: Monad2C & Bifunctor2( - M: MonadThrow2C & Bifunctor2 -): ( +export const refinement = (M: MonadThrow2C & Bifunctor2) => ( from: DecoderT, refinement: (a: A) => a is B, onError: (u: unknown) => E -) => DecoderT { - return (from, refinement, onError) => ({ - decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(u)))) - }) -} +): DecoderT => ({ + decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(u)))) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const parse = (M: MonadThrow2C & Bifunctor2) => ( + from: DecoderT, + parser: (a: A) => Kind2 +): DecoderT => ({ + decode: (u) => M.chain(from.decode(u), (a) => parser(a)) +}) /** * @category combinators diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 1044a1802..c02e5c947 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -126,6 +126,15 @@ export const withExpected: ( expected: (actual: unknown, e: DecodeError) => DecodeError ) => TaskDecoder = DT.withExpected(M) +/** + * @category combinators + * @since 2.2.7 + */ +export const parse: ( + from: TaskDecoder, + parser: (a: A) => TE.TaskEither +) => TaskDecoder = DT.parse(M) + /** * @category combinators * @since 2.2.7 diff --git a/test/Codec.ts b/test/Codec.ts index 08652da5d..8b8a27f74 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -8,7 +8,7 @@ import { pipe } from 'fp-ts/lib/pipeable' const NumberFromString: C.Codec = C.make( D.parse(D.string, (s) => { const n = parseFloat(s) - return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`) : right(n) + return isNaN(n) ? left([D.tree(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`)]) : right(n) }), { encode: String } ) diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 3e3949241..1f38cb212 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -11,16 +11,10 @@ const undefinedGuard: G.Guard = { } const undef: D.Decoder = D.fromGuard(undefinedGuard, 'undefined') -const NumberFromString: D.Decoder = { - decode: (u) => - pipe( - D.string.decode(u), - E.chain((s) => { - const n = parseFloat(s) - return isNaN(n) ? D.failure(u, 'parsable to a number') : D.success(n) - }) - ) -} +const NumberFromString: D.Decoder = D.parse(D.string, (s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) +}) interface PositiveBrand { readonly Positive: unique symbol diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 51de4eacf..c5747d260 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -12,16 +12,10 @@ const undefinedGuard: G.Guard = { } const undef: D.TaskDecoder = D.fromGuard(undefinedGuard, 'undefined') -const NumberFromString: D.TaskDecoder = { - decode: (u) => - pipe( - D.string.decode(u), - TE.chain((s) => { - const n = parseFloat(s) - return isNaN(n) ? D.failure(u, 'parsable to a number') : D.success(n) - }) - ) -} +const NumberFromString: D.TaskDecoder = D.parse(D.string, (s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) +}) interface PositiveBrand { readonly Positive: unique symbol From c1b5afffee5d80c699b0e4afabf3a0c37dd162c7 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 08:43:43 +0200 Subject: [PATCH 066/222] add instances --- docs/modules/Decoder.ts.md | 11 --- docs/modules/Decoder2.ts.md | 100 +++++++++++++++++++++++ docs/modules/TaskDecoder.ts.md | 100 +++++++++++++++++++++++ src/Decoder.ts | 44 +++++------ src/Decoder2.ts | 120 +++++++++++++++++++++++++++- src/TaskDecoder.ts | 140 ++++++++++++++++++++++++++++++--- test/Decoder2.ts | 25 ++++++ test/TaskDecoder.ts | 25 ++++++ 8 files changed, 511 insertions(+), 54 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 3e91a7711..6ec284197 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -57,7 +57,6 @@ Added in v2.2.0 - [utils](#utils) - [TypeOf (type alias)](#typeof-type-alias) - [draw](#draw) - - [toForest](#toforest) --- @@ -458,13 +457,3 @@ export declare const draw: (e: DecodeError) => string ``` Added in v2.2.7 - -## toForest - -**Signature** - -```ts -export declare const toForest: (e: DecodeError) => NonEmptyArray> -``` - -Added in v2.2.7 diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index 9854eaac8..083f54267 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -12,10 +12,14 @@ Added in v2.2.7

Table of contents

+- [Alt](#alt) + - [alt](#alt) - [DecodeError](#decodeerror) - [DecodeError (type alias)](#decodeerror-type-alias) - [failure](#failure) - [success](#success) +- [Functor](#functor) + - [map](#map) - [combinators](#combinators) - [array](#array) - [intersection](#intersection) @@ -33,6 +37,12 @@ Added in v2.2.7 - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [altDecoder](#altdecoder) + - [functorDecoder](#functordecoder) + - [schemableDecoder](#schemabledecoder) - [model](#model) - [Decoder (interface)](#decoder-interface) - [primitives](#primitives) @@ -43,9 +53,22 @@ Added in v2.2.7 - [string](#string) - [utils](#utils) - [draw](#draw) + - [stringify](#stringify) --- +# Alt + +## alt + +**Signature** + +```ts +export declare const alt:
(that: () => Decoder) => (me: Decoder) => Decoder +``` + +Added in v2.2.7 + # DecodeError ## DecodeError (type alias) @@ -78,6 +101,18 @@ export declare function success(a: A): E.Either Added in v2.2.7 +# Functor + +## map + +**Signature** + +```ts +export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder +``` + +Added in v2.2.7 + # combinators ## array @@ -250,6 +285,61 @@ export declare const literal: (...va Added in v2.2.7 +# instances + +## URI + +**Signature** + +```ts +export declare const URI: 'io-ts/Decoder2' +``` + +Added in v2.2.7 + +## URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.7 + +## altDecoder + +**Signature** + +```ts +export declare const altDecoder: Alt1<'io-ts/Decoder2'> +``` + +Added in v2.2.7 + +## functorDecoder + +**Signature** + +```ts +export declare const functorDecoder: Functor1<'io-ts/Decoder2'> +``` + +Added in v2.2.7 + +## schemableDecoder + +**Signature** + +```ts +export declare const schemableDecoder: Schemable1<'io-ts/Decoder2'> & + WithUnknownContainers1<'io-ts/Decoder2'> & + WithUnion1<'io-ts/Decoder2'> & + WithRefinement1<'io-ts/Decoder2'> +``` + +Added in v2.2.7 + # model ## Decoder (interface) @@ -327,3 +417,13 @@ export declare const draw: (e: FS.FreeSemigroup>) => stri ``` Added in v2.2.7 + +## stringify + +**Signature** + +```ts +export declare const stringify: (e: E.Either>, A>) => string +``` + +Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index f265ff747..bef216a6b 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -12,10 +12,14 @@ Added in v2.2.7

Table of contents

+- [Alt](#alt) + - [alt](#alt) - [DecodeError](#decodeerror) - [DecodeError (type alias)](#decodeerror-type-alias) - [failure](#failure) - [success](#success) +- [Functor](#functor) + - [map](#map) - [combinators](#combinators) - [array](#array) - [intersection](#intersection) @@ -33,6 +37,12 @@ Added in v2.2.7 - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) +- [instances](#instances) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) + - [altDecoder](#altdecoder) + - [functorDecoder](#functordecoder) + - [schemableTaskDecoder](#schemabletaskdecoder) - [model](#model) - [TaskDecoder (interface)](#taskdecoder-interface) - [primitives](#primitives) @@ -43,9 +53,22 @@ Added in v2.2.7 - [string](#string) - [utils](#utils) - [draw](#draw) + - [stringify](#stringify) --- +# Alt + +## alt + +**Signature** + +```ts +export declare const alt:
(that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + # DecodeError ## DecodeError (type alias) @@ -78,6 +101,18 @@ export declare function success(a: A): TE.TaskEither Added in v2.2.7 +# Functor + +## map + +**Signature** + +```ts +export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + # combinators ## array @@ -252,6 +287,61 @@ export declare const literal: (...va Added in v2.2.7 +# instances + +## URI + +**Signature** + +```ts +export declare const URI: 'io-ts/TaskDecoder' +``` + +Added in v2.2.7 + +## URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.7 + +## altDecoder + +**Signature** + +```ts +export declare const altDecoder: Alt1<'io-ts/TaskDecoder'> +``` + +Added in v2.2.7 + +## functorDecoder + +**Signature** + +```ts +export declare const functorDecoder: Functor1<'io-ts/TaskDecoder'> +``` + +Added in v2.2.7 + +## schemableTaskDecoder + +**Signature** + +```ts +export declare const schemableTaskDecoder: Schemable1<'io-ts/TaskDecoder'> & + WithUnknownContainers1<'io-ts/TaskDecoder'> & + WithUnion1<'io-ts/TaskDecoder'> & + WithRefinement1<'io-ts/TaskDecoder'> +``` + +Added in v2.2.7 + # model ## TaskDecoder (interface) @@ -329,3 +419,13 @@ export declare const draw: (e: FS.FreeSemigroup>) => stri ``` Added in v2.2.7 + +## stringify + +**Signature** + +```ts +export declare const stringify: (e: TE.TaskEither>, A>) => T.Task +``` + +Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index e12338f74..454cdcb8c 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -471,15 +471,9 @@ export function union]>( } // ------------------------------------------------------------------------------------- -// pipeables +// non-pipeables // ------------------------------------------------------------------------------------- -/** - * @category Functor - * @since 2.2.0 - */ -export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) - const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ decode: (u) => { const e = fa.decode(u) @@ -487,12 +481,6 @@ const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ } }) -/** - * @category Alt - * @since 2.2.0 - */ -export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) - const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) => ({ decode: (u) => { const e = fx.decode(u) @@ -500,6 +488,22 @@ const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) = } }) +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @category Functor + * @since 2.2.0 + */ +export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) + +/** + * @category Alt + * @since 2.2.0 + */ +export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -573,20 +577,8 @@ export const schemableDecoder: Schemable1 & // utils // ------------------------------------------------------------------------------------- -/** - * @since 2.2.7 - */ -export const toForest = (e: DecodeError): NonEmptyArray> => { +const toForest = (e: DecodeError): NonEmptyArray> => { return e - // const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ - // Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - // Required: (key, errors) => T.make(`required property ${JSON.stringify(key)}`, toForest(errors)) - // }) - // const toForest: (f: FS.FreeSemigroup>) => NEA.NonEmptyArray> = FS.fold( - // (value) => [toTree(value)], - // (left, right) => NEA.concat(toForest(left), toForest(right)) - // ) - // return toForest(s) } /** diff --git a/src/Decoder2.ts b/src/Decoder2.ts index f2f28f3be..19b034791 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -1,14 +1,17 @@ /** * @since 2.2.7 */ +import { Alt1 } from 'fp-ts/lib/Alt' import * as E from 'fp-ts/lib/Either' +import { Functor1 } from 'fp-ts/lib/Functor' +import * as NEA from 'fp-ts/lib/NonEmptyArray' +import { pipe } from 'fp-ts/lib/pipeable' +import * as T from 'fp-ts/lib/Tree' +import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as DT from './DecoderT' -import * as FS from '../src/FreeSemigroup' import * as G from './Guard' -import * as NEA from 'fp-ts/lib/NonEmptyArray' -import * as T from 'fp-ts/lib/Tree' -import { Literal } from './Schemable' +import { Literal, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // config @@ -228,6 +231,107 @@ export const sum: ( */ export const lazy: (id: string, f: () => Decoder) => Decoder = DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ + decode: (u) => pipe(fa.decode(u), E.map(f)) +}) + +const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, that) => ({ + decode: (u) => + pipe( + me.decode(u), + E.alt(() => that().decode(u)) + ) +}) + +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @category Functor + * @since 2.2.7 + */ +export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) + +/** + * @category Alt + * @since 2.2.7 + */ +export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @category instances + * @since 2.2.7 + */ +export const URI = 'io-ts/Decoder2' + +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: Decoder + } +} + +/** + * @category instances + * @since 2.2.7 + */ +export const functorDecoder: Functor1 = { + URI, + map: map_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const altDecoder: Alt1 = { + URI, + map: map_, + alt: alt_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const schemableDecoder: Schemable1 & + WithUnknownContainers1 & + WithUnion1 & + WithRefinement1 = { + URI, + literal, + string, + number, + boolean, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable1['tuple'], + intersection, + sum, + lazy, + UnknownArray, + UnknownRecord, + union: union as WithUnion1['union'], + refinement: refinement as WithRefinement1['refinement'] +} + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- @@ -251,3 +355,11 @@ const toForest = (e: DecodeError): NEA.NonEmptyArray> => { * @since 2.2.7 */ export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') + +/** + * @since 2.2.7 + */ +export const stringify: (e: E.Either) => string = E.fold( + (e) => draw(e), + (a) => JSON.stringify(a, null, 2) +) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index c02e5c947..4344b6407 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -1,14 +1,18 @@ /** * @since 2.2.7 */ +import { Alt1 } from 'fp-ts/lib/Alt' +import { Functor1 } from 'fp-ts/lib/Functor' +import * as NEA from 'fp-ts/lib/NonEmptyArray' +import { pipe } from 'fp-ts/lib/pipeable' +import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' +import { drawTree, make, Tree } from 'fp-ts/lib/Tree' +import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as DT from './DecoderT' -import * as FS from '../src/FreeSemigroup' import * as G from './Guard' -import * as NEA from 'fp-ts/lib/NonEmptyArray' -import * as T from 'fp-ts/lib/Tree' -import { Literal } from './Schemable' +import { Literal, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // config @@ -238,19 +242,121 @@ export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = FS.of(DE.lazy(id, e)) ) +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const map_: (fa: TaskDecoder, f: (a: A) => B) => TaskDecoder = (fa, f) => ({ + decode: (u) => pipe(fa.decode(u), TE.map(f)) +}) + +const alt_: (me: TaskDecoder, that: () => TaskDecoder) => TaskDecoder = (me, that) => ({ + decode: (u) => + pipe( + me.decode(u), + TE.alt(() => that().decode(u)) + ) +}) + +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @category Functor + * @since 2.2.7 + */ +export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = (f) => (fa) => map_(fa, f) + +/** + * @category Alt + * @since 2.2.7 + */ +export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = (that) => (fa) => + alt_(fa, that) + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @category instances + * @since 2.2.7 + */ +export const URI = 'io-ts/TaskDecoder' + +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: TaskDecoder + } +} + +/** + * @category instances + * @since 2.2.7 + */ +export const functorDecoder: Functor1 = { + URI, + map: map_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const altDecoder: Alt1 = { + URI, + map: map_, + alt: alt_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const schemableTaskDecoder: Schemable1 & + WithUnknownContainers1 & + WithUnion1 & + WithRefinement1 = { + URI, + literal, + string, + number, + boolean, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable1['tuple'], + intersection, + sum, + lazy, + UnknownArray, + UnknownRecord, + union: union as WithUnion1['union'], + refinement: refinement as WithRefinement1['refinement'] +} + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- -const toForest = (e: DecodeError): NEA.NonEmptyArray> => { - const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ - Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => T.make(`member ${index}`, toForest(errors)), - Lazy: (id, errors) => T.make(`lazy type ${id}`, toForest(errors)) +const toForest = (e: DecodeError): NEA.NonEmptyArray> => { + const toTree: (e: DE.DecodeError) => Tree = DE.fold({ + Leaf: (input, error) => make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), + Member: (index, errors) => make(`member ${index}`, toForest(errors)), + Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) }) - const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( + const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( (value) => [toTree(value)], (left, right) => NEA.concat(toForest(left), toForest(right)) ) @@ -260,4 +366,12 @@ const toForest = (e: DecodeError): NEA.NonEmptyArray> => { /** * @since 2.2.7 */ -export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') +export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') + +/** + * @since 2.2.7 + */ +export const stringify: (e: TE.TaskEither) => T.Task = TE.fold( + (e) => T.of(draw(e)), + (a) => T.of(JSON.stringify(a, null, 2)) +) diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 1f38cb212..221547cca 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -29,6 +29,26 @@ type Int = number & IntBrand const Int: D.Decoder = D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') describe('Decoder', () => { + // ------------------------------------------------------------------------------------- + // pipeables + // ------------------------------------------------------------------------------------- + it('map', () => { + const decoder = pipe( + D.string, + D.map((s) => s + '!') + ) + assert.deepStrictEqual(decoder.decode('a'), E.right('a!')) + }) + + it('alt', () => { + const decoder = pipe( + D.string, + D.alt(() => D.number) + ) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode(1), E.right(1)) + }) + // ------------------------------------------------------------------------------------- // primitives // ------------------------------------------------------------------------------------- @@ -521,4 +541,9 @@ required property "d" ) }) }) + + it('stringify', () => { + assert.deepStrictEqual(D.stringify(D.string.decode('a')), '"a"') + assert.deepStrictEqual(D.stringify(D.string.decode(null)), 'cannot decode null, should be string') + }) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index c5747d260..9cf1d04fa 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -30,6 +30,26 @@ type Int = number & IntBrand const Int: D.TaskDecoder = D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') describe('TaskDecoder', () => { + // ------------------------------------------------------------------------------------- + // pipeables + // ------------------------------------------------------------------------------------- + it('map', async () => { + const decoder = pipe( + D.string, + D.map((s) => s + '!') + ) + assert.deepStrictEqual(await decoder.decode('a')(), E.right('a!')) + }) + + it('alt', async () => { + const decoder = pipe( + D.string, + D.alt(() => D.number) + ) + assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) + assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) + }) + // ------------------------------------------------------------------------------------- // primitives // ------------------------------------------------------------------------------------- @@ -540,4 +560,9 @@ required property "d" ) }) }) + + it('stringify', async () => { + assert.deepStrictEqual(await D.stringify(D.string.decode('a'))(), '"a"') + assert.deepStrictEqual(await D.stringify(D.string.decode(null))(), 'cannot decode null, should be string') + }) }) From 2f306a9242c742bd7ef61a24dfb6d4750224bded Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 08:50:28 +0200 Subject: [PATCH 067/222] TaskDecoder: add fromDecoder --- docs/modules/TaskDecoder.ts.md | 11 +++ src/TaskDecoder.ts | 19 ++-- test/Decoder2.ts | 167 ++++++++++++++++---------------- test/TaskDecoder.ts | 170 +++++++++++++++++---------------- 4 files changed, 197 insertions(+), 170 deletions(-) diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index bef216a6b..d5e755bef 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -35,6 +35,7 @@ Added in v2.2.7 - [union](#union) - [withExpected](#withexpected) - [constructors](#constructors) + - [fromDecoder](#fromdecoder) - [fromGuard](#fromguard) - [literal](#literal) - [instances](#instances) @@ -267,6 +268,16 @@ Added in v2.2.7 # constructors +## fromDecoder + +**Signature** + +```ts +export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder +``` + +Added in v2.2.7 + ## fromGuard **Signature** diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 4344b6407..b7818a7bd 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -12,6 +12,7 @@ import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as DT from './DecoderT' import * as G from './Guard' +import * as D from './Decoder2' import { Literal, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -67,7 +68,13 @@ export function failure(actual: unknown, message: string): TE.TaskEit // constructors // ------------------------------------------------------------------------------------- -// TODO: add fromDecoder: (decoder: D.Decoder) => TaskDecoder +/** + * @category constructors + * @since 2.2.7 + */ +export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ + decode: TE.fromEitherK(decoder.decode) +}) /** * @category constructors @@ -91,31 +98,31 @@ export const literal = ]>(...valu * @category primitives * @since 2.2.7 */ -export const string: TaskDecoder = fromGuard(G.string, 'string') +export const string: TaskDecoder = fromDecoder(D.string) /** * @category primitives * @since 2.2.7 */ -export const number: TaskDecoder = fromGuard(G.number, 'number') +export const number: TaskDecoder = fromDecoder(D.number) /** * @category primitives * @since 2.2.7 */ -export const boolean: TaskDecoder = fromGuard(G.boolean, 'boolean') +export const boolean: TaskDecoder = fromDecoder(D.boolean) /** * @category primitives * @since 2.2.7 */ -export const UnknownArray: TaskDecoder> = fromGuard(G.UnknownArray, 'Array') +export const UnknownArray: TaskDecoder> = fromDecoder(D.UnknownArray) /** * @category primitives * @since 2.2.7 */ -export const UnknownRecord: TaskDecoder> = fromGuard(G.UnknownRecord, 'Record') +export const UnknownRecord: TaskDecoder> = fromDecoder(D.UnknownRecord) // ------------------------------------------------------------------------------------- // combinators diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 221547cca..75e4b6a19 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -84,14 +84,14 @@ describe('Decoder', () => { describe('literal', () => { it('should decode a valid input', async () => { - const codec = D.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(codec.decode('a'), E.right('a')) - assert.deepStrictEqual(codec.decode(null), E.right(null)) + const decoder = D.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode(null), E.right(null)) }) it('should reject an invalid input', async () => { - const codec = D.literal('a', null) - assert.deepStrictEqual(codec.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) + const decoder = D.literal('a', null) + assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) }) }) @@ -106,15 +106,15 @@ describe('Decoder', () => { describe('nullable', () => { it('should decode a valid input', () => { - const codec = D.nullable(NumberFromString) - assert.deepStrictEqual(codec.decode(null), E.right(null)) - assert.deepStrictEqual(codec.decode('1'), E.right(1)) + const decoder = D.nullable(NumberFromString) + assert.deepStrictEqual(decoder.decode(null), E.right(null)) + assert.deepStrictEqual(decoder.decode('1'), E.right(1)) }) it('should reject an invalid input', () => { - const codec = D.nullable(NumberFromString) + const decoder = D.nullable(NumberFromString) assert.deepStrictEqual( - codec.decode(undefined), + decoder.decode(undefined), E.left( FS.concat( FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), @@ -123,7 +123,7 @@ describe('Decoder', () => { ) ) assert.deepStrictEqual( - codec.decode('a'), + decoder.decode('a'), E.left( FS.concat( FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), @@ -136,44 +136,44 @@ describe('Decoder', () => { describe('type', () => { it('should decode a valid input', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), E.right({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) }) it('should strip additional fields', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', async () => { - const codec = D.type({ + const decoder = D.type({ a: undef }) - assert.deepStrictEqual(codec.decode({}), E.right({ a: undefined })) + assert.deepStrictEqual(decoder.decode({}), E.right({ a: undefined })) }) it('should reject an invalid input', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string }) - assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( - codec.decode({ a: 1 }), + decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) it('should collect all errors', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string, b: D.number }) assert.deepStrictEqual( - codec.decode({}), + decoder.decode({}), E.left( FS.concat( FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), @@ -192,49 +192,49 @@ describe('Decoder', () => { return 'b' } } - const codec = D.type({ a: D.string, b: D.string }) - assert.deepStrictEqual(codec.decode(new A()), E.right({ a: 'a', b: 'b' })) + const decoder = D.type({ a: D.string, b: D.string }) + assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) }) }) describe('partial', () => { it('should decode a valid input', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), E.right({ a: 'a' })) - assert.deepStrictEqual(codec.decode({}), E.right({})) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({}), E.right({})) }) it('should strip additional fields', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) }) it('should not add missing fields', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(codec.decode({}), E.right({})) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({}), E.right({})) }) it('should not strip fields corresponding to undefined values', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(codec.decode({ a: undefined }), E.right({ a: undefined })) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({ a: undefined }), E.right({ a: undefined })) }) it('should reject an invalid input', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( - codec.decode({ a: 1 }), + decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) ) }) it('should collect all errors', async () => { - const codec = D.partial({ + const decoder = D.partial({ a: D.string, b: D.number }) assert.deepStrictEqual( - codec.decode({ a: 1, b: 'b' }), + decoder.decode({ a: 1, b: 'b' }), E.left( FS.concat( FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), @@ -253,28 +253,28 @@ describe('Decoder', () => { return 'b' } } - const codec = D.partial({ a: D.string, b: D.string }) - assert.deepStrictEqual(codec.decode(new A()), E.right({ a: 'a', b: 'b' })) + const decoder = D.partial({ a: D.string, b: D.string }) + assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) }) }) describe('array', () => { it('should decode a valid input', async () => { - const codec = D.array(D.string) - assert.deepStrictEqual(codec.decode([]), E.right([])) - assert.deepStrictEqual(codec.decode(['a']), E.right(['a'])) + const decoder = D.array(D.string) + assert.deepStrictEqual(decoder.decode([]), E.right([])) + assert.deepStrictEqual(decoder.decode(['a']), E.right(['a'])) }) it('should reject an invalid input', async () => { - const codec = D.array(D.string) - assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual(codec.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) + const decoder = D.array(D.string) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) }) it('should collect all errors', async () => { - const codec = D.array(D.string) + const decoder = D.array(D.string) assert.deepStrictEqual( - codec.decode([1, 2]), + decoder.decode([1, 2]), E.left( FS.concat( FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), @@ -287,24 +287,24 @@ describe('Decoder', () => { describe('record', () => { it('should decode a valid value', async () => { - const codec = D.record(D.number) - assert.deepStrictEqual(codec.decode({}), E.right({})) - assert.deepStrictEqual(codec.decode({ a: 1 }), E.right({ a: 1 })) + const decoder = D.record(D.number) + assert.deepStrictEqual(decoder.decode({}), E.right({})) + assert.deepStrictEqual(decoder.decode({ a: 1 }), E.right({ a: 1 })) }) it('should reject an invalid value', async () => { - const codec = D.record(D.number) - assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + const decoder = D.record(D.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( - codec.decode({ a: 'a' }), + decoder.decode({ a: 'a' }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) ) }) it('should collect all errors', async () => { - const codec = D.record(D.number) + const decoder = D.record(D.number) assert.deepStrictEqual( - codec.decode({ a: 'a', b: 'b' }), + decoder.decode({ a: 'a', b: 'b' }), E.left( FS.concat( FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), @@ -317,8 +317,8 @@ describe('Decoder', () => { describe('tuple', () => { it('should decode a valid input', async () => { - const codec = D.tuple(D.string, D.number) - assert.deepStrictEqual(codec.decode(['a', 1]), E.right(['a', 1])) + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(decoder.decode(['a', 1]), E.right(['a', 1])) }) it('should handle zero components', async () => { @@ -326,19 +326,22 @@ describe('Decoder', () => { }) it('should reject an invalid input', async () => { - const codec = D.tuple(D.string, D.number) - assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) assert.deepStrictEqual( - codec.decode(['a']), + decoder.decode(['a']), E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) ) - assert.deepStrictEqual(codec.decode([1, 2]), E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))))) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) + ) }) it('should collect all errors', async () => { - const codec = D.tuple(D.string, D.number) + const decoder = D.tuple(D.string, D.number) assert.deepStrictEqual( - codec.decode([1, 'a']), + decoder.decode([1, 'a']), E.left( FS.concat( FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), @@ -349,8 +352,8 @@ describe('Decoder', () => { }) it('should strip additional components', async () => { - const codec = D.tuple(D.string, D.number) - assert.deepStrictEqual(codec.decode(['a', 1, true]), E.right(['a', 1])) + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(decoder.decode(['a', 1, true]), E.right(['a', 1])) }) }) @@ -378,26 +381,26 @@ describe('Decoder', () => { describe('refinement', () => { it('should decode a valid input', () => { - const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') - assert.deepStrictEqual(codec.decode('a'), E.right('a')) + const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) }) it('should reject an invalid input', () => { - const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') - assert.deepStrictEqual(codec.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) - assert.deepStrictEqual(codec.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) + const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) }) }) describe('intersection', () => { it('should decode a valid input', () => { - const codec = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), E.right({ a: 'a', b: 1 })) + const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a', b: 1 })) }) it('should handle primitives', () => { - const codec = D.intersection(Int, Positive) - assert.deepStrictEqual(codec.decode(1), E.right(1)) + const decoder = D.intersection(Int, Positive) + assert.deepStrictEqual(decoder.decode(1), E.right(1)) }) it('should accumulate all errors', () => { @@ -428,22 +431,22 @@ describe('Decoder', () => { it('should decode a valid input', () => { const A = D.type({ _tag: D.literal('A'), a: D.string }) const B = D.type({ _tag: D.literal('B'), b: D.number }) - const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), E.right({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), E.right({ _tag: 'B', b: 1 })) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), E.right({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), E.right({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { const A = D.type({ _tag: D.literal('A'), a: D.string }) const B = D.type({ _tag: D.literal('B'), b: D.number }) - const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) assert.deepStrictEqual( - codec.decode({}), + decoder.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) ) assert.deepStrictEqual( - codec.decode({ _tag: 'A', a: 1 }), + decoder.decode({ _tag: 'A', a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 9cf1d04fa..d8b879fa0 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -86,16 +86,22 @@ describe('TaskDecoder', () => { // constructors // ------------------------------------------------------------------------------------- + it('fromGuard', async () => { + const decoder = D.fromGuard(G.string, 'string') + assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) + assert.deepStrictEqual(await decoder.decode(null)(), E.left(FS.of(DE.leaf(null, 'string')))) + }) + describe('literal', () => { it('should decode a valid input', async () => { - const codec = D.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(await codec.decode('a')(), E.right('a')) - assert.deepStrictEqual(await codec.decode(null)(), E.right(null)) + const decoder = D.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) + assert.deepStrictEqual(await decoder.decode(null)(), E.right(null)) }) it('should reject an invalid input', async () => { - const codec = D.literal('a', null) - assert.deepStrictEqual(await codec.decode('b')(), E.left(FS.of(DE.leaf('b', '"a" | null')))) + const decoder = D.literal('a', null) + assert.deepStrictEqual(await decoder.decode('b')(), E.left(FS.of(DE.leaf('b', '"a" | null')))) }) }) @@ -110,15 +116,15 @@ describe('TaskDecoder', () => { describe('nullable', () => { it('should decode a valid input', async () => { - const codec = D.nullable(NumberFromString) - assert.deepStrictEqual(await codec.decode(null)(), E.right(null)) - assert.deepStrictEqual(await codec.decode('1')(), E.right(1)) + const decoder = D.nullable(NumberFromString) + assert.deepStrictEqual(await decoder.decode(null)(), E.right(null)) + assert.deepStrictEqual(await decoder.decode('1')(), E.right(1)) }) it('should reject an invalid input', async () => { - const codec = D.nullable(NumberFromString) + const decoder = D.nullable(NumberFromString) assert.deepStrictEqual( - await codec.decode(undefined)(), + await decoder.decode(undefined)(), E.left( FS.concat( FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), @@ -127,7 +133,7 @@ describe('TaskDecoder', () => { ) ) assert.deepStrictEqual( - await codec.decode('a')(), + await decoder.decode('a')(), E.left( FS.concat( FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), @@ -140,47 +146,47 @@ describe('TaskDecoder', () => { describe('type', () => { it('should decode a valid input', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string }) - assert.deepStrictEqual(await codec.decode({ a: 'a' })(), E.right({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), E.right({ a: 'a' })) }) it('should strip additional fields', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string }) - assert.deepStrictEqual(await codec.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', async () => { - const codec = D.type({ + const decoder = D.type({ a: undef }) - assert.deepStrictEqual(await codec.decode({})(), E.right({ a: undefined })) + assert.deepStrictEqual(await decoder.decode({})(), E.right({ a: undefined })) }) it('should reject an invalid input', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string }) assert.deepStrictEqual( - await codec.decode(undefined)(), + await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Record'))) ) assert.deepStrictEqual( - await codec.decode({ a: 1 })(), + await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) it('should collect all errors', async () => { - const codec = D.type({ + const decoder = D.type({ a: D.string, b: D.number }) assert.deepStrictEqual( - await codec.decode({})(), + await decoder.decode({})(), E.left( FS.concat( FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), @@ -199,52 +205,52 @@ describe('TaskDecoder', () => { return 'b' } } - const codec = D.type({ a: D.string, b: D.string }) - assert.deepStrictEqual(await codec.decode(new A())(), E.right({ a: 'a', b: 'b' })) + const decoder = D.type({ a: D.string, b: D.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), E.right({ a: 'a', b: 'b' })) }) }) describe('partial', () => { it('should decode a valid input', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(await codec.decode({ a: 'a' })(), E.right({ a: 'a' })) - assert.deepStrictEqual(await codec.decode({})(), E.right({})) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), E.right({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({})(), E.right({})) }) it('should strip additional fields', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(await codec.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) }) it('should not add missing fields', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(await codec.decode({})(), E.right({})) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(await decoder.decode({})(), E.right({})) }) it('should not strip fields corresponding to undefined values', async () => { - const codec = D.partial({ a: D.string }) - assert.deepStrictEqual(await codec.decode({ a: undefined })(), E.right({ a: undefined })) + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(await decoder.decode({ a: undefined })(), E.right({ a: undefined })) }) it('should reject an invalid input', async () => { - const codec = D.partial({ a: D.string }) + const decoder = D.partial({ a: D.string }) assert.deepStrictEqual( - await codec.decode(undefined)(), + await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Record'))) ) assert.deepStrictEqual( - await codec.decode({ a: 1 })(), + await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) ) }) it('should collect all errors', async () => { - const codec = D.partial({ + const decoder = D.partial({ a: D.string, b: D.number }) assert.deepStrictEqual( - await codec.decode({ a: 1, b: 'b' })(), + await decoder.decode({ a: 1, b: 'b' })(), E.left( FS.concat( FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), @@ -263,31 +269,31 @@ describe('TaskDecoder', () => { return 'b' } } - const codec = D.partial({ a: D.string, b: D.string }) - assert.deepStrictEqual(await codec.decode(new A())(), E.right({ a: 'a', b: 'b' })) + const decoder = D.partial({ a: D.string, b: D.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), E.right({ a: 'a', b: 'b' })) }) }) describe('array', () => { it('should decode a valid input', async () => { - const codec = D.array(D.string) - assert.deepStrictEqual(await codec.decode([])(), E.right([])) - assert.deepStrictEqual(await codec.decode(['a'])(), E.right(['a'])) + const decoder = D.array(D.string) + assert.deepStrictEqual(await decoder.decode([])(), E.right([])) + assert.deepStrictEqual(await decoder.decode(['a'])(), E.right(['a'])) }) it('should reject an invalid input', async () => { - const codec = D.array(D.string) - assert.deepStrictEqual(await codec.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) + const decoder = D.array(D.string) + assert.deepStrictEqual(await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) assert.deepStrictEqual( - await codec.decode([1])(), + await decoder.decode([1])(), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string'))))) ) }) it('should collect all errors', async () => { - const codec = D.array(D.string) + const decoder = D.array(D.string) assert.deepStrictEqual( - await codec.decode([1, 2])(), + await decoder.decode([1, 2])(), E.left( FS.concat( FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), @@ -300,27 +306,27 @@ describe('TaskDecoder', () => { describe('record', () => { it('should decode a valid value', async () => { - const codec = D.record(D.number) - assert.deepStrictEqual(await codec.decode({})(), E.right({})) - assert.deepStrictEqual(await codec.decode({ a: 1 })(), E.right({ a: 1 })) + const decoder = D.record(D.number) + assert.deepStrictEqual(await decoder.decode({})(), E.right({})) + assert.deepStrictEqual(await decoder.decode({ a: 1 })(), E.right({ a: 1 })) }) it('should reject an invalid value', async () => { - const codec = D.record(D.number) + const decoder = D.record(D.number) assert.deepStrictEqual( - await codec.decode(undefined)(), + await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Record'))) ) assert.deepStrictEqual( - await codec.decode({ a: 'a' })(), + await decoder.decode({ a: 'a' })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) ) }) it('should collect all errors', async () => { - const codec = D.record(D.number) + const decoder = D.record(D.number) assert.deepStrictEqual( - await codec.decode({ a: 'a', b: 'b' })(), + await decoder.decode({ a: 'a', b: 'b' })(), E.left( FS.concat( FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), @@ -333,8 +339,8 @@ describe('TaskDecoder', () => { describe('tuple', () => { it('should decode a valid input', async () => { - const codec = D.tuple(D.string, D.number) - assert.deepStrictEqual(await codec.decode(['a', 1])(), E.right(['a', 1])) + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(await decoder.decode(['a', 1])(), E.right(['a', 1])) }) it('should handle zero components', async () => { @@ -342,22 +348,22 @@ describe('TaskDecoder', () => { }) it('should reject an invalid input', async () => { - const codec = D.tuple(D.string, D.number) - assert.deepStrictEqual(await codec.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) assert.deepStrictEqual( - await codec.decode(['a'])(), + await decoder.decode(['a'])(), E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) ) assert.deepStrictEqual( - await codec.decode([1, 2])(), + await decoder.decode([1, 2])(), E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) it('should collect all errors', async () => { - const codec = D.tuple(D.string, D.number) + const decoder = D.tuple(D.string, D.number) assert.deepStrictEqual( - await codec.decode([1, 'a'])(), + await decoder.decode([1, 'a'])(), E.left( FS.concat( FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), @@ -368,8 +374,8 @@ describe('TaskDecoder', () => { }) it('should strip additional components', async () => { - const codec = D.tuple(D.string, D.number) - assert.deepStrictEqual(await codec.decode(['a', 1, true])(), E.right(['a', 1])) + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(await decoder.decode(['a', 1, true])(), E.right(['a', 1])) }) }) @@ -397,26 +403,26 @@ describe('TaskDecoder', () => { describe('refinement', () => { it('should decode a valid input', async () => { - const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') - assert.deepStrictEqual(await codec.decode('a')(), E.right('a')) + const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) }) it('should reject an invalid input', async () => { - const codec = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') - assert.deepStrictEqual(await codec.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'string')))) - assert.deepStrictEqual(await codec.decode('')(), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) + const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + assert.deepStrictEqual(await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(await decoder.decode('')(), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) }) }) describe('intersection', () => { it('should decode a valid input', async () => { - const codec = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) - assert.deepStrictEqual(await codec.decode({ a: 'a', b: 1 })(), E.right({ a: 'a', b: 1 })) + const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), E.right({ a: 'a', b: 1 })) }) it('should handle primitives', async () => { - const codec = D.intersection(Int, Positive) - assert.deepStrictEqual(await codec.decode(1)(), E.right(1)) + const decoder = D.intersection(Int, Positive) + assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) }) it('should accumulate all errors', async () => { @@ -447,22 +453,22 @@ describe('TaskDecoder', () => { it('should decode a valid input', async () => { const A = D.type({ _tag: D.literal('A'), a: D.string }) const B = D.type({ _tag: D.literal('B'), b: D.number }) - const codec = sum({ A, B }) - assert.deepStrictEqual(await codec.decode({ _tag: 'A', a: 'a' })(), E.right({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(await codec.decode({ _tag: 'B', b: 1 })(), E.right({ _tag: 'B', b: 1 })) + const decoder = sum({ A, B }) + assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), E.right({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), E.right({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', async () => { const A = D.type({ _tag: D.literal('A'), a: D.string }) const B = D.type({ _tag: D.literal('B'), b: D.number }) - const codec = sum({ A, B }) - assert.deepStrictEqual(await codec.decode(null)(), E.left(FS.of(DE.leaf(null, 'Record')))) + const decoder = sum({ A, B }) + assert.deepStrictEqual(await decoder.decode(null)(), E.left(FS.of(DE.leaf(null, 'Record')))) assert.deepStrictEqual( - await codec.decode({})(), + await decoder.decode({})(), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) ) assert.deepStrictEqual( - await codec.decode({ _tag: 'A', a: 1 })(), + await decoder.decode({ _tag: 'A', a: 1 })(), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) From 3626a74c6102af78aad24f3ef8362661d9d3f269 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 11:55:39 +0200 Subject: [PATCH 068/222] make intersections pipeables --- CHANGELOG.md | 11 ++-- docs/modules/Codec.ts.md | 6 +-- docs/modules/Decoder.ts.md | 6 +-- docs/modules/Decoder2.ts.md | 6 +-- docs/modules/DecoderT.ts.md | 11 ++-- docs/modules/Encoder.ts.md | 6 +-- docs/modules/Eq.ts.md | 6 +-- docs/modules/Guard.ts.md | 36 +++++++------ docs/modules/JsonCodec.ts.md | 6 +-- docs/modules/JsonEncoder.ts.md | 6 +-- docs/modules/Schemable.ts.md | 4 +- docs/modules/TaskDecoder.ts.md | 6 +-- docs/modules/Type.ts.md | 34 +++++++------ dtslint/ts3.5/Encoder.ts | 3 +- dtslint/ts3.5/Schema.ts | 3 +- src/Codec.ts | 6 ++- src/Decoder.ts | 28 +++++------ src/Decoder2.ts | 4 +- src/DecoderT.ts | 9 ++-- src/Encoder.ts | 10 ++-- src/Eq.ts | 10 ++-- src/Guard.ts | 92 ++++++++++++++-------------------- src/JsonCodec.ts | 4 +- src/JsonEncoder.ts | 4 +- src/Schemable.ts | 4 +- src/TaskDecoder.ts | 6 +-- src/Type.ts | 58 ++++++++------------- test/Arbitrary.ts | 9 ++-- test/Codec.ts | 12 ++--- test/Decoder.ts | 24 ++++----- test/Decoder2.ts | 10 ++-- test/DecoderT.ts | 18 +++---- test/Encoder.ts | 4 +- test/Eq.ts | 5 +- test/Guard.ts | 7 +-- test/Schema.ts | 7 +-- test/TaskDecoder.ts | 10 ++-- test/Type.ts | 7 +-- 38 files changed, 230 insertions(+), 268 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2cc79006..5f6c06f41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,15 +21,18 @@ - add `DecoderT` module (@gcanti) - add `FreeSemigroup` module (@gcanti) - add `TaskDecoder` module (@gcanti) - - remove `Tree` module (@gcanti) + - (**bc**) remove `Tree` module (@gcanti) - `Decoder` - - remove `never` (@gcanti) - - change `parse` signature (@gcanti) + - (**bc**) remove `never` (@gcanti) + - (**bc**) change `parse` signature (@gcanti) - `Guard` - - remove `never` (@gcanti) + - (**bc**) remove `never` (@gcanti) - `Schemable` - better `literal` signature (@gcanti) - better `union` signature (@gcanti) + - (**bc**) make intersections pipeables (@gcanti) + +**bc** means "possible breaking change" # 2.2.6 diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index fcd3d6f3a..181d881a0 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -16,7 +16,7 @@ Added in v2.2.3 - [imap](#imap) - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) @@ -72,12 +72,12 @@ export declare function array(items: Codec): Codec, Array(left: Codec, right: Codec): Codec +export declare const intersect: (right: Codec) => (left: Codec) => Codec ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 6ec284197..d346d7a68 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -24,7 +24,7 @@ Added in v2.2.0 - [map](#map) - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [parse](#parse) @@ -148,12 +148,12 @@ export declare function array(items: Decoder): Decoder> Added in v2.2.0 -## intersection +## intersect **Signature** ```ts -export declare function intersection(left: Decoder, right: Decoder): Decoder +export declare const intersect: (right: Decoder) => (left: Decoder) => Decoder ``` Added in v2.2.0 diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index 083f54267..dada5ac68 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -22,7 +22,7 @@ Added in v2.2.7 - [map](#map) - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [parse](#parse) @@ -125,12 +125,12 @@ export declare const array: (items: Decoder) => Decoder Added in v2.2.7 -## intersection +## intersect **Signature** ```ts -export declare const intersection: (left: Decoder, right: Decoder) => Decoder +export declare const intersect: (right: Decoder) => (left: Decoder) => Decoder ``` Added in v2.2.7 diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index b5975c7b9..247adadd9 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -14,7 +14,7 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [parse](#parse) @@ -51,17 +51,14 @@ export declare function array( Added in v2.2.7 -## intersection +## intersect **Signature** ```ts -export declare const intersection: < - M extends 'io-ts/Codec' | 'io-ts/Encoder' | 'Either' | 'IOEither' | 'TaskEither', - E ->( +export declare const intersect: ( M: Apply2C -) => (left: DecoderT, right: DecoderT) => DecoderT +) => (right: DecoderT) => (left: DecoderT) => DecoderT ``` Added in v2.2.7 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index dd049938b..c59dca916 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -18,7 +18,7 @@ Added in v2.2.3 - [compose](#compose) - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) @@ -77,12 +77,12 @@ export declare function array(items: Encoder): Encoder, Arr Added in v2.2.3 -## intersection +## intersect **Signature** ```ts -export declare function intersection(left: Encoder, right: Encoder): Encoder +export declare const intersect: (right: Encoder) => (left: Encoder) => Encoder ``` Added in v2.2.3 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 88a8aaa41..16a64e7a6 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -14,7 +14,7 @@ Added in v2.2.2 - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) @@ -48,12 +48,12 @@ export declare const array: (eq: E.Eq) => E.Eq Added in v2.2.2 -## intersection +## intersect **Signature** ```ts -export declare function intersection(left: Eq, right: Eq): Eq +export declare const intersect: (right: E.Eq) => (left: E.Eq) => E.Eq ``` Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 885af020d..ea72fe335 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -14,7 +14,7 @@ Added in v2.2.0 - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) @@ -50,17 +50,17 @@ Added in v2.2.0 **Signature** ```ts -export declare function array(items: Guard): Guard> +export declare const array: (items: Guard) => Guard ``` Added in v2.2.0 -## intersection +## intersect **Signature** ```ts -export declare function intersection(left: Guard, right: Guard): Guard +export declare const intersect: (right: Guard) => (left: Guard) => Guard ``` Added in v2.2.0 @@ -70,7 +70,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function lazy(f: () => Guard): Guard +export declare const lazy: (f: () => Guard) => Guard ``` Added in v2.2.0 @@ -80,7 +80,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function nullable(or: Guard): Guard +export declare const nullable: (or: Guard) => Guard ``` Added in v2.2.0 @@ -90,9 +90,9 @@ Added in v2.2.0 **Signature** ```ts -export declare function partial( +export declare const partial: ( properties: { [K in keyof A]: Guard } -): Guard> +) => Guard> ``` Added in v2.2.0 @@ -102,7 +102,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function record(codomain: Guard): Guard> +export declare const record: (codomain: Guard) => Guard> ``` Added in v2.2.0 @@ -112,7 +112,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function refinement(from: Guard, refinement: (a: A) => a is B): Guard +export declare const refinement: (from: Guard, refinement: (a: A) => a is B) => Guard ``` Added in v2.2.0 @@ -122,9 +122,9 @@ Added in v2.2.0 **Signature** ```ts -export declare function sum( +export declare const sum: ( tag: T -): (members: { [K in keyof A]: Guard }) => Guard +) => (members: { [K in keyof A]: Guard }) => Guard ``` Added in v2.2.0 @@ -134,9 +134,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function tuple>( - ...components: { [K in keyof A]: Guard } -): Guard +export declare const tuple: (...components: { [K in keyof A]: Guard }) => Guard ``` Added in v2.2.0 @@ -146,7 +144,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> +export declare const type: (properties: { [K in keyof A]: Guard }) => Guard<{ [K in keyof A]: A[K] }> ``` Added in v2.2.0 @@ -156,9 +154,9 @@ Added in v2.2.0 **Signature** ```ts -export declare function union]>( +export declare const union: ( ...members: { [K in keyof A]: Guard } -): Guard +) => Guard ``` Added in v2.2.0 @@ -170,7 +168,7 @@ Added in v2.2.0 **Signature** ```ts -export declare function literal]>(...values: A): Guard +export declare const literal: (...values: A) => Guard ``` Added in v2.2.0 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index f32934d48..ea67eee42 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -16,7 +16,7 @@ Added in v2.2.3 - [imap](#imap) - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) @@ -69,12 +69,12 @@ export declare const array: (items: JsonCodec) => JsonCodec Added in v2.2.3 -## intersection +## intersect **Signature** ```ts -export declare const intersection: (left: JsonCodec, right: JsonCodec) => JsonCodec +export declare const intersect: (right: JsonCodec) => (left: JsonCodec) => JsonCodec ``` Added in v2.2.3 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index f84480379..fbb558882 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -16,7 +16,7 @@ Added in v2.2.3 - [contramap](#contramap) - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) @@ -65,12 +65,12 @@ export declare const array: (items: JsonEncoder) => JsonEncoder Added in v2.2.3 -## intersection +## intersect **Signature** ```ts -export declare const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder +export declare const intersect: (right: JsonEncoder) => (left: JsonEncoder) => JsonEncoder ``` Added in v2.2.3 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index ed496b7ef..3edf81445 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -55,7 +55,7 @@ export interface Schemable { readonly record: (codomain: HKT) => HKT> readonly array: (items: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT - readonly intersection: (left: HKT, right: HKT) => HKT + readonly intersect: (right: HKT) => (left: HKT) => HKT readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT } @@ -80,7 +80,7 @@ export interface Schemable1 { readonly record: (codomain: Kind) => Kind> readonly array: (items: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind - readonly intersection: (left: Kind, right: Kind) => Kind + readonly intersect: (right: Kind) => (left: Kind) => Kind readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind } diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index d5e755bef..4db3f139f 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -22,7 +22,7 @@ Added in v2.2.7 - [map](#map) - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [parse](#parse) @@ -126,12 +126,12 @@ export declare const array: (items: TaskDecoder) => TaskDecoder Added in v2.2.7 -## intersection +## intersect **Signature** ```ts -export declare const intersection: (left: TaskDecoder, right: TaskDecoder) => TaskDecoder +export declare const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 922fa622e..55b45e6c2 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -14,7 +14,7 @@ Added in v2.2.3 - [combinators](#combinators) - [array](#array) - - [intersection](#intersection) + - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) @@ -48,17 +48,17 @@ Added in v2.2.3 **Signature** ```ts -export declare function array(items: Type): Type> +export declare const array: (items: Type) => Type ``` Added in v2.2.3 -## intersection +## intersect **Signature** ```ts -export declare function intersection(left: Type, right: Type): Type +export declare const intersect: (right: Type) => (left: Type) => Type ``` Added in v2.2.3 @@ -68,7 +68,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function lazy(id: string, f: () => Type): Type +export declare const lazy: (id: string, f: () => Type) => Type ``` Added in v2.2.3 @@ -78,7 +78,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function nullable(or: Type): Type +export declare const nullable: (or: Type) => Type ``` Added in v2.2.3 @@ -88,7 +88,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function partial(properties: { [K in keyof A]: Type }): Type> +export declare const partial: (properties: { [K in keyof A]: Type }) => Type> ``` Added in v2.2.3 @@ -98,7 +98,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function record(codomain: Type): Type> +export declare const record: (codomain: Type) => Type> ``` Added in v2.2.3 @@ -108,11 +108,11 @@ Added in v2.2.3 **Signature** ```ts -export declare function refinement( +export declare const refinement: ( from: Type, refinement: (a: A) => a is B, expected: string -): Type +) => Type ``` Added in v2.2.3 @@ -122,7 +122,9 @@ Added in v2.2.3 **Signature** ```ts -export declare function sum(_tag: T): (members: { [K in keyof A]: Type }) => Type +export declare const sum: ( + _tag: T +) => (members: { [K in keyof A]: Type }) => Type ``` Added in v2.2.3 @@ -132,7 +134,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function tuple>(...components: { [K in keyof A]: Type }): Type +export declare const tuple: (...components: { [K in keyof A]: Type }) => Type ``` Added in v2.2.3 @@ -142,7 +144,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> +export declare const type: (properties: { [K in keyof A]: Type }) => Type<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 @@ -152,9 +154,9 @@ Added in v2.2.3 **Signature** ```ts -export declare function union]>( +export declare const union: ( ...members: { [K in keyof A]: Type } -): Type +) => Type ``` Added in v2.2.3 @@ -166,7 +168,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function literal]>(...values: A): Type +export declare const literal: (...values: A) => Type ``` Added in v2.2.3 diff --git a/dtslint/ts3.5/Encoder.ts b/dtslint/ts3.5/Encoder.ts index 43c2c829a..576a63697 100644 --- a/dtslint/ts3.5/Encoder.ts +++ b/dtslint/ts3.5/Encoder.ts @@ -1,4 +1,5 @@ import * as E from '../../src/Encoder' +import { pipe } from 'fp-ts/lib/pipeable' const NumberToString: E.Encoder = { encode: String @@ -55,7 +56,7 @@ E.tuple(NumberToString, BooleanToNumber) // $ExpectType Encoder<[string, number] // // intersection // -E.intersection(E.type({ a: NumberToString }), E.type({ b: BooleanToNumber })) // $ExpectType Encoder<{ a: string; } & { b: number; }, { a: number; } & { b: boolean; }> +pipe(E.type({ a: NumberToString }), E.intersect(E.type({ b: BooleanToNumber }))) // $ExpectType Encoder<{ a: string; } & { b: number; }, { a: number; } & { b: boolean; }> // // sum diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index eb1c68bc1..4a9ed433e 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -1,5 +1,6 @@ import { Schemable, WithUnknownContainers, memoize, WithRefinement, WithUnion } from '../../src/Schemable' import { HKT } from 'fp-ts/lib/HKT' +import { pipe } from 'fp-ts/lib/pipeable' interface Schema { (S: Schemable & WithUnknownContainers & WithRefinement & WithUnion): HKT @@ -88,7 +89,7 @@ make((S) => S.tuple(S.string, S.number, S.boolean)) // $ExpectType Schema<[strin // intersection // -make((S) => S.intersection(S.type({ a: S.string }), S.type({ b: S.number }))) // $ExpectType Schema<{ a: string; } & { b: number; }> +make((S) => pipe(S.type({ a: S.string }), S.intersect(S.type({ b: S.number })))) // $ExpectType Schema<{ a: string; } & { b: number; }> // // sum diff --git a/src/Codec.ts b/src/Codec.ts index 3bb43806b..731330faf 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -194,8 +194,10 @@ export function tuple>>( * @category combinators * @since 2.2.3 */ -export function intersection(left: Codec, right: Codec): Codec { - return make(D.intersection(left, right), E.intersection(left, right)) +export const intersect = (right: Codec): ((left: Codec) => Codec) => { + const intersectD = D.intersect(right) + const intersectE = E.intersect(right) + return (left) => make(intersectD(left), intersectE(left)) } /** diff --git a/src/Decoder.ts b/src/Decoder.ts index 454cdcb8c..79da5a586 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -367,7 +367,7 @@ function typeOf(x: unknown): string { /** * @internal */ -export function intersect(a: A, b: B): A & B { +export function intersect_(a: A, b: B): A & B { if (a !== undefined && b !== undefined) { const tx = typeOf(a) const ty = typeOf(b) @@ -382,21 +382,19 @@ export function intersect(a: A, b: B): A & B { * @category combinators * @since 2.2.0 */ -export function intersection(left: Decoder, right: Decoder): Decoder { - return { - decode: (u) => { - const ea = left.decode(u) - const eb = right.decode(u) - if (E.isLeft(ea)) { - return E.isLeft(eb) ? E.left(ea.left.concat(eb.left) as DecodeError) : ea - } - if (E.isLeft(eb)) { - return eb - } - return success(intersect(ea.right, eb.right)) +export const intersect = (right: Decoder) => (left: Decoder): Decoder => ({ + decode: (u) => { + const ea = left.decode(u) + const eb = right.decode(u) + if (E.isLeft(ea)) { + return E.isLeft(eb) ? E.left(ea.left.concat(eb.left) as DecodeError) : ea + } + if (E.isLeft(eb)) { + return eb } + return success(intersect_(ea.right, eb.right)) } -} +}) /** * @category combinators @@ -564,7 +562,7 @@ export const schemableDecoder: Schemable1 & record, array, tuple: tuple as Schemable1['tuple'], - intersection, + intersect, sum, lazy, UnknownArray, diff --git a/src/Decoder2.ts b/src/Decoder2.ts index 19b034791..3955ea226 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -205,7 +205,7 @@ export const union: ]>( * @category combinators * @since 2.2.7 */ -export const intersection: (left: Decoder, right: Decoder) => Decoder = DT.intersection(M) +export const intersect: (right: Decoder) => (left: Decoder) => Decoder = DT.intersect(M) /** * @category combinators @@ -323,7 +323,7 @@ export const schemableDecoder: Schemable1 & record, array, tuple: tuple as Schemable1['tuple'], - intersection, + intersect, sum, lazy, UnknownArray, diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 5f06c80e0..a865ffe12 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -249,7 +249,7 @@ const typeOf = (x: unknown): string => (x === null ? 'null' : typeof x) /** * @internal */ -export const intersect = (a: A, b: B): A & B => { +export const intersect_ = (a: A, b: B): A & B => { if (a !== undefined && b !== undefined) { const tx = typeOf(a) const ty = typeOf(b) @@ -264,13 +264,12 @@ export const intersect = (a: A, b: B): A & B => { * @category combinators * @since 2.2.7 */ -export const intersection = (M: Apply2C) => ( - left: DecoderT, - right: DecoderT +export const intersect = (M: Apply2C) => (right: DecoderT) => ( + left: DecoderT ): DecoderT => ({ decode: (u) => M.ap( - M.map(left.decode(u), (a: A) => (b: B) => intersect(a, b)), + M.map(left.decode(u), (a: A) => (b: B) => intersect_(a, b)), right.decode(u) ) }) diff --git a/src/Encoder.ts b/src/Encoder.ts index 0da14a0da..e28338aa8 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -3,7 +3,7 @@ */ import { Contravariant2 } from 'fp-ts/lib/Contravariant' import { Category2 } from 'fp-ts/lib/Category' -import { intersect } from './Decoder' +import { intersect_ } from './Decoder' import { memoize } from './Schemable' import { identity } from 'fp-ts/lib/function' @@ -144,11 +144,9 @@ export function tuple>>( * @category combinators * @since 2.2.3 */ -export function intersection(left: Encoder, right: Encoder): Encoder { - return { - encode: (ab) => intersect(left.encode(ab), right.encode(ab)) - } -} +export const intersect = (right: Encoder) => (left: Encoder): Encoder => ({ + encode: (ab) => intersect_(left.encode(ab), right.encode(ab)) +}) /** * @category combinators diff --git a/src/Eq.ts b/src/Eq.ts index cd58591dc..2fbac2008 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -130,11 +130,9 @@ export const tuple: >( * @category combinators * @since 2.2.2 */ -export function intersection(left: Eq, right: Eq): Eq { - return { - equals: (x, y) => left.equals(x, y) && right.equals(x, y) - } -} +export const intersect = (right: Eq) => (left: Eq): Eq => ({ + equals: (x, y) => left.equals(x, y) && right.equals(x, y) +}) /** * @category combinators @@ -186,7 +184,7 @@ export const schemableEq: Schemable1 & WithUnknownContainers1 & Wi record, array, tuple, - intersection, + intersect, sum, lazy: (_, f) => lazy(f), UnknownArray, diff --git a/src/Guard.ts b/src/Guard.ts index 26133babe..d960e436b 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -32,11 +32,9 @@ export type TypeOf = G extends Guard ? A : never * @category constructors * @since 2.2.0 */ -export function literal]>(...values: A): Guard { - return { - is: (u: unknown): u is A[number] => values.findIndex((a) => a === u) !== -1 - } -} +export const literal = ]>(...values: A): Guard => ({ + is: (u: unknown): u is A[number] => values.findIndex((a) => a === u) !== -1 +}) // ------------------------------------------------------------------------------------- // primitives @@ -90,28 +88,24 @@ export const UnknownRecord: Guard> = { * @category combinators * @since 2.2.0 */ -export function refinement(from: Guard, refinement: (a: A) => a is B): Guard { - return { - is: (u: unknown): u is B => from.is(u) && refinement(u) - } -} +export const refinement = (from: Guard, refinement: (a: A) => a is B): Guard => ({ + is: (u: unknown): u is B => from.is(u) && refinement(u) +}) /** * @category combinators * @since 2.2.0 */ -export function nullable(or: Guard): Guard { - return { - is: (u): u is null | A => u === null || or.is(u) - } -} +export const nullable = (or: Guard): Guard => ({ + is: (u): u is null | A => u === null || or.is(u) +}) /** * @category combinators * @since 2.2.0 */ -export function type(properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> { - return refinement(UnknownRecord, (r): r is { +export const type = (properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> => + refinement(UnknownRecord, (r): r is { [K in keyof A]: A[K] } => { for (const k in properties) { @@ -121,14 +115,13 @@ export function type(properties: { [K in keyof A]: Guard }): Guard<{ [K } return true }) -} /** * @category combinators * @since 2.2.0 */ -export function partial(properties: { [K in keyof A]: Guard }): Guard> { - return refinement(UnknownRecord, (r): r is Partial => { +export const partial = (properties: { [K in keyof A]: Guard }): Guard> => + refinement(UnknownRecord, (r): r is Partial => { for (const k in properties) { const v = r[k] if (v !== undefined && !properties[k].is(v)) { @@ -137,14 +130,13 @@ export function partial(properties: { [K in keyof A]: Guard }): Guard

(codomain: Guard): Guard> { - return refinement(UnknownRecord, (r): r is Record => { +export const record = (codomain: Guard): Guard> => + refinement(UnknownRecord, (r): r is Record => { for (const k in r) { if (!codomain.is(r[k])) { return false @@ -152,68 +144,58 @@ export function record(codomain: Guard): Guard> { } return true }) -} /** * @category combinators * @since 2.2.0 */ -export function array(items: Guard): Guard> { - return refinement(UnknownArray, (us): us is Array => us.every(items.is)) -} +export const array = (items: Guard): Guard> => + refinement(UnknownArray, (us): us is Array => us.every(items.is)) /** * @category combinators * @since 2.2.0 */ -export function tuple>(...components: { [K in keyof A]: Guard }): Guard { - return { - is: (u): u is A => Array.isArray(u) && u.length === components.length && components.every((c, i) => c.is(u[i])) - } -} +export const tuple = >(...components: { [K in keyof A]: Guard }): Guard => ({ + is: (u): u is A => Array.isArray(u) && u.length === components.length && components.every((c, i) => c.is(u[i])) +}) /** * @category combinators * @since 2.2.0 */ -export function intersection(left: Guard, right: Guard): Guard { - return { - is: (u: unknown): u is A & B => left.is(u) && right.is(u) - } -} +export const intersect = (right: Guard) => (left: Guard): Guard => ({ + is: (u: unknown): u is A & B => left.is(u) && right.is(u) +}) /** * @category combinators * @since 2.2.0 */ -export function union]>( +export const union = ]>( ...members: { [K in keyof A]: Guard } -): Guard { - return { - is: (u: unknown): u is A | A[number] => members.some((m) => m.is(u)) - } -} +): Guard => ({ + is: (u: unknown): u is A | A[number] => members.some((m) => m.is(u)) +}) /** * @category combinators * @since 2.2.0 */ -export function sum(tag: T): (members: { [K in keyof A]: Guard }) => Guard { - return (members: { [K in keyof A]: Guard }) => - refinement(UnknownRecord, (r): r is any => { - const v = r[tag] as keyof A - if (v in members) { - return members[v].is(r) - } - return false - }) -} +export const sum = (tag: T) => (members: { [K in keyof A]: Guard }): Guard => + refinement(UnknownRecord, (r): r is any => { + const v = r[tag] as keyof A + if (v in members) { + return members[v].is(r) + } + return false + }) /** * @category combinators * @since 2.2.0 */ -export function lazy(f: () => Guard): Guard { +export const lazy = (f: () => Guard): Guard => { const get = memoize>(f) return { is: (u: unknown): u is A => get().is(u) @@ -258,7 +240,7 @@ export const schemableGuard: Schemable1 & WithUnknownContainers1 & Wit record, array, tuple: tuple as Schemable1['tuple'], - intersection, + intersect, sum, lazy: (_, f) => lazy(f), UnknownArray, diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 35a49f8a0..e5cffd71c 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -139,7 +139,7 @@ export const tuple: >( * @category combinators * @since 2.2.3 */ -export const intersection: (left: JsonCodec, right: JsonCodec) => JsonCodec = C.intersection +export const intersect: (right: JsonCodec) => (left: JsonCodec) => JsonCodec = C.intersect /** * @category combinators @@ -212,7 +212,7 @@ export const schemableJsonCodec: Schemable1 & WithRefinement1 = { record, array, tuple: tuple as Schemable1['tuple'], - intersection, + intersect, sum, lazy, refinement: refinement as WithRefinement1['refinement'] diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 321186f80..8a04d7488 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -109,7 +109,7 @@ export const tuple: >( * @category combinators * @since 2.2.3 */ -export const intersection: (left: JsonEncoder, right: JsonEncoder) => JsonEncoder = E.intersection +export const intersect: (right: JsonEncoder) => (left: JsonEncoder) => JsonEncoder = E.intersect /** * @category combinators @@ -182,7 +182,7 @@ export const schemableJsonEncoder: Schemable1 = { record, array, tuple, - intersection, + intersect, sum, lazy: (_, f) => lazy(f) } diff --git a/src/Schemable.ts b/src/Schemable.ts index 6d4e9f0cd..2ea1b1fb8 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -23,7 +23,7 @@ export interface Schemable { readonly record: (codomain: HKT) => HKT> readonly array: (items: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT - readonly intersection: (left: HKT, right: HKT) => HKT + readonly intersect: (right: HKT) => (left: HKT) => HKT readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT } @@ -43,7 +43,7 @@ export interface Schemable1 { readonly record: (codomain: Kind) => Kind> readonly array: (items: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind - readonly intersection: (left: Kind, right: Kind) => Kind + readonly intersect: (right: Kind) => (left: Kind) => Kind readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index b7818a7bd..3cb97f588 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -219,9 +219,7 @@ export const union: ]>( * @category combinators * @since 2.2.7 */ -export const intersection: (left: TaskDecoder, right: TaskDecoder) => TaskDecoder = DT.intersection( - M -) +export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = DT.intersect(M) /** * @category combinators @@ -342,7 +340,7 @@ export const schemableTaskDecoder: Schemable1 & record, array, tuple: tuple as Schemable1['tuple'], - intersection, + intersect, sum, lazy, UnknownArray, diff --git a/src/Type.ts b/src/Type.ts index 0597f1f78..501b569ce 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -22,9 +22,8 @@ export interface Type extends t.Type {} * @category constructors * @since 2.2.3 */ -export function literal]>(...values: A): Type { - return t.union(values.map((v) => t.literal(v as any)) as any) -} +export const literal = ]>(...values: A): Type => + t.union(values.map((v) => t.literal(v as any)) as any) // ------------------------------------------------------------------------------------- // primitives @@ -68,92 +67,75 @@ export const UnknownRecord: Type> = t.UnknownRecord * @category combinators * @since 2.2.3 */ -export function refinement(from: Type, refinement: (a: A) => a is B, expected: string): Type { +export const refinement = (from: Type, refinement: (a: A) => a is B, expected: string): Type => // tslint:disable-next-line: deprecation - return t.refinement(from, refinement, expected) as any -} + t.refinement(from, refinement, expected) as any /** * @category combinators * @since 2.2.3 */ -export function nullable(or: Type): Type { - return t.union([t.null, or]) -} +export const nullable = (or: Type): Type => t.union([t.null, or]) /** * @category combinators * @since 2.2.3 */ -export function type(properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> { - return t.type(properties) as any -} +export const type = (properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> => + t.type(properties) as any /** * @category combinators * @since 2.2.3 */ -export function partial(properties: { [K in keyof A]: Type }): Type> { - return t.partial(properties) -} +export const partial = (properties: { [K in keyof A]: Type }): Type> => + t.partial(properties) /** * @category combinators * @since 2.2.3 */ -export function record(codomain: Type): Type> { - return t.record(t.string, codomain) -} +export const record = (codomain: Type): Type> => t.record(t.string, codomain) /** * @category combinators * @since 2.2.3 */ -export function array(items: Type): Type> { - return t.array(items) -} +export const array = (items: Type): Type> => t.array(items) /** * @category combinators * @since 2.2.3 */ -export function tuple>(...components: { [K in keyof A]: Type }): Type { - return t.tuple(components as any) as any -} +export const tuple = >(...components: { [K in keyof A]: Type }): Type => + t.tuple(components as any) as any /** * @category combinators * @since 2.2.3 */ -export function intersection(left: Type, right: Type): Type { - return t.intersection([left, right]) -} +export const intersect = (right: Type) => (left: Type): Type => t.intersection([left, right]) /** * @category combinators * @since 2.2.3 */ -export function lazy(id: string, f: () => Type): Type { - return t.recursion(id, f) -} +export const lazy = (id: string, f: () => Type): Type => t.recursion(id, f) /** * @category combinators * @since 2.2.3 */ -export function sum(_tag: T): (members: { [K in keyof A]: Type }) => Type { - return (members) => t.union(Object.values(members) as any) -} +export const sum = (_tag: T) => (members: { [K in keyof A]: Type }): Type => + t.union(Object.values(members) as any) /** * @category combinators * @since 2.2.3 */ -export function union]>( +export const union = ]>( ...members: { [K in keyof A]: Type } -): Type { - return t.union(members as any) -} +): Type => t.union(members as any) // ------------------------------------------------------------------------------------- // instances @@ -193,7 +175,7 @@ export const schemableType: Schemable1 & WithUnknownContainers1 & With record, array, tuple: tuple as Schemable1['tuple'], - intersection, + intersect, sum, lazy, UnknownArray, diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index ad6d717e7..2d192d0f4 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -3,7 +3,7 @@ */ import * as fc from 'fast-check' import * as S from '../src/Schemable' -import { intersect } from '../src/Decoder' +import { intersect_ } from '../src/Decoder' // ------------------------------------------------------------------------------------- // model @@ -81,9 +81,8 @@ export function tuple>( return (fc.tuple as any)(...components) } -export function intersection(left: Arbitrary, right: Arbitrary): Arbitrary { - return fc.tuple(left, right).map(([a, b]) => intersect(a, b)) -} +export const intersect = (right: Arbitrary) => (left: Arbitrary): Arbitrary => + fc.tuple(left, right).map(([a, b]) => intersect_(a, b)) export function sum( _tag: T @@ -131,7 +130,7 @@ export const schemableArbitrary: S.Schemable1 & record, array, tuple: tuple as S.Schemable1['tuple'], - intersection, + intersect, sum, lazy: (_, f) => lazy(f), UnknownArray, diff --git a/test/Codec.ts b/test/Codec.ts index 8b8a27f74..666f6c238 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -486,27 +486,27 @@ describe('Codec', () => { }) }) - describe('intersection', () => { + describe('intersect', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.intersection(C.type({ a: C.string }), C.type({ b: C.number })) + const codec = pipe(C.type({ a: C.string }), C.intersect(C.type({ b: C.number }))) assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), right({ a: 'a', b: 1 })) }) it('should handle primitives', () => { - const codec = C.intersection(Int, Positive) + const codec = pipe(Int, C.intersect(Positive)) assert.deepStrictEqual(codec.decode(1), right(1)) }) }) describe('encode', () => { it('should encode a value', () => { - const codec = C.intersection(C.type({ a: C.string }), C.type({ b: NumberFromString })) + const codec = pipe(C.type({ a: C.string }), C.intersect(C.type({ b: NumberFromString }))) assert.deepStrictEqual(codec.encode({ a: 'a', b: 1 }), { a: 'a', b: '1' }) }) it('should handle primitives', () => { - const codec = C.intersection(Int, Positive) + const codec = pipe(Int, C.intersect(Positive)) assert.deepStrictEqual(codec.encode(1 as any), 1) }) }) @@ -573,7 +573,7 @@ describe('Codec', () => { } const codec: C.Codec = C.lazy('A', () => - C.intersection(C.type({ a: NumberFromString }), C.partial({ b: codec })) + pipe(C.type({ a: NumberFromString }), C.intersect(C.partial({ b: codec }))) ) describe('decode', () => { diff --git a/test/Decoder.ts b/test/Decoder.ts index 68c56365e..33020b16b 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -66,9 +66,9 @@ describe('Decoder', () => { }) }) - describe('intersection', () => { + describe('intersect', () => { it('should accumulate all errors', () => { - const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) assert.deepStrictEqual( decoder.decode({}), E.left([ @@ -87,41 +87,41 @@ describe('Decoder', () => { }) }) - describe('intersect', () => { + describe('intersect_', () => { it('should concat strings', () => { - assert.deepStrictEqual(D.intersect('a', 'b'), 'b') + assert.deepStrictEqual(D.intersect_('a', 'b'), 'b') }) it('should concat numbers', () => { - assert.deepStrictEqual(D.intersect(1, 2), 2) + assert.deepStrictEqual(D.intersect_(1, 2), 2) }) it('should concat booleans', () => { - assert.deepStrictEqual(D.intersect(true, false), false) + assert.deepStrictEqual(D.intersect_(true, false), false) }) it('should concat nulls', () => { - assert.deepStrictEqual(D.intersect(null, null), null) + assert.deepStrictEqual(D.intersect_(null, null), null) }) it('should concat undefineds', () => { - assert.deepStrictEqual(D.intersect(undefined, undefined), undefined) + assert.deepStrictEqual(D.intersect_(undefined, undefined), undefined) }) it('should concat objects', () => { - assert.deepStrictEqual(D.intersect({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) + assert.deepStrictEqual(D.intersect_({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) }) it('should concat a string with an object', () => { - assert.deepStrictEqual(D.intersect('a', { a: 1 }), { 0: 'a', a: 1 }) + assert.deepStrictEqual(D.intersect_('a', { a: 1 }), { 0: 'a', a: 1 }) }) it('should concat a number with an object', () => { - assert.deepStrictEqual(D.intersect(1, { a: 1 }), { a: 1 }) + assert.deepStrictEqual(D.intersect_(1, { a: 1 }), { a: 1 }) }) it('should concat a boolean with an object', () => { - assert.deepStrictEqual(D.intersect(true, { a: 1 }), { a: 1 }) + assert.deepStrictEqual(D.intersect_(true, { a: 1 }), { a: 1 }) }) }) diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 75e4b6a19..d9fd34fe6 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -392,19 +392,19 @@ describe('Decoder', () => { }) }) - describe('intersection', () => { + describe('intersect', () => { it('should decode a valid input', () => { - const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a', b: 1 })) }) it('should handle primitives', () => { - const decoder = D.intersection(Int, Positive) + const decoder = pipe(Int, D.intersect(Positive)) assert.deepStrictEqual(decoder.decode(1), E.right(1)) }) it('should accumulate all errors', () => { - const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) assert.deepStrictEqual( decoder.decode({ a: 'a' }), E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -466,7 +466,7 @@ describe('Decoder', () => { } const lazyDecoder: D.Decoder = D.lazy('A', () => - D.intersection(D.type({ a: NumberFromString }), D.partial({ b: lazyDecoder })) + pipe(D.type({ a: NumberFromString }), D.intersect(D.partial({ b: lazyDecoder }))) ) describe('lazy', () => { diff --git a/test/DecoderT.ts b/test/DecoderT.ts index 241510cea..c86d72372 100644 --- a/test/DecoderT.ts +++ b/test/DecoderT.ts @@ -4,39 +4,39 @@ import * as DT from '../src/DecoderT' describe('DecoderT', () => { describe('intersect', () => { it('should concat strings', () => { - assert.deepStrictEqual(DT.intersect('a', 'b'), 'b') + assert.deepStrictEqual(DT.intersect_('a', 'b'), 'b') }) it('should concat numbers', () => { - assert.deepStrictEqual(DT.intersect(1, 2), 2) + assert.deepStrictEqual(DT.intersect_(1, 2), 2) }) it('should concat booleans', () => { - assert.deepStrictEqual(DT.intersect(true, false), false) + assert.deepStrictEqual(DT.intersect_(true, false), false) }) it('should concat nulls', () => { - assert.deepStrictEqual(DT.intersect(null, null), null) + assert.deepStrictEqual(DT.intersect_(null, null), null) }) it('should concat undefineds', () => { - assert.deepStrictEqual(DT.intersect(undefined, undefined), undefined) + assert.deepStrictEqual(DT.intersect_(undefined, undefined), undefined) }) it('should concat objects', () => { - assert.deepStrictEqual(DT.intersect({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) + assert.deepStrictEqual(DT.intersect_({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) }) it('should concat a string with an object', () => { - assert.deepStrictEqual(DT.intersect('a', { a: 1 }), { 0: 'a', a: 1 }) + assert.deepStrictEqual(DT.intersect_('a', { a: 1 }), { 0: 'a', a: 1 }) }) it('should concat a number with an object', () => { - assert.deepStrictEqual(DT.intersect(1, { a: 1 }), { a: 1 }) + assert.deepStrictEqual(DT.intersect_(1, { a: 1 }), { a: 1 }) }) it('should concat a boolean with an object', () => { - assert.deepStrictEqual(DT.intersect(true, { a: 1 }), { a: 1 }) + assert.deepStrictEqual(DT.intersect_(true, { a: 1 }), { a: 1 }) }) }) }) diff --git a/test/Encoder.ts b/test/Encoder.ts index 77643ed5f..260a6e3b6 100644 --- a/test/Encoder.ts +++ b/test/Encoder.ts @@ -56,8 +56,8 @@ describe('Encoder', () => { assert.deepStrictEqual(encoder.encode([3, true]), ['3', 1]) }) - it('intersection', () => { - const encoder = E.intersection(E.type({ a: NumberToString }), E.type({ b: BooleanToNumber })) + it('intersect', () => { + const encoder = pipe(E.type({ a: NumberToString }), E.intersect(E.type({ b: BooleanToNumber }))) assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) }) diff --git a/test/Eq.ts b/test/Eq.ts index 285a7b5d0..e2605822f 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -1,6 +1,7 @@ import * as assert from 'assert' import * as E from '../src/Eq' import { Eq } from 'fp-ts/lib/Eq' +import { pipe } from 'fp-ts/lib/pipeable' describe('Eq', () => { it('literal', () => { @@ -42,8 +43,8 @@ describe('Eq', () => { assert.deepStrictEqual(eq.equals(['a', 1], ['a', 2]), false) }) - it('intersection', () => { - const eq = E.intersection(E.type({ a: E.string }), E.type({ b: E.number })) + it('intersect', () => { + const eq = pipe(E.type({ a: E.string }), E.intersect(E.type({ b: E.number }))) assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'a', b: 1 }), true) assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'c', b: 1 }), false) assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'a', b: 2 }), false) diff --git a/test/Guard.ts b/test/Guard.ts index af60affad..dd9907a6f 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -1,5 +1,6 @@ import * as assert from 'assert' import * as G from '../src/Guard' +import { pipe } from 'fp-ts/lib/pipeable' describe('Guard', () => { describe('refinement', () => { @@ -151,14 +152,14 @@ describe('Guard', () => { }) }) - describe('intersection', () => { + describe('intersect', () => { it('should accepts valid inputs', () => { - const guard = G.intersection(G.type({ a: G.string }), G.type({ b: G.number })) + const guard = pipe(G.type({ a: G.string }), G.intersect(G.type({ b: G.number }))) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) }) it('should rejects invalid inputs', () => { - const guard = G.intersection(G.type({ a: G.string }), G.type({ b: G.number })) + const guard = pipe(G.type({ a: G.string }), G.intersect(G.type({ b: G.number }))) assert.strictEqual(guard.is({ a: 'a' }), false) }) }) diff --git a/test/Schema.ts b/test/Schema.ts index 027e35a2b..8ebddc54e 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -7,6 +7,7 @@ import * as G from '../src/Guard' import { Schema, interpreter, make } from '../src/Schema' import * as A from './Arbitrary' import * as JE from '../src/JsonEncoder' +import { pipe } from 'fp-ts/lib/pipeable' function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { try { @@ -99,8 +100,8 @@ describe('Schema', () => { check(make((S) => S.tuple(S.string, S.number))) }) - it('intersection', () => { - check(make((S) => S.intersection(S.type({ a: S.string }), S.type({ b: S.number })))) + it('intersect', () => { + check(make((S) => pipe(S.type({ a: S.string }), S.intersect(S.type({ b: S.number }))))) }) it('sum', () => { @@ -117,7 +118,7 @@ describe('Schema', () => { } const schema: Schema = make((S) => - S.lazy('A', () => S.intersection(S.type({ a: S.string }), S.partial({ b: schema(S), c: S.number }))) + S.lazy('A', () => pipe(S.type({ a: S.string }), S.intersect(S.partial({ b: schema(S), c: S.number })))) ) check(schema) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index d8b879fa0..fb1385075 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -414,19 +414,19 @@ describe('TaskDecoder', () => { }) }) - describe('intersection', () => { + describe('intersect', () => { it('should decode a valid input', async () => { - const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), E.right({ a: 'a', b: 1 })) }) it('should handle primitives', async () => { - const decoder = D.intersection(Int, Positive) + const decoder = pipe(Int, D.intersect(Positive)) assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) }) it('should accumulate all errors', async () => { - const decoder = D.intersection(D.type({ a: D.string }), D.type({ b: D.number })) + const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) assert.deepStrictEqual( await decoder.decode({ a: 'a' })(), E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -488,7 +488,7 @@ describe('TaskDecoder', () => { } const lazyDecoder: D.TaskDecoder = D.lazy('A', () => - D.intersection(D.type({ a: NumberFromString }), D.partial({ b: lazyDecoder })) + pipe(D.type({ a: NumberFromString }), D.intersect(D.partial({ b: lazyDecoder }))) ) describe('lazy', () => { diff --git a/test/Type.ts b/test/Type.ts index 079b133dd..7652af40b 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -16,6 +16,7 @@ import { } from '../src/Schemable' import * as T from '../src/Type' import * as A from './Arbitrary' +import { pipe } from 'fp-ts/lib/pipeable' interface Schema { (S: Schemable & WithUnknownContainers & WithUnion): HKT @@ -149,9 +150,9 @@ describe('Type', () => { ) }) - it('intersection', () => { + it('intersect', () => { check( - make((S) => S.intersection(S.type({ a: S.string }), S.type({ b: S.number }))), + make((S) => pipe(S.type({ a: S.string }), S.intersect(S.type({ b: S.number })))), t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) ) }) @@ -176,7 +177,7 @@ describe('Type', () => { } const schema: Schema = make((S) => - S.lazy('A', () => S.intersection(S.type({ a: S.string }), S.partial({ b: schema(S), c: S.number }))) + S.lazy('A', () => pipe(S.type({ a: S.string }), S.intersect(S.partial({ b: schema(S), c: S.number })))) ) const type: t.Type = t.recursion('A', () => t.intersection([t.type({ a: t.string }), t.partial({ b: type, c: t.number })]) From c499186689a29050a7d670c8d2fbf2ffca78b2b1 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 14:48:47 +0200 Subject: [PATCH 069/222] make parse pipeable --- CHANGELOG.md | 2 +- docs/modules/Decoder2.ts.md | 3 +-- docs/modules/DecoderT.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 3 +-- src/Decoder2.ts | 2 +- src/DecoderT.ts | 3 +-- src/TaskDecoder.ts | 3 +-- test/Decoder2.ts | 11 +++++++---- test/TaskDecoder.ts | 11 +++++++---- 9 files changed, 21 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f6c06f41..b0902e09a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ - (**bc**) remove `Tree` module (@gcanti) - `Decoder` - (**bc**) remove `never` (@gcanti) - - (**bc**) change `parse` signature (@gcanti) + - (**bc**) make `parse` pipeable and change its `parser` argument (@gcanti) - `Guard` - (**bc**) remove `never` (@gcanti) - `Schemable` diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index dada5ac68..23e962481 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -161,9 +161,8 @@ Added in v2.2.7 ```ts export declare const parse: ( - from: Decoder, parser: (a: A) => E.Either>, B> -) => Decoder +) => (from: Decoder) => Decoder ``` Added in v2.2.7 diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 247adadd9..48890fa57 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -94,7 +94,7 @@ Added in v2.2.7 ```ts export declare const parse: ( M: MonadThrow2C & Bifunctor2 -) => (from: DecoderT, parser: (a: A) => Kind2) => DecoderT +) => (parser: (a: A) => Kind2) => (from: DecoderT) => DecoderT ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 4db3f139f..596066cb6 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -162,9 +162,8 @@ Added in v2.2.7 ```ts export declare const parse: ( - from: TaskDecoder, parser: (a: A) => TE.TaskEither>, B> -) => TaskDecoder +) => (from: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 diff --git a/src/Decoder2.ts b/src/Decoder2.ts index 3955ea226..92ae48315 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -141,7 +141,7 @@ export const refinement = ( * @category combinators * @since 2.2.7 */ -export const parse: (from: Decoder, parser: (a: A) => E.Either) => Decoder = DT.parse(M) +export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = DT.parse(M) /** * @category combinators diff --git a/src/DecoderT.ts b/src/DecoderT.ts index a865ffe12..d91a12cc6 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -85,9 +85,8 @@ export const refinement = (M: MonadThrow2C & Bifunctor * @since 2.2.7 */ export const parse = (M: MonadThrow2C & Bifunctor2) => ( - from: DecoderT, parser: (a: A) => Kind2 -): DecoderT => ({ +) => (from: DecoderT): DecoderT => ({ decode: (u) => M.chain(from.decode(u), (a) => parser(a)) }) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 3cb97f588..2df097ee0 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -142,9 +142,8 @@ export const withExpected: ( * @since 2.2.7 */ export const parse: ( - from: TaskDecoder, parser: (a: A) => TE.TaskEither -) => TaskDecoder = DT.parse(M) +) => (from: TaskDecoder) => TaskDecoder = DT.parse(M) /** * @category combinators diff --git a/test/Decoder2.ts b/test/Decoder2.ts index d9fd34fe6..29c8e5c9f 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -11,10 +11,13 @@ const undefinedGuard: G.Guard = { } const undef: D.Decoder = D.fromGuard(undefinedGuard, 'undefined') -const NumberFromString: D.Decoder = D.parse(D.string, (s) => { - const n = parseFloat(s) - return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) -}) +const NumberFromString: D.Decoder = pipe( + D.string, + D.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + }) +) interface PositiveBrand { readonly Positive: unique symbol diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index fb1385075..02f444a3e 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -12,10 +12,13 @@ const undefinedGuard: G.Guard = { } const undef: D.TaskDecoder = D.fromGuard(undefinedGuard, 'undefined') -const NumberFromString: D.TaskDecoder = D.parse(D.string, (s) => { - const n = parseFloat(s) - return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) -}) +const NumberFromString: D.TaskDecoder = pipe( + D.string, + D.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + }) +) interface PositiveBrand { readonly Positive: unique symbol From 6f1957d6c7723bee8f3daac42560350ac6b887dd Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 16:19:42 +0200 Subject: [PATCH 070/222] make refinements pipeables --- CHANGELOG.md | 3 +- docs/modules/Codec.ts.md | 11 ++--- docs/modules/Decoder.ts.md | 13 +++-- docs/modules/Decoder2.ts.md | 13 +++-- docs/modules/DecoderT.ts.md | 9 ++-- docs/modules/Eq.ts.md | 2 +- docs/modules/Guard.ts.md | 8 ++-- docs/modules/JsonCodec.ts.md | 13 +++-- docs/modules/Schemable.ts.md | 16 +++---- docs/modules/TaskDecoder.ts.md | 13 +++-- docs/modules/Type.ts.md | 12 ++--- dtslint/ts3.5/Schema.ts | 11 +++-- src/Codec.ts | 10 ++-- src/Decoder.ts | 31 +++++------- src/Decoder2.ts | 20 +++----- src/DecoderT.ts | 5 +- src/Eq.ts | 6 +-- src/Guard.ts | 88 ++++++++++++++++++++-------------- src/JsonCodec.ts | 13 +++-- src/Schemable.ts | 8 ++-- src/TaskDecoder.ts | 17 ++++--- src/Type.ts | 10 ++-- test/Arbitrary.ts | 9 ++-- test/Codec.ts | 27 ++++++++--- test/Decoder2.ts | 22 +++++++-- test/Eq.ts | 7 ++- test/Guard.ts | 12 +++-- test/TaskDecoder.ts | 22 +++++++-- test/Type.ts | 7 ++- 29 files changed, 241 insertions(+), 197 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0902e09a..153a9ddf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,8 +31,9 @@ - better `literal` signature (@gcanti) - better `union` signature (@gcanti) - (**bc**) make intersections pipeables (@gcanti) + - (**bc**) make refinements pipeables (@gcanti) -**bc** means "possible breaking change" +**bc** means "breaking change" # 2.2.6 diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 181d881a0..369f1142c 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -21,7 +21,7 @@ Added in v2.2.3 - [nullable](#nullable) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -124,16 +124,15 @@ export declare function record(codomain: Codec): Codec( - from: Codec, +export declare const refine: ( refinement: (a: A) => a is B, - expected: string -): Codec + id: string +) => (from: Codec) => Codec ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index d346d7a68..25830b857 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -30,7 +30,7 @@ Added in v2.2.0 - [parse](#parse) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -210,16 +210,15 @@ export declare function record(codomain: Decoder): Decoder( - from: Decoder, +export declare const refine: ( refinement: (a: A) => a is B, - expected: string -): Decoder + id: string +) => (from: Decoder) => Decoder ``` Added in v2.2.0 @@ -365,7 +364,7 @@ Added in v2.2.3 export declare const schemableDecoder: Schemable1<'io-ts/Decoder'> & WithUnknownContainers1<'io-ts/Decoder'> & WithUnion1<'io-ts/Decoder'> & - WithRefinement1<'io-ts/Decoder'> + WithRefine1<'io-ts/Decoder'> ``` Added in v2.2.3 diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md index 23e962481..006bc8e51 100644 --- a/docs/modules/Decoder2.ts.md +++ b/docs/modules/Decoder2.ts.md @@ -28,7 +28,7 @@ Added in v2.2.7 - [parse](#parse) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -189,16 +189,15 @@ export declare const record: (codomain: Decoder) => Decoder( - from: Decoder, +export declare const refine: ( refinement: (a: A) => a is B, - expected: string -) => Decoder + id: string +) => (from: Decoder) => Decoder ``` Added in v2.2.7 @@ -334,7 +333,7 @@ Added in v2.2.7 export declare const schemableDecoder: Schemable1<'io-ts/Decoder2'> & WithUnknownContainers1<'io-ts/Decoder2'> & WithUnion1<'io-ts/Decoder2'> & - WithRefinement1<'io-ts/Decoder2'> + WithRefine1<'io-ts/Decoder2'> ``` Added in v2.2.7 diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 48890fa57..4721ab950 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -20,7 +20,7 @@ Added in v2.2.7 - [parse](#parse) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -129,18 +129,17 @@ export declare function record( Added in v2.2.7 -## refinement +## refine **Signature** ```ts -export declare const refinement: ( +export declare const refine: ( M: MonadThrow2C & Bifunctor2 ) => ( - from: DecoderT, refinement: (a: A) => a is B, onError: (u: unknown) => E -) => DecoderT +) => (from: DecoderT) => DecoderT ``` Added in v2.2.7 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 16a64e7a6..52f46128b 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -135,7 +135,7 @@ Added in v2.2.2 **Signature** ```ts -export declare const schemableEq: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefinement1<'Eq'> +export declare const schemableEq: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefine1<'Eq'> ``` Added in v2.2.3 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index ea72fe335..bed939b30 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -19,7 +19,7 @@ Added in v2.2.0 - [nullable](#nullable) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -107,12 +107,12 @@ export declare const record: (codomain: Guard) => Guard> Added in v2.2.0 -## refinement +## refine **Signature** ```ts -export declare const refinement: (from: Guard, refinement: (a: A) => a is B) => Guard +export declare const refine: (refinement: (a: A) => a is B) => (from: Guard) => Guard ``` Added in v2.2.0 @@ -203,7 +203,7 @@ Added in v2.2.0 export declare const schemableGuard: Schemable1<'io-ts/Guard'> & WithUnknownContainers1<'io-ts/Guard'> & WithUnion1<'io-ts/Guard'> & - WithRefinement1<'io-ts/Guard'> + WithRefine1<'io-ts/Guard'> ``` Added in v2.2.3 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index ea67eee42..c590aacaa 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -21,7 +21,7 @@ Added in v2.2.3 - [nullable](#nullable) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -121,16 +121,15 @@ export declare const record: (codomain: JsonCodec) => JsonCodec( - from: JsonCodec, +export declare const refine: ( refinement: (a: A) => a is B, - expected: string -) => JsonCodec + id: string +) => (from: JsonCodec) => JsonCodec ``` Added in v2.2.3 @@ -241,7 +240,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const schemableJsonCodec: Schemable1<'io-ts/JsonCodec'> & WithRefinement1<'io-ts/JsonCodec'> +export declare const schemableJsonCodec: Schemable1<'io-ts/JsonCodec'> & WithRefine1<'io-ts/JsonCodec'> ``` Added in v2.2.3 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 3edf81445..5710aaeb2 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -16,8 +16,8 @@ Added in v2.2.0 - [Literal (type alias)](#literal-type-alias) - [Schemable (interface)](#schemable-interface) - [Schemable1 (interface)](#schemable1-interface) - - [WithRefinement (interface)](#withrefinement-interface) - - [WithRefinement1 (interface)](#withrefinement1-interface) + - [WithRefine (interface)](#withrefine-interface) + - [WithRefine1 (interface)](#withrefine1-interface) - [WithUnion (interface)](#withunion-interface) - [WithUnion1 (interface)](#withunion1-interface) - [WithUnknownContainers (interface)](#withunknowncontainers-interface) @@ -88,25 +88,25 @@ export interface Schemable1 { Added in v2.2.3 -## WithRefinement (interface) +## WithRefine (interface) **Signature** ```ts -export interface WithRefinement { - readonly refinement: (from: HKT, refinement: (a: A) => a is B, expected: string) => HKT +export interface WithRefine { + readonly refine: (refinement: (a: A) => a is B, id: string) => (from: HKT) => HKT } ``` Added in v2.2.3 -## WithRefinement1 (interface) +## WithRefine1 (interface) **Signature** ```ts -export interface WithRefinement1 { - readonly refinement: (from: Kind, refinement: (a: A) => a is B, expected: string) => Kind +export interface WithRefine1 { + readonly refine: (refinement: (a: A) => a is B, id: string) => (from: Kind) => Kind } ``` diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 596066cb6..24813c9ff 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -28,7 +28,7 @@ Added in v2.2.7 - [parse](#parse) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -190,16 +190,15 @@ export declare const record: (codomain: TaskDecoder) => TaskDecoder( - from: TaskDecoder, +export declare const refine: ( refinement: (a: A) => a is B, - expected: string -) => TaskDecoder + id: string +) => (from: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -347,7 +346,7 @@ Added in v2.2.7 export declare const schemableTaskDecoder: Schemable1<'io-ts/TaskDecoder'> & WithUnknownContainers1<'io-ts/TaskDecoder'> & WithUnion1<'io-ts/TaskDecoder'> & - WithRefinement1<'io-ts/TaskDecoder'> + WithRefine1<'io-ts/TaskDecoder'> ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 55b45e6c2..1c92d118f 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -19,7 +19,7 @@ Added in v2.2.3 - [nullable](#nullable) - [partial](#partial) - [record](#record) - - [refinement](#refinement) + - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) @@ -103,16 +103,12 @@ export declare const record: (codomain: Type) => Type> Added in v2.2.3 -## refinement +## refine **Signature** ```ts -export declare const refinement: ( - from: Type, - refinement: (a: A) => a is B, - expected: string -) => Type +export declare const refine: (refinement: (a: A) => a is B, id: string) => (from: Type) => Type ``` Added in v2.2.3 @@ -203,7 +199,7 @@ Added in v2.2.3 export declare const schemableType: Schemable1<'io-ts/Type'> & WithUnknownContainers1<'io-ts/Type'> & WithUnion1<'io-ts/Type'> & - WithRefinement1<'io-ts/Type'> + WithRefine1<'io-ts/Type'> ``` Added in v2.2.3 diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index 4a9ed433e..7b8ff53d9 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -1,9 +1,9 @@ -import { Schemable, WithUnknownContainers, memoize, WithRefinement, WithUnion } from '../../src/Schemable' +import { Schemable, WithUnknownContainers, memoize, WithRefine, WithUnion } from '../../src/Schemable' import { HKT } from 'fp-ts/lib/HKT' import { pipe } from 'fp-ts/lib/pipeable' interface Schema { - (S: Schemable & WithUnknownContainers & WithRefinement & WithUnion): HKT + (S: Schemable & WithUnknownContainers & WithRefine & WithUnion): HKT } export type TypeOf = S extends Schema ? A : never @@ -155,7 +155,12 @@ interface PositiveBrand { type Positive = number & PositiveBrand -make((S) => S.refinement(S.number, (n): n is Positive => n > 0, 'Positive')) +make((S) => + pipe( + S.number, + S.refine((n): n is Positive => n > 0, 'Positive') + ) +) // // union diff --git a/src/Codec.ts b/src/Codec.ts index 731330faf..2b4b50165 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -123,12 +123,12 @@ export function withExpected( * @category combinators * @since 2.2.3 */ -export function refinement( - from: Codec, +export const refine = ( refinement: (a: A) => a is B, - expected: string -): Codec { - return make(D.refinement(from, refinement, expected), from) + id: string +): ((from: Codec) => Codec) => { + const refine = D.refine(refinement, id) + return (from) => make(refine(from), from) } /** diff --git a/src/Decoder.ts b/src/Decoder.ts index 79da5a586..a79523efa 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -8,7 +8,7 @@ import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' import { drawTree, Forest, Tree } from 'fp-ts/lib/Tree' import * as G from './Guard' -import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -170,22 +170,16 @@ export function withExpected( * @category combinators * @since 2.2.0 */ -export function refinement( - from: Decoder, - refinement: (a: A) => a is B, - expected: string -): Decoder { - return { - decode: (u) => { - const e = from.decode(u) - if (E.isLeft(e)) { - return e - } - const a = e.right - return refinement(a) ? success(a) : failure(`cannot refine ${JSON.stringify(u)}, should be ${expected}`) +export const refine = (refinement: (a: A) => a is B, id: string) => (from: Decoder): Decoder => ({ + decode: (u) => { + const e = from.decode(u) + if (E.isLeft(e)) { + return e } + const a = e.right + return refinement(a) ? success(a) : failure(`cannot refine ${JSON.stringify(u)}, should be ${id}`) } -} +}) /** * @category combinators @@ -547,10 +541,7 @@ export const altDecoder: Alt1 = { * @category instances * @since 2.2.3 */ -export const schemableDecoder: Schemable1 & - WithUnknownContainers1 & - WithUnion1 & - WithRefinement1 = { +export const schemableDecoder: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, literal, string, @@ -568,7 +559,7 @@ export const schemableDecoder: Schemable1 & UnknownArray, UnknownRecord, union: union as WithUnion1['union'], - refinement: refinement as WithRefinement1['refinement'] + refine: refine as WithRefine1['refine'] } // ------------------------------------------------------------------------------------- diff --git a/src/Decoder2.ts b/src/Decoder2.ts index 92ae48315..cb4d7e1b3 100644 --- a/src/Decoder2.ts +++ b/src/Decoder2.ts @@ -11,10 +11,10 @@ import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as DT from './DecoderT' import * as G from './Guard' -import { Literal, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- -// config +// DecoderT config // ------------------------------------------------------------------------------------- const M = E.getValidation(DE.getSemigroup()) @@ -22,7 +22,7 @@ const fromGuardM = DT.fromGuard(M) const literalM = DT.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) ) -const refinementM = DT.refinement(M) +const refineM = DT.refine(M) // ------------------------------------------------------------------------------------- // model @@ -131,11 +131,8 @@ export const withExpected: ( * @category combinators * @since 2.2.7 */ -export const refinement = ( - from: Decoder, - refinement: (a: A) => a is B, - expected: string -): Decoder => refinementM(from, refinement, (u) => FS.of(DE.leaf(u, expected))) +export const refine = (refinement: (a: A) => a is B, id: string): ((from: Decoder) => Decoder) => + refineM(refinement, (u) => FS.of(DE.leaf(u, id))) /** * @category combinators @@ -308,10 +305,7 @@ export const altDecoder: Alt1 = { * @category instances * @since 2.2.7 */ -export const schemableDecoder: Schemable1 & - WithUnknownContainers1 & - WithUnion1 & - WithRefinement1 = { +export const schemableDecoder: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, literal, string, @@ -329,7 +323,7 @@ export const schemableDecoder: Schemable1 & UnknownArray, UnknownRecord, union: union as WithUnion1['union'], - refinement: refinement as WithRefinement1['refinement'] + refine: refine as WithRefine1['refine'] } // ------------------------------------------------------------------------------------- diff --git a/src/DecoderT.ts b/src/DecoderT.ts index d91a12cc6..8ff271f3e 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -72,11 +72,10 @@ export const withExpected = (M: Monad2C & Bifunctor2(M: MonadThrow2C & Bifunctor2) => ( - from: DecoderT, +export const refine = (M: MonadThrow2C & Bifunctor2) => ( refinement: (a: A) => a is B, onError: (u: unknown) => E -): DecoderT => ({ +) => (from: DecoderT): DecoderT => ({ decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(u)))) }) diff --git a/src/Eq.ts b/src/Eq.ts index 2fbac2008..3393d1e1a 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -4,7 +4,7 @@ import * as A from 'fp-ts/lib/Array' import * as E from 'fp-ts/lib/Eq' import * as R from 'fp-ts/lib/Record' -import { memoize, Schemable1, WithRefinement1, WithUnknownContainers1 } from './Schemable' +import { memoize, Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' import Eq = E.Eq // ------------------------------------------------------------------------------------- @@ -172,7 +172,7 @@ export function lazy(f: () => Eq): Eq { * @category instances * @since 2.2.3 */ -export const schemableEq: Schemable1 & WithUnknownContainers1 & WithRefinement1 = { +export const schemableEq: Schemable1 & WithUnknownContainers1 & WithRefine1 = { URI: E.URI, literal: () => E.eqStrict, string, @@ -189,5 +189,5 @@ export const schemableEq: Schemable1 & WithUnknownContainers1 & Wi lazy: (_, f) => lazy(f), UnknownArray, UnknownRecord, - refinement: (from) => from + refine: () => (from) => from } diff --git a/src/Guard.ts b/src/Guard.ts index d960e436b..1bf2e8930 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -1,7 +1,8 @@ /** * @since 2.2.0 */ -import { Literal, memoize, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import { pipe } from 'fp-ts/lib/pipeable' +import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -88,7 +89,7 @@ export const UnknownRecord: Guard> = { * @category combinators * @since 2.2.0 */ -export const refinement = (from: Guard, refinement: (a: A) => a is B): Guard => ({ +export const refine = (refinement: (a: A) => a is B) => (from: Guard): Guard => ({ is: (u: unknown): u is B => from.is(u) && refinement(u) }) @@ -105,52 +106,64 @@ export const nullable = (or: Guard): Guard => ({ * @since 2.2.0 */ export const type = (properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> => - refinement(UnknownRecord, (r): r is { - [K in keyof A]: A[K] - } => { - for (const k in properties) { - if (!(k in r) || !properties[k].is(r[k])) { - return false + pipe( + UnknownRecord, + refine((r): r is { + [K in keyof A]: A[K] + } => { + for (const k in properties) { + if (!(k in r) || !properties[k].is(r[k])) { + return false + } } - } - return true - }) + return true + }) + ) /** * @category combinators * @since 2.2.0 */ export const partial = (properties: { [K in keyof A]: Guard }): Guard> => - refinement(UnknownRecord, (r): r is Partial => { - for (const k in properties) { - const v = r[k] - if (v !== undefined && !properties[k].is(v)) { - return false + pipe( + UnknownRecord, + refine((r): r is Partial => { + for (const k in properties) { + const v = r[k] + if (v !== undefined && !properties[k].is(v)) { + return false + } } - } - return true - }) + return true + }) + ) /** * @category combinators * @since 2.2.0 */ export const record = (codomain: Guard): Guard> => - refinement(UnknownRecord, (r): r is Record => { - for (const k in r) { - if (!codomain.is(r[k])) { - return false + pipe( + UnknownRecord, + refine((r): r is Record => { + for (const k in r) { + if (!codomain.is(r[k])) { + return false + } } - } - return true - }) + return true + }) + ) /** * @category combinators * @since 2.2.0 */ export const array = (items: Guard): Guard> => - refinement(UnknownArray, (us): us is Array => us.every(items.is)) + pipe( + UnknownArray, + refine((us): us is Array => us.every(items.is)) + ) /** * @category combinators @@ -183,13 +196,16 @@ export const union = ]>( * @since 2.2.0 */ export const sum = (tag: T) => (members: { [K in keyof A]: Guard }): Guard => - refinement(UnknownRecord, (r): r is any => { - const v = r[tag] as keyof A - if (v in members) { - return members[v].is(r) - } - return false - }) + pipe( + UnknownRecord, + refine((r): r is any => { + const v = r[tag] as keyof A + if (v in members) { + return members[v].is(r) + } + return false + }) + ) /** * @category combinators @@ -228,7 +244,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const schemableGuard: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { +export const schemableGuard: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, literal, string, @@ -246,5 +262,5 @@ export const schemableGuard: Schemable1 & WithUnknownContainers1 & Wit UnknownArray, UnknownRecord, union: union as WithUnion1['union'], - refinement: refinement as WithRefinement1['refinement'] + refine: refine as WithRefine1['refine'] } diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index e5cffd71c..758157507 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -5,7 +5,7 @@ import { Invariant1 } from 'fp-ts/lib/Invariant' import * as D from './Decoder' import * as JE from './JsonEncoder' import * as C from './Codec' -import { Literal, Schemable1, WithRefinement1 } from './Schemable' +import { Literal, Schemable1, WithRefine1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -87,11 +87,10 @@ export const withExpected: ( * @category combinators * @since 2.2.3 */ -export const refinement: ( - from: JsonCodec, +export const refine: ( refinement: (a: A) => a is B, - expected: string -) => JsonCodec = C.refinement + id: string +) => (from: JsonCodec) => JsonCodec = C.refine /** * @category combinators @@ -200,7 +199,7 @@ export const invariantJsonCodec: Invariant1 = { * @category instances * @since 2.2.3 */ -export const schemableJsonCodec: Schemable1 & WithRefinement1 = { +export const schemableJsonCodec: Schemable1 & WithRefine1 = { URI, literal, string, @@ -215,5 +214,5 @@ export const schemableJsonCodec: Schemable1 & WithRefinement1 = { intersect, sum, lazy, - refinement: refinement as WithRefinement1['refinement'] + refine: refine as WithRefine1['refine'] } diff --git a/src/Schemable.ts b/src/Schemable.ts index 2ea1b1fb8..c20efef59 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -85,15 +85,15 @@ export interface WithUnion1 { /** * @since 2.2.3 */ -export interface WithRefinement { - readonly refinement: (from: HKT, refinement: (a: A) => a is B, expected: string) => HKT +export interface WithRefine { + readonly refine: (refinement: (a: A) => a is B, id: string) => (from: HKT) => HKT } /** * @since 2.2.3 */ -export interface WithRefinement1 { - readonly refinement: (from: Kind, refinement: (a: A) => a is B, expected: string) => Kind +export interface WithRefine1 { + readonly refine: (refinement: (a: A) => a is B, id: string) => (from: Kind) => Kind } /** diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 2df097ee0..334808bf9 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -13,10 +13,10 @@ import * as DE from './DecodeError' import * as DT from './DecoderT' import * as G from './Guard' import * as D from './Decoder2' -import { Literal, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- -// config +// DecoderT config // ------------------------------------------------------------------------------------- const M = TE.getTaskValidation(DE.getSemigroup()) @@ -24,7 +24,7 @@ const fromGuardM = DT.fromGuard(M) const literalM = DT.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) ) -const refinementM = DT.refinement(M) +const refineM = DT.refine(M) // ------------------------------------------------------------------------------------- // model @@ -149,11 +149,10 @@ export const parse: ( * @category combinators * @since 2.2.7 */ -export const refinement = ( - from: TaskDecoder, +export const refine = ( refinement: (a: A) => a is B, - expected: string -): TaskDecoder => refinementM(from, refinement, (u) => FS.of(DE.leaf(u, expected))) + id: string +): ((from: TaskDecoder) => TaskDecoder) => refineM(refinement, (u) => FS.of(DE.leaf(u, id))) /** * @category combinators @@ -327,7 +326,7 @@ export const altDecoder: Alt1 = { export const schemableTaskDecoder: Schemable1 & WithUnknownContainers1 & WithUnion1 & - WithRefinement1 = { + WithRefine1 = { URI, literal, string, @@ -345,7 +344,7 @@ export const schemableTaskDecoder: Schemable1 & UnknownArray, UnknownRecord, union: union as WithUnion1['union'], - refinement: refinement as WithRefinement1['refinement'] + refine: refine as WithRefine1['refine'] } // ------------------------------------------------------------------------------------- diff --git a/src/Type.ts b/src/Type.ts index 501b569ce..9542d1d9a 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -2,7 +2,7 @@ * @since 2.2.3 */ import * as t from './index' -import { Literal, Schemable1, WithUnion1, WithRefinement1, WithUnknownContainers1 } from './Schemable' +import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -67,9 +67,9 @@ export const UnknownRecord: Type> = t.UnknownRecord * @category combinators * @since 2.2.3 */ -export const refinement = (from: Type, refinement: (a: A) => a is B, expected: string): Type => +export const refine = (refinement: (a: A) => a is B, id: string) => (from: Type): Type => // tslint:disable-next-line: deprecation - t.refinement(from, refinement, expected) as any + t.refinement(from, refinement, id) as any /** * @category combinators @@ -163,7 +163,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const schemableType: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1 = { +export const schemableType: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, literal, string, @@ -181,5 +181,5 @@ export const schemableType: Schemable1 & WithUnknownContainers1 & With UnknownArray, UnknownRecord, union: union as WithUnion1['union'], - refinement: refinement as WithRefinement1['refinement'] + refine: refine as WithRefine1['refine'] } diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 2d192d0f4..c86246e09 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -43,9 +43,8 @@ export const UnknownRecord: Arbitrary> = fc.dictionary(s // combinators // ------------------------------------------------------------------------------------- -export function refinement(from: Arbitrary, refinement: (a: A) => a is B): Arbitrary { - return from.filter(refinement) -} +export const refine = (refinement: (a: A) => a is B) => (from: Arbitrary): Arbitrary => + from.filter(refinement) export function nullable(or: Arbitrary): Arbitrary { return fc.oneof(fc.constant(null), or) @@ -118,7 +117,7 @@ declare module 'fp-ts/lib/HKT' { export const schemableArbitrary: S.Schemable1 & S.WithUnknownContainers1 & S.WithUnion1 & - S.WithRefinement1 = { + S.WithRefine1 = { URI, literal, string, @@ -136,5 +135,5 @@ export const schemableArbitrary: S.Schemable1 & UnknownArray, UnknownRecord, union: union as S.WithUnion1['union'], - refinement: refinement as S.WithRefinement1['refinement'] + refine: refine as S.WithRefine1['refine'] } diff --git a/test/Codec.ts b/test/Codec.ts index 666f6c238..5be13711b 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -17,13 +17,19 @@ interface PositiveBrand { readonly Positive: unique symbol } type Positive = number & PositiveBrand -const Positive: C.Codec = C.refinement(C.number, (n): n is Positive => n > 0, 'Positive') +const Positive: C.Codec = pipe( + C.number, + C.refine((n): n is Positive => n > 0, 'Positive') +) interface IntBrand { readonly Int: unique symbol } type Int = number & IntBrand -const Int: C.Codec = C.refinement(C.number, (n): n is Int => Number.isInteger(n), 'Int') +const Int: C.Codec = pipe( + C.number, + C.refine((n): n is Int => Number.isInteger(n), 'Int') +) const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined @@ -129,15 +135,21 @@ describe('Codec', () => { }) }) - describe('refinement', () => { + describe('refine', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.refinement(C.string, (s): s is string => s.length > 0, 'NonEmptyString') + const codec = pipe( + C.string, + C.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) assert.deepStrictEqual(codec.decode('a'), right('a')) }) it('should reject an invalid input', () => { - const codec = C.refinement(C.string, (s): s is string => s.length > 0, 'NonEmptyString') + const codec = pipe( + C.string, + C.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) assert.deepStrictEqual(codec.decode(undefined), left([D.tree('cannot decode undefined, should be string')])) assert.deepStrictEqual(codec.decode(''), left([D.tree('cannot refine "", should be NonEmptyString')])) }) @@ -145,7 +157,10 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = C.refinement(C.string, (s): s is string => s.length > 0, 'NonEmptyString') + const codec = pipe( + C.string, + C.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) assert.strictEqual(codec.encode('a'), 'a') }) }) diff --git a/test/Decoder2.ts b/test/Decoder2.ts index 29c8e5c9f..271f730e7 100644 --- a/test/Decoder2.ts +++ b/test/Decoder2.ts @@ -23,13 +23,19 @@ interface PositiveBrand { readonly Positive: unique symbol } type Positive = number & PositiveBrand -const Positive: D.Decoder = D.refinement(D.number, (n): n is Positive => n > 0, 'Positive') +const Positive: D.Decoder = pipe( + D.number, + D.refine((n): n is Positive => n > 0, 'Positive') +) interface IntBrand { readonly Int: unique symbol } type Int = number & IntBrand -const Int: D.Decoder = D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') +const Int: D.Decoder = pipe( + D.number, + D.refine((n): n is Int => Number.isInteger(n), 'Int') +) describe('Decoder', () => { // ------------------------------------------------------------------------------------- @@ -382,14 +388,20 @@ describe('Decoder', () => { }) }) - describe('refinement', () => { + describe('refine', () => { it('should decode a valid input', () => { - const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + const decoder = pipe( + D.string, + D.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) assert.deepStrictEqual(decoder.decode('a'), E.right('a')) }) it('should reject an invalid input', () => { - const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + const decoder = pipe( + D.string, + D.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) }) diff --git a/test/Eq.ts b/test/Eq.ts index e2605822f..c7584207a 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -81,12 +81,15 @@ describe('Eq', () => { assert.strictEqual(eq.equals({ _tag: 'B', b: 1 }, { _tag: 'B', b: 2 }), false) }) - it('refinement', () => { + it('refine', () => { interface NonEmptyStringBrand { readonly NonEmptyString: unique symbol } type NonEmptyString = string & NonEmptyStringBrand - const eq = E.schemableEq.refinement(E.string, (s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + const eq = pipe( + E.string, + E.schemableEq.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + ) const a: NonEmptyString = 'a' as any const b: NonEmptyString = 'b' as any assert.deepStrictEqual(eq.equals(a, a), true) diff --git a/test/Guard.ts b/test/Guard.ts index dd9907a6f..ad5c6f91f 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -3,14 +3,20 @@ import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' describe('Guard', () => { - describe('refinement', () => { + describe('refine', () => { it('should accepts valid inputs', () => { - const guard = G.refinement(G.string, (s): s is string => s.length > 0) + const guard = pipe( + G.string, + G.refine((s): s is string => s.length > 0) + ) assert.strictEqual(guard.is('a'), true) }) it('should rejects invalid inputs', () => { - const guard = G.refinement(G.string, (s): s is string => s.length > 0) + const guard = pipe( + G.string, + G.refine((s): s is string => s.length > 0) + ) assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is(''), false) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 02f444a3e..60ca95ba4 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -24,13 +24,19 @@ interface PositiveBrand { readonly Positive: unique symbol } type Positive = number & PositiveBrand -const Positive: D.TaskDecoder = D.refinement(D.number, (n): n is Positive => n > 0, 'Positive') +const Positive: D.TaskDecoder = pipe( + D.number, + D.refine((n): n is Positive => n > 0, 'Positive') +) interface IntBrand { readonly Int: unique symbol } type Int = number & IntBrand -const Int: D.TaskDecoder = D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') +const Int: D.TaskDecoder = pipe( + D.number, + D.refine((n): n is Int => Number.isInteger(n), 'Int') +) describe('TaskDecoder', () => { // ------------------------------------------------------------------------------------- @@ -404,14 +410,20 @@ describe('TaskDecoder', () => { }) }) - describe('refinement', () => { + describe('refine', () => { it('should decode a valid input', async () => { - const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + const decoder = pipe( + D.string, + D.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) }) it('should reject an invalid input', async () => { - const decoder = D.refinement(D.string, (s): s is string => s.length > 0, 'NonEmptyString') + const decoder = pipe( + D.string, + D.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) assert.deepStrictEqual(await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'string')))) assert.deepStrictEqual(await decoder.decode('')(), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) }) diff --git a/test/Type.ts b/test/Type.ts index 7652af40b..81f58e17d 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -192,12 +192,15 @@ describe('Type', () => { ) }) - it('refinement', () => { + it('refine', () => { interface NonEmptyStringBrand { readonly NonEmptyString: unique symbol } type NonEmptyString = string & NonEmptyStringBrand - const type = T.refinement(T.string, (s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + const type = pipe( + T.string, + T.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + ) assert.deepStrictEqual(isRight(type.decode('a')), true) assert.deepStrictEqual(isRight(type.decode('')), false) }) From bc91d4e67ffa9ce75c33258e4a1b298aef6878d9 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 23 Jun 2020 18:33:31 +0200 Subject: [PATCH 071/222] add error API and update docs --- CHANGELOG.md | 1 + README.md | 4 +- docs/modules/Decoder.ts.md | 174 +++++----- docs/modules/Decoder2.ts.md | 427 ----------------------- docs/modules/DecoderT.ts.md | 2 +- docs/modules/Encoder.ts.md | 2 +- docs/modules/Eq.ts.md | 2 +- docs/modules/FreeSemigroup.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 4 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 13 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 2 +- perf/Decoder2.ts | 16 - src/Decoder.ts | 495 ++++++++------------------- src/Decoder2.ts | 359 ------------------- src/DecoderT.ts | 18 +- src/Encoder.ts | 3 +- src/Schemable.ts | 20 ++ src/TaskDecoder.ts | 12 +- test/Arbitrary.ts | 3 +- test/Codec.ts | 200 ++++++----- test/Decoder.ts | 566 ++++++++++++++++++++++++++---- test/Decoder2.ts | 567 ------------------------------- test/DecoderT.ts | 42 --- test/Schemable.ts | 42 +++ 31 files changed, 920 insertions(+), 2070 deletions(-) delete mode 100644 docs/modules/Decoder2.ts.md delete mode 100644 src/Decoder2.ts delete mode 100644 test/Decoder2.ts delete mode 100644 test/DecoderT.ts create mode 100644 test/Schemable.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 153a9ddf1..b8295cdea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - `Decoder` - (**bc**) remove `never` (@gcanti) - (**bc**) make `parse` pipeable and change its `parser` argument (@gcanti) + - (**bc**) change `DecoderError` (@gcanti) - `Guard` - (**bc**) remove `never` (@gcanti) - `Schemable` diff --git a/README.md b/README.md index bc60435b5..f89fd281e 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,12 @@ npm i io-ts fp-ts ## Experimental features (version `2.2+`) -Experimental features are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. +Experimental features (\*) are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - [`Decoder.ts` module](Decoder.md) - [`Encoder.ts` module](Encoder.md) - [`Codec.ts` module](Codec.md) - [`Eq.ts` module](Eq.md) - [`Schema.ts` module (advanced feature)](Schema.md) + +(\*) A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 25830b857..e24f6ef9f 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -6,7 +6,7 @@ parent: Modules ## Decoder overview -Added in v2.2.0 +Added in v2.2.7 --- @@ -15,11 +15,10 @@ Added in v2.2.0 - [Alt](#alt) - [alt](#alt) - [DecodeError](#decodeerror) - - [DecodeError (interface)](#decodeerror-interface) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [error](#error) - [failure](#failure) - - [isNotEmpty](#isnotempty) - [success](#success) - - [tree](#tree) - [Functor](#functor) - [map](#map) - [combinators](#combinators) @@ -39,7 +38,6 @@ Added in v2.2.0 - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) - - [of](#of) - [instances](#instances) - [URI](#uri) - [URI (type alias)](#uri-type-alias) @@ -55,8 +53,8 @@ Added in v2.2.0 - [number](#number) - [string](#string) - [utils](#utils) - - [TypeOf (type alias)](#typeof-type-alias) - [draw](#draw) + - [stringify](#stringify) --- @@ -67,62 +65,52 @@ Added in v2.2.0 **Signature** ```ts -export declare const alt: (that: () => Decoder) => (fa: Decoder) => Decoder +export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 # DecodeError -## DecodeError (interface) +## DecodeError (type alias) **Signature** ```ts -export interface DecodeError extends NonEmptyArray> {} +export type DecodeError = FS.FreeSemigroup> ``` -Added in v2.2.2 +Added in v2.2.7 -## failure +## error **Signature** ```ts -export declare function failure(message: string): Either +export declare function error(actual: unknown, message: string): DecodeError ``` -Added in v2.2.0 +Added in v2.2.7 -## isNotEmpty +## failure **Signature** ```ts -export declare function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray +export declare function failure(actual: unknown, message: string): E.Either ``` -Added in v2.2.2 +Added in v2.2.7 ## success **Signature** ```ts -export declare function success(a: A): Either -``` - -Added in v2.2.0 - -## tree - -**Signature** - -```ts -export declare function tree(value: A, forest: Forest = empty): Tree +export declare function success(a: A): E.Either ``` -Added in v2.2.0 +Added in v2.2.7 # Functor @@ -134,7 +122,7 @@ Added in v2.2.0 export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 # combinators @@ -143,10 +131,10 @@ Added in v2.2.0 **Signature** ```ts -export declare function array(items: Decoder): Decoder> +export declare const array: (items: Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## intersect @@ -156,59 +144,61 @@ Added in v2.2.0 export declare const intersect: (right: Decoder) => (left: Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## lazy **Signature** ```ts -export declare function lazy(id: string, f: () => Decoder): Decoder +export declare const lazy: (id: string, f: () => Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## nullable **Signature** ```ts -export declare function nullable(or: Decoder): Decoder +export declare const nullable: (or: Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## parse **Signature** ```ts -export declare function parse(from: Decoder, parser: (a: A) => Either): Decoder +export declare const parse: ( + parser: (a: A) => E.Either>, B> +) => (from: Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## partial **Signature** ```ts -export declare function partial( +export declare const partial: ( properties: { [K in keyof A]: Decoder } -): Decoder> +) => Decoder> ``` -Added in v2.2.0 +Added in v2.2.7 ## record **Signature** ```ts -export declare function record(codomain: Decoder): Decoder> +export declare const record: (codomain: Decoder) => Decoder> ``` -Added in v2.2.0 +Added in v2.2.7 ## refine @@ -221,66 +211,66 @@ export declare const refine: ( ) => (from: Decoder) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## sum **Signature** ```ts -export declare function sum( +export declare const sum: ( tag: T -): (members: { [K in keyof A]: Decoder }) => Decoder +) => (members: { [K in keyof A]: Decoder }) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## tuple **Signature** ```ts -export declare function tuple>( +export declare const tuple: ( ...components: { [K in keyof A]: Decoder } -): Decoder +) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## type **Signature** ```ts -export declare function type(properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> +export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> ``` -Added in v2.2.0 +Added in v2.2.7 ## union **Signature** ```ts -export declare function union]>( +export declare const union: ( ...members: { [K in keyof A]: Decoder } -): Decoder +) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## withExpected **Signature** ```ts -export declare function withExpected( +export declare const withExpected: ( decoder: Decoder, - expected: (actual: unknown, e: DecodeError) => DecodeError -): Decoder + expected: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 # constructors @@ -289,10 +279,10 @@ Added in v2.2.0 **Signature** ```ts -export declare function fromGuard(guard: G.Guard, expected: string): Decoder +export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## literal @@ -302,17 +292,7 @@ Added in v2.2.0 export declare const literal: (...values: A) => Decoder ``` -Added in v2.2.0 - -## of - -**Signature** - -```ts -export declare function of(a: A): Decoder -``` - -Added in v2.2.3 +Added in v2.2.7 # instances @@ -321,10 +301,10 @@ Added in v2.2.3 **Signature** ```ts -export declare const URI: 'io-ts/Decoder' +export declare const URI: 'io-ts/Decoder2' ``` -Added in v2.2.0 +Added in v2.2.7 ## URI (type alias) @@ -334,40 +314,40 @@ Added in v2.2.0 export type URI = typeof URI ``` -Added in v2.2.0 +Added in v2.2.7 ## altDecoder **Signature** ```ts -export declare const altDecoder: Alt1<'io-ts/Decoder'> +export declare const altDecoder: Alt1<'io-ts/Decoder2'> ``` -Added in v2.2.3 +Added in v2.2.7 ## functorDecoder **Signature** ```ts -export declare const functorDecoder: Functor1<'io-ts/Decoder'> +export declare const functorDecoder: Functor1<'io-ts/Decoder2'> ``` -Added in v2.2.3 +Added in v2.2.7 ## schemableDecoder **Signature** ```ts -export declare const schemableDecoder: Schemable1<'io-ts/Decoder'> & - WithUnknownContainers1<'io-ts/Decoder'> & - WithUnion1<'io-ts/Decoder'> & - WithRefine1<'io-ts/Decoder'> +export declare const schemableDecoder: Schemable1<'io-ts/Decoder2'> & + WithUnknownContainers1<'io-ts/Decoder2'> & + WithUnion1<'io-ts/Decoder2'> & + WithRefine1<'io-ts/Decoder2'> ``` -Added in v2.2.3 +Added in v2.2.7 # model @@ -377,11 +357,11 @@ Added in v2.2.3 ```ts export interface Decoder { - readonly decode: (u: unknown) => Either + readonly decode: (u: unknown) => E.Either } ``` -Added in v2.2.0 +Added in v2.2.7 # primitives @@ -393,7 +373,7 @@ Added in v2.2.0 export declare const UnknownArray: Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## UnknownRecord @@ -403,7 +383,7 @@ Added in v2.2.0 export declare const UnknownRecord: Decoder> ``` -Added in v2.2.0 +Added in v2.2.7 ## boolean @@ -413,7 +393,7 @@ Added in v2.2.0 export declare const boolean: Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## number @@ -423,7 +403,7 @@ Added in v2.2.0 export declare const number: Decoder ``` -Added in v2.2.0 +Added in v2.2.7 ## string @@ -433,26 +413,26 @@ Added in v2.2.0 export declare const string: Decoder ``` -Added in v2.2.0 +Added in v2.2.7 # utils -## TypeOf (type alias) +## draw **Signature** ```ts -export type TypeOf = D extends Decoder ? A : never +export declare const draw: (e: FS.FreeSemigroup>) => string ``` -Added in v2.2.0 +Added in v2.2.7 -## draw +## stringify **Signature** ```ts -export declare const draw: (e: DecodeError) => string +export declare const stringify: (e: E.Either>, A>) => string ``` Added in v2.2.7 diff --git a/docs/modules/Decoder2.ts.md b/docs/modules/Decoder2.ts.md deleted file mode 100644 index 006bc8e51..000000000 --- a/docs/modules/Decoder2.ts.md +++ /dev/null @@ -1,427 +0,0 @@ ---- -title: Decoder2.ts -nav_order: 4 -parent: Modules ---- - -## Decoder2 overview - -Added in v2.2.7 - ---- - -

Table of contents

- -- [Alt](#alt) - - [alt](#alt) -- [DecodeError](#decodeerror) - - [DecodeError (type alias)](#decodeerror-type-alias) - - [failure](#failure) - - [success](#success) -- [Functor](#functor) - - [map](#map) -- [combinators](#combinators) - - [array](#array) - - [intersect](#intersect) - - [lazy](#lazy) - - [nullable](#nullable) - - [parse](#parse) - - [partial](#partial) - - [record](#record) - - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) - - [union](#union) - - [withExpected](#withexpected) -- [constructors](#constructors) - - [fromGuard](#fromguard) - - [literal](#literal) -- [instances](#instances) - - [URI](#uri) - - [URI (type alias)](#uri-type-alias) - - [altDecoder](#altdecoder) - - [functorDecoder](#functordecoder) - - [schemableDecoder](#schemabledecoder) -- [model](#model) - - [Decoder (interface)](#decoder-interface) -- [primitives](#primitives) - - [UnknownArray](#unknownarray) - - [UnknownRecord](#unknownrecord) - - [boolean](#boolean) - - [number](#number) - - [string](#string) -- [utils](#utils) - - [draw](#draw) - - [stringify](#stringify) - ---- - -# Alt - -## alt - -**Signature** - -```ts -export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder -``` - -Added in v2.2.7 - -# DecodeError - -## DecodeError (type alias) - -**Signature** - -```ts -export type DecodeError = FS.FreeSemigroup> -``` - -Added in v2.2.7 - -## failure - -**Signature** - -```ts -export declare function failure(actual: unknown, message: string): E.Either -``` - -Added in v2.2.7 - -## success - -**Signature** - -```ts -export declare function success(a: A): E.Either -``` - -Added in v2.2.7 - -# Functor - -## map - -**Signature** - -```ts -export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder -``` - -Added in v2.2.7 - -# combinators - -## array - -**Signature** - -```ts -export declare const array: (items: Decoder) => Decoder -``` - -Added in v2.2.7 - -## intersect - -**Signature** - -```ts -export declare const intersect: (right: Decoder) => (left: Decoder) => Decoder -``` - -Added in v2.2.7 - -## lazy - -**Signature** - -```ts -export declare const lazy: (id: string, f: () => Decoder) => Decoder -``` - -Added in v2.2.7 - -## nullable - -**Signature** - -```ts -export declare const nullable: (or: Decoder) => Decoder -``` - -Added in v2.2.7 - -## parse - -**Signature** - -```ts -export declare const parse: ( - parser: (a: A) => E.Either>, B> -) => (from: Decoder) => Decoder -``` - -Added in v2.2.7 - -## partial - -**Signature** - -```ts -export declare const partial: ( - properties: { [K in keyof A]: Decoder } -) => Decoder> -``` - -Added in v2.2.7 - -## record - -**Signature** - -```ts -export declare const record: (codomain: Decoder) => Decoder> -``` - -Added in v2.2.7 - -## refine - -**Signature** - -```ts -export declare const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: Decoder) => Decoder -``` - -Added in v2.2.7 - -## sum - -**Signature** - -```ts -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: Decoder }) => Decoder -``` - -Added in v2.2.7 - -## tuple - -**Signature** - -```ts -export declare const tuple: ( - ...components: { [K in keyof A]: Decoder } -) => Decoder -``` - -Added in v2.2.7 - -## type - -**Signature** - -```ts -export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> -``` - -Added in v2.2.7 - -## union - -**Signature** - -```ts -export declare const union: ( - ...members: { [K in keyof A]: Decoder } -) => Decoder -``` - -Added in v2.2.7 - -## withExpected - -**Signature** - -```ts -export declare const withExpected: ( - decoder: Decoder, - expected: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => Decoder -``` - -Added in v2.2.7 - -# constructors - -## fromGuard - -**Signature** - -```ts -export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder -``` - -Added in v2.2.7 - -## literal - -**Signature** - -```ts -export declare const literal: (...values: A) => Decoder -``` - -Added in v2.2.7 - -# instances - -## URI - -**Signature** - -```ts -export declare const URI: 'io-ts/Decoder2' -``` - -Added in v2.2.7 - -## URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.7 - -## altDecoder - -**Signature** - -```ts -export declare const altDecoder: Alt1<'io-ts/Decoder2'> -``` - -Added in v2.2.7 - -## functorDecoder - -**Signature** - -```ts -export declare const functorDecoder: Functor1<'io-ts/Decoder2'> -``` - -Added in v2.2.7 - -## schemableDecoder - -**Signature** - -```ts -export declare const schemableDecoder: Schemable1<'io-ts/Decoder2'> & - WithUnknownContainers1<'io-ts/Decoder2'> & - WithUnion1<'io-ts/Decoder2'> & - WithRefine1<'io-ts/Decoder2'> -``` - -Added in v2.2.7 - -# model - -## Decoder (interface) - -**Signature** - -```ts -export interface Decoder { - readonly decode: (u: unknown) => E.Either -} -``` - -Added in v2.2.7 - -# primitives - -## UnknownArray - -**Signature** - -```ts -export declare const UnknownArray: Decoder -``` - -Added in v2.2.7 - -## UnknownRecord - -**Signature** - -```ts -export declare const UnknownRecord: Decoder> -``` - -Added in v2.2.7 - -## boolean - -**Signature** - -```ts -export declare const boolean: Decoder -``` - -Added in v2.2.7 - -## number - -**Signature** - -```ts -export declare const number: Decoder -``` - -Added in v2.2.7 - -## string - -**Signature** - -```ts -export declare const string: Decoder -``` - -Added in v2.2.7 - -# utils - -## draw - -**Signature** - -```ts -export declare const draw: (e: FS.FreeSemigroup>) => string -``` - -Added in v2.2.7 - -## stringify - -**Signature** - -```ts -export declare const stringify: (e: E.Either>, A>) => string -``` - -Added in v2.2.7 diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 4721ab950..ffe0e08cb 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -1,6 +1,6 @@ --- title: DecoderT.ts -nav_order: 5 +nav_order: 4 parent: Modules --- diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index c59dca916..74cb8d79e 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -1,6 +1,6 @@ --- title: Encoder.ts -nav_order: 6 +nav_order: 5 parent: Modules --- diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 52f46128b..5e3add0cf 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -1,6 +1,6 @@ --- title: Eq.ts -nav_order: 7 +nav_order: 6 parent: Modules --- diff --git a/docs/modules/FreeSemigroup.ts.md b/docs/modules/FreeSemigroup.ts.md index d89229887..4ebe5a8a3 100644 --- a/docs/modules/FreeSemigroup.ts.md +++ b/docs/modules/FreeSemigroup.ts.md @@ -1,6 +1,6 @@ --- title: FreeSemigroup.ts -nav_order: 8 +nav_order: 7 parent: Modules --- diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index bed939b30..e00814754 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -1,6 +1,6 @@ --- title: Guard.ts -nav_order: 9 +nav_order: 8 parent: Modules --- diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index c590aacaa..d3d6adc8d 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -1,6 +1,6 @@ --- title: JsonCodec.ts -nav_order: 11 +nav_order: 10 parent: Modules --- @@ -175,7 +175,7 @@ Added in v2.2.3 ```ts export declare const withExpected: ( codec: JsonCodec, - expected: (actual: unknown, e: D.DecodeError) => D.DecodeError + expected: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> ) => JsonCodec ``` diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index fbb558882..2f5f1c71e 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 12 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 1db8dde68..2abc64ffe 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 13 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 175cf05b2..5aea2ce60 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 14 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index d9068def7..ec28e2aad 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 15 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 5710aaeb2..ccc6bbf89 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 16 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 24813c9ff..f3d30a4fc 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 17 +nav_order: 16 parent: Modules --- @@ -16,6 +16,7 @@ Added in v2.2.7 - [alt](#alt) - [DecodeError](#decodeerror) - [DecodeError (type alias)](#decodeerror-type-alias) + - [error](#error) - [failure](#failure) - [success](#success) - [Functor](#functor) @@ -82,6 +83,16 @@ export type DecodeError = FS.FreeSemigroup> Added in v2.2.7 +## error + +**Signature** + +```ts +export declare function error(actual: unknown, message: string): DecodeError +``` + +Added in v2.2.7 + ## failure **Signature** diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 1c92d118f..dc35af2f9 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 18 +nav_order: 17 parent: Modules --- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 91cf925cc..0ee2410e8 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 10 +nav_order: 9 parent: Modules --- diff --git a/perf/Decoder2.ts b/perf/Decoder2.ts index 3000106ac..34e26d03d 100644 --- a/perf/Decoder2.ts +++ b/perf/Decoder2.ts @@ -2,7 +2,6 @@ import * as Benchmark from 'benchmark' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import * as D from '../src/Decoder' -import * as D2 from '../src/Decoder2' import * as G from '../src/Guard' /* @@ -23,11 +22,6 @@ const decoder = D.type({ age: D.number }) -const decoder2 = D2.type({ - name: D2.string, - age: D2.number -}) - const guard = G.type({ name: G.string, age: G.number @@ -41,7 +35,6 @@ const good = { const bad = {} // console.log(decoder.decode(bad)) -// console.log(decoder2.decode(bad)) // console.log(JSON.stringify(freeDecoder.decode(bad), null, 2)) const suite = new Benchmark.Suite() @@ -53,24 +46,15 @@ suite .add('Decoder (good)', function () { decoder.decode(good) }) - .add('Decoder2 (good)', function () { - decoder2.decode(good) - }) .add('Guard (bad)', function () { guard.is(bad) }) .add('Decoder (bad)', function () { decoder.decode(bad) }) - .add('Decoder2 (bad)', function () { - decoder2.decode(bad) - }) .add('Decoder (draw)', function () { pipe(decoder.decode(bad), E.mapLeft(D.draw)) }) - .add('Decoder2 (draw)', function () { - pipe(decoder2.decode(bad), E.mapLeft(D2.draw)) - }) .on('cycle', function (event: any) { console.log(String(event.target)) }) diff --git a/src/Decoder.ts b/src/Decoder.ts index a79523efa..4b11d8d1a 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -1,37 +1,40 @@ /** - * @since 2.2.0 + * @since 2.2.7 */ import { Alt1 } from 'fp-ts/lib/Alt' import * as E from 'fp-ts/lib/Either' import { Functor1 } from 'fp-ts/lib/Functor' -import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray' +import * as NEA from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' -import { drawTree, Forest, Tree } from 'fp-ts/lib/Tree' +import * as T from 'fp-ts/lib/Tree' +import * as FS from './FreeSemigroup' +import * as DE from './DecodeError' +import * as DT from './DecoderT' import * as G from './Guard' -import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- -// model +// DecoderT config // ------------------------------------------------------------------------------------- -import Either = E.Either - -/** - * @category model - * @since 2.2.0 - */ -export interface Decoder { - readonly decode: (u: unknown) => Either -} +const M = E.getValidation(DE.getSemigroup()) +const fromGuardM = DT.fromGuard(M) +const literalM = DT.literal(M)((u, values) => + FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) +) +const refineM = DT.refine(M) // ------------------------------------------------------------------------------------- -// utils +// model // ------------------------------------------------------------------------------------- /** - * @since 2.2.0 + * @category model + * @since 2.2.7 */ -export type TypeOf = D extends Decoder ? A : never +export interface Decoder { + readonly decode: (u: unknown) => E.Either +} // ------------------------------------------------------------------------------------- // DecodeError @@ -39,45 +42,32 @@ export type TypeOf = D extends Decoder ? A : never /** * @category DecodeError - * @since 2.2.2 + * @since 2.2.7 */ -export interface DecodeError extends NonEmptyArray> {} - -const empty: Array = [] +export type DecodeError = FS.FreeSemigroup> /** * @category DecodeError - * @since 2.2.0 + * @since 2.2.7 */ -export function tree(value: A, forest: Forest = empty): Tree { - return { - value, - forest - } +export function error(actual: unknown, message: string): DecodeError { + return FS.of(DE.leaf(actual, message)) } /** * @category DecodeError - * @since 2.2.0 + * @since 2.2.7 */ -export function success(a: A): Either { +export function success(a: A): E.Either { return E.right(a) } /** * @category DecodeError - * @since 2.2.0 - */ -export function failure(message: string): Either { - return E.left([tree(message)]) -} - -/** - * @category DecodeError - * @since 2.2.2 + * @since 2.2.7 */ -export function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray { - return as.length > 0 +export function failure(actual: unknown, message: string): E.Either { + return E.left(error(actual, message)) } // ------------------------------------------------------------------------------------- @@ -86,30 +76,17 @@ export function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray { /** * @category constructors - * @since 2.2.3 - */ -export function of(a: A): Decoder { - return { - decode: () => success(a) - } -} - -/** - * @category constructors - * @since 2.2.0 + * @since 2.2.7 */ -export function fromGuard(guard: G.Guard, expected: string): Decoder { - return { - decode: (u) => (guard.is(u) ? success(u) : failure(`cannot decode ${JSON.stringify(u)}, should be ${expected}`)) - } -} +export const fromGuard = (guard: G.Guard, expected: string): Decoder => + fromGuardM(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors - * @since 2.2.0 + * @since 2.2.7 */ export const literal = ]>(...values: A): Decoder => - fromGuard(G.literal(...values), values.map((value) => JSON.stringify(value)).join(' | ')) + literalM(...values) // ------------------------------------------------------------------------------------- // primitives @@ -117,31 +94,31 @@ export const literal = ]>(...valu /** * @category primitives - * @since 2.2.0 + * @since 2.2.7 */ export const string: Decoder = fromGuard(G.string, 'string') /** * @category primitives - * @since 2.2.0 + * @since 2.2.7 */ export const number: Decoder = fromGuard(G.number, 'number') /** * @category primitives - * @since 2.2.0 + * @since 2.2.7 */ export const boolean: Decoder = fromGuard(G.boolean, 'boolean') /** * @category primitives - * @since 2.2.0 + * @since 2.2.7 */ export const UnknownArray: Decoder> = fromGuard(G.UnknownArray, 'Array') /** * @category primitives - * @since 2.2.0 + * @since 2.2.7 */ export const UnknownRecord: Decoder> = fromGuard(G.UnknownRecord, 'Record') @@ -151,333 +128,128 @@ export const UnknownRecord: Decoder> = fromGuard(G.Unkno /** * @category combinators - * @since 2.2.0 + * @since 2.2.7 */ -export function withExpected( +export const withExpected: ( decoder: Decoder, expected: (actual: unknown, e: DecodeError) => DecodeError -): Decoder { - return { - decode: (u) => - pipe( - decoder.decode(u), - E.mapLeft((nea) => expected(u, nea)) - ) - } -} +) => Decoder = DT.withExpected(M) /** * @category combinators - * @since 2.2.0 - */ -export const refine = (refinement: (a: A) => a is B, id: string) => (from: Decoder): Decoder => ({ - decode: (u) => { - const e = from.decode(u) - if (E.isLeft(e)) { - return e - } - const a = e.right - return refinement(a) ? success(a) : failure(`cannot refine ${JSON.stringify(u)}, should be ${id}`) - } -}) + * @since 2.2.7 + */ +export const refine = (refinement: (a: A) => a is B, id: string): ((from: Decoder) => Decoder) => + refineM(refinement, (u) => FS.of(DE.leaf(u, id))) /** * @category combinators - * @since 2.2.0 - */ -export function parse(from: Decoder, parser: (a: A) => Either): Decoder { - return { - decode: (u) => { - const e = from.decode(u) - if (E.isLeft(e)) { - return e - } - return parser(e.right) - } - } -} + * @since 2.2.7 + */ +export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = DT.parse(M) /** * @category combinators - * @since 2.2.0 + * @since 2.2.7 */ -export function nullable(or: Decoder): Decoder { - return union(literal(null), or) -} +export const nullable: (or: Decoder) => Decoder = DT.nullable(M)((u, e) => + FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e))) +) /** * @category combinators - * @since 2.2.0 - */ -export function type(properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> { - return { - decode: (u) => { - const e = UnknownRecord.decode(u) - if (E.isLeft(e)) { - return e - } else { - const r = e.right - const a: Partial = {} - const errors: Array> = [] - for (const k in properties) { - const e = properties[k].decode(r[k]) - if (E.isLeft(e)) { - errors.push(tree(`required property ${JSON.stringify(k)}`, e.left)) - } else { - a[k] = e.right - } - } - return isNotEmpty(errors) ? E.left(errors) : success(a as A) - } - } - } -} + * @since 2.2.7 + */ +export const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> = DT.type( + M +)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) /** * @category combinators - * @since 2.2.0 - */ -export function partial(properties: { [K in keyof A]: Decoder }): Decoder> { - return { - decode: (u) => { - const e = UnknownRecord.decode(u) - if (E.isLeft(e)) { - return e - } else { - const r = e.right - const a: Partial = {} - const errors: Array> = [] - for (const k in properties) { - // don't add missing properties - if (k in r) { - const rk = r[k] - // don't strip undefined properties - if (rk === undefined) { - a[k] = undefined - } else { - const e = properties[k].decode(rk) - if (E.isLeft(e)) { - errors.push(tree(`optional property ${JSON.stringify(k)}`, e.left)) - } else { - a[k] = e.right - } - } - } - } - return isNotEmpty(errors) ? E.left(errors) : success(a) - } - } - } -} + * @since 2.2.7 + */ +export const partial: ( + properties: { [K in keyof A]: Decoder } +) => Decoder> = DT.partial(M)(UnknownRecord, (k, e) => + FS.of(DE.key(k, DE.optional, e)) +) /** * @category combinators - * @since 2.2.0 - */ -export function record(codomain: Decoder): Decoder> { - return { - decode: (u) => { - const e = UnknownRecord.decode(u) - if (E.isLeft(e)) { - return e - } else { - const r = e.right - const a: Record = {} - const errors: Array> = [] - for (const k in r) { - const e = codomain.decode(r[k]) - if (E.isLeft(e)) { - errors.push(tree(`key ${JSON.stringify(k)}`, e.left)) - } else { - a[k] = e.right - } - } - return isNotEmpty(errors) ? E.left(errors) : success(a) - } - } - } -} + * @since 2.2.7 + */ +export const array: (items: Decoder) => Decoder> = DT.array(M)(UnknownArray, (i, e) => + FS.of(DE.index(i, DE.optional, e)) +) /** * @category combinators - * @since 2.2.0 - */ -export function array(items: Decoder): Decoder> { - return { - decode: (u) => { - const e = UnknownArray.decode(u) - if (E.isLeft(e)) { - return e - } else { - const us = e.right - const len = us.length - const a: Array = new Array(len) - const errors: Array> = [] - for (let i = 0; i < len; i++) { - const e = items.decode(us[i]) - if (E.isLeft(e)) { - errors.push(tree(`optional index ${i}`, e.left)) - } else { - a[i] = e.right - } - } - return isNotEmpty(errors) ? E.left(errors) : success(a) - } - } - } -} + * @since 2.2.7 + */ +export const record: (codomain: Decoder) => Decoder> = DT.record(M)(UnknownRecord, (k, e) => + FS.of(DE.key(k, DE.optional, e)) +) /** * @category combinators - * @since 2.2.0 - */ -export function tuple>(...components: { [K in keyof A]: Decoder }): Decoder { - return { - decode: (u) => { - const e = UnknownArray.decode(u) - if (E.isLeft(e)) { - return e - } - const us = e.right - const a: Array = [] - const errors: Array> = [] - for (let i = 0; i < components.length; i++) { - const e = components[i].decode(us[i]) - if (E.isLeft(e)) { - errors.push(tree(`required index ${i}`, e.left)) - } else { - a.push(e.right) - } - } - return isNotEmpty(errors) ? E.left(errors) : success(a as any) - } - } -} - -function typeOf(x: unknown): string { - return x === null ? 'null' : typeof x -} - -/** - * @internal + * @since 2.2.7 */ -export function intersect_(a: A, b: B): A & B { - if (a !== undefined && b !== undefined) { - const tx = typeOf(a) - const ty = typeOf(b) - if (tx === 'object' || ty === 'object') { - return Object.assign({}, a, b) - } - } - return b as any -} +export const tuple: >( + ...components: { [K in keyof A]: Decoder } +) => Decoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any /** * @category combinators - * @since 2.2.0 - */ -export const intersect = (right: Decoder) => (left: Decoder): Decoder => ({ - decode: (u) => { - const ea = left.decode(u) - const eb = right.decode(u) - if (E.isLeft(ea)) { - return E.isLeft(eb) ? E.left(ea.left.concat(eb.left) as DecodeError) : ea - } - if (E.isLeft(eb)) { - return eb - } - return success(intersect_(ea.right, eb.right)) - } -}) + * @since 2.2.7 + */ +export const union: ]>( + ...members: { [K in keyof A]: Decoder } +) => Decoder = DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators - * @since 2.2.0 - */ -export function lazy(id: string, f: () => Decoder): Decoder { - const get = memoize>(f) - return { - decode: (u) => - pipe( - get().decode(u), - E.mapLeft((nea) => [tree(id, nea)]) - ) - } -} + * @since 2.2.7 + */ +export const intersect: (right: Decoder) => (left: Decoder) => Decoder = DT.intersect(M) /** * @category combinators - * @since 2.2.0 - */ -export function sum(tag: T): (members: { [K in keyof A]: Decoder }) => Decoder { - return (members: { [K in keyof A]: Decoder }) => { - const keys = Object.keys(members) - const expected = keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ') - return { - decode: (u) => { - const e = UnknownRecord.decode(u) - if (E.isLeft(e)) { - return e - } - const v = e.right[tag] as keyof A - if (v in members) { - return members[v].decode(u) - } - return E.left([ - tree(`required property ${JSON.stringify(tag)}`, [ - tree(`cannot decode ${JSON.stringify(v)}, should be ${expected}`) - ]) - ]) - } - } - } -} + * @since 2.2.7 + */ +export const sum: ( + tag: T +) => (members: { [K in keyof A]: Decoder }) => Decoder = DT.sum(M)( + UnknownRecord, + (tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) + ) + ) +) /** * @category combinators - * @since 2.2.0 + * @since 2.2.7 */ -export function union]>( - ...members: { [K in keyof A]: Decoder } -): Decoder { - const len = members.length - return { - decode: (u) => { - const e = members[0].decode(u) - if (E.isRight(e)) { - return e - } else { - const errors: DecodeError = [tree(`member 0`, e.left)] - for (let i = 1; i < len; i++) { - const e = members[i].decode(u) - if (E.isRight(e)) { - return e - } else { - errors.push(tree(`member ${i}`, e.left)) - } - } - return E.left(errors) - } - } - } -} +export const lazy: (id: string, f: () => Decoder) => Decoder = DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables // ------------------------------------------------------------------------------------- const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ - decode: (u) => { - const e = fa.decode(u) - return E.isLeft(e) ? e : E.right(f(e.right)) - } + decode: (u) => pipe(fa.decode(u), E.map(f)) }) -const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) => ({ - decode: (u) => { - const e = fx.decode(u) - return E.isLeft(e) ? fy().decode(u) : e - } +const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, that) => ({ + decode: (u) => + pipe( + me.decode(u), + E.alt(() => that().decode(u)) + ) }) // ------------------------------------------------------------------------------------- @@ -486,15 +258,15 @@ const alt_: (fx: Decoder, fy: () => Decoder) => Decoder = (fx, fy) = /** * @category Functor - * @since 2.2.0 + * @since 2.2.7 */ export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) /** * @category Alt - * @since 2.2.0 + * @since 2.2.7 */ -export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) +export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) // ------------------------------------------------------------------------------------- // instances @@ -502,13 +274,13 @@ export const alt: (that: () => Decoder) => (fa: Decoder) => Decoder /** * @category instances - * @since 2.2.0 + * @since 2.2.7 */ -export const URI = 'io-ts/Decoder' +export const URI = 'io-ts/Decoder2' /** * @category instances - * @since 2.2.0 + * @since 2.2.7 */ export type URI = typeof URI @@ -520,7 +292,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.3 + * @since 2.2.7 */ export const functorDecoder: Functor1 = { URI, @@ -529,7 +301,7 @@ export const functorDecoder: Functor1 = { /** * @category instances - * @since 2.2.3 + * @since 2.2.7 */ export const altDecoder: Alt1 = { URI, @@ -539,7 +311,7 @@ export const altDecoder: Alt1 = { /** * @category instances - * @since 2.2.3 + * @since 2.2.7 */ export const schemableDecoder: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, @@ -566,11 +338,30 @@ export const schemableDecoder: Schemable1 & WithUnknownContainers1 & W // utils // ------------------------------------------------------------------------------------- -const toForest = (e: DecodeError): NonEmptyArray> => { - return e +const toForest = (e: DecodeError): NEA.NonEmptyArray> => { + const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ + Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), + Member: (index, errors) => T.make(`member ${index}`, toForest(errors)), + Lazy: (id, errors) => T.make(`lazy type ${id}`, toForest(errors)) + }) + const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( + (value) => [toTree(value)], + (left, right) => NEA.concat(toForest(left), toForest(right)) + ) + return toForest(e) } /** * @since 2.2.7 */ -export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') +export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') + +/** + * @since 2.2.7 + */ +export const stringify: (e: E.Either) => string = E.fold( + (e) => draw(e), + (a) => JSON.stringify(a, null, 2) +) diff --git a/src/Decoder2.ts b/src/Decoder2.ts deleted file mode 100644 index cb4d7e1b3..000000000 --- a/src/Decoder2.ts +++ /dev/null @@ -1,359 +0,0 @@ -/** - * @since 2.2.7 - */ -import { Alt1 } from 'fp-ts/lib/Alt' -import * as E from 'fp-ts/lib/Either' -import { Functor1 } from 'fp-ts/lib/Functor' -import * as NEA from 'fp-ts/lib/NonEmptyArray' -import { pipe } from 'fp-ts/lib/pipeable' -import * as T from 'fp-ts/lib/Tree' -import * as FS from '../src/FreeSemigroup' -import * as DE from './DecodeError' -import * as DT from './DecoderT' -import * as G from './Guard' -import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' - -// ------------------------------------------------------------------------------------- -// DecoderT config -// ------------------------------------------------------------------------------------- - -const M = E.getValidation(DE.getSemigroup()) -const fromGuardM = DT.fromGuard(M) -const literalM = DT.literal(M)((u, values) => - FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) -) -const refineM = DT.refine(M) - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @category model - * @since 2.2.7 - */ -export interface Decoder { - readonly decode: (u: unknown) => E.Either -} - -// ------------------------------------------------------------------------------------- -// DecodeError -// ------------------------------------------------------------------------------------- - -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = FS.FreeSemigroup> - -/** - * @category DecodeError - * @since 2.2.7 - */ -export function success(a: A): E.Either { - return E.right(a) -} - -/** - * @category DecodeError - * @since 2.2.7 - */ -export function failure(actual: unknown, message: string): E.Either { - return E.left(FS.of(DE.leaf(actual, message))) -} - -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromGuard = (guard: G.Guard, expected: string): Decoder => - fromGuardM(guard, (u) => FS.of(DE.leaf(u, expected))) - -/** - * @category constructors - * @since 2.2.7 - */ -export const literal = ]>(...values: A): Decoder => - literalM(...values) - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.7 - */ -export const string: Decoder = fromGuard(G.string, 'string') - -/** - * @category primitives - * @since 2.2.7 - */ -export const number: Decoder = fromGuard(G.number, 'number') - -/** - * @category primitives - * @since 2.2.7 - */ -export const boolean: Decoder = fromGuard(G.boolean, 'boolean') - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownArray: Decoder> = fromGuard(G.UnknownArray, 'Array') - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownRecord: Decoder> = fromGuard(G.UnknownRecord, 'Record') - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.7 - */ -export const withExpected: ( - decoder: Decoder, - expected: (actual: unknown, e: DecodeError) => DecodeError -) => Decoder = DT.withExpected(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const refine = (refinement: (a: A) => a is B, id: string): ((from: Decoder) => Decoder) => - refineM(refinement, (u) => FS.of(DE.leaf(u, id))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = DT.parse(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const nullable: (or: Decoder) => Decoder = DT.nullable(M)((u, e) => - FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e))) -) - -/** - * @category combinators - * @since 2.2.7 - */ -export const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> = DT.type( - M -)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const partial: ( - properties: { [K in keyof A]: Decoder } -) => Decoder> = DT.partial(M)(UnknownRecord, (k, e) => - FS.of(DE.key(k, DE.optional, e)) -) - -/** - * @category combinators - * @since 2.2.7 - */ -export const array: (items: Decoder) => Decoder> = DT.array(M)(UnknownArray, (i, e) => - FS.of(DE.index(i, DE.optional, e)) -) - -/** - * @category combinators - * @since 2.2.7 - */ -export const record: (codomain: Decoder) => Decoder> = DT.record(M)(UnknownRecord, (k, e) => - FS.of(DE.key(k, DE.optional, e)) -) - -/** - * @category combinators - * @since 2.2.7 - */ -export const tuple: >( - ...components: { [K in keyof A]: Decoder } -) => Decoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const union: ]>( - ...members: { [K in keyof A]: Decoder } -) => Decoder = DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const intersect: (right: Decoder) => (left: Decoder) => Decoder = DT.intersect(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const sum: ( - tag: T -) => (members: { [K in keyof A]: Decoder }) => Decoder = DT.sum(M)( - UnknownRecord, - (tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) - ) - ) -) - -/** - * @category combinators - * @since 2.2.7 - */ -export const lazy: (id: string, f: () => Decoder) => Decoder = DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) - -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- - -const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ - decode: (u) => pipe(fa.decode(u), E.map(f)) -}) - -const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, that) => ({ - decode: (u) => - pipe( - me.decode(u), - E.alt(() => that().decode(u)) - ) -}) - -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- - -/** - * @category Functor - * @since 2.2.7 - */ -export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) - -/** - * @category Alt - * @since 2.2.7 - */ -export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @category instances - * @since 2.2.7 - */ -export const URI = 'io-ts/Decoder2' - -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: Decoder - } -} - -/** - * @category instances - * @since 2.2.7 - */ -export const functorDecoder: Functor1 = { - URI, - map: map_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const altDecoder: Alt1 = { - URI, - map: map_, - alt: alt_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const schemableDecoder: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { - URI, - literal, - string, - number, - boolean, - nullable, - type, - partial, - record, - array, - tuple: tuple as Schemable1['tuple'], - intersect, - sum, - lazy, - UnknownArray, - UnknownRecord, - union: union as WithUnion1['union'], - refine: refine as WithRefine1['refine'] -} - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -const toForest = (e: DecodeError): NEA.NonEmptyArray> => { - const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ - Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => T.make(`member ${index}`, toForest(errors)), - Lazy: (id, errors) => T.make(`lazy type ${id}`, toForest(errors)) - }) - const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( - (value) => [toTree(value)], - (left, right) => NEA.concat(toForest(left), toForest(right)) - ) - return toForest(e) -} - -/** - * @since 2.2.7 - */ -export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') - -/** - * @since 2.2.7 - */ -export const stringify: (e: E.Either) => string = E.fold( - (e) => draw(e), - (a) => JSON.stringify(a, null, 2) -) diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 8ff271f3e..6a6e0a6e7 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -8,7 +8,7 @@ import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' -import { Literal, memoize } from './Schemable' +import { Literal, memoize, intersect_ } from './Schemable' import { Alt2C } from 'fp-ts/lib/Alt' import { Apply2C } from 'fp-ts/lib/Apply' @@ -242,22 +242,6 @@ export const union = (M: Alt2C & Bifunctor2) => ( } }) -const typeOf = (x: unknown): string => (x === null ? 'null' : typeof x) - -/** - * @internal - */ -export const intersect_ = (a: A, b: B): A & B => { - if (a !== undefined && b !== undefined) { - const tx = typeOf(a) - const ty = typeOf(b) - if (tx === 'object' || ty === 'object') { - return Object.assign({}, a, b) - } - } - return b as any -} - /** * @category combinators * @since 2.2.7 diff --git a/src/Encoder.ts b/src/Encoder.ts index e28338aa8..7624042fa 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -3,8 +3,7 @@ */ import { Contravariant2 } from 'fp-ts/lib/Contravariant' import { Category2 } from 'fp-ts/lib/Category' -import { intersect_ } from './Decoder' -import { memoize } from './Schemable' +import { memoize, intersect_ } from './Schemable' import { identity } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- diff --git a/src/Schemable.ts b/src/Schemable.ts index c20efef59..cdc841d95 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -110,3 +110,23 @@ export function memoize(f: (a: A) => B): (a: A) => B { return cache.get(a) } } + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +const typeOf = (x: unknown): string => (x === null ? 'null' : typeof x) + +/** + * @internal + */ +export const intersect_ = (a: A, b: B): A & B => { + if (a !== undefined && b !== undefined) { + const tx = typeOf(a) + const ty = typeOf(b) + if (tx === 'object' || ty === 'object') { + return Object.assign({}, a, b) + } + } + return b as any +} diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 334808bf9..ff90a7c7f 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -12,7 +12,7 @@ import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as DT from './DecoderT' import * as G from './Guard' -import * as D from './Decoder2' +import * as D from './Decoder' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -48,6 +48,14 @@ export interface TaskDecoder { */ export type DecodeError = FS.FreeSemigroup> +/** + * @category DecodeError + * @since 2.2.7 + */ +export function error(actual: unknown, message: string): DecodeError { + return FS.of(DE.leaf(actual, message)) +} + /** * @category DecodeError * @since 2.2.7 @@ -61,7 +69,7 @@ export function success(a: A): TE.TaskEither { * @since 2.2.7 */ export function failure(actual: unknown, message: string): TE.TaskEither { - return TE.left(FS.of(DE.leaf(actual, message))) + return TE.left(error(actual, message)) } // ------------------------------------------------------------------------------------- diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index c86246e09..582b17b30 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -3,7 +3,6 @@ */ import * as fc from 'fast-check' import * as S from '../src/Schemable' -import { intersect_ } from '../src/Decoder' // ------------------------------------------------------------------------------------- // model @@ -81,7 +80,7 @@ export function tuple>( } export const intersect = (right: Arbitrary) => (left: Arbitrary): Arbitrary => - fc.tuple(left, right).map(([a, b]) => intersect_(a, b)) + fc.tuple(left, right).map(([a, b]) => S.intersect_(a, b)) export function sum( _tag: T diff --git a/test/Codec.ts b/test/Codec.ts index 5be13711b..45d4bd87f 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -4,12 +4,17 @@ import * as C from '../src/Codec' import * as D from '../src/Decoder' import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from '../src/DecodeError' +import * as FS from '../src/FreeSemigroup' const NumberFromString: C.Codec = C.make( - D.parse(D.string, (s) => { - const n = parseFloat(s) - return isNaN(n) ? left([D.tree(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`)]) : right(n) - }), + pipe( + D.string, + D.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + }) + ), { encode: String } ) @@ -64,8 +69,8 @@ describe('Codec', () => { describe('withExpected', () => { describe('decode', () => { it('should, return the provided expected', () => { - const codec = C.withExpected(C.number, () => [D.tree(`not a number`)]) - assert.deepStrictEqual(codec.decode('a'), left([D.tree('not a number')])) + const decoder = C.withExpected(C.number, (u) => FS.of(DE.leaf(u, 'not a number'))) + assert.deepStrictEqual(decoder.decode('a'), left(FS.of(DE.leaf('a', 'not a number')))) }) }) }) @@ -79,7 +84,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.string - assert.deepStrictEqual(codec.decode(null), left([D.tree('cannot decode null, should be string')])) + assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'string')))) }) }) }) @@ -93,7 +98,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.number - assert.deepStrictEqual(codec.decode(null), left([D.tree('cannot decode null, should be number')])) + assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'number')))) }) }) }) @@ -108,7 +113,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.boolean - assert.deepStrictEqual(codec.decode(null), left([D.tree('cannot decode null, should be boolean')])) + assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'boolean')))) }) }) }) @@ -123,7 +128,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.literal('a', null) - assert.deepStrictEqual(codec.decode('b'), left([D.tree('cannot decode "b", should be "a" | null')])) + assert.deepStrictEqual(codec.decode('b'), left(FS.of(DE.leaf('b', '"a" | null')))) }) }) @@ -150,8 +155,8 @@ describe('Codec', () => { C.string, C.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(codec.decode(undefined), left([D.tree('cannot decode undefined, should be string')])) - assert.deepStrictEqual(codec.decode(''), left([D.tree('cannot refine "", should be NonEmptyString')])) + assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(codec.decode(''), left(FS.of(DE.leaf('', 'NonEmptyString')))) }) }) @@ -178,17 +183,21 @@ describe('Codec', () => { const codec = C.nullable(NumberFromString) assert.deepStrictEqual( codec.decode(undefined), - left([ - D.tree('member 0', [D.tree('cannot decode undefined, should be null')]), - D.tree('member 1', [D.tree('cannot decode undefined, should be string')]) - ]) + left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) ) assert.deepStrictEqual( codec.decode('a'), - left([ - D.tree('member 0', [D.tree('cannot decode "a", should be null')]), - D.tree('member 1', [D.tree('cannot decode "a", should be parsable into a number')]) - ]) + left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) ) }) }) @@ -229,13 +238,10 @@ describe('Codec', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual( - codec.decode(undefined), - left([D.tree('cannot decode undefined, should be Record')]) - ) + assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( codec.decode({ a: 1 }), - left([D.tree('required property "a"', [D.tree('cannot decode 1, should be string')])]) + left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) @@ -246,10 +252,12 @@ describe('Codec', () => { }) assert.deepStrictEqual( codec.decode({}), - left([ - D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')]), - D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')]) - ]) + left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) ) }) @@ -306,13 +314,10 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual( - codec.decode(undefined), - left([D.tree('cannot decode undefined, should be Record')]) - ) + assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( codec.decode({ a: 1 }), - left([D.tree('optional property "a"', [D.tree('cannot decode 1, should be string')])]) + left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) ) }) @@ -323,10 +328,12 @@ describe('Codec', () => { }) assert.deepStrictEqual( codec.decode({ a: 1, b: 'b' }), - left([ - D.tree('optional property "a"', [D.tree('cannot decode 1, should be string')]), - D.tree('optional property "b"', [D.tree('cannot decode "b", should be number')]) - ]) + left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) ) }) @@ -379,13 +386,10 @@ describe('Codec', () => { it('should reject an invalid value', () => { const codec = C.record(C.number) - assert.deepStrictEqual( - codec.decode(undefined), - left([D.tree('cannot decode undefined, should be Record')]) - ) + assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( codec.decode({ a: 'a' }), - left([D.tree('key "a"', [D.tree('cannot decode "a", should be number')])]) + left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) ) }) @@ -393,10 +397,12 @@ describe('Codec', () => { const codec = C.record(C.number) assert.deepStrictEqual( codec.decode({ a: 'a', b: 'b' }), - left([ - D.tree('key "a"', [D.tree('cannot decode "a", should be number')]), - D.tree('key "b"', [D.tree('cannot decode "b", should be number')]) - ]) + left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) ) }) }) @@ -419,24 +425,20 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.array(C.string) - assert.deepStrictEqual( - codec.decode(undefined), - left([D.tree('cannot decode undefined, should be Array')]) - ) - assert.deepStrictEqual( - codec.decode([1]), - left([D.tree('optional index 0', [D.tree('cannot decode 1, should be string')])]) - ) + assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual(codec.decode([1]), left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) }) it('should collect all errors', () => { const codec = C.array(C.string) assert.deepStrictEqual( codec.decode([1, 2]), - left([ - D.tree('optional index 0', [D.tree('cannot decode 1, should be string')]), - D.tree('optional index 1', [D.tree('cannot decode 2, should be string')]) - ]) + left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) ) }) }) @@ -462,28 +464,24 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual( - codec.decode(undefined), - left([D.tree('cannot decode undefined, should be Array')]) - ) + assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Array')))) assert.deepStrictEqual( codec.decode(['a']), - left([D.tree('required index 1', [D.tree('cannot decode undefined, should be number')])]) - ) - assert.deepStrictEqual( - codec.decode([1, 2]), - left([D.tree('required index 0', [D.tree('cannot decode 1, should be string')])]) + left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) ) + assert.deepStrictEqual(codec.decode([1, 2]), left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))))) }) it('should collect all errors', () => { const codec = C.tuple(C.string, C.number) assert.deepStrictEqual( codec.decode([1, 'a']), - left([ - D.tree('required index 0', [D.tree('cannot decode 1, should be string')]), - D.tree('required index 1', [D.tree('cannot decode "a", should be number')]) - ]) + left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) ) }) @@ -543,17 +541,14 @@ describe('Codec', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual( - codec.decode(null), - left([D.tree('cannot decode null, should be Record')]) - ) + assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'Record')))) assert.deepStrictEqual( codec.decode({}), - left([D.tree('required property "_tag"', [D.tree('cannot decode undefined, should be "A" | "B"')])]) + left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) ) assert.deepStrictEqual( codec.decode({ _tag: 'A', a: 1 }), - left([D.tree('required property "a"', [D.tree('cannot decode 1, should be string')])]) + left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) @@ -561,7 +556,7 @@ describe('Codec', () => { const decoder = sum({}) assert.deepStrictEqual( decoder.decode({}), - left([D.tree('required property "_tag"', [D.tree('cannot decode undefined, should be never')])]) + left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) ) }) }) @@ -587,46 +582,49 @@ describe('Codec', () => { b?: AOut } - const codec: C.Codec = C.lazy('A', () => - pipe(C.type({ a: NumberFromString }), C.intersect(C.partial({ b: codec }))) + const lazyCodec: C.Codec = C.lazy('A', () => + pipe(C.type({ a: NumberFromString }), C.intersect(C.partial({ b: lazyCodec }))) ) describe('decode', () => { it('should decode a valid input', () => { - assert.deepStrictEqual(codec.decode({ a: '1' }), right({ a: 1 })) - assert.deepStrictEqual(codec.decode({ a: '1', b: { a: '2' } }), right({ a: 1, b: { a: 2 } })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), right({ a: 1 })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), right({ a: 1, b: { a: 2 } })) }) it('should reject an invalid input', () => { assert.deepStrictEqual( - codec.decode({ a: 1 }), - left([D.tree('A', [D.tree('required property "a"', [D.tree('cannot decode 1, should be string')])])]) + lazyCodec.decode({ a: 1 }), + left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) ) assert.deepStrictEqual( - codec.decode({ a: 'a' }), - left([ - D.tree('A', [ - D.tree('required property "a"', [D.tree('cannot decode "a", should be parsable into a number')]) - ]) - ]) + lazyCodec.decode({ a: 'a' }), + left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) ) assert.deepStrictEqual( - codec.decode({ a: '1', b: {} }), - left([ - D.tree('A', [ - D.tree('optional property "b"', [ - D.tree('A', [D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')])]) - ]) - ]) - ]) + lazyCodec.decode({ a: '1', b: {} }), + left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) ) }) }) describe('encode', () => { it('should encode a value', () => { - assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) - assert.deepStrictEqual(codec.encode({ a: 1, b: { a: 2 } }), { a: '1', b: { a: '2' } }) + assert.deepStrictEqual(lazyCodec.encode({ a: 1 }), { a: '1' }) + assert.deepStrictEqual(lazyCodec.encode({ a: 1, b: { a: 2 } }), { a: '1', b: { a: '2' } }) }) }) }) diff --git a/test/Decoder.ts b/test/Decoder.ts index 33020b16b..6063cd4ba 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -1,33 +1,368 @@ import * as assert from 'assert' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from '../src/DecodeError' +import * as FS from '../src/FreeSemigroup' +import * as G from '../src/Guard' import * as D from '../src/Decoder' +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: D.Decoder = D.fromGuard(undefinedGuard, 'undefined') + +const NumberFromString: D.Decoder = pipe( + D.string, + D.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + }) +) + +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: D.Decoder = pipe( + D.number, + D.refine((n): n is Positive => n > 0, 'Positive') +) + +interface IntBrand { + readonly Int: unique symbol +} +type Int = number & IntBrand +const Int: D.Decoder = pipe( + D.number, + D.refine((n): n is Int => Number.isInteger(n), 'Int') +) + describe('Decoder', () => { - it('of', () => { - const decoder = D.of(1) - assert.deepStrictEqual(decoder.decode('aaa'), E.right(1)) + // ------------------------------------------------------------------------------------- + // pipeables + // ------------------------------------------------------------------------------------- + it('map', () => { + const decoder = pipe( + D.string, + D.map((s) => s + '!') + ) + assert.deepStrictEqual(decoder.decode('a'), E.right('a!')) }) - describe('functorDecoder', () => { - it('map', () => { - const decoder = pipe( - D.string, - D.map((s) => s.length) + it('alt', () => { + const decoder = pipe( + D.string, + D.alt(() => D.number) + ) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode(1), E.right(1)) + }) + + // ------------------------------------------------------------------------------------- + // primitives + // ------------------------------------------------------------------------------------- + + it('string', async () => { + assert.deepStrictEqual(D.string.decode('a'), E.right('a')) + assert.deepStrictEqual(D.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) + }) + + it('number', async () => { + assert.deepStrictEqual(D.number.decode(1), E.right(1)) + assert.deepStrictEqual(D.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) + }) + + it('boolean', async () => { + assert.deepStrictEqual(D.boolean.decode(true), E.right(true)) + assert.deepStrictEqual(D.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) + }) + + it('UnknownArray', async () => { + assert.deepStrictEqual(D.UnknownArray.decode([1, 'a']), E.right([1, 'a'])) + assert.deepStrictEqual(D.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) + }) + + it('UnknownRecord', async () => { + assert.deepStrictEqual(D.UnknownRecord.decode({ a: 1, b: 'b' }), E.right({ a: 1, b: 'b' })) + assert.deepStrictEqual(D.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + }) + + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- + + describe('literal', () => { + it('should decode a valid input', async () => { + const decoder = D.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode(null), E.right(null)) + }) + + it('should reject an invalid input', async () => { + const decoder = D.literal('a', null) + assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) + }) + }) + + // ------------------------------------------------------------------------------------- + // combinators + // ------------------------------------------------------------------------------------- + + it('withExpected', () => { + const decoder = D.withExpected(D.number, (u) => FS.of(DE.leaf(u, 'not a number'))) + assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) + }) + + describe('nullable', () => { + it('should decode a valid input', () => { + const decoder = D.nullable(NumberFromString) + assert.deepStrictEqual(decoder.decode(null), E.right(null)) + assert.deepStrictEqual(decoder.decode('1'), E.right(1)) + }) + + it('should reject an invalid input', () => { + const decoder = D.nullable(NumberFromString) + assert.deepStrictEqual( + decoder.decode(undefined), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) + ) + assert.deepStrictEqual( + decoder.decode('a'), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) ) - assert.deepStrictEqual(decoder.decode(null), E.left([D.tree('cannot decode null, should be string')])) - assert.deepStrictEqual(decoder.decode('aaa'), E.right(3)) }) }) - describe('altDecoder', () => { - it('alt', () => { - const decoder = pipe( - D.string, - D.alt(() => pipe(D.number, D.map(String))) + describe('type', () => { + it('should decode a valid input', async () => { + const decoder = D.type({ + a: D.string + }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) + }) + + it('should strip additional fields', async () => { + const decoder = D.type({ + a: D.string + }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = D.type({ + a: undef + }) + assert.deepStrictEqual(decoder.decode({}), E.right({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = D.type({ + a: D.string + }) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + decoder.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - assert.deepStrictEqual(decoder.decode(1), E.right('1')) + }) + + it('should collect all errors', async () => { + const decoder = D.type({ + a: D.string, + b: D.number + }) + assert.deepStrictEqual( + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = D.type({ a: D.string, b: D.string }) + assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) + }) + }) + + describe('partial', () => { + it('should decode a valid input', async () => { + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({}), E.right({})) + }) + + it('should strip additional fields', async () => { + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + }) + + it('should not add missing fields', async () => { + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({}), E.right({})) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode({ a: undefined }), E.right({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = D.partial({ a: D.string }) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + decoder.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = D.partial({ + a: D.string, + b: D.number + }) + assert.deepStrictEqual( + decoder.decode({ a: 1, b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = D.partial({ a: D.string, b: D.string }) + assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) + }) + }) + + describe('array', () => { + it('should decode a valid input', async () => { + const decoder = D.array(D.string) + assert.deepStrictEqual(decoder.decode([]), E.right([])) + assert.deepStrictEqual(decoder.decode(['a']), E.right(['a'])) + }) + + it('should reject an invalid input', async () => { + const decoder = D.array(D.string) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) + }) + + it('should collect all errors', async () => { + const decoder = D.array(D.string) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) + ) + }) + }) + + describe('record', () => { + it('should decode a valid value', async () => { + const decoder = D.record(D.number) + assert.deepStrictEqual(decoder.decode({}), E.right({})) + assert.deepStrictEqual(decoder.decode({ a: 1 }), E.right({ a: 1 })) + }) + + it('should reject an invalid value', async () => { + const decoder = D.record(D.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + decoder.decode({ a: 'a' }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = D.record(D.number) + assert.deepStrictEqual( + decoder.decode({ a: 'a', b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + }) + + describe('tuple', () => { + it('should decode a valid input', async () => { + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(decoder.decode(['a', 1]), E.right(['a', 1])) + }) + + it('should handle zero components', async () => { + assert.deepStrictEqual(D.tuple().decode([]), E.right([])) + }) + + it('should reject an invalid input', async () => { + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual( + decoder.decode(['a']), + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual( + decoder.decode([1, 'a']), + E.left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) + ) + }) + + it('should strip additional components', async () => { + const decoder = D.tuple(D.string, D.number) + assert.deepStrictEqual(decoder.decode(['a', 1, true]), E.right(['a', 1])) }) }) @@ -43,99 +378,190 @@ describe('Decoder', () => { const decoder = D.union(D.string, D.number) assert.deepStrictEqual( decoder.decode(true), - E.left([ - D.tree('member 0', [D.tree('cannot decode true, should be string')]), - D.tree('member 1', [D.tree('cannot decode true, should be number')]) - ]) + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), + FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) + ) + ) ) }) }) - describe('sum', () => { - it('should support non-`string` tag values', () => { - const decoder = D.sum('_tag')({ - true: D.type({ _tag: D.literal(true), a: D.string }), - false: D.type({ _tag: D.literal(false), b: D.number }) - }) - assert.deepStrictEqual(decoder.decode({ _tag: true, a: 'a' }), E.right({ _tag: true, a: 'a' })) - assert.deepStrictEqual(decoder.decode({ _tag: false, b: 1 }), E.right({ _tag: false, b: 1 })) - assert.deepStrictEqual( - decoder.decode({ _tag: false, b: 'a' }), - E.left([D.tree('required property "b"', [D.tree('cannot decode "a", should be number')])]) + describe('refine', () => { + it('should decode a valid input', () => { + const decoder = pipe( + D.string, + D.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + }) + + it('should reject an invalid input', () => { + const decoder = pipe( + D.string, + D.refine((s): s is string => s.length > 0, 'NonEmptyString') ) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) }) }) describe('intersect', () => { + it('should decode a valid input', () => { + const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a', b: 1 })) + }) + + it('should handle primitives', () => { + const decoder = pipe(Int, D.intersect(Positive)) + assert.deepStrictEqual(decoder.decode(1), E.right(1)) + }) + it('should accumulate all errors', () => { const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) assert.deepStrictEqual( - decoder.decode({}), - E.left([ - D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')]), - D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')]) - ]) + decoder.decode({ a: 'a' }), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) ) assert.deepStrictEqual( decoder.decode({ b: 1 }), - E.left([D.tree('required property "a"', [D.tree('cannot decode undefined, should be string')])]) + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) ) assert.deepStrictEqual( - decoder.decode({ a: 'a' }), - E.left([D.tree('required property "b"', [D.tree('cannot decode undefined, should be number')])]) + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) ) }) }) - describe('intersect_', () => { - it('should concat strings', () => { - assert.deepStrictEqual(D.intersect_('a', 'b'), 'b') - }) - - it('should concat numbers', () => { - assert.deepStrictEqual(D.intersect_(1, 2), 2) - }) + describe('sum', () => { + const sum = D.sum('_tag') - it('should concat booleans', () => { - assert.deepStrictEqual(D.intersect_(true, false), false) + it('should decode a valid input', () => { + const A = D.type({ _tag: D.literal('A'), a: D.string }) + const B = D.type({ _tag: D.literal('B'), b: D.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), E.right({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), E.right({ _tag: 'B', b: 1 })) }) - it('should concat nulls', () => { - assert.deepStrictEqual(D.intersect_(null, null), null) + it('should reject an invalid input', () => { + const A = D.type({ _tag: D.literal('A'), a: D.string }) + const B = D.type({ _tag: D.literal('B'), b: D.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual( + decoder.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + ) + assert.deepStrictEqual( + decoder.decode({ _tag: 'A', a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) }) - it('should concat undefineds', () => { - assert.deepStrictEqual(D.intersect_(undefined, undefined), undefined) + it('should support empty records', () => { + const decoder = sum({}) + assert.deepStrictEqual( + decoder.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + ) }) + }) - it('should concat objects', () => { - assert.deepStrictEqual(D.intersect_({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) - }) + interface A { + a: number + b?: A + } - it('should concat a string with an object', () => { - assert.deepStrictEqual(D.intersect_('a', { a: 1 }), { 0: 'a', a: 1 }) - }) + const lazyDecoder: D.Decoder = D.lazy('A', () => + pipe(D.type({ a: NumberFromString }), D.intersect(D.partial({ b: lazyDecoder }))) + ) - it('should concat a number with an object', () => { - assert.deepStrictEqual(D.intersect_(1, { a: 1 }), { a: 1 }) + describe('lazy', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), E.right({ a: 1 })) + assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), E.right({ a: 1, b: { a: 2 } })) }) - it('should concat a boolean with an object', () => { - assert.deepStrictEqual(D.intersect_(true, { a: 1 }), { a: 1 }) + it('should reject an invalid input', () => { + assert.deepStrictEqual( + lazyDecoder.decode({ a: 1 }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: 'a' }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: '1', b: {} }), + E.left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) + ) }) }) + // ------------------------------------------------------------------------------------- + // utils + // ------------------------------------------------------------------------------------- + describe('draw', () => { - it('should draw a tree', () => { - const codec = D.type({ - a: D.string + it('draw', () => { + const decoder = D.type({ + a: D.string, + b: D.number, + c: D.array(D.boolean), + d: D.nullable(D.string) }) - assert.deepStrictEqual(pipe(codec.decode({ a: 'a' }), E.mapLeft(D.draw)), E.right({ a: 'a' })) assert.deepStrictEqual( - pipe(codec.decode({ a: 1 }), E.mapLeft(D.draw)), + pipe(decoder.decode({ c: [1] }), E.mapLeft(D.draw)), E.left(`required property "a" -└─ cannot decode 1, should be string`) +└─ cannot decode undefined, should be string +required property "b" +└─ cannot decode undefined, should be number +required property "c" +└─ optional index 0 + └─ cannot decode 1, should be boolean +required property "d" +├─ member 0 +│ └─ cannot decode undefined, should be null +└─ member 1 + └─ cannot decode undefined, should be string`) ) }) + + it('should support lazy combinators', () => { + assert.deepStrictEqual( + pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(D.draw)), + E.left(`lazy type A +└─ optional property \"b\" + └─ lazy type A + └─ required property \"a\" + └─ cannot decode undefined, should be string`) + ) + }) + }) + + it('stringify', () => { + assert.deepStrictEqual(D.stringify(D.string.decode('a')), '"a"') + assert.deepStrictEqual(D.stringify(D.string.decode(null)), 'cannot decode null, should be string') }) }) diff --git a/test/Decoder2.ts b/test/Decoder2.ts deleted file mode 100644 index 271f730e7..000000000 --- a/test/Decoder2.ts +++ /dev/null @@ -1,567 +0,0 @@ -import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import * as DE from '../src/DecodeError' -import * as FS from '../src/FreeSemigroup' -import * as G from '../src/Guard' -import * as D from '../src/Decoder2' - -const undefinedGuard: G.Guard = { - is: (u): u is undefined => u === undefined -} -const undef: D.Decoder = D.fromGuard(undefinedGuard, 'undefined') - -const NumberFromString: D.Decoder = pipe( - D.string, - D.parse((s) => { - const n = parseFloat(s) - return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) - }) -) - -interface PositiveBrand { - readonly Positive: unique symbol -} -type Positive = number & PositiveBrand -const Positive: D.Decoder = pipe( - D.number, - D.refine((n): n is Positive => n > 0, 'Positive') -) - -interface IntBrand { - readonly Int: unique symbol -} -type Int = number & IntBrand -const Int: D.Decoder = pipe( - D.number, - D.refine((n): n is Int => Number.isInteger(n), 'Int') -) - -describe('Decoder', () => { - // ------------------------------------------------------------------------------------- - // pipeables - // ------------------------------------------------------------------------------------- - it('map', () => { - const decoder = pipe( - D.string, - D.map((s) => s + '!') - ) - assert.deepStrictEqual(decoder.decode('a'), E.right('a!')) - }) - - it('alt', () => { - const decoder = pipe( - D.string, - D.alt(() => D.number) - ) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - assert.deepStrictEqual(decoder.decode(1), E.right(1)) - }) - - // ------------------------------------------------------------------------------------- - // primitives - // ------------------------------------------------------------------------------------- - - it('string', async () => { - assert.deepStrictEqual(D.string.decode('a'), E.right('a')) - assert.deepStrictEqual(D.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) - }) - - it('number', async () => { - assert.deepStrictEqual(D.number.decode(1), E.right(1)) - assert.deepStrictEqual(D.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) - }) - - it('boolean', async () => { - assert.deepStrictEqual(D.boolean.decode(true), E.right(true)) - assert.deepStrictEqual(D.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) - }) - - it('UnknownArray', async () => { - assert.deepStrictEqual(D.UnknownArray.decode([1, 'a']), E.right([1, 'a'])) - assert.deepStrictEqual(D.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) - }) - - it('UnknownRecord', async () => { - assert.deepStrictEqual(D.UnknownRecord.decode({ a: 1, b: 'b' }), E.right({ a: 1, b: 'b' })) - assert.deepStrictEqual(D.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) - }) - - // ------------------------------------------------------------------------------------- - // constructors - // ------------------------------------------------------------------------------------- - - describe('literal', () => { - it('should decode a valid input', async () => { - const decoder = D.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - assert.deepStrictEqual(decoder.decode(null), E.right(null)) - }) - - it('should reject an invalid input', async () => { - const decoder = D.literal('a', null) - assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) - }) - }) - - // ------------------------------------------------------------------------------------- - // combinators - // ------------------------------------------------------------------------------------- - - it('withExpected', () => { - const decoder = D.withExpected(D.number, (u) => FS.of(DE.leaf(u, 'not a number'))) - assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) - }) - - describe('nullable', () => { - it('should decode a valid input', () => { - const decoder = D.nullable(NumberFromString) - assert.deepStrictEqual(decoder.decode(null), E.right(null)) - assert.deepStrictEqual(decoder.decode('1'), E.right(1)) - }) - - it('should reject an invalid input', () => { - const decoder = D.nullable(NumberFromString) - assert.deepStrictEqual( - decoder.decode(undefined), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) - ) - ) - ) - assert.deepStrictEqual( - decoder.decode('a'), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) - ) - ) - ) - }) - }) - - describe('type', () => { - it('should decode a valid input', async () => { - const decoder = D.type({ - a: D.string - }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) - }) - - it('should strip additional fields', async () => { - const decoder = D.type({ - a: D.string - }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = D.type({ - a: undef - }) - assert.deepStrictEqual(decoder.decode({}), E.right({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = D.type({ - a: D.string - }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) - assert.deepStrictEqual( - decoder.decode({ a: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = D.type({ - a: D.string, - b: D.number - }) - assert.deepStrictEqual( - decoder.decode({}), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = D.type({ a: D.string, b: D.string }) - assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) - }) - }) - - describe('partial', () => { - it('should decode a valid input', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) - assert.deepStrictEqual(decoder.decode({}), E.right({})) - }) - - it('should strip additional fields', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) - }) - - it('should not add missing fields', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({}), E.right({})) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({ a: undefined }), E.right({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) - assert.deepStrictEqual( - decoder.decode({ a: 1 }), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = D.partial({ - a: D.string, - b: D.number - }) - assert.deepStrictEqual( - decoder.decode({ a: 1, b: 'b' }), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = D.partial({ a: D.string, b: D.string }) - assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) - }) - }) - - describe('array', () => { - it('should decode a valid input', async () => { - const decoder = D.array(D.string) - assert.deepStrictEqual(decoder.decode([]), E.right([])) - assert.deepStrictEqual(decoder.decode(['a']), E.right(['a'])) - }) - - it('should reject an invalid input', async () => { - const decoder = D.array(D.string) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) - }) - - it('should collect all errors', async () => { - const decoder = D.array(D.string) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left( - FS.concat( - FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) - ) - ) - ) - }) - }) - - describe('record', () => { - it('should decode a valid value', async () => { - const decoder = D.record(D.number) - assert.deepStrictEqual(decoder.decode({}), E.right({})) - assert.deepStrictEqual(decoder.decode({ a: 1 }), E.right({ a: 1 })) - }) - - it('should reject an invalid value', async () => { - const decoder = D.record(D.number) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) - assert.deepStrictEqual( - decoder.decode({ a: 'a' }), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = D.record(D.number) - assert.deepStrictEqual( - decoder.decode({ a: 'a', b: 'b' }), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - }) - - describe('tuple', () => { - it('should decode a valid input', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(decoder.decode(['a', 1]), E.right(['a', 1])) - }) - - it('should handle zero components', async () => { - assert.deepStrictEqual(D.tuple().decode([]), E.right([])) - }) - - it('should reject an invalid input', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual( - decoder.decode(['a']), - E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual( - decoder.decode([1, 'a']), - E.left( - FS.concat( - FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) - ) - ) - ) - }) - - it('should strip additional components', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(decoder.decode(['a', 1, true]), E.right(['a', 1])) - }) - }) - - describe('union', () => { - it('should decode a valid input', () => { - assert.deepStrictEqual(D.union(D.string).decode('a'), E.right('a')) - const decoder = D.union(D.string, D.number) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - assert.deepStrictEqual(decoder.decode(1), E.right(1)) - }) - - it('should reject an invalid input', () => { - const decoder = D.union(D.string, D.number) - assert.deepStrictEqual( - decoder.decode(true), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), - FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) - ) - ) - ) - }) - }) - - describe('refine', () => { - it('should decode a valid input', () => { - const decoder = pipe( - D.string, - D.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - }) - - it('should reject an invalid input', () => { - const decoder = pipe( - D.string, - D.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) - assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) - }) - }) - - describe('intersect', () => { - it('should decode a valid input', () => { - const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a', b: 1 })) - }) - - it('should handle primitives', () => { - const decoder = pipe(Int, D.intersect(Positive)) - assert.deepStrictEqual(decoder.decode(1), E.right(1)) - }) - - it('should accumulate all errors', () => { - const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) - assert.deepStrictEqual( - decoder.decode({ a: 'a' }), - E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - decoder.decode({ b: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) - ) - assert.deepStrictEqual( - decoder.decode({}), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - }) - - describe('sum', () => { - const sum = D.sum('_tag') - - it('should decode a valid input', () => { - const A = D.type({ _tag: D.literal('A'), a: D.string }) - const B = D.type({ _tag: D.literal('B'), b: D.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), E.right({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), E.right({ _tag: 'B', b: 1 })) - }) - - it('should reject an invalid input', () => { - const A = D.type({ _tag: D.literal('A'), a: D.string }) - const B = D.type({ _tag: D.literal('B'), b: D.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) - assert.deepStrictEqual( - decoder.decode({}), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) - ) - assert.deepStrictEqual( - decoder.decode({ _tag: 'A', a: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should support empty records', () => { - const decoder = sum({}) - assert.deepStrictEqual( - decoder.decode({}), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) - ) - }) - }) - - interface A { - a: number - b?: A - } - - const lazyDecoder: D.Decoder = D.lazy('A', () => - pipe(D.type({ a: NumberFromString }), D.intersect(D.partial({ b: lazyDecoder }))) - ) - - describe('lazy', () => { - it('should decode a valid input', () => { - assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), E.right({ a: 1 })) - assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), E.right({ a: 1, b: { a: 2 } })) - }) - - it('should reject an invalid input', () => { - assert.deepStrictEqual( - lazyDecoder.decode({ a: 1 }), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) - ) - assert.deepStrictEqual( - lazyDecoder.decode({ a: 'a' }), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) - ) - assert.deepStrictEqual( - lazyDecoder.decode({ a: '1', b: {} }), - E.left( - FS.of( - DE.lazy( - 'A', - FS.of( - DE.key( - 'b', - DE.optional, - FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) - ) - ) - ) - ) - ) - ) - }) - }) - - // ------------------------------------------------------------------------------------- - // utils - // ------------------------------------------------------------------------------------- - - describe('draw', () => { - it('draw', () => { - const decoder = D.type({ - a: D.string, - b: D.number, - c: D.array(D.boolean), - d: D.nullable(D.string) - }) - assert.deepStrictEqual( - pipe(decoder.decode({ c: [1] }), E.mapLeft(D.draw)), - E.left(`required property "a" -└─ cannot decode undefined, should be string -required property "b" -└─ cannot decode undefined, should be number -required property "c" -└─ optional index 0 - └─ cannot decode 1, should be boolean -required property "d" -├─ member 0 -│ └─ cannot decode undefined, should be null -└─ member 1 - └─ cannot decode undefined, should be string`) - ) - }) - - it('should support lazy combinators', () => { - assert.deepStrictEqual( - pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(D.draw)), - E.left(`lazy type A -└─ optional property \"b\" - └─ lazy type A - └─ required property \"a\" - └─ cannot decode undefined, should be string`) - ) - }) - }) - - it('stringify', () => { - assert.deepStrictEqual(D.stringify(D.string.decode('a')), '"a"') - assert.deepStrictEqual(D.stringify(D.string.decode(null)), 'cannot decode null, should be string') - }) -}) diff --git a/test/DecoderT.ts b/test/DecoderT.ts deleted file mode 100644 index c86d72372..000000000 --- a/test/DecoderT.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as assert from 'assert' -import * as DT from '../src/DecoderT' - -describe('DecoderT', () => { - describe('intersect', () => { - it('should concat strings', () => { - assert.deepStrictEqual(DT.intersect_('a', 'b'), 'b') - }) - - it('should concat numbers', () => { - assert.deepStrictEqual(DT.intersect_(1, 2), 2) - }) - - it('should concat booleans', () => { - assert.deepStrictEqual(DT.intersect_(true, false), false) - }) - - it('should concat nulls', () => { - assert.deepStrictEqual(DT.intersect_(null, null), null) - }) - - it('should concat undefineds', () => { - assert.deepStrictEqual(DT.intersect_(undefined, undefined), undefined) - }) - - it('should concat objects', () => { - assert.deepStrictEqual(DT.intersect_({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) - }) - - it('should concat a string with an object', () => { - assert.deepStrictEqual(DT.intersect_('a', { a: 1 }), { 0: 'a', a: 1 }) - }) - - it('should concat a number with an object', () => { - assert.deepStrictEqual(DT.intersect_(1, { a: 1 }), { a: 1 }) - }) - - it('should concat a boolean with an object', () => { - assert.deepStrictEqual(DT.intersect_(true, { a: 1 }), { a: 1 }) - }) - }) -}) diff --git a/test/Schemable.ts b/test/Schemable.ts new file mode 100644 index 000000000..7d6cf9050 --- /dev/null +++ b/test/Schemable.ts @@ -0,0 +1,42 @@ +import * as assert from 'assert' +import * as S from '../src/Schemable' + +describe('DecoderT', () => { + describe('intersect', () => { + it('should concat strings', () => { + assert.deepStrictEqual(S.intersect_('a', 'b'), 'b') + }) + + it('should concat numbers', () => { + assert.deepStrictEqual(S.intersect_(1, 2), 2) + }) + + it('should concat booleans', () => { + assert.deepStrictEqual(S.intersect_(true, false), false) + }) + + it('should concat nulls', () => { + assert.deepStrictEqual(S.intersect_(null, null), null) + }) + + it('should concat undefineds', () => { + assert.deepStrictEqual(S.intersect_(undefined, undefined), undefined) + }) + + it('should concat objects', () => { + assert.deepStrictEqual(S.intersect_({ a: 1 }, { b: 2 }), { a: 1, b: 2 }) + }) + + it('should concat a string with an object', () => { + assert.deepStrictEqual(S.intersect_('a', { a: 1 }), { 0: 'a', a: 1 }) + }) + + it('should concat a number with an object', () => { + assert.deepStrictEqual(S.intersect_(1, { a: 1 }), { a: 1 }) + }) + + it('should concat a boolean with an object', () => { + assert.deepStrictEqual(S.intersect_(true, { a: 1 }), { a: 1 }) + }) + }) +}) From 9bf9d79cf2d1db80e43bd88b7b6b1ca6acf2f38e Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 07:03:41 +0200 Subject: [PATCH 072/222] add /*#__PURE__*/ comments --- docs/modules/Decoder.ts.md | 9 ++- docs/modules/TaskDecoder.ts.md | 9 ++- src/Decoder.ts | 119 +++++++++++++++++------------- src/TaskDecoder.ts | 128 +++++++++++++++++++-------------- 4 files changed, 154 insertions(+), 111 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index e24f6ef9f..4ce6af640 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -87,7 +87,7 @@ Added in v2.2.7 **Signature** ```ts -export declare function error(actual: unknown, message: string): DecodeError +export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> ``` Added in v2.2.7 @@ -97,7 +97,10 @@ Added in v2.2.7 **Signature** ```ts -export declare function failure(actual: unknown, message: string): E.Either +export declare const failure: ( + actual: unknown, + message: string +) => E.Either>, A> ``` Added in v2.2.7 @@ -107,7 +110,7 @@ Added in v2.2.7 **Signature** ```ts -export declare function success(a: A): E.Either +export declare const success: (a: A) => E.Either>, A> ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index f3d30a4fc..761e4e624 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -88,7 +88,7 @@ Added in v2.2.7 **Signature** ```ts -export declare function error(actual: unknown, message: string): DecodeError +export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> ``` Added in v2.2.7 @@ -98,7 +98,10 @@ Added in v2.2.7 **Signature** ```ts -export declare function failure(actual: unknown, message: string): TE.TaskEither +export declare const failure: ( + actual: unknown, + message: string +) => TE.TaskEither>, A> ``` Added in v2.2.7 @@ -108,7 +111,7 @@ Added in v2.2.7 **Signature** ```ts -export declare function success(a: A): TE.TaskEither +export declare const success: (a: A) => TE.TaskEither>, A> ``` Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index 4b11d8d1a..6e79c6c60 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -17,12 +17,18 @@ import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } // DecoderT config // ------------------------------------------------------------------------------------- -const M = E.getValidation(DE.getSemigroup()) -const fromGuardM = DT.fromGuard(M) -const literalM = DT.literal(M)((u, values) => - FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) -) -const refineM = DT.refine(M) +const M = + /*#__PURE__*/ + E.getValidation(DE.getSemigroup()) +const fromGuardM = + /*#__PURE__*/ + DT.fromGuard(M) +const literalM = + /*#__PURE__*/ + DT.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) +const refineM = + /*#__PURE__*/ + DT.refine(M) // ------------------------------------------------------------------------------------- // model @@ -50,25 +56,20 @@ export type DecodeError = FS.FreeSemigroup> * @category DecodeError * @since 2.2.7 */ -export function error(actual: unknown, message: string): DecodeError { - return FS.of(DE.leaf(actual, message)) -} +export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) /** * @category DecodeError * @since 2.2.7 */ -export function success(a: A): E.Either { - return E.right(a) -} +export const success: (a: A) => E.Either = E.right /** * @category DecodeError * @since 2.2.7 */ -export function failure(actual: unknown, message: string): E.Either { - return E.left(error(actual, message)) -} +export const failure = (actual: unknown, message: string): E.Either => + E.left(error(actual, message)) // ------------------------------------------------------------------------------------- // constructors @@ -96,31 +97,41 @@ export const literal = ]>(...valu * @category primitives * @since 2.2.7 */ -export const string: Decoder = fromGuard(G.string, 'string') +export const string: Decoder = + /*#__PURE__*/ + fromGuard(G.string, 'string') /** * @category primitives * @since 2.2.7 */ -export const number: Decoder = fromGuard(G.number, 'number') +export const number: Decoder = + /*#__PURE__*/ + fromGuard(G.number, 'number') /** * @category primitives * @since 2.2.7 */ -export const boolean: Decoder = fromGuard(G.boolean, 'boolean') +export const boolean: Decoder = + /*#__PURE__*/ + fromGuard(G.boolean, 'boolean') /** * @category primitives * @since 2.2.7 */ -export const UnknownArray: Decoder> = fromGuard(G.UnknownArray, 'Array') +export const UnknownArray: Decoder> = + /*#__PURE__*/ + fromGuard(G.UnknownArray, 'Array') /** * @category primitives * @since 2.2.7 */ -export const UnknownRecord: Decoder> = fromGuard(G.UnknownRecord, 'Record') +export const UnknownRecord: Decoder> = + /*#__PURE__*/ + fromGuard(G.UnknownRecord, 'Record') // ------------------------------------------------------------------------------------- // combinators @@ -133,7 +144,9 @@ export const UnknownRecord: Decoder> = fromGuard(G.Unkno export const withExpected: ( decoder: Decoder, expected: (actual: unknown, e: DecodeError) => DecodeError -) => Decoder = DT.withExpected(M) +) => Decoder = + /*#__PURE__*/ + DT.withExpected(M) /** * @category combinators @@ -146,57 +159,57 @@ export const refine = (refinement: (a: A) => a is B, id: string) * @category combinators * @since 2.2.7 */ -export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = DT.parse(M) +export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = + /*#__PURE__*/ + DT.parse(M) /** * @category combinators * @since 2.2.7 */ -export const nullable: (or: Decoder) => Decoder = DT.nullable(M)((u, e) => - FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e))) -) +export const nullable: (or: Decoder) => Decoder = + /*#__PURE__*/ + DT.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ -export const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> = DT.type( - M -)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) +export const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> = + /*#__PURE__*/ + DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) /** * @category combinators * @since 2.2.7 */ -export const partial: ( - properties: { [K in keyof A]: Decoder } -) => Decoder> = DT.partial(M)(UnknownRecord, (k, e) => - FS.of(DE.key(k, DE.optional, e)) -) +export const partial: (properties: { [K in keyof A]: Decoder }) => Decoder> = + /*#__PURE__*/ + DT.partial(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators * @since 2.2.7 */ -export const array: (items: Decoder) => Decoder> = DT.array(M)(UnknownArray, (i, e) => - FS.of(DE.index(i, DE.optional, e)) -) +export const array: (items: Decoder) => Decoder> = + /*#__PURE__*/ + DT.array(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.optional, e))) /** * @category combinators * @since 2.2.7 */ -export const record: (codomain: Decoder) => Decoder> = DT.record(M)(UnknownRecord, (k, e) => - FS.of(DE.key(k, DE.optional, e)) -) +export const record: (codomain: Decoder) => Decoder> = + /*#__PURE__*/ + DT.record(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators * @since 2.2.7 */ -export const tuple: >( - ...components: { [K in keyof A]: Decoder } -) => Decoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any +export const tuple: >(...components: { [K in keyof A]: Decoder }) => Decoder = + /*#__PURE__*/ + DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any /** * @category combinators @@ -204,23 +217,25 @@ export const tuple: >( */ export const union: ]>( ...members: { [K in keyof A]: Decoder } -) => Decoder = DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any +) => Decoder = + /*#__PURE__*/ + DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators * @since 2.2.7 */ -export const intersect: (right: Decoder) => (left: Decoder) => Decoder = DT.intersect(M) +export const intersect: (right: Decoder) => (left: Decoder) => Decoder = + /*#__PURE__*/ + DT.intersect(M) /** * @category combinators * @since 2.2.7 */ -export const sum: ( - tag: T -) => (members: { [K in keyof A]: Decoder }) => Decoder = DT.sum(M)( - UnknownRecord, - (tag, value, keys) => +export const sum: (tag: T) => (members: { [K in keyof A]: Decoder }) => Decoder = + /*#__PURE__*/ + DT.sum(M)(UnknownRecord, (tag, value, keys) => FS.of( DE.key( tag, @@ -228,13 +243,15 @@ export const sum: ( FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) ) ) -) + ) /** * @category combinators * @since 2.2.7 */ -export const lazy: (id: string, f: () => Decoder) => Decoder = DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +export const lazy: (id: string, f: () => Decoder) => Decoder = + /*#__PURE__*/ + DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index ff90a7c7f..c2e8d7c31 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -19,12 +19,18 @@ import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } // DecoderT config // ------------------------------------------------------------------------------------- -const M = TE.getTaskValidation(DE.getSemigroup()) -const fromGuardM = DT.fromGuard(M) -const literalM = DT.literal(M)((u, values) => - FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | '))) -) -const refineM = DT.refine(M) +const M = + /*#__PURE__*/ + TE.getTaskValidation(DE.getSemigroup()) +const fromGuardM = + /*#__PURE__*/ + DT.fromGuard(M) +const literalM = + /*#__PURE__*/ + DT.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) +const refineM = + /*#__PURE__*/ + DT.refine(M) // ------------------------------------------------------------------------------------- // model @@ -52,25 +58,20 @@ export type DecodeError = FS.FreeSemigroup> * @category DecodeError * @since 2.2.7 */ -export function error(actual: unknown, message: string): DecodeError { - return FS.of(DE.leaf(actual, message)) -} +export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) /** * @category DecodeError * @since 2.2.7 */ -export function success(a: A): TE.TaskEither { - return TE.right(a) -} +export const success: (a: A) => TE.TaskEither = TE.right /** * @category DecodeError * @since 2.2.7 */ -export function failure(actual: unknown, message: string): TE.TaskEither { - return TE.left(error(actual, message)) -} +export const failure = (actual: unknown, message: string): TE.TaskEither => + TE.left(error(actual, message)) // ------------------------------------------------------------------------------------- // constructors @@ -106,31 +107,41 @@ export const literal = ]>(...valu * @category primitives * @since 2.2.7 */ -export const string: TaskDecoder = fromDecoder(D.string) +export const string: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.string) /** * @category primitives * @since 2.2.7 */ -export const number: TaskDecoder = fromDecoder(D.number) +export const number: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.number) /** * @category primitives * @since 2.2.7 */ -export const boolean: TaskDecoder = fromDecoder(D.boolean) +export const boolean: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.boolean) /** * @category primitives * @since 2.2.7 */ -export const UnknownArray: TaskDecoder> = fromDecoder(D.UnknownArray) +export const UnknownArray: TaskDecoder> = + /*#__PURE__*/ + fromDecoder(D.UnknownArray) /** * @category primitives * @since 2.2.7 */ -export const UnknownRecord: TaskDecoder> = fromDecoder(D.UnknownRecord) +export const UnknownRecord: TaskDecoder> = + /*#__PURE__*/ + fromDecoder(D.UnknownRecord) // ------------------------------------------------------------------------------------- // combinators @@ -143,40 +154,44 @@ export const UnknownRecord: TaskDecoder> = fromDecoder(D export const withExpected: ( decoder: TaskDecoder, expected: (actual: unknown, e: DecodeError) => DecodeError -) => TaskDecoder = DT.withExpected(M) +) => TaskDecoder = + /*#__PURE__*/ + DT.withExpected(M) /** * @category combinators * @since 2.2.7 */ -export const parse: ( - parser: (a: A) => TE.TaskEither -) => (from: TaskDecoder) => TaskDecoder = DT.parse(M) +export const refine = ( + refinement: (a: A) => a is B, + id: string +): ((from: TaskDecoder) => TaskDecoder) => refineM(refinement, (u) => FS.of(DE.leaf(u, id))) /** * @category combinators * @since 2.2.7 */ -export const refine = ( - refinement: (a: A) => a is B, - id: string -): ((from: TaskDecoder) => TaskDecoder) => refineM(refinement, (u) => FS.of(DE.leaf(u, id))) +export const parse: ( + parser: (a: A) => TE.TaskEither +) => (from: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + DT.parse(M) /** * @category combinators * @since 2.2.7 */ -export const nullable: (or: TaskDecoder) => TaskDecoder = DT.nullable(M)((u, e) => - FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e))) -) +export const nullable: (or: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + DT.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ -export const type: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder<{ [K in keyof A]: A[K] }> = DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) +export const type: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder<{ [K in keyof A]: A[K] }> = + /*#__PURE__*/ + DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) /** * @category combinators @@ -184,26 +199,25 @@ export const type: ( */ export const partial: ( properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder> = DT.partial(M)(UnknownRecord, (k, e) => - FS.of(DE.key(k, DE.optional, e)) -) +) => TaskDecoder> = + /*#__PURE__*/ + DT.partial(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators * @since 2.2.7 */ -export const array: (items: TaskDecoder) => TaskDecoder> = DT.array(M)(UnknownArray, (i, e) => - FS.of(DE.index(i, DE.optional, e)) -) +export const array: (items: TaskDecoder) => TaskDecoder> = + /*#__PURE__*/ + DT.array(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.optional, e))) /** * @category combinators * @since 2.2.7 */ -export const record: (codomain: TaskDecoder) => TaskDecoder> = DT.record(M)( - UnknownRecord, - (k, e) => FS.of(DE.key(k, DE.optional, e)) -) +export const record: (codomain: TaskDecoder) => TaskDecoder> = + /*#__PURE__*/ + DT.record(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators @@ -211,7 +225,9 @@ export const record: (codomain: TaskDecoder) => TaskDecoder>( ...components: { [K in keyof A]: TaskDecoder } -) => TaskDecoder = DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any +) => TaskDecoder = + /*#__PURE__*/ + DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any /** * @category combinators @@ -219,13 +235,17 @@ export const tuple: >( */ export const union: ]>( ...members: { [K in keyof A]: TaskDecoder } -) => TaskDecoder = DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any +) => TaskDecoder = + /*#__PURE__*/ + DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators * @since 2.2.7 */ -export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = DT.intersect(M) +export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + DT.intersect(M) /** * @category combinators @@ -233,9 +253,9 @@ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) */ export const sum: ( tag: T -) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder = DT.sum(M)( - UnknownRecord, - (tag, value, keys) => +) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder = + /*#__PURE__*/ + DT.sum(M)(UnknownRecord, (tag, value, keys) => FS.of( DE.key( tag, @@ -243,15 +263,15 @@ export const sum: ( FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) ) ) -) + ) /** * @category combinators * @since 2.2.7 */ -export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = DT.lazy(M)((id, e) => - FS.of(DE.lazy(id, e)) -) +export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables From 79bf22ea2f07901c02dc7df6a2ec04905b89ec5e Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 07:07:25 +0200 Subject: [PATCH 073/222] remove useless functions in TaskDecoder --- docs/modules/Decoder.ts.md | 11 ----------- docs/modules/TaskDecoder.ts.md | 11 ----------- src/Decoder.ts | 2 +- src/TaskDecoder.ts | 23 +++-------------------- 4 files changed, 4 insertions(+), 43 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 4ce6af640..2a7ef0ecc 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -54,7 +54,6 @@ Added in v2.2.7 - [string](#string) - [utils](#utils) - [draw](#draw) - - [stringify](#stringify) --- @@ -429,13 +428,3 @@ export declare const draw: (e: FS.FreeSemigroup>) => stri ``` Added in v2.2.7 - -## stringify - -**Signature** - -```ts -export declare const stringify: (e: E.Either>, A>) => string -``` - -Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 761e4e624..67f3fe818 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -55,7 +55,6 @@ Added in v2.2.7 - [string](#string) - [utils](#utils) - [draw](#draw) - - [stringify](#stringify) --- @@ -442,13 +441,3 @@ export declare const draw: (e: FS.FreeSemigroup>) => stri ``` Added in v2.2.7 - -## stringify - -**Signature** - -```ts -export declare const stringify: (e: TE.TaskEither>, A>) => T.Task -``` - -Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index 6e79c6c60..5456a9a9e 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -376,7 +376,7 @@ const toForest = (e: DecodeError): NEA.NonEmptyArray> => { export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') /** - * @since 2.2.7 + * @internal */ export const stringify: (e: E.Either) => string = E.fold( (e) => draw(e), diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index c2e8d7c31..8d0b0b1a1 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -3,16 +3,14 @@ */ import { Alt1 } from 'fp-ts/lib/Alt' import { Functor1 } from 'fp-ts/lib/Functor' -import * as NEA from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' -import { drawTree, make, Tree } from 'fp-ts/lib/Tree' import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' +import * as D from './Decoder' import * as DT from './DecoderT' import * as G from './Guard' -import * as D from './Decoder' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -379,28 +377,13 @@ export const schemableTaskDecoder: Schemable1 & // utils // ------------------------------------------------------------------------------------- -const toForest = (e: DecodeError): NEA.NonEmptyArray> => { - const toTree: (e: DE.DecodeError) => Tree = DE.fold({ - Leaf: (input, error) => make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => make(`member ${index}`, toForest(errors)), - Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) - }) - const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( - (value) => [toTree(value)], - (left, right) => NEA.concat(toForest(left), toForest(right)) - ) - return toForest(e) -} - /** * @since 2.2.7 */ -export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') +export const draw: (e: DecodeError) => string = D.draw /** - * @since 2.2.7 + * @internal */ export const stringify: (e: TE.TaskEither) => T.Task = TE.fold( (e) => T.of(draw(e)), From d6a76ec25c7f9402ecf884daf8df3f0fccb0c3d2 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 08:55:39 +0200 Subject: [PATCH 074/222] DecoderT: fix refine signature --- docs/modules/DecoderT.ts.md | 12 ++++++------ src/Decoder.ts | 2 +- src/DecoderT.ts | 30 +++++++++++++----------------- src/TaskDecoder.ts | 2 +- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index ffe0e08cb..82e011c30 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -138,7 +138,7 @@ export declare const refine: & Bifunctor2 ) => ( refinement: (a: A) => a is B, - onError: (u: unknown) => E + onError: (a: A) => E ) => (from: DecoderT) => DecoderT ``` @@ -215,7 +215,7 @@ export declare const withExpected: < E >( M: Monad2C & Bifunctor2 -) => (decoder: DecoderT, expected: (actual: unknown, e: E) => E) => DecoderT +) => (decoder: DecoderT, expected: (u: unknown, e: E) => E) => DecoderT ``` Added in v2.2.7 @@ -239,11 +239,11 @@ Added in v2.2.7 **Signature** ```ts -export declare function literal( +export declare const literal: ( M: MonadThrow2C -): ( - onError: (u: unknown, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A) => DecoderT +) => ( + onError: (u: unknown, values: readonly [Literal, ...Literal[]]) => E +) => (...values: A) => DecoderT ``` Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index 5456a9a9e..98308a619 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -153,7 +153,7 @@ export const withExpected: ( * @since 2.2.7 */ export const refine = (refinement: (a: A) => a is B, id: string): ((from: Decoder) => Decoder) => - refineM(refinement, (u) => FS.of(DE.leaf(u, id))) + refineM(refinement, (a) => FS.of(DE.leaf(a, id))) /** * @category combinators diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 6a6e0a6e7..7fdbec995 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -43,15 +43,11 @@ export const fromGuard = (M: MonadThrow2C) => ( * @category constructors * @since 2.2.7 */ -export function literal( - M: MonadThrow2C -): ( +export const literal = (M: MonadThrow2C) => ( onError: (u: unknown, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A) => DecoderT { - return (onError) => (...values) => ({ - decode: (u) => (G.literal(...values).is(u) ? M.of(u) : M.throwError(onError(u, values))) - }) -} +) => ]>(...values: A): DecoderT => ({ + decode: (u) => (G.literal(...values).is(u) ? M.of(u) : M.throwError(onError(u, values))) +}) // ------------------------------------------------------------------------------------- // combinators @@ -63,7 +59,7 @@ export function literal( */ export const withExpected = (M: Monad2C & Bifunctor2) => ( decoder: DecoderT, - expected: (actual: unknown, e: E) => E + expected: (u: unknown, e: E) => E ): DecoderT => ({ decode: (u) => M.mapLeft(decoder.decode(u), (e) => expected(u, e)) }) @@ -74,9 +70,9 @@ export const withExpected = (M: Monad2C & Bifunctor2(M: MonadThrow2C & Bifunctor2) => ( refinement: (a: A) => a is B, - onError: (u: unknown) => E + onError: (a: A) => E ) => (from: DecoderT): DecoderT => ({ - decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(u)))) + decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(a)))) }) /** @@ -120,8 +116,8 @@ export function type( return (UnknownRecord, onKeyError) => (properties) => ({ decode: (u) => M.chain(UnknownRecord.decode(u), (r) => - traverse(properties as Record>, (k, decoder) => - M.mapLeft(decoder.decode(r[k]), (e) => onKeyError(k, e)) + traverse(properties as Record>, (key, decoder) => + M.mapLeft(decoder.decode(r[key]), (e) => onKeyError(key, e)) ) ) as any }) @@ -144,10 +140,10 @@ export function partial( decode: (u) => M.map( M.chain(UnknownRecord.decode(u), (r) => - traverse(properties as Record>, (k, decoder) => { - const rk = r[k] + traverse(properties as Record>, (key, decoder) => { + const rk = r[key] if (rk === undefined) { - return k in r + return key in r ? // don't strip undefined properties undef : // don't add missing properties @@ -155,7 +151,7 @@ export function partial( } return M.bimap( decoder.decode(rk), - (e) => onKeyError(k, e), + (e) => onKeyError(key, e), (a) => E.right(a) ) }) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 8d0b0b1a1..2eef33f79 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -163,7 +163,7 @@ export const withExpected: ( export const refine = ( refinement: (a: A) => a is B, id: string -): ((from: TaskDecoder) => TaskDecoder) => refineM(refinement, (u) => FS.of(DE.leaf(u, id))) +): ((from: TaskDecoder) => TaskDecoder) => refineM(refinement, (a) => FS.of(DE.leaf(a, id))) /** * @category combinators From 24273f6436719cec37a4e9c9c3de675d9d7ab1ed Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 09:04:28 +0200 Subject: [PATCH 075/222] DecoderT: fix nullable implementation --- src/DecoderT.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 7fdbec995..ab1abe5ef 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -94,7 +94,7 @@ export const nullable = (M: Applicative2C & Bifunctor2 ) => (or: DecoderT): DecoderT => ({ decode: (u) => u === null - ? M.of(u) + ? M.of(null) : M.bimap( or.decode(u), (e) => onError(u, e), From b61edaf097d821495c9a7778ad9229a5c5080a3d Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 09:44:29 +0200 Subject: [PATCH 076/222] DecoderT: fix withExpected signature --- docs/modules/DecoderT.ts.md | 19 ++++++++----------- src/DecoderT.ts | 34 +++++++++++++++++----------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 82e011c30..3b46af80f 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -45,7 +45,7 @@ export declare function array( M: Monad2C & Bifunctor2 ): ( UnknownArray: DecoderT>, - onItemError: (i: number, e: E) => E + onItemError: (index: number, e: E) => E ) => (items: DecoderT) => DecoderT> ``` @@ -108,7 +108,7 @@ export declare function partial( M: Monad2C & Bifunctor2 ): ( UnknownRecord: DecoderT>, - onKeyError: (k: string, e: E) => E + onKeyError: (key: string, e: E) => E ) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> ``` @@ -123,7 +123,7 @@ export declare function record( M: Monad2C & Bifunctor2 ): ( UnknownRecord: DecoderT>, - onKeyError: (k: string, e: E) => E + onKeyError: (key: string, e: E) => E ) => (codomain: DecoderT) => DecoderT> ``` @@ -168,7 +168,7 @@ export declare function tuple( M: Monad2C & Bifunctor2 ): ( UnknownArray: DecoderT>, - onIndexError: (i: number, e: E) => E + onIndexError: (index: number, e: E) => E ) => >(...components: { [K in keyof A]: DecoderT }) => DecoderT ``` @@ -183,7 +183,7 @@ export declare function type( M: Monad2C & Bifunctor2 ): ( UnknownRecord: DecoderT>, - onKeyError: (k: string, e: E) => E + onKeyError: (key: string, e: E) => E ) => (properties: { [K in keyof A]: DecoderT }) => DecoderT ``` @@ -210,12 +210,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const withExpected: < - M extends 'io-ts/Codec' | 'io-ts/Encoder' | 'Either' | 'IOEither' | 'TaskEither', - E ->( - M: Monad2C & Bifunctor2 -) => (decoder: DecoderT, expected: (u: unknown, e: E) => E) => DecoderT +export declare const withExpected: ( + M: Bifunctor2 +) => (decoder: DecoderT, expected: (u: unknown, e: E) => E) => DecoderT ``` Added in v2.2.7 diff --git a/src/DecoderT.ts b/src/DecoderT.ts index ab1abe5ef..da4cffc10 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -57,7 +57,7 @@ export const literal = (M: MonadThrow2C) => ( * @category combinators * @since 2.2.7 */ -export const withExpected = (M: Monad2C & Bifunctor2) => ( +export const withExpected = (M: Bifunctor2) => ( decoder: DecoderT, expected: (u: unknown, e: E) => E ): DecoderT => ({ @@ -110,7 +110,7 @@ export function type( M: Monad2C & Bifunctor2 ): ( UnknownRecord: DecoderT>, - onKeyError: (k: string, e: E) => E + onKeyError: (key: string, e: E) => E ) => (properties: { [K in keyof A]: DecoderT }) => DecoderT { const traverse = traverseRecordWithIndex(M) return (UnknownRecord, onKeyError) => (properties) => ({ @@ -131,7 +131,7 @@ export function partial( M: Monad2C & Bifunctor2 ): ( UnknownRecord: DecoderT>, - onKeyError: (k: string, e: E) => E + onKeyError: (key: string, e: E) => E ) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> { const traverse = traverseRecordWithIndex(M) const skip = M.of>(E.left(undefined)) @@ -169,13 +169,13 @@ export function array( M: Monad2C & Bifunctor2 ): ( UnknownArray: DecoderT>, - onItemError: (i: number, e: E) => E + onItemError: (index: number, e: E) => E ) => (items: DecoderT) => DecoderT> { const traverse = traverseArrayWithIndex(M) return (UnknownArray, onItemError) => (items) => ({ decode: (u) => M.chain(UnknownArray.decode(u), (us) => - traverse(us, (i, u) => M.mapLeft(items.decode(u), (e) => onItemError(i, e))) + traverse(us, (index, u) => M.mapLeft(items.decode(u), (e) => onItemError(index, e))) ) }) } @@ -188,13 +188,13 @@ export function record( M: Monad2C & Bifunctor2 ): ( UnknownRecord: DecoderT>, - onKeyError: (k: string, e: E) => E + onKeyError: (key: string, e: E) => E ) => (codomain: DecoderT) => DecoderT> { const traverse = traverseRecordWithIndex(M) return (UnknownRecord, onKeyError) => (codomain) => ({ decode: (u) => M.chain(UnknownRecord.decode(u), (r) => - traverse(r, (k, u) => M.mapLeft(codomain.decode(u), (e) => onKeyError(k, e))) + traverse(r, (key, u) => M.mapLeft(codomain.decode(u), (e) => onKeyError(key, e))) ) }) } @@ -207,14 +207,14 @@ export function tuple( M: Monad2C & Bifunctor2 ): ( UnknownArray: DecoderT>, - onIndexError: (i: number, e: E) => E + onIndexError: (index: number, e: E) => E ) => >(...components: { [K in keyof A]: DecoderT }) => DecoderT { const traverse = traverseArrayWithIndex(M) return (UnknownArray, onIndexError) => (...components) => ({ decode: (u) => M.chain(UnknownArray.decode(u), (us) => - traverse((components as unknown) as Array>, (i, decoder) => - M.mapLeft(decoder.decode(us[i]), (e) => onIndexError(i, e)) + traverse((components as unknown) as Array>, (index, decoder) => + M.mapLeft(decoder.decode(us[index]), (e) => onIndexError(index, e)) ) ) as any }) @@ -231,8 +231,8 @@ export const union = (M: Alt2C & Bifunctor2) => ( ): DecoderT => ({ decode: (u) => { let out: Kind2 = M.mapLeft(members[0].decode(u), (e) => onMemberError(0, e)) - for (let i = 1; i < members.length; i++) { - out = M.alt(out, () => M.mapLeft(members[i].decode(u), (e) => onMemberError(i, e))) + for (let index = 1; index < members.length; index++) { + out = M.alt(out, () => M.mapLeft(members[index].decode(u), (e) => onMemberError(index, e))) } return out } @@ -301,13 +301,13 @@ const traverseArrayWithIndex = (M: Applicative2C) => < f: (i: number, a: A) => Kind2 ): Kind2> => { return as.reduce( - (mbs, a, i) => + (mbs, a, index) => M.ap( M.map(mbs, (bs) => (b: B) => { bs.push(b) return bs }), - f(i, a) + f(index, a) ), M.of>([]) ) @@ -336,10 +336,10 @@ const traverseRecordWithIndex = (M: Applicative2C) => const compactRecord = (r: Record>): Record => { const out: Record = {} - for (const k in r) { - const rk = r[k] + for (const key in r) { + const rk = r[key] if (E.isRight(rk)) { - out[k] = rk.right + out[key] = rk.right } } return out From f1fd92e4a931d1e444d3bf43501196a734cf2629 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 09:52:14 +0200 Subject: [PATCH 077/222] DecoderT: fix parse signature --- docs/modules/DecoderT.ts.md | 2 +- src/DecoderT.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 3b46af80f..8a8ddabae 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -93,7 +93,7 @@ Added in v2.2.7 ```ts export declare const parse: ( - M: MonadThrow2C & Bifunctor2 + M: Monad2C ) => (parser: (a: A) => Kind2) => (from: DecoderT) => DecoderT ``` diff --git a/src/DecoderT.ts b/src/DecoderT.ts index da4cffc10..39b93da11 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -79,9 +79,9 @@ export const refine = (M: MonadThrow2C & Bifunctor2 * @category combinators * @since 2.2.7 */ -export const parse = (M: MonadThrow2C & Bifunctor2) => ( - parser: (a: A) => Kind2 -) => (from: DecoderT): DecoderT => ({ +export const parse = (M: Monad2C) => (parser: (a: A) => Kind2) => ( + from: DecoderT +): DecoderT => ({ decode: (u) => M.chain(from.decode(u), (a) => parser(a)) }) From 2e4c08e2fbe46d0f50fdccb2efa9c7765920962e Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 10:07:43 +0200 Subject: [PATCH 078/222] DecoderT: fix lazy signature --- docs/modules/DecoderT.ts.md | 6 +++--- src/DecoderT.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 8a8ddabae..5116ef688 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -68,9 +68,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const lazy: ( - M: MonadThrow2C & Bifunctor2 -) => (onError: (id: string, e: E) => E) => (id: string, f: () => DecoderT) => DecoderT +export declare const lazy: ( + M: Bifunctor2 +) => (onError: (id: string, e: E) => E) => (id: string, f: () => DecoderT) => DecoderT ``` Added in v2.2.7 diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 39b93da11..41e52d331 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -281,7 +281,7 @@ export const sum = (M: MonadThrow2C) => ( * @category combinators * @since 2.2.7 */ -export const lazy = (M: MonadThrow2C & Bifunctor2) => ( +export const lazy = (M: Bifunctor2) => ( onError: (id: string, e: E) => E ): ((id: string, f: () => DecoderT) => DecoderT) => { return (id: string, f: () => DecoderT): DecoderT => { From c5632b095f52a6a6411d330bdd380c60c2f8e694 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 10:38:51 +0200 Subject: [PATCH 079/222] add Kleisli module --- CHANGELOG.md | 1 + docs/modules/DecoderT.ts.md | 34 ++-- docs/modules/Kleisli.ts.md | 278 +++++++++++++++++++++++++ docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- src/DecoderT.ts | 279 +++++-------------------- src/Kleisli.ts | 347 ++++++++++++++++++++++++++++++++ 11 files changed, 700 insertions(+), 251 deletions(-) create mode 100644 docs/modules/Kleisli.ts.md create mode 100644 src/Kleisli.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index b8295cdea..be76b5b19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - add `DecoderT` module (@gcanti) - add `FreeSemigroup` module (@gcanti) - add `TaskDecoder` module (@gcanti) + - add `Kleisli` module (@gcanti) - (**bc**) remove `Tree` module (@gcanti) - `Decoder` - (**bc**) remove `never` (@gcanti) diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md index 5116ef688..e46289e78 100644 --- a/docs/modules/DecoderT.ts.md +++ b/docs/modules/DecoderT.ts.md @@ -41,12 +41,12 @@ Added in v2.2.7 **Signature** ```ts -export declare function array( +export declare const array: ( M: Monad2C & Bifunctor2 -): ( - UnknownArray: DecoderT>, +) => ( + UnknownArray: DecoderT, onItemError: (index: number, e: E) => E -) => (items: DecoderT) => DecoderT> +) => (items: DecoderT) => DecoderT ``` Added in v2.2.7 @@ -104,9 +104,9 @@ Added in v2.2.7 **Signature** ```ts -export declare function partial( +export declare const partial: ( M: Monad2C & Bifunctor2 -): ( +) => ( UnknownRecord: DecoderT>, onKeyError: (key: string, e: E) => E ) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> @@ -119,9 +119,9 @@ Added in v2.2.7 **Signature** ```ts -export declare function record( +export declare const record: ( M: Monad2C & Bifunctor2 -): ( +) => ( UnknownRecord: DecoderT>, onKeyError: (key: string, e: E) => E ) => (codomain: DecoderT) => DecoderT> @@ -164,12 +164,12 @@ Added in v2.2.7 **Signature** ```ts -export declare function tuple( +export declare const tuple: ( M: Monad2C & Bifunctor2 -): ( - UnknownArray: DecoderT>, +) => ( + UnknownArray: DecoderT, onIndexError: (index: number, e: E) => E -) => >(...components: { [K in keyof A]: DecoderT }) => DecoderT +) => (...components: { [K in keyof A]: DecoderT }) => DecoderT ``` Added in v2.2.7 @@ -179,9 +179,9 @@ Added in v2.2.7 **Signature** ```ts -export declare function type( +export declare const type: ( M: Monad2C & Bifunctor2 -): ( +) => ( UnknownRecord: DecoderT>, onKeyError: (key: string, e: E) => E ) => (properties: { [K in keyof A]: DecoderT }) => DecoderT @@ -197,7 +197,7 @@ Added in v2.2.7 export declare const union: ( M: Alt2C & Bifunctor2 ) => ( - onMemberError: (i: number, e: E) => E + onMemberError: (index: number, e: E) => E ) => ( ...members: { [K in keyof A]: DecoderT } ) => DecoderT @@ -252,9 +252,7 @@ Added in v2.2.7 **Signature** ```ts -export interface DecoderT { - readonly decode: (u: unknown) => Kind2 -} +export interface DecoderT extends K.Kleisli {} ``` Added in v2.2.7 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md new file mode 100644 index 000000000..534ebf48c --- /dev/null +++ b/docs/modules/Kleisli.ts.md @@ -0,0 +1,278 @@ +--- +title: Kleisli.ts +nav_order: 12 +parent: Modules +--- + +## Kleisli overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [combinators](#combinators) + - [array](#array) + - [intersect](#intersect) + - [lazy](#lazy) + - [nullable](#nullable) + - [parse](#parse) + - [partial](#partial) + - [record](#record) + - [refine](#refine) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) + - [withExpected](#withexpected) +- [constructors](#constructors) + - [fromGuard](#fromguard) + - [literal](#literal) +- [model](#model) + - [Kleisli (interface)](#kleisli-interface) +- [utils](#utils) + - [pipe](#pipe) + +--- + +# combinators + +## array + +**Signature** + +```ts +export declare function array( + M: Applicative2C & Bifunctor2 +): (onItemError: (index: number, e: E) => E) => (items: Kleisli) => Kleisli, E, Array
> +``` + +Added in v2.2.7 + +## intersect + +**Signature** + +```ts +export declare const intersect: ( + M: Apply2C +) => (right: Kleisli) => (left: Kleisli) => Kleisli +``` + +Added in v2.2.7 + +## lazy + +**Signature** + +```ts +export declare const lazy: ( + M: Bifunctor2 +) => (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +``` + +Added in v2.2.7 + +## nullable + +**Signature** + +```ts +export declare const nullable: ( + M: Applicative2C & Bifunctor2 +) => (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +``` + +Added in v2.2.7 + +## parse + +**Signature** + +```ts +export declare const parse: ( + M: Monad2C +) => (parser: (a: A) => Kind2) => (from: Kleisli) => Kleisli +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare function partial( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => ( + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare function record( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> +``` + +Added in v2.2.7 + +## refine + +**Signature** + +```ts +export declare const refine: ( + M: MonadThrow2C & Bifunctor2 +) => ( + refinement: (a: A) => a is B, + onError: (a: A) => E +) => (from: Kleisli) => Kleisli +``` + +Added in v2.2.7 + +## sum + +**Signature** + +```ts +export declare const sum: ( + M: MonadThrow2C +) => ( + onTagError: (tag: string, value: unknown, tags: readonly string[]) => E +) => ( + tag: T +) => , A>( + members: { [K in keyof A]: Kleisli } +) => Kleisli +``` + +Added in v2.2.7 + +## tuple + +**Signature** + +```ts +export declare function tuple( + M: Applicative2C & Bifunctor2 +): ( + onIndexError: (index: number, e: E) => E +) => >( + ...components: { [K in keyof A]: Kleisli } +) => Kleisli, E, A> +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare function type( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => ( + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, { [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 + +## union + +**Signature** + +```ts +export declare const union: ( + M: Alt2C & Bifunctor2 +) => ( + onMemberError: (index: number, e: E) => E +) => ( + ...members: { [K in keyof A]: Kleisli } +) => Kleisli +``` + +Added in v2.2.7 + +## withExpected + +**Signature** + +```ts +export declare const withExpected: ( + M: Bifunctor2 +) => (decoder: Kleisli, expected: (i: I, e: E) => E) => Kleisli +``` + +Added in v2.2.7 + +# constructors + +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: ( + M: MonadThrow2C +) => (guard: G.Guard, onError: (i: I) => E) => Kleisli +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare const literal: ( + M: MonadThrow2C +) => ( + onError: (i: I, values: readonly [Literal, ...Literal[]]) => E +) => (...values: A) => Kleisli +``` + +Added in v2.2.7 + +# model + +## Kleisli (interface) + +**Signature** + +```ts +export interface Kleisli { + readonly decode: (i: I) => Kind2 +} +``` + +Added in v2.2.7 + +# utils + +## pipe + +**Signature** + +```ts +export declare const pipe: ( + M: Monad2C +) => (ia: Kleisli, ab: Kleisli) => Kleisli +``` + +Added in v2.2.7 diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 2abc64ffe..1db8dde68 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 12 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 5aea2ce60..175cf05b2 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 13 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index ec28e2aad..d9068def7 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 14 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index ccc6bbf89..5710aaeb2 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 15 +nav_order: 16 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 67f3fe818..c412d25c0 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 16 +nav_order: 17 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index dc35af2f9..1c92d118f 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 17 +nav_order: 18 parent: Modules --- diff --git a/src/DecoderT.ts b/src/DecoderT.ts index 41e52d331..f35f22415 100644 --- a/src/DecoderT.ts +++ b/src/DecoderT.ts @@ -1,16 +1,16 @@ /** * @since 2.2.7 */ +import { Alt2C } from 'fp-ts/lib/Alt' import { Applicative2C } from 'fp-ts/lib/Applicative' +import { Apply2C } from 'fp-ts/lib/Apply' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import * as E from 'fp-ts/lib/Either' import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' -import { Literal, memoize, intersect_ } from './Schemable' -import { Alt2C } from 'fp-ts/lib/Alt' -import { Apply2C } from 'fp-ts/lib/Apply' +import * as K from './Kleisli' +import { Literal } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -20,9 +20,7 @@ import { Apply2C } from 'fp-ts/lib/Apply' * @category model * @since 2.2.7 */ -export interface DecoderT { - readonly decode: (u: unknown) => Kind2 -} +export interface DecoderT extends K.Kleisli {} // ------------------------------------------------------------------------------------- // constructors @@ -32,22 +30,19 @@ export interface DecoderT { * @category constructors * @since 2.2.7 */ -export const fromGuard = (M: MonadThrow2C) => ( - guard: G.Guard, - onError: (u: unknown) => E -): DecoderT => ({ - decode: (u) => (guard.is(u) ? M.of(u) : M.throwError(onError(u))) -}) +export const fromGuard: ( + M: MonadThrow2C +) => (guard: G.Guard, onError: (u: unknown) => E) => DecoderT = K.fromGuard /** * @category constructors * @since 2.2.7 */ -export const literal = (M: MonadThrow2C) => ( +export const literal: ( + M: MonadThrow2C +) => ( onError: (u: unknown, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A): DecoderT => ({ - decode: (u) => (G.literal(...values).is(u) ? M.of(u) : M.throwError(onError(u, values))) -}) +) => ]>(...values: A) => DecoderT = K.literal // ------------------------------------------------------------------------------------- // combinators @@ -57,200 +52,105 @@ export const literal = (M: MonadThrow2C) => ( * @category combinators * @since 2.2.7 */ -export const withExpected = (M: Bifunctor2) => ( - decoder: DecoderT, - expected: (u: unknown, e: E) => E -): DecoderT => ({ - decode: (u) => M.mapLeft(decoder.decode(u), (e) => expected(u, e)) -}) +export const withExpected: ( + M: Bifunctor2 +) => (decoder: DecoderT, expected: (u: unknown, e: E) => E) => DecoderT = K.withExpected /** * @category combinators * @since 2.2.7 */ -export const refine = (M: MonadThrow2C & Bifunctor2) => ( +export const refine: ( + M: MonadThrow2C & Bifunctor2 +) => ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: DecoderT): DecoderT => ({ - decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(a)))) -}) +) => (from: DecoderT) => DecoderT = K.refine /** * @category combinators * @since 2.2.7 */ -export const parse = (M: Monad2C) => (parser: (a: A) => Kind2) => ( - from: DecoderT -): DecoderT => ({ - decode: (u) => M.chain(from.decode(u), (a) => parser(a)) -}) +export const parse: ( + M: Monad2C +) => (parser: (a: A) => Kind2) => (from: DecoderT) => DecoderT = K.parse /** * @category combinators * @since 2.2.7 */ -export const nullable = (M: Applicative2C & Bifunctor2) => ( - onError: (u: unknown, e: E) => E -) => (or: DecoderT): DecoderT => ({ - decode: (u) => - u === null - ? M.of(null) - : M.bimap( - or.decode(u), - (e) => onError(u, e), - (a): A | null => a - ) -}) +export const nullable: ( + M: Applicative2C & Bifunctor2 +) => (onError: (u: unknown, e: E) => E) => (or: DecoderT) => DecoderT = K.nullable /** * @category combinators * @since 2.2.7 */ -export function type( - M: Monad2C & Bifunctor2 -): ( +export const type = (M: Monad2C & Bifunctor2) => ( UnknownRecord: DecoderT>, onKeyError: (key: string, e: E) => E -) => (properties: { [K in keyof A]: DecoderT }) => DecoderT { - const traverse = traverseRecordWithIndex(M) - return (UnknownRecord, onKeyError) => (properties) => ({ - decode: (u) => - M.chain(UnknownRecord.decode(u), (r) => - traverse(properties as Record>, (key, decoder) => - M.mapLeft(decoder.decode(r[key]), (e) => onKeyError(key, e)) - ) - ) as any - }) -} +) => (properties: { [K in keyof A]: DecoderT }): DecoderT => + K.pipe(M)(UnknownRecord, K.type(M)(onKeyError)(properties)) /** * @category combinators * @since 2.2.7 */ -export function partial( - M: Monad2C & Bifunctor2 -): ( +export const partial = (M: Monad2C & Bifunctor2) => ( UnknownRecord: DecoderT>, onKeyError: (key: string, e: E) => E -) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> { - const traverse = traverseRecordWithIndex(M) - const skip = M.of>(E.left(undefined)) - const undef = M.of>(E.right(undefined)) - return (UnknownRecord, onKeyError) => (properties) => ({ - decode: (u) => - M.map( - M.chain(UnknownRecord.decode(u), (r) => - traverse(properties as Record>, (key, decoder) => { - const rk = r[key] - if (rk === undefined) { - return key in r - ? // don't strip undefined properties - undef - : // don't add missing properties - skip - } - return M.bimap( - decoder.decode(rk), - (e) => onKeyError(key, e), - (a) => E.right(a) - ) - }) - ), - compactRecord - ) as any - }) -} +) => (properties: { [K in keyof A]: DecoderT }): DecoderT> => + K.pipe(M)(UnknownRecord, K.partial(M)(onKeyError)(properties)) /** * @category combinators * @since 2.2.7 */ -export function array( - M: Monad2C & Bifunctor2 -): ( +export const array = (M: Monad2C & Bifunctor2) => ( UnknownArray: DecoderT>, onItemError: (index: number, e: E) => E -) => (items: DecoderT) => DecoderT> { - const traverse = traverseArrayWithIndex(M) - return (UnknownArray, onItemError) => (items) => ({ - decode: (u) => - M.chain(UnknownArray.decode(u), (us) => - traverse(us, (index, u) => M.mapLeft(items.decode(u), (e) => onItemError(index, e))) - ) - }) -} +) => (items: DecoderT): DecoderT> => K.pipe(M)(UnknownArray, K.array(M)(onItemError)(items)) /** * @category combinators * @since 2.2.7 */ -export function record( - M: Monad2C & Bifunctor2 -): ( +export const record = (M: Monad2C & Bifunctor2) => ( UnknownRecord: DecoderT>, onKeyError: (key: string, e: E) => E -) => (codomain: DecoderT) => DecoderT> { - const traverse = traverseRecordWithIndex(M) - return (UnknownRecord, onKeyError) => (codomain) => ({ - decode: (u) => - M.chain(UnknownRecord.decode(u), (r) => - traverse(r, (key, u) => M.mapLeft(codomain.decode(u), (e) => onKeyError(key, e))) - ) - }) -} +) => (codomain: DecoderT): DecoderT> => + K.pipe(M)(UnknownRecord, K.record(M)(onKeyError)(codomain)) /** * @category combinators * @since 2.2.7 */ -export function tuple( - M: Monad2C & Bifunctor2 -): ( +export const tuple = (M: Monad2C & Bifunctor2) => ( UnknownArray: DecoderT>, onIndexError: (index: number, e: E) => E -) => >(...components: { [K in keyof A]: DecoderT }) => DecoderT { - const traverse = traverseArrayWithIndex(M) - return (UnknownArray, onIndexError) => (...components) => ({ - decode: (u) => - M.chain(UnknownArray.decode(u), (us) => - traverse((components as unknown) as Array>, (index, decoder) => - M.mapLeft(decoder.decode(us[index]), (e) => onIndexError(index, e)) - ) - ) as any - }) -} +) => >(...components: { [K in keyof A]: DecoderT }): DecoderT => + K.pipe(M)(UnknownArray, K.tuple(M)(onIndexError)(...components)) as any /** * @category combinators * @since 2.2.7 */ -export const union = (M: Alt2C & Bifunctor2) => ( - onMemberError: (i: number, e: E) => E +export const union: ( + M: Alt2C & Bifunctor2 +) => ( + onMemberError: (index: number, e: E) => E ) => ]>( ...members: { [K in keyof A]: DecoderT } -): DecoderT => ({ - decode: (u) => { - let out: Kind2 = M.mapLeft(members[0].decode(u), (e) => onMemberError(0, e)) - for (let index = 1; index < members.length; index++) { - out = M.alt(out, () => M.mapLeft(members[index].decode(u), (e) => onMemberError(index, e))) - } - return out - } -}) +) => DecoderT = K.union as any /** * @category combinators * @since 2.2.7 */ -export const intersect = (M: Apply2C) => (right: DecoderT) => ( - left: DecoderT -): DecoderT => ({ - decode: (u) => - M.ap( - M.map(left.decode(u), (a: A) => (b: B) => intersect_(a, b)), - right.decode(u) - ) -}) +export const intersect: ( + M: Apply2C +) => (right: DecoderT) => (left: DecoderT) => DecoderT = K.intersect /** * @category combinators @@ -259,88 +159,13 @@ export const intersect = (M: Apply2C) => (right: De export const sum = (M: MonadThrow2C) => ( UnknownRecord: DecoderT>, onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => ( - tag: T -): ((members: { [K in keyof A]: DecoderT }) => DecoderT) => { - return (members: { [K in keyof A]: DecoderT }): DecoderT => { - const keys = Object.keys(members) - return { - decode: (u) => - M.chain(UnknownRecord.decode(u), (r) => { - const v = r[tag] as keyof A - if (v in members) { - return members[v].decode(u) - } - return M.throwError(onTagError(tag, v, keys)) - }) - } - } -} +) => (tag: T) => (members: { [K in keyof A]: DecoderT }): DecoderT => + K.pipe(M)(UnknownRecord, K.sum(M)(onTagError)(tag)(members)) /** * @category combinators * @since 2.2.7 */ -export const lazy = (M: Bifunctor2) => ( - onError: (id: string, e: E) => E -): ((id: string, f: () => DecoderT) => DecoderT) => { - return (id: string, f: () => DecoderT): DecoderT => { - const get = memoize>(f) - return { - decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) - } - } -} - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -const traverseArrayWithIndex = (M: Applicative2C) => ( - as: Array, - f: (i: number, a: A) => Kind2 -): Kind2> => { - return as.reduce( - (mbs, a, index) => - M.ap( - M.map(mbs, (bs) => (b: B) => { - bs.push(b) - return bs - }), - f(index, a) - ), - M.of>([]) - ) -} - -const traverseRecordWithIndex = (M: Applicative2C) => ( - r: Record, - f: (k: string, a: A) => Kind2 -): Kind2> => { - const ks = Object.keys(r) - if (ks.length === 0) { - return M.of({}) - } - let fr: Kind2> = M.of({}) - for (const key of ks) { - fr = M.ap( - M.map(fr, (r) => (b: B) => { - r[key] = b - return r - }), - f(key, r[key]) - ) - } - return fr -} - -const compactRecord = (r: Record>): Record => { - const out: Record = {} - for (const key in r) { - const rk = r[key] - if (E.isRight(rk)) { - out[key] = rk.right - } - } - return out -} +export const lazy: ( + M: Bifunctor2 +) => (onError: (id: string, e: E) => E) => (id: string, f: () => DecoderT) => DecoderT = K.lazy diff --git a/src/Kleisli.ts b/src/Kleisli.ts new file mode 100644 index 000000000..5840d5a00 --- /dev/null +++ b/src/Kleisli.ts @@ -0,0 +1,347 @@ +/** + * @since 2.2.7 + */ +import { Alt2C } from 'fp-ts/lib/Alt' +import { Applicative2C } from 'fp-ts/lib/Applicative' +import { Apply2C } from 'fp-ts/lib/Apply' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import * as E from 'fp-ts/lib/Either' +import { Kind2, URIS2 } from 'fp-ts/lib/HKT' +import { Monad2C } from 'fp-ts/lib/Monad' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import * as G from './Guard' +import { intersect_, Literal, memoize } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface Kleisli { + readonly decode: (i: I) => Kind2 +} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (M: MonadThrow2C) => ( + guard: G.Guard, + onError: (i: I) => E +): Kleisli => ({ + decode: (i) => (guard.is(i) ? M.of(i) : M.throwError(onError(i))) +}) + +/** + * @category constructors + * @since 2.2.7 + */ +export const literal = (M: MonadThrow2C) => ( + onError: (i: I, values: readonly [Literal, ...Array]) => E +) => ]>(...values: A): Kleisli => ({ + decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) +}) + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @category combinators + * @since 2.2.7 + */ +export const withExpected = (M: Bifunctor2) => ( + decoder: Kleisli, + expected: (i: I, e: E) => E +): Kleisli => ({ + decode: (i) => M.mapLeft(decoder.decode(i), (e) => expected(i, e)) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const refine = (M: MonadThrow2C & Bifunctor2) => ( + refinement: (a: A) => a is B, + onError: (a: A) => E +) => (from: Kleisli): Kleisli => ({ + decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(a)))) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const parse = (M: Monad2C) => (parser: (a: A) => Kind2) => ( + from: Kleisli +): Kleisli => ({ + decode: (u) => M.chain(from.decode(u), (a) => parser(a)) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const nullable = (M: Applicative2C & Bifunctor2) => ( + onError: (i: I, e: E) => E +) => (or: Kleisli): Kleisli => ({ + decode: (i) => + i === null + ? M.of(null) + : M.bimap( + or.decode(i), + (e) => onError(i, e), + (a): A | null => a + ) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export function type( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => ( + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, { [K in keyof A]: A[K] }> { + const traverse = traverseRecordWithIndex(M) + return (onKeyError) => (properties) => ({ + decode: (i) => + traverse(properties as Record>, (k, decoder) => + M.mapLeft(decoder.decode(i[k]), (e) => onKeyError(k, e)) + ) as any + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export function partial( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => ( + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> { + const traverse = traverseRecordWithIndex(M) + const skip = M.of>(E.left(undefined)) + const undef = M.of>(E.right(undefined)) + return (onKeyError) => (properties) => ({ + decode: (i) => + M.map( + traverse(properties as Record>, (k, decoder) => { + const ik = i[k] + if (ik === undefined) { + return k in i + ? // don't strip undefined properties + undef + : // don't add missing properties + skip + } + return M.bimap( + decoder.decode(ik), + (e) => onKeyError(k, e), + (a) => E.right(a) + ) + }), + compactRecord + ) as any + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export function array( + M: Applicative2C & Bifunctor2 +): ( + onItemError: (index: number, e: E) => E +) => (items: Kleisli) => Kleisli, E, Array> { + const traverse = traverseArrayWithIndex(M) + return (onItemError) => (items) => ({ + decode: (is) => traverse(is, (index, i) => M.mapLeft(items.decode(i), (e) => onItemError(index, e))) + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export function record( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> { + const traverse = traverseRecordWithIndex(M) + return (onKeyError) => (codomain) => ({ + decode: (ir) => traverse(ir, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export function tuple( + M: Applicative2C & Bifunctor2 +): ( + onIndexError: (index: number, e: E) => E +) => >( + ...components: { [K in keyof A]: Kleisli } +) => Kleisli, E, A> { + const traverse = traverseArrayWithIndex(M) + return (onIndexError) => (...components) => ({ + decode: (is) => + traverse((components as unknown) as Array>, (index, decoder) => + M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) + ) as any + }) +} + +/** + * @category combinators + * @since 2.2.7 + */ +export const union = (M: Alt2C & Bifunctor2) => ( + onMemberError: (index: number, e: E) => E +) => ]>( + ...members: { [K in keyof A]: Kleisli } +): Kleisli => ({ + decode: (i) => { + let out: Kind2 = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) + for (let index = 1; index < members.length; index++) { + out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) + } + return out + } +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const intersect = (M: Apply2C) => (right: Kleisli) => ( + left: Kleisli +): Kleisli => ({ + decode: (i) => + M.ap( + M.map(left.decode(i), (a: A) => (b: B) => intersect_(a, b)), + right.decode(i) + ) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const sum = (M: MonadThrow2C) => ( + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +): (, A>( + members: { [K in keyof A]: Kleisli } +) => Kleisli) => { + return , A>( + members: { [K in keyof A]: Kleisli } + ): Kleisli => { + const keys = Object.keys(members) + return { + decode: (ir) => { + const v = ir[tag] + if (v in members) { + return (members as any)[v].decode(ir) + } + return M.throwError(onTagError(tag, v, keys)) + } + } + } +} + +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy = (M: Bifunctor2) => ( + onError: (id: string, e: E) => E +): ((id: string, f: () => Kleisli) => Kleisli) => { + return (id: string, f: () => Kleisli): Kleisli => { + const get = memoize>(f) + return { + decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) + } + } +} + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +const traverseArrayWithIndex = (M: Applicative2C) => ( + as: Array, + f: (i: number, a: A) => Kind2 +): Kind2> => { + return as.reduce( + (mbs, a, i) => + M.ap( + M.map(mbs, (bs) => (b: B) => { + bs.push(b) + return bs + }), + f(i, a) + ), + M.of>([]) + ) +} + +const traverseRecordWithIndex = (M: Applicative2C) => ( + r: Record, + f: (k: string, a: A) => Kind2 +): Kind2> => { + const ks = Object.keys(r) + if (ks.length === 0) { + return M.of({}) + } + let fr: Kind2> = M.of({}) + for (const key of ks) { + fr = M.ap( + M.map(fr, (r) => (b: B) => { + r[key] = b + return r + }), + f(key, r[key]) + ) + } + return fr +} + +const compactRecord = (r: Record>): Record => { + const out: Record = {} + for (const k in r) { + const rk = r[k] + if (E.isRight(rk)) { + out[k] = rk.right + } + } + return out +} + +/** + * @since 2.2.7 + */ +export const pipe = (M: Monad2C) => ( + ia: Kleisli, + ab: Kleisli +): Kleisli => ({ + decode: (i) => M.chain(ia.decode(i), ab.decode) +}) From fb2c6d605eb7f867fd788d156f472afd86bebc8c Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 15:02:22 +0200 Subject: [PATCH 080/222] remove DecoderT module --- CHANGELOG.md | 1 - docs/modules/DecoderT.ts.md | 258 ------------------------------- docs/modules/Encoder.ts.md | 2 +- docs/modules/Eq.ts.md | 2 +- docs/modules/FreeSemigroup.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/Kleisli.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 2 +- src/Decoder.ts | 81 +++++----- src/DecoderT.ts | 171 -------------------- src/TaskDecoder.ts | 87 +++++------ 19 files changed, 87 insertions(+), 539 deletions(-) delete mode 100644 docs/modules/DecoderT.ts.md delete mode 100644 src/DecoderT.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index be76b5b19..30a4e86cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,6 @@ - **Experimental** - add `DecodeError` module (@gcanti) - - add `DecoderT` module (@gcanti) - add `FreeSemigroup` module (@gcanti) - add `TaskDecoder` module (@gcanti) - add `Kleisli` module (@gcanti) diff --git a/docs/modules/DecoderT.ts.md b/docs/modules/DecoderT.ts.md deleted file mode 100644 index e46289e78..000000000 --- a/docs/modules/DecoderT.ts.md +++ /dev/null @@ -1,258 +0,0 @@ ---- -title: DecoderT.ts -nav_order: 4 -parent: Modules ---- - -## DecoderT overview - -Added in v2.2.7 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [array](#array) - - [intersect](#intersect) - - [lazy](#lazy) - - [nullable](#nullable) - - [parse](#parse) - - [partial](#partial) - - [record](#record) - - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) - - [union](#union) - - [withExpected](#withexpected) -- [constructors](#constructors) - - [fromGuard](#fromguard) - - [literal](#literal) -- [model](#model) - - [DecoderT (interface)](#decodert-interface) - ---- - -# combinators - -## array - -**Signature** - -```ts -export declare const array: ( - M: Monad2C & Bifunctor2 -) => ( - UnknownArray: DecoderT, - onItemError: (index: number, e: E) => E -) =>
(items: DecoderT) => DecoderT -``` - -Added in v2.2.7 - -## intersect - -**Signature** - -```ts -export declare const intersect: ( - M: Apply2C -) => (right: DecoderT) => (left: DecoderT) => DecoderT -``` - -Added in v2.2.7 - -## lazy - -**Signature** - -```ts -export declare const lazy: ( - M: Bifunctor2 -) => (onError: (id: string, e: E) => E) => (id: string, f: () => DecoderT) => DecoderT -``` - -Added in v2.2.7 - -## nullable - -**Signature** - -```ts -export declare const nullable: ( - M: Applicative2C & Bifunctor2 -) => (onError: (u: unknown, e: E) => E) => (or: DecoderT) => DecoderT -``` - -Added in v2.2.7 - -## parse - -**Signature** - -```ts -export declare const parse: ( - M: Monad2C -) => (parser: (a: A) => Kind2) => (from: DecoderT) => DecoderT -``` - -Added in v2.2.7 - -## partial - -**Signature** - -```ts -export declare const partial: ( - M: Monad2C & Bifunctor2 -) => ( - UnknownRecord: DecoderT>, - onKeyError: (key: string, e: E) => E -) => (properties: { [K in keyof A]: DecoderT }) => DecoderT> -``` - -Added in v2.2.7 - -## record - -**Signature** - -```ts -export declare const record: ( - M: Monad2C & Bifunctor2 -) => ( - UnknownRecord: DecoderT>, - onKeyError: (key: string, e: E) => E -) => (codomain: DecoderT) => DecoderT> -``` - -Added in v2.2.7 - -## refine - -**Signature** - -```ts -export declare const refine: ( - M: MonadThrow2C & Bifunctor2 -) => ( - refinement: (a: A) => a is B, - onError: (a: A) => E -) => (from: DecoderT) => DecoderT -``` - -Added in v2.2.7 - -## sum - -**Signature** - -```ts -export declare const sum: ( - M: MonadThrow2C -) => ( - UnknownRecord: DecoderT>, - onTagError: (tag: string, value: unknown, tags: readonly string[]) => E -) => (tag: T) => (members: { [K in keyof A]: DecoderT }) => DecoderT -``` - -Added in v2.2.7 - -## tuple - -**Signature** - -```ts -export declare const tuple: ( - M: Monad2C & Bifunctor2 -) => ( - UnknownArray: DecoderT, - onIndexError: (index: number, e: E) => E -) => (...components: { [K in keyof A]: DecoderT }) => DecoderT -``` - -Added in v2.2.7 - -## type - -**Signature** - -```ts -export declare const type: ( - M: Monad2C & Bifunctor2 -) => ( - UnknownRecord: DecoderT>, - onKeyError: (key: string, e: E) => E -) => (properties: { [K in keyof A]: DecoderT }) => DecoderT -``` - -Added in v2.2.7 - -## union - -**Signature** - -```ts -export declare const union: ( - M: Alt2C & Bifunctor2 -) => ( - onMemberError: (index: number, e: E) => E -) => ( - ...members: { [K in keyof A]: DecoderT } -) => DecoderT -``` - -Added in v2.2.7 - -## withExpected - -**Signature** - -```ts -export declare const withExpected: ( - M: Bifunctor2 -) => (decoder: DecoderT, expected: (u: unknown, e: E) => E) => DecoderT -``` - -Added in v2.2.7 - -# constructors - -## fromGuard - -**Signature** - -```ts -export declare const fromGuard: ( - M: MonadThrow2C -) => (guard: G.Guard, onError: (u: unknown) => E) => DecoderT -``` - -Added in v2.2.7 - -## literal - -**Signature** - -```ts -export declare const literal: ( - M: MonadThrow2C -) => ( - onError: (u: unknown, values: readonly [Literal, ...Literal[]]) => E -) => (...values: A) => DecoderT -``` - -Added in v2.2.7 - -# model - -## DecoderT (interface) - -**Signature** - -```ts -export interface DecoderT extends K.Kleisli {} -``` - -Added in v2.2.7 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 74cb8d79e..df97a1309 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -1,6 +1,6 @@ --- title: Encoder.ts -nav_order: 5 +nav_order: 4 parent: Modules --- diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 5e3add0cf..ecaf8b042 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -1,6 +1,6 @@ --- title: Eq.ts -nav_order: 6 +nav_order: 5 parent: Modules --- diff --git a/docs/modules/FreeSemigroup.ts.md b/docs/modules/FreeSemigroup.ts.md index 4ebe5a8a3..54ce8453f 100644 --- a/docs/modules/FreeSemigroup.ts.md +++ b/docs/modules/FreeSemigroup.ts.md @@ -1,6 +1,6 @@ --- title: FreeSemigroup.ts -nav_order: 7 +nav_order: 6 parent: Modules --- diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index e00814754..c7356afd4 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -1,6 +1,6 @@ --- title: Guard.ts -nav_order: 8 +nav_order: 7 parent: Modules --- diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index d3d6adc8d..1a06c9766 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -1,6 +1,6 @@ --- title: JsonCodec.ts -nav_order: 10 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 2f5f1c71e..e9c2d63fc 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 11 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 534ebf48c..3e031a5b3 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -1,6 +1,6 @@ --- title: Kleisli.ts -nav_order: 12 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 1db8dde68..2abc64ffe 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 13 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 175cf05b2..5aea2ce60 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 14 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index d9068def7..ec28e2aad 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 15 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 5710aaeb2..ccc6bbf89 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 16 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index c412d25c0..67f3fe818 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 17 +nav_order: 16 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 1c92d118f..dc35af2f9 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 18 +nav_order: 17 parent: Modules --- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 0ee2410e8..393ec5095 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -1,6 +1,6 @@ --- title: index.ts -nav_order: 9 +nav_order: 8 parent: Modules --- diff --git a/src/Decoder.ts b/src/Decoder.ts index 98308a619..e1021fd8b 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -7,28 +7,19 @@ import { Functor1 } from 'fp-ts/lib/Functor' import * as NEA from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Tree' -import * as FS from './FreeSemigroup' import * as DE from './DecodeError' -import * as DT from './DecoderT' +import * as FS from './FreeSemigroup' import * as G from './Guard' +import * as K from './Kleisli' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- -// DecoderT config +// Kleisli config // ------------------------------------------------------------------------------------- const M = /*#__PURE__*/ E.getValidation(DE.getSemigroup()) -const fromGuardM = - /*#__PURE__*/ - DT.fromGuard(M) -const literalM = - /*#__PURE__*/ - DT.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) -const refineM = - /*#__PURE__*/ - DT.refine(M) // ------------------------------------------------------------------------------------- // model @@ -80,14 +71,15 @@ export const failure = (actual: unknown, message: string): E.Either(guard: G.Guard, expected: string): Decoder => - fromGuardM(guard, (u) => FS.of(DE.leaf(u, expected))) + K.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors * @since 2.2.7 */ -export const literal = ]>(...values: A): Decoder => - literalM(...values) +export const literal: ]>(...values: A) => Decoder = + /*#__PURE__*/ + K.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) // ------------------------------------------------------------------------------------- // primitives @@ -146,14 +138,14 @@ export const withExpected: ( expected: (actual: unknown, e: DecodeError) => DecodeError ) => Decoder = /*#__PURE__*/ - DT.withExpected(M) + K.withExpected(M) /** * @category combinators * @since 2.2.7 */ export const refine = (refinement: (a: A) => a is B, id: string): ((from: Decoder) => Decoder) => - refineM(refinement, (a) => FS.of(DE.leaf(a, id))) + K.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) /** * @category combinators @@ -161,7 +153,7 @@ export const refine = (refinement: (a: A) => a is B, id: string) */ export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = /*#__PURE__*/ - DT.parse(M) + K.parse(M) /** * @category combinators @@ -169,47 +161,42 @@ export const parse: (parser: (a: A) => E.Either) => (from: */ export const nullable: (or: Decoder) => Decoder = /*#__PURE__*/ - DT.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) + K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ -export const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> = - /*#__PURE__*/ - DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) +export const type = (properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> => + K.pipe(M)(UnknownRecord, K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) /** * @category combinators * @since 2.2.7 */ -export const partial: (properties: { [K in keyof A]: Decoder }) => Decoder> = - /*#__PURE__*/ - DT.partial(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) +export const partial = (properties: { [K in keyof A]: Decoder }): Decoder> => + K.pipe(M)(UnknownRecord, K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) /** * @category combinators * @since 2.2.7 */ -export const array: (items: Decoder) => Decoder> = - /*#__PURE__*/ - DT.array(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.optional, e))) +export const array = (items: Decoder): Decoder> => + K.pipe(M)(UnknownArray, K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) /** * @category combinators * @since 2.2.7 */ -export const record: (codomain: Decoder) => Decoder> = - /*#__PURE__*/ - DT.record(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) +export const record = (codomain: Decoder): Decoder> => + K.pipe(M)(UnknownRecord, K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) /** * @category combinators * @since 2.2.7 */ -export const tuple: >(...components: { [K in keyof A]: Decoder }) => Decoder = - /*#__PURE__*/ - DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any +export const tuple = >(...components: { [K in keyof A]: Decoder }): Decoder => + K.pipe(M)(UnknownArray, K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) /** * @category combinators @@ -219,7 +206,7 @@ export const union: ]>( ...members: { [K in keyof A]: Decoder } ) => Decoder = /*#__PURE__*/ - DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any + K.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators @@ -227,22 +214,24 @@ export const union: ]>( */ export const intersect: (right: Decoder) => (left: Decoder) => Decoder = /*#__PURE__*/ - DT.intersect(M) + K.intersect(M) /** * @category combinators * @since 2.2.7 */ -export const sum: (tag: T) => (members: { [K in keyof A]: Decoder }) => Decoder = - /*#__PURE__*/ - DT.sum(M)(UnknownRecord, (tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) +export const sum = (tag: T) => (members: { [K in keyof A]: Decoder }): Decoder => + K.pipe(M)( + UnknownRecord, + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) + ) ) - ) + )(tag)(members) ) /** @@ -251,7 +240,7 @@ export const sum: (tag: T) => (members: { [K in keyof A]: D */ export const lazy: (id: string, f: () => Decoder) => Decoder = /*#__PURE__*/ - DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables diff --git a/src/DecoderT.ts b/src/DecoderT.ts deleted file mode 100644 index f35f22415..000000000 --- a/src/DecoderT.ts +++ /dev/null @@ -1,171 +0,0 @@ -/** - * @since 2.2.7 - */ -import { Alt2C } from 'fp-ts/lib/Alt' -import { Applicative2C } from 'fp-ts/lib/Applicative' -import { Apply2C } from 'fp-ts/lib/Apply' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import { Kind2, URIS2 } from 'fp-ts/lib/HKT' -import { Monad2C } from 'fp-ts/lib/Monad' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import * as G from './Guard' -import * as K from './Kleisli' -import { Literal } from './Schemable' - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @category model - * @since 2.2.7 - */ -export interface DecoderT extends K.Kleisli {} - -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromGuard: ( - M: MonadThrow2C -) => (guard: G.Guard, onError: (u: unknown) => E) => DecoderT = K.fromGuard - -/** - * @category constructors - * @since 2.2.7 - */ -export const literal: ( - M: MonadThrow2C -) => ( - onError: (u: unknown, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A) => DecoderT = K.literal - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.7 - */ -export const withExpected: ( - M: Bifunctor2 -) => (decoder: DecoderT, expected: (u: unknown, e: E) => E) => DecoderT = K.withExpected - -/** - * @category combinators - * @since 2.2.7 - */ -export const refine: ( - M: MonadThrow2C & Bifunctor2 -) => ( - refinement: (a: A) => a is B, - onError: (a: A) => E -) => (from: DecoderT) => DecoderT = K.refine - -/** - * @category combinators - * @since 2.2.7 - */ -export const parse: ( - M: Monad2C -) => (parser: (a: A) => Kind2) => (from: DecoderT) => DecoderT = K.parse - -/** - * @category combinators - * @since 2.2.7 - */ -export const nullable: ( - M: Applicative2C & Bifunctor2 -) => (onError: (u: unknown, e: E) => E) => (or: DecoderT) => DecoderT = K.nullable - -/** - * @category combinators - * @since 2.2.7 - */ -export const type = (M: Monad2C & Bifunctor2) => ( - UnknownRecord: DecoderT>, - onKeyError: (key: string, e: E) => E -) => (properties: { [K in keyof A]: DecoderT }): DecoderT => - K.pipe(M)(UnknownRecord, K.type(M)(onKeyError)(properties)) - -/** - * @category combinators - * @since 2.2.7 - */ -export const partial = (M: Monad2C & Bifunctor2) => ( - UnknownRecord: DecoderT>, - onKeyError: (key: string, e: E) => E -) => (properties: { [K in keyof A]: DecoderT }): DecoderT> => - K.pipe(M)(UnknownRecord, K.partial(M)(onKeyError)(properties)) - -/** - * @category combinators - * @since 2.2.7 - */ -export const array = (M: Monad2C & Bifunctor2) => ( - UnknownArray: DecoderT>, - onItemError: (index: number, e: E) => E -) => (items: DecoderT): DecoderT> => K.pipe(M)(UnknownArray, K.array(M)(onItemError)(items)) - -/** - * @category combinators - * @since 2.2.7 - */ -export const record = (M: Monad2C & Bifunctor2) => ( - UnknownRecord: DecoderT>, - onKeyError: (key: string, e: E) => E -) => (codomain: DecoderT): DecoderT> => - K.pipe(M)(UnknownRecord, K.record(M)(onKeyError)(codomain)) - -/** - * @category combinators - * @since 2.2.7 - */ -export const tuple = (M: Monad2C & Bifunctor2) => ( - UnknownArray: DecoderT>, - onIndexError: (index: number, e: E) => E -) => >(...components: { [K in keyof A]: DecoderT }): DecoderT => - K.pipe(M)(UnknownArray, K.tuple(M)(onIndexError)(...components)) as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const union: ( - M: Alt2C & Bifunctor2 -) => ( - onMemberError: (index: number, e: E) => E -) => ]>( - ...members: { [K in keyof A]: DecoderT } -) => DecoderT = K.union as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const intersect: ( - M: Apply2C -) => (right: DecoderT) => (left: DecoderT) => DecoderT = K.intersect - -/** - * @category combinators - * @since 2.2.7 - */ -export const sum = (M: MonadThrow2C) => ( - UnknownRecord: DecoderT>, - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => (tag: T) => (members: { [K in keyof A]: DecoderT }): DecoderT => - K.pipe(M)(UnknownRecord, K.sum(M)(onTagError)(tag)(members)) - -/** - * @category combinators - * @since 2.2.7 - */ -export const lazy: ( - M: Bifunctor2 -) => (onError: (id: string, e: E) => E) => (id: string, f: () => DecoderT) => DecoderT = K.lazy diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 2eef33f79..81dbac08d 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -9,26 +9,17 @@ import * as TE from 'fp-ts/lib/TaskEither' import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as D from './Decoder' -import * as DT from './DecoderT' import * as G from './Guard' +import * as K from './Kleisli' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- -// DecoderT config +// Kleisli config // ------------------------------------------------------------------------------------- const M = /*#__PURE__*/ TE.getTaskValidation(DE.getSemigroup()) -const fromGuardM = - /*#__PURE__*/ - DT.fromGuard(M) -const literalM = - /*#__PURE__*/ - DT.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) -const refineM = - /*#__PURE__*/ - DT.refine(M) // ------------------------------------------------------------------------------------- // model @@ -88,14 +79,15 @@ export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ * @since 2.2.7 */ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => - fromGuardM(guard, (u) => FS.of(DE.leaf(u, expected))) + K.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors * @since 2.2.7 */ -export const literal = ]>(...values: A): TaskDecoder => - literalM(...values) +export const literal: ]>(...values: A) => TaskDecoder = + /*#__PURE__*/ + K.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) // ------------------------------------------------------------------------------------- // primitives @@ -154,7 +146,7 @@ export const withExpected: ( expected: (actual: unknown, e: DecodeError) => DecodeError ) => TaskDecoder = /*#__PURE__*/ - DT.withExpected(M) + K.withExpected(M) /** * @category combinators @@ -163,7 +155,7 @@ export const withExpected: ( export const refine = ( refinement: (a: A) => a is B, id: string -): ((from: TaskDecoder) => TaskDecoder) => refineM(refinement, (a) => FS.of(DE.leaf(a, id))) +): ((from: TaskDecoder) => TaskDecoder) => K.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) /** * @category combinators @@ -173,7 +165,7 @@ export const parse: ( parser: (a: A) => TE.TaskEither ) => (from: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - DT.parse(M) + K.parse(M) /** * @category combinators @@ -181,51 +173,46 @@ export const parse: ( */ export const nullable: (or: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - DT.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) + K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ -export const type: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder<{ [K in keyof A]: A[K] }> = - /*#__PURE__*/ - DT.type(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.required, e))) +export const type = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder<{ [K in keyof A]: A[K] }> => + K.pipe(M)(UnknownRecord, K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) /** * @category combinators * @since 2.2.7 */ -export const partial: ( +export const partial = ( properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder> = - /*#__PURE__*/ - DT.partial(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) +): TaskDecoder> => + K.pipe(M)(UnknownRecord, K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) /** * @category combinators * @since 2.2.7 */ -export const array: (items: TaskDecoder) => TaskDecoder> = - /*#__PURE__*/ - DT.array(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.optional, e))) +export const array = (items: TaskDecoder): TaskDecoder> => + K.pipe(M)(UnknownArray, K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) /** * @category combinators * @since 2.2.7 */ -export const record: (codomain: TaskDecoder) => TaskDecoder> = - /*#__PURE__*/ - DT.record(M)(UnknownRecord, (k, e) => FS.of(DE.key(k, DE.optional, e))) +export const record = (codomain: TaskDecoder): TaskDecoder> => + K.pipe(M)(UnknownRecord, K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) /** * @category combinators * @since 2.2.7 */ -export const tuple: >( +export const tuple = >( ...components: { [K in keyof A]: TaskDecoder } -) => TaskDecoder = - /*#__PURE__*/ - DT.tuple(M)(UnknownArray, (i, e) => FS.of(DE.index(i, DE.required, e))) as any +): TaskDecoder => + K.pipe(M)(UnknownArray, K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) /** * @category combinators @@ -235,7 +222,7 @@ export const union: ]>( ...members: { [K in keyof A]: TaskDecoder } ) => TaskDecoder = /*#__PURE__*/ - DT.union(M)((i, e) => FS.of(DE.member(i, e))) as any + K.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators @@ -243,24 +230,26 @@ export const union: ]>( */ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - DT.intersect(M) + K.intersect(M) /** * @category combinators * @since 2.2.7 */ -export const sum: ( - tag: T -) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder = - /*#__PURE__*/ - DT.sum(M)(UnknownRecord, (tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) +export const sum = (tag: T) => ( + members: { [K in keyof A]: TaskDecoder } +): TaskDecoder => + K.pipe(M)( + UnknownRecord, + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) + ) ) - ) + )(tag)(members) ) /** @@ -269,7 +258,7 @@ export const sum: ( */ export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = /*#__PURE__*/ - DT.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables From ebd7c166982701c9dba5bf7c439f73197b8990c1 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 15:15:37 +0200 Subject: [PATCH 081/222] remove `withExpected` in favour of `mapLeftWithInput` --- CHANGELOG.md | 1 + docs/modules/Codec.ts.md | 27 +++++++++++++-------------- docs/modules/Decoder.ts.md | 27 +++++++++++++-------------- docs/modules/JsonCodec.ts.md | 27 +++++++++++++-------------- docs/modules/Kleisli.ts.md | 31 ++++++++++++++++++------------- docs/modules/TaskDecoder.ts.md | 27 +++++++++++++-------------- src/Codec.ts | 10 ++++------ src/Decoder.ts | 9 ++++----- src/JsonCodec.ts | 7 +++---- src/Kleisli.ts | 7 +++---- src/TaskDecoder.ts | 9 ++++----- test/Codec.ts | 7 +++++-- test/Decoder.ts | 7 +++++-- test/TaskDecoder.ts | 7 +++++-- 14 files changed, 104 insertions(+), 99 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a4e86cc..9a8cf75b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - (**bc**) remove `never` (@gcanti) - (**bc**) make `parse` pipeable and change its `parser` argument (@gcanti) - (**bc**) change `DecoderError` (@gcanti) + - (**bc**) remove `withExpected` in favour of `mapLeftWithInput` (@gcanti) - `Guard` - (**bc**) remove `never` (@gcanti) - `Schemable` diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 369f1142c..45df8233b 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -18,6 +18,7 @@ Added in v2.2.3 - [array](#array) - [intersect](#intersect) - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [partial](#partial) - [record](#record) @@ -25,7 +26,6 @@ Added in v2.2.3 - [sum](#sum) - [tuple](#tuple) - [type](#type) - - [withExpected](#withexpected) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [literal](#literal) @@ -92,6 +92,18 @@ export declare function lazy(id: string, f: () => Codec): Codec( + f: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> +) => (codec: Codec) => Codec +``` + +Added in v2.2.3 + ## nullable **Signature** @@ -173,19 +185,6 @@ export declare function type

>>( Added in v2.2.3 -## withExpected - -**Signature** - -```ts -export declare function withExpected( - codec: Codec, - expected: (actual: unknown, e: D.DecodeError) => D.DecodeError -): Codec -``` - -Added in v2.2.3 - # constructors ## fromDecoder diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 2a7ef0ecc..91c1e48e8 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -25,6 +25,7 @@ Added in v2.2.7 - [array](#array) - [intersect](#intersect) - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) @@ -34,7 +35,6 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) - - [withExpected](#withexpected) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -158,6 +158,18 @@ export declare const lazy: (id: string, f: () => Decoder) => Decoder Added in v2.2.7 +## mapLeftWithInput + +**Signature** + +```ts +export declare const mapLeftWithInput: ( + f: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: Decoder) => Decoder +``` + +Added in v2.2.7 + ## nullable **Signature** @@ -261,19 +273,6 @@ export declare const union: ( Added in v2.2.7 -## withExpected - -**Signature** - -```ts -export declare const withExpected: ( - decoder: Decoder, - expected: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => Decoder -``` - -Added in v2.2.7 - # constructors ## fromGuard diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 1a06c9766..60ef9c1c0 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -18,6 +18,7 @@ Added in v2.2.3 - [array](#array) - [intersect](#intersect) - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [partial](#partial) - [record](#record) @@ -25,7 +26,6 @@ Added in v2.2.3 - [sum](#sum) - [tuple](#tuple) - [type](#type) - - [withExpected](#withexpected) - [constructors](#constructors) - [literal](#literal) - [make](#make) @@ -89,6 +89,18 @@ export declare const lazy: (id: string, f: () => JsonCodec) => JsonCodec( + f: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> +) => (codec: JsonCodec) => JsonCodec +``` + +Added in v2.2.3 + ## nullable **Signature** @@ -168,19 +180,6 @@ export declare const type: (properties: { [K in keyof A]: JsonCodec }) Added in v2.2.3 -## withExpected - -**Signature** - -```ts -export declare const withExpected: ( - codec: JsonCodec, - expected: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> -) => JsonCodec -``` - -Added in v2.2.3 - # constructors ## literal diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 3e031a5b3..b29950a74 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -16,6 +16,7 @@ Added in v2.2.7 - [array](#array) - [intersect](#intersect) - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) @@ -25,7 +26,6 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) - - [withExpected](#withexpected) - [constructors](#constructors) - [fromGuard](#fromguard) - [literal](#literal) @@ -74,6 +74,23 @@ export declare const lazy: ( + M: Bifunctor2 +) => (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +``` + +Added in v2.2.7 + ## nullable **Signature** @@ -209,18 +226,6 @@ export declare const union: ( - M: Bifunctor2 -) => (decoder: Kleisli, expected: (i: I, e: E) => E) => Kleisli -``` - -Added in v2.2.7 - # constructors ## fromGuard diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 67f3fe818..aa717ea07 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -25,6 +25,7 @@ Added in v2.2.7 - [array](#array) - [intersect](#intersect) - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) @@ -34,7 +35,6 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) - - [withExpected](#withexpected) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [fromGuard](#fromguard) @@ -159,6 +159,18 @@ export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecod Added in v2.2.7 +## mapLeftWithInput + +**Signature** + +```ts +export declare const mapLeftWithInput: ( + f: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + ## nullable **Signature** @@ -264,19 +276,6 @@ export declare const union: ( Added in v2.2.7 -## withExpected - -**Signature** - -```ts -export declare const withExpected: ( - decoder: TaskDecoder, - expected: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => TaskDecoder -``` - -Added in v2.2.7 - # constructors ## fromDecoder diff --git a/src/Codec.ts b/src/Codec.ts index 2b4b50165..07993f483 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -6,6 +6,7 @@ import * as D from './Decoder' import * as E from './Encoder' import { Literal } from './Schemable' import { identity } from 'fp-ts/lib/function' +import { pipe } from 'fp-ts/lib/pipeable' // ------------------------------------------------------------------------------------- // model @@ -112,12 +113,9 @@ export const UnknownRecord: Codec, Record( - codec: Codec, - expected: (actual: unknown, e: D.DecodeError) => D.DecodeError -): Codec { - return make(D.withExpected(codec, expected), codec) -} +export const mapLeftWithInput = (f: (actual: unknown, e: D.DecodeError) => D.DecodeError) => ( + codec: Codec +): Codec => make(pipe(codec, D.mapLeftWithInput(f)), codec) /** * @category combinators diff --git a/src/Decoder.ts b/src/Decoder.ts index e1021fd8b..5f7c1aa1b 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -133,12 +133,11 @@ export const UnknownRecord: Decoder> = * @category combinators * @since 2.2.7 */ -export const withExpected: ( - decoder: Decoder, - expected: (actual: unknown, e: DecodeError) => DecodeError -) => Decoder = +export const mapLeftWithInput: ( + f: (actual: unknown, e: DecodeError) => DecodeError +) => (decoder: Decoder) => Decoder = /*#__PURE__*/ - K.withExpected(M) + K.mapLeftWithInput(M) /** * @category combinators diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 758157507..928dded3f 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -78,10 +78,9 @@ export const boolean: JsonCodec = C.boolean * @category combinators * @since 2.2.3 */ -export const withExpected: ( - codec: JsonCodec, - expected: (actual: unknown, e: D.DecodeError) => D.DecodeError -) => JsonCodec = C.withExpected +export const mapLeftWithInput: ( + f: (actual: unknown, e: D.DecodeError) => D.DecodeError +) => (codec: JsonCodec) => JsonCodec = C.mapLeftWithInput /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 5840d5a00..786cde368 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -57,11 +57,10 @@ export const literal = (M: MonadThrow2C) => ( * @category combinators * @since 2.2.7 */ -export const withExpected = (M: Bifunctor2) => ( - decoder: Kleisli, - expected: (i: I, e: E) => E +export const mapLeftWithInput = (M: Bifunctor2) => (f: (i: I, e: E) => E) => ( + decoder: Kleisli ): Kleisli => ({ - decode: (i) => M.mapLeft(decoder.decode(i), (e) => expected(i, e)) + decode: (i) => M.mapLeft(decoder.decode(i), (e) => f(i, e)) }) /** diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 81dbac08d..b7114e9bc 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -141,12 +141,11 @@ export const UnknownRecord: TaskDecoder> = * @category combinators * @since 2.2.7 */ -export const withExpected: ( - decoder: TaskDecoder, - expected: (actual: unknown, e: DecodeError) => DecodeError -) => TaskDecoder = +export const mapLeftWithInput: ( + f: (actual: unknown, e: DecodeError) => DecodeError +) => (decoder: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.withExpected(M) + K.mapLeftWithInput(M) /** * @category combinators diff --git a/test/Codec.ts b/test/Codec.ts index 45d4bd87f..268ce6c75 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -66,10 +66,13 @@ describe('Codec', () => { assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) - describe('withExpected', () => { + describe('mapLeftWithInput', () => { describe('decode', () => { it('should, return the provided expected', () => { - const decoder = C.withExpected(C.number, (u) => FS.of(DE.leaf(u, 'not a number'))) + const decoder = pipe( + C.number, + C.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + ) assert.deepStrictEqual(decoder.decode('a'), left(FS.of(DE.leaf('a', 'not a number')))) }) }) diff --git a/test/Decoder.ts b/test/Decoder.ts index 6063cd4ba..33f7026ab 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -108,8 +108,11 @@ describe('Decoder', () => { // combinators // ------------------------------------------------------------------------------------- - it('withExpected', () => { - const decoder = D.withExpected(D.number, (u) => FS.of(DE.leaf(u, 'not a number'))) + it('mapLeftWithInput', () => { + const decoder = pipe( + D.number, + D.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + ) assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 60ca95ba4..f84a4e670 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -118,8 +118,11 @@ describe('TaskDecoder', () => { // combinators // ------------------------------------------------------------------------------------- - it('withExpected', async () => { - const decoder = D.withExpected(D.number, (u) => FS.of(DE.leaf(u, 'not a number'))) + it('mapLeftWithInput', async () => { + const decoder = pipe( + D.number, + D.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + ) assert.deepStrictEqual(await decoder.decode('a')(), E.left(FS.of(DE.leaf('a', 'not a number')))) }) From 011f8e8802d11041953571bc8bfc8dce89469c91 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 15:52:29 +0200 Subject: [PATCH 082/222] rename Kleisli to Kleisli2 --- .../modules/{Kleisli.ts.md => Kleisli2.ts.md} | 54 +++++++------- src/Decoder.ts | 36 +++++----- src/{Kleisli.ts => Kleisli2.ts} | 70 +++++++++---------- src/TaskDecoder.ts | 36 +++++----- 4 files changed, 99 insertions(+), 97 deletions(-) rename docs/modules/{Kleisli.ts.md => Kleisli2.ts.md} (73%) rename src/{Kleisli.ts => Kleisli2.ts} (81%) diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli2.ts.md similarity index 73% rename from docs/modules/Kleisli.ts.md rename to docs/modules/Kleisli2.ts.md index b29950a74..234103023 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli2.ts.md @@ -1,10 +1,10 @@ --- -title: Kleisli.ts +title: Kleisli2.ts nav_order: 11 parent: Modules --- -## Kleisli overview +## Kleisli2 overview Added in v2.2.7 @@ -30,7 +30,7 @@ Added in v2.2.7 - [fromGuard](#fromguard) - [literal](#literal) - [model](#model) - - [Kleisli (interface)](#kleisli-interface) + - [Kleisli2 (interface)](#kleisli2-interface) - [utils](#utils) - [pipe](#pipe) @@ -45,7 +45,9 @@ Added in v2.2.7 ```ts export declare function array( M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (items: Kleisli) => Kleisli, E, Array> +): ( + onItemError: (index: number, e: E) => E +) => (items: Kleisli2) => Kleisli2, E, Array> ``` Added in v2.2.7 @@ -57,7 +59,7 @@ Added in v2.2.7 ```ts export declare const intersect: ( M: Apply2C -) => (right: Kleisli) => (left: Kleisli) => Kleisli +) => (right: Kleisli2) => (left: Kleisli2) => Kleisli2 ``` Added in v2.2.7 @@ -69,7 +71,7 @@ Added in v2.2.7 ```ts export declare const lazy: ( M: Bifunctor2 -) => (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +) => (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli2) => Kleisli2 ``` Added in v2.2.7 @@ -86,7 +88,7 @@ export declare const mapLeftWithInput: ( M: Bifunctor2 -) => (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +) => (f: (i: I, e: E) => E) => (decoder: Kleisli2) => Kleisli2 ``` Added in v2.2.7 @@ -98,7 +100,7 @@ Added in v2.2.7 ```ts export declare const nullable: ( M: Applicative2C & Bifunctor2 -) => (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +) => (onError: (i: I, e: E) => E) => (or: Kleisli2) => Kleisli2 ``` Added in v2.2.7 @@ -110,7 +112,7 @@ Added in v2.2.7 ```ts export declare const parse: ( M: Monad2C -) => (parser: (a: A) => Kind2) => (from: Kleisli) => Kleisli +) => (parser: (a: A) => Kind2) => (from: Kleisli2) => Kleisli2 ``` Added in v2.2.7 @@ -125,8 +127,8 @@ export declare function partial( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> + properties: { [K in keyof A]: Kleisli2 } +) => Kleisli2, E, Partial<{ [K in keyof A]: A[K] }>> ``` Added in v2.2.7 @@ -140,7 +142,7 @@ export declare function record( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> +) => (codomain: Kleisli2) => Kleisli2, E, Record> ``` Added in v2.2.7 @@ -155,7 +157,7 @@ export declare const refine: ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli) => Kleisli +) => (from: Kleisli2) => Kleisli2 ``` Added in v2.2.7 @@ -172,8 +174,8 @@ export declare const sum: ( tag: T ) => , A>( - members: { [K in keyof A]: Kleisli } -) => Kleisli + members: { [K in keyof A]: Kleisli2 } +) => Kleisli2 ``` Added in v2.2.7 @@ -188,8 +190,8 @@ export declare function tuple( ): ( onIndexError: (index: number, e: E) => E ) => >( - ...components: { [K in keyof A]: Kleisli } -) => Kleisli, E, A> + ...components: { [K in keyof A]: Kleisli2 } +) => Kleisli2, E, A> ``` Added in v2.2.7 @@ -204,8 +206,8 @@ export declare function type( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, { [K in keyof A]: A[K] }> + properties: { [K in keyof A]: Kleisli2 } +) => Kleisli2, E, { [K in keyof A]: A[K] }> ``` Added in v2.2.7 @@ -220,8 +222,8 @@ export declare const union: ( onMemberError: (index: number, e: E) => E ) => ( - ...members: { [K in keyof A]: Kleisli } -) => Kleisli + ...members: { [K in keyof A]: Kleisli2 } +) => Kleisli2 ``` Added in v2.2.7 @@ -235,7 +237,7 @@ Added in v2.2.7 ```ts export declare const fromGuard: ( M: MonadThrow2C -) => (guard: G.Guard, onError: (i: I) => E) => Kleisli +) => (guard: G.Guard, onError: (i: I) => E) => Kleisli2 ``` Added in v2.2.7 @@ -249,19 +251,19 @@ export declare const literal: ) => ( onError: (i: I, values: readonly [Literal, ...Literal[]]) => E -) => (...values: A) => Kleisli +) => (...values: A) => Kleisli2 ``` Added in v2.2.7 # model -## Kleisli (interface) +## Kleisli2 (interface) **Signature** ```ts -export interface Kleisli { +export interface Kleisli2 { readonly decode: (i: I) => Kind2 } ``` @@ -277,7 +279,7 @@ Added in v2.2.7 ```ts export declare const pipe: ( M: Monad2C -) => (ia: Kleisli, ab: Kleisli) => Kleisli +) => (ia: Kleisli2, ab: Kleisli2) => Kleisli2 ``` Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index 5f7c1aa1b..2d61d745b 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -10,11 +10,11 @@ import * as T from 'fp-ts/lib/Tree' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' import * as G from './Guard' -import * as K from './Kleisli' +import * as K2 from './Kleisli2' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- -// Kleisli config +// Kleisli2 config // ------------------------------------------------------------------------------------- const M = @@ -71,7 +71,7 @@ export const failure = (actual: unknown, message: string): E.Either(guard: G.Guard, expected: string): Decoder => - K.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) + K2.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors @@ -79,7 +79,7 @@ export const fromGuard = (guard: G.Guard, expected: string): Decoder => */ export const literal: ]>(...values: A) => Decoder = /*#__PURE__*/ - K.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) + K2.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) // ------------------------------------------------------------------------------------- // primitives @@ -137,14 +137,14 @@ export const mapLeftWithInput: ( f: (actual: unknown, e: DecodeError) => DecodeError ) => (decoder: Decoder) => Decoder = /*#__PURE__*/ - K.mapLeftWithInput(M) + K2.mapLeftWithInput(M) /** * @category combinators * @since 2.2.7 */ export const refine = (refinement: (a: A) => a is B, id: string): ((from: Decoder) => Decoder) => - K.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) + K2.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) /** * @category combinators @@ -152,7 +152,7 @@ export const refine = (refinement: (a: A) => a is B, id: string) */ export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = /*#__PURE__*/ - K.parse(M) + K2.parse(M) /** * @category combinators @@ -160,42 +160,42 @@ export const parse: (parser: (a: A) => E.Either) => (from: */ export const nullable: (or: Decoder) => Decoder = /*#__PURE__*/ - K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) + K2.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> => - K.pipe(M)(UnknownRecord, K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) + K2.pipe(M)(UnknownRecord, K2.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) /** * @category combinators * @since 2.2.7 */ export const partial = (properties: { [K in keyof A]: Decoder }): Decoder> => - K.pipe(M)(UnknownRecord, K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) + K2.pipe(M)(UnknownRecord, K2.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) /** * @category combinators * @since 2.2.7 */ export const array = (items: Decoder): Decoder> => - K.pipe(M)(UnknownArray, K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) + K2.pipe(M)(UnknownArray, K2.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: Decoder): Decoder> => - K.pipe(M)(UnknownRecord, K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) + K2.pipe(M)(UnknownRecord, K2.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) /** * @category combinators * @since 2.2.7 */ export const tuple = >(...components: { [K in keyof A]: Decoder }): Decoder => - K.pipe(M)(UnknownArray, K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) + K2.pipe(M)(UnknownArray, K2.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) /** * @category combinators @@ -205,7 +205,7 @@ export const union: ]>( ...members: { [K in keyof A]: Decoder } ) => Decoder = /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) as any + K2.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators @@ -213,16 +213,16 @@ export const union: ]>( */ export const intersect: (right: Decoder) => (left: Decoder) => Decoder = /*#__PURE__*/ - K.intersect(M) + K2.intersect(M) /** * @category combinators * @since 2.2.7 */ export const sum = (tag: T) => (members: { [K in keyof A]: Decoder }): Decoder => - K.pipe(M)( + K2.pipe(M)( UnknownRecord, - K.sum(M)((tag, value, keys) => + K2.sum(M)((tag, value, keys) => FS.of( DE.key( tag, @@ -239,7 +239,7 @@ export const sum = (tag: T) => (members: { [K in keyof A]: */ export const lazy: (id: string, f: () => Decoder) => Decoder = /*#__PURE__*/ - K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + K2.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables diff --git a/src/Kleisli.ts b/src/Kleisli2.ts similarity index 81% rename from src/Kleisli.ts rename to src/Kleisli2.ts index 786cde368..7e833bb39 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli2.ts @@ -20,7 +20,7 @@ import { intersect_, Literal, memoize } from './Schemable' * @category model * @since 2.2.7 */ -export interface Kleisli { +export interface Kleisli2 { readonly decode: (i: I) => Kind2 } @@ -35,7 +35,7 @@ export interface Kleisli { export const fromGuard = (M: MonadThrow2C) => ( guard: G.Guard, onError: (i: I) => E -): Kleisli => ({ +): Kleisli2 => ({ decode: (i) => (guard.is(i) ? M.of(i) : M.throwError(onError(i))) }) @@ -45,7 +45,7 @@ export const fromGuard = (M: MonadThrow2C) => ( */ export const literal = (M: MonadThrow2C) => ( onError: (i: I, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A): Kleisli => ({ +) => ]>(...values: A): Kleisli2 => ({ decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) }) @@ -58,8 +58,8 @@ export const literal = (M: MonadThrow2C) => ( * @since 2.2.7 */ export const mapLeftWithInput = (M: Bifunctor2) => (f: (i: I, e: E) => E) => ( - decoder: Kleisli -): Kleisli => ({ + decoder: Kleisli2 +): Kleisli2 => ({ decode: (i) => M.mapLeft(decoder.decode(i), (e) => f(i, e)) }) @@ -70,7 +70,7 @@ export const mapLeftWithInput = (M: Bifunctor2) => export const refine = (M: MonadThrow2C & Bifunctor2) => ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli): Kleisli => ({ +) => (from: Kleisli2): Kleisli2 => ({ decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(a)))) }) @@ -79,8 +79,8 @@ export const refine = (M: MonadThrow2C & Bifunctor2 * @since 2.2.7 */ export const parse = (M: Monad2C) => (parser: (a: A) => Kind2) => ( - from: Kleisli -): Kleisli => ({ + from: Kleisli2 +): Kleisli2 => ({ decode: (u) => M.chain(from.decode(u), (a) => parser(a)) }) @@ -90,7 +90,7 @@ export const parse = (M: Monad2C) => (parser: (a */ export const nullable = (M: Applicative2C & Bifunctor2) => ( onError: (i: I, e: E) => E -) => (or: Kleisli): Kleisli => ({ +) => (or: Kleisli2): Kleisli2 => ({ decode: (i) => i === null ? M.of(null) @@ -110,12 +110,12 @@ export function type( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, { [K in keyof A]: A[K] }> { + properties: { [K in keyof A]: Kleisli2 } +) => Kleisli2, E, { [K in keyof A]: A[K] }> { const traverse = traverseRecordWithIndex(M) return (onKeyError) => (properties) => ({ decode: (i) => - traverse(properties as Record>, (k, decoder) => + traverse(properties as Record>, (k, decoder) => M.mapLeft(decoder.decode(i[k]), (e) => onKeyError(k, e)) ) as any }) @@ -130,15 +130,15 @@ export function partial( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> { + properties: { [K in keyof A]: Kleisli2 } +) => Kleisli2, E, Partial<{ [K in keyof A]: A[K] }>> { const traverse = traverseRecordWithIndex(M) const skip = M.of>(E.left(undefined)) const undef = M.of>(E.right(undefined)) return (onKeyError) => (properties) => ({ decode: (i) => M.map( - traverse(properties as Record>, (k, decoder) => { + traverse(properties as Record>, (k, decoder) => { const ik = i[k] if (ik === undefined) { return k in i @@ -166,7 +166,7 @@ export function array( M: Applicative2C & Bifunctor2 ): ( onItemError: (index: number, e: E) => E -) => (items: Kleisli) => Kleisli, E, Array> { +) => (items: Kleisli2) => Kleisli2, E, Array> { const traverse = traverseArrayWithIndex(M) return (onItemError) => (items) => ({ decode: (is) => traverse(is, (index, i) => M.mapLeft(items.decode(i), (e) => onItemError(index, e))) @@ -181,7 +181,7 @@ export function record( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> { +) => (codomain: Kleisli2) => Kleisli2, E, Record> { const traverse = traverseRecordWithIndex(M) return (onKeyError) => (codomain) => ({ decode: (ir) => traverse(ir, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) @@ -197,12 +197,12 @@ export function tuple( ): ( onIndexError: (index: number, e: E) => E ) => >( - ...components: { [K in keyof A]: Kleisli } -) => Kleisli, E, A> { + ...components: { [K in keyof A]: Kleisli2 } +) => Kleisli2, E, A> { const traverse = traverseArrayWithIndex(M) return (onIndexError) => (...components) => ({ decode: (is) => - traverse((components as unknown) as Array>, (index, decoder) => + traverse((components as unknown) as Array>, (index, decoder) => M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) ) as any }) @@ -215,8 +215,8 @@ export function tuple( export const union = (M: Alt2C & Bifunctor2) => ( onMemberError: (index: number, e: E) => E ) => ]>( - ...members: { [K in keyof A]: Kleisli } -): Kleisli => ({ + ...members: { [K in keyof A]: Kleisli2 } +): Kleisli2 => ({ decode: (i) => { let out: Kind2 = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) for (let index = 1; index < members.length; index++) { @@ -230,9 +230,9 @@ export const union = (M: Alt2C & Bifunctor2) => ( * @category combinators * @since 2.2.7 */ -export const intersect = (M: Apply2C) => (right: Kleisli) => ( - left: Kleisli -): Kleisli => ({ +export const intersect = (M: Apply2C) => (right: Kleisli2) => ( + left: Kleisli2 +): Kleisli2 => ({ decode: (i) => M.ap( M.map(left.decode(i), (a: A) => (b: B) => intersect_(a, b)), @@ -249,11 +249,11 @@ export const sum = (M: MonadThrow2C) => ( ) => ( tag: T ): (, A>( - members: { [K in keyof A]: Kleisli } -) => Kleisli) => { + members: { [K in keyof A]: Kleisli2 } +) => Kleisli2) => { return , A>( - members: { [K in keyof A]: Kleisli } - ): Kleisli => { + members: { [K in keyof A]: Kleisli2 } + ): Kleisli2 => { const keys = Object.keys(members) return { decode: (ir) => { @@ -273,9 +273,9 @@ export const sum = (M: MonadThrow2C) => ( */ export const lazy = (M: Bifunctor2) => ( onError: (id: string, e: E) => E -): ((id: string, f: () => Kleisli) => Kleisli) => { - return (id: string, f: () => Kleisli): Kleisli => { - const get = memoize>(f) +): ((id: string, f: () => Kleisli2) => Kleisli2) => { + return (id: string, f: () => Kleisli2): Kleisli2 => { + const get = memoize>(f) return { decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) } @@ -339,8 +339,8 @@ const compactRecord = (r: Record>): Record(M: Monad2C) => ( - ia: Kleisli, - ab: Kleisli -): Kleisli => ({ + ia: Kleisli2, + ab: Kleisli2 +): Kleisli2 => ({ decode: (i) => M.chain(ia.decode(i), ab.decode) }) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index b7114e9bc..33321f248 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -10,11 +10,11 @@ import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as D from './Decoder' import * as G from './Guard' -import * as K from './Kleisli' +import * as D2 from './Kleisli2' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- -// Kleisli config +// Kleisli2 config // ------------------------------------------------------------------------------------- const M = @@ -79,7 +79,7 @@ export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ * @since 2.2.7 */ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => - K.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) + D2.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors @@ -87,7 +87,7 @@ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder]>(...values: A) => TaskDecoder = /*#__PURE__*/ - K.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) + D2.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) // ------------------------------------------------------------------------------------- // primitives @@ -145,7 +145,7 @@ export const mapLeftWithInput: ( f: (actual: unknown, e: DecodeError) => DecodeError ) => (decoder: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.mapLeftWithInput(M) + D2.mapLeftWithInput(M) /** * @category combinators @@ -154,7 +154,7 @@ export const mapLeftWithInput: ( export const refine = ( refinement: (a: A) => a is B, id: string -): ((from: TaskDecoder) => TaskDecoder) => K.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) +): ((from: TaskDecoder) => TaskDecoder) => D2.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) /** * @category combinators @@ -164,7 +164,7 @@ export const parse: ( parser: (a: A) => TE.TaskEither ) => (from: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.parse(M) + D2.parse(M) /** * @category combinators @@ -172,14 +172,14 @@ export const parse: ( */ export const nullable: (or: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) + D2.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder<{ [K in keyof A]: A[K] }> => - K.pipe(M)(UnknownRecord, K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) + D2.pipe(M)(UnknownRecord, D2.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) /** * @category combinators @@ -188,21 +188,21 @@ export const type = (properties: { [K in keyof A]: TaskDecoder }): Task export const partial = ( properties: { [K in keyof A]: TaskDecoder } ): TaskDecoder> => - K.pipe(M)(UnknownRecord, K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) + D2.pipe(M)(UnknownRecord, D2.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) /** * @category combinators * @since 2.2.7 */ export const array = (items: TaskDecoder): TaskDecoder> => - K.pipe(M)(UnknownArray, K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) + D2.pipe(M)(UnknownArray, D2.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - K.pipe(M)(UnknownRecord, K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) + D2.pipe(M)(UnknownRecord, D2.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) /** * @category combinators @@ -211,7 +211,7 @@ export const record = (codomain: TaskDecoder): TaskDecoder>( ...components: { [K in keyof A]: TaskDecoder } ): TaskDecoder => - K.pipe(M)(UnknownArray, K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) + D2.pipe(M)(UnknownArray, D2.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) /** * @category combinators @@ -221,7 +221,7 @@ export const union: ]>( ...members: { [K in keyof A]: TaskDecoder } ) => TaskDecoder = /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) as any + D2.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators @@ -229,7 +229,7 @@ export const union: ]>( */ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.intersect(M) + D2.intersect(M) /** * @category combinators @@ -238,9 +238,9 @@ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } ): TaskDecoder => - K.pipe(M)( + D2.pipe(M)( UnknownRecord, - K.sum(M)((tag, value, keys) => + D2.sum(M)((tag, value, keys) => FS.of( DE.key( tag, @@ -257,7 +257,7 @@ export const sum = (tag: T) => ( */ export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + D2.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables From 1fde6262832646ddaf23824bde7bcdbf8127d97d Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 24 Jun 2020 16:17:19 +0200 Subject: [PATCH 083/222] Kleisli2: add combinators --- docs/modules/Decoder.ts.md | 14 ++++---- docs/modules/Kleisli2.ts.md | 55 ++++++++++++++++++++++--------- docs/modules/TaskDecoder.ts.md | 12 +++---- src/Decoder.ts | 24 ++++++-------- src/Kleisli2.ts | 43 +++++++++++++++++++------ src/TaskDecoder.ts | 59 ++++++++++++++++------------------ test/Decoder.ts | 17 ++++------ test/TaskDecoder.ts | 13 +++----- 8 files changed, 132 insertions(+), 105 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 91c1e48e8..625fe081f 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -302,7 +302,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const URI: 'io-ts/Decoder2' +export declare const URI: 'io-ts/Decoder' ``` Added in v2.2.7 @@ -322,7 +322,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const altDecoder: Alt1<'io-ts/Decoder2'> +export declare const altDecoder: Alt1<'io-ts/Decoder'> ``` Added in v2.2.7 @@ -332,7 +332,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const functorDecoder: Functor1<'io-ts/Decoder2'> +export declare const functorDecoder: Functor1<'io-ts/Decoder'> ``` Added in v2.2.7 @@ -342,10 +342,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const schemableDecoder: Schemable1<'io-ts/Decoder2'> & - WithUnknownContainers1<'io-ts/Decoder2'> & - WithUnion1<'io-ts/Decoder2'> & - WithRefine1<'io-ts/Decoder2'> +export declare const schemableDecoder: Schemable1<'io-ts/Decoder'> & + WithUnknownContainers1<'io-ts/Decoder'> & + WithUnion1<'io-ts/Decoder'> & + WithRefine1<'io-ts/Decoder'> ``` Added in v2.2.7 diff --git a/docs/modules/Kleisli2.ts.md b/docs/modules/Kleisli2.ts.md index 234103023..ccd994e9b 100644 --- a/docs/modules/Kleisli2.ts.md +++ b/docs/modules/Kleisli2.ts.md @@ -13,13 +13,16 @@ Added in v2.2.7

Table of contents

- [combinators](#combinators) + - [alt](#alt) - [array](#array) - [intersect](#intersect) - [lazy](#lazy) + - [map](#map) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [pipe](#pipe) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -31,13 +34,23 @@ Added in v2.2.7 - [literal](#literal) - [model](#model) - [Kleisli2 (interface)](#kleisli2-interface) -- [utils](#utils) - - [pipe](#pipe) --- # combinators +## alt + +**Signature** + +```ts +export declare const alt: ( + A: Alt2C +) => (that: Lazy>) => (me: Kleisli2) => Kleisli2 +``` + +Added in v2.2.7 + ## array **Signature** @@ -76,6 +89,18 @@ export declare const lazy: ( + F: Functor2C +) => (f: (a: A) => B) => (ia: Kleisli2) => Kleisli2 +``` + +Added in v2.2.7 + ## mapLeftWithInput **Signature** @@ -133,6 +158,18 @@ export declare function partial( Added in v2.2.7 +## pipe + +**Signature** + +```ts +export declare const pipe: ( + M: Monad2C +) => (ia: Kleisli2, ab: Kleisli2) => Kleisli2 +``` + +Added in v2.2.7 + ## record **Signature** @@ -269,17 +306,3 @@ export interface Kleisli2 { ``` Added in v2.2.7 - -# utils - -## pipe - -**Signature** - -```ts -export declare const pipe: ( - M: Monad2C -) => (ia: Kleisli2, ab: Kleisli2) => Kleisli2 -``` - -Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index aa717ea07..64bff0c3d 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -42,8 +42,8 @@ Added in v2.2.7 - [instances](#instances) - [URI](#uri) - [URI (type alias)](#uri-type-alias) - - [altDecoder](#altdecoder) - - [functorDecoder](#functordecoder) + - [altTaskDecoder](#alttaskdecoder) + - [functorTaskDecoder](#functortaskdecoder) - [schemableTaskDecoder](#schemabletaskdecoder) - [model](#model) - [TaskDecoder (interface)](#taskdecoder-interface) @@ -330,22 +330,22 @@ export type URI = typeof URI Added in v2.2.7 -## altDecoder +## altTaskDecoder **Signature** ```ts -export declare const altDecoder: Alt1<'io-ts/TaskDecoder'> +export declare const altTaskDecoder: Alt1<'io-ts/TaskDecoder'> ``` Added in v2.2.7 -## functorDecoder +## functorTaskDecoder **Signature** ```ts -export declare const functorDecoder: Functor1<'io-ts/TaskDecoder'> +export declare const functorTaskDecoder: Functor1<'io-ts/TaskDecoder'> ``` Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index 2d61d745b..dd288ae21 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -245,17 +245,9 @@ export const lazy: (id: string, f: () => Decoder) => Decoder = // non-pipeables // ------------------------------------------------------------------------------------- -const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => ({ - decode: (u) => pipe(fa.decode(u), E.map(f)) -}) - -const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, that) => ({ - decode: (u) => - pipe( - me.decode(u), - E.alt(() => that().decode(u)) - ) -}) +const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => pipe(fa, map(f)) + +const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, that) => pipe(me, alt(that)) // ------------------------------------------------------------------------------------- // pipeables @@ -265,13 +257,17 @@ const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, tha * @category Functor * @since 2.2.7 */ -export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = (f) => (fa) => map_(fa, f) +export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = + /*#__PURE__*/ + K2.map(M) /** * @category Alt * @since 2.2.7 */ -export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = (that) => (fa) => alt_(fa, that) +export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = + /*#__PURE__*/ + K2.alt(M) // ------------------------------------------------------------------------------------- // instances @@ -281,7 +277,7 @@ export const alt: (that: () => Decoder) => (me: Decoder) => Decoder * @category instances * @since 2.2.7 */ -export const URI = 'io-ts/Decoder2' +export const URI = 'io-ts/Decoder' /** * @category instances diff --git a/src/Kleisli2.ts b/src/Kleisli2.ts index 7e833bb39..47caad6aa 100644 --- a/src/Kleisli2.ts +++ b/src/Kleisli2.ts @@ -6,11 +6,13 @@ import { Applicative2C } from 'fp-ts/lib/Applicative' import { Apply2C } from 'fp-ts/lib/Apply' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import * as E from 'fp-ts/lib/Either' +import { Functor2C } from 'fp-ts/lib/Functor' import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' import { intersect_, Literal, memoize } from './Schemable' +import { Lazy } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- // model @@ -282,6 +284,37 @@ export const lazy = (M: Bifunctor2) => ( } } +/** + * @category combinators + * @since 2.2.7 + */ +export const pipe = (M: Monad2C) => ( + ia: Kleisli2, + ab: Kleisli2 +): Kleisli2 => ({ + decode: (i) => M.chain(ia.decode(i), ab.decode) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const map = (F: Functor2C) => (f: (a: A) => B) => ( + ia: Kleisli2 +): Kleisli2 => ({ + decode: (i) => F.map(ia.decode(i), f) +}) + +/** + * @category combinators + * @since 2.2.7 + */ +export const alt = (A: Alt2C) => (that: Lazy>) => ( + me: Kleisli2 +): Kleisli2 => ({ + decode: (i) => A.alt(me.decode(i), () => that().decode(i)) +}) + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- @@ -334,13 +367,3 @@ const compactRecord = (r: Record>): Record(M: Monad2C) => ( - ia: Kleisli2, - ab: Kleisli2 -): Kleisli2 => ({ - decode: (i) => M.chain(ia.decode(i), ab.decode) -}) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 33321f248..fd828ad14 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -10,7 +10,7 @@ import * as FS from '../src/FreeSemigroup' import * as DE from './DecodeError' import * as D from './Decoder' import * as G from './Guard' -import * as D2 from './Kleisli2' +import * as K2 from './Kleisli2' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ * @since 2.2.7 */ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => - D2.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) + K2.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) /** * @category constructors @@ -87,7 +87,7 @@ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder]>(...values: A) => TaskDecoder = /*#__PURE__*/ - D2.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) + K2.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) // ------------------------------------------------------------------------------------- // primitives @@ -145,7 +145,7 @@ export const mapLeftWithInput: ( f: (actual: unknown, e: DecodeError) => DecodeError ) => (decoder: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - D2.mapLeftWithInput(M) + K2.mapLeftWithInput(M) /** * @category combinators @@ -154,7 +154,7 @@ export const mapLeftWithInput: ( export const refine = ( refinement: (a: A) => a is B, id: string -): ((from: TaskDecoder) => TaskDecoder) => D2.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) +): ((from: TaskDecoder) => TaskDecoder) => K2.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) /** * @category combinators @@ -164,7 +164,7 @@ export const parse: ( parser: (a: A) => TE.TaskEither ) => (from: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - D2.parse(M) + K2.parse(M) /** * @category combinators @@ -172,14 +172,14 @@ export const parse: ( */ export const nullable: (or: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - D2.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) + K2.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder<{ [K in keyof A]: A[K] }> => - D2.pipe(M)(UnknownRecord, D2.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) + K2.pipe(M)(UnknownRecord, K2.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) /** * @category combinators @@ -188,21 +188,21 @@ export const type = (properties: { [K in keyof A]: TaskDecoder }): Task export const partial = ( properties: { [K in keyof A]: TaskDecoder } ): TaskDecoder> => - D2.pipe(M)(UnknownRecord, D2.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) + K2.pipe(M)(UnknownRecord, K2.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) /** * @category combinators * @since 2.2.7 */ export const array = (items: TaskDecoder): TaskDecoder> => - D2.pipe(M)(UnknownArray, D2.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) + K2.pipe(M)(UnknownArray, K2.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - D2.pipe(M)(UnknownRecord, D2.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) + K2.pipe(M)(UnknownRecord, K2.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) /** * @category combinators @@ -211,7 +211,7 @@ export const record = (codomain: TaskDecoder): TaskDecoder>( ...components: { [K in keyof A]: TaskDecoder } ): TaskDecoder => - D2.pipe(M)(UnknownArray, D2.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) + K2.pipe(M)(UnknownArray, K2.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) /** * @category combinators @@ -221,7 +221,7 @@ export const union: ]>( ...members: { [K in keyof A]: TaskDecoder } ) => TaskDecoder = /*#__PURE__*/ - D2.union(M)((i, e) => FS.of(DE.member(i, e))) as any + K2.union(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators @@ -229,7 +229,7 @@ export const union: ]>( */ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - D2.intersect(M) + K2.intersect(M) /** * @category combinators @@ -238,9 +238,9 @@ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } ): TaskDecoder => - D2.pipe(M)( + K2.pipe(M)( UnknownRecord, - D2.sum(M)((tag, value, keys) => + K2.sum(M)((tag, value, keys) => FS.of( DE.key( tag, @@ -257,23 +257,15 @@ export const sum = (tag: T) => ( */ export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = /*#__PURE__*/ - D2.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + K2.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) // ------------------------------------------------------------------------------------- // non-pipeables // ------------------------------------------------------------------------------------- -const map_: (fa: TaskDecoder, f: (a: A) => B) => TaskDecoder = (fa, f) => ({ - decode: (u) => pipe(fa.decode(u), TE.map(f)) -}) +const map_: (fa: TaskDecoder, f: (a: A) => B) => TaskDecoder = (fa, f) => pipe(fa, map(f)) -const alt_: (me: TaskDecoder, that: () => TaskDecoder) => TaskDecoder = (me, that) => ({ - decode: (u) => - pipe( - me.decode(u), - TE.alt(() => that().decode(u)) - ) -}) +const alt_: (me: TaskDecoder, that: () => TaskDecoder) => TaskDecoder = (me, that) => pipe(me, alt(that)) // ------------------------------------------------------------------------------------- // pipeables @@ -283,14 +275,17 @@ const alt_: (me: TaskDecoder, that: () => TaskDecoder) => TaskDecoder(f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = (f) => (fa) => map_(fa, f) +export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K2.map(M) /** * @category Alt * @since 2.2.7 */ -export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = (that) => (fa) => - alt_(fa, that) +export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K2.alt(M) // ------------------------------------------------------------------------------------- // instances @@ -318,7 +313,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.7 */ -export const functorDecoder: Functor1 = { +export const functorTaskDecoder: Functor1 = { URI, map: map_ } @@ -327,7 +322,7 @@ export const functorDecoder: Functor1 = { * @category instances * @since 2.2.7 */ -export const altDecoder: Alt1 = { +export const altTaskDecoder: Alt1 = { URI, map: map_, alt: alt_ diff --git a/test/Decoder.ts b/test/Decoder.ts index 33f7026ab..e3c45526f 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -39,21 +39,16 @@ const Int: D.Decoder = pipe( describe('Decoder', () => { // ------------------------------------------------------------------------------------- - // pipeables + // instances // ------------------------------------------------------------------------------------- - it('map', () => { - const decoder = pipe( - D.string, - D.map((s) => s + '!') - ) + + it('functorDecoder', () => { + const decoder = D.functorDecoder.map(D.string, (s) => s + '!') assert.deepStrictEqual(decoder.decode('a'), E.right('a!')) }) - it('alt', () => { - const decoder = pipe( - D.string, - D.alt(() => D.number) - ) + it('altDecoder', () => { + const decoder = D.altDecoder.alt(D.string, () => D.number) assert.deepStrictEqual(decoder.decode('a'), E.right('a')) assert.deepStrictEqual(decoder.decode(1), E.right(1)) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index f84a4e670..10dd95db9 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -40,21 +40,16 @@ const Int: D.TaskDecoder = pipe( describe('TaskDecoder', () => { // ------------------------------------------------------------------------------------- - // pipeables + // instances // ------------------------------------------------------------------------------------- + it('map', async () => { - const decoder = pipe( - D.string, - D.map((s) => s + '!') - ) + const decoder = D.functorTaskDecoder.map(D.string, (s) => s + '!') assert.deepStrictEqual(await decoder.decode('a')(), E.right('a!')) }) it('alt', async () => { - const decoder = pipe( - D.string, - D.alt(() => D.number) - ) + const decoder = D.altTaskDecoder.alt(D.string, () => D.number) assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) }) From 5203803e8c33011722af8b55904ee31f0c4668ca Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 06:09:04 +0200 Subject: [PATCH 084/222] make `Json` type immutable --- CHANGELOG.md | 1 + docs/modules/JsonEncoder.ts.md | 12 +++++++----- src/JsonEncoder.ts | 8 +++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8cf75b7..92471bb43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - add `TaskDecoder` module (@gcanti) - add `Kleisli` module (@gcanti) - (**bc**) remove `Tree` module (@gcanti) + - (**bc**) make `Json` type immutable (@gcanti) - `Decoder` - (**bc**) remove `never` (@gcanti) - (**bc**) make `parse` pipeable and change its `parser` argument (@gcanti) diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index e9c2d63fc..4b9c8b0bb 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -33,7 +33,7 @@ Added in v2.2.3 - [Json (type alias)](#json-type-alias) - [JsonArray (interface)](#jsonarray-interface) - [JsonEncoder (interface)](#jsonencoder-interface) - - [JsonObject (type alias)](#jsonobject-type-alias) + - [JsonRecord (interface)](#jsonrecord-interface) - [primitives](#primitives) - [id](#id) - [utils](#utils) @@ -202,7 +202,7 @@ Added in v2.2.3 **Signature** ```ts -export type Json = null | string | number | boolean | JsonObject | JsonArray +export type Json = null | string | number | boolean | JsonRecord | JsonArray ``` Added in v2.2.3 @@ -212,7 +212,7 @@ Added in v2.2.3 **Signature** ```ts -export interface JsonArray extends Array {} +export interface JsonArray extends ReadonlyArray {} ``` Added in v2.2.3 @@ -229,12 +229,14 @@ export interface JsonEncoder { Added in v2.2.3 -## JsonObject (type alias) +## JsonRecord (interface) **Signature** ```ts -export type JsonObject = { [key: string]: Json } +export interface JsonRecord { + [key: string]: Json +} ``` Added in v2.2.3 diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 8a04d7488..db90d2f83 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -14,19 +14,21 @@ import { Schemable1 } from './Schemable' * @category model * @since 2.2.3 */ -export interface JsonArray extends Array {} +export interface JsonArray extends ReadonlyArray {} /** * @category model * @since 2.2.3 */ -export type JsonObject = { [key: string]: Json } +export interface JsonRecord { + [key: string]: Json +} /** * @category model * @since 2.2.3 */ -export type Json = null | string | number | boolean | JsonObject | JsonArray +export type Json = null | string | number | boolean | JsonRecord | JsonArray /** * @category model From c8ea010625c01243cf966f5f1f5b6b3c947dd994 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 06:38:31 +0200 Subject: [PATCH 085/222] fix mapLeftWithInput and refine signatures --- docs/modules/Codec.ts.md | 8 ++++---- docs/modules/Decoder.ts.md | 4 ++-- docs/modules/JsonCodec.ts.md | 4 ++-- docs/modules/Kleisli2.ts.md | 6 +++--- docs/modules/TaskDecoder.ts.md | 4 ++-- src/Codec.ts | 6 +++--- src/Decoder.ts | 4 ++-- src/JsonCodec.ts | 4 ++-- src/Kleisli2.ts | 6 +++--- src/TaskDecoder.ts | 4 ++-- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 45df8233b..3e560224e 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -97,9 +97,9 @@ Added in v2.2.3 **Signature** ```ts -export declare const mapLeftWithInput: ( +export declare const mapLeftWithInput: ( f: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> -) => (codec: Codec) => Codec +) => (codec: Codec) => Codec ``` Added in v2.2.3 @@ -141,10 +141,10 @@ Added in v2.2.3 **Signature** ```ts -export declare const refine: ( +export declare const refine: ( refinement: (a: A) => a is B, id: string -) => (from: Codec) => Codec +) => (from: Codec) => Codec ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 625fe081f..951a86411 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -163,9 +163,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const mapLeftWithInput: ( +export declare const mapLeftWithInput: ( f: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: Decoder) => Decoder +) => (decoder: Decoder) => Decoder ``` Added in v2.2.7 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 60ef9c1c0..c33626066 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -94,9 +94,9 @@ Added in v2.2.3 **Signature** ```ts -export declare const mapLeftWithInput: ( +export declare const mapLeftWithInput: ( f: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> -) => (codec: JsonCodec) => JsonCodec +) => (codec: JsonCodec) => JsonCodec ``` Added in v2.2.3 diff --git a/docs/modules/Kleisli2.ts.md b/docs/modules/Kleisli2.ts.md index ccd994e9b..b90e6796c 100644 --- a/docs/modules/Kleisli2.ts.md +++ b/docs/modules/Kleisli2.ts.md @@ -113,7 +113,7 @@ export declare const mapLeftWithInput: ( M: Bifunctor2 -) => (f: (i: I, e: E) => E) => (decoder: Kleisli2) => Kleisli2 +) => (f: (i: I, e: E) => E) => (decoder: Kleisli2) => Kleisli2 ``` Added in v2.2.7 @@ -191,10 +191,10 @@ Added in v2.2.7 ```ts export declare const refine: ( M: MonadThrow2C & Bifunctor2 -) => ( +) => ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli2) => Kleisli2 +) => (from: Kleisli2) => Kleisli2 ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 64bff0c3d..d36d2ddd5 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -164,9 +164,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const mapLeftWithInput: ( +export declare const mapLeftWithInput: ( f: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: TaskDecoder) => TaskDecoder +) => (decoder: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 diff --git a/src/Codec.ts b/src/Codec.ts index 07993f483..73c892974 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -113,7 +113,7 @@ export const UnknownRecord: Codec, Record(f: (actual: unknown, e: D.DecodeError) => D.DecodeError) => ( +export const mapLeftWithInput = (f: (actual: unknown, e: D.DecodeError) => D.DecodeError) => ( codec: Codec ): Codec => make(pipe(codec, D.mapLeftWithInput(f)), codec) @@ -121,10 +121,10 @@ export const mapLeftWithInput = (f: (actual: unknown, e: D.DecodeError) => * @category combinators * @since 2.2.3 */ -export const refine = ( +export const refine = ( refinement: (a: A) => a is B, id: string -): ((from: Codec) => Codec) => { +): ((from: Codec) => Codec) => { const refine = D.refine(refinement, id) return (from) => make(refine(from), from) } diff --git a/src/Decoder.ts b/src/Decoder.ts index dd288ae21..e5feb3724 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -133,9 +133,9 @@ export const UnknownRecord: Decoder> = * @category combinators * @since 2.2.7 */ -export const mapLeftWithInput: ( +export const mapLeftWithInput: ( f: (actual: unknown, e: DecodeError) => DecodeError -) => (decoder: Decoder) => Decoder = +) => (decoder: Decoder) => Decoder = /*#__PURE__*/ K2.mapLeftWithInput(M) diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 928dded3f..26b608de9 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -78,9 +78,9 @@ export const boolean: JsonCodec = C.boolean * @category combinators * @since 2.2.3 */ -export const mapLeftWithInput: ( +export const mapLeftWithInput: ( f: (actual: unknown, e: D.DecodeError) => D.DecodeError -) => (codec: JsonCodec) => JsonCodec = C.mapLeftWithInput +) => (codec: JsonCodec) => JsonCodec = C.mapLeftWithInput /** * @category combinators diff --git a/src/Kleisli2.ts b/src/Kleisli2.ts index 47caad6aa..edc89cea6 100644 --- a/src/Kleisli2.ts +++ b/src/Kleisli2.ts @@ -59,7 +59,7 @@ export const literal = (M: MonadThrow2C) => ( * @category combinators * @since 2.2.7 */ -export const mapLeftWithInput = (M: Bifunctor2) => (f: (i: I, e: E) => E) => ( +export const mapLeftWithInput = (M: Bifunctor2) => (f: (i: I, e: E) => E) => ( decoder: Kleisli2 ): Kleisli2 => ({ decode: (i) => M.mapLeft(decoder.decode(i), (e) => f(i, e)) @@ -69,10 +69,10 @@ export const mapLeftWithInput = (M: Bifunctor2) => * @category combinators * @since 2.2.7 */ -export const refine = (M: MonadThrow2C & Bifunctor2) => ( +export const refine = (M: MonadThrow2C & Bifunctor2) => ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli2): Kleisli2 => ({ +) => (from: Kleisli2): Kleisli2 => ({ decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(a)))) }) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index fd828ad14..d6f6757ca 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -141,9 +141,9 @@ export const UnknownRecord: TaskDecoder> = * @category combinators * @since 2.2.7 */ -export const mapLeftWithInput: ( +export const mapLeftWithInput: ( f: (actual: unknown, e: DecodeError) => DecodeError -) => (decoder: TaskDecoder) => TaskDecoder = +) => (decoder: TaskDecoder) => TaskDecoder = /*#__PURE__*/ K2.mapLeftWithInput(M) From c3e01fda32f5fedcb11975fc7c2c48076e5e509f Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 07:06:16 +0200 Subject: [PATCH 086/222] add KleisliDecoder, KleisliTaskDecoder modules --- CHANGELOG.md | 6 +- docs/modules/Decoder.ts.md | 30 +- .../modules/{Kleisli2.ts.md => Kleisli.ts.md} | 67 ++-- docs/modules/KleisliDecoder.ts.md | 336 +++++++++++++++++ docs/modules/KleisliTaskDecoder.ts.md | 349 ++++++++++++++++++ docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 42 ++- docs/modules/Type.ts.md | 2 +- dtslint/ts3.5/Decoder.ts | 22 +- dtslint/ts3.5/Guard.ts | 9 +- dtslint/ts3.5/TaskDecoder.ts | 37 ++ perf/Decoder.ts | 3 + perf/Decoder2.ts | 13 +- src/Decoder.ts | 103 ++---- src/Encoder.ts | 28 +- src/{Kleisli2.ts => Kleisli.ts} | 102 +++-- src/KleisliDecoder.ts | 241 ++++++++++++ src/KleisliTaskDecoder.ts | 257 +++++++++++++ src/TaskDecoder.ts | 110 ++---- test/Codec.ts | 137 +++---- test/Decoder.ts | 252 +++++++------ test/KleisliDecoder.ts | 16 + test/KleisliTaskDecoder.ts | 17 + test/TaskDecoder.ts | 291 +++++++-------- 27 files changed, 1875 insertions(+), 603 deletions(-) rename docs/modules/{Kleisli2.ts.md => Kleisli.ts.md} (69%) create mode 100644 docs/modules/KleisliDecoder.ts.md create mode 100644 docs/modules/KleisliTaskDecoder.ts.md create mode 100644 dtslint/ts3.5/TaskDecoder.ts rename src/{Kleisli2.ts => Kleisli.ts} (75%) create mode 100644 src/KleisliDecoder.ts create mode 100644 src/KleisliTaskDecoder.ts create mode 100644 test/KleisliDecoder.ts create mode 100644 test/KleisliTaskDecoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 92471bb43..52fb13274 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ - add `FreeSemigroup` module (@gcanti) - add `TaskDecoder` module (@gcanti) - add `Kleisli` module (@gcanti) + - add `KleisliDecoder` module (@gcanti) + - add `KleisliTaskDecoder` module (@gcanti) - (**bc**) remove `Tree` module (@gcanti) - (**bc**) make `Json` type immutable (@gcanti) - `Decoder` @@ -31,8 +33,8 @@ - `Guard` - (**bc**) remove `never` (@gcanti) - `Schemable` - - better `literal` signature (@gcanti) - - better `union` signature (@gcanti) + - (**bc**) better `literal` signature (@gcanti) + - (**bc**) better `union` signature (@gcanti) - (**bc**) make intersections pipeables (@gcanti) - (**bc**) make refinements pipeables (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 951a86411..dd4feef41 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -23,6 +23,7 @@ Added in v2.2.7 - [map](#map) - [combinators](#combinators) - [array](#array) + - [compose](#compose) - [intersect](#intersect) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) @@ -53,6 +54,7 @@ Added in v2.2.7 - [number](#number) - [string](#string) - [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) - [draw](#draw) --- @@ -76,7 +78,7 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = FS.FreeSemigroup> +export type DecodeError = KD.DecodeError ``` Added in v2.2.7 @@ -138,6 +140,16 @@ export declare const array: (items: Decoder) => Decoder Added in v2.2.7 +## compose + +**Signature** + +```ts +export declare const compose: (to: KD.KleisliDecoder) => (from: Decoder) => Decoder +``` + +Added in v2.2.7 + ## intersect **Signature** @@ -164,7 +176,7 @@ Added in v2.2.7 ```ts export declare const mapLeftWithInput: ( - f: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> + f: (input: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> ) => (decoder: Decoder) => Decoder ``` @@ -357,9 +369,7 @@ Added in v2.2.7 **Signature** ```ts -export interface Decoder { - readonly decode: (u: unknown) => E.Either -} +export interface Decoder extends KD.KleisliDecoder {} ``` Added in v2.2.7 @@ -418,6 +428,16 @@ Added in v2.2.7 # utils +## TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = KD.TypeOf +``` + +Added in v2.2.7 + ## draw **Signature** diff --git a/docs/modules/Kleisli2.ts.md b/docs/modules/Kleisli.ts.md similarity index 69% rename from docs/modules/Kleisli2.ts.md rename to docs/modules/Kleisli.ts.md index b90e6796c..1b18893e2 100644 --- a/docs/modules/Kleisli2.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -1,10 +1,10 @@ --- -title: Kleisli2.ts +title: Kleisli.ts nav_order: 11 parent: Modules --- -## Kleisli2 overview +## Kleisli overview Added in v2.2.7 @@ -30,10 +30,10 @@ Added in v2.2.7 - [type](#type) - [union](#union) - [constructors](#constructors) - - [fromGuard](#fromguard) + - [fromRefinement](#fromrefinement) - [literal](#literal) - [model](#model) - - [Kleisli2 (interface)](#kleisli2-interface) + - [Kleisli (interface)](#kleisli-interface) --- @@ -46,7 +46,7 @@ Added in v2.2.7 ```ts export declare const alt: ( A: Alt2C -) => (that: Lazy>) => (me: Kleisli2) => Kleisli2 +) => (that: Lazy>) => (me: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -58,9 +58,7 @@ Added in v2.2.7 ```ts export declare function array( M: Applicative2C & Bifunctor2 -): ( - onItemError: (index: number, e: E) => E -) => (items: Kleisli2) => Kleisli2, E, Array> +): (onItemError: (index: number, e: E) => E) => (items: Kleisli) => Kleisli, E, Array> ``` Added in v2.2.7 @@ -72,7 +70,7 @@ Added in v2.2.7 ```ts export declare const intersect: ( M: Apply2C -) => (right: Kleisli2) => (left: Kleisli2) => Kleisli2 +) => (right: Kleisli) => (left: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -84,7 +82,7 @@ Added in v2.2.7 ```ts export declare const lazy: ( M: Bifunctor2 -) => (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli2) => Kleisli2 +) => (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli ``` Added in v2.2.7 @@ -96,7 +94,7 @@ Added in v2.2.7 ```ts export declare const map: ( F: Functor2C -) => (f: (a: A) => B) => (ia: Kleisli2) => Kleisli2 +) => (f: (a: A) => B) => (ia: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -113,7 +111,7 @@ export declare const mapLeftWithInput: ( M: Bifunctor2 -) => (f: (i: I, e: E) => E) => (decoder: Kleisli2) => Kleisli2 +) => (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -125,7 +123,7 @@ Added in v2.2.7 ```ts export declare const nullable: ( M: Applicative2C & Bifunctor2 -) => (onError: (i: I, e: E) => E) => (or: Kleisli2) => Kleisli2 +) => (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -137,7 +135,7 @@ Added in v2.2.7 ```ts export declare const parse: ( M: Monad2C -) => (parser: (a: A) => Kind2) => (from: Kleisli2) => Kleisli2 +) => (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -152,8 +150,8 @@ export declare function partial( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli2 } -) => Kleisli2, E, Partial<{ [K in keyof A]: A[K] }>> + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> ``` Added in v2.2.7 @@ -165,7 +163,7 @@ Added in v2.2.7 ```ts export declare const pipe: ( M: Monad2C -) => (ia: Kleisli2, ab: Kleisli2) => Kleisli2 +) => (ia: Kleisli, ab: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -179,7 +177,7 @@ export declare function record( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli2) => Kleisli2, E, Record> +) => (codomain: Kleisli) => Kleisli, E, Record> ``` Added in v2.2.7 @@ -194,7 +192,7 @@ export declare const refine: ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli2) => Kleisli2 +) => (from: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -211,8 +209,8 @@ export declare const sum: ( tag: T ) => , A>( - members: { [K in keyof A]: Kleisli2 } -) => Kleisli2 + members: { [K in keyof A]: Kleisli } +) => Kleisli ``` Added in v2.2.7 @@ -227,8 +225,8 @@ export declare function tuple( ): ( onIndexError: (index: number, e: E) => E ) => >( - ...components: { [K in keyof A]: Kleisli2 } -) => Kleisli2, E, A> + ...components: { [K in keyof A]: Kleisli } +) => Kleisli, E, A> ``` Added in v2.2.7 @@ -243,8 +241,8 @@ export declare function type( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli2 } -) => Kleisli2, E, { [K in keyof A]: A[K] }> + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, { [K in keyof A]: A[K] }> ``` Added in v2.2.7 @@ -259,22 +257,25 @@ export declare const union: ( onMemberError: (index: number, e: E) => E ) => ( - ...members: { [K in keyof A]: Kleisli2 } -) => Kleisli2 + ...members: { [K in keyof A]: Kleisli } +) => Kleisli ``` Added in v2.2.7 # constructors -## fromGuard +## fromRefinement **Signature** ```ts -export declare const fromGuard: ( +export declare const fromRefinement: < + M extends 'io-ts/Codec' | 'io-ts/Encoder' | 'Either' | 'IOEither' | 'TaskEither', + E +>( M: MonadThrow2C -) => (guard: G.Guard, onError: (i: I) => E) => Kleisli2 +) => (refinement: Refinement, onError: (i: I) => E) => Kleisli ``` Added in v2.2.7 @@ -288,19 +289,19 @@ export declare const literal: ) => ( onError: (i: I, values: readonly [Literal, ...Literal[]]) => E -) => (...values: A) => Kleisli2 +) => (...values: A) => Kleisli ``` Added in v2.2.7 # model -## Kleisli2 (interface) +## Kleisli (interface) **Signature** ```ts -export interface Kleisli2 { +export interface Kleisli { readonly decode: (i: I) => Kind2 } ``` diff --git a/docs/modules/KleisliDecoder.ts.md b/docs/modules/KleisliDecoder.ts.md new file mode 100644 index 000000000..281721724 --- /dev/null +++ b/docs/modules/KleisliDecoder.ts.md @@ -0,0 +1,336 @@ +--- +title: KleisliDecoder.ts +nav_order: 12 +parent: Modules +--- + +## KleisliDecoder overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [Alt](#alt) + - [alt](#alt) +- [DecodeError](#decodeerror) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [error](#error) + - [failure](#failure) + - [success](#success) +- [Functor](#functor) + - [map](#map) +- [combinators](#combinators) + - [array](#array) + - [compose](#compose) + - [intersect](#intersect) + - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) + - [nullable](#nullable) + - [parse](#parse) + - [partial](#partial) + - [record](#record) + - [refine](#refine) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [constructors](#constructors) + - [fromRefinement](#fromrefinement) + - [literal](#literal) +- [model](#model) + - [KleisliDecoder (interface)](#kleislidecoder-interface) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) + +--- + +# Alt + +## alt + +**Signature** + +```ts +export declare const alt: (that: () => KleisliDecoder) => (me: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +# DecodeError + +## DecodeError (type alias) + +**Signature** + +```ts +export type DecodeError = FS.FreeSemigroup> +``` + +Added in v2.2.7 + +## error + +**Signature** + +```ts +export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> +``` + +Added in v2.2.7 + +## failure + +**Signature** + +```ts +export declare const failure:
( + actual: unknown, + message: string +) => E.Either>, A> +``` + +Added in v2.2.7 + +## success + +**Signature** + +```ts +export declare const success: (a: A) => E.Either>, A> +``` + +Added in v2.2.7 + +# Functor + +## map + +**Signature** + +```ts +export declare const map: (f: (a: A) => B) => (fa: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +# combinators + +## array + +**Signature** + +```ts +export declare const array: (items: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## compose + +**Signature** + +```ts +export declare const compose: ( + to: KleisliDecoder +) => (from: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## intersect + +**Signature** + +```ts +export declare const intersect: ( + right: KleisliDecoder +) => (left: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## lazy + +**Signature** + +```ts +export declare const lazy: (id: string, f: () => KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## mapLeftWithInput + +**Signature** + +```ts +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## nullable + +**Signature** + +```ts +export declare const nullable: (or: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## parse + +**Signature** + +```ts +export declare const parse: ( + parser: (a: A) => E.Either>, B> +) => (from: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: KleisliDecoder } +) => KleisliDecoder, Partial<{ [K in keyof A]: A[K] }>> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare const record: ( + codomain: KleisliDecoder +) => KleisliDecoder, Record> +``` + +Added in v2.2.7 + +## refine + +**Signature** + +```ts +export declare const refine: ( + refinement: (a: A) => a is B, + id: string +) => (from: KleisliDecoder) => KleisliDecoder +``` + +Added in v2.2.7 + +## sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => , A>( + members: { [K in keyof A]: KleisliDecoder } +) => KleisliDecoder +``` + +Added in v2.2.7 + +## tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: KleisliDecoder } +) => KleisliDecoder +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: KleisliDecoder } +) => KleisliDecoder, { [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 + +## union + +**Signature** + +```ts +export declare const union: ( + ...members: { [K in keyof A]: KleisliDecoder } +) => KleisliDecoder +``` + +Added in v2.2.7 + +# constructors + +## fromRefinement + +**Signature** + +```ts +export declare const fromRefinement: ( + refinement: Refinement, + expected: string +) => KleisliDecoder +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare const literal: ( + ...values: A +) => KleisliDecoder +``` + +Added in v2.2.7 + +# model + +## KleisliDecoder (interface) + +**Signature** + +```ts +export interface KleisliDecoder { + readonly decode: (i: I) => E.Either +} +``` + +Added in v2.2.7 + +# utils + +## TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = KD extends KleisliDecoder ? A : never +``` + +Added in v2.2.7 diff --git a/docs/modules/KleisliTaskDecoder.ts.md b/docs/modules/KleisliTaskDecoder.ts.md new file mode 100644 index 000000000..c5b796163 --- /dev/null +++ b/docs/modules/KleisliTaskDecoder.ts.md @@ -0,0 +1,349 @@ +--- +title: KleisliTaskDecoder.ts +nav_order: 13 +parent: Modules +--- + +## KleisliTaskDecoder overview + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [Alt](#alt) + - [alt](#alt) +- [DecodeError](#decodeerror) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [error](#error) + - [failure](#failure) + - [success](#success) +- [Functor](#functor) + - [map](#map) +- [combinators](#combinators) + - [array](#array) + - [compose](#compose) + - [intersect](#intersect) + - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) + - [nullable](#nullable) + - [parse](#parse) + - [partial](#partial) + - [record](#record) + - [refine](#refine) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [constructors](#constructors) + - [fromKleisliDecoder](#fromkleislidecoder) + - [fromRefinement](#fromrefinement) + - [literal](#literal) +- [model](#model) + - [KleisliTaskDecoder (interface)](#kleislitaskdecoder-interface) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) + +--- + +# Alt + +## alt + +**Signature** + +```ts +export declare const alt: ( + that: () => KleisliTaskDecoder +) => (me: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +# DecodeError + +## DecodeError (type alias) + +**Signature** + +```ts +export type DecodeError = KD.DecodeError +``` + +Added in v2.2.7 + +## error + +**Signature** + +```ts +export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> +``` + +Added in v2.2.7 + +## failure + +**Signature** + +```ts +export declare const failure:
( + actual: unknown, + message: string +) => TE.TaskEither>, A> +``` + +Added in v2.2.7 + +## success + +**Signature** + +```ts +export declare const success: (a: A) => TE.TaskEither>, A> +``` + +Added in v2.2.7 + +# Functor + +## map + +**Signature** + +```ts +export declare const map: (f: (a: A) => B) => (fa: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +# combinators + +## array + +**Signature** + +```ts +export declare const array: (items: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## compose + +**Signature** + +```ts +export declare const compose: ( + to: KleisliTaskDecoder +) => (from: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## intersect + +**Signature** + +```ts +export declare const intersect: ( + right: KleisliTaskDecoder +) => (left: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## lazy + +**Signature** + +```ts +export declare const lazy: (id: string, f: () => KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## mapLeftWithInput + +**Signature** + +```ts +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## nullable + +**Signature** + +```ts +export declare const nullable: (or: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## parse + +**Signature** + +```ts +export declare const parse: ( + parser: (a: A) => TE.TaskEither>, B> +) => (from: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: KleisliTaskDecoder } +) => KleisliTaskDecoder, Partial<{ [K in keyof A]: A[K] }>> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare const record: ( + codomain: KleisliTaskDecoder +) => KleisliTaskDecoder, Record> +``` + +Added in v2.2.7 + +## refine + +**Signature** + +```ts +export declare const refine: ( + refinement: (a: A) => a is B, + id: string +) => (from: KleisliTaskDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => , A>( + members: { [K in keyof A]: KleisliTaskDecoder } +) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: KleisliTaskDecoder } +) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: KleisliTaskDecoder } +) => KleisliTaskDecoder, { [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 + +## union + +**Signature** + +```ts +export declare const union: ( + ...members: { [K in keyof A]: KleisliTaskDecoder } +) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +# constructors + +## fromKleisliDecoder + +**Signature** + +```ts +export declare const fromKleisliDecoder: (decoder: KD.KleisliDecoder) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## fromRefinement + +**Signature** + +```ts +export declare const fromRefinement: ( + refinement: Refinement, + expected: string +) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare const literal: ( + ...values: A +) => KleisliTaskDecoder +``` + +Added in v2.2.7 + +# model + +## KleisliTaskDecoder (interface) + +**Signature** + +```ts +export interface KleisliTaskDecoder { + readonly decode: (i: I) => TE.TaskEither +} +``` + +Added in v2.2.7 + +# utils + +## TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = KTD extends KleisliTaskDecoder ? A : never +``` + +Added in v2.2.7 diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 2abc64ffe..ff27f5a0e 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 12 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 5aea2ce60..deb8add51 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 13 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index ec28e2aad..e2d7f3a3e 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 14 +nav_order: 16 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index ccc6bbf89..11dbe1e88 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 15 +nav_order: 17 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index d36d2ddd5..8b7f07738 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 16 +nav_order: 18 parent: Modules --- @@ -23,6 +23,7 @@ Added in v2.2.7 - [map](#map) - [combinators](#combinators) - [array](#array) + - [compose](#compose) - [intersect](#intersect) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) @@ -54,6 +55,7 @@ Added in v2.2.7 - [number](#number) - [string](#string) - [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) - [draw](#draw) --- @@ -77,7 +79,7 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = FS.FreeSemigroup> +export type DecodeError = D.DecodeError ``` Added in v2.2.7 @@ -87,7 +89,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> +export declare const error: (actual: unknown, message: string) => FreeSemigroup> ``` Added in v2.2.7 @@ -100,7 +102,7 @@ Added in v2.2.7 export declare const failure: ( actual: unknown, message: string -) => TE.TaskEither>, A> +) => TE.TaskEither>, A> ``` Added in v2.2.7 @@ -110,7 +112,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const success: (a: A) => TE.TaskEither>, A> +export declare const success: (a: A) => TE.TaskEither>, A> ``` Added in v2.2.7 @@ -139,6 +141,16 @@ export declare const array: (items: TaskDecoder) => TaskDecoder Added in v2.2.7 +## compose + +**Signature** + +```ts +export declare const compose: (to: KTD.KleisliTaskDecoder) => (from: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + ## intersect **Signature** @@ -165,7 +177,7 @@ Added in v2.2.7 ```ts export declare const mapLeftWithInput: ( - f: (actual: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> + f: (input: unknown, e: FreeSemigroup>) => FreeSemigroup> ) => (decoder: TaskDecoder) => TaskDecoder ``` @@ -187,7 +199,7 @@ Added in v2.2.7 ```ts export declare const parse: ( - parser: (a: A) => TE.TaskEither>, B> + parser: (a: A) => TE.TaskEither>, B> ) => (from: TaskDecoder) => TaskDecoder ``` @@ -370,9 +382,7 @@ Added in v2.2.7 **Signature** ```ts -export interface TaskDecoder { - readonly decode: (u: unknown) => TE.TaskEither -} +export interface TaskDecoder extends KTD.KleisliTaskDecoder {} ``` Added in v2.2.7 @@ -431,12 +441,22 @@ Added in v2.2.7 # utils +## TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = KTD.TypeOf +``` + +Added in v2.2.7 + ## draw **Signature** ```ts -export declare const draw: (e: FS.FreeSemigroup>) => string +export declare const draw: (e: FreeSemigroup>) => string ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index dc35af2f9..9a1086a5b 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 17 +nav_order: 19 parent: Modules --- diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 7fefac185..c0039c6a8 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -1,7 +1,10 @@ import * as _ from '../../src/Decoder' +import * as DE from '../../src/DecodeError' +import * as FS from '../../src/FreeSemigroup' +import { pipe } from 'fp-ts/lib/pipeable' // $ExpectType Decoder<{ a: string; b: { c: number; }; }> -_.type({ +const A = _.type({ a: _.string, b: _.type({ c: _.number @@ -15,3 +18,20 @@ _.partial({ c: _.number }) }) + +// +// TypeOf +// + +// $ExpectType { a: string; b: { c: number; }; } +export type A = _.TypeOf + +// +// mapLeftWithInput +// + +// $ExpectType Decoder +pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) +) diff --git a/dtslint/ts3.5/Guard.ts b/dtslint/ts3.5/Guard.ts index 1f78f6b1c..ff971bf82 100644 --- a/dtslint/ts3.5/Guard.ts +++ b/dtslint/ts3.5/Guard.ts @@ -1,7 +1,7 @@ import * as _ from '../../src/Guard' // $ExpectType Guard<{ a: string; b: { c: number; }; }> -_.type({ +const A = _.type({ a: _.string, b: _.type({ c: _.number @@ -15,3 +15,10 @@ _.partial({ c: _.number }) }) + +// +// TypeOf +// + +// $ExpectType { a: string; b: { c: number; }; } +type A = _.TypeOf diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts new file mode 100644 index 000000000..add91cdf6 --- /dev/null +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -0,0 +1,37 @@ +import * as _ from '../../src/TaskDecoder' +import * as DE from '../../src/DecodeError' +import * as FS from '../../src/FreeSemigroup' +import { pipe } from 'fp-ts/lib/pipeable' + +// $ExpectType TaskDecoder<{ a: string; b: { c: number; }; }> +const A = _.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType TaskDecoder; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) + +// +// TypeOf +// + +// $ExpectType { a: string; b: { c: number; }; } +export type A = _.TypeOf + +// +// mapLeftWithInput +// + +// $ExpectType TaskDecoder +pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) +) diff --git a/perf/Decoder.ts b/perf/Decoder.ts index c7b78ea7c..a34949a57 100644 --- a/perf/Decoder.ts +++ b/perf/Decoder.ts @@ -4,6 +4,9 @@ import * as t from '../src/Decoder' /* space-object (good) x 662,359 ops/sec ±0.65% (88 runs sampled) space-object (bad) x 379,528 ops/sec ±0.56% (89 runs sampled) + +space-object (good) x 295,284 ops/sec ±0.67% (85 runs sampled) +space-object (bad) x 295,530 ops/sec ±0.53% (88 runs sampled) */ const suite = new Benchmark.Suite() diff --git a/perf/Decoder2.ts b/perf/Decoder2.ts index 34e26d03d..8dcf042e0 100644 --- a/perf/Decoder2.ts +++ b/perf/Decoder2.ts @@ -6,14 +6,11 @@ import * as G from '../src/Guard' /* -Guard (good) x 35,916,863 ops/sec ±1.28% (86 runs sampled) -Decoder (good) x 4,855,216 ops/sec ±0.83% (89 runs sampled) -Decoder2 (good) x 2,397,112 ops/sec ±0.53% (87 runs sampled) -Guard (bad) x 35,685,300 ops/sec ±1.45% (85 runs sampled) -Decoder (bad) x 1,255,976 ops/sec ±0.60% (90 runs sampled) -Decoder2 (bad) x 2,054,836 ops/sec ±0.73% (85 runs sampled) -Decoder (draw) x 584,770 ops/sec ±1.83% (87 runs sampled) -Decoder2 (draw) x 368,364 ops/sec ±0.45% (84 runs sampled) +Guard (good) x 36,163,576 ops/sec ±1.45% (86 runs sampled) +Decoder (good) x 2,365,294 ops/sec ±0.70% (87 runs sampled) +Guard (bad) x 34,845,843 ops/sec ±1.27% (84 runs sampled) +Decoder (bad) x 1,977,286 ops/sec ±0.86% (86 runs sampled) +Decoder (draw) x 365,279 ops/sec ±1.17% (82 runs sampled) */ diff --git a/src/Decoder.ts b/src/Decoder.ts index e5feb3724..719c198a2 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -10,17 +10,9 @@ import * as T from 'fp-ts/lib/Tree' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' import * as G from './Guard' -import * as K2 from './Kleisli2' +import * as KD from './KleisliDecoder' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' -// ------------------------------------------------------------------------------------- -// Kleisli2 config -// ------------------------------------------------------------------------------------- - -const M = - /*#__PURE__*/ - E.getValidation(DE.getSemigroup()) - // ------------------------------------------------------------------------------------- // model // ------------------------------------------------------------------------------------- @@ -29,9 +21,7 @@ const M = * @category model * @since 2.2.7 */ -export interface Decoder { - readonly decode: (u: unknown) => E.Either -} +export interface Decoder extends KD.KleisliDecoder {} // ------------------------------------------------------------------------------------- // DecodeError @@ -41,26 +31,25 @@ export interface Decoder { * @category DecodeError * @since 2.2.7 */ -export type DecodeError = FS.FreeSemigroup> +export type DecodeError = KD.DecodeError /** * @category DecodeError * @since 2.2.7 */ -export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) +export const error: (actual: unknown, message: string) => DecodeError = KD.error /** * @category DecodeError * @since 2.2.7 */ -export const success: (a: A) => E.Either = E.right +export const success: (a: A) => E.Either = KD.success /** * @category DecodeError * @since 2.2.7 */ -export const failure = (actual: unknown, message: string): E.Either => - E.left(error(actual, message)) +export const failure: (actual: unknown, message: string) => E.Either = KD.failure // ------------------------------------------------------------------------------------- // constructors @@ -70,16 +59,13 @@ export const failure = (actual: unknown, message: string): E.Either(guard: G.Guard, expected: string): Decoder => - K2.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) +export const fromGuard = (guard: G.Guard, expected: string): Decoder => KD.fromRefinement(guard.is, expected) /** * @category constructors * @since 2.2.7 */ -export const literal: ]>(...values: A) => Decoder = - /*#__PURE__*/ - K2.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) +export const literal: ]>(...values: A) => Decoder = KD.literal // ------------------------------------------------------------------------------------- // primitives @@ -134,68 +120,61 @@ export const UnknownRecord: Decoder> = * @since 2.2.7 */ export const mapLeftWithInput: ( - f: (actual: unknown, e: DecodeError) => DecodeError -) => (decoder: Decoder) => Decoder = - /*#__PURE__*/ - K2.mapLeftWithInput(M) + f: (input: unknown, e: DecodeError) => DecodeError +) => (decoder: Decoder) => Decoder = KD.mapLeftWithInput /** * @category combinators * @since 2.2.7 */ -export const refine = (refinement: (a: A) => a is B, id: string): ((from: Decoder) => Decoder) => - K2.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) +export const refine: (refinement: (a: A) => a is B, id: string) => (from: Decoder) => Decoder = + KD.refine /** * @category combinators * @since 2.2.7 */ -export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = - /*#__PURE__*/ - K2.parse(M) +export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = KD.parse /** * @category combinators * @since 2.2.7 */ -export const nullable: (or: Decoder) => Decoder = - /*#__PURE__*/ - K2.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) +export const nullable: (or: Decoder) => Decoder = KD.nullable /** * @category combinators * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> => - K2.pipe(M)(UnknownRecord, K2.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) + pipe(UnknownRecord, compose(KD.type(properties))) /** * @category combinators * @since 2.2.7 */ export const partial = (properties: { [K in keyof A]: Decoder }): Decoder> => - K2.pipe(M)(UnknownRecord, K2.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) + pipe(UnknownRecord, compose(KD.partial(properties))) /** * @category combinators * @since 2.2.7 */ -export const array = (items: Decoder): Decoder> => - K2.pipe(M)(UnknownArray, K2.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) +export const array = (items: Decoder): Decoder> => pipe(UnknownArray, compose(KD.array(items))) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: Decoder): Decoder> => - K2.pipe(M)(UnknownRecord, K2.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) + pipe(UnknownRecord, compose(KD.record(codomain))) /** * @category combinators * @since 2.2.7 */ export const tuple = >(...components: { [K in keyof A]: Decoder }): Decoder => - K2.pipe(M)(UnknownArray, K2.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) + pipe(UnknownArray, compose(KD.tuple(...(components as any)))) /** * @category combinators @@ -203,43 +182,32 @@ export const tuple = >(...components: { [K in k */ export const union: ]>( ...members: { [K in keyof A]: Decoder } -) => Decoder = - /*#__PURE__*/ - K2.union(M)((i, e) => FS.of(DE.member(i, e))) as any +) => Decoder = KD.union as any /** * @category combinators * @since 2.2.7 */ -export const intersect: (right: Decoder) => (left: Decoder) => Decoder = - /*#__PURE__*/ - K2.intersect(M) +export const intersect: (right: Decoder) => (left: Decoder) => Decoder = KD.intersect /** * @category combinators * @since 2.2.7 */ export const sum = (tag: T) => (members: { [K in keyof A]: Decoder }): Decoder => - K2.pipe(M)( - UnknownRecord, - K2.sum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) - ) - ) - )(tag)(members) - ) + pipe(UnknownRecord, compose(KD.sum(tag)(members))) /** * @category combinators * @since 2.2.7 */ -export const lazy: (id: string, f: () => Decoder) => Decoder = - /*#__PURE__*/ - K2.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +export const lazy: (id: string, f: () => Decoder) => Decoder = KD.lazy + +/** + * @category combinators + * @since 2.2.7 + */ +export const compose: (to: KD.KleisliDecoder) => (from: Decoder) => Decoder = KD.compose // ------------------------------------------------------------------------------------- // non-pipeables @@ -257,17 +225,13 @@ const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, tha * @category Functor * @since 2.2.7 */ -export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = - /*#__PURE__*/ - K2.map(M) +export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = KD.map /** * @category Alt * @since 2.2.7 */ -export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = - /*#__PURE__*/ - K2.alt(M) +export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = KD.alt // ------------------------------------------------------------------------------------- // instances @@ -339,6 +303,11 @@ export const schemableDecoder: Schemable1 & WithUnknownContainers1 & W // utils // ------------------------------------------------------------------------------------- +/** + * @since 2.2.7 + */ +export type TypeOf = KD.TypeOf + const toForest = (e: DecodeError): NEA.NonEmptyArray> => { const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), diff --git a/src/Encoder.ts b/src/Encoder.ts index 7624042fa..e52f16a2e 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -18,20 +18,6 @@ export interface Encoder { readonly encode: (a: A) => O } -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.3 - */ -export type TypeOf = E extends Encoder ? A : never - -/** - * @since 2.2.3 - */ -export type OutputOf = E extends Encoder ? O : never - // ------------------------------------------------------------------------------------- // constructors // ------------------------------------------------------------------------------------- @@ -238,3 +224,17 @@ export const categoryEncoder: Category2 = { compose: compose_, id } + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.3 + */ +export type TypeOf = E extends Encoder ? A : never + +/** + * @since 2.2.3 + */ +export type OutputOf = E extends Encoder ? O : never diff --git a/src/Kleisli2.ts b/src/Kleisli.ts similarity index 75% rename from src/Kleisli2.ts rename to src/Kleisli.ts index edc89cea6..fce5c3da6 100644 --- a/src/Kleisli2.ts +++ b/src/Kleisli.ts @@ -12,7 +12,7 @@ import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' import { intersect_, Literal, memoize } from './Schemable' -import { Lazy } from 'fp-ts/lib/function' +import { Lazy, Refinement } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- // model @@ -22,7 +22,7 @@ import { Lazy } from 'fp-ts/lib/function' * @category model * @since 2.2.7 */ -export interface Kleisli2 { +export interface Kleisli { readonly decode: (i: I) => Kind2 } @@ -34,11 +34,11 @@ export interface Kleisli2 { * @category constructors * @since 2.2.7 */ -export const fromGuard = (M: MonadThrow2C) => ( - guard: G.Guard, +export const fromRefinement = (M: MonadThrow2C) => ( + refinement: Refinement, onError: (i: I) => E -): Kleisli2 => ({ - decode: (i) => (guard.is(i) ? M.of(i) : M.throwError(onError(i))) +): Kleisli => ({ + decode: (i) => (refinement(i) ? M.of(i) : M.throwError(onError(i))) }) /** @@ -47,7 +47,7 @@ export const fromGuard = (M: MonadThrow2C) => ( */ export const literal = (M: MonadThrow2C) => ( onError: (i: I, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A): Kleisli2 => ({ +) => ]>(...values: A): Kleisli => ({ decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) }) @@ -60,8 +60,8 @@ export const literal = (M: MonadThrow2C) => ( * @since 2.2.7 */ export const mapLeftWithInput = (M: Bifunctor2) => (f: (i: I, e: E) => E) => ( - decoder: Kleisli2 -): Kleisli2 => ({ + decoder: Kleisli +): Kleisli => ({ decode: (i) => M.mapLeft(decoder.decode(i), (e) => f(i, e)) }) @@ -72,19 +72,15 @@ export const mapLeftWithInput = (M: Bifunctor2) => (f: export const refine = (M: MonadThrow2C & Bifunctor2) => ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli2): Kleisli2 => ({ - decode: (u) => M.chain(from.decode(u), (a) => (refinement(a) ? M.of(a) : M.throwError(onError(a)))) -}) +) => (from: Kleisli): Kleisli => pipe(M)(from, fromRefinement(M)(refinement, onError)) /** * @category combinators * @since 2.2.7 */ -export const parse = (M: Monad2C) => (parser: (a: A) => Kind2) => ( - from: Kleisli2 -): Kleisli2 => ({ - decode: (u) => M.chain(from.decode(u), (a) => parser(a)) -}) +export const parse = (M: Monad2C) => (decode: (a: A) => Kind2) => ( + from: Kleisli +): Kleisli => pipe(M)(from, { decode }) /** * @category combinators @@ -92,7 +88,7 @@ export const parse = (M: Monad2C) => (parser: (a */ export const nullable = (M: Applicative2C & Bifunctor2) => ( onError: (i: I, e: E) => E -) => (or: Kleisli2): Kleisli2 => ({ +) => (or: Kleisli): Kleisli => ({ decode: (i) => i === null ? M.of(null) @@ -112,12 +108,12 @@ export function type( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli2 } -) => Kleisli2, E, { [K in keyof A]: A[K] }> { + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, { [K in keyof A]: A[K] }> { const traverse = traverseRecordWithIndex(M) return (onKeyError) => (properties) => ({ decode: (i) => - traverse(properties as Record>, (k, decoder) => + traverse(properties as Record>, (k, decoder) => M.mapLeft(decoder.decode(i[k]), (e) => onKeyError(k, e)) ) as any }) @@ -132,22 +128,22 @@ export function partial( ): ( onKeyError: (key: string, e: E) => E ) => ( - properties: { [K in keyof A]: Kleisli2 } -) => Kleisli2, E, Partial<{ [K in keyof A]: A[K] }>> { + properties: { [K in keyof A]: Kleisli } +) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> { const traverse = traverseRecordWithIndex(M) - const skip = M.of>(E.left(undefined)) - const undef = M.of>(E.right(undefined)) + const undefinedProperty = M.of>(E.right(undefined)) + const skipProperty = M.of>(E.left(undefined)) return (onKeyError) => (properties) => ({ decode: (i) => M.map( - traverse(properties as Record>, (k, decoder) => { + traverse(properties as Record>, (k, decoder) => { const ik = i[k] if (ik === undefined) { return k in i ? // don't strip undefined properties - undef + undefinedProperty : // don't add missing properties - skip + skipProperty } return M.bimap( decoder.decode(ik), @@ -168,7 +164,7 @@ export function array( M: Applicative2C & Bifunctor2 ): ( onItemError: (index: number, e: E) => E -) => (items: Kleisli2) => Kleisli2, E, Array> { +) => (items: Kleisli) => Kleisli, E, Array> { const traverse = traverseArrayWithIndex(M) return (onItemError) => (items) => ({ decode: (is) => traverse(is, (index, i) => M.mapLeft(items.decode(i), (e) => onItemError(index, e))) @@ -183,7 +179,7 @@ export function record( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli2) => Kleisli2, E, Record> { +) => (codomain: Kleisli) => Kleisli, E, Record> { const traverse = traverseRecordWithIndex(M) return (onKeyError) => (codomain) => ({ decode: (ir) => traverse(ir, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) @@ -199,12 +195,12 @@ export function tuple( ): ( onIndexError: (index: number, e: E) => E ) => >( - ...components: { [K in keyof A]: Kleisli2 } -) => Kleisli2, E, A> { + ...components: { [K in keyof A]: Kleisli } +) => Kleisli, E, A> { const traverse = traverseArrayWithIndex(M) return (onIndexError) => (...components) => ({ decode: (is) => - traverse((components as unknown) as Array>, (index, decoder) => + traverse((components as unknown) as Array>, (index, decoder) => M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) ) as any }) @@ -217,8 +213,8 @@ export function tuple( export const union = (M: Alt2C & Bifunctor2) => ( onMemberError: (index: number, e: E) => E ) => ]>( - ...members: { [K in keyof A]: Kleisli2 } -): Kleisli2 => ({ + ...members: { [K in keyof A]: Kleisli } +): Kleisli => ({ decode: (i) => { let out: Kind2 = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) for (let index = 1; index < members.length; index++) { @@ -232,9 +228,9 @@ export const union = (M: Alt2C & Bifunctor2) => ( * @category combinators * @since 2.2.7 */ -export const intersect = (M: Apply2C) => (right: Kleisli2) => ( - left: Kleisli2 -): Kleisli2 => ({ +export const intersect = (M: Apply2C) => (right: Kleisli) => ( + left: Kleisli +): Kleisli => ({ decode: (i) => M.ap( M.map(left.decode(i), (a: A) => (b: B) => intersect_(a, b)), @@ -251,11 +247,11 @@ export const sum = (M: MonadThrow2C) => ( ) => ( tag: T ): (, A>( - members: { [K in keyof A]: Kleisli2 } -) => Kleisli2) => { + members: { [K in keyof A]: Kleisli } +) => Kleisli) => { return , A>( - members: { [K in keyof A]: Kleisli2 } - ): Kleisli2 => { + members: { [K in keyof A]: Kleisli } + ): Kleisli => { const keys = Object.keys(members) return { decode: (ir) => { @@ -275,9 +271,9 @@ export const sum = (M: MonadThrow2C) => ( */ export const lazy = (M: Bifunctor2) => ( onError: (id: string, e: E) => E -): ((id: string, f: () => Kleisli2) => Kleisli2) => { - return (id: string, f: () => Kleisli2): Kleisli2 => { - const get = memoize>(f) +): ((id: string, f: () => Kleisli) => Kleisli) => { + return (id: string, f: () => Kleisli): Kleisli => { + const get = memoize>(f) return { decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) } @@ -289,9 +285,9 @@ export const lazy = (M: Bifunctor2) => ( * @since 2.2.7 */ export const pipe = (M: Monad2C) => ( - ia: Kleisli2, - ab: Kleisli2 -): Kleisli2 => ({ + ia: Kleisli, + ab: Kleisli +): Kleisli => ({ decode: (i) => M.chain(ia.decode(i), ab.decode) }) @@ -300,8 +296,8 @@ export const pipe = (M: Monad2C) => ( * @since 2.2.7 */ export const map = (F: Functor2C) => (f: (a: A) => B) => ( - ia: Kleisli2 -): Kleisli2 => ({ + ia: Kleisli +): Kleisli => ({ decode: (i) => F.map(ia.decode(i), f) }) @@ -309,9 +305,9 @@ export const map = (F: Functor2C) => (f: (a: A) * @category combinators * @since 2.2.7 */ -export const alt = (A: Alt2C) => (that: Lazy>) => ( - me: Kleisli2 -): Kleisli2 => ({ +export const alt = (A: Alt2C) => (that: Lazy>) => ( + me: Kleisli +): Kleisli => ({ decode: (i) => A.alt(me.decode(i), () => that().decode(i)) }) diff --git a/src/KleisliDecoder.ts b/src/KleisliDecoder.ts new file mode 100644 index 000000000..ffd68a3a6 --- /dev/null +++ b/src/KleisliDecoder.ts @@ -0,0 +1,241 @@ +/** + * @since 2.2.7 + */ +import * as E from 'fp-ts/lib/Either' +import { Refinement } from 'fp-ts/lib/function' +import * as DE from './DecodeError' +import * as FS from './FreeSemigroup' +import * as K from './Kleisli' +import { Literal } from './Schemable' + +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- + +const M = + /*#__PURE__*/ + E.getValidation(DE.getSemigroup()) + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface KleisliDecoder { + readonly decode: (i: I) => E.Either +} + +// ------------------------------------------------------------------------------------- +// DecodeError +// ------------------------------------------------------------------------------------- + +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = FS.FreeSemigroup> + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const success: (a: A) => E.Either = E.right + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const failure = (actual: unknown, message: string): E.Either => + E.left(error(actual, message)) + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromRefinement = (refinement: Refinement, expected: string): KleisliDecoder => + K.fromRefinement(M)(refinement, (u) => error(u, expected)) + +/** + * @category constructors + * @since 2.2.7 + */ +export const literal: ]>( + ...values: A +) => KleisliDecoder = + /*#__PURE__*/ + K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @category combinators + * @since 2.2.7 + */ +export const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.mapLeftWithInput(M) + +/** + * @category combinators + * @since 2.2.7 + */ +export const refine = ( + refinement: (a: A) => a is B, + id: string +): ((from: KleisliDecoder) => KleisliDecoder) => K.refine(M)(refinement, (a) => error(a, id)) + +/** + * @category combinators + * @since 2.2.7 + */ +export const parse: ( + parser: (a: A) => E.Either +) => (from: KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.parse(M) + +/** + * @category combinators + * @since 2.2.7 + */ +export const nullable: (or: KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e)))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const type = ( + properties: { [K in keyof A]: KleisliDecoder } +): KleisliDecoder, { [K in keyof A]: A[K] }> => + K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) + +/** + * @category combinators + * @since 2.2.7 + */ +export const partial = ( + properties: { [K in keyof A]: KleisliDecoder } +): KleisliDecoder, Partial<{ [K in keyof A]: A[K] }>> => + K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) + +/** + * @category combinators + * @since 2.2.7 + */ +export const array = (items: KleisliDecoder): KleisliDecoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) + +/** + * @category combinators + * @since 2.2.7 + */ +export const record = (codomain: KleisliDecoder): KleisliDecoder, Record> => + K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) + +/** + * @category combinators + * @since 2.2.7 + */ +export const tuple = >( + ...components: { [K in keyof A]: KleisliDecoder } +): KleisliDecoder, A> => K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any)) + +/** + * @category combinators + * @since 2.2.7 + */ +export const union: ]>( + ...members: { [K in keyof A]: KleisliDecoder } +) => KleisliDecoder = + /*#__PURE__*/ + K.union(M)((i, e) => FS.of(DE.member(i, e))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const intersect: ( + right: KleisliDecoder +) => (left: KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.intersect(M) + +/** + * @category combinators + * @since 2.2.7 + */ +export const sum = (tag: T) => , A>( + members: { [K in keyof A]: KleisliDecoder } +): KleisliDecoder => + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) + ) + )(tag)(members) + +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy: (id: string, f: () => KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const compose = (to: KleisliDecoder) => (from: KleisliDecoder): KleisliDecoder => + K.pipe(M)(from, to) + +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @category Functor + * @since 2.2.7 + */ +export const map: (f: (a: A) => B) => (fa: KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.map(M) + +/** + * @category Alt + * @since 2.2.7 + */ +export const alt: (that: () => KleisliDecoder) => (me: KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.alt(M) + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.7 + */ +export type TypeOf = KD extends KleisliDecoder ? A : never diff --git a/src/KleisliTaskDecoder.ts b/src/KleisliTaskDecoder.ts new file mode 100644 index 000000000..b4c024540 --- /dev/null +++ b/src/KleisliTaskDecoder.ts @@ -0,0 +1,257 @@ +/** + * @since 2.2.7 + */ +import { Refinement } from 'fp-ts/lib/function' +import * as TE from 'fp-ts/lib/TaskEither' +import * as DE from './DecodeError' +import * as FS from './FreeSemigroup' +import * as K from './Kleisli' +import * as KD from './KleisliDecoder' +import { Literal } from './Schemable' + +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- + +const M = + /*#__PURE__*/ + TE.getTaskValidation(DE.getSemigroup()) + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface KleisliTaskDecoder { + readonly decode: (i: I) => TE.TaskEither +} + +// ------------------------------------------------------------------------------------- +// DecodeError +// ------------------------------------------------------------------------------------- + +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = KD.DecodeError + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const error: (actual: unknown, message: string) => DecodeError = KD.error + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const success: (a: A) => TE.TaskEither = TE.right + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const failure = (actual: unknown, message: string): TE.TaskEither => + TE.left(KD.error(actual, message)) + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromKleisliDecoder = (decoder: KD.KleisliDecoder): KleisliTaskDecoder => ({ + decode: TE.fromEitherK(decoder.decode) +}) + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromRefinement = ( + refinement: Refinement, + expected: string +): KleisliTaskDecoder => fromKleisliDecoder(KD.fromRefinement(refinement, expected)) + +/** + * @category constructors + * @since 2.2.7 + */ +export const literal: ]>( + ...values: A +) => KleisliTaskDecoder = + /*#__PURE__*/ + K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @category combinators + * @since 2.2.7 + */ +export const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.mapLeftWithInput(M) + +/** + * @category combinators + * @since 2.2.7 + */ +export const refine = ( + refinement: (a: A) => a is B, + id: string +): ((from: KleisliTaskDecoder) => KleisliTaskDecoder) => K.refine(M)(refinement, (a) => error(a, id)) + +/** + * @category combinators + * @since 2.2.7 + */ +export const parse: ( + parser: (a: A) => TE.TaskEither +) => (from: KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.parse(M) + +/** + * @category combinators + * @since 2.2.7 + */ +export const nullable: (or: KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e)))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const type = ( + properties: { [K in keyof A]: KleisliTaskDecoder } +): KleisliTaskDecoder, { [K in keyof A]: A[K] }> => + K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) + +/** + * @category combinators + * @since 2.2.7 + */ +export const partial = ( + properties: { [K in keyof A]: KleisliTaskDecoder } +): KleisliTaskDecoder, Partial<{ [K in keyof A]: A[K] }>> => + K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) + +/** + * @category combinators + * @since 2.2.7 + */ +export const array = (items: KleisliTaskDecoder): KleisliTaskDecoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) + +/** + * @category combinators + * @since 2.2.7 + */ +export const record = ( + codomain: KleisliTaskDecoder +): KleisliTaskDecoder, Record> => + K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) + +/** + * @category combinators + * @since 2.2.7 + */ +export const tuple = >( + ...components: { [K in keyof A]: KleisliTaskDecoder } +): KleisliTaskDecoder, A> => K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any)) + +/** + * @category combinators + * @since 2.2.7 + */ +export const union: ]>( + ...members: { [K in keyof A]: KleisliTaskDecoder } +) => KleisliTaskDecoder = + /*#__PURE__*/ + K.union(M)((i, e) => FS.of(DE.member(i, e))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const intersect: ( + right: KleisliTaskDecoder +) => (left: KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.intersect(M) + +/** + * @category combinators + * @since 2.2.7 + */ +export const sum = (tag: T) => , A>( + members: { [K in keyof A]: KleisliTaskDecoder } +): KleisliTaskDecoder => + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) + ) + )(tag)(members) + +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy: (id: string, f: () => KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const compose = (to: KleisliTaskDecoder) => ( + from: KleisliTaskDecoder +): KleisliTaskDecoder => K.pipe(M)(from, to) + +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @category Functor + * @since 2.2.7 + */ +export const map: (f: (a: A) => B) => (fa: KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.map(M) + +/** + * @category Alt + * @since 2.2.7 + */ +export const alt: ( + that: () => KleisliTaskDecoder +) => (me: KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.alt(M) + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.7 + */ +export type TypeOf = KTD extends KleisliTaskDecoder ? A : never diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index d6f6757ca..176129036 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -6,21 +6,11 @@ import { Functor1 } from 'fp-ts/lib/Functor' import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' -import * as FS from '../src/FreeSemigroup' -import * as DE from './DecodeError' import * as D from './Decoder' import * as G from './Guard' -import * as K2 from './Kleisli2' +import * as KTD from './KleisliTaskDecoder' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' -// ------------------------------------------------------------------------------------- -// Kleisli2 config -// ------------------------------------------------------------------------------------- - -const M = - /*#__PURE__*/ - TE.getTaskValidation(DE.getSemigroup()) - // ------------------------------------------------------------------------------------- // model // ------------------------------------------------------------------------------------- @@ -29,9 +19,7 @@ const M = * @category model * @since 2.2.7 */ -export interface TaskDecoder { - readonly decode: (u: unknown) => TE.TaskEither -} +export interface TaskDecoder extends KTD.KleisliTaskDecoder {} // ------------------------------------------------------------------------------------- // DecodeError @@ -41,26 +29,25 @@ export interface TaskDecoder { * @category DecodeError * @since 2.2.7 */ -export type DecodeError = FS.FreeSemigroup> +export type DecodeError = D.DecodeError /** * @category DecodeError * @since 2.2.7 */ -export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) +export const error: (actual: unknown, message: string) => DecodeError = D.error /** * @category DecodeError * @since 2.2.7 */ -export const success: (a: A) => TE.TaskEither = TE.right +export const success: (a: A) => TE.TaskEither = KTD.success /** * @category DecodeError * @since 2.2.7 */ -export const failure = (actual: unknown, message: string): TE.TaskEither => - TE.left(error(actual, message)) +export const failure: (actual: unknown, message: string) => TE.TaskEither = KTD.failure // ------------------------------------------------------------------------------------- // constructors @@ -70,24 +57,21 @@ export const failure = (actual: unknown, message: string): TE.TaskEit * @category constructors * @since 2.2.7 */ -export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ - decode: TE.fromEitherK(decoder.decode) -}) +export const fromDecoder: (decoder: D.Decoder) => TaskDecoder = KTD.fromKleisliDecoder /** * @category constructors * @since 2.2.7 */ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => - K2.fromGuard(M)(guard, (u) => FS.of(DE.leaf(u, expected))) + KTD.fromRefinement(guard.is, expected) /** * @category constructors * @since 2.2.7 */ export const literal: ]>(...values: A) => TaskDecoder = - /*#__PURE__*/ - K2.literal(M)((u, values) => FS.of(DE.leaf(u, values.map((value) => JSON.stringify(value)).join(' | ')))) + KTD.literal // ------------------------------------------------------------------------------------- // primitives @@ -142,19 +126,17 @@ export const UnknownRecord: TaskDecoder> = * @since 2.2.7 */ export const mapLeftWithInput: ( - f: (actual: unknown, e: DecodeError) => DecodeError -) => (decoder: TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K2.mapLeftWithInput(M) + f: (input: unknown, e: DecodeError) => DecodeError +) => (decoder: TaskDecoder) => TaskDecoder = KTD.mapLeftWithInput /** * @category combinators * @since 2.2.7 */ -export const refine = ( +export const refine: ( refinement: (a: A) => a is B, id: string -): ((from: TaskDecoder) => TaskDecoder) => K2.refine(M)(refinement, (a) => FS.of(DE.leaf(a, id))) +) => (from: TaskDecoder) => TaskDecoder = KTD.refine /** * @category combinators @@ -162,24 +144,20 @@ export const refine = ( */ export const parse: ( parser: (a: A) => TE.TaskEither -) => (from: TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K2.parse(M) +) => (from: TaskDecoder) => TaskDecoder = KTD.parse /** * @category combinators * @since 2.2.7 */ -export const nullable: (or: TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K2.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, FS.of(DE.leaf(u, 'null')))), FS.of(DE.member(1, e)))) +export const nullable: (or: TaskDecoder) => TaskDecoder = KTD.nullable /** * @category combinators * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder<{ [K in keyof A]: A[K] }> => - K2.pipe(M)(UnknownRecord, K2.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties)) + pipe(UnknownRecord, compose(KTD.type(properties))) /** * @category combinators @@ -187,22 +165,20 @@ export const type = (properties: { [K in keyof A]: TaskDecoder }): Task */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => - K2.pipe(M)(UnknownRecord, K2.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties)) +): TaskDecoder> => pipe(UnknownRecord, compose(KTD.partial(properties))) /** * @category combinators * @since 2.2.7 */ -export const array = (items: TaskDecoder): TaskDecoder> => - K2.pipe(M)(UnknownArray, K2.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items)) +export const array = (items: TaskDecoder): TaskDecoder> => pipe(UnknownArray, compose(KTD.array(items))) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - K2.pipe(M)(UnknownRecord, K2.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain)) + pipe(UnknownRecord, compose(KTD.record(codomain))) /** * @category combinators @@ -210,8 +186,7 @@ export const record = (codomain: TaskDecoder): TaskDecoder>( ...components: { [K in keyof A]: TaskDecoder } -): TaskDecoder => - K2.pipe(M)(UnknownArray, K2.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any))) +): TaskDecoder => pipe(UnknownArray, compose(KTD.tuple(...(components as any)))) /** * @category combinators @@ -219,17 +194,13 @@ export const tuple = >( */ export const union: ]>( ...members: { [K in keyof A]: TaskDecoder } -) => TaskDecoder = - /*#__PURE__*/ - K2.union(M)((i, e) => FS.of(DE.member(i, e))) as any +) => TaskDecoder = KTD.union as any /** * @category combinators * @since 2.2.7 */ -export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K2.intersect(M) +export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = KTD.intersect /** * @category combinators @@ -237,27 +208,19 @@ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) */ export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => - K2.pipe(M)( - UnknownRecord, - K2.sum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - FS.of(DE.leaf(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) - ) - ) - )(tag)(members) - ) +): TaskDecoder => pipe(UnknownRecord, compose(KTD.sum(tag)(members))) /** * @category combinators * @since 2.2.7 */ -export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K2.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = KTD.lazy + +/** + * @category combinators + * @since 2.2.7 + */ +export const compose: (to: KTD.KleisliTaskDecoder) => (from: TaskDecoder) => TaskDecoder = KTD.compose // ------------------------------------------------------------------------------------- // non-pipeables @@ -275,17 +238,13 @@ const alt_: (me: TaskDecoder, that: () => TaskDecoder) => TaskDecoder(f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K2.map(M) +export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = KTD.map /** * @category Alt * @since 2.2.7 */ -export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K2.alt(M) +export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = KTD.alt // ------------------------------------------------------------------------------------- // instances @@ -360,6 +319,11 @@ export const schemableTaskDecoder: Schemable1 & // utils // ------------------------------------------------------------------------------------- +/** + * @since 2.2.7 + */ +export type TypeOf = KTD.TypeOf + /** * @since 2.2.7 */ diff --git a/test/Codec.ts b/test/Codec.ts index 268ce6c75..e0bc3331b 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -1,11 +1,11 @@ import * as assert from 'assert' -import { left, right } from 'fp-ts/lib/Either' import * as C from '../src/Codec' import * as D from '../src/Decoder' import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' +import * as E from 'fp-ts/lib/Either' const NumberFromString: C.Codec = C.make( pipe( @@ -49,7 +49,7 @@ describe('Codec', () => { (s) => ({ value: s }), ({ value }) => value ) - assert.deepStrictEqual(codec.decode('a'), right({ value: 'a' })) + assert.deepStrictEqual(codec.decode('a'), D.success({ value: 'a' })) assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) }) @@ -62,7 +62,7 @@ describe('Codec', () => { ({ value }) => value ) ) - assert.deepStrictEqual(codec.decode('a'), right({ value: 'a' })) + assert.deepStrictEqual(codec.decode('a'), D.success({ value: 'a' })) assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) @@ -73,7 +73,7 @@ describe('Codec', () => { C.number, C.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) ) - assert.deepStrictEqual(decoder.decode('a'), left(FS.of(DE.leaf('a', 'not a number')))) + assert.deepStrictEqual(decoder.decode('a'), D.failure('a', 'not a number')) }) }) }) @@ -82,12 +82,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.string - assert.deepStrictEqual(codec.decode('a'), right('a')) + assert.deepStrictEqual(codec.decode('a'), D.success('a')) }) it('should reject an invalid input', () => { const codec = C.string - assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'string')))) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'string')) }) }) }) @@ -96,12 +96,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.number - assert.deepStrictEqual(codec.decode(1), right(1)) + assert.deepStrictEqual(codec.decode(1), D.success(1)) }) it('should reject an invalid input', () => { const codec = C.number - assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'number')))) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'number')) }) }) }) @@ -110,13 +110,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.boolean - assert.deepStrictEqual(codec.decode(true), right(true)) - assert.deepStrictEqual(codec.decode(false), right(false)) + assert.deepStrictEqual(codec.decode(true), D.success(true)) + assert.deepStrictEqual(codec.decode(false), D.success(false)) }) it('should reject an invalid input', () => { const codec = C.boolean - assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'boolean')))) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'boolean')) }) }) }) @@ -125,13 +125,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(codec.decode('a'), right('a')) - assert.deepStrictEqual(codec.decode(null), right(null)) + assert.deepStrictEqual(codec.decode('a'), D.success('a')) + assert.deepStrictEqual(codec.decode(null), D.success(null)) }) it('should reject an invalid input', () => { const codec = C.literal('a', null) - assert.deepStrictEqual(codec.decode('b'), left(FS.of(DE.leaf('b', '"a" | null')))) + assert.deepStrictEqual(codec.decode('b'), D.failure('b', '"a" | null')) }) }) @@ -150,7 +150,7 @@ describe('Codec', () => { C.string, C.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(codec.decode('a'), right('a')) + assert.deepStrictEqual(codec.decode('a'), D.success('a')) }) it('should reject an invalid input', () => { @@ -158,8 +158,8 @@ describe('Codec', () => { C.string, C.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'string')))) - assert.deepStrictEqual(codec.decode(''), left(FS.of(DE.leaf('', 'NonEmptyString')))) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'string')) + assert.deepStrictEqual(codec.decode(''), D.failure('', 'NonEmptyString')) }) }) @@ -178,15 +178,15 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.nullable(NumberFromString) - assert.deepStrictEqual(codec.decode(null), right(null)) - assert.deepStrictEqual(codec.decode('1'), right(1)) + assert.deepStrictEqual(codec.decode(null), D.success(null)) + assert.deepStrictEqual(codec.decode('1'), D.success(1)) }) it('should reject an invalid input', () => { const codec = C.nullable(NumberFromString) assert.deepStrictEqual( codec.decode(undefined), - left( + E.left( FS.concat( FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) @@ -195,7 +195,7 @@ describe('Codec', () => { ) assert.deepStrictEqual( codec.decode('a'), - left( + E.left( FS.concat( FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) @@ -220,31 +220,31 @@ describe('Codec', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), right({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) }) it('should strip additional fields', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), right({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', () => { const codec = C.type({ a: undef }) - assert.deepStrictEqual(codec.decode({}), right({ a: undefined })) + assert.deepStrictEqual(codec.decode({}), D.success({ a: undefined })) }) it('should reject an invalid input', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 1 }), - left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) @@ -255,7 +255,7 @@ describe('Codec', () => { }) assert.deepStrictEqual( codec.decode({}), - left( + E.left( FS.concat( FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) @@ -274,7 +274,7 @@ describe('Codec', () => { } } const codec = C.type({ a: C.string, b: C.string }) - assert.deepStrictEqual(codec.decode(new A()), right({ a: 'a', b: 'b' })) + assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) }) }) @@ -296,31 +296,31 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), right({ a: 'a' })) - assert.deepStrictEqual(codec.decode({}), right({})) + assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({}), D.success({})) }) it('should strip additional fields', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), right({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) }) it('should not add missing fields', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({}), right({})) + assert.deepStrictEqual(codec.decode({}), D.success({})) }) it('should not strip fields corresponding to undefined values', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: undefined }), right({ a: undefined })) + assert.deepStrictEqual(codec.decode({ a: undefined }), D.success({ a: undefined })) }) it('should reject an invalid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 1 }), - left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) ) }) @@ -331,7 +331,7 @@ describe('Codec', () => { }) assert.deepStrictEqual( codec.decode({ a: 1, b: 'b' }), - left( + E.left( FS.concat( FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) @@ -350,7 +350,7 @@ describe('Codec', () => { } } const codec = C.partial({ a: C.string, b: C.string }) - assert.deepStrictEqual(codec.decode(new A()), right({ a: 'a', b: 'b' })) + assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) }) }) @@ -383,16 +383,16 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid value', () => { const codec = C.record(C.number) - assert.deepStrictEqual(codec.decode({}), right({})) - assert.deepStrictEqual(codec.decode({ a: 1 }), right({ a: 1 })) + assert.deepStrictEqual(codec.decode({}), D.success({})) + assert.deepStrictEqual(codec.decode({ a: 1 }), D.success({ a: 1 })) }) it('should reject an invalid value', () => { const codec = C.record(C.number) - assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 'a' }), - left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) ) }) @@ -400,7 +400,7 @@ describe('Codec', () => { const codec = C.record(C.number) assert.deepStrictEqual( codec.decode({ a: 'a', b: 'b' }), - left( + E.left( FS.concat( FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) @@ -422,21 +422,21 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.array(C.string) - assert.deepStrictEqual(codec.decode([]), right([])) - assert.deepStrictEqual(codec.decode(['a']), right(['a'])) + assert.deepStrictEqual(codec.decode([]), D.success([])) + assert.deepStrictEqual(codec.decode(['a']), D.success(['a'])) }) it('should reject an invalid input', () => { const codec = C.array(C.string) - assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual(codec.decode([1]), left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) + assert.deepStrictEqual(codec.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) }) it('should collect all errors', () => { const codec = C.array(C.string) assert.deepStrictEqual( codec.decode([1, 2]), - left( + E.left( FS.concat( FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) @@ -458,28 +458,31 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(['a', 1]), right(['a', 1])) + assert.deepStrictEqual(codec.decode(['a', 1]), D.success(['a', 1])) }) it('should handle zero components', () => { - assert.deepStrictEqual(C.tuple().decode([]), right([])) + assert.deepStrictEqual(C.tuple().decode([]), D.success([])) }) it('should reject an invalid input', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(undefined), left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) assert.deepStrictEqual( codec.decode(['a']), - left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + codec.decode([1, 2]), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) ) - assert.deepStrictEqual(codec.decode([1, 2]), left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))))) }) it('should collect all errors', () => { const codec = C.tuple(C.string, C.number) assert.deepStrictEqual( codec.decode([1, 'a']), - left( + E.left( FS.concat( FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) @@ -490,7 +493,7 @@ describe('Codec', () => { it('should strip additional components', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(['a', 1, true]), right(['a', 1])) + assert.deepStrictEqual(codec.decode(['a', 1, true]), D.success(['a', 1])) }) }) @@ -506,12 +509,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = pipe(C.type({ a: C.string }), C.intersect(C.type({ b: C.number }))) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), right({ a: 'a', b: 1 })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a', b: 1 })) }) it('should handle primitives', () => { const codec = pipe(Int, C.intersect(Positive)) - assert.deepStrictEqual(codec.decode(1), right(1)) + assert.deepStrictEqual(codec.decode(1), D.success(1)) }) }) @@ -536,22 +539,22 @@ describe('Codec', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), right({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), right({ _tag: 'B', b: 1 })) + assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), D.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), D.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'Record')) assert.deepStrictEqual( codec.decode({}), - left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) ) assert.deepStrictEqual( codec.decode({ _tag: 'A', a: 1 }), - left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) }) @@ -559,7 +562,7 @@ describe('Codec', () => { const decoder = sum({}) assert.deepStrictEqual( decoder.decode({}), - left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) ) }) }) @@ -591,22 +594,22 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { - assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), right({ a: 1 })) - assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), right({ a: 1, b: { a: 2 } })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), D.success({ a: 1 })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), D.success({ a: 1, b: { a: 2 } })) }) it('should reject an invalid input', () => { assert.deepStrictEqual( lazyCodec.decode({ a: 1 }), - left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) ) assert.deepStrictEqual( lazyCodec.decode({ a: 'a' }), - left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) ) assert.deepStrictEqual( lazyCodec.decode({ a: '1', b: {} }), - left( + E.left( FS.of( DE.lazy( 'A', diff --git a/test/Decoder.ts b/test/Decoder.ts index e3c45526f..d7bd0ad1c 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -2,20 +2,21 @@ import * as assert from 'assert' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' +import * as _ from '../src/Decoder' import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' -import * as D from '../src/Decoder' +import * as KD from '../src/KleisliDecoder' const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } -const undef: D.Decoder = D.fromGuard(undefinedGuard, 'undefined') +const undef: _.Decoder = _.fromGuard(undefinedGuard, 'undefined') -const NumberFromString: D.Decoder = pipe( - D.string, - D.parse((s) => { +const NumberFromString: _.Decoder = pipe( + _.string, + _.parse((s) => { const n = parseFloat(s) - return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) }) ) @@ -23,18 +24,18 @@ interface PositiveBrand { readonly Positive: unique symbol } type Positive = number & PositiveBrand -const Positive: D.Decoder = pipe( - D.number, - D.refine((n): n is Positive => n > 0, 'Positive') +const Positive: _.Decoder = pipe( + _.number, + _.refine((n): n is Positive => n > 0, 'Positive') ) interface IntBrand { readonly Int: unique symbol } type Int = number & IntBrand -const Int: D.Decoder = pipe( - D.number, - D.refine((n): n is Int => Number.isInteger(n), 'Int') +const Int: _.Decoder = pipe( + _.number, + _.refine((n): n is Int => Number.isInteger(n), 'Int') ) describe('Decoder', () => { @@ -43,14 +44,14 @@ describe('Decoder', () => { // ------------------------------------------------------------------------------------- it('functorDecoder', () => { - const decoder = D.functorDecoder.map(D.string, (s) => s + '!') - assert.deepStrictEqual(decoder.decode('a'), E.right('a!')) + const decoder = _.functorDecoder.map(_.string, (s) => s + '!') + assert.deepStrictEqual(decoder.decode('a'), _.success('a!')) }) it('altDecoder', () => { - const decoder = D.altDecoder.alt(D.string, () => D.number) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - assert.deepStrictEqual(decoder.decode(1), E.right(1)) + const decoder = _.altDecoder.alt(_.string, () => _.number) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) }) // ------------------------------------------------------------------------------------- @@ -58,28 +59,28 @@ describe('Decoder', () => { // ------------------------------------------------------------------------------------- it('string', async () => { - assert.deepStrictEqual(D.string.decode('a'), E.right('a')) - assert.deepStrictEqual(D.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) + assert.deepStrictEqual(_.string.decode('a'), _.success('a')) + assert.deepStrictEqual(_.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) }) it('number', async () => { - assert.deepStrictEqual(D.number.decode(1), E.right(1)) - assert.deepStrictEqual(D.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) + assert.deepStrictEqual(_.number.decode(1), _.success(1)) + assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) }) it('boolean', async () => { - assert.deepStrictEqual(D.boolean.decode(true), E.right(true)) - assert.deepStrictEqual(D.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) + assert.deepStrictEqual(_.boolean.decode(true), _.success(true)) + assert.deepStrictEqual(_.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) }) it('UnknownArray', async () => { - assert.deepStrictEqual(D.UnknownArray.decode([1, 'a']), E.right([1, 'a'])) - assert.deepStrictEqual(D.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) + assert.deepStrictEqual(_.UnknownArray.decode([1, 'a']), _.success([1, 'a'])) + assert.deepStrictEqual(_.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) }) it('UnknownRecord', async () => { - assert.deepStrictEqual(D.UnknownRecord.decode({ a: 1, b: 'b' }), E.right({ a: 1, b: 'b' })) - assert.deepStrictEqual(D.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual(_.UnknownRecord.decode({ a: 1, b: 'b' }), _.success({ a: 1, b: 'b' })) + assert.deepStrictEqual(_.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) }) // ------------------------------------------------------------------------------------- @@ -88,13 +89,13 @@ describe('Decoder', () => { describe('literal', () => { it('should decode a valid input', async () => { - const decoder = D.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - assert.deepStrictEqual(decoder.decode(null), E.right(null)) + const decoder = _.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(null), _.success(null)) }) it('should reject an invalid input', async () => { - const decoder = D.literal('a', null) + const decoder = _.literal('a', null) assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) }) }) @@ -105,21 +106,34 @@ describe('Decoder', () => { it('mapLeftWithInput', () => { const decoder = pipe( - D.number, - D.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) ) assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) }) + it('compose', () => { + interface IntBrand { + readonly Int: unique symbol + } + + type Int = number & IntBrand + + const decoder = pipe(_.number, _.compose(KD.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + assert.deepStrictEqual(decoder.decode('a'), _.failure('a', 'number')) + assert.deepStrictEqual(decoder.decode(1.2), _.failure(1.2, 'IntFromNumber')) + }) + describe('nullable', () => { it('should decode a valid input', () => { - const decoder = D.nullable(NumberFromString) - assert.deepStrictEqual(decoder.decode(null), E.right(null)) - assert.deepStrictEqual(decoder.decode('1'), E.right(1)) + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual(decoder.decode(null), _.success(null)) + assert.deepStrictEqual(decoder.decode('1'), _.success(1)) }) it('should reject an invalid input', () => { - const decoder = D.nullable(NumberFromString) + const decoder = _.nullable(NumberFromString) assert.deepStrictEqual( decoder.decode(undefined), E.left( @@ -143,29 +157,29 @@ describe('Decoder', () => { describe('type', () => { it('should decode a valid input', async () => { - const decoder = D.type({ - a: D.string + const decoder = _.type({ + a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) }) it('should strip additional fields', async () => { - const decoder = D.type({ - a: D.string + const decoder = _.type({ + a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', async () => { - const decoder = D.type({ + const decoder = _.type({ a: undef }) - assert.deepStrictEqual(decoder.decode({}), E.right({ a: undefined })) + assert.deepStrictEqual(decoder.decode({}), _.success({ a: undefined })) }) it('should reject an invalid input', async () => { - const decoder = D.type({ - a: D.string + const decoder = _.type({ + a: _.string }) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( @@ -175,9 +189,9 @@ describe('Decoder', () => { }) it('should collect all errors', async () => { - const decoder = D.type({ - a: D.string, - b: D.number + const decoder = _.type({ + a: _.string, + b: _.number }) assert.deepStrictEqual( decoder.decode({}), @@ -199,35 +213,35 @@ describe('Decoder', () => { return 'b' } } - const decoder = D.type({ a: D.string, b: D.string }) - assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) + const decoder = _.type({ a: _.string, b: _.string }) + assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) }) }) describe('partial', () => { it('should decode a valid input', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), E.right({ a: 'a' })) - assert.deepStrictEqual(decoder.decode({}), E.right({})) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({}), _.success({})) }) it('should strip additional fields', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a' })) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) }) it('should not add missing fields', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({}), E.right({})) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({}), _.success({})) }) it('should not strip fields corresponding to undefined values', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(decoder.decode({ a: undefined }), E.right({ a: undefined })) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: undefined }), _.success({ a: undefined })) }) it('should reject an invalid input', async () => { - const decoder = D.partial({ a: D.string }) + const decoder = _.partial({ a: _.string }) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), @@ -236,9 +250,9 @@ describe('Decoder', () => { }) it('should collect all errors', async () => { - const decoder = D.partial({ - a: D.string, - b: D.number + const decoder = _.partial({ + a: _.string, + b: _.number }) assert.deepStrictEqual( decoder.decode({ a: 1, b: 'b' }), @@ -260,26 +274,26 @@ describe('Decoder', () => { return 'b' } } - const decoder = D.partial({ a: D.string, b: D.string }) - assert.deepStrictEqual(decoder.decode(new A()), E.right({ a: 'a', b: 'b' })) + const decoder = _.partial({ a: _.string, b: _.string }) + assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) }) }) describe('array', () => { it('should decode a valid input', async () => { - const decoder = D.array(D.string) - assert.deepStrictEqual(decoder.decode([]), E.right([])) - assert.deepStrictEqual(decoder.decode(['a']), E.right(['a'])) + const decoder = _.array(_.string) + assert.deepStrictEqual(decoder.decode([]), _.success([])) + assert.deepStrictEqual(decoder.decode(['a']), _.success(['a'])) }) it('should reject an invalid input', async () => { - const decoder = D.array(D.string) + const decoder = _.array(_.string) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) }) it('should collect all errors', async () => { - const decoder = D.array(D.string) + const decoder = _.array(_.string) assert.deepStrictEqual( decoder.decode([1, 2]), E.left( @@ -294,13 +308,13 @@ describe('Decoder', () => { describe('record', () => { it('should decode a valid value', async () => { - const decoder = D.record(D.number) - assert.deepStrictEqual(decoder.decode({}), E.right({})) - assert.deepStrictEqual(decoder.decode({ a: 1 }), E.right({ a: 1 })) + const decoder = _.record(_.number) + assert.deepStrictEqual(decoder.decode({}), _.success({})) + assert.deepStrictEqual(decoder.decode({ a: 1 }), _.success({ a: 1 })) }) it('should reject an invalid value', async () => { - const decoder = D.record(D.number) + const decoder = _.record(_.number) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( decoder.decode({ a: 'a' }), @@ -309,7 +323,7 @@ describe('Decoder', () => { }) it('should collect all errors', async () => { - const decoder = D.record(D.number) + const decoder = _.record(_.number) assert.deepStrictEqual( decoder.decode({ a: 'a', b: 'b' }), E.left( @@ -324,16 +338,16 @@ describe('Decoder', () => { describe('tuple', () => { it('should decode a valid input', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(decoder.decode(['a', 1]), E.right(['a', 1])) + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(['a', 1]), _.success(['a', 1])) }) it('should handle zero components', async () => { - assert.deepStrictEqual(D.tuple().decode([]), E.right([])) + assert.deepStrictEqual(_.tuple().decode([]), _.success([])) }) it('should reject an invalid input', async () => { - const decoder = D.tuple(D.string, D.number) + const decoder = _.tuple(_.string, _.number) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) assert.deepStrictEqual( decoder.decode(['a']), @@ -346,7 +360,7 @@ describe('Decoder', () => { }) it('should collect all errors', async () => { - const decoder = D.tuple(D.string, D.number) + const decoder = _.tuple(_.string, _.number) assert.deepStrictEqual( decoder.decode([1, 'a']), E.left( @@ -359,21 +373,21 @@ describe('Decoder', () => { }) it('should strip additional components', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(decoder.decode(['a', 1, true]), E.right(['a', 1])) + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(['a', 1, true]), _.success(['a', 1])) }) }) describe('union', () => { it('should decode a valid input', () => { - assert.deepStrictEqual(D.union(D.string).decode('a'), E.right('a')) - const decoder = D.union(D.string, D.number) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) - assert.deepStrictEqual(decoder.decode(1), E.right(1)) + assert.deepStrictEqual(_.union(_.string).decode('a'), _.success('a')) + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) }) it('should reject an invalid input', () => { - const decoder = D.union(D.string, D.number) + const decoder = _.union(_.string, _.number) assert.deepStrictEqual( decoder.decode(true), E.left( @@ -389,16 +403,16 @@ describe('Decoder', () => { describe('refine', () => { it('should decode a valid input', () => { const decoder = pipe( - D.string, - D.refine((s): s is string => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(decoder.decode('a'), E.right('a')) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) }) it('should reject an invalid input', () => { const decoder = pipe( - D.string, - D.refine((s): s is string => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') ) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) @@ -407,17 +421,17 @@ describe('Decoder', () => { describe('intersect', () => { it('should decode a valid input', () => { - const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), E.right({ a: 'a', b: 1 })) + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a', b: 1 })) }) it('should handle primitives', () => { - const decoder = pipe(Int, D.intersect(Positive)) - assert.deepStrictEqual(decoder.decode(1), E.right(1)) + const decoder = pipe(Int, _.intersect(Positive)) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) }) it('should accumulate all errors', () => { - const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) assert.deepStrictEqual( decoder.decode({ a: 'a' }), E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -439,19 +453,19 @@ describe('Decoder', () => { }) describe('sum', () => { - const sum = D.sum('_tag') + const sum = _.sum('_tag') it('should decode a valid input', () => { - const A = D.type({ _tag: D.literal('A'), a: D.string }) - const B = D.type({ _tag: D.literal('B'), b: D.number }) + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), E.right({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), E.right({ _tag: 'B', b: 1 })) + assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), _.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), _.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { - const A = D.type({ _tag: D.literal('A'), a: D.string }) - const B = D.type({ _tag: D.literal('B'), b: D.number }) + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) assert.deepStrictEqual( @@ -478,14 +492,14 @@ describe('Decoder', () => { b?: A } - const lazyDecoder: D.Decoder = D.lazy('A', () => - pipe(D.type({ a: NumberFromString }), D.intersect(D.partial({ b: lazyDecoder }))) + const lazyDecoder: _.Decoder = _.lazy('A', () => + pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) ) describe('lazy', () => { it('should decode a valid input', () => { - assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), E.right({ a: 1 })) - assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), E.right({ a: 1, b: { a: 2 } })) + assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), _.success({ a: 1 })) + assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), _.success({ a: 1, b: { a: 2 } })) }) it('should reject an invalid input', () => { @@ -523,14 +537,14 @@ describe('Decoder', () => { describe('draw', () => { it('draw', () => { - const decoder = D.type({ - a: D.string, - b: D.number, - c: D.array(D.boolean), - d: D.nullable(D.string) + const decoder = _.type({ + a: _.string, + b: _.number, + c: _.array(_.boolean), + d: _.nullable(_.string) }) assert.deepStrictEqual( - pipe(decoder.decode({ c: [1] }), E.mapLeft(D.draw)), + pipe(decoder.decode({ c: [1] }), E.mapLeft(_.draw)), E.left(`required property "a" └─ cannot decode undefined, should be string required property "b" @@ -548,7 +562,7 @@ required property "d" it('should support lazy combinators', () => { assert.deepStrictEqual( - pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(D.draw)), + pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(_.draw)), E.left(`lazy type A └─ optional property \"b\" └─ lazy type A @@ -559,7 +573,7 @@ required property "d" }) it('stringify', () => { - assert.deepStrictEqual(D.stringify(D.string.decode('a')), '"a"') - assert.deepStrictEqual(D.stringify(D.string.decode(null)), 'cannot decode null, should be string') + assert.deepStrictEqual(_.stringify(_.string.decode('a')), '"a"') + assert.deepStrictEqual(_.stringify(_.string.decode(null)), 'cannot decode null, should be string') }) }) diff --git a/test/KleisliDecoder.ts b/test/KleisliDecoder.ts new file mode 100644 index 000000000..1720f7d48 --- /dev/null +++ b/test/KleisliDecoder.ts @@ -0,0 +1,16 @@ +import * as assert from 'assert' +import * as _ from '../src/KleisliDecoder' + +interface IntBrand { + readonly Int: unique symbol +} + +type Int = number & IntBrand + +describe('KleisliDecoder', () => { + it('fromRefinement', () => { + const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') + assert.deepStrictEqual(IntFromNumber.decode(1), _.success(1)) + assert.deepStrictEqual(IntFromNumber.decode(1.2), _.failure(1.2, 'IntFromNumber')) + }) +}) diff --git a/test/KleisliTaskDecoder.ts b/test/KleisliTaskDecoder.ts new file mode 100644 index 000000000..49ed96809 --- /dev/null +++ b/test/KleisliTaskDecoder.ts @@ -0,0 +1,17 @@ +import * as assert from 'assert' +import * as KD from '../src/KleisliDecoder' +import * as _ from '../src/KleisliTaskDecoder' + +interface IntBrand { + readonly Int: unique symbol +} + +type Int = number & IntBrand + +describe('KleisliTaskDecoder', () => { + it('fromRefinement', async () => { + const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') + assert.deepStrictEqual(await IntFromNumber.decode(1)(), KD.success(1)) + assert.deepStrictEqual(await IntFromNumber.decode(1.2)(), KD.failure(1.2, 'IntFromNumber')) + }) +}) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 10dd95db9..77500d66f 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -5,18 +5,20 @@ import * as TE from 'fp-ts/lib/TaskEither' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' -import * as D from '../src/TaskDecoder' +import * as KD from '../src/KleisliDecoder' +import * as KTD from '../src/KleisliTaskDecoder' +import * as _ from '../src/TaskDecoder' const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } -const undef: D.TaskDecoder = D.fromGuard(undefinedGuard, 'undefined') +const undef: _.TaskDecoder = _.fromGuard(undefinedGuard, 'undefined') -const NumberFromString: D.TaskDecoder = pipe( - D.string, - D.parse((s) => { +const NumberFromString: _.TaskDecoder = pipe( + _.string, + _.parse((s) => { const n = parseFloat(s) - return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) }) ) @@ -24,18 +26,18 @@ interface PositiveBrand { readonly Positive: unique symbol } type Positive = number & PositiveBrand -const Positive: D.TaskDecoder = pipe( - D.number, - D.refine((n): n is Positive => n > 0, 'Positive') +const Positive: _.TaskDecoder = pipe( + _.number, + _.refine((n): n is Positive => n > 0, 'Positive') ) interface IntBrand { readonly Int: unique symbol } type Int = number & IntBrand -const Int: D.TaskDecoder = pipe( - D.number, - D.refine((n): n is Int => Number.isInteger(n), 'Int') +const Int: _.TaskDecoder = pipe( + _.number, + _.refine((n): n is Int => Number.isInteger(n), 'Int') ) describe('TaskDecoder', () => { @@ -44,14 +46,14 @@ describe('TaskDecoder', () => { // ------------------------------------------------------------------------------------- it('map', async () => { - const decoder = D.functorTaskDecoder.map(D.string, (s) => s + '!') - assert.deepStrictEqual(await decoder.decode('a')(), E.right('a!')) + const decoder = _.functorTaskDecoder.map(_.string, (s) => s + '!') + assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a!')) }) it('alt', async () => { - const decoder = D.altTaskDecoder.alt(D.string, () => D.number) - assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) - assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) + const decoder = _.altTaskDecoder.alt(_.string, () => _.number) + assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) + assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) }) // ------------------------------------------------------------------------------------- @@ -59,31 +61,28 @@ describe('TaskDecoder', () => { // ------------------------------------------------------------------------------------- it('string', async () => { - assert.deepStrictEqual(await D.string.decode('a')(), E.right('a')) - assert.deepStrictEqual(await D.string.decode(null)(), E.left(FS.of(DE.leaf(null, 'string')))) + assert.deepStrictEqual(await _.string.decode('a')(), KD.success('a')) + assert.deepStrictEqual(await _.string.decode(null)(), KD.failure(null, 'string')) }) it('number', async () => { - assert.deepStrictEqual(await D.number.decode(1)(), E.right(1)) - assert.deepStrictEqual(await D.number.decode(null)(), E.left(FS.of(DE.leaf(null, 'number')))) + assert.deepStrictEqual(await _.number.decode(1)(), KD.success(1)) + assert.deepStrictEqual(await _.number.decode(null)(), KD.failure(null, 'number')) }) it('boolean', async () => { - assert.deepStrictEqual(await D.boolean.decode(true)(), E.right(true)) - assert.deepStrictEqual(await D.boolean.decode(null)(), E.left(FS.of(DE.leaf(null, 'boolean')))) + assert.deepStrictEqual(await _.boolean.decode(true)(), KD.success(true)) + assert.deepStrictEqual(await _.boolean.decode(null)(), KD.failure(null, 'boolean')) }) it('UnknownArray', async () => { - assert.deepStrictEqual(await D.UnknownArray.decode([1, 'a'])(), E.right([1, 'a'])) - assert.deepStrictEqual(await D.UnknownArray.decode(null)(), E.left(FS.of(DE.leaf(null, 'Array')))) + assert.deepStrictEqual(await _.UnknownArray.decode([1, 'a'])(), KD.success([1, 'a'])) + assert.deepStrictEqual(await _.UnknownArray.decode(null)(), KD.failure(null, 'Array')) }) it('UnknownRecord', async () => { - assert.deepStrictEqual(await D.UnknownRecord.decode({ a: 1, b: 'b' })(), E.right({ a: 1, b: 'b' })) - assert.deepStrictEqual( - await D.UnknownRecord.decode(null)(), - E.left(FS.of(DE.leaf(null, 'Record'))) - ) + assert.deepStrictEqual(await _.UnknownRecord.decode({ a: 1, b: 'b' })(), KD.success({ a: 1, b: 'b' })) + assert.deepStrictEqual(await _.UnknownRecord.decode(null)(), KD.failure(null, 'Record')) }) // ------------------------------------------------------------------------------------- @@ -91,21 +90,21 @@ describe('TaskDecoder', () => { // ------------------------------------------------------------------------------------- it('fromGuard', async () => { - const decoder = D.fromGuard(G.string, 'string') - assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) - assert.deepStrictEqual(await decoder.decode(null)(), E.left(FS.of(DE.leaf(null, 'string')))) + const decoder = _.fromGuard(G.string, 'string') + assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) + assert.deepStrictEqual(await decoder.decode(null)(), KD.failure(null, 'string')) }) describe('literal', () => { it('should decode a valid input', async () => { - const decoder = D.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) - assert.deepStrictEqual(await decoder.decode(null)(), E.right(null)) + const decoder = _.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) + assert.deepStrictEqual(await decoder.decode(null)(), KD.success(null)) }) it('should reject an invalid input', async () => { - const decoder = D.literal('a', null) - assert.deepStrictEqual(await decoder.decode('b')(), E.left(FS.of(DE.leaf('b', '"a" | null')))) + const decoder = _.literal('a', null) + assert.deepStrictEqual(await decoder.decode('b')(), KD.failure('b', '"a" | null')) }) }) @@ -115,21 +114,34 @@ describe('TaskDecoder', () => { it('mapLeftWithInput', async () => { const decoder = pipe( - D.number, - D.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) ) - assert.deepStrictEqual(await decoder.decode('a')(), E.left(FS.of(DE.leaf('a', 'not a number')))) + assert.deepStrictEqual(await decoder.decode('a')(), KD.failure('a', 'not a number')) + }) + + it('compose', async () => { + interface IntBrand { + readonly Int: unique symbol + } + + type Int = number & IntBrand + + const decoder = pipe(_.number, _.compose(KTD.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) + assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) + assert.deepStrictEqual(await decoder.decode('a')(), KD.failure('a', 'number')) + assert.deepStrictEqual(await decoder.decode(1.2)(), KD.failure(1.2, 'IntFromNumber')) }) describe('nullable', () => { it('should decode a valid input', async () => { - const decoder = D.nullable(NumberFromString) - assert.deepStrictEqual(await decoder.decode(null)(), E.right(null)) - assert.deepStrictEqual(await decoder.decode('1')(), E.right(1)) + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual(await decoder.decode(null)(), KD.success(null)) + assert.deepStrictEqual(await decoder.decode('1')(), KD.success(1)) }) it('should reject an invalid input', async () => { - const decoder = D.nullable(NumberFromString) + const decoder = _.nullable(NumberFromString) assert.deepStrictEqual( await decoder.decode(undefined)(), E.left( @@ -153,34 +165,31 @@ describe('TaskDecoder', () => { describe('type', () => { it('should decode a valid input', async () => { - const decoder = D.type({ - a: D.string + const decoder = _.type({ + a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), E.right({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), KD.success({ a: 'a' })) }) it('should strip additional fields', async () => { - const decoder = D.type({ - a: D.string + const decoder = _.type({ + a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), KD.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', async () => { - const decoder = D.type({ + const decoder = _.type({ a: undef }) - assert.deepStrictEqual(await decoder.decode({})(), E.right({ a: undefined })) + assert.deepStrictEqual(await decoder.decode({})(), KD.success({ a: undefined })) }) it('should reject an invalid input', async () => { - const decoder = D.type({ - a: D.string + const decoder = _.type({ + a: _.string }) - assert.deepStrictEqual( - await decoder.decode(undefined)(), - E.left(FS.of(DE.leaf(undefined, 'Record'))) - ) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Record')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -188,9 +197,9 @@ describe('TaskDecoder', () => { }) it('should collect all errors', async () => { - const decoder = D.type({ - a: D.string, - b: D.number + const decoder = _.type({ + a: _.string, + b: _.number }) assert.deepStrictEqual( await decoder.decode({})(), @@ -212,39 +221,36 @@ describe('TaskDecoder', () => { return 'b' } } - const decoder = D.type({ a: D.string, b: D.string }) - assert.deepStrictEqual(await decoder.decode(new A())(), E.right({ a: 'a', b: 'b' })) + const decoder = _.type({ a: _.string, b: _.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), KD.success({ a: 'a', b: 'b' })) }) }) describe('partial', () => { it('should decode a valid input', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), E.right({ a: 'a' })) - assert.deepStrictEqual(await decoder.decode({})(), E.right({})) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), KD.success({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({})(), KD.success({})) }) it('should strip additional fields', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), E.right({ a: 'a' })) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), KD.success({ a: 'a' })) }) it('should not add missing fields', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(await decoder.decode({})(), E.right({})) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({})(), KD.success({})) }) it('should not strip fields corresponding to undefined values', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual(await decoder.decode({ a: undefined })(), E.right({ a: undefined })) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: undefined })(), KD.success({ a: undefined })) }) it('should reject an invalid input', async () => { - const decoder = D.partial({ a: D.string }) - assert.deepStrictEqual( - await decoder.decode(undefined)(), - E.left(FS.of(DE.leaf(undefined, 'Record'))) - ) + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Record')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -252,9 +258,9 @@ describe('TaskDecoder', () => { }) it('should collect all errors', async () => { - const decoder = D.partial({ - a: D.string, - b: D.number + const decoder = _.partial({ + a: _.string, + b: _.number }) assert.deepStrictEqual( await decoder.decode({ a: 1, b: 'b' })(), @@ -276,21 +282,21 @@ describe('TaskDecoder', () => { return 'b' } } - const decoder = D.partial({ a: D.string, b: D.string }) - assert.deepStrictEqual(await decoder.decode(new A())(), E.right({ a: 'a', b: 'b' })) + const decoder = _.partial({ a: _.string, b: _.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), KD.success({ a: 'a', b: 'b' })) }) }) describe('array', () => { it('should decode a valid input', async () => { - const decoder = D.array(D.string) - assert.deepStrictEqual(await decoder.decode([])(), E.right([])) - assert.deepStrictEqual(await decoder.decode(['a'])(), E.right(['a'])) + const decoder = _.array(_.string) + assert.deepStrictEqual(await decoder.decode([])(), KD.success([])) + assert.deepStrictEqual(await decoder.decode(['a'])(), KD.success(['a'])) }) it('should reject an invalid input', async () => { - const decoder = D.array(D.string) - assert.deepStrictEqual(await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) + const decoder = _.array(_.string) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Array')) assert.deepStrictEqual( await decoder.decode([1])(), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -298,7 +304,7 @@ describe('TaskDecoder', () => { }) it('should collect all errors', async () => { - const decoder = D.array(D.string) + const decoder = _.array(_.string) assert.deepStrictEqual( await decoder.decode([1, 2])(), E.left( @@ -313,17 +319,14 @@ describe('TaskDecoder', () => { describe('record', () => { it('should decode a valid value', async () => { - const decoder = D.record(D.number) - assert.deepStrictEqual(await decoder.decode({})(), E.right({})) - assert.deepStrictEqual(await decoder.decode({ a: 1 })(), E.right({ a: 1 })) + const decoder = _.record(_.number) + assert.deepStrictEqual(await decoder.decode({})(), KD.success({})) + assert.deepStrictEqual(await decoder.decode({ a: 1 })(), KD.success({ a: 1 })) }) it('should reject an invalid value', async () => { - const decoder = D.record(D.number) - assert.deepStrictEqual( - await decoder.decode(undefined)(), - E.left(FS.of(DE.leaf(undefined, 'Record'))) - ) + const decoder = _.record(_.number) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Record')) assert.deepStrictEqual( await decoder.decode({ a: 'a' })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) @@ -331,7 +334,7 @@ describe('TaskDecoder', () => { }) it('should collect all errors', async () => { - const decoder = D.record(D.number) + const decoder = _.record(_.number) assert.deepStrictEqual( await decoder.decode({ a: 'a', b: 'b' })(), E.left( @@ -346,17 +349,17 @@ describe('TaskDecoder', () => { describe('tuple', () => { it('should decode a valid input', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(await decoder.decode(['a', 1])(), E.right(['a', 1])) + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(['a', 1])(), KD.success(['a', 1])) }) it('should handle zero components', async () => { - assert.deepStrictEqual(await D.tuple().decode([])(), E.right([])) + assert.deepStrictEqual(await _.tuple().decode([])(), KD.success([])) }) it('should reject an invalid input', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'Array')))) + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Array')) assert.deepStrictEqual( await decoder.decode(['a'])(), E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -368,7 +371,7 @@ describe('TaskDecoder', () => { }) it('should collect all errors', async () => { - const decoder = D.tuple(D.string, D.number) + const decoder = _.tuple(_.string, _.number) assert.deepStrictEqual( await decoder.decode([1, 'a'])(), E.left( @@ -381,21 +384,21 @@ describe('TaskDecoder', () => { }) it('should strip additional components', async () => { - const decoder = D.tuple(D.string, D.number) - assert.deepStrictEqual(await decoder.decode(['a', 1, true])(), E.right(['a', 1])) + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(['a', 1, true])(), KD.success(['a', 1])) }) }) describe('union', () => { it('should decode a valid input', async () => { - assert.deepStrictEqual(await D.union(D.string).decode('a')(), E.right('a')) - const decoder = D.union(D.string, D.number) - assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) - assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) + assert.deepStrictEqual(await _.union(_.string).decode('a')(), KD.success('a')) + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) + assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) }) it('should reject an invalid input', async () => { - const decoder = D.union(D.string, D.number) + const decoder = _.union(_.string, _.number) assert.deepStrictEqual( await decoder.decode(true)(), E.left( @@ -411,35 +414,35 @@ describe('TaskDecoder', () => { describe('refine', () => { it('should decode a valid input', async () => { const decoder = pipe( - D.string, - D.refine((s): s is string => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(await decoder.decode('a')(), E.right('a')) + assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) }) it('should reject an invalid input', async () => { const decoder = pipe( - D.string, - D.refine((s): s is string => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(await decoder.decode(undefined)(), E.left(FS.of(DE.leaf(undefined, 'string')))) - assert.deepStrictEqual(await decoder.decode('')(), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'string')) + assert.deepStrictEqual(await decoder.decode('')(), KD.failure('', 'NonEmptyString')) }) }) describe('intersect', () => { it('should decode a valid input', async () => { - const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), E.right({ a: 'a', b: 1 })) + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), KD.success({ a: 'a', b: 1 })) }) it('should handle primitives', async () => { - const decoder = pipe(Int, D.intersect(Positive)) - assert.deepStrictEqual(await decoder.decode(1)(), E.right(1)) + const decoder = pipe(Int, _.intersect(Positive)) + assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) }) it('should accumulate all errors', async () => { - const decoder = pipe(D.type({ a: D.string }), D.intersect(D.type({ b: D.number }))) + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) assert.deepStrictEqual( await decoder.decode({ a: 'a' })(), E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -461,21 +464,21 @@ describe('TaskDecoder', () => { }) describe('sum', () => { - const sum = D.sum('_tag') + const sum = _.sum('_tag') it('should decode a valid input', async () => { - const A = D.type({ _tag: D.literal('A'), a: D.string }) - const B = D.type({ _tag: D.literal('B'), b: D.number }) + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), E.right({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), E.right({ _tag: 'B', b: 1 })) + assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), KD.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), KD.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', async () => { - const A = D.type({ _tag: D.literal('A'), a: D.string }) - const B = D.type({ _tag: D.literal('B'), b: D.number }) + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode(null)(), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual(await decoder.decode(null)(), KD.failure(null, 'Record')) assert.deepStrictEqual( await decoder.decode({})(), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) @@ -500,14 +503,14 @@ describe('TaskDecoder', () => { b?: A } - const lazyDecoder: D.TaskDecoder = D.lazy('A', () => - pipe(D.type({ a: NumberFromString }), D.intersect(D.partial({ b: lazyDecoder }))) + const lazyDecoder: _.TaskDecoder = _.lazy('A', () => + pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) ) describe('lazy', () => { it('should decode a valid input', async () => { - assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), E.right({ a: 1 })) - assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), E.right({ a: 1, b: { a: 2 } })) + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), KD.success({ a: 1 })) + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), KD.success({ a: 1, b: { a: 2 } })) }) it('should reject an invalid input', async () => { @@ -545,14 +548,14 @@ describe('TaskDecoder', () => { describe('draw', () => { it('draw', async () => { - const decoder = D.type({ - a: D.string, - b: D.number, - c: D.array(D.boolean), - d: D.nullable(D.string) + const decoder = _.type({ + a: _.string, + b: _.number, + c: _.array(_.boolean), + d: _.nullable(_.string) }) assert.deepStrictEqual( - await pipe(decoder.decode({ c: [1] }), TE.mapLeft(D.draw))(), + await pipe(decoder.decode({ c: [1] }), TE.mapLeft(_.draw))(), E.left(`required property "a" └─ cannot decode undefined, should be string required property "b" @@ -570,7 +573,7 @@ required property "d" it('should support lazy combinators', async () => { assert.deepStrictEqual( - await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(D.draw))(), + await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(_.draw))(), E.left(`lazy type A └─ optional property \"b\" └─ lazy type A @@ -581,7 +584,7 @@ required property "d" }) it('stringify', async () => { - assert.deepStrictEqual(await D.stringify(D.string.decode('a'))(), '"a"') - assert.deepStrictEqual(await D.stringify(D.string.decode(null))(), 'cannot decode null, should be string') + assert.deepStrictEqual(await _.stringify(_.string.decode('a'))(), '"a"') + assert.deepStrictEqual(await _.stringify(_.string.decode(null))(), 'cannot decode null, should be string') }) }) From ba38a9e738cf15a2a3f01cf7b35fee7a455d1a1d Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 12:54:21 +0200 Subject: [PATCH 087/222] use Encode type-level tricks --- docs/modules/Encoder.ts.md | 2 +- docs/modules/Kleisli.ts.md | 49 +++++++++++++++++++------- docs/modules/KleisliDecoder.ts.md | 44 +++++++++++++++-------- docs/modules/KleisliTaskDecoder.ts.md | 50 +++++++++++++++++++-------- dtslint/ts3.5/Kleisli.ts | 48 +++++++++++++++++++++++++ dtslint/ts3.5/KleisliDecoder.ts | 38 ++++++++++++++++++++ dtslint/ts3.5/KleisliTaskDecoder.ts | 38 ++++++++++++++++++++ src/Decoder.ts | 8 ++--- src/Encoder.ts | 4 ++- src/Kleisli.ts | 34 +++++++++++------- src/KleisliDecoder.ts | 36 +++++++++++-------- src/KleisliTaskDecoder.ts | 36 +++++++++++-------- src/TaskDecoder.ts | 8 ++--- 13 files changed, 301 insertions(+), 94 deletions(-) create mode 100644 dtslint/ts3.5/Kleisli.ts create mode 100644 dtslint/ts3.5/KleisliDecoder.ts create mode 100644 dtslint/ts3.5/KleisliTaskDecoder.ts diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index df97a1309..56862667a 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -136,7 +136,7 @@ Added in v2.2.3 ```ts export declare function sum( tag: T -): >>(members: M) => Encoder, TypeOf> +): >>(members: MS) => Encoder, TypeOf> ``` Added in v2.2.3 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 1b18893e2..6f06f333d 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -34,6 +34,9 @@ Added in v2.2.7 - [literal](#literal) - [model](#model) - [Kleisli (interface)](#kleisli-interface) +- [utils](#utils) + - [InputOf (type alias)](#inputof-type-alias) + - [TypeOf (type alias)](#typeof-type-alias) --- @@ -149,9 +152,9 @@ export declare function partial( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> +) =>

>>( + properties: P +) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> ``` Added in v2.2.7 @@ -208,9 +211,9 @@ export declare const sum: E ) => ( tag: T -) => , A>( - members: { [K in keyof A]: Kleisli } -) => Kleisli +) => >>( + members: MS +) => Kleisli, E, TypeOf> ``` Added in v2.2.7 @@ -224,9 +227,9 @@ export declare function tuple( M: Applicative2C & Bifunctor2 ): ( onIndexError: (index: number, e: E) => E -) => >( - ...components: { [K in keyof A]: Kleisli } -) => Kleisli, E, A> +) => >>( + ...components: C +) => Kleisli }, E, { [K in keyof C]: TypeOf }> ``` Added in v2.2.7 @@ -240,9 +243,9 @@ export declare function type( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, { [K in keyof A]: A[K] }> +) =>

>>( + properties: P +) => Kleisli }, E, { [K in keyof P]: TypeOf }> ``` Added in v2.2.7 @@ -307,3 +310,25 @@ export interface Kleisli { ``` Added in v2.2.7 + +# utils + +## InputOf (type alias) + +**Signature** + +```ts +export type InputOf = KD extends Kleisli ? I : never +``` + +Added in v2.2.7 + +## TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = KD extends Kleisli ? A : never +``` + +Added in v2.2.7 diff --git a/docs/modules/KleisliDecoder.ts.md b/docs/modules/KleisliDecoder.ts.md index 281721724..65912252f 100644 --- a/docs/modules/KleisliDecoder.ts.md +++ b/docs/modules/KleisliDecoder.ts.md @@ -42,6 +42,7 @@ Added in v2.2.7 - [model](#model) - [KleisliDecoder (interface)](#kleislidecoder-interface) - [utils](#utils) + - [InputOf (type alias)](#inputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) --- @@ -200,9 +201,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: KleisliDecoder } -) => KleisliDecoder, Partial<{ [K in keyof A]: A[K] }>> +export declare const partial:

>>( + properties: P +) => KleisliDecoder< + { [K in keyof P]: K.InputOf<'Either', P[K]> }, + Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }> +> ``` Added in v2.2.7 @@ -239,9 +243,9 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => , A>( - members: { [K in keyof A]: KleisliDecoder } -) => KleisliDecoder +) => >>( + members: MS +) => KleisliDecoder, K.TypeOf<'Either', MS[keyof MS]>> ``` Added in v2.2.7 @@ -251,9 +255,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const tuple: ( - ...components: { [K in keyof A]: KleisliDecoder } -) => KleisliDecoder +export declare const tuple: []>( + ...components: C +) => KleisliDecoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> ``` Added in v2.2.7 @@ -263,9 +267,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: KleisliDecoder } -) => KleisliDecoder, { [K in keyof A]: A[K] }> +export declare const type:

>>( + properties: P +) => KleisliDecoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> ``` Added in v2.2.7 @@ -302,9 +306,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: ( +export declare const literal: ( ...values: A -) => KleisliDecoder +) => KleisliDecoder ``` Added in v2.2.7 @@ -325,12 +329,22 @@ Added in v2.2.7 # utils +## InputOf (type alias) + +**Signature** + +```ts +export type InputOf = K.InputOf +``` + +Added in v2.2.7 + ## TypeOf (type alias) **Signature** ```ts -export type TypeOf = KD extends KleisliDecoder ? A : never +export type TypeOf = K.TypeOf ``` Added in v2.2.7 diff --git a/docs/modules/KleisliTaskDecoder.ts.md b/docs/modules/KleisliTaskDecoder.ts.md index c5b796163..0b3500150 100644 --- a/docs/modules/KleisliTaskDecoder.ts.md +++ b/docs/modules/KleisliTaskDecoder.ts.md @@ -43,6 +43,7 @@ Added in v2.2.7 - [model](#model) - [KleisliTaskDecoder (interface)](#kleislitaskdecoder-interface) - [utils](#utils) + - [InputOf (type alias)](#inputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) --- @@ -203,9 +204,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: KleisliTaskDecoder } -) => KleisliTaskDecoder, Partial<{ [K in keyof A]: A[K] }>> +export declare const partial:

>>( + properties: P +) => KleisliTaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +> ``` Added in v2.2.7 @@ -242,9 +246,9 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => , A>( - members: { [K in keyof A]: KleisliTaskDecoder } -) => KleisliTaskDecoder +) => >>( + members: MS +) => KleisliTaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.7 @@ -254,9 +258,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const tuple: ( - ...components: { [K in keyof A]: KleisliTaskDecoder } -) => KleisliTaskDecoder +export declare const tuple: []>( + ...components: C +) => KleisliTaskDecoder< + { [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, + { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> } +> ``` Added in v2.2.7 @@ -266,9 +273,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: KleisliTaskDecoder } -) => KleisliTaskDecoder, { [K in keyof A]: A[K] }> +export declare const type:

>>( + properties: P +) => KleisliTaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> } +> ``` Added in v2.2.7 @@ -315,9 +325,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: ( +export declare const literal: ( ...values: A -) => KleisliTaskDecoder +) => KleisliTaskDecoder ``` Added in v2.2.7 @@ -338,12 +348,22 @@ Added in v2.2.7 # utils +## InputOf (type alias) + +**Signature** + +```ts +export type InputOf = K.InputOf +``` + +Added in v2.2.7 + ## TypeOf (type alias) **Signature** ```ts -export type TypeOf = KTD extends KleisliTaskDecoder ? A : never +export type TypeOf = K.TypeOf ``` Added in v2.2.7 diff --git a/dtslint/ts3.5/Kleisli.ts b/dtslint/ts3.5/Kleisli.ts new file mode 100644 index 000000000..714149a94 --- /dev/null +++ b/dtslint/ts3.5/Kleisli.ts @@ -0,0 +1,48 @@ +import * as _ from '../../src/Kleisli' +import * as E from 'fp-ts/lib/Either' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import { Alt2C } from 'fp-ts/lib/Alt' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' + +declare const M: MonadThrow2C & Bifunctor2 & Alt2C +declare const NumberFromString: _.Kleisli + +// +// type +// + +const type = _.type(M)((_, e) => e) + +// $ExpectType Kleisli<"Either", { a: string; }, string, { a: number; }> +type({ + a: NumberFromString +}) + +// +// partial +// + +// $ExpectType Kleisli<"Either", { a: string; }, string, Partial<{ a: number; }>> +_.partial(M)((_, e) => e)({ + a: NumberFromString +}) + +// +// tuple +// + +// $ExpectType Kleisli<"Either", [string], string, [number]> +_.tuple(M)((_, e) => e)(NumberFromString) + +// +// sum +// + +declare const literalA: _.Kleisli +declare const literalB: _.Kleisli + +// $ExpectType Kleisli<"Either", { _tag: unknown; a: string; } | { _tag: unknown; b: string; }, string, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> +_.sum(M)(() => 'error')('_tag')({ + A: type({ _tag: literalA, a: NumberFromString }), + B: type({ _tag: literalB, b: NumberFromString }) +}) diff --git a/dtslint/ts3.5/KleisliDecoder.ts b/dtslint/ts3.5/KleisliDecoder.ts new file mode 100644 index 000000000..3cab454ee --- /dev/null +++ b/dtslint/ts3.5/KleisliDecoder.ts @@ -0,0 +1,38 @@ +import * as _ from '../../src/KleisliDecoder' + +declare const NumberFromString: _.KleisliDecoder + +// +// type +// + +// $ExpectType KleisliDecoder<{ a: string; }, { a: number; }> +_.type({ + a: NumberFromString +}) + +// +// partial +// + +// $ExpectType KleisliDecoder<{ a: string; }, Partial<{ a: number; }>> +_.partial({ + a: NumberFromString +}) + +// +// tuple +// + +// $ExpectType KleisliDecoder<[string], [number]> +_.tuple(NumberFromString) + +// +// sum +// + +// $ExpectType KleisliDecoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: NumberFromString }), + B: _.type({ _tag: _.literal('B'), b: NumberFromString }) +}) diff --git a/dtslint/ts3.5/KleisliTaskDecoder.ts b/dtslint/ts3.5/KleisliTaskDecoder.ts new file mode 100644 index 000000000..66bff66d4 --- /dev/null +++ b/dtslint/ts3.5/KleisliTaskDecoder.ts @@ -0,0 +1,38 @@ +import * as _ from '../../src/KleisliTaskDecoder' + +declare const NumberFromString: _.KleisliTaskDecoder + +// +// type +// + +// $ExpectType KleisliTaskDecoder<{ a: string; }, { a: number; }> +_.type({ + a: NumberFromString +}) + +// +// partial +// + +// $ExpectType KleisliTaskDecoder<{ a: string; }, Partial<{ a: number; }>> +_.partial({ + a: NumberFromString +}) + +// +// tuple +// + +// $ExpectType KleisliTaskDecoder<[string], [number]> +_.tuple(NumberFromString) + +// +// sum +// + +// $ExpectType KleisliTaskDecoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: NumberFromString }), + B: _.type({ _tag: _.literal('B'), b: NumberFromString }) +}) diff --git a/src/Decoder.ts b/src/Decoder.ts index 719c198a2..bff75c53d 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -147,14 +147,14 @@ export const nullable: (or: Decoder) => Decoder = KD.nullable * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> => - pipe(UnknownRecord, compose(KD.type(properties))) + pipe(UnknownRecord as any, compose(KD.type(properties))) /** * @category combinators * @since 2.2.7 */ export const partial = (properties: { [K in keyof A]: Decoder }): Decoder> => - pipe(UnknownRecord, compose(KD.partial(properties))) + pipe(UnknownRecord as any, compose(KD.partial(properties))) /** * @category combinators @@ -174,7 +174,7 @@ export const record = (codomain: Decoder): Decoder> => * @since 2.2.7 */ export const tuple = >(...components: { [K in keyof A]: Decoder }): Decoder => - pipe(UnknownArray, compose(KD.tuple(...(components as any)))) + pipe(UnknownArray as any, compose(KD.tuple(...components))) as any /** * @category combinators @@ -195,7 +195,7 @@ export const intersect: (right: Decoder) => (left: Decoder) => Decod * @since 2.2.7 */ export const sum = (tag: T) => (members: { [K in keyof A]: Decoder }): Decoder => - pipe(UnknownRecord, compose(KD.sum(tag)(members))) + pipe(UnknownRecord as any, compose(KD.sum(tag)(members))) /** * @category combinators diff --git a/src/Encoder.ts b/src/Encoder.ts index e52f16a2e..c64cebad1 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -139,7 +139,9 @@ export const intersect = (right: Encoder) => (left: Encoder( tag: T -): >>(members: M) => Encoder, TypeOf> { +): >>( + members: MS +) => Encoder, TypeOf> { return (members) => { return { encode: (a) => members[a[tag]].encode(a) diff --git a/src/Kleisli.ts b/src/Kleisli.ts index fce5c3da6..bd65add0a 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -99,6 +99,16 @@ export const nullable = (M: Applicative2C & Bifunctor2 ) }) +/** + * @since 2.2.7 + */ +export type TypeOf = KD extends Kleisli ? A : never + +/** + * @since 2.2.7 + */ +export type InputOf = KD extends Kleisli ? I : never + /** * @category combinators * @since 2.2.7 @@ -107,9 +117,9 @@ export function type( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, { [K in keyof A]: A[K] }> { +) =>

>>( + properties: P +) => Kleisli }, E, { [K in keyof P]: TypeOf }> { const traverse = traverseRecordWithIndex(M) return (onKeyError) => (properties) => ({ decode: (i) => @@ -127,9 +137,9 @@ export function partial( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => Kleisli, E, Partial<{ [K in keyof A]: A[K] }>> { +) =>

>>( + properties: P +) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> { const traverse = traverseRecordWithIndex(M) const undefinedProperty = M.of>(E.right(undefined)) const skipProperty = M.of>(E.left(undefined)) @@ -194,9 +204,9 @@ export function tuple( M: Applicative2C & Bifunctor2 ): ( onIndexError: (index: number, e: E) => E -) => >( - ...components: { [K in keyof A]: Kleisli } -) => Kleisli, E, A> { +) => >>( + ...components: C +) => Kleisli }, E, { [K in keyof C]: TypeOf }> { const traverse = traverseArrayWithIndex(M) return (onIndexError) => (...components) => ({ decode: (is) => @@ -246,9 +256,9 @@ export const sum = (M: MonadThrow2C) => ( onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E ) => ( tag: T -): (, A>( - members: { [K in keyof A]: Kleisli } -) => Kleisli) => { +): (>>( + members: MS +) => Kleisli, E, TypeOf>) => { return , A>( members: { [K in keyof A]: Kleisli } ): Kleisli => { diff --git a/src/KleisliDecoder.ts b/src/KleisliDecoder.ts index ffd68a3a6..143a2262e 100644 --- a/src/KleisliDecoder.ts +++ b/src/KleisliDecoder.ts @@ -72,9 +72,9 @@ export const fromRefinement = (refinement: Refinement, exp * @category constructors * @since 2.2.7 */ -export const literal: ]>( +export const literal: ]>( ...values: A -) => KleisliDecoder = +) => KleisliDecoder = /*#__PURE__*/ K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) @@ -123,18 +123,18 @@ export const nullable: (or: KleisliDecoder) => KleisliDecoder( - properties: { [K in keyof A]: KleisliDecoder } -): KleisliDecoder, { [K in keyof A]: A[K] }> => +export const type =

>>( + properties: P +): KleisliDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators * @since 2.2.7 */ -export const partial = ( - properties: { [K in keyof A]: KleisliDecoder } -): KleisliDecoder, Partial<{ [K in keyof A]: A[K] }>> => +export const partial =

>>( + properties: P +): KleisliDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** @@ -155,9 +155,10 @@ export const record = (codomain: KleisliDecoder): KleisliDecoder>( - ...components: { [K in keyof A]: KleisliDecoder } -): KleisliDecoder, A> => K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any)) +export const tuple = >>( + ...components: C +): KleisliDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => + K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators @@ -183,9 +184,9 @@ export const intersect: ( * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => , A>( - members: { [K in keyof A]: KleisliDecoder } -): KleisliDecoder => +export const sum = (tag: T) => >>( + members: MS +): KleisliDecoder, TypeOf> => K.sum(M)((tag, value, keys) => FS.of( DE.key( @@ -238,4 +239,9 @@ export const alt: (that: () => KleisliDecoder) => (me: KleisliDecode /** * @since 2.2.7 */ -export type TypeOf = KD extends KleisliDecoder ? A : never +export type TypeOf = K.TypeOf + +/** + * @since 2.2.7 + */ +export type InputOf = K.InputOf diff --git a/src/KleisliTaskDecoder.ts b/src/KleisliTaskDecoder.ts index b4c024540..77da48cfc 100644 --- a/src/KleisliTaskDecoder.ts +++ b/src/KleisliTaskDecoder.ts @@ -83,9 +83,9 @@ export const fromRefinement = ( * @category constructors * @since 2.2.7 */ -export const literal: ]>( +export const literal: ]>( ...values: A -) => KleisliTaskDecoder = +) => KleisliTaskDecoder = /*#__PURE__*/ K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) @@ -134,18 +134,18 @@ export const nullable: (or: KleisliTaskDecoder) => KleisliTaskDecode * @category combinators * @since 2.2.7 */ -export const type = ( - properties: { [K in keyof A]: KleisliTaskDecoder } -): KleisliTaskDecoder, { [K in keyof A]: A[K] }> => +export const type =

>>( + properties: P +): KleisliTaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators * @since 2.2.7 */ -export const partial = ( - properties: { [K in keyof A]: KleisliTaskDecoder } -): KleisliTaskDecoder, Partial<{ [K in keyof A]: A[K] }>> => +export const partial =

>>( + properties: P +): KleisliTaskDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** @@ -168,9 +168,10 @@ export const record = ( * @category combinators * @since 2.2.7 */ -export const tuple = >( - ...components: { [K in keyof A]: KleisliTaskDecoder } -): KleisliTaskDecoder, A> => K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...(components as any)) +export const tuple = >>( + ...components: C +): KleisliTaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => + K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators @@ -196,9 +197,9 @@ export const intersect: ( * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => , A>( - members: { [K in keyof A]: KleisliTaskDecoder } -): KleisliTaskDecoder => +export const sum = (tag: T) => >>( + members: MS +): KleisliTaskDecoder, TypeOf> => K.sum(M)((tag, value, keys) => FS.of( DE.key( @@ -254,4 +255,9 @@ export const alt: ( /** * @since 2.2.7 */ -export type TypeOf = KTD extends KleisliTaskDecoder ? A : never +export type TypeOf = K.TypeOf + +/** + * @since 2.2.7 + */ +export type InputOf = K.InputOf diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 176129036..0ba139cc4 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -157,7 +157,7 @@ export const nullable: (or: TaskDecoder) => TaskDecoder = KTD.nu * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder<{ [K in keyof A]: A[K] }> => - pipe(UnknownRecord, compose(KTD.type(properties))) + pipe(UnknownRecord as any, compose(KTD.type(properties))) /** * @category combinators @@ -165,7 +165,7 @@ export const type = (properties: { [K in keyof A]: TaskDecoder }): Task */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(UnknownRecord, compose(KTD.partial(properties))) +): TaskDecoder> => pipe(UnknownRecord as any, compose(KTD.partial(properties))) /** * @category combinators @@ -186,7 +186,7 @@ export const record = (codomain: TaskDecoder): TaskDecoder>( ...components: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownArray, compose(KTD.tuple(...(components as any)))) +): TaskDecoder => pipe(UnknownArray as any, compose(KTD.tuple(...components))) as any /** * @category combinators @@ -208,7 +208,7 @@ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) */ export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord, compose(KTD.sum(tag)(members))) +): TaskDecoder => pipe(UnknownRecord as any, compose(KTD.sum(tag)(members))) /** * @category combinators From a94a8f84d97769ec5840443711109bb2b96e146b Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 13:07:05 +0200 Subject: [PATCH 088/222] remove `as any` from KleisliDecoder and KleisliTaskDecoder --- docs/modules/Kleisli.ts.md | 6 +++--- docs/modules/KleisliDecoder.ts.md | 6 +++--- docs/modules/KleisliTaskDecoder.ts.md | 6 +++--- dtslint/ts3.5/Kleisli.ts | 8 ++++++++ dtslint/ts3.5/KleisliDecoder.ts | 8 ++++++++ dtslint/ts3.5/KleisliTaskDecoder.ts | 8 ++++++++ src/Kleisli.ts | 8 ++++---- src/KleisliDecoder.ts | 8 ++++---- src/KleisliTaskDecoder.ts | 8 ++++---- 9 files changed, 45 insertions(+), 21 deletions(-) diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 6f06f333d..25daa52d3 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -259,9 +259,9 @@ export declare const union: & Bifunctor2 ) => ( onMemberError: (index: number, e: E) => E -) => ( - ...members: { [K in keyof A]: Kleisli } -) => Kleisli +) => , ...Kleisli[]]>( + ...members: MS +) => Kleisli, E, TypeOf> ``` Added in v2.2.7 diff --git a/docs/modules/KleisliDecoder.ts.md b/docs/modules/KleisliDecoder.ts.md index 65912252f..d3e81a124 100644 --- a/docs/modules/KleisliDecoder.ts.md +++ b/docs/modules/KleisliDecoder.ts.md @@ -279,9 +279,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const union: ( - ...members: { [K in keyof A]: KleisliDecoder } -) => KleisliDecoder +export declare const union: , ...KleisliDecoder[]]>( + ...members: MS +) => KleisliDecoder, K.TypeOf<'Either', MS[keyof MS]>> ``` Added in v2.2.7 diff --git a/docs/modules/KleisliTaskDecoder.ts.md b/docs/modules/KleisliTaskDecoder.ts.md index 0b3500150..58ea7eedf 100644 --- a/docs/modules/KleisliTaskDecoder.ts.md +++ b/docs/modules/KleisliTaskDecoder.ts.md @@ -288,9 +288,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const union: ( - ...members: { [K in keyof A]: KleisliTaskDecoder } -) => KleisliTaskDecoder +export declare const union: , ...KleisliTaskDecoder[]]>( + ...members: MS +) => KleisliTaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.7 diff --git a/dtslint/ts3.5/Kleisli.ts b/dtslint/ts3.5/Kleisli.ts index 714149a94..25a455d68 100644 --- a/dtslint/ts3.5/Kleisli.ts +++ b/dtslint/ts3.5/Kleisli.ts @@ -5,6 +5,7 @@ import { Alt2C } from 'fp-ts/lib/Alt' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' declare const M: MonadThrow2C & Bifunctor2 & Alt2C +declare const string: _.Kleisli declare const NumberFromString: _.Kleisli // @@ -46,3 +47,10 @@ _.sum(M)(() => 'error')('_tag')({ A: type({ _tag: literalA, a: NumberFromString }), B: type({ _tag: literalB, b: NumberFromString }) }) + +// +// union +// + +// $ExpectType Kleisli<"Either", string, string, string | number> +_.union(M)((_, e) => e)(NumberFromString, string) diff --git a/dtslint/ts3.5/KleisliDecoder.ts b/dtslint/ts3.5/KleisliDecoder.ts index 3cab454ee..0c9af0fb8 100644 --- a/dtslint/ts3.5/KleisliDecoder.ts +++ b/dtslint/ts3.5/KleisliDecoder.ts @@ -1,5 +1,6 @@ import * as _ from '../../src/KleisliDecoder' +declare const string: _.KleisliDecoder declare const NumberFromString: _.KleisliDecoder // @@ -36,3 +37,10 @@ _.sum('_tag')({ A: _.type({ _tag: _.literal('A'), a: NumberFromString }), B: _.type({ _tag: _.literal('B'), b: NumberFromString }) }) + +// +// union +// + +// $ExpectType KleisliDecoder +_.union(NumberFromString, string) diff --git a/dtslint/ts3.5/KleisliTaskDecoder.ts b/dtslint/ts3.5/KleisliTaskDecoder.ts index 66bff66d4..5980e22f0 100644 --- a/dtslint/ts3.5/KleisliTaskDecoder.ts +++ b/dtslint/ts3.5/KleisliTaskDecoder.ts @@ -1,5 +1,6 @@ import * as _ from '../../src/KleisliTaskDecoder' +declare const string: _.KleisliTaskDecoder declare const NumberFromString: _.KleisliTaskDecoder // @@ -36,3 +37,10 @@ _.sum('_tag')({ A: _.type({ _tag: _.literal('A'), a: NumberFromString }), B: _.type({ _tag: _.literal('B'), b: NumberFromString }) }) + +// +// union +// + +// $ExpectType KleisliTaskDecoder +_.union(NumberFromString, string) diff --git a/src/Kleisli.ts b/src/Kleisli.ts index bd65add0a..7024ba3e7 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -222,11 +222,11 @@ export function tuple( */ export const union = (M: Alt2C & Bifunctor2) => ( onMemberError: (index: number, e: E) => E -) => ]>( - ...members: { [K in keyof A]: Kleisli } -): Kleisli => ({ +) => , ...Array>]>( + ...members: MS +): Kleisli, E, TypeOf> => ({ decode: (i) => { - let out: Kind2 = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) + let out: Kind2> = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) for (let index = 1; index < members.length; index++) { out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) } diff --git a/src/KleisliDecoder.ts b/src/KleisliDecoder.ts index 143a2262e..bf4b19324 100644 --- a/src/KleisliDecoder.ts +++ b/src/KleisliDecoder.ts @@ -164,11 +164,11 @@ export const tuple = >>( * @category combinators * @since 2.2.7 */ -export const union: ]>( - ...members: { [K in keyof A]: KleisliDecoder } -) => KleisliDecoder = +export const union: , ...Array>]>( + ...members: MS +) => KleisliDecoder, TypeOf> = /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) as any + K.union(M)((i, e) => FS.of(DE.member(i, e))) /** * @category combinators diff --git a/src/KleisliTaskDecoder.ts b/src/KleisliTaskDecoder.ts index 77da48cfc..a8694c9be 100644 --- a/src/KleisliTaskDecoder.ts +++ b/src/KleisliTaskDecoder.ts @@ -177,11 +177,11 @@ export const tuple = >>( * @category combinators * @since 2.2.7 */ -export const union: ]>( - ...members: { [K in keyof A]: KleisliTaskDecoder } -) => KleisliTaskDecoder = +export const union: , ...Array>]>( + ...members: MS +) => KleisliTaskDecoder, TypeOf> = /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) as any + K.union(M)((i, e) => FS.of(DE.member(i, e))) /** * @category combinators From 1cc97816833f4470961f8984f0c3de604ba97cac Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 15:03:18 +0200 Subject: [PATCH 089/222] Kleisli: change pipe to compose --- docs/modules/Kleisli.ts.md | 26 +++++++++++++------------- docs/modules/KleisliDecoder.ts.md | 4 +--- docs/modules/KleisliTaskDecoder.ts.md | 4 +--- src/Kleisli.ts | 9 ++++----- src/KleisliDecoder.ts | 9 ++++----- src/KleisliTaskDecoder.ts | 12 ++++++------ 6 files changed, 29 insertions(+), 35 deletions(-) diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 25daa52d3..dc8578ffe 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -15,6 +15,7 @@ Added in v2.2.7 - [combinators](#combinators) - [alt](#alt) - [array](#array) + - [compose](#compose) - [intersect](#intersect) - [lazy](#lazy) - [map](#map) @@ -22,7 +23,6 @@ Added in v2.2.7 - [nullable](#nullable) - [parse](#parse) - [partial](#partial) - - [pipe](#pipe) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -66,6 +66,18 @@ export declare function array( Added in v2.2.7 +## compose + +**Signature** + +```ts +export declare const compose: ( + M: Monad2C +) => (ab: Kleisli) => (ia: Kleisli) => Kleisli +``` + +Added in v2.2.7 + ## intersect **Signature** @@ -159,18 +171,6 @@ export declare function partial( Added in v2.2.7 -## pipe - -**Signature** - -```ts -export declare const pipe: ( - M: Monad2C -) => (ia: Kleisli, ab: Kleisli) => Kleisli -``` - -Added in v2.2.7 - ## record **Signature** diff --git a/docs/modules/KleisliDecoder.ts.md b/docs/modules/KleisliDecoder.ts.md index d3e81a124..7fe4084cf 100644 --- a/docs/modules/KleisliDecoder.ts.md +++ b/docs/modules/KleisliDecoder.ts.md @@ -320,9 +320,7 @@ Added in v2.2.7 **Signature** ```ts -export interface KleisliDecoder { - readonly decode: (i: I) => E.Either -} +export interface KleisliDecoder extends K.Kleisli {} ``` Added in v2.2.7 diff --git a/docs/modules/KleisliTaskDecoder.ts.md b/docs/modules/KleisliTaskDecoder.ts.md index 58ea7eedf..d61492c68 100644 --- a/docs/modules/KleisliTaskDecoder.ts.md +++ b/docs/modules/KleisliTaskDecoder.ts.md @@ -339,9 +339,7 @@ Added in v2.2.7 **Signature** ```ts -export interface KleisliTaskDecoder { - readonly decode: (i: I) => TE.TaskEither -} +export interface KleisliTaskDecoder extends K.Kleisli {} ``` Added in v2.2.7 diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 7024ba3e7..55d310380 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -72,7 +72,7 @@ export const mapLeftWithInput = (M: Bifunctor2) => (f: export const refine = (M: MonadThrow2C & Bifunctor2) => ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli): Kleisli => pipe(M)(from, fromRefinement(M)(refinement, onError)) +) => (from: Kleisli): Kleisli => compose(M)(fromRefinement(M)(refinement, onError))(from) /** * @category combinators @@ -80,7 +80,7 @@ export const refine = (M: MonadThrow2C & Bifunctor2 */ export const parse = (M: Monad2C) => (decode: (a: A) => Kind2) => ( from: Kleisli -): Kleisli => pipe(M)(from, { decode }) +): Kleisli => compose(M)({ decode })(from) /** * @category combinators @@ -294,9 +294,8 @@ export const lazy = (M: Bifunctor2) => ( * @category combinators * @since 2.2.7 */ -export const pipe = (M: Monad2C) => ( - ia: Kleisli, - ab: Kleisli +export const compose = (M: Monad2C) => (ab: Kleisli) => ( + ia: Kleisli ): Kleisli => ({ decode: (i) => M.chain(ia.decode(i), ab.decode) }) diff --git a/src/KleisliDecoder.ts b/src/KleisliDecoder.ts index bf4b19324..9cea6dcc9 100644 --- a/src/KleisliDecoder.ts +++ b/src/KleisliDecoder.ts @@ -24,9 +24,7 @@ const M = * @category model * @since 2.2.7 */ -export interface KleisliDecoder { - readonly decode: (i: I) => E.Either -} +export interface KleisliDecoder extends K.Kleisli {} // ------------------------------------------------------------------------------------- // DecodeError @@ -209,8 +207,9 @@ export const lazy: (id: string, f: () => KleisliDecoder) => KleisliD * @category combinators * @since 2.2.7 */ -export const compose = (to: KleisliDecoder) => (from: KleisliDecoder): KleisliDecoder => - K.pipe(M)(from, to) +export const compose: (to: KleisliDecoder) => (from: KleisliDecoder) => KleisliDecoder = + /*#__PURE__*/ + K.compose(M) // ------------------------------------------------------------------------------------- // pipeables diff --git a/src/KleisliTaskDecoder.ts b/src/KleisliTaskDecoder.ts index a8694c9be..aa0f4bed6 100644 --- a/src/KleisliTaskDecoder.ts +++ b/src/KleisliTaskDecoder.ts @@ -25,9 +25,7 @@ const M = * @category model * @since 2.2.7 */ -export interface KleisliTaskDecoder { - readonly decode: (i: I) => TE.TaskEither -} +export interface KleisliTaskDecoder extends K.Kleisli {} // ------------------------------------------------------------------------------------- // DecodeError @@ -222,9 +220,11 @@ export const lazy: (id: string, f: () => KleisliTaskDecoder) => Klei * @category combinators * @since 2.2.7 */ -export const compose = (to: KleisliTaskDecoder) => ( - from: KleisliTaskDecoder -): KleisliTaskDecoder => K.pipe(M)(from, to) +export const compose: ( + to: KleisliTaskDecoder +) => (from: KleisliTaskDecoder) => KleisliTaskDecoder = + /*#__PURE__*/ + K.compose(M) // ------------------------------------------------------------------------------------- // pipeables From 9692015ab792e2d858e45636653a7b70377c4fb1 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 16:50:12 +0200 Subject: [PATCH 090/222] type, partial and sum should be loose while enforcing an object as input --- src/Decoder.ts | 11 ++++++++--- src/Guard.ts | 7 +++++++ src/TaskDecoder.ts | 13 ++++++++++--- test/Codec.ts | 6 +++--- test/Decoder.ts | 6 +++--- test/TaskDecoder.ts | 6 +++--- 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/Decoder.ts b/src/Decoder.ts index bff75c53d..e1a9e772e 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -111,6 +111,11 @@ export const UnknownRecord: Decoder> = /*#__PURE__*/ fromGuard(G.UnknownRecord, 'Record') +/** + * @internal + */ +export const object: Decoder = fromGuard(G.object, 'object') + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -147,14 +152,14 @@ export const nullable: (or: Decoder) => Decoder = KD.nullable * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> => - pipe(UnknownRecord as any, compose(KD.type(properties))) + pipe(object as any, compose(KD.type(properties))) /** * @category combinators * @since 2.2.7 */ export const partial = (properties: { [K in keyof A]: Decoder }): Decoder> => - pipe(UnknownRecord as any, compose(KD.partial(properties))) + pipe(object as any, compose(KD.partial(properties))) /** * @category combinators @@ -195,7 +200,7 @@ export const intersect: (right: Decoder) => (left: Decoder) => Decod * @since 2.2.7 */ export const sum = (tag: T) => (members: { [K in keyof A]: Decoder }): Decoder => - pipe(UnknownRecord as any, compose(KD.sum(tag)(members))) + pipe(object as any, compose(KD.sum(tag)(members))) /** * @category combinators diff --git a/src/Guard.ts b/src/Guard.ts index 1bf2e8930..e40e5d34b 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -81,6 +81,13 @@ export const UnknownRecord: Guard> = { is: (u: unknown): u is Record => Object.prototype.toString.call(u) === '[object Object]' } +/** + * @internal + */ +export const object: Guard = { + is: (u: unknown): u is object => u != null && !string.is(u) && !number.is(u) && !boolean.is(u) +} + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 0ba139cc4..78141bb5f 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -117,6 +117,13 @@ export const UnknownRecord: TaskDecoder> = /*#__PURE__*/ fromDecoder(D.UnknownRecord) +/** + * @internal + */ +export const object: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.object) + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -157,7 +164,7 @@ export const nullable: (or: TaskDecoder) => TaskDecoder = KTD.nu * @since 2.2.7 */ export const type = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder<{ [K in keyof A]: A[K] }> => - pipe(UnknownRecord as any, compose(KTD.type(properties))) + pipe(object as any, compose(KTD.type(properties))) /** * @category combinators @@ -165,7 +172,7 @@ export const type = (properties: { [K in keyof A]: TaskDecoder }): Task */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(UnknownRecord as any, compose(KTD.partial(properties))) +): TaskDecoder> => pipe(object as any, compose(KTD.partial(properties))) /** * @category combinators @@ -208,7 +215,7 @@ export const intersect: (right: TaskDecoder) => (left: TaskDecoder) */ export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord as any, compose(KTD.sum(tag)(members))) +): TaskDecoder => pipe(object as any, compose(KTD.sum(tag)(members))) /** * @category combinators diff --git a/test/Codec.ts b/test/Codec.ts index e0bc3331b..231fd2c6f 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -241,7 +241,7 @@ describe('Codec', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -317,7 +317,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -547,7 +547,7 @@ describe('Codec', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'Record')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'object')) assert.deepStrictEqual( codec.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/Decoder.ts b/test/Decoder.ts index d7bd0ad1c..08065290c 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -181,7 +181,7 @@ describe('Decoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -242,7 +242,7 @@ describe('Decoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -467,7 +467,7 @@ describe('Decoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) assert.deepStrictEqual( decoder.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 77500d66f..c741425e3 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -189,7 +189,7 @@ describe('TaskDecoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Record')) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'object')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -250,7 +250,7 @@ describe('TaskDecoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Record')) + assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'object')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -478,7 +478,7 @@ describe('TaskDecoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode(null)(), KD.failure(null, 'Record')) + assert.deepStrictEqual(await decoder.decode(null)(), KD.failure(null, 'object')) assert.deepStrictEqual( await decoder.decode({})(), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) From 55543c26cccef96e5048a30ce64f83b0334c0544 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 25 Jun 2020 18:01:13 +0200 Subject: [PATCH 091/222] fix d.ts --- docs/modules/Kleisli.ts.md | 68 ++++++------- dtslint/ts3.5/JsonEncoder.ts | 11 +++ src/Decoder.ts | 4 +- src/Kleisli.ts | 182 +++++++++++++++++++++-------------- 4 files changed, 153 insertions(+), 112 deletions(-) diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index dc8578ffe..48c68a2bf 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -47,9 +47,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const alt: ( +export declare function alt( A: Alt2C -) => (that: Lazy>) => (me: Kleisli) => Kleisli +): (that: Lazy>) => (me: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -71,9 +71,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const compose: ( +export declare function compose( M: Monad2C -) => (ab: Kleisli) => (ia: Kleisli) => Kleisli +): (ab: Kleisli) => (ia: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -83,9 +83,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const intersect: ( +export declare function intersect( M: Apply2C -) => (right: Kleisli) => (left: Kleisli) => Kleisli +): (right: Kleisli) => (left: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -95,9 +95,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const lazy: ( +export declare function lazy( M: Bifunctor2 -) => (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli ``` Added in v2.2.7 @@ -107,9 +107,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const map: ( +export declare function map( F: Functor2C -) => (f: (a: A) => B) => (ia: Kleisli) => Kleisli +): (f: (a: A) => B) => (ia: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -119,14 +119,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const mapLeftWithInput: ( +export declare function mapLeftWithInput( M: Bifunctor2 -) => (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -136,9 +131,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const nullable: ( +export declare function nullable( M: Applicative2C & Bifunctor2 -) => (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -148,9 +143,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const parse: ( +export declare function parse( M: Monad2C -) => (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli +): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli ``` Added in v2.2.7 @@ -190,9 +185,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const refine: ( +export declare function refine( M: MonadThrow2C & Bifunctor2 -) => ( +): ( refinement: (a: A) => a is B, onError: (a: A) => E ) => (from: Kleisli) => Kleisli @@ -205,10 +200,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const sum: ( +export declare function sum( M: MonadThrow2C -) => ( - onTagError: (tag: string, value: unknown, tags: readonly string[]) => E +): ( + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E ) => ( tag: T ) => >>( @@ -255,11 +250,11 @@ Added in v2.2.7 **Signature** ```ts -export declare const union: ( +export declare function union( M: Alt2C & Bifunctor2 -) => ( +): ( onMemberError: (index: number, e: E) => E -) => , ...Kleisli[]]>( +) => , ...Array>]>( ...members: MS ) => Kleisli, E, TypeOf> ``` @@ -273,12 +268,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const fromRefinement: < - M extends 'io-ts/Codec' | 'io-ts/Encoder' | 'Either' | 'IOEither' | 'TaskEither', - E ->( +export declare function fromRefinement( M: MonadThrow2C -) => (refinement: Refinement, onError: (i: I) => E) => Kleisli +): (refinement: Refinement, onError: (i: I) => E) => Kleisli ``` Added in v2.2.7 @@ -288,11 +280,11 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: ( +export declare function literal( M: MonadThrow2C -) => ( - onError: (i: I, values: readonly [Literal, ...Literal[]]) => E -) => (...values: A) => Kleisli +): ( + onError: (i: I, values: readonly [Literal, ...Array]) => E +) => ]>(...values: A) => Kleisli ``` Added in v2.2.7 diff --git a/dtslint/ts3.5/JsonEncoder.ts b/dtslint/ts3.5/JsonEncoder.ts index 1ef67cab2..e24d6f641 100644 --- a/dtslint/ts3.5/JsonEncoder.ts +++ b/dtslint/ts3.5/JsonEncoder.ts @@ -15,3 +15,14 @@ _.partial({ c: _.id() }) }) + +// +// Json type +// + +const number: _.Json = 1 +const string: _.Json = 'a' +const boolean: _.Json = true +const nully: _.Json = null +const array: _.Json = [1, 'a', true, null] +const record: _.Json = { a: 1, b: 'b', c: true, d: null } diff --git a/src/Decoder.ts b/src/Decoder.ts index e1a9e772e..7b8c3a6fc 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -114,7 +114,9 @@ export const UnknownRecord: Decoder> = /** * @internal */ -export const object: Decoder = fromGuard(G.object, 'object') +export const object: Decoder = + /*#__PURE__*/ + fromGuard(G.object, 'object') // ------------------------------------------------------------------------------------- // combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 55d310380..1d4cfe914 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -34,22 +34,27 @@ export interface Kleisli { * @category constructors * @since 2.2.7 */ -export const fromRefinement = (M: MonadThrow2C) => ( - refinement: Refinement, - onError: (i: I) => E -): Kleisli => ({ - decode: (i) => (refinement(i) ? M.of(i) : M.throwError(onError(i))) -}) +export function fromRefinement( + M: MonadThrow2C +): (refinement: Refinement, onError: (i: I) => E) => Kleisli { + return (refinement, onError) => ({ + decode: (i) => (refinement(i) ? M.of(i) : M.throwError(onError(i))) + }) +} /** * @category constructors * @since 2.2.7 */ -export const literal = (M: MonadThrow2C) => ( +export function literal( + M: MonadThrow2C +): ( onError: (i: I, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A): Kleisli => ({ - decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) -}) +) => ]>(...values: A) => Kleisli { + return (onError) => ]>(...values: A) => ({ + decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) + }) +} // ------------------------------------------------------------------------------------- // combinators @@ -59,45 +64,55 @@ export const literal = (M: MonadThrow2C) => ( * @category combinators * @since 2.2.7 */ -export const mapLeftWithInput = (M: Bifunctor2) => (f: (i: I, e: E) => E) => ( - decoder: Kleisli -): Kleisli => ({ - decode: (i) => M.mapLeft(decoder.decode(i), (e) => f(i, e)) -}) +export function mapLeftWithInput( + M: Bifunctor2 +): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli { + return (f) => (decoder) => ({ + decode: (i) => M.mapLeft(decoder.decode(i), (e) => f(i, e)) + }) +} /** * @category combinators * @since 2.2.7 */ -export const refine = (M: MonadThrow2C & Bifunctor2) => ( +export function refine( + M: MonadThrow2C & Bifunctor2 +): ( refinement: (a: A) => a is B, onError: (a: A) => E -) => (from: Kleisli): Kleisli => compose(M)(fromRefinement(M)(refinement, onError))(from) +) => (from: Kleisli) => Kleisli { + return (refinement, onError) => (from) => compose(M)(fromRefinement(M)(refinement, onError))(from) +} /** * @category combinators * @since 2.2.7 */ -export const parse = (M: Monad2C) => (decode: (a: A) => Kind2) => ( - from: Kleisli -): Kleisli => compose(M)({ decode })(from) +export function parse( + M: Monad2C +): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli { + return (decode) => (from) => compose(M)({ decode })(from) +} /** * @category combinators * @since 2.2.7 */ -export const nullable = (M: Applicative2C & Bifunctor2) => ( - onError: (i: I, e: E) => E -) => (or: Kleisli): Kleisli => ({ - decode: (i) => - i === null - ? M.of(null) - : M.bimap( - or.decode(i), - (e) => onError(i, e), - (a): A | null => a - ) -}) +export function nullable( + M: Applicative2C & Bifunctor2 +): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli { + return (onError: (i: I, e: E) => E) => (or: Kleisli): Kleisli => ({ + decode: (i) => + i === null + ? M.of(null) + : M.bimap( + or.decode(i), + (e) => onError(i, e), + (a): A | null => a + ) + }) +} /** * @since 2.2.7 @@ -220,46 +235,58 @@ export function tuple( * @category combinators * @since 2.2.7 */ -export const union = (M: Alt2C & Bifunctor2) => ( +export function union( + M: Alt2C & Bifunctor2 +): ( onMemberError: (index: number, e: E) => E ) => , ...Array>]>( ...members: MS -): Kleisli, E, TypeOf> => ({ - decode: (i) => { - let out: Kind2> = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) - for (let index = 1; index < members.length; index++) { - out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) +) => Kleisli, E, TypeOf> { + return (onMemberError) => , ...Array>]>( + ...members: MS + ) => ({ + decode: (i) => { + let out: Kind2> = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) + for (let index = 1; index < members.length; index++) { + out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) + } + return out } - return out - } -}) + }) +} /** * @category combinators * @since 2.2.7 */ -export const intersect = (M: Apply2C) => (right: Kleisli) => ( - left: Kleisli -): Kleisli => ({ - decode: (i) => - M.ap( - M.map(left.decode(i), (a: A) => (b: B) => intersect_(a, b)), - right.decode(i) - ) -}) +export function intersect( + M: Apply2C +): (right: Kleisli) => (left: Kleisli) => Kleisli { + return (right: Kleisli) => ( + left: Kleisli + ): Kleisli => ({ + decode: (i) => + M.ap( + M.map(left.decode(i), (a: A) => (b: B) => intersect_(a, b)), + right.decode(i) + ) + }) +} /** * @category combinators * @since 2.2.7 */ -export const sum = (M: MonadThrow2C) => ( +export function sum( + M: MonadThrow2C +): ( onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E ) => ( tag: T -): (>>( +) => >>( members: MS -) => Kleisli, E, TypeOf>) => { - return , A>( +) => Kleisli, E, TypeOf> { + return (onTagError) => (tag) => , A>( members: { [K in keyof A]: Kleisli } ): Kleisli => { const keys = Object.keys(members) @@ -279,10 +306,13 @@ export const sum = (M: MonadThrow2C) => ( * @category combinators * @since 2.2.7 */ -export const lazy = (M: Bifunctor2) => ( - onError: (id: string, e: E) => E -): ((id: string, f: () => Kleisli) => Kleisli) => { - return (id: string, f: () => Kleisli): Kleisli => { +export function lazy( + M: Bifunctor2 +): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli { + return (onError: (id: string, e: E) => E) => ( + id: string, + f: () => Kleisli + ): Kleisli => { const get = memoize>(f) return { decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) @@ -294,31 +324,37 @@ export const lazy = (M: Bifunctor2) => ( * @category combinators * @since 2.2.7 */ -export const compose = (M: Monad2C) => (ab: Kleisli) => ( - ia: Kleisli -): Kleisli => ({ - decode: (i) => M.chain(ia.decode(i), ab.decode) -}) +export function compose( + M: Monad2C +): (ab: Kleisli) => (ia: Kleisli) => Kleisli { + return (ab) => (ia) => ({ + decode: (i) => M.chain(ia.decode(i), ab.decode) + }) +} /** * @category combinators * @since 2.2.7 */ -export const map = (F: Functor2C) => (f: (a: A) => B) => ( - ia: Kleisli -): Kleisli => ({ - decode: (i) => F.map(ia.decode(i), f) -}) +export function map( + F: Functor2C +): (f: (a: A) => B) => (ia: Kleisli) => Kleisli { + return (f) => (ia) => ({ + decode: (i) => F.map(ia.decode(i), f) + }) +} /** * @category combinators * @since 2.2.7 */ -export const alt = (A: Alt2C) => (that: Lazy>) => ( - me: Kleisli -): Kleisli => ({ - decode: (i) => A.alt(me.decode(i), () => that().decode(i)) -}) +export function alt( + A: Alt2C +): (that: Lazy>) => (me: Kleisli) => Kleisli { + return (that) => (me) => ({ + decode: (i) => A.alt(me.decode(i), () => that().decode(i)) + }) +} // ------------------------------------------------------------------------------------- // utils From b1b704e613c326c3b68345cd044ee944f5934867 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 26 Jun 2020 12:46:57 +0200 Subject: [PATCH 092/222] better naming --- docs/modules/Kleisli.ts.md | 4 ++-- src/Kleisli.ts | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 48c68a2bf..c6aa9e7c7 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -158,7 +158,7 @@ Added in v2.2.7 export declare function partial( M: Applicative2C & Bifunctor2 ): ( - onKeyError: (key: string, e: E) => E + onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P ) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> @@ -237,7 +237,7 @@ Added in v2.2.7 export declare function type( M: Applicative2C & Bifunctor2 ): ( - onKeyError: (key: string, e: E) => E + onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P ) => Kleisli }, E, { [K in keyof P]: TypeOf }> diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 1d4cfe914..b00c69109 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -131,15 +131,15 @@ export type InputOf = KD extends Kleisli( M: Applicative2C & Bifunctor2 ): ( - onKeyError: (key: string, e: E) => E + onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P ) => Kleisli }, E, { [K in keyof P]: TypeOf }> { const traverse = traverseRecordWithIndex(M) - return (onKeyError) => (properties) => ({ + return (onPropertyError) => (properties) => ({ decode: (i) => - traverse(properties as Record>, (k, decoder) => - M.mapLeft(decoder.decode(i[k]), (e) => onKeyError(k, e)) + traverse(properties as Record>, (key, decoder) => + M.mapLeft(decoder.decode(i[key]), (e) => onPropertyError(key, e)) ) as any }) } @@ -151,28 +151,28 @@ export function type( export function partial( M: Applicative2C & Bifunctor2 ): ( - onKeyError: (key: string, e: E) => E + onPropertyError: (key: string, e: E) => E ) =>

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }>> ``` Added in v2.2.7 @@ -228,7 +218,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const record: (codomain: Decoder) => Decoder> +export declare const record: (codomain: Decoder) => Decoder, Record> ``` Added in v2.2.7 @@ -241,7 +231,7 @@ Added in v2.2.7 export declare const refine: ( refinement: (a: A) => a is B, id: string -) => (from: Decoder) => Decoder +) => (from: Decoder) => Decoder ``` Added in v2.2.7 @@ -253,7 +243,9 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: Decoder }) => Decoder +) => >>( + members: MS +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> ``` Added in v2.2.7 @@ -263,9 +255,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const tuple: ( - ...components: { [K in keyof A]: Decoder } -) => Decoder +export declare const tuple: []>( + ...components: C +) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> ``` Added in v2.2.7 @@ -275,7 +267,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder<{ [K in keyof A]: A[K] }> +export declare const type:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> ``` Added in v2.2.7 @@ -285,21 +279,21 @@ Added in v2.2.7 **Signature** ```ts -export declare const union: ( - ...members: { [K in keyof A]: Decoder } -) => Decoder +export declare const union: , ...Decoder[]]>( + ...members: MS +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> ``` Added in v2.2.7 # constructors -## fromGuard +## fromRefinement **Signature** ```ts -export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder +export declare const fromRefinement: (refinement: Refinement, expected: string) => Decoder ``` Added in v2.2.7 @@ -309,62 +303,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: (...values: A) => Decoder -``` - -Added in v2.2.7 - -# instances - -## URI - -**Signature** - -```ts -export declare const URI: 'io-ts/Decoder' -``` - -Added in v2.2.7 - -## URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.7 - -## altDecoder - -**Signature** - -```ts -export declare const altDecoder: Alt1<'io-ts/Decoder'> -``` - -Added in v2.2.7 - -## functorDecoder - -**Signature** - -```ts -export declare const functorDecoder: Functor1<'io-ts/Decoder'> -``` - -Added in v2.2.7 - -## schemableDecoder - -**Signature** - -```ts -export declare const schemableDecoder: Schemable1<'io-ts/Decoder'> & - WithUnknownContainers1<'io-ts/Decoder'> & - WithUnion1<'io-ts/Decoder'> & - WithRefine1<'io-ts/Decoder'> +export declare const literal: (...values: A) => Decoder ``` Added in v2.2.7 @@ -376,81 +315,29 @@ Added in v2.2.7 **Signature** ```ts -export interface Decoder extends KD.KleisliDecoder {} -``` - -Added in v2.2.7 - -# primitives - -## UnknownArray - -**Signature** - -```ts -export declare const UnknownArray: Decoder -``` - -Added in v2.2.7 - -## UnknownRecord - -**Signature** - -```ts -export declare const UnknownRecord: Decoder> -``` - -Added in v2.2.7 - -## boolean - -**Signature** - -```ts -export declare const boolean: Decoder -``` - -Added in v2.2.7 - -## number - -**Signature** - -```ts -export declare const number: Decoder -``` - -Added in v2.2.7 - -## string - -**Signature** - -```ts -export declare const string: Decoder +export interface Decoder extends K.Kleisli {} ``` Added in v2.2.7 # utils -## TypeOf (type alias) +## InputOf (type alias) **Signature** ```ts -export type TypeOf = KD.TypeOf +export type InputOf = K.InputOf ``` Added in v2.2.7 -## draw +## TypeOf (type alias) **Signature** ```ts -export declare const draw: (e: FS.FreeSemigroup>) => string +export type TypeOf = K.TypeOf ``` Added in v2.2.7 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index b11c0fd2b..f5d91ad8c 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -36,10 +36,10 @@ Added in v2.2.3 - [constructors](#constructors) - [id](#id) - [instances](#instances) + - [Category](#category) + - [Contravariant](#contravariant-1) - [URI](#uri) - [URI (type alias)](#uri-type-alias) - - [categoryEncoder](#categoryencoder) - - [contravariantEncoder](#contravariantencoder) - [model](#model) - [Encoder (interface)](#encoder-interface) - [utils](#utils) @@ -186,42 +186,42 @@ Added in v2.2.3 # instances -## URI +## Category **Signature** ```ts -export declare const URI: 'io-ts/Encoder' +export declare const Category: Category2<'io-ts/Encoder'> ``` Added in v2.2.3 -## URI (type alias) +## Contravariant **Signature** ```ts -export type URI = typeof URI +export declare const Contravariant: Contravariant2<'io-ts/Encoder'> ``` Added in v2.2.3 -## categoryEncoder +## URI **Signature** ```ts -export declare const categoryEncoder: Category2<'io-ts/Encoder'> +export declare const URI: 'io-ts/Encoder' ``` Added in v2.2.3 -## contravariantEncoder +## URI (type alias) **Signature** ```ts -export declare const contravariantEncoder: Contravariant2<'io-ts/Encoder'> +export type URI = typeof URI ``` Added in v2.2.3 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index e412b3ef3..2138c14bc 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -30,7 +30,7 @@ Added in v2.2.2 - [tuple](#tuple) - [type](#type) - [instances](#instances) - - [schemableEq](#schemableeq) + - [Schemable](#schemable) - [primitives](#primitives) - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) @@ -137,12 +137,12 @@ Added in v2.2.2 # instances -## schemableEq +## Schemable **Signature** ```ts -export declare const schemableEq: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefine1<'Eq'> +export declare const Schemable: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefine1<'Eq'> ``` Added in v2.2.3 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index cb7257bd5..07250ced6 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -34,9 +34,9 @@ Added in v2.2.0 - [constructors](#constructors) - [literal](#literal) - [instances](#instances) + - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) - - [schemableGuard](#schemableguard) - [model](#model) - [Guard (interface)](#guard-interface) - [primitives](#primitives) @@ -182,38 +182,38 @@ Added in v2.2.0 # instances -## URI +## Schemable **Signature** ```ts -export declare const URI: 'io-ts/Guard' +export declare const Schemable: Schemable1<'io-ts/Guard'> & + WithUnknownContainers1<'io-ts/Guard'> & + WithUnion1<'io-ts/Guard'> & + WithRefine1<'io-ts/Guard'> ``` -Added in v2.2.0 +Added in v2.2.3 -## URI (type alias) +## URI **Signature** ```ts -export type URI = typeof URI +export declare const URI: 'io-ts/Guard' ``` Added in v2.2.0 -## schemableGuard +## URI (type alias) **Signature** ```ts -export declare const schemableGuard: Schemable1<'io-ts/Guard'> & - WithUnknownContainers1<'io-ts/Guard'> & - WithUnion1<'io-ts/Guard'> & - WithRefine1<'io-ts/Guard'> +export type URI = typeof URI ``` -Added in v2.2.3 +Added in v2.2.0 # model diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 76911b252..cff68e608 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -37,10 +37,10 @@ Added in v2.2.3 - [literal](#literal) - [make](#make) - [instances](#instances) + - [Invariant](#invariant) + - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) - - [invariantJsonCodec](#invariantjsoncodec) - - [schemableJsonCodec](#schemablejsoncodec) - [model](#model) - [JsonCodec (interface)](#jsoncodec-interface) - [primitives](#primitives) @@ -204,49 +204,49 @@ Added in v2.2.3 **Signature** ```ts -export declare const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec +export declare const make: (decoder: UD.UnknownDecoder, encoder: JE.JsonEncoder) => JsonCodec ``` Added in v2.2.3 # instances -## URI +## Invariant **Signature** ```ts -export declare const URI: 'io-ts/JsonCodec' +export declare const Invariant: Invariant1<'io-ts/JsonCodec'> ``` Added in v2.2.3 -## URI (type alias) +## Schemable **Signature** ```ts -export type URI = typeof URI +export declare const Schemable: Schemable1<'io-ts/JsonCodec'> & WithRefine1<'io-ts/JsonCodec'> ``` Added in v2.2.3 -## invariantJsonCodec +## URI **Signature** ```ts -export declare const invariantJsonCodec: Invariant1<'io-ts/JsonCodec'> +export declare const URI: 'io-ts/JsonCodec' ``` Added in v2.2.3 -## schemableJsonCodec +## URI (type alias) **Signature** ```ts -export declare const schemableJsonCodec: Schemable1<'io-ts/JsonCodec'> & WithRefine1<'io-ts/JsonCodec'> +export type URI = typeof URI ``` Added in v2.2.3 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 00869dfac..d2d4c53e9 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -32,10 +32,10 @@ Added in v2.2.3 - [tuple](#tuple) - [type](#type) - [instances](#instances) + - [Contravariant](#contravariant-1) + - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) - - [contravariantJsonEncoder](#contravariantjsonencoder) - - [schemableJsonEncoder](#schemablejsonencoder) - [model](#model) - [Json (type alias)](#json-type-alias) - [JsonArray (interface)](#jsonarray-interface) @@ -162,42 +162,42 @@ Added in v2.2.3 # instances -## URI +## Contravariant **Signature** ```ts -export declare const URI: 'io-ts/JsonEncoder' +export declare const Contravariant: Contravariant1<'io-ts/JsonEncoder'> ``` Added in v2.2.3 -## URI (type alias) +## Schemable **Signature** ```ts -export type URI = typeof URI +export declare const Schemable: Schemable1<'io-ts/JsonEncoder'> ``` Added in v2.2.3 -## contravariantJsonEncoder +## URI **Signature** ```ts -export declare const contravariantJsonEncoder: Contravariant1<'io-ts/JsonEncoder'> +export declare const URI: 'io-ts/JsonEncoder' ``` Added in v2.2.3 -## schemableJsonEncoder +## URI (type alias) **Signature** ```ts -export declare const schemableJsonEncoder: Schemable1<'io-ts/JsonEncoder'> +export type URI = typeof URI ``` Added in v2.2.3 diff --git a/docs/modules/KleisliDecoder.ts.md b/docs/modules/KleisliDecoder.ts.md deleted file mode 100644 index 79c37cb1d..000000000 --- a/docs/modules/KleisliDecoder.ts.md +++ /dev/null @@ -1,355 +0,0 @@ ---- -title: KleisliDecoder.ts -nav_order: 12 -parent: Modules ---- - -## KleisliDecoder overview - -**This module is experimental** - -Experimental features are published in order to get early feedback from the community, see these tracking -[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - -A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - -Added in v2.2.7 - ---- - -

Table of contents

- -- [Alt](#alt) - - [alt](#alt) -- [DecodeError](#decodeerror) - - [DecodeError (type alias)](#decodeerror-type-alias) - - [error](#error) - - [failure](#failure) - - [success](#success) -- [Functor](#functor) - - [map](#map) -- [combinators](#combinators) - - [array](#array) - - [compose](#compose) - - [intersect](#intersect) - - [lazy](#lazy) - - [mapLeftWithInput](#mapleftwithinput) - - [nullable](#nullable) - - [parse](#parse) - - [partial](#partial) - - [record](#record) - - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) - - [union](#union) -- [constructors](#constructors) - - [fromRefinement](#fromrefinement) - - [literal](#literal) -- [model](#model) - - [KleisliDecoder (interface)](#kleislidecoder-interface) -- [utils](#utils) - - [InputOf (type alias)](#inputof-type-alias) - - [TypeOf (type alias)](#typeof-type-alias) - ---- - -# Alt - -## alt - -**Signature** - -```ts -export declare const alt: (that: () => KleisliDecoder) => (me: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -# DecodeError - -## DecodeError (type alias) - -**Signature** - -```ts -export type DecodeError = FS.FreeSemigroup> -``` - -Added in v2.2.7 - -## error - -**Signature** - -```ts -export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> -``` - -Added in v2.2.7 - -## failure - -**Signature** - -```ts -export declare const failure: ( - actual: unknown, - message: string -) => E.Either>, A> -``` - -Added in v2.2.7 - -## success - -**Signature** - -```ts -export declare const success: (a: A) => E.Either>, A> -``` - -Added in v2.2.7 - -# Functor - -## map - -**Signature** - -```ts -export declare const map: (f: (a: A) => B) => (fa: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -# combinators - -## array - -**Signature** - -```ts -export declare const array: (items: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## compose - -**Signature** - -```ts -export declare const compose: ( - to: KleisliDecoder -) => (from: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## intersect - -**Signature** - -```ts -export declare const intersect: ( - right: KleisliDecoder -) => (left: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## lazy - -**Signature** - -```ts -export declare const lazy: (id: string, f: () => KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## mapLeftWithInput - -**Signature** - -```ts -export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## nullable - -**Signature** - -```ts -export declare const nullable: (or: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## parse - -**Signature** - -```ts -export declare const parse: ( - parser: (a: A) => E.Either>, B> -) => (from: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## partial - -**Signature** - -```ts -export declare const partial:

>>( - properties: P -) => KleisliDecoder< - { [K in keyof P]: K.InputOf<'Either', P[K]> }, - Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }> -> -``` - -Added in v2.2.7 - -## record - -**Signature** - -```ts -export declare const record: ( - codomain: KleisliDecoder -) => KleisliDecoder, Record> -``` - -Added in v2.2.7 - -## refine - -**Signature** - -```ts -export declare const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: KleisliDecoder) => KleisliDecoder -``` - -Added in v2.2.7 - -## sum - -**Signature** - -```ts -export declare const sum: ( - tag: T -) => >>( - members: MS -) => KleisliDecoder, K.TypeOf<'Either', MS[keyof MS]>> -``` - -Added in v2.2.7 - -## tuple - -**Signature** - -```ts -export declare const tuple: []>( - ...components: C -) => KleisliDecoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> -``` - -Added in v2.2.7 - -## type - -**Signature** - -```ts -export declare const type:

>>( - properties: P -) => KleisliDecoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> -``` - -Added in v2.2.7 - -## union - -**Signature** - -```ts -export declare const union: , ...KleisliDecoder[]]>( - ...members: MS -) => KleisliDecoder, K.TypeOf<'Either', MS[keyof MS]>> -``` - -Added in v2.2.7 - -# constructors - -## fromRefinement - -**Signature** - -```ts -export declare const fromRefinement: ( - refinement: Refinement, - expected: string -) => KleisliDecoder -``` - -Added in v2.2.7 - -## literal - -**Signature** - -```ts -export declare const literal: ( - ...values: A -) => KleisliDecoder -``` - -Added in v2.2.7 - -# model - -## KleisliDecoder (interface) - -**Signature** - -```ts -export interface KleisliDecoder extends K.Kleisli {} -``` - -Added in v2.2.7 - -# utils - -## InputOf (type alias) - -**Signature** - -```ts -export type InputOf = K.InputOf -``` - -Added in v2.2.7 - -## TypeOf (type alias) - -**Signature** - -```ts -export type TypeOf = K.TypeOf -``` - -Added in v2.2.7 diff --git a/docs/modules/KleisliTaskDecoder.ts.md b/docs/modules/KleisliTaskDecoder.ts.md deleted file mode 100644 index bc061d44e..000000000 --- a/docs/modules/KleisliTaskDecoder.ts.md +++ /dev/null @@ -1,374 +0,0 @@ ---- -title: KleisliTaskDecoder.ts -nav_order: 13 -parent: Modules ---- - -## KleisliTaskDecoder overview - -**This module is experimental** - -Experimental features are published in order to get early feedback from the community, see these tracking -[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - -A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - -Added in v2.2.7 - ---- - -

Table of contents

- -- [Alt](#alt) - - [alt](#alt) -- [DecodeError](#decodeerror) - - [DecodeError (type alias)](#decodeerror-type-alias) - - [error](#error) - - [failure](#failure) - - [success](#success) -- [Functor](#functor) - - [map](#map) -- [combinators](#combinators) - - [array](#array) - - [compose](#compose) - - [intersect](#intersect) - - [lazy](#lazy) - - [mapLeftWithInput](#mapleftwithinput) - - [nullable](#nullable) - - [parse](#parse) - - [partial](#partial) - - [record](#record) - - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) - - [union](#union) -- [constructors](#constructors) - - [fromKleisliDecoder](#fromkleislidecoder) - - [fromRefinement](#fromrefinement) - - [literal](#literal) -- [model](#model) - - [KleisliTaskDecoder (interface)](#kleislitaskdecoder-interface) -- [utils](#utils) - - [InputOf (type alias)](#inputof-type-alias) - - [TypeOf (type alias)](#typeof-type-alias) - ---- - -# Alt - -## alt - -**Signature** - -```ts -export declare const alt: ( - that: () => KleisliTaskDecoder -) => (me: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -# DecodeError - -## DecodeError (type alias) - -**Signature** - -```ts -export type DecodeError = KD.DecodeError -``` - -Added in v2.2.7 - -## error - -**Signature** - -```ts -export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> -``` - -Added in v2.2.7 - -## failure - -**Signature** - -```ts -export declare const failure: ( - actual: unknown, - message: string -) => TE.TaskEither>, A> -``` - -Added in v2.2.7 - -## success - -**Signature** - -```ts -export declare const success: (a: A) => TE.TaskEither>, A> -``` - -Added in v2.2.7 - -# Functor - -## map - -**Signature** - -```ts -export declare const map: (f: (a: A) => B) => (fa: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -# combinators - -## array - -**Signature** - -```ts -export declare const array: (items: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## compose - -**Signature** - -```ts -export declare const compose: ( - to: KleisliTaskDecoder -) => (from: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## intersect - -**Signature** - -```ts -export declare const intersect: ( - right: KleisliTaskDecoder -) => (left: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## lazy - -**Signature** - -```ts -export declare const lazy: (id: string, f: () => KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## mapLeftWithInput - -**Signature** - -```ts -export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## nullable - -**Signature** - -```ts -export declare const nullable: (or: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## parse - -**Signature** - -```ts -export declare const parse: ( - parser: (a: A) => TE.TaskEither>, B> -) => (from: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## partial - -**Signature** - -```ts -export declare const partial:

>>( - properties: P -) => KleisliTaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> -> -``` - -Added in v2.2.7 - -## record - -**Signature** - -```ts -export declare const record: ( - codomain: KleisliTaskDecoder -) => KleisliTaskDecoder, Record> -``` - -Added in v2.2.7 - -## refine - -**Signature** - -```ts -export declare const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: KleisliTaskDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## sum - -**Signature** - -```ts -export declare const sum: ( - tag: T -) => >>( - members: MS -) => KleisliTaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> -``` - -Added in v2.2.7 - -## tuple - -**Signature** - -```ts -export declare const tuple: []>( - ...components: C -) => KleisliTaskDecoder< - { [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, - { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> } -> -``` - -Added in v2.2.7 - -## type - -**Signature** - -```ts -export declare const type:

>>( - properties: P -) => KleisliTaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> } -> -``` - -Added in v2.2.7 - -## union - -**Signature** - -```ts -export declare const union: , ...KleisliTaskDecoder[]]>( - ...members: MS -) => KleisliTaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> -``` - -Added in v2.2.7 - -# constructors - -## fromKleisliDecoder - -**Signature** - -```ts -export declare const fromKleisliDecoder: (decoder: KD.KleisliDecoder) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## fromRefinement - -**Signature** - -```ts -export declare const fromRefinement: ( - refinement: Refinement, - expected: string -) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -## literal - -**Signature** - -```ts -export declare const literal: ( - ...values: A -) => KleisliTaskDecoder -``` - -Added in v2.2.7 - -# model - -## KleisliTaskDecoder (interface) - -**Signature** - -```ts -export interface KleisliTaskDecoder extends K.Kleisli {} -``` - -Added in v2.2.7 - -# utils - -## InputOf (type alias) - -**Signature** - -```ts -export type InputOf = K.InputOf -``` - -Added in v2.2.7 - -## TypeOf (type alias) - -**Signature** - -```ts -export type TypeOf = K.TypeOf -``` - -Added in v2.2.7 diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index ff27f5a0e..2abc64ffe 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 14 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index deb8add51..5aea2ce60 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 15 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 5ebcd5a7a..9043f23ca 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 16 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 6e4d7664b..1e42f3acf 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 17 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 6a15fa49b..3ce71a5d0 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 18 +nav_order: 16 parent: Modules --- @@ -44,26 +44,14 @@ Added in v2.2.7 - [type](#type) - [union](#union) - [constructors](#constructors) - - [fromDecoder](#fromdecoder) - - [fromGuard](#fromguard) + - [fromKleisliDecoder](#fromkleislidecoder) + - [fromRefinement](#fromrefinement) - [literal](#literal) -- [instances](#instances) - - [URI](#uri) - - [URI (type alias)](#uri-type-alias) - - [altTaskDecoder](#alttaskdecoder) - - [functorTaskDecoder](#functortaskdecoder) - - [schemableTaskDecoder](#schemabletaskdecoder) - [model](#model) - [TaskDecoder (interface)](#taskdecoder-interface) -- [primitives](#primitives) - - [UnknownArray](#unknownarray) - - [UnknownRecord](#unknownrecord) - - [boolean](#boolean) - - [number](#number) - - [string](#string) - [utils](#utils) + - [InputOf (type alias)](#inputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) - - [draw](#draw) --- @@ -74,7 +62,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder +export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -96,7 +84,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const error: (actual: unknown, message: string) => FreeSemigroup> +export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> ``` Added in v2.2.7 @@ -109,7 +97,7 @@ Added in v2.2.7 export declare const failure: ( actual: unknown, message: string -) => TE.TaskEither>, A> +) => TE.TaskEither>, A> ``` Added in v2.2.7 @@ -119,7 +107,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const success: (a: A) => TE.TaskEither>, A> +export declare const success: (a: A) => TE.TaskEither>, A> ``` Added in v2.2.7 @@ -131,7 +119,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder +export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -143,7 +131,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const array: (items: TaskDecoder) => TaskDecoder +export declare const array: (items: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -153,7 +141,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const compose: (to: KTD.KleisliTaskDecoder) => (from: TaskDecoder) => TaskDecoder +export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -163,7 +151,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder +export declare const intersect: ( + right: TaskDecoder +) => (left: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -173,7 +163,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder +export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -183,9 +173,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const mapLeftWithInput: ( - f: (input: unknown, e: FreeSemigroup>) => FreeSemigroup> -) => (decoder: TaskDecoder) => TaskDecoder +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -195,7 +185,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const nullable: (or: TaskDecoder) => TaskDecoder +export declare const nullable: (or: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -206,8 +196,8 @@ Added in v2.2.7 ```ts export declare const parse: ( - parser: (a: A) => TE.TaskEither>, B> -) => (from: TaskDecoder) => TaskDecoder + parser: (a: A) => TE.TaskEither>, B> +) => (from: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -217,9 +207,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder> +export declare const partial:

>>( + properties: P +) => TaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +> ``` Added in v2.2.7 @@ -229,7 +222,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const record: (codomain: TaskDecoder) => TaskDecoder> +export declare const record: (codomain: TaskDecoder) => TaskDecoder, Record> ``` Added in v2.2.7 @@ -242,7 +235,7 @@ Added in v2.2.7 export declare const refine: ( refinement: (a: A) => a is B, id: string -) => (from: TaskDecoder) => TaskDecoder +) => (from: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -254,7 +247,9 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder +) => >>( + members: MS +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.7 @@ -264,9 +259,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const tuple: ( - ...components: { [K in keyof A]: TaskDecoder } -) => TaskDecoder +export declare const tuple: []>( + ...components: C +) => TaskDecoder<{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> }> ``` Added in v2.2.7 @@ -276,9 +271,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder<{ [K in keyof A]: A[K] }> +export declare const type:

>>( + properties: P +) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> ``` Added in v2.2.7 @@ -288,31 +283,34 @@ Added in v2.2.7 **Signature** ```ts -export declare const union: ( - ...members: { [K in keyof A]: TaskDecoder } -) => TaskDecoder +export declare const union: , ...TaskDecoder[]]>( + ...members: MS +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.7 # constructors -## fromDecoder +## fromKleisliDecoder **Signature** ```ts -export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder +export declare const fromKleisliDecoder: (decoder: D.Decoder) => TaskDecoder ``` Added in v2.2.7 -## fromGuard +## fromRefinement **Signature** ```ts -export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder +export declare const fromRefinement: ( + refinement: Refinement, + expected: string +) => TaskDecoder ``` Added in v2.2.7 @@ -322,62 +320,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: (...values: A) => TaskDecoder -``` - -Added in v2.2.7 - -# instances - -## URI - -**Signature** - -```ts -export declare const URI: 'io-ts/TaskDecoder' -``` - -Added in v2.2.7 - -## URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.7 - -## altTaskDecoder - -**Signature** - -```ts -export declare const altTaskDecoder: Alt1<'io-ts/TaskDecoder'> -``` - -Added in v2.2.7 - -## functorTaskDecoder - -**Signature** - -```ts -export declare const functorTaskDecoder: Functor1<'io-ts/TaskDecoder'> -``` - -Added in v2.2.7 - -## schemableTaskDecoder - -**Signature** - -```ts -export declare const schemableTaskDecoder: Schemable1<'io-ts/TaskDecoder'> & - WithUnknownContainers1<'io-ts/TaskDecoder'> & - WithUnion1<'io-ts/TaskDecoder'> & - WithRefine1<'io-ts/TaskDecoder'> +export declare const literal: ( + ...values: A +) => TaskDecoder ``` Added in v2.2.7 @@ -389,81 +334,29 @@ Added in v2.2.7 **Signature** ```ts -export interface TaskDecoder extends KTD.KleisliTaskDecoder {} -``` - -Added in v2.2.7 - -# primitives - -## UnknownArray - -**Signature** - -```ts -export declare const UnknownArray: TaskDecoder -``` - -Added in v2.2.7 - -## UnknownRecord - -**Signature** - -```ts -export declare const UnknownRecord: TaskDecoder> -``` - -Added in v2.2.7 - -## boolean - -**Signature** - -```ts -export declare const boolean: TaskDecoder -``` - -Added in v2.2.7 - -## number - -**Signature** - -```ts -export declare const number: TaskDecoder -``` - -Added in v2.2.7 - -## string - -**Signature** - -```ts -export declare const string: TaskDecoder +export interface TaskDecoder extends K.Kleisli {} ``` Added in v2.2.7 # utils -## TypeOf (type alias) +## InputOf (type alias) **Signature** ```ts -export type TypeOf = KTD.TypeOf +export type InputOf = K.InputOf ``` Added in v2.2.7 -## draw +## TypeOf (type alias) **Signature** ```ts -export declare const draw: (e: FreeSemigroup>) => string +export type TypeOf = K.TypeOf ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 6057965d2..9007c9c1e 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 19 +nav_order: 17 parent: Modules --- @@ -34,9 +34,9 @@ Added in v2.2.3 - [constructors](#constructors) - [literal](#literal) - [instances](#instances) + - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) - - [schemableType](#schemabletype) - [model](#model) - [Type (interface)](#type-interface) - [primitives](#primitives) @@ -178,35 +178,35 @@ Added in v2.2.3 # instances -## URI +## Schemable **Signature** ```ts -export declare const URI: 'io-ts/Type' +export declare const Schemable: Schemable1<'io-ts/Type'> & + WithUnknownContainers1<'io-ts/Type'> & + WithUnion1<'io-ts/Type'> & + WithRefine1<'io-ts/Type'> ``` Added in v2.2.3 -## URI (type alias) +## URI **Signature** ```ts -export type URI = typeof URI +export declare const URI: 'io-ts/Type' ``` Added in v2.2.3 -## schemableType +## URI (type alias) **Signature** ```ts -export declare const schemableType: Schemable1<'io-ts/Type'> & - WithUnknownContainers1<'io-ts/Type'> & - WithUnion1<'io-ts/Type'> & - WithRefine1<'io-ts/Type'> +export type URI = typeof URI ``` Added in v2.2.3 diff --git a/docs/modules/UnknownDecoder.ts.md b/docs/modules/UnknownDecoder.ts.md new file mode 100644 index 000000000..3fdb43ebb --- /dev/null +++ b/docs/modules/UnknownDecoder.ts.md @@ -0,0 +1,458 @@ +--- +title: UnknownDecoder.ts +nav_order: 18 +parent: Modules +--- + +## UnknownDecoder overview + +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [Alt](#alt) + - [alt](#alt) +- [DecodeError](#decodeerror) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [error](#error) + - [failure](#failure) + - [success](#success) +- [Functor](#functor) + - [map](#map) +- [combinators](#combinators) + - [array](#array) + - [compose](#compose) + - [intersect](#intersect) + - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) + - [nullable](#nullable) + - [parse](#parse) + - [partial](#partial) + - [record](#record) + - [refine](#refine) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [constructors](#constructors) + - [fromGuard](#fromguard) + - [literal](#literal) +- [instances](#instances) + - [Alt](#alt-1) + - [Functor](#functor-1) + - [Schemable](#schemable) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) +- [model](#model) + - [UnknownDecoder (interface)](#unknowndecoder-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) + - [draw](#draw) + +--- + +# Alt + +## alt + +**Signature** + +```ts +export declare const alt: (that: () => UnknownDecoder) => (me: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +# DecodeError + +## DecodeError (type alias) + +**Signature** + +```ts +export type DecodeError = D.DecodeError +``` + +Added in v2.2.7 + +## error + +**Signature** + +```ts +export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> +``` + +Added in v2.2.7 + +## failure + +**Signature** + +```ts +export declare const failure: ( + actual: unknown, + message: string +) => E.Either>, A> +``` + +Added in v2.2.7 + +## success + +**Signature** + +```ts +export declare const success: (a: A) => E.Either>, A> +``` + +Added in v2.2.7 + +# Functor + +## map + +**Signature** + +```ts +export declare const map: (f: (a: A) => B) => (fa: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +# combinators + +## array + +**Signature** + +```ts +export declare const array: (items: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## compose + +**Signature** + +```ts +export declare const compose: (to: D.Decoder) => (from: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## intersect + +**Signature** + +```ts +export declare const intersect: (right: UnknownDecoder) => (left: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## lazy + +**Signature** + +```ts +export declare const lazy: (id: string, f: () => UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## mapLeftWithInput + +**Signature** + +```ts +export declare const mapLeftWithInput: ( + f: (input: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## nullable + +**Signature** + +```ts +export declare const nullable: (or: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## parse + +**Signature** + +```ts +export declare const parse: ( + parser: (a: A) => E.Either>, B> +) => (from: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: UnknownDecoder } +) => UnknownDecoder> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare const record: (codomain: UnknownDecoder) => UnknownDecoder> +``` + +Added in v2.2.7 + +## refine + +**Signature** + +```ts +export declare const refine: ( + refinement: (a: A) => a is B, + id: string +) => (from: UnknownDecoder) => UnknownDecoder +``` + +Added in v2.2.7 + +## sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: UnknownDecoder }) => UnknownDecoder +``` + +Added in v2.2.7 + +## tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: UnknownDecoder } +) => UnknownDecoder +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: UnknownDecoder } +) => UnknownDecoder<{ [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 + +## union + +**Signature** + +```ts +export declare const union: ( + ...members: { [K in keyof A]: UnknownDecoder } +) => UnknownDecoder +``` + +Added in v2.2.7 + +# constructors + +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: (guard: G.Guard, expected: string) => UnknownDecoder +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare const literal: (...values: A) => UnknownDecoder +``` + +Added in v2.2.7 + +# instances + +## Alt + +**Signature** + +```ts +export declare const Alt: Alt1<'io-ts/UnknownDecoder'> +``` + +Added in v2.2.7 + +## Functor + +**Signature** + +```ts +export declare const Functor: Functor1<'io-ts/UnknownDecoder'> +``` + +Added in v2.2.7 + +## Schemable + +**Signature** + +```ts +export declare const Schemable: Schemable1<'io-ts/UnknownDecoder'> & + WithUnknownContainers1<'io-ts/UnknownDecoder'> & + WithUnion1<'io-ts/UnknownDecoder'> & + WithRefine1<'io-ts/UnknownDecoder'> +``` + +Added in v2.2.7 + +## URI + +**Signature** + +```ts +export declare const URI: 'io-ts/UnknownDecoder' +``` + +Added in v2.2.7 + +## URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.7 + +# model + +## UnknownDecoder (interface) + +**Signature** + +```ts +export interface UnknownDecoder extends D.Decoder {} +``` + +Added in v2.2.7 + +# primitives + +## UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: UnknownDecoder +``` + +Added in v2.2.7 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: UnknownDecoder> +``` + +Added in v2.2.7 + +## boolean + +**Signature** + +```ts +export declare const boolean: UnknownDecoder +``` + +Added in v2.2.7 + +## number + +**Signature** + +```ts +export declare const number: UnknownDecoder +``` + +Added in v2.2.7 + +## string + +**Signature** + +```ts +export declare const string: UnknownDecoder +``` + +Added in v2.2.7 + +# utils + +## TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = D.TypeOf +``` + +Added in v2.2.7 + +## draw + +**Signature** + +```ts +export declare const draw: (e: FS.FreeSemigroup>) => string +``` + +Added in v2.2.7 diff --git a/docs/modules/UnknownTaskDecoder.ts.md b/docs/modules/UnknownTaskDecoder.ts.md new file mode 100644 index 000000000..69eb69e1a --- /dev/null +++ b/docs/modules/UnknownTaskDecoder.ts.md @@ -0,0 +1,475 @@ +--- +title: UnknownTaskDecoder.ts +nav_order: 19 +parent: Modules +--- + +## UnknownTaskDecoder overview + +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + +Added in v2.2.7 + +--- + +

Table of contents

+ +- [Alt](#alt) + - [alt](#alt) +- [DecodeError](#decodeerror) + - [DecodeError (type alias)](#decodeerror-type-alias) + - [error](#error) + - [failure](#failure) + - [success](#success) +- [Functor](#functor) + - [map](#map) +- [combinators](#combinators) + - [array](#array) + - [compose](#compose) + - [intersect](#intersect) + - [lazy](#lazy) + - [mapLeftWithInput](#mapleftwithinput) + - [nullable](#nullable) + - [parse](#parse) + - [partial](#partial) + - [record](#record) + - [refine](#refine) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [constructors](#constructors) + - [fromDecoder](#fromdecoder) + - [fromGuard](#fromguard) + - [literal](#literal) +- [instances](#instances) + - [Alt](#alt-1) + - [Functor](#functor-1) + - [Schemable](#schemable) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) +- [model](#model) + - [UnknownTaskDecoder (interface)](#unknowntaskdecoder-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) +- [utils](#utils) + - [TypeOf (type alias)](#typeof-type-alias) + - [draw](#draw) + +--- + +# Alt + +## alt + +**Signature** + +```ts +export declare const alt:
(that: () => UnknownTaskDecoder) => (me: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +# DecodeError + +## DecodeError (type alias) + +**Signature** + +```ts +export type DecodeError = D.DecodeError +``` + +Added in v2.2.7 + +## error + +**Signature** + +```ts +export declare const error: (actual: unknown, message: string) => FreeSemigroup> +``` + +Added in v2.2.7 + +## failure + +**Signature** + +```ts +export declare const failure: ( + actual: unknown, + message: string +) => TE.TaskEither>, A> +``` + +Added in v2.2.7 + +## success + +**Signature** + +```ts +export declare const success: (a: A) => TE.TaskEither>, A> +``` + +Added in v2.2.7 + +# Functor + +## map + +**Signature** + +```ts +export declare const map: (f: (a: A) => B) => (fa: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +# combinators + +## array + +**Signature** + +```ts +export declare const array: (items: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## compose + +**Signature** + +```ts +export declare const compose: ( + to: KTD.TaskDecoder +) => (from: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## intersect + +**Signature** + +```ts +export declare const intersect: ( + right: UnknownTaskDecoder +) => (left: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## lazy + +**Signature** + +```ts +export declare const lazy: (id: string, f: () => UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## mapLeftWithInput + +**Signature** + +```ts +export declare const mapLeftWithInput: ( + f: (input: unknown, e: FreeSemigroup>) => FreeSemigroup> +) => (decoder: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## nullable + +**Signature** + +```ts +export declare const nullable: (or: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## parse + +**Signature** + +```ts +export declare const parse: ( + parser: (a: A) => TE.TaskEither>, B> +) => (from: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: UnknownTaskDecoder } +) => UnknownTaskDecoder> +``` + +Added in v2.2.7 + +## record + +**Signature** + +```ts +export declare const record: (codomain: UnknownTaskDecoder) => UnknownTaskDecoder> +``` + +Added in v2.2.7 + +## refine + +**Signature** + +```ts +export declare const refine: ( + refinement: (a: A) => a is B, + id: string +) => (from: UnknownTaskDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## sum + +**Signature** + +```ts +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: UnknownTaskDecoder }) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## tuple + +**Signature** + +```ts +export declare const tuple: ( + ...components: { [K in keyof A]: UnknownTaskDecoder } +) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## type + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: UnknownTaskDecoder } +) => UnknownTaskDecoder<{ [K in keyof A]: A[K] }> +``` + +Added in v2.2.7 + +## union + +**Signature** + +```ts +export declare const union: ( + ...members: { [K in keyof A]: UnknownTaskDecoder } +) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +# constructors + +## fromDecoder + +**Signature** + +```ts +export declare const fromDecoder: (decoder: D.UnknownDecoder) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: (guard: G.Guard, expected: string) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +## literal + +**Signature** + +```ts +export declare const literal: ( + ...values: A +) => UnknownTaskDecoder +``` + +Added in v2.2.7 + +# instances + +## Alt + +**Signature** + +```ts +export declare const Alt: Alt1<'io-ts/UnknownTaskDecoder'> +``` + +Added in v2.2.7 + +## Functor + +**Signature** + +```ts +export declare const Functor: Functor1<'io-ts/UnknownTaskDecoder'> +``` + +Added in v2.2.7 + +## Schemable + +**Signature** + +```ts +export declare const Schemable: Schemable1<'io-ts/UnknownTaskDecoder'> & + WithUnknownContainers1<'io-ts/UnknownTaskDecoder'> & + WithUnion1<'io-ts/UnknownTaskDecoder'> & + WithRefine1<'io-ts/UnknownTaskDecoder'> +``` + +Added in v2.2.7 + +## URI + +**Signature** + +```ts +export declare const URI: 'io-ts/UnknownTaskDecoder' +``` + +Added in v2.2.7 + +## URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.7 + +# model + +## UnknownTaskDecoder (interface) + +**Signature** + +```ts +export interface UnknownTaskDecoder extends KTD.TaskDecoder {} +``` + +Added in v2.2.7 + +# primitives + +## UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: UnknownTaskDecoder +``` + +Added in v2.2.7 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: UnknownTaskDecoder> +``` + +Added in v2.2.7 + +## boolean + +**Signature** + +```ts +export declare const boolean: UnknownTaskDecoder +``` + +Added in v2.2.7 + +## number + +**Signature** + +```ts +export declare const number: UnknownTaskDecoder +``` + +Added in v2.2.7 + +## string + +**Signature** + +```ts +export declare const string: UnknownTaskDecoder +``` + +Added in v2.2.7 + +# utils + +## TypeOf (type alias) + +**Signature** + +```ts +export type TypeOf = KTD.TypeOf +``` + +Added in v2.2.7 + +## draw + +**Signature** + +```ts +export declare const draw: (e: FreeSemigroup>) => string +``` + +Added in v2.2.7 diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index c0039c6a8..d6e41cafe 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -1,37 +1,46 @@ import * as _ from '../../src/Decoder' -import * as DE from '../../src/DecodeError' -import * as FS from '../../src/FreeSemigroup' -import { pipe } from 'fp-ts/lib/pipeable' - -// $ExpectType Decoder<{ a: string; b: { c: number; }; }> -const A = _.type({ - a: _.string, - b: _.type({ - c: _.number - }) + +declare const string: _.Decoder +declare const NumberFromString: _.Decoder + +// +// type +// + +// $ExpectType Decoder<{ a: string; }, { a: number; }> +_.type({ + a: NumberFromString }) -// $ExpectType Decoder; }>> +// +// partial +// + +// $ExpectType Decoder<{ a: string; }, Partial<{ a: number; }>> _.partial({ - a: _.string, - b: _.partial({ - c: _.number - }) + a: NumberFromString }) // -// TypeOf +// tuple +// + +// $ExpectType Decoder<[string], [number]> +_.tuple(NumberFromString) + +// +// sum // -// $ExpectType { a: string; b: { c: number; }; } -export type A = _.TypeOf +// $ExpectType Decoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: NumberFromString }), + B: _.type({ _tag: _.literal('B'), b: NumberFromString }) +}) // -// mapLeftWithInput +// union // -// $ExpectType Decoder -pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) -) +// $ExpectType Decoder +_.union(NumberFromString, string) diff --git a/dtslint/ts3.5/KleisliDecoder.ts b/dtslint/ts3.5/KleisliDecoder.ts deleted file mode 100644 index 0c9af0fb8..000000000 --- a/dtslint/ts3.5/KleisliDecoder.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as _ from '../../src/KleisliDecoder' - -declare const string: _.KleisliDecoder -declare const NumberFromString: _.KleisliDecoder - -// -// type -// - -// $ExpectType KleisliDecoder<{ a: string; }, { a: number; }> -_.type({ - a: NumberFromString -}) - -// -// partial -// - -// $ExpectType KleisliDecoder<{ a: string; }, Partial<{ a: number; }>> -_.partial({ - a: NumberFromString -}) - -// -// tuple -// - -// $ExpectType KleisliDecoder<[string], [number]> -_.tuple(NumberFromString) - -// -// sum -// - -// $ExpectType KleisliDecoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: NumberFromString }), - B: _.type({ _tag: _.literal('B'), b: NumberFromString }) -}) - -// -// union -// - -// $ExpectType KleisliDecoder -_.union(NumberFromString, string) diff --git a/dtslint/ts3.5/KleisliTaskDecoder.ts b/dtslint/ts3.5/KleisliTaskDecoder.ts deleted file mode 100644 index 5980e22f0..000000000 --- a/dtslint/ts3.5/KleisliTaskDecoder.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as _ from '../../src/KleisliTaskDecoder' - -declare const string: _.KleisliTaskDecoder -declare const NumberFromString: _.KleisliTaskDecoder - -// -// type -// - -// $ExpectType KleisliTaskDecoder<{ a: string; }, { a: number; }> -_.type({ - a: NumberFromString -}) - -// -// partial -// - -// $ExpectType KleisliTaskDecoder<{ a: string; }, Partial<{ a: number; }>> -_.partial({ - a: NumberFromString -}) - -// -// tuple -// - -// $ExpectType KleisliTaskDecoder<[string], [number]> -_.tuple(NumberFromString) - -// -// sum -// - -// $ExpectType KleisliTaskDecoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: NumberFromString }), - B: _.type({ _tag: _.literal('B'), b: NumberFromString }) -}) - -// -// union -// - -// $ExpectType KleisliTaskDecoder -_.union(NumberFromString, string) diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts index add91cdf6..acf7fefdc 100644 --- a/dtslint/ts3.5/TaskDecoder.ts +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -1,37 +1,46 @@ import * as _ from '../../src/TaskDecoder' -import * as DE from '../../src/DecodeError' -import * as FS from '../../src/FreeSemigroup' -import { pipe } from 'fp-ts/lib/pipeable' - -// $ExpectType TaskDecoder<{ a: string; b: { c: number; }; }> -const A = _.type({ - a: _.string, - b: _.type({ - c: _.number - }) + +declare const string: _.TaskDecoder +declare const NumberFromString: _.TaskDecoder + +// +// type +// + +// $ExpectType TaskDecoder<{ a: string; }, { a: number; }> +_.type({ + a: NumberFromString }) -// $ExpectType TaskDecoder; }>> +// +// partial +// + +// $ExpectType TaskDecoder<{ a: string; }, Partial<{ a: number; }>> _.partial({ - a: _.string, - b: _.partial({ - c: _.number - }) + a: NumberFromString }) // -// TypeOf +// tuple +// + +// $ExpectType TaskDecoder<[string], [number]> +_.tuple(NumberFromString) + +// +// sum // -// $ExpectType { a: string; b: { c: number; }; } -export type A = _.TypeOf +// $ExpectType TaskDecoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: NumberFromString }), + B: _.type({ _tag: _.literal('B'), b: NumberFromString }) +}) // -// mapLeftWithInput +// union // -// $ExpectType TaskDecoder -pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) -) +// $ExpectType TaskDecoder +_.union(NumberFromString, string) diff --git a/dtslint/ts3.5/UnknownDecoder.ts b/dtslint/ts3.5/UnknownDecoder.ts new file mode 100644 index 000000000..300d6eead --- /dev/null +++ b/dtslint/ts3.5/UnknownDecoder.ts @@ -0,0 +1,37 @@ +import * as _ from '../../src/UnknownDecoder' +import * as DE from '../../src/DecodeError' +import * as FS from '../../src/FreeSemigroup' +import { pipe } from 'fp-ts/lib/pipeable' + +// $ExpectType UnknownDecoder<{ a: string; b: { c: number; }; }> +const A = _.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType UnknownDecoder; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) + +// +// TypeOf +// + +// $ExpectType { a: string; b: { c: number; }; } +export type A = _.TypeOf + +// +// mapLeftWithInput +// + +// $ExpectType UnknownDecoder +pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) +) diff --git a/dtslint/ts3.5/UnknownTaskDecoder.ts b/dtslint/ts3.5/UnknownTaskDecoder.ts new file mode 100644 index 000000000..08542e9a3 --- /dev/null +++ b/dtslint/ts3.5/UnknownTaskDecoder.ts @@ -0,0 +1,37 @@ +import * as _ from '../../src/UnknownTaskDecoder' +import * as DE from '../../src/DecodeError' +import * as FS from '../../src/FreeSemigroup' +import { pipe } from 'fp-ts/lib/pipeable' + +// $ExpectType UnknownTaskDecoder<{ a: string; b: { c: number; }; }> +const A = _.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType UnknownTaskDecoder; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) + +// +// TypeOf +// + +// $ExpectType { a: string; b: { c: number; }; } +export type A = _.TypeOf + +// +// mapLeftWithInput +// + +// $ExpectType UnknownTaskDecoder +pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) +) diff --git a/index.md b/index.md index d1b51beb5..4296fded5 100644 --- a/index.md +++ b/index.md @@ -415,7 +415,7 @@ type C = { } ``` -You can apply `partial` to an already defined codec via its `props` field +You can apply `partial` to an already `type`-defined codec via its `props` field ```ts const PartialUser = t.partial(User.props) diff --git a/package.json b/package.json index 7177a0429..62f951559 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "perf": "ts-node perf/index", "dtslint": "dtslint dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", - "doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", + "doctoc": "doctoc README.md index.md UnknownDecoder.md Encoder.md Codec.md Eq.md Schema.md", "docs": "docs-ts", "import-path-rewrite": "import-path-rewrite" }, diff --git a/src/Codec.ts b/src/Codec.ts index cf43bfa5d..d11b77c7e 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -9,7 +9,7 @@ * @since 2.2.3 */ import { Invariant2 } from 'fp-ts/lib/Invariant' -import * as D from './Decoder' +import * as D from './UnknownDecoder' import * as E from './Encoder' import { Literal } from './Schemable' import { identity } from 'fp-ts/lib/function' @@ -28,7 +28,7 @@ import { pipe } from 'fp-ts/lib/pipeable' * @category model * @since 2.2.3 */ -export interface Codec extends D.Decoder, E.Encoder {} +export interface Codec extends D.UnknownDecoder, E.Encoder {} // ------------------------------------------------------------------------------------- // utils @@ -52,7 +52,7 @@ export type OutputOf = E.OutputOf * @category constructors * @since 2.2.3 */ -export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { +export function make(decoder: D.UnknownDecoder, encoder: E.Encoder): Codec { return { decode: decoder.decode, encode: encoder.encode @@ -63,7 +63,7 @@ export function make(decoder: D.Decoder, encoder: E.Encoder): Cod * @category constructors * @since 2.2.3 */ -export function fromDecoder(decoder: D.Decoder): Codec { +export function fromDecoder(decoder: D.UnknownDecoder): Codec { return { decode: decoder.decode, encode: identity @@ -151,7 +151,7 @@ export function nullable(or: Codec): Codec { export function type

>>( properties: P ): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { - const decoder: D.Decoder<{ [K in keyof P]: TypeOf }> = D.type(properties) as any + const decoder: D.UnknownDecoder<{ [K in keyof P]: TypeOf }> = D.type(properties) as any return make(decoder, E.type(properties)) } @@ -190,7 +190,7 @@ export function array(items: Codec): Codec, Array> { export function tuple>>( ...components: C ): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> { - const decoder: D.Decoder<{ [K in keyof C]: TypeOf }> = D.tuple(...components) as any + const decoder: D.UnknownDecoder<{ [K in keyof C]: TypeOf }> = D.tuple(...components) as any const encoder = E.tuple(...components) return make(decoder, encoder) } @@ -237,7 +237,7 @@ export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec imap_(fa, f, g) const imap_: (fa: Codec, f: (a: A) => B, g: (b: B) => A) => Codec = (fa, f, g) => - make(D.functorDecoder.map(fa, f), E.contravariantEncoder.contramap(fa, g)) + make(D.Functor.map(fa, f), E.Contravariant.contramap(fa, g)) // ------------------------------------------------------------------------------------- // instances @@ -265,7 +265,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const invariantCodec: Invariant2 = { +export const Invariant: Invariant2 = { URI, imap: imap_ } diff --git a/src/Decoder.ts b/src/Decoder.ts index 0038c5446..efdfae3c9 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -8,15 +8,61 @@ * * @since 2.2.7 */ -import { Alt1 } from 'fp-ts/lib/Alt' +import { Alt2C } from 'fp-ts/lib/Alt' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import * as E from 'fp-ts/lib/Either' -import { Functor1 } from 'fp-ts/lib/Functor' +import { Refinement } from 'fp-ts/lib/function' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' -import * as G from './Guard' -import * as KD from './KleisliDecoder' -import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import * as K from './Kleisli' +import { Literal } from './Schemable' + +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- + +/** + * @internal + */ +export const SE = + /*#__PURE__*/ + DE.getSemigroup() + +/** + * @internal + */ +export const ap = ( + fab: E.Either B>, + fa: E.Either +): E.Either => + E.isLeft(fab) + ? E.isLeft(fa) + ? E.left(SE.concat(fab.left, fa.left)) + : fab + : E.isLeft(fa) + ? fa + : E.right(fab.right(fa.right)) + +const M: MonadThrow2C & Bifunctor2 & Alt2C = { + URI: E.URI, + _E: undefined as any, + map: (fa, f) => pipe(fa, E.map(f)), + ap, + of: E.right, + chain: (ma, f) => pipe(ma, E.chain(f)), + throwError: E.left, + bimap: (fa, f, g) => pipe(fa, E.bimap(f, g)), + mapLeft: (fa, f) => pipe(fa, E.mapLeft(f)), + alt: (me, that) => { + if (E.isRight(me)) { + return me + } + const ea = that() + return E.isLeft(ea) ? E.left(SE.concat(me.left, ea.left)) : ea + } +} // ------------------------------------------------------------------------------------- // model @@ -26,7 +72,7 @@ import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } * @category model * @since 2.2.7 */ -export interface Decoder extends KD.KleisliDecoder {} +export interface Decoder extends K.Kleisli {} // ------------------------------------------------------------------------------------- // DecodeError @@ -36,25 +82,26 @@ export interface Decoder extends KD.KleisliDecoder {} * @category DecodeError * @since 2.2.7 */ -export type DecodeError = KD.DecodeError +export type DecodeError = FS.FreeSemigroup> /** * @category DecodeError * @since 2.2.7 */ -export const error: (actual: unknown, message: string) => DecodeError = KD.error +export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) /** * @category DecodeError * @since 2.2.7 */ -export const success: (a: A) => E.Either = KD.success +export const success: (a: A) => E.Either = E.right /** * @category DecodeError * @since 2.2.7 */ -export const failure: (actual: unknown, message: string) => E.Either = KD.failure +export const failure = (actual: unknown, message: string): E.Either => + E.left(error(actual, message)) // ------------------------------------------------------------------------------------- // constructors @@ -64,64 +111,16 @@ export const failure: (actual: unknown, message: string) => E.Either< * @category constructors * @since 2.2.7 */ -export const fromGuard = (guard: G.Guard, expected: string): Decoder => KD.fromRefinement(guard.is, expected) +export const fromRefinement = (refinement: Refinement, expected: string): Decoder => + K.fromRefinement(M)(refinement, (u) => error(u, expected)) /** * @category constructors * @since 2.2.7 */ -export const literal: ]>(...values: A) => Decoder = KD.literal - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.7 - */ -export const string: Decoder = - /*#__PURE__*/ - fromGuard(G.string, 'string') - -/** - * @category primitives - * @since 2.2.7 - */ -export const number: Decoder = +export const literal: ]>(...values: A) => Decoder = /*#__PURE__*/ - fromGuard(G.number, 'number') - -/** - * @category primitives - * @since 2.2.7 - */ -export const boolean: Decoder = - /*#__PURE__*/ - fromGuard(G.boolean, 'boolean') - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownArray: Decoder> = - /*#__PURE__*/ - fromGuard(G.UnknownArray, 'Array') - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownRecord: Decoder> = - /*#__PURE__*/ - fromGuard(G.UnknownRecord, 'Record') - -/** - * @internal - */ -export const object: Decoder = - /*#__PURE__*/ - fromGuard(G.object, 'object') + K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) // ------------------------------------------------------------------------------------- // combinators @@ -131,103 +130,128 @@ export const object: Decoder = * @category combinators * @since 2.2.7 */ -export const mapLeftWithInput: ( - f: (input: unknown, e: DecodeError) => DecodeError -) => (decoder: Decoder) => Decoder = KD.mapLeftWithInput +export const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: Decoder) => Decoder = + /*#__PURE__*/ + K.mapLeftWithInput(M) /** * @category combinators * @since 2.2.7 */ -export const refine: (refinement: (a: A) => a is B, id: string) => (from: Decoder) => Decoder = - KD.refine +export const refine = ( + refinement: (a: A) => a is B, + id: string +): ((from: Decoder) => Decoder) => K.refine(M)(refinement, (a) => error(a, id)) /** * @category combinators * @since 2.2.7 */ -export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = KD.parse +export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = + /*#__PURE__*/ + K.parse(M) /** * @category combinators * @since 2.2.7 */ -export const nullable: (or: Decoder) => Decoder = KD.nullable +export const nullable: (or: Decoder) => Decoder = + /*#__PURE__*/ + K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ -export const type = (properties: { [K in keyof A]: Decoder }): Decoder<{ [K in keyof A]: A[K] }> => - pipe(object as any, compose(KD.type(properties))) +export const type =

>>( + properties: P +): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => + K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators * @since 2.2.7 */ -export const partial = (properties: { [K in keyof A]: Decoder }): Decoder> => - pipe(object as any, compose(KD.partial(properties))) +export const partial =

>>( + properties: P +): Decoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => + K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** * @category combinators * @since 2.2.7 */ -export const array = (items: Decoder): Decoder> => pipe(UnknownArray, compose(KD.array(items))) +export const array = (items: Decoder): Decoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) /** * @category combinators * @since 2.2.7 */ -export const record = (codomain: Decoder): Decoder> => - pipe(UnknownRecord, compose(KD.record(codomain))) +export const record = (codomain: Decoder): Decoder, Record> => + K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.7 */ -export const tuple = >(...components: { [K in keyof A]: Decoder }): Decoder => - pipe(UnknownArray as any, compose(KD.tuple(...components))) as any +export const tuple = >>( + ...components: C +): Decoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => + K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators * @since 2.2.7 */ -export const union: ]>( - ...members: { [K in keyof A]: Decoder } -) => Decoder = KD.union as any +export const union: , ...Array>]>( + ...members: MS +) => Decoder, TypeOf> = + /*#__PURE__*/ + K.union(M)((i, e) => FS.of(DE.member(i, e))) /** * @category combinators * @since 2.2.7 */ -export const intersect: (right: Decoder) => (left: Decoder) => Decoder = KD.intersect +export const intersect: (right: Decoder) => (left: Decoder) => Decoder = + /*#__PURE__*/ + K.intersect(M) /** * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => (members: { [K in keyof A]: Decoder }): Decoder => - pipe(object as any, compose(KD.sum(tag)(members))) +export const sum = (tag: T) => >>( + members: MS +): Decoder, TypeOf> => + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) + ) + )(tag)(members) /** * @category combinators * @since 2.2.7 */ -export const lazy: (id: string, f: () => Decoder) => Decoder = KD.lazy +export const lazy: (id: string, f: () => Decoder) => Decoder = + /*#__PURE__*/ + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) /** * @category combinators * @since 2.2.7 */ -export const compose: (to: KD.KleisliDecoder) => (from: Decoder) => Decoder = KD.compose - -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- - -const map_: (fa: Decoder, f: (a: A) => B) => Decoder = (fa, f) => pipe(fa, map(f)) - -const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, that) => pipe(me, alt(that)) +export const compose: (to: Decoder) => (from: Decoder) => Decoder = + /*#__PURE__*/ + K.compose(M) // ------------------------------------------------------------------------------------- // pipeables @@ -237,79 +261,17 @@ const alt_: (me: Decoder, that: () => Decoder) => Decoder = (me, tha * @category Functor * @since 2.2.7 */ -export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = KD.map +export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = + /*#__PURE__*/ + K.map(M) /** * @category Alt * @since 2.2.7 */ -export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = KD.alt - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @category instances - * @since 2.2.7 - */ -export const URI = 'io-ts/Decoder' - -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: Decoder - } -} - -/** - * @category instances - * @since 2.2.7 - */ -export const functorDecoder: Functor1 = { - URI, - map: map_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const altDecoder: Alt1 = { - URI, - map: map_, - alt: alt_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const schemableDecoder: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { - URI, - literal, - string, - number, - boolean, - nullable, - type, - partial, - record, - array, - tuple: tuple as Schemable1['tuple'], - intersect, - sum, - lazy, - UnknownArray, - UnknownRecord, - union: union as WithUnion1['union'], - refine: refine as WithRefine1['refine'] -} +export const alt: (that: () => Decoder) => (me: Decoder) => Decoder = + /*#__PURE__*/ + K.alt(M) // ------------------------------------------------------------------------------------- // utils @@ -318,56 +280,9 @@ export const schemableDecoder: Schemable1 & WithUnknownContainers1 & W /** * @since 2.2.7 */ -export type TypeOf = KD.TypeOf - -interface Tree { - readonly value: A - readonly forest: ReadonlyArray> -} - -const empty: Array = [] - -const make = (value: A, forest: ReadonlyArray> = empty): Tree => ({ - value, - forest -}) - -const drawTree = (tree: Tree): string => tree.value + drawForest('\n', tree.forest) - -const drawForest = (indentation: string, forest: ReadonlyArray>): string => { - let r: string = '' - const len = forest.length - let tree: Tree - for (let i = 0; i < len; i++) { - tree = forest[i] - const isLast = i === len - 1 - r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value - r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest) - } - return r -} - -const toTree: (e: DE.DecodeError) => Tree = DE.fold({ - Leaf: (input, error) => make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => make(`member ${index}`, toForest(errors)), - Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) -}) - -const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( - (value) => [toTree(value)], - (left, right) => toForest(left).concat(toForest(right)) -) +export type TypeOf = K.TypeOf /** * @since 2.2.7 */ -export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') - -/** - * @internal - */ -export const stringify: (e: E.Either) => string = - /*#__PURE__*/ - E.fold(draw, (a) => JSON.stringify(a, null, 2)) +export type InputOf = K.InputOf diff --git a/src/Encoder.ts b/src/Encoder.ts index 9323c1a7f..d03f4865f 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -219,7 +219,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const contravariantEncoder: Contravariant2 = { +export const Contravariant: Contravariant2 = { URI, contramap: contramap_ } @@ -228,7 +228,7 @@ export const contravariantEncoder: Contravariant2 = { * @category instances * @since 2.2.3 */ -export const categoryEncoder: Category2 = { +export const Category: Category2 = { URI, compose: compose_, id diff --git a/src/Eq.ts b/src/Eq.ts index 3889e2eea..f9fe3fc61 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -179,7 +179,7 @@ export function lazy(f: () => Eq): Eq { * @category instances * @since 2.2.3 */ -export const schemableEq: Schemable1 & WithUnknownContainers1 & WithRefine1 = { +export const Schemable: Schemable1 & WithUnknownContainers1 & WithRefine1 = { URI: E.URI, literal: () => E.eqStrict, string, diff --git a/src/Guard.ts b/src/Guard.ts index 021371c01..13040faa7 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -260,7 +260,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const schemableGuard: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { +export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, literal, string, diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index e672454ec..c8450a19b 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -9,7 +9,7 @@ * @since 2.2.3 */ import { Invariant1 } from 'fp-ts/lib/Invariant' -import * as D from './Decoder' +import * as UD from './UnknownDecoder' import * as JE from './JsonEncoder' import * as C from './Codec' import { Literal, Schemable1, WithRefine1 } from './Schemable' @@ -46,7 +46,7 @@ export type TypeOf = JE.TypeOf * @category constructors * @since 2.2.3 */ -export const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec = C.make +export const make: (decoder: UD.UnknownDecoder, encoder: JE.JsonEncoder) => JsonCodec = C.make /** * @category constructors @@ -86,7 +86,7 @@ export const boolean: JsonCodec = C.boolean * @since 2.2.3 */ export const mapLeftWithInput: ( - f: (actual: unknown, e: D.DecodeError) => D.DecodeError + f: (actual: unknown, e: UD.DecodeError) => UD.DecodeError ) => (codec: JsonCodec) => JsonCodec = C.mapLeftWithInput /** @@ -196,16 +196,16 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const invariantJsonCodec: Invariant1 = { +export const Invariant: Invariant1 = { URI, - imap: C.invariantCodec.imap + imap: C.Invariant.imap } /** * @category instances * @since 2.2.3 */ -export const schemableJsonCodec: Schemable1 & WithRefine1 = { +export const Schemable: Schemable1 & WithRefine1 = { URI, literal, string, diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 97b1a63e0..ae89f9bc6 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -170,16 +170,16 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const contravariantJsonEncoder: Contravariant1 = { +export const Contravariant: Contravariant1 = { URI, - contramap: E.contravariantEncoder.contramap + contramap: E.Contravariant.contramap } /** * @category instances * @since 2.2.3 */ -export const schemableJsonEncoder: Schemable1 = { +export const Schemable: Schemable1 = { URI, literal: () => id(), string: id(), diff --git a/src/KleisliDecoder.ts b/src/KleisliDecoder.ts deleted file mode 100644 index c3b3b7dad..000000000 --- a/src/KleisliDecoder.ts +++ /dev/null @@ -1,294 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2C } from 'fp-ts/lib/Alt' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import { pipe } from 'fp-ts/lib/pipeable' -import * as DE from './DecodeError' -import * as FS from './FreeSemigroup' -import * as K from './Kleisli' -import { Literal } from './Schemable' - -// ------------------------------------------------------------------------------------- -// Kleisli config -// ------------------------------------------------------------------------------------- - -/** - * @internal - */ -export const SE = - /*#__PURE__*/ - DE.getSemigroup() - -/** - * @internal - */ -export const ap = ( - fab: E.Either B>, - fa: E.Either -): E.Either => - E.isLeft(fab) - ? E.isLeft(fa) - ? E.left(SE.concat(fab.left, fa.left)) - : fab - : E.isLeft(fa) - ? fa - : E.right(fab.right(fa.right)) - -const M: MonadThrow2C & Bifunctor2 & Alt2C = { - URI: E.URI, - _E: undefined as any, - map: (fa, f) => pipe(fa, E.map(f)), - ap, - of: E.right, - chain: (ma, f) => pipe(ma, E.chain(f)), - throwError: E.left, - bimap: (fa, f, g) => pipe(fa, E.bimap(f, g)), - mapLeft: (fa, f) => pipe(fa, E.mapLeft(f)), - alt: (me, that) => { - if (E.isRight(me)) { - return me - } - const ea = that() - return E.isLeft(ea) ? E.left(SE.concat(me.left, ea.left)) : ea - } -} - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @category model - * @since 2.2.7 - */ -export interface KleisliDecoder extends K.Kleisli {} - -// ------------------------------------------------------------------------------------- -// DecodeError -// ------------------------------------------------------------------------------------- - -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = FS.FreeSemigroup> - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const success: (a: A) => E.Either = E.right - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const failure = (actual: unknown, message: string): E.Either => - E.left(error(actual, message)) - -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromRefinement = (refinement: Refinement, expected: string): KleisliDecoder => - K.fromRefinement(M)(refinement, (u) => error(u, expected)) - -/** - * @category constructors - * @since 2.2.7 - */ -export const literal: ]>( - ...values: A -) => KleisliDecoder = - /*#__PURE__*/ - K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.7 - */ -export const mapLeftWithInput: ( - f: (input: I, e: DecodeError) => DecodeError -) => (decoder: KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.mapLeftWithInput(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const refine = ( - refinement: (a: A) => a is B, - id: string -): ((from: KleisliDecoder) => KleisliDecoder) => K.refine(M)(refinement, (a) => error(a, id)) - -/** - * @category combinators - * @since 2.2.7 - */ -export const parse: ( - parser: (a: A) => E.Either -) => (from: KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.parse(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const nullable: (or: KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e)))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const type =

>>( - properties: P -): KleisliDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) - -/** - * @category combinators - * @since 2.2.7 - */ -export const partial =

>>( - properties: P -): KleisliDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => - K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) - -/** - * @category combinators - * @since 2.2.7 - */ -export const array = (items: KleisliDecoder): KleisliDecoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) - -/** - * @category combinators - * @since 2.2.7 - */ -export const record = (codomain: KleisliDecoder): KleisliDecoder, Record> => - K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) - -/** - * @category combinators - * @since 2.2.7 - */ -export const tuple = >>( - ...components: C -): KleisliDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) - -/** - * @category combinators - * @since 2.2.7 - */ -export const union: , ...Array>]>( - ...members: MS -) => KleisliDecoder, TypeOf> = - /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const intersect: ( - right: KleisliDecoder -) => (left: KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.intersect(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const sum = (tag: T) => >>( - members: MS -): KleisliDecoder, TypeOf> => - K.sum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) - ) - ) - )(tag)(members) - -/** - * @category combinators - * @since 2.2.7 - */ -export const lazy: (id: string, f: () => KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const compose: (to: KleisliDecoder) => (from: KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.compose(M) - -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- - -/** - * @category Functor - * @since 2.2.7 - */ -export const map: (f: (a: A) => B) => (fa: KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.map(M) - -/** - * @category Alt - * @since 2.2.7 - */ -export const alt: (that: () => KleisliDecoder) => (me: KleisliDecoder) => KleisliDecoder = - /*#__PURE__*/ - K.alt(M) - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.7 - */ -export type TypeOf = K.TypeOf - -/** - * @since 2.2.7 - */ -export type InputOf = K.InputOf diff --git a/src/KleisliTaskDecoder.ts b/src/KleisliTaskDecoder.ts deleted file mode 100644 index ade185fc8..000000000 --- a/src/KleisliTaskDecoder.ts +++ /dev/null @@ -1,303 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2C } from 'fp-ts/lib/Alt' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import { pipe } from 'fp-ts/lib/pipeable' -import * as T from 'fp-ts/lib/Task' -import * as TE from 'fp-ts/lib/TaskEither' -import * as DE from './DecodeError' -import * as FS from './FreeSemigroup' -import * as K from './Kleisli' -import * as KD from './KleisliDecoder' -import { Literal } from './Schemable' - -// ------------------------------------------------------------------------------------- -// Kleisli config -// ------------------------------------------------------------------------------------- - -const M: MonadThrow2C & Bifunctor2 & Alt2C = { - URI: TE.URI, - _E: undefined as any, - map: (fa, f) => pipe(fa, TE.map(f)), - ap: (fab: TE.TaskEither B>, fa: TE.TaskEither) => - pipe( - pipe( - fab, - T.map((h) => (ga: E.Either) => KD.ap(h, ga)) - ), - T.ap(fa) - ), - of: TE.right, - chain: (ma, f) => pipe(ma, TE.chain(f)), - throwError: TE.left, - bimap: (fa, f, g) => pipe(fa, TE.bimap(f, g)), - mapLeft: (fa, f) => pipe(fa, TE.mapLeft(f)), - alt: (me, that) => - pipe( - me, - T.chain((e1) => - E.isRight(e1) - ? T.of(e1) - : pipe( - that(), - T.map((e2) => (E.isLeft(e2) ? E.left(KD.SE.concat(e1.left, e2.left)) : e2)) - ) - ) - ) -} - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @category model - * @since 2.2.7 - */ -export interface KleisliTaskDecoder extends K.Kleisli {} - -// ------------------------------------------------------------------------------------- -// DecodeError -// ------------------------------------------------------------------------------------- - -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = KD.DecodeError - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const error: (actual: unknown, message: string) => DecodeError = KD.error - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const success: (a: A) => TE.TaskEither = TE.right - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const failure = (actual: unknown, message: string): TE.TaskEither => - TE.left(KD.error(actual, message)) - -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromKleisliDecoder = (decoder: KD.KleisliDecoder): KleisliTaskDecoder => ({ - decode: TE.fromEitherK(decoder.decode) -}) - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromRefinement = ( - refinement: Refinement, - expected: string -): KleisliTaskDecoder => fromKleisliDecoder(KD.fromRefinement(refinement, expected)) - -/** - * @category constructors - * @since 2.2.7 - */ -export const literal: ]>( - ...values: A -) => KleisliTaskDecoder = - /*#__PURE__*/ - K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.7 - */ -export const mapLeftWithInput: ( - f: (input: I, e: DecodeError) => DecodeError -) => (decoder: KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.mapLeftWithInput(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const refine = ( - refinement: (a: A) => a is B, - id: string -): ((from: KleisliTaskDecoder) => KleisliTaskDecoder) => K.refine(M)(refinement, (a) => error(a, id)) - -/** - * @category combinators - * @since 2.2.7 - */ -export const parse: ( - parser: (a: A) => TE.TaskEither -) => (from: KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.parse(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const nullable: (or: KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e)))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const type =

>>( - properties: P -): KleisliTaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) - -/** - * @category combinators - * @since 2.2.7 - */ -export const partial =

>>( - properties: P -): KleisliTaskDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => - K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) - -/** - * @category combinators - * @since 2.2.7 - */ -export const array = (items: KleisliTaskDecoder): KleisliTaskDecoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) - -/** - * @category combinators - * @since 2.2.7 - */ -export const record = ( - codomain: KleisliTaskDecoder -): KleisliTaskDecoder, Record> => - K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) - -/** - * @category combinators - * @since 2.2.7 - */ -export const tuple = >>( - ...components: C -): KleisliTaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) - -/** - * @category combinators - * @since 2.2.7 - */ -export const union: , ...Array>]>( - ...members: MS -) => KleisliTaskDecoder, TypeOf> = - /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const intersect: ( - right: KleisliTaskDecoder -) => (left: KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.intersect(M) - -/** - * @category combinators - * @since 2.2.7 - */ -export const sum = (tag: T) => >>( - members: MS -): KleisliTaskDecoder, TypeOf> => - K.sum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) - ) - ) - )(tag)(members) - -/** - * @category combinators - * @since 2.2.7 - */ -export const lazy: (id: string, f: () => KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const compose: ( - to: KleisliTaskDecoder -) => (from: KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.compose(M) - -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- - -/** - * @category Functor - * @since 2.2.7 - */ -export const map: (f: (a: A) => B) => (fa: KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.map(M) - -/** - * @category Alt - * @since 2.2.7 - */ -export const alt: ( - that: () => KleisliTaskDecoder -) => (me: KleisliTaskDecoder) => KleisliTaskDecoder = - /*#__PURE__*/ - K.alt(M) - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.7 - */ -export type TypeOf = K.TypeOf - -/** - * @since 2.2.7 - */ -export type InputOf = K.InputOf diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index ca87aa9c0..c9e147ec7 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -8,15 +8,54 @@ * * @since 2.2.7 */ -import { Alt1 } from 'fp-ts/lib/Alt' -import { Functor1 } from 'fp-ts/lib/Functor' +import { Alt2C } from 'fp-ts/lib/Alt' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import * as E from 'fp-ts/lib/Either' +import { Refinement } from 'fp-ts/lib/function' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' +import * as DE from './DecodeError' +import * as FS from './FreeSemigroup' +import * as K from './Kleisli' import * as D from './Decoder' -import * as G from './Guard' -import * as KTD from './KleisliTaskDecoder' -import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import { Literal } from './Schemable' + +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- + +const M: MonadThrow2C & Bifunctor2 & Alt2C = { + URI: TE.URI, + _E: undefined as any, + map: (fa, f) => pipe(fa, TE.map(f)), + ap: (fab: TE.TaskEither B>, fa: TE.TaskEither) => + pipe( + pipe( + fab, + T.map((h) => (ga: E.Either) => D.ap(h, ga)) + ), + T.ap(fa) + ), + of: TE.right, + chain: (ma, f) => pipe(ma, TE.chain(f)), + throwError: TE.left, + bimap: (fa, f, g) => pipe(fa, TE.bimap(f, g)), + mapLeft: (fa, f) => pipe(fa, TE.mapLeft(f)), + alt: (me, that) => + pipe( + me, + T.chain((e1) => + E.isRight(e1) + ? T.of(e1) + : pipe( + that(), + T.map((e2) => (E.isLeft(e2) ? E.left(D.SE.concat(e1.left, e2.left)) : e2)) + ) + ) + ) +} // ------------------------------------------------------------------------------------- // model @@ -26,7 +65,7 @@ import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } * @category model * @since 2.2.7 */ -export interface TaskDecoder extends KTD.KleisliTaskDecoder {} +export interface TaskDecoder extends K.Kleisli {} // ------------------------------------------------------------------------------------- // DecodeError @@ -48,13 +87,14 @@ export const error: (actual: unknown, message: string) => DecodeError = D.error * @category DecodeError * @since 2.2.7 */ -export const success: (a: A) => TE.TaskEither = KTD.success +export const success: (a: A) => TE.TaskEither = TE.right /** * @category DecodeError * @since 2.2.7 */ -export const failure: (actual: unknown, message: string) => TE.TaskEither = KTD.failure +export const failure = (actual: unknown, message: string): TE.TaskEither => + TE.left(D.error(actual, message)) // ------------------------------------------------------------------------------------- // constructors @@ -64,72 +104,26 @@ export const failure: (actual: unknown, message: string) => TE.TaskEi * @category constructors * @since 2.2.7 */ -export const fromDecoder: (decoder: D.Decoder) => TaskDecoder = KTD.fromKleisliDecoder +export const fromKleisliDecoder = (decoder: D.Decoder): TaskDecoder => ({ + decode: TE.fromEitherK(decoder.decode) +}) /** * @category constructors * @since 2.2.7 */ -export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => - KTD.fromRefinement(guard.is, expected) +export const fromRefinement = (refinement: Refinement, expected: string): TaskDecoder => + fromKleisliDecoder(D.fromRefinement(refinement, expected)) /** * @category constructors * @since 2.2.7 */ -export const literal: ]>(...values: A) => TaskDecoder = - KTD.literal - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.7 - */ -export const string: TaskDecoder = - /*#__PURE__*/ - fromDecoder(D.string) - -/** - * @category primitives - * @since 2.2.7 - */ -export const number: TaskDecoder = +export const literal: ]>( + ...values: A +) => TaskDecoder = /*#__PURE__*/ - fromDecoder(D.number) - -/** - * @category primitives - * @since 2.2.7 - */ -export const boolean: TaskDecoder = - /*#__PURE__*/ - fromDecoder(D.boolean) - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownArray: TaskDecoder> = - /*#__PURE__*/ - fromDecoder(D.UnknownArray) - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownRecord: TaskDecoder> = - /*#__PURE__*/ - fromDecoder(D.UnknownRecord) - -/** - * @internal - */ -export const object: TaskDecoder = - /*#__PURE__*/ - fromDecoder(D.object) + K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) // ------------------------------------------------------------------------------------- // combinators @@ -139,18 +133,20 @@ export const object: TaskDecoder = * @category combinators * @since 2.2.7 */ -export const mapLeftWithInput: ( - f: (input: unknown, e: DecodeError) => DecodeError -) => (decoder: TaskDecoder) => TaskDecoder = KTD.mapLeftWithInput +export const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.mapLeftWithInput(M) /** * @category combinators * @since 2.2.7 */ -export const refine: ( +export const refine = ( refinement: (a: A) => a is B, id: string -) => (from: TaskDecoder) => TaskDecoder = KTD.refine +): ((from: TaskDecoder) => TaskDecoder) => K.refine(M)(refinement, (a) => error(a, id)) /** * @category combinators @@ -158,91 +154,111 @@ export const refine: ( */ export const parse: ( parser: (a: A) => TE.TaskEither -) => (from: TaskDecoder) => TaskDecoder = KTD.parse +) => (from: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.parse(M) /** * @category combinators * @since 2.2.7 */ -export const nullable: (or: TaskDecoder) => TaskDecoder = KTD.nullable +export const nullable: (or: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.nullable(M)((u, e) => FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e)))) /** * @category combinators * @since 2.2.7 */ -export const type = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder<{ [K in keyof A]: A[K] }> => - pipe(object as any, compose(KTD.type(properties))) +export const type =

>>( + properties: P +): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => + K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators * @since 2.2.7 */ -export const partial = ( - properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(object as any, compose(KTD.partial(properties))) +export const partial =

>>( + properties: P +): TaskDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => + K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** * @category combinators * @since 2.2.7 */ -export const array = (items: TaskDecoder): TaskDecoder> => pipe(UnknownArray, compose(KTD.array(items))) +export const array = (items: TaskDecoder): TaskDecoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) /** * @category combinators * @since 2.2.7 */ -export const record = (codomain: TaskDecoder): TaskDecoder> => - pipe(UnknownRecord, compose(KTD.record(codomain))) +export const record = (codomain: TaskDecoder): TaskDecoder, Record> => + K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.7 */ -export const tuple = >( - ...components: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownArray as any, compose(KTD.tuple(...components))) as any +export const tuple = >>( + ...components: C +): TaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => + K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators * @since 2.2.7 */ -export const union: ]>( - ...members: { [K in keyof A]: TaskDecoder } -) => TaskDecoder = KTD.union as any +export const union: , ...Array>]>( + ...members: MS +) => TaskDecoder, TypeOf> = + /*#__PURE__*/ + K.union(M)((i, e) => FS.of(DE.member(i, e))) /** * @category combinators * @since 2.2.7 */ -export const intersect: (right: TaskDecoder) => (left: TaskDecoder) => TaskDecoder = KTD.intersect +export const intersect: ( + right: TaskDecoder +) => (left: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.intersect(M) /** * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => ( - members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(object as any, compose(KTD.sum(tag)(members))) +export const sum = (tag: T) => >>( + members: MS +): TaskDecoder, TypeOf> => + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) + ) + )(tag)(members) /** * @category combinators * @since 2.2.7 */ -export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = KTD.lazy +export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) /** * @category combinators * @since 2.2.7 */ -export const compose: (to: KTD.KleisliTaskDecoder) => (from: TaskDecoder) => TaskDecoder = KTD.compose - -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- - -const map_: (fa: TaskDecoder, f: (a: A) => B) => TaskDecoder = (fa, f) => pipe(fa, map(f)) - -const alt_: (me: TaskDecoder, that: () => TaskDecoder) => TaskDecoder = (me, that) => pipe(me, alt(that)) +export const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.compose(M) // ------------------------------------------------------------------------------------- // pipeables @@ -252,82 +268,17 @@ const alt_: (me: TaskDecoder, that: () => TaskDecoder) => TaskDecoder(f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = KTD.map +export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.map(M) /** * @category Alt * @since 2.2.7 */ -export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = KTD.alt - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @category instances - * @since 2.2.7 - */ -export const URI = 'io-ts/TaskDecoder' - -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: TaskDecoder - } -} - -/** - * @category instances - * @since 2.2.7 - */ -export const functorTaskDecoder: Functor1 = { - URI, - map: map_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const altTaskDecoder: Alt1 = { - URI, - map: map_, - alt: alt_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const schemableTaskDecoder: Schemable1 & - WithUnknownContainers1 & - WithUnion1 & - WithRefine1 = { - URI, - literal, - string, - number, - boolean, - nullable, - type, - partial, - record, - array, - tuple: tuple as Schemable1['tuple'], - intersect, - sum, - lazy, - UnknownArray, - UnknownRecord, - union: union as WithUnion1['union'], - refine: refine as WithRefine1['refine'] -} +export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.alt(M) // ------------------------------------------------------------------------------------- // utils @@ -336,17 +287,9 @@ export const schemableTaskDecoder: Schemable1 & /** * @since 2.2.7 */ -export type TypeOf = KTD.TypeOf +export type TypeOf = K.TypeOf /** * @since 2.2.7 */ -export const draw: (e: DecodeError) => string = D.draw - -/** - * @internal - */ -export const stringify: (e: TE.TaskEither) => T.Task = TE.fold( - (e) => T.of(draw(e)), - (a) => T.of(JSON.stringify(a, null, 2)) -) +export type InputOf = K.InputOf diff --git a/src/Type.ts b/src/Type.ts index 2a6be0423..3784ac24f 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -181,7 +181,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.3 */ -export const schemableType: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { +export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, literal, string, diff --git a/src/UnknownDecoder.ts b/src/UnknownDecoder.ts new file mode 100644 index 000000000..83df59c03 --- /dev/null +++ b/src/UnknownDecoder.ts @@ -0,0 +1,386 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt1 } from 'fp-ts/lib/Alt' +import * as E from 'fp-ts/lib/Either' +import { Functor1 } from 'fp-ts/lib/Functor' +import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from './DecodeError' +import * as FS from './FreeSemigroup' +import * as G from './Guard' +import * as D from './Decoder' +import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface UnknownDecoder extends D.Decoder {} + +// ------------------------------------------------------------------------------------- +// DecodeError +// ------------------------------------------------------------------------------------- + +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = D.DecodeError + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const error: (actual: unknown, message: string) => DecodeError = D.error + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const success: (a: A) => E.Either = D.success + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const failure: (actual: unknown, message: string) => E.Either = D.failure + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (guard: G.Guard, expected: string): UnknownDecoder => + D.fromRefinement(guard.is, expected) + +/** + * @category constructors + * @since 2.2.7 + */ +export const literal: ]>(...values: A) => UnknownDecoder = + D.literal + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @category primitives + * @since 2.2.7 + */ +export const string: UnknownDecoder = + /*#__PURE__*/ + fromGuard(G.string, 'string') + +/** + * @category primitives + * @since 2.2.7 + */ +export const number: UnknownDecoder = + /*#__PURE__*/ + fromGuard(G.number, 'number') + +/** + * @category primitives + * @since 2.2.7 + */ +export const boolean: UnknownDecoder = + /*#__PURE__*/ + fromGuard(G.boolean, 'boolean') + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownArray: UnknownDecoder> = + /*#__PURE__*/ + fromGuard(G.UnknownArray, 'Array') + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownRecord: UnknownDecoder> = + /*#__PURE__*/ + fromGuard(G.UnknownRecord, 'Record') + +/** + * @internal + */ +export const object: UnknownDecoder = + /*#__PURE__*/ + fromGuard(G.object, 'object') + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @category combinators + * @since 2.2.7 + */ +export const mapLeftWithInput: ( + f: (input: unknown, e: DecodeError) => DecodeError +) => (decoder: UnknownDecoder) => UnknownDecoder = D.mapLeftWithInput + +/** + * @category combinators + * @since 2.2.7 + */ +export const refine: ( + refinement: (a: A) => a is B, + id: string +) => (from: UnknownDecoder) => UnknownDecoder = D.refine + +/** + * @category combinators + * @since 2.2.7 + */ +export const parse: ( + parser: (a: A) => E.Either +) => (from: UnknownDecoder) => UnknownDecoder = D.parse + +/** + * @category combinators + * @since 2.2.7 + */ +export const nullable: (or: UnknownDecoder) => UnknownDecoder = D.nullable + +/** + * @category combinators + * @since 2.2.7 + */ +export const type = ( + properties: { [K in keyof A]: UnknownDecoder } +): UnknownDecoder<{ [K in keyof A]: A[K] }> => pipe(object as any, compose(D.type(properties))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const partial = ( + properties: { [K in keyof A]: UnknownDecoder } +): UnknownDecoder> => pipe(object as any, compose(D.partial(properties))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const array = (items: UnknownDecoder): UnknownDecoder> => + pipe(UnknownArray, compose(D.array(items))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const record = (codomain: UnknownDecoder): UnknownDecoder> => + pipe(UnknownRecord, compose(D.record(codomain))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const tuple = >( + ...components: { [K in keyof A]: UnknownDecoder } +): UnknownDecoder => pipe(UnknownArray as any, compose(D.tuple(...components))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const union: ]>( + ...members: { [K in keyof A]: UnknownDecoder } +) => UnknownDecoder = D.union as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const intersect: (right: UnknownDecoder) => (left: UnknownDecoder) => UnknownDecoder = + D.intersect + +/** + * @category combinators + * @since 2.2.7 + */ +export const sum = (tag: T) => ( + members: { [K in keyof A]: UnknownDecoder } +): UnknownDecoder => pipe(object as any, compose(D.sum(tag)(members))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy: (id: string, f: () => UnknownDecoder) => UnknownDecoder = D.lazy + +/** + * @category combinators + * @since 2.2.7 + */ +export const compose: (to: D.Decoder) => (from: UnknownDecoder) => UnknownDecoder = D.compose + +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const map_: (fa: UnknownDecoder, f: (a: A) => B) => UnknownDecoder = (fa, f) => pipe(fa, map(f)) + +const alt_: (me: UnknownDecoder, that: () => UnknownDecoder) => UnknownDecoder = (me, that) => + pipe(me, alt(that)) + +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @category Functor + * @since 2.2.7 + */ +export const map: (f: (a: A) => B) => (fa: UnknownDecoder) => UnknownDecoder = D.map + +/** + * @category Alt + * @since 2.2.7 + */ +export const alt: (that: () => UnknownDecoder) => (me: UnknownDecoder) => UnknownDecoder = D.alt + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @category instances + * @since 2.2.7 + */ +export const URI = 'io-ts/UnknownDecoder' + +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: UnknownDecoder + } +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Functor: Functor1 = { + URI, + map: map_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Alt: Alt1 = { + URI, + map: map_, + alt: alt_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { + URI, + literal, + string, + number, + boolean, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable1['tuple'], + intersect, + sum, + lazy, + UnknownArray, + UnknownRecord, + union: union as WithUnion1['union'], + refine: refine as WithRefine1['refine'] +} + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.7 + */ +export type TypeOf = D.TypeOf + +interface Tree { + readonly value: A + readonly forest: ReadonlyArray> +} + +const empty: Array = [] + +const make = (value: A, forest: ReadonlyArray> = empty): Tree => ({ + value, + forest +}) + +const drawTree = (tree: Tree): string => tree.value + drawForest('\n', tree.forest) + +const drawForest = (indentation: string, forest: ReadonlyArray>): string => { + let r: string = '' + const len = forest.length + let tree: Tree + for (let i = 0; i < len; i++) { + tree = forest[i] + const isLast = i === len - 1 + r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value + r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest) + } + return r +} + +const toTree: (e: DE.DecodeError) => Tree = DE.fold({ + Leaf: (input, error) => make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), + Member: (index, errors) => make(`member ${index}`, toForest(errors)), + Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) +}) + +const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( + (value) => [toTree(value)], + (left, right) => toForest(left).concat(toForest(right)) +) + +/** + * @since 2.2.7 + */ +export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') + +/** + * @internal + */ +export const stringify: (e: E.Either) => string = + /*#__PURE__*/ + E.fold(draw, (a) => JSON.stringify(a, null, 2)) diff --git a/src/UnknownTaskDecoder.ts b/src/UnknownTaskDecoder.ts new file mode 100644 index 000000000..4d1caf7c1 --- /dev/null +++ b/src/UnknownTaskDecoder.ts @@ -0,0 +1,356 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt1 } from 'fp-ts/lib/Alt' +import { Functor1 } from 'fp-ts/lib/Functor' +import { pipe } from 'fp-ts/lib/pipeable' +import * as T from 'fp-ts/lib/Task' +import * as TE from 'fp-ts/lib/TaskEither' +import * as D from './UnknownDecoder' +import * as G from './Guard' +import * as KTD from './TaskDecoder' +import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +/** + * @category model + * @since 2.2.7 + */ +export interface UnknownTaskDecoder extends KTD.TaskDecoder {} + +// ------------------------------------------------------------------------------------- +// DecodeError +// ------------------------------------------------------------------------------------- + +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = D.DecodeError + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const error: (actual: unknown, message: string) => DecodeError = D.error + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const success: (a: A) => TE.TaskEither = KTD.success + +/** + * @category DecodeError + * @since 2.2.7 + */ +export const failure: (actual: unknown, message: string) => TE.TaskEither = KTD.failure + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromDecoder: (decoder: D.UnknownDecoder) => UnknownTaskDecoder = KTD.fromKleisliDecoder + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (guard: G.Guard, expected: string): UnknownTaskDecoder => + KTD.fromRefinement(guard.is, expected) + +/** + * @category constructors + * @since 2.2.7 + */ +export const literal: ]>(...values: A) => UnknownTaskDecoder = + KTD.literal + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @category primitives + * @since 2.2.7 + */ +export const string: UnknownTaskDecoder = + /*#__PURE__*/ + fromDecoder(D.string) + +/** + * @category primitives + * @since 2.2.7 + */ +export const number: UnknownTaskDecoder = + /*#__PURE__*/ + fromDecoder(D.number) + +/** + * @category primitives + * @since 2.2.7 + */ +export const boolean: UnknownTaskDecoder = + /*#__PURE__*/ + fromDecoder(D.boolean) + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownArray: UnknownTaskDecoder> = + /*#__PURE__*/ + fromDecoder(D.UnknownArray) + +/** + * @category primitives + * @since 2.2.7 + */ +export const UnknownRecord: UnknownTaskDecoder> = + /*#__PURE__*/ + fromDecoder(D.UnknownRecord) + +/** + * @internal + */ +export const object: UnknownTaskDecoder = + /*#__PURE__*/ + fromDecoder(D.object) + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +/** + * @category combinators + * @since 2.2.7 + */ +export const mapLeftWithInput: ( + f: (input: unknown, e: DecodeError) => DecodeError +) => (decoder: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.mapLeftWithInput + +/** + * @category combinators + * @since 2.2.7 + */ +export const refine: ( + refinement: (a: A) => a is B, + id: string +) => (from: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.refine + +/** + * @category combinators + * @since 2.2.7 + */ +export const parse: ( + parser: (a: A) => TE.TaskEither +) => (from: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.parse + +/** + * @category combinators + * @since 2.2.7 + */ +export const nullable: (or: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.nullable + +/** + * @category combinators + * @since 2.2.7 + */ +export const type = ( + properties: { [K in keyof A]: UnknownTaskDecoder } +): UnknownTaskDecoder<{ [K in keyof A]: A[K] }> => pipe(object as any, compose(KTD.type(properties))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const partial = ( + properties: { [K in keyof A]: UnknownTaskDecoder } +): UnknownTaskDecoder> => pipe(object as any, compose(KTD.partial(properties))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const array = (items: UnknownTaskDecoder): UnknownTaskDecoder> => + pipe(UnknownArray, compose(KTD.array(items))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const record = (codomain: UnknownTaskDecoder): UnknownTaskDecoder> => + pipe(UnknownRecord, compose(KTD.record(codomain))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const tuple = >( + ...components: { [K in keyof A]: UnknownTaskDecoder } +): UnknownTaskDecoder => pipe(UnknownArray as any, compose(KTD.tuple(...components))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const union: ]>( + ...members: { [K in keyof A]: UnknownTaskDecoder } +) => UnknownTaskDecoder = KTD.union as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const intersect: ( + right: UnknownTaskDecoder +) => (left: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.intersect + +/** + * @category combinators + * @since 2.2.7 + */ +export const sum = (tag: T) => ( + members: { [K in keyof A]: UnknownTaskDecoder } +): UnknownTaskDecoder => pipe(object as any, compose(KTD.sum(tag)(members))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const lazy: (id: string, f: () => UnknownTaskDecoder) => UnknownTaskDecoder = KTD.lazy + +/** + * @category combinators + * @since 2.2.7 + */ +export const compose: (to: KTD.TaskDecoder) => (from: UnknownTaskDecoder) => UnknownTaskDecoder = + KTD.compose + +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const map_: (fa: UnknownTaskDecoder, f: (a: A) => B) => UnknownTaskDecoder = (fa, f) => pipe(fa, map(f)) + +const alt_: (me: UnknownTaskDecoder, that: () => UnknownTaskDecoder) => UnknownTaskDecoder = (me, that) => + pipe(me, alt(that)) + +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- + +/** + * @category Functor + * @since 2.2.7 + */ +export const map: (f: (a: A) => B) => (fa: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.map + +/** + * @category Alt + * @since 2.2.7 + */ +export const alt: (that: () => UnknownTaskDecoder) => (me: UnknownTaskDecoder) => UnknownTaskDecoder = + KTD.alt + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @category instances + * @since 2.2.7 + */ +export const URI = 'io-ts/UnknownTaskDecoder' + +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: UnknownTaskDecoder + } +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Functor: Functor1 = { + URI, + map: map_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Alt: Alt1 = { + URI, + map: map_, + alt: alt_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { + URI, + literal, + string, + number, + boolean, + nullable, + type, + partial, + record, + array, + tuple: tuple as Schemable1['tuple'], + intersect, + sum, + lazy, + UnknownArray, + UnknownRecord, + union: union as WithUnion1['union'], + refine: refine as WithRefine1['refine'] +} + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.7 + */ +export type TypeOf = KTD.TypeOf + +/** + * @since 2.2.7 + */ +export const draw: (e: DecodeError) => string = D.draw + +/** + * @internal + */ +export const stringify: (e: TE.TaskEither) => T.Task = TE.fold( + (e) => T.of(draw(e)), + (a) => T.of(JSON.stringify(a, null, 2)) +) diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 582b17b30..6effccf72 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -113,10 +113,7 @@ declare module 'fp-ts/lib/HKT' { } } -export const schemableArbitrary: S.Schemable1 & - S.WithUnknownContainers1 & - S.WithUnion1 & - S.WithRefine1 = { +export const Schemable: S.Schemable1 & S.WithUnknownContainers1 & S.WithUnion1 & S.WithRefine1 = { URI, literal, string, diff --git a/test/Codec.ts b/test/Codec.ts index 231fd2c6f..da718676b 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as C from '../src/Codec' -import * as D from '../src/Decoder' +import * as UD from '../src/UnknownDecoder' import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' @@ -9,10 +9,10 @@ import * as E from 'fp-ts/lib/Either' const NumberFromString: C.Codec = C.make( pipe( - D.string, - D.parse((s) => { + UD.string, + UD.parse((s) => { const n = parseFloat(s) - return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + return isNaN(n) ? UD.failure(s, 'parsable to a number') : UD.success(n) }) ), { encode: String } @@ -39,17 +39,17 @@ const Int: C.Codec = pipe( const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } -const undef: C.Codec = C.fromDecoder(D.fromGuard(undefinedGuard, 'undefined')) +const undef: C.Codec = C.fromDecoder(UD.fromGuard(undefinedGuard, 'undefined')) describe('Codec', () => { - describe('invariantCodec', () => { + describe('Invariant', () => { it('imap', () => { - const codec = C.invariantCodec.imap( + const codec = C.Invariant.imap( C.string, (s) => ({ value: s }), ({ value }) => value ) - assert.deepStrictEqual(codec.decode('a'), D.success({ value: 'a' })) + assert.deepStrictEqual(codec.decode('a'), UD.success({ value: 'a' })) assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) }) @@ -62,7 +62,7 @@ describe('Codec', () => { ({ value }) => value ) ) - assert.deepStrictEqual(codec.decode('a'), D.success({ value: 'a' })) + assert.deepStrictEqual(codec.decode('a'), UD.success({ value: 'a' })) assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) @@ -73,7 +73,7 @@ describe('Codec', () => { C.number, C.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) ) - assert.deepStrictEqual(decoder.decode('a'), D.failure('a', 'not a number')) + assert.deepStrictEqual(decoder.decode('a'), UD.failure('a', 'not a number')) }) }) }) @@ -82,12 +82,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.string - assert.deepStrictEqual(codec.decode('a'), D.success('a')) + assert.deepStrictEqual(codec.decode('a'), UD.success('a')) }) it('should reject an invalid input', () => { const codec = C.string - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'string')) + assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'string')) }) }) }) @@ -96,12 +96,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.number - assert.deepStrictEqual(codec.decode(1), D.success(1)) + assert.deepStrictEqual(codec.decode(1), UD.success(1)) }) it('should reject an invalid input', () => { const codec = C.number - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'number')) + assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'number')) }) }) }) @@ -110,13 +110,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.boolean - assert.deepStrictEqual(codec.decode(true), D.success(true)) - assert.deepStrictEqual(codec.decode(false), D.success(false)) + assert.deepStrictEqual(codec.decode(true), UD.success(true)) + assert.deepStrictEqual(codec.decode(false), UD.success(false)) }) it('should reject an invalid input', () => { const codec = C.boolean - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'boolean')) + assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'boolean')) }) }) }) @@ -125,13 +125,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(codec.decode('a'), D.success('a')) - assert.deepStrictEqual(codec.decode(null), D.success(null)) + assert.deepStrictEqual(codec.decode('a'), UD.success('a')) + assert.deepStrictEqual(codec.decode(null), UD.success(null)) }) it('should reject an invalid input', () => { const codec = C.literal('a', null) - assert.deepStrictEqual(codec.decode('b'), D.failure('b', '"a" | null')) + assert.deepStrictEqual(codec.decode('b'), UD.failure('b', '"a" | null')) }) }) @@ -150,7 +150,7 @@ describe('Codec', () => { C.string, C.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(codec.decode('a'), D.success('a')) + assert.deepStrictEqual(codec.decode('a'), UD.success('a')) }) it('should reject an invalid input', () => { @@ -158,8 +158,8 @@ describe('Codec', () => { C.string, C.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'string')) - assert.deepStrictEqual(codec.decode(''), D.failure('', 'NonEmptyString')) + assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'string')) + assert.deepStrictEqual(codec.decode(''), UD.failure('', 'NonEmptyString')) }) }) @@ -178,8 +178,8 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.nullable(NumberFromString) - assert.deepStrictEqual(codec.decode(null), D.success(null)) - assert.deepStrictEqual(codec.decode('1'), D.success(1)) + assert.deepStrictEqual(codec.decode(null), UD.success(null)) + assert.deepStrictEqual(codec.decode('1'), UD.success(1)) }) it('should reject an invalid input', () => { @@ -220,28 +220,28 @@ describe('Codec', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a' }), UD.success({ a: 'a' })) }) it('should strip additional fields', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), UD.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', () => { const codec = C.type({ a: undef }) - assert.deepStrictEqual(codec.decode({}), D.success({ a: undefined })) + assert.deepStrictEqual(codec.decode({}), UD.success({ a: undefined })) }) it('should reject an invalid input', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -274,7 +274,7 @@ describe('Codec', () => { } } const codec = C.type({ a: C.string, b: C.string }) - assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) + assert.deepStrictEqual(codec.decode(new A()), UD.success({ a: 'a', b: 'b' })) }) }) @@ -296,28 +296,28 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) - assert.deepStrictEqual(codec.decode({}), D.success({})) + assert.deepStrictEqual(codec.decode({ a: 'a' }), UD.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({}), UD.success({})) }) it('should strip additional fields', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), UD.success({ a: 'a' })) }) it('should not add missing fields', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({}), D.success({})) + assert.deepStrictEqual(codec.decode({}), UD.success({})) }) it('should not strip fields corresponding to undefined values', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: undefined }), D.success({ a: undefined })) + assert.deepStrictEqual(codec.decode({ a: undefined }), UD.success({ a: undefined })) }) it('should reject an invalid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -350,7 +350,7 @@ describe('Codec', () => { } } const codec = C.partial({ a: C.string, b: C.string }) - assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) + assert.deepStrictEqual(codec.decode(new A()), UD.success({ a: 'a', b: 'b' })) }) }) @@ -383,13 +383,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid value', () => { const codec = C.record(C.number) - assert.deepStrictEqual(codec.decode({}), D.success({})) - assert.deepStrictEqual(codec.decode({ a: 1 }), D.success({ a: 1 })) + assert.deepStrictEqual(codec.decode({}), UD.success({})) + assert.deepStrictEqual(codec.decode({ a: 1 }), UD.success({ a: 1 })) }) it('should reject an invalid value', () => { const codec = C.record(C.number) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) + assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 'a' }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) @@ -422,13 +422,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.array(C.string) - assert.deepStrictEqual(codec.decode([]), D.success([])) - assert.deepStrictEqual(codec.decode(['a']), D.success(['a'])) + assert.deepStrictEqual(codec.decode([]), UD.success([])) + assert.deepStrictEqual(codec.decode(['a']), UD.success(['a'])) }) it('should reject an invalid input', () => { const codec = C.array(C.string) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) + assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'Array')) assert.deepStrictEqual(codec.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) }) @@ -458,16 +458,16 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(['a', 1]), D.success(['a', 1])) + assert.deepStrictEqual(codec.decode(['a', 1]), UD.success(['a', 1])) }) it('should handle zero components', () => { - assert.deepStrictEqual(C.tuple().decode([]), D.success([])) + assert.deepStrictEqual(C.tuple().decode([]), UD.success([])) }) it('should reject an invalid input', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) + assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'Array')) assert.deepStrictEqual( codec.decode(['a']), E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -493,7 +493,7 @@ describe('Codec', () => { it('should strip additional components', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(['a', 1, true]), D.success(['a', 1])) + assert.deepStrictEqual(codec.decode(['a', 1, true]), UD.success(['a', 1])) }) }) @@ -509,12 +509,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = pipe(C.type({ a: C.string }), C.intersect(C.type({ b: C.number }))) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a', b: 1 })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), UD.success({ a: 'a', b: 1 })) }) it('should handle primitives', () => { const codec = pipe(Int, C.intersect(Positive)) - assert.deepStrictEqual(codec.decode(1), D.success(1)) + assert.deepStrictEqual(codec.decode(1), UD.success(1)) }) }) @@ -539,15 +539,15 @@ describe('Codec', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), D.success({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), D.success({ _tag: 'B', b: 1 })) + assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), UD.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), UD.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'object')) + assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'object')) assert.deepStrictEqual( codec.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) @@ -594,8 +594,8 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { - assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), D.success({ a: 1 })) - assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), D.success({ a: 1, b: { a: 2 } })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), UD.success({ a: 1 })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), UD.success({ a: 1, b: { a: 2 } })) }) it('should reject an invalid input', () => { diff --git a/test/Decoder.ts b/test/Decoder.ts index 5c341aaf2..8ca07eacf 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -1,585 +1,16 @@ import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import * as DE from '../src/DecodeError' import * as _ from '../src/Decoder' -import * as FS from '../src/FreeSemigroup' -import * as G from '../src/Guard' -import * as KD from '../src/KleisliDecoder' - -const undefinedGuard: G.Guard = { - is: (u): u is undefined => u === undefined -} -const undef: _.Decoder = _.fromGuard(undefinedGuard, 'undefined') - -const NumberFromString: _.Decoder = pipe( - _.string, - _.parse((s) => { - const n = parseFloat(s) - return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) - }) -) - -interface PositiveBrand { - readonly Positive: unique symbol -} -type Positive = number & PositiveBrand -const Positive: _.Decoder = pipe( - _.number, - _.refine((n): n is Positive => n > 0, 'Positive') -) interface IntBrand { readonly Int: unique symbol } + type Int = number & IntBrand -const Int: _.Decoder = pipe( - _.number, - _.refine((n): n is Int => Number.isInteger(n), 'Int') -) describe('Decoder', () => { - // ------------------------------------------------------------------------------------- - // instances - // ------------------------------------------------------------------------------------- - - it('functorDecoder', () => { - const decoder = _.functorDecoder.map(_.string, (s) => s + '!') - assert.deepStrictEqual(decoder.decode('a'), _.success('a!')) - }) - - it('altDecoder', () => { - const decoder = _.altDecoder.alt(_.string, () => _.number) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - }) - - // ------------------------------------------------------------------------------------- - // primitives - // ------------------------------------------------------------------------------------- - - it('string', async () => { - assert.deepStrictEqual(_.string.decode('a'), _.success('a')) - assert.deepStrictEqual(_.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) - }) - - describe('number', () => { - it('number', async () => { - assert.deepStrictEqual(_.number.decode(1), _.success(1)) - assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) - }) - - it('should exclude NaN', () => { - assert.deepStrictEqual(_.number.decode(NaN), E.left(FS.of(DE.leaf(NaN, 'number')))) - }) - }) - - it('boolean', async () => { - assert.deepStrictEqual(_.boolean.decode(true), _.success(true)) - assert.deepStrictEqual(_.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) - }) - - it('UnknownArray', async () => { - assert.deepStrictEqual(_.UnknownArray.decode([1, 'a']), _.success([1, 'a'])) - assert.deepStrictEqual(_.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) - }) - - it('UnknownRecord', async () => { - assert.deepStrictEqual(_.UnknownRecord.decode({ a: 1, b: 'b' }), _.success({ a: 1, b: 'b' })) - assert.deepStrictEqual(_.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) - }) - - // ------------------------------------------------------------------------------------- - // constructors - // ------------------------------------------------------------------------------------- - - describe('literal', () => { - it('should decode a valid input', async () => { - const decoder = _.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - assert.deepStrictEqual(decoder.decode(null), _.success(null)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.literal('a', null) - assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) - }) - }) - - // ------------------------------------------------------------------------------------- - // combinators - // ------------------------------------------------------------------------------------- - - it('mapLeftWithInput', () => { - const decoder = pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) - ) - assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) - }) - - it('compose', () => { - interface IntBrand { - readonly Int: unique symbol - } - - type Int = number & IntBrand - - const decoder = pipe(_.number, _.compose(KD.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - assert.deepStrictEqual(decoder.decode('a'), _.failure('a', 'number')) - assert.deepStrictEqual(decoder.decode(1.2), _.failure(1.2, 'IntFromNumber')) - }) - - describe('nullable', () => { - it('should decode a valid input', () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual(decoder.decode(null), _.success(null)) - assert.deepStrictEqual(decoder.decode('1'), _.success(1)) - }) - - it('should reject an invalid input', () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual( - decoder.decode(undefined), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) - ) - ) - ) - assert.deepStrictEqual( - decoder.decode('a'), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) - ) - ) - ) - }) - }) - - describe('type', () => { - it('should decode a valid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) - }) - - it('should strip additional fields', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.type({ - a: undef - }) - assert.deepStrictEqual(decoder.decode({}), _.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) - assert.deepStrictEqual( - decoder.decode({ a: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.type({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - decoder.decode({}), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.type({ a: _.string, b: _.string }) - assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) - }) - }) - - describe('partial', () => { - it('should decode a valid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) - assert.deepStrictEqual(decoder.decode({}), _.success({})) - }) - - it('should strip additional fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) - }) - - it('should not add missing fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({}), _.success({})) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: undefined }), _.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) - assert.deepStrictEqual( - decoder.decode({ a: 1 }), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.partial({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - decoder.decode({ a: 1, b: 'b' }), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.partial({ a: _.string, b: _.string }) - assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) - }) - }) - - describe('array', () => { - it('should decode a valid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(decoder.decode([]), _.success([])) - assert.deepStrictEqual(decoder.decode(['a']), _.success(['a'])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) - }) - - it('should collect all errors', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left( - FS.concat( - FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) - ) - ) - ) - }) - }) - - describe('record', () => { - it('should decode a valid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(decoder.decode({}), _.success({})) - assert.deepStrictEqual(decoder.decode({ a: 1 }), _.success({ a: 1 })) - }) - - it('should reject an invalid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) - assert.deepStrictEqual( - decoder.decode({ a: 'a' }), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual( - decoder.decode({ a: 'a', b: 'b' }), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - }) - - describe('tuple', () => { - it('should decode a valid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(decoder.decode(['a', 1]), _.success(['a', 1])) - }) - - it('should handle zero components', async () => { - assert.deepStrictEqual(_.tuple().decode([]), _.success([])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual( - decoder.decode(['a']), - E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual( - decoder.decode([1, 'a']), - E.left( - FS.concat( - FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) - ) - ) - ) - }) - - it('should strip additional components', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(decoder.decode(['a', 1, true]), _.success(['a', 1])) - }) - }) - - describe('union', () => { - it('should decode a valid input', () => { - assert.deepStrictEqual(_.union(_.string).decode('a'), _.success('a')) - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - }) - - it('should reject an invalid input', () => { - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual( - decoder.decode(true), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), - FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) - ) - ) - ) - }) - }) - - describe('refine', () => { - it('should decode a valid input', () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - }) - - it('should reject an invalid input', () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) - assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) - }) - }) - - describe('intersect', () => { - it('should decode a valid input', () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a', b: 1 })) - }) - - it('should handle primitives', () => { - const decoder = pipe(Int, _.intersect(Positive)) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - }) - - it('should accumulate all errors', () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual( - decoder.decode({ a: 'a' }), - E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - decoder.decode({ b: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) - ) - assert.deepStrictEqual( - decoder.decode({}), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - }) - - describe('sum', () => { - const sum = _.sum('_tag') - - it('should decode a valid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), _.success({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), _.success({ _tag: 'B', b: 1 })) - }) - - it('should reject an invalid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) - assert.deepStrictEqual( - decoder.decode({}), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) - ) - assert.deepStrictEqual( - decoder.decode({ _tag: 'A', a: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should support empty records', () => { - const decoder = sum({}) - assert.deepStrictEqual( - decoder.decode({}), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) - ) - }) - }) - - interface A { - a: number - b?: A - } - - const lazyDecoder: _.Decoder = _.lazy('A', () => - pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) - ) - - describe('lazy', () => { - it('should decode a valid input', () => { - assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), _.success({ a: 1 })) - assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), _.success({ a: 1, b: { a: 2 } })) - }) - - it('should reject an invalid input', () => { - assert.deepStrictEqual( - lazyDecoder.decode({ a: 1 }), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) - ) - assert.deepStrictEqual( - lazyDecoder.decode({ a: 'a' }), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) - ) - assert.deepStrictEqual( - lazyDecoder.decode({ a: '1', b: {} }), - E.left( - FS.of( - DE.lazy( - 'A', - FS.of( - DE.key( - 'b', - DE.optional, - FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) - ) - ) - ) - ) - ) - ) - }) - }) - - // ------------------------------------------------------------------------------------- - // utils - // ------------------------------------------------------------------------------------- - - describe('draw', () => { - it('draw', () => { - const decoder = _.type({ - a: _.string, - b: _.number, - c: _.array(_.boolean), - d: _.nullable(_.string) - }) - assert.deepStrictEqual( - pipe(decoder.decode({ c: [1] }), E.mapLeft(_.draw)), - E.left(`required property "a" -└─ cannot decode undefined, should be string -required property "b" -└─ cannot decode undefined, should be number -required property "c" -└─ optional index 0 - └─ cannot decode 1, should be boolean -required property "d" -├─ member 0 -│ └─ cannot decode undefined, should be null -└─ member 1 - └─ cannot decode undefined, should be string`) - ) - }) - - it('should support lazy combinators', () => { - assert.deepStrictEqual( - pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(_.draw)), - E.left(`lazy type A -└─ optional property \"b\" - └─ lazy type A - └─ required property \"a\" - └─ cannot decode undefined, should be string`) - ) - }) - }) - - it('stringify', () => { - assert.deepStrictEqual(_.stringify(_.string.decode('a')), '"a"') - assert.deepStrictEqual(_.stringify(_.string.decode(null)), 'cannot decode null, should be string') + it('fromRefinement', () => { + const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') + assert.deepStrictEqual(IntFromNumber.decode(1), _.success(1)) + assert.deepStrictEqual(IntFromNumber.decode(1.2), _.failure(1.2, 'IntFromNumber')) }) }) diff --git a/test/Eq.ts b/test/Eq.ts index c7584207a..d2788c122 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -5,7 +5,7 @@ import { pipe } from 'fp-ts/lib/pipeable' describe('Eq', () => { it('literal', () => { - const eq = E.schemableEq.literal('a', null) + const eq = E.Schemable.literal('a', null) assert.deepStrictEqual(eq.equals('a', 'a'), true) assert.deepStrictEqual(eq.equals(null, null), true) assert.deepStrictEqual(eq.equals('a', null), false) @@ -56,7 +56,7 @@ describe('Eq', () => { b: Array } - const eq: Eq = E.schemableEq.lazy('A', () => + const eq: Eq = E.Schemable.lazy('A', () => E.type({ a: E.number, b: E.array(eq) @@ -71,8 +71,8 @@ describe('Eq', () => { it('sum', () => { const sum = E.sum('_tag') const eq = sum({ - A: E.type({ _tag: E.schemableEq.literal('A'), a: E.string }), - B: E.type({ _tag: E.schemableEq.literal('B'), b: E.number }) + A: E.type({ _tag: E.Schemable.literal('A'), a: E.string }), + B: E.type({ _tag: E.Schemable.literal('B'), b: E.number }) }) assert.strictEqual(eq.equals({ _tag: 'A', a: 'a' }, { _tag: 'A', a: 'a' }), true) assert.strictEqual(eq.equals({ _tag: 'B', b: 1 }, { _tag: 'B', b: 1 }), true) @@ -88,7 +88,7 @@ describe('Eq', () => { type NonEmptyString = string & NonEmptyStringBrand const eq = pipe( E.string, - E.schemableEq.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + E.Schemable.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') ) const a: NonEmptyString = 'a' as any const b: NonEmptyString = 'b' as any diff --git a/test/Guard.ts b/test/Guard.ts index 7ac30f6a3..d18843db1 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -195,7 +195,7 @@ describe('Guard', () => { b: Array } - const guard: G.Guard = G.schemableGuard.lazy('A', () => + const guard: G.Guard = G.Schemable.lazy('A', () => G.type({ a: G.number, b: G.array(guard) diff --git a/test/JsonEncoder.ts b/test/JsonEncoder.ts index 044f1de91..a4ef8904a 100644 --- a/test/JsonEncoder.ts +++ b/test/JsonEncoder.ts @@ -2,9 +2,9 @@ import * as assert from 'assert' import * as JE from '../src/JsonEncoder' describe('Encoder', () => { - describe('contravariantJsonEncoder', () => { + describe('Contravariant', () => { it('contramap', () => { - const encoder = JE.contravariantJsonEncoder.contramap(JE.schemableJsonEncoder.number, (s: string) => s.length) + const encoder = JE.Contravariant.contramap(JE.Schemable.number, (s: string) => s.length) assert.deepStrictEqual(encoder.encode('aaa'), 3) }) }) diff --git a/test/KleisliDecoder.ts b/test/KleisliDecoder.ts deleted file mode 100644 index 1720f7d48..000000000 --- a/test/KleisliDecoder.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as assert from 'assert' -import * as _ from '../src/KleisliDecoder' - -interface IntBrand { - readonly Int: unique symbol -} - -type Int = number & IntBrand - -describe('KleisliDecoder', () => { - it('fromRefinement', () => { - const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') - assert.deepStrictEqual(IntFromNumber.decode(1), _.success(1)) - assert.deepStrictEqual(IntFromNumber.decode(1.2), _.failure(1.2, 'IntFromNumber')) - }) -}) diff --git a/test/KleisliTaskDecoder.ts b/test/KleisliTaskDecoder.ts deleted file mode 100644 index 49ed96809..000000000 --- a/test/KleisliTaskDecoder.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as assert from 'assert' -import * as KD from '../src/KleisliDecoder' -import * as _ from '../src/KleisliTaskDecoder' - -interface IntBrand { - readonly Int: unique symbol -} - -type Int = number & IntBrand - -describe('KleisliTaskDecoder', () => { - it('fromRefinement', async () => { - const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') - assert.deepStrictEqual(await IntFromNumber.decode(1)(), KD.success(1)) - assert.deepStrictEqual(await IntFromNumber.decode(1.2)(), KD.failure(1.2, 'IntFromNumber')) - }) -}) diff --git a/test/Schema.ts b/test/Schema.ts index 8ebddc54e..9c65cfa9f 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -19,11 +19,11 @@ function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { } function check(schema: Schema): void { - const arb = interpreter(A.schemableArbitrary)(schema) - const codec = interpreter(JC.schemableJsonCodec)(schema) - const guard = interpreter(G.schemableGuard)(schema) - const eq = interpreter(Eq.schemableEq)(schema) - const encoder = interpreter(JE.schemableJsonEncoder)(schema) + const arb = interpreter(A.Schemable)(schema) + const codec = interpreter(JC.Schemable)(schema) + const guard = interpreter(G.Schemable)(schema) + const eq = interpreter(Eq.Schemable)(schema) + const encoder = interpreter(JE.Schemable)(schema) // decoders, guards and eqs should be aligned fc.assert(fc.property(arb, (a) => isRight(codec.decode(a)) && guard.is(a) && eq.equals(a, a))) // laws diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index c741425e3..770759670 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -1,590 +1,17 @@ import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import * as TE from 'fp-ts/lib/TaskEither' -import * as DE from '../src/DecodeError' -import * as FS from '../src/FreeSemigroup' -import * as G from '../src/Guard' -import * as KD from '../src/KleisliDecoder' -import * as KTD from '../src/KleisliTaskDecoder' +import * as D from '../src/Decoder' import * as _ from '../src/TaskDecoder' -const undefinedGuard: G.Guard = { - is: (u): u is undefined => u === undefined -} -const undef: _.TaskDecoder = _.fromGuard(undefinedGuard, 'undefined') - -const NumberFromString: _.TaskDecoder = pipe( - _.string, - _.parse((s) => { - const n = parseFloat(s) - return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) - }) -) - -interface PositiveBrand { - readonly Positive: unique symbol -} -type Positive = number & PositiveBrand -const Positive: _.TaskDecoder = pipe( - _.number, - _.refine((n): n is Positive => n > 0, 'Positive') -) - interface IntBrand { readonly Int: unique symbol } + type Int = number & IntBrand -const Int: _.TaskDecoder = pipe( - _.number, - _.refine((n): n is Int => Number.isInteger(n), 'Int') -) describe('TaskDecoder', () => { - // ------------------------------------------------------------------------------------- - // instances - // ------------------------------------------------------------------------------------- - - it('map', async () => { - const decoder = _.functorTaskDecoder.map(_.string, (s) => s + '!') - assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a!')) - }) - - it('alt', async () => { - const decoder = _.altTaskDecoder.alt(_.string, () => _.number) - assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) - assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) - }) - - // ------------------------------------------------------------------------------------- - // primitives - // ------------------------------------------------------------------------------------- - - it('string', async () => { - assert.deepStrictEqual(await _.string.decode('a')(), KD.success('a')) - assert.deepStrictEqual(await _.string.decode(null)(), KD.failure(null, 'string')) - }) - - it('number', async () => { - assert.deepStrictEqual(await _.number.decode(1)(), KD.success(1)) - assert.deepStrictEqual(await _.number.decode(null)(), KD.failure(null, 'number')) - }) - - it('boolean', async () => { - assert.deepStrictEqual(await _.boolean.decode(true)(), KD.success(true)) - assert.deepStrictEqual(await _.boolean.decode(null)(), KD.failure(null, 'boolean')) - }) - - it('UnknownArray', async () => { - assert.deepStrictEqual(await _.UnknownArray.decode([1, 'a'])(), KD.success([1, 'a'])) - assert.deepStrictEqual(await _.UnknownArray.decode(null)(), KD.failure(null, 'Array')) - }) - - it('UnknownRecord', async () => { - assert.deepStrictEqual(await _.UnknownRecord.decode({ a: 1, b: 'b' })(), KD.success({ a: 1, b: 'b' })) - assert.deepStrictEqual(await _.UnknownRecord.decode(null)(), KD.failure(null, 'Record')) - }) - - // ------------------------------------------------------------------------------------- - // constructors - // ------------------------------------------------------------------------------------- - - it('fromGuard', async () => { - const decoder = _.fromGuard(G.string, 'string') - assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) - assert.deepStrictEqual(await decoder.decode(null)(), KD.failure(null, 'string')) - }) - - describe('literal', () => { - it('should decode a valid input', async () => { - const decoder = _.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) - assert.deepStrictEqual(await decoder.decode(null)(), KD.success(null)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.literal('a', null) - assert.deepStrictEqual(await decoder.decode('b')(), KD.failure('b', '"a" | null')) - }) - }) - - // ------------------------------------------------------------------------------------- - // combinators - // ------------------------------------------------------------------------------------- - - it('mapLeftWithInput', async () => { - const decoder = pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) - ) - assert.deepStrictEqual(await decoder.decode('a')(), KD.failure('a', 'not a number')) - }) - - it('compose', async () => { - interface IntBrand { - readonly Int: unique symbol - } - - type Int = number & IntBrand - - const decoder = pipe(_.number, _.compose(KTD.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) - assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) - assert.deepStrictEqual(await decoder.decode('a')(), KD.failure('a', 'number')) - assert.deepStrictEqual(await decoder.decode(1.2)(), KD.failure(1.2, 'IntFromNumber')) - }) - - describe('nullable', () => { - it('should decode a valid input', async () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual(await decoder.decode(null)(), KD.success(null)) - assert.deepStrictEqual(await decoder.decode('1')(), KD.success(1)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual( - await decoder.decode(undefined)(), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) - ) - ) - ) - assert.deepStrictEqual( - await decoder.decode('a')(), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) - ) - ) - ) - }) - }) - - describe('type', () => { - it('should decode a valid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), KD.success({ a: 'a' })) - }) - - it('should strip additional fields', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), KD.success({ a: 'a' })) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.type({ - a: undef - }) - assert.deepStrictEqual(await decoder.decode({})(), KD.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'object')) - assert.deepStrictEqual( - await decoder.decode({ a: 1 })(), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.type({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.type({ a: _.string, b: _.string }) - assert.deepStrictEqual(await decoder.decode(new A())(), KD.success({ a: 'a', b: 'b' })) - }) - }) - - describe('partial', () => { - it('should decode a valid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), KD.success({ a: 'a' })) - assert.deepStrictEqual(await decoder.decode({})(), KD.success({})) - }) - - it('should strip additional fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), KD.success({ a: 'a' })) - }) - - it('should not add missing fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({})(), KD.success({})) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: undefined })(), KD.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'object')) - assert.deepStrictEqual( - await decoder.decode({ a: 1 })(), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.partial({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - await decoder.decode({ a: 1, b: 'b' })(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.partial({ a: _.string, b: _.string }) - assert.deepStrictEqual(await decoder.decode(new A())(), KD.success({ a: 'a', b: 'b' })) - }) - }) - - describe('array', () => { - it('should decode a valid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(await decoder.decode([])(), KD.success([])) - assert.deepStrictEqual(await decoder.decode(['a'])(), KD.success(['a'])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Array')) - assert.deepStrictEqual( - await decoder.decode([1])(), - E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual( - await decoder.decode([1, 2])(), - E.left( - FS.concat( - FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) - ) - ) - ) - }) - }) - - describe('record', () => { - it('should decode a valid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(await decoder.decode({})(), KD.success({})) - assert.deepStrictEqual(await decoder.decode({ a: 1 })(), KD.success({ a: 1 })) - }) - - it('should reject an invalid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Record')) - assert.deepStrictEqual( - await decoder.decode({ a: 'a' })(), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual( - await decoder.decode({ a: 'a', b: 'b' })(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - }) - - describe('tuple', () => { - it('should decode a valid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(await decoder.decode(['a', 1])(), KD.success(['a', 1])) - }) - - it('should handle zero components', async () => { - assert.deepStrictEqual(await _.tuple().decode([])(), KD.success([])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'Array')) - assert.deepStrictEqual( - await decoder.decode(['a'])(), - E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - await decoder.decode([1, 2])(), - E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual( - await decoder.decode([1, 'a'])(), - E.left( - FS.concat( - FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) - ) - ) - ) - }) - - it('should strip additional components', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(await decoder.decode(['a', 1, true])(), KD.success(['a', 1])) - }) - }) - - describe('union', () => { - it('should decode a valid input', async () => { - assert.deepStrictEqual(await _.union(_.string).decode('a')(), KD.success('a')) - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) - assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual( - await decoder.decode(true)(), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), - FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) - ) - ) - ) - }) - }) - - describe('refine', () => { - it('should decode a valid input', async () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(await decoder.decode('a')(), KD.success('a')) - }) - - it('should reject an invalid input', async () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(await decoder.decode(undefined)(), KD.failure(undefined, 'string')) - assert.deepStrictEqual(await decoder.decode('')(), KD.failure('', 'NonEmptyString')) - }) - }) - - describe('intersect', () => { - it('should decode a valid input', async () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), KD.success({ a: 'a', b: 1 })) - }) - - it('should handle primitives', async () => { - const decoder = pipe(Int, _.intersect(Positive)) - assert.deepStrictEqual(await decoder.decode(1)(), KD.success(1)) - }) - - it('should accumulate all errors', async () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual( - await decoder.decode({ a: 'a' })(), - E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - await decoder.decode({ b: 1 })(), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) - ) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - }) - - describe('sum', () => { - const sum = _.sum('_tag') - - it('should decode a valid input', async () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), KD.success({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), KD.success({ _tag: 'B', b: 1 })) - }) - - it('should reject an invalid input', async () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode(null)(), KD.failure(null, 'object')) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) - ) - assert.deepStrictEqual( - await decoder.decode({ _tag: 'A', a: 1 })(), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should support empty records', async () => { - const decoder = sum({}) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) - ) - }) - }) - - interface A { - a: number - b?: A - } - - const lazyDecoder: _.TaskDecoder = _.lazy('A', () => - pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) - ) - - describe('lazy', () => { - it('should decode a valid input', async () => { - assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), KD.success({ a: 1 })) - assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), KD.success({ a: 1, b: { a: 2 } })) - }) - - it('should reject an invalid input', async () => { - assert.deepStrictEqual( - await lazyDecoder.decode({ a: 1 })(), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) - ) - assert.deepStrictEqual( - await lazyDecoder.decode({ a: 'a' })(), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) - ) - assert.deepStrictEqual( - await lazyDecoder.decode({ a: '1', b: {} })(), - E.left( - FS.of( - DE.lazy( - 'A', - FS.of( - DE.key( - 'b', - DE.optional, - FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) - ) - ) - ) - ) - ) - ) - }) - }) - - // ------------------------------------------------------------------------------------- - // utils - // ------------------------------------------------------------------------------------- - - describe('draw', () => { - it('draw', async () => { - const decoder = _.type({ - a: _.string, - b: _.number, - c: _.array(_.boolean), - d: _.nullable(_.string) - }) - assert.deepStrictEqual( - await pipe(decoder.decode({ c: [1] }), TE.mapLeft(_.draw))(), - E.left(`required property "a" -└─ cannot decode undefined, should be string -required property "b" -└─ cannot decode undefined, should be number -required property "c" -└─ optional index 0 - └─ cannot decode 1, should be boolean -required property "d" -├─ member 0 -│ └─ cannot decode undefined, should be null -└─ member 1 - └─ cannot decode undefined, should be string`) - ) - }) - - it('should support lazy combinators', async () => { - assert.deepStrictEqual( - await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(_.draw))(), - E.left(`lazy type A -└─ optional property \"b\" - └─ lazy type A - └─ required property \"a\" - └─ cannot decode undefined, should be string`) - ) - }) - }) - - it('stringify', async () => { - assert.deepStrictEqual(await _.stringify(_.string.decode('a'))(), '"a"') - assert.deepStrictEqual(await _.stringify(_.string.decode(null))(), 'cannot decode null, should be string') + it('fromRefinement', async () => { + const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') + assert.deepStrictEqual(await IntFromNumber.decode(1)(), D.success(1)) + assert.deepStrictEqual(await IntFromNumber.decode(1.2)(), D.failure(1.2, 'IntFromNumber')) }) }) diff --git a/test/Type.ts b/test/Type.ts index a2feb4f74..4edc326c5 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -3,7 +3,7 @@ import * as fc from 'fast-check' import { isRight, isLeft } from 'fp-ts/lib/Either' import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' import * as t from '../src' -import * as D from '../src/Decoder' +import * as UD from '../src/UnknownDecoder' import * as G from '../src/Guard' import { memoize, @@ -33,10 +33,10 @@ function interpreter( } function check(schema: Schema, type: t.Type): void { - const arb = interpreter(A.schemableArbitrary)(schema) - const decoder = interpreter(D.schemableDecoder)(schema) - const guard = interpreter(G.schemableGuard)(schema) - const itype = interpreter(_.schemableType)(schema) + const arb = interpreter(A.Schemable)(schema) + const decoder = interpreter(UD.Schemable)(schema) + const guard = interpreter(G.Schemable)(schema) + const itype = interpreter(_.Schemable)(schema) // decoder and type should be aligned fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) === isRight(type.decode(a)))) // interpreted type and type should be aligned diff --git a/test/UnknownDecoder.ts b/test/UnknownDecoder.ts new file mode 100644 index 000000000..641c22330 --- /dev/null +++ b/test/UnknownDecoder.ts @@ -0,0 +1,585 @@ +import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from '../src/DecodeError' +import * as _ from '../src/UnknownDecoder' +import * as FS from '../src/FreeSemigroup' +import * as G from '../src/Guard' +import * as D from '../src/Decoder' + +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: _.UnknownDecoder = _.fromGuard(undefinedGuard, 'undefined') + +const NumberFromString: _.UnknownDecoder = pipe( + _.string, + _.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) + }) +) + +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: _.UnknownDecoder = pipe( + _.number, + _.refine((n): n is Positive => n > 0, 'Positive') +) + +interface IntBrand { + readonly Int: unique symbol +} +type Int = number & IntBrand +const Int: _.UnknownDecoder = pipe( + _.number, + _.refine((n): n is Int => Number.isInteger(n), 'Int') +) + +describe('UnknownDecoder', () => { + // ------------------------------------------------------------------------------------- + // instances + // ------------------------------------------------------------------------------------- + + it('Functor', () => { + const decoder = _.Functor.map(_.string, (s) => s + '!') + assert.deepStrictEqual(decoder.decode('a'), _.success('a!')) + }) + + it('Alt', () => { + const decoder = _.Alt.alt(_.string, () => _.number) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + }) + + // ------------------------------------------------------------------------------------- + // primitives + // ------------------------------------------------------------------------------------- + + it('string', async () => { + assert.deepStrictEqual(_.string.decode('a'), _.success('a')) + assert.deepStrictEqual(_.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) + }) + + describe('number', () => { + it('number', async () => { + assert.deepStrictEqual(_.number.decode(1), _.success(1)) + assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) + }) + + it('should exclude NaN', () => { + assert.deepStrictEqual(_.number.decode(NaN), E.left(FS.of(DE.leaf(NaN, 'number')))) + }) + }) + + it('boolean', async () => { + assert.deepStrictEqual(_.boolean.decode(true), _.success(true)) + assert.deepStrictEqual(_.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) + }) + + it('UnknownArray', async () => { + assert.deepStrictEqual(_.UnknownArray.decode([1, 'a']), _.success([1, 'a'])) + assert.deepStrictEqual(_.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) + }) + + it('UnknownRecord', async () => { + assert.deepStrictEqual(_.UnknownRecord.decode({ a: 1, b: 'b' }), _.success({ a: 1, b: 'b' })) + assert.deepStrictEqual(_.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + }) + + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- + + describe('literal', () => { + it('should decode a valid input', async () => { + const decoder = _.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(null), _.success(null)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.literal('a', null) + assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) + }) + }) + + // ------------------------------------------------------------------------------------- + // combinators + // ------------------------------------------------------------------------------------- + + it('mapLeftWithInput', () => { + const decoder = pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + ) + assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) + }) + + it('compose', () => { + interface IntBrand { + readonly Int: unique symbol + } + + type Int = number & IntBrand + + const decoder = pipe(_.number, _.compose(D.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + assert.deepStrictEqual(decoder.decode('a'), _.failure('a', 'number')) + assert.deepStrictEqual(decoder.decode(1.2), _.failure(1.2, 'IntFromNumber')) + }) + + describe('nullable', () => { + it('should decode a valid input', () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual(decoder.decode(null), _.success(null)) + assert.deepStrictEqual(decoder.decode('1'), _.success(1)) + }) + + it('should reject an invalid input', () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual( + decoder.decode(undefined), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) + ) + assert.deepStrictEqual( + decoder.decode('a'), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) + ) + }) + }) + + describe('type', () => { + it('should decode a valid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) + }) + + it('should strip additional fields', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.type({ + a: undef + }) + assert.deepStrictEqual(decoder.decode({}), _.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual( + decoder.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.type({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.type({ a: _.string, b: _.string }) + assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) + }) + }) + + describe('partial', () => { + it('should decode a valid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({}), _.success({})) + }) + + it('should strip additional fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) + }) + + it('should not add missing fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({}), _.success({})) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: undefined }), _.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual( + decoder.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.partial({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + decoder.decode({ a: 1, b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.partial({ a: _.string, b: _.string }) + assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) + }) + }) + + describe('array', () => { + it('should decode a valid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(decoder.decode([]), _.success([])) + assert.deepStrictEqual(decoder.decode(['a']), _.success(['a'])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) + }) + + it('should collect all errors', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) + ) + }) + }) + + describe('record', () => { + it('should decode a valid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(decoder.decode({}), _.success({})) + assert.deepStrictEqual(decoder.decode({ a: 1 }), _.success({ a: 1 })) + }) + + it('should reject an invalid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + decoder.decode({ a: 'a' }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual( + decoder.decode({ a: 'a', b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + }) + + describe('tuple', () => { + it('should decode a valid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(['a', 1]), _.success(['a', 1])) + }) + + it('should handle zero components', async () => { + assert.deepStrictEqual(_.tuple().decode([]), _.success([])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual( + decoder.decode(['a']), + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual( + decoder.decode([1, 'a']), + E.left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) + ) + }) + + it('should strip additional components', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(['a', 1, true]), _.success(['a', 1])) + }) + }) + + describe('union', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(_.union(_.string).decode('a'), _.success('a')) + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + }) + + it('should reject an invalid input', () => { + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual( + decoder.decode(true), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), + FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) + ) + ) + ) + }) + }) + + describe('refine', () => { + it('should decode a valid input', () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + }) + + it('should reject an invalid input', () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) + }) + }) + + describe('intersect', () => { + it('should decode a valid input', () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a', b: 1 })) + }) + + it('should handle primitives', () => { + const decoder = pipe(Int, _.intersect(Positive)) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + }) + + it('should accumulate all errors', () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual( + decoder.decode({ a: 'a' }), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + decoder.decode({ b: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) + ) + assert.deepStrictEqual( + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + }) + + describe('sum', () => { + const sum = _.sum('_tag') + + it('should decode a valid input', () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), _.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), _.success({ _tag: 'B', b: 1 })) + }) + + it('should reject an invalid input', () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) + assert.deepStrictEqual( + decoder.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + ) + assert.deepStrictEqual( + decoder.decode({ _tag: 'A', a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should support empty records', () => { + const decoder = sum({}) + assert.deepStrictEqual( + decoder.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + ) + }) + }) + + interface A { + a: number + b?: A + } + + const lazyDecoder: _.UnknownDecoder = _.lazy('A', () => + pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) + ) + + describe('lazy', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), _.success({ a: 1 })) + assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), _.success({ a: 1, b: { a: 2 } })) + }) + + it('should reject an invalid input', () => { + assert.deepStrictEqual( + lazyDecoder.decode({ a: 1 }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: 'a' }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: '1', b: {} }), + E.left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) + ) + }) + }) + + // ------------------------------------------------------------------------------------- + // utils + // ------------------------------------------------------------------------------------- + + describe('draw', () => { + it('draw', () => { + const decoder = _.type({ + a: _.string, + b: _.number, + c: _.array(_.boolean), + d: _.nullable(_.string) + }) + assert.deepStrictEqual( + pipe(decoder.decode({ c: [1] }), E.mapLeft(_.draw)), + E.left(`required property "a" +└─ cannot decode undefined, should be string +required property "b" +└─ cannot decode undefined, should be number +required property "c" +└─ optional index 0 + └─ cannot decode 1, should be boolean +required property "d" +├─ member 0 +│ └─ cannot decode undefined, should be null +└─ member 1 + └─ cannot decode undefined, should be string`) + ) + }) + + it('should support lazy combinators', () => { + assert.deepStrictEqual( + pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(_.draw)), + E.left(`lazy type A +└─ optional property \"b\" + └─ lazy type A + └─ required property \"a\" + └─ cannot decode undefined, should be string`) + ) + }) + }) + + it('stringify', () => { + assert.deepStrictEqual(_.stringify(_.string.decode('a')), '"a"') + assert.deepStrictEqual(_.stringify(_.string.decode(null)), 'cannot decode null, should be string') + }) +}) diff --git a/test/UnknownTaskDecoder.ts b/test/UnknownTaskDecoder.ts new file mode 100644 index 000000000..8c9aedc45 --- /dev/null +++ b/test/UnknownTaskDecoder.ts @@ -0,0 +1,590 @@ +import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as TE from 'fp-ts/lib/TaskEither' +import * as DE from '../src/DecodeError' +import * as FS from '../src/FreeSemigroup' +import * as G from '../src/Guard' +import * as D from '../src/Decoder' +import * as TD from '../src/TaskDecoder' +import * as _ from '../src/UnknownTaskDecoder' + +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: _.UnknownTaskDecoder = _.fromGuard(undefinedGuard, 'undefined') + +const NumberFromString: _.UnknownTaskDecoder = pipe( + _.string, + _.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) + }) +) + +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: _.UnknownTaskDecoder = pipe( + _.number, + _.refine((n): n is Positive => n > 0, 'Positive') +) + +interface IntBrand { + readonly Int: unique symbol +} +type Int = number & IntBrand +const Int: _.UnknownTaskDecoder = pipe( + _.number, + _.refine((n): n is Int => Number.isInteger(n), 'Int') +) + +describe('UnknownTaskDecoder', () => { + // ------------------------------------------------------------------------------------- + // instances + // ------------------------------------------------------------------------------------- + + it('Functor', async () => { + const decoder = _.Functor.map(_.string, (s) => s + '!') + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a!')) + }) + + it('Alt', async () => { + const decoder = _.Alt.alt(_.string, () => _.number) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + }) + + // ------------------------------------------------------------------------------------- + // primitives + // ------------------------------------------------------------------------------------- + + it('string', async () => { + assert.deepStrictEqual(await _.string.decode('a')(), D.success('a')) + assert.deepStrictEqual(await _.string.decode(null)(), D.failure(null, 'string')) + }) + + it('number', async () => { + assert.deepStrictEqual(await _.number.decode(1)(), D.success(1)) + assert.deepStrictEqual(await _.number.decode(null)(), D.failure(null, 'number')) + }) + + it('boolean', async () => { + assert.deepStrictEqual(await _.boolean.decode(true)(), D.success(true)) + assert.deepStrictEqual(await _.boolean.decode(null)(), D.failure(null, 'boolean')) + }) + + it('UnknownArray', async () => { + assert.deepStrictEqual(await _.UnknownArray.decode([1, 'a'])(), D.success([1, 'a'])) + assert.deepStrictEqual(await _.UnknownArray.decode(null)(), D.failure(null, 'Array')) + }) + + it('UnknownRecord', async () => { + assert.deepStrictEqual(await _.UnknownRecord.decode({ a: 1, b: 'b' })(), D.success({ a: 1, b: 'b' })) + assert.deepStrictEqual(await _.UnknownRecord.decode(null)(), D.failure(null, 'Record')) + }) + + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- + + it('fromGuard', async () => { + const decoder = _.fromGuard(G.string, 'string') + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'string')) + }) + + describe('literal', () => { + it('should decode a valid input', async () => { + const decoder = _.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(null)(), D.success(null)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.literal('a', null) + assert.deepStrictEqual(await decoder.decode('b')(), D.failure('b', '"a" | null')) + }) + }) + + // ------------------------------------------------------------------------------------- + // combinators + // ------------------------------------------------------------------------------------- + + it('mapLeftWithInput', async () => { + const decoder = pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + ) + assert.deepStrictEqual(await decoder.decode('a')(), D.failure('a', 'not a number')) + }) + + it('compose', async () => { + interface IntBrand { + readonly Int: unique symbol + } + + type Int = number & IntBrand + + const decoder = pipe(_.number, _.compose(TD.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + assert.deepStrictEqual(await decoder.decode('a')(), D.failure('a', 'number')) + assert.deepStrictEqual(await decoder.decode(1.2)(), D.failure(1.2, 'IntFromNumber')) + }) + + describe('nullable', () => { + it('should decode a valid input', async () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual(await decoder.decode(null)(), D.success(null)) + assert.deepStrictEqual(await decoder.decode('1')(), D.success(1)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual( + await decoder.decode(undefined)(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) + ) + assert.deepStrictEqual( + await decoder.decode('a')(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) + ) + }) + }) + + describe('type', () => { + it('should decode a valid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) + }) + + it('should strip additional fields', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.type({ + a: undef + }) + assert.deepStrictEqual(await decoder.decode({})(), D.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual( + await decoder.decode({ a: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.type({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.type({ a: _.string, b: _.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), D.success({ a: 'a', b: 'b' })) + }) + }) + + describe('partial', () => { + it('should decode a valid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({})(), D.success({})) + }) + + it('should strip additional fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a' })) + }) + + it('should not add missing fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({})(), D.success({})) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: undefined })(), D.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual( + await decoder.decode({ a: 1 })(), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.partial({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + await decoder.decode({ a: 1, b: 'b' })(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.partial({ a: _.string, b: _.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), D.success({ a: 'a', b: 'b' })) + }) + }) + + describe('array', () => { + it('should decode a valid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(await decoder.decode([])(), D.success([])) + assert.deepStrictEqual(await decoder.decode(['a'])(), D.success(['a'])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Array')) + assert.deepStrictEqual( + await decoder.decode([1])(), + E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual( + await decoder.decode([1, 2])(), + E.left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) + ) + }) + }) + + describe('record', () => { + it('should decode a valid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(await decoder.decode({})(), D.success({})) + assert.deepStrictEqual(await decoder.decode({ a: 1 })(), D.success({ a: 1 })) + }) + + it('should reject an invalid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) + assert.deepStrictEqual( + await decoder.decode({ a: 'a' })(), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual( + await decoder.decode({ a: 'a', b: 'b' })(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + }) + + describe('tuple', () => { + it('should decode a valid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(['a', 1])(), D.success(['a', 1])) + }) + + it('should handle zero components', async () => { + assert.deepStrictEqual(await _.tuple().decode([])(), D.success([])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Array')) + assert.deepStrictEqual( + await decoder.decode(['a'])(), + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + await decoder.decode([1, 2])(), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual( + await decoder.decode([1, 'a'])(), + E.left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) + ) + }) + + it('should strip additional components', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(['a', 1, true])(), D.success(['a', 1])) + }) + }) + + describe('union', () => { + it('should decode a valid input', async () => { + assert.deepStrictEqual(await _.union(_.string).decode('a')(), D.success('a')) + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual( + await decoder.decode(true)(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), + FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) + ) + ) + ) + }) + }) + + describe('refine', () => { + it('should decode a valid input', async () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + }) + + it('should reject an invalid input', async () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'string')) + assert.deepStrictEqual(await decoder.decode('')(), D.failure('', 'NonEmptyString')) + }) + }) + + describe('intersect', () => { + it('should decode a valid input', async () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a', b: 1 })) + }) + + it('should handle primitives', async () => { + const decoder = pipe(Int, _.intersect(Positive)) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + }) + + it('should accumulate all errors', async () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual( + await decoder.decode({ a: 'a' })(), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + await decoder.decode({ b: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) + ) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + }) + + describe('sum', () => { + const sum = _.sum('_tag') + + it('should decode a valid input', async () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), D.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), D.success({ _tag: 'B', b: 1 })) + }) + + it('should reject an invalid input', async () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'object')) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + ) + assert.deepStrictEqual( + await decoder.decode({ _tag: 'A', a: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should support empty records', async () => { + const decoder = sum({}) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + ) + }) + }) + + interface A { + a: number + b?: A + } + + const lazyDecoder: _.UnknownTaskDecoder = _.lazy('A', () => + pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) + ) + + describe('lazy', () => { + it('should decode a valid input', async () => { + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), D.success({ a: 1 })) + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), D.success({ a: 1, b: { a: 2 } })) + }) + + it('should reject an invalid input', async () => { + assert.deepStrictEqual( + await lazyDecoder.decode({ a: 1 })(), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + ) + assert.deepStrictEqual( + await lazyDecoder.decode({ a: 'a' })(), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + ) + assert.deepStrictEqual( + await lazyDecoder.decode({ a: '1', b: {} })(), + E.left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) + ) + }) + }) + + // ------------------------------------------------------------------------------------- + // utils + // ------------------------------------------------------------------------------------- + + describe('draw', () => { + it('draw', async () => { + const decoder = _.type({ + a: _.string, + b: _.number, + c: _.array(_.boolean), + d: _.nullable(_.string) + }) + assert.deepStrictEqual( + await pipe(decoder.decode({ c: [1] }), TE.mapLeft(_.draw))(), + E.left(`required property "a" +└─ cannot decode undefined, should be string +required property "b" +└─ cannot decode undefined, should be number +required property "c" +└─ optional index 0 + └─ cannot decode 1, should be boolean +required property "d" +├─ member 0 +│ └─ cannot decode undefined, should be null +└─ member 1 + └─ cannot decode undefined, should be string`) + ) + }) + + it('should support lazy combinators', async () => { + assert.deepStrictEqual( + await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(_.draw))(), + E.left(`lazy type A +└─ optional property \"b\" + └─ lazy type A + └─ required property \"a\" + └─ cannot decode undefined, should be string`) + ) + }) + }) + + it('stringify', async () => { + assert.deepStrictEqual(await _.stringify(_.string.decode('a'))(), '"a"') + assert.deepStrictEqual(await _.stringify(_.string.decode(null))(), 'cannot decode null, should be string') + }) +}) From 7c058b828592f7bcb7a885a36a7cccbb5316cf38 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 07:43:08 +0200 Subject: [PATCH 101/222] make UnknownDecoder module useless --- CHANGELOG.md | 12 + Schema.md | 10 +- docs/modules/Codec.ts.md | 6 +- docs/modules/Decoder.ts.md | 297 +++++++++++-- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/Schema.ts.md | 27 +- docs/modules/Schemable.ts.md | 77 ++++ docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/UnknownTaskDecoder.ts.md | 2 +- dtslint/ts3.5/Decoder.ts | 74 +++- src/Codec.ts | 16 +- src/Decoder.ts | 288 ++++++++++++- src/JsonCodec.ts | 8 +- src/Schema.ts | 11 +- src/Schemable.ts | 55 ++- src/TaskDecoder.ts | 6 +- src/UnknownTaskDecoder.ts | 6 +- test/Codec.ts | 104 ++--- test/Decoder.ts | 582 +++++++++++++++++++++++++- test/Type.ts | 22 +- 20 files changed, 1456 insertions(+), 151 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b18814c66..0f797f83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,16 @@ - rename `schemableGuard` to `Schemable` (@gcanti) - `KleisliDecoder` - rename to `Decoder` (@gcanti) + - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) + - rename `type` to `ktype` + - rename `partial` to `kpartial` + - rename `array` to `karray` + - rename `record` to `krecord` + - rename `tuple` to `ktuple` + - rename `sum` to `ksum` + - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) + - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) + - add `draw` function (@gcanti) - `KleisliTaskDecoder` - rename to `TaskDecoder` (@gcanti) - `JsonCodec` @@ -41,6 +51,8 @@ - `JsonEncoder` - rename `contravariantJsonCodec` to `Contravariant` (@gcanti) - rename `schemableJsonEncoder` to `Schemable` (@gcanti) + - `Schemable` + - add `Schemable2C`, `WithUnknownContainers2C`, `WithUnion2C`, `WithRefine2C` (@gcanti) - `TaskDecoder` - rename to `UnknownTaskDecoder` (@gcanti) - rename `functorTaskDecoder` to `Functor` (@gcanti) diff --git a/Schema.md b/Schema.md index 879e80fb2..c149c7545 100644 --- a/Schema.md +++ b/Schema.md @@ -33,11 +33,11 @@ export const Person = S.make((S) => }) ) -export const decoderPerson = S.interpreter(D.schemableDecoder)(Person) -export const encoderPerson = S.interpreter(JE.schemableJsonEncoder)(Person) -export const codecPerson = S.interpreter(JC.schemableJsonCodec)(Person) -export const guardPerson = S.interpreter(G.schemableGuard)(Person) -export const eqPerson = S.interpreter(Eq.schemableEq)(Person) +export const decoderPerson = S.interpreter(D.Schemable)(Person) +export const encoderPerson = S.interpreter(JE.Schemable)(Person) +export const codecPerson = S.interpreter(JC.Schemable)(Person) +export const guardPerson = S.interpreter(G.Schemable)(Person) +export const eqPerson = S.interpreter(Eq.Schemable)(Person) ``` # How to extend the built-in `Schema` diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index fba4f479f..7dfca0f55 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -199,7 +199,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function fromDecoder(decoder: D.UnknownDecoder): Codec +export declare function fromDecoder(decoder: D.Decoder): Codec ``` Added in v2.2.3 @@ -221,7 +221,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function make(decoder: D.UnknownDecoder, encoder: E.Encoder): Codec +export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec ``` Added in v2.2.3 @@ -270,7 +270,7 @@ Laws: **Signature** ```ts -export interface Codec extends D.UnknownDecoder, E.Encoder {} +export interface Codec extends D.Decoder, E.Encoder {} ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 407864599..f126d0240 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -21,6 +21,8 @@ Added in v2.2.7 - [Alt](#alt) - [alt](#alt) +- [Category](#category) + - [id](#id) - [DecodeError](#decodeerror) - [DecodeError (type alias)](#decodeerror-type-alias) - [error](#error) @@ -28,10 +30,17 @@ Added in v2.2.7 - [success](#success) - [Functor](#functor) - [map](#map) +- [Semigroupoid](#semigroupoid) + - [compose](#compose) - [combinators](#combinators) - [array](#array) - - [compose](#compose) - [intersect](#intersect) + - [karray](#karray) + - [kpartial](#kpartial) + - [krecord](#krecord) + - [ksum](#ksum) + - [ktuple](#ktuple) + - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -44,13 +53,28 @@ Added in v2.2.7 - [type](#type) - [union](#union) - [constructors](#constructors) + - [fromGuard](#fromguard) - [fromRefinement](#fromrefinement) - [literal](#literal) +- [instances](#instances) + - [Alt](#alt-1) + - [Category](#category-1) + - [Functor](#functor-1) + - [Schemable](#schemable) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) - [model](#model) - [Decoder (interface)](#decoder-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) + - [draw](#draw) --- @@ -66,6 +90,18 @@ export declare const alt: (that: () => Decoder) => (me: Decoder() => Decoder +``` + +Added in v2.2.8 + # DecodeError ## DecodeError (type alias) @@ -123,27 +159,29 @@ export declare const map: (f: (a: A) => B) => (fa: Decoder) => De Added in v2.2.7 -# combinators +# Semigroupoid -## array +## compose **Signature** ```ts -export declare const array: (items: Decoder) => Decoder +export declare const compose: (to: Decoder) => (from: Decoder) => Decoder ``` Added in v2.2.7 -## compose +# combinators + +## array **Signature** ```ts -export declare const compose: (to: Decoder) => (from: Decoder) => Decoder +export declare const array: (items: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## intersect @@ -157,6 +195,76 @@ export declare const intersect: ( Added in v2.2.7 +## karray + +**Signature** + +```ts +export declare const karray: (items: Decoder) => Decoder +``` + +Added in v2.2.7 + +## kpartial + +**Signature** + +```ts +export declare const kpartial:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }>> +``` + +Added in v2.2.7 + +## krecord + +**Signature** + +```ts +export declare const krecord: (codomain: Decoder) => Decoder, Record> +``` + +Added in v2.2.7 + +## ksum + +**Signature** + +```ts +export declare const ksum: ( + tag: T +) => >>( + members: MS +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> +``` + +Added in v2.2.7 + +## ktuple + +**Signature** + +```ts +export declare const ktuple: []>( + ...components: C +) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> +``` + +Added in v2.2.7 + +## ktype + +**Signature** + +```ts +export declare const ktype:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> +``` + +Added in v2.2.7 + ## lazy **Signature** @@ -206,22 +314,22 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }>> +export declare const partial: ( + properties: { [K in keyof A]: Decoder } +) => Decoder> ``` -Added in v2.2.7 +Added in v2.2.8 ## record **Signature** ```ts -export declare const record: (codomain: Decoder) => Decoder, Record> +export declare const record: (codomain: Decoder) => Decoder> ``` -Added in v2.2.7 +Added in v2.2.8 ## refine @@ -243,36 +351,34 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => >>( - members: MS -) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> +) => (members: { [K in keyof A]: Decoder }) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## tuple **Signature** ```ts -export declare const tuple: []>( - ...components: C -) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> +export declare const tuple: ( + ...components: { [K in keyof A]: Decoder } +) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## type **Signature** ```ts -export declare const type:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> +export declare const type: ( + properties: { [K in keyof A]: Decoder } +) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## union @@ -288,6 +394,16 @@ Added in v2.2.7 # constructors +## fromGuard + +**Signature** + +```ts +export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder +``` + +Added in v2.2.7 + ## fromRefinement **Signature** @@ -303,7 +419,74 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: (...values: A) => Decoder +export declare const literal: ( + ...values: A +) => Decoder +``` + +Added in v2.2.7 + +# instances + +## Alt + +**Signature** + +```ts +export declare const Alt: Alt2<'io-ts/Decoder'> +``` + +Added in v2.2.7 + +## Category + +**Signature** + +```ts +export declare const Category: Category2<'io-ts/Decoder'> +``` + +Added in v2.2.8 + +## Functor + +**Signature** + +```ts +export declare const Functor: Functor2<'io-ts/Decoder'> +``` + +Added in v2.2.7 + +## Schemable + +**Signature** + +```ts +export declare const Schemable: S.Schemable2C<'io-ts/Decoder', unknown> & + S.WithUnknownContainers2C<'io-ts/Decoder', unknown> & + S.WithUnion2C<'io-ts/Decoder', unknown> & + S.WithRefine2C<'io-ts/Decoder', unknown> +``` + +Added in v2.2.7 + +## URI + +**Signature** + +```ts +export declare const URI: 'io-ts/Decoder' +``` + +Added in v2.2.7 + +## URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI ``` Added in v2.2.7 @@ -320,6 +503,58 @@ export interface Decoder extends K.Kleisli {} Added in v2.2.7 +# primitives + +## UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: Decoder +``` + +Added in v2.2.8 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: Decoder> +``` + +Added in v2.2.8 + +## boolean + +**Signature** + +```ts +export declare const boolean: Decoder +``` + +Added in v2.2.8 + +## number + +**Signature** + +```ts +export declare const number: Decoder +``` + +Added in v2.2.8 + +## string + +**Signature** + +```ts +export declare const string: Decoder +``` + +Added in v2.2.8 + # utils ## InputOf (type alias) @@ -341,3 +576,13 @@ export type TypeOf = K.TypeOf ``` Added in v2.2.7 + +## draw + +**Signature** + +```ts +export declare const draw: (e: FS.FreeSemigroup>) => string +``` + +Added in v2.2.8 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index cff68e608..c67761083 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -204,7 +204,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const make: (decoder: UD.UnknownDecoder, encoder: JE.JsonEncoder) => JsonCodec +export declare const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec ``` Added in v2.2.3 diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 9043f23ca..2d7fd2a33 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -72,7 +72,32 @@ Added in v2.2.0 **Signature** ```ts -export declare function interpreter(S: Schemable1): (schema: Schema) => Kind +export declare const interpreter: { + ( + S: Schemable2C + ): (schema: Schema) => Kind2 + < + S extends + | 'Eq' + | 'io-ts/Guard' + | 'io-ts/JsonCodec' + | 'io-ts/JsonEncoder' + | 'io-ts/Type' + | 'io-ts/UnknownDecoder' + | 'io-ts/UnknownTaskDecoder' + | 'Ord' + | 'Option' + | 'ReadonlyRecord' + | 'ReadonlyNonEmptyArray' + | 'NonEmptyArray' + | 'Array' + | 'Record' + | 'IO' + | 'Task' + >( + S: Schemable1 + ): (schema: Schema) => Kind +} ``` Added in v2.2.3 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 1e42f3acf..e0e70ffdd 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -23,12 +23,16 @@ Added in v2.2.0 - [Literal (type alias)](#literal-type-alias) - [Schemable (interface)](#schemable-interface) - [Schemable1 (interface)](#schemable1-interface) + - [Schemable2C (interface)](#schemable2c-interface) - [WithRefine (interface)](#withrefine-interface) - [WithRefine1 (interface)](#withrefine1-interface) + - [WithRefine2C (interface)](#withrefine2c-interface) - [WithUnion (interface)](#withunion-interface) - [WithUnion1 (interface)](#withunion1-interface) + - [WithUnion2C (interface)](#withunion2c-interface) - [WithUnknownContainers (interface)](#withunknowncontainers-interface) - [WithUnknownContainers1 (interface)](#withunknowncontainers1-interface) + - [WithUnknownContainers2C (interface)](#withunknowncontainers2c-interface) - [memoize](#memoize) --- @@ -95,6 +99,37 @@ export interface Schemable1 { Added in v2.2.3 +## Schemable2C (interface) + +**Signature** + +```ts +export interface Schemable2C { + readonly URI: S + readonly literal: ]>(...values: A) => Kind2 + readonly string: Kind2 + readonly number: Kind2 + readonly boolean: Kind2 + readonly nullable: (or: Kind2) => Kind2 + readonly type: (properties: { [K in keyof A]: Kind2 }) => Kind2 + readonly partial: ( + properties: { [K in keyof A]: Kind2 } + ) => Kind2> + readonly record: (codomain: Kind2) => Kind2> + readonly array: (items: Kind2) => Kind2> + readonly tuple: >( + ...components: { [K in keyof A]: Kind2 } + ) => Kind2 + readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: Kind2 }) => Kind2 + readonly lazy: (id: string, f: () => Kind2) => Kind2 +} +``` + +Added in v2.2.8 + ## WithRefine (interface) **Signature** @@ -119,6 +154,21 @@ export interface WithRefine1 { Added in v2.2.3 +## WithRefine2C (interface) + +**Signature** + +```ts +export interface WithRefine2C { + readonly refine: ( + refinement: (a: A) => a is B, + id: string + ) => (from: Kind2) => Kind2 +} +``` + +Added in v2.2.8 + ## WithUnion (interface) **Signature** @@ -147,6 +197,20 @@ export interface WithUnion1 { Added in v2.2.3 +## WithUnion2C (interface) + +**Signature** + +```ts +export interface WithUnion2C { + readonly union: ]>( + ...members: { [K in keyof A]: Kind2 } + ) => Kind2 +} +``` + +Added in v2.2.8 + ## WithUnknownContainers (interface) **Signature** @@ -173,6 +237,19 @@ export interface WithUnknownContainers1 { Added in v2.2.3 +## WithUnknownContainers2C (interface) + +**Signature** + +```ts +export interface WithUnknownContainers2C { + readonly UnknownArray: Kind2> + readonly UnknownRecord: Kind2> +} +``` + +Added in v2.2.8 + ## memoize **Signature** diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 3ce71a5d0..3854d2bcb 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -320,7 +320,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const literal: ( +export declare const literal: ( ...values: A ) => TaskDecoder ``` diff --git a/docs/modules/UnknownTaskDecoder.ts.md b/docs/modules/UnknownTaskDecoder.ts.md index 69eb69e1a..a460ecb97 100644 --- a/docs/modules/UnknownTaskDecoder.ts.md +++ b/docs/modules/UnknownTaskDecoder.ts.md @@ -306,7 +306,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const fromDecoder: (decoder: D.UnknownDecoder) => UnknownTaskDecoder +export declare const fromDecoder: (decoder: D.Decoder) => UnknownTaskDecoder ``` Added in v2.2.7 diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index d6e41cafe..4a4161919 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -1,46 +1,96 @@ +import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from '../../src/DecodeError' import * as _ from '../../src/Decoder' +import * as FS from '../../src/FreeSemigroup' -declare const string: _.Decoder +declare const StringFromString: _.Decoder declare const NumberFromString: _.Decoder // -// type +// TypeOf +// + +// $ExpectType number +export type TypeOfNumberFromString = _.TypeOf + +// +// InputOf +// + +// $ExpectType string +export type InputOfNumberFromString = _.InputOf + +// +// ktype // // $ExpectType Decoder<{ a: string; }, { a: number; }> -_.type({ +_.ktype({ a: NumberFromString }) // -// partial +// kpartial // // $ExpectType Decoder<{ a: string; }, Partial<{ a: number; }>> -_.partial({ +_.kpartial({ a: NumberFromString }) // -// tuple +// ktuple // // $ExpectType Decoder<[string], [number]> -_.tuple(NumberFromString) +_.ktuple(NumberFromString) // -// sum +// ksum // // $ExpectType Decoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: NumberFromString }), - B: _.type({ _tag: _.literal('B'), b: NumberFromString }) +_.ksum('_tag')({ + A: _.ktype({ _tag: _.literal('A'), a: NumberFromString }), + B: _.ktype({ _tag: _.literal('B'), b: NumberFromString }) }) // // union // +// $ExpectType Decoder +_.union(_.number, _.string) + // $ExpectType Decoder -_.union(NumberFromString, string) +_.union(NumberFromString, StringFromString) + +// ------------------------------------------------------------------------------------- +// unknown input +// ------------------------------------------------------------------------------------- + +// $ExpectType Decoder +const A = _.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType Decoder; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) + +// +// mapLeftWithInput +// + +// $ExpectType Decoder +pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) +) diff --git a/src/Codec.ts b/src/Codec.ts index d11b77c7e..c1647fd80 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -8,12 +8,12 @@ * * @since 2.2.3 */ +import { identity } from 'fp-ts/lib/function' import { Invariant2 } from 'fp-ts/lib/Invariant' -import * as D from './UnknownDecoder' +import { pipe } from 'fp-ts/lib/pipeable' +import * as D from './Decoder' import * as E from './Encoder' import { Literal } from './Schemable' -import { identity } from 'fp-ts/lib/function' -import { pipe } from 'fp-ts/lib/pipeable' // ------------------------------------------------------------------------------------- // model @@ -28,7 +28,7 @@ import { pipe } from 'fp-ts/lib/pipeable' * @category model * @since 2.2.3 */ -export interface Codec extends D.UnknownDecoder, E.Encoder {} +export interface Codec extends D.Decoder, E.Encoder {} // ------------------------------------------------------------------------------------- // utils @@ -52,7 +52,7 @@ export type OutputOf = E.OutputOf * @category constructors * @since 2.2.3 */ -export function make(decoder: D.UnknownDecoder, encoder: E.Encoder): Codec { +export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { return { decode: decoder.decode, encode: encoder.encode @@ -63,7 +63,7 @@ export function make(decoder: D.UnknownDecoder, encoder: E.Encoder(decoder: D.UnknownDecoder): Codec { +export function fromDecoder(decoder: D.Decoder): Codec { return { decode: decoder.decode, encode: identity @@ -151,7 +151,7 @@ export function nullable(or: Codec): Codec { export function type

>>( properties: P ): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { - const decoder: D.UnknownDecoder<{ [K in keyof P]: TypeOf }> = D.type(properties) as any + const decoder: D.Decoder }> = D.type(properties) as any return make(decoder, E.type(properties)) } @@ -190,7 +190,7 @@ export function array(items: Codec): Codec, Array> { export function tuple>>( ...components: C ): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> { - const decoder: D.UnknownDecoder<{ [K in keyof C]: TypeOf }> = D.tuple(...components) as any + const decoder: D.Decoder }> = D.tuple(...components) as any const encoder = E.tuple(...components) return make(decoder, encoder) } diff --git a/src/Decoder.ts b/src/Decoder.ts index efdfae3c9..44cccfb61 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -8,16 +8,19 @@ * * @since 2.2.7 */ -import { Alt2C } from 'fp-ts/lib/Alt' +import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import { Category2 } from 'fp-ts/lib/Category' import * as E from 'fp-ts/lib/Either' import { Refinement } from 'fp-ts/lib/function' +import { Functor2 } from 'fp-ts/lib/Functor' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' +import * as G from './Guard' import * as K from './Kleisli' -import { Literal } from './Schemable' +import * as S from './Schemable' // ------------------------------------------------------------------------------------- // Kleisli config @@ -118,10 +121,70 @@ export const fromRefinement = (refinement: Refinement, exp * @category constructors * @since 2.2.7 */ -export const literal: ]>(...values: A) => Decoder = +export const fromGuard = (guard: G.Guard, expected: string): Decoder => + fromRefinement(guard.is, expected) + +/** + * @category constructors + * @since 2.2.7 + */ +export const literal: ]>( + ...values: A +) => Decoder = /*#__PURE__*/ K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @category primitives + * @since 2.2.8 + */ +export const string: Decoder = + /*#__PURE__*/ + fromGuard(G.string, 'string') + +/** + * @category primitives + * @since 2.2.8 + */ +export const number: Decoder = + /*#__PURE__*/ + fromGuard(G.number, 'number') + +/** + * @category primitives + * @since 2.2.8 + */ +export const boolean: Decoder = + /*#__PURE__*/ + fromGuard(G.boolean, 'boolean') + +/** + * @category primitives + * @since 2.2.8 + */ +export const UnknownArray: Decoder> = + /*#__PURE__*/ + fromGuard(G.UnknownArray, 'Array') + +/** + * @category primitives + * @since 2.2.8 + */ +export const UnknownRecord: Decoder> = + /*#__PURE__*/ + fromGuard(G.UnknownRecord, 'Record') + +/** + * @internal + */ +export const object: Decoder = + /*#__PURE__*/ + fromGuard(G.object, 'object') + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -165,43 +228,81 @@ export const nullable: (or: Decoder) => Decoder * @category combinators * @since 2.2.7 */ -export const type =

>>( +export const ktype =

>>( properties: P ): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) +/** + * @category combinators + * @since 2.2.8 + */ +export const type = ( + properties: { [K in keyof A]: Decoder } +): Decoder => pipe(object as any, compose(ktype(properties))) + /** * @category combinators * @since 2.2.7 */ -export const partial =

>>( +export const kpartial =

>>( properties: P ): Decoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) +/** + * @category combinators + * @since 2.2.8 + */ +export const partial = ( + properties: { [K in keyof A]: Decoder } +): Decoder> => pipe(object as any, compose(kpartial(properties))) + /** * @category combinators * @since 2.2.7 */ -export const array = (items: Decoder): Decoder, Array> => +export const karray = (items: Decoder): Decoder, Array> => K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) +/** + * @category combinators + * @since 2.2.8 + */ +export const array = (items: Decoder): Decoder> => + pipe(UnknownArray, compose(karray(items))) + /** * @category combinators * @since 2.2.7 */ -export const record = (codomain: Decoder): Decoder, Record> => +export const krecord = (codomain: Decoder): Decoder, Record> => K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +/** + * @category combinators + * @since 2.2.8 + */ +export const record = (codomain: Decoder): Decoder> => + pipe(UnknownRecord, compose(krecord(codomain))) + /** * @category combinators * @since 2.2.7 */ -export const tuple = >>( +export const ktuple = >>( ...components: C ): Decoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) +/** + * @category combinators + * @since 2.2.8 + */ +export const tuple = >( + ...components: { [K in keyof A]: Decoder } +): Decoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any + /** * @category combinators * @since 2.2.7 @@ -224,7 +325,7 @@ export const intersect: (right: Decoder) => (left: Decoder< * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => >>( +export const ksum = (tag: T) => >>( members: MS ): Decoder, TypeOf> => K.sum(M)((tag, value, keys) => @@ -239,19 +340,29 @@ export const sum = (tag: T) => (id: string, f: () => Decoder) => Decoder = - /*#__PURE__*/ - K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +export const sum = (tag: T) => ( + members: { [K in keyof A]: Decoder } +): Decoder => pipe(object as any, compose(ksum(tag)(members))) /** * @category combinators * @since 2.2.7 */ -export const compose: (to: Decoder) => (from: Decoder) => Decoder = +export const lazy: (id: string, f: () => Decoder) => Decoder = /*#__PURE__*/ - K.compose(M) + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const map_: Functor2['map'] = (fa, f) => pipe(fa, map(f)) + +const alt_: Alt2['alt'] = (me, that) => pipe(me, alt(that)) + +const compose_: Category2['compose'] = (ab, la) => pipe(la, compose(ab)) // ------------------------------------------------------------------------------------- // pipeables @@ -273,6 +384,101 @@ export const alt: (that: () => Decoder) => (me: Decoder) => De /*#__PURE__*/ K.alt(M) +/** + * @category Semigroupoid + * @since 2.2.7 + */ +export const compose: (to: Decoder) => (from: Decoder) => Decoder = + /*#__PURE__*/ + K.compose(M) + +/** + * @category Category + * @since 2.2.8 + */ +export const id = (): Decoder => ({ + decode: success +}) + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @category instances + * @since 2.2.7 + */ +export const URI = 'io-ts/Decoder' + +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind2 { + readonly [URI]: Decoder + } +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Functor: Functor2 = { + URI, + map: map_ +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Alt: Alt2 = { + URI, + map: map_, + alt: alt_ +} + +/** + * @category instances + * @since 2.2.8 + */ +export const Category: Category2 = { + URI, + compose: compose_, + id +} + +/** + * @category instances + * @since 2.2.7 + */ +export const Schemable: S.Schemable2C & + S.WithUnknownContainers2C & + S.WithUnion2C & + S.WithRefine2C = { + URI, + literal, + string, + number, + boolean, + nullable, + type, + partial, + record, + array, + tuple: tuple as S.Schemable2C['tuple'], + intersect, + sum, + lazy, + UnknownArray, + UnknownRecord, + union: union as S.WithUnion2C['union'], + refine: refine as S.WithRefine2C['refine'] +} + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- @@ -286,3 +492,55 @@ export type TypeOf = K.TypeOf * @since 2.2.7 */ export type InputOf = K.InputOf + +interface Tree { + readonly value: A + readonly forest: ReadonlyArray> +} + +const empty: Array = [] + +const make = (value: A, forest: ReadonlyArray> = empty): Tree => ({ + value, + forest +}) + +const drawTree = (tree: Tree): string => tree.value + drawForest('\n', tree.forest) + +const drawForest = (indentation: string, forest: ReadonlyArray>): string => { + let r: string = '' + const len = forest.length + let tree: Tree + for (let i = 0; i < len; i++) { + tree = forest[i] + const isLast = i === len - 1 + r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value + r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest) + } + return r +} + +const toTree: (e: DE.DecodeError) => Tree = DE.fold({ + Leaf: (input, error) => make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), + Member: (index, errors) => make(`member ${index}`, toForest(errors)), + Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) +}) + +const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( + (value) => [toTree(value)], + (left, right) => toForest(left).concat(toForest(right)) +) + +/** + * @since 2.2.8 + */ +export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') + +/** + * @internal + */ +export const stringify: (e: E.Either) => string = + /*#__PURE__*/ + E.fold(draw, (a) => JSON.stringify(a, null, 2)) diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index c8450a19b..05a703688 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -9,9 +9,9 @@ * @since 2.2.3 */ import { Invariant1 } from 'fp-ts/lib/Invariant' -import * as UD from './UnknownDecoder' -import * as JE from './JsonEncoder' import * as C from './Codec' +import * as D from './Decoder' +import * as JE from './JsonEncoder' import { Literal, Schemable1, WithRefine1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -46,7 +46,7 @@ export type TypeOf = JE.TypeOf * @category constructors * @since 2.2.3 */ -export const make: (decoder: UD.UnknownDecoder, encoder: JE.JsonEncoder) => JsonCodec = C.make +export const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec = C.make /** * @category constructors @@ -86,7 +86,7 @@ export const boolean: JsonCodec = C.boolean * @since 2.2.3 */ export const mapLeftWithInput: ( - f: (actual: unknown, e: UD.DecodeError) => UD.DecodeError + f: (actual: unknown, e: D.DecodeError) => D.DecodeError ) => (codec: JsonCodec) => JsonCodec = C.mapLeftWithInput /** diff --git a/src/Schema.ts b/src/Schema.ts index 3e2b4e434..2a7e20652 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -8,8 +8,8 @@ * * @since 2.2.0 */ -import { HKT, URIS, Kind } from 'fp-ts/lib/HKT' -import { memoize, Schemable, Schemable1 } from './Schemable' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' +import { memoize, Schemable, Schemable1, Schemable2C } from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -47,6 +47,7 @@ export type TypeOf = S extends Schema ? A : never /** * @since 2.2.3 */ -export function interpreter(S: Schemable1): (schema: Schema) => Kind { - return (schema: any) => schema(S) -} +export const interpreter: { + (S: Schemable2C): (schema: Schema) => Kind2 + (S: Schemable1): (schema: Schema) => Kind +} = (S: any) => (schema: any) => schema(S) diff --git a/src/Schemable.ts b/src/Schemable.ts index aed1a4b97..bfd0a51c8 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' /** * @since 2.2.0 @@ -55,6 +55,32 @@ export interface Schemable1 { readonly lazy: (id: string, f: () => Kind) => Kind } +/** + * @since 2.2.8 + */ +export interface Schemable2C { + readonly URI: S + readonly literal: ]>(...values: A) => Kind2 + readonly string: Kind2 + readonly number: Kind2 + readonly boolean: Kind2 + readonly nullable: (or: Kind2) => Kind2 + readonly type: (properties: { [K in keyof A]: Kind2 }) => Kind2 + readonly partial: ( + properties: { [K in keyof A]: Kind2 } + ) => Kind2> + readonly record: (codomain: Kind2) => Kind2> + readonly array: (items: Kind2) => Kind2> + readonly tuple: >( + ...components: { [K in keyof A]: Kind2 } + ) => Kind2 + readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: Kind2 }) => Kind2 + readonly lazy: (id: string, f: () => Kind2) => Kind2 +} + /** * @since 2.2.3 */ @@ -71,6 +97,14 @@ export interface WithUnknownContainers1 { readonly UnknownRecord: Kind> } +/** + * @since 2.2.8 + */ +export interface WithUnknownContainers2C { + readonly UnknownArray: Kind2> + readonly UnknownRecord: Kind2> +} + /** * @since 2.2.3 */ @@ -89,6 +123,15 @@ export interface WithUnion1 { ) => Kind } +/** + * @since 2.2.8 + */ +export interface WithUnion2C { + readonly union: ]>( + ...members: { [K in keyof A]: Kind2 } + ) => Kind2 +} + /** * @since 2.2.3 */ @@ -103,6 +146,16 @@ export interface WithRefine1 { readonly refine: (refinement: (a: A) => a is B, id: string) => (from: Kind) => Kind } +/** + * @since 2.2.8 + */ +export interface WithRefine2C { + readonly refine: ( + refinement: (a: A) => a is B, + id: string + ) => (from: Kind2) => Kind2 +} + /** * @since 2.2.0 */ diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index c9e147ec7..9d4229d0a 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -17,10 +17,10 @@ import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' import * as DE from './DecodeError' +import * as D from './Decoder' import * as FS from './FreeSemigroup' import * as K from './Kleisli' -import * as D from './Decoder' -import { Literal } from './Schemable' +import * as S from './Schemable' // ------------------------------------------------------------------------------------- // Kleisli config @@ -119,7 +119,7 @@ export const fromRefinement = (refinement: Refinement, exp * @category constructors * @since 2.2.7 */ -export const literal: ]>( +export const literal: ]>( ...values: A ) => TaskDecoder = /*#__PURE__*/ diff --git a/src/UnknownTaskDecoder.ts b/src/UnknownTaskDecoder.ts index 4d1caf7c1..a47031f5e 100644 --- a/src/UnknownTaskDecoder.ts +++ b/src/UnknownTaskDecoder.ts @@ -13,10 +13,10 @@ import { Functor1 } from 'fp-ts/lib/Functor' import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' -import * as D from './UnknownDecoder' +import * as D from './Decoder' import * as G from './Guard' -import * as KTD from './TaskDecoder' import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import * as KTD from './TaskDecoder' // ------------------------------------------------------------------------------------- // model @@ -64,7 +64,7 @@ export const failure: (actual: unknown, message: string) => TE.TaskEi * @category constructors * @since 2.2.7 */ -export const fromDecoder: (decoder: D.UnknownDecoder) => UnknownTaskDecoder = KTD.fromKleisliDecoder +export const fromDecoder: (decoder: D.Decoder) => UnknownTaskDecoder = KTD.fromKleisliDecoder /** * @category constructors diff --git a/test/Codec.ts b/test/Codec.ts index da718676b..1ce903c33 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as C from '../src/Codec' -import * as UD from '../src/UnknownDecoder' +import * as D from '../src/Decoder' import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' @@ -9,10 +9,10 @@ import * as E from 'fp-ts/lib/Either' const NumberFromString: C.Codec = C.make( pipe( - UD.string, - UD.parse((s) => { + D.string, + D.parse((s) => { const n = parseFloat(s) - return isNaN(n) ? UD.failure(s, 'parsable to a number') : UD.success(n) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) }) ), { encode: String } @@ -39,7 +39,7 @@ const Int: C.Codec = pipe( const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } -const undef: C.Codec = C.fromDecoder(UD.fromGuard(undefinedGuard, 'undefined')) +const undef: C.Codec = C.fromDecoder(D.fromGuard(undefinedGuard, 'undefined')) describe('Codec', () => { describe('Invariant', () => { @@ -49,7 +49,7 @@ describe('Codec', () => { (s) => ({ value: s }), ({ value }) => value ) - assert.deepStrictEqual(codec.decode('a'), UD.success({ value: 'a' })) + assert.deepStrictEqual(codec.decode('a'), D.success({ value: 'a' })) assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) }) @@ -62,7 +62,7 @@ describe('Codec', () => { ({ value }) => value ) ) - assert.deepStrictEqual(codec.decode('a'), UD.success({ value: 'a' })) + assert.deepStrictEqual(codec.decode('a'), D.success({ value: 'a' })) assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) @@ -73,7 +73,7 @@ describe('Codec', () => { C.number, C.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) ) - assert.deepStrictEqual(decoder.decode('a'), UD.failure('a', 'not a number')) + assert.deepStrictEqual(decoder.decode('a'), D.failure('a', 'not a number')) }) }) }) @@ -82,12 +82,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.string - assert.deepStrictEqual(codec.decode('a'), UD.success('a')) + assert.deepStrictEqual(codec.decode('a'), D.success('a')) }) it('should reject an invalid input', () => { const codec = C.string - assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'string')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'string')) }) }) }) @@ -96,12 +96,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.number - assert.deepStrictEqual(codec.decode(1), UD.success(1)) + assert.deepStrictEqual(codec.decode(1), D.success(1)) }) it('should reject an invalid input', () => { const codec = C.number - assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'number')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'number')) }) }) }) @@ -110,13 +110,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.boolean - assert.deepStrictEqual(codec.decode(true), UD.success(true)) - assert.deepStrictEqual(codec.decode(false), UD.success(false)) + assert.deepStrictEqual(codec.decode(true), D.success(true)) + assert.deepStrictEqual(codec.decode(false), D.success(false)) }) it('should reject an invalid input', () => { const codec = C.boolean - assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'boolean')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'boolean')) }) }) }) @@ -125,13 +125,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(codec.decode('a'), UD.success('a')) - assert.deepStrictEqual(codec.decode(null), UD.success(null)) + assert.deepStrictEqual(codec.decode('a'), D.success('a')) + assert.deepStrictEqual(codec.decode(null), D.success(null)) }) it('should reject an invalid input', () => { const codec = C.literal('a', null) - assert.deepStrictEqual(codec.decode('b'), UD.failure('b', '"a" | null')) + assert.deepStrictEqual(codec.decode('b'), D.failure('b', '"a" | null')) }) }) @@ -150,7 +150,7 @@ describe('Codec', () => { C.string, C.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(codec.decode('a'), UD.success('a')) + assert.deepStrictEqual(codec.decode('a'), D.success('a')) }) it('should reject an invalid input', () => { @@ -158,8 +158,8 @@ describe('Codec', () => { C.string, C.refine((s): s is string => s.length > 0, 'NonEmptyString') ) - assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'string')) - assert.deepStrictEqual(codec.decode(''), UD.failure('', 'NonEmptyString')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'string')) + assert.deepStrictEqual(codec.decode(''), D.failure('', 'NonEmptyString')) }) }) @@ -178,8 +178,8 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.nullable(NumberFromString) - assert.deepStrictEqual(codec.decode(null), UD.success(null)) - assert.deepStrictEqual(codec.decode('1'), UD.success(1)) + assert.deepStrictEqual(codec.decode(null), D.success(null)) + assert.deepStrictEqual(codec.decode('1'), D.success(1)) }) it('should reject an invalid input', () => { @@ -220,28 +220,28 @@ describe('Codec', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), UD.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) }) it('should strip additional fields', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), UD.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', () => { const codec = C.type({ a: undef }) - assert.deepStrictEqual(codec.decode({}), UD.success({ a: undefined })) + assert.deepStrictEqual(codec.decode({}), D.success({ a: undefined })) }) it('should reject an invalid input', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -274,7 +274,7 @@ describe('Codec', () => { } } const codec = C.type({ a: C.string, b: C.string }) - assert.deepStrictEqual(codec.decode(new A()), UD.success({ a: 'a', b: 'b' })) + assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) }) }) @@ -296,28 +296,28 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a' }), UD.success({ a: 'a' })) - assert.deepStrictEqual(codec.decode({}), UD.success({})) + assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({}), D.success({})) }) it('should strip additional fields', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), UD.success({ a: 'a' })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) }) it('should not add missing fields', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({}), UD.success({})) + assert.deepStrictEqual(codec.decode({}), D.success({})) }) it('should not strip fields corresponding to undefined values', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode({ a: undefined }), UD.success({ a: undefined })) + assert.deepStrictEqual(codec.decode({ a: undefined }), D.success({ a: undefined })) }) it('should reject an invalid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -350,7 +350,7 @@ describe('Codec', () => { } } const codec = C.partial({ a: C.string, b: C.string }) - assert.deepStrictEqual(codec.decode(new A()), UD.success({ a: 'a', b: 'b' })) + assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) }) }) @@ -383,13 +383,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid value', () => { const codec = C.record(C.number) - assert.deepStrictEqual(codec.decode({}), UD.success({})) - assert.deepStrictEqual(codec.decode({ a: 1 }), UD.success({ a: 1 })) + assert.deepStrictEqual(codec.decode({}), D.success({})) + assert.deepStrictEqual(codec.decode({ a: 1 }), D.success({ a: 1 })) }) it('should reject an invalid value', () => { const codec = C.record(C.number) - assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'Record')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 'a' }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) @@ -422,13 +422,13 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.array(C.string) - assert.deepStrictEqual(codec.decode([]), UD.success([])) - assert.deepStrictEqual(codec.decode(['a']), UD.success(['a'])) + assert.deepStrictEqual(codec.decode([]), D.success([])) + assert.deepStrictEqual(codec.decode(['a']), D.success(['a'])) }) it('should reject an invalid input', () => { const codec = C.array(C.string) - assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'Array')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) assert.deepStrictEqual(codec.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) }) @@ -458,16 +458,16 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(['a', 1]), UD.success(['a', 1])) + assert.deepStrictEqual(codec.decode(['a', 1]), D.success(['a', 1])) }) it('should handle zero components', () => { - assert.deepStrictEqual(C.tuple().decode([]), UD.success([])) + assert.deepStrictEqual(C.tuple().decode([]), D.success([])) }) it('should reject an invalid input', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(undefined), UD.failure(undefined, 'Array')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) assert.deepStrictEqual( codec.decode(['a']), E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -493,7 +493,7 @@ describe('Codec', () => { it('should strip additional components', () => { const codec = C.tuple(C.string, C.number) - assert.deepStrictEqual(codec.decode(['a', 1, true]), UD.success(['a', 1])) + assert.deepStrictEqual(codec.decode(['a', 1, true]), D.success(['a', 1])) }) }) @@ -509,12 +509,12 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = pipe(C.type({ a: C.string }), C.intersect(C.type({ b: C.number }))) - assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), UD.success({ a: 'a', b: 1 })) + assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a', b: 1 })) }) it('should handle primitives', () => { const codec = pipe(Int, C.intersect(Positive)) - assert.deepStrictEqual(codec.decode(1), UD.success(1)) + assert.deepStrictEqual(codec.decode(1), D.success(1)) }) }) @@ -539,15 +539,15 @@ describe('Codec', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), UD.success({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), UD.success({ _tag: 'B', b: 1 })) + assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), D.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), D.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), UD.failure(null, 'object')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'object')) assert.deepStrictEqual( codec.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) @@ -594,8 +594,8 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { - assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), UD.success({ a: 1 })) - assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), UD.success({ a: 1, b: { a: 2 } })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), D.success({ a: 1 })) + assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), D.success({ a: 1, b: { a: 2 } })) }) it('should reject an invalid input', () => { diff --git a/test/Decoder.ts b/test/Decoder.ts index 8ca07eacf..154f5ff7a 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -1,13 +1,593 @@ import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from '../src/DecodeError' +import * as FS from '../src/FreeSemigroup' +import * as G from '../src/Guard' import * as _ from '../src/Decoder' +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: _.Decoder = _.fromGuard(undefinedGuard, 'undefined') + +const NumberFromString: _.Decoder = pipe( + _.string, + _.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) + }) +) + +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: _.Decoder = pipe( + _.number, + _.refine((n): n is Positive => n > 0, 'Positive') +) + interface IntBrand { readonly Int: unique symbol } - type Int = number & IntBrand +const Int: _.Decoder = pipe( + _.number, + _.refine((n): n is Int => Number.isInteger(n), 'Int') +) describe('Decoder', () => { + // ------------------------------------------------------------------------------------- + // instances + // ------------------------------------------------------------------------------------- + + it('Functor', () => { + const decoder = _.Functor.map(_.string, (s) => s + '!') + assert.deepStrictEqual(decoder.decode('a'), _.success('a!')) + }) + + it('Alt', () => { + const decoder = _.Alt.alt(_.string, () => _.number) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + }) + + it('Category', () => { + const decoder = _.Category.compose(_.id(), _.string) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(1), _.failure(1, 'string')) + }) + + // ------------------------------------------------------------------------------------- + // primitives + // ------------------------------------------------------------------------------------- + + it('string', async () => { + assert.deepStrictEqual(_.string.decode('a'), _.success('a')) + assert.deepStrictEqual(_.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) + }) + + describe('number', () => { + it('number', async () => { + assert.deepStrictEqual(_.number.decode(1), _.success(1)) + assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) + }) + + it('should exclude NaN', () => { + assert.deepStrictEqual(_.number.decode(NaN), E.left(FS.of(DE.leaf(NaN, 'number')))) + }) + }) + + it('boolean', async () => { + assert.deepStrictEqual(_.boolean.decode(true), _.success(true)) + assert.deepStrictEqual(_.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) + }) + + it('UnknownArray', async () => { + assert.deepStrictEqual(_.UnknownArray.decode([1, 'a']), _.success([1, 'a'])) + assert.deepStrictEqual(_.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) + }) + + it('UnknownRecord', async () => { + assert.deepStrictEqual(_.UnknownRecord.decode({ a: 1, b: 'b' }), _.success({ a: 1, b: 'b' })) + assert.deepStrictEqual(_.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + }) + + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- + + describe('literal', () => { + it('should decode a valid input', async () => { + const decoder = _.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(null), _.success(null)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.literal('a', null) + assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) + }) + }) + + // ------------------------------------------------------------------------------------- + // combinators + // ------------------------------------------------------------------------------------- + + it('mapLeftWithInput', () => { + const decoder = pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + ) + assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) + }) + + it('compose', () => { + interface IntBrand { + readonly Int: unique symbol + } + + type Int = number & IntBrand + + const decoder = pipe(_.number, _.compose(_.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + assert.deepStrictEqual(decoder.decode('a'), _.failure('a', 'number')) + assert.deepStrictEqual(decoder.decode(1.2), _.failure(1.2, 'IntFromNumber')) + }) + + describe('nullable', () => { + it('should decode a valid input', () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual(decoder.decode(null), _.success(null)) + assert.deepStrictEqual(decoder.decode('1'), _.success(1)) + }) + + it('should reject an invalid input', () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual( + decoder.decode(undefined), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) + ) + assert.deepStrictEqual( + decoder.decode('a'), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) + ) + }) + }) + + describe('type', () => { + it('should decode a valid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) + }) + + it('should strip additional fields', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.type({ + a: undef + }) + assert.deepStrictEqual(decoder.decode({}), _.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual( + decoder.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.type({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.type({ a: _.string, b: _.string }) + assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) + }) + }) + + describe('partial', () => { + it('should decode a valid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) + assert.deepStrictEqual(decoder.decode({}), _.success({})) + }) + + it('should strip additional fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) + }) + + it('should not add missing fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({}), _.success({})) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode({ a: undefined }), _.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual( + decoder.decode({ a: 1 }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.partial({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + decoder.decode({ a: 1, b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.partial({ a: _.string, b: _.string }) + assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) + }) + }) + + describe('array', () => { + it('should decode a valid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(decoder.decode([]), _.success([])) + assert.deepStrictEqual(decoder.decode(['a']), _.success(['a'])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) + }) + + it('should collect all errors', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) + ) + }) + }) + + describe('record', () => { + it('should decode a valid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(decoder.decode({}), _.success({})) + assert.deepStrictEqual(decoder.decode({ a: 1 }), _.success({ a: 1 })) + }) + + it('should reject an invalid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual( + decoder.decode({ a: 'a' }), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual( + decoder.decode({ a: 'a', b: 'b' }), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + }) + + describe('tuple', () => { + it('should decode a valid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(['a', 1]), _.success(['a', 1])) + }) + + it('should handle zero components', async () => { + assert.deepStrictEqual(_.tuple().decode([]), _.success([])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) + assert.deepStrictEqual( + decoder.decode(['a']), + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + decoder.decode([1, 2]), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual( + decoder.decode([1, 'a']), + E.left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) + ) + }) + + it('should strip additional components', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(decoder.decode(['a', 1, true]), _.success(['a', 1])) + }) + }) + + describe('union', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(_.union(_.string).decode('a'), _.success('a')) + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + }) + + it('should reject an invalid input', () => { + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual( + decoder.decode(true), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), + FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) + ) + ) + ) + }) + }) + + describe('refine', () => { + it('should decode a valid input', () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(decoder.decode('a'), _.success('a')) + }) + + it('should reject an invalid input', () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) + assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) + }) + }) + + describe('intersect', () => { + it('should decode a valid input', () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a', b: 1 })) + }) + + it('should handle primitives', () => { + const decoder = pipe(Int, _.intersect(Positive)) + assert.deepStrictEqual(decoder.decode(1), _.success(1)) + }) + + it('should accumulate all errors', () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual( + decoder.decode({ a: 'a' }), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + decoder.decode({ b: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) + ) + assert.deepStrictEqual( + decoder.decode({}), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + }) + + describe('sum', () => { + const sum = _.sum('_tag') + + it('should decode a valid input', () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), _.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), _.success({ _tag: 'B', b: 1 })) + }) + + it('should reject an invalid input', () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) + assert.deepStrictEqual( + decoder.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + ) + assert.deepStrictEqual( + decoder.decode({ _tag: 'A', a: 1 }), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should support empty records', () => { + const decoder = sum({}) + assert.deepStrictEqual( + decoder.decode({}), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + ) + }) + }) + + interface A { + a: number + b?: A + } + + const lazyDecoder: _.Decoder = _.lazy('A', () => + pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) + ) + + describe('lazy', () => { + it('should decode a valid input', () => { + assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), _.success({ a: 1 })) + assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), _.success({ a: 1, b: { a: 2 } })) + }) + + it('should reject an invalid input', () => { + assert.deepStrictEqual( + lazyDecoder.decode({ a: 1 }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: 'a' }), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + ) + assert.deepStrictEqual( + lazyDecoder.decode({ a: '1', b: {} }), + E.left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) + ) + }) + }) + + // ------------------------------------------------------------------------------------- + // utils + // ------------------------------------------------------------------------------------- + + describe('draw', () => { + it('draw', () => { + const decoder = _.type({ + a: _.string, + b: _.number, + c: _.array(_.boolean), + d: _.nullable(_.string) + }) + assert.deepStrictEqual( + pipe(decoder.decode({ c: [1] }), E.mapLeft(_.draw)), + E.left(`required property "a" +└─ cannot decode undefined, should be string +required property "b" +└─ cannot decode undefined, should be number +required property "c" +└─ optional index 0 + └─ cannot decode 1, should be boolean +required property "d" +├─ member 0 +│ └─ cannot decode undefined, should be null +└─ member 1 + └─ cannot decode undefined, should be string`) + ) + }) + + it('should support lazy combinators', () => { + assert.deepStrictEqual( + pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(_.draw)), + E.left(`lazy type A +└─ optional property \"b\" + └─ lazy type A + └─ required property \"a\" + └─ cannot decode undefined, should be string`) + ) + }) + }) + + it('stringify', () => { + assert.deepStrictEqual(_.stringify(_.string.decode('a')), '"a"') + assert.deepStrictEqual(_.stringify(_.string.decode(null)), 'cannot decode null, should be string') + }) + it('fromRefinement', () => { const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') assert.deepStrictEqual(IntFromNumber.decode(1), _.success(1)) diff --git a/test/Type.ts b/test/Type.ts index 4edc326c5..d8087526a 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -1,9 +1,9 @@ import * as assert from 'assert' import * as fc from 'fast-check' import { isRight, isLeft } from 'fp-ts/lib/Either' -import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' +import { Kind, URIS, HKT, URIS2, Kind2 } from 'fp-ts/lib/HKT' import * as t from '../src' -import * as UD from '../src/UnknownDecoder' +import * as D from '../src/Decoder' import * as G from '../src/Guard' import { memoize, @@ -12,7 +12,10 @@ import { Schemable1, WithUnion1, WithUnknownContainers, - WithUnknownContainers1 + WithUnknownContainers1, + Schemable2C, + WithUnknownContainers2C, + WithUnion2C } from '../src/Schemable' import * as _ from '../src/Type' import * as A from './Arbitrary' @@ -26,15 +29,16 @@ function make(f: Schema): Schema { return memoize(f) } -function interpreter( - S: Schemable1 & WithUnknownContainers1 & WithUnion1 -): (schema: Schema) => Kind { - return (schema: any) => schema(S) -} +const interpreter: { + (S: Schemable2C & WithUnknownContainers2C & WithUnion2C): ( + schema: Schema + ) => Kind2 + (S: Schemable1 & WithUnknownContainers1 & WithUnion1): (schema: Schema) => Kind +} = (S: any) => (schema: any) => schema(S) function check(schema: Schema, type: t.Type): void { const arb = interpreter(A.Schemable)(schema) - const decoder = interpreter(UD.Schemable)(schema) + const decoder = interpreter(D.Schemable)(schema) const guard = interpreter(G.Schemable)(schema) const itype = interpreter(_.Schemable)(schema) // decoder and type should be aligned From 8185618eba70aa3b1b96c0fc63ea9bdd9410b828 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 08:38:00 +0200 Subject: [PATCH 102/222] make UnknownTaskDecoder module useless --- CHANGELOG.md | 13 + docs/modules/Schema.ts.md | 11 +- docs/modules/TaskDecoder.ts.md | 303 +++++++++++++++-- dtslint/ts3.5/TaskDecoder.ts | 74 ++++- src/TaskDecoder.ts | 247 +++++++++++++- src/UnknownTaskDecoder.ts | 14 +- test/TaskDecoder.ts | 592 ++++++++++++++++++++++++++++++++- 7 files changed, 1187 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f797f83b..3fb4e6f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,19 @@ - add `draw` function (@gcanti) - `KleisliTaskDecoder` - rename to `TaskDecoder` (@gcanti) + - rename `fromKleisliDecoder` to `fromDecoder` (@gcanti) + - add `fromGuard` (@gcanti) + - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) + - rename `type` to `ktype` + - rename `partial` to `kpartial` + - rename `array` to `karray` + - rename `record` to `krecord` + - rename `tuple` to `ktuple` + - rename `sum` to `ksum` + - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) + - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) + - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) + - add `draw` function (@gcanti) - `JsonCodec` - rename `invariantJsonCodec` to `Invariant` (@gcanti) - rename `schemableJsonCodec` to `Schemable` (@gcanti) diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 2d7fd2a33..f01a96dc4 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -73,7 +73,16 @@ Added in v2.2.0 ```ts export declare const interpreter: { - ( + < + S extends + | 'io-ts/Codec' + | 'Either' + | 'io-ts/Decoder' + | 'io-ts/Encoder' + | 'io-ts/TaskDecoder' + | 'IOEither' + | 'TaskEither' + >( S: Schemable2C ): (schema: Schema) => Kind2 < diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 3854d2bcb..0d1b55ef9 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -21,6 +21,8 @@ Added in v2.2.7 - [Alt](#alt) - [alt](#alt) +- [Category](#category) + - [id](#id) - [DecodeError](#decodeerror) - [DecodeError (type alias)](#decodeerror-type-alias) - [error](#error) @@ -28,10 +30,17 @@ Added in v2.2.7 - [success](#success) - [Functor](#functor) - [map](#map) +- [Semigroupoid](#semigroupoid) + - [compose](#compose) - [combinators](#combinators) - [array](#array) - - [compose](#compose) - [intersect](#intersect) + - [karray](#karray) + - [kpartial](#kpartial) + - [krecord](#krecord) + - [ksum](#ksum) + - [ktuple](#ktuple) + - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -44,14 +53,29 @@ Added in v2.2.7 - [type](#type) - [union](#union) - [constructors](#constructors) - - [fromKleisliDecoder](#fromkleislidecoder) + - [fromDecoder](#fromdecoder) + - [fromGuard](#fromguard) - [fromRefinement](#fromrefinement) - [literal](#literal) +- [instances](#instances) + - [Alt](#alt-1) + - [Category](#category-1) + - [Functor](#functor-1) + - [Schemable](#schemable) + - [URI](#uri) + - [URI (type alias)](#uri-type-alias) - [model](#model) - [TaskDecoder (interface)](#taskdecoder-interface) +- [primitives](#primitives) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [boolean](#boolean) + - [number](#number) + - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) + - [draw](#draw) --- @@ -67,6 +91,18 @@ export declare const alt: (that: () => TaskDecoder) => (me: TaskDeco Added in v2.2.7 +# Category + +## id + +**Signature** + +```ts +export declare const id: () => TaskDecoder +``` + +Added in v2.2.8 + # DecodeError ## DecodeError (type alias) @@ -124,24 +160,26 @@ export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) = Added in v2.2.7 -# combinators +# Semigroupoid -## array +## compose **Signature** ```ts -export declare const array: (items: TaskDecoder) => TaskDecoder +export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 -## compose +# combinators + +## array **Signature** ```ts -export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder +export declare const array: (items: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -158,6 +196,79 @@ export declare const intersect: ( Added in v2.2.7 +## karray + +**Signature** + +```ts +export declare const karray: (items: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + +## kpartial + +**Signature** + +```ts +export declare const kpartial:

>>( + properties: P +) => TaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +> +``` + +Added in v2.2.7 + +## krecord + +**Signature** + +```ts +export declare const krecord: (codomain: TaskDecoder) => TaskDecoder, Record> +``` + +Added in v2.2.7 + +## ksum + +**Signature** + +```ts +export declare const ksum: ( + tag: T +) => >>( + members: MS +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> +``` + +Added in v2.2.7 + +## ktuple + +**Signature** + +```ts +export declare const ktuple: []>( + ...components: C +) => TaskDecoder<{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> }> +``` + +Added in v2.2.7 + +## ktype + +**Signature** + +```ts +export declare const ktype:

>>( + properties: P +) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +``` + +Added in v2.2.7 + ## lazy **Signature** @@ -207,25 +318,22 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial:

>>( - properties: P -) => TaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> -> +export declare const partial: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder> ``` -Added in v2.2.7 +Added in v2.2.5 ## record **Signature** ```ts -export declare const record: (codomain: TaskDecoder) => TaskDecoder, Record> +export declare const record: (codomain: TaskDecoder) => TaskDecoder> ``` -Added in v2.2.7 +Added in v2.2.8 ## refine @@ -247,36 +355,34 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => >>( - members: MS -) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> +) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## tuple **Signature** ```ts -export declare const tuple: []>( - ...components: C -) => TaskDecoder<{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> }> +export declare const tuple: ( + ...components: { [K in keyof A]: TaskDecoder } +) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## type **Signature** ```ts -export declare const type:

>>( - properties: P -) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +export declare const type: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## union @@ -292,12 +398,22 @@ Added in v2.2.7 # constructors -## fromKleisliDecoder +## fromDecoder + +**Signature** + +```ts +export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder +``` + +Added in v2.2.7 + +## fromGuard **Signature** ```ts -export declare const fromKleisliDecoder: (decoder: D.Decoder) => TaskDecoder +export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder ``` Added in v2.2.7 @@ -327,6 +443,71 @@ export declare const literal: ( Added in v2.2.7 +# instances + +## Alt + +**Signature** + +```ts +export declare const Alt: Alt2<'io-ts/TaskDecoder'> +``` + +Added in v2.2.8 + +## Category + +**Signature** + +```ts +export declare const Category: Category2<'io-ts/TaskDecoder'> +``` + +Added in v2.2.8 + +## Functor + +**Signature** + +```ts +export declare const Functor: Functor2<'io-ts/TaskDecoder'> +``` + +Added in v2.2.8 + +## Schemable + +**Signature** + +```ts +export declare const Schemable: S.Schemable2C<'io-ts/TaskDecoder', unknown> & + S.WithUnknownContainers2C<'io-ts/TaskDecoder', unknown> & + S.WithUnion2C<'io-ts/TaskDecoder', unknown> & + S.WithRefine2C<'io-ts/TaskDecoder', unknown> +``` + +Added in v2.2.8 + +## URI + +**Signature** + +```ts +export declare const URI: 'io-ts/TaskDecoder' +``` + +Added in v2.2.8 + +## URI (type alias) + +**Signature** + +```ts +export type URI = typeof URI +``` + +Added in v2.2.8 + # model ## TaskDecoder (interface) @@ -339,6 +520,58 @@ export interface TaskDecoder extends K.Kleisli Added in v2.2.7 +# primitives + +## UnknownArray + +**Signature** + +```ts +export declare const UnknownArray: TaskDecoder +``` + +Added in v2.2.8 + +## UnknownRecord + +**Signature** + +```ts +export declare const UnknownRecord: TaskDecoder> +``` + +Added in v2.2.8 + +## boolean + +**Signature** + +```ts +export declare const boolean: TaskDecoder +``` + +Added in v2.2.8 + +## number + +**Signature** + +```ts +export declare const number: TaskDecoder +``` + +Added in v2.2.8 + +## string + +**Signature** + +```ts +export declare const string: TaskDecoder +``` + +Added in v2.2.8 + # utils ## InputOf (type alias) @@ -360,3 +593,13 @@ export type TypeOf = K.TypeOf ``` Added in v2.2.7 + +## draw + +**Signature** + +```ts +export declare const draw: (e: FS.FreeSemigroup>) => string +``` + +Added in v2.2.8 diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts index acf7fefdc..fce6909a8 100644 --- a/dtslint/ts3.5/TaskDecoder.ts +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -1,46 +1,96 @@ +import { pipe } from 'fp-ts/lib/pipeable' +import * as DE from '../../src/DecodeError' import * as _ from '../../src/TaskDecoder' +import * as FS from '../../src/FreeSemigroup' -declare const string: _.TaskDecoder +declare const StringFromString: _.TaskDecoder declare const NumberFromString: _.TaskDecoder // -// type +// TypeOf +// + +// $ExpectType number +export type TypeOfNumberFromString = _.TypeOf + +// +// InputOf +// + +// $ExpectType string +export type InputOfNumberFromString = _.InputOf + +// +// ktype // // $ExpectType TaskDecoder<{ a: string; }, { a: number; }> -_.type({ +_.ktype({ a: NumberFromString }) // -// partial +// kpartial // // $ExpectType TaskDecoder<{ a: string; }, Partial<{ a: number; }>> -_.partial({ +_.kpartial({ a: NumberFromString }) // -// tuple +// ktuple // // $ExpectType TaskDecoder<[string], [number]> -_.tuple(NumberFromString) +_.ktuple(NumberFromString) // -// sum +// ksum // // $ExpectType TaskDecoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: NumberFromString }), - B: _.type({ _tag: _.literal('B'), b: NumberFromString }) +_.ksum('_tag')({ + A: _.ktype({ _tag: _.literal('A'), a: NumberFromString }), + B: _.ktype({ _tag: _.literal('B'), b: NumberFromString }) }) // // union // +// $ExpectType TaskDecoder +_.union(_.number, _.string) + // $ExpectType TaskDecoder -_.union(NumberFromString, string) +_.union(NumberFromString, StringFromString) + +// ------------------------------------------------------------------------------------- +// unknown input +// ------------------------------------------------------------------------------------- + +// $ExpectType TaskDecoder +const A = _.type({ + a: _.string, + b: _.type({ + c: _.number + }) +}) + +// $ExpectType TaskDecoder; }>> +_.partial({ + a: _.string, + b: _.partial({ + c: _.number + }) +}) + +// +// mapLeftWithInput +// + +// $ExpectType TaskDecoder +pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) +) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 9d4229d0a..2d39bf9ea 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -8,10 +8,12 @@ * * @since 2.2.7 */ -import { Alt2C } from 'fp-ts/lib/Alt' +import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import { Category2 } from 'fp-ts/lib/Category' import * as E from 'fp-ts/lib/Either' import { Refinement } from 'fp-ts/lib/function' +import { Functor2 } from 'fp-ts/lib/Functor' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Task' @@ -19,6 +21,7 @@ import * as TE from 'fp-ts/lib/TaskEither' import * as DE from './DecodeError' import * as D from './Decoder' import * as FS from './FreeSemigroup' +import * as G from './Guard' import * as K from './Kleisli' import * as S from './Schemable' @@ -104,7 +107,7 @@ export const failure = (actual: unknown, message: string): TE.TaskEit * @category constructors * @since 2.2.7 */ -export const fromKleisliDecoder = (decoder: D.Decoder): TaskDecoder => ({ +export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ decode: TE.fromEitherK(decoder.decode) }) @@ -113,7 +116,14 @@ export const fromKleisliDecoder = (decoder: D.Decoder): TaskDecoder< * @since 2.2.7 */ export const fromRefinement = (refinement: Refinement, expected: string): TaskDecoder => - fromKleisliDecoder(D.fromRefinement(refinement, expected)) + fromDecoder(D.fromRefinement(refinement, expected)) + +/** + * @category constructors + * @since 2.2.7 + */ +export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => + fromRefinement(guard.is, expected) /** * @category constructors @@ -125,6 +135,57 @@ export const literal: ]>( /*#__PURE__*/ K.literal(M)((u, values) => error(u, values.map((value) => JSON.stringify(value)).join(' | '))) +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +/** + * @category primitives + * @since 2.2.8 + */ +export const string: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.string) + +/** + * @category primitives + * @since 2.2.8 + */ +export const number: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.number) + +/** + * @category primitives + * @since 2.2.8 + */ +export const boolean: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.boolean) + +/** + * @category primitives + * @since 2.2.8 + */ +export const UnknownArray: TaskDecoder> = + /*#__PURE__*/ + fromDecoder(D.UnknownArray) + +/** + * @category primitives + * @since 2.2.8 + */ +export const UnknownRecord: TaskDecoder> = + /*#__PURE__*/ + fromDecoder(D.UnknownRecord) + +/** + * @internal + */ +export const object: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.object) + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -170,43 +231,81 @@ export const nullable: (or: TaskDecoder) => TaskDecoder>>( +export const ktype =

>>( properties: P ): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) +/** + * @category combinators + * @since 2.2.8 + */ +export const type = ( + properties: { [K in keyof A]: TaskDecoder } +): TaskDecoder => pipe(object as any, compose(ktype(properties))) + /** * @category combinators * @since 2.2.7 */ -export const partial =

>>( +export const kpartial =

>>( properties: P ): TaskDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) +/** + * @category combinators + * @since 2.2.5 + */ +export const partial = ( + properties: { [K in keyof A]: TaskDecoder } +): TaskDecoder> => pipe(object as any, compose(kpartial(properties))) + /** * @category combinators * @since 2.2.7 */ -export const array = (items: TaskDecoder): TaskDecoder, Array> => +export const karray = (items: TaskDecoder): TaskDecoder, Array> => K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) /** * @category combinators * @since 2.2.7 */ -export const record = (codomain: TaskDecoder): TaskDecoder, Record> => +export const array = (items: TaskDecoder): TaskDecoder> => + pipe(UnknownArray, compose(karray(items))) + +/** + * @category combinators + * @since 2.2.7 + */ +export const krecord = (codomain: TaskDecoder): TaskDecoder, Record> => K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +/** + * @category combinators + * @since 2.2.8 + */ +export const record = (codomain: TaskDecoder): TaskDecoder> => + pipe(UnknownRecord, compose(krecord(codomain))) + /** * @category combinators * @since 2.2.7 */ -export const tuple = >>( +export const ktuple = >>( ...components: C ): TaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) +/** + * @category combinators + * @since 2.2.8 + */ +export const tuple = >( + ...components: { [K in keyof A]: TaskDecoder } +): TaskDecoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any + /** * @category combinators * @since 2.2.7 @@ -231,7 +330,7 @@ export const intersect: ( * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => >>( +export const ksum = (tag: T) => >>( members: MS ): TaskDecoder, TypeOf> => K.sum(M)((tag, value, keys) => @@ -246,19 +345,29 @@ export const sum = (tag: T) => (id: string, f: () => TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +export const sum = (tag: T) => ( + members: { [K in keyof A]: TaskDecoder } +): TaskDecoder => pipe(object as any, compose(ksum(tag)(members))) /** * @category combinators * @since 2.2.7 */ -export const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder = +export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.compose(M) + K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) + +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const map_: Functor2['map'] = (fa, f) => pipe(fa, map(f)) + +const alt_: Alt2['alt'] = (me, that) => pipe(me, alt(that)) + +const compose_: Category2['compose'] = (ab, la) => pipe(la, compose(ab)) // ------------------------------------------------------------------------------------- // pipeables @@ -280,6 +389,101 @@ export const alt: (that: () => TaskDecoder) => (me: TaskDecoder(to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder = + /*#__PURE__*/ + K.compose(M) + +/** + * @category Category + * @since 2.2.8 + */ +export const id = (): TaskDecoder => ({ + decode: success +}) + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +/** + * @category instances + * @since 2.2.8 + */ +export const URI = 'io-ts/TaskDecoder' + +/** + * @category instances + * @since 2.2.8 + */ +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind2 { + readonly [URI]: TaskDecoder + } +} + +/** + * @category instances + * @since 2.2.8 + */ +export const Functor: Functor2 = { + URI, + map: map_ +} + +/** + * @category instances + * @since 2.2.8 + */ +export const Alt: Alt2 = { + URI, + map: map_, + alt: alt_ +} + +/** + * @category instances + * @since 2.2.8 + */ +export const Category: Category2 = { + URI, + compose: compose_, + id +} + +/** + * @category instances + * @since 2.2.8 + */ +export const Schemable: S.Schemable2C & + S.WithUnknownContainers2C & + S.WithUnion2C & + S.WithRefine2C = { + URI, + literal, + string, + number, + boolean, + nullable, + type, + partial, + record, + array, + tuple: tuple as S.Schemable2C['tuple'], + intersect, + sum, + lazy, + UnknownArray, + UnknownRecord, + union: union as S.WithUnion2C['union'], + refine: refine as S.WithRefine2C['refine'] +} + // ------------------------------------------------------------------------------------- // utils // ------------------------------------------------------------------------------------- @@ -293,3 +497,16 @@ export type TypeOf = K.TypeOf * @since 2.2.7 */ export type InputOf = K.InputOf + +/** + * @since 2.2.8 + */ +export const draw: (e: DecodeError) => string = D.draw + +/** + * @internal + */ +export const stringify: (e: TE.TaskEither) => T.Task = TE.fold( + (e) => T.of(draw(e)), + (a) => T.of(JSON.stringify(a, null, 2)) +) diff --git a/src/UnknownTaskDecoder.ts b/src/UnknownTaskDecoder.ts index a47031f5e..cf4095a92 100644 --- a/src/UnknownTaskDecoder.ts +++ b/src/UnknownTaskDecoder.ts @@ -64,7 +64,7 @@ export const failure: (actual: unknown, message: string) => TE.TaskEi * @category constructors * @since 2.2.7 */ -export const fromDecoder: (decoder: D.Decoder) => UnknownTaskDecoder = KTD.fromKleisliDecoder +export const fromDecoder: (decoder: D.Decoder) => UnknownTaskDecoder = KTD.fromDecoder /** * @category constructors @@ -172,7 +172,7 @@ export const nullable: (or: UnknownTaskDecoder) => UnknownTaskDecoder( properties: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder<{ [K in keyof A]: A[K] }> => pipe(object as any, compose(KTD.type(properties))) +): UnknownTaskDecoder<{ [K in keyof A]: A[K] }> => pipe(object as any, compose(KTD.ktype(properties))) /** * @category combinators @@ -180,21 +180,21 @@ export const type = ( */ export const partial = ( properties: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder> => pipe(object as any, compose(KTD.partial(properties))) +): UnknownTaskDecoder> => pipe(object as any, compose(KTD.kpartial(properties))) /** * @category combinators * @since 2.2.7 */ export const array = (items: UnknownTaskDecoder): UnknownTaskDecoder> => - pipe(UnknownArray, compose(KTD.array(items))) + pipe(UnknownArray, compose(KTD.karray(items))) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: UnknownTaskDecoder): UnknownTaskDecoder> => - pipe(UnknownRecord, compose(KTD.record(codomain))) + pipe(UnknownRecord, compose(KTD.krecord(codomain))) /** * @category combinators @@ -202,7 +202,7 @@ export const record = (codomain: UnknownTaskDecoder): UnknownTaskDecoder>( ...components: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder => pipe(UnknownArray as any, compose(KTD.tuple(...components))) as any +): UnknownTaskDecoder => pipe(UnknownArray as any, compose(KTD.ktuple(...components))) as any /** * @category combinators @@ -226,7 +226,7 @@ export const intersect: ( */ export const sum = (tag: T) => ( members: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder => pipe(object as any, compose(KTD.sum(tag)(members))) +): UnknownTaskDecoder => pipe(object as any, compose(KTD.ksum(tag)(members))) /** * @category combinators diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 770759670..9328e6305 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -1,17 +1,605 @@ import * as assert from 'assert' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as TE from 'fp-ts/lib/TaskEither' +import * as DE from '../src/DecodeError' +import * as FS from '../src/FreeSemigroup' +import * as G from '../src/Guard' import * as D from '../src/Decoder' import * as _ from '../src/TaskDecoder' +const undefinedGuard: G.Guard = { + is: (u): u is undefined => u === undefined +} +const undef: _.TaskDecoder = _.fromGuard(undefinedGuard, 'undefined') + +const NumberFromString: _.TaskDecoder = pipe( + _.string, + _.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) + }) +) + +interface PositiveBrand { + readonly Positive: unique symbol +} +type Positive = number & PositiveBrand +const Positive: _.TaskDecoder = pipe( + _.number, + _.refine((n): n is Positive => n > 0, 'Positive') +) + interface IntBrand { readonly Int: unique symbol } - type Int = number & IntBrand +const Int: _.TaskDecoder = pipe( + _.number, + _.refine((n): n is Int => Number.isInteger(n), 'Int') +) + +describe('UnknownTaskDecoder', () => { + // ------------------------------------------------------------------------------------- + // instances + // ------------------------------------------------------------------------------------- + + it('Functor', async () => { + const decoder = _.Functor.map(_.string, (s) => s + '!') + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a!')) + }) + + it('Alt', async () => { + const decoder = _.Alt.alt(_.string, () => _.number) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + }) + + it('Category', async () => { + const decoder = _.Category.compose(_.id(), _.string) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(1)(), D.failure(1, 'string')) + }) + + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- -describe('TaskDecoder', () => { it('fromRefinement', async () => { const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') assert.deepStrictEqual(await IntFromNumber.decode(1)(), D.success(1)) assert.deepStrictEqual(await IntFromNumber.decode(1.2)(), D.failure(1.2, 'IntFromNumber')) }) + + // ------------------------------------------------------------------------------------- + // primitives + // ------------------------------------------------------------------------------------- + + it('string', async () => { + assert.deepStrictEqual(await _.string.decode('a')(), D.success('a')) + assert.deepStrictEqual(await _.string.decode(null)(), D.failure(null, 'string')) + }) + + it('number', async () => { + assert.deepStrictEqual(await _.number.decode(1)(), D.success(1)) + assert.deepStrictEqual(await _.number.decode(null)(), D.failure(null, 'number')) + }) + + it('boolean', async () => { + assert.deepStrictEqual(await _.boolean.decode(true)(), D.success(true)) + assert.deepStrictEqual(await _.boolean.decode(null)(), D.failure(null, 'boolean')) + }) + + it('UnknownArray', async () => { + assert.deepStrictEqual(await _.UnknownArray.decode([1, 'a'])(), D.success([1, 'a'])) + assert.deepStrictEqual(await _.UnknownArray.decode(null)(), D.failure(null, 'Array')) + }) + + it('UnknownRecord', async () => { + assert.deepStrictEqual(await _.UnknownRecord.decode({ a: 1, b: 'b' })(), D.success({ a: 1, b: 'b' })) + assert.deepStrictEqual(await _.UnknownRecord.decode(null)(), D.failure(null, 'Record')) + }) + + // ------------------------------------------------------------------------------------- + // constructors + // ------------------------------------------------------------------------------------- + + it('fromGuard', async () => { + const decoder = _.fromGuard(G.string, 'string') + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'string')) + }) + + describe('literal', () => { + it('should decode a valid input', async () => { + const decoder = _.literal('a', null, 'b', 1, true) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(null)(), D.success(null)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.literal('a', null) + assert.deepStrictEqual(await decoder.decode('b')(), D.failure('b', '"a" | null')) + }) + }) + + // ------------------------------------------------------------------------------------- + // combinators + // ------------------------------------------------------------------------------------- + + it('mapLeftWithInput', async () => { + const decoder = pipe( + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + ) + assert.deepStrictEqual(await decoder.decode('a')(), D.failure('a', 'not a number')) + }) + + it('compose', async () => { + interface IntBrand { + readonly Int: unique symbol + } + + type Int = number & IntBrand + + const decoder = pipe(_.number, _.compose(_.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + assert.deepStrictEqual(await decoder.decode('a')(), D.failure('a', 'number')) + assert.deepStrictEqual(await decoder.decode(1.2)(), D.failure(1.2, 'IntFromNumber')) + }) + + describe('nullable', () => { + it('should decode a valid input', async () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual(await decoder.decode(null)(), D.success(null)) + assert.deepStrictEqual(await decoder.decode('1')(), D.success(1)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.nullable(NumberFromString) + assert.deepStrictEqual( + await decoder.decode(undefined)(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) + ) + ) + ) + assert.deepStrictEqual( + await decoder.decode('a')(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), + FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) + ) + ) + ) + }) + }) + + describe('type', () => { + it('should decode a valid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) + }) + + it('should strip additional fields', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a' })) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.type({ + a: undef + }) + assert.deepStrictEqual(await decoder.decode({})(), D.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.type({ + a: _.string + }) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual( + await decoder.decode({ a: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.type({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.type({ a: _.string, b: _.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), D.success({ a: 'a', b: 'b' })) + }) + }) + + describe('partial', () => { + it('should decode a valid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) + assert.deepStrictEqual(await decoder.decode({})(), D.success({})) + }) + + it('should strip additional fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a' })) + }) + + it('should not add missing fields', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({})(), D.success({})) + }) + + it('should not strip fields corresponding to undefined values', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode({ a: undefined })(), D.success({ a: undefined })) + }) + + it('should reject an invalid input', async () => { + const decoder = _.partial({ a: _.string }) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual( + await decoder.decode({ a: 1 })(), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.partial({ + a: _.string, + b: _.number + }) + assert.deepStrictEqual( + await decoder.decode({ a: 1, b: 'b' })(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + + it('should support getters', async () => { + class A { + get a() { + return 'a' + } + get b() { + return 'b' + } + } + const decoder = _.partial({ a: _.string, b: _.string }) + assert.deepStrictEqual(await decoder.decode(new A())(), D.success({ a: 'a', b: 'b' })) + }) + }) + + describe('array', () => { + it('should decode a valid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(await decoder.decode([])(), D.success([])) + assert.deepStrictEqual(await decoder.decode(['a'])(), D.success(['a'])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Array')) + assert.deepStrictEqual( + await decoder.decode([1])(), + E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.array(_.string) + assert.deepStrictEqual( + await decoder.decode([1, 2])(), + E.left( + FS.concat( + FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) + ) + ) + ) + }) + }) + + describe('record', () => { + it('should decode a valid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(await decoder.decode({})(), D.success({})) + assert.deepStrictEqual(await decoder.decode({ a: 1 })(), D.success({ a: 1 })) + }) + + it('should reject an invalid value', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) + assert.deepStrictEqual( + await decoder.decode({ a: 'a' })(), + E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.record(_.number) + assert.deepStrictEqual( + await decoder.decode({ a: 'a', b: 'b' })(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), + FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) + ) + ) + ) + }) + }) + + describe('tuple', () => { + it('should decode a valid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(['a', 1])(), D.success(['a', 1])) + }) + + it('should handle zero components', async () => { + assert.deepStrictEqual(await _.tuple().decode([])(), D.success([])) + }) + + it('should reject an invalid input', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Array')) + assert.deepStrictEqual( + await decoder.decode(['a'])(), + E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + await decoder.decode([1, 2])(), + E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should collect all errors', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual( + await decoder.decode([1, 'a'])(), + E.left( + FS.concat( + FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), + FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) + ) + ) + ) + }) + + it('should strip additional components', async () => { + const decoder = _.tuple(_.string, _.number) + assert.deepStrictEqual(await decoder.decode(['a', 1, true])(), D.success(['a', 1])) + }) + }) + + describe('union', () => { + it('should decode a valid input', async () => { + assert.deepStrictEqual(await _.union(_.string).decode('a')(), D.success('a')) + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + }) + + it('should reject an invalid input', async () => { + const decoder = _.union(_.string, _.number) + assert.deepStrictEqual( + await decoder.decode(true)(), + E.left( + FS.concat( + FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), + FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) + ) + ) + ) + }) + }) + + describe('refine', () => { + it('should decode a valid input', async () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) + }) + + it('should reject an invalid input', async () => { + const decoder = pipe( + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') + ) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'string')) + assert.deepStrictEqual(await decoder.decode('')(), D.failure('', 'NonEmptyString')) + }) + }) + + describe('intersect', () => { + it('should decode a valid input', async () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a', b: 1 })) + }) + + it('should handle primitives', async () => { + const decoder = pipe(Int, _.intersect(Positive)) + assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) + }) + + it('should accumulate all errors', async () => { + const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + assert.deepStrictEqual( + await decoder.decode({ a: 'a' })(), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) + ) + assert.deepStrictEqual( + await decoder.decode({ b: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) + ) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left( + FS.concat( + FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), + FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) + ) + ) + ) + }) + }) + + describe('sum', () => { + const sum = _.sum('_tag') + + it('should decode a valid input', async () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), D.success({ _tag: 'A', a: 'a' })) + assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), D.success({ _tag: 'B', b: 1 })) + }) + + it('should reject an invalid input', async () => { + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) + const decoder = sum({ A, B }) + assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'object')) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) + ) + assert.deepStrictEqual( + await decoder.decode({ _tag: 'A', a: 1 })(), + E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) + ) + }) + + it('should support empty records', async () => { + const decoder = sum({}) + assert.deepStrictEqual( + await decoder.decode({})(), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) + ) + }) + }) + + interface A { + a: number + b?: A + } + + const lazyDecoder: _.TaskDecoder = _.lazy('A', () => + pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) + ) + + describe('lazy', () => { + it('should decode a valid input', async () => { + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), D.success({ a: 1 })) + assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), D.success({ a: 1, b: { a: 2 } })) + }) + + it('should reject an invalid input', async () => { + assert.deepStrictEqual( + await lazyDecoder.decode({ a: 1 })(), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) + ) + assert.deepStrictEqual( + await lazyDecoder.decode({ a: 'a' })(), + E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) + ) + assert.deepStrictEqual( + await lazyDecoder.decode({ a: '1', b: {} })(), + E.left( + FS.of( + DE.lazy( + 'A', + FS.of( + DE.key( + 'b', + DE.optional, + FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) + ) + ) + ) + ) + ) + ) + }) + }) + + // ------------------------------------------------------------------------------------- + // utils + // ------------------------------------------------------------------------------------- + + describe('draw', () => { + it('draw', async () => { + const decoder = _.type({ + a: _.string, + b: _.number, + c: _.array(_.boolean), + d: _.nullable(_.string) + }) + assert.deepStrictEqual( + await pipe(decoder.decode({ c: [1] }), TE.mapLeft(_.draw))(), + E.left(`required property "a" +└─ cannot decode undefined, should be string +required property "b" +└─ cannot decode undefined, should be number +required property "c" +└─ optional index 0 + └─ cannot decode 1, should be boolean +required property "d" +├─ member 0 +│ └─ cannot decode undefined, should be null +└─ member 1 + └─ cannot decode undefined, should be string`) + ) + }) + + it('should support lazy combinators', async () => { + assert.deepStrictEqual( + await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(_.draw))(), + E.left(`lazy type A +└─ optional property \"b\" + └─ lazy type A + └─ required property \"a\" + └─ cannot decode undefined, should be string`) + ) + }) + }) + + it('stringify', async () => { + assert.deepStrictEqual(await _.stringify(_.string.decode('a'))(), '"a"') + assert.deepStrictEqual(await _.stringify(_.string.decode(null))(), 'cannot decode null, should be string') + }) }) From af5333e12f656207b66af73b2d9f0ce1b6c6235d Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 08:39:39 +0200 Subject: [PATCH 103/222] remove UnknnownDecoder module --- CHANGELOG.md | 7 +- docs/modules/Schema.ts.md | 1 - docs/modules/UnknownDecoder.ts.md | 458 -------------------- docs/modules/UnknownTaskDecoder.ts.md | 2 +- dtslint/ts3.5/UnknownDecoder.ts | 37 -- src/UnknownDecoder.ts | 386 ----------------- test/UnknownDecoder.ts | 585 -------------------------- 7 files changed, 2 insertions(+), 1474 deletions(-) delete mode 100644 docs/modules/UnknownDecoder.ts.md delete mode 100644 dtslint/ts3.5/UnknownDecoder.ts delete mode 100644 src/UnknownDecoder.ts delete mode 100644 test/UnknownDecoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb4e6f4f..43da0312b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,11 +19,6 @@ - **Experimental** - `Codec` - rename `invariantCodec` to `Invariant` (@gcanti) - - `Decoder` - - rename to `UnknownDecoder` (@gcanti) - - rename `functorDecoder` to `Functor` (@gcanti) - - rename `altDecoder` to `Alt` (@gcanti) - - rename `schemableDecoder` to `Schemable` (@gcanti) - `Encoder` - rename `contravariantEncoder` to `Contravariant` (@gcanti) - rename `categoryEncoder` to `Category` (@gcanti) @@ -32,7 +27,7 @@ - `Guard` - rename `schemableGuard` to `Schemable` (@gcanti) - `KleisliDecoder` - - rename to `Decoder` (@gcanti) + - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - rename `type` to `ktype` - rename `partial` to `kpartial` diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index f01a96dc4..48ea20871 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -92,7 +92,6 @@ export declare const interpreter: { | 'io-ts/JsonCodec' | 'io-ts/JsonEncoder' | 'io-ts/Type' - | 'io-ts/UnknownDecoder' | 'io-ts/UnknownTaskDecoder' | 'Ord' | 'Option' diff --git a/docs/modules/UnknownDecoder.ts.md b/docs/modules/UnknownDecoder.ts.md deleted file mode 100644 index 3fdb43ebb..000000000 --- a/docs/modules/UnknownDecoder.ts.md +++ /dev/null @@ -1,458 +0,0 @@ ---- -title: UnknownDecoder.ts -nav_order: 18 -parent: Modules ---- - -## UnknownDecoder overview - -**This module is experimental** - -Experimental features are published in order to get early feedback from the community, see these tracking -[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - -A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - -Added in v2.2.7 - ---- - -

Table of contents

- -- [Alt](#alt) - - [alt](#alt) -- [DecodeError](#decodeerror) - - [DecodeError (type alias)](#decodeerror-type-alias) - - [error](#error) - - [failure](#failure) - - [success](#success) -- [Functor](#functor) - - [map](#map) -- [combinators](#combinators) - - [array](#array) - - [compose](#compose) - - [intersect](#intersect) - - [lazy](#lazy) - - [mapLeftWithInput](#mapleftwithinput) - - [nullable](#nullable) - - [parse](#parse) - - [partial](#partial) - - [record](#record) - - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) - - [union](#union) -- [constructors](#constructors) - - [fromGuard](#fromguard) - - [literal](#literal) -- [instances](#instances) - - [Alt](#alt-1) - - [Functor](#functor-1) - - [Schemable](#schemable) - - [URI](#uri) - - [URI (type alias)](#uri-type-alias) -- [model](#model) - - [UnknownDecoder (interface)](#unknowndecoder-interface) -- [primitives](#primitives) - - [UnknownArray](#unknownarray) - - [UnknownRecord](#unknownrecord) - - [boolean](#boolean) - - [number](#number) - - [string](#string) -- [utils](#utils) - - [TypeOf (type alias)](#typeof-type-alias) - - [draw](#draw) - ---- - -# Alt - -## alt - -**Signature** - -```ts -export declare const alt: (that: () => UnknownDecoder) => (me: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -# DecodeError - -## DecodeError (type alias) - -**Signature** - -```ts -export type DecodeError = D.DecodeError -``` - -Added in v2.2.7 - -## error - -**Signature** - -```ts -export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> -``` - -Added in v2.2.7 - -## failure - -**Signature** - -```ts -export declare const failure: ( - actual: unknown, - message: string -) => E.Either>, A> -``` - -Added in v2.2.7 - -## success - -**Signature** - -```ts -export declare const success: (a: A) => E.Either>, A> -``` - -Added in v2.2.7 - -# Functor - -## map - -**Signature** - -```ts -export declare const map: (f: (a: A) => B) => (fa: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -# combinators - -## array - -**Signature** - -```ts -export declare const array: (items: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## compose - -**Signature** - -```ts -export declare const compose: (to: D.Decoder) => (from: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## intersect - -**Signature** - -```ts -export declare const intersect: (right: UnknownDecoder) => (left: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## lazy - -**Signature** - -```ts -export declare const lazy: (id: string, f: () => UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## mapLeftWithInput - -**Signature** - -```ts -export declare const mapLeftWithInput: ( - f: (input: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## nullable - -**Signature** - -```ts -export declare const nullable: (or: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## parse - -**Signature** - -```ts -export declare const parse: ( - parser: (a: A) => E.Either>, B> -) => (from: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## partial - -**Signature** - -```ts -export declare const partial: ( - properties: { [K in keyof A]: UnknownDecoder } -) => UnknownDecoder> -``` - -Added in v2.2.7 - -## record - -**Signature** - -```ts -export declare const record: (codomain: UnknownDecoder) => UnknownDecoder> -``` - -Added in v2.2.7 - -## refine - -**Signature** - -```ts -export declare const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: UnknownDecoder) => UnknownDecoder -``` - -Added in v2.2.7 - -## sum - -**Signature** - -```ts -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: UnknownDecoder }) => UnknownDecoder -``` - -Added in v2.2.7 - -## tuple - -**Signature** - -```ts -export declare const tuple: ( - ...components: { [K in keyof A]: UnknownDecoder } -) => UnknownDecoder -``` - -Added in v2.2.7 - -## type - -**Signature** - -```ts -export declare const type: ( - properties: { [K in keyof A]: UnknownDecoder } -) => UnknownDecoder<{ [K in keyof A]: A[K] }> -``` - -Added in v2.2.7 - -## union - -**Signature** - -```ts -export declare const union: ( - ...members: { [K in keyof A]: UnknownDecoder } -) => UnknownDecoder -``` - -Added in v2.2.7 - -# constructors - -## fromGuard - -**Signature** - -```ts -export declare const fromGuard: (guard: G.Guard, expected: string) => UnknownDecoder -``` - -Added in v2.2.7 - -## literal - -**Signature** - -```ts -export declare const literal: (...values: A) => UnknownDecoder -``` - -Added in v2.2.7 - -# instances - -## Alt - -**Signature** - -```ts -export declare const Alt: Alt1<'io-ts/UnknownDecoder'> -``` - -Added in v2.2.7 - -## Functor - -**Signature** - -```ts -export declare const Functor: Functor1<'io-ts/UnknownDecoder'> -``` - -Added in v2.2.7 - -## Schemable - -**Signature** - -```ts -export declare const Schemable: Schemable1<'io-ts/UnknownDecoder'> & - WithUnknownContainers1<'io-ts/UnknownDecoder'> & - WithUnion1<'io-ts/UnknownDecoder'> & - WithRefine1<'io-ts/UnknownDecoder'> -``` - -Added in v2.2.7 - -## URI - -**Signature** - -```ts -export declare const URI: 'io-ts/UnknownDecoder' -``` - -Added in v2.2.7 - -## URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.7 - -# model - -## UnknownDecoder (interface) - -**Signature** - -```ts -export interface UnknownDecoder extends D.Decoder {} -``` - -Added in v2.2.7 - -# primitives - -## UnknownArray - -**Signature** - -```ts -export declare const UnknownArray: UnknownDecoder -``` - -Added in v2.2.7 - -## UnknownRecord - -**Signature** - -```ts -export declare const UnknownRecord: UnknownDecoder> -``` - -Added in v2.2.7 - -## boolean - -**Signature** - -```ts -export declare const boolean: UnknownDecoder -``` - -Added in v2.2.7 - -## number - -**Signature** - -```ts -export declare const number: UnknownDecoder -``` - -Added in v2.2.7 - -## string - -**Signature** - -```ts -export declare const string: UnknownDecoder -``` - -Added in v2.2.7 - -# utils - -## TypeOf (type alias) - -**Signature** - -```ts -export type TypeOf = D.TypeOf -``` - -Added in v2.2.7 - -## draw - -**Signature** - -```ts -export declare const draw: (e: FS.FreeSemigroup>) => string -``` - -Added in v2.2.7 diff --git a/docs/modules/UnknownTaskDecoder.ts.md b/docs/modules/UnknownTaskDecoder.ts.md index a460ecb97..fa9b1883b 100644 --- a/docs/modules/UnknownTaskDecoder.ts.md +++ b/docs/modules/UnknownTaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: UnknownTaskDecoder.ts -nav_order: 19 +nav_order: 18 parent: Modules --- diff --git a/dtslint/ts3.5/UnknownDecoder.ts b/dtslint/ts3.5/UnknownDecoder.ts deleted file mode 100644 index 300d6eead..000000000 --- a/dtslint/ts3.5/UnknownDecoder.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as _ from '../../src/UnknownDecoder' -import * as DE from '../../src/DecodeError' -import * as FS from '../../src/FreeSemigroup' -import { pipe } from 'fp-ts/lib/pipeable' - -// $ExpectType UnknownDecoder<{ a: string; b: { c: number; }; }> -const A = _.type({ - a: _.string, - b: _.type({ - c: _.number - }) -}) - -// $ExpectType UnknownDecoder; }>> -_.partial({ - a: _.string, - b: _.partial({ - c: _.number - }) -}) - -// -// TypeOf -// - -// $ExpectType { a: string; b: { c: number; }; } -export type A = _.TypeOf - -// -// mapLeftWithInput -// - -// $ExpectType UnknownDecoder -pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) -) diff --git a/src/UnknownDecoder.ts b/src/UnknownDecoder.ts deleted file mode 100644 index 83df59c03..000000000 --- a/src/UnknownDecoder.ts +++ /dev/null @@ -1,386 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt1 } from 'fp-ts/lib/Alt' -import * as E from 'fp-ts/lib/Either' -import { Functor1 } from 'fp-ts/lib/Functor' -import { pipe } from 'fp-ts/lib/pipeable' -import * as DE from './DecodeError' -import * as FS from './FreeSemigroup' -import * as G from './Guard' -import * as D from './Decoder' -import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @category model - * @since 2.2.7 - */ -export interface UnknownDecoder extends D.Decoder {} - -// ------------------------------------------------------------------------------------- -// DecodeError -// ------------------------------------------------------------------------------------- - -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = D.DecodeError - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const error: (actual: unknown, message: string) => DecodeError = D.error - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const success: (a: A) => E.Either = D.success - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const failure: (actual: unknown, message: string) => E.Either = D.failure - -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromGuard = (guard: G.Guard, expected: string): UnknownDecoder => - D.fromRefinement(guard.is, expected) - -/** - * @category constructors - * @since 2.2.7 - */ -export const literal: ]>(...values: A) => UnknownDecoder = - D.literal - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.7 - */ -export const string: UnknownDecoder = - /*#__PURE__*/ - fromGuard(G.string, 'string') - -/** - * @category primitives - * @since 2.2.7 - */ -export const number: UnknownDecoder = - /*#__PURE__*/ - fromGuard(G.number, 'number') - -/** - * @category primitives - * @since 2.2.7 - */ -export const boolean: UnknownDecoder = - /*#__PURE__*/ - fromGuard(G.boolean, 'boolean') - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownArray: UnknownDecoder> = - /*#__PURE__*/ - fromGuard(G.UnknownArray, 'Array') - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownRecord: UnknownDecoder> = - /*#__PURE__*/ - fromGuard(G.UnknownRecord, 'Record') - -/** - * @internal - */ -export const object: UnknownDecoder = - /*#__PURE__*/ - fromGuard(G.object, 'object') - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.7 - */ -export const mapLeftWithInput: ( - f: (input: unknown, e: DecodeError) => DecodeError -) => (decoder: UnknownDecoder) => UnknownDecoder = D.mapLeftWithInput - -/** - * @category combinators - * @since 2.2.7 - */ -export const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: UnknownDecoder) => UnknownDecoder = D.refine - -/** - * @category combinators - * @since 2.2.7 - */ -export const parse: ( - parser: (a: A) => E.Either -) => (from: UnknownDecoder) => UnknownDecoder = D.parse - -/** - * @category combinators - * @since 2.2.7 - */ -export const nullable: (or: UnknownDecoder) => UnknownDecoder = D.nullable - -/** - * @category combinators - * @since 2.2.7 - */ -export const type = ( - properties: { [K in keyof A]: UnknownDecoder } -): UnknownDecoder<{ [K in keyof A]: A[K] }> => pipe(object as any, compose(D.type(properties))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const partial = ( - properties: { [K in keyof A]: UnknownDecoder } -): UnknownDecoder> => pipe(object as any, compose(D.partial(properties))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const array = (items: UnknownDecoder): UnknownDecoder> => - pipe(UnknownArray, compose(D.array(items))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const record = (codomain: UnknownDecoder): UnknownDecoder> => - pipe(UnknownRecord, compose(D.record(codomain))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const tuple = >( - ...components: { [K in keyof A]: UnknownDecoder } -): UnknownDecoder => pipe(UnknownArray as any, compose(D.tuple(...components))) as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const union: ]>( - ...members: { [K in keyof A]: UnknownDecoder } -) => UnknownDecoder = D.union as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const intersect: (right: UnknownDecoder) => (left: UnknownDecoder) => UnknownDecoder = - D.intersect - -/** - * @category combinators - * @since 2.2.7 - */ -export const sum = (tag: T) => ( - members: { [K in keyof A]: UnknownDecoder } -): UnknownDecoder => pipe(object as any, compose(D.sum(tag)(members))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const lazy: (id: string, f: () => UnknownDecoder) => UnknownDecoder = D.lazy - -/** - * @category combinators - * @since 2.2.7 - */ -export const compose: (to: D.Decoder) => (from: UnknownDecoder) => UnknownDecoder = D.compose - -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- - -const map_: (fa: UnknownDecoder, f: (a: A) => B) => UnknownDecoder = (fa, f) => pipe(fa, map(f)) - -const alt_: (me: UnknownDecoder, that: () => UnknownDecoder) => UnknownDecoder = (me, that) => - pipe(me, alt(that)) - -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- - -/** - * @category Functor - * @since 2.2.7 - */ -export const map: (f: (a: A) => B) => (fa: UnknownDecoder) => UnknownDecoder = D.map - -/** - * @category Alt - * @since 2.2.7 - */ -export const alt: (that: () => UnknownDecoder) => (me: UnknownDecoder) => UnknownDecoder = D.alt - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @category instances - * @since 2.2.7 - */ -export const URI = 'io-ts/UnknownDecoder' - -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: UnknownDecoder - } -} - -/** - * @category instances - * @since 2.2.7 - */ -export const Functor: Functor1 = { - URI, - map: map_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const Alt: Alt1 = { - URI, - map: map_, - alt: alt_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { - URI, - literal, - string, - number, - boolean, - nullable, - type, - partial, - record, - array, - tuple: tuple as Schemable1['tuple'], - intersect, - sum, - lazy, - UnknownArray, - UnknownRecord, - union: union as WithUnion1['union'], - refine: refine as WithRefine1['refine'] -} - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.7 - */ -export type TypeOf = D.TypeOf - -interface Tree { - readonly value: A - readonly forest: ReadonlyArray> -} - -const empty: Array = [] - -const make = (value: A, forest: ReadonlyArray> = empty): Tree => ({ - value, - forest -}) - -const drawTree = (tree: Tree): string => tree.value + drawForest('\n', tree.forest) - -const drawForest = (indentation: string, forest: ReadonlyArray>): string => { - let r: string = '' - const len = forest.length - let tree: Tree - for (let i = 0; i < len; i++) { - tree = forest[i] - const isLast = i === len - 1 - r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value - r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest) - } - return r -} - -const toTree: (e: DE.DecodeError) => Tree = DE.fold({ - Leaf: (input, error) => make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => make(`member ${index}`, toForest(errors)), - Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) -}) - -const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( - (value) => [toTree(value)], - (left, right) => toForest(left).concat(toForest(right)) -) - -/** - * @since 2.2.7 - */ -export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') - -/** - * @internal - */ -export const stringify: (e: E.Either) => string = - /*#__PURE__*/ - E.fold(draw, (a) => JSON.stringify(a, null, 2)) diff --git a/test/UnknownDecoder.ts b/test/UnknownDecoder.ts deleted file mode 100644 index 641c22330..000000000 --- a/test/UnknownDecoder.ts +++ /dev/null @@ -1,585 +0,0 @@ -import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import * as DE from '../src/DecodeError' -import * as _ from '../src/UnknownDecoder' -import * as FS from '../src/FreeSemigroup' -import * as G from '../src/Guard' -import * as D from '../src/Decoder' - -const undefinedGuard: G.Guard = { - is: (u): u is undefined => u === undefined -} -const undef: _.UnknownDecoder = _.fromGuard(undefinedGuard, 'undefined') - -const NumberFromString: _.UnknownDecoder = pipe( - _.string, - _.parse((s) => { - const n = parseFloat(s) - return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) - }) -) - -interface PositiveBrand { - readonly Positive: unique symbol -} -type Positive = number & PositiveBrand -const Positive: _.UnknownDecoder = pipe( - _.number, - _.refine((n): n is Positive => n > 0, 'Positive') -) - -interface IntBrand { - readonly Int: unique symbol -} -type Int = number & IntBrand -const Int: _.UnknownDecoder = pipe( - _.number, - _.refine((n): n is Int => Number.isInteger(n), 'Int') -) - -describe('UnknownDecoder', () => { - // ------------------------------------------------------------------------------------- - // instances - // ------------------------------------------------------------------------------------- - - it('Functor', () => { - const decoder = _.Functor.map(_.string, (s) => s + '!') - assert.deepStrictEqual(decoder.decode('a'), _.success('a!')) - }) - - it('Alt', () => { - const decoder = _.Alt.alt(_.string, () => _.number) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - }) - - // ------------------------------------------------------------------------------------- - // primitives - // ------------------------------------------------------------------------------------- - - it('string', async () => { - assert.deepStrictEqual(_.string.decode('a'), _.success('a')) - assert.deepStrictEqual(_.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) - }) - - describe('number', () => { - it('number', async () => { - assert.deepStrictEqual(_.number.decode(1), _.success(1)) - assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) - }) - - it('should exclude NaN', () => { - assert.deepStrictEqual(_.number.decode(NaN), E.left(FS.of(DE.leaf(NaN, 'number')))) - }) - }) - - it('boolean', async () => { - assert.deepStrictEqual(_.boolean.decode(true), _.success(true)) - assert.deepStrictEqual(_.boolean.decode(null), E.left(FS.of(DE.leaf(null, 'boolean')))) - }) - - it('UnknownArray', async () => { - assert.deepStrictEqual(_.UnknownArray.decode([1, 'a']), _.success([1, 'a'])) - assert.deepStrictEqual(_.UnknownArray.decode(null), E.left(FS.of(DE.leaf(null, 'Array')))) - }) - - it('UnknownRecord', async () => { - assert.deepStrictEqual(_.UnknownRecord.decode({ a: 1, b: 'b' }), _.success({ a: 1, b: 'b' })) - assert.deepStrictEqual(_.UnknownRecord.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) - }) - - // ------------------------------------------------------------------------------------- - // constructors - // ------------------------------------------------------------------------------------- - - describe('literal', () => { - it('should decode a valid input', async () => { - const decoder = _.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - assert.deepStrictEqual(decoder.decode(null), _.success(null)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.literal('a', null) - assert.deepStrictEqual(decoder.decode('b'), E.left(FS.of(DE.leaf('b', '"a" | null')))) - }) - }) - - // ------------------------------------------------------------------------------------- - // combinators - // ------------------------------------------------------------------------------------- - - it('mapLeftWithInput', () => { - const decoder = pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) - ) - assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) - }) - - it('compose', () => { - interface IntBrand { - readonly Int: unique symbol - } - - type Int = number & IntBrand - - const decoder = pipe(_.number, _.compose(D.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - assert.deepStrictEqual(decoder.decode('a'), _.failure('a', 'number')) - assert.deepStrictEqual(decoder.decode(1.2), _.failure(1.2, 'IntFromNumber')) - }) - - describe('nullable', () => { - it('should decode a valid input', () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual(decoder.decode(null), _.success(null)) - assert.deepStrictEqual(decoder.decode('1'), _.success(1)) - }) - - it('should reject an invalid input', () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual( - decoder.decode(undefined), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) - ) - ) - ) - assert.deepStrictEqual( - decoder.decode('a'), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) - ) - ) - ) - }) - }) - - describe('type', () => { - it('should decode a valid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) - }) - - it('should strip additional fields', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.type({ - a: undef - }) - assert.deepStrictEqual(decoder.decode({}), _.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) - assert.deepStrictEqual( - decoder.decode({ a: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.type({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - decoder.decode({}), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.type({ a: _.string, b: _.string }) - assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) - }) - }) - - describe('partial', () => { - it('should decode a valid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) - assert.deepStrictEqual(decoder.decode({}), _.success({})) - }) - - it('should strip additional fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) - }) - - it('should not add missing fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({}), _.success({})) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode({ a: undefined }), _.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) - assert.deepStrictEqual( - decoder.decode({ a: 1 }), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.partial({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - decoder.decode({ a: 1, b: 'b' }), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.partial({ a: _.string, b: _.string }) - assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) - }) - }) - - describe('array', () => { - it('should decode a valid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(decoder.decode([]), _.success([])) - assert.deepStrictEqual(decoder.decode(['a']), _.success(['a'])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual(decoder.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) - }) - - it('should collect all errors', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left( - FS.concat( - FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) - ) - ) - ) - }) - }) - - describe('record', () => { - it('should decode a valid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(decoder.decode({}), _.success({})) - assert.deepStrictEqual(decoder.decode({ a: 1 }), _.success({ a: 1 })) - }) - - it('should reject an invalid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) - assert.deepStrictEqual( - decoder.decode({ a: 'a' }), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual( - decoder.decode({ a: 'a', b: 'b' }), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - }) - - describe('tuple', () => { - it('should decode a valid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(decoder.decode(['a', 1]), _.success(['a', 1])) - }) - - it('should handle zero components', async () => { - assert.deepStrictEqual(_.tuple().decode([]), _.success([])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Array')))) - assert.deepStrictEqual( - decoder.decode(['a']), - E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - decoder.decode([1, 2]), - E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual( - decoder.decode([1, 'a']), - E.left( - FS.concat( - FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) - ) - ) - ) - }) - - it('should strip additional components', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(decoder.decode(['a', 1, true]), _.success(['a', 1])) - }) - }) - - describe('union', () => { - it('should decode a valid input', () => { - assert.deepStrictEqual(_.union(_.string).decode('a'), _.success('a')) - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - }) - - it('should reject an invalid input', () => { - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual( - decoder.decode(true), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), - FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) - ) - ) - ) - }) - }) - - describe('refine', () => { - it('should decode a valid input', () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(decoder.decode('a'), _.success('a')) - }) - - it('should reject an invalid input', () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'string')))) - assert.deepStrictEqual(decoder.decode(''), E.left(FS.of(DE.leaf('', 'NonEmptyString')))) - }) - }) - - describe('intersect', () => { - it('should decode a valid input', () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a', b: 1 })) - }) - - it('should handle primitives', () => { - const decoder = pipe(Int, _.intersect(Positive)) - assert.deepStrictEqual(decoder.decode(1), _.success(1)) - }) - - it('should accumulate all errors', () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual( - decoder.decode({ a: 'a' }), - E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - decoder.decode({ b: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) - ) - assert.deepStrictEqual( - decoder.decode({}), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - }) - - describe('sum', () => { - const sum = _.sum('_tag') - - it('should decode a valid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), _.success({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), _.success({ _tag: 'B', b: 1 })) - }) - - it('should reject an invalid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) - assert.deepStrictEqual( - decoder.decode({}), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) - ) - assert.deepStrictEqual( - decoder.decode({ _tag: 'A', a: 1 }), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should support empty records', () => { - const decoder = sum({}) - assert.deepStrictEqual( - decoder.decode({}), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) - ) - }) - }) - - interface A { - a: number - b?: A - } - - const lazyDecoder: _.UnknownDecoder = _.lazy('A', () => - pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) - ) - - describe('lazy', () => { - it('should decode a valid input', () => { - assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), _.success({ a: 1 })) - assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), _.success({ a: 1, b: { a: 2 } })) - }) - - it('should reject an invalid input', () => { - assert.deepStrictEqual( - lazyDecoder.decode({ a: 1 }), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) - ) - assert.deepStrictEqual( - lazyDecoder.decode({ a: 'a' }), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) - ) - assert.deepStrictEqual( - lazyDecoder.decode({ a: '1', b: {} }), - E.left( - FS.of( - DE.lazy( - 'A', - FS.of( - DE.key( - 'b', - DE.optional, - FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) - ) - ) - ) - ) - ) - ) - }) - }) - - // ------------------------------------------------------------------------------------- - // utils - // ------------------------------------------------------------------------------------- - - describe('draw', () => { - it('draw', () => { - const decoder = _.type({ - a: _.string, - b: _.number, - c: _.array(_.boolean), - d: _.nullable(_.string) - }) - assert.deepStrictEqual( - pipe(decoder.decode({ c: [1] }), E.mapLeft(_.draw)), - E.left(`required property "a" -└─ cannot decode undefined, should be string -required property "b" -└─ cannot decode undefined, should be number -required property "c" -└─ optional index 0 - └─ cannot decode 1, should be boolean -required property "d" -├─ member 0 -│ └─ cannot decode undefined, should be null -└─ member 1 - └─ cannot decode undefined, should be string`) - ) - }) - - it('should support lazy combinators', () => { - assert.deepStrictEqual( - pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(_.draw)), - E.left(`lazy type A -└─ optional property \"b\" - └─ lazy type A - └─ required property \"a\" - └─ cannot decode undefined, should be string`) - ) - }) - }) - - it('stringify', () => { - assert.deepStrictEqual(_.stringify(_.string.decode('a')), '"a"') - assert.deepStrictEqual(_.stringify(_.string.decode(null)), 'cannot decode null, should be string') - }) -}) From e4541ace2d407763fb775e353d5ae518ed963ef4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 08:41:39 +0200 Subject: [PATCH 104/222] remove UnknownTaskDecoder module --- CHANGELOG.md | 7 +- docs/modules/Schema.ts.md | 1 - docs/modules/UnknownTaskDecoder.ts.md | 475 --------------------- dtslint/ts3.5/UnknownTaskDecoder.ts | 37 -- src/UnknownTaskDecoder.ts | 356 ---------------- test/UnknownTaskDecoder.ts | 590 -------------------------- 6 files changed, 1 insertion(+), 1465 deletions(-) delete mode 100644 docs/modules/UnknownTaskDecoder.ts.md delete mode 100644 dtslint/ts3.5/UnknownTaskDecoder.ts delete mode 100644 src/UnknownTaskDecoder.ts delete mode 100644 test/UnknownTaskDecoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 43da0312b..9cbd4437b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - add `draw` function (@gcanti) - `KleisliTaskDecoder` - - rename to `TaskDecoder` (@gcanti) + - remove old `TaskDecoder.ts` module and rename `KleisliTaskDecoder` to `TaskDecoder` (@gcanti) - rename `fromKleisliDecoder` to `fromDecoder` (@gcanti) - add `fromGuard` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) @@ -61,11 +61,6 @@ - rename `schemableJsonEncoder` to `Schemable` (@gcanti) - `Schemable` - add `Schemable2C`, `WithUnknownContainers2C`, `WithUnion2C`, `WithRefine2C` (@gcanti) - - `TaskDecoder` - - rename to `UnknownTaskDecoder` (@gcanti) - - rename `functorTaskDecoder` to `Functor` (@gcanti) - - rename `altTaskDecoder` to `Alt` (@gcanti) - - rename `schemableTaskDecoder` to `Schemable` (@gcanti) - `Type` - rename `schemableType` to `Schemable` (@gcanti) diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 48ea20871..637fe19ba 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -92,7 +92,6 @@ export declare const interpreter: { | 'io-ts/JsonCodec' | 'io-ts/JsonEncoder' | 'io-ts/Type' - | 'io-ts/UnknownTaskDecoder' | 'Ord' | 'Option' | 'ReadonlyRecord' diff --git a/docs/modules/UnknownTaskDecoder.ts.md b/docs/modules/UnknownTaskDecoder.ts.md deleted file mode 100644 index fa9b1883b..000000000 --- a/docs/modules/UnknownTaskDecoder.ts.md +++ /dev/null @@ -1,475 +0,0 @@ ---- -title: UnknownTaskDecoder.ts -nav_order: 18 -parent: Modules ---- - -## UnknownTaskDecoder overview - -**This module is experimental** - -Experimental features are published in order to get early feedback from the community, see these tracking -[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - -A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - -Added in v2.2.7 - ---- - -

Table of contents

- -- [Alt](#alt) - - [alt](#alt) -- [DecodeError](#decodeerror) - - [DecodeError (type alias)](#decodeerror-type-alias) - - [error](#error) - - [failure](#failure) - - [success](#success) -- [Functor](#functor) - - [map](#map) -- [combinators](#combinators) - - [array](#array) - - [compose](#compose) - - [intersect](#intersect) - - [lazy](#lazy) - - [mapLeftWithInput](#mapleftwithinput) - - [nullable](#nullable) - - [parse](#parse) - - [partial](#partial) - - [record](#record) - - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) - - [union](#union) -- [constructors](#constructors) - - [fromDecoder](#fromdecoder) - - [fromGuard](#fromguard) - - [literal](#literal) -- [instances](#instances) - - [Alt](#alt-1) - - [Functor](#functor-1) - - [Schemable](#schemable) - - [URI](#uri) - - [URI (type alias)](#uri-type-alias) -- [model](#model) - - [UnknownTaskDecoder (interface)](#unknowntaskdecoder-interface) -- [primitives](#primitives) - - [UnknownArray](#unknownarray) - - [UnknownRecord](#unknownrecord) - - [boolean](#boolean) - - [number](#number) - - [string](#string) -- [utils](#utils) - - [TypeOf (type alias)](#typeof-type-alias) - - [draw](#draw) - ---- - -# Alt - -## alt - -**Signature** - -```ts -export declare const alt:
(that: () => UnknownTaskDecoder) => (me: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -# DecodeError - -## DecodeError (type alias) - -**Signature** - -```ts -export type DecodeError = D.DecodeError -``` - -Added in v2.2.7 - -## error - -**Signature** - -```ts -export declare const error: (actual: unknown, message: string) => FreeSemigroup> -``` - -Added in v2.2.7 - -## failure - -**Signature** - -```ts -export declare const failure: ( - actual: unknown, - message: string -) => TE.TaskEither>, A> -``` - -Added in v2.2.7 - -## success - -**Signature** - -```ts -export declare const success: (a: A) => TE.TaskEither>, A> -``` - -Added in v2.2.7 - -# Functor - -## map - -**Signature** - -```ts -export declare const map: (f: (a: A) => B) => (fa: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -# combinators - -## array - -**Signature** - -```ts -export declare const array: (items: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## compose - -**Signature** - -```ts -export declare const compose: ( - to: KTD.TaskDecoder -) => (from: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## intersect - -**Signature** - -```ts -export declare const intersect: ( - right: UnknownTaskDecoder -) => (left: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## lazy - -**Signature** - -```ts -export declare const lazy: (id: string, f: () => UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## mapLeftWithInput - -**Signature** - -```ts -export declare const mapLeftWithInput: ( - f: (input: unknown, e: FreeSemigroup>) => FreeSemigroup> -) => (decoder: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## nullable - -**Signature** - -```ts -export declare const nullable: (or: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## parse - -**Signature** - -```ts -export declare const parse: ( - parser: (a: A) => TE.TaskEither>, B> -) => (from: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## partial - -**Signature** - -```ts -export declare const partial: ( - properties: { [K in keyof A]: UnknownTaskDecoder } -) => UnknownTaskDecoder> -``` - -Added in v2.2.7 - -## record - -**Signature** - -```ts -export declare const record: (codomain: UnknownTaskDecoder) => UnknownTaskDecoder> -``` - -Added in v2.2.7 - -## refine - -**Signature** - -```ts -export declare const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: UnknownTaskDecoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## sum - -**Signature** - -```ts -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: UnknownTaskDecoder }) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## tuple - -**Signature** - -```ts -export declare const tuple: ( - ...components: { [K in keyof A]: UnknownTaskDecoder } -) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## type - -**Signature** - -```ts -export declare const type: ( - properties: { [K in keyof A]: UnknownTaskDecoder } -) => UnknownTaskDecoder<{ [K in keyof A]: A[K] }> -``` - -Added in v2.2.7 - -## union - -**Signature** - -```ts -export declare const union: ( - ...members: { [K in keyof A]: UnknownTaskDecoder } -) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -# constructors - -## fromDecoder - -**Signature** - -```ts -export declare const fromDecoder: (decoder: D.Decoder) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## fromGuard - -**Signature** - -```ts -export declare const fromGuard: (guard: G.Guard, expected: string) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -## literal - -**Signature** - -```ts -export declare const literal: ( - ...values: A -) => UnknownTaskDecoder -``` - -Added in v2.2.7 - -# instances - -## Alt - -**Signature** - -```ts -export declare const Alt: Alt1<'io-ts/UnknownTaskDecoder'> -``` - -Added in v2.2.7 - -## Functor - -**Signature** - -```ts -export declare const Functor: Functor1<'io-ts/UnknownTaskDecoder'> -``` - -Added in v2.2.7 - -## Schemable - -**Signature** - -```ts -export declare const Schemable: Schemable1<'io-ts/UnknownTaskDecoder'> & - WithUnknownContainers1<'io-ts/UnknownTaskDecoder'> & - WithUnion1<'io-ts/UnknownTaskDecoder'> & - WithRefine1<'io-ts/UnknownTaskDecoder'> -``` - -Added in v2.2.7 - -## URI - -**Signature** - -```ts -export declare const URI: 'io-ts/UnknownTaskDecoder' -``` - -Added in v2.2.7 - -## URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.7 - -# model - -## UnknownTaskDecoder (interface) - -**Signature** - -```ts -export interface UnknownTaskDecoder extends KTD.TaskDecoder {} -``` - -Added in v2.2.7 - -# primitives - -## UnknownArray - -**Signature** - -```ts -export declare const UnknownArray: UnknownTaskDecoder -``` - -Added in v2.2.7 - -## UnknownRecord - -**Signature** - -```ts -export declare const UnknownRecord: UnknownTaskDecoder> -``` - -Added in v2.2.7 - -## boolean - -**Signature** - -```ts -export declare const boolean: UnknownTaskDecoder -``` - -Added in v2.2.7 - -## number - -**Signature** - -```ts -export declare const number: UnknownTaskDecoder -``` - -Added in v2.2.7 - -## string - -**Signature** - -```ts -export declare const string: UnknownTaskDecoder -``` - -Added in v2.2.7 - -# utils - -## TypeOf (type alias) - -**Signature** - -```ts -export type TypeOf = KTD.TypeOf -``` - -Added in v2.2.7 - -## draw - -**Signature** - -```ts -export declare const draw: (e: FreeSemigroup>) => string -``` - -Added in v2.2.7 diff --git a/dtslint/ts3.5/UnknownTaskDecoder.ts b/dtslint/ts3.5/UnknownTaskDecoder.ts deleted file mode 100644 index 08542e9a3..000000000 --- a/dtslint/ts3.5/UnknownTaskDecoder.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as _ from '../../src/UnknownTaskDecoder' -import * as DE from '../../src/DecodeError' -import * as FS from '../../src/FreeSemigroup' -import { pipe } from 'fp-ts/lib/pipeable' - -// $ExpectType UnknownTaskDecoder<{ a: string; b: { c: number; }; }> -const A = _.type({ - a: _.string, - b: _.type({ - c: _.number - }) -}) - -// $ExpectType UnknownTaskDecoder; }>> -_.partial({ - a: _.string, - b: _.partial({ - c: _.number - }) -}) - -// -// TypeOf -// - -// $ExpectType { a: string; b: { c: number; }; } -export type A = _.TypeOf - -// -// mapLeftWithInput -// - -// $ExpectType UnknownTaskDecoder -pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) -) diff --git a/src/UnknownTaskDecoder.ts b/src/UnknownTaskDecoder.ts deleted file mode 100644 index cf4095a92..000000000 --- a/src/UnknownTaskDecoder.ts +++ /dev/null @@ -1,356 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt1 } from 'fp-ts/lib/Alt' -import { Functor1 } from 'fp-ts/lib/Functor' -import { pipe } from 'fp-ts/lib/pipeable' -import * as T from 'fp-ts/lib/Task' -import * as TE from 'fp-ts/lib/TaskEither' -import * as D from './Decoder' -import * as G from './Guard' -import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' -import * as KTD from './TaskDecoder' - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @category model - * @since 2.2.7 - */ -export interface UnknownTaskDecoder extends KTD.TaskDecoder {} - -// ------------------------------------------------------------------------------------- -// DecodeError -// ------------------------------------------------------------------------------------- - -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = D.DecodeError - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const error: (actual: unknown, message: string) => DecodeError = D.error - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const success: (a: A) => TE.TaskEither = KTD.success - -/** - * @category DecodeError - * @since 2.2.7 - */ -export const failure: (actual: unknown, message: string) => TE.TaskEither = KTD.failure - -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromDecoder: (decoder: D.Decoder) => UnknownTaskDecoder = KTD.fromDecoder - -/** - * @category constructors - * @since 2.2.7 - */ -export const fromGuard = (guard: G.Guard, expected: string): UnknownTaskDecoder => - KTD.fromRefinement(guard.is, expected) - -/** - * @category constructors - * @since 2.2.7 - */ -export const literal: ]>(...values: A) => UnknownTaskDecoder = - KTD.literal - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.7 - */ -export const string: UnknownTaskDecoder = - /*#__PURE__*/ - fromDecoder(D.string) - -/** - * @category primitives - * @since 2.2.7 - */ -export const number: UnknownTaskDecoder = - /*#__PURE__*/ - fromDecoder(D.number) - -/** - * @category primitives - * @since 2.2.7 - */ -export const boolean: UnknownTaskDecoder = - /*#__PURE__*/ - fromDecoder(D.boolean) - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownArray: UnknownTaskDecoder> = - /*#__PURE__*/ - fromDecoder(D.UnknownArray) - -/** - * @category primitives - * @since 2.2.7 - */ -export const UnknownRecord: UnknownTaskDecoder> = - /*#__PURE__*/ - fromDecoder(D.UnknownRecord) - -/** - * @internal - */ -export const object: UnknownTaskDecoder = - /*#__PURE__*/ - fromDecoder(D.object) - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.7 - */ -export const mapLeftWithInput: ( - f: (input: unknown, e: DecodeError) => DecodeError -) => (decoder: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.mapLeftWithInput - -/** - * @category combinators - * @since 2.2.7 - */ -export const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.refine - -/** - * @category combinators - * @since 2.2.7 - */ -export const parse: ( - parser: (a: A) => TE.TaskEither -) => (from: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.parse - -/** - * @category combinators - * @since 2.2.7 - */ -export const nullable: (or: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.nullable - -/** - * @category combinators - * @since 2.2.7 - */ -export const type = ( - properties: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder<{ [K in keyof A]: A[K] }> => pipe(object as any, compose(KTD.ktype(properties))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const partial = ( - properties: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder> => pipe(object as any, compose(KTD.kpartial(properties))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const array = (items: UnknownTaskDecoder): UnknownTaskDecoder> => - pipe(UnknownArray, compose(KTD.karray(items))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const record = (codomain: UnknownTaskDecoder): UnknownTaskDecoder> => - pipe(UnknownRecord, compose(KTD.krecord(codomain))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const tuple = >( - ...components: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder => pipe(UnknownArray as any, compose(KTD.ktuple(...components))) as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const union: ]>( - ...members: { [K in keyof A]: UnknownTaskDecoder } -) => UnknownTaskDecoder = KTD.union as any - -/** - * @category combinators - * @since 2.2.7 - */ -export const intersect: ( - right: UnknownTaskDecoder -) => (left: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.intersect - -/** - * @category combinators - * @since 2.2.7 - */ -export const sum = (tag: T) => ( - members: { [K in keyof A]: UnknownTaskDecoder } -): UnknownTaskDecoder => pipe(object as any, compose(KTD.ksum(tag)(members))) - -/** - * @category combinators - * @since 2.2.7 - */ -export const lazy: (id: string, f: () => UnknownTaskDecoder) => UnknownTaskDecoder = KTD.lazy - -/** - * @category combinators - * @since 2.2.7 - */ -export const compose: (to: KTD.TaskDecoder) => (from: UnknownTaskDecoder) => UnknownTaskDecoder = - KTD.compose - -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- - -const map_: (fa: UnknownTaskDecoder, f: (a: A) => B) => UnknownTaskDecoder = (fa, f) => pipe(fa, map(f)) - -const alt_: (me: UnknownTaskDecoder, that: () => UnknownTaskDecoder) => UnknownTaskDecoder = (me, that) => - pipe(me, alt(that)) - -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- - -/** - * @category Functor - * @since 2.2.7 - */ -export const map: (f: (a: A) => B) => (fa: UnknownTaskDecoder) => UnknownTaskDecoder = KTD.map - -/** - * @category Alt - * @since 2.2.7 - */ -export const alt: (that: () => UnknownTaskDecoder) => (me: UnknownTaskDecoder) => UnknownTaskDecoder = - KTD.alt - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @category instances - * @since 2.2.7 - */ -export const URI = 'io-ts/UnknownTaskDecoder' - -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: UnknownTaskDecoder - } -} - -/** - * @category instances - * @since 2.2.7 - */ -export const Functor: Functor1 = { - URI, - map: map_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const Alt: Alt1 = { - URI, - map: map_, - alt: alt_ -} - -/** - * @category instances - * @since 2.2.7 - */ -export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { - URI, - literal, - string, - number, - boolean, - nullable, - type, - partial, - record, - array, - tuple: tuple as Schemable1['tuple'], - intersect, - sum, - lazy, - UnknownArray, - UnknownRecord, - union: union as WithUnion1['union'], - refine: refine as WithRefine1['refine'] -} - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.7 - */ -export type TypeOf = KTD.TypeOf - -/** - * @since 2.2.7 - */ -export const draw: (e: DecodeError) => string = D.draw - -/** - * @internal - */ -export const stringify: (e: TE.TaskEither) => T.Task = TE.fold( - (e) => T.of(draw(e)), - (a) => T.of(JSON.stringify(a, null, 2)) -) diff --git a/test/UnknownTaskDecoder.ts b/test/UnknownTaskDecoder.ts deleted file mode 100644 index 8c9aedc45..000000000 --- a/test/UnknownTaskDecoder.ts +++ /dev/null @@ -1,590 +0,0 @@ -import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import * as TE from 'fp-ts/lib/TaskEither' -import * as DE from '../src/DecodeError' -import * as FS from '../src/FreeSemigroup' -import * as G from '../src/Guard' -import * as D from '../src/Decoder' -import * as TD from '../src/TaskDecoder' -import * as _ from '../src/UnknownTaskDecoder' - -const undefinedGuard: G.Guard = { - is: (u): u is undefined => u === undefined -} -const undef: _.UnknownTaskDecoder = _.fromGuard(undefinedGuard, 'undefined') - -const NumberFromString: _.UnknownTaskDecoder = pipe( - _.string, - _.parse((s) => { - const n = parseFloat(s) - return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) - }) -) - -interface PositiveBrand { - readonly Positive: unique symbol -} -type Positive = number & PositiveBrand -const Positive: _.UnknownTaskDecoder = pipe( - _.number, - _.refine((n): n is Positive => n > 0, 'Positive') -) - -interface IntBrand { - readonly Int: unique symbol -} -type Int = number & IntBrand -const Int: _.UnknownTaskDecoder = pipe( - _.number, - _.refine((n): n is Int => Number.isInteger(n), 'Int') -) - -describe('UnknownTaskDecoder', () => { - // ------------------------------------------------------------------------------------- - // instances - // ------------------------------------------------------------------------------------- - - it('Functor', async () => { - const decoder = _.Functor.map(_.string, (s) => s + '!') - assert.deepStrictEqual(await decoder.decode('a')(), D.success('a!')) - }) - - it('Alt', async () => { - const decoder = _.Alt.alt(_.string, () => _.number) - assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) - assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) - }) - - // ------------------------------------------------------------------------------------- - // primitives - // ------------------------------------------------------------------------------------- - - it('string', async () => { - assert.deepStrictEqual(await _.string.decode('a')(), D.success('a')) - assert.deepStrictEqual(await _.string.decode(null)(), D.failure(null, 'string')) - }) - - it('number', async () => { - assert.deepStrictEqual(await _.number.decode(1)(), D.success(1)) - assert.deepStrictEqual(await _.number.decode(null)(), D.failure(null, 'number')) - }) - - it('boolean', async () => { - assert.deepStrictEqual(await _.boolean.decode(true)(), D.success(true)) - assert.deepStrictEqual(await _.boolean.decode(null)(), D.failure(null, 'boolean')) - }) - - it('UnknownArray', async () => { - assert.deepStrictEqual(await _.UnknownArray.decode([1, 'a'])(), D.success([1, 'a'])) - assert.deepStrictEqual(await _.UnknownArray.decode(null)(), D.failure(null, 'Array')) - }) - - it('UnknownRecord', async () => { - assert.deepStrictEqual(await _.UnknownRecord.decode({ a: 1, b: 'b' })(), D.success({ a: 1, b: 'b' })) - assert.deepStrictEqual(await _.UnknownRecord.decode(null)(), D.failure(null, 'Record')) - }) - - // ------------------------------------------------------------------------------------- - // constructors - // ------------------------------------------------------------------------------------- - - it('fromGuard', async () => { - const decoder = _.fromGuard(G.string, 'string') - assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) - assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'string')) - }) - - describe('literal', () => { - it('should decode a valid input', async () => { - const decoder = _.literal('a', null, 'b', 1, true) - assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) - assert.deepStrictEqual(await decoder.decode(null)(), D.success(null)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.literal('a', null) - assert.deepStrictEqual(await decoder.decode('b')(), D.failure('b', '"a" | null')) - }) - }) - - // ------------------------------------------------------------------------------------- - // combinators - // ------------------------------------------------------------------------------------- - - it('mapLeftWithInput', async () => { - const decoder = pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) - ) - assert.deepStrictEqual(await decoder.decode('a')(), D.failure('a', 'not a number')) - }) - - it('compose', async () => { - interface IntBrand { - readonly Int: unique symbol - } - - type Int = number & IntBrand - - const decoder = pipe(_.number, _.compose(TD.fromRefinement((n): n is Int => Number.isInteger(n), 'IntFromNumber'))) - assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) - assert.deepStrictEqual(await decoder.decode('a')(), D.failure('a', 'number')) - assert.deepStrictEqual(await decoder.decode(1.2)(), D.failure(1.2, 'IntFromNumber')) - }) - - describe('nullable', () => { - it('should decode a valid input', async () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual(await decoder.decode(null)(), D.success(null)) - assert.deepStrictEqual(await decoder.decode('1')(), D.success(1)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.nullable(NumberFromString) - assert.deepStrictEqual( - await decoder.decode(undefined)(), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(undefined, 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf(undefined, 'string')))) - ) - ) - ) - assert.deepStrictEqual( - await decoder.decode('a')(), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf('a', 'null')))), - FS.of(DE.member(1, FS.of(DE.leaf('a', 'parsable to a number')))) - ) - ) - ) - }) - }) - - describe('type', () => { - it('should decode a valid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) - }) - - it('should strip additional fields', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a' })) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.type({ - a: undef - }) - assert.deepStrictEqual(await decoder.decode({})(), D.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.type({ - a: _.string - }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) - assert.deepStrictEqual( - await decoder.decode({ a: 1 })(), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.type({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.type({ a: _.string, b: _.string }) - assert.deepStrictEqual(await decoder.decode(new A())(), D.success({ a: 'a', b: 'b' })) - }) - }) - - describe('partial', () => { - it('should decode a valid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) - assert.deepStrictEqual(await decoder.decode({})(), D.success({})) - }) - - it('should strip additional fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a' })) - }) - - it('should not add missing fields', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({})(), D.success({})) - }) - - it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode({ a: undefined })(), D.success({ a: undefined })) - }) - - it('should reject an invalid input', async () => { - const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) - assert.deepStrictEqual( - await decoder.decode({ a: 1 })(), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.partial({ - a: _.string, - b: _.number - }) - assert.deepStrictEqual( - await decoder.decode({ a: 1, b: 'b' })(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.partial({ a: _.string, b: _.string }) - assert.deepStrictEqual(await decoder.decode(new A())(), D.success({ a: 'a', b: 'b' })) - }) - }) - - describe('array', () => { - it('should decode a valid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(await decoder.decode([])(), D.success([])) - assert.deepStrictEqual(await decoder.decode(['a'])(), D.success(['a'])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Array')) - assert.deepStrictEqual( - await decoder.decode([1])(), - E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.array(_.string) - assert.deepStrictEqual( - await decoder.decode([1, 2])(), - E.left( - FS.concat( - FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.optional, FS.of(DE.leaf(2, 'string')))) - ) - ) - ) - }) - }) - - describe('record', () => { - it('should decode a valid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(await decoder.decode({})(), D.success({})) - assert.deepStrictEqual(await decoder.decode({ a: 1 })(), D.success({ a: 1 })) - }) - - it('should reject an invalid value', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) - assert.deepStrictEqual( - await decoder.decode({ a: 'a' })(), - E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.record(_.number) - assert.deepStrictEqual( - await decoder.decode({ a: 'a', b: 'b' })(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.optional, FS.of(DE.leaf('a', 'number')))), - FS.of(DE.key('b', DE.optional, FS.of(DE.leaf('b', 'number')))) - ) - ) - ) - }) - }) - - describe('tuple', () => { - it('should decode a valid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(await decoder.decode(['a', 1])(), D.success(['a', 1])) - }) - - it('should handle zero components', async () => { - assert.deepStrictEqual(await _.tuple().decode([])(), D.success([])) - }) - - it('should reject an invalid input', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Array')) - assert.deepStrictEqual( - await decoder.decode(['a'])(), - E.left(FS.of(DE.index(1, DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - await decoder.decode([1, 2])(), - E.left(FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should collect all errors', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual( - await decoder.decode([1, 'a'])(), - E.left( - FS.concat( - FS.of(DE.index(0, DE.required, FS.of(DE.leaf(1, 'string')))), - FS.of(DE.index(1, DE.required, FS.of(DE.leaf('a', 'number')))) - ) - ) - ) - }) - - it('should strip additional components', async () => { - const decoder = _.tuple(_.string, _.number) - assert.deepStrictEqual(await decoder.decode(['a', 1, true])(), D.success(['a', 1])) - }) - }) - - describe('union', () => { - it('should decode a valid input', async () => { - assert.deepStrictEqual(await _.union(_.string).decode('a')(), D.success('a')) - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) - assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) - }) - - it('should reject an invalid input', async () => { - const decoder = _.union(_.string, _.number) - assert.deepStrictEqual( - await decoder.decode(true)(), - E.left( - FS.concat( - FS.of(DE.member(0, FS.of(DE.leaf(true, 'string')))), - FS.of(DE.member(1, FS.of(DE.leaf(true, 'number')))) - ) - ) - ) - }) - }) - - describe('refine', () => { - it('should decode a valid input', async () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) - }) - - it('should reject an invalid input', async () => { - const decoder = pipe( - _.string, - _.refine((s): s is string => s.length > 0, 'NonEmptyString') - ) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'string')) - assert.deepStrictEqual(await decoder.decode('')(), D.failure('', 'NonEmptyString')) - }) - }) - - describe('intersect', () => { - it('should decode a valid input', async () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a', b: 1 })) - }) - - it('should handle primitives', async () => { - const decoder = pipe(Int, _.intersect(Positive)) - assert.deepStrictEqual(await decoder.decode(1)(), D.success(1)) - }) - - it('should accumulate all errors', async () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) - assert.deepStrictEqual( - await decoder.decode({ a: 'a' })(), - E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) - ) - assert.deepStrictEqual( - await decoder.decode({ b: 1 })(), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string'))))) - ) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left( - FS.concat( - FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))), - FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number')))) - ) - ) - ) - }) - }) - - describe('sum', () => { - const sum = _.sum('_tag') - - it('should decode a valid input', async () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), D.success({ _tag: 'A', a: 'a' })) - assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), D.success({ _tag: 'B', b: 1 })) - }) - - it('should reject an invalid input', async () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) - const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'object')) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) - ) - assert.deepStrictEqual( - await decoder.decode({ _tag: 'A', a: 1 })(), - E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) - ) - }) - - it('should support empty records', async () => { - const decoder = sum({}) - assert.deepStrictEqual( - await decoder.decode({})(), - E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) - ) - }) - }) - - interface A { - a: number - b?: A - } - - const lazyDecoder: _.UnknownTaskDecoder = _.lazy('A', () => - pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) - ) - - describe('lazy', () => { - it('should decode a valid input', async () => { - assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), D.success({ a: 1 })) - assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), D.success({ a: 1, b: { a: 2 } })) - }) - - it('should reject an invalid input', async () => { - assert.deepStrictEqual( - await lazyDecoder.decode({ a: 1 })(), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))))) - ) - assert.deepStrictEqual( - await lazyDecoder.decode({ a: 'a' })(), - E.left(FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf('a', 'parsable to a number'))))))) - ) - assert.deepStrictEqual( - await lazyDecoder.decode({ a: '1', b: {} })(), - E.left( - FS.of( - DE.lazy( - 'A', - FS.of( - DE.key( - 'b', - DE.optional, - FS.of(DE.lazy('A', FS.of(DE.key('a', DE.required, FS.of(DE.leaf(undefined, 'string')))))) - ) - ) - ) - ) - ) - ) - }) - }) - - // ------------------------------------------------------------------------------------- - // utils - // ------------------------------------------------------------------------------------- - - describe('draw', () => { - it('draw', async () => { - const decoder = _.type({ - a: _.string, - b: _.number, - c: _.array(_.boolean), - d: _.nullable(_.string) - }) - assert.deepStrictEqual( - await pipe(decoder.decode({ c: [1] }), TE.mapLeft(_.draw))(), - E.left(`required property "a" -└─ cannot decode undefined, should be string -required property "b" -└─ cannot decode undefined, should be number -required property "c" -└─ optional index 0 - └─ cannot decode 1, should be boolean -required property "d" -├─ member 0 -│ └─ cannot decode undefined, should be null -└─ member 1 - └─ cannot decode undefined, should be string`) - ) - }) - - it('should support lazy combinators', async () => { - assert.deepStrictEqual( - await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(_.draw))(), - E.left(`lazy type A -└─ optional property \"b\" - └─ lazy type A - └─ required property \"a\" - └─ cannot decode undefined, should be string`) - ) - }) - }) - - it('stringify', async () => { - assert.deepStrictEqual(await _.stringify(_.string.decode('a'))(), '"a"') - assert.deepStrictEqual(await _.stringify(_.string.decode(null))(), 'cannot decode null, should be string') - }) -}) From 645c6070d72883b0f84b852559dc5456f9a22e6b Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 14:59:15 +0200 Subject: [PATCH 105/222] rename "items" to "item" --- docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 4 ++-- docs/modules/Encoder.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 2 +- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/Kleisli.ts.md | 2 +- docs/modules/Schemable.ts.md | 6 +++--- docs/modules/TaskDecoder.ts.md | 4 ++-- docs/modules/Type.ts.md | 2 +- src/Codec.ts | 4 ++-- src/Decoder.ts | 8 ++++---- src/Encoder.ts | 4 ++-- src/Guard.ts | 4 ++-- src/JsonCodec.ts | 2 +- src/JsonEncoder.ts | 2 +- src/Kleisli.ts | 8 +++----- src/Schemable.ts | 6 +++--- src/TaskDecoder.ts | 8 ++++---- src/Type.ts | 2 +- test/Arbitrary.ts | 4 ++-- 21 files changed, 39 insertions(+), 41 deletions(-) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 7dfca0f55..38f11570d 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -74,7 +74,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function array(items: Codec): Codec, Array> +export declare function array(item: Codec): Codec, Array> ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index f126d0240..d14fd1a41 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -178,7 +178,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const array: (items: Decoder) => Decoder +export declare const array: (item: Decoder) => Decoder ``` Added in v2.2.8 @@ -200,7 +200,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const karray: (items: Decoder) => Decoder +export declare const karray: (item: Decoder) => Decoder ``` Added in v2.2.7 diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index f5d91ad8c..bdc1c177d 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -79,7 +79,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function array(items: Encoder): Encoder, Array> +export declare function array(item: Encoder): Encoder, Array> ``` Added in v2.2.3 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 07250ced6..5f0962dd1 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -57,7 +57,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const array: (items: Guard) => Guard +export declare const array: (item: Guard) => Guard ``` Added in v2.2.0 diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index c67761083..4aa1be04b 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -71,7 +71,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const array: (items: JsonCodec) => JsonCodec +export declare const array: (item: JsonCodec) => JsonCodec ``` Added in v2.2.3 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index d2d4c53e9..12b5b05df 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -67,7 +67,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const array: (items: JsonEncoder) => JsonEncoder +export declare const array: (item: JsonEncoder) => JsonEncoder ``` Added in v2.2.3 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index f0be368fa..679455b38 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -68,7 +68,7 @@ Added in v2.2.7 ```ts export declare function array( M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (items: Kleisli) => Kleisli, E, Array> +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> ``` Added in v2.2.7 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index e0e70ffdd..2ed347688 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -64,7 +64,7 @@ export interface Schemable { readonly type: (properties: { [K in keyof A]: HKT }) => HKT readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> readonly record: (codomain: HKT) => HKT> - readonly array: (items: HKT) => HKT> + readonly array: (item: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT readonly intersect: (right: HKT) => (left: HKT) => HKT readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT @@ -89,7 +89,7 @@ export interface Schemable1 { readonly type: (properties: { [K in keyof A]: Kind }) => Kind readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> readonly record: (codomain: Kind) => Kind> - readonly array: (items: Kind) => Kind> + readonly array: (item: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind readonly intersect: (right: Kind) => (left: Kind) => Kind readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind @@ -116,7 +116,7 @@ export interface Schemable2C { properties: { [K in keyof A]: Kind2 } ) => Kind2> readonly record: (codomain: Kind2) => Kind2> - readonly array: (items: Kind2) => Kind2> + readonly array: (item: Kind2) => Kind2> readonly tuple: >( ...components: { [K in keyof A]: Kind2 } ) => Kind2 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 0d1b55ef9..4a49f1595 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -179,7 +179,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const array: (items: TaskDecoder) => TaskDecoder +export declare const array: (item: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -201,7 +201,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const karray: (items: TaskDecoder) => TaskDecoder +export declare const karray: (item: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 9007c9c1e..75272afff 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -55,7 +55,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const array: (items: Type) => Type +export declare const array: (item: Type) => Type ``` Added in v2.2.3 diff --git a/src/Codec.ts b/src/Codec.ts index c1647fd80..4a2ec4ad7 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -179,8 +179,8 @@ export function record(codomain: Codec): Codec, Re * @category combinators * @since 2.2.3 */ -export function array(items: Codec): Codec, Array> { - return make(D.array(items), E.array(items)) +export function array(item: Codec): Codec, Array> { + return make(D.array(item), E.array(item)) } /** diff --git a/src/Decoder.ts b/src/Decoder.ts index 44cccfb61..cd1b39ac9 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -262,15 +262,15 @@ export const partial = ( * @category combinators * @since 2.2.7 */ -export const karray = (items: Decoder): Decoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) +export const karray = (item: Decoder): Decoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.8 */ -export const array = (items: Decoder): Decoder> => - pipe(UnknownArray, compose(karray(items))) +export const array = (item: Decoder): Decoder> => + pipe(UnknownArray, compose(karray(item))) /** * @category combinators diff --git a/src/Encoder.ts b/src/Encoder.ts index d03f4865f..1e518a634 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -114,9 +114,9 @@ export function record(codomain: Encoder): Encoder * @category combinators * @since 2.2.3 */ -export function array(items: Encoder): Encoder, Array> { +export function array(item: Encoder): Encoder, Array> { return { - encode: (as) => as.map(items.encode) + encode: (as) => as.map(item.encode) } } diff --git a/src/Guard.ts b/src/Guard.ts index 13040faa7..91afd015f 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -175,10 +175,10 @@ export const record = (codomain: Guard): Guard> => * @category combinators * @since 2.2.0 */ -export const array = (items: Guard): Guard> => +export const array = (item: Guard): Guard> => pipe( UnknownArray, - refine((us): us is Array => us.every(items.is)) + refine((us): us is Array => us.every(item.is)) ) /** diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 05a703688..29780d28d 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -130,7 +130,7 @@ export const record: (codomain: JsonCodec) => JsonCodec> * @category combinators * @since 2.2.3 */ -export const array: (items: JsonCodec) => JsonCodec> = C.array +export const array: (item: JsonCodec) => JsonCodec> = C.array /** * @category combinators diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index ae89f9bc6..5df01d960 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -104,7 +104,7 @@ export const record: (codomain: JsonEncoder) => JsonEncoder(items: JsonEncoder) => JsonEncoder> = E.array +export const array: (item: JsonEncoder) => JsonEncoder> = E.array /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 3295ef504..458ba2016 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -194,12 +194,10 @@ export function partial( */ export function array( M: Applicative2C & Bifunctor2 -): ( - onItemError: (index: number, e: E) => E -) => (items: Kleisli) => Kleisli, E, Array> { +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> { const traverse = traverseArrayWithIndex(M) - return (onItemError) => (items) => ({ - decode: (is) => traverse(is, (index, i) => M.mapLeft(items.decode(i), (e) => onItemError(index, e))) + return (onItemError) => (item) => ({ + decode: (is) => traverse(is, (index, i) => M.mapLeft(item.decode(i), (e) => onItemError(index, e))) }) } diff --git a/src/Schemable.ts b/src/Schemable.ts index bfd0a51c8..f5fc3929f 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -28,7 +28,7 @@ export interface Schemable { readonly type: (properties: { [K in keyof A]: HKT }) => HKT readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> readonly record: (codomain: HKT) => HKT> - readonly array: (items: HKT) => HKT> + readonly array: (item: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT readonly intersect: (right: HKT) => (left: HKT) => HKT readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT @@ -48,7 +48,7 @@ export interface Schemable1 { readonly type: (properties: { [K in keyof A]: Kind }) => Kind readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> readonly record: (codomain: Kind) => Kind> - readonly array: (items: Kind) => Kind> + readonly array: (item: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind readonly intersect: (right: Kind) => (left: Kind) => Kind readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind @@ -70,7 +70,7 @@ export interface Schemable2C { properties: { [K in keyof A]: Kind2 } ) => Kind2> readonly record: (codomain: Kind2) => Kind2> - readonly array: (items: Kind2) => Kind2> + readonly array: (item: Kind2) => Kind2> readonly tuple: >( ...components: { [K in keyof A]: Kind2 } ) => Kind2 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 2d39bf9ea..1b8032efd 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -265,15 +265,15 @@ export const partial = ( * @category combinators * @since 2.2.7 */ -export const karray = (items: TaskDecoder): TaskDecoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(items) +export const karray = (item: TaskDecoder): TaskDecoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.7 */ -export const array = (items: TaskDecoder): TaskDecoder> => - pipe(UnknownArray, compose(karray(items))) +export const array = (item: TaskDecoder): TaskDecoder> => + pipe(UnknownArray, compose(karray(item))) /** * @category combinators diff --git a/src/Type.ts b/src/Type.ts index 3784ac24f..f930ad827 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -119,7 +119,7 @@ export const record = (codomain: Type): Type> => t.recor * @category combinators * @since 2.2.3 */ -export const array = (items: Type): Type> => t.array(items) +export const array = (item: Type): Type> => t.array(item) /** * @category combinators diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 6effccf72..1126e1acf 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -66,8 +66,8 @@ export function record(codomain: Arbitrary): Arbitrary> return fc.dictionary(string, codomain) } -export function array(items: Arbitrary): Arbitrary> { - return fc.array(items) +export function array(item: Arbitrary): Arbitrary> { + return fc.array(item) } export function tuple>( From f628d1aa6ed0f04a9ed8143ff317d9e238bf8bd5 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 17:04:20 +0200 Subject: [PATCH 106/222] drop `type` in favour of `props` --- CHANGELOG.md | 7 +++-- docs/modules/Decoder.ts.md | 26 ++++++++-------- docs/modules/Kleisli.ts.md | 45 ++++++++++++++++----------- docs/modules/TaskDecoder.ts.md | 26 ++++++++-------- dtslint/ts3.5/Decoder.ts | 19 +++--------- dtslint/ts3.5/Kleisli.ts | 56 ---------------------------------- dtslint/ts3.5/TaskDecoder.ts | 19 +++--------- src/Decoder.ts | 19 ++++++------ src/Kleisli.ts | 34 ++++++++++++++------- src/TaskDecoder.ts | 19 ++++++------ test/Codec.ts | 2 +- test/Decoder.ts | 2 +- test/TaskDecoder.ts | 2 +- 13 files changed, 115 insertions(+), 161 deletions(-) delete mode 100644 dtslint/ts3.5/Kleisli.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cbd4437b..1f296593b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,10 +26,13 @@ - rename `schemableEq` to `Schemable` (@gcanti) - `Guard` - rename `schemableGuard` to `Schemable` (@gcanti) + - `Kleisli` + - add `id` (@gcanti) + - drop `type` in favour of `props` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - - rename `type` to `ktype` + - drop `type` in favour of `props` (@gcanti) - rename `partial` to `kpartial` - rename `array` to `karray` - rename `record` to `krecord` @@ -43,7 +46,7 @@ - rename `fromKleisliDecoder` to `fromDecoder` (@gcanti) - add `fromGuard` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - - rename `type` to `ktype` + - drop `type` in favour of `props` (@gcanti) - rename `partial` to `kpartial` - rename `array` to `karray` - rename `record` to `krecord` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index d14fd1a41..fb53356af 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -40,12 +40,12 @@ Added in v2.2.7 - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) - - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [props](#props) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -253,18 +253,6 @@ export declare const ktuple: []>( Added in v2.2.7 -## ktype - -**Signature** - -```ts -export declare const ktype:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> -``` - -Added in v2.2.7 - ## lazy **Signature** @@ -321,6 +309,18 @@ export declare const partial: ( Added in v2.2.8 +## props + +**Signature** + +```ts +export declare const props: ( + properties: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder +``` + +Added in v2.2.8 + ## record **Signature** diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 679455b38..453dd701a 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -23,6 +23,7 @@ Added in v2.2.7 - [alt](#alt) - [array](#array) - [compose](#compose) + - [id](#id) - [intersect](#intersect) - [lazy](#lazy) - [map](#map) @@ -30,11 +31,11 @@ Added in v2.2.7 - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [props](#props) - [record](#record) - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - - [type](#type) - [union](#union) - [constructors](#constructors) - [fromRefinement](#fromrefinement) @@ -85,6 +86,16 @@ export declare function compose( Added in v2.2.7 +## id + +**Signature** + +```ts +export declare function id(M: Applicative2C): () => Kleisli +``` + +Added in v2.2.8 + ## intersect **Signature** @@ -173,6 +184,22 @@ export declare function partial( Added in v2.2.7 +## props + +**Signature** + +```ts +export declare function props( + M: Monad2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) => ( + properties: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli +``` + +Added in v2.2.8 + ## record **Signature** @@ -236,22 +263,6 @@ export declare function tuple( Added in v2.2.7 -## type - -**Signature** - -```ts -export declare function type( - M: Applicative2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) =>

>>( - properties: P -) => Kleisli }, E, { [K in keyof P]: TypeOf }> -``` - -Added in v2.2.7 - ## union **Signature** diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 4a49f1595..1e7009b93 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -40,12 +40,12 @@ Added in v2.2.7 - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) - - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [props](#props) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -257,18 +257,6 @@ export declare const ktuple: []>( Added in v2.2.7 -## ktype - -**Signature** - -```ts -export declare const ktype:

>>( - properties: P -) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> -``` - -Added in v2.2.7 - ## lazy **Signature** @@ -325,6 +313,18 @@ export declare const partial: ( Added in v2.2.5 +## props + +**Signature** + +```ts +export declare const props: ( + properties: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder +``` + +Added in v2.2.8 + ## record **Signature** diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 4a4161919..39a2004e1 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -20,15 +20,6 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf -// -// ktype -// - -// $ExpectType Decoder<{ a: string; }, { a: number; }> -_.ktype({ - a: NumberFromString -}) - // // kpartial // @@ -46,13 +37,13 @@ _.kpartial({ _.ktuple(NumberFromString) // -// ksum +// sum // -// $ExpectType Decoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> -_.ksum('_tag')({ - A: _.ktype({ _tag: _.literal('A'), a: NumberFromString }), - B: _.ktype({ _tag: _.literal('B'), b: NumberFromString }) +// $ExpectType Decoder +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: _.string }), + B: _.type({ _tag: _.literal('B'), b: _.number }) }) // diff --git a/dtslint/ts3.5/Kleisli.ts b/dtslint/ts3.5/Kleisli.ts deleted file mode 100644 index 25a455d68..000000000 --- a/dtslint/ts3.5/Kleisli.ts +++ /dev/null @@ -1,56 +0,0 @@ -import * as _ from '../../src/Kleisli' -import * as E from 'fp-ts/lib/Either' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import { Alt2C } from 'fp-ts/lib/Alt' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' - -declare const M: MonadThrow2C & Bifunctor2 & Alt2C -declare const string: _.Kleisli -declare const NumberFromString: _.Kleisli - -// -// type -// - -const type = _.type(M)((_, e) => e) - -// $ExpectType Kleisli<"Either", { a: string; }, string, { a: number; }> -type({ - a: NumberFromString -}) - -// -// partial -// - -// $ExpectType Kleisli<"Either", { a: string; }, string, Partial<{ a: number; }>> -_.partial(M)((_, e) => e)({ - a: NumberFromString -}) - -// -// tuple -// - -// $ExpectType Kleisli<"Either", [string], string, [number]> -_.tuple(M)((_, e) => e)(NumberFromString) - -// -// sum -// - -declare const literalA: _.Kleisli -declare const literalB: _.Kleisli - -// $ExpectType Kleisli<"Either", { _tag: unknown; a: string; } | { _tag: unknown; b: string; }, string, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> -_.sum(M)(() => 'error')('_tag')({ - A: type({ _tag: literalA, a: NumberFromString }), - B: type({ _tag: literalB, b: NumberFromString }) -}) - -// -// union -// - -// $ExpectType Kleisli<"Either", string, string, string | number> -_.union(M)((_, e) => e)(NumberFromString, string) diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts index fce6909a8..e1451b62c 100644 --- a/dtslint/ts3.5/TaskDecoder.ts +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -20,15 +20,6 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf -// -// ktype -// - -// $ExpectType TaskDecoder<{ a: string; }, { a: number; }> -_.ktype({ - a: NumberFromString -}) - // // kpartial // @@ -46,13 +37,13 @@ _.kpartial({ _.ktuple(NumberFromString) // -// ksum +// sum // -// $ExpectType TaskDecoder<{ _tag: unknown; a: string; } | { _tag: unknown; b: string; }, { _tag: "A"; a: number; } | { _tag: "B"; b: number; }> -_.ksum('_tag')({ - A: _.ktype({ _tag: _.literal('A'), a: NumberFromString }), - B: _.ktype({ _tag: _.literal('B'), b: NumberFromString }) +// $ExpectType TaskDecoder +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: _.string }), + B: _.type({ _tag: _.literal('B'), b: _.number }) }) // diff --git a/src/Decoder.ts b/src/Decoder.ts index cd1b39ac9..953efe107 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -226,12 +226,13 @@ export const nullable: (or: Decoder) => Decoder /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const ktype =

>>( - properties: P -): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) +export const props: ( + properties: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder = + /*#__PURE__*/ + K.props(M)((k, e) => FS.of(DE.key(k, DE.required, e))) /** * @category combinators @@ -239,7 +240,7 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: Decoder } -): Decoder => pipe(object as any, compose(ktype(properties))) +): Decoder => pipe(UnknownRecord, props(properties)) /** * @category combinators @@ -396,9 +397,9 @@ export const compose: (to: Decoder) => (from: Decoder) => D * @category Category * @since 2.2.8 */ -export const id = (): Decoder => ({ - decode: success -}) +export const id: () => Decoder = + /*#__PURE__*/ + K.id(M) // ------------------------------------------------------------------------------------- // instances diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 458ba2016..4dd1826f9 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -133,21 +133,23 @@ export type InputOf = KD extends Kleisli( - M: Applicative2C & Bifunctor2 +export function props( + M: Monad2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E -) =>

>>( - properties: P -) => Kleisli }, E, { [K in keyof P]: TypeOf }> { +) => ( + properties: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli { const traverse = traverseRecordWithIndex(M) - return (onPropertyError) => (properties) => ({ - decode: (i) => - traverse(properties as Record>, (key, decoder) => - M.mapLeft(decoder.decode(i[key]), (e) => onPropertyError(key, e)) - ) as any + return (onPropertyError) => (properties) => (decoder) => ({ + decode: (h) => + M.chain(decoder.decode(h), (ri) => { + return traverse(properties as Record>, (key, decoder) => + M.mapLeft(decoder.decode(ri[key]), (e) => onPropertyError(key, e)) + ) as any + }) }) } @@ -337,6 +339,16 @@ export function compose( }) } +/** + * @category combinators + * @since 2.2.8 + */ +export function id(M: Applicative2C): () => Kleisli { + return () => ({ + decode: M.of + }) +} + /** * @category combinators * @since 2.2.7 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 1b8032efd..dd5b4d135 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -229,12 +229,13 @@ export const nullable: (or: TaskDecoder) => TaskDecoder>>( - properties: P -): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) +export const props: ( + properties: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder = + /*#__PURE__*/ + K.props(M)((k, e) => FS.of(DE.key(k, DE.required, e))) /** * @category combinators @@ -242,7 +243,7 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(object as any, compose(ktype(properties))) +): TaskDecoder => pipe(UnknownRecord, props(properties)) /** * @category combinators @@ -401,9 +402,9 @@ export const compose: (to: TaskDecoder) => (from: TaskDecoder(): TaskDecoder => ({ - decode: success -}) +export const id: () => TaskDecoder = + /*#__PURE__*/ + K.id(M) // ------------------------------------------------------------------------------------- // instances diff --git a/test/Codec.ts b/test/Codec.ts index 1ce903c33..9d9a84509 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -241,7 +241,7 @@ describe('Codec', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) diff --git a/test/Decoder.ts b/test/Decoder.ts index 154f5ff7a..71165034c 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -192,7 +192,7 @@ describe('Decoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 9328e6305..4ab73c160 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -204,7 +204,7 @@ describe('UnknownTaskDecoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) From 9d1356dcbb1b63fa4c04fc762a43f39b0926c05e Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 17:14:02 +0200 Subject: [PATCH 107/222] drop `partial` in favour of `partialProps` --- CHANGELOG.md | 5 ++- docs/modules/Decoder.ts.md | 26 ++++++------- docs/modules/Kleisli.ts.md | 16 ++++---- docs/modules/TaskDecoder.ts.md | 31 +++++++--------- dtslint/ts3.5/Decoder.ts | 9 ----- dtslint/ts3.5/TaskDecoder.ts | 9 ----- src/Decoder.ts | 13 ++++--- src/Kleisli.ts | 68 ++++++++++++++++++---------------- src/TaskDecoder.ts | 15 ++++---- test/Codec.ts | 2 +- test/Decoder.ts | 2 +- test/TaskDecoder.ts | 2 +- 12 files changed, 93 insertions(+), 105 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f296593b..652439dbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,11 +29,12 @@ - `Kleisli` - add `id` (@gcanti) - drop `type` in favour of `props` (@gcanti) + - drop `partial` in favour of `partialProps` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - drop `type` in favour of `props` (@gcanti) - - rename `partial` to `kpartial` + - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `karray` - rename `record` to `krecord` - rename `tuple` to `ktuple` @@ -47,7 +48,7 @@ - add `fromGuard` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - drop `type` in favour of `props` (@gcanti) - - rename `partial` to `kpartial` + - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `karray` - rename `record` to `krecord` - rename `tuple` to `ktuple` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index fb53356af..c2de711aa 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -36,7 +36,6 @@ Added in v2.2.7 - [array](#array) - [intersect](#intersect) - [karray](#karray) - - [kpartial](#kpartial) - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) @@ -45,6 +44,7 @@ Added in v2.2.7 - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [partialProps](#partialprops) - [props](#props) - [record](#record) - [refine](#refine) @@ -205,18 +205,6 @@ export declare const karray: (item: Decoder) => Decoder Added in v2.2.7 -## kpartial - -**Signature** - -```ts -export declare const kpartial:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }>> -``` - -Added in v2.2.7 - ## krecord **Signature** @@ -309,6 +297,18 @@ export declare const partial: ( Added in v2.2.8 +## partialProps + +**Signature** + +```ts +export declare const partialProps: ( + properties: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder> +``` + +Added in v2.2.8 + ## props **Signature** diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 453dd701a..02e3e3a01 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -30,7 +30,7 @@ Added in v2.2.7 - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - - [partial](#partial) + - [partialProps](#partialprops) - [props](#props) - [record](#record) - [refine](#refine) @@ -168,21 +168,21 @@ export declare function parse( Added in v2.2.7 -## partial +## partialProps **Signature** ```ts -export declare function partial( - M: Applicative2C & Bifunctor2 +export declare function partialProps( + M: Monad2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E -) =>

>>( - properties: P -) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> +) => ( + properties: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli> ``` -Added in v2.2.7 +Added in v2.2.8 ## props diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 1e7009b93..a87f15086 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -36,7 +36,6 @@ Added in v2.2.7 - [array](#array) - [intersect](#intersect) - [karray](#karray) - - [kpartial](#kpartial) - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) @@ -45,6 +44,7 @@ Added in v2.2.7 - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [partialProps](#partialprops) - [props](#props) - [record](#record) - [refine](#refine) @@ -206,21 +206,6 @@ export declare const karray: (item: TaskDecoder) => TaskDecoder>>( - properties: P -) => TaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> -> -``` - -Added in v2.2.7 - ## krecord **Signature** @@ -311,7 +296,19 @@ export declare const partial: ( ) => TaskDecoder> ``` -Added in v2.2.5 +Added in v2.2.8 + +## partialProps + +**Signature** + +```ts +export declare const partialProps: ( + properties: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder> +``` + +Added in v2.2.8 ## props diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 39a2004e1..ba8d48818 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -20,15 +20,6 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf -// -// kpartial -// - -// $ExpectType Decoder<{ a: string; }, Partial<{ a: number; }>> -_.kpartial({ - a: NumberFromString -}) - // // ktuple // diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts index e1451b62c..a3f00d74c 100644 --- a/dtslint/ts3.5/TaskDecoder.ts +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -20,15 +20,6 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf -// -// kpartial -// - -// $ExpectType TaskDecoder<{ a: string; }, Partial<{ a: number; }>> -_.kpartial({ - a: NumberFromString -}) - // // ktuple // diff --git a/src/Decoder.ts b/src/Decoder.ts index 953efe107..b4b130b62 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -244,12 +244,13 @@ export const type = ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const kpartial =

>>( - properties: P -): Decoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => - K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) +export const partialProps: ( + properties: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder> = + /*#__PURE__*/ + K.partialProps(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators @@ -257,7 +258,7 @@ export const kpartial =

>>( */ export const partial = ( properties: { [K in keyof A]: Decoder } -): Decoder> => pipe(object as any, compose(kpartial(properties))) +): Decoder> => pipe(UnknownRecord, partialProps(properties)) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 4dd1826f9..2aaff63b4 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -145,48 +145,54 @@ export function props( const traverse = traverseRecordWithIndex(M) return (onPropertyError) => (properties) => (decoder) => ({ decode: (h) => - M.chain(decoder.decode(h), (ri) => { - return traverse(properties as Record>, (key, decoder) => - M.mapLeft(decoder.decode(ri[key]), (e) => onPropertyError(key, e)) - ) as any - }) + M.chain( + decoder.decode(h), + (ri) => + traverse(properties as Record>, (key, decoder) => + M.mapLeft(decoder.decode(ri[key]), (e) => onPropertyError(key, e)) + ) as any + ) }) } /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export function partial( - M: Applicative2C & Bifunctor2 +export function partialProps( + M: Monad2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E -) =>

>>( - properties: P -) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> { +) => ( + properties: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli> { const traverse = traverseRecordWithIndex(M) const undefinedProperty = M.of>(E.right(undefined)) const skipProperty = M.of>(E.left(undefined)) - return (onPropertyError) => (properties) => ({ - decode: (i) => - M.map( - traverse(properties as Record>, (key, decoder) => { - const ikey = i[key] - if (ikey === undefined) { - return key in i - ? // don't strip undefined properties - undefinedProperty - : // don't add missing properties - skipProperty - } - return M.bimap( - decoder.decode(ikey), - (e) => onPropertyError(key, e), - (a) => E.right(a) - ) - }), - compactRecord - ) as any + return (onPropertyError) => (properties) => (decoder) => ({ + decode: (h) => + M.chain( + decoder.decode(h), + (ri) => + M.map( + traverse(properties as Record>, (key, decoder) => { + const ikey = ri[key] + if (ikey === undefined) { + return key in ri + ? // don't strip undefined properties + undefinedProperty + : // don't add missing properties + skipProperty + } + return M.bimap( + decoder.decode(ikey), + (e) => onPropertyError(key, e), + (a) => E.right(a) + ) + }), + compactRecord + ) as any + ) }) } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index dd5b4d135..d4399f8ae 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -247,20 +247,21 @@ export const type = ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const kpartial =

>>( - properties: P -): TaskDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => - K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) +export const partialProps: ( + properties: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder> = + /*#__PURE__*/ + K.partialProps(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators - * @since 2.2.5 + * @since 2.2.8 */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(object as any, compose(kpartial(properties))) +): TaskDecoder> => pipe(UnknownRecord, partialProps(properties)) /** * @category combinators diff --git a/test/Codec.ts b/test/Codec.ts index 9d9a84509..8d508c90f 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -317,7 +317,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) diff --git a/test/Decoder.ts b/test/Decoder.ts index 71165034c..8ee000bde 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -253,7 +253,7 @@ describe('Decoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 4ab73c160..4e18d5565 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -265,7 +265,7 @@ describe('UnknownTaskDecoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) From a05dd2c53b3eaa8fc6214595bb6b3efad7ebaa16 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 17:22:15 +0200 Subject: [PATCH 108/222] rename `array` to `items` --- CHANGELOG.md | 5 +++-- docs/modules/Decoder.ts.md | 6 +++--- docs/modules/Kleisli.ts.md | 26 +++++++++++++------------- docs/modules/TaskDecoder.ts.md | 6 +++--- src/Decoder.ts | 6 +++--- src/Kleisli.ts | 2 +- src/TaskDecoder.ts | 6 +++--- 7 files changed, 29 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 652439dbd..0e0f4d5cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,12 +30,13 @@ - add `id` (@gcanti) - drop `type` in favour of `props` (@gcanti) - drop `partial` in favour of `partialProps` (@gcanti) + - rename `array` to `items` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - drop `type` in favour of `props` (@gcanti) - drop `partial` in favour of `partialProps` (@gcanti) - - rename `array` to `karray` + - rename `array` to `items` - rename `record` to `krecord` - rename `tuple` to `ktuple` - rename `sum` to `ksum` @@ -49,7 +50,7 @@ - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - drop `type` in favour of `props` (@gcanti) - drop `partial` in favour of `partialProps` (@gcanti) - - rename `array` to `karray` + - rename `array` to `items` - rename `record` to `krecord` - rename `tuple` to `ktuple` - rename `sum` to `ksum` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index c2de711aa..ef8416a8d 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -35,7 +35,7 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) - [intersect](#intersect) - - [karray](#karray) + - [items](#items) - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) @@ -195,12 +195,12 @@ export declare const intersect: ( Added in v2.2.7 -## karray +## items **Signature** ```ts -export declare const karray: (item: Decoder) => Decoder +export declare const items: (item: Decoder) => Decoder ``` Added in v2.2.7 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 02e3e3a01..b08c6a454 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -21,10 +21,10 @@ Added in v2.2.7 - [combinators](#combinators) - [alt](#alt) - - [array](#array) - [compose](#compose) - [id](#id) - [intersect](#intersect) + - [items](#items) - [lazy](#lazy) - [map](#map) - [mapLeftWithInput](#mapleftwithinput) @@ -62,18 +62,6 @@ export declare function alt( Added in v2.2.7 -## array - -**Signature** - -```ts -export declare function array( - M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> -``` - -Added in v2.2.7 - ## compose **Signature** @@ -108,6 +96,18 @@ export declare function intersect( Added in v2.2.7 +## items + +**Signature** + +```ts +export declare function items( + M: Applicative2C & Bifunctor2 +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> +``` + +Added in v2.2.7 + ## lazy **Signature** diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index a87f15086..f6eb8c1df 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -35,7 +35,7 @@ Added in v2.2.7 - [combinators](#combinators) - [array](#array) - [intersect](#intersect) - - [karray](#karray) + - [items](#items) - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) @@ -196,12 +196,12 @@ export declare const intersect: ( Added in v2.2.7 -## karray +## items **Signature** ```ts -export declare const karray: (item: TaskDecoder) => TaskDecoder +export declare const items: (item: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index b4b130b62..8833a1a37 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -264,15 +264,15 @@ export const partial = ( * @category combinators * @since 2.2.7 */ -export const karray = (item: Decoder): Decoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) +export const items = (item: Decoder): Decoder, Array> => + K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.8 */ export const array = (item: Decoder): Decoder> => - pipe(UnknownArray, compose(karray(item))) + pipe(UnknownArray, compose(items(item))) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 2aaff63b4..d1aa47e0a 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -200,7 +200,7 @@ export function partialProps( * @category combinators * @since 2.2.7 */ -export function array( +export function items( M: Applicative2C & Bifunctor2 ): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> { const traverse = traverseArrayWithIndex(M) diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index d4399f8ae..0e553b92a 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -267,15 +267,15 @@ export const partial = ( * @category combinators * @since 2.2.7 */ -export const karray = (item: TaskDecoder): TaskDecoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) +export const items = (item: TaskDecoder): TaskDecoder, Array> => + K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.7 */ export const array = (item: TaskDecoder): TaskDecoder> => - pipe(UnknownArray, compose(karray(item))) + pipe(UnknownArray, compose(items(item))) /** * @category combinators From 7acb18db274ade3973802795f4a5828e1a9cabaf Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 17:24:37 +0200 Subject: [PATCH 109/222] rename `record` to `values` --- CHANGELOG.md | 5 +++-- docs/modules/Decoder.ts.md | 22 +++++++++++----------- docs/modules/Kleisli.ts.md | 30 +++++++++++++++--------------- docs/modules/TaskDecoder.ts.md | 22 +++++++++++----------- src/Decoder.ts | 6 +++--- src/Kleisli.ts | 2 +- src/TaskDecoder.ts | 6 +++--- 7 files changed, 47 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0f4d5cb..57240ec6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,13 +31,14 @@ - drop `type` in favour of `props` (@gcanti) - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `items` (@gcanti) + - rename `record` to `values` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - drop `type` in favour of `props` (@gcanti) - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `items` - - rename `record` to `krecord` + - rename `record` to `values` - rename `tuple` to `ktuple` - rename `sum` to `ksum` - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) @@ -51,7 +52,7 @@ - drop `type` in favour of `props` (@gcanti) - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `items` - - rename `record` to `krecord` + - rename `record` to `values` - rename `tuple` to `ktuple` - rename `sum` to `ksum` - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index ef8416a8d..170f617fc 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -36,7 +36,6 @@ Added in v2.2.7 - [array](#array) - [intersect](#intersect) - [items](#items) - - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) - [lazy](#lazy) @@ -52,6 +51,7 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) + - [values](#values) - [constructors](#constructors) - [fromGuard](#fromguard) - [fromRefinement](#fromrefinement) @@ -205,16 +205,6 @@ export declare const items: (item: Decoder) => Decoder Added in v2.2.7 -## krecord - -**Signature** - -```ts -export declare const krecord: (codomain: Decoder) => Decoder, Record> -``` - -Added in v2.2.7 - ## ksum **Signature** @@ -392,6 +382,16 @@ export declare const union: , ...Decoder< Added in v2.2.7 +## values + +**Signature** + +```ts +export declare const values: (codomain: Decoder) => Decoder, Record> +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index b08c6a454..b7b53c284 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -32,11 +32,11 @@ Added in v2.2.7 - [parse](#parse) - [partialProps](#partialprops) - [props](#props) - - [record](#record) - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [union](#union) + - [values](#values) - [constructors](#constructors) - [fromRefinement](#fromrefinement) - [literal](#literal) @@ -200,20 +200,6 @@ export declare function props( Added in v2.2.8 -## record - -**Signature** - -```ts -export declare function record( - M: Applicative2C & Bifunctor2 -): ( - onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> -``` - -Added in v2.2.7 - ## refine **Signature** @@ -279,6 +265,20 @@ export declare function union( Added in v2.2.7 +## values + +**Signature** + +```ts +export declare function values( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> +``` + +Added in v2.2.7 + # constructors ## fromRefinement diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index f6eb8c1df..d74e8984d 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -36,7 +36,6 @@ Added in v2.2.7 - [array](#array) - [intersect](#intersect) - [items](#items) - - [krecord](#krecord) - [ksum](#ksum) - [ktuple](#ktuple) - [lazy](#lazy) @@ -52,6 +51,7 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) + - [values](#values) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [fromGuard](#fromguard) @@ -206,16 +206,6 @@ export declare const items: (item: TaskDecoder) => TaskDecoder(codomain: TaskDecoder) => TaskDecoder, Record> -``` - -Added in v2.2.7 - ## ksum **Signature** @@ -393,6 +383,16 @@ export declare const union: , ...Task Added in v2.2.7 +## values + +**Signature** + +```ts +export declare const values: (codomain: TaskDecoder) => TaskDecoder, Record> +``` + +Added in v2.2.7 + # constructors ## fromDecoder diff --git a/src/Decoder.ts b/src/Decoder.ts index 8833a1a37..08b6717a3 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -278,15 +278,15 @@ export const array = (item: Decoder): Decoder> * @category combinators * @since 2.2.7 */ -export const krecord = (codomain: Decoder): Decoder, Record> => - K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +export const values = (codomain: Decoder): Decoder, Record> => + K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.8 */ export const record = (codomain: Decoder): Decoder> => - pipe(UnknownRecord, compose(krecord(codomain))) + pipe(UnknownRecord, compose(values(codomain))) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index d1aa47e0a..d372ce2be 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -213,7 +213,7 @@ export function items( * @category combinators * @since 2.2.7 */ -export function record( +export function values( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 0e553b92a..9d59339dd 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -281,15 +281,15 @@ export const array = (item: TaskDecoder): TaskDecoder(codomain: TaskDecoder): TaskDecoder, Record> => - K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +export const values = (codomain: TaskDecoder): TaskDecoder, Record> => + K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.8 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - pipe(UnknownRecord, compose(krecord(codomain))) + pipe(UnknownRecord, compose(values(codomain))) /** * @category combinators From 0eb0207edcb7678ffdd5009e4ef40aa9189fe0d7 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 17:41:29 +0200 Subject: [PATCH 110/222] drop `tuple` in favour of `components` --- CHANGELOG.md | 5 +++-- docs/modules/Decoder.ts.md | 28 ++++++++++++++-------------- docs/modules/Kleisli.ts.md | 34 +++++++++++++++++----------------- docs/modules/TaskDecoder.ts.md | 28 ++++++++++++++-------------- dtslint/ts3.5/Decoder.ts | 7 ------- dtslint/ts3.5/TaskDecoder.ts | 7 ------- src/Decoder.ts | 15 ++++++++------- src/Kleisli.ts | 24 ++++++++++++++---------- src/TaskDecoder.ts | 15 ++++++++------- 9 files changed, 78 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57240ec6d..e08563796 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `items` (@gcanti) - rename `record` to `values` (@gcanti) + - drop `tuple` in favour of `components` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) @@ -39,7 +40,7 @@ - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `items` - rename `record` to `values` - - rename `tuple` to `ktuple` + - rename `tuple` to `components` - rename `sum` to `ksum` - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) @@ -53,7 +54,7 @@ - drop `partial` in favour of `partialProps` (@gcanti) - rename `array` to `items` - rename `record` to `values` - - rename `tuple` to `ktuple` + - rename `tuple` to `components` - rename `sum` to `ksum` - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 170f617fc..bb02e9e73 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -34,10 +34,10 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) + - [components](#components) - [intersect](#intersect) - [items](#items) - [ksum](#ksum) - - [ktuple](#ktuple) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -183,6 +183,18 @@ export declare const array: (item: Decoder) => Decoder( + ...list: { [K in keyof A]: Decoder } +) => (decoder: Decoder) => Decoder +``` + +Added in v2.2.8 + ## intersect **Signature** @@ -219,18 +231,6 @@ export declare const ksum: ( Added in v2.2.7 -## ktuple - -**Signature** - -```ts -export declare const ktuple: []>( - ...components: C -) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> -``` - -Added in v2.2.7 - ## lazy **Signature** @@ -352,7 +352,7 @@ Added in v2.2.8 ```ts export declare const tuple: ( - ...components: { [K in keyof A]: Decoder } + ...list: { [K in keyof A]: Decoder } ) => Decoder ``` diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index b7b53c284..f9214737c 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -21,6 +21,7 @@ Added in v2.2.7 - [combinators](#combinators) - [alt](#alt) + - [components](#components) - [compose](#compose) - [id](#id) - [intersect](#intersect) @@ -34,7 +35,6 @@ Added in v2.2.7 - [props](#props) - [refine](#refine) - [sum](#sum) - - [tuple](#tuple) - [union](#union) - [values](#values) - [constructors](#constructors) @@ -62,6 +62,22 @@ export declare function alt( Added in v2.2.7 +## components + +**Signature** + +```ts +export declare function components( + M: Monad2C & Bifunctor2 +): ( + onIndexError: (index: number, e: E) => E +) => >( + ...list: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli +``` + +Added in v2.2.7 + ## compose **Signature** @@ -233,22 +249,6 @@ export declare function sum( Added in v2.2.7 -## tuple - -**Signature** - -```ts -export declare function tuple( - M: Applicative2C & Bifunctor2 -): ( - onIndexError: (index: number, e: E) => E -) => >>( - ...components: C -) => Kleisli }, E, { [K in keyof C]: TypeOf }> -``` - -Added in v2.2.7 - ## union **Signature** diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index d74e8984d..c2d431c0b 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -34,10 +34,10 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) + - [components](#components) - [intersect](#intersect) - [items](#items) - [ksum](#ksum) - - [ktuple](#ktuple) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -184,6 +184,18 @@ export declare const array: (item: TaskDecoder) => TaskDecoder( + ...list: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.8 + ## intersect **Signature** @@ -220,18 +232,6 @@ export declare const ksum: ( Added in v2.2.7 -## ktuple - -**Signature** - -```ts -export declare const ktuple: []>( - ...components: C -) => TaskDecoder<{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> }> -``` - -Added in v2.2.7 - ## lazy **Signature** @@ -353,7 +353,7 @@ Added in v2.2.8 ```ts export declare const tuple: ( - ...components: { [K in keyof A]: TaskDecoder } + ...list: { [K in keyof A]: TaskDecoder } ) => TaskDecoder ``` diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index ba8d48818..8e5e435c8 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -20,13 +20,6 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf -// -// ktuple -// - -// $ExpectType Decoder<[string], [number]> -_.ktuple(NumberFromString) - // // sum // diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts index a3f00d74c..b016f6a6d 100644 --- a/dtslint/ts3.5/TaskDecoder.ts +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -20,13 +20,6 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf -// -// ktuple -// - -// $ExpectType TaskDecoder<[string], [number]> -_.ktuple(NumberFromString) - // // sum // diff --git a/src/Decoder.ts b/src/Decoder.ts index 08b6717a3..c7ea114aa 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -290,20 +290,21 @@ export const record = (codomain: Decoder): Decoder>>( - ...components: C -): Decoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) +export const components: >( + ...list: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder = + /*#__PURE__*/ + K.components(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any /** * @category combinators * @since 2.2.8 */ export const tuple = >( - ...components: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any + ...list: { [K in keyof A]: Decoder } +): Decoder => pipe(UnknownArray, components(...(list as any))) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index d372ce2be..500586595 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -228,19 +228,23 @@ export function values( * @category combinators * @since 2.2.7 */ -export function tuple( - M: Applicative2C & Bifunctor2 +export function components( + M: Monad2C & Bifunctor2 ): ( onIndexError: (index: number, e: E) => E -) => >>( - ...components: C -) => Kleisli }, E, { [K in keyof C]: TypeOf }> { +) => >( + ...list: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli { const traverse = traverseArrayWithIndex(M) - return (onIndexError) => (...components) => ({ - decode: (is) => - traverse((components as unknown) as Array>, (index, decoder) => - M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) - ) as any + return (onIndexError) => (...components) => (decoder) => ({ + decode: (h) => + M.chain( + decoder.decode(h), + (is) => + traverse((components as unknown) as Array>, (index, decoder) => + M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) + ) as any + ) }) } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 9d59339dd..80229cc81 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -293,20 +293,21 @@ export const record = (codomain: TaskDecoder): TaskDecoder>>( - ...components: C -): TaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) +export const components: >( + ...list: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder = + /*#__PURE__*/ + K.components(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any /** * @category combinators * @since 2.2.8 */ export const tuple = >( - ...components: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any + ...list: { [K in keyof A]: TaskDecoder } +): TaskDecoder => pipe(UnknownArray, components(...(list as any))) /** * @category combinators From faf0419e803fb58be1e30aec15fefa32311e110e Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 18:20:53 +0200 Subject: [PATCH 111/222] drop `sum` in favour of `variants` --- CHANGELOG.md | 5 +++-- src/Decoder.ts | 32 +++++++++++--------------------- src/Guard.ts | 7 ------- src/Kleisli.ts | 35 +++++++++++++++++------------------ src/TaskDecoder.ts | 32 +++++++++++--------------------- test/Codec.ts | 2 +- test/Decoder.ts | 2 +- test/TaskDecoder.ts | 2 +- 8 files changed, 45 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e08563796..86c978e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - rename `array` to `items` (@gcanti) - rename `record` to `values` (@gcanti) - drop `tuple` in favour of `components` (@gcanti) + - drop `sum` in favour of `variants` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) @@ -41,7 +42,7 @@ - rename `array` to `items` - rename `record` to `values` - rename `tuple` to `components` - - rename `sum` to `ksum` + - rename `sum` to `variants` - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - add `draw` function (@gcanti) @@ -55,7 +56,7 @@ - rename `array` to `items` - rename `record` to `values` - rename `tuple` to `components` - - rename `sum` to `ksum` + - rename `sum` to `variants` - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) diff --git a/src/Decoder.ts b/src/Decoder.ts index c7ea114aa..37d683b9f 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -178,13 +178,6 @@ export const UnknownRecord: Decoder> = /*#__PURE__*/ fromGuard(G.UnknownRecord, 'Record') -/** - * @internal - */ -export const object: Decoder = - /*#__PURE__*/ - fromGuard(G.object, 'object') - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -326,20 +319,17 @@ export const intersect: (right: Decoder) => (left: Decoder< /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const ksum = (tag: T) => >>( - members: MS -): Decoder, TypeOf> => - K.sum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) - ) - ) - )(tag)(members) +export const variants: ( + tag: T +) => ( + members: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder = K.variants(M)((tag, value, keys) => + FS.of( + DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) + ) +) /** * @category combinators @@ -347,7 +337,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: Decoder } -): Decoder => pipe(object as any, compose(ksum(tag)(members))) +): Decoder => pipe(UnknownRecord, variants(tag)(members)) /** * @category combinators diff --git a/src/Guard.ts b/src/Guard.ts index 91afd015f..3a81418f8 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -90,13 +90,6 @@ export const UnknownRecord: Guard> = { is: (u: unknown): u is Record => Object.prototype.toString.call(u) === '[object Object]' } -/** - * @internal - */ -export const object: Guard = { - is: (u: unknown): u is object => u != null && !string.is(u) && !number.is(u) && !boolean.is(u) -} - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 500586595..03f500f14 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -220,7 +220,7 @@ export function values( ) => (codomain: Kleisli) => Kleisli, E, Record> { const traverse = traverseRecordWithIndex(M) return (onKeyError) => (codomain) => ({ - decode: (ir) => traverse(ir, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) + decode: (ri) => traverse(ri, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) }) } @@ -292,30 +292,29 @@ export function intersect( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export function sum( +export function variants( M: MonadThrow2C ): ( onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E ) => ( tag: T -) => >>( - members: MS -) => Kleisli, E, TypeOf> { - return (onTagError) => (tag) => , A>( - members: { [K in keyof A]: Kleisli } - ): Kleisli => { +) => ( + members: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli { + return (onTagError) => (tag) => (members) => { const keys = Object.keys(members) - return { - decode: (ir) => { - const v = ir[tag] - if (v in members) { - return (members as any)[v].decode(ir) - } - return M.throwError(onTagError(tag, v, keys)) - } - } + return (decoder) => ({ + decode: (h) => + M.chain(decoder.decode(h), (ri: any) => { + const v = ri[tag] + if (v in members) { + return (members as any)[v].decode(ri) + } + return M.throwError(onTagError(tag, v, keys)) + }) + }) } } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 80229cc81..62116fb70 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -179,13 +179,6 @@ export const UnknownRecord: TaskDecoder> = /*#__PURE__*/ fromDecoder(D.UnknownRecord) -/** - * @internal - */ -export const object: TaskDecoder = - /*#__PURE__*/ - fromDecoder(D.object) - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -331,20 +324,17 @@ export const intersect: ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const ksum = (tag: T) => >>( - members: MS -): TaskDecoder, TypeOf> => - K.sum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) - ) - ) - )(tag)(members) +export const variants: ( + tag: T +) => ( + members: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder = K.variants(M)((tag, value, keys) => + FS.of( + DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) + ) +) /** * @category combinators @@ -352,7 +342,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(object as any, compose(ksum(tag)(members))) +): TaskDecoder => pipe(UnknownRecord, variants(tag)(members)) /** * @category combinators diff --git a/test/Codec.ts b/test/Codec.ts index 8d508c90f..74c43b0e9 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -547,7 +547,7 @@ describe('Codec', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'object')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'Record')) assert.deepStrictEqual( codec.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/Decoder.ts b/test/Decoder.ts index 8ee000bde..0a675d6ce 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -478,7 +478,7 @@ describe('Decoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) assert.deepStrictEqual( decoder.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 4e18d5565..c2983d042 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -493,7 +493,7 @@ describe('UnknownTaskDecoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'object')) + assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'Record')) assert.deepStrictEqual( await decoder.decode({})(), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) From a2f44e6a6cba329bcf4860a6f692c2056c58ce4a Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 18:58:03 +0200 Subject: [PATCH 112/222] drop `union` in favour of `members` --- CHANGELOG.md | 8 ++-- docs/modules/Decoder.ts.md | 47 ++++++++++++++-------- docs/modules/Kleisli.ts.md | 66 +++++++++++++++---------------- docs/modules/Schema.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 47 ++++++++++++++-------- dtslint/ts3.5/Decoder.ts | 59 +++++++++++++++++++--------- dtslint/ts3.5/TaskDecoder.ts | 71 ---------------------------------- src/Decoder.ts | 18 ++++++--- src/Kleisli.ts | 31 +++++++-------- src/TaskDecoder.ts | 18 ++++++--- 10 files changed, 181 insertions(+), 186 deletions(-) delete mode 100644 dtslint/ts3.5/TaskDecoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 86c978e16..6dd8b33d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - rename `array` to `items` (@gcanti) - rename `record` to `values` (@gcanti) - drop `tuple` in favour of `components` (@gcanti) + - drop `union` in favour of `members` (@gcanti) - drop `sum` in favour of `variants` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) @@ -42,8 +43,9 @@ - rename `array` to `items` - rename `record` to `values` - rename `tuple` to `components` + - rename `union` to `members` - rename `sum` to `variants` - - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) + - add `type`, `partial`, `array`, `record`, `tuple`, `union`, `sum` combinators (@gcanti) - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - add `draw` function (@gcanti) - `KleisliTaskDecoder` @@ -56,9 +58,9 @@ - rename `array` to `items` - rename `record` to `values` - rename `tuple` to `components` + - rename `union` to `members` - rename `sum` to `variants` - - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) - - add `type`, `partial`, `array`, `record`, `tuple`, `sum` combinators (@gcanti) + - add `type`, `partial`, `array`, `record`, `tuple`, `union`, `sum` combinators (@gcanti) - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - add `draw` function (@gcanti) - `JsonCodec` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index bb02e9e73..1229408b6 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -37,9 +37,9 @@ Added in v2.2.7 - [components](#components) - [intersect](#intersect) - [items](#items) - - [ksum](#ksum) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) + - [members](#members) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) @@ -52,6 +52,7 @@ Added in v2.2.7 - [type](#type) - [union](#union) - [values](#values) + - [variants](#variants) - [constructors](#constructors) - [fromGuard](#fromguard) - [fromRefinement](#fromrefinement) @@ -217,41 +218,39 @@ export declare const items: (item: Decoder) => Decoder Added in v2.2.7 -## ksum +## lazy **Signature** ```ts -export declare const ksum: ( - tag: T -) => >>( - members: MS -) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> +export declare const lazy: (id: string, f: () => Decoder) => Decoder ``` Added in v2.2.7 -## lazy +## mapLeftWithInput **Signature** ```ts -export declare const lazy: (id: string, f: () => Decoder) => Decoder +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: Decoder) => Decoder ``` Added in v2.2.7 -## mapLeftWithInput +## members **Signature** ```ts -export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: Decoder) => Decoder +export declare const members: ( + ...list: { [K in keyof A]: Decoder } +) => (decoder: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## nullable @@ -375,9 +374,9 @@ Added in v2.2.8 **Signature** ```ts -export declare const union: , ...Decoder[]]>( - ...members: MS -) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> +export declare const union: ( + ...list: { [K in keyof A]: Decoder } +) => Decoder ``` Added in v2.2.7 @@ -392,6 +391,20 @@ export declare const values: (codomain: Decoder) => Decoder( + tag: T +) => ( + members: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder +``` + +Added in v2.2.8 + # constructors ## fromGuard diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index f9214737c..e0009587a 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -29,14 +29,14 @@ Added in v2.2.7 - [lazy](#lazy) - [map](#map) - [mapLeftWithInput](#mapleftwithinput) + - [members](#members) - [nullable](#nullable) - [parse](#parse) - [partialProps](#partialprops) - [props](#props) - [refine](#refine) - - [sum](#sum) - - [union](#union) - [values](#values) + - [variants](#variants) - [constructors](#constructors) - [fromRefinement](#fromrefinement) - [literal](#literal) @@ -160,6 +160,22 @@ export declare function mapLeftWithInput( Added in v2.2.7 +## members + +**Signature** + +```ts +export declare function members( + M: Monad2C & Alt2C & Bifunctor2 +): ( + onMemberError: (index: number, e: E) => E +) => ]>( + ...members: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli) => Kleisli +``` + +Added in v2.2.8 + ## nullable **Signature** @@ -231,53 +247,37 @@ export declare function refine( Added in v2.2.7 -## sum - -**Signature** - -```ts -export declare function sum( - M: MonadThrow2C -): ( - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => ( - tag: T -) => >>( - members: MS -) => Kleisli, E, TypeOf> -``` - -Added in v2.2.7 - -## union +## values **Signature** ```ts -export declare function union( - M: Alt2C & Bifunctor2 +export declare function values( + M: Applicative2C & Bifunctor2 ): ( - onMemberError: (index: number, e: E) => E -) => , ...Array>]>( - ...members: MS -) => Kleisli, E, TypeOf> + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> ``` Added in v2.2.7 -## values +## variants **Signature** ```ts -export declare function values( - M: Applicative2C & Bifunctor2 +export declare function variants( + M: MonadThrow2C ): ( - onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +) => ( + members: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli ``` -Added in v2.2.7 +Added in v2.2.8 # constructors diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 637fe19ba..9ff666849 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -76,10 +76,10 @@ export declare const interpreter: { < S extends | 'io-ts/Codec' - | 'Either' | 'io-ts/Decoder' | 'io-ts/Encoder' | 'io-ts/TaskDecoder' + | 'Either' | 'IOEither' | 'TaskEither' >( diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index c2d431c0b..cc038336e 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -37,9 +37,9 @@ Added in v2.2.7 - [components](#components) - [intersect](#intersect) - [items](#items) - - [ksum](#ksum) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) + - [members](#members) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) @@ -52,6 +52,7 @@ Added in v2.2.7 - [type](#type) - [union](#union) - [values](#values) + - [variants](#variants) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [fromGuard](#fromguard) @@ -218,41 +219,39 @@ export declare const items: (item: TaskDecoder) => TaskDecoder( - tag: T -) => >>( - members: MS -) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> +export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder ``` Added in v2.2.7 -## lazy +## mapLeftWithInput **Signature** ```ts -export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 -## mapLeftWithInput +## members **Signature** ```ts -export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: TaskDecoder) => TaskDecoder +export declare const members: ( + ...list: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## nullable @@ -376,9 +375,9 @@ Added in v2.2.8 **Signature** ```ts -export declare const union: , ...TaskDecoder[]]>( - ...members: MS -) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> +export declare const union: ( + ...list: { [K in keyof A]: TaskDecoder } +) => TaskDecoder ``` Added in v2.2.7 @@ -393,6 +392,20 @@ export declare const values: (codomain: TaskDecoder) => TaskDecoder< Added in v2.2.7 +## variants + +**Signature** + +```ts +export declare const variants: ( + tag: T +) => ( + members: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder +``` + +Added in v2.2.8 + # constructors ## fromDecoder diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 8e5e435c8..2005ce812 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -21,37 +21,36 @@ export type TypeOfNumberFromString = _.TypeOf export type InputOfNumberFromString = _.InputOf // -// sum +// props // -// $ExpectType Decoder -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: _.string }), - B: _.type({ _tag: _.literal('B'), b: _.number }) -}) +// $ExpectType Decoder +pipe( + _.UnknownRecord, + _.props({ + a: _.string, + b: _.type({ + c: _.number + }) + }) +) // -// union +// type // -// $ExpectType Decoder -_.union(_.number, _.string) - -// $ExpectType Decoder -_.union(NumberFromString, StringFromString) - -// ------------------------------------------------------------------------------------- -// unknown input -// ------------------------------------------------------------------------------------- - // $ExpectType Decoder -const A = _.type({ +_.type({ a: _.string, b: _.type({ c: _.number }) }) +// +// partial +// + // $ExpectType Decoder; }>> _.partial({ a: _.string, @@ -60,6 +59,30 @@ _.partial({ }) }) +// +// sum +// + +// $ExpectType Decoder +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: _.string }), + B: _.type({ _tag: _.literal('B'), b: _.number }) +}) + +// +// members +// + +// $ExpectType Decoder +pipe(_.string, _.members(NumberFromString, StringFromString)) + +// +// union +// + +// $ExpectType Decoder +_.union(_.number, _.string) + // // mapLeftWithInput // diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts deleted file mode 100644 index b016f6a6d..000000000 --- a/dtslint/ts3.5/TaskDecoder.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { pipe } from 'fp-ts/lib/pipeable' -import * as DE from '../../src/DecodeError' -import * as _ from '../../src/TaskDecoder' -import * as FS from '../../src/FreeSemigroup' - -declare const StringFromString: _.TaskDecoder -declare const NumberFromString: _.TaskDecoder - -// -// TypeOf -// - -// $ExpectType number -export type TypeOfNumberFromString = _.TypeOf - -// -// InputOf -// - -// $ExpectType string -export type InputOfNumberFromString = _.InputOf - -// -// sum -// - -// $ExpectType TaskDecoder -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: _.string }), - B: _.type({ _tag: _.literal('B'), b: _.number }) -}) - -// -// union -// - -// $ExpectType TaskDecoder -_.union(_.number, _.string) - -// $ExpectType TaskDecoder -_.union(NumberFromString, StringFromString) - -// ------------------------------------------------------------------------------------- -// unknown input -// ------------------------------------------------------------------------------------- - -// $ExpectType TaskDecoder -const A = _.type({ - a: _.string, - b: _.type({ - c: _.number - }) -}) - -// $ExpectType TaskDecoder; }>> -_.partial({ - a: _.string, - b: _.partial({ - c: _.number - }) -}) - -// -// mapLeftWithInput -// - -// $ExpectType TaskDecoder -pipe( - _.number, - _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) -) diff --git a/src/Decoder.ts b/src/Decoder.ts index 37d683b9f..977eb3d10 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -301,13 +301,21 @@ export const tuple = >( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const union: , ...Array>]>( - ...members: MS -) => Decoder, TypeOf> = +export const members: ]>( + ...list: { [K in keyof A]: Decoder } +) => (decoder: Decoder) => Decoder = /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) + K.members(M)((i, e) => FS.of(DE.member(i, e))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const union = ]>( + ...list: { [K in keyof A]: Decoder } +): Decoder => pipe(id(), members(...(list as any))) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 03f500f14..31f9c2fda 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -250,25 +250,24 @@ export function components( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export function union( - M: Alt2C & Bifunctor2 +export function members( + M: Monad2C & Alt2C & Bifunctor2 ): ( onMemberError: (index: number, e: E) => E -) => , ...Array>]>( - ...members: MS -) => Kleisli, E, TypeOf> { - return (onMemberError) => , ...Array>]>( - ...members: MS - ) => ({ - decode: (i) => { - let out: Kind2> = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) - for (let index = 1; index < members.length; index++) { - out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) - } - return out - } +) => ]>( + ...members: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli) => Kleisli { + return (onMemberError) => (...members) => (decoder) => ({ + decode: (h) => + M.chain(decoder.decode(h), (i) => { + let out = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) + for (let index = 1; index < members.length; index++) { + out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) + } + return out + }) }) } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 62116fb70..6be830b58 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -304,13 +304,21 @@ export const tuple = >( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const union: , ...Array>]>( - ...members: MS -) => TaskDecoder, TypeOf> = +export const members: ]>( + ...list: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.union(M)((i, e) => FS.of(DE.member(i, e))) + K.members(M)((i, e) => FS.of(DE.member(i, e))) as any + +/** + * @category combinators + * @since 2.2.7 + */ +export const union = ]>( + ...list: { [K in keyof A]: TaskDecoder } +): TaskDecoder => pipe(id(), members(...(list as any))) /** * @category combinators From 844d9346b2412a39d748414311711f4d9a619156 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 19:05:01 +0200 Subject: [PATCH 113/222] drop `array` in favour of `items` --- CHANGELOG.md | 4 ++-- docs/modules/Decoder.ts.md | 6 +++--- docs/modules/Kleisli.ts.md | 6 ++++-- docs/modules/TaskDecoder.ts.md | 6 +++--- src/Decoder.ts | 10 +++++----- src/Kleisli.ts | 13 +++++++++---- src/TaskDecoder.ts | 11 +++++++---- 7 files changed, 33 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd8b33d4..01ff73bbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,8 +30,8 @@ - add `id` (@gcanti) - drop `type` in favour of `props` (@gcanti) - drop `partial` in favour of `partialProps` (@gcanti) - - rename `array` to `items` (@gcanti) - - rename `record` to `values` (@gcanti) + - drop `array` in favour of `items` (@gcanti) + - drop `record` in favour of `values` (@gcanti) - drop `tuple` in favour of `components` (@gcanti) - drop `union` in favour of `members` (@gcanti) - drop `sum` in favour of `variants` (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 1229408b6..eba28ec68 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -213,10 +213,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const items: (item: Decoder) => Decoder +export declare const items: (item: Decoder) => (decoder: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## lazy @@ -247,7 +247,7 @@ Added in v2.2.7 ```ts export declare const members: ( ...list: { [K in keyof A]: Decoder } -) => (decoder: Decoder) => Decoder +) => (decoder: Decoder) => Decoder ``` Added in v2.2.8 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index e0009587a..d5c479cda 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -118,8 +118,10 @@ Added in v2.2.7 ```ts export declare function items( - M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> + M: Monad2C & Bifunctor2 +): ( + onItemError: (index: number, e: E) => E +) => (item: Kleisli) => (decoder: Kleisli>) => Kleisli> ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index cc038336e..cbf29c1d1 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -214,10 +214,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const items: (item: TaskDecoder) => TaskDecoder +export declare const items: (item: TaskDecoder) => (decoder: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## lazy @@ -248,7 +248,7 @@ Added in v2.2.7 ```ts export declare const members: ( ...list: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder) => TaskDecoder +) => (decoder: TaskDecoder) => TaskDecoder ``` Added in v2.2.8 diff --git a/src/Decoder.ts b/src/Decoder.ts index 977eb3d10..084b796dc 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -255,17 +255,17 @@ export const partial = ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const items = (item: Decoder): Decoder, Array> => - K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) +export const items: (item: Decoder) => (decoder: Decoder>) => Decoder> = + /*#__PURE__*/ + K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) /** * @category combinators * @since 2.2.8 */ -export const array = (item: Decoder): Decoder> => - pipe(UnknownArray, compose(items(item))) +export const array = (item: Decoder): Decoder> => pipe(UnknownArray, items(item)) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 31f9c2fda..473815344 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -201,11 +201,16 @@ export function partialProps( * @since 2.2.7 */ export function items( - M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> { + M: Monad2C & Bifunctor2 +): ( + onItemError: (index: number, e: E) => E +) => (item: Kleisli) => (decoder: Kleisli>) => Kleisli> { const traverse = traverseArrayWithIndex(M) - return (onItemError) => (item) => ({ - decode: (is) => traverse(is, (index, i) => M.mapLeft(item.decode(i), (e) => onItemError(index, e))) + return (onItemError) => (item) => (decoder) => ({ + decode: (h) => + M.chain(decoder.decode(h), (is) => + traverse(is, (index, i) => M.mapLeft(item.decode(i), (e) => onItemError(index, e))) + ) }) } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 6be830b58..747794967 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -258,17 +258,20 @@ export const partial = ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const items = (item: TaskDecoder): TaskDecoder, Array> => - K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) +export const items: ( + item: TaskDecoder +) => (decoder: TaskDecoder>) => TaskDecoder> = + /*#__PURE__*/ + K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) /** * @category combinators * @since 2.2.7 */ export const array = (item: TaskDecoder): TaskDecoder> => - pipe(UnknownArray, compose(items(item))) + pipe(UnknownArray, items(item)) /** * @category combinators From 13b937a4cc9222cbd755bb5cfacd2c750d248003 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 19:08:32 +0200 Subject: [PATCH 114/222] drop `record` in favour of `values` --- docs/modules/Decoder.ts.md | 6 ++++-- docs/modules/Kleisli.ts.md | 6 ++++-- docs/modules/TaskDecoder.ts.md | 6 ++++-- src/Decoder.ts | 11 +++++++---- src/Kleisli.ts | 13 +++++++++---- src/TaskDecoder.ts | 11 +++++++---- 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index eba28ec68..0197b4d77 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -386,10 +386,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const values: (codomain: Decoder) => Decoder, Record> +export declare const values: ( + codomain: Decoder +) => (decoder: Decoder>) => Decoder> ``` -Added in v2.2.7 +Added in v2.2.8 ## variants diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index d5c479cda..697f3437d 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -255,10 +255,12 @@ Added in v2.2.7 ```ts export declare function values( - M: Applicative2C & Bifunctor2 + M: Monad2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> +) => ( + codomain: Kleisli +) => (decoder: Kleisli>) => Kleisli> ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index cbf29c1d1..a0fea1d2b 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -387,10 +387,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const values: (codomain: TaskDecoder) => TaskDecoder, Record> +export declare const values: ( + codomain: TaskDecoder +) => (decoder: TaskDecoder>) => TaskDecoder> ``` -Added in v2.2.7 +Added in v2.2.8 ## variants diff --git a/src/Decoder.ts b/src/Decoder.ts index 084b796dc..6186a92b2 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -269,17 +269,20 @@ export const array = (item: Decoder): Decoder> /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ -export const values = (codomain: Decoder): Decoder, Record> => - K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +export const values: ( + codomain: Decoder +) => (decoder: Decoder>) => Decoder> = + /*#__PURE__*/ + K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators * @since 2.2.8 */ export const record = (codomain: Decoder): Decoder> => - pipe(UnknownRecord, compose(values(codomain))) + pipe(UnknownRecord, values(codomain)) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 473815344..550f8cb57 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -219,13 +219,18 @@ export function items( * @since 2.2.7 */ export function values( - M: Applicative2C & Bifunctor2 + M: Monad2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> { +) => ( + codomain: Kleisli +) => (decoder: Kleisli>) => Kleisli> { const traverse = traverseRecordWithIndex(M) - return (onKeyError) => (codomain) => ({ - decode: (ri) => traverse(ri, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) + return (onKeyError) => (codomain) => (decoder) => ({ + decode: (h) => + M.chain(decoder.decode(h), (ri) => + traverse(ri, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) + ) }) } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 747794967..d27bc94a5 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -275,17 +275,20 @@ export const array = (item: TaskDecoder): TaskDecoder(codomain: TaskDecoder): TaskDecoder, Record> => - K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +export const values: ( + codomain: TaskDecoder +) => (decoder: TaskDecoder>) => TaskDecoder> = + /*#__PURE__*/ + K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators * @since 2.2.8 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - pipe(UnknownRecord, compose(values(codomain))) + pipe(UnknownRecord, values(codomain)) /** * @category combinators From 381f4fa06469851a101b252110aeed7d60e6f8b6 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 19:13:54 +0200 Subject: [PATCH 115/222] renaming --- CHANGELOG.md | 42 +++---- docs/modules/Decoder.ts.md | 154 ++++++++++++------------ docs/modules/Kleisli.ts.md | 206 ++++++++++++++++----------------- docs/modules/TaskDecoder.ts.md | 156 +++++++++++++------------ dtslint/ts3.5/Decoder.ts | 4 +- src/Decoder.ts | 51 ++++---- src/Kleisli.ts | 16 +-- src/TaskDecoder.ts | 52 +++++---- 8 files changed, 343 insertions(+), 338 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01ff73bbf..55f8ca2fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,23 +28,23 @@ - rename `schemableGuard` to `Schemable` (@gcanti) - `Kleisli` - add `id` (@gcanti) - - drop `type` in favour of `props` (@gcanti) - - drop `partial` in favour of `partialProps` (@gcanti) - - drop `array` in favour of `items` (@gcanti) - - drop `record` in favour of `values` (@gcanti) - - drop `tuple` in favour of `components` (@gcanti) - - drop `union` in favour of `members` (@gcanti) - - drop `sum` in favour of `variants` (@gcanti) + - drop `type` in favour of `composeType` (@gcanti) + - drop `partial` in favour of `composePartial` (@gcanti) + - drop `array` in favour of `composeArray` (@gcanti) + - drop `record` in favour of `composeRecord` (@gcanti) + - drop `tuple` in favour of `composeTuple` (@gcanti) + - drop `union` in favour of `composeUnion` (@gcanti) + - drop `sum` in favour of `composeSum` (@gcanti) - `KleisliDecoder` - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - - drop `type` in favour of `props` (@gcanti) - - drop `partial` in favour of `partialProps` (@gcanti) - - rename `array` to `items` - - rename `record` to `values` - - rename `tuple` to `components` - - rename `union` to `members` - - rename `sum` to `variants` + - drop `type` in favour of `composeType` (@gcanti) + - drop `partial` in favour of `composePartial` (@gcanti) + - rename `array` to `composeArray` + - rename `record` to `composeRecord` + - rename `tuple` to `composeTuple` + - rename `union` to `composeUnion` + - rename `sum` to `composeSum` - add `type`, `partial`, `array`, `record`, `tuple`, `union`, `sum` combinators (@gcanti) - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - add `draw` function (@gcanti) @@ -53,13 +53,13 @@ - rename `fromKleisliDecoder` to `fromDecoder` (@gcanti) - add `fromGuard` (@gcanti) - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - - drop `type` in favour of `props` (@gcanti) - - drop `partial` in favour of `partialProps` (@gcanti) - - rename `array` to `items` - - rename `record` to `values` - - rename `tuple` to `components` - - rename `union` to `members` - - rename `sum` to `variants` + - drop `type` in favour of `composeType` (@gcanti) + - drop `partial` in favour of `composePartial` (@gcanti) + - rename `array` to `composeArray` + - rename `record` to `composeRecord` + - rename `tuple` to `composeTuple` + - rename `union` to `composeUnion` + - rename `sum` to `composeSum` - add `type`, `partial`, `array`, `record`, `tuple`, `union`, `sum` combinators (@gcanti) - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - add `draw` function (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 0197b4d77..158aa4332 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -34,25 +34,25 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) - - [components](#components) + - [composeArray](#composearray) + - [composePartial](#composepartial) + - [composeRecord](#composerecord) + - [composeSum](#composesum) + - [composeTuple](#composetuple) + - [composeType](#composetype) + - [composeUnion](#composeunion) - [intersect](#intersect) - - [items](#items) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - - [members](#members) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) - - [partialProps](#partialprops) - - [props](#props) - [record](#record) - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) - [union](#union) - - [values](#values) - - [variants](#variants) - [constructors](#constructors) - [fromGuard](#fromguard) - [fromRefinement](#fromrefinement) @@ -184,128 +184,154 @@ export declare const array: (item: Decoder) => Decoder( - ...list: { [K in keyof A]: Decoder } -) => (decoder: Decoder) => Decoder +export declare const composeArray: (item: Decoder) => (decoder: Decoder) => Decoder ``` Added in v2.2.8 -## intersect +## composePartial **Signature** ```ts -export declare const intersect: ( - right: Decoder -) => (left: Decoder) => Decoder +export declare const composePartial: ( + properties: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder> ``` -Added in v2.2.7 +Added in v2.2.8 -## items +## composeRecord **Signature** ```ts -export declare const items: (item: Decoder) => (decoder: Decoder) => Decoder +export declare const composeRecord: ( + codomain: Decoder +) => (decoder: Decoder>) => Decoder> ``` Added in v2.2.8 -## lazy +## composeSum **Signature** ```ts -export declare const lazy: (id: string, f: () => Decoder) => Decoder +export declare const composeSum: ( + tag: T +) => ( + members: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 -## mapLeftWithInput +## composeTuple **Signature** ```ts -export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: Decoder) => Decoder +export declare const composeTuple: ( + ...components: { [K in keyof A]: Decoder } +) => (decoder: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 -## members +## composeType **Signature** ```ts -export declare const members: ( - ...list: { [K in keyof A]: Decoder } +export declare const composeType: ( + properties: { [K in keyof A]: Decoder } +) => (decoder: Decoder>) => Decoder +``` + +Added in v2.2.8 + +## composeUnion + +**Signature** + +```ts +export declare const composeUnion: ( + ...members: { [K in keyof A]: Decoder } ) => (decoder: Decoder) => Decoder ``` Added in v2.2.8 -## nullable +## intersect **Signature** ```ts -export declare const nullable: (or: Decoder) => Decoder +export declare const intersect: ( + right: Decoder +) => (left: Decoder) => Decoder ``` Added in v2.2.7 -## parse +## lazy **Signature** ```ts -export declare const parse: ( - parser: (a: A) => E.Either>, B> -) => (from: Decoder) => Decoder +export declare const lazy: (id: string, f: () => Decoder) => Decoder ``` Added in v2.2.7 -## partial +## mapLeftWithInput **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: Decoder } -) => Decoder> +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 -## partialProps +## nullable **Signature** ```ts -export declare const partialProps: ( - properties: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder> +export declare const nullable: (or: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 -## props +## parse **Signature** ```ts -export declare const props: ( - properties: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder +export declare const parse: ( + parser: (a: A) => E.Either>, B> +) => (from: Decoder) => Decoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: Decoder } +) => Decoder> ``` Added in v2.2.8 @@ -351,7 +377,7 @@ Added in v2.2.8 ```ts export declare const tuple: ( - ...list: { [K in keyof A]: Decoder } + ...components: { [K in keyof A]: Decoder } ) => Decoder ``` @@ -375,38 +401,12 @@ Added in v2.2.8 ```ts export declare const union: ( - ...list: { [K in keyof A]: Decoder } + ...members: { [K in keyof A]: Decoder } ) => Decoder ``` Added in v2.2.7 -## values - -**Signature** - -```ts -export declare const values: ( - codomain: Decoder -) => (decoder: Decoder>) => Decoder> -``` - -Added in v2.2.8 - -## variants - -**Signature** - -```ts -export declare const variants: ( - tag: T -) => ( - members: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder -``` - -Added in v2.2.8 - # constructors ## fromGuard diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 697f3437d..22d2656e3 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -21,22 +21,22 @@ Added in v2.2.7 - [combinators](#combinators) - [alt](#alt) - - [components](#components) - [compose](#compose) + - [composeArray](#composearray) + - [composePartial](#composepartial) + - [composeRecord](#composerecord) + - [composeSum](#composesum) + - [composeTuple](#composetuple) + - [composeType](#composetype) + - [composeUnion](#composeunion) - [id](#id) - [intersect](#intersect) - - [items](#items) - [lazy](#lazy) - [map](#map) - [mapLeftWithInput](#mapleftwithinput) - - [members](#members) - [nullable](#nullable) - [parse](#parse) - - [partialProps](#partialprops) - - [props](#props) - [refine](#refine) - - [values](#values) - - [variants](#variants) - [constructors](#constructors) - [fromRefinement](#fromrefinement) - [literal](#literal) @@ -62,22 +62,6 @@ export declare function alt( Added in v2.2.7 -## components - -**Signature** - -```ts -export declare function components( - M: Monad2C & Bifunctor2 -): ( - onIndexError: (index: number, e: E) => E -) => >( - ...list: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli -``` - -Added in v2.2.7 - ## compose **Signature** @@ -90,84 +74,108 @@ export declare function compose( Added in v2.2.7 -## id +## composeArray **Signature** ```ts -export declare function id(M: Applicative2C): () => Kleisli +export declare function composeArray( + M: Monad2C & Bifunctor2 +): ( + onItemError: (index: number, e: E) => E +) => (item: Kleisli) => (decoder: Kleisli>) => Kleisli> ``` -Added in v2.2.8 +Added in v2.2.7 -## intersect +## composePartial **Signature** ```ts -export declare function intersect( - M: Apply2C -): (right: Kleisli) => (left: Kleisli) => Kleisli +export declare function composePartial( + M: Monad2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) => ( + properties: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli> ``` -Added in v2.2.7 +Added in v2.2.8 -## items +## composeRecord **Signature** ```ts -export declare function items( +export declare function composeRecord( M: Monad2C & Bifunctor2 ): ( - onItemError: (index: number, e: E) => E -) => (item: Kleisli) => (decoder: Kleisli>) => Kleisli> + onKeyError: (key: string, e: E) => E +) => ( + codomain: Kleisli +) => (decoder: Kleisli>) => Kleisli> ``` Added in v2.2.7 -## lazy +## composeSum **Signature** ```ts -export declare function lazy( - M: Bifunctor2 -): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +export declare function composeSum( + M: MonadThrow2C +): ( + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +) => ( + members: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli ``` -Added in v2.2.7 +Added in v2.2.8 -## map +## composeTuple **Signature** ```ts -export declare function map( - F: Functor2C -): (f: (a: A) => B) => (ia: Kleisli) => Kleisli +export declare function composeTuple( + M: Monad2C & Bifunctor2 +): ( + onIndexError: (index: number, e: E) => E +) => >( + ...components: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli ``` Added in v2.2.7 -## mapLeftWithInput +## composeType **Signature** ```ts -export declare function mapLeftWithInput( - M: Bifunctor2 -): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +export declare function composeType( + M: Monad2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) => ( + properties: { [K in keyof A]: Kleisli } +) => (decoder: Kleisli>) => Kleisli ``` -Added in v2.2.7 +Added in v2.2.8 -## members +## composeUnion **Signature** ```ts -export declare function members( +export declare function composeUnion( M: Monad2C & Alt2C & Bifunctor2 ): ( onMemberError: (index: number, e: E) => E @@ -178,110 +186,102 @@ export declare function members( Added in v2.2.8 -## nullable +## id **Signature** ```ts -export declare function nullable( - M: Applicative2C & Bifunctor2 -): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +export declare function id(M: Applicative2C): () => Kleisli +``` + +Added in v2.2.8 + +## intersect + +**Signature** + +```ts +export declare function intersect( + M: Apply2C +): (right: Kleisli) => (left: Kleisli) => Kleisli ``` Added in v2.2.7 -## parse +## lazy **Signature** ```ts -export declare function parse( - M: Monad2C -): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli +export declare function lazy( + M: Bifunctor2 +): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli ``` Added in v2.2.7 -## partialProps +## map **Signature** ```ts -export declare function partialProps( - M: Monad2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli> +export declare function map( + F: Functor2C +): (f: (a: A) => B) => (ia: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## props +## mapLeftWithInput **Signature** ```ts -export declare function props( - M: Monad2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli +export declare function mapLeftWithInput( + M: Bifunctor2 +): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## refine +## nullable **Signature** ```ts -export declare function refine( - M: MonadThrow2C & Bifunctor2 -): ( - refinement: (a: A) => a is B, - onError: (a: A) => E -) => (from: Kleisli) => Kleisli +export declare function nullable( + M: Applicative2C & Bifunctor2 +): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli ``` Added in v2.2.7 -## values +## parse **Signature** ```ts -export declare function values( - M: Monad2C & Bifunctor2 -): ( - onKeyError: (key: string, e: E) => E -) => ( - codomain: Kleisli -) => (decoder: Kleisli>) => Kleisli> +export declare function parse( + M: Monad2C +): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli ``` Added in v2.2.7 -## variants +## refine **Signature** ```ts -export declare function variants( - M: MonadThrow2C -): ( - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => ( - tag: T -) => ( - members: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli +export declare function refine( + M: MonadThrow2C & Bifunctor2 +): ( + refinement: (a: A) => a is B, + onError: (a: A) => E +) => (from: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 # constructors diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index a0fea1d2b..9d05f0943 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -34,25 +34,25 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) - - [components](#components) + - [composeArray](#composearray) + - [composePartial](#composepartial) + - [composeRecord](#composerecord) + - [composeSum](#composesum) + - [composeTuple](#composetuple) + - [composeType](#composetype) + - [composeUnion](#composeunion) - [intersect](#intersect) - - [items](#items) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - - [members](#members) - [nullable](#nullable) - [parse](#parse) - [partial](#partial) - - [partialProps](#partialprops) - - [props](#props) - [record](#record) - [refine](#refine) - [sum](#sum) - [tuple](#tuple) - [type](#type) - [union](#union) - - [values](#values) - - [variants](#variants) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [fromGuard](#fromguard) @@ -185,128 +185,156 @@ export declare const array: (item: TaskDecoder) => TaskDecoder( - ...list: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder) => TaskDecoder +export declare const composeArray: ( + item: TaskDecoder +) => (decoder: TaskDecoder) => TaskDecoder ``` Added in v2.2.8 -## intersect +## composePartial **Signature** ```ts -export declare const intersect: ( - right: TaskDecoder -) => (left: TaskDecoder) => TaskDecoder +export declare const composePartial: ( + properties: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder> ``` -Added in v2.2.7 +Added in v2.2.8 -## items +## composeRecord **Signature** ```ts -export declare const items: (item: TaskDecoder) => (decoder: TaskDecoder) => TaskDecoder +export declare const composeRecord: ( + codomain: TaskDecoder +) => (decoder: TaskDecoder>) => TaskDecoder> ``` Added in v2.2.8 -## lazy +## composeSum **Signature** ```ts -export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder +export declare const composeSum: ( + tag: T +) => ( + members: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 -## mapLeftWithInput +## composeTuple **Signature** ```ts -export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: TaskDecoder) => TaskDecoder +export declare const composeTuple: ( + ...components: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 -## members +## composeType **Signature** ```ts -export declare const members: ( - ...list: { [K in keyof A]: TaskDecoder } +export declare const composeType: ( + properties: { [K in keyof A]: TaskDecoder } +) => (decoder: TaskDecoder>) => TaskDecoder +``` + +Added in v2.2.8 + +## composeUnion + +**Signature** + +```ts +export declare const composeUnion: ( + ...members: { [K in keyof A]: TaskDecoder } ) => (decoder: TaskDecoder) => TaskDecoder ``` Added in v2.2.8 -## nullable +## intersect **Signature** ```ts -export declare const nullable: (or: TaskDecoder) => TaskDecoder +export declare const intersect: ( + right: TaskDecoder +) => (left: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 -## parse +## lazy **Signature** ```ts -export declare const parse: ( - parser: (a: A) => TE.TaskEither>, B> -) => (from: TaskDecoder) => TaskDecoder +export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder ``` Added in v2.2.7 -## partial +## mapLeftWithInput **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder> +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 -## partialProps +## nullable **Signature** ```ts -export declare const partialProps: ( - properties: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder> +export declare const nullable: (or: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 -## props +## parse **Signature** ```ts -export declare const props: ( - properties: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder +export declare const parse: ( + parser: (a: A) => TE.TaskEither>, B> +) => (from: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + +## partial + +**Signature** + +```ts +export declare const partial: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder> ``` Added in v2.2.8 @@ -352,7 +380,7 @@ Added in v2.2.8 ```ts export declare const tuple: ( - ...list: { [K in keyof A]: TaskDecoder } + ...components: { [K in keyof A]: TaskDecoder } ) => TaskDecoder ``` @@ -376,38 +404,12 @@ Added in v2.2.8 ```ts export declare const union: ( - ...list: { [K in keyof A]: TaskDecoder } + ...members: { [K in keyof A]: TaskDecoder } ) => TaskDecoder ``` Added in v2.2.7 -## values - -**Signature** - -```ts -export declare const values: ( - codomain: TaskDecoder -) => (decoder: TaskDecoder>) => TaskDecoder> -``` - -Added in v2.2.8 - -## variants - -**Signature** - -```ts -export declare const variants: ( - tag: T -) => ( - members: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder -``` - -Added in v2.2.8 - # constructors ## fromDecoder diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 2005ce812..1b90ddd71 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -27,7 +27,7 @@ export type InputOfNumberFromString = _.InputOf // $ExpectType Decoder pipe( _.UnknownRecord, - _.props({ + _.composeType({ a: _.string, b: _.type({ c: _.number @@ -74,7 +74,7 @@ _.sum('_tag')({ // // $ExpectType Decoder -pipe(_.string, _.members(NumberFromString, StringFromString)) +pipe(_.string, _.composeUnion(NumberFromString, StringFromString)) // // union diff --git a/src/Decoder.ts b/src/Decoder.ts index 6186a92b2..26c77d969 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -221,11 +221,11 @@ export const nullable: (or: Decoder) => Decoder * @category combinators * @since 2.2.8 */ -export const props: ( +export const composeType: ( properties: { [K in keyof A]: Decoder } ) => (decoder: Decoder>) => Decoder = /*#__PURE__*/ - K.props(M)((k, e) => FS.of(DE.key(k, DE.required, e))) + K.composeType(M)((k, e) => FS.of(DE.key(k, DE.required, e))) /** * @category combinators @@ -233,17 +233,17 @@ export const props: ( */ export const type = ( properties: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord, props(properties)) +): Decoder => pipe(UnknownRecord, composeType(properties)) /** * @category combinators * @since 2.2.8 */ -export const partialProps: ( +export const composePartial: ( properties: { [K in keyof A]: Decoder } ) => (decoder: Decoder>) => Decoder> = /*#__PURE__*/ - K.partialProps(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) + K.composePartial(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators @@ -251,74 +251,75 @@ export const partialProps: ( */ export const partial = ( properties: { [K in keyof A]: Decoder } -): Decoder> => pipe(UnknownRecord, partialProps(properties)) +): Decoder> => pipe(UnknownRecord, composePartial(properties)) /** * @category combinators * @since 2.2.8 */ -export const items: (item: Decoder) => (decoder: Decoder>) => Decoder> = +export const composeArray: (item: Decoder) => (decoder: Decoder>) => Decoder> = /*#__PURE__*/ - K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) + K.composeArray(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) /** * @category combinators * @since 2.2.8 */ -export const array = (item: Decoder): Decoder> => pipe(UnknownArray, items(item)) +export const array = (item: Decoder): Decoder> => + pipe(UnknownArray, composeArray(item)) /** * @category combinators * @since 2.2.8 */ -export const values: ( +export const composeRecord: ( codomain: Decoder ) => (decoder: Decoder>) => Decoder> = /*#__PURE__*/ - K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) + K.composeRecord(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators * @since 2.2.8 */ export const record = (codomain: Decoder): Decoder> => - pipe(UnknownRecord, values(codomain)) + pipe(UnknownRecord, composeRecord(codomain)) /** * @category combinators * @since 2.2.8 */ -export const components: >( - ...list: { [K in keyof A]: Decoder } +export const composeTuple: >( + ...components: { [K in keyof A]: Decoder } ) => (decoder: Decoder>) => Decoder = /*#__PURE__*/ - K.components(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any + K.composeTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any /** * @category combinators * @since 2.2.8 */ export const tuple = >( - ...list: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownArray, components(...(list as any))) + ...components: { [K in keyof A]: Decoder } +): Decoder => pipe(UnknownArray, composeTuple(...(components as any))) /** * @category combinators * @since 2.2.8 */ -export const members: ]>( - ...list: { [K in keyof A]: Decoder } +export const composeUnion: ]>( + ...members: { [K in keyof A]: Decoder } ) => (decoder: Decoder) => Decoder = /*#__PURE__*/ - K.members(M)((i, e) => FS.of(DE.member(i, e))) as any + K.composeUnion(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators * @since 2.2.7 */ export const union = ]>( - ...list: { [K in keyof A]: Decoder } -): Decoder => pipe(id(), members(...(list as any))) + ...members: { [K in keyof A]: Decoder } +): Decoder => pipe(id(), composeUnion(...(members as any))) /** * @category combinators @@ -332,11 +333,11 @@ export const intersect: (right: Decoder) => (left: Decoder< * @category combinators * @since 2.2.8 */ -export const variants: ( +export const composeSum: ( tag: T ) => ( members: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder = K.variants(M)((tag, value, keys) => +) => (decoder: Decoder>) => Decoder = K.composeSum(M)((tag, value, keys) => FS.of( DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) ) @@ -348,7 +349,7 @@ export const variants: ( */ export const sum = (tag: T) => ( members: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord, variants(tag)(members)) +): Decoder => pipe(UnknownRecord, composeSum(tag)(members)) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 550f8cb57..303f96eec 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -135,7 +135,7 @@ export type InputOf = KD extends Kleisli( +export function composeType( M: Monad2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E @@ -159,7 +159,7 @@ export function props( * @category combinators * @since 2.2.8 */ -export function partialProps( +export function composePartial( M: Monad2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E @@ -200,7 +200,7 @@ export function partialProps( * @category combinators * @since 2.2.7 */ -export function items( +export function composeArray( M: Monad2C & Bifunctor2 ): ( onItemError: (index: number, e: E) => E @@ -218,7 +218,7 @@ export function items( * @category combinators * @since 2.2.7 */ -export function values( +export function composeRecord( M: Monad2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E @@ -238,12 +238,12 @@ export function values( * @category combinators * @since 2.2.7 */ -export function components( +export function composeTuple( M: Monad2C & Bifunctor2 ): ( onIndexError: (index: number, e: E) => E ) => >( - ...list: { [K in keyof A]: Kleisli } + ...components: { [K in keyof A]: Kleisli } ) => (decoder: Kleisli>) => Kleisli { const traverse = traverseArrayWithIndex(M) return (onIndexError) => (...components) => (decoder) => ({ @@ -262,7 +262,7 @@ export function components( * @category combinators * @since 2.2.8 */ -export function members( +export function composeUnion( M: Monad2C & Alt2C & Bifunctor2 ): ( onMemberError: (index: number, e: E) => E @@ -303,7 +303,7 @@ export function intersect( * @category combinators * @since 2.2.8 */ -export function variants( +export function composeSum( M: MonadThrow2C ): ( onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index d27bc94a5..4bb179917 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -224,11 +224,11 @@ export const nullable: (or: TaskDecoder) => TaskDecoder( +export const composeType: ( properties: { [K in keyof A]: TaskDecoder } ) => (decoder: TaskDecoder>) => TaskDecoder = /*#__PURE__*/ - K.props(M)((k, e) => FS.of(DE.key(k, DE.required, e))) + K.composeType(M)((k, e) => FS.of(DE.key(k, DE.required, e))) /** * @category combinators @@ -236,17 +236,17 @@ export const props: ( */ export const type = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord, props(properties)) +): TaskDecoder => pipe(UnknownRecord, composeType(properties)) /** * @category combinators * @since 2.2.8 */ -export const partialProps: ( +export const composePartial: ( properties: { [K in keyof A]: TaskDecoder } ) => (decoder: TaskDecoder>) => TaskDecoder> = /*#__PURE__*/ - K.partialProps(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) + K.composePartial(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators @@ -254,77 +254,77 @@ export const partialProps: ( */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(UnknownRecord, partialProps(properties)) +): TaskDecoder> => pipe(UnknownRecord, composePartial(properties)) /** * @category combinators * @since 2.2.8 */ -export const items: ( +export const composeArray: ( item: TaskDecoder ) => (decoder: TaskDecoder>) => TaskDecoder> = /*#__PURE__*/ - K.items(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) + K.composeArray(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) /** * @category combinators * @since 2.2.7 */ export const array = (item: TaskDecoder): TaskDecoder> => - pipe(UnknownArray, items(item)) + pipe(UnknownArray, composeArray(item)) /** * @category combinators * @since 2.2.8 */ -export const values: ( +export const composeRecord: ( codomain: TaskDecoder ) => (decoder: TaskDecoder>) => TaskDecoder> = /*#__PURE__*/ - K.values(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) + K.composeRecord(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) /** * @category combinators * @since 2.2.8 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - pipe(UnknownRecord, values(codomain)) + pipe(UnknownRecord, composeRecord(codomain)) /** * @category combinators * @since 2.2.8 */ -export const components: >( - ...list: { [K in keyof A]: TaskDecoder } +export const composeTuple: >( + ...components: { [K in keyof A]: TaskDecoder } ) => (decoder: TaskDecoder>) => TaskDecoder = /*#__PURE__*/ - K.components(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any + K.composeTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any /** * @category combinators * @since 2.2.8 */ export const tuple = >( - ...list: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownArray, components(...(list as any))) + ...components: { [K in keyof A]: TaskDecoder } +): TaskDecoder => pipe(UnknownArray, composeTuple(...(components as any))) /** * @category combinators * @since 2.2.8 */ -export const members: ]>( - ...list: { [K in keyof A]: TaskDecoder } +export const composeUnion: ]>( + ...members: { [K in keyof A]: TaskDecoder } ) => (decoder: TaskDecoder) => TaskDecoder = /*#__PURE__*/ - K.members(M)((i, e) => FS.of(DE.member(i, e))) as any + K.composeUnion(M)((i, e) => FS.of(DE.member(i, e))) as any /** * @category combinators * @since 2.2.7 */ export const union = ]>( - ...list: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(id(), members(...(list as any))) + ...members: { [K in keyof A]: TaskDecoder } +): TaskDecoder => pipe(id(), composeUnion(...(members as any))) /** * @category combinators @@ -340,11 +340,13 @@ export const intersect: ( * @category combinators * @since 2.2.8 */ -export const variants: ( +export const composeSum: ( tag: T ) => ( members: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder = K.variants(M)((tag, value, keys) => +) => (decoder: TaskDecoder>) => TaskDecoder = K.composeSum( + M +)((tag, value, keys) => FS.of( DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) ) @@ -356,7 +358,7 @@ export const variants: ( */ export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord, variants(tag)(members)) +): TaskDecoder => pipe(UnknownRecord, composeSum(tag)(members)) /** * @category combinators From a56ef36a157df63e8a462ef8d932303b70cecba5 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 1 Jul 2020 20:06:23 +0200 Subject: [PATCH 116/222] update since tags --- docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 52 +++++++++++++++++----------------- docs/modules/Encoder.ts.md | 4 +-- docs/modules/Eq.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/JsonCodec.ts.md | 4 +-- docs/modules/JsonEncoder.ts.md | 4 +-- docs/modules/Kleisli.ts.md | 6 ++-- docs/modules/TaskDecoder.ts.md | 46 +++++++++++++++--------------- docs/modules/Type.ts.md | 2 +- dtslint/ts3.5/Decoder.ts | 50 ++++++++++++++++++++++++++++++-- src/Codec.ts | 2 +- src/Decoder.ts | 52 +++++++++++++++++----------------- src/Encoder.ts | 4 +-- src/Eq.ts | 2 +- src/Guard.ts | 2 +- src/JsonCodec.ts | 4 +-- src/JsonEncoder.ts | 4 +-- src/Kleisli.ts | 6 ++-- src/TaskDecoder.ts | 46 +++++++++++++++--------------- src/Type.ts | 2 +- 21 files changed, 172 insertions(+), 126 deletions(-) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 38f11570d..6ce62b401 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -236,7 +236,7 @@ Added in v2.2.3 export declare const Invariant: Invariant2<'io-ts/Codec'> ``` -Added in v2.2.3 +Added in v2.2.8 ## URI diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 158aa4332..f04aaf1e2 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -13,7 +13,7 @@ Experimental features are published in order to get early feedback from the comm A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. -Added in v2.2.7 +Added in v2.2.8 --- @@ -89,7 +89,7 @@ Added in v2.2.7 export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 # Category @@ -113,7 +113,7 @@ Added in v2.2.8 export type DecodeError = FS.FreeSemigroup> ``` -Added in v2.2.7 +Added in v2.2.8 ## error @@ -123,7 +123,7 @@ Added in v2.2.7 export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> ``` -Added in v2.2.7 +Added in v2.2.8 ## failure @@ -136,7 +136,7 @@ export declare const failure: ( ) => E.Either>, A> ``` -Added in v2.2.7 +Added in v2.2.8 ## success @@ -146,7 +146,7 @@ Added in v2.2.7 export declare const success: (a: A) => E.Either>, A> ``` -Added in v2.2.7 +Added in v2.2.8 # Functor @@ -158,7 +158,7 @@ Added in v2.2.7 export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 # Semigroupoid @@ -170,7 +170,7 @@ Added in v2.2.7 export declare const compose: (to: Decoder) => (from: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 # combinators @@ -278,7 +278,7 @@ export declare const intersect: ( ) => (left: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## lazy @@ -288,7 +288,7 @@ Added in v2.2.7 export declare const lazy: (id: string, f: () => Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## mapLeftWithInput @@ -300,7 +300,7 @@ export declare const mapLeftWithInput: ( ) => (decoder: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## nullable @@ -310,7 +310,7 @@ Added in v2.2.7 export declare const nullable: (or: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## parse @@ -322,7 +322,7 @@ export declare const parse: ( ) => (from: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## partial @@ -357,7 +357,7 @@ export declare const refine: ( ) => (from: Decoder) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## sum @@ -405,7 +405,7 @@ export declare const union: ( ) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 # constructors @@ -417,7 +417,7 @@ Added in v2.2.7 export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## fromRefinement @@ -427,7 +427,7 @@ Added in v2.2.7 export declare const fromRefinement: (refinement: Refinement, expected: string) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 ## literal @@ -439,7 +439,7 @@ export declare const literal: ( ) => Decoder ``` -Added in v2.2.7 +Added in v2.2.8 # instances @@ -451,7 +451,7 @@ Added in v2.2.7 export declare const Alt: Alt2<'io-ts/Decoder'> ``` -Added in v2.2.7 +Added in v2.2.8 ## Category @@ -471,7 +471,7 @@ Added in v2.2.8 export declare const Functor: Functor2<'io-ts/Decoder'> ``` -Added in v2.2.7 +Added in v2.2.8 ## Schemable @@ -484,7 +484,7 @@ export declare const Schemable: S.Schemable2C<'io-ts/Decoder', unknown> & S.WithRefine2C<'io-ts/Decoder', unknown> ``` -Added in v2.2.7 +Added in v2.2.8 ## URI @@ -494,7 +494,7 @@ Added in v2.2.7 export declare const URI: 'io-ts/Decoder' ``` -Added in v2.2.7 +Added in v2.2.8 ## URI (type alias) @@ -504,7 +504,7 @@ Added in v2.2.7 export type URI = typeof URI ``` -Added in v2.2.7 +Added in v2.2.8 # model @@ -516,7 +516,7 @@ Added in v2.2.7 export interface Decoder extends K.Kleisli {} ``` -Added in v2.2.7 +Added in v2.2.8 # primitives @@ -580,7 +580,7 @@ Added in v2.2.8 export type InputOf = K.InputOf ``` -Added in v2.2.7 +Added in v2.2.8 ## TypeOf (type alias) @@ -590,7 +590,7 @@ Added in v2.2.7 export type TypeOf = K.TypeOf ``` -Added in v2.2.7 +Added in v2.2.8 ## draw diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index bdc1c177d..93a9479a7 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -194,7 +194,7 @@ Added in v2.2.3 export declare const Category: Category2<'io-ts/Encoder'> ``` -Added in v2.2.3 +Added in v2.2.8 ## Contravariant @@ -204,7 +204,7 @@ Added in v2.2.3 export declare const Contravariant: Contravariant2<'io-ts/Encoder'> ``` -Added in v2.2.3 +Added in v2.2.8 ## URI diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 2138c14bc..6897d7d5a 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -145,7 +145,7 @@ Added in v2.2.2 export declare const Schemable: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefine1<'Eq'> ``` -Added in v2.2.3 +Added in v2.2.8 # primitives diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 5f0962dd1..a3a71ba91 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -193,7 +193,7 @@ export declare const Schemable: Schemable1<'io-ts/Guard'> & WithRefine1<'io-ts/Guard'> ``` -Added in v2.2.3 +Added in v2.2.8 ## URI diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index 4aa1be04b..6fdf373a6 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -219,7 +219,7 @@ Added in v2.2.3 export declare const Invariant: Invariant1<'io-ts/JsonCodec'> ``` -Added in v2.2.3 +Added in v2.2.8 ## Schemable @@ -229,7 +229,7 @@ Added in v2.2.3 export declare const Schemable: Schemable1<'io-ts/JsonCodec'> & WithRefine1<'io-ts/JsonCodec'> ``` -Added in v2.2.3 +Added in v2.2.8 ## URI diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 12b5b05df..d297878e0 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -170,7 +170,7 @@ Added in v2.2.3 export declare const Contravariant: Contravariant1<'io-ts/JsonEncoder'> ``` -Added in v2.2.3 +Added in v2.2.8 ## Schemable @@ -180,7 +180,7 @@ Added in v2.2.3 export declare const Schemable: Schemable1<'io-ts/JsonEncoder'> ``` -Added in v2.2.3 +Added in v2.2.8 ## URI diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 22d2656e3..7c4f443c0 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -86,7 +86,7 @@ export declare function composeArray( ) => (item: Kleisli) => (decoder: Kleisli>) => Kleisli> ``` -Added in v2.2.7 +Added in v2.2.8 ## composePartial @@ -118,7 +118,7 @@ export declare function composeRecord( ) => (decoder: Kleisli>) => Kleisli> ``` -Added in v2.2.7 +Added in v2.2.8 ## composeSum @@ -152,7 +152,7 @@ export declare function composeTuple( ) => (decoder: Kleisli>) => Kleisli ``` -Added in v2.2.7 +Added in v2.2.8 ## composeType diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 9d05f0943..b33ed0830 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -13,7 +13,7 @@ Experimental features are published in order to get early feedback from the comm A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. -Added in v2.2.7 +Added in v2.2.8 --- @@ -90,7 +90,7 @@ Added in v2.2.7 export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 # Category @@ -114,7 +114,7 @@ Added in v2.2.8 export type DecodeError = D.DecodeError ``` -Added in v2.2.7 +Added in v2.2.8 ## error @@ -124,7 +124,7 @@ Added in v2.2.7 export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> ``` -Added in v2.2.7 +Added in v2.2.8 ## failure @@ -137,7 +137,7 @@ export declare const failure: ( ) => TE.TaskEither>, A> ``` -Added in v2.2.7 +Added in v2.2.8 ## success @@ -147,7 +147,7 @@ Added in v2.2.7 export declare const success: (a: A) => TE.TaskEither>, A> ``` -Added in v2.2.7 +Added in v2.2.8 # Functor @@ -159,7 +159,7 @@ Added in v2.2.7 export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 # Semigroupoid @@ -171,7 +171,7 @@ Added in v2.2.7 export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 # combinators @@ -183,7 +183,7 @@ Added in v2.2.7 export declare const array: (item: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## composeArray @@ -281,7 +281,7 @@ export declare const intersect: ( ) => (left: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## lazy @@ -291,7 +291,7 @@ Added in v2.2.7 export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## mapLeftWithInput @@ -303,7 +303,7 @@ export declare const mapLeftWithInput: ( ) => (decoder: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## nullable @@ -313,7 +313,7 @@ Added in v2.2.7 export declare const nullable: (or: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## parse @@ -325,7 +325,7 @@ export declare const parse: ( ) => (from: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## partial @@ -360,7 +360,7 @@ export declare const refine: ( ) => (from: TaskDecoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## sum @@ -408,7 +408,7 @@ export declare const union: ( ) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 # constructors @@ -420,7 +420,7 @@ Added in v2.2.7 export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## fromGuard @@ -430,7 +430,7 @@ Added in v2.2.7 export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## fromRefinement @@ -443,7 +443,7 @@ export declare const fromRefinement: ( ) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 ## literal @@ -455,7 +455,7 @@ export declare const literal: ( ) => TaskDecoder ``` -Added in v2.2.7 +Added in v2.2.8 # instances @@ -532,7 +532,7 @@ Added in v2.2.8 export interface TaskDecoder extends K.Kleisli {} ``` -Added in v2.2.7 +Added in v2.2.8 # primitives @@ -596,7 +596,7 @@ Added in v2.2.8 export type InputOf = K.InputOf ``` -Added in v2.2.7 +Added in v2.2.8 ## TypeOf (type alias) @@ -606,7 +606,7 @@ Added in v2.2.7 export type TypeOf = K.TypeOf ``` -Added in v2.2.7 +Added in v2.2.8 ## draw diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 75272afff..3dca4bf16 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -189,7 +189,7 @@ export declare const Schemable: Schemable1<'io-ts/Type'> & WithRefine1<'io-ts/Type'> ``` -Added in v2.2.3 +Added in v2.2.8 ## URI diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 1b90ddd71..f40941081 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -5,6 +5,7 @@ import * as FS from '../../src/FreeSemigroup' declare const StringFromString: _.Decoder declare const NumberFromString: _.Decoder +declare const ArrayFromString: _.Decoder> // // TypeOf @@ -21,7 +22,7 @@ export type TypeOfNumberFromString = _.TypeOf export type InputOfNumberFromString = _.InputOf // -// props +// composeType // // $ExpectType Decoder @@ -47,6 +48,21 @@ _.type({ }) }) +// +// composePartial +// + +// $ExpectType Decoder; }>> +pipe( + _.UnknownRecord, + _.composePartial({ + a: _.string, + b: _.partial({ + c: _.number + }) + }) +) + // // partial // @@ -59,6 +75,36 @@ _.partial({ }) }) +// +// composeArray +// + +// $ExpectType Decoder +pipe(_.UnknownArray, _.composeArray(_.string)) + +// $ExpectType Decoder +pipe(ArrayFromString, _.composeArray(NumberFromString)) + +// +// array +// + +// $ExpectType Decoder +_.array(_.string) + +// +// composeSum +// + +// $ExpectType Decoder +pipe( + _.UnknownRecord, + _.composeSum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: _.string }), + B: _.type({ _tag: _.literal('B'), b: _.number }) + }) +) + // // sum // @@ -70,7 +116,7 @@ _.sum('_tag')({ }) // -// members +// composeUnion // // $ExpectType Decoder diff --git a/src/Codec.ts b/src/Codec.ts index 4a2ec4ad7..f7eb41c18 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -263,7 +263,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Invariant: Invariant2 = { URI, diff --git a/src/Decoder.ts b/src/Decoder.ts index 26c77d969..afdf91814 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -6,7 +6,7 @@ * * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. * - * @since 2.2.7 + * @since 2.2.8 */ import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' @@ -73,7 +73,7 @@ const M: MonadThrow2C & Bifunctor2 & Alt2C extends K.Kleisli {} @@ -83,25 +83,25 @@ export interface Decoder extends K.Kleisli {} /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export type DecodeError = FS.FreeSemigroup> /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export const success: (a: A) => E.Either = E.right /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export const failure = (actual: unknown, message: string): E.Either => E.left(error(actual, message)) @@ -112,21 +112,21 @@ export const failure = (actual: unknown, message: string): E.Either(refinement: Refinement, expected: string): Decoder => K.fromRefinement(M)(refinement, (u) => error(u, expected)) /** * @category constructors - * @since 2.2.7 + * @since 2.2.8 */ export const fromGuard = (guard: G.Guard, expected: string): Decoder => fromRefinement(guard.is, expected) /** * @category constructors - * @since 2.2.7 + * @since 2.2.8 */ export const literal: ]>( ...values: A @@ -184,7 +184,7 @@ export const UnknownRecord: Decoder> = /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const mapLeftWithInput: ( f: (input: I, e: DecodeError) => DecodeError @@ -194,7 +194,7 @@ export const mapLeftWithInput: ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const refine = ( refinement: (a: A) => a is B, @@ -203,7 +203,7 @@ export const refine = ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = /*#__PURE__*/ @@ -211,7 +211,7 @@ export const parse: (parser: (a: A) => E.Either) => (fr /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const nullable: (or: Decoder) => Decoder = /*#__PURE__*/ @@ -315,7 +315,7 @@ export const composeUnion: ]>( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const union = ]>( ...members: { [K in keyof A]: Decoder } @@ -323,7 +323,7 @@ export const union = ]>( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const intersect: (right: Decoder) => (left: Decoder) => Decoder = /*#__PURE__*/ @@ -353,7 +353,7 @@ export const sum = (tag: T) => ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const lazy: (id: string, f: () => Decoder) => Decoder = /*#__PURE__*/ @@ -375,7 +375,7 @@ const compose_: Category2['compose'] = (ab, la) => pipe(la, compose(ab)) /** * @category Functor - * @since 2.2.7 + * @since 2.2.8 */ export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = /*#__PURE__*/ @@ -383,7 +383,7 @@ export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder(that: () => Decoder) => (me: Decoder) => Decoder = /*#__PURE__*/ @@ -391,7 +391,7 @@ export const alt: (that: () => Decoder) => (me: Decoder) => De /** * @category Semigroupoid - * @since 2.2.7 + * @since 2.2.8 */ export const compose: (to: Decoder) => (from: Decoder) => Decoder = /*#__PURE__*/ @@ -411,13 +411,13 @@ export const id: () => Decoder = /** * @category instances - * @since 2.2.7 + * @since 2.2.8 */ export const URI = 'io-ts/Decoder' /** * @category instances - * @since 2.2.7 + * @since 2.2.8 */ export type URI = typeof URI @@ -429,7 +429,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.7 + * @since 2.2.8 */ export const Functor: Functor2 = { URI, @@ -438,7 +438,7 @@ export const Functor: Functor2 = { /** * @category instances - * @since 2.2.7 + * @since 2.2.8 */ export const Alt: Alt2 = { URI, @@ -458,7 +458,7 @@ export const Category: Category2 = { /** * @category instances - * @since 2.2.7 + * @since 2.2.8 */ export const Schemable: S.Schemable2C & S.WithUnknownContainers2C & @@ -489,12 +489,12 @@ export const Schemable: S.Schemable2C & // ------------------------------------------------------------------------------------- /** - * @since 2.2.7 + * @since 2.2.8 */ export type TypeOf = K.TypeOf /** - * @since 2.2.7 + * @since 2.2.8 */ export type InputOf = K.InputOf diff --git a/src/Encoder.ts b/src/Encoder.ts index 1e518a634..9727f23b6 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -217,7 +217,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Contravariant: Contravariant2 = { URI, @@ -226,7 +226,7 @@ export const Contravariant: Contravariant2 = { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Category: Category2 = { URI, diff --git a/src/Eq.ts b/src/Eq.ts index f9fe3fc61..5d687f2c2 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -177,7 +177,7 @@ export function lazy(f: () => Eq): Eq { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Schemable: Schemable1 & WithUnknownContainers1 & WithRefine1 = { URI: E.URI, diff --git a/src/Guard.ts b/src/Guard.ts index 3a81418f8..b6ebeb6fd 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -251,7 +251,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 29780d28d..ac82906c5 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -194,7 +194,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Invariant: Invariant1 = { URI, @@ -203,7 +203,7 @@ export const Invariant: Invariant1 = { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Schemable: Schemable1 & WithRefine1 = { URI, diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index 5df01d960..7d736bb5b 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -168,7 +168,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Contravariant: Contravariant1 = { URI, @@ -177,7 +177,7 @@ export const Contravariant: Contravariant1 = { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Schemable: Schemable1 = { URI, diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 303f96eec..cde673f71 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -198,7 +198,7 @@ export function composePartial( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export function composeArray( M: Monad2C & Bifunctor2 @@ -216,7 +216,7 @@ export function composeArray( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export function composeRecord( M: Monad2C & Bifunctor2 @@ -236,7 +236,7 @@ export function composeRecord( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export function composeTuple( M: Monad2C & Bifunctor2 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 4bb179917..e68a43b55 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -6,7 +6,7 @@ * * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. * - * @since 2.2.7 + * @since 2.2.8 */ import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' @@ -66,7 +66,7 @@ const M: MonadThrow2C & Bifunctor2 & Alt2C extends K.Kleisli {} @@ -76,25 +76,25 @@ export interface TaskDecoder extends K.Kleisli /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export type DecodeError = D.DecodeError /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export const error: (actual: unknown, message: string) => DecodeError = D.error /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export const success: (a: A) => TE.TaskEither = TE.right /** * @category DecodeError - * @since 2.2.7 + * @since 2.2.8 */ export const failure = (actual: unknown, message: string): TE.TaskEither => TE.left(D.error(actual, message)) @@ -105,7 +105,7 @@ export const failure = (actual: unknown, message: string): TE.TaskEit /** * @category constructors - * @since 2.2.7 + * @since 2.2.8 */ export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ decode: TE.fromEitherK(decoder.decode) @@ -113,21 +113,21 @@ export const fromDecoder = (decoder: D.Decoder): TaskDecoder = /** * @category constructors - * @since 2.2.7 + * @since 2.2.8 */ export const fromRefinement = (refinement: Refinement, expected: string): TaskDecoder => fromDecoder(D.fromRefinement(refinement, expected)) /** * @category constructors - * @since 2.2.7 + * @since 2.2.8 */ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => fromRefinement(guard.is, expected) /** * @category constructors - * @since 2.2.7 + * @since 2.2.8 */ export const literal: ]>( ...values: A @@ -185,7 +185,7 @@ export const UnknownRecord: TaskDecoder> = /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const mapLeftWithInput: ( f: (input: I, e: DecodeError) => DecodeError @@ -195,7 +195,7 @@ export const mapLeftWithInput: ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const refine = ( refinement: (a: A) => a is B, @@ -204,7 +204,7 @@ export const refine = ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const parse: ( parser: (a: A) => TE.TaskEither @@ -214,7 +214,7 @@ export const parse: ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const nullable: (or: TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -268,7 +268,7 @@ export const composeArray: ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const array = (item: TaskDecoder): TaskDecoder> => pipe(UnknownArray, composeArray(item)) @@ -320,7 +320,7 @@ export const composeUnion: ]>( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const union = ]>( ...members: { [K in keyof A]: TaskDecoder } @@ -328,7 +328,7 @@ export const union = ]>( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const intersect: ( right: TaskDecoder @@ -362,7 +362,7 @@ export const sum = (tag: T) => ( /** * @category combinators - * @since 2.2.7 + * @since 2.2.8 */ export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -384,7 +384,7 @@ const compose_: Category2['compose'] = (ab, la) => pipe(la, compose(ab)) /** * @category Functor - * @since 2.2.7 + * @since 2.2.8 */ export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -392,7 +392,7 @@ export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDe /** * @category Alt - * @since 2.2.7 + * @since 2.2.8 */ export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -400,7 +400,7 @@ export const alt: (that: () => TaskDecoder) => (me: TaskDecoder(to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -498,12 +498,12 @@ export const Schemable: S.Schemable2C & // ------------------------------------------------------------------------------------- /** - * @since 2.2.7 + * @since 2.2.8 */ export type TypeOf = K.TypeOf /** - * @since 2.2.7 + * @since 2.2.8 */ export type InputOf = K.InputOf diff --git a/src/Type.ts b/src/Type.ts index f930ad827..d924f26e5 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -179,7 +179,7 @@ declare module 'fp-ts/lib/HKT' { /** * @category instances - * @since 2.2.3 + * @since 2.2.8 */ export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { URI, From 41bd78bd9402364c4809de65ce8da9bc212261de Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 2 Jul 2020 12:38:46 +0200 Subject: [PATCH 117/222] make `Guard` more general by adding a `I` type parameter --- CHANGELOG.md | 1 + docs/modules/Decoder.ts.md | 2 +- docs/modules/Guard.ts.md | 96 ++++++++++++++++++++++------- docs/modules/TaskDecoder.ts.md | 2 +- dtslint/ts3.5/Guard.ts | 14 ++++- src/Decoder.ts | 2 +- src/Guard.ts | 109 ++++++++++++++++++++++----------- src/TaskDecoder.ts | 2 +- test/Codec.ts | 2 +- test/Decoder.ts | 2 +- test/Guard.ts | 36 ++++++++++- test/TaskDecoder.ts | 2 +- 12 files changed, 200 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55f8ca2fc..8a1e1ae9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - `Eq` - rename `schemableEq` to `Schemable` (@gcanti) - `Guard` + - make `Guard` more general by adding a `I` type parameter (@gcanti) - rename `schemableGuard` to `Schemable` (@gcanti) - `Kleisli` - add `id` (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index f04aaf1e2..8f8901afc 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -414,7 +414,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder +export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder ``` Added in v2.2.8 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index a3a71ba91..b0cd9bea7 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -20,7 +20,10 @@ Added in v2.2.0

Table of contents

- [combinators](#combinators) + - [alt](#alt) - [array](#array) + - [compose](#compose) + - [id](#id) - [intersect](#intersect) - [lazy](#lazy) - [nullable](#nullable) @@ -46,28 +49,59 @@ Added in v2.2.0 - [number](#number) - [string](#string) - [utils](#utils) + - [InputOf (type alias)](#inputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) --- # combinators +## alt + +**Signature** + +```ts +export declare const alt: (that: () => Guard) => (me: Guard) => Guard +``` + +Added in v2.2.8 + ## array **Signature** ```ts -export declare const array:
(item: Guard) => Guard +export declare const array: (item: Guard) => Guard ``` Added in v2.2.0 +## compose + +**Signature** + +```ts +export declare const compose: (to: Guard) => (from: Guard) => Guard +``` + +Added in v2.2.8 + +## id + +**Signature** + +```ts +export declare const id: () => Guard +``` + +Added in v2.2.8 + ## intersect **Signature** ```ts -export declare const intersect: (right: Guard) => (left: Guard) => Guard +export declare const intersect: (right: Guard) => (left: Guard) => Guard ``` Added in v2.2.0 @@ -77,7 +111,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const lazy: (f: () => Guard) => Guard +export declare const lazy: (f: () => Guard) => Guard ``` Added in v2.2.0 @@ -87,7 +121,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const nullable: (or: Guard) => Guard +export declare const nullable: (or: Guard) => Guard ``` Added in v2.2.0 @@ -98,8 +132,8 @@ Added in v2.2.0 ```ts export declare const partial: ( - properties: { [K in keyof A]: Guard } -) => Guard> + properties: { [K in keyof A]: Guard } +) => Guard> ``` Added in v2.2.0 @@ -109,7 +143,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const record: (codomain: Guard) => Guard> +export declare const record: (codomain: Guard) => Guard> ``` Added in v2.2.0 @@ -119,7 +153,9 @@ Added in v2.2.0 **Signature** ```ts -export declare const refine: (refinement: (a: A) => a is B) => (from: Guard) => Guard +export declare const refine: ( + refinement: (a: A) => a is B +) => (from: Guard) => Guard ``` Added in v2.2.0 @@ -131,7 +167,7 @@ Added in v2.2.0 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: Guard }) => Guard +) => (members: { [K in keyof A]: Guard }) => Guard ``` Added in v2.2.0 @@ -141,7 +177,9 @@ Added in v2.2.0 **Signature** ```ts -export declare const tuple: (...components: { [K in keyof A]: Guard }) => Guard +export declare const tuple: ( + ...components: { [K in keyof A]: Guard } +) => Guard ``` Added in v2.2.0 @@ -151,7 +189,9 @@ Added in v2.2.0 **Signature** ```ts -export declare const type: (properties: { [K in keyof A]: Guard }) => Guard<{ [K in keyof A]: A[K] }> +export declare const type: ( + properties: { [K in keyof A]: Guard } +) => Guard ``` Added in v2.2.0 @@ -162,8 +202,8 @@ Added in v2.2.0 ```ts export declare const union: ( - ...members: { [K in keyof A]: Guard } -) => Guard + ...members: { [K in keyof A]: Guard } +) => Guard ``` Added in v2.2.0 @@ -175,7 +215,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const literal: (...values: A) => Guard +export declare const literal: (...values: A) => Guard ``` Added in v2.2.0 @@ -222,12 +262,12 @@ Added in v2.2.0 **Signature** ```ts -export interface Guard { - is: (u: unknown) => u is A +export interface Guard { + is: (i: I) => i is A } ``` -Added in v2.2.0 +Added in v2.2.8 # primitives @@ -236,7 +276,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const UnknownArray: Guard +export declare const UnknownArray: Guard ``` Added in v2.2.0 @@ -246,7 +286,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const UnknownRecord: Guard> +export declare const UnknownRecord: Guard> ``` Added in v2.2.0 @@ -256,7 +296,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const boolean: Guard +export declare const boolean: Guard ``` Added in v2.2.0 @@ -268,7 +308,7 @@ Note: `NaN` is excluded. **Signature** ```ts -export declare const number: Guard +export declare const number: Guard ``` Added in v2.2.0 @@ -278,19 +318,29 @@ Added in v2.2.0 **Signature** ```ts -export declare const string: Guard +export declare const string: Guard ``` Added in v2.2.0 # utils +## InputOf (type alias) + +**Signature** + +```ts +export type InputOf = G extends Guard ? I : never +``` + +Added in v2.2.8 + ## TypeOf (type alias) **Signature** ```ts -export type TypeOf = G extends Guard ? A : never +export type TypeOf = G extends Guard ? A : never ``` Added in v2.2.2 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index b33ed0830..e5016ff71 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -427,7 +427,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder +export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder ``` Added in v2.2.8 diff --git a/dtslint/ts3.5/Guard.ts b/dtslint/ts3.5/Guard.ts index ff971bf82..8ca9b88db 100644 --- a/dtslint/ts3.5/Guard.ts +++ b/dtslint/ts3.5/Guard.ts @@ -1,6 +1,10 @@ import * as _ from '../../src/Guard' -// $ExpectType Guard<{ a: string; b: { c: number; }; }> +// +// type +// + +// $ExpectType Guard const A = _.type({ a: _.string, b: _.type({ @@ -8,7 +12,11 @@ const A = _.type({ }) }) -// $ExpectType Guard; }>> +// +// partial +// + +// $ExpectType Guard; }>> _.partial({ a: _.string, b: _.partial({ @@ -21,4 +29,4 @@ _.partial({ // // $ExpectType { a: string; b: { c: number; }; } -type A = _.TypeOf +export type A = _.TypeOf diff --git a/src/Decoder.ts b/src/Decoder.ts index afdf91814..cd1292643 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -121,7 +121,7 @@ export const fromRefinement = (refinement: Refinement, exp * @category constructors * @since 2.2.8 */ -export const fromGuard = (guard: G.Guard, expected: string): Decoder => +export const fromGuard = (guard: G.Guard, expected: string): Decoder => fromRefinement(guard.is, expected) /** diff --git a/src/Guard.ts b/src/Guard.ts index b6ebeb6fd..18c157bfd 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -17,10 +17,10 @@ import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownConta /** * @category model - * @since 2.2.0 + * @since 2.2.8 */ -export interface Guard { - is: (u: unknown) => u is A +export interface Guard { + is: (i: I) => i is A } // ------------------------------------------------------------------------------------- @@ -30,7 +30,12 @@ export interface Guard { /** * @since 2.2.2 */ -export type TypeOf = G extends Guard ? A : never +export type TypeOf = G extends Guard ? A : never + +/** + * @since 2.2.8 + */ +export type InputOf = G extends Guard ? I : never // ------------------------------------------------------------------------------------- // constructors @@ -40,7 +45,7 @@ export type TypeOf = G extends Guard ? A : never * @category constructors * @since 2.2.0 */ -export const literal = ]>(...values: A): Guard => ({ +export const literal = ]>(...values: A): Guard => ({ is: (u: unknown): u is A[number] => values.findIndex((a) => a === u) !== -1 }) @@ -52,7 +57,7 @@ export const literal = ]>(...valu * @category primitives * @since 2.2.0 */ -export const string: Guard = { +export const string: Guard = { is: (u: unknown): u is string => typeof u === 'string' } @@ -62,7 +67,7 @@ export const string: Guard = { * @category primitives * @since 2.2.0 */ -export const number: Guard = { +export const number: Guard = { is: (u: unknown): u is number => typeof u === 'number' && !isNaN(u) } @@ -70,7 +75,7 @@ export const number: Guard = { * @category primitives * @since 2.2.0 */ -export const boolean: Guard = { +export const boolean: Guard = { is: (u: unknown): u is boolean => typeof u === 'boolean' } @@ -78,7 +83,7 @@ export const boolean: Guard = { * @category primitives * @since 2.2.0 */ -export const UnknownArray: Guard> = { +export const UnknownArray: Guard> = { is: Array.isArray } @@ -86,7 +91,7 @@ export const UnknownArray: Guard> = { * @category primitives * @since 2.2.0 */ -export const UnknownRecord: Guard> = { +export const UnknownRecord: Guard> = { is: (u: unknown): u is Record => Object.prototype.toString.call(u) === '[object Object]' } @@ -98,23 +103,27 @@ export const UnknownRecord: Guard> = { * @category combinators * @since 2.2.0 */ -export const refine = (refinement: (a: A) => a is B) => (from: Guard): Guard => ({ - is: (u: unknown): u is B => from.is(u) && refinement(u) +export const refine = (refinement: (a: A) => a is B) => ( + from: Guard +): Guard => ({ + is: (i: I): i is B => from.is(i) && refinement(i) }) /** * @category combinators * @since 2.2.0 */ -export const nullable = (or: Guard): Guard => ({ - is: (u): u is null | A => u === null || or.is(u) +export const nullable = (or: Guard): Guard => ({ + is: (i): i is null | A => i === null || or.is(i) }) /** * @category combinators * @since 2.2.0 */ -export const type = (properties: { [K in keyof A]: Guard }): Guard<{ [K in keyof A]: A[K] }> => +export const type = ( + properties: { [K in keyof A]: Guard } +): Guard => pipe( UnknownRecord, refine((r): r is { @@ -133,7 +142,9 @@ export const type = (properties: { [K in keyof A]: Guard }): Guard<{ [K * @category combinators * @since 2.2.0 */ -export const partial = (properties: { [K in keyof A]: Guard }): Guard> => +export const partial = ( + properties: { [K in keyof A]: Guard } +): Guard> => pipe( UnknownRecord, refine((r): r is Partial => { @@ -151,7 +162,17 @@ export const partial = (properties: { [K in keyof A]: Guard }): Guard

(codomain: Guard): Guard> => +export const array = (item: Guard): Guard> => + pipe( + UnknownArray, + refine((us): us is Array => us.every(item.is)) + ) + +/** + * @category combinators + * @since 2.2.0 + */ +export const record = (codomain: Guard): Guard> => pipe( UnknownRecord, refine((r): r is Record => { @@ -168,17 +189,9 @@ export const record = (codomain: Guard): Guard> => * @category combinators * @since 2.2.0 */ -export const array = (item: Guard): Guard> => - pipe( - UnknownArray, - refine((us): us is Array => us.every(item.is)) - ) - -/** - * @category combinators - * @since 2.2.0 - */ -export const tuple = >(...components: { [K in keyof A]: Guard }): Guard => ({ +export const tuple = >( + ...components: { [K in keyof A]: Guard } +): Guard => ({ is: (u): u is A => Array.isArray(u) && u.length === components.length && components.every((c, i) => c.is(u[i])) }) @@ -186,7 +199,7 @@ export const tuple = >(...components: { [K in k * @category combinators * @since 2.2.0 */ -export const intersect = (right: Guard) => (left: Guard): Guard => ({ +export const intersect = (right: Guard) => (left: Guard): Guard => ({ is: (u: unknown): u is A & B => left.is(u) && right.is(u) }) @@ -195,8 +208,8 @@ export const intersect = (right: Guard) => (left: Guard): Guard]>( - ...members: { [K in keyof A]: Guard } -): Guard => ({ + ...members: { [K in keyof A]: Guard } +): Guard => ({ is: (u: unknown): u is A | A[number] => members.some((m) => m.is(u)) }) @@ -204,7 +217,9 @@ export const union = ]>( * @category combinators * @since 2.2.0 */ -export const sum = (tag: T) => (members: { [K in keyof A]: Guard }): Guard => +export const sum = (tag: T) => ( + members: { [K in keyof A]: Guard } +): Guard => pipe( UnknownRecord, refine((r): r is any => { @@ -220,13 +235,37 @@ export const sum = (tag: T) => (members: { [K in keyof A]: * @category combinators * @since 2.2.0 */ -export const lazy = (f: () => Guard): Guard => { - const get = memoize>(f) +export const lazy = (f: () => Guard): Guard => { + const get = memoize>(f) return { is: (u: unknown): u is A => get().is(u) } } +/** + * @category combinators + * @since 2.2.8 + */ +export const alt = (that: () => Guard) => (me: Guard): Guard => ({ + is: (i): i is A => me.is(i) || that().is(i) +}) + +/** + * @category combinators + * @since 2.2.8 + */ +export const compose = (to: Guard) => (from: Guard): Guard => ({ + is: (i): i is B => from.is(i) && to.is(i) +}) + +/** + * @category combinators + * @since 2.2.8 + */ +export const id = (): Guard => ({ + is: (_): _ is A => true +}) + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -245,7 +284,7 @@ export type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind { - readonly [URI]: Guard + readonly [URI]: Guard } } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index e68a43b55..4fa4a2d51 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -122,7 +122,7 @@ export const fromRefinement = (refinement: Refinement, exp * @category constructors * @since 2.2.8 */ -export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => +export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => fromRefinement(guard.is, expected) /** diff --git a/test/Codec.ts b/test/Codec.ts index 74c43b0e9..6e074110a 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -36,7 +36,7 @@ const Int: C.Codec = pipe( C.refine((n): n is Int => Number.isInteger(n), 'Int') ) -const undefinedGuard: G.Guard = { +const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } const undef: C.Codec = C.fromDecoder(D.fromGuard(undefinedGuard, 'undefined')) diff --git a/test/Decoder.ts b/test/Decoder.ts index 0a675d6ce..07c277d71 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -6,7 +6,7 @@ import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' import * as _ from '../src/Decoder' -const undefinedGuard: G.Guard = { +const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } const undef: _.Decoder = _.fromGuard(undefinedGuard, 'undefined') diff --git a/test/Guard.ts b/test/Guard.ts index d18843db1..26e274608 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -2,7 +2,39 @@ import * as assert from 'assert' import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' +interface NonEmptyStringBrand { + readonly NonEmptyString: unique symbol +} + +type NonEmptyString = string & NonEmptyStringBrand + +const NonEmptyString: G.Guard = { + is: (s): s is NonEmptyString => s.length > 0 +} + describe('Guard', () => { + it('alt', () => { + const guard = pipe( + G.string, + G.alt(() => G.number) + ) + assert.strictEqual(guard.is('a'), true) + assert.strictEqual(guard.is(1), true) + assert.strictEqual(guard.is(null), false) + }) + + it('compose', () => { + const guard = pipe(G.string, G.compose(NonEmptyString)) + assert.strictEqual(guard.is('a'), true) + assert.strictEqual(guard.is(null), false) + assert.strictEqual(guard.is(''), false) + }) + + it('id', () => { + const guard = G.id() + assert.strictEqual(guard.is('a'), true) + }) + describe('number', () => { it('should exclude NaN', () => { assert.deepStrictEqual(G.number.is(NaN), false) @@ -59,7 +91,7 @@ describe('Guard', () => { }) it('should check missing fields', () => { - const undef: G.Guard = { + const undef: G.Guard = { is: (u): u is undefined => u === undefined } const guard = G.type({ a: undef }) @@ -195,7 +227,7 @@ describe('Guard', () => { b: Array } - const guard: G.Guard = G.Schemable.lazy('A', () => + const guard: G.Guard = G.Schemable.lazy('A', () => G.type({ a: G.number, b: G.array(guard) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index c2983d042..f6ecef600 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -8,7 +8,7 @@ import * as G from '../src/Guard' import * as D from '../src/Decoder' import * as _ from '../src/TaskDecoder' -const undefinedGuard: G.Guard = { +const undefinedGuard: G.Guard = { is: (u): u is undefined => u === undefined } const undef: _.TaskDecoder = _.fromGuard(undefinedGuard, 'undefined') From e1ea4965bce0d08b512d1d2c4b7e2aafa677d289 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 3 Jul 2020 06:13:04 +0200 Subject: [PATCH 118/222] update Decoder.md --- UnknownDecoder.md => Decoder.md | 31 ++++++++++++++++++++++--------- README.md | 2 +- package.json | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) rename UnknownDecoder.md => Decoder.md (91%) diff --git a/UnknownDecoder.md b/Decoder.md similarity index 91% rename from UnknownDecoder.md rename to Decoder.md index 07b29459a..a2be1e271 100644 --- a/UnknownDecoder.md +++ b/Decoder.md @@ -1,7 +1,7 @@ -- [Decoder interface](#decoder-interface) +- [Model](#model) - [Built-in primitive decoders](#built-in-primitive-decoders) - [Combinators](#combinators) - [The `literal` constructor](#the-literal-constructor) @@ -13,6 +13,7 @@ - [The `tuple` combinator](#the-tuple-combinator) - [The `intersect` combinator](#the-intersect-combinator) - [The `sum` combinator](#the-sum-combinator) + - [The `union` combinator](#the-union-combinator) - [The `lazy` combinator](#the-lazy-combinator) - [The `refine` combinator](#the-refine-combinator) - [The `parse` combinator](#the-parse-combinator) @@ -24,8 +25,8 @@ # Model ```ts -export interface UnknownDecoder { - readonly decode: (u: unknown) => E.Either +interface Decoder { + readonly decode: (i: I) => E.Either } ``` @@ -36,7 +37,7 @@ A decoder representing `string` can be defined as ```ts import * as D from 'io-ts/lib/Decoder' -export const string: D.Decoder = { +export const string: D.Decoder = { decode: (u) => (typeof u === 'string' ? D.success(u) : D.failure(u, 'string')) } ``` @@ -72,11 +73,11 @@ console.log( # Built-in primitive decoders -- `string: Decoder` -- `number: Decoder` -- `boolean: Decoder` -- `UnknownArray: Decoder>` -- `UnknownRecord: Decoder>` +- `string: Decoder` +- `number: Decoder` +- `boolean: Decoder` +- `UnknownArray: Decoder>` +- `UnknownRecord: Decoder>` # Combinators @@ -222,6 +223,18 @@ export const MySum: D.Decoder< }) ``` +## The `union` combinator + +The `union` combinator describes untagged unions + +```ts +const MyUnion = D.union(D.string, D.number) + +console.log(isRight(MyUnion.decode('a'))) // => true +console.log(isRight(MyUnion.decode(1))) // => true +console.log(isRight(MyUnion.decode(null))) // => false +``` + ## The `lazy` combinator The `lazy` combinator allows to define recursive and mutually recursive decoders diff --git a/README.md b/README.md index f4af0369c..f89fd281e 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ npm i io-ts fp-ts Experimental features (\*) are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. -- [`UnknownDecoder.ts` module](UnknownDecoder.md) +- [`Decoder.ts` module](Decoder.md) - [`Encoder.ts` module](Encoder.md) - [`Codec.ts` module](Codec.md) - [`Eq.ts` module](Eq.md) diff --git a/package.json b/package.json index 62f951559..7177a0429 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "perf": "ts-node perf/index", "dtslint": "dtslint dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", - "doctoc": "doctoc README.md index.md UnknownDecoder.md Encoder.md Codec.md Eq.md Schema.md", + "doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", "docs": "docs-ts", "import-path-rewrite": "import-path-rewrite" }, From 35a946bc1c5546d0c12dafb33fe85004f3b1603e Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 3 Jul 2020 06:36:53 +0200 Subject: [PATCH 119/222] update changelog --- CHANGELOG.md | 110 +++++++++++++++++++-------------- docs/modules/Decoder.ts.md | 60 +++++++++--------- docs/modules/TaskDecoder.ts.md | 64 +++++++++---------- src/Decoder.ts | 60 +++++++++--------- src/TaskDecoder.ts | 64 +++++++++---------- 5 files changed, 187 insertions(+), 171 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a1e1ae9e..462e98de9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,63 +17,79 @@ # 2.2.8 - **Experimental** + - (\*) remove `KleisliDecoder` module (@gcanti) + - (\*) remove `KleisliTaskDecoder` module (@gcanti) + - `Decoder` + - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) + - add `fromRefinement` function (@gcanti) + - change `fromGuard` signature (@gcanti) + - add `composeType` function (@gcanti) + - add `composePartial` function (@gcanti) + - add `composeArray` function (@gcanti) + - add `composeRecord` function (@gcanti) + - add `composeTuple` function (@gcanti) + - add `composeUnion` function (@gcanti) + - add `composeSum` function (@gcanti) + - add `compose` function (@gcanti) + - add `id` function (@gcanti) + - (\*) rename `functorDecoder` instance to `Functor` (@gcanti) + - (\*) rename `altDecoder` instance to `Alt` (@gcanti) + - (\*) rename `schemableDecoder` instance to `Schemable` (@gcanti) + - add `Category` instance (@gcanti) + - add `InputOf` type (@gcanti) + - `TaskDecoder` + - (\*) make `TaskDecoder` more general by adding a `I` type parameter (@gcanti) + - add `fromRefinement` function (@gcanti) + - change `fromDecoder` signature (@gcanti) + - add `composeType` function (@gcanti) + - add `composePartial` function (@gcanti) + - add `composeArray` function (@gcanti) + - add `composeRecord` function (@gcanti) + - add `composeTuple` function (@gcanti) + - add `composeUnion` function (@gcanti) + - add `composeSum` function (@gcanti) + - add `compose` function (@gcanti) + - add `id` function (@gcanti) + - (\*) rename `functorTaskDecoder` instance to `Functor` (@gcanti) + - (\*) rename `altTaskDecoder` instance to `Alt` (@gcanti) + - (\*) rename `schemableTaskDecoder` instance to `Schemable` (@gcanti) + - add `Category` instance (@gcanti) + - add `InputOf` type (@gcanti) + - `Guard` + - (\*) make `Guard` more general by adding a `I` type parameter (@gcanti) + - (\*) rename `schemableGuard` to `Schemable` (@gcanti) + - add `InputOf` type (@gcanti) + - add `alt` function (@gcanti) + - add `compose` function (@gcanti) + - add `id` function (@gcanti) - `Codec` - - rename `invariantCodec` to `Invariant` (@gcanti) + - (\*) rename `invariantCodec` to `Invariant` (@gcanti) - `Encoder` - - rename `contravariantEncoder` to `Contravariant` (@gcanti) - - rename `categoryEncoder` to `Category` (@gcanti) + - (\*) rename `contravariantEncoder` to `Contravariant` (@gcanti) + - (\*) rename `categoryEncoder` to `Category` (@gcanti) - `Eq` - - rename `schemableEq` to `Schemable` (@gcanti) - - `Guard` - - make `Guard` more general by adding a `I` type parameter (@gcanti) - - rename `schemableGuard` to `Schemable` (@gcanti) + - (\*) rename `schemableEq` to `Schemable` (@gcanti) - `Kleisli` - add `id` (@gcanti) - - drop `type` in favour of `composeType` (@gcanti) - - drop `partial` in favour of `composePartial` (@gcanti) - - drop `array` in favour of `composeArray` (@gcanti) - - drop `record` in favour of `composeRecord` (@gcanti) - - drop `tuple` in favour of `composeTuple` (@gcanti) - - drop `union` in favour of `composeUnion` (@gcanti) - - drop `sum` in favour of `composeSum` (@gcanti) - - `KleisliDecoder` - - remove old `Decoder.ts` module and rename `KleisliDecoder` to `Decoder` (@gcanti) - - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - - drop `type` in favour of `composeType` (@gcanti) - - drop `partial` in favour of `composePartial` (@gcanti) - - rename `array` to `composeArray` - - rename `record` to `composeRecord` - - rename `tuple` to `composeTuple` - - rename `union` to `composeUnion` - - rename `sum` to `composeSum` - - add `type`, `partial`, `array`, `record`, `tuple`, `union`, `sum` combinators (@gcanti) - - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - - add `draw` function (@gcanti) - - `KleisliTaskDecoder` - - remove old `TaskDecoder.ts` module and rename `KleisliTaskDecoder` to `TaskDecoder` (@gcanti) - - rename `fromKleisliDecoder` to `fromDecoder` (@gcanti) - - add `fromGuard` (@gcanti) - - add `string`, `number`, `boolean`, `UnknownArray`, `UnknownRecord` primitives (@gcanti) - - drop `type` in favour of `composeType` (@gcanti) - - drop `partial` in favour of `composePartial` (@gcanti) - - rename `array` to `composeArray` - - rename `record` to `composeRecord` - - rename `tuple` to `composeTuple` - - rename `union` to `composeUnion` - - rename `sum` to `composeSum` - - add `type`, `partial`, `array`, `record`, `tuple`, `union`, `sum` combinators (@gcanti) - - add `Functor2`, `Alt2`, `Category2`, `Schemable2c` instances (@gcanti) - - add `draw` function (@gcanti) + - (\*) drop `type` in favour of `composeType` (@gcanti) + - (\*) drop `partial` in favour of `composePartial` (@gcanti) + - (\*) drop `array` in favour of `composeArray` (@gcanti) + - (\*) drop `record` in favour of `composeRecord` (@gcanti) + - (\*) drop `tuple` in favour of `composeTuple` (@gcanti) + - (\*) drop `union` in favour of `composeUnion` (@gcanti) + - (\*) drop `sum` in favour of `composeSum` (@gcanti) - `JsonCodec` - - rename `invariantJsonCodec` to `Invariant` (@gcanti) - - rename `schemableJsonCodec` to `Schemable` (@gcanti) + - (\*) rename `invariantJsonCodec` to `Invariant` (@gcanti) + - (\*) rename `schemableJsonCodec` to `Schemable` (@gcanti) - `JsonEncoder` - - rename `contravariantJsonCodec` to `Contravariant` (@gcanti) - - rename `schemableJsonEncoder` to `Schemable` (@gcanti) + - (\*) rename `contravariantJsonCodec` to `Contravariant` (@gcanti) + - (\*) rename `schemableJsonEncoder` to `Schemable` (@gcanti) - `Schemable` - add `Schemable2C`, `WithUnknownContainers2C`, `WithUnion2C`, `WithRefine2C` (@gcanti) - `Type` - - rename `schemableType` to `Schemable` (@gcanti) + - (\*) rename `schemableType` to `Schemable` (@gcanti) + +(\*) breaking change # 2.2.7 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 8f8901afc..b19a2e5fc 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -13,7 +13,7 @@ Experimental features are published in order to get early feedback from the comm A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. -Added in v2.2.8 +Added in v2.2.7 --- @@ -89,7 +89,7 @@ Added in v2.2.8 export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 # Category @@ -113,7 +113,7 @@ Added in v2.2.8 export type DecodeError = FS.FreeSemigroup> ``` -Added in v2.2.8 +Added in v2.2.7 ## error @@ -123,7 +123,7 @@ Added in v2.2.8 export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> ``` -Added in v2.2.8 +Added in v2.2.7 ## failure @@ -136,7 +136,7 @@ export declare const failure: ( ) => E.Either>, A> ``` -Added in v2.2.8 +Added in v2.2.7 ## success @@ -146,7 +146,7 @@ Added in v2.2.8 export declare const success: (a: A) => E.Either>, A> ``` -Added in v2.2.8 +Added in v2.2.7 # Functor @@ -158,7 +158,7 @@ Added in v2.2.8 export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 # Semigroupoid @@ -182,7 +182,7 @@ Added in v2.2.8 export declare const array: (item: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## composeArray @@ -266,7 +266,7 @@ export declare const composeUnion: (decoder: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## intersect @@ -278,7 +278,7 @@ export declare const intersect: ( ) => (left: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## lazy @@ -288,7 +288,7 @@ Added in v2.2.8 export declare const lazy: (id: string, f: () => Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## mapLeftWithInput @@ -300,7 +300,7 @@ export declare const mapLeftWithInput: ( ) => (decoder: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## nullable @@ -310,7 +310,7 @@ Added in v2.2.8 export declare const nullable: (or: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## parse @@ -322,7 +322,7 @@ export declare const parse: ( ) => (from: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## partial @@ -334,7 +334,7 @@ export declare const partial: ( ) => Decoder> ``` -Added in v2.2.8 +Added in v2.2.7 ## record @@ -344,7 +344,7 @@ Added in v2.2.8 export declare const record: (codomain: Decoder) => Decoder> ``` -Added in v2.2.8 +Added in v2.2.7 ## refine @@ -357,7 +357,7 @@ export declare const refine: ( ) => (from: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## sum @@ -369,7 +369,7 @@ export declare const sum: ( ) => (members: { [K in keyof A]: Decoder }) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## tuple @@ -381,7 +381,7 @@ export declare const tuple: ( ) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## type @@ -393,7 +393,7 @@ export declare const type: ( ) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## union @@ -439,7 +439,7 @@ export declare const literal: ( ) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 # instances @@ -494,7 +494,7 @@ Added in v2.2.8 export declare const URI: 'io-ts/Decoder' ``` -Added in v2.2.8 +Added in v2.2.7 ## URI (type alias) @@ -504,7 +504,7 @@ Added in v2.2.8 export type URI = typeof URI ``` -Added in v2.2.8 +Added in v2.2.7 # model @@ -528,7 +528,7 @@ Added in v2.2.8 export declare const UnknownArray: Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## UnknownRecord @@ -538,7 +538,7 @@ Added in v2.2.8 export declare const UnknownRecord: Decoder> ``` -Added in v2.2.8 +Added in v2.2.7 ## boolean @@ -548,7 +548,7 @@ Added in v2.2.8 export declare const boolean: Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## number @@ -558,7 +558,7 @@ Added in v2.2.8 export declare const number: Decoder ``` -Added in v2.2.8 +Added in v2.2.7 ## string @@ -568,7 +568,7 @@ Added in v2.2.8 export declare const string: Decoder ``` -Added in v2.2.8 +Added in v2.2.7 # utils @@ -590,7 +590,7 @@ Added in v2.2.8 export type TypeOf = K.TypeOf ``` -Added in v2.2.8 +Added in v2.2.7 ## draw @@ -600,4 +600,4 @@ Added in v2.2.8 export declare const draw: (e: FS.FreeSemigroup>) => string ``` -Added in v2.2.8 +Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index e5016ff71..0f4e468e3 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -13,7 +13,7 @@ Experimental features are published in order to get early feedback from the comm A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. -Added in v2.2.8 +Added in v2.2.7 --- @@ -90,7 +90,7 @@ Added in v2.2.8 export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 # Category @@ -114,7 +114,7 @@ Added in v2.2.8 export type DecodeError = D.DecodeError ``` -Added in v2.2.8 +Added in v2.2.7 ## error @@ -124,7 +124,7 @@ Added in v2.2.8 export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> ``` -Added in v2.2.8 +Added in v2.2.7 ## failure @@ -137,7 +137,7 @@ export declare const failure: ( ) => TE.TaskEither>, A> ``` -Added in v2.2.8 +Added in v2.2.7 ## success @@ -147,7 +147,7 @@ Added in v2.2.8 export declare const success: (a: A) => TE.TaskEither>, A> ``` -Added in v2.2.8 +Added in v2.2.7 # Functor @@ -159,7 +159,7 @@ Added in v2.2.8 export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 # Semigroupoid @@ -183,7 +183,7 @@ Added in v2.2.8 export declare const array: (item: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## composeArray @@ -281,7 +281,7 @@ export declare const intersect: ( ) => (left: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## lazy @@ -291,7 +291,7 @@ Added in v2.2.8 export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## mapLeftWithInput @@ -303,7 +303,7 @@ export declare const mapLeftWithInput: ( ) => (decoder: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## nullable @@ -313,7 +313,7 @@ Added in v2.2.8 export declare const nullable: (or: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## parse @@ -325,7 +325,7 @@ export declare const parse: ( ) => (from: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## partial @@ -337,7 +337,7 @@ export declare const partial: ( ) => TaskDecoder> ``` -Added in v2.2.8 +Added in v2.2.7 ## record @@ -347,7 +347,7 @@ Added in v2.2.8 export declare const record: (codomain: TaskDecoder) => TaskDecoder> ``` -Added in v2.2.8 +Added in v2.2.7 ## refine @@ -360,7 +360,7 @@ export declare const refine: ( ) => (from: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## sum @@ -372,7 +372,7 @@ export declare const sum: ( ) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## tuple @@ -384,7 +384,7 @@ export declare const tuple: ( ) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## type @@ -396,7 +396,7 @@ export declare const type: ( ) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## union @@ -408,7 +408,7 @@ export declare const union: ( ) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 # constructors @@ -420,7 +420,7 @@ Added in v2.2.8 export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## fromGuard @@ -430,7 +430,7 @@ Added in v2.2.8 export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## fromRefinement @@ -455,7 +455,7 @@ export declare const literal: ( ) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 # instances @@ -510,7 +510,7 @@ Added in v2.2.8 export declare const URI: 'io-ts/TaskDecoder' ``` -Added in v2.2.8 +Added in v2.2.7 ## URI (type alias) @@ -520,7 +520,7 @@ Added in v2.2.8 export type URI = typeof URI ``` -Added in v2.2.8 +Added in v2.2.7 # model @@ -544,7 +544,7 @@ Added in v2.2.8 export declare const UnknownArray: TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## UnknownRecord @@ -554,7 +554,7 @@ Added in v2.2.8 export declare const UnknownRecord: TaskDecoder> ``` -Added in v2.2.8 +Added in v2.2.7 ## boolean @@ -564,7 +564,7 @@ Added in v2.2.8 export declare const boolean: TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## number @@ -574,7 +574,7 @@ Added in v2.2.8 export declare const number: TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 ## string @@ -584,7 +584,7 @@ Added in v2.2.8 export declare const string: TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 # utils @@ -606,7 +606,7 @@ Added in v2.2.8 export type TypeOf = K.TypeOf ``` -Added in v2.2.8 +Added in v2.2.7 ## draw @@ -616,4 +616,4 @@ Added in v2.2.8 export declare const draw: (e: FS.FreeSemigroup>) => string ``` -Added in v2.2.8 +Added in v2.2.7 diff --git a/src/Decoder.ts b/src/Decoder.ts index cd1292643..af19c6932 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -6,7 +6,7 @@ * * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. * - * @since 2.2.8 + * @since 2.2.7 */ import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' @@ -83,25 +83,25 @@ export interface Decoder extends K.Kleisli {} /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export type DecodeError = FS.FreeSemigroup> /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export const error = (actual: unknown, message: string): DecodeError => FS.of(DE.leaf(actual, message)) /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export const success: (a: A) => E.Either = E.right /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export const failure = (actual: unknown, message: string): E.Either => E.left(error(actual, message)) @@ -126,7 +126,7 @@ export const fromGuard = (guard: G.Guard, expected: string /** * @category constructors - * @since 2.2.8 + * @since 2.2.7 */ export const literal: ]>( ...values: A @@ -140,7 +140,7 @@ export const literal: ]>( /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const string: Decoder = /*#__PURE__*/ @@ -148,7 +148,7 @@ export const string: Decoder = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const number: Decoder = /*#__PURE__*/ @@ -156,7 +156,7 @@ export const number: Decoder = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const boolean: Decoder = /*#__PURE__*/ @@ -164,7 +164,7 @@ export const boolean: Decoder = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const UnknownArray: Decoder> = /*#__PURE__*/ @@ -172,7 +172,7 @@ export const UnknownArray: Decoder> = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const UnknownRecord: Decoder> = /*#__PURE__*/ @@ -184,7 +184,7 @@ export const UnknownRecord: Decoder> = /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const mapLeftWithInput: ( f: (input: I, e: DecodeError) => DecodeError @@ -194,7 +194,7 @@ export const mapLeftWithInput: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const refine = ( refinement: (a: A) => a is B, @@ -203,7 +203,7 @@ export const refine = ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const parse: (parser: (a: A) => E.Either) => (from: Decoder) => Decoder = /*#__PURE__*/ @@ -211,7 +211,7 @@ export const parse: (parser: (a: A) => E.Either) => (fr /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const nullable: (or: Decoder) => Decoder = /*#__PURE__*/ @@ -229,7 +229,7 @@ export const composeType: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const type = ( properties: { [K in keyof A]: Decoder } @@ -247,7 +247,7 @@ export const composePartial: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const partial = ( properties: { [K in keyof A]: Decoder } @@ -263,7 +263,7 @@ export const composeArray: (item: Decoder) => (decoder: Decoder(item: Decoder): Decoder> => pipe(UnknownArray, composeArray(item)) @@ -280,7 +280,7 @@ export const composeRecord: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const record = (codomain: Decoder): Decoder> => pipe(UnknownRecord, composeRecord(codomain)) @@ -297,7 +297,7 @@ export const composeTuple: >( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const tuple = >( ...components: { [K in keyof A]: Decoder } @@ -305,7 +305,7 @@ export const tuple = >( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const composeUnion: ]>( ...members: { [K in keyof A]: Decoder } @@ -323,7 +323,7 @@ export const union = ]>( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const intersect: (right: Decoder) => (left: Decoder) => Decoder = /*#__PURE__*/ @@ -345,7 +345,7 @@ export const composeSum: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const sum = (tag: T) => ( members: { [K in keyof A]: Decoder } @@ -353,7 +353,7 @@ export const sum = (tag: T) => ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const lazy: (id: string, f: () => Decoder) => Decoder = /*#__PURE__*/ @@ -375,7 +375,7 @@ const compose_: Category2['compose'] = (ab, la) => pipe(la, compose(ab)) /** * @category Functor - * @since 2.2.8 + * @since 2.2.7 */ export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder = /*#__PURE__*/ @@ -383,7 +383,7 @@ export const map: (f: (a: A) => B) => (fa: Decoder) => Decoder(that: () => Decoder) => (me: Decoder) => Decoder = /*#__PURE__*/ @@ -411,13 +411,13 @@ export const id: () => Decoder = /** * @category instances - * @since 2.2.8 + * @since 2.2.7 */ export const URI = 'io-ts/Decoder' /** * @category instances - * @since 2.2.8 + * @since 2.2.7 */ export type URI = typeof URI @@ -489,7 +489,7 @@ export const Schemable: S.Schemable2C & // ------------------------------------------------------------------------------------- /** - * @since 2.2.8 + * @since 2.2.7 */ export type TypeOf = K.TypeOf @@ -539,7 +539,7 @@ const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( ) /** - * @since 2.2.8 + * @since 2.2.7 */ export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 4fa4a2d51..39f3042cc 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -6,7 +6,7 @@ * * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. * - * @since 2.2.8 + * @since 2.2.7 */ import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' @@ -76,25 +76,25 @@ export interface TaskDecoder extends K.Kleisli /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export type DecodeError = D.DecodeError /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export const error: (actual: unknown, message: string) => DecodeError = D.error /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export const success: (a: A) => TE.TaskEither = TE.right /** * @category DecodeError - * @since 2.2.8 + * @since 2.2.7 */ export const failure = (actual: unknown, message: string): TE.TaskEither => TE.left(D.error(actual, message)) @@ -105,7 +105,7 @@ export const failure = (actual: unknown, message: string): TE.TaskEit /** * @category constructors - * @since 2.2.8 + * @since 2.2.7 */ export const fromDecoder = (decoder: D.Decoder): TaskDecoder => ({ decode: TE.fromEitherK(decoder.decode) @@ -120,14 +120,14 @@ export const fromRefinement = (refinement: Refinement, exp /** * @category constructors - * @since 2.2.8 + * @since 2.2.7 */ export const fromGuard = (guard: G.Guard, expected: string): TaskDecoder => fromRefinement(guard.is, expected) /** * @category constructors - * @since 2.2.8 + * @since 2.2.7 */ export const literal: ]>( ...values: A @@ -141,7 +141,7 @@ export const literal: ]>( /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const string: TaskDecoder = /*#__PURE__*/ @@ -149,7 +149,7 @@ export const string: TaskDecoder = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const number: TaskDecoder = /*#__PURE__*/ @@ -157,7 +157,7 @@ export const number: TaskDecoder = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const boolean: TaskDecoder = /*#__PURE__*/ @@ -165,7 +165,7 @@ export const boolean: TaskDecoder = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const UnknownArray: TaskDecoder> = /*#__PURE__*/ @@ -173,7 +173,7 @@ export const UnknownArray: TaskDecoder> = /** * @category primitives - * @since 2.2.8 + * @since 2.2.7 */ export const UnknownRecord: TaskDecoder> = /*#__PURE__*/ @@ -185,7 +185,7 @@ export const UnknownRecord: TaskDecoder> = /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const mapLeftWithInput: ( f: (input: I, e: DecodeError) => DecodeError @@ -195,7 +195,7 @@ export const mapLeftWithInput: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const refine = ( refinement: (a: A) => a is B, @@ -204,7 +204,7 @@ export const refine = ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const parse: ( parser: (a: A) => TE.TaskEither @@ -214,7 +214,7 @@ export const parse: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const nullable: (or: TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -232,7 +232,7 @@ export const composeType: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const type = ( properties: { [K in keyof A]: TaskDecoder } @@ -250,7 +250,7 @@ export const composePartial: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } @@ -268,7 +268,7 @@ export const composeArray: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const array = (item: TaskDecoder): TaskDecoder> => pipe(UnknownArray, composeArray(item)) @@ -285,7 +285,7 @@ export const composeRecord: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const record = (codomain: TaskDecoder): TaskDecoder> => pipe(UnknownRecord, composeRecord(codomain)) @@ -302,7 +302,7 @@ export const composeTuple: >( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const tuple = >( ...components: { [K in keyof A]: TaskDecoder } @@ -320,7 +320,7 @@ export const composeUnion: ]>( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const union = ]>( ...members: { [K in keyof A]: TaskDecoder } @@ -328,7 +328,7 @@ export const union = ]>( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const intersect: ( right: TaskDecoder @@ -354,7 +354,7 @@ export const composeSum: ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } @@ -362,7 +362,7 @@ export const sum = (tag: T) => ( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -384,7 +384,7 @@ const compose_: Category2['compose'] = (ab, la) => pipe(la, compose(ab)) /** * @category Functor - * @since 2.2.8 + * @since 2.2.7 */ export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -392,7 +392,7 @@ export const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDe /** * @category Alt - * @since 2.2.8 + * @since 2.2.7 */ export const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder = /*#__PURE__*/ @@ -420,13 +420,13 @@ export const id: () => TaskDecoder = /** * @category instances - * @since 2.2.8 + * @since 2.2.7 */ export const URI = 'io-ts/TaskDecoder' /** * @category instances - * @since 2.2.8 + * @since 2.2.7 */ export type URI = typeof URI @@ -498,7 +498,7 @@ export const Schemable: S.Schemable2C & // ------------------------------------------------------------------------------------- /** - * @since 2.2.8 + * @since 2.2.7 */ export type TypeOf = K.TypeOf @@ -508,7 +508,7 @@ export type TypeOf = K.TypeOf export type InputOf = K.InputOf /** - * @since 2.2.8 + * @since 2.2.7 */ export const draw: (e: DecodeError) => string = D.draw From 9d23727b037e67e05dbcc1cc8c0356cbf9c633ae Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 3 Jul 2020 06:55:03 +0200 Subject: [PATCH 120/222] remove `JsonCodec` module --- CHANGELOG.md | 4 +- docs/modules/JsonCodec.ts.md | 313 -------------------------------- docs/modules/JsonEncoder.ts.md | 2 +- docs/modules/Kleisli.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 3 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- dtslint/ts3.5/JsonCodec.ts | 17 -- src/JsonCodec.ts | 224 ----------------------- test/Schema.ts | 18 +- 13 files changed, 18 insertions(+), 575 deletions(-) delete mode 100644 docs/modules/JsonCodec.ts.md delete mode 100644 dtslint/ts3.5/JsonCodec.ts delete mode 100644 src/JsonCodec.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 462e98de9..89b122a02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - **Experimental** - (\*) remove `KleisliDecoder` module (@gcanti) - (\*) remove `KleisliTaskDecoder` module (@gcanti) + - (\*) remove `JsonCodec` module (@gcanti) - `Decoder` - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) - add `fromRefinement` function (@gcanti) @@ -78,9 +79,6 @@ - (\*) drop `tuple` in favour of `composeTuple` (@gcanti) - (\*) drop `union` in favour of `composeUnion` (@gcanti) - (\*) drop `sum` in favour of `composeSum` (@gcanti) - - `JsonCodec` - - (\*) rename `invariantJsonCodec` to `Invariant` (@gcanti) - - (\*) rename `schemableJsonCodec` to `Schemable` (@gcanti) - `JsonEncoder` - (\*) rename `contravariantJsonCodec` to `Contravariant` (@gcanti) - (\*) rename `schemableJsonEncoder` to `Schemable` (@gcanti) diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md deleted file mode 100644 index 6fdf373a6..000000000 --- a/docs/modules/JsonCodec.ts.md +++ /dev/null @@ -1,313 +0,0 @@ ---- -title: JsonCodec.ts -nav_order: 9 -parent: Modules ---- - -## JsonCodec overview - -**This module is experimental** - -Experimental features are published in order to get early feedback from the community, see these tracking -[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - -A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - -Added in v2.2.3 - ---- - -

Table of contents

- -- [Contravariant](#contravariant) - - [imap](#imap) -- [combinators](#combinators) - - [array](#array) - - [intersect](#intersect) - - [lazy](#lazy) - - [mapLeftWithInput](#mapleftwithinput) - - [nullable](#nullable) - - [partial](#partial) - - [record](#record) - - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) -- [constructors](#constructors) - - [literal](#literal) - - [make](#make) -- [instances](#instances) - - [Invariant](#invariant) - - [Schemable](#schemable) - - [URI](#uri) - - [URI (type alias)](#uri-type-alias) -- [model](#model) - - [JsonCodec (interface)](#jsoncodec-interface) -- [primitives](#primitives) - - [boolean](#boolean) - - [number](#number) - - [string](#string) -- [utils](#utils) - - [TypeOf (type alias)](#typeof-type-alias) - ---- - -# Contravariant - -## imap - -**Signature** - -```ts -export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) => JsonCodec -``` - -Added in v2.2.3 - -# combinators - -## array - -**Signature** - -```ts -export declare const array: (item: JsonCodec) => JsonCodec -``` - -Added in v2.2.3 - -## intersect - -**Signature** - -```ts -export declare const intersect: (right: JsonCodec) => (left: JsonCodec) => JsonCodec -``` - -Added in v2.2.3 - -## lazy - -**Signature** - -```ts -export declare const lazy: (id: string, f: () => JsonCodec) => JsonCodec -``` - -Added in v2.2.3 - -## mapLeftWithInput - -**Signature** - -```ts -export declare const mapLeftWithInput: ( - f: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> -) => (codec: JsonCodec) => JsonCodec -``` - -Added in v2.2.3 - -## nullable - -**Signature** - -```ts -export declare const nullable: (or: JsonCodec) => JsonCodec -``` - -Added in v2.2.3 - -## partial - -**Signature** - -```ts -export declare const partial: ( - properties: { [K in keyof A]: JsonCodec } -) => JsonCodec> -``` - -Added in v2.2.3 - -## record - -**Signature** - -```ts -export declare const record: (codomain: JsonCodec) => JsonCodec> -``` - -Added in v2.2.3 - -## refine - -**Signature** - -```ts -export declare const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: JsonCodec) => JsonCodec -``` - -Added in v2.2.3 - -## sum - -**Signature** - -```ts -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: JsonCodec }) => JsonCodec -``` - -Added in v2.2.3 - -## tuple - -**Signature** - -```ts -export declare const tuple: ( - ...components: { [K in keyof A]: JsonCodec } -) => JsonCodec -``` - -Added in v2.2.3 - -## type - -**Signature** - -```ts -export declare const type: (properties: { [K in keyof A]: JsonCodec }) => JsonCodec<{ [K in keyof A]: A[K] }> -``` - -Added in v2.2.3 - -# constructors - -## literal - -**Signature** - -```ts -export declare const literal: (...values: A) => JsonCodec -``` - -Added in v2.2.3 - -## make - -**Signature** - -```ts -export declare const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec -``` - -Added in v2.2.3 - -# instances - -## Invariant - -**Signature** - -```ts -export declare const Invariant: Invariant1<'io-ts/JsonCodec'> -``` - -Added in v2.2.8 - -## Schemable - -**Signature** - -```ts -export declare const Schemable: Schemable1<'io-ts/JsonCodec'> & WithRefine1<'io-ts/JsonCodec'> -``` - -Added in v2.2.8 - -## URI - -**Signature** - -```ts -export declare const URI: 'io-ts/JsonCodec' -``` - -Added in v2.2.3 - -## URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.3 - -# model - -## JsonCodec (interface) - -Laws: - -1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` -2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` - -**Signature** - -```ts -export interface JsonCodec extends C.Codec {} -``` - -Added in v2.2.3 - -# primitives - -## boolean - -**Signature** - -```ts -export declare const boolean: JsonCodec -``` - -Added in v2.2.3 - -## number - -**Signature** - -```ts -export declare const number: JsonCodec -``` - -Added in v2.2.3 - -## string - -**Signature** - -```ts -export declare const string: JsonCodec -``` - -Added in v2.2.3 - -# utils - -## TypeOf (type alias) - -**Signature** - -```ts -export type TypeOf = JE.TypeOf -``` - -Added in v2.2.2 diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index d297878e0..6c54d2f61 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -1,6 +1,6 @@ --- title: JsonEncoder.ts -nav_order: 10 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 7c4f443c0..57173754d 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -1,6 +1,6 @@ --- title: Kleisli.ts -nav_order: 11 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 2abc64ffe..8f9bdae48 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 12 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index 5aea2ce60..cecc74f5f 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 13 +nav_order: 12 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 9ff666849..dbfc09f7d 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 14 +nav_order: 13 parent: Modules --- @@ -89,7 +89,6 @@ export declare const interpreter: { S extends | 'Eq' | 'io-ts/Guard' - | 'io-ts/JsonCodec' | 'io-ts/JsonEncoder' | 'io-ts/Type' | 'Ord' diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 2ed347688..5fe3c4dcf 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 15 +nav_order: 14 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 0f4e468e3..37b210930 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 16 +nav_order: 15 parent: Modules --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 3dca4bf16..4a41998e1 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 17 +nav_order: 16 parent: Modules --- diff --git a/dtslint/ts3.5/JsonCodec.ts b/dtslint/ts3.5/JsonCodec.ts deleted file mode 100644 index b07200189..000000000 --- a/dtslint/ts3.5/JsonCodec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as _ from '../../src/JsonCodec' - -// $ExpectType JsonCodec<{ a: string; b: { c: number; }; }> -_.type({ - a: _.string, - b: _.type({ - c: _.number - }) -}) - -// $ExpectType JsonCodec; }>> -_.partial({ - a: _.string, - b: _.partial({ - c: _.number - }) -}) diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts deleted file mode 100644 index ac82906c5..000000000 --- a/src/JsonCodec.ts +++ /dev/null @@ -1,224 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import { Invariant1 } from 'fp-ts/lib/Invariant' -import * as C from './Codec' -import * as D from './Decoder' -import * as JE from './JsonEncoder' -import { Literal, Schemable1, WithRefine1 } from './Schemable' - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * Laws: - * - * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` - * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` - * - * @category model - * @since 2.2.3 - */ -export interface JsonCodec extends C.Codec {} - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.2 - */ -export type TypeOf = JE.TypeOf - -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.3 - */ -export const make: (decoder: D.Decoder, encoder: JE.JsonEncoder) => JsonCodec = C.make - -/** - * @category constructors - * @since 2.2.3 - */ -export const literal: ]>(...values: A) => JsonCodec = - C.literal - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.3 - */ -export const string: JsonCodec = C.string - -/** - * @category primitives - * @since 2.2.3 - */ -export const number: JsonCodec = C.number - -/** - * @category primitives - * @since 2.2.3 - */ -export const boolean: JsonCodec = C.boolean - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.3 - */ -export const mapLeftWithInput: ( - f: (actual: unknown, e: D.DecodeError) => D.DecodeError -) => (codec: JsonCodec) => JsonCodec = C.mapLeftWithInput - -/** - * @category combinators - * @since 2.2.3 - */ -export const refine: ( - refinement: (a: A) => a is B, - id: string -) => (from: JsonCodec) => JsonCodec = C.refine - -/** - * @category combinators - * @since 2.2.3 - */ -export const nullable: (or: JsonCodec) => JsonCodec = C.nullable - -/** - * @category combinators - * @since 2.2.3 - */ -export const type: ( - properties: { [K in keyof A]: JsonCodec } -) => JsonCodec<{ [K in keyof A]: A[K] }> = C.type as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const partial: ( - properties: { [K in keyof A]: JsonCodec } -) => JsonCodec> = C.partial as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const record: (codomain: JsonCodec) => JsonCodec> = C.record - -/** - * @category combinators - * @since 2.2.3 - */ -export const array: (item: JsonCodec) => JsonCodec> = C.array - -/** - * @category combinators - * @since 2.2.3 - */ -export const tuple: >( - ...components: { [K in keyof A]: JsonCodec } -) => JsonCodec = C.tuple as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const intersect: (right: JsonCodec) => (left: JsonCodec) => JsonCodec = C.intersect - -/** - * @category combinators - * @since 2.2.3 - */ -export const sum: ( - tag: T -) => (members: { [K in keyof A]: JsonCodec }) => JsonCodec = C.sum as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const lazy: (id: string, f: () => JsonCodec) => JsonCodec = C.lazy - -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- - -/** - * @category Contravariant - * @since 2.2.3 - */ -export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: JsonCodec) => JsonCodec = C.imap - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @category instances - * @since 2.2.3 - */ -export const URI = 'io-ts/JsonCodec' - -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: JsonCodec - } -} - -/** - * @category instances - * @since 2.2.8 - */ -export const Invariant: Invariant1 = { - URI, - imap: C.Invariant.imap -} - -/** - * @category instances - * @since 2.2.8 - */ -export const Schemable: Schemable1 & WithRefine1 = { - URI, - literal, - string, - number, - boolean, - nullable, - type, - partial, - record, - array, - tuple: tuple as Schemable1['tuple'], - intersect, - sum, - lazy, - refine: refine as WithRefine1['refine'] -} diff --git a/test/Schema.ts b/test/Schema.ts index 9c65cfa9f..c5a4f2da5 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,13 +1,13 @@ import * as assert from 'assert' import * as fc from 'fast-check' import { isRight } from 'fp-ts/lib/Either' -import * as JC from '../src/JsonCodec' +import { pipe } from 'fp-ts/lib/pipeable' +import * as D from '../src/Decoder' import * as Eq from '../src/Eq' import * as G from '../src/Guard' -import { Schema, interpreter, make } from '../src/Schema' -import * as A from './Arbitrary' import * as JE from '../src/JsonEncoder' -import { pipe } from 'fp-ts/lib/pipeable' +import { interpreter, make, Schema } from '../src/Schema' +import * as A from './Arbitrary' function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { try { @@ -20,22 +20,22 @@ function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { function check(schema: Schema): void { const arb = interpreter(A.Schemable)(schema) - const codec = interpreter(JC.Schemable)(schema) + const decoder = interpreter(D.Schemable)(schema) const guard = interpreter(G.Schemable)(schema) const eq = interpreter(Eq.Schemable)(schema) const encoder = interpreter(JE.Schemable)(schema) // decoders, guards and eqs should be aligned - fc.assert(fc.property(arb, (a) => isRight(codec.decode(a)) && guard.is(a) && eq.equals(a, a))) + fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) && guard.is(a) && eq.equals(a, a))) // laws // 1. - fc.assert(fc.property(arb, (a) => isRight(codec.decode(codec.encode(a))) && isRight(codec.decode(encoder.encode(a))))) + fc.assert(fc.property(arb, (a) => isRight(decoder.decode(encoder.encode(a))))) // 2. fc.assert( fc.property(arb, (u) => { - const a = codec.decode(u) + const a = decoder.decode(u) if (isRight(a)) { const o = a.right - return isDeepStrictEqual(codec.encode(o), u) && isDeepStrictEqual(encoder.encode(o), u) && eq.equals(o, u) + return isDeepStrictEqual(encoder.encode(o), u) && eq.equals(o, u) } return false }) From 599256481249797dfc90127a73e2850a9844b0e3 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 3 Jul 2020 07:02:50 +0200 Subject: [PATCH 121/222] Guard: add `zero` function --- CHANGELOG.md | 1 + docs/modules/Guard.ts.md | 11 +++++++++++ src/Guard.ts | 8 ++++++++ test/Guard.ts | 5 +++++ 4 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89b122a02..ac5ffc44c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ - (\*) rename `schemableGuard` to `Schemable` (@gcanti) - add `InputOf` type (@gcanti) - add `alt` function (@gcanti) + - add `zero` function (@gcanti) - add `compose` function (@gcanti) - add `id` function (@gcanti) - `Codec` diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index b0cd9bea7..780060ee9 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -34,6 +34,7 @@ Added in v2.2.0 - [tuple](#tuple) - [type](#type) - [union](#union) + - [zero](#zero) - [constructors](#constructors) - [literal](#literal) - [instances](#instances) @@ -208,6 +209,16 @@ export declare const union: ( Added in v2.2.0 +## zero + +**Signature** + +```ts +export declare const zero: () => Guard +``` + +Added in v2.2.8 + # constructors ## literal diff --git a/src/Guard.ts b/src/Guard.ts index 18c157bfd..4186f631d 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -250,6 +250,14 @@ export const alt = (that: () => Guard) => (me: Guard is: (i): i is A => me.is(i) || that().is(i) }) +/** + * @category combinators + * @since 2.2.8 + */ +export const zero = (): Guard => ({ + is: (_): _ is A => false +}) + /** * @category combinators * @since 2.2.8 diff --git a/test/Guard.ts b/test/Guard.ts index 26e274608..5034563be 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -23,6 +23,11 @@ describe('Guard', () => { assert.strictEqual(guard.is(null), false) }) + it('zero', () => { + const guard = G.zero() + assert.strictEqual(guard.is('a'), false) + }) + it('compose', () => { const guard = pipe(G.string, G.compose(NonEmptyString)) assert.strictEqual(guard.is('a'), true) From 1e25eac4e42409b69d4ddd253b1c6903fb574cae Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 3 Jul 2020 07:38:07 +0200 Subject: [PATCH 122/222] Encoder: change `id` category tag --- docs/modules/Encoder.ts.md | 30 +++++++++++++-------------- src/Encoder.ts | 42 +++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 93a9479a7..e6d576d80 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -19,6 +19,8 @@ Added in v2.2.3

Table of contents

+- [Category](#category) + - [id](#id) - [Contravariant](#contravariant) - [contramap](#contramap) - [Semigroupoid](#semigroupoid) @@ -33,10 +35,8 @@ Added in v2.2.3 - [sum](#sum) - [tuple](#tuple) - [type](#type) -- [constructors](#constructors) - - [id](#id) - [instances](#instances) - - [Category](#category) + - [Category](#category-1) - [Contravariant](#contravariant-1) - [URI](#uri) - [URI (type alias)](#uri-type-alias) @@ -48,6 +48,18 @@ Added in v2.2.3 --- +# Category + +## id + +**Signature** + +```ts +export declare function id
(): Encoder +``` + +Added in v2.2.3 + # Contravariant ## contramap @@ -172,18 +184,6 @@ export declare function type

>>( Added in v2.2.3 -# constructors - -## id - -**Signature** - -```ts -export declare function id(): Encoder -``` - -Added in v2.2.3 - # instances ## Category diff --git a/src/Encoder.ts b/src/Encoder.ts index 9727f23b6..0bf37d10a 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -25,20 +25,6 @@ export interface Encoder { readonly encode: (a: A) => O } -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- - -/** - * @category constructors - * @since 2.2.3 - */ -export function id(): Encoder { - return { - encode: identity - } -} - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -167,6 +153,18 @@ export function lazy(f: () => Encoder): Encoder { } } +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder = (fa, f) => ({ + encode: (b) => fa.encode(f(b)) +}) + +const compose_: (ab: Encoder, la: Encoder) => Encoder = (ab, ea) => ({ + encode: (b) => ea.encode(ab.encode(b)) +}) + // ------------------------------------------------------------------------------------- // pipeables // ------------------------------------------------------------------------------------- @@ -178,10 +176,6 @@ export function lazy(f: () => Encoder): Encoder { export const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder = (f) => (fa) => contramap_(fa, f) -const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder = (fa, f) => ({ - encode: (b) => fa.encode(f(b)) -}) - /** * @category Semigroupoid * @since 2.2.3 @@ -189,9 +183,15 @@ const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder export const compose: (ea: Encoder) => (ab: Encoder) => Encoder = (ea) => (ab) => compose_(ab, ea) -const compose_: (ab: Encoder, la: Encoder) => Encoder = (ab, ea) => ({ - encode: (b) => ea.encode(ab.encode(b)) -}) +/** + * @category Category + * @since 2.2.3 + */ +export function id(): Encoder { + return { + encode: identity + } +} // ------------------------------------------------------------------------------------- // instances From d79767ec23bac98d66c8cb448ea0b1d9f60d6389 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 3 Jul 2020 09:51:43 +0200 Subject: [PATCH 123/222] revert compose* --- CHANGELOG.md | 26 ++--- docs/modules/Decoder.ts.md | 91 ++++++--------- docs/modules/Kleisli.ts.md | 208 ++++++++++++++++----------------- docs/modules/Schema.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 92 +++++++-------- dtslint/ts3.5/Decoder.ts | 60 ---------- src/Decoder.ts | 88 ++++++-------- src/Kleisli.ts | 206 +++++++++++++++----------------- src/TaskDecoder.ts | 94 +++++++-------- 9 files changed, 362 insertions(+), 505 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac5ffc44c..a3ba7446d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,13 +24,12 @@ - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromGuard` signature (@gcanti) - - add `composeType` function (@gcanti) - - add `composePartial` function (@gcanti) - - add `composeArray` function (@gcanti) - - add `composeRecord` function (@gcanti) - - add `composeTuple` function (@gcanti) - - add `composeUnion` function (@gcanti) - - add `composeSum` function (@gcanti) + - add `ktype` function (@gcanti) + - add `kpartial` function (@gcanti) + - add `karray` function (@gcanti) + - add `krecord` function (@gcanti) + - add `ktuple` function (@gcanti) + - add `ksum` function (@gcanti) - add `compose` function (@gcanti) - add `id` function (@gcanti) - (\*) rename `functorDecoder` instance to `Functor` (@gcanti) @@ -42,13 +41,12 @@ - (\*) make `TaskDecoder` more general by adding a `I` type parameter (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromDecoder` signature (@gcanti) - - add `composeType` function (@gcanti) - - add `composePartial` function (@gcanti) - - add `composeArray` function (@gcanti) - - add `composeRecord` function (@gcanti) - - add `composeTuple` function (@gcanti) - - add `composeUnion` function (@gcanti) - - add `composeSum` function (@gcanti) + - add `ktype` function (@gcanti) + - add `kpartial` function (@gcanti) + - add `karray` function (@gcanti) + - add `krecord` function (@gcanti) + - add `ktuple` function (@gcanti) + - add `ksum` function (@gcanti) - add `compose` function (@gcanti) - add `id` function (@gcanti) - (\*) rename `functorTaskDecoder` instance to `Functor` (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index b19a2e5fc..9c9d2ea61 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -34,14 +34,13 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) - - [composeArray](#composearray) - - [composePartial](#composepartial) - - [composeRecord](#composerecord) - - [composeSum](#composesum) - - [composeTuple](#composetuple) - - [composeType](#composetype) - - [composeUnion](#composeunion) - [intersect](#intersect) + - [karray](#karray) + - [kpartial](#kpartial) + - [krecord](#krecord) + - [ksum](#ksum) + - [ktuple](#ktuple) + - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -184,101 +183,87 @@ export declare const array: (item: Decoder) => Decoder(item: Decoder) => (decoder: Decoder) => Decoder +export declare const intersect: ( + right: Decoder +) => (left: Decoder) => Decoder ``` -Added in v2.2.8 +Added in v2.2.7 -## composePartial +## karray **Signature** ```ts -export declare const composePartial: ( - properties: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder> +export declare const karray: (item: Decoder) => Decoder ``` Added in v2.2.8 -## composeRecord +## kpartial **Signature** ```ts -export declare const composeRecord: ( - codomain: Decoder -) => (decoder: Decoder>) => Decoder> +export declare const kpartial:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }>> ``` Added in v2.2.8 -## composeSum +## krecord **Signature** ```ts -export declare const composeSum: ( - tag: T -) => ( - members: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder +export declare const krecord: (codomain: Decoder) => Decoder, Record> ``` Added in v2.2.8 -## composeTuple +## ksum **Signature** ```ts -export declare const composeTuple: ( - ...components: { [K in keyof A]: Decoder } -) => (decoder: Decoder) => Decoder +export declare const ksum: ( + tag: T +) => >>( + members: MS +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> ``` Added in v2.2.8 -## composeType +## ktuple **Signature** ```ts -export declare const composeType: ( - properties: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder +export declare const ktuple: []>( + ...components: C +) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> ``` Added in v2.2.8 -## composeUnion +## ktype **Signature** ```ts -export declare const composeUnion: ( - ...members: { [K in keyof A]: Decoder } -) => (decoder: Decoder) => Decoder +export declare const ktype:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> ``` -Added in v2.2.7 - -## intersect - -**Signature** - -```ts -export declare const intersect: ( - right: Decoder -) => (left: Decoder) => Decoder -``` - -Added in v2.2.7 +Added in v2.2.8 ## lazy @@ -400,12 +385,12 @@ Added in v2.2.7 **Signature** ```ts -export declare const union: ( - ...members: { [K in keyof A]: Decoder } -) => Decoder +export declare const union: , ...Decoder[]]>( + ...members: MS +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> ``` -Added in v2.2.8 +Added in v2.2.7 # constructors diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 57173754d..25c0690b7 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -21,14 +21,8 @@ Added in v2.2.7 - [combinators](#combinators) - [alt](#alt) + - [array](#array) - [compose](#compose) - - [composeArray](#composearray) - - [composePartial](#composepartial) - - [composeRecord](#composerecord) - - [composeSum](#composesum) - - [composeTuple](#composetuple) - - [composeType](#composetype) - - [composeUnion](#composeunion) - [id](#id) - [intersect](#intersect) - [lazy](#lazy) @@ -36,7 +30,13 @@ Added in v2.2.7 - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) + - [partial](#partial) + - [record](#record) - [refine](#refine) + - [sum](#sum) + - [tuple](#tuple) + - [type](#type) + - [union](#union) - [constructors](#constructors) - [fromRefinement](#fromrefinement) - [literal](#literal) @@ -62,223 +62,219 @@ export declare function alt( Added in v2.2.7 -## compose +## array **Signature** ```ts -export declare function compose( - M: Monad2C -): (ab: Kleisli) => (ia: Kleisli) => Kleisli +export declare function array( + M: Applicative2C & Bifunctor2 +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> ``` Added in v2.2.7 -## composeArray +## compose **Signature** ```ts -export declare function composeArray( - M: Monad2C & Bifunctor2 -): ( - onItemError: (index: number, e: E) => E -) => (item: Kleisli) => (decoder: Kleisli>) => Kleisli> +export declare function compose( + M: Monad2C +): (ab: Kleisli) => (ia: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## composePartial +## id **Signature** ```ts -export declare function composePartial( - M: Monad2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli> +export declare function id(M: Applicative2C): () => Kleisli ``` Added in v2.2.8 -## composeRecord +## intersect **Signature** ```ts -export declare function composeRecord( - M: Monad2C & Bifunctor2 -): ( - onKeyError: (key: string, e: E) => E -) => ( - codomain: Kleisli -) => (decoder: Kleisli>) => Kleisli> +export declare function intersect( + M: Apply2C +): (right: Kleisli) => (left: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## composeSum +## lazy **Signature** ```ts -export declare function composeSum( - M: MonadThrow2C -): ( - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => ( - tag: T -) => ( - members: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli +export declare function lazy( + M: Bifunctor2 +): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## composeTuple +## map **Signature** ```ts -export declare function composeTuple( - M: Monad2C & Bifunctor2 -): ( - onIndexError: (index: number, e: E) => E -) => >( - ...components: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli +export declare function map( + F: Functor2C +): (f: (a: A) => B) => (ia: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## composeType +## mapLeftWithInput **Signature** ```ts -export declare function composeType( - M: Monad2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli +export declare function mapLeftWithInput( + M: Bifunctor2 +): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## composeUnion +## nullable **Signature** ```ts -export declare function composeUnion( - M: Monad2C & Alt2C & Bifunctor2 -): ( - onMemberError: (index: number, e: E) => E -) => ]>( - ...members: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli) => Kleisli +export declare function nullable( + M: Applicative2C & Bifunctor2 +): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## id +## parse **Signature** ```ts -export declare function id(M: Applicative2C): () => Kleisli +export declare function parse( + M: Monad2C +): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli ``` -Added in v2.2.8 +Added in v2.2.7 -## intersect +## partial **Signature** ```ts -export declare function intersect( - M: Apply2C -): (right: Kleisli) => (left: Kleisli) => Kleisli +export declare function partial( + M: Applicative2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) =>

>>( + properties: P +) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> ``` Added in v2.2.7 -## lazy +## record **Signature** ```ts -export declare function lazy( - M: Bifunctor2 -): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +export declare function record( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> ``` Added in v2.2.7 -## map +## refine **Signature** ```ts -export declare function map( - F: Functor2C -): (f: (a: A) => B) => (ia: Kleisli) => Kleisli +export declare function refine( + M: MonadThrow2C & Bifunctor2 +): ( + refinement: (a: A) => a is B, + onError: (a: A) => E +) => (from: Kleisli) => Kleisli ``` Added in v2.2.7 -## mapLeftWithInput +## sum **Signature** ```ts -export declare function mapLeftWithInput( - M: Bifunctor2 -): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +export declare function sum( + M: MonadThrow2C +): ( + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +) => >>( + members: MS +) => Kleisli, E, TypeOf> ``` Added in v2.2.7 -## nullable +## tuple **Signature** ```ts -export declare function nullable( +export declare function tuple( M: Applicative2C & Bifunctor2 -): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +): ( + onIndexError: (index: number, e: E) => E +) => >>( + ...components: C +) => Kleisli }, E, { [K in keyof C]: TypeOf }> ``` Added in v2.2.7 -## parse +## type **Signature** ```ts -export declare function parse( - M: Monad2C -): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli +export declare function type( + M: Applicative2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) =>

>>( + properties: P +) => Kleisli }, E, { [K in keyof P]: TypeOf }> ``` Added in v2.2.7 -## refine +## union **Signature** ```ts -export declare function refine( - M: MonadThrow2C & Bifunctor2 -): ( - refinement: (a: A) => a is B, - onError: (a: A) => E -) => (from: Kleisli) => Kleisli +export declare function union( + M: Alt2C & Bifunctor2 +): ( + onMemberError: (index: number, e: E) => E +) => , ...Array>]>( + ...members: MS +) => Kleisli, E, TypeOf> ``` Added in v2.2.7 diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index dbfc09f7d..909740f89 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -76,10 +76,10 @@ export declare const interpreter: { < S extends | 'io-ts/Codec' + | 'Either' | 'io-ts/Decoder' | 'io-ts/Encoder' | 'io-ts/TaskDecoder' - | 'Either' | 'IOEither' | 'TaskEither' >( diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 37b210930..b9b429e27 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -34,14 +34,13 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) - - [composeArray](#composearray) - - [composePartial](#composepartial) - - [composeRecord](#composerecord) - - [composeSum](#composesum) - - [composeTuple](#composetuple) - - [composeType](#composetype) - - [composeUnion](#composeunion) - [intersect](#intersect) + - [karray](#karray) + - [kpartial](#kpartial) + - [krecord](#krecord) + - [ksum](#ksum) + - [ktuple](#ktuple) + - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -185,104 +184,91 @@ export declare const array: (item: TaskDecoder) => TaskDecoder( - item: TaskDecoder -) => (decoder: TaskDecoder) => TaskDecoder +export declare const intersect: ( + right: TaskDecoder +) => (left: TaskDecoder) => TaskDecoder ``` -Added in v2.2.8 +Added in v2.2.7 -## composePartial +## karray **Signature** ```ts -export declare const composePartial: ( - properties: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder> +export declare const karray: (item: TaskDecoder) => TaskDecoder ``` Added in v2.2.8 -## composeRecord +## kpartial **Signature** ```ts -export declare const composeRecord: ( - codomain: TaskDecoder -) => (decoder: TaskDecoder>) => TaskDecoder> +export declare const kpartial:

>>( + properties: P +) => TaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +> ``` Added in v2.2.8 -## composeSum +## krecord **Signature** ```ts -export declare const composeSum: ( - tag: T -) => ( - members: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder +export declare const krecord: (codomain: TaskDecoder) => TaskDecoder, Record> ``` Added in v2.2.8 -## composeTuple +## ksum **Signature** ```ts -export declare const composeTuple: ( - ...components: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder) => TaskDecoder +export declare const ksum: ( + tag: T +) => >>( + members: MS +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.8 -## composeType +## ktuple **Signature** ```ts -export declare const composeType: ( - properties: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder +export declare const ktuple: []>( + ...components: C +) => TaskDecoder<{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> }> ``` Added in v2.2.8 -## composeUnion +## ktype **Signature** ```ts -export declare const composeUnion: ( - ...members: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder) => TaskDecoder +export declare const ktype:

>>( + properties: P +) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> ``` Added in v2.2.8 -## intersect - -**Signature** - -```ts -export declare const intersect: ( - right: TaskDecoder -) => (left: TaskDecoder) => TaskDecoder -``` - -Added in v2.2.7 - ## lazy **Signature** @@ -403,9 +389,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const union: ( - ...members: { [K in keyof A]: TaskDecoder } -) => TaskDecoder +export declare const union: , ...TaskDecoder[]]>( + ...members: MS +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.7 diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index f40941081..db436be80 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -21,21 +21,6 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf -// -// composeType -// - -// $ExpectType Decoder -pipe( - _.UnknownRecord, - _.composeType({ - a: _.string, - b: _.type({ - c: _.number - }) - }) -) - // // type // @@ -48,21 +33,6 @@ _.type({ }) }) -// -// composePartial -// - -// $ExpectType Decoder; }>> -pipe( - _.UnknownRecord, - _.composePartial({ - a: _.string, - b: _.partial({ - c: _.number - }) - }) -) - // // partial // @@ -75,16 +45,6 @@ _.partial({ }) }) -// -// composeArray -// - -// $ExpectType Decoder -pipe(_.UnknownArray, _.composeArray(_.string)) - -// $ExpectType Decoder -pipe(ArrayFromString, _.composeArray(NumberFromString)) - // // array // @@ -92,19 +52,6 @@ pipe(ArrayFromString, _.composeArray(NumberFromString)) // $ExpectType Decoder _.array(_.string) -// -// composeSum -// - -// $ExpectType Decoder -pipe( - _.UnknownRecord, - _.composeSum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: _.string }), - B: _.type({ _tag: _.literal('B'), b: _.number }) - }) -) - // // sum // @@ -115,13 +62,6 @@ _.sum('_tag')({ B: _.type({ _tag: _.literal('B'), b: _.number }) }) -// -// composeUnion -// - -// $ExpectType Decoder -pipe(_.string, _.composeUnion(NumberFromString, StringFromString)) - // // union // diff --git a/src/Decoder.ts b/src/Decoder.ts index af19c6932..fcc5d02d3 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -221,11 +221,10 @@ export const nullable: (or: Decoder) => Decoder * @category combinators * @since 2.2.8 */ -export const composeType: ( - properties: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder = - /*#__PURE__*/ - K.composeType(M)((k, e) => FS.of(DE.key(k, DE.required, e))) +export const ktype =

>>( + properties: P +): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => + K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators @@ -233,17 +232,16 @@ export const composeType: ( */ export const type = ( properties: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord, composeType(properties)) +): Decoder => pipe(UnknownRecord as any, compose(ktype(properties))) /** * @category combinators * @since 2.2.8 */ -export const composePartial: ( - properties: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder> = - /*#__PURE__*/ - K.composePartial(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) +export const kpartial =

>>( + properties: P +): Decoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => + K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** * @category combinators @@ -251,49 +249,44 @@ export const composePartial: ( */ export const partial = ( properties: { [K in keyof A]: Decoder } -): Decoder> => pipe(UnknownRecord, composePartial(properties)) +): Decoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) /** * @category combinators * @since 2.2.8 */ -export const composeArray: (item: Decoder) => (decoder: Decoder>) => Decoder> = - /*#__PURE__*/ - K.composeArray(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) +export const karray = (item: Decoder): Decoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.7 */ export const array = (item: Decoder): Decoder> => - pipe(UnknownArray, composeArray(item)) + pipe(UnknownArray, compose(karray(item))) /** * @category combinators * @since 2.2.8 */ -export const composeRecord: ( - codomain: Decoder -) => (decoder: Decoder>) => Decoder> = - /*#__PURE__*/ - K.composeRecord(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) +export const krecord = (codomain: Decoder): Decoder, Record> => + K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: Decoder): Decoder> => - pipe(UnknownRecord, composeRecord(codomain)) + pipe(UnknownRecord, compose(krecord(codomain))) /** * @category combinators * @since 2.2.8 */ -export const composeTuple: >( - ...components: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder = - /*#__PURE__*/ - K.composeTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any +export const ktuple = >>( + ...components: C +): Decoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => + K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators @@ -301,25 +294,17 @@ export const composeTuple: >( */ export const tuple = >( ...components: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownArray, composeTuple(...(components as any))) +): Decoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any /** * @category combinators * @since 2.2.7 */ -export const composeUnion: ]>( - ...members: { [K in keyof A]: Decoder } -) => (decoder: Decoder) => Decoder = +export const union: , ...Array>]>( + ...members: MS +) => Decoder, TypeOf> = /*#__PURE__*/ - K.composeUnion(M)((i, e) => FS.of(DE.member(i, e))) as any - -/** - * @category combinators - * @since 2.2.8 - */ -export const union = ]>( - ...members: { [K in keyof A]: Decoder } -): Decoder => pipe(id(), composeUnion(...(members as any))) + K.union(M)((i, e) => FS.of(DE.member(i, e))) /** * @category combinators @@ -333,15 +318,18 @@ export const intersect: (right: Decoder) => (left: Decoder< * @category combinators * @since 2.2.8 */ -export const composeSum: ( - tag: T -) => ( - members: { [K in keyof A]: Decoder } -) => (decoder: Decoder>) => Decoder = K.composeSum(M)((tag, value, keys) => - FS.of( - DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) - ) -) +export const ksum = (tag: T) => >>( + members: MS +): Decoder, TypeOf> => + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) + ) + )(tag)(members) /** * @category combinators @@ -349,7 +337,7 @@ export const composeSum: ( */ export const sum = (tag: T) => ( members: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord, composeSum(tag)(members)) +): Decoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index cde673f71..0b3fcab27 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -133,151 +133,130 @@ export type InputOf = KD extends Kleisli( - M: Monad2C & Bifunctor2 +export function type( + M: Applicative2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli { +) =>

>>( + properties: P +) => Kleisli }, E, { [K in keyof P]: TypeOf }> { const traverse = traverseRecordWithIndex(M) - return (onPropertyError) => (properties) => (decoder) => ({ - decode: (h) => - M.chain( - decoder.decode(h), - (ri) => - traverse(properties as Record>, (key, decoder) => - M.mapLeft(decoder.decode(ri[key]), (e) => onPropertyError(key, e)) - ) as any - ) + return (onPropertyError) => (properties) => ({ + decode: (i) => + traverse(properties as Record>, (key, decoder) => + M.mapLeft(decoder.decode(i[key]), (e) => onPropertyError(key, e)) + ) as any }) } /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ -export function composePartial( - M: Monad2C & Bifunctor2 +export function partial( + M: Applicative2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E -) => ( - properties: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli> { +) =>

>>( + properties: P +) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> { const traverse = traverseRecordWithIndex(M) const undefinedProperty = M.of>(E.right(undefined)) const skipProperty = M.of>(E.left(undefined)) - return (onPropertyError) => (properties) => (decoder) => ({ - decode: (h) => - M.chain( - decoder.decode(h), - (ri) => - M.map( - traverse(properties as Record>, (key, decoder) => { - const ikey = ri[key] - if (ikey === undefined) { - return key in ri - ? // don't strip undefined properties - undefinedProperty - : // don't add missing properties - skipProperty - } - return M.bimap( - decoder.decode(ikey), - (e) => onPropertyError(key, e), - (a) => E.right(a) - ) - }), - compactRecord - ) as any - ) + return (onPropertyError) => (properties) => ({ + decode: (i) => + M.map( + traverse(properties as Record>, (key, decoder) => { + const ikey = i[key] + if (ikey === undefined) { + return key in i + ? // don't strip undefined properties + undefinedProperty + : // don't add missing properties + skipProperty + } + return M.bimap( + decoder.decode(ikey), + (e) => onPropertyError(key, e), + (a) => E.right(a) + ) + }), + compactRecord + ) as any }) } /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ -export function composeArray( - M: Monad2C & Bifunctor2 -): ( - onItemError: (index: number, e: E) => E -) => (item: Kleisli) => (decoder: Kleisli>) => Kleisli> { +export function array( + M: Applicative2C & Bifunctor2 +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> { const traverse = traverseArrayWithIndex(M) - return (onItemError) => (item) => (decoder) => ({ - decode: (h) => - M.chain(decoder.decode(h), (is) => - traverse(is, (index, i) => M.mapLeft(item.decode(i), (e) => onItemError(index, e))) - ) + return (onItemError) => (item) => ({ + decode: (is) => traverse(is, (index, i) => M.mapLeft(item.decode(i), (e) => onItemError(index, e))) }) } /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ -export function composeRecord( - M: Monad2C & Bifunctor2 +export function record( + M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E -) => ( - codomain: Kleisli -) => (decoder: Kleisli>) => Kleisli> { +) => (codomain: Kleisli) => Kleisli, E, Record> { const traverse = traverseRecordWithIndex(M) - return (onKeyError) => (codomain) => (decoder) => ({ - decode: (h) => - M.chain(decoder.decode(h), (ri) => - traverse(ri, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) - ) + return (onKeyError) => (codomain) => ({ + decode: (ir) => traverse(ir, (key, i) => M.mapLeft(codomain.decode(i), (e) => onKeyError(key, e))) }) } /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ -export function composeTuple( - M: Monad2C & Bifunctor2 +export function tuple( + M: Applicative2C & Bifunctor2 ): ( onIndexError: (index: number, e: E) => E -) => >( - ...components: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli { +) => >>( + ...components: C +) => Kleisli }, E, { [K in keyof C]: TypeOf }> { const traverse = traverseArrayWithIndex(M) - return (onIndexError) => (...components) => (decoder) => ({ - decode: (h) => - M.chain( - decoder.decode(h), - (is) => - traverse((components as unknown) as Array>, (index, decoder) => - M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) - ) as any - ) + return (onIndexError) => (...components) => ({ + decode: (is) => + traverse((components as unknown) as Array>, (index, decoder) => + M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) + ) as any }) } /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ -export function composeUnion( - M: Monad2C & Alt2C & Bifunctor2 +export function union( + M: Alt2C & Bifunctor2 ): ( onMemberError: (index: number, e: E) => E -) => ]>( - ...members: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli) => Kleisli { - return (onMemberError) => (...members) => (decoder) => ({ - decode: (h) => - M.chain(decoder.decode(h), (i) => { - let out = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) - for (let index = 1; index < members.length; index++) { - out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) - } - return out - }) +) => , ...Array>]>( + ...members: MS +) => Kleisli, E, TypeOf> { + return (onMemberError) => , ...Array>]>( + ...members: MS + ) => ({ + decode: (i) => { + let out: Kind2> = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) + for (let index = 1; index < members.length; index++) { + out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) + } + return out + } }) } @@ -301,29 +280,30 @@ export function intersect( /** * @category combinators - * @since 2.2.8 + * @since 2.2.7 */ -export function composeSum( +export function sum( M: MonadThrow2C ): ( onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E ) => ( tag: T -) => ( - members: { [K in keyof A]: Kleisli } -) => (decoder: Kleisli>) => Kleisli { - return (onTagError) => (tag) => (members) => { +) => >>( + members: MS +) => Kleisli, E, TypeOf> { + return (onTagError) => (tag) => , A>( + members: { [K in keyof A]: Kleisli } + ): Kleisli => { const keys = Object.keys(members) - return (decoder) => ({ - decode: (h) => - M.chain(decoder.decode(h), (ri: any) => { - const v = ri[tag] - if (v in members) { - return (members as any)[v].decode(ri) - } - return M.throwError(onTagError(tag, v, keys)) - }) - }) + return { + decode: (ir) => { + const v = ir[tag] + if (v in members) { + return (members as any)[v].decode(ir) + } + return M.throwError(onTagError(tag, v, keys)) + } + } } } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 39f3042cc..f8b8fb77b 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -224,11 +224,10 @@ export const nullable: (or: TaskDecoder) => TaskDecoder( - properties: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder = - /*#__PURE__*/ - K.composeType(M)((k, e) => FS.of(DE.key(k, DE.required, e))) +export const ktype =

>>( + properties: P +): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => + K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators @@ -236,17 +235,16 @@ export const composeType: ( */ export const type = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord, composeType(properties)) +): TaskDecoder => pipe(UnknownRecord as any, compose(ktype(properties))) /** * @category combinators * @since 2.2.8 */ -export const composePartial: ( - properties: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder> = - /*#__PURE__*/ - K.composePartial(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) +export const kpartial =

>>( + properties: P +): TaskDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => + K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** * @category combinators @@ -254,51 +252,44 @@ export const composePartial: ( */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(UnknownRecord, composePartial(properties)) +): TaskDecoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) /** * @category combinators * @since 2.2.8 */ -export const composeArray: ( - item: TaskDecoder -) => (decoder: TaskDecoder>) => TaskDecoder> = - /*#__PURE__*/ - K.composeArray(M)((i, e) => FS.of(DE.index(i, DE.optional, e))) +export const karray = (item: TaskDecoder): TaskDecoder, Array> => + K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.7 */ export const array = (item: TaskDecoder): TaskDecoder> => - pipe(UnknownArray, composeArray(item)) + pipe(UnknownArray, compose(karray(item))) /** * @category combinators * @since 2.2.8 */ -export const composeRecord: ( - codomain: TaskDecoder -) => (decoder: TaskDecoder>) => TaskDecoder> = - /*#__PURE__*/ - K.composeRecord(M)((k, e) => FS.of(DE.key(k, DE.optional, e))) +export const krecord = (codomain: TaskDecoder): TaskDecoder, Record> => + K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - pipe(UnknownRecord, composeRecord(codomain)) + pipe(UnknownRecord, compose(krecord(codomain))) /** * @category combinators * @since 2.2.8 */ -export const composeTuple: >( - ...components: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder = - /*#__PURE__*/ - K.composeTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e))) as any +export const ktuple = >>( + ...components: C +): TaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => + K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators @@ -306,25 +297,17 @@ export const composeTuple: >( */ export const tuple = >( ...components: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownArray, composeTuple(...(components as any))) - -/** - * @category combinators - * @since 2.2.8 - */ -export const composeUnion: ]>( - ...members: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder) => TaskDecoder = - /*#__PURE__*/ - K.composeUnion(M)((i, e) => FS.of(DE.member(i, e))) as any +): TaskDecoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any /** * @category combinators * @since 2.2.7 */ -export const union = ]>( - ...members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(id(), composeUnion(...(members as any))) +export const union: , ...Array>]>( + ...members: MS +) => TaskDecoder, TypeOf> = + /*#__PURE__*/ + K.union(M)((i, e) => FS.of(DE.member(i, e))) /** * @category combinators @@ -340,17 +323,18 @@ export const intersect: ( * @category combinators * @since 2.2.8 */ -export const composeSum: ( - tag: T -) => ( - members: { [K in keyof A]: TaskDecoder } -) => (decoder: TaskDecoder>) => TaskDecoder = K.composeSum( - M -)((tag, value, keys) => - FS.of( - DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | '))) - ) -) +export const ksum = (tag: T) => >>( + members: MS +): TaskDecoder, TypeOf> => + K.sum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) + ) + )(tag)(members) /** * @category combinators @@ -358,7 +342,7 @@ export const composeSum: ( */ export const sum = (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord, composeSum(tag)(members)) +): TaskDecoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) /** * @category combinators From 327cd9ae8271074a3acad4141fdd0fda90082e6f Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 3 Jul 2020 19:14:40 +0200 Subject: [PATCH 124/222] add `object` primitive --- CHANGELOG.md | 3 +++ docs/modules/Decoder.ts.md | 20 +++++++++++++++++--- docs/modules/Guard.ts.md | 11 +++++++++++ docs/modules/Kleisli.ts.md | 6 +++--- docs/modules/TaskDecoder.ts.md | 20 +++++++++++++++++--- dtslint/ts3.5/Decoder.ts | 12 ++++++++++++ src/Decoder.ts | 20 ++++++++++++++------ src/Guard.ts | 8 ++++++++ src/Kleisli.ts | 6 +++--- src/TaskDecoder.ts | 20 ++++++++++++++------ test/Codec.ts | 6 +++--- test/Decoder.ts | 6 +++--- test/TaskDecoder.ts | 6 +++--- 13 files changed, 111 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3ba7446d..fbb3bdcfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - (\*) remove `JsonCodec` module (@gcanti) - `Decoder` - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) + - add `object` primitive (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromGuard` signature (@gcanti) - add `ktype` function (@gcanti) @@ -39,6 +40,7 @@ - add `InputOf` type (@gcanti) - `TaskDecoder` - (\*) make `TaskDecoder` more general by adding a `I` type parameter (@gcanti) + - add `object` primitive (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromDecoder` signature (@gcanti) - add `ktype` function (@gcanti) @@ -57,6 +59,7 @@ - `Guard` - (\*) make `Guard` more general by adding a `I` type parameter (@gcanti) - (\*) rename `schemableGuard` to `Schemable` (@gcanti) + - add `object` primitive (@gcanti) - add `InputOf` type (@gcanti) - add `alt` function (@gcanti) - add `zero` function (@gcanti) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 9c9d2ea61..f59bb2f85 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -70,6 +70,7 @@ Added in v2.2.7 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) + - [object](#object) - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) @@ -212,7 +213,10 @@ Added in v2.2.8 ```ts export declare const kpartial:

>>( properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }>> +) => Decoder< + Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, + Partial<{ [K in keyof P]: K.TypeOf<'Either', P[K]> }> +> ``` Added in v2.2.8 @@ -236,7 +240,7 @@ export declare const ksum: ( tag: T ) => >>( members: MS -) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> +) => Decoder>, K.TypeOf<'Either', MS[keyof MS]>> ``` Added in v2.2.8 @@ -260,7 +264,7 @@ Added in v2.2.8 ```ts export declare const ktype:

>>( properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> +) => Decoder }>, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> ``` Added in v2.2.8 @@ -545,6 +549,16 @@ export declare const number: Decoder Added in v2.2.7 +## object + +**Signature** + +```ts +export declare const object: Decoder +``` + +Added in v2.2.8 + ## string **Signature** diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 780060ee9..71928049c 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -48,6 +48,7 @@ Added in v2.2.0 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) + - [object](#object) - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) @@ -324,6 +325,16 @@ export declare const number: Guard Added in v2.2.0 +## object + +**Signature** + +```ts +export declare const object: Guard +``` + +Added in v2.2.8 + ## string **Signature** diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 25c0690b7..78660b735 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -179,7 +179,7 @@ export declare function partial( onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P -) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> +) => Kleisli }>, E, Partial<{ [K in keyof P]: TypeOf }>> ``` Added in v2.2.7 @@ -226,7 +226,7 @@ export declare function sum( tag: T ) => >>( members: MS -) => Kleisli, E, TypeOf> +) => Kleisli>, E, TypeOf> ``` Added in v2.2.7 @@ -258,7 +258,7 @@ export declare function type( onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P -) => Kleisli }, E, { [K in keyof P]: TypeOf }> +) => Kleisli }>, E, { [K in keyof P]: TypeOf }> ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index b9b429e27..6d7f97f1d 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -71,6 +71,7 @@ Added in v2.2.7 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) + - [object](#object) - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) @@ -214,7 +215,7 @@ Added in v2.2.8 export declare const kpartial:

>>( properties: P ) => TaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, Partial<{ [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> > ``` @@ -240,7 +241,7 @@ export declare const ksum: ( tag: T ) => >>( members: MS -) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> +) => TaskDecoder>, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.8 @@ -264,7 +265,10 @@ Added in v2.2.8 ```ts export declare const ktype:

>>( properties: P -) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +) => TaskDecoder< + Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, + { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> } +> ``` Added in v2.2.8 @@ -562,6 +566,16 @@ export declare const number: TaskDecoder Added in v2.2.7 +## object + +**Signature** + +```ts +export declare const object: TaskDecoder +``` + +Added in v2.2.8 + ## string **Signature** diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index db436be80..ba77cec83 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -33,6 +33,18 @@ _.type({ }) }) +// +// kpartial +// + +// $ExpectType Decoder; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> +_.kpartial({ + a: _.string, + b: _.kpartial({ + c: _.number + }) +}) + // // partial // diff --git a/src/Decoder.ts b/src/Decoder.ts index fcc5d02d3..5bb9e425f 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -178,6 +178,14 @@ export const UnknownRecord: Decoder> = /*#__PURE__*/ fromGuard(G.UnknownRecord, 'Record') +/** + * @category primitives + * @since 2.2.8 + */ +export const object: Decoder = + /*#__PURE__*/ + fromGuard(G.object, 'object') + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -223,7 +231,7 @@ export const nullable: (or: Decoder) => Decoder */ export const ktype =

>>( properties: P -): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => +): Decoder }>, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** @@ -232,7 +240,7 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord as any, compose(ktype(properties))) +): Decoder => pipe(object, compose(ktype(properties))) /** * @category combinators @@ -240,7 +248,7 @@ export const type = ( */ export const kpartial =

>>( properties: P -): Decoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => +): Decoder }>, Partial<{ [K in keyof P]: TypeOf }>> => K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** @@ -249,7 +257,7 @@ export const kpartial =

>>( */ export const partial = ( properties: { [K in keyof A]: Decoder } -): Decoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) +): Decoder> => pipe(object, compose(kpartial(properties))) /** * @category combinators @@ -320,7 +328,7 @@ export const intersect: (right: Decoder) => (left: Decoder< */ export const ksum = (tag: T) => >>( members: MS -): Decoder, TypeOf> => +): Decoder>, TypeOf> => K.sum(M)((tag, value, keys) => FS.of( DE.key( @@ -337,7 +345,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) +): Decoder => pipe(object, compose(ksum(tag)(members))) /** * @category combinators diff --git a/src/Guard.ts b/src/Guard.ts index 4186f631d..bbee2d299 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -95,6 +95,14 @@ export const UnknownRecord: Guard> = { is: (u: unknown): u is Record => Object.prototype.toString.call(u) === '[object Object]' } +/** + * @category primitives + * @since 2.2.8 + */ +export const object: Guard = { + is: (u: unknown): u is object => u != null && !string.is(u) && !number.is(u) && !boolean.is(u) +} + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 0b3fcab27..be0df4e76 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -141,7 +141,7 @@ export function type( onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P -) => Kleisli }, E, { [K in keyof P]: TypeOf }> { +) => Kleisli }>, E, { [K in keyof P]: TypeOf }> { const traverse = traverseRecordWithIndex(M) return (onPropertyError) => (properties) => ({ decode: (i) => @@ -161,7 +161,7 @@ export function partial( onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P -) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> { +) => Kleisli }>, E, Partial<{ [K in keyof P]: TypeOf }>> { const traverse = traverseRecordWithIndex(M) const undefinedProperty = M.of>(E.right(undefined)) const skipProperty = M.of>(E.left(undefined)) @@ -290,7 +290,7 @@ export function sum( tag: T ) => >>( members: MS -) => Kleisli, E, TypeOf> { +) => Kleisli>, E, TypeOf> { return (onTagError) => (tag) => , A>( members: { [K in keyof A]: Kleisli } ): Kleisli => { diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index f8b8fb77b..036f0200a 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -179,6 +179,14 @@ export const UnknownRecord: TaskDecoder> = /*#__PURE__*/ fromDecoder(D.UnknownRecord) +/** + * @category primitives + * @since 2.2.8 + */ +export const object: TaskDecoder = + /*#__PURE__*/ + fromDecoder(D.object) + // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -226,7 +234,7 @@ export const nullable: (or: TaskDecoder) => TaskDecoder>>( properties: P -): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => +): TaskDecoder }>, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** @@ -235,7 +243,7 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord as any, compose(ktype(properties))) +): TaskDecoder => pipe(object, compose(ktype(properties))) /** * @category combinators @@ -243,7 +251,7 @@ export const type = ( */ export const kpartial =

>>( properties: P -): TaskDecoder<{ [K in keyof P]: InputOf }, Partial<{ [K in keyof P]: TypeOf }>> => +): TaskDecoder }>, Partial<{ [K in keyof P]: TypeOf }>> => K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** @@ -252,7 +260,7 @@ export const kpartial =

>>( */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) +): TaskDecoder> => pipe(object, compose(kpartial(properties))) /** * @category combinators @@ -325,7 +333,7 @@ export const intersect: ( */ export const ksum = (tag: T) => >>( members: MS -): TaskDecoder, TypeOf> => +): TaskDecoder>, TypeOf> => K.sum(M)((tag, value, keys) => FS.of( DE.key( @@ -342,7 +350,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) +): TaskDecoder => pipe(object, compose(ksum(tag)(members))) /** * @category combinators diff --git a/test/Codec.ts b/test/Codec.ts index 6e074110a..a37a4cd08 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -241,7 +241,7 @@ describe('Codec', () => { const codec = C.type({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -317,7 +317,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = C.partial({ a: C.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -547,7 +547,7 @@ describe('Codec', () => { const A = C.type({ _tag: C.literal('A'), a: C.string }) const B = C.type({ _tag: C.literal('B'), b: C.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'Record')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'object')) assert.deepStrictEqual( codec.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/Decoder.ts b/test/Decoder.ts index 07c277d71..dc8c16cc3 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -192,7 +192,7 @@ describe('Decoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -253,7 +253,7 @@ describe('Decoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -478,7 +478,7 @@ describe('Decoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) assert.deepStrictEqual( decoder.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index f6ecef600..8e9814aec 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -204,7 +204,7 @@ describe('UnknownTaskDecoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -265,7 +265,7 @@ describe('UnknownTaskDecoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -493,7 +493,7 @@ describe('UnknownTaskDecoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'Record')) + assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'object')) assert.deepStrictEqual( await decoder.decode({})(), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) From c53c707e012f00f079ce016ad2a0055f65841dda Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 9 Jul 2020 09:23:05 +0200 Subject: [PATCH 125/222] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7177a0429..08a74cdbb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.7", + "version": "2.2.8", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", From 5761b6991485640277c43529839eadfb93c41c79 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 9 Jul 2020 13:52:35 +0200 Subject: [PATCH 126/222] make `Codec` more general by adding a `I` type parameter --- CHANGELOG.md | 3 + docs/modules/Codec.ts.md | 95 +++++++++++++----- docs/modules/Decoder.ts.md | 4 +- docs/modules/Schema.ts.md | 16 +-- dtslint/ts3.5/Codec.ts | 4 +- jest.config.js | 2 +- package-lock.json | 8 +- package.json | 2 +- src/Codec.ts | 140 +++++++++++++++----------- src/Decoder.ts | 11 +- src/Encoder.ts | 8 +- src/Guard.ts | 3 +- src/Kleisli.ts | 24 +++-- src/TaskDecoder.ts | 6 +- test/Codec.ts | 201 +++++++++++++++++-------------------- test/Decoder.ts | 45 ++------- test/Encoder.ts | 35 +++---- test/helpers.ts | 64 ++++++++++++ 18 files changed, 370 insertions(+), 301 deletions(-) create mode 100644 test/helpers.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index fbb3bdcfe..607a1b1f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ - (\*) remove `KleisliDecoder` module (@gcanti) - (\*) remove `KleisliTaskDecoder` module (@gcanti) - (\*) remove `JsonCodec` module (@gcanti) + - `Codec` + - (\*) make `Codec` more general by adding a `I` type parameter (@gcanti) + - add `compose` function (@gcanti) - `Decoder` - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) - add `object` primitive (@gcanti) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 6ce62b401..c8ad8866c 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -23,6 +23,7 @@ Added in v2.2.3 - [imap](#imap) - [combinators](#combinators) - [array](#array) + - [compose](#compose) - [intersect](#intersect) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) @@ -48,8 +49,10 @@ Added in v2.2.3 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) + - [object](#object) - [string](#string) - [utils](#utils) + - [InputOf (type alias)](#inputof-type-alias) - [OutputOf (type alias)](#outputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) @@ -62,7 +65,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec ``` Added in v2.2.3 @@ -74,17 +77,31 @@ Added in v2.2.3 **Signature** ```ts -export declare function array(item: Codec): Codec, Array> +export declare function array(item: Codec): Codec, Array> ``` Added in v2.2.3 +## compose + +**Signature** + +```ts +export declare const compose: ( + to: Codec +) => (from: Codec) => Codec +``` + +Added in v2.2.8 + ## intersect **Signature** ```ts -export declare const intersect: (right: Codec) => (left: Codec) => Codec +export declare const intersect: ( + right: Codec +) => (left: Codec) => Codec ``` Added in v2.2.3 @@ -94,7 +111,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function lazy(id: string, f: () => Codec): Codec +export declare function lazy(id: string, f: () => Codec): Codec ``` Added in v2.2.3 @@ -104,9 +121,9 @@ Added in v2.2.3 **Signature** ```ts -export declare const mapLeftWithInput: ( - f: (actual: unknown, e: FreeSemigroup>) => FreeSemigroup> -) => (codec: Codec) => Codec +export declare const mapLeftWithInput: ( + f: (i: I, e: FreeSemigroup>) => FreeSemigroup> +) => (codec: Codec) => Codec ``` Added in v2.2.3 @@ -116,7 +133,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function nullable(or: Codec): Codec +export declare function nullable(or: Codec): Codec ``` Added in v2.2.3 @@ -126,9 +143,9 @@ Added in v2.2.3 **Signature** ```ts -export declare function partial

>>( +export declare function partial

>>( properties: P -): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> +): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> ``` Added in v2.2.3 @@ -138,7 +155,9 @@ Added in v2.2.3 **Signature** ```ts -export declare function record(codomain: Codec): Codec, Record> +export declare function record( + codomain: Codec +): Codec, Record> ``` Added in v2.2.3 @@ -151,7 +170,7 @@ Added in v2.2.3 export declare const refine: ( refinement: (a: A) => a is B, id: string -) => (from: Codec) => Codec +) => (from: Codec) => Codec ``` Added in v2.2.3 @@ -163,7 +182,9 @@ Added in v2.2.3 ```ts export declare function sum( tag: T -): >>(members: M) => Codec, TypeOf> +): >>( + members: M +) => Codec, TypeOf> ``` Added in v2.2.3 @@ -173,9 +194,9 @@ Added in v2.2.3 **Signature** ```ts -export declare function tuple>>( +export declare function tuple>>( ...components: C -): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> +): Codec }, { [K in keyof C]: TypeOf }> ``` Added in v2.2.3 @@ -185,9 +206,9 @@ Added in v2.2.3 **Signature** ```ts -export declare function type

>>( +export declare function type

>>( properties: P -): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +): Codec }, { [K in keyof P]: TypeOf }> ``` Added in v2.2.3 @@ -199,7 +220,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function fromDecoder(decoder: D.Decoder): Codec +export declare function fromDecoder(decoder: D.Decoder): Codec ``` Added in v2.2.3 @@ -211,7 +232,7 @@ Added in v2.2.3 ```ts export declare function literal]>( ...values: A -): Codec +): Codec ``` Added in v2.2.3 @@ -221,7 +242,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec +export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec ``` Added in v2.2.3 @@ -233,7 +254,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const Invariant: Invariant2<'io-ts/Codec'> +export declare const Invariant: Invariant3<'io-ts/Codec'> ``` Added in v2.2.8 @@ -270,7 +291,7 @@ Laws: **Signature** ```ts -export interface Codec extends D.Decoder, E.Encoder {} +export interface Codec extends D.Decoder, E.Encoder {} ``` Added in v2.2.3 @@ -282,7 +303,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const UnknownArray: Codec +export declare const UnknownArray: Codec ``` Added in v2.2.3 @@ -292,7 +313,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const UnknownRecord: Codec, Record> +export declare const UnknownRecord: Codec, Record> ``` Added in v2.2.3 @@ -302,7 +323,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const boolean: Codec +export declare const boolean: Codec ``` Added in v2.2.3 @@ -312,23 +333,43 @@ Added in v2.2.3 **Signature** ```ts -export declare const number: Codec +export declare const number: Codec ``` Added in v2.2.3 +## object + +**Signature** + +```ts +export declare const object: Codec +``` + +Added in v2.2.8 + ## string **Signature** ```ts -export declare const string: Codec +export declare const string: Codec ``` Added in v2.2.3 # utils +## InputOf (type alias) + +**Signature** + +```ts +export type InputOf = D.InputOf +``` + +Added in v2.2.8 + ## OutputOf (type alias) **Signature** diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index f59bb2f85..69159ff24 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -576,7 +576,7 @@ Added in v2.2.7 **Signature** ```ts -export type InputOf = K.InputOf +export type InputOf = K.InputOf ``` Added in v2.2.8 @@ -586,7 +586,7 @@ Added in v2.2.8 **Signature** ```ts -export type TypeOf = K.TypeOf +export type TypeOf = K.TypeOf ``` Added in v2.2.7 diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 909740f89..1fa845621 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -73,16 +73,7 @@ Added in v2.2.0 ```ts export declare const interpreter: { - < - S extends - | 'io-ts/Codec' - | 'Either' - | 'io-ts/Decoder' - | 'io-ts/Encoder' - | 'io-ts/TaskDecoder' - | 'IOEither' - | 'TaskEither' - >( + ( S: Schemable2C ): (schema: Schema) => Kind2 < @@ -90,16 +81,15 @@ export declare const interpreter: { | 'Eq' | 'io-ts/Guard' | 'io-ts/JsonEncoder' - | 'io-ts/Type' - | 'Ord' | 'Option' | 'ReadonlyRecord' - | 'ReadonlyNonEmptyArray' + | 'Ord' | 'NonEmptyArray' | 'Array' | 'Record' | 'IO' | 'Task' + | 'io-ts/Type' >( S: Schemable1 ): (schema: Schema) => Kind diff --git a/dtslint/ts3.5/Codec.ts b/dtslint/ts3.5/Codec.ts index c978244df..d7d3fa558 100644 --- a/dtslint/ts3.5/Codec.ts +++ b/dtslint/ts3.5/Codec.ts @@ -1,6 +1,6 @@ import * as _ from '../../src/Codec' -// $ExpectType Codec<{ a: string; b: { c: number; }; }, { a: string; b: { c: number; }; }> +// $ExpectType Codec _.type({ a: _.string, b: _.type({ @@ -8,7 +8,7 @@ _.type({ }) }) -// $ExpectType Codec; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> +// $ExpectType Codec; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> _.partial({ a: _.string, b: _.partial({ diff --git a/jest.config.js b/jest.config.js index ea4cd8f60..80716b030 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,5 +16,5 @@ module.exports = { statements: 100 } }, - modulePathIgnorePatterns: ['2.1.x/helpers.ts', 'Arbitrary.ts'] + modulePathIgnorePatterns: ['2.1.x/helpers.ts', 'Arbitrary.ts', 'helpers.ts'] } diff --git a/package-lock.json b/package-lock.json index 0856ba63b..454757640 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.5", + "version": "2.2.8", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2599,9 +2599,9 @@ "dev": true }, "fp-ts": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.3.tgz", - "integrity": "sha512-lQd+hahLd8cygNoXbEHDjH/cbF6XVWlEPb8h5GXXlozjCSDxWgclvkpOoTRfBA0P+r69l9VvW1nEsSGIJRQpWw==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.7.0.tgz", + "integrity": "sha512-J7EIg4MEVuOm1vZspQDVYRD/CTsQECQk01cP5VEBvQ5LnSSjp6sckun1m1eUPSuvtMIlGgm9NqqOxE0+QyntWQ==", "dev": true }, "fragment-cache": { diff --git a/package.json b/package.json index 08a74cdbb..2b7ee7bf8 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", "fast-check": "^1.24.2", - "fp-ts": "2.5.3", + "fp-ts": "^2.7.0", "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", diff --git a/src/Codec.ts b/src/Codec.ts index f7eb41c18..d042e5227 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -9,7 +9,7 @@ * @since 2.2.3 */ import { identity } from 'fp-ts/lib/function' -import { Invariant2 } from 'fp-ts/lib/Invariant' +import { Invariant3 } from 'fp-ts/lib/Invariant' import { pipe } from 'fp-ts/lib/pipeable' import * as D from './Decoder' import * as E from './Encoder' @@ -28,21 +28,7 @@ import { Literal } from './Schemable' * @category model * @since 2.2.3 */ -export interface Codec extends D.Decoder, E.Encoder {} - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.3 - */ -export type TypeOf = E.TypeOf - -/** - * @since 2.2.3 - */ -export type OutputOf = E.OutputOf +export interface Codec extends D.Decoder, E.Encoder {} // ------------------------------------------------------------------------------------- // constructors @@ -52,7 +38,7 @@ export type OutputOf = E.OutputOf * @category constructors * @since 2.2.3 */ -export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { +export function make(decoder: D.Decoder, encoder: E.Encoder): Codec { return { decode: decoder.decode, encode: encoder.encode @@ -63,7 +49,7 @@ export function make(decoder: D.Decoder, encoder: E.Encoder(decoder: D.Decoder): Codec { +export function fromDecoder(decoder: D.Decoder): Codec { return { decode: decoder.decode, encode: identity @@ -74,7 +60,9 @@ export function fromDecoder(decoder: D.Decoder): Codec { * @category constructors * @since 2.2.3 */ -export function literal]>(...values: A): Codec { +export function literal]>( + ...values: A +): Codec { return fromDecoder(D.literal(...values)) } @@ -86,31 +74,41 @@ export function literal]>(...valu * @category primitives * @since 2.2.3 */ -export const string: Codec = fromDecoder(D.string) +export const string: Codec = + /*#__PURE__*/ + fromDecoder(D.string) /** * @category primitives * @since 2.2.3 */ -export const number: Codec = fromDecoder(D.number) +export const number: Codec = + /*#__PURE__*/ + fromDecoder(D.number) /** * @category primitives * @since 2.2.3 */ -export const boolean: Codec = fromDecoder(D.boolean) +export const boolean: Codec = + /*#__PURE__*/ + fromDecoder(D.boolean) /** * @category primitives * @since 2.2.3 */ -export const UnknownArray: Codec, Array> = fromDecoder(D.UnknownArray) +export const UnknownArray: Codec, Array> = + /*#__PURE__*/ + fromDecoder(D.UnknownArray) /** * @category primitives * @since 2.2.3 */ -export const UnknownRecord: Codec, Record> = fromDecoder(D.UnknownRecord) +export const UnknownRecord: Codec, Record> = + /*#__PURE__*/ + fromDecoder(D.UnknownRecord) // ------------------------------------------------------------------------------------- // combinators @@ -120,9 +118,9 @@ export const UnknownRecord: Codec, Record D.DecodeError) => ( - codec: Codec -): Codec => make(pipe(codec, D.mapLeftWithInput(f)), codec) +export const mapLeftWithInput = (f: (i: I, e: D.DecodeError) => D.DecodeError) => ( + codec: Codec +): Codec => make(pipe(codec, D.mapLeftWithInput(f)), codec) /** * @category combinators @@ -131,7 +129,7 @@ export const mapLeftWithInput = (f: (actual: unknown, e: D.DecodeError) => D.Dec export const refine = ( refinement: (a: A) => a is B, id: string -): ((from: Codec) => Codec) => { +): ((from: Codec) => Codec) => { const refine = D.refine(refinement, id) return (from) => make(refine(from), from) } @@ -140,7 +138,7 @@ export const refine = ( * @category combinators * @since 2.2.3 */ -export function nullable(or: Codec): Codec { +export function nullable(or: Codec): Codec { return make(D.nullable(or), E.nullable(or)) } @@ -148,30 +146,27 @@ export function nullable(or: Codec): Codec { * @category combinators * @since 2.2.3 */ -export function type

>>( +export function type

>>( properties: P -): Codec<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { - const decoder: D.Decoder }> = D.type(properties) as any - return make(decoder, E.type(properties)) +): Codec }, { [K in keyof P]: TypeOf }> { + return make(D.type(properties) as any, E.type(properties)) } /** * @category combinators * @since 2.2.3 */ -export function partial

>>( +export function partial

>>( properties: P -): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> { - // these two `any`s are required to make typescript@3.5 compile - // vvvvvv vvvvvv - return make(D.partial(properties as any), E.partial(properties)) as any +): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> { + return make(D.partial(properties) as any, E.partial(properties)) } /** * @category combinators * @since 2.2.3 */ -export function record(codomain: Codec): Codec, Record> { +export function record(codomain: Codec): Codec, Record> { return make(D.record(codomain), E.record(codomain)) } @@ -179,7 +174,7 @@ export function record(codomain: Codec): Codec, Re * @category combinators * @since 2.2.3 */ -export function array(item: Codec): Codec, Array> { +export function array(item: Codec): Codec, Array> { return make(D.array(item), E.array(item)) } @@ -187,19 +182,19 @@ export function array(item: Codec): Codec, Array> { * @category combinators * @since 2.2.3 */ -export function tuple>>( +export function tuple>>( ...components: C -): Codec<{ [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> { - const decoder: D.Decoder }> = D.tuple(...components) as any - const encoder = E.tuple(...components) - return make(decoder, encoder) +): Codec }, { [K in keyof C]: TypeOf }> { + return make(D.tuple(...components) as any, E.tuple(...components)) } /** * @category combinators * @since 2.2.3 */ -export const intersect = (right: Codec): ((left: Codec) => Codec) => { +export const intersect = ( + right: Codec +): ((left: Codec) => Codec) => { const intersectD = D.intersect(right) const intersectE = E.intersect(right) return (left) => make(intersectD(left), intersectE(left)) @@ -211,7 +206,9 @@ export const intersect = (right: Codec): ((left: Codec) */ export function sum( tag: T -): >>(members: M) => Codec, TypeOf> { +): >>( + members: M +) => Codec, TypeOf> { const sumD = D.sum(tag) const sumE = E.sum(tag) return (members) => make(sumD(members), sumE(members)) @@ -221,10 +218,24 @@ export function sum( * @category combinators * @since 2.2.3 */ -export function lazy(id: string, f: () => Codec): Codec { +export function lazy(id: string, f: () => Codec): Codec { return make(D.lazy(id, f), E.lazy(f)) } +/** + * @category combinators + * @since 2.2.8 + */ +export const compose = (to: Codec) => ( + from: Codec +): Codec => make(D.compose(to)(from), E.compose(from)(to)) + +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- + +const imap_: Invariant3['imap'] = (fa, f, g) => make(D.Functor.map(fa, f), E.Contravariant.contramap(fa, g)) + // ------------------------------------------------------------------------------------- // pipeables // ------------------------------------------------------------------------------------- @@ -233,11 +244,9 @@ export function lazy(id: string, f: () => Codec): Codec { * @category Invariant * @since 2.2.3 */ -export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec = (f, g) => (fa) => - imap_(fa, f, g) - -const imap_: (fa: Codec, f: (a: A) => B, g: (b: B) => A) => Codec = (fa, f, g) => - make(D.Functor.map(fa, f), E.Contravariant.contramap(fa, g)) +export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec = (f, g) => ( + fa +) => imap_(fa, f, g) // ------------------------------------------------------------------------------------- // instances @@ -256,8 +265,8 @@ export const URI = 'io-ts/Codec' export type URI = typeof URI declare module 'fp-ts/lib/HKT' { - interface URItoKind2 { - readonly [URI]: Codec + interface URItoKind3 { + readonly [URI]: Codec } } @@ -265,7 +274,26 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.8 */ -export const Invariant: Invariant2 = { +export const Invariant: Invariant3 = { URI, imap: imap_ } + +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 2.2.8 + */ +export type InputOf = D.InputOf + +/** + * @since 2.2.3 + */ +export type OutputOf = E.OutputOf + +/** + * @since 2.2.3 + */ +export type TypeOf = E.TypeOf diff --git a/src/Decoder.ts b/src/Decoder.ts index 5bb9e425f..c5e6fbafd 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -179,8 +179,7 @@ export const UnknownRecord: Decoder> = fromGuard(G.UnknownRecord, 'Record') /** - * @category primitives - * @since 2.2.8 + * @internal */ export const object: Decoder = /*#__PURE__*/ @@ -485,14 +484,14 @@ export const Schemable: S.Schemable2C & // ------------------------------------------------------------------------------------- /** - * @since 2.2.7 + * @since 2.2.8 */ -export type TypeOf = K.TypeOf +export type InputOf = K.InputOf /** - * @since 2.2.8 + * @since 2.2.7 */ -export type InputOf = K.InputOf +export type TypeOf = K.TypeOf interface Tree { readonly value: A diff --git a/src/Encoder.ts b/src/Encoder.ts index 0bf37d10a..f06ad8832 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -157,13 +157,11 @@ export function lazy(f: () => Encoder): Encoder { // non-pipeables // ------------------------------------------------------------------------------------- -const contramap_: (fa: Encoder, f: (b: B) => A) => Encoder = (fa, f) => ({ - encode: (b) => fa.encode(f(b)) +const contramap_: (ea: Encoder, f: (b: B) => A) => Encoder = (ea, f) => ({ + encode: (b) => ea.encode(f(b)) }) -const compose_: (ab: Encoder, la: Encoder) => Encoder = (ab, ea) => ({ - encode: (b) => ea.encode(ab.encode(b)) -}) +const compose_: (ab: Encoder, ea: Encoder) => Encoder = (ab, ea) => contramap_(ea, ab.encode) // ------------------------------------------------------------------------------------- // pipeables diff --git a/src/Guard.ts b/src/Guard.ts index bbee2d299..b9282e754 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -96,8 +96,7 @@ export const UnknownRecord: Guard> = { } /** - * @category primitives - * @since 2.2.8 + * @internal */ export const object: Guard = { is: (u: unknown): u is object => u != null && !string.is(u) && !number.is(u) && !boolean.is(u) diff --git a/src/Kleisli.ts b/src/Kleisli.ts index be0df4e76..54d1c8d3b 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -121,16 +121,6 @@ export function nullable( }) } -/** - * @since 2.2.7 - */ -export type TypeOf = KD extends Kleisli ? A : never - -/** - * @since 2.2.7 - */ -export type InputOf = KD extends Kleisli ? I : never - /** * @category combinators * @since 2.2.7 @@ -423,3 +413,17 @@ const compactRecord = (r: Record>): Record = KD extends Kleisli ? A : never + +/** + * @since 2.2.7 + */ +export type InputOf = KD extends Kleisli ? I : never diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 036f0200a..55cc66660 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -179,11 +179,7 @@ export const UnknownRecord: TaskDecoder> = /*#__PURE__*/ fromDecoder(D.UnknownRecord) -/** - * @category primitives - * @since 2.2.8 - */ -export const object: TaskDecoder = +const object: TaskDecoder = /*#__PURE__*/ fromDecoder(D.object) diff --git a/test/Codec.ts b/test/Codec.ts index a37a4cd08..8bf1d8846 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -1,51 +1,36 @@ import * as assert from 'assert' -import * as C from '../src/Codec' +import * as _ from '../src/Codec' import * as D from '../src/Decoder' -import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' import * as E from 'fp-ts/lib/Either' +import * as H from './helpers' +import { id } from '../src/Encoder' -const NumberFromString: C.Codec = C.make( - pipe( - D.string, - D.parse((s) => { - const n = parseFloat(s) - return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) - }) - ), - { encode: String } -) +const codecString: _.Codec = _.make(D.string, id()) -interface PositiveBrand { - readonly Positive: unique symbol -} -type Positive = number & PositiveBrand -const Positive: C.Codec = pipe( - C.number, - C.refine((n): n is Positive => n > 0, 'Positive') +const codecNumberFromString: _.Codec = _.make( + H.decoderNumberFromString, + H.encoderNumberToString ) -interface IntBrand { - readonly Int: unique symbol -} -type Int = number & IntBrand -const Int: C.Codec = pipe( - C.number, - C.refine((n): n is Int => Number.isInteger(n), 'Int') +const codecNumberFromUnknownString: _.Codec = pipe( + codecString, + _.compose(codecNumberFromString) ) -const undefinedGuard: G.Guard = { - is: (u): u is undefined => u === undefined -} -const undef: C.Codec = C.fromDecoder(D.fromGuard(undefinedGuard, 'undefined')) +const codecPositive: _.Codec = _.fromDecoder(H.decoderPositive) + +const codecInt: _.Codec = _.fromDecoder(H.decoderInt) + +const codecUndefined: _.Codec = _.fromDecoder(H.decoderUndefined) describe('Codec', () => { describe('Invariant', () => { it('imap', () => { - const codec = C.Invariant.imap( - C.string, + const codec = _.Invariant.imap( + _.string, (s) => ({ value: s }), ({ value }) => value ) @@ -56,8 +41,8 @@ describe('Codec', () => { it('imap', () => { const codec = pipe( - C.string, - C.imap( + _.string, + _.imap( (s) => ({ value: s }), ({ value }) => value ) @@ -70,8 +55,8 @@ describe('Codec', () => { describe('decode', () => { it('should, return the provided expected', () => { const decoder = pipe( - C.number, - C.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) + _.number, + _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) ) assert.deepStrictEqual(decoder.decode('a'), D.failure('a', 'not a number')) }) @@ -81,12 +66,12 @@ describe('Codec', () => { describe('string', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.string + const codec = _.string assert.deepStrictEqual(codec.decode('a'), D.success('a')) }) it('should reject an invalid input', () => { - const codec = C.string + const codec = _.string assert.deepStrictEqual(codec.decode(null), D.failure(null, 'string')) }) }) @@ -95,12 +80,12 @@ describe('Codec', () => { describe('number', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.number + const codec = _.number assert.deepStrictEqual(codec.decode(1), D.success(1)) }) it('should reject an invalid input', () => { - const codec = C.number + const codec = _.number assert.deepStrictEqual(codec.decode(null), D.failure(null, 'number')) }) }) @@ -109,13 +94,13 @@ describe('Codec', () => { describe('boolean', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.boolean + const codec = _.boolean assert.deepStrictEqual(codec.decode(true), D.success(true)) assert.deepStrictEqual(codec.decode(false), D.success(false)) }) it('should reject an invalid input', () => { - const codec = C.boolean + const codec = _.boolean assert.deepStrictEqual(codec.decode(null), D.failure(null, 'boolean')) }) }) @@ -124,20 +109,20 @@ describe('Codec', () => { describe('literal', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.literal('a', null, 'b', 1, true) + const codec = _.literal('a', null, 'b', 1, true) assert.deepStrictEqual(codec.decode('a'), D.success('a')) assert.deepStrictEqual(codec.decode(null), D.success(null)) }) it('should reject an invalid input', () => { - const codec = C.literal('a', null) + const codec = _.literal('a', null) assert.deepStrictEqual(codec.decode('b'), D.failure('b', '"a" | null')) }) }) describe('encode', () => { it('should encode a value', () => { - const codec = C.literal('a') + const codec = _.literal('a') assert.deepStrictEqual(codec.encode('a'), 'a') }) }) @@ -147,16 +132,16 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { const codec = pipe( - C.string, - C.refine((s): s is string => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') ) assert.deepStrictEqual(codec.decode('a'), D.success('a')) }) it('should reject an invalid input', () => { const codec = pipe( - C.string, - C.refine((s): s is string => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') ) assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'string')) assert.deepStrictEqual(codec.decode(''), D.failure('', 'NonEmptyString')) @@ -166,8 +151,8 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { const codec = pipe( - C.string, - C.refine((s): s is string => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is string => s.length > 0, 'NonEmptyString') ) assert.strictEqual(codec.encode('a'), 'a') }) @@ -177,13 +162,13 @@ describe('Codec', () => { describe('nullable', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.nullable(NumberFromString) + const codec = _.nullable(codecNumberFromUnknownString) assert.deepStrictEqual(codec.decode(null), D.success(null)) assert.deepStrictEqual(codec.decode('1'), D.success(1)) }) it('should reject an invalid input', () => { - const codec = C.nullable(NumberFromString) + const codec = _.nullable(codecNumberFromUnknownString) assert.deepStrictEqual( codec.decode(undefined), E.left( @@ -207,7 +192,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = C.nullable(NumberFromString) + const codec = _.nullable(codecNumberFromUnknownString) assert.strictEqual(codec.encode(null), null) assert.strictEqual(codec.encode(1), '1') }) @@ -217,29 +202,29 @@ describe('Codec', () => { describe('type', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.type({ - a: C.string + const codec = _.type({ + a: _.string }) assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) }) it('should strip additional fields', () => { - const codec = C.type({ - a: C.string + const codec = _.type({ + a: _.string }) assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', () => { - const codec = C.type({ - a: undef + const codec = _.type({ + a: codecUndefined }) assert.deepStrictEqual(codec.decode({}), D.success({ a: undefined })) }) it('should reject an invalid input', () => { - const codec = C.type({ - a: C.string + const codec = _.type({ + a: _.string }) assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( @@ -249,9 +234,9 @@ describe('Codec', () => { }) it('should collect all errors', () => { - const codec = C.type({ - a: C.string, - b: C.number + const codec = _.type({ + a: _.string, + b: _.number }) assert.deepStrictEqual( codec.decode({}), @@ -273,19 +258,19 @@ describe('Codec', () => { return 'b' } } - const codec = C.type({ a: C.string, b: C.string }) + const codec = _.type({ a: _.string, b: _.string }) assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) }) }) describe('encode', () => { it('should encode a value', () => { - const codec = C.type({ a: NumberFromString }) + const codec = _.type({ a: codecNumberFromUnknownString }) assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) }) it('should strip additional fields', () => { - const codec = C.type({ a: C.number }) + const codec = _.type({ a: _.number }) const a = { a: 1, b: true } assert.deepStrictEqual(codec.encode(a), { a: 1 }) }) @@ -295,28 +280,28 @@ describe('Codec', () => { describe('partial', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) assert.deepStrictEqual(codec.decode({}), D.success({})) }) it('should strip additional fields', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) }) it('should not add missing fields', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.decode({}), D.success({})) }) it('should not strip fields corresponding to undefined values', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.decode({ a: undefined }), D.success({ a: undefined })) }) it('should reject an invalid input', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) assert.deepStrictEqual( codec.decode({ a: 1 }), @@ -325,9 +310,9 @@ describe('Codec', () => { }) it('should collect all errors', () => { - const codec = C.partial({ - a: C.string, - b: C.number + const codec = _.partial({ + a: _.string, + b: _.number }) assert.deepStrictEqual( codec.decode({ a: 1, b: 'b' }), @@ -349,31 +334,31 @@ describe('Codec', () => { return 'b' } } - const codec = C.partial({ a: C.string, b: C.string }) + const codec = _.partial({ a: _.string, b: _.string }) assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) }) }) describe('encode', () => { it('should encode a value', () => { - const codec = C.partial({ a: NumberFromString }) + const codec = _.partial({ a: codecNumberFromUnknownString }) assert.deepStrictEqual(codec.encode({}), {}) assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) }) it('should strip additional fields', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) const a = { a: 'a', b: true } assert.deepStrictEqual(codec.encode(a), { a: 'a' }) }) it('should not add missing fields', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.encode({}), {}) }) it('should not strip fields corresponding to undefined values', () => { - const codec = C.partial({ a: C.string }) + const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.encode({ a: undefined }), { a: undefined }) }) }) @@ -382,13 +367,13 @@ describe('Codec', () => { describe('record', () => { describe('decode', () => { it('should decode a valid value', () => { - const codec = C.record(C.number) + const codec = _.record(_.number) assert.deepStrictEqual(codec.decode({}), D.success({})) assert.deepStrictEqual(codec.decode({ a: 1 }), D.success({ a: 1 })) }) it('should reject an invalid value', () => { - const codec = C.record(C.number) + const codec = _.record(_.number) assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 'a' }), @@ -397,7 +382,7 @@ describe('Codec', () => { }) it('should collect all errors', () => { - const codec = C.record(C.number) + const codec = _.record(_.number) assert.deepStrictEqual( codec.decode({ a: 'a', b: 'b' }), E.left( @@ -412,7 +397,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = C.record(NumberFromString) + const codec = _.record(codecNumberFromUnknownString) assert.deepStrictEqual(codec.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) }) }) @@ -421,19 +406,19 @@ describe('Codec', () => { describe('array', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.array(C.string) + const codec = _.array(_.string) assert.deepStrictEqual(codec.decode([]), D.success([])) assert.deepStrictEqual(codec.decode(['a']), D.success(['a'])) }) it('should reject an invalid input', () => { - const codec = C.array(C.string) + const codec = _.array(_.string) assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) assert.deepStrictEqual(codec.decode([1]), E.left(FS.of(DE.index(0, DE.optional, FS.of(DE.leaf(1, 'string')))))) }) it('should collect all errors', () => { - const codec = C.array(C.string) + const codec = _.array(_.string) assert.deepStrictEqual( codec.decode([1, 2]), E.left( @@ -448,7 +433,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = C.array(NumberFromString) + const codec = _.array(codecNumberFromUnknownString) assert.deepStrictEqual(codec.encode([1, 2]), ['1', '2']) }) }) @@ -457,16 +442,16 @@ describe('Codec', () => { describe('tuple', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = C.tuple(C.string, C.number) + const codec = _.tuple(_.string, _.number) assert.deepStrictEqual(codec.decode(['a', 1]), D.success(['a', 1])) }) it('should handle zero components', () => { - assert.deepStrictEqual(C.tuple().decode([]), D.success([])) + assert.deepStrictEqual(_.tuple().decode([]), D.success([])) }) it('should reject an invalid input', () => { - const codec = C.tuple(C.string, C.number) + const codec = _.tuple(_.string, _.number) assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Array')) assert.deepStrictEqual( codec.decode(['a']), @@ -479,7 +464,7 @@ describe('Codec', () => { }) it('should collect all errors', () => { - const codec = C.tuple(C.string, C.number) + const codec = _.tuple(_.string, _.number) assert.deepStrictEqual( codec.decode([1, 'a']), E.left( @@ -492,14 +477,14 @@ describe('Codec', () => { }) it('should strip additional components', () => { - const codec = C.tuple(C.string, C.number) + const codec = _.tuple(_.string, _.number) assert.deepStrictEqual(codec.decode(['a', 1, true]), D.success(['a', 1])) }) }) describe('encode', () => { it('should encode a value', () => { - const codec = C.tuple(NumberFromString, C.string) + const codec = _.tuple(codecNumberFromUnknownString, _.string) assert.deepStrictEqual(codec.encode([1, 'a']), ['1', 'a']) }) }) @@ -508,44 +493,44 @@ describe('Codec', () => { describe('intersect', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = pipe(C.type({ a: C.string }), C.intersect(C.type({ b: C.number }))) + const codec = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a', b: 1 })) }) it('should handle primitives', () => { - const codec = pipe(Int, C.intersect(Positive)) + const codec = pipe(codecInt, _.intersect(codecPositive)) assert.deepStrictEqual(codec.decode(1), D.success(1)) }) }) describe('encode', () => { it('should encode a value', () => { - const codec = pipe(C.type({ a: C.string }), C.intersect(C.type({ b: NumberFromString }))) + const codec = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: codecNumberFromUnknownString }))) assert.deepStrictEqual(codec.encode({ a: 'a', b: 1 }), { a: 'a', b: '1' }) }) it('should handle primitives', () => { - const codec = pipe(Int, C.intersect(Positive)) + const codec = pipe(codecInt, _.intersect(codecPositive)) assert.deepStrictEqual(codec.encode(1 as any), 1) }) }) }) describe('sum', () => { - const sum = C.sum('_tag') + const sum = _.sum('_tag') describe('decode', () => { it('should decode a valid input', () => { - const A = C.type({ _tag: C.literal('A'), a: C.string }) - const B = C.type({ _tag: C.literal('B'), b: C.number }) + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) const codec = sum({ A, B }) assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), D.success({ _tag: 'A', a: 'a' })) assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), D.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { - const A = C.type({ _tag: C.literal('A'), a: C.string }) - const B = C.type({ _tag: C.literal('B'), b: C.number }) + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: _.number }) const codec = sum({ A, B }) assert.deepStrictEqual(codec.decode(null), D.failure(null, 'object')) assert.deepStrictEqual( @@ -569,8 +554,8 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const A = C.type({ _tag: C.literal('A'), a: C.string }) - const B = C.type({ _tag: C.literal('B'), b: NumberFromString }) + const A = _.type({ _tag: _.literal('A'), a: _.string }) + const B = _.type({ _tag: _.literal('B'), b: codecNumberFromUnknownString }) const codec = sum({ A, B }) assert.deepStrictEqual(codec.encode({ _tag: 'A', a: 'a' }), { _tag: 'A', a: 'a' }) assert.deepStrictEqual(codec.encode({ _tag: 'B', b: 1 }), { _tag: 'B', b: '1' }) @@ -588,8 +573,8 @@ describe('Codec', () => { b?: AOut } - const lazyCodec: C.Codec = C.lazy('A', () => - pipe(C.type({ a: NumberFromString }), C.intersect(C.partial({ b: lazyCodec }))) + const lazyCodec: _.Codec = _.lazy('A', () => + pipe(_.type({ a: codecNumberFromUnknownString }), _.intersect(_.partial({ b: lazyCodec }))) ) describe('decode', () => { diff --git a/test/Decoder.ts b/test/Decoder.ts index dc8c16cc3..12f7e89d9 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -3,39 +3,8 @@ import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' -import * as G from '../src/Guard' import * as _ from '../src/Decoder' - -const undefinedGuard: G.Guard = { - is: (u): u is undefined => u === undefined -} -const undef: _.Decoder = _.fromGuard(undefinedGuard, 'undefined') - -const NumberFromString: _.Decoder = pipe( - _.string, - _.parse((s) => { - const n = parseFloat(s) - return isNaN(n) ? _.failure(s, 'parsable to a number') : _.success(n) - }) -) - -interface PositiveBrand { - readonly Positive: unique symbol -} -type Positive = number & PositiveBrand -const Positive: _.Decoder = pipe( - _.number, - _.refine((n): n is Positive => n > 0, 'Positive') -) - -interface IntBrand { - readonly Int: unique symbol -} -type Int = number & IntBrand -const Int: _.Decoder = pipe( - _.number, - _.refine((n): n is Int => Number.isInteger(n), 'Int') -) +import * as H from './helpers' describe('Decoder', () => { // ------------------------------------------------------------------------------------- @@ -138,13 +107,13 @@ describe('Decoder', () => { describe('nullable', () => { it('should decode a valid input', () => { - const decoder = _.nullable(NumberFromString) + const decoder = _.nullable(H.decoderNumberFromUnknownString) assert.deepStrictEqual(decoder.decode(null), _.success(null)) assert.deepStrictEqual(decoder.decode('1'), _.success(1)) }) it('should reject an invalid input', () => { - const decoder = _.nullable(NumberFromString) + const decoder = _.nullable(H.decoderNumberFromUnknownString) assert.deepStrictEqual( decoder.decode(undefined), E.left( @@ -183,7 +152,7 @@ describe('Decoder', () => { it('should not strip fields corresponding to undefined values', async () => { const decoder = _.type({ - a: undef + a: H.decoderUndefined }) assert.deepStrictEqual(decoder.decode({}), _.success({ a: undefined })) }) @@ -437,7 +406,7 @@ describe('Decoder', () => { }) it('should handle primitives', () => { - const decoder = pipe(Int, _.intersect(Positive)) + const decoder = pipe(H.decoderInt, _.intersect(H.decoderPositive)) assert.deepStrictEqual(decoder.decode(1), _.success(1)) }) @@ -504,7 +473,7 @@ describe('Decoder', () => { } const lazyDecoder: _.Decoder = _.lazy('A', () => - pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) + pipe(_.type({ a: H.decoderNumberFromUnknownString }), _.intersect(_.partial({ b: lazyDecoder }))) ) describe('lazy', () => { @@ -589,7 +558,7 @@ required property "d" }) it('fromRefinement', () => { - const IntFromNumber = _.fromRefinement((n: number): n is Int => Number.isInteger(n), 'IntFromNumber') + const IntFromNumber = _.fromRefinement((n: number): n is H.Int => Number.isInteger(n), 'IntFromNumber') assert.deepStrictEqual(IntFromNumber.decode(1), _.success(1)) assert.deepStrictEqual(IntFromNumber.decode(1.2), _.failure(1.2, 'IntFromNumber')) }) diff --git a/test/Encoder.ts b/test/Encoder.ts index 260a6e3b6..4bedd9563 100644 --- a/test/Encoder.ts +++ b/test/Encoder.ts @@ -1,39 +1,32 @@ import * as assert from 'assert' import * as E from '../src/Encoder' import { pipe } from 'fp-ts/lib/pipeable' - -const NumberToString: E.Encoder = { - encode: String -} - -const BooleanToNumber: E.Encoder = { - encode: (b) => (b ? 1 : 0) -} +import * as H from './helpers' describe('Encoder', () => { it('contramap', () => { - const encoder = E.contramap((s: string) => s.length)(NumberToString) + const encoder = E.contramap((s: string) => s.length)(H.encoderNumberToString) assert.deepStrictEqual(encoder.encode('aaa'), '3') }) it('compose', () => { - const encoder = pipe(BooleanToNumber, E.compose(NumberToString)) + const encoder = pipe(H.encoderBooleanToNumber, E.compose(H.encoderNumberToString)) assert.deepStrictEqual(encoder.encode(true), '1') }) it('nullable', () => { - const encoder = E.nullable(NumberToString) + const encoder = E.nullable(H.encoderNumberToString) assert.deepStrictEqual(encoder.encode(1), '1') assert.deepStrictEqual(encoder.encode(null), null) }) it('type', () => { - const encoder = E.type({ a: NumberToString, b: BooleanToNumber }) + const encoder = E.type({ a: H.encoderNumberToString, b: H.encoderBooleanToNumber }) assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) }) it('partial', () => { - const encoder = E.partial({ a: NumberToString, b: BooleanToNumber }) + const encoder = E.partial({ a: H.encoderNumberToString, b: H.encoderBooleanToNumber }) assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) assert.deepStrictEqual(encoder.encode({ a: 1 }), { a: '1' }) assert.deepStrictEqual(encoder.encode({ a: 1, b: undefined }), { a: '1', b: undefined }) @@ -42,28 +35,28 @@ describe('Encoder', () => { }) it('record', () => { - const encoder = E.record(NumberToString) + const encoder = E.record(H.encoderNumberToString) assert.deepStrictEqual(encoder.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) }) it('array', () => { - const encoder = E.array(NumberToString) + const encoder = E.array(H.encoderNumberToString) assert.deepStrictEqual(encoder.encode([1, 2]), ['1', '2']) }) it('tuple', () => { - const encoder = E.tuple(NumberToString, BooleanToNumber) + const encoder = E.tuple(H.encoderNumberToString, H.encoderBooleanToNumber) assert.deepStrictEqual(encoder.encode([3, true]), ['3', 1]) }) it('intersect', () => { - const encoder = pipe(E.type({ a: NumberToString }), E.intersect(E.type({ b: BooleanToNumber }))) + const encoder = pipe(E.type({ a: H.encoderNumberToString }), E.intersect(E.type({ b: H.encoderBooleanToNumber }))) assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) }) it('sum', () => { - const S1 = E.type({ _tag: E.id<'A'>(), a: NumberToString }) - const S2 = E.type({ _tag: E.id<'B'>(), b: BooleanToNumber }) + const S1 = E.type({ _tag: E.id<'A'>(), a: H.encoderNumberToString }) + const S2 = E.type({ _tag: E.id<'B'>(), b: H.encoderBooleanToNumber }) const sum = E.sum('_tag') const encoder = sum({ A: S1, B: S2 }) assert.deepStrictEqual(encoder.encode({ _tag: 'A', a: 1 }), { _tag: 'A', a: '1' }) @@ -89,14 +82,14 @@ describe('Encoder', () => { } const A: E.Encoder = E.lazy(() => E.type({ - a: NumberToString, + a: H.encoderNumberToString, bs: E.array(B) }) ) const B: E.Encoder = E.lazy(() => E.type({ - b: BooleanToNumber, + b: H.encoderBooleanToNumber, as: E.array(A) }) ) diff --git a/test/helpers.ts b/test/helpers.ts new file mode 100644 index 000000000..333b363bc --- /dev/null +++ b/test/helpers.ts @@ -0,0 +1,64 @@ +import * as G from '../src/Guard' +import * as D from '../src/Decoder' +import * as E from '../src/Encoder' +import { pipe } from 'fp-ts/lib/pipeable' + +// ------------------------------------------------------------------------------------- +// guards +// ------------------------------------------------------------------------------------- + +export const guardUndefined: G.Guard = { + is: (u): u is undefined => u === undefined +} + +// ------------------------------------------------------------------------------------- +// decoders +// ------------------------------------------------------------------------------------- + +export const decoderUndefined: D.Decoder = D.fromGuard(guardUndefined, 'undefined') + +export const decoderNumberFromString: D.Decoder = { + decode: (s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'parsable to a number') : D.success(n) + } +} + +export const decoderNumberFromUnknownString: D.Decoder = pipe( + D.string, + D.compose(decoderNumberFromString) +) + +export interface PositiveBrand { + readonly Positive: unique symbol +} + +export type Positive = number & PositiveBrand + +export const decoderPositive: D.Decoder = pipe( + D.number, + D.refine((n): n is Positive => n > 0, 'Positive') +) + +export interface IntBrand { + readonly Int: unique symbol +} + +export type Int = number & IntBrand + +export const decoderInt: D.Decoder = pipe( + D.number, + D.refine((n): n is Int => Number.isInteger(n), 'Int') +) + +// ------------------------------------------------------------------------------------- +// encoders +// ------------------------------------------------------------------------------------- + +export const encoderNumberToString: E.Encoder = { + encode: String +} + +export const encoderBooleanToNumber: E.Encoder = { + encode: (b) => (b ? 1 : 0) +} From dcb0817d0aa8afbd7c060923719602314b55186b Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 9 Jul 2020 17:04:36 +0200 Subject: [PATCH 127/222] remove `JsonEncoder` module --- CHANGELOG.md | 1 + docs/modules/Codec.ts.md | 11 -- docs/modules/Decoder.ts.md | 11 -- docs/modules/Guard.ts.md | 11 -- docs/modules/JsonEncoder.ts.md | 273 -------------------------------- docs/modules/Kleisli.ts.md | 2 +- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 3 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 13 +- docs/modules/Type.ts.md | 2 +- dtslint/ts3.5/JsonEncoder.ts | 28 ---- src/JsonEncoder.ts | 197 ----------------------- test/JsonEncoder.ts | 11 -- test/Schema.ts | 26 --- 16 files changed, 8 insertions(+), 587 deletions(-) delete mode 100644 docs/modules/JsonEncoder.ts.md delete mode 100644 dtslint/ts3.5/JsonEncoder.ts delete mode 100644 src/JsonEncoder.ts delete mode 100644 test/JsonEncoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 607a1b1f1..c05500748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - (\*) remove `KleisliDecoder` module (@gcanti) - (\*) remove `KleisliTaskDecoder` module (@gcanti) - (\*) remove `JsonCodec` module (@gcanti) + - (\*) remove `JsonEncoder` module (@gcanti) - `Codec` - (\*) make `Codec` more general by adding a `I` type parameter (@gcanti) - add `compose` function (@gcanti) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index c8ad8866c..570d608b2 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -49,7 +49,6 @@ Added in v2.2.3 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) - - [object](#object) - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) @@ -338,16 +337,6 @@ export declare const number: Codec Added in v2.2.3 -## object - -**Signature** - -```ts -export declare const object: Codec -``` - -Added in v2.2.8 - ## string **Signature** diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 69159ff24..8ae6f1b83 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -70,7 +70,6 @@ Added in v2.2.7 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) - - [object](#object) - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) @@ -549,16 +548,6 @@ export declare const number: Decoder Added in v2.2.7 -## object - -**Signature** - -```ts -export declare const object: Decoder -``` - -Added in v2.2.8 - ## string **Signature** diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 71928049c..780060ee9 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -48,7 +48,6 @@ Added in v2.2.0 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) - - [object](#object) - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) @@ -325,16 +324,6 @@ export declare const number: Guard Added in v2.2.0 -## object - -**Signature** - -```ts -export declare const object: Guard -``` - -Added in v2.2.8 - ## string **Signature** diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md deleted file mode 100644 index 6c54d2f61..000000000 --- a/docs/modules/JsonEncoder.ts.md +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: JsonEncoder.ts -nav_order: 9 -parent: Modules ---- - -## JsonEncoder overview - -**This module is experimental** - -Experimental features are published in order to get early feedback from the community, see these tracking -[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - -A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - -Added in v2.2.3 - ---- - -

Table of contents

- -- [Contravariant](#contravariant) - - [contramap](#contramap) -- [combinators](#combinators) - - [array](#array) - - [intersect](#intersect) - - [lazy](#lazy) - - [nullable](#nullable) - - [partial](#partial) - - [record](#record) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) -- [instances](#instances) - - [Contravariant](#contravariant-1) - - [Schemable](#schemable) - - [URI](#uri) - - [URI (type alias)](#uri-type-alias) -- [model](#model) - - [Json (type alias)](#json-type-alias) - - [JsonArray (interface)](#jsonarray-interface) - - [JsonEncoder (interface)](#jsonencoder-interface) - - [JsonRecord (interface)](#jsonrecord-interface) -- [primitives](#primitives) - - [id](#id) -- [utils](#utils) - - [TypeOf (type alias)](#typeof-type-alias) - ---- - -# Contravariant - -## contramap - -**Signature** - -```ts -export declare const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder -``` - -Added in v2.2.3 - -# combinators - -## array - -**Signature** - -```ts -export declare const array: (item: JsonEncoder) => JsonEncoder -``` - -Added in v2.2.3 - -## intersect - -**Signature** - -```ts -export declare const intersect: (right: JsonEncoder) => (left: JsonEncoder) => JsonEncoder -``` - -Added in v2.2.3 - -## lazy - -**Signature** - -```ts -export declare const lazy: (f: () => JsonEncoder) => JsonEncoder -``` - -Added in v2.2.3 - -## nullable - -**Signature** - -```ts -export declare const nullable: (or: JsonEncoder) => JsonEncoder -``` - -Added in v2.2.3 - -## partial - -**Signature** - -```ts -export declare const partial: ( - properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder> -``` - -Added in v2.2.3 - -## record - -**Signature** - -```ts -export declare const record: (codomain: JsonEncoder) => JsonEncoder> -``` - -Added in v2.2.3 - -## sum - -**Signature** - -```ts -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: JsonEncoder }) => JsonEncoder -``` - -Added in v2.2.3 - -## tuple - -**Signature** - -```ts -export declare const tuple: ( - ...components: { [K in keyof A]: JsonEncoder } -) => JsonEncoder -``` - -Added in v2.2.3 - -## type - -**Signature** - -```ts -export declare const type: ( - properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder<{ [K in keyof A]: A[K] }> -``` - -Added in v2.2.3 - -# instances - -## Contravariant - -**Signature** - -```ts -export declare const Contravariant: Contravariant1<'io-ts/JsonEncoder'> -``` - -Added in v2.2.8 - -## Schemable - -**Signature** - -```ts -export declare const Schemable: Schemable1<'io-ts/JsonEncoder'> -``` - -Added in v2.2.8 - -## URI - -**Signature** - -```ts -export declare const URI: 'io-ts/JsonEncoder' -``` - -Added in v2.2.3 - -## URI (type alias) - -**Signature** - -```ts -export type URI = typeof URI -``` - -Added in v2.2.3 - -# model - -## Json (type alias) - -**Signature** - -```ts -export type Json = null | string | number | boolean | JsonRecord | JsonArray -``` - -Added in v2.2.3 - -## JsonArray (interface) - -**Signature** - -```ts -export interface JsonArray extends ReadonlyArray {} -``` - -Added in v2.2.3 - -## JsonEncoder (interface) - -**Signature** - -```ts -export interface JsonEncoder { - readonly encode: (a: A) => Json -} -``` - -Added in v2.2.3 - -## JsonRecord (interface) - -**Signature** - -```ts -export interface JsonRecord { - readonly [key: string]: Json -} -``` - -Added in v2.2.3 - -# primitives - -## id - -**Signature** - -```ts -export declare function id(): JsonEncoder -``` - -Added in v2.2.5 - -# utils - -## TypeOf (type alias) - -**Signature** - -```ts -export type TypeOf = E.TypeOf -``` - -Added in v2.2.3 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 78660b735..c2406bb4a 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -1,6 +1,6 @@ --- title: Kleisli.ts -nav_order: 10 +nav_order: 9 parent: Modules --- diff --git a/docs/modules/PathReporter.ts.md b/docs/modules/PathReporter.ts.md index 8f9bdae48..215c43320 100644 --- a/docs/modules/PathReporter.ts.md +++ b/docs/modules/PathReporter.ts.md @@ -1,6 +1,6 @@ --- title: PathReporter.ts -nav_order: 11 +nav_order: 10 parent: Modules --- diff --git a/docs/modules/Reporter.ts.md b/docs/modules/Reporter.ts.md index cecc74f5f..893dd233c 100644 --- a/docs/modules/Reporter.ts.md +++ b/docs/modules/Reporter.ts.md @@ -1,6 +1,6 @@ --- title: Reporter.ts -nav_order: 12 +nav_order: 11 parent: Modules --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 1fa845621..51e8fce56 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -1,6 +1,6 @@ --- title: Schema.ts -nav_order: 13 +nav_order: 12 parent: Modules --- @@ -80,7 +80,6 @@ export declare const interpreter: { S extends | 'Eq' | 'io-ts/Guard' - | 'io-ts/JsonEncoder' | 'Option' | 'ReadonlyRecord' | 'Ord' diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 5fe3c4dcf..a4c9f09df 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -1,6 +1,6 @@ --- title: Schemable.ts -nav_order: 14 +nav_order: 13 parent: Modules --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 6d7f97f1d..3ee55c039 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -1,6 +1,6 @@ --- title: TaskDecoder.ts -nav_order: 15 +nav_order: 14 parent: Modules --- @@ -71,7 +71,6 @@ Added in v2.2.7 - [UnknownRecord](#unknownrecord) - [boolean](#boolean) - [number](#number) - - [object](#object) - [string](#string) - [utils](#utils) - [InputOf (type alias)](#inputof-type-alias) @@ -566,16 +565,6 @@ export declare const number: TaskDecoder Added in v2.2.7 -## object - -**Signature** - -```ts -export declare const object: TaskDecoder -``` - -Added in v2.2.8 - ## string **Signature** diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 4a41998e1..04ec70290 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -1,6 +1,6 @@ --- title: Type.ts -nav_order: 16 +nav_order: 15 parent: Modules --- diff --git a/dtslint/ts3.5/JsonEncoder.ts b/dtslint/ts3.5/JsonEncoder.ts deleted file mode 100644 index e24d6f641..000000000 --- a/dtslint/ts3.5/JsonEncoder.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as _ from '../../src/JsonEncoder' - -// $ExpectType JsonEncoder<{ a: string; b: { c: number; }; }> -_.type({ - a: _.id(), - b: _.type({ - c: _.id() - }) -}) - -// $ExpectType JsonEncoder; }>> -_.partial({ - a: _.id(), - b: _.partial({ - c: _.id() - }) -}) - -// -// Json type -// - -const number: _.Json = 1 -const string: _.Json = 'a' -const boolean: _.Json = true -const nully: _.Json = null -const array: _.Json = [1, 'a', true, null] -const record: _.Json = { a: 1, b: 'b', c: true, d: null } diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts deleted file mode 100644 index 7d736bb5b..000000000 --- a/src/JsonEncoder.ts +++ /dev/null @@ -1,197 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import { Contravariant1 } from 'fp-ts/lib/Contravariant' -import { identity } from 'fp-ts/lib/function' -import * as E from './Encoder' -import { Schemable1 } from './Schemable' - -// ------------------------------------------------------------------------------------- -// model -// ------------------------------------------------------------------------------------- - -/** - * @category model - * @since 2.2.3 - */ -export interface JsonArray extends ReadonlyArray {} - -/** - * @category model - * @since 2.2.3 - */ -export interface JsonRecord { - readonly [key: string]: Json -} - -/** - * @category model - * @since 2.2.3 - */ -export type Json = null | string | number | boolean | JsonRecord | JsonArray - -/** - * @category model - * @since 2.2.3 - */ -export interface JsonEncoder { - readonly encode: (a: A) => Json -} - -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- - -/** - * @since 2.2.3 - */ -export type TypeOf = E.TypeOf - -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- - -/** - * @category primitives - * @since 2.2.5 - */ -export function id(): JsonEncoder { - return { - encode: identity - } -} - -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - -/** - * @category combinators - * @since 2.2.3 - */ -export const nullable: (or: JsonEncoder) => JsonEncoder = E.nullable - -/** - * @category combinators - * @since 2.2.3 - */ -export const type: ( - properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder<{ [K in keyof A]: A[K] }> = E.type as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const partial: ( - properties: { [K in keyof A]: JsonEncoder } -) => JsonEncoder> = E.partial as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const record: (codomain: JsonEncoder) => JsonEncoder> = E.record - -/** - * @category combinators - * @since 2.2.3 - */ -export const array: (item: JsonEncoder) => JsonEncoder> = E.array - -/** - * @category combinators - * @since 2.2.3 - */ -export const tuple: >( - ...components: { [K in keyof A]: JsonEncoder } -) => JsonEncoder = E.tuple as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const intersect: (right: JsonEncoder) => (left: JsonEncoder) => JsonEncoder = E.intersect - -/** - * @category combinators - * @since 2.2.3 - */ -export const sum: ( - tag: T -) => (members: { [K in keyof A]: JsonEncoder }) => JsonEncoder = E.sum as any - -/** - * @category combinators - * @since 2.2.3 - */ -export const lazy: (f: () => JsonEncoder) => JsonEncoder = E.lazy - -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- - -/** - * @category Contravariant - * @since 2.2.3 - */ -export const contramap: (f: (b: B) => A) => (fa: JsonEncoder) => JsonEncoder = E.contramap - -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- - -/** - * @category instances - * @since 2.2.3 - */ -export const URI = 'io-ts/JsonEncoder' - -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI - -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: JsonEncoder - } -} - -/** - * @category instances - * @since 2.2.8 - */ -export const Contravariant: Contravariant1 = { - URI, - contramap: E.Contravariant.contramap -} - -/** - * @category instances - * @since 2.2.8 - */ -export const Schemable: Schemable1 = { - URI, - literal: () => id(), - string: id(), - number: id(), - boolean: id(), - nullable, - type, - partial, - record, - array, - tuple, - intersect, - sum, - lazy: (_, f) => lazy(f) -} diff --git a/test/JsonEncoder.ts b/test/JsonEncoder.ts deleted file mode 100644 index a4ef8904a..000000000 --- a/test/JsonEncoder.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as assert from 'assert' -import * as JE from '../src/JsonEncoder' - -describe('Encoder', () => { - describe('Contravariant', () => { - it('contramap', () => { - const encoder = JE.Contravariant.contramap(JE.Schemable.number, (s: string) => s.length) - assert.deepStrictEqual(encoder.encode('aaa'), 3) - }) - }) -}) diff --git a/test/Schema.ts b/test/Schema.ts index c5a4f2da5..e2ec4ffbe 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,45 +1,19 @@ -import * as assert from 'assert' import * as fc from 'fast-check' import { isRight } from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import * as D from '../src/Decoder' import * as Eq from '../src/Eq' import * as G from '../src/Guard' -import * as JE from '../src/JsonEncoder' import { interpreter, make, Schema } from '../src/Schema' import * as A from './Arbitrary' -function isDeepStrictEqual(actual: unknown, expected: unknown): boolean { - try { - assert.deepStrictEqual(actual, expected) - return true - } catch { - return false - } -} - function check(schema: Schema): void { const arb = interpreter(A.Schemable)(schema) const decoder = interpreter(D.Schemable)(schema) const guard = interpreter(G.Schemable)(schema) const eq = interpreter(Eq.Schemable)(schema) - const encoder = interpreter(JE.Schemable)(schema) // decoders, guards and eqs should be aligned fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) && guard.is(a) && eq.equals(a, a))) - // laws - // 1. - fc.assert(fc.property(arb, (a) => isRight(decoder.decode(encoder.encode(a))))) - // 2. - fc.assert( - fc.property(arb, (u) => { - const a = decoder.decode(u) - if (isRight(a)) { - const o = a.right - return isDeepStrictEqual(encoder.encode(o), u) && eq.equals(o, u) - } - return false - }) - ) } describe('Schema', () => { it('string', () => { From 7e19969b087929bf07450cf1fe12f79c5ade112f Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 9 Jul 2020 17:51:42 +0200 Subject: [PATCH 128/222] fix ktype, ksum signatures --- docs/modules/Decoder.ts.md | 4 ++-- docs/modules/Kleisli.ts.md | 4 ++-- docs/modules/TaskDecoder.ts.md | 7 ++----- dtslint/ts3.5/Decoder.ts | 2 -- src/Decoder.ts | 17 +++++------------ src/Guard.ts | 7 ------- src/Kleisli.ts | 4 ++-- src/TaskDecoder.ts | 14 +++++--------- test/Codec.ts | 6 +++--- test/Decoder.ts | 6 +++--- test/TaskDecoder.ts | 6 +++--- 11 files changed, 27 insertions(+), 50 deletions(-) diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 8ae6f1b83..e0b837976 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -239,7 +239,7 @@ export declare const ksum: ( tag: T ) => >>( members: MS -) => Decoder>, K.TypeOf<'Either', MS[keyof MS]>> +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> ``` Added in v2.2.8 @@ -263,7 +263,7 @@ Added in v2.2.8 ```ts export declare const ktype:

>>( properties: P -) => Decoder }>, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> ``` Added in v2.2.8 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index c2406bb4a..29d203e58 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -226,7 +226,7 @@ export declare function sum( tag: T ) => >>( members: MS -) => Kleisli>, E, TypeOf> +) => Kleisli, E, TypeOf> ``` Added in v2.2.7 @@ -258,7 +258,7 @@ export declare function type( onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P -) => Kleisli }>, E, { [K in keyof P]: TypeOf }> +) => Kleisli }, E, { [K in keyof P]: TypeOf }> ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 3ee55c039..589add265 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -240,7 +240,7 @@ export declare const ksum: ( tag: T ) => >>( members: MS -) => TaskDecoder>, K.TypeOf<'TaskEither', MS[keyof MS]>> +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> ``` Added in v2.2.8 @@ -264,10 +264,7 @@ Added in v2.2.8 ```ts export declare const ktype:

>>( properties: P -) => TaskDecoder< - Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, - { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> } -> +) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> ``` Added in v2.2.8 diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index ba77cec83..dbd445288 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -3,9 +3,7 @@ import * as DE from '../../src/DecodeError' import * as _ from '../../src/Decoder' import * as FS from '../../src/FreeSemigroup' -declare const StringFromString: _.Decoder declare const NumberFromString: _.Decoder -declare const ArrayFromString: _.Decoder> // // TypeOf diff --git a/src/Decoder.ts b/src/Decoder.ts index c5e6fbafd..e1e45c8d5 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -178,13 +178,6 @@ export const UnknownRecord: Decoder> = /*#__PURE__*/ fromGuard(G.UnknownRecord, 'Record') -/** - * @internal - */ -export const object: Decoder = - /*#__PURE__*/ - fromGuard(G.object, 'object') - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -230,7 +223,7 @@ export const nullable: (or: Decoder) => Decoder */ export const ktype =

>>( properties: P -): Decoder }>, { [K in keyof P]: TypeOf }> => +): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** @@ -239,7 +232,7 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: Decoder } -): Decoder => pipe(object, compose(ktype(properties))) +): Decoder => pipe(UnknownRecord as any, compose(ktype(properties))) /** * @category combinators @@ -256,7 +249,7 @@ export const kpartial =

>>( */ export const partial = ( properties: { [K in keyof A]: Decoder } -): Decoder> => pipe(object, compose(kpartial(properties))) +): Decoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) /** * @category combinators @@ -327,7 +320,7 @@ export const intersect: (right: Decoder) => (left: Decoder< */ export const ksum = (tag: T) => >>( members: MS -): Decoder>, TypeOf> => +): Decoder, TypeOf> => K.sum(M)((tag, value, keys) => FS.of( DE.key( @@ -344,7 +337,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: Decoder } -): Decoder => pipe(object, compose(ksum(tag)(members))) +): Decoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) /** * @category combinators diff --git a/src/Guard.ts b/src/Guard.ts index b9282e754..4186f631d 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -95,13 +95,6 @@ export const UnknownRecord: Guard> = { is: (u: unknown): u is Record => Object.prototype.toString.call(u) === '[object Object]' } -/** - * @internal - */ -export const object: Guard = { - is: (u: unknown): u is object => u != null && !string.is(u) && !number.is(u) && !boolean.is(u) -} - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 54d1c8d3b..f79ed40f3 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -131,7 +131,7 @@ export function type( onPropertyError: (key: string, e: E) => E ) =>

>>( properties: P -) => Kleisli }>, E, { [K in keyof P]: TypeOf }> { +) => Kleisli }, E, { [K in keyof P]: TypeOf }> { const traverse = traverseRecordWithIndex(M) return (onPropertyError) => (properties) => ({ decode: (i) => @@ -280,7 +280,7 @@ export function sum( tag: T ) => >>( members: MS -) => Kleisli>, E, TypeOf> { +) => Kleisli, E, TypeOf> { return (onTagError) => (tag) => , A>( members: { [K in keyof A]: Kleisli } ): Kleisli => { diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 55cc66660..ea29997be 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -179,10 +179,6 @@ export const UnknownRecord: TaskDecoder> = /*#__PURE__*/ fromDecoder(D.UnknownRecord) -const object: TaskDecoder = - /*#__PURE__*/ - fromDecoder(D.object) - // ------------------------------------------------------------------------------------- // combinators // ------------------------------------------------------------------------------------- @@ -230,7 +226,7 @@ export const nullable: (or: TaskDecoder) => TaskDecoder>>( properties: P -): TaskDecoder }>, { [K in keyof P]: TypeOf }> => +): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** @@ -239,7 +235,7 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(object, compose(ktype(properties))) +): TaskDecoder => pipe(UnknownRecord as any, compose(ktype(properties))) /** * @category combinators @@ -256,7 +252,7 @@ export const kpartial =

>>( */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(object, compose(kpartial(properties))) +): TaskDecoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) /** * @category combinators @@ -329,7 +325,7 @@ export const intersect: ( */ export const ksum = (tag: T) => >>( members: MS -): TaskDecoder>, TypeOf> => +): TaskDecoder, TypeOf> => K.sum(M)((tag, value, keys) => FS.of( DE.key( @@ -346,7 +342,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(object, compose(ksum(tag)(members))) +): TaskDecoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) /** * @category combinators diff --git a/test/Codec.ts b/test/Codec.ts index 8bf1d8846..21f534f01 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -226,7 +226,7 @@ describe('Codec', () => { const codec = _.type({ a: _.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -302,7 +302,7 @@ describe('Codec', () => { it('should reject an invalid input', () => { const codec = _.partial({ a: _.string }) - assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'object')) + assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) assert.deepStrictEqual( codec.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -532,7 +532,7 @@ describe('Codec', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const codec = sum({ A, B }) - assert.deepStrictEqual(codec.decode(null), D.failure(null, 'object')) + assert.deepStrictEqual(codec.decode(null), D.failure(null, 'Record')) assert.deepStrictEqual( codec.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/Decoder.ts b/test/Decoder.ts index 12f7e89d9..a4f8f609a 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -161,7 +161,7 @@ describe('Decoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -222,7 +222,7 @@ describe('Decoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'object')))) + assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) assert.deepStrictEqual( decoder.decode({ a: 1 }), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -447,7 +447,7 @@ describe('Decoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'object')))) + assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) assert.deepStrictEqual( decoder.decode({}), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index 8e9814aec..f6ecef600 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -204,7 +204,7 @@ describe('UnknownTaskDecoder', () => { const decoder = _.type({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) @@ -265,7 +265,7 @@ describe('UnknownTaskDecoder', () => { it('should reject an invalid input', async () => { const decoder = _.partial({ a: _.string }) - assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'object')) + assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) assert.deepStrictEqual( await decoder.decode({ a: 1 })(), E.left(FS.of(DE.key('a', DE.optional, FS.of(DE.leaf(1, 'string'))))) @@ -493,7 +493,7 @@ describe('UnknownTaskDecoder', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) const B = _.type({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) - assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'object')) + assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'Record')) assert.deepStrictEqual( await decoder.decode({})(), E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, '"A" | "B"'))))) From cab210a2d7192499744714bc049e80a5507b5b79 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 9 Jul 2020 18:58:18 +0200 Subject: [PATCH 129/222] Codec: add ktype, kpartial, karray, krecord, ktuple, ksum --- CHANGELOG.md | 6 +++ docs/modules/Codec.ts.md | 86 +++++++++++++++++++++++++++++++++++ dtslint/ts3.5/Codec.ts | 98 ++++++++++++++++++++++++++++++++++++++++ dtslint/ts3.5/Decoder.ts | 12 +++++ src/Codec.ts | 82 +++++++++++++++++++++++++++++---- 5 files changed, 275 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c05500748..99126d8e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,12 @@ - (\*) remove `JsonEncoder` module (@gcanti) - `Codec` - (\*) make `Codec` more general by adding a `I` type parameter (@gcanti) + - add `ktype` function (@gcanti) + - add `kpartial` function (@gcanti) + - add `karray` function (@gcanti) + - add `krecord` function (@gcanti) + - add `ktuple` function (@gcanti) + - add `ksum` function (@gcanti) - add `compose` function (@gcanti) - `Decoder` - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 570d608b2..5d359b8a7 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -25,6 +25,12 @@ Added in v2.2.3 - [array](#array) - [compose](#compose) - [intersect](#intersect) + - [karray](#karray) + - [kpartial](#kpartial) + - [krecord](#krecord) + - [ksum](#ksum) + - [ktuple](#ktuple) + - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -105,6 +111,86 @@ export declare const intersect: ( Added in v2.2.3 +## karray + +**Signature** + +```ts +export declare function karray(item: Codec): Codec, Array, Array> +``` + +Added in v2.2.3 + +## kpartial + +**Signature** + +```ts +export declare function kpartial

>>( + properties: P +): Codec< + Partial<{ [K in keyof P]: InputOf }>, + Partial<{ [K in keyof P]: OutputOf }>, + Partial<{ [K in keyof P]: TypeOf }> +> +``` + +Added in v2.2.8 + +## krecord + +**Signature** + +```ts +export declare function krecord( + codomain: Codec +): Codec, Record, Record> +``` + +Added in v2.2.3 + +## ksum + +**Signature** + +```ts +export declare const ksum: ( + tag: T +) => >>( + members: MS +) => Codec, E.OutputOf, E.TypeOf> +``` + +Added in v2.2.8 + +## ktuple + +**Signature** + +```ts +export declare const ktuple: []>( + ...components: C +) => Codec< + { [K in keyof C]: InputOf<'Either', C[K]> }, + { [K in keyof C]: E.OutputOf }, + { [K in keyof C]: E.TypeOf } +> +``` + +Added in v2.2.8 + +## ktype + +**Signature** + +```ts +export declare function ktype

>>( + properties: P +): Codec<{ [K in keyof P]: InputOf }, { [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +``` + +Added in v2.2.8 + ## lazy **Signature** diff --git a/dtslint/ts3.5/Codec.ts b/dtslint/ts3.5/Codec.ts index d7d3fa558..75b25a1c8 100644 --- a/dtslint/ts3.5/Codec.ts +++ b/dtslint/ts3.5/Codec.ts @@ -1,5 +1,23 @@ import * as _ from '../../src/Codec' +declare const NumberFromString: _.Codec + +// +// ktype +// + +// $ExpectType Codec<{ a: unknown; b: { c: string; }; }, { a: string; b: { c: string; }; }, { a: string; b: { c: number; }; }> +_.ktype({ + a: _.string, + b: _.ktype({ + c: NumberFromString + }) +}) + +// +// type +// + // $ExpectType Codec _.type({ a: _.string, @@ -8,6 +26,22 @@ _.type({ }) }) +// +// kpartial +// + +// $ExpectType Codec; }>, Partial<{ a: string; b: Partial<{ c: string; }>; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> +_.kpartial({ + a: _.string, + b: _.kpartial({ + c: NumberFromString + }) +}) + +// +// partial +// + // $ExpectType Codec; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> _.partial({ a: _.string, @@ -15,3 +49,67 @@ _.partial({ c: _.number }) }) + +// +// karray +// + +// $ExpectType Codec +_.karray(NumberFromString) + +// +// array +// + +// $ExpectType Codec +_.array(_.string) + +// +// krecord +// + +// $ExpectType Codec, Record, Record> +_.krecord(NumberFromString) + +// +// record +// + +// $ExpectType Codec, Record> +_.record(_.string) + +// +// ktuple +// + +// $ExpectType Codec<[unknown, string, unknown], [string, string, boolean], [string, number, boolean]> +_.ktuple(_.string, NumberFromString, _.boolean) + +// +// tuple +// + +// $ExpectType Codec +_.tuple(_.string, _.number, _.boolean) + +const f: (s: string) => void = (s) => s.length + +// +// ksum +// + +// $ExpectType Codec<{ _tag: unknown; a: unknown; } | { _tag: unknown; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: number; }> +_.ksum('_tag')({ + A: _.ktype({ _tag: _.literal('A'), a: _.string }), + B: _.ktype({ _tag: _.literal('B'), b: NumberFromString }) +}) + +// +// sum +// + +// $ExpectType Codec +_.sum('_tag')({ + A: _.type({ _tag: _.literal('A'), a: _.string }), + B: _.type({ _tag: _.literal('B'), b: _.number }) +}) diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index dbd445288..777a3af1c 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -19,6 +19,18 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf +// +// ktype +// + +// $ExpectType Decoder<{ a: unknown; b: { c: string; }; }, { a: string; b: { c: number; }; }> +_.ktype({ + a: _.string, + b: _.ktype({ + c: NumberFromString + }) +}) + // // type // diff --git a/src/Codec.ts b/src/Codec.ts index d042e5227..6f1dcce2c 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -142,6 +142,16 @@ export function nullable(or: Codec): Codec>>( + properties: P +): Codec<{ [K in keyof P]: InputOf }, { [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { + return make(D.ktype(properties) as any, E.type(properties)) +} + /** * @category combinators * @since 2.2.3 @@ -149,7 +159,21 @@ export function nullable(or: Codec): Codec>>( properties: P ): Codec }, { [K in keyof P]: TypeOf }> { - return make(D.type(properties) as any, E.type(properties)) + return pipe(UnknownRecord, compose(ktype(properties as any))) as any +} + +/** + * @category combinators + * @since 2.2.8 + */ +export function kpartial

>>( + properties: P +): Codec< + Partial<{ [K in keyof P]: InputOf }>, + Partial<{ [K in keyof P]: OutputOf }>, + Partial<{ [K in keyof P]: TypeOf }> +> { + return make(D.kpartial(properties), E.partial(properties)) } /** @@ -159,15 +183,15 @@ export function type

>>( export function partial

>>( properties: P ): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> { - return make(D.partial(properties) as any, E.partial(properties)) + return pipe(UnknownRecord, compose(kpartial(properties as any))) as any } /** * @category combinators * @since 2.2.3 */ -export function record(codomain: Codec): Codec, Record> { - return make(D.record(codomain), E.record(codomain)) +export function karray(item: Codec): Codec, Array, Array> { + return make(D.karray(item), E.array(item)) } /** @@ -175,9 +199,36 @@ export function record(codomain: Codec): Codec(item: Codec): Codec, Array> { - return make(D.array(item), E.array(item)) + return pipe(UnknownArray, compose(karray(item))) as any +} + +/** + * @category combinators + * @since 2.2.3 + */ +export function krecord( + codomain: Codec +): Codec, Record, Record> { + return make(D.krecord(codomain), E.record(codomain)) } +/** + * @category combinators + * @since 2.2.3 + */ +export function record(codomain: Codec): Codec, Record> { + return pipe(UnknownRecord, compose(krecord(codomain))) as any +} + +/** + * @category combinators + * @since 2.2.8 + */ +export const ktuple = >>( + ...components: C +): Codec<{ [K in keyof C]: InputOf }, { [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> => + make(D.ktuple(...components) as any, E.tuple(...components)) + /** * @category combinators * @since 2.2.3 @@ -185,7 +236,7 @@ export function array(item: Codec): Codec export function tuple>>( ...components: C ): Codec }, { [K in keyof C]: TypeOf }> { - return make(D.tuple(...components) as any, E.tuple(...components)) + return pipe(UnknownArray as any, compose(ktuple(...components) as any)) as any } /** @@ -200,6 +251,20 @@ export const intersect = ( return (left) => make(intersectD(left), intersectE(left)) } +/** + * @category combinators + * @since 2.2.8 + */ +export const ksum = ( + tag: T +): (>>( + members: MS +) => Codec, OutputOf, TypeOf>) => { + const decoder = D.ksum(tag) + const encoder = E.sum(tag) + return (members) => make(decoder(members) as any, encoder(members)) +} + /** * @category combinators * @since 2.2.3 @@ -209,9 +274,8 @@ export function sum( ): >>( members: M ) => Codec, TypeOf> { - const sumD = D.sum(tag) - const sumE = E.sum(tag) - return (members) => make(sumD(members), sumE(members)) + const sum = ksum(tag) + return (members) => pipe(UnknownRecord, compose(sum(members) as any)) as any } /** From 6f6c567b0678fbe4c7c9023a4859272c23bbde85 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 10 Jul 2020 17:07:16 +0200 Subject: [PATCH 130/222] update changelog --- CHANGELOG.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99126d8e8..0755f726d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,6 @@ - add `compose` function (@gcanti) - `Decoder` - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) - - add `object` primitive (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromGuard` signature (@gcanti) - add `ktype` function (@gcanti) @@ -50,7 +49,6 @@ - add `InputOf` type (@gcanti) - `TaskDecoder` - (\*) make `TaskDecoder` more general by adding a `I` type parameter (@gcanti) - - add `object` primitive (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromDecoder` signature (@gcanti) - add `ktype` function (@gcanti) @@ -69,7 +67,6 @@ - `Guard` - (\*) make `Guard` more general by adding a `I` type parameter (@gcanti) - (\*) rename `schemableGuard` to `Schemable` (@gcanti) - - add `object` primitive (@gcanti) - add `InputOf` type (@gcanti) - add `alt` function (@gcanti) - add `zero` function (@gcanti) @@ -84,13 +81,6 @@ - (\*) rename `schemableEq` to `Schemable` (@gcanti) - `Kleisli` - add `id` (@gcanti) - - (\*) drop `type` in favour of `composeType` (@gcanti) - - (\*) drop `partial` in favour of `composePartial` (@gcanti) - - (\*) drop `array` in favour of `composeArray` (@gcanti) - - (\*) drop `record` in favour of `composeRecord` (@gcanti) - - (\*) drop `tuple` in favour of `composeTuple` (@gcanti) - - (\*) drop `union` in favour of `composeUnion` (@gcanti) - - (\*) drop `sum` in favour of `composeSum` (@gcanti) - `JsonEncoder` - (\*) rename `contravariantJsonCodec` to `Contravariant` (@gcanti) - (\*) rename `schemableJsonEncoder` to `Schemable` (@gcanti) From 0fbe4ae55fdd852bac35c8aad4c13da3cb52e62b Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 10 Jul 2020 17:46:19 +0200 Subject: [PATCH 131/222] renaming --- CHANGELOG.md | 42 ++++---- docs/modules/Codec.ts.md | 60 +++++------ docs/modules/Decoder.ts.md | 60 +++++------ docs/modules/Kleisli.ts.md | 178 ++++++++++++++++----------------- docs/modules/TaskDecoder.ts.md | 62 ++++++------ dtslint/ts3.5/Codec.ts | 34 +++---- dtslint/ts3.5/Decoder.ts | 57 +++++++++-- src/Codec.ts | 36 +++---- src/Decoder.ts | 36 +++---- src/Kleisli.ts | 12 +-- src/TaskDecoder.ts | 37 +++---- test/Codec.ts | 30 +++--- 12 files changed, 345 insertions(+), 299 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0755f726d..51b38ba97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,23 +23,23 @@ - (\*) remove `JsonEncoder` module (@gcanti) - `Codec` - (\*) make `Codec` more general by adding a `I` type parameter (@gcanti) - - add `ktype` function (@gcanti) - - add `kpartial` function (@gcanti) - - add `karray` function (@gcanti) - - add `krecord` function (@gcanti) - - add `ktuple` function (@gcanti) - - add `ksum` function (@gcanti) + - add `fromType` function (@gcanti) + - add `fromPartial` function (@gcanti) + - add `fromArray` function (@gcanti) + - add `fromRecord` function (@gcanti) + - add `fromTuple` function (@gcanti) + - add `fromSum` function (@gcanti) - add `compose` function (@gcanti) - `Decoder` - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromGuard` signature (@gcanti) - - add `ktype` function (@gcanti) - - add `kpartial` function (@gcanti) - - add `karray` function (@gcanti) - - add `krecord` function (@gcanti) - - add `ktuple` function (@gcanti) - - add `ksum` function (@gcanti) + - add `fromType` function (@gcanti) + - add `fromPartial` function (@gcanti) + - add `fromArray` function (@gcanti) + - add `fromRecord` function (@gcanti) + - add `fromTuple` function (@gcanti) + - add `fromSum` function (@gcanti) - add `compose` function (@gcanti) - add `id` function (@gcanti) - (\*) rename `functorDecoder` instance to `Functor` (@gcanti) @@ -51,12 +51,12 @@ - (\*) make `TaskDecoder` more general by adding a `I` type parameter (@gcanti) - add `fromRefinement` function (@gcanti) - change `fromDecoder` signature (@gcanti) - - add `ktype` function (@gcanti) - - add `kpartial` function (@gcanti) - - add `karray` function (@gcanti) - - add `krecord` function (@gcanti) - - add `ktuple` function (@gcanti) - - add `ksum` function (@gcanti) + - add `fromType` function (@gcanti) + - add `fromPartial` function (@gcanti) + - add `fromArray` function (@gcanti) + - add `fromRecord` function (@gcanti) + - add `fromTuple` function (@gcanti) + - add `fromSum` function (@gcanti) - add `compose` function (@gcanti) - add `id` function (@gcanti) - (\*) rename `functorTaskDecoder` instance to `Functor` (@gcanti) @@ -81,6 +81,12 @@ - (\*) rename `schemableEq` to `Schemable` (@gcanti) - `Kleisli` - add `id` (@gcanti) + - rename `type` to `fromType` (@gcanti) + - rename `partial` to `fromPartial` (@gcanti) + - rename `array` to `fromArray` (@gcanti) + - rename `record` to `fromRecord` (@gcanti) + - rename `tuple` to `fromTuple` (@gcanti) + - rename `sum` to `fromSum` (@gcanti) - `JsonEncoder` - (\*) rename `contravariantJsonCodec` to `Contravariant` (@gcanti) - (\*) rename `schemableJsonEncoder` to `Schemable` (@gcanti) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 5d359b8a7..3dff9dd9d 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -24,13 +24,13 @@ Added in v2.2.3 - [combinators](#combinators) - [array](#array) - [compose](#compose) + - [fromArray](#fromarray) + - [fromPartial](#frompartial) + - [fromRecord](#fromrecord) + - [fromSum](#fromsum) + - [fromTuple](#fromtuple) + - [fromType](#fromtype) - [intersect](#intersect) - - [karray](#karray) - - [kpartial](#kpartial) - - [krecord](#krecord) - - [ksum](#ksum) - - [ktuple](#ktuple) - - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -99,34 +99,22 @@ export declare const compose: ( Added in v2.2.8 -## intersect - -**Signature** - -```ts -export declare const intersect: ( - right: Codec -) => (left: Codec) => Codec -``` - -Added in v2.2.3 - -## karray +## fromArray **Signature** ```ts -export declare function karray(item: Codec): Codec, Array, Array> +export declare function fromArray(item: Codec): Codec, Array, Array> ``` Added in v2.2.3 -## kpartial +## fromPartial **Signature** ```ts -export declare function kpartial

>>( +export declare function fromPartial

>>( properties: P ): Codec< Partial<{ [K in keyof P]: InputOf }>, @@ -137,24 +125,24 @@ export declare function kpartial

>> Added in v2.2.8 -## krecord +## fromRecord **Signature** ```ts -export declare function krecord( +export declare function fromRecord( codomain: Codec ): Codec, Record, Record> ``` Added in v2.2.3 -## ksum +## fromSum **Signature** ```ts -export declare const ksum: ( +export declare const fromSum: ( tag: T ) => >>( members: MS @@ -163,12 +151,12 @@ export declare const ksum: ( Added in v2.2.8 -## ktuple +## fromTuple **Signature** ```ts -export declare const ktuple: []>( +export declare const fromTuple: []>( ...components: C ) => Codec< { [K in keyof C]: InputOf<'Either', C[K]> }, @@ -179,18 +167,30 @@ export declare const ktuple: []>( Added in v2.2.8 -## ktype +## fromType **Signature** ```ts -export declare function ktype

>>( +export declare function fromType

>>( properties: P ): Codec<{ [K in keyof P]: InputOf }, { [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> ``` Added in v2.2.8 +## intersect + +**Signature** + +```ts +export declare const intersect: ( + right: Codec +) => (left: Codec) => Codec +``` + +Added in v2.2.3 + ## lazy **Signature** diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index e0b837976..b4fa16a7e 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -34,13 +34,13 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) + - [fromArray](#fromarray) + - [fromPartial](#frompartial) + - [fromRecord](#fromrecord) + - [fromSum](#fromsum) + - [fromTuple](#fromtuple) + - [fromType](#fromtype) - [intersect](#intersect) - - [karray](#karray) - - [kpartial](#kpartial) - - [krecord](#krecord) - - [ksum](#ksum) - - [ktuple](#ktuple) - - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -183,34 +183,22 @@ export declare const array: (item: Decoder) => Decoder( - right: Decoder -) => (left: Decoder) => Decoder -``` - -Added in v2.2.7 - -## karray +## fromArray **Signature** ```ts -export declare const karray: (item: Decoder) => Decoder +export declare const fromArray: (item: Decoder) => Decoder ``` Added in v2.2.8 -## kpartial +## fromPartial **Signature** ```ts -export declare const kpartial:

>>( +export declare const fromPartial:

>>( properties: P ) => Decoder< Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, @@ -220,22 +208,22 @@ export declare const kpartial:

>>( Added in v2.2.8 -## krecord +## fromRecord **Signature** ```ts -export declare const krecord: (codomain: Decoder) => Decoder, Record> +export declare const fromRecord: (codomain: Decoder) => Decoder, Record> ``` Added in v2.2.8 -## ksum +## fromSum **Signature** ```ts -export declare const ksum: ( +export declare const fromSum: ( tag: T ) => >>( members: MS @@ -244,30 +232,42 @@ export declare const ksum: ( Added in v2.2.8 -## ktuple +## fromTuple **Signature** ```ts -export declare const ktuple: []>( +export declare const fromTuple: []>( ...components: C ) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K in keyof C]: K.TypeOf<'Either', C[K]> }> ``` Added in v2.2.8 -## ktype +## fromType **Signature** ```ts -export declare const ktype:

>>( +export declare const fromType:

>>( properties: P ) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> ``` Added in v2.2.8 +## intersect + +**Signature** + +```ts +export declare const intersect: ( + right: Decoder +) => (left: Decoder) => Decoder +``` + +Added in v2.2.7 + ## lazy **Signature** diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 29d203e58..428b60e60 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -21,8 +21,13 @@ Added in v2.2.7 - [combinators](#combinators) - [alt](#alt) - - [array](#array) - [compose](#compose) + - [fromArray](#fromarray) + - [fromPartial](#frompartial) + - [fromRecord](#fromrecord) + - [fromSum](#fromsum) + - [fromTuple](#fromtuple) + - [fromType](#fromtype) - [id](#id) - [intersect](#intersect) - [lazy](#lazy) @@ -30,12 +35,7 @@ Added in v2.2.7 - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [parse](#parse) - - [partial](#partial) - - [record](#record) - [refine](#refine) - - [sum](#sum) - - [tuple](#tuple) - - [type](#type) - [union](#union) - [constructors](#constructors) - [fromRefinement](#fromrefinement) @@ -62,203 +62,203 @@ export declare function alt( Added in v2.2.7 -## array +## compose **Signature** ```ts -export declare function array( - M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> +export declare function compose( + M: Monad2C +): (ab: Kleisli) => (ia: Kleisli) => Kleisli ``` Added in v2.2.7 -## compose +## fromArray **Signature** ```ts -export declare function compose( - M: Monad2C -): (ab: Kleisli) => (ia: Kleisli) => Kleisli +export declare function fromArray( + M: Applicative2C & Bifunctor2 +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> ``` Added in v2.2.7 -## id +## fromPartial **Signature** ```ts -export declare function id(M: Applicative2C): () => Kleisli +export declare function fromPartial( + M: Applicative2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) =>

>>( + properties: P +) => Kleisli }>, E, Partial<{ [K in keyof P]: TypeOf }>> ``` -Added in v2.2.8 +Added in v2.2.7 -## intersect +## fromRecord **Signature** ```ts -export declare function intersect( - M: Apply2C -): (right: Kleisli) => (left: Kleisli) => Kleisli +export declare function fromRecord( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> ``` Added in v2.2.7 -## lazy +## fromSum **Signature** ```ts -export declare function lazy( - M: Bifunctor2 -): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +export declare function fromSum( + M: MonadThrow2C +): ( + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +) => >>( + members: MS +) => Kleisli, E, TypeOf> ``` Added in v2.2.7 -## map +## fromTuple **Signature** ```ts -export declare function map( - F: Functor2C -): (f: (a: A) => B) => (ia: Kleisli) => Kleisli +export declare function fromTuple( + M: Applicative2C & Bifunctor2 +): ( + onIndexError: (index: number, e: E) => E +) => >>( + ...components: C +) => Kleisli }, E, { [K in keyof C]: TypeOf }> ``` Added in v2.2.7 -## mapLeftWithInput +## fromType **Signature** ```ts -export declare function mapLeftWithInput( - M: Bifunctor2 -): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +export declare function fromType( + M: Applicative2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) =>

>>( + properties: P +) => Kleisli }, E, { [K in keyof P]: TypeOf }> ``` Added in v2.2.7 -## nullable +## id **Signature** ```ts -export declare function nullable( - M: Applicative2C & Bifunctor2 -): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +export declare function id(M: Applicative2C): () => Kleisli ``` -Added in v2.2.7 +Added in v2.2.8 -## parse +## intersect **Signature** ```ts -export declare function parse( - M: Monad2C -): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli +export declare function intersect( + M: Apply2C +): (right: Kleisli) => (left: Kleisli) => Kleisli ``` Added in v2.2.7 -## partial +## lazy **Signature** ```ts -export declare function partial( - M: Applicative2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) =>

>>( - properties: P -) => Kleisli }>, E, Partial<{ [K in keyof P]: TypeOf }>> +export declare function lazy( + M: Bifunctor2 +): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli ``` Added in v2.2.7 -## record +## map **Signature** ```ts -export declare function record( - M: Applicative2C & Bifunctor2 -): ( - onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> +export declare function map( + F: Functor2C +): (f: (a: A) => B) => (ia: Kleisli) => Kleisli ``` Added in v2.2.7 -## refine +## mapLeftWithInput **Signature** ```ts -export declare function refine( - M: MonadThrow2C & Bifunctor2 -): ( - refinement: (a: A) => a is B, - onError: (a: A) => E -) => (from: Kleisli) => Kleisli +export declare function mapLeftWithInput( + M: Bifunctor2 +): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli ``` Added in v2.2.7 -## sum +## nullable **Signature** ```ts -export declare function sum( - M: MonadThrow2C -): ( - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => ( - tag: T -) => >>( - members: MS -) => Kleisli, E, TypeOf> +export declare function nullable( + M: Applicative2C & Bifunctor2 +): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli ``` Added in v2.2.7 -## tuple +## parse **Signature** ```ts -export declare function tuple( - M: Applicative2C & Bifunctor2 -): ( - onIndexError: (index: number, e: E) => E -) => >>( - ...components: C -) => Kleisli }, E, { [K in keyof C]: TypeOf }> +export declare function parse( + M: Monad2C +): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli ``` Added in v2.2.7 -## type +## refine **Signature** ```ts -export declare function type( - M: Applicative2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) =>

>>( - properties: P -) => Kleisli }, E, { [K in keyof P]: TypeOf }> +export declare function refine( + M: MonadThrow2C & Bifunctor2 +): ( + refinement: (a: A) => a is B, + onError: (a: A) => E +) => (from: Kleisli) => Kleisli ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 589add265..dda070f6d 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -34,13 +34,13 @@ Added in v2.2.7 - [compose](#compose) - [combinators](#combinators) - [array](#array) + - [fromArray](#fromarray) + - [fromPartial](#frompartial) + - [fromRecord](#fromrecord) + - [fromSum](#fromsum) + - [fromTuple](#fromtuple) + - [fromType](#fromtype) - [intersect](#intersect) - - [karray](#karray) - - [kpartial](#kpartial) - - [krecord](#krecord) - - [ksum](#ksum) - - [ktuple](#ktuple) - - [ktype](#ktype) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) @@ -184,34 +184,22 @@ export declare const array: (item: TaskDecoder) => TaskDecoder( - right: TaskDecoder -) => (left: TaskDecoder) => TaskDecoder -``` - -Added in v2.2.7 - -## karray +## fromArray **Signature** ```ts -export declare const karray: (item: TaskDecoder) => TaskDecoder +export declare const fromArray: (item: TaskDecoder) => TaskDecoder ``` Added in v2.2.8 -## kpartial +## fromPartial **Signature** ```ts -export declare const kpartial:

>>( +export declare const fromPartial:

>>( properties: P ) => TaskDecoder< Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, @@ -221,22 +209,24 @@ export declare const kpartial:

>> Added in v2.2.8 -## krecord +## fromRecord **Signature** ```ts -export declare const krecord: (codomain: TaskDecoder) => TaskDecoder, Record> +export declare const fromRecord: ( + codomain: TaskDecoder +) => TaskDecoder, Record> ``` Added in v2.2.8 -## ksum +## fromSum **Signature** ```ts -export declare const ksum: ( +export declare const fromSum: ( tag: T ) => >>( members: MS @@ -245,30 +235,42 @@ export declare const ksum: ( Added in v2.2.8 -## ktuple +## fromTuple **Signature** ```ts -export declare const ktuple: []>( +export declare const fromTuple: []>( ...components: C ) => TaskDecoder<{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> }> ``` Added in v2.2.8 -## ktype +## fromType **Signature** ```ts -export declare const ktype:

>>( +export declare const fromType:

>>( properties: P ) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> ``` Added in v2.2.8 +## intersect + +**Signature** + +```ts +export declare const intersect: ( + right: TaskDecoder +) => (left: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.7 + ## lazy **Signature** diff --git a/dtslint/ts3.5/Codec.ts b/dtslint/ts3.5/Codec.ts index 75b25a1c8..d66bcee7c 100644 --- a/dtslint/ts3.5/Codec.ts +++ b/dtslint/ts3.5/Codec.ts @@ -3,13 +3,13 @@ import * as _ from '../../src/Codec' declare const NumberFromString: _.Codec // -// ktype +// fromType // // $ExpectType Codec<{ a: unknown; b: { c: string; }; }, { a: string; b: { c: string; }; }, { a: string; b: { c: number; }; }> -_.ktype({ +_.fromType({ a: _.string, - b: _.ktype({ + b: _.fromType({ c: NumberFromString }) }) @@ -27,13 +27,13 @@ _.type({ }) // -// kpartial +// fromPartial // // $ExpectType Codec; }>, Partial<{ a: string; b: Partial<{ c: string; }>; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> -_.kpartial({ +_.fromPartial({ a: _.string, - b: _.kpartial({ + b: _.fromPartial({ c: NumberFromString }) }) @@ -51,11 +51,11 @@ _.partial({ }) // -// karray +// fromArray // // $ExpectType Codec -_.karray(NumberFromString) +_.fromArray(NumberFromString) // // array @@ -65,11 +65,11 @@ _.karray(NumberFromString) _.array(_.string) // -// krecord +// fromRecord // // $ExpectType Codec, Record, Record> -_.krecord(NumberFromString) +_.fromRecord(NumberFromString) // // record @@ -79,11 +79,11 @@ _.krecord(NumberFromString) _.record(_.string) // -// ktuple +// fromTuple // // $ExpectType Codec<[unknown, string, unknown], [string, string, boolean], [string, number, boolean]> -_.ktuple(_.string, NumberFromString, _.boolean) +_.fromTuple(_.string, NumberFromString, _.boolean) // // tuple @@ -92,16 +92,14 @@ _.ktuple(_.string, NumberFromString, _.boolean) // $ExpectType Codec _.tuple(_.string, _.number, _.boolean) -const f: (s: string) => void = (s) => s.length - // -// ksum +// fromSum // // $ExpectType Codec<{ _tag: unknown; a: unknown; } | { _tag: unknown; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: number; }> -_.ksum('_tag')({ - A: _.ktype({ _tag: _.literal('A'), a: _.string }), - B: _.ktype({ _tag: _.literal('B'), b: NumberFromString }) +_.fromSum('_tag')({ + A: _.fromType({ _tag: _.literal('A'), a: _.string }), + B: _.fromType({ _tag: _.literal('B'), b: NumberFromString }) }) // diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 777a3af1c..ddcad509e 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -20,13 +20,13 @@ export type TypeOfNumberFromString = _.TypeOf export type InputOfNumberFromString = _.InputOf // -// ktype +// fromType // // $ExpectType Decoder<{ a: unknown; b: { c: string; }; }, { a: string; b: { c: number; }; }> -_.ktype({ +_.fromType({ a: _.string, - b: _.ktype({ + b: _.fromType({ c: NumberFromString }) }) @@ -44,13 +44,13 @@ _.type({ }) // -// kpartial +// fromPartial // // $ExpectType Decoder; }>, Partial<{ a: string; b: Partial<{ c: number; }>; }>> -_.kpartial({ +_.fromPartial({ a: _.string, - b: _.kpartial({ + b: _.fromPartial({ c: _.number }) }) @@ -67,6 +67,13 @@ _.partial({ }) }) +// +// fromArray +// + +// $ExpectType Decoder +_.fromArray(NumberFromString) + // // array // @@ -74,6 +81,44 @@ _.partial({ // $ExpectType Decoder _.array(_.string) +// +// fromRecord +// + +// $ExpectType Decoder, Record> +_.fromRecord(NumberFromString) + +// +// record +// + +// $ExpectType Decoder> +_.record(_.string) + +// +// fromTuple +// + +// $ExpectType Decoder<[unknown, string, unknown], [string, number, boolean]> +_.fromTuple(_.string, NumberFromString, _.boolean) + +// +// tuple +// + +// $ExpectType Decoder +_.tuple(_.string, _.number, _.boolean) + +// +// fromSum +// + +// $ExpectType Decoder<{ _tag: unknown; a: unknown; } | { _tag: unknown; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: number; }> +_.fromSum('_tag')({ + A: _.fromType({ _tag: _.literal('A'), a: _.string }), + B: _.fromType({ _tag: _.literal('B'), b: NumberFromString }) +}) + // // sum // diff --git a/src/Codec.ts b/src/Codec.ts index 6f1dcce2c..abbfbf323 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -146,10 +146,10 @@ export function nullable(or: Codec): Codec>>( +export function fromType

>>( properties: P ): Codec<{ [K in keyof P]: InputOf }, { [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { - return make(D.ktype(properties) as any, E.type(properties)) + return make(D.fromType(properties) as any, E.type(properties)) } /** @@ -159,21 +159,21 @@ export function ktype

>>( export function type

>>( properties: P ): Codec }, { [K in keyof P]: TypeOf }> { - return pipe(UnknownRecord, compose(ktype(properties as any))) as any + return pipe(UnknownRecord, compose(fromType(properties as any))) as any } /** * @category combinators * @since 2.2.8 */ -export function kpartial

>>( +export function fromPartial

>>( properties: P ): Codec< Partial<{ [K in keyof P]: InputOf }>, Partial<{ [K in keyof P]: OutputOf }>, Partial<{ [K in keyof P]: TypeOf }> > { - return make(D.kpartial(properties), E.partial(properties)) + return make(D.fromPartial(properties), E.partial(properties)) } /** @@ -183,15 +183,15 @@ export function kpartial

>>( export function partial

>>( properties: P ): Codec }>, Partial<{ [K in keyof P]: TypeOf }>> { - return pipe(UnknownRecord, compose(kpartial(properties as any))) as any + return pipe(UnknownRecord, compose(fromPartial(properties as any))) as any } /** * @category combinators * @since 2.2.3 */ -export function karray(item: Codec): Codec, Array, Array> { - return make(D.karray(item), E.array(item)) +export function fromArray(item: Codec): Codec, Array, Array> { + return make(D.fromArray(item), E.array(item)) } /** @@ -199,17 +199,17 @@ export function karray(item: Codec): Codec, Array, * @since 2.2.3 */ export function array(item: Codec): Codec, Array> { - return pipe(UnknownArray, compose(karray(item))) as any + return pipe(UnknownArray, compose(fromArray(item))) as any } /** * @category combinators * @since 2.2.3 */ -export function krecord( +export function fromRecord( codomain: Codec ): Codec, Record, Record> { - return make(D.krecord(codomain), E.record(codomain)) + return make(D.fromRecord(codomain), E.record(codomain)) } /** @@ -217,17 +217,17 @@ export function krecord( * @since 2.2.3 */ export function record(codomain: Codec): Codec, Record> { - return pipe(UnknownRecord, compose(krecord(codomain))) as any + return pipe(UnknownRecord, compose(fromRecord(codomain))) as any } /** * @category combinators * @since 2.2.8 */ -export const ktuple = >>( +export const fromTuple = >>( ...components: C ): Codec<{ [K in keyof C]: InputOf }, { [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> => - make(D.ktuple(...components) as any, E.tuple(...components)) + make(D.fromTuple(...components) as any, E.tuple(...components)) /** * @category combinators @@ -236,7 +236,7 @@ export const ktuple = >>( export function tuple>>( ...components: C ): Codec }, { [K in keyof C]: TypeOf }> { - return pipe(UnknownArray as any, compose(ktuple(...components) as any)) as any + return pipe(UnknownArray as any, compose(fromTuple(...components) as any)) as any } /** @@ -255,12 +255,12 @@ export const intersect = ( * @category combinators * @since 2.2.8 */ -export const ksum = ( +export const fromSum = ( tag: T ): (>>( members: MS ) => Codec, OutputOf, TypeOf>) => { - const decoder = D.ksum(tag) + const decoder = D.fromSum(tag) const encoder = E.sum(tag) return (members) => make(decoder(members) as any, encoder(members)) } @@ -274,7 +274,7 @@ export function sum( ): >>( members: M ) => Codec, TypeOf> { - const sum = ksum(tag) + const sum = fromSum(tag) return (members) => pipe(UnknownRecord, compose(sum(members) as any)) as any } diff --git a/src/Decoder.ts b/src/Decoder.ts index e1e45c8d5..edbeefafd 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -221,10 +221,10 @@ export const nullable: (or: Decoder) => Decoder * @category combinators * @since 2.2.8 */ -export const ktype =

>>( +export const fromType =

>>( properties: P ): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) + K.fromType(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators @@ -232,16 +232,16 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord as any, compose(ktype(properties))) +): Decoder => pipe(UnknownRecord as any, compose(fromType(properties))) /** * @category combinators * @since 2.2.8 */ -export const kpartial =

>>( +export const fromPartial =

>>( properties: P ): Decoder }>, Partial<{ [K in keyof P]: TypeOf }>> => - K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) + K.fromPartial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** * @category combinators @@ -249,44 +249,44 @@ export const kpartial =

>>( */ export const partial = ( properties: { [K in keyof A]: Decoder } -): Decoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) +): Decoder> => pipe(UnknownRecord as any, compose(fromPartial(properties))) /** * @category combinators * @since 2.2.8 */ -export const karray = (item: Decoder): Decoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) +export const fromArray = (item: Decoder): Decoder, Array> => + K.fromArray(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.7 */ export const array = (item: Decoder): Decoder> => - pipe(UnknownArray, compose(karray(item))) + pipe(UnknownArray, compose(fromArray(item))) /** * @category combinators * @since 2.2.8 */ -export const krecord = (codomain: Decoder): Decoder, Record> => - K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +export const fromRecord = (codomain: Decoder): Decoder, Record> => + K.fromRecord(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: Decoder): Decoder> => - pipe(UnknownRecord, compose(krecord(codomain))) + pipe(UnknownRecord, compose(fromRecord(codomain))) /** * @category combinators * @since 2.2.8 */ -export const ktuple = >>( +export const fromTuple = >>( ...components: C ): Decoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) + K.fromTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators @@ -294,7 +294,7 @@ export const ktuple = >>( */ export const tuple = >( ...components: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any +): Decoder => pipe(UnknownArray as any, compose(fromTuple(...components))) as any /** * @category combinators @@ -318,10 +318,10 @@ export const intersect: (right: Decoder) => (left: Decoder< * @category combinators * @since 2.2.8 */ -export const ksum = (tag: T) => >>( +export const fromSum = (tag: T) => >>( members: MS ): Decoder, TypeOf> => - K.sum(M)((tag, value, keys) => + K.fromSum(M)((tag, value, keys) => FS.of( DE.key( tag, @@ -337,7 +337,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) +): Decoder => pipe(UnknownRecord as any, compose(fromSum(tag)(members))) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index f79ed40f3..b9ad74841 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -125,7 +125,7 @@ export function nullable( * @category combinators * @since 2.2.7 */ -export function type( +export function fromType( M: Applicative2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E @@ -145,7 +145,7 @@ export function type( * @category combinators * @since 2.2.7 */ -export function partial( +export function fromPartial( M: Applicative2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E @@ -182,7 +182,7 @@ export function partial( * @category combinators * @since 2.2.7 */ -export function array( +export function fromArray( M: Applicative2C & Bifunctor2 ): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> { const traverse = traverseArrayWithIndex(M) @@ -195,7 +195,7 @@ export function array( * @category combinators * @since 2.2.7 */ -export function record( +export function fromRecord( M: Applicative2C & Bifunctor2 ): ( onKeyError: (key: string, e: E) => E @@ -210,7 +210,7 @@ export function record( * @category combinators * @since 2.2.7 */ -export function tuple( +export function fromTuple( M: Applicative2C & Bifunctor2 ): ( onIndexError: (index: number, e: E) => E @@ -272,7 +272,7 @@ export function intersect( * @category combinators * @since 2.2.7 */ -export function sum( +export function fromSum( M: MonadThrow2C ): ( onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index ea29997be..96eae0e6a 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -224,10 +224,10 @@ export const nullable: (or: TaskDecoder) => TaskDecoder>>( +export const fromType =

>>( properties: P ): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.type(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) + K.fromType(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** * @category combinators @@ -235,16 +235,16 @@ export const ktype =

>>( */ export const type = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord as any, compose(ktype(properties))) +): TaskDecoder => pipe(UnknownRecord as any, compose(fromType(properties))) /** * @category combinators * @since 2.2.8 */ -export const kpartial =

>>( +export const fromPartial =

>>( properties: P ): TaskDecoder }>, Partial<{ [K in keyof P]: TypeOf }>> => - K.partial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) + K.fromPartial(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(properties) /** * @category combinators @@ -252,44 +252,45 @@ export const kpartial =

>>( */ export const partial = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => pipe(UnknownRecord as any, compose(kpartial(properties))) +): TaskDecoder> => + pipe(UnknownRecord as any, compose(fromPartial(properties))) /** * @category combinators * @since 2.2.8 */ -export const karray = (item: TaskDecoder): TaskDecoder, Array> => - K.array(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) +export const fromArray = (item: TaskDecoder): TaskDecoder, Array> => + K.fromArray(M)((i, e) => FS.of(DE.index(i, DE.optional, e)))(item) /** * @category combinators * @since 2.2.7 */ export const array = (item: TaskDecoder): TaskDecoder> => - pipe(UnknownArray, compose(karray(item))) + pipe(UnknownArray, compose(fromArray(item))) /** * @category combinators * @since 2.2.8 */ -export const krecord = (codomain: TaskDecoder): TaskDecoder, Record> => - K.record(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) +export const fromRecord = (codomain: TaskDecoder): TaskDecoder, Record> => + K.fromRecord(M)((k, e) => FS.of(DE.key(k, DE.optional, e)))(codomain) /** * @category combinators * @since 2.2.7 */ export const record = (codomain: TaskDecoder): TaskDecoder> => - pipe(UnknownRecord, compose(krecord(codomain))) + pipe(UnknownRecord, compose(fromRecord(codomain))) /** * @category combinators * @since 2.2.8 */ -export const ktuple = >>( +export const fromTuple = >>( ...components: C ): TaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.tuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) + K.fromTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) /** * @category combinators @@ -297,7 +298,7 @@ export const ktuple = >>( */ export const tuple = >( ...components: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownArray as any, compose(ktuple(...components))) as any +): TaskDecoder => pipe(UnknownArray as any, compose(fromTuple(...components))) as any /** * @category combinators @@ -323,10 +324,10 @@ export const intersect: ( * @category combinators * @since 2.2.8 */ -export const ksum = (tag: T) => >>( +export const fromSum = (tag: T) => >>( members: MS ): TaskDecoder, TypeOf> => - K.sum(M)((tag, value, keys) => + K.fromSum(M)((tag, value, keys) => FS.of( DE.key( tag, @@ -342,7 +343,7 @@ export const ksum = (tag: T) => (tag: T) => ( members: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord as any, compose(ksum(tag)(members))) +): TaskDecoder => pipe(UnknownRecord as any, compose(fromSum(tag)(members))) /** * @category combinators diff --git a/test/Codec.ts b/test/Codec.ts index 21f534f01..a421ae9df 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -6,19 +6,13 @@ import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' import * as E from 'fp-ts/lib/Either' import * as H from './helpers' -import { id } from '../src/Encoder' - -const codecString: _.Codec = _.make(D.string, id()) const codecNumberFromString: _.Codec = _.make( H.decoderNumberFromString, H.encoderNumberToString ) -const codecNumberFromUnknownString: _.Codec = pipe( - codecString, - _.compose(codecNumberFromString) -) +const codecNumber: _.Codec = pipe(_.string, _.compose(codecNumberFromString)) const codecPositive: _.Codec = _.fromDecoder(H.decoderPositive) @@ -162,13 +156,13 @@ describe('Codec', () => { describe('nullable', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = _.nullable(codecNumberFromUnknownString) + const codec = _.nullable(codecNumber) assert.deepStrictEqual(codec.decode(null), D.success(null)) assert.deepStrictEqual(codec.decode('1'), D.success(1)) }) it('should reject an invalid input', () => { - const codec = _.nullable(codecNumberFromUnknownString) + const codec = _.nullable(codecNumber) assert.deepStrictEqual( codec.decode(undefined), E.left( @@ -192,7 +186,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = _.nullable(codecNumberFromUnknownString) + const codec = _.nullable(codecNumber) assert.strictEqual(codec.encode(null), null) assert.strictEqual(codec.encode(1), '1') }) @@ -265,7 +259,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = _.type({ a: codecNumberFromUnknownString }) + const codec = _.type({ a: codecNumber }) assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) }) @@ -341,7 +335,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = _.partial({ a: codecNumberFromUnknownString }) + const codec = _.partial({ a: codecNumber }) assert.deepStrictEqual(codec.encode({}), {}) assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) }) @@ -397,7 +391,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = _.record(codecNumberFromUnknownString) + const codec = _.record(codecNumber) assert.deepStrictEqual(codec.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) }) }) @@ -433,7 +427,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = _.array(codecNumberFromUnknownString) + const codec = _.array(codecNumber) assert.deepStrictEqual(codec.encode([1, 2]), ['1', '2']) }) }) @@ -484,7 +478,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = _.tuple(codecNumberFromUnknownString, _.string) + const codec = _.tuple(codecNumber, _.string) assert.deepStrictEqual(codec.encode([1, 'a']), ['1', 'a']) }) }) @@ -505,7 +499,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: codecNumberFromUnknownString }))) + const codec = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: codecNumber }))) assert.deepStrictEqual(codec.encode({ a: 'a', b: 1 }), { a: 'a', b: '1' }) }) @@ -555,7 +549,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: codecNumberFromUnknownString }) + const B = _.type({ _tag: _.literal('B'), b: codecNumber }) const codec = sum({ A, B }) assert.deepStrictEqual(codec.encode({ _tag: 'A', a: 'a' }), { _tag: 'A', a: 'a' }) assert.deepStrictEqual(codec.encode({ _tag: 'B', b: 1 }), { _tag: 'B', b: '1' }) @@ -574,7 +568,7 @@ describe('Codec', () => { } const lazyCodec: _.Codec = _.lazy('A', () => - pipe(_.type({ a: codecNumberFromUnknownString }), _.intersect(_.partial({ b: lazyCodec }))) + pipe(_.type({ a: codecNumber }), _.intersect(_.partial({ b: lazyCodec }))) ) describe('decode', () => { From 79cfe76ad8aaa0f6e081b2c5f67894c28cf75389 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 10 Jul 2020 17:59:08 +0200 Subject: [PATCH 132/222] add issue test --- test/Codec.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/Codec.ts b/test/Codec.ts index a421ae9df..45ae60c7a 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -613,4 +613,42 @@ describe('Codec', () => { }) }) }) + + it('#453', () => { + const Base64: _.Codec = { + decode: (s) => + E.tryCatch( + () => Buffer.from(s, 'base64').toString(), + () => D.error(s, 'Base64') + ), + encode: (s) => Buffer.from(s).toString('base64') + } + + const Json: _.Codec = { + decode: (s) => E.parseJSON(s, () => D.error(s, 'Json')), + encode: (a) => JSON.stringify(a) + } + + const DateFromString: _.Codec = _.make( + { + decode: (s) => { + const d = new Date(s) + return isNaN(d.getTime()) ? D.failure(s, 'DateFromISOString') : D.success(d) + } + }, + { encode: String } + ) + + const User = _.type({ a: _.string, b: pipe(_.string, _.compose(DateFromString)) }) + + const codec = pipe(_.string, _.compose(Base64), _.compose(Json), _.compose(User)) + + assert.deepStrictEqual( + codec.decode(codec.encode({ a: 'a', b: new Date('1980') })), + E.right({ + a: 'a', + b: new Date('1980') + }) + ) + }) }) From 44789f484ac4f10d920ab1d08ffecfcfc0ee51e9 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 11 Jul 2020 11:00:40 +0200 Subject: [PATCH 133/222] split Schemable instances --- CHANGELOG.md | 8 +++---- docs/modules/Decoder.ts.md | 38 ++++++++++++++++++++++++++++++---- docs/modules/Eq.ts.md | 24 ++++++++++++++++++++- docs/modules/Guard.ts.md | 38 ++++++++++++++++++++++++++++++---- docs/modules/TaskDecoder.ts.md | 38 ++++++++++++++++++++++++++++++---- docs/modules/Type.ts.md | 38 ++++++++++++++++++++++++++++++---- src/Decoder.ts | 32 +++++++++++++++++++++------- src/Eq.ts | 20 +++++++++++++++--- src/Guard.ts | 29 ++++++++++++++++++++++---- src/TaskDecoder.ts | 32 +++++++++++++++++++++------- src/Type.ts | 29 ++++++++++++++++++++++---- test/Eq.ts | 2 +- test/Type.ts | 6 +++--- 13 files changed, 284 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51b38ba97..df4c78a64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,7 @@ - add `id` function (@gcanti) - (\*) rename `functorDecoder` instance to `Functor` (@gcanti) - (\*) rename `altDecoder` instance to `Alt` (@gcanti) - - (\*) rename `schemableDecoder` instance to `Schemable` (@gcanti) + - (\*) rename and split `schemableDecoder` instance to `Schemable` (@gcanti) - add `Category` instance (@gcanti) - add `InputOf` type (@gcanti) - `TaskDecoder` @@ -61,7 +61,7 @@ - add `id` function (@gcanti) - (\*) rename `functorTaskDecoder` instance to `Functor` (@gcanti) - (\*) rename `altTaskDecoder` instance to `Alt` (@gcanti) - - (\*) rename `schemableTaskDecoder` instance to `Schemable` (@gcanti) + - (\*) rename and split `schemableTaskDecoder` instance to `Schemable` (@gcanti) - add `Category` instance (@gcanti) - add `InputOf` type (@gcanti) - `Guard` @@ -78,7 +78,7 @@ - (\*) rename `contravariantEncoder` to `Contravariant` (@gcanti) - (\*) rename `categoryEncoder` to `Category` (@gcanti) - `Eq` - - (\*) rename `schemableEq` to `Schemable` (@gcanti) + - (\*) rename and split `schemableEq` to `Schemable` (@gcanti) - `Kleisli` - add `id` (@gcanti) - rename `type` to `fromType` (@gcanti) @@ -93,7 +93,7 @@ - `Schemable` - add `Schemable2C`, `WithUnknownContainers2C`, `WithUnion2C`, `WithRefine2C` (@gcanti) - `Type` - - (\*) rename `schemableType` to `Schemable` (@gcanti) + - (\*) rename and split `schemableType` to `Schemable` (@gcanti) (\*) breaking change diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index b4fa16a7e..e465e63fb 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -63,6 +63,9 @@ Added in v2.2.7 - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) + - [WithRefine](#withrefine) + - [WithUnion](#withunion) + - [WithUnknownContainers](#withunknowncontainers) - [model](#model) - [Decoder (interface)](#decoder-interface) - [primitives](#primitives) @@ -466,10 +469,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const Schemable: S.Schemable2C<'io-ts/Decoder', unknown> & - S.WithUnknownContainers2C<'io-ts/Decoder', unknown> & - S.WithUnion2C<'io-ts/Decoder', unknown> & - S.WithRefine2C<'io-ts/Decoder', unknown> +export declare const Schemable: S.Schemable2C<'io-ts/Decoder', unknown> ``` Added in v2.2.8 @@ -494,6 +494,36 @@ export type URI = typeof URI Added in v2.2.7 +## WithRefine + +**Signature** + +```ts +export declare const WithRefine: S.WithRefine2C<'io-ts/Decoder', unknown> +``` + +Added in v2.2.8 + +## WithUnion + +**Signature** + +```ts +export declare const WithUnion: S.WithUnion2C<'io-ts/Decoder', unknown> +``` + +Added in v2.2.8 + +## WithUnknownContainers + +**Signature** + +```ts +export declare const WithUnknownContainers: S.WithUnknownContainers2C<'io-ts/Decoder', unknown> +``` + +Added in v2.2.8 + # model ## Decoder (interface) diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 6897d7d5a..35fddadf2 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -31,6 +31,8 @@ Added in v2.2.2 - [type](#type) - [instances](#instances) - [Schemable](#schemable) + - [WithRefine](#withrefine) + - [WithUnknownContainers](#withunknowncontainers) - [primitives](#primitives) - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) @@ -142,7 +144,27 @@ Added in v2.2.2 **Signature** ```ts -export declare const Schemable: Schemable1<'Eq'> & WithUnknownContainers1<'Eq'> & WithRefine1<'Eq'> +export declare const Schemable: Schemable1<'Eq'> +``` + +Added in v2.2.8 + +## WithRefine + +**Signature** + +```ts +export declare const WithRefine: WithRefine1<'Eq'> +``` + +Added in v2.2.8 + +## WithUnknownContainers + +**Signature** + +```ts +export declare const WithUnknownContainers: WithUnknownContainers1<'Eq'> ``` Added in v2.2.8 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 780060ee9..5671e7cac 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -41,6 +41,9 @@ Added in v2.2.0 - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) + - [WithRefine](#withrefine) + - [WithUnion](#withunion) + - [WithUnknownContainers](#withunknowncontainers) - [model](#model) - [Guard (interface)](#guard-interface) - [primitives](#primitives) @@ -238,10 +241,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const Schemable: Schemable1<'io-ts/Guard'> & - WithUnknownContainers1<'io-ts/Guard'> & - WithUnion1<'io-ts/Guard'> & - WithRefine1<'io-ts/Guard'> +export declare const Schemable: Schemable1<'io-ts/Guard'> ``` Added in v2.2.8 @@ -266,6 +266,36 @@ export type URI = typeof URI Added in v2.2.0 +## WithRefine + +**Signature** + +```ts +export declare const WithRefine: WithRefine1<'io-ts/Guard'> +``` + +Added in v2.2.8 + +## WithUnion + +**Signature** + +```ts +export declare const WithUnion: WithUnion1<'io-ts/Guard'> +``` + +Added in v2.2.8 + +## WithUnknownContainers + +**Signature** + +```ts +export declare const WithUnknownContainers: WithUnknownContainers1<'io-ts/Guard'> +``` + +Added in v2.2.8 + # model ## Guard (interface) diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index dda070f6d..0465d0c7b 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -64,6 +64,9 @@ Added in v2.2.7 - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) + - [WithRefine](#withrefine) + - [WithUnion](#withunion) + - [WithUnknownContainers](#withunknowncontainers) - [model](#model) - [TaskDecoder (interface)](#taskdecoder-interface) - [primitives](#primitives) @@ -482,10 +485,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const Schemable: S.Schemable2C<'io-ts/TaskDecoder', unknown> & - S.WithUnknownContainers2C<'io-ts/TaskDecoder', unknown> & - S.WithUnion2C<'io-ts/TaskDecoder', unknown> & - S.WithRefine2C<'io-ts/TaskDecoder', unknown> +export declare const Schemable: S.Schemable2C<'io-ts/TaskDecoder', unknown> ``` Added in v2.2.8 @@ -510,6 +510,36 @@ export type URI = typeof URI Added in v2.2.7 +## WithRefine + +**Signature** + +```ts +export declare const WithRefine: S.WithRefine2C<'io-ts/TaskDecoder', unknown> +``` + +Added in v2.2.8 + +## WithUnion + +**Signature** + +```ts +export declare const WithUnion: S.WithUnion2C<'io-ts/TaskDecoder', unknown> +``` + +Added in v2.2.8 + +## WithUnknownContainers + +**Signature** + +```ts +export declare const WithUnknownContainers: S.WithUnknownContainers2C<'io-ts/TaskDecoder', unknown> +``` + +Added in v2.2.8 + # model ## TaskDecoder (interface) diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 04ec70290..46e3d16b7 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -37,6 +37,9 @@ Added in v2.2.3 - [Schemable](#schemable) - [URI](#uri) - [URI (type alias)](#uri-type-alias) + - [WithRefine](#withrefine) + - [WithUnion](#withunion) + - [WithUnknownContainers](#withunknowncontainers) - [model](#model) - [Type (interface)](#type-interface) - [primitives](#primitives) @@ -183,10 +186,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const Schemable: Schemable1<'io-ts/Type'> & - WithUnknownContainers1<'io-ts/Type'> & - WithUnion1<'io-ts/Type'> & - WithRefine1<'io-ts/Type'> +export declare const Schemable: Schemable1<'io-ts/Type'> ``` Added in v2.2.8 @@ -211,6 +211,36 @@ export type URI = typeof URI Added in v2.2.3 +## WithRefine + +**Signature** + +```ts +export declare const WithRefine: WithRefine1<'io-ts/Type'> +``` + +Added in v2.2.8 + +## WithUnion + +**Signature** + +```ts +export declare const WithUnion: WithUnion1<'io-ts/Type'> +``` + +Added in v2.2.8 + +## WithUnknownContainers + +**Signature** + +```ts +export declare const WithUnknownContainers: WithUnknownContainers1<'io-ts/Type'> +``` + +Added in v2.2.8 + # model ## Type (interface) diff --git a/src/Decoder.ts b/src/Decoder.ts index edbeefafd..13e2496fa 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -448,10 +448,7 @@ export const Category: Category2 = { * @category instances * @since 2.2.8 */ -export const Schemable: S.Schemable2C & - S.WithUnknownContainers2C & - S.WithUnion2C & - S.WithRefine2C = { +export const Schemable: S.Schemable2C = { URI, literal, string, @@ -465,10 +462,31 @@ export const Schemable: S.Schemable2C & tuple: tuple as S.Schemable2C['tuple'], intersect, sum, - lazy, + lazy +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnknownContainers: S.WithUnknownContainers2C = { UnknownArray, - UnknownRecord, - union: union as S.WithUnion2C['union'], + UnknownRecord +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnion: S.WithUnion2C = { + union: union as S.WithUnion2C['union'] +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithRefine: S.WithRefine2C = { refine: refine as S.WithRefine2C['refine'] } diff --git a/src/Eq.ts b/src/Eq.ts index 5d687f2c2..394a517fd 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -179,7 +179,7 @@ export function lazy(f: () => Eq): Eq { * @category instances * @since 2.2.8 */ -export const Schemable: Schemable1 & WithUnknownContainers1 & WithRefine1 = { +export const Schemable: Schemable1 = { URI: E.URI, literal: () => E.eqStrict, string, @@ -193,8 +193,22 @@ export const Schemable: Schemable1 & WithUnknownContainers1 & With tuple, intersect, sum, - lazy: (_, f) => lazy(f), + lazy: (_, f) => lazy(f) +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnknownContainers: WithUnknownContainers1 = { UnknownArray, - UnknownRecord, + UnknownRecord +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithRefine: WithRefine1 = { refine: () => (from) => from } diff --git a/src/Guard.ts b/src/Guard.ts index 4186f631d..2d8c7792f 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -300,7 +300,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.8 */ -export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { +export const Schemable: Schemable1 = { URI, literal, string, @@ -314,9 +314,30 @@ export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnio tuple: tuple as Schemable1['tuple'], intersect, sum, - lazy: (_, f) => lazy(f), + lazy: (_, f) => lazy(f) +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnknownContainers: WithUnknownContainers1 = { UnknownArray, - UnknownRecord, - union: union as WithUnion1['union'], + UnknownRecord +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnion: WithUnion1 = { + union: union as WithUnion1['union'] +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithRefine: WithRefine1 = { refine: refine as WithRefine1['refine'] } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 96eae0e6a..7e80406c7 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -454,10 +454,7 @@ export const Category: Category2 = { * @category instances * @since 2.2.8 */ -export const Schemable: S.Schemable2C & - S.WithUnknownContainers2C & - S.WithUnion2C & - S.WithRefine2C = { +export const Schemable: S.Schemable2C = { URI, literal, string, @@ -471,10 +468,31 @@ export const Schemable: S.Schemable2C & tuple: tuple as S.Schemable2C['tuple'], intersect, sum, - lazy, + lazy +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnknownContainers: S.WithUnknownContainers2C = { UnknownArray, - UnknownRecord, - union: union as S.WithUnion2C['union'], + UnknownRecord +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnion: S.WithUnion2C = { + union: union as S.WithUnion2C['union'] +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithRefine: S.WithRefine2C = { refine: refine as S.WithRefine2C['refine'] } diff --git a/src/Type.ts b/src/Type.ts index d924f26e5..ace0caafe 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -181,7 +181,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.8 */ -export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefine1 = { +export const Schemable: Schemable1 = { URI, literal, string, @@ -195,9 +195,30 @@ export const Schemable: Schemable1 & WithUnknownContainers1 & WithUnio tuple: tuple as Schemable1['tuple'], intersect, sum, - lazy, + lazy +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnknownContainers: WithUnknownContainers1 = { UnknownArray, - UnknownRecord, - union: union as WithUnion1['union'], + UnknownRecord +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithUnion: WithUnion1 = { + union: union as WithUnion1['union'] +} + +/** + * @category instances + * @since 2.2.8 + */ +export const WithRefine: WithRefine1 = { refine: refine as WithRefine1['refine'] } diff --git a/test/Eq.ts b/test/Eq.ts index d2788c122..6e74bfc71 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -88,7 +88,7 @@ describe('Eq', () => { type NonEmptyString = string & NonEmptyStringBrand const eq = pipe( E.string, - E.Schemable.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + E.WithRefine.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') ) const a: NonEmptyString = 'a' as any const b: NonEmptyString = 'b' as any diff --git a/test/Type.ts b/test/Type.ts index d8087526a..2c20a1562 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -38,9 +38,9 @@ const interpreter: { function check(schema: Schema, type: t.Type): void { const arb = interpreter(A.Schemable)(schema) - const decoder = interpreter(D.Schemable)(schema) - const guard = interpreter(G.Schemable)(schema) - const itype = interpreter(_.Schemable)(schema) + const decoder = interpreter({ ...D.Schemable, ...D.WithUnknownContainers, ...D.WithUnion })(schema) + const guard = interpreter({ ...G.Schemable, ...G.WithUnknownContainers, ...G.WithUnion })(schema) + const itype = interpreter({ ..._.Schemable, ..._.WithUnknownContainers, ..._.WithUnion })(schema) // decoder and type should be aligned fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) === isRight(type.decode(a)))) // interpreted type and type should be aligned From c385e713326d7f7334d504aafbcbff83426a1651 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 13 Jul 2020 16:01:39 +0200 Subject: [PATCH 134/222] update changelog --- CHANGELOG.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df4c78a64..3243ef668 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,7 @@ - add `id` function (@gcanti) - (\*) rename `functorDecoder` instance to `Functor` (@gcanti) - (\*) rename `altDecoder` instance to `Alt` (@gcanti) - - (\*) rename and split `schemableDecoder` instance to `Schemable` (@gcanti) + - (\*) rename and split `schemableDecoder` (@gcanti) - add `Category` instance (@gcanti) - add `InputOf` type (@gcanti) - `TaskDecoder` @@ -61,12 +61,12 @@ - add `id` function (@gcanti) - (\*) rename `functorTaskDecoder` instance to `Functor` (@gcanti) - (\*) rename `altTaskDecoder` instance to `Alt` (@gcanti) - - (\*) rename and split `schemableTaskDecoder` instance to `Schemable` (@gcanti) + - (\*) rename and split `schemableTaskDecoder` (@gcanti) - add `Category` instance (@gcanti) - add `InputOf` type (@gcanti) - `Guard` - (\*) make `Guard` more general by adding a `I` type parameter (@gcanti) - - (\*) rename `schemableGuard` to `Schemable` (@gcanti) + - (\*) rename `schemableGuard` (@gcanti) - add `InputOf` type (@gcanti) - add `alt` function (@gcanti) - add `zero` function (@gcanti) @@ -78,7 +78,7 @@ - (\*) rename `contravariantEncoder` to `Contravariant` (@gcanti) - (\*) rename `categoryEncoder` to `Category` (@gcanti) - `Eq` - - (\*) rename and split `schemableEq` to `Schemable` (@gcanti) + - (\*) rename and split `schemableEq` (@gcanti) - `Kleisli` - add `id` (@gcanti) - rename `type` to `fromType` (@gcanti) @@ -87,13 +87,10 @@ - rename `record` to `fromRecord` (@gcanti) - rename `tuple` to `fromTuple` (@gcanti) - rename `sum` to `fromSum` (@gcanti) - - `JsonEncoder` - - (\*) rename `contravariantJsonCodec` to `Contravariant` (@gcanti) - - (\*) rename `schemableJsonEncoder` to `Schemable` (@gcanti) - `Schemable` - add `Schemable2C`, `WithUnknownContainers2C`, `WithUnion2C`, `WithRefine2C` (@gcanti) - `Type` - - (\*) rename and split `schemableType` to `Schemable` (@gcanti) + - (\*) rename and split `schemableType` (@gcanti) (\*) breaking change From a7283bd146b52803ab2e748cd174945723b426c5 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 16 Jul 2020 10:29:04 +0200 Subject: [PATCH 135/222] remove `Object.freeze` calls, closes #497 --- CHANGELOG.md | 5 ++++ docs/modules/index.ts.md | 4 +-- package.json | 2 +- src/index.ts | 52 +++++++------------------------------ test/2.1.x/readonly.ts | 16 +----------- test/2.1.x/readonlyArray.ts | 16 +----------- 6 files changed, 20 insertions(+), 75 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3243ef668..7a0564223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.9 + +- **Polish** + - remove `Object.freeze` calls, closes #497 (@gcanti) + # 2.2.8 - **Experimental** diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 393ec5095..0ff850a35 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -218,7 +218,7 @@ Added in v1.0.0 **Signature** ```ts -export declare const array: (codec: C, name?: string) => ArrayC +export declare const array: (item: C, name?: string) => ArrayC ``` Added in v1.0.0 @@ -310,7 +310,7 @@ Added in v1.0.0 **Signature** ```ts -export declare const readonlyArray: (codec: C, name?: string) => ReadonlyArrayC +export declare const readonlyArray: (item: C, name?: string) => ReadonlyArrayC ``` Added in v1.0.0 diff --git a/package.json b/package.json index 2b7ee7bf8..fe4e9a749 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.8", + "version": "2.2.9", "description": "TypeScript runtime type system for IO decoding/encoding", "files": [ "lib", diff --git a/src/index.ts b/src/index.ts index 09af4c6a1..10903a67e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -793,10 +793,10 @@ export interface ArrayC extends ArrayType>, * @category Combinators * @since 1.0.0 */ -export const array = (codec: C, name: string = `Array<${codec.name}>`): ArrayC => +export const array = (item: C, name: string = `Array<${item.name}>`): ArrayC => new ArrayType( name, - (u): u is Array> => UnknownArray.is(u) && u.every(codec.is), + (u): u is Array> => UnknownArray.is(u) && u.every(item.is), (u, c) => { const e = UnknownArray.validate(u, c) if (isLeft(e)) { @@ -808,7 +808,7 @@ export const array = (codec: C, name: string = `Array<${codec.n const errors: Errors = [] for (let i = 0; i < len; i++) { const ui = us[i] - const result = codec.validate(ui, appendContext(c, String(i), codec, ui)) + const result = item.validate(ui, appendContext(c, String(i), item, ui)) if (isLeft(result)) { pushAll(errors, result.left) } else { @@ -823,8 +823,8 @@ export const array = (codec: C, name: string = `Array<${codec.n } return errors.length > 0 ? failures(errors) : success(as) }, - codec.encode === identity ? identity : (a) => a.map(codec.encode), - codec + item.encode === identity ? identity : (a) => a.map(item.encode), + item ) /** @@ -1633,23 +1633,7 @@ export interface ReadonlyC * @since 1.0.0 */ export const readonly = (codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC => { - return new ReadonlyType( - name, - codec.is, - (u, c) => { - const e = codec.validate(u, c) - if (isLeft(e)) { - return e - } - const x = e.right - if (process.env.NODE_ENV !== 'production') { - return right(Object.freeze(x)) - } - return right(x) - }, - codec.encode === identity ? identity : codec.encode, - codec - ) + return new ReadonlyType(name, codec.is, codec.validate, codec.encode, codec) } /** @@ -1682,27 +1666,11 @@ export interface ReadonlyArrayC * @since 1.0.0 */ export const readonlyArray = ( - codec: C, - name: string = `ReadonlyArray<${codec.name}>` + item: C, + name: string = `ReadonlyArray<${item.name}>` ): ReadonlyArrayC => { - const arrayType = array(codec) - return new ReadonlyArrayType( - name, - arrayType.is, - (u, c) => { - const e = arrayType.validate(u, c) - if (isLeft(e)) { - return e - } - const x = e.right - if (process.env.NODE_ENV !== 'production') { - return right(Object.freeze(x)) - } - return right(x) - }, - arrayType.encode as any, - codec - ) + const codec = array(item) + return new ReadonlyArrayType(name, codec.is, codec.validate, codec.encode, item) as any } /** diff --git a/test/2.1.x/readonly.ts b/test/2.1.x/readonly.ts index 42f6100b9..8a8d4807b 100644 --- a/test/2.1.x/readonly.ts +++ b/test/2.1.x/readonly.ts @@ -1,7 +1,6 @@ import * as assert from 'assert' import * as t from '../../src/index' -import { assertSuccess, assertFailure, NumberFromString } from './helpers' -import { either } from 'fp-ts/lib/Either' +import { assertFailure, assertSuccess, NumberFromString } from './helpers' describe('readonly', () => { describe('name', () => { @@ -42,19 +41,6 @@ describe('readonly', () => { const T = t.readonly(t.type({ a: t.number })) assertFailure(T, {}, ['Invalid value undefined supplied to : Readonly<{ a: number }>/a: number']) }) - - it('should freeze the value', () => { - const T = t.readonly(t.type({ a: t.number })) - either.map(T.decode({ a: 1 }), (x) => assert.ok(Object.isFrozen(x))) - }) - - it('should not freeze in production', () => { - const env = process.env.NODE_ENV - process.env.NODE_ENV = 'production' - const T = t.readonly(t.type({ a: t.number })) - either.map(T.decode({ a: 1 }), (x) => assert.ok(!Object.isFrozen(x))) - process.env.NODE_ENV = env - }) }) describe('encode', () => { diff --git a/test/2.1.x/readonlyArray.ts b/test/2.1.x/readonlyArray.ts index 71ccd09eb..9920412c9 100644 --- a/test/2.1.x/readonlyArray.ts +++ b/test/2.1.x/readonlyArray.ts @@ -1,7 +1,6 @@ import * as assert from 'assert' import * as t from '../../src/index' -import { assertSuccess, assertFailure, NumberFromString } from './helpers' -import { either } from 'fp-ts/lib/Either' +import { assertFailure, assertSuccess, NumberFromString } from './helpers' describe('readonlyArray', () => { describe('name', () => { @@ -44,19 +43,6 @@ describe('readonlyArray', () => { const T = t.readonlyArray(t.number) assertFailure(T, ['s'], ['Invalid value "s" supplied to : ReadonlyArray/0: number']) }) - - it('should freeze the value', () => { - const T = t.readonlyArray(t.number) - either.map(T.decode([1]), (x) => assert.ok(Object.isFrozen(x))) - }) - - it('should not freeze in production', () => { - const env = process.env.NODE_ENV - process.env.NODE_ENV = 'production' - const T = t.readonlyArray(t.number) - either.map(T.decode([1]), (x) => assert.ok(!Object.isFrozen(x))) - process.env.NODE_ENV = env - }) }) describe('encode', () => { From 923bd59c480aae68c29d0a5e8754543d0b31ca91 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 16 Jul 2020 10:45:36 +0200 Subject: [PATCH 136/222] add `Wrap` member to DecodeError + add `withMessage` combinator to `Decoder` and `TaskDecoder` --- CHANGELOG.md | 7 +++++++ docs/modules/DecodeError.ts.md | 29 ++++++++++++++++++++++++++++- docs/modules/Decoder.ts.md | 13 +++++++++++++ docs/modules/TaskDecoder.ts.md | 13 +++++++++++++ src/DecodeError.ts | 25 ++++++++++++++++++++++++- src/Decoder.ts | 12 +++++++++++- src/TaskDecoder.ts | 9 +++++++++ test/Decoder.ts | 18 ++++++++++++++++++ test/TaskDecoder.ts | 18 ++++++++++++++++++ 9 files changed, 141 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a0564223..3ba7d9f0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,13 @@ - **Polish** - remove `Object.freeze` calls, closes #497 (@gcanti) +- **Experimental** + - `DecodeError` + - add `Wrap` member (@gcanti) + - `Decoder` + - add `withMessage` combinator (@gcanti) + - `TaskDecoder` + - add `withMessage` combinator (@gcanti) # 2.2.8 diff --git a/docs/modules/DecodeError.ts.md b/docs/modules/DecodeError.ts.md index a104745bd..1725e4f53 100644 --- a/docs/modules/DecodeError.ts.md +++ b/docs/modules/DecodeError.ts.md @@ -25,6 +25,7 @@ Added in v2.2.7 - [lazy](#lazy) - [leaf](#leaf) - [member](#member) + - [wrap](#wrap) - [destructors](#destructors) - [fold](#fold) - [instances](#instances) @@ -37,6 +38,7 @@ Added in v2.2.7 - [Lazy (interface)](#lazy-interface) - [Leaf (interface)](#leaf-interface) - [Member (interface)](#member-interface) + - [Wrap (interface)](#wrap-interface) - [optional](#optional) - [required](#required) @@ -94,6 +96,16 @@ export declare const member: (index: number, errors: FS.FreeSemigroup(error: E, errors: FS.FreeSemigroup>) => DecodeError +``` + +Added in v2.2.9 + # destructors ## fold @@ -107,6 +119,7 @@ export declare const fold: (patterns: { Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R Member: (index: number, errors: FS.FreeSemigroup>) => R Lazy: (id: string, errors: FS.FreeSemigroup>) => R + Wrap: (error: E, errors: FS.FreeSemigroup>) => R }) => (e: DecodeError) => R ``` @@ -131,7 +144,7 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = Leaf | Key | Index | Member | Lazy +export type DecodeError = Leaf | Key | Index | Member | Lazy | Wrap ``` Added in v2.2.7 @@ -218,6 +231,20 @@ export interface Member { Added in v2.2.7 +## Wrap (interface) + +**Signature** + +```ts +export interface Wrap { + readonly _tag: 'Wrap' + readonly error: E + readonly errors: FS.FreeSemigroup> +} +``` + +Added in v2.2.9 + ## optional **Signature** diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index e465e63fb..e4df5beef 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -52,6 +52,7 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) + - [withMessage](#withmessage) - [constructors](#constructors) - [fromGuard](#fromguard) - [fromRefinement](#fromrefinement) @@ -398,6 +399,18 @@ export declare const union: , ...Decoder< Added in v2.2.7 +## withMessage + +**Signature** + +```ts +export declare const withMessage: ( + message: (input: I, e: FS.FreeSemigroup>) => string +) => (decoder: Decoder) => Decoder +``` + +Added in v2.2.9 + # constructors ## fromGuard diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 0465d0c7b..0d7c789d9 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -52,6 +52,7 @@ Added in v2.2.7 - [tuple](#tuple) - [type](#type) - [union](#union) + - [withMessage](#withmessage) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [fromGuard](#fromguard) @@ -401,6 +402,18 @@ export declare const union: , ...Task Added in v2.2.7 +## withMessage + +**Signature** + +```ts +export declare const withMessage: ( + message: (input: I, e: FS.FreeSemigroup>) => string +) => (decoder: TaskDecoder) => TaskDecoder +``` + +Added in v2.2.9 + # constructors ## fromDecoder diff --git a/src/DecodeError.ts b/src/DecodeError.ts index 37b8c5922..dac974485 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -81,11 +81,21 @@ export interface Lazy { readonly errors: FS.FreeSemigroup> } +/** + * @category model + * @since 2.2.9 + */ +export interface Wrap { + readonly _tag: 'Wrap' + readonly error: E + readonly errors: FS.FreeSemigroup> +} + /** * @category model * @since 2.2.7 */ -export type DecodeError = Leaf | Key | Index | Member | Lazy +export type DecodeError = Leaf | Key | Index | Member | Lazy | Wrap /** * @category constructors @@ -135,6 +145,16 @@ export const lazy = (id: string, errors: FS.FreeSemigroup>): D errors }) +/** + * @category constructors + * @since 2.2.9 + */ +export const wrap = (error: E, errors: FS.FreeSemigroup>): DecodeError => ({ + _tag: 'Wrap', + error, + errors +}) + /** * @category destructors * @since 2.2.7 @@ -145,6 +165,7 @@ export const fold = (patterns: { Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R Member: (index: number, errors: FS.FreeSemigroup>) => R Lazy: (id: string, errors: FS.FreeSemigroup>) => R + Wrap: (error: E, errors: FS.FreeSemigroup>) => R }): ((e: DecodeError) => R) => { const f = (e: DecodeError): R => { switch (e._tag) { @@ -158,6 +179,8 @@ export const fold = (patterns: { return patterns.Member(e.index, e.errors) case 'Lazy': return patterns.Lazy(e.id, e.errors) + case 'Wrap': + return patterns.Wrap(e.error, e.errors) } } return f diff --git a/src/Decoder.ts b/src/Decoder.ts index 13e2496fa..51d97db39 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -192,6 +192,15 @@ export const mapLeftWithInput: ( /*#__PURE__*/ K.mapLeftWithInput(M) +/** + * @category combinators + * @since 2.2.9 + */ +export const withMessage = ( + message: (input: I, e: DecodeError) => string +): ((decoder: Decoder) => Decoder) => + mapLeftWithInput((input, e) => FS.of(DE.wrap(message(input, e), e))) + /** * @category combinators * @since 2.2.7 @@ -536,7 +545,8 @@ const toTree: (e: DE.DecodeError) => Tree = DE.fold({ Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), Member: (index, errors) => make(`member ${index}`, toForest(errors)), - Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) + Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)), + Wrap: (error, errors) => make(error, toForest(errors)) }) const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 7e80406c7..d8ef66dcd 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -193,6 +193,15 @@ export const mapLeftWithInput: ( /*#__PURE__*/ K.mapLeftWithInput(M) +/** + * @category combinators + * @since 2.2.9 + */ +export const withMessage = ( + message: (input: I, e: DecodeError) => string +): ((decoder: TaskDecoder) => TaskDecoder) => + mapLeftWithInput((input, e) => FS.of(DE.wrap(message(input, e), e))) + /** * @category combinators * @since 2.2.7 diff --git a/test/Decoder.ts b/test/Decoder.ts index a4f8f609a..0be76e0ac 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -92,6 +92,24 @@ describe('Decoder', () => { assert.deepStrictEqual(decoder.decode('a'), E.left(FS.of(DE.leaf('a', 'not a number')))) }) + it('withMessage', () => { + const decoder = pipe( + _.type({ + name: _.string, + age: _.number + }), + _.withMessage(() => 'Person') + ) + assert.deepStrictEqual( + pipe(decoder.decode({}), E.mapLeft(_.draw)), + E.left(`Person +├─ required property "name" +│ └─ cannot decode undefined, should be string +└─ required property "age" + └─ cannot decode undefined, should be number`) + ) + }) + it('compose', () => { interface IntBrand { readonly Int: unique symbol diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index f6ecef600..aaafd270e 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -135,6 +135,24 @@ describe('UnknownTaskDecoder', () => { assert.deepStrictEqual(await decoder.decode('a')(), D.failure('a', 'not a number')) }) + it('withMessage', async () => { + const decoder = pipe( + _.type({ + name: _.string, + age: _.number + }), + _.withMessage(() => 'Person') + ) + assert.deepStrictEqual( + await pipe(decoder.decode({}), TE.mapLeft(_.draw))(), + E.left(`Person +├─ required property "name" +│ └─ cannot decode undefined, should be string +└─ required property "age" + └─ cannot decode undefined, should be number`) + ) + }) + it('compose', async () => { interface IntBrand { readonly Int: unique symbol From c88e2cc930fd3ffd42c748d0257c5e87d0faa4c7 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 7 Aug 2020 09:39:09 +0200 Subject: [PATCH 137/222] update Schema.md --- Schema.md | 35 +++++++++++++++++++---------------- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Schema.md b/Schema.md index c149c7545..3275a703a 100644 --- a/Schema.md +++ b/Schema.md @@ -19,12 +19,11 @@ export interface Schema { **Example** ```ts -import * as S from 'io-ts/lib/Schema' import * as D from 'io-ts/lib/Decoder' -import * as JE from 'io-ts/lib/JsonEncoder' -import * as JC from 'io-ts/lib/JsonCodec' -import * as G from 'io-ts/lib/Guard' import * as Eq from 'io-ts/lib/Eq' +import * as G from 'io-ts/lib/Guard' +import * as S from 'io-ts/lib/Schema' +import * as TD from 'io-ts/lib/TaskDecoder' export const Person = S.make((S) => S.type({ @@ -34,10 +33,9 @@ export const Person = S.make((S) => ) export const decoderPerson = S.interpreter(D.Schemable)(Person) -export const encoderPerson = S.interpreter(JE.Schemable)(Person) -export const codecPerson = S.interpreter(JC.Schemable)(Person) export const guardPerson = S.interpreter(G.Schemable)(Person) export const eqPerson = S.interpreter(Eq.Schemable)(Person) +export const taskDecoderPerson = S.interpreter(TD.Schemable)(Person) ``` # How to extend the built-in `Schema` @@ -57,14 +55,15 @@ export type Int = number & IntBrand Now we must define a custom `MySchemable` type class containing a new member `Int`... ```ts -import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' +import { Kind2, URIS2, HKT } from 'fp-ts/lib/HKT' +import * as S from 'io-ts/lib/Schemable' export interface MySchemable extends S.Schemable { readonly Int: HKT } -export interface MySchemable1 extends S.Schemable1 { - readonly Int: Kind +export interface MySchemable2C extends S.Schemable2C { + readonly Int: Kind2 } ``` @@ -80,17 +79,21 @@ export function make(f: MySchema): MySchema { } ``` -Finally we must define an instance of `MySchemable1` for `Decoder` and an interpreter +Finally we must define an instance of `MySchemable2C` for `Decoder` and an interpreter ```ts import * as D from 'io-ts/lib/Decoder' - -export const mySchemable: MySchemable1 = { - ...D.schemableDecoder, - Int: D.refinement(D.number, (n): n is Int => Number.isInteger(n), 'Int') +import { pipe } from 'fp-ts/function' + +export const mySchemable: MySchemable2C = { + ...D.Schemable, + Int: pipe( + D.number, + D.refine((n): n is Int => Number.isInteger(n), 'Int') + ) } -export function interpreter(S: MySchemable1): (schema: MySchema) => Kind +export function interpreter(S: MySchemable2C): (schema: MySchema) => Kind2 export function interpreter(S: MySchemable): (schema: MySchema) => HKT { return (schema) => schema(S) } @@ -114,7 +117,7 @@ const Person: MySchema<{ export const decoderPerson = interpreter(mySchemable)(Person) /* -const decoderPerson: D.Decoder<{ +const decoderPerson: D.Decoder diff --git a/package-lock.json b/package-lock.json index 454757640..382293c05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.8", + "version": "2.2.9", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2599,9 +2599,9 @@ "dev": true }, "fp-ts": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.7.0.tgz", - "integrity": "sha512-J7EIg4MEVuOm1vZspQDVYRD/CTsQECQk01cP5VEBvQ5LnSSjp6sckun1m1eUPSuvtMIlGgm9NqqOxE0+QyntWQ==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.8.1.tgz", + "integrity": "sha512-HuA/6roEliHoBgEOLCKmGRcM90e2trW/ITZZ9d9P/ra7PreqQagC3Jg6OzqWkai13KUbG90b8QO9rHPBGK/ckw==", "dev": true }, "fragment-cache": { diff --git a/package.json b/package.json index fe4e9a749..9b7511ce2 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", "fast-check": "^1.24.2", - "fp-ts": "^2.7.0", + "fp-ts": "^2.8.1", "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", From 942aae4a626bde43ee5e7236e03a41a65e887fe4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 7 Aug 2020 09:46:43 +0200 Subject: [PATCH 138/222] update Decoder.md --- Decoder.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Decoder.md b/Decoder.md index a2be1e271..98cbadb72 100644 --- a/Decoder.md +++ b/Decoder.md @@ -88,8 +88,8 @@ We can combine these primitive decoders through _combinators_ to build composite The `literal` constructor describes one or more literals. ```ts -export const MyLiteral: D.Decoder<'a'> = D.literal('a') -export const MyLiterals: D.Decoder<'a' | 'b'> = D.literal('a', 'b') +export const MyLiteral: D.Decoder = D.literal('a') +export const MyLiterals: D.Decoder = D.literal('a', 'b') ``` ## The `nullable` combinator @@ -97,7 +97,7 @@ export const MyLiterals: D.Decoder<'a' | 'b'> = D.literal('a', 'b') The `nullable` combinator describes a nullable value ```ts -export const NullableString: D.Decoder = D.nullable(D.string) +export const NullableString: D.Decoder = D.nullable(D.string) ``` ## The `type` combinator @@ -147,7 +147,7 @@ console.log(Person.decode({ name: 'name', rememberMe: true })) The `record` combinator describes a `Record` ```ts -export const MyRecord: D.Decoder> = D.record(D.number) +export const MyRecord: D.Decoder> = D.record(D.number) console.log(isRight(MyRecord.decode({ a: 1, b: 2 }))) // => true ``` @@ -157,7 +157,7 @@ console.log(isRight(MyRecord.decode({ a: 1, b: 2 }))) // => true The `array` combinator describes an array `Array` ```ts -export const MyArray: D.Decoder> = D.array(D.number) +export const MyArray: D.Decoder> = D.array(D.number) console.log(isRight(MyArray.decode([1, 2, 3]))) // => true ``` @@ -167,7 +167,7 @@ console.log(isRight(MyArray.decode([1, 2, 3]))) // => true The `tuple` combinator describes a `n`-tuple ```ts -export const MyTuple: D.Decoder<[string, number]> = D.tuple(D.string, D.number) +export const MyTuple: D.Decoder = D.tuple(D.string, D.number) console.log(isRight(MyTuple.decode(['a', 1]))) // => true ``` @@ -204,6 +204,7 @@ The `sum` combinator describes tagged unions (aka sum types) ```ts export const MySum: D.Decoder< + unknown, | { type: 'A' a: string @@ -247,7 +248,7 @@ interface Category { subcategory: null | Category } -const Category: D.Decoder = D.lazy('Category', () => +const Category: D.Decoder = D.lazy('Category', () => D.type({ title: D.string, subcategory: D.nullable(Category) @@ -268,14 +269,14 @@ interface Bar { foo: null | Foo } -const Foo: D.Decoder = D.lazy('Foo', () => +const Foo: D.Decoder = D.lazy('Foo', () => D.type({ foo: D.string, bar: D.nullable(Bar) }) ) -const Bar: D.Decoder = D.lazy('Bar', () => +const Bar: D.Decoder = D.lazy('Bar', () => D.type({ bar: D.number, foo: D.nullable(Foo) @@ -288,13 +289,15 @@ const Bar: D.Decoder = D.lazy('Bar', () => The `refine` combinator allows to define refinements, for example a branded type ```ts +import { pipe } from 'fp-ts/lib/function' + export interface PositiveBrand { readonly Positive: unique symbol } export type Positive = number & PositiveBrand -export const Positive: D.Decoder = pipe( +export const Positive: D.Decoder = pipe( D.number, D.refine((n): n is Positive => n > 0, 'Positive') ) @@ -308,7 +311,10 @@ console.log(isRight(Positive.decode(-1))) // => false The `parse` combinator is more powerful than `refine` in that you can change the output type ```ts -export const NumberFromString: D.Decoder = pipe( +import { pipe } from 'fp-ts/lib/function' +import { isRight } from 'fp-ts/lib/Either' + +export const NumberFromString: D.Decoder = pipe( D.string, D.parse((s) => { const n = parseFloat(s) From 6d1dcac4faf10a00d1393f901ae7d6f01c831ed9 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 7 Aug 2020 09:50:49 +0200 Subject: [PATCH 139/222] update Codec.md --- Codec.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Codec.md b/Codec.md index 9efabb53e..9788eed56 100644 --- a/Codec.md +++ b/Codec.md @@ -8,7 +8,7 @@ # Codec interface ```ts -export interface Codec extends Decoder, Encoder {} +export interface Codec extends D.Decoder, E.Encoder {} ``` A codec is just a decoder and an encoder packed together. @@ -26,16 +26,21 @@ You can build a new codec using the `make` helper import * as C from 'io-ts/lib/Codec' import * as D from 'io-ts/lib/Decoder' import * as E from 'io-ts/lib/Encoder' -import { left, right } from 'fp-ts/lib/Either' - -const decoder: D.Decoder = D.parse(D.string, (s) => { - const n = parseFloat(s) - return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be parsable into a number`) : right(n) -}) +import { pipe } from 'fp-ts/lib/function' + +const decoder: D.Decoder = pipe( + D.string, + D.parse((s) => { + const n = parseFloat(s) + return isNaN(n) + ? D.failure(s, `cannot decode ${JSON.stringify(s)}, should be parsable into a number`) + : D.success(n) + }) +) const encoder: E.Encoder = { encode: String } -export const NumberFromString: C.Codec = C.make(decoder, encoder) +export const NumberFromString: C.Codec = C.make(decoder, encoder) ``` From 004dfcde3ce94340cf229ddd4ebaba125c6a7831 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:46:47 +0900 Subject: [PATCH 140/222] tsconfig setup matching that of fp-ts --- tsconfig.build-es6.json | 7 +++++++ tsconfig.es6.json => tsconfig.build.json | 6 +++--- tsconfig.json | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 tsconfig.build-es6.json rename tsconfig.es6.json => tsconfig.build.json (55%) diff --git a/tsconfig.build-es6.json b/tsconfig.build-es6.json new file mode 100644 index 000000000..6b5e341f1 --- /dev/null +++ b/tsconfig.build-es6.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "./dist/es6", + "module": "es6" + } +} diff --git a/tsconfig.es6.json b/tsconfig.build.json similarity index 55% rename from tsconfig.es6.json rename to tsconfig.build.json index fa53d00ed..9d833c294 100644 --- a/tsconfig.es6.json +++ b/tsconfig.build.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "./es6", - "module": "es6" - } + "noEmit": false + }, + "include": ["./src"] } diff --git a/tsconfig.json b/tsconfig.json index 692989298..082d65dec 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,14 @@ { "compilerOptions": { - "outDir": "./lib", + "outDir": "./dist/lib", + "noEmit": true, "declaration": true, + "esModuleInterop": true, "module": "commonjs", "noImplicitReturns": false, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, - "noEmitOnError": false, "strict": true, "target": "es5", "moduleResolution": "node", From 4659fb0531d7b000021b675711b38003fe338597 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:47:04 +0900 Subject: [PATCH 141/222] copy over fp-ts build scripts --- scripts/FileSystem.ts | 29 ++++++++++++++ scripts/build.ts | 88 ++++++++++++++++++++++++++++++++++++++++++ scripts/pre-publish.ts | 7 ++++ scripts/run.ts | 21 ++++++++++ 4 files changed, 145 insertions(+) create mode 100644 scripts/FileSystem.ts create mode 100644 scripts/build.ts create mode 100644 scripts/pre-publish.ts create mode 100644 scripts/run.ts diff --git a/scripts/FileSystem.ts b/scripts/FileSystem.ts new file mode 100644 index 000000000..9e2c2c468 --- /dev/null +++ b/scripts/FileSystem.ts @@ -0,0 +1,29 @@ +import * as TE from 'fp-ts/TaskEither' +import { flow } from 'fp-ts/function' +import * as fs from 'fs' +import G from 'glob' + +export interface FileSystem { + readonly readFile: (path: string) => TE.TaskEither + readonly writeFile: (path: string, content: string) => TE.TaskEither + readonly copyFile: (from: string, to: string) => TE.TaskEither + readonly glob: (pattern: string) => TE.TaskEither> + readonly mkdir: (path: string) => TE.TaskEither +} + +const readFile = TE.taskify(fs.readFile) +const writeFile = TE.taskify(fs.writeFile) +const copyFile = TE.taskify(fs.copyFile) +const glob = TE.taskify>(G) +const mkdirTE = TE.taskify(fs.mkdir) + +export const fileSystem: FileSystem = { + readFile: (path) => readFile(path, 'utf8'), + writeFile, + copyFile, + glob, + mkdir: flow( + mkdirTE, + TE.map(() => undefined) + ) +} diff --git a/scripts/build.ts b/scripts/build.ts new file mode 100644 index 000000000..ba6ec6f59 --- /dev/null +++ b/scripts/build.ts @@ -0,0 +1,88 @@ +import * as path from 'path' +import * as E from 'fp-ts/Either' +import { pipe } from 'fp-ts/function' +import * as RTE from 'fp-ts/ReaderTaskEither' +import * as A from 'fp-ts/ReadonlyArray' +import * as TE from 'fp-ts/TaskEither' +import { FileSystem, fileSystem } from './FileSystem' +import { run } from './run' + +interface Build extends RTE.ReaderTaskEither {} + +const OUTPUT_FOLDER = 'dist' +const PKG = 'package.json' + +export const copyPackageJson: Build = (C) => + pipe( + C.readFile(PKG), + TE.chain((s) => TE.fromEither(E.parseJSON(s, E.toError))), + TE.map((v) => { + const clone = Object.assign({}, v as any) + + delete clone.scripts + delete clone.files + delete clone.devDependencies + + return clone + }), + TE.chain((json) => C.writeFile(path.join(OUTPUT_FOLDER, PKG), JSON.stringify(json, null, 2))) + ) + +export const FILES: ReadonlyArray = ['CHANGELOG.md', 'LICENSE', 'README.md'] + +export const copyFiles: Build> = (C) => + pipe( + FILES, + A.traverse(TE.taskEither)((from) => C.copyFile(from, path.resolve(OUTPUT_FOLDER, from))) + ) + +const traverse = A.traverse(TE.taskEither) + +export const makeModules: Build = (C) => + pipe( + C.glob(`${OUTPUT_FOLDER}/lib/*.js`), + TE.map(getModules), + TE.chain(traverse(makeSingleModule(C))), + TE.map(() => undefined) + ) + +function getModules(paths: ReadonlyArray): ReadonlyArray { + return paths.map((filePath) => path.basename(filePath, '.js')).filter((x) => x !== 'index') +} + +function makeSingleModule(C: FileSystem): (module: string) => TE.TaskEither { + return (m) => + pipe( + C.mkdir(path.join(OUTPUT_FOLDER, m)), + TE.chain(() => makePkgJson(m)), + TE.chain((data) => C.writeFile(path.join(OUTPUT_FOLDER, m, 'package.json'), data)) + ) +} + +function makePkgJson(module: string): TE.TaskEither { + return pipe( + JSON.stringify( + { + main: `../lib/${module}.js`, + module: `../es6/${module}.js`, + typings: `../lib/${module}.d.ts`, + sideEffects: false + }, + null, + 2 + ), + TE.right + ) +} + +const main: Build = pipe( + copyPackageJson, + RTE.chain(() => copyFiles), + RTE.chain(() => makeModules) +) + +run( + main({ + ...fileSystem + }) +) diff --git a/scripts/pre-publish.ts b/scripts/pre-publish.ts new file mode 100644 index 000000000..0dc641bb5 --- /dev/null +++ b/scripts/pre-publish.ts @@ -0,0 +1,7 @@ +import { left } from '../src/TaskEither' +import { run } from './run' + +const main = left(new Error('"npm publish" can not be run from root, run "npm run release" instead')) + +run(main) + diff --git a/scripts/run.ts b/scripts/run.ts new file mode 100644 index 000000000..7629fe11d --- /dev/null +++ b/scripts/run.ts @@ -0,0 +1,21 @@ +import { fold } from 'fp-ts/Either' +import { TaskEither } from 'fp-ts/TaskEither' + +export function run(eff: TaskEither): void { + eff() + .then( + fold( + (e) => { + throw e + }, + (_) => { + process.exitCode = 0 + } + ) + ) + .catch((e) => { + console.error(e) // tslint:disable-line no-console + + process.exitCode = 1 + }) +} From fba482866ed05a36b424db53934697040b60d270 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:47:24 +0900 Subject: [PATCH 142/222] update all fp-ts usages in src --- src/Codec.ts | 8 ++++---- src/DecodeError.ts | 2 +- src/Decoder.ts | 18 +++++++++--------- src/Encoder.ts | 8 ++++---- src/Eq.ts | 6 +++--- src/FreeSemigroup.ts | 2 +- src/Guard.ts | 4 ++-- src/Kleisli.ts | 20 ++++++++++---------- src/PathReporter.ts | 2 +- src/Schema.ts | 2 +- src/Schemable.ts | 2 +- src/TaskDecoder.ts | 22 +++++++++++----------- src/ThrowReporter.ts | 2 +- src/Type.ts | 6 +++--- src/index.ts | 4 ++-- 15 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/Codec.ts b/src/Codec.ts index abbfbf323..2042f4bbf 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -8,9 +8,9 @@ * * @since 2.2.3 */ -import { identity } from 'fp-ts/lib/function' -import { Invariant3 } from 'fp-ts/lib/Invariant' -import { pipe } from 'fp-ts/lib/pipeable' +import { identity } from 'fp-ts/function' +import { Invariant3 } from 'fp-ts/Invariant' +import { pipe } from 'fp-ts/pipeable' import * as D from './Decoder' import * as E from './Encoder' import { Literal } from './Schemable' @@ -328,7 +328,7 @@ export const URI = 'io-ts/Codec' */ export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { +declare module 'fp-ts/HKT' { interface URItoKind3 { readonly [URI]: Codec } diff --git a/src/DecodeError.ts b/src/DecodeError.ts index dac974485..274761d07 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -8,7 +8,7 @@ * * @since 2.2.7 */ -import { Semigroup } from 'fp-ts/lib/Semigroup' +import { Semigroup } from 'fp-ts/Semigroup' import * as FS from './FreeSemigroup' /** diff --git a/src/Decoder.ts b/src/Decoder.ts index 51d97db39..a6d3ff721 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -8,14 +8,14 @@ * * @since 2.2.7 */ -import { Alt2, Alt2C } from 'fp-ts/lib/Alt' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import { Category2 } from 'fp-ts/lib/Category' -import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' -import { Functor2 } from 'fp-ts/lib/Functor' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import { pipe } from 'fp-ts/lib/pipeable' +import { Alt2, Alt2C } from 'fp-ts/Alt' +import { Bifunctor2 } from 'fp-ts/Bifunctor' +import { Category2 } from 'fp-ts/Category' +import * as E from 'fp-ts/Either' +import { Refinement } from 'fp-ts/function' +import { Functor2 } from 'fp-ts/Functor' +import { MonadThrow2C } from 'fp-ts/MonadThrow' +import { pipe } from 'fp-ts/pipeable' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' import * as G from './Guard' @@ -418,7 +418,7 @@ export const URI = 'io-ts/Decoder' */ export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { +declare module 'fp-ts/HKT' { interface URItoKind2 { readonly [URI]: Decoder } diff --git a/src/Encoder.ts b/src/Encoder.ts index f06ad8832..9c4a0e448 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -8,10 +8,10 @@ * * @since 2.2.3 */ -import { Contravariant2 } from 'fp-ts/lib/Contravariant' -import { Category2 } from 'fp-ts/lib/Category' +import { Contravariant2 } from 'fp-ts/Contravariant' +import { Category2 } from 'fp-ts/Category' import { memoize, intersect_ } from './Schemable' -import { identity } from 'fp-ts/lib/function' +import { identity } from 'fp-ts/function' // ------------------------------------------------------------------------------------- // model @@ -207,7 +207,7 @@ export const URI = 'io-ts/Encoder' */ export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { +declare module 'fp-ts/HKT' { interface URItoKind2 { readonly [URI]: Encoder } diff --git a/src/Eq.ts b/src/Eq.ts index 394a517fd..955084cba 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -8,9 +8,9 @@ * * @since 2.2.2 */ -import * as A from 'fp-ts/lib/Array' -import * as E from 'fp-ts/lib/Eq' -import * as R from 'fp-ts/lib/Record' +import * as A from 'fp-ts/Array' +import * as E from 'fp-ts/Eq' +import * as R from 'fp-ts/Record' import { memoize, Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' import Eq = E.Eq diff --git a/src/FreeSemigroup.ts b/src/FreeSemigroup.ts index f1a764e70..815365574 100644 --- a/src/FreeSemigroup.ts +++ b/src/FreeSemigroup.ts @@ -8,7 +8,7 @@ * * @since 2.2.7 */ -import { Semigroup } from 'fp-ts/lib/Semigroup' +import { Semigroup } from 'fp-ts/Semigroup' /** * @category model diff --git a/src/Guard.ts b/src/Guard.ts index 2d8c7792f..1de88a422 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { pipe } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/pipeable' import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -290,7 +290,7 @@ export const URI = 'io-ts/Guard' */ export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { +declare module 'fp-ts/HKT' { interface URItoKind { readonly [URI]: Guard } diff --git a/src/Kleisli.ts b/src/Kleisli.ts index b9ad74841..24dadce2c 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -8,18 +8,18 @@ * * @since 2.2.7 */ -import { Alt2C } from 'fp-ts/lib/Alt' -import { Applicative2C } from 'fp-ts/lib/Applicative' -import { Apply2C } from 'fp-ts/lib/Apply' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import * as E from 'fp-ts/lib/Either' -import { Functor2C } from 'fp-ts/lib/Functor' -import { Kind2, URIS2 } from 'fp-ts/lib/HKT' -import { Monad2C } from 'fp-ts/lib/Monad' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import { Alt2C } from 'fp-ts/Alt' +import { Applicative2C } from 'fp-ts/Applicative' +import { Apply2C } from 'fp-ts/Apply' +import { Bifunctor2 } from 'fp-ts/Bifunctor' +import * as E from 'fp-ts/Either' +import { Functor2C } from 'fp-ts/Functor' +import { Kind2, URIS2 } from 'fp-ts/HKT' +import { Monad2C } from 'fp-ts/Monad' +import { MonadThrow2C } from 'fp-ts/MonadThrow' import * as G from './Guard' import { intersect_, Literal, memoize } from './Schemable' -import { Lazy, Refinement } from 'fp-ts/lib/function' +import { Lazy, Refinement } from 'fp-ts/function' // ------------------------------------------------------------------------------------- // model diff --git a/src/PathReporter.ts b/src/PathReporter.ts index 66b953e98..a9559b47e 100644 --- a/src/PathReporter.ts +++ b/src/PathReporter.ts @@ -3,7 +3,7 @@ */ import { Reporter } from './Reporter' import { Context, getFunctionName, ValidationError } from '.' -import { fold } from 'fp-ts/lib/Either' +import { fold } from 'fp-ts/Either' function stringify(v: any): string { if (typeof v === 'function') { diff --git a/src/Schema.ts b/src/Schema.ts index 2a7e20652..c5ab7394a 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/HKT' import { memoize, Schemable, Schemable1, Schemable2C } from './Schemable' // ------------------------------------------------------------------------------------- diff --git a/src/Schemable.ts b/src/Schemable.ts index f5fc3929f..d64ae126d 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/HKT' /** * @since 2.2.0 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index d8ef66dcd..d0619fdbf 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -8,16 +8,16 @@ * * @since 2.2.7 */ -import { Alt2, Alt2C } from 'fp-ts/lib/Alt' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import { Category2 } from 'fp-ts/lib/Category' -import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' -import { Functor2 } from 'fp-ts/lib/Functor' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import { pipe } from 'fp-ts/lib/pipeable' -import * as T from 'fp-ts/lib/Task' -import * as TE from 'fp-ts/lib/TaskEither' +import { Alt2, Alt2C } from 'fp-ts/Alt' +import { Bifunctor2 } from 'fp-ts/Bifunctor' +import { Category2 } from 'fp-ts/Category' +import * as E from 'fp-ts/Either' +import { Refinement } from 'fp-ts/function' +import { Functor2 } from 'fp-ts/Functor' +import { MonadThrow2C } from 'fp-ts/MonadThrow' +import { pipe } from 'fp-ts/pipeable' +import * as T from 'fp-ts/Task' +import * as TE from 'fp-ts/TaskEither' import * as DE from './DecodeError' import * as D from './Decoder' import * as FS from './FreeSemigroup' @@ -424,7 +424,7 @@ export const URI = 'io-ts/TaskDecoder' */ export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { +declare module 'fp-ts/HKT' { interface URItoKind2 { readonly [URI]: TaskDecoder } diff --git a/src/ThrowReporter.ts b/src/ThrowReporter.ts index 8d991a992..667bfa2e3 100644 --- a/src/ThrowReporter.ts +++ b/src/ThrowReporter.ts @@ -4,7 +4,7 @@ */ import { Reporter } from './Reporter' import { PathReporter } from './PathReporter' -import { isLeft } from 'fp-ts/lib/Either' +import { isLeft } from 'fp-ts/Either' /** * @category deprecated diff --git a/src/Type.ts b/src/Type.ts index ace0caafe..ee845d68a 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -10,8 +10,8 @@ */ import * as t from './index' import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' +import * as E from 'fp-ts/Either' +import { pipe } from 'fp-ts/pipeable' // ------------------------------------------------------------------------------------- // model @@ -171,7 +171,7 @@ export const URI = 'io-ts/Type' */ export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { +declare module 'fp-ts/HKT' { interface URItoKind { readonly [URI]: Type } diff --git a/src/index.ts b/src/index.ts index 10903a67e..8d5e967b6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ /** * @since 1.0.0 */ -import { Either, isLeft, left, right } from 'fp-ts/lib/Either' -import { Predicate, Refinement } from 'fp-ts/lib/function' +import { Either, isLeft, left, right } from 'fp-ts/Either' +import { Predicate, Refinement } from 'fp-ts/function' // ------------------------------------------------------------------------------------- // model From f5e1637e9e53a5934bbd3ad181795e763ce0bc10 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:47:50 +0900 Subject: [PATCH 143/222] update all fp-ts usages in test (dont use lib) --- test/2.1.x/TypeClass.ts | 4 ++-- test/2.1.x/helpers.ts | 4 ++-- test/2.1.x/type.ts | 4 ++-- test/2.1.x/union.ts | 2 +- test/Arbitrary.ts | 2 +- test/Codec.ts | 4 ++-- test/Decoder.ts | 4 ++-- test/Encoder.ts | 2 +- test/Eq.ts | 4 ++-- test/Guard.ts | 2 +- test/Schema.ts | 4 ++-- test/TaskDecoder.ts | 6 +++--- test/Type.ts | 6 +++--- test/helpers.ts | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/test/2.1.x/TypeClass.ts b/test/2.1.x/TypeClass.ts index c179b3e07..bc6f067f1 100644 --- a/test/2.1.x/TypeClass.ts +++ b/test/2.1.x/TypeClass.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import { Either, fold, right } from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' +import { Either, fold, right } from 'fp-ts/Either' +import { pipe } from 'fp-ts/pipeable' import * as t from '../../src/index' import { assertFailure, assertSuccess } from './helpers' diff --git a/test/2.1.x/helpers.ts b/test/2.1.x/helpers.ts index de7733520..9c1de5996 100644 --- a/test/2.1.x/helpers.ts +++ b/test/2.1.x/helpers.ts @@ -1,8 +1,8 @@ import * as assert from 'assert' -import { right, either, fold } from 'fp-ts/lib/Either' +import { right, either, fold } from 'fp-ts/Either' import * as t from '../../src/index' import { PathReporter } from '../../src/PathReporter' -import { pipe } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/pipeable' export function assertStrictEqual(result: t.Validation, expected: any): void { pipe( diff --git a/test/2.1.x/type.ts b/test/2.1.x/type.ts index 66be70f60..b39c4bba1 100644 --- a/test/2.1.x/type.ts +++ b/test/2.1.x/type.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import { fold } from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/Either' +import { pipe } from 'fp-ts/pipeable' import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' diff --git a/test/2.1.x/union.ts b/test/2.1.x/union.ts index d340cba05..385e9e747 100644 --- a/test/2.1.x/union.ts +++ b/test/2.1.x/union.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' -import { either } from 'fp-ts/lib/Either' +import { either } from 'fp-ts/Either' describe('union', () => { describe('name', () => { diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 1126e1acf..995e4b63d 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -107,7 +107,7 @@ export const URI = 'Arbitrary' export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { +declare module 'fp-ts/HKT' { interface URItoKind { readonly Arbitrary: Arbitrary } diff --git a/test/Codec.ts b/test/Codec.ts index 45ae60c7a..77b53b40a 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -1,10 +1,10 @@ import * as assert from 'assert' import * as _ from '../src/Codec' import * as D from '../src/Decoder' -import { pipe } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/pipeable' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' -import * as E from 'fp-ts/lib/Either' +import * as E from 'fp-ts/Either' import * as H from './helpers' const codecNumberFromString: _.Codec = _.make( diff --git a/test/Decoder.ts b/test/Decoder.ts index 0be76e0ac..59a0bf999 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' +import * as E from 'fp-ts/Either' +import { pipe } from 'fp-ts/pipeable' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' import * as _ from '../src/Decoder' diff --git a/test/Encoder.ts b/test/Encoder.ts index 4bedd9563..0eac4f1c0 100644 --- a/test/Encoder.ts +++ b/test/Encoder.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as E from '../src/Encoder' -import { pipe } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/pipeable' import * as H from './helpers' describe('Encoder', () => { diff --git a/test/Eq.ts b/test/Eq.ts index 6e74bfc71..6b89bc4a6 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import * as E from '../src/Eq' -import { Eq } from 'fp-ts/lib/Eq' -import { pipe } from 'fp-ts/lib/pipeable' +import { Eq } from 'fp-ts/Eq' +import { pipe } from 'fp-ts/pipeable' describe('Eq', () => { it('literal', () => { diff --git a/test/Guard.ts b/test/Guard.ts index 5034563be..e0de97614 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as G from '../src/Guard' -import { pipe } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/pipeable' interface NonEmptyStringBrand { readonly NonEmptyString: unique symbol diff --git a/test/Schema.ts b/test/Schema.ts index e2ec4ffbe..e86fae9ee 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,6 +1,6 @@ import * as fc from 'fast-check' -import { isRight } from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' +import { isRight } from 'fp-ts/Either' +import { pipe } from 'fp-ts/pipeable' import * as D from '../src/Decoder' import * as Eq from '../src/Eq' import * as G from '../src/Guard' diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index aaafd270e..eb53fcbd9 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' -import * as E from 'fp-ts/lib/Either' -import { pipe } from 'fp-ts/lib/pipeable' -import * as TE from 'fp-ts/lib/TaskEither' +import * as E from 'fp-ts/Either' +import { pipe } from 'fp-ts/pipeable' +import * as TE from 'fp-ts/TaskEither' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' diff --git a/test/Type.ts b/test/Type.ts index 2c20a1562..70ed65281 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import * as fc from 'fast-check' -import { isRight, isLeft } from 'fp-ts/lib/Either' -import { Kind, URIS, HKT, URIS2, Kind2 } from 'fp-ts/lib/HKT' +import { isRight, isLeft } from 'fp-ts/Either' +import { Kind, URIS, HKT, URIS2, Kind2 } from 'fp-ts/HKT' import * as t from '../src' import * as D from '../src/Decoder' import * as G from '../src/Guard' @@ -19,7 +19,7 @@ import { } from '../src/Schemable' import * as _ from '../src/Type' import * as A from './Arbitrary' -import { pipe } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/pipeable' interface Schema { (S: Schemable & WithUnknownContainers & WithUnion): HKT diff --git a/test/helpers.ts b/test/helpers.ts index 333b363bc..3a1395cf3 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -1,7 +1,7 @@ import * as G from '../src/Guard' import * as D from '../src/Decoder' import * as E from '../src/Encoder' -import { pipe } from 'fp-ts/lib/pipeable' +import { pipe } from 'fp-ts/pipeable' // ------------------------------------------------------------------------------------- // guards From 61f6f9c0a02a5d4543a09ac5b1b0b9e5706e7341 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:48:29 +0900 Subject: [PATCH 144/222] update all docs fp-ts imports --- Codec.md | 2 +- Decoder.md | 14 +++++++------- Eq.md | 2 +- Schema.md | 2 +- index.md | 14 +++++++------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Codec.md b/Codec.md index 9788eed56..117854a29 100644 --- a/Codec.md +++ b/Codec.md @@ -26,7 +26,7 @@ You can build a new codec using the `make` helper import * as C from 'io-ts/lib/Codec' import * as D from 'io-ts/lib/Decoder' import * as E from 'io-ts/lib/Encoder' -import { pipe } from 'fp-ts/lib/function' +import { pipe } from 'fp-ts/function' const decoder: D.Decoder = pipe( D.string, diff --git a/Decoder.md b/Decoder.md index 98cbadb72..30ecc265c 100644 --- a/Decoder.md +++ b/Decoder.md @@ -45,7 +45,7 @@ export const string: D.Decoder = { and we can use it as follows: ```ts -import { isRight } from 'fp-ts/lib/Either' +import { isRight } from 'fp-ts/Either' console.log(isRight(string.decode('a'))) // => true console.log(isRight(string.decode(null))) // => false @@ -54,8 +54,8 @@ console.log(isRight(string.decode(null))) // => false More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold) along with `pipe` (which is similar to the pipeline operator) ```ts -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/Either' console.log( pipe( @@ -289,7 +289,7 @@ const Bar: D.Decoder = D.lazy('Bar', () => The `refine` combinator allows to define refinements, for example a branded type ```ts -import { pipe } from 'fp-ts/lib/function' +import { pipe } from 'fp-ts/function' export interface PositiveBrand { readonly Positive: unique symbol @@ -311,8 +311,8 @@ console.log(isRight(Positive.decode(-1))) // => false The `parse` combinator is more powerful than `refine` in that you can change the output type ```ts -import { pipe } from 'fp-ts/lib/function' -import { isRight } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/function' +import { isRight } from 'fp-ts/Either' export const NumberFromString: D.Decoder = pipe( D.string, @@ -354,7 +354,7 @@ export interface Person extends D.TypeOf {} # Built-in error reporter ```ts -import { isLeft } from 'fp-ts/lib/Either' +import { isLeft } from 'fp-ts/Either' export const Person = D.type({ name: D.string, diff --git a/Eq.md b/Eq.md index 0a3828586..9ce49b262 100644 --- a/Eq.md +++ b/Eq.md @@ -26,7 +26,7 @@ Instances must satisfy the following laws: **Example** ```ts -import { Eq } from 'fp-ts/lib/Eq' +import { Eq } from 'fp-ts/Eq' export const string: Eq = { equals: (x, y) => x === y diff --git a/Schema.md b/Schema.md index 3275a703a..95189845c 100644 --- a/Schema.md +++ b/Schema.md @@ -55,7 +55,7 @@ export type Int = number & IntBrand Now we must define a custom `MySchemable` type class containing a new member `Int`... ```ts -import { Kind2, URIS2, HKT } from 'fp-ts/lib/HKT' +import { Kind2, URIS2, HKT } from 'fp-ts/HKT' import * as S from 'io-ts/lib/Schemable' export interface MySchemable extends S.Schemable { diff --git a/index.md b/index.md index 4296fded5..b315f6df9 100644 --- a/index.md +++ b/index.md @@ -90,7 +90,7 @@ const string = new t.Type( and we can use it as follows: ```ts -import { isRight } from 'fp-ts/lib/Either' +import { isRight } from 'fp-ts/Either' isRight(string.decode('a string')) // true isRight(string.decode(null)) // false @@ -100,8 +100,8 @@ More generally the result of calling `decode` can be handled using [`fold`](http ```ts import * as t from 'io-ts' -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/Either' // failure handler const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` @@ -224,8 +224,8 @@ interface Errors extends Array {} Example ```ts -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/Either' const getPaths = (v: t.Validation): Array => { return pipe( @@ -247,7 +247,7 @@ You can set your own error message by providing a `message` argument to `failure Example ```ts -import { either } from 'fp-ts/lib/Either' +import { either } from 'fp-ts/Either' const NumberFromString = new t.Type( 'NumberFromString', @@ -434,7 +434,7 @@ type PartialUser = { You can define your own types. Let's see an example ```ts -import { either } from 'fp-ts/lib/Either' +import { either } from 'fp-ts/Either' // represents a Date from an ISO string const DateFromString = new t.Type( From 33b162d4e16e9f34bb4bf53b60625a572f067053 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:49:18 +0900 Subject: [PATCH 145/222] remove import path rewrite, bump fp-ts peer dep --- package-lock.json | 75 ----------------------------------------------- package.json | 3 +- 2 files changed, 1 insertion(+), 77 deletions(-) diff --git a/package-lock.json b/package-lock.json index 382293c05..6046af13e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2941,81 +2941,6 @@ "resolve-cwd": "^3.0.0" } }, - "import-path-rewrite": { - "version": "github:gcanti/import-path-rewrite#0086599732ccc761a33255a702a07266895d0572", - "from": "github:gcanti/import-path-rewrite", - "dev": true, - "requires": { - "chalk": "^3.0.0", - "glob": "^7.1.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.0.tgz", - "integrity": "sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", diff --git a/package.json b/package.json index 9b7511ce2..4d6063a99 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "homepage": "https://github.com/gcanti/io-ts", "dependencies": {}, "peerDependencies": { - "fp-ts": "^2.0.0" + "fp-ts": "^2.8.0" }, "devDependencies": { "@types/benchmark": "1.0.31", @@ -50,7 +50,6 @@ "dtslint": "github:gcanti/dtslint", "fast-check": "^1.24.2", "fp-ts": "^2.8.1", - "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", "prettier": "2.0.2", From 80ddfae9ab0e3f6a5ebb15e67927fdc8d8e6076b Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:49:34 +0900 Subject: [PATCH 146/222] new build scripts --- package.json | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 4d6063a99..3080cba7b 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,6 @@ "name": "io-ts", "version": "2.2.9", "description": "TypeScript runtime type system for IO decoding/encoding", - "files": [ - "lib", - "es6" - ], "main": "lib/index.js", "module": "es6/index.js", "typings": "lib/index.d.ts", @@ -16,15 +12,16 @@ "prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"", "fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples,exercises}/**/*.ts\"", "test": "npm run prettier && npm run lint && npm run dtslint && npm run jest && npm run docs", - "clean": "rimraf lib/* es6/*", - "build": "npm run clean && tsc && tsc -p tsconfig.es6.json && npm run import-path-rewrite", - "prepublish": "npm run build", + "clean": "rm -rf ./dist", + "prebuild": "npm run clean", + "build": "tsc -p ./tsconfig.build.json && tsc -p ./tsconfig.build-es6.json && ts-node scripts/build", + "postbuild": "prettier --loglevel=silent --write \"./dist/**/*.ts\"", + "prepublishOnly": "ts-node scripts/pre-publish", "perf": "ts-node perf/index", "dtslint": "dtslint dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", "doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", - "docs": "docs-ts", - "import-path-rewrite": "import-path-rewrite" + "docs": "docs-ts" }, "repository": { "type": "git", From 1190af00088d5187ef77d26cf797606513213e1d Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:49:42 +0900 Subject: [PATCH 147/222] gitignore /dist --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1d675a13a..75c9cc260 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ *.log node_modules -lib -es6 +/dist dev coverage declaration/out/src From f5ebc00715eb222ac477da19d99a9407d135a3fa Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 14:50:02 +0900 Subject: [PATCH 148/222] docs imports --- docs/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.md b/docs/index.md index 1075b9970..e9376c3e2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -73,7 +73,7 @@ const string = new t.Type( and we can use it as follows: ```ts -import { isRight } from 'fp-ts/lib/Either' +import { isRight } from 'fp-ts/Either' isRight(string.decode('a string')) // true isRight(string.decode(null)) // false @@ -83,8 +83,8 @@ More generally the result of calling `decode` can be handled using [`fold`](http ```ts import * as t from 'io-ts' -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/Either' // failure handler const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` From a91714a0763f3b2d4ccddcc806903756276c8df5 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 15:01:28 +0900 Subject: [PATCH 149/222] fp-ts import --- scripts/pre-publish.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pre-publish.ts b/scripts/pre-publish.ts index 0dc641bb5..c326efd04 100644 --- a/scripts/pre-publish.ts +++ b/scripts/pre-publish.ts @@ -1,4 +1,4 @@ -import { left } from '../src/TaskEither' +import { left } from 'fp-ts/TaskEither' import { run } from './run' const main = left(new Error('"npm publish" can not be run from root, run "npm run release" instead')) From ceeb325818ca8e043ee15e6a2fd6325316df051e Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 15:04:16 +0900 Subject: [PATCH 150/222] Release scripts --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3080cba7b..d73b1efc2 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,9 @@ "dtslint": "dtslint dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", "doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", - "docs": "docs-ts" + "docs": "docs-ts", + "prerelease": "npm run build", + "release": "ts-node scripts/release" }, "repository": { "type": "git", From 05c28d4948b7d32e04f79f8ebe411e495d3a933a Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Sat, 8 Aug 2020 15:06:50 +0900 Subject: [PATCH 151/222] release script source --- scripts/release.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/release.ts diff --git a/scripts/release.ts b/scripts/release.ts new file mode 100644 index 000000000..750f3eddd --- /dev/null +++ b/scripts/release.ts @@ -0,0 +1,23 @@ +import { run } from './run' +import * as child_process from 'child_process' +import { left, right } from 'fp-ts/Either' +import * as TE from 'fp-ts/TaskEither' + +const DIST = 'dist' + +const exec = (cmd: string, args?: child_process.ExecOptions): TE.TaskEither => () => + new Promise((resolve) => { + child_process.exec(cmd, args, (err) => { + if (err !== null) { + return resolve(left(err)) + } + + return resolve(right(undefined)) + }) + }) + +export const main = exec('npm publish', { + cwd: DIST +}) + +run(main) From 3da455a9d5ff81f2a83b17319e805cb06edf0102 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Mon, 10 Aug 2020 10:56:10 +0900 Subject: [PATCH 152/222] Revert "remove import path rewrite, bump fp-ts peer dep" This reverts commit d04d2910cf92b99cf3aa67d8908b57ef07e22895. --- package-lock.json | 75 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 6046af13e..382293c05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2941,6 +2941,81 @@ "resolve-cwd": "^3.0.0" } }, + "import-path-rewrite": { + "version": "github:gcanti/import-path-rewrite#0086599732ccc761a33255a702a07266895d0572", + "from": "github:gcanti/import-path-rewrite", + "dev": true, + "requires": { + "chalk": "^3.0.0", + "glob": "^7.1.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.0.tgz", + "integrity": "sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", diff --git a/package.json b/package.json index d73b1efc2..24af9c3b5 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "homepage": "https://github.com/gcanti/io-ts", "dependencies": {}, "peerDependencies": { - "fp-ts": "^2.8.0" + "fp-ts": "^2.0.0" }, "devDependencies": { "@types/benchmark": "1.0.31", @@ -49,6 +49,7 @@ "dtslint": "github:gcanti/dtslint", "fast-check": "^1.24.2", "fp-ts": "^2.8.1", + "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", "prettier": "2.0.2", From ef212f9468b977893399189dea502ef5a77bdfba Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Mon, 10 Aug 2020 10:58:49 +0900 Subject: [PATCH 153/222] Revert "update all fp-ts usages in src" This reverts commit 1102b3bf3d15c4eb55d8f6c540949798d8798871. --- src/Codec.ts | 8 ++++---- src/DecodeError.ts | 2 +- src/Decoder.ts | 18 +++++++++--------- src/Encoder.ts | 8 ++++---- src/Eq.ts | 6 +++--- src/FreeSemigroup.ts | 2 +- src/Guard.ts | 4 ++-- src/Kleisli.ts | 20 ++++++++++---------- src/PathReporter.ts | 2 +- src/Schema.ts | 2 +- src/Schemable.ts | 2 +- src/TaskDecoder.ts | 22 +++++++++++----------- src/ThrowReporter.ts | 2 +- src/Type.ts | 6 +++--- src/index.ts | 4 ++-- 15 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/Codec.ts b/src/Codec.ts index 2042f4bbf..abbfbf323 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -8,9 +8,9 @@ * * @since 2.2.3 */ -import { identity } from 'fp-ts/function' -import { Invariant3 } from 'fp-ts/Invariant' -import { pipe } from 'fp-ts/pipeable' +import { identity } from 'fp-ts/lib/function' +import { Invariant3 } from 'fp-ts/lib/Invariant' +import { pipe } from 'fp-ts/lib/pipeable' import * as D from './Decoder' import * as E from './Encoder' import { Literal } from './Schemable' @@ -328,7 +328,7 @@ export const URI = 'io-ts/Codec' */ export type URI = typeof URI -declare module 'fp-ts/HKT' { +declare module 'fp-ts/lib/HKT' { interface URItoKind3 { readonly [URI]: Codec } diff --git a/src/DecodeError.ts b/src/DecodeError.ts index 274761d07..dac974485 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -8,7 +8,7 @@ * * @since 2.2.7 */ -import { Semigroup } from 'fp-ts/Semigroup' +import { Semigroup } from 'fp-ts/lib/Semigroup' import * as FS from './FreeSemigroup' /** diff --git a/src/Decoder.ts b/src/Decoder.ts index a6d3ff721..51d97db39 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -8,14 +8,14 @@ * * @since 2.2.7 */ -import { Alt2, Alt2C } from 'fp-ts/Alt' -import { Bifunctor2 } from 'fp-ts/Bifunctor' -import { Category2 } from 'fp-ts/Category' -import * as E from 'fp-ts/Either' -import { Refinement } from 'fp-ts/function' -import { Functor2 } from 'fp-ts/Functor' -import { MonadThrow2C } from 'fp-ts/MonadThrow' -import { pipe } from 'fp-ts/pipeable' +import { Alt2, Alt2C } from 'fp-ts/lib/Alt' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import { Category2 } from 'fp-ts/lib/Category' +import * as E from 'fp-ts/lib/Either' +import { Refinement } from 'fp-ts/lib/function' +import { Functor2 } from 'fp-ts/lib/Functor' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import { pipe } from 'fp-ts/lib/pipeable' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' import * as G from './Guard' @@ -418,7 +418,7 @@ export const URI = 'io-ts/Decoder' */ export type URI = typeof URI -declare module 'fp-ts/HKT' { +declare module 'fp-ts/lib/HKT' { interface URItoKind2 { readonly [URI]: Decoder } diff --git a/src/Encoder.ts b/src/Encoder.ts index 9c4a0e448..f06ad8832 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -8,10 +8,10 @@ * * @since 2.2.3 */ -import { Contravariant2 } from 'fp-ts/Contravariant' -import { Category2 } from 'fp-ts/Category' +import { Contravariant2 } from 'fp-ts/lib/Contravariant' +import { Category2 } from 'fp-ts/lib/Category' import { memoize, intersect_ } from './Schemable' -import { identity } from 'fp-ts/function' +import { identity } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- // model @@ -207,7 +207,7 @@ export const URI = 'io-ts/Encoder' */ export type URI = typeof URI -declare module 'fp-ts/HKT' { +declare module 'fp-ts/lib/HKT' { interface URItoKind2 { readonly [URI]: Encoder } diff --git a/src/Eq.ts b/src/Eq.ts index 955084cba..394a517fd 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -8,9 +8,9 @@ * * @since 2.2.2 */ -import * as A from 'fp-ts/Array' -import * as E from 'fp-ts/Eq' -import * as R from 'fp-ts/Record' +import * as A from 'fp-ts/lib/Array' +import * as E from 'fp-ts/lib/Eq' +import * as R from 'fp-ts/lib/Record' import { memoize, Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' import Eq = E.Eq diff --git a/src/FreeSemigroup.ts b/src/FreeSemigroup.ts index 815365574..f1a764e70 100644 --- a/src/FreeSemigroup.ts +++ b/src/FreeSemigroup.ts @@ -8,7 +8,7 @@ * * @since 2.2.7 */ -import { Semigroup } from 'fp-ts/Semigroup' +import { Semigroup } from 'fp-ts/lib/Semigroup' /** * @category model diff --git a/src/Guard.ts b/src/Guard.ts index 1de88a422..2d8c7792f 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' // ------------------------------------------------------------------------------------- @@ -290,7 +290,7 @@ export const URI = 'io-ts/Guard' */ export type URI = typeof URI -declare module 'fp-ts/HKT' { +declare module 'fp-ts/lib/HKT' { interface URItoKind { readonly [URI]: Guard } diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 24dadce2c..b9ad74841 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -8,18 +8,18 @@ * * @since 2.2.7 */ -import { Alt2C } from 'fp-ts/Alt' -import { Applicative2C } from 'fp-ts/Applicative' -import { Apply2C } from 'fp-ts/Apply' -import { Bifunctor2 } from 'fp-ts/Bifunctor' -import * as E from 'fp-ts/Either' -import { Functor2C } from 'fp-ts/Functor' -import { Kind2, URIS2 } from 'fp-ts/HKT' -import { Monad2C } from 'fp-ts/Monad' -import { MonadThrow2C } from 'fp-ts/MonadThrow' +import { Alt2C } from 'fp-ts/lib/Alt' +import { Applicative2C } from 'fp-ts/lib/Applicative' +import { Apply2C } from 'fp-ts/lib/Apply' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import * as E from 'fp-ts/lib/Either' +import { Functor2C } from 'fp-ts/lib/Functor' +import { Kind2, URIS2 } from 'fp-ts/lib/HKT' +import { Monad2C } from 'fp-ts/lib/Monad' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' import { intersect_, Literal, memoize } from './Schemable' -import { Lazy, Refinement } from 'fp-ts/function' +import { Lazy, Refinement } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- // model diff --git a/src/PathReporter.ts b/src/PathReporter.ts index a9559b47e..66b953e98 100644 --- a/src/PathReporter.ts +++ b/src/PathReporter.ts @@ -3,7 +3,7 @@ */ import { Reporter } from './Reporter' import { Context, getFunctionName, ValidationError } from '.' -import { fold } from 'fp-ts/Either' +import { fold } from 'fp-ts/lib/Either' function stringify(v: any): string { if (typeof v === 'function') { diff --git a/src/Schema.ts b/src/Schema.ts index c5ab7394a..2a7e20652 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/HKT' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' import { memoize, Schemable, Schemable1, Schemable2C } from './Schemable' // ------------------------------------------------------------------------------------- diff --git a/src/Schemable.ts b/src/Schemable.ts index d64ae126d..f5fc3929f 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/HKT' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' /** * @since 2.2.0 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index d0619fdbf..d8ef66dcd 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -8,16 +8,16 @@ * * @since 2.2.7 */ -import { Alt2, Alt2C } from 'fp-ts/Alt' -import { Bifunctor2 } from 'fp-ts/Bifunctor' -import { Category2 } from 'fp-ts/Category' -import * as E from 'fp-ts/Either' -import { Refinement } from 'fp-ts/function' -import { Functor2 } from 'fp-ts/Functor' -import { MonadThrow2C } from 'fp-ts/MonadThrow' -import { pipe } from 'fp-ts/pipeable' -import * as T from 'fp-ts/Task' -import * as TE from 'fp-ts/TaskEither' +import { Alt2, Alt2C } from 'fp-ts/lib/Alt' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import { Category2 } from 'fp-ts/lib/Category' +import * as E from 'fp-ts/lib/Either' +import { Refinement } from 'fp-ts/lib/function' +import { Functor2 } from 'fp-ts/lib/Functor' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import { pipe } from 'fp-ts/lib/pipeable' +import * as T from 'fp-ts/lib/Task' +import * as TE from 'fp-ts/lib/TaskEither' import * as DE from './DecodeError' import * as D from './Decoder' import * as FS from './FreeSemigroup' @@ -424,7 +424,7 @@ export const URI = 'io-ts/TaskDecoder' */ export type URI = typeof URI -declare module 'fp-ts/HKT' { +declare module 'fp-ts/lib/HKT' { interface URItoKind2 { readonly [URI]: TaskDecoder } diff --git a/src/ThrowReporter.ts b/src/ThrowReporter.ts index 667bfa2e3..8d991a992 100644 --- a/src/ThrowReporter.ts +++ b/src/ThrowReporter.ts @@ -4,7 +4,7 @@ */ import { Reporter } from './Reporter' import { PathReporter } from './PathReporter' -import { isLeft } from 'fp-ts/Either' +import { isLeft } from 'fp-ts/lib/Either' /** * @category deprecated diff --git a/src/Type.ts b/src/Type.ts index ee845d68a..ace0caafe 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -10,8 +10,8 @@ */ import * as t from './index' import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable' -import * as E from 'fp-ts/Either' -import { pipe } from 'fp-ts/pipeable' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' // ------------------------------------------------------------------------------------- // model @@ -171,7 +171,7 @@ export const URI = 'io-ts/Type' */ export type URI = typeof URI -declare module 'fp-ts/HKT' { +declare module 'fp-ts/lib/HKT' { interface URItoKind { readonly [URI]: Type } diff --git a/src/index.ts b/src/index.ts index 8d5e967b6..10903a67e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ /** * @since 1.0.0 */ -import { Either, isLeft, left, right } from 'fp-ts/Either' -import { Predicate, Refinement } from 'fp-ts/function' +import { Either, isLeft, left, right } from 'fp-ts/lib/Either' +import { Predicate, Refinement } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- // model From a062aae5178315a1a1b2a80c8b8e6a3a2f72caa2 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Mon, 10 Aug 2020 10:59:23 +0900 Subject: [PATCH 154/222] Revert "update all fp-ts usages in test (dont use lib)" This reverts commit 985dd78b80164d69a574467a301adb380aa90a2f. --- test/2.1.x/TypeClass.ts | 4 ++-- test/2.1.x/helpers.ts | 4 ++-- test/2.1.x/type.ts | 4 ++-- test/2.1.x/union.ts | 2 +- test/Arbitrary.ts | 2 +- test/Codec.ts | 4 ++-- test/Decoder.ts | 4 ++-- test/Encoder.ts | 2 +- test/Eq.ts | 4 ++-- test/Guard.ts | 2 +- test/Schema.ts | 4 ++-- test/TaskDecoder.ts | 6 +++--- test/Type.ts | 6 +++--- test/helpers.ts | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/test/2.1.x/TypeClass.ts b/test/2.1.x/TypeClass.ts index bc6f067f1..c179b3e07 100644 --- a/test/2.1.x/TypeClass.ts +++ b/test/2.1.x/TypeClass.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import { Either, fold, right } from 'fp-ts/Either' -import { pipe } from 'fp-ts/pipeable' +import { Either, fold, right } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' import * as t from '../../src/index' import { assertFailure, assertSuccess } from './helpers' diff --git a/test/2.1.x/helpers.ts b/test/2.1.x/helpers.ts index 9c1de5996..de7733520 100644 --- a/test/2.1.x/helpers.ts +++ b/test/2.1.x/helpers.ts @@ -1,8 +1,8 @@ import * as assert from 'assert' -import { right, either, fold } from 'fp-ts/Either' +import { right, either, fold } from 'fp-ts/lib/Either' import * as t from '../../src/index' import { PathReporter } from '../../src/PathReporter' -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' export function assertStrictEqual(result: t.Validation, expected: any): void { pipe( diff --git a/test/2.1.x/type.ts b/test/2.1.x/type.ts index b39c4bba1..66be70f60 100644 --- a/test/2.1.x/type.ts +++ b/test/2.1.x/type.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import { fold } from 'fp-ts/Either' -import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' diff --git a/test/2.1.x/union.ts b/test/2.1.x/union.ts index 385e9e747..d340cba05 100644 --- a/test/2.1.x/union.ts +++ b/test/2.1.x/union.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' -import { either } from 'fp-ts/Either' +import { either } from 'fp-ts/lib/Either' describe('union', () => { describe('name', () => { diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 995e4b63d..1126e1acf 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -107,7 +107,7 @@ export const URI = 'Arbitrary' export type URI = typeof URI -declare module 'fp-ts/HKT' { +declare module 'fp-ts/lib/HKT' { interface URItoKind { readonly Arbitrary: Arbitrary } diff --git a/test/Codec.ts b/test/Codec.ts index 77b53b40a..45ae60c7a 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -1,10 +1,10 @@ import * as assert from 'assert' import * as _ from '../src/Codec' import * as D from '../src/Decoder' -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' -import * as E from 'fp-ts/Either' +import * as E from 'fp-ts/lib/Either' import * as H from './helpers' const codecNumberFromString: _.Codec = _.make( diff --git a/test/Decoder.ts b/test/Decoder.ts index 59a0bf999..0be76e0ac 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' -import * as E from 'fp-ts/Either' -import { pipe } from 'fp-ts/pipeable' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' import * as _ from '../src/Decoder' diff --git a/test/Encoder.ts b/test/Encoder.ts index 0eac4f1c0..4bedd9563 100644 --- a/test/Encoder.ts +++ b/test/Encoder.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as E from '../src/Encoder' -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' import * as H from './helpers' describe('Encoder', () => { diff --git a/test/Eq.ts b/test/Eq.ts index 6b89bc4a6..6e74bfc71 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import * as E from '../src/Eq' -import { Eq } from 'fp-ts/Eq' -import { pipe } from 'fp-ts/pipeable' +import { Eq } from 'fp-ts/lib/Eq' +import { pipe } from 'fp-ts/lib/pipeable' describe('Eq', () => { it('literal', () => { diff --git a/test/Guard.ts b/test/Guard.ts index e0de97614..5034563be 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as G from '../src/Guard' -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' interface NonEmptyStringBrand { readonly NonEmptyString: unique symbol diff --git a/test/Schema.ts b/test/Schema.ts index e86fae9ee..e2ec4ffbe 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,6 +1,6 @@ import * as fc from 'fast-check' -import { isRight } from 'fp-ts/Either' -import { pipe } from 'fp-ts/pipeable' +import { isRight } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' import * as D from '../src/Decoder' import * as Eq from '../src/Eq' import * as G from '../src/Guard' diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index eb53fcbd9..aaafd270e 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' -import * as E from 'fp-ts/Either' -import { pipe } from 'fp-ts/pipeable' -import * as TE from 'fp-ts/TaskEither' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as TE from 'fp-ts/lib/TaskEither' import * as DE from '../src/DecodeError' import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' diff --git a/test/Type.ts b/test/Type.ts index 70ed65281..2c20a1562 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -1,7 +1,7 @@ import * as assert from 'assert' import * as fc from 'fast-check' -import { isRight, isLeft } from 'fp-ts/Either' -import { Kind, URIS, HKT, URIS2, Kind2 } from 'fp-ts/HKT' +import { isRight, isLeft } from 'fp-ts/lib/Either' +import { Kind, URIS, HKT, URIS2, Kind2 } from 'fp-ts/lib/HKT' import * as t from '../src' import * as D from '../src/Decoder' import * as G from '../src/Guard' @@ -19,7 +19,7 @@ import { } from '../src/Schemable' import * as _ from '../src/Type' import * as A from './Arbitrary' -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' interface Schema { (S: Schemable & WithUnknownContainers & WithUnion): HKT diff --git a/test/helpers.ts b/test/helpers.ts index 3a1395cf3..333b363bc 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -1,7 +1,7 @@ import * as G from '../src/Guard' import * as D from '../src/Decoder' import * as E from '../src/Encoder' -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/lib/pipeable' // ------------------------------------------------------------------------------------- // guards From 5f77c1e6febbd1fd7905212c981b0fc13a9fb05b Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Mon, 10 Aug 2020 11:01:25 +0900 Subject: [PATCH 155/222] Revert "update all docs fp-ts imports" This reverts commit 5728dd42fde46ff0e7f1511cf9f427a30131c50b. --- Codec.md | 2 +- Decoder.md | 14 +++++++------- Eq.md | 2 +- Schema.md | 2 +- index.md | 14 +++++++------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Codec.md b/Codec.md index 117854a29..9788eed56 100644 --- a/Codec.md +++ b/Codec.md @@ -26,7 +26,7 @@ You can build a new codec using the `make` helper import * as C from 'io-ts/lib/Codec' import * as D from 'io-ts/lib/Decoder' import * as E from 'io-ts/lib/Encoder' -import { pipe } from 'fp-ts/function' +import { pipe } from 'fp-ts/lib/function' const decoder: D.Decoder = pipe( D.string, diff --git a/Decoder.md b/Decoder.md index 30ecc265c..98cbadb72 100644 --- a/Decoder.md +++ b/Decoder.md @@ -45,7 +45,7 @@ export const string: D.Decoder = { and we can use it as follows: ```ts -import { isRight } from 'fp-ts/Either' +import { isRight } from 'fp-ts/lib/Either' console.log(isRight(string.decode('a'))) // => true console.log(isRight(string.decode(null))) // => false @@ -54,8 +54,8 @@ console.log(isRight(string.decode(null))) // => false More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold) along with `pipe` (which is similar to the pipeline operator) ```ts -import { pipe } from 'fp-ts/pipeable' -import { fold } from 'fp-ts/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' console.log( pipe( @@ -289,7 +289,7 @@ const Bar: D.Decoder = D.lazy('Bar', () => The `refine` combinator allows to define refinements, for example a branded type ```ts -import { pipe } from 'fp-ts/function' +import { pipe } from 'fp-ts/lib/function' export interface PositiveBrand { readonly Positive: unique symbol @@ -311,8 +311,8 @@ console.log(isRight(Positive.decode(-1))) // => false The `parse` combinator is more powerful than `refine` in that you can change the output type ```ts -import { pipe } from 'fp-ts/function' -import { isRight } from 'fp-ts/Either' +import { pipe } from 'fp-ts/lib/function' +import { isRight } from 'fp-ts/lib/Either' export const NumberFromString: D.Decoder = pipe( D.string, @@ -354,7 +354,7 @@ export interface Person extends D.TypeOf {} # Built-in error reporter ```ts -import { isLeft } from 'fp-ts/Either' +import { isLeft } from 'fp-ts/lib/Either' export const Person = D.type({ name: D.string, diff --git a/Eq.md b/Eq.md index 9ce49b262..0a3828586 100644 --- a/Eq.md +++ b/Eq.md @@ -26,7 +26,7 @@ Instances must satisfy the following laws: **Example** ```ts -import { Eq } from 'fp-ts/Eq' +import { Eq } from 'fp-ts/lib/Eq' export const string: Eq = { equals: (x, y) => x === y diff --git a/Schema.md b/Schema.md index 95189845c..3275a703a 100644 --- a/Schema.md +++ b/Schema.md @@ -55,7 +55,7 @@ export type Int = number & IntBrand Now we must define a custom `MySchemable` type class containing a new member `Int`... ```ts -import { Kind2, URIS2, HKT } from 'fp-ts/HKT' +import { Kind2, URIS2, HKT } from 'fp-ts/lib/HKT' import * as S from 'io-ts/lib/Schemable' export interface MySchemable extends S.Schemable { diff --git a/index.md b/index.md index b315f6df9..4296fded5 100644 --- a/index.md +++ b/index.md @@ -90,7 +90,7 @@ const string = new t.Type( and we can use it as follows: ```ts -import { isRight } from 'fp-ts/Either' +import { isRight } from 'fp-ts/lib/Either' isRight(string.decode('a string')) // true isRight(string.decode(null)) // false @@ -100,8 +100,8 @@ More generally the result of calling `decode` can be handled using [`fold`](http ```ts import * as t from 'io-ts' -import { pipe } from 'fp-ts/pipeable' -import { fold } from 'fp-ts/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' // failure handler const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` @@ -224,8 +224,8 @@ interface Errors extends Array {} Example ```ts -import { pipe } from 'fp-ts/pipeable' -import { fold } from 'fp-ts/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' const getPaths = (v: t.Validation): Array => { return pipe( @@ -247,7 +247,7 @@ You can set your own error message by providing a `message` argument to `failure Example ```ts -import { either } from 'fp-ts/Either' +import { either } from 'fp-ts/lib/Either' const NumberFromString = new t.Type( 'NumberFromString', @@ -434,7 +434,7 @@ type PartialUser = { You can define your own types. Let's see an example ```ts -import { either } from 'fp-ts/Either' +import { either } from 'fp-ts/lib/Either' // represents a Date from an ISO string const DateFromString = new t.Type( From 943397b56a6bcfac9a03f0f46128ee38dda36488 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Mon, 10 Aug 2020 11:01:53 +0900 Subject: [PATCH 156/222] reintroduce import-path-rewrite for compatibility --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 24af9c3b5..ca1a93e80 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "test": "npm run prettier && npm run lint && npm run dtslint && npm run jest && npm run docs", "clean": "rm -rf ./dist", "prebuild": "npm run clean", - "build": "tsc -p ./tsconfig.build.json && tsc -p ./tsconfig.build-es6.json && ts-node scripts/build", + "build": "tsc -p ./tsconfig.build.json && tsc -p ./tsconfig.build-es6.json && npm run import-path-rewrite && ts-node scripts/build", "postbuild": "prettier --loglevel=silent --write \"./dist/**/*.ts\"", "prepublishOnly": "ts-node scripts/pre-publish", "perf": "ts-node perf/index", @@ -23,7 +23,8 @@ "doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", "docs": "docs-ts", "prerelease": "npm run build", - "release": "ts-node scripts/release" + "release": "ts-node scripts/release", + "import-path-rewrite": "import-path-rewrite" }, "repository": { "type": "git", From 8b29eb0592d08f12d4bf964e5fc910730b64941d Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Mon, 10 Aug 2020 11:05:07 +0900 Subject: [PATCH 157/222] Revert "docs imports" This reverts commit 603df65fc5e179a12f15080ae0e1bbb31aabf114. --- docs/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.md b/docs/index.md index e9376c3e2..1075b9970 100644 --- a/docs/index.md +++ b/docs/index.md @@ -73,7 +73,7 @@ const string = new t.Type( and we can use it as follows: ```ts -import { isRight } from 'fp-ts/Either' +import { isRight } from 'fp-ts/lib/Either' isRight(string.decode('a string')) // true isRight(string.decode(null)) // false @@ -83,8 +83,8 @@ More generally the result of calling `decode` can be handled using [`fold`](http ```ts import * as t from 'io-ts' -import { pipe } from 'fp-ts/pipeable' -import { fold } from 'fp-ts/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import { fold } from 'fp-ts/lib/Either' // failure handler const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` From 061c3b73aca55da13e7f0bc5434e8725131e6872 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 19 Aug 2020 10:11:19 +0200 Subject: [PATCH 158/222] version 2.2.10 --- CHANGELOG.md | 5 +++++ package-lock.json | 10 +++++----- package.json | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ba7d9f0a..4ce11fb97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.10 + +- **Polish** + - expose `fp-ts` modules without lib/es6 prefix, #507 (@osdiab) + # 2.2.9 - **Polish** diff --git a/package-lock.json b/package-lock.json index 382293c05..3d36e8724 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.9", + "version": "2.2.10", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2942,7 +2942,7 @@ } }, "import-path-rewrite": { - "version": "github:gcanti/import-path-rewrite#0086599732ccc761a33255a702a07266895d0572", + "version": "github:gcanti/import-path-rewrite#39b4178f9ff80aed3fa18a702584e0d0f0d6d8bc", "from": "github:gcanti/import-path-rewrite", "dev": true, "requires": { @@ -2951,9 +2951,9 @@ }, "dependencies": { "ansi-styles": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.0.tgz", - "integrity": "sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "dev": true, "requires": { "@types/color-name": "^1.1.1", diff --git a/package.json b/package.json index ca1a93e80..5a5525b5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.9", + "version": "2.2.10", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", From a53a60e0633461ed69aded36250d45bcfb80ea83 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 19 Aug 2020 10:44:31 +0200 Subject: [PATCH 159/222] remove /lib prefix in docs --- Codec.md | 8 ++++---- Decoder.md | 16 ++++++++-------- Encoder.md | 2 +- Eq.md | 4 ++-- Schema.md | 16 ++++++++-------- index.md | 16 ++++++++-------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Codec.md b/Codec.md index 9788eed56..0656973ea 100644 --- a/Codec.md +++ b/Codec.md @@ -23,10 +23,10 @@ You can build a new codec using the `make` helper **Example** ```ts -import * as C from 'io-ts/lib/Codec' -import * as D from 'io-ts/lib/Decoder' -import * as E from 'io-ts/lib/Encoder' -import { pipe } from 'fp-ts/lib/function' +import * as C from 'io-ts/Codec' +import * as D from 'io-ts/Decoder' +import * as E from 'io-ts/Encoder' +import { pipe } from 'fp-ts/function' const decoder: D.Decoder = pipe( D.string, diff --git a/Decoder.md b/Decoder.md index 98cbadb72..27c5eee35 100644 --- a/Decoder.md +++ b/Decoder.md @@ -35,7 +35,7 @@ interface Decoder { A decoder representing `string` can be defined as ```ts -import * as D from 'io-ts/lib/Decoder' +import * as D from 'io-ts/Decoder' export const string: D.Decoder = { decode: (u) => (typeof u === 'string' ? D.success(u) : D.failure(u, 'string')) @@ -45,7 +45,7 @@ export const string: D.Decoder = { and we can use it as follows: ```ts -import { isRight } from 'fp-ts/lib/Either' +import { isRight } from 'fp-ts/Either' console.log(isRight(string.decode('a'))) // => true console.log(isRight(string.decode(null))) // => false @@ -54,8 +54,8 @@ console.log(isRight(string.decode(null))) // => false More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold) along with `pipe` (which is similar to the pipeline operator) ```ts -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/Either' console.log( pipe( @@ -289,7 +289,7 @@ const Bar: D.Decoder = D.lazy('Bar', () => The `refine` combinator allows to define refinements, for example a branded type ```ts -import { pipe } from 'fp-ts/lib/function' +import { pipe } from 'fp-ts/function' export interface PositiveBrand { readonly Positive: unique symbol @@ -311,8 +311,8 @@ console.log(isRight(Positive.decode(-1))) // => false The `parse` combinator is more powerful than `refine` in that you can change the output type ```ts -import { pipe } from 'fp-ts/lib/function' -import { isRight } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/function' +import { isRight } from 'fp-ts/Either' export const NumberFromString: D.Decoder = pipe( D.string, @@ -354,7 +354,7 @@ export interface Person extends D.TypeOf {} # Built-in error reporter ```ts -import { isLeft } from 'fp-ts/lib/Either' +import { isLeft } from 'fp-ts/Either' export const Person = D.type({ name: D.string, diff --git a/Encoder.md b/Encoder.md index cbeb0f4c0..c5accd529 100644 --- a/Encoder.md +++ b/Encoder.md @@ -18,7 +18,7 @@ export interface Encoder { An encoder representing a nullable value ```ts -import * as E from 'io-ts/lib/Encoder' +import * as E from 'io-ts/Encoder' export function nullable(or: E.Encoder): E.Encoder { return { diff --git a/Eq.md b/Eq.md index 0a3828586..eaac1a433 100644 --- a/Eq.md +++ b/Eq.md @@ -26,7 +26,7 @@ Instances must satisfy the following laws: **Example** ```ts -import { Eq } from 'fp-ts/lib/Eq' +import { Eq } from 'fp-ts/Eq' export const string: Eq = { equals: (x, y) => x === y @@ -57,7 +57,7 @@ export const string: Eq = { **Example** ```ts -import * as E from 'io-ts/lib/Eq' +import * as E from 'io-ts/Eq' const Person = E.type({ name: E.string, diff --git a/Schema.md b/Schema.md index 3275a703a..84a92f784 100644 --- a/Schema.md +++ b/Schema.md @@ -19,11 +19,11 @@ export interface Schema { **Example** ```ts -import * as D from 'io-ts/lib/Decoder' -import * as Eq from 'io-ts/lib/Eq' -import * as G from 'io-ts/lib/Guard' -import * as S from 'io-ts/lib/Schema' -import * as TD from 'io-ts/lib/TaskDecoder' +import * as D from 'io-ts/Decoder' +import * as Eq from 'io-ts/Eq' +import * as G from 'io-ts/Guard' +import * as S from 'io-ts/Schema' +import * as TD from 'io-ts/TaskDecoder' export const Person = S.make((S) => S.type({ @@ -55,8 +55,8 @@ export type Int = number & IntBrand Now we must define a custom `MySchemable` type class containing a new member `Int`... ```ts -import { Kind2, URIS2, HKT } from 'fp-ts/lib/HKT' -import * as S from 'io-ts/lib/Schemable' +import { Kind2, URIS2, HKT } from 'fp-ts/HKT' +import * as S from 'io-ts/Schemable' export interface MySchemable extends S.Schemable { readonly Int: HKT @@ -82,7 +82,7 @@ export function make(f: MySchema): MySchema { Finally we must define an instance of `MySchemable2C` for `Decoder` and an interpreter ```ts -import * as D from 'io-ts/lib/Decoder' +import * as D from 'io-ts/Decoder' import { pipe } from 'fp-ts/function' export const mySchemable: MySchemable2C = { diff --git a/index.md b/index.md index 4296fded5..05d72d7ee 100644 --- a/index.md +++ b/index.md @@ -90,7 +90,7 @@ const string = new t.Type( and we can use it as follows: ```ts -import { isRight } from 'fp-ts/lib/Either' +import { isRight } from 'fp-ts/Either' isRight(string.decode('a string')) // true isRight(string.decode(null)) // false @@ -100,8 +100,8 @@ More generally the result of calling `decode` can be handled using [`fold`](http ```ts import * as t from 'io-ts' -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/Either' // failure handler const onLeft = (errors: t.Errors): string => `${errors.length} error(s) found` @@ -195,7 +195,7 @@ This package exports a default `PathReporter` reporter Example ```ts -import { PathReporter } from 'io-ts/lib/PathReporter' +import { PathReporter } from 'io-ts/PathReporter' const result = User.decode({ name: 'Giulio' }) @@ -224,8 +224,8 @@ interface Errors extends Array {} Example ```ts -import { pipe } from 'fp-ts/lib/pipeable' -import { fold } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/pipeable' +import { fold } from 'fp-ts/Either' const getPaths = (v: t.Validation): Array => { return pipe( @@ -247,7 +247,7 @@ You can set your own error message by providing a `message` argument to `failure Example ```ts -import { either } from 'fp-ts/lib/Either' +import { either } from 'fp-ts/Either' const NumberFromString = new t.Type( 'NumberFromString', @@ -434,7 +434,7 @@ type PartialUser = { You can define your own types. Let's see an example ```ts -import { either } from 'fp-ts/lib/Either' +import { either } from 'fp-ts/Either' // represents a Date from an ISO string const DateFromString = new t.Type( From 652b859e98ca7ac4bf1a2a9bd8160fb35277bf76 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 19 Aug 2020 11:48:30 +0200 Subject: [PATCH 160/222] fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ce11fb97..7448ae273 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ # 2.2.10 - **Polish** - - expose `fp-ts` modules without lib/es6 prefix, #507 (@osdiab) + - expose modules without lib/es6 prefix, #507 (@osdiab) # 2.2.9 From ed0b89a4bf8179b03cddd5349fe9eb78dc3d474d Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 22 Aug 2020 09:27:36 +0200 Subject: [PATCH 161/222] remove pipeable module from docs --- Decoder.md | 2 +- index.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Decoder.md b/Decoder.md index 27c5eee35..f254119a4 100644 --- a/Decoder.md +++ b/Decoder.md @@ -54,7 +54,7 @@ console.log(isRight(string.decode(null))) // => false More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold) along with `pipe` (which is similar to the pipeline operator) ```ts -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/function' import { fold } from 'fp-ts/Either' console.log( diff --git a/index.md b/index.md index 05d72d7ee..314c847b6 100644 --- a/index.md +++ b/index.md @@ -100,7 +100,7 @@ More generally the result of calling `decode` can be handled using [`fold`](http ```ts import * as t from 'io-ts' -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/function' import { fold } from 'fp-ts/Either' // failure handler @@ -224,7 +224,7 @@ interface Errors extends Array {} Example ```ts -import { pipe } from 'fp-ts/pipeable' +import { pipe } from 'fp-ts/function' import { fold } from 'fp-ts/Either' const getPaths = (v: t.Validation): Array => { From 10295a45f198b5952c51b957336acb9812b5b7ed Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 22 Aug 2020 09:29:43 +0200 Subject: [PATCH 162/222] fix Arbitrary signatures --- test/Arbitrary.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 1126e1acf..c195d0232 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -14,7 +14,7 @@ export interface Arbitrary extends fc.Arbitrary {} // constructors // ------------------------------------------------------------------------------------- -export function literal>(...values: A): Arbitrary { +export function literal]>(...values: A): Arbitrary { return fc.oneof(...values.map((v) => fc.constant(v))) } @@ -93,7 +93,7 @@ export function lazy(f: () => Arbitrary): Arbitrary { return fc.constant(null).chain(() => get()) } -export function union>( +export function union, ...Array>]>( ...members: { [K in keyof A]: Arbitrary } ): Arbitrary { return fc.oneof(...members) From 547fa034d61e9f26b1e02081b6c45c3bc39bfebf Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 22 Aug 2020 09:31:59 +0200 Subject: [PATCH 163/222] better interpreter signature --- docs/modules/Schema.ts.md | 25 ++++--------------------- src/Schema.ts | 9 +++++---- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index 51e8fce56..a2922eb96 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -72,27 +72,10 @@ Added in v2.2.0 **Signature** ```ts -export declare const interpreter: { - ( - S: Schemable2C - ): (schema: Schema) => Kind2 - < - S extends - | 'Eq' - | 'io-ts/Guard' - | 'Option' - | 'ReadonlyRecord' - | 'Ord' - | 'NonEmptyArray' - | 'Array' - | 'Record' - | 'IO' - | 'Task' - | 'io-ts/Type' - >( - S: Schemable1 - ): (schema: Schema) => Kind -} +export declare function interpreter( + S: Schemable2C +): (schema: Schema) => Kind2 +export declare function interpreter(S: Schemable1): (schema: Schema) => Kind ``` Added in v2.2.3 diff --git a/src/Schema.ts b/src/Schema.ts index 2a7e20652..6eaf1ae4b 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -47,7 +47,8 @@ export type TypeOf = S extends Schema ? A : never /** * @since 2.2.3 */ -export const interpreter: { - (S: Schemable2C): (schema: Schema) => Kind2 - (S: Schemable1): (schema: Schema) => Kind -} = (S: any) => (schema: any) => schema(S) +export function interpreter(S: Schemable2C): (schema: Schema) => Kind2 +export function interpreter(S: Schemable1): (schema: Schema) => Kind +export function interpreter(S: Schemable): (schema: Schema) => HKT { + return (schema) => schema(S) +} From 5a795ae3db63cd4d4da55034dfb328f2158c6214 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 22 Aug 2020 09:32:24 +0200 Subject: [PATCH 164/222] upgrade to typescript@3.9.6 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d36e8724..5441c204f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7200,9 +7200,9 @@ } }, "typescript": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", - "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", + "version": "3.9.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.6.tgz", + "integrity": "sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==", "dev": true }, "unc-path-regex": { diff --git a/package.json b/package.json index 5a5525b5f..d6b4ea7f3 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "ts-node": "8.8.2", "tslint": "6.1.1", "tslint-config-standard": "9.0.0", - "typescript": "^3.9.3" + "typescript": "^3.9.6" }, "tags": [ "typescript", From a92e57f5685e08b51ef361388d3dc56514e873fb Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 22 Aug 2020 09:52:11 +0200 Subject: [PATCH 165/222] change Schemable import in Type module --- docs/modules/Type.ts.md | 10 +++++----- src/Type.ts | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 46e3d16b7..144d21cd0 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -174,7 +174,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const literal: (...values: A) => Type +export declare const literal: (...values: A) => Type ``` Added in v2.2.3 @@ -186,7 +186,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const Schemable: Schemable1<'io-ts/Type'> +export declare const Schemable: S.Schemable1<'io-ts/Type'> ``` Added in v2.2.8 @@ -216,7 +216,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const WithRefine: WithRefine1<'io-ts/Type'> +export declare const WithRefine: S.WithRefine1<'io-ts/Type'> ``` Added in v2.2.8 @@ -226,7 +226,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const WithUnion: WithUnion1<'io-ts/Type'> +export declare const WithUnion: S.WithUnion1<'io-ts/Type'> ``` Added in v2.2.8 @@ -236,7 +236,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const WithUnknownContainers: WithUnknownContainers1<'io-ts/Type'> +export declare const WithUnknownContainers: S.WithUnknownContainers1<'io-ts/Type'> ``` Added in v2.2.8 diff --git a/src/Type.ts b/src/Type.ts index ace0caafe..ca08b5ec9 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -8,10 +8,10 @@ * * @since 2.2.3 */ -import * as t from './index' -import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' +import * as t from './index' +import * as S from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -31,7 +31,7 @@ export interface Type extends t.Type {} * @category constructors * @since 2.2.3 */ -export const literal = ]>(...values: A): Type => +export const literal = ]>(...values: A): Type => t.union(values.map((v) => t.literal(v as any)) as any) // ------------------------------------------------------------------------------------- @@ -181,7 +181,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.8 */ -export const Schemable: Schemable1 = { +export const Schemable: S.Schemable1 = { URI, literal, string, @@ -192,7 +192,7 @@ export const Schemable: Schemable1 = { partial, record, array, - tuple: tuple as Schemable1['tuple'], + tuple: tuple as S.Schemable1['tuple'], intersect, sum, lazy @@ -202,7 +202,7 @@ export const Schemable: Schemable1 = { * @category instances * @since 2.2.8 */ -export const WithUnknownContainers: WithUnknownContainers1 = { +export const WithUnknownContainers: S.WithUnknownContainers1 = { UnknownArray, UnknownRecord } @@ -211,14 +211,14 @@ export const WithUnknownContainers: WithUnknownContainers1 = { * @category instances * @since 2.2.8 */ -export const WithUnion: WithUnion1 = { - union: union as WithUnion1['union'] +export const WithUnion: S.WithUnion1 = { + union: union as S.WithUnion1['union'] } /** * @category instances * @since 2.2.8 */ -export const WithRefine: WithRefine1 = { - refine: refine as WithRefine1['refine'] +export const WithRefine: S.WithRefine1 = { + refine: refine as S.WithRefine1['refine'] } From 9e12d0cca3076d97ddd87a82d4b3c5898f48a53a Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 22 Aug 2020 12:14:35 +0200 Subject: [PATCH 166/222] change interpreter definition in docs --- Schema.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Schema.md b/Schema.md index 84a92f784..c266c74d3 100644 --- a/Schema.md +++ b/Schema.md @@ -83,7 +83,8 @@ Finally we must define an instance of `MySchemable2C` for `Decoder` and an inter ```ts import * as D from 'io-ts/Decoder' -import { pipe } from 'fp-ts/function' +import { pipe, unsafeCoerce } from 'fp-ts/function' +import * as SC from 'io-ts/Schema' export const mySchemable: MySchemable2C = { ...D.Schemable, @@ -93,10 +94,10 @@ export const mySchemable: MySchemable2C = { ) } -export function interpreter(S: MySchemable2C): (schema: MySchema) => Kind2 -export function interpreter(S: MySchemable): (schema: MySchema) => HKT { - return (schema) => schema(S) -} +const interpreter: { + (S: MySchemable2C): (schema: MySchema) => Kind2 + (S: MySchemable1): (schema: MySchema) => Kind +} = unsafeCoerce(SC.interpreter) ``` Now we can define a schema leveraging the new `Int` capability From f19b6795fcfe9c011abf1d666a527b3c78ed7c18 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 30 Sep 2020 09:36:33 +0200 Subject: [PATCH 167/222] add missing MySchemable1 definition to Schema.md --- Schema.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Schema.md b/Schema.md index c266c74d3..9a7d8ac05 100644 --- a/Schema.md +++ b/Schema.md @@ -55,13 +55,20 @@ export type Int = number & IntBrand Now we must define a custom `MySchemable` type class containing a new member `Int`... ```ts -import { Kind2, URIS2, HKT } from 'fp-ts/HKT' +import { Kind, Kind2, URIS, URIS2, HKT } from 'fp-ts/HKT' import * as S from 'io-ts/Schemable' +// base type class definition export interface MySchemable extends S.Schemable { readonly Int: HKT } +// type class definition for * -> * constructors (e.g. `Eq`, `Guard`) +export interface MySchemable1 extends S.Schemable1 { + readonly Int: Kind +} + +// type class definition for * -> * -> * constructors (e.g. `Decoder`, `Encoder`) export interface MySchemable2C extends S.Schemable2C { readonly Int: Kind2 } @@ -115,7 +122,11 @@ const Person: MySchema<{ age: Int; }> */ +``` +and get the corresponding decoder using the `mySchemable` instance + +```ts export const decoderPerson = interpreter(mySchemable)(Person) /* const decoderPerson: D.Decoder Date: Sat, 3 Oct 2020 20:30:54 +0400 Subject: [PATCH 168/222] Make toForest stack-safe --- src/Decoder.ts | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Decoder.ts b/src/Decoder.ts index 51d97db39..a5d046b9f 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -549,10 +549,27 @@ const toTree: (e: DE.DecodeError) => Tree = DE.fold({ Wrap: (error, errors) => make(error, toForest(errors)) }) -const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( - (value) => [toTree(value)], - (left, right) => toForest(left).concat(toForest(right)) -) +const toForest = (e: DecodeError): ReadonlyArray> => { + const stack = []; + let focus = e; + const res = []; + while (true) { + switch (focus._tag) { + case "Of": + res.push(toTree(focus.value)); + if (stack.length === 0) { + return res; + } else { + focus = stack.pop()!; + } + break; + case "Concat": + stack.push(focus.right); + focus = focus.left; + break; + } + } +}; /** * @since 2.2.7 From 5fa346263b78d5d519957dd9ba79421860b52837 Mon Sep 17 00:00:00 2001 From: Irakli Safareli Date: Sat, 3 Oct 2020 20:50:49 +0400 Subject: [PATCH 169/222] add tests --- src/Decoder.ts | 26 +++++++++++++------------- test/Decoder.ts | 16 ++++++++++++++++ test/FreeSemigroup.ts | 13 +++++++++++++ 3 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 test/FreeSemigroup.ts diff --git a/src/Decoder.ts b/src/Decoder.ts index a5d046b9f..a44f78eb9 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -550,26 +550,26 @@ const toTree: (e: DE.DecodeError) => Tree = DE.fold({ }) const toForest = (e: DecodeError): ReadonlyArray> => { - const stack = []; - let focus = e; - const res = []; + const stack = [] + let focus = e + const res = [] while (true) { switch (focus._tag) { - case "Of": - res.push(toTree(focus.value)); + case 'Of': + res.push(toTree(focus.value)) if (stack.length === 0) { - return res; + return res } else { - focus = stack.pop()!; + focus = stack.pop()! } - break; - case "Concat": - stack.push(focus.right); - focus = focus.left; - break; + break + case 'Concat': + stack.push(focus.right) + focus = focus.left + break } } -}; +} /** * @since 2.2.7 diff --git a/test/Decoder.ts b/test/Decoder.ts index 0be76e0ac..c23f6dbe0 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -534,6 +534,22 @@ describe('Decoder', () => { // ------------------------------------------------------------------------------------- describe('draw', () => { + it('is stack safe', () => { + expect(() => { + E.mapLeft(_.draw)( + _.record(_.type({ done: _.boolean })).decode( + new Array(10000) + .fill({}) + .map((v, k) => [k, v]) + .reduce((acc, [k, v]) => { + acc[k] = v + return acc + }, {} as Record) + ) + ) + }).not.toThrow() + }) + it('draw', () => { const decoder = _.type({ a: _.string, diff --git a/test/FreeSemigroup.ts b/test/FreeSemigroup.ts new file mode 100644 index 000000000..029dcb7db --- /dev/null +++ b/test/FreeSemigroup.ts @@ -0,0 +1,13 @@ +import * as FS from '../src/FreeSemigroup' + +describe('FreeSemigroup', () => { + it('fold', () => { + const sum: (input: FS.FreeSemigroup) => string = FS.fold( + (value) => value, + (left, right) => sum(left) + sum(right) + ) + + expect(sum(FS.of('1'))).toBe('1') + expect(sum(FS.concat(FS.of('1'), FS.of('2')))).toBe('12') + }) +}) From 46999babe78b08765a573a1a56d5c16233d99f0b Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 5 Oct 2020 11:52:40 +0200 Subject: [PATCH 170/222] version 2.2.11 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7448ae273..78c2c6cc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.11 + +- **Polish** + - `Decoder` + - make `toForest` stack-safe, #520 (@safareli) + # 2.2.10 - **Polish** diff --git a/package.json b/package.json index d6b4ea7f3..0cd8f9fc8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.10", + "version": "2.2.11", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", From ff59c8b389431f7bf55556b761e71993d9a28b35 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 21 Oct 2020 17:15:42 +0200 Subject: [PATCH 171/222] Experimental: make `sum` safer, closes #523 --- CHANGELOG.md | 28 +++++++++++++++++++++++++++- Decoder.md | 21 +++++++++++++++++++++ docs/modules/Decoder.ts.md | 2 +- docs/modules/Eq.ts.md | 4 +++- docs/modules/Guard.ts.md | 2 +- docs/modules/Schemable.ts.md | 10 +++++++--- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- dtslint/ts3.5/Codec.ts | 10 ++++++---- dtslint/ts3.5/Decoder.ts | 10 ++++++---- dtslint/ts3.5/Eq.ts | 12 ++++++++++++ dtslint/ts3.5/Guard.ts | 12 ++++++++++++ dtslint/ts3.5/Schema.ts | 2 ++ dtslint/ts3.5/TaskDecoder.ts | 13 +++++++++++++ dtslint/ts3.5/tslint.json | 9 ++++++++- package-lock.json | 24 ++++++++++++------------ package.json | 4 ++-- src/Codec.ts | 2 +- src/Decoder.ts | 4 ++-- src/Eq.ts | 4 +++- src/Guard.ts | 2 +- src/Kleisli.ts | 2 +- src/Schemable.ts | 10 +++++++--- src/TaskDecoder.ts | 4 ++-- src/Type.ts | 5 +++-- test/Arbitrary.ts | 2 +- test/Decoder.ts | 26 +++++++++++++------------- test/Guard.ts | 10 +++++----- 28 files changed, 174 insertions(+), 64 deletions(-) create mode 100644 dtslint/ts3.5/TaskDecoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 78c2c6cc3..7990f6787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,35 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.12 + +- **Experimental** + - (\*) make `sum` safer, closes #523 (@gcanti) + +(\*) breaking change + +In case of non-`string` tag values, the respective key must be enclosed in brackets + +```ts +export const MySum: D.Decoder< + unknown, + | { + type: 1 // non-`string` tag value + a: string + } + | { + type: 2 // non-`string` tag value + b: number + } +> = D.sum('type')({ + [1]: D.type({ type: D.literal(1), a: D.string }), + [2]: D.type({ type: D.literal(2), b: D.number }) +}) +``` + # 2.2.11 -- **Polish** +- **Experimental** - `Decoder` - make `toForest` stack-safe, #520 (@safareli) diff --git a/Decoder.md b/Decoder.md index f254119a4..96e0d4991 100644 --- a/Decoder.md +++ b/Decoder.md @@ -224,6 +224,27 @@ export const MySum: D.Decoder< }) ``` +**non-`string` tag values** + +In case of non-`string` tag values, the respective key must be enclosed in brackets + +```ts +export const MySum: D.Decoder< + unknown, + | { + type: 1 // non-`string` tag value + a: string + } + | { + type: 2 // non-`string` tag value + b: number + } +> = D.sum('type')({ + [1]: D.type({ type: D.literal(1), a: D.string }), + [2]: D.type({ type: D.literal(2), b: D.number }) +}) +``` + ## The `union` combinator The `union` combinator describes untagged unions diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index e4df5beef..dc7255a86 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -358,7 +358,7 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: Decoder }) => Decoder +) => (members: { [K in keyof A]: Decoder> }) => Decoder ``` Added in v2.2.7 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 35fddadf2..7c23c1f91 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -112,7 +112,9 @@ Added in v2.2.2 **Signature** ```ts -export declare function sum(tag: T): (members: { [K in keyof A]: Eq }) => Eq +export declare function sum( + tag: T +): (members: { [K in keyof A]: Eq> }) => Eq ``` Added in v2.2.2 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 5671e7cac..72caf9230 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -171,7 +171,7 @@ Added in v2.2.0 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: Guard }) => Guard +) => (members: { [K in keyof A]: Guard> }) => Guard ``` Added in v2.2.0 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index a4c9f09df..2f9aeef47 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -67,7 +67,9 @@ export interface Schemable { readonly array: (item: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT readonly intersect: (right: HKT) => (left: HKT) => HKT - readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: HKT> }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT } ``` @@ -92,7 +94,9 @@ export interface Schemable1 { readonly array: (item: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind readonly intersect: (right: Kind) => (left: Kind) => Kind - readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: Kind> }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind } ``` @@ -123,7 +127,7 @@ export interface Schemable2C { readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 readonly sum: ( tag: T - ) => (members: { [K in keyof A]: Kind2 }) => Kind2 + ) => (members: { [K in keyof A]: Kind2> }) => Kind2 readonly lazy: (id: string, f: () => Kind2) => Kind2 } ``` diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 0d7c789d9..2ec9b094d 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -361,7 +361,7 @@ Added in v2.2.7 ```ts export declare const sum: ( tag: T -) => (members: { [K in keyof A]: TaskDecoder }) => TaskDecoder +) => (members: { [K in keyof A]: TaskDecoder> }) => TaskDecoder ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 144d21cd0..ec439c83e 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -130,7 +130,7 @@ Added in v2.2.3 ```ts export declare const sum: ( _tag: T -) => (members: { [K in keyof A]: Type }) => Type +) => (members: { [K in keyof A]: Type> }) => Type ``` Added in v2.2.3 diff --git a/dtslint/ts3.5/Codec.ts b/dtslint/ts3.5/Codec.ts index d66bcee7c..480c97466 100644 --- a/dtslint/ts3.5/Codec.ts +++ b/dtslint/ts3.5/Codec.ts @@ -106,8 +106,10 @@ _.fromSum('_tag')({ // sum // +const S1 = _.type({ _tag: _.literal('A'), a: _.string }) +const S2 = _.type({ _tag: _.literal('B'), b: _.number }) + // $ExpectType Codec -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: _.string }), - B: _.type({ _tag: _.literal('B'), b: _.number }) -}) +_.sum('_tag')({ A: S1, B: S2 }) +// // $ExpectError +// _.sum('_tag')({ A: S1, B: S1 }) diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index ddcad509e..ad43cff69 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -123,11 +123,13 @@ _.fromSum('_tag')({ // sum // +const S1 = _.type({ _tag: _.literal('A'), a: _.string }) +const S2 = _.type({ _tag: _.literal('B'), b: _.number }) + // $ExpectType Decoder -_.sum('_tag')({ - A: _.type({ _tag: _.literal('A'), a: _.string }), - B: _.type({ _tag: _.literal('B'), b: _.number }) -}) +_.sum('_tag')({ A: S1, B: S2 }) +// $ExpectError +_.sum('_tag')({ A: S1, B: S1 }) // // union diff --git a/dtslint/ts3.5/Eq.ts b/dtslint/ts3.5/Eq.ts index f41f379ac..5e948dc08 100644 --- a/dtslint/ts3.5/Eq.ts +++ b/dtslint/ts3.5/Eq.ts @@ -15,3 +15,15 @@ _.partial({ c: _.number }) }) + +// +// sum +// + +const S1 = _.type({ _tag: _.Schemable.literal('A'), a: _.string }) +const S2 = _.type({ _tag: _.Schemable.literal('B'), b: _.number }) + +// $ExpectType Eq<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }> +_.sum('_tag')({ A: S1, B: S2 }) +// // $ExpectError +// _.sum('_tag')({ A: S1, B: S1 }) diff --git a/dtslint/ts3.5/Guard.ts b/dtslint/ts3.5/Guard.ts index 8ca9b88db..afc8a9a42 100644 --- a/dtslint/ts3.5/Guard.ts +++ b/dtslint/ts3.5/Guard.ts @@ -30,3 +30,15 @@ _.partial({ // $ExpectType { a: string; b: { c: number; }; } export type A = _.TypeOf + +// +// sum +// + +const S1 = _.type({ _tag: _.literal('A'), a: _.string }) +const S2 = _.type({ _tag: _.literal('B'), b: _.number }) + +// $ExpectType Guard +_.sum('_tag')({ A: S1, B: S2 }) +// $ExpectError +_.sum('_tag')({ A: S1, B: S1 }) diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index 7b8ff53d9..921fd5a41 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -100,6 +100,8 @@ const S2 = make((S) => S.type({ _tag: S.literal('B'), b: S.number })) // $ExpectType Schema<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }> make((S) => S.sum('_tag')({ A: S1(S), B: S2(S) })) +// $ExpectError +make((S) => S.sum('_tag')({ A: S1(S), B: S1(S) })) // // lazy diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts new file mode 100644 index 000000000..8d8af5d4d --- /dev/null +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -0,0 +1,13 @@ +import * as _ from '../../src/TaskDecoder' + +// +// sum +// + +const S1 = _.type({ _tag: _.literal('A'), a: _.string }) +const S2 = _.type({ _tag: _.literal('B'), b: _.number }) + +// $ExpectType TaskDecoder +_.sum('_tag')({ A: S1, B: S2 }) +// $ExpectError +_.sum('_tag')({ A: S1, B: S1 }) diff --git a/dtslint/ts3.5/tslint.json b/dtslint/ts3.5/tslint.json index 9ce37507e..1691e6c2f 100644 --- a/dtslint/ts3.5/tslint.json +++ b/dtslint/ts3.5/tslint.json @@ -14,6 +14,13 @@ "object-literal-shorthand": false, "prefer-object-spread": false, "whitespace": false, - "use-default-type-parameter": false + "use-default-type-parameter": false, + "interface-name": false, + "no-promise-as-boolean": false, + "no-eval": false, + "label-position": false, + "function-constructor": false, + "invalid-void": false, + "no-construct": false } } diff --git a/package-lock.json b/package-lock.json index 5441c204f..e9c61cacb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.10", + "version": "2.2.12", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2125,7 +2125,7 @@ } }, "dtslint": { - "version": "github:gcanti/dtslint#de9181e0f1069b16ea15da87f74d88ed9bc221b7", + "version": "github:gcanti/dtslint#249e07696dbd4588287d320a705f0ad39175eeb6", "from": "github:gcanti/dtslint", "dev": true, "requires": { @@ -2133,7 +2133,7 @@ "parsimmon": "^1.12.0", "strip-json-comments": "^2.0.1", "tslint": "^5.12.0", - "typescript": "^4.0.0-dev.20200514" + "typescript": "^4.1.0-dev.20201021" }, "dependencies": { "fs-extra": { @@ -2169,9 +2169,9 @@ } }, "typescript": { - "version": "4.0.0-dev.20200514", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.0-dev.20200514.tgz", - "integrity": "sha512-o++Z0PwCL2iqEwTnoUVfDIAMo9xS+dvxm/6sl6n2VfxGGmVyaC9F6Naaylh+VZ5qG6Actdso0kJnzDxXVwY5fw==", + "version": "4.1.0-dev.20201021", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.0-dev.20201021.tgz", + "integrity": "sha512-AysECaeZgcDxcSDtzFq3hBwJ7cCG7md0gWBZIH19UPDcGtJBaAM6F/NCT4LZ4AV2NeGLQtEAGzE53lMq/i5whw==", "dev": true } } @@ -5646,9 +5646,9 @@ "dev": true }, "parsimmon": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.13.0.tgz", - "integrity": "sha512-5UIrOCW+gjbILkjKPgTgmq8LKf8TT3Iy7kN2VD7OtQ81facKn8B4gG1X94jWqXYZsxG2KbJhrv/Yq/5H6BQn7A==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.16.0.tgz", + "integrity": "sha512-tekGDz2Lny27SQ/5DzJdIK0lqsWwZ667SCLFIDCxaZM7VNgQjyKLbaL7FYPKpbjdxNAXFV/mSxkq5D2fnkW4pA==", "dev": true }, "pascalcase": { @@ -7200,9 +7200,9 @@ } }, "typescript": { - "version": "3.9.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.6.tgz", - "integrity": "sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.3.tgz", + "integrity": "sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==", "dev": true }, "unc-path-regex": { diff --git a/package.json b/package.json index 0cd8f9fc8..89b653ff1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.11", + "version": "2.2.12", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", @@ -59,7 +59,7 @@ "ts-node": "8.8.2", "tslint": "6.1.1", "tslint-config-standard": "9.0.0", - "typescript": "^3.9.6" + "typescript": "^4.0.3" }, "tags": [ "typescript", diff --git a/src/Codec.ts b/src/Codec.ts index abbfbf323..301bcbe5e 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -227,7 +227,7 @@ export function record(codomain: Codec): Codec>>( ...components: C ): Codec<{ [K in keyof C]: InputOf }, { [K in keyof C]: OutputOf }, { [K in keyof C]: TypeOf }> => - make(D.fromTuple(...components) as any, E.tuple(...components)) + make(D.fromTuple(...components) as any, E.tuple(...components)) as any /** * @category combinators diff --git a/src/Decoder.ts b/src/Decoder.ts index a44f78eb9..1b5102282 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -295,7 +295,7 @@ export const record = (codomain: Decoder): Decoder>>( ...components: C ): Decoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.fromTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) + K.fromTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) as any /** * @category combinators @@ -345,7 +345,7 @@ export const fromSum = (tag: T) => (tag: T) => ( - members: { [K in keyof A]: Decoder } + members: { [K in keyof A]: Decoder> } ): Decoder => pipe(UnknownRecord as any, compose(fromSum(tag)(members))) /** diff --git a/src/Eq.ts b/src/Eq.ts index 394a517fd..49a4f2577 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -145,7 +145,9 @@ export const intersect = (right: Eq) => (left: Eq): Eq => ({ * @category combinators * @since 2.2.2 */ -export function sum(tag: T): (members: { [K in keyof A]: Eq }) => Eq { +export function sum( + tag: T +): (members: { [K in keyof A]: Eq> }) => Eq { return (members: Record>) => { return { equals: (x: Record, y: Record) => { diff --git a/src/Guard.ts b/src/Guard.ts index 2d8c7792f..9747db1cb 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -218,7 +218,7 @@ export const union = ]>( * @since 2.2.0 */ export const sum = (tag: T) => ( - members: { [K in keyof A]: Guard } + members: { [K in keyof A]: Guard> } ): Guard => pipe( UnknownRecord, diff --git a/src/Kleisli.ts b/src/Kleisli.ts index b9ad74841..81e890baa 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -287,7 +287,7 @@ export function fromSum( const keys = Object.keys(members) return { decode: (ir) => { - const v = ir[tag] + const v: any = ir[tag] if (v in members) { return (members as any)[v].decode(ir) } diff --git a/src/Schemable.ts b/src/Schemable.ts index f5fc3929f..967aff390 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -31,7 +31,9 @@ export interface Schemable { readonly array: (item: HKT) => HKT> readonly tuple: >(...components: { [K in keyof A]: HKT }) => HKT readonly intersect: (right: HKT) => (left: HKT) => HKT - readonly sum: (tag: T) => (members: { [K in keyof A]: HKT }) => HKT + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: HKT> }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT } @@ -51,7 +53,9 @@ export interface Schemable1 { readonly array: (item: Kind) => Kind> readonly tuple: >(...components: { [K in keyof A]: Kind }) => Kind readonly intersect: (right: Kind) => (left: Kind) => Kind - readonly sum: (tag: T) => (members: { [K in keyof A]: Kind }) => Kind + readonly sum: ( + tag: T + ) => (members: { [K in keyof A]: Kind> }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind } @@ -77,7 +81,7 @@ export interface Schemable2C { readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 readonly sum: ( tag: T - ) => (members: { [K in keyof A]: Kind2 }) => Kind2 + ) => (members: { [K in keyof A]: Kind2> }) => Kind2 readonly lazy: (id: string, f: () => Kind2) => Kind2 } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index d8ef66dcd..33cef914d 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -299,7 +299,7 @@ export const record = (codomain: TaskDecoder): TaskDecoder>>( ...components: C ): TaskDecoder<{ [K in keyof C]: InputOf }, { [K in keyof C]: TypeOf }> => - K.fromTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) + K.fromTuple(M)((i, e) => FS.of(DE.index(i, DE.required, e)))(...components) as any /** * @category combinators @@ -351,7 +351,7 @@ export const fromSum = (tag: T) => (tag: T) => ( - members: { [K in keyof A]: TaskDecoder } + members: { [K in keyof A]: TaskDecoder> } ): TaskDecoder => pipe(UnknownRecord as any, compose(fromSum(tag)(members))) /** diff --git a/src/Type.ts b/src/Type.ts index ca08b5ec9..744cf72a1 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -144,8 +144,9 @@ export const lazy = (id: string, f: () => Type): Type => t.recursion(id * @category combinators * @since 2.2.3 */ -export const sum = (_tag: T) => (members: { [K in keyof A]: Type }): Type => - t.union(Object.values(members) as any) +export const sum = (_tag: T) => ( + members: { [K in keyof A]: Type> } +): Type => t.union(Object.values(members) as any) /** * @category combinators diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index c195d0232..ab3002299 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -84,7 +84,7 @@ export const intersect = (right: Arbitrary) => (left: Arbitrary): Ar export function sum( _tag: T -): (members: { [K in keyof A]: Arbitrary }) => Arbitrary { +): (members: { [K in keyof A]: Arbitrary> }) => Arbitrary { return (members: Record>) => fc.oneof(...Object.keys(members).map((k) => members[k])) } diff --git a/test/Decoder.ts b/test/Decoder.ts index c23f6dbe0..55b34e650 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -262,19 +262,6 @@ describe('Decoder', () => { ) ) }) - - it('should support getters', async () => { - class A { - get a() { - return 'a' - } - get b() { - return 'b' - } - } - const decoder = _.partial({ a: _.string, b: _.string }) - assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) - }) }) describe('array', () => { @@ -483,6 +470,19 @@ describe('Decoder', () => { E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf(undefined, 'never'))))) ) }) + + it('should support non-`string` tag values', () => { + const decoder = _.sum('_tag')({ + [1]: _.type({ _tag: _.literal(1), a: _.string }), + [2]: _.type({ _tag: _.literal(2), b: _.number }) + }) + assert.deepStrictEqual(decoder.decode({ _tag: 1, a: 'a' }), E.right({ _tag: 1, a: 'a' })) + assert.deepStrictEqual(decoder.decode({ _tag: 2, b: 1 }), E.right({ _tag: 2, b: 1 })) + assert.deepStrictEqual( + decoder.decode({ _tag: 2, b: 'a' }), + E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf('a', 'number'))))) + ) + }) }) interface A { diff --git a/test/Guard.ts b/test/Guard.ts index 5034563be..0ae0887bd 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -273,12 +273,12 @@ describe('Guard', () => { it('should support non-`string` tag values', () => { const guard = G.sum('_tag')({ - true: G.type({ _tag: G.literal(true), a: G.string }), - false: G.type({ _tag: G.literal(false), b: G.number }) + [1]: G.type({ _tag: G.literal(1), a: G.string }), + [2]: G.type({ _tag: G.literal(2), b: G.number }) }) - assert.deepStrictEqual(guard.is({ _tag: true, a: 'a' }), true) - assert.deepStrictEqual(guard.is({ _tag: false, b: 1 }), true) - assert.deepStrictEqual(guard.is({ _tag: false, b: 'a' }), false) + assert.deepStrictEqual(guard.is({ _tag: 1, a: 'a' }), true) + assert.deepStrictEqual(guard.is({ _tag: 2, b: 1 }), true) + assert.deepStrictEqual(guard.is({ _tag: 2, b: 'a' }), false) }) }) }) From 5847e817a51c2e81a42ec45646118ca09793036e Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 4 Nov 2020 10:59:32 +0100 Subject: [PATCH 172/222] Docs: Extracting static types from encoders --- Encoder.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Encoder.md b/Encoder.md index c5accd529..66690e3e0 100644 --- a/Encoder.md +++ b/Encoder.md @@ -2,6 +2,7 @@ - [Encoder interface](#encoder-interface) +- [Extracting static types from encoders](#extracting-static-types-from-encoders) @@ -26,3 +27,18 @@ export function nullable(or: E.Encoder): E.Encoder = { + encode: String +} + +type MyOutputType = E.OutputOf +/* +type MyOutputType = string +*/ +``` From 1de671bc453aab546b71202d89faa89a00d7f8f7 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 4 Nov 2020 11:13:21 +0100 Subject: [PATCH 173/222] Docs: InputOf operator example --- Decoder.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Decoder.md b/Decoder.md index 96e0d4991..c4ef3acb5 100644 --- a/Decoder.md +++ b/Decoder.md @@ -349,7 +349,7 @@ console.log(isRight(NumberFromString.decode('a'))) // => false # Extracting static types from decoders -Static types can be extracted from decoders using the `TypeOf` operator +Static types can be extracted from decoders using the `TypeOf` and `InputOf` operators ```ts export const Person = D.type({ @@ -364,6 +364,11 @@ type Person = { age: number; } */ + +type PersonInputType = D.InputOf +/* +type PersonInputType = unknown +*/ ``` Note that you can define an `interface` instead of a type alias From 2881d940b34fa7803e586262520b0c0795329287 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 20 Nov 2020 16:20:36 +0100 Subject: [PATCH 174/222] improve internal `mergeAll` function, closes #532 --- CHANGELOG.md | 5 +++++ package.json | 2 +- src/index.ts | 8 ++++++-- test/2.1.x/intersection.ts | 7 +++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7990f6787..6c04639e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.13 + +- **Bug Fix** + - improve internal `mergeAll` function, closes #532 (@gcanti) + # 2.2.12 - **Experimental** diff --git a/package.json b/package.json index 89b653ff1..22fbf4851 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.12", + "version": "2.2.13", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", diff --git a/src/index.ts b/src/index.ts index 10903a67e..c2204bfbd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1416,9 +1416,13 @@ export interface IntersectionC]> unknown > {} -const mergeAll = (base: any, us: Array): any => { +/** + * @internal + */ +export const mergeAll = (base: any, us: Array): any => { let equal = true let primitive = true + const baseIsNotADictionary = !UnknownRecord.is(base) for (const u of us) { if (u !== base) { equal = false @@ -1435,7 +1439,7 @@ const mergeAll = (base: any, us: Array): any => { let r: any = {} for (const u of us) { for (const k in u) { - if (u[k] !== base[k] || !r.hasOwnProperty(k)) { + if (!r.hasOwnProperty(k) || baseIsNotADictionary || u[k] !== base[k]) { r[k] = u[k] } } diff --git a/test/2.1.x/intersection.ts b/test/2.1.x/intersection.ts index 5a0e2b2b8..cd2515091 100644 --- a/test/2.1.x/intersection.ts +++ b/test/2.1.x/intersection.ts @@ -3,6 +3,13 @@ import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' describe('intersection', () => { + it('mergeAll', () => { + assert.deepStrictEqual(t.mergeAll(undefined, [{ prop1: 'b', prop2: 2 }, { prop1: 'a' }, { prop2: 1 }]), { + prop1: 'a', + prop2: 1 + }) + }) + describe('name', () => { it('should assign a default name', () => { const T = t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) From 6ec25a9a0a65affa0559aabdfc5da984787300f4 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Tue, 24 Nov 2020 09:38:07 +0100 Subject: [PATCH 175/222] add GitHub action --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..33e15836c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,29 @@ +name: Node.js CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run build --if-present + - run: npm test From c2f80401bb2b5f6d71dcde049fc4864ab01bb4f0 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 24 Nov 2020 09:39:03 +0100 Subject: [PATCH 176/222] remove travis --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index afb9d6d99..000000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - '12' From 5079181eb0e460d4e84666b0ac51524661b6cd65 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 13 Dec 2020 10:18:06 +0100 Subject: [PATCH 177/222] upgrade typescript and dtslint versions --- package-lock.json | 18 +++++++++--------- package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index e9c61cacb..18ad5e200 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.12", + "version": "2.2.13", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2125,7 +2125,7 @@ } }, "dtslint": { - "version": "github:gcanti/dtslint#249e07696dbd4588287d320a705f0ad39175eeb6", + "version": "github:gcanti/dtslint#ef28f0ad1d3bd64b8367f6f543cf6fd3b9b09c1b", "from": "github:gcanti/dtslint", "dev": true, "requires": { @@ -2133,7 +2133,7 @@ "parsimmon": "^1.12.0", "strip-json-comments": "^2.0.1", "tslint": "^5.12.0", - "typescript": "^4.1.0-dev.20201021" + "typescript": "^4.2.0-dev.20201211" }, "dependencies": { "fs-extra": { @@ -2169,9 +2169,9 @@ } }, "typescript": { - "version": "4.1.0-dev.20201021", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.0-dev.20201021.tgz", - "integrity": "sha512-AysECaeZgcDxcSDtzFq3hBwJ7cCG7md0gWBZIH19UPDcGtJBaAM6F/NCT4LZ4AV2NeGLQtEAGzE53lMq/i5whw==", + "version": "4.2.0-dev.20201211", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.0-dev.20201211.tgz", + "integrity": "sha512-k+ENtRQ+u9ZWF7URgAAHYTPSVu8imLa7a08XmZG+swJZTeOZJMrzFfklK/Wn5765RFG6kh2nnvcQaO9AtR/DGg==", "dev": true } } @@ -7200,9 +7200,9 @@ } }, "typescript": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.3.tgz", - "integrity": "sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", + "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", "dev": true }, "unc-path-regex": { diff --git a/package.json b/package.json index 22fbf4851..15c9a10b2 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "ts-node": "8.8.2", "tslint": "6.1.1", "tslint-config-standard": "9.0.0", - "typescript": "^4.0.3" + "typescript": "^4.1.3" }, "tags": [ "typescript", From f13a10ae9d405f3fb8564cf3b7917d31aa7c0e27 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 13 Dec 2020 10:28:24 +0100 Subject: [PATCH 178/222] fix tests --- test/2.1.x/default-types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/2.1.x/default-types.ts b/test/2.1.x/default-types.ts index c9f34c6f4..251205329 100644 --- a/test/2.1.x/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -250,7 +250,7 @@ describe('never', () => { assertFailure(T, 'foo', ['Invalid value "foo" supplied to : never']) assertFailure(T, 1, ['Invalid value 1 supplied to : never']) assertFailure(T, true, ['Invalid value true supplied to : never']) - assertFailure(T, t.identity, ['Invalid value supplied to : never']) + assertFailure(T, t.identity, ['Invalid value identity supplied to : never']) assertFailure(T, {}, ['Invalid value {} supplied to : never']) assertFailure(T, [], ['Invalid value [] supplied to : never']) assertFailure(T, /a/, ['Invalid value {} supplied to : never']) From d453902b69b8bd54c8ff178b9c69a8e6bf9938cd Mon Sep 17 00:00:00 2001 From: Irakli Safareli Date: Thu, 21 Jan 2021 19:51:01 +0400 Subject: [PATCH 179/222] Remove non null assertion in Decoder.toForest --- src/Decoder.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Decoder.ts b/src/Decoder.ts index 1b5102282..ae17bea83 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -557,10 +557,11 @@ const toForest = (e: DecodeError): ReadonlyArray> => { switch (focus._tag) { case 'Of': res.push(toTree(focus.value)) - if (stack.length === 0) { + const tmp = stack.pop() + if (tmp === undefined) { return res } else { - focus = stack.pop()! + focus = tmp } break case 'Concat': From 638d7c199ff5e094b85e8a24fac636bbdc6408df Mon Sep 17 00:00:00 2001 From: Eric Crosson Date: Wed, 27 Jan 2021 08:07:47 -0600 Subject: [PATCH 180/222] doc: exclude zero from set of positive integers --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 314c847b6..0efe4c4d1 100644 --- a/index.md +++ b/index.md @@ -355,7 +355,7 @@ interface PositiveBrand { const Positive = t.brand( t.number, // a codec representing the type to be refined - (n): n is t.Branded => n >= 0, // a custom type guard using the build-in helper `Branded` + (n): n is t.Branded => 0 < n, // a custom type guard using the build-in helper `Branded` 'Positive' // the name must match the readonly field in the brand ) From 896eb9b3de71b29ee5deff2e55ec6e9fe43896ca Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 28 Jan 2021 08:12:58 +0100 Subject: [PATCH 181/222] refactor docs --- .eslintrc.json | 22 + docs/modules/index.ts.md | 2070 +++++++++++++++++++------------------- package-lock.json | 803 ++++++++++++++- package.json | 4 + src/Decoder.ts | 2 +- src/Schemable.ts | 2 +- src/index.ts | 1678 +++++++++++++++--------------- tsconfig.json | 2 +- 8 files changed, 2753 insertions(+), 1830 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..b5307935d --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,22 @@ +{ + "parserOptions": { + "project": "./tsconfig.json" + }, + "plugins": [], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@typescript-eslint/member-delimiter-style": 0, + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-empty-interface": "off", + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], + "prefer-rest-params": "off", + "prefer-spread": "off" + } +} diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 0ff850a35..5bbdab537 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -12,30 +12,16 @@ Added in v1.0.0

Table of contents

-- [Combinators](#combinators) - - [array](#array) - - [brand](#brand) - - [intersection](#intersection) - - [keyof](#keyof) - - [literal](#literal) - - [partial](#partial) - - [readonly](#readonly) - - [readonlyArray](#readonlyarray) - - [record](#record) - - [recursion](#recursion) - - [strict](#strict) - - [tuple](#tuple) - - [type](#type) - - [union](#union) -- [Model](#model) - - [Context (interface)](#context-interface) - - [ContextEntry (interface)](#contextentry-interface) +- [Codec](#codec) + - [Any (interface)](#any-interface) - [Decode (type alias)](#decode-type-alias) - [Decoder (interface)](#decoder-interface) - [Encode (type alias)](#encode-type-alias) - [Encoder (interface)](#encoder-interface) - - [Errors (interface)](#errors-interface) + - [InputOf (type alias)](#inputof-type-alias) - [Is (type alias)](#is-type-alias) + - [Mixed (interface)](#mixed-interface) + - [OutputOf (type alias)](#outputof-type-alias) - [Type (class)](#type-class) - [pipe (method)](#pipe-method) - [asDecoder (method)](#asdecoder-method) @@ -44,44 +30,102 @@ Added in v1.0.0 - [\_A (property)](#_a-property) - [\_O (property)](#_o-property) - [\_I (property)](#_i-property) + - [TypeOf (type alias)](#typeof-type-alias) - [Validate (type alias)](#validate-type-alias) +- [Decode error](#decode-error) + - [Context (interface)](#context-interface) + - [ContextEntry (interface)](#contextentry-interface) + - [Errors (interface)](#errors-interface) - [Validation (type alias)](#validation-type-alias) - [ValidationError (interface)](#validationerror-interface) -- [Primitives](#primitives) - - [Int](#int) - - [UnknownArray](#unknownarray) - - [UnknownRecord](#unknownrecord) - - [bigint](#bigint) - - [boolean](#boolean) - - [nullType](#nulltype) - - [number](#number) - - [string](#string) - - [unknown](#unknown) - - [voidType](#voidtype) + - [failure](#failure) + - [failures](#failures) + - [success](#success) +- [combinators](#combinators) + - [ArrayC (interface)](#arrayc-interface) + - [ArrayType (class)](#arraytype-class) + - [\_tag (property)](#_tag-property) + - [Brand (interface)](#brand-interface) + - [BrandC (interface)](#brandc-interface) + - [Branded (type alias)](#branded-type-alias) + - [DictionaryType (class)](#dictionarytype-class) + - [\_tag (property)](#_tag-property-1) + - [ExactC (interface)](#exactc-interface) + - [ExactType (class)](#exacttype-class) + - [\_tag (property)](#_tag-property-2) + - [InterfaceType (class)](#interfacetype-class) + - [\_tag (property)](#_tag-property-3) + - [IntersectionC (interface)](#intersectionc-interface) + - [IntersectionType (class)](#intersectiontype-class) + - [\_tag (property)](#_tag-property-4) + - [PartialC (interface)](#partialc-interface) + - [PartialType (class)](#partialtype-class) + - [\_tag (property)](#_tag-property-5) + - [ReadonlyArrayC (interface)](#readonlyarrayc-interface) + - [ReadonlyArrayType (class)](#readonlyarraytype-class) + - [\_tag (property)](#_tag-property-6) + - [ReadonlyC (interface)](#readonlyc-interface) + - [ReadonlyType (class)](#readonlytype-class) + - [\_tag (property)](#_tag-property-7) + - [RecordC (interface)](#recordc-interface) + - [RecursiveType (class)](#recursivetype-class) + - [\_tag (property)](#_tag-property-8) + - [type (property)](#type-property) + - [RefinementType (class)](#refinementtype-class) + - [\_tag (property)](#_tag-property-9) + - [TupleC (interface)](#tuplec-interface) + - [TupleType (class)](#tupletype-class) + - [\_tag (property)](#_tag-property-10) + - [TypeC (interface)](#typec-interface) + - [UnionC (interface)](#unionc-interface) + - [UnionType (class)](#uniontype-class) + - [\_tag (property)](#_tag-property-11) + - [array](#array) + - [brand](#brand) + - [exact](#exact) + - [intersection](#intersection) + - [partial](#partial) + - [readonly](#readonly) + - [readonlyArray](#readonlyarray) + - [record](#record) + - [recursion](#recursion) + - [strict](#strict) + - [tuple](#tuple) + - [type](#type) + - [union](#union) +- [constructors](#constructors) + - [KeyofC (interface)](#keyofc-interface) + - [KeyofType (class)](#keyoftype-class) + - [\_tag (property)](#_tag-property-12) + - [LiteralC (interface)](#literalc-interface) + - [LiteralType (class)](#literaltype-class) + - [\_tag (property)](#_tag-property-13) + - [keyof](#keyof) + - [literal](#literal) - [deprecated](#deprecated) - [~~AnyC~~ (interface)](#anyc-interface) - [~~AnyType~~ (class)](#anytype-class) - - [\_tag (property)](#_tag-property) + - [\_tag (property)](#_tag-property-14) - [~~Array~~](#array) - [~~Compact~~ (type alias)](#compact-type-alias) - [~~Dictionary~~](#dictionary) - [~~Exact~~ (type alias)](#exact-type-alias) - [~~FunctionC~~ (interface)](#functionc-interface) - [~~FunctionType~~ (class)](#functiontype-class) - - [\_tag (property)](#_tag-property-1) + - [\_tag (property)](#_tag-property-15) - [~~Function~~](#function) - [~~Integer~~](#integer) - [~~NeverC~~ (interface)](#neverc-interface) - [~~NeverType~~ (class)](#nevertype-class) - - [\_tag (property)](#_tag-property-2) + - [\_tag (property)](#_tag-property-16) - [~~ObjectC~~ (interface)](#objectc-interface) - [~~ObjectType~~ (class)](#objecttype-class) - - [\_tag (property)](#_tag-property-3) + - [\_tag (property)](#_tag-property-17) - [~~PropsOf~~ (type alias)](#propsof-type-alias) - [~~RefinementC~~ (interface)](#refinementc-interface) - [~~StrictC~~ (interface)](#strictc-interface) - [~~StrictType~~ (class)](#stricttype-class) - - [\_tag (property)](#_tag-property-4) + - [\_tag (property)](#_tag-property-18) - [~~TaggedExact~~ (interface)](#taggedexact-interface) - [~~TaggedIntersectionArgument~~ (type alias)](#taggedintersectionargument-type-alias) - [~~TaggedIntersection~~ (interface)](#taggedintersection-interface) @@ -103,364 +147,309 @@ Added in v1.0.0 - [~~object~~](#object) - [~~refinement~~](#refinement) - [~~taggedUnion~~](#taggedunion) -- [utils](#utils) - - [Any (interface)](#any-interface) +- [primitives](#primitives) - [AnyArrayType (class)](#anyarraytype-class) - - [\_tag (property)](#_tag-property-5) + - [\_tag (property)](#_tag-property-19) - [AnyDictionaryType (class)](#anydictionarytype-class) - - [\_tag (property)](#_tag-property-6) - - [AnyProps (interface)](#anyprops-interface) - - [ArrayC (interface)](#arrayc-interface) - - [ArrayType (class)](#arraytype-class) - - [\_tag (property)](#_tag-property-7) + - [\_tag (property)](#_tag-property-20) - [BigIntC (interface)](#bigintc-interface) - [BigIntType (class)](#biginttype-class) - - [\_tag (property)](#_tag-property-8) + - [\_tag (property)](#_tag-property-21) - [BooleanC (interface)](#booleanc-interface) - [BooleanType (class)](#booleantype-class) - - [\_tag (property)](#_tag-property-9) - - [Brand (interface)](#brand-interface) - - [BrandC (interface)](#brandc-interface) - - [Branded (type alias)](#branded-type-alias) - - [DictionaryType (class)](#dictionarytype-class) - - [\_tag (property)](#_tag-property-10) - - [ExactC (interface)](#exactc-interface) - - [ExactType (class)](#exacttype-class) - - [\_tag (property)](#_tag-property-11) - - [HasProps (type alias)](#hasprops-type-alias) - - [HasPropsIntersection (interface)](#haspropsintersection-interface) - - [HasPropsReadonly (interface)](#haspropsreadonly-interface) - - [HasPropsRefinement (interface)](#haspropsrefinement-interface) - - [InputOf (type alias)](#inputof-type-alias) + - [\_tag (property)](#_tag-property-22) + - [Int](#int) - [Int (type alias)](#int-type-alias) - [IntBrand (interface)](#intbrand-interface) - - [InterfaceType (class)](#interfacetype-class) - - [\_tag (property)](#_tag-property-12) - - [IntersectionC (interface)](#intersectionc-interface) - - [IntersectionType (class)](#intersectiontype-class) - - [\_tag (property)](#_tag-property-13) - - [KeyofC (interface)](#keyofc-interface) - - [KeyofType (class)](#keyoftype-class) - - [\_tag (property)](#_tag-property-14) - - [LiteralC (interface)](#literalc-interface) - - [LiteralType (class)](#literaltype-class) - - [\_tag (property)](#_tag-property-15) - - [Mixed (interface)](#mixed-interface) - [NullC (interface)](#nullc-interface) - [NullType (class)](#nulltype-class) - - [\_tag (property)](#_tag-property-16) + - [\_tag (property)](#_tag-property-23) - [NumberC (interface)](#numberc-interface) - [NumberType (class)](#numbertype-class) - - [\_tag (property)](#_tag-property-17) - - [OutputOf (type alias)](#outputof-type-alias) - - [OutputOfDictionary (type alias)](#outputofdictionary-type-alias) - - [OutputOfPartialProps (type alias)](#outputofpartialprops-type-alias) - - [OutputOfProps (type alias)](#outputofprops-type-alias) - - [PartialC (interface)](#partialc-interface) - - [PartialType (class)](#partialtype-class) - - [\_tag (property)](#_tag-property-18) - - [Props (interface)](#props-interface) - - [ReadonlyArrayC (interface)](#readonlyarrayc-interface) - - [ReadonlyArrayType (class)](#readonlyarraytype-class) - - [\_tag (property)](#_tag-property-19) - - [ReadonlyC (interface)](#readonlyc-interface) - - [ReadonlyType (class)](#readonlytype-class) - - [\_tag (property)](#_tag-property-20) - - [RecordC (interface)](#recordc-interface) - - [RecursiveType (class)](#recursivetype-class) - - [\_tag (property)](#_tag-property-21) - - [type (property)](#type-property) - - [RefinementType (class)](#refinementtype-class) - - [\_tag (property)](#_tag-property-22) + - [\_tag (property)](#_tag-property-24) - [StringC (interface)](#stringc-interface) - [StringType (class)](#stringtype-class) - - [\_tag (property)](#_tag-property-23) - - [TupleC (interface)](#tuplec-interface) - - [TupleType (class)](#tupletype-class) - - [\_tag (property)](#_tag-property-24) - - [TypeC (interface)](#typec-interface) - - [TypeOf (type alias)](#typeof-type-alias) - - [TypeOfDictionary (type alias)](#typeofdictionary-type-alias) - - [TypeOfPartialProps (type alias)](#typeofpartialprops-type-alias) - - [TypeOfProps (type alias)](#typeofprops-type-alias) + - [\_tag (property)](#_tag-property-25) - [UndefinedC (interface)](#undefinedc-interface) - [UndefinedType (class)](#undefinedtype-class) - - [\_tag (property)](#_tag-property-25) - - [UnionC (interface)](#unionc-interface) - - [UnionType (class)](#uniontype-class) - [\_tag (property)](#_tag-property-26) + - [UnknownArray](#unknownarray) - [UnknownArrayC (interface)](#unknownarrayc-interface) - [UnknownC (interface)](#unknownc-interface) + - [UnknownRecord](#unknownrecord) - [UnknownRecordC (interface)](#unknownrecordc-interface) - [UnknownType (class)](#unknowntype-class) - [\_tag (property)](#_tag-property-27) - [VoidC (interface)](#voidc-interface) - [VoidType (class)](#voidtype-class) - [\_tag (property)](#_tag-property-28) + - [bigint](#bigint) + - [boolean](#boolean) + - [null](#null) + - [nullType](#nulltype) + - [number](#number) + - [string](#string) + - [undefined](#undefined) + - [unknown](#unknown) + - [void](#void) + - [voidType](#voidtype) +- [utils](#utils) + - [AnyProps (interface)](#anyprops-interface) + - [HasProps (type alias)](#hasprops-type-alias) + - [HasPropsIntersection (interface)](#haspropsintersection-interface) + - [HasPropsReadonly (interface)](#haspropsreadonly-interface) + - [HasPropsRefinement (interface)](#haspropsrefinement-interface) + - [OutputOfDictionary (type alias)](#outputofdictionary-type-alias) + - [OutputOfPartialProps (type alias)](#outputofpartialprops-type-alias) + - [OutputOfProps (type alias)](#outputofprops-type-alias) + - [Props (interface)](#props-interface) + - [TypeOfDictionary (type alias)](#typeofdictionary-type-alias) + - [TypeOfPartialProps (type alias)](#typeofpartialprops-type-alias) + - [TypeOfProps (type alias)](#typeofprops-type-alias) - [appendContext](#appendcontext) - - [exact](#exact) - - [failure](#failure) - - [failures](#failures) - [getContextEntry](#getcontextentry) - [getFunctionName](#getfunctionname) - [identity](#identity) - - [null](#null) - - [success](#success) - - [undefined](#undefined) - - [void](#void) --- -# Combinators +# Codec -## array +## Any (interface) **Signature** ```ts -export declare const array: (item: C, name?: string) => ArrayC +export interface Any extends Type {} ``` Added in v1.0.0 -## brand +## Decode (type alias) **Signature** ```ts -export declare const brand: ( - codec: C, - predicate: Refinement>, - name: N -) => BrandC +export type Decode = (i: I) => Validation ``` -Added in v1.8.1 +Added in v1.0.0 -## intersection +## Decoder (interface) **Signature** ```ts -export declare function intersection< - A extends Mixed, - B extends Mixed, - C extends Mixed, - D extends Mixed, - E extends Mixed ->(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> -export declare function intersection( - codecs: [A, B, C, D], - name?: string -): IntersectionC<[A, B, C, D]> -export declare function intersection( - codecs: [A, B, C], - name?: string -): IntersectionC<[A, B, C]> -export declare function intersection( - codecs: [A, B], - name?: string -): IntersectionC<[A, B]> +export interface Decoder { + readonly name: string + readonly validate: Validate + readonly decode: Decode +} ``` Added in v1.0.0 -## keyof +## Encode (type alias) **Signature** ```ts -export declare const keyof: (keys: D, name?: string) => KeyofC +export type Encode = (a: A) => O ``` Added in v1.0.0 -## literal +## Encoder (interface) **Signature** ```ts -export declare const literal: (value: V, name?: string) => LiteralC +export interface Encoder { + readonly encode: Encode +} ``` Added in v1.0.0 -## partial +## InputOf (type alias) **Signature** ```ts -export declare const partial:

(props: P, name?: string) => PartialC

+export type InputOf = C['_I'] ``` Added in v1.0.0 -## readonly +## Is (type alias) **Signature** ```ts -export declare const readonly: (codec: C, name?: string) => ReadonlyC +export type Is = (u: unknown) => u is A ``` Added in v1.0.0 -## readonlyArray +## Mixed (interface) **Signature** ```ts -export declare const readonlyArray: (item: C, name?: string) => ReadonlyArrayC +export interface Mixed extends Type {} ``` Added in v1.0.0 -## record +## OutputOf (type alias) **Signature** ```ts -export declare function record(domain: D, codomain: C, name?: string): RecordC +export type OutputOf = C['_O'] ``` -Added in v1.7.1 +Added in v1.0.0 -## recursion +## Type (class) **Signature** ```ts -export declare const recursion: = Type>( - name: string, - definition: (self: C) => C -) => RecursiveType +export declare class Type { + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: Is, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: Validate, + /** converts a value of type A to a value of type O */ + readonly encode: Encode + ) +} ``` Added in v1.0.0 -## strict - -Strips additional properties +### pipe (method) **Signature** ```ts -export declare const strict:

(props: P, name?: string) => ExactC> +pipe( + this: Type, + ab: Type, + name: string = `pipe(${this.name}, ${ab.name})` + ): Type ``` Added in v1.0.0 -## tuple +### asDecoder (method) **Signature** ```ts -export declare function tuple( - codecs: [A, B, C, D, E], - name?: string -): TupleC<[A, B, C, D, E]> -export declare function tuple( - codecs: [A, B, C, D], - name?: string -): TupleC<[A, B, C, D]> -export declare function tuple( - codecs: [A, B, C], - name?: string -): TupleC<[A, B, C]> -export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> -export declare function tuple(codecs: [A], name?: string): TupleC<[A]> +asDecoder(): Decoder ``` Added in v1.0.0 -## type +### asEncoder (method) **Signature** ```ts -export declare const type:

(props: P, name?: string) => TypeC

+asEncoder(): Encoder ``` Added in v1.0.0 -## union +### decode (method) + +a version of `validate` with a default context **Signature** ```ts -export declare const union: (codecs: CS, name?: string) => UnionC +decode(i: I): Validation ``` Added in v1.0.0 -# Model +### \_A (property) -## Context (interface) +**Signature** + +```ts +readonly _A: A +``` + +Added in v1.0.0 + +### \_O (property) **Signature** ```ts -export interface Context extends ReadonlyArray {} +readonly _O: O ``` Added in v1.0.0 -## ContextEntry (interface) +### \_I (property) **Signature** ```ts -export interface ContextEntry { - readonly key: string - readonly type: Decoder - /** the input data */ - readonly actual?: unknown -} +readonly _I: I ``` Added in v1.0.0 -## Decode (type alias) +## TypeOf (type alias) **Signature** ```ts -export type Decode = (i: I) => Validation +export type TypeOf = C['_A'] ``` Added in v1.0.0 -## Decoder (interface) +## Validate (type alias) **Signature** ```ts -export interface Decoder { - readonly name: string - readonly validate: Validate - readonly decode: Decode -} +export type Validate = (i: I, context: Context) => Validation ``` Added in v1.0.0 -## Encode (type alias) +# Decode error + +## Context (interface) **Signature** ```ts -export type Encode = (a: A) => O +export interface Context extends ReadonlyArray {} ``` Added in v1.0.0 -## Encoder (interface) +## ContextEntry (interface) **Signature** ```ts -export interface Encoder { - readonly encode: Encode +export interface ContextEntry { + readonly key: string + readonly type: Decoder + /** the input data */ + readonly actual?: unknown } ``` @@ -476,273 +465,314 @@ export interface Errors extends Array {} Added in v1.0.0 -## Is (type alias) +## Validation (type alias) **Signature** ```ts -export type Is = (u: unknown) => u is A +export type Validation = Either ``` Added in v1.0.0 -## Type (class) +## ValidationError (interface) **Signature** ```ts -export declare class Type { - constructor( - /** a unique name for this codec */ - readonly name: string, - /** a custom type guard */ - readonly is: Is, - /** succeeds if a value of type I can be decoded to a value of type A */ - readonly validate: Validate, - /** converts a value of type A to a value of type O */ - readonly encode: Encode - ) +export interface ValidationError { + /** the offending (sub)value */ + readonly value: unknown + /** where the error originated */ + readonly context: Context + /** optional custom error message */ + readonly message?: string } ``` Added in v1.0.0 -### pipe (method) +## failure **Signature** ```ts -pipe( - this: Type, - ab: Type, - name: string = `pipe(${this.name}, ${ab.name})` - ): Type +export declare const failure: (value: unknown, context: Context, message?: string) => Either ``` Added in v1.0.0 -### asDecoder (method) +## failures **Signature** ```ts -asDecoder(): Decoder +export declare const failures: (errors: Errors) => Either ``` Added in v1.0.0 -### asEncoder (method) +## success **Signature** ```ts -asEncoder(): Encoder +export declare const success: (value: T) => Either ``` Added in v1.0.0 -### decode (method) +# combinators -a version of `validate` with a default context +## ArrayC (interface) **Signature** ```ts -decode(i: I): Validation +export interface ArrayC extends ArrayType>, Array>, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -### \_A (property) +## ArrayType (class) **Signature** ```ts -readonly _A: A +export declare class ArrayType { + constructor( + name: string, + is: ArrayType['is'], + validate: ArrayType['validate'], + encode: ArrayType['encode'], + readonly type: C + ) +} ``` Added in v1.0.0 -### \_O (property) +### \_tag (property) **Signature** ```ts -readonly _O: O +readonly _tag: "ArrayType" ``` Added in v1.0.0 -### \_I (property) +## Brand (interface) **Signature** ```ts -readonly _I: I +export interface Brand { + readonly [_brand]: B +} ``` -Added in v1.0.0 +Added in v1.8.1 -## Validate (type alias) +## BrandC (interface) **Signature** ```ts -export type Validate = (i: I, context: Context) => Validation +export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.8.1 -## Validation (type alias) +## Branded (type alias) **Signature** ```ts -export type Validation = Either +export type Branded = A & Brand ``` -Added in v1.0.0 +Added in v1.8.1 -## ValidationError (interface) +## DictionaryType (class) **Signature** ```ts -export interface ValidationError { - /** the offending (sub)value */ - readonly value: unknown - /** where the error originated */ - readonly context: Context - /** optional custom error message */ - readonly message?: string +export declare class DictionaryType { + constructor( + name: string, + is: DictionaryType['is'], + validate: DictionaryType['validate'], + encode: DictionaryType['encode'], + readonly domain: D, + readonly codomain: C + ) } ``` Added in v1.0.0 -# Primitives - -## Int - -A branded codec representing an integer +### \_tag (property) **Signature** ```ts -export declare const Int: BrandC +readonly _tag: "DictionaryType" ``` -Added in v1.8.1 +Added in v1.0.0 -## UnknownArray +## ExactC (interface) **Signature** ```ts -export declare const UnknownArray: UnknownArrayC +export interface ExactC extends ExactType, OutputOf, InputOf> {} ``` -Added in v1.7.1 +Added in v1.5.3 -## UnknownRecord +## ExactType (class) **Signature** ```ts -export declare const UnknownRecord: UnknownRecordC +export declare class ExactType { + constructor( + name: string, + is: ExactType['is'], + validate: ExactType['validate'], + encode: ExactType['encode'], + readonly type: C + ) +} ``` -Added in v1.7.1 +Added in v1.1.0 -## bigint +### \_tag (property) **Signature** ```ts -export declare const bigint: BigIntC +readonly _tag: "ExactType" ``` -Added in v2.1.0 +Added in v1.0.0 -## boolean +## InterfaceType (class) **Signature** ```ts -export declare const boolean: BooleanC +export declare class InterfaceType { + constructor( + name: string, + is: InterfaceType['is'], + validate: InterfaceType['validate'], + encode: InterfaceType['encode'], + readonly props: P + ) +} ``` Added in v1.0.0 -## nullType +### \_tag (property) **Signature** ```ts -export declare const nullType: NullC +readonly _tag: "InterfaceType" ``` Added in v1.0.0 -## number +## IntersectionC (interface) **Signature** ```ts -export declare const number: NumberC +export interface IntersectionC]> + extends IntersectionType< + CS, + CS extends { length: 2 } + ? TypeOf & TypeOf + : CS extends { length: 3 } + ? TypeOf & TypeOf & TypeOf + : CS extends { length: 4 } + ? TypeOf & TypeOf & TypeOf & TypeOf + : CS extends { length: 5 } + ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf + : unknown, + CS extends { length: 2 } + ? OutputOf & OutputOf + : CS extends { length: 3 } + ? OutputOf & OutputOf & OutputOf + : CS extends { length: 4 } + ? OutputOf & OutputOf & OutputOf & OutputOf + : CS extends { length: 5 } + ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf + : unknown, + unknown + > {} ``` -Added in v1.0.0 +Added in v1.5.3 -## string +## IntersectionType (class) **Signature** ```ts -export declare const string: StringC +export declare class IntersectionType { + constructor( + name: string, + is: IntersectionType['is'], + validate: IntersectionType['validate'], + encode: IntersectionType['encode'], + readonly types: CS + ) +} ``` Added in v1.0.0 -## unknown - -**Signature** - -```ts -export declare const unknown: UnknownC -``` - -Added in v1.5.0 - -## voidType +### \_tag (property) **Signature** ```ts -export declare const voidType: VoidC +readonly _tag: "IntersectionType" ``` -Added in v1.2.0 - -# deprecated +Added in v1.0.0 -## ~~AnyC~~ (interface) +## PartialC (interface) **Signature** ```ts -export interface AnyC extends AnyType {} +export interface PartialC

+ extends PartialType }, { [K in keyof P]?: OutputOf }, unknown> {} ``` Added in v1.5.3 -## ~~AnyType~~ (class) +## PartialType (class) **Signature** ```ts -export declare class AnyType { - constructor() +export declare class PartialType { + constructor( + name: string, + is: PartialType['is'], + validate: PartialType['validate'], + encode: PartialType['encode'], + readonly props: P + ) } ``` @@ -753,75 +783,74 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "AnyType" -``` - -Added in v1.0.0 - -## ~~Array~~ - -Use `UnknownArray` instead - -**Signature** - -```ts -export declare const Array: UnknownArrayC +readonly _tag: "PartialType" ``` Added in v1.0.0 -## ~~Compact~~ (type alias) - -used in `intersection` as a workaround for #234 +## ReadonlyArrayC (interface) **Signature** ```ts -export type Compact = { [K in keyof A]: A[K] } +export interface ReadonlyArrayC + extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} ``` -Added in v1.4.2 - -## ~~Dictionary~~ +Added in v1.5.3 -Use `UnknownRecord` instead +## ReadonlyArrayType (class) **Signature** ```ts -export declare const Dictionary: UnknownRecordC +export declare class ReadonlyArrayType { + constructor( + name: string, + is: ReadonlyArrayType['is'], + validate: ReadonlyArrayType['validate'], + encode: ReadonlyArrayType['encode'], + readonly type: C + ) +} ``` Added in v1.0.0 -## ~~Exact~~ (type alias) +### \_tag (property) **Signature** ```ts -export type Exact = T & - { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } +readonly _tag: "ReadonlyArrayType" ``` -Added in v1.1.0 +Added in v1.0.0 -## ~~FunctionC~~ (interface) +## ReadonlyC (interface) **Signature** ```ts -export interface FunctionC extends FunctionType {} +export interface ReadonlyC + extends ReadonlyType>, Readonly>, unknown> {} ``` Added in v1.5.3 -## ~~FunctionType~~ (class) +## ReadonlyType (class) **Signature** ```ts -export declare class FunctionType { - constructor() +export declare class ReadonlyType { + constructor( + name: string, + is: ReadonlyType['is'], + validate: ReadonlyType['validate'], + encode: ReadonlyType['encode'], + readonly type: C + ) } ``` @@ -832,50 +861,35 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "FunctionType" -``` - -Added in v1.0.0 - -## ~~Function~~ - -**Signature** - -```ts -export declare const Function: FunctionC -``` - -Added in v1.0.0 - -## ~~Integer~~ - -Use `Int` instead - -**Signature** - -```ts -export declare const Integer: RefinementC +readonly _tag: "ReadonlyType" ``` Added in v1.0.0 -## ~~NeverC~~ (interface) +## RecordC (interface) **Signature** ```ts -export interface NeverC extends NeverType {} +export interface RecordC + extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} ``` Added in v1.5.3 -## ~~NeverType~~ (class) +## RecursiveType (class) **Signature** ```ts -export declare class NeverType { - constructor() +export declare class RecursiveType { + constructor( + name: string, + is: RecursiveType['is'], + validate: RecursiveType['validate'], + encode: RecursiveType['encode'], + public runDefinition: () => C + ) } ``` @@ -886,28 +900,35 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "NeverType" +readonly _tag: "RecursiveType" ``` Added in v1.0.0 -## ~~ObjectC~~ (interface) +### type (property) **Signature** ```ts -export interface ObjectC extends ObjectType {} +readonly type: C ``` -Added in v1.5.3 +Added in v1.0.0 -## ~~ObjectType~~ (class) +## RefinementType (class) **Signature** ```ts -export declare class ObjectType { - constructor() +export declare class RefinementType { + constructor( + name: string, + is: RefinementType['is'], + validate: RefinementType['validate'], + encode: RefinementType['encode'], + readonly type: C, + readonly predicate: Predicate + ) } ``` @@ -918,59 +939,59 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "ObjectType" -``` - -Added in v1.0.0 - -## ~~PropsOf~~ (type alias) - -**Signature** - -```ts -export type PropsOf = T['props'] +readonly _tag: "RefinementType" ``` Added in v1.0.0 -## ~~RefinementC~~ (interface) - -Use `BrandC` instead - -**Signature** - -```ts -export interface RefinementC extends RefinementType, OutputOf, InputOf> {} -``` - -Added in v1.5.3 - -## ~~StrictC~~ (interface) +## TupleC (interface) **Signature** ```ts -export interface StrictC

// tslint:disable-next-line: deprecation - extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} +export interface TupleC]> + extends TupleType< + CS, + CS extends { length: 1 } + ? [TypeOf] + : CS extends { length: 2 } + ? [TypeOf, TypeOf] + : CS extends { length: 3 } + ? [TypeOf, TypeOf, TypeOf] + : CS extends { length: 4 } + ? [TypeOf, TypeOf, TypeOf, TypeOf] + : CS extends { length: 5 } + ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] + : unknown, + CS extends { length: 1 } + ? [OutputOf] + : CS extends { length: 2 } + ? [OutputOf, OutputOf] + : CS extends { length: 3 } + ? [OutputOf, OutputOf, OutputOf] + : CS extends { length: 4 } + ? [OutputOf, OutputOf, OutputOf, OutputOf] + : CS extends { length: 5 } + ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] + : unknown, + unknown + > {} ``` Added in v1.5.3 -## ~~StrictType~~ (class) +## TupleType (class) **Signature** ```ts -export declare class StrictType { +export declare class TupleType { constructor( name: string, - // tslint:disable-next-line: deprecation - is: StrictType['is'], - // tslint:disable-next-line: deprecation - validate: StrictType['validate'], - // tslint:disable-next-line: deprecation - encode: StrictType['encode'], - readonly props: P + is: TupleType['is'], + validate: TupleType['validate'], + encode: TupleType['encode'], + readonly types: CS ) } ``` @@ -982,379 +1003,363 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "StrictType" +readonly _tag: "TupleType" ``` Added in v1.0.0 -## ~~TaggedExact~~ (interface) - -**Signature** - -```ts -export interface TaggedExact extends ExactType, A, O> {} -``` - -Added in v1.3.0 - -## ~~TaggedIntersectionArgument~~ (type alias) +## TypeC (interface) **Signature** ```ts -export type TaggedIntersectionArgument = - // tslint:disable-next-line: deprecation - | [Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Mixed, Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed, Mixed, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged, Mixed, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Tagged, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Mixed, Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Mixed, Mixed, Tagged] +export interface TypeC

+ extends InterfaceType }, { [K in keyof P]: OutputOf }, unknown> {} ``` -Added in v1.3.0 +Added in v1.5.3 -## ~~TaggedIntersection~~ (interface) +## UnionC (interface) **Signature** ```ts -export interface TaggedIntersection // tslint:disable-next-line: deprecation - extends IntersectionType, A, O> {} +export interface UnionC]> + extends UnionType, OutputOf, unknown> {} ``` -Added in v1.3.0 +Added in v1.5.3 -## ~~TaggedProps~~ (type alias) +## UnionType (class) **Signature** ```ts -export type TaggedProps = { [K in Tag]: LiteralType } +export declare class UnionType { + constructor( + name: string, + is: UnionType['is'], + validate: UnionType['validate'], + encode: UnionType['encode'], + readonly types: CS + ) +} ``` -Added in v1.3.0 +Added in v1.0.0 -## ~~TaggedRefinement~~ (interface) +### \_tag (property) **Signature** ```ts -export interface TaggedRefinement extends RefinementType, A, O> {} +readonly _tag: "UnionType" ``` -Added in v1.3.0 +Added in v1.0.0 -## ~~TaggedUnionC~~ (interface) +## array **Signature** ```ts -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation - extends TaggedUnionType, OutputOf, unknown> {} +export declare function array(item: C, name: string = `Array<${item.name}>`): ArrayC ``` -Added in v1.5.3 +Added in v1.0.0 -## ~~TaggedUnionType~~ (class) +## brand **Signature** ```ts -export declare class TaggedUnionType { - constructor( - name: string, - // tslint:disable-next-line: deprecation - is: TaggedUnionType['is'], - // tslint:disable-next-line: deprecation - validate: TaggedUnionType['validate'], - // tslint:disable-next-line: deprecation - encode: TaggedUnionType['encode'], - codecs: CS, - readonly tag: Tag - ) -} +export declare function brand( + codec: C, + predicate: Refinement, Branded, B>>, + name: N +): BrandC ``` -Added in v1.3.0 - -## ~~TaggedUnion~~ (interface) - -**Signature** - -```ts -export interface TaggedUnion extends UnionType>, A, O> {} -``` +Added in v1.8.1 -Added in v1.3.0 +## exact -## ~~Tagged~~ (type alias) +Strips additional properties **Signature** ```ts -export type Tagged = - // tslint:disable-next-line: deprecation - | InterfaceType, A, O> - // tslint:disable-next-line: deprecation - | StrictType, A, O> - // tslint:disable-next-line: deprecation - | TaggedRefinement - // tslint:disable-next-line: deprecation - | TaggedUnion - // tslint:disable-next-line: deprecation - | TaggedIntersection - // tslint:disable-next-line: deprecation - | TaggedExact - | RecursiveType +export declare function exact(codec: C, name: string = getExactTypeName(codec)): ExactC ``` -Added in v1.3.0 - -## ~~alias~~ +Added in v1.1.0 -Keeps the codec "kind" +## intersection **Signature** ```ts -export declare function alias( - codec: PartialType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => PartialType -export declare function alias( - // tslint:disable-next-line: deprecation - codec: StrictType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => // tslint:disable-next-line: deprecation -StrictType -export declare function alias( - codec: InterfaceType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => InterfaceType +export declare function intersection< + A extends Mixed, + B extends Mixed, + C extends Mixed, + D extends Mixed, + E extends Mixed +>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> +export declare function intersection( + codecs: [A, B, C, D], + name?: string +): IntersectionC<[A, B, C, D]> +export declare function intersection( + codecs: [A, B, C], + name?: string +): IntersectionC<[A, B, C]> +export declare function intersection( + codecs: [A, B], + name?: string +): IntersectionC<[A, B]> ``` -Added in v1.1.0 - -## ~~any~~ +Added in v1.0.0 -Use `unknown` instead +## partial **Signature** ```ts -export declare const any: AnyC +export declare function partial

( + props: P, + name: string = getPartialTypeName(getInterfaceTypeName(props)) +): PartialC

``` Added in v1.0.0 -## ~~clean~~ - -Drops the codec "kind" +## readonly **Signature** ```ts -export declare function clean(codec: Type): Type +export declare function readonly(codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC ``` -Added in v1.1.0 - -## ~~dictionary~~ +Added in v1.0.0 -Use `record` instead +## readonlyArray **Signature** ```ts -export declare const dictionary: typeof record +export declare function readonlyArray( + item: C, + name: string = `ReadonlyArray<${item.name}>` +): ReadonlyArrayC ``` Added in v1.0.0 -## ~~getDefaultContext~~ +## record **Signature** ```ts -export declare const getDefaultContext: (decoder: Decoder) => Context +export declare function record(domain: D, codomain: C, name?: string): RecordC ``` -Added in v1.0.0 +Added in v1.7.1 -## ~~getValidationError~~ +## recursion **Signature** ```ts -export declare const getValidationError: (value: unknown, context: Context) => ValidationError +export declare function recursion = Type>( + name: string, + definition: (self: C) => C +): RecursiveType ``` Added in v1.0.0 -## ~~interface~~ +## strict -Use `type` instead +Strips additional properties **Signature** ```ts -export declare const interface:

(props: P, name?: string) => TypeC

+export declare const strict:

(props: P, name?: string) => ExactC> ``` Added in v1.0.0 -## ~~mixed~~ (type alias) - -Use `unknown` instead +## tuple **Signature** ```ts -export type mixed = unknown +export declare function tuple( + codecs: [A, B, C, D, E], + name?: string +): TupleC<[A, B, C, D, E]> +export declare function tuple( + codecs: [A, B, C, D], + name?: string +): TupleC<[A, B, C, D]> +export declare function tuple( + codecs: [A, B, C], + name?: string +): TupleC<[A, B, C]> +export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> +export declare function tuple(codecs: [A], name?: string): TupleC<[A]> ``` Added in v1.0.0 -## ~~never~~ +## type **Signature** ```ts -export declare const never: NeverC +export declare function type

(props: P, name: string = getInterfaceTypeName(props)): TypeC

``` Added in v1.0.0 -## ~~object~~ - -Use `UnknownRecord` instead +## union **Signature** ```ts -export declare const object: ObjectC +export declare function union]>( + codecs: CS, + name: string = getUnionName(codecs) +): UnionC ``` Added in v1.0.0 -## ~~refinement~~ +# constructors -Use `brand` instead +## KeyofC (interface) **Signature** ```ts -export declare function refinement( - codec: C, - predicate: Predicate>, - name: string = `(${codec.name} | ${getFunctionName(predicate)})` -): // tslint:disable-next-line: deprecation -RefinementC +export interface KeyofC extends KeyofType {} +``` + +Added in v1.5.3 + +## KeyofType (class) + +**Signature** + +```ts +export declare class KeyofType { + constructor( + name: string, + is: KeyofType['is'], + validate: KeyofType['validate'], + encode: KeyofType['encode'], + readonly keys: D + ) +} ``` Added in v1.0.0 -## ~~taggedUnion~~ +### \_tag (property) -Use `union` instead +**Signature** + +```ts +readonly _tag: "KeyofType" +``` + +Added in v1.0.0 + +## LiteralC (interface) **Signature** ```ts -export declare const taggedUnion: ( - tag: Tag, - codecs: CS, - name?: string -) => TaggedUnionC +export interface LiteralC extends LiteralType {} ``` -Added in v1.3.0 +Added in v1.5.3 -# utils +## LiteralType (class) -## Any (interface) +**Signature** + +```ts +export declare class LiteralType { + constructor( + name: string, + is: LiteralType['is'], + validate: LiteralType['validate'], + encode: LiteralType['encode'], + readonly value: V + ) +} +``` + +Added in v1.0.0 + +### \_tag (property) **Signature** ```ts -export interface Any extends Type {} +readonly _tag: "LiteralType" ``` Added in v1.0.0 -## AnyArrayType (class) +## keyof **Signature** ```ts -export declare class AnyArrayType { - constructor() -} +export declare function keyof( + keys: D, + name: string = Object.keys(keys) + .map((k) => JSON.stringify(k)) + .join(' | ') +): KeyofC ``` Added in v1.0.0 -### \_tag (property) +## literal **Signature** ```ts -readonly _tag: "AnyArrayType" +export declare function literal(value: V, name: string = JSON.stringify(value)): LiteralC ``` Added in v1.0.0 -## AnyDictionaryType (class) +# deprecated + +## ~~AnyC~~ (interface) **Signature** ```ts -export declare class AnyDictionaryType { +export interface AnyC extends AnyType {} +``` + +Added in v1.5.3 + +## ~~AnyType~~ (class) + +**Signature** + +```ts +export declare class AnyType { constructor() } ``` @@ -1366,109 +1371,128 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "AnyDictionaryType" +readonly _tag: "AnyType" ``` Added in v1.0.0 -## AnyProps (interface) +## ~~Array~~ + +Use `UnknownArray` instead **Signature** ```ts -export interface AnyProps { - [key: string]: Any -} +export declare const Array: UnknownArrayC ``` Added in v1.0.0 -## ArrayC (interface) +## ~~Compact~~ (type alias) + +used in `intersection` as a workaround for #234 **Signature** ```ts -export interface ArrayC extends ArrayType>, Array>, unknown> {} +export type Compact = { [K in keyof A]: A[K] } ``` -Added in v1.5.3 +Added in v1.4.2 -## ArrayType (class) +## ~~Dictionary~~ + +Use `UnknownRecord` instead **Signature** ```ts -export declare class ArrayType { - constructor( - name: string, - is: ArrayType['is'], - validate: ArrayType['validate'], - encode: ArrayType['encode'], - readonly type: C - ) -} +export declare const Dictionary: UnknownRecordC ``` Added in v1.0.0 -### \_tag (property) +## ~~Exact~~ (type alias) **Signature** ```ts -readonly _tag: "ArrayType" +export type Exact = T & + { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } ``` -Added in v1.0.0 +Added in v1.1.0 -## BigIntC (interface) +## ~~FunctionC~~ (interface) **Signature** ```ts -export interface BigIntC extends BigIntType {} +export interface FunctionC extends FunctionType {} ``` -Added in v2.1.0 +Added in v1.5.3 -## BigIntType (class) +## ~~FunctionType~~ (class) **Signature** ```ts -export declare class BigIntType { +export declare class FunctionType { constructor() } ``` -Added in v2.1.0 +Added in v1.0.0 ### \_tag (property) **Signature** ```ts -readonly _tag: "BigIntType" +readonly _tag: "FunctionType" ``` Added in v1.0.0 -## BooleanC (interface) +## ~~Function~~ **Signature** ```ts -export interface BooleanC extends BooleanType {} +export declare const Function: FunctionC +``` + +Added in v1.0.0 + +## ~~Integer~~ + +Use `Int` instead + +**Signature** + +```ts +export declare const Integer: RefinementC +``` + +Added in v1.0.0 + +## ~~NeverC~~ (interface) + +**Signature** + +```ts +export interface NeverC extends NeverType {} ``` Added in v1.5.3 -## BooleanType (class) +## ~~NeverType~~ (class) **Signature** ```ts -export declare class BooleanType { +export declare class NeverType { constructor() } ``` @@ -1480,379 +1504,443 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "BooleanType" +readonly _tag: "NeverType" ``` Added in v1.0.0 -## Brand (interface) +## ~~ObjectC~~ (interface) **Signature** ```ts -export interface Brand { - readonly [_brand]: B -} +export interface ObjectC extends ObjectType {} ``` -Added in v1.8.1 +Added in v1.5.3 -## BrandC (interface) +## ~~ObjectType~~ (class) **Signature** ```ts -export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} +export declare class ObjectType { + constructor() +} ``` -Added in v1.8.1 +Added in v1.0.0 -## Branded (type alias) +### \_tag (property) **Signature** ```ts -export type Branded = A & Brand +readonly _tag: "ObjectType" ``` -Added in v1.8.1 +Added in v1.0.0 -## DictionaryType (class) +## ~~PropsOf~~ (type alias) **Signature** ```ts -export declare class DictionaryType { - constructor( - name: string, - is: DictionaryType['is'], - validate: DictionaryType['validate'], - encode: DictionaryType['encode'], - readonly domain: D, - readonly codomain: C - ) -} +export type PropsOf = T['props'] ``` Added in v1.0.0 -### \_tag (property) +## ~~RefinementC~~ (interface) + +Use `BrandC` instead **Signature** ```ts -readonly _tag: "DictionaryType" +export interface RefinementC extends RefinementType, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.5.3 -## ExactC (interface) +## ~~StrictC~~ (interface) **Signature** ```ts -export interface ExactC extends ExactType, OutputOf, InputOf> {} +export interface StrictC

// tslint:disable-next-line: deprecation + extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} ``` Added in v1.5.3 -## ExactType (class) +## ~~StrictType~~ (class) **Signature** ```ts -export declare class ExactType { +export declare class StrictType { constructor( name: string, - is: ExactType['is'], - validate: ExactType['validate'], - encode: ExactType['encode'], - readonly type: C + // tslint:disable-next-line: deprecation + is: StrictType['is'], + // tslint:disable-next-line: deprecation + validate: StrictType['validate'], + // tslint:disable-next-line: deprecation + encode: StrictType['encode'], + readonly props: P ) } ``` -Added in v1.1.0 +Added in v1.0.0 ### \_tag (property) **Signature** ```ts -readonly _tag: "ExactType" +readonly _tag: "StrictType" ``` Added in v1.0.0 -## HasProps (type alias) +## ~~TaggedExact~~ (interface) **Signature** ```ts -export type HasProps = - | HasPropsRefinement - | HasPropsReadonly - | HasPropsIntersection - | InterfaceType - // tslint:disable-next-line: deprecation - | StrictType - | PartialType +export interface TaggedExact extends ExactType, A, O> {} ``` -Added in v1.1.0 +Added in v1.3.0 -## HasPropsIntersection (interface) +## ~~TaggedIntersectionArgument~~ (type alias) **Signature** ```ts -export interface HasPropsIntersection extends IntersectionType, any, any, any> {} +export type TaggedIntersectionArgument = + // tslint:disable-next-line: deprecation + | [Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Mixed, Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed, Mixed, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged, Mixed, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Tagged, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Mixed, Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Mixed, Mixed, Tagged] ``` -Added in v1.1.0 +Added in v1.3.0 -## HasPropsReadonly (interface) +## ~~TaggedIntersection~~ (interface) **Signature** ```ts -export interface HasPropsReadonly extends ReadonlyType {} +export interface TaggedIntersection // tslint:disable-next-line: deprecation + extends IntersectionType, A, O> {} ``` -Added in v1.1.0 +Added in v1.3.0 -## HasPropsRefinement (interface) +## ~~TaggedProps~~ (type alias) **Signature** ```ts -export interface HasPropsRefinement extends RefinementType {} +export type TaggedProps = { [K in Tag]: LiteralType } ``` -Added in v1.1.0 +Added in v1.3.0 -## InputOf (type alias) +## ~~TaggedRefinement~~ (interface) **Signature** ```ts -export type InputOf = C['_I'] +export interface TaggedRefinement extends RefinementType, A, O> {} ``` -Added in v1.0.0 +Added in v1.3.0 -## Int (type alias) +## ~~TaggedUnionC~~ (interface) **Signature** ```ts -export type Int = Branded +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation + extends TaggedUnionType, OutputOf, unknown> {} ``` -Added in v1.8.1 +Added in v1.5.3 -## IntBrand (interface) +## ~~TaggedUnionType~~ (class) **Signature** ```ts -export interface IntBrand { - readonly Int: unique symbol +export declare class TaggedUnionType { + constructor( + name: string, + // tslint:disable-next-line: deprecation + is: TaggedUnionType['is'], + // tslint:disable-next-line: deprecation + validate: TaggedUnionType['validate'], + // tslint:disable-next-line: deprecation + encode: TaggedUnionType['encode'], + codecs: CS, + readonly tag: Tag + ) } ``` -Added in v1.8.1 +Added in v1.3.0 -## InterfaceType (class) +## ~~TaggedUnion~~ (interface) **Signature** ```ts -export declare class InterfaceType { - constructor( - name: string, - is: InterfaceType['is'], - validate: InterfaceType['validate'], - encode: InterfaceType['encode'], - readonly props: P - ) -} +export interface TaggedUnion extends UnionType>, A, O> {} ``` -Added in v1.0.0 +Added in v1.3.0 -### \_tag (property) +## ~~Tagged~~ (type alias) **Signature** ```ts -readonly _tag: "InterfaceType" +export type Tagged = + // tslint:disable-next-line: deprecation + | InterfaceType, A, O> + // tslint:disable-next-line: deprecation + | StrictType, A, O> + // tslint:disable-next-line: deprecation + | TaggedRefinement + // tslint:disable-next-line: deprecation + | TaggedUnion + // tslint:disable-next-line: deprecation + | TaggedIntersection + // tslint:disable-next-line: deprecation + | TaggedExact + | RecursiveType ``` -Added in v1.0.0 +Added in v1.3.0 -## IntersectionC (interface) +## ~~alias~~ + +Keeps the codec "kind" **Signature** ```ts -export interface IntersectionC]> - extends IntersectionType< - CS, - CS extends { length: 2 } - ? TypeOf & TypeOf - : CS extends { length: 3 } - ? TypeOf & TypeOf & TypeOf - : CS extends { length: 4 } - ? TypeOf & TypeOf & TypeOf & TypeOf - : CS extends { length: 5 } - ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf - : unknown, - CS extends { length: 2 } - ? OutputOf & OutputOf - : CS extends { length: 3 } - ? OutputOf & OutputOf & OutputOf - : CS extends { length: 4 } - ? OutputOf & OutputOf & OutputOf & OutputOf - : CS extends { length: 5 } - ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf - : unknown, - unknown - > {} +export declare function alias( + codec: PartialType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => PartialType +export declare function alias( + // tslint:disable-next-line: deprecation + codec: StrictType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => // tslint:disable-next-line: deprecation +StrictType +export declare function alias( + codec: InterfaceType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => InterfaceType +``` + +Added in v1.1.0 + +## ~~any~~ + +Use `unknown` instead + +**Signature** + +```ts +export declare const any: AnyC ``` -Added in v1.5.3 +Added in v1.0.0 + +## ~~clean~~ -## IntersectionType (class) +Drops the codec "kind" **Signature** ```ts -export declare class IntersectionType { - constructor( - name: string, - is: IntersectionType['is'], - validate: IntersectionType['validate'], - encode: IntersectionType['encode'], - readonly types: CS - ) -} +export declare function clean(codec: Type): Type ``` -Added in v1.0.0 +Added in v1.1.0 -### \_tag (property) +## ~~dictionary~~ + +Use `record` instead **Signature** ```ts -readonly _tag: "IntersectionType" +export declare const dictionary: typeof record ``` Added in v1.0.0 -## KeyofC (interface) +## ~~getDefaultContext~~ **Signature** ```ts -export interface KeyofC extends KeyofType {} +export declare const getDefaultContext: (decoder: Decoder) => Context ``` -Added in v1.5.3 +Added in v1.0.0 -## KeyofType (class) +## ~~getValidationError~~ **Signature** ```ts -export declare class KeyofType { - constructor( - name: string, - is: KeyofType['is'], - validate: KeyofType['validate'], - encode: KeyofType['encode'], - readonly keys: D - ) -} +export declare const getValidationError: (value: unknown, context: Context) => ValidationError ``` Added in v1.0.0 -### \_tag (property) +## ~~interface~~ + +Use `type` instead **Signature** ```ts -readonly _tag: "KeyofType" +export declare const interface: typeof type ``` Added in v1.0.0 -## LiteralC (interface) +## ~~mixed~~ (type alias) + +Use `unknown` instead **Signature** ```ts -export interface LiteralC extends LiteralType {} +export type mixed = unknown ``` -Added in v1.5.3 +Added in v1.0.0 -## LiteralType (class) +## ~~never~~ **Signature** ```ts -export declare class LiteralType { - constructor( - name: string, - is: LiteralType['is'], - validate: LiteralType['validate'], - encode: LiteralType['encode'], - readonly value: V - ) -} +export declare const never: NeverC ``` Added in v1.0.0 -### \_tag (property) +## ~~object~~ + +Use `UnknownRecord` instead **Signature** ```ts -readonly _tag: "LiteralType" +export declare const object: ObjectC ``` Added in v1.0.0 -## Mixed (interface) +## ~~refinement~~ + +Use `brand` instead **Signature** ```ts -export interface Mixed extends Type {} +export declare function refinement( + codec: C, + predicate: Predicate>, + name: string = `(${codec.name} | ${getFunctionName(predicate)})` +): // tslint:disable-next-line: deprecation +RefinementC ``` Added in v1.0.0 -## NullC (interface) +## ~~taggedUnion~~ + +Use `union` instead **Signature** ```ts -export interface NullC extends NullType {} +export declare const taggedUnion: ( + tag: Tag, + codecs: CS, + name?: string +) => TaggedUnionC ``` -Added in v1.5.3 +Added in v1.3.0 -## NullType (class) +# primitives + +## AnyArrayType (class) **Signature** ```ts -export declare class NullType { +export declare class AnyArrayType { constructor() } ``` @@ -1864,158 +1952,148 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "NullType" +readonly _tag: "AnyArrayType" ``` Added in v1.0.0 -## NumberC (interface) +## AnyDictionaryType (class) **Signature** ```ts -export interface NumberC extends NumberType {} +export declare class AnyDictionaryType { + constructor() +} ``` -Added in v1.5.3 +Added in v1.0.0 -## NumberType (class) +### \_tag (property) **Signature** ```ts -export declare class NumberType { - constructor() -} +readonly _tag: "AnyDictionaryType" ``` Added in v1.0.0 -### \_tag (property) +## BigIntC (interface) **Signature** ```ts -readonly _tag: "NumberType" +export interface BigIntC extends BigIntType {} ``` -Added in v1.0.0 +Added in v2.1.0 -## OutputOf (type alias) +## BigIntType (class) **Signature** ```ts -export type OutputOf = C['_O'] +export declare class BigIntType { + constructor() +} ``` -Added in v1.0.0 +Added in v2.1.0 -## OutputOfDictionary (type alias) +### \_tag (property) **Signature** ```ts -export type OutputOfDictionary = { [K in OutputOf]: OutputOf } +readonly _tag: "BigIntType" ``` Added in v1.0.0 -## OutputOfPartialProps (type alias) +## BooleanC (interface) **Signature** ```ts -export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } +export interface BooleanC extends BooleanType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## OutputOfProps (type alias) +## BooleanType (class) **Signature** ```ts -export type OutputOfProps

= { [K in keyof P]: OutputOf } +export declare class BooleanType { + constructor() +} ``` Added in v1.0.0 -## PartialC (interface) +### \_tag (property) **Signature** ```ts -export interface PartialC

- extends PartialType }, { [K in keyof P]?: OutputOf }, unknown> {} +readonly _tag: "BooleanType" ``` -Added in v1.5.3 +Added in v1.0.0 -## PartialType (class) +## Int + +A branded codec representing an integer **Signature** ```ts -export declare class PartialType { - constructor( - name: string, - is: PartialType['is'], - validate: PartialType['validate'], - encode: PartialType['encode'], - readonly props: P - ) -} +export declare const Int: BrandC ``` -Added in v1.0.0 +Added in v1.8.1 -### \_tag (property) +## Int (type alias) **Signature** ```ts -readonly _tag: "PartialType" +export type Int = Branded ``` -Added in v1.0.0 +Added in v1.8.1 -## Props (interface) +## IntBrand (interface) **Signature** ```ts -export interface Props { - [key: string]: Mixed +export interface IntBrand { + readonly Int: unique symbol } ``` -Added in v1.0.0 +Added in v1.8.1 -## ReadonlyArrayC (interface) +## NullC (interface) **Signature** ```ts -export interface ReadonlyArrayC - extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} +export interface NullC extends NullType {} ``` Added in v1.5.3 -## ReadonlyArrayType (class) +## NullType (class) **Signature** ```ts -export declare class ReadonlyArrayType { - constructor( - name: string, - is: ReadonlyArrayType['is'], - validate: ReadonlyArrayType['validate'], - encode: ReadonlyArrayType['encode'], - readonly type: C - ) +export declare class NullType { + constructor() } ``` @@ -2026,35 +2104,28 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "ReadonlyArrayType" +readonly _tag: "NullType" ``` Added in v1.0.0 -## ReadonlyC (interface) +## NumberC (interface) **Signature** ```ts -export interface ReadonlyC - extends ReadonlyType>, Readonly>, unknown> {} +export interface NumberC extends NumberType {} ``` Added in v1.5.3 -## ReadonlyType (class) +## NumberType (class) **Signature** ```ts -export declare class ReadonlyType { - constructor( - name: string, - is: ReadonlyType['is'], - validate: ReadonlyType['validate'], - encode: ReadonlyType['encode'], - readonly type: C - ) +export declare class NumberType { + constructor() } ``` @@ -2065,35 +2136,28 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "ReadonlyType" +readonly _tag: "NumberType" ``` Added in v1.0.0 -## RecordC (interface) +## StringC (interface) **Signature** ```ts -export interface RecordC - extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} +export interface StringC extends StringType {} ``` Added in v1.5.3 -## RecursiveType (class) +## StringType (class) **Signature** ```ts -export declare class RecursiveType { - constructor( - name: string, - is: RecursiveType['is'], - validate: RecursiveType['validate'], - encode: RecursiveType['encode'], - public runDefinition: () => C - ) +export declare class StringType { + constructor() } ``` @@ -2104,460 +2168,416 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "RecursiveType" +readonly _tag: "StringType" ``` Added in v1.0.0 -### type (property) +## UndefinedC (interface) **Signature** ```ts -readonly type: C +export interface UndefinedC extends UndefinedType {} +``` + +Added in v1.5.3 + +## UndefinedType (class) + +**Signature** + +```ts +export declare class UndefinedType { + constructor() +} ``` Added in v1.0.0 -## RefinementType (class) +### \_tag (property) **Signature** ```ts -export declare class RefinementType { - constructor( - name: string, - is: RefinementType['is'], - validate: RefinementType['validate'], - encode: RefinementType['encode'], - readonly type: C, - readonly predicate: Predicate - ) -} +readonly _tag: "UndefinedType" ``` Added in v1.0.0 -### \_tag (property) +## UnknownArray **Signature** ```ts -readonly _tag: "RefinementType" +export declare const UnknownArray: UnknownArrayC ``` -Added in v1.0.0 +Added in v1.7.1 -## StringC (interface) +## UnknownArrayC (interface) **Signature** ```ts -export interface StringC extends StringType {} +export interface UnknownArrayC extends AnyArrayType {} ``` Added in v1.5.3 -## StringType (class) +## UnknownC (interface) **Signature** ```ts -export declare class StringType { - constructor() -} +export interface UnknownC extends UnknownType {} ``` -Added in v1.0.0 +Added in v1.5.3 -### \_tag (property) +## UnknownRecord **Signature** ```ts -readonly _tag: "StringType" +export declare const UnknownRecord: UnknownRecordC ``` -Added in v1.0.0 +Added in v1.7.1 -## TupleC (interface) +## UnknownRecordC (interface) **Signature** ```ts -export interface TupleC]> - extends TupleType< - CS, - CS extends { length: 1 } - ? [TypeOf] - : CS extends { length: 2 } - ? [TypeOf, TypeOf] - : CS extends { length: 3 } - ? [TypeOf, TypeOf, TypeOf] - : CS extends { length: 4 } - ? [TypeOf, TypeOf, TypeOf, TypeOf] - : CS extends { length: 5 } - ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] - : unknown, - CS extends { length: 1 } - ? [OutputOf] - : CS extends { length: 2 } - ? [OutputOf, OutputOf] - : CS extends { length: 3 } - ? [OutputOf, OutputOf, OutputOf] - : CS extends { length: 4 } - ? [OutputOf, OutputOf, OutputOf, OutputOf] - : CS extends { length: 5 } - ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] - : unknown, - unknown - > {} +export interface UnknownRecordC extends AnyDictionaryType {} ``` Added in v1.5.3 -## TupleType (class) +## UnknownType (class) **Signature** ```ts -export declare class TupleType { - constructor( - name: string, - is: TupleType['is'], - validate: TupleType['validate'], - encode: TupleType['encode'], - readonly types: CS - ) +export declare class UnknownType { + constructor() } ``` -Added in v1.0.0 +Added in v1.5.0 ### \_tag (property) **Signature** ```ts -readonly _tag: "TupleType" +readonly _tag: "UnknownType" ``` Added in v1.0.0 -## TypeC (interface) +## VoidC (interface) **Signature** ```ts -export interface TypeC

- extends InterfaceType }, { [K in keyof P]: OutputOf }, unknown> {} +export interface VoidC extends VoidType {} ``` Added in v1.5.3 -## TypeOf (type alias) +## VoidType (class) **Signature** ```ts -export type TypeOf = C['_A'] +export declare class VoidType { + constructor() +} ``` -Added in v1.0.0 +Added in v1.2.0 -## TypeOfDictionary (type alias) +### \_tag (property) **Signature** ```ts -export type TypeOfDictionary = { [K in TypeOf]: TypeOf } +readonly _tag: "VoidType" ``` Added in v1.0.0 -## TypeOfPartialProps (type alias) +## bigint **Signature** ```ts -export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } +export declare const bigint: BigIntC ``` -Added in v1.0.0 +Added in v2.1.0 -## TypeOfProps (type alias) +## boolean **Signature** ```ts -export type TypeOfProps

= { [K in keyof P]: TypeOf } +export declare const boolean: BooleanC ``` Added in v1.0.0 -## UndefinedC (interface) - -**Signature** - -```ts -export interface UndefinedC extends UndefinedType {} -``` - -Added in v1.5.3 - -## UndefinedType (class) +## null **Signature** ```ts -export declare class UndefinedType { - constructor() -} +export declare const null: NullC ``` Added in v1.0.0 -### \_tag (property) +## nullType **Signature** ```ts -readonly _tag: "UndefinedType" +export declare const nullType: NullC ``` Added in v1.0.0 -## UnionC (interface) +## number **Signature** ```ts -export interface UnionC]> - extends UnionType, OutputOf, unknown> {} +export declare const number: NumberC ``` -Added in v1.5.3 +Added in v1.0.0 -## UnionType (class) +## string **Signature** ```ts -export declare class UnionType { - constructor( - name: string, - is: UnionType['is'], - validate: UnionType['validate'], - encode: UnionType['encode'], - readonly types: CS - ) -} +export declare const string: StringC ``` Added in v1.0.0 -### \_tag (property) +## undefined **Signature** ```ts -readonly _tag: "UnionType" +export declare const undefined: UndefinedC ``` Added in v1.0.0 -## UnknownArrayC (interface) +## unknown **Signature** ```ts -export interface UnknownArrayC extends AnyArrayType {} +export declare const unknown: UnknownC ``` -Added in v1.5.3 +Added in v1.5.0 -## UnknownC (interface) +## void **Signature** ```ts -export interface UnknownC extends UnknownType {} +export declare const void: VoidC ``` -Added in v1.5.3 +Added in v1.0.0 -## UnknownRecordC (interface) +## voidType **Signature** ```ts -export interface UnknownRecordC extends AnyDictionaryType {} +export declare const voidType: VoidC ``` -Added in v1.5.3 +Added in v1.2.0 -## UnknownType (class) +# utils + +## AnyProps (interface) **Signature** ```ts -export declare class UnknownType { - constructor() +export interface AnyProps { + [key: string]: Any } ``` -Added in v1.5.0 +Added in v1.0.0 -### \_tag (property) +## HasProps (type alias) **Signature** ```ts -readonly _tag: "UnknownType" +export type HasProps = + | HasPropsRefinement + | HasPropsReadonly + | HasPropsIntersection + | InterfaceType + // tslint:disable-next-line: deprecation + | StrictType + | PartialType ``` -Added in v1.0.0 +Added in v1.1.0 -## VoidC (interface) +## HasPropsIntersection (interface) **Signature** ```ts -export interface VoidC extends VoidType {} +export interface HasPropsIntersection extends IntersectionType, any, any, any> {} ``` -Added in v1.5.3 +Added in v1.1.0 -## VoidType (class) +## HasPropsReadonly (interface) **Signature** ```ts -export declare class VoidType { - constructor() -} +export interface HasPropsReadonly extends ReadonlyType {} ``` -Added in v1.2.0 +Added in v1.1.0 -### \_tag (property) +## HasPropsRefinement (interface) **Signature** ```ts -readonly _tag: "VoidType" +export interface HasPropsRefinement extends RefinementType {} ``` -Added in v1.0.0 +Added in v1.1.0 -## appendContext +## OutputOfDictionary (type alias) **Signature** ```ts -export declare const appendContext: (c: Context, key: string, decoder: Decoder, actual?: unknown) => Context +export type OutputOfDictionary = { [K in OutputOf]: OutputOf } ``` Added in v1.0.0 -## exact - -Strips additional properties +## OutputOfPartialProps (type alias) **Signature** ```ts -export declare const exact: (codec: C, name?: string) => ExactC +export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } ``` -Added in v1.1.0 +Added in v1.0.0 -## failure +## OutputOfProps (type alias) **Signature** ```ts -export declare const failure: (value: unknown, context: Context, message?: string) => Either +export type OutputOfProps

= { [K in keyof P]: OutputOf } ``` Added in v1.0.0 -## failures +## Props (interface) **Signature** ```ts -export declare const failures: (errors: Errors) => Either +export interface Props { + [key: string]: Mixed +} ``` Added in v1.0.0 -## getContextEntry +## TypeOfDictionary (type alias) **Signature** ```ts -export declare const getContextEntry: (key: string, decoder: Decoder) => ContextEntry +export type TypeOfDictionary = { [K in TypeOf]: TypeOf } ``` Added in v1.0.0 -## getFunctionName +## TypeOfPartialProps (type alias) **Signature** ```ts -export declare const getFunctionName: (f: Function) => string +export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } ``` Added in v1.0.0 -## identity +## TypeOfProps (type alias) **Signature** ```ts -export declare const identity: (a: A) => A +export type TypeOfProps

= { [K in keyof P]: TypeOf } ``` Added in v1.0.0 -## null +## appendContext **Signature** ```ts -export declare const null: NullC +export declare function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context ``` Added in v1.0.0 -## success +## getContextEntry **Signature** ```ts -export declare const success: (value: T) => Either +export declare function getContextEntry(key: string, decoder: Decoder): ContextEntry ``` Added in v1.0.0 -## undefined +## getFunctionName **Signature** ```ts -export declare const undefined: UndefinedC +export declare function getFunctionName(f: Function): string ``` Added in v1.0.0 -## void +## identity **Signature** ```ts -export declare const void: VoidC +export declare const identity: (a: A) => A ``` Added in v1.0.0 diff --git a/package-lock.json b/package-lock.json index 18ad5e200..93cd7106e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -313,6 +313,86 @@ "is-negated-glob": "^1.0.0" } }, + "@eslint/eslintrc": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", + "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, "@istanbuljs/load-nyc-config": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", @@ -974,6 +1054,12 @@ "pretty-format": "^25.2.1" } }, + "@types/json-schema": { + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "dev": true + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -1013,6 +1099,191 @@ "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz", + "integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "4.14.1", + "@typescript-eslint/scope-manager": "4.14.1", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "tsutils": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", + "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz", + "integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.14.1", + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/typescript-estree": "4.14.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz", + "integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "4.14.1", + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/typescript-estree": "4.14.1", + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz", + "integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/visitor-keys": "4.14.1" + } + }, + "@typescript-eslint/types": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz", + "integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz", + "integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/visitor-keys": "4.14.1", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globby": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "tsutils": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", + "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz", + "integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.14.1", + "eslint-visitor-keys": "^2.0.0" + } + }, "abab": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", @@ -1043,6 +1314,12 @@ } } }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true + }, "acorn-walk": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", @@ -2201,6 +2478,23 @@ "once": "^1.4.0" } }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + } + } + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -2256,12 +2550,328 @@ "source-map": "~0.6.1" } }, + "eslint": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz", + "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@eslint/eslintrc": "^0.3.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^6.0.0", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.4", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, "estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", @@ -2529,6 +3139,15 @@ "bser": "2.1.1" } }, + "file-entry-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz", + "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, "fill-range": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", @@ -2569,6 +3188,22 @@ } } }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -2643,6 +3278,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gensync": { "version": "1.0.0-beta.1", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", @@ -2931,6 +3572,24 @@ "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "dev": true }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, "import-local": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", @@ -2942,11 +3601,12 @@ } }, "import-path-rewrite": { - "version": "github:gcanti/import-path-rewrite#39b4178f9ff80aed3fa18a702584e0d0f0d6d8bc", + "version": "github:gcanti/import-path-rewrite#536890c96ad6bd6d347aae08958c8404b8d51e86", "from": "github:gcanti/import-path-rewrite", "dev": true, "requires": { "chalk": "^3.0.0", + "fp-ts": "^2.0.0", "glob": "^7.1.6" }, "dependencies": { @@ -4759,6 +5419,12 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -4917,6 +5583,15 @@ "@sinonjs/commons": "^1.7.0" } }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "make-dir": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", @@ -5625,6 +6300,15 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-entities": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", @@ -5792,6 +6476,12 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "prompts": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", @@ -5928,6 +6618,12 @@ } } }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, "remark-frontmatter": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-1.3.2.tgz", @@ -6073,6 +6769,12 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -6419,6 +7121,49 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -6838,6 +7583,44 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "table": { + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "dev": true, + "requires": { + "ajv": "^7.0.2", + "lodash": "^4.17.20", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" + }, + "dependencies": { + "ajv": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz", + "integrity": "sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + } + } + }, "terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -6859,6 +7642,12 @@ "minimatch": "^3.0.4" } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "throat": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz", @@ -7377,6 +8166,12 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "dev": true }, + "v8-compile-cache": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", + "dev": true + }, "v8-to-istanbul": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz", @@ -7650,6 +8445,12 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yargs": { "version": "15.3.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", diff --git a/package.json b/package.json index 15c9a10b2..7f6945292 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "sideEffects": false, "scripts": { "lint": "tslint -p tsconfig.tslint.json src/**/*.ts test/**/*.ts", + "eslint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.ts\"", "jest": "jest", "prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"", "fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples,exercises}/**/*.ts\"", @@ -44,10 +45,13 @@ "@types/benchmark": "1.0.31", "@types/jest": "25.2.1", "@types/node": "13.11.0", + "@typescript-eslint/eslint-plugin": "^4.14.1", + "@typescript-eslint/parser": "^4.14.1", "benchmark": "2.1.4", "docs-ts": "^0.5.1", "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", + "eslint": "^7.18.0", "fast-check": "^1.24.2", "fp-ts": "^2.8.1", "import-path-rewrite": "github:gcanti/import-path-rewrite", diff --git a/src/Decoder.ts b/src/Decoder.ts index ae17bea83..f08165842 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -528,7 +528,7 @@ const make = (value: A, forest: ReadonlyArray> = empty): Tree => ( const drawTree = (tree: Tree): string => tree.value + drawForest('\n', tree.forest) const drawForest = (indentation: string, forest: ReadonlyArray>): string => { - let r: string = '' + let r = '' const len = forest.length let tree: Tree for (let i = 0; i < len; i++) { diff --git a/src/Schemable.ts b/src/Schemable.ts index 967aff390..4f387b639 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -164,7 +164,7 @@ export interface WithRefine2C { * @since 2.2.0 */ export function memoize(f: (a: A) => B): (a: A) => B { - let cache = new Map() + const cache = new Map() return (a) => { if (!cache.has(a)) { const b = f(a) diff --git a/src/index.ts b/src/index.ts index c2204bfbd..7388cf49f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,11 +5,11 @@ import { Either, isLeft, left, right } from 'fp-ts/lib/Either' import { Predicate, Refinement } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- -// model +// Decode error // ------------------------------------------------------------------------------------- /** - * @category Model + * @category Decode error * @since 1.0.0 */ export interface ContextEntry { @@ -20,13 +20,13 @@ export interface ContextEntry { } /** - * @category Model + * @category Decode error * @since 1.0.0 */ export interface Context extends ReadonlyArray {} /** - * @category Model + * @category Decode error * @since 1.0.0 */ export interface ValidationError { @@ -39,68 +39,96 @@ export interface ValidationError { } /** - * @category Model + * @category Decode error * @since 1.0.0 */ export interface Errors extends Array {} /** - * @category Model + * @category Decode error * @since 1.0.0 */ export type Validation = Either /** - * @category Model + * @category Decode error + * @since 1.0.0 + */ +export const failures: (errors: Errors) => Validation = left + +/** + * @category Decode error + * @since 1.0.0 + */ +export const failure = (value: unknown, context: Context, message?: string): Validation => + failures([{ value, context, message }]) + +/** + * @category Decode error + * @since 1.0.0 + */ +export const success: (value: T) => Validation = right + +// ------------------------------------------------------------------------------------- +// Codec +// ------------------------------------------------------------------------------------- + +/** + * @category Codec * @since 1.0.0 */ export type Is = (u: unknown) => u is A /** - * @category Model + * @category Codec * @since 1.0.0 */ export type Validate = (i: I, context: Context) => Validation /** - * @category Model + * @category Codec * @since 1.0.0 */ export type Decode = (i: I) => Validation /** - * @category Model + * @category Codec * @since 1.0.0 */ export type Encode = (a: A) => O /** + * @category Codec * @since 1.0.0 */ export interface Any extends Type {} /** + * @category Codec * @since 1.0.0 */ export interface Mixed extends Type {} /** + * @category Codec * @since 1.0.0 */ export type TypeOf = C['_A'] /** + * @category Codec * @since 1.0.0 */ export type InputOf = C['_I'] /** + * @category Codec * @since 1.0.0 */ export type OutputOf = C['_O'] /** - * @category Model + * @category Codec * @since 1.0.0 */ export interface Decoder { @@ -110,7 +138,7 @@ export interface Decoder { } /** - * @category Model + * @category Codec * @since 1.0.0 */ export interface Encoder { @@ -118,7 +146,7 @@ export interface Encoder { } /** - * @category Model + * @category Codec * @since 1.0.0 */ export class Type implements Decoder, Encoder { @@ -189,56 +217,526 @@ export class Type implements Decoder, Encoder } } -/** - * @since 1.0.0 - */ -export const identity = (a: A): A => a +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- + +/** + * @since 1.0.0 + */ +export const identity = (a: A): A => a + +/** + * @since 1.0.0 + */ +export function getFunctionName(f: Function): string { + return (f as any).displayName || (f as any).name || `` +} + +/** + * @since 1.0.0 + */ +export function getContextEntry(key: string, decoder: Decoder): ContextEntry { + return { key, type: decoder } +} + +/** + * @since 1.0.0 + */ +export function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context { + const len = c.length + const r = Array(len + 1) + for (let i = 0; i < len; i++) { + r[i] = c[i] + } + r[len] = { key, type: decoder, actual } + return r +} + +function pushAll(xs: Array, ys: Array): void { + const l = ys.length + for (let i = 0; i < l; i++) { + xs.push(ys[i]) + } +} + +const hasOwnProperty = Object.prototype.hasOwnProperty + +/** + * @since 1.0.0 + */ +export interface AnyProps { + [key: string]: Any +} + +function getNameFromProps(props: Props): string { + return Object.keys(props) + .map((k) => `${k}: ${props[k].name}`) + .join(', ') +} + +function useIdentity(codecs: Array): boolean { + for (let i = 0; i < codecs.length; i++) { + if (codecs[i].encode !== identity) { + return false + } + } + return true +} + +/** + * @since 1.0.0 + */ +export type TypeOfProps

= { [K in keyof P]: TypeOf } + +/** + * @since 1.0.0 + */ +export type OutputOfProps

= { [K in keyof P]: OutputOf } + +/** + * @since 1.0.0 + */ +export interface Props { + [key: string]: Mixed +} + +function getInterfaceTypeName(props: Props): string { + return `{ ${getNameFromProps(props)} }` +} + +/** + * @since 1.0.0 + */ +export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } + +/** + * @since 1.0.0 + */ +export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } + +function getPartialTypeName(inner: string): string { + return `Partial<${inner}>` +} + +/** + * @since 1.0.0 + */ +export type TypeOfDictionary = { [K in TypeOf]: TypeOf } + +/** + * @since 1.0.0 + */ +export type OutputOfDictionary = { [K in OutputOf]: OutputOf } + +function enumerableRecord( + keys: Array, + domain: D, + codomain: C, + name: string = `{ [K in ${domain.name}]: ${codomain.name} }` +): RecordC { + const len = keys.length + return new DictionaryType( + name, + (u): u is { [K in TypeOf]: TypeOf } => UnknownRecord.is(u) && keys.every((k) => codomain.is(u[k])), + (u, c) => { + const e = UnknownRecord.validate(u, c) + if (isLeft(e)) { + return e + } + const o = e.right + const a: { [key: string]: any } = {} + const errors: Errors = [] + let changed: boolean = false + for (let i = 0; i < len; i++) { + const k = keys[i] + const ok = o[k] + const codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)) + if (isLeft(codomainResult)) { + pushAll(errors, codomainResult.left) + } else { + const vok = codomainResult.right + changed = changed || vok !== ok + a[k] = vok + } + } + return errors.length > 0 ? failures(errors) : success((changed || Object.keys(o).length !== len ? a : o) as any) + }, + codomain.encode === identity + ? identity + : (a: any) => { + const s: { [key: string]: any } = {} + for (let i = 0; i < len; i++) { + const k = keys[i] + s[k] = codomain.encode(a[k]) + } + return s as any + }, + domain, + codomain + ) +} + +/** + * @internal + */ +export function getDomainKeys(domain: D): Record | undefined { + if (isLiteralC(domain)) { + const literal = domain.value + if (string.is(literal)) { + return { [literal]: null } + } + } else if (isKeyofC(domain)) { + return domain.keys + } else if (isUnionC(domain)) { + const keys = domain.types.map((type) => getDomainKeys(type)) + return keys.some(undefinedType.is) ? undefined : Object.assign({}, ...keys) + } + return undefined +} + +function nonEnumerableRecord( + domain: D, + codomain: C, + name: string = `{ [K in ${domain.name}]: ${codomain.name} }` +): RecordC { + return new DictionaryType( + name, + (u): u is { [K in TypeOf]: TypeOf } => { + if (UnknownRecord.is(u)) { + return Object.keys(u).every((k) => domain.is(k) && codomain.is(u[k])) + } + return isAnyC(codomain) && Array.isArray(u) + }, + (u, c) => { + if (UnknownRecord.is(u)) { + const a: { [key: string]: any } = {} + const errors: Errors = [] + const keys = Object.keys(u) + const len = keys.length + let changed: boolean = false + for (let i = 0; i < len; i++) { + let k = keys[i] + const ok = u[k] + const domainResult = domain.validate(k, appendContext(c, k, domain, k)) + if (isLeft(domainResult)) { + pushAll(errors, domainResult.left) + } else { + const vk = domainResult.right + changed = changed || vk !== k + k = vk + const codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)) + if (isLeft(codomainResult)) { + pushAll(errors, codomainResult.left) + } else { + const vok = codomainResult.right + changed = changed || vok !== ok + a[k] = vok + } + } + } + return errors.length > 0 ? failures(errors) : success((changed ? a : u) as any) + } + if (isAnyC(codomain) && Array.isArray(u)) { + return success(u) + } + return failure(u, c) + }, + domain.encode === identity && codomain.encode === identity + ? identity + : (a) => { + const s: { [key: string]: any } = {} + const keys = Object.keys(a) + const len = keys.length + for (let i = 0; i < len; i++) { + const k = keys[i] + s[String(domain.encode(k))] = codomain.encode(a[k]) + } + return s as any + }, + domain, + codomain + ) +} + +function getUnionName]>(codecs: CS): string { + return '(' + codecs.map((type) => type.name).join(' | ') + ')' +} + +/** + * @internal + */ +export function mergeAll(base: any, us: Array): any { + let equal = true + let primitive = true + const baseIsNotADictionary = !UnknownRecord.is(base) + for (const u of us) { + if (u !== base) { + equal = false + } + if (UnknownRecord.is(u)) { + primitive = false + } + } + if (equal) { + return base + } else if (primitive) { + return us[us.length - 1] + } + const r: any = {} + for (const u of us) { + for (const k in u) { + if (!r.hasOwnProperty(k) || baseIsNotADictionary || u[k] !== base[k]) { + r[k] = u[k] + } + } + } + return r +} + +/** + * @since 1.1.0 + */ +export interface HasPropsRefinement extends RefinementType {} +/** + * @since 1.1.0 + */ +export interface HasPropsReadonly extends ReadonlyType {} +/** + * @since 1.1.0 + */ +export interface HasPropsIntersection extends IntersectionType, any, any, any> {} +/** + * @since 1.1.0 + */ +export type HasProps = + | HasPropsRefinement + | HasPropsReadonly + | HasPropsIntersection + | InterfaceType + // tslint:disable-next-line: deprecation + | StrictType + | PartialType + +function getProps(codec: HasProps): Props { + switch (codec._tag) { + case 'RefinementType': + case 'ReadonlyType': + return getProps(codec.type) + case 'InterfaceType': + case 'StrictType': + case 'PartialType': + return codec.props + case 'IntersectionType': + return codec.types.reduce((props, type) => Object.assign(props, getProps(type)), {}) + } +} + +function stripKeys(o: any, props: Props): unknown { + const keys = Object.getOwnPropertyNames(o) + let shouldStrip = false + const r: any = {} + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + if (!hasOwnProperty.call(props, key)) { + shouldStrip = true + } else { + r[key] = o[key] + } + } + return shouldStrip ? r : o +} + +function getExactTypeName(codec: Any): string { + if (isTypeC(codec)) { + return `{| ${getNameFromProps(codec.props)} |}` + } else if (isPartialC(codec)) { + return getPartialTypeName(`{| ${getNameFromProps(codec.props)} |}`) + } + return `Exact<${codec.name}>` +} + +interface NonEmptyArray extends Array { + 0: A +} + +function isNonEmpty(as: Array): as is NonEmptyArray { + return as.length > 0 +} + +interface Tags extends Record> {} + +/** + * @internal + */ +export const emptyTags: Tags = {} + +function intersect(a: NonEmptyArray, b: NonEmptyArray): Array { + const r: Array = [] + for (const v of a) { + if (b.indexOf(v) !== -1) { + r.push(v) + } + } + return r +} + +function mergeTags(a: Tags, b: Tags): Tags { + if (a === emptyTags) { + return b + } + if (b === emptyTags) { + return a + } + let r: Tags = Object.assign({}, a) + for (const k in b) { + if (a.hasOwnProperty(k)) { + const intersection = intersect(a[k], b[k]) + if (isNonEmpty(intersection)) { + r[k] = intersection + } else { + r = emptyTags + break + } + } else { + r[k] = b[k] + } + } + return r +} + +function intersectTags(a: Tags, b: Tags): Tags { + if (a === emptyTags || b === emptyTags) { + return emptyTags + } + let r: Tags = emptyTags + for (const k in a) { + if (b.hasOwnProperty(k)) { + const intersection = intersect(a[k], b[k]) + if (intersection.length === 0) { + if (r === emptyTags) { + r = {} + } + r[k] = a[k].concat(b[k]) as any + } + } + } + return r +} + +// tslint:disable-next-line: deprecation +function isAnyC(codec: Any): codec is AnyC { + return (codec as any)._tag === 'AnyType' +} + +function isLiteralC(codec: Any): codec is LiteralC { + return (codec as any)._tag === 'LiteralType' +} + +function isKeyofC(codec: Any): codec is KeyofC> { + return (codec as any)._tag === 'KeyofType' +} + +function isTypeC(codec: Any): codec is TypeC { + return (codec as any)._tag === 'InterfaceType' +} + +function isPartialC(codec: Any): codec is PartialC { + return (codec as any)._tag === 'PartialType' +} + +// tslint:disable-next-line: deprecation +function isStrictC(codec: Any): codec is StrictC { + return (codec as any)._tag === 'StrictType' +} + +function isExactC(codec: Any): codec is ExactC { + return (codec as any)._tag === 'ExactType' +} -/** - * @since 1.0.0 - */ -export const getFunctionName = (f: Function): string => - (f as any).displayName || (f as any).name || `` +// tslint:disable-next-line: deprecation +function isRefinementC(codec: Any): codec is RefinementC { + return (codec as any)._tag === 'RefinementType' +} -/** - * @since 1.0.0 - */ -export const getContextEntry = (key: string, decoder: Decoder): ContextEntry => ({ key, type: decoder }) +function isIntersectionC(codec: Any): codec is IntersectionC<[Mixed, Mixed, ...Array]> { + return (codec as any)._tag === 'IntersectionType' +} -/** - * @since 1.0.0 - */ -export const appendContext = (c: Context, key: string, decoder: Decoder, actual?: unknown): Context => { - const len = c.length - const r = Array(len + 1) - for (let i = 0; i < len; i++) { - r[i] = c[i] - } - r[len] = { key, type: decoder, actual } - return r +function isUnionC(codec: Any): codec is UnionC<[Mixed, Mixed, ...Array]> { + return (codec as any)._tag === 'UnionType' } -/** - * @since 1.0.0 - */ -export const failures: (errors: Errors) => Validation = left +function isRecursiveC(codec: Any): codec is RecursiveType { + return (codec as any)._tag === 'RecursiveType' +} + +const lazyCodecs: Array = [] /** - * @since 1.0.0 + * @internal */ -export const failure = (value: unknown, context: Context, message?: string): Validation => - failures([{ value, context, message }]) +export function getTags(codec: Any): Tags { + if (lazyCodecs.indexOf(codec) !== -1) { + return emptyTags + } + if (isTypeC(codec) || isStrictC(codec)) { + let index: Tags = emptyTags + // tslint:disable-next-line: forin + for (const k in codec.props) { + const prop = codec.props[k] + if (isLiteralC(prop)) { + if (index === emptyTags) { + index = {} + } + index[k] = [prop.value] + } + } + return index + } else if (isExactC(codec) || isRefinementC(codec)) { + return getTags(codec.type) + } else if (isIntersectionC(codec)) { + return codec.types.reduce((tags, codec) => mergeTags(tags, getTags(codec)), emptyTags) + } else if (isUnionC(codec)) { + return codec.types.slice(1).reduce((tags, codec) => intersectTags(tags, getTags(codec)), getTags(codec.types[0])) + } else if (isRecursiveC(codec)) { + lazyCodecs.push(codec) + const tags = getTags(codec.type) + lazyCodecs.pop() + return tags + } + return emptyTags +} /** - * @since 1.0.0 + * @internal */ -export const success: (value: T) => Validation = right - -const pushAll = (xs: Array, ys: Array): void => { - const l = ys.length - for (let i = 0; i < l; i++) { - xs.push(ys[i]) +export function getIndex(codecs: NonEmptyArray): [string, NonEmptyArray>] | undefined { + const tags = getTags(codecs[0]) + const keys = Object.keys(tags) + const len = codecs.length + keys: for (const k of keys) { + const all = tags[k].slice() + const index: NonEmptyArray> = [tags[k]] + for (let i = 1; i < len; i++) { + const codec = codecs[i] + const ctags = getTags(codec) + const values = ctags[k] + // tslint:disable-next-line: strict-type-predicates + if (values === undefined) { + continue keys + } else { + if (values.some((v) => all.indexOf(v) !== -1)) { + continue keys + } else { + all.push(...values) + index.push(values) + } + } + } + return [k, index] } + return undefined } // ------------------------------------------------------------------------------------- @@ -246,6 +744,7 @@ const pushAll = (xs: Array, ys: Array): void => { // ------------------------------------------------------------------------------------- /** + * @category primitives * @since 1.0.0 */ export class NullType extends Type { @@ -264,17 +763,19 @@ export class NullType extends Type { } /** + * @category primitives * @since 1.5.3 */ export interface NullC extends NullType {} /** - * @category Primitives + * @category primitives * @since 1.0.0 */ export const nullType: NullC = new NullType() /** + * @category primitives * @since 1.0.0 */ export class UndefinedType extends Type { @@ -293,6 +794,7 @@ export class UndefinedType extends Type { } /** + * @category primitives * @since 1.5.3 */ export interface UndefinedC extends UndefinedType {} @@ -300,6 +802,7 @@ export interface UndefinedC extends UndefinedType {} const undefinedType: UndefinedC = new UndefinedType() /** + * @category primitives * @since 1.2.0 */ export class VoidType extends Type { @@ -313,17 +816,19 @@ export class VoidType extends Type { } /** + * @category primitives * @since 1.5.3 */ export interface VoidC extends VoidType {} /** - * @category Primitives + * @category primitives * @since 1.2.0 */ export const voidType: VoidC = new VoidType() /** + * @category primitives * @since 1.5.0 */ export class UnknownType extends Type { @@ -337,17 +842,19 @@ export class UnknownType extends Type { } /** + * @category primitives * @since 1.5.3 */ export interface UnknownC extends UnknownType {} /** - * @category Primitives + * @category primitives * @since 1.5.0 */ export const unknown: UnknownC = new UnknownType() /** + * @category primitives * @since 1.0.0 */ export class StringType extends Type { @@ -366,17 +873,19 @@ export class StringType extends Type { } /** + * @category primitives * @since 1.5.3 */ export interface StringC extends StringType {} /** - * @category Primitives + * @category primitives * @since 1.0.0 */ export const string: StringC = new StringType() /** + * @category primitives * @since 1.0.0 */ export class NumberType extends Type { @@ -395,17 +904,19 @@ export class NumberType extends Type { } /** + * @category primitives * @since 1.5.3 */ export interface NumberC extends NumberType {} /** - * @category Primitives + * @category primitives * @since 1.0.0 */ export const number: NumberC = new NumberType() /** + * @category primitives * @since 2.1.0 */ export class BigIntType extends Type { @@ -425,17 +936,19 @@ export class BigIntType extends Type { } /** + * @category primitives * @since 2.1.0 */ export interface BigIntC extends BigIntType {} /** - * @category Primitives + * @category primitives * @since 2.1.0 */ export const bigint: BigIntC = new BigIntType() /** + * @category primitives * @since 1.0.0 */ export class BooleanType extends Type { @@ -454,17 +967,19 @@ export class BooleanType extends Type { } /** + * @category primitives * @since 1.5.3 */ export interface BooleanC extends BooleanType {} /** - * @category Primitives + * @category primitives * @since 1.0.0 */ export const boolean: BooleanC = new BooleanType() /** + * @category primitives * @since 1.0.0 */ export class AnyArrayType extends Type> { @@ -478,17 +993,19 @@ export class AnyArrayType extends Type> { } /** + * @category primitives * @since 1.5.3 */ export interface UnknownArrayC extends AnyArrayType {} /** - * @category Primitives + * @category primitives * @since 1.7.1 */ export const UnknownArray: UnknownArrayC = new AnyArrayType() /** + * @category primitives * @since 1.0.0 */ export class AnyDictionaryType extends Type<{ [key: string]: unknown }> { @@ -510,54 +1027,116 @@ export class AnyDictionaryType extends Type<{ [key: string]: unknown }> { } /** - * @category Primitives - * @since 1.7.1 + * @category primitives + * @since 1.5.3 */ -export const UnknownRecord: UnknownRecordC = new AnyDictionaryType() +export interface UnknownRecordC extends AnyDictionaryType {} + +export { + /** + * @category primitives + * @since 1.0.0 + */ + nullType as null, + /** + * @category primitives + * @since 1.0.0 + */ + undefinedType as undefined, + /** + * @category primitives + * @since 1.0.0 + */ + voidType as void +} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +type LiteralValue = string | number | boolean + +/** + * @category constructors + * @since 1.0.0 + */ +export class LiteralType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'LiteralType' = 'LiteralType' + constructor( + name: string, + is: LiteralType['is'], + validate: LiteralType['validate'], + encode: LiteralType['encode'], + readonly value: V + ) { + super(name, is, validate, encode) + } +} /** + * @category constructors * @since 1.5.3 */ -export interface UnknownRecordC extends AnyDictionaryType {} +export interface LiteralC extends LiteralType {} /** - * @category deprecated + * @category constructors * @since 1.0.0 - * @deprecated */ -export class FunctionType extends Type { +export function literal(value: V, name: string = JSON.stringify(value)): LiteralC { + const is = (u: unknown): u is V => u === value + return new LiteralType(name, is, (u, c) => (is(u) ? success(value) : failure(u, c)), identity, value) +} + +/** + * @category constructors + * @since 1.0.0 + */ +export class KeyofType extends Type { /** * @since 1.0.0 */ - readonly _tag: 'FunctionType' = 'FunctionType' - constructor() { - super( - 'Function', - // tslint:disable-next-line:strict-type-predicates - (u): u is Function => typeof u === 'function', - (u, c) => (this.is(u) ? success(u) : failure(u, c)), - identity - ) + readonly _tag: 'KeyofType' = 'KeyofType' + constructor( + name: string, + is: KeyofType['is'], + validate: KeyofType['validate'], + encode: KeyofType['encode'], + readonly keys: D + ) { + super(name, is, validate, encode) } } /** - * @category deprecated + * @category constructors * @since 1.5.3 - * @deprecated */ -// tslint:disable-next-line: deprecation -export interface FunctionC extends FunctionType {} +export interface KeyofC extends KeyofType {} /** - * @category deprecated + * @category constructors * @since 1.0.0 - * @deprecated */ -// tslint:disable-next-line: deprecation -export const Function: FunctionC = new FunctionType() +export function keyof( + keys: D, + name: string = Object.keys(keys) + .map((k) => JSON.stringify(k)) + .join(' | ') +): KeyofC { + const is = (u: unknown): u is keyof D => string.is(u) && hasOwnProperty.call(keys, u) + return new KeyofType(name, is, (u, c) => (is(u) ? success(u) : failure(u, c)), identity, keys) +} + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- /** + * @category combinators * @since 1.0.0 */ export class RefinementType extends Type { @@ -580,6 +1159,7 @@ export class RefinementType extends declare const _brand: unique symbol /** + * @category combinators * @since 1.8.1 */ export interface Brand { @@ -587,128 +1167,60 @@ export interface Brand { } /** + * @category combinators * @since 1.8.1 */ export type Branded = A & Brand /** + * @category combinators * @since 1.8.1 */ export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- - /** - * @category Combinators + * @category combinators * @since 1.8.1 */ -export const brand = ( +export function brand( codec: C, predicate: Refinement, Branded, B>>, name: N -): BrandC => { +): BrandC { // tslint:disable-next-line: deprecation return refinement(codec, predicate, name) } /** - * @since 1.8.1 - */ -export interface IntBrand { - readonly Int: unique symbol -} - -/** - * A branded codec representing an integer - * - * @category Primitives - * @since 1.8.1 - */ -export const Int = brand(number, (n): n is Branded => Number.isInteger(n), 'Int') - -/** - * @since 1.8.1 - */ -export type Int = Branded - -type LiteralValue = string | number | boolean - -/** - * @since 1.0.0 - */ -export class LiteralType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'LiteralType' = 'LiteralType' - constructor( - name: string, - is: LiteralType['is'], - validate: LiteralType['validate'], - encode: LiteralType['encode'], - readonly value: V - ) { - super(name, is, validate, encode) - } -} - -/** - * @since 1.5.3 - */ -export interface LiteralC extends LiteralType {} - -/** - * @category Combinators - * @since 1.0.0 + * @category primitives + * @since 1.7.1 */ -export const literal = (value: V, name: string = JSON.stringify(value)): LiteralC => { - const is = (u: unknown): u is V => u === value - return new LiteralType(name, is, (u, c) => (is(u) ? success(value) : failure(u, c)), identity, value) -} +export const UnknownRecord: UnknownRecordC = new AnyDictionaryType() /** - * @since 1.0.0 + * @category primitives + * @since 1.8.1 */ -export class KeyofType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'KeyofType' = 'KeyofType' - constructor( - name: string, - is: KeyofType['is'], - validate: KeyofType['validate'], - encode: KeyofType['encode'], - readonly keys: D - ) { - super(name, is, validate, encode) - } +export interface IntBrand { + readonly Int: unique symbol } -const hasOwnProperty = Object.prototype.hasOwnProperty - /** - * @since 1.5.3 + * A branded codec representing an integer + * + * @category primitives + * @since 1.8.1 */ -export interface KeyofC extends KeyofType {} +export const Int = brand(number, (n): n is Branded => Number.isInteger(n), 'Int') /** - * @category Combinators - * @since 1.0.0 + * @category primitives + * @since 1.8.1 */ -export const keyof = ( - keys: D, - name: string = Object.keys(keys) - .map((k) => JSON.stringify(k)) - .join(' | ') -): KeyofC => { - const is = (u: unknown): u is keyof D => string.is(u) && hasOwnProperty.call(keys, u) - return new KeyofType(name, is, (u, c) => (is(u) ? success(u) : failure(u, c)), identity, keys) -} +export type Int = Branded /** + * @category combinators * @since 1.0.0 */ export class RecursiveType extends Type { @@ -740,13 +1252,13 @@ Object.defineProperty(RecursiveType.prototype, 'type', { }) /** - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const recursion = = Type>( +export function recursion = Type>( name: string, definition: (self: C) => C -): RecursiveType => { +): RecursiveType { let cache: C const runDefinition = (): C => { if (!cache) { @@ -766,6 +1278,7 @@ export const recursion = = Type< } /** + * @category combinators * @since 1.0.0 */ export class ArrayType extends Type { @@ -785,16 +1298,17 @@ export class ArrayType extends Type< } /** + * @category combinators * @since 1.5.3 */ export interface ArrayC extends ArrayType>, Array>, unknown> {} /** - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const array = (item: C, name: string = `Array<${item.name}>`): ArrayC => - new ArrayType( +export function array(item: C, name: string = `Array<${item.name}>`): ArrayC { + return new ArrayType( name, (u): u is Array> => UnknownArray.is(u) && u.every(item.is), (u, c) => { @@ -826,8 +1340,10 @@ export const array = (item: C, name: string = `Array<${item.nam item.encode === identity ? identity : (a) => a.map(item.encode), item ) +} /** + * @category combinators * @since 1.0.0 */ export class InterfaceType extends Type { @@ -847,58 +1363,17 @@ export class InterfaceType extends Type } /** - * @since 1.0.0 - */ -export interface AnyProps { - [key: string]: Any -} - -const getNameFromProps = (props: Props): string => - Object.keys(props) - .map((k) => `${k}: ${props[k].name}`) - .join(', ') - -const useIdentity = (codecs: Array): boolean => { - for (let i = 0; i < codecs.length; i++) { - if (codecs[i].encode !== identity) { - return false - } - } - return true -} - -/** - * @since 1.0.0 - */ -export type TypeOfProps

= { [K in keyof P]: TypeOf } - -/** - * @since 1.0.0 - */ -export type OutputOfProps

= { [K in keyof P]: OutputOf } - -/** - * @since 1.0.0 - */ -export interface Props { - [key: string]: Mixed -} - -/** + * @category combinators * @since 1.5.3 */ export interface TypeC

extends InterfaceType }, { [K in keyof P]: OutputOf }, unknown> {} -const getInterfaceTypeName = (props: Props): string => { - return `{ ${getNameFromProps(props)} }` -} - /** - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const type =

(props: P, name: string = getInterfaceTypeName(props)): TypeC

=> { +export function type

(props: P, name: string = getInterfaceTypeName(props)): TypeC

{ const keys = Object.keys(props) const types = keys.map((key) => props[key]) const len = keys.length @@ -963,6 +1438,7 @@ export const type =

(props: P, name: string = getInterfaceTypeN } /** + * @category combinators * @since 1.0.0 */ export class PartialType extends Type { @@ -982,33 +1458,20 @@ export class PartialType extends Type { } /** - * @since 1.0.0 - */ -export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } - -/** - * @since 1.0.0 - */ -export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } - -/** + * @category combinators * @since 1.5.3 */ export interface PartialC

extends PartialType }, { [K in keyof P]?: OutputOf }, unknown> {} -const getPartialTypeName = (inner: string): string => { - return `Partial<${inner}>` -} - /** - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const partial =

( +export function partial

( props: P, name: string = getPartialTypeName(getInterfaceTypeName(props)) -): PartialC

=> { +): PartialC

{ const keys = Object.keys(props) const types = keys.map((key) => props[key]) const len = keys.length @@ -1046,202 +1509,64 @@ export const partial =

( } } else { const vak = result.right - if (vak !== ak) { - /* istanbul ignore next */ - if (a === o) { - a = { ...o } - } - a[k] = vak - } - } - } - return errors.length > 0 ? failures(errors) : success(a as any) - }, - useIdentity(types) - ? identity - : (a) => { - const s: { [key: string]: any } = { ...a } - for (let i = 0; i < len; i++) { - const k = keys[i] - const ak = a[k] - if (ak !== undefined) { - s[k] = types[i].encode(ak) - } - } - return s as any - }, - props - ) -} - -/** - * @since 1.0.0 - */ -export class DictionaryType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'DictionaryType' = 'DictionaryType' - constructor( - name: string, - is: DictionaryType['is'], - validate: DictionaryType['validate'], - encode: DictionaryType['encode'], - readonly domain: D, - readonly codomain: C - ) { - super(name, is, validate, encode) - } -} - -/** - * @since 1.0.0 - */ -export type TypeOfDictionary = { [K in TypeOf]: TypeOf } - -/** - * @since 1.0.0 - */ -export type OutputOfDictionary = { [K in OutputOf]: OutputOf } - -/** - * @since 1.5.3 - */ -export interface RecordC - extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} - -function enumerableRecord( - keys: Array, - domain: D, - codomain: C, - name: string = `{ [K in ${domain.name}]: ${codomain.name} }` -): RecordC { - const len = keys.length - return new DictionaryType( - name, - (u): u is { [K in TypeOf]: TypeOf } => UnknownRecord.is(u) && keys.every((k) => codomain.is(u[k])), - (u, c) => { - const e = UnknownRecord.validate(u, c) - if (isLeft(e)) { - return e - } - const o = e.right - const a: { [key: string]: any } = {} - const errors: Errors = [] - let changed: boolean = false - for (let i = 0; i < len; i++) { - const k = keys[i] - const ok = o[k] - const codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)) - if (isLeft(codomainResult)) { - pushAll(errors, codomainResult.left) - } else { - const vok = codomainResult.right - changed = changed || vok !== ok - a[k] = vok - } - } - return errors.length > 0 ? failures(errors) : success((changed || Object.keys(o).length !== len ? a : o) as any) - }, - codomain.encode === identity - ? identity - : (a: any) => { - const s: { [key: string]: any } = {} - for (let i = 0; i < len; i++) { - const k = keys[i] - s[k] = codomain.encode(a[k]) - } - return s as any - }, - domain, - codomain - ) -} - -/** - * @internal - */ -export function getDomainKeys(domain: D): Record | undefined { - if (isLiteralC(domain)) { - const literal = domain.value - if (string.is(literal)) { - return { [literal]: null } - } - } else if (isKeyofC(domain)) { - return domain.keys - } else if (isUnionC(domain)) { - const keys = domain.types.map((type) => getDomainKeys(type)) - return keys.some(undefinedType.is) ? undefined : Object.assign({}, ...keys) - } - return undefined -} - -function nonEnumerableRecord( - domain: D, - codomain: C, - name: string = `{ [K in ${domain.name}]: ${codomain.name} }` -): RecordC { - return new DictionaryType( - name, - (u): u is { [K in TypeOf]: TypeOf } => { - if (UnknownRecord.is(u)) { - return Object.keys(u).every((k) => domain.is(k) && codomain.is(u[k])) - } - return isAnyC(codomain) && Array.isArray(u) - }, - (u, c) => { - if (UnknownRecord.is(u)) { - const a: { [key: string]: any } = {} - const errors: Errors = [] - const keys = Object.keys(u) - const len = keys.length - let changed: boolean = false - for (let i = 0; i < len; i++) { - let k = keys[i] - const ok = u[k] - const domainResult = domain.validate(k, appendContext(c, k, domain, k)) - if (isLeft(domainResult)) { - pushAll(errors, domainResult.left) - } else { - const vk = domainResult.right - changed = changed || vk !== k - k = vk - const codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)) - if (isLeft(codomainResult)) { - pushAll(errors, codomainResult.left) - } else { - const vok = codomainResult.right - changed = changed || vok !== ok - a[k] = vok + if (vak !== ak) { + /* istanbul ignore next */ + if (a === o) { + a = { ...o } } + a[k] = vak } } - return errors.length > 0 ? failures(errors) : success((changed ? a : u) as any) - } - if (isAnyC(codomain) && Array.isArray(u)) { - return success(u) } - return failure(u, c) + return errors.length > 0 ? failures(errors) : success(a as any) }, - domain.encode === identity && codomain.encode === identity + useIdentity(types) ? identity : (a) => { - const s: { [key: string]: any } = {} - const keys = Object.keys(a) - const len = keys.length + const s: { [key: string]: any } = { ...a } for (let i = 0; i < len; i++) { const k = keys[i] - s[String(domain.encode(k))] = codomain.encode(a[k]) + const ak = a[k] + if (ak !== undefined) { + s[k] = types[i].encode(ak) + } } return s as any }, - domain, - codomain + props ) } /** - * @category Combinators + * @category combinators + * @since 1.0.0 + */ +export class DictionaryType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'DictionaryType' = 'DictionaryType' + constructor( + name: string, + is: DictionaryType['is'], + validate: DictionaryType['validate'], + encode: DictionaryType['encode'], + readonly domain: D, + readonly codomain: C + ) { + super(name, is, validate, encode) + } +} + +/** + * @category combinators + * @since 1.5.3 + */ +export interface RecordC + extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} + +/** + * @category combinators * @since 1.7.1 */ export function record(domain: D, codomain: C, name?: string): RecordC { @@ -1252,6 +1577,7 @@ export function record(domain: D, codomain: C, } /** + * @category combinators * @since 1.0.0 */ export class UnionType, A = any, O = A, I = unknown> extends Type { @@ -1271,23 +1597,20 @@ export class UnionType, A = any, O = A, I = unknown> exten } /** + * @category combinators * @since 1.5.3 */ export interface UnionC]> extends UnionType, OutputOf, unknown> {} -const getUnionName = ]>(codecs: CS): string => { - return '(' + codecs.map((type) => type.name).join(' | ') + ')' -} - /** - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const union = ]>( +export function union]>( codecs: CS, name: string = getUnionName(codecs) -): UnionC => { +): UnionC { const index = getIndex(codecs) if (index !== undefined && codecs.length > 0) { const [tag, groups] = index @@ -1371,6 +1694,7 @@ export const union = ]>( } /** + * @category combinators * @since 1.0.0 */ export class IntersectionType, A = any, O = A, I = unknown> extends Type { @@ -1390,6 +1714,7 @@ export class IntersectionType, A = any, O = A, I = unknown } /** + * @category combinators * @since 1.5.3 */ export interface IntersectionC]> @@ -1417,38 +1742,7 @@ export interface IntersectionC]> > {} /** - * @internal - */ -export const mergeAll = (base: any, us: Array): any => { - let equal = true - let primitive = true - const baseIsNotADictionary = !UnknownRecord.is(base) - for (const u of us) { - if (u !== base) { - equal = false - } - if (UnknownRecord.is(u)) { - primitive = false - } - } - if (equal) { - return base - } else if (primitive) { - return us[us.length - 1] - } - let r: any = {} - for (const u of us) { - for (const k in u) { - if (!r.hasOwnProperty(k) || baseIsNotADictionary || u[k] !== base[k]) { - r[k] = u[k] - } - } - } - return r -} - -/** - * @category Combinators + * @category combinators * @since 1.0.0 */ export function intersection( @@ -1500,6 +1794,7 @@ export function intersection]>( } /** + * @category combinators * @since 1.0.0 */ export class TupleType, A = any, O = A, I = unknown> extends Type { @@ -1519,6 +1814,7 @@ export class TupleType, A = any, O = A, I = unknown> exten } /** + * @category combinators * @since 1.5.3 */ export interface TupleC]> @@ -1550,7 +1846,7 @@ export interface TupleC]> > {} /** - * @category Combinators + * @category combinators * @since 1.0.0 */ export function tuple( @@ -1608,6 +1904,7 @@ export function tuple]>( } /** + * @category combinators * @since 1.0.0 */ export class ReadonlyType extends Type { @@ -1627,20 +1924,22 @@ export class ReadonlyType extends Ty } /** + * @category combinators * @since 1.5.3 */ export interface ReadonlyC extends ReadonlyType>, Readonly>, unknown> {} /** - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const readonly = (codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC => { +export function readonly(codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC { return new ReadonlyType(name, codec.is, codec.validate, codec.encode, codec) } /** + * @category combinators * @since 1.0.0 */ export class ReadonlyArrayType extends Type { @@ -1660,19 +1959,20 @@ export class ReadonlyArrayType exten } /** + * @category combinators * @since 1.5.3 */ export interface ReadonlyArrayC extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} /** - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const readonlyArray = ( +export function readonlyArray( item: C, name: string = `ReadonlyArray<${item.name}>` -): ReadonlyArrayC => { +): ReadonlyArrayC { const codec = array(item) return new ReadonlyArrayType(name, codec.is, codec.validate, codec.encode, item) as any } @@ -1680,73 +1980,13 @@ export const readonlyArray = ( /** * Strips additional properties * - * @category Combinators + * @category combinators * @since 1.0.0 */ -export const strict =

(props: P, name?: string): ExactC> => { - return exact(type(props), name) -} - -/** - * @category deprecated - * @since 1.3.0 - * @deprecated - */ -export class TaggedUnionType< - Tag extends string, - CS extends Array, - A = any, - O = A, - I = unknown -> extends UnionType { - constructor( - name: string, - // tslint:disable-next-line: deprecation - is: TaggedUnionType['is'], - // tslint:disable-next-line: deprecation - validate: TaggedUnionType['validate'], - // tslint:disable-next-line: deprecation - encode: TaggedUnionType['encode'], - codecs: CS, - readonly tag: Tag - ) { - super(name, is, validate, encode, codecs) /* istanbul ignore next */ // <= workaround for https://github.com/Microsoft/TypeScript/issues/13455 - } -} - -/** - * @category deprecated - * @since 1.5.3 - * @deprecated - */ -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation - extends TaggedUnionType, OutputOf, unknown> {} - -/** - * Use `union` instead - * - * @category deprecated - * @since 1.3.0 - * @deprecated - */ -export const taggedUnion = ]>( - tag: Tag, - codecs: CS, - name: string = getUnionName(codecs) - // tslint:disable-next-line: deprecation -): TaggedUnionC => { - const U = union(codecs, name) - // tslint:disable-next-line: deprecation - if (U instanceof TaggedUnionType) { - return U - } else { - console.warn(`[io-ts] Cannot build a tagged union for ${name}, returning a de-optimized union`) - // tslint:disable-next-line: deprecation - return new TaggedUnionType(name, U.is, U.validate, U.encode, codecs, tag) - } -} +export const strict =

(props: P, name?: string): ExactC> => exact(type(props), name) /** + * @category combinators * @since 1.1.0 */ export class ExactType extends Type { @@ -1766,109 +2006,136 @@ export class ExactType extends Type< } /** - * @since 1.1.0 - */ -export interface HasPropsRefinement extends RefinementType {} -/** - * @since 1.1.0 + * @category combinators + * @since 1.5.3 */ -export interface HasPropsReadonly extends ReadonlyType {} +export interface ExactC extends ExactType, OutputOf, InputOf> {} + /** + * Strips additional properties + * + * @category combinators * @since 1.1.0 */ -export interface HasPropsIntersection extends IntersectionType, any, any, any> {} +export function exact(codec: C, name: string = getExactTypeName(codec)): ExactC { + const props: Props = getProps(codec) + return new ExactType( + name, + codec.is, + (u, c) => { + const e = UnknownRecord.validate(u, c) + if (isLeft(e)) { + return e + } + const ce = codec.validate(u, c) + if (isLeft(ce)) { + return ce + } + return right(stripKeys(ce.right, props)) + }, + (a) => codec.encode(stripKeys(a, props)), + codec + ) +} + +// ------------------------------------------------------------------------------------- +// deprecated +// ------------------------------------------------------------------------------------- + /** - * @since 1.1.0 + * @category deprecated + * @since 1.0.0 + * @deprecated */ -export type HasProps = - | HasPropsRefinement - | HasPropsReadonly - | HasPropsIntersection - | InterfaceType - // tslint:disable-next-line: deprecation - | StrictType - | PartialType - -const getProps = (codec: HasProps): Props => { - switch (codec._tag) { - case 'RefinementType': - case 'ReadonlyType': - return getProps(codec.type) - case 'InterfaceType': - case 'StrictType': - case 'PartialType': - return codec.props - case 'IntersectionType': - return codec.types.reduce((props, type) => Object.assign(props, getProps(type)), {}) +export class FunctionType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'FunctionType' = 'FunctionType' + constructor() { + super( + 'Function', + // tslint:disable-next-line:strict-type-predicates + (u): u is Function => typeof u === 'function', + (u, c) => (this.is(u) ? success(u) : failure(u, c)), + identity + ) } } /** + * @category deprecated * @since 1.5.3 + * @deprecated */ -export interface ExactC extends ExactType, OutputOf, InputOf> {} +// tslint:disable-next-line: deprecation +export interface FunctionC extends FunctionType {} -const stripKeys = (o: any, props: Props): unknown => { - const keys = Object.getOwnPropertyNames(o) - let shouldStrip = false - const r: any = {} - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - if (!hasOwnProperty.call(props, key)) { - shouldStrip = true - } else { - r[key] = o[key] - } - } - return shouldStrip ? r : o -} +/** + * @category deprecated + * @since 1.0.0 + * @deprecated + */ +// tslint:disable-next-line: deprecation +export const Function: FunctionC = new FunctionType() -const getExactTypeName = (codec: Any): string => { - if (isTypeC(codec)) { - return `{| ${getNameFromProps(codec.props)} |}` - } else if (isPartialC(codec)) { - return getPartialTypeName(`{| ${getNameFromProps(codec.props)} |}`) +/** + * @category deprecated + * @since 1.3.0 + * @deprecated + */ +export class TaggedUnionType< + Tag extends string, + CS extends Array, + A = any, + O = A, + I = unknown +> extends UnionType { + constructor( + name: string, + // tslint:disable-next-line: deprecation + is: TaggedUnionType['is'], + // tslint:disable-next-line: deprecation + validate: TaggedUnionType['validate'], + // tslint:disable-next-line: deprecation + encode: TaggedUnionType['encode'], + codecs: CS, + readonly tag: Tag + ) { + super(name, is, validate, encode, codecs) /* istanbul ignore next */ // <= workaround for https://github.com/Microsoft/TypeScript/issues/13455 } - return `Exact<${codec.name}>` } /** - * Strips additional properties - * @since 1.1.0 + * @category deprecated + * @since 1.5.3 + * @deprecated */ -export const exact = (codec: C, name: string = getExactTypeName(codec)): ExactC => { - const props: Props = getProps(codec) - return new ExactType( - name, - codec.is, - (u, c) => { - const e = UnknownRecord.validate(u, c) - if (isLeft(e)) { - return e - } - const ce = codec.validate(u, c) - if (isLeft(ce)) { - return ce - } - return right(stripKeys(ce.right, props)) - }, - (a) => codec.encode(stripKeys(a, props)), - codec - ) -} - -export { - /** - * @since 1.0.0 - */ - nullType as null -} +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation + extends TaggedUnionType, OutputOf, unknown> {} -export { - /** - * @since 1.0.0 - */ - undefinedType as undefined +/** + * Use `union` instead + * + * @category deprecated + * @since 1.3.0 + * @deprecated + */ +export const taggedUnion = ]>( + tag: Tag, + codecs: CS, + name: string = getUnionName(codecs) + // tslint:disable-next-line: deprecation +): TaggedUnionC => { + const U = union(codecs, name) + // tslint:disable-next-line: deprecation + if (U instanceof TaggedUnionType) { + return U + } else { + console.warn(`[io-ts] Cannot build a tagged union for ${name}, returning a de-optimized union`) + // tslint:disable-next-line: deprecation + return new TaggedUnionType(name, U.is, U.validate, U.encode, codecs, tag) + } } export { @@ -1892,16 +2159,6 @@ export { */ type as interface } -export { - /** - * @since 1.0.0 - */ - voidType as void -} - -// -// deprecations -// /** * Use `unknown` instead @@ -2319,184 +2576,3 @@ export function alias( , OO extends Exact = O>() => Type { return () => codec as any } - -interface NonEmptyArray extends Array { - 0: A -} - -const isNonEmpty = (as: Array): as is NonEmptyArray => as.length > 0 - -interface Tags extends Record> {} - -/** - * @internal - */ -export const emptyTags: Tags = {} - -function intersect(a: NonEmptyArray, b: NonEmptyArray): Array { - const r: Array = [] - for (const v of a) { - if (b.indexOf(v) !== -1) { - r.push(v) - } - } - return r -} - -function mergeTags(a: Tags, b: Tags): Tags { - if (a === emptyTags) { - return b - } - if (b === emptyTags) { - return a - } - let r: Tags = Object.assign({}, a) - for (const k in b) { - if (a.hasOwnProperty(k)) { - const intersection = intersect(a[k], b[k]) - if (isNonEmpty(intersection)) { - r[k] = intersection - } else { - r = emptyTags - break - } - } else { - r[k] = b[k] - } - } - return r -} - -function intersectTags(a: Tags, b: Tags): Tags { - if (a === emptyTags || b === emptyTags) { - return emptyTags - } - let r: Tags = emptyTags - for (const k in a) { - if (b.hasOwnProperty(k)) { - const intersection = intersect(a[k], b[k]) - if (intersection.length === 0) { - if (r === emptyTags) { - r = {} - } - r[k] = a[k].concat(b[k]) as any - } - } - } - return r -} - -// tslint:disable-next-line: deprecation -function isAnyC(codec: Any): codec is AnyC { - return (codec as any)._tag === 'AnyType' -} - -function isLiteralC(codec: Any): codec is LiteralC { - return (codec as any)._tag === 'LiteralType' -} - -function isKeyofC(codec: Any): codec is KeyofC> { - return (codec as any)._tag === 'KeyofType' -} - -function isTypeC(codec: Any): codec is TypeC { - return (codec as any)._tag === 'InterfaceType' -} - -function isPartialC(codec: Any): codec is PartialC { - return (codec as any)._tag === 'PartialType' -} - -// tslint:disable-next-line: deprecation -function isStrictC(codec: Any): codec is StrictC { - return (codec as any)._tag === 'StrictType' -} - -function isExactC(codec: Any): codec is ExactC { - return (codec as any)._tag === 'ExactType' -} - -// tslint:disable-next-line: deprecation -function isRefinementC(codec: Any): codec is RefinementC { - return (codec as any)._tag === 'RefinementType' -} - -function isIntersectionC(codec: Any): codec is IntersectionC<[Mixed, Mixed, ...Array]> { - return (codec as any)._tag === 'IntersectionType' -} - -function isUnionC(codec: Any): codec is UnionC<[Mixed, Mixed, ...Array]> { - return (codec as any)._tag === 'UnionType' -} - -function isRecursiveC(codec: Any): codec is RecursiveType { - return (codec as any)._tag === 'RecursiveType' -} - -const lazyCodecs: Array = [] - -/** - * @internal - */ -export function getTags(codec: Any): Tags { - if (lazyCodecs.indexOf(codec) !== -1) { - return emptyTags - } - if (isTypeC(codec) || isStrictC(codec)) { - let index: Tags = emptyTags - // tslint:disable-next-line: forin - for (let k in codec.props) { - const prop = codec.props[k] - if (isLiteralC(prop)) { - if (index === emptyTags) { - index = {} - } - index[k] = [prop.value] - } - } - return index - } else if (isExactC(codec) || isRefinementC(codec)) { - return getTags(codec.type) - } else if (isIntersectionC(codec)) { - return codec.types.reduce((tags, codec) => mergeTags(tags, getTags(codec)), emptyTags) - } else if (isUnionC(codec)) { - return codec.types.slice(1).reduce((tags, codec) => intersectTags(tags, getTags(codec)), getTags(codec.types[0])) - } else if (isRecursiveC(codec)) { - lazyCodecs.push(codec) - const tags = getTags(codec.type) - lazyCodecs.pop() - return tags - } - return emptyTags -} - -/** - * @internal - */ -export function getIndex(codecs: NonEmptyArray): [string, NonEmptyArray>] | undefined { - const tags = getTags(codecs[0]) - const keys = Object.keys(tags) - const len = codecs.length - keys: for (const k of keys) { - const all = tags[k].slice() - const index: NonEmptyArray> = [tags[k]] - for (let i = 1; i < len; i++) { - const codec = codecs[i] - const ctags = getTags(codec) - const values = ctags[k] - // tslint:disable-next-line: strict-type-predicates - if (values === undefined) { - continue keys - } else { - if (values.some((v) => all.indexOf(v) !== -1)) { - continue keys - } else { - all.push(...values) - index.push(values) - } - } - } - return [k, index] - } - return undefined -} diff --git a/tsconfig.json b/tsconfig.json index 082d65dec..7976177fa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,5 +16,5 @@ "stripInternal": true, "lib": ["es2015", "ESNext.BigInt"] }, - "include": ["./src/**/*"] + "include": ["./src", "./test", "./scripts"] } From bc3f69686ffcf60947fbb249dcc35d54e15b759d Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 28 Jan 2021 08:46:13 +0100 Subject: [PATCH 182/222] refactor docs --- docs/modules/index.ts.md | 2023 +++++++++++++++++++------------------- src/index.ts | 153 +-- 2 files changed, 1043 insertions(+), 1133 deletions(-) diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 5bbdab537..e6de5febb 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -13,14 +13,9 @@ Added in v1.0.0

Table of contents

- [Codec](#codec) - - [Any (interface)](#any-interface) - - [Decode (type alias)](#decode-type-alias) - [Decoder (interface)](#decoder-interface) - - [Encode (type alias)](#encode-type-alias) - [Encoder (interface)](#encoder-interface) - [InputOf (type alias)](#inputof-type-alias) - - [Is (type alias)](#is-type-alias) - - [Mixed (interface)](#mixed-interface) - [OutputOf (type alias)](#outputof-type-alias) - [Type (class)](#type-class) - [pipe (method)](#pipe-method) @@ -31,7 +26,6 @@ Added in v1.0.0 - [\_O (property)](#_o-property) - [\_I (property)](#_i-property) - [TypeOf (type alias)](#typeof-type-alias) - - [Validate (type alias)](#validate-type-alias) - [Decode error](#decode-error) - [Context (interface)](#context-interface) - [ContextEntry (interface)](#contextentry-interface) @@ -42,90 +36,167 @@ Added in v1.0.0 - [failures](#failures) - [success](#success) - [combinators](#combinators) + - [array](#array) + - [brand](#brand) + - [exact](#exact) + - [intersection](#intersection) + - [partial](#partial) + - [readonly](#readonly) + - [readonlyArray](#readonlyarray) + - [record](#record) + - [recursion](#recursion) + - [strict](#strict) + - [tuple](#tuple) + - [type](#type) + - [union](#union) + - [~~alias~~](#alias) + - [~~clean~~](#clean) + - [~~dictionary~~](#dictionary) + - [~~interface~~](#interface) + - [~~refinement~~](#refinement) + - [~~taggedUnion~~](#taggedunion) +- [constructors](#constructors) + - [keyof](#keyof) + - [literal](#literal) +- [primitives](#primitives) + - [Int](#int) + - [UnknownArray](#unknownarray) + - [UnknownRecord](#unknownrecord) + - [bigint](#bigint) + - [boolean](#boolean) + - [null](#null) + - [nullType](#nulltype) + - [number](#number) + - [string](#string) + - [undefined](#undefined) + - [unknown](#unknown) + - [void](#void) + - [voidType](#voidtype) + - [~~Array~~](#array) + - [~~Dictionary~~](#dictionary) + - [~~Function~~](#function) + - [~~Integer~~](#integer) + - [~~any~~](#any) + - [~~never~~](#never) + - [~~object~~](#object) +- [utils](#utils) + - [Any (interface)](#any-interface) + - [AnyArrayType (class)](#anyarraytype-class) + - [\_tag (property)](#_tag-property) + - [AnyDictionaryType (class)](#anydictionarytype-class) + - [\_tag (property)](#_tag-property-1) + - [AnyProps (interface)](#anyprops-interface) - [ArrayC (interface)](#arrayc-interface) - [ArrayType (class)](#arraytype-class) - - [\_tag (property)](#_tag-property) + - [\_tag (property)](#_tag-property-2) + - [BigIntC (interface)](#bigintc-interface) + - [BigIntType (class)](#biginttype-class) + - [\_tag (property)](#_tag-property-3) + - [BooleanC (interface)](#booleanc-interface) + - [BooleanType (class)](#booleantype-class) + - [\_tag (property)](#_tag-property-4) - [Brand (interface)](#brand-interface) - [BrandC (interface)](#brandc-interface) - [Branded (type alias)](#branded-type-alias) + - [Decode (type alias)](#decode-type-alias) - [DictionaryType (class)](#dictionarytype-class) - - [\_tag (property)](#_tag-property-1) + - [\_tag (property)](#_tag-property-5) + - [Encode (type alias)](#encode-type-alias) - [ExactC (interface)](#exactc-interface) - [ExactType (class)](#exacttype-class) - - [\_tag (property)](#_tag-property-2) + - [\_tag (property)](#_tag-property-6) + - [HasProps (type alias)](#hasprops-type-alias) + - [HasPropsIntersection (interface)](#haspropsintersection-interface) + - [HasPropsReadonly (interface)](#haspropsreadonly-interface) + - [HasPropsRefinement (interface)](#haspropsrefinement-interface) + - [Int (type alias)](#int-type-alias) + - [IntBrand (interface)](#intbrand-interface) - [InterfaceType (class)](#interfacetype-class) - - [\_tag (property)](#_tag-property-3) + - [\_tag (property)](#_tag-property-7) - [IntersectionC (interface)](#intersectionc-interface) - [IntersectionType (class)](#intersectiontype-class) - - [\_tag (property)](#_tag-property-4) + - [\_tag (property)](#_tag-property-8) + - [Is (type alias)](#is-type-alias) + - [KeyofC (interface)](#keyofc-interface) + - [KeyofType (class)](#keyoftype-class) + - [\_tag (property)](#_tag-property-9) + - [LiteralC (interface)](#literalc-interface) + - [LiteralType (class)](#literaltype-class) + - [\_tag (property)](#_tag-property-10) + - [Mixed (interface)](#mixed-interface) + - [NullC (interface)](#nullc-interface) + - [NullType (class)](#nulltype-class) + - [\_tag (property)](#_tag-property-11) + - [NumberC (interface)](#numberc-interface) + - [NumberType (class)](#numbertype-class) + - [\_tag (property)](#_tag-property-12) + - [OutputOfDictionary (type alias)](#outputofdictionary-type-alias) + - [OutputOfPartialProps (type alias)](#outputofpartialprops-type-alias) + - [OutputOfProps (type alias)](#outputofprops-type-alias) - [PartialC (interface)](#partialc-interface) - [PartialType (class)](#partialtype-class) - - [\_tag (property)](#_tag-property-5) + - [\_tag (property)](#_tag-property-13) + - [Props (interface)](#props-interface) - [ReadonlyArrayC (interface)](#readonlyarrayc-interface) - [ReadonlyArrayType (class)](#readonlyarraytype-class) - - [\_tag (property)](#_tag-property-6) + - [\_tag (property)](#_tag-property-14) - [ReadonlyC (interface)](#readonlyc-interface) - [ReadonlyType (class)](#readonlytype-class) - - [\_tag (property)](#_tag-property-7) + - [\_tag (property)](#_tag-property-15) - [RecordC (interface)](#recordc-interface) - [RecursiveType (class)](#recursivetype-class) - - [\_tag (property)](#_tag-property-8) + - [\_tag (property)](#_tag-property-16) - [type (property)](#type-property) - [RefinementType (class)](#refinementtype-class) - - [\_tag (property)](#_tag-property-9) + - [\_tag (property)](#_tag-property-17) + - [StringC (interface)](#stringc-interface) + - [StringType (class)](#stringtype-class) + - [\_tag (property)](#_tag-property-18) - [TupleC (interface)](#tuplec-interface) - [TupleType (class)](#tupletype-class) - - [\_tag (property)](#_tag-property-10) + - [\_tag (property)](#_tag-property-19) - [TypeC (interface)](#typec-interface) + - [TypeOfDictionary (type alias)](#typeofdictionary-type-alias) + - [TypeOfPartialProps (type alias)](#typeofpartialprops-type-alias) + - [TypeOfProps (type alias)](#typeofprops-type-alias) + - [UndefinedC (interface)](#undefinedc-interface) + - [UndefinedType (class)](#undefinedtype-class) + - [\_tag (property)](#_tag-property-20) - [UnionC (interface)](#unionc-interface) - [UnionType (class)](#uniontype-class) - - [\_tag (property)](#_tag-property-11) - - [array](#array) - - [brand](#brand) - - [exact](#exact) - - [intersection](#intersection) - - [partial](#partial) - - [readonly](#readonly) - - [readonlyArray](#readonlyarray) - - [record](#record) - - [recursion](#recursion) - - [strict](#strict) - - [tuple](#tuple) - - [type](#type) - - [union](#union) -- [constructors](#constructors) - - [KeyofC (interface)](#keyofc-interface) - - [KeyofType (class)](#keyoftype-class) - - [\_tag (property)](#_tag-property-12) - - [LiteralC (interface)](#literalc-interface) - - [LiteralType (class)](#literaltype-class) - - [\_tag (property)](#_tag-property-13) - - [keyof](#keyof) - - [literal](#literal) -- [deprecated](#deprecated) + - [\_tag (property)](#_tag-property-21) + - [UnknownArrayC (interface)](#unknownarrayc-interface) + - [UnknownC (interface)](#unknownc-interface) + - [UnknownRecordC (interface)](#unknownrecordc-interface) + - [UnknownType (class)](#unknowntype-class) + - [\_tag (property)](#_tag-property-22) + - [Validate (type alias)](#validate-type-alias) + - [VoidC (interface)](#voidc-interface) + - [VoidType (class)](#voidtype-class) + - [\_tag (property)](#_tag-property-23) + - [appendContext](#appendcontext) + - [getContextEntry](#getcontextentry) + - [getFunctionName](#getfunctionname) + - [identity](#identity) - [~~AnyC~~ (interface)](#anyc-interface) - [~~AnyType~~ (class)](#anytype-class) - - [\_tag (property)](#_tag-property-14) - - [~~Array~~](#array) + - [\_tag (property)](#_tag-property-24) - [~~Compact~~ (type alias)](#compact-type-alias) - - [~~Dictionary~~](#dictionary) - [~~Exact~~ (type alias)](#exact-type-alias) - [~~FunctionC~~ (interface)](#functionc-interface) - [~~FunctionType~~ (class)](#functiontype-class) - - [\_tag (property)](#_tag-property-15) - - [~~Function~~](#function) - - [~~Integer~~](#integer) + - [\_tag (property)](#_tag-property-25) - [~~NeverC~~ (interface)](#neverc-interface) - [~~NeverType~~ (class)](#nevertype-class) - - [\_tag (property)](#_tag-property-16) + - [\_tag (property)](#_tag-property-26) - [~~ObjectC~~ (interface)](#objectc-interface) - [~~ObjectType~~ (class)](#objecttype-class) - - [\_tag (property)](#_tag-property-17) + - [\_tag (property)](#_tag-property-27) - [~~PropsOf~~ (type alias)](#propsof-type-alias) - [~~RefinementC~~ (interface)](#refinementc-interface) - [~~StrictC~~ (interface)](#strictc-interface) - [~~StrictType~~ (class)](#stricttype-class) - - [\_tag (property)](#_tag-property-18) + - [\_tag (property)](#_tag-property-28) - [~~TaggedExact~~ (interface)](#taggedexact-interface) - [~~TaggedIntersectionArgument~~ (type alias)](#taggedintersectionargument-type-alias) - [~~TaggedIntersection~~ (interface)](#taggedintersection-interface) @@ -135,106 +206,14 @@ Added in v1.0.0 - [~~TaggedUnionType~~ (class)](#taggeduniontype-class) - [~~TaggedUnion~~ (interface)](#taggedunion-interface) - [~~Tagged~~ (type alias)](#tagged-type-alias) - - [~~alias~~](#alias) - - [~~any~~](#any) - - [~~clean~~](#clean) - - [~~dictionary~~](#dictionary) - [~~getDefaultContext~~](#getdefaultcontext) - [~~getValidationError~~](#getvalidationerror) - - [~~interface~~](#interface) - [~~mixed~~ (type alias)](#mixed-type-alias) - - [~~never~~](#never) - - [~~object~~](#object) - - [~~refinement~~](#refinement) - - [~~taggedUnion~~](#taggedunion) -- [primitives](#primitives) - - [AnyArrayType (class)](#anyarraytype-class) - - [\_tag (property)](#_tag-property-19) - - [AnyDictionaryType (class)](#anydictionarytype-class) - - [\_tag (property)](#_tag-property-20) - - [BigIntC (interface)](#bigintc-interface) - - [BigIntType (class)](#biginttype-class) - - [\_tag (property)](#_tag-property-21) - - [BooleanC (interface)](#booleanc-interface) - - [BooleanType (class)](#booleantype-class) - - [\_tag (property)](#_tag-property-22) - - [Int](#int) - - [Int (type alias)](#int-type-alias) - - [IntBrand (interface)](#intbrand-interface) - - [NullC (interface)](#nullc-interface) - - [NullType (class)](#nulltype-class) - - [\_tag (property)](#_tag-property-23) - - [NumberC (interface)](#numberc-interface) - - [NumberType (class)](#numbertype-class) - - [\_tag (property)](#_tag-property-24) - - [StringC (interface)](#stringc-interface) - - [StringType (class)](#stringtype-class) - - [\_tag (property)](#_tag-property-25) - - [UndefinedC (interface)](#undefinedc-interface) - - [UndefinedType (class)](#undefinedtype-class) - - [\_tag (property)](#_tag-property-26) - - [UnknownArray](#unknownarray) - - [UnknownArrayC (interface)](#unknownarrayc-interface) - - [UnknownC (interface)](#unknownc-interface) - - [UnknownRecord](#unknownrecord) - - [UnknownRecordC (interface)](#unknownrecordc-interface) - - [UnknownType (class)](#unknowntype-class) - - [\_tag (property)](#_tag-property-27) - - [VoidC (interface)](#voidc-interface) - - [VoidType (class)](#voidtype-class) - - [\_tag (property)](#_tag-property-28) - - [bigint](#bigint) - - [boolean](#boolean) - - [null](#null) - - [nullType](#nulltype) - - [number](#number) - - [string](#string) - - [undefined](#undefined) - - [unknown](#unknown) - - [void](#void) - - [voidType](#voidtype) -- [utils](#utils) - - [AnyProps (interface)](#anyprops-interface) - - [HasProps (type alias)](#hasprops-type-alias) - - [HasPropsIntersection (interface)](#haspropsintersection-interface) - - [HasPropsReadonly (interface)](#haspropsreadonly-interface) - - [HasPropsRefinement (interface)](#haspropsrefinement-interface) - - [OutputOfDictionary (type alias)](#outputofdictionary-type-alias) - - [OutputOfPartialProps (type alias)](#outputofpartialprops-type-alias) - - [OutputOfProps (type alias)](#outputofprops-type-alias) - - [Props (interface)](#props-interface) - - [TypeOfDictionary (type alias)](#typeofdictionary-type-alias) - - [TypeOfPartialProps (type alias)](#typeofpartialprops-type-alias) - - [TypeOfProps (type alias)](#typeofprops-type-alias) - - [appendContext](#appendcontext) - - [getContextEntry](#getcontextentry) - - [getFunctionName](#getfunctionname) - - [identity](#identity) --- # Codec -## Any (interface) - -**Signature** - -```ts -export interface Any extends Type {} -``` - -Added in v1.0.0 - -## Decode (type alias) - -**Signature** - -```ts -export type Decode = (i: I) => Validation -``` - -Added in v1.0.0 - ## Decoder (interface) **Signature** @@ -249,16 +228,6 @@ export interface Decoder { Added in v1.0.0 -## Encode (type alias) - -**Signature** - -```ts -export type Encode = (a: A) => O -``` - -Added in v1.0.0 - ## Encoder (interface) **Signature** @@ -281,26 +250,6 @@ export type InputOf = C['_I'] Added in v1.0.0 -## Is (type alias) - -**Signature** - -```ts -export type Is = (u: unknown) => u is A -``` - -Added in v1.0.0 - -## Mixed (interface) - -**Signature** - -```ts -export interface Mixed extends Type {} -``` - -Added in v1.0.0 - ## OutputOf (type alias) **Signature** @@ -418,16 +367,6 @@ export type TypeOf = C['_A'] Added in v1.0.0 -## Validate (type alias) - -**Signature** - -```ts -export type Validate = (i: I, context: Context) => Validation -``` - -Added in v1.0.0 - # Decode error ## Context (interface) @@ -524,525 +463,584 @@ Added in v1.0.0 # combinators -## ArrayC (interface) +## array **Signature** ```ts -export interface ArrayC extends ArrayType>, Array>, unknown> {} +export declare function array(item: C, name: string = `Array<${item.name}>`): ArrayC ``` -Added in v1.5.3 +Added in v1.0.0 -## ArrayType (class) +## brand **Signature** ```ts -export declare class ArrayType { - constructor( - name: string, - is: ArrayType['is'], - validate: ArrayType['validate'], - encode: ArrayType['encode'], - readonly type: C - ) -} +export declare function brand( + codec: C, + predicate: Refinement, Branded, B>>, + name: N +): BrandC +``` + +Added in v1.8.1 + +## exact + +Strips additional properties. + +**Signature** + +```ts +export declare function exact(codec: C, name: string = getExactTypeName(codec)): ExactC +``` + +Added in v1.1.0 + +## intersection + +**Signature** + +```ts +export declare function intersection< + A extends Mixed, + B extends Mixed, + C extends Mixed, + D extends Mixed, + E extends Mixed +>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> +export declare function intersection( + codecs: [A, B, C, D], + name?: string +): IntersectionC<[A, B, C, D]> +export declare function intersection( + codecs: [A, B, C], + name?: string +): IntersectionC<[A, B, C]> +export declare function intersection( + codecs: [A, B], + name?: string +): IntersectionC<[A, B]> ``` Added in v1.0.0 -### \_tag (property) +## partial **Signature** ```ts -readonly _tag: "ArrayType" +export declare function partial

( + props: P, + name: string = getPartialTypeName(getInterfaceTypeName(props)) +): PartialC

``` Added in v1.0.0 -## Brand (interface) +## readonly **Signature** ```ts -export interface Brand { - readonly [_brand]: B -} +export declare function readonly(codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC +``` + +Added in v1.0.0 + +## readonlyArray + +**Signature** + +```ts +export declare function readonlyArray( + item: C, + name: string = `ReadonlyArray<${item.name}>` +): ReadonlyArrayC +``` + +Added in v1.0.0 + +## record + +**Signature** + +```ts +export declare function record(domain: D, codomain: C, name?: string): RecordC +``` + +Added in v1.7.1 + +## recursion + +**Signature** + +```ts +export declare function recursion = Type>( + name: string, + definition: (self: C) => C +): RecursiveType +``` + +Added in v1.0.0 + +## strict + +Strips additional properties, equivalent to `exact(type(props))`. + +**Signature** + +```ts +export declare const strict:

(props: P, name?: string) => ExactC> +``` + +Added in v1.0.0 + +## tuple + +**Signature** + +```ts +export declare function tuple( + codecs: [A, B, C, D, E], + name?: string +): TupleC<[A, B, C, D, E]> +export declare function tuple( + codecs: [A, B, C, D], + name?: string +): TupleC<[A, B, C, D]> +export declare function tuple( + codecs: [A, B, C], + name?: string +): TupleC<[A, B, C]> +export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> +export declare function tuple(codecs: [A], name?: string): TupleC<[A]> +``` + +Added in v1.0.0 + +## type + +**Signature** + +```ts +export declare function type

(props: P, name: string = getInterfaceTypeName(props)): TypeC

``` -Added in v1.8.1 +Added in v1.0.0 -## BrandC (interface) +## union **Signature** ```ts -export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} +export declare function union]>( + codecs: CS, + name: string = getUnionName(codecs) +): UnionC ``` -Added in v1.8.1 +Added in v1.0.0 -## Branded (type alias) +## ~~alias~~ + +Keeps the codec "kind". **Signature** ```ts -export type Branded = A & Brand +export declare function alias( + codec: PartialType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => PartialType +export declare function alias( + // tslint:disable-next-line: deprecation + codec: StrictType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => // tslint:disable-next-line: deprecation +StrictType +export declare function alias( + codec: InterfaceType +): < + // tslint:disable-next-line: deprecation + AA extends Exact, + // tslint:disable-next-line: deprecation + OO extends Exact = O, + // tslint:disable-next-line: deprecation + PP extends Exact = P, + II extends I = I +>() => InterfaceType ``` -Added in v1.8.1 +Added in v1.1.0 -## DictionaryType (class) +## ~~clean~~ + +Drops the codec "kind". **Signature** ```ts -export declare class DictionaryType { - constructor( - name: string, - is: DictionaryType['is'], - validate: DictionaryType['validate'], - encode: DictionaryType['encode'], - readonly domain: D, - readonly codomain: C - ) -} +export declare function clean(codec: Type): Type ``` -Added in v1.0.0 +Added in v1.1.0 -### \_tag (property) +## ~~dictionary~~ + +Use `record` instead. **Signature** ```ts -readonly _tag: "DictionaryType" +export declare const dictionary: typeof record ``` Added in v1.0.0 -## ExactC (interface) +## ~~interface~~ + +Use `type` instead. **Signature** ```ts -export interface ExactC extends ExactType, OutputOf, InputOf> {} +export declare const interface: typeof type ``` -Added in v1.5.3 +Added in v1.0.0 -## ExactType (class) +## ~~refinement~~ + +Use `brand` instead. **Signature** ```ts -export declare class ExactType { - constructor( - name: string, - is: ExactType['is'], - validate: ExactType['validate'], - encode: ExactType['encode'], - readonly type: C - ) -} +export declare function refinement( + codec: C, + predicate: Predicate>, + name: string = `(${codec.name} | ${getFunctionName(predicate)})` +): // tslint:disable-next-line: deprecation +RefinementC ``` -Added in v1.1.0 +Added in v1.0.0 -### \_tag (property) +## ~~taggedUnion~~ + +Use `union` instead. **Signature** ```ts -readonly _tag: "ExactType" +export declare const taggedUnion: ( + tag: Tag, + codecs: CS, + name?: string +) => TaggedUnionC ``` -Added in v1.0.0 +Added in v1.3.0 -## InterfaceType (class) +# constructors + +## keyof **Signature** ```ts -export declare class InterfaceType { - constructor( - name: string, - is: InterfaceType['is'], - validate: InterfaceType['validate'], - encode: InterfaceType['encode'], - readonly props: P - ) -} +export declare function keyof( + keys: D, + name: string = Object.keys(keys) + .map((k) => JSON.stringify(k)) + .join(' | ') +): KeyofC ``` Added in v1.0.0 -### \_tag (property) +## literal **Signature** ```ts -readonly _tag: "InterfaceType" +export declare function literal(value: V, name: string = JSON.stringify(value)): LiteralC ``` Added in v1.0.0 -## IntersectionC (interface) +# primitives + +## Int + +A branded codec representing an integer **Signature** ```ts -export interface IntersectionC]> - extends IntersectionType< - CS, - CS extends { length: 2 } - ? TypeOf & TypeOf - : CS extends { length: 3 } - ? TypeOf & TypeOf & TypeOf - : CS extends { length: 4 } - ? TypeOf & TypeOf & TypeOf & TypeOf - : CS extends { length: 5 } - ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf - : unknown, - CS extends { length: 2 } - ? OutputOf & OutputOf - : CS extends { length: 3 } - ? OutputOf & OutputOf & OutputOf - : CS extends { length: 4 } - ? OutputOf & OutputOf & OutputOf & OutputOf - : CS extends { length: 5 } - ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf - : unknown, - unknown - > {} +export declare const Int: BrandC ``` -Added in v1.5.3 +Added in v1.8.1 -## IntersectionType (class) +## UnknownArray **Signature** ```ts -export declare class IntersectionType { - constructor( - name: string, - is: IntersectionType['is'], - validate: IntersectionType['validate'], - encode: IntersectionType['encode'], - readonly types: CS - ) -} +export declare const UnknownArray: UnknownArrayC ``` -Added in v1.0.0 +Added in v1.7.1 -### \_tag (property) +## UnknownRecord **Signature** ```ts -readonly _tag: "IntersectionType" +export declare const UnknownRecord: UnknownRecordC ``` -Added in v1.0.0 +Added in v1.7.1 -## PartialC (interface) +## bigint **Signature** ```ts -export interface PartialC

- extends PartialType }, { [K in keyof P]?: OutputOf }, unknown> {} +export declare const bigint: BigIntC ``` -Added in v1.5.3 +Added in v2.1.0 -## PartialType (class) +## boolean **Signature** ```ts -export declare class PartialType { - constructor( - name: string, - is: PartialType['is'], - validate: PartialType['validate'], - encode: PartialType['encode'], - readonly props: P - ) -} +export declare const boolean: BooleanC ``` Added in v1.0.0 -### \_tag (property) +## null **Signature** ```ts -readonly _tag: "PartialType" +export declare const null: NullC ``` Added in v1.0.0 -## ReadonlyArrayC (interface) +## nullType **Signature** ```ts -export interface ReadonlyArrayC - extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} +export declare const nullType: NullC ``` -Added in v1.5.3 +Added in v1.0.0 -## ReadonlyArrayType (class) +## number **Signature** ```ts -export declare class ReadonlyArrayType { - constructor( - name: string, - is: ReadonlyArrayType['is'], - validate: ReadonlyArrayType['validate'], - encode: ReadonlyArrayType['encode'], - readonly type: C - ) -} +export declare const number: NumberC ``` Added in v1.0.0 -### \_tag (property) +## string **Signature** ```ts -readonly _tag: "ReadonlyArrayType" +export declare const string: StringC ``` Added in v1.0.0 -## ReadonlyC (interface) +## undefined **Signature** ```ts -export interface ReadonlyC - extends ReadonlyType>, Readonly>, unknown> {} +export declare const undefined: UndefinedC ``` -Added in v1.5.3 +Added in v1.0.0 -## ReadonlyType (class) +## unknown **Signature** ```ts -export declare class ReadonlyType { - constructor( - name: string, - is: ReadonlyType['is'], - validate: ReadonlyType['validate'], - encode: ReadonlyType['encode'], - readonly type: C - ) -} +export declare const unknown: UnknownC ``` -Added in v1.0.0 +Added in v1.5.0 -### \_tag (property) +## void **Signature** ```ts -readonly _tag: "ReadonlyType" +export declare const void: VoidC ``` Added in v1.0.0 -## RecordC (interface) +## voidType **Signature** ```ts -export interface RecordC - extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} +export declare const voidType: VoidC ``` -Added in v1.5.3 +Added in v1.2.0 -## RecursiveType (class) +## ~~Array~~ + +Use `UnknownArray` instead. **Signature** ```ts -export declare class RecursiveType { - constructor( - name: string, - is: RecursiveType['is'], - validate: RecursiveType['validate'], - encode: RecursiveType['encode'], - public runDefinition: () => C - ) -} +export declare const Array: UnknownArrayC ``` Added in v1.0.0 -### \_tag (property) +## ~~Dictionary~~ + +Use `UnknownRecord` instead. **Signature** ```ts -readonly _tag: "RecursiveType" +export declare const Dictionary: UnknownRecordC ``` Added in v1.0.0 -### type (property) +## ~~Function~~ **Signature** ```ts -readonly type: C +export declare const Function: FunctionC ``` Added in v1.0.0 -## RefinementType (class) +## ~~Integer~~ + +Use `Int` instead. **Signature** ```ts -export declare class RefinementType { - constructor( - name: string, - is: RefinementType['is'], - validate: RefinementType['validate'], - encode: RefinementType['encode'], - readonly type: C, - readonly predicate: Predicate - ) -} +export declare const Integer: RefinementC ``` Added in v1.0.0 -### \_tag (property) +## ~~any~~ + +Use `unknown` instead. **Signature** ```ts -readonly _tag: "RefinementType" +export declare const any: AnyC ``` Added in v1.0.0 -## TupleC (interface) +## ~~never~~ **Signature** ```ts -export interface TupleC]> - extends TupleType< - CS, - CS extends { length: 1 } - ? [TypeOf] - : CS extends { length: 2 } - ? [TypeOf, TypeOf] - : CS extends { length: 3 } - ? [TypeOf, TypeOf, TypeOf] - : CS extends { length: 4 } - ? [TypeOf, TypeOf, TypeOf, TypeOf] - : CS extends { length: 5 } - ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] - : unknown, - CS extends { length: 1 } - ? [OutputOf] - : CS extends { length: 2 } - ? [OutputOf, OutputOf] - : CS extends { length: 3 } - ? [OutputOf, OutputOf, OutputOf] - : CS extends { length: 4 } - ? [OutputOf, OutputOf, OutputOf, OutputOf] - : CS extends { length: 5 } - ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] - : unknown, - unknown - > {} +export declare const never: NeverC ``` -Added in v1.5.3 +Added in v1.0.0 -## TupleType (class) +## ~~object~~ + +Use `UnknownRecord` instead. **Signature** ```ts -export declare class TupleType { - constructor( - name: string, - is: TupleType['is'], - validate: TupleType['validate'], - encode: TupleType['encode'], - readonly types: CS - ) -} +export declare const object: ObjectC ``` Added in v1.0.0 -### \_tag (property) +# utils + +## Any (interface) **Signature** ```ts -readonly _tag: "TupleType" +export interface Any extends Type {} ``` Added in v1.0.0 -## TypeC (interface) +## AnyArrayType (class) **Signature** ```ts -export interface TypeC

- extends InterfaceType }, { [K in keyof P]: OutputOf }, unknown> {} +export declare class AnyArrayType { + constructor() +} ``` -Added in v1.5.3 +Added in v1.0.0 -## UnionC (interface) +### \_tag (property) **Signature** ```ts -export interface UnionC]> - extends UnionType, OutputOf, unknown> {} +readonly _tag: "AnyArrayType" ``` -Added in v1.5.3 +Added in v1.0.0 -## UnionType (class) +## AnyDictionaryType (class) **Signature** ```ts -export declare class UnionType { - constructor( - name: string, - is: UnionType['is'], - validate: UnionType['validate'], - encode: UnionType['encode'], - readonly types: CS - ) +export declare class AnyDictionaryType { + constructor() } ``` @@ -1053,216 +1051,180 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "UnionType" +readonly _tag: "AnyDictionaryType" ``` Added in v1.0.0 -## array +## AnyProps (interface) **Signature** ```ts -export declare function array(item: C, name: string = `Array<${item.name}>`): ArrayC +export interface AnyProps { + [key: string]: Any +} ``` Added in v1.0.0 -## brand +## ArrayC (interface) **Signature** ```ts -export declare function brand( - codec: C, - predicate: Refinement, Branded, B>>, - name: N -): BrandC +export interface ArrayC extends ArrayType>, Array>, unknown> {} ``` -Added in v1.8.1 - -## exact +Added in v1.5.3 -Strips additional properties +## ArrayType (class) **Signature** ```ts -export declare function exact(codec: C, name: string = getExactTypeName(codec)): ExactC +export declare class ArrayType { + constructor( + name: string, + is: ArrayType['is'], + validate: ArrayType['validate'], + encode: ArrayType['encode'], + readonly type: C + ) +} ``` -Added in v1.1.0 +Added in v1.0.0 -## intersection +### \_tag (property) **Signature** ```ts -export declare function intersection< - A extends Mixed, - B extends Mixed, - C extends Mixed, - D extends Mixed, - E extends Mixed ->(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> -export declare function intersection( - codecs: [A, B, C, D], - name?: string -): IntersectionC<[A, B, C, D]> -export declare function intersection( - codecs: [A, B, C], - name?: string -): IntersectionC<[A, B, C]> -export declare function intersection( - codecs: [A, B], - name?: string -): IntersectionC<[A, B]> +readonly _tag: "ArrayType" ``` Added in v1.0.0 -## partial +## BigIntC (interface) **Signature** ```ts -export declare function partial

( - props: P, - name: string = getPartialTypeName(getInterfaceTypeName(props)) -): PartialC

+export interface BigIntC extends BigIntType {} ``` -Added in v1.0.0 +Added in v2.1.0 -## readonly +## BigIntType (class) **Signature** ```ts -export declare function readonly(codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC +export declare class BigIntType { + constructor() +} ``` -Added in v1.0.0 +Added in v2.1.0 -## readonlyArray +### \_tag (property) **Signature** ```ts -export declare function readonlyArray( - item: C, - name: string = `ReadonlyArray<${item.name}>` -): ReadonlyArrayC +readonly _tag: "BigIntType" ``` Added in v1.0.0 -## record +## BooleanC (interface) **Signature** ```ts -export declare function record(domain: D, codomain: C, name?: string): RecordC +export interface BooleanC extends BooleanType {} ``` -Added in v1.7.1 +Added in v1.5.3 -## recursion +## BooleanType (class) **Signature** ```ts -export declare function recursion = Type>( - name: string, - definition: (self: C) => C -): RecursiveType +export declare class BooleanType { + constructor() +} ``` Added in v1.0.0 -## strict - -Strips additional properties +### \_tag (property) **Signature** ```ts -export declare const strict:

(props: P, name?: string) => ExactC> +readonly _tag: "BooleanType" ``` Added in v1.0.0 -## tuple +## Brand (interface) **Signature** ```ts -export declare function tuple( - codecs: [A, B, C, D, E], - name?: string -): TupleC<[A, B, C, D, E]> -export declare function tuple( - codecs: [A, B, C, D], - name?: string -): TupleC<[A, B, C, D]> -export declare function tuple( - codecs: [A, B, C], - name?: string -): TupleC<[A, B, C]> -export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> -export declare function tuple(codecs: [A], name?: string): TupleC<[A]> +export interface Brand { + readonly [_brand]: B +} ``` -Added in v1.0.0 +Added in v1.8.1 -## type +## BrandC (interface) **Signature** ```ts -export declare function type

(props: P, name: string = getInterfaceTypeName(props)): TypeC

+export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.8.1 -## union +## Branded (type alias) **Signature** ```ts -export declare function union]>( - codecs: CS, - name: string = getUnionName(codecs) -): UnionC +export type Branded = A & Brand ``` -Added in v1.0.0 - -# constructors +Added in v1.8.1 -## KeyofC (interface) +## Decode (type alias) **Signature** ```ts -export interface KeyofC extends KeyofType {} +export type Decode = (i: I) => Validation ``` -Added in v1.5.3 +Added in v1.0.0 -## KeyofType (class) +## DictionaryType (class) **Signature** ```ts -export declare class KeyofType { +export declare class DictionaryType { constructor( name: string, - is: KeyofType['is'], - validate: KeyofType['validate'], - encode: KeyofType['encode'], - readonly keys: D + is: DictionaryType['is'], + validate: DictionaryType['validate'], + encode: DictionaryType['encode'], + readonly domain: D, + readonly codomain: C ) } ``` @@ -1274,172 +1236,201 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "KeyofType" +readonly _tag: "DictionaryType" ``` Added in v1.0.0 -## LiteralC (interface) +## Encode (type alias) **Signature** ```ts -export interface LiteralC extends LiteralType {} +export type Encode = (a: A) => O ``` -Added in v1.5.3 +Added in v1.0.0 -## LiteralType (class) +## ExactC (interface) **Signature** ```ts -export declare class LiteralType { - constructor( - name: string, - is: LiteralType['is'], - validate: LiteralType['validate'], - encode: LiteralType['encode'], - readonly value: V - ) -} +export interface ExactC extends ExactType, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.5.3 -### \_tag (property) +## ExactType (class) **Signature** ```ts -readonly _tag: "LiteralType" +export declare class ExactType { + constructor( + name: string, + is: ExactType['is'], + validate: ExactType['validate'], + encode: ExactType['encode'], + readonly type: C + ) +} ``` -Added in v1.0.0 +Added in v1.1.0 -## keyof +### \_tag (property) **Signature** ```ts -export declare function keyof( - keys: D, - name: string = Object.keys(keys) - .map((k) => JSON.stringify(k)) - .join(' | ') -): KeyofC +readonly _tag: "ExactType" ``` Added in v1.0.0 -## literal +## HasProps (type alias) **Signature** ```ts -export declare function literal(value: V, name: string = JSON.stringify(value)): LiteralC +export type HasProps = + | HasPropsRefinement + | HasPropsReadonly + | HasPropsIntersection + | InterfaceType + // tslint:disable-next-line: deprecation + | StrictType + | PartialType ``` -Added in v1.0.0 - -# deprecated +Added in v1.1.0 -## ~~AnyC~~ (interface) +## HasPropsIntersection (interface) **Signature** ```ts -export interface AnyC extends AnyType {} +export interface HasPropsIntersection extends IntersectionType, any, any, any> {} ``` -Added in v1.5.3 +Added in v1.1.0 -## ~~AnyType~~ (class) +## HasPropsReadonly (interface) **Signature** ```ts -export declare class AnyType { - constructor() -} +export interface HasPropsReadonly extends ReadonlyType {} ``` -Added in v1.0.0 +Added in v1.1.0 -### \_tag (property) +## HasPropsRefinement (interface) **Signature** ```ts -readonly _tag: "AnyType" +export interface HasPropsRefinement extends RefinementType {} ``` -Added in v1.0.0 - -## ~~Array~~ +Added in v1.1.0 -Use `UnknownArray` instead +## Int (type alias) **Signature** ```ts -export declare const Array: UnknownArrayC +export type Int = Branded ``` -Added in v1.0.0 - -## ~~Compact~~ (type alias) +Added in v1.8.1 -used in `intersection` as a workaround for #234 +## IntBrand (interface) **Signature** ```ts -export type Compact = { [K in keyof A]: A[K] } +export interface IntBrand { + readonly Int: unique symbol +} ``` -Added in v1.4.2 - -## ~~Dictionary~~ +Added in v1.8.1 -Use `UnknownRecord` instead +## InterfaceType (class) **Signature** ```ts -export declare const Dictionary: UnknownRecordC +export declare class InterfaceType { + constructor( + name: string, + is: InterfaceType['is'], + validate: InterfaceType['validate'], + encode: InterfaceType['encode'], + readonly props: P + ) +} ``` Added in v1.0.0 -## ~~Exact~~ (type alias) +### \_tag (property) **Signature** ```ts -export type Exact = T & - { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } +readonly _tag: "InterfaceType" ``` -Added in v1.1.0 +Added in v1.0.0 -## ~~FunctionC~~ (interface) +## IntersectionC (interface) **Signature** ```ts -export interface FunctionC extends FunctionType {} +export interface IntersectionC]> + extends IntersectionType< + CS, + CS extends { length: 2 } + ? TypeOf & TypeOf + : CS extends { length: 3 } + ? TypeOf & TypeOf & TypeOf + : CS extends { length: 4 } + ? TypeOf & TypeOf & TypeOf & TypeOf + : CS extends { length: 5 } + ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf + : unknown, + CS extends { length: 2 } + ? OutputOf & OutputOf + : CS extends { length: 3 } + ? OutputOf & OutputOf & OutputOf + : CS extends { length: 4 } + ? OutputOf & OutputOf & OutputOf & OutputOf + : CS extends { length: 5 } + ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf + : unknown, + unknown + > {} ``` Added in v1.5.3 -## ~~FunctionType~~ (class) +## IntersectionType (class) **Signature** ```ts -export declare class FunctionType { - constructor() +export declare class IntersectionType { + constructor( + name: string, + is: IntersectionType['is'], + validate: IntersectionType['validate'], + encode: IntersectionType['encode'], + readonly types: CS + ) } ``` @@ -1450,50 +1441,44 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "FunctionType" -``` - -Added in v1.0.0 - -## ~~Function~~ - -**Signature** - -```ts -export declare const Function: FunctionC +readonly _tag: "IntersectionType" ``` Added in v1.0.0 -## ~~Integer~~ - -Use `Int` instead +## Is (type alias) **Signature** ```ts -export declare const Integer: RefinementC +export type Is = (u: unknown) => u is A ``` Added in v1.0.0 -## ~~NeverC~~ (interface) +## KeyofC (interface) **Signature** ```ts -export interface NeverC extends NeverType {} +export interface KeyofC extends KeyofType {} ``` Added in v1.5.3 -## ~~NeverType~~ (class) +## KeyofType (class) **Signature** ```ts -export declare class NeverType { - constructor() +export declare class KeyofType { + constructor( + name: string, + is: KeyofType['is'], + validate: KeyofType['validate'], + encode: KeyofType['encode'], + readonly keys: D + ) } ``` @@ -1504,28 +1489,34 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "NeverType" +readonly _tag: "KeyofType" ``` Added in v1.0.0 -## ~~ObjectC~~ (interface) +## LiteralC (interface) **Signature** ```ts -export interface ObjectC extends ObjectType {} +export interface LiteralC extends LiteralType {} ``` Added in v1.5.3 -## ~~ObjectType~~ (class) +## LiteralType (class) **Signature** ```ts -export declare class ObjectType { - constructor() +export declare class LiteralType { + constructor( + name: string, + is: LiteralType['is'], + validate: LiteralType['validate'], + encode: LiteralType['encode'], + readonly value: V + ) } ``` @@ -1536,60 +1527,38 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "ObjectType" +readonly _tag: "LiteralType" ``` Added in v1.0.0 -## ~~PropsOf~~ (type alias) +## Mixed (interface) **Signature** ```ts -export type PropsOf = T['props'] +export interface Mixed extends Type {} ``` Added in v1.0.0 -## ~~RefinementC~~ (interface) - -Use `BrandC` instead - -**Signature** - -```ts -export interface RefinementC extends RefinementType, OutputOf, InputOf> {} -``` - -Added in v1.5.3 - -## ~~StrictC~~ (interface) +## NullC (interface) **Signature** ```ts -export interface StrictC

// tslint:disable-next-line: deprecation - extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} +export interface NullC extends NullType {} ``` Added in v1.5.3 -## ~~StrictType~~ (class) +## NullType (class) **Signature** ```ts -export declare class StrictType { - constructor( - name: string, - // tslint:disable-next-line: deprecation - is: StrictType['is'], - // tslint:disable-next-line: deprecation - validate: StrictType['validate'], - // tslint:disable-next-line: deprecation - encode: StrictType['encode'], - readonly props: P - ) +export declare class NullType { + constructor() } ``` @@ -1600,369 +1569,296 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "StrictType" +readonly _tag: "NullType" ``` Added in v1.0.0 -## ~~TaggedExact~~ (interface) +## NumberC (interface) **Signature** ```ts -export interface TaggedExact extends ExactType, A, O> {} +export interface NumberC extends NumberType {} ``` -Added in v1.3.0 +Added in v1.5.3 -## ~~TaggedIntersectionArgument~~ (type alias) +## NumberType (class) **Signature** ```ts -export type TaggedIntersectionArgument = - // tslint:disable-next-line: deprecation - | [Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Mixed, Tagged] - // tslint:disable-next-line: deprecation - | [Tagged, Mixed, Mixed, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Tagged, Mixed, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Tagged, Mixed, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Mixed, Tagged, Mixed] - // tslint:disable-next-line: deprecation - | [Mixed, Mixed, Mixed, Mixed, Tagged] +export declare class NumberType { + constructor() +} ``` -Added in v1.3.0 +Added in v1.0.0 -## ~~TaggedIntersection~~ (interface) +### \_tag (property) **Signature** ```ts -export interface TaggedIntersection // tslint:disable-next-line: deprecation - extends IntersectionType, A, O> {} +readonly _tag: "NumberType" ``` -Added in v1.3.0 +Added in v1.0.0 -## ~~TaggedProps~~ (type alias) +## OutputOfDictionary (type alias) **Signature** ```ts -export type TaggedProps = { [K in Tag]: LiteralType } +export type OutputOfDictionary = { [K in OutputOf]: OutputOf } ``` -Added in v1.3.0 +Added in v1.0.0 -## ~~TaggedRefinement~~ (interface) +## OutputOfPartialProps (type alias) **Signature** ```ts -export interface TaggedRefinement extends RefinementType, A, O> {} +export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } ``` -Added in v1.3.0 +Added in v1.0.0 -## ~~TaggedUnionC~~ (interface) +## OutputOfProps (type alias) **Signature** ```ts -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation - extends TaggedUnionType, OutputOf, unknown> {} +export type OutputOfProps

= { [K in keyof P]: OutputOf } ``` -Added in v1.5.3 +Added in v1.0.0 -## ~~TaggedUnionType~~ (class) +## PartialC (interface) **Signature** ```ts -export declare class TaggedUnionType { - constructor( - name: string, - // tslint:disable-next-line: deprecation - is: TaggedUnionType['is'], - // tslint:disable-next-line: deprecation - validate: TaggedUnionType['validate'], - // tslint:disable-next-line: deprecation - encode: TaggedUnionType['encode'], - codecs: CS, - readonly tag: Tag - ) -} +export interface PartialC

+ extends PartialType }, { [K in keyof P]?: OutputOf }, unknown> {} ``` -Added in v1.3.0 +Added in v1.5.3 -## ~~TaggedUnion~~ (interface) +## PartialType (class) **Signature** ```ts -export interface TaggedUnion extends UnionType>, A, O> {} +export declare class PartialType { + constructor( + name: string, + is: PartialType['is'], + validate: PartialType['validate'], + encode: PartialType['encode'], + readonly props: P + ) +} ``` -Added in v1.3.0 +Added in v1.0.0 -## ~~Tagged~~ (type alias) +### \_tag (property) **Signature** ```ts -export type Tagged = - // tslint:disable-next-line: deprecation - | InterfaceType, A, O> - // tslint:disable-next-line: deprecation - | StrictType, A, O> - // tslint:disable-next-line: deprecation - | TaggedRefinement - // tslint:disable-next-line: deprecation - | TaggedUnion - // tslint:disable-next-line: deprecation - | TaggedIntersection - // tslint:disable-next-line: deprecation - | TaggedExact - | RecursiveType +readonly _tag: "PartialType" ``` -Added in v1.3.0 - -## ~~alias~~ +Added in v1.0.0 -Keeps the codec "kind" +## Props (interface) **Signature** ```ts -export declare function alias( - codec: PartialType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => PartialType -export declare function alias( - // tslint:disable-next-line: deprecation - codec: StrictType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => // tslint:disable-next-line: deprecation -StrictType -export declare function alias( - codec: InterfaceType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => InterfaceType +export interface Props { + [key: string]: Mixed +} ``` -Added in v1.1.0 - -## ~~any~~ +Added in v1.0.0 -Use `unknown` instead +## ReadonlyArrayC (interface) **Signature** ```ts -export declare const any: AnyC +export interface ReadonlyArrayC + extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} ``` -Added in v1.0.0 - -## ~~clean~~ +Added in v1.5.3 -Drops the codec "kind" +## ReadonlyArrayType (class) **Signature** ```ts -export declare function clean(codec: Type): Type +export declare class ReadonlyArrayType { + constructor( + name: string, + is: ReadonlyArrayType['is'], + validate: ReadonlyArrayType['validate'], + encode: ReadonlyArrayType['encode'], + readonly type: C + ) +} ``` -Added in v1.1.0 - -## ~~dictionary~~ +Added in v1.0.0 -Use `record` instead +### \_tag (property) **Signature** ```ts -export declare const dictionary: typeof record +readonly _tag: "ReadonlyArrayType" ``` Added in v1.0.0 -## ~~getDefaultContext~~ +## ReadonlyC (interface) **Signature** ```ts -export declare const getDefaultContext: (decoder: Decoder) => Context +export interface ReadonlyC + extends ReadonlyType>, Readonly>, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -## ~~getValidationError~~ +## ReadonlyType (class) **Signature** ```ts -export declare const getValidationError: (value: unknown, context: Context) => ValidationError +export declare class ReadonlyType { + constructor( + name: string, + is: ReadonlyType['is'], + validate: ReadonlyType['validate'], + encode: ReadonlyType['encode'], + readonly type: C + ) +} ``` Added in v1.0.0 -## ~~interface~~ - -Use `type` instead +### \_tag (property) **Signature** ```ts -export declare const interface: typeof type +readonly _tag: "ReadonlyType" ``` Added in v1.0.0 -## ~~mixed~~ (type alias) - -Use `unknown` instead +## RecordC (interface) **Signature** ```ts -export type mixed = unknown +export interface RecordC + extends DictionaryType]: TypeOf }, { [K in OutputOf]: OutputOf }, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -## ~~never~~ +## RecursiveType (class) **Signature** ```ts -export declare const never: NeverC +export declare class RecursiveType { + constructor( + name: string, + is: RecursiveType['is'], + validate: RecursiveType['validate'], + encode: RecursiveType['encode'], + public runDefinition: () => C + ) +} ``` Added in v1.0.0 -## ~~object~~ - -Use `UnknownRecord` instead +### \_tag (property) **Signature** ```ts -export declare const object: ObjectC +readonly _tag: "RecursiveType" ``` Added in v1.0.0 -## ~~refinement~~ - -Use `brand` instead +### type (property) **Signature** ```ts -export declare function refinement( - codec: C, - predicate: Predicate>, - name: string = `(${codec.name} | ${getFunctionName(predicate)})` -): // tslint:disable-next-line: deprecation -RefinementC +readonly type: C ``` Added in v1.0.0 -## ~~taggedUnion~~ - -Use `union` instead +## RefinementType (class) **Signature** ```ts -export declare const taggedUnion: ( - tag: Tag, - codecs: CS, - name?: string -) => TaggedUnionC +export declare class RefinementType { + constructor( + name: string, + is: RefinementType['is'], + validate: RefinementType['validate'], + encode: RefinementType['encode'], + readonly type: C, + readonly predicate: Predicate + ) +} ``` -Added in v1.3.0 - -# primitives +Added in v1.0.0 -## AnyArrayType (class) +### \_tag (property) **Signature** ```ts -export declare class AnyArrayType { - constructor() -} +readonly _tag: "RefinementType" ``` Added in v1.0.0 -### \_tag (property) +## StringC (interface) **Signature** ```ts -readonly _tag: "AnyArrayType" +export interface StringC extends StringType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## AnyDictionaryType (class) +## StringType (class) **Signature** ```ts -export declare class AnyDictionaryType { +export declare class StringType { constructor() } ``` @@ -1974,610 +1870,709 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "AnyDictionaryType" +readonly _tag: "StringType" ``` Added in v1.0.0 -## BigIntC (interface) +## TupleC (interface) **Signature** ```ts -export interface BigIntC extends BigIntType {} +export interface TupleC]> + extends TupleType< + CS, + CS extends { length: 1 } + ? [TypeOf] + : CS extends { length: 2 } + ? [TypeOf, TypeOf] + : CS extends { length: 3 } + ? [TypeOf, TypeOf, TypeOf] + : CS extends { length: 4 } + ? [TypeOf, TypeOf, TypeOf, TypeOf] + : CS extends { length: 5 } + ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] + : unknown, + CS extends { length: 1 } + ? [OutputOf] + : CS extends { length: 2 } + ? [OutputOf, OutputOf] + : CS extends { length: 3 } + ? [OutputOf, OutputOf, OutputOf] + : CS extends { length: 4 } + ? [OutputOf, OutputOf, OutputOf, OutputOf] + : CS extends { length: 5 } + ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] + : unknown, + unknown + > {} ``` -Added in v2.1.0 +Added in v1.5.3 -## BigIntType (class) +## TupleType (class) **Signature** ```ts -export declare class BigIntType { - constructor() +export declare class TupleType { + constructor( + name: string, + is: TupleType['is'], + validate: TupleType['validate'], + encode: TupleType['encode'], + readonly types: CS + ) } ``` -Added in v2.1.0 +Added in v1.0.0 ### \_tag (property) **Signature** ```ts -readonly _tag: "BigIntType" +readonly _tag: "TupleType" ``` Added in v1.0.0 -## BooleanC (interface) +## TypeC (interface) **Signature** ```ts -export interface BooleanC extends BooleanType {} +export interface TypeC

+ extends InterfaceType }, { [K in keyof P]: OutputOf }, unknown> {} ``` Added in v1.5.3 -## BooleanType (class) +## TypeOfDictionary (type alias) **Signature** ```ts -export declare class BooleanType { - constructor() -} +export type TypeOfDictionary = { [K in TypeOf]: TypeOf } ``` Added in v1.0.0 -### \_tag (property) +## TypeOfPartialProps (type alias) **Signature** ```ts -readonly _tag: "BooleanType" +export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } ``` Added in v1.0.0 -## Int - -A branded codec representing an integer +## TypeOfProps (type alias) **Signature** ```ts -export declare const Int: BrandC +export type TypeOfProps

= { [K in keyof P]: TypeOf } ``` -Added in v1.8.1 +Added in v1.0.0 -## Int (type alias) +## UndefinedC (interface) **Signature** ```ts -export type Int = Branded +export interface UndefinedC extends UndefinedType {} ``` -Added in v1.8.1 +Added in v1.5.3 -## IntBrand (interface) +## UndefinedType (class) **Signature** ```ts -export interface IntBrand { - readonly Int: unique symbol +export declare class UndefinedType { + constructor() } ``` -Added in v1.8.1 +Added in v1.0.0 -## NullC (interface) +### \_tag (property) **Signature** ```ts -export interface NullC extends NullType {} +readonly _tag: "UndefinedType" ``` -Added in v1.5.3 +Added in v1.0.0 -## NullType (class) +## UnionC (interface) **Signature** ```ts -export declare class NullType { - constructor() -} +export interface UnionC]> + extends UnionType, OutputOf, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -### \_tag (property) +## UnionType (class) **Signature** ```ts -readonly _tag: "NullType" +export declare class UnionType { + constructor( + name: string, + is: UnionType['is'], + validate: UnionType['validate'], + encode: UnionType['encode'], + readonly types: CS + ) +} ``` Added in v1.0.0 -## NumberC (interface) +### \_tag (property) **Signature** ```ts -export interface NumberC extends NumberType {} +readonly _tag: "UnionType" ``` -Added in v1.5.3 +Added in v1.0.0 -## NumberType (class) +## UnknownArrayC (interface) **Signature** ```ts -export declare class NumberType { - constructor() -} +export interface UnknownArrayC extends AnyArrayType {} ``` -Added in v1.0.0 +Added in v1.5.3 -### \_tag (property) +## UnknownC (interface) **Signature** ```ts -readonly _tag: "NumberType" +export interface UnknownC extends UnknownType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## StringC (interface) +## UnknownRecordC (interface) **Signature** ```ts -export interface StringC extends StringType {} +export interface UnknownRecordC extends AnyDictionaryType {} ``` Added in v1.5.3 -## StringType (class) +## UnknownType (class) **Signature** ```ts -export declare class StringType { +export declare class UnknownType { constructor() } ``` -Added in v1.0.0 +Added in v1.5.0 ### \_tag (property) **Signature** ```ts -readonly _tag: "StringType" +readonly _tag: "UnknownType" ``` Added in v1.0.0 -## UndefinedC (interface) +## Validate (type alias) **Signature** ```ts -export interface UndefinedC extends UndefinedType {} +export type Validate = (i: I, context: Context) => Validation ``` -Added in v1.5.3 +Added in v1.0.0 -## UndefinedType (class) +## VoidC (interface) **Signature** ```ts -export declare class UndefinedType { - constructor() -} +export interface VoidC extends VoidType {} ``` -Added in v1.0.0 +Added in v1.5.3 -### \_tag (property) +## VoidType (class) **Signature** ```ts -readonly _tag: "UndefinedType" +export declare class VoidType { + constructor() +} ``` -Added in v1.0.0 +Added in v1.2.0 -## UnknownArray +### \_tag (property) **Signature** ```ts -export declare const UnknownArray: UnknownArrayC +readonly _tag: "VoidType" ``` -Added in v1.7.1 +Added in v1.0.0 -## UnknownArrayC (interface) +## appendContext **Signature** ```ts -export interface UnknownArrayC extends AnyArrayType {} +export declare function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context ``` -Added in v1.5.3 +Added in v1.0.0 -## UnknownC (interface) +## getContextEntry **Signature** ```ts -export interface UnknownC extends UnknownType {} +export declare function getContextEntry(key: string, decoder: Decoder): ContextEntry ``` -Added in v1.5.3 +Added in v1.0.0 -## UnknownRecord +## getFunctionName **Signature** ```ts -export declare const UnknownRecord: UnknownRecordC +export declare function getFunctionName(f: Function): string ``` -Added in v1.7.1 +Added in v1.0.0 -## UnknownRecordC (interface) +## identity **Signature** ```ts -export interface UnknownRecordC extends AnyDictionaryType {} +export declare const identity: (a: A) => A ``` -Added in v1.5.3 +Added in v1.0.0 -## UnknownType (class) +## ~~AnyC~~ (interface) **Signature** ```ts -export declare class UnknownType { - constructor() -} +export interface AnyC extends AnyType {} ``` -Added in v1.5.0 +Added in v1.5.3 -### \_tag (property) +## ~~AnyType~~ (class) **Signature** ```ts -readonly _tag: "UnknownType" +export declare class AnyType { + constructor() +} ``` Added in v1.0.0 -## VoidC (interface) +### \_tag (property) **Signature** ```ts -export interface VoidC extends VoidType {} +readonly _tag: "AnyType" ``` -Added in v1.5.3 +Added in v1.0.0 -## VoidType (class) +## ~~Compact~~ (type alias) **Signature** ```ts -export declare class VoidType { - constructor() -} +export type Compact = { [K in keyof A]: A[K] } ``` -Added in v1.2.0 +Added in v1.4.2 -### \_tag (property) +## ~~Exact~~ (type alias) **Signature** ```ts -readonly _tag: "VoidType" +export type Exact = T & + { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } ``` -Added in v1.0.0 +Added in v1.1.0 -## bigint +## ~~FunctionC~~ (interface) **Signature** ```ts -export declare const bigint: BigIntC +export interface FunctionC extends FunctionType {} ``` -Added in v2.1.0 +Added in v1.5.3 -## boolean +## ~~FunctionType~~ (class) **Signature** ```ts -export declare const boolean: BooleanC +export declare class FunctionType { + constructor() +} ``` Added in v1.0.0 -## null +### \_tag (property) **Signature** ```ts -export declare const null: NullC +readonly _tag: "FunctionType" ``` Added in v1.0.0 -## nullType +## ~~NeverC~~ (interface) **Signature** ```ts -export declare const nullType: NullC +export interface NeverC extends NeverType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## number +## ~~NeverType~~ (class) **Signature** ```ts -export declare const number: NumberC +export declare class NeverType { + constructor() +} ``` Added in v1.0.0 -## string +### \_tag (property) **Signature** ```ts -export declare const string: StringC +readonly _tag: "NeverType" ``` Added in v1.0.0 -## undefined +## ~~ObjectC~~ (interface) **Signature** ```ts -export declare const undefined: UndefinedC +export interface ObjectC extends ObjectType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## unknown +## ~~ObjectType~~ (class) **Signature** ```ts -export declare const unknown: UnknownC +export declare class ObjectType { + constructor() +} ``` -Added in v1.5.0 +Added in v1.0.0 -## void +### \_tag (property) **Signature** ```ts -export declare const void: VoidC +readonly _tag: "ObjectType" ``` Added in v1.0.0 -## voidType +## ~~PropsOf~~ (type alias) **Signature** ```ts -export declare const voidType: VoidC +export type PropsOf = T['props'] ``` -Added in v1.2.0 +Added in v1.0.0 -# utils +## ~~RefinementC~~ (interface) -## AnyProps (interface) +Use `BrandC` instead. **Signature** ```ts -export interface AnyProps { - [key: string]: Any -} +export interface RefinementC extends RefinementType, OutputOf, InputOf> {} ``` -Added in v1.0.0 +Added in v1.5.3 -## HasProps (type alias) +## ~~StrictC~~ (interface) **Signature** ```ts -export type HasProps = - | HasPropsRefinement - | HasPropsReadonly - | HasPropsIntersection - | InterfaceType - // tslint:disable-next-line: deprecation - | StrictType - | PartialType +export interface StrictC

// tslint:disable-next-line: deprecation + extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} ``` -Added in v1.1.0 +Added in v1.5.3 -## HasPropsIntersection (interface) +## ~~StrictType~~ (class) **Signature** ```ts -export interface HasPropsIntersection extends IntersectionType, any, any, any> {} +export declare class StrictType { + constructor( + name: string, + // tslint:disable-next-line: deprecation + is: StrictType['is'], + // tslint:disable-next-line: deprecation + validate: StrictType['validate'], + // tslint:disable-next-line: deprecation + encode: StrictType['encode'], + readonly props: P + ) +} ``` -Added in v1.1.0 +Added in v1.0.0 -## HasPropsReadonly (interface) +### \_tag (property) **Signature** ```ts -export interface HasPropsReadonly extends ReadonlyType {} +readonly _tag: "StrictType" ``` -Added in v1.1.0 +Added in v1.0.0 -## HasPropsRefinement (interface) +## ~~TaggedExact~~ (interface) **Signature** ```ts -export interface HasPropsRefinement extends RefinementType {} +export interface TaggedExact extends ExactType, A, O> {} ``` -Added in v1.1.0 +Added in v1.3.0 -## OutputOfDictionary (type alias) +## ~~TaggedIntersectionArgument~~ (type alias) **Signature** ```ts -export type OutputOfDictionary = { [K in OutputOf]: OutputOf } +export type TaggedIntersectionArgument = + // tslint:disable-next-line: deprecation + | [Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Mixed, Tagged] + // tslint:disable-next-line: deprecation + | [Tagged, Mixed, Mixed, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Tagged, Mixed, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Tagged, Mixed, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Mixed, Tagged, Mixed] + // tslint:disable-next-line: deprecation + | [Mixed, Mixed, Mixed, Mixed, Tagged] ``` -Added in v1.0.0 +Added in v1.3.0 -## OutputOfPartialProps (type alias) +## ~~TaggedIntersection~~ (interface) **Signature** ```ts -export type OutputOfPartialProps

= { [K in keyof P]?: OutputOf } +export interface TaggedIntersection // tslint:disable-next-line: deprecation + extends IntersectionType, A, O> {} ``` -Added in v1.0.0 +Added in v1.3.0 -## OutputOfProps (type alias) +## ~~TaggedProps~~ (type alias) **Signature** ```ts -export type OutputOfProps

= { [K in keyof P]: OutputOf } +export type TaggedProps = { [K in Tag]: LiteralType } ``` -Added in v1.0.0 +Added in v1.3.0 -## Props (interface) +## ~~TaggedRefinement~~ (interface) **Signature** ```ts -export interface Props { - [key: string]: Mixed -} +export interface TaggedRefinement extends RefinementType, A, O> {} ``` -Added in v1.0.0 +Added in v1.3.0 -## TypeOfDictionary (type alias) +## ~~TaggedUnionC~~ (interface) **Signature** ```ts -export type TypeOfDictionary = { [K in TypeOf]: TypeOf } +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation + extends TaggedUnionType, OutputOf, unknown> {} ``` -Added in v1.0.0 +Added in v1.5.3 -## TypeOfPartialProps (type alias) +## ~~TaggedUnionType~~ (class) **Signature** ```ts -export type TypeOfPartialProps

= { [K in keyof P]?: TypeOf } +export declare class TaggedUnionType { + constructor( + name: string, + // tslint:disable-next-line: deprecation + is: TaggedUnionType['is'], + // tslint:disable-next-line: deprecation + validate: TaggedUnionType['validate'], + // tslint:disable-next-line: deprecation + encode: TaggedUnionType['encode'], + codecs: CS, + readonly tag: Tag + ) +} ``` -Added in v1.0.0 +Added in v1.3.0 -## TypeOfProps (type alias) +## ~~TaggedUnion~~ (interface) **Signature** ```ts -export type TypeOfProps

= { [K in keyof P]: TypeOf } +export interface TaggedUnion extends UnionType>, A, O> {} ``` -Added in v1.0.0 +Added in v1.3.0 -## appendContext +## ~~Tagged~~ (type alias) **Signature** ```ts -export declare function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context +export type Tagged = + // tslint:disable-next-line: deprecation + | InterfaceType, A, O> + // tslint:disable-next-line: deprecation + | StrictType, A, O> + // tslint:disable-next-line: deprecation + | TaggedRefinement + // tslint:disable-next-line: deprecation + | TaggedUnion + // tslint:disable-next-line: deprecation + | TaggedIntersection + // tslint:disable-next-line: deprecation + | TaggedExact + | RecursiveType ``` -Added in v1.0.0 +Added in v1.3.0 -## getContextEntry +## ~~getDefaultContext~~ **Signature** ```ts -export declare function getContextEntry(key: string, decoder: Decoder): ContextEntry +export declare const getDefaultContext: (decoder: Decoder) => Context ``` Added in v1.0.0 -## getFunctionName +## ~~getValidationError~~ **Signature** ```ts -export declare function getFunctionName(f: Function): string +export declare const getValidationError: (value: unknown, context: Context) => ValidationError ``` Added in v1.0.0 -## identity +## ~~mixed~~ (type alias) + +Use `unknown` instead. **Signature** ```ts -export declare const identity: (a: A) => A +export type mixed = unknown ``` Added in v1.0.0 diff --git a/src/index.ts b/src/index.ts index 7388cf49f..d15ef712e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -74,37 +74,31 @@ export const success: (value: T) => Validation = right // ------------------------------------------------------------------------------------- /** - * @category Codec * @since 1.0.0 */ export type Is = (u: unknown) => u is A /** - * @category Codec * @since 1.0.0 */ export type Validate = (i: I, context: Context) => Validation /** - * @category Codec * @since 1.0.0 */ export type Decode = (i: I) => Validation /** - * @category Codec * @since 1.0.0 */ export type Encode = (a: A) => O /** - * @category Codec * @since 1.0.0 */ export interface Any extends Type {} /** - * @category Codec * @since 1.0.0 */ export interface Mixed extends Type {} @@ -744,7 +738,6 @@ export function getIndex(codecs: NonEmptyArray): [string, NonEmptyArray { @@ -763,7 +756,6 @@ export class NullType extends Type { } /** - * @category primitives * @since 1.5.3 */ export interface NullC extends NullType {} @@ -775,7 +767,6 @@ export interface NullC extends NullType {} export const nullType: NullC = new NullType() /** - * @category primitives * @since 1.0.0 */ export class UndefinedType extends Type { @@ -794,7 +785,6 @@ export class UndefinedType extends Type { } /** - * @category primitives * @since 1.5.3 */ export interface UndefinedC extends UndefinedType {} @@ -802,7 +792,6 @@ export interface UndefinedC extends UndefinedType {} const undefinedType: UndefinedC = new UndefinedType() /** - * @category primitives * @since 1.2.0 */ export class VoidType extends Type { @@ -816,7 +805,6 @@ export class VoidType extends Type { } /** - * @category primitives * @since 1.5.3 */ export interface VoidC extends VoidType {} @@ -828,7 +816,6 @@ export interface VoidC extends VoidType {} export const voidType: VoidC = new VoidType() /** - * @category primitives * @since 1.5.0 */ export class UnknownType extends Type { @@ -842,7 +829,6 @@ export class UnknownType extends Type { } /** - * @category primitives * @since 1.5.3 */ export interface UnknownC extends UnknownType {} @@ -854,7 +840,6 @@ export interface UnknownC extends UnknownType {} export const unknown: UnknownC = new UnknownType() /** - * @category primitives * @since 1.0.0 */ export class StringType extends Type { @@ -873,7 +858,6 @@ export class StringType extends Type { } /** - * @category primitives * @since 1.5.3 */ export interface StringC extends StringType {} @@ -885,7 +869,6 @@ export interface StringC extends StringType {} export const string: StringC = new StringType() /** - * @category primitives * @since 1.0.0 */ export class NumberType extends Type { @@ -904,7 +887,6 @@ export class NumberType extends Type { } /** - * @category primitives * @since 1.5.3 */ export interface NumberC extends NumberType {} @@ -916,7 +898,6 @@ export interface NumberC extends NumberType {} export const number: NumberC = new NumberType() /** - * @category primitives * @since 2.1.0 */ export class BigIntType extends Type { @@ -936,7 +917,6 @@ export class BigIntType extends Type { } /** - * @category primitives * @since 2.1.0 */ export interface BigIntC extends BigIntType {} @@ -948,7 +928,6 @@ export interface BigIntC extends BigIntType {} export const bigint: BigIntC = new BigIntType() /** - * @category primitives * @since 1.0.0 */ export class BooleanType extends Type { @@ -967,7 +946,6 @@ export class BooleanType extends Type { } /** - * @category primitives * @since 1.5.3 */ export interface BooleanC extends BooleanType {} @@ -979,7 +957,6 @@ export interface BooleanC extends BooleanType {} export const boolean: BooleanC = new BooleanType() /** - * @category primitives * @since 1.0.0 */ export class AnyArrayType extends Type> { @@ -993,7 +970,6 @@ export class AnyArrayType extends Type> { } /** - * @category primitives * @since 1.5.3 */ export interface UnknownArrayC extends AnyArrayType {} @@ -1005,7 +981,6 @@ export interface UnknownArrayC extends AnyArrayType {} export const UnknownArray: UnknownArrayC = new AnyArrayType() /** - * @category primitives * @since 1.0.0 */ export class AnyDictionaryType extends Type<{ [key: string]: unknown }> { @@ -1027,11 +1002,16 @@ export class AnyDictionaryType extends Type<{ [key: string]: unknown }> { } /** - * @category primitives * @since 1.5.3 */ export interface UnknownRecordC extends AnyDictionaryType {} +/** + * @category primitives + * @since 1.7.1 + */ +export const UnknownRecord: UnknownRecordC = new AnyDictionaryType() + export { /** * @category primitives @@ -1057,7 +1037,6 @@ export { type LiteralValue = string | number | boolean /** - * @category constructors * @since 1.0.0 */ export class LiteralType extends Type { @@ -1077,7 +1056,6 @@ export class LiteralType extends Type { } /** - * @category constructors * @since 1.5.3 */ export interface LiteralC extends LiteralType {} @@ -1092,7 +1070,6 @@ export function literal(value: V, name: string = JSON.st } /** - * @category constructors * @since 1.0.0 */ export class KeyofType extends Type { @@ -1112,7 +1089,6 @@ export class KeyofType extends Type extends KeyofType {} @@ -1136,7 +1112,6 @@ export function keyof( // ------------------------------------------------------------------------------------- /** - * @category combinators * @since 1.0.0 */ export class RefinementType extends Type { @@ -1159,7 +1134,6 @@ export class RefinementType extends declare const _brand: unique symbol /** - * @category combinators * @since 1.8.1 */ export interface Brand { @@ -1167,13 +1141,11 @@ export interface Brand { } /** - * @category combinators * @since 1.8.1 */ export type Branded = A & Brand /** - * @category combinators * @since 1.8.1 */ export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} @@ -1192,13 +1164,6 @@ export function brand => Number.isInteger(n), 'Int') /** - * @category primitives * @since 1.8.1 */ export type Int = Branded /** - * @category combinators * @since 1.0.0 */ export class RecursiveType extends Type { @@ -1278,7 +1241,6 @@ export function recursion = Type< } /** - * @category combinators * @since 1.0.0 */ export class ArrayType extends Type { @@ -1298,7 +1260,6 @@ export class ArrayType extends Type< } /** - * @category combinators * @since 1.5.3 */ export interface ArrayC extends ArrayType>, Array>, unknown> {} @@ -1343,7 +1304,6 @@ export function array(item: C, name: string = `Array<${item.nam } /** - * @category combinators * @since 1.0.0 */ export class InterfaceType extends Type { @@ -1363,7 +1323,6 @@ export class InterfaceType extends Type } /** - * @category combinators * @since 1.5.3 */ export interface TypeC

@@ -1438,7 +1397,6 @@ export function type

(props: P, name: string = getInterfaceTypeN } /** - * @category combinators * @since 1.0.0 */ export class PartialType extends Type { @@ -1458,7 +1416,6 @@ export class PartialType extends Type { } /** - * @category combinators * @since 1.5.3 */ export interface PartialC

@@ -1538,7 +1495,6 @@ export function partial

( } /** - * @category combinators * @since 1.0.0 */ export class DictionaryType extends Type { @@ -1559,7 +1515,6 @@ export class DictionaryType @@ -1577,7 +1532,6 @@ export function record(domain: D, codomain: C, } /** - * @category combinators * @since 1.0.0 */ export class UnionType, A = any, O = A, I = unknown> extends Type { @@ -1597,7 +1551,6 @@ export class UnionType, A = any, O = A, I = unknown> exten } /** - * @category combinators * @since 1.5.3 */ export interface UnionC]> @@ -1694,7 +1647,6 @@ export function union]>( } /** - * @category combinators * @since 1.0.0 */ export class IntersectionType, A = any, O = A, I = unknown> extends Type { @@ -1714,7 +1666,6 @@ export class IntersectionType, A = any, O = A, I = unknown } /** - * @category combinators * @since 1.5.3 */ export interface IntersectionC]> @@ -1794,7 +1745,6 @@ export function intersection]>( } /** - * @category combinators * @since 1.0.0 */ export class TupleType, A = any, O = A, I = unknown> extends Type { @@ -1814,7 +1764,6 @@ export class TupleType, A = any, O = A, I = unknown> exten } /** - * @category combinators * @since 1.5.3 */ export interface TupleC]> @@ -1904,7 +1853,6 @@ export function tuple]>( } /** - * @category combinators * @since 1.0.0 */ export class ReadonlyType extends Type { @@ -1924,7 +1872,6 @@ export class ReadonlyType extends Ty } /** - * @category combinators * @since 1.5.3 */ export interface ReadonlyC @@ -1939,7 +1886,6 @@ export function readonly(codec: C, name: string = `Readonly<${c } /** - * @category combinators * @since 1.0.0 */ export class ReadonlyArrayType extends Type { @@ -1959,7 +1905,6 @@ export class ReadonlyArrayType exten } /** - * @category combinators * @since 1.5.3 */ export interface ReadonlyArrayC @@ -1978,7 +1923,7 @@ export function readonlyArray( } /** - * Strips additional properties + * Strips additional properties, equivalent to `exact(type(props))`. * * @category combinators * @since 1.0.0 @@ -1986,7 +1931,6 @@ export function readonlyArray( export const strict =

(props: P, name?: string): ExactC> => exact(type(props), name) /** - * @category combinators * @since 1.1.0 */ export class ExactType extends Type { @@ -2006,13 +1950,12 @@ export class ExactType extends Type< } /** - * @category combinators * @since 1.5.3 */ export interface ExactC extends ExactType, OutputOf, InputOf> {} /** - * Strips additional properties + * Strips additional properties. * * @category combinators * @since 1.1.0 @@ -2043,7 +1986,6 @@ export function exact(codec: C, name: string = getExactTypeN // ------------------------------------------------------------------------------------- /** - * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2064,7 +2006,6 @@ export class FunctionType extends Type { } /** - * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2072,7 +2013,7 @@ export class FunctionType extends Type { export interface FunctionC extends FunctionType {} /** - * @category deprecated + * @category primitives * @since 1.0.0 * @deprecated */ @@ -2080,7 +2021,6 @@ export interface FunctionC extends FunctionType {} export const Function: FunctionC = new FunctionType() /** - * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2107,7 +2047,6 @@ export class TaggedUnionType< } /** - * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2115,9 +2054,9 @@ export interface TaggedUnionC, OutputOf, unknown> {} /** - * Use `union` instead + * Use `union` instead. * - * @category deprecated + * @category combinators * @since 1.3.0 * @deprecated */ @@ -2140,9 +2079,9 @@ export const taggedUnion = { } /** - * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2220,7 +2154,7 @@ export class NeverType extends Type { export interface NeverC extends NeverType {} /** - * @category deprecated + * @category primitives * @since 1.0.0 * @deprecated */ @@ -2228,7 +2162,6 @@ export interface NeverC extends NeverType {} export const never: NeverC = new NeverType() /** - * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2243,7 +2176,6 @@ export class AnyType extends Type { } /** - * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2251,9 +2183,9 @@ export class AnyType extends Type { export interface AnyC extends AnyType {} /** - * Use `unknown` instead + * Use `unknown` instead. * - * @category deprecated + * @category primitives * @since 1.0.0 * @deprecated */ @@ -2261,16 +2193,15 @@ export interface AnyC extends AnyType {} export const any: AnyC = new AnyType() /** - * Use `UnknownRecord` instead + * Use `UnknownRecord` instead. * - * @category deprecated + * @category primitives * @since 1.0.0 * @deprecated */ export const Dictionary: UnknownRecordC = UnknownRecord /** - * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2290,7 +2221,6 @@ export class ObjectType extends Type { } /** - * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2298,9 +2228,9 @@ export class ObjectType extends Type { export interface ObjectC extends ObjectType {} /** - * Use `UnknownRecord` instead + * Use `UnknownRecord` instead. * - * @category deprecated + * @category primitives * @since 1.0.0 * @deprecated */ @@ -2308,18 +2238,17 @@ export interface ObjectC extends ObjectType {} export const object: ObjectC = new ObjectType() /** - * Use `BrandC` instead + * Use `BrandC` instead. * - * @category deprecated * @since 1.5.3 * @deprecated */ export interface RefinementC extends RefinementType, OutputOf, InputOf> {} /** - * Use `brand` instead + * Use `brand` instead. * - * @category deprecated + * @category combinators * @since 1.0.0 * @deprecated */ @@ -2347,9 +2276,9 @@ RefinementC { } /** - * Use `Int` instead + * Use `Int` instead. * - * @category deprecated + * @category primitives * @since 1.0.0 * @deprecated */ @@ -2357,25 +2286,21 @@ RefinementC { export const Integer = refinement(number, Number.isInteger, 'Integer') /** - * Use `record` instead + * Use `record` instead. * - * @category deprecated + * @category combinators * @since 1.0.0 * @deprecated */ export const dictionary: typeof record = record /** - * used in `intersection` as a workaround for #234 - * - * @category deprecated * @since 1.4.2 * @deprecated */ export type Compact = { [K in keyof A]: A[K] } /** - * @category deprecated * @since 1.0.0 * @deprecated */ @@ -2399,7 +2324,6 @@ export class StrictType extends Type { } /** - * @category deprecated * @since 1.5.3 * @deprecated */ @@ -2407,14 +2331,12 @@ export interface StrictC

// tslint:disable-next-line: deprecat extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} /** - * @category deprecated * @since 1.3.0 * @deprecated */ export type TaggedProps = { [K in Tag]: LiteralType } /** - * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2422,7 +2344,6 @@ export type TaggedProps = { [K in Tag]: LiteralType } export interface TaggedRefinement extends RefinementType, A, O> {} /** - * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2430,7 +2351,6 @@ export interface TaggedRefinement extends Refineme export interface TaggedUnion extends UnionType>, A, O> {} /** - * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2467,7 +2387,6 @@ export type TaggedIntersectionArgument = | [Mixed, Mixed, Mixed, Mixed, Tagged] /** - * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2475,7 +2394,6 @@ export interface TaggedIntersection // tslint:dis extends IntersectionType, A, O> {} /** - * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2483,7 +2401,6 @@ export interface TaggedIntersection // tslint:dis export interface TaggedExact extends ExactType, A, O> {} /** - * @category deprecated * @since 1.3.0 * @deprecated */ @@ -2503,9 +2420,9 @@ export type Tagged = | RecursiveType /** - * Drops the codec "kind" + * Drops the codec "kind". * - * @category deprecated + * @category combinators * @since 1.1.0 * @deprecated */ @@ -2514,14 +2431,12 @@ export function clean(codec: Type): Type = T['props'] /** - * @category deprecated * @since 1.1.0 * @deprecated */ @@ -2529,9 +2444,9 @@ export type Exact = T & { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } /** - * Keeps the codec "kind" + * Keeps the codec "kind". * - * @category deprecated + * @category combinators * @since 1.1.0 * @deprecated */ From 30a4115c75375dbd02954bac793a34cc06be45c3 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 28 Jan 2021 12:33:25 +0100 Subject: [PATCH 183/222] upgrade dev deps --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 93cd7106e..26ab7a77c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3234,9 +3234,9 @@ "dev": true }, "fp-ts": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.8.1.tgz", - "integrity": "sha512-HuA/6roEliHoBgEOLCKmGRcM90e2trW/ITZZ9d9P/ra7PreqQagC3Jg6OzqWkai13KUbG90b8QO9rHPBGK/ckw==", + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.3.tgz", + "integrity": "sha512-NjzcHYgigcbPQ6yJ52zwgsVDwKz3vwy9sjbxyzcvfXQm+j1BGeOPRuzLKEwsLyE4Xut6gG1FXJtsU9/gUB7tXg==", "dev": true }, "fragment-cache": { diff --git a/package.json b/package.json index 7f6945292..9a9001ddb 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "dtslint": "github:gcanti/dtslint", "eslint": "^7.18.0", "fast-check": "^1.24.2", - "fp-ts": "^2.8.1", + "fp-ts": "^2.9.3", "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", From 0163b6ce7fc008e623c73c99d336d717b9335fa7 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 28 Jan 2021 14:46:05 +0100 Subject: [PATCH 184/222] use Refinement when possible --- docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 2 +- docs/modules/Guard.ts.md | 2 +- docs/modules/Schemable.ts.md | 6 +++--- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 2 +- src/Codec.ts | 4 ++-- src/Decoder.ts | 2 +- src/Guard.ts | 3 ++- src/Schemable.ts | 7 ++++--- src/TaskDecoder.ts | 2 +- src/Type.ts | 3 ++- test/Arbitrary.ts | 3 ++- 13 files changed, 22 insertions(+), 18 deletions(-) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 3dff9dd9d..5fa777bc9 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -253,7 +253,7 @@ Added in v2.2.3 ```ts export declare const refine: ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ) => (from: Codec) => Codec ``` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index dc7255a86..8cd8c083f 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -344,7 +344,7 @@ Added in v2.2.7 ```ts export declare const refine: ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ) => (from: Decoder) => Decoder ``` diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 72caf9230..b55856287 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -158,7 +158,7 @@ Added in v2.2.0 ```ts export declare const refine: ( - refinement: (a: A) => a is B + refinement: Refinement ) => (from: Guard) => Guard ``` diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 2f9aeef47..0f5405350 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -140,7 +140,7 @@ Added in v2.2.8 ```ts export interface WithRefine { - readonly refine: (refinement: (a: A) => a is B, id: string) => (from: HKT) => HKT + readonly refine: (refinement: Refinement, id: string) => (from: HKT) => HKT } ``` @@ -152,7 +152,7 @@ Added in v2.2.3 ```ts export interface WithRefine1 { - readonly refine: (refinement: (a: A) => a is B, id: string) => (from: Kind) => Kind + readonly refine: (refinement: Refinement, id: string) => (from: Kind) => Kind } ``` @@ -165,7 +165,7 @@ Added in v2.2.3 ```ts export interface WithRefine2C { readonly refine: ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ) => (from: Kind2) => Kind2 } diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 2ec9b094d..484312419 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -347,7 +347,7 @@ Added in v2.2.7 ```ts export declare const refine: ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ) => (from: TaskDecoder) => TaskDecoder ``` diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index ec439c83e..11d2695bc 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -118,7 +118,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const refine: (refinement: (a: A) => a is B, id: string) => (from: Type) => Type +export declare const refine: (refinement: Refinement, id: string) => (from: Type) => Type ``` Added in v2.2.3 diff --git a/src/Codec.ts b/src/Codec.ts index 301bcbe5e..ec1042594 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -8,7 +8,7 @@ * * @since 2.2.3 */ -import { identity } from 'fp-ts/lib/function' +import { identity, Refinement } from 'fp-ts/lib/function' import { Invariant3 } from 'fp-ts/lib/Invariant' import { pipe } from 'fp-ts/lib/pipeable' import * as D from './Decoder' @@ -127,7 +127,7 @@ export const mapLeftWithInput = (f: (i: I, e: D.DecodeError) => D.DecodeError * @since 2.2.3 */ export const refine = ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ): ((from: Codec) => Codec) => { const refine = D.refine(refinement, id) diff --git a/src/Decoder.ts b/src/Decoder.ts index f08165842..a62436667 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -206,7 +206,7 @@ export const withMessage = ( * @since 2.2.7 */ export const refine = ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ): ((from: Decoder) => Decoder) => K.refine(M)(refinement, (a) => error(a, id)) diff --git a/src/Guard.ts b/src/Guard.ts index 9747db1cb..78f9ab6ec 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -8,6 +8,7 @@ * * @since 2.2.0 */ +import { Refinement } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' @@ -103,7 +104,7 @@ export const UnknownRecord: Guard> = { * @category combinators * @since 2.2.0 */ -export const refine = (refinement: (a: A) => a is B) => ( +export const refine = (refinement: Refinement) => ( from: Guard ): Guard => ({ is: (i: I): i is B => from.is(i) && refinement(i) diff --git a/src/Schemable.ts b/src/Schemable.ts index 4f387b639..4834623cd 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -8,6 +8,7 @@ * * @since 2.2.0 */ +import { Refinement } from 'fp-ts/lib/function' import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' /** @@ -140,14 +141,14 @@ export interface WithUnion2C { * @since 2.2.3 */ export interface WithRefine { - readonly refine: (refinement: (a: A) => a is B, id: string) => (from: HKT) => HKT + readonly refine: (refinement: Refinement, id: string) => (from: HKT) => HKT } /** * @since 2.2.3 */ export interface WithRefine1 { - readonly refine: (refinement: (a: A) => a is B, id: string) => (from: Kind) => Kind + readonly refine: (refinement: Refinement, id: string) => (from: Kind) => Kind } /** @@ -155,7 +156,7 @@ export interface WithRefine1 { */ export interface WithRefine2C { readonly refine: ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ) => (from: Kind2) => Kind2 } diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 33cef914d..4132da3a8 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -207,7 +207,7 @@ export const withMessage = ( * @since 2.2.7 */ export const refine = ( - refinement: (a: A) => a is B, + refinement: Refinement, id: string ): ((from: TaskDecoder) => TaskDecoder) => K.refine(M)(refinement, (a) => error(a, id)) diff --git a/src/Type.ts b/src/Type.ts index 744cf72a1..852cfea07 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -9,6 +9,7 @@ * @since 2.2.3 */ import * as E from 'fp-ts/lib/Either' +import { Refinement } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' import * as t from './index' import * as S from './Schemable' @@ -85,7 +86,7 @@ export const UnknownRecord: Type> = t.UnknownRecord * @category combinators * @since 2.2.3 */ -export const refine = (refinement: (a: A) => a is B, id: string) => (from: Type): Type => +export const refine = (refinement: Refinement, id: string) => (from: Type): Type => // tslint:disable-next-line: deprecation t.refinement(from, refinement, id) as any diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index ab3002299..40b7f2543 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -2,6 +2,7 @@ * An instance of `Schemable` for `fast-check` arbitraries that emit valid values */ import * as fc from 'fast-check' +import { Refinement } from 'fp-ts/lib/function' import * as S from '../src/Schemable' // ------------------------------------------------------------------------------------- @@ -42,7 +43,7 @@ export const UnknownRecord: Arbitrary> = fc.dictionary(s // combinators // ------------------------------------------------------------------------------------- -export const refine = (refinement: (a: A) => a is B) => (from: Arbitrary): Arbitrary => +export const refine = (refinement: Refinement) => (from: Arbitrary): Arbitrary => from.filter(refinement) export function nullable(or: Arbitrary): Arbitrary { From cd5a1b089e39b1b0c2b1b3a555f5267a9d6f4710 Mon Sep 17 00:00:00 2001 From: Wayne Van Son Date: Wed, 3 Feb 2021 16:37:51 +0000 Subject: [PATCH 185/222] tests: fixes spelling errors in guards.ts --- test/Guard.ts | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/test/Guard.ts b/test/Guard.ts index 0ae0887bd..91b832e49 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -47,7 +47,7 @@ describe('Guard', () => { }) describe('refine', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = pipe( G.string, G.refine((s): s is string => s.length > 0) @@ -55,7 +55,7 @@ describe('Guard', () => { assert.strictEqual(guard.is('a'), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = pipe( G.string, G.refine((s): s is string => s.length > 0) @@ -66,30 +66,30 @@ describe('Guard', () => { }) describe('nullable', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = G.nullable(G.string) assert.strictEqual(guard.is(null), true) assert.strictEqual(guard.is('a'), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.nullable(G.string) assert.strictEqual(guard.is(1), false) }) }) describe('type', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = G.type({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) }) - it('should accepts additional fields', () => { + it('should accept additional fields', () => { const guard = G.type({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1, c: true }), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.type({ a: G.string, b: G.number }) assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is({ a: 'a' }), false) @@ -118,7 +118,7 @@ describe('Guard', () => { }) describe('partial', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = G.partial({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) assert.strictEqual(guard.is({ a: 'a' }), true) @@ -126,12 +126,12 @@ describe('Guard', () => { assert.strictEqual(guard.is({}), true) }) - it('should accepts additional fields', () => { + it('should accept additional fields', () => { const guard = G.partial({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1, c: true }), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.partial({ a: G.string, b: G.number }) assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is({ a: 'a', b: 'b' }), false) @@ -152,13 +152,13 @@ describe('Guard', () => { }) describe('record', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = G.record(G.string) assert.strictEqual(guard.is({}), true) assert.strictEqual(guard.is({ a: 'a', b: 'b' }), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.record(G.string) assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is({ a: 'a', b: 1 }), false) @@ -166,13 +166,13 @@ describe('Guard', () => { }) describe('array', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = G.array(G.number) assert.strictEqual(guard.is([]), true) assert.strictEqual(guard.is([1, 2, 3]), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.array(G.number) assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is(['a']), false) @@ -180,47 +180,47 @@ describe('Guard', () => { }) describe('tuple', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = G.tuple(G.string, G.number) assert.strictEqual(guard.is(['a', 1]), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.tuple(G.string, G.number) assert.strictEqual(guard.is([1, 2]), false) }) - it('should rejects additional fields', () => { + it('should reject additional fields', () => { const guard = G.tuple(G.string, G.number) assert.strictEqual(guard.is(['a', 1, true]), false) }) - it('should rejects missing fields', () => { + it('should reject missing fields', () => { const guard = G.tuple(G.string, G.number) assert.strictEqual(guard.is(['a']), false) }) }) describe('intersect', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = pipe(G.type({ a: G.string }), G.intersect(G.type({ b: G.number }))) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = pipe(G.type({ a: G.string }), G.intersect(G.type({ b: G.number }))) assert.strictEqual(guard.is({ a: 'a' }), false) }) }) describe('union', () => { - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = G.union(G.string, G.number) assert.strictEqual(guard.is('a'), true) assert.strictEqual(guard.is(1), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.union(G.string, G.number) assert.strictEqual(guard.is(undefined), false) }) @@ -239,12 +239,12 @@ describe('Guard', () => { }) ) - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { assert.strictEqual(guard.is({ a: 1, b: [] }), true) assert.strictEqual(guard.is({ a: 1, b: [{ a: 2, b: [] }] }), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = G.union(G.string, G.number) assert.strictEqual(guard.is(undefined), false) }) @@ -253,7 +253,7 @@ describe('Guard', () => { describe('sum', () => { const sum = G.sum('_tag') - it('should accepts valid inputs', () => { + it('should accept valid inputs', () => { const guard = sum({ A: G.type({ _tag: G.literal('A'), a: G.string }), B: G.type({ _tag: G.literal('B'), b: G.number }) @@ -262,7 +262,7 @@ describe('Guard', () => { assert.deepStrictEqual(guard.is({ _tag: 'B', b: 1 }), true) }) - it('should rejects invalid inputs', () => { + it('should reject invalid inputs', () => { const guard = sum({ A: G.type({ _tag: G.literal('A'), a: G.string }), B: G.type({ _tag: G.literal('B'), b: G.number }) From eedc19781bc1cc40789fbd360e627e794499ab22 Mon Sep 17 00:00:00 2001 From: Wayne Van Son Date: Wed, 3 Feb 2021 17:56:11 +1100 Subject: [PATCH 186/222] relax `UnknownRecord` check, closes #559 --- src/Guard.ts | 2 +- test/Guard.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Guard.ts b/src/Guard.ts index 78f9ab6ec..1d9b58682 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -93,7 +93,7 @@ export const UnknownArray: Guard> = { * @since 2.2.0 */ export const UnknownRecord: Guard> = { - is: (u: unknown): u is Record => Object.prototype.toString.call(u) === '[object Object]' + is: (u: unknown): u is Record => u != null && typeof u === 'object' && !Array.isArray(u) } // ------------------------------------------------------------------------------------- diff --git a/test/Guard.ts b/test/Guard.ts index 91b832e49..44ab3cf8d 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -1,6 +1,7 @@ import * as assert from 'assert' import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' +import { Stream } from 'stream' interface NonEmptyStringBrand { readonly NonEmptyString: unique symbol @@ -281,4 +282,16 @@ describe('Guard', () => { assert.deepStrictEqual(guard.is({ _tag: 2, b: 'a' }), false) }) }) + + describe('UnknownRecord', () => { + it('should accept valid inputs', () => { + assert.strictEqual(G.UnknownRecord.is(new Set()), true) + assert.strictEqual(G.UnknownRecord.is(new Map()), true) + assert.strictEqual(G.UnknownRecord.is(new Stream()), true) + }) + + it('should reject invalid inputs', () => { + assert.strictEqual(G.UnknownRecord.is([]), false) + }) + }) }) From 41c5e107df1865ecb98914c63baf0d0b8abd0600 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 3 Feb 2021 08:06:15 +0100 Subject: [PATCH 187/222] Guard: more UnknownRecord tests --- src/Guard.ts | 2 +- test/Guard.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Guard.ts b/src/Guard.ts index 1d9b58682..e7855b130 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -93,7 +93,7 @@ export const UnknownArray: Guard> = { * @since 2.2.0 */ export const UnknownRecord: Guard> = { - is: (u: unknown): u is Record => u != null && typeof u === 'object' && !Array.isArray(u) + is: (u: unknown): u is Record => u !== null && typeof u === 'object' && !Array.isArray(u) } // ------------------------------------------------------------------------------------- diff --git a/test/Guard.ts b/test/Guard.ts index 44ab3cf8d..ea481f021 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -285,13 +285,18 @@ describe('Guard', () => { describe('UnknownRecord', () => { it('should accept valid inputs', () => { - assert.strictEqual(G.UnknownRecord.is(new Set()), true) - assert.strictEqual(G.UnknownRecord.is(new Map()), true) - assert.strictEqual(G.UnknownRecord.is(new Stream()), true) + assert.deepStrictEqual(G.UnknownRecord.is({}), true) + assert.deepStrictEqual(G.UnknownRecord.is(new String()), true) + assert.deepStrictEqual(G.UnknownRecord.is(new Number()), true) + assert.deepStrictEqual(G.UnknownRecord.is(new Set()), true) + assert.deepStrictEqual(G.UnknownRecord.is(new Map()), true) + assert.deepStrictEqual(G.UnknownRecord.is(new Stream()), true) }) it('should reject invalid inputs', () => { - assert.strictEqual(G.UnknownRecord.is([]), false) + assert.deepStrictEqual(G.UnknownRecord.is(null), false) + assert.deepStrictEqual(G.UnknownRecord.is(undefined), false) + assert.deepStrictEqual(G.UnknownRecord.is([]), false) }) }) }) From 6e0c58b0a1f445a1ba9bb8006d76cb43ba6d7c98 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 3 Feb 2021 08:06:43 +0100 Subject: [PATCH 188/222] bump version --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c04639e9..9c1fd36d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.14 + +- **Experimental** + - `Guard` + - relax `UnknownRecord` check, closes #559 (@waynevanson) + # 2.2.13 - **Bug Fix** diff --git a/package.json b/package.json index 9a9001ddb..6d2c1d2b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.13", + "version": "2.2.14", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", From b9ed38482f2a7c26d1dae5599958e4269ddabf28 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 12 Feb 2021 08:49:50 +0100 Subject: [PATCH 189/222] add JsonSchema tests --- jest.config.js | 2 +- package-lock.json | 8 +- package.json | 2 +- test/JsonSchema.test.ts | 172 ++++++++++++++++++++++++++++++++++ test/JsonSchema.ts | 203 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 381 insertions(+), 6 deletions(-) create mode 100644 test/JsonSchema.test.ts create mode 100644 test/JsonSchema.ts diff --git a/jest.config.js b/jest.config.js index 80716b030..084a6cf0d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,5 +16,5 @@ module.exports = { statements: 100 } }, - modulePathIgnorePatterns: ['2.1.x/helpers.ts', 'Arbitrary.ts', 'helpers.ts'] + modulePathIgnorePatterns: ['2.1.x/helpers.ts', 'Arbitrary.ts', 'helpers.ts', 'JsonSchema.ts'] } diff --git a/package-lock.json b/package-lock.json index 26ab7a77c..b358c8923 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.13", + "version": "2.2.14", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3234,9 +3234,9 @@ "dev": true }, "fp-ts": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.3.tgz", - "integrity": "sha512-NjzcHYgigcbPQ6yJ52zwgsVDwKz3vwy9sjbxyzcvfXQm+j1BGeOPRuzLKEwsLyE4Xut6gG1FXJtsU9/gUB7tXg==", + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.5.tgz", + "integrity": "sha512-MiHrA5teO6t8zKArE3DdMPT/Db6v2GUt5yfWnhBTrrsVfeCJUUnV6sgFvjGNBKDmEMqVwRFkEePL7wPwqrLKKA==", "dev": true }, "fragment-cache": { diff --git a/package.json b/package.json index 6d2c1d2b0..6482af43f 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "dtslint": "github:gcanti/dtslint", "eslint": "^7.18.0", "fast-check": "^1.24.2", - "fp-ts": "^2.9.3", + "fp-ts": "^2.9.5", "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", diff --git a/test/JsonSchema.test.ts b/test/JsonSchema.test.ts new file mode 100644 index 000000000..3fbaf7e58 --- /dev/null +++ b/test/JsonSchema.test.ts @@ -0,0 +1,172 @@ +import * as assert from 'assert' +import Ajv from 'ajv' +import * as J from './JsonSchema' +import * as C from 'fp-ts/Const' +import { pipe } from 'fp-ts/function' + +const ajv = new Ajv() + +describe('JsonSchema', () => { + it('literal', () => { + const validate = ajv.compile(J.literal('a').compile()) + assert.strictEqual(validate('a'), true) + assert.strictEqual(validate(1), false) + }) + + it('string', () => { + const validate = ajv.compile(J.string.compile()) + assert.strictEqual(validate('a'), true) + assert.strictEqual(validate(1), false) + }) + + it('boolean', () => { + const validate = ajv.compile(J.boolean.compile()) + assert.strictEqual(validate(true), true) + assert.strictEqual(validate(1), false) + }) + + it('UnknownArray', () => { + const validate = ajv.compile(J.UnknownArray.compile()) + assert.strictEqual(validate([]), true) + assert.strictEqual(validate([1, 2, 3]), true) + assert.strictEqual(validate(1), false) + assert.strictEqual(validate([1, undefined, 3]), true) + }) + + it('UnknownRecord', () => { + const validate = ajv.compile(J.UnknownRecord.compile()) + assert.strictEqual(validate({}), true) + assert.strictEqual(validate({ a: 'a', b: 1 }), true) + assert.strictEqual(validate(1), false) + assert.strictEqual(validate({ a: 'a', b: 1, c: undefined }), true) + }) + + it('type', () => { + const schema = J.type({ a: J.string, b: J.number }).compile() + const validate = ajv.compile(schema) + assert.strictEqual(validate({ a: 'a', b: 1 }), true) + assert.strictEqual(validate({ a: 'a' }), false) + assert.strictEqual(validate({ a: 'a', b: 'b' }), false) + }) + + it('partial', () => { + const validate = ajv.compile(J.partial({ a: J.string, b: J.number }).compile()) + assert.strictEqual(validate({ a: 'a', b: 1 }), true) + assert.strictEqual(validate({ a: 'a' }), true) + assert.strictEqual(validate({ a: 'a', b: undefined }), true) + assert.strictEqual(validate({ a: 'a', b: 'b' }), false) + }) + + it('record', () => { + const validate = ajv.compile(J.record(J.string).compile()) + assert.strictEqual(validate({ a: 'a', b: 'b' }), true) + assert.strictEqual(validate({ a: 'a', b: 1 }), false) + }) + + it('array', () => { + const validate = ajv.compile(J.array(J.number).compile()) + assert.strictEqual(validate([]), true) + assert.strictEqual(validate([1, 2, 3]), true) + assert.strictEqual(validate([1, 'a', 3]), false) + }) + + it('tuple', () => { + const validate = ajv.compile(J.tuple(J.string, J.number).compile()) + assert.strictEqual(validate(['a', 1]), true) + assert.strictEqual(validate(['a', 1, true]), false) + assert.strictEqual(validate(['a']), false) + }) + + describe('intersection', () => { + it('should handle non primitive values', () => { + const validate = ajv.compile(pipe(J.type({ a: J.string }), J.intersect(J.type({ b: J.number }))).compile()) + assert.strictEqual(validate({ a: 'a', b: 1 }), true) + assert.strictEqual(validate({ a: 'a' }), false) + }) + + interface IntBrand { + readonly Int: unique symbol + } + type Int = number & IntBrand + + const Int: J.JsonSchema = { + compile: () => + C.make({ + type: 'integer' + }) + } + const Positive: J.JsonSchema = { + compile: () => + C.make({ + type: 'number', + minimum: 0 + }) + } + + it('should handle primitives', () => { + const validate = ajv.compile(pipe(Int, J.intersect(Positive)).compile()) + assert.strictEqual(validate(1), true) + assert.strictEqual(validate(-1), false) + }) + }) + + it('sum', () => { + const sum = J.sum('_tag') + + const A = J.type({ _tag: J.literal('A'), a: J.string }) + const B = J.type({ _tag: J.literal('B'), b: J.number }) + const validate = ajv.compile(sum({ A, B }).compile()) + assert.strictEqual(validate({ _tag: 'A', a: 'a' }), true) + assert.strictEqual(validate({ _tag: 'B', b: 1 }), true) + assert.strictEqual(validate(undefined), false) + assert.strictEqual(validate({}), false) + }) + + it('union', () => { + const validate = ajv.compile(J.union(J.string, J.number).compile()) + assert.strictEqual(validate('a'), true) + assert.strictEqual(validate(1), true) + assert.strictEqual(validate(true), false) + }) + + describe('lazy', () => { + it('should support recursive json schemas', () => { + interface A { + readonly a: number + readonly b?: A + } + + const schema: J.JsonSchema = J.lazy('A', () => + pipe(J.type({ a: J.number }), J.intersect(J.partial({ b: schema }))) + ) + + const jsonSchema = schema.compile() + const validate = ajv.compile(jsonSchema) + assert.strictEqual(validate({}), false) + assert.strictEqual(validate({ a: 1 }), true) + assert.strictEqual(validate({ a: 1, b: null }), false) + assert.strictEqual(validate({ a: 1, b: { a: 2 } }), true) + }) + + it('should support mutually recursive json schemas', () => { + interface A { + readonly b?: B + } + interface B { + readonly a?: A + } + const A: J.JsonSchema = J.lazy('A', () => J.partial({ b: B })) + const B: J.JsonSchema = J.lazy('B', () => J.partial({ a: A })) + const jsonSchema = A.compile() + const validateA = ajv.compile(jsonSchema) + assert.strictEqual(validateA({}), true) + assert.strictEqual(validateA({ b: {} }), true) + assert.strictEqual(validateA({ b: { a: {} } }), true) + + const validateB = ajv.compile(B.compile()) + assert.strictEqual(validateB({}), true) + assert.strictEqual(validateB({ a: {} }), true) + assert.strictEqual(validateB({ a: { b: {} } }), true) + }) + }) +}) diff --git a/test/JsonSchema.ts b/test/JsonSchema.ts new file mode 100644 index 000000000..0eadcc3c0 --- /dev/null +++ b/test/JsonSchema.ts @@ -0,0 +1,203 @@ +import * as C from 'fp-ts/Const' +import { pipe } from 'fp-ts/function' +import * as R from 'fp-ts/ReadonlyRecord' +import { JSONSchema7 } from 'json-schema' +import * as S from '../src/Schemable' + +// ------------------------------------------------------------------------------------- +// model +// ------------------------------------------------------------------------------------- + +export interface JsonSchema { + readonly compile: (definitions?: Record) => C.Const +} + +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- + +export function literal]>( + ...values: A +): JsonSchema { + return { + compile: () => C.make({ enum: [...values] }) + } +} + +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- + +export const string: JsonSchema = { + compile: () => C.make({ type: 'string' }) +} + +export const number: JsonSchema = { + compile: () => C.make({ type: 'number' }) +} + +export const boolean: JsonSchema = { + compile: () => C.make({ type: 'boolean' }) +} + +// tslint:disable-next-line: readonly-array +export const UnknownArray: JsonSchema> = { + compile: () => C.make({ type: 'array' }) +} + +export const UnknownRecord: JsonSchema> = { + compile: () => C.make({ type: 'object' }) +} + +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- + +const nullJsonSchema: JsonSchema = { + compile: () => C.make({ enum: [null] }) +} + +export function nullable(or: JsonSchema): JsonSchema { + return union(nullJsonSchema, or) +} + +export function type(properties: { [K in keyof A]: JsonSchema }): JsonSchema { + return { + compile: (lazy) => + C.make({ + type: 'object', + properties: pipe( + properties, + R.map, JSONSchema7>((p) => p.compile(lazy)) + ), + required: Object.keys(properties) + }) + } +} + +export function partial(properties: { [K in keyof A]: JsonSchema }): JsonSchema> { + return { + compile: (lazy) => + C.make({ + type: 'object', + properties: pipe( + properties, + R.map, JSONSchema7>((p) => p.compile(lazy)) + ) + }) + } +} + +export function record(codomain: JsonSchema): JsonSchema> { + return { + compile: (lazy) => + C.make({ + type: 'object', + additionalProperties: codomain.compile(lazy) + }) + } +} + +// tslint:disable-next-line: readonly-array +export function array(items: JsonSchema): JsonSchema> { + return { + compile: (lazy) => + C.make({ + type: 'array', + items: items.compile(lazy) + }) + } +} + +export function tuple>( + ...components: { [K in keyof A]: JsonSchema } +): JsonSchema { + const len = components.length + return { + compile: (lazy) => + C.make({ + type: 'array', + items: len > 0 ? components.map((c) => c.compile(lazy)) : undefined, + minItems: len, + maxItems: len + }) + } +} + +export const intersect = (right: JsonSchema) => (left: JsonSchema): JsonSchema => ({ + compile: (lazy) => C.make({ allOf: [left.compile(lazy), right.compile(lazy)] }) +}) + +export function sum( + _tag: T +): (members: { [K in keyof A]: JsonSchema> }) => JsonSchema { + return (members: Record>) => { + return { + compile: (lazy) => C.make({ anyOf: Object.keys(members).map((k) => members[k].compile(lazy)) }) + } + } +} + +export function lazy(id: string, f: () => JsonSchema): JsonSchema { + const $ref = `#/definitions/${id}` + return { + compile: (definitions) => { + if (definitions !== undefined) { + if (definitions.hasOwnProperty(id)) { + return C.make({ $ref }) + } + definitions[id] = undefined + return (definitions[id] = f().compile(definitions)) + } else { + definitions = { [id]: undefined } + definitions[id] = f().compile(definitions) + return C.make({ + definitions, + $ref + }) + } + } + } +} + +export function union]>( + ...members: { [K in keyof A]: JsonSchema } +): JsonSchema { + return { + compile: (lazy) => C.make({ anyOf: members.map((m) => m.compile(lazy)) }) + } +} + +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- + +export const URI = 'io-ts/JsonSchema' + +export type URI = typeof URI + +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: JsonSchema + } +} + +export const Schemable: S.Schemable1 & S.WithUnknownContainers1 & S.WithUnion1 = { + URI, + literal, + string, + number, + boolean, + UnknownArray, + UnknownRecord, + nullable, + type, + partial, + record, + array, + tuple: tuple as S.Schemable1['tuple'], + intersect, + sum, + lazy, + union: union as S.WithUnion1['union'] +} From ecb94e9d87df1598365fc47a99c66a281ec2072a Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 14 Feb 2021 06:02:37 +0100 Subject: [PATCH 190/222] upgrade to latest docs-ts --- docs/_config.yml | 2 +- docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 8 +- docs/modules/TaskDecoder.ts.md | 8 +- package-lock.json | 159 +++++++++++++++++++-------------- package.json | 2 +- 6 files changed, 101 insertions(+), 80 deletions(-) diff --git a/docs/_config.yml b/docs/_config.yml index dfd75838a..58be4a3bf 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -6,4 +6,4 @@ search_enabled: true # Aux links for the upper right navigation aux_links: 'io-ts on GitHub': - - '//github.com/gcanti/io-ts' + - 'https://github.com/gcanti/io-ts' diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 5fa777bc9..8953e711f 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -207,7 +207,7 @@ Added in v2.2.3 ```ts export declare const mapLeftWithInput: ( - f: (i: I, e: FreeSemigroup>) => FreeSemigroup> + f: (i: I, e: D.DecodeError) => D.DecodeError ) => (codec: Codec) => Codec ``` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 8cd8c083f..866bb5357 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -123,7 +123,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> +export declare const error: (actual: unknown, message: string) => DecodeError ``` Added in v2.2.7 @@ -288,7 +288,7 @@ Added in v2.2.7 ```ts export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> + f: (input: I, e: DecodeError) => DecodeError ) => (decoder: Decoder) => Decoder ``` @@ -405,7 +405,7 @@ Added in v2.2.7 ```ts export declare const withMessage: ( - message: (input: I, e: FS.FreeSemigroup>) => string + message: (input: I, e: DecodeError) => string ) => (decoder: Decoder) => Decoder ``` @@ -628,7 +628,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const draw: (e: FS.FreeSemigroup>) => string +export declare const draw: (e: DecodeError) => string ``` Added in v2.2.7 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 484312419..73a452756 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -124,7 +124,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const error: (actual: unknown, message: string) => FS.FreeSemigroup> +export declare const error: (actual: unknown, message: string) => DecodeError ``` Added in v2.2.7 @@ -291,7 +291,7 @@ Added in v2.2.7 ```ts export declare const mapLeftWithInput: ( - f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> + f: (input: I, e: DecodeError) => DecodeError ) => (decoder: TaskDecoder) => TaskDecoder ``` @@ -408,7 +408,7 @@ Added in v2.2.7 ```ts export declare const withMessage: ( - message: (input: I, e: FS.FreeSemigroup>) => string + message: (input: I, e: DecodeError) => string ) => (decoder: TaskDecoder) => TaskDecoder ``` @@ -644,7 +644,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const draw: (e: FS.FreeSemigroup>) => string +export declare const draw: (e: DecodeError) => string ``` Added in v2.2.7 diff --git a/package-lock.json b/package-lock.json index b358c8923..f864d39c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -923,35 +923,37 @@ } }, "@ts-morph/common": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.1.1.tgz", - "integrity": "sha512-8TLlC85CXgKNoTeqoXtrscPmKDbQCBfwZJ4hqli/QI4STa7sD2H6UqI9LSg8uBV5FYaD0QSdj/mtrCDrELvF+Q==", + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.7.5.tgz", + "integrity": "sha512-nlFunSKAsFWI0Ol/uPxJcpVqXxTGNuaWXTmoQDhcnwj1UM4QmBSUVWzqoQ0OzUlqo4sV1gobfFBkMHuZVemMAQ==", "dev": true, "requires": { "@dsherret/to-absolute-glob": "^2.0.2", - "fs-extra": "^8.1.0", - "glob-parent": "^5.1.0", - "globby": "^10.0.1", + "fast-glob": "^3.2.5", "is-negated-glob": "^1.0.0", - "multimatch": "^4.0.0", - "typescript": "~3.7.2" + "mkdirp": "^1.0.4", + "multimatch": "^5.0.0", + "typescript": "~4.1.3" }, "dependencies": { - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", "dev": true, "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" } }, - "typescript": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", - "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true } } @@ -1009,16 +1011,6 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, - "@types/glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==", - "dev": true, - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, "@types/istanbul-lib-coverage": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", @@ -1974,9 +1966,9 @@ "dev": true }, "code-block-writer": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.0.tgz", - "integrity": "sha512-RG9hpXtWFeUWhuUav1YuP/vGcyncW+t90yJLk9fNZs1De2OuHTHKAKThVCokt29PYq5RoJ0QSZaIZ+rvPO23hA==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", "dev": true }, "coffee-script": { @@ -2293,27 +2285,37 @@ } }, "docs-ts": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.5.1.tgz", - "integrity": "sha512-zdBt4P6X7h577/Vku0YHAw/RR1+zpKklK+DOzed1HJltwAAciQG14qy18TzcMbVUFxrnT9OO4Y1K/lQLdX1i/Q==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.6.1.tgz", + "integrity": "sha512-B/SjymEpFR0ikAMRCZDmmQYmrWnwz53U9rUaI6KwbQW4mU0+QZt+DkrfB39yaidJRwISf/2o51ebWxMPi9jX5Q==", "dev": true, "requires": { "chalk": "^2.4.2", "doctrine": "^3.0.0", - "fp-ts": "^2.6.2", + "fp-ts": "^2.9.3", "fs-extra": "^7.0.1", - "glob": "^7.1.3", + "glob": "^7.1.6", + "io-ts": "^2.2.13", + "logging-ts": "^0.3.4", "markdown-toc": "^1.2.0", - "rimraf": "^2.6.3", - "ts-morph": "^5.0.0", - "ts-node": "^8.0.2" + "rimraf": "^2.7.1", + "ts-morph": "^9.1.0", + "ts-node": "^8.10.2" }, "dependencies": { - "fp-ts": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.6.5.tgz", - "integrity": "sha512-lQNzOMJj98b623+UZLQ+tnN/8qtNXz/vRoR9k7L/9OlUIyYH3qVzSUVZBDXYsAd7nOWzzdQALCX1ZqcF70altQ==", - "dev": true + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } }, "rimraf": { "version": "2.7.1", @@ -2323,6 +2325,29 @@ "requires": { "glob": "^7.1.3" } + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + } } } }, @@ -3349,22 +3374,6 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "globby": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz", - "integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.0.3", - "glob": "^7.1.3", - "ignore": "^5.1.1", - "merge2": "^1.2.3", - "slash": "^3.0.0" - } - }, "graceful-fs": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", @@ -3698,6 +3707,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "io-ts": { + "version": "2.2.14", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.14.tgz", + "integrity": "sha512-UWL1mdDe5YI4+/7YlrbsSwKmsECFFlWcVHT2CPGzeNODHj2qY0cibjulYfrfz5SCPoDAsjVP7vFKGcF+L10+SQ==", + "dev": true + }, "ip-regex": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", @@ -5574,6 +5589,12 @@ "chalk": "^2.4.2" } }, + "logging-ts": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/logging-ts/-/logging-ts-0.3.4.tgz", + "integrity": "sha512-TJYaSB88h8N9/ojruoGZgJeQEwpLmDNWpGf03hDgjPNo5QnwO28vkSH/H8/9aMoX8zeShVJUOnKRM6zs5ifR0A==", + "dev": true + }, "lolex": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", @@ -5990,9 +6011,9 @@ "dev": true }, "multimatch": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", - "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", + "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", "dev": true, "requires": { "@types/minimatch": "^3.0.3", @@ -7819,14 +7840,14 @@ } }, "ts-morph": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-5.0.0.tgz", - "integrity": "sha512-VP5dFnOzmlsDkSyuGczgVNtyJdYXMxFqMO2Rb0pIeni0o0Cy/nDljETBWhJs4FI4DIWv7Ftq69kgZO8p8w6LCw==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-9.1.0.tgz", + "integrity": "sha512-sei4u651MBenr27sD6qLDXN3gZ4thiX71E3qV7SuVtDas0uvK2LtgZkIYUf9DKm/fLJ6AB/+yhRJ1vpEBJgy7Q==", "dev": true, "requires": { "@dsherret/to-absolute-glob": "^2.0.2", - "@ts-morph/common": "~0.1.0", - "code-block-writer": "^10.0.0" + "@ts-morph/common": "~0.7.0", + "code-block-writer": "^10.1.1" } }, "ts-node": { diff --git a/package.json b/package.json index 6482af43f..580d397ac 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/parser": "^4.14.1", "benchmark": "2.1.4", - "docs-ts": "^0.5.1", + "docs-ts": "^0.6.1", "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", "eslint": "^7.18.0", From 192ccb8b05eeebf5709cdf0bfef339244ac3b4b3 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 14 Feb 2021 06:24:29 +0100 Subject: [PATCH 191/222] fix build --- package-lock.json | 10 ++++++++++ package.json | 1 + 2 files changed, 11 insertions(+) diff --git a/package-lock.json b/package-lock.json index f864d39c9..8df34e3ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1011,6 +1011,16 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, + "@types/glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", + "dev": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "@types/istanbul-lib-coverage": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", diff --git a/package.json b/package.json index 580d397ac..ab39b7d65 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ }, "devDependencies": { "@types/benchmark": "1.0.31", + "@types/glob": "^7.1.3", "@types/jest": "25.2.1", "@types/node": "13.11.0", "@typescript-eslint/eslint-plugin": "^4.14.1", From a7952a62a65168008b1d5a23025447ddc3311d59 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 14 Feb 2021 07:07:15 +0100 Subject: [PATCH 192/222] upgrade to latest docs-ts --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8df34e3ba..f77485aa5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2295,9 +2295,9 @@ } }, "docs-ts": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.6.1.tgz", - "integrity": "sha512-B/SjymEpFR0ikAMRCZDmmQYmrWnwz53U9rUaI6KwbQW4mU0+QZt+DkrfB39yaidJRwISf/2o51ebWxMPi9jX5Q==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.6.2.tgz", + "integrity": "sha512-61u998y7nKi9J3/Vw8BRXeNAIepDsODmVKvPHgqRdMGSE+nR/yb7b5qspCbcUcsCnJ9eDhTJc22nlGdt0NSPRw==", "dev": true, "requires": { "chalk": "^2.4.2", diff --git a/package.json b/package.json index ab39b7d65..67b02b661 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/parser": "^4.14.1", "benchmark": "2.1.4", - "docs-ts": "^0.6.1", + "docs-ts": "^0.6.2", "doctoc": "1.4.0", "dtslint": "github:gcanti/dtslint", "eslint": "^7.18.0", From 2dc13a8204df42a7929d19af3307cda036dba402 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 17 Feb 2021 16:05:10 +0100 Subject: [PATCH 193/222] Schemable: add readonly combinator, closes #525 --- CHANGELOG.md | 8 ++++++++ docs/modules/Decoder.ts.md | 11 +++++++++++ docs/modules/Eq.ts.md | 11 +++++++++++ docs/modules/Guard.ts.md | 11 +++++++++++ docs/modules/Schemable.ts.md | 3 +++ docs/modules/TaskDecoder.ts.md | 11 +++++++++++ docs/modules/Type.ts.md | 11 +++++++++++ dtslint/ts3.5/Decoder.ts | 11 +++++++++++ dtslint/ts3.5/Eq.ts | 11 +++++++++++ dtslint/ts3.5/Guard.ts | 11 +++++++++++ dtslint/ts3.5/Schema.ts | 7 +++++++ dtslint/ts3.5/TaskDecoder.ts | 11 +++++++++++ dtslint/ts3.5/Type.ts | 11 +++++++++++ package.json | 2 +- src/Decoder.ts | 11 +++++++++-- src/Eq.ts | 10 +++++++++- src/Guard.ts | 11 +++++++++-- src/Schemable.ts | 3 +++ src/TaskDecoder.ts | 11 +++++++++-- src/Type.ts | 11 +++++++++-- test/Arbitrary.ts | 5 ++++- test/JsonSchema.ts | 5 ++++- 22 files changed, 185 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1fd36d1..a89ea2a7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,14 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.15 + +- **Experimental** + - `Schemable` + - (\*) add `readonly` combinator (@gcanti) + +(\*) breaking change + # 2.2.14 - **Experimental** diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 866bb5357..daa1a08ac 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -46,6 +46,7 @@ Added in v2.2.7 - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [readonly](#readonly) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -328,6 +329,16 @@ export declare const partial: ( Added in v2.2.7 +## readonly + +**Signature** + +```ts +export declare const readonly: (decoder: Decoder) => Decoder> +``` + +Added in v2.2.15 + ## record **Signature** diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index 7c23c1f91..cce08dfd9 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -25,6 +25,7 @@ Added in v2.2.2 - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) + - [readonly](#readonly) - [record](#record) - [sum](#sum) - [tuple](#tuple) @@ -97,6 +98,16 @@ export declare function partial(properties: { [K in keyof A]: Eq }): Eq Added in v2.2.2 +## readonly + +**Signature** + +```ts +export declare const readonly: (eq: E.Eq) => E.Eq> +``` + +Added in v2.2.15 + ## record **Signature** diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index b55856287..6fe59133f 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -28,6 +28,7 @@ Added in v2.2.0 - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) + - [readonly](#readonly) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -142,6 +143,16 @@ export declare const partial: ( Added in v2.2.0 +## readonly + +**Signature** + +```ts +export declare const readonly: (guard: Guard) => Guard> +``` + +Added in v2.2.15 + ## record **Signature** diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 0f5405350..a43a7879b 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -71,6 +71,7 @@ export interface Schemable { tag: T ) => (members: { [K in keyof A]: HKT> }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT + readonly readonly: (sa: HKT) => HKT> } ``` @@ -98,6 +99,7 @@ export interface Schemable1 { tag: T ) => (members: { [K in keyof A]: Kind> }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind + readonly readonly: (sa: Kind) => Kind> } ``` @@ -129,6 +131,7 @@ export interface Schemable2C { tag: T ) => (members: { [K in keyof A]: Kind2> }) => Kind2 readonly lazy: (id: string, f: () => Kind2) => Kind2 + readonly readonly: (sa: Kind2) => Kind2> } ``` diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 73a452756..d7595c51f 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -46,6 +46,7 @@ Added in v2.2.7 - [nullable](#nullable) - [parse](#parse) - [partial](#partial) + - [readonly](#readonly) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -331,6 +332,16 @@ export declare const partial: ( Added in v2.2.7 +## readonly + +**Signature** + +```ts +export declare const readonly: (decoder: TaskDecoder) => TaskDecoder> +``` + +Added in v2.2.15 + ## record **Signature** diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 11d2695bc..f91a497d9 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -25,6 +25,7 @@ Added in v2.2.3 - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) + - [readonly](#readonly) - [record](#record) - [refine](#refine) - [sum](#sum) @@ -103,6 +104,16 @@ export declare const partial: (properties: { [K in keyof A]: Type }) => Added in v2.2.3 +## readonly + +**Signature** + +```ts +export declare const readonly: (type: Type) => Type> +``` + +Added in v2.2.15 + ## record **Signature** diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index ad43cff69..1221eee5c 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -147,3 +147,14 @@ pipe( _.number, _.mapLeftWithInput((u) => FS.of(DE.leaf(u, 'not a number'))) ) + +// +// readonly +// + +// $ExpectType Decoder> +_.readonly( + _.type({ + a: _.string + }) +) diff --git a/dtslint/ts3.5/Eq.ts b/dtslint/ts3.5/Eq.ts index 5e948dc08..20caf616b 100644 --- a/dtslint/ts3.5/Eq.ts +++ b/dtslint/ts3.5/Eq.ts @@ -27,3 +27,14 @@ const S2 = _.type({ _tag: _.Schemable.literal('B'), b: _.number }) _.sum('_tag')({ A: S1, B: S2 }) // // $ExpectError // _.sum('_tag')({ A: S1, B: S1 }) + +// +// readonly +// + +// $ExpectType Eq> +_.readonly( + _.type({ + a: _.string + }) +) diff --git a/dtslint/ts3.5/Guard.ts b/dtslint/ts3.5/Guard.ts index afc8a9a42..94b07457d 100644 --- a/dtslint/ts3.5/Guard.ts +++ b/dtslint/ts3.5/Guard.ts @@ -42,3 +42,14 @@ const S2 = _.type({ _tag: _.literal('B'), b: _.number }) _.sum('_tag')({ A: S1, B: S2 }) // $ExpectError _.sum('_tag')({ A: S1, B: S1 }) + +// +// readonly +// + +// $ExpectType Guard> +_.readonly( + _.type({ + a: _.string + }) +) diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index 921fd5a41..84b67930f 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -172,3 +172,10 @@ make((S) => make((S) => S.union()) make((S) => S.union(S.string)) // $ExpectType Schema make((S) => S.union(S.string, S.number)) // $ExpectType Schema + +// +// readonly +// + +// $ExpectType Schema> +make((S) => S.readonly(S.type({ a: S.string }))) diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts index 8d8af5d4d..4b426c47c 100644 --- a/dtslint/ts3.5/TaskDecoder.ts +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -11,3 +11,14 @@ const S2 = _.type({ _tag: _.literal('B'), b: _.number }) _.sum('_tag')({ A: S1, B: S2 }) // $ExpectError _.sum('_tag')({ A: S1, B: S1 }) + +// +// readonly +// + +// $ExpectType TaskDecoder> +_.readonly( + _.type({ + a: _.string + }) +) diff --git a/dtslint/ts3.5/Type.ts b/dtslint/ts3.5/Type.ts index cf7aec6f3..feb9e213d 100644 --- a/dtslint/ts3.5/Type.ts +++ b/dtslint/ts3.5/Type.ts @@ -15,3 +15,14 @@ _.partial({ c: _.number }) }) + +// +// readonly +// + +// $ExpectType Type> +_.readonly( + _.type({ + a: _.string + }) +) diff --git a/package.json b/package.json index 67b02b661..f949262ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.14", + "version": "2.2.15", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", diff --git a/src/Decoder.ts b/src/Decoder.ts index a62436667..1c47116e4 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -12,7 +12,7 @@ import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import { Category2 } from 'fp-ts/lib/Category' import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' +import { identity, Refinement } from 'fp-ts/lib/function' import { Functor2 } from 'fp-ts/lib/Functor' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' @@ -356,6 +356,12 @@ export const lazy: (id: string, f: () => Decoder) => Decoder = /*#__PURE__*/ K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +/** + * @category combinators + * @since 2.2.15 + */ +export const readonly: (decoder: Decoder) => Decoder> = identity + // ------------------------------------------------------------------------------------- // non-pipeables // ------------------------------------------------------------------------------------- @@ -471,7 +477,8 @@ export const Schemable: S.Schemable2C = { tuple: tuple as S.Schemable2C['tuple'], intersect, sum, - lazy + lazy, + readonly } /** diff --git a/src/Eq.ts b/src/Eq.ts index 49a4f2577..326fe0978 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -10,6 +10,7 @@ */ import * as A from 'fp-ts/lib/Array' import * as E from 'fp-ts/lib/Eq' +import { identity } from 'fp-ts/lib/function' import * as R from 'fp-ts/lib/Record' import { memoize, Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' import Eq = E.Eq @@ -173,6 +174,12 @@ export function lazy(f: () => Eq): Eq { } } +/** + * @category combinators + * @since 2.2.15 + */ +export const readonly: (eq: Eq) => Eq> = identity + // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -195,7 +202,8 @@ export const Schemable: Schemable1 = { tuple, intersect, sum, - lazy: (_, f) => lazy(f) + lazy: (_, f) => lazy(f), + readonly } /** diff --git a/src/Guard.ts b/src/Guard.ts index e7855b130..b569b5ae9 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -8,7 +8,7 @@ * * @since 2.2.0 */ -import { Refinement } from 'fp-ts/lib/function' +import { identity, Refinement } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' @@ -243,6 +243,12 @@ export const lazy = (f: () => Guard): Guard => { } } +/** + * @category combinators + * @since 2.2.15 + */ +export const readonly: (guard: Guard) => Guard> = identity + /** * @category combinators * @since 2.2.8 @@ -315,7 +321,8 @@ export const Schemable: Schemable1 = { tuple: tuple as Schemable1['tuple'], intersect, sum, - lazy: (_, f) => lazy(f) + lazy: (_, f) => lazy(f), + readonly } /** diff --git a/src/Schemable.ts b/src/Schemable.ts index 4834623cd..ac92c490e 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -36,6 +36,7 @@ export interface Schemable { tag: T ) => (members: { [K in keyof A]: HKT> }) => HKT readonly lazy: (id: string, f: () => HKT) => HKT + readonly readonly: (sa: HKT) => HKT> } /** @@ -58,6 +59,7 @@ export interface Schemable1 { tag: T ) => (members: { [K in keyof A]: Kind> }) => Kind readonly lazy: (id: string, f: () => Kind) => Kind + readonly readonly: (sa: Kind) => Kind> } /** @@ -84,6 +86,7 @@ export interface Schemable2C { tag: T ) => (members: { [K in keyof A]: Kind2> }) => Kind2 readonly lazy: (id: string, f: () => Kind2) => Kind2 + readonly readonly: (sa: Kind2) => Kind2> } /** diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 4132da3a8..16d0602b1 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -12,7 +12,7 @@ import { Alt2, Alt2C } from 'fp-ts/lib/Alt' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import { Category2 } from 'fp-ts/lib/Category' import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' +import { identity, Refinement } from 'fp-ts/lib/function' import { Functor2 } from 'fp-ts/lib/Functor' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' @@ -362,6 +362,12 @@ export const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder /*#__PURE__*/ K.lazy(M)((id, e) => FS.of(DE.lazy(id, e))) +/** + * @category combinators + * @since 2.2.15 + */ +export const readonly: (decoder: TaskDecoder) => TaskDecoder> = identity + // ------------------------------------------------------------------------------------- // non-pipeables // ------------------------------------------------------------------------------------- @@ -477,7 +483,8 @@ export const Schemable: S.Schemable2C = { tuple: tuple as S.Schemable2C['tuple'], intersect, sum, - lazy + lazy, + readonly } /** diff --git a/src/Type.ts b/src/Type.ts index 852cfea07..db5f8a373 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -9,7 +9,7 @@ * @since 2.2.3 */ import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' +import { identity, Refinement } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' import * as t from './index' import * as S from './Schemable' @@ -141,6 +141,12 @@ export const intersect = (right: Type) => (left: Type): Type */ export const lazy = (id: string, f: () => Type): Type => t.recursion(id, f) +/** + * @category combinators + * @since 2.2.15 + */ +export const readonly: (type: Type) => Type> = identity + /** * @category combinators * @since 2.2.3 @@ -197,7 +203,8 @@ export const Schemable: S.Schemable1 = { tuple: tuple as S.Schemable1['tuple'], intersect, sum, - lazy + lazy, + readonly } /** diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 40b7f2543..6a4e44129 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -2,7 +2,7 @@ * An instance of `Schemable` for `fast-check` arbitraries that emit valid values */ import * as fc from 'fast-check' -import { Refinement } from 'fp-ts/lib/function' +import { identity, Refinement } from 'fp-ts/lib/function' import * as S from '../src/Schemable' // ------------------------------------------------------------------------------------- @@ -94,6 +94,8 @@ export function lazy(f: () => Arbitrary): Arbitrary { return fc.constant(null).chain(() => get()) } +export const readonly: (arb: Arbitrary) => Arbitrary> = identity + export function union, ...Array>]>( ...members: { [K in keyof A]: Arbitrary } ): Arbitrary { @@ -129,6 +131,7 @@ export const Schemable: S.Schemable1 & S.WithUnknownContainers1 & S.Wi intersect, sum, lazy: (_, f) => lazy(f), + readonly, UnknownArray, UnknownRecord, union: union as S.WithUnion1['union'], diff --git a/test/JsonSchema.ts b/test/JsonSchema.ts index 0eadcc3c0..4dd4cd9e5 100644 --- a/test/JsonSchema.ts +++ b/test/JsonSchema.ts @@ -1,5 +1,5 @@ import * as C from 'fp-ts/Const' -import { pipe } from 'fp-ts/function' +import { identity, pipe } from 'fp-ts/function' import * as R from 'fp-ts/ReadonlyRecord' import { JSONSchema7 } from 'json-schema' import * as S from '../src/Schemable' @@ -160,6 +160,8 @@ export function lazy(id: string, f: () => JsonSchema): JsonSchema { } } +export const readonly: (arb: JsonSchema) => JsonSchema> = identity + export function union]>( ...members: { [K in keyof A]: JsonSchema } ): JsonSchema { @@ -199,5 +201,6 @@ export const Schemable: S.Schemable1 & S.WithUnknownContainers1 & S.Wi intersect, sum, lazy, + readonly, union: union as S.WithUnion1['union'] } From f6691cd693f7ab9102490c347d7b9917a63c6300 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 17 Feb 2021 16:53:10 +0100 Subject: [PATCH 194/222] deprecate `type` / `fromType` in favour of `struct` / `fromStruct` --- CHANGELOG.md | 3 ++ docs/modules/Codec.ts.md | 62 +++++++++++++++++-------- docs/modules/Decoder.ts.md | 82 +++++++++++++++++++++++----------- docs/modules/Encoder.ts.md | 23 +++++++--- docs/modules/Eq.ts.md | 17 ++++++- docs/modules/Guard.ts.md | 41 +++++++++++------ docs/modules/Kleisli.ts.md | 47 ++++++++++++------- docs/modules/Schemable.ts.md | 6 +++ docs/modules/TaskDecoder.ts.md | 82 +++++++++++++++++++++++----------- docs/modules/Type.ts.md | 27 ++++++++--- dtslint/ts3.5/Codec.ts | 20 ++++----- dtslint/ts3.5/Decoder.ts | 22 ++++----- dtslint/ts3.5/Encoder.ts | 18 ++++---- dtslint/ts3.5/Eq.ts | 10 ++--- dtslint/ts3.5/Guard.ts | 12 ++--- dtslint/ts3.5/Schema.ts | 18 ++++---- dtslint/ts3.5/TaskDecoder.ts | 6 +-- dtslint/ts3.5/Type.ts | 6 +-- src/Codec.ts | 30 ++++++++++--- src/Decoder.ts | 31 ++++++++++--- src/Encoder.ts | 13 +++++- src/Eq.ts | 12 ++++- src/Guard.ts | 14 +++++- src/Kleisli.ts | 13 +++++- src/Schemable.ts | 6 +++ src/TaskDecoder.ts | 31 ++++++++++--- src/Type.ts | 14 +++++- test/Arbitrary.ts | 5 ++- test/Codec.ts | 38 ++++++++-------- test/Decoder.ts | 38 ++++++++-------- test/Encoder.ts | 17 ++++--- test/Guard.ts | 30 ++++++------- test/JsonSchema.test.ts | 12 ++--- test/JsonSchema.ts | 5 ++- test/Schema.ts | 12 ++--- test/TaskDecoder.ts | 32 ++++++------- test/Type.ts | 12 ++--- 37 files changed, 572 insertions(+), 295 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a89ea2a7e..74232e5da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ - **Experimental** - `Schemable` - (\*) add `readonly` combinator (@gcanti) + - (\*) add `struct` combinator (@gcanti) + - deprecate `type` in favour of `struct` (@gcanti) + - deprecate `fromType` in favour of `fromStruct` (@gcanti) (\*) breaking change diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 8953e711f..de0027cc6 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -27,9 +27,9 @@ Added in v2.2.3 - [fromArray](#fromarray) - [fromPartial](#frompartial) - [fromRecord](#fromrecord) + - [fromStruct](#fromstruct) - [fromSum](#fromsum) - [fromTuple](#fromtuple) - - [fromType](#fromtype) - [intersect](#intersect) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) @@ -37,9 +37,11 @@ Added in v2.2.3 - [partial](#partial) - [record](#record) - [refine](#refine) + - [struct](#struct) - [sum](#sum) - [tuple](#tuple) - - [type](#type) + - [~~fromType~~](#fromtype) + - [~~type~~](#type) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [literal](#literal) @@ -137,6 +139,18 @@ export declare function fromRecord( Added in v2.2.3 +## fromStruct + +**Signature** + +```ts +export declare function fromStruct

>>( + properties: P +): Codec<{ [K in keyof P]: InputOf }, { [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +``` + +Added in v2.2.15 + ## fromSum **Signature** @@ -167,18 +181,6 @@ export declare const fromTuple: []>( Added in v2.2.8 -## fromType - -**Signature** - -```ts -export declare function fromType

>>( - properties: P -): Codec<{ [K in keyof P]: InputOf }, { [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> -``` - -Added in v2.2.8 - ## intersect **Signature** @@ -260,6 +262,18 @@ export declare const refine: ( Added in v2.2.3 +## struct + +**Signature** + +```ts +export declare function struct

>>( + properties: P +): Codec }, { [K in keyof P]: TypeOf }> +``` + +Added in v2.2.15 + ## sum **Signature** @@ -286,14 +300,26 @@ export declare function tuple>> Added in v2.2.3 -## type +## ~~fromType~~ + +Use `fromStruct` instead. **Signature** ```ts -export declare function type

>>( - properties: P -): Codec }, { [K in keyof P]: TypeOf }> +export declare const fromType: typeof fromStruct +``` + +Added in v2.2.8 + +## ~~type~~ + +Use `struct` instead. + +**Signature** + +```ts +export declare const type: typeof struct ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index daa1a08ac..347edd76c 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -37,9 +37,9 @@ Added in v2.2.7 - [fromArray](#fromarray) - [fromPartial](#frompartial) - [fromRecord](#fromrecord) + - [fromStruct](#fromstruct) - [fromSum](#fromsum) - [fromTuple](#fromtuple) - - [fromType](#fromtype) - [intersect](#intersect) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) @@ -49,11 +49,13 @@ Added in v2.2.7 - [readonly](#readonly) - [record](#record) - [refine](#refine) + - [struct](#struct) - [sum](#sum) - [tuple](#tuple) - - [type](#type) - [union](#union) - [withMessage](#withmessage) + - [~~fromType~~](#fromtype) + - [~~type~~](#type) - [constructors](#constructors) - [fromGuard](#fromguard) - [fromRefinement](#fromrefinement) @@ -223,6 +225,18 @@ export declare const fromRecord: (codomain: Decoder) => Decoder>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> +``` + +Added in v2.2.15 + ## fromSum **Signature** @@ -249,18 +263,6 @@ export declare const fromTuple: []>( Added in v2.2.8 -## fromType - -**Signature** - -```ts -export declare const fromType:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> -``` - -Added in v2.2.8 - ## intersect **Signature** @@ -362,6 +364,18 @@ export declare const refine: ( Added in v2.2.7 +## struct + +**Signature** + +```ts +export declare const struct: ( + properties: { [K in keyof A]: Decoder } +) => Decoder +``` + +Added in v2.2.15 + ## sum **Signature** @@ -386,18 +400,6 @@ export declare const tuple: ( Added in v2.2.7 -## type - -**Signature** - -```ts -export declare const type: ( - properties: { [K in keyof A]: Decoder } -) => Decoder -``` - -Added in v2.2.7 - ## union **Signature** @@ -422,6 +424,34 @@ export declare const withMessage: ( Added in v2.2.9 +## ~~fromType~~ + +Use `fromStruct` instead. + +**Signature** + +```ts +export declare const fromType:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K in keyof P]: K.TypeOf<'Either', P[K]> }> +``` + +Added in v2.2.8 + +## ~~type~~ + +Use `struct` instead. + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: Decoder } +) => Decoder +``` + +Added in v2.2.7 + # constructors ## fromGuard diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index e6d576d80..2d2cb6144 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -32,9 +32,10 @@ Added in v2.2.3 - [nullable](#nullable) - [partial](#partial) - [record](#record) + - [struct](#struct) - [sum](#sum) - [tuple](#tuple) - - [type](#type) + - [~~type~~](#type) - [instances](#instances) - [Category](#category-1) - [Contravariant](#contravariant-1) @@ -148,6 +149,18 @@ export declare function record(codomain: Encoder): Encoder>>( + properties: P +): Encoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +``` + +Added in v2.2.15 + ## sum **Signature** @@ -172,14 +185,14 @@ export declare function tuple>>( Added in v2.2.3 -## type +## ~~type~~ + +Use `struct` instead. **Signature** ```ts -export declare function type

>>( - properties: P -): Encoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> +export declare const type: typeof struct ``` Added in v2.2.3 diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index cce08dfd9..5043ed517 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -27,9 +27,10 @@ Added in v2.2.2 - [partial](#partial) - [readonly](#readonly) - [record](#record) + - [struct](#struct) - [sum](#sum) - [tuple](#tuple) - - [type](#type) + - [~~type~~](#type) - [instances](#instances) - [Schemable](#schemable) - [WithRefine](#withrefine) @@ -118,6 +119,16 @@ export declare const record: (codomain: E.Eq) => E.Eq> Added in v2.2.2 +## struct + +**Signature** + +```ts +export declare const struct: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K in keyof A]: A[K] }> +``` + +Added in v2.2.15 + ## sum **Signature** @@ -140,7 +151,9 @@ export declare const tuple: (...components: { [K i Added in v2.2.2 -## type +## ~~type~~ + +Use `struct` instead. **Signature** diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 6fe59133f..015da589d 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -31,11 +31,12 @@ Added in v2.2.0 - [readonly](#readonly) - [record](#record) - [refine](#refine) + - [struct](#struct) - [sum](#sum) - [tuple](#tuple) - - [type](#type) - [union](#union) - [zero](#zero) + - [~~type~~](#type) - [constructors](#constructors) - [literal](#literal) - [instances](#instances) @@ -175,6 +176,18 @@ export declare const refine: ( Added in v2.2.0 +## struct + +**Signature** + +```ts +export declare const struct: ( + properties: { [K in keyof A]: Guard } +) => Guard +``` + +Added in v2.2.15 + ## sum **Signature** @@ -199,18 +212,6 @@ export declare const tuple: ( Added in v2.2.0 -## type - -**Signature** - -```ts -export declare const type: ( - properties: { [K in keyof A]: Guard } -) => Guard -``` - -Added in v2.2.0 - ## union **Signature** @@ -233,6 +234,20 @@ export declare const zero: () => Guard Added in v2.2.8 +## ~~type~~ + +Use `struct` instead. + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: Guard } +) => Guard +``` + +Added in v2.2.0 + # constructors ## literal diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 428b60e60..7bdaeb261 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -25,9 +25,9 @@ Added in v2.2.7 - [fromArray](#fromarray) - [fromPartial](#frompartial) - [fromRecord](#fromrecord) + - [fromStruct](#fromstruct) - [fromSum](#fromsum) - [fromTuple](#fromtuple) - - [fromType](#fromtype) - [id](#id) - [intersect](#intersect) - [lazy](#lazy) @@ -37,6 +37,7 @@ Added in v2.2.7 - [parse](#parse) - [refine](#refine) - [union](#union) + - [~~fromType~~](#fromtype) - [constructors](#constructors) - [fromRefinement](#fromrefinement) - [literal](#literal) @@ -116,6 +117,22 @@ export declare function fromRecord( Added in v2.2.7 +## fromStruct + +**Signature** + +```ts +export declare function fromStruct( + M: Applicative2C & Bifunctor2 +): ( + onPropertyError: (key: string, e: E) => E +) =>

>>( + properties: P +) => Kleisli }, E, { [K in keyof P]: TypeOf }> +``` + +Added in v2.2.15 + ## fromSum **Signature** @@ -150,22 +167,6 @@ export declare function fromTuple( Added in v2.2.7 -## fromType - -**Signature** - -```ts -export declare function fromType( - M: Applicative2C & Bifunctor2 -): ( - onPropertyError: (key: string, e: E) => E -) =>

>>( - properties: P -) => Kleisli }, E, { [K in keyof P]: TypeOf }> -``` - -Added in v2.2.7 - ## id **Signature** @@ -279,6 +280,18 @@ export declare function union( Added in v2.2.7 +## ~~fromType~~ + +Use `fromStruct` instead. + +**Signature** + +```ts +export declare const fromType: typeof fromStruct +``` + +Added in v2.2.7 + # constructors ## fromRefinement diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index a43a7879b..9d5d7d23b 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -61,7 +61,9 @@ export interface Schemable { readonly number: HKT readonly boolean: HKT readonly nullable: (or: HKT) => HKT + /** @deprecated */ readonly type: (properties: { [K in keyof A]: HKT }) => HKT + readonly struct: (properties: { [K in keyof A]: HKT }) => HKT readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> readonly record: (codomain: HKT) => HKT> readonly array: (item: HKT) => HKT> @@ -89,7 +91,9 @@ export interface Schemable1 { readonly number: Kind readonly boolean: Kind readonly nullable: (or: Kind) => Kind + /** @deprecated */ readonly type: (properties: { [K in keyof A]: Kind }) => Kind + readonly struct: (properties: { [K in keyof A]: Kind }) => Kind readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> readonly record: (codomain: Kind) => Kind> readonly array: (item: Kind) => Kind> @@ -117,7 +121,9 @@ export interface Schemable2C { readonly number: Kind2 readonly boolean: Kind2 readonly nullable: (or: Kind2) => Kind2 + /** @deprecated */ readonly type: (properties: { [K in keyof A]: Kind2 }) => Kind2 + readonly struct: (properties: { [K in keyof A]: Kind2 }) => Kind2 readonly partial: ( properties: { [K in keyof A]: Kind2 } ) => Kind2> diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index d7595c51f..8caa35f08 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -37,9 +37,9 @@ Added in v2.2.7 - [fromArray](#fromarray) - [fromPartial](#frompartial) - [fromRecord](#fromrecord) + - [fromStruct](#fromstruct) - [fromSum](#fromsum) - [fromTuple](#fromtuple) - - [fromType](#fromtype) - [intersect](#intersect) - [lazy](#lazy) - [mapLeftWithInput](#mapleftwithinput) @@ -49,11 +49,13 @@ Added in v2.2.7 - [readonly](#readonly) - [record](#record) - [refine](#refine) + - [struct](#struct) - [sum](#sum) - [tuple](#tuple) - - [type](#type) - [union](#union) - [withMessage](#withmessage) + - [~~fromType~~](#fromtype) + - [~~type~~](#type) - [constructors](#constructors) - [fromDecoder](#fromdecoder) - [fromGuard](#fromguard) @@ -226,6 +228,18 @@ export declare const fromRecord: ( Added in v2.2.8 +## fromStruct + +**Signature** + +```ts +export declare const fromStruct:

>>( + properties: P +) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +``` + +Added in v2.2.15 + ## fromSum **Signature** @@ -252,18 +266,6 @@ export declare const fromTuple: []>( Added in v2.2.8 -## fromType - -**Signature** - -```ts -export declare const fromType:

>>( - properties: P -) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> -``` - -Added in v2.2.8 - ## intersect **Signature** @@ -365,6 +367,18 @@ export declare const refine: ( Added in v2.2.7 +## struct + +**Signature** + +```ts +export declare const struct: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder +``` + +Added in v2.2.15 + ## sum **Signature** @@ -389,18 +403,6 @@ export declare const tuple: ( Added in v2.2.7 -## type - -**Signature** - -```ts -export declare const type: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder -``` - -Added in v2.2.7 - ## union **Signature** @@ -425,6 +427,34 @@ export declare const withMessage: ( Added in v2.2.9 +## ~~fromType~~ + +Use `fromStruct` instead. + +**Signature** + +```ts +export declare const fromType:

>>( + properties: P +) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }> +``` + +Added in v2.2.8 + +## ~~type~~ + +Use `struct` instead. + +**Signature** + +```ts +export declare const type: ( + properties: { [K in keyof A]: TaskDecoder } +) => TaskDecoder +``` + +Added in v2.2.7 + # constructors ## fromDecoder diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index f91a497d9..d1d2bd000 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -28,10 +28,11 @@ Added in v2.2.3 - [readonly](#readonly) - [record](#record) - [refine](#refine) + - [struct](#struct) - [sum](#sum) - [tuple](#tuple) - - [type](#type) - [union](#union) + - [~~type~~](#type) - [constructors](#constructors) - [literal](#literal) - [instances](#instances) @@ -134,6 +135,16 @@ export declare const refine: (refinement: Refinement, id: Added in v2.2.3 +## struct + +**Signature** + +```ts +export declare const struct: (properties: { [K in keyof A]: Type }) => Type<{ [K in keyof A]: A[K] }> +``` + +Added in v2.2.15 + ## sum **Signature** @@ -156,24 +167,26 @@ export declare const tuple: (...components: { [K i Added in v2.2.3 -## type +## union **Signature** ```ts -export declare const type: (properties: { [K in keyof A]: Type }) => Type<{ [K in keyof A]: A[K] }> +export declare const union: ( + ...members: { [K in keyof A]: Type } +) => Type ``` Added in v2.2.3 -## union +## ~~type~~ + +Use `struct` instead. **Signature** ```ts -export declare const union: ( - ...members: { [K in keyof A]: Type } -) => Type +export declare const type: (properties: { [K in keyof A]: Type }) => Type<{ [K in keyof A]: A[K] }> ``` Added in v2.2.3 diff --git a/dtslint/ts3.5/Codec.ts b/dtslint/ts3.5/Codec.ts index 480c97466..677e7fe02 100644 --- a/dtslint/ts3.5/Codec.ts +++ b/dtslint/ts3.5/Codec.ts @@ -3,25 +3,25 @@ import * as _ from '../../src/Codec' declare const NumberFromString: _.Codec // -// fromType +// fromStruct // // $ExpectType Codec<{ a: unknown; b: { c: string; }; }, { a: string; b: { c: string; }; }, { a: string; b: { c: number; }; }> -_.fromType({ +_.fromStruct({ a: _.string, - b: _.fromType({ + b: _.fromStruct({ c: NumberFromString }) }) // -// type +// struct // // $ExpectType Codec -_.type({ +_.struct({ a: _.string, - b: _.type({ + b: _.struct({ c: _.number }) }) @@ -98,16 +98,16 @@ _.tuple(_.string, _.number, _.boolean) // $ExpectType Codec<{ _tag: unknown; a: unknown; } | { _tag: unknown; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: number; }> _.fromSum('_tag')({ - A: _.fromType({ _tag: _.literal('A'), a: _.string }), - B: _.fromType({ _tag: _.literal('B'), b: NumberFromString }) + A: _.fromStruct({ _tag: _.literal('A'), a: _.string }), + B: _.fromStruct({ _tag: _.literal('B'), b: NumberFromString }) }) // // sum // -const S1 = _.type({ _tag: _.literal('A'), a: _.string }) -const S2 = _.type({ _tag: _.literal('B'), b: _.number }) +const S1 = _.struct({ _tag: _.literal('A'), a: _.string }) +const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType Codec _.sum('_tag')({ A: S1, B: S2 }) diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 1221eee5c..94e80ca7d 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -20,25 +20,25 @@ export type TypeOfNumberFromString = _.TypeOf export type InputOfNumberFromString = _.InputOf // -// fromType +// fromStruct // // $ExpectType Decoder<{ a: unknown; b: { c: string; }; }, { a: string; b: { c: number; }; }> -_.fromType({ +_.fromStruct({ a: _.string, - b: _.fromType({ + b: _.fromStruct({ c: NumberFromString }) }) // -// type +// struct // // $ExpectType Decoder -_.type({ +_.struct({ a: _.string, - b: _.type({ + b: _.struct({ c: _.number }) }) @@ -115,16 +115,16 @@ _.tuple(_.string, _.number, _.boolean) // $ExpectType Decoder<{ _tag: unknown; a: unknown; } | { _tag: unknown; b: string; }, { _tag: "A"; a: string; } | { _tag: "B"; b: number; }> _.fromSum('_tag')({ - A: _.fromType({ _tag: _.literal('A'), a: _.string }), - B: _.fromType({ _tag: _.literal('B'), b: NumberFromString }) + A: _.fromStruct({ _tag: _.literal('A'), a: _.string }), + B: _.fromStruct({ _tag: _.literal('B'), b: NumberFromString }) }) // // sum // -const S1 = _.type({ _tag: _.literal('A'), a: _.string }) -const S2 = _.type({ _tag: _.literal('B'), b: _.number }) +const S1 = _.struct({ _tag: _.literal('A'), a: _.string }) +const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType Decoder _.sum('_tag')({ A: S1, B: S2 }) @@ -154,7 +154,7 @@ pipe( // $ExpectType Decoder> _.readonly( - _.type({ + _.struct({ a: _.string }) ) diff --git a/dtslint/ts3.5/Encoder.ts b/dtslint/ts3.5/Encoder.ts index 576a63697..8bb901d4b 100644 --- a/dtslint/ts3.5/Encoder.ts +++ b/dtslint/ts3.5/Encoder.ts @@ -9,7 +9,7 @@ const BooleanToNumber: E.Encoder = { encode: (b) => (b ? 1 : 0) } -export const OfTest = E.type({ a: E.id(), b: E.type({ c: NumberToString }) }) +export const OfTest = E.struct({ a: E.id(), b: E.struct({ c: NumberToString }) }) // // TypeOf @@ -27,9 +27,9 @@ export type OfTestOutput = E.OutputOf // $ExpectType { a: string; E.nullable(NumberToString) // $ExpectType Encoder // -// type +// struct // -E.type({ a: E.type({ b: NumberToString }) }) // $ExpectType Encoder<{ a: { b: string; }; }, { a: { b: number; }; }> +E.struct({ a: E.struct({ b: NumberToString }) }) // $ExpectType Encoder<{ a: { b: string; }; }, { a: { b: number; }; }> // // partial @@ -56,19 +56,19 @@ E.tuple(NumberToString, BooleanToNumber) // $ExpectType Encoder<[string, number] // // intersection // -pipe(E.type({ a: NumberToString }), E.intersect(E.type({ b: BooleanToNumber }))) // $ExpectType Encoder<{ a: string; } & { b: number; }, { a: number; } & { b: boolean; }> +pipe(E.struct({ a: NumberToString }), E.intersect(E.struct({ b: BooleanToNumber }))) // $ExpectType Encoder<{ a: string; } & { b: number; }, { a: number; } & { b: boolean; }> // // sum // -const S1 = E.type({ _tag: E.id<'A'>(), a: NumberToString }) -const S2 = E.type({ _tag: E.id<'B'>(), b: BooleanToNumber }) +const S1 = E.struct({ _tag: E.id<'A'>(), a: NumberToString }) +const S2 = E.struct({ _tag: E.id<'B'>(), b: BooleanToNumber }) const sum = E.sum('_tag') // $ExpectType Encoder<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }, { _tag: "A"; a: number; } | { _tag: "B"; b: boolean; }> sum({ A: S1, B: S2 }) -const S3 = E.type({ _tag: E.id<'C'>(), c: E.id() }) +const S3 = E.struct({ _tag: E.id<'C'>(), c: E.id() }) // // lazy @@ -90,14 +90,14 @@ interface BOut { as: Array } const A: E.Encoder = E.lazy(() => - E.type({ + E.struct({ a: NumberToString, bs: E.array(B) }) ) const B: E.Encoder = E.lazy(() => - E.type({ + E.struct({ b: BooleanToNumber, as: E.array(A) }) diff --git a/dtslint/ts3.5/Eq.ts b/dtslint/ts3.5/Eq.ts index 20caf616b..c27c58a94 100644 --- a/dtslint/ts3.5/Eq.ts +++ b/dtslint/ts3.5/Eq.ts @@ -1,9 +1,9 @@ import * as _ from '../../src/Eq' // $ExpectType Eq<{ a: string; b: { c: number; }; }> -_.type({ +_.struct({ a: _.string, - b: _.type({ + b: _.struct({ c: _.number }) }) @@ -20,8 +20,8 @@ _.partial({ // sum // -const S1 = _.type({ _tag: _.Schemable.literal('A'), a: _.string }) -const S2 = _.type({ _tag: _.Schemable.literal('B'), b: _.number }) +const S1 = _.struct({ _tag: _.Schemable.literal('A'), a: _.string }) +const S2 = _.struct({ _tag: _.Schemable.literal('B'), b: _.number }) // $ExpectType Eq<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }> _.sum('_tag')({ A: S1, B: S2 }) @@ -34,7 +34,7 @@ _.sum('_tag')({ A: S1, B: S2 }) // $ExpectType Eq> _.readonly( - _.type({ + _.struct({ a: _.string }) ) diff --git a/dtslint/ts3.5/Guard.ts b/dtslint/ts3.5/Guard.ts index 94b07457d..31a9d3de2 100644 --- a/dtslint/ts3.5/Guard.ts +++ b/dtslint/ts3.5/Guard.ts @@ -1,13 +1,13 @@ import * as _ from '../../src/Guard' // -// type +// struct // // $ExpectType Guard -const A = _.type({ +const A = _.struct({ a: _.string, - b: _.type({ + b: _.struct({ c: _.number }) }) @@ -35,8 +35,8 @@ export type A = _.TypeOf // sum // -const S1 = _.type({ _tag: _.literal('A'), a: _.string }) -const S2 = _.type({ _tag: _.literal('B'), b: _.number }) +const S1 = _.struct({ _tag: _.literal('A'), a: _.string }) +const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType Guard _.sum('_tag')({ A: S1, B: S2 }) @@ -49,7 +49,7 @@ _.sum('_tag')({ A: S1, B: S1 }) // $ExpectType Guard> _.readonly( - _.type({ + _.struct({ a: _.string }) ) diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index 84b67930f..e14dbf9a0 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -16,7 +16,7 @@ function make(f: Schema): Schema { // TypeOf // -export const OfTest = make((S) => S.type({ a: S.string, b: S.type({ c: S.number }) })) +export const OfTest = make((S) => S.struct({ a: S.string, b: S.struct({ c: S.number }) })) export type OfTest = TypeOf // $ExpectType { a: string; b: { c: number; }; } // @@ -53,10 +53,10 @@ make((S) => S.boolean) // $ExpectType Schema make((S) => S.nullable(S.string)) // $ExpectType Schema // -// type +// struct // -make((S) => S.type({ a: S.string, b: S.type({ c: S.number }) })) // $ExpectType Schema<{ a: string; b: { c: number; }; }> +make((S) => S.struct({ a: S.string, b: S.struct({ c: S.number }) })) // $ExpectType Schema<{ a: string; b: { c: number; }; }> // // partial @@ -89,14 +89,14 @@ make((S) => S.tuple(S.string, S.number, S.boolean)) // $ExpectType Schema<[strin // intersection // -make((S) => pipe(S.type({ a: S.string }), S.intersect(S.type({ b: S.number })))) // $ExpectType Schema<{ a: string; } & { b: number; }> +make((S) => pipe(S.struct({ a: S.string }), S.intersect(S.struct({ b: S.number })))) // $ExpectType Schema<{ a: string; } & { b: number; }> // // sum // -const S1 = make((S) => S.type({ _tag: S.literal('A'), a: S.string })) -const S2 = make((S) => S.type({ _tag: S.literal('B'), b: S.number })) +const S1 = make((S) => S.struct({ _tag: S.literal('A'), a: S.string })) +const S2 = make((S) => S.struct({ _tag: S.literal('B'), b: S.number })) // $ExpectType Schema<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }> make((S) => S.sum('_tag')({ A: S1(S), B: S2(S) })) @@ -119,7 +119,7 @@ interface B { const A: Schema = make((S) => S.lazy('A', () => - S.type({ + S.struct({ a: S.string, bs: S.array(B(S)) }) @@ -128,7 +128,7 @@ const A: Schema = make((S) => const B: Schema = make((S) => S.lazy('B', () => - S.type({ + S.struct({ b: S.number, as: S.array(A(S)) }) @@ -178,4 +178,4 @@ make((S) => S.union(S.string, S.number)) // $ExpectType Schema // // $ExpectType Schema> -make((S) => S.readonly(S.type({ a: S.string }))) +make((S) => S.readonly(S.struct({ a: S.string }))) diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.5/TaskDecoder.ts index 4b426c47c..10a8e936d 100644 --- a/dtslint/ts3.5/TaskDecoder.ts +++ b/dtslint/ts3.5/TaskDecoder.ts @@ -4,8 +4,8 @@ import * as _ from '../../src/TaskDecoder' // sum // -const S1 = _.type({ _tag: _.literal('A'), a: _.string }) -const S2 = _.type({ _tag: _.literal('B'), b: _.number }) +const S1 = _.struct({ _tag: _.literal('A'), a: _.string }) +const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType TaskDecoder _.sum('_tag')({ A: S1, B: S2 }) @@ -18,7 +18,7 @@ _.sum('_tag')({ A: S1, B: S1 }) // $ExpectType TaskDecoder> _.readonly( - _.type({ + _.struct({ a: _.string }) ) diff --git a/dtslint/ts3.5/Type.ts b/dtslint/ts3.5/Type.ts index feb9e213d..503d4b920 100644 --- a/dtslint/ts3.5/Type.ts +++ b/dtslint/ts3.5/Type.ts @@ -1,9 +1,9 @@ import * as _ from '../../src/Type' // $ExpectType Type<{ a: string; b: { c: number; }; }> -_.type({ +_.struct({ a: _.string, - b: _.type({ + b: _.struct({ c: _.number }) }) @@ -22,7 +22,7 @@ _.partial({ // $ExpectType Type> _.readonly( - _.type({ + _.struct({ a: _.string }) ) diff --git a/src/Codec.ts b/src/Codec.ts index ec1042594..035665ff7 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -144,24 +144,42 @@ export function nullable(or: Codec): Codec>>( +export function fromStruct

>>( properties: P ): Codec<{ [K in keyof P]: InputOf }, { [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { - return make(D.fromType(properties) as any, E.type(properties)) + return make(D.fromStruct(properties) as any, E.struct(properties)) } /** + * Use `fromStruct` instead. + * * @category combinators - * @since 2.2.3 + * @since 2.2.8 + * @deprecated + */ +export const fromType = fromStruct + +/** + * @category combinators + * @since 2.2.15 */ -export function type

>>( +export function struct

>>( properties: P ): Codec }, { [K in keyof P]: TypeOf }> { - return pipe(UnknownRecord, compose(fromType(properties as any))) as any + return pipe(UnknownRecord, compose(fromStruct(properties as any))) as any } +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export const type = struct + /** * @category combinators * @since 2.2.8 diff --git a/src/Decoder.ts b/src/Decoder.ts index 1c47116e4..f98ff1d23 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -228,20 +228,38 @@ export const nullable: (or: Decoder) => Decoder /** * @category combinators - * @since 2.2.8 + * @since 2.2.15 */ -export const fromType =

>>( +export const fromStruct =

>>( properties: P ): Decoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.fromType(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) + K.fromStruct(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** + * Use `fromStruct` instead. + * * @category combinators - * @since 2.2.7 + * @since 2.2.8 + * @deprecated + */ +export const fromType = fromStruct + +/** + * @category combinators + * @since 2.2.15 */ -export const type = ( +export const struct = ( properties: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord as any, compose(fromType(properties))) +): Decoder => pipe(UnknownRecord as any, compose(fromStruct(properties))) + +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export const type = struct /** * @category combinators @@ -471,6 +489,7 @@ export const Schemable: S.Schemable2C = { boolean, nullable, type, + struct, partial, record, array, diff --git a/src/Encoder.ts b/src/Encoder.ts index f06ad8832..5b7eac912 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -41,9 +41,9 @@ export function nullable(or: Encoder): Encoder { /** * @category combinators - * @since 2.2.3 + * @since 2.2.15 */ -export function type

>>( +export function struct

>>( properties: P ): Encoder<{ [K in keyof P]: OutputOf }, { [K in keyof P]: TypeOf }> { return { @@ -57,6 +57,15 @@ export function type

>>( } } +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export const type = struct + /** * @category combinators * @since 2.2.3 diff --git a/src/Eq.ts b/src/Eq.ts index 326fe0978..61df119f0 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -90,10 +90,19 @@ export function nullable(or: Eq): Eq { } /** + * @category combinators + * @since 2.2.15 + */ +export const struct: (eqs: { [K in keyof A]: Eq }) => Eq<{ [K in keyof A]: A[K] }> = E.getStructEq + +/** + * Use `struct` instead. + * * @category combinators * @since 2.2.2 + * @deprecated */ -export const type: (eqs: { [K in keyof A]: Eq }) => Eq<{ [K in keyof A]: A[K] }> = E.getStructEq +export const type = struct /** * @category combinators @@ -196,6 +205,7 @@ export const Schemable: Schemable1 = { boolean, nullable, type, + struct, partial, record, array, diff --git a/src/Guard.ts b/src/Guard.ts index b569b5ae9..16bc2474a 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -120,9 +120,9 @@ export const nullable = (or: Guard): Guard( +export const struct = ( properties: { [K in keyof A]: Guard } ): Guard => pipe( @@ -139,6 +139,15 @@ export const type = ( }) ) +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.0 + * @deprecated + */ +export const type = struct + /** * @category combinators * @since 2.2.0 @@ -315,6 +324,7 @@ export const Schemable: Schemable1 = { boolean, nullable, type, + struct, partial, record, array, diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 81e890baa..5a30c198b 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -123,9 +123,9 @@ export function nullable( /** * @category combinators - * @since 2.2.7 + * @since 2.2.15 */ -export function fromType( +export function fromStruct( M: Applicative2C & Bifunctor2 ): ( onPropertyError: (key: string, e: E) => E @@ -141,6 +141,15 @@ export function fromType( }) } +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export const fromType = fromStruct + /** * @category combinators * @since 2.2.7 diff --git a/src/Schemable.ts b/src/Schemable.ts index ac92c490e..4178108f0 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -26,7 +26,9 @@ export interface Schemable { readonly number: HKT readonly boolean: HKT readonly nullable: (or: HKT) => HKT + /** @deprecated */ readonly type: (properties: { [K in keyof A]: HKT }) => HKT + readonly struct: (properties: { [K in keyof A]: HKT }) => HKT readonly partial: (properties: { [K in keyof A]: HKT }) => HKT> readonly record: (codomain: HKT) => HKT> readonly array: (item: HKT) => HKT> @@ -49,7 +51,9 @@ export interface Schemable1 { readonly number: Kind readonly boolean: Kind readonly nullable: (or: Kind) => Kind + /** @deprecated */ readonly type: (properties: { [K in keyof A]: Kind }) => Kind + readonly struct: (properties: { [K in keyof A]: Kind }) => Kind readonly partial: (properties: { [K in keyof A]: Kind }) => Kind> readonly record: (codomain: Kind) => Kind> readonly array: (item: Kind) => Kind> @@ -72,7 +76,9 @@ export interface Schemable2C { readonly number: Kind2 readonly boolean: Kind2 readonly nullable: (or: Kind2) => Kind2 + /** @deprecated */ readonly type: (properties: { [K in keyof A]: Kind2 }) => Kind2 + readonly struct: (properties: { [K in keyof A]: Kind2 }) => Kind2 readonly partial: ( properties: { [K in keyof A]: Kind2 } ) => Kind2> diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 16d0602b1..8ae798cad 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -231,20 +231,38 @@ export const nullable: (or: TaskDecoder) => TaskDecoder>>( +export const fromStruct =

>>( properties: P ): TaskDecoder<{ [K in keyof P]: InputOf }, { [K in keyof P]: TypeOf }> => - K.fromType(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) + K.fromStruct(M)((k, e) => FS.of(DE.key(k, DE.required, e)))(properties) /** + * Use `fromStruct` instead. + * * @category combinators - * @since 2.2.7 + * @since 2.2.8 + * @deprecated + */ +export const fromType = fromStruct + +/** + * @category combinators + * @since 2.2.15 */ -export const type = ( +export const struct = ( properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord as any, compose(fromType(properties))) +): TaskDecoder => pipe(UnknownRecord as any, compose(fromStruct(properties))) + +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export const type = struct /** * @category combinators @@ -477,6 +495,7 @@ export const Schemable: S.Schemable2C = { boolean, nullable, type, + struct, partial, record, array, diff --git a/src/Type.ts b/src/Type.ts index db5f8a373..187d334c3 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -98,11 +98,20 @@ export const nullable = (or: Type): Type => t.union([t.null, or] /** * @category combinators - * @since 2.2.3 + * @since 2.2.15 */ -export const type = (properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> => +export const struct = (properties: { [K in keyof A]: Type }): Type<{ [K in keyof A]: A[K] }> => t.type(properties) as any +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export const type = struct + /** * @category combinators * @since 2.2.3 @@ -197,6 +206,7 @@ export const Schemable: S.Schemable1 = { boolean, nullable, type, + struct, partial, record, array, diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 6a4e44129..11185cd47 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -50,7 +50,7 @@ export function nullable(or: Arbitrary): Arbitrary { return fc.oneof(fc.constant(null), or) } -export function type(properties: { [K in keyof A]: Arbitrary }): Arbitrary { +export function struct(properties: { [K in keyof A]: Arbitrary }): Arbitrary { return fc.record(properties) } @@ -123,7 +123,8 @@ export const Schemable: S.Schemable1 & S.WithUnknownContainers1 & S.Wi number, boolean, nullable, - type, + type: struct, + struct, partial, record, array, diff --git a/test/Codec.ts b/test/Codec.ts index 45ae60c7a..cfc48d99b 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -193,31 +193,31 @@ describe('Codec', () => { }) }) - describe('type', () => { + describe('struct', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = _.type({ + const codec = _.struct({ a: _.string }) assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) }) it('should strip additional fields', () => { - const codec = _.type({ + const codec = _.struct({ a: _.string }) assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', () => { - const codec = _.type({ + const codec = _.struct({ a: codecUndefined }) assert.deepStrictEqual(codec.decode({}), D.success({ a: undefined })) }) it('should reject an invalid input', () => { - const codec = _.type({ + const codec = _.struct({ a: _.string }) assert.deepStrictEqual(codec.decode(undefined), D.failure(undefined, 'Record')) @@ -228,7 +228,7 @@ describe('Codec', () => { }) it('should collect all errors', () => { - const codec = _.type({ + const codec = _.struct({ a: _.string, b: _.number }) @@ -252,19 +252,19 @@ describe('Codec', () => { return 'b' } } - const codec = _.type({ a: _.string, b: _.string }) + const codec = _.struct({ a: _.string, b: _.string }) assert.deepStrictEqual(codec.decode(new A()), D.success({ a: 'a', b: 'b' })) }) }) describe('encode', () => { it('should encode a value', () => { - const codec = _.type({ a: codecNumber }) + const codec = _.struct({ a: codecNumber }) assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) }) it('should strip additional fields', () => { - const codec = _.type({ a: _.number }) + const codec = _.struct({ a: _.number }) const a = { a: 1, b: true } assert.deepStrictEqual(codec.encode(a), { a: 1 }) }) @@ -487,7 +487,7 @@ describe('Codec', () => { describe('intersect', () => { describe('decode', () => { it('should decode a valid input', () => { - const codec = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + const codec = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a', b: 1 })) }) @@ -499,7 +499,7 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const codec = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: codecNumber }))) + const codec = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: codecNumber }))) assert.deepStrictEqual(codec.encode({ a: 'a', b: 1 }), { a: 'a', b: '1' }) }) @@ -515,16 +515,16 @@ describe('Codec', () => { describe('decode', () => { it('should decode a valid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) + const A = _.struct({ _tag: _.literal('A'), a: _.string }) + const B = _.struct({ _tag: _.literal('B'), b: _.number }) const codec = sum({ A, B }) assert.deepStrictEqual(codec.decode({ _tag: 'A', a: 'a' }), D.success({ _tag: 'A', a: 'a' })) assert.deepStrictEqual(codec.decode({ _tag: 'B', b: 1 }), D.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) + const A = _.struct({ _tag: _.literal('A'), a: _.string }) + const B = _.struct({ _tag: _.literal('B'), b: _.number }) const codec = sum({ A, B }) assert.deepStrictEqual(codec.decode(null), D.failure(null, 'Record')) assert.deepStrictEqual( @@ -548,8 +548,8 @@ describe('Codec', () => { describe('encode', () => { it('should encode a value', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: codecNumber }) + const A = _.struct({ _tag: _.literal('A'), a: _.string }) + const B = _.struct({ _tag: _.literal('B'), b: codecNumber }) const codec = sum({ A, B }) assert.deepStrictEqual(codec.encode({ _tag: 'A', a: 'a' }), { _tag: 'A', a: 'a' }) assert.deepStrictEqual(codec.encode({ _tag: 'B', b: 1 }), { _tag: 'B', b: '1' }) @@ -568,7 +568,7 @@ describe('Codec', () => { } const lazyCodec: _.Codec = _.lazy('A', () => - pipe(_.type({ a: codecNumber }), _.intersect(_.partial({ b: lazyCodec }))) + pipe(_.struct({ a: codecNumber }), _.intersect(_.partial({ b: lazyCodec }))) ) describe('decode', () => { @@ -639,7 +639,7 @@ describe('Codec', () => { { encode: String } ) - const User = _.type({ a: _.string, b: pipe(_.string, _.compose(DateFromString)) }) + const User = _.struct({ a: _.string, b: pipe(_.string, _.compose(DateFromString)) }) const codec = pipe(_.string, _.compose(Base64), _.compose(Json), _.compose(User)) diff --git a/test/Decoder.ts b/test/Decoder.ts index 55b34e650..f1323521b 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -94,7 +94,7 @@ describe('Decoder', () => { it('withMessage', () => { const decoder = pipe( - _.type({ + _.struct({ name: _.string, age: _.number }), @@ -153,30 +153,30 @@ describe('Decoder', () => { }) }) - describe('type', () => { + describe('struct', () => { it('should decode a valid input', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string }) assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) }) it('should strip additional fields', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string }) assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: H.decoderUndefined }) assert.deepStrictEqual(decoder.decode({}), _.success({ a: undefined })) }) it('should reject an invalid input', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string }) assert.deepStrictEqual(decoder.decode(undefined), E.left(FS.of(DE.leaf(undefined, 'Record')))) @@ -187,7 +187,7 @@ describe('Decoder', () => { }) it('should collect all errors', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string, b: _.number }) @@ -211,7 +211,7 @@ describe('Decoder', () => { return 'b' } } - const decoder = _.type({ a: _.string, b: _.string }) + const decoder = _.struct({ a: _.string, b: _.string }) assert.deepStrictEqual(decoder.decode(new A()), _.success({ a: 'a', b: 'b' })) }) }) @@ -406,7 +406,7 @@ describe('Decoder', () => { describe('intersect', () => { it('should decode a valid input', () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + const decoder = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a', b: 1 })) }) @@ -416,7 +416,7 @@ describe('Decoder', () => { }) it('should accumulate all errors', () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + const decoder = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual( decoder.decode({ a: 'a' }), E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -441,16 +441,16 @@ describe('Decoder', () => { const sum = _.sum('_tag') it('should decode a valid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) + const A = _.struct({ _tag: _.literal('A'), a: _.string }) + const B = _.struct({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) assert.deepStrictEqual(decoder.decode({ _tag: 'A', a: 'a' }), _.success({ _tag: 'A', a: 'a' })) assert.deepStrictEqual(decoder.decode({ _tag: 'B', b: 1 }), _.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) + const A = _.struct({ _tag: _.literal('A'), a: _.string }) + const B = _.struct({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) assert.deepStrictEqual(decoder.decode(null), E.left(FS.of(DE.leaf(null, 'Record')))) assert.deepStrictEqual( @@ -473,8 +473,8 @@ describe('Decoder', () => { it('should support non-`string` tag values', () => { const decoder = _.sum('_tag')({ - [1]: _.type({ _tag: _.literal(1), a: _.string }), - [2]: _.type({ _tag: _.literal(2), b: _.number }) + [1]: _.struct({ _tag: _.literal(1), a: _.string }), + [2]: _.struct({ _tag: _.literal(2), b: _.number }) }) assert.deepStrictEqual(decoder.decode({ _tag: 1, a: 'a' }), E.right({ _tag: 1, a: 'a' })) assert.deepStrictEqual(decoder.decode({ _tag: 2, b: 1 }), E.right({ _tag: 2, b: 1 })) @@ -491,7 +491,7 @@ describe('Decoder', () => { } const lazyDecoder: _.Decoder = _.lazy('A', () => - pipe(_.type({ a: H.decoderNumberFromUnknownString }), _.intersect(_.partial({ b: lazyDecoder }))) + pipe(_.struct({ a: H.decoderNumberFromUnknownString }), _.intersect(_.partial({ b: lazyDecoder }))) ) describe('lazy', () => { @@ -537,7 +537,7 @@ describe('Decoder', () => { it('is stack safe', () => { expect(() => { E.mapLeft(_.draw)( - _.record(_.type({ done: _.boolean })).decode( + _.record(_.struct({ done: _.boolean })).decode( new Array(10000) .fill({}) .map((v, k) => [k, v]) @@ -551,7 +551,7 @@ describe('Decoder', () => { }) it('draw', () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string, b: _.number, c: _.array(_.boolean), diff --git a/test/Encoder.ts b/test/Encoder.ts index 4bedd9563..d4155a63d 100644 --- a/test/Encoder.ts +++ b/test/Encoder.ts @@ -20,8 +20,8 @@ describe('Encoder', () => { assert.deepStrictEqual(encoder.encode(null), null) }) - it('type', () => { - const encoder = E.type({ a: H.encoderNumberToString, b: H.encoderBooleanToNumber }) + it('struct', () => { + const encoder = E.struct({ a: H.encoderNumberToString, b: H.encoderBooleanToNumber }) assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) }) @@ -50,13 +50,16 @@ describe('Encoder', () => { }) it('intersect', () => { - const encoder = pipe(E.type({ a: H.encoderNumberToString }), E.intersect(E.type({ b: H.encoderBooleanToNumber }))) + const encoder = pipe( + E.struct({ a: H.encoderNumberToString }), + E.intersect(E.struct({ b: H.encoderBooleanToNumber })) + ) assert.deepStrictEqual(encoder.encode({ a: 1, b: true }), { a: '1', b: 1 }) }) it('sum', () => { - const S1 = E.type({ _tag: E.id<'A'>(), a: H.encoderNumberToString }) - const S2 = E.type({ _tag: E.id<'B'>(), b: H.encoderBooleanToNumber }) + const S1 = E.struct({ _tag: E.id<'A'>(), a: H.encoderNumberToString }) + const S2 = E.struct({ _tag: E.id<'B'>(), b: H.encoderBooleanToNumber }) const sum = E.sum('_tag') const encoder = sum({ A: S1, B: S2 }) assert.deepStrictEqual(encoder.encode({ _tag: 'A', a: 1 }), { _tag: 'A', a: '1' }) @@ -81,14 +84,14 @@ describe('Encoder', () => { as: Array } const A: E.Encoder = E.lazy(() => - E.type({ + E.struct({ a: H.encoderNumberToString, bs: E.array(B) }) ) const B: E.Encoder = E.lazy(() => - E.type({ + E.struct({ b: H.encoderBooleanToNumber, as: E.array(A) }) diff --git a/test/Guard.ts b/test/Guard.ts index ea481f021..23cd4318e 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -79,19 +79,19 @@ describe('Guard', () => { }) }) - describe('type', () => { + describe('struct', () => { it('should accept valid inputs', () => { - const guard = G.type({ a: G.string, b: G.number }) + const guard = G.struct({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) }) it('should accept additional fields', () => { - const guard = G.type({ a: G.string, b: G.number }) + const guard = G.struct({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1, c: true }), true) }) it('should reject invalid inputs', () => { - const guard = G.type({ a: G.string, b: G.number }) + const guard = G.struct({ a: G.string, b: G.number }) assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is({ a: 'a' }), false) }) @@ -100,7 +100,7 @@ describe('Guard', () => { const undef: G.Guard = { is: (u): u is undefined => u === undefined } - const guard = G.type({ a: undef }) + const guard = G.struct({ a: undef }) assert.strictEqual(guard.is({}), false) }) @@ -113,7 +113,7 @@ describe('Guard', () => { return 'b' } } - const guard = G.type({ a: G.string, b: G.string }) + const guard = G.struct({ a: G.string, b: G.string }) assert.deepStrictEqual(guard.is(new A()), true) }) }) @@ -204,12 +204,12 @@ describe('Guard', () => { describe('intersect', () => { it('should accept valid inputs', () => { - const guard = pipe(G.type({ a: G.string }), G.intersect(G.type({ b: G.number }))) + const guard = pipe(G.struct({ a: G.string }), G.intersect(G.struct({ b: G.number }))) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) }) it('should reject invalid inputs', () => { - const guard = pipe(G.type({ a: G.string }), G.intersect(G.type({ b: G.number }))) + const guard = pipe(G.struct({ a: G.string }), G.intersect(G.struct({ b: G.number }))) assert.strictEqual(guard.is({ a: 'a' }), false) }) }) @@ -234,7 +234,7 @@ describe('Guard', () => { } const guard: G.Guard = G.Schemable.lazy('A', () => - G.type({ + G.struct({ a: G.number, b: G.array(guard) }) @@ -256,8 +256,8 @@ describe('Guard', () => { it('should accept valid inputs', () => { const guard = sum({ - A: G.type({ _tag: G.literal('A'), a: G.string }), - B: G.type({ _tag: G.literal('B'), b: G.number }) + A: G.struct({ _tag: G.literal('A'), a: G.string }), + B: G.struct({ _tag: G.literal('B'), b: G.number }) }) assert.deepStrictEqual(guard.is({ _tag: 'A', a: 'a' }), true) assert.deepStrictEqual(guard.is({ _tag: 'B', b: 1 }), true) @@ -265,8 +265,8 @@ describe('Guard', () => { it('should reject invalid inputs', () => { const guard = sum({ - A: G.type({ _tag: G.literal('A'), a: G.string }), - B: G.type({ _tag: G.literal('B'), b: G.number }) + A: G.struct({ _tag: G.literal('A'), a: G.string }), + B: G.struct({ _tag: G.literal('B'), b: G.number }) }) assert.strictEqual(guard.is(undefined), false) assert.strictEqual(guard.is({}), false) @@ -274,8 +274,8 @@ describe('Guard', () => { it('should support non-`string` tag values', () => { const guard = G.sum('_tag')({ - [1]: G.type({ _tag: G.literal(1), a: G.string }), - [2]: G.type({ _tag: G.literal(2), b: G.number }) + [1]: G.struct({ _tag: G.literal(1), a: G.string }), + [2]: G.struct({ _tag: G.literal(2), b: G.number }) }) assert.deepStrictEqual(guard.is({ _tag: 1, a: 'a' }), true) assert.deepStrictEqual(guard.is({ _tag: 2, b: 1 }), true) diff --git a/test/JsonSchema.test.ts b/test/JsonSchema.test.ts index 3fbaf7e58..c8a86d81b 100644 --- a/test/JsonSchema.test.ts +++ b/test/JsonSchema.test.ts @@ -41,8 +41,8 @@ describe('JsonSchema', () => { assert.strictEqual(validate({ a: 'a', b: 1, c: undefined }), true) }) - it('type', () => { - const schema = J.type({ a: J.string, b: J.number }).compile() + it('struct', () => { + const schema = J.struct({ a: J.string, b: J.number }).compile() const validate = ajv.compile(schema) assert.strictEqual(validate({ a: 'a', b: 1 }), true) assert.strictEqual(validate({ a: 'a' }), false) @@ -79,7 +79,7 @@ describe('JsonSchema', () => { describe('intersection', () => { it('should handle non primitive values', () => { - const validate = ajv.compile(pipe(J.type({ a: J.string }), J.intersect(J.type({ b: J.number }))).compile()) + const validate = ajv.compile(pipe(J.struct({ a: J.string }), J.intersect(J.struct({ b: J.number }))).compile()) assert.strictEqual(validate({ a: 'a', b: 1 }), true) assert.strictEqual(validate({ a: 'a' }), false) }) @@ -113,8 +113,8 @@ describe('JsonSchema', () => { it('sum', () => { const sum = J.sum('_tag') - const A = J.type({ _tag: J.literal('A'), a: J.string }) - const B = J.type({ _tag: J.literal('B'), b: J.number }) + const A = J.struct({ _tag: J.literal('A'), a: J.string }) + const B = J.struct({ _tag: J.literal('B'), b: J.number }) const validate = ajv.compile(sum({ A, B }).compile()) assert.strictEqual(validate({ _tag: 'A', a: 'a' }), true) assert.strictEqual(validate({ _tag: 'B', b: 1 }), true) @@ -137,7 +137,7 @@ describe('JsonSchema', () => { } const schema: J.JsonSchema = J.lazy('A', () => - pipe(J.type({ a: J.number }), J.intersect(J.partial({ b: schema }))) + pipe(J.struct({ a: J.number }), J.intersect(J.partial({ b: schema }))) ) const jsonSchema = schema.compile() diff --git a/test/JsonSchema.ts b/test/JsonSchema.ts index 4dd4cd9e5..bdc331c54 100644 --- a/test/JsonSchema.ts +++ b/test/JsonSchema.ts @@ -61,7 +61,7 @@ export function nullable(or: JsonSchema): JsonSchema { return union(nullJsonSchema, or) } -export function type(properties: { [K in keyof A]: JsonSchema }): JsonSchema { +export function struct(properties: { [K in keyof A]: JsonSchema }): JsonSchema { return { compile: (lazy) => C.make({ @@ -193,7 +193,8 @@ export const Schemable: S.Schemable1 & S.WithUnknownContainers1 & S.Wi UnknownArray, UnknownRecord, nullable, - type, + type: struct, + struct, partial, record, array, diff --git a/test/Schema.ts b/test/Schema.ts index e2ec4ffbe..08890a6ad 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -38,10 +38,10 @@ describe('Schema', () => { check(make((S) => S.nullable(S.string))) }) - it('type', () => { + it('struct', () => { check( make((S) => - S.type({ + S.struct({ name: S.string, age: S.number }) @@ -75,12 +75,12 @@ describe('Schema', () => { }) it('intersect', () => { - check(make((S) => pipe(S.type({ a: S.string }), S.intersect(S.type({ b: S.number }))))) + check(make((S) => pipe(S.struct({ a: S.string }), S.intersect(S.struct({ b: S.number }))))) }) it('sum', () => { - const A = make((S) => S.type({ _tag: S.literal('A'), a: S.string })) - const B = make((S) => S.type({ _tag: S.literal('B'), b: S.number })) + const A = make((S) => S.struct({ _tag: S.literal('A'), a: S.string })) + const B = make((S) => S.struct({ _tag: S.literal('B'), b: S.number })) check(make((S) => S.sum('_tag')({ A: A(S), B: B(S) }))) }) @@ -92,7 +92,7 @@ describe('Schema', () => { } const schema: Schema = make((S) => - S.lazy('A', () => pipe(S.type({ a: S.string }), S.intersect(S.partial({ b: schema(S), c: S.number })))) + S.lazy('A', () => pipe(S.struct({ a: S.string }), S.intersect(S.partial({ b: schema(S), c: S.number })))) ) check(schema) }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index aaafd270e..da48f05e2 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -137,7 +137,7 @@ describe('UnknownTaskDecoder', () => { it('withMessage', async () => { const decoder = pipe( - _.type({ + _.struct({ name: _.string, age: _.number }), @@ -196,30 +196,30 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('type', () => { + describe('struct', () => { it('should decode a valid input', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string }) assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) }) it('should strip additional fields', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string }) assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a' })) }) it('should not strip fields corresponding to undefined values', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: undef }) assert.deepStrictEqual(await decoder.decode({})(), D.success({ a: undefined })) }) it('should reject an invalid input', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string }) assert.deepStrictEqual(await decoder.decode(undefined)(), D.failure(undefined, 'Record')) @@ -230,7 +230,7 @@ describe('UnknownTaskDecoder', () => { }) it('should collect all errors', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string, b: _.number }) @@ -254,7 +254,7 @@ describe('UnknownTaskDecoder', () => { return 'b' } } - const decoder = _.type({ a: _.string, b: _.string }) + const decoder = _.struct({ a: _.string, b: _.string }) assert.deepStrictEqual(await decoder.decode(new A())(), D.success({ a: 'a', b: 'b' })) }) }) @@ -465,7 +465,7 @@ describe('UnknownTaskDecoder', () => { describe('intersect', () => { it('should decode a valid input', async () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + const decoder = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a', b: 1 })) }) @@ -475,7 +475,7 @@ describe('UnknownTaskDecoder', () => { }) it('should accumulate all errors', async () => { - const decoder = pipe(_.type({ a: _.string }), _.intersect(_.type({ b: _.number }))) + const decoder = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual( await decoder.decode({ a: 'a' })(), E.left(FS.of(DE.key('b', DE.required, FS.of(DE.leaf(undefined, 'number'))))) @@ -500,16 +500,16 @@ describe('UnknownTaskDecoder', () => { const sum = _.sum('_tag') it('should decode a valid input', async () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) + const A = _.struct({ _tag: _.literal('A'), a: _.string }) + const B = _.struct({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) assert.deepStrictEqual(await decoder.decode({ _tag: 'A', a: 'a' })(), D.success({ _tag: 'A', a: 'a' })) assert.deepStrictEqual(await decoder.decode({ _tag: 'B', b: 1 })(), D.success({ _tag: 'B', b: 1 })) }) it('should reject an invalid input', async () => { - const A = _.type({ _tag: _.literal('A'), a: _.string }) - const B = _.type({ _tag: _.literal('B'), b: _.number }) + const A = _.struct({ _tag: _.literal('A'), a: _.string }) + const B = _.struct({ _tag: _.literal('B'), b: _.number }) const decoder = sum({ A, B }) assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'Record')) assert.deepStrictEqual( @@ -537,7 +537,7 @@ describe('UnknownTaskDecoder', () => { } const lazyDecoder: _.TaskDecoder = _.lazy('A', () => - pipe(_.type({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) + pipe(_.struct({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) ) describe('lazy', () => { @@ -581,7 +581,7 @@ describe('UnknownTaskDecoder', () => { describe('draw', () => { it('draw', async () => { - const decoder = _.type({ + const decoder = _.struct({ a: _.string, b: _.number, c: _.array(_.boolean), diff --git a/test/Type.ts b/test/Type.ts index 2c20a1562..567fe0972 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -105,10 +105,10 @@ describe('Type', () => { ) }) - it('type', () => { + it('struct', () => { check( make((S) => - S.type({ + S.struct({ name: S.string, age: S.number }) @@ -162,7 +162,7 @@ describe('Type', () => { it('intersect', () => { check( - make((S) => pipe(S.type({ a: S.string }), S.intersect(S.type({ b: S.number })))), + make((S) => pipe(S.struct({ a: S.string }), S.intersect(S.struct({ b: S.number })))), t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) ) }) @@ -171,8 +171,8 @@ describe('Type', () => { check( make((S) => S.sum('_tag')({ - A: S.type({ _tag: S.literal('A'), a: S.string }), - B: S.type({ _tag: S.literal('B'), b: S.number }) + A: S.struct({ _tag: S.literal('A'), a: S.string }), + B: S.struct({ _tag: S.literal('B'), b: S.number }) }) ), t.union([t.type({ _tag: t.literal('A'), a: t.string }), t.type({ _tag: t.literal('B'), b: t.number })]) @@ -187,7 +187,7 @@ describe('Type', () => { } const schema: Schema = make((S) => - S.lazy('A', () => pipe(S.type({ a: S.string }), S.intersect(S.partial({ b: schema(S), c: S.number })))) + S.lazy('A', () => pipe(S.struct({ a: S.string }), S.intersect(S.partial({ b: schema(S), c: S.number })))) ) const type: t.Type = t.recursion('A', () => t.intersection([t.type({ a: t.string }), t.partial({ b: type, c: t.number })]) From 1f1fb851f3b0fe46f9ca41beea7f4ae2f04b3325 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 22 Feb 2021 16:40:04 +0100 Subject: [PATCH 195/222] update docs --- Decoder.md | 38 +++++++++++++++++++------------------- Schema.md | 4 ++-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Decoder.md b/Decoder.md index c4ef3acb5..e6b6589ab 100644 --- a/Decoder.md +++ b/Decoder.md @@ -6,7 +6,7 @@ - [Combinators](#combinators) - [The `literal` constructor](#the-literal-constructor) - [The `nullable` combinator](#the-nullable-combinator) - - [The `type` combinator](#the-type-combinator) + - [The `struct` combinator](#the-struct-combinator) - [The `partial` combinator](#the-partial-combinator) - [The `record` combinator](#the-record-combinator) - [The `array` combinator](#the-array-combinator) @@ -100,12 +100,12 @@ The `nullable` combinator describes a nullable value export const NullableString: D.Decoder = D.nullable(D.string) ``` -## The `type` combinator +## The `struct` combinator -The `type` combinator describes an object with required fields. +The `struct` combinator describes an object with required fields. ```ts -export const Person = D.type({ +export const Person = D.struct({ name: D.string, age: D.number }) @@ -114,7 +114,7 @@ console.log(isRight(Person.decode({ name: 'name', age: 42 }))) // => true console.log(isRight(Person.decode({ name: 'name' }))) // => false ``` -The `type` combinator will strip additional fields while decoding +The `struct` combinator will strip additional fields while decoding ```ts console.log(Person.decode({ name: 'name', age: 42, rememberMe: true })) @@ -184,7 +184,7 @@ The `intersect` combinator is useful in order to mix required and optional props ```ts export const Person = pipe( - D.type({ + D.struct({ name: D.string }), D.intersect( @@ -215,12 +215,12 @@ export const MySum: D.Decoder< } // v--- tag name > = D.sum('type')({ - // +----- all union members in the dictionary must own a field named like the chosen tag ("type" in this case) - // | - // v v----- this value must be equal to its corresponding dictionary key ("A" in this case) - A: D.type({ type: D.literal('A'), a: D.string }), - // v----- this value must be equal to its corresponding dictionary key ("B" in this case) - B: D.type({ type: D.literal('B'), b: D.number }) + // +----- all union members in the dictionary must own a field named like the chosen tag ("type" in this case) + // | + // v v----- this value must be equal to its corresponding dictionary key ("A" in this case) + A: D.struct({ type: D.literal('A'), a: D.string }), + // v----- this value must be equal to its corresponding dictionary key ("B" in this case) + B: D.struct({ type: D.literal('B'), b: D.number }) }) ``` @@ -240,8 +240,8 @@ export const MySum: D.Decoder< b: number } > = D.sum('type')({ - [1]: D.type({ type: D.literal(1), a: D.string }), - [2]: D.type({ type: D.literal(2), b: D.number }) + [1]: D.struct({ type: D.literal(1), a: D.string }), + [2]: D.struct({ type: D.literal(2), b: D.number }) }) ``` @@ -270,7 +270,7 @@ interface Category { } const Category: D.Decoder = D.lazy('Category', () => - D.type({ + D.struct({ title: D.string, subcategory: D.nullable(Category) }) @@ -291,14 +291,14 @@ interface Bar { } const Foo: D.Decoder = D.lazy('Foo', () => - D.type({ + D.struct({ foo: D.string, bar: D.nullable(Bar) }) ) const Bar: D.Decoder = D.lazy('Bar', () => - D.type({ + D.struct({ bar: D.number, foo: D.nullable(Foo) }) @@ -352,7 +352,7 @@ console.log(isRight(NumberFromString.decode('a'))) // => false Static types can be extracted from decoders using the `TypeOf` and `InputOf` operators ```ts -export const Person = D.type({ +export const Person = D.struct({ name: D.string, age: D.number }) @@ -382,7 +382,7 @@ export interface Person extends D.TypeOf {} ```ts import { isLeft } from 'fp-ts/Either' -export const Person = D.type({ +export const Person = D.struct({ name: D.string, age: D.number }) diff --git a/Schema.md b/Schema.md index 9a7d8ac05..23bb045df 100644 --- a/Schema.md +++ b/Schema.md @@ -26,7 +26,7 @@ import * as S from 'io-ts/Schema' import * as TD from 'io-ts/TaskDecoder' export const Person = S.make((S) => - S.type({ + S.struct({ name: S.string, age: S.number }) @@ -111,7 +111,7 @@ Now we can define a schema leveraging the new `Int` capability ```ts export const Person = make((S) => - S.type({ + S.struct({ name: S.string, age: S.Int }) From c2456669d7ffcd5fbb4edea4a862fad2f41e7e27 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 6 Mar 2021 06:50:36 +0100 Subject: [PATCH 196/222] upgrade fp-ts to 2.5.0 --- package-lock.json | 14 ++++++++++---- package.json | 4 ++-- scripts/FileSystem.ts | 4 ++-- scripts/build.ts | 19 ++++++++----------- scripts/pre-publish.ts | 3 +-- scripts/release.ts | 4 ++-- scripts/run.ts | 4 ++-- test/Codec.ts | 16 ++++++++++++++-- test/Eq.ts | 8 ++++---- test/JsonSchema.test.ts | 4 ++-- test/JsonSchema.ts | 7 ++++--- 11 files changed, 51 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index f77485aa5..294bc4709 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.14", + "version": "2.2.15", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2313,6 +2313,12 @@ "ts-node": "^8.10.2" }, "dependencies": { + "fp-ts": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.5.tgz", + "integrity": "sha512-MiHrA5teO6t8zKArE3DdMPT/Db6v2GUt5yfWnhBTrrsVfeCJUUnV6sgFvjGNBKDmEMqVwRFkEePL7wPwqrLKKA==", + "dev": true + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -3269,9 +3275,9 @@ "dev": true }, "fp-ts": { - "version": "2.9.5", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.5.tgz", - "integrity": "sha512-MiHrA5teO6t8zKArE3DdMPT/Db6v2GUt5yfWnhBTrrsVfeCJUUnV6sgFvjGNBKDmEMqVwRFkEePL7wPwqrLKKA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.0.tgz", + "integrity": "sha512-xkC9ZKl/i2cU+8FAsdyLcTvPRXphp42FcK5WmZpB47VXb4gggC3DHlVDKNLdbC+U8zz6yp1b0bj0mZg0axmZYQ==", "dev": true }, "fragment-cache": { diff --git a/package.json b/package.json index f949262ef..f904dc85d 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "homepage": "https://github.com/gcanti/io-ts", "dependencies": {}, "peerDependencies": { - "fp-ts": "^2.0.0" + "fp-ts": "^2.5.0" }, "devDependencies": { "@types/benchmark": "1.0.31", @@ -54,7 +54,7 @@ "dtslint": "github:gcanti/dtslint", "eslint": "^7.18.0", "fast-check": "^1.24.2", - "fp-ts": "^2.9.5", + "fp-ts": "^2.5.0", "import-path-rewrite": "github:gcanti/import-path-rewrite", "jest": "25.2.7", "mocha": "7.1.1", diff --git a/scripts/FileSystem.ts b/scripts/FileSystem.ts index 9e2c2c468..fa10d9f0f 100644 --- a/scripts/FileSystem.ts +++ b/scripts/FileSystem.ts @@ -1,5 +1,5 @@ -import * as TE from 'fp-ts/TaskEither' -import { flow } from 'fp-ts/function' +import * as TE from 'fp-ts/lib/TaskEither' +import { flow } from 'fp-ts/lib/function' import * as fs from 'fs' import G from 'glob' diff --git a/scripts/build.ts b/scripts/build.ts index ba6ec6f59..eabd0eb52 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,9 +1,9 @@ import * as path from 'path' -import * as E from 'fp-ts/Either' -import { pipe } from 'fp-ts/function' -import * as RTE from 'fp-ts/ReaderTaskEither' -import * as A from 'fp-ts/ReadonlyArray' -import * as TE from 'fp-ts/TaskEither' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' +import * as RTE from 'fp-ts/lib/ReaderTaskEither' +import * as A from 'fp-ts/lib/ReadonlyArray' +import * as TE from 'fp-ts/lib/TaskEither' import { FileSystem, fileSystem } from './FileSystem' import { run } from './run' @@ -31,18 +31,15 @@ export const copyPackageJson: Build = (C) => export const FILES: ReadonlyArray = ['CHANGELOG.md', 'LICENSE', 'README.md'] export const copyFiles: Build> = (C) => - pipe( - FILES, - A.traverse(TE.taskEither)((from) => C.copyFile(from, path.resolve(OUTPUT_FOLDER, from))) - ) + A.readonlyArray.traverse(TE.taskEither)(FILES, (from) => C.copyFile(from, path.resolve(OUTPUT_FOLDER, from))) -const traverse = A.traverse(TE.taskEither) +const traverse = A.readonlyArray.traverse(TE.taskEither) export const makeModules: Build = (C) => pipe( C.glob(`${OUTPUT_FOLDER}/lib/*.js`), TE.map(getModules), - TE.chain(traverse(makeSingleModule(C))), + TE.chain((modules) => traverse(modules, makeSingleModule(C))), TE.map(() => undefined) ) diff --git a/scripts/pre-publish.ts b/scripts/pre-publish.ts index c326efd04..01db9915c 100644 --- a/scripts/pre-publish.ts +++ b/scripts/pre-publish.ts @@ -1,7 +1,6 @@ -import { left } from 'fp-ts/TaskEither' +import { left } from 'fp-ts/lib/TaskEither' import { run } from './run' const main = left(new Error('"npm publish" can not be run from root, run "npm run release" instead')) run(main) - diff --git a/scripts/release.ts b/scripts/release.ts index 750f3eddd..418c37ffe 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -1,7 +1,7 @@ import { run } from './run' import * as child_process from 'child_process' -import { left, right } from 'fp-ts/Either' -import * as TE from 'fp-ts/TaskEither' +import { left, right } from 'fp-ts/lib/Either' +import * as TE from 'fp-ts/lib/TaskEither' const DIST = 'dist' diff --git a/scripts/run.ts b/scripts/run.ts index 7629fe11d..6c259ef49 100644 --- a/scripts/run.ts +++ b/scripts/run.ts @@ -1,5 +1,5 @@ -import { fold } from 'fp-ts/Either' -import { TaskEither } from 'fp-ts/TaskEither' +import { fold } from 'fp-ts/lib/Either' +import { TaskEither } from 'fp-ts/lib/TaskEither' export function run(eff: TaskEither): void { eff() diff --git a/test/Codec.ts b/test/Codec.ts index cfc48d99b..8b228ee39 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -20,6 +20,18 @@ const codecInt: _.Codec = _.fromDecoder(H.decoderInt) const codecUndefined: _.Codec = _.fromDecoder(H.decoderUndefined) +export type Json = boolean | number | string | null | JsonArray | JsonRecord + +export interface JsonRecord { + readonly [key: string]: Json +} + +export interface JsonArray extends ReadonlyArray {} + +export function parseJSON(s: string, onError: (reason: unknown) => E): E.Either { + return E.tryCatch(() => JSON.parse(s), onError) +} + describe('Codec', () => { describe('Invariant', () => { it('imap', () => { @@ -624,8 +636,8 @@ describe('Codec', () => { encode: (s) => Buffer.from(s).toString('base64') } - const Json: _.Codec = { - decode: (s) => E.parseJSON(s, () => D.error(s, 'Json')), + const Json: _.Codec = { + decode: (s) => parseJSON(s, () => D.error(s, 'Json')), encode: (a) => JSON.stringify(a) } diff --git a/test/Eq.ts b/test/Eq.ts index 6e74bfc71..a7b1921bb 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -44,7 +44,7 @@ describe('Eq', () => { }) it('intersect', () => { - const eq = pipe(E.type({ a: E.string }), E.intersect(E.type({ b: E.number }))) + const eq = pipe(E.struct({ a: E.string }), E.intersect(E.struct({ b: E.number }))) assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'a', b: 1 }), true) assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'c', b: 1 }), false) assert.deepStrictEqual(eq.equals({ a: 'a', b: 1 }, { a: 'a', b: 2 }), false) @@ -57,7 +57,7 @@ describe('Eq', () => { } const eq: Eq = E.Schemable.lazy('A', () => - E.type({ + E.struct({ a: E.number, b: E.array(eq) }) @@ -71,8 +71,8 @@ describe('Eq', () => { it('sum', () => { const sum = E.sum('_tag') const eq = sum({ - A: E.type({ _tag: E.Schemable.literal('A'), a: E.string }), - B: E.type({ _tag: E.Schemable.literal('B'), b: E.number }) + A: E.struct({ _tag: E.Schemable.literal('A'), a: E.string }), + B: E.struct({ _tag: E.Schemable.literal('B'), b: E.number }) }) assert.strictEqual(eq.equals({ _tag: 'A', a: 'a' }, { _tag: 'A', a: 'a' }), true) assert.strictEqual(eq.equals({ _tag: 'B', b: 1 }, { _tag: 'B', b: 1 }), true) diff --git a/test/JsonSchema.test.ts b/test/JsonSchema.test.ts index c8a86d81b..670f4b924 100644 --- a/test/JsonSchema.test.ts +++ b/test/JsonSchema.test.ts @@ -1,8 +1,8 @@ import * as assert from 'assert' import Ajv from 'ajv' import * as J from './JsonSchema' -import * as C from 'fp-ts/Const' -import { pipe } from 'fp-ts/function' +import * as C from 'fp-ts/lib/Const' +import { pipe } from 'fp-ts/lib/pipeable' const ajv = new Ajv() diff --git a/test/JsonSchema.ts b/test/JsonSchema.ts index bdc331c54..99be4dc9f 100644 --- a/test/JsonSchema.ts +++ b/test/JsonSchema.ts @@ -1,6 +1,7 @@ -import * as C from 'fp-ts/Const' -import { identity, pipe } from 'fp-ts/function' -import * as R from 'fp-ts/ReadonlyRecord' +import * as C from 'fp-ts/lib/Const' +import { identity } from 'fp-ts/lib/function' +import { pipe } from 'fp-ts/lib/pipeable' +import * as R from 'fp-ts/lib/ReadonlyRecord' import { JSONSchema7 } from 'json-schema' import * as S from '../src/Schemable' From b88a20cf978d042b93ca95f746bafa549b9343f8 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 8 Mar 2021 14:37:03 +0100 Subject: [PATCH 197/222] version 2.2.16 --- CHANGELOG.md | 10 ++++++++++ docs/modules/Codec.ts.md | 11 +++++++++++ docs/modules/Encoder.ts.md | 11 +++++++++++ package.json | 4 ++-- src/Codec.ts | 6 ++++++ src/Encoder.ts | 6 ++++++ 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74232e5da..7f9389b04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,16 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.16 + +Experimental modules require `fp-ts@^2.5.0`. + +- **Experimental** + - `Codec` + - add `readonly` combinator (@gcanti) + - `Encoder` + - add `readonly` combinator (@gcanti) + # 2.2.15 - **Experimental** diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index de0027cc6..0f5feca24 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -35,6 +35,7 @@ Added in v2.2.3 - [mapLeftWithInput](#mapleftwithinput) - [nullable](#nullable) - [partial](#partial) + - [readonly](#readonly) - [record](#record) - [refine](#refine) - [struct](#struct) @@ -237,6 +238,16 @@ export declare function partial

(codec: Codec) => Codec> +``` + +Added in v2.2.16 + ## record **Signature** diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 2d2cb6144..153decb69 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -31,6 +31,7 @@ Added in v2.2.3 - [lazy](#lazy) - [nullable](#nullable) - [partial](#partial) + - [readonly](#readonly) - [record](#record) - [struct](#struct) - [sum](#sum) @@ -139,6 +140,16 @@ export declare function partial

>>( Added in v2.2.3 +## readonly + +**Signature** + +```ts +export declare const readonly: (decoder: Encoder) => Encoder> +``` + +Added in v2.2.16 + ## record **Signature** diff --git a/package.json b/package.json index f904dc85d..9c7cc2434 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "io-ts", - "version": "2.2.15", + "version": "2.2.16", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", "typings": "lib/index.d.ts", "sideEffects": false, "scripts": { - "lint": "tslint -p tsconfig.tslint.json src/**/*.ts test/**/*.ts", + "lint": "tslint -p .", "eslint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.ts\"", "jest": "jest", "prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"", diff --git a/src/Codec.ts b/src/Codec.ts index 035665ff7..fe43c2aa5 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -304,6 +304,12 @@ export function lazy(id: string, f: () => Codec): Codec(codec: Codec) => Codec> = identity + /** * @category combinators * @since 2.2.8 diff --git a/src/Encoder.ts b/src/Encoder.ts index 5b7eac912..8cf7a0855 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -162,6 +162,12 @@ export function lazy(f: () => Encoder): Encoder { } } +/** + * @category combinators + * @since 2.2.16 + */ +export const readonly: (decoder: Encoder) => Encoder> = identity + // ------------------------------------------------------------------------------------- // non-pipeables // ------------------------------------------------------------------------------------- From 920b21ea32e82b328cd14ff4b28da72ae60db505 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 15 Mar 2021 09:00:49 +0100 Subject: [PATCH 198/222] README: clarify the difference between stable and experimental modules, closes #571 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f89fd281e..43cf5bc4a 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,11 @@ npm i io-ts fp-ts - [`index.ts` module](index.md) -## Experimental features (version `2.2+`) +## Experimental modules (version `2.2+`) -Experimental features (\*) are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. +Experimental modules (\*) are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +The experimental modules are **independent and backward-incompatible** with stable ones. - [`Decoder.ts` module](Decoder.md) - [`Encoder.ts` module](Encoder.md) From 87f6b860001eb4b487429b0547cfa9a4efca33b4 Mon Sep 17 00:00:00 2001 From: Emanuele Menon Date: Mon, 26 Apr 2021 21:57:23 +0200 Subject: [PATCH 199/222] Fixed first codec law Signed-off-by: Emanuele Menon --- Codec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Codec.md b/Codec.md index 0656973ea..4f4addcbb 100644 --- a/Codec.md +++ b/Codec.md @@ -15,7 +15,7 @@ A codec is just a decoder and an encoder packed together. The following laws must hold -1. `pipe(codec.decode(u), E.fold(() => u, codec.encode) = u` for all `u` in `unknown` +1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` You can build a new codec using the `make` helper From f19b0e87ebbf372652da49d51eaad62aa1c8ed1e Mon Sep 17 00:00:00 2001 From: Lawson Date: Wed, 19 Jan 2022 16:46:47 +0700 Subject: [PATCH 200/222] Typo in index.md (#626) --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 0efe4c4d1..ea8028f7c 100644 --- a/index.md +++ b/index.md @@ -29,7 +29,7 @@ A codec can: - decode inputs of type `I` (through `decode`) - encode outputs of type `O` (through `encode`) -- be used as a custom [type guard](https://basarat.gitbooks.io/typescript/content/docs/types/typeGuard.html) (through `is`) +- be used as a custom [type guard](https://basarat.gitbook.io/typescript/type-system/typeguard) (through `is`) ```ts class Type { From 1f23c7c4936690506eda3e1f7ad0066e84aa8bb1 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 23 Mar 2022 12:38:30 +0100 Subject: [PATCH 201/222] update dtslint --- package-lock.json | 30 ++++++++++++++++++------------ package.json | 2 +- test/Arbitrary.ts | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 294bc4709..1136755a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.15", + "version": "2.2.16", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -955,6 +955,12 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true + }, + "typescript": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", + "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==", + "dev": true } } }, @@ -2443,7 +2449,7 @@ } }, "dtslint": { - "version": "github:gcanti/dtslint#ef28f0ad1d3bd64b8367f6f543cf6fd3b9b09c1b", + "version": "github:gcanti/dtslint#2c3c3487e7650d6ca90c2877dbbd7c4c08360d0d", "from": "github:gcanti/dtslint", "dev": true, "requires": { @@ -2451,7 +2457,7 @@ "parsimmon": "^1.12.0", "strip-json-comments": "^2.0.1", "tslint": "^5.12.0", - "typescript": "^4.2.0-dev.20201211" + "typescript": "^4.6.2" }, "dependencies": { "fs-extra": { @@ -2487,9 +2493,9 @@ } }, "typescript": { - "version": "4.2.0-dev.20201211", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.0-dev.20201211.tgz", - "integrity": "sha512-k+ENtRQ+u9ZWF7URgAAHYTPSVu8imLa7a08XmZG+swJZTeOZJMrzFfklK/Wn5765RFG6kh2nnvcQaO9AtR/DGg==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true } } @@ -6367,9 +6373,9 @@ "dev": true }, "parsimmon": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.16.0.tgz", - "integrity": "sha512-tekGDz2Lny27SQ/5DzJdIK0lqsWwZ667SCLFIDCxaZM7VNgQjyKLbaL7FYPKpbjdxNAXFV/mSxkq5D2fnkW4pA==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz", + "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==", "dev": true }, "pascalcase": { @@ -8026,9 +8032,9 @@ } }, "typescript": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", - "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true }, "unc-path-regex": { diff --git a/package.json b/package.json index 9c7cc2434..59152d8bf 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "ts-node": "8.8.2", "tslint": "6.1.1", "tslint-config-standard": "9.0.0", - "typescript": "^4.1.3" + "typescript": "^4.6.2" }, "tags": [ "typescript", diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 11185cd47..9587552ad 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -99,7 +99,7 @@ export const readonly: (arb: Arbitrary) => Arbitrary> = identi export function union, ...Array>]>( ...members: { [K in keyof A]: Arbitrary } ): Arbitrary { - return fc.oneof(...members) + return fc.oneof(...members) as any } // ------------------------------------------------------------------------------------- From 73d0ea7f8d4d6dcea41132317b7c20680f22cf67 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Tue, 26 Jul 2022 10:27:19 +0100 Subject: [PATCH 202/222] Don't throw a TypeError when trying to decode a sum value that contains a dangerous string --- src/Kleisli.ts | 2 +- test/Decoder.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 5a30c198b..6ea53b58b 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -297,7 +297,7 @@ export function fromSum( return { decode: (ir) => { const v: any = ir[tag] - if (v in members) { + if (Object.prototype.hasOwnProperty.call(members, v)) { return (members as any)[v].decode(ir) } return M.throwError(onTagError(tag, v, keys)) diff --git a/test/Decoder.ts b/test/Decoder.ts index f1323521b..422d1041a 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -461,6 +461,10 @@ describe('Decoder', () => { decoder.decode({ _tag: 'A', a: 1 }), E.left(FS.of(DE.key('a', DE.required, FS.of(DE.leaf(1, 'string'))))) ) + assert.deepStrictEqual( + decoder.decode({ _tag: 'toString', a: 1 }), + E.left(FS.of(DE.key('_tag', DE.required, FS.of(DE.leaf('toString', '"A" | "B"'))))) + ) }) it('should support empty records', () => { From 0ef9c7c01c5b59b93815097cd72afd5fa12af248 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 28 Jul 2022 14:40:12 +0200 Subject: [PATCH 203/222] update CI node version --- .github/workflows/main.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 33e15836c..67af800a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,28 +2,27 @@ name: Node.js CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: build: - runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm run build --if-present - - run: npm test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run build --if-present + - run: npm test From eae9114237f4cf8b8da68b1fac52e6181a4cdbd4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 28 Jul 2022 14:49:17 +0200 Subject: [PATCH 204/222] version 2.2.17 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9389b04..028ee21b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.17 + +- **Bug Fix** + - Don't throw a TypeError when trying to decode a sum value that contains a dangerous string, #650 (@thewilkybarkid) + # 2.2.16 Experimental modules require `fp-ts@^2.5.0`. diff --git a/package.json b/package.json index 59152d8bf..a08782657 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.16", + "version": "2.2.17", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", From 63eea029773595b6a9cff9d70894935ae7a20e7e Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 4 Aug 2022 09:07:14 +0200 Subject: [PATCH 205/222] fix eslint warnings --- docs/modules/index.ts.md | 13 +++++-------- src/index.ts | 32 +++++++++++++++----------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index e6de5febb..650ca44ad 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -289,7 +289,7 @@ Added in v1.0.0 pipe( this: Type, ab: Type, - name: string = `pipe(${this.name}, ${ab.name})` + name = `pipe(${this.name}, ${ab.name})` ): Type ``` @@ -468,7 +468,7 @@ Added in v1.0.0 **Signature** ```ts -export declare function array(item: C, name: string = `Array<${item.name}>`): ArrayC +export declare function array(item: C, name = `Array<${item.name}>`): ArrayC ``` Added in v1.0.0 @@ -545,7 +545,7 @@ Added in v1.0.0 **Signature** ```ts -export declare function readonly(codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC +export declare function readonly(codec: C, name = `Readonly<${codec.name}>`): ReadonlyC ``` Added in v1.0.0 @@ -555,10 +555,7 @@ Added in v1.0.0 **Signature** ```ts -export declare function readonlyArray( - item: C, - name: string = `ReadonlyArray<${item.name}>` -): ReadonlyArrayC +export declare function readonlyArray(item: C, name = `ReadonlyArray<${item.name}>`): ReadonlyArrayC ``` Added in v1.0.0 @@ -736,7 +733,7 @@ Use `brand` instead. export declare function refinement( codec: C, predicate: Predicate>, - name: string = `(${codec.name} | ${getFunctionName(predicate)})` + name = `(${codec.name} | ${getFunctionName(predicate)})` ): // tslint:disable-next-line: deprecation RefinementC ``` diff --git a/src/index.ts b/src/index.ts index d15ef712e..33b81e21e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -175,7 +175,7 @@ export class Type implements Decoder, Encoder pipe( this: Type, ab: Type, - name: string = `pipe(${this.name}, ${ab.name})` + name = `pipe(${this.name}, ${ab.name})` ): Type { return new Type( name, @@ -327,7 +327,7 @@ function enumerableRecord( keys: Array, domain: D, codomain: C, - name: string = `{ [K in ${domain.name}]: ${codomain.name} }` + name = `{ [K in ${domain.name}]: ${codomain.name} }` ): RecordC { const len = keys.length return new DictionaryType( @@ -341,7 +341,7 @@ function enumerableRecord( const o = e.right const a: { [key: string]: any } = {} const errors: Errors = [] - let changed: boolean = false + let changed = false for (let i = 0; i < len; i++) { const k = keys[i] const ok = o[k] @@ -392,7 +392,7 @@ export function getDomainKeys(domain: D): Record( domain: D, codomain: C, - name: string = `{ [K in ${domain.name}]: ${codomain.name} }` + name = `{ [K in ${domain.name}]: ${codomain.name} }` ): RecordC { return new DictionaryType( name, @@ -408,7 +408,7 @@ function nonEnumerableRecord( const errors: Errors = [] const keys = Object.keys(u) const len = keys.length - let changed: boolean = false + let changed = false for (let i = 0; i < len; i++) { let k = keys[i] const ok = u[k] @@ -460,6 +460,7 @@ function getUnionName]>(codecs: CS): s /** * @internal */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function mergeAll(base: any, us: Array): any { let equal = true let primitive = true @@ -480,7 +481,7 @@ export function mergeAll(base: any, us: Array): any { const r: any = {} for (const u of us) { for (const k in u) { - if (!r.hasOwnProperty(k) || baseIsNotADictionary || u[k] !== base[k]) { + if (!hasOwnProperty.call(r, k) || baseIsNotADictionary || u[k] !== base[k]) { r[k] = u[k] } } @@ -584,7 +585,7 @@ function mergeTags(a: Tags, b: Tags): Tags { } let r: Tags = Object.assign({}, a) for (const k in b) { - if (a.hasOwnProperty(k)) { + if (hasOwnProperty.call(a, k)) { const intersection = intersect(a[k], b[k]) if (isNonEmpty(intersection)) { r[k] = intersection @@ -605,7 +606,7 @@ function intersectTags(a: Tags, b: Tags): Tags { } let r: Tags = emptyTags for (const k in a) { - if (b.hasOwnProperty(k)) { + if (hasOwnProperty.call(b, k)) { const intersection = intersect(a[k], b[k]) if (intersection.length === 0) { if (r === emptyTags) { @@ -1268,7 +1269,7 @@ export interface ArrayC extends ArrayType>, * @category combinators * @since 1.0.0 */ -export function array(item: C, name: string = `Array<${item.name}>`): ArrayC { +export function array(item: C, name = `Array<${item.name}>`): ArrayC { return new ArrayType( name, (u): u is Array> => UnknownArray.is(u) && u.every(item.is), @@ -1711,7 +1712,7 @@ export function intersection( export function intersection(codecs: [A, B], name?: string): IntersectionC<[A, B]> export function intersection]>( codecs: CS, - name: string = `(${codecs.map((type) => type.name).join(' & ')})` + name = `(${codecs.map((type) => type.name).join(' & ')})` ): IntersectionC { const len = codecs.length return new IntersectionType( @@ -1814,7 +1815,7 @@ export function tuple(codecs: [A, B], name?: s export function tuple(codecs: [A], name?: string): TupleC<[A]> export function tuple]>( codecs: CS, - name: string = `[${codecs.map((type) => type.name).join(', ')}]` + name = `[${codecs.map((type) => type.name).join(', ')}]` ): TupleC { const len = codecs.length return new TupleType( @@ -1881,7 +1882,7 @@ export interface ReadonlyC * @category combinators * @since 1.0.0 */ -export function readonly(codec: C, name: string = `Readonly<${codec.name}>`): ReadonlyC { +export function readonly(codec: C, name = `Readonly<${codec.name}>`): ReadonlyC { return new ReadonlyType(name, codec.is, codec.validate, codec.encode, codec) } @@ -1914,10 +1915,7 @@ export interface ReadonlyArrayC * @category combinators * @since 1.0.0 */ -export function readonlyArray( - item: C, - name: string = `ReadonlyArray<${item.name}>` -): ReadonlyArrayC { +export function readonlyArray(item: C, name = `ReadonlyArray<${item.name}>`): ReadonlyArrayC { const codec = array(item) return new ReadonlyArrayType(name, codec.is, codec.validate, codec.encode, item) as any } @@ -2255,7 +2253,7 @@ export interface RefinementC extends RefinementType, export function refinement( codec: C, predicate: Predicate>, - name: string = `(${codec.name} | ${getFunctionName(predicate)})` + name = `(${codec.name} | ${getFunctionName(predicate)})` ): // tslint:disable-next-line: deprecation RefinementC { return new RefinementType( From 9e8ef0e0398dc2b0c15556a8db128666c6fa7203 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Mon, 29 Aug 2022 16:19:50 +0200 Subject: [PATCH 206/222] fix `typescript@4.8` errors, closes #656, closes #647 (#657) --- CHANGELOG.md | 5 + docs/modules/Codec.ts.md | 2 +- docs/modules/Decoder.ts.md | 2 +- docs/modules/Guard.ts.md | 12 +- docs/modules/Kleisli.ts.md | 6 +- docs/modules/Schemable.ts.md | 12 +- docs/modules/TaskDecoder.ts.md | 2 +- docs/modules/Type.ts.md | 4 +- docs/modules/index.ts.md | 30 +- dtslint/ts3.5/Decoder.ts | 42 + dtslint/ts3.5/Schema.ts | 2 + dtslint/ts3.5/index.ts | 4 +- package-lock.json | 11137 ++++++++++++++++++++++++++++++- package.json | 5 +- src/Codec.ts | 4 +- src/DecodeError.ts | 2 + src/Decoder.ts | 17 +- src/Eq.ts | 4 +- src/Guard.ts | 22 +- src/Kleisli.ts | 14 +- src/Schemable.ts | 12 +- src/TaskDecoder.ts | 2 +- src/Type.ts | 5 +- src/index.ts | 35 +- test/Arbitrary.ts | 4 +- test/Decoder.ts | 4 +- test/JsonSchema.ts | 4 +- test/TaskDecoder.ts | 4 +- 28 files changed, 11233 insertions(+), 165 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 028ee21b4..496e1cc4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.18 + +- **Bug Fix** + - fix `typescript@4.8` errors, closes #656, closes #647 (@gcanti) + # 2.2.17 - **Bug Fix** diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 0f5feca24..841c0f3f3 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -352,7 +352,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function literal]>( +export declare function literal], L extends S.Literal = S.Literal>( ...values: A ): Codec ``` diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 347edd76c..e2b947d74 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -479,7 +479,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const literal: ( +export declare const literal: ( ...values: A ) => Decoder ``` diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index 015da589d..ce797e488 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -255,7 +255,9 @@ Added in v2.2.0 **Signature** ```ts -export declare const literal: (...values: A) => Guard +export declare const literal: ( + ...values: A +) => Guard ``` Added in v2.2.0 @@ -267,7 +269,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const Schemable: Schemable1<'io-ts/Guard'> +export declare const Schemable: S.Schemable1<'io-ts/Guard'> ``` Added in v2.2.8 @@ -297,7 +299,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const WithRefine: WithRefine1<'io-ts/Guard'> +export declare const WithRefine: S.WithRefine1<'io-ts/Guard'> ``` Added in v2.2.8 @@ -307,7 +309,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const WithUnion: WithUnion1<'io-ts/Guard'> +export declare const WithUnion: S.WithUnion1<'io-ts/Guard'> ``` Added in v2.2.8 @@ -317,7 +319,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const WithUnknownContainers: WithUnknownContainers1<'io-ts/Guard'> +export declare const WithUnknownContainers: S.WithUnknownContainers1<'io-ts/Guard'> ``` Added in v2.2.8 diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index 7bdaeb261..d29e54961 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -314,8 +314,10 @@ Added in v2.2.7 export declare function literal( M: MonadThrow2C ): ( - onError: (i: I, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A) => Kleisli + onError: (i: I, values: readonly [S.Literal, ...ReadonlyArray]) => E +) => ], L extends S.Literal = S.Literal>( + ...values: A +) => Kleisli ``` Added in v2.2.7 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 9d5d7d23b..0d146264b 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -56,7 +56,9 @@ Added in v2.2.0 ```ts export interface Schemable { readonly URI: S - readonly literal: ]>(...values: A) => HKT + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => HKT readonly string: HKT readonly number: HKT readonly boolean: HKT @@ -86,7 +88,9 @@ Added in v2.2.3 ```ts export interface Schemable1 { readonly URI: S - readonly literal: ]>(...values: A) => Kind + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind readonly string: Kind readonly number: Kind readonly boolean: Kind @@ -116,7 +120,9 @@ Added in v2.2.3 ```ts export interface Schemable2C { readonly URI: S - readonly literal: ]>(...values: A) => Kind2 + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind2 readonly string: Kind2 readonly number: Kind2 readonly boolean: Kind2 diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 8caa35f08..ae2cd3e0d 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -495,7 +495,7 @@ Added in v2.2.8 **Signature** ```ts -export declare const literal: ( +export declare const literal: ( ...values: A ) => TaskDecoder ``` diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index d1d2bd000..c6ceb033b 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -198,7 +198,9 @@ Added in v2.2.3 **Signature** ```ts -export declare const literal: (...values: A) => Type +export declare const literal: ( + ...values: A +) => Type ``` Added in v2.2.3 diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 650ca44ad..33f379407 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -650,39 +650,15 @@ Keeps the codec "kind". ```ts export declare function alias( codec: PartialType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => PartialType +): () => PartialType export declare function alias( // tslint:disable-next-line: deprecation codec: StrictType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => // tslint:disable-next-line: deprecation +): () => // tslint:disable-next-line: deprecation StrictType export declare function alias( codec: InterfaceType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => InterfaceType +): () => InterfaceType ``` Added in v1.1.0 diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.5/Decoder.ts index 94e80ca7d..c37951e67 100644 --- a/dtslint/ts3.5/Decoder.ts +++ b/dtslint/ts3.5/Decoder.ts @@ -19,6 +19,48 @@ export type TypeOfNumberFromString = _.TypeOf // $ExpectType string export type InputOfNumberFromString = _.InputOf +// +// literal +// + +// $ExpectType Decoder +_.literal('A') + +// $ExpectType Decoder +_.literal('A', 'B') + +// $ExpectType Decoder +_.union(_.literal('A')) + +// $ExpectType Decoder +_.union(_.literal('A'), _.literal('B')) + +// $ExpectType Decoder +_.struct({ + a: _.literal('A') +}) + +// $ExpectType Decoder +pipe( + _.struct({ + a: _.literal('A') + }), + _.intersect( + _.struct({ + b: _.literal('B') + }) + ) +) + +import * as S from '../../src/Schemable' +declare const literal: ], L extends S.Literal = S.Literal>( + ...values: A +) => _.Decoder +// $ExpectType Decoder +_.struct({ + a: literal('A') +}) + // // fromStruct // diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.5/Schema.ts index e14dbf9a0..ee8729eb3 100644 --- a/dtslint/ts3.5/Schema.ts +++ b/dtslint/ts3.5/Schema.ts @@ -27,6 +27,7 @@ export type OfTest = TypeOf // $ExpectType { a: string; b: { c: n make((S) => S.literal()) make((S) => S.literal('a')) // $ExpectType Schema<"a"> make((S) => S.literal('a', 'b', null)) // $ExpectType Schema<"a" | "b" | null> +make((S) => S.literal<['a']>('a')) // $ExpectType Schema<"a"> // // string @@ -57,6 +58,7 @@ make((S) => S.nullable(S.string)) // $ExpectType Schema // make((S) => S.struct({ a: S.string, b: S.struct({ c: S.number }) })) // $ExpectType Schema<{ a: string; b: { c: number; }; }> +make((S) => S.struct({ a: S.literal('a') })) // $ExpectType Schema<{ a: "a"; }> // // partial diff --git a/dtslint/ts3.5/index.ts b/dtslint/ts3.5/index.ts index 8faac7e57..97f7ff977 100644 --- a/dtslint/ts3.5/index.ts +++ b/dtslint/ts3.5/index.ts @@ -387,8 +387,8 @@ type AliasTest2 = t.OutputOf['a'] // $ExpectType string type AliasTest3 = t.OutputOf['b'] // $ExpectType string // $ExpectError const C6 = t.alias(C1)() -// $ExpectError -const C7 = t.alias(C1)() +// // $ExpectError +// bug fix: 647 const C7 = t.alias(C1)() const C8 = t.alias(C1)() type AliasTest4 = t.TypeOf // $ExpectType C1 type AliasTest5 = t.OutputOf // $ExpectType C1O diff --git a/package-lock.json b/package-lock.json index 1136755a7..5234b1b74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,11018 @@ { "name": "io-ts", - "version": "2.2.16", - "lockfileVersion": 1, + "version": "2.2.17", + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "io-ts", + "version": "2.2.17", + "license": "MIT", + "devDependencies": { + "@types/benchmark": "1.0.31", + "@types/glob": "^7.1.3", + "@types/jest": "25.2.1", + "@types/node": "13.11.0", + "@typescript-eslint/eslint-plugin": "^4.14.1", + "@typescript-eslint/parser": "^4.14.1", + "benchmark": "2.1.4", + "docs-ts": "^0.6.2", + "doctoc": "1.4.0", + "dtslint": "github:gcanti/dtslint", + "eslint": "^7.18.0", + "fast-check": "^1.24.2", + "fp-ts": "^2.5.0", + "import-path-rewrite": "github:gcanti/import-path-rewrite", + "jest": "25.2.7", + "mocha": "7.1.1", + "prettier": "2.0.2", + "rimraf": "3.0.2", + "ts-jest": "25.3.1", + "ts-node": "8.8.2", + "tslint": "6.1.1", + "tslint-config-standard": "9.0.0", + "typescript": "^4.8.2" + }, + "peerDependencies": { + "fp-ts": "^2.5.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.8.3" + } + }, + "node_modules/@babel/core": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.0.tgz", + "integrity": "sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.9.0", + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helpers": "^7.9.0", + "@babel/parser": "^7.9.0", + "@babel/template": "^7.8.6", + "@babel/traverse": "^7.9.0", + "@babel/types": "^7.9.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/@babel/core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@babel/core/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.9.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.4.tgz", + "integrity": "sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.9.0", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "node_modules/@babel/generator/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", + "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", + "dev": true, + "dependencies": { + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "node_modules/@babel/helper-get-function-arity": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", + "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.8.3" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", + "integrity": "sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.8.3" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", + "integrity": "sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.8.3" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz", + "integrity": "sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.6", + "@babel/helper-simple-access": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/template": "^7.8.6", + "@babel/types": "^7.9.0", + "lodash": "^4.17.13" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", + "integrity": "sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.8.3" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", + "integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==", + "dev": true + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz", + "integrity": "sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA==", + "dev": true, + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/traverse": "^7.8.6", + "@babel/types": "^7.8.6" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", + "integrity": "sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", + "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.8.3" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz", + "integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==", + "dev": true + }, + "node_modules/@babel/helpers": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.9.2.tgz", + "integrity": "sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA==", + "dev": true, + "dependencies": { + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.9.0", + "@babel/types": "^7.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.9.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.9.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", + "integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", + "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.6", + "@babel/types": "^7.8.6" + } + }, + "node_modules/@babel/traverse": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.0.tgz", + "integrity": "sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.9.0", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.9.0", + "@babel/types": "^7.9.0", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + } + }, + "node_modules/@babel/traverse/node_modules/debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/@babel/traverse/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@babel/types": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", + "integrity": "sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.9.0", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@cnakazawa/watch": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", + "integrity": "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==", + "dev": true, + "dependencies": { + "exec-sh": "^0.3.2", + "minimist": "^1.2.0" + }, + "bin": { + "watch": "cli.js" + }, + "engines": { + "node": ">=0.1.95" + } + }, + "node_modules/@dsherret/to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-H2R13IvZdM6gei2vOGSzF7HdMyw=", + "dev": true, + "dependencies": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", + "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "dependencies": { + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/@eslint/eslintrc/node_modules/lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", + "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-25.2.6.tgz", + "integrity": "sha512-bGp+0PicZVCEhb+ifnW9wpKWONNdkhtJsRE7ap729hiAfTvCN6VhGx0s/l/V/skA2pnyqq+N/7xl9ZWfykDpsg==", + "dev": true, + "dependencies": { + "@jest/source-map": "^25.2.6", + "chalk": "^3.0.0", + "jest-util": "^25.2.6", + "slash": "^3.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/console/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/console/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/console/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@jest/console/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-25.2.7.tgz", + "integrity": "sha512-Nd6ELJyR+j0zlwhzkfzY70m04hAur0VnMwJXVe4VmmD/SaQ6DEyal++ERQ1sgyKIKKEqRuui6k/R0wHLez4P+g==", + "dev": true, + "dependencies": { + "@jest/console": "^25.2.6", + "@jest/reporters": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.3", + "jest-changed-files": "^25.2.6", + "jest-config": "^25.2.7", + "jest-haste-map": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-resolve-dependencies": "^25.2.7", + "jest-runner": "^25.2.7", + "jest-runtime": "^25.2.7", + "jest-snapshot": "^25.2.7", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "jest-watcher": "^25.2.7", + "micromatch": "^4.0.2", + "p-each-series": "^2.1.0", + "realpath-native": "^2.0.0", + "rimraf": "^3.0.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/core/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/core/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/core/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@jest/core/node_modules/graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "node_modules/@jest/core/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/environment": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.2.6.tgz", + "integrity": "sha512-17WIw+wCb9drRNFw1hi8CHah38dXVdOk7ga9exThhGtXlZ9mK8xH4DjSB9uGDGXIWYSHmrxoyS6KJ7ywGr7bzg==", + "dev": true, + "dependencies": { + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/fake-timers": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", + "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "lolex": "^5.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/reporters": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", + "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.2", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.0", + "jest-haste-map": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "slash": "^3.0.0", + "source-map": "^0.6.0", + "string-length": "^3.1.0", + "terminal-link": "^2.0.0", + "v8-to-istanbul": "^4.0.1" + }, + "engines": { + "node": ">= 8.3" + }, + "optionalDependencies": { + "node-notifier": "^6.0.0" + } + }, + "node_modules/@jest/reporters/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/reporters/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/reporters/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/reporters/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@jest/reporters/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/reporters/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/source-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", + "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0", + "graceful-fs": "^4.2.3", + "source-map": "^0.6.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/source-map/node_modules/graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "node_modules/@jest/test-result": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", + "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", + "dev": true, + "dependencies": { + "@jest/console": "^25.2.6", + "@jest/types": "^25.2.6", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", + "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", + "dev": true, + "dependencies": { + "@jest/test-result": "^25.2.6", + "jest-haste-map": "^25.2.6", + "jest-runner": "^25.2.7", + "jest-runtime": "^25.2.7" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/transform": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.1.0", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-util": "^25.2.6", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/transform/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/transform/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/transform/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/transform/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@jest/transform/node_modules/graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "node_modules/@jest/transform/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/transform/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/@jest/types/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/types/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/types/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/types/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@jest/types/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/types/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", + "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.3", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", + "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", + "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.3", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@sinonjs/commons": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", + "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@textlint/ast-node-types": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-4.2.2.tgz", + "integrity": "sha512-5VHykhxgUat7dvRWGw52Tk55SWjuZDpDO7PKDhfcLTFrD1cjbTtFFnWeJc0BfoqB2AUjfHXRoMdnqbFRGmnPVQ==", + "dev": true + }, + "node_modules/@textlint/markdown-to-ast": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@textlint/markdown-to-ast/-/markdown-to-ast-6.0.9.tgz", + "integrity": "sha512-hfAWBvTeUGh5t5kTn2U3uP3qOSM1BSrxzl1jF3nn0ywfZXpRBZr5yRjXnl4DzIYawCtZOshmRi/tI3/x4TE1jQ==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^4.0.3", + "debug": "^2.1.3", + "remark-frontmatter": "^1.2.0", + "remark-parse": "^5.0.0", + "structured-source": "^3.0.2", + "traverse": "^0.6.6", + "unified": "^6.1.6" + } + }, + "node_modules/@ts-morph/common": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.7.5.tgz", + "integrity": "sha512-nlFunSKAsFWI0Ol/uPxJcpVqXxTGNuaWXTmoQDhcnwj1UM4QmBSUVWzqoQ0OzUlqo4sV1gobfFBkMHuZVemMAQ==", + "dev": true, + "dependencies": { + "@dsherret/to-absolute-glob": "^2.0.2", + "fast-glob": "^3.2.5", + "is-negated-glob": "^1.0.0", + "mkdirp": "^1.0.4", + "multimatch": "^5.0.0", + "typescript": "~4.1.3" + } + }, + "node_modules/@ts-morph/common/node_modules/fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@ts-morph/common/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@ts-morph/common/node_modules/typescript": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", + "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.7.tgz", + "integrity": "sha512-RL62NqSFPCDK2FM1pSDH0scHpJvsXtZNiYlMB73DgPBaG1E38ZYVL+ei5EkWRbr+KC4YNiAUNBnRj+bgwpgjMw==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz", + "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz", + "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.9.tgz", + "integrity": "sha512-jEFQ8L1tuvPjOI8lnpaf73oCJe+aoxL6ygqSy6c8LcW98zaC+4mzWuQIRCEvKeCOu+lbqdXcg4Uqmm1S8AP1tw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.3.0" + } + }, + "node_modules/@types/benchmark": { + "version": "1.0.31", + "resolved": "https://registry.npmjs.org/@types/benchmark/-/benchmark-1.0.31.tgz", + "integrity": "sha512-F6fVNOkGEkSdo/19yWYOwVKGvzbTeWkR/XQYBKtGBQ9oGRjBN9f/L4aJI4sDcVPJO58Y1CJZN8va9V2BhrZapA==", + "dev": true + }, + "node_modules/@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "node_modules/@types/glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", + "dev": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", + "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", + "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*", + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "25.2.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.1.tgz", + "integrity": "sha512-msra1bCaAeEdkSyA0CZ6gW1ukMIvZ5YoJkdXw/qhQdsuuDlFTcEUrUw8CLCPt2rVRUfXlClVvK2gvPs9IokZaA==", + "dev": true, + "dependencies": { + "jest-diff": "^25.2.1", + "pretty-format": "^25.2.1" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "dev": true + }, + "node_modules/@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.0.tgz", + "integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==", + "dev": true + }, + "node_modules/@types/prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==", + "dev": true + }, + "node_modules/@types/stack-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==", + "dev": true + }, + "node_modules/@types/yargs": { + "version": "15.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.4.tgz", + "integrity": "sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz", + "integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==", + "dev": true, + "dependencies": { + "@typescript-eslint/experimental-utils": "4.14.1", + "@typescript-eslint/scope-manager": "4.14.1", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^4.0.0", + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/tsutils": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", + "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/@typescript-eslint/experimental-utils": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz", + "integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.14.1", + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/typescript-estree": "4.14.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz", + "integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "4.14.1", + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/typescript-estree": "4.14.1", + "debug": "^4.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz", + "integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/visitor-keys": "4.14.1" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz", + "integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==", + "dev": true, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz", + "integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.14.1", + "@typescript-eslint/visitor-keys": "4.14.1", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/globby": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/tsutils": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", + "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz", + "integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.14.1", + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/abab": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", + "dev": true + }, + "node_modules/acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-globals": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "dev": true, + "dependencies": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + } + }, + "node_modules/acorn-globals/node_modules/acorn": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ajv": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "node_modules/anchor-markdown-header": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/anchor-markdown-header/-/anchor-markdown-header-0.5.7.tgz", + "integrity": "sha1-BFBj125qH5zTJ6V6ASaqD97Dcac=", + "dev": true, + "dependencies": { + "emoji-regex": "~6.1.0" + } + }, + "node_modules/ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "dependencies": { + "type-fest": "^0.11.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-red": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "dependencies": { + "ansi-wrap": "0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "node_modules/atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true, + "bin": { + "atob": "bin/atob.js" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/autolinker": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-0.28.1.tgz", + "integrity": "sha1-BlK0kYgYefB3XazgzcoyM5QqTkc=", + "dev": true, + "dependencies": { + "gulp-header": "^1.7.1" + } + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", + "dev": true + }, + "node_modules/babel-jest": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.2.6.tgz", + "integrity": "sha512-MDJOAlwtIeIQiGshyX0d2PxTbV73xZMpNji40ivVTPQOm59OdRR9nYCkffqI7ugtsK4JR98HgNKbDbuVf4k5QQ==", + "dev": true, + "dependencies": { + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "@types/babel__core": "^7.1.0", + "babel-plugin-istanbul": "^6.0.0", + "babel-preset-jest": "^25.2.6", + "chalk": "^3.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": ">= 8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-jest/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/babel-jest/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-jest/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/babel-jest/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/babel-jest/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-jest/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz", + "integrity": "sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^4.0.0", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.2.6.tgz", + "integrity": "sha512-qE2xjMathybYxjiGFJg0mLFrz0qNp83aNZycWDY/SuHiZNq+vQfRQtuINqyXyue1ELd8Rd+1OhFSLjms8msMbw==", + "dev": true, + "dependencies": { + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/babel-preset-jest": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.2.6.tgz", + "integrity": "sha512-Xh2eEAwaLY9+SyMt/xmGZDnXTW/7pSaBPG0EMo7EuhvosFKVWYB6CqwYD31DaEQuoTL090oDZ0FEqygffGRaSQ==", + "dev": true, + "dependencies": { + "@babel/plugin-syntax-bigint": "^7.0.0", + "@babel/plugin-syntax-object-rest-spread": "^7.0.0", + "babel-plugin-jest-hoist": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/bail": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.4.tgz", + "integrity": "sha512-S8vuDB4w6YpRhICUDET3guPlQpaJl7od94tpZ0Fvnyp+MKW/HyDTcRDck+29C9g+d/qQHnddRH3+94kZdrW0Ww==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "node_modules/base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "dependencies": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/benchmark": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", + "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", + "dev": true, + "dependencies": { + "lodash": "^4.17.4", + "platform": "^1.3.3" + } + }, + "node_modules/binary-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boundary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-1.0.1.tgz", + "integrity": "sha1-TWfcJgLAzBbdm85+v4fpSCkPWBI=", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/braces/node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-process-hrtime": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", + "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", + "dev": true + }, + "node_modules/browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "dev": true, + "dependencies": { + "resolve": "1.1.7" + } + }, + "node_modules/browser-resolve/node_modules/resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "node_modules/builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "dependencies": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cache-base/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/capture-exit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", + "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==", + "dev": true, + "dependencies": { + "rsvp": "^4.8.4" + }, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/character-entities": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.3.tgz", + "integrity": "sha512-yB4oYSAa9yLcGyTbB4ItFwHw43QHdH129IJ5R+WvxOkWlyFnR5FAaBNnUq4mcxsTVZGh28bHoeTHMKXH1wZf3w==", + "dev": true + }, + "node_modules/character-entities-legacy": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.3.tgz", + "integrity": "sha512-YAxUpPoPwxYFsslbdKkhrGnXAtXoHNgYjlBM3WMXkWGTl5RsY3QmOyhwAgL8Nxm9l5LBThXGawxKPn68y6/fww==", + "dev": true + }, + "node_modules/character-reference-invalid": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.3.tgz", + "integrity": "sha512-VOq6PRzQBam/8Jm6XBGk2fNEnHXAdGd6go0rtd4weAGECBamHDwwCQSOT12TACIYUZegUXnV6xBXqUssijtxIg==", + "dev": true + }, + "node_modules/chokidar": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.2.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.1.1" + } + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "node_modules/class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "dependencies": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/class-utils/node_modules/define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/class-utils/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/code-block-writer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", + "dev": true + }, + "node_modules/coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "deprecated": "CoffeeScript on NPM has moved to \"coffeescript\" (no hyphen)", + "dev": true, + "bin": { + "cake": "bin/cake", + "coffee": "bin/coffee" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/collapse-white-space": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.5.tgz", + "integrity": "sha512-703bOOmytCYAX9cXYqoikYIx6twmFCXsnzRQheBcTG3nzKYBR4P/+wkYeH+Mvj7qUz8zZDtdyzbxfnEi/kYzRQ==", + "dev": true + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", + "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "dev": true + }, + "node_modules/collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "dependencies": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "engines": [ + "node >= 0.8" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/concat-with-sourcemaps": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", + "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==", + "dev": true, + "dependencies": { + "source-map": "^0.6.1" + } + }, + "node_modules/convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", + "dev": true + }, + "node_modules/cssstyle": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.2.0.tgz", + "integrity": "sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA==", + "dev": true, + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/data-urls": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", + "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.2.0", + "whatwg-url": "^7.0.0" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-property/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-property/node_modules/is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-property/node_modules/is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-property/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-property/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/diacritics-map": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/diacritics-map/-/diacritics-map-0.1.0.tgz", + "integrity": "sha1-bfwP+dAQAKLt8oZTccrDFulJd68=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-25.2.6.tgz", + "integrity": "sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==", + "dev": true, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/docs-ts": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.6.2.tgz", + "integrity": "sha512-61u998y7nKi9J3/Vw8BRXeNAIepDsODmVKvPHgqRdMGSE+nR/yb7b5qspCbcUcsCnJ9eDhTJc22nlGdt0NSPRw==", + "dev": true, + "dependencies": { + "chalk": "^2.4.2", + "doctrine": "^3.0.0", + "fp-ts": "^2.9.3", + "fs-extra": "^7.0.1", + "glob": "^7.1.6", + "io-ts": "^2.2.13", + "logging-ts": "^0.3.4", + "markdown-toc": "^1.2.0", + "rimraf": "^2.7.1", + "ts-morph": "^9.1.0", + "ts-node": "^8.10.2" + }, + "bin": { + "docs-ts": "lib/bin.js" + }, + "peerDependencies": { + "typescript": "^3.3.1 || ^4.x" + } + }, + "node_modules/docs-ts/node_modules/fp-ts": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.5.tgz", + "integrity": "sha512-MiHrA5teO6t8zKArE3DdMPT/Db6v2GUt5yfWnhBTrrsVfeCJUUnV6sgFvjGNBKDmEMqVwRFkEePL7wPwqrLKKA==", + "dev": true + }, + "node_modules/docs-ts/node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/docs-ts/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/docs-ts/node_modules/source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/docs-ts/node_modules/ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "dev": true, + "dependencies": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=6.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/doctoc": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/doctoc/-/doctoc-1.4.0.tgz", + "integrity": "sha512-8IAq3KdMkxhXCUF+xdZxdJxwuz8N2j25sMgqiu4U4JWluN9tRKMlAalxGASszQjlZaBprdD2YfXpL3VPWUD4eg==", + "dev": true, + "dependencies": { + "@textlint/markdown-to-ast": "~6.0.9", + "anchor-markdown-header": "^0.5.5", + "htmlparser2": "~3.9.2", + "minimist": "~1.2.0", + "underscore": "~1.8.3", + "update-section": "^0.3.0" + }, + "bin": { + "doctoc": "doctoc.js" + }, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/doctoc/node_modules/underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dom-serializer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "dev": true, + "dependencies": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "node_modules/domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true + }, + "node_modules/domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dev": true, + "dependencies": { + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dev": true, + "dependencies": { + "domelementtype": "1" + } + }, + "node_modules/domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "dev": true, + "dependencies": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "node_modules/dtslint": { + "version": "0.4.4", + "resolved": "git+ssh://git@github.com/gcanti/dtslint.git#f361dc93d6a195f530df28779082548e01cecd5e", + "dev": true, + "license": "MIT", + "dependencies": { + "fs-extra": "^6.0.1", + "parsimmon": "^1.12.0", + "strip-json-comments": "^2.0.1", + "tslint": "^5.12.0", + "typescript": "^4.6.2" + }, + "bin": { + "dtslint": "bin/index.js" + }, + "engines": { + "node": ">=6.10.0" + } + }, + "node_modules/dtslint/node_modules/fs-extra": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", + "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "node_modules/dtslint/node_modules/tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "bin": { + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + } + }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/emoji-regex": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.1.3.tgz", + "integrity": "sha1-7HmjlpsC0uzytyJUJ5v5m8eoOTI=", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/enquirer/node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true + }, + "node_modules/es-abstract": { + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", + "dev": true, + "dependencies": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/escodegen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", + "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", + "dev": true, + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=4.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/eslint": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz", + "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "@eslint/eslintrc": "^0.3.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^6.0.0", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.4", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/eslint/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "dependencies": { + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/eslint/node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint/node_modules/lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/eslint/node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint/node_modules/semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "dependencies": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/espree/node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/exec-sh": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz", + "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==", + "dev": true + }, + "node_modules/execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "dependencies": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "dependencies": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expand-brackets/node_modules/define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "dependencies": { + "fill-range": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expect": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/expect/-/expect-25.2.7.tgz", + "integrity": "sha512-yA+U2Ph0MkMsJ9N8q5hs9WgWI6oJYfecdXta6LkP/alY/jZZL1MHlJ2wbLh60Ucqf3G+51ytbqV3mlGfmxkpNw==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "ansi-styles": "^4.0.0", + "jest-get-type": "^25.2.6", + "jest-matcher-utils": "^25.2.7", + "jest-message-util": "^25.2.6", + "jest-regex-util": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/expect/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/expect/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/expect/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "dependencies": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true, + "engines": [ + "node >=0.6.0" + ] + }, + "node_modules/fast-check": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-1.24.2.tgz", + "integrity": "sha512-ZL48cyZZLJnVsUj127Zi1mfFLM98yzw0LlSSH8CMeVmpL5RCfSRcZSZZ0kJWrRK4eOgNFnXXKNDbzuRb3Vsdhg==", + "dev": true, + "dependencies": { + "pure-rand": "^2.0.0", + "tslib": "^1.10.0" + }, + "engines": { + "node": ">=0.12" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.2.tgz", + "integrity": "sha512-UDV82o4uQyljznxwMxyVRJgZZt3O5wENYojjzbaGEGZgeOxkLFf+V4cnUD+krzb2F72E18RhamkMZ7AdeggF7A==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "node_modules/fastq": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fault": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.3.tgz", + "integrity": "sha512-sfFuP4X0hzrbGKjAUNXYvNqsZ5F6ohx/dZ9I0KQud/aiZNwg263r5L9yGB0clvXHCkzXh5W3t7RSHchggYIFmA==", + "dev": true, + "dependencies": { + "format": "^0.2.2" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", + "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", + "dev": true, + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz", + "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "dependencies": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "deprecated": "Fixed a prototype pollution security issue in 4.1.0, please upgrade to ^4.1.1 or ^5.0.1.", + "dev": true, + "dependencies": { + "is-buffer": "~2.0.3" + }, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat/node_modules/is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/flatted": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/fp-ts": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.0.tgz", + "integrity": "sha512-xkC9ZKl/i2cU+8FAsdyLcTvPRXphp42FcK5WmZpB47VXb4gggC3DHlVDKNLdbC+U8zz6yp1b0bj0mZg0axmZYQ==", + "dev": true + }, + "node_modules/fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "dependencies": { + "map-cache": "^0.2.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "deprecated": "\"Please update to latest v2.3 or v2.2\"", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "node_modules/gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "dev": true + }, + "node_modules/gray-matter": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-2.1.1.tgz", + "integrity": "sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=", + "dev": true, + "dependencies": { + "ansi-red": "^0.1.1", + "coffee-script": "^1.12.4", + "extend-shallow": "^2.0.1", + "js-yaml": "^3.8.1", + "toml": "^2.3.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "dev": true, + "optional": true + }, + "node_modules/gulp-header": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.12.tgz", + "integrity": "sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ==", + "deprecated": "Removed event-stream from gulp-header", + "dev": true, + "dependencies": { + "concat-with-sourcemaps": "*", + "lodash.template": "^4.4.0", + "through2": "^2.0.0" + } + }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "deprecated": "this library is no longer supported", + "dev": true, + "dependencies": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "dependencies": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-value/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "dependencies": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-values/node_modules/is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-values/node_modules/is-number/node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-values/node_modules/kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^1.0.1" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/htmlparser2": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", + "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "dev": true, + "dependencies": { + "domelementtype": "^1.3.0", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, + "node_modules/human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true, + "engines": { + "node": ">=8.12.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/import-local": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", + "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-path-rewrite": { + "version": "0.0.1", + "resolved": "git+ssh://git@github.com/gcanti/import-path-rewrite.git#536890c96ad6bd6d347aae08958c8404b8d51e86", + "integrity": "sha512-PtAwJ2v+eVo8iggV16kFtU04w20Al3sp3/A0k9AP4d2GOIH5czbYT0GhKLFOWr5jDfiNm1KffW22KI/RKelWpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^3.0.0", + "fp-ts": "^2.0.0", + "glob": "^7.1.6" + }, + "bin": { + "import-path-rewrite": "lib/bin.js" + } + }, + "node_modules/import-path-rewrite/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/import-path-rewrite/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-path-rewrite/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/import-path-rewrite/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/import-path-rewrite/node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/import-path-rewrite/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-path-rewrite/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/io-ts": { + "version": "2.2.14", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.14.tgz", + "integrity": "sha512-UWL1mdDe5YI4+/7YlrbsSwKmsECFFlWcVHT2CPGzeNODHj2qY0cibjulYfrfz5SCPoDAsjVP7vFKGcF+L10+SQ==", + "dev": true, + "peerDependencies": { + "fp-ts": "^2.0.0" + } + }, + "node_modules/ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dev": true, + "dependencies": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-alphabetical": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.3.tgz", + "integrity": "sha512-eEMa6MKpHFzw38eKm56iNNi6GJ7lf6aLLio7Kr23sJPAECscgRtZvOBYybejWDQ2bM949Y++61PY+udzj5QMLA==", + "dev": true + }, + "node_modules/is-alphanumerical": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.3.tgz", + "integrity": "sha512-A1IGAPO5AW9vSh7omxIlOGwIqEvpW/TA+DksVOPM5ODuxKlZS09+TEM1E3275lJqO2oJ38vDpeAL3DCIiHE6eA==", + "dev": true, + "dependencies": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "node_modules/is-callable": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "dependencies": { + "ci-info": "^2.0.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.3.tgz", + "integrity": "sha512-bvLSwoDg2q6Gf+E2LEPiklHZxxiSi3XAh4Mav65mKqTfCO1HM3uBs24TjEH8iJX3bbDdLXKJXBTmGzuTUuAEjQ==", + "dev": true + }, + "node_modules/is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "dependencies": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-descriptor/node_modules/kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hexadecimal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.3.tgz", + "integrity": "sha512-zxQ9//Q3D/34poZf8fiy3m3XVpbQc7ren15iKqrTtLPwkPD/t3Scy9Imp63FujULGxuK0ZlCwoo5xNpktFgbOA==", + "dev": true + }, + "node_modules/is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dev": true, + "dependencies": { + "is-unc-path": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "node_modules/is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dev": true, + "dependencies": { + "unc-path-regex": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-whitespace-character": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.3.tgz", + "integrity": "sha512-SNPgMLz9JzPccD3nPctcj8sZlX9DAMJSKH8bP7Z6bohCwuNgX8xbWr1eTAYXX9Vpi/aSn8Y1akL9WgM3t43YNQ==", + "dev": true + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-word-character": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.3.tgz", + "integrity": "sha512-0wfcrFgOOOBdgRNT9H33xe6Zi6yhX/uoc4U8NBZGeQQB0ctU1dnlNTyL9JM2646bHDTpsDm1Brb3VPoCIMrd/A==", + "dev": true + }, + "node_modules/is-wsl": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.1.1.tgz", + "integrity": "sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog==", + "dev": true, + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "dependencies": { + "isarray": "1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz", + "integrity": "sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.7.5", + "@babel/parser": "^7.7.5", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", + "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/istanbul-reports": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", + "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest/-/jest-25.2.7.tgz", + "integrity": "sha512-XV1n/CE2McCikl4tfpCY950RytHYvxdo/wvtgmn/qwA8z1s16fuvgFL/KoPrrmkqJTaPMUlLVE58pwiaTX5TdA==", + "dev": true, + "dependencies": { + "@jest/core": "^25.2.7", + "import-local": "^3.0.2", + "jest-cli": "^25.2.7" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-changed-files": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.2.6.tgz", + "integrity": "sha512-F7l2m5n55jFnJj4ItB9XbAlgO+6umgvz/mdK76BfTd2NGkvGf9x96hUXP/15a1K0k14QtVOoutwpRKl360msvg==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "execa": "^3.2.0", + "throat": "^5.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-changed-files/node_modules/cross-spawn": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", + "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/jest-changed-files/node_modules/execa": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", + "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": "^8.12.0 || >=9.7.0" + } + }, + "node_modules/jest-changed-files/node_modules/get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-changed-files/node_modules/is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-changed-files/node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-changed-files/node_modules/p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-changed-files/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-changed-files/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-changed-files/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-config": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.2.7.tgz", + "integrity": "sha512-rIdPPXR6XUxi+7xO4CbmXXkE6YWprvlKc4kg1SrkCL2YV5m/8MkHstq9gBZJ19Qoa3iz/GP+0sTG/PcIwkFojg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^25.2.7", + "@jest/types": "^25.2.6", + "babel-jest": "^25.2.6", + "chalk": "^3.0.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.1", + "jest-environment-jsdom": "^25.2.6", + "jest-environment-node": "^25.2.6", + "jest-get-type": "^25.2.6", + "jest-jasmine2": "^25.2.7", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "micromatch": "^4.0.2", + "pretty-format": "^25.2.6", + "realpath-native": "^2.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-config/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-config/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-config/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-config/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-config/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-config/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-diff": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.2.6.tgz", + "integrity": "sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==", + "dev": true, + "dependencies": { + "chalk": "^3.0.0", + "diff-sequences": "^25.2.6", + "jest-get-type": "^25.2.6", + "pretty-format": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-diff/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-diff/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-diff/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-diff/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-diff/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-diff/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-docblock": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.2.6.tgz", + "integrity": "sha512-VAYrljEq0upq0oERfIaaNf28gC6p9gORndhHstCYF8NWGNQJnzoaU//S475IxfWMk4UjjVmS9rJKLe5Jjjbixw==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-each": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.2.6.tgz", + "integrity": "sha512-OgQ01VINaRD6idWJOhCYwUc5EcgHBiFlJuw+ON2VgYr7HLtMFyCcuo+3mmBvuLUH4QudREZN7cDCZviknzsaJQ==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "jest-get-type": "^25.2.6", + "jest-util": "^25.2.6", + "pretty-format": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-each/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-each/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-each/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-each/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-each/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-each/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-environment-jsdom": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.2.6.tgz", + "integrity": "sha512-/o7MZIhGmLGIEG5j7r5B5Az0umWLCHU+F5crwfbm0BzC4ybHTJZOQTFQWhohBg+kbTCNOuftMcqHlVkVduJCQQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^25.2.6", + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "jsdom": "^15.2.1" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-environment-node": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.2.6.tgz", + "integrity": "sha512-D1Ihj14fxZiMHGeTtU/LunhzSI+UeBvlr/rcXMTNyRMUMSz2PEhuqGbB78brBY6Dk3FhJDk7Ta+8reVaGjLWhA==", + "dev": true, + "dependencies": { + "@jest/environment": "^25.2.6", + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "semver": "^6.3.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-environment-node/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/jest-get-type": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-25.2.6.tgz", + "integrity": "sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==", + "dev": true, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-haste-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7", + "which": "^2.0.2" + }, + "engines": { + "node": ">= 8.3" + }, + "optionalDependencies": { + "fsevents": "^2.1.2" + } + }, + "node_modules/jest-haste-map/node_modules/graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "node_modules/jest-jasmine2": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.2.7.tgz", + "integrity": "sha512-HeQxEbonp8fUvik9jF0lkU9ab1u5TQdIb7YSU9Fj7SxWtqHNDGyCpF6ZZ3r/5yuertxi+R95Ba9eA91GMQ38eA==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.1.0", + "@jest/environment": "^25.2.6", + "@jest/source-map": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "co": "^4.6.0", + "expect": "^25.2.7", + "is-generator-fn": "^2.0.0", + "jest-each": "^25.2.6", + "jest-matcher-utils": "^25.2.7", + "jest-message-util": "^25.2.6", + "jest-runtime": "^25.2.7", + "jest-snapshot": "^25.2.7", + "jest-util": "^25.2.6", + "pretty-format": "^25.2.6", + "throat": "^5.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-jasmine2/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-jasmine2/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-jasmine2/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-jasmine2/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-jasmine2/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-jasmine2/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-leak-detector": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-25.2.6.tgz", + "integrity": "sha512-n+aJUM+j/x1kIaPVxzerMqhAUuqTU1PL5kup46rXh+l9SP8H6LqECT/qD1GrnylE1L463/0StSPkH4fUpkuEjA==", + "dev": true, + "dependencies": { + "jest-get-type": "^25.2.6", + "pretty-format": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-matcher-utils": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-25.2.7.tgz", + "integrity": "sha512-jNYmKQPRyPO3ny0KY1I4f0XW4XnpJ3Nx5ovT4ik0TYDOYzuXJW40axqOyS61l/voWbVT9y9nZ1THL1DlpaBVpA==", + "dev": true, + "dependencies": { + "chalk": "^3.0.0", + "jest-diff": "^25.2.6", + "jest-get-type": "^25.2.6", + "pretty-format": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-matcher-utils/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-matcher-utils/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-matcher-utils/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-matcher-utils/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-matcher-utils/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-matcher-utils/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-message-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-25.2.6.tgz", + "integrity": "sha512-Hgg5HbOssSqOuj+xU1mi7m3Ti2nwSQJQf/kxEkrz2r2rp2ZLO1pMeKkz2WiDUWgSR+APstqz0uMFcE5yc0qdcg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "@jest/types": "^25.2.6", + "@types/stack-utils": "^1.0.1", + "chalk": "^3.0.0", + "micromatch": "^4.0.2", + "slash": "^3.0.0", + "stack-utils": "^1.0.1" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-message-util/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-message-util/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-message-util/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-message-util/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-message-util/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-message-util/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-mock": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-25.2.6.tgz", + "integrity": "sha512-vc4nibavi2RGPdj/MyZy/azuDjZhpYZLvpfgq1fxkhbyTpKVdG7CgmRVKJ7zgLpY5kuMjTzDYA6QnRwhsCU+tA==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", + "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "dev": true, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-resolve": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-25.2.6.tgz", + "integrity": "sha512-7O61GVdcAXkLz/vNGKdF+00A80/fKEAA47AEXVNcZwj75vEjPfZbXDaWFmAQCyXj4oo9y9dC9D+CLA11t8ieGw==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "browser-resolve": "^1.11.3", + "chalk": "^3.0.0", + "jest-pnp-resolver": "^1.2.1", + "realpath-native": "^2.0.0", + "resolve": "^1.15.1" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.2.7.tgz", + "integrity": "sha512-IrnMzCAh11Xd2gAOJL+ThEW6QO8DyqNdvNkQcaCticDrOAr9wtKT7yT6QBFFjqKFgjjvaVKDs59WdgUhgYnHnQ==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-snapshot": "^25.2.7" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-resolve/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-resolve/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-resolve/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-resolve/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-resolve/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-resolve/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runner": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.2.7.tgz", + "integrity": "sha512-RFEr71nMrtNwcpoHzie5+fe1w3JQCGMyT2xzNwKe3f88+bK+frM2o1v24gEcPxQ2QqB3COMCe2+1EkElP+qqqQ==", + "dev": true, + "dependencies": { + "@jest/console": "^25.2.6", + "@jest/environment": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.3", + "jest-config": "^25.2.7", + "jest-docblock": "^25.2.6", + "jest-haste-map": "^25.2.6", + "jest-jasmine2": "^25.2.7", + "jest-leak-detector": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-runtime": "^25.2.7", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "source-map-support": "^0.5.6", + "throat": "^5.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-runner/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-runner/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runner/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-runner/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-runner/node_modules/graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "node_modules/jest-runner/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runner/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.2.7.tgz", + "integrity": "sha512-Gw3X8KxTTFylu2T/iDSNKRUQXQiPIYUY0b66GwVYa7W8wySkUljKhibQHSq0VhmCAN7vRBEQjlVQ+NFGNmQeBw==", + "dev": true, + "dependencies": { + "@jest/console": "^25.2.6", + "@jest/environment": "^25.2.6", + "@jest/source-map": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.3", + "jest-config": "^25.2.7", + "jest-haste-map": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-snapshot": "^25.2.7", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "jest-runtime": "bin/jest-runtime.js" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-runtime/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-runtime/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-runtime/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-runtime/node_modules/graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "node_modules/jest-runtime/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-serializer": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "dev": true, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-snapshot": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-25.2.7.tgz", + "integrity": "sha512-Rm8k7xpGM4tzmYhB6IeRjsOMkXaU8/FOz5XlU6oYwhy53mq6txVNqIKqN1VSiexzpC80oWVxVDfUDt71M6XPOA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0", + "@jest/types": "^25.2.6", + "@types/prettier": "^1.19.0", + "chalk": "^3.0.0", + "expect": "^25.2.7", + "jest-diff": "^25.2.6", + "jest-get-type": "^25.2.6", + "jest-matcher-utils": "^25.2.7", + "jest-message-util": "^25.2.6", + "jest-resolve": "^25.2.6", + "make-dir": "^3.0.0", + "natural-compare": "^1.4.0", + "pretty-format": "^25.2.6", + "semver": "^6.3.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-snapshot/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-snapshot/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-snapshot/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-snapshot/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/jest-snapshot/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-util/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-util/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-util/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-util/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-util/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-util/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-validate": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-25.2.6.tgz", + "integrity": "sha512-a4GN7hYbqQ3Rt9iHsNLFqQz7HDV7KiRPCwPgo5nqtTIWNZw7gnT8KchG+Riwh+UTSn8REjFCodGp50KX/fRNgQ==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "camelcase": "^5.3.1", + "chalk": "^3.0.0", + "jest-get-type": "^25.2.6", + "leven": "^3.1.0", + "pretty-format": "^25.2.6" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-validate/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-validate/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-validate/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-validate/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-validate/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-validate/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-watcher": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-25.2.7.tgz", + "integrity": "sha512-RdHuW+f49tahWtluTnUdZ2iPliebleROI2L/J5phYrUS6DPC9RB3SuUtqYyYhGZJsbvRSuLMIlY/cICJ+PIecw==", + "dev": true, + "dependencies": { + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "jest-util": "^25.2.6", + "string-length": "^3.1.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-watcher/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-watcher/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-watcher/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-watcher/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-watcher/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-watcher/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-worker": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "dev": true, + "dependencies": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest-worker/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest/node_modules/jest-cli": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.2.7.tgz", + "integrity": "sha512-OOAZwY4Jkd3r5WhVM5L3JeLNFaylvHUczMLxQDVLrrVyb1Cy+DNJ6MVsb5TLh6iBklB42m5TOP+IbOgKGGOtMw==", + "dev": true, + "dependencies": { + "@jest/core": "^25.2.7", + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "is-ci": "^2.0.0", + "jest-config": "^25.2.7", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "prompts": "^2.0.1", + "realpath-native": "^2.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/jest/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "node_modules/jsdom": { + "version": "15.2.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", + "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", + "dev": true, + "dependencies": { + "abab": "^2.0.0", + "acorn": "^7.1.0", + "acorn-globals": "^4.3.2", + "array-equal": "^1.0.0", + "cssom": "^0.4.1", + "cssstyle": "^2.0.0", + "data-urls": "^1.1.0", + "domexception": "^1.0.1", + "escodegen": "^1.11.1", + "html-encoding-sniffer": "^1.0.2", + "nwsapi": "^2.2.0", + "parse5": "5.1.0", + "pn": "^1.1.0", + "request": "^2.88.0", + "request-promise-native": "^1.0.7", + "saxes": "^3.1.9", + "symbol-tree": "^3.2.2", + "tough-cookie": "^3.0.1", + "w3c-hr-time": "^1.0.1", + "w3c-xmlserializer": "^1.1.2", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^7.0.0", + "ws": "^7.0.0", + "xml-name-validator": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "node_modules/json5": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/lazy-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", + "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "dev": true, + "dependencies": { + "set-getter": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/list-item": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/list-item/-/list-item-1.1.1.tgz", + "integrity": "sha1-DGXQDih8tmPMs8s4Sad+iewmilY=", + "dev": true, + "dependencies": { + "expand-range": "^1.8.1", + "extend-shallow": "^2.0.1", + "is-number": "^2.1.0", + "repeat-string": "^1.5.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "node_modules/lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true + }, + "node_modules/lodash.template": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", + "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", + "dev": true, + "dependencies": { + "lodash._reinterpolate": "^3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "node_modules/lodash.templatesettings": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", + "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", + "dev": true, + "dependencies": { + "lodash._reinterpolate": "^3.0.0" + } + }, + "node_modules/log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "dependencies": { + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/logging-ts": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/logging-ts/-/logging-ts-0.3.4.tgz", + "integrity": "sha512-TJYaSB88h8N9/ojruoGZgJeQEwpLmDNWpGf03hDgjPNo5QnwO28vkSH/H8/9aMoX8zeShVJUOnKRM6zs5ifR0A==", + "dev": true, + "peerDependencies": { + "fp-ts": "^2.0.5" + } + }, + "node_modules/lolex": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, + "node_modules/makeerror": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "dev": true, + "dependencies": { + "tmpl": "1.0.x" + } + }, + "node_modules/map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "dependencies": { + "object-visit": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/markdown-escapes": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.3.tgz", + "integrity": "sha512-XUi5HJhhV5R74k8/0H2oCbCiYf/u4cO/rX8tnGkRvrqhsr5BRNU6Mg0yt/8UIx1iIS8220BNJsDb7XnILhLepw==", + "dev": true + }, + "node_modules/markdown-link": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/markdown-link/-/markdown-link-0.1.1.tgz", + "integrity": "sha1-MsXGUZmmRXMWMi0eQinRNAfIx88=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/markdown-toc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/markdown-toc/-/markdown-toc-1.2.0.tgz", + "integrity": "sha512-eOsq7EGd3asV0oBfmyqngeEIhrbkc7XVP63OwcJBIhH2EpG2PzFcbZdhy1jutXSlRBBVMNXHvMtSr5LAxSUvUg==", + "dev": true, + "dependencies": { + "concat-stream": "^1.5.2", + "diacritics-map": "^0.1.0", + "gray-matter": "^2.1.0", + "lazy-cache": "^2.0.2", + "list-item": "^1.1.1", + "markdown-link": "^0.1.1", + "minimist": "^1.2.0", + "mixin-deep": "^1.1.3", + "object.pick": "^1.2.0", + "remarkable": "^1.7.1", + "repeat-string": "^1.6.1", + "strip-color": "^0.1.0" + }, + "bin": { + "markdown-toc": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/math-random": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", + "dev": true + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "dev": true, + "dependencies": { + "mime-db": "1.43.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, + "dependencies": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mixin-deep/node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz", + "integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==", + "dev": true, + "dependencies": { + "ansi-colors": "3.2.3", + "browser-stdout": "1.3.1", + "chokidar": "3.3.0", + "debug": "3.2.6", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "find-up": "3.0.0", + "glob": "7.1.3", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", + "minimatch": "3.0.4", + "mkdirp": "0.5.3", + "ms": "2.1.1", + "node-environment-flags": "1.0.6", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "dependencies": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "node_modules/mocha/node_modules/debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/mocha/node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/mocha/node_modules/emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "node_modules/mocha/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/mkdirp": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", + "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "node_modules/mocha/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/mocha/node_modules/wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "dependencies": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "node_modules/mocha/node_modules/yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/multimatch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", + "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", + "dev": true, + "dependencies": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node_modules/node-environment-flags": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "dev": true, + "dependencies": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", + "dev": true + }, + "node_modules/node-modules-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", + "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-notifier": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-6.0.0.tgz", + "integrity": "sha512-SVfQ/wMw+DesunOm5cKqr6yDcvUTDl/yc97ybGHMrteNEY6oekXpNpS3lZwgLlwz0FLgHoiW28ZpmBHUDg37cw==", + "dev": true, + "optional": true, + "dependencies": { + "growly": "^1.3.0", + "is-wsl": "^2.1.1", + "semver": "^6.3.0", + "shellwords": "^0.1.1", + "which": "^1.3.1" + } + }, + "node_modules/node-notifier/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "optional": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/node-notifier/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "optional": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nwsapi": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", + "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", + "dev": true + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "dependencies": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-copy/node_modules/define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "dependencies": { + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-visit/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.getownpropertydescriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.pick/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-each-series": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", + "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-entities": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "dev": true, + "dependencies": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" + } + }, + "node_modules/parse5": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", + "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", + "dev": true + }, + "node_modules/parsimmon": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz", + "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==", + "dev": true + }, + "node_modules/pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", + "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "dev": true, + "dependencies": { + "node-modules-regexp": "^1.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/platform": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.5.tgz", + "integrity": "sha512-TuvHS8AOIZNAlE77WUDiR4rySV/VMptyMfcfeoMgs4P8apaZM3JrnbzBiixKUv+XR6i+BXrQh8WAnjaSPFO65Q==", + "dev": true + }, + "node_modules/pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true + }, + "node_modules/posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz", + "integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/pretty-format": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.2.6.tgz", + "integrity": "sha512-DEiWxLBaCHneffrIT4B+TpMvkV9RNvvJrd3lY9ew1CEQobDzEXmYT1mg0hJhljZty7kCc10z13ohOFAE8jrUDg==", + "dev": true, + "dependencies": { + "@jest/types": "^25.2.6", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^16.12.0" + }, + "engines": { + "node": ">= 8.3" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-format/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/pretty-format/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/prompts": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", + "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", + "dev": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pure-rand": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-2.0.0.tgz", + "integrity": "sha512-mk98aayyd00xbfHgE3uEmAUGzz3jCdm8Mkf5DUXUhc7egmOaGG2D7qhVlynGenNe9VaNJZvzO9hkc8myuTkDgw==", + "dev": true + }, + "node_modules/qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/randomatic": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "dev": true, + "dependencies": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/randomatic/node_modules/is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/randomatic/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, + "node_modules/readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readdirp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "dev": true, + "dependencies": { + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/realpath-native": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-2.0.0.tgz", + "integrity": "sha512-v1SEYUOXXdbBZK8ZuNgO4TBjamPsiSgcFr0aP+tEKpQZK8vooEUqV6nm6Cv502mX4NF2EfsnVqtNAHG+/6Ur1Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "dependencies": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regex-not/node_modules/extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regex-not/node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/remark-frontmatter": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-1.3.2.tgz", + "integrity": "sha512-2eayxITZ8rezsXdgcXnYB3iLivohm2V/ZT4Ne8uhua6A4pk6GdLE2ZzJnbnINtD1HRLaTdB7RwF9sgUbMptJZA==", + "dev": true, + "dependencies": { + "fault": "^1.0.1", + "xtend": "^4.0.1" + } + }, + "node_modules/remark-parse": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", + "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", + "dev": true, + "dependencies": { + "collapse-white-space": "^1.0.2", + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "is-word-character": "^1.0.0", + "markdown-escapes": "^1.0.0", + "parse-entities": "^1.1.0", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "trim": "0.0.1", + "trim-trailing-lines": "^1.0.0", + "unherit": "^1.0.4", + "unist-util-remove-position": "^1.0.0", + "vfile-location": "^2.0.0", + "xtend": "^4.0.1" + } + }, + "node_modules/remarkable": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/remarkable/-/remarkable-1.7.4.tgz", + "integrity": "sha512-e6NKUXgX95whv7IgddywbeN/ItCkWbISmc2DiqHJb0wTrqZIexqdco5b8Z3XZoo/48IdNVKM9ZCvTPJ4F5uvhg==", + "dev": true, + "dependencies": { + "argparse": "^1.0.10", + "autolinker": "~0.28.0" + }, + "bin": { + "remarkable": "bin/remarkable.js" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "node_modules/repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dev": true, + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request-promise-core": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", + "dev": true, + "dependencies": { + "lodash": "^4.17.15" + }, + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "request": "^2.34" + } + }, + "node_modules/request-promise-native": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", + "deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142", + "dev": true, + "dependencies": { + "request-promise-core": "1.1.3", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + }, + "engines": { + "node": ">=0.12.0" + }, + "peerDependencies": { + "request": "^2.34" + } + }, + "node_modules/request-promise-native/node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/request/node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "node_modules/resolve": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", + "dev": true, + "dependencies": { + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "deprecated": "https://github.com/lydell/resolve-url#deprecated", + "dev": true + }, + "node_modules/ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rsvp": { + "version": "4.8.5", + "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", + "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", + "dev": true, + "engines": { + "node": "6.* || >= 7.*" + } + }, + "node_modules/run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "dependencies": { + "ret": "~0.1.10" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/sane": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", + "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", + "deprecated": "some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added", + "dev": true, + "dependencies": { + "@cnakazawa/watch": "^1.0.3", + "anymatch": "^2.0.0", + "capture-exit": "^2.0.0", + "exec-sh": "^0.3.2", + "execa": "^1.0.0", + "fb-watchman": "^2.0.0", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5" + }, + "bin": { + "sane": "src/cli.js" + }, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/sane/node_modules/anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "dependencies": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "node_modules/sane/node_modules/braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "dependencies": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/braces/node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/extend-shallow/node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "dependencies": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/fill-range/node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/is-number/node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "dependencies": { + "remove-trailing-separator": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "dependencies": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/saxes": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", + "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", + "dev": true, + "dependencies": { + "xmlchars": "^2.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "node_modules/set-getter": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", + "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "dev": true, + "dependencies": { + "to-object-path": "^0.3.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, + "dependencies": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "dev": true, + "optional": true + }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "dependencies": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "dependencies": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "dependencies": { + "kind-of": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon/node_modules/define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-resolve": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", + "dev": true, + "dependencies": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", + "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "deprecated": "See https://github.com/lydell/source-map-url#deprecated", + "dev": true + }, + "node_modules/split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "dependencies": { + "extend-shallow": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/split-string/node_modules/extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/split-string/node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "node_modules/sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stack-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", + "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/state-toggle": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.2.tgz", + "integrity": "sha512-8LpelPGR0qQM4PnfLiplOQNJcIN1/r2Gy0xKB2zKnIW2YzPMt2sR4I/+gtPjhN7Svh9kw+zqEg2SFwpBO9iNiw==", + "dev": true + }, + "node_modules/static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "dependencies": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/static-extend/node_modules/define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-length": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz", + "integrity": "sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA==", + "dev": true, + "dependencies": { + "astral-regex": "^1.0.0", + "strip-ansi": "^5.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-length/node_modules/ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/string-length/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz", + "integrity": "sha512-EEJnGqa/xNfIg05SxiPSqRS7S9qwDhYts1TSLR1BQfYUfPe1stofgGKvwERK9+9yf+PpfBMlpBaCHucXGPQfUA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimleft": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", + "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimstart": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimright": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", + "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimend": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.0.tgz", + "integrity": "sha512-iCP8g01NFYiiBOnwG1Xc3WZLyoo+RuBymwIlWncShXDDJYWN6DbnM3odslBJdgCdRlq94B5s63NWAZlcn2CS4w==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-color": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/strip-color/-/strip-color-0.1.0.tgz", + "integrity": "sha1-EG9l09PmotlAHKwOsM6LinArT3s=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/structured-source": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-3.0.2.tgz", + "integrity": "sha1-3YAkJeD1PcSm56yjdSkBoczaevU=", + "dev": true, + "dependencies": { + "boundary": "^1.0.1" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-hyperlinks": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz", + "integrity": "sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true + }, + "node_modules/table": { + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "dev": true, + "dependencies": { + "ajv": "^7.0.2", + "lodash": "^4.17.20", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table/node_modules/ajv": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz", + "integrity": "sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/table/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/table/node_modules/lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "node_modules/terminal-link": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", + "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.2.1", + "supports-hyperlinks": "^2.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "node_modules/throat": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz", + "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", + "dev": true + }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/tmpl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "dependencies": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/to-regex-range/node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/to-regex/node_modules/extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex/node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/toml": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/toml/-/toml-2.3.6.tgz", + "integrity": "sha512-gVweAectJU3ebq//Ferr2JUY4WKSDe5N+z0FvjDncLGyHmIDoxgY/2Ie4qfEIDm4IS7OA6Rmdm7pdEEdMcV/xQ==", + "dev": true + }, + "node_modules/tough-cookie": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", + "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", + "dev": true, + "dependencies": { + "ip-regex": "^2.1.0", + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/traverse": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", + "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=", + "dev": true + }, + "node_modules/trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", + "dev": true + }, + "node_modules/trim-trailing-lines": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.2.tgz", + "integrity": "sha512-MUjYItdrqqj2zpcHFTkMa9WAv4JHTI6gnRQGPFLrt5L9a6tRMiDnIqYl8JBvu2d2Tc3lWJKQwlGCp0K8AvCM+Q==", + "dev": true + }, + "node_modules/trough": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.4.tgz", + "integrity": "sha512-tdzBRDGWcI1OpPVmChbdSKhvSVurznZ8X36AYURAcl+0o2ldlCY2XPzyXNNxwJwwyIU+rIglTCG4kxtNKBQH7Q==", + "dev": true + }, + "node_modules/ts-jest": { + "version": "25.3.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.3.1.tgz", + "integrity": "sha512-O53FtKguoMUByalAJW+NWEv7c4tus5ckmhfa7/V0jBb2z8v5rDSLFC1Ate7wLknYPC1euuhY6eJjQq4FtOZrkg==", + "dev": true, + "dependencies": { + "bs-logger": "0.x", + "buffer-from": "1.x", + "fast-json-stable-stringify": "2.x", + "json5": "2.x", + "lodash.memoize": "4.x", + "make-error": "1.x", + "micromatch": "4.x", + "mkdirp": "1.x", + "resolve": "1.x", + "semver": "6.x", + "yargs-parser": "18.x" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": ">= 8" + }, + "peerDependencies": { + "jest": ">=25 <26" + } + }, + "node_modules/ts-jest/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/ts-morph": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-9.1.0.tgz", + "integrity": "sha512-sei4u651MBenr27sD6qLDXN3gZ4thiX71E3qV7SuVtDas0uvK2LtgZkIYUf9DKm/fLJ6AB/+yhRJ1vpEBJgy7Q==", + "dev": true, + "dependencies": { + "@dsherret/to-absolute-glob": "^2.0.2", + "@ts-morph/common": "~0.7.0", + "code-block-writer": "^10.1.1" + } + }, + "node_modules/ts-node": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz", + "integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==", + "dev": true, + "dependencies": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=6.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/tslib": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", + "dev": true + }, + "node_modules/tslint": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.1.tgz", + "integrity": "sha512-kd6AQ/IgPRpLn6g5TozqzPdGNZ0q0jtXW4//hRcj10qLYBaa3mTUU2y2MCG+RXZm8Zx+KZi0eA+YCrMyNlF4UA==", + "deprecated": "TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.3", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.10.0", + "tsutils": "^2.29.0" + }, + "bin": { + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + } + }, + "node_modules/tslint-config-standard": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/tslint-config-standard/-/tslint-config-standard-9.0.0.tgz", + "integrity": "sha512-CAw9J743RnPMemQV/XQ4YyNreC+A1NItACfkm+cBedrOkz6CQfwlnbKn8anUXBfoa4Zo4tjAhblRbsMNcSLfSw==", + "deprecated": "TSLint is deprecated, please move to ESLint: https://github.com/blakeembrey/tslint-config-standard/issues/61", + "dev": true, + "dependencies": { + "tslint-eslint-rules": "^5.3.1" + } + }, + "node_modules/tslint-config-standard/node_modules/doctrine": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", + "integrity": "sha512-qiB/Rir6Un6Ad/TIgTRzsremsTGWzs8j7woXvp14jgq00676uBiBT5eUOi+FgRywZFVy5Us/c04ISRpZhRbS6w==", + "dev": true, + "dependencies": { + "esutils": "^1.1.6", + "isarray": "0.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tslint-config-standard/node_modules/esutils": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", + "integrity": "sha512-RG1ZkUT7iFJG9LSHr7KDuuMSlujfeTtMNIcInURxKAxhMtwQhI3NrQhz26gZQYlsYZQKzsnwtpKrFKj9K9Qu1A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tslint-config-standard/node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "dev": true + }, + "node_modules/tslint-config-standard/node_modules/tslib": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "dev": true + }, + "node_modules/tslint-config-standard/node_modules/tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "bin": { + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + } + }, + "node_modules/tslint-config-standard/node_modules/tslint-eslint-rules": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz", + "integrity": "sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==", + "dev": true, + "dependencies": { + "doctrine": "0.7.2", + "tslib": "1.9.0", + "tsutils": "^3.0.0" + }, + "peerDependencies": { + "tslint": "^5.0.0", + "typescript": "^2.2.0 || ^3.0.0" + } + }, + "node_modules/tslint-config-standard/node_modules/tslint-eslint-rules/node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tslint-config-standard/node_modules/typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", + "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unherit": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.2.tgz", + "integrity": "sha512-W3tMnpaMG7ZY6xe/moK04U9fBhi6wEiCYHUW5Mop/wQHf12+79EQGwxYejNdhEz2mkqkBlGwm7pxmgBKMVUj0w==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "xtend": "^4.0.1" + } + }, + "node_modules/unified": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", + "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "dev": true, + "dependencies": { + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^1.1.0", + "trough": "^1.0.0", + "vfile": "^2.0.0", + "x-is-string": "^0.1.0" + } + }, + "node_modules/union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, + "dependencies": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unist-util-is": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", + "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", + "dev": true + }, + "node_modules/unist-util-remove-position": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.3.tgz", + "integrity": "sha512-CtszTlOjP2sBGYc2zcKA/CvNdTdEs3ozbiJ63IPBxh8iZg42SCCb8m04f8z2+V1aSk5a7BxbZKEdoDjadmBkWA==", + "dev": true, + "dependencies": { + "unist-util-visit": "^1.1.0" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", + "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", + "dev": true + }, + "node_modules/unist-util-visit": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", + "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "dev": true, + "dependencies": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", + "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", + "dev": true, + "dependencies": { + "unist-util-is": "^3.0.0" + } + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "dependencies": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unset-value/node_modules/has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "dependencies": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unset-value/node_modules/has-value/node_modules/isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "dependencies": { + "isarray": "1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unset-value/node_modules/has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unset-value/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/update-section": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/update-section/-/update-section-0.3.3.tgz", + "integrity": "sha1-RY8Xgg03gg3GDiC4bZQ5GwASMVg=", + "dev": true + }, + "node_modules/uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "deprecated": "Please see https://github.com/lydell/urix#deprecated", + "dev": true + }, + "node_modules/use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", + "dev": true + }, + "node_modules/v8-to-istanbul": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz", + "integrity": "sha512-sAjOC+Kki6aJVbUOXJbcR0MnbfjvBzwKZazEJymA2IX49uoOdEdk+4fBq5cXgYgiyKtAyrrJNtBZdOeDIF+Fng==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": "8.x.x || >=10.10.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/vfile": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", + "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", + "dev": true, + "dependencies": { + "is-buffer": "^1.1.4", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + } + }, + "node_modules/vfile-location": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.5.tgz", + "integrity": "sha512-Pa1ey0OzYBkLPxPZI3d9E+S4BmvfVwNAAXrrqGbwTVXWaX2p9kM1zZ+n35UtVM06shmWKH4RPRN8KI80qE3wNQ==", + "dev": true + }, + "node_modules/vfile-message": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", + "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", + "dev": true, + "dependencies": { + "unist-util-stringify-position": "^1.1.1" + } + }, + "node_modules/w3c-hr-time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", + "dev": true, + "dependencies": { + "browser-process-hrtime": "^1.0.0" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", + "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", + "dev": true, + "dependencies": { + "domexception": "^1.0.1", + "webidl-conversions": "^4.0.2", + "xml-name-validator": "^3.0.0" + } + }, + "node_modules/walker": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "dev": true, + "dependencies": { + "makeerror": "1.0.x" + } + }, + "node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "node_modules/whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", + "dev": true, + "dependencies": { + "iconv-lite": "0.4.24" + } + }, + "node_modules/whatwg-mimetype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dev": true, + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/wide-align/node_modules/ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/ws": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=", + "dev": true + }, + "node_modules/xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true + }, + "node_modules/xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", + "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==", + "dev": true, + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.2.tgz", + "integrity": "sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "dev": true, + "dependencies": { + "flat": "^4.1.0", + "lodash": "^4.17.15", + "yargs": "^13.3.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "dependencies": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "node_modules/yargs-unparser/node_modules/emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "node_modules/yargs-unparser/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/yargs-unparser/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/yargs-unparser/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs-unparser/node_modules/yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "dependencies": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "node_modules/yargs-unparser/node_modules/yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + }, "dependencies": { "@babel/code-frame": { "version": "7.8.3", @@ -1326,7 +12336,8 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", - "dev": true + "dev": true, + "requires": {} }, "acorn-walk": { "version": "6.2.0", @@ -2449,9 +13460,9 @@ } }, "dtslint": { - "version": "github:gcanti/dtslint#2c3c3487e7650d6ca90c2877dbbd7c4c08360d0d", - "from": "github:gcanti/dtslint", + "version": "git+ssh://git@github.com/gcanti/dtslint.git#f361dc93d6a195f530df28779082548e01cecd5e", "dev": true, + "from": "dtslint@gcanti/dtslint", "requires": { "fs-extra": "^6.0.1", "parsimmon": "^1.12.0", @@ -2491,12 +13502,6 @@ "tslib": "^1.8.0", "tsutils": "^2.29.0" } - }, - "typescript": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", - "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", - "dev": true } } }, @@ -3632,9 +14637,10 @@ } }, "import-path-rewrite": { - "version": "github:gcanti/import-path-rewrite#536890c96ad6bd6d347aae08958c8404b8d51e86", - "from": "github:gcanti/import-path-rewrite", + "version": "git+ssh://git@github.com/gcanti/import-path-rewrite.git#536890c96ad6bd6d347aae08958c8404b8d51e86", + "integrity": "sha512-PtAwJ2v+eVo8iggV16kFtU04w20Al3sp3/A0k9AP4d2GOIH5czbYT0GhKLFOWr5jDfiNm1KffW22KI/RKelWpg==", "dev": true, + "from": "import-path-rewrite@github:gcanti/import-path-rewrite", "requires": { "chalk": "^3.0.0", "fp-ts": "^2.0.0", @@ -3733,7 +14739,8 @@ "version": "2.2.14", "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.14.tgz", "integrity": "sha512-UWL1mdDe5YI4+/7YlrbsSwKmsECFFlWcVHT2CPGzeNODHj2qY0cibjulYfrfz5SCPoDAsjVP7vFKGcF+L10+SQ==", - "dev": true + "dev": true, + "requires": {} }, "ip-regex": { "version": "2.1.0", @@ -4812,7 +15819,8 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==", - "dev": true + "dev": true, + "requires": {} }, "jest-regex-util": { "version": "25.2.6", @@ -5615,7 +16623,8 @@ "version": "0.3.4", "resolved": "https://registry.npmjs.org/logging-ts/-/logging-ts-0.3.4.tgz", "integrity": "sha512-TJYaSB88h8N9/ojruoGZgJeQEwpLmDNWpGf03hDgjPNo5QnwO28vkSH/H8/9aMoX8zeShVJUOnKRM6zs5ifR0A==", - "dev": true + "dev": true, + "requires": {} }, "lolex": { "version": "5.1.2", @@ -7439,6 +18448,15 @@ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", "dev": true }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, "string-length": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz", @@ -7527,15 +18545,6 @@ "es-abstract": "^1.17.5" } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", @@ -7919,23 +18928,12 @@ "dev": true, "requires": { "tslint-eslint-rules": "^5.3.1" - } - }, - "tslint-eslint-rules": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz", - "integrity": "sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==", - "dev": true, - "requires": { - "doctrine": "0.7.2", - "tslib": "1.9.0", - "tsutils": "^3.0.0" }, "dependencies": { "doctrine": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", - "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", + "integrity": "sha512-qiB/Rir6Un6Ad/TIgTRzsremsTGWzs8j7woXvp14jgq00676uBiBT5eUOi+FgRywZFVy5Us/c04ISRpZhRbS6w==", "dev": true, "requires": { "esutils": "^1.1.6", @@ -7945,13 +18943,13 @@ "esutils": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", - "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", + "integrity": "sha512-RG1ZkUT7iFJG9LSHr7KDuuMSlujfeTtMNIcInURxKAxhMtwQhI3NrQhz26gZQYlsYZQKzsnwtpKrFKj9K9Qu1A==", "dev": true }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", "dev": true }, "tslib": { @@ -7960,14 +18958,56 @@ "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", "dev": true }, - "tsutils": { - "version": "3.17.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", - "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "dev": true, + "peer": true, "requires": { - "tslib": "^1.8.1" + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + }, + "tslint-eslint-rules": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz", + "integrity": "sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==", + "dev": true, + "requires": { + "doctrine": "0.7.2", + "tslib": "1.9.0", + "tsutils": "^3.0.0" + }, + "dependencies": { + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } } + }, + "typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "dev": true, + "peer": true } } }, @@ -8032,9 +19072,9 @@ } }, "typescript": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", - "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", + "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "dev": true }, "unc-path-regex": { @@ -8456,7 +19496,8 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", - "dev": true + "dev": true, + "requires": {} }, "x-is-string": { "version": "0.1.0", diff --git a/package.json b/package.json index a08782657..a6a8108ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.17", + "version": "2.2.18", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", @@ -37,7 +37,6 @@ "url": "https://github.com/gcanti/io-ts/issues" }, "homepage": "https://github.com/gcanti/io-ts", - "dependencies": {}, "peerDependencies": { "fp-ts": "^2.5.0" }, @@ -64,7 +63,7 @@ "ts-node": "8.8.2", "tslint": "6.1.1", "tslint-config-standard": "9.0.0", - "typescript": "^4.6.2" + "typescript": "^4.8.2" }, "tags": [ "typescript", diff --git a/src/Codec.ts b/src/Codec.ts index fe43c2aa5..9465e02e7 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -13,7 +13,7 @@ import { Invariant3 } from 'fp-ts/lib/Invariant' import { pipe } from 'fp-ts/lib/pipeable' import * as D from './Decoder' import * as E from './Encoder' -import { Literal } from './Schemable' +import * as S from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -60,7 +60,7 @@ export function fromDecoder(decoder: D.Decoder): Codec { * @category constructors * @since 2.2.3 */ -export function literal]>( +export function literal], L extends S.Literal = S.Literal>( ...values: A ): Codec { return fromDecoder(D.literal(...values)) diff --git a/src/DecodeError.ts b/src/DecodeError.ts index dac974485..07e8b5046 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -25,12 +25,14 @@ export interface Leaf { * @category model * @since 2.2.7 */ +// eslint-disable-next-line @typescript-eslint/prefer-as-const export const required: 'required' = 'required' /** * @category model * @since 2.2.7 */ +// eslint-disable-next-line @typescript-eslint/prefer-as-const export const optional: 'optional' = 'optional' /** diff --git a/src/Decoder.ts b/src/Decoder.ts index f98ff1d23..702cc9bba 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -128,7 +128,7 @@ export const fromGuard = (guard: G.Guard, expected: string * @category constructors * @since 2.2.7 */ -export const literal: ]>( +export const literal: ], L extends S.Literal = S.Literal>( ...values: A ) => Decoder = /*#__PURE__*/ @@ -579,15 +579,18 @@ const toForest = (e: DecodeError): ReadonlyArray> => { const stack = [] let focus = e const res = [] + // eslint-disable-next-line no-constant-condition while (true) { switch (focus._tag) { case 'Of': - res.push(toTree(focus.value)) - const tmp = stack.pop() - if (tmp === undefined) { - return res - } else { - focus = tmp + { + res.push(toTree(focus.value)) + const tmp = stack.pop() + if (tmp === undefined) { + return res + } else { + focus = tmp + } } break case 'Concat': diff --git a/src/Eq.ts b/src/Eq.ts index 61df119f0..67015156f 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -114,7 +114,7 @@ export function partial(properties: { [K in keyof A]: Eq }): Eq( ): (members: { [K in keyof A]: Eq> }) => Eq { return (members: Record>) => { return { - equals: (x: Record, y: Record) => { + equals: (x: any, y: any) => { const vx = x[tag] const vy = y[tag] if (vx !== vy) { diff --git a/src/Guard.ts b/src/Guard.ts index 16bc2474a..d189660fd 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -10,7 +10,7 @@ */ import { identity, Refinement } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' -import { Literal, memoize, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' +import * as S from './Schemable' // ------------------------------------------------------------------------------------- // model @@ -46,7 +46,9 @@ export type InputOf = G extends Guard ? I : never * @category constructors * @since 2.2.0 */ -export const literal = ]>(...values: A): Guard => ({ +export const literal = ], L extends S.Literal = S.Literal>( + ...values: A +): Guard => ({ is: (u: unknown): u is A[number] => values.findIndex((a) => a === u) !== -1 }) @@ -246,7 +248,7 @@ export const sum = (tag: T) => ( * @since 2.2.0 */ export const lazy = (f: () => Guard): Guard => { - const get = memoize>(f) + const get = S.memoize>(f) return { is: (u: unknown): u is A => get().is(u) } @@ -316,7 +318,7 @@ declare module 'fp-ts/lib/HKT' { * @category instances * @since 2.2.8 */ -export const Schemable: Schemable1 = { +export const Schemable: S.Schemable1 = { URI, literal, string, @@ -328,7 +330,7 @@ export const Schemable: Schemable1 = { partial, record, array, - tuple: tuple as Schemable1['tuple'], + tuple: tuple as S.Schemable1['tuple'], intersect, sum, lazy: (_, f) => lazy(f), @@ -339,7 +341,7 @@ export const Schemable: Schemable1 = { * @category instances * @since 2.2.8 */ -export const WithUnknownContainers: WithUnknownContainers1 = { +export const WithUnknownContainers: S.WithUnknownContainers1 = { UnknownArray, UnknownRecord } @@ -348,14 +350,14 @@ export const WithUnknownContainers: WithUnknownContainers1 = { * @category instances * @since 2.2.8 */ -export const WithUnion: WithUnion1 = { - union: union as WithUnion1['union'] +export const WithUnion: S.WithUnion1 = { + union: union as S.WithUnion1['union'] } /** * @category instances * @since 2.2.8 */ -export const WithRefine: WithRefine1 = { - refine: refine as WithRefine1['refine'] +export const WithRefine: S.WithRefine1 = { + refine: refine as S.WithRefine1['refine'] } diff --git a/src/Kleisli.ts b/src/Kleisli.ts index 6ea53b58b..b6cba277f 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -18,7 +18,7 @@ import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import * as G from './Guard' -import { intersect_, Literal, memoize } from './Schemable' +import * as S from './Schemable' import { Lazy, Refinement } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- @@ -56,9 +56,11 @@ export function fromRefinement( export function literal( M: MonadThrow2C ): ( - onError: (i: I, values: readonly [Literal, ...Array]) => E -) => ]>(...values: A) => Kleisli { - return (onError) => ]>(...values: A) => ({ + onError: (i: I, values: readonly [S.Literal, ...ReadonlyArray]) => E +) => ], L extends S.Literal = S.Literal>( + ...values: A +) => Kleisli { + return (onError) => ]>(...values: A) => ({ decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) }) } @@ -271,7 +273,7 @@ export function intersect( ): Kleisli => ({ decode: (i) => M.ap( - M.map(left.decode(i), (a: A) => (b: B) => intersect_(a, b)), + M.map(left.decode(i), (a: A) => (b: B) => S.intersect_(a, b)), right.decode(i) ) }) @@ -317,7 +319,7 @@ export function lazy( id: string, f: () => Kleisli ): Kleisli => { - const get = memoize>(f) + const get = S.memoize>(f) return { decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) } diff --git a/src/Schemable.ts b/src/Schemable.ts index 4178108f0..1eda7c3c5 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -21,7 +21,9 @@ export type Literal = string | number | boolean | null */ export interface Schemable { readonly URI: S - readonly literal: ]>(...values: A) => HKT + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => HKT readonly string: HKT readonly number: HKT readonly boolean: HKT @@ -46,7 +48,9 @@ export interface Schemable { */ export interface Schemable1 { readonly URI: S - readonly literal: ]>(...values: A) => Kind + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind readonly string: Kind readonly number: Kind readonly boolean: Kind @@ -71,7 +75,9 @@ export interface Schemable1 { */ export interface Schemable2C { readonly URI: S - readonly literal: ]>(...values: A) => Kind2 + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind2 readonly string: Kind2 readonly number: Kind2 readonly boolean: Kind2 diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 8ae798cad..0af1501a1 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -129,7 +129,7 @@ export const fromGuard = (guard: G.Guard, expected: string * @category constructors * @since 2.2.7 */ -export const literal: ]>( +export const literal: ], L extends S.Literal = S.Literal>( ...values: A ) => TaskDecoder = /*#__PURE__*/ diff --git a/src/Type.ts b/src/Type.ts index 187d334c3..26ab3f20d 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -32,8 +32,9 @@ export interface Type extends t.Type {} * @category constructors * @since 2.2.3 */ -export const literal = ]>(...values: A): Type => - t.union(values.map((v) => t.literal(v as any)) as any) +export const literal = ], L extends S.Literal = S.Literal>( + ...values: A +): Type => t.union(values.map((v) => t.literal(v as any)) as any) // ------------------------------------------------------------------------------------- // primitives diff --git a/src/index.ts b/src/index.ts index 33b81e21e..cca466825 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2450,42 +2450,15 @@ export type Exact = T & */ export function alias( codec: PartialType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => PartialType +): () => PartialType export function alias( // tslint:disable-next-line: deprecation codec: StrictType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => // tslint:disable-next-line: deprecation +): () => // tslint:disable-next-line: deprecation StrictType export function alias( codec: InterfaceType -): < - // tslint:disable-next-line: deprecation - AA extends Exact, - // tslint:disable-next-line: deprecation - OO extends Exact = O, - // tslint:disable-next-line: deprecation - PP extends Exact = P, - II extends I = I ->() => InterfaceType -export function alias( - codec: Type -): // tslint:disable-next-line: deprecation -, OO extends Exact = O>() => Type { +): () => InterfaceType +export function alias(codec: Type): () => Type { return () => codec as any } diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 9587552ad..0eccbfa9c 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -15,7 +15,9 @@ export interface Arbitrary extends fc.Arbitrary {} // constructors // ------------------------------------------------------------------------------------- -export function literal]>(...values: A): Arbitrary { +export function literal], L extends S.Literal = S.Literal>( + ...values: A +): Arbitrary { return fc.oneof(...values.map((v) => fc.constant(v))) } diff --git a/test/Decoder.ts b/test/Decoder.ts index 422d1041a..a7e82449b 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -582,9 +582,9 @@ required property "d" assert.deepStrictEqual( pipe(lazyDecoder.decode({ a: '1', b: {} }), E.mapLeft(_.draw)), E.left(`lazy type A -└─ optional property \"b\" +└─ optional property "b" └─ lazy type A - └─ required property \"a\" + └─ required property "a" └─ cannot decode undefined, should be string`) ) }) diff --git a/test/JsonSchema.ts b/test/JsonSchema.ts index 99be4dc9f..7a1e8e3e6 100644 --- a/test/JsonSchema.ts +++ b/test/JsonSchema.ts @@ -17,7 +17,7 @@ export interface JsonSchema { // constructors // ------------------------------------------------------------------------------------- -export function literal]>( +export function literal], L extends S.Literal = S.Literal>( ...values: A ): JsonSchema { return { @@ -144,7 +144,7 @@ export function lazy(id: string, f: () => JsonSchema): JsonSchema { return { compile: (definitions) => { if (definitions !== undefined) { - if (definitions.hasOwnProperty(id)) { + if (Object.prototype.hasOwnProperty.call(definitions, id)) { return C.make({ $ref }) } definitions[id] = undefined diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index da48f05e2..a944df232 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -608,9 +608,9 @@ required property "d" assert.deepStrictEqual( await pipe(lazyDecoder.decode({ a: '1', b: {} }), TE.mapLeft(_.draw))(), E.left(`lazy type A -└─ optional property \"b\" +└─ optional property "b" └─ lazy type A - └─ required property \"a\" + └─ required property "a" └─ cannot decode undefined, should be string`) ) }) From 7069ed04e04ca046d699ba4cf01b75c1515c6635 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Wed, 31 Aug 2022 23:37:46 +0800 Subject: [PATCH 207/222] docs: remove david-dm.org from README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 43cf5bc4a..8c4272a56 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ [![build status](https://img.shields.io/travis/gcanti/io-ts/master.svg?style=flat-square)](https://travis-ci.org/gcanti/io-ts) -[![dependency status](https://img.shields.io/david/gcanti/io-ts.svg?style=flat-square)](https://david-dm.org/gcanti/io-ts) ![npm downloads](https://img.shields.io/npm/dm/io-ts.svg) From 4edbeb35f2c808156b31bb11aaf6a0cb783e8963 Mon Sep 17 00:00:00 2001 From: Malte Legenhausen Date: Thu, 6 Oct 2022 10:01:01 +0200 Subject: [PATCH 208/222] Object.prototype.toString removed from UnknownRecord.is --- src/index.ts | 5 +---- test/2.1.x/default-types.ts | 4 ++-- test/2.1.x/record.ts | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index cca466825..2434a6830 100644 --- a/src/index.ts +++ b/src/index.ts @@ -992,10 +992,7 @@ export class AnyDictionaryType extends Type<{ [key: string]: unknown }> { constructor() { super( 'UnknownRecord', - (u): u is { [key: string]: unknown } => { - const s = Object.prototype.toString.call(u) - return s === '[object Object]' || s === '[object Window]' - }, + (u): u is { [key: string]: unknown } => u !== null && typeof u === 'object' && !Array.isArray(u), (u, c) => (this.is(u) ? success(u) : failure(u, c)), identity ) diff --git a/test/2.1.x/default-types.ts b/test/2.1.x/default-types.ts index 251205329..4e7c1f1c1 100644 --- a/test/2.1.x/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -8,12 +8,12 @@ describe('UnknownRecord', () => { const T = t.UnknownRecord assert.strictEqual(T.is({}), true) assert.strictEqual(T.is({ a: 1 }), true) + assert.strictEqual(T.is(new Number()), true) }) it('should return `false` for invalid objects', () => { const T = t.UnknownRecord assert.strictEqual(T.is(undefined), false) - assert.strictEqual(T.is(new Number()), false) // #407 assert.strictEqual(T.is([]), false) }) @@ -24,6 +24,7 @@ describe('UnknownRecord', () => { const T = t.UnknownRecord assertSuccess(T.decode({})) assertSuccess(T.decode({ a: 1 })) + assertSuccess(T.decode(new Number())) }) it('should fail validating an invalid value', () => { @@ -33,7 +34,6 @@ describe('UnknownRecord', () => { assertFailure(T, true, ['Invalid value true supplied to : UnknownRecord']) assertFailure(T, null, ['Invalid value null supplied to : UnknownRecord']) assertFailure(T, undefined, ['Invalid value undefined supplied to : UnknownRecord']) - assertFailure(T, new Number(), ['Invalid value 0 supplied to : UnknownRecord']) // #407 assertFailure(T, [], ['Invalid value [] supplied to : UnknownRecord']) }) diff --git a/test/2.1.x/record.ts b/test/2.1.x/record.ts index e03581cc9..c04025130 100644 --- a/test/2.1.x/record.ts +++ b/test/2.1.x/record.ts @@ -28,6 +28,7 @@ describe('record', () => { const T1 = t.record(t.string, t.number) assert.strictEqual(T1.is({}), true) assert.strictEqual(T1.is({ a: 1 }), true) + assert.strictEqual(T1.is(new Number()), true) const T2 = t.record(t.string, NumberFromString) assert.strictEqual(T2.is({}), true) @@ -42,7 +43,6 @@ describe('record', () => { const T1 = t.record(t.string, t.number) assert.strictEqual(T1.is({ a: 'a' }), false) assert.strictEqual(T1.is(null), false) - assert.strictEqual(T1.is(new Number()), false) // #407 assert.strictEqual(T1.is([]), false) @@ -73,6 +73,7 @@ describe('record', () => { const T = t.record(t.string, t.number) assertSuccess(T.decode({})) assertSuccess(T.decode({ a: 1 })) + assertSuccess(T.decode(new Number())) }) it('should return the same reference while decoding isomorphic values', () => { @@ -106,7 +107,6 @@ describe('record', () => { const T1 = t.record(t.string, t.number) assertFailure(T1, 1, ['Invalid value 1 supplied to : { [K in string]: number }']) assertFailure(T1, { aa: 's' }, ['Invalid value "s" supplied to : { [K in string]: number }/aa: number']) - assertFailure(T1, new Number(), ['Invalid value 0 supplied to : { [K in string]: number }']) // #407 assertFailure(T1, [], ['Invalid value [] supplied to : { [K in string]: number }']) // #407 From e619fb1a769afb0dde3b17f4fc3ae28caa004466 Mon Sep 17 00:00:00 2001 From: gcanti Date: Thu, 6 Oct 2022 14:19:00 +0200 Subject: [PATCH 209/222] version 2.2.19 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 496e1cc4b..4a71d0217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.19 + +- **Bug Fix** + - allow `Error` to be decoded with `UnknownRecord`, #664 (@mlegenhausen) + # 2.2.18 - **Bug Fix** diff --git a/package.json b/package.json index a6a8108ba..8f799159f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.18", + "version": "2.2.19", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", From e508b89448c0a4354b318774b0f2b83424a10429 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 3 Dec 2022 03:32:11 +0100 Subject: [PATCH 210/222] - undeprecate `FunctionType`, `FunctionC`, `Function` --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/index.ts | 13 ++++--------- test/2.1.x/default-types.ts | 2 -- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a71d0217..4e2fb3d3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.20 + +- undeprecate `FunctionType`, `FunctionC`, `Function` + # 2.2.19 - **Bug Fix** diff --git a/package.json b/package.json index 8f799159f..177f04bf8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.19", + "version": "2.2.20", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", diff --git a/src/index.ts b/src/index.ts index 2434a6830..5827cae91 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1976,13 +1976,8 @@ export function exact(codec: C, name: string = getExactTypeN ) } -// ------------------------------------------------------------------------------------- -// deprecated -// ------------------------------------------------------------------------------------- - /** * @since 1.0.0 - * @deprecated */ export class FunctionType extends Type { /** @@ -2002,19 +1997,19 @@ export class FunctionType extends Type { /** * @since 1.5.3 - * @deprecated */ -// tslint:disable-next-line: deprecation export interface FunctionC extends FunctionType {} /** * @category primitives * @since 1.0.0 - * @deprecated */ -// tslint:disable-next-line: deprecation export const Function: FunctionC = new FunctionType() +// ------------------------------------------------------------------------------------- +// deprecated +// ------------------------------------------------------------------------------------- + /** * @since 1.3.0 * @deprecated diff --git a/test/2.1.x/default-types.ts b/test/2.1.x/default-types.ts index 4e7c1f1c1..808107073 100644 --- a/test/2.1.x/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -186,12 +186,10 @@ describe('object', () => { describe('Function', () => { it('should decode functions', () => { - // tslint:disable-next-line: deprecation assertSuccess(t.Function.decode(t.identity)) }) it('should not decode non-functions', () => { - // tslint:disable-next-line: deprecation const T = t.Function assertFailure(T, 1, ['Invalid value 1 supplied to : Function']) }) From e312a81c795d2ef79e429b5af23668930da5f252 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 3 Dec 2022 03:34:54 +0100 Subject: [PATCH 211/222] - undeprecate `NeverType`, `NeverC`, `never` --- CHANGELOG.md | 1 + src/index.ts | 69 +++++++++++++++++-------------------- test/2.1.x/default-types.ts | 10 ------ 3 files changed, 33 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e2fb3d3f..05054e8f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ # 2.2.20 - undeprecate `FunctionType`, `FunctionC`, `Function` +- undeprecate `NeverType`, `NeverC`, `never` # 2.2.19 diff --git a/src/index.ts b/src/index.ts index 5827cae91..e9c9bd933 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2006,6 +2006,38 @@ export interface FunctionC extends FunctionType {} */ export const Function: FunctionC = new FunctionType() +/** + * @since 1.0.0 + */ +export class NeverType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'NeverType' = 'NeverType' + constructor() { + super( + 'never', + (_): _ is never => false, + (u, c) => failure(u, c), + /* istanbul ignore next */ + () => { + throw new Error('cannot encode never') + } + ) + } +} + +/** + * @since 1.5.3 + */ +export interface NeverC extends NeverType {} + +/** + * @category primitives + * @since 1.0.0 + */ +export const never: NeverC = new NeverType() + // ------------------------------------------------------------------------------------- // deprecated // ------------------------------------------------------------------------------------- @@ -2114,43 +2146,6 @@ export const getDefaultContext /* istanbul ignore next */ = (decoder: Decoder { - /** - * @since 1.0.0 - */ - readonly _tag: 'NeverType' = 'NeverType' - constructor() { - super( - 'never', - (_): _ is never => false, - (u, c) => failure(u, c), - /* istanbul ignore next */ - () => { - throw new Error('cannot encode never') - } - ) - } -} - -/** - * @since 1.5.3 - * @deprecated - */ -// tslint:disable-next-line: deprecation -export interface NeverC extends NeverType {} - -/** - * @category primitives - * @since 1.0.0 - * @deprecated - */ -// tslint:disable-next-line: deprecation -export const never: NeverC = new NeverType() - /** * @since 1.0.0 * @deprecated diff --git a/test/2.1.x/default-types.ts b/test/2.1.x/default-types.ts index 808107073..1063fcdf2 100644 --- a/test/2.1.x/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -241,7 +241,6 @@ describe('any', () => { describe('never', () => { it('should not decode any value', () => { - // tslint:disable-next-line: deprecation const T = (t.never as any) as t.Any assertFailure(T, null, ['Invalid value null supplied to : never']) assertFailure(T, undefined, ['Invalid value undefined supplied to : never']) @@ -255,23 +254,14 @@ describe('never', () => { }) it('should not accept any value', () => { - // tslint:disable-next-line: deprecation assert.ok(!t.never.is(null)) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is(undefined)) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is('foo')) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is(1)) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is(true)) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is(t.identity)) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is({})) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is([])) - // tslint:disable-next-line: deprecation assert.ok(!t.never.is(/a/)) }) }) From 4b85202e9cd9058d039d1d76e79f01417ea360f4 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 3 Dec 2022 03:37:40 +0100 Subject: [PATCH 212/222] undeprecate `AnyType`, `AnyC`, `any` --- CHANGELOG.md | 1 + src/index.ts | 55 ++++++++++++++++--------------------- test/2.1.x/default-types.ts | 18 ------------ test/2.1.x/record.ts | 3 -- 4 files changed, 25 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05054e8f2..77e028384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - undeprecate `FunctionType`, `FunctionC`, `Function` - undeprecate `NeverType`, `NeverC`, `never` +- undeprecate `AnyType`, `AnyC`, `any` # 2.2.19 diff --git a/src/index.ts b/src/index.ts index e9c9bd933..eec41d87d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2038,6 +2038,30 @@ export interface NeverC extends NeverType {} */ export const never: NeverC = new NeverType() +/** + * @since 1.0.0 + */ +export class AnyType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'AnyType' = 'AnyType' + constructor() { + super('any', (_): _ is any => true, success, identity) + } +} + +/** + * @since 1.5.3 + */ +export interface AnyC extends AnyType {} + +/** + * @category primitives + * @since 1.0.0 + */ +export const any: AnyC = new AnyType() + // ------------------------------------------------------------------------------------- // deprecated // ------------------------------------------------------------------------------------- @@ -2146,37 +2170,6 @@ export const getDefaultContext /* istanbul ignore next */ = (decoder: Decoder { - /** - * @since 1.0.0 - */ - readonly _tag: 'AnyType' = 'AnyType' - constructor() { - super('any', (_): _ is any => true, success, identity) - } -} - -/** - * @since 1.5.3 - * @deprecated - */ -// tslint:disable-next-line: deprecation -export interface AnyC extends AnyType {} - -/** - * Use `unknown` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -// tslint:disable-next-line: deprecation -export const any: AnyC = new AnyType() - /** * Use `UnknownRecord` instead. * diff --git a/test/2.1.x/default-types.ts b/test/2.1.x/default-types.ts index 1063fcdf2..49bf9982a 100644 --- a/test/2.1.x/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -197,44 +197,26 @@ describe('Function', () => { describe('any', () => { it('should decode any value', () => { - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode(null)) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode(undefined)) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode('foo')) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode(1)) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode(true)) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode(t.identity)) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode({})) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode([])) - // tslint:disable-next-line: deprecation assertSuccess(t.any.decode(/a/)) }) it('should accept any value', () => { - // tslint:disable-next-line: deprecation assert.ok(t.any.is(null)) - // tslint:disable-next-line: deprecation assert.ok(t.any.is(undefined)) - // tslint:disable-next-line: deprecation assert.ok(t.any.is('foo')) - // tslint:disable-next-line: deprecation assert.ok(t.any.is(1)) - // tslint:disable-next-line: deprecation assert.ok(t.any.is(true)) - // tslint:disable-next-line: deprecation assert.ok(t.any.is(t.identity)) - // tslint:disable-next-line: deprecation assert.ok(t.any.is({})) - // tslint:disable-next-line: deprecation assert.ok(t.any.is([])) - // tslint:disable-next-line: deprecation assert.ok(t.any.is(/a/)) }) }) diff --git a/test/2.1.x/record.ts b/test/2.1.x/record.ts index c04025130..1ad02f32b 100644 --- a/test/2.1.x/record.ts +++ b/test/2.1.x/record.ts @@ -62,7 +62,6 @@ describe('record', () => { }) it('should accept an array if the codomain is `any`', () => { - // tslint:disable-next-line: deprecation const T = t.record(t.string, t.any) assert.strictEqual(T.is([]), true) }) @@ -98,7 +97,6 @@ describe('record', () => { }) it('should decode an array if the codomain is `any`', () => { - // tslint:disable-next-line: deprecation const T = t.record(t.string, t.any) assertSuccess(T.decode([1])) }) @@ -141,7 +139,6 @@ describe('record', () => { }) it('should accept an array if the codomain is `any`', () => { - // tslint:disable-next-line: deprecation const T = t.record(t.string, t.any) const a = [1] assert.strictEqual(T.encode(a), a) From bdaf80448c5d9326d45e8381f88fd0f11c2dcf73 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 3 Dec 2022 03:47:49 +0100 Subject: [PATCH 213/222] undeprecate `RefinementC`, `refinement`, `Integer` --- CHANGELOG.md | 1 + src/index.ts | 86 ++++++++++++++++--------------------- test/2.1.x/default-types.ts | 1 - test/2.1.x/exact.ts | 3 -- test/2.1.x/helpers.ts | 2 +- test/2.1.x/record.ts | 1 - test/2.1.x/refinement.ts | 15 +++---- test/2.1.x/union.ts | 1 + 8 files changed, 45 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77e028384..4a4c19b2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - undeprecate `FunctionType`, `FunctionC`, `Function` - undeprecate `NeverType`, `NeverC`, `never` - undeprecate `AnyType`, `AnyC`, `any` +- undeprecate `RefinementC`, `refinement`, `Integer` # 2.2.19 diff --git a/src/index.ts b/src/index.ts index eec41d87d..364b77241 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1157,7 +1157,6 @@ export function brand, Branded, B>>, name: N ): BrandC { - // tslint:disable-next-line: deprecation return refinement(codec, predicate, name) } @@ -2062,6 +2061,43 @@ export interface AnyC extends AnyType {} */ export const any: AnyC = new AnyType() +/** + * @since 1.5.3 + */ +export interface RefinementC extends RefinementType, OutputOf, InputOf> {} + +/** + * @category combinators + * @since 1.0.0 + */ +export function refinement( + codec: C, + predicate: Predicate>, + name = `(${codec.name} | ${getFunctionName(predicate)})` +): RefinementC { + return new RefinementType( + name, + (u): u is TypeOf => codec.is(u) && predicate(u), + (i, c) => { + const e = codec.validate(i, c) + if (isLeft(e)) { + return e + } + const a = e.right + return predicate(a) ? success(a) : failure(a, c) + }, + codec.encode, + codec, + predicate + ) +} + +/** + * @category primitives + * @since 1.0.0 + */ +export const Integer = refinement(number, Number.isInteger, 'Integer') + // ------------------------------------------------------------------------------------- // deprecated // ------------------------------------------------------------------------------------- @@ -2215,54 +2251,6 @@ export interface ObjectC extends ObjectType {} // tslint:disable-next-line: deprecation export const object: ObjectC = new ObjectType() -/** - * Use `BrandC` instead. - * - * @since 1.5.3 - * @deprecated - */ -export interface RefinementC extends RefinementType, OutputOf, InputOf> {} - -/** - * Use `brand` instead. - * - * @category combinators - * @since 1.0.0 - * @deprecated - */ -export function refinement( - codec: C, - predicate: Predicate>, - name = `(${codec.name} | ${getFunctionName(predicate)})` -): // tslint:disable-next-line: deprecation -RefinementC { - return new RefinementType( - name, - (u): u is TypeOf => codec.is(u) && predicate(u), - (i, c) => { - const e = codec.validate(i, c) - if (isLeft(e)) { - return e - } - const a = e.right - return predicate(a) ? success(a) : failure(a, c) - }, - codec.encode, - codec, - predicate - ) -} - -/** - * Use `Int` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -// tslint:disable-next-line: deprecation -export const Integer = refinement(number, Number.isInteger, 'Integer') - /** * Use `record` instead. * diff --git a/test/2.1.x/default-types.ts b/test/2.1.x/default-types.ts index 49bf9982a..87597441a 100644 --- a/test/2.1.x/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -139,7 +139,6 @@ describe('bigint', () => { describe('Integer', () => { it('should validate integers', () => { - // tslint:disable-next-line: deprecation const T = t.Integer assertSuccess(T.decode(1)) assertFailure(T, 0.5, ['Invalid value 0.5 supplied to : Integer']) diff --git a/test/2.1.x/exact.ts b/test/2.1.x/exact.ts index b4694e2d0..a44ebdd09 100644 --- a/test/2.1.x/exact.ts +++ b/test/2.1.x/exact.ts @@ -52,7 +52,6 @@ describe('exact', () => { }) it('should succeed validating a valid value (refinement)', () => { - // tslint:disable-next-line: deprecation const T = t.exact(t.refinement(t.type({ foo: t.string }), (p) => p.foo.length > 2)) assertSuccess(T.decode({ foo: 'foo' })) }) @@ -107,14 +106,12 @@ describe('exact', () => { }) it('should fail validating an invalid value (refinement)', () => { - // tslint:disable-next-line: deprecation const T = t.exact(t.refinement(t.type({ foo: t.string }), (p) => p.foo.length > 2)) assertFailure(T, null, ['Invalid value null supplied to : Exact<({ foo: string } | )>']) assertFailure(T, { foo: 'a' }, ['Invalid value {"foo":"a"} supplied to : Exact<({ foo: string } | )>']) }) it('should strip additional properties (refinement)', () => { - // tslint:disable-next-line: deprecation const T = t.exact(t.refinement(t.type({ foo: t.string }), (p) => p.foo.length > 2)) assertSuccess(T.decode({ foo: 'foo', bar: 1 }), { foo: 'foo' }) }) diff --git a/test/2.1.x/helpers.ts b/test/2.1.x/helpers.ts index de7733520..df441ec75 100644 --- a/test/2.1.x/helpers.ts +++ b/test/2.1.x/helpers.ts @@ -4,6 +4,7 @@ import * as t from '../../src/index' import { PathReporter } from '../../src/PathReporter' import { pipe } from 'fp-ts/lib/pipeable' +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function assertStrictEqual(result: t.Validation, expected: any): void { pipe( result, @@ -95,7 +96,6 @@ export const HyphenatedString = new t.Type( (a) => a[0] + a[2] ) -// tslint:disable-next-line: deprecation export const IntegerFromString = t.refinement(NumberFromString, t.Integer.is, 'IntegerFromString') export function withDefault( diff --git a/test/2.1.x/record.ts b/test/2.1.x/record.ts index 1ad02f32b..736e5583e 100644 --- a/test/2.1.x/record.ts +++ b/test/2.1.x/record.ts @@ -150,7 +150,6 @@ describe('record', () => { const value1 = { aa: 1 } assertStrictEqual(T1.decode(value1), value1) const T2 = t.record( - // tslint:disable-next-line: deprecation t.refinement(t.string, (s) => s.length >= 2), t.number ) diff --git a/test/2.1.x/refinement.ts b/test/2.1.x/refinement.ts index 8e303f9a9..5d030b9c5 100644 --- a/test/2.1.x/refinement.ts +++ b/test/2.1.x/refinement.ts @@ -5,13 +5,11 @@ import { assertSuccess, assertFailure, assertStrictEqual, IntegerFromString, Num describe('refinement', () => { describe('name', () => { it('should assign a default name', () => { - // tslint:disable-next-line: deprecation const T = t.refinement(t.number, (n) => n >= 0) assert.strictEqual(T.name, '(number | )') }) it('should accept a name', () => { - // tslint:disable-next-line: deprecation const T = t.refinement(t.number, (n) => n >= 0, 'T') assert.strictEqual(T.name, 'T') }) @@ -19,7 +17,6 @@ describe('refinement', () => { describe('is', () => { it('should check a isomorphic value', () => { - // tslint:disable-next-line: deprecation const T = t.Integer assert.strictEqual(T.is(1.2), false) assert.strictEqual(T.is('a'), false) @@ -27,7 +24,6 @@ describe('refinement', () => { }) it('should check a prismatic value', () => { - // tslint:disable-next-line: deprecation const T = t.refinement(NumberFromString, (n) => n % 1 === 0) assert.strictEqual(T.is(1.2), false) assert.strictEqual(T.is('a'), false) @@ -37,21 +33,22 @@ describe('refinement', () => { describe('decode', () => { it('should succeed validating a valid value', () => { - // tslint:disable-next-line: deprecation const T = t.refinement(t.number, (n) => n >= 0) assertSuccess(T.decode(0)) assertSuccess(T.decode(1)) }) it('should return the same reference if validation succeeded', () => { - // tslint:disable-next-line: deprecation - const T = t.refinement(t.Dictionary, () => true) + const T = t.refinement( + // tslint:disable-next-line: deprecation + t.Dictionary, + () => true + ) const value = {} assertStrictEqual(T.decode(value), value) }) it('should fail validating an invalid value', () => { - // tslint:disable-next-line: deprecation const T = t.Integer assertFailure(T, 'a', ['Invalid value "a" supplied to : Integer']) assertFailure(T, 1.2, ['Invalid value 1.2 supplied to : Integer']) @@ -66,13 +63,11 @@ describe('refinement', () => { describe('encode', () => { it('should encode a prismatic value', () => { - // tslint:disable-next-line: deprecation const T = t.refinement(t.array(NumberFromString), () => true) assert.deepStrictEqual(T.encode([1]), ['1']) }) it('should return the same reference while encoding', () => { - // tslint:disable-next-line: deprecation const T = t.refinement(t.array(t.number), () => true) assert.strictEqual(T.encode, t.identity) }) diff --git a/test/2.1.x/union.ts b/test/2.1.x/union.ts index d340cba05..c7a36402d 100644 --- a/test/2.1.x/union.ts +++ b/test/2.1.x/union.ts @@ -199,6 +199,7 @@ describe('union', () => { } ) assert.strictEqual( + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error t.getTags(t.intersection([t.type({ a: t.literal('a') }), t.type({ a: t.literal('b') })])), t.emptyTags From 9103e887387559d5d273036fa0788e67e210a322 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 3 Dec 2022 04:03:15 +0100 Subject: [PATCH 214/222] add refinement overload to allow custom branding, closes #373 --- CHANGELOG.md | 1 + docs/modules/index.ts.md | 398 +++++++++++++++++++-------------------- dtslint/ts3.5/index.ts | 12 +- src/index.ts | 8 +- 4 files changed, 215 insertions(+), 204 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a4c19b2c..fce0de42a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - undeprecate `NeverType`, `NeverC`, `never` - undeprecate `AnyType`, `AnyC`, `any` - undeprecate `RefinementC`, `refinement`, `Integer` +- add refinement overload to allow custom branding, closes #373 # 2.2.19 diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 33f379407..280da15e7 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -45,6 +45,7 @@ Added in v1.0.0 - [readonlyArray](#readonlyarray) - [record](#record) - [recursion](#recursion) + - [refinement](#refinement) - [strict](#strict) - [tuple](#tuple) - [type](#type) @@ -53,17 +54,20 @@ Added in v1.0.0 - [~~clean~~](#clean) - [~~dictionary~~](#dictionary) - [~~interface~~](#interface) - - [~~refinement~~](#refinement) - [~~taggedUnion~~](#taggedunion) - [constructors](#constructors) - [keyof](#keyof) - [literal](#literal) - [primitives](#primitives) + - [Function](#function) - [Int](#int) + - [Integer](#integer) - [UnknownArray](#unknownarray) - [UnknownRecord](#unknownrecord) + - [any](#any) - [bigint](#bigint) - [boolean](#boolean) + - [never](#never) - [null](#null) - [nullType](#nulltype) - [number](#number) @@ -74,37 +78,39 @@ Added in v1.0.0 - [voidType](#voidtype) - [~~Array~~](#array) - [~~Dictionary~~](#dictionary) - - [~~Function~~](#function) - - [~~Integer~~](#integer) - - [~~any~~](#any) - - [~~never~~](#never) - [~~object~~](#object) - [utils](#utils) - [Any (interface)](#any-interface) - [AnyArrayType (class)](#anyarraytype-class) - [\_tag (property)](#_tag-property) + - [AnyC (interface)](#anyc-interface) - [AnyDictionaryType (class)](#anydictionarytype-class) - [\_tag (property)](#_tag-property-1) - [AnyProps (interface)](#anyprops-interface) + - [AnyType (class)](#anytype-class) + - [\_tag (property)](#_tag-property-2) - [ArrayC (interface)](#arrayc-interface) - [ArrayType (class)](#arraytype-class) - - [\_tag (property)](#_tag-property-2) + - [\_tag (property)](#_tag-property-3) - [BigIntC (interface)](#bigintc-interface) - [BigIntType (class)](#biginttype-class) - - [\_tag (property)](#_tag-property-3) + - [\_tag (property)](#_tag-property-4) - [BooleanC (interface)](#booleanc-interface) - [BooleanType (class)](#booleantype-class) - - [\_tag (property)](#_tag-property-4) + - [\_tag (property)](#_tag-property-5) - [Brand (interface)](#brand-interface) - [BrandC (interface)](#brandc-interface) - [Branded (type alias)](#branded-type-alias) - [Decode (type alias)](#decode-type-alias) - [DictionaryType (class)](#dictionarytype-class) - - [\_tag (property)](#_tag-property-5) + - [\_tag (property)](#_tag-property-6) - [Encode (type alias)](#encode-type-alias) - [ExactC (interface)](#exactc-interface) - [ExactType (class)](#exacttype-class) - - [\_tag (property)](#_tag-property-6) + - [\_tag (property)](#_tag-property-7) + - [FunctionC (interface)](#functionc-interface) + - [FunctionType (class)](#functiontype-class) + - [\_tag (property)](#_tag-property-8) - [HasProps (type alias)](#hasprops-type-alias) - [HasPropsIntersection (interface)](#haspropsintersection-interface) - [HasPropsReadonly (interface)](#haspropsreadonly-interface) @@ -112,88 +118,82 @@ Added in v1.0.0 - [Int (type alias)](#int-type-alias) - [IntBrand (interface)](#intbrand-interface) - [InterfaceType (class)](#interfacetype-class) - - [\_tag (property)](#_tag-property-7) + - [\_tag (property)](#_tag-property-9) - [IntersectionC (interface)](#intersectionc-interface) - [IntersectionType (class)](#intersectiontype-class) - - [\_tag (property)](#_tag-property-8) + - [\_tag (property)](#_tag-property-10) - [Is (type alias)](#is-type-alias) - [KeyofC (interface)](#keyofc-interface) - [KeyofType (class)](#keyoftype-class) - - [\_tag (property)](#_tag-property-9) + - [\_tag (property)](#_tag-property-11) - [LiteralC (interface)](#literalc-interface) - [LiteralType (class)](#literaltype-class) - - [\_tag (property)](#_tag-property-10) + - [\_tag (property)](#_tag-property-12) - [Mixed (interface)](#mixed-interface) + - [NeverC (interface)](#neverc-interface) + - [NeverType (class)](#nevertype-class) + - [\_tag (property)](#_tag-property-13) - [NullC (interface)](#nullc-interface) - [NullType (class)](#nulltype-class) - - [\_tag (property)](#_tag-property-11) + - [\_tag (property)](#_tag-property-14) - [NumberC (interface)](#numberc-interface) - [NumberType (class)](#numbertype-class) - - [\_tag (property)](#_tag-property-12) + - [\_tag (property)](#_tag-property-15) - [OutputOfDictionary (type alias)](#outputofdictionary-type-alias) - [OutputOfPartialProps (type alias)](#outputofpartialprops-type-alias) - [OutputOfProps (type alias)](#outputofprops-type-alias) - [PartialC (interface)](#partialc-interface) - [PartialType (class)](#partialtype-class) - - [\_tag (property)](#_tag-property-13) + - [\_tag (property)](#_tag-property-16) - [Props (interface)](#props-interface) - [ReadonlyArrayC (interface)](#readonlyarrayc-interface) - [ReadonlyArrayType (class)](#readonlyarraytype-class) - - [\_tag (property)](#_tag-property-14) + - [\_tag (property)](#_tag-property-17) - [ReadonlyC (interface)](#readonlyc-interface) - [ReadonlyType (class)](#readonlytype-class) - - [\_tag (property)](#_tag-property-15) + - [\_tag (property)](#_tag-property-18) - [RecordC (interface)](#recordc-interface) - [RecursiveType (class)](#recursivetype-class) - - [\_tag (property)](#_tag-property-16) + - [\_tag (property)](#_tag-property-19) - [type (property)](#type-property) + - [RefinementC (interface)](#refinementc-interface) - [RefinementType (class)](#refinementtype-class) - - [\_tag (property)](#_tag-property-17) + - [\_tag (property)](#_tag-property-20) - [StringC (interface)](#stringc-interface) - [StringType (class)](#stringtype-class) - - [\_tag (property)](#_tag-property-18) + - [\_tag (property)](#_tag-property-21) - [TupleC (interface)](#tuplec-interface) - [TupleType (class)](#tupletype-class) - - [\_tag (property)](#_tag-property-19) + - [\_tag (property)](#_tag-property-22) - [TypeC (interface)](#typec-interface) - [TypeOfDictionary (type alias)](#typeofdictionary-type-alias) - [TypeOfPartialProps (type alias)](#typeofpartialprops-type-alias) - [TypeOfProps (type alias)](#typeofprops-type-alias) - [UndefinedC (interface)](#undefinedc-interface) - [UndefinedType (class)](#undefinedtype-class) - - [\_tag (property)](#_tag-property-20) + - [\_tag (property)](#_tag-property-23) - [UnionC (interface)](#unionc-interface) - [UnionType (class)](#uniontype-class) - - [\_tag (property)](#_tag-property-21) + - [\_tag (property)](#_tag-property-24) - [UnknownArrayC (interface)](#unknownarrayc-interface) - [UnknownC (interface)](#unknownc-interface) - [UnknownRecordC (interface)](#unknownrecordc-interface) - [UnknownType (class)](#unknowntype-class) - - [\_tag (property)](#_tag-property-22) + - [\_tag (property)](#_tag-property-25) - [Validate (type alias)](#validate-type-alias) - [VoidC (interface)](#voidc-interface) - [VoidType (class)](#voidtype-class) - - [\_tag (property)](#_tag-property-23) + - [\_tag (property)](#_tag-property-26) - [appendContext](#appendcontext) - [getContextEntry](#getcontextentry) - [getFunctionName](#getfunctionname) - [identity](#identity) - - [~~AnyC~~ (interface)](#anyc-interface) - - [~~AnyType~~ (class)](#anytype-class) - - [\_tag (property)](#_tag-property-24) - [~~Compact~~ (type alias)](#compact-type-alias) - [~~Exact~~ (type alias)](#exact-type-alias) - - [~~FunctionC~~ (interface)](#functionc-interface) - - [~~FunctionType~~ (class)](#functiontype-class) - - [\_tag (property)](#_tag-property-25) - - [~~NeverC~~ (interface)](#neverc-interface) - - [~~NeverType~~ (class)](#nevertype-class) - - [\_tag (property)](#_tag-property-26) - [~~ObjectC~~ (interface)](#objectc-interface) - [~~ObjectType~~ (class)](#objecttype-class) - [\_tag (property)](#_tag-property-27) - [~~PropsOf~~ (type alias)](#propsof-type-alias) - - [~~RefinementC~~ (interface)](#refinementc-interface) - [~~StrictC~~ (interface)](#strictc-interface) - [~~StrictType~~ (class)](#stricttype-class) - [\_tag (property)](#_tag-property-28) @@ -583,6 +583,25 @@ export declare function recursion Added in v1.0.0 +## refinement + +**Signature** + +```ts +export declare function refinement>( + codec: C, + refinement: Refinement, B>, + name?: string +): RefinementC +export declare function refinement( + codec: C, + predicate: Predicate>, + name?: string +): RefinementC +``` + +Added in v1.0.0 + ## strict Strips additional properties, equivalent to `exact(type(props))`. @@ -699,23 +718,6 @@ export declare const interface: typeof type Added in v1.0.0 -## ~~refinement~~ - -Use `brand` instead. - -**Signature** - -```ts -export declare function refinement( - codec: C, - predicate: Predicate>, - name = `(${codec.name} | ${getFunctionName(predicate)})` -): // tslint:disable-next-line: deprecation -RefinementC -``` - -Added in v1.0.0 - ## ~~taggedUnion~~ Use `union` instead. @@ -761,6 +763,16 @@ Added in v1.0.0 # primitives +## Function + +**Signature** + +```ts +export declare const Function: FunctionC +``` + +Added in v1.0.0 + ## Int A branded codec representing an integer @@ -773,6 +785,16 @@ export declare const Int: BrandC Added in v1.8.1 +## Integer + +**Signature** + +```ts +export declare const Integer: RefinementC +``` + +Added in v1.0.0 + ## UnknownArray **Signature** @@ -793,6 +815,16 @@ export declare const UnknownRecord: UnknownRecordC Added in v1.7.1 +## any + +**Signature** + +```ts +export declare const any: AnyC +``` + +Added in v1.0.0 + ## bigint **Signature** @@ -813,6 +845,16 @@ export declare const boolean: BooleanC Added in v1.0.0 +## never + +**Signature** + +```ts +export declare const never: NeverC +``` + +Added in v1.0.0 + ## null **Signature** @@ -917,80 +959,68 @@ export declare const Dictionary: UnknownRecordC Added in v1.0.0 -## ~~Function~~ - -**Signature** - -```ts -export declare const Function: FunctionC -``` - -Added in v1.0.0 - -## ~~Integer~~ +## ~~object~~ -Use `Int` instead. +Use `UnknownRecord` instead. **Signature** ```ts -export declare const Integer: RefinementC +export declare const object: ObjectC ``` Added in v1.0.0 -## ~~any~~ +# utils -Use `unknown` instead. +## Any (interface) **Signature** ```ts -export declare const any: AnyC +export interface Any extends Type {} ``` Added in v1.0.0 -## ~~never~~ +## AnyArrayType (class) **Signature** ```ts -export declare const never: NeverC +export declare class AnyArrayType { + constructor() +} ``` Added in v1.0.0 -## ~~object~~ - -Use `UnknownRecord` instead. +### \_tag (property) **Signature** ```ts -export declare const object: ObjectC +readonly _tag: "AnyArrayType" ``` Added in v1.0.0 -# utils - -## Any (interface) +## AnyC (interface) **Signature** ```ts -export interface Any extends Type {} +export interface AnyC extends AnyType {} ``` -Added in v1.0.0 +Added in v1.5.3 -## AnyArrayType (class) +## AnyDictionaryType (class) **Signature** ```ts -export declare class AnyArrayType { +export declare class AnyDictionaryType { constructor() } ``` @@ -1002,41 +1032,41 @@ Added in v1.0.0 **Signature** ```ts -readonly _tag: "AnyArrayType" +readonly _tag: "AnyDictionaryType" ``` Added in v1.0.0 -## AnyDictionaryType (class) +## AnyProps (interface) **Signature** ```ts -export declare class AnyDictionaryType { - constructor() +export interface AnyProps { + [key: string]: Any } ``` Added in v1.0.0 -### \_tag (property) +## AnyType (class) **Signature** ```ts -readonly _tag: "AnyDictionaryType" +export declare class AnyType { + constructor() +} ``` Added in v1.0.0 -## AnyProps (interface) +### \_tag (property) **Signature** ```ts -export interface AnyProps { - [key: string]: Any -} +readonly _tag: "AnyType" ``` Added in v1.0.0 @@ -1262,6 +1292,38 @@ readonly _tag: "ExactType" Added in v1.0.0 +## FunctionC (interface) + +**Signature** + +```ts +export interface FunctionC extends FunctionType {} +``` + +Added in v1.5.3 + +## FunctionType (class) + +**Signature** + +```ts +export declare class FunctionType { + constructor() +} +``` + +Added in v1.0.0 + +### \_tag (property) + +**Signature** + +```ts +readonly _tag: "FunctionType" +``` + +Added in v1.0.0 + ## HasProps (type alias) **Signature** @@ -1515,6 +1577,38 @@ export interface Mixed extends Type {} Added in v1.0.0 +## NeverC (interface) + +**Signature** + +```ts +export interface NeverC extends NeverType {} +``` + +Added in v1.5.3 + +## NeverType (class) + +**Signature** + +```ts +export declare class NeverType { + constructor() +} +``` + +Added in v1.0.0 + +### \_tag (property) + +**Signature** + +```ts +readonly _tag: "NeverType" +``` + +Added in v1.0.0 + ## NullC (interface) **Signature** @@ -1787,6 +1881,16 @@ readonly type: C Added in v1.0.0 +## RefinementC (interface) + +**Signature** + +```ts +export interface RefinementC> extends RefinementType, InputOf> {} +``` + +Added in v1.5.3 + ## RefinementType (class) **Signature** @@ -2158,38 +2262,6 @@ export declare const identity: (a: A) => A Added in v1.0.0 -## ~~AnyC~~ (interface) - -**Signature** - -```ts -export interface AnyC extends AnyType {} -``` - -Added in v1.5.3 - -## ~~AnyType~~ (class) - -**Signature** - -```ts -export declare class AnyType { - constructor() -} -``` - -Added in v1.0.0 - -### \_tag (property) - -**Signature** - -```ts -readonly _tag: "AnyType" -``` - -Added in v1.0.0 - ## ~~Compact~~ (type alias) **Signature** @@ -2211,70 +2283,6 @@ export type Exact = T & Added in v1.1.0 -## ~~FunctionC~~ (interface) - -**Signature** - -```ts -export interface FunctionC extends FunctionType {} -``` - -Added in v1.5.3 - -## ~~FunctionType~~ (class) - -**Signature** - -```ts -export declare class FunctionType { - constructor() -} -``` - -Added in v1.0.0 - -### \_tag (property) - -**Signature** - -```ts -readonly _tag: "FunctionType" -``` - -Added in v1.0.0 - -## ~~NeverC~~ (interface) - -**Signature** - -```ts -export interface NeverC extends NeverType {} -``` - -Added in v1.5.3 - -## ~~NeverType~~ (class) - -**Signature** - -```ts -export declare class NeverType { - constructor() -} -``` - -Added in v1.0.0 - -### \_tag (property) - -**Signature** - -```ts -readonly _tag: "NeverType" -``` - -Added in v1.0.0 - ## ~~ObjectC~~ (interface) **Signature** @@ -2317,18 +2325,6 @@ export type PropsOf = T['props'] Added in v1.0.0 -## ~~RefinementC~~ (interface) - -Use `BrandC` instead. - -**Signature** - -```ts -export interface RefinementC extends RefinementType, OutputOf, InputOf> {} -``` - -Added in v1.5.3 - ## ~~StrictC~~ (interface) **Signature** diff --git a/dtslint/ts3.5/index.ts b/dtslint/ts3.5/index.ts index 97f7ff977..bdb9953ca 100644 --- a/dtslint/ts3.5/index.ts +++ b/dtslint/ts3.5/index.ts @@ -63,14 +63,22 @@ type Keyof1OutputTest = t.OutputOf // $ExpectType "a" | "b" // refinement // -const Refinement1 = t.refinement(t.number, (n) => n % 2 === 0) // $ExpectType RefinementC +const Refinement1 = t.refinement(t.number, (n) => n % 2 === 0) // $ExpectType RefinementC type Refinement1TypeTest = t.TypeOf // $ExpectType number type Refinement1OutputTest = t.OutputOf // $ExpectType number -const Refinement2 = t.refinement(NumberFromString, (n) => n % 2 === 0) // $ExpectType RefinementC> +const Refinement2 = t.refinement(NumberFromString, (n) => n % 2 === 0) // $ExpectType RefinementC, number> type Refinement2TypeTest = t.TypeOf // $ExpectType number type Refinement2OutputTest = t.OutputOf // $ExpectType string +type Int = number & { __brand__: 'Int' } + +// $ExpectType RefinementC +t.refinement(t.number, (n): n is Int => Number.isInteger(n), 'Int') + +// $ExpectType RefinementC +t.refinement(t.number, Number.isInteger, 'Integer') + // // array // diff --git a/src/index.ts b/src/index.ts index 364b77241..951f8e528 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2064,12 +2064,18 @@ export const any: AnyC = new AnyType() /** * @since 1.5.3 */ -export interface RefinementC extends RefinementType, OutputOf, InputOf> {} +export interface RefinementC> extends RefinementType, InputOf> {} /** * @category combinators * @since 1.0.0 */ +export function refinement>( + codec: C, + refinement: Refinement, B>, + name?: string +): RefinementC +export function refinement(codec: C, predicate: Predicate>, name?: string): RefinementC export function refinement( codec: C, predicate: Predicate>, From dedb64e05328417ecd3d87e00008d9e72130374a Mon Sep 17 00:00:00 2001 From: phiresky Date: Sun, 12 Feb 2023 14:52:59 +0100 Subject: [PATCH 215/222] reorder documentation to make it more beginner-friendly --- README.md | 3 +- index.md | 138 ++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 88 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 8c4272a56..822ef86cd 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,10 @@ npm i io-ts fp-ts # Usage + ## Stable features -- [`index.ts` module](index.md) +- [Documentation of the main stable features (`index.ts` module)](index.md) ## Experimental modules (version `2.2+`) diff --git a/index.md b/index.md index ea8028f7c..68d557548 100644 --- a/index.md +++ b/index.md @@ -21,6 +21,91 @@ +# Basic usage + +```ts +import * as t from 'io-ts' + +const User = t.type({ + userId: t.number, + name: t.string +}) +``` + +This is equivalent to defining something like: + +```ts +type User = { + userId: number + name: string +} +``` + +The advantage of using `io-ts` to define the runtime type is that we can validate the type at runtime, and we can also extract the corresponding static type, so we don’t have to define it twice. + +You can use this runtime type to validate or decode untrusted data: + +```ts +import * as t from "io-ts"; +import { PathReporter } from "io-ts/PathReporter"; +import { isLeft } from "fp-ts/Either"; + +const User = t.type({ + userId: t.number, + name: t.string, +}); + +const data: unknown = { userId: 123, name: "foo" }; // data that looks like User but from an unknown source + +const decoded = User.decode(data); // Either +if (isLeft(decoded)) { + throw Error( + `Could not validate data: ${PathReporter.report(decoded).join("\n")}` + ); + // e.g.: Could not validate data: Invalid value "foo" supplied to : { userId: number, name: string }/userId: number +} + +type UserT = t.TypeOf; // compile-time type +const decodedUser: UserT = decoded.right; // now safely the correct type + +console.log("decoded user id:", decodedUser.userId); +``` + +io-ts also supports more complex encoding/decoding (serialization/deserialization) scenarios where the output type of `decode()` is not necessarily the same as the input type. This allows you to, for example, encode a `Date` object as a string and decode it back into a `Date` object (see [Custom types](#custom-types)). + +# Implemented types / combinators + +| Type | TypeScript | codec / combinator | +| --------------------------- | --------------------------- | -------------------------------------------------------------------- | +| null | `null` | `t.null` or `t.nullType` | +| undefined | `undefined` | `t.undefined` | +| void | `void` | `t.void` or `t.voidType` | +| string | `string` | `t.string` | +| number | `number` | `t.number` | +| boolean | `boolean` | `t.boolean` | +| unknown | `unknown` | `t.unknown` | +| array of unknown | `Array` | `t.UnknownArray` | +| array of type | `Array` | `t.array(A)` | +| record of unknown | `Record` | `t.UnknownRecord` | +| record of type | `Record` | `t.record(K, A)` | +| function | `Function` | `t.Function` | +| literal | `'s'` | `t.literal('s')` | +| partial | `Partial<{ name: string }>` | `t.partial({ name: t.string })` | +| readonly | `Readonly` | `t.readonly(A)` | +| readonly array | `ReadonlyArray` | `t.readonlyArray(A)` | +| type alias | `type T = { name: A }` | `t.type({ name: A })` | +| tuple | `[ A, B ]` | `t.tuple([ A, B ])` | +| union | `A \| B` | `t.union([ A, B ])` | +| intersection | `A & B` | `t.intersection([ A, B ])` | +| keyof | `keyof M` | `t.keyof(M)` (**only supports string keys**) | +| recursive types | | `t.recursion(name, definition)` | +| branded types / refinements | ✘ | `t.brand(A, predicate, brand)` | +| integer | ✘ | `t.Int` (built-in branded codec) | +| exact types | ✘ | `t.exact(type)` (no unknown extra properties) | +| strict | ✘ | `t.strict({ name: A })` (an alias of `t.exact(t.type({ name: A })))` | + + + # The idea A value of type `Type` (called "codec") is the runtime representation of the static type `A`. @@ -116,27 +201,7 @@ pipe(t.string.decode(null), fold(onLeft, onRight)) // => "1 error(s) found" ``` -We can combine these codecs through [combinators](#implemented-types--combinators) to build composite types which represent entities like domain models, request payloads etc. in our applications: - -```ts -import * as t from 'io-ts' - -const User = t.type({ - userId: t.number, - name: t.string -}) -``` - -So this is equivalent to defining something like: - -```ts -type User = { - userId: number - name: string -} -``` - -The advantage of using `io-ts` to define the runtime type is that we can validate the type at runtime, and we can also extract the corresponding static type, so we don’t have to define it twice. +We can combine these codecs through [combinators](#implemented-types--combinators) to build composite types which represent entities like domain models, request payloads etc. in our applications. # TypeScript integration @@ -266,37 +331,6 @@ console.log(PathReporter.report(NumberFromString.decode('a'))) You can also use the [`withMessage`](https://gcanti.github.io/io-ts-types/modules/withMessage.ts.html) helper from [io-ts-types](https://github.com/gcanti/io-ts-types) -# Implemented types / combinators - -| Type | TypeScript | codec / combinator | -| --------------------------- | --------------------------- | -------------------------------------------------------------------- | -| null | `null` | `t.null` or `t.nullType` | -| undefined | `undefined` | `t.undefined` | -| void | `void` | `t.void` or `t.voidType` | -| string | `string` | `t.string` | -| number | `number` | `t.number` | -| boolean | `boolean` | `t.boolean` | -| unknown | `unknown` | `t.unknown` | -| array of unknown | `Array` | `t.UnknownArray` | -| array of type | `Array` | `t.array(A)` | -| record of unknown | `Record` | `t.UnknownRecord` | -| record of type | `Record` | `t.record(K, A)` | -| function | `Function` | `t.Function` | -| literal | `'s'` | `t.literal('s')` | -| partial | `Partial<{ name: string }>` | `t.partial({ name: t.string })` | -| readonly | `Readonly` | `t.readonly(A)` | -| readonly array | `ReadonlyArray` | `t.readonlyArray(A)` | -| type alias | `type T = { name: A }` | `t.type({ name: A })` | -| tuple | `[ A, B ]` | `t.tuple([ A, B ])` | -| union | `A \| B` | `t.union([ A, B ])` | -| intersection | `A & B` | `t.intersection([ A, B ])` | -| keyof | `keyof M` | `t.keyof(M)` (**only supports string keys**) | -| recursive types | | `t.recursion(name, definition)` | -| branded types / refinements | ✘ | `t.brand(A, predicate, brand)` | -| integer | ✘ | `t.Int` (built-in branded codec) | -| exact types | ✘ | `t.exact(type)` | -| strict | ✘ | `t.strict({ name: A })` (an alias of `t.exact(t.type({ name: A })))` | - # Recursive types Recursive types can't be inferred by TypeScript so you must provide the static type as a hint From 0baeb15266c55fa74b812eca9ff9a30cf1859fe2 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 26 Apr 2023 20:26:33 +0200 Subject: [PATCH 216/222] update deps --- .eslintrc.json | 28 +- .github/workflows/main.yml | 2 +- .vscode/settings.json | 10 +- docs/modules/Decoder.ts.md | 23 +- docs/modules/Guard.ts.md | 23 +- docs/modules/Schemable.ts.md | 8 +- docs/modules/TaskDecoder.ts.md | 23 +- docs/modules/Type.ts.md | 2 +- docs/modules/index.ts.md | 15 +- dtslint/index.d.ts | 2 +- dtslint/{ts3.5 => ts3.9}/Codec.ts | 0 dtslint/{ts3.5 => ts3.9}/Decoder.ts | 0 dtslint/{ts3.5 => ts3.9}/Encoder.ts | 0 dtslint/{ts3.5 => ts3.9}/Eq.ts | 0 dtslint/{ts3.5 => ts3.9}/Guard.ts | 0 dtslint/{ts3.5 => ts3.9}/Schema.ts | 0 dtslint/{ts3.5 => ts3.9}/TaskDecoder.ts | 0 dtslint/{ts3.5 => ts3.9}/Type.ts | 0 dtslint/{ts3.5 => ts3.9}/index.d.ts | 0 dtslint/{ts3.5 => ts3.9}/index.ts | 0 dtslint/{ts3.5 => ts3.9}/tsconfig.json | 3 +- dtslint/{ts3.5 => ts3.9}/tslint.json | 0 package-lock.json | 23795 +++++++------------ package.json | 51 +- scripts/FileSystem.ts | 4 +- scripts/build.ts | 3 +- scripts/pre-publish.ts | 1 + scripts/release.ts | 3 +- src/Codec.ts | 21 +- src/DecodeError.ts | 1 + src/Decoder.ts | 44 +- src/Encoder.ts | 13 +- src/Eq.ts | 14 +- src/FreeSemigroup.ts | 18 +- src/Guard.ts | 95 +- src/Kleisli.ts | 189 +- src/PathReporter.ts | 5 +- src/Schema.ts | 1 + src/Schemable.ts | 8 +- src/TaskDecoder.ts | 47 +- src/ThrowReporter.ts | 5 +- src/Type.ts | 21 +- src/index.ts | 11 +- test/2.1.x/PathReporter.ts | 7 +- test/2.1.x/ThrowReporter.ts | 3 +- test/2.1.x/TypeClass.ts | 15 +- test/2.1.x/array.ts | 11 +- test/2.1.x/brand.ts | 13 +- test/2.1.x/default-types.ts | 35 +- test/2.1.x/exact.ts | 15 +- test/2.1.x/helpers.ts | 5 +- test/2.1.x/intersection.ts | 11 +- test/2.1.x/keyof.ts | 11 +- test/2.1.x/literal.ts | 13 +- test/2.1.x/partial.ts | 13 +- test/2.1.x/readonly.ts | 11 +- test/2.1.x/readonlyArray.ts | 11 +- test/2.1.x/record.ts | 25 +- test/2.1.x/recursion.ts | 11 +- test/2.1.x/refinement.ts | 13 +- test/2.1.x/strict.ts | 15 +- test/2.1.x/strictInterfaceWithOptionals.ts | 7 +- test/2.1.x/taggedUnion.ts | 11 +- test/2.1.x/tuple.ts | 11 +- test/2.1.x/type.ts | 11 +- test/2.1.x/union.ts | 17 +- test/Arbitrary.ts | 13 +- test/Codec.ts | 93 +- test/Decoder.ts | 33 +- test/Encoder.ts | 5 +- test/Eq.ts | 5 +- test/FreeSemigroup.ts | 2 +- test/Guard.ts | 31 +- test/JsonSchema.test.ts | 11 +- test/JsonSchema.ts | 9 +- test/Schema.ts | 3 +- test/Schemable.ts | 5 +- test/TaskDecoder.ts | 31 +- test/Type.ts | 19 +- test/helpers.ts | 5 +- tsconfig.json | 4 +- tsconfig.tslint.json | 7 - tslint.json | 11 - vite.config.ts | 19 + 84 files changed, 9793 insertions(+), 15297 deletions(-) rename dtslint/{ts3.5 => ts3.9}/Codec.ts (100%) rename dtslint/{ts3.5 => ts3.9}/Decoder.ts (100%) rename dtslint/{ts3.5 => ts3.9}/Encoder.ts (100%) rename dtslint/{ts3.5 => ts3.9}/Eq.ts (100%) rename dtslint/{ts3.5 => ts3.9}/Guard.ts (100%) rename dtslint/{ts3.5 => ts3.9}/Schema.ts (100%) rename dtslint/{ts3.5 => ts3.9}/TaskDecoder.ts (100%) rename dtslint/{ts3.5 => ts3.9}/Type.ts (100%) rename dtslint/{ts3.5 => ts3.9}/index.d.ts (100%) rename dtslint/{ts3.5 => ts3.9}/index.ts (100%) rename dtslint/{ts3.5 => ts3.9}/tsconfig.json (87%) rename dtslint/{ts3.5 => ts3.9}/tslint.json (100%) delete mode 100644 tsconfig.tslint.json delete mode 100644 tslint.json create mode 100644 vite.config.ts diff --git a/.eslintrc.json b/.eslintrc.json index b5307935d..2c790eba6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,21 +2,43 @@ "parserOptions": { "project": "./tsconfig.json" }, - "plugins": [], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended" ], + "plugins": ["deprecation", "import", "simple-import-sort"], "rules": { + "@typescript-eslint/array-type": [ + "warn", + { + "default": "generic", + "readonly": "generic" + } + ], + "@typescript-eslint/prefer-readonly": "warn", "@typescript-eslint/member-delimiter-style": 0, "@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/ban-types": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-empty-interface": "off", "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], + "@typescript-eslint/no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_" + } + ], + "@typescript-eslint/prefer-as-const": "off", "prefer-rest-params": "off", - "prefer-spread": "off" + "prefer-spread": "off", + "deprecation/deprecation": "off", + "import/first": "error", + "import/no-cycle": "error", + "import/newline-after-import": "error", + "import/no-duplicates": "error", + "import/no-unresolved": "off", + "import/order": "off", + "simple-import-sort/imports": "error" } } diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67af800a2..f2d3e4a05 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - node-version: [16.x] + node-version: [16.17.1] steps: - uses: actions/checkout@v2 diff --git a/.vscode/settings.json b/.vscode/settings.json index 6de18e4ed..845aa4f2d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,9 @@ { - "typescript.tsdk": "./node_modules/typescript/lib" -} + "typescript.tsdk": "./node_modules/typescript/lib", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "eslint.validate": ["typescript"], + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "files.insertFinalNewline": true + } diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index e2b947d74..a893a08f9 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -302,7 +302,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const nullable: (or: Decoder) => Decoder +export declare const nullable: (or: Decoder) => Decoder ``` Added in v2.2.7 @@ -324,9 +324,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: Decoder } -) => Decoder> +export declare const partial: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + Partial<{ [K in keyof A]: A[K] }> +> ``` Added in v2.2.7 @@ -369,9 +370,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const struct: ( - properties: { [K in keyof A]: Decoder } -) => Decoder +export declare const struct: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + { [K in keyof A]: A[K] } +> ``` Added in v2.2.15 @@ -445,9 +447,10 @@ Use `struct` instead. **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: Decoder } -) => Decoder +export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + { [K in keyof A]: A[K] } +> ``` Added in v2.2.7 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index ce797e488..7f83dbf23 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -127,7 +127,7 @@ Added in v2.2.0 **Signature** ```ts -export declare const nullable: (or: Guard) => Guard +export declare const nullable: (or: Guard) => Guard ``` Added in v2.2.0 @@ -137,9 +137,10 @@ Added in v2.2.0 **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: Guard } -) => Guard> +export declare const partial: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + Partial<{ [K in keyof A]: A[K] }> +> ``` Added in v2.2.0 @@ -181,9 +182,10 @@ Added in v2.2.0 **Signature** ```ts -export declare const struct: ( - properties: { [K in keyof A]: Guard } -) => Guard +export declare const struct: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + { [K in keyof A]: A[K] } +> ``` Added in v2.2.15 @@ -241,9 +243,10 @@ Use `struct` instead. **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: Guard } -) => Guard +export declare const type: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + { [K in keyof A]: A[K] } +> ``` Added in v2.2.0 diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 0d146264b..b147d3fca 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -130,9 +130,11 @@ export interface Schemable2C { /** @deprecated */ readonly type: (properties: { [K in keyof A]: Kind2 }) => Kind2 readonly struct: (properties: { [K in keyof A]: Kind2 }) => Kind2 - readonly partial: ( - properties: { [K in keyof A]: Kind2 } - ) => Kind2> + readonly partial: (properties: { [K in keyof A]: Kind2 }) => Kind2< + S, + E, + Partial<{ [K in keyof A]: A[K] }> + > readonly record: (codomain: Kind2) => Kind2> readonly array: (item: Kind2) => Kind2> readonly tuple: >( diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index ae2cd3e0d..ca2aa5440 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -305,7 +305,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const nullable: (or: TaskDecoder) => TaskDecoder +export declare const nullable: (or: TaskDecoder) => TaskDecoder ``` Added in v2.2.7 @@ -327,9 +327,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder> +export declare const partial: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + Partial<{ [K in keyof A]: A[K] }> +> ``` Added in v2.2.7 @@ -372,9 +373,10 @@ Added in v2.2.7 **Signature** ```ts -export declare const struct: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder +export declare const struct: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + { [K in keyof A]: A[K] } +> ``` Added in v2.2.15 @@ -448,9 +450,10 @@ Use `struct` instead. **Signature** ```ts -export declare const type: ( - properties: { [K in keyof A]: TaskDecoder } -) => TaskDecoder +export declare const type: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + { [K in keyof A]: A[K] } +> ``` Added in v2.2.7 diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index c6ceb033b..6488782de 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -90,7 +90,7 @@ Added in v2.2.3 **Signature** ```ts -export declare const nullable: (or: Type) => Type +export declare const nullable: (or: Type) => Type ``` Added in v2.2.3 diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md index 280da15e7..31fef0e0e 100644 --- a/docs/modules/index.ts.md +++ b/docs/modules/index.ts.md @@ -436,7 +436,7 @@ Added in v1.0.0 **Signature** ```ts -export declare const failure: (value: unknown, context: Context, message?: string) => Either +export declare const failure: (value: unknown, context: Context, message?: string | undefined) => Either ``` Added in v1.0.0 @@ -609,7 +609,7 @@ Strips additional properties, equivalent to `exact(type(props))`. **Signature** ```ts -export declare const strict:

(props: P, name?: string) => ExactC> +export declare const strict:

(props: P, name?: string | undefined) => ExactC> ``` Added in v1.0.0 @@ -2277,8 +2277,9 @@ Added in v1.4.2 **Signature** ```ts -export type Exact = T & - { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } +export type Exact = T & { + [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never +} ``` Added in v1.1.0 @@ -2330,7 +2331,7 @@ Added in v1.0.0 **Signature** ```ts -export interface StrictC

// tslint:disable-next-line: deprecation +export interface StrictC

// tslint:disable-next-line: deprecation extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} ``` @@ -2422,7 +2423,7 @@ Added in v1.3.0 **Signature** ```ts -export interface TaggedIntersection // tslint:disable-next-line: deprecation +export interface TaggedIntersection // tslint:disable-next-line: deprecation extends IntersectionType, A, O> {} ``` @@ -2453,7 +2454,7 @@ Added in v1.3.0 **Signature** ```ts -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation extends TaggedUnionType, OutputOf, unknown> {} ``` diff --git a/dtslint/index.d.ts b/dtslint/index.d.ts index 5dc1183e8..3ae9a657e 100644 --- a/dtslint/index.d.ts +++ b/dtslint/index.d.ts @@ -1 +1 @@ -// TypeScript Version: 3.5 +// TypeScript Version: 3.9 diff --git a/dtslint/ts3.5/Codec.ts b/dtslint/ts3.9/Codec.ts similarity index 100% rename from dtslint/ts3.5/Codec.ts rename to dtslint/ts3.9/Codec.ts diff --git a/dtslint/ts3.5/Decoder.ts b/dtslint/ts3.9/Decoder.ts similarity index 100% rename from dtslint/ts3.5/Decoder.ts rename to dtslint/ts3.9/Decoder.ts diff --git a/dtslint/ts3.5/Encoder.ts b/dtslint/ts3.9/Encoder.ts similarity index 100% rename from dtslint/ts3.5/Encoder.ts rename to dtslint/ts3.9/Encoder.ts diff --git a/dtslint/ts3.5/Eq.ts b/dtslint/ts3.9/Eq.ts similarity index 100% rename from dtslint/ts3.5/Eq.ts rename to dtslint/ts3.9/Eq.ts diff --git a/dtslint/ts3.5/Guard.ts b/dtslint/ts3.9/Guard.ts similarity index 100% rename from dtslint/ts3.5/Guard.ts rename to dtslint/ts3.9/Guard.ts diff --git a/dtslint/ts3.5/Schema.ts b/dtslint/ts3.9/Schema.ts similarity index 100% rename from dtslint/ts3.5/Schema.ts rename to dtslint/ts3.9/Schema.ts diff --git a/dtslint/ts3.5/TaskDecoder.ts b/dtslint/ts3.9/TaskDecoder.ts similarity index 100% rename from dtslint/ts3.5/TaskDecoder.ts rename to dtslint/ts3.9/TaskDecoder.ts diff --git a/dtslint/ts3.5/Type.ts b/dtslint/ts3.9/Type.ts similarity index 100% rename from dtslint/ts3.5/Type.ts rename to dtslint/ts3.9/Type.ts diff --git a/dtslint/ts3.5/index.d.ts b/dtslint/ts3.9/index.d.ts similarity index 100% rename from dtslint/ts3.5/index.d.ts rename to dtslint/ts3.9/index.d.ts diff --git a/dtslint/ts3.5/index.ts b/dtslint/ts3.9/index.ts similarity index 100% rename from dtslint/ts3.5/index.ts rename to dtslint/ts3.9/index.ts diff --git a/dtslint/ts3.5/tsconfig.json b/dtslint/ts3.9/tsconfig.json similarity index 87% rename from dtslint/ts3.5/tsconfig.json rename to dtslint/ts3.9/tsconfig.json index a83515bca..e55758e3c 100644 --- a/dtslint/ts3.5/tsconfig.json +++ b/dtslint/ts3.9/tsconfig.json @@ -11,6 +11,7 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "target": "es5", - "lib": ["es2015"] + "lib": ["es2015"], + "skipLibCheck": true } } diff --git a/dtslint/ts3.5/tslint.json b/dtslint/ts3.9/tslint.json similarity index 100% rename from dtslint/ts3.5/tslint.json rename to dtslint/ts3.9/tslint.json diff --git a/package-lock.json b/package-lock.json index 5234b1b74..432c62dcb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,73 +1,98 @@ { "name": "io-ts", - "version": "2.2.17", + "version": "2.2.20", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "io-ts", - "version": "2.2.17", + "version": "2.2.20", "license": "MIT", "devDependencies": { - "@types/benchmark": "1.0.31", + "@types/benchmark": "^1.0.31", "@types/glob": "^7.1.3", - "@types/jest": "25.2.1", - "@types/node": "13.11.0", - "@typescript-eslint/eslint-plugin": "^4.14.1", - "@typescript-eslint/parser": "^4.14.1", + "@types/node": "^16.18.25", + "@typescript-eslint/eslint-plugin": "^5.59.0", + "@typescript-eslint/parser": "^5.59.0", + "@vitest/coverage-istanbul": "^0.23.4", "benchmark": "2.1.4", - "docs-ts": "^0.6.2", - "doctoc": "1.4.0", + "docs-ts": "^0.7.2", "dtslint": "github:gcanti/dtslint", - "eslint": "^7.18.0", - "fast-check": "^1.24.2", - "fp-ts": "^2.5.0", + "eslint": "^8.38.0", + "eslint-plugin-deprecation": "^1.4.1", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-simple-import-sort": "^10.0.0", + "fast-check": "^1.26.0", + "glob": "^7.1.6", "import-path-rewrite": "github:gcanti/import-path-rewrite", - "jest": "25.2.7", - "mocha": "7.1.1", - "prettier": "2.0.2", - "rimraf": "3.0.2", - "ts-jest": "25.3.1", - "ts-node": "8.8.2", - "tslint": "6.1.1", - "tslint-config-standard": "9.0.0", - "typescript": "^4.8.2" + "mocha": "^5.2.0", + "prettier": "^2.7.1", + "rimraf": "2.6.2", + "ts-node": "^8.0.2", + "tslint": "5.11.0", + "typescript": "^5.0.4", + "vite": "^4.3.3", + "vitest": "^0.30.1" }, "peerDependencies": { "fp-ts": "^2.5.0" } }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "dev": true, "dependencies": { - "@babel/highlight": "^7.8.3" + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", + "integrity": "sha512-/DYyDpeCfaVinT40FPGdkkb+lYSKvsVuMjDAG7jPOWWiM1ibOaB9CXJAlc4d1QpP/U2q2P9jbrSlClKSErd55g==", + "dev": true, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.0.tgz", - "integrity": "sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.0", - "@babel/helper-module-transforms": "^7.9.0", - "@babel/helpers": "^7.9.0", - "@babel/parser": "^7.9.0", - "@babel/template": "^7.8.6", - "@babel/traverse": "^7.9.0", - "@babel/types": "^7.9.0", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.4.tgz", + "integrity": "sha512-qt/YV149Jman/6AfmlxJ04LMIu8bMoyl3RB91yTFrxQmgbrSvQMy7cI8Q62FHx1t8wJ8B5fu0UDoLwHAhUo1QA==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-compilation-targets": "^7.21.4", + "@babel/helper-module-transforms": "^7.21.2", + "@babel/helpers": "^7.21.0", + "@babel/parser": "^7.21.4", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.4", + "@babel/types": "^7.21.4", "convert-source-map": "^1.7.0", "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.13", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.0" }, "engines": { "node": ">=6.9.0" @@ -93,167 +118,221 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/@babel/core/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, - "engines": { - "node": ">=0.10.0" + "bin": { + "semver": "bin/semver.js" } }, "node_modules/@babel/generator": { - "version": "7.9.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.4.tgz", - "integrity": "sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA==", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", + "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", "dev": true, "dependencies": { - "@babel/types": "^7.9.0", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" + "@babel/types": "^7.21.4", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@babel/generator/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "node_modules/@babel/helper-compilation-targets": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.4.tgz", + "integrity": "sha512-Fa0tTuOXZ1iL8IeDFUWCzjZcn+sJGd9RZdH9esYVjEejGmzf+FFYQpMi/kZUk2kPy/q1H3/GPw7np8qar/stfg==", "dev": true, + "dependencies": { + "@babel/compat-data": "^7.21.4", + "@babel/helper-validator-option": "^7.21.0", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", + "semver": "^6.3.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-function-name": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", - "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, "dependencies": { - "@babel/helper-get-function-arity": "^7.8.3", - "@babel/template": "^7.8.3", - "@babel/types": "^7.8.3" + "yallist": "^3.0.2" } }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", - "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, - "dependencies": { - "@babel/types": "^7.8.3" + "bin": { + "semver": "bin/semver.js" } }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", - "integrity": "sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA==", + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", "dev": true, - "dependencies": { - "@babel/types": "^7.8.3" + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@babel/helper-module-imports": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", - "integrity": "sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==", + "node_modules/@babel/helper-function-name": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "dev": true, "dependencies": { - "@babel/types": "^7.8.3" + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz", - "integrity": "sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA==", + "node_modules/@babel/helper-hoist-variables": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", "dev": true, "dependencies": { - "@babel/helper-module-imports": "^7.8.3", - "@babel/helper-replace-supers": "^7.8.6", - "@babel/helper-simple-access": "^7.8.3", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/template": "^7.8.6", - "@babel/types": "^7.9.0", - "lodash": "^4.17.13" + "@babel/types": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", - "integrity": "sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ==", + "node_modules/@babel/helper-module-imports": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz", + "integrity": "sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==", "dev": true, "dependencies": { - "@babel/types": "^7.8.3" + "@babel/types": "^7.21.4" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", - "integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==", - "dev": true - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz", - "integrity": "sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA==", + "node_modules/@babel/helper-module-transforms": { + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", + "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", "dev": true, "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.8.3", - "@babel/helper-optimise-call-expression": "^7.8.3", - "@babel/traverse": "^7.8.6", - "@babel/types": "^7.8.6" + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.2", + "@babel/types": "^7.21.2" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", - "integrity": "sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "dev": true, "dependencies": { - "@babel/template": "^7.8.3", - "@babel/types": "^7.8.3" + "@babel/types": "^7.20.2" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", - "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", "dev": true, "dependencies": { - "@babel/types": "^7.8.3" + "@babel/types": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "dev": true, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz", - "integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==", - "dev": true + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/helpers": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.9.2.tgz", - "integrity": "sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", + "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", "dev": true, "dependencies": { - "@babel/template": "^7.8.3", - "@babel/traverse": "^7.9.0", - "@babel/types": "^7.9.0" + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.9.0", + "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.9.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", - "integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", + "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -262,56 +341,39 @@ "node": ">=6.0.0" } }, - "node_modules/@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/template": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", - "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.8.3", - "@babel/parser": "^7.8.6", - "@babel/types": "^7.8.6" + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.0.tgz", - "integrity": "sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.0", - "@babel/helper-function-name": "^7.8.3", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/parser": "^7.9.0", - "@babel/types": "^7.9.0", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", + "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.21.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.21.4", + "@babel/types": "^7.21.4", "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/traverse/node_modules/debug": { @@ -331,36 +393,17 @@ "dev": true }, "node_modules/@babel/types": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", - "integrity": "sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng==", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", + "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.9.0", - "lodash": "^4.17.13", + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "node_modules/@cnakazawa/watch": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", - "integrity": "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==", - "dev": true, - "dependencies": { - "exec-sh": "^0.3.2", - "minimist": "^1.2.0" - }, - "bin": { - "watch": "cli.js" }, "engines": { - "node": ">=0.1.95" + "node": ">=6.9.0" } }, "node_modules/@dsherret/to-absolute-glob": { @@ -376,713 +419,644 @@ "node": ">=0.10.0" } }, - "node_modules/@eslint/eslintrc": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", - "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==", + "node_modules/@esbuild/android-arm": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz", + "integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "lodash": "^4.17.20", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "node_modules/@esbuild/android-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.18.tgz", + "integrity": "sha512-/iq0aK0eeHgSC3z55ucMAHO05OIqmQehiGay8eP5l/5l+iEr4EIbh4/MI8xD9qRFjqzgkc0JkX0LculNC9mXBw==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "node_modules/@esbuild/android-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.18.tgz", + "integrity": "sha512-x+0efYNBF3NPW2Xc5bFOSFW7tTXdAcpfEg2nXmxegm4mJuVeS+i109m/7HMiOQ6M12aVGGFlqJX3RhNdYM2lWg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "ms": "2.1.2" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "node_modules/@esbuild/darwin-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.18.tgz", + "integrity": "sha512-6tY+djEAdF48M1ONWnQb1C+6LiXrKjmqjzPNPWXhu/GzOHTHX2nh8Mo2ZAmBFg0kIodHhciEgUBtcYCAIjGbjQ==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "type-fest": "^0.8.1" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "node_modules/@esbuild/darwin-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.18.tgz", + "integrity": "sha512-Qq84ykvLvya3dO49wVC9FFCNUfSrQJLbxhoQk/TE1r6MjHo3sFF2tlJCwMjhkBVq3/ahUisj7+EpRSz0/+8+9A==", + "cpu": [ + "x64" + ], "dev": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">= 4" + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", - "dev": true - }, - "node_modules/@eslint/eslintrc/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/@eslint/eslintrc/node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.18.tgz", + "integrity": "sha512-fw/ZfxfAzuHfaQeMDhbzxp9mc+mHn1Y94VDHFHjGvt2Uxl10mT4CDavHm+/L9KG441t1QdABqkVYwakMUeyLRA==", + "cpu": [ + "arm64" + ], "dev": true, + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=12" } }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "node_modules/@esbuild/freebsd-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.18.tgz", + "integrity": "sha512-FQFbRtTaEi8ZBi/A6kxOC0V0E9B/97vPdYjY9NdawyLd4Qk5VD5g2pbWN2VR1c0xhzcJm74HWpObPszWC+qTew==", + "cpu": [ + "x64" + ], "dev": true, + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", - "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", + "node_modules/@esbuild/linux-arm": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.18.tgz", + "integrity": "sha512-jW+UCM40LzHcouIaqv3e/oRs0JM76JfhHjCavPxMUti7VAPh8CaGSlS7cmyrdpzSk7A+8f0hiedHqr/LMnfijg==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", - "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "node_modules/@esbuild/linux-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.18.tgz", + "integrity": "sha512-R7pZvQZFOY2sxUG8P6A21eq6q+eBv7JPQYIybHVf1XkQYC+lT7nDBdC7wWKTrbvMXKRaGudp/dzZCwL/863mZQ==", + "cpu": [ + "arm64" + ], "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@jest/console": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-25.2.6.tgz", - "integrity": "sha512-bGp+0PicZVCEhb+ifnW9wpKWONNdkhtJsRE7ap729hiAfTvCN6VhGx0s/l/V/skA2pnyqq+N/7xl9ZWfykDpsg==", + "node_modules/@esbuild/linux-ia32": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.18.tgz", + "integrity": "sha512-ygIMc3I7wxgXIxk6j3V00VlABIjq260i967Cp9BNAk5pOOpIXmd1RFQJQX9Io7KRsthDrQYrtcx7QCof4o3ZoQ==", + "cpu": [ + "ia32" + ], "dev": true, - "dependencies": { - "@jest/source-map": "^25.2.6", - "chalk": "^3.0.0", - "jest-util": "^25.2.6", - "slash": "^3.0.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 8.3" + "node": ">=12" } }, - "node_modules/@jest/console/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/@esbuild/linux-loong64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz", + "integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==", + "cpu": [ + "loong64" + ], "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=12" } }, - "node_modules/@jest/console/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/@esbuild/linux-mips64el": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.18.tgz", + "integrity": "sha512-oVqckATOAGuiUOa6wr8TXaVPSa+6IwVJrGidmNZS1cZVx0HqkTMkqFGD2HIx9H1RvOwFeWYdaYbdY6B89KUMxA==", + "cpu": [ + "mips64el" + ], "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@jest/console/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@esbuild/linux-ppc64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.18.tgz", + "integrity": "sha512-3dLlQO+b/LnQNxgH4l9rqa2/IwRJVN9u/bK63FhOPB4xqiRqlQAU0qDU3JJuf0BmaH0yytTBdoSBHrb2jqc5qQ==", + "cpu": [ + "ppc64" + ], "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=7.0.0" + "node": ">=12" } }, - "node_modules/@jest/console/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "node_modules/@esbuild/linux-riscv64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.18.tgz", + "integrity": "sha512-/x7leOyDPjZV3TcsdfrSI107zItVnsX1q2nho7hbbQoKnmoeUWjs+08rKKt4AUXju7+3aRZSsKrJtaRmsdL1xA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/@jest/console/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/@esbuild/linux-s390x": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.18.tgz", + "integrity": "sha512-cX0I8Q9xQkL/6F5zWdYmVf5JSQt+ZfZD2bJudZrWD+4mnUvoZ3TDDXtDX2mUaq6upMFv9FlfIh4Gfun0tbGzuw==", + "cpu": [ + "s390x" + ], "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@jest/console/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/@esbuild/linux-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.18.tgz", + "integrity": "sha512-66RmRsPlYy4jFl0vG80GcNRdirx4nVWAzJmXkevgphP1qf4dsLQCpSKGM3DUQCojwU1hnepI63gNZdrr02wHUA==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@jest/core": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-25.2.7.tgz", - "integrity": "sha512-Nd6ELJyR+j0zlwhzkfzY70m04hAur0VnMwJXVe4VmmD/SaQ6DEyal++ERQ1sgyKIKKEqRuui6k/R0wHLez4P+g==", + "node_modules/@esbuild/netbsd-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.18.tgz", + "integrity": "sha512-95IRY7mI2yrkLlTLb1gpDxdC5WLC5mZDi+kA9dmM5XAGxCME0F8i4bYH4jZreaJ6lIZ0B8hTrweqG1fUyW7jbg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "@jest/console": "^25.2.6", - "@jest/reporters": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.3", - "jest-changed-files": "^25.2.6", - "jest-config": "^25.2.7", - "jest-haste-map": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-resolve-dependencies": "^25.2.7", - "jest-runner": "^25.2.7", - "jest-runtime": "^25.2.7", - "jest-snapshot": "^25.2.7", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "jest-watcher": "^25.2.7", - "micromatch": "^4.0.2", - "p-each-series": "^2.1.0", - "realpath-native": "^2.0.0", - "rimraf": "^3.0.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">= 8.3" - } - }, - "node_modules/@jest/core/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, + "optional": true, + "os": [ + "netbsd" + ], "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=12" } }, - "node_modules/@jest/core/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/@esbuild/openbsd-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.18.tgz", + "integrity": "sha512-WevVOgcng+8hSZ4Q3BKL3n1xTv5H6Nb53cBrtzzEjDbbnOmucEVcZeGCsCOi9bAOcDYEeBZbD2SJNBxlfP3qiA==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "optional": true, + "os": [ + "openbsd" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@jest/core/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@esbuild/sunos-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.18.tgz", + "integrity": "sha512-Rzf4QfQagnwhQXVBS3BYUlxmEbcV7MY+BH5vfDZekU5eYpcffHSyjU8T0xucKVuOcdCsMo+Ur5wmgQJH2GfNrg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "optional": true, + "os": [ + "sunos" + ], "engines": { - "node": ">=7.0.0" + "node": ">=12" } }, - "node_modules/@jest/core/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "node_modules/@esbuild/win32-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.18.tgz", + "integrity": "sha512-Kb3Ko/KKaWhjeAm2YoT/cNZaHaD1Yk/pa3FTsmqo9uFh1D1Rfco7BBLIPdDOozrObj2sahslFuAQGvWbgWldAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/@jest/core/node_modules/graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true + "node_modules/@esbuild/win32-ia32": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.18.tgz", + "integrity": "sha512-0/xUMIdkVHwkvxfbd5+lfG7mHOf2FRrxNbPiKWg9C4fFrB8H0guClmaM3BFiRUYrznVoyxTIyC/Ou2B7QQSwmw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/@jest/core/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/@esbuild/win32-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.18.tgz", + "integrity": "sha512-qU25Ma1I3NqTSHJUOKi9sAH1/Mzuvlke0ioMJRthLXKm7JiSKVwFghlGbDLOO2sARECGhja4xYfRAZNPAkooYg==", + "cpu": [ + "x64" + ], "dev": true, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/@jest/core/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "eslint-visitor-keys": "^3.3.0" }, "engines": { - "node": ">=8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, - "node_modules/@jest/environment": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.2.6.tgz", - "integrity": "sha512-17WIw+wCb9drRNFw1hi8CHah38dXVdOk7ga9exThhGtXlZ9mK8xH4DjSB9uGDGXIWYSHmrxoyS6KJ7ywGr7bzg==", + "node_modules/@eslint-community/regexpp": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", + "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", "dev": true, - "dependencies": { - "@jest/fake-timers": "^25.2.6", - "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6" - }, "engines": { - "node": ">= 8.3" + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@jest/fake-timers": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", - "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", + "node_modules/@eslint/eslintrc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", + "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", "dev": true, "dependencies": { - "@jest/types": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "lolex": "^5.0.0" + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.5.1", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" }, "engines": { - "node": ">= 8.3" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@jest/reporters": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", - "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.2", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.0", - "jest-haste-map": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "slash": "^3.0.0", - "source-map": "^0.6.0", - "string-length": "^3.1.0", - "terminal-link": "^2.0.0", - "v8-to-istanbul": "^4.0.1" + "ms": "2.1.2" }, "engines": { - "node": ">= 8.3" + "node": ">=6.0" }, - "optionalDependencies": { - "node-notifier": "^6.0.0" + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/@jest/reporters/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "type-fest": "^0.20.2" }, "engines": { "node": ">=8" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@jest/reporters/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "argparse": "^2.0.1" }, - "engines": { - "node": ">=8" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/@jest/reporters/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=7.0.0" + "node": "*" } }, - "node_modules/@jest/reporters/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/@jest/reporters/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/@eslint/eslintrc/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@jest/reporters/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@jest/source-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", - "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", + "node_modules/@eslint/js": { + "version": "8.39.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.39.0.tgz", + "integrity": "sha512-kf9RB0Fg7NZfap83B3QOqOGg9QmD9yBudqQXzzOtn3i4y7ZUXe5ONeW34Gwi+TxhH4mvj72R1Zc300KUMa9Bng==", "dev": true, - "dependencies": { - "callsites": "^3.0.0", - "graceful-fs": "^4.2.3", - "source-map": "^0.6.0" - }, "engines": { - "node": ">= 8.3" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@jest/source-map/node_modules/graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "node_modules/@jest/test-result": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", - "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "dependencies": { - "@jest/console": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" }, "engines": { - "node": ">= 8.3" + "node": ">=10.10.0" } }, - "node_modules/@jest/test-sequencer": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", - "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", + "node_modules/@humanwhocodes/config-array/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { - "@jest/test-result": "^25.2.6", - "jest-haste-map": "^25.2.6", - "jest-runner": "^25.2.7", - "jest-runtime": "^25.2.7" + "ms": "2.1.2" }, "engines": { - "node": ">= 8.3" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/@jest/transform": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">= 8.3" + "node": "*" } }, - "node_modules/@jest/transform/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/@humanwhocodes/config-array/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": ">=12.22" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@jest/transform/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, "engines": { "node": ">=8" } }, - "node_modules/@jest/transform/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" }, "engines": { - "node": ">=7.0.0" + "node": ">=6.0.0" } }, - "node_modules/@jest/transform/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/transform/node_modules/graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "node_modules/@jest/transform/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/transform/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - }, "engines": { - "node": ">= 8.3" + "node": ">=6.0.0" } }, - "node_modules/@jest/types/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=6.0.0" } }, - "node_modules/@jest/types/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true }, - "node_modules/@jest/types/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", "dev": true, "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" } }, - "node_modules/@jest/types/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, - "node_modules/@jest/types/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@nodelib/fs.scandir": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", - "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "dependencies": { - "@nodelib/fs.stat": "2.0.3", + "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" }, "engines": { @@ -1090,57 +1064,27 @@ } }, "node_modules/@nodelib/fs.stat": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", - "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.walk": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", - "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "dependencies": { - "@nodelib/fs.scandir": "2.1.3", + "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" }, "engines": { "node": ">= 8" } }, - "node_modules/@sinonjs/commons": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", - "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@textlint/ast-node-types": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-4.2.2.tgz", - "integrity": "sha512-5VHykhxgUat7dvRWGw52Tk55SWjuZDpDO7PKDhfcLTFrD1cjbTtFFnWeJc0BfoqB2AUjfHXRoMdnqbFRGmnPVQ==", - "dev": true - }, - "node_modules/@textlint/markdown-to-ast": { - "version": "6.0.9", - "resolved": "https://registry.npmjs.org/@textlint/markdown-to-ast/-/markdown-to-ast-6.0.9.tgz", - "integrity": "sha512-hfAWBvTeUGh5t5kTn2U3uP3qOSM1BSrxzl1jF3nn0ywfZXpRBZr5yRjXnl4DzIYawCtZOshmRi/tI3/x4TE1jQ==", - "dev": true, - "dependencies": { - "@textlint/ast-node-types": "^4.0.3", - "debug": "^2.1.3", - "remark-frontmatter": "^1.2.0", - "remark-parse": "^5.0.0", - "structured-source": "^3.0.2", - "traverse": "^0.6.6", - "unified": "^6.1.6" - } - }, "node_modules/@ts-morph/common": { "version": "0.7.5", "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.7.5.tgz", @@ -1155,23 +1099,6 @@ "typescript": "~4.1.3" } }, - "node_modules/@ts-morph/common/node_modules/fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@ts-morph/common/node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -1197,59 +1124,27 @@ "node": ">=4.2.0" } }, - "node_modules/@types/babel__core": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.7.tgz", - "integrity": "sha512-RL62NqSFPCDK2FM1pSDH0scHpJvsXtZNiYlMB73DgPBaG1E38ZYVL+ei5EkWRbr+KC4YNiAUNBnRj+bgwpgjMw==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.6.1", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz", - "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==", - "dev": true, - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz", - "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.9.tgz", - "integrity": "sha512-jEFQ8L1tuvPjOI8lnpaf73oCJe+aoxL6ygqSy6c8LcW98zaC+4mzWuQIRCEvKeCOu+lbqdXcg4Uqmm1S8AP1tw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.3.0" - } - }, "node_modules/@types/benchmark": { "version": "1.0.31", "resolved": "https://registry.npmjs.org/@types/benchmark/-/benchmark-1.0.31.tgz", "integrity": "sha512-F6fVNOkGEkSdo/19yWYOwVKGvzbTeWkR/XQYBKtGBQ9oGRjBN9f/L4aJI4sDcVPJO58Y1CJZN8va9V2BhrZapA==", "dev": true }, - "node_modules/@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "node_modules/@types/chai": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-3.5.2.tgz", + "integrity": "sha512-+ZvkforUDGqwU1npZYIMPuszsInIypxL81rFAsCGDs9CRhAEWO6s3rpO+TfJk9mgUgxKNMnSVQa/npPPD4gJXw==", "dev": true }, + "node_modules/@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, "node_modules/@types/glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", @@ -1260,45 +1155,16 @@ "@types/node": "*" } }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", - "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==", + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", - "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/jest": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.1.tgz", - "integrity": "sha512-msra1bCaAeEdkSyA0CZ6gW1ukMIvZ5YoJkdXw/qhQdsuuDlFTcEUrUw8CLCPt2rVRUfXlClVvK2gvPs9IokZaA==", - "dev": true, - "dependencies": { - "jest-diff": "^25.2.1", - "pretty-format": "^25.2.1" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", - "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, "node_modules/@types/minimatch": { @@ -1308,63 +1174,44 @@ "dev": true }, "node_modules/@types/node": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.0.tgz", - "integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==", - "dev": true - }, - "node_modules/@types/prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==", - "dev": true - }, - "node_modules/@types/stack-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", - "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==", + "version": "16.18.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.25.tgz", + "integrity": "sha512-rUDO6s9Q/El1R1I21HG4qw/LstTHCPO/oQNAwI/4b2f9EWvMnqt4d3HJwPMawfZ3UvodB8516Yg+VAq54YM+eA==", "dev": true }, - "node_modules/@types/yargs": { - "version": "15.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.4.tgz", - "integrity": "sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==", - "dev": true, - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", - "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz", - "integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==", + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.1.tgz", + "integrity": "sha512-AVi0uazY5quFB9hlp2Xv+ogpfpk77xzsgsIEWyVS7uK/c7MZ5tw7ZPbapa0SbfkqE0fsAMkz5UwtgMLVk2BQAg==", "dev": true, "dependencies": { - "@typescript-eslint/experimental-utils": "4.14.1", - "@typescript-eslint/scope-manager": "4.14.1", - "debug": "^4.1.1", - "functional-red-black-tree": "^1.0.1", - "lodash": "^4.17.15", - "regexpp": "^3.0.0", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.59.1", + "@typescript-eslint/type-utils": "5.59.1", + "@typescript-eslint/utils": "5.59.1", + "debug": "^4.3.4", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^4.0.0", - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1373,9 +1220,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -1396,9 +1243,9 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -1411,9 +1258,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/tsutils": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", - "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, "dependencies": { "tslib": "^1.8.1" @@ -1425,50 +1272,93 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/@typescript-eslint/experimental-utils": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz", - "integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==", + "node_modules/@typescript-eslint/parser": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.1.tgz", + "integrity": "sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.14.1", - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/typescript-estree": "4.14.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" + "@typescript-eslint/scope-manager": "5.59.1", + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/typescript-estree": "5.59.1", + "debug": "^4.3.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@typescript-eslint/parser": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz", - "integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==", + "node_modules/@typescript-eslint/parser/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "4.14.1", - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/typescript-estree": "4.14.1", - "debug": "^4.1.1" + "ms": "2.1.2" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.1.tgz", + "integrity": "sha512-mau0waO5frJctPuAzcxiNWqJR5Z8V0190FTSqRw1Q4Euop6+zTwHAf8YIXNwDOT29tyUDrQ65jSg9aTU/H0omA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/visitor-keys": "5.59.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.1.tgz", + "integrity": "sha512-ZMWQ+Oh82jWqWzvM3xU+9y5U7MEMVv6GLioM3R5NJk6uvP47kZ7YvlgSHJ7ERD6bOY7Q4uxWm25c76HKEwIjZw==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "5.59.1", + "@typescript-eslint/utils": "5.59.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + "eslint": "*" }, "peerDependenciesMeta": { "typescript": { @@ -1476,10 +1366,10 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "node_modules/@typescript-eslint/type-utils/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -1493,36 +1383,34 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/ms": { + "node_modules/@typescript-eslint/type-utils/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz", - "integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==", + "node_modules/@typescript-eslint/type-utils/node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/visitor-keys": "4.14.1" + "tslib": "^1.8.1" }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": ">= 6" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, "node_modules/@typescript-eslint/types": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz", - "integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==", + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.1.tgz", + "integrity": "sha512-dg0ICB+RZwHlysIy/Dh1SP+gnXNzwd/KS0JprD3Lmgmdq+dJAJnUPe1gNG34p0U19HvRlGX733d/KqscrGC1Pg==", "dev": true, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", @@ -1530,22 +1418,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz", - "integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==", + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.1.tgz", + "integrity": "sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/visitor-keys": "4.14.1", - "debug": "^4.1.1", - "globby": "^11.0.1", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/visitor-keys": "5.59.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", @@ -1558,9 +1445,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -1574,26 +1461,6 @@ } } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/globby": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", - "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -1601,9 +1468,9 @@ "dev": true }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -1616,9 +1483,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/tsutils": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", - "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, "dependencies": { "tslib": "^1.8.1" @@ -1630,623 +1497,871 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz", - "integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==", + "node_modules/@typescript-eslint/utils": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.1.tgz", + "integrity": "sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "4.14.1", - "eslint-visitor-keys": "^2.0.0" + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.59.1", + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/typescript-estree": "5.59.1", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/abab": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", - "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", - "dev": true - }, - "node_modules/acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { - "acorn": "bin/acorn" + "semver": "bin/semver.js" }, "engines": { - "node": ">=0.4.0" + "node": ">=10" } }, - "node_modules/acorn-globals": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", - "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.1.tgz", + "integrity": "sha512-6waEYwBTCWryx0VJmP7JaM4FpipLsFl9CvYf2foAE8Qh/Y0s+bxWysciwOs0LTBED4JCaNxTZ5rGadB14M6dwA==", "dev": true, "dependencies": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - } - }, - "node_modules/acorn-globals/node_modules/acorn": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", - "dev": true, - "bin": { - "acorn": "bin/acorn" + "@typescript-eslint/types": "5.59.1", + "eslint-visitor-keys": "^3.3.0" }, "engines": { - "node": ">=0.4.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "node_modules/@vitest/coverage-istanbul": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/@vitest/coverage-istanbul/-/coverage-istanbul-0.23.4.tgz", + "integrity": "sha512-vl+c682jwCkthdOomO7aBRY/H2bXfxjYAo+WZoGktdWEiSBfwhFUOcJJW3+Ery9i8ja+M1Jd19HrqYriLixGPw==", "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + "dependencies": { + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-instrument": "^5.2.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.1", + "istanbul-reports": "^3.1.5", + "test-exclude": "^6.0.0", + "vitest": "0.23.4" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/acorn-walk": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", - "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", + "node_modules/@vitest/coverage-istanbul/node_modules/@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", + "dev": true + }, + "node_modules/@vitest/coverage-istanbul/node_modules/@types/node": { + "version": "18.16.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz", + "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==", + "dev": true + }, + "node_modules/@vitest/coverage-istanbul/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true, + "bin": { + "acorn": "bin/acorn" + }, "engines": { "node": ">=0.4.0" } }, - "node_modules/ajv": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", - "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "node_modules/@vitest/coverage-istanbul/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/anchor-markdown-header": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/anchor-markdown-header/-/anchor-markdown-header-0.5.7.tgz", - "integrity": "sha1-BFBj125qH5zTJ6V6ASaqD97Dcac=", + "node_modules/@vitest/coverage-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", "dev": true, "dependencies": { - "emoji-regex": "~6.1.0" + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "node_modules/@vitest/coverage-istanbul/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@vitest/coverage-istanbul/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, - "engines": { - "node": ">=6" + "bin": { + "semver": "bin/semver.js" } }, - "node_modules/ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "node_modules/@vitest/coverage-istanbul/node_modules/strip-literal": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-0.4.2.tgz", + "integrity": "sha512-pv48ybn4iE1O9RLgCAN0iU4Xv7RlBTiit6DKmMiErbs9x1wH6vXBs45tWc0H5wUIF6TLTrKweqkmYF/iraQKNw==", "dev": true, "dependencies": { - "type-fest": "^0.11.0" - }, - "engines": { - "node": ">=8" + "acorn": "^8.8.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/ansi-red": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", - "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "node_modules/@vitest/coverage-istanbul/node_modules/tinypool": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.1.tgz", + "integrity": "sha512-zLA1ZXlstbU2rlpA4CIeVaqvWq41MTWqLY3FfsAXgC8+f7Pk7zroaJQxDgxn1xNudKW6Kmj4808rPFShUlIRmQ==", "dev": true, - "dependencies": { - "ansi-wrap": "0.1.0" - }, "engines": { - "node": ">=0.10.0" + "node": ">=14.0.0" } }, - "node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "node_modules/@vitest/coverage-istanbul/node_modules/tinyspy": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.1.1.tgz", + "integrity": "sha512-UVq5AXt/gQlti7oxoIg5oi/9r0WpF7DGEVwXgqWSMmyN16+e3tl5lIvTaOpJ3TAtu5xFzWccFRM4R5NaWHF+4g==", "dev": true, "engines": { - "node": ">=8" + "node": ">=14.0.0" } }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "node_modules/@vitest/coverage-istanbul/node_modules/vite": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.6.tgz", + "integrity": "sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==", "dev": true, "dependencies": { - "color-convert": "^1.9.0" + "esbuild": "^0.15.9", + "postcss": "^8.4.18", + "resolve": "^1.22.1", + "rollup": "^2.79.1" + }, + "bin": { + "vite": "bin/vite.js" }, "engines": { - "node": ">=4" - } - }, - "node_modules/ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } } }, - "node_modules/anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "node_modules/@vitest/coverage-istanbul/node_modules/vitest": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.23.4.tgz", + "integrity": "sha512-iukBNWqQAv8EKDBUNntspLp9SfpaVFbmzmM0sNcnTxASQZMzRw3PsM6DMlsHiI+I6GeO5/sYDg3ecpC+SNFLrQ==", "dev": true, "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" + "@types/chai": "^4.3.3", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "chai": "^4.3.6", + "debug": "^4.3.4", + "local-pkg": "^0.4.2", + "strip-literal": "^0.4.1", + "tinybench": "^2.1.5", + "tinypool": "^0.3.0", + "tinyspy": "^1.0.2", + "vite": "^2.9.12 || ^3.0.0-0" + }, + "bin": { + "vitest": "vitest.mjs" }, "engines": { - "node": ">= 8" + "node": ">=v14.16.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } } }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "node_modules/@vitest/expect": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.30.1.tgz", + "integrity": "sha512-c3kbEtN8XXJSeN81iDGq29bUzSjQhjES2WR3aColsS4lPGbivwLtas4DNUe0jD9gg/FYGIteqOenfU95EFituw==", "dev": true, "dependencies": { - "sprintf-js": "~1.0.2" + "@vitest/spy": "0.30.1", + "@vitest/utils": "0.30.1", + "chai": "^4.3.7" } }, - "node_modules/arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "node_modules/@vitest/runner": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.30.1.tgz", + "integrity": "sha512-W62kT/8i0TF1UBCNMRtRMOBWJKRnNyv9RrjIgdUryEe0wNpGZvvwPDLuzYdxvgSckzjp54DSpv1xUbv4BQ0qVA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "@vitest/utils": "0.30.1", + "concordance": "^5.0.4", + "p-limit": "^4.0.0", + "pathe": "^1.1.0" } }, - "node_modules/arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/array-differ": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", - "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "node_modules/@vitest/snapshot": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.30.1.tgz", + "integrity": "sha512-fJZqKrE99zo27uoZA/azgWyWbFvM1rw2APS05yB0JaLwUIg9aUtvvnBf4q7JWhEcAHmSwbrxKFgyBUga6tq9Tw==", "dev": true, - "engines": { - "node": ">=8" + "dependencies": { + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "pretty-format": "^27.5.1" } }, - "node_modules/array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", - "dev": true - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "node_modules/@vitest/snapshot/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "node_modules/@vitest/snapshot/node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, "engines": { - "node": ">=0.10.0" + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, - "node_modules/arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "dev": true, - "engines": { - "node": ">=8" - } + "node_modules/@vitest/snapshot/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true }, - "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "node_modules/@vitest/spy": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.30.1.tgz", + "integrity": "sha512-YfJeIf37GvTZe04ZKxzJfnNNuNSmTEGnla2OdL60C8od16f3zOfv9q9K0nNii0NfjDJRt/CVN/POuY5/zTS+BA==", "dev": true, "dependencies": { - "safer-buffer": "~2.1.0" + "tinyspy": "^2.1.0" } }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "node_modules/@vitest/utils": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.30.1.tgz", + "integrity": "sha512-/c8Xv2zUVc+rnNt84QF0Y0zkfxnaGhp87K2dYJMLtLOIckPzuxLVzAtFCicGFdB4NeBHNzTRr1tNn7rCtQcWFA==", "dev": true, - "engines": { - "node": ">=0.8" + "dependencies": { + "concordance": "^5.0.4", + "loupe": "^2.3.6", + "pretty-format": "^27.5.1" } }, - "node_modules/assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "node_modules/@vitest/utils/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "node_modules/@vitest/utils/node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, "engines": { - "node": ">=4" + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "node_modules/@vitest/utils/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, - "node_modules/atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "node_modules/abab": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true, + "peer": true, "bin": { - "atob": "bin/atob.js" + "acorn": "bin/acorn" }, "engines": { - "node": ">= 4.5.0" + "node": ">=0.4.0" } }, - "node_modules/autolinker": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-0.28.1.tgz", - "integrity": "sha1-BlK0kYgYefB3XazgzcoyM5QqTkc=", - "dev": true, - "dependencies": { - "gulp-header": "^1.7.1" + "node_modules/acorn-globals": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" } }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "node_modules/acorn-globals/node_modules/acorn": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true, + "optional": true, + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, "engines": { - "node": "*" + "node": ">=0.4.0" } }, - "node_modules/aws4": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", - "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", - "dev": true - }, - "node_modules/babel-jest": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.2.6.tgz", - "integrity": "sha512-MDJOAlwtIeIQiGshyX0d2PxTbV73xZMpNji40ivVTPQOm59OdRR9nYCkffqI7ugtsK4JR98HgNKbDbuVf4k5QQ==", + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, - "dependencies": { - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/babel__core": "^7.1.0", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^25.2.6", - "chalk": "^3.0.0", - "slash": "^3.0.0" - }, - "engines": { - "node": ">= 8.3" - }, "peerDependencies": { - "@babel/core": "^7.0.0" + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/babel-jest/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/acorn-walk": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, + "optional": true, + "peer": true, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=0.4.0" } }, - "node_modules/babel-jest/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, - "engines": { - "node": ">=8" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/babel-jest/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/ansi-red": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "ansi-wrap": "0.1.0" }, "engines": { - "node": ">=7.0.0" + "node": ">=0.10.0" } }, - "node_modules/babel-jest/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/babel-jest/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { "node": ">=8" } }, - "node_modules/babel-jest/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "color-convert": "^1.9.0" }, "engines": { - "node": ">=8" + "node": ">=4" } }, - "node_modules/babel-plugin-istanbul": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz", - "integrity": "sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ==", + "node_modules/ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^4.0.0", - "test-exclude": "^6.0.0" - }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/babel-plugin-jest-hoist": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.2.6.tgz", - "integrity": "sha512-qE2xjMathybYxjiGFJg0mLFrz0qNp83aNZycWDY/SuHiZNq+vQfRQtuINqyXyue1ELd8Rd+1OhFSLjms8msMbw==", - "dev": true, - "dependencies": { - "@types/babel__traverse": "^7.0.6" - }, - "engines": { - "node": ">= 8.3" - } + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, - "node_modules/babel-preset-jest": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.2.6.tgz", - "integrity": "sha512-Xh2eEAwaLY9+SyMt/xmGZDnXTW/7pSaBPG0EMo7EuhvosFKVWYB6CqwYD31DaEQuoTL090oDZ0FEqygffGRaSQ==", + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "dependencies": { - "@babel/plugin-syntax-bigint": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^25.2.6" - }, - "engines": { - "node": ">= 8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "sprintf-js": "~1.0.2" } }, - "node_modules/bail": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.4.tgz", - "integrity": "sha512-S8vuDB4w6YpRhICUDET3guPlQpaJl7od94tpZ0Fvnyp+MKW/HyDTcRDck+29C9g+d/qQHnddRH3+94kZdrW0Ww==", - "dev": true - }, - "node_modules/balanced-match": { + "node_modules/array-buffer-byte-length": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "node_modules/base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", "dev": true, "dependencies": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/base/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "node_modules/array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", "dev": true, - "dependencies": { - "is-descriptor": "^1.0.0" - }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/base/node_modules/is-accessor-descriptor": { + "node_modules/array-equal": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/array-includes": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", + "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", "dev": true, "dependencies": { - "kind-of": "^6.0.0" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", + "is-string": "^1.0.7" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/base/node_modules/is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, - "dependencies": { - "kind-of": "^6.0.0" - }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/base/node_modules/is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "node_modules/array.prototype.flat": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", + "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", "dev": true, "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/base/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "node_modules/array.prototype.flatmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", + "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/base/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "node_modules/asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "tweetnacl": "^0.14.3" + "safer-buffer": "~2.1.0" } }, - "node_modules/benchmark": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", - "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, - "dependencies": { - "lodash": "^4.17.4", - "platform": "^1.3.3" + "optional": true, + "peer": true, + "engines": { + "node": ">=0.8" } }, - "node_modules/binary-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", - "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/boundary": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/boundary/-/boundary-1.0.1.tgz", - "integrity": "sha1-TWfcJgLAzBbdm85+v4fpSCkPWBI=", - "dev": true + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true, + "optional": true, + "peer": true }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "node_modules/autolinker": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-0.28.1.tgz", + "integrity": "sha1-BlK0kYgYefB3XazgzcoyM5QqTkc=", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "gulp-header": "^1.7.1" } }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha512-XqYMR2dfdGMW+hd0IUZ2PwK+fGeFkOxZJ0wY+JaQAHzt1Zx8LcvpiZD2NiGkEG8qx0CfkAOr5xt76d1e8vG90g==", + "dev": true, + "dependencies": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + } + }, + "node_modules/babel-code-frame/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-code-frame/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-code-frame/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-code-frame/node_modules/js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg==", + "dev": true + }, + "node_modules/babel-code-frame/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-code-frame/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/benchmark": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", + "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", + "dev": true, + "dependencies": { + "lodash": "^4.17.4", + "platform": "^1.3.3" + } + }, + "node_modules/blueimp-md5": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", + "integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "dependencies": { "fill-range": "^7.0.1" @@ -2271,22 +2386,9 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, - "node_modules/browser-resolve": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", - "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", "dev": true, - "dependencies": { - "resolve": "1.1.7" - } - }, - "node_modules/browser-resolve/node_modules/resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true + "optional": true, + "peer": true }, "node_modules/browser-stdout": { "version": "1.3.1", @@ -2294,25 +2396,32 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "node_modules/bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "node_modules/browserslist": { + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], "dependencies": { - "fast-json-stable-stringify": "2.x" + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" + }, + "bin": { + "browserslist": "cli.js" }, "engines": { - "node": ">= 6" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "dependencies": { - "node-int64": "^0.4.0" + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, "node_modules/buffer-from": { @@ -2330,33 +2439,26 @@ "node": ">=0.10.0" } }, - "node_modules/cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", "dev": true, - "dependencies": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/cache-base/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/callsites": { @@ -2368,33 +2470,52 @@ "node": ">=6" } }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "node_modules/caniuse-lite": { + "version": "1.0.30001481", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", + "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==", "dev": true, - "engines": { - "node": ">=6" - } + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] }, - "node_modules/capture-exit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", - "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==", + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", "dev": true, "dependencies": { - "rsvp": "^4.8.4" + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" }, "engines": { - "node": "6.* || 8.* || >= 10.*" + "node": ">=4" } }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -2409,106 +2530,13 @@ "node": ">=4" } }, - "node_modules/character-entities": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.3.tgz", - "integrity": "sha512-yB4oYSAa9yLcGyTbB4ItFwHw43QHdH129IJ5R+WvxOkWlyFnR5FAaBNnUq4mcxsTVZGh28bHoeTHMKXH1wZf3w==", - "dev": true - }, - "node_modules/character-entities-legacy": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.3.tgz", - "integrity": "sha512-YAxUpPoPwxYFsslbdKkhrGnXAtXoHNgYjlBM3WMXkWGTl5RsY3QmOyhwAgL8Nxm9l5LBThXGawxKPn68y6/fww==", - "dev": true - }, - "node_modules/character-reference-invalid": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.3.tgz", - "integrity": "sha512-VOq6PRzQBam/8Jm6XBGk2fNEnHXAdGd6go0rtd4weAGECBamHDwwCQSOT12TACIYUZegUXnV6xBXqUssijtxIg==", - "dev": true - }, - "node_modules/chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", - "dev": true, - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.1.1" - } - }, - "node_modules/ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "node_modules/class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "dependencies": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", "dev": true, "engines": { - "iojs": ">= 1.0.0", - "node": ">= 0.12.0" + "node": "*" } }, "node_modules/code-block-writer": { @@ -2531,31 +2559,6 @@ "node": ">=0.8.0" } }, - "node_modules/collapse-white-space": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.5.tgz", - "integrity": "sha512-703bOOmytCYAX9cXYqoikYIx6twmFCXsnzRQheBcTG3nzKYBR4P/+wkYeH+Mvj7qUz8zZDtdyzbxfnEi/kYzRQ==", - "dev": true - }, - "node_modules/collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true - }, - "node_modules/collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "dependencies": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -2576,6 +2579,8 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -2589,12 +2594,6 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "node_modules/component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2625,6 +2624,40 @@ "source-map": "^0.6.1" } }, + "node_modules/concordance": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.4.tgz", + "integrity": "sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==", + "dev": true, + "dependencies": { + "date-time": "^3.1.0", + "esutils": "^2.0.3", + "fast-diff": "^1.2.0", + "js-string-escape": "^1.0.1", + "lodash": "^4.17.15", + "md5-hex": "^3.0.1", + "semver": "^7.3.2", + "well-known-symbols": "^2.0.0" + }, + "engines": { + "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" + } + }, + "node_modules/concordance/node_modules/semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", @@ -2634,60 +2667,27 @@ "safe-buffer": "~5.1.1" } }, - "node_modules/copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/cross-spawn/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, "node_modules/cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/cssstyle": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.2.0.tgz", "integrity": "sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "cssom": "~0.3.6" }, @@ -2699,13 +2699,17 @@ "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, + "optional": true, + "peer": true, "dependencies": { "assert-plus": "^1.0.0" }, @@ -2718,37 +2722,36 @@ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "abab": "^2.0.0", "whatwg-mimetype": "^2.2.0", "whatwg-url": "^7.0.0" } }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/date-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", + "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", "dev": true, "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true, + "time-zone": "^1.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, "engines": { - "node": ">=0.10" + "node": ">=6" } }, "node_modules/deep-is": { @@ -2757,94 +2760,20 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, - "node_modules/deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "dev": true, "dependencies": { - "object-keys": "^1.0.12" + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" - } - }, - "node_modules/define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/define-property/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/define-property/node_modules/is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/define-property/node_modules/is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/define-property/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/define-property/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/delayed-stream": { @@ -2852,19 +2781,12 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true, + "optional": true, + "peer": true, "engines": { "node": ">=0.4.0" } }, - "node_modules/detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/diacritics-map": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/diacritics-map/-/diacritics-map-0.1.0.tgz", @@ -2883,15 +2805,6 @@ "node": ">=0.3.1" } }, - "node_modules/diff-sequences": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-25.2.6.tgz", - "integrity": "sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==", - "dev": true, - "engines": { - "node": ">= 8.3" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -2905,17 +2818,17 @@ } }, "node_modules/docs-ts": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.6.2.tgz", - "integrity": "sha512-61u998y7nKi9J3/Vw8BRXeNAIepDsODmVKvPHgqRdMGSE+nR/yb7b5qspCbcUcsCnJ9eDhTJc22nlGdt0NSPRw==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.7.2.tgz", + "integrity": "sha512-9zydJV84gi0imZWdVPHHqar7yIx6wRpwRHc4aJ3pw9vov/4pAmjfEPPE5gXRtiPFf+3WqOrE4qC6ih1kBJGl9w==", "dev": true, "dependencies": { "chalk": "^2.4.2", "doctrine": "^3.0.0", - "fp-ts": "^2.9.3", + "fp-ts": "^2.13.2", "fs-extra": "^7.0.1", "glob": "^7.1.6", - "io-ts": "^2.2.13", + "io-ts": "^2.2.20", "logging-ts": "^0.3.4", "markdown-toc": "^1.2.0", "rimraf": "^2.7.1", @@ -2926,33 +2839,8 @@ "docs-ts": "lib/bin.js" }, "peerDependencies": { - "typescript": "^3.3.1 || ^4.x" - } - }, - "node_modules/docs-ts/node_modules/fp-ts": { - "version": "2.9.5", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.5.tgz", - "integrity": "sha512-MiHrA5teO6t8zKArE3DdMPT/Db6v2GUt5yfWnhBTrrsVfeCJUUnV6sgFvjGNBKDmEMqVwRFkEePL7wPwqrLKKA==", - "dev": true - }, - "node_modules/docs-ts/node_modules/glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "prettier": "^2.0.0", + "typescript": "^3.3.1 || ^4.x || ^5.x" } }, "node_modules/docs-ts/node_modules/rimraf": { @@ -3002,32 +2890,6 @@ "typescript": ">=2.7" } }, - "node_modules/doctoc": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/doctoc/-/doctoc-1.4.0.tgz", - "integrity": "sha512-8IAq3KdMkxhXCUF+xdZxdJxwuz8N2j25sMgqiu4U4JWluN9tRKMlAalxGASszQjlZaBprdD2YfXpL3VPWUD4eg==", - "dev": true, - "dependencies": { - "@textlint/markdown-to-ast": "~6.0.9", - "anchor-markdown-header": "^0.5.5", - "htmlparser2": "~3.9.2", - "minimist": "~1.2.0", - "underscore": "~1.8.3", - "update-section": "^0.3.0" - }, - "bin": { - "doctoc": "doctoc.js" - }, - "engines": { - "node": ">=0.4" - } - }, - "node_modules/doctoc/node_modules/underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -3040,53 +2902,20 @@ "node": ">=6.0.0" } }, - "node_modules/dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", - "dev": true, - "dependencies": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "node_modules/domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, "node_modules/domexception": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "webidl-conversions": "^4.0.2" } }, - "node_modules/domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, - "dependencies": { - "domelementtype": "1" - } - }, - "node_modules/domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, - "dependencies": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, "node_modules/dtslint": { "version": "0.4.4", - "resolved": "git+ssh://git@github.com/gcanti/dtslint.git#f361dc93d6a195f530df28779082548e01cecd5e", + "resolved": "git+ssh://git@github.com/gcanti/dtslint.git#1558adbeda424fec83a8d314784c18728a970cd4", "dev": true, "license": "MIT", "dependencies": { @@ -3144,75 +2973,77 @@ "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" } }, + "node_modules/dtslint/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, + "optional": true, + "peer": true, "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" } }, - "node_modules/emoji-regex": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.1.3.tgz", - "integrity": "sha1-7HmjlpsC0uzytyJUJ5v5m8eoOTI=", - "dev": true - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "dependencies": { - "ansi-colors": "^4.1.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/enquirer/node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "node_modules/electron-to-chromium": { + "version": "1.4.372", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.372.tgz", + "integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung==", "dev": true }, "node_modules/es-abstract": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", - "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", + "version": "1.21.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", + "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==", "dev": true, "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.2.0", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", - "object-inspect": "^1.7.0", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.7", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" }, "engines": { "node": ">= 0.4" @@ -3221,6 +3052,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -3238,608 +3092,711 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/escodegen": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", - "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", + "node_modules/esbuild": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", + "integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==", "dev": true, - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, + "hasInstallScript": true, "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" + "esbuild": "bin/esbuild" }, "engines": { - "node": ">=4.0" + "node": ">=12" }, "optionalDependencies": { - "source-map": "~0.6.1" + "@esbuild/android-arm": "0.15.18", + "@esbuild/linux-loong64": "0.15.18", + "esbuild-android-64": "0.15.18", + "esbuild-android-arm64": "0.15.18", + "esbuild-darwin-64": "0.15.18", + "esbuild-darwin-arm64": "0.15.18", + "esbuild-freebsd-64": "0.15.18", + "esbuild-freebsd-arm64": "0.15.18", + "esbuild-linux-32": "0.15.18", + "esbuild-linux-64": "0.15.18", + "esbuild-linux-arm": "0.15.18", + "esbuild-linux-arm64": "0.15.18", + "esbuild-linux-mips64le": "0.15.18", + "esbuild-linux-ppc64le": "0.15.18", + "esbuild-linux-riscv64": "0.15.18", + "esbuild-linux-s390x": "0.15.18", + "esbuild-netbsd-64": "0.15.18", + "esbuild-openbsd-64": "0.15.18", + "esbuild-sunos-64": "0.15.18", + "esbuild-windows-32": "0.15.18", + "esbuild-windows-64": "0.15.18", + "esbuild-windows-arm64": "0.15.18" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz", + "integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" } }, - "node_modules/eslint": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz", - "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==", + "node_modules/esbuild-android-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz", + "integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.3.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.2.0", - "esutils": "^2.0.2", - "file-entry-cache": "^6.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash": "^4.17.20", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.4", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=12" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "node_modules/esbuild-darwin-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz", + "integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=8.0.0" + "node": ">=12" } }, - "node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "node_modules/esbuild-darwin-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz", + "integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" + "node": ">=12" } }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "node_modules/esbuild-freebsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz", + "integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==", + "cpu": [ + "x64" + ], "dev": true, + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=4" + "node": ">=12" } }, - "node_modules/eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "node_modules/esbuild-freebsd-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz", + "integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==", + "cpu": [ + "arm64" + ], "dev": true, + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=10" + "node": ">=12" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/esbuild-linux-32": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz", + "integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==", + "cpu": [ + "ia32" + ], "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=12" } }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "node_modules/esbuild-linux-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz", + "integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": ">=12" } }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/esbuild-linux-arm": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz", + "integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=7.0.0" + "node": ">=12" } }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/eslint/node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "node_modules/esbuild-linux-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz", + "integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 8" + "node": ">=12" } }, - "node_modules/eslint/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "node_modules/esbuild-linux-mips64le": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz", + "integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==", + "cpu": [ + "mips64el" + ], "dev": true, - "dependencies": { - "ms": "2.1.2" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "node": ">=12" } }, - "node_modules/eslint/node_modules/globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "node_modules/esbuild-linux-ppc64le": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz", + "integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==", + "cpu": [ + "ppc64" + ], "dev": true, - "dependencies": { - "type-fest": "^0.8.1" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=12" } }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/esbuild-linux-riscv64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz", + "integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==", + "cpu": [ + "riscv64" + ], "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/eslint/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "node_modules/esbuild-linux-s390x": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz", + "integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==", + "cpu": [ + "s390x" + ], "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 4" + "node": ">=12" } }, - "node_modules/eslint/node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "node_modules/esbuild-netbsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz", + "integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, + "optional": true, + "os": [ + "netbsd" + ], "engines": { - "node": ">= 0.8.0" + "node": ">=12" } }, - "node_modules/eslint/node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", - "dev": true - }, - "node_modules/eslint/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/eslint/node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "node_modules/esbuild-openbsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz", + "integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, + "optional": true, + "os": [ + "openbsd" + ], "engines": { - "node": ">= 0.8.0" + "node": ">=12" } }, - "node_modules/eslint/node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "node_modules/esbuild-sunos-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz", + "integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==", + "cpu": [ + "x64" + ], "dev": true, + "optional": true, + "os": [ + "sunos" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/eslint/node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "node_modules/esbuild-windows-32": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz", + "integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==", + "cpu": [ + "ia32" + ], "dev": true, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">= 0.8.0" + "node": ">=12" } }, - "node_modules/eslint/node_modules/semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "node_modules/esbuild-windows-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz", + "integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=10" + "node": ">=12" } }, - "node_modules/eslint/node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "node_modules/esbuild-windows-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz", + "integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/eslint/node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, "engines": { - "node": ">=8" + "node": ">=6" } }, - "node_modules/eslint/node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=0.8.0" } }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/escodegen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", + "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "has-flag": "^4.0.0" + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" }, "engines": { - "node": ">=8" + "node": ">=4.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" } }, - "node_modules/eslint/node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" + "node_modules/eslint": { + "version": "8.39.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz", + "integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.2", + "@eslint/js": "8.39.0", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.0", + "espree": "^9.5.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" }, "engines": { - "node": ">= 0.8.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "node_modules/eslint-import-resolver-node": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz", + "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==", "dev": true, - "engines": { - "node": ">=8" + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.11.0", + "resolve": "^1.22.1" } }, - "node_modules/espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" + "ms": "^2.1.1" } }, - "node_modules/espree/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } + "node_modules/eslint-import-resolver-node/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, "engines": { "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" + "dependencies": { + "ms": "^2.1.1" } }, - "node_modules/esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "node_modules/eslint-module-utils/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/eslint-plugin-deprecation": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-deprecation/-/eslint-plugin-deprecation-1.4.1.tgz", + "integrity": "sha512-4vxTghWzxsBukPJVQupi6xlTuDc8Pyi1QlRCrFiLgwLPMJQW3cJCNaehJUKQqQFvuue5m4W27e179Y3Qjzeghg==", "dev": true, "dependencies": { - "estraverse": "^5.1.0" + "@typescript-eslint/utils": "^5.57.0", + "tslib": "^2.3.1", + "tsutils": "^3.21.0" }, - "engines": { - "node": ">=0.10" + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0", + "typescript": "^3.7.5 || ^4.0.0 || ^5.0.0" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true, - "engines": { - "node": ">=4.0" - } + "node_modules/eslint-plugin-deprecation/node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", + "dev": true }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "node_modules/eslint-plugin-deprecation/node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, "dependencies": { - "estraverse": "^5.2.0" + "tslib": "^1.8.1" }, "engines": { - "node": ">=4.0" + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "node_modules/eslint-plugin-deprecation/node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/eslint-plugin-import": { + "version": "2.27.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz", + "integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==", "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.7.4", + "has": "^1.0.3", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.6", + "resolve": "^1.22.1", + "semver": "^6.3.0", + "tsconfig-paths": "^3.14.1" + }, "engines": { - "node": ">=4.0" + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, - "engines": { - "node": ">=4.0" + "dependencies": { + "ms": "^2.1.1" } }, - "node_modules/esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, "engines": { "node": ">=0.10.0" } }, - "node_modules/exec-sh": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz", - "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==", - "dev": true - }, - "node_modules/execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=6" + "node": "*" } }, - "node_modules/exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "node_modules/eslint-plugin-import/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, - "engines": { - "node": ">= 0.8.0" + "bin": { + "semver": "bin/semver.js" } }, - "node_modules/expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "node_modules/eslint-plugin-simple-import-sort": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz", + "integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==", "dev": true, - "dependencies": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" + "peerDependencies": { + "eslint": ">=5.0.0" } }, - "node_modules/expand-brackets/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "dependencies": { - "is-descriptor": "^0.1.0" + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=8.0.0" } }, - "node_modules/expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "node_modules/eslint-visitor-keys": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", + "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", "dev": true, - "dependencies": { - "fill-range": "^2.1.0" - }, "engines": { - "node": ">=0.10.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/expect": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/expect/-/expect-25.2.7.tgz", - "integrity": "sha512-yA+U2Ph0MkMsJ9N8q5hs9WgWI6oJYfecdXta6LkP/alY/jZZL1MHlJ2wbLh60Ucqf3G+51ytbqV3mlGfmxkpNw==", + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { - "@jest/types": "^25.2.6", - "ansi-styles": "^4.0.0", - "jest-get-type": "^25.2.6", - "jest-matcher-utils": "^25.2.7", - "jest-message-util": "^25.2.6", - "jest-regex-util": "^25.2.6" + "color-convert": "^2.0.1" }, "engines": { - "node": ">= 8.3" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/expect/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/expect/node_modules/color-convert": { + "node_modules/eslint/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", @@ -3851,844 +3808,789 @@ "node": ">=7.0.0" } }, - "node_modules/expect/node_modules/color-name": { + "node_modules/eslint/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "node_modules/eslint/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "dependencies": { - "is-extendable": "^0.1.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">= 8" } }, - "node_modules/extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "node_modules/eslint/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "ms": "2.1.2" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "dependencies": { - "is-descriptor": "^1.0.0" + "node": ">=6.0" }, - "engines": { - "node": ">=0.10.0" + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/extglob/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "dependencies": { - "kind-of": "^6.0.0" - }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "dependencies": { - "kind-of": "^6.0.0" + "node": ">=10" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/extglob/node_modules/is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", "dev": true, "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">=0.10.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/extglob/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=4.0" } }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true, - "engines": [ - "node >=0.6.0" - ] - }, - "node_modules/fast-check": { - "version": "1.24.2", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-1.24.2.tgz", - "integrity": "sha512-ZL48cyZZLJnVsUj127Zi1mfFLM98yzw0LlSSH8CMeVmpL5RCfSRcZSZZ0kJWrRK4eOgNFnXXKNDbzuRb3Vsdhg==", + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "dependencies": { - "pure-rand": "^2.0.0", - "tslib": "^1.10.0" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=0.12" + "node": ">=10" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.2.tgz", - "integrity": "sha512-UDV82o4uQyljznxwMxyVRJgZZt3O5wENYojjzbaGEGZgeOxkLFf+V4cnUD+krzb2F72E18RhamkMZ7AdeggF7A==", + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "is-glob": "^4.0.3" }, "engines": { - "node": ">=8" + "node": ">=10.13.0" } }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "node_modules/fastq": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", - "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", + "node_modules/eslint/node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "dependencies": { - "reusify": "^1.0.4" + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fault": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.3.tgz", - "integrity": "sha512-sfFuP4X0hzrbGKjAUNXYvNqsZ5F6ohx/dZ9I0KQud/aiZNwg263r5L9yGB0clvXHCkzXh5W3t7RSHchggYIFmA==", + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "dependencies": { - "format": "^0.2.2" + "engines": { + "node": ">=8" } }, - "node_modules/fb-watchman": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", - "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { - "bser": "2.1.1" + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/file-entry-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz", - "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==", + "node_modules/eslint/node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "dependencies": { - "flat-cache": "^3.0.4" + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">= 0.8.0" } }, - "node_modules/fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "dependencies": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" + "p-locate": "^5.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "deprecated": "Fixed a prototype pollution security issue in 4.1.0, please upgrade to ^4.1.1 or ^5.0.1.", + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/eslint/node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", "dev": true, "dependencies": { - "is-buffer": "~2.0.3" + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" }, - "bin": { - "flat": "cli.js" + "engines": { + "node": ">= 0.8.0" } }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" + "yocto-queue": "^0.1.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/flat/node_modules/is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/flatted": { + "node_modules/eslint/node_modules/path-key": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", - "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", - "dev": true - }, - "node_modules/for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "node_modules/eslint/node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, "engines": { - "node": "*" + "node": ">= 0.8.0" } }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "node_modules/eslint/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" + "shebang-regex": "^3.0.0" }, "engines": { - "node": ">= 0.12" + "node": ">=8" } }, - "node_modules/format": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", - "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=", + "node_modules/eslint/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, "engines": { - "node": ">=0.4.x" + "node": ">=8" } }, - "node_modules/fp-ts": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.0.tgz", - "integrity": "sha512-xkC9ZKl/i2cU+8FAsdyLcTvPRXphp42FcK5WmZpB47VXb4gggC3DHlVDKNLdbC+U8zz6yp1b0bj0mZg0axmZYQ==", - "dev": true + "node_modules/eslint/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "dependencies": { - "map-cache": "^0.2.2" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "node_modules/eslint/node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "prelude-ls": "^1.2.1" }, "engines": { - "node": ">=6 <7 || >=8" + "node": ">= 0.8.0" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "deprecated": "\"Please update to latest v2.3 or v2.2\"", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "node_modules/gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, "engines": { - "node": "6.* || 8.* || >= 10.*" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "node_modules/espree": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", + "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", "dev": true, "dependencies": { - "pump": "^3.0.0" + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.0" }, "engines": { - "node": ">=6" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "node_modules/espree/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true, + "bin": { + "acorn": "bin/acorn" + }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "dependencies": { - "assert-plus": "^1.0.0" + "node": ">=0.4.0" } }, - "node_modules/glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" }, "engines": { - "node": "*" + "node": ">=4" } }, - "node_modules/glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { - "is-glob": "^4.0.1" + "estraverse": "^5.1.0" }, "engines": { - "node": ">= 6" + "node": ">=0.10" } }, - "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { - "node": ">=4" + "node": ">=4.0" } }, - "node_modules/graceful-fs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", - "dev": true - }, - "node_modules/gray-matter": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-2.1.1.tgz", - "integrity": "sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=", + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "dependencies": { - "ansi-red": "^0.1.1", - "coffee-script": "^1.12.4", - "extend-shallow": "^2.0.1", - "js-yaml": "^3.8.1", - "toml": "^2.3.2" + "estraverse": "^5.2.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=4.0" } }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", "dev": true, "engines": { - "node": ">=4.x" + "node": ">=4.0" } }, - "node_modules/growly": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", - "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true, - "optional": true - }, - "node_modules/gulp-header": { - "version": "1.8.12", - "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.12.tgz", - "integrity": "sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ==", - "deprecated": "Removed event-stream from gulp-header", + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, - "dependencies": { - "concat-with-sourcemaps": "*", - "lodash.template": "^4.4.0", - "through2": "^2.0.0" + "engines": { + "node": ">=4.0" } }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, "engines": { - "node": ">=4" + "node": ">=0.10.0" } }, - "node_modules/har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "deprecated": "this library is no longer supported", + "node_modules/expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "dependencies": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" + "fill-range": "^2.1.0" }, "engines": { - "node": ">=6" + "node": ">=0.10.0" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "dependencies": { - "function-bind": "^1.1.1" + "is-extendable": "^0.1.0" }, "engines": { - "node": ">= 0.4.0" + "node": ">=0.10.0" } }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true, - "engines": { - "node": ">=4" - } + "engines": [ + "node >=0.6.0" + ], + "optional": true, + "peer": true }, - "node_modules/has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "node_modules/fast-check": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-1.26.0.tgz", + "integrity": "sha512-B1AjSfe0bmi6FdFIzmrrGSjrsF6e2MCmZiM6zJaRbBMP+gIvdNakle5FIMKi0xbS9KlN9BZho1R7oB/qoNIQuA==", "dev": true, + "dependencies": { + "pure-rand": "^2.0.0", + "tslib": "^2.0.0" + }, "engines": { - "node": ">= 0.4" + "node": ">=0.12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/fast-check" } }, - "node_modules/has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "node_modules/fast-check/node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", + "dev": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "dependencies": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" }, "engines": { - "node": ">=0.10.0" + "node": ">=8.6.0" } }, - "node_modules/has-value/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, - "node_modules/has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "node_modules/fastq": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", "dev": true, "dependencies": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" + "reusify": "^1.0.4" } }, - "node_modules/has-values/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "dependencies": { - "kind-of": "^3.0.2" + "flat-cache": "^3.0.4" }, "engines": { - "node": ">=0.10.0" + "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/has-values/node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "node_modules/fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "dependencies": { - "is-buffer": "^1.1.5" + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" }, "engines": { "node": ">=0.10.0" } }, - "node_modules/has-values/node_modules/kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, "dependencies": { - "is-buffer": "^1.1.5" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" }, "engines": { - "node": ">=0.10.0" + "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, "bin": { - "he": "bin/he" + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, "dependencies": { - "whatwg-encoding": "^1.0.1" + "is-callable": "^1.1.3" } }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "node_modules/htmlparser2": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", - "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true, - "dependencies": { - "domelementtype": "^1.3.0", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", "dev": true, - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, + "optional": true, + "peer": true, "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" + "node": "*" } }, - "node_modules/human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, "engines": { - "node": ">=8.12.0" + "node": ">= 0.12" } }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "node_modules/fp-ts": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.14.0.tgz", + "integrity": "sha512-QLagLSYAgMA00pZzUzeksH/78Sd14y7+Gc2A8Yaja3/IpGOFMdm/gYBuDMxYqLsJ58iT5lz+bJb953RAeFfp1A==" + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dev": true, "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=6 <7 || >=8" } }, - "node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">= 4" + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", "dev": true, "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" }, "engines": { - "node": ">=6" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/import-fresh/node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true, - "engines": { - "node": ">=4" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/import-local": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", - "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, "engines": { - "node": ">=8" + "node": ">=6.9.0" } }, - "node_modules/import-path-rewrite": { - "version": "0.0.1", - "resolved": "git+ssh://git@github.com/gcanti/import-path-rewrite.git#536890c96ad6bd6d347aae08958c8404b8d51e86", - "integrity": "sha512-PtAwJ2v+eVo8iggV16kFtU04w20Al3sp3/A0k9AP4d2GOIH5czbYT0GhKLFOWr5jDfiNm1KffW22KI/RKelWpg==", + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^3.0.0", - "fp-ts": "^2.0.0", - "glob": "^7.1.6" - }, - "bin": { - "import-path-rewrite": "lib/bin.js" + "engines": { + "node": "*" } }, - "node_modules/import-path-rewrite/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/import-path-rewrite/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/import-path-rewrite/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" + "assert-plus": "^1.0.0" } }, - "node_modules/import-path-rewrite/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/import-path-rewrite/node_modules/glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, @@ -4699,492 +4601,416 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/import-path-rewrite/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, "engines": { - "node": ">=8" + "node": ">= 6" } }, - "node_modules/import-path-rewrite/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, "engines": { - "node": ">=0.8.19" + "node": ">=4" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/io-ts": { - "version": "2.2.14", - "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.14.tgz", - "integrity": "sha512-UWL1mdDe5YI4+/7YlrbsSwKmsECFFlWcVHT2CPGzeNODHj2qY0cibjulYfrfz5SCPoDAsjVP7vFKGcF+L10+SQ==", - "dev": true, - "peerDependencies": { - "fp-ts": "^2.0.0" - } - }, - "node_modules/ip-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", - "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", - "dev": true, + "define-properties": "^1.1.3" + }, "engines": { - "node": ">=4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "dependencies": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dev": true, "dependencies": { - "kind-of": "^3.0.2" + "get-intrinsic": "^1.1.3" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-alphabetical": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.3.tgz", - "integrity": "sha512-eEMa6MKpHFzw38eKm56iNNi6GJ7lf6aLLio7Kr23sJPAECscgRtZvOBYybejWDQ2bM949Y++61PY+udzj5QMLA==", + "node_modules/graceful-fs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", "dev": true }, - "node_modules/is-alphanumerical": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.3.tgz", - "integrity": "sha512-A1IGAPO5AW9vSh7omxIlOGwIqEvpW/TA+DksVOPM5ODuxKlZS09+TEM1E3275lJqO2oJ38vDpeAL3DCIiHE6eA==", - "dev": true, - "dependencies": { - "is-alphabetical": "^1.0.0", - "is-decimal": "^1.0.0" - } + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "node_modules/gray-matter": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-2.1.1.tgz", + "integrity": "sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=", "dev": true, "dependencies": { - "binary-extensions": "^2.0.0" + "ansi-red": "^0.1.1", + "coffee-script": "^1.12.4", + "extend-shallow": "^2.0.1", + "js-yaml": "^3.8.1", + "toml": "^2.3.2" }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "node_modules/is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=4.x" } }, - "node_modules/is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "node_modules/gulp-header": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.12.tgz", + "integrity": "sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ==", + "deprecated": "Removed event-stream from gulp-header", "dev": true, "dependencies": { - "ci-info": "^2.0.0" - }, - "bin": { - "is-ci": "bin.js" + "concat-with-sourcemaps": "*", + "lodash.template": "^4.4.0", + "through2": "^2.0.0" } }, - "node_modules/is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, + "optional": true, + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "node_modules/har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "deprecated": "this library is no longer supported", "dev": true, - "engines": { - "node": ">= 0.4" + "optional": true, + "peer": true, + "dependencies": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=6" } }, - "node_modules/is-decimal": { + "node_modules/has": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.3.tgz", - "integrity": "sha512-bvLSwoDg2q6Gf+E2LEPiklHZxxiSi3XAh4Mav65mKqTfCO1HM3uBs24TjEH8iJX3bbDdLXKJXBTmGzuTUuAEjQ==", - "dev": true - }, - "node_modules/is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "function-bind": "^1.1.1" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4.0" } }, - "node_modules/is-descriptor/node_modules/kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "node_modules/has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, "engines": { "node": ">=0.10.0" } }, - "node_modules/is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "node_modules/has-ansi/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", "dev": true, "engines": { "node": ">=0.10.0" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-fullwidth-code-point": { + "node_modules/has-flag": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true, "engines": { - "node": ">=8" + "node": ">=4" } }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", "dev": true, - "engines": { - "node": ">=6" + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-hexadecimal": { + "node_modules/has-symbols": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.3.tgz", - "integrity": "sha512-zxQ9//Q3D/34poZf8fiy3m3XVpbQc7ren15iKqrTtLPwkPD/t3Scy9Imp63FujULGxuK0ZlCwoo5xNpktFgbOA==", - "dev": true - }, - "node_modules/is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", "dev": true, "dependencies": { - "kind-of": "^3.0.2" + "has-symbols": "^1.0.2" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "node_modules/he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha512-z/GDPjlRMNOa2XJiB4em8wJpuuBfrFOlYKTZxtpkdr1uPdibHI8rYA3MY0KDObpVyaes0e/aunid/t88ZI2EKA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "bin": { + "he": "bin/he" } }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "node_modules/html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" + "whatwg-encoding": "^1.0.1" } }, - "node_modules/is-plain-object/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=0.8", + "npm": ">=1.3.7" } }, - "node_modules/is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "has": "^1.0.3" + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dev": true, - "dependencies": { - "is-unc-path": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">= 4" } }, - "node_modules/is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "dependencies": { - "has-symbols": "^1.0.1" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=6" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "node_modules/is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dev": true, - "dependencies": { - "unc-path-regex": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-whitespace-character": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.3.tgz", - "integrity": "sha512-SNPgMLz9JzPccD3nPctcj8sZlX9DAMJSKH8bP7Z6bohCwuNgX8xbWr1eTAYXX9Vpi/aSn8Y1akL9WgM3t43YNQ==", - "dev": true - }, - "node_modules/is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-word-character": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.3.tgz", - "integrity": "sha512-0wfcrFgOOOBdgRNT9H33xe6Zi6yhX/uoc4U8NBZGeQQB0ctU1dnlNTyL9JM2646bHDTpsDm1Brb3VPoCIMrd/A==", - "dev": true - }, - "node_modules/is-wsl": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.1.1.tgz", - "integrity": "sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog==", + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, - "optional": true, "engines": { - "node": ">=8" + "node": ">=4" } }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "node_modules/isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "node_modules/import-path-rewrite": { + "version": "0.0.1", + "resolved": "git+ssh://git@github.com/gcanti/import-path-rewrite.git#536890c96ad6bd6d347aae08958c8404b8d51e86", "dev": true, + "license": "MIT", "dependencies": { - "isarray": "1.0.0" + "chalk": "^3.0.0", + "fp-ts": "^2.0.0", + "glob": "^7.1.6" }, - "engines": { - "node": ">=0.10.0" + "bin": { + "import-path-rewrite": "lib/bin.js" } }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", - "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "node_modules/import-path-rewrite/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/istanbul-lib-instrument": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz", - "integrity": "sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg==", + "node_modules/import-path-rewrite/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "dependencies": { - "@babel/core": "^7.7.5", - "@babel/parser": "^7.7.5", - "@babel/template": "^7.7.4", - "@babel/traverse": "^7.7.4", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { "node": ">=8" } }, - "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "node_modules/import-path-rewrite/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" + "color-name": "~1.1.4" }, "engines": { - "node": ">=8" + "node": ">=7.0.0" } }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { + "node_modules/import-path-rewrite/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/import-path-rewrite/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", @@ -5193,10 +5019,10 @@ "node": ">=8" } }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/import-path-rewrite/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "dependencies": { "has-flag": "^4.0.0" @@ -5205,622 +5031,459 @@ "node": ">=8" } }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", - "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true, - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, "engines": { - "node": ">=8" + "node": ">=0.8.19" } }, - "node_modules/istanbul-lib-source-maps/node_modules/debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "dependencies": { - "ms": "^2.1.1" + "once": "^1.3.0", + "wrappy": "1" } }, - "node_modules/istanbul-lib-source-maps/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "node_modules/istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "node_modules/internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", "dev": true, "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" }, "engines": { - "node": ">=8" + "node": ">= 0.4" } }, - "node_modules/jest": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest/-/jest-25.2.7.tgz", - "integrity": "sha512-XV1n/CE2McCikl4tfpCY950RytHYvxdo/wvtgmn/qwA8z1s16fuvgFL/KoPrrmkqJTaPMUlLVE58pwiaTX5TdA==", + "node_modules/io-ts": { + "version": "2.2.20", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.20.tgz", + "integrity": "sha512-Rq2BsYmtwS5vVttie4rqrOCIfHCS9TgpRLFpKQCM1wZBBRY9nWVGmEvm2FnDbSE2un1UE39DvFpTR5UL47YDcA==", "dev": true, - "dependencies": { - "@jest/core": "^25.2.7", - "import-local": "^3.0.2", - "jest-cli": "^25.2.7" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": ">= 8.3" + "peerDependencies": { + "fp-ts": "^2.5.0" } }, - "node_modules/jest-changed-files": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.2.6.tgz", - "integrity": "sha512-F7l2m5n55jFnJj4ItB9XbAlgO+6umgvz/mdK76BfTd2NGkvGf9x96hUXP/15a1K0k14QtVOoutwpRKl360msvg==", + "node_modules/ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", "dev": true, - "dependencies": { - "@jest/types": "^25.2.6", - "execa": "^3.2.0", - "throat": "^5.0.0" - }, + "optional": true, + "peer": true, "engines": { - "node": ">= 8.3" + "node": ">=4" } }, - "node_modules/jest-changed-files/node_modules/cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "node_modules/is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" }, "engines": { - "node": ">= 8" + "node": ">=0.10.0" } }, - "node_modules/jest-changed-files/node_modules/execa": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", - "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", "dev": true, "dependencies": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "p-finally": "^2.0.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" }, - "engines": { - "node": "^8.12.0 || >=9.7.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-changed-files/node_modules/get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", "dev": true, "dependencies": { - "pump": "^3.0.0" + "has-bigints": "^1.0.1" }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-changed-files/node_modules/is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-changed-files/node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", "dev": true, "dependencies": { - "path-key": "^3.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-changed-files/node_modules/p-finally": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", - "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", - "dev": true, - "engines": { - "node": ">=8" - } + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true }, - "node_modules/jest-changed-files/node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-changed-files/node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "node_modules/is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", "dev": true, "dependencies": { - "shebang-regex": "^3.0.0" + "has": "^1.0.3" }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-changed-files/node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-config": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.2.7.tgz", - "integrity": "sha512-rIdPPXR6XUxi+7xO4CbmXXkE6YWprvlKc4kg1SrkCL2YV5m/8MkHstq9gBZJ19Qoa3iz/GP+0sTG/PcIwkFojg==", + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "dev": true, "dependencies": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^25.2.7", - "@jest/types": "^25.2.6", - "babel-jest": "^25.2.6", - "chalk": "^3.0.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.1", - "jest-environment-jsdom": "^25.2.6", - "jest-environment-node": "^25.2.6", - "jest-get-type": "^25.2.6", - "jest-jasmine2": "^25.2.7", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "micromatch": "^4.0.2", - "pretty-format": "^25.2.6", - "realpath-native": "^2.0.0" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">= 8.3" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-config/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=0.10.0" } }, - "node_modules/jest-config/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-config/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "is-extglob": "^2.1.1" }, "engines": { - "node": ">=7.0.0" + "node": ">=0.10.0" } }, - "node_modules/jest-config/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-config/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", "dev": true, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-config/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.2.6.tgz", - "integrity": "sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==", + "node_modules/is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "dependencies": { - "chalk": "^3.0.0", - "diff-sequences": "^25.2.6", - "jest-get-type": "^25.2.6", - "pretty-format": "^25.2.6" + "kind-of": "^3.0.2" }, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-diff/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, "engines": { "node": ">=8" } }, - "node_modules/jest-diff/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "isobject": "^3.0.1" }, "engines": { - "node": ">=7.0.0" + "node": ">=0.10.0" } }, - "node_modules/jest-diff/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-diff/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/is-plain-object/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-diff/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-docblock": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.2.6.tgz", - "integrity": "sha512-VAYrljEq0upq0oERfIaaNf28gC6p9gORndhHstCYF8NWGNQJnzoaU//S475IxfWMk4UjjVmS9rJKLe5Jjjbixw==", + "node_modules/is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "dependencies": { - "detect-newline": "^3.0.0" + "is-unc-path": "^1.0.0" }, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-each": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.2.6.tgz", - "integrity": "sha512-OgQ01VINaRD6idWJOhCYwUc5EcgHBiFlJuw+ON2VgYr7HLtMFyCcuo+3mmBvuLUH4QudREZN7cDCZviknzsaJQ==", + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", "dev": true, "dependencies": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "jest-get-type": "^25.2.6", - "jest-util": "^25.2.6", - "pretty-format": "^25.2.6" + "call-bind": "^1.0.2" }, - "engines": { - "node": ">= 8.3" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-each/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-each/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "has-symbols": "^1.0.2" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-each/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-each/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-each/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true, - "engines": { - "node": ">=8" - } + "optional": true, + "peer": true }, - "node_modules/jest-each/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "unc-path-regex": "^0.1.2" }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-environment-jsdom": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.2.6.tgz", - "integrity": "sha512-/o7MZIhGmLGIEG5j7r5B5Az0umWLCHU+F5crwfbm0BzC4ybHTJZOQTFQWhohBg+kbTCNOuftMcqHlVkVduJCQQ==", + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, "dependencies": { - "@jest/environment": "^25.2.6", - "@jest/fake-timers": "^25.2.6", - "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "jsdom": "^15.2.1" + "call-bind": "^1.0.2" }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-environment-node": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.2.6.tgz", - "integrity": "sha512-D1Ihj14fxZiMHGeTtU/LunhzSI+UeBvlr/rcXMTNyRMUMSz2PEhuqGbB78brBY6Dk3FhJDk7Ta+8reVaGjLWhA==", + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "dev": true, "dependencies": { - "@jest/environment": "^25.2.6", - "@jest/fake-timers": "^25.2.6", - "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "semver": "^6.3.0" + "isarray": "1.0.0" }, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-environment-node/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/jest-get-type": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-25.2.6.tgz", - "integrity": "sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==", - "dev": true, - "engines": { - "node": ">= 8.3" - } - }, - "node_modules/jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", - "dev": true, - "dependencies": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - }, - "engines": { - "node": ">= 8.3" - }, - "optionalDependencies": { - "fsevents": "^2.1.2" - } - }, - "node_modules/jest-haste-map/node_modules/graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "node_modules/jest-jasmine2": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.2.7.tgz", - "integrity": "sha512-HeQxEbonp8fUvik9jF0lkU9ab1u5TQdIb7YSU9Fj7SxWtqHNDGyCpF6ZZ3r/5yuertxi+R95Ba9eA91GMQ38eA==", + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true, - "dependencies": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^25.2.6", - "@jest/source-map": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "co": "^4.6.0", - "expect": "^25.2.7", - "is-generator-fn": "^2.0.0", - "jest-each": "^25.2.6", - "jest-matcher-utils": "^25.2.7", - "jest-message-util": "^25.2.6", - "jest-runtime": "^25.2.7", - "jest-snapshot": "^25.2.7", - "jest-util": "^25.2.6", - "pretty-format": "^25.2.6", - "throat": "^5.0.0" - }, - "engines": { - "node": ">= 8.3" - } + "optional": true, + "peer": true }, - "node_modules/jest-jasmine2/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/jest-jasmine2/node_modules/chalk": { + "node_modules/istanbul-lib-report": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", "supports-color": "^7.1.0" }, "engines": { "node": ">=8" } }, - "node_modules/jest-jasmine2/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-jasmine2/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-jasmine2/node_modules/has-flag": { + "node_modules/istanbul-lib-report/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", @@ -5829,7 +5492,7 @@ "node": ">=8" } }, - "node_modules/jest-jasmine2/node_modules/supports-color": { + "node_modules/istanbul-lib-report/node_modules/supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", @@ -5841,8185 +5504,5131 @@ "node": ">=8" } }, - "node_modules/jest-leak-detector": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-25.2.6.tgz", - "integrity": "sha512-n+aJUM+j/x1kIaPVxzerMqhAUuqTU1PL5kup46rXh+l9SP8H6LqECT/qD1GrnylE1L463/0StSPkH4fUpkuEjA==", + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", "dev": true, "dependencies": { - "jest-get-type": "^25.2.6", - "pretty-format": "^25.2.6" + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" }, "engines": { - "node": ">= 8.3" + "node": ">=10" } }, - "node_modules/jest-matcher-utils": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-25.2.7.tgz", - "integrity": "sha512-jNYmKQPRyPO3ny0KY1I4f0XW4XnpJ3Nx5ovT4ik0TYDOYzuXJW40axqOyS61l/voWbVT9y9nZ1THL1DlpaBVpA==", + "node_modules/istanbul-lib-source-maps/node_modules/debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", "dev": true, "dependencies": { - "chalk": "^3.0.0", - "jest-diff": "^25.2.6", - "jest-get-type": "^25.2.6", - "pretty-format": "^25.2.6" - }, - "engines": { - "node": ">= 8.3" + "ms": "^2.1.1" } }, - "node_modules/jest-matcher-utils/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/istanbul-lib-source-maps/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/jest-matcher-utils/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/js-sdsl": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", + "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" } }, - "node_modules/jest-matcher-utils/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.8" } }, - "node_modules/jest-matcher-utils/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-matcher-utils/node_modules/has-flag": { + "node_modules/js-tokens": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, - "node_modules/jest-matcher-utils/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" }, - "engines": { - "node": ">=8" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jest-message-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-25.2.6.tgz", - "integrity": "sha512-Hgg5HbOssSqOuj+xU1mi7m3Ti2nwSQJQf/kxEkrz2r2rp2ZLO1pMeKkz2WiDUWgSR+APstqz0uMFcE5yc0qdcg==", + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@jest/types": "^25.2.6", - "@types/stack-utils": "^1.0.1", - "chalk": "^3.0.0", - "micromatch": "^4.0.2", - "slash": "^3.0.0", - "stack-utils": "^1.0.1" - }, - "engines": { - "node": ">= 8.3" - } + "optional": true, + "peer": true }, - "node_modules/jest-message-util/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/jsdom": { + "version": "15.2.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", + "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "abab": "^2.0.0", + "acorn": "^7.1.0", + "acorn-globals": "^4.3.2", + "array-equal": "^1.0.0", + "cssom": "^0.4.1", + "cssstyle": "^2.0.0", + "data-urls": "^1.1.0", + "domexception": "^1.0.1", + "escodegen": "^1.11.1", + "html-encoding-sniffer": "^1.0.2", + "nwsapi": "^2.2.0", + "parse5": "5.1.0", + "pn": "^1.1.0", + "request": "^2.88.0", + "request-promise-native": "^1.0.7", + "saxes": "^3.1.9", + "symbol-tree": "^3.2.2", + "tough-cookie": "^3.0.1", + "w3c-hr-time": "^1.0.1", + "w3c-xmlserializer": "^1.1.2", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^7.0.0", + "ws": "^7.0.0", + "xml-name-validator": "^3.0.0" }, "engines": { "node": ">=8" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } } }, - "node_modules/jest-message-util/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "bin": { + "jsesc": "bin/jsesc" }, "engines": { - "node": ">=8" + "node": ">=4" } }, - "node_modules/jest-message-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } + "optional": true, + "peer": true }, - "node_modules/jest-message-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "node_modules/jest-message-util/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true, - "engines": { - "node": ">=8" - } + "optional": true, + "peer": true }, - "node_modules/jest-message-util/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" + "bin": { + "json5": "lib/cli.js" }, "engines": { - "node": ">=8" + "node": ">=6" } }, - "node_modules/jest-mock": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-25.2.6.tgz", - "integrity": "sha512-vc4nibavi2RGPdj/MyZy/azuDjZhpYZLvpfgq1fxkhbyTpKVdG7CgmRVKJ7zgLpY5kuMjTzDYA6QnRwhsCU+tA==", + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, - "dependencies": { - "@jest/types": "^25.2.6" - }, - "engines": { - "node": ">= 8.3" + "optionalDependencies": { + "graceful-fs": "^4.1.6" } }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", - "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==", + "node_modules/jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "dev": true, - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" - }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } + "engines": [ + "node >=0.6.0" + ], + "optional": true, + "peer": true, + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" } }, - "node_modules/jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, + "dependencies": { + "is-buffer": "^1.1.5" + }, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-resolve": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-25.2.6.tgz", - "integrity": "sha512-7O61GVdcAXkLz/vNGKdF+00A80/fKEAA47AEXVNcZwj75vEjPfZbXDaWFmAQCyXj4oo9y9dC9D+CLA11t8ieGw==", + "node_modules/lazy-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", + "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", "dev": true, "dependencies": { - "@jest/types": "^25.2.6", - "browser-resolve": "^1.11.3", - "chalk": "^3.0.0", - "jest-pnp-resolver": "^1.2.1", - "realpath-native": "^2.0.0", - "resolve": "^1.15.1" + "set-getter": "^0.1.0" }, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-resolve-dependencies": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.2.7.tgz", - "integrity": "sha512-IrnMzCAh11Xd2gAOJL+ThEW6QO8DyqNdvNkQcaCticDrOAr9wtKT7yT6QBFFjqKFgjjvaVKDs59WdgUhgYnHnQ==", + "node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "@jest/types": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-snapshot": "^25.2.7" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" }, "engines": { - "node": ">= 8.3" + "node": ">= 0.8.0" } }, - "node_modules/jest-resolve/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/list-item": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/list-item/-/list-item-1.1.1.tgz", + "integrity": "sha1-DGXQDih8tmPMs8s4Sad+iewmilY=", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "expand-range": "^1.8.1", + "extend-shallow": "^2.0.1", + "is-number": "^2.1.0", + "repeat-string": "^1.5.2" }, "engines": { - "node": ">=8" + "node": ">=0.10.0" + } + }, + "node_modules/local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true, + "engines": { + "node": ">=14" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/jest-resolve/node_modules/chalk": { + "node_modules/lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "node_modules/lodash._reinterpolate": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/lodash.template": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", + "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" + "lodash._reinterpolate": "^3.0.0", + "lodash.templatesettings": "^4.0.0" } }, - "node_modules/jest-resolve/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/lodash.templatesettings": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", + "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", "dev": true, "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" + "lodash._reinterpolate": "^3.0.0" } }, - "node_modules/jest-resolve/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-resolve/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/logging-ts": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/logging-ts/-/logging-ts-0.3.4.tgz", + "integrity": "sha512-TJYaSB88h8N9/ojruoGZgJeQEwpLmDNWpGf03hDgjPNo5QnwO28vkSH/H8/9aMoX8zeShVJUOnKRM6zs5ifR0A==", "dev": true, - "engines": { - "node": ">=8" + "peerDependencies": { + "fp-ts": "^2.0.5" } }, - "node_modules/jest-resolve/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" + "get-func-name": "^2.0.0" } }, - "node_modules/jest-runner": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.2.7.tgz", - "integrity": "sha512-RFEr71nMrtNwcpoHzie5+fe1w3JQCGMyT2xzNwKe3f88+bK+frM2o1v24gEcPxQ2QqB3COMCe2+1EkElP+qqqQ==", + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "dependencies": { - "@jest/console": "^25.2.6", - "@jest/environment": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.3", - "jest-config": "^25.2.7", - "jest-docblock": "^25.2.6", - "jest-haste-map": "^25.2.6", - "jest-jasmine2": "^25.2.7", - "jest-leak-detector": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-runtime": "^25.2.7", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "source-map-support": "^0.5.6", - "throat": "^5.0.0" + "yallist": "^4.0.0" }, "engines": { - "node": ">= 8.3" + "node": ">=10" } }, - "node_modules/jest-runner/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/magic-string": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz", + "integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "@jridgewell/sourcemap-codec": "^1.4.13" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=12" } }, - "node_modules/jest-runner/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "semver": "^6.0.0" }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/jest-runner/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" + "bin": { + "semver": "bin/semver.js" } }, - "node_modules/jest-runner/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-runner/node_modules/graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "node_modules/make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", "dev": true }, - "node_modules/jest-runner/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/markdown-link": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/markdown-link/-/markdown-link-0.1.1.tgz", + "integrity": "sha1-MsXGUZmmRXMWMi0eQinRNAfIx88=", "dev": true, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-runner/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/markdown-toc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/markdown-toc/-/markdown-toc-1.2.0.tgz", + "integrity": "sha512-eOsq7EGd3asV0oBfmyqngeEIhrbkc7XVP63OwcJBIhH2EpG2PzFcbZdhy1jutXSlRBBVMNXHvMtSr5LAxSUvUg==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "concat-stream": "^1.5.2", + "diacritics-map": "^0.1.0", + "gray-matter": "^2.1.0", + "lazy-cache": "^2.0.2", + "list-item": "^1.1.1", + "markdown-link": "^0.1.1", + "minimist": "^1.2.0", + "mixin-deep": "^1.1.3", + "object.pick": "^1.2.0", + "remarkable": "^1.7.1", + "repeat-string": "^1.6.1", + "strip-color": "^0.1.0" + }, + "bin": { + "markdown-toc": "cli.js" }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-runtime": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.2.7.tgz", - "integrity": "sha512-Gw3X8KxTTFylu2T/iDSNKRUQXQiPIYUY0b66GwVYa7W8wySkUljKhibQHSq0VhmCAN7vRBEQjlVQ+NFGNmQeBw==", + "node_modules/math-random": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", + "dev": true + }, + "node_modules/md5-hex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", + "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", "dev": true, "dependencies": { - "@jest/console": "^25.2.6", - "@jest/environment": "^25.2.6", - "@jest/source-map": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.3", - "jest-config": "^25.2.7", - "jest-haste-map": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-snapshot": "^25.2.7", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0", - "yargs": "^15.3.1" - }, - "bin": { - "jest-runtime": "bin/jest-runtime.js" + "blueimp-md5": "^2.10.0" }, "engines": { - "node": ">= 8.3" + "node": ">=8" } }, - "node_modules/jest-runtime/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">= 8" } }, - "node_modules/jest-runtime/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": ">=8" + "node": ">=8.6" } }, - "node_modules/jest-runtime/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "optional": true, + "peer": true, "engines": { - "node": ">=7.0.0" + "node": ">= 0.6" } }, - "node_modules/jest-runtime/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-runtime/node_modules/graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "node_modules/jest-runtime/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "mime-db": "1.43.0" + }, "engines": { - "node": ">=8" + "node": ">= 0.6" } }, - "node_modules/jest-runtime/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "dev": true, + "dependencies": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-snapshot": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-25.2.7.tgz", - "integrity": "sha512-Rm8k7xpGM4tzmYhB6IeRjsOMkXaU8/FOz5XlU6oYwhy53mq6txVNqIKqN1VSiexzpC80oWVxVDfUDt71M6XPOA==", + "node_modules/mixin-deep/node_modules/is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "dependencies": { - "@babel/types": "^7.0.0", - "@jest/types": "^25.2.6", - "@types/prettier": "^1.19.0", - "chalk": "^3.0.0", - "expect": "^25.2.7", - "jest-diff": "^25.2.6", - "jest-get-type": "^25.2.6", - "jest-matcher-utils": "^25.2.7", - "jest-message-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "make-dir": "^3.0.0", - "natural-compare": "^1.4.0", - "pretty-format": "^25.2.6", - "semver": "^6.3.0" + "is-plain-object": "^2.0.4" }, "engines": { - "node": ">= 8.3" + "node": ">=0.10.0" } }, - "node_modules/jest-snapshot/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" + "minimist": "^1.2.5" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "bin": { + "mkdirp": "bin/cmd.js" } }, - "node_modules/jest-snapshot/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/mlly": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.2.0.tgz", + "integrity": "sha512-+c7A3CV0KGdKcylsI6khWyts/CYrGTrRVo4R/I7u/cUsy0Conxa6LUhiEzVKIw14lc2L5aiO4+SeVe4TeGRKww==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "acorn": "^8.8.2", + "pathe": "^1.1.0", + "pkg-types": "^1.0.2", + "ufo": "^1.1.1" + } + }, + "node_modules/mlly/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" }, "engines": { - "node": ">=8" + "node": ">=0.4.0" } }, - "node_modules/jest-snapshot/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" }, "engines": { - "node": ">=7.0.0" + "node": ">= 4.0.0" } }, - "node_modules/jest-snapshot/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "node_modules/mocha/node_modules/commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, - "node_modules/jest-snapshot/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/mocha/node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, - "engines": { - "node": ">=8" + "dependencies": { + "ms": "2.0.0" } }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "node_modules/mocha/node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true, - "bin": { - "semver": "bin/semver.js" + "engines": { + "node": ">=0.3.1" } }, - "node_modules/jest-snapshot/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/mocha/node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "node_modules/mocha/node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", + "dev": true + }, + "node_modules/mocha/node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", "dev": true, "dependencies": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" + "minimist": "0.0.8" }, - "engines": { - "node": ">= 8.3" + "bin": { + "mkdirp": "bin/cmd.js" } }, - "node_modules/jest-util/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/mocha/node_modules/supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "has-flag": "^3.0.0" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=4" } }, - "node_modules/jest-util/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/multimatch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", + "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/jest-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" }, "engines": { - "node": ">=7.0.0" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/jest-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node_modules/jest-util/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", + "dev": true + }, + "node_modules/nwsapi": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", + "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true, + "optional": true, + "peer": true, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/jest-util/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-validate": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-25.2.6.tgz", - "integrity": "sha512-a4GN7hYbqQ3Rt9iHsNLFqQz7HDV7KiRPCwPgo5nqtTIWNZw7gnT8KchG+Riwh+UTSn8REjFCodGp50KX/fRNgQ==", + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true, - "dependencies": { - "@jest/types": "^25.2.6", - "camelcase": "^5.3.1", - "chalk": "^3.0.0", - "jest-get-type": "^25.2.6", - "leven": "^3.1.0", - "pretty-format": "^25.2.6" - }, "engines": { - "node": ">= 8.3" + "node": ">= 0.4" } }, - "node_modules/jest-validate/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-validate/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-validate/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "isobject": "^3.0.1" }, "engines": { - "node": ">=7.0.0" + "node": ">=0.10.0" } }, - "node_modules/jest-validate/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-validate/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/object.pick/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-validate/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/object.values": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", + "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-watcher": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-25.2.7.tgz", - "integrity": "sha512-RdHuW+f49tahWtluTnUdZ2iPliebleROI2L/J5phYrUS6DPC9RB3SuUtqYyYhGZJsbvRSuLMIlY/cICJ+PIecw==", + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "dependencies": { - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "jest-util": "^25.2.6", - "string-length": "^3.1.0" - }, - "engines": { - "node": ">= 8.3" + "wrappy": "1" } }, - "node_modules/jest-watcher/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">= 0.8.0" } }, - "node_modules/jest-watcher/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "callsites": "^3.0.0" }, "engines": { - "node": ">=8" + "node": ">=6" } }, - "node_modules/jest-watcher/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/parse5": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", + "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } + "optional": true, + "peer": true }, - "node_modules/jest-watcher/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "node_modules/parsimmon": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz", + "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==", "dev": true }, - "node_modules/jest-watcher/node_modules/has-flag": { + "node_modules/path-exists": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "engines": { "node": ">=8" } }, - "node_modules/jest-watcher/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", - "dev": true, - "dependencies": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">= 8.3" - } + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true }, - "node_modules/jest-worker/node_modules/has-flag": { + "node_modules/path-type": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, "engines": { "node": ">=8" } }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "node_modules/pathe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.0.tgz", + "integrity": "sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/jest/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": ">=8.6" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/jest/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "node_modules/pkg-types": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.2.tgz", + "integrity": "sha512-hM58GKXOcj8WTqUXnsQyJYXdeAPbythQgEF3nTcEo+nkD49chjQ9IKm/QJy9xf6JakXptz86h7ecP2024rrLaQ==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" + "jsonc-parser": "^3.2.0", + "mlly": "^1.1.1", + "pathe": "^1.1.0" } }, - "node_modules/jest/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/platform": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.5.tgz", + "integrity": "sha512-TuvHS8AOIZNAlE77WUDiR4rySV/VMptyMfcfeoMgs4P8apaZM3JrnbzBiixKUv+XR6i+BXrQh8WAnjaSPFO65Q==", + "dev": true + }, + "node_modules/pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/postcss": { + "version": "8.4.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", + "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "dependencies": { - "color-name": "~1.1.4" + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" }, "engines": { - "node": ">=7.0.0" + "node": "^10 || ^12 || >=14" } }, - "node_modules/jest/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true, + "optional": true, + "peer": true, "engines": { - "node": ">=8" + "node": ">= 0.8.0" } }, - "node_modules/jest/node_modules/jest-cli": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.2.7.tgz", - "integrity": "sha512-OOAZwY4Jkd3r5WhVM5L3JeLNFaylvHUczMLxQDVLrrVyb1Cy+DNJ6MVsb5TLh6iBklB42m5TOP+IbOgKGGOtMw==", + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, - "dependencies": { - "@jest/core": "^25.2.7", - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "import-local": "^3.0.2", - "is-ci": "^2.0.0", - "jest-config": "^25.2.7", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "prompts": "^2.0.1", - "realpath-native": "^2.0.0", - "yargs": "^15.3.1" - }, "bin": { - "jest": "bin/jest.js" + "prettier": "bin-prettier.js" }, "engines": { - "node": ">= 8.3" - } - }, - "node_modules/jest/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" + "node": ">=10.13.0" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, - "node_modules/js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true + "optional": true, + "peer": true }, - "node_modules/jsdom": { - "version": "15.2.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", - "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true, - "dependencies": { - "abab": "^2.0.0", - "acorn": "^7.1.0", - "acorn-globals": "^4.3.2", - "array-equal": "^1.0.0", - "cssom": "^0.4.1", - "cssstyle": "^2.0.0", - "data-urls": "^1.1.0", - "domexception": "^1.0.1", - "escodegen": "^1.11.1", - "html-encoding-sniffer": "^1.0.2", - "nwsapi": "^2.2.0", - "parse5": "5.1.0", - "pn": "^1.1.0", - "request": "^2.88.0", - "request-promise-native": "^1.0.7", - "saxes": "^3.1.9", - "symbol-tree": "^3.2.2", - "tough-cookie": "^3.0.1", - "w3c-hr-time": "^1.0.1", - "w3c-xmlserializer": "^1.1.2", - "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.5", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^7.0.0", - "ws": "^7.0.0", - "xml-name-validator": "^3.0.0" - }, "engines": { - "node": ">=8" - }, - "peerDependencies": { - "canvas": "^2.5.0" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } + "node": ">=6" } }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "node_modules/pure-rand": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-2.0.0.tgz", + "integrity": "sha512-mk98aayyd00xbfHgE3uEmAUGzz3jCdm8Mkf5DUXUhc7egmOaGG2D7qhVlynGenNe9VaNJZvzO9hkc8myuTkDgw==", + "dev": true + }, + "node_modules/qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true, - "bin": { - "jsesc": "bin/jsesc" - }, + "optional": true, + "peer": true, "engines": { - "node": ">=4" + "node": ">=0.6" } }, - "node_modules/json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "node_modules/json5": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", - "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "node_modules/randomatic": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", "dev": true, "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "json5": "lib/cli.js" + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" }, "engines": { - "node": ">=6" + "node": ">= 0.10.0" } }, - "node_modules/jsonfile": { + "node_modules/randomatic/node_modules/is-number": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "node_modules/randomatic/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, - "engines": [ - "node >=0.6.0" - ], "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "node_modules/regexp.prototype.flags": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz", + "integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==", "dev": true, "dependencies": { - "is-buffer": "^1.1.5" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "functions-have-names": "^1.2.3" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "node_modules/remarkable": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/remarkable/-/remarkable-1.7.4.tgz", + "integrity": "sha512-e6NKUXgX95whv7IgddywbeN/ItCkWbISmc2DiqHJb0wTrqZIexqdco5b8Z3XZoo/48IdNVKM9ZCvTPJ4F5uvhg==", "dev": true, + "dependencies": { + "argparse": "^1.0.10", + "autolinker": "~0.28.0" + }, + "bin": { + "remarkable": "bin/remarkable.js" + }, "engines": { - "node": ">=6" + "node": ">= 0.10.0" } }, - "node_modules/lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "node_modules/repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", "dev": true, - "dependencies": { - "set-getter": "^0.1.0" - }, "engines": { "node": ">=0.10.0" } }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true, "engines": { - "node": ">=6" + "node": ">=0.10" } }, - "node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 6" } }, - "node_modules/list-item": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/list-item/-/list-item-1.1.1.tgz", - "integrity": "sha1-DGXQDih8tmPMs8s4Sad+iewmilY=", + "node_modules/request-promise-core": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "expand-range": "^1.8.1", - "extend-shallow": "^2.0.1", - "is-number": "^2.1.0", - "repeat-string": "^1.5.2" + "lodash": "^4.17.15" }, "engines": { "node": ">=0.10.0" + }, + "peerDependencies": { + "request": "^2.34" } }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, + "node_modules/request-promise-native": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", + "deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142", + "dev": true, + "optional": true, + "peer": true, "dependencies": { - "p-locate": "^4.1.0" + "request-promise-core": "1.1.3", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" }, "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, - "node_modules/lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, - "node_modules/lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", - "dev": true - }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", - "dev": true - }, - "node_modules/lodash.template": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", - "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", - "dev": true, - "dependencies": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" + "node": ">=0.12.0" + }, + "peerDependencies": { + "request": "^2.34" } }, - "node_modules/lodash.templatesettings": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", - "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", + "node_modules/request-promise-native/node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "lodash._reinterpolate": "^3.0.0" + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" } }, - "node_modules/log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "node_modules/request/node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "chalk": "^2.4.2" + "psl": "^1.1.28", + "punycode": "^2.1.1" }, "engines": { - "node": ">=8" + "node": ">=0.8" } }, - "node_modules/logging-ts": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/logging-ts/-/logging-ts-0.3.4.tgz", - "integrity": "sha512-TJYaSB88h8N9/ojruoGZgJeQEwpLmDNWpGf03hDgjPNo5QnwO28vkSH/H8/9aMoX8zeShVJUOnKRM6zs5ifR0A==", + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", "dev": true, - "peerDependencies": { - "fp-ts": "^2.0.5" + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, - "dependencies": { - "@sinonjs/commons": "^1.7.0" + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "dependencies": { - "yallist": "^4.0.0" + "glob": "^7.0.5" }, - "engines": { - "node": ">=10" + "bin": { + "rimraf": "bin.js" } }, - "node_modules/make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "node_modules/rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", "dev": true, - "dependencies": { - "semver": "^6.0.0" + "bin": { + "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=8" + "node": ">=10.0.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "optionalDependencies": { + "fsevents": "~2.3.2" } }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, - "bin": { - "semver": "bin/semver.js" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" } }, - "node_modules/make-error": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", - "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", "dev": true, "dependencies": { - "tmpl": "1.0.x" + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "optional": true, + "peer": true }, - "node_modules/map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "node_modules/saxes": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", + "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "object-visit": "^1.0.0" + "xmlchars": "^2.1.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/markdown-escapes": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.3.tgz", - "integrity": "sha512-XUi5HJhhV5R74k8/0H2oCbCiYf/u4cO/rX8tnGkRvrqhsr5BRNU6Mg0yt/8UIx1iIS8220BNJsDb7XnILhLepw==", - "dev": true - }, - "node_modules/markdown-link": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/markdown-link/-/markdown-link-0.1.1.tgz", - "integrity": "sha1-MsXGUZmmRXMWMi0eQinRNAfIx88=", + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true, - "engines": { - "node": ">=0.10.0" + "bin": { + "semver": "bin/semver" } }, - "node_modules/markdown-toc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/markdown-toc/-/markdown-toc-1.2.0.tgz", - "integrity": "sha512-eOsq7EGd3asV0oBfmyqngeEIhrbkc7XVP63OwcJBIhH2EpG2PzFcbZdhy1jutXSlRBBVMNXHvMtSr5LAxSUvUg==", + "node_modules/set-getter": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", + "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", "dev": true, "dependencies": { - "concat-stream": "^1.5.2", - "diacritics-map": "^0.1.0", - "gray-matter": "^2.1.0", - "lazy-cache": "^2.0.2", - "list-item": "^1.1.1", - "markdown-link": "^0.1.1", - "minimist": "^1.2.0", - "mixin-deep": "^1.1.3", - "object.pick": "^1.2.0", - "remarkable": "^1.7.1", - "repeat-string": "^1.6.1", - "strip-color": "^0.1.0" - }, - "bin": { - "markdown-toc": "cli.js" + "to-object-path": "^0.3.0" }, "engines": { "node": ">=0.10.0" } }, - "node_modules/math-random": { + "node_modules/side-channel": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", - "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", - "dev": true + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/merge-stream": { + "node_modules/siginfo": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "engines": { - "node": ">= 8" + "node": ">=8" } }, - "node_modules/micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, - "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/mime-db": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", - "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "dev": true, "engines": { - "node": ">= 0.6" + "node": ">=0.10.0" } }, - "node_modules/mime-types": { - "version": "2.1.26", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", - "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "node_modules/source-map-support": { + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", + "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", "dev": true, "dependencies": { - "mime-db": "1.43.0" - }, - "engines": { - "node": ">= 0.6" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "node_modules/sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "brace-expansion": "^1.1.7" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" }, "engines": { - "node": "*" + "node": ">=0.10.0" } }, - "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true }, - "node_modules/mixin-deep": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", - "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", - "dev": true, - "dependencies": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } + "node_modules/std-env": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.2.tgz", + "integrity": "sha512-uUZI65yrV2Qva5gqE0+A7uVAvO40iPo6jGhs7s8keRfHCmtg+uB2X6EiLGCI9IgL1J17xGhvoOqSz79lzICPTA==", + "dev": true }, - "node_modules/mixin-deep/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "node_modules/stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4" - }, + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } }, - "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" + "safe-buffer": "~5.1.0" } }, - "node_modules/mocha": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz", - "integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==", + "node_modules/string.prototype.trim": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", + "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", "dev": true, "dependencies": { - "ansi-colors": "3.2.3", - "browser-stdout": "1.3.1", - "chokidar": "3.3.0", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.3", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" }, "engines": { - "node": ">= 8.0.0" + "node": ">= 0.4" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mocha/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "node_modules/string.prototype.trimend": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", + "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", "dev": true, - "engines": { - "node": ">=6" + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mocha/node_modules/cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "node_modules/string.prototype.trimstart": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", + "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", "dev": true, "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mocha/node_modules/debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "node_modules/mocha/node_modules/diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "node_modules/strip-color": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/strip-color/-/strip-color-0.1.0.tgz", + "integrity": "sha1-EG9l09PmotlAHKwOsM6LinArT3s=", "dev": true, "engines": { - "node": ">=0.3.1" + "node": ">=0.10.0" } }, - "node_modules/mocha/node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "node_modules/mocha/node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "node_modules/strip-literal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", + "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", "dev": true, "dependencies": { - "locate-path": "^3.0.0" + "acorn": "^8.8.2" }, - "engines": { - "node": ">=6" + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/mocha/node_modules/glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "node_modules/strip-literal/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "bin": { + "acorn": "bin/acorn" }, "engines": { - "node": "*" + "node": ">=0.4.0" } }, - "node_modules/mocha/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, "engines": { "node": ">=4" } }, - "node_modules/mocha/node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, "engines": { - "node": ">=6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mocha/node_modules/mkdirp": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", - "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, "dependencies": { - "minimist": "^1.2.5" + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" }, - "bin": { - "mkdirp": "bin/cmd.js" + "engines": { + "node": ">=8" } }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "node_modules/mocha/node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" } }, - "node_modules/mocha/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "node_modules/time-zone": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", + "integrity": "sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==", "dev": true, "engines": { "node": ">=4" } }, - "node_modules/mocha/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "node_modules/tinybench": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.4.0.tgz", + "integrity": "sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.4.0.tgz", + "integrity": "sha512-2ksntHOKf893wSAH4z/+JbPpi92esw8Gn9N2deXX+B0EO92hexAVI9GIZZPx7P5aYo5KULfeOSt3kMOmSOy6uA==", "dev": true, - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, "engines": { - "node": ">=6" + "node": ">=14.0.0" } }, - "node_modules/mocha/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "node_modules/tinyspy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.0.tgz", + "integrity": "sha512-7eORpyqImoOvkQJCSkL0d0mB4NHHIFAy4b1u8PHdDa7SjGS2njzl6/lyGoZLm+eyYEtlUmFGE0rFj66SWxZgQQ==", "dev": true, - "dependencies": { - "ansi-regex": "^4.1.0" - }, "engines": { - "node": ">=6" + "node": ">=14.0.0" } }, - "node_modules/mocha/node_modules/supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, "engines": { - "node": ">=6" + "node": ">=4" } }, - "node_modules/mocha/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "node_modules/to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, "dependencies": { - "isexe": "^2.0.0" + "kind-of": "^3.0.2" }, - "bin": { - "which": "bin/which" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/mocha/node_modules/wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" + "is-number": "^7.0.0" }, "engines": { - "node": ">=6" + "node": ">=8.0" } }, - "node_modules/mocha/node_modules/yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "node_modules/to-regex-range/node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" + "engines": { + "node": ">=0.12.0" } }, - "node_modules/mocha/node_modules/yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "node_modules/toml": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/toml/-/toml-2.3.6.tgz", + "integrity": "sha512-gVweAectJU3ebq//Ferr2JUY4WKSDe5N+z0FvjDncLGyHmIDoxgY/2Ie4qfEIDm4IS7OA6Rmdm7pdEEdMcV/xQ==", "dev": true }, - "node_modules/multimatch": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", - "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", + "node_modules/tough-cookie": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", + "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "@types/minimatch": "^3.0.3", - "array-differ": "^3.0.0", - "array-union": "^2.1.0", - "arrify": "^2.0.1", - "minimatch": "^3.0.4" + "ip-regex": "^2.1.0", + "psl": "^1.1.28", + "punycode": "^2.1.1" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=6" } }, - "node_modules/nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" + "punycode": "^2.1.0" } }, - "node_modules/nanomatch/node_modules/extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "node_modules/ts-morph": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-9.1.0.tgz", + "integrity": "sha512-sei4u651MBenr27sD6qLDXN3gZ4thiX71E3qV7SuVtDas0uvK2LtgZkIYUf9DKm/fLJ6AB/+yhRJ1vpEBJgy7Q==", "dev": true, "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" + "@dsherret/to-absolute-glob": "^2.0.2", + "@ts-morph/common": "~0.7.0", + "code-block-writer": "^10.1.1" } }, - "node_modules/nanomatch/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "node_modules/ts-node": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz", + "integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==", "dev": true, "dependencies": { - "is-plain-object": "^2.0.4" + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" } }, - "node_modules/nanomatch/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "node_modules/tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", "dev": true, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" } }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "node_modules/node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" } }, - "node_modules/node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", - "dev": true - }, - "node_modules/node-modules-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", + "node_modules/tsconfig-paths/node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/node-notifier": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-6.0.0.tgz", - "integrity": "sha512-SVfQ/wMw+DesunOm5cKqr6yDcvUTDl/yc97ybGHMrteNEY6oekXpNpS3lZwgLlwz0FLgHoiW28ZpmBHUDg37cw==", + "node_modules/tsconfig-paths/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, - "optional": true, - "dependencies": { - "growly": "^1.3.0", - "is-wsl": "^2.1.1", - "semver": "^6.3.0", - "shellwords": "^0.1.1", - "which": "^1.3.1" + "engines": { + "node": ">=4" } }, - "node_modules/node-notifier/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "optional": true, - "bin": { - "semver": "bin/semver.js" - } + "node_modules/tslib": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", + "dev": true }, - "node_modules/node-notifier/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "node_modules/tslint": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", + "integrity": "sha512-yA5YmWkzQoMF/fOA6TjkJlJniZxpo7cneTvdQEJj7blUd7YsR23gcOC5caM2MP186hTrhpSf1VSuygnikerwmQ==", "dev": true, - "optional": true, "dependencies": { - "isexe": "^2.0.0" + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.27.2" }, "bin": { - "which": "bin/which" + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev" } }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "node_modules/tslint/node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=0.3.1" } }, - "node_modules/npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "node_modules/tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "dependencies": { - "path-key": "^2.0.0" + "tslib": "^1.8.1" }, - "engines": { - "node": ">=4" + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" } }, - "node_modules/nwsapi": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", - "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", - "dev": true - }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, "engines": { "node": "*" } }, - "node_modules/object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" + "prelude-ls": "~1.1.2" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.8.0" } }, - "node_modules/object-copy/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true, - "dependencies": { - "is-descriptor": "^0.1.0" - }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, "engines": { - "node": ">= 0.4" + "node": ">=12.20" } }, - "node_modules/object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "node_modules/ufo": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.1.1.tgz", + "integrity": "sha512-MvlCc4GHrmZdAllBc0iUDowff36Q9Ndw/UzqmEKyrfSzokTd9ZCy1i+IIk5hrYKkjoYVQyNbrw7/F8XJ2rEwTg==", + "dev": true + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "dependencies": { - "isobject": "^3.0.0" + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-visit/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "node_modules/unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true, "engines": { "node": ">=0.10.0" } }, - "node_modules/object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true, - "dependencies": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - }, "engines": { - "node": ">= 0.4" + "node": ">= 4.0.0" } }, - "node_modules/object.getownpropertydescriptors": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", - "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "node_modules/update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" + "escalade": "^3.1.1", + "picocolors": "^1.0.0" }, - "engines": { - "node": ">= 0.8" + "bin": { + "update-browserslist-db": "cli.js" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "peerDependencies": { + "browserslist": ">= 4.21.0" } }, - "node_modules/object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "node_modules/uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "dev": true, "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" + "punycode": "^2.1.0" } }, - "node_modules/object.pick/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, - "engines": { - "node": ">=0.10.0" + "optional": true, + "peer": true, + "bin": { + "uuid": "bin/uuid" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, + "engines": [ + "node >=0.6.0" + ], + "optional": true, + "peer": true, "dependencies": { - "wrappy": "1" + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" } }, - "node_modules/onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "node_modules/vite": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.3.tgz", + "integrity": "sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA==", "dev": true, "dependencies": { - "mimic-fn": "^2.1.0" + "esbuild": "^0.17.5", + "postcss": "^8.4.23", + "rollup": "^3.21.0" + }, + "bin": { + "vite": "bin/vite.js" }, "engines": { - "node": ">=6" + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } } }, - "node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "node_modules/vite-node": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.30.1.tgz", + "integrity": "sha512-vTikpU/J7e6LU/8iM3dzBo8ZhEiKZEKRznEMm+mJh95XhWaPrJQraT/QsT2NWmuEf+zgAoMe64PKT7hfZ1Njmg==", "dev": true, "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.2.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" }, "engines": { - "node": ">= 0.8.0" + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/p-each-series": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", - "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==", + "node_modules/vite-node/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, + "dependencies": { + "ms": "2.1.2" + }, "engines": { - "node": ">=8" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "node_modules/vite-node/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/vite/node_modules/@esbuild/android-arm": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.18.tgz", + "integrity": "sha512-EmwL+vUBZJ7mhFCs5lA4ZimpUH3WMAoqvOIYhVQwdIgSpHC8ImHdsRyhHAVxpDYUSm0lWvd63z0XH1IlImS2Qw==", + "cpu": [ + "arm" + ], "dev": true, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=4" + "node": ">=12" } }, - "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/vite/node_modules/@esbuild/linux-loong64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.18.tgz", + "integrity": "sha512-bvPG+MyFs5ZlwYclCG1D744oHk1Pv7j8psF5TfYx7otCVmcJsEXgFEhQkbhNW8otDHL1a2KDINW20cfCgnzgMQ==", + "cpu": [ + "loong64" + ], "dev": true, - "dependencies": { - "p-try": "^2.0.0" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/esbuild": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.18.tgz", + "integrity": "sha512-z1lix43jBs6UKjcZVKOw2xx69ffE2aG0PygLL5qJ9OS/gy0Ewd1gW/PUQIOIQGXBHWNywSc0floSKoMFF8aK2w==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" }, "engines": { - "node": ">=6" + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.18", + "@esbuild/android-arm64": "0.17.18", + "@esbuild/android-x64": "0.17.18", + "@esbuild/darwin-arm64": "0.17.18", + "@esbuild/darwin-x64": "0.17.18", + "@esbuild/freebsd-arm64": "0.17.18", + "@esbuild/freebsd-x64": "0.17.18", + "@esbuild/linux-arm": "0.17.18", + "@esbuild/linux-arm64": "0.17.18", + "@esbuild/linux-ia32": "0.17.18", + "@esbuild/linux-loong64": "0.17.18", + "@esbuild/linux-mips64el": "0.17.18", + "@esbuild/linux-ppc64": "0.17.18", + "@esbuild/linux-riscv64": "0.17.18", + "@esbuild/linux-s390x": "0.17.18", + "@esbuild/linux-x64": "0.17.18", + "@esbuild/netbsd-x64": "0.17.18", + "@esbuild/openbsd-x64": "0.17.18", + "@esbuild/sunos-x64": "0.17.18", + "@esbuild/win32-arm64": "0.17.18", + "@esbuild/win32-ia32": "0.17.18", + "@esbuild/win32-x64": "0.17.18" + } + }, + "node_modules/vite/node_modules/rollup": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.0.tgz", + "integrity": "sha512-ANPhVcyeHvYdQMUyCbczy33nbLzI7RzrBje4uvNiTDJGIMtlKoOStmympwr9OtS1LZxiDmE2wvxHyVhoLtf1KQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/vitest": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.30.1.tgz", + "integrity": "sha512-y35WTrSTlTxfMLttgQk4rHcaDkbHQwDP++SNwPb+7H8yb13Q3cu2EixrtHzF27iZ8v0XCciSsLg00RkPAzB/aA==", + "dev": true, + "dependencies": { + "@types/chai": "^4.3.4", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.30.1", + "@vitest/runner": "0.30.1", + "@vitest/snapshot": "0.30.1", + "@vitest/spy": "0.30.1", + "@vitest/utils": "0.30.1", + "acorn": "^8.8.2", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.7", + "concordance": "^5.0.4", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "source-map": "^0.6.1", + "std-env": "^3.3.2", + "strip-literal": "^1.0.1", + "tinybench": "^2.4.0", + "tinypool": "^0.4.0", + "vite": "^3.0.0 || ^4.0.0", + "vite-node": "0.30.1", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.18.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*", + "playwright": "*", + "safaridriver": "*", + "webdriverio": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "playwright": { + "optional": true + }, + "safaridriver": { + "optional": true + }, + "webdriverio": { + "optional": true + } } }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/vitest/node_modules/@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", + "dev": true + }, + "node_modules/vitest/node_modules/@types/node": { + "version": "18.16.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz", + "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==", + "dev": true + }, + "node_modules/vitest/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true, - "dependencies": { - "p-limit": "^2.2.0" + "bin": { + "acorn": "bin/acorn" }, "engines": { - "node": ">=8" + "node": ">=0.4.0" } }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "node_modules/vitest/node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true, "engines": { - "node": ">=6" + "node": ">=0.4.0" } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "node_modules/vitest/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { - "callsites": "^3.0.0" + "ms": "2.1.2" }, "engines": { - "node": ">=6" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/parse-entities": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", - "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "node_modules/vitest/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/w3c-hr-time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "character-entities": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "character-reference-invalid": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-hexadecimal": "^1.0.0" + "browser-process-hrtime": "^1.0.0" } }, - "node_modules/parse5": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", - "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", - "dev": true - }, - "node_modules/parsimmon": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz", - "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==", - "dev": true - }, - "node_modules/pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "node_modules/w3c-xmlserializer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", + "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", "dev": true, - "engines": { - "node": ">=0.10.0" + "optional": true, + "peer": true, + "dependencies": { + "domexception": "^1.0.1", + "webidl-conversions": "^4.0.2", + "xml-name-validator": "^3.0.0" } }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", "dev": true, - "engines": { - "node": ">=8" - } + "optional": true, + "peer": true }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "node_modules/well-known-symbols": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", + "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "node_modules/whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", "dev": true, - "engines": { - "node": ">=8" + "optional": true, + "peer": true, + "dependencies": { + "iconv-lite": "0.4.24" } }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "node_modules/whatwg-mimetype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } + "optional": true, + "peer": true }, - "node_modules/pirates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", - "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", "dev": true, + "optional": true, + "peer": true, "dependencies": { - "node-modules-regexp": "^1.0.0" - }, - "engines": { - "node": ">= 6" + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" } }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "dependencies": { - "find-up": "^4.0.0" + "isexe": "^2.0.0" }, - "engines": { - "node": ">=8" - } - }, - "node_modules/platform": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.5.tgz", - "integrity": "sha512-TuvHS8AOIZNAlE77WUDiR4rySV/VMptyMfcfeoMgs4P8apaZM3JrnbzBiixKUv+XR6i+BXrQh8WAnjaSPFO65Q==", - "dev": true - }, - "node_modules/pn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", - "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", - "dev": true - }, - "node_modules/posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/prettier": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz", - "integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==", - "dev": true, "bin": { - "prettier": "bin-prettier.js" + "node-which": "bin/node-which" }, "engines": { - "node": ">=10.13.0" + "node": ">= 8" } }, - "node_modules/pretty-format": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.2.6.tgz", - "integrity": "sha512-DEiWxLBaCHneffrIT4B+TpMvkV9RNvvJrd3lY9ew1CEQobDzEXmYT1mg0hJhljZty7kCc10z13ohOFAE8jrUDg==", + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", "dev": true, "dependencies": { - "@jest/types": "^25.2.6", - "ansi-regex": "^5.0.0", - "ansi-styles": "^4.0.0", - "react-is": "^16.12.0" + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" }, - "engines": { - "node": ">= 8.3" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/pretty-format/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" }, "engines": { - "node": ">=7.0.0" + "node": ">=8" } }, - "node_modules/pretty-format/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true, "engines": { - "node": ">=0.4.0" + "node": ">=0.10.0" } }, - "node_modules/prompts": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", - "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/ws": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", "dev": true, - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.4" - }, + "optional": true, + "peer": true, "engines": { - "node": ">= 6" + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, - "node_modules/psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true - }, - "node_modules/pump": { + "node_modules/xml-name-validator": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } + "optional": true, + "peer": true }, - "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true, "engines": { - "node": ">=6" + "node": ">=0.4" } }, - "node_modules/pure-rand": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-2.0.0.tgz", - "integrity": "sha512-mk98aayyd00xbfHgE3uEmAUGzz3jCdm8Mkf5DUXUhc7egmOaGG2D7qhVlynGenNe9VaNJZvzO9hkc8myuTkDgw==", + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true, "engines": { - "node": ">=0.6" + "node": ">=6" } }, - "node_modules/randomatic": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", - "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, - "dependencies": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, "engines": { - "node": ">= 0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } - }, - "node_modules/randomatic/node_modules/is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + } + }, + "dependencies": { + "@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" } }, - "node_modules/randomatic/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "@babel/highlight": "^7.18.6" } }, - "node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "@babel/compat-data": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", + "integrity": "sha512-/DYyDpeCfaVinT40FPGdkkb+lYSKvsVuMjDAG7jPOWWiM1ibOaB9CXJAlc4d1QpP/U2q2P9jbrSlClKSErd55g==", "dev": true }, - "node_modules/readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", - "dev": true, - "dependencies": { - "picomatch": "^2.0.4" + "@babel/core": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.4.tgz", + "integrity": "sha512-qt/YV149Jman/6AfmlxJ04LMIu8bMoyl3RB91yTFrxQmgbrSvQMy7cI8Q62FHx1t8wJ8B5fu0UDoLwHAhUo1QA==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-compilation-targets": "^7.21.4", + "@babel/helper-module-transforms": "^7.21.2", + "@babel/helpers": "^7.21.0", + "@babel/parser": "^7.21.4", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.4", + "@babel/types": "^7.21.4", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.0" }, - "engines": { - "node": ">= 8" + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, - "node_modules/realpath-native": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-2.0.0.tgz", - "integrity": "sha512-v1SEYUOXXdbBZK8ZuNgO4TBjamPsiSgcFr0aP+tEKpQZK8vooEUqV6nm6Cv502mX4NF2EfsnVqtNAHG+/6Ur1Q==", + "@babel/generator": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", + "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", "dev": true, - "engines": { - "node": ">=8" + "requires": { + "@babel/types": "^7.21.4", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" } }, - "node_modules/regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "@babel/helper-compilation-targets": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.4.tgz", + "integrity": "sha512-Fa0tTuOXZ1iL8IeDFUWCzjZcn+sJGd9RZdH9esYVjEejGmzf+FFYQpMi/kZUk2kPy/q1H3/GPw7np8qar/stfg==", "dev": true, - "dependencies": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" + "requires": { + "@babel/compat-data": "^7.21.4", + "@babel/helper-validator-option": "^7.21.0", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", + "semver": "^6.3.0" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } } }, - "node_modules/regex-not/node_modules/extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "dev": true, - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" } }, - "node_modules/regex-not/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "@babel/helper-hoist-variables": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "@babel/types": "^7.18.6" } }, - "node_modules/regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "@babel/helper-module-imports": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz", + "integrity": "sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==", "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" + "requires": { + "@babel/types": "^7.21.4" } }, - "node_modules/remark-frontmatter": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-1.3.2.tgz", - "integrity": "sha512-2eayxITZ8rezsXdgcXnYB3iLivohm2V/ZT4Ne8uhua6A4pk6GdLE2ZzJnbnINtD1HRLaTdB7RwF9sgUbMptJZA==", + "@babel/helper-module-transforms": { + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", + "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", "dev": true, - "dependencies": { - "fault": "^1.0.1", - "xtend": "^4.0.1" + "requires": { + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.2", + "@babel/types": "^7.21.2" } }, - "node_modules/remark-parse": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", - "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", - "dev": true, - "dependencies": { - "collapse-white-space": "^1.0.2", - "is-alphabetical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-whitespace-character": "^1.0.0", - "is-word-character": "^1.0.0", - "markdown-escapes": "^1.0.0", - "parse-entities": "^1.1.0", - "repeat-string": "^1.5.4", - "state-toggle": "^1.0.0", - "trim": "0.0.1", - "trim-trailing-lines": "^1.0.0", - "unherit": "^1.0.4", - "unist-util-remove-position": "^1.0.0", - "vfile-location": "^2.0.0", - "xtend": "^4.0.1" + "@babel/helper-simple-access": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", + "dev": true, + "requires": { + "@babel/types": "^7.20.2" } }, - "node_modules/remarkable": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/remarkable/-/remarkable-1.7.4.tgz", - "integrity": "sha512-e6NKUXgX95whv7IgddywbeN/ItCkWbISmc2DiqHJb0wTrqZIexqdco5b8Z3XZoo/48IdNVKM9ZCvTPJ4F5uvhg==", + "@babel/helper-split-export-declaration": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", "dev": true, - "dependencies": { - "argparse": "^1.0.10", - "autolinker": "~0.28.0" - }, - "bin": { - "remarkable": "bin/remarkable.js" - }, - "engines": { - "node": ">= 0.10.0" + "requires": { + "@babel/types": "^7.18.6" } }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "@babel/helper-string-parser": { + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", "dev": true }, - "node_modules/repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", + "dev": true + }, + "@babel/helpers": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", + "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0" } }, - "node_modules/repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, - "engines": { - "node": ">=0.10" + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" } }, - "node_modules/replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "@babel/parser": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", + "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", + "dev": true + }, + "@babel/template": { + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "dev": true, - "engines": { - "node": ">= 0.10" + "requires": { + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" } }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "dev": true, - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" + "@babel/traverse": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", + "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.21.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.21.4", + "@babel/types": "^7.21.4", + "debug": "^4.1.0", + "globals": "^11.1.0" }, - "engines": { - "node": ">= 6" + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "node_modules/request-promise-core": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", - "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", + "@babel/types": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", + "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", "dev": true, - "dependencies": { - "lodash": "^4.17.15" - }, - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "request": "^2.34" + "requires": { + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", + "to-fast-properties": "^2.0.0" } }, - "node_modules/request-promise-native": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", - "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", - "deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142", + "@dsherret/to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-H2R13IvZdM6gei2vOGSzF7HdMyw=", "dev": true, - "dependencies": { - "request-promise-core": "1.1.3", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "engines": { - "node": ">=0.12.0" - }, - "peerDependencies": { - "request": "^2.34" + "requires": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" } }, - "node_modules/request-promise-native/node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "@esbuild/android-arm": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz", + "integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==", "dev": true, - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } + "optional": true }, - "node_modules/request/node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "@esbuild/android-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.18.tgz", + "integrity": "sha512-/iq0aK0eeHgSC3z55ucMAHO05OIqmQehiGay8eP5l/5l+iEr4EIbh4/MI8xD9qRFjqzgkc0JkX0LculNC9mXBw==", "dev": true, - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } + "optional": true }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "@esbuild/android-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.18.tgz", + "integrity": "sha512-x+0efYNBF3NPW2Xc5bFOSFW7tTXdAcpfEg2nXmxegm4mJuVeS+i109m/7HMiOQ6M12aVGGFlqJX3RhNdYM2lWg==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "@esbuild/darwin-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.18.tgz", + "integrity": "sha512-6tY+djEAdF48M1ONWnQb1C+6LiXrKjmqjzPNPWXhu/GzOHTHX2nh8Mo2ZAmBFg0kIodHhciEgUBtcYCAIjGbjQ==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true + "@esbuild/darwin-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.18.tgz", + "integrity": "sha512-Qq84ykvLvya3dO49wVC9FFCNUfSrQJLbxhoQk/TE1r6MjHo3sFF2tlJCwMjhkBVq3/ahUisj7+EpRSz0/+8+9A==", + "dev": true, + "optional": true }, - "node_modules/resolve": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", - "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", + "@esbuild/freebsd-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.18.tgz", + "integrity": "sha512-fw/ZfxfAzuHfaQeMDhbzxp9mc+mHn1Y94VDHFHjGvt2Uxl10mT4CDavHm+/L9KG441t1QdABqkVYwakMUeyLRA==", "dev": true, - "dependencies": { - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "optional": true }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "@esbuild/freebsd-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.18.tgz", + "integrity": "sha512-FQFbRtTaEi8ZBi/A6kxOC0V0E9B/97vPdYjY9NdawyLd4Qk5VD5g2pbWN2VR1c0xhzcJm74HWpObPszWC+qTew==", "dev": true, - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } + "optional": true }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "@esbuild/linux-arm": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.18.tgz", + "integrity": "sha512-jW+UCM40LzHcouIaqv3e/oRs0JM76JfhHjCavPxMUti7VAPh8CaGSlS7cmyrdpzSk7A+8f0hiedHqr/LMnfijg==", "dev": true, - "engines": { - "node": ">=8" - } + "optional": true }, - "node_modules/resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "deprecated": "https://github.com/lydell/resolve-url#deprecated", - "dev": true + "@esbuild/linux-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.18.tgz", + "integrity": "sha512-R7pZvQZFOY2sxUG8P6A21eq6q+eBv7JPQYIybHVf1XkQYC+lT7nDBdC7wWKTrbvMXKRaGudp/dzZCwL/863mZQ==", + "dev": true, + "optional": true }, - "node_modules/ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "@esbuild/linux-ia32": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.18.tgz", + "integrity": "sha512-ygIMc3I7wxgXIxk6j3V00VlABIjq260i967Cp9BNAk5pOOpIXmd1RFQJQX9Io7KRsthDrQYrtcx7QCof4o3ZoQ==", "dev": true, - "engines": { - "node": ">=0.12" - } + "optional": true }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "@esbuild/linux-loong64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz", + "integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==", "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "@esbuild/linux-mips64el": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.18.tgz", + "integrity": "sha512-oVqckATOAGuiUOa6wr8TXaVPSa+6IwVJrGidmNZS1cZVx0HqkTMkqFGD2HIx9H1RvOwFeWYdaYbdY6B89KUMxA==", "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "optional": true }, - "node_modules/rsvp": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", - "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", + "@esbuild/linux-ppc64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.18.tgz", + "integrity": "sha512-3dLlQO+b/LnQNxgH4l9rqa2/IwRJVN9u/bK63FhOPB4xqiRqlQAU0qDU3JJuf0BmaH0yytTBdoSBHrb2jqc5qQ==", "dev": true, - "engines": { - "node": "6.* || >= 7.*" - } + "optional": true }, - "node_modules/run-parallel": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", - "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", - "dev": true + "@esbuild/linux-riscv64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.18.tgz", + "integrity": "sha512-/x7leOyDPjZV3TcsdfrSI107zItVnsX1q2nho7hbbQoKnmoeUWjs+08rKKt4AUXju7+3aRZSsKrJtaRmsdL1xA==", + "dev": true, + "optional": true }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "@esbuild/linux-s390x": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.18.tgz", + "integrity": "sha512-cX0I8Q9xQkL/6F5zWdYmVf5JSQt+ZfZD2bJudZrWD+4mnUvoZ3TDDXtDX2mUaq6upMFv9FlfIh4Gfun0tbGzuw==", + "dev": true, + "optional": true }, - "node_modules/safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "@esbuild/linux-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.18.tgz", + "integrity": "sha512-66RmRsPlYy4jFl0vG80GcNRdirx4nVWAzJmXkevgphP1qf4dsLQCpSKGM3DUQCojwU1hnepI63gNZdrr02wHUA==", "dev": true, - "dependencies": { - "ret": "~0.1.10" - } + "optional": true }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "@esbuild/netbsd-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.18.tgz", + "integrity": "sha512-95IRY7mI2yrkLlTLb1gpDxdC5WLC5mZDi+kA9dmM5XAGxCME0F8i4bYH4jZreaJ6lIZ0B8hTrweqG1fUyW7jbg==", + "dev": true, + "optional": true }, - "node_modules/sane": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", - "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", - "deprecated": "some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added", + "@esbuild/openbsd-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.18.tgz", + "integrity": "sha512-WevVOgcng+8hSZ4Q3BKL3n1xTv5H6Nb53cBrtzzEjDbbnOmucEVcZeGCsCOi9bAOcDYEeBZbD2SJNBxlfP3qiA==", "dev": true, - "dependencies": { - "@cnakazawa/watch": "^1.0.3", - "anymatch": "^2.0.0", - "capture-exit": "^2.0.0", - "exec-sh": "^0.3.2", - "execa": "^1.0.0", - "fb-watchman": "^2.0.0", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5" - }, - "bin": { - "sane": "src/cli.js" - }, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } + "optional": true }, - "node_modules/sane/node_modules/anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "@esbuild/sunos-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.18.tgz", + "integrity": "sha512-Rzf4QfQagnwhQXVBS3BYUlxmEbcV7MY+BH5vfDZekU5eYpcffHSyjU8T0xucKVuOcdCsMo+Ur5wmgQJH2GfNrg==", "dev": true, - "dependencies": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } + "optional": true }, - "node_modules/sane/node_modules/braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "@esbuild/win32-arm64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.18.tgz", + "integrity": "sha512-Kb3Ko/KKaWhjeAm2YoT/cNZaHaD1Yk/pa3FTsmqo9uFh1D1Rfco7BBLIPdDOozrObj2sahslFuAQGvWbgWldAg==", "dev": true, - "dependencies": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/sane/node_modules/braces/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "@esbuild/win32-ia32": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.18.tgz", + "integrity": "sha512-0/xUMIdkVHwkvxfbd5+lfG7mHOf2FRrxNbPiKWg9C4fFrB8H0guClmaM3BFiRUYrznVoyxTIyC/Ou2B7QQSwmw==", "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/sane/node_modules/extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "@esbuild/win32-x64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.18.tgz", + "integrity": "sha512-qU25Ma1I3NqTSHJUOKi9sAH1/Mzuvlke0ioMJRthLXKm7JiSKVwFghlGbDLOO2sARECGhja4xYfRAZNPAkooYg==", "dev": true, - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/sane/node_modules/extend-shallow/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "eslint-visitor-keys": "^3.3.0" } }, - "node_modules/sane/node_modules/fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "@eslint-community/regexpp": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", + "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "dev": true + }, + "@eslint/eslintrc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", + "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", "dev": true, - "dependencies": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.5.1", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } } }, - "node_modules/sane/node_modules/fill-range/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "@eslint/js": { + "version": "8.39.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.39.0.tgz", + "integrity": "sha512-kf9RB0Fg7NZfap83B3QOqOGg9QmD9yBudqQXzzOtn3i4y7ZUXe5ONeW34Gwi+TxhH4mvj72R1Zc300KUMa9Bng==", + "dev": true + }, + "@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "node_modules/sane/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "dev": true + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" } }, - "node_modules/sane/node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", "dev": true, - "dependencies": { - "is-buffer": "^1.1.5" + "requires": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + } } }, - "node_modules/sane/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" } }, - "node_modules/sane/node_modules/micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true }, - "node_modules/sane/node_modules/normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" } }, - "node_modules/sane/node_modules/to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "@ts-morph/common": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.7.5.tgz", + "integrity": "sha512-nlFunSKAsFWI0Ol/uPxJcpVqXxTGNuaWXTmoQDhcnwj1UM4QmBSUVWzqoQ0OzUlqo4sV1gobfFBkMHuZVemMAQ==", "dev": true, - "dependencies": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" + "requires": { + "@dsherret/to-absolute-glob": "^2.0.2", + "fast-glob": "^3.2.5", + "is-negated-glob": "^1.0.0", + "mkdirp": "^1.0.4", + "multimatch": "^5.0.0", + "typescript": "~4.1.3" }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/saxes": { - "version": "3.1.11", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", - "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", - "dev": true, "dependencies": { - "xmlchars": "^2.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, + "typescript": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", + "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==", + "dev": true + } } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "@types/benchmark": { + "version": "1.0.31", + "resolved": "https://registry.npmjs.org/@types/benchmark/-/benchmark-1.0.31.tgz", + "integrity": "sha512-F6fVNOkGEkSdo/19yWYOwVKGvzbTeWkR/XQYBKtGBQ9oGRjBN9f/L4aJI4sDcVPJO58Y1CJZN8va9V2BhrZapA==", "dev": true }, - "node_modules/set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", - "dev": true, - "dependencies": { - "to-object-path": "^0.3.0" - }, - "engines": { - "node": ">=0.10.0" - } + "@types/chai": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-3.5.2.tgz", + "integrity": "sha512-+ZvkforUDGqwU1npZYIMPuszsInIypxL81rFAsCGDs9CRhAEWO6s3rpO+TfJk9mgUgxKNMnSVQa/npPPD4gJXw==", + "dev": true }, - "node_modules/set-value": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", - "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", "dev": true, - "dependencies": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "@types/chai": "*" } }, - "node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "@types/glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", "dev": true, - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "@types/minimatch": "*", + "@types/node": "*" } }, - "node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true }, - "node_modules/shellwords": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", - "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true, - "optional": true + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true }, - "node_modules/signal-exit": { + "@types/minimatch": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", "dev": true }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "@types/node": { + "version": "16.18.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.25.tgz", + "integrity": "sha512-rUDO6s9Q/El1R1I21HG4qw/LstTHCPO/oQNAwI/4b2f9EWvMnqt4d3HJwPMawfZ3UvodB8516Yg+VAq54YM+eA==", "dev": true }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } + "@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "@typescript-eslint/eslint-plugin": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.1.tgz", + "integrity": "sha512-AVi0uazY5quFB9hlp2Xv+ogpfpk77xzsgsIEWyVS7uK/c7MZ5tw7ZPbapa0SbfkqE0fsAMkz5UwtgMLVk2BQAg==", "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=10" + "requires": { + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.59.1", + "@typescript-eslint/type-utils": "5.59.1", + "@typescript-eslint/utils": "5.59.1", + "debug": "^4.3.4", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "@typescript-eslint/parser": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.1.tgz", + "integrity": "sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" + "requires": { + "@typescript-eslint/scope-manager": "5.59.1", + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/typescript-estree": "5.59.1", + "debug": "^4.3.4" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "node_modules/slice-ansi/node_modules/astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "@typescript-eslint/scope-manager": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.1.tgz", + "integrity": "sha512-mau0waO5frJctPuAzcxiNWqJR5Z8V0190FTSqRw1Q4Euop6+zTwHAf8YIXNwDOT29tyUDrQ65jSg9aTU/H0omA==", "dev": true, - "engines": { - "node": ">=8" + "requires": { + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/visitor-keys": "5.59.1" } }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "@typescript-eslint/type-utils": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.1.tgz", + "integrity": "sha512-ZMWQ+Oh82jWqWzvM3xU+9y5U7MEMVv6GLioM3R5NJk6uvP47kZ7YvlgSHJ7ERD6bOY7Q4uxWm25c76HKEwIjZw==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" + "requires": { + "@typescript-eslint/typescript-estree": "5.59.1", + "@typescript-eslint/utils": "5.59.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" }, - "engines": { - "node": ">=7.0.0" + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } } }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "@typescript-eslint/types": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.1.tgz", + "integrity": "sha512-dg0ICB+RZwHlysIy/Dh1SP+gnXNzwd/KS0JprD3Lmgmdq+dJAJnUPe1gNG34p0U19HvRlGX733d/KqscrGC1Pg==", "dev": true }, - "node_modules/snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "dependencies": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "@typescript-eslint/typescript-estree": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.1.tgz", + "integrity": "sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA==", "dev": true, - "dependencies": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" + "requires": { + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/visitor-keys": "5.59.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } } }, - "node_modules/snapdragon-node/node_modules/is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "@typescript-eslint/utils": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.1.tgz", + "integrity": "sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA==", "dev": true, - "dependencies": { - "kind-of": "^6.0.0" + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.59.1", + "@typescript-eslint/types": "5.59.1", + "@typescript-eslint/typescript-estree": "5.59.1", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, - "node_modules/snapdragon-node/node_modules/is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "@typescript-eslint/visitor-keys": { + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.1.tgz", + "integrity": "sha512-6waEYwBTCWryx0VJmP7JaM4FpipLsFl9CvYf2foAE8Qh/Y0s+bxWysciwOs0LTBED4JCaNxTZ5rGadB14M6dwA==", "dev": true, - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "@typescript-eslint/types": "5.59.1", + "eslint-visitor-keys": "^3.3.0" } }, - "node_modules/snapdragon-node/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "@vitest/coverage-istanbul": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/@vitest/coverage-istanbul/-/coverage-istanbul-0.23.4.tgz", + "integrity": "sha512-vl+c682jwCkthdOomO7aBRY/H2bXfxjYAo+WZoGktdWEiSBfwhFUOcJJW3+Ery9i8ja+M1Jd19HrqYriLixGPw==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-instrument": "^5.2.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.1", + "istanbul-reports": "^3.1.5", + "test-exclude": "^6.0.0", + "vitest": "0.23.4" + }, + "dependencies": { + "@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", + "dev": true + }, + "@types/node": { + "version": "18.16.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz", + "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==", + "dev": true + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "strip-literal": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-0.4.2.tgz", + "integrity": "sha512-pv48ybn4iE1O9RLgCAN0iU4Xv7RlBTiit6DKmMiErbs9x1wH6vXBs45tWc0H5wUIF6TLTrKweqkmYF/iraQKNw==", + "dev": true, + "requires": { + "acorn": "^8.8.0" + } + }, + "tinypool": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.1.tgz", + "integrity": "sha512-zLA1ZXlstbU2rlpA4CIeVaqvWq41MTWqLY3FfsAXgC8+f7Pk7zroaJQxDgxn1xNudKW6Kmj4808rPFShUlIRmQ==", + "dev": true + }, + "tinyspy": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.1.1.tgz", + "integrity": "sha512-UVq5AXt/gQlti7oxoIg5oi/9r0WpF7DGEVwXgqWSMmyN16+e3tl5lIvTaOpJ3TAtu5xFzWccFRM4R5NaWHF+4g==", + "dev": true + }, + "vite": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.6.tgz", + "integrity": "sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==", + "dev": true, + "requires": { + "esbuild": "^0.15.9", + "fsevents": "~2.3.2", + "postcss": "^8.4.18", + "resolve": "^1.22.1", + "rollup": "^2.79.1" + } + }, + "vitest": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.23.4.tgz", + "integrity": "sha512-iukBNWqQAv8EKDBUNntspLp9SfpaVFbmzmM0sNcnTxASQZMzRw3PsM6DMlsHiI+I6GeO5/sYDg3ecpC+SNFLrQ==", + "dev": true, + "requires": { + "@types/chai": "^4.3.3", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "chai": "^4.3.6", + "debug": "^4.3.4", + "local-pkg": "^0.4.2", + "strip-literal": "^0.4.1", + "tinybench": "^2.1.5", + "tinypool": "^0.3.0", + "tinyspy": "^1.0.2", + "vite": "^2.9.12 || ^3.0.0-0" + } + } } }, - "node_modules/snapdragon-node/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "@vitest/expect": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.30.1.tgz", + "integrity": "sha512-c3kbEtN8XXJSeN81iDGq29bUzSjQhjES2WR3aColsS4lPGbivwLtas4DNUe0jD9gg/FYGIteqOenfU95EFituw==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "@vitest/spy": "0.30.1", + "@vitest/utils": "0.30.1", + "chai": "^4.3.7" } }, - "node_modules/snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "@vitest/runner": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.30.1.tgz", + "integrity": "sha512-W62kT/8i0TF1UBCNMRtRMOBWJKRnNyv9RrjIgdUryEe0wNpGZvvwPDLuzYdxvgSckzjp54DSpv1xUbv4BQ0qVA==", "dev": true, - "dependencies": { - "kind-of": "^3.2.0" + "requires": { + "@vitest/utils": "0.30.1", + "concordance": "^5.0.4", + "p-limit": "^4.0.0", + "pathe": "^1.1.0" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "requires": { + "yocto-queue": "^1.0.0" + } + }, + "yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true + } } }, - "node_modules/snapdragon/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "@vitest/snapshot": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.30.1.tgz", + "integrity": "sha512-fJZqKrE99zo27uoZA/azgWyWbFvM1rw2APS05yB0JaLwUIg9aUtvvnBf4q7JWhEcAHmSwbrxKFgyBUga6tq9Tw==", "dev": true, - "dependencies": { - "is-descriptor": "^0.1.0" + "requires": { + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "pretty-format": "^27.5.1" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + }, + "pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + } + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + } } }, - "node_modules/snapdragon/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "@vitest/spy": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.30.1.tgz", + "integrity": "sha512-YfJeIf37GvTZe04ZKxzJfnNNuNSmTEGnla2OdL60C8od16f3zOfv9q9K0nNii0NfjDJRt/CVN/POuY5/zTS+BA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "tinyspy": "^2.1.0" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "@vitest/utils": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.30.1.tgz", + "integrity": "sha512-/c8Xv2zUVc+rnNt84QF0Y0zkfxnaGhp87K2dYJMLtLOIckPzuxLVzAtFCicGFdB4NeBHNzTRr1tNn7rCtQcWFA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "concordance": "^5.0.4", + "loupe": "^2.3.6", + "pretty-format": "^27.5.1" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + }, + "pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + } + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + } } }, - "node_modules/source-map-resolve": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", - "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", - "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", + "abab": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", "dev": true, - "dependencies": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } + "optional": true, + "peer": true }, - "node_modules/source-map-support": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", - "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", + "acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true, + "peer": true + }, + "acorn-globals": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + }, "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "acorn": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "dev": true, + "optional": true, + "peer": true + } } }, - "node_modules/source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "deprecated": "See https://github.com/lydell/source-map-url#deprecated", - "dev": true + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "requires": {} }, - "node_modules/split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "acorn-walk": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", "dev": true, - "dependencies": { - "extend-shallow": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } + "optional": true, + "peer": true }, - "node_modules/split-string/node_modules/extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, - "node_modules/split-string/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "ansi-red": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "ansi-wrap": "0.1.0" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, - "node_modules/sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dev": true, - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stack-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", - "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "color-convert": "^1.9.0" } }, - "node_modules/state-toggle": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.2.tgz", - "integrity": "sha512-8LpelPGR0qQM4PnfLiplOQNJcIN1/r2Gy0xKB2zKnIW2YzPMt2sR4I/+gtPjhN7Svh9kw+zqEg2SFwpBO9iNiw==", + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true }, - "node_modules/static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, - "dependencies": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "sprintf-js": "~1.0.2" } }, - "node_modules/static-extend/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", "dev": true, - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" } }, - "node_modules/stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "optional": true, + "peer": true }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "array-includes": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", + "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", + "is-string": "^1.0.7" } }, - "node_modules/string-length": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz", - "integrity": "sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA==", + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "array.prototype.flat": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", + "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", "dev": true, - "dependencies": { - "astral-regex": "^1.0.0", - "strip-ansi": "^5.2.0" - }, - "engines": { - "node": ">=8" + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" } }, - "node_modules/string-length/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "array.prototype.flatmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", + "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", "dev": true, - "engines": { - "node": ">=6" + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" } }, - "node_modules/string-length/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true, - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" + "optional": true, + "peer": true, + "requires": { + "safer-buffer": "~2.1.0" } }, - "node_modules/string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } + "optional": true, + "peer": true }, - "node_modules/string-width/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, - "node_modules/string.prototype.trimend": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz", - "integrity": "sha512-EEJnGqa/xNfIg05SxiPSqRS7S9qwDhYts1TSLR1BQfYUfPe1stofgGKvwERK9+9yf+PpfBMlpBaCHucXGPQfUA==", + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true, - "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "optional": true, + "peer": true }, - "node_modules/string.prototype.trimleft": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", - "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", + "autolinker": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-0.28.1.tgz", + "integrity": "sha1-BlK0kYgYefB3XazgzcoyM5QqTkc=", "dev": true, - "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimstart": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "requires": { + "gulp-header": "^1.7.1" } }, - "node_modules/string.prototype.trimright": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", - "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", "dev": true, - "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimend": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "optional": true, + "peer": true }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.0.tgz", - "integrity": "sha512-iCP8g01NFYiiBOnwG1Xc3WZLyoo+RuBymwIlWncShXDDJYWN6DbnM3odslBJdgCdRlq94B5s63NWAZlcn2CS4w==", + "aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", "dev": true, - "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "optional": true, + "peer": true }, - "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha512-XqYMR2dfdGMW+hd0IUZ2PwK+fGeFkOxZJ0wY+JaQAHzt1Zx8LcvpiZD2NiGkEG8qx0CfkAOr5xt76d1e8vG90g==", "dev": true, - "dependencies": { - "ansi-regex": "^5.0.0" + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" }, - "engines": { - "node": ">=8" + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg==", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true + } } }, - "node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "engines": { - "node": ">=8" - } + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, - "node_modules/strip-color": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/strip-color/-/strip-color-0.1.0.tgz", - "integrity": "sha1-EG9l09PmotlAHKwOsM6LinArT3s=", + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, - "engines": { - "node": ">=0.10.0" + "optional": true, + "peer": true, + "requires": { + "tweetnacl": "^0.14.3" } }, - "node_modules/strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "benchmark": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", + "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "lodash": "^4.17.4", + "platform": "^1.3.3" } }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } + "blueimp-md5": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", + "integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==", + "dev": true }, - "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/structured-source": { + "braces": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-3.0.2.tgz", - "integrity": "sha1-3YAkJeD1PcSm56yjdSkBoczaevU=", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, + "requires": { + "fill-range": "^7.0.1" + }, "dependencies": { - "boundary": "^1.0.1" + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + } } }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "browser-process-hrtime": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", + "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } + "optional": true, + "peer": true }, - "node_modules/supports-hyperlinks": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz", - "integrity": "sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=8" - } + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true }, - "node_modules/supports-hyperlinks/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "browserslist": { + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", "dev": true, - "engines": { - "node": ">=8" + "requires": { + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" } }, - "node_modules/supports-hyperlinks/node_modules/supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true }, - "node_modules/symbol-tree": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, - "node_modules/table": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", - "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", - "dev": true, - "dependencies": { - "ajv": "^7.0.2", - "lodash": "^4.17.20", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.0" - }, - "engines": { - "node": ">=10.0.0" - } + "cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true }, - "node_modules/table/node_modules/ajv": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz", - "integrity": "sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==", + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" } }, - "node_modules/table/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, - "node_modules/table/node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "caniuse-lite": { + "version": "1.0.30001481", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", + "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==", "dev": true }, - "node_modules/terminal-link": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", - "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true, - "dependencies": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "optional": true, + "peer": true + }, + "chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" } }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", "dev": true }, - "node_modules/throat": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz", - "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", + "code-block-writer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", "dev": true }, - "node_modules/through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" + "requires": { + "color-name": "1.1.3" } }, - "node_modules/tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "engines": { - "node": ">=4" + "optional": true, + "peer": true, + "requires": { + "delayed-stream": "~1.0.0" } }, - "node_modules/to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" } }, - "node_modules/to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "concat-with-sourcemaps": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", + "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==", "dev": true, - "dependencies": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "source-map": "^0.6.1" } }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "concordance": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.4.tgz", + "integrity": "sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==", "dev": true, - "dependencies": { - "is-number": "^7.0.0" + "requires": { + "date-time": "^3.1.0", + "esutils": "^2.0.3", + "fast-diff": "^1.2.0", + "js-string-escape": "^1.0.1", + "lodash": "^4.17.15", + "md5-hex": "^3.0.1", + "semver": "^7.3.2", + "well-known-symbols": "^2.0.0" }, - "engines": { - "node": ">=8.0" + "dependencies": { + "semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, - "node_modules/to-regex-range/node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", "dev": true, - "engines": { - "node": ">=0.12.0" + "requires": { + "safe-buffer": "~5.1.1" } }, - "node_modules/to-regex/node_modules/extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", "dev": true, - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" + "optional": true, + "peer": true + }, + "cssstyle": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.2.0.tgz", + "integrity": "sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "cssom": "~0.3.6" }, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true, + "optional": true, + "peer": true + } } }, - "node_modules/to-regex/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" + "optional": true, + "peer": true, + "requires": { + "assert-plus": "^1.0.0" } }, - "node_modules/toml": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/toml/-/toml-2.3.6.tgz", - "integrity": "sha512-gVweAectJU3ebq//Ferr2JUY4WKSDe5N+z0FvjDncLGyHmIDoxgY/2Ie4qfEIDm4IS7OA6Rmdm7pdEEdMcV/xQ==", - "dev": true + "data-urls": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", + "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.2.0", + "whatwg-url": "^7.0.0" + } }, - "node_modules/tough-cookie": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", - "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", + "date-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", + "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", "dev": true, - "dependencies": { - "ip-regex": "^2.1.0", - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=6" + "requires": { + "time-zone": "^1.0.0" } }, - "node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, - "dependencies": { - "punycode": "^2.1.0" + "requires": { + "type-detect": "^4.0.0" } }, - "node_modules/traverse": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", - "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=", + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, - "node_modules/trim": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", - "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", - "dev": true + "define-properties": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", + "dev": true, + "requires": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } }, - "node_modules/trim-trailing-lines": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.2.tgz", - "integrity": "sha512-MUjYItdrqqj2zpcHFTkMa9WAv4JHTI6gnRQGPFLrt5L9a6tRMiDnIqYl8JBvu2d2Tc3lWJKQwlGCp0K8AvCM+Q==", + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true, + "optional": true, + "peer": true + }, + "diacritics-map": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/diacritics-map/-/diacritics-map-0.1.0.tgz", + "integrity": "sha1-bfwP+dAQAKLt8oZTccrDFulJd68=", "dev": true }, - "node_modules/trough": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.4.tgz", - "integrity": "sha512-tdzBRDGWcI1OpPVmChbdSKhvSVurznZ8X36AYURAcl+0o2ldlCY2XPzyXNNxwJwwyIU+rIglTCG4kxtNKBQH7Q==", + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, - "node_modules/ts-jest": { - "version": "25.3.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.3.1.tgz", - "integrity": "sha512-O53FtKguoMUByalAJW+NWEv7c4tus5ckmhfa7/V0jBb2z8v5rDSLFC1Ate7wLknYPC1euuhY6eJjQq4FtOZrkg==", + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, - "dependencies": { - "bs-logger": "0.x", - "buffer-from": "1.x", - "fast-json-stable-stringify": "2.x", - "json5": "2.x", - "lodash.memoize": "4.x", - "make-error": "1.x", - "micromatch": "4.x", - "mkdirp": "1.x", - "resolve": "1.x", - "semver": "6.x", - "yargs-parser": "18.x" - }, - "bin": { - "ts-jest": "cli.js" - }, - "engines": { - "node": ">= 8" - }, - "peerDependencies": { - "jest": ">=25 <26" + "requires": { + "path-type": "^4.0.0" } }, - "node_modules/ts-jest/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "docs-ts": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.7.2.tgz", + "integrity": "sha512-9zydJV84gi0imZWdVPHHqar7yIx6wRpwRHc4aJ3pw9vov/4pAmjfEPPE5gXRtiPFf+3WqOrE4qC6ih1kBJGl9w==", "dev": true, - "bin": { - "mkdirp": "bin/cmd.js" + "requires": { + "chalk": "^2.4.2", + "doctrine": "^3.0.0", + "fp-ts": "^2.13.2", + "fs-extra": "^7.0.1", + "glob": "^7.1.6", + "io-ts": "^2.2.20", + "logging-ts": "^0.3.4", + "markdown-toc": "^1.2.0", + "rimraf": "^2.7.1", + "ts-morph": "^9.1.0", + "ts-node": "^8.10.2" }, - "engines": { - "node": ">=10" + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + } + } } }, - "node_modules/ts-jest/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, - "bin": { - "semver": "bin/semver.js" + "requires": { + "esutils": "^2.0.2" } }, - "node_modules/ts-morph": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-9.1.0.tgz", - "integrity": "sha512-sei4u651MBenr27sD6qLDXN3gZ4thiX71E3qV7SuVtDas0uvK2LtgZkIYUf9DKm/fLJ6AB/+yhRJ1vpEBJgy7Q==", + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", "dev": true, - "dependencies": { - "@dsherret/to-absolute-glob": "^2.0.2", - "@ts-morph/common": "~0.7.0", - "code-block-writer": "^10.1.1" + "optional": true, + "peer": true, + "requires": { + "webidl-conversions": "^4.0.2" } }, - "node_modules/ts-node": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz", - "integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==", + "dtslint": { + "version": "git+ssh://git@github.com/gcanti/dtslint.git#1558adbeda424fec83a8d314784c18728a970cd4", "dev": true, - "dependencies": { - "arg": "^4.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.6", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "engines": { - "node": ">=6.0.0" + "from": "dtslint@github:gcanti/dtslint", + "requires": { + "fs-extra": "^6.0.1", + "parsimmon": "^1.12.0", + "strip-json-comments": "^2.0.1", + "tslint": "^5.12.0", + "typescript": "^4.6.2" }, - "peerDependencies": { - "typescript": ">=2.7" - } - }, - "node_modules/tslib": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", - "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", - "dev": true - }, - "node_modules/tslint": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.1.tgz", - "integrity": "sha512-kd6AQ/IgPRpLn6g5TozqzPdGNZ0q0jtXW4//hRcj10qLYBaa3mTUU2y2MCG+RXZm8Zx+KZi0eA+YCrMyNlF4UA==", - "deprecated": "TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.", - "dev": true, "dependencies": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.3", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.10.0", - "tsutils": "^2.29.0" - }, - "bin": { - "tslint": "bin/tslint" - }, - "engines": { - "node": ">=4.8.0" - }, - "peerDependencies": { - "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + "fs-extra": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", + "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true + } } }, - "node_modules/tslint-config-standard": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/tslint-config-standard/-/tslint-config-standard-9.0.0.tgz", - "integrity": "sha512-CAw9J743RnPMemQV/XQ4YyNreC+A1NItACfkm+cBedrOkz6CQfwlnbKn8anUXBfoa4Zo4tjAhblRbsMNcSLfSw==", - "deprecated": "TSLint is deprecated, please move to ESLint: https://github.com/blakeembrey/tslint-config-standard/issues/61", + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, - "dependencies": { - "tslint-eslint-rules": "^5.3.1" + "optional": true, + "peer": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, - "node_modules/tslint-config-standard/node_modules/doctrine": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", - "integrity": "sha512-qiB/Rir6Un6Ad/TIgTRzsremsTGWzs8j7woXvp14jgq00676uBiBT5eUOi+FgRywZFVy5Us/c04ISRpZhRbS6w==", + "electron-to-chromium": { + "version": "1.4.372", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.372.tgz", + "integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung==", + "dev": true + }, + "es-abstract": { + "version": "1.21.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", + "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==", "dev": true, - "dependencies": { - "esutils": "^1.1.6", - "isarray": "0.0.1" - }, - "engines": { - "node": ">=0.10.0" + "requires": { + "array-buffer-byte-length": "^1.0.0", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.2.0", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.7", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" + } + }, + "es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" } }, - "node_modules/tslint-config-standard/node_modules/esutils": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", - "integrity": "sha512-RG1ZkUT7iFJG9LSHr7KDuuMSlujfeTtMNIcInURxKAxhMtwQhI3NrQhz26gZQYlsYZQKzsnwtpKrFKj9K9Qu1A==", + "es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", "dev": true, - "engines": { - "node": ">=0.10.0" + "requires": { + "has": "^1.0.3" } }, - "node_modules/tslint-config-standard/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true - }, - "node_modules/tslint-config-standard/node_modules/tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", - "dev": true - }, - "node_modules/tslint-config-standard/node_modules/tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - }, - "bin": { - "tslint": "bin/tslint" - }, - "engines": { - "node": ">=4.8.0" - }, - "peerDependencies": { - "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" } }, - "node_modules/tslint-config-standard/node_modules/tslint-eslint-rules": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz", - "integrity": "sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==", + "esbuild": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", + "integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.15.18", + "@esbuild/linux-loong64": "0.15.18", + "esbuild-android-64": "0.15.18", + "esbuild-android-arm64": "0.15.18", + "esbuild-darwin-64": "0.15.18", + "esbuild-darwin-arm64": "0.15.18", + "esbuild-freebsd-64": "0.15.18", + "esbuild-freebsd-arm64": "0.15.18", + "esbuild-linux-32": "0.15.18", + "esbuild-linux-64": "0.15.18", + "esbuild-linux-arm": "0.15.18", + "esbuild-linux-arm64": "0.15.18", + "esbuild-linux-mips64le": "0.15.18", + "esbuild-linux-ppc64le": "0.15.18", + "esbuild-linux-riscv64": "0.15.18", + "esbuild-linux-s390x": "0.15.18", + "esbuild-netbsd-64": "0.15.18", + "esbuild-openbsd-64": "0.15.18", + "esbuild-sunos-64": "0.15.18", + "esbuild-windows-32": "0.15.18", + "esbuild-windows-64": "0.15.18", + "esbuild-windows-arm64": "0.15.18" + } + }, + "esbuild-android-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz", + "integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==", "dev": true, - "dependencies": { - "doctrine": "0.7.2", - "tslib": "1.9.0", - "tsutils": "^3.0.0" - }, - "peerDependencies": { - "tslint": "^5.0.0", - "typescript": "^2.2.0 || ^3.0.0" - } + "optional": true }, - "node_modules/tslint-config-standard/node_modules/tslint-eslint-rules/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "esbuild-android-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz", + "integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==", "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } + "optional": true }, - "node_modules/tslint-config-standard/node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "esbuild-darwin-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz", + "integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==", "dev": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } + "optional": true }, - "node_modules/tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "esbuild-darwin-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz", + "integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==", "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "peerDependencies": { - "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" - } + "optional": true }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "esbuild-freebsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz", + "integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==", "dev": true, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } + "optional": true }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true + "esbuild-freebsd-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz", + "integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==", + "dev": true, + "optional": true }, - "node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "esbuild-linux-32": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz", + "integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==", "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } + "optional": true }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "esbuild-linux-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz", + "integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==", "dev": true, - "engines": { - "node": ">=4" - } + "optional": true }, - "node_modules/type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "esbuild-linux-arm": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz", + "integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==", "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "optional": true }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true + "esbuild-linux-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz", + "integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==", + "dev": true, + "optional": true }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "esbuild-linux-mips64le": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz", + "integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==", "dev": true, - "dependencies": { - "is-typedarray": "^1.0.0" - } + "optional": true }, - "node_modules/typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "esbuild-linux-ppc64le": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz", + "integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==", "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } + "optional": true }, - "node_modules/unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "esbuild-linux-riscv64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz", + "integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/unherit": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.2.tgz", - "integrity": "sha512-W3tMnpaMG7ZY6xe/moK04U9fBhi6wEiCYHUW5Mop/wQHf12+79EQGwxYejNdhEz2mkqkBlGwm7pxmgBKMVUj0w==", + "esbuild-linux-s390x": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz", + "integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==", "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "xtend": "^4.0.1" - } + "optional": true }, - "node_modules/unified": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", - "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "esbuild-netbsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz", + "integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==", "dev": true, - "dependencies": { - "bail": "^1.0.0", - "extend": "^3.0.0", - "is-plain-obj": "^1.1.0", - "trough": "^1.0.0", - "vfile": "^2.0.0", - "x-is-string": "^0.1.0" - } + "optional": true }, - "node_modules/union-value": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", - "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "esbuild-openbsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz", + "integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==", "dev": true, - "dependencies": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - }, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/unist-util-is": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", - "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", - "dev": true - }, - "node_modules/unist-util-remove-position": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.3.tgz", - "integrity": "sha512-CtszTlOjP2sBGYc2zcKA/CvNdTdEs3ozbiJ63IPBxh8iZg42SCCb8m04f8z2+V1aSk5a7BxbZKEdoDjadmBkWA==", - "dev": true, - "dependencies": { - "unist-util-visit": "^1.1.0" - } - }, - "node_modules/unist-util-stringify-position": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", - "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", - "dev": true - }, - "node_modules/unist-util-visit": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", - "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", - "dev": true, - "dependencies": { - "unist-util-visit-parents": "^2.0.0" - } - }, - "node_modules/unist-util-visit-parents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", - "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", - "dev": true, - "dependencies": { - "unist-util-is": "^3.0.0" - } - }, - "node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "dependencies": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "dependencies": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-value/node_modules/isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "esbuild-sunos-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz", + "integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==", "dev": true, - "dependencies": { - "isarray": "1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/unset-value/node_modules/has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "esbuild-windows-32": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz", + "integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "optional": true }, - "node_modules/unset-value/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "esbuild-windows-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz", + "integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==", "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/update-section": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/update-section/-/update-section-0.3.3.tgz", - "integrity": "sha1-RY8Xgg03gg3GDiC4bZQ5GwASMVg=", - "dev": true + "optional": true }, - "node_modules/uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "esbuild-windows-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz", + "integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==", "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "deprecated": "Please see https://github.com/lydell/urix#deprecated", - "dev": true + "optional": true }, - "node_modules/use": { + "escalade": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "dev": true, - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/v8-compile-cache": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", - "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", - "dev": true - }, - "node_modules/v8-to-istanbul": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz", - "integrity": "sha512-sAjOC+Kki6aJVbUOXJbcR0MnbfjvBzwKZazEJymA2IX49uoOdEdk+4fBq5cXgYgiyKtAyrrJNtBZdOeDIF+Fng==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0", - "source-map": "^0.7.3" - }, - "engines": { - "node": "8.x.x || >=10.10.0" - } - }, - "node_modules/v8-to-istanbul/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/vfile": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", - "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", - "dev": true, - "dependencies": { - "is-buffer": "^1.1.4", - "replace-ext": "1.0.0", - "unist-util-stringify-position": "^1.0.0", - "vfile-message": "^1.0.0" - } - }, - "node_modules/vfile-location": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.5.tgz", - "integrity": "sha512-Pa1ey0OzYBkLPxPZI3d9E+S4BmvfVwNAAXrrqGbwTVXWaX2p9kM1zZ+n35UtVM06shmWKH4RPRN8KI80qE3wNQ==", - "dev": true - }, - "node_modules/vfile-message": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", - "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", - "dev": true, - "dependencies": { - "unist-util-stringify-position": "^1.1.1" - } - }, - "node_modules/w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "dev": true, - "dependencies": { - "browser-process-hrtime": "^1.0.0" - } - }, - "node_modules/w3c-xmlserializer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", - "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", - "dev": true, - "dependencies": { - "domexception": "^1.0.1", - "webidl-conversions": "^4.0.2", - "xml-name-validator": "^3.0.0" - } - }, - "node_modules/walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", - "dev": true, - "dependencies": { - "makeerror": "1.0.x" - } - }, - "node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true }, - "node_modules/whatwg-encoding": { + "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", - "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", - "dev": true, - "dependencies": { - "iconv-lite": "0.4.24" - } - }, - "node_modules/whatwg-mimetype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", - "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "node_modules/whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "escodegen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", + "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", "dev": true, - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" + "optional": true, + "peer": true, + "requires": { + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" + "eslint": { + "version": "8.39.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz", + "integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.2", + "@eslint/js": "8.39.0", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.0", + "espree": "^9.5.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "node_modules/wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, "dependencies": { - "string-width": "^1.0.2 || 2" - } - }, - "node_modules/wide-align/node_modules/ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "dependencies": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "node_modules/write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, - "dependencies": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "node_modules/ws": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", - "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", - "dev": true, - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/x-is-string": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", - "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=", - "dev": true - }, - "node_modules/xml-name-validator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true - }, - "node_modules/xmlchars": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", - "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true - }, - "node_modules/xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true, - "engines": { - "node": ">=0.4" - } - }, - "node_modules/y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yargs": { - "version": "15.3.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", - "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==", - "dev": true, - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs-parser": { - "version": "18.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.2.tgz", - "integrity": "sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", - "dev": true, - "dependencies": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "node_modules/yargs-unparser/node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "node_modules/yargs-unparser/node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/yargs-unparser/node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/yargs-unparser/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser/node_modules/yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "node_modules/yargs-unparser/node_modules/yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - } - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.8.3" - } - }, - "@babel/core": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.0.tgz", - "integrity": "sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.0", - "@babel/helper-module-transforms": "^7.9.0", - "@babel/helpers": "^7.9.0", - "@babel/parser": "^7.9.0", - "@babel/template": "^7.8.6", - "@babel/traverse": "^7.9.0", - "@babel/types": "^7.9.0", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.13", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.9.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.4.tgz", - "integrity": "sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA==", - "dev": true, - "requires": { - "@babel/types": "^7.9.0", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "@babel/helper-function-name": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", - "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.8.3", - "@babel/template": "^7.8.3", - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", - "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", - "integrity": "sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-module-imports": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", - "integrity": "sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-module-transforms": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz", - "integrity": "sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.8.3", - "@babel/helper-replace-supers": "^7.8.6", - "@babel/helper-simple-access": "^7.8.3", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/template": "^7.8.6", - "@babel/types": "^7.9.0", - "lodash": "^4.17.13" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", - "integrity": "sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", - "integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==", - "dev": true - }, - "@babel/helper-replace-supers": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz", - "integrity": "sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA==", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.8.3", - "@babel/helper-optimise-call-expression": "^7.8.3", - "@babel/traverse": "^7.8.6", - "@babel/types": "^7.8.6" - } - }, - "@babel/helper-simple-access": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", - "integrity": "sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw==", - "dev": true, - "requires": { - "@babel/template": "^7.8.3", - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", - "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz", - "integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==", - "dev": true - }, - "@babel/helpers": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.9.2.tgz", - "integrity": "sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA==", - "dev": true, - "requires": { - "@babel/template": "^7.8.3", - "@babel/traverse": "^7.9.0", - "@babel/types": "^7.9.0" - } - }, - "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.9.0", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.9.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", - "integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==", - "dev": true - }, - "@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/template": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", - "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/parser": "^7.8.6", - "@babel/types": "^7.8.6" - } - }, - "@babel/traverse": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.0.tgz", - "integrity": "sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.0", - "@babel/helper-function-name": "^7.8.3", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/parser": "^7.9.0", - "@babel/types": "^7.9.0", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "@babel/types": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", - "integrity": "sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.9.0", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - } - }, - "@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "@cnakazawa/watch": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", - "integrity": "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==", - "dev": true, - "requires": { - "exec-sh": "^0.3.2", - "minimist": "^1.2.0" - } - }, - "@dsherret/to-absolute-glob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", - "integrity": "sha1-H2R13IvZdM6gei2vOGSzF7HdMyw=", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - } - }, - "@eslint/eslintrc": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", - "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "lodash": "^4.17.20", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - } - } - }, - "@istanbuljs/load-nyc-config": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", - "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - } - }, - "@istanbuljs/schema": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", - "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", - "dev": true - }, - "@jest/console": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-25.2.6.tgz", - "integrity": "sha512-bGp+0PicZVCEhb+ifnW9wpKWONNdkhtJsRE7ap729hiAfTvCN6VhGx0s/l/V/skA2pnyqq+N/7xl9ZWfykDpsg==", - "dev": true, - "requires": { - "@jest/source-map": "^25.2.6", - "chalk": "^3.0.0", - "jest-util": "^25.2.6", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/core": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-25.2.7.tgz", - "integrity": "sha512-Nd6ELJyR+j0zlwhzkfzY70m04hAur0VnMwJXVe4VmmD/SaQ6DEyal++ERQ1sgyKIKKEqRuui6k/R0wHLez4P+g==", - "dev": true, - "requires": { - "@jest/console": "^25.2.6", - "@jest/reporters": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.3", - "jest-changed-files": "^25.2.6", - "jest-config": "^25.2.7", - "jest-haste-map": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-resolve-dependencies": "^25.2.7", - "jest-runner": "^25.2.7", - "jest-runtime": "^25.2.7", - "jest-snapshot": "^25.2.7", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "jest-watcher": "^25.2.7", - "micromatch": "^4.0.2", - "p-each-series": "^2.1.0", - "realpath-native": "^2.0.0", - "rimraf": "^3.0.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/environment": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.2.6.tgz", - "integrity": "sha512-17WIw+wCb9drRNFw1hi8CHah38dXVdOk7ga9exThhGtXlZ9mK8xH4DjSB9uGDGXIWYSHmrxoyS6KJ7ywGr7bzg==", - "dev": true, - "requires": { - "@jest/fake-timers": "^25.2.6", - "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6" - } - }, - "@jest/fake-timers": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", - "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "lolex": "^5.0.0" - } - }, - "@jest/reporters": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", - "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", - "dev": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.2", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.0", - "jest-haste-map": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "node-notifier": "^6.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.0", - "string-length": "^3.1.0", - "terminal-link": "^2.0.0", - "v8-to-istanbul": "^4.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/source-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", - "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", - "dev": true, - "requires": { - "callsites": "^3.0.0", - "graceful-fs": "^4.2.3", - "source-map": "^0.6.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - } - } - }, - "@jest/test-result": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", - "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", - "dev": true, - "requires": { - "@jest/console": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - } - }, - "@jest/test-sequencer": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", - "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", - "dev": true, - "requires": { - "@jest/test-result": "^25.2.6", - "jest-haste-map": "^25.2.6", - "jest-runner": "^25.2.7", - "jest-runtime": "^25.2.7" - } - }, - "@jest/transform": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", - "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.3", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", - "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", - "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.3", - "fastq": "^1.6.0" - } - }, - "@sinonjs/commons": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", - "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@textlint/ast-node-types": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-4.2.2.tgz", - "integrity": "sha512-5VHykhxgUat7dvRWGw52Tk55SWjuZDpDO7PKDhfcLTFrD1cjbTtFFnWeJc0BfoqB2AUjfHXRoMdnqbFRGmnPVQ==", - "dev": true - }, - "@textlint/markdown-to-ast": { - "version": "6.0.9", - "resolved": "https://registry.npmjs.org/@textlint/markdown-to-ast/-/markdown-to-ast-6.0.9.tgz", - "integrity": "sha512-hfAWBvTeUGh5t5kTn2U3uP3qOSM1BSrxzl1jF3nn0ywfZXpRBZr5yRjXnl4DzIYawCtZOshmRi/tI3/x4TE1jQ==", - "dev": true, - "requires": { - "@textlint/ast-node-types": "^4.0.3", - "debug": "^2.1.3", - "remark-frontmatter": "^1.2.0", - "remark-parse": "^5.0.0", - "structured-source": "^3.0.2", - "traverse": "^0.6.6", - "unified": "^6.1.6" - } - }, - "@ts-morph/common": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.7.5.tgz", - "integrity": "sha512-nlFunSKAsFWI0Ol/uPxJcpVqXxTGNuaWXTmoQDhcnwj1UM4QmBSUVWzqoQ0OzUlqo4sV1gobfFBkMHuZVemMAQ==", - "dev": true, - "requires": { - "@dsherret/to-absolute-glob": "^2.0.2", - "fast-glob": "^3.2.5", - "is-negated-glob": "^1.0.0", - "mkdirp": "^1.0.4", - "multimatch": "^5.0.0", - "typescript": "~4.1.3" - }, - "dependencies": { - "fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" - } - }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true - }, - "typescript": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", - "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==", - "dev": true - } - } - }, - "@types/babel__core": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.7.tgz", - "integrity": "sha512-RL62NqSFPCDK2FM1pSDH0scHpJvsXtZNiYlMB73DgPBaG1E38ZYVL+ei5EkWRbr+KC4YNiAUNBnRj+bgwpgjMw==", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "@types/babel__generator": { - "version": "7.6.1", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz", - "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@types/babel__template": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz", - "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@types/babel__traverse": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.9.tgz", - "integrity": "sha512-jEFQ8L1tuvPjOI8lnpaf73oCJe+aoxL6ygqSy6c8LcW98zaC+4mzWuQIRCEvKeCOu+lbqdXcg4Uqmm1S8AP1tw==", - "dev": true, - "requires": { - "@babel/types": "^7.3.0" - } - }, - "@types/benchmark": { - "version": "1.0.31", - "resolved": "https://registry.npmjs.org/@types/benchmark/-/benchmark-1.0.31.tgz", - "integrity": "sha512-F6fVNOkGEkSdo/19yWYOwVKGvzbTeWkR/XQYBKtGBQ9oGRjBN9f/L4aJI4sDcVPJO58Y1CJZN8va9V2BhrZapA==", - "dev": true - }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", - "dev": true - }, - "@types/glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", - "dev": true, - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/istanbul-lib-coverage": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", - "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==", - "dev": true - }, - "@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*" - } - }, - "@types/istanbul-reports": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", - "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, - "@types/jest": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.1.tgz", - "integrity": "sha512-msra1bCaAeEdkSyA0CZ6gW1ukMIvZ5YoJkdXw/qhQdsuuDlFTcEUrUw8CLCPt2rVRUfXlClVvK2gvPs9IokZaA==", - "dev": true, - "requires": { - "jest-diff": "^25.2.1", - "pretty-format": "^25.2.1" - } - }, - "@types/json-schema": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", - "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", - "dev": true - }, - "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true - }, - "@types/node": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.0.tgz", - "integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==", - "dev": true - }, - "@types/prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==", - "dev": true - }, - "@types/stack-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", - "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==", - "dev": true - }, - "@types/yargs": { - "version": "15.0.4", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.4.tgz", - "integrity": "sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "@types/yargs-parser": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", - "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", - "dev": true - }, - "@typescript-eslint/eslint-plugin": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz", - "integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==", - "dev": true, - "requires": { - "@typescript-eslint/experimental-utils": "4.14.1", - "@typescript-eslint/scope-manager": "4.14.1", - "debug": "^4.1.1", - "functional-red-black-tree": "^1.0.1", - "lodash": "^4.17.15", - "regexpp": "^3.0.0", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "tsutils": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", - "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } - } - }, - "@typescript-eslint/experimental-utils": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz", - "integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.14.1", - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/typescript-estree": "4.14.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - } - }, - "@typescript-eslint/parser": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz", - "integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==", - "dev": true, - "requires": { - "@typescript-eslint/scope-manager": "4.14.1", - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/typescript-estree": "4.14.1", - "debug": "^4.1.1" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "@typescript-eslint/scope-manager": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz", - "integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/visitor-keys": "4.14.1" - } - }, - "@typescript-eslint/types": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz", - "integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz", - "integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.14.1", - "@typescript-eslint/visitor-keys": "4.14.1", - "debug": "^4.1.1", - "globby": "^11.0.1", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "globby": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", - "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", - "slash": "^3.0.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "tsutils": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", - "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } - } - }, - "@typescript-eslint/visitor-keys": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz", - "integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.14.1", - "eslint-visitor-keys": "^2.0.0" - } - }, - "abab": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", - "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", - "dev": true - }, - "acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", - "dev": true - }, - "acorn-globals": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", - "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", - "dev": true, - "requires": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - }, - "dependencies": { - "acorn": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", - "dev": true - } - } - }, - "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", - "dev": true, - "requires": {} - }, - "acorn-walk": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", - "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", - "dev": true - }, - "ajv": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", - "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "anchor-markdown-header": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/anchor-markdown-header/-/anchor-markdown-header-0.5.7.tgz", - "integrity": "sha1-BFBj125qH5zTJ6V6ASaqD97Dcac=", - "dev": true, - "requires": { - "emoji-regex": "~6.1.0" - } - }, - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", - "dev": true - }, - "ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - } - }, - "ansi-red": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", - "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", - "dev": true, - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", - "dev": true - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-differ": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", - "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", - "dev": true - }, - "array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", - "dev": true - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "dev": true - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true - }, - "autolinker": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-0.28.1.tgz", - "integrity": "sha1-BlK0kYgYefB3XazgzcoyM5QqTkc=", - "dev": true, - "requires": { - "gulp-header": "^1.7.1" - } - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", - "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", - "dev": true - }, - "babel-jest": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.2.6.tgz", - "integrity": "sha512-MDJOAlwtIeIQiGshyX0d2PxTbV73xZMpNji40ivVTPQOm59OdRR9nYCkffqI7ugtsK4JR98HgNKbDbuVf4k5QQ==", - "dev": true, - "requires": { - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/babel__core": "^7.1.0", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^25.2.6", - "chalk": "^3.0.0", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "babel-plugin-istanbul": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz", - "integrity": "sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^4.0.0", - "test-exclude": "^6.0.0" - } - }, - "babel-plugin-jest-hoist": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.2.6.tgz", - "integrity": "sha512-qE2xjMathybYxjiGFJg0mLFrz0qNp83aNZycWDY/SuHiZNq+vQfRQtuINqyXyue1ELd8Rd+1OhFSLjms8msMbw==", - "dev": true, - "requires": { - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-preset-jest": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.2.6.tgz", - "integrity": "sha512-Xh2eEAwaLY9+SyMt/xmGZDnXTW/7pSaBPG0EMo7EuhvosFKVWYB6CqwYD31DaEQuoTL090oDZ0FEqygffGRaSQ==", - "dev": true, - "requires": { - "@babel/plugin-syntax-bigint": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^25.2.6" - } - }, - "bail": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.4.tgz", - "integrity": "sha512-S8vuDB4w6YpRhICUDET3guPlQpaJl7od94tpZ0Fvnyp+MKW/HyDTcRDck+29C9g+d/qQHnddRH3+94kZdrW0Ww==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - } - } - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "benchmark": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", - "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", - "dev": true, - "requires": { - "lodash": "^4.17.4", - "platform": "^1.3.3" - } - }, - "binary-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", - "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", - "dev": true - }, - "boundary": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/boundary/-/boundary-1.0.1.tgz", - "integrity": "sha1-TWfcJgLAzBbdm85+v4fpSCkPWBI=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - }, - "dependencies": { - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - } - } - }, - "browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, - "browser-resolve": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", - "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", - "dev": true, - "requires": { - "resolve": "1.1.7" - }, - "dependencies": { - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - } - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "requires": { - "fast-json-stable-stringify": "2.x" - } - }, - "bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "capture-exit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", - "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==", - "dev": true, - "requires": { - "rsvp": "^4.8.4" - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "character-entities": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.3.tgz", - "integrity": "sha512-yB4oYSAa9yLcGyTbB4ItFwHw43QHdH129IJ5R+WvxOkWlyFnR5FAaBNnUq4mcxsTVZGh28bHoeTHMKXH1wZf3w==", - "dev": true - }, - "character-entities-legacy": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.3.tgz", - "integrity": "sha512-YAxUpPoPwxYFsslbdKkhrGnXAtXoHNgYjlBM3WMXkWGTl5RsY3QmOyhwAgL8Nxm9l5LBThXGawxKPn68y6/fww==", - "dev": true - }, - "character-reference-invalid": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.3.tgz", - "integrity": "sha512-VOq6PRzQBam/8Jm6XBGk2fNEnHXAdGd6go0rtd4weAGECBamHDwwCQSOT12TACIYUZegUXnV6xBXqUssijtxIg==", - "dev": true - }, - "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", - "dev": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.1.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" - } - }, - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, - "code-block-writer": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", - "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", - "dev": true - }, - "coffee-script": { - "version": "1.12.7", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", - "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", - "dev": true - }, - "collapse-white-space": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.5.tgz", - "integrity": "sha512-703bOOmytCYAX9cXYqoikYIx6twmFCXsnzRQheBcTG3nzKYBR4P/+wkYeH+Mvj7qUz8zZDtdyzbxfnEi/kYzRQ==", - "dev": true - }, - "collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "concat-with-sourcemaps": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", - "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - } - }, - "convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true - }, - "cssstyle": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.2.0.tgz", - "integrity": "sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA==", - "dev": true, - "requires": { - "cssom": "~0.3.6" - }, - "dependencies": { - "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - } - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "data-urls": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", - "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", - "dev": true, - "requires": { - "abab": "^2.0.0", - "whatwg-mimetype": "^2.2.0", - "whatwg-url": "^7.0.0" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - } - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true - }, - "diacritics-map": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/diacritics-map/-/diacritics-map-0.1.0.tgz", - "integrity": "sha1-bfwP+dAQAKLt8oZTccrDFulJd68=", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "diff-sequences": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-25.2.6.tgz", - "integrity": "sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "docs-ts": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/docs-ts/-/docs-ts-0.6.2.tgz", - "integrity": "sha512-61u998y7nKi9J3/Vw8BRXeNAIepDsODmVKvPHgqRdMGSE+nR/yb7b5qspCbcUcsCnJ9eDhTJc22nlGdt0NSPRw==", - "dev": true, - "requires": { - "chalk": "^2.4.2", - "doctrine": "^3.0.0", - "fp-ts": "^2.9.3", - "fs-extra": "^7.0.1", - "glob": "^7.1.6", - "io-ts": "^2.2.13", - "logging-ts": "^0.3.4", - "markdown-toc": "^1.2.0", - "rimraf": "^2.7.1", - "ts-morph": "^9.1.0", - "ts-node": "^8.10.2" - }, - "dependencies": { - "fp-ts": { - "version": "2.9.5", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.9.5.tgz", - "integrity": "sha512-MiHrA5teO6t8zKArE3DdMPT/Db6v2GUt5yfWnhBTrrsVfeCJUUnV6sgFvjGNBKDmEMqVwRFkEePL7wPwqrLKKA==", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", - "dev": true, - "requires": { - "arg": "^4.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.17", - "yn": "3.1.1" - } - } - } - }, - "doctoc": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/doctoc/-/doctoc-1.4.0.tgz", - "integrity": "sha512-8IAq3KdMkxhXCUF+xdZxdJxwuz8N2j25sMgqiu4U4JWluN9tRKMlAalxGASszQjlZaBprdD2YfXpL3VPWUD4eg==", - "dev": true, - "requires": { - "@textlint/markdown-to-ast": "~6.0.9", - "anchor-markdown-header": "^0.5.5", - "htmlparser2": "~3.9.2", - "minimist": "~1.2.0", - "underscore": "~1.8.3", - "update-section": "^0.3.0" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - } - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", - "dev": true, - "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, - "domexception": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", - "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", - "dev": true, - "requires": { - "webidl-conversions": "^4.0.2" - } - }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "dtslint": { - "version": "git+ssh://git@github.com/gcanti/dtslint.git#f361dc93d6a195f530df28779082548e01cecd5e", - "dev": true, - "from": "dtslint@gcanti/dtslint", - "requires": { - "fs-extra": "^6.0.1", - "parsimmon": "^1.12.0", - "strip-json-comments": "^2.0.1", - "tslint": "^5.12.0", - "typescript": "^4.6.2" - }, - "dependencies": { - "fs-extra": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", - "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - } - } - } - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "emoji-regex": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.1.3.tgz", - "integrity": "sha1-7HmjlpsC0uzytyJUJ5v5m8eoOTI=", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - }, - "dependencies": { - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - } - } - }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true - }, - "es-abstract": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", - "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", - "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", - "dev": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - } - }, - "eslint": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz", - "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.3.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.2.0", - "esutils": "^2.0.2", - "file-entry-cache": "^6.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash": "^4.17.20", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.4", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - } - } - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", - "dev": true - }, - "espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", - "dev": true, - "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "exec-sh": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz", - "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==", - "dev": true - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", - "dev": true - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "color-convert": "^2.0.1" } - } - } - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "^2.1.0" - } - }, - "expect": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/expect/-/expect-25.2.7.tgz", - "integrity": "sha512-yA+U2Ph0MkMsJ9N8q5hs9WgWI6oJYfecdXta6LkP/alY/jZZL1MHlJ2wbLh60Ucqf3G+51ytbqV3mlGfmxkpNw==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "ansi-styles": "^4.0.0", - "jest-get-type": "^25.2.6", - "jest-matcher-utils": "^25.2.7", - "jest-message-util": "^25.2.6", - "jest-regex-util": "^25.2.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" } }, "color-convert": { @@ -14036,2000 +10645,1034 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "ms": "2.1.2" } }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-scope": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" } }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" } }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true - } - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-check": { - "version": "1.24.2", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-1.24.2.tgz", - "integrity": "sha512-ZL48cyZZLJnVsUj127Zi1mfFLM98yzw0LlSSH8CMeVmpL5RCfSRcZSZZ0kJWrRK4eOgNFnXXKNDbzuRb3Vsdhg==", - "dev": true, - "requires": { - "pure-rand": "^2.0.0", - "tslib": "^1.10.0" - } - }, - "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", - "dev": true - }, - "fast-glob": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.2.tgz", - "integrity": "sha512-UDV82o4uQyljznxwMxyVRJgZZt3O5wENYojjzbaGEGZgeOxkLFf+V4cnUD+krzb2F72E18RhamkMZ7AdeggF7A==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fastq": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", - "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fault": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.3.tgz", - "integrity": "sha512-sfFuP4X0hzrbGKjAUNXYvNqsZ5F6ohx/dZ9I0KQud/aiZNwg263r5L9yGB0clvXHCkzXh5W3t7RSHchggYIFmA==", - "dev": true, - "requires": { - "format": "^0.2.2" - } - }, - "fb-watchman": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", - "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", - "dev": true, - "requires": { - "bser": "2.1.1" - } - }, - "file-entry-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz", - "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", - "dev": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "dev": true, - "requires": { - "is-buffer": "~2.0.3" - }, - "dependencies": { - "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true - } - } - }, - "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - } - }, - "flatted": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", - "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", - "dev": true - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "format": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", - "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=", - "dev": true - }, - "fp-ts": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.0.tgz", - "integrity": "sha512-xkC9ZKl/i2cU+8FAsdyLcTvPRXphp42FcK5WmZpB47VXb4gggC3DHlVDKNLdbC+U8zz6yp1b0bj0mZg0axmZYQ==", - "dev": true - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "graceful-fs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", - "dev": true - }, - "gray-matter": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-2.1.1.tgz", - "integrity": "sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=", - "dev": true, - "requires": { - "ansi-red": "^0.1.1", - "coffee-script": "^1.12.4", - "extend-shallow": "^2.0.1", - "js-yaml": "^3.8.1", - "toml": "^2.3.2" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "growly": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", - "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true, - "optional": true - }, - "gulp-header": { - "version": "1.8.12", - "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.12.tgz", - "integrity": "sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ==", - "dev": true, - "requires": { - "concat-with-sourcemaps": "*", - "lodash.template": "^4.4.0", - "through2": "^2.0.0" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "dev": true, - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "eslint-import-resolver-node": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz", + "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==", "dev": true, "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" + "debug": "^3.2.7", + "is-core-module": "^2.11.0", + "resolve": "^1.22.1" }, "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true } } }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "debug": "^3.2.7" }, "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } + "ms": "^2.1.1" } }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true } } }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", - "dev": true, - "requires": { - "whatwg-encoding": "^1.0.1" - } - }, - "html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "htmlparser2": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", - "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", - "dev": true, - "requires": { - "domelementtype": "^1.3.0", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", - "dev": true - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "eslint-plugin-deprecation": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-deprecation/-/eslint-plugin-deprecation-1.4.1.tgz", + "integrity": "sha512-4vxTghWzxsBukPJVQupi6xlTuDc8Pyi1QlRCrFiLgwLPMJQW3cJCNaehJUKQqQFvuue5m4W27e179Y3Qjzeghg==", "dev": true, "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" + "@typescript-eslint/utils": "^5.57.0", + "tslib": "^2.3.1", + "tsutils": "^3.21.0" }, "dependencies": { - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } } } }, - "import-local": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", - "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", - "dev": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - } - }, - "import-path-rewrite": { - "version": "git+ssh://git@github.com/gcanti/import-path-rewrite.git#536890c96ad6bd6d347aae08958c8404b8d51e86", - "integrity": "sha512-PtAwJ2v+eVo8iggV16kFtU04w20Al3sp3/A0k9AP4d2GOIH5czbYT0GhKLFOWr5jDfiNm1KffW22KI/RKelWpg==", + "eslint-plugin-import": { + "version": "2.27.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz", + "integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==", "dev": true, - "from": "import-path-rewrite@github:gcanti/import-path-rewrite", "requires": { - "chalk": "^3.0.0", - "fp-ts": "^2.0.0", - "glob": "^7.1.6" + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.7.4", + "has": "^1.0.3", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.6", + "resolve": "^1.22.1", + "semver": "^6.3.0", + "tsconfig-paths": "^3.14.1" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "ms": "^2.1.1" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "color-name": "~1.1.4" + "esutils": "^2.0.2" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "brace-expansion": "^1.1.7" } }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "io-ts": { - "version": "2.2.14", - "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.14.tgz", - "integrity": "sha512-UWL1mdDe5YI4+/7YlrbsSwKmsECFFlWcVHT2CPGzeNODHj2qY0cibjulYfrfz5SCPoDAsjVP7vFKGcF+L10+SQ==", - "dev": true, - "requires": {} - }, - "ip-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", - "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", - "dev": true - }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dev": true, - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-alphabetical": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.3.tgz", - "integrity": "sha512-eEMa6MKpHFzw38eKm56iNNi6GJ7lf6aLLio7Kr23sJPAECscgRtZvOBYybejWDQ2bM949Y++61PY+udzj5QMLA==", - "dev": true - }, - "is-alphanumerical": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.3.tgz", - "integrity": "sha512-A1IGAPO5AW9vSh7omxIlOGwIqEvpW/TA+DksVOPM5ODuxKlZS09+TEM1E3275lJqO2oJ38vDpeAL3DCIiHE6eA==", - "dev": true, - "requires": { - "is-alphabetical": "^1.0.0", - "is-decimal": "^1.0.0" - } - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", - "dev": true + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "eslint-plugin-simple-import-sort": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz", + "integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==", "dev": true, - "requires": { - "ci-info": "^2.0.0" - } + "requires": {} }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "requires": { - "kind-of": "^3.0.2" + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" } }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, - "is-decimal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.3.tgz", - "integrity": "sha512-bvLSwoDg2q6Gf+E2LEPiklHZxxiSi3XAh4Mav65mKqTfCO1HM3uBs24TjEH8iJX3bbDdLXKJXBTmGzuTUuAEjQ==", + "eslint-visitor-keys": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", + "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", "dev": true }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "espree": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", + "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.0" }, "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true } } }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true - }, - "is-glob": { + "esprima": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-hexadecimal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.3.tgz", - "integrity": "sha512-zxQ9//Q3D/34poZf8fiy3m3XVpbQc7ren15iKqrTtLPwkPD/t3Scy9Imp63FujULGxuK0ZlCwoo5xNpktFgbOA==", - "dev": true - }, - "is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", - "dev": true - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "requires": { - "isobject": "^3.0.1" + "estraverse": "^5.1.0" }, "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true } } }, - "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "requires": { - "has": "^1.0.3" + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } } }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dev": true, - "requires": { - "is-unc-path": "^1.0.0" - } + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "has-symbols": "^1.0.1" + "fill-range": "^2.1.0" } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true, + "optional": true, + "peer": true }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "unc-path-regex": "^0.1.2" + "is-extendable": "^0.1.0" } }, - "is-whitespace-character": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.3.tgz", - "integrity": "sha512-SNPgMLz9JzPccD3nPctcj8sZlX9DAMJSKH8bP7Z6bohCwuNgX8xbWr1eTAYXX9Vpi/aSn8Y1akL9WgM3t43YNQ==", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "is-word-character": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.3.tgz", - "integrity": "sha512-0wfcrFgOOOBdgRNT9H33xe6Zi6yhX/uoc4U8NBZGeQQB0ctU1dnlNTyL9JM2646bHDTpsDm1Brb3VPoCIMrd/A==", - "dev": true + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true, + "optional": true, + "peer": true }, - "is-wsl": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.1.1.tgz", - "integrity": "sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog==", + "fast-check": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-1.26.0.tgz", + "integrity": "sha512-B1AjSfe0bmi6FdFIzmrrGSjrsF6e2MCmZiM6zJaRbBMP+gIvdNakle5FIMKi0xbS9KlN9BZho1R7oB/qoNIQuA==", "dev": true, - "optional": true + "requires": { + "pure-rand": "^2.0.0", + "tslib": "^2.0.0" + }, + "dependencies": { + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", + "dev": true + } + } }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "requires": { - "isarray": "1.0.0" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" } }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, - "istanbul-lib-coverage": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", - "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "istanbul-lib-instrument": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz", - "integrity": "sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg==", + "fastq": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", "dev": true, "requires": { - "@babel/core": "^7.7.5", - "@babel/parser": "^7.7.5", - "@babel/template": "^7.7.4", - "@babel/traverse": "^7.7.4", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } + "reusify": "^1.0.4" } }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" } }, - "istanbul-lib-source-maps": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", - "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" }, "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { - "ms": "^2.1.1" + "glob": "^7.1.3" } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true } } }, - "istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" + "is-callable": "^1.1.3" } }, - "jest": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest/-/jest-25.2.7.tgz", - "integrity": "sha512-XV1n/CE2McCikl4tfpCY950RytHYvxdo/wvtgmn/qwA8z1s16fuvgFL/KoPrrmkqJTaPMUlLVE58pwiaTX5TdA==", + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true, + "optional": true, + "peer": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, + "optional": true, + "peer": true, "requires": { - "@jest/core": "^25.2.7", - "import-local": "^3.0.2", - "jest-cli": "^25.2.7" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-cli": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.2.7.tgz", - "integrity": "sha512-OOAZwY4Jkd3r5WhVM5L3JeLNFaylvHUczMLxQDVLrrVyb1Cy+DNJ6MVsb5TLh6iBklB42m5TOP+IbOgKGGOtMw==", - "dev": true, - "requires": { - "@jest/core": "^25.2.7", - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "import-local": "^3.0.2", - "is-ci": "^2.0.0", - "jest-config": "^25.2.7", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "prompts": "^2.0.1", - "realpath-native": "^2.0.0", - "yargs": "^15.3.1" - } - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" } }, - "jest-changed-files": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.2.6.tgz", - "integrity": "sha512-F7l2m5n55jFnJj4ItB9XbAlgO+6umgvz/mdK76BfTd2NGkvGf9x96hUXP/15a1K0k14QtVOoutwpRKl360msvg==", + "fp-ts": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.14.0.tgz", + "integrity": "sha512-QLagLSYAgMA00pZzUzeksH/78Sd14y7+Gc2A8Yaja3/IpGOFMdm/gYBuDMxYqLsJ58iT5lz+bJb953RAeFfp1A==" + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dev": true, "requires": { - "@jest/types": "^25.2.6", - "execa": "^3.2.0", - "throat": "^5.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "execa": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", - "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "p-finally": "^2.0.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "p-finally": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", - "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - } + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" } }, - "jest-config": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.2.7.tgz", - "integrity": "sha512-rIdPPXR6XUxi+7xO4CbmXXkE6YWprvlKc4kg1SrkCL2YV5m/8MkHstq9gBZJ19Qoa3iz/GP+0sTG/PcIwkFojg==", + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", "dev": true, "requires": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^25.2.7", - "@jest/types": "^25.2.6", - "babel-jest": "^25.2.6", - "chalk": "^3.0.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.1", - "jest-environment-jsdom": "^25.2.6", - "jest-environment-node": "^25.2.6", - "jest-get-type": "^25.2.6", - "jest-jasmine2": "^25.2.7", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "micromatch": "^4.0.2", - "pretty-format": "^25.2.6", - "realpath-native": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true + }, + "get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" } }, - "jest-diff": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.2.6.tgz", - "integrity": "sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==", + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", "dev": true, "requires": { - "chalk": "^3.0.0", - "diff-sequences": "^25.2.6", - "jest-get-type": "^25.2.6", - "pretty-format": "^25.2.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" } }, - "jest-docblock": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.2.6.tgz", - "integrity": "sha512-VAYrljEq0upq0oERfIaaNf28gC6p9gORndhHstCYF8NWGNQJnzoaU//S475IxfWMk4UjjVmS9rJKLe5Jjjbixw==", + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, + "optional": true, + "peer": true, "requires": { - "detect-newline": "^3.0.0" + "assert-plus": "^1.0.0" } }, - "jest-each": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.2.6.tgz", - "integrity": "sha512-OgQ01VINaRD6idWJOhCYwUc5EcgHBiFlJuw+ON2VgYr7HLtMFyCcuo+3mmBvuLUH4QudREZN7cDCZviknzsaJQ==", + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "jest-get-type": "^25.2.6", - "jest-util": "^25.2.6", - "pretty-format": "^25.2.6" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { - "has-flag": "^4.0.0" + "brace-expansion": "^1.1.7" } } } }, - "jest-environment-jsdom": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.2.6.tgz", - "integrity": "sha512-/o7MZIhGmLGIEG5j7r5B5Az0umWLCHU+F5crwfbm0BzC4ybHTJZOQTFQWhohBg+kbTCNOuftMcqHlVkVduJCQQ==", - "dev": true, - "requires": { - "@jest/environment": "^25.2.6", - "@jest/fake-timers": "^25.2.6", - "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "jsdom": "^15.2.1" - } - }, - "jest-environment-node": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.2.6.tgz", - "integrity": "sha512-D1Ihj14fxZiMHGeTtU/LunhzSI+UeBvlr/rcXMTNyRMUMSz2PEhuqGbB78brBY6Dk3FhJDk7Ta+8reVaGjLWhA==", + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { - "@jest/environment": "^25.2.6", - "@jest/fake-timers": "^25.2.6", - "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } + "is-glob": "^4.0.1" } }, - "jest-get-type": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-25.2.6.tgz", - "integrity": "sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==", + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, "requires": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - } + "define-properties": "^1.1.3" } }, - "jest-jasmine2": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.2.7.tgz", - "integrity": "sha512-HeQxEbonp8fUvik9jF0lkU9ab1u5TQdIb7YSU9Fj7SxWtqHNDGyCpF6ZZ3r/5yuertxi+R95Ba9eA91GMQ38eA==", + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "requires": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^25.2.6", - "@jest/source-map": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "co": "^4.6.0", - "expect": "^25.2.7", - "is-generator-fn": "^2.0.0", - "jest-each": "^25.2.6", - "jest-matcher-utils": "^25.2.7", - "jest-message-util": "^25.2.6", - "jest-runtime": "^25.2.7", - "jest-snapshot": "^25.2.7", - "jest-util": "^25.2.6", - "pretty-format": "^25.2.6", - "throat": "^5.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" } }, - "jest-leak-detector": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-25.2.6.tgz", - "integrity": "sha512-n+aJUM+j/x1kIaPVxzerMqhAUuqTU1PL5kup46rXh+l9SP8H6LqECT/qD1GrnylE1L463/0StSPkH4fUpkuEjA==", + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dev": true, "requires": { - "jest-get-type": "^25.2.6", - "pretty-format": "^25.2.6" + "get-intrinsic": "^1.1.3" } }, - "jest-matcher-utils": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-25.2.7.tgz", - "integrity": "sha512-jNYmKQPRyPO3ny0KY1I4f0XW4XnpJ3Nx5ovT4ik0TYDOYzuXJW40axqOyS61l/voWbVT9y9nZ1THL1DlpaBVpA==", + "graceful-fs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "dev": true + }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, + "gray-matter": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-2.1.1.tgz", + "integrity": "sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=", "dev": true, "requires": { - "chalk": "^3.0.0", - "jest-diff": "^25.2.6", - "jest-get-type": "^25.2.6", - "pretty-format": "^25.2.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "ansi-red": "^0.1.1", + "coffee-script": "^1.12.4", + "extend-shallow": "^2.0.1", + "js-yaml": "^3.8.1", + "toml": "^2.3.2" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "gulp-header": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-1.8.12.tgz", + "integrity": "sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ==", + "dev": true, + "requires": { + "concat-with-sourcemaps": "*", + "lodash.template": "^4.4.0", + "through2": "^2.0.0" } }, - "jest-message-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-25.2.6.tgz", - "integrity": "sha512-Hgg5HbOssSqOuj+xU1mi7m3Ti2nwSQJQf/kxEkrz2r2rp2ZLO1pMeKkz2WiDUWgSR+APstqz0uMFcE5yc0qdcg==", + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true, + "optional": true, + "peer": true + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "dev": true, + "optional": true, + "peer": true, "requires": { - "@babel/code-frame": "^7.0.0", - "@jest/types": "^25.2.6", - "@types/stack-utils": "^1.0.1", - "chalk": "^3.0.0", - "micromatch": "^4.0.2", - "slash": "^3.0.0", - "stack-utils": "^1.0.1" + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, - "jest-mock": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-25.2.6.tgz", - "integrity": "sha512-vc4nibavi2RGPdj/MyZy/azuDjZhpYZLvpfgq1fxkhbyTpKVdG7CgmRVKJ7zgLpY5kuMjTzDYA6QnRwhsCU+tA==", + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", "dev": true, "requires": { - "@jest/types": "^25.2.6" + "get-intrinsic": "^1.1.1" } }, - "jest-pnp-resolver": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", - "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==", + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", "dev": true, - "requires": {} + "requires": { + "has-symbols": "^1.0.2" + } }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha512-z/GDPjlRMNOa2XJiB4em8wJpuuBfrFOlYKTZxtpkdr1uPdibHI8rYA3MY0KDObpVyaes0e/aunid/t88ZI2EKA==", "dev": true }, - "jest-resolve": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-25.2.6.tgz", - "integrity": "sha512-7O61GVdcAXkLz/vNGKdF+00A80/fKEAA47AEXVNcZwj75vEjPfZbXDaWFmAQCyXj4oo9y9dC9D+CLA11t8ieGw==", + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", "dev": true, + "optional": true, + "peer": true, "requires": { - "@jest/types": "^25.2.6", - "browser-resolve": "^1.11.3", - "chalk": "^3.0.0", - "jest-pnp-resolver": "^1.2.1", - "realpath-native": "^2.0.0", - "resolve": "^1.15.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "whatwg-encoding": "^1.0.1" + } + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, - "jest-resolve-dependencies": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.2.7.tgz", - "integrity": "sha512-IrnMzCAh11Xd2gAOJL+ThEW6QO8DyqNdvNkQcaCticDrOAr9wtKT7yT6QBFFjqKFgjjvaVKDs59WdgUhgYnHnQ==", + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, + "optional": true, + "peer": true, "requires": { - "@jest/types": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-snapshot": "^25.2.7" + "safer-buffer": ">= 2.1.2 < 3" } }, - "jest-runner": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.2.7.tgz", - "integrity": "sha512-RFEr71nMrtNwcpoHzie5+fe1w3JQCGMyT2xzNwKe3f88+bK+frM2o1v24gEcPxQ2QqB3COMCe2+1EkElP+qqqQ==", + "ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "requires": { - "@jest/console": "^25.2.6", - "@jest/environment": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.3", - "jest-config": "^25.2.7", - "jest-docblock": "^25.2.6", - "jest-haste-map": "^25.2.6", - "jest-jasmine2": "^25.2.7", - "jest-leak-detector": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-runtime": "^25.2.7", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "source-map-support": "^0.5.6", - "throat": "^5.0.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "has-flag": { + "resolve-from": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true } } }, - "jest-runtime": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.2.7.tgz", - "integrity": "sha512-Gw3X8KxTTFylu2T/iDSNKRUQXQiPIYUY0b66GwVYa7W8wySkUljKhibQHSq0VhmCAN7vRBEQjlVQ+NFGNmQeBw==", + "import-path-rewrite": { + "version": "git+ssh://git@github.com/gcanti/import-path-rewrite.git#536890c96ad6bd6d347aae08958c8404b8d51e86", "dev": true, + "from": "import-path-rewrite@github:gcanti/import-path-rewrite", "requires": { - "@jest/console": "^25.2.6", - "@jest/environment": "^25.2.6", - "@jest/source-map": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/yargs": "^15.0.0", "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.3", - "jest-config": "^25.2.7", - "jest-haste-map": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-snapshot": "^25.2.7", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0", - "yargs": "^15.3.1" + "fp-ts": "^2.0.0", + "glob": "^7.1.6" }, "dependencies": { "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, @@ -16058,12 +11701,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -16071,9 +11708,9 @@ "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -16081,205 +11718,335 @@ } } }, - "jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "jest-snapshot": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-25.2.7.tgz", - "integrity": "sha512-Rm8k7xpGM4tzmYhB6IeRjsOMkXaU8/FOz5XlU6oYwhy53mq6txVNqIKqN1VSiexzpC80oWVxVDfUDt71M6XPOA==", + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "@babel/types": "^7.0.0", - "@jest/types": "^25.2.6", - "@types/prettier": "^1.19.0", - "chalk": "^3.0.0", - "expect": "^25.2.7", - "jest-diff": "^25.2.6", - "jest-get-type": "^25.2.6", - "jest-matcher-utils": "^25.2.7", - "jest-message-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "make-dir": "^3.0.0", - "natural-compare": "^1.4.0", - "pretty-format": "^25.2.6", - "semver": "^6.3.0" + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "io-ts": { + "version": "2.2.20", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.20.tgz", + "integrity": "sha512-Rq2BsYmtwS5vVttie4rqrOCIfHCS9TgpRLFpKQCM1wZBBRY9nWVGmEvm2FnDbSE2un1UE39DvFpTR5UL47YDcA==", + "dev": true, + "requires": {} + }, + "ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", + "dev": true, + "optional": true, + "peer": true + }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dev": true, + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + } + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true + }, + "is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "dev": true + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dev": true, + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true, + "optional": true, + "peer": true + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dev": true, + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "call-bind": "^1.0.2" + } + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" } }, - "jest-validate": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-25.2.6.tgz", - "integrity": "sha512-a4GN7hYbqQ3Rt9iHsNLFqQz7HDV7KiRPCwPgo5nqtTIWNZw7gnT8KchG+Riwh+UTSn8REjFCodGp50KX/fRNgQ==", + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true, + "optional": true, + "peer": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", "dev": true, "requires": { - "@jest/types": "^25.2.6", - "camelcase": "^5.3.1", - "chalk": "^3.0.0", - "jest-get-type": "^25.2.6", - "leven": "^3.1.0", - "pretty-format": "^25.2.6" + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -16297,99 +12064,56 @@ } } }, - "jest-watcher": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-25.2.7.tgz", - "integrity": "sha512-RdHuW+f49tahWtluTnUdZ2iPliebleROI2L/J5phYrUS6DPC9RB3SuUtqYyYhGZJsbvRSuLMIlY/cICJ+PIecw==", + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", "dev": true, "requires": { - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "jest-util": "^25.2.6", - "string-length": "^3.1.0" + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { - "color-name": "~1.1.4" + "ms": "^2.1.1" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, - "jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", "dev": true, "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" } }, + "js-sdsl": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", + "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", + "dev": true + }, + "js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -16410,13 +12134,17 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "jsdom": { "version": "15.2.1", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", "dev": true, + "optional": true, + "peer": true, "requires": { "abab": "^2.0.0", "acorn": "^7.1.0", @@ -16456,7 +12184,9 @@ "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "json-schema-traverse": { "version": "0.4.1", @@ -16474,16 +12204,21 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "json5": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", - "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true }, "jsonfile": { "version": "4.0.0", @@ -16499,6 +12234,8 @@ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "dev": true, + "optional": true, + "peer": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -16515,12 +12252,6 @@ "is-buffer": "^1.1.5" } }, - "kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true - }, "lazy-cache": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", @@ -16530,17 +12261,13 @@ "set-getter": "^0.1.0" } }, - "leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true - }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, + "optional": true, + "peer": true, "requires": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -16558,14 +12285,11 @@ "repeat-string": "^1.5.2" } }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } + "local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true }, "lodash": { "version": "4.17.15", @@ -16579,17 +12303,19 @@ "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", "dev": true }, - "lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "lodash.template": { "version": "4.5.0", @@ -16603,20 +12329,11 @@ }, "lodash.templatesettings": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", - "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0" - } - }, - "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", + "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", "dev": true, "requires": { - "chalk": "^2.4.2" + "lodash._reinterpolate": "^3.0.0" } }, "logging-ts": { @@ -16626,13 +12343,13 @@ "dev": true, "requires": {} }, - "lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", "dev": true, "requires": { - "@sinonjs/commons": "^1.7.0" + "get-func-name": "^2.0.0" } }, "lru-cache": { @@ -16644,6 +12361,15 @@ "yallist": "^4.0.0" } }, + "magic-string": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz", + "integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==", + "dev": true, + "requires": { + "@jridgewell/sourcemap-codec": "^1.4.13" + } + }, "make-dir": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", @@ -16667,36 +12393,6 @@ "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", "dev": true }, - "makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", - "dev": true, - "requires": { - "tmpl": "1.0.x" - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "markdown-escapes": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.3.tgz", - "integrity": "sha512-XUi5HJhhV5R74k8/0H2oCbCiYf/u4cO/rX8tnGkRvrqhsr5BRNU6Mg0yt/8UIx1iIS8220BNJsDb7XnILhLepw==", - "dev": true - }, "markdown-link": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/markdown-link/-/markdown-link-0.1.1.tgz", @@ -16729,11 +12425,14 @@ "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", "dev": true }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true + "md5-hex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", + "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", + "dev": true, + "requires": { + "blueimp-md5": "^2.10.0" + } }, "merge2": { "version": "1.4.1", @@ -16742,36 +12441,34 @@ "dev": true }, "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" + "braces": "^3.0.2", + "picomatch": "^2.3.1" } }, "mime-db": { "version": "1.43.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "mime-types": { "version": "2.1.26", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", "dev": true, + "optional": true, + "peer": true, "requires": { "mime-db": "1.43.0" } }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -16817,62 +12514,58 @@ "minimist": "^1.2.5" } }, + "mlly": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.2.0.tgz", + "integrity": "sha512-+c7A3CV0KGdKcylsI6khWyts/CYrGTrRVo4R/I7u/cUsy0Conxa6LUhiEzVKIw14lc2L5aiO4+SeVe4TeGRKww==", + "dev": true, + "requires": { + "acorn": "^8.8.2", + "pathe": "^1.1.0", + "pkg-types": "^1.0.2", + "ufo": "^1.1.1" + }, + "dependencies": { + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true + } + } + }, "mocha": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz", - "integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", "dev": true, "requires": { - "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", - "chokidar": "3.3.0", - "debug": "3.2.6", + "commander": "2.15.1", + "debug": "3.1.0", "diff": "3.5.0", "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", + "glob": "7.1.2", "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", + "he": "1.1.1", "minimatch": "3.0.4", - "mkdirp": "0.5.3", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" + "mkdirp": "0.5.1", + "supports-color": "5.4.0" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.0.0" } }, "diff": { @@ -16881,25 +12574,10 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -16910,128 +12588,29 @@ "path-is-absolute": "^1.0.0" } }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", "dev": true }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, "mkdirp": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", - "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "minimist": "0.0.8" } }, "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "requires": { "has-flag": "^3.0.0" } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } } } }, @@ -17054,51 +12633,11 @@ "minimatch": "^3.0.4" } }, - "nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - } - } + "nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true }, "natural-compare": { "version": "1.4.0", @@ -17106,120 +12645,38 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - } - }, - "node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", - "dev": true - }, - "node-modules-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, - "node-notifier": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-6.0.0.tgz", - "integrity": "sha512-SVfQ/wMw+DesunOm5cKqr6yDcvUTDl/yc97ybGHMrteNEY6oekXpNpS3lZwgLlwz0FLgHoiW28ZpmBHUDg37cw==", - "dev": true, - "optional": true, - "requires": { - "growly": "^1.3.0", - "is-wsl": "^2.1.1", - "semver": "^6.3.0", - "shellwords": "^0.1.1", - "which": "^1.3.1" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "optional": true - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "optional": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", "dev": true }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, "nwsapi": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } + "optional": true, + "peer": true }, "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", "dev": true }, "object-keys": { @@ -17228,43 +12685,16 @@ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", - "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" } }, "object.pick": { @@ -17284,6 +12714,17 @@ } } }, + "object.values": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", + "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -17293,20 +12734,13 @@ "wrappy": "1" } }, - "onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, + "optional": true, + "peer": true, "requires": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", @@ -17316,70 +12750,22 @@ "word-wrap": "~1.2.3" } }, - "p-each-series": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", - "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "requires": { - "callsites": "^3.0.0" - } - }, - "parse-entities": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", - "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", - "dev": true, - "requires": { - "character-entities": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "character-reference-invalid": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-hexadecimal": "^1.0.0" + "callsites": "^3.0.0" } }, "parse5": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "parsimmon": { "version": "1.18.1", @@ -17387,12 +12773,6 @@ "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==", "dev": true }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -17405,16 +12785,10 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "path-type": { @@ -17423,34 +12797,47 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "pathe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.0.tgz", + "integrity": "sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true, + "optional": true, + "peer": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, - "pirates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", - "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", - "dev": true, - "requires": { - "node-modules-regexp": "^1.0.0" - } - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "pkg-types": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.2.tgz", + "integrity": "sha512-hM58GKXOcj8WTqUXnsQyJYXdeAPbythQgEF3nTcEo+nkD49chjQ9IKm/QJy9xf6JakXptz86h7ecP2024rrLaQ==", "dev": true, "requires": { - "find-up": "^4.0.0" + "jsonc-parser": "^3.2.0", + "mlly": "^1.1.1", + "pathe": "^1.1.0" } }, "platform": { @@ -17463,102 +12850,48 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true + "postcss": { + "version": "8.4.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", + "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", + "dev": true, + "requires": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "prettier": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz", - "integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true }, - "pretty-format": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.2.6.tgz", - "integrity": "sha512-DEiWxLBaCHneffrIT4B+TpMvkV9RNvvJrd3lY9ew1CEQobDzEXmYT1mg0hJhljZty7kCc10z13ohOFAE8jrUDg==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "ansi-regex": "^5.0.0", - "ansi-styles": "^4.0.0", - "react-is": "^16.12.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "prompts": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", - "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", - "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.4" - } - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } + "optional": true, + "peer": true }, "punycode": { "version": "2.1.1", @@ -17576,6 +12909,14 @@ "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true, + "optional": true, + "peer": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, "randomatic": { @@ -17603,12 +12944,6 @@ } } }, - "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true - }, "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", @@ -17624,89 +12959,15 @@ "util-deprecate": "~1.0.1" } }, - "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", - "dev": true, - "requires": { - "picomatch": "^2.0.4" - } - }, - "realpath-native": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-2.0.0.tgz", - "integrity": "sha512-v1SEYUOXXdbBZK8ZuNgO4TBjamPsiSgcFr0aP+tEKpQZK8vooEUqV6nm6Cv502mX4NF2EfsnVqtNAHG+/6Ur1Q==", - "dev": true - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", - "dev": true - }, - "remark-frontmatter": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-1.3.2.tgz", - "integrity": "sha512-2eayxITZ8rezsXdgcXnYB3iLivohm2V/ZT4Ne8uhua6A4pk6GdLE2ZzJnbnINtD1HRLaTdB7RwF9sgUbMptJZA==", - "dev": true, - "requires": { - "fault": "^1.0.1", - "xtend": "^4.0.1" - } - }, - "remark-parse": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", - "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", + "regexp.prototype.flags": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz", + "integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==", "dev": true, "requires": { - "collapse-white-space": "^1.0.2", - "is-alphabetical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-whitespace-character": "^1.0.0", - "is-word-character": "^1.0.0", - "markdown-escapes": "^1.0.0", - "parse-entities": "^1.1.0", - "repeat-string": "^1.5.4", - "state-toggle": "^1.0.0", - "trim": "0.0.1", - "trim-trailing-lines": "^1.0.0", - "unherit": "^1.0.4", - "unist-util-remove-position": "^1.0.0", - "vfile-location": "^2.0.0", - "xtend": "^4.0.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "functions-have-names": "^1.2.3" } }, "remarkable": { @@ -17719,12 +12980,6 @@ "autolinker": "~0.28.0" } }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, "repeat-element": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", @@ -17737,17 +12992,13 @@ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true - }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "dev": true, + "optional": true, + "peer": true, "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -17776,6 +13027,8 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, + "optional": true, + "peer": true, "requires": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -17788,6 +13041,8 @@ "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", "dev": true, + "optional": true, + "peer": true, "requires": { "lodash": "^4.17.15" } @@ -17797,6 +13052,8 @@ "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", "dev": true, + "optional": true, + "peer": true, "requires": { "request-promise-core": "1.1.3", "stealthy-require": "^1.1.1", @@ -17808,6 +13065,8 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, + "optional": true, + "peer": true, "requires": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -17815,60 +13074,17 @@ } } }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, "resolve": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", - "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", "dev": true, "requires": { - "path-parse": "^1.0.6" + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, - "resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "requires": { - "resolve-from": "^5.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true - }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -17876,25 +13092,31 @@ "dev": true }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "^7.1.3" + "glob": "^7.0.5" } }, - "rsvp": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", - "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", - "dev": true + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } }, "run-parallel": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", - "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", - "dev": true + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } }, "safe-buffer": { "version": "5.1.2", @@ -17902,200 +13124,32 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", "dev": true, "requires": { - "ret": "~0.1.10" + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" } }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "sane": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", - "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", "dev": true, - "requires": { - "@cnakazawa/watch": "^1.0.3", - "anymatch": "^2.0.0", - "capture-exit": "^2.0.0", - "exec-sh": "^0.3.2", - "execa": "^1.0.0", - "fb-watchman": "^2.0.0", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - } - } + "optional": true, + "peer": true }, "saxes": { "version": "3.1.11", "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", "dev": true, + "optional": true, + "peer": true, "requires": { "xmlchars": "^2.1.1" } @@ -18103,13 +13157,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "set-getter": { @@ -18121,50 +13169,21 @@ "to-object-path": "^0.3.0" } }, - "set-value": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", - "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, "requires": { - "shebang-regex": "^1.0.0" + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" } }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shellwords": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", - "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, - "sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true }, "slash": { @@ -18173,172 +13192,17 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, - "source-map-resolve": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", - "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", - "dev": true, - "requires": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true }, "source-map-support": { "version": "0.5.12", @@ -18350,42 +13214,6 @@ "source-map": "^0.6.0" } }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -18397,6 +13225,8 @@ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "dev": true, + "optional": true, + "peer": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -18409,44 +13239,25 @@ "tweetnacl": "~0.14.0" } }, - "stack-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", - "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", + "stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true }, - "state-toggle": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.2.tgz", - "integrity": "sha512-8LpelPGR0qQM4PnfLiplOQNJcIN1/r2Gy0xKB2zKnIW2YzPMt2sR4I/+gtPjhN7Svh9kw+zqEg2SFwpBO9iNiw==", + "std-env": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.2.tgz", + "integrity": "sha512-uUZI65yrV2Qva5gqE0+A7uVAvO40iPo6jGhs7s8keRfHCmtg+uB2X6EiLGCI9IgL1J17xGhvoOqSz79lzICPTA==", "dev": true }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "string_decoder": { "version": "1.1.1", @@ -18457,232 +13268,100 @@ "safe-buffer": "~5.1.0" } }, - "string-length": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz", - "integrity": "sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA==", - "dev": true, - "requires": { - "astral-regex": "^1.0.0", - "strip-ansi": "^5.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "string.prototype.trim": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", + "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", "dev": true, "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - } + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" } }, "string.prototype.trimend": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz", - "integrity": "sha512-EEJnGqa/xNfIg05SxiPSqRS7S9qwDhYts1TSLR1BQfYUfPe1stofgGKvwERK9+9yf+PpfBMlpBaCHucXGPQfUA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - } - }, - "string.prototype.trimleft": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", - "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimstart": "^1.0.0" - } - }, - "string.prototype.trimright": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", - "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", + "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimend": "^1.0.0" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" } }, "string.prototype.trimstart": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.0.tgz", - "integrity": "sha512-iCP8g01NFYiiBOnwG1Xc3WZLyoo+RuBymwIlWncShXDDJYWN6DbnM3odslBJdgCdRlq94B5s63NWAZlcn2CS4w==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", + "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true - }, "strip-color": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/strip-color/-/strip-color-0.1.0.tgz", - "integrity": "sha1-EG9l09PmotlAHKwOsM6LinArT3s=", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "structured-source": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-3.0.2.tgz", - "integrity": "sha1-3YAkJeD1PcSm56yjdSkBoczaevU=", - "dev": true, - "requires": { - "boundary": "^1.0.1" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "supports-hyperlinks": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz", - "integrity": "sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA==", - "dev": true, - "requires": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/strip-color/-/strip-color-0.1.0.tgz", + "integrity": "sha1-EG9l09PmotlAHKwOsM6LinArT3s=", + "dev": true }, - "symbol-tree": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, - "table": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", - "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "strip-literal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", + "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", "dev": true, "requires": { - "ajv": "^7.0.2", - "lodash": "^4.17.20", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.0" + "acorn": "^8.8.2" }, "dependencies": { - "ajv": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz", - "integrity": "sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true } } }, - "terminal-link": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", - "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" + "has-flag": "^3.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "optional": true, + "peer": true + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -18700,12 +13379,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "throat": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz", - "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", - "dev": true - }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -18716,10 +13389,28 @@ "xtend": "~4.0.1" } }, - "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "time-zone": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", + "integrity": "sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==", + "dev": true + }, + "tinybench": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.4.0.tgz", + "integrity": "sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==", + "dev": true + }, + "tinypool": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.4.0.tgz", + "integrity": "sha512-2ksntHOKf893wSAH4z/+JbPpi92esw8Gn9N2deXX+B0EO92hexAVI9GIZZPx7P5aYo5KULfeOSt3kMOmSOy6uA==", + "dev": true + }, + "tinyspy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.0.tgz", + "integrity": "sha512-7eORpyqImoOvkQJCSkL0d0mB4NHHIFAy4b1u8PHdDa7SjGS2njzl6/lyGoZLm+eyYEtlUmFGE0rFj66SWxZgQQ==", "dev": true }, "to-fast-properties": { @@ -18737,39 +13428,6 @@ "kind-of": "^3.0.2" } }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -18798,6 +13456,8 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", "dev": true, + "optional": true, + "peer": true, "requires": { "ip-regex": "^2.1.0", "psl": "^1.1.28", @@ -18809,67 +13469,12 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", "dev": true, + "optional": true, + "peer": true, "requires": { "punycode": "^2.1.0" } }, - "traverse": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", - "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=", - "dev": true - }, - "trim": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", - "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", - "dev": true - }, - "trim-trailing-lines": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.2.tgz", - "integrity": "sha512-MUjYItdrqqj2zpcHFTkMa9WAv4JHTI6gnRQGPFLrt5L9a6tRMiDnIqYl8JBvu2d2Tc3lWJKQwlGCp0K8AvCM+Q==", - "dev": true - }, - "trough": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.4.tgz", - "integrity": "sha512-tdzBRDGWcI1OpPVmChbdSKhvSVurznZ8X36AYURAcl+0o2ldlCY2XPzyXNNxwJwwyIU+rIglTCG4kxtNKBQH7Q==", - "dev": true - }, - "ts-jest": { - "version": "25.3.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.3.1.tgz", - "integrity": "sha512-O53FtKguoMUByalAJW+NWEv7c4tus5ckmhfa7/V0jBb2z8v5rDSLFC1Ate7wLknYPC1euuhY6eJjQq4FtOZrkg==", - "dev": true, - "requires": { - "bs-logger": "0.x", - "buffer-from": "1.x", - "fast-json-stable-stringify": "2.x", - "json5": "2.x", - "lodash.memoize": "4.x", - "make-error": "1.x", - "micromatch": "4.x", - "mkdirp": "1.x", - "resolve": "1.x", - "semver": "6.x", - "yargs-parser": "18.x" - }, - "dependencies": { - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, "ts-morph": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-9.1.0.tgz", @@ -18894,6 +13499,41 @@ "yn": "3.1.1" } }, + "tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + } + } + }, "tslib": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", @@ -18901,113 +13541,30 @@ "dev": true }, "tslint": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.1.tgz", - "integrity": "sha512-kd6AQ/IgPRpLn6g5TozqzPdGNZ0q0jtXW4//hRcj10qLYBaa3mTUU2y2MCG+RXZm8Zx+KZi0eA+YCrMyNlF4UA==", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", + "integrity": "sha512-yA5YmWkzQoMF/fOA6TjkJlJniZxpo7cneTvdQEJj7blUd7YsR23gcOC5caM2MP186hTrhpSf1VSuygnikerwmQ==", "dev": true, "requires": { - "@babel/code-frame": "^7.0.0", + "babel-code-frame": "^6.22.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", - "diff": "^4.0.1", + "diff": "^3.2.0", "glob": "^7.1.1", - "js-yaml": "^3.13.1", + "js-yaml": "^3.7.0", "minimatch": "^3.0.4", - "mkdirp": "^0.5.3", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.10.0", - "tsutils": "^2.29.0" - } - }, - "tslint-config-standard": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/tslint-config-standard/-/tslint-config-standard-9.0.0.tgz", - "integrity": "sha512-CAw9J743RnPMemQV/XQ4YyNreC+A1NItACfkm+cBedrOkz6CQfwlnbKn8anUXBfoa4Zo4tjAhblRbsMNcSLfSw==", - "dev": true, - "requires": { - "tslint-eslint-rules": "^5.3.1" + "tslib": "^1.8.0", + "tsutils": "^2.27.2" }, "dependencies": { - "doctrine": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", - "integrity": "sha512-qiB/Rir6Un6Ad/TIgTRzsremsTGWzs8j7woXvp14jgq00676uBiBT5eUOi+FgRywZFVy5Us/c04ISRpZhRbS6w==", - "dev": true, - "requires": { - "esutils": "^1.1.6", - "isarray": "0.0.1" - } - }, - "esutils": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", - "integrity": "sha512-RG1ZkUT7iFJG9LSHr7KDuuMSlujfeTtMNIcInURxKAxhMtwQhI3NrQhz26gZQYlsYZQKzsnwtpKrFKj9K9Qu1A==", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true - }, - "tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true - }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "peer": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - } - }, - "tslint-eslint-rules": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz", - "integrity": "sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==", - "dev": true, - "requires": { - "doctrine": "0.7.2", - "tslib": "1.9.0", - "tsutils": "^3.0.0" - }, - "dependencies": { - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } - } - }, - "typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", - "dev": true, - "peer": true } } }, @@ -19025,6 +13582,8 @@ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, + "optional": true, + "peer": true, "requires": { "safe-buffer": "^5.0.1" } @@ -19033,13 +13592,17 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, + "optional": true, + "peer": true, "requires": { "prelude-ls": "~1.1.2" } @@ -19050,11 +13613,16 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, - "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true + "typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + } }, "typedarray": { "version": "0.0.6", @@ -19062,160 +13630,52 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, "typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", - "dev": true - }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true }, - "unherit": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.2.tgz", - "integrity": "sha512-W3tMnpaMG7ZY6xe/moK04U9fBhi6wEiCYHUW5Mop/wQHf12+79EQGwxYejNdhEz2mkqkBlGwm7pxmgBKMVUj0w==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "xtend": "^4.0.1" - } - }, - "unified": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", - "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", - "dev": true, - "requires": { - "bail": "^1.0.0", - "extend": "^3.0.0", - "is-plain-obj": "^1.1.0", - "trough": "^1.0.0", - "vfile": "^2.0.0", - "x-is-string": "^0.1.0" - } - }, - "union-value": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", - "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - } - }, - "unist-util-is": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", - "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", + "ufo": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.1.1.tgz", + "integrity": "sha512-MvlCc4GHrmZdAllBc0iUDowff36Q9Ndw/UzqmEKyrfSzokTd9ZCy1i+IIk5hrYKkjoYVQyNbrw7/F8XJ2rEwTg==", "dev": true }, - "unist-util-remove-position": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.3.tgz", - "integrity": "sha512-CtszTlOjP2sBGYc2zcKA/CvNdTdEs3ozbiJ63IPBxh8iZg42SCCb8m04f8z2+V1aSk5a7BxbZKEdoDjadmBkWA==", + "unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "requires": { - "unist-util-visit": "^1.1.0" + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" } }, - "unist-util-stringify-position": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", - "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, - "unist-util-visit": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", - "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", - "dev": true, - "requires": { - "unist-util-visit-parents": "^2.0.0" - } - }, - "unist-util-visit-parents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", - "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", - "dev": true, - "requires": { - "unist-util-is": "^3.0.0" - } - }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" } }, - "update-section": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/update-section/-/update-section-0.3.3.tgz", - "integrity": "sha1-RY8Xgg03gg3GDiC4bZQ5GwASMVg=", - "dev": true - }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -19225,18 +13685,6 @@ "punycode": "^2.1.0" } }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "use": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -19247,69 +13695,194 @@ "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true - }, - "v8-compile-cache": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", - "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", - "dev": true - }, - "v8-to-istanbul": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz", - "integrity": "sha512-sAjOC+Kki6aJVbUOXJbcR0MnbfjvBzwKZazEJymA2IX49uoOdEdk+4fBq5cXgYgiyKtAyrrJNtBZdOeDIF+Fng==", "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0", - "source-map": "^0.7.3" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true - } - } + "optional": true, + "peer": true }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, + "optional": true, + "peer": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" } }, - "vfile": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", - "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", + "vite": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.3.tgz", + "integrity": "sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA==", "dev": true, "requires": { - "is-buffer": "^1.1.4", - "replace-ext": "1.0.0", - "unist-util-stringify-position": "^1.0.0", - "vfile-message": "^1.0.0" + "esbuild": "^0.17.5", + "fsevents": "~2.3.2", + "postcss": "^8.4.23", + "rollup": "^3.21.0" + }, + "dependencies": { + "@esbuild/android-arm": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.18.tgz", + "integrity": "sha512-EmwL+vUBZJ7mhFCs5lA4ZimpUH3WMAoqvOIYhVQwdIgSpHC8ImHdsRyhHAVxpDYUSm0lWvd63z0XH1IlImS2Qw==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.18.tgz", + "integrity": "sha512-bvPG+MyFs5ZlwYclCG1D744oHk1Pv7j8psF5TfYx7otCVmcJsEXgFEhQkbhNW8otDHL1a2KDINW20cfCgnzgMQ==", + "dev": true, + "optional": true + }, + "esbuild": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.18.tgz", + "integrity": "sha512-z1lix43jBs6UKjcZVKOw2xx69ffE2aG0PygLL5qJ9OS/gy0Ewd1gW/PUQIOIQGXBHWNywSc0floSKoMFF8aK2w==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.17.18", + "@esbuild/android-arm64": "0.17.18", + "@esbuild/android-x64": "0.17.18", + "@esbuild/darwin-arm64": "0.17.18", + "@esbuild/darwin-x64": "0.17.18", + "@esbuild/freebsd-arm64": "0.17.18", + "@esbuild/freebsd-x64": "0.17.18", + "@esbuild/linux-arm": "0.17.18", + "@esbuild/linux-arm64": "0.17.18", + "@esbuild/linux-ia32": "0.17.18", + "@esbuild/linux-loong64": "0.17.18", + "@esbuild/linux-mips64el": "0.17.18", + "@esbuild/linux-ppc64": "0.17.18", + "@esbuild/linux-riscv64": "0.17.18", + "@esbuild/linux-s390x": "0.17.18", + "@esbuild/linux-x64": "0.17.18", + "@esbuild/netbsd-x64": "0.17.18", + "@esbuild/openbsd-x64": "0.17.18", + "@esbuild/sunos-x64": "0.17.18", + "@esbuild/win32-arm64": "0.17.18", + "@esbuild/win32-ia32": "0.17.18", + "@esbuild/win32-x64": "0.17.18" + } + }, + "rollup": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.0.tgz", + "integrity": "sha512-ANPhVcyeHvYdQMUyCbczy33nbLzI7RzrBje4uvNiTDJGIMtlKoOStmympwr9OtS1LZxiDmE2wvxHyVhoLtf1KQ==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + } } }, - "vfile-location": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.5.tgz", - "integrity": "sha512-Pa1ey0OzYBkLPxPZI3d9E+S4BmvfVwNAAXrrqGbwTVXWaX2p9kM1zZ+n35UtVM06shmWKH4RPRN8KI80qE3wNQ==", - "dev": true - }, - "vfile-message": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", - "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", + "vite-node": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.30.1.tgz", + "integrity": "sha512-vTikpU/J7e6LU/8iM3dzBo8ZhEiKZEKRznEMm+mJh95XhWaPrJQraT/QsT2NWmuEf+zgAoMe64PKT7hfZ1Njmg==", "dev": true, "requires": { - "unist-util-stringify-position": "^1.1.1" + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.2.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "vitest": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.30.1.tgz", + "integrity": "sha512-y35WTrSTlTxfMLttgQk4rHcaDkbHQwDP++SNwPb+7H8yb13Q3cu2EixrtHzF27iZ8v0XCciSsLg00RkPAzB/aA==", + "dev": true, + "requires": { + "@types/chai": "^4.3.4", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.30.1", + "@vitest/runner": "0.30.1", + "@vitest/snapshot": "0.30.1", + "@vitest/spy": "0.30.1", + "@vitest/utils": "0.30.1", + "acorn": "^8.8.2", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.7", + "concordance": "^5.0.4", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "source-map": "^0.6.1", + "std-env": "^3.3.2", + "strip-literal": "^1.0.1", + "tinybench": "^2.4.0", + "tinypool": "^0.4.0", + "vite": "^3.0.0 || ^4.0.0", + "vite-node": "0.30.1", + "why-is-node-running": "^2.2.2" + }, + "dependencies": { + "@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", + "dev": true + }, + "@types/node": { + "version": "18.16.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz", + "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==", + "dev": true + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "w3c-hr-time": { @@ -19317,6 +13890,8 @@ "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", "dev": true, + "optional": true, + "peer": true, "requires": { "browser-process-hrtime": "^1.0.0" } @@ -19326,25 +13901,26 @@ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", "dev": true, + "optional": true, + "peer": true, "requires": { "domexception": "^1.0.1", "webidl-conversions": "^4.0.2", "xml-name-validator": "^3.0.0" } }, - "walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", - "dev": true, - "requires": { - "makeerror": "1.0.x" - } - }, "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true, + "optional": true, + "peer": true + }, + "well-known-symbols": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", + "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==", "dev": true }, "whatwg-encoding": { @@ -19352,6 +13928,8 @@ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", "dev": true, + "optional": true, + "peer": true, "requires": { "iconv-lite": "0.4.24" } @@ -19360,13 +13938,17 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "whatwg-url": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", "dev": true, + "optional": true, + "peer": true, "requires": { "lodash.sortby": "^4.7.0", "tr46": "^1.0.1", @@ -19382,52 +13964,41 @@ "isexe": "^2.0.0" } }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", "dev": true, "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + } + }, + "why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "requires": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" } }, "word-wrap": { @@ -19436,86 +14007,36 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, "ws": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", "dev": true, + "optional": true, + "peer": true, "requires": {} }, - "x-is-string": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", - "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=", - "dev": true - }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "xtend": { "version": "4.0.1", @@ -19523,187 +14044,23 @@ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "yargs": { - "version": "15.3.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", - "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.1" - } - }, - "yargs-parser": { - "version": "18.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.2.tgz", - "integrity": "sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", - "dev": true, - "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/package.json b/package.json index 177f04bf8..6041cdbb1 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,12 @@ "typings": "lib/index.d.ts", "sideEffects": false, "scripts": { - "lint": "tslint -p .", - "eslint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.ts\"", - "jest": "jest", + "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.ts\"", + "lint-fix": "eslint --fix \"src/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.ts\"", "prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"", "fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples,exercises}/**/*.ts\"", - "test": "npm run prettier && npm run lint && npm run dtslint && npm run jest && npm run docs", + "eslint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.ts\"", + "test": "npm run lint && npm run prettier && npm run dtslint && npm run vitest && npm run docs", "clean": "rm -rf ./dist", "prebuild": "npm run clean", "build": "tsc -p ./tsconfig.build.json && tsc -p ./tsconfig.build-es6.json && npm run import-path-rewrite && ts-node scripts/build", @@ -25,7 +25,9 @@ "docs": "docs-ts", "prerelease": "npm run build", "release": "ts-node scripts/release", - "import-path-rewrite": "import-path-rewrite" + "import-path-rewrite": "import-path-rewrite", + "vitest": "vitest run", + "coverage": "vitest run --coverage" }, "repository": { "type": "git", @@ -41,29 +43,30 @@ "fp-ts": "^2.5.0" }, "devDependencies": { - "@types/benchmark": "1.0.31", + "@types/benchmark": "^1.0.31", "@types/glob": "^7.1.3", - "@types/jest": "25.2.1", - "@types/node": "13.11.0", - "@typescript-eslint/eslint-plugin": "^4.14.1", - "@typescript-eslint/parser": "^4.14.1", + "@types/node": "^16.18.25", + "@typescript-eslint/eslint-plugin": "^5.59.0", + "@typescript-eslint/parser": "^5.59.0", + "@vitest/coverage-istanbul": "^0.23.4", "benchmark": "2.1.4", - "docs-ts": "^0.6.2", - "doctoc": "1.4.0", + "docs-ts": "^0.7.2", "dtslint": "github:gcanti/dtslint", - "eslint": "^7.18.0", - "fast-check": "^1.24.2", - "fp-ts": "^2.5.0", + "eslint": "^8.38.0", + "eslint-plugin-deprecation": "^1.4.1", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-simple-import-sort": "^10.0.0", + "fast-check": "^1.26.0", + "glob": "^7.1.6", "import-path-rewrite": "github:gcanti/import-path-rewrite", - "jest": "25.2.7", - "mocha": "7.1.1", - "prettier": "2.0.2", - "rimraf": "3.0.2", - "ts-jest": "25.3.1", - "ts-node": "8.8.2", - "tslint": "6.1.1", - "tslint-config-standard": "9.0.0", - "typescript": "^4.8.2" + "mocha": "^5.2.0", + "prettier": "^2.7.1", + "rimraf": "2.6.2", + "ts-node": "^8.0.2", + "tslint": "5.11.0", + "typescript": "^5.0.4", + "vite": "^4.3.3", + "vitest": "^0.30.1" }, "tags": [ "typescript", diff --git a/scripts/FileSystem.ts b/scripts/FileSystem.ts index fa10d9f0f..c9389f561 100644 --- a/scripts/FileSystem.ts +++ b/scripts/FileSystem.ts @@ -1,5 +1,5 @@ -import * as TE from 'fp-ts/lib/TaskEither' import { flow } from 'fp-ts/lib/function' +import * as TE from 'fp-ts/lib/TaskEither' import * as fs from 'fs' import G from 'glob' @@ -11,7 +11,7 @@ export interface FileSystem { readonly mkdir: (path: string) => TE.TaskEither } -const readFile = TE.taskify(fs.readFile) +const readFile = TE.taskify(fs.readFile) const writeFile = TE.taskify(fs.writeFile) const copyFile = TE.taskify(fs.copyFile) const glob = TE.taskify>(G) diff --git a/scripts/build.ts b/scripts/build.ts index eabd0eb52..99f6c7808 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,9 +1,10 @@ -import * as path from 'path' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import * as RTE from 'fp-ts/lib/ReaderTaskEither' import * as A from 'fp-ts/lib/ReadonlyArray' import * as TE from 'fp-ts/lib/TaskEither' +import * as path from 'path' + import { FileSystem, fileSystem } from './FileSystem' import { run } from './run' diff --git a/scripts/pre-publish.ts b/scripts/pre-publish.ts index 01db9915c..88ad52e44 100644 --- a/scripts/pre-publish.ts +++ b/scripts/pre-publish.ts @@ -1,4 +1,5 @@ import { left } from 'fp-ts/lib/TaskEither' + import { run } from './run' const main = left(new Error('"npm publish" can not be run from root, run "npm run release" instead')) diff --git a/scripts/release.ts b/scripts/release.ts index 418c37ffe..65ef6b3a0 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -1,8 +1,9 @@ -import { run } from './run' import * as child_process from 'child_process' import { left, right } from 'fp-ts/lib/Either' import * as TE from 'fp-ts/lib/TaskEither' +import { run } from './run' + const DIST = 'dist' const exec = (cmd: string, args?: child_process.ExecOptions): TE.TaskEither => () => diff --git a/src/Codec.ts b/src/Codec.ts index 9465e02e7..9dfa896b8 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -11,6 +11,7 @@ import { identity, Refinement } from 'fp-ts/lib/function' import { Invariant3 } from 'fp-ts/lib/Invariant' import { pipe } from 'fp-ts/lib/pipeable' + import * as D from './Decoder' import * as E from './Encoder' import * as S from './Schemable' @@ -118,9 +119,10 @@ export const UnknownRecord: Codec, Record(f: (i: I, e: D.DecodeError) => D.DecodeError) => ( - codec: Codec -): Codec => make(pipe(codec, D.mapLeftWithInput(f)), codec) +export const mapLeftWithInput = + (f: (i: I, e: D.DecodeError) => D.DecodeError) => + (codec: Codec): Codec => + make(pipe(codec, D.mapLeftWithInput(f)), codec) /** * @category combinators @@ -314,9 +316,10 @@ export const readonly: (codec: Codec) => Codec(to: Codec) => ( - from: Codec -): Codec => make(D.compose(to)(from), E.compose(from)(to)) +export const compose = + (to: Codec) => + (from: Codec): Codec => + make(D.compose(to)(from), E.compose(from)(to)) // ------------------------------------------------------------------------------------- // non-pipeables @@ -332,9 +335,9 @@ const imap_: Invariant3['imap'] = (fa, f, g) => make(D.Functor.map(fa, f), * @category Invariant * @since 2.2.3 */ -export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec = (f, g) => ( - fa -) => imap_(fa, f, g) +export const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec = + (f, g) => (fa) => + imap_(fa, f, g) // ------------------------------------------------------------------------------------- // instances diff --git a/src/DecodeError.ts b/src/DecodeError.ts index 07e8b5046..babe78a57 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -9,6 +9,7 @@ * @since 2.2.7 */ import { Semigroup } from 'fp-ts/lib/Semigroup' + import * as FS from './FreeSemigroup' /** diff --git a/src/Decoder.ts b/src/Decoder.ts index 702cc9bba..3901a499b 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -16,6 +16,7 @@ import { identity, Refinement } from 'fp-ts/lib/function' import { Functor2 } from 'fp-ts/lib/Functor' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' + import * as DE from './DecodeError' import * as FS from './FreeSemigroup' import * as G from './Guard' @@ -248,9 +249,10 @@ export const fromType = fromStruct * @category combinators * @since 2.2.15 */ -export const struct = ( - properties: { [K in keyof A]: Decoder } -): Decoder => pipe(UnknownRecord as any, compose(fromStruct(properties))) +export const struct = (properties: { [K in keyof A]: Decoder }): Decoder< + unknown, + { [K in keyof A]: A[K] } +> => pipe(UnknownRecord as any, compose(fromStruct(properties))) /** * Use `struct` instead. @@ -274,9 +276,10 @@ export const fromPartial =

>>( * @category combinators * @since 2.2.7 */ -export const partial = ( - properties: { [K in keyof A]: Decoder } -): Decoder> => pipe(UnknownRecord as any, compose(fromPartial(properties))) +export const partial = (properties: { [K in keyof A]: Decoder }): Decoder< + unknown, + Partial<{ [K in keyof A]: A[K] }> +> => pipe(UnknownRecord as any, compose(fromPartial(properties))) /** * @category combinators @@ -345,26 +348,27 @@ export const intersect: (right: Decoder) => (left: Decoder< * @category combinators * @since 2.2.8 */ -export const fromSum = (tag: T) => >>( - members: MS -): Decoder, TypeOf> => - K.fromSum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) +export const fromSum = + (tag: T) => + >>(members: MS): Decoder, TypeOf> => + K.fromSum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) ) - ) - )(tag)(members) + )(tag)(members) /** * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => ( - members: { [K in keyof A]: Decoder> } -): Decoder => pipe(UnknownRecord as any, compose(fromSum(tag)(members))) +export const sum = + (tag: T) => + (members: { [K in keyof A]: Decoder> }): Decoder => + pipe(UnknownRecord as any, compose(fromSum(tag)(members))) /** * @category combinators diff --git a/src/Encoder.ts b/src/Encoder.ts index 8cf7a0855..7c8546df1 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -8,11 +8,12 @@ * * @since 2.2.3 */ -import { Contravariant2 } from 'fp-ts/lib/Contravariant' import { Category2 } from 'fp-ts/lib/Category' -import { memoize, intersect_ } from './Schemable' +import { Contravariant2 } from 'fp-ts/lib/Contravariant' import { identity } from 'fp-ts/lib/function' +import { intersect_, memoize } from './Schemable' + // ------------------------------------------------------------------------------------- // model // ------------------------------------------------------------------------------------- @@ -131,9 +132,11 @@ export function tuple>>( * @category combinators * @since 2.2.3 */ -export const intersect = (right: Encoder) => (left: Encoder): Encoder => ({ - encode: (ab) => intersect_(left.encode(ab), right.encode(ab)) -}) +export const intersect = + (right: Encoder) => + (left: Encoder): Encoder => ({ + encode: (ab) => intersect_(left.encode(ab), right.encode(ab)) + }) /** * @category combinators diff --git a/src/Eq.ts b/src/Eq.ts index 67015156f..ebfeff9b3 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -12,6 +12,7 @@ import * as A from 'fp-ts/lib/Array' import * as E from 'fp-ts/lib/Eq' import { identity } from 'fp-ts/lib/function' import * as R from 'fp-ts/lib/Record' + import { memoize, Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' import Eq = E.Eq @@ -139,17 +140,18 @@ export const array: (eq: Eq) => Eq> = A.getEq * @category combinators * @since 2.2.2 */ -export const tuple: >( - ...components: { [K in keyof A]: Eq } -) => Eq = E.getTupleEq as any +export const tuple: >(...components: { [K in keyof A]: Eq }) => Eq = + E.getTupleEq as any /** * @category combinators * @since 2.2.2 */ -export const intersect = (right: Eq) => (left: Eq): Eq => ({ - equals: (x, y) => left.equals(x, y) && right.equals(x, y) -}) +export const intersect = + (right: Eq) => + (left: Eq): Eq => ({ + equals: (x, y) => left.equals(x, y) && right.equals(x, y) + }) /** * @category combinators diff --git a/src/FreeSemigroup.ts b/src/FreeSemigroup.ts index f1a764e70..571b0c128 100644 --- a/src/FreeSemigroup.ts +++ b/src/FreeSemigroup.ts @@ -55,16 +55,16 @@ export const concat = (left: FreeSemigroup, right: FreeSemigroup): Free * @category destructors * @since 2.2.7 */ -export const fold = (onOf: (value: A) => R, onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R) => ( - f: FreeSemigroup -): R => { - switch (f._tag) { - case 'Of': - return onOf(f.value) - case 'Concat': - return onConcat(f.left, f.right) +export const fold = + (onOf: (value: A) => R, onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R) => + (f: FreeSemigroup): R => { + switch (f._tag) { + case 'Of': + return onOf(f.value) + case 'Concat': + return onConcat(f.left, f.right) + } } -} /** * @category instances diff --git a/src/Guard.ts b/src/Guard.ts index d189660fd..c9d8bf62e 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -10,6 +10,7 @@ */ import { identity, Refinement } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' + import * as S from './Schemable' // ------------------------------------------------------------------------------------- @@ -106,11 +107,11 @@ export const UnknownRecord: Guard> = { * @category combinators * @since 2.2.0 */ -export const refine = (refinement: Refinement) => ( - from: Guard -): Guard => ({ - is: (i: I): i is B => from.is(i) && refinement(i) -}) +export const refine = + (refinement: Refinement) => + (from: Guard): Guard => ({ + is: (i: I): i is B => from.is(i) && refinement(i) + }) /** * @category combinators @@ -124,21 +125,26 @@ export const nullable = (or: Guard): Guard( - properties: { [K in keyof A]: Guard } -): Guard => +export const struct = (properties: { [K in keyof A]: Guard }): Guard< + unknown, + { [K in keyof A]: A[K] } +> => pipe( UnknownRecord, - refine((r): r is { - [K in keyof A]: A[K] - } => { - for (const k in properties) { - if (!(k in r) || !properties[k].is(r[k])) { - return false + refine( + ( + r + ): r is { + [K in keyof A]: A[K] + } => { + for (const k in properties) { + if (!(k in r) || !properties[k].is(r[k])) { + return false + } } + return true } - return true - }) + ) ) /** @@ -154,9 +160,10 @@ export const type = struct * @category combinators * @since 2.2.0 */ -export const partial = ( - properties: { [K in keyof A]: Guard } -): Guard> => +export const partial = (properties: { [K in keyof A]: Guard }): Guard< + unknown, + Partial<{ [K in keyof A]: A[K] }> +> => pipe( UnknownRecord, refine((r): r is Partial => { @@ -211,9 +218,11 @@ export const tuple = >( * @category combinators * @since 2.2.0 */ -export const intersect = (right: Guard) => (left: Guard): Guard => ({ - is: (u: unknown): u is A & B => left.is(u) && right.is(u) -}) +export const intersect = + (right: Guard) => + (left: Guard): Guard => ({ + is: (u: unknown): u is A & B => left.is(u) && right.is(u) + }) /** * @category combinators @@ -229,19 +238,19 @@ export const union = ]>( * @category combinators * @since 2.2.0 */ -export const sum = (tag: T) => ( - members: { [K in keyof A]: Guard> } -): Guard => - pipe( - UnknownRecord, - refine((r): r is any => { - const v = r[tag] as keyof A - if (v in members) { - return members[v].is(r) - } - return false - }) - ) +export const sum = + (tag: T) => + (members: { [K in keyof A]: Guard> }): Guard => + pipe( + UnknownRecord, + refine((r): r is any => { + const v = r[tag] as keyof A + if (v in members) { + return members[v].is(r) + } + return false + }) + ) /** * @category combinators @@ -264,9 +273,11 @@ export const readonly: (guard: Guard) => Guard(that: () => Guard) => (me: Guard): Guard => ({ - is: (i): i is A => me.is(i) || that().is(i) -}) +export const alt = + (that: () => Guard) => + (me: Guard): Guard => ({ + is: (i): i is A => me.is(i) || that().is(i) + }) /** * @category combinators @@ -280,9 +291,11 @@ export const zero = (): Guard => ({ * @category combinators * @since 2.2.8 */ -export const compose = (to: Guard) => (from: Guard): Guard => ({ - is: (i): i is B => from.is(i) && to.is(i) -}) +export const compose = + (to: Guard) => + (from: Guard): Guard => ({ + is: (i): i is B => from.is(i) && to.is(i) + }) /** * @category combinators diff --git a/src/Kleisli.ts b/src/Kleisli.ts index b6cba277f..6c1b72e1a 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -13,13 +13,14 @@ import { Applicative2C } from 'fp-ts/lib/Applicative' import { Apply2C } from 'fp-ts/lib/Apply' import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import * as E from 'fp-ts/lib/Either' +import { Lazy, Refinement } from 'fp-ts/lib/function' import { Functor2C } from 'fp-ts/lib/Functor' import { Kind2, URIS2 } from 'fp-ts/lib/HKT' import { Monad2C } from 'fp-ts/lib/Monad' import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' + import * as G from './Guard' import * as S from './Schemable' -import { Lazy, Refinement } from 'fp-ts/lib/function' // ------------------------------------------------------------------------------------- // model @@ -60,9 +61,10 @@ export function literal( ) => ], L extends S.Literal = S.Literal>( ...values: A ) => Kleisli { - return (onError) => ]>(...values: A) => ({ - decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) - }) + return (onError) => + ]>(...values: A) => ({ + decode: (i) => (G.literal(...values).is(i) ? M.of(i) : M.throwError(onError(i, values))) + }) } // ------------------------------------------------------------------------------------- @@ -111,16 +113,17 @@ export function parse( export function nullable( M: Applicative2C & Bifunctor2 ): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli { - return (onError: (i: I, e: E) => E) => (or: Kleisli): Kleisli => ({ - decode: (i) => - i === null - ? M.of(null) - : M.bimap( - or.decode(i), - (e) => onError(i, e), - (a): A | null => a - ) - }) + return (onError: (i: I, e: E) => E) => + (or: Kleisli): Kleisli => ({ + decode: (i) => + i === null + ? M.of(null) + : M.bimap( + or.decode(i), + (e) => onError(i, e), + (a): A | null => a + ) + }) } /** @@ -229,12 +232,13 @@ export function fromTuple( ...components: C ) => Kleisli }, E, { [K in keyof C]: TypeOf }> { const traverse = traverseArrayWithIndex(M) - return (onIndexError) => (...components) => ({ - decode: (is) => - traverse((components as unknown) as Array>, (index, decoder) => - M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) - ) as any - }) + return (onIndexError) => + (...components) => ({ + decode: (is) => + traverse(components as unknown as Array>, (index, decoder) => + M.mapLeft(decoder.decode(is[index]), (e) => onIndexError(index, e)) + ) as any + }) } /** @@ -248,17 +252,16 @@ export function union( ) => , ...Array>]>( ...members: MS ) => Kleisli, E, TypeOf> { - return (onMemberError) => , ...Array>]>( - ...members: MS - ) => ({ - decode: (i) => { - let out: Kind2> = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) - for (let index = 1; index < members.length; index++) { - out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) + return (onMemberError) => + , ...Array>]>(...members: MS) => ({ + decode: (i) => { + let out: Kind2> = M.mapLeft(members[0].decode(i), (e) => onMemberError(0, e)) + for (let index = 1; index < members.length; index++) { + out = M.alt(out, () => M.mapLeft(members[index].decode(i), (e) => onMemberError(index, e))) + } + return out } - return out - } - }) + }) } /** @@ -268,15 +271,14 @@ export function union( export function intersect( M: Apply2C ): (right: Kleisli) => (left: Kleisli) => Kleisli { - return (right: Kleisli) => ( - left: Kleisli - ): Kleisli => ({ - decode: (i) => - M.ap( - M.map(left.decode(i), (a: A) => (b: B) => S.intersect_(a, b)), - right.decode(i) - ) - }) + return (right: Kleisli) => + (left: Kleisli): Kleisli => ({ + decode: (i) => + M.ap( + M.map(left.decode(i), (a: A) => (b: B) => S.intersect_(a, b)), + right.decode(i) + ) + }) } /** @@ -292,20 +294,25 @@ export function fromSum( ) => >>( members: MS ) => Kleisli, E, TypeOf> { - return (onTagError) => (tag) => , A>( - members: { [K in keyof A]: Kleisli } - ): Kleisli => { - const keys = Object.keys(members) - return { - decode: (ir) => { - const v: any = ir[tag] - if (Object.prototype.hasOwnProperty.call(members, v)) { - return (members as any)[v].decode(ir) + return (onTagError) => + (tag) => + , A>(members: { [K in keyof A]: Kleisli }): Kleisli< + M, + I, + E, + A[keyof A] + > => { + const keys = Object.keys(members) + return { + decode: (ir) => { + const v: any = ir[tag] + if (Object.prototype.hasOwnProperty.call(members, v)) { + return (members as any)[v].decode(ir) + } + return M.throwError(onTagError(tag, v, keys)) } - return M.throwError(onTagError(tag, v, keys)) } } - } } /** @@ -315,15 +322,13 @@ export function fromSum( export function lazy( M: Bifunctor2 ): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli { - return (onError: (id: string, e: E) => E) => ( - id: string, - f: () => Kleisli - ): Kleisli => { - const get = S.memoize>(f) - return { - decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) + return (onError: (id: string, e: E) => E) => + (id: string, f: () => Kleisli): Kleisli => { + const get = S.memoize>(f) + return { + decode: (u) => M.mapLeft(get().decode(u), (e) => onError(id, e)) + } } - } } /** @@ -376,43 +381,41 @@ export function alt( // utils // ------------------------------------------------------------------------------------- -const traverseArrayWithIndex = (M: Applicative2C) => ( - as: Array, - f: (i: number, a: A) => Kind2 -): Kind2> => { - return as.reduce( - (mbs, a, i) => - M.ap( - M.map(mbs, (bs) => (b: B) => { - bs.push(b) - return bs - }), - f(i, a) - ), - M.of>([]) - ) -} - -const traverseRecordWithIndex = (M: Applicative2C) => ( - r: Record, - f: (k: string, a: A) => Kind2 -): Kind2> => { - const ks = Object.keys(r) - if (ks.length === 0) { - return M.of({}) - } - let fr: Kind2> = M.of({}) - for (const key of ks) { - fr = M.ap( - M.map(fr, (r) => (b: B) => { - r[key] = b - return r - }), - f(key, r[key]) +const traverseArrayWithIndex = + (M: Applicative2C) => + (as: Array, f: (i: number, a: A) => Kind2): Kind2> => { + return as.reduce( + (mbs, a, i) => + M.ap( + M.map(mbs, (bs) => (b: B) => { + bs.push(b) + return bs + }), + f(i, a) + ), + M.of>([]) ) } - return fr -} + +const traverseRecordWithIndex = + (M: Applicative2C) => + (r: Record, f: (k: string, a: A) => Kind2): Kind2> => { + const ks = Object.keys(r) + if (ks.length === 0) { + return M.of({}) + } + let fr: Kind2> = M.of({}) + for (const key of ks) { + fr = M.ap( + M.map(fr, (r) => (b: B) => { + r[key] = b + return r + }), + f(key, r[key]) + ) + } + return fr + } const compactRecord = (r: Record>): Record => { const out: Record = {} diff --git a/src/PathReporter.ts b/src/PathReporter.ts index 66b953e98..7872a226a 100644 --- a/src/PathReporter.ts +++ b/src/PathReporter.ts @@ -1,10 +1,11 @@ /** * @since 1.0.0 */ -import { Reporter } from './Reporter' -import { Context, getFunctionName, ValidationError } from '.' import { fold } from 'fp-ts/lib/Either' +import { Context, getFunctionName, ValidationError } from '.' +import { Reporter } from './Reporter' + function stringify(v: any): string { if (typeof v === 'function') { return getFunctionName(v) diff --git a/src/Schema.ts b/src/Schema.ts index 6eaf1ae4b..fdb78348c 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -9,6 +9,7 @@ * @since 2.2.0 */ import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' + import { memoize, Schemable, Schemable1, Schemable2C } from './Schemable' // ------------------------------------------------------------------------------------- diff --git a/src/Schemable.ts b/src/Schemable.ts index 1eda7c3c5..aa46094b3 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -85,9 +85,11 @@ export interface Schemable2C { /** @deprecated */ readonly type: (properties: { [K in keyof A]: Kind2 }) => Kind2 readonly struct: (properties: { [K in keyof A]: Kind2 }) => Kind2 - readonly partial: ( - properties: { [K in keyof A]: Kind2 } - ) => Kind2> + readonly partial: (properties: { [K in keyof A]: Kind2 }) => Kind2< + S, + E, + Partial<{ [K in keyof A]: A[K] }> + > readonly record: (codomain: Kind2) => Kind2> readonly array: (item: Kind2) => Kind2> readonly tuple: >( diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 0af1501a1..fc1f2b3d3 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -18,6 +18,7 @@ import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' import { pipe } from 'fp-ts/lib/pipeable' import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' + import * as DE from './DecodeError' import * as D from './Decoder' import * as FS from './FreeSemigroup' @@ -251,9 +252,10 @@ export const fromType = fromStruct * @category combinators * @since 2.2.15 */ -export const struct = ( - properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder => pipe(UnknownRecord as any, compose(fromStruct(properties))) +export const struct = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder< + unknown, + { [K in keyof A]: A[K] } +> => pipe(UnknownRecord as any, compose(fromStruct(properties))) /** * Use `struct` instead. @@ -277,10 +279,10 @@ export const fromPartial =

>>( * @category combinators * @since 2.2.7 */ -export const partial = ( - properties: { [K in keyof A]: TaskDecoder } -): TaskDecoder> => - pipe(UnknownRecord as any, compose(fromPartial(properties))) +export const partial = (properties: { [K in keyof A]: TaskDecoder }): TaskDecoder< + unknown, + Partial<{ [K in keyof A]: A[K] }> +> => pipe(UnknownRecord as any, compose(fromPartial(properties))) /** * @category combinators @@ -351,26 +353,29 @@ export const intersect: ( * @category combinators * @since 2.2.8 */ -export const fromSum = (tag: T) => >>( - members: MS -): TaskDecoder, TypeOf> => - K.fromSum(M)((tag, value, keys) => - FS.of( - DE.key( - tag, - DE.required, - error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) +export const fromSum = + (tag: T) => + >>( + members: MS + ): TaskDecoder, TypeOf> => + K.fromSum(M)((tag, value, keys) => + FS.of( + DE.key( + tag, + DE.required, + error(value, keys.length === 0 ? 'never' : keys.map((k) => JSON.stringify(k)).join(' | ')) + ) ) - ) - )(tag)(members) + )(tag)(members) /** * @category combinators * @since 2.2.7 */ -export const sum = (tag: T) => ( - members: { [K in keyof A]: TaskDecoder> } -): TaskDecoder => pipe(UnknownRecord as any, compose(fromSum(tag)(members))) +export const sum = + (tag: T) => + (members: { [K in keyof A]: TaskDecoder> }): TaskDecoder => + pipe(UnknownRecord as any, compose(fromSum(tag)(members))) /** * @category combinators diff --git a/src/ThrowReporter.ts b/src/ThrowReporter.ts index 8d991a992..3444decac 100644 --- a/src/ThrowReporter.ts +++ b/src/ThrowReporter.ts @@ -2,10 +2,11 @@ * @deprecated * @since 1.0.0 */ -import { Reporter } from './Reporter' -import { PathReporter } from './PathReporter' import { isLeft } from 'fp-ts/lib/Either' +import { PathReporter } from './PathReporter' +import { Reporter } from './Reporter' + /** * @category deprecated * @since 1.0.0 diff --git a/src/Type.ts b/src/Type.ts index 26ab3f20d..0cc37e84d 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -11,6 +11,7 @@ import * as E from 'fp-ts/lib/Either' import { identity, Refinement } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' + import * as t from './index' import * as S from './Schemable' @@ -87,9 +88,11 @@ export const UnknownRecord: Type> = t.UnknownRecord * @category combinators * @since 2.2.3 */ -export const refine = (refinement: Refinement, id: string) => (from: Type): Type => - // tslint:disable-next-line: deprecation - t.refinement(from, refinement, id) as any +export const refine = + (refinement: Refinement, id: string) => + (from: Type): Type => + // tslint:disable-next-line: deprecation + t.refinement(from, refinement, id) as any /** * @category combinators @@ -143,7 +146,10 @@ export const tuple = >(...components: { [K in k * @category combinators * @since 2.2.3 */ -export const intersect = (right: Type) => (left: Type): Type => t.intersection([left, right]) +export const intersect = + (right: Type) => + (left: Type): Type => + t.intersection([left, right]) /** * @category combinators @@ -161,9 +167,10 @@ export const readonly: (type: Type) => Type> = identity * @category combinators * @since 2.2.3 */ -export const sum = (_tag: T) => ( - members: { [K in keyof A]: Type> } -): Type => t.union(Object.values(members) as any) +export const sum = + (_tag: T) => + (members: { [K in keyof A]: Type> }): Type => + t.union(Object.values(members) as any) /** * @category combinators diff --git a/src/index.ts b/src/index.ts index 951f8e528..b2164250c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2138,7 +2138,7 @@ export class TaggedUnionType< * @since 1.5.3 * @deprecated */ -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation extends TaggedUnionType, OutputOf, unknown> {} /** @@ -2299,7 +2299,7 @@ export class StrictType extends Type { * @since 1.5.3 * @deprecated */ -export interface StrictC

// tslint:disable-next-line: deprecation +export interface StrictC

// tslint:disable-next-line: deprecation extends StrictType }, { [K in keyof P]: OutputOf }, unknown> {} /** @@ -2362,7 +2362,7 @@ export type TaggedIntersectionArgument = * @since 1.3.0 * @deprecated */ -export interface TaggedIntersection // tslint:disable-next-line: deprecation +export interface TaggedIntersection // tslint:disable-next-line: deprecation extends IntersectionType, A, O> {} /** @@ -2412,8 +2412,9 @@ export type PropsOf = T['props'] * @since 1.1.0 * @deprecated */ -export type Exact = T & - { [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never } +export type Exact = T & { + [K in ({ [K in keyof X]: K } & { [K in keyof T]: never } & { [key: string]: never })[keyof X]]?: never +} /** * Keeps the codec "kind". diff --git a/test/2.1.x/PathReporter.ts b/test/2.1.x/PathReporter.ts index 48b70cb65..2420d93f4 100644 --- a/test/2.1.x/PathReporter.ts +++ b/test/2.1.x/PathReporter.ts @@ -1,15 +1,16 @@ import * as assert from 'assert' + import * as t from '../../src' import { PathReporter } from '../../src/PathReporter' import { NumberFromString } from './helpers' -describe('PathReporter', () => { +describe.concurrent('PathReporter', () => { it('should use the function name as error message', () => { - // tslint:disable-next-line: no-empty + // eslint-disable-next-line @typescript-eslint/no-empty-function assert.deepStrictEqual(PathReporter.report(t.number.decode(function () {})), [ 'Invalid value supplied to : number' ]) - // tslint:disable-next-line: no-empty + // eslint-disable-next-line @typescript-eslint/no-empty-function assert.deepStrictEqual(PathReporter.report(t.number.decode(function f() {})), [ 'Invalid value f supplied to : number' ]) diff --git a/test/2.1.x/ThrowReporter.ts b/test/2.1.x/ThrowReporter.ts index 33ac2e3ed..45fafc7cf 100644 --- a/test/2.1.x/ThrowReporter.ts +++ b/test/2.1.x/ThrowReporter.ts @@ -1,8 +1,9 @@ import * as assert from 'assert' + import * as t from '../../src' import { ThrowReporter } from '../../src/ThrowReporter' -describe('ThrowReporter', () => { +describe.concurrent('ThrowReporter', () => { it('should throw on invalid inputs', () => { assert.throws(() => { // tslint:disable-next-line: deprecation diff --git a/test/2.1.x/TypeClass.ts b/test/2.1.x/TypeClass.ts index c179b3e07..4022086b7 100644 --- a/test/2.1.x/TypeClass.ts +++ b/test/2.1.x/TypeClass.ts @@ -1,6 +1,7 @@ import * as assert from 'assert' import { Either, fold, right } from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' + import * as t from '../../src/index' import { assertFailure, assertSuccess } from './helpers' @@ -16,7 +17,7 @@ const BAA = new t.Type( const BAI = t.string.pipe(BAA, 'T') -describe('Type', () => { +describe.concurrent('Type', () => { it('should auto bind decode', () => { function clone(t: C): C { const r = Object.create(Object.getPrototypeOf(t)) @@ -46,7 +47,7 @@ describe('Type', () => { assert.strictEqual(decode(clone(A).decode, { a: { a: null } }), true) }) - describe('pipe', () => { + describe.concurrent('pipe', () => { it('should assign a default name', () => { const AOI = t.string const T = AOI.pipe(BAA) @@ -77,20 +78,20 @@ describe('Type', () => { }) }) - describe('asDecoder', () => { + describe.concurrent('asDecoder', () => { it('should return a decoder', () => { assertSuccess(t.string.asDecoder().decode('1')) }) }) - describe('asEncoder', () => { + describe.concurrent('asEncoder', () => { it('should return an encoder', () => { assert.strictEqual(BAI.asEncoder().encode(2), '2') }) }) }) -describe('getContextEntry', () => { +describe.concurrent('getContextEntry', () => { it('should return a ContextEntry', () => { assert.deepStrictEqual(t.getContextEntry('key', t.string), { key: 'key', @@ -99,7 +100,7 @@ describe('getContextEntry', () => { }) }) -describe('clean', () => { +describe.concurrent('clean', () => { it('should return the same type', () => { const T = t.type({ a: t.string }) // tslint:disable-next-line: deprecation @@ -107,7 +108,7 @@ describe('clean', () => { }) }) -describe('alias', () => { +describe.concurrent('alias', () => { it('should return the same type', () => { const T = t.type({ a: t.string }) assert.strictEqual(t.alias(T)(), T) diff --git a/test/2.1.x/array.ts b/test/2.1.x/array.ts index e34a3079e..c6b9f31f6 100644 --- a/test/2.1.x/array.ts +++ b/test/2.1.x/array.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertStrictSuccess, assertSuccess, NumberFromString } from './helpers' -describe('array', () => { - describe('name', () => { +describe.concurrent('array', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.array(t.number) assert.strictEqual(T.name, 'Array') @@ -15,7 +16,7 @@ describe('array', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.array(t.number) assert.strictEqual(T.is([]), true) @@ -24,7 +25,7 @@ describe('array', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T = t.array(t.number) assertSuccess(T.decode([]), []) @@ -50,7 +51,7 @@ describe('array', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.array(t.number) assert.deepStrictEqual(T.encode([1, 2, 3]), [1, 2, 3]) diff --git a/test/2.1.x/brand.ts b/test/2.1.x/brand.ts index 3c2e296f0..7566d6916 100644 --- a/test/2.1.x/brand.ts +++ b/test/2.1.x/brand.ts @@ -1,6 +1,7 @@ import * as assert from 'assert' + import * as t from '../../src/index' -import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' +import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' interface PositiveBrand { readonly Positive: unique symbol @@ -40,15 +41,15 @@ const MyNumberFromStringArray = t.brand( const IntFromString = NumberFromString.pipe(t.Int, 'IntFromString') -describe('brand', () => { - describe('name', () => { +describe.concurrent('brand', () => { + describe.concurrent('name', () => { it('should accept a name', () => { const T = Positive assert.strictEqual(T.name, 'Positive') }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.Int assert.strictEqual(T.is(1.2), false) @@ -64,7 +65,7 @@ describe('brand', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value', () => { const T = Positive assertSuccess(T.decode(0)) @@ -90,7 +91,7 @@ describe('brand', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { const T = MyNumberFromStringArray assert.deepStrictEqual(T.encode([1] as any), ['1']) diff --git a/test/2.1.x/default-types.ts b/test/2.1.x/default-types.ts index 87597441a..3a6361959 100644 --- a/test/2.1.x/default-types.ts +++ b/test/2.1.x/default-types.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' -import { assertSuccess, assertFailure } from './helpers' +import { assertFailure, assertSuccess } from './helpers' -describe('UnknownRecord', () => { - describe('is', () => { +describe.concurrent('UnknownRecord', () => { + describe.concurrent('is', () => { it('should return `true` for valid objects', () => { const T = t.UnknownRecord assert.strictEqual(T.is({}), true) @@ -19,7 +20,7 @@ describe('UnknownRecord', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value', () => { const T = t.UnknownRecord assertSuccess(T.decode({})) @@ -40,7 +41,7 @@ describe('UnknownRecord', () => { }) }) -describe('UnknownArray', () => { +describe.concurrent('UnknownArray', () => { it('should succeed decoding a valid value', () => { const T = t.UnknownArray assertSuccess(T.decode([])) @@ -57,7 +58,7 @@ describe('UnknownArray', () => { }) }) -describe('null', () => { +describe.concurrent('null', () => { it('should succeed decoding a valid value', () => { assertSuccess(t.null.decode(null)) }) @@ -67,7 +68,7 @@ describe('null', () => { }) }) -describe('undefined', () => { +describe.concurrent('undefined', () => { it('should succeed decoding a valid value', () => { assertSuccess(t.undefined.decode(undefined)) }) @@ -77,7 +78,7 @@ describe('undefined', () => { }) }) -describe('unknown', () => { +describe.concurrent('unknown', () => { it('should decode any value', () => { assertSuccess(t.unknown.decode(null)) assertSuccess(t.unknown.decode(undefined)) @@ -101,7 +102,7 @@ describe('unknown', () => { }) }) -describe('boolean', () => { +describe.concurrent('boolean', () => { it('should decode boolean values', () => { const T = t.boolean assertSuccess(T.decode(true)) @@ -114,7 +115,7 @@ describe('boolean', () => { }) }) -describe('bigint', () => { +describe.concurrent('bigint', () => { const T = t.bigint it('should decode bigint values', () => { assertSuccess(T.decode(BigInt(0))) @@ -137,7 +138,7 @@ describe('bigint', () => { }) }) -describe('Integer', () => { +describe.concurrent('Integer', () => { it('should validate integers', () => { const T = t.Integer assertSuccess(T.decode(1)) @@ -148,7 +149,7 @@ describe('Integer', () => { }) }) -describe('void', () => { +describe.concurrent('void', () => { it('should support the alias `voidType`', () => { const T = t.void assertSuccess(t.voidType.decode(undefined)) @@ -156,7 +157,7 @@ describe('void', () => { }) }) -describe('object', () => { +describe.concurrent('object', () => { it('should decode arrays', () => { // tslint:disable-next-line: deprecation assertSuccess(t.object.decode([])) @@ -183,7 +184,7 @@ describe('object', () => { }) }) -describe('Function', () => { +describe.concurrent('Function', () => { it('should decode functions', () => { assertSuccess(t.Function.decode(t.identity)) }) @@ -194,7 +195,7 @@ describe('Function', () => { }) }) -describe('any', () => { +describe.concurrent('any', () => { it('should decode any value', () => { assertSuccess(t.any.decode(null)) assertSuccess(t.any.decode(undefined)) @@ -220,9 +221,9 @@ describe('any', () => { }) }) -describe('never', () => { +describe.concurrent('never', () => { it('should not decode any value', () => { - const T = (t.never as any) as t.Any + const T = t.never as any as t.Any assertFailure(T, null, ['Invalid value null supplied to : never']) assertFailure(T, undefined, ['Invalid value undefined supplied to : never']) assertFailure(T, 'foo', ['Invalid value "foo" supplied to : never']) diff --git a/test/2.1.x/exact.ts b/test/2.1.x/exact.ts index a44ebdd09..36e2916b4 100644 --- a/test/2.1.x/exact.ts +++ b/test/2.1.x/exact.ts @@ -1,9 +1,10 @@ -import * as t from '../../src/index' -import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' import * as assert from 'assert' -describe('exact', () => { - describe('name', () => { +import * as t from '../../src/index' +import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' + +describe.concurrent('exact', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.exact(t.type({ foo: t.string })) assert.strictEqual(T.name, '{| foo: string |}') @@ -15,7 +16,7 @@ describe('exact', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.exact(t.type({ a: t.number })) assert.strictEqual(T.is({ a: 0 }), true) @@ -31,7 +32,7 @@ describe('exact', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value (type)', () => { const T = t.exact(t.type({ foo: t.string })) assertSuccess(T.decode({ foo: 'foo' })) @@ -127,7 +128,7 @@ describe('exact', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { const T = t.exact(t.type({ a: NumberFromString })) assert.deepStrictEqual(T.encode({ a: 1 }), { a: '1' }) diff --git a/test/2.1.x/helpers.ts b/test/2.1.x/helpers.ts index df441ec75..e0e205758 100644 --- a/test/2.1.x/helpers.ts +++ b/test/2.1.x/helpers.ts @@ -1,8 +1,9 @@ import * as assert from 'assert' -import { right, either, fold } from 'fp-ts/lib/Either' +import { either, fold, right } from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' + import * as t from '../../src/index' import { PathReporter } from '../../src/PathReporter' -import { pipe } from 'fp-ts/lib/pipeable' // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function assertStrictEqual(result: t.Validation, expected: any): void { diff --git a/test/2.1.x/intersection.ts b/test/2.1.x/intersection.ts index cd2515091..c3d73fe5b 100644 --- a/test/2.1.x/intersection.ts +++ b/test/2.1.x/intersection.ts @@ -1,8 +1,9 @@ import * as assert from 'assert' + import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' -describe('intersection', () => { +describe.concurrent('intersection', () => { it('mergeAll', () => { assert.deepStrictEqual(t.mergeAll(undefined, [{ prop1: 'b', prop2: 2 }, { prop1: 'a' }, { prop2: 1 }]), { prop1: 'a', @@ -10,7 +11,7 @@ describe('intersection', () => { }) }) - describe('name', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) assert.strictEqual(T.name, '({ a: string } & { b: number })') @@ -22,7 +23,7 @@ describe('intersection', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) assert.strictEqual(T.is({}), false) @@ -47,7 +48,7 @@ describe('intersection', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T = t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) assertSuccess(T.decode({ a: 'a', b: 1 })) @@ -123,7 +124,7 @@ describe('intersection', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.intersection([t.type({ a: t.string }), t.type({ b: t.number })]) assert.deepStrictEqual(T.encode({ a: 'a', b: 1 }), { a: 'a', b: 1 }) diff --git a/test/2.1.x/keyof.ts b/test/2.1.x/keyof.ts index 736a89c08..95a5c81a1 100644 --- a/test/2.1.x/keyof.ts +++ b/test/2.1.x/keyof.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' -import { assertSuccess, assertFailure } from './helpers' +import { assertFailure, assertSuccess } from './helpers' -describe('keyof', () => { - describe('name', () => { +describe.concurrent('keyof', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.keyof({ a: 1, b: 2 }) assert.strictEqual(T.name, '"a" | "b"') @@ -15,7 +16,7 @@ describe('keyof', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.keyof({ a: 1, b: 2 }) assert.strictEqual(T.is(null), false) @@ -25,7 +26,7 @@ describe('keyof', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T = t.keyof({ a: 1, b: 2 }) assertSuccess(T.decode('a')) diff --git a/test/2.1.x/literal.ts b/test/2.1.x/literal.ts index 76b61a143..fd6349305 100644 --- a/test/2.1.x/literal.ts +++ b/test/2.1.x/literal.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' -import { assertSuccess, assertFailure } from './helpers' +import { assertFailure, assertSuccess } from './helpers' -describe('literal', () => { - describe('name', () => { +describe.concurrent('literal', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.literal('a') assert.strictEqual(T.name, '"a"') @@ -15,7 +16,7 @@ describe('literal', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.literal('a') assert.strictEqual(T.is('a'), true) @@ -23,7 +24,7 @@ describe('literal', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T = t.literal('a') assertSuccess(T.decode('a')) @@ -35,7 +36,7 @@ describe('literal', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.literal('a') assert.strictEqual(T.encode('a'), 'a') diff --git a/test/2.1.x/partial.ts b/test/2.1.x/partial.ts index cfa811972..9e0cbbc34 100644 --- a/test/2.1.x/partial.ts +++ b/test/2.1.x/partial.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' -import { assertSuccess, assertFailure, assertStrictEqual, withDefault, NumberFromString } from './helpers' +import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString, withDefault } from './helpers' -describe('partial', () => { - describe('name', () => { +describe.concurrent('partial', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.partial({ a: t.number }) assert.strictEqual(T.name, 'Partial<{ a: number }>') @@ -15,7 +16,7 @@ describe('partial', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should return `true` on valid inputs', () => { const T1 = t.partial({ a: t.number }) assert.strictEqual(T1.is({}), true) @@ -41,7 +42,7 @@ describe('partial', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed on valid inputs', () => { const T = t.partial({ a: t.number }) assertSuccess(T.decode({}), {}) @@ -83,7 +84,7 @@ describe('partial', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.partial({ a: t.number }) assert.deepStrictEqual(T.encode({}), {}) diff --git a/test/2.1.x/readonly.ts b/test/2.1.x/readonly.ts index 8a8d4807b..fa9dc7809 100644 --- a/test/2.1.x/readonly.ts +++ b/test/2.1.x/readonly.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' import { assertFailure, assertSuccess, NumberFromString } from './helpers' -describe('readonly', () => { - describe('name', () => { +describe.concurrent('readonly', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.readonly(t.type({ a: t.number })) assert.strictEqual(T.name, 'Readonly<{ a: number }>') @@ -15,7 +16,7 @@ describe('readonly', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.readonly(t.type({ a: t.number })) assert.strictEqual(T.is({ a: 1 }), true) @@ -31,7 +32,7 @@ describe('readonly', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value', () => { const T = t.readonly(t.type({ a: t.number })) assertSuccess(T.decode({ a: 1 })) @@ -43,7 +44,7 @@ describe('readonly', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { const T = t.readonly(t.type({ a: NumberFromString })) assert.deepStrictEqual(T.encode({ a: 1 }), { a: '1' }) diff --git a/test/2.1.x/readonlyArray.ts b/test/2.1.x/readonlyArray.ts index 9920412c9..980d63c77 100644 --- a/test/2.1.x/readonlyArray.ts +++ b/test/2.1.x/readonlyArray.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' import { assertFailure, assertSuccess, NumberFromString } from './helpers' -describe('readonlyArray', () => { - describe('name', () => { +describe.concurrent('readonlyArray', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.readonlyArray(t.number) assert.strictEqual(T.name, 'ReadonlyArray') @@ -15,7 +16,7 @@ describe('readonlyArray', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.readonlyArray(t.number) assert.strictEqual(T.is([]), true) @@ -33,7 +34,7 @@ describe('readonlyArray', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value', () => { const T = t.readonlyArray(t.number) assertSuccess(T.decode([1])) @@ -45,7 +46,7 @@ describe('readonlyArray', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { const T = t.readonlyArray(NumberFromString) assert.deepStrictEqual(T.encode([0, 1]), ['0', '1']) diff --git a/test/2.1.x/record.ts b/test/2.1.x/record.ts index 736e5583e..c479b9f93 100644 --- a/test/2.1.x/record.ts +++ b/test/2.1.x/record.ts @@ -1,4 +1,5 @@ import * as assert from 'assert' + import * as t from '../../src/index' import { assertFailure, @@ -9,9 +10,9 @@ import { NumberFromString } from './helpers' -describe('record', () => { - describe('nonEnumerableRecord', () => { - describe('name', () => { +describe.concurrent('record', () => { + describe.concurrent('nonEnumerableRecord', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.record(t.string, t.number) assert.strictEqual(T.name, '{ [K in string]: number }') @@ -23,7 +24,7 @@ describe('record', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should return `true` on valid inputs', () => { const T1 = t.record(t.string, t.number) assert.strictEqual(T1.is({}), true) @@ -67,7 +68,7 @@ describe('record', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T = t.record(t.string, t.number) assertSuccess(T.decode({})) @@ -116,7 +117,7 @@ describe('record', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.record(t.string, t.number) assert.deepStrictEqual(T.encode({ a: 1 }), { a: 1 }) @@ -165,8 +166,8 @@ describe('record', () => { }) }) - describe('enumerableRecord', () => { - describe('getDomainKeys', () => { + describe.concurrent('enumerableRecord', () => { + describe.concurrent('getDomainKeys', () => { it('should handle literal', () => { assert.deepStrictEqual(t.getDomainKeys(t.literal('a')), { a: null }) assert.deepStrictEqual(t.getDomainKeys(t.literal(1)), undefined) @@ -182,7 +183,7 @@ describe('record', () => { }) }) - describe('name', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.record(t.literal('a'), t.number) assert.strictEqual(T.name, '{ [K in "a"]: number }') @@ -194,7 +195,7 @@ describe('record', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should return `true` on valid inputs', () => { const T = t.record(t.literal('a'), t.string) assert.strictEqual(T.is({ a: 'a' }), true) @@ -207,7 +208,7 @@ describe('record', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should support literals as domain type', () => { const T = t.record(t.literal('a'), t.string) assertSuccess(T.decode({ a: 'a' }), { a: 'a' }) @@ -244,7 +245,7 @@ describe('record', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.record(t.literal('a'), t.number) assert.deepStrictEqual(T.encode({ a: 1 }), { a: 1 }) diff --git a/test/2.1.x/recursion.ts b/test/2.1.x/recursion.ts index 5a1001b1a..445e46229 100644 --- a/test/2.1.x/recursion.ts +++ b/test/2.1.x/recursion.ts @@ -1,6 +1,7 @@ import * as assert from 'assert' + import * as t from '../../src/index' -import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' +import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' type T = { a: number @@ -13,8 +14,8 @@ const T: t.Type = t.recursion('T', (self) => }) ) -describe('recursion', () => { - describe('is', () => { +describe.concurrent('recursion', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { type A = { a: number @@ -50,7 +51,7 @@ describe('recursion', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value', () => { assertSuccess(T.decode({ a: 1, b: null })) assertSuccess(T.decode({ a: 1, b: { a: 2, b: null } })) @@ -82,7 +83,7 @@ describe('recursion', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { type A = { a: number diff --git a/test/2.1.x/refinement.ts b/test/2.1.x/refinement.ts index 5d030b9c5..0a580bbdc 100644 --- a/test/2.1.x/refinement.ts +++ b/test/2.1.x/refinement.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' -import { assertSuccess, assertFailure, assertStrictEqual, IntegerFromString, NumberFromString } from './helpers' +import { assertFailure, assertStrictEqual, assertSuccess, IntegerFromString, NumberFromString } from './helpers' -describe('refinement', () => { - describe('name', () => { +describe.concurrent('refinement', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.refinement(t.number, (n) => n >= 0) assert.strictEqual(T.name, '(number | )') @@ -15,7 +16,7 @@ describe('refinement', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.Integer assert.strictEqual(T.is(1.2), false) @@ -31,7 +32,7 @@ describe('refinement', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value', () => { const T = t.refinement(t.number, (n) => n >= 0) assertSuccess(T.decode(0)) @@ -61,7 +62,7 @@ describe('refinement', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { const T = t.refinement(t.array(NumberFromString), () => true) assert.deepStrictEqual(T.encode([1]), ['1']) diff --git a/test/2.1.x/strict.ts b/test/2.1.x/strict.ts index 0717e2b98..7fcf039b0 100644 --- a/test/2.1.x/strict.ts +++ b/test/2.1.x/strict.ts @@ -1,9 +1,10 @@ -import * as t from '../../src/index' -import { assertSuccess, assertFailure, assertStrictEqual, NumberFromString } from './helpers' import * as assert from 'assert' -describe('strict', () => { - describe('name', () => { +import * as t from '../../src/index' +import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' + +describe.concurrent('strict', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.strict({ foo: t.string }) assert.strictEqual(T.name, '{| foo: string |}') @@ -15,7 +16,7 @@ describe('strict', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.strict({ a: t.number }) assert.strictEqual(T.is({ a: 0 }), true) @@ -44,7 +45,7 @@ describe('strict', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should succeed validating a valid value', () => { const T = t.strict({ foo: t.string }) assertSuccess(T.decode({ foo: 'foo' })) @@ -85,7 +86,7 @@ describe('strict', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { const T = t.strict({ a: NumberFromString }) assert.deepStrictEqual(T.encode({ a: 1 }), { a: '1' }) diff --git a/test/2.1.x/strictInterfaceWithOptionals.ts b/test/2.1.x/strictInterfaceWithOptionals.ts index 50e9219a8..d4a191877 100644 --- a/test/2.1.x/strictInterfaceWithOptionals.ts +++ b/test/2.1.x/strictInterfaceWithOptionals.ts @@ -1,7 +1,8 @@ -import * as t from '../../src/index' -import { assertSuccess, assertFailure, NumberFromString } from './helpers' import * as assert from 'assert' +import * as t from '../../src/index' +import { assertFailure, assertSuccess, NumberFromString } from './helpers' + export function strictInterfaceWithOptionals( required: R, optional: O, @@ -10,7 +11,7 @@ export function strictInterfaceWithOptionals { +describe.concurrent('strictInterfaceWithOptionals', () => { it('should succeed validating a valid value', () => { const T = strictInterfaceWithOptionals({ foo: t.string }, { bar: t.string }, 'T') assertSuccess(T.decode({ foo: 'foo' })) diff --git a/test/2.1.x/taggedUnion.ts b/test/2.1.x/taggedUnion.ts index 32e177ab3..a25d78f69 100644 --- a/test/2.1.x/taggedUnion.ts +++ b/test/2.1.x/taggedUnion.ts @@ -1,4 +1,5 @@ import * as assert from 'assert' + import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' @@ -16,8 +17,8 @@ const OptionNumberFromString = t.taggedUnion( 'OptionNumberFromString' ) -describe('taggedUnion', () => { - describe('name', () => { +describe.concurrent('taggedUnion', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { // tslint:disable-next-line: deprecation const OptionNumber = t.taggedUnion('type', [ @@ -34,7 +35,7 @@ describe('taggedUnion', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { assert.strictEqual(OptionNumber.is(null), false) assert.strictEqual(OptionNumber.is({}), false) @@ -45,7 +46,7 @@ describe('taggedUnion', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { assertSuccess(OptionNumber.decode({ type: 'None' })) assertSuccess(OptionNumber.decode({ type: 'Some', value: 1 })) @@ -172,7 +173,7 @@ describe('taggedUnion', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { assert.deepStrictEqual(OptionNumber.encode({ type: 'Some', value: 1 }), { type: 'Some', value: 1 }) }) diff --git a/test/2.1.x/tuple.ts b/test/2.1.x/tuple.ts index 6f574b4af..7a529f511 100644 --- a/test/2.1.x/tuple.ts +++ b/test/2.1.x/tuple.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' + import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' -describe('tuple', () => { - describe('name', () => { +describe.concurrent('tuple', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.tuple([t.number, t.string]) assert.strictEqual(T.name, '[number, string]') @@ -15,7 +16,7 @@ describe('tuple', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.tuple([t.number, t.string]) assert.strictEqual(T.is([0, 'foo']), true) @@ -38,7 +39,7 @@ describe('tuple', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T0 = t.tuple([] as any) assertSuccess(T0.decode([])) @@ -81,7 +82,7 @@ describe('tuple', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.tuple([t.number, t.string]) assert.deepStrictEqual(T.encode([1, 'a']), [1, 'a']) diff --git a/test/2.1.x/type.ts b/test/2.1.x/type.ts index 66be70f60..461e3f829 100644 --- a/test/2.1.x/type.ts +++ b/test/2.1.x/type.ts @@ -1,11 +1,12 @@ import * as assert from 'assert' import { fold } from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' + import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' -describe('type', () => { - describe('name', () => { +describe.concurrent('type', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.type({ a: t.string }) assert.strictEqual(T.name, '{ a: string }') @@ -17,7 +18,7 @@ describe('type', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should return `true` on valid inputs', () => { const T = t.type({ a: t.string }) assert.strictEqual(T.is({ a: 'a' }), true) @@ -56,7 +57,7 @@ describe('type', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T = t.type({ a: t.string }) assertSuccess(T.decode({ a: 'a' })) @@ -109,7 +110,7 @@ describe('type', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a isomorphic value', () => { const T = t.type({ a: t.string }) assert.deepStrictEqual(T.encode({ a: 'a' }), { a: 'a' }) diff --git a/test/2.1.x/union.ts b/test/2.1.x/union.ts index c7a36402d..44975d07b 100644 --- a/test/2.1.x/union.ts +++ b/test/2.1.x/union.ts @@ -1,10 +1,11 @@ import * as assert from 'assert' +import { either } from 'fp-ts/lib/Either' + import * as t from '../../src/index' import { assertFailure, assertStrictEqual, assertSuccess, NumberFromString } from './helpers' -import { either } from 'fp-ts/lib/Either' -describe('union', () => { - describe('name', () => { +describe.concurrent('union', () => { + describe.concurrent('name', () => { it('should assign a default name', () => { const T = t.union([t.string, t.number]) assert.strictEqual(T.name, '(string | number)') @@ -16,7 +17,7 @@ describe('union', () => { }) }) - describe('is', () => { + describe.concurrent('is', () => { it('should check a isomorphic value', () => { const T = t.union([t.string, t.number]) assert.strictEqual(T.is(0), true) @@ -32,7 +33,7 @@ describe('union', () => { }) }) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a isomorphic value', () => { const T = t.union([t.string, t.number]) assertSuccess(T.decode('s')) @@ -61,7 +62,7 @@ describe('union', () => { assertStrictEqual(T.decode(value), value) }) - describe('robustness', () => { + describe.concurrent('robustness', () => { it('should handle one codec', () => { const T = t.union([t.string] as any) assertSuccess(T.decode('s')) @@ -70,7 +71,7 @@ describe('union', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a prismatic value', () => { const T1 = t.union([t.type({ a: NumberFromString }), t.number]) assert.deepStrictEqual(T1.encode({ a: 1 }), { a: '1' }) @@ -133,7 +134,7 @@ describe('union', () => { }) }) - describe('getTags', () => { + describe.concurrent('getTags', () => { it('not eligible', () => { assert.strictEqual(t.getTags(t.string), t.emptyTags) }) diff --git a/test/Arbitrary.ts b/test/Arbitrary.ts index 0eccbfa9c..235a5d2dd 100644 --- a/test/Arbitrary.ts +++ b/test/Arbitrary.ts @@ -3,6 +3,7 @@ */ import * as fc from 'fast-check' import { identity, Refinement } from 'fp-ts/lib/function' + import * as S from '../src/Schemable' // ------------------------------------------------------------------------------------- @@ -45,8 +46,10 @@ export const UnknownRecord: Arbitrary> = fc.dictionary(s // combinators // ------------------------------------------------------------------------------------- -export const refine = (refinement: Refinement) => (from: Arbitrary): Arbitrary => - from.filter(refinement) +export const refine = + (refinement: Refinement) => + (from: Arbitrary): Arbitrary => + from.filter(refinement) export function nullable(or: Arbitrary): Arbitrary { return fc.oneof(fc.constant(null), or) @@ -82,8 +85,10 @@ export function tuple>( return (fc.tuple as any)(...components) } -export const intersect = (right: Arbitrary) => (left: Arbitrary): Arbitrary => - fc.tuple(left, right).map(([a, b]) => S.intersect_(a, b)) +export const intersect = + (right: Arbitrary) => + (left: Arbitrary): Arbitrary => + fc.tuple(left, right).map(([a, b]) => S.intersect_(a, b)) export function sum( _tag: T diff --git a/test/Codec.ts b/test/Codec.ts index 8b228ee39..5a1b2d451 100644 --- a/test/Codec.ts +++ b/test/Codec.ts @@ -1,10 +1,11 @@ import * as assert from 'assert' -import * as _ from '../src/Codec' -import * as D from '../src/Decoder' +import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' + +import * as _ from '../src/Codec' import * as DE from '../src/DecodeError' +import * as D from '../src/Decoder' import * as FS from '../src/FreeSemigroup' -import * as E from 'fp-ts/lib/Either' import * as H from './helpers' const codecNumberFromString: _.Codec = _.make( @@ -32,8 +33,8 @@ export function parseJSON(s: string, onError: (reason: unknown) => E): E.Eith return E.tryCatch(() => JSON.parse(s), onError) } -describe('Codec', () => { - describe('Invariant', () => { +describe.concurrent('Codec', () => { + describe.concurrent('Invariant', () => { it('imap', () => { const codec = _.Invariant.imap( _.string, @@ -57,8 +58,8 @@ describe('Codec', () => { assert.deepStrictEqual(codec.encode({ value: 'a' }), 'a') }) - describe('mapLeftWithInput', () => { - describe('decode', () => { + describe.concurrent('mapLeftWithInput', () => { + describe.concurrent('decode', () => { it('should, return the provided expected', () => { const decoder = pipe( _.number, @@ -69,8 +70,8 @@ describe('Codec', () => { }) }) - describe('string', () => { - describe('decode', () => { + describe.concurrent('string', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.string assert.deepStrictEqual(codec.decode('a'), D.success('a')) @@ -83,8 +84,8 @@ describe('Codec', () => { }) }) - describe('number', () => { - describe('decode', () => { + describe.concurrent('number', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.number assert.deepStrictEqual(codec.decode(1), D.success(1)) @@ -97,8 +98,8 @@ describe('Codec', () => { }) }) - describe('boolean', () => { - describe('decode', () => { + describe.concurrent('boolean', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.boolean assert.deepStrictEqual(codec.decode(true), D.success(true)) @@ -112,8 +113,8 @@ describe('Codec', () => { }) }) - describe('literal', () => { - describe('decode', () => { + describe.concurrent('literal', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.literal('a', null, 'b', 1, true) assert.deepStrictEqual(codec.decode('a'), D.success('a')) @@ -126,7 +127,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = _.literal('a') assert.deepStrictEqual(codec.encode('a'), 'a') @@ -134,8 +135,8 @@ describe('Codec', () => { }) }) - describe('refine', () => { - describe('decode', () => { + describe.concurrent('refine', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = pipe( _.string, @@ -154,7 +155,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = pipe( _.string, @@ -165,8 +166,8 @@ describe('Codec', () => { }) }) - describe('nullable', () => { - describe('decode', () => { + describe.concurrent('nullable', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.nullable(codecNumber) assert.deepStrictEqual(codec.decode(null), D.success(null)) @@ -196,7 +197,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = _.nullable(codecNumber) assert.strictEqual(codec.encode(null), null) @@ -205,8 +206,8 @@ describe('Codec', () => { }) }) - describe('struct', () => { - describe('decode', () => { + describe.concurrent('struct', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.struct({ a: _.string @@ -269,7 +270,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = _.struct({ a: codecNumber }) assert.deepStrictEqual(codec.encode({ a: 1 }), { a: '1' }) @@ -283,8 +284,8 @@ describe('Codec', () => { }) }) - describe('partial', () => { - describe('decode', () => { + describe.concurrent('partial', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.partial({ a: _.string }) assert.deepStrictEqual(codec.decode({ a: 'a' }), D.success({ a: 'a' })) @@ -345,7 +346,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = _.partial({ a: codecNumber }) assert.deepStrictEqual(codec.encode({}), {}) @@ -370,8 +371,8 @@ describe('Codec', () => { }) }) - describe('record', () => { - describe('decode', () => { + describe.concurrent('record', () => { + describe.concurrent('decode', () => { it('should decode a valid value', () => { const codec = _.record(_.number) assert.deepStrictEqual(codec.decode({}), D.success({})) @@ -401,7 +402,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = _.record(codecNumber) assert.deepStrictEqual(codec.encode({ a: 1, b: 2 }), { a: '1', b: '2' }) @@ -409,8 +410,8 @@ describe('Codec', () => { }) }) - describe('array', () => { - describe('decode', () => { + describe.concurrent('array', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.array(_.string) assert.deepStrictEqual(codec.decode([]), D.success([])) @@ -437,7 +438,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = _.array(codecNumber) assert.deepStrictEqual(codec.encode([1, 2]), ['1', '2']) @@ -445,8 +446,8 @@ describe('Codec', () => { }) }) - describe('tuple', () => { - describe('decode', () => { + describe.concurrent('tuple', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = _.tuple(_.string, _.number) assert.deepStrictEqual(codec.decode(['a', 1]), D.success(['a', 1])) @@ -488,7 +489,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = _.tuple(codecNumber, _.string) assert.deepStrictEqual(codec.encode([1, 'a']), ['1', 'a']) @@ -496,8 +497,8 @@ describe('Codec', () => { }) }) - describe('intersect', () => { - describe('decode', () => { + describe.concurrent('intersect', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const codec = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual(codec.decode({ a: 'a', b: 1 }), D.success({ a: 'a', b: 1 })) @@ -509,7 +510,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const codec = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: codecNumber }))) assert.deepStrictEqual(codec.encode({ a: 'a', b: 1 }), { a: 'a', b: '1' }) @@ -522,10 +523,10 @@ describe('Codec', () => { }) }) - describe('sum', () => { + describe.concurrent('sum', () => { const sum = _.sum('_tag') - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { const A = _.struct({ _tag: _.literal('A'), a: _.string }) const B = _.struct({ _tag: _.literal('B'), b: _.number }) @@ -558,7 +559,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { const A = _.struct({ _tag: _.literal('A'), a: _.string }) const B = _.struct({ _tag: _.literal('B'), b: codecNumber }) @@ -569,7 +570,7 @@ describe('Codec', () => { }) }) - describe('lazy', () => { + describe.concurrent('lazy', () => { interface A { a: number b?: A @@ -583,7 +584,7 @@ describe('Codec', () => { pipe(_.struct({ a: codecNumber }), _.intersect(_.partial({ b: lazyCodec }))) ) - describe('decode', () => { + describe.concurrent('decode', () => { it('should decode a valid input', () => { assert.deepStrictEqual(lazyCodec.decode({ a: '1' }), D.success({ a: 1 })) assert.deepStrictEqual(lazyCodec.decode({ a: '1', b: { a: '2' } }), D.success({ a: 1, b: { a: 2 } })) @@ -618,7 +619,7 @@ describe('Codec', () => { }) }) - describe('encode', () => { + describe.concurrent('encode', () => { it('should encode a value', () => { assert.deepStrictEqual(lazyCodec.encode({ a: 1 }), { a: '1' }) assert.deepStrictEqual(lazyCodec.encode({ a: 1, b: { a: 2 } }), { a: '1', b: { a: '2' } }) diff --git a/test/Decoder.ts b/test/Decoder.ts index a7e82449b..558fb4cd0 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -1,12 +1,13 @@ import * as assert from 'assert' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' + import * as DE from '../src/DecodeError' -import * as FS from '../src/FreeSemigroup' import * as _ from '../src/Decoder' +import * as FS from '../src/FreeSemigroup' import * as H from './helpers' -describe('Decoder', () => { +describe.concurrent('Decoder', () => { // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -37,7 +38,7 @@ describe('Decoder', () => { assert.deepStrictEqual(_.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) }) - describe('number', () => { + describe.concurrent('number', () => { it('number', async () => { assert.deepStrictEqual(_.number.decode(1), _.success(1)) assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) @@ -67,7 +68,7 @@ describe('Decoder', () => { // constructors // ------------------------------------------------------------------------------------- - describe('literal', () => { + describe.concurrent('literal', () => { it('should decode a valid input', async () => { const decoder = _.literal('a', null, 'b', 1, true) assert.deepStrictEqual(decoder.decode('a'), _.success('a')) @@ -123,7 +124,7 @@ describe('Decoder', () => { assert.deepStrictEqual(decoder.decode(1.2), _.failure(1.2, 'IntFromNumber')) }) - describe('nullable', () => { + describe.concurrent('nullable', () => { it('should decode a valid input', () => { const decoder = _.nullable(H.decoderNumberFromUnknownString) assert.deepStrictEqual(decoder.decode(null), _.success(null)) @@ -153,7 +154,7 @@ describe('Decoder', () => { }) }) - describe('struct', () => { + describe.concurrent('struct', () => { it('should decode a valid input', async () => { const decoder = _.struct({ a: _.string @@ -216,7 +217,7 @@ describe('Decoder', () => { }) }) - describe('partial', () => { + describe.concurrent('partial', () => { it('should decode a valid input', async () => { const decoder = _.partial({ a: _.string }) assert.deepStrictEqual(decoder.decode({ a: 'a' }), _.success({ a: 'a' })) @@ -264,7 +265,7 @@ describe('Decoder', () => { }) }) - describe('array', () => { + describe.concurrent('array', () => { it('should decode a valid input', async () => { const decoder = _.array(_.string) assert.deepStrictEqual(decoder.decode([]), _.success([])) @@ -291,7 +292,7 @@ describe('Decoder', () => { }) }) - describe('record', () => { + describe.concurrent('record', () => { it('should decode a valid value', async () => { const decoder = _.record(_.number) assert.deepStrictEqual(decoder.decode({}), _.success({})) @@ -321,7 +322,7 @@ describe('Decoder', () => { }) }) - describe('tuple', () => { + describe.concurrent('tuple', () => { it('should decode a valid input', async () => { const decoder = _.tuple(_.string, _.number) assert.deepStrictEqual(decoder.decode(['a', 1]), _.success(['a', 1])) @@ -363,7 +364,7 @@ describe('Decoder', () => { }) }) - describe('union', () => { + describe.concurrent('union', () => { it('should decode a valid input', () => { assert.deepStrictEqual(_.union(_.string).decode('a'), _.success('a')) const decoder = _.union(_.string, _.number) @@ -385,7 +386,7 @@ describe('Decoder', () => { }) }) - describe('refine', () => { + describe.concurrent('refine', () => { it('should decode a valid input', () => { const decoder = pipe( _.string, @@ -404,7 +405,7 @@ describe('Decoder', () => { }) }) - describe('intersect', () => { + describe.concurrent('intersect', () => { it('should decode a valid input', () => { const decoder = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual(decoder.decode({ a: 'a', b: 1 }), _.success({ a: 'a', b: 1 })) @@ -437,7 +438,7 @@ describe('Decoder', () => { }) }) - describe('sum', () => { + describe.concurrent('sum', () => { const sum = _.sum('_tag') it('should decode a valid input', () => { @@ -498,7 +499,7 @@ describe('Decoder', () => { pipe(_.struct({ a: H.decoderNumberFromUnknownString }), _.intersect(_.partial({ b: lazyDecoder }))) ) - describe('lazy', () => { + describe.concurrent('lazy', () => { it('should decode a valid input', () => { assert.deepStrictEqual(lazyDecoder.decode({ a: '1' }), _.success({ a: 1 })) assert.deepStrictEqual(lazyDecoder.decode({ a: '1', b: { a: '2' } }), _.success({ a: 1, b: { a: 2 } })) @@ -537,7 +538,7 @@ describe('Decoder', () => { // utils // ------------------------------------------------------------------------------------- - describe('draw', () => { + describe.concurrent('draw', () => { it('is stack safe', () => { expect(() => { E.mapLeft(_.draw)( diff --git a/test/Encoder.ts b/test/Encoder.ts index d4155a63d..042612c50 100644 --- a/test/Encoder.ts +++ b/test/Encoder.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' -import * as E from '../src/Encoder' import { pipe } from 'fp-ts/lib/pipeable' + +import * as E from '../src/Encoder' import * as H from './helpers' -describe('Encoder', () => { +describe.concurrent('Encoder', () => { it('contramap', () => { const encoder = E.contramap((s: string) => s.length)(H.encoderNumberToString) assert.deepStrictEqual(encoder.encode('aaa'), '3') diff --git a/test/Eq.ts b/test/Eq.ts index a7b1921bb..0d8d03d9b 100644 --- a/test/Eq.ts +++ b/test/Eq.ts @@ -1,9 +1,10 @@ import * as assert from 'assert' -import * as E from '../src/Eq' import { Eq } from 'fp-ts/lib/Eq' import { pipe } from 'fp-ts/lib/pipeable' -describe('Eq', () => { +import * as E from '../src/Eq' + +describe.concurrent('Eq', () => { it('literal', () => { const eq = E.Schemable.literal('a', null) assert.deepStrictEqual(eq.equals('a', 'a'), true) diff --git a/test/FreeSemigroup.ts b/test/FreeSemigroup.ts index 029dcb7db..eb2810337 100644 --- a/test/FreeSemigroup.ts +++ b/test/FreeSemigroup.ts @@ -1,6 +1,6 @@ import * as FS from '../src/FreeSemigroup' -describe('FreeSemigroup', () => { +describe.concurrent('FreeSemigroup', () => { it('fold', () => { const sum: (input: FS.FreeSemigroup) => string = FS.fold( (value) => value, diff --git a/test/Guard.ts b/test/Guard.ts index 23cd4318e..2cd3e3511 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -1,8 +1,9 @@ import * as assert from 'assert' -import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' import { Stream } from 'stream' +import * as G from '../src/Guard' + interface NonEmptyStringBrand { readonly NonEmptyString: unique symbol } @@ -13,7 +14,7 @@ const NonEmptyString: G.Guard = { is: (s): s is NonEmptyString => s.length > 0 } -describe('Guard', () => { +describe.concurrent('Guard', () => { it('alt', () => { const guard = pipe( G.string, @@ -41,13 +42,13 @@ describe('Guard', () => { assert.strictEqual(guard.is('a'), true) }) - describe('number', () => { + describe.concurrent('number', () => { it('should exclude NaN', () => { assert.deepStrictEqual(G.number.is(NaN), false) }) }) - describe('refine', () => { + describe.concurrent('refine', () => { it('should accept valid inputs', () => { const guard = pipe( G.string, @@ -66,7 +67,7 @@ describe('Guard', () => { }) }) - describe('nullable', () => { + describe.concurrent('nullable', () => { it('should accept valid inputs', () => { const guard = G.nullable(G.string) assert.strictEqual(guard.is(null), true) @@ -79,7 +80,7 @@ describe('Guard', () => { }) }) - describe('struct', () => { + describe.concurrent('struct', () => { it('should accept valid inputs', () => { const guard = G.struct({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) @@ -118,7 +119,7 @@ describe('Guard', () => { }) }) - describe('partial', () => { + describe.concurrent('partial', () => { it('should accept valid inputs', () => { const guard = G.partial({ a: G.string, b: G.number }) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) @@ -152,7 +153,7 @@ describe('Guard', () => { }) }) - describe('record', () => { + describe.concurrent('record', () => { it('should accept valid inputs', () => { const guard = G.record(G.string) assert.strictEqual(guard.is({}), true) @@ -166,7 +167,7 @@ describe('Guard', () => { }) }) - describe('array', () => { + describe.concurrent('array', () => { it('should accept valid inputs', () => { const guard = G.array(G.number) assert.strictEqual(guard.is([]), true) @@ -180,7 +181,7 @@ describe('Guard', () => { }) }) - describe('tuple', () => { + describe.concurrent('tuple', () => { it('should accept valid inputs', () => { const guard = G.tuple(G.string, G.number) assert.strictEqual(guard.is(['a', 1]), true) @@ -202,7 +203,7 @@ describe('Guard', () => { }) }) - describe('intersect', () => { + describe.concurrent('intersect', () => { it('should accept valid inputs', () => { const guard = pipe(G.struct({ a: G.string }), G.intersect(G.struct({ b: G.number }))) assert.strictEqual(guard.is({ a: 'a', b: 1 }), true) @@ -214,7 +215,7 @@ describe('Guard', () => { }) }) - describe('union', () => { + describe.concurrent('union', () => { it('should accept valid inputs', () => { const guard = G.union(G.string, G.number) assert.strictEqual(guard.is('a'), true) @@ -227,7 +228,7 @@ describe('Guard', () => { }) }) - describe('lazy', () => { + describe.concurrent('lazy', () => { interface A { a: number b: Array @@ -251,7 +252,7 @@ describe('Guard', () => { }) }) - describe('sum', () => { + describe.concurrent('sum', () => { const sum = G.sum('_tag') it('should accept valid inputs', () => { @@ -283,7 +284,7 @@ describe('Guard', () => { }) }) - describe('UnknownRecord', () => { + describe.concurrent('UnknownRecord', () => { it('should accept valid inputs', () => { assert.deepStrictEqual(G.UnknownRecord.is({}), true) assert.deepStrictEqual(G.UnknownRecord.is(new String()), true) diff --git a/test/JsonSchema.test.ts b/test/JsonSchema.test.ts index 670f4b924..6b5b8b90e 100644 --- a/test/JsonSchema.test.ts +++ b/test/JsonSchema.test.ts @@ -1,12 +1,13 @@ -import * as assert from 'assert' import Ajv from 'ajv' -import * as J from './JsonSchema' +import * as assert from 'assert' import * as C from 'fp-ts/lib/Const' import { pipe } from 'fp-ts/lib/pipeable' +import * as J from './JsonSchema' + const ajv = new Ajv() -describe('JsonSchema', () => { +describe.concurrent('JsonSchema', () => { it('literal', () => { const validate = ajv.compile(J.literal('a').compile()) assert.strictEqual(validate('a'), true) @@ -77,7 +78,7 @@ describe('JsonSchema', () => { assert.strictEqual(validate(['a']), false) }) - describe('intersection', () => { + describe.concurrent('intersection', () => { it('should handle non primitive values', () => { const validate = ajv.compile(pipe(J.struct({ a: J.string }), J.intersect(J.struct({ b: J.number }))).compile()) assert.strictEqual(validate({ a: 'a', b: 1 }), true) @@ -129,7 +130,7 @@ describe('JsonSchema', () => { assert.strictEqual(validate(true), false) }) - describe('lazy', () => { + describe.concurrent('lazy', () => { it('should support recursive json schemas', () => { interface A { readonly a: number diff --git a/test/JsonSchema.ts b/test/JsonSchema.ts index 7a1e8e3e6..5b8c5f4ca 100644 --- a/test/JsonSchema.ts +++ b/test/JsonSchema.ts @@ -3,6 +3,7 @@ import { identity } from 'fp-ts/lib/function' import { pipe } from 'fp-ts/lib/pipeable' import * as R from 'fp-ts/lib/ReadonlyRecord' import { JSONSchema7 } from 'json-schema' + import * as S from '../src/Schemable' // ------------------------------------------------------------------------------------- @@ -125,9 +126,11 @@ export function tuple>( } } -export const intersect = (right: JsonSchema) => (left: JsonSchema): JsonSchema => ({ - compile: (lazy) => C.make({ allOf: [left.compile(lazy), right.compile(lazy)] }) -}) +export const intersect = + (right: JsonSchema) => + (left: JsonSchema): JsonSchema => ({ + compile: (lazy) => C.make({ allOf: [left.compile(lazy), right.compile(lazy)] }) + }) export function sum( _tag: T diff --git a/test/Schema.ts b/test/Schema.ts index 08890a6ad..14230c935 100644 --- a/test/Schema.ts +++ b/test/Schema.ts @@ -1,6 +1,7 @@ import * as fc from 'fast-check' import { isRight } from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' + import * as D from '../src/Decoder' import * as Eq from '../src/Eq' import * as G from '../src/Guard' @@ -15,7 +16,7 @@ function check(schema: Schema): void { // decoders, guards and eqs should be aligned fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) && guard.is(a) && eq.equals(a, a))) } -describe('Schema', () => { +describe.concurrent('Schema', () => { it('string', () => { check(make((S) => S.string)) }) diff --git a/test/Schemable.ts b/test/Schemable.ts index 7d6cf9050..64de70bd3 100644 --- a/test/Schemable.ts +++ b/test/Schemable.ts @@ -1,8 +1,9 @@ import * as assert from 'assert' + import * as S from '../src/Schemable' -describe('DecoderT', () => { - describe('intersect', () => { +describe.concurrent('DecoderT', () => { + describe.concurrent('intersect', () => { it('should concat strings', () => { assert.deepStrictEqual(S.intersect_('a', 'b'), 'b') }) diff --git a/test/TaskDecoder.ts b/test/TaskDecoder.ts index a944df232..e79ac6dbe 100644 --- a/test/TaskDecoder.ts +++ b/test/TaskDecoder.ts @@ -2,10 +2,11 @@ import * as assert from 'assert' import * as E from 'fp-ts/lib/Either' import { pipe } from 'fp-ts/lib/pipeable' import * as TE from 'fp-ts/lib/TaskEither' + import * as DE from '../src/DecodeError' +import * as D from '../src/Decoder' import * as FS from '../src/FreeSemigroup' import * as G from '../src/Guard' -import * as D from '../src/Decoder' import * as _ from '../src/TaskDecoder' const undefinedGuard: G.Guard = { @@ -39,7 +40,7 @@ const Int: _.TaskDecoder = pipe( _.refine((n): n is Int => Number.isInteger(n), 'Int') ) -describe('UnknownTaskDecoder', () => { +describe.concurrent('UnknownTaskDecoder', () => { // ------------------------------------------------------------------------------------- // instances // ------------------------------------------------------------------------------------- @@ -110,7 +111,7 @@ describe('UnknownTaskDecoder', () => { assert.deepStrictEqual(await decoder.decode(null)(), D.failure(null, 'string')) }) - describe('literal', () => { + describe.concurrent('literal', () => { it('should decode a valid input', async () => { const decoder = _.literal('a', null, 'b', 1, true) assert.deepStrictEqual(await decoder.decode('a')(), D.success('a')) @@ -166,7 +167,7 @@ describe('UnknownTaskDecoder', () => { assert.deepStrictEqual(await decoder.decode(1.2)(), D.failure(1.2, 'IntFromNumber')) }) - describe('nullable', () => { + describe.concurrent('nullable', () => { it('should decode a valid input', async () => { const decoder = _.nullable(NumberFromString) assert.deepStrictEqual(await decoder.decode(null)(), D.success(null)) @@ -196,7 +197,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('struct', () => { + describe.concurrent('struct', () => { it('should decode a valid input', async () => { const decoder = _.struct({ a: _.string @@ -259,7 +260,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('partial', () => { + describe.concurrent('partial', () => { it('should decode a valid input', async () => { const decoder = _.partial({ a: _.string }) assert.deepStrictEqual(await decoder.decode({ a: 'a' })(), D.success({ a: 'a' })) @@ -320,7 +321,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('array', () => { + describe.concurrent('array', () => { it('should decode a valid input', async () => { const decoder = _.array(_.string) assert.deepStrictEqual(await decoder.decode([])(), D.success([])) @@ -350,7 +351,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('record', () => { + describe.concurrent('record', () => { it('should decode a valid value', async () => { const decoder = _.record(_.number) assert.deepStrictEqual(await decoder.decode({})(), D.success({})) @@ -380,7 +381,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('tuple', () => { + describe.concurrent('tuple', () => { it('should decode a valid input', async () => { const decoder = _.tuple(_.string, _.number) assert.deepStrictEqual(await decoder.decode(['a', 1])(), D.success(['a', 1])) @@ -422,7 +423,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('union', () => { + describe.concurrent('union', () => { it('should decode a valid input', async () => { assert.deepStrictEqual(await _.union(_.string).decode('a')(), D.success('a')) const decoder = _.union(_.string, _.number) @@ -444,7 +445,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('refine', () => { + describe.concurrent('refine', () => { it('should decode a valid input', async () => { const decoder = pipe( _.string, @@ -463,7 +464,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('intersect', () => { + describe.concurrent('intersect', () => { it('should decode a valid input', async () => { const decoder = pipe(_.struct({ a: _.string }), _.intersect(_.struct({ b: _.number }))) assert.deepStrictEqual(await decoder.decode({ a: 'a', b: 1 })(), D.success({ a: 'a', b: 1 })) @@ -496,7 +497,7 @@ describe('UnknownTaskDecoder', () => { }) }) - describe('sum', () => { + describe.concurrent('sum', () => { const sum = _.sum('_tag') it('should decode a valid input', async () => { @@ -540,7 +541,7 @@ describe('UnknownTaskDecoder', () => { pipe(_.struct({ a: NumberFromString }), _.intersect(_.partial({ b: lazyDecoder }))) ) - describe('lazy', () => { + describe.concurrent('lazy', () => { it('should decode a valid input', async () => { assert.deepStrictEqual(await lazyDecoder.decode({ a: '1' })(), D.success({ a: 1 })) assert.deepStrictEqual(await lazyDecoder.decode({ a: '1', b: { a: '2' } })(), D.success({ a: 1, b: { a: 2 } })) @@ -579,7 +580,7 @@ describe('UnknownTaskDecoder', () => { // utils // ------------------------------------------------------------------------------------- - describe('draw', () => { + describe.concurrent('draw', () => { it('draw', async () => { const decoder = _.struct({ a: _.string, diff --git a/test/Type.ts b/test/Type.ts index 567fe0972..b0b3a56f6 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -1,25 +1,26 @@ import * as assert from 'assert' import * as fc from 'fast-check' -import { isRight, isLeft } from 'fp-ts/lib/Either' -import { Kind, URIS, HKT, URIS2, Kind2 } from 'fp-ts/lib/HKT' +import { isLeft, isRight } from 'fp-ts/lib/Either' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' +import { pipe } from 'fp-ts/lib/pipeable' + import * as t from '../src' import * as D from '../src/Decoder' import * as G from '../src/Guard' import { memoize, Schemable, - WithUnion, Schemable1, + Schemable2C, + WithUnion, WithUnion1, + WithUnion2C, WithUnknownContainers, WithUnknownContainers1, - Schemable2C, - WithUnknownContainers2C, - WithUnion2C + WithUnknownContainers2C } from '../src/Schemable' import * as _ from '../src/Type' import * as A from './Arbitrary' -import { pipe } from 'fp-ts/lib/pipeable' interface Schema { (S: Schemable & WithUnknownContainers & WithUnion): HKT @@ -49,7 +50,7 @@ function check(schema: Schema, type: t.Type): void { fc.assert(fc.property(arb, (a) => guard.is(a) === type.is(a))) } -describe('Type', () => { +describe.concurrent('Type', () => { it('string', () => { check( make((S) => S.string), @@ -57,7 +58,7 @@ describe('Type', () => { ) }) - describe('number', () => { + describe.concurrent('number', () => { it('number', () => { check( make((S) => S.number), diff --git a/test/helpers.ts b/test/helpers.ts index 333b363bc..85a0b6a5c 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -1,7 +1,8 @@ -import * as G from '../src/Guard' +import { pipe } from 'fp-ts/lib/pipeable' + import * as D from '../src/Decoder' import * as E from '../src/Encoder' -import { pipe } from 'fp-ts/lib/pipeable' +import * as G from '../src/Guard' // ------------------------------------------------------------------------------------- // guards diff --git a/tsconfig.json b/tsconfig.json index 7976177fa..155dbcab9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,9 @@ "moduleResolution": "node", "forceConsistentCasingInFileNames": true, "stripInternal": true, - "lib": ["es2015", "ESNext.BigInt"] + "lib": ["es2015", "ESNext.BigInt"], + "skipLibCheck": true, + "types": ["vitest/globals"] }, "include": ["./src", "./test", "./scripts"] } diff --git a/tsconfig.tslint.json b/tsconfig.tslint.json deleted file mode 100644 index b3750f282..000000000 --- a/tsconfig.tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": true - }, - "include": ["./test/**/*"] -} diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 3c8e16e70..000000000 --- a/tslint.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "tslint-config-standard", - "rules": { - "space-before-function-paren": false, - "no-use-before-declare": false, - "variable-name": false, - "ter-indent": false, - "strict-type-predicates": false, - "deprecation": true - } -} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 000000000..d98cd45d6 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,19 @@ +/// +import { defineConfig } from 'vite' + +export default defineConfig({ + test: { + include: ['./test/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + exclude: [ + './test/**/util.ts', + './test/JsonSchema.ts', + './test/helpers.ts', + './test/Arbitrary.ts', + './test/2.1.x/helpers.ts' + ], + globals: true, + coverage: { + provider: 'istanbul' + } + } +}) From 616583de0198632cad7820ed8701b15f654c7fd2 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 5 Jun 2023 14:41:08 +0200 Subject: [PATCH 217/222] switch to definitelytyped/dtslint --- .eslintrc.json | 1 + dtslint/{ts3.9 => }/Codec.ts | 4 +- dtslint/{ts3.9 => }/Decoder.ts | 11 +- dtslint/{ts3.9 => }/Encoder.ts | 5 +- dtslint/{ts3.9 => }/Eq.ts | 4 +- dtslint/{ts3.9 => }/Guard.ts | 4 +- dtslint/{ts3.9 => }/Schema.ts | 9 +- dtslint/{ts3.9 => }/TaskDecoder.ts | 6 +- dtslint/{ts3.9 => }/Type.ts | 2 +- dtslint/index.d.ts | 2 +- dtslint/{ts3.9 => }/index.ts | 266 +-- dtslint/ts3.9/index.d.ts | 0 dtslint/ts3.9/tsconfig.json | 17 - dtslint/ts3.9/tslint.json | 26 - dtslint/tsconfig.json | 10 + package-lock.json | 2626 +++++++++++++++++++++++----- package.json | 6 +- tsconfig.json | 2 +- 18 files changed, 2408 insertions(+), 593 deletions(-) rename dtslint/{ts3.9 => }/Codec.ts (97%) rename dtslint/{ts3.9 => }/Decoder.ts (94%) rename dtslint/{ts3.9 => }/Encoder.ts (95%) rename dtslint/{ts3.9 => }/Eq.ts (92%) rename dtslint/{ts3.9 => }/Guard.ts (93%) rename dtslint/{ts3.9 => }/Schema.ts (95%) rename dtslint/{ts3.9 => }/TaskDecoder.ts (79%) rename dtslint/{ts3.9 => }/Type.ts (91%) rename dtslint/{ts3.9 => }/index.ts (53%) delete mode 100644 dtslint/ts3.9/index.d.ts delete mode 100644 dtslint/ts3.9/tsconfig.json delete mode 100644 dtslint/ts3.9/tslint.json create mode 100644 dtslint/tsconfig.json diff --git a/.eslintrc.json b/.eslintrc.json index 2c790eba6..ff7aea944 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,6 +30,7 @@ } ], "@typescript-eslint/prefer-as-const": "off", + "@typescript-eslint/ban-ts-comment": "off", "prefer-rest-params": "off", "prefer-spread": "off", "deprecation/deprecation": "off", diff --git a/dtslint/ts3.9/Codec.ts b/dtslint/Codec.ts similarity index 97% rename from dtslint/ts3.9/Codec.ts rename to dtslint/Codec.ts index 677e7fe02..a65b3dc60 100644 --- a/dtslint/ts3.9/Codec.ts +++ b/dtslint/Codec.ts @@ -1,4 +1,4 @@ -import * as _ from '../../src/Codec' +import * as _ from '../src/Codec' declare const NumberFromString: _.Codec @@ -111,5 +111,5 @@ const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType Codec _.sum('_tag')({ A: S1, B: S2 }) -// // $ExpectError +// // @ts-expect-error // _.sum('_tag')({ A: S1, B: S1 }) diff --git a/dtslint/ts3.9/Decoder.ts b/dtslint/Decoder.ts similarity index 94% rename from dtslint/ts3.9/Decoder.ts rename to dtslint/Decoder.ts index c37951e67..fa280618d 100644 --- a/dtslint/ts3.9/Decoder.ts +++ b/dtslint/Decoder.ts @@ -1,7 +1,9 @@ import { pipe } from 'fp-ts/lib/pipeable' -import * as DE from '../../src/DecodeError' -import * as _ from '../../src/Decoder' -import * as FS from '../../src/FreeSemigroup' + +import * as DE from '../src/DecodeError' +import * as _ from '../src/Decoder' +import * as FS from '../src/FreeSemigroup' +import * as S from '../src/Schemable' declare const NumberFromString: _.Decoder @@ -52,7 +54,6 @@ pipe( ) ) -import * as S from '../../src/Schemable' declare const literal: ], L extends S.Literal = S.Literal>( ...values: A ) => _.Decoder @@ -170,7 +171,7 @@ const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType Decoder _.sum('_tag')({ A: S1, B: S2 }) -// $ExpectError +// @ts-expect-error _.sum('_tag')({ A: S1, B: S1 }) // diff --git a/dtslint/ts3.9/Encoder.ts b/dtslint/Encoder.ts similarity index 95% rename from dtslint/ts3.9/Encoder.ts rename to dtslint/Encoder.ts index 8bb901d4b..159618561 100644 --- a/dtslint/ts3.9/Encoder.ts +++ b/dtslint/Encoder.ts @@ -1,6 +1,7 @@ -import * as E from '../../src/Encoder' import { pipe } from 'fp-ts/lib/pipeable' +import * as E from '../src/Encoder' + const NumberToString: E.Encoder = { encode: String } @@ -68,7 +69,7 @@ const sum = E.sum('_tag') // $ExpectType Encoder<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }, { _tag: "A"; a: number; } | { _tag: "B"; b: boolean; }> sum({ A: S1, B: S2 }) -const S3 = E.struct({ _tag: E.id<'C'>(), c: E.id() }) +export const S3 = E.struct({ _tag: E.id<'C'>(), c: E.id() }) // // lazy diff --git a/dtslint/ts3.9/Eq.ts b/dtslint/Eq.ts similarity index 92% rename from dtslint/ts3.9/Eq.ts rename to dtslint/Eq.ts index c27c58a94..f17fe66b4 100644 --- a/dtslint/ts3.9/Eq.ts +++ b/dtslint/Eq.ts @@ -1,4 +1,4 @@ -import * as _ from '../../src/Eq' +import * as _ from '../src/Eq' // $ExpectType Eq<{ a: string; b: { c: number; }; }> _.struct({ @@ -25,7 +25,7 @@ const S2 = _.struct({ _tag: _.Schemable.literal('B'), b: _.number }) // $ExpectType Eq<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }> _.sum('_tag')({ A: S1, B: S2 }) -// // $ExpectError +// // @ts-expect-error // _.sum('_tag')({ A: S1, B: S1 }) // diff --git a/dtslint/ts3.9/Guard.ts b/dtslint/Guard.ts similarity index 93% rename from dtslint/ts3.9/Guard.ts rename to dtslint/Guard.ts index 31a9d3de2..53bf9a53f 100644 --- a/dtslint/ts3.9/Guard.ts +++ b/dtslint/Guard.ts @@ -1,4 +1,4 @@ -import * as _ from '../../src/Guard' +import * as _ from '../src/Guard' // // struct @@ -40,7 +40,7 @@ const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType Guard _.sum('_tag')({ A: S1, B: S2 }) -// $ExpectError +// @ts-expect-error _.sum('_tag')({ A: S1, B: S1 }) // diff --git a/dtslint/ts3.9/Schema.ts b/dtslint/Schema.ts similarity index 95% rename from dtslint/ts3.9/Schema.ts rename to dtslint/Schema.ts index ee8729eb3..ea7538f46 100644 --- a/dtslint/ts3.9/Schema.ts +++ b/dtslint/Schema.ts @@ -1,7 +1,8 @@ -import { Schemable, WithUnknownContainers, memoize, WithRefine, WithUnion } from '../../src/Schemable' import { HKT } from 'fp-ts/lib/HKT' import { pipe } from 'fp-ts/lib/pipeable' +import { memoize, Schemable, WithRefine, WithUnion, WithUnknownContainers } from '../src/Schemable' + interface Schema { (S: Schemable & WithUnknownContainers & WithRefine & WithUnion): HKT } @@ -23,7 +24,7 @@ export type OfTest = TypeOf // $ExpectType { a: string; b: { c: n // literal // -// $ExpectError +// @ts-expect-error make((S) => S.literal()) make((S) => S.literal('a')) // $ExpectType Schema<"a"> make((S) => S.literal('a', 'b', null)) // $ExpectType Schema<"a" | "b" | null> @@ -102,7 +103,7 @@ const S2 = make((S) => S.struct({ _tag: S.literal('B'), b: S.number })) // $ExpectType Schema<{ _tag: "A"; a: string; } | { _tag: "B"; b: number; }> make((S) => S.sum('_tag')({ A: S1(S), B: S2(S) })) -// $ExpectError +// @ts-expect-error make((S) => S.sum('_tag')({ A: S1(S), B: S1(S) })) // @@ -170,7 +171,7 @@ make((S) => // union // -// $ExpectError +// @ts-expect-error make((S) => S.union()) make((S) => S.union(S.string)) // $ExpectType Schema make((S) => S.union(S.string, S.number)) // $ExpectType Schema diff --git a/dtslint/ts3.9/TaskDecoder.ts b/dtslint/TaskDecoder.ts similarity index 79% rename from dtslint/ts3.9/TaskDecoder.ts rename to dtslint/TaskDecoder.ts index 10a8e936d..33d5f7557 100644 --- a/dtslint/ts3.9/TaskDecoder.ts +++ b/dtslint/TaskDecoder.ts @@ -1,4 +1,4 @@ -import * as _ from '../../src/TaskDecoder' +import * as _ from '../src/TaskDecoder' // // sum @@ -9,8 +9,8 @@ const S2 = _.struct({ _tag: _.literal('B'), b: _.number }) // $ExpectType TaskDecoder _.sum('_tag')({ A: S1, B: S2 }) -// $ExpectError -_.sum('_tag')({ A: S1, B: S1 }) +// // @ts-expect-error +// _.sum('_tag')({ A: S1, B: S1 }) // // readonly diff --git a/dtslint/ts3.9/Type.ts b/dtslint/Type.ts similarity index 91% rename from dtslint/ts3.9/Type.ts rename to dtslint/Type.ts index 503d4b920..ffc94a7c9 100644 --- a/dtslint/ts3.9/Type.ts +++ b/dtslint/Type.ts @@ -1,4 +1,4 @@ -import * as _ from '../../src/Type' +import * as _ from '../src/Type' // $ExpectType Type<{ a: string; b: { c: number; }; }> _.struct({ diff --git a/dtslint/index.d.ts b/dtslint/index.d.ts index 3ae9a657e..ed97e6f6f 100644 --- a/dtslint/index.d.ts +++ b/dtslint/index.d.ts @@ -1 +1 @@ -// TypeScript Version: 3.9 +// Minimum TypeScript Version: 3.9 diff --git a/dtslint/ts3.9/index.ts b/dtslint/index.ts similarity index 53% rename from dtslint/ts3.9/index.ts rename to dtslint/index.ts index bdb9953ca..2c995d043 100644 --- a/dtslint/ts3.9/index.ts +++ b/dtslint/index.ts @@ -1,5 +1,7 @@ -import * as t from '../../src' import { either } from 'fp-ts/lib/Either' +import { TaskEither } from 'fp-ts/lib/TaskEither' + +import * as t from '../src' // // helpers @@ -41,35 +43,35 @@ const Recursion1: t.Type = t.recursion('T', () => }) ) -const Recursion1TypeTest = Recursion1 // $ExpectType Type +export const Recursion1TypeTest = Recursion1 // $ExpectType Type // // literal // const Literal1 = t.literal('a') // $ExpectType LiteralC<"a"> -type Literal1TypeTest = t.TypeOf // $ExpectType "a" -type Literal1OutputTest = t.OutputOf // $ExpectType "a" +export type Literal1TypeTest = t.TypeOf // $ExpectType "a" +export type Literal1OutputTest = t.OutputOf // $ExpectType "a" // // keyof // const Keyof1 = t.keyof({ a: true, b: true }) // $ExpectType KeyofC<{ a: boolean; b: boolean; }> -type Keyof1TypeTest = t.TypeOf // $ExpectType "a" | "b" -type Keyof1OutputTest = t.OutputOf // $ExpectType "a" | "b" +export type Keyof1TypeTest = t.TypeOf // $ExpectType "a" | "b" +export type Keyof1OutputTest = t.OutputOf // $ExpectType "a" | "b" // // refinement // const Refinement1 = t.refinement(t.number, (n) => n % 2 === 0) // $ExpectType RefinementC -type Refinement1TypeTest = t.TypeOf // $ExpectType number -type Refinement1OutputTest = t.OutputOf // $ExpectType number +export type Refinement1TypeTest = t.TypeOf // $ExpectType number +export type Refinement1OutputTest = t.OutputOf // $ExpectType number const Refinement2 = t.refinement(NumberFromString, (n) => n % 2 === 0) // $ExpectType RefinementC, number> -type Refinement2TypeTest = t.TypeOf // $ExpectType number -type Refinement2OutputTest = t.OutputOf // $ExpectType string +export type Refinement2TypeTest = t.TypeOf // $ExpectType number +export type Refinement2OutputTest = t.OutputOf // $ExpectType string type Int = number & { __brand__: 'Int' } @@ -84,71 +86,71 @@ t.refinement(t.number, Number.isInteger, 'Integer') // const Array1 = t.array(t.number) // $ExpectType ArrayC -type Array1TypeTest = t.TypeOf // $ExpectType number[] -type Array1OutputTest = t.OutputOf // $ExpectType number[] +export type Array1TypeTest = t.TypeOf // $ExpectType number[] +export type Array1OutputTest = t.OutputOf // $ExpectType number[] const Array2 = t.array(NumberFromString) // $ExpectType ArrayC> -type Array2TypeTest = t.TypeOf // $ExpectType number[] -type Array2OutputTest = t.OutputOf // $ExpectType string[] +export type Array2TypeTest = t.TypeOf // $ExpectType number[] +export type Array2OutputTest = t.OutputOf // $ExpectType string[] // // type // const Type1 = t.type({ a: t.string, b: t.number }) // $ExpectType TypeC<{ a: StringC; b: NumberC; }> -type Type1TypeTest = Equals, { a: string; b: number }> // $ExpectType "T" -type Type1OutputTest = Equals, { a: string; b: number }> // $ExpectType "T" +export type Type1TypeTest = Equals, { a: string; b: number }> // $ExpectType "T" +export type Type1OutputTest = Equals, { a: string; b: number }> // $ExpectType "T" const Type2 = t.type({ a: t.type({ b: t.string }) }) // $ExpectType TypeC<{ a: TypeC<{ b: StringC; }>; }> -type Type2TypeTest = Equals, { a: { b: string } }> // $ExpectType "T" -type Type2OutputTest = Equals, { a: { b: string } }> // $ExpectType "T" +export type Type2TypeTest = Equals, { a: { b: string } }> // $ExpectType "T" +export type Type2OutputTest = Equals, { a: { b: string } }> // $ExpectType "T" const Type3 = t.type({ a: NumberFromString }) // $ExpectType TypeC<{ a: Type; }> -type Type3TypeTest = Equals, { a: number }> // $ExpectType "T" -type Type3OutputTest = Equals, { a: string }> // $ExpectType "T" +export type Type3TypeTest = Equals, { a: number }> // $ExpectType "T" +export type Type3OutputTest = Equals, { a: string }> // $ExpectType "T" // // record // const Record1 = t.record(t.keyof({ a: true }), t.number) // $ExpectType RecordC, NumberC> -type Record1TypeTest = Equals, { [K in 'a']: number }> // $ExpectType "T" -type Record1OutputTest = Equals, { [K in 'a']: number }> // $ExpectType "T" +export type Record1TypeTest = Equals, { [K in 'a']: number }> // $ExpectType "T" +export type Record1OutputTest = Equals, { [K in 'a']: number }> // $ExpectType "T" const Record2 = t.record(t.string, NumberFromString) // $ExpectType RecordC> -type Record2TypeTest = Equals, { [K in string]: number }> // $ExpectType "T" -type Record2OutputTest = Equals, { [K in string]: string }> // $ExpectType "T" +export type Record2TypeTest = Equals, { [K in string]: number }> // $ExpectType "T" +export type Record2OutputTest = Equals, { [K in string]: string }> // $ExpectType "T" // // union // -// $ExpectError -const Union0 = t.union([]) +// @ts-expect-error +t.union([]) -// $ExpectError -const Union1 = t.union([t.boolean]) +// @ts-expect-error +t.union([t.boolean]) const Union2 = t.union([t.boolean, t.number]) // $ExpectType UnionC<[BooleanC, NumberC]> -type Union2TypeTest = t.TypeOf // $ExpectType number | boolean -type Union2OutputTest = t.OutputOf // $ExpectType number | boolean +export type Union2TypeTest = t.TypeOf // $ExpectType number | boolean +export type Union2OutputTest = t.OutputOf // $ExpectType number | boolean const Union3 = t.union([t.boolean, NumberFromString]) // $ExpectType UnionC<[BooleanC, Type]> -type Union3TypeTest = t.TypeOf // $ExpectType number | boolean -type Union3OutputTest = t.OutputOf // $ExpectType string | boolean +export type Union3TypeTest = t.TypeOf // $ExpectType number | boolean +export type Union3OutputTest = t.OutputOf // $ExpectType string | boolean // // intersection // const Intersection2 = t.intersection([t.type({ a: t.number }), t.type({ b: t.string })]) // $ExpectType IntersectionC<[TypeC<{ a: NumberC; }>, TypeC<{ b: StringC; }>]> -type Intersection2TypeTest = Equals, { a: number; b: string }> // $ExpectType "T" -type Intersection2OutputTest = Equals, { a: number; b: string }> // $ExpectType "T" +export type Intersection2TypeTest = Equals, { a: number; b: string }> // $ExpectType "T" +export type Intersection2OutputTest = Equals, { a: number; b: string }> // $ExpectType "T" const Intersection3 = t.intersection([t.type({ a: t.number }), t.type({ b: t.string }), t.type({ c: t.boolean })]) -const Intersection3Test = Intersection3 // $ExpectType IntersectionC<[TypeC<{ a: NumberC; }>, TypeC<{ b: StringC; }>, TypeC<{ c: BooleanC; }>]> -type Intersection3TypeTest = Equals, { a: number; b: string; c: boolean }> // $ExpectType "T" -type Intersection23OutputTest = Equals, { a: number; b: string; c: boolean }> // $ExpectType "T" +export const Intersection3Test = Intersection3 // $ExpectType IntersectionC<[TypeC<{ a: NumberC; }>, TypeC<{ b: StringC; }>, TypeC<{ c: BooleanC; }>]> +export type Intersection3TypeTest = Equals, { a: number; b: string; c: boolean }> // $ExpectType "T" +export type Intersection23OutputTest = Equals, { a: number; b: string; c: boolean }> // $ExpectType "T" const Intersection4 = t.intersection([ t.type({ a: t.number }), @@ -156,9 +158,17 @@ const Intersection4 = t.intersection([ t.type({ c: t.boolean }), t.type({ d: t.null }) ]) -const Intersection4Test = Intersection4 // $ExpectType IntersectionC<[TypeC<{ a: NumberC; }>, TypeC<{ b: StringC; }>, TypeC<{ c: BooleanC; }>, TypeC<{ d: NullC; }>]> -type Intersection4TypeTest = Equals, { a: number; b: string; c: boolean; d: null }> // $ExpectType "T" -type Intersection43OutputTest = Equals, { a: number; b: string; c: boolean; d: null }> // $ExpectType "T" +export const Intersection4Test = Intersection4 // $ExpectType IntersectionC<[TypeC<{ a: NumberC; }>, TypeC<{ b: StringC; }>, TypeC<{ c: BooleanC; }>, TypeC<{ d: NullC; }>]> +// $ExpectType "T" +export type Intersection4TypeTest = Equals< + t.TypeOf, + { a: number; b: string; c: boolean; d: null } +> +// $ExpectType "T" +export type Intersection43OutputTest = Equals< + t.OutputOf, + { a: number; b: string; c: boolean; d: null } +> const Intersection5 = t.intersection([ t.type({ a: t.number }), @@ -167,7 +177,7 @@ const Intersection5 = t.intersection([ t.type({ d: t.null }), t.type({ e: t.undefined }) ]) -const Intersection5Test = Intersection5 // $ExpectType IntersectionC<[TypeC<{ a: NumberC; }>, TypeC<{ b: StringC; }>, TypeC<{ c: BooleanC; }>, TypeC<{ d: NullC; }>, TypeC<{ e: UndefinedC; }>]> +export const Intersection5Test = Intersection5 // $ExpectType IntersectionC<[TypeC<{ a: NumberC; }>, TypeC<{ b: StringC; }>, TypeC<{ c: BooleanC; }>, TypeC<{ d: NullC; }>, TypeC<{ e: UndefinedC; }>]> interface ExpectedIntersection5TypeTest { a: number b: string @@ -175,7 +185,7 @@ interface ExpectedIntersection5TypeTest { d: null e: undefined } -type Intersection5TypeTest = Equals, ExpectedIntersection5TypeTest> // $ExpectType "T" +export type Intersection5TypeTest = Equals, ExpectedIntersection5TypeTest> // $ExpectType "T" interface ExpectedIntersection53OutputTest { a: number b: string @@ -183,14 +193,14 @@ interface ExpectedIntersection53OutputTest { d: null e: undefined } -type Intersection53OutputTest = Equals, ExpectedIntersection53OutputTest> // $ExpectType "T" +export type Intersection53OutputTest = Equals, ExpectedIntersection53OutputTest> // $ExpectType "T" const Intersection6 = t.intersection([t.type({ a: NumberFromString }), t.type({ b: t.string })]) // $ExpectType IntersectionC<[TypeC<{ a: Type; }>, TypeC<{ b: StringC; }>]> -type Intersection6TypeTest = Equals, { a: number; b: string }> // $ExpectType "T" -type Intersection6OutputTest = Equals, { a: string; b: string }> // $ExpectType "T" +export type Intersection6TypeTest = Equals, { a: number; b: string }> // $ExpectType "T" +export type Intersection6OutputTest = Equals, { a: string; b: string }> // $ExpectType "T" -// $ExpectError -const Intersection7 = t.intersection([t.string, t.string, t.string, t.string, t.string, t.string]) +// @ts-expect-error +t.intersection([t.string, t.string, t.string, t.string, t.string, t.string]) declare function testIntersectionInput(x: t.Type, any, unknown>): void declare function testIntersectionOuput(x: t.Type, unknown>): void @@ -202,9 +212,9 @@ const QueryString = t.intersection([ b: t.number }) ]) -// $ExpectError +// @ts-expect-error testIntersectionInput(QueryString) -// $ExpectError +// @ts-expect-error testIntersectionOuput(QueryString) const IntersectionWithPrimitive = t.intersection([ @@ -214,97 +224,97 @@ const IntersectionWithPrimitive = t.intersection([ }) ]) -type IntersectionWithPrimitiveTest = Equals, number & { a: 'a' }> // $ExpectType "T" +export type IntersectionWithPrimitiveTest = Equals, number & { a: 'a' }> // $ExpectType "T" // // tuple // -// $ExpectError -const Tuple1 = t.tuple([]) +// @ts-expect-error +t.tuple([]) const Tuple2 = t.tuple([t.string]) // $ExpectType TupleC<[StringC]> -type Tuple2TypeTest = t.TypeOf // $ExpectType [string] -type Tuple2OutputTest = t.OutputOf // $ExpectType [string] +export type Tuple2TypeTest = t.TypeOf // $ExpectType [string] +export type Tuple2OutputTest = t.OutputOf // $ExpectType [string] const Tuple3 = t.tuple([t.string, t.number]) // $ExpectType TupleC<[StringC, NumberC]> -type Tuple3TypeTest = t.TypeOf // $ExpectType [string, number] -type Tuple3OutputTest = t.OutputOf // $ExpectType [string, number] +export type Tuple3TypeTest = t.TypeOf // $ExpectType [string, number] +export type Tuple3OutputTest = t.OutputOf // $ExpectType [string, number] const Tuple4 = t.tuple([t.string, NumberFromString]) // $ExpectType TupleC<[StringC, Type]> -type Tuple4TypeTest = t.TypeOf // $ExpectType [string, number] -type Tuple4OutputTest = t.OutputOf // $ExpectType [string, string] +export type Tuple4TypeTest = t.TypeOf // $ExpectType [string, number] +export type Tuple4OutputTest = t.OutputOf // $ExpectType [string, string] const Tuple5 = t.tuple([t.string, t.number, t.boolean]) // $ExpectType TupleC<[StringC, NumberC, BooleanC]> -type Tuple5TypeTest = t.TypeOf // $ExpectType [string, number, boolean] -type Tuple5OutputTest = t.OutputOf // $ExpectType [string, number, boolean] +export type Tuple5TypeTest = t.TypeOf // $ExpectType [string, number, boolean] +export type Tuple5OutputTest = t.OutputOf // $ExpectType [string, number, boolean] const Tuple6 = t.tuple([t.string, t.number, t.boolean, t.null]) // $ExpectType TupleC<[StringC, NumberC, BooleanC, NullC]> -type Tuple6TypeTest = t.TypeOf // $ExpectType [string, number, boolean, null] -type Tuple6OutputTest = t.OutputOf // $ExpectType [string, number, boolean, null] +export type Tuple6TypeTest = t.TypeOf // $ExpectType [string, number, boolean, null] +export type Tuple6OutputTest = t.OutputOf // $ExpectType [string, number, boolean, null] const Tuple7 = t.tuple([t.string, t.number, t.boolean, t.null, t.undefined]) // $ExpectType TupleC<[StringC, NumberC, BooleanC, NullC, UndefinedC]> -type Tuple7TypeTest = t.TypeOf // $ExpectType [string, number, boolean, null, undefined] -type Tuple7OutputTest = t.OutputOf // $ExpectType [string, number, boolean, null, undefined] +export type Tuple7TypeTest = t.TypeOf // $ExpectType [string, number, boolean, null, undefined] +export type Tuple7OutputTest = t.OutputOf // $ExpectType [string, number, boolean, null, undefined] -// $ExpectError -const Tuple8 = t.tuple([t.string, t.string, t.string, t.string, t.string, t.string]) +// @ts-expect-error +t.tuple([t.string, t.string, t.string, t.string, t.string, t.string]) // // partial // const Partial1 = t.partial({ a: t.string, b: t.number }) // $ExpectType PartialC<{ a: StringC; b: NumberC; }> -type Partial1TypeTest = Equals, { a?: string; b?: number }> // $ExpectType "T" -type Partial1OutputTest = Equals, { a?: string; b?: number }> // $ExpectType "T" +export type Partial1TypeTest = Equals, { a?: string; b?: number }> // $ExpectType "T" +export type Partial1OutputTest = Equals, { a?: string; b?: number }> // $ExpectType "T" const Partial2 = t.partial({ a: t.string, b: NumberFromString }) // $ExpectType PartialC<{ a: StringC; b: Type; }> -type Partial2TypeTest = Equals, { a?: string; b?: number }> // $ExpectType "T" -type Partial2OutputTest = Equals, { a?: string; b?: string }> // $ExpectType "T" +export type Partial2TypeTest = Equals, { a?: string; b?: number }> // $ExpectType "T" +export type Partial2OutputTest = Equals, { a?: string; b?: string }> // $ExpectType "T" // // readonly // const Readonly1 = t.readonly(t.type({ a: t.number })) // $ExpectType ReadonlyC> -type Readonly1TypeTest = Equals, { readonly a: number }> // $ExpectType "T" -type Readonly1OutputTest = Equals, { readonly a: number }> // $ExpectType "T" +export type Readonly1TypeTest = Equals, { readonly a: number }> // $ExpectType "T" +export type Readonly1OutputTest = Equals, { readonly a: number }> // $ExpectType "T" const Readonly2 = t.readonly(t.type({ a: NumberFromString })) // $ExpectType ReadonlyC; }>> -type Readonly2TypeTest = Equals, { readonly a: number }> // $ExpectType "T" -type Readonly2OutputTest = Equals, { readonly a: string }> // $ExpectType "T" +export type Readonly2TypeTest = Equals, { readonly a: number }> // $ExpectType "T" +export type Readonly2OutputTest = Equals, { readonly a: string }> // $ExpectType "T" const Readonly3 = t.readonly(t.tuple([t.string, NumberFromString])) -type Readonly3TypeTest = Equals, Readonly<[string, number]>> // $ExpectType "T" -type Readonly3OutputTest = Equals, Readonly<[string, string]>> // $ExpectType "T" +export type Readonly3TypeTest = Equals, Readonly<[string, number]>> // $ExpectType "T" +export type Readonly3OutputTest = Equals, Readonly<[string, string]>> // $ExpectType "T" // // readonlyArray // const ReadonlyArray1 = t.readonlyArray(t.number) -type ReadonlyArray1TypeTest = t.TypeOf // $ExpectType ReadonlyArray -type ReadonlyArray1OutputTest = t.OutputOf // $ExpectType ReadonlyArray +export type ReadonlyArray1TypeTest = t.TypeOf // $ExpectType ReadonlyArray +export type ReadonlyArray1OutputTest = t.OutputOf // $ExpectType ReadonlyArray const ReadonlyArray2 = t.readonlyArray(NumberFromString) -type ReadonlyArray2TypeTest = t.TypeOf // $ExpectType ReadonlyArray -type ReadonlyArray2OutputTest = t.OutputOf // $ExpectType ReadonlyArray +export type ReadonlyArray2TypeTest = t.TypeOf // $ExpectType ReadonlyArray +export type ReadonlyArray2OutputTest = t.OutputOf // $ExpectType ReadonlyArray // // strict // const Strict1 = t.strict({ a: t.string, b: t.number }) // $ExpectType ExactC> -type Strict1TypeTest = Equals, { a: string; b: number }> // $ExpectType "T" -type Strict1OutputTest = Equals, { a: string; b: number }> // $ExpectType "T" +export type Strict1TypeTest = Equals, { a: string; b: number }> // $ExpectType "T" +export type Strict1OutputTest = Equals, { a: string; b: number }> // $ExpectType "T" const Strict2 = t.strict({ a: t.strict({ b: t.string }) }) // $ExpectType ExactC>; }>> -type Strict2TypeTest = Equals, { a: { b: string } }> // $ExpectType "T" -type Strict2OutputTest = Equals, { a: { b: string } }> // $ExpectType "T" +export type Strict2TypeTest = Equals, { a: { b: string } }> // $ExpectType "T" +export type Strict2OutputTest = Equals, { a: { b: string } }> // $ExpectType "T" const Strict3 = t.strict({ a: NumberFromString }) // $ExpectType ExactC; }>> -type Strict3TypeTest = Equals, { a: number }> // $ExpectType "T" -type Strict3OutputTest = Equals, { a: string }> // $ExpectType "T" +export type Strict3TypeTest = Equals, { a: number }> // $ExpectType "T" +export type Strict3OutputTest = Equals, { a: string }> // $ExpectType "T" // // tagged unions @@ -314,9 +324,9 @@ const TaggedUnion1 = t.taggedUnion('type', [ t.type({ type: t.literal('a'), a: t.number }), t.type({ type: t.literal('b') }) ]) -const TaggedUnion1Type = TaggedUnion1 // $ExpectType TaggedUnionC<"type", [TypeC<{ type: LiteralC<"a">; a: NumberC; }>, TypeC<{ type: LiteralC<"b">; }>]> -type TaggedUnion1TypeTest = Equals, { type: 'a'; a: number } | { type: 'b' }> // $ExpectType "T" -type TaggedUnion1OutputTest = Equals, { type: 'a'; a: number } | { type: 'b' }> // $ExpectType "T" +export const TaggedUnion1Type = TaggedUnion1 // $ExpectType TaggedUnionC<"type", [TypeC<{ type: LiteralC<"a">; a: NumberC; }>, TypeC<{ type: LiteralC<"b">; }>]> +export type TaggedUnion1TypeTest = Equals, { type: 'a'; a: number } | { type: 'b' }> // $ExpectType "T" +export type TaggedUnion1OutputTest = Equals, { type: 'a'; a: number } | { type: 'b' }> // $ExpectType "T" interface TaggedUnion2_A { type: 'a' @@ -343,20 +353,20 @@ const TaggedUnion2_B: t.RecursiveType = t.recursion, TaggedUnion2_A | TaggedUnion2_B> // $ExpectType "T" -type TaggedUnion2OutputTest = Equals, TaggedUnion2_A | TaggedUnion2_B> // $ExpectType "T" +export type TaggedUnion2TypeTest = Equals, TaggedUnion2_A | TaggedUnion2_B> // $ExpectType "T" +export type TaggedUnion2OutputTest = Equals, TaggedUnion2_A | TaggedUnion2_B> // $ExpectType "T" // // exact // const Exact1 = t.exact(t.type({ a: t.number })) // $ExpectType ExactC> -type Exact1TypeTest = Equals, { a: number }> // $ExpectType "T" -type Exact1OutputTest = Equals, { a: number }> // $ExpectType "T" +export type Exact1TypeTest = Equals, { a: number }> // $ExpectType "T" +export type Exact1OutputTest = Equals, { a: number }> // $ExpectType "T" const Exact2 = t.exact(t.type({ a: NumberFromString })) // $ExpectType ExactC; }>> -type Exact2TypeTest = Equals, { a: number }> // $ExpectType "T" -type Exact2OutputTest = Equals, { a: string }> // $ExpectType "T" +export type Exact2TypeTest = Equals, { a: number }> // $ExpectType "T" +export type Exact2OutputTest = Equals, { a: string }> // $ExpectType "T" // // clean / alias @@ -381,25 +391,25 @@ interface C1WithAdditionalProp extends C1 { c: boolean } -// $ExpectError -const C2 = t.clean(C1) -// $ExpectError -const C3 = t.clean(C1) +// @ts-expect-error +export const C2 = t.clean(C1) +// @ts-expect-error +export const C3 = t.clean(C1) const C4 = t.clean(C1) -type CleanTest1 = t.TypeOf // $ExpectType C1 -type CleanTest2 = t.OutputOf // $ExpectType C1O +export type CleanTest1 = t.TypeOf // $ExpectType C1 +export type CleanTest2 = t.OutputOf // $ExpectType C1O const C5 = t.alias(C1)() -type AliasTest1 = t.TypeOf // $ExpectType C1 -type AliasTest2 = t.OutputOf['a'] // $ExpectType string -type AliasTest3 = t.OutputOf['b'] // $ExpectType string -// $ExpectError -const C6 = t.alias(C1)() -// // $ExpectError +export type AliasTest1 = t.TypeOf // $ExpectType C1 +export type AliasTest2 = t.OutputOf['a'] // $ExpectType string +export type AliasTest3 = t.OutputOf['b'] // $ExpectType string +// @ts-expect-error +export const C6 = t.alias(C1)() +// // @ts-expect-error // bug fix: 647 const C7 = t.alias(C1)() const C8 = t.alias(C1)() -type AliasTest4 = t.TypeOf // $ExpectType C1 -type AliasTest5 = t.OutputOf // $ExpectType C1O +export type AliasTest4 = t.TypeOf // $ExpectType C1 +export type AliasTest5 = t.OutputOf // $ExpectType C1O // // miscellanea @@ -539,8 +549,6 @@ export function maybe( // ---------------- -import { TaskEither } from 'fp-ts/lib/TaskEither' - // tslint:disable-next-line:strict-export-declare-modifiers declare function withValidation( type: t.Type, @@ -561,9 +569,9 @@ interface PositiveBrand { readonly Positive: unique symbol } -const PositiveBad = t.brand( +export const PositiveBad = t.brand( t.number, - // $ExpectError + // @ts-expect-error (n): n is t.Branded => n > 0, 'Bad' // name doesn't match ) @@ -579,8 +587,8 @@ const Person = t.type({ type Person = t.TypeOf // $ExpectType { name: string; age: number & Brand & Brand; } -// $ExpectError -const person: Person = { name: 'name', age: -1.2 } +// @ts-expect-error +export const person: Person = { name: 'name', age: -1.2 } interface IntBrand2 { readonly Int: unique symbol @@ -590,24 +598,22 @@ const Int2 = t.brand(t.number, (n): n is t.Branded => Number. type Int2 = t.TypeOf // $ExpectType Branded // should be possible to convert a branded type to its carrier type -const toNumber = (n: t.Int): number => n +export const toNumber = (n: t.Int): number => n -// $ExpectError -const intToInt2 = (int: t.Int): Int2 => int +// @ts-expect-error +export const intToInt2 = (int: t.Int): Int2 => int // // UnknownRecord // -// $ExpectError -const ur1: Record = [1, 2, 3] -// $ExpectError -const ur2: Record = new Date() -// tslint:disable: no-construct -// $ExpectError -const ur3: Record = new Number() -// $ExpectError -const ur4: Record = new String() -// $ExpectError -const ur5: Record = new Boolean() -// tslint:enable: no-construct +// @ts-expect-error +export const ur1: Record = [1, 2, 3] +// @ts-expect-error +export const ur2: Record = new Date() +// @ts-expect-error +export const ur3: Record = new Number() +// @ts-expect-error +export const ur4: Record = new String() +// @ts-expect-error +export const ur5: Record = new Boolean() diff --git a/dtslint/ts3.9/index.d.ts b/dtslint/ts3.9/index.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/dtslint/ts3.9/tsconfig.json b/dtslint/ts3.9/tsconfig.json deleted file mode 100644 index e55758e3c..000000000 --- a/dtslint/ts3.9/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "noEmit": true, - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "noImplicitReturns": false, - "noUnusedLocals": false, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "target": "es5", - "lib": ["es2015"], - "skipLibCheck": true - } -} diff --git a/dtslint/ts3.9/tslint.json b/dtslint/ts3.9/tslint.json deleted file mode 100644 index 1691e6c2f..000000000 --- a/dtslint/ts3.9/tslint.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": "dtslint/dtslint.json", - "rules": { - "semicolon": false, - "array-type": false, - "no-unnecessary-generics": false, - "member-access": false, - "no-empty-interface": false, - "no-arg": false, - "no-object-literal-type-assertion": false, - "no-unnecessary-class": false, - "radix": false, - "no-angle-bracket-type-assertion": false, - "object-literal-shorthand": false, - "prefer-object-spread": false, - "whitespace": false, - "use-default-type-parameter": false, - "interface-name": false, - "no-promise-as-boolean": false, - "no-eval": false, - "label-position": false, - "function-constructor": false, - "invalid-void": false, - "no-construct": false - } -} diff --git a/dtslint/tsconfig.json b/dtslint/tsconfig.json new file mode 100644 index 000000000..3a81dbe85 --- /dev/null +++ b/dtslint/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "module": "commonjs", + "strict": true, + "noEmit": true, + "target": "es5", + "lib": ["es2015"], + "skipLibCheck": true + } +} diff --git a/package-lock.json b/package-lock.json index 432c62dcb..874a36cfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "2.2.20", "license": "MIT", "devDependencies": { + "@definitelytyped/dtslint": "^0.0.163", "@types/benchmark": "^1.0.31", "@types/glob": "^7.1.3", "@types/node": "^16.18.25", @@ -17,7 +18,6 @@ "@vitest/coverage-istanbul": "^0.23.4", "benchmark": "2.1.4", "docs-ts": "^0.7.2", - "dtslint": "github:gcanti/dtslint", "eslint": "^8.38.0", "eslint-plugin-deprecation": "^1.4.1", "eslint-plugin-import": "^2.27.5", @@ -30,7 +30,7 @@ "rimraf": "2.6.2", "ts-node": "^8.0.2", "tslint": "5.11.0", - "typescript": "^5.0.4", + "typescript": "^5.1.3", "vite": "^4.3.3", "vitest": "^0.30.1" }, @@ -406,6 +406,185 @@ "node": ">=6.9.0" } }, + "node_modules/@definitelytyped/dts-critic": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/dts-critic/-/dts-critic-0.0.163.tgz", + "integrity": "sha512-HsTvylj8x2gQaawsOCcN2Xk2Cx0wgV9kaj83hgsO9SITZSPd7dA0UkHyNRadbMkMwqNDKcnizcmWdz0+0gIo8A==", + "dev": true, + "dependencies": { + "@definitelytyped/header-parser": "^0.0.163", + "command-exists": "^1.2.8", + "rimraf": "^3.0.2", + "semver": "^6.2.0", + "tmp": "^0.2.1", + "yargs": "^15.3.1" + }, + "engines": { + "node": ">=10.17.0" + }, + "peerDependencies": { + "typescript": "*" + } + }, + "node_modules/@definitelytyped/dts-critic/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@definitelytyped/dts-critic/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@definitelytyped/dtslint": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/dtslint/-/dtslint-0.0.163.tgz", + "integrity": "sha512-U0uw7Zu0QdYSuBMYgxvRYjkhkeulTEg8vDgJ7TiYQUv/wODeujSAmGahQn51E5hOlSMYUw7A9utdbUukxE02SQ==", + "dev": true, + "dependencies": { + "@definitelytyped/dts-critic": "^0.0.163", + "@definitelytyped/header-parser": "^0.0.163", + "@definitelytyped/typescript-versions": "^0.0.163", + "@definitelytyped/utils": "^0.0.163", + "@typescript-eslint/eslint-plugin": "^5.55.0", + "@typescript-eslint/parser": "^5.55.0", + "@typescript-eslint/types": "^5.56.0", + "@typescript-eslint/typescript-estree": "^5.55.0", + "@typescript-eslint/utils": "^5.55.0", + "eslint": "^8.17.0", + "fs-extra": "^6.0.1", + "json-stable-stringify": "^1.0.1", + "strip-json-comments": "^2.0.1", + "tslint": "5.14.0", + "yargs": "^15.1.0" + }, + "bin": { + "dtslint": "dist/index.js" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "typescript": ">= 3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.7.0-dev || >= 3.8.0-dev || >= 3.9.0-dev || >= 4.0.0-dev || >=5.0.0-dev" + } + }, + "node_modules/@definitelytyped/dtslint/node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/@definitelytyped/dtslint/node_modules/fs-extra": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", + "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "node_modules/@definitelytyped/dtslint/node_modules/tslint": { + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.14.0.tgz", + "integrity": "sha512-IUla/ieHVnB8Le7LdQFRGlVJid2T/gaJe5VkjzRVSRR6pA2ODYrnfR1hmxi+5+au9l50jBwpbBL34txgv4NnTQ==", + "dev": true, + "dependencies": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "bin": { + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + } + }, + "node_modules/@definitelytyped/header-parser": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.163.tgz", + "integrity": "sha512-Jr+/q+ESfc7uWldz/j11BfpjIN/gB4WmwhFENhWaMwM0W/9p0ShF+OiUqGhk2Q3Iz8v/oyWzSsxyxgasg9kCxQ==", + "dev": true, + "dependencies": { + "@definitelytyped/typescript-versions": "^0.0.163", + "@types/parsimmon": "^1.10.1", + "parsimmon": "^1.13.0" + } + }, + "node_modules/@definitelytyped/typescript-versions": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/typescript-versions/-/typescript-versions-0.0.163.tgz", + "integrity": "sha512-+GWtJhC+7UaCUnJ+ZkA7bfGuPd6ZbJKEjbHqh76/gOXsqAUOMEa49ufsLlIPUbkEeQlnDNoTHCegE5X/Q+u+/A==", + "dev": true + }, + "node_modules/@definitelytyped/utils": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/utils/-/utils-0.0.163.tgz", + "integrity": "sha512-6MX5TxaQbG/j2RkCWbcbLvv+YNipKqY0eQJafDhwC/RprUocpg+uYVNlH8XzdKRWOGJ0pq7SZOsJD4C3A01ZXg==", + "dev": true, + "dependencies": { + "@definitelytyped/typescript-versions": "^0.0.163", + "@qiwi/npm-registry-client": "^8.9.1", + "@types/node": "^14.14.35", + "charm": "^1.0.2", + "fs-extra": "^8.1.0", + "fstream": "^1.0.12", + "tar": "^6.1.11", + "tar-stream": "^2.1.4" + } + }, + "node_modules/@definitelytyped/utils/node_modules/@types/node": { + "version": "14.18.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.48.tgz", + "integrity": "sha512-iL0PIMwejpmuVHgfibHpfDwOdsbmB50wr21X71VnF5d7SsBF7WK+ZvP/SCcFm7Iwb9iiYSap9rlrdhToNAWdxg==", + "dev": true + }, + "node_modules/@definitelytyped/utils/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, "node_modules/@dsherret/to-absolute-glob": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", @@ -1085,6 +1264,77 @@ "node": ">= 8" } }, + "node_modules/@qiwi/npm-registry-client": { + "version": "8.9.1", + "resolved": "https://registry.npmjs.org/@qiwi/npm-registry-client/-/npm-registry-client-8.9.1.tgz", + "integrity": "sha512-rZF+mG+NfijR0SHphhTLHRr4aM4gtfdwoAMY6we2VGQam8vkN1cxGG1Lg/Llrj8Dd0Mu6VjdFQRyMMRZxtZR2A==", + "dev": true, + "dependencies": { + "concat-stream": "^2.0.0", + "graceful-fs": "^4.2.4", + "normalize-package-data": "~1.0.1 || ^2.0.0 || ^3.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^8.0.0", + "once": "^1.4.0", + "request": "^2.88.2", + "retry": "^0.12.0", + "safe-buffer": "^5.2.1", + "semver": "2 >=2.2.1 || 3.x || 4 || 5 || 7", + "slide": "^1.1.6", + "ssri": "^8.0.0" + }, + "optionalDependencies": { + "npmlog": "2 || ^3.1.0 || ^4.0.0" + } + }, + "node_modules/@qiwi/npm-registry-client/node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "dev": true, + "engines": [ + "node >= 6.0" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/@qiwi/npm-registry-client/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@qiwi/npm-registry-client/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/@ts-morph/common": { "version": "0.7.5", "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.7.5.tgz", @@ -1179,6 +1429,12 @@ "integrity": "sha512-rUDO6s9Q/El1R1I21HG4qw/LstTHCPO/oQNAwI/4b2f9EWvMnqt4d3HJwPMawfZ3UvodB8516Yg+VAq54YM+eA==", "dev": true }, + "node_modules/@types/parsimmon": { + "version": "1.10.6", + "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.6.tgz", + "integrity": "sha512-FwAQwMRbkhx0J6YELkwIpciVzCcgEqXEbIrIn3a2P5d3kGEHQ3wVhlN3YdVepYP+bZzCYO6OjmD4o9TGOZ40rA==", + "dev": true + }, "node_modules/@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -2046,6 +2302,24 @@ "node": ">=0.10.0" } }, + "node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true, + "optional": true + }, + "node_modules/are-we-there-yet": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", + "dev": true, + "optional": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -2169,8 +2443,6 @@ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "safer-buffer": "~2.1.0" } @@ -2180,8 +2452,6 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=0.8" } @@ -2199,9 +2469,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/autolinker": { "version": "0.28.1", @@ -2229,8 +2497,6 @@ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", "dev": true, - "optional": true, - "peer": true, "engines": { "node": "*" } @@ -2239,9 +2505,7 @@ "version": "1.9.1", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/babel-code-frame": { "version": "6.26.0", @@ -2321,13 +2585,31 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, - "optional": true, - "peer": true, "dependencies": { "tweetnacl": "^0.14.3" } @@ -2342,6 +2624,31 @@ "platform": "^1.3.3" } }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/blueimp-md5": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", @@ -2424,6 +2731,30 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -2439,6 +2770,12 @@ "node": ">=0.10.0" } }, + "node_modules/builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==", + "dev": true + }, "node_modules/cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -2470,6 +2807,15 @@ "node": ">=6" } }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001481", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", @@ -2494,9 +2840,7 @@ "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/chai": { "version": "4.3.7", @@ -2530,6 +2874,15 @@ "node": ">=4" } }, + "node_modules/charm": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/charm/-/charm-1.0.2.tgz", + "integrity": "sha512-wqW3VdPnlSWT4eRiYX+hcs+C6ViBPUWk1qTCd+37qw9kEm/a5n2qcyQDMBWvSYKN/ctqZzeXNQaeBjOetJJUkw==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1" + } + }, "node_modules/check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -2539,22 +2892,75 @@ "node": "*" } }, - "node_modules/code-block-writer": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", - "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", - "dev": true - }, - "node_modules/coffee-script": { - "version": "1.12.7", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", - "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", - "deprecated": "CoffeeScript on NPM has moved to \"coffeescript\" (no hyphen)", + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", "dev": true, - "bin": { - "cake": "bin/cake", - "coffee": "bin/coffee" - }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/code-block-writer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", + "dev": true + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "deprecated": "CoffeeScript on NPM has moved to \"coffeescript\" (no hyphen)", + "dev": true, + "bin": { + "cake": "bin/cake", + "coffee": "bin/coffee" + }, "engines": { "node": ">=0.8.0" } @@ -2579,8 +2985,6 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -2588,6 +2992,12 @@ "node": ">= 0.8" } }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -2658,6 +3068,13 @@ "node": ">=10" } }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true, + "optional": true + }, "node_modules/convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", @@ -2708,8 +3125,6 @@ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, - "optional": true, - "peer": true, "dependencies": { "assert-plus": "^1.0.0" }, @@ -2742,6 +3157,15 @@ "node": ">=6" } }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/deep-eql": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", @@ -2781,12 +3205,17 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=0.4.0" } }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "dev": true, + "optional": true + }, "node_modules/diacritics-map": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/diacritics-map/-/diacritics-map-0.1.0.tgz", @@ -2913,86 +3342,11 @@ "webidl-conversions": "^4.0.2" } }, - "node_modules/dtslint": { - "version": "0.4.4", - "resolved": "git+ssh://git@github.com/gcanti/dtslint.git#1558adbeda424fec83a8d314784c18728a970cd4", - "dev": true, - "license": "MIT", - "dependencies": { - "fs-extra": "^6.0.1", - "parsimmon": "^1.12.0", - "strip-json-comments": "^2.0.1", - "tslint": "^5.12.0", - "typescript": "^4.6.2" - }, - "bin": { - "dtslint": "bin/index.js" - }, - "engines": { - "node": ">=6.10.0" - } - }, - "node_modules/dtslint/node_modules/fs-extra": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", - "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "node_modules/dtslint/node_modules/tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - }, - "bin": { - "tslint": "bin/tslint" - }, - "engines": { - "node": ">=4.8.0" - }, - "peerDependencies": { - "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" - } - }, - "node_modules/dtslint/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, - "optional": true, - "peer": true, "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -3004,6 +3358,21 @@ "integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung==", "dev": true }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/es-abstract": { "version": "1.21.2", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", @@ -4244,9 +4613,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/extend-shallow": { "version": "2.0.1", @@ -4267,9 +4634,7 @@ "dev": true, "engines": [ "node >=0.6.0" - ], - "optional": true, - "peer": true + ] }, "node_modules/fast-check": { "version": "1.26.0", @@ -4371,6 +4736,19 @@ "node": ">=0.10.0" } }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -4428,8 +4806,6 @@ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", "dev": true, - "optional": true, - "peer": true, "engines": { "node": "*" } @@ -4439,8 +4815,6 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -4455,6 +4829,12 @@ "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.14.0.tgz", "integrity": "sha512-QLagLSYAgMA00pZzUzeksH/78Sd14y7+Gc2A8Yaja3/IpGOFMdm/gYBuDMxYqLsJ58iT5lz+bJb953RAeFfp1A==" }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, "node_modules/fs-extra": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", @@ -4469,6 +4849,18 @@ "node": ">=6 <7 || >=8" } }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4489,6 +4881,21 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "engines": { + "node": ">=0.6" + } + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -4522,6 +4929,46 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==", + "dev": true, + "optional": true, + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/gauge/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "optional": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -4531,6 +4978,15 @@ "node": ">=6.9.0" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", @@ -4575,8 +5031,6 @@ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, - "optional": true, - "peer": true, "dependencies": { "assert-plus": "^1.0.0" } @@ -4682,9 +5136,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, "node_modules/grapheme-splitter": { @@ -4735,8 +5189,6 @@ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=4" } @@ -4747,8 +5199,6 @@ "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "deprecated": "this library is no longer supported", "dev": true, - "optional": true, - "peer": true, "dependencies": { "ajv": "^6.5.5", "har-schema": "^2.0.0" @@ -4859,6 +5309,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true, + "optional": true + }, "node_modules/he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -4868,6 +5325,18 @@ "he": "bin/he" } }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/html-encoding-sniffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", @@ -4890,8 +5359,6 @@ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, - "optional": true, - "peer": true, "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -4916,6 +5383,26 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -5208,6 +5695,19 @@ "node": ">=0.10.0" } }, + "node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "optional": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -5391,9 +5891,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/is-unc-path": { "version": "1.0.0", @@ -5456,9 +5954,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", @@ -5589,9 +6085,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/jsdom": { "version": "15.2.1", @@ -5656,9 +6150,7 @@ "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -5666,6 +6158,18 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/json-stable-stringify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.2.tgz", + "integrity": "sha512-eunSSaEnxV12z+Z73y/j5N37/In40GK4GmsSy+tEHJMxknvqnA7/djeYtAgW0GsWHUfg+847WJjKaEylk2y09g==", + "dev": true, + "dependencies": { + "jsonify": "^0.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -5676,9 +6180,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/json5": { "version": "2.2.3", @@ -5707,6 +6209,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -5715,8 +6226,6 @@ "engines": [ "node >=0.6.0" ], - "optional": true, - "peer": true, "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -5790,6 +6299,18 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", @@ -5987,8 +6508,6 @@ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">= 0.6" } @@ -5998,8 +6517,6 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "mime-db": "1.43.0" }, @@ -6020,10 +6537,38 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } }, "node_modules/mixin-deep": { "version": "1.3.2", @@ -6051,12 +6596,12 @@ } }, "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "dependencies": { - "minimist": "^1.2.5" + "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" @@ -6245,6 +6790,88 @@ "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", "dev": true }, + "node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-package-arg": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz", + "integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "semver": "^7.3.4", + "validate-npm-package-name": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-package-arg/node_modules/semver": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "optional": true, + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/nwsapi": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", @@ -6258,12 +6885,20 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": "*" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", @@ -6366,6 +7001,42 @@ "node": ">= 0.8.0" } }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -6444,9 +7115,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/picocolors": { "version": "1.0.0", @@ -6555,9 +7224,7 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/punycode": { "version": "2.1.1", @@ -6579,8 +7246,6 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=0.6" } @@ -6709,8 +7374,6 @@ "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", "dev": true, - "optional": true, - "peer": true, "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -6794,8 +7457,6 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -6804,6 +7465,21 @@ "node": ">=0.8" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -6821,6 +7497,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -6905,9 +7590,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/saxes": { "version": "3.1.11", @@ -6932,6 +7615,12 @@ "semver": "bin/semver" } }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true + }, "node_modules/set-getter": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", @@ -6964,6 +7653,13 @@ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "optional": true + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -6973,6 +7669,15 @@ "node": ">=8" } }, + "node_modules/slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -7001,6 +7706,38 @@ "source-map": "^0.6.0" } }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz", + "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==", + "dev": true + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -7012,8 +7749,6 @@ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -7034,6 +7769,18 @@ "node": ">=0.10.0" } }, + "node_modules/ssri": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "dev": true, + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", @@ -7066,6 +7813,44 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "optional": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "optional": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/string.prototype.trim": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", @@ -7135,7 +7920,7 @@ "node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "dev": true, "engines": { "node": ">=0.10.0" @@ -7197,15 +7982,83 @@ "optional": true, "peer": true }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "node_modules/tar": { + "version": "6.1.15", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", + "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", "dev": true, "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" }, "engines": { "node": ">=8" @@ -7260,6 +8113,33 @@ "node": ">=14.0.0" } }, + "node_modules/tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "dependencies": { + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=8.17.0" + } + }, + "node_modules/tmp/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -7395,15 +8275,6 @@ "json5": "lib/cli.js" } }, - "node_modules/tsconfig-paths/node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/tsconfig-paths/node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -7474,8 +8345,6 @@ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, - "optional": true, - "peer": true, "dependencies": { "safe-buffer": "^5.0.1" }, @@ -7487,9 +8356,7 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/type-check": { "version": "0.3.2", @@ -7535,16 +8402,16 @@ "dev": true }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", + "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=14.17" } }, "node_modules/ufo": { @@ -7637,12 +8504,29 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, - "optional": true, - "peer": true, "bin": { "uuid": "bin/uuid" } }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==", + "dev": true, + "dependencies": { + "builtins": "^1.0.3" + } + }, "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -7651,8 +8535,6 @@ "engines": [ "node >=0.6.0" ], - "optional": true, - "peer": true, "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -8077,6 +8959,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "dev": true + }, "node_modules/which-typed-array": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", @@ -8113,6 +9001,16 @@ "node": ">=8" } }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "optional": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -8122,6 +9020,76 @@ "node": ">=0.10.0" } }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -8176,12 +9144,76 @@ "node": ">=0.4" } }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", @@ -8495,6 +9527,152 @@ "to-fast-properties": "^2.0.0" } }, + "@definitelytyped/dts-critic": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/dts-critic/-/dts-critic-0.0.163.tgz", + "integrity": "sha512-HsTvylj8x2gQaawsOCcN2Xk2Cx0wgV9kaj83hgsO9SITZSPd7dA0UkHyNRadbMkMwqNDKcnizcmWdz0+0gIo8A==", + "dev": true, + "requires": { + "@definitelytyped/header-parser": "^0.0.163", + "command-exists": "^1.2.8", + "rimraf": "^3.0.2", + "semver": "^6.2.0", + "tmp": "^0.2.1", + "yargs": "^15.3.1" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@definitelytyped/dtslint": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/dtslint/-/dtslint-0.0.163.tgz", + "integrity": "sha512-U0uw7Zu0QdYSuBMYgxvRYjkhkeulTEg8vDgJ7TiYQUv/wODeujSAmGahQn51E5hOlSMYUw7A9utdbUukxE02SQ==", + "dev": true, + "requires": { + "@definitelytyped/dts-critic": "^0.0.163", + "@definitelytyped/header-parser": "^0.0.163", + "@definitelytyped/typescript-versions": "^0.0.163", + "@definitelytyped/utils": "^0.0.163", + "@typescript-eslint/eslint-plugin": "^5.55.0", + "@typescript-eslint/parser": "^5.55.0", + "@typescript-eslint/types": "^5.56.0", + "@typescript-eslint/typescript-estree": "^5.55.0", + "@typescript-eslint/utils": "^5.55.0", + "eslint": "^8.17.0", + "fs-extra": "^6.0.1", + "json-stable-stringify": "^1.0.1", + "strip-json-comments": "^2.0.1", + "tslint": "5.14.0", + "yargs": "^15.1.0" + }, + "dependencies": { + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "fs-extra": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", + "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "tslint": { + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.14.0.tgz", + "integrity": "sha512-IUla/ieHVnB8Le7LdQFRGlVJid2T/gaJe5VkjzRVSRR6pA2ODYrnfR1hmxi+5+au9l50jBwpbBL34txgv4NnTQ==", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + } + } + }, + "@definitelytyped/header-parser": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.163.tgz", + "integrity": "sha512-Jr+/q+ESfc7uWldz/j11BfpjIN/gB4WmwhFENhWaMwM0W/9p0ShF+OiUqGhk2Q3Iz8v/oyWzSsxyxgasg9kCxQ==", + "dev": true, + "requires": { + "@definitelytyped/typescript-versions": "^0.0.163", + "@types/parsimmon": "^1.10.1", + "parsimmon": "^1.13.0" + } + }, + "@definitelytyped/typescript-versions": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/typescript-versions/-/typescript-versions-0.0.163.tgz", + "integrity": "sha512-+GWtJhC+7UaCUnJ+ZkA7bfGuPd6ZbJKEjbHqh76/gOXsqAUOMEa49ufsLlIPUbkEeQlnDNoTHCegE5X/Q+u+/A==", + "dev": true + }, + "@definitelytyped/utils": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@definitelytyped/utils/-/utils-0.0.163.tgz", + "integrity": "sha512-6MX5TxaQbG/j2RkCWbcbLvv+YNipKqY0eQJafDhwC/RprUocpg+uYVNlH8XzdKRWOGJ0pq7SZOsJD4C3A01ZXg==", + "dev": true, + "requires": { + "@definitelytyped/typescript-versions": "^0.0.163", + "@qiwi/npm-registry-client": "^8.9.1", + "@types/node": "^14.14.35", + "charm": "^1.0.2", + "fs-extra": "^8.1.0", + "fstream": "^1.0.12", + "tar": "^6.1.11", + "tar-stream": "^2.1.4" + }, + "dependencies": { + "@types/node": { + "version": "14.18.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.48.tgz", + "integrity": "sha512-iL0PIMwejpmuVHgfibHpfDwOdsbmB50wr21X71VnF5d7SsBF7WK+ZvP/SCcFm7Iwb9iiYSap9rlrdhToNAWdxg==", + "dev": true + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } + } + }, "@dsherret/to-absolute-glob": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", @@ -8887,6 +10065,57 @@ "fastq": "^1.6.0" } }, + "@qiwi/npm-registry-client": { + "version": "8.9.1", + "resolved": "https://registry.npmjs.org/@qiwi/npm-registry-client/-/npm-registry-client-8.9.1.tgz", + "integrity": "sha512-rZF+mG+NfijR0SHphhTLHRr4aM4gtfdwoAMY6we2VGQam8vkN1cxGG1Lg/Llrj8Dd0Mu6VjdFQRyMMRZxtZR2A==", + "dev": true, + "requires": { + "concat-stream": "^2.0.0", + "graceful-fs": "^4.2.4", + "normalize-package-data": "~1.0.1 || ^2.0.0 || ^3.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^8.0.0", + "npmlog": "2 || ^3.1.0 || ^4.0.0", + "once": "^1.4.0", + "request": "^2.88.2", + "retry": "^0.12.0", + "safe-buffer": "^5.2.1", + "semver": "2 >=2.2.1 || 3.x || 4 || 5 || 7", + "slide": "^1.1.6", + "ssri": "^8.0.0" + }, + "dependencies": { + "concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, "@ts-morph/common": { "version": "0.7.5", "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.7.5.tgz", @@ -8970,6 +10199,12 @@ "integrity": "sha512-rUDO6s9Q/El1R1I21HG4qw/LstTHCPO/oQNAwI/4b2f9EWvMnqt4d3HJwPMawfZ3UvodB8516Yg+VAq54YM+eA==", "dev": true }, + "@types/parsimmon": { + "version": "1.10.6", + "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.6.tgz", + "integrity": "sha512-FwAQwMRbkhx0J6YELkwIpciVzCcgEqXEbIrIn3a2P5d3kGEHQ3wVhlN3YdVepYP+bZzCYO6OjmD4o9TGOZ40rA==", + "dev": true + }, "@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -9536,6 +10771,24 @@ "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -9629,8 +10882,6 @@ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true, - "optional": true, - "peer": true, "requires": { "safer-buffer": "~2.1.0" } @@ -9639,9 +10890,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "assertion-error": { "version": "1.1.0", @@ -9653,9 +10902,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "autolinker": { "version": "0.28.1", @@ -9676,17 +10923,13 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "aws4": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "babel-code-frame": { "version": "6.26.0", @@ -9753,13 +10996,17 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, - "optional": true, - "peer": true, "requires": { "tweetnacl": "^0.14.3" } @@ -9774,6 +11021,30 @@ "platform": "^1.3.3" } }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "blueimp-md5": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", @@ -9836,6 +11107,16 @@ "update-browserslist-db": "^1.0.10" } }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -9848,6 +11129,12 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==", + "dev": true + }, "cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -9870,6 +11157,12 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, "caniuse-lite": { "version": "1.0.30001481", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", @@ -9880,9 +11173,7 @@ "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "chai": { "version": "4.3.7", @@ -9910,18 +11201,70 @@ "supports-color": "^5.3.0" } }, + "charm": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/charm/-/charm-1.0.2.tgz", + "integrity": "sha512-wqW3VdPnlSWT4eRiYX+hcs+C6ViBPUWk1qTCd+37qw9kEm/a5n2qcyQDMBWvSYKN/ctqZzeXNQaeBjOetJJUkw==", + "dev": true, + "requires": { + "inherits": "^2.0.1" + } + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", "dev": true }, + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, "code-block-writer": { "version": "10.1.1", "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", "dev": true }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "dev": true, + "optional": true + }, "coffee-script": { "version": "1.12.7", "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", @@ -9948,12 +11291,16 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "optional": true, - "peer": true, "requires": { "delayed-stream": "~1.0.0" } }, + "command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -10014,6 +11361,13 @@ } } }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true, + "optional": true + }, "convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", @@ -10063,8 +11417,6 @@ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, - "optional": true, - "peer": true, "requires": { "assert-plus": "^1.0.0" } @@ -10091,6 +11443,12 @@ "time-zone": "^1.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true + }, "deep-eql": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", @@ -10120,9 +11478,14 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", "dev": true, - "optional": true, - "peer": true + "optional": true }, "diacritics-map": { "version": "0.1.0", @@ -10218,65 +11581,11 @@ "webidl-conversions": "^4.0.2" } }, - "dtslint": { - "version": "git+ssh://git@github.com/gcanti/dtslint.git#1558adbeda424fec83a8d314784c18728a970cd4", - "dev": true, - "from": "dtslint@github:gcanti/dtslint", - "requires": { - "fs-extra": "^6.0.1", - "parsimmon": "^1.12.0", - "strip-json-comments": "^2.0.1", - "tslint": "^5.12.0", - "typescript": "^4.6.2" - }, - "dependencies": { - "fs-extra": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", - "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - } - }, - "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true - } - } - }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, - "optional": true, - "peer": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -10288,6 +11597,21 @@ "integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung==", "dev": true }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "es-abstract": { "version": "1.21.2", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", @@ -11117,9 +12441,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "extend-shallow": { "version": "2.0.1", @@ -11134,9 +12456,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "fast-check": { "version": "1.26.0", @@ -11224,6 +12544,16 @@ "repeat-string": "^1.5.2" } }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, "flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -11270,17 +12600,13 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, - "optional": true, - "peer": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -11292,6 +12618,12 @@ "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.14.0.tgz", "integrity": "sha512-QLagLSYAgMA00pZzUzeksH/78Sd14y7+Gc2A8Yaja3/IpGOFMdm/gYBuDMxYqLsJ58iT5lz+bJb953RAeFfp1A==" }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, "fs-extra": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", @@ -11303,6 +12635,15 @@ "universalify": "^0.1.0" } }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -11316,6 +12657,18 @@ "dev": true, "optional": true }, + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -11340,12 +12693,54 @@ "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==", + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", @@ -11378,8 +12773,6 @@ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, - "optional": true, - "peer": true, "requires": { "assert-plus": "^1.0.0" } @@ -11457,9 +12850,9 @@ } }, "graceful-fs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, "grapheme-splitter": { @@ -11502,17 +12895,13 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "har-validator": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "dev": true, - "optional": true, - "peer": true, "requires": { "ajv": "^6.5.5", "har-schema": "^2.0.0" @@ -11586,12 +12975,28 @@ "has-symbols": "^1.0.2" } }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true, + "optional": true + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha512-z/GDPjlRMNOa2XJiB4em8wJpuuBfrFOlYKTZxtpkdr1uPdibHI8rYA3MY0KDObpVyaes0e/aunid/t88ZI2EKA==", "dev": true }, + "hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, "html-encoding-sniffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", @@ -11614,8 +13019,6 @@ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, - "optional": true, - "peer": true, "requires": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -11633,6 +13036,12 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, "ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -11848,6 +13257,16 @@ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dev": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -11973,9 +13392,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "is-unc-path": { "version": "1.0.0", @@ -12026,9 +13443,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "istanbul-lib-coverage": { "version": "3.2.0", @@ -12134,9 +13549,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "jsdom": { "version": "15.2.1", @@ -12184,9 +13597,7 @@ "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "json-schema-traverse": { "version": "0.4.1", @@ -12194,6 +13605,15 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "json-stable-stringify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.2.tgz", + "integrity": "sha512-eunSSaEnxV12z+Z73y/j5N37/In40GK4GmsSy+tEHJMxknvqnA7/djeYtAgW0GsWHUfg+847WJjKaEylk2y09g==", + "dev": true, + "requires": { + "jsonify": "^0.0.1" + } + }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -12204,9 +13624,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "json5": { "version": "2.2.3", @@ -12229,13 +13647,17 @@ "graceful-fs": "^4.1.6" } }, + "jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "dev": true, - "optional": true, - "peer": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -12291,6 +13713,15 @@ "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", "dev": true }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", @@ -12454,17 +13885,13 @@ "version": "1.43.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "mime-types": { "version": "2.1.26", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", "dev": true, - "optional": true, - "peer": true, "requires": { "mime-db": "1.43.0" } @@ -12479,11 +13906,30 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true }, + "minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + } + }, "mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -12506,12 +13952,12 @@ } }, "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "requires": { - "minimist": "^1.2.5" + "minimist": "^1.2.6" } }, "mlly": { @@ -12645,17 +14091,82 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, + "node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", + "dev": true + }, + "normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "requires": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "npm-package-arg": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz", + "integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==", + "dev": true, + "requires": { + "hosted-git-info": "^4.0.1", + "semver": "^7.3.4", + "validate-npm-package-name": "^3.0.0" + }, + "dependencies": { + "semver": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } }, - "node-releases": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", - "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", - "dev": true + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "dev": true, + "optional": true }, "nwsapi": { "version": "2.2.0", @@ -12669,9 +14180,14 @@ "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "dev": true, - "optional": true, - "peer": true + "optional": true }, "object-inspect": { "version": "1.12.3", @@ -12750,6 +14266,30 @@ "word-wrap": "~1.2.3" } }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -12813,9 +14353,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "picocolors": { "version": "1.0.0", @@ -12889,9 +14427,7 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "punycode": { "version": "2.1.1", @@ -12909,9 +14445,7 @@ "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "queue-microtask": { "version": "1.2.3", @@ -12997,8 +14531,6 @@ "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "dev": true, - "optional": true, - "peer": true, "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -13027,8 +14559,6 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, - "optional": true, - "peer": true, "requires": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -13074,6 +14604,18 @@ } } }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, "resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -13085,6 +14627,12 @@ "supports-preserve-symlinks-flag": "^1.0.0" } }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -13139,9 +14687,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "saxes": { "version": "3.1.11", @@ -13160,6 +14706,12 @@ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true + }, "set-getter": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", @@ -13186,12 +14738,25 @@ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "optional": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -13214,6 +14779,38 @@ "source-map": "^0.6.0" } }, + "spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz", + "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==", + "dev": true + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -13225,8 +14822,6 @@ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "dev": true, - "optional": true, - "peer": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -13239,6 +14834,15 @@ "tweetnacl": "~0.14.0" } }, + "ssri": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "dev": true, + "requires": { + "minipass": "^3.1.1" + } + }, "stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", @@ -13268,6 +14872,37 @@ "safe-buffer": "~5.1.0" } }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dev": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, "string.prototype.trim": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", @@ -13319,7 +14954,7 @@ "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "dev": true }, "strip-literal": { @@ -13362,6 +14997,60 @@ "optional": true, "peer": true }, + "tar": { + "version": "6.1.15", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", + "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", + "dev": true, + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "dependencies": { + "minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + } + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -13413,6 +15102,26 @@ "integrity": "sha512-7eORpyqImoOvkQJCSkL0d0mB4NHHIFAy4b1u8PHdDa7SjGS2njzl6/lyGoZLm+eyYEtlUmFGE0rFj66SWxZgQQ==", "dev": true }, + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.0" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -13520,12 +15229,6 @@ "minimist": "^1.2.0" } }, - "minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true - }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -13582,8 +15285,6 @@ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, - "optional": true, - "peer": true, "requires": { "safe-buffer": "^5.0.1" } @@ -13592,9 +15293,7 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "type-check": { "version": "0.3.2", @@ -13631,9 +15330,9 @@ "dev": true }, "typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", + "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", "dev": true }, "ufo": { @@ -13695,17 +15394,32 @@ "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, - "optional": true, - "peer": true + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, - "optional": true, - "peer": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -13977,6 +15691,12 @@ "is-symbol": "^1.0.3" } }, + "which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "dev": true + }, "which-typed-array": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", @@ -14001,12 +15721,76 @@ "stackback": "0.0.2" } }, + "wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -14044,12 +15828,66 @@ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index 6041cdbb1..c5d5f8ec7 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "postbuild": "prettier --loglevel=silent --write \"./dist/**/*.ts\"", "prepublishOnly": "ts-node scripts/pre-publish", "perf": "ts-node perf/index", - "dtslint": "dtslint dtslint", + "dtslint": "dtslint --expectOnly dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", "doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", "docs": "docs-ts", @@ -43,6 +43,7 @@ "fp-ts": "^2.5.0" }, "devDependencies": { + "@definitelytyped/dtslint": "^0.0.163", "@types/benchmark": "^1.0.31", "@types/glob": "^7.1.3", "@types/node": "^16.18.25", @@ -51,7 +52,6 @@ "@vitest/coverage-istanbul": "^0.23.4", "benchmark": "2.1.4", "docs-ts": "^0.7.2", - "dtslint": "github:gcanti/dtslint", "eslint": "^8.38.0", "eslint-plugin-deprecation": "^1.4.1", "eslint-plugin-import": "^2.27.5", @@ -64,7 +64,7 @@ "rimraf": "2.6.2", "ts-node": "^8.0.2", "tslint": "5.11.0", - "typescript": "^5.0.4", + "typescript": "^5.1.3", "vite": "^4.3.3", "vitest": "^0.30.1" }, diff --git a/tsconfig.json b/tsconfig.json index 155dbcab9..1e3a4b56e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,5 +18,5 @@ "skipLibCheck": true, "types": ["vitest/globals"] }, - "include": ["./src", "./test", "./scripts"] + "include": ["./src", "./test", "./scripts", "./dtslint"] } From 1236c93e2d969b85d5fba909915fe3d3eccd8085 Mon Sep 17 00:00:00 2001 From: Graham Fisher Date: Fri, 1 Dec 2023 13:02:17 -0500 Subject: [PATCH 218/222] "record.is" allows keys outside domain; "record.{en,de}code" allow but strip keys outside domain; optimize "exact.encode" --- src/index.ts | 69 +++++++++++++++++++------------------------ test/2.1.x/helpers.ts | 14 ++++++--- test/2.1.x/record.ts | 63 +++++++++++++++++++++++++++------------ 3 files changed, 84 insertions(+), 62 deletions(-) diff --git a/src/index.ts b/src/index.ts index b2164250c..501de5da9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -330,42 +330,17 @@ function enumerableRecord( name = `{ [K in ${domain.name}]: ${codomain.name} }` ): RecordC { const len = keys.length + const props: Props = {} + for (let i = 0; i < len; i++) { + props[keys[i]] = codomain + } + const exactCodec = exact(type(props, name), name) + return new DictionaryType( name, - (u): u is { [K in TypeOf]: TypeOf } => UnknownRecord.is(u) && keys.every((k) => codomain.is(u[k])), - (u, c) => { - const e = UnknownRecord.validate(u, c) - if (isLeft(e)) { - return e - } - const o = e.right - const a: { [key: string]: any } = {} - const errors: Errors = [] - let changed = false - for (let i = 0; i < len; i++) { - const k = keys[i] - const ok = o[k] - const codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)) - if (isLeft(codomainResult)) { - pushAll(errors, codomainResult.left) - } else { - const vok = codomainResult.right - changed = changed || vok !== ok - a[k] = vok - } - } - return errors.length > 0 ? failures(errors) : success((changed || Object.keys(o).length !== len ? a : o) as any) - }, - codomain.encode === identity - ? identity - : (a: any) => { - const s: { [key: string]: any } = {} - for (let i = 0; i < len; i++) { - const k = keys[i] - s[k] = codomain.encode(a[k]) - } - return s as any - }, + (u): u is { [K in TypeOf]: TypeOf } => exactCodec.is(u), + exactCodec.validate, + exactCodec.encode, domain, codomain ) @@ -389,6 +364,22 @@ export function getDomainKeys(domain: D): Record( domain: D, codomain: C, @@ -398,7 +389,7 @@ function nonEnumerableRecord( name, (u): u is { [K in TypeOf]: TypeOf } => { if (UnknownRecord.is(u)) { - return Object.keys(u).every((k) => domain.is(k) && codomain.is(u[k])) + return Object.keys(u).every((k) => !domain.is(k) || codomain.is(u[k])) } return isAnyC(codomain) && Array.isArray(u) }, @@ -414,7 +405,7 @@ function nonEnumerableRecord( const ok = u[k] const domainResult = domain.validate(k, appendContext(c, k, domain, k)) if (isLeft(domainResult)) { - pushAll(errors, domainResult.left) + changed = true } else { const vk = domainResult.right changed = changed || vk !== k @@ -437,10 +428,10 @@ function nonEnumerableRecord( return failure(u, c) }, domain.encode === identity && codomain.encode === identity - ? identity + ? (a) => stripNonDomainKeys(a, domain) : (a) => { const s: { [key: string]: any } = {} - const keys = Object.keys(a) + const keys = Object.keys(stripNonDomainKeys(a, domain)) const len = keys.length for (let i = 0; i < len; i++) { const k = keys[i] @@ -1970,7 +1961,7 @@ export function exact(codec: C, name: string = getExactTypeN } return right(stripKeys(ce.right, props)) }, - (a) => codec.encode(stripKeys(a, props)), + useIdentity(Object.values(props)) ? (a) => stripKeys(a, props) : (a) => codec.encode(stripKeys(a, props)), codec ) } diff --git a/test/2.1.x/helpers.ts b/test/2.1.x/helpers.ts index e0e205758..2a6caaf1c 100644 --- a/test/2.1.x/helpers.ts +++ b/test/2.1.x/helpers.ts @@ -83,13 +83,19 @@ export const NumberFromString = new t.Type( String ) -export const HyphenatedString = new t.Type( - 'HyphenatedString', - (v): v is string => t.string.is(v) && v.length === 3 && v[1] === '-', +export const HyphenatedString = t.refinement( + t.string, + (v): v is `${string}-${string}` => v.length === 3 && v[1] === '-', + '`${string}-${string}`' +) + +export const HyphenatedStringFromNonHyphenated = new t.Type<`${string}-${string}`, string, unknown>( + 'HyphenatedStringFromNonHyphenated', + HyphenatedString.is, (u, c) => either.chain(t.string.validate(u, c), (s) => { if (s.length === 2) { - return right(s[0] + '-' + s[1]) + return right(`${s[0]}-${s[1]}` as const) } else { return t.failure(s, c) } diff --git a/test/2.1.x/record.ts b/test/2.1.x/record.ts index c479b9f93..cf471e339 100644 --- a/test/2.1.x/record.ts +++ b/test/2.1.x/record.ts @@ -7,6 +7,7 @@ import { assertStrictSuccess, assertSuccess, HyphenatedString, + HyphenatedStringFromNonHyphenated, NumberFromString } from './helpers' @@ -38,6 +39,7 @@ describe.concurrent('record', () => { const T3 = t.record(HyphenatedString, t.number) assert.strictEqual(T3.is({}), true) assert.strictEqual(T3.is({ 'a-a': 1 }), true) + assert.strictEqual(T3.is({ 'a-a': 1, extra: null }), true) }) it('should return `false` on invalid inputs', () => { @@ -54,7 +56,7 @@ describe.concurrent('record', () => { assert.strictEqual(T2.is([]), false) const T3 = t.record(HyphenatedString, t.number) - assert.strictEqual(T3.is({ aa: 1 }), false) + assert.strictEqual(T3.is({ 'a-a': '1' }), false) }) it('should not accept an array if the codomain is `unknown`', () => { @@ -69,7 +71,7 @@ describe.concurrent('record', () => { }) describe.concurrent('decode', () => { - it('should decode a isomorphic value', () => { + it('should decode an isomorphic value', () => { const T = t.record(t.string, t.number) assertSuccess(T.decode({})) assertSuccess(T.decode({ a: 1 })) @@ -88,10 +90,17 @@ describe.concurrent('record', () => { }) it('should decode a prismatic key', () => { - const T = t.record(HyphenatedString, t.number) + const T = t.record(HyphenatedStringFromNonHyphenated, t.number) assertSuccess(T.decode({ ab: 1 }), { 'a-b': 1 }) }) + it('should strip keys outside the domain', () => { + const T1 = t.record(HyphenatedString, t.number) + assertSuccess(T1.decode({ 'a-b': 1, extra: null }), { 'a-b': 1 }) + const T2 = t.record(HyphenatedStringFromNonHyphenated, t.number) + assertSuccess(T2.decode({ ab: 1, extra: null }), { 'a-b': 1 }) + }) + it('should not decode an array if the codomain is `unknown`', () => { const T = t.record(t.string, t.unknown) assertFailure(T, [1], ['Invalid value [1] supplied to : { [K in string]: unknown }']) @@ -111,19 +120,19 @@ describe.concurrent('record', () => { // #407 assertFailure(T1, [1], ['Invalid value [1] supplied to : { [K in string]: number }']) const T2 = t.record(HyphenatedString, t.number) - assertFailure(T2, { a: 1 }, [ - 'Invalid value "a" supplied to : { [K in HyphenatedString]: number }/a: HyphenatedString' + assertFailure(T2, { a: 1, 'a-a': '2' }, [ + 'Invalid value "2" supplied to : { [K in `${string}-${string}`]: number }/a-a: number' ]) }) }) describe.concurrent('encode', () => { - it('should encode a isomorphic value', () => { + it('should encode an isomorphic value', () => { const T = t.record(t.string, t.number) assert.deepStrictEqual(T.encode({ a: 1 }), { a: 1 }) }) - it('should return the same reference while decoding a isomorphic value', () => { + it('should return the same reference while decoding an isomorphic value', () => { const T = t.record(t.string, t.number) const a = { a: 1 } assert.strictEqual(T.encode(a), a) @@ -135,10 +144,19 @@ describe.concurrent('record', () => { }) it('should encode a prismatic key', () => { - const T = t.record(HyphenatedString, t.number) + const T = t.record(HyphenatedStringFromNonHyphenated, t.number) assert.deepStrictEqual(T.encode({ 'a-b': 1 }), { ab: 1 }) }) + it('should strip keys outside the domain', () => { + const T1 = t.record(HyphenatedString, t.number) + const withExtra1 = { 'a-b': 1, extra: null } + assert.deepStrictEqual(T1.encode(withExtra1), { 'a-b': 1 }) + const T2 = t.record(HyphenatedStringFromNonHyphenated, t.number) + const withExtra2 = { 'a-b': 1, extra: null } + assert.deepStrictEqual(T2.encode(withExtra2), { ab: 1 }) + }) + it('should accept an array if the codomain is `any`', () => { const T = t.record(t.string, t.any) const a = [1] @@ -150,19 +168,15 @@ describe.concurrent('record', () => { const T1 = t.record(t.string, t.number) const value1 = { aa: 1 } assertStrictEqual(T1.decode(value1), value1) - const T2 = t.record( - t.refinement(t.string, (s) => s.length >= 2), - t.number - ) - const value2 = { aa: 1 } + const T2 = t.record(HyphenatedString, t.number) + const value2 = { 'a-a': 1 } assertStrictEqual(T2.decode(value2), value2) }) it('should return the same reference while encoding', () => { - const T1 = t.record(t.string, t.number) - assert.strictEqual(T1.encode, t.identity) - const T2 = t.record(HyphenatedString, t.number) - assert.strictEqual(T2.encode === t.identity, false) + const T = t.record(t.string, t.number) + const value = { a: 1 } + assert.strictEqual(T.encode(value), value) }) }) @@ -243,15 +257,20 @@ describe.concurrent('record', () => { 'Invalid value undefined supplied to : ({ [K in "a"]: string } & { [K in string]: unknown })/0: { [K in "a"]: string }/a: string' ]) }) + + it('should decode a prismatic value', () => { + const T = t.record(t.literal('a'), NumberFromString) + assertSuccess(T.decode({ a: '1' }), { a: 1 }) + }) }) describe.concurrent('encode', () => { - it('should encode a isomorphic value', () => { + it('should encode an isomorphic value', () => { const T = t.record(t.literal('a'), t.number) assert.deepStrictEqual(T.encode({ a: 1 }), { a: 1 }) }) - it('should return the same reference while decoding a isomorphic value', () => { + it('should return the same reference while decoding an isomorphic value', () => { const T = t.record(t.literal('a'), t.number) const a = { a: 1 } assert.strictEqual(T.encode(a), a) @@ -261,6 +280,12 @@ describe.concurrent('record', () => { const T = t.record(t.literal('a'), NumberFromString) assert.deepStrictEqual(T.encode({ a: 1 }), { a: '1' }) }) + + it('should strip keys outside the domain', () => { + const T = t.record(t.literal('a'), t.number) + const withExtra = { a: 1, extra: null } + assert.deepEqual(T.encode(withExtra), { a: 1 }) + }) }) }) }) From 90a3d04b20844d7487a385be80f84a785f7eb704 Mon Sep 17 00:00:00 2001 From: Graham Fisher Date: Fri, 1 Dec 2023 13:11:06 -0500 Subject: [PATCH 219/222] revert redundant exact optimization (already handled by 'type') --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 501de5da9..4bcd5ed34 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1961,7 +1961,7 @@ export function exact(codec: C, name: string = getExactTypeN } return right(stripKeys(ce.right, props)) }, - useIdentity(Object.values(props)) ? (a) => stripKeys(a, props) : (a) => codec.encode(stripKeys(a, props)), + (a) => codec.encode(stripKeys(a, props)), codec ) } From 4abb81c03bbab6d488cdef25280e85f0c9a6d9e1 Mon Sep 17 00:00:00 2001 From: Graham Fisher Date: Sun, 3 Dec 2023 12:02:47 -0500 Subject: [PATCH 220/222] exact . type -> strict; ignore '.DS_Store' --- .gitignore | 1 + src/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 75c9cc260..61a704309 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules dev coverage declaration/out/src +.DS_Store diff --git a/src/index.ts b/src/index.ts index 4bcd5ed34..570257de6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -334,7 +334,7 @@ function enumerableRecord( for (let i = 0; i < len; i++) { props[keys[i]] = codomain } - const exactCodec = exact(type(props, name), name) + const exactCodec = strict(props, name) return new DictionaryType( name, From 0a0b0c3a4e8f88b00a4825586fb661ceef58e659 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sun, 3 Dec 2023 19:09:43 +0100 Subject: [PATCH 221/222] version 2.2.21 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fce0de42a..bfe46f091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.21 + +- **Bug Fix** + - Handle `record` keys outside `domain`, #705 (@tgfisher4) + # 2.2.20 - undeprecate `FunctionType`, `FunctionC`, `Function` diff --git a/package.json b/package.json index c5d5f8ec7..265d1034f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.20", + "version": "2.2.21", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", From b026dc4767b836b52cf04caf34dcd45cb0b0be34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 21:24:43 +0000 Subject: [PATCH 222/222] Bump ws from 7.2.3 to 7.5.10 Bumps [ws](https://github.com/websockets/ws) from 7.2.3 to 7.5.10. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.2.3...7.5.10) --- updated-dependencies: - dependency-name: ws dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 874a36cfb..5ae24d148 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "io-ts", - "version": "2.2.20", + "version": "2.2.21", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "io-ts", - "version": "2.2.20", + "version": "2.2.21", "license": "MIT", "devDependencies": { "@definitelytyped/dtslint": "^0.0.163", @@ -9097,9 +9097,9 @@ "dev": true }, "node_modules/ws": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", - "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, "optional": true, "peer": true, @@ -15798,9 +15798,9 @@ "dev": true }, "ws": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", - "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, "optional": true, "peer": true,

>>( properties: P ) => Kleisli }, E, Partial<{ [K in keyof P]: TypeOf }>> { const traverse = traverseRecordWithIndex(M) const undefinedProperty = M.of>(E.right(undefined)) const skipProperty = M.of>(E.left(undefined)) - return (onKeyError) => (properties) => ({ + return (onPropertyError) => (properties) => ({ decode: (i) => M.map( - traverse(properties as Record>, (k, decoder) => { - const ik = i[k] - if (ik === undefined) { - return k in i + traverse(properties as Record>, (key, decoder) => { + const ikey = i[key] + if (ikey === undefined) { + return key in i ? // don't strip undefined properties undefinedProperty : // don't add missing properties skipProperty } return M.bimap( - decoder.decode(ik), - (e) => onKeyError(k, e), + decoder.decode(ikey), + (e) => onPropertyError(key, e), (a) => E.right(a) ) }), From ac43c19ad761867b285cca3d8e12c336f7e31910 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 26 Jun 2020 14:57:22 +0200 Subject: [PATCH 093/222] remove `NaN` from `number` instances --- CHANGELOG.md | 25 +++++++++++++------------ docs/modules/Guard.ts.md | 2 ++ src/Guard.ts | 4 +++- src/Type.ts | 13 ++++++++++++- test/Decoder.ts | 12 +++++++++--- test/Guard.ts | 6 ++++++ test/Type.ts | 26 ++++++++++++++++---------- 7 files changed, 61 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52fb13274..9e4d689e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,22 +23,23 @@ - add `Kleisli` module (@gcanti) - add `KleisliDecoder` module (@gcanti) - add `KleisliTaskDecoder` module (@gcanti) - - (**bc**) remove `Tree` module (@gcanti) - - (**bc**) make `Json` type immutable (@gcanti) + - (\*) remove `NaN` from `number` instances (@gcanti) + - (\*) remove `Tree` module (@gcanti) + - (\*) make `Json` type immutable (@gcanti) - `Decoder` - - (**bc**) remove `never` (@gcanti) - - (**bc**) make `parse` pipeable and change its `parser` argument (@gcanti) - - (**bc**) change `DecoderError` (@gcanti) - - (**bc**) remove `withExpected` in favour of `mapLeftWithInput` (@gcanti) + - (\*) remove `never` (@gcanti) + - (\*) make `parse` pipeable and change its `parser` argument (@gcanti) + - (\*) change `DecoderError` (@gcanti) + - (\*) remove `withExpected` in favour of `mapLeftWithInput` (@gcanti) - `Guard` - - (**bc**) remove `never` (@gcanti) + - (\*) remove `never` (@gcanti) - `Schemable` - - (**bc**) better `literal` signature (@gcanti) - - (**bc**) better `union` signature (@gcanti) - - (**bc**) make intersections pipeables (@gcanti) - - (**bc**) make refinements pipeables (@gcanti) + - (\*) better `literal` signature (@gcanti) + - (\*) better `union` signature (@gcanti) + - (\*) make intersections pipeables (@gcanti) + - (\*) make refinements pipeables (@gcanti) -**bc** means "breaking change" +(\*) breaking change # 2.2.6 diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index c7356afd4..bc422e10d 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -256,6 +256,8 @@ Added in v2.2.0 ## number +Note: `NaN` is excluded. + **Signature** ```ts diff --git a/src/Guard.ts b/src/Guard.ts index e40e5d34b..8babe5d24 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -50,11 +50,13 @@ export const string: Guard = { } /** + * Note: `NaN` is excluded. + * * @category primitives * @since 2.2.0 */ export const number: Guard = { - is: (u: unknown): u is number => typeof u === 'number' + is: (u: unknown): u is number => typeof u === 'number' && !isNaN(u) } /** diff --git a/src/Type.ts b/src/Type.ts index 9542d1d9a..7c4146d3f 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -3,6 +3,8 @@ */ import * as t from './index' import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable' +import * as E from 'fp-ts/lib/Either' +import { pipe } from 'fp-ts/lib/pipeable' // ------------------------------------------------------------------------------------- // model @@ -39,7 +41,16 @@ export const string: Type = t.string * @category primitives * @since 2.2.3 */ -export const number: Type = t.number +export const number: Type = new t.Type( + t.number.name, + t.number.is, + (u, c) => + pipe( + t.number.decode(u), + E.chain((n) => (isNaN(n) ? t.failure(u, c) : t.success(n))) + ), + t.number.encode +) /** * @category primitives diff --git a/test/Decoder.ts b/test/Decoder.ts index 08065290c..5c341aaf2 100644 --- a/test/Decoder.ts +++ b/test/Decoder.ts @@ -63,9 +63,15 @@ describe('Decoder', () => { assert.deepStrictEqual(_.string.decode(null), E.left(FS.of(DE.leaf(null, 'string')))) }) - it('number', async () => { - assert.deepStrictEqual(_.number.decode(1), _.success(1)) - assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) + describe('number', () => { + it('number', async () => { + assert.deepStrictEqual(_.number.decode(1), _.success(1)) + assert.deepStrictEqual(_.number.decode(null), E.left(FS.of(DE.leaf(null, 'number')))) + }) + + it('should exclude NaN', () => { + assert.deepStrictEqual(_.number.decode(NaN), E.left(FS.of(DE.leaf(NaN, 'number')))) + }) }) it('boolean', async () => { diff --git a/test/Guard.ts b/test/Guard.ts index ad5c6f91f..7ac30f6a3 100644 --- a/test/Guard.ts +++ b/test/Guard.ts @@ -3,6 +3,12 @@ import * as G from '../src/Guard' import { pipe } from 'fp-ts/lib/pipeable' describe('Guard', () => { + describe('number', () => { + it('should exclude NaN', () => { + assert.deepStrictEqual(G.number.is(NaN), false) + }) + }) + describe('refine', () => { it('should accepts valid inputs', () => { const guard = pipe( diff --git a/test/Type.ts b/test/Type.ts index 81f58e17d..a2feb4f74 100644 --- a/test/Type.ts +++ b/test/Type.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as fc from 'fast-check' -import { isRight } from 'fp-ts/lib/Either' +import { isRight, isLeft } from 'fp-ts/lib/Either' import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' import * as t from '../src' import * as D from '../src/Decoder' @@ -14,7 +14,7 @@ import { WithUnknownContainers, WithUnknownContainers1 } from '../src/Schemable' -import * as T from '../src/Type' +import * as _ from '../src/Type' import * as A from './Arbitrary' import { pipe } from 'fp-ts/lib/pipeable' @@ -36,7 +36,7 @@ function check(schema: Schema, type: t.Type): void { const arb = interpreter(A.schemableArbitrary)(schema) const decoder = interpreter(D.schemableDecoder)(schema) const guard = interpreter(G.schemableGuard)(schema) - const itype = interpreter(T.schemableType)(schema) + const itype = interpreter(_.schemableType)(schema) // decoder and type should be aligned fc.assert(fc.property(arb, (a) => isRight(decoder.decode(a)) === isRight(type.decode(a)))) // interpreted type and type should be aligned @@ -53,11 +53,17 @@ describe('Type', () => { ) }) - it('number', () => { - check( - make((S) => S.number), - t.number - ) + describe('number', () => { + it('number', () => { + check( + make((S) => S.number), + t.number + ) + }) + + it('should exclude NaN', () => { + assert.deepStrictEqual(isLeft(_.number.decode(NaN)), true) + }) }) it('boolean', () => { @@ -198,8 +204,8 @@ describe('Type', () => { } type NonEmptyString = string & NonEmptyStringBrand const type = pipe( - T.string, - T.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') + _.string, + _.refine((s): s is NonEmptyString => s.length > 0, 'NonEmptyString') ) assert.deepStrictEqual(isRight(type.decode('a')), true) assert.deepStrictEqual(isRight(type.decode('')), false) From 12f4dc1f4f025b1266c47f4e8b8b7693a65138f8 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 26 Jun 2020 15:18:50 +0200 Subject: [PATCH 094/222] add disclaimers --- docs/modules/Codec.ts.md | 7 +++++++ docs/modules/DecodeError.ts.md | 7 +++++++ docs/modules/Decoder.ts.md | 7 +++++++ docs/modules/Encoder.ts.md | 7 +++++++ docs/modules/Eq.ts.md | 7 +++++++ docs/modules/FreeSemigroup.ts.md | 7 +++++++ docs/modules/Guard.ts.md | 7 +++++++ docs/modules/JsonCodec.ts.md | 7 +++++++ docs/modules/JsonEncoder.ts.md | 7 +++++++ docs/modules/Kleisli.ts.md | 7 +++++++ docs/modules/KleisliDecoder.ts.md | 7 +++++++ docs/modules/KleisliTaskDecoder.ts.md | 7 +++++++ docs/modules/Schema.ts.md | 7 +++++++ docs/modules/Schemable.ts.md | 7 +++++++ docs/modules/TaskDecoder.ts.md | 7 +++++++ docs/modules/Type.ts.md | 7 +++++++ src/Codec.ts | 7 +++++++ src/DecodeError.ts | 7 +++++++ src/Decoder.ts | 7 +++++++ src/Encoder.ts | 7 +++++++ src/Eq.ts | 7 +++++++ src/FreeSemigroup.ts | 7 +++++++ src/Guard.ts | 7 +++++++ src/JsonCodec.ts | 7 +++++++ src/JsonEncoder.ts | 7 +++++++ src/Kleisli.ts | 7 +++++++ src/KleisliDecoder.ts | 7 +++++++ src/KleisliTaskDecoder.ts | 7 +++++++ src/Schema.ts | 7 +++++++ src/Schemable.ts | 7 +++++++ src/TaskDecoder.ts | 7 +++++++ src/Type.ts | 7 +++++++ 32 files changed, 224 insertions(+) diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 3e560224e..5f350bb09 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Codec overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.3 --- diff --git a/docs/modules/DecodeError.ts.md b/docs/modules/DecodeError.ts.md index f01519543..a104745bd 100644 --- a/docs/modules/DecodeError.ts.md +++ b/docs/modules/DecodeError.ts.md @@ -6,6 +6,13 @@ parent: Modules ## DecodeError overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.7 --- diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index dd4feef41..5609eefe0 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Decoder overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.7 --- diff --git a/docs/modules/Encoder.ts.md b/docs/modules/Encoder.ts.md index 56862667a..b11c0fd2b 100644 --- a/docs/modules/Encoder.ts.md +++ b/docs/modules/Encoder.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Encoder overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.3 --- diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index ecaf8b042..e412b3ef3 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Eq overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.2 --- diff --git a/docs/modules/FreeSemigroup.ts.md b/docs/modules/FreeSemigroup.ts.md index 54ce8453f..a78ec8d48 100644 --- a/docs/modules/FreeSemigroup.ts.md +++ b/docs/modules/FreeSemigroup.ts.md @@ -6,6 +6,13 @@ parent: Modules ## FreeSemigroup overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.7 --- diff --git a/docs/modules/Guard.ts.md b/docs/modules/Guard.ts.md index bc422e10d..cb7257bd5 100644 --- a/docs/modules/Guard.ts.md +++ b/docs/modules/Guard.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Guard overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.0 --- diff --git a/docs/modules/JsonCodec.ts.md b/docs/modules/JsonCodec.ts.md index c33626066..76911b252 100644 --- a/docs/modules/JsonCodec.ts.md +++ b/docs/modules/JsonCodec.ts.md @@ -6,6 +6,13 @@ parent: Modules ## JsonCodec overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.3 --- diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 4b9c8b0bb..351e31155 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -6,6 +6,13 @@ parent: Modules ## JsonEncoder overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.3 --- diff --git a/docs/modules/Kleisli.ts.md b/docs/modules/Kleisli.ts.md index c6aa9e7c7..f0be368fa 100644 --- a/docs/modules/Kleisli.ts.md +++ b/docs/modules/Kleisli.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Kleisli overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.7 --- diff --git a/docs/modules/KleisliDecoder.ts.md b/docs/modules/KleisliDecoder.ts.md index 7fe4084cf..79c37cb1d 100644 --- a/docs/modules/KleisliDecoder.ts.md +++ b/docs/modules/KleisliDecoder.ts.md @@ -6,6 +6,13 @@ parent: Modules ## KleisliDecoder overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.7 --- diff --git a/docs/modules/KleisliTaskDecoder.ts.md b/docs/modules/KleisliTaskDecoder.ts.md index d61492c68..bc061d44e 100644 --- a/docs/modules/KleisliTaskDecoder.ts.md +++ b/docs/modules/KleisliTaskDecoder.ts.md @@ -6,6 +6,13 @@ parent: Modules ## KleisliTaskDecoder overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.7 --- diff --git a/docs/modules/Schema.ts.md b/docs/modules/Schema.ts.md index e2d7f3a3e..5ebcd5a7a 100644 --- a/docs/modules/Schema.ts.md +++ b/docs/modules/Schema.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Schema overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.0 --- diff --git a/docs/modules/Schemable.ts.md b/docs/modules/Schemable.ts.md index 11dbe1e88..6e4d7664b 100644 --- a/docs/modules/Schemable.ts.md +++ b/docs/modules/Schemable.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Schemable overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.0 --- diff --git a/docs/modules/TaskDecoder.ts.md b/docs/modules/TaskDecoder.ts.md index 8b7f07738..6a15fa49b 100644 --- a/docs/modules/TaskDecoder.ts.md +++ b/docs/modules/TaskDecoder.ts.md @@ -6,6 +6,13 @@ parent: Modules ## TaskDecoder overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.7 --- diff --git a/docs/modules/Type.ts.md b/docs/modules/Type.ts.md index 9a1086a5b..6057965d2 100644 --- a/docs/modules/Type.ts.md +++ b/docs/modules/Type.ts.md @@ -6,6 +6,13 @@ parent: Modules ## Type overview +**This module is experimental** + +Experimental features are published in order to get early feedback from the community, see these tracking +[issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + Added in v2.2.3 --- diff --git a/src/Codec.ts b/src/Codec.ts index 73c892974..cf43bfa5d 100644 --- a/src/Codec.ts +++ b/src/Codec.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.3 */ import { Invariant2 } from 'fp-ts/lib/Invariant' diff --git a/src/DecodeError.ts b/src/DecodeError.ts index f8b7b2ec5..37b8c5922 100644 --- a/src/DecodeError.ts +++ b/src/DecodeError.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.7 */ import { Semigroup } from 'fp-ts/lib/Semigroup' diff --git a/src/Decoder.ts b/src/Decoder.ts index 7b8c3a6fc..94c051d8f 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.7 */ import { Alt1 } from 'fp-ts/lib/Alt' diff --git a/src/Encoder.ts b/src/Encoder.ts index c64cebad1..9323c1a7f 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.3 */ import { Contravariant2 } from 'fp-ts/lib/Contravariant' diff --git a/src/Eq.ts b/src/Eq.ts index 3393d1e1a..3889e2eea 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.2 */ import * as A from 'fp-ts/lib/Array' diff --git a/src/FreeSemigroup.ts b/src/FreeSemigroup.ts index a227e5a8c..f1a764e70 100644 --- a/src/FreeSemigroup.ts +++ b/src/FreeSemigroup.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.7 */ import { Semigroup } from 'fp-ts/lib/Semigroup' diff --git a/src/Guard.ts b/src/Guard.ts index 8babe5d24..021371c01 100644 --- a/src/Guard.ts +++ b/src/Guard.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.0 */ import { pipe } from 'fp-ts/lib/pipeable' diff --git a/src/JsonCodec.ts b/src/JsonCodec.ts index 26b608de9..e672454ec 100644 --- a/src/JsonCodec.ts +++ b/src/JsonCodec.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.3 */ import { Invariant1 } from 'fp-ts/lib/Invariant' diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index db90d2f83..c47f57abf 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.3 */ import { Contravariant1 } from 'fp-ts/lib/Contravariant' diff --git a/src/Kleisli.ts b/src/Kleisli.ts index b00c69109..3295ef504 100644 --- a/src/Kleisli.ts +++ b/src/Kleisli.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.7 */ import { Alt2C } from 'fp-ts/lib/Alt' diff --git a/src/KleisliDecoder.ts b/src/KleisliDecoder.ts index 9cea6dcc9..46fc6800d 100644 --- a/src/KleisliDecoder.ts +++ b/src/KleisliDecoder.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.7 */ import * as E from 'fp-ts/lib/Either' diff --git a/src/KleisliTaskDecoder.ts b/src/KleisliTaskDecoder.ts index aa0f4bed6..cccf6022e 100644 --- a/src/KleisliTaskDecoder.ts +++ b/src/KleisliTaskDecoder.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.7 */ import { Refinement } from 'fp-ts/lib/function' diff --git a/src/Schema.ts b/src/Schema.ts index e85a59eac..3e2b4e434 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.0 */ import { HKT, URIS, Kind } from 'fp-ts/lib/HKT' diff --git a/src/Schemable.ts b/src/Schemable.ts index cdc841d95..aed1a4b97 100644 --- a/src/Schemable.ts +++ b/src/Schemable.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.0 */ import { Kind, URIS, HKT } from 'fp-ts/lib/HKT' diff --git a/src/TaskDecoder.ts b/src/TaskDecoder.ts index 78141bb5f..ca87aa9c0 100644 --- a/src/TaskDecoder.ts +++ b/src/TaskDecoder.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.7 */ import { Alt1 } from 'fp-ts/lib/Alt' diff --git a/src/Type.ts b/src/Type.ts index 7c4146d3f..2a6be0423 100644 --- a/src/Type.ts +++ b/src/Type.ts @@ -1,4 +1,11 @@ /** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * * @since 2.2.3 */ import * as t from './index' From e325e474f2c7c3a2ef43dc261b06ba8939242718 Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 26 Jun 2020 18:38:30 +0200 Subject: [PATCH 095/222] remove some module dependencies --- src/Decoder.ts | 55 +++++++++++++++++++++++++++------------ src/KleisliDecoder.ts | 45 ++++++++++++++++++++++++++++++-- src/KleisliTaskDecoder.ts | 39 ++++++++++++++++++++++++--- 3 files changed, 118 insertions(+), 21 deletions(-) diff --git a/src/Decoder.ts b/src/Decoder.ts index 94c051d8f..1dbce06ce 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -11,9 +11,7 @@ import { Alt1 } from 'fp-ts/lib/Alt' import * as E from 'fp-ts/lib/Either' import { Functor1 } from 'fp-ts/lib/Functor' -import * as NEA from 'fp-ts/lib/NonEmptyArray' import { pipe } from 'fp-ts/lib/pipeable' -import * as T from 'fp-ts/lib/Tree' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' import * as G from './Guard' @@ -322,25 +320,50 @@ export const schemableDecoder: Schemable1 & WithUnknownContainers1 & W */ export type TypeOf = KD.TypeOf -const toForest = (e: DecodeError): NEA.NonEmptyArray> => { - const toTree: (e: DE.DecodeError) => T.Tree = DE.fold({ - Leaf: (input, error) => T.make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), - Key: (key, kind, errors) => T.make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), - Index: (index, kind, errors) => T.make(`${kind} index ${index}`, toForest(errors)), - Member: (index, errors) => T.make(`member ${index}`, toForest(errors)), - Lazy: (id, errors) => T.make(`lazy type ${id}`, toForest(errors)) - }) - const toForest: (f: DecodeError) => NEA.NonEmptyArray> = FS.fold( - (value) => [toTree(value)], - (left, right) => NEA.concat(toForest(left), toForest(right)) - ) - return toForest(e) +interface Tree { + readonly value: A + readonly forest: ReadonlyArray> } +const empty: Array = [] + +const make = (value: A, forest: ReadonlyArray> = empty): Tree => ({ + value, + forest +}) + +const drawTree = (tree: Tree): string => tree.value + drawForest('\n', tree.forest) + +const drawForest = (indentation: string, forest: ReadonlyArray>): string => { + let r: string = '' + const len = forest.length + let tree: Tree + for (let i = 0; i < len; i++) { + tree = forest[i] + const isLast = i === len - 1 + r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value + r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest) + } + return r +} + +const toTree: (e: DE.DecodeError) => Tree = DE.fold({ + Leaf: (input, error) => make(`cannot decode ${JSON.stringify(input)}, should be ${error}`), + Key: (key, kind, errors) => make(`${kind} property ${JSON.stringify(key)}`, toForest(errors)), + Index: (index, kind, errors) => make(`${kind} index ${index}`, toForest(errors)), + Member: (index, errors) => make(`member ${index}`, toForest(errors)), + Lazy: (id, errors) => make(`lazy type ${id}`, toForest(errors)) +}) + +const toForest: (e: DecodeError) => ReadonlyArray> = FS.fold( + (value) => [toTree(value)], + (left, right) => toForest(left).concat(toForest(right)) +) + /** * @since 2.2.7 */ -export const draw = (e: DecodeError): string => toForest(e).map(T.drawTree).join('\n') +export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join('\n') /** * @internal diff --git a/src/KleisliDecoder.ts b/src/KleisliDecoder.ts index 46fc6800d..c3b3b7dad 100644 --- a/src/KleisliDecoder.ts +++ b/src/KleisliDecoder.ts @@ -8,8 +8,12 @@ * * @since 2.2.7 */ +import { Alt2C } from 'fp-ts/lib/Alt' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' import * as E from 'fp-ts/lib/Either' import { Refinement } from 'fp-ts/lib/function' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import { pipe } from 'fp-ts/lib/pipeable' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' import * as K from './Kleisli' @@ -19,9 +23,46 @@ import { Literal } from './Schemable' // Kleisli config // ------------------------------------------------------------------------------------- -const M = +/** + * @internal + */ +export const SE = /*#__PURE__*/ - E.getValidation(DE.getSemigroup()) + DE.getSemigroup() + +/** + * @internal + */ +export const ap = ( + fab: E.Either B>, + fa: E.Either +): E.Either => + E.isLeft(fab) + ? E.isLeft(fa) + ? E.left(SE.concat(fab.left, fa.left)) + : fab + : E.isLeft(fa) + ? fa + : E.right(fab.right(fa.right)) + +const M: MonadThrow2C & Bifunctor2 & Alt2C = { + URI: E.URI, + _E: undefined as any, + map: (fa, f) => pipe(fa, E.map(f)), + ap, + of: E.right, + chain: (ma, f) => pipe(ma, E.chain(f)), + throwError: E.left, + bimap: (fa, f, g) => pipe(fa, E.bimap(f, g)), + mapLeft: (fa, f) => pipe(fa, E.mapLeft(f)), + alt: (me, that) => { + if (E.isRight(me)) { + return me + } + const ea = that() + return E.isLeft(ea) ? E.left(SE.concat(me.left, ea.left)) : ea + } +} // ------------------------------------------------------------------------------------- // model diff --git a/src/KleisliTaskDecoder.ts b/src/KleisliTaskDecoder.ts index cccf6022e..ade185fc8 100644 --- a/src/KleisliTaskDecoder.ts +++ b/src/KleisliTaskDecoder.ts @@ -8,7 +8,13 @@ * * @since 2.2.7 */ +import { Alt2C } from 'fp-ts/lib/Alt' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import * as E from 'fp-ts/lib/Either' import { Refinement } from 'fp-ts/lib/function' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import { pipe } from 'fp-ts/lib/pipeable' +import * as T from 'fp-ts/lib/Task' import * as TE from 'fp-ts/lib/TaskEither' import * as DE from './DecodeError' import * as FS from './FreeSemigroup' @@ -20,9 +26,36 @@ import { Literal } from './Schemable' // Kleisli config // ------------------------------------------------------------------------------------- -const M = - /*#__PURE__*/ - TE.getTaskValidation(DE.getSemigroup()) +const M: MonadThrow2C & Bifunctor2 & Alt2C = { + URI: TE.URI, + _E: undefined as any, + map: (fa, f) => pipe(fa, TE.map(f)), + ap: (fab: TE.TaskEither B>, fa: TE.TaskEither) => + pipe( + pipe( + fab, + T.map((h) => (ga: E.Either) => KD.ap(h, ga)) + ), + T.ap(fa) + ), + of: TE.right, + chain: (ma, f) => pipe(ma, TE.chain(f)), + throwError: TE.left, + bimap: (fa, f, g) => pipe(fa, TE.bimap(f, g)), + mapLeft: (fa, f) => pipe(fa, TE.mapLeft(f)), + alt: (me, that) => + pipe( + me, + T.chain((e1) => + E.isRight(e1) + ? T.of(e1) + : pipe( + that(), + T.map((e2) => (E.isLeft(e2) ? E.left(KD.SE.concat(e1.left, e2.left)) : e2)) + ) + ) + ) +} // ------------------------------------------------------------------------------------- // model From 5d538bb188b25e25275d08cdd3e0e58afe5f8126 Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 27 Jun 2020 07:39:07 +0200 Subject: [PATCH 096/222] update makdown docs --- Decoder.md | 59 +++++++++++++++++++++++++++------------------------- index.md | 1 - package.json | 2 +- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Decoder.md b/Decoder.md index cefaced2b..0aca88f89 100644 --- a/Decoder.md +++ b/Decoder.md @@ -11,10 +11,10 @@ - [The `record` combinator](#the-record-combinator) - [The `array` combinator](#the-array-combinator) - [The `tuple` combinator](#the-tuple-combinator) - - [The `intersection` combinator](#the-intersection-combinator) + - [The `intersect` combinator](#the-intersect-combinator) - [The `sum` combinator](#the-sum-combinator) - [The `lazy` combinator](#the-lazy-combinator) - - [The `refinement` combinator](#the-refinement-combinator) + - [The `refine` combinator](#the-refine-combinator) - [The `parse` combinator](#the-parse-combinator) - [Extracting static types from decoders](#extracting-static-types-from-decoders) - [Built-in error reporter](#built-in-error-reporter) @@ -25,7 +25,7 @@ ```ts export interface Decoder { - readonly decode: (u: unknown) => E.Either>, A> + readonly decode: (u: unknown) => E.Either } ``` @@ -37,8 +37,7 @@ A decoder representing `string` can be defined as import * as D from 'io-ts/lib/Decoder' export const string: D.Decoder = { - decode: (u) => - typeof u === 'string' ? D.success(u) : D.failure(`cannot decode ${JSON.stringify(u)}, should be string`) + decode: (u) => (typeof u === 'string' ? D.success(u) : D.failure(u, 'string')) } ``` @@ -51,7 +50,7 @@ console.log(isRight(string.decode('a'))) // => true console.log(isRight(string.decode(null))) // => false ``` -More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold-function) along with `pipe` (which is similar to the pipeline operator) +More generally the result of calling `decode` can be handled using [`fold`](https://gcanti.github.io/fp-ts/modules/Either.ts.html#fold) along with `pipe` (which is similar to the pipeline operator) ```ts import { pipe } from 'fp-ts/lib/pipeable' @@ -62,18 +61,17 @@ console.log( string.decode(null), fold( // failure handler - (errors) => console.error(errors), + (errors) => `error: ${JSON.stringify(errors)}`, // success handler - (a) => console.log(a) + (a) => `success: ${JSON.stringify(a)}` ) ) ) -// => [ { value: 'cannot decode null, should be string', forest: [] } ] +// => error: {"_tag":"Of","value":{"_tag":"Leaf","actual":null,"error":"string"}} ``` # Built-in primitive decoders -- `never: Decoder` - `string: Decoder` - `number: Decoder` - `boolean: Decoder` @@ -179,18 +177,20 @@ The `tuple` combinator will strip additional components while decoding console.log(MyTuple.decode(['a', 1, true])) // => { _tag: 'Right', right: [ 'a', 1 ] } ``` -## The `intersection` combinator +## The `intersect` combinator -The `intersection` combinator is useful in order to mix required and optional props +The `intersect` combinator is useful in order to mix required and optional props ```ts -export const Person = D.intersection( +export const Person = pipe( D.type({ name: D.string }), - D.partial({ - age: D.number - }) + D.intersect( + D.partial({ + age: D.number + }) + ) ) console.log(isRight(Person.decode({ name: 'name' }))) // => true @@ -270,9 +270,9 @@ const Bar: D.Decoder = D.lazy('Bar', () => ) ``` -## The `refinement` combinator +## The `refine` combinator -The `refinement` combinator allows to define refinements, for example a branded type +The `refine` combinator allows to define refinements, for example a branded type ```ts export interface PositiveBrand { @@ -281,7 +281,10 @@ export interface PositiveBrand { export type Positive = number & PositiveBrand -export const Positive: D.Decoder = D.refinement(D.number, (n): n is Positive => n > 0, 'Positive') +export const Positive: D.Decoder = pipe( + D.number, + D.refine((n): n is Positive => n > 0, 'Positive') +) console.log(isRight(Positive.decode(1))) // => true console.log(isRight(Positive.decode(-1))) // => false @@ -289,15 +292,16 @@ console.log(isRight(Positive.decode(-1))) // => false ## The `parse` combinator -The `parse` combinator is more powerful than `refinement` in that you can change the output type +The `parse` combinator is more powerful than `refine` in that you can change the output type ```ts -import { left, right } from 'fp-ts/lib/Either' - -export const NumberFromString: D.Decoder = D.parse(D.string, (s) => { - const n = parseFloat(s) - return isNaN(n) ? left(`cannot decode ${JSON.stringify(s)}, should be NumberFromString`) : right(n) -}) +export const NumberFromString: D.Decoder = pipe( + D.string, + D.parse((s) => { + const n = parseFloat(s) + return isNaN(n) ? D.failure(s, 'NumberFromString') : D.success(n) + }) +) console.log(isRight(NumberFromString.decode('1'))) // => true console.log(isRight(NumberFromString.decode('a'))) // => false @@ -332,7 +336,6 @@ export interface Person extends D.TypeOf {} ```ts import { isLeft } from 'fp-ts/lib/Either' -import { draw } from 'io-ts/lib/Tree' export const Person = D.type({ name: D.string, @@ -341,7 +344,7 @@ export const Person = D.type({ const result = Person.decode({}) if (isLeft(result)) { - console.log(draw(result.left)) + console.log(D.draw(result.left)) } /* required property "name" diff --git a/index.md b/index.md index 864012600..d1b51beb5 100644 --- a/index.md +++ b/index.md @@ -1,7 +1,6 @@ - - [The idea](#the-idea) - [TypeScript integration](#typescript-integration) - [TypeScript compatibility](#typescript-compatibility) diff --git a/package.json b/package.json index cebb3cc34..7177a0429 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "perf": "ts-node perf/index", "dtslint": "dtslint dtslint", "mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", - "doctoc": "doctoc README.md Type.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", + "doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", "docs": "docs-ts", "import-path-rewrite": "import-path-rewrite" }, From 9472c0801d8eca8e61c573cfd017f990e28f219e Mon Sep 17 00:00:00 2001 From: gcanti Date: Sat, 27 Jun 2020 12:18:06 +0200 Subject: [PATCH 097/222] add PURE comment --- src/Decoder.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Decoder.ts b/src/Decoder.ts index 1dbce06ce..0038c5446 100644 --- a/src/Decoder.ts +++ b/src/Decoder.ts @@ -368,7 +368,6 @@ export const draw = (e: DecodeError): string => toForest(e).map(drawTree).join(' /** * @internal */ -export const stringify: (e: E.Either) => string = E.fold( - (e) => draw(e), - (a) => JSON.stringify(a, null, 2) -) +export const stringify: (e: E.Either) => string = + /*#__PURE__*/ + E.fold(draw, (a) => JSON.stringify(a, null, 2)) From 049c6d1067dc85ce539422b2adbcfc901dc22053 Mon Sep 17 00:00:00 2001 From: gcanti Date: Mon, 29 Jun 2020 08:24:33 +0200 Subject: [PATCH 098/222] make JsonRecord readonly --- docs/modules/JsonEncoder.ts.md | 2 +- src/JsonEncoder.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/JsonEncoder.ts.md b/docs/modules/JsonEncoder.ts.md index 351e31155..00869dfac 100644 --- a/docs/modules/JsonEncoder.ts.md +++ b/docs/modules/JsonEncoder.ts.md @@ -242,7 +242,7 @@ Added in v2.2.3 ```ts export interface JsonRecord { - [key: string]: Json + readonly [key: string]: Json } ``` diff --git a/src/JsonEncoder.ts b/src/JsonEncoder.ts index c47f57abf..97b1a63e0 100644 --- a/src/JsonEncoder.ts +++ b/src/JsonEncoder.ts @@ -28,7 +28,7 @@ export interface JsonArray extends ReadonlyArray {} * @since 2.2.3 */ export interface JsonRecord { - [key: string]: Json + readonly [key: string]: Json } /** From dfe652232fe49208fb968ab161fd9a91873ba4f8 Mon Sep 17 00:00:00 2001 From: Ya Zhuang <499038+zhuangya@users.noreply.github.com> Date: Fri, 10 Jul 2020 17:02:04 +0800 Subject: [PATCH 099/222] Update index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index de171af08..1075b9970 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ A codec can: - decode inputs of type `I` (through `decode`) - encode outputs of type `O` (through `encode`) -- be used as a custom [type guard](https://basarat.gitbooks.io/typescript/content/docs/types/typeGuard.html) (through `is`) +- be used as a custom [type guard](https://basarat.gitbook.io/typescript/type-system/typeguard) (through `is`) ```ts class Type { From fa86e53dde075e54e6f136c794b1b3872f635a78 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 30 Jun 2020 16:45:33 +0200 Subject: [PATCH 100/222] renaming --- CHANGELOG.md | 35 ++ README.md | 2 +- Decoder.md => UnknownDecoder.md | 4 +- docs/modules/Codec.ts.md | 20 +- docs/modules/Decoder.ts.md | 195 ++------- docs/modules/Encoder.ts.md | 20 +- docs/modules/Eq.ts.md | 6 +- docs/modules/Guard.ts.md | 24 +- docs/modules/JsonCodec.ts.md | 22 +- docs/modules/JsonEncoder.ts.md | 20 +- docs/modules/KleisliDecoder.ts.md | 355 ---------------- docs/modules/KleisliTaskDecoder.ts.md | 374 ---------------- docs/modules/PathReporter.ts.md | 2 +- docs/modules/Reporter.ts.md | 2 +- docs/modules/Schema.ts.md | 2 +- docs/modules/Schemable.ts.md | 2 +- docs/modules/TaskDecoder.ts.md | 219 +++------- docs/modules/Type.ts.md | 22 +- docs/modules/UnknownDecoder.ts.md | 458 ++++++++++++++++++++ docs/modules/UnknownTaskDecoder.ts.md | 475 +++++++++++++++++++++ dtslint/ts3.5/Decoder.ts | 57 +-- dtslint/ts3.5/KleisliDecoder.ts | 46 -- dtslint/ts3.5/KleisliTaskDecoder.ts | 46 -- dtslint/ts3.5/TaskDecoder.ts | 57 +-- dtslint/ts3.5/UnknownDecoder.ts | 37 ++ dtslint/ts3.5/UnknownTaskDecoder.ts | 37 ++ index.md | 2 +- package.json | 2 +- src/Codec.ts | 16 +- src/Decoder.ts | 337 ++++++--------- src/Encoder.ts | 4 +- src/Eq.ts | 2 +- src/Guard.ts | 2 +- src/JsonCodec.ts | 12 +- src/JsonEncoder.ts | 6 +- src/KleisliDecoder.ts | 294 ------------- src/KleisliTaskDecoder.ts | 303 ------------- src/TaskDecoder.ts | 301 ++++++------- src/Type.ts | 2 +- src/UnknownDecoder.ts | 386 +++++++++++++++++ src/UnknownTaskDecoder.ts | 356 ++++++++++++++++ test/Arbitrary.ts | 5 +- test/Codec.ts | 108 ++--- test/Decoder.ts | 579 +------------------------ test/Eq.ts | 10 +- test/Guard.ts | 2 +- test/JsonEncoder.ts | 4 +- test/KleisliDecoder.ts | 16 - test/KleisliTaskDecoder.ts | 17 - test/Schema.ts | 10 +- test/TaskDecoder.ts | 585 +------------------------ test/Type.ts | 10 +- test/UnknownDecoder.ts | 585 +++++++++++++++++++++++++ test/UnknownTaskDecoder.ts | 590 ++++++++++++++++++++++++++ 54 files changed, 3552 insertions(+), 3533 deletions(-) rename Decoder.md => UnknownDecoder.md (99%) delete mode 100644 docs/modules/KleisliDecoder.ts.md delete mode 100644 docs/modules/KleisliTaskDecoder.ts.md create mode 100644 docs/modules/UnknownDecoder.ts.md create mode 100644 docs/modules/UnknownTaskDecoder.ts.md delete mode 100644 dtslint/ts3.5/KleisliDecoder.ts delete mode 100644 dtslint/ts3.5/KleisliTaskDecoder.ts create mode 100644 dtslint/ts3.5/UnknownDecoder.ts create mode 100644 dtslint/ts3.5/UnknownTaskDecoder.ts delete mode 100644 src/KleisliDecoder.ts delete mode 100644 src/KleisliTaskDecoder.ts create mode 100644 src/UnknownDecoder.ts create mode 100644 src/UnknownTaskDecoder.ts delete mode 100644 test/KleisliDecoder.ts delete mode 100644 test/KleisliTaskDecoder.ts create mode 100644 test/UnknownDecoder.ts create mode 100644 test/UnknownTaskDecoder.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e4d689e3..b18814c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,41 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.8 + +- **Experimental** + - `Codec` + - rename `invariantCodec` to `Invariant` (@gcanti) + - `Decoder` + - rename to `UnknownDecoder` (@gcanti) + - rename `functorDecoder` to `Functor` (@gcanti) + - rename `altDecoder` to `Alt` (@gcanti) + - rename `schemableDecoder` to `Schemable` (@gcanti) + - `Encoder` + - rename `contravariantEncoder` to `Contravariant` (@gcanti) + - rename `categoryEncoder` to `Category` (@gcanti) + - `Eq` + - rename `schemableEq` to `Schemable` (@gcanti) + - `Guard` + - rename `schemableGuard` to `Schemable` (@gcanti) + - `KleisliDecoder` + - rename to `Decoder` (@gcanti) + - `KleisliTaskDecoder` + - rename to `TaskDecoder` (@gcanti) + - `JsonCodec` + - rename `invariantJsonCodec` to `Invariant` (@gcanti) + - rename `schemableJsonCodec` to `Schemable` (@gcanti) + - `JsonEncoder` + - rename `contravariantJsonCodec` to `Contravariant` (@gcanti) + - rename `schemableJsonEncoder` to `Schemable` (@gcanti) + - `TaskDecoder` + - rename to `UnknownTaskDecoder` (@gcanti) + - rename `functorTaskDecoder` to `Functor` (@gcanti) + - rename `altTaskDecoder` to `Alt` (@gcanti) + - rename `schemableTaskDecoder` to `Schemable` (@gcanti) + - `Type` + - rename `schemableType` to `Schemable` (@gcanti) + # 2.2.7 - **Experimental** diff --git a/README.md b/README.md index f89fd281e..f4af0369c 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ npm i io-ts fp-ts Experimental features (\*) are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. -- [`Decoder.ts` module](Decoder.md) +- [`UnknownDecoder.ts` module](UnknownDecoder.md) - [`Encoder.ts` module](Encoder.md) - [`Codec.ts` module](Codec.md) - [`Eq.ts` module](Eq.md) diff --git a/Decoder.md b/UnknownDecoder.md similarity index 99% rename from Decoder.md rename to UnknownDecoder.md index 0aca88f89..07b29459a 100644 --- a/Decoder.md +++ b/UnknownDecoder.md @@ -21,10 +21,10 @@ -# Decoder interface +# Model ```ts -export interface Decoder { +export interface UnknownDecoder { readonly decode: (u: unknown) => E.Either } ``` diff --git a/docs/modules/Codec.ts.md b/docs/modules/Codec.ts.md index 5f350bb09..fba4f479f 100644 --- a/docs/modules/Codec.ts.md +++ b/docs/modules/Codec.ts.md @@ -38,9 +38,9 @@ Added in v2.2.3 - [literal](#literal) - [make](#make) - [instances](#instances) + - [Invariant](#invariant-1) - [URI](#uri) - [URI (type alias)](#uri-type-alias) - - [invariantCodec](#invariantcodec) - [model](#model) - [Codec (interface)](#codec-interface) - [primitives](#primitives) @@ -199,7 +199,7 @@ Added in v2.2.3 **Signature** ```ts -export declare function fromDecoder(decoder: D.Decoder): Codec +export declare function fromDecoder(decoder: D.UnknownDecoder): Codec ``` Added in v2.2.3 @@ -221,39 +221,39 @@ Added in v2.2.3 **Signature** ```ts -export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec +export declare function make(decoder: D.UnknownDecoder, encoder: E.Encoder): Codec ``` Added in v2.2.3 # instances -## URI +## Invariant **Signature** ```ts -export declare const URI: 'io-ts/Codec' +export declare const Invariant: Invariant2<'io-ts/Codec'> ``` Added in v2.2.3 -## URI (type alias) +## URI **Signature** ```ts -export type URI = typeof URI +export declare const URI: 'io-ts/Codec' ``` Added in v2.2.3 -## invariantCodec +## URI (type alias) **Signature** ```ts -export declare const invariantCodec: Invariant2<'io-ts/Codec'> +export type URI = typeof URI ``` Added in v2.2.3 @@ -270,7 +270,7 @@ Laws: **Signature** ```ts -export interface Codec extends D.Decoder, E.Encoder {} +export interface Codec extends D.UnknownDecoder, E.Encoder {} ``` Added in v2.2.3 diff --git a/docs/modules/Decoder.ts.md b/docs/modules/Decoder.ts.md index 5609eefe0..407864599 100644 --- a/docs/modules/Decoder.ts.md +++ b/docs/modules/Decoder.ts.md @@ -44,25 +44,13 @@ Added in v2.2.7 - [type](#type) - [union](#union) - [constructors](#constructors) - - [fromGuard](#fromguard) + - [fromRefinement](#fromrefinement) - [literal](#literal) -- [instances](#instances) - - [URI](#uri) - - [URI (type alias)](#uri-type-alias) - - [altDecoder](#altdecoder) - - [functorDecoder](#functordecoder) - - [schemableDecoder](#schemabledecoder) - [model](#model) - [Decoder (interface)](#decoder-interface) -- [primitives](#primitives) - - [UnknownArray](#unknownarray) - - [UnknownRecord](#unknownrecord) - - [boolean](#boolean) - - [number](#number) - - [string](#string) - [utils](#utils) + - [InputOf (type alias)](#inputof-type-alias) - [TypeOf (type alias)](#typeof-type-alias) - - [draw](#draw) --- @@ -73,7 +61,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder +export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder ``` Added in v2.2.7 @@ -85,7 +73,7 @@ Added in v2.2.7 **Signature** ```ts -export type DecodeError = KD.DecodeError +export type DecodeError = FS.FreeSemigroup> ``` Added in v2.2.7 @@ -130,7 +118,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder +export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder ``` Added in v2.2.7 @@ -142,7 +130,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const array: (items: Decoder) => Decoder +export declare const array: (items: Decoder) => Decoder ``` Added in v2.2.7 @@ -152,7 +140,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const compose: (to: KD.KleisliDecoder) => (from: Decoder) => Decoder +export declare const compose: (to: Decoder) => (from: Decoder) => Decoder ``` Added in v2.2.7 @@ -162,7 +150,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const intersect: (right: Decoder) => (left: Decoder) => Decoder +export declare const intersect: ( + right: Decoder +) => (left: Decoder) => Decoder ``` Added in v2.2.7 @@ -172,7 +162,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const lazy: (id: string, f: () => Decoder) => Decoder +export declare const lazy: (id: string, f: () => Decoder) => Decoder ``` Added in v2.2.7 @@ -182,9 +172,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const mapLeftWithInput: ( - f: (input: unknown, e: FS.FreeSemigroup>) => FS.FreeSemigroup> -) => (decoder: Decoder) => Decoder +export declare const mapLeftWithInput: ( + f: (input: I, e: FS.FreeSemigroup>) => FS.FreeSemigroup> +) => (decoder: Decoder) => Decoder ``` Added in v2.2.7 @@ -194,7 +184,7 @@ Added in v2.2.7 **Signature** ```ts -export declare const nullable: (or: Decoder) => Decoder +export declare const nullable: (or: Decoder) => Decoder ``` Added in v2.2.7 @@ -206,7 +196,7 @@ Added in v2.2.7 ```ts export declare const parse: ( parser: (a: A) => E.Either>, B> -) => (from: Decoder) => Decoder +) => (from: Decoder) => Decoder ``` Added in v2.2.7 @@ -216,9 +206,9 @@ Added in v2.2.7 **Signature** ```ts -export declare const partial: ( - properties: { [K in keyof A]: Decoder } -) => Decoder> +export declare const partial: