@coopenomics/factory 2025.5.14 → 2025.6.13

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.mjs CHANGED
@@ -365,6 +365,285 @@ const VarsSchema = {
365
365
  additionalProperties: true
366
366
  };
367
367
 
368
+ const MeetSchema = {
369
+ type: "object",
370
+ properties: {
371
+ id: { type: "string" },
372
+ hash: { type: "string" },
373
+ coopname: { type: "string" },
374
+ type: { type: "string" },
375
+ level: { type: "string" },
376
+ status: { type: "string" },
377
+ open_at: { type: "string" },
378
+ close_at: { type: "string" },
379
+ open_at_datetime: { type: "string" },
380
+ close_at_datetime: { type: "string" },
381
+ presider_full_name: { type: "string" },
382
+ secretary_full_name: { type: "string" },
383
+ initiator: { type: "string" },
384
+ presider: { type: "string" },
385
+ secretary: { type: "string" },
386
+ quorum_percent: { type: "number" },
387
+ signed_ballots: { type: "string" },
388
+ current_quorum_percent: { type: "number" },
389
+ cycle: { type: "string" },
390
+ notified_users: {
391
+ type: "array",
392
+ items: { type: "string" }
393
+ },
394
+ quorum_passed: { type: "boolean" },
395
+ created_at: { type: "string" },
396
+ proposal: {
397
+ type: "object",
398
+ properties: {
399
+ version: { type: "string" },
400
+ hash: { type: "string" },
401
+ doc_hash: { type: "string" },
402
+ meta_hash: { type: "string" },
403
+ meta: { type: "string" },
404
+ signatures: {
405
+ type: "array",
406
+ items: {
407
+ type: "object",
408
+ properties: {
409
+ id: { type: "number" },
410
+ signed_hash: { type: "string" },
411
+ signer: { type: "string" },
412
+ public_key: { type: "string" },
413
+ signature: { type: "string" },
414
+ signed_at: { type: "string" },
415
+ meta: { type: "string" }
416
+ },
417
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
418
+ additionalProperties: true
419
+ }
420
+ }
421
+ },
422
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
423
+ additionalProperties: true
424
+ },
425
+ authorization: {
426
+ type: "object",
427
+ properties: {
428
+ version: { type: "string" },
429
+ hash: { type: "string" },
430
+ doc_hash: { type: "string" },
431
+ meta_hash: { type: "string" },
432
+ meta: { type: "string" },
433
+ signatures: {
434
+ type: "array",
435
+ items: {
436
+ type: "object",
437
+ properties: {
438
+ id: { type: "number" },
439
+ signed_hash: { type: "string" },
440
+ signer: { type: "string" },
441
+ public_key: { type: "string" },
442
+ signature: { type: "string" },
443
+ signed_at: { type: "string" },
444
+ meta: { type: "string" }
445
+ },
446
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
447
+ additionalProperties: true
448
+ }
449
+ }
450
+ },
451
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
452
+ additionalProperties: true
453
+ },
454
+ decision1: {
455
+ type: "object",
456
+ properties: {
457
+ version: { type: "string" },
458
+ hash: { type: "string" },
459
+ doc_hash: { type: "string" },
460
+ meta_hash: { type: "string" },
461
+ meta: { type: "string" },
462
+ signatures: {
463
+ type: "array",
464
+ items: {
465
+ type: "object",
466
+ properties: {
467
+ id: { type: "number" },
468
+ signed_hash: { type: "string" },
469
+ signer: { type: "string" },
470
+ public_key: { type: "string" },
471
+ signature: { type: "string" },
472
+ signed_at: { type: "string" },
473
+ meta: { type: "string" }
474
+ },
475
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
476
+ additionalProperties: true
477
+ }
478
+ }
479
+ },
480
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
481
+ additionalProperties: true
482
+ },
483
+ decision2: {
484
+ type: "object",
485
+ properties: {
486
+ version: { type: "string" },
487
+ hash: { type: "string" },
488
+ doc_hash: { type: "string" },
489
+ meta_hash: { type: "string" },
490
+ meta: { type: "string" },
491
+ signatures: {
492
+ type: "array",
493
+ items: {
494
+ type: "object",
495
+ properties: {
496
+ id: { type: "number" },
497
+ signed_hash: { type: "string" },
498
+ signer: { type: "string" },
499
+ public_key: { type: "string" },
500
+ signature: { type: "string" },
501
+ signed_at: { type: "string" },
502
+ meta: { type: "string" }
503
+ },
504
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
505
+ additionalProperties: true
506
+ }
507
+ }
508
+ },
509
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
510
+ additionalProperties: true
511
+ }
512
+ },
513
+ required: [
514
+ "id",
515
+ "hash",
516
+ "coopname",
517
+ "type",
518
+ "status",
519
+ "open_at_datetime",
520
+ "close_at_datetime",
521
+ "presider_full_name",
522
+ "secretary_full_name"
523
+ ],
524
+ additionalProperties: true
525
+ };
526
+ const MeetPointSchema = {
527
+ type: "object",
528
+ properties: {
529
+ context: { type: "string" },
530
+ title: { type: "string" },
531
+ decision: { type: "string" }
532
+ },
533
+ required: ["context", "title", "decision"],
534
+ additionalProperties: true
535
+ };
536
+ const QuestionSchema$1 = {
537
+ type: "object",
538
+ properties: {
539
+ id: { type: "string" },
540
+ number: { type: "string" },
541
+ coopname: { type: "string" },
542
+ meet_id: { type: "string" },
543
+ title: { type: "string" },
544
+ context: { type: "string" },
545
+ decision: { type: "string" },
546
+ counter_votes_for: { type: "string" },
547
+ counter_votes_against: { type: "string" },
548
+ counter_votes_abstained: { type: "string" },
549
+ voters_for: { type: "array", items: { type: "string" } },
550
+ voters_against: { type: "array", items: { type: "string" } },
551
+ voters_abstained: { type: "array", items: { type: "string" } }
552
+ },
553
+ required: [
554
+ "id",
555
+ "number",
556
+ "coopname",
557
+ "meet_id",
558
+ "title",
559
+ "context",
560
+ "decision",
561
+ "counter_votes_for",
562
+ "counter_votes_against",
563
+ "counter_votes_abstained",
564
+ "voters_for",
565
+ "voters_against",
566
+ "voters_abstained"
567
+ ],
568
+ additionalProperties: true
569
+ };
570
+ const QuestionExtendedSchema = {
571
+ type: "object",
572
+ properties: {
573
+ id: { type: "string" },
574
+ number: { type: "string" },
575
+ coopname: { type: "string" },
576
+ meet_id: { type: "string" },
577
+ title: { type: "string" },
578
+ context: { type: "string" },
579
+ decision: { type: "string" },
580
+ counter_votes_for: { type: "string" },
581
+ counter_votes_against: { type: "string" },
582
+ counter_votes_abstained: { type: "string" },
583
+ voters_for: { type: "array", items: { type: "string" } },
584
+ voters_against: { type: "array", items: { type: "string" } },
585
+ voters_abstained: { type: "array", items: { type: "string" } },
586
+ votes_total: { type: "integer", nullable: true },
587
+ votes_for_percent: { type: "integer", nullable: true },
588
+ votes_against_percent: { type: "integer", nullable: true },
589
+ votes_abstained_percent: { type: "integer", nullable: true },
590
+ is_accepted: { type: "boolean", nullable: true }
591
+ },
592
+ required: [
593
+ "id",
594
+ "number",
595
+ "coopname",
596
+ "meet_id",
597
+ "title",
598
+ "context",
599
+ "decision",
600
+ "counter_votes_for",
601
+ "counter_votes_against",
602
+ "counter_votes_abstained",
603
+ "voters_for",
604
+ "voters_against",
605
+ "voters_abstained"
606
+ ],
607
+ additionalProperties: true
608
+ };
609
+
610
+ const CommonUserSchema = {
611
+ type: "object",
612
+ properties: {
613
+ full_name_or_short_name: { type: "string" },
614
+ birthdate_or_ogrn: { type: "string" },
615
+ abbr_full_name: { type: "string" }
616
+ },
617
+ required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name"],
618
+ additionalProperties: true
619
+ };
620
+
621
+ const AgendaMeetSchema = {
622
+ type: "object",
623
+ properties: {
624
+ type: { type: "string", enum: ["regular", "extra"] },
625
+ open_at_datetime: { type: "string" },
626
+ close_at_datetime: { type: "string" }
627
+ },
628
+ required: [
629
+ "type",
630
+ "open_at_datetime",
631
+ "close_at_datetime"
632
+ ],
633
+ additionalProperties: true
634
+ };
635
+ const AgendaQuestionSchema = {
636
+ type: "object",
637
+ properties: {
638
+ number: { type: "string" },
639
+ title: { type: "string" },
640
+ context: { type: "string", nullable: true },
641
+ decision: { type: "string" }
642
+ },
643
+ required: ["number", "title", "decision"],
644
+ additionalProperties: true
645
+ };
646
+
368
647
  const registry_id$q = Cooperative$1.Registry.WalletAgreement.registry_id;
369
648
  const Schema$q = {
370
649
  type: "object",
@@ -904,17 +1183,6 @@ const CommonRequestSchema = {
904
1183
  additionalProperties: true
905
1184
  };
906
1185
 
907
- const CommonUserSchema = {
908
- type: "object",
909
- properties: {
910
- full_name_or_short_name: { type: "string" },
911
- birthdate_or_ogrn: { type: "string" },
912
- abbr_full_name: { type: "string" }
913
- },
914
- required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name"],
915
- additionalProperties: true
916
- };
917
-
918
1186
  const registry_id$g = Cooperative$1.Registry.AssetContributionStatement.registry_id;
919
1187
  const Schema$g = {
920
1188
  type: "object",
@@ -1404,9 +1672,15 @@ const Schema$4 = {
1404
1672
  properties: {
1405
1673
  meta: IMetaJSONSchema,
1406
1674
  coop: CooperativeSchema,
1407
- vars: VarsSchema
1675
+ vars: VarsSchema,
1676
+ meet: AgendaMeetSchema,
1677
+ user: CommonUserSchema,
1678
+ questions: {
1679
+ type: "array",
1680
+ items: AgendaQuestionSchema
1681
+ }
1408
1682
  },
1409
- required: ["meta", "coop", "vars"],
1683
+ required: ["meta", "coop", "vars", "meet", "user", "questions"],
1410
1684
  additionalProperties: true
1411
1685
  };
1412
1686
  const Template$4 = {
@@ -1430,9 +1704,15 @@ const Schema$3 = {
1430
1704
  properties: {
1431
1705
  meta: IMetaJSONSchema,
1432
1706
  coop: CooperativeSchema,
1433
- vars: VarsSchema
1707
+ vars: VarsSchema,
1708
+ decision: decisionSchema,
1709
+ meet: MeetSchema,
1710
+ questions: {
1711
+ type: "array",
1712
+ items: MeetPointSchema
1713
+ }
1434
1714
  },
1435
- required: ["meta", "coop", "vars"],
1715
+ required: ["meta", "coop", "vars", "decision", "meet", "questions"],
1436
1716
  additionalProperties: true
1437
1717
  };
1438
1718
  const Template$3 = {
@@ -1456,9 +1736,15 @@ const Schema$2 = {
1456
1736
  properties: {
1457
1737
  meta: IMetaJSONSchema,
1458
1738
  coop: CooperativeSchema,
1459
- vars: VarsSchema
1739
+ vars: VarsSchema,
1740
+ user: CommonUserSchema,
1741
+ meet: MeetSchema,
1742
+ questions: {
1743
+ type: "array",
1744
+ items: MeetPointSchema
1745
+ }
1460
1746
  },
1461
- required: ["meta", "coop", "vars"],
1747
+ required: ["meta", "coop", "vars", "meet", "questions", "user"],
1462
1748
  additionalProperties: true
1463
1749
  };
1464
1750
  const Template$2 = {
@@ -1476,15 +1762,49 @@ const AnnualGeneralMeetingNotification = {
1476
1762
  registry_id: registry_id$2
1477
1763
  };
1478
1764
 
1765
+ const AnswerSchema = {
1766
+ type: "object",
1767
+ properties: {
1768
+ id: { type: "string" },
1769
+ number: { type: "string" },
1770
+ vote: { type: "string", enum: ["for", "against", "abstained"] }
1771
+ },
1772
+ required: ["id", "number", "vote"],
1773
+ additionalProperties: true
1774
+ };
1775
+ const QuestionSchema = {
1776
+ type: "object",
1777
+ properties: {
1778
+ id: { type: "string" },
1779
+ number: { type: "string" },
1780
+ title: { type: "string" },
1781
+ context: { type: "string" },
1782
+ decision: { type: "string" }
1783
+ },
1784
+ required: ["id", "number", "title", "context", "decision"],
1785
+ additionalProperties: true
1786
+ };
1479
1787
  const registry_id$1 = Cooperative$1.Registry.AnnualGeneralMeetingVotingBallot.registry_id;
1480
1788
  const Schema$1 = {
1481
1789
  type: "object",
1482
1790
  properties: {
1483
1791
  meta: IMetaJSONSchema,
1484
1792
  coop: CooperativeSchema,
1485
- vars: VarsSchema
1793
+ vars: VarsSchema,
1794
+ meet: MeetSchema,
1795
+ user: CommonUserSchema,
1796
+ answers: {
1797
+ type: "array",
1798
+ items: AnswerSchema,
1799
+ minItems: 1
1800
+ },
1801
+ questions: {
1802
+ type: "array",
1803
+ items: QuestionSchema,
1804
+ minItems: 1
1805
+ }
1486
1806
  },
1487
- required: ["meta", "coop", "vars"],
1807
+ required: ["meta", "coop", "vars", "meet", "user", "answers", "questions"],
1488
1808
  additionalProperties: true
1489
1809
  };
1490
1810
  const Template$1 = {
@@ -1508,9 +1828,15 @@ const Schema = {
1508
1828
  properties: {
1509
1829
  meta: IMetaJSONSchema,
1510
1830
  coop: CooperativeSchema,
1511
- vars: VarsSchema
1831
+ vars: VarsSchema,
1832
+ decision: decisionSchema,
1833
+ meet: MeetSchema,
1834
+ questions: {
1835
+ type: "array",
1836
+ items: QuestionExtendedSchema
1837
+ }
1512
1838
  },
1513
- required: ["meta", "coop", "vars"],
1839
+ required: ["meta", "coop", "vars", "decision", "meet", "questions"],
1514
1840
  additionalProperties: true
1515
1841
  };
1516
1842
  const Template = {
@@ -2176,7 +2502,7 @@ class PDFService {
2176
2502
 
2177
2503
  const name = "@coopenomics/factory";
2178
2504
  const type = "module";
2179
- const version = "2025.5.14";
2505
+ const version = "2025.6.13";
2180
2506
  const packageManager = "pnpm@9.0.6";
2181
2507
  const description = "";
2182
2508
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
@@ -2226,7 +2552,7 @@ const dependencies = {
2226
2552
  "ajv-formats": "^3.0.1",
2227
2553
  "ajv-i18n": "^4.2.0",
2228
2554
  axios: "^1.7.2",
2229
- cooptypes: "2025.5.14",
2555
+ cooptypes: "2025.6.13",
2230
2556
  dotenv: "^16.4.5",
2231
2557
  "eosjs-ecc": "^4.0.7",
2232
2558
  handlebars: "^4.7.8",
@@ -2267,7 +2593,7 @@ const pnpm = {
2267
2593
  "vite@>=5.1.0 <=5.1.6": ">=5.1.7"
2268
2594
  }
2269
2595
  };
2270
- const gitHead = "515a374f86b8c38fa9e725072b3816782e5c734c";
2596
+ const gitHead = "4a5fb2af8b23629f9820d8364373210f3b7be665";
2271
2597
  const packageJson = {
2272
2598
  name: name,
2273
2599
  type: type,
@@ -2294,6 +2620,40 @@ const packageJson = {
2294
2620
  gitHead: gitHead
2295
2621
  };
2296
2622
 
2623
+ function formatDateTime(timestamp) {
2624
+ if (!timestamp)
2625
+ return "";
2626
+ const timezone = "Europe/Moscow";
2627
+ let moscowDate;
2628
+ if (timestamp.includes("T")) {
2629
+ moscowDate = moment.utc(timestamp).tz(timezone);
2630
+ } else if (!Number.isNaN(Number(timestamp))) {
2631
+ moscowDate = moment.unix(Number(timestamp)).tz(timezone);
2632
+ } else {
2633
+ moscowDate = moment(timestamp).tz(timezone);
2634
+ }
2635
+ const months = [
2636
+ "\u044F\u043D\u0432\u0430\u0440\u044F",
2637
+ "\u0444\u0435\u0432\u0440\u0430\u043B\u044F",
2638
+ "\u043C\u0430\u0440\u0442\u0430",
2639
+ "\u0430\u043F\u0440\u0435\u043B\u044F",
2640
+ "\u043C\u0430\u044F",
2641
+ "\u0438\u044E\u043D\u044F",
2642
+ "\u0438\u044E\u043B\u044F",
2643
+ "\u0430\u0432\u0433\u0443\u0441\u0442\u0430",
2644
+ "\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F",
2645
+ "\u043E\u043A\u0442\u044F\u0431\u0440\u044F",
2646
+ "\u043D\u043E\u044F\u0431\u0440\u044F",
2647
+ "\u0434\u0435\u043A\u0430\u0431\u0440\u044F"
2648
+ ];
2649
+ const day = moscowDate.date();
2650
+ const month = months[moscowDate.month()];
2651
+ const year = moscowDate.year();
2652
+ const hours = moscowDate.format("HH");
2653
+ const minutes = moscowDate.format("mm");
2654
+ return `${day} ${month} ${year} ${hours}:${minutes} (\u041C\u0441\u043A)`;
2655
+ }
2656
+
2297
2657
  var __defProp$2 = Object.defineProperty;
2298
2658
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2299
2659
  var __publicField$2 = (obj, key, value) => {
@@ -2390,6 +2750,22 @@ class DocFactory {
2390
2750
  name: "\u0421\u041E\u0421\u0415\u0414\u0418"
2391
2751
  };
2392
2752
  }
2753
+ async getGeneralMeetingDecision(meet, created_at) {
2754
+ const quorum_percent = Number(meet.current_quorum_percent);
2755
+ const votes_for = 0;
2756
+ const votes_against = 0;
2757
+ const votes_abstained = 0;
2758
+ const [date, time] = created_at.split(" ");
2759
+ return {
2760
+ id: Number(meet.id),
2761
+ date,
2762
+ time,
2763
+ votes_for,
2764
+ votes_against,
2765
+ votes_abstained,
2766
+ voters_percent: quorum_percent
2767
+ };
2768
+ }
2393
2769
  async getDecision(coop, coopname, decision_id, created_at) {
2394
2770
  const votes_for_actions = (await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-actions`, new URLSearchParams({
2395
2771
  filter: JSON.stringify({
@@ -2429,6 +2805,93 @@ class DocFactory {
2429
2805
  // decision,
2430
2806
  };
2431
2807
  }
2808
+ async getMeet(coopname, meet_hash, block_num) {
2809
+ const block_filter = block_num ? { block_num: { $lte: block_num } } : {};
2810
+ const meetResponse = await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-tables`, new URLSearchParams({
2811
+ filter: JSON.stringify({
2812
+ "code": "meet",
2813
+ "scope": coopname,
2814
+ "table": "meets",
2815
+ "value.hash": meet_hash.toUpperCase(),
2816
+ ...block_filter
2817
+ }),
2818
+ limit: String(1)
2819
+ }));
2820
+ const meet = meetResponse.results[0]?.value;
2821
+ if (!meet)
2822
+ throw new Error("\u0421\u043E\u0431\u0440\u0430\u043D\u0438\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E");
2823
+ const presiderData = await this.getUser(meet.presider, block_num);
2824
+ const secretaryData = await this.getUser(meet.secretary, block_num);
2825
+ const presiderFullName = this.getFullParticipantName(presiderData.data);
2826
+ const secretaryFullName = this.getFullParticipantName(secretaryData.data);
2827
+ const meetExtended = {
2828
+ ...meet,
2829
+ current_quorum_percent: Number(Number(meet.current_quorum_percent).toFixed(1)),
2830
+ close_at_datetime: formatDateTime(meet.close_at),
2831
+ open_at_datetime: formatDateTime(meet.open_at),
2832
+ presider_full_name: presiderFullName,
2833
+ secretary_full_name: secretaryFullName
2834
+ };
2835
+ return meetExtended;
2836
+ }
2837
+ async getMeetQuestions(coopname, meet_id, block_num) {
2838
+ const block_filter = block_num ? { block_num: { $lte: block_num } } : {};
2839
+ const questionsResponse = await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-tables`, new URLSearchParams({
2840
+ filter: JSON.stringify({
2841
+ "code": "meet",
2842
+ "scope": coopname,
2843
+ "table": "questions",
2844
+ "value.meet_id": String(meet_id),
2845
+ ...block_filter
2846
+ })
2847
+ }));
2848
+ const questions = questionsResponse.results?.map((result) => result.value) || [];
2849
+ questions.sort((a, b) => {
2850
+ const numA = Number.parseInt(a.number.toString(), 10);
2851
+ const numB = Number.parseInt(b.number.toString(), 10);
2852
+ return numA - numB;
2853
+ });
2854
+ const extendedQuestions = questions.map((question) => {
2855
+ const votesFor = Number(question.counter_votes_for);
2856
+ const votesAgainst = Number(question.counter_votes_against);
2857
+ const votesAbstained = Number(question.counter_votes_abstained);
2858
+ const votesTotal = votesFor + votesAgainst + votesAbstained;
2859
+ const calculatePercent = (value) => {
2860
+ if (votesTotal === 0)
2861
+ return 0;
2862
+ return Math.round(value / votesTotal * 100);
2863
+ };
2864
+ const isAccepted = votesTotal > 0 && votesFor > votesTotal / 2;
2865
+ return {
2866
+ ...question,
2867
+ votes_total: votesTotal,
2868
+ votes_for_percent: calculatePercent(votesFor),
2869
+ votes_against_percent: calculatePercent(votesAgainst),
2870
+ votes_abstained_percent: calculatePercent(votesAbstained),
2871
+ is_accepted: isAccepted
2872
+ };
2873
+ });
2874
+ return extendedQuestions;
2875
+ }
2876
+ /**
2877
+ * Определяет как пользователь проголосовал по конкретному вопросу
2878
+ * @param question Вопрос голосования
2879
+ * @param username Имя пользователя
2880
+ * @returns 'for', 'against' или 'abstained'
2881
+ */
2882
+ getUserVote(question, username) {
2883
+ console.log(question, username);
2884
+ if (question.voters_for && question.voters_for.includes(username)) {
2885
+ return "for";
2886
+ }
2887
+ if (question.voters_against && question.voters_against.includes(username)) {
2888
+ return "against";
2889
+ }
2890
+ if (question.voters_abstained && question.voters_abstained.includes(username)) {
2891
+ return "abstained";
2892
+ }
2893
+ return "abstained";
2894
+ }
2432
2895
  async getTemplate(scope, registry_id, block_num) {
2433
2896
  const block_filter = block_num ? { block_num: { $lte: block_num } } : {};
2434
2897
  const templateResponse = await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-tables`, new URLSearchParams({
@@ -2512,7 +2975,7 @@ class DocFactory {
2512
2975
  };
2513
2976
  }
2514
2977
  extractOrganizationName(input) {
2515
- const regex = /^\s*(?:[А-ЯЁA-Za-z]{2,4}\s+)?["'«»“”]?([А-ЯЁа-яёA-Za-z0-9\- ]+(?:\s[А-ЯЁа-яёA-Za-z0-9\- ]+)*)["'«»“”]?\s*$/;
2978
+ const regex = /^\s*(?:[А-ЯЁA-Za-z]{2,4}\s+)?["'«»]?([А-ЯЁа-яёA-Za-z0-9\- ]+(?:\s[А-ЯЁа-яёA-Za-z0-9\- ]+)*)["'«»]?\s*$/;
2516
2979
  const match = input.short_name.match(regex);
2517
2980
  if (!match) {
2518
2981
  throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0438\u0437\u0432\u043B\u0435\u0447\u044C \u0438\u043C\u044F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0437: "${input.short_name}"`);
@@ -3444,15 +3907,28 @@ let Factory$4 = class Factory extends DocFactory {
3444
3907
  const meta = await super.getMeta({ title: template.title, ...data });
3445
3908
  const coop = await super.getCooperative(data.coopname, data.block_num);
3446
3909
  const vars = await super.getVars(data.coopname, data.block_num);
3447
- const user = await super.getUser(data.username, data.block_num);
3910
+ const userData = await super.getUser(data.username, data.block_num);
3911
+ const user = super.getCommonUser(userData);
3912
+ const meet = { ...data.meet };
3913
+ const questions = [...data.questions];
3448
3914
  const combinedData = {
3449
3915
  meta,
3450
3916
  coop,
3451
- vars
3917
+ vars,
3918
+ meet,
3919
+ questions,
3920
+ user
3452
3921
  };
3453
3922
  await super.validate(combinedData, template.model);
3454
3923
  const translation = template.translations[meta.lang];
3455
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
3924
+ const document = await super.generatePDF(
3925
+ user.full_name_or_short_name,
3926
+ template.context,
3927
+ combinedData,
3928
+ translation,
3929
+ meta,
3930
+ options?.skip_save
3931
+ );
3456
3932
  return document;
3457
3933
  }
3458
3934
  };
@@ -3471,15 +3947,27 @@ let Factory$3 = class Factory extends DocFactory {
3471
3947
  const meta = await super.getMeta({ title: template.title, ...data });
3472
3948
  const coop = await super.getCooperative(data.coopname, data.block_num);
3473
3949
  const vars = await super.getVars(data.coopname, data.block_num);
3474
- const user = await super.getUser(data.username, data.block_num);
3950
+ const decision = await super.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
3951
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
3952
+ const questions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
3475
3953
  const combinedData = {
3476
3954
  meta,
3477
3955
  coop,
3478
- vars
3956
+ vars,
3957
+ decision,
3958
+ meet,
3959
+ questions
3479
3960
  };
3480
3961
  await super.validate(combinedData, template.model);
3481
3962
  const translation = template.translations[meta.lang];
3482
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
3963
+ const document = await super.generatePDF(
3964
+ `${coop.chairman.last_name} ${coop.chairman.first_name} ${coop.chairman.middle_name}`,
3965
+ template.context,
3966
+ combinedData,
3967
+ translation,
3968
+ meta,
3969
+ options?.skip_save
3970
+ );
3483
3971
  return document;
3484
3972
  }
3485
3973
  };
@@ -3498,15 +3986,29 @@ let Factory$2 = class Factory extends DocFactory {
3498
3986
  const meta = await super.getMeta({ title: template.title, ...data });
3499
3987
  const coop = await super.getCooperative(data.coopname, data.block_num);
3500
3988
  const vars = await super.getVars(data.coopname, data.block_num);
3501
- const user = await super.getUser(data.username, data.block_num);
3989
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
3990
+ const questions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
3991
+ const userData = await super.getUser(meet.presider, data.block_num);
3992
+ const user = super.getCommonUser(userData);
3502
3993
  const combinedData = {
3503
3994
  meta,
3504
3995
  coop,
3505
- vars
3996
+ vars,
3997
+ meet,
3998
+ questions,
3999
+ user
3506
4000
  };
4001
+ console.log(combinedData);
3507
4002
  await super.validate(combinedData, template.model);
3508
4003
  const translation = template.translations[meta.lang];
3509
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4004
+ const document = await super.generatePDF(
4005
+ user.full_name_or_short_name,
4006
+ template.context,
4007
+ combinedData,
4008
+ translation,
4009
+ meta,
4010
+ options?.skip_save
4011
+ );
3510
4012
  return document;
3511
4013
  }
3512
4014
  };
@@ -3525,15 +4027,39 @@ let Factory$1 = class Factory extends DocFactory {
3525
4027
  const meta = await super.getMeta({ title: template.title, ...data });
3526
4028
  const coop = await super.getCooperative(data.coopname, data.block_num);
3527
4029
  const vars = await super.getVars(data.coopname, data.block_num);
3528
- const user = await super.getUser(data.username, data.block_num);
4030
+ const userData = await super.getUser(data.username, data.block_num);
4031
+ const user = super.getCommonUser(userData);
4032
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
4033
+ const meetQuestions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
4034
+ console.log("meetQuestions", meetQuestions);
4035
+ const questions = meetQuestions.map((question) => ({
4036
+ id: question.id.toString(),
4037
+ number: question.number.toString(),
4038
+ title: question.title,
4039
+ context: question.context || "",
4040
+ decision: question.decision
4041
+ }));
4042
+ const { answers } = data;
3529
4043
  const combinedData = {
3530
4044
  meta,
3531
4045
  coop,
3532
- vars
4046
+ vars,
4047
+ user,
4048
+ meet,
4049
+ answers,
4050
+ questions
3533
4051
  };
4052
+ console.dir(combinedData, { depth: null });
3534
4053
  await super.validate(combinedData, template.model);
3535
4054
  const translation = template.translations[meta.lang];
3536
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4055
+ const document = await super.generatePDF(
4056
+ user.full_name_or_short_name,
4057
+ template.context,
4058
+ combinedData,
4059
+ translation,
4060
+ meta,
4061
+ options?.skip_save
4062
+ );
3537
4063
  return document;
3538
4064
  }
3539
4065
  };
@@ -3552,15 +4078,27 @@ class Factory extends DocFactory {
3552
4078
  const meta = await super.getMeta({ title: template.title, ...data });
3553
4079
  const coop = await super.getCooperative(data.coopname, data.block_num);
3554
4080
  const vars = await super.getVars(data.coopname, data.block_num);
3555
- const user = await super.getUser(data.username, data.block_num);
4081
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
4082
+ const questions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
4083
+ const decision = await super.getGeneralMeetingDecision(meet, meta.created_at);
3556
4084
  const combinedData = {
3557
4085
  meta,
3558
4086
  coop,
3559
- vars
4087
+ vars,
4088
+ decision,
4089
+ meet,
4090
+ questions
3560
4091
  };
3561
4092
  await super.validate(combinedData, template.model);
3562
4093
  const translation = template.translations[meta.lang];
3563
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4094
+ const document = await super.generatePDF(
4095
+ `${meet.presider} / ${meet.secretary}`,
4096
+ template.context,
4097
+ combinedData,
4098
+ translation,
4099
+ meta,
4100
+ options?.skip_save
4101
+ );
3564
4102
  return document;
3565
4103
  }
3566
4104
  }
@@ -3746,4 +4284,4 @@ class Generator {
3746
4284
  }
3747
4285
  }
3748
4286
 
3749
- export { AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CoopenomicsAgreement, CooperativeSchema, DecisionOfParticipantApplication, FreeDecision, Generator, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, decisionSchema, entrepreneurSchema, individualSchema, organizationSchema, paymentMethodSchema };
4287
+ export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, DecisionOfParticipantApplication, FreeDecision, Generator, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, MeetPointSchema, MeetSchema, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema$1 as QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, decisionSchema, entrepreneurSchema, individualSchema, organizationSchema, paymentMethodSchema };