@kontur.candy/generator 5.19.0 → 5.20.0-fs-8321-server-side-calculations.1
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/dist/index.js +84 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59207,7 +59207,8 @@ AbsoluteModelFieldPath.fieldExtractRegex = new RegExp(`^(.*)\\.(${AbsoluteModelF
|
|
|
59207
59207
|
"use strict";
|
|
59208
59208
|
__webpack_require__.r(__webpack_exports__);
|
|
59209
59209
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
59210
|
-
/* harmony export */ "buildIterationSequence": () => (/* binding */ buildIterationSequence)
|
|
59210
|
+
/* harmony export */ "buildIterationSequence": () => (/* binding */ buildIterationSequence),
|
|
59211
|
+
/* harmony export */ "buildIterationSequenceWithInstances": () => (/* binding */ buildIterationSequenceWithInstances)
|
|
59211
59212
|
/* harmony export */ });
|
|
59212
59213
|
/* harmony import */ var _ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ModelPath */ "./Common/ModelPath/ModelPath.ts");
|
|
59213
59214
|
|
|
@@ -59225,6 +59226,24 @@ function buildIterationSequence(modelPath) {
|
|
|
59225
59226
|
}
|
|
59226
59227
|
return result;
|
|
59227
59228
|
}
|
|
59229
|
+
function buildIterationSequenceWithInstances(modelPath) {
|
|
59230
|
+
const result = [];
|
|
59231
|
+
const tokens = modelPath.getPathPartsAsArray();
|
|
59232
|
+
const createPathFunc = modelPath.isAbsolute() ? _ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens : _ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens;
|
|
59233
|
+
let currentInstances = [];
|
|
59234
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
59235
|
+
const token = tokens[i];
|
|
59236
|
+
if (token === _ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each || _ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isInstanceToken(token)) {
|
|
59237
|
+
currentInstances = currentInstances.concat(token);
|
|
59238
|
+
result.push({
|
|
59239
|
+
iterable: createPathFunc(tokens.slice(0, i).map(x => _ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isInstanceToken(x) ? _ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each : x)),
|
|
59240
|
+
suffix: (0,_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)(tokens.slice(i + 1)),
|
|
59241
|
+
instances: currentInstances
|
|
59242
|
+
});
|
|
59243
|
+
}
|
|
59244
|
+
}
|
|
59245
|
+
return result;
|
|
59246
|
+
}
|
|
59228
59247
|
|
|
59229
59248
|
/***/ }),
|
|
59230
59249
|
|
|
@@ -59290,6 +59309,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
59290
59309
|
/* harmony export */ "Map2": () => (/* binding */ Map2)
|
|
59291
59310
|
/* harmony export */ });
|
|
59292
59311
|
/* harmony import */ var _TypingUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../TypingUtils */ "./Common/TypingUtils.ts");
|
|
59312
|
+
/* harmony import */ var _IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../IterableUtils */ "./Common/IterableUtils.ts");
|
|
59313
|
+
|
|
59293
59314
|
|
|
59294
59315
|
class Map2 {
|
|
59295
59316
|
constructor() {
|
|
@@ -59308,6 +59329,18 @@ class Map2 {
|
|
|
59308
59329
|
has(key) {
|
|
59309
59330
|
return this.getEntryOrUndefined(key) != undefined;
|
|
59310
59331
|
}
|
|
59332
|
+
remove(key) {
|
|
59333
|
+
const hash = this.getKeyHash(key);
|
|
59334
|
+
const list = this.hashMap.get(hash);
|
|
59335
|
+
if (list != undefined) {
|
|
59336
|
+
const removingEntry = Iterator.from(_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.iterateEntries(list)).find(([index, [itemKey, itemValue]]) => this.areKeyEqual(itemKey, key));
|
|
59337
|
+
if (removingEntry != undefined) {
|
|
59338
|
+
list.splice(removingEntry[0], 1);
|
|
59339
|
+
return true;
|
|
59340
|
+
}
|
|
59341
|
+
}
|
|
59342
|
+
return false;
|
|
59343
|
+
}
|
|
59311
59344
|
get isEmpty() {
|
|
59312
59345
|
return this.hashMap.size === 0;
|
|
59313
59346
|
}
|
|
@@ -59527,6 +59560,7 @@ class ModelPathImpl {
|
|
|
59527
59560
|
this.tokens = void 0;
|
|
59528
59561
|
this.absolute = void 0;
|
|
59529
59562
|
this.legacyPath = void 0;
|
|
59563
|
+
this.cachedHash = void 0;
|
|
59530
59564
|
this.tokens = pathParts.filter(x => x !== "");
|
|
59531
59565
|
this.absolute = absolute;
|
|
59532
59566
|
}
|
|
@@ -59623,32 +59657,35 @@ class ModelPathImpl {
|
|
|
59623
59657
|
* Всегда целое положительное беззнаковое 32-битное число
|
|
59624
59658
|
*/
|
|
59625
59659
|
getHash(eachCurrentCollision = _EachCurrentCollision__WEBPACK_IMPORTED_MODULE_2__.EachCurrentCollision.AreSame) {
|
|
59626
|
-
|
|
59627
|
-
|
|
59628
|
-
|
|
59629
|
-
|
|
59630
|
-
|
|
59631
|
-
|
|
59632
|
-
if (eachCurrentCollision === _EachCurrentCollision__WEBPACK_IMPORTED_MODULE_2__.EachCurrentCollision.AreDifferent) {
|
|
59633
|
-
currentStr = token === PathTokens.each ? "*" : "!";
|
|
59660
|
+
if (this.cachedHash == undefined) {
|
|
59661
|
+
let hash = 5381;
|
|
59662
|
+
for (const token of (0,_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.reverseArray)(this.tokens)) {
|
|
59663
|
+
let currentStr;
|
|
59664
|
+
if (PathTokens.isSimpleToken(token)) {
|
|
59665
|
+
currentStr = token;
|
|
59634
59666
|
} else {
|
|
59635
|
-
|
|
59667
|
+
if (eachCurrentCollision === _EachCurrentCollision__WEBPACK_IMPORTED_MODULE_2__.EachCurrentCollision.AreDifferent) {
|
|
59668
|
+
currentStr = token === PathTokens.each ? "*" : "!";
|
|
59669
|
+
} else {
|
|
59670
|
+
currentStr = "*";
|
|
59671
|
+
}
|
|
59672
|
+
}
|
|
59673
|
+
let stringIndex = currentStr.length;
|
|
59674
|
+
while (stringIndex) {
|
|
59675
|
+
// tslint:disable-next-line:no-bitwise
|
|
59676
|
+
hash = hash * 33 ^ currentStr.charCodeAt(--stringIndex);
|
|
59636
59677
|
}
|
|
59637
59678
|
}
|
|
59638
|
-
let stringIndex = currentStr.length;
|
|
59639
|
-
while (stringIndex) {
|
|
59640
|
-
// tslint:disable-next-line:no-bitwise
|
|
59641
|
-
hash = hash * 33 ^ currentStr.charCodeAt(--stringIndex);
|
|
59642
|
-
}
|
|
59643
|
-
}
|
|
59644
59679
|
|
|
59645
|
-
|
|
59646
|
-
|
|
59647
|
-
|
|
59648
|
-
|
|
59649
|
-
|
|
59650
|
-
|
|
59651
|
-
|
|
59680
|
+
/*
|
|
59681
|
+
tslint:disable-next-line:no-bitwise
|
|
59682
|
+
JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
|
59683
|
+
integers. Since we want the results to be always positive, convert the
|
|
59684
|
+
signed int to an unsigned by doing an unsigned bitshift.
|
|
59685
|
+
*/
|
|
59686
|
+
this.cachedHash = hash >>> 0;
|
|
59687
|
+
}
|
|
59688
|
+
return this.cachedHash;
|
|
59652
59689
|
}
|
|
59653
59690
|
isIncludes(modelPath) {
|
|
59654
59691
|
const targetTokens = modelPath.getPathPartsAsArray();
|
|
@@ -59788,7 +59825,7 @@ class ModelPathImpl {
|
|
|
59788
59825
|
// @ts-expect-error
|
|
59789
59826
|
return result.toPath();
|
|
59790
59827
|
}
|
|
59791
|
-
applyInstancesDirty(instances) {
|
|
59828
|
+
applyInstancesDirty(instances, fillWithMultiplicityIfHasNoInstance) {
|
|
59792
59829
|
if (this.isResolved() || instances.length === 0) {
|
|
59793
59830
|
return this;
|
|
59794
59831
|
}
|
|
@@ -59797,7 +59834,8 @@ class ModelPathImpl {
|
|
|
59797
59834
|
for (const token of this.getPathParts()) {
|
|
59798
59835
|
if (PathTokens.isMultiToken(token) && instanceCounter < instances.length) {
|
|
59799
59836
|
var _instances$instanceCo;
|
|
59800
|
-
|
|
59837
|
+
const instanceOrEach = (_instances$instanceCo = instances[instanceCounter]) !== null && _instances$instanceCo !== void 0 ? _instances$instanceCo : fillWithMultiplicityIfHasNoInstance == true ? PathTokens.each : (0,_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)();
|
|
59838
|
+
result.append(instanceOrEach);
|
|
59801
59839
|
instanceCounter++;
|
|
59802
59840
|
} else {
|
|
59803
59841
|
result.append(token);
|
|
@@ -83110,6 +83148,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
83110
83148
|
/* harmony import */ var _DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../DataSchema/DataSchemaUtils */ "./Generator/src/generators/DataSchema/DataSchemaUtils.ts");
|
|
83111
83149
|
/* harmony import */ var _FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../FLang/FlangUtils */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FlangUtils.ts");
|
|
83112
83150
|
/* harmony import */ var _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../../Common/ModelPath/AbsoluteModelFieldPath */ "./Common/ModelPath/AbsoluteModelFieldPath.ts");
|
|
83151
|
+
/* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
|
|
83152
|
+
|
|
83113
83153
|
|
|
83114
83154
|
|
|
83115
83155
|
|
|
@@ -83141,20 +83181,27 @@ class FormulaRulesBuilder {
|
|
|
83141
83181
|
const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
|
|
83142
83182
|
const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
|
|
83143
83183
|
const getFormulaExpression = targetField => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, targetField), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue));
|
|
83144
|
-
const
|
|
83145
|
-
|
|
83146
|
-
|
|
83147
|
-
|
|
83148
|
-
result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value")));
|
|
83149
|
-
} else {
|
|
83150
|
-
result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("true")), getFormulaExpression("value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue)))));
|
|
83151
|
-
}
|
|
83152
|
-
} else {
|
|
83153
|
-
result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value")));
|
|
83154
|
-
}
|
|
83155
|
-
result.push(...precalculationRules);
|
|
83184
|
+
const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
|
|
83185
|
+
const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
|
|
83186
|
+
const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget) : undefined;
|
|
83187
|
+
const result = [autoValueRule, autoFlagRule, valueRule].concat(...precalculationRules).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined);
|
|
83156
83188
|
return result;
|
|
83157
83189
|
}
|
|
83190
|
+
createAutoValueRule(fullTarget, getFormulaExpression) {
|
|
83191
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "autoValue"), getFormulaExpression("autoValue"));
|
|
83192
|
+
}
|
|
83193
|
+
createRegularValueRule(fullTarget, getFormulaExpression) {
|
|
83194
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
|
|
83195
|
+
}
|
|
83196
|
+
createAutoFlagRule(fullTarget) {
|
|
83197
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("false"))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.BuildInTypeExpression.string), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"))));
|
|
83198
|
+
}
|
|
83199
|
+
createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) {
|
|
83200
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
|
|
83201
|
+
}
|
|
83202
|
+
createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) {
|
|
83203
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("true")), getFormulaExpression("value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue))));
|
|
83204
|
+
}
|
|
83158
83205
|
adjustPathMultiplicity(path) {
|
|
83159
83206
|
return (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__.adjustPathMultiplicityComplex)(path, this.formSchemaRng, this.dataDeclarationHelper);
|
|
83160
83207
|
}
|