@kontur.candy/generator 5.32.0-RPN2721v2.0 → 5.33.0-ss-doc-import.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.
Files changed (2) hide show
  1. package/dist/index.js +75 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58544,6 +58544,30 @@ function isContextualActionName(handlerName) {
58544
58544
 
58545
58545
  /***/ }),
58546
58546
 
58547
+ /***/ "./Common/FormPathUtils.ts":
58548
+ /*!*********************************!*\
58549
+ !*** ./Common/FormPathUtils.ts ***!
58550
+ \*********************************/
58551
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
58552
+
58553
+ "use strict";
58554
+ __webpack_require__.r(__webpack_exports__);
58555
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
58556
+ /* harmony export */ extractGfvFromFormPath: () => (/* binding */ extractGfvFromFormPath)
58557
+ /* harmony export */ });
58558
+ /* harmony import */ var _TypingUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TypingUtils */ "./Common/TypingUtils.ts");
58559
+ /* harmony import */ var _WellKnownDirectories__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WellKnownDirectories */ "./Common/WellKnownDirectories.ts");
58560
+
58561
+
58562
+ function extractGfvFromFormPath(formPath) {
58563
+ var _ref, _match$groups$gfv, _match$groups, _match$groups2;
58564
+ const regexp = new RegExp(`([\\/\\\\](?<gfv1>\\d{6,})[\\/\\\\]${_WellKnownDirectories__WEBPACK_IMPORTED_MODULE_1__.WellKnownDirectories.CandySubdirectoryName})|(((\\.farm)|(${_WellKnownDirectories__WEBPACK_IMPORTED_MODULE_1__.WellKnownDirectories.TestFarmDir}))[\\/\\\\]forms[\\/\\\\](?<gfv2>\\d{6,}))`);
58565
+ const match = regexp.exec(formPath);
58566
+ return (_ref = (_match$groups$gfv = match === null || match === void 0 ? void 0 : (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups["gfv1"]) !== null && _match$groups$gfv !== void 0 ? _match$groups$gfv : match === null || match === void 0 ? void 0 : (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2["gfv2"]) !== null && _ref !== void 0 ? _ref : (0,_TypingUtils__WEBPACK_IMPORTED_MODULE_0__.reject)(`Unable to determine gfv from path: ${formPath}`);
58567
+ }
58568
+
58569
+ /***/ }),
58570
+
58547
58571
  /***/ "./Common/IndentString.ts":
58548
58572
  /*!********************************!*\
58549
58573
  !*** ./Common/IndentString.ts ***!
@@ -60312,6 +60336,25 @@ function assertIs(value) {
60312
60336
 
60313
60337
  /***/ }),
60314
60338
 
60339
+ /***/ "./Common/WellKnownDirectories.ts":
60340
+ /*!****************************************!*\
60341
+ !*** ./Common/WellKnownDirectories.ts ***!
60342
+ \****************************************/
60343
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
60344
+
60345
+ "use strict";
60346
+ __webpack_require__.r(__webpack_exports__);
60347
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
60348
+ /* harmony export */ WellKnownDirectories: () => (/* binding */ WellKnownDirectories)
60349
+ /* harmony export */ });
60350
+ class WellKnownDirectories {}
60351
+ WellKnownDirectories.CandySubdirectoryName = "Candy";
60352
+ WellKnownDirectories.FormJsonFileName = "form.json";
60353
+ WellKnownDirectories.GeneratedFormSubdirectory = "form";
60354
+ WellKnownDirectories.TestFarmDir = "TestFarm";
60355
+
60356
+ /***/ }),
60357
+
60315
60358
  /***/ "./Common/getRngSchemaFilename.ts":
60316
60359
  /*!****************************************!*\
60317
60360
  !*** ./Common/getRngSchemaFilename.ts ***!
@@ -61272,7 +61315,22 @@ function addYears(date, amount) {
61272
61315
  return date;
61273
61316
  }
61274
61317
  function dateToString(date, format) {
61275
- return format.replace("dd", date.getDate().toString().padStart(2, "0")).replace("MM", (date.getMonth() + 1).toString().padStart(2, "0")).replace("yyyy", date.getFullYear().toString());
61318
+ var _months;
61319
+ const months = {
61320
+ "1": "января",
61321
+ "2": "февраля",
61322
+ "3": "марта",
61323
+ "4": "апреля",
61324
+ "5": "мая",
61325
+ "6": "июня",
61326
+ "7": "июля",
61327
+ "8": "августа",
61328
+ "9": "сентября",
61329
+ "10": "октября",
61330
+ "11": "ноября",
61331
+ "12": "декабря"
61332
+ };
61333
+ return format.replace("HH", date.getHours().toString().padStart(2, "0")).replace("mm", date.getMinutes().toString().padStart(2, "0")).replace("dd", date.getDate().toString().padStart(2, "0")).replace("d", date.getDate().toString()).replace("MMMM", (_months = months[date.getMonth() + 1]) !== null && _months !== void 0 ? _months : "").replace("MM", (date.getMonth() + 1).toString().padStart(2, "0")).replace("yyyy", date.getFullYear().toString());
61276
61334
  }
61277
61335
  function isDate(date) {
61278
61336
  return date instanceof Date && !isNaN(date.getTime());
@@ -80050,7 +80108,7 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
80050
80108
  const validationRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_ValidationRulesBuilder__WEBPACK_IMPORTED_MODULE_40__.ValidationRulesBuilder(sugarRoot, dataDeclarationHelper, formSchemaRng, formulaExprConverter, kcXmlConditions, typeRegistry, (_sugarRoot$schemaVali4 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali4 !== void 0 ? _sugarRoot$schemaVali4 : false);
80051
80109
  const optionalSectionRuleBuilder = new _ServerSideFLangNormalization_RuleBuilders_OptionalSectionRulesBuilder__WEBPACK_IMPORTED_MODULE_33__.OptionalSectionRulesBuilder(sugarRoot, dataDeclarationHelper);
80052
80110
  const normalizationRulesGenerator = new _ServerSideFLangNormalization_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__.NormalizationRulesGenerator(optionalSectionRuleBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder, formSchemaRng);
80053
- const formulaOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__.FormulaOnlyNormalizationRuleGenerator(dataDeclarationHelper, formSchemaRng, formulas, optionalSectionRuleBuilder, formulaExprConverter);
80111
+ const formulaOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__.FormulaOnlyNormalizationRuleGenerator(dataDeclarationHelper, formSchemaRng, formulas, optionalSectionRuleBuilder, formulaExprConverter, validationRulesBuilder);
80054
80112
  const formulaAndInitOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_FormulaAndInitOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_41__.FormulaAndInitOnlyNormalizationRuleGenerator(sugarRulesBuilder, formulaRulesBuilder, optionalSectionRuleBuilder, formSchemaRng);
80055
80113
  const builder = new _FormSourcesBuilder_FormSourcesBuilder__WEBPACK_IMPORTED_MODULE_21__.FormSourcesBuilder(additionalContent.formSourcesPath);
80056
80114
  const markupGenerator = new _markupGenerator_MarkupGenerator__WEBPACK_IMPORTED_MODULE_12__.MarkupGenerator(additionalContent.formSourcesPath, additionalContent.helpersContent, additionalContent.tourSteps, controlCustomizationContext, typeRegistry, formSchemaRng, dataDeclarationHelper, (_sugarRoot$schemaVali5 = sugarRoot.schemaValidations) !== null && _sugarRoot$schemaVali5 !== void 0 ? _sugarRoot$schemaVali5 : false);
@@ -80228,6 +80286,8 @@ __webpack_require__.r(__webpack_exports__);
80228
80286
  /* harmony import */ var recursive_readdir__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(recursive_readdir__WEBPACK_IMPORTED_MODULE_7__);
80229
80287
  /* harmony import */ var _common_ExtractSugarReferences__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/ExtractSugarReferences */ "./Generator/src/common/ExtractSugarReferences.ts");
80230
80288
  /* harmony import */ var _Common_getRngSchemaFilename__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Common/getRngSchemaFilename */ "./Common/getRngSchemaFilename.ts");
80289
+ /* harmony import */ var _Common_FormPathUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Common/FormPathUtils */ "./Common/FormPathUtils.ts");
80290
+
80231
80291
 
80232
80292
 
80233
80293
 
@@ -80244,7 +80304,7 @@ const readdirAsync = (0,util__WEBPACK_IMPORTED_MODULE_2__.promisify)(fs__WEBPACK
80244
80304
  async function readFormSources(formSourcesPath, farmDirectory) {
80245
80305
  var _JSON$parse$settings;
80246
80306
  const rootPath = farmDirectory;
80247
- const formName = path__WEBPACK_IMPORTED_MODULE_1___default().basename(formSourcesPath);
80307
+ const gfv = (0,_Common_FormPathUtils__WEBPACK_IMPORTED_MODULE_10__.extractGfvFromFormPath)(formSourcesPath);
80248
80308
  const formSugarDirectoryPath = path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "sugar");
80249
80309
  const sugarReferences = await extractReferences(formSugarDirectoryPath);
80250
80310
  const sugarContent = await readSugarFiles(formSugarDirectoryPath, sugarReferences);
@@ -80257,7 +80317,7 @@ async function readFormSources(formSourcesPath, farmDirectory) {
80257
80317
  const result = {
80258
80318
  sugarContent: sugarContent,
80259
80319
  resources: {
80260
- gfv: path__WEBPACK_IMPORTED_MODULE_1___default().basename(formSourcesPath),
80320
+ gfv: gfv,
80261
80321
  formSourcesPath: formSourcesPath,
80262
80322
  formJsonSettings: (_JSON$parse$settings = JSON.parse(await readFileSource(formSourcesPath, "form.json", "{}"))["settings"]) !== null && _JSON$parse$settings !== void 0 ? _JSON$parse$settings : {},
80263
80323
  additionalSettings: await readFileSource(formSourcesPath, "settings.json", "{}"),
@@ -80265,9 +80325,9 @@ async function readFormSources(formSourcesPath, farmDirectory) {
80265
80325
  helpersContent: await readJavaScriptFilesWithNames(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "helpers")),
80266
80326
  commonHelpersContent: await readJavaScriptFilesWithNames(path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "jsHelpers")),
80267
80327
  validationsContent: await readJavaScriptFilesWithNames(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "validations")),
80268
- schemaRngContent: await readSchemaRngFile(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "schemas"), formName),
80269
- kcJsXmlContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${formName}.КС.candy.js.xml`, "<dummy/>")) || "",
80270
- kcLangContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${formName}.КС.candy.js.kclang`, "")) || "",
80328
+ schemaRngContent: await readSchemaRngFile(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "schemas"), gfv),
80329
+ kcJsXmlContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${gfv}.КС.candy.js.xml`, "<dummy/>")) || "",
80330
+ kcLangContent: (await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"), `${gfv}.КС.candy.js.kclang`, "")) || "",
80271
80331
  tourSteps: await readFileSource(path__WEBPACK_IMPORTED_MODULE_1___default().join(rootPath, "tour"), "tour.js", "{}"),
80272
80332
  hooksContent: await readHooksFile(formSourcesPath),
80273
80333
  customControlsContent: await readCustomControlsFiles(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "controls")),
@@ -80277,8 +80337,8 @@ async function readFormSources(formSourcesPath, farmDirectory) {
80277
80337
  additionalNormalizers: await readAdditionalNormalizersFiles(formSourcesPath)
80278
80338
  }
80279
80339
  };
80280
- if (formName.startsWith("4")) {
80281
- const commonResourcesPath = path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "..", "..", "commonResources");
80340
+ if (gfv.startsWith("4")) {
80341
+ const commonResourcesPath = path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "commonResources");
80282
80342
  // tslint:disable-next-line no-unsafe-any
80283
80343
  const {
80284
80344
  elements
@@ -83205,20 +83265,24 @@ __webpack_require__.r(__webpack_exports__);
83205
83265
 
83206
83266
 
83207
83267
  class FormulaOnlyNormalizationRuleGenerator {
83208
- constructor(dataDeclarationHelper, formSchemaRng, formulas, optionalSectionRuleBuilder, formulaExprConverter) {
83268
+ constructor(dataDeclarationHelper, formSchemaRng, formulas, optionalSectionRuleBuilder, formulaExprConverter, validationRulesBuilder) {
83209
83269
  this.dataDeclarationHelper = void 0;
83210
83270
  this.formSchemaRng = void 0;
83211
83271
  this.formulas = void 0;
83212
83272
  this.formulaExprConverter = void 0;
83213
83273
  this.optionalSectionRuleBuilder = void 0;
83274
+ this.validationRulesBuilder = void 0;
83214
83275
  this.optionalSectionRuleBuilder = optionalSectionRuleBuilder;
83215
83276
  this.dataDeclarationHelper = dataDeclarationHelper;
83216
83277
  this.formSchemaRng = formSchemaRng;
83217
83278
  this.formulas = formulas;
83218
83279
  this.formulaExprConverter = formulaExprConverter;
83280
+ this.validationRulesBuilder = validationRulesBuilder;
83219
83281
  }
83220
83282
  generateRules() {
83221
- const allRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.concat(this.buildFormulaFLangRules(), this.optionalSectionRuleBuilder.buildRules());
83283
+ const calculationRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.concat(this.buildFormulaFLangRules(), this.optionalSectionRuleBuilder.buildRules());
83284
+ const validationRules = this.validationRulesBuilder.buildRules();
83285
+ const allRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.concat(calculationRules, validationRules);
83222
83286
  return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.combineRulesWithOptionalSectionChecking)(allRules, this.optionalSectionRuleBuilder);
83223
83287
  }
83224
83288
  *buildFormulaFLangRules() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.32.0-RPN2721v2.0",
3
+ "version": "5.33.0-ss-doc-import.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,