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.52 to 0.0.53

custom_typings/xmlvalidation.d.ts

8

dist/src/schemaUtil.js

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

/// <reference path="../typings/main.d.ts" />
"use strict";
/// <reference path="../typings/main.d.ts" />
var _ = require("./utils");
var xmlValidator = require('./xmlUtil');
var xmlUtil = require('./xmlUtil');
var DOMParser = require('xmldom').DOMParser;

@@ -345,3 +345,3 @@ var ZSchema = require("z-schema");

}
this.schemaObj = new xmlValidator.XMLValidator(this.handleReferenceElement(schema));
this.schemaObj = xmlUtil.getValidator(this.handleReferenceElement(schema));
}

@@ -368,3 +368,3 @@ XMLSchemaObject.prototype.getType = function () {

}
this.validate(xmlValidator.jsonToXml(object));
this.validate(xmlUtil.jsonToXml(object));
};

@@ -371,0 +371,0 @@ XMLSchemaObject.prototype.validate = function (xml) {

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

var json = q.charAt(0) == '{';
if (json || q.charAt(0) == '<') {
if (json || (q.charAt(0) == '<' && q.length > 1 && q.charAt(1) != '<')) {
return new ts.ExternalType("", q, json, contentProvider);

@@ -14,0 +14,0 @@ }

/// <reference path="../../typings/main.d.ts" />
export declare class XMLValidator {
private schema;
private schemaObject;
constructor(schema: string);
validate(xml: string): Error[];
}
import { XMLValidator } from "raml-xml-validation";
export declare function getValidator(arg: string): XMLValidator;
export declare function jsonToXml(jsonObject: any): string;

@@ -0,15 +1,19 @@

/// <reference path="../typings/main.d.ts" />
"use strict";
/// <reference path="../typings/main.d.ts" />
var validator = require('xmllint-hack2');
var XMLValidator = (function () {
function XMLValidator(schema) {
this.schema = schema;
}
XMLValidator.prototype.validate = function (xml) {
var result = validator.validateXML({ xml: xml, schema: this.schema });
return (result && result.errors && result.errors.map(function (error) { return new Error(error); })) || [];
};
return XMLValidator;
}());
exports.XMLValidator = XMLValidator;
var sss;
var XMLValidatorConstructor;
try {
XMLValidatorConstructor = require("raml-xml-validation").XMLValidator;
}
catch (exception) {
var XMLValidatorDummyImpl = (function () {
function XMLValidatorDummyImpl(arg) {
}
XMLValidatorDummyImpl.prototype.validate = function (xml) {
return [];
};
return XMLValidatorDummyImpl;
}());
XMLValidatorConstructor = XMLValidatorDummyImpl;
}
function objectToXml(object) {

@@ -62,2 +66,6 @@ if (!object) {

}
function getValidator(arg) {
return new XMLValidatorConstructor(arg);
}
exports.getValidator = getValidator;
function jsonToXml(jsonObject) {

@@ -64,0 +72,0 @@ var nodeName = jsonObject && Object.keys(jsonObject)[0];

{
"name": "raml-typesystem",
"version": "0.0.52",
"version": "0.0.53",
"main": "dist/src/index.js",
"scripts": {
"test-cov": " ./node_modules/.bin/istanbul cover _mocha dist/tests/*Tests.js",
"build": "rimraf dist && tsc",
"noValidationBuild": "rimraf dist && tsc",
"build": "npm install raml-xml-validation && npm run noValidationBuild",
"pullall": "dev-env-installer pullall",

@@ -21,4 +22,3 @@ "buildall": "dev-env-installer buildall",

"date-and-time": "0.3.0",
"xmldom": "^0.1.22",
"xmllint-hack2": "^0.0.2"
"xmldom": "^0.1.22"
},

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

/// <reference path="../typings/main.d.ts" />
import {XMLValidator} from "raml-xml-validation";
declare var global:any;

@@ -7,3 +9,3 @@ declare function require(s:string):any;

import xmlValidator = require('./xmlUtil');
import xmlUtil = require('./xmlUtil');

@@ -454,3 +456,3 @@ var DOMParser = require('xmldom').DOMParser;

export class XMLSchemaObject {
private schemaObj: xmlValidator.XMLValidator;
private schemaObj: XMLValidator;

@@ -464,3 +466,3 @@ private extraElementData: any = null;

this.schemaObj = new xmlValidator.XMLValidator(this.handleReferenceElement(schema));
this.schemaObj = xmlUtil.getValidator(this.handleReferenceElement(schema));
}

@@ -499,3 +501,3 @@

this.validate(xmlValidator.jsonToXml(object));
this.validate(xmlUtil.jsonToXml(object));
}

@@ -502,0 +504,0 @@

@@ -21,3 +21,3 @@ import typeExpression=require("./typeExpressionParser")

var json=q.charAt(0)=='{';
if (json || q.charAt(0)=='<'){
if (json || (q.charAt(0)=='<'&&q.length>1&&q.charAt(1)!='<')){
return new ts.ExternalType("", q, json, contentProvider);

@@ -24,0 +24,0 @@ }

/// <reference path="../typings/main.d.ts" />
import {XMLValidator} from "raml-xml-validation";
var sss: XMLValidator
declare function require(s:string):any;
var validator = require('xmllint-hack2');
var XMLValidatorConstructor: any;
export class XMLValidator {
private schemaObject: any;
constructor(private schema:string) {
}
try {
XMLValidatorConstructor = require("raml-xml-validation").XMLValidator;
} catch(exception) {
class XMLValidatorDummyImpl {
constructor(arg: string) {
validate(xml: string): Error[] {
var result = validator.validateXML({xml: xml, schema: this.schema});
}
return (result && result.errors && result.errors.map((error: any) => new Error(error))) || [];
validate(xml: string): Error[] {
return [];
}
}
XMLValidatorConstructor = XMLValidatorDummyImpl;
}

@@ -83,2 +89,6 @@

export function getValidator(arg: string): XMLValidator {
return new XMLValidatorConstructor(arg);
}
export function jsonToXml(jsonObject: any) {

@@ -85,0 +95,0 @@ var nodeName = jsonObject && Object.keys(jsonObject)[0];

@@ -14,4 +14,5 @@ {

"node_modules",
"typings"
"typings",
"custom_typings"
]
}

@@ -7,4 +7,5 @@ {

"underscore": "github:DefinitelyTyped/DefinitelyTyped/underscore/underscore.d.ts#01ce3ccf7f071514ff5057ef32a4550bf0b81dfe",
"xml2js": "github:DefinitelyTyped/DefinitelyTyped/xml2js/xml2js.d.ts#7304e0770d53762f89af7fcf14517d5f45a04cc2"
"xml2js": "github:DefinitelyTyped/DefinitelyTyped/xml2js/xml2js.d.ts#7304e0770d53762f89af7fcf14517d5f45a04cc2",
"xmlvalidation": "file:custom_typings/xmlvalidation.d.ts"
}
}

@@ -20,2 +20,7 @@ {

},
"raml-xml-validation" : {
"build" : "npm run build",
"gitUrl" : "https://github.com/dreamflyer/raml-xml-validation.git",
"installTypings" : true
},
"ts-structure-parser" : {

@@ -22,0 +27,0 @@ "build" : "npm run build",

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