3xpr 1.12.2 → 1.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/expression/{infrastructure → application}/expressions.d.ts +29 -14
- package/expression/application/expressions.js +153 -0
- package/expression/application/expressions.js.map +1 -0
- package/expression/application/index.d.ts +1 -6
- package/expression/application/index.js +1 -6
- package/expression/application/index.js.map +1 -1
- package/expression/application/useCases/convert.d.ts +4 -4
- package/expression/application/useCases/convert.js +7 -6
- package/expression/application/useCases/convert.js.map +1 -1
- package/expression/application/useCases/evaluate.d.ts +3 -3
- package/expression/application/useCases/evaluate.js +4 -4
- package/expression/application/useCases/evaluate.js.map +1 -1
- package/expression/application/useCases/evaluateObserveDecorator.d.ts +2 -2
- package/expression/domain/expressions.d.ts +21 -27
- package/expression/infrastructure/convertFrom/convertFromGraphql.d.ts +1 -1
- package/expression/infrastructure/expressionsBuilder.d.ts +4 -0
- package/expression/infrastructure/expressionsBuilder.js +24 -0
- package/expression/infrastructure/expressionsBuilder.js.map +1 -0
- package/expression/infrastructure/index.d.ts +1 -1
- package/expression/infrastructure/index.js +1 -1
- package/expression/infrastructure/index.js.map +1 -1
- package/index.d.ts +1 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/model/application/modelService.d.ts +2 -1
- package/model/application/modelService.js +3 -0
- package/model/application/modelService.js.map +1 -1
- package/model/domain/services.d.ts +2 -0
- package/operand/application/facade.d.ts +26 -0
- package/operand/application/facade.js +42 -0
- package/operand/application/facade.js.map +1 -0
- package/operand/application/index.d.ts +6 -1
- package/operand/application/index.js +6 -1
- package/operand/application/index.js.map +1 -1
- package/{expression → operand}/application/services/builder.d.ts +1 -2
- package/{expression → operand}/application/services/builder.js +5 -5
- package/operand/application/services/builder.js.map +1 -0
- package/{expression → operand}/application/services/builderCacheDecorator.d.ts +2 -2
- package/{expression → operand}/application/services/builderCacheDecorator.js +2 -2
- package/operand/application/services/builderCacheDecorator.js.map +1 -0
- package/operand/application/services/normalizer.js.map +1 -0
- package/operand/application/services/parser.js.map +1 -0
- package/{expression → operand}/application/useCases/build.d.ts +1 -1
- package/operand/application/useCases/build.js.map +1 -0
- package/operand/application/useCases/reduce.d.ts +1 -1
- package/operand/{application/services → domain}/constBuilder.d.ts +1 -1
- package/operand/domain/constBuilder.js.map +1 -0
- package/operand/domain/index.d.ts +1 -0
- package/operand/domain/index.js +1 -0
- package/operand/domain/index.js.map +1 -1
- package/operand/domain/services.d.ts +9 -0
- package/operand/infrastructure/constBuilder.d.ts +1 -1
- package/operand/infrastructure/facadeBuilder.d.ts +5 -0
- package/operand/infrastructure/facadeBuilder.js +28 -0
- package/operand/infrastructure/facadeBuilder.js.map +1 -0
- package/operand/infrastructure/helper.d.ts +1 -1
- package/operand/infrastructure/index.d.ts +1 -3
- package/operand/infrastructure/index.js +1 -3
- package/operand/infrastructure/index.js.map +1 -1
- package/package.json +1 -1
- package/expression/application/ports/converter.d.ts +0 -3
- package/expression/application/ports/converter.js +0 -3
- package/expression/application/ports/converter.js.map +0 -1
- package/expression/application/services/builder.js.map +0 -1
- package/expression/application/services/builderCacheDecorator.js.map +0 -1
- package/expression/application/services/normalizer.js.map +0 -1
- package/expression/application/services/parser.js.map +0 -1
- package/expression/application/useCases/build.js.map +0 -1
- package/expression/infrastructure/expressions.js +0 -124
- package/expression/infrastructure/expressions.js.map +0 -1
- package/operand/application/services/constBuilder.js.map +0 -1
- /package/{expression → operand}/application/services/normalizer.d.ts +0 -0
- /package/{expression → operand}/application/services/normalizer.js +0 -0
- /package/{expression → operand}/application/services/parser.d.ts +0 -0
- /package/{expression → operand}/application/services/parser.js +0 -0
- /package/{expression → operand}/application/useCases/build.js +0 -0
- /package/operand/{application/services → domain}/constBuilder.js +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Expressions = void 0;
|
|
4
|
-
const typ3s_1 = require("typ3s");
|
|
5
|
-
const h3lp_1 = require("h3lp");
|
|
6
|
-
const domain_1 = require("../../shared/domain");
|
|
7
|
-
const application_1 = require("../../operand/application");
|
|
8
|
-
const library_1 = require("./library");
|
|
9
|
-
const application_2 = require("../application");
|
|
10
|
-
const convert_1 = require("../application/useCases/convert");
|
|
11
|
-
const application_3 = require("../../model/application");
|
|
12
|
-
const infrastructure_1 = require("../../operand/infrastructure");
|
|
13
|
-
const convertFromFunction_1 = require("./convertFrom/convertFromFunction");
|
|
14
|
-
const convertFromGraphql_1 = require("./convertFrom/convertFromGraphql");
|
|
15
|
-
class Expressions {
|
|
16
|
-
constructor() {
|
|
17
|
-
const constBuilder = new infrastructure_1.ConstBuilderImpl();
|
|
18
|
-
this.model = new application_3.ModelServiceImpl();
|
|
19
|
-
this.operandClone = new application_1.OperandClone();
|
|
20
|
-
this.parameterService = new application_1.ParameterServiceImpl();
|
|
21
|
-
const operandSerializer = new application_1.OperandSerializerImpl();
|
|
22
|
-
this.operandBuild = new application_2.OperandBuild()
|
|
23
|
-
.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))
|
|
24
|
-
.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));
|
|
25
|
-
this.expressionConvert = new convert_1.ExpressionConvert()
|
|
26
|
-
.add('function', new convertFromFunction_1.ExpressionConvertFunction(this.operandBuild.get('sync')))
|
|
27
|
-
.add('graphql', new convertFromGraphql_1.ExpressionConvertGraphql());
|
|
28
|
-
new library_1.CoreLibrary(this.operandBuild.get('sync')).load(this.model);
|
|
29
|
-
this.expressionEvaluator = new application_2.ExpressionEvaluateObserveDecorator(new application_2.ExpressionEvaluateImpl(this.operandBuild));
|
|
30
|
-
}
|
|
31
|
-
addLibrary(library) {
|
|
32
|
-
library.load(this.model);
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
get operators() {
|
|
36
|
-
return this.model.operators;
|
|
37
|
-
}
|
|
38
|
-
get enums() {
|
|
39
|
-
return this.model.enums;
|
|
40
|
-
}
|
|
41
|
-
get formats() {
|
|
42
|
-
return this.model.formats;
|
|
43
|
-
}
|
|
44
|
-
get constants() {
|
|
45
|
-
return this.model.constants;
|
|
46
|
-
}
|
|
47
|
-
get functions() {
|
|
48
|
-
return this.model.functions;
|
|
49
|
-
}
|
|
50
|
-
getEvaluatorFactory(key) {
|
|
51
|
-
return this.operandBuild.get(key).evaluatorFactory;
|
|
52
|
-
}
|
|
53
|
-
addOperator(sing, source, additionalInfo) {
|
|
54
|
-
this.model.addOperator(source, sing, additionalInfo);
|
|
55
|
-
}
|
|
56
|
-
addFunction(sing, source, additionalInfo) {
|
|
57
|
-
this.model.addFunction(sing, source, additionalInfo);
|
|
58
|
-
}
|
|
59
|
-
addEnum(key, values) {
|
|
60
|
-
this.model.addEnum(key, values);
|
|
61
|
-
}
|
|
62
|
-
addFormat(key, pattern) {
|
|
63
|
-
this.model.addFormat(key, pattern);
|
|
64
|
-
}
|
|
65
|
-
addConstant(key, value) {
|
|
66
|
-
this.model.addConstant(key, value);
|
|
67
|
-
}
|
|
68
|
-
addOperatorAlias(alias, reference) {
|
|
69
|
-
this.model.addOperatorAlias(alias, reference);
|
|
70
|
-
}
|
|
71
|
-
addFunctionAlias(alias, reference) {
|
|
72
|
-
this.model.addFunctionAlias(alias, reference);
|
|
73
|
-
}
|
|
74
|
-
convert(source, from) {
|
|
75
|
-
return this.expressionConvert.convert(source, from);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get parameters of expression
|
|
79
|
-
* @param expression expression
|
|
80
|
-
* @returns Parameters of expression
|
|
81
|
-
*/
|
|
82
|
-
parameters(expression) {
|
|
83
|
-
const operand = this.operandBuild.build(expression, 'sync');
|
|
84
|
-
return this.parameterService.parameters(operand);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Get type of expression
|
|
88
|
-
* @param expression expression
|
|
89
|
-
* @returns Type of expression
|
|
90
|
-
*/
|
|
91
|
-
type(expression) {
|
|
92
|
-
const operand = this.operandBuild.build(expression, 'sync');
|
|
93
|
-
return typ3s_1.Type.stringify(operand.returnType);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Evaluate and solve expression
|
|
97
|
-
* @param expression string expression
|
|
98
|
-
* @param data Data with variables
|
|
99
|
-
* @returns Result of the evaluate expression
|
|
100
|
-
*/
|
|
101
|
-
eval(expression, data) {
|
|
102
|
-
const context = new domain_1.Context(new domain_1.Data(data));
|
|
103
|
-
return this.expressionEvaluator.eval(expression, context);
|
|
104
|
-
}
|
|
105
|
-
evalAsync(expression, data = {}) {
|
|
106
|
-
const context = new domain_1.Context(new domain_1.Data(data));
|
|
107
|
-
return this.expressionEvaluator.evalAsync(expression, context);
|
|
108
|
-
}
|
|
109
|
-
// Listeners and subscribers
|
|
110
|
-
subscribe(observer) {
|
|
111
|
-
this.expressionEvaluator.subscribe(observer);
|
|
112
|
-
}
|
|
113
|
-
unsubscribe(observer) {
|
|
114
|
-
this.expressionEvaluator.unsubscribe(observer);
|
|
115
|
-
}
|
|
116
|
-
build(expression) {
|
|
117
|
-
return this.operandBuild.build(expression, 'sync');
|
|
118
|
-
}
|
|
119
|
-
clone(source) {
|
|
120
|
-
return this.operandClone.clone(source, 'sync');
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
exports.Expressions = Expressions;
|
|
124
|
-
//# sourceMappingURL=expressions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"expressions.js","sourceRoot":"","sources":["../../../../src/lib/expression/infrastructure/expressions.ts"],"names":[],"mappings":";;;AAAA,iCAA4B;AAC5B,+BAAkC;AAElC,gDAA+F;AAE/F,2DAAqG;AACrG,uCAAuC;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1D,CAAC;IAEM,SAAS,CAAE,UAAkB,EAAE,OAAY,EAAE;QACnD,MAAM,OAAO,GAAG,IAAI,gBAAO,CAAC,IAAI,aAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC;IAED,4BAA4B;IACrB,SAAS,CAAE,QAAuB;QACxC,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC7C,CAAC;IAEM,WAAW,CAAE,QAAuB;QAC1C,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC/C,CAAC;IAEM,KAAK,CAAE,UAAkB;QAC/B,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACnD,CAAC;IAEM,KAAK,CAAE,MAAc;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/C,CAAC;CACD;AAjJD,kCAiJC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constBuilder.js","sourceRoot":"","sources":["../../../../../src/lib/operand/application/services/constBuilder.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|