@kontur.candy/generator 5.55.1 → 5.56.0-fix-port.0
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 +48 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47196,9 +47196,13 @@ function isMatchAbbreviation(abbreviation, value) {
|
|
|
47196
47196
|
"use strict";
|
|
47197
47197
|
__webpack_require__.r(__webpack_exports__);
|
|
47198
47198
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
47199
|
+
/* harmony export */ ensureIsKnownViewModelFieldName: () => (/* binding */ ensureIsKnownViewModelFieldName),
|
|
47199
47200
|
/* harmony export */ getKnownViewModelFieldNames: () => (/* binding */ getKnownViewModelFieldNames),
|
|
47200
47201
|
/* harmony export */ nonRegularFieldName: () => (/* binding */ nonRegularFieldName)
|
|
47201
47202
|
/* harmony export */ });
|
|
47203
|
+
/* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
|
|
47204
|
+
|
|
47205
|
+
|
|
47202
47206
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47203
47207
|
|
|
47204
47208
|
// Эту модель, которая лежит в redux-состоянии в поле viewModel, каждый узел кроме . является ViewModel
|
|
@@ -47207,6 +47211,9 @@ function nonRegularFieldName(fieldName) {
|
|
|
47207
47211
|
// @ts-ignore
|
|
47208
47212
|
return fieldName;
|
|
47209
47213
|
}
|
|
47214
|
+
function ensureIsKnownViewModelFieldName(fieldName) {
|
|
47215
|
+
return getKnownViewModelFieldNames().includes(fieldName) ? fieldName : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.reject)(`[${fieldName}] is not known ViewModelFieldName`);
|
|
47216
|
+
}
|
|
47210
47217
|
function getKnownViewModelFieldNames() {
|
|
47211
47218
|
const names = ["children", "error", "warning", "description", "id", "disabled", "visible", "disabledSending", "value", "autoValue", "autoFlag", "resourcesHash", "errorsCount", "warningsCount", "code", "picklist", "normalized", "emptyUnitsVisible", "pencilOpened", "ignoreAutoFlag", "disableValueAutoInit", "index", "regionCode", "district", "city", "settlement", "street", "house", "building", "room", "bossValue", "agentValue", "senderInn", "nameorg", "sum", "count", "normalizationSource", "referencedId"];
|
|
47212
47219
|
return names;
|
|
@@ -70275,7 +70282,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
70275
70282
|
/* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
|
|
70276
70283
|
/* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
|
|
70277
70284
|
/* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
|
|
70278
|
-
/* harmony import */ var
|
|
70285
|
+
/* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
|
|
70286
|
+
/* harmony import */ var _Engine_src_Engine_Core_CoreTypes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Engine/src/Engine/Core/CoreTypes */ "./Engine/src/Engine/Core/CoreTypes.ts");
|
|
70287
|
+
/* harmony import */ var _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./FLang/FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
|
|
70288
|
+
/* harmony import */ var _FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./FLang/FlangUtils */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FlangUtils.ts");
|
|
70289
|
+
|
|
70290
|
+
|
|
70291
|
+
|
|
70279
70292
|
|
|
70280
70293
|
|
|
70281
70294
|
|
|
@@ -70342,8 +70355,8 @@ class FetchFunctionToFlangConverter {
|
|
|
70342
70355
|
const innerCondition = this.traverse(node.test);
|
|
70343
70356
|
const then = this.traverse(node.consequent);
|
|
70344
70357
|
const elseThen = this.traverse(node.alternate);
|
|
70345
|
-
const condition = innerCondition instanceof
|
|
70346
|
-
return new
|
|
70358
|
+
const condition = innerCondition instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.LogicalExpression ? innerCondition : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NotEqExpression(innerCondition, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullLiteralExpression());
|
|
70359
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ConditionalExpression(condition, then, elseThen);
|
|
70347
70360
|
}
|
|
70348
70361
|
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isBinaryExpression(node)) {
|
|
70349
70362
|
const left = this.traverse(node.left);
|
|
@@ -70351,12 +70364,12 @@ class FetchFunctionToFlangConverter {
|
|
|
70351
70364
|
switch (node.operator) {
|
|
70352
70365
|
case "==":
|
|
70353
70366
|
case "===":
|
|
70354
|
-
return new
|
|
70367
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.EqExpression(left, right);
|
|
70355
70368
|
case "!=":
|
|
70356
70369
|
case "!==":
|
|
70357
|
-
return new
|
|
70370
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NotEqExpression(left, right);
|
|
70358
70371
|
case "+":
|
|
70359
|
-
return new
|
|
70372
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.SumBinaryExpression(left, right);
|
|
70360
70373
|
default:
|
|
70361
70374
|
throw new JsToFlangConvertError("Not supported!");
|
|
70362
70375
|
}
|
|
@@ -70366,38 +70379,57 @@ class FetchFunctionToFlangConverter {
|
|
|
70366
70379
|
const right = this.traverse(node.right);
|
|
70367
70380
|
switch (node.operator) {
|
|
70368
70381
|
case "||":
|
|
70369
|
-
return new
|
|
70382
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.OrBinaryExpression(left, right);
|
|
70370
70383
|
case "&&":
|
|
70371
|
-
return new
|
|
70384
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.AndBinaryExpression(left, right);
|
|
70372
70385
|
case "??":
|
|
70373
|
-
return new
|
|
70386
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullCoalesceExpression(left, right);
|
|
70374
70387
|
default:
|
|
70375
70388
|
throw new JsToFlangConvertError("Not supported!");
|
|
70376
70389
|
}
|
|
70377
70390
|
}
|
|
70378
70391
|
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isStringLiteral(node)) {
|
|
70379
|
-
return new
|
|
70392
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.StringLiteralExpression(node.value);
|
|
70380
70393
|
}
|
|
70381
70394
|
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isNumericLiteral(node)) {
|
|
70382
|
-
return new
|
|
70395
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.DecimalLiteralExpression(node.value);
|
|
70383
70396
|
}
|
|
70384
70397
|
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isNullLiteral(node)) {
|
|
70385
|
-
return new
|
|
70398
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullLiteralExpression();
|
|
70386
70399
|
}
|
|
70387
70400
|
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isIdentifier(node) && node.name === "undefined") {
|
|
70388
|
-
return new
|
|
70401
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullLiteralExpression();
|
|
70389
70402
|
}
|
|
70390
70403
|
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isMemberExpression(node)) {
|
|
70391
70404
|
return this.convertMemberExpression(node);
|
|
70392
70405
|
}
|
|
70406
|
+
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isCallExpression(node)) {
|
|
70407
|
+
return this.convertCallExpression(node);
|
|
70408
|
+
}
|
|
70393
70409
|
throw new JsToFlangConvertError("Unknown code node.\n" + JSON.stringify(node, null, 4));
|
|
70394
70410
|
}
|
|
70411
|
+
convertCallExpression(node) {
|
|
70412
|
+
const obj = node.callee;
|
|
70413
|
+
const args = node.arguments;
|
|
70414
|
+
const isModelCall = _babel_types__WEBPACK_IMPORTED_MODULE_1__.isMemberExpression(obj) && _babel_types__WEBPACK_IMPORTED_MODULE_1__.isMemberExpression(obj.object) && _babel_types__WEBPACK_IMPORTED_MODULE_1__.isThisExpression(obj.object.object) && _babel_types__WEBPACK_IMPORTED_MODULE_1__.isIdentifier(obj.object.property) && obj.object.property.name === "model" && _babel_types__WEBPACK_IMPORTED_MODULE_1__.isIdentifier(obj.property) && obj.property.name === "getCached";
|
|
70415
|
+
if (isModelCall) {
|
|
70416
|
+
var _extractedArgs$, _extractedArgs$2;
|
|
70417
|
+
const extractedArgs = args.map(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isStringLiteral(x) ? x.value : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.reject)("Arguments of [getCached] MUST be strings"));
|
|
70418
|
+
if (extractedArgs.length != 2) {
|
|
70419
|
+
return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.reject)("[getCached] MUST have 2 arguments!");
|
|
70420
|
+
}
|
|
70421
|
+
const path = (_extractedArgs$ = extractedArgs[0]) !== null && _extractedArgs$ !== void 0 ? _extractedArgs$ : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.reject)();
|
|
70422
|
+
const fieldName = (_extractedArgs$2 = extractedArgs[1]) !== null && _extractedArgs$2 !== void 0 ? _extractedArgs$2 : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.reject)();
|
|
70423
|
+
return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.makeStringValueReference)((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_4__.createAbsolute)(path), (0,_Engine_src_Engine_Core_CoreTypes__WEBPACK_IMPORTED_MODULE_5__.ensureIsKnownViewModelFieldName)(fieldName));
|
|
70424
|
+
}
|
|
70425
|
+
throw new JsToFlangConvertError("Unknown call to model!");
|
|
70426
|
+
}
|
|
70395
70427
|
convertMemberExpression(node) {
|
|
70396
70428
|
const obj = node.object;
|
|
70397
|
-
const
|
|
70398
|
-
if (
|
|
70429
|
+
const isRequisitesCall = _babel_types__WEBPACK_IMPORTED_MODULE_1__.isMemberExpression(obj) && _babel_types__WEBPACK_IMPORTED_MODULE_1__.isThisExpression(obj.object) && _babel_types__WEBPACK_IMPORTED_MODULE_1__.isIdentifier(obj.property) && obj.property.name === "requisites";
|
|
70430
|
+
if (isRequisitesCall) {
|
|
70399
70431
|
if (_babel_types__WEBPACK_IMPORTED_MODULE_1__.isStringLiteral(node.property)) {
|
|
70400
|
-
return new
|
|
70432
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.GetExternalInfoExpression(node.property.value.endsWith(".value") ? node.property.value : `${node.property.value}.value`);
|
|
70401
70433
|
}
|
|
70402
70434
|
throw new JsToFlangConvertError("Unsuported call to requisites!");
|
|
70403
70435
|
}
|