Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raml-typesystem

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raml-typesystem - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

dist/tests/actualParse.d.ts

5

dist/src/exampleBuilder.js

@@ -0,1 +1,2 @@

"use strict";
var rt = require("./typesystem");

@@ -79,3 +80,3 @@ var meta = require("./metainfo");

if (typeof this._value === "string") {
return !this.isJSONString() && !this.isXMLString();
return !(this.isJSONString() || this.isXMLString());
}

@@ -114,3 +115,3 @@ return true;

return Example;
})();
}());
function exampleFromNominal(n) {

@@ -117,0 +118,0 @@ var tp = n.getAdapter(rt.InheritedType);

@@ -0,1 +1,2 @@

"use strict";
var ts = require("./typesystem");

@@ -39,3 +40,3 @@ var ms = require("./metainfo");

return FacetPrototype;
})();
}());
exports.FacetPrototype = FacetPrototype;

@@ -103,3 +104,3 @@ var Registry = (function () {

return Registry;
})();
}());
exports.Registry = Registry;

@@ -106,0 +107,0 @@ var instance;

@@ -1,2 +0,6 @@

export import nt = require("./nominal-types");
export import nominalTypes = require("./nominal-types");
export interface IValidationPath {
name: string;
child?: IValidationPath;
}
export interface IStatus {

@@ -10,2 +14,4 @@ isOk(): boolean;

getErrors(): IStatus[];
getValidationPath(): IValidationPath;
getValidationPathAsString(): string;
}

@@ -157,2 +163,2 @@ export interface ITypeFacet {

export declare function setPropertyConstructor(c: any): void;
export declare function toNominal(t: IParsedType, bt: (name: string) => nt.ITypeDefinition): nt.ITypeDefinition;
export declare function toNominal(t: IParsedType, bt: (name: string) => nominalTypes.ITypeDefinition): nominalTypes.ITypeDefinition;

@@ -0,1 +1,2 @@

"use strict";
var ts = require("./typesystem");

@@ -9,3 +10,3 @@ var tc = require("./parse");

var nm = require("./nominals");
exports.nt = require("./nominal-types");
exports.nominalTypes = require("./nominal-types");
function loadTypeCollection(data) {

@@ -136,3 +137,3 @@ return tc.parseJSONTypeCollection(data, ts.builtInRegistry());

return TypeConstructor;
})();
}());
exports.TypeConstructor = TypeConstructor;

@@ -139,0 +140,0 @@ function setPropertyConstructor(c) {

3

dist/src/jsonSchemaWriter.js

@@ -0,1 +1,2 @@

"use strict";
var ts = require("./typesystem");

@@ -169,4 +170,4 @@ var restr = require("./restrictions");

return SchemaWriter;
})();
}());
exports.SchemaWriter = SchemaWriter;
//# sourceMappingURL=jsonSchemaWriter.js.map

@@ -0,1 +1,2 @@

"use strict";
var __extends = (this && this.__extends) || function (d, b) {

@@ -29,3 +30,3 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

return MetaInfo;
})(ts.TypeInformation);
}(ts.TypeInformation));
exports.MetaInfo = MetaInfo;

@@ -38,3 +39,3 @@ var Description = (function (_super) {

return Description;
})(MetaInfo);
}(MetaInfo));
exports.Description = Description;

@@ -47,3 +48,3 @@ var NotScalar = (function (_super) {

return NotScalar;
})(MetaInfo);
}(MetaInfo));
exports.NotScalar = NotScalar;

@@ -56,3 +57,3 @@ var DisplayName = (function (_super) {

return DisplayName;
})(MetaInfo);
}(MetaInfo));
exports.DisplayName = DisplayName;

@@ -65,3 +66,3 @@ var Usage = (function (_super) {

return Usage;
})(MetaInfo);
}(MetaInfo));
exports.Usage = Usage;

@@ -84,3 +85,3 @@ var Annotation = (function (_super) {

}
var valOwner = tp.validateDirect(q, true);
var valOwner = tp.validateDirect(q, true, false);
if (!valOwner.isOk()) {

@@ -94,3 +95,3 @@ var res = new typesystem_1.Status(typesystem_1.Status.OK, 0, "invalid annotation value" + valOwner.getMessage(), this);

return Annotation;
})(MetaInfo);
}(MetaInfo));
exports.Annotation = Annotation;

@@ -112,3 +113,3 @@ var FacetDeclaration = (function (_super) {

return FacetDeclaration;
})(MetaInfo);
}(MetaInfo));
exports.FacetDeclaration = FacetDeclaration;

@@ -121,7 +122,7 @@ var CustomFacet = (function (_super) {

return CustomFacet;
})(MetaInfo);
}(MetaInfo));
exports.CustomFacet = CustomFacet;
function parseExampleIfNeeded(val, type) {
if (typeof val === 'string') {
if (type.isObject() || type.isArray()) {
if (type.isObject() || type.isArray() || type.isExternal()) {
var exampleString = val;

@@ -134,2 +135,6 @@ var firstChar = exampleString.trim().charAt(0);

catch (e) {
if (type.isObject() || type.isArray()) {
var c = new typesystem_1.Status(typesystem_1.Status.ERROR, 0, "Can not parse JSON example:" + e.message, this);
return c;
}
}

@@ -154,6 +159,14 @@ }

Example.prototype.validateSelf = function (registry) {
var valOwner = this.owner().validateDirect(parseExampleIfNeeded(this.value(), this.owner()), true);
var rr = parseExampleIfNeeded(this.value(), this.owner());
if (rr instanceof ts.Status) {
rr.setValidationPath({ name: "example" });
return rr;
}
var valOwner = this.owner().validateDirect(rr, true, false);
if (!valOwner.isOk()) {
if (typeof this.value() === "string") {
}
var c = new typesystem_1.Status(typesystem_1.Status.ERROR, 0, "using invalid `example`:" + valOwner.getMessage(), this);
valOwner.getErrors().forEach(function (x) { return c.addSubStatus(x); });
c.setValidationPath({ name: "example" });
return c;

@@ -167,3 +180,3 @@ }

return Example;
})(MetaInfo);
}(MetaInfo));
exports.Example = Example;

@@ -182,3 +195,3 @@ var Required = (function (_super) {

return Required;
})(MetaInfo);
}(MetaInfo));
exports.Required = Required;

@@ -194,3 +207,3 @@ var AllowedTargets = (function (_super) {

return AllowedTargets;
})(MetaInfo);
}(MetaInfo));
exports.AllowedTargets = AllowedTargets;

@@ -222,3 +235,12 @@ var Examples = (function (_super) {

var example = parseExampleIfNeeded(v[x].content, _this.owner());
rs.addSubStatus(_this.owner().validateDirect(example, true));
if (example instanceof ts.Status) {
example.setValidationPath({ name: x });
rs.addSubStatus(example);
return;
}
var res = _this.owner().validateDirect(example, true, false);
res.getErrors().forEach(function (ex) {
rs.addSubStatus(ex);
ex.setValidationPath({ name: x, child: { name: "content" } });
});
Object.keys(v[x]).forEach(function (key) {

@@ -239,3 +261,3 @@ if (key.charAt(0) == '(' && key.charAt(key.length - 1) == ')') {

return Examples;
})(MetaInfo);
}(MetaInfo));
exports.Examples = Examples;

@@ -248,3 +270,3 @@ var XMLInfo = (function (_super) {

return XMLInfo;
})(MetaInfo);
}(MetaInfo));
exports.XMLInfo = XMLInfo;

@@ -264,3 +286,3 @@ var Default = (function (_super) {

return Default;
})(MetaInfo);
}(MetaInfo));
exports.Default = Default;

@@ -295,3 +317,3 @@ var Discriminator = (function (_super) {

return Discriminator;
})(ts.TypeInformation);
}(ts.TypeInformation));
exports.Discriminator = Discriminator;

@@ -329,4 +351,4 @@ var DiscriminatorValue = (function (_super) {

return DiscriminatorValue;
})(ts.TypeInformation);
}(ts.TypeInformation));
exports.DiscriminatorValue = DiscriminatorValue;
//# sourceMappingURL=metainfo.js.map

@@ -111,3 +111,2 @@ export interface INamedEntity {

domain(): ITypeDefinition;
getFacetValidator(): FacetValidator;
isRequired(): boolean;

@@ -114,0 +113,0 @@ isMultiValue(): boolean;

@@ -0,1 +1,2 @@

"use strict";
var ValueRequirement = (function () {

@@ -7,4 +8,4 @@ function ValueRequirement(name, value) {

return ValueRequirement;
})();
}());
exports.ValueRequirement = ValueRequirement;
//# sourceMappingURL=nominal-interfaces.js.map

@@ -0,1 +1,2 @@

"use strict";
var __extends = (this && this.__extends) || function (d, b) {

@@ -32,3 +33,3 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

return Adaptable;
})();
}());
exports.Adaptable = Adaptable;

@@ -67,3 +68,3 @@ var Described = (function (_super) {

return Described;
})(Adaptable);
}(Adaptable));
exports.Described = Described;

@@ -87,3 +88,3 @@ var Annotation = (function (_super) {

return Annotation;
})(Described);
}(Described));
exports.Annotation = Annotation;

@@ -94,3 +95,3 @@ var Empty = (function () {

return Empty;
})();
}());
exports.Empty = Empty;

@@ -113,3 +114,3 @@ var EmptyUniverse = (function () {

return EmptyUniverse;
})();
}());
var emptyUniverse = new EmptyUniverse();

@@ -303,3 +304,2 @@ var ebuilder = require("./exampleBuilder");

}
var sp = this.allSuperTypes();
var mm = {};

@@ -309,11 +309,2 @@ for (var q in this.fixedFacets) {

}
sp.forEach(function (x) {
if (x instanceof AbstractType) {
x.contributeFacets(mm);
var ff = x.fixedFacets;
for (var q in ff) {
mm[q] = ff[q];
}
}
});
this.contributeFacets(mm);

@@ -527,3 +518,3 @@ this._af = mm;

return AbstractType;
})(Described);
}(Described));
exports.AbstractType = AbstractType;

@@ -551,3 +542,3 @@ var ValueType = (function (_super) {

return ValueType;
})(AbstractType);
}(AbstractType));
exports.ValueType = ValueType;

@@ -595,3 +586,3 @@ var StructuredType = (function (_super) {

return StructuredType;
})(AbstractType);
}(AbstractType));
exports.StructuredType = StructuredType;

@@ -746,3 +737,3 @@ var Property = (function (_super) {

return Property;
})(Described);
}(Described));
exports.Property = Property;

@@ -790,3 +781,3 @@ var Union = (function (_super) {

return Union;
})(AbstractType);
}(AbstractType));
exports.Union = Union;

@@ -823,3 +814,3 @@ var Array = (function (_super) {

return Array;
})(AbstractType);
}(AbstractType));
exports.Array = Array;

@@ -853,4 +844,4 @@ var ExternalType = (function (_super) {

return ExternalType;
})(StructuredType);
}(StructuredType));
exports.ExternalType = ExternalType;
//# sourceMappingURL=nominal-types.js.map

@@ -0,1 +1,2 @@

"use strict";
var ts = require("./typesystem");

@@ -24,3 +25,3 @@ var nt = require("./nominal-types");

if (t.isBuiltin()) {
var s = callback(t.name());
var s = (t.name() != "any" && t.name() != "array") ? callback(t.name()) : null;
if (!s) {

@@ -52,2 +53,5 @@ if (t.isScalar()) {

var ut = new nt.Union(t.name(), null);
if (t.superTypes().length == 0) {
ut._superTypes.push(toNominal(ts.UNION, callback, customizer));
}
t.typeFamily().forEach(function (x) {

@@ -82,3 +86,2 @@ if (ut.left == null) {

}
t.putExtra(NOMINAL, vs);
t.superTypes().forEach(function (x) {

@@ -93,2 +96,17 @@ var mn = toNominal(x, callback);

});
if (t.isEmpty()) {
if (t.isArray() && t.superTypes().length == 1 && t.superTypes()[0].isAnonymous()) {
var q = vs.superTypes()[0];
q.setName(t.name());
q._subTypes = q._subTypes.filter(function (x) { return x != vs; });
vs = q;
}
if (t.isUnion() && t.superTypes().length == 1 && t.superTypes()[0].isAnonymous()) {
var q = vs.superTypes()[0];
q.setName(t.name());
q._subTypes = q._subTypes.filter(function (x) { return x != vs; });
vs = q;
}
}
t.putExtra(NOMINAL, vs);
var proto = parse.toProto(t);

@@ -95,0 +113,0 @@ proto.properties.forEach(function (x) {

@@ -6,2 +6,3 @@ import ts = require("./typesystem");

import { TypeRegistry } from "./typesystem";
import su = require('./schemaUtil');
export declare enum NodeKind {

@@ -19,4 +20,4 @@ SCALAR = 0,

}
export declare function parseJSON(name: string, n: any, r?: ts.TypeRegistry): ts.AbstractType;
export declare function parseJSONTypeCollection(n: any, r?: ts.TypeRegistry): TypeCollection;
export declare function parseJSON(name: string, n: any, r?: ts.TypeRegistry, provider?: su.IContentProvider): ts.AbstractType;
export declare function parseJSONTypeCollection(n: any, r?: ts.TypeRegistry, provider?: su.IContentProvider): TypeCollection;
export declare class PropertyBean {

@@ -23,0 +24,0 @@ id: string;

@@ -0,1 +1,2 @@

"use strict";
var __extends = (this && this.__extends) || function (d, b) {

@@ -23,3 +24,3 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

var JSObjectNode = (function () {
function JSObjectNode(_key, obj, inArr) {
function JSObjectNode(_key, obj, inArr, provider) {
if (inArr === void 0) { inArr = false; }

@@ -29,2 +30,3 @@ this._key = _key;

this.inArr = inArr;
this.provider = provider;
}

@@ -50,3 +52,3 @@ JSObjectNode.prototype.value = function () {

if (this.obj.hasOwnProperty(k)) {
return new JSObjectNode(k, this.obj[k]);
return new JSObjectNode(k, this.obj[k], false, this.contentProvider());
}

@@ -58,6 +60,6 @@ return null;

if (Array.isArray(this.obj)) {
return this.obj.map(function (x) { return new JSObjectNode(null, x, true); });
return this.obj.map(function (x) { return new JSObjectNode(null, x, true, _this.contentProvider()); });
}
else if (this.obj && typeof this.obj == "object") {
return Object.keys(this.obj).map(function (x) { return new JSObjectNode(x, _this.obj[x]); });
return Object.keys(this.obj).map(function (x) { return new JSObjectNode(x, _this.obj[x], false, _this.provider); });
}

@@ -78,12 +80,16 @@ return [];

};
JSObjectNode.prototype.contentProvider = function () {
return this.provider;
};
;
return JSObjectNode;
})();
function parseJSON(name, n, r) {
}());
function parseJSON(name, n, r, provider) {
if (r === void 0) { r = ts.builtInRegistry(); }
return parse(name, new JSObjectNode(null, n), r);
return parse(name, new JSObjectNode(null, n, false, provider), r);
}
exports.parseJSON = parseJSON;
function parseJSONTypeCollection(n, r) {
function parseJSONTypeCollection(n, r, provider) {
if (r === void 0) { r = ts.builtInRegistry(); }
return parseTypeCollection(new JSObjectNode(null, n), r);
return parseTypeCollection(new JSObjectNode(null, n, false, provider), r);
}

@@ -112,3 +118,3 @@ exports.parseJSONTypeCollection = parseJSONTypeCollection;

return PropertyBean;
})();
}());
exports.PropertyBean = PropertyBean;

@@ -174,3 +180,3 @@ var TypeCollection = (function () {

return TypeCollection;
})();
}());
exports.TypeCollection = TypeCollection;

@@ -224,7 +230,8 @@ var AccumulatingRegistry = (function (_super) {

return AccumulatingRegistry;
})(ts.TypeRegistry);
}(ts.TypeRegistry));
exports.AccumulatingRegistry = AccumulatingRegistry;
function parseTypes(n, tr) {
if (tr === void 0) { tr = ts.builtInRegistry(); }
return parseTypeCollection(new JSObjectNode(null, n), tr);
var provider = n.provider && n.provider();
return parseTypeCollection(new JSObjectNode(null, n, false, provider), tr);
}

@@ -264,3 +271,3 @@ exports.parseTypes = parseTypes;

return WrapArrayNode;
})();
}());
function transformToArray(n) {

@@ -416,3 +423,3 @@ return new WrapArrayNode(n);

return TypeProto;
})();
}());
exports.TypeProto = TypeProto;

@@ -544,4 +551,5 @@ function toProto(type) {

if (annotation === void 0) { annotation = false; }
var provider = n.contentProvider ? n.contentProvider() : null;
if (n.kind() == NodeKind.SCALAR) {
var sp = n.value() ? typeExpressions.parseToType("" + n.value(), r) : ts.STRING;
var sp = n.value() ? typeExpressions.parseToType("" + n.value(), r, provider) : ts.STRING;
if (name == null) {

@@ -560,3 +568,3 @@ return sp;

n.children().forEach(function (x) {
supers.push(typeExpressions.parseToType("" + x.value(), r));
supers.push(typeExpressions.parseToType("" + x.value(), r, provider));
});

@@ -595,6 +603,6 @@ var res = ts.derive(name, supers);

if (tp.kind() == NodeKind.SCALAR) {
superTypes = [typeExpressions.parseToType("" + tp.value(), r)];
superTypes = [typeExpressions.parseToType("" + tp.value(), r, provider)];
}
else if (tp.kind() == NodeKind.ARRAY) {
superTypes = tp.children().map(function (x) { return x.value(); }).map(function (y) { return typeExpressions.parseToType("" + y, r); });
superTypes = tp.children().map(function (x) { return x.value(); }).map(function (y) { return typeExpressions.parseToType("" + y, r, provider); });
}

@@ -632,2 +640,9 @@ }

}
if (key == "items") {
if (result.isSubTypeOf(ts.ARRAY)) {
var tp = parse(null, x, r);
actualResult.addMeta(new restrictions_2.ComponentShouldBeOfType(tp));
return;
}
}
if (key === "facets") {

@@ -634,0 +649,0 @@ return;

/// <reference path="../../typings/main.d.ts" />
import ts = require("./typesystem");
import su = require("./schemaUtil");
import { Constraint } from "./typesystem";
import { AbstractType } from "./typesystem";
export declare type IValidationPath = ts.IValidationPath;
export declare abstract class MatchesProperty extends ts.Constraint {

@@ -9,4 +11,5 @@ private _type;

constructor(_type: ts.AbstractType);
check(i: any): ts.Status;
validateProp(i: any, n: string, t: ts.AbstractType): ts.Status;
check(i: any, p: ts.IValidationPath): ts.Status;
patchPath(p: ts.IValidationPath): IValidationPath;
validateProp(i: any, n: string, t: ts.AbstractType, q: ts.IValidationPath): ts.Status;
abstract propId(): string;

@@ -17,3 +20,4 @@ validateSelf(registry: ts.TypeRegistry): ts.Status;

private _value;
constructor(_value: string);
private provider;
constructor(_value: string, provider: su.IContentProvider);
value(): string;

@@ -48,3 +52,3 @@ check(i: any): ts.Status;

matches(s: string): boolean;
check(i: any): ts.Status;
check(i: any, p: ts.IValidationPath): ts.Status;
requiredType(): ts.InheritedType;

@@ -70,3 +74,3 @@ propId(): string;

composeWith(t: ts.Constraint): ts.Constraint;
check(i: any): ts.Status;
check(i: any, p: ts.IValidationPath): ts.Status;
}

@@ -83,3 +87,3 @@ export declare class AdditionalPropertyIs extends MatchesProperty {

composeWith(t: ts.Constraint): ts.Constraint;
check(i: any): ts.Status;
check(i: any, p: ts.IValidationPath): ts.Status;
}

@@ -86,0 +90,0 @@ export declare abstract class FacetRestriction<T> extends ts.Constraint {

@@ -0,1 +1,2 @@

"use strict";
var __extends = (this && this.__extends) || function (d, b) {

@@ -20,12 +21,42 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

};
MatchesProperty.prototype.check = function (i) {
MatchesProperty.prototype.check = function (i, p) {
throw new Error("Should be never called");
};
MatchesProperty.prototype.validateProp = function (i, n, t) {
MatchesProperty.prototype.patchPath = function (p) {
if (!p) {
return { name: this.propId() };
}
else {
var c = p;
var r = null;
var cp = null;
while (c) {
if (!r) {
r = { name: c.name };
cp = r;
}
else {
var news = { name: c.name };
cp.child = news;
c = c.child;
cp = news;
}
}
r.child = { name: this.propId() };
return r;
}
};
MatchesProperty.prototype.validateProp = function (i, n, t, q) {
var vl = i[n];
if (vl !== null && vl !== undefined) {
var st = t.validate(vl);
var st = t.validate(vl, true, false);
if (!st.isOk()) {
if (t.isUnknown() || t.isRecurrent()) {
var s = new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "Validating instance against unknown type:" + t.name(), this);
s.setValidationPath(this.patchPath(q));
return s;
}
var s = new typesystem_2.Status(typesystem_2.Status.OK, 0, "", this);
st.getErrors().forEach(function (x) { return s.addSubStatus(x); });
s.setValidationPath(this.patchPath(q));
return s;

@@ -40,3 +71,5 @@ }

if (!st.isOk()) {
return new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " range type has error:" + st.getMessage(), this);
var p = new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " range type has error:" + st.getMessage(), this);
p.setValidationPath({ name: this.propId() });
return p;
}

@@ -46,3 +79,5 @@ return st;

if (this._type.isSubTypeOf(ts.UNKNOWN) || this._type.isSubTypeOf(ts.RECURRENT)) {
return new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " refers to unknown type " + this._type.name(), this);
var p = new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " refers to unknown type " + this._type.name(), this);
p.setValidationPath({ name: this.propId() });
return p;
}

@@ -52,3 +87,5 @@ if (this._type.isUnion()) {

if (ui) {
return new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " refers to unknown type " + ui.name(), this);
var p = new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " refers to unknown type " + ui.name(), this);
p.setValidationPath({ name: this.propId() });
return p;
}

@@ -59,9 +96,10 @@ }

return MatchesProperty;
})(ts.Constraint);
}(ts.Constraint));
exports.MatchesProperty = MatchesProperty;
var MatchToSchema = (function (_super) {
__extends(MatchToSchema, _super);
function MatchToSchema(_value) {
function MatchToSchema(_value, provider) {
_super.call(this);
this._value = _value;
this.provider = provider;
}

@@ -76,3 +114,3 @@ MatchToSchema.prototype.value = function () {

try {
so = su.getJSONSchema(strVal);
so = su.getJSONSchema(strVal, this.provider);
}

@@ -114,3 +152,3 @@ catch (e) {

return MatchToSchema;
})(ts.Constraint);
}(ts.Constraint));
exports.MatchToSchema = MatchToSchema;

@@ -151,3 +189,7 @@ var KnownPropertyRestriction = (function (_super) {

var s = new ts.Status(ts.Status.OK, 0, "", this);
Object.keys(nm).forEach(function (x) { return s.addSubStatus(ts.error("Unknown property:" + x, _this)); });
Object.keys(nm).forEach(function (x) {
var err = ts.error("Unknown property:" + x, _this);
err.setValidationPath({ name: x });
s.addSubStatus(err);
});
return s;

@@ -179,3 +221,3 @@ }

return KnownPropertyRestriction;
})(ts.Constraint);
}(ts.Constraint));
exports.KnownPropertyRestriction = KnownPropertyRestriction;

@@ -189,3 +231,3 @@ var HasProperty = (function (_super) {

HasProperty.prototype.check = function (i) {
if (i && typeof i == 'object') {
if (i && typeof i == 'object' && !Array.isArray(i)) {
if (i.hasOwnProperty(this.name)) {

@@ -217,3 +259,3 @@ return ts.OK_STATUS;

return HasProperty;
})(ts.Constraint);
}(ts.Constraint));
exports.HasProperty = HasProperty;

@@ -230,6 +272,6 @@ var PropertyIs = (function (_super) {

};
PropertyIs.prototype.check = function (i) {
PropertyIs.prototype.check = function (i, p) {
if (i && typeof i === "object") {
if (i.hasOwnProperty(this.name)) {
var st = this.validateProp(i, this.name, this.type);
var st = this.validateProp(i, this.name, this.type, p);
return st;

@@ -282,3 +324,3 @@ }

return PropertyIs;
})(MatchesProperty);
}(MatchesProperty));
exports.PropertyIs = PropertyIs;

@@ -355,3 +397,3 @@ var MapPropertyIs = (function (_super) {

};
MapPropertyIs.prototype.check = function (i) {
MapPropertyIs.prototype.check = function (i, p) {
var _this = this;

@@ -363,3 +405,3 @@ if (i) {

if (n.match(_this.regexp)) {
var stat = _this.validateProp(i, n, _this.type);
var stat = _this.validateProp(i, n, _this.type, p);
if (!stat.isOk()) {

@@ -376,3 +418,3 @@ rs.addSubStatus(stat);

return MapPropertyIs;
})(MatchesProperty);
}(MatchesProperty));
exports.MapPropertyIs = MapPropertyIs;

@@ -439,3 +481,3 @@ var AdditionalPropertyIs = (function (_super) {

};
AdditionalPropertyIs.prototype.check = function (i) {
AdditionalPropertyIs.prototype.check = function (i, p) {
var _this = this;

@@ -447,3 +489,3 @@ var t = this.type;

if (!_this.match(n)) {
var stat = _this.validateProp(i, n, t);
var stat = _this.validateProp(i, n, t, p);
if (!stat.isOk()) {

@@ -458,3 +500,3 @@ res.addSubStatus(stat);

return AdditionalPropertyIs;
})(MatchesProperty);
}(MatchesProperty));
exports.AdditionalPropertyIs = AdditionalPropertyIs;

@@ -468,7 +510,11 @@ var FacetRestriction = (function (_super) {

if (!this.owner().isSubTypeOf(this.requiredType())) {
return ts.error(this.facetName() + " facet can only be used with " + this.requiredType().name() + " types", this);
var rs = ts.error(this.facetName() + " facet can only be used with " + this.requiredType().name() + " types", this);
rs.setValidationPath({ name: this.facetName() });
return rs;
}
var m = this.checkValue();
if (m) {
return ts.error(m, this);
var rs = ts.error(m, this);
rs.setValidationPath({ name: this.facetName() });
return rs;
}

@@ -478,3 +524,3 @@ return ts.OK_STATUS;

return FacetRestriction;
})(ts.Constraint);
}(ts.Constraint));
exports.FacetRestriction = FacetRestriction;

@@ -592,3 +638,3 @@ function is_int(value) {

return MinMaxRestriction;
})(FacetRestriction);
}(FacetRestriction));
exports.MinMaxRestriction = MinMaxRestriction;

@@ -607,3 +653,3 @@ var Maximum = (function (_super) {

return Maximum;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.Maximum = Maximum;

@@ -622,3 +668,3 @@ var Minimum = (function (_super) {

return Minimum;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.Minimum = Minimum;

@@ -639,3 +685,3 @@ var MaxItems = (function (_super) {

return MaxItems;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.MaxItems = MaxItems;

@@ -656,3 +702,3 @@ var MinItems = (function (_super) {

return MinItems;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.MinItems = MinItems;

@@ -674,3 +720,3 @@ var MaxLength = (function (_super) {

return MaxLength;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.MaxLength = MaxLength;

@@ -692,3 +738,3 @@ var MinLength = (function (_super) {

return MinLength;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.MinLength = MinLength;

@@ -707,3 +753,3 @@ var MaxProperties = (function (_super) {

return MaxProperties;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.MaxProperties = MaxProperties;

@@ -722,3 +768,3 @@ var MinProperties = (function (_super) {

return MinProperties;
})(MinMaxRestriction);
}(MinMaxRestriction));
exports.MinProperties = MinProperties;

@@ -761,3 +807,3 @@ var UniqueItems = (function (_super) {

return UniqueItems;
})(FacetRestriction);
}(FacetRestriction));
exports.UniqueItems = UniqueItems;

@@ -780,3 +826,5 @@ var ComponentShouldBeOfType = (function (_super) {

for (var j = 0; j < ar.length; j++) {
rs.addSubStatus(this.type.validate(ar[j]));
var ss = this.type.validate(ar[j], true);
ss.setValidationPath({ name: "" + j });
rs.addSubStatus(ss);
}

@@ -836,3 +884,3 @@ }

return ComponentShouldBeOfType;
})(FacetRestriction);
}(FacetRestriction));
exports.ComponentShouldBeOfType = ComponentShouldBeOfType;

@@ -887,3 +935,3 @@ var Pattern = (function (_super) {

return Pattern;
})(FacetRestriction);
}(FacetRestriction));
exports.Pattern = Pattern;

@@ -937,3 +985,3 @@ var Enum = (function (_super) {

if (!res.isOk()) {
result = "all enum values should be valid instances of declaring type";
result = res.getMessage();
}

@@ -951,3 +999,3 @@ });

return Enum;
})(FacetRestriction);
}(FacetRestriction));
exports.Enum = Enum;

@@ -954,0 +1002,0 @@ function optimize(r) {

@@ -6,9 +6,24 @@ /// <reference path="../../typings/main.d.ts" />

}
export interface IContentProvider {
contextPath(): string;
normalizePath(url: string): string;
content(reference: string): string;
hasAsyncRequests(): boolean;
resolvePath(context: string, relativePath: string): string;
isAbsolutePath(uri: string): boolean;
}
export declare class JSONSchemaObject {
private schema;
private provider;
jsonSchema: any;
constructor(schema: string);
constructor(schema: string, provider: IContentProvider);
getType(): string;
validateObject(object: any): void;
validate(content: string): void;
validateObject(object: any): any;
getMissingReferences(references: any[], normalize?: boolean): any[];
private getSchemaPath(schema, normalize?);
private patchSchema(schema);
private collectRefContainers(rootObject, refContainers);
validate(content: any, alreadyAccepted?: any[]): void;
private setupId(json, path);
private acceptErrors(key, errors, throwImmediately?);
}

@@ -33,4 +48,4 @@ export interface ValidationError {

}
export declare function getJSONSchema(content: string): any;
export declare function getJSONSchema(content: string, provider: IContentProvider): any;
export declare function getXMLSchema(content: string): any;
export declare function createSchema(content: string): Schema;
export declare function createSchema(content: string, provider: IContentProvider): Schema;

@@ -1,2 +0,3 @@

var lru = require("lrucache");
"use strict";
var _ = require("underscore");
var ZSchema = require("z-schema");

@@ -7,9 +8,51 @@ var ValidationResult = (function () {

return ValidationResult;
})();
}());
exports.ValidationResult = ValidationResult;
var globalCache = lru(400);
var useLint = true;
var ErrorsCache = (function () {
function ErrorsCache() {
this.errors = {};
}
ErrorsCache.prototype.getValue = function (key) {
return this.errors[key];
};
ErrorsCache.prototype.setValue = function (key, value) {
this.errors[key] = value;
};
return ErrorsCache;
}());
var globalCache = new ErrorsCache();
var DummyProvider = (function () {
function DummyProvider() {
}
DummyProvider.prototype.contextPath = function () {
return "";
};
DummyProvider.prototype.normalizePath = function (url) {
return "";
};
DummyProvider.prototype.content = function (reference) {
return "";
};
DummyProvider.prototype.hasAsyncRequests = function () {
return false;
};
DummyProvider.prototype.resolvePath = function (context, relativePath) {
return "";
};
DummyProvider.prototype.isAbsolutePath = function (uri) {
return false;
};
return DummyProvider;
}());
var JSONSchemaObject = (function () {
function JSONSchemaObject(schema) {
function JSONSchemaObject(schema, provider) {
this.schema = schema;
this.provider = provider;
if (!provider) {
this.provider = new DummyProvider();
}
else {
this.provider = provider;
}
if (!schema || schema.trim().length == 0 || schema.trim().charAt(0) != '{') {

@@ -23,3 +66,3 @@ throw new Error("Invalid JSON schema content");

catch (err) {
throw new Error("It is not JSON schema");
throw new Error("It is not JSON schema(can not parse JSON:" + err.message + ")");
}

@@ -31,2 +74,3 @@ if (!jsonSchemaObject) {

var api = require('json-schema-compatibility');
this.setupId(jsonSchemaObject, this.provider.contextPath());
jsonSchemaObject = api.v4(jsonSchemaObject);

@@ -46,24 +90,152 @@ }

};
JSONSchemaObject.prototype.validate = function (content) {
var key = content + this.schema;
var c = globalCache.get(key);
if (c) {
if (c instanceof Error) {
throw c;
JSONSchemaObject.prototype.getMissingReferences = function (references, normalize) {
var _this = this;
if (normalize === void 0) { normalize = false; }
var result = [];
var validator = new ZSchema();
references.forEach(function (references) { return validator.setRemoteReference(references.reference, references.content || {}); });
validator.validateSchema(this.jsonSchema);
var result = validator.getMissingRemoteReferences();
return normalize ? result.map(function (reference) { return _this.provider.normalizePath(reference); }) : result;
};
JSONSchemaObject.prototype.getSchemaPath = function (schema, normalize) {
if (normalize === void 0) { normalize = false; }
if (!schema) {
return "";
}
if (!schema.id) {
return "";
}
var id = schema.id.trim();
if (!(id.lastIndexOf('#') === id.length - 1)) {
return id;
}
var result = id.substr(0, id.length - 1);
if (!normalize) {
return result;
}
return this.provider.normalizePath(result);
};
JSONSchemaObject.prototype.patchSchema = function (schema) {
var _this = this;
if (!schema) {
return schema;
}
if (!schema.id) {
return schema;
}
var id = schema.id.trim();
if (!(id.lastIndexOf('#') === id.length - 1)) {
return schema;
}
;
var currentPath = id.substr(0, id.length - 1);
if (!this.provider.isAbsolutePath(currentPath)) {
return schema;
}
currentPath = this.provider.normalizePath(currentPath);
var refContainers = [];
this.collectRefContainers(schema, refContainers);
refContainers.forEach(function (refConatiner) {
var reference = refConatiner['$ref'];
if (typeof reference !== 'string') {
return;
}
if (reference.indexOf('#') === 0) {
return;
}
if (!_this.provider.isAbsolutePath(reference)) {
refConatiner['$ref'] = _this.provider.resolvePath(currentPath, reference).replace(/\\/g, '/');
}
});
};
JSONSchemaObject.prototype.collectRefContainers = function (rootObject, refContainers) {
var _this = this;
Object.keys(rootObject).forEach(function (key) {
if (key === '$ref') {
refContainers.push(rootObject);
return;
}
if (!rootObject[key]) {
return;
}
if (typeof rootObject[key] === 'object') {
_this.collectRefContainers(rootObject[key], refContainers);
}
});
};
JSONSchemaObject.prototype.validate = function (content, alreadyAccepted) {
var _this = this;
if (alreadyAccepted === void 0) { alreadyAccepted = []; }
var key = content + this.schema + this.provider.contextPath();
var error = globalCache.getValue(key);
if (error) {
if (error instanceof Error) {
throw error;
}
return;
}
var validator = new ZSchema();
var valid = validator.validate(JSON.parse(content), this.jsonSchema);
var errors = validator.getLastErrors();
alreadyAccepted.forEach(function (accepted) { return validator.setRemoteReference(accepted.reference, accepted.content); });
validator.validate(JSON.parse(content), this.jsonSchema);
var missingReferences = validator.getMissingRemoteReferences().filter(function (reference) { return !_.find(alreadyAccepted, function (acceptedReference) { return reference === acceptedReference.reference; }); });
if (!missingReferences || missingReferences.length === 0) {
this.acceptErrors(key, validator.getLastErrors(), true);
return;
}
var acceptedReferences = [];
missingReferences.forEach(function (reference) {
var remoteSchemeContent;
var result = { reference: reference };
try {
var api = require('json-schema-compatibility');
var jsonObject = JSON.parse(_this.provider.content(reference));
_this.setupId(jsonObject, _this.provider.normalizePath(reference));
remoteSchemeContent = api.v4(jsonObject);
delete remoteSchemeContent['$schema'];
result.content = remoteSchemeContent;
}
catch (exception) {
result.error = exception;
}
finally {
acceptedReferences.push(result);
}
});
if (this.provider.hasAsyncRequests()) {
return;
}
acceptedReferences.forEach(function (accepted) {
alreadyAccepted.push(accepted);
});
this.validate(content, alreadyAccepted);
};
JSONSchemaObject.prototype.setupId = function (json, path) {
if (!path) {
return;
}
if (!json) {
return;
}
if (json.id) {
return;
}
json.id = path.replace(/\\/g, '/') + '#';
this.patchSchema(json);
};
JSONSchemaObject.prototype.acceptErrors = function (key, errors, throwImmediately) {
if (throwImmediately === void 0) { throwImmediately = false; }
if (errors && errors.length > 0) {
var res = new Error("Content is not valid according to schema:" + errors.map(function (x) { return x.message + " " + x.params; }).join(", "));
res.errors = errors;
globalCache.set(key, res);
throw res;
globalCache.setValue(key, res);
if (throwImmediately) {
throw res;
}
return;
}
globalCache.set(key, 1);
globalCache.setValue(key, 1);
};
return JSONSchemaObject;
})();
}());
exports.JSONSchemaObject = JSONSchemaObject;

@@ -85,11 +257,11 @@ var XMLSchemaObject = (function () {

return XMLSchemaObject;
})();
}());
exports.XMLSchemaObject = XMLSchemaObject;
function getJSONSchema(content) {
var rs = useLint ? globalCache.get(content) : false;
if (rs) {
function getJSONSchema(content, provider) {
var rs = useLint ? globalCache.getValue(content) : false;
if (rs && rs.provider) {
return rs;
}
var res = new JSONSchemaObject(content);
globalCache.set(content, res);
var res = new JSONSchemaObject(content, provider);
globalCache.setValue(content, res);
return res;

@@ -99,3 +271,3 @@ }

function getXMLSchema(content) {
var rs = useLint ? globalCache.get(content) : false;
var rs = useLint ? globalCache.getValue(content) : false;
if (rs) {

@@ -106,8 +278,8 @@ return rs;

if (useLint) {
globalCache.set(content, res);
globalCache.setValue(content, res);
}
}
exports.getXMLSchema = getXMLSchema;
function createSchema(content) {
var rs = useLint ? globalCache.get(content) : false;
function createSchema(content, provider) {
var rs = useLint ? globalCache.getValue(content) : false;
if (rs) {

@@ -117,5 +289,5 @@ return rs;

try {
var res = new JSONSchemaObject(content);
var res = new JSONSchemaObject(content, provider);
if (useLint) {
globalCache.set(content, res);
globalCache.setValue(content, res);
}

@@ -128,3 +300,3 @@ return res;

if (useLint) {
globalCache.set(content, res);
globalCache.setValue(content, res);
}

@@ -135,3 +307,3 @@ return res;

if (useLint) {
globalCache.set(content, new Error("Can not parse schema"));
globalCache.setValue(content, new Error("Can not parse schema"));
}

@@ -138,0 +310,0 @@ return null;

@@ -0,1 +1,2 @@

"use strict";
var parser = (function () {

@@ -2,0 +3,0 @@ "use strict";

import ts = require("./typesystem");
import schemaUtil = require('./schemaUtil');
export interface BaseNode {

@@ -18,3 +19,3 @@ type: string;

}
export declare function parseToType(val: string, t: ts.TypeRegistry): ts.AbstractType;
export declare function parseToType(val: string, t: ts.TypeRegistry, contentProvider?: schemaUtil.IContentProvider): ts.AbstractType;
export declare function storeToString(t: ts.AbstractType): string;

@@ -0,1 +1,2 @@

"use strict";
var typeExpression = require("./typeExpressionParser");

@@ -5,3 +6,4 @@ var ts = require("./typesystem");

var restrictions_2 = require("./restrictions");
function parseToType(val, t) {
function parseToType(val, t, contentProvider) {
if (contentProvider === void 0) { contentProvider = null; }
try {

@@ -11,3 +13,3 @@ var q = val.trim();

if (json || q.charAt(0) == '<') {
return new ts.ExternalType("", q, json);
return new ts.ExternalType("", q, json, contentProvider);
}

@@ -14,0 +16,0 @@ var mapShortCutIndex = val.indexOf("{}");

/// <reference path="../../typings/main.d.ts" />
import su = require("./schemaUtil");
export interface IValidationPath {
name: string;
child?: IValidationPath;
}
export declare class Status {

@@ -13,2 +18,7 @@ static CODE_CONFLICTING_TYPE_KIND: number;

protected subStatus: Status[];
protected vp: IValidationPath;
getValidationPath(): IValidationPath;
getValidationPathAsString(): string;
patchPath(p: IValidationPath): IValidationPath;
setValidationPath(c: IValidationPath): void;
constructor(severity: number, code: number, message: string, source: any);

@@ -42,3 +52,3 @@ addSubStatus(st: Status): void;

constructor();
abstract check(i: any): Status;
abstract check(i: any, parentPath: IValidationPath): Status;
private static intersections;

@@ -125,8 +135,8 @@ protected intersect(t0: AbstractType, t1: AbstractType): AbstractType;

isPolymorphic(): boolean;
restrictions(): Constraint[];
restrictions(forValidation?: boolean): Constraint[];
customFacets(): TypeInformation[];
isUnion(): boolean;
meta(): TypeInformation[];
validateDirect(i: any, autoClose?: boolean): Status;
validate(i: any, autoClose?: boolean): Status;
validateDirect(i: any, autoClose?: boolean, nullAllowed?: boolean, path?: IValidationPath): Status;
validate(i: any, autoClose?: boolean, nullAllowed?: boolean): Status;
declareMapProperty(name: string, type: AbstractType): AbstractType;

@@ -226,3 +236,5 @@ closeUnknownProperties(): void;

}
export declare class TypeOfRestriction extends Constraint {
export declare abstract class GenericTypeOf extends Constraint {
}
export declare class TypeOfRestriction extends GenericTypeOf {
private val;

@@ -235,4 +247,5 @@ constructor(val: string);

composeWith(r: Constraint): Constraint;
toString(): string;
}
export declare class IntegerRestriction extends Constraint {
export declare class IntegerRestriction extends GenericTypeOf {
constructor();

@@ -244,6 +257,14 @@ check(i: any): Status;

}
export declare class ScalarRestriction extends GenericTypeOf {
constructor();
check(i: any): Status;
requiredType(): RootType;
facetName(): string;
value(): boolean;
}
export declare class OrRestriction extends Constraint {
private val;
constructor(val: Constraint[]);
check(i: any): Status;
private _extraMessage;
constructor(val: Constraint[], _extraMessage?: string);
check(i: any, p: IValidationPath): Status;
value(): any[];

@@ -258,3 +279,3 @@ requiredType(): RootType;

options(): Constraint[];
check(i: any): Status;
check(i: any, p: IValidationPath): Status;
requiredType(): RootType;

@@ -275,2 +296,3 @@ facetName(): string;

export declare const NOTHING: RootType;
export declare const UNION: InheritedType;
export declare const UNKNOWN: InheritedType;

@@ -281,3 +303,6 @@ export declare const RECURRENT: InheritedType;

private json;
constructor(name: string, _content: string, json: boolean);
private provider;
constructor(name: string, _content: string, json: boolean, provider: su.IContentProvider);
getContentProvider(): su.IContentProvider;
setContentProvider(provider: su.IContentProvider): void;
kind(): string;

@@ -284,0 +309,0 @@ isJSON(): boolean;

@@ -0,1 +1,2 @@

"use strict";
var __extends = (this && this.__extends) || function (d, b) {

@@ -16,2 +17,63 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

}
Status.prototype.getValidationPath = function () {
return this.vp;
};
Status.prototype.getValidationPathAsString = function () {
if (!this.vp) {
return "";
}
var s = "";
var c = this.vp;
while (c) {
s += c.name;
if (c.child) {
s += '/';
}
c = c.child;
}
return s;
};
Status.prototype.patchPath = function (p) {
if (!p) {
return null;
}
else {
var c = p;
var r = null;
var cp = null;
while (c) {
if (!r) {
r = { name: c.name };
cp = r;
c = c.child;
cp = r;
}
else {
var news = { name: c.name };
cp.child = news;
c = c.child;
cp = news;
}
}
return r;
}
};
Status.prototype.setValidationPath = function (c) {
var _this = this;
if (this.vp) {
c = this.patchPath(c);
var m = c;
while (m.child) {
m = m.child;
}
m.child = this.vp;
this.vp = c;
}
else {
this.vp = c;
}
this.subStatus.forEach(function (x) {
x.setValidationPath(_this.vp);
});
};
Status.prototype.addSubStatus = function (st) {

@@ -25,5 +87,7 @@ this.subStatus.push(st);

Status.prototype.getErrors = function () {
if (this.isError()) {
if (this.isError() || this.isWarning()) {
if (this.subStatus.length > 0) {
return this.subStatus.filter(function (x) { return x.isError(); });
var rs = [];
this.subStatus.forEach(function (x) { return rs = rs.concat(x.getErrors()); });
return rs;
}

@@ -70,3 +134,3 @@ return [this];

return Status;
})();
}());
exports.Status = Status;

@@ -92,3 +156,3 @@ exports.OK_STATUS = new Status(Status.OK, Status.OK, "", null);

return TypeInformation;
})();
}());
exports.TypeInformation = TypeInformation;

@@ -147,3 +211,3 @@ var stack = null;

return Constraint;
})(TypeInformation);
}(TypeInformation));
exports.Constraint = Constraint;

@@ -191,3 +255,3 @@ var restr = require("./restrictions");

return TypeRegistry;
})();
}());
exports.TypeRegistry = TypeRegistry;

@@ -197,3 +261,3 @@ var RestrictionsConflict = (function (_super) {

function RestrictionsConflict(_conflicting, _stack, source) {
_super.call(this, Status.ERROR, 0, "Restrictions conflict", source);
_super.call(this, Status.ERROR, 0, "Restrictions conflict " + _conflicting + " and " + _stack.getRestriction().toString(), source);
this._conflicting = _conflicting;

@@ -220,3 +284,3 @@ this._stack = _stack;

return RestrictionsConflict;
})(Status);
}(Status));
exports.RestrictionsConflict = RestrictionsConflict;

@@ -279,9 +343,28 @@ var globalId = 0;

rs.addSubStatus(this.checkConfluent());
if (this.isExternal()) {
var allS = this.allSuperTypes();
var mma = allS.filter(function (x) { return x instanceof ExternalType; });
if (this instanceof ExternalType) {
mma.push(this);
}
mma.forEach(function (x) {
if (x.isJSON()) {
try {
su.getJSONSchema(x.schema(), x.getContentProvider && x.getContentProvider());
}
catch (e) {
rs.addSubStatus(new Status(Status.ERROR, 0, e.message, _this));
}
}
});
}
if (rs.isOk()) {
this.superTypes().forEach(function (x) {
if (x.isAnonymous()) {
rs.addSubStatus(x.validateType(tr));
}
});
}
}
this.validateMeta(tr).getErrors().forEach(function (x) { return rs.addSubStatus(x); });
this.superTypes().forEach(function (x) {
if (x.isAnonymous()) {
rs.addSubStatus(x.validateType(tr));
}
});
if (this.isObject()) {

@@ -310,19 +393,2 @@ var required = {};

}
if (this.isExternal()) {
var allS = this.allSuperTypes();
var mma = allS.filter(function (x) { return x instanceof ExternalType; });
if (this instanceof ExternalType) {
mma.push(this);
}
mma.forEach(function (x) {
if (x.isJSON()) {
try {
su.getJSONSchema(x.schema());
}
catch (e) {
rs.addSubStatus(new Status(Status.ERROR, 0, e.message, _this));
}
}
});
}
return rs;

@@ -415,3 +481,3 @@ };

var ft = fds[cd.facetName()].value();
rs.addSubStatus(ft.validate((cd.value())));
rs.addSubStatus(ft.validateDirect(cd.value(), false, false));
delete rfds[cd.facetName()];

@@ -543,3 +609,4 @@ }

};
AbstractType.prototype.restrictions = function () {
AbstractType.prototype.restrictions = function (forValidation) {
if (forValidation === void 0) { forValidation = false; }
if (this.isUnion()) {

@@ -553,3 +620,16 @@ var rs = [];

}
return this.meta().filter(function (x) { return x instanceof Constraint; });
var result = [];
var generic = null;
this.meta().forEach(function (x) {
if (x instanceof Constraint) {
if (x instanceof GenericTypeOf && forValidation) {
if (generic) {
return;
}
generic = x;
}
result.push(x);
}
});
return result;
};

@@ -570,7 +650,12 @@ AbstractType.prototype.customFacets = function () {

};
AbstractType.prototype.validateDirect = function (i, autoClose) {
AbstractType.prototype.validateDirect = function (i, autoClose, nullAllowed, path) {
var _this = this;
if (autoClose === void 0) { autoClose = false; }
if (nullAllowed === void 0) { nullAllowed = true; }
if (path === void 0) { path = null; }
var result = new Status(Status.OK, 0, "", this);
this.restrictions().forEach(function (x) { return result.addSubStatus(x.check(i)); });
if (!nullAllowed && (i === null || i === undefined)) {
return error("object is expected", this);
}
this.restrictions(true).forEach(function (x) { return result.addSubStatus(x.check(i, path)); });
if ((autoClose || exports.autoCloseFlag) && this.isObject() && (!this.oneMeta(restrictions_1.KnownPropertyRestriction))) {

@@ -580,3 +665,5 @@ var cp = new restrictions_1.KnownPropertyRestriction(true);

cp.check(i).getErrors().forEach(function (x) {
result.addSubStatus(new Status(Status.ERROR, 0, x.getMessage(), _this));
var rs = new Status(Status.WARNING, 0, x.getMessage(), _this);
rs.setValidationPath(x.getValidationPath());
result.addSubStatus(rs);
});

@@ -586,5 +673,9 @@ }

};
AbstractType.prototype.validate = function (i, autoClose) {
AbstractType.prototype.validate = function (i, autoClose, nullAllowed) {
if (autoClose === void 0) { autoClose = false; }
if (nullAllowed === void 0) { nullAllowed = true; }
var g = exports.autoCloseFlag;
if (!nullAllowed && (i === null || i === undefined)) {
return error("object is expected", this);
}
if (autoClose) {

@@ -797,3 +888,3 @@ exports.autoCloseFlag = true;

return AbstractType;
})();
}());
exports.AbstractType = AbstractType;

@@ -809,3 +900,3 @@ var Modifier = (function (_super) {

return Modifier;
})(TypeInformation);
}(TypeInformation));
exports.Modifier = Modifier;

@@ -824,3 +915,3 @@ var Polymorphic = (function (_super) {

return Polymorphic;
})(Modifier);
}(Modifier));
exports.Polymorphic = Polymorphic;

@@ -839,3 +930,3 @@ var Abstract = (function (_super) {

return Abstract;
})(Modifier);
}(Modifier));
exports.Abstract = Abstract;

@@ -854,3 +945,3 @@ var Internal = (function (_super) {

return Internal;
})(Modifier);
}(Modifier));
exports.Internal = Internal;

@@ -869,3 +960,3 @@ var BuiltIn = (function (_super) {

return BuiltIn;
})(Modifier);
}(Modifier));
var BUILT_IN = new BuiltIn();

@@ -881,3 +972,3 @@ var RootType = (function (_super) {

return RootType;
})(AbstractType);
}(AbstractType));
exports.RootType = RootType;

@@ -925,3 +1016,3 @@ var InheritedType = (function (_super) {

return InheritedType;
})(AbstractType);
}(AbstractType));
exports.InheritedType = InheritedType;

@@ -951,3 +1042,3 @@ var DerivedType = (function (_super) {

return DerivedType;
})(AbstractType);
}(AbstractType));
exports.DerivedType = DerivedType;

@@ -975,2 +1066,3 @@ var UnionType = (function (_super) {

var st = new Status(Status.OK, 0, "", this);
var options = null;
for (var j = 0; j < this.options().length; j++) {

@@ -981,4 +1073,5 @@ var s = this.options()[j].validateDirect(i, autoClose);

}
st.addSubStatus(s);
options = s;
}
st.addSubStatus(options);
return st;

@@ -990,6 +1083,6 @@ };

UnionType.prototype.restrictions = function () {
return [new OrRestriction(this.allOptions().map(function (x) { return new AndRestriction(x.restrictions()); }))];
return [new OrRestriction(this.allOptions().map(function (x) { return new AndRestriction(x.restrictions()); }), "union type options does not pass validation")];
};
return UnionType;
})(DerivedType);
}(DerivedType));
exports.UnionType = UnionType;

@@ -1010,3 +1103,3 @@ var IntersectionType = (function (_super) {

return IntersectionType;
})(DerivedType);
}(DerivedType));
exports.IntersectionType = IntersectionType;

@@ -1085,3 +1178,3 @@ var registry = new TypeRegistry();

return NothingRestriction;
})(Constraint);
}(Constraint));
exports.NothingRestriction = NothingRestriction;

@@ -1100,3 +1193,3 @@ var RestrictionStackEntry = (function () {

return RestrictionStackEntry;
})();
}());
exports.RestrictionStackEntry = RestrictionStackEntry;

@@ -1115,4 +1208,12 @@ var NothingRestrictionWithLocation = (function (_super) {

return NothingRestrictionWithLocation;
})(NothingRestriction);
}(NothingRestriction));
exports.NothingRestrictionWithLocation = NothingRestrictionWithLocation;
var GenericTypeOf = (function (_super) {
__extends(GenericTypeOf, _super);
function GenericTypeOf() {
_super.apply(this, arguments);
}
return GenericTypeOf;
}(Constraint));
exports.GenericTypeOf = GenericTypeOf;
var TypeOfRestriction = (function (_super) {

@@ -1127,3 +1228,3 @@ __extends(TypeOfRestriction, _super);

if (i === null || i === undefined) {
to = "null";
return exports.OK_STATUS;
}

@@ -1157,4 +1258,7 @@ if (Array.isArray(i)) {

};
TypeOfRestriction.prototype.toString = function () {
return "should be of type " + this.val;
};
return TypeOfRestriction;
})(Constraint);
}(GenericTypeOf));
exports.TypeOfRestriction = TypeOfRestriction;

@@ -1175,3 +1279,3 @@ function is_int(value) {

IntegerRestriction.prototype.check = function (i) {
if (is_int(i)) {
if (typeof i == "number" && is_int(i)) {
return exports.OK_STATUS;

@@ -1191,19 +1295,56 @@ }

return IntegerRestriction;
})(Constraint);
}(GenericTypeOf));
exports.IntegerRestriction = IntegerRestriction;
var ScalarRestriction = (function (_super) {
__extends(ScalarRestriction, _super);
function ScalarRestriction() {
_super.call(this);
}
ScalarRestriction.prototype.check = function (i) {
if (!i) {
return exports.OK_STATUS;
}
if (typeof i === 'number' || typeof i === 'boolean' || typeof i === 'string') {
return exports.OK_STATUS;
}
return error("scalar is expected", this);
};
ScalarRestriction.prototype.requiredType = function () {
return exports.ANY;
};
ScalarRestriction.prototype.facetName = function () {
return "should be scalar";
};
ScalarRestriction.prototype.value = function () {
return true;
};
return ScalarRestriction;
}(GenericTypeOf));
exports.ScalarRestriction = ScalarRestriction;
var OrRestriction = (function (_super) {
__extends(OrRestriction, _super);
function OrRestriction(val) {
function OrRestriction(val, _extraMessage) {
_super.call(this);
this.val = val;
this._extraMessage = _extraMessage;
}
OrRestriction.prototype.check = function (i) {
OrRestriction.prototype.check = function (i, p) {
var cs = new Status(Status.OK, 0, "", this);
var first = null;
for (var j = 0; j < this.val.length; j++) {
var m = this.val[j].check(i);
var m = this.val[j].check(i, p);
if (m.isOk()) {
return exports.OK_STATUS;
}
cs.addSubStatus(m);
if (!first) {
first = m;
}
;
}
if (first) {
cs.addSubStatus(first);
if (this._extraMessage) {
cs.addSubStatus(error(this._extraMessage, this));
}
}
return cs;

@@ -1221,3 +1362,3 @@ };

return OrRestriction;
})(Constraint);
}(Constraint));
exports.OrRestriction = OrRestriction;

@@ -1236,5 +1377,5 @@ var AndRestriction = (function (_super) {

};
AndRestriction.prototype.check = function (i) {
AndRestriction.prototype.check = function (i, p) {
for (var j = 0; j < this.val.length; j++) {
var st = this.val[j].check(i);
var st = this.val[j].check(i, p);
if (!st.isOk()) {

@@ -1253,3 +1394,3 @@ return st;

return AndRestriction;
})(Constraint);
}(Constraint));
exports.AndRestriction = AndRestriction;

@@ -1268,5 +1409,7 @@ exports.ANY = new RootType("any");

exports.NOTHING = new RootType("nothing");
exports.UNION = exports.ANY.inherit("union");
exports.UNKNOWN = exports.NOTHING.inherit("unknown");
exports.RECURRENT = exports.NOTHING.inherit("recurrent");
exports.ANY.addMeta(BUILT_IN);
exports.UNION.addMeta(BUILT_IN);
exports.SCALAR.addMeta(BUILT_IN);

@@ -1286,2 +1429,3 @@ exports.OBJECT.addMeta(BUILT_IN);

exports.EXTERNAL.lock();
exports.UNION.lock();
registry.addType(exports.ANY);

@@ -1306,13 +1450,20 @@ registry.addType(exports.SCALAR);

exports.FILE.addMeta(new TypeOfRestriction("string"));
exports.SCALAR.addMeta(new OrRestriction([new TypeOfRestriction("string"), new TypeOfRestriction("boolean"), new TypeOfRestriction("number")]));
exports.SCALAR.addMeta(new ScalarRestriction());
registry.types().forEach(function (x) { return x.lock(); });
var ExternalType = (function (_super) {
__extends(ExternalType, _super);
function ExternalType(name, _content, json) {
function ExternalType(name, _content, json, provider) {
_super.call(this, name);
this._content = _content;
this.json = json;
this.addMeta(new restr.MatchToSchema(_content));
this.provider = provider;
this.addMeta(new restr.MatchToSchema(_content, provider));
this.addSuper(exports.EXTERNAL);
}
ExternalType.prototype.getContentProvider = function () {
return this.provider;
};
ExternalType.prototype.setContentProvider = function (provider) {
this.provider = provider;
};
ExternalType.prototype.kind = function () {

@@ -1328,4 +1479,4 @@ return "external";

return ExternalType;
})(InheritedType);
}(InheritedType));
exports.ExternalType = ExternalType;
//# sourceMappingURL=typesystem.js.map

@@ -0,1 +1,2 @@

"use strict";
var _ = require("underscore");

@@ -2,0 +3,0 @@ function find(t, it) {

@@ -0,1 +1,2 @@

"use strict";
var xml2js = require("xml2js");

@@ -2,0 +3,0 @@ var restrictions_1 = require("./restrictions");

@@ -0,1 +1,2 @@

"use strict";
var chai = require("chai");

@@ -2,0 +3,0 @@ var ts = require("../src/typesystem");

@@ -1,2 +0,3 @@

var ps = require("../src/parse");
"use strict";
var ps = require("./actualParse");
var chai = require("chai");

@@ -3,0 +4,0 @@ var assert = chai.assert;

@@ -1,2 +0,3 @@

var ps = require("../src/parse");
"use strict";
var ps = require("./actualParse");
var jsschema = require("../src/jsonSchemaWriter");

@@ -3,0 +4,0 @@ describe("Simple validation testing", function () {

@@ -1,5 +0,20 @@

var ps = require("../src/parse");
"use strict";
var ps = require("./actualParse");
var ts = require("../src/typesystem");
var chai = require("chai");
var assert = chai.assert;
describe("JSON Schemas testing", function () {
it("schema with reference, example is valid", function () {
var tp = ps.parseJSON("SomeType", {
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string","required":true},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
});
assert.isTrue(tp.validate({ parentName: "someName", child: { childName: "anotherName" } }).isOk());
});
it("schema with reference, example is invalid", function () {
var tp = ps.parseJSON("SomeType", {
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string","required":true},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
});
assert.isTrue(!tp.validate({ parentName: "someName", child: { childName1: "anotherName" } }).isOk());
});
});
describe("Simple validation testing", function () {

@@ -6,0 +21,0 @@ it("built in types exist", function () {

@@ -1,2 +0,3 @@

var ps = require("../src/parse");
"use strict";
var ps = require("./actualParse");
var ts = require("../src/typesystem");

@@ -78,3 +79,174 @@ var chai = require("chai");

});
it("Builtins type of is validated only once", function () {
var tp = ps.parseJSONTypeCollection({
types: {
XX: {
type: "object",
properties: {
c: "string",
},
example: {
c: { a: "3" }
}
}
}
});
var t = tp.getType("XX");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Incompatible typeof lead to confluent types", function () {
var tp = ps.parseJSONTypeCollection({
types: {
XX: {
type: ["string", "number"],
}
}
});
var t = tp.getType("XX");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Validating against properties of unknown type", function () {
var tp = ps.parseJSONTypeCollection({
types: {
XX: {
type: "object",
properties: {
"x": "Likes"
},
example: {
x: { z: 2 }
}
}
}
});
var t = tp.getType("XX");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 2);
var err = false;
st.getErrors().forEach(function (x) {
if (x.getMessage().indexOf("against") != -1) {
err = true;
}
});
assert.isTrue(err);
});
it("Validating recurrent types error count", function () {
var tp = ps.parseJSONTypeCollection({
types: {
A: {
type: "b",
},
B: "a[]"
}
});
var t = tp.getType("B");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Validating recurrent types error count (union types)", function () {
var tp = ps.parseJSONTypeCollection({
types: {
a: "b | c",
b: "a | c",
c: "string"
}
});
var t = tp.getType("b");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Validating recurrent types error count (array types)", function () {
var tp = ps.parseJSONTypeCollection({
types: {
a: "b[]",
b: "a[]",
c: "string"
}
});
var t = tp.getType("b");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Validating incorrect JSON external type", function () {
var tp = ps.parseJSONTypeCollection({
types: {
a: "{ properties: {}}",
}
});
var t = tp.getType("a");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Top level null is not allowed", function () {
var tp = ps.parseJSONTypeCollection({
types: {
a: {
"type": " object",
example: null
}
}
});
var t = tp.getType("a");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Invalid JSON example", function () {
var tp = ps.parseJSONTypeCollection({
types: {
a: {
"type": " object",
properties: {
x: "number"
},
example: "{ d: 5}"
}
}
});
var t = tp.getType("a");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
});
it("Invalid JSON example 2", function () {
var tp = ps.parseJSONTypeCollection({
types: {
a: {
"type": "\n {\n \"required\": \"message\",\n \"$schema\": \"http://json-schema.org/draft-04/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"message\": {\n \"required\": true,\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n }",
example: "{ \"message\":\"s\" ,\"r\":2 }"
}
}
});
var t = tp.getType("a");
var st = t.validateType(ts.builtInRegistry());
var f = false;
assert.isTrue(st.getErrors().length === 1);
assert.isTrue(st.getMessage() === "Example does not conform to schema:Content is not valid according to schema:Additional properties not allowed: r r");
});
it("Valid example", function () {
var tp = ps.parseJSONTypeCollection({
types: {
a: {
"type": "object",
properties: {
x: "string[]"
},
example: { x: [] }
}
}
});
var t = tp.getType("a");
var st = t.validateType(ts.builtInRegistry());
assert.isTrue(st.getErrors().length === 0);
});
});
//# sourceMappingURL=regressionTests.js.map

@@ -0,1 +1,2 @@

"use strict";
describe("Simple validation testing", function () {

@@ -2,0 +3,0 @@ it("Unknown property error message #8", function () {

@@ -1,2 +0,3 @@

var ps = require("../src/parse");
"use strict";
var ps = require("./actualParse");
var ts = require("../src/typesystem");

@@ -131,3 +132,59 @@ var chai = require("chai");

});
it("nominal hierarchy 1 (Arrays)", function () {
var tps = ps.parseJSONTypeCollection({
types: {
A: "string[]"
}
}, ts.builtInRegistry());
var tp = tps.getType("A");
var nt = nm.toNominal(tp, function (x) { return null; });
var st = nt.allSuperTypes();
assert.isTrue(st.length == 2);
assert.isTrue(nt.isArray());
assert.isTrue(st[0].nameId() == "array");
assert.isTrue(!st[0].isArray());
assert.isTrue(st[1].nameId() == "any");
});
it("nominal hierarchy 2 (union)", function () {
var tps = ps.parseJSONTypeCollection({
types: {
A: "string|number"
}
}, ts.builtInRegistry());
var tp = tps.getType("A");
var nt = nm.toNominal(tp, function (x) { return null; });
var st = nt.allSuperTypes();
assert.isTrue(st.length == 2);
assert.isTrue(nt.isUnion());
assert.isTrue(st[0].nameId() == "union");
assert.isTrue(st[1].nameId() == "any");
});
it("nominal hierarchy 3", function () {
var tps = ps.parseJSONTypeCollection({
types: {
A: { type: "string|number" }
}
}, ts.builtInRegistry());
var tp = tps.getType("A");
var nt = nm.toNominal(tp, function (x) { return null; });
var st = nt.allSuperTypes();
assert.isTrue(st.length == 2);
assert.isTrue(nt.isUnion());
assert.isTrue(st[0].nameId() == "union");
assert.isTrue(st[1].nameId() == "any");
});
it("nominal hierarchy 4 (object)", function () {
var tps = ps.parseJSONTypeCollection({
types: {
A: { type: "object" }
}
}, ts.builtInRegistry());
var tp = tps.getType("A");
var nt = nm.toNominal(tp, function (x) { return null; });
var st = nt.allSuperTypes();
assert.isTrue(st.length == 2);
assert.isTrue(st[0].nameId() == "object");
assert.isTrue(st[1].nameId() == "any");
});
});
//# sourceMappingURL=toNominalTests.js.map

@@ -1,2 +0,3 @@

var ps = require("../src/parse");
"use strict";
var ps = require("./actualParse");
var ts = require("../src/typesystem");

@@ -3,0 +4,0 @@ var chai = require("chai");

{
"name": "raml-typesystem",
"version": "0.0.16",
"version": "0.0.17",
"private": false,

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

@@ -1,3 +0,3 @@

// Compiled using typings@0.6.8
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/be0b6b394f77a59e192ad7cfec18078706e44db5/chai/chai.d.ts
// Compiled using typings@0.3.3
// Source: https://raw.githubusercontent.com/definitelytyped/DefinitelyTyped/be0b6b394f77a59e192ad7cfec18078706e44db5/chai/chai.d.ts
// Type definitions for chai 2.0.0

@@ -4,0 +4,0 @@ // Project: http://chaijs.com/

@@ -1,3 +0,3 @@

// Compiled using typings@0.6.8
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/mocha/mocha.d.ts
// Compiled using typings@0.3.3
// Source: https://raw.githubusercontent.com/definitelytyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/mocha/mocha.d.ts
// Type definitions for mocha 2.2.5

@@ -4,0 +4,0 @@ // Project: http://mochajs.org/

@@ -1,3 +0,3 @@

// Compiled using typings@0.6.8
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7304e0770d53762f89af7fcf14517d5f45a04cc2/xml2js/xml2js.d.ts
// Compiled using typings@0.3.3
// Source: https://raw.githubusercontent.com/definitelytyped/DefinitelyTyped/7304e0770d53762f89af7fcf14517d5f45a04cc2/xml2js/xml2js.d.ts
// Type definitions for node-xml2js

@@ -4,0 +4,0 @@ // Project: https://github.com/Leonidas-from-XIV/node-xml2js

@@ -1,3 +0,3 @@

// Compiled using typings@0.6.8
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/be0b6b394f77a59e192ad7cfec18078706e44db5/chai/chai.d.ts
// Compiled using typings@0.3.3
// Source: https://raw.githubusercontent.com/definitelytyped/DefinitelyTyped/be0b6b394f77a59e192ad7cfec18078706e44db5/chai/chai.d.ts
// Type definitions for chai 2.0.0

@@ -4,0 +4,0 @@ // Project: http://chaijs.com/

@@ -1,3 +0,3 @@

// Compiled using typings@0.6.8
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/mocha/mocha.d.ts
// Compiled using typings@0.3.3
// Source: https://raw.githubusercontent.com/definitelytyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/mocha/mocha.d.ts
// Type definitions for mocha 2.2.5

@@ -4,0 +4,0 @@ // Project: http://mochajs.org/

@@ -1,3 +0,3 @@

// Compiled using typings@0.6.8
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7304e0770d53762f89af7fcf14517d5f45a04cc2/xml2js/xml2js.d.ts
// Compiled using typings@0.3.3
// Source: https://raw.githubusercontent.com/definitelytyped/DefinitelyTyped/7304e0770d53762f89af7fcf14517d5f45a04cc2/xml2js/xml2js.d.ts
// Type definitions for node-xml2js

@@ -4,0 +4,0 @@ // Project: https://github.com/Leonidas-from-XIV/node-xml2js

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 too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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