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.83 to 0.0.84

4

dist/src/parse.d.ts

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

anchor?(): any;
path(): string;
}

@@ -38,2 +39,5 @@ export declare function parseJSON(name: string, n: any, r?: ts.TypeRegistry, provider?: su.IContentProvider): ts.AbstractType;

export declare class TypeCollection {
private _id;
constructor(_id: string);
id(): string;
private _types;

@@ -40,0 +44,0 @@ private _typeMap;

@@ -92,2 +92,5 @@ "use strict";

};
JSObjectNode.prototype.path = function () {
return JSON.stringify(this.obj);
};
return JSObjectNode;

@@ -145,3 +148,4 @@ }());

var TypeCollection = /** @class */ (function () {
function TypeCollection() {
function TypeCollection(_id) {
this._id = _id;
this._types = [];

@@ -153,2 +157,5 @@ this._typeMap = {};

}
TypeCollection.prototype.id = function () {
return this._id;
};
TypeCollection.prototype.library = function (n) {

@@ -321,2 +328,5 @@ return this.uses[n];

};
WrapArrayNode.prototype.path = function () {
return this.n.path();
};
return WrapArrayNode;

@@ -328,3 +338,3 @@ }());

function parseTypeCollection(n, tr) {
var result = new TypeCollection();
var result = new TypeCollection(n.path());
if (n.anchor) {

@@ -778,3 +788,3 @@ if (n.anchor().__$$) {

if (uses.kind() === NodeKind.MAP) {
var col = new TypeCollection();
var col = new TypeCollection(n.path());
uses.children().forEach(function (c) {

@@ -781,0 +791,0 @@ col.addLibrary(c.key(), parseTypeCollection(c, ts.builtInRegistry()));

@@ -199,2 +199,3 @@ export interface IValidationPath {

addLibrary(namespace: string, lib: IParsedTypeCollection): void;
id(): string;
}

@@ -201,0 +202,0 @@ export interface ITypeRegistry {

import ts = require("./typesystem");
import { Status } from "./typesystem";
export declare let messageRegistry: any;
export declare function serializeToXML(object: any, type: ts.AbstractType): string;
export declare function readObject(content: string, t: ts.AbstractType): any;
export declare function getXmlErrors(root: any): Status[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var xml2js = require("xml2js");
var ts = require("./typesystem");
var _ = require("underscore");

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

var typesystem_1 = require("./typesystem");
exports.messageRegistry = require("../../resources/errorMessages");
var XML_ERRORS = '@unexpected_root_attributes_and_elements';

@@ -299,6 +301,13 @@ var bodyNames = [

extraAttributes.forEach(function (name) {
errors.push('Unexpected attribute "' + name + '".');
errors.push(ts.error(exports.messageRegistry.UNEXPECTED_XML_ATTRIBUTE, null, { name: name }).getMessage());
});
extraElements.forEach(function (name) {
errors.push('Unexpected element "' + name + '".');
var message;
if (name == "_" && typeof node[name] === "string") {
message = ts.error(exports.messageRegistry.TEXT_CONTENT_NOT_ALLOWED_FOR_THE_XML_ELEMENT, null).getMessage();
}
else {
message = ts.error(exports.messageRegistry.UNEXPECTED_XML_ELEMENT, null, { name: name }).getMessage();
}
errors.push(message);
if (remove) {

@@ -305,0 +314,0 @@ delete node[name];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var escape = require("escape-html");
var XMLValidatorConstructor;

@@ -47,3 +48,3 @@ try {

if (typeof root === 'string') {
result = result + root;
result = result + escape(root);
}

@@ -55,2 +56,6 @@ else {

}
if (key === "_" && (typeof root[key] === "string")) {
result += escape(root[key]);
return;
}
if (typeof root[key] === 'object' && !root[key].length) {

@@ -57,0 +62,0 @@ var child = {};

4

package.json
{
"name": "raml-typesystem",
"version": "0.0.83",
"version": "0.0.84",
"main": "dist/src/index.js",

@@ -18,2 +18,3 @@ "scripts": {

"date-and-time": "0.5.0",
"escape-html": "1.0.3",
"json-schema-compatibility": "1.1.0",

@@ -50,2 +51,3 @@ "json-to-ast": "2.0.0-alpha1.3",

"@types/chai": "4.0.1",
"@types/escape-html" : "0.0.20",
"@types/mocha": "2.2.41",

@@ -52,0 +54,0 @@ "@types/node": "4.2.20",

@@ -553,3 +553,15 @@ {

"message" : "should be scalar"
},
"UNEXPECTED_XML_ELEMENT" : {
"code" : "UNEXPECTED_XML_ELEMENT",
"message" : "Unexpected element '{{name}}'"
},
"UNEXPECTED_XML_ATTRIBUTE" : {
"code" : "UNEXPECTED_XML_ATTRIBUTE",
"message" : "Unexpected attribute '{{name}}'"
},
"TEXT_CONTENT_NOT_ALLOWED_FOR_THE_XML_ELEMENT" : {
"code" : "TEXT_CONTENT_NOT_ALLOWED_FOR_THE_XML_ELEMENT",
"message" : "The node is not allowed to have text content"
}
}

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

anchor?():any
path():string
}

@@ -104,2 +106,6 @@

}
path():string{
return JSON.stringify(this.obj)
}
}

@@ -159,2 +165,9 @@ export function parseJSON(name: string,n:any,r:ts.TypeRegistry=ts.builtInRegistry(), provider?: su.IContentProvider):ts.AbstractType {

export class TypeCollection {
constructor(private _id:string){}
id():string{
return this._id
}
private _types:AbstractType[]=[];

@@ -350,2 +363,6 @@ private _typeMap:{[name:string]:AbstractType}={};

}
path():string{
return this.n.path()
}
}

@@ -358,3 +375,3 @@

export function parseTypeCollection(n:ParseNode,tr:ts.TypeRegistry):TypeCollection{
var result=new TypeCollection();
var result=new TypeCollection(n.path());
if (n.anchor){

@@ -842,3 +859,3 @@ if (n.anchor().__$$){

if (uses.kind()===NodeKind.MAP){
var col = new TypeCollection();
var col = new TypeCollection(n.path());
uses.children().forEach(c=>{

@@ -845,0 +862,0 @@ col.addLibrary(c.key(),parseTypeCollection(c,ts.builtInRegistry()));

@@ -243,2 +243,4 @@ export interface IValidationPath{

addLibrary(namespace:string,lib:IParsedTypeCollection):void
id():string
}

@@ -245,0 +247,0 @@ export interface ITypeRegistry {

@@ -8,2 +8,3 @@ import xml2js=require("xml2js");

import {Status} from "./typesystem";
export let messageRegistry = require("../../resources/errorMessages");

@@ -415,8 +416,14 @@ var XML_ERRORS = '@unexpected_root_attributes_and_elements';

extraAttributes.forEach(name => {
errors.push('Unexpected attribute "' + name + '".');
errors.push(ts.error(messageRegistry.UNEXPECTED_XML_ATTRIBUTE,null,{name:name}).getMessage());
});
extraElements.forEach(name => {
errors.push('Unexpected element "' + name + '".');
let message:string;
if(name=="_" && typeof node[name] === "string"){
message = ts.error(messageRegistry.TEXT_CONTENT_NOT_ALLOWED_FOR_THE_XML_ELEMENT,null).getMessage()
}
else{
message = ts.error(messageRegistry.UNEXPECTED_XML_ELEMENT,null,{name:name}).getMessage()
}
errors.push(message)
if(remove) {

@@ -423,0 +430,0 @@ delete node[name];

import {XMLValidator, XMLSchemaReference} from "raml-xml-validation";
import escape = require("escape-html")

@@ -58,3 +59,3 @@ declare function require(s:string):any;

if (typeof root === 'string') {
result = result + root;
result = result + escape(root);
} else {

@@ -66,2 +67,6 @@

}
if(key === "_" && (typeof root[key] === "string")){
result += escape(root[key])
return
}

@@ -68,0 +73,0 @@ if (typeof root[key] === 'object' && !root[key].length) {

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