New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

suretype

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

suretype - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

4

dist/api/index.d.ts

@@ -9,5 +9,8 @@ import { CoreValidator } from "../validators/core/validator";

import { ObjectValidator } from "../validators/object/validator";
import { ArrayValidator } from "../validators/array/validator";
import { TupleValidator } from "../validators/tuple/validator";
import { AnyOfValidator } from "../validators/or/validator";
import { AllOfValidator } from "../validators/all-of/validator";
import { IfValidator } from "../validators/if/validator";
import { RawValidator } from "../validators/raw/validator";
import { RecursiveValidator } from "../validators/recursive/validator";

@@ -19,2 +22,3 @@ import { TypeOf } from "../validators/functional";

import { RecursiveValue } from "../validators/types";
export { CoreValidator, BaseValidator, BooleanValidator, NumberValidator, StringValidator, NullValidator, AnyValidator, ObjectValidator, ArrayValidator, TupleValidator, AnyOfValidator, AllOfValidator, IfValidator, RawValidator, RecursiveValidator, };
export declare const v: {

@@ -21,0 +25,0 @@ string: () => StringValidator<string>;

73

dist/api/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureNamed = exports.annotate = exports.suretype = exports.raw = exports.recursiveUnCast = exports.recursiveCast = exports.v = void 0;
const validator_1 = require("../validators/boolean/validator");
const validator_2 = require("../validators/number/validator");
const validator_3 = require("../validators/string/validator");
const validator_4 = require("../validators/null/validator");
const validator_5 = require("../validators/any/validator");
const validator_6 = require("../validators/object/validator");
const validator_7 = require("../validators/array/validator");
const validator_8 = require("../validators/tuple/validator");
const validator_9 = require("../validators/or/validator");
const validator_10 = require("../validators/all-of/validator");
const validator_11 = require("../validators/if/validator");
const validator_12 = require("../validators/raw/validator");
const validator_13 = require("../validators/recursive/validator");
exports.ensureNamed = exports.annotate = exports.suretype = exports.raw = exports.recursiveUnCast = exports.recursiveCast = exports.v = exports.RecursiveValidator = exports.RawValidator = exports.IfValidator = exports.AllOfValidator = exports.AnyOfValidator = exports.TupleValidator = exports.ArrayValidator = exports.ObjectValidator = exports.AnyValidator = exports.NullValidator = exports.StringValidator = exports.NumberValidator = exports.BooleanValidator = exports.BaseValidator = exports.CoreValidator = void 0;
const validator_1 = require("../validators/core/validator");
Object.defineProperty(exports, "CoreValidator", { enumerable: true, get: function () { return validator_1.CoreValidator; } });
const validator_2 = require("../validators/base/validator");
Object.defineProperty(exports, "BaseValidator", { enumerable: true, get: function () { return validator_2.BaseValidator; } });
const validator_3 = require("../validators/boolean/validator");
Object.defineProperty(exports, "BooleanValidator", { enumerable: true, get: function () { return validator_3.BooleanValidator; } });
const validator_4 = require("../validators/number/validator");
Object.defineProperty(exports, "NumberValidator", { enumerable: true, get: function () { return validator_4.NumberValidator; } });
const validator_5 = require("../validators/string/validator");
Object.defineProperty(exports, "StringValidator", { enumerable: true, get: function () { return validator_5.StringValidator; } });
const validator_6 = require("../validators/null/validator");
Object.defineProperty(exports, "NullValidator", { enumerable: true, get: function () { return validator_6.NullValidator; } });
const validator_7 = require("../validators/any/validator");
Object.defineProperty(exports, "AnyValidator", { enumerable: true, get: function () { return validator_7.AnyValidator; } });
const validator_8 = require("../validators/object/validator");
Object.defineProperty(exports, "ObjectValidator", { enumerable: true, get: function () { return validator_8.ObjectValidator; } });
const validator_9 = require("../validators/array/validator");
Object.defineProperty(exports, "ArrayValidator", { enumerable: true, get: function () { return validator_9.ArrayValidator; } });
const validator_10 = require("../validators/tuple/validator");
Object.defineProperty(exports, "TupleValidator", { enumerable: true, get: function () { return validator_10.TupleValidator; } });
const validator_11 = require("../validators/or/validator");
Object.defineProperty(exports, "AnyOfValidator", { enumerable: true, get: function () { return validator_11.AnyOfValidator; } });
const validator_12 = require("../validators/all-of/validator");
Object.defineProperty(exports, "AllOfValidator", { enumerable: true, get: function () { return validator_12.AllOfValidator; } });
const validator_13 = require("../validators/if/validator");
Object.defineProperty(exports, "IfValidator", { enumerable: true, get: function () { return validator_13.IfValidator; } });
const validator_14 = require("../validators/raw/validator");
Object.defineProperty(exports, "RawValidator", { enumerable: true, get: function () { return validator_14.RawValidator; } });
const validator_15 = require("../validators/recursive/validator");
Object.defineProperty(exports, "RecursiveValidator", { enumerable: true, get: function () { return validator_15.RecursiveValidator; } });
const validation_1 = require("../validation");
const annotations_1 = require("../annotations");
const string = () => new validator_3.StringValidator();
const number = () => new validator_2.NumberValidator();
const object = (obj) => new validator_6.ObjectValidator(obj);
const tuple = (types) => new validator_8.TupleValidator(types);
const array = (itemType) => new validator_7.ArrayValidator(itemType !== null && itemType !== void 0 ? itemType : any());
const string = () => new validator_5.StringValidator();
const number = () => new validator_4.NumberValidator();
const object = (obj) => new validator_8.ObjectValidator(obj);
const tuple = (types) => new validator_10.TupleValidator(types);
const array = (itemType) => new validator_9.ArrayValidator(itemType !== null && itemType !== void 0 ? itemType : any());
const arrayOrTuple = ((itemType) => typeof itemType === 'object' && itemType && Array.isArray(itemType)
? tuple(itemType)
: array(itemType));
const boolean = () => new validator_1.BooleanValidator();
const _null = () => new validator_4.NullValidator();
const anyOf = (validators) => new validator_9.AnyOfValidator(validators);
const allOf = (validators) => new validator_10.AllOfValidator(validators);
const any = () => new validator_5.AnyValidator();
const unknown = () => new validator_5.AnyValidator();
const _if = (validator) => new validator_11.IfValidator(validator);
const recursive = () => new validator_13.RecursiveValidator();
const boolean = () => new validator_3.BooleanValidator();
const _null = () => new validator_6.NullValidator();
const anyOf = (validators) => new validator_11.AnyOfValidator(validators);
const allOf = (validators) => new validator_12.AllOfValidator(validators);
const any = () => new validator_7.AnyValidator();
const unknown = () => new validator_7.AnyValidator();
const _if = (validator) => new validator_13.IfValidator(validator);
const recursive = () => new validator_15.RecursiveValidator();
exports.v = {

@@ -59,3 +76,3 @@ string,

exports.recursiveUnCast = recursiveUnCast;
const raw = (jsonSchema, fragment) => new validator_12.RawValidator(jsonSchema, fragment);
const raw = (jsonSchema, fragment) => new validator_14.RawValidator(jsonSchema, fragment);
exports.raw = raw;

@@ -62,0 +79,0 @@ /**

{
"name": "suretype",
"version": "2.2.0",
"version": "2.2.1",
"description": "Typesafe JSON (Schema) validator with magic powers 🧙‍♂️",

@@ -5,0 +5,0 @@ "author": "Gustaf Räntilä",

@@ -321,6 +321,7 @@ [![npm version][npm-image]][npm-url]

<img src="https://raw.githubusercontent.com/grantila/suretype/master/.github/images/suretype-typeconv.svg" width="25%" />
### Exporting using typeconv
<img src="https://raw.githubusercontent.com/grantila/suretype/master/.github/images/suretype-typeconv.svg" width="25%" />
A better (well, often much more practical) way of converting suretype validator schemas into JSON Schema is by using [`typeconv`][typeconv-github-url] [![npm version][typeconv-image]][typeconv-npm-url].

@@ -336,7 +337,7 @@

Example *from* Open API *to* SureType; `$ npx typeconv -f oapi -t st -o generated 'schemas/**/*.yml'`
Example *from* SureType *to* TypeScript; `$ npx typeconv -f st -t ts -o generated 'src/validators/**/*.ts'`
You can also convert **from** any of these formats ***into*** suretype validators!
Example *from* SureType *to* TypeScript; `$ npx typeconv -f st -t ts -o generated 'src/validators/**/*.ts'`
Example *from* Open API *to* SureType; `$ npx typeconv -f oapi -t st -o generated 'schemas/**/*.yml'`

@@ -343,0 +344,0 @@

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