Socket
Socket
Sign inDemoInstall

@fp-ts/schema

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fp-ts/schema - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

Arbitrary.d.ts

@@ -14,3 +14,3 @@ /**

*/
export interface Arbitrary<in out A> extends Schema<A> {
export interface Arbitrary<A> extends Schema<A> {
readonly arbitrary: (fc: typeof FastCheck) => FastCheck.Arbitrary<A>;

@@ -17,0 +17,0 @@ }

@@ -44,3 +44,3 @@ "use strict";

case "Tuple":
return _tuple(ast, ast.components.map(go), (0, _Function.pipe)(ast.restElement, O.map(go)));
return _tuple(ast, ast.components.map(c => go(c.value)), (0, _Function.pipe)(ast.restElement, O.map(go)));
case "Union":

@@ -52,3 +52,3 @@ {

case "Struct":
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.stringIndexSignature, O.map(is => go(is.value))), (0, _Function.pipe)(ast.symbolIndexSignature, O.map(is => go(is.value))));
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.indexSignatures.string, O.map(is => go(is.value))), (0, _Function.pipe)(ast.indexSignatures.symbol, O.map(is => go(is.value))));
case "Lazy":

@@ -130,3 +130,8 @@ return _lazy(() => go(ast.f()));

// ---------------------------------------------
let output = fc.tuple(...components.map(c => c.arbitrary(fc)));
let output = fc.tuple(...components.map((c, i) => {
// ---------------------------------------------
// handle optional components
// ---------------------------------------------
return ast.components[i].optional ? fc.oneof(fc.constant(undefined), c.arbitrary(fc)) : c.arbitrary(fc);
}));
// ---------------------------------------------

@@ -133,0 +138,0 @@ // handle rest element

/**
* @since 1.0.0
*/
import * as Monoid from "@fp-ts/core/typeclass/Monoid";
import * as Semigroup from "@fp-ts/core/typeclass/Semigroup";
import type { Option } from "@fp-ts/data/Option";

@@ -66,7 +68,18 @@ import type { Provider } from "@fp-ts/schema/Provider";

*/
export interface IndexSignatures {
"string": Option<IndexSignature>;
"number": Option<IndexSignature>;
"symbol": Option<IndexSignature>;
}
/**
* @since 1.0.0
*/
export declare const indexSignatures: (string: Option<IndexSignature>, number: Option<IndexSignature>, symbol: Option<IndexSignature>) => IndexSignatures;
/**
* @since 1.0.0
*/
export interface Struct {
readonly _tag: "Struct";
readonly fields: ReadonlyArray<Field>;
readonly stringIndexSignature: Option<IndexSignature>;
readonly symbolIndexSignature: Option<IndexSignature>;
readonly indexSignatures: IndexSignatures;
}

@@ -76,3 +89,3 @@ /**

*/
export declare const struct: (fields: ReadonlyArray<Field>, stringIndexSignature: Option<IndexSignature>, symbolIndexSignature: Option<IndexSignature>) => Struct;
export declare const struct: (fields: ReadonlyArray<Field>, indexSignatures: IndexSignatures) => Struct;
/**

@@ -85,5 +98,24 @@ * @since 1.0.0

*/
export declare const IndexSignaturesMonoid: Monoid.Monoid<IndexSignatures>;
/**
* @since 1.0.0
*/
export declare const StructSemigroup: Semigroup.Semigroup<Struct>;
/**
* @since 1.0.0
*/
export interface Component {
readonly value: AST;
readonly optional: boolean;
}
/**
* @since 1.0.0
*/
export declare const component: (value: AST, optional: boolean) => Component;
/**
* @since 1.0.0
*/
export interface Tuple {
readonly _tag: "Tuple";
readonly components: ReadonlyArray<AST>;
readonly components: ReadonlyArray<Component>;
readonly restElement: Option<AST>;

@@ -95,3 +127,3 @@ readonly readonly: boolean;

*/
export declare const tuple: (components: ReadonlyArray<AST>, restElement: Option<AST>, readonly: boolean) => Tuple;
export declare const tuple: (components: ReadonlyArray<Component>, restElement: Option<AST>, readonly: boolean) => Tuple;
/**

@@ -115,2 +147,6 @@ * @since 1.0.0

*/
export declare const isUnion: (ast: AST) => ast is Union;
/**
* @since 1.0.0
*/
export interface Lazy {

@@ -127,11 +163,7 @@ readonly _tag: "Lazy";

*/
export declare const getStringIndexSignature: (ast: AST) => Option<IndexSignature>;
export declare const getFields: (ast: AST) => ReadonlyArray<Field>;
/**
* @since 1.0.0
*/
export declare const getSymbolIndexSignature: (ast: AST) => Option<IndexSignature>;
/**
* @since 1.0.0
*/
export declare const getFields: (ast: AST) => ReadonlyArray<Field>;
export declare const partial: (ast: AST) => AST;
//# sourceMappingURL=AST.d.ts.map

@@ -6,3 +6,5 @@ "use strict";

});
exports.union = exports.tuple = exports.struct = exports.of = exports.lazy = exports.isTuple = exports.isStruct = exports.isDeclaration = exports.indexSignature = exports.getSymbolIndexSignature = exports.getStringIndexSignature = exports.getFields = exports.field = exports.declare = void 0;
exports.union = exports.tuple = exports.struct = exports.partial = exports.of = exports.lazy = exports.isUnion = exports.isTuple = exports.isStruct = exports.isDeclaration = exports.indexSignatures = exports.indexSignature = exports.getFields = exports.field = exports.declare = exports.component = exports.StructSemigroup = exports.IndexSignaturesMonoid = void 0;
var Monoid = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Monoid"));
var Semigroup = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Semigroup"));
var _Function = /*#__PURE__*/require("@fp-ts/data/Function");

@@ -62,7 +64,15 @@ var O = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Option"));

exports.indexSignature = indexSignature;
const struct = (fields, stringIndexSignature, symbolIndexSignature) => ({
const indexSignatures = (string, number, symbol) => ({
string,
number,
symbol
});
/**
* @since 1.0.0
*/
exports.indexSignatures = indexSignatures;
const struct = (fields, indexSignatures) => ({
_tag: "Struct",
fields,
stringIndexSignature,
symbolIndexSignature
indexSignatures
});

@@ -78,2 +88,26 @@ /**

exports.isStruct = isStruct;
const IndexSignaturesMonoid = /*#__PURE__*/Monoid.struct({
string: /*#__PURE__*/O.getMonoid( /*#__PURE__*/Semigroup.last()),
number: /*#__PURE__*/O.getMonoid( /*#__PURE__*/Semigroup.last()),
symbol: /*#__PURE__*/O.getMonoid( /*#__PURE__*/Semigroup.last())
});
/**
* @since 1.0.0
*/
exports.IndexSignaturesMonoid = IndexSignaturesMonoid;
const StructSemigroup = /*#__PURE__*/Semigroup.fromCombine(that => self => struct(self.fields.concat(that.fields),
// TODO: handle duplicated keys
IndexSignaturesMonoid.combine(that.indexSignatures)(self.indexSignatures)));
/**
* @since 1.0.0
*/
exports.StructSemigroup = StructSemigroup;
const component = (value, optional) => ({
value,
optional
});
/**
* @since 1.0.0
*/
exports.component = component;
const tuple = (components, restElement, readonly) => ({

@@ -94,6 +128,9 @@ _tag: "Tuple",

exports.isTuple = isTuple;
const union = members => ({
_tag: "Union",
members
});
const union = members => {
// TODO: handle union flattening
return {
_tag: "Union",
members
};
};
/**

@@ -103,2 +140,7 @@ * @since 1.0.0

exports.union = union;
const isUnion = ast => ast._tag === "Union";
/**
* @since 1.0.0
*/
exports.isUnion = isUnion;
const lazy = f => ({

@@ -108,2 +150,3 @@ _tag: "Lazy",

});
// TODO: handle index signatures in unions
/**

@@ -113,22 +156,2 @@ * @since 1.0.0

exports.lazy = lazy;
const getStringIndexSignature = ast => {
if (isStruct(ast)) {
return ast.stringIndexSignature;
}
return O.none;
};
/**
* @since 1.0.0
*/
exports.getStringIndexSignature = getStringIndexSignature;
const getSymbolIndexSignature = ast => {
if (isStruct(ast)) {
return ast.symbolIndexSignature;
}
return O.none;
};
/**
* @since 1.0.0
*/
exports.getSymbolIndexSignature = getSymbolIndexSignature;
const getFields = ast => {

@@ -142,3 +165,2 @@ switch (ast._tag) {

{
// TODO: handle indexSignatures
const memberFields = ast.members.map(getFields);

@@ -166,2 +188,17 @@ if ((0, _ReadonlyArray.isNonEmpty)(memberFields)) {

exports.getFields = getFields;
const orUndefined = ast => union([of(undefined), ast]);
/**
* @since 1.0.0
*/
const partial = ast => {
if (isStruct(ast)) {
return struct(ast.fields.map(f => field(f.key, f.value, true, f.readonly)), ast.indexSignatures);
} else if (isTuple(ast)) {
return tuple(ast.components.map(c => component(c.value, true)), (0, _Function.pipe)(ast.restElement, O.map(orUndefined)), ast.readonly);
} else if (isUnion(ast)) {
return union(ast.members.map(partial));
}
return ast;
};
exports.partial = partial;
//# sourceMappingURL=AST.js.map

@@ -25,4 +25,4 @@ /**

*/
export interface Codec<in out A> extends Schema<A>, Decoder<unknown, A>, Encoder<unknown, A>, Guard<A>, Arbitrary<A>, Pretty<A> {
readonly parseOrThrow: (text: string) => A;
export interface Codec<A> extends Schema<A>, Decoder<unknown, A>, Encoder<unknown, A>, Guard<A>, Arbitrary<A>, Pretty<A> {
readonly parseOrThrow: (text: string, format?: (errors: NonEmptyReadonlyArray<DecodeError>) => string) => A;
readonly stringify: (value: A) => string;

@@ -136,3 +136,3 @@ readonly of: (value: A) => A;

*/
export declare const withRest: <R>(rest: Schema<R>) => <A extends readonly any[]>(self: Schema<A>) => Schema<readonly [...A, ...R[]]>;
export declare const restElement: <R>(rest: Schema<R>) => <A extends readonly any[]>(self: Schema<A>) => Schema<readonly [...A, ...R[]]>;
/**

@@ -139,0 +139,0 @@ * @since 1.0.0

@@ -6,3 +6,4 @@ "use strict";

});
exports.withRest = exports.warnings = exports.warning = exports.unknownObject = exports.unknownArray = exports.unknown = exports.union = exports.tuple = exports.symbolIndexSignature = exports.symbol = exports.success = exports.struct = exports.stringIndexSignature = exports.string = exports.refine = exports.readonlySet = exports.provideCodecFor = exports.pick = exports.partial = exports.option = exports.omit = exports.number = exports.nonEmptyArray = exports.never = exports.nativeEnum = exports.minLength = exports.maxLength = exports.make = exports.literal = exports.list = exports.lessThanOrEqualTo = exports.lessThan = exports.lazy = exports.keyof = exports.jsonObject = exports.jsonArray = exports.json = exports.isWarning = exports.isSuccess = exports.isFailure = exports.int = exports.greaterThanOrEqualTo = exports.greaterThan = exports.filterWith = exports.filter = exports.failures = exports.failure = exports.extend = exports.codecFor = exports.chunk = exports.boolean = exports.bigint = exports.array = exports.any = void 0;
exports.warnings = exports.warning = exports.unknownObject = exports.unknownArray = exports.unknown = exports.union = exports.tuple = exports.symbolIndexSignature = exports.symbol = exports.success = exports.struct = exports.stringIndexSignature = exports.string = exports.restElement = exports.refine = exports.readonlySet = exports.provideCodecFor = exports.pick = exports.partial = exports.option = exports.omit = exports.number = exports.nonEmptyArray = exports.never = exports.nativeEnum = exports.minLength = exports.maxLength = exports.make = exports.literal = exports.list = exports.lessThanOrEqualTo = exports.lessThan = exports.lazy = exports.keyof = exports.jsonObject = exports.jsonArray = exports.json = exports.isWarning = exports.isSuccess = exports.isFailure = exports.int = exports.greaterThanOrEqualTo = exports.greaterThan = exports.filterWith = exports.filter = exports.failures = exports.failure = exports.extend = exports.codecFor = exports.chunk = exports.boolean = exports.bigint = exports.array = exports.any = void 0;
var E = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Either"));
var _Function = /*#__PURE__*/require("@fp-ts/data/Function");

@@ -37,19 +38,20 @@ var _Json = /*#__PURE__*/require("@fp-ts/data/Json");

pretty,
parseOrThrow: text => {
parseOrThrow: (text, format) => {
const json = (0, _Json.parse)(text);
if (json._tag === "Left") {
if (E.isLeft(json)) {
throw new Error(`Cannot parse JSON from: ${text}`);
}
const result = decode(json.right);
if (result._tag === "Right") {
if (!I.isFailure(result)) {
return result.right;
}
throw new Error(`Cannot parse object, errors: ${result.left.map(_ => JSON.stringify(_)).join(", ")}`);
const message = `Cannot decode JSON` + (format ? `, errors: ${format(result.left)}` : ``);
throw new Error(message);
},
stringify: value => {
const str = (0, _Json.stringify)(encode(value));
if (str._tag === "Left") {
throw new Error(`Cannot encode JSON, error: ${String(str.left)}`);
const json = (0, _Json.stringify)(encode(value));
if (E.isLeft(json)) {
throw new Error(`Cannot encode JSON, error: ${String(json.left)}`);
}
return str.right;
return json.right;
},

@@ -185,7 +187,7 @@ of: _Function.identity

exports.tuple = tuple;
const withRest = rest => self => codecFor(S.withRest(rest)(self));
const restElement = rest => self => codecFor(S.restElement(rest)(self));
/**
* @since 1.0.0
*/
exports.withRest = withRest;
exports.restElement = restElement;
const array = item => codecFor(S.array(item));

@@ -192,0 +194,0 @@ /**

@@ -50,8 +50,7 @@ "use strict";

return I.success(BigInt(u));
} catch (e) {
const expected = e instanceof Error ? e.message : String(e);
return I.failure(DE.custom(expected, u));
} catch (_e) {
return I.failure(DE.notType(id, u));
}
}
return I.failure(DE.notType("string | number | bigint | boolean", u));
return I.failure(DE.notType(id, u));
});

@@ -58,0 +57,0 @@ const Encoder = /*#__PURE__*/I.makeEncoder(Schema, n => n.toString());

@@ -41,3 +41,3 @@ "use strict";

const Guard = /*#__PURE__*/I.makeGuard(Schema, _Boolean.isBoolean);
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, _Boolean.isBoolean, u => DE.notType("boolean", u));
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, _Boolean.isBoolean, u => DE.notType(id, u));
const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -44,0 +44,0 @@ const Arbitrary = /*#__PURE__*/I.makeArbitrary(Schema, fc => fc.boolean());

@@ -24,4 +24,4 @@ "use strict";

exports.id = id;
const schema = /*#__PURE__*/(0, _filter.filter)(id, n => Number.isInteger(n) ? I.success(n) : I.failure(DE.notType("int", n)));
const schema = /*#__PURE__*/(0, _filter.filter)(id, n => Number.isInteger(n) ? I.success(n) : I.failure(DE.notType(id, n)));
exports.schema = schema;
//# sourceMappingURL=Int.js.map

@@ -41,3 +41,3 @@ "use strict";

/** @internal */
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isJson, u => DE.notType("Json", u));
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isJson, u => DE.notType(id, u));
exports.Decoder = Decoder;

@@ -44,0 +44,0 @@ const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -41,3 +41,3 @@ "use strict";

/** @internal */
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isJsonArray, u => DE.notType("JsonArray", u));
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isJsonArray, u => DE.notType(id, u));
exports.Decoder = Decoder;

@@ -44,0 +44,0 @@ const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -41,3 +41,3 @@ "use strict";

/** @internal */
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isJsonObject, u => DE.notType("JsonObject", u));
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isJsonObject, u => DE.notType(id, u));
exports.Decoder = Decoder;

@@ -44,0 +44,0 @@ const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -5,3 +5,7 @@ import type * as S from "@fp-ts/schema/Schema";

*/
export declare const id: unique symbol;
/**
* @since 1.0.0
*/
export declare const Schema: S.Schema<never>;
//# sourceMappingURL=Never.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

});
exports.Schema = void 0;
exports.id = exports.Schema = void 0;
var AST = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/AST"));

@@ -19,4 +19,9 @@ var I = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/internal/common"));

*/
const id = /*#__PURE__*/Symbol.for("@fp-ts/schema/data/never");
/**
* @since 1.0.0
*/
exports.id = id;
const Schema = /*#__PURE__*/I.makeSchema( /*#__PURE__*/AST.union([]));
exports.Schema = Schema;
//# sourceMappingURL=Never.js.map

@@ -43,3 +43,3 @@ "use strict";

exports.Guard = Guard;
const Decoder = /*#__PURE__*/I.makeDecoder(Schema, u => Guard.is(u) ? isNaN(u) ? I.warning(DE.nan, u) : isFinite(u) ? I.success(u) : I.warning(DE.notFinite, u) : I.failure(DE.notType("number", u)));
const Decoder = /*#__PURE__*/I.makeDecoder(Schema, u => Guard.is(u) ? isNaN(u) ? I.warning(DE.nan, u) : isFinite(u) ? I.success(u) : I.warning(DE.notFinite, u) : I.failure(DE.notType(id, u)));
const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -46,0 +46,0 @@ /** @internal */

@@ -41,3 +41,3 @@ "use strict";

const Guard = /*#__PURE__*/I.makeGuard(Schema, String.isString);
const Decoder = /*#__PURE__*/I.makeDecoder(Schema, u => Guard.is(u) ? I.success(u) : I.failure(DE.notType("string", u)));
const Decoder = /*#__PURE__*/I.makeDecoder(Schema, u => Guard.is(u) ? I.success(u) : I.failure(DE.notType(id, u)));
const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -44,0 +44,0 @@ const Arbitrary = /*#__PURE__*/I.makeArbitrary(Schema, fc => fc.string());

@@ -40,3 +40,3 @@ "use strict";

const Guard = /*#__PURE__*/I.makeGuard(Schema, u => typeof u === "symbol");
const Decoder = /*#__PURE__*/I.makeDecoder(Schema, u => Guard.is(u) ? I.success(u) : I.failure(DE.notType("symbol", u)));
const Decoder = /*#__PURE__*/I.makeDecoder(Schema, u => Guard.is(u) ? I.success(u) : I.failure(DE.notType(id, u)));
const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -43,0 +43,0 @@ const Arbitrary = /*#__PURE__*/I.makeArbitrary(Schema, fc => fc.string().map(s => Symbol.for(s)));

@@ -44,3 +44,3 @@ "use strict";

exports.Guard = Guard;
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, isUnknownArray, u => DE.notType("ReadonlyArray<unknown>", u));
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, isUnknownArray, u => DE.notType(id, u));
exports.Decoder = Decoder;

@@ -47,0 +47,0 @@ const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -43,3 +43,3 @@ "use strict";

exports.Guard = Guard;
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isUnknownObject, u => DE.notType("{ readonly [_: string]: unknown }", u));
const Decoder = /*#__PURE__*/I.fromRefinement(Schema, I.isUnknownObject, u => DE.notType(id, u));
exports.Decoder = Decoder;

@@ -46,0 +46,0 @@ const Encoder = /*#__PURE__*/I.makeEncoder(Schema, _Function.identity);

@@ -26,3 +26,3 @@ /**

readonly _tag: "NotType";
readonly expected: string;
readonly expected: symbol;
readonly actual: unknown;

@@ -33,3 +33,3 @@ }

*/
export declare const notType: (expected: string, actual: unknown) => NotType;
export declare const notType: (expected: symbol, actual: unknown) => NotType;
/**

@@ -36,0 +36,0 @@ * @since 1.0.0

@@ -12,3 +12,3 @@ /**

*/
export interface Decoder<in I, in out A> extends Schema<A> {
export interface Decoder<I, A> extends Schema<A> {
readonly I: (_: I) => void;

@@ -15,0 +15,0 @@ readonly decode: (i: I) => These<NonEmptyReadonlyArray<DE.DecodeError>, A>;

@@ -9,4 +9,5 @@ "use strict";

var O = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Option"));
var UnknownArray = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/data/UnknownArray"));
var UnknownObject = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/data/UnknownObject"));
var DataNever = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/data/Never"));
var DataUnknownArray = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/data/UnknownArray"));
var DataUnknownObject = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/data/UnknownObject"));
var DE = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/DecodeError"));

@@ -88,5 +89,5 @@ var I = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/schema/internal/common"));

case "Tuple":
return (0, _Function.pipe)(UnknownArray.Decoder, I.compose(_tuple(ast, ast.components.map(go), (0, _Function.pipe)(ast.restElement, O.map(go)))));
return (0, _Function.pipe)(DataUnknownArray.Decoder, I.compose(_tuple(ast, ast.components.map(c => go(c.value)), (0, _Function.pipe)(ast.restElement, O.map(go)))));
case "Struct":
return (0, _Function.pipe)(UnknownObject.Decoder, I.compose(_struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.stringIndexSignature, O.map(is => go(is.value))), (0, _Function.pipe)(ast.symbolIndexSignature, O.map(is => go(is.value))))));
return (0, _Function.pipe)(DataUnknownObject.Decoder, I.compose(_struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.indexSignatures.string, O.map(is => go(is.value))), (0, _Function.pipe)(ast.indexSignatures.symbol, O.map(is => go(is.value))))));
case "Union":

@@ -113,4 +114,4 @@ return _union(ast, ast.members.map(go));

exports._of = _of;
const _tuple = (ast, components, oRestElement) => make(I.makeSchema(ast), us => {
const out = [];
const _tuple = (ast, components, oRestElement) => make(I.makeSchema(ast), input => {
const output = [];
const es = [];

@@ -122,4 +123,10 @@ let i = 0;

for (; i < components.length; i++) {
// ---------------------------------------------
// handle optional components
// ---------------------------------------------
if (ast.components[i].optional && input[i] === undefined) {
continue;
}
const decoder = components[i];
const t = decoder.decode(us[i]);
const t = decoder.decode(input[i]);
if (isFailure(t)) {

@@ -130,3 +137,3 @@ return failures(I.append(es, DE.index(i, t.left))); // bail out on a fatal errors

}
out[i] = t.right;
output[i] = t.right;
}

@@ -138,4 +145,4 @@ // ---------------------------------------------

const decoder = oRestElement.value;
for (; i < us.length; i++) {
const t = decoder.decode(us[i]);
for (; i < input.length; i++) {
const t = decoder.decode(input[i]);
if (isFailure(t)) {

@@ -146,3 +153,3 @@ return failures(I.append(es, DE.index(i, t.left))); // bail out on a fatal errors

}
out[i] = t.right;
output[i] = t.right;
}

@@ -153,3 +160,3 @@ } else {

// ---------------------------------------------
for (; i < us.length; i++) {
for (; i < input.length; i++) {
es.push(DE.unexpectedIndex(i));

@@ -161,3 +168,3 @@ }

// ---------------------------------------------
return I.isNonEmpty(es) ? warnings(es, out) : success(out);
return I.isNonEmpty(es) ? warnings(es, output) : success(output);
});

@@ -256,3 +263,3 @@ /** @internal */

}
return I.isNonEmpty(es) ? failures(es) : failure(DE.notType("never", u));
return I.isNonEmpty(es) ? failures(es) : failure(DE.notType(DataNever.id, u));
});

@@ -259,0 +266,0 @@ /** @internal */

@@ -9,3 +9,3 @@ /**

*/
export interface Encoder<out S, in out A> extends Schema<A> {
export interface Encoder<S, A> extends Schema<A> {
readonly encode: (value: A) => S;

@@ -12,0 +12,0 @@ }

@@ -45,5 +45,5 @@ "use strict";

case "Tuple":
return _tuple(ast, ast.components.map(go), (0, _Function.pipe)(ast.restElement, O.map(go)));
return _tuple(ast, ast.components.map(c => go(c.value)), (0, _Function.pipe)(ast.restElement, O.map(go)));
case "Struct":
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.stringIndexSignature, O.map(is => go(is.value))), (0, _Function.pipe)(ast.symbolIndexSignature, O.map(is => go(is.value))));
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.indexSignatures.string, O.map(is => go(is.value))), (0, _Function.pipe)(ast.indexSignatures.symbol, O.map(is => go(is.value))));
case "Union":

@@ -70,4 +70,4 @@ return _union(ast, ast.members.map(m => [G.guardFor(I.makeSchema(m)), go(m)]));

exports._of = _of;
const _tuple = (ast, components, oRestElement) => make(I.makeSchema(ast), us => {
const out = [];
const _tuple = (ast, components, oRestElement) => make(I.makeSchema(ast), input => {
const output = [];
let i = 0;

@@ -78,4 +78,13 @@ // ---------------------------------------------

for (; i < components.length; i++) {
const encoder = components[i];
out[i] = encoder.encode(us[i]);
// ---------------------------------------------
// handle optional components
// ---------------------------------------------
if (ast.components[i].optional && input[i] === undefined) {
if (i < input.length) {
output[i] = undefined;
}
} else {
const encoder = components[i];
output[i] = encoder.encode(input[i]);
}
}

@@ -87,7 +96,7 @@ // ---------------------------------------------

const encoder = oRestElement.value;
for (; i < us.length; i++) {
out[i] = encoder.encode(us[i]);
for (; i < input.length; i++) {
output[i] = encoder.encode(input[i]);
}
}
return out;
return output;
});

@@ -94,0 +103,0 @@ /** @internal */

@@ -13,3 +13,3 @@ /**

*/
export interface Guard<in out A> extends Schema<A> {
export interface Guard<A> extends Schema<A> {
readonly is: (input: unknown) => input is A;

@@ -16,0 +16,0 @@ }

@@ -46,3 +46,3 @@ "use strict";

case "Tuple":
return _tuple(ast, ast.components.map(go), (0, _Function.pipe)(ast.restElement, O.map(go)));
return _tuple(ast, ast.components.map(c => go(c.value)), (0, _Function.pipe)(ast.restElement, O.map(go)));
case "Union":

@@ -54,3 +54,3 @@ {

case "Struct":
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.stringIndexSignature, O.map(is => go(is.value))), (0, _Function.pipe)(ast.symbolIndexSignature, O.map(is => go(is.value))));
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.indexSignatures.string, O.map(is => go(is.value))), (0, _Function.pipe)(ast.indexSignatures.symbol, O.map(is => go(is.value))));
case "Lazy":

@@ -141,2 +141,8 @@ return _lazy(() => go(ast.f()));

for (; i < components.length; i++) {
// ---------------------------------------------
// handle optional components
// ---------------------------------------------
if (ast.components[i].optional && input[i] === undefined) {
continue;
}
if (!components[i].is(input[i])) {

@@ -143,0 +149,0 @@ return false;

@@ -167,3 +167,3 @@ "use strict";

const _optional = optional || {};
return makeSchema(AST.struct(getPropertyKeys(required).map(key => AST.field(key, required[key].ast, false, true)).concat(getPropertyKeys(_optional).map(key => AST.field(key, _optional[key].ast, true, true))), O.none, O.none));
return makeSchema(AST.struct(getPropertyKeys(required).map(key => AST.field(key, required[key].ast, false, true)).concat(getPropertyKeys(_optional).map(key => AST.field(key, _optional[key].ast, true, true))), AST.indexSignatures(O.none, O.none, O.none)));
};

@@ -170,0 +170,0 @@ /** @internal */

{
"name": "@fp-ts/schema",
"version": "0.0.4",
"version": "0.0.5",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

@@ -10,3 +10,3 @@ import type { Provider } from "@fp-ts/schema/Provider";

*/
export interface Pretty<in out A> extends Schema<A> {
export interface Pretty<A> extends Schema<A> {
readonly pretty: (a: A) => string;

@@ -13,0 +13,0 @@ }

@@ -51,5 +51,5 @@ "use strict";

case "Tuple":
return _tuple(ast, ast.components.map(go), (0, _Function.pipe)(ast.restElement, O.map(go)));
return _tuple(ast, ast.components.map(c => go(c.value)), (0, _Function.pipe)(ast.restElement, O.map(go)));
case "Struct":
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.stringIndexSignature, O.map(is => go(is.value))), (0, _Function.pipe)(ast.symbolIndexSignature, O.map(is => go(is.value))));
return _struct(ast, ast.fields.map(f => go(f.value)), (0, _Function.pipe)(ast.indexSignatures.string, O.map(is => go(is.value))), (0, _Function.pipe)(ast.indexSignatures.symbol, O.map(is => go(is.value))));
case "Union":

@@ -129,4 +129,13 @@ {

for (; i < components.length; i++) {
const pretty = components[i];
output[i] = pretty.pretty(input[i]);
// ---------------------------------------------
// handle optional components
// ---------------------------------------------
if (ast.components[i].optional && input[i] === undefined) {
if (i < input.length) {
output[i] = "undefined";
}
} else {
const pretty = components[i];
output[i] = pretty.pretty(input[i]);
}
}

@@ -142,3 +151,3 @@ // ---------------------------------------------

}
return "[" + output.join(",") + "]";
return "[" + output.join(", ") + "]";
});

@@ -145,0 +154,0 @@ const _union = (ast, members) => make(I.makeSchema(ast), a => {

@@ -28,3 +28,2 @@ <h3 align="center">

- deriving single artifacts from a `Schema`:
- `Codec`
- `Guard`

@@ -34,6 +33,7 @@ - `Arbitrary`

- `Codec` (all in one artifact)
- custom interpreters
- custom schema combinators
- custom artifact compilers
- custom `Schema` combinators
- custom data types
- custom decode errors
- custom decode errors (TODO)
- refinements (TODO)
- versioning (TODO)

@@ -44,2 +44,4 @@ - migration (TODO)

Schema definition
```ts

@@ -52,4 +54,7 @@ import * as C from "@fp-ts/schema/Codec";

});
```
// extract the inferred type
Extract the inferred type
```ts
type Person = C.Infer<typeof Person>;

@@ -62,14 +67,40 @@ /*

*/
```
Decode from `unknown`
```ts
import * as DE from "@fp-ts/schema/DecodeError";
// decode from JSON
expect(Person.decode({ name: "name", age: 18 })).toEqual(
C.success({ name: "name", age: 18 })
);
const unknown: unknown = { name: "name", age: 18 };
expect(Person.decode(unknown)).toEqual(C.success({ name: "name", age: 18 }));
expect(Person.decode(null)).toEqual(
C.failure(DE.notType("{ readonly [_: string]: unknown }", null))
C.failure(DE.notType(Symbol.for("@fp-ts/schema/data/UnknownObject"), null))
);
```
// encode to JSON
Parse from `JSON` string
```ts
expect(() => Person.parseOrThrow("malformed")).toThrow(
new Error("Cannot parse JSON from: malformed")
);
expect(() => Person.parseOrThrow("{}")).toThrow(
new Error("Cannot decode JSON")
);
// with a custom formatter
expect(() =>
Person.parseOrThrow("{}", (errors) => JSON.stringify(errors))
).toThrow(
new Error(
'Cannot decode JSON, errors: [{"_tag":"Key","key":"name","errors":[{"_tag":"NotType"}]}]'
)
);
```
Encode to `unknown`
```ts
expect(Person.encode({ name: "name", age: 18 })).toEqual({

@@ -79,20 +110,37 @@ name: "name",

});
```
// guard
Encode to `JSON` string
```ts
expect(Person.stringify({ name: "name", age: 18 })).toEqual(
'{"name":"name","age":18}'
);
```
Guard
```ts
expect(Person.is({ name: "name", age: 18 })).toEqual(true);
expect(Person.is(null)).toEqual(false);
```
// pretty print
Pretty print
```ts
expect(Person.pretty({ name: "name", age: 18 })).toEqual(
'{ "name": "name", "age": 18 }'
);
```
[`fast-check`](https://github.com/dubzzz/fast-check) `Arbitrary`
```ts
import * as fc from "fast-check";
// fast-check arbitrary
console.log(fc.sample(Person.arbitrary(fc), 2));
/*
[
{ name: '!U?z/X', age: -2.5223372357846707e-44 },
{ name: 'valukeypro', age: -1.401298464324817e-45 }
{ name: '!U?z/X', age: -2.5223372357846707e-44 },
{ name: 'valukeypro', age: -1.401298464324817e-45 }
]

@@ -102,5 +150,5 @@ */

# Custom interpreters
# Custom artifact compilers
`src/Pretty.ts`, `src/Guard.ts` and `src/Arbitrary.ts` are good examples of defining a custom interpreter.
`src/Pretty.ts`, `src/Guard.ts` and `src/Arbitrary.ts` are good examples of defining a custom compiler.

@@ -121,8 +169,86 @@ # Custom schema combinators

## Guard
From a technical point of view a schema is just a typed wrapper of an `AST` value
```ts
interface Schema<in out A> {
readonly ast: AST;
}
```
The `AST` type represents a tiny portion of the TypeScript AST, roughly speaking the part describing ADTs (algebraic data types),
i.e. products (like structs and tuples) and unions.
This means that you can define your own schema constructors / combinators as long as you are able to manipulate the `AST` type accordingly, let's see an example.
Say we want to define a `pair` schema constructor, which takes a `Schema<A>` as input and returns a `Schema<readonly [A, A]>` as output.
First of all we need to define the signature of `pair`
```ts
import * as S from "@fp-ts/schema/Schema";
declare const pair: <A>(schema: S.Schema<A>) => S.Schema<readonly [A, A]>;
```
Then we can implement the body using the APIs exported by the `AST.ts` module
```ts
import * as AST from "@fp-ts/schema/AST";
import * as O from "@fp-ts/data/Option";
const pair = <A>(schema: S.Schema<A>): S.Schema<readonly [A, A]> => {
const item = AST.component(
schema.ast, // <= the type of the component
false // <= specifies if the component is optional
);
const tuple = AST.tuple(
[item, item], // <= components definitions
O.none, // <= rest element
true // <= specifies if the tuple is readonly
);
return S.make(tuple); // <= wrap the AST value in a Schema
};
```
The goal of this example was showing the low-level APIs of the `AST` module, but the same result can
be achieved using the much more handy APIs of the `Schema` module
```ts
const pair = <A>(schema: S.Schema<A>): S.Schema<readonly [A, A]> =>
S.tuple(schema, schema);
```
Please note that the `S.tuple` itself is nothing special and can be defined in userland
```ts
export const tuple = <Components extends ReadonlyArray<Schema<any>>>(
...components: Components
): Schema<{ readonly [K in keyof Components]: Infer<Components[K]> }> =>
make(
AST.tuple(
components.map((c) => AST.component(c.ast, false)),
O.none,
true
)
);
```
Now you can compile your `pair` schemas using the `codecFor` compiler
```ts
import * as C from "@fp-ts/schema/Codec";
// const myNumberPair: C.Codec<readonly [number, number]>
const myNumberPair = C.codecFor(pair(S.number));
expect(myNumberPair.is([1, 2])).toEqual(true);
expect(myNumberPair.is([1, "a"])).toEqual(false);
```
**Guard**
A `Guard` is a derivable artifact that is able to refine a value of type `unknown` to a value of type `A`.
```ts
interface Guard<A> extends Schema<A> {
interface Guard<in out A> extends Schema<A> {
readonly is: (input: unknown) => input is A;

@@ -132,3 +258,3 @@ }

## Arbitrary
**Arbitrary**

@@ -143,3 +269,3 @@ An `Arbitrary` is a derivable artifact that is able to produce [`fast-check`](https://github.com/dubzzz/fast-check) arbitraries.

## Pretty
**Pretty**

@@ -154,9 +280,11 @@ A `Pretty` is a derivable artifact that is able to pretty print a value of type `A`.

## Codec
**Codec**
A `Codec` is a derivable artifact that is able to:
- decode a value of type `unknown` to a value of type `A`.
- encode a value of type `A` to a value of type `unknown`.
- decode a value of type `unknown` to a value of type `A`
- encode a value of type `A` to a value of type `unknown`
A `Codec` is also a `Guard`, an `Arbitrary` and a `Pretty`.
```ts

@@ -203,2 +331,4 @@ interface Codec<in out A>

**Note**. Filters don't change the `Schema` type.
```ts

@@ -263,7 +393,7 @@ // $ExpectType Codec<string>

## Rest element
Rest element
```ts
// $ExpectType Schema<readonly [string, number, ...boolean[]]>
pipe(C.tuple(C.string, C.number), C.withRest(C.boolean));
pipe(C.tuple(C.string, C.number), C.restElement(C.boolean));
```

@@ -280,2 +410,4 @@

Equivalent to `pipe(tuple(item), restElement(item))`
```ts

@@ -282,0 +414,0 @@ // $ExpectType Codec<readonly [number, ...number[]]>

@@ -16,3 +16,3 @@ /**

*/
export interface Schema<in out A> {
export interface Schema<A> {
readonly A: (_: A) => A;

@@ -98,3 +98,3 @@ readonly ast: AST.AST;

*/
export declare const withRest: <R>(rest: Schema<R>) => <A extends readonly any[]>(self: Schema<A>) => Schema<readonly [...A, ...R[]]>;
export declare const restElement: <R>(rest: Schema<R>) => <A extends readonly any[]>(self: Schema<A>) => Schema<readonly [...A, ...R[]]>;
/**

@@ -101,0 +101,0 @@ * @since 1.0.0

@@ -6,3 +6,3 @@ "use strict";

});
exports.withRest = exports.unknownObject = exports.unknownArray = exports.unknown = exports.union = exports.tuple = exports.symbolIndexSignature = exports.symbol = exports.struct = exports.stringIndexSignature = exports.string = exports.refine = exports.readonlySet = exports.pick = exports.partial = exports.option = exports.omit = exports.of = exports.number = exports.nonEmptyArray = exports.never = exports.nativeEnum = exports.minLength = exports.maxLength = exports.make = exports.literal = exports.list = exports.lessThanOrEqualTo = exports.lessThan = exports.lazy = exports.keyof = exports.jsonObject = exports.jsonArray = exports.json = exports.int = exports.greaterThanOrEqualTo = exports.greaterThan = exports.filterWith = exports.filter = exports.extend = exports.declare = exports.clone = exports.chunk = exports.boolean = exports.bigint = exports.array = exports.any = void 0;
exports.unknownObject = exports.unknownArray = exports.unknown = exports.union = exports.tuple = exports.symbolIndexSignature = exports.symbol = exports.struct = exports.stringIndexSignature = exports.string = exports.restElement = exports.refine = exports.readonlySet = exports.pick = exports.partial = exports.option = exports.omit = exports.of = exports.number = exports.nonEmptyArray = exports.never = exports.nativeEnum = exports.minLength = exports.maxLength = exports.make = exports.literal = exports.list = exports.lessThanOrEqualTo = exports.lessThan = exports.lazy = exports.keyof = exports.jsonObject = exports.jsonArray = exports.json = exports.int = exports.greaterThanOrEqualTo = exports.greaterThan = exports.filterWith = exports.filter = exports.extend = exports.declare = exports.clone = exports.chunk = exports.boolean = exports.bigint = exports.array = exports.any = void 0;
var _Function = /*#__PURE__*/require("@fp-ts/data/Function");

@@ -66,3 +66,3 @@ var O = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Option"));

}
throw new Error("cannot `clone` non-Declaration schemas");
throw new Error("`clone` is not supported on this schema");
};

@@ -139,3 +139,3 @@ /**

exports.keyof = keyof;
const tuple = (...components) => make(AST.tuple(components.map(c => c.ast), O.none, true));
const tuple = (...components) => make(AST.tuple(components.map(c => AST.component(c.ast, false)), O.none, true));
/**

@@ -145,3 +145,3 @@ * @since 1.0.0

exports.tuple = tuple;
const withRest = rest => self => {
const restElement = rest => self => {
if (AST.isTuple(self.ast)) {

@@ -153,3 +153,3 @@ const a = self.ast;

}
throw new Error("cannot `withRest` non-Tuple schemas");
throw new Error("`restElement` is not supported on this schema");
};

@@ -159,3 +159,3 @@ /**

*/
exports.withRest = withRest;
exports.restElement = restElement;
const array = I.array;

@@ -166,3 +166,3 @@ /**

exports.array = array;
const nonEmptyArray = item => make(AST.tuple([item.ast], O.some(item.ast), true));
const nonEmptyArray = item => (0, _Function.pipe)(tuple(item), restElement(item));
/**

@@ -178,3 +178,3 @@ * @since 1.0.0

const pick = (...keys) => self => {
return make(AST.struct(AST.getFields(self.ast).filter(f => keys.includes(f.key)), O.none, O.none));
return make(AST.struct(AST.getFields(self.ast).filter(f => keys.includes(f.key)), AST.indexSignatures(O.none, O.none, O.none)));
};

@@ -186,3 +186,3 @@ /**

const omit = (...keys) => self => {
return make(AST.struct(AST.getFields(self.ast).filter(f => !keys.includes(f.key)), O.none, O.none));
return make(AST.struct(AST.getFields(self.ast).filter(f => !keys.includes(f.key)), AST.indexSignatures(O.none, O.none, O.none)));
};

@@ -193,8 +193,3 @@ /**

exports.omit = omit;
const partial = self => {
if (AST.isStruct(self.ast)) {
return make(AST.struct(self.ast.fields.map(f => AST.field(f.key, f.value, true, f.readonly)), self.ast.stringIndexSignature, self.ast.symbolIndexSignature));
}
throw new Error("cannot `partial` non-Struct schemas");
};
const partial = self => make(AST.partial(self.ast));
/**

@@ -204,3 +199,3 @@ * @since 1.0.0

exports.partial = partial;
const stringIndexSignature = value => make(AST.struct([], O.some(AST.indexSignature(value.ast, true)), O.none));
const stringIndexSignature = value => make(AST.struct([], AST.indexSignatures(O.some(AST.indexSignature(value.ast, true)), O.none, O.none)));
/**

@@ -210,3 +205,3 @@ * @since 1.0.0

exports.stringIndexSignature = stringIndexSignature;
const symbolIndexSignature = value => make(AST.struct([], O.none, O.some(AST.indexSignature(value.ast, true))));
const symbolIndexSignature = value => make(AST.struct([], AST.indexSignatures(O.none, O.none, O.some(AST.indexSignature(value.ast, true)))));
/**

@@ -218,13 +213,5 @@ * @since 1.0.0

if (AST.isStruct(self.ast) && AST.isStruct(that.ast)) {
const a = AST.getStringIndexSignature(self.ast);
const b = AST.getSymbolIndexSignature(self.ast);
const c = AST.getStringIndexSignature(that.ast);
const d = AST.getSymbolIndexSignature(that.ast);
if (O.isSome(a) && O.isSome(b) || O.isSome(c) && O.isSome(d)) {
throw new Error("cannot `extend` double index signatures");
}
const struct = AST.struct(AST.getFields(self.ast).concat(AST.getFields(that.ast)), (0, _Function.pipe)(a, O.orElse(c)), (0, _Function.pipe)(b, O.orElse(d)));
return make(struct);
return make(AST.StructSemigroup.combine(that.ast)(self.ast));
}
throw new Error("cannot `extend` non-Struct schemas");
throw new Error("`extend` is not supported on this schema");
};

@@ -231,0 +218,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc