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

3xpr

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

3xpr - npm Package Compare versions

Comparing version 1.7.10 to 1.8.0

1

expression/contract/index.d.ts
export * from './base';
export * from './context';
export * from './operand';
export * from './type';
export * from './managers';

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

__exportStar(require("./operand"), exports);
__exportStar(require("./type"), exports);
__exportStar(require("./managers"), exports);
//# sourceMappingURL=index.js.map

2

expression/contract/managers.d.ts

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

import { Type } from './type';
import { Type } from 'json-light';
import { Parameter, Format, OperatorAdditionalInfo, FunctionAdditionalInfo, IEvaluator, Context } from '.';

@@ -3,0 +3,0 @@ import { Operand, OperatorMetadata } from './operand';

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

import { Type, Context, Parameter, Position } from '.';
import { Context, Parameter, Position } from '.';
import { Type } from 'json-light';
export declare enum OperandType {

@@ -3,0 +4,0 @@ Const = "Const",

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

const contract_1 = require("./contract");
const json_light_1 = require("json-light");
const operand_1 = require("./operand");

@@ -130,3 +131,3 @@ const process_1 = require("./process");

const operand = this.typed(expression);
return contract_1.Type.toString(operand.returnType);
return json_light_1.Type.stringify(operand.returnType);
}

@@ -133,0 +134,0 @@ clone(source) {

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

const contract_1 = require("../contract");
const json_light_1 = require("json-light");
class ConstEvaluator extends contract_1.Evaluator {

@@ -13,8 +14,8 @@ eval() {

switch (this.operand.returnType.kind) {
case contract_1.Kind.string:
case json_light_1.Kind.string:
return this.operand.name;
case contract_1.Kind.boolean:
case json_light_1.Kind.boolean:
return Boolean(this.operand.name);
case contract_1.Kind.integer:
case contract_1.Kind.decimal:
case json_light_1.Kind.integer:
case json_light_1.Kind.decimal:
return parseFloat(this.operand.name);

@@ -21,0 +22,0 @@ default:

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

const contract_1 = require("../contract");
const json_light_1 = require("json-light");
const evaluators_1 = require("./evaluators");
class ConstBuilder {
build(pos, value) {
const operand = new contract_1.Operand(pos, value, contract_1.OperandType.Const, [], contract_1.Type.get(value));
const operand = new contract_1.Operand(pos, value, contract_1.OperandType.Const, [], json_light_1.Type.get(value));
operand.evaluator = new evaluators_1.ConstEvaluator(operand);

@@ -11,0 +12,0 @@ return operand;

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

const contract_1 = require("../contract");
const json_light_1 = require("json-light");
class ParameterManager {

@@ -11,3 +12,3 @@ parameters(operand) {

if (operand.type === contract_1.OperandType.Var) {
parameters.push({ name: operand.name, type: contract_1.Type.toString(operand.returnType) });
parameters.push({ name: operand.name, type: json_light_1.Type.stringify(operand.returnType) });
}

@@ -14,0 +15,0 @@ for (const child of operand.children) {

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

const contract_1 = require("../contract");
const json_light_1 = require("json-light");
class Parser {

@@ -186,3 +187,3 @@ constructor(model, expression) {

}
operand = new contract_1.Operand(pos, value, contract_1.OperandType.Const, [], contract_1.Type.integer);
operand = new contract_1.Operand(pos, value, contract_1.OperandType.Const, [], json_light_1.Type.integer);
}

@@ -201,7 +202,7 @@ else if (h3lp_1.h3lp.val.isDecimalFormat(value)) {

}
operand = new contract_1.Operand(pos, value, contract_1.OperandType.Const, [], contract_1.Type.decimal);
operand = new contract_1.Operand(pos, value, contract_1.OperandType.Const, [], json_light_1.Type.decimal);
}
else if (this.model.isConstant(value)) {
const constantValue = this.model.getConstantValue(value);
operand = new contract_1.Operand(pos, constantValue, contract_1.OperandType.Const, [], contract_1.Type.get(constantValue));
operand = new contract_1.Operand(pos, constantValue, contract_1.OperandType.Const, [], json_light_1.Type.get(constantValue));
}

@@ -218,3 +219,3 @@ else if (this.model.isEnum(value)) {

const result = this.getString(char);
operand = new contract_1.Operand(pos, result, contract_1.OperandType.Const, [], contract_1.Type.string);
operand = new contract_1.Operand(pos, result, contract_1.OperandType.Const, [], json_light_1.Type.string);
}

@@ -224,3 +225,3 @@ else if (char === '`') {

const result = this.getTemplate();
operand = new contract_1.Operand(pos, result, contract_1.OperandType.Template, [], contract_1.Type.string);
operand = new contract_1.Operand(pos, result, contract_1.OperandType.Template, [], json_light_1.Type.string);
}

@@ -728,3 +729,3 @@ else if (char === '(') {

const enumValue = this.model.getEnumValue(enumName, enumOption);
return new contract_1.Operand(pos, enumValue, contract_1.OperandType.Const, [], contract_1.Type.get(value));
return new contract_1.Operand(pos, enumValue, contract_1.OperandType.Const, [], json_light_1.Type.get(value));
}

@@ -736,3 +737,3 @@ else {

const _value = values[name];
const attribute = new contract_1.Operand(pos, name, contract_1.OperandType.KeyVal, [new contract_1.Operand(pos, _value, contract_1.OperandType.Const, [], contract_1.Type.get(_value))]);
const attribute = new contract_1.Operand(pos, name, contract_1.OperandType.KeyVal, [new contract_1.Operand(pos, _value, contract_1.OperandType.Const, [], json_light_1.Type.get(_value))]);
attributes.push(attribute);

@@ -739,0 +740,0 @@ }

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

const contract_1 = require("../contract");
const json_light_1 = require("json-light");
class OperandSerializer {

@@ -23,3 +24,3 @@ clone(sentence) {

}
return { pos: operand.pos, name: operand.name, children, number: operand.number, type: operand.type, returnType: contract_1.Type.toString(operand.returnType) };
return { pos: operand.pos, name: operand.name, children, number: operand.number, type: operand.type, returnType: json_light_1.Type.stringify(operand.returnType) };
}

@@ -35,3 +36,3 @@ _deserialize(metadata) {

// eslint-disable-next-line no-case-declarations
const operand = new contract_1.Operand(metadata.pos, metadata.name, contract_1.OperandType[metadata.type], children, contract_1.Type.to(metadata.returnType));
const operand = new contract_1.Operand(metadata.pos, metadata.name, contract_1.OperandType[metadata.type], children, json_light_1.Type.to(metadata.returnType));
operand.number = metadata.number;

@@ -38,0 +39,0 @@ return operand;

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

import { Operand, IModelManager, Type, ITypeManager, OperatorMetadata } from '../contract';
import { Operand, IModelManager, ITypeManager, OperatorMetadata } from '../contract';
import { Type } from 'json-light';
export declare class TypeManager implements ITypeManager {

@@ -3,0 +4,0 @@ protected readonly model: IModelManager;

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

const contract_1 = require("../contract");
const json_light_1 = require("json-light");
class TypeManager {

@@ -27,3 +28,3 @@ // eslint-disable-next-line no-useless-constructor

this.setUndefinedAsAny(operand);
return operand.returnType || contract_1.Type.any;
return operand.returnType || json_light_1.Type.any;
}

@@ -81,3 +82,3 @@ solveType(operand) {

if (operand.returnType === undefined) {
operand.returnType = contract_1.Type.any;
operand.returnType = json_light_1.Type.any;
}

@@ -95,3 +96,3 @@ for (const child of operand.children) {

}
obj.returnType = contract_1.Type.Obj(properties);
obj.returnType = json_light_1.Type.Obj(properties);
}

@@ -101,7 +102,7 @@ solveProperty(property) {

if (property.children[0].returnType === undefined) {
property.children[0].returnType = contract_1.Type.List(contract_1.Type.Obj([{ name: property.name }]));
property.children[0].returnType = json_light_1.Type.List(json_light_1.Type.Obj([{ name: property.name }]));
}
else if (contract_1.Type.isList(property.children[0].returnType)) {
else if (json_light_1.Type.isList(property.children[0].returnType)) {
const listType = property.children[0].returnType.list;
if (listType.items && contract_1.Type.isObj(listType.items)) {
if (listType.items && json_light_1.Type.isObj(listType.items)) {
const objectType = listType.items.obj;

@@ -119,3 +120,3 @@ const propertyType = objectType.properties.find(p => p.name === property.name);

if (array.children[0].returnType !== undefined) {
array.returnType = contract_1.Type.List(array.children[0].returnType);
array.returnType = json_light_1.Type.List(array.children[0].returnType);
}

@@ -138,11 +139,11 @@ }

// TODO: hay que hacer que se pueda convertir de metadata type a Type y viceversa
arrow.returnType = contract_1.Type.to(metadata.returnType);
arrow.returnType = json_light_1.Type.to(metadata.returnType);
}
if (array.returnType === undefined && metadata.params[0].type && !this.isIndeterminateType(metadata.params[0].type)) {
// TODO: hay que hacer que se pueda convertir de metadata type a Type y viceversa
array.returnType = contract_1.Type.to(metadata.params[0].type);
array.returnType = json_light_1.Type.to(metadata.params[0].type);
}
if (predicate && metadata.params[1].type && !this.isIndeterminateType(metadata.params[1].type)) {
// TODO: hay que hacer que se pueda convertir de metadata type a Type y viceversa
predicate.returnType = contract_1.Type.to(metadata.params[1].type);
predicate.returnType = json_light_1.Type.to(metadata.params[1].type);
}

@@ -193,4 +194,4 @@ if (predicate) {

}
if (contract_1.Type.isPrimitive(type)) {
return contract_1.Type.to(type);
if (json_light_1.Type.isPrimitive(type)) {
return json_light_1.Type.to(type);
}

@@ -200,4 +201,4 @@ // si de acuerdo a la metadata el tipo es un array de primitivo, asigna el tipo, example: string[]

const elementType = type.substring(0, type.length - 2);
if (contract_1.Type.isPrimitive(elementType)) {
return contract_1.Type.List(contract_1.Type.get(elementType));
if (json_light_1.Type.isPrimitive(elementType)) {
return json_light_1.Type.List(json_light_1.Type.get(elementType));
}

@@ -211,3 +212,3 @@ }

if (array.children[0].returnType && array.children[0].returnType !== beforeType) {
array.returnType = contract_1.Type.List(array.children[0].returnType);
array.returnType = json_light_1.Type.List(array.children[0].returnType);
}

@@ -218,5 +219,5 @@ }

this.solveTemplate(property.children[0]);
if (property.children[0].returnType !== undefined && property.children[0].returnType !== beforeType && contract_1.Type.isList(property.children[0].returnType)) {
if (property.children[0].returnType !== undefined && property.children[0].returnType !== beforeType && json_light_1.Type.isList(property.children[0].returnType)) {
const arrayType = property.children[0].returnType.list;
if (contract_1.Type.isObj(arrayType.items)) {
if (json_light_1.Type.isObj(arrayType.items)) {
const objectType = arrayType.items.obj;

@@ -245,3 +246,3 @@ const propertyType = objectType.properties.find(p => p.name === property.name);

}
obj.returnType = contract_1.Type.Obj(properties);
obj.returnType = json_light_1.Type.Obj(properties);
}

@@ -256,3 +257,3 @@ }

}
else if (metadata.returnType === 'T[]' && contract_1.Type.isList(operator.returnType)) {
else if (metadata.returnType === 'T[]' && json_light_1.Type.isList(operator.returnType)) {
templateType = operator.returnType.list.items;

@@ -277,3 +278,3 @@ }

}
else if (paramMetadata.type === 'T[]' && contract_1.Type.isList(child.returnType)) {
else if (paramMetadata.type === 'T[]' && json_light_1.Type.isList(child.returnType)) {
templateType = child.returnType.list.items;

@@ -292,3 +293,3 @@ break;

else if (metadata.returnType === 'T[]') {
operator.returnType = contract_1.Type.List(templateType);
operator.returnType = json_light_1.Type.List(templateType);
}

@@ -310,3 +311,3 @@ }

else if (paramMetadata.type === 'T[]') {
child.returnType = contract_1.Type.List(templateType);
child.returnType = json_light_1.Type.List(templateType);
}

@@ -313,0 +314,0 @@ }

{
"name": "3xpr",
"version": "1.7.10",
"version": "1.8.0",
"description": "expressions",

@@ -20,3 +20,4 @@ "author": "Flavio Lionel Rita <flaviolrita@hotmail.com>",

"dependencies": {
"h3lp": "1.2.4"
"h3lp": "1.2.8",
"json-light": "0.1.0"
},

@@ -23,0 +24,0 @@ "keywords": [

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