@kontur.candy/generator 5.19.1 → 5.20.0-fs-8321-server-side-calculations.2
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 +88 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59188,7 +59188,7 @@ class AbsoluteModelFieldPath {
|
|
|
59188
59188
|
return `${this.path.toLegacyPath()}.${this.field}`;
|
|
59189
59189
|
}
|
|
59190
59190
|
toLegacyPath() {
|
|
59191
|
-
const isLastTokenAnInstance = _ModelPath__WEBPACK_IMPORTED_MODULE_5__.PathTokens.
|
|
59191
|
+
const isLastTokenAnInstance = _ModelPath__WEBPACK_IMPORTED_MODULE_5__.PathTokens.isInstanceTokenOrInstancesSpec(_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.last(this.path.getPathParts()));
|
|
59192
59192
|
const slashIfRequired = isLastTokenAnInstance ? "/" : "";
|
|
59193
59193
|
return `${this.path.toLegacyPath()}${slashIfRequired}.${this.field}`;
|
|
59194
59194
|
}
|
|
@@ -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
|
}
|
|
@@ -59414,6 +59447,9 @@ class PathTokens {
|
|
|
59414
59447
|
static isInstanceToken(part) {
|
|
59415
59448
|
return typeof part === "string" && /^\d+$/i.test(part);
|
|
59416
59449
|
}
|
|
59450
|
+
static isInstanceTokenOrInstancesSpec(part) {
|
|
59451
|
+
return typeof part === "string" && (/^\d+$/i.test(part) || /^\[(\d+\,?)+\]$/i.test(part));
|
|
59452
|
+
}
|
|
59417
59453
|
}
|
|
59418
59454
|
PathTokens.each = EachSymbol;
|
|
59419
59455
|
PathTokens.current = CurrentSymbol;
|
|
@@ -59527,6 +59563,7 @@ class ModelPathImpl {
|
|
|
59527
59563
|
this.tokens = void 0;
|
|
59528
59564
|
this.absolute = void 0;
|
|
59529
59565
|
this.legacyPath = void 0;
|
|
59566
|
+
this.cachedHash = void 0;
|
|
59530
59567
|
this.tokens = pathParts.filter(x => x !== "");
|
|
59531
59568
|
this.absolute = absolute;
|
|
59532
59569
|
}
|
|
@@ -59623,32 +59660,35 @@ class ModelPathImpl {
|
|
|
59623
59660
|
* Всегда целое положительное беззнаковое 32-битное число
|
|
59624
59661
|
*/
|
|
59625
59662
|
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 ? "*" : "!";
|
|
59663
|
+
if (this.cachedHash == undefined) {
|
|
59664
|
+
let hash = 5381;
|
|
59665
|
+
for (const token of (0,_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.reverseArray)(this.tokens)) {
|
|
59666
|
+
let currentStr;
|
|
59667
|
+
if (PathTokens.isSimpleToken(token)) {
|
|
59668
|
+
currentStr = token;
|
|
59634
59669
|
} else {
|
|
59635
|
-
|
|
59670
|
+
if (eachCurrentCollision === _EachCurrentCollision__WEBPACK_IMPORTED_MODULE_2__.EachCurrentCollision.AreDifferent) {
|
|
59671
|
+
currentStr = token === PathTokens.each ? "*" : "!";
|
|
59672
|
+
} else {
|
|
59673
|
+
currentStr = "*";
|
|
59674
|
+
}
|
|
59675
|
+
}
|
|
59676
|
+
let stringIndex = currentStr.length;
|
|
59677
|
+
while (stringIndex) {
|
|
59678
|
+
// tslint:disable-next-line:no-bitwise
|
|
59679
|
+
hash = hash * 33 ^ currentStr.charCodeAt(--stringIndex);
|
|
59636
59680
|
}
|
|
59637
59681
|
}
|
|
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
59682
|
|
|
59645
|
-
|
|
59646
|
-
|
|
59647
|
-
|
|
59648
|
-
|
|
59649
|
-
|
|
59650
|
-
|
|
59651
|
-
|
|
59683
|
+
/*
|
|
59684
|
+
tslint:disable-next-line:no-bitwise
|
|
59685
|
+
JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
|
59686
|
+
integers. Since we want the results to be always positive, convert the
|
|
59687
|
+
signed int to an unsigned by doing an unsigned bitshift.
|
|
59688
|
+
*/
|
|
59689
|
+
this.cachedHash = hash >>> 0;
|
|
59690
|
+
}
|
|
59691
|
+
return this.cachedHash;
|
|
59652
59692
|
}
|
|
59653
59693
|
isIncludes(modelPath) {
|
|
59654
59694
|
const targetTokens = modelPath.getPathPartsAsArray();
|
|
@@ -59788,7 +59828,7 @@ class ModelPathImpl {
|
|
|
59788
59828
|
// @ts-expect-error
|
|
59789
59829
|
return result.toPath();
|
|
59790
59830
|
}
|
|
59791
|
-
applyInstancesDirty(instances) {
|
|
59831
|
+
applyInstancesDirty(instances, fillWithMultiplicityIfHasNoInstance) {
|
|
59792
59832
|
if (this.isResolved() || instances.length === 0) {
|
|
59793
59833
|
return this;
|
|
59794
59834
|
}
|
|
@@ -59797,7 +59837,8 @@ class ModelPathImpl {
|
|
|
59797
59837
|
for (const token of this.getPathParts()) {
|
|
59798
59838
|
if (PathTokens.isMultiToken(token) && instanceCounter < instances.length) {
|
|
59799
59839
|
var _instances$instanceCo;
|
|
59800
|
-
|
|
59840
|
+
const instanceOrEach = (_instances$instanceCo = instances[instanceCounter]) !== null && _instances$instanceCo !== void 0 ? _instances$instanceCo : fillWithMultiplicityIfHasNoInstance == true ? PathTokens.each : (0,_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)();
|
|
59841
|
+
result.append(instanceOrEach);
|
|
59801
59842
|
instanceCounter++;
|
|
59802
59843
|
} else {
|
|
59803
59844
|
result.append(token);
|
|
@@ -83110,6 +83151,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
83110
83151
|
/* harmony import */ var _DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../DataSchema/DataSchemaUtils */ "./Generator/src/generators/DataSchema/DataSchemaUtils.ts");
|
|
83111
83152
|
/* harmony import */ var _FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../FLang/FlangUtils */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FlangUtils.ts");
|
|
83112
83153
|
/* harmony import */ var _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../../Common/ModelPath/AbsoluteModelFieldPath */ "./Common/ModelPath/AbsoluteModelFieldPath.ts");
|
|
83154
|
+
/* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
|
|
83155
|
+
|
|
83113
83156
|
|
|
83114
83157
|
|
|
83115
83158
|
|
|
@@ -83141,20 +83184,27 @@ class FormulaRulesBuilder {
|
|
|
83141
83184
|
const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
|
|
83142
83185
|
const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
|
|
83143
83186
|
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);
|
|
83187
|
+
const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
|
|
83188
|
+
const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
|
|
83189
|
+
const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget) : undefined;
|
|
83190
|
+
const result = [autoValueRule, autoFlagRule, valueRule].concat(...precalculationRules).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined);
|
|
83156
83191
|
return result;
|
|
83157
83192
|
}
|
|
83193
|
+
createAutoValueRule(fullTarget, getFormulaExpression) {
|
|
83194
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "autoValue"), getFormulaExpression("autoValue"));
|
|
83195
|
+
}
|
|
83196
|
+
createRegularValueRule(fullTarget, getFormulaExpression) {
|
|
83197
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
|
|
83198
|
+
}
|
|
83199
|
+
createAutoFlagRule(fullTarget) {
|
|
83200
|
+
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"))));
|
|
83201
|
+
}
|
|
83202
|
+
createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) {
|
|
83203
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
|
|
83204
|
+
}
|
|
83205
|
+
createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) {
|
|
83206
|
+
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))));
|
|
83207
|
+
}
|
|
83158
83208
|
adjustPathMultiplicity(path) {
|
|
83159
83209
|
return (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__.adjustPathMultiplicityComplex)(path, this.formSchemaRng, this.dataDeclarationHelper);
|
|
83160
83210
|
}
|