@coopenomics/factory 2.2.5 → 2.2.7

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
@@ -90,7 +90,7 @@ const decisionSchema = {
90
90
  voters_percent: { type: "number" }
91
91
  },
92
92
  required: ["id", "date", "time", "votes_for", "votes_against", "votes_abstained", "voters_percent"],
93
- additionalProperties: false
93
+ additionalProperties: true
94
94
  };
95
95
 
96
96
  const entrepreneurSchema = {
@@ -131,7 +131,7 @@ const organizationSchema = {
131
131
  type: "object",
132
132
  properties: {
133
133
  username: { type: "string" },
134
- type: { type: "string", enum: ["coop", "ooo", "oao", "zao", "pao", "ao"] },
134
+ type: { type: "string", enum: ["coop", "prodcoop", "ooo", "oao", "zao", "pao", "ao"] },
135
135
  short_name: { type: "string" },
136
136
  full_name: { type: "string" },
137
137
  represented_by: {
@@ -366,8 +366,8 @@ const VarsSchema = {
366
366
  additionalProperties: true
367
367
  };
368
368
 
369
- const registry_id$9 = cooptypes.Cooperative.Registry.WalletAgreement.registry_id;
370
- const Schema$9 = {
369
+ const registry_id$f = cooptypes.Cooperative.Registry.WalletAgreement.registry_id;
370
+ const Schema$f = {
371
371
  type: "object",
372
372
  properties: {
373
373
  meta: IMetaJSONSchema,
@@ -377,23 +377,23 @@ const Schema$9 = {
377
377
  required: ["meta", "coop", "vars"],
378
378
  additionalProperties: true
379
379
  };
380
- const Template$9 = {
380
+ const Template$f = {
381
381
  title: cooptypes.Cooperative.Registry.WalletAgreement.title,
382
382
  description: cooptypes.Cooperative.Registry.WalletAgreement.description,
383
- model: Schema$9,
383
+ model: Schema$f,
384
384
  context: cooptypes.Cooperative.Registry.WalletAgreement.context,
385
385
  translations: cooptypes.Cooperative.Registry.WalletAgreement.translations
386
386
  };
387
387
 
388
388
  const WalletAgreement = {
389
389
  __proto__: null,
390
- Schema: Schema$9,
391
- Template: Template$9,
392
- registry_id: registry_id$9
390
+ Schema: Schema$f,
391
+ Template: Template$f,
392
+ registry_id: registry_id$f
393
393
  };
394
394
 
395
- const registry_id$8 = cooptypes.Cooperative.Registry.RegulationElectronicSignature.registry_id;
396
- const Schema$8 = {
395
+ const registry_id$e = cooptypes.Cooperative.Registry.RegulationElectronicSignature.registry_id;
396
+ const Schema$e = {
397
397
  type: "object",
398
398
  properties: {
399
399
  meta: IMetaJSONSchema,
@@ -403,23 +403,23 @@ const Schema$8 = {
403
403
  required: ["meta", "coop", "vars"],
404
404
  additionalProperties: true
405
405
  };
406
- const Template$8 = {
406
+ const Template$e = {
407
407
  title: cooptypes.Cooperative.Registry.RegulationElectronicSignature.title,
408
408
  description: cooptypes.Cooperative.Registry.RegulationElectronicSignature.description,
409
- model: Schema$8,
409
+ model: Schema$e,
410
410
  context: cooptypes.Cooperative.Registry.RegulationElectronicSignature.context,
411
411
  translations: cooptypes.Cooperative.Registry.RegulationElectronicSignature.translations
412
412
  };
413
413
 
414
414
  const RegulationElectronicSignaturet = {
415
415
  __proto__: null,
416
- Schema: Schema$8,
417
- Template: Template$8,
418
- registry_id: registry_id$8
416
+ Schema: Schema$e,
417
+ Template: Template$e,
418
+ registry_id: registry_id$e
419
419
  };
420
420
 
421
- const registry_id$7 = cooptypes.Cooperative.Registry.PrivacyPolicy.registry_id;
422
- const Schema$7 = {
421
+ const registry_id$d = cooptypes.Cooperative.Registry.PrivacyPolicy.registry_id;
422
+ const Schema$d = {
423
423
  type: "object",
424
424
  properties: {
425
425
  meta: IMetaJSONSchema,
@@ -429,23 +429,23 @@ const Schema$7 = {
429
429
  required: ["meta", "coop", "vars"],
430
430
  additionalProperties: true
431
431
  };
432
- const Template$7 = {
432
+ const Template$d = {
433
433
  title: cooptypes.Cooperative.Registry.PrivacyPolicy.title,
434
434
  description: cooptypes.Cooperative.Registry.PrivacyPolicy.description,
435
- model: Schema$7,
435
+ model: Schema$d,
436
436
  context: cooptypes.Cooperative.Registry.PrivacyPolicy.context,
437
437
  translations: cooptypes.Cooperative.Registry.PrivacyPolicy.translations
438
438
  };
439
439
 
440
440
  const PrivacyPolicy = {
441
441
  __proto__: null,
442
- Schema: Schema$7,
443
- Template: Template$7,
444
- registry_id: registry_id$7
442
+ Schema: Schema$d,
443
+ Template: Template$d,
444
+ registry_id: registry_id$d
445
445
  };
446
446
 
447
- const registry_id$6 = cooptypes.Cooperative.Registry.UserAgreement.registry_id;
448
- const Schema$6 = {
447
+ const registry_id$c = cooptypes.Cooperative.Registry.UserAgreement.registry_id;
448
+ const Schema$c = {
449
449
  type: "object",
450
450
  properties: {
451
451
  meta: IMetaJSONSchema,
@@ -462,23 +462,23 @@ const Schema$6 = {
462
462
  required: ["meta", "coop", "vars", "user"],
463
463
  additionalProperties: true
464
464
  };
465
- const Template$6 = {
465
+ const Template$c = {
466
466
  title: cooptypes.Cooperative.Registry.UserAgreement.title,
467
467
  description: cooptypes.Cooperative.Registry.UserAgreement.description,
468
- model: Schema$6,
468
+ model: Schema$c,
469
469
  context: cooptypes.Cooperative.Registry.UserAgreement.context,
470
470
  translations: cooptypes.Cooperative.Registry.UserAgreement.translations
471
471
  };
472
472
 
473
473
  const UserAgreement = {
474
474
  __proto__: null,
475
- Schema: Schema$6,
476
- Template: Template$6,
477
- registry_id: registry_id$6
475
+ Schema: Schema$c,
476
+ Template: Template$c,
477
+ registry_id: registry_id$c
478
478
  };
479
479
 
480
- const registry_id$5 = cooptypes.Cooperative.Registry.CoopenomicsAgreement.registry_id;
481
- const Schema$5 = {
480
+ const registry_id$b = cooptypes.Cooperative.Registry.CoopenomicsAgreement.registry_id;
481
+ const Schema$b = {
482
482
  type: "object",
483
483
  properties: {
484
484
  meta: IMetaJSONSchema,
@@ -489,23 +489,23 @@ const Schema$5 = {
489
489
  required: ["meta", "coop", "vars", "partner"],
490
490
  additionalProperties: true
491
491
  };
492
- const Template$5 = {
492
+ const Template$b = {
493
493
  title: cooptypes.Cooperative.Registry.CoopenomicsAgreement.title,
494
494
  description: cooptypes.Cooperative.Registry.CoopenomicsAgreement.description,
495
- model: Schema$5,
495
+ model: Schema$b,
496
496
  context: cooptypes.Cooperative.Registry.CoopenomicsAgreement.context,
497
497
  translations: cooptypes.Cooperative.Registry.CoopenomicsAgreement.translations
498
498
  };
499
499
 
500
500
  const CoopenomicsAgreement = {
501
501
  __proto__: null,
502
- Schema: Schema$5,
503
- Template: Template$5,
504
- registry_id: registry_id$5
502
+ Schema: Schema$b,
503
+ Template: Template$b,
504
+ registry_id: registry_id$b
505
505
  };
506
506
 
507
- const registry_id$4 = cooptypes.Cooperative.Registry.ParticipantApplication.registry_id;
508
- const Schema$4 = {
507
+ const registry_id$a = cooptypes.Cooperative.Registry.ParticipantApplication.registry_id;
508
+ const Schema$a = {
509
509
  type: "object",
510
510
  properties: {
511
511
  type: {
@@ -577,23 +577,23 @@ const Schema$4 = {
577
577
  required: ["meta", "coop", "type", "signature"],
578
578
  additionalProperties: true
579
579
  };
580
- const Template$4 = {
580
+ const Template$a = {
581
581
  title: cooptypes.Cooperative.Registry.ParticipantApplication.title,
582
582
  description: cooptypes.Cooperative.Registry.ParticipantApplication.description,
583
- model: Schema$4,
583
+ model: Schema$a,
584
584
  context: cooptypes.Cooperative.Registry.ParticipantApplication.context,
585
585
  translations: cooptypes.Cooperative.Registry.ParticipantApplication.translations
586
586
  };
587
587
 
588
588
  const ParticipantApplication = {
589
589
  __proto__: null,
590
- Schema: Schema$4,
591
- Template: Template$4,
592
- registry_id: registry_id$4
590
+ Schema: Schema$a,
591
+ Template: Template$a,
592
+ registry_id: registry_id$a
593
593
  };
594
594
 
595
- const registry_id$3 = cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.registry_id;
596
- const Schema$3 = {
595
+ const registry_id$9 = cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.registry_id;
596
+ const Schema$9 = {
597
597
  type: "object",
598
598
  properties: {
599
599
  type: {
@@ -650,28 +650,30 @@ const Schema$3 = {
650
650
  },
651
651
  required: [...IMetaJSONSchema.required],
652
652
  additionalProperties: true
653
- }
653
+ },
654
+ vars: VarsSchema
654
655
  },
655
656
  required: ["meta", "coop", "type", "decision"],
657
+ // vars не добавляем в обязательные параметры для обратной совместимости (начиная с 2.26)
656
658
  additionalProperties: true
657
659
  };
658
- const Template$3 = {
660
+ const Template$9 = {
659
661
  title: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.title,
660
662
  description: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.description,
661
- model: Schema$3,
663
+ model: Schema$9,
662
664
  context: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.context,
663
665
  translations: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.translations
664
666
  };
665
667
 
666
668
  const DecisionOfParticipantApplication = {
667
669
  __proto__: null,
668
- Schema: Schema$3,
669
- Template: Template$3,
670
- registry_id: registry_id$3
670
+ Schema: Schema$9,
671
+ Template: Template$9,
672
+ registry_id: registry_id$9
671
673
  };
672
674
 
673
- const registry_id$2 = cooptypes.Cooperative.Registry.SelectBranchStatement.registry_id;
674
- const Schema$2 = {
675
+ const registry_id$8 = cooptypes.Cooperative.Registry.SelectBranchStatement.registry_id;
676
+ const Schema$8 = {
675
677
  type: "object",
676
678
  properties: {
677
679
  type: {
@@ -726,23 +728,23 @@ const Schema$2 = {
726
728
  required: ["meta", "type", "branch", "vars"],
727
729
  additionalProperties: true
728
730
  };
729
- const Template$2 = {
731
+ const Template$8 = {
730
732
  title: cooptypes.Cooperative.Registry.SelectBranchStatement.title,
731
733
  description: cooptypes.Cooperative.Registry.SelectBranchStatement.description,
732
- model: Schema$2,
734
+ model: Schema$8,
733
735
  context: cooptypes.Cooperative.Registry.SelectBranchStatement.context,
734
736
  translations: cooptypes.Cooperative.Registry.SelectBranchStatement.translations
735
737
  };
736
738
 
737
739
  const SelectBranchStatement = {
738
740
  __proto__: null,
739
- Schema: Schema$2,
740
- Template: Template$2,
741
- registry_id: registry_id$2
741
+ Schema: Schema$8,
742
+ Template: Template$8,
743
+ registry_id: registry_id$8
742
744
  };
743
745
 
744
- const registry_id$1 = cooptypes.Cooperative.Registry.ProjectFreeDecision.registry_id;
745
- const Schema$1 = {
746
+ const registry_id$7 = cooptypes.Cooperative.Registry.ProjectFreeDecision.registry_id;
747
+ const Schema$7 = {
746
748
  type: "object",
747
749
  properties: {
748
750
  coop: {
@@ -777,23 +779,23 @@ const Schema$1 = {
777
779
  required: ["meta", "coop", "project", "suggester_name", "vars"],
778
780
  additionalProperties: true
779
781
  };
780
- const Template$1 = {
782
+ const Template$7 = {
781
783
  title: cooptypes.Cooperative.Registry.ProjectFreeDecision.title,
782
784
  description: cooptypes.Cooperative.Registry.ProjectFreeDecision.description,
783
- model: Schema$1,
785
+ model: Schema$7,
784
786
  context: cooptypes.Cooperative.Registry.ProjectFreeDecision.context,
785
787
  translations: cooptypes.Cooperative.Registry.ProjectFreeDecision.translations
786
788
  };
787
789
 
788
790
  const ProjectFreeDecision = {
789
791
  __proto__: null,
790
- Schema: Schema$1,
791
- Template: Template$1,
792
- registry_id: registry_id$1
792
+ Schema: Schema$7,
793
+ Template: Template$7,
794
+ registry_id: registry_id$7
793
795
  };
794
796
 
795
- const registry_id = cooptypes.Cooperative.Registry.FreeDecision.registry_id;
796
- const Schema = {
797
+ const registry_id$6 = cooptypes.Cooperative.Registry.FreeDecision.registry_id;
798
+ const Schema$6 = {
797
799
  type: "object",
798
800
  properties: {
799
801
  coop: {
@@ -829,20 +831,259 @@ const Schema = {
829
831
  },
830
832
  required: ["id", "question", "decision"],
831
833
  additionalProperties: true
832
- }
834
+ },
835
+ vars: VarsSchema
833
836
  },
834
837
  required: ["meta", "coop", "decision", "project"],
838
+ // vars не вносим для обратной совместимости начиная с версии 2.25
835
839
  additionalProperties: true
836
840
  };
837
- const Template = {
841
+ const Template$6 = {
838
842
  title: cooptypes.Cooperative.Registry.FreeDecision.title,
839
843
  description: cooptypes.Cooperative.Registry.FreeDecision.description,
840
- model: Schema,
844
+ model: Schema$6,
841
845
  context: cooptypes.Cooperative.Registry.FreeDecision.context,
842
846
  translations: cooptypes.Cooperative.Registry.FreeDecision.translations
843
847
  };
844
848
 
845
849
  const FreeDecision = {
850
+ __proto__: null,
851
+ Schema: Schema$6,
852
+ Template: Template$6,
853
+ registry_id: registry_id$6
854
+ };
855
+
856
+ const CommonRequestSchema = {
857
+ type: "object",
858
+ properties: {
859
+ hash: { type: "string" },
860
+ title: { type: "string" },
861
+ unit_of_measurement: { type: "string" },
862
+ units: { type: "number" },
863
+ unit_cost: { type: "string" },
864
+ total_cost: { type: "string" },
865
+ currency: { type: "string" },
866
+ type: { type: "string" },
867
+ program_id: { type: "number" }
868
+ },
869
+ required: [
870
+ "hash",
871
+ "title",
872
+ "unit_of_measurement",
873
+ "units",
874
+ "unit_cost",
875
+ "total_cost",
876
+ "currency",
877
+ "type",
878
+ "program_id"
879
+ ],
880
+ additionalProperties: true
881
+ };
882
+
883
+ const CommonUserSchema = {
884
+ type: "object",
885
+ properties: {
886
+ full_name_or_short_name: { type: "string" },
887
+ birthdate_or_ogrn: { type: "string" }
888
+ },
889
+ required: ["full_name_or_short_name", "birthdate_or_ogrn"],
890
+ additionalProperties: true
891
+ };
892
+
893
+ const registry_id$5 = cooptypes.Cooperative.Registry.AssetContributionStatement.registry_id;
894
+ const Schema$5 = {
895
+ type: "object",
896
+ properties: {
897
+ meta: IMetaJSONSchema,
898
+ coop: CooperativeSchema,
899
+ vars: VarsSchema,
900
+ request: CommonRequestSchema,
901
+ user: CommonUserSchema
902
+ },
903
+ required: ["meta", "coop", "vars", "request", "user"],
904
+ additionalProperties: true
905
+ };
906
+ const Template$5 = {
907
+ title: cooptypes.Cooperative.Registry.AssetContributionStatement.title,
908
+ description: cooptypes.Cooperative.Registry.AssetContributionStatement.description,
909
+ model: Schema$5,
910
+ context: cooptypes.Cooperative.Registry.AssetContributionStatement.context,
911
+ translations: cooptypes.Cooperative.Registry.AssetContributionStatement.translations
912
+ };
913
+
914
+ const AssetContributionStatement = {
915
+ __proto__: null,
916
+ Schema: Schema$5,
917
+ Template: Template$5,
918
+ registry_id: registry_id$5
919
+ };
920
+
921
+ const registry_id$4 = cooptypes.Cooperative.Registry.ReturnByAssetStatement.registry_id;
922
+ const Schema$4 = {
923
+ type: "object",
924
+ properties: {
925
+ meta: IMetaJSONSchema,
926
+ coop: CooperativeSchema,
927
+ vars: VarsSchema,
928
+ request: CommonRequestSchema,
929
+ user: CommonUserSchema
930
+ },
931
+ required: ["meta", "coop", "vars", "request", "user"],
932
+ additionalProperties: true
933
+ };
934
+ const Template$4 = {
935
+ title: cooptypes.Cooperative.Registry.ReturnByAssetStatement.title,
936
+ description: cooptypes.Cooperative.Registry.ReturnByAssetStatement.description,
937
+ model: Schema$4,
938
+ context: cooptypes.Cooperative.Registry.ReturnByAssetStatement.context,
939
+ translations: cooptypes.Cooperative.Registry.ReturnByAssetStatement.translations
940
+ };
941
+
942
+ const ReturnByAssetStatement = {
943
+ __proto__: null,
944
+ Schema: Schema$4,
945
+ Template: Template$4,
946
+ registry_id: registry_id$4
947
+ };
948
+
949
+ const registry_id$3 = cooptypes.Cooperative.Registry.AssetContributionDecision.registry_id;
950
+ const Schema$3 = {
951
+ type: "object",
952
+ properties: {
953
+ meta: IMetaJSONSchema,
954
+ coop: CooperativeSchema,
955
+ vars: VarsSchema,
956
+ request: CommonRequestSchema,
957
+ user: CommonUserSchema,
958
+ decision: decisionSchema
959
+ },
960
+ required: ["meta", "coop", "vars", "request", "user", "decision"],
961
+ additionalProperties: true
962
+ };
963
+ const Template$3 = {
964
+ title: cooptypes.Cooperative.Registry.AssetContributionDecision.title,
965
+ description: cooptypes.Cooperative.Registry.AssetContributionDecision.description,
966
+ model: Schema$3,
967
+ context: cooptypes.Cooperative.Registry.AssetContributionDecision.context,
968
+ translations: cooptypes.Cooperative.Registry.AssetContributionDecision.translations
969
+ };
970
+
971
+ const AssetContributionDecision = {
972
+ __proto__: null,
973
+ Schema: Schema$3,
974
+ Template: Template$3,
975
+ registry_id: registry_id$3
976
+ };
977
+
978
+ const registry_id$2 = cooptypes.Cooperative.Registry.ReturnByAssetDecision.registry_id;
979
+ const Schema$2 = {
980
+ type: "object",
981
+ properties: {
982
+ meta: IMetaJSONSchema,
983
+ coop: CooperativeSchema,
984
+ vars: VarsSchema,
985
+ request: CommonRequestSchema,
986
+ user: CommonUserSchema,
987
+ decision: decisionSchema
988
+ },
989
+ required: ["meta", "coop", "vars", "request", "user", "decision"],
990
+ additionalProperties: true
991
+ };
992
+ const Template$2 = {
993
+ title: cooptypes.Cooperative.Registry.ReturnByAssetDecision.title,
994
+ description: cooptypes.Cooperative.Registry.ReturnByAssetDecision.description,
995
+ model: Schema$2,
996
+ context: cooptypes.Cooperative.Registry.ReturnByAssetDecision.context,
997
+ translations: cooptypes.Cooperative.Registry.ReturnByAssetDecision.translations
998
+ };
999
+
1000
+ const ReturnByAssetDecision = {
1001
+ __proto__: null,
1002
+ Schema: Schema$2,
1003
+ Template: Template$2,
1004
+ registry_id: registry_id$2
1005
+ };
1006
+
1007
+ const FirstLastMiddleNameSchema = {
1008
+ type: "object",
1009
+ properties: {
1010
+ first_name: { type: "string" },
1011
+ last_name: { type: "string" },
1012
+ middle_name: { type: "string" }
1013
+ },
1014
+ required: ["first_name", "last_name", "middle_name"],
1015
+ additionalProperties: true
1016
+ };
1017
+
1018
+ const CommonProgramSchema = {
1019
+ type: "object",
1020
+ properties: {
1021
+ name: { type: "string" }
1022
+ },
1023
+ required: ["name"],
1024
+ additionalProperties: true
1025
+ };
1026
+
1027
+ const registry_id$1 = cooptypes.Cooperative.Registry.AssetContributionAct.registry_id;
1028
+ const Schema$1 = {
1029
+ type: "object",
1030
+ properties: {
1031
+ meta: IMetaJSONSchema,
1032
+ coop: CooperativeSchema,
1033
+ vars: VarsSchema,
1034
+ request: CommonRequestSchema,
1035
+ user: CommonUserSchema,
1036
+ decision: decisionSchema,
1037
+ act_id: { type: "string" },
1038
+ receiver: FirstLastMiddleNameSchema,
1039
+ program: CommonProgramSchema,
1040
+ branch: { ...organizationSchema, nullable: true }
1041
+ },
1042
+ required: ["meta", "coop", "vars", "request", "user", "decision", "act_id", "receiver", "program"],
1043
+ additionalProperties: true
1044
+ };
1045
+ const Template$1 = {
1046
+ title: cooptypes.Cooperative.Registry.AssetContributionAct.title,
1047
+ description: cooptypes.Cooperative.Registry.AssetContributionAct.description,
1048
+ model: Schema$1,
1049
+ context: cooptypes.Cooperative.Registry.AssetContributionAct.context,
1050
+ translations: cooptypes.Cooperative.Registry.AssetContributionAct.translations
1051
+ };
1052
+
1053
+ const AssetContributionAct = {
1054
+ __proto__: null,
1055
+ Schema: Schema$1,
1056
+ Template: Template$1,
1057
+ registry_id: registry_id$1
1058
+ };
1059
+
1060
+ const registry_id = cooptypes.Cooperative.Registry.ReturnByAssetAct.registry_id;
1061
+ const Schema = {
1062
+ type: "object",
1063
+ properties: {
1064
+ meta: IMetaJSONSchema,
1065
+ coop: CooperativeSchema,
1066
+ vars: VarsSchema,
1067
+ request: CommonRequestSchema,
1068
+ user: CommonUserSchema,
1069
+ decision: decisionSchema,
1070
+ act_id: { type: "string" },
1071
+ transmitter: FirstLastMiddleNameSchema,
1072
+ program: CommonProgramSchema,
1073
+ branch: { ...organizationSchema, nullable: true }
1074
+ },
1075
+ required: ["meta", "coop", "vars", "request", "user", "decision", "act_id", "transmitter", "program"],
1076
+ additionalProperties: true
1077
+ };
1078
+ const Template = {
1079
+ title: cooptypes.Cooperative.Registry.ReturnByAssetAct.title,
1080
+ description: cooptypes.Cooperative.Registry.ReturnByAssetAct.description,
1081
+ model: Schema,
1082
+ context: cooptypes.Cooperative.Registry.ReturnByAssetAct.context,
1083
+ translations: cooptypes.Cooperative.Registry.ReturnByAssetAct.translations
1084
+ };
1085
+
1086
+ const ReturnByAssetAct = {
846
1087
  __proto__: null,
847
1088
  Schema: Schema,
848
1089
  Template: Template,
@@ -859,7 +1100,13 @@ const Registry = {
859
1100
  101: SelectBranchStatement,
860
1101
  501: DecisionOfParticipantApplication,
861
1102
  599: ProjectFreeDecision,
862
- 600: FreeDecision
1103
+ 600: FreeDecision,
1104
+ 700: AssetContributionStatement,
1105
+ 701: AssetContributionDecision,
1106
+ 702: AssetContributionAct,
1107
+ 800: ReturnByAssetStatement,
1108
+ 801: ReturnByAssetDecision,
1109
+ 802: ReturnByAssetAct
863
1110
  };
864
1111
 
865
1112
  var __defProp$c = Object.defineProperty;
@@ -1480,7 +1727,7 @@ class PDFService {
1480
1727
 
1481
1728
  const name = "@coopenomics/factory";
1482
1729
  const type = "module";
1483
- const version = "2.2.5";
1730
+ const version = "2.2.7";
1484
1731
  const packageManager = "pnpm@9.0.6";
1485
1732
  const description = "";
1486
1733
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
@@ -1529,7 +1776,7 @@ const dependencies = {
1529
1776
  "ajv-formats": "^3.0.1",
1530
1777
  "ajv-i18n": "^4.2.0",
1531
1778
  axios: "^1.7.2",
1532
- cooptypes: "2.2.5",
1779
+ cooptypes: "2.2.7",
1533
1780
  dotenv: "^16.4.5",
1534
1781
  "eosjs-ecc": "^4.0.7",
1535
1782
  handlebars: "^4.7.8",
@@ -1571,7 +1818,7 @@ const pnpm = {
1571
1818
  "vite@>=5.1.0 <=5.1.6": ">=5.1.7"
1572
1819
  }
1573
1820
  };
1574
- const gitHead = "97b21a9d69b6c387a1a7f2c32642d29c0898694e";
1821
+ const gitHead = "3be56ba462561e4dd9e7225bb95b254b20f89042";
1575
1822
  const packageJson = {
1576
1823
  name: name,
1577
1824
  type: type,
@@ -1676,6 +1923,24 @@ class DocFactory {
1676
1923
  throw new Error("\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B");
1677
1924
  return vars;
1678
1925
  }
1926
+ async getRequest(_request_id, _block_num) {
1927
+ return {
1928
+ hash: "1234567890",
1929
+ title: "\u041C\u043E\u043B\u043E\u043A\u043E \u0411\u0443\u0440\u0451\u043D\u043A\u0430",
1930
+ unit_of_measurement: "\u043B\u0438\u0442\u0440\u044B",
1931
+ units: 100,
1932
+ unit_cost: "1000",
1933
+ total_cost: "100000",
1934
+ currency: "RUB",
1935
+ type: "receive",
1936
+ program_id: 1
1937
+ };
1938
+ }
1939
+ async getProgram(_program_id) {
1940
+ return {
1941
+ name: "\u0421\u041E\u0421\u0415\u0414\u0418"
1942
+ };
1943
+ }
1679
1944
  async getDecision(coop, coopname, decision_id, created_at) {
1680
1945
  const votes_for_actions = (await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-actions`, new URLSearchParams({
1681
1946
  filter: JSON.stringify({
@@ -1782,6 +2047,28 @@ class DocFactory {
1782
2047
  }
1783
2048
  return "";
1784
2049
  }
2050
+ getFullParticipantName(data) {
2051
+ if ("first_name" in data) {
2052
+ return `${data.last_name} ${data.first_name} ${data.middle_name}`;
2053
+ } else if ("short_name" in data) {
2054
+ return data.short_name;
2055
+ }
2056
+ return "";
2057
+ }
2058
+ getFirstLastMiddleName(data) {
2059
+ return {
2060
+ first_name: "first_name" in data ? data.first_name : "",
2061
+ last_name: "last_name" in data ? data.last_name : "",
2062
+ middle_name: "middle_name" in data ? data.middle_name : ""
2063
+ };
2064
+ }
2065
+ getCommonUser(data) {
2066
+ return {
2067
+ full_name_or_short_name: this.getFullParticipantName(data),
2068
+ // or_short_name
2069
+ birthdate_or_ogrn: "birthdate" in data ? data.birthdate : "details" in data ? data.details.ogrn : ""
2070
+ };
2071
+ }
1785
2072
  async saveDraft(document) {
1786
2073
  await this.storage.saveDraft(document);
1787
2074
  }
@@ -1829,16 +2116,16 @@ class DocFactory {
1829
2116
  }
1830
2117
  }
1831
2118
 
1832
- let Factory$9 = class Factory extends DocFactory {
2119
+ let Factory$f = class Factory extends DocFactory {
1833
2120
  constructor(storage) {
1834
2121
  super(storage);
1835
2122
  }
1836
2123
  async generateDocument(data, options) {
1837
2124
  let template;
1838
2125
  if (process.env.SOURCE === "local") {
1839
- template = Template$9;
2126
+ template = Template$f;
1840
2127
  } else {
1841
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$9, data.block_num);
2128
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$f, data.block_num);
1842
2129
  }
1843
2130
  const meta = await super.getMeta({ title: template.title, ...data });
1844
2131
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -1856,16 +2143,16 @@ let Factory$9 = class Factory extends DocFactory {
1856
2143
  }
1857
2144
  };
1858
2145
 
1859
- let Factory$8 = class Factory extends DocFactory {
2146
+ let Factory$e = class Factory extends DocFactory {
1860
2147
  constructor(storage) {
1861
2148
  super(storage);
1862
2149
  }
1863
2150
  async generateDocument(data, options) {
1864
2151
  let template;
1865
2152
  if (process.env.SOURCE === "local") {
1866
- template = Template$8;
2153
+ template = Template$e;
1867
2154
  } else {
1868
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$8, data.block_num);
2155
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$e, data.block_num);
1869
2156
  }
1870
2157
  const meta = await super.getMeta({ title: template.title, ...data });
1871
2158
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -1883,16 +2170,16 @@ let Factory$8 = class Factory extends DocFactory {
1883
2170
  }
1884
2171
  };
1885
2172
 
1886
- let Factory$7 = class Factory extends DocFactory {
2173
+ let Factory$d = class Factory extends DocFactory {
1887
2174
  constructor(storage) {
1888
2175
  super(storage);
1889
2176
  }
1890
2177
  async generateDocument(data, options) {
1891
2178
  let template;
1892
2179
  if (process.env.SOURCE === "local") {
1893
- template = Template$7;
2180
+ template = Template$d;
1894
2181
  } else {
1895
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$7, data.block_num);
2182
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$d, data.block_num);
1896
2183
  }
1897
2184
  const meta = await super.getMeta({ title: template.title, ...data });
1898
2185
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -1910,16 +2197,16 @@ let Factory$7 = class Factory extends DocFactory {
1910
2197
  }
1911
2198
  };
1912
2199
 
1913
- let Factory$6 = class Factory extends DocFactory {
2200
+ let Factory$c = class Factory extends DocFactory {
1914
2201
  constructor(storage) {
1915
2202
  super(storage);
1916
2203
  }
1917
2204
  async generateDocument(data, options) {
1918
2205
  let template;
1919
2206
  if (process.env.SOURCE === "local") {
1920
- template = Template$6;
2207
+ template = Template$c;
1921
2208
  } else {
1922
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$6, data.block_num);
2209
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$c, data.block_num);
1923
2210
  }
1924
2211
  const meta = await super.getMeta({ title: template.title, ...data });
1925
2212
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -1941,16 +2228,16 @@ let Factory$6 = class Factory extends DocFactory {
1941
2228
  }
1942
2229
  };
1943
2230
 
1944
- let Factory$5 = class Factory extends DocFactory {
2231
+ let Factory$b = class Factory extends DocFactory {
1945
2232
  constructor(storage) {
1946
2233
  super(storage);
1947
2234
  }
1948
2235
  async generateDocument(data, options) {
1949
2236
  let template;
1950
2237
  if (process.env.SOURCE === "local") {
1951
- template = Template$5;
2238
+ template = Template$b;
1952
2239
  } else {
1953
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$5, data.block_num);
2240
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$b, data.block_num);
1954
2241
  }
1955
2242
  const meta = await super.getMeta({ title: template.title, ...data });
1956
2243
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -1970,16 +2257,16 @@ let Factory$5 = class Factory extends DocFactory {
1970
2257
  }
1971
2258
  };
1972
2259
 
1973
- let Factory$4 = class Factory extends DocFactory {
2260
+ let Factory$a = class Factory extends DocFactory {
1974
2261
  constructor(storage) {
1975
2262
  super(storage);
1976
2263
  }
1977
2264
  async generateDocument(data, _options) {
1978
2265
  let template;
1979
2266
  if (process.env.SOURCE === "local") {
1980
- template = Template$2;
2267
+ template = Template$8;
1981
2268
  } else {
1982
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$2, data.block_num);
2269
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$8, data.block_num);
1983
2270
  }
1984
2271
  const user = await super.getUser(data.username, data.block_num);
1985
2272
  const userData = {
@@ -2001,16 +2288,16 @@ let Factory$4 = class Factory extends DocFactory {
2001
2288
  }
2002
2289
  };
2003
2290
 
2004
- let Factory$3 = class Factory extends DocFactory {
2291
+ let Factory$9 = class Factory extends DocFactory {
2005
2292
  constructor(storage) {
2006
2293
  super(storage);
2007
2294
  }
2008
2295
  async generateDocument(data, _options) {
2009
2296
  let template;
2010
2297
  if (process.env.SOURCE === "local") {
2011
- template = Template$4;
2298
+ template = Template$a;
2012
2299
  } else {
2013
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$4, data.block_num);
2300
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$a, data.block_num);
2014
2301
  }
2015
2302
  const user = await super.getUser(data.username, data.block_num);
2016
2303
  let bank_account = {};
@@ -2023,6 +2310,8 @@ let Factory$3 = class Factory extends DocFactory {
2023
2310
  }
2024
2311
  };
2025
2312
  const coop = await super.getCooperative(data.coopname, data.block_num);
2313
+ const coop_bank_account = await super.getBankAccount(data.coopname, data.block_num);
2314
+ const extended_coop = { ...coop, bank_account: coop_bank_account };
2026
2315
  if (coop.is_branched && !data.braname)
2027
2316
  throw new Error("\u041A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u043D\u044B\u0439 \u0443\u0447\u0430\u0441\u0442\u043E\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0443\u043A\u0430\u0437\u0430\u043D");
2028
2317
  let branch;
@@ -2050,7 +2339,7 @@ let Factory$3 = class Factory extends DocFactory {
2050
2339
  }
2051
2340
  }
2052
2341
  const vars = await super.getVars(data.coopname, data.block_num);
2053
- const combinedData = { ...userData, meta, coop, branch, type: user.type, vars, signature };
2342
+ const combinedData = { ...userData, meta, coop: extended_coop, branch, type: user.type, vars, signature };
2054
2343
  await super.validate(combinedData, template.model);
2055
2344
  const translation = template.translations[meta.lang];
2056
2345
  const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, data.skip_save);
@@ -2058,22 +2347,23 @@ let Factory$3 = class Factory extends DocFactory {
2058
2347
  }
2059
2348
  };
2060
2349
 
2061
- let Factory$2 = class Factory extends DocFactory {
2350
+ let Factory$8 = class Factory extends DocFactory {
2062
2351
  constructor(storage) {
2063
2352
  super(storage);
2064
2353
  }
2065
2354
  async generateDocument(data, options) {
2066
2355
  let template;
2067
2356
  if (process.env.SOURCE === "local") {
2068
- template = Template$3;
2357
+ template = Template$9;
2069
2358
  } else {
2070
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$3, data.block_num);
2359
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$9, data.block_num);
2071
2360
  }
2072
2361
  const user = await super.getUser(data.username, data.block_num);
2073
2362
  const userData = {
2074
2363
  [user.type]: user.data
2075
2364
  };
2076
2365
  const coop = await super.getCooperative(data.coopname, data.block_num);
2366
+ const vars = await super.getVars(data.coopname, data.block_num);
2077
2367
  const meta = await super.getMeta({
2078
2368
  title: template.title,
2079
2369
  ...data
@@ -2086,6 +2376,7 @@ let Factory$2 = class Factory extends DocFactory {
2086
2376
  );
2087
2377
  const combinedData = {
2088
2378
  ...userData,
2379
+ vars,
2089
2380
  meta,
2090
2381
  coop,
2091
2382
  type: user.type,
@@ -2105,16 +2396,16 @@ let Factory$2 = class Factory extends DocFactory {
2105
2396
  }
2106
2397
  };
2107
2398
 
2108
- let Factory$1 = class Factory extends DocFactory {
2399
+ let Factory$7 = class Factory extends DocFactory {
2109
2400
  constructor(storage) {
2110
2401
  super(storage);
2111
2402
  }
2112
2403
  async generateDocument(data, options) {
2113
2404
  let template;
2114
2405
  if (process.env.SOURCE === "local") {
2115
- template = Template$1;
2406
+ template = Template$7;
2116
2407
  } else {
2117
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$1, data.block_num);
2408
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$7, data.block_num);
2118
2409
  }
2119
2410
  const user = await this.getUser(data.username, data.block_num);
2120
2411
  const suggester_name = await this.getFullName(user.data);
@@ -2150,16 +2441,16 @@ let Factory$1 = class Factory extends DocFactory {
2150
2441
  }
2151
2442
  };
2152
2443
 
2153
- class Factory extends DocFactory {
2444
+ let Factory$6 = class Factory extends DocFactory {
2154
2445
  constructor(storage) {
2155
2446
  super(storage);
2156
2447
  }
2157
2448
  async generateDocument(data, options) {
2158
2449
  let template;
2159
2450
  if (process.env.SOURCE === "local") {
2160
- template = Template;
2451
+ template = Template$6;
2161
2452
  } else {
2162
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id, data.block_num);
2453
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$6, data.block_num);
2163
2454
  }
2164
2455
  const user = await this.getUser(data.username, data.block_num);
2165
2456
  const userData = {
@@ -2179,13 +2470,14 @@ class Factory extends DocFactory {
2179
2470
  if (!data.project_id)
2180
2471
  throw new Error("\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D");
2181
2472
  const project = await this.getProject(data.project_id, data.block_num);
2182
- console.log("project: ", project, data);
2473
+ const vars = await super.getVars(data.coopname, data.block_num);
2183
2474
  const combinedData = {
2184
2475
  ...userData,
2185
2476
  meta,
2186
2477
  coop,
2187
2478
  decision,
2188
- project
2479
+ project,
2480
+ vars
2189
2481
  };
2190
2482
  await this.validate(combinedData, template.model);
2191
2483
  const translation = template.translations[meta.lang];
@@ -2199,6 +2491,222 @@ class Factory extends DocFactory {
2199
2491
  );
2200
2492
  return document;
2201
2493
  }
2494
+ };
2495
+
2496
+ let Factory$5 = class Factory extends DocFactory {
2497
+ constructor(storage) {
2498
+ super(storage);
2499
+ }
2500
+ async generateDocument(data, options) {
2501
+ let template;
2502
+ if (process.env.SOURCE === "local") {
2503
+ template = Template$5;
2504
+ } else {
2505
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$5, data.block_num);
2506
+ }
2507
+ const meta = await super.getMeta({ title: template.title, ...data });
2508
+ const coop = await super.getCooperative(data.coopname, data.block_num);
2509
+ const vars = await super.getVars(data.coopname, data.block_num);
2510
+ const user = await super.getUser(data.username, data.block_num);
2511
+ const request = data.request;
2512
+ const commonUser = this.getCommonUser(user.data);
2513
+ const combinedData = {
2514
+ meta,
2515
+ coop,
2516
+ vars,
2517
+ user: commonUser,
2518
+ request
2519
+ };
2520
+ await super.validate(combinedData, template.model);
2521
+ const translation = template.translations[meta.lang];
2522
+ const document = await super.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
2523
+ return document;
2524
+ }
2525
+ };
2526
+
2527
+ let Factory$4 = class Factory extends DocFactory {
2528
+ constructor(storage) {
2529
+ super(storage);
2530
+ }
2531
+ async generateDocument(data, options) {
2532
+ let template;
2533
+ if (process.env.SOURCE === "local") {
2534
+ template = Template$4;
2535
+ } else {
2536
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$4, data.block_num);
2537
+ }
2538
+ const meta = await this.getMeta({ title: template.title, ...data });
2539
+ const coop = await this.getCooperative(data.coopname, data.block_num);
2540
+ const vars = await this.getVars(data.coopname, data.block_num);
2541
+ const user = await this.getUser(data.username, data.block_num);
2542
+ const request = data.request;
2543
+ const commonUser = this.getCommonUser(user.data);
2544
+ const combinedData = {
2545
+ meta,
2546
+ coop,
2547
+ vars,
2548
+ user: commonUser,
2549
+ request
2550
+ };
2551
+ await this.validate(combinedData, template.model);
2552
+ const translation = template.translations[meta.lang];
2553
+ const document = await super.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
2554
+ return document;
2555
+ }
2556
+ };
2557
+
2558
+ let Factory$3 = class Factory extends DocFactory {
2559
+ constructor(storage) {
2560
+ super(storage);
2561
+ }
2562
+ async generateDocument(data, options) {
2563
+ let template;
2564
+ if (process.env.SOURCE === "local") {
2565
+ template = Template$3;
2566
+ } else {
2567
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$3, data.block_num);
2568
+ }
2569
+ const meta = await this.getMeta({ title: template.title, ...data });
2570
+ const coop = await this.getCooperative(data.coopname, data.block_num);
2571
+ const vars = await this.getVars(data.coopname, data.block_num);
2572
+ const user = await this.getUser(data.username, data.block_num);
2573
+ const request = await this.getRequest(data.request_id, data.block_num);
2574
+ const decision = await this.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
2575
+ const commonUser = this.getCommonUser(user.data);
2576
+ const combinedData = {
2577
+ meta,
2578
+ coop,
2579
+ vars,
2580
+ user: commonUser,
2581
+ request,
2582
+ decision
2583
+ };
2584
+ await this.validate(combinedData, template.model);
2585
+ const translation = template.translations[meta.lang];
2586
+ const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
2587
+ return document;
2588
+ }
2589
+ };
2590
+
2591
+ let Factory$2 = class Factory extends DocFactory {
2592
+ constructor(storage) {
2593
+ super(storage);
2594
+ }
2595
+ async generateDocument(data, options) {
2596
+ let template;
2597
+ if (process.env.SOURCE === "local") {
2598
+ template = Template$1;
2599
+ } else {
2600
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$1, data.block_num);
2601
+ }
2602
+ const meta = await this.getMeta({ title: template.title, ...data });
2603
+ const coop = await this.getCooperative(data.coopname, data.block_num);
2604
+ const vars = await this.getVars(data.coopname, data.block_num);
2605
+ const user = await this.getUser(data.username, data.block_num);
2606
+ const request = await this.getRequest(data.request_id, data.block_num);
2607
+ const decision = await this.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
2608
+ const commonUser = this.getCommonUser(user.data);
2609
+ const receiver = await this.getUser(data.receiver, data.block_num);
2610
+ if (coop.is_branched && !data.braname)
2611
+ throw new Error("Branch name is required");
2612
+ let branch;
2613
+ if (data.braname)
2614
+ branch = await this.getOrganization(data.braname, data.block_num);
2615
+ const program = await this.getProgram(request.program_id);
2616
+ const combinedData = {
2617
+ meta,
2618
+ coop,
2619
+ vars,
2620
+ user: commonUser,
2621
+ request,
2622
+ decision,
2623
+ program,
2624
+ act_id: data.act_id,
2625
+ receiver: this.getFirstLastMiddleName(receiver.data),
2626
+ branch
2627
+ };
2628
+ await this.validate(combinedData, template.model);
2629
+ const translation = template.translations[meta.lang];
2630
+ const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
2631
+ return document;
2632
+ }
2633
+ };
2634
+
2635
+ let Factory$1 = class Factory extends DocFactory {
2636
+ constructor(storage) {
2637
+ super(storage);
2638
+ }
2639
+ async generateDocument(data, options) {
2640
+ let template;
2641
+ if (process.env.SOURCE === "local") {
2642
+ template = Template$2;
2643
+ } else {
2644
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$2, data.block_num);
2645
+ }
2646
+ const meta = await this.getMeta({ title: template.title, ...data });
2647
+ const coop = await this.getCooperative(data.coopname, data.block_num);
2648
+ const vars = await this.getVars(data.coopname, data.block_num);
2649
+ const user = await this.getUser(data.username, data.block_num);
2650
+ const request = await this.getRequest(data.request_id, data.block_num);
2651
+ const decision = await this.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
2652
+ const commonUser = this.getCommonUser(user.data);
2653
+ const combinedData = {
2654
+ meta,
2655
+ coop,
2656
+ vars,
2657
+ user: commonUser,
2658
+ request,
2659
+ decision
2660
+ };
2661
+ await this.validate(combinedData, template.model);
2662
+ const translation = template.translations[meta.lang];
2663
+ const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
2664
+ return document;
2665
+ }
2666
+ };
2667
+
2668
+ class Factory extends DocFactory {
2669
+ constructor(storage) {
2670
+ super(storage);
2671
+ }
2672
+ async generateDocument(data, options) {
2673
+ let template;
2674
+ if (process.env.SOURCE === "local") {
2675
+ template = Template;
2676
+ } else {
2677
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id, data.block_num);
2678
+ }
2679
+ const meta = await this.getMeta({ title: template.title, ...data });
2680
+ const coop = await this.getCooperative(data.coopname, data.block_num);
2681
+ const vars = await this.getVars(data.coopname, data.block_num);
2682
+ const user = await this.getUser(data.username, data.block_num);
2683
+ const request = await this.getRequest(data.request_id, data.block_num);
2684
+ const decision = await this.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
2685
+ const commonUser = this.getCommonUser(user.data);
2686
+ const transmitter = await this.getUser(data.transmitter, data.block_num);
2687
+ if (coop.is_branched && !data.braname)
2688
+ throw new Error("Branch name is required");
2689
+ let branch;
2690
+ if (data.braname)
2691
+ branch = await this.getOrganization(data.braname, data.block_num);
2692
+ const program = await this.getProgram(request.program_id);
2693
+ const combinedData = {
2694
+ meta,
2695
+ coop,
2696
+ vars,
2697
+ user: commonUser,
2698
+ request,
2699
+ decision,
2700
+ program,
2701
+ act_id: data.act_id,
2702
+ transmitter: this.getFirstLastMiddleName(transmitter.data),
2703
+ branch
2704
+ };
2705
+ await this.validate(combinedData, template.model);
2706
+ const translation = template.translations[meta.lang];
2707
+ const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
2708
+ return document;
2709
+ }
2202
2710
  }
2203
2711
 
2204
2712
  var __defProp$1 = Object.defineProperty;
@@ -2263,26 +2771,38 @@ class Generator {
2263
2771
  async connect(mongoUri) {
2264
2772
  this.storage = new MongoDBConnector(mongoUri);
2265
2773
  this.factories = {
2266
- [registry_id$9]: new Factory$9(this.storage),
2774
+ [registry_id$f]: new Factory$f(this.storage),
2267
2775
  // 1
2268
- [registry_id$8]: new Factory$8(this.storage),
2776
+ [registry_id$e]: new Factory$e(this.storage),
2269
2777
  // 2
2270
- [registry_id$7]: new Factory$7(this.storage),
2778
+ [registry_id$d]: new Factory$d(this.storage),
2271
2779
  // 3
2272
- [registry_id$6]: new Factory$6(this.storage),
2780
+ [registry_id$c]: new Factory$c(this.storage),
2273
2781
  // 4
2274
- [registry_id$5]: new Factory$5(this.storage),
2782
+ [registry_id$b]: new Factory$b(this.storage),
2275
2783
  // 50
2276
- [registry_id$4]: new Factory$3(this.storage),
2784
+ [registry_id$a]: new Factory$9(this.storage),
2277
2785
  // 100
2278
- [registry_id$2]: new Factory$4(this.storage),
2786
+ [registry_id$8]: new Factory$a(this.storage),
2279
2787
  // 101
2280
- [registry_id$3]: new Factory$2(this.storage),
2788
+ [registry_id$9]: new Factory$8(this.storage),
2281
2789
  // 501
2282
- [registry_id$1]: new Factory$1(this.storage),
2790
+ [registry_id$7]: new Factory$7(this.storage),
2283
2791
  // 599
2284
- [registry_id]: new Factory(this.storage)
2792
+ [registry_id$6]: new Factory$6(this.storage),
2285
2793
  // 600
2794
+ [registry_id$5]: new Factory$5(this.storage),
2795
+ // 700
2796
+ [registry_id$4]: new Factory$4(this.storage),
2797
+ // 800
2798
+ [registry_id$2]: new Factory$1(this.storage),
2799
+ // 801
2800
+ [registry_id]: new Factory(this.storage),
2801
+ // 802
2802
+ [registry_id$3]: new Factory$3(this.storage),
2803
+ // 701
2804
+ [registry_id$1]: new Factory$2(this.storage)
2805
+ // 702
2286
2806
  };
2287
2807
  await this.storage.connect();
2288
2808
  }
@@ -2347,6 +2867,9 @@ class Generator {
2347
2867
  }
2348
2868
  }
2349
2869
 
2870
+ exports.AssetContributionAct = AssetContributionAct;
2871
+ exports.AssetContributionDecision = AssetContributionDecision;
2872
+ exports.AssetContributionStatement = AssetContributionStatement;
2350
2873
  exports.BankAccountSchema = BankAccountSchema;
2351
2874
  exports.CoopenomicsAgreement = CoopenomicsAgreement;
2352
2875
  exports.CooperativeSchema = CooperativeSchema;
@@ -2358,6 +2881,9 @@ exports.PrivacyPolicy = PrivacyPolicy;
2358
2881
  exports.ProjectFreeDecision = ProjectFreeDecision;
2359
2882
  exports.Registry = Registry;
2360
2883
  exports.RegulationElectronicSignature = RegulationElectronicSignaturet;
2884
+ exports.ReturnByAssetAct = ReturnByAssetAct;
2885
+ exports.ReturnByAssetDecision = ReturnByAssetDecision;
2886
+ exports.ReturnByAssetStatement = ReturnByAssetStatement;
2361
2887
  exports.SelectBranchStatement = SelectBranchStatement;
2362
2888
  exports.UserAgreement = UserAgreement;
2363
2889
  exports.VarsSchema = VarsSchema;