@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.cjs CHANGED
@@ -378,6 +378,285 @@ const VarsSchema = {
378
378
  additionalProperties: true
379
379
  };
380
380
 
381
+ const MeetSchema = {
382
+ type: "object",
383
+ properties: {
384
+ id: { type: "string" },
385
+ hash: { type: "string" },
386
+ coopname: { type: "string" },
387
+ type: { type: "string" },
388
+ level: { type: "string" },
389
+ status: { type: "string" },
390
+ open_at: { type: "string" },
391
+ close_at: { type: "string" },
392
+ open_at_datetime: { type: "string" },
393
+ close_at_datetime: { type: "string" },
394
+ presider_full_name: { type: "string" },
395
+ secretary_full_name: { type: "string" },
396
+ initiator: { type: "string" },
397
+ presider: { type: "string" },
398
+ secretary: { type: "string" },
399
+ quorum_percent: { type: "number" },
400
+ signed_ballots: { type: "string" },
401
+ current_quorum_percent: { type: "number" },
402
+ cycle: { type: "string" },
403
+ notified_users: {
404
+ type: "array",
405
+ items: { type: "string" }
406
+ },
407
+ quorum_passed: { type: "boolean" },
408
+ created_at: { type: "string" },
409
+ proposal: {
410
+ type: "object",
411
+ properties: {
412
+ version: { type: "string" },
413
+ hash: { type: "string" },
414
+ doc_hash: { type: "string" },
415
+ meta_hash: { type: "string" },
416
+ meta: { type: "string" },
417
+ signatures: {
418
+ type: "array",
419
+ items: {
420
+ type: "object",
421
+ properties: {
422
+ id: { type: "number" },
423
+ signed_hash: { type: "string" },
424
+ signer: { type: "string" },
425
+ public_key: { type: "string" },
426
+ signature: { type: "string" },
427
+ signed_at: { type: "string" },
428
+ meta: { type: "string" }
429
+ },
430
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
431
+ additionalProperties: true
432
+ }
433
+ }
434
+ },
435
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
436
+ additionalProperties: true
437
+ },
438
+ authorization: {
439
+ type: "object",
440
+ properties: {
441
+ version: { type: "string" },
442
+ hash: { type: "string" },
443
+ doc_hash: { type: "string" },
444
+ meta_hash: { type: "string" },
445
+ meta: { type: "string" },
446
+ signatures: {
447
+ type: "array",
448
+ items: {
449
+ type: "object",
450
+ properties: {
451
+ id: { type: "number" },
452
+ signed_hash: { type: "string" },
453
+ signer: { type: "string" },
454
+ public_key: { type: "string" },
455
+ signature: { type: "string" },
456
+ signed_at: { type: "string" },
457
+ meta: { type: "string" }
458
+ },
459
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
460
+ additionalProperties: true
461
+ }
462
+ }
463
+ },
464
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
465
+ additionalProperties: true
466
+ },
467
+ decision1: {
468
+ type: "object",
469
+ properties: {
470
+ version: { type: "string" },
471
+ hash: { type: "string" },
472
+ doc_hash: { type: "string" },
473
+ meta_hash: { type: "string" },
474
+ meta: { type: "string" },
475
+ signatures: {
476
+ type: "array",
477
+ items: {
478
+ type: "object",
479
+ properties: {
480
+ id: { type: "number" },
481
+ signed_hash: { type: "string" },
482
+ signer: { type: "string" },
483
+ public_key: { type: "string" },
484
+ signature: { type: "string" },
485
+ signed_at: { type: "string" },
486
+ meta: { type: "string" }
487
+ },
488
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
489
+ additionalProperties: true
490
+ }
491
+ }
492
+ },
493
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
494
+ additionalProperties: true
495
+ },
496
+ decision2: {
497
+ type: "object",
498
+ properties: {
499
+ version: { type: "string" },
500
+ hash: { type: "string" },
501
+ doc_hash: { type: "string" },
502
+ meta_hash: { type: "string" },
503
+ meta: { type: "string" },
504
+ signatures: {
505
+ type: "array",
506
+ items: {
507
+ type: "object",
508
+ properties: {
509
+ id: { type: "number" },
510
+ signed_hash: { type: "string" },
511
+ signer: { type: "string" },
512
+ public_key: { type: "string" },
513
+ signature: { type: "string" },
514
+ signed_at: { type: "string" },
515
+ meta: { type: "string" }
516
+ },
517
+ required: ["id", "signed_hash", "signer", "public_key", "signature", "signed_at", "meta"],
518
+ additionalProperties: true
519
+ }
520
+ }
521
+ },
522
+ required: ["version", "hash", "doc_hash", "meta_hash", "meta", "signatures"],
523
+ additionalProperties: true
524
+ }
525
+ },
526
+ required: [
527
+ "id",
528
+ "hash",
529
+ "coopname",
530
+ "type",
531
+ "status",
532
+ "open_at_datetime",
533
+ "close_at_datetime",
534
+ "presider_full_name",
535
+ "secretary_full_name"
536
+ ],
537
+ additionalProperties: true
538
+ };
539
+ const MeetPointSchema = {
540
+ type: "object",
541
+ properties: {
542
+ context: { type: "string" },
543
+ title: { type: "string" },
544
+ decision: { type: "string" }
545
+ },
546
+ required: ["context", "title", "decision"],
547
+ additionalProperties: true
548
+ };
549
+ const QuestionSchema$1 = {
550
+ type: "object",
551
+ properties: {
552
+ id: { type: "string" },
553
+ number: { type: "string" },
554
+ coopname: { type: "string" },
555
+ meet_id: { type: "string" },
556
+ title: { type: "string" },
557
+ context: { type: "string" },
558
+ decision: { type: "string" },
559
+ counter_votes_for: { type: "string" },
560
+ counter_votes_against: { type: "string" },
561
+ counter_votes_abstained: { type: "string" },
562
+ voters_for: { type: "array", items: { type: "string" } },
563
+ voters_against: { type: "array", items: { type: "string" } },
564
+ voters_abstained: { type: "array", items: { type: "string" } }
565
+ },
566
+ required: [
567
+ "id",
568
+ "number",
569
+ "coopname",
570
+ "meet_id",
571
+ "title",
572
+ "context",
573
+ "decision",
574
+ "counter_votes_for",
575
+ "counter_votes_against",
576
+ "counter_votes_abstained",
577
+ "voters_for",
578
+ "voters_against",
579
+ "voters_abstained"
580
+ ],
581
+ additionalProperties: true
582
+ };
583
+ const QuestionExtendedSchema = {
584
+ type: "object",
585
+ properties: {
586
+ id: { type: "string" },
587
+ number: { type: "string" },
588
+ coopname: { type: "string" },
589
+ meet_id: { type: "string" },
590
+ title: { type: "string" },
591
+ context: { type: "string" },
592
+ decision: { type: "string" },
593
+ counter_votes_for: { type: "string" },
594
+ counter_votes_against: { type: "string" },
595
+ counter_votes_abstained: { type: "string" },
596
+ voters_for: { type: "array", items: { type: "string" } },
597
+ voters_against: { type: "array", items: { type: "string" } },
598
+ voters_abstained: { type: "array", items: { type: "string" } },
599
+ votes_total: { type: "integer", nullable: true },
600
+ votes_for_percent: { type: "integer", nullable: true },
601
+ votes_against_percent: { type: "integer", nullable: true },
602
+ votes_abstained_percent: { type: "integer", nullable: true },
603
+ is_accepted: { type: "boolean", nullable: true }
604
+ },
605
+ required: [
606
+ "id",
607
+ "number",
608
+ "coopname",
609
+ "meet_id",
610
+ "title",
611
+ "context",
612
+ "decision",
613
+ "counter_votes_for",
614
+ "counter_votes_against",
615
+ "counter_votes_abstained",
616
+ "voters_for",
617
+ "voters_against",
618
+ "voters_abstained"
619
+ ],
620
+ additionalProperties: true
621
+ };
622
+
623
+ const CommonUserSchema = {
624
+ type: "object",
625
+ properties: {
626
+ full_name_or_short_name: { type: "string" },
627
+ birthdate_or_ogrn: { type: "string" },
628
+ abbr_full_name: { type: "string" }
629
+ },
630
+ required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name"],
631
+ additionalProperties: true
632
+ };
633
+
634
+ const AgendaMeetSchema = {
635
+ type: "object",
636
+ properties: {
637
+ type: { type: "string", enum: ["regular", "extra"] },
638
+ open_at_datetime: { type: "string" },
639
+ close_at_datetime: { type: "string" }
640
+ },
641
+ required: [
642
+ "type",
643
+ "open_at_datetime",
644
+ "close_at_datetime"
645
+ ],
646
+ additionalProperties: true
647
+ };
648
+ const AgendaQuestionSchema = {
649
+ type: "object",
650
+ properties: {
651
+ number: { type: "string" },
652
+ title: { type: "string" },
653
+ context: { type: "string", nullable: true },
654
+ decision: { type: "string" }
655
+ },
656
+ required: ["number", "title", "decision"],
657
+ additionalProperties: true
658
+ };
659
+
381
660
  const registry_id$q = cooptypes.Cooperative.Registry.WalletAgreement.registry_id;
382
661
  const Schema$q = {
383
662
  type: "object",
@@ -917,17 +1196,6 @@ const CommonRequestSchema = {
917
1196
  additionalProperties: true
918
1197
  };
919
1198
 
920
- const CommonUserSchema = {
921
- type: "object",
922
- properties: {
923
- full_name_or_short_name: { type: "string" },
924
- birthdate_or_ogrn: { type: "string" },
925
- abbr_full_name: { type: "string" }
926
- },
927
- required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name"],
928
- additionalProperties: true
929
- };
930
-
931
1199
  const registry_id$g = cooptypes.Cooperative.Registry.AssetContributionStatement.registry_id;
932
1200
  const Schema$g = {
933
1201
  type: "object",
@@ -1417,9 +1685,15 @@ const Schema$4 = {
1417
1685
  properties: {
1418
1686
  meta: IMetaJSONSchema,
1419
1687
  coop: CooperativeSchema,
1420
- vars: VarsSchema
1688
+ vars: VarsSchema,
1689
+ meet: AgendaMeetSchema,
1690
+ user: CommonUserSchema,
1691
+ questions: {
1692
+ type: "array",
1693
+ items: AgendaQuestionSchema
1694
+ }
1421
1695
  },
1422
- required: ["meta", "coop", "vars"],
1696
+ required: ["meta", "coop", "vars", "meet", "user", "questions"],
1423
1697
  additionalProperties: true
1424
1698
  };
1425
1699
  const Template$4 = {
@@ -1443,9 +1717,15 @@ const Schema$3 = {
1443
1717
  properties: {
1444
1718
  meta: IMetaJSONSchema,
1445
1719
  coop: CooperativeSchema,
1446
- vars: VarsSchema
1720
+ vars: VarsSchema,
1721
+ decision: decisionSchema,
1722
+ meet: MeetSchema,
1723
+ questions: {
1724
+ type: "array",
1725
+ items: MeetPointSchema
1726
+ }
1447
1727
  },
1448
- required: ["meta", "coop", "vars"],
1728
+ required: ["meta", "coop", "vars", "decision", "meet", "questions"],
1449
1729
  additionalProperties: true
1450
1730
  };
1451
1731
  const Template$3 = {
@@ -1469,9 +1749,15 @@ const Schema$2 = {
1469
1749
  properties: {
1470
1750
  meta: IMetaJSONSchema,
1471
1751
  coop: CooperativeSchema,
1472
- vars: VarsSchema
1752
+ vars: VarsSchema,
1753
+ user: CommonUserSchema,
1754
+ meet: MeetSchema,
1755
+ questions: {
1756
+ type: "array",
1757
+ items: MeetPointSchema
1758
+ }
1473
1759
  },
1474
- required: ["meta", "coop", "vars"],
1760
+ required: ["meta", "coop", "vars", "meet", "questions", "user"],
1475
1761
  additionalProperties: true
1476
1762
  };
1477
1763
  const Template$2 = {
@@ -1489,15 +1775,49 @@ const AnnualGeneralMeetingNotification = {
1489
1775
  registry_id: registry_id$2
1490
1776
  };
1491
1777
 
1778
+ const AnswerSchema = {
1779
+ type: "object",
1780
+ properties: {
1781
+ id: { type: "string" },
1782
+ number: { type: "string" },
1783
+ vote: { type: "string", enum: ["for", "against", "abstained"] }
1784
+ },
1785
+ required: ["id", "number", "vote"],
1786
+ additionalProperties: true
1787
+ };
1788
+ const QuestionSchema = {
1789
+ type: "object",
1790
+ properties: {
1791
+ id: { type: "string" },
1792
+ number: { type: "string" },
1793
+ title: { type: "string" },
1794
+ context: { type: "string" },
1795
+ decision: { type: "string" }
1796
+ },
1797
+ required: ["id", "number", "title", "context", "decision"],
1798
+ additionalProperties: true
1799
+ };
1492
1800
  const registry_id$1 = cooptypes.Cooperative.Registry.AnnualGeneralMeetingVotingBallot.registry_id;
1493
1801
  const Schema$1 = {
1494
1802
  type: "object",
1495
1803
  properties: {
1496
1804
  meta: IMetaJSONSchema,
1497
1805
  coop: CooperativeSchema,
1498
- vars: VarsSchema
1806
+ vars: VarsSchema,
1807
+ meet: MeetSchema,
1808
+ user: CommonUserSchema,
1809
+ answers: {
1810
+ type: "array",
1811
+ items: AnswerSchema,
1812
+ minItems: 1
1813
+ },
1814
+ questions: {
1815
+ type: "array",
1816
+ items: QuestionSchema,
1817
+ minItems: 1
1818
+ }
1499
1819
  },
1500
- required: ["meta", "coop", "vars"],
1820
+ required: ["meta", "coop", "vars", "meet", "user", "answers", "questions"],
1501
1821
  additionalProperties: true
1502
1822
  };
1503
1823
  const Template$1 = {
@@ -1521,9 +1841,15 @@ const Schema = {
1521
1841
  properties: {
1522
1842
  meta: IMetaJSONSchema,
1523
1843
  coop: CooperativeSchema,
1524
- vars: VarsSchema
1844
+ vars: VarsSchema,
1845
+ decision: decisionSchema,
1846
+ meet: MeetSchema,
1847
+ questions: {
1848
+ type: "array",
1849
+ items: QuestionExtendedSchema
1850
+ }
1525
1851
  },
1526
- required: ["meta", "coop", "vars"],
1852
+ required: ["meta", "coop", "vars", "decision", "meet", "questions"],
1527
1853
  additionalProperties: true
1528
1854
  };
1529
1855
  const Template = {
@@ -2189,7 +2515,7 @@ class PDFService {
2189
2515
 
2190
2516
  const name = "@coopenomics/factory";
2191
2517
  const type = "module";
2192
- const version = "2025.5.14";
2518
+ const version = "2025.6.13";
2193
2519
  const packageManager = "pnpm@9.0.6";
2194
2520
  const description = "";
2195
2521
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
@@ -2239,7 +2565,7 @@ const dependencies = {
2239
2565
  "ajv-formats": "^3.0.1",
2240
2566
  "ajv-i18n": "^4.2.0",
2241
2567
  axios: "^1.7.2",
2242
- cooptypes: "2025.5.14",
2568
+ cooptypes: "2025.6.13",
2243
2569
  dotenv: "^16.4.5",
2244
2570
  "eosjs-ecc": "^4.0.7",
2245
2571
  handlebars: "^4.7.8",
@@ -2280,7 +2606,7 @@ const pnpm = {
2280
2606
  "vite@>=5.1.0 <=5.1.6": ">=5.1.7"
2281
2607
  }
2282
2608
  };
2283
- const gitHead = "515a374f86b8c38fa9e725072b3816782e5c734c";
2609
+ const gitHead = "4a5fb2af8b23629f9820d8364373210f3b7be665";
2284
2610
  const packageJson = {
2285
2611
  name: name,
2286
2612
  type: type,
@@ -2307,6 +2633,40 @@ const packageJson = {
2307
2633
  gitHead: gitHead
2308
2634
  };
2309
2635
 
2636
+ function formatDateTime(timestamp) {
2637
+ if (!timestamp)
2638
+ return "";
2639
+ const timezone = "Europe/Moscow";
2640
+ let moscowDate;
2641
+ if (timestamp.includes("T")) {
2642
+ moscowDate = moment__default.utc(timestamp).tz(timezone);
2643
+ } else if (!Number.isNaN(Number(timestamp))) {
2644
+ moscowDate = moment__default.unix(Number(timestamp)).tz(timezone);
2645
+ } else {
2646
+ moscowDate = moment__default(timestamp).tz(timezone);
2647
+ }
2648
+ const months = [
2649
+ "\u044F\u043D\u0432\u0430\u0440\u044F",
2650
+ "\u0444\u0435\u0432\u0440\u0430\u043B\u044F",
2651
+ "\u043C\u0430\u0440\u0442\u0430",
2652
+ "\u0430\u043F\u0440\u0435\u043B\u044F",
2653
+ "\u043C\u0430\u044F",
2654
+ "\u0438\u044E\u043D\u044F",
2655
+ "\u0438\u044E\u043B\u044F",
2656
+ "\u0430\u0432\u0433\u0443\u0441\u0442\u0430",
2657
+ "\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F",
2658
+ "\u043E\u043A\u0442\u044F\u0431\u0440\u044F",
2659
+ "\u043D\u043E\u044F\u0431\u0440\u044F",
2660
+ "\u0434\u0435\u043A\u0430\u0431\u0440\u044F"
2661
+ ];
2662
+ const day = moscowDate.date();
2663
+ const month = months[moscowDate.month()];
2664
+ const year = moscowDate.year();
2665
+ const hours = moscowDate.format("HH");
2666
+ const minutes = moscowDate.format("mm");
2667
+ return `${day} ${month} ${year} ${hours}:${minutes} (\u041C\u0441\u043A)`;
2668
+ }
2669
+
2310
2670
  var __defProp$2 = Object.defineProperty;
2311
2671
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2312
2672
  var __publicField$2 = (obj, key, value) => {
@@ -2403,6 +2763,22 @@ class DocFactory {
2403
2763
  name: "\u0421\u041E\u0421\u0415\u0414\u0418"
2404
2764
  };
2405
2765
  }
2766
+ async getGeneralMeetingDecision(meet, created_at) {
2767
+ const quorum_percent = Number(meet.current_quorum_percent);
2768
+ const votes_for = 0;
2769
+ const votes_against = 0;
2770
+ const votes_abstained = 0;
2771
+ const [date, time] = created_at.split(" ");
2772
+ return {
2773
+ id: Number(meet.id),
2774
+ date,
2775
+ time,
2776
+ votes_for,
2777
+ votes_against,
2778
+ votes_abstained,
2779
+ voters_percent: quorum_percent
2780
+ };
2781
+ }
2406
2782
  async getDecision(coop, coopname, decision_id, created_at) {
2407
2783
  const votes_for_actions = (await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-actions`, new URLSearchParams({
2408
2784
  filter: JSON.stringify({
@@ -2442,6 +2818,93 @@ class DocFactory {
2442
2818
  // decision,
2443
2819
  };
2444
2820
  }
2821
+ async getMeet(coopname, meet_hash, block_num) {
2822
+ const block_filter = block_num ? { block_num: { $lte: block_num } } : {};
2823
+ const meetResponse = await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-tables`, new URLSearchParams({
2824
+ filter: JSON.stringify({
2825
+ "code": "meet",
2826
+ "scope": coopname,
2827
+ "table": "meets",
2828
+ "value.hash": meet_hash.toUpperCase(),
2829
+ ...block_filter
2830
+ }),
2831
+ limit: String(1)
2832
+ }));
2833
+ const meet = meetResponse.results[0]?.value;
2834
+ if (!meet)
2835
+ throw new Error("\u0421\u043E\u0431\u0440\u0430\u043D\u0438\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E");
2836
+ const presiderData = await this.getUser(meet.presider, block_num);
2837
+ const secretaryData = await this.getUser(meet.secretary, block_num);
2838
+ const presiderFullName = this.getFullParticipantName(presiderData.data);
2839
+ const secretaryFullName = this.getFullParticipantName(secretaryData.data);
2840
+ const meetExtended = {
2841
+ ...meet,
2842
+ current_quorum_percent: Number(Number(meet.current_quorum_percent).toFixed(1)),
2843
+ close_at_datetime: formatDateTime(meet.close_at),
2844
+ open_at_datetime: formatDateTime(meet.open_at),
2845
+ presider_full_name: presiderFullName,
2846
+ secretary_full_name: secretaryFullName
2847
+ };
2848
+ return meetExtended;
2849
+ }
2850
+ async getMeetQuestions(coopname, meet_id, block_num) {
2851
+ const block_filter = block_num ? { block_num: { $lte: block_num } } : {};
2852
+ const questionsResponse = await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-tables`, new URLSearchParams({
2853
+ filter: JSON.stringify({
2854
+ "code": "meet",
2855
+ "scope": coopname,
2856
+ "table": "questions",
2857
+ "value.meet_id": String(meet_id),
2858
+ ...block_filter
2859
+ })
2860
+ }));
2861
+ const questions = questionsResponse.results?.map((result) => result.value) || [];
2862
+ questions.sort((a, b) => {
2863
+ const numA = Number.parseInt(a.number.toString(), 10);
2864
+ const numB = Number.parseInt(b.number.toString(), 10);
2865
+ return numA - numB;
2866
+ });
2867
+ const extendedQuestions = questions.map((question) => {
2868
+ const votesFor = Number(question.counter_votes_for);
2869
+ const votesAgainst = Number(question.counter_votes_against);
2870
+ const votesAbstained = Number(question.counter_votes_abstained);
2871
+ const votesTotal = votesFor + votesAgainst + votesAbstained;
2872
+ const calculatePercent = (value) => {
2873
+ if (votesTotal === 0)
2874
+ return 0;
2875
+ return Math.round(value / votesTotal * 100);
2876
+ };
2877
+ const isAccepted = votesTotal > 0 && votesFor > votesTotal / 2;
2878
+ return {
2879
+ ...question,
2880
+ votes_total: votesTotal,
2881
+ votes_for_percent: calculatePercent(votesFor),
2882
+ votes_against_percent: calculatePercent(votesAgainst),
2883
+ votes_abstained_percent: calculatePercent(votesAbstained),
2884
+ is_accepted: isAccepted
2885
+ };
2886
+ });
2887
+ return extendedQuestions;
2888
+ }
2889
+ /**
2890
+ * Определяет как пользователь проголосовал по конкретному вопросу
2891
+ * @param question Вопрос голосования
2892
+ * @param username Имя пользователя
2893
+ * @returns 'for', 'against' или 'abstained'
2894
+ */
2895
+ getUserVote(question, username) {
2896
+ console.log(question, username);
2897
+ if (question.voters_for && question.voters_for.includes(username)) {
2898
+ return "for";
2899
+ }
2900
+ if (question.voters_against && question.voters_against.includes(username)) {
2901
+ return "against";
2902
+ }
2903
+ if (question.voters_abstained && question.voters_abstained.includes(username)) {
2904
+ return "abstained";
2905
+ }
2906
+ return "abstained";
2907
+ }
2445
2908
  async getTemplate(scope, registry_id, block_num) {
2446
2909
  const block_filter = block_num ? { block_num: { $lte: block_num } } : {};
2447
2910
  const templateResponse = await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-tables`, new URLSearchParams({
@@ -2525,7 +2988,7 @@ class DocFactory {
2525
2988
  };
2526
2989
  }
2527
2990
  extractOrganizationName(input) {
2528
- const regex = /^\s*(?:[А-ЯЁA-Za-z]{2,4}\s+)?["'«»“”]?([А-ЯЁа-яёA-Za-z0-9\- ]+(?:\s[А-ЯЁа-яёA-Za-z0-9\- ]+)*)["'«»“”]?\s*$/;
2991
+ const regex = /^\s*(?:[А-ЯЁA-Za-z]{2,4}\s+)?["'«»]?([А-ЯЁа-яёA-Za-z0-9\- ]+(?:\s[А-ЯЁа-яёA-Za-z0-9\- ]+)*)["'«»]?\s*$/;
2529
2992
  const match = input.short_name.match(regex);
2530
2993
  if (!match) {
2531
2994
  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}"`);
@@ -3457,15 +3920,28 @@ let Factory$4 = class Factory extends DocFactory {
3457
3920
  const meta = await super.getMeta({ title: template.title, ...data });
3458
3921
  const coop = await super.getCooperative(data.coopname, data.block_num);
3459
3922
  const vars = await super.getVars(data.coopname, data.block_num);
3460
- const user = await super.getUser(data.username, data.block_num);
3923
+ const userData = await super.getUser(data.username, data.block_num);
3924
+ const user = super.getCommonUser(userData);
3925
+ const meet = { ...data.meet };
3926
+ const questions = [...data.questions];
3461
3927
  const combinedData = {
3462
3928
  meta,
3463
3929
  coop,
3464
- vars
3930
+ vars,
3931
+ meet,
3932
+ questions,
3933
+ user
3465
3934
  };
3466
3935
  await super.validate(combinedData, template.model);
3467
3936
  const translation = template.translations[meta.lang];
3468
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
3937
+ const document = await super.generatePDF(
3938
+ user.full_name_or_short_name,
3939
+ template.context,
3940
+ combinedData,
3941
+ translation,
3942
+ meta,
3943
+ options?.skip_save
3944
+ );
3469
3945
  return document;
3470
3946
  }
3471
3947
  };
@@ -3484,15 +3960,27 @@ let Factory$3 = class Factory extends DocFactory {
3484
3960
  const meta = await super.getMeta({ title: template.title, ...data });
3485
3961
  const coop = await super.getCooperative(data.coopname, data.block_num);
3486
3962
  const vars = await super.getVars(data.coopname, data.block_num);
3487
- const user = await super.getUser(data.username, data.block_num);
3963
+ const decision = await super.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
3964
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
3965
+ const questions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
3488
3966
  const combinedData = {
3489
3967
  meta,
3490
3968
  coop,
3491
- vars
3969
+ vars,
3970
+ decision,
3971
+ meet,
3972
+ questions
3492
3973
  };
3493
3974
  await super.validate(combinedData, template.model);
3494
3975
  const translation = template.translations[meta.lang];
3495
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
3976
+ const document = await super.generatePDF(
3977
+ `${coop.chairman.last_name} ${coop.chairman.first_name} ${coop.chairman.middle_name}`,
3978
+ template.context,
3979
+ combinedData,
3980
+ translation,
3981
+ meta,
3982
+ options?.skip_save
3983
+ );
3496
3984
  return document;
3497
3985
  }
3498
3986
  };
@@ -3511,15 +3999,29 @@ let Factory$2 = class Factory extends DocFactory {
3511
3999
  const meta = await super.getMeta({ title: template.title, ...data });
3512
4000
  const coop = await super.getCooperative(data.coopname, data.block_num);
3513
4001
  const vars = await super.getVars(data.coopname, data.block_num);
3514
- const user = await super.getUser(data.username, data.block_num);
4002
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
4003
+ const questions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
4004
+ const userData = await super.getUser(meet.presider, data.block_num);
4005
+ const user = super.getCommonUser(userData);
3515
4006
  const combinedData = {
3516
4007
  meta,
3517
4008
  coop,
3518
- vars
4009
+ vars,
4010
+ meet,
4011
+ questions,
4012
+ user
3519
4013
  };
4014
+ console.log(combinedData);
3520
4015
  await super.validate(combinedData, template.model);
3521
4016
  const translation = template.translations[meta.lang];
3522
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4017
+ const document = await super.generatePDF(
4018
+ user.full_name_or_short_name,
4019
+ template.context,
4020
+ combinedData,
4021
+ translation,
4022
+ meta,
4023
+ options?.skip_save
4024
+ );
3523
4025
  return document;
3524
4026
  }
3525
4027
  };
@@ -3538,15 +4040,39 @@ let Factory$1 = class Factory extends DocFactory {
3538
4040
  const meta = await super.getMeta({ title: template.title, ...data });
3539
4041
  const coop = await super.getCooperative(data.coopname, data.block_num);
3540
4042
  const vars = await super.getVars(data.coopname, data.block_num);
3541
- const user = await super.getUser(data.username, data.block_num);
4043
+ const userData = await super.getUser(data.username, data.block_num);
4044
+ const user = super.getCommonUser(userData);
4045
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
4046
+ const meetQuestions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
4047
+ console.log("meetQuestions", meetQuestions);
4048
+ const questions = meetQuestions.map((question) => ({
4049
+ id: question.id.toString(),
4050
+ number: question.number.toString(),
4051
+ title: question.title,
4052
+ context: question.context || "",
4053
+ decision: question.decision
4054
+ }));
4055
+ const { answers } = data;
3542
4056
  const combinedData = {
3543
4057
  meta,
3544
4058
  coop,
3545
- vars
4059
+ vars,
4060
+ user,
4061
+ meet,
4062
+ answers,
4063
+ questions
3546
4064
  };
4065
+ console.dir(combinedData, { depth: null });
3547
4066
  await super.validate(combinedData, template.model);
3548
4067
  const translation = template.translations[meta.lang];
3549
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4068
+ const document = await super.generatePDF(
4069
+ user.full_name_or_short_name,
4070
+ template.context,
4071
+ combinedData,
4072
+ translation,
4073
+ meta,
4074
+ options?.skip_save
4075
+ );
3550
4076
  return document;
3551
4077
  }
3552
4078
  };
@@ -3565,15 +4091,27 @@ class Factory extends DocFactory {
3565
4091
  const meta = await super.getMeta({ title: template.title, ...data });
3566
4092
  const coop = await super.getCooperative(data.coopname, data.block_num);
3567
4093
  const vars = await super.getVars(data.coopname, data.block_num);
3568
- const user = await super.getUser(data.username, data.block_num);
4094
+ const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
4095
+ const questions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
4096
+ const decision = await super.getGeneralMeetingDecision(meet, meta.created_at);
3569
4097
  const combinedData = {
3570
4098
  meta,
3571
4099
  coop,
3572
- vars
4100
+ vars,
4101
+ decision,
4102
+ meet,
4103
+ questions
3573
4104
  };
3574
4105
  await super.validate(combinedData, template.model);
3575
4106
  const translation = template.translations[meta.lang];
3576
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4107
+ const document = await super.generatePDF(
4108
+ `${meet.presider} / ${meet.secretary}`,
4109
+ template.context,
4110
+ combinedData,
4111
+ translation,
4112
+ meta,
4113
+ options?.skip_save
4114
+ );
3577
4115
  return document;
3578
4116
  }
3579
4117
  }
@@ -3759,6 +4297,8 @@ class Generator {
3759
4297
  }
3760
4298
  }
3761
4299
 
4300
+ exports.AgendaMeetSchema = AgendaMeetSchema;
4301
+ exports.AgendaQuestionSchema = AgendaQuestionSchema;
3762
4302
  exports.AnnualGeneralMeetingAgenda = AnnualGeneralMeetingAgenda;
3763
4303
  exports.AnnualGeneralMeetingDecision = AnnualGeneralMeetingDecision;
3764
4304
  exports.AnnualGeneralMeetingNotification = AnnualGeneralMeetingNotification;
@@ -3768,6 +4308,7 @@ exports.AssetContributionAct = AssetContributionAct;
3768
4308
  exports.AssetContributionDecision = AssetContributionDecision;
3769
4309
  exports.AssetContributionStatement = AssetContributionStatement;
3770
4310
  exports.BankAccountSchema = BankAccountSchema;
4311
+ exports.CommonUserSchema = CommonUserSchema;
3771
4312
  exports.CoopenomicsAgreement = CoopenomicsAgreement;
3772
4313
  exports.CooperativeSchema = CooperativeSchema;
3773
4314
  exports.DecisionOfParticipantApplication = DecisionOfParticipantApplication;
@@ -3778,9 +4319,13 @@ exports.InvestByResultAct = InvestByResultAct;
3778
4319
  exports.InvestByResultStatement = InvestByResultStatement;
3779
4320
  exports.InvestMembershipConvertation = InvestMembershipConvertation;
3780
4321
  exports.InvestmentAgreement = InvestmentAgreement;
4322
+ exports.MeetPointSchema = MeetPointSchema;
4323
+ exports.MeetSchema = MeetSchema;
3781
4324
  exports.ParticipantApplication = ParticipantApplication;
3782
4325
  exports.PrivacyPolicy = PrivacyPolicy;
3783
4326
  exports.ProjectFreeDecision = ProjectFreeDecision;
4327
+ exports.QuestionExtendedSchema = QuestionExtendedSchema;
4328
+ exports.QuestionSchema = QuestionSchema$1;
3784
4329
  exports.Registry = Registry;
3785
4330
  exports.RegulationElectronicSignature = RegulationElectronicSignaturet;
3786
4331
  exports.ReturnByAssetAct = ReturnByAssetAct;