Comparing version 1.12.2 to 1.12.3
@@ -1,8 +0,3 @@ | ||
export * from './services/parser'; | ||
export * from './services/builder'; | ||
export * from './services/builderCacheDecorator'; | ||
export * from './useCases/evaluate'; | ||
export * from './useCases/evaluateObserveDecorator'; | ||
export * from './ports/converter'; | ||
export * from './services/normalizer'; | ||
export * from './useCases/build'; |
@@ -17,10 +17,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./services/parser"), exports); | ||
__exportStar(require("./services/builder"), exports); | ||
__exportStar(require("./services/builderCacheDecorator"), exports); | ||
__exportStar(require("./useCases/evaluate"), exports); | ||
__exportStar(require("./useCases/evaluateObserveDecorator"), exports); | ||
__exportStar(require("./ports/converter"), exports); | ||
__exportStar(require("./services/normalizer"), exports); | ||
__exportStar(require("./useCases/build"), exports); | ||
//# sourceMappingURL=index.js.map |
import { Context } from '../../../shared/domain'; | ||
import { OperandBuild } from '..'; | ||
import { ExpressionEvaluate } from '../../domain'; | ||
import { OperandFacade } from '../../../operand/domain'; | ||
export declare class ExpressionEvaluateImpl implements ExpressionEvaluate { | ||
private readonly operandBuild; | ||
constructor(operandBuild: OperandBuild); | ||
private readonly operand; | ||
constructor(operand: OperandFacade); | ||
eval(expression: string, context: Context): any; | ||
evalAsync(expression: string, context: Context): Promise<any>; | ||
} |
@@ -6,11 +6,11 @@ "use strict"; | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(operandBuild) { | ||
this.operandBuild = operandBuild; | ||
constructor(operand) { | ||
this.operand = operand; | ||
} | ||
eval(expression, context) { | ||
const operand = this.operandBuild.build(expression, 'sync'); | ||
const operand = this.operand.build(expression, 'sync'); | ||
return operand.eval(context); | ||
} | ||
async evalAsync(expression, context) { | ||
const operand = this.operandBuild.build(expression, 'async'); | ||
const operand = this.operand.build(expression, 'async'); | ||
return operand.eval(context); | ||
@@ -17,0 +17,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { OperatorMetadata, OperatorAdditionalInfo, FunctionAdditionalInfo, EvaluatorFactory } from '../../operand/domain'; | ||
import { OperatorMetadata, OperatorAdditionalInfo, FunctionAdditionalInfo, EvaluatorFactory, ConstBuilder } from '../../operand/domain'; | ||
import { Format, Parameter, ActionObserver, Operand } from '../../shared/domain'; | ||
@@ -11,2 +11,3 @@ import { ModelService, Library } from '../../model/domain'; | ||
get functions(): [string, OperatorMetadata][]; | ||
constBuilder: ConstBuilder; | ||
getEvaluatorFactory(key: string): EvaluatorFactory; | ||
@@ -13,0 +14,0 @@ addOperator(sing: string, source: any, additionalInfo: OperatorAdditionalInfo): void; |
import { ModelService, Library } from '../../model/domain'; | ||
import { Operand, Parameter, Format, ActionObserver } from '../../shared/domain'; | ||
import { OperatorMetadata, FunctionAdditionalInfo, OperatorAdditionalInfo, EvaluatorFactory } from '../../operand/domain'; | ||
import { OperatorMetadata, FunctionAdditionalInfo, OperatorAdditionalInfo, EvaluatorFactory, ConstBuilder } from '../../operand/domain'; | ||
import { IExpressions } from '../domain'; | ||
@@ -8,5 +8,3 @@ export declare class Expressions implements IExpressions { | ||
private expressionConvert; | ||
private parameterService; | ||
private operandBuild; | ||
private operandClone; | ||
private operandFacade; | ||
private expressionEvaluator; | ||
@@ -20,3 +18,2 @@ constructor(); | ||
get functions(): [string, OperatorMetadata][]; | ||
getEvaluatorFactory(key: string): EvaluatorFactory; | ||
addOperator(sing: string, source: any, additionalInfo: OperatorAdditionalInfo): void; | ||
@@ -30,2 +27,4 @@ addFunction(sing: string, source: any, additionalInfo?: FunctionAdditionalInfo): void; | ||
convert(source: any, from: string): [string, any]; | ||
get constBuilder(): ConstBuilder; | ||
getEvaluatorFactory(key: string): EvaluatorFactory; | ||
/** | ||
@@ -43,2 +42,4 @@ * Get parameters of expression | ||
type(expression: string): string; | ||
build(expression: string): Operand; | ||
clone(source: Operand): Operand; | ||
/** | ||
@@ -54,4 +55,2 @@ * Evaluate and solve expression | ||
unsubscribe(observer: ActionObserver): void; | ||
build(expression: string): Operand; | ||
clone(source: Operand): Operand; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Expressions = void 0; | ||
const typ3s_1 = require("typ3s"); | ||
const h3lp_1 = require("h3lp"); | ||
const domain_1 = require("../../shared/domain"); | ||
const application_1 = require("../../operand/application"); | ||
const library_1 = require("./library"); | ||
const application_2 = require("../application"); | ||
const application_1 = require("../application"); | ||
const convert_1 = require("../application/useCases/convert"); | ||
const application_3 = require("../../model/application"); | ||
const infrastructure_1 = require("../../operand/infrastructure"); | ||
const application_2 = require("../../model/application"); | ||
const convertFromFunction_1 = require("./convertFrom/convertFromFunction"); | ||
const convertFromGraphql_1 = require("./convertFrom/convertFromGraphql"); | ||
const infrastructure_1 = require("../../operand/infrastructure"); | ||
class Expressions { | ||
constructor() { | ||
const constBuilder = new infrastructure_1.ConstBuilderImpl(); | ||
this.model = new application_3.ModelServiceImpl(); | ||
this.operandClone = new application_1.OperandClone(); | ||
this.parameterService = new application_1.ParameterServiceImpl(); | ||
const operandSerializer = new application_1.OperandSerializerImpl(); | ||
this.operandBuild = new application_2.OperandBuild() | ||
.add('sync', new application_2.OperandBuilderCacheDecorator(new application_2.OperandBuilderImpl(new infrastructure_1.SyncEvaluatorFactoryBuilder(this.model).build(), this.model, constBuilder), new h3lp_1.MemoryCache(), operandSerializer)) | ||
.add('async', new application_2.OperandBuilderCacheDecorator(new application_2.OperandBuilderImpl(new infrastructure_1.AsyncEvaluatorFactoryBuilder(this.model).build(), this.model, constBuilder), new h3lp_1.MemoryCache(), operandSerializer)); | ||
this.model = new application_2.ModelServiceImpl(); | ||
this.operandFacade = new infrastructure_1.OperandFacadeImpl(this.model); | ||
this.expressionConvert = new convert_1.ExpressionConvert() | ||
.add('function', new convertFromFunction_1.ExpressionConvertFunction(this.operandBuild.get('sync'))) | ||
.add('function', new convertFromFunction_1.ExpressionConvertFunction(this.operandFacade.getBuilder('sync'))) | ||
.add('graphql', new convertFromGraphql_1.ExpressionConvertGraphql()); | ||
new library_1.CoreLibrary(this.operandBuild.get('sync')).load(this.model); | ||
this.expressionEvaluator = new application_2.ExpressionEvaluateObserveDecorator(new application_2.ExpressionEvaluateImpl(this.operandBuild)); | ||
new library_1.CoreLibrary(this.operandFacade.getBuilder('sync')).load(this.model); | ||
this.expressionEvaluator = new application_1.ExpressionEvaluateObserveDecorator(new application_1.ExpressionEvaluateImpl(this.operandFacade)); | ||
} | ||
@@ -50,5 +41,2 @@ addLibrary(library) { | ||
} | ||
getEvaluatorFactory(key) { | ||
return this.operandBuild.get(key).evaluatorFactory; | ||
} | ||
addOperator(sing, source, additionalInfo) { | ||
@@ -78,2 +66,8 @@ this.model.addOperator(source, sing, additionalInfo); | ||
} | ||
get constBuilder() { | ||
return this.operandFacade.constBuilder; | ||
} | ||
getEvaluatorFactory(key) { | ||
return this.operandFacade.getBuilder(key).evaluatorFactory; | ||
} | ||
/** | ||
@@ -85,4 +79,3 @@ * Get parameters of expression | ||
parameters(expression) { | ||
const operand = this.operandBuild.build(expression, 'sync'); | ||
return this.parameterService.parameters(operand); | ||
return this.operandFacade.parameters(expression); | ||
} | ||
@@ -95,5 +88,10 @@ /** | ||
type(expression) { | ||
const operand = this.operandBuild.build(expression, 'sync'); | ||
return typ3s_1.Type.stringify(operand.returnType); | ||
return this.operandFacade.type(expression); | ||
} | ||
build(expression) { | ||
return this.operandFacade.build(expression, 'sync'); | ||
} | ||
clone(source) { | ||
return this.operandFacade.clone(source); | ||
} | ||
/** | ||
@@ -120,10 +118,4 @@ * Evaluate and solve expression | ||
} | ||
build(expression) { | ||
return this.operandBuild.build(expression, 'sync'); | ||
} | ||
clone(source) { | ||
return this.operandClone.clone(source, 'sync'); | ||
} | ||
} | ||
exports.Expressions = Expressions; | ||
//# sourceMappingURL=expressions.js.map |
@@ -8,3 +8,7 @@ export * from './services/factory'; | ||
export * from './services/typeService'; | ||
export * from './useCases/build'; | ||
export * from './services/parameterService'; | ||
export * from './services/constBuilder'; | ||
export * from './services/parser'; | ||
export * from './services/builder'; | ||
export * from './services/builderCacheDecorator'; | ||
export * from './services/normalizer'; |
@@ -24,4 +24,8 @@ "use strict"; | ||
__exportStar(require("./services/typeService"), exports); | ||
__exportStar(require("./useCases/build"), exports); | ||
__exportStar(require("./services/parameterService"), exports); | ||
__exportStar(require("./services/constBuilder"), exports); | ||
__exportStar(require("./services/parser"), exports); | ||
__exportStar(require("./services/builder"), exports); | ||
__exportStar(require("./services/builderCacheDecorator"), exports); | ||
__exportStar(require("./services/normalizer"), exports); | ||
//# sourceMappingURL=index.js.map |
import { ModelService } from '../../../model/domain'; | ||
import { Operand } from '../../../shared/domain'; | ||
import { ConstBuilder } from '../services/constBuilder'; | ||
import { ConstBuilder } from '../../domain/constBuilder'; | ||
export declare class OperandReduce { | ||
@@ -5,0 +5,0 @@ private readonly model; |
export * from './services'; | ||
export * from './entities'; | ||
export * from './constBuilder'; |
@@ -19,2 +19,3 @@ "use strict"; | ||
__exportStar(require("./entities"), exports); | ||
__exportStar(require("./constBuilder"), exports); | ||
//# sourceMappingURL=index.js.map |
import { IEvaluator, Operand, Parameter } from '../../shared/domain'; | ||
import { Type } from 'typ3s'; | ||
import { EvaluatorBuilder } from './entities'; | ||
import { ConstBuilder } from './constBuilder'; | ||
export interface EvaluatorFactory { | ||
@@ -28,1 +29,9 @@ add(key: string, evaluator: EvaluatorBuilder): EvaluatorFactory; | ||
} | ||
export interface OperandFacade { | ||
constBuilder: ConstBuilder; | ||
getBuilder(key: string): OperandBuilder; | ||
parameters(expression: string): Parameter[]; | ||
type(expression: string): string; | ||
build(expression: string, key: string): Operand; | ||
clone(source: Operand): Operand; | ||
} |
import { Operand, Position } from '../../shared/domain'; | ||
import { ConstBuilder } from '../application'; | ||
import { ConstBuilder } from '../domain'; | ||
export declare class ConstBuilderImpl implements ConstBuilder { | ||
build(pos: Position, value: any): Operand; | ||
} |
import { Context, Operand } from '../../shared/domain'; | ||
import { IOperandHelper } from '../../shared/application'; | ||
import { ConstBuilder } from '../application/services/constBuilder'; | ||
import { ConstBuilder } from '../domain/constBuilder'; | ||
export declare class OperandHelper implements IOperandHelper { | ||
@@ -5,0 +5,0 @@ private readonly constBuilder; |
export * from './helper'; | ||
export * from './constBuilder'; | ||
export * from './evaluators/sync'; | ||
export * from './evaluators/async'; | ||
export * from './facade'; |
@@ -18,5 +18,3 @@ "use strict"; | ||
__exportStar(require("./helper"), exports); | ||
__exportStar(require("./constBuilder"), exports); | ||
__exportStar(require("./evaluators/sync"), exports); | ||
__exportStar(require("./evaluators/async"), exports); | ||
__exportStar(require("./facade"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "3xpr", | ||
"version": "1.12.2", | ||
"version": "1.12.3", | ||
"description": "expressions", | ||
@@ -5,0 +5,0 @@ "author": "Flavio Lionel Rita <flaviolrita@hotmail.com>", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
586451
241
7084