Comparing version 1.12.7 to 1.12.8
@@ -11,3 +11,2 @@ "use strict"; | ||
const infrastructure_1 = require("../../operand/infrastructure"); | ||
const application_3 = require("../../operand/application"); | ||
class ExpressionsBuilder { | ||
@@ -24,4 +23,3 @@ // eslint-disable-next-line no-useless-constructor | ||
.addConvert('graphql', new convertFromGraphql_1.ExpressionConvertGraphql()); | ||
const operandClone = new application_3.OperandClone(); | ||
new library_1.CoreLibrary(operandFacade.getBuilder('sync'), operandClone).load(model); | ||
new library_1.CoreLibrary(operandFacade.getBuilder('sync'), operandFacade).load(model); | ||
const expressionEvaluator = new application_1.ExpressionEvaluateObserveDecorator(new application_1.ExpressionEvaluateImpl(operandFacade)); | ||
@@ -28,0 +26,0 @@ return new application_1.ExpressionsImpl(model, expressionConvert, operandFacade, expressionEvaluator, expressionEvaluator); |
import { ModelService, Library } from '../../model/domain'; | ||
import { OperandBuilder } from '../../operand/domain'; | ||
import { OperandClone } from '../../operand/application'; | ||
import { OperandBuilder, OperandCloner } from '../../operand/domain'; | ||
export declare class CoreLibrary implements Library { | ||
private readonly builder; | ||
private readonly operandClone; | ||
constructor(builder: OperandBuilder, operandClone: OperandClone); | ||
private readonly cloner; | ||
constructor(builder: OperandBuilder, cloner: OperandCloner); | ||
load(model: ModelService): void; | ||
@@ -9,0 +8,0 @@ private constants; |
@@ -9,5 +9,5 @@ "use strict"; | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(builder, operandClone) { | ||
constructor(builder, cloner) { | ||
this.builder = builder; | ||
this.operandClone = operandClone; | ||
this.cloner = cloner; | ||
} | ||
@@ -352,3 +352,3 @@ load(model) { | ||
arrayFunctions(model) { | ||
model.addFunction('map(list: any[], predicate: T):T[]', new Map(this.builder, this.operandClone)); | ||
model.addFunction('map(list: any[], predicate: T):T[]', new Map(this.builder, this.cloner)); | ||
model.addFunctionAlias('select', 'map'); | ||
@@ -607,9 +607,9 @@ model.addFunction('foreach(list: any[], predicate: any):void', new Foreach()); | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(builder, operandClone, operand) { | ||
constructor(builder, cloner, operand) { | ||
super(operand); | ||
this.builder = builder; | ||
this.operandClone = operandClone; | ||
this.cloner = cloner; | ||
} | ||
clone(operand) { | ||
return new Map(this.builder, this.operandClone, operand); | ||
return new Map(this.builder, this.cloner, operand); | ||
} | ||
@@ -647,3 +647,3 @@ eval(context) { | ||
for (const keyValue of aggregates) { | ||
const operandCloned = this.operandClone.clone(keyValue.children[0], 'sync'); | ||
const operandCloned = this.cloner.clone(keyValue.children[0], 'sync'); | ||
const operandResolved = __1.helper.operand.solveAggregates(key.items, variable, operandCloned, context); | ||
@@ -650,0 +650,0 @@ const value = operandResolved.eval(context); |
@@ -0,4 +1,6 @@ | ||
import { EvaluatorFactory } from '../../domain'; | ||
import { Operand } from '../../../shared/domain'; | ||
export declare class OperandClone { | ||
private factories; | ||
private readonly factories; | ||
constructor(factories: [string, EvaluatorFactory][]); | ||
private getFactory; | ||
@@ -5,0 +7,0 @@ clone(operand: Operand, type: string): Operand; |
@@ -6,7 +6,13 @@ "use strict"; | ||
class OperandClone { | ||
constructor() { | ||
this.factories = {}; | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(factories) { | ||
this.factories = factories; | ||
} | ||
getFactory(key) { | ||
return this.factories[key]; | ||
var _a; | ||
const factory = (_a = this.factories.find(p => p[0] === key)) === null || _a === void 0 ? void 0 : _a[1]; | ||
if (factory === undefined) { | ||
throw new Error(`Factory ${key} not found`); | ||
} | ||
return factory; | ||
} | ||
@@ -13,0 +19,0 @@ clone(operand, type) { |
@@ -29,3 +29,6 @@ import { IEvaluator, Operand, Parameter } from '../../shared/domain'; | ||
} | ||
export interface OperandFacade { | ||
export interface OperandCloner { | ||
clone(source: Operand, key?: string): Operand; | ||
} | ||
export interface OperandFacade extends OperandCloner { | ||
constBuilder: ConstBuilder; | ||
@@ -36,3 +39,2 @@ getBuilder(key: string): OperandBuilder; | ||
build(expression: string, key?: string): Operand; | ||
clone(source: Operand, key?: string): Operand; | ||
} |
@@ -24,3 +24,3 @@ "use strict"; | ||
const asyncEvaluatorFactory = new sync_1.SyncEvaluatorFactoryBuilder(this.model).build(); | ||
const operandClone = new clone_1.OperandClone(); | ||
const operandClone = new clone_1.OperandClone([['sync', syncEvaluatorFactory], ['async', asyncEvaluatorFactory]]); | ||
const parameterService = new parameterService_1.ParameterServiceImpl(); | ||
@@ -27,0 +27,0 @@ const operandSerializer = new serializer_1.OperandSerializerImpl(); |
{ | ||
"name": "3xpr", | ||
"version": "1.12.7", | ||
"version": "1.12.8", | ||
"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
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
589543
7143