@kontur.candy/generator 4.282.0-keapiSS.1 → 4.282.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 +86 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -123430,23 +123430,7 @@ class EvaluateTemplateVisitor {
|
|
|
123430
123430
|
|
|
123431
123431
|
node.attributes[attributeName] = updatedValue;
|
|
123432
123432
|
} else if (typeof attribute === "object" && !Array.isArray(attribute) && attribute !== null) {
|
|
123433
|
-
|
|
123434
|
-
Object.keys(attribute).forEach(key => {
|
|
123435
|
-
const value = attribute[key];
|
|
123436
|
-
|
|
123437
|
-
if (typeof value === "string") {
|
|
123438
|
-
let updatedValue = value;
|
|
123439
|
-
|
|
123440
|
-
for (const parameter of stringParameters) {
|
|
123441
|
-
updatedValue = this.applyStringParameter(parameter, updatedValue);
|
|
123442
|
-
}
|
|
123443
|
-
|
|
123444
|
-
newValue[key] = updatedValue;
|
|
123445
|
-
} else if (typeof value === "number") {
|
|
123446
|
-
newValue[key] = value;
|
|
123447
|
-
}
|
|
123448
|
-
});
|
|
123449
|
-
node.attributes[attributeName] = newValue;
|
|
123433
|
+
node.attributes[attributeName] = this.parseObjectAttribute(attribute, stringParameters);
|
|
123450
123434
|
}
|
|
123451
123435
|
}
|
|
123452
123436
|
|
|
@@ -123522,6 +123506,33 @@ class EvaluateTemplateVisitor {
|
|
|
123522
123506
|
return node;
|
|
123523
123507
|
}
|
|
123524
123508
|
|
|
123509
|
+
parseObjectAttribute(attribute, stringParameters) {
|
|
123510
|
+
const result = {};
|
|
123511
|
+
|
|
123512
|
+
if (attribute === undefined) {
|
|
123513
|
+
return result;
|
|
123514
|
+
}
|
|
123515
|
+
|
|
123516
|
+
for (const [key, value] of Object.entries(attribute)) {
|
|
123517
|
+
if (typeof value === "string") {
|
|
123518
|
+
let updatedValue = value;
|
|
123519
|
+
|
|
123520
|
+
for (const parameter of stringParameters) {
|
|
123521
|
+
updatedValue = this.applyStringParameter(parameter, updatedValue);
|
|
123522
|
+
}
|
|
123523
|
+
|
|
123524
|
+
result[key] = updatedValue;
|
|
123525
|
+
} else if (typeof value === "number") {
|
|
123526
|
+
result[key] = value;
|
|
123527
|
+
} else if (typeof value === "object") {
|
|
123528
|
+
const typedValue = value;
|
|
123529
|
+
result[key] = this.parseObjectAttribute(typedValue, stringParameters);
|
|
123530
|
+
}
|
|
123531
|
+
}
|
|
123532
|
+
|
|
123533
|
+
return result;
|
|
123534
|
+
}
|
|
123535
|
+
|
|
123525
123536
|
applyStringParameter(parameter, sourceAttributeValue) {
|
|
123526
123537
|
if (parameter.parameterInfo.type !== _SugarTemplateInfo__WEBPACK_IMPORTED_MODULE_5__.SugarTemplateParameterType.String) {
|
|
123527
123538
|
throw new Error("Parameter type should be String");
|
|
@@ -131142,6 +131153,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
131142
131153
|
/* harmony import */ var _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator */ "./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts");
|
|
131143
131154
|
/* harmony import */ var _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator.ts");
|
|
131144
131155
|
/* harmony import */ var _HelperFunctionsGenerator_CommonHelperFunctionsGenerator__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./HelperFunctionsGenerator/CommonHelperFunctionsGenerator */ "./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts");
|
|
131156
|
+
/* harmony import */ var _ServerSideFLangNormalization_AdditionalNormalizerFile__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./ServerSideFLangNormalization/AdditionalNormalizerFile */ "./Generator/src/generators/ServerSideFLangNormalization/AdditionalNormalizerFile.ts");
|
|
131157
|
+
|
|
131145
131158
|
|
|
131146
131159
|
|
|
131147
131160
|
|
|
@@ -131229,11 +131242,22 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
|
|
|
131229
131242
|
|
|
131230
131243
|
const normalizationRules = normalizationRulesGenerator.generateRules(resourcesHash);
|
|
131231
131244
|
const formulaNormalizationRules = (_additionalContent$fo5 = additionalContent.formJsonSettings) !== null && _additionalContent$fo5 !== void 0 && _additionalContent$fo5.disableFlangRulesForEnableAutoFieldFeature ? "" : formlulaOnlyNormalizationRulesGenerator.generateRules(resourcesHash);
|
|
131232
|
-
const
|
|
131245
|
+
const additionalNormalizationRules = formulaNormalizationRules != "" ? [{
|
|
131233
131246
|
content: formulaNormalizationRules,
|
|
131234
131247
|
normalizerId: "formulas"
|
|
131235
131248
|
}] : [];
|
|
131236
|
-
|
|
131249
|
+
|
|
131250
|
+
if (additionalContent.additionalNormalizers) {
|
|
131251
|
+
for (const additionalNormalizer of additionalContent.additionalNormalizers) {
|
|
131252
|
+
const isDefault = additionalNormalizer.filenameWithoutExtension.toLowerCase() === _ServerSideFLangNormalization_AdditionalNormalizerFile__WEBPACK_IMPORTED_MODULE_32__.defaultNormalizerFilename.toLowerCase();
|
|
131253
|
+
additionalNormalizationRules.push({
|
|
131254
|
+
content: additionalNormalizer.content,
|
|
131255
|
+
normalizerId: isDefault ? undefined : additionalNormalizer.filenameWithoutExtension
|
|
131256
|
+
});
|
|
131257
|
+
}
|
|
131258
|
+
}
|
|
131259
|
+
|
|
131260
|
+
const resultRules = combineFlangRules(normalizationRules, ...additionalNormalizationRules);
|
|
131237
131261
|
builder.addServerSideResource("ServerSide.normalize", resultRules);
|
|
131238
131262
|
}
|
|
131239
131263
|
|
|
@@ -131280,7 +131304,9 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
|
|
|
131280
131304
|
}
|
|
131281
131305
|
|
|
131282
131306
|
function combineFlangRules(baseRules, ...rules) {
|
|
131283
|
-
|
|
131307
|
+
const customNormalizeRules = rules.filter(r => r.normalizerId).map(x => `--${x.normalizerId}--\n${x.content}`);
|
|
131308
|
+
const additionalBaseRules = rules.filter(r => !r.normalizerId).map(r => r.content);
|
|
131309
|
+
return [baseRules].concat(additionalBaseRules).concat(customNormalizeRules).join("\n");
|
|
131284
131310
|
}
|
|
131285
131311
|
|
|
131286
131312
|
function getReferencedFetchFunctions(fetchFunctionSources) {
|
|
@@ -131412,7 +131438,8 @@ async function readFormSources(formSourcesPath, farmDirectory) {
|
|
|
131412
131438
|
customControlsContent: await readCustomControlsFiles(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "controls")),
|
|
131413
131439
|
fetchFunctionSources: await readFiles(sugarReferences.fetchFunctionFiles.map(x => path__WEBPACK_IMPORTED_MODULE_1___default().resolve(formSugarDirectoryPath, x))),
|
|
131414
131440
|
localization: await connectJSFilesWithNames(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "localization")),
|
|
131415
|
-
importedFiles: await readImportedFiles(formSourcesPath)
|
|
131441
|
+
importedFiles: await readImportedFiles(formSourcesPath),
|
|
131442
|
+
additionalNormalizers: await readAdditionalNormalizersFiles(formSourcesPath)
|
|
131416
131443
|
}
|
|
131417
131444
|
};
|
|
131418
131445
|
|
|
@@ -131583,6 +131610,29 @@ async function readImportedFiles(rootPath) {
|
|
|
131583
131610
|
}
|
|
131584
131611
|
}
|
|
131585
131612
|
|
|
131613
|
+
async function readAdditionalNormalizersFiles(rootPath) {
|
|
131614
|
+
try {
|
|
131615
|
+
const normalizersDirectoryName = "normalizers";
|
|
131616
|
+
const files = await readdirAsync(path__WEBPACK_IMPORTED_MODULE_1___default().join(rootPath, normalizersDirectoryName));
|
|
131617
|
+
const normalizerFiles = [];
|
|
131618
|
+
|
|
131619
|
+
for (const filename of files) {
|
|
131620
|
+
const content = await readFileAsync(path__WEBPACK_IMPORTED_MODULE_1___default().join(rootPath, normalizersDirectoryName, filename), "utf-8");
|
|
131621
|
+
const normalizerFile = {
|
|
131622
|
+
filenameWithoutExtension: path__WEBPACK_IMPORTED_MODULE_1___default().parse(filename).name,
|
|
131623
|
+
content: content
|
|
131624
|
+
};
|
|
131625
|
+
normalizerFiles.push(normalizerFile);
|
|
131626
|
+
}
|
|
131627
|
+
|
|
131628
|
+
return normalizerFiles;
|
|
131629
|
+
} catch (error) {
|
|
131630
|
+
// eslint-disable-next-line no-console
|
|
131631
|
+
console.warn(chalk__WEBPACK_IMPORTED_MODULE_3___default().yellow(`Error while reading normalizers at ${rootPath}`, error));
|
|
131632
|
+
return [];
|
|
131633
|
+
}
|
|
131634
|
+
}
|
|
131635
|
+
|
|
131586
131636
|
async function readJavaScriptFilesWithNames(formJavaScriptFilesPath) {
|
|
131587
131637
|
try {
|
|
131588
131638
|
const files = await readdirAsync(formJavaScriptFilesPath);
|
|
@@ -131703,6 +131753,21 @@ function getRequisitesFromEvaluableProps(...evaluablePropValues) {
|
|
|
131703
131753
|
|
|
131704
131754
|
/***/ }),
|
|
131705
131755
|
|
|
131756
|
+
/***/ "./Generator/src/generators/ServerSideFLangNormalization/AdditionalNormalizerFile.ts":
|
|
131757
|
+
/*!*******************************************************************************************!*\
|
|
131758
|
+
!*** ./Generator/src/generators/ServerSideFLangNormalization/AdditionalNormalizerFile.ts ***!
|
|
131759
|
+
\*******************************************************************************************/
|
|
131760
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
131761
|
+
|
|
131762
|
+
"use strict";
|
|
131763
|
+
__webpack_require__.r(__webpack_exports__);
|
|
131764
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
131765
|
+
/* harmony export */ "defaultNormalizerFilename": () => (/* binding */ defaultNormalizerFilename)
|
|
131766
|
+
/* harmony export */ });
|
|
131767
|
+
const defaultNormalizerFilename = "defaultNormalizeRules";
|
|
131768
|
+
|
|
131769
|
+
/***/ }),
|
|
131770
|
+
|
|
131706
131771
|
/***/ "./Generator/src/generators/ServerSideFLangNormalization/FLangValidationBuildContext.ts":
|
|
131707
131772
|
/*!**********************************************************************************************!*\
|
|
131708
131773
|
!*** ./Generator/src/generators/ServerSideFLangNormalization/FLangValidationBuildContext.ts ***!
|