@coopenomics/factory 2025.12.2-alpha-3 → 2026.2.21-1

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
@@ -266,9 +266,15 @@ const CooperativeSchema = {
266
266
  type: "array",
267
267
  items: memberSchema
268
268
  },
269
+ defaultBankAccount: {
270
+ type: "object",
271
+ properties: BankAccountSchema.properties,
272
+ required: BankAccountSchema.required,
273
+ additionalProperties: false
274
+ },
269
275
  ...organizationSchema.properties
270
276
  },
271
- required: [...organizationSchema.required, "is_branched", "registration", "initial", "minimum", "org_registration", "org_initial", "org_minimum", "members", "totalMembers", "chairman"],
277
+ required: [...organizationSchema.required, "is_branched", "registration", "initial", "minimum", "org_registration", "org_initial", "org_minimum", "members", "totalMembers", "chairman", "defaultBankAccount"],
272
278
  additionalProperties: true
273
279
  };
274
280
 
@@ -290,6 +296,7 @@ const VarsSchema = {
290
296
  passport_request: { type: "string" },
291
297
  wallet_agreement: {
292
298
  type: "object",
299
+ nullable: true,
293
300
  properties: {
294
301
  protocol_number: { type: "string" },
295
302
  protocol_day_month_year: { type: "string" }
@@ -299,6 +306,7 @@ const VarsSchema = {
299
306
  },
300
307
  privacy_agreement: {
301
308
  type: "object",
309
+ nullable: true,
302
310
  properties: {
303
311
  protocol_number: { type: "string" },
304
312
  protocol_day_month_year: { type: "string" }
@@ -308,6 +316,7 @@ const VarsSchema = {
308
316
  },
309
317
  signature_agreement: {
310
318
  type: "object",
319
+ nullable: true,
311
320
  properties: {
312
321
  protocol_number: { type: "string" },
313
322
  protocol_day_month_year: { type: "string" }
@@ -317,6 +326,7 @@ const VarsSchema = {
317
326
  },
318
327
  user_agreement: {
319
328
  type: "object",
329
+ nullable: true,
320
330
  properties: {
321
331
  protocol_number: { type: "string" },
322
332
  protocol_day_month_year: { type: "string" }
@@ -326,6 +336,7 @@ const VarsSchema = {
326
336
  },
327
337
  participant_application: {
328
338
  type: "object",
339
+ nullable: true,
329
340
  properties: {
330
341
  protocol_number: { type: "string" },
331
342
  protocol_day_month_year: { type: "string" }
@@ -343,17 +354,55 @@ const VarsSchema = {
343
354
  additionalProperties: true,
344
355
  nullable: true
345
356
  },
346
- investment_agreement: {
357
+ generation_contract_template: {
347
358
  type: "object",
348
359
  properties: {
349
360
  protocol_number: { type: "string" },
350
- protocol_day_month_year: { type: "string" },
351
- subject: { type: "string" },
352
- terms: { type: "string" }
361
+ protocol_day_month_year: { type: "string" }
353
362
  },
354
363
  required: ["protocol_day_month_year", "protocol_number"],
355
364
  additionalProperties: true,
356
365
  nullable: true
366
+ },
367
+ blagorost_program: {
368
+ type: "object",
369
+ nullable: true,
370
+ properties: {
371
+ protocol_number: { type: "string" },
372
+ protocol_day_month_year: { type: "string" }
373
+ },
374
+ required: ["protocol_number", "protocol_day_month_year"],
375
+ additionalProperties: true
376
+ },
377
+ blagorost_offer_template: {
378
+ type: "object",
379
+ nullable: true,
380
+ properties: {
381
+ protocol_number: { type: "string" },
382
+ protocol_day_month_year: { type: "string" }
383
+ },
384
+ required: ["protocol_number", "protocol_day_month_year"],
385
+ additionalProperties: true
386
+ },
387
+ generator_program: {
388
+ type: "object",
389
+ nullable: true,
390
+ properties: {
391
+ protocol_number: { type: "string" },
392
+ protocol_day_month_year: { type: "string" }
393
+ },
394
+ required: ["protocol_number", "protocol_day_month_year"],
395
+ additionalProperties: true
396
+ },
397
+ generator_offer_template: {
398
+ type: "object",
399
+ nullable: true,
400
+ properties: {
401
+ protocol_number: { type: "string" },
402
+ protocol_day_month_year: { type: "string" }
403
+ },
404
+ required: ["protocol_number", "protocol_day_month_year"],
405
+ additionalProperties: true
357
406
  }
358
407
  },
359
408
  required: [
@@ -369,11 +418,18 @@ const VarsSchema = {
369
418
  "name",
370
419
  "confidential_link",
371
420
  "confidential_email",
372
- "contact_email",
373
- "wallet_agreement",
374
- "privacy_agreement",
375
- "signature_agreement",
376
- "user_agreement"
421
+ "contact_email"
422
+ // 'wallet_agreement', //not_required
423
+ // 'signature_agreement', //not_required
424
+ // 'privacy_agreement', //not_required
425
+ // 'user_agreement', //not_required
426
+ // 'participant_application', //not_required
427
+ // 'coopenomics_agreement', //not_required
428
+ // 'generation_contract_template', //not_required
429
+ // 'blagorost_program', //not_required
430
+ // 'blagorost_offer_template', //not_required
431
+ // 'generator_program', //not_required
432
+ // 'generator_offer_template', //not_required
377
433
  ],
378
434
  additionalProperties: true
379
435
  };
@@ -625,9 +681,11 @@ const CommonUserSchema = {
625
681
  properties: {
626
682
  full_name_or_short_name: { type: "string" },
627
683
  birthdate_or_ogrn: { type: "string" },
628
- abbr_full_name: { type: "string" }
684
+ abbr_full_name: { type: "string" },
685
+ email: { type: "string" },
686
+ phone: { type: "string" }
629
687
  },
630
- required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name"],
688
+ required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name", "email", "phone"],
631
689
  additionalProperties: true
632
690
  };
633
691
 
@@ -657,8 +715,23 @@ const AgendaQuestionSchema = {
657
715
  additionalProperties: true
658
716
  };
659
717
 
660
- const registry_id$L = cooptypes.Cooperative.Registry.WalletAgreement.registry_id;
661
- const Schema$L = {
718
+ const udataSchema = {
719
+ type: "object",
720
+ properties: {
721
+ coopname: { type: "string" },
722
+ username: { type: "string" },
723
+ key: { type: "string" },
724
+ value: { type: "string" },
725
+ metadata: { type: "object", nullable: true },
726
+ deleted: { type: "boolean", nullable: true },
727
+ block_num: { type: "number", nullable: true }
728
+ },
729
+ required: ["coopname", "username", "key", "value"],
730
+ additionalProperties: true
731
+ };
732
+
733
+ const registry_id$W = cooptypes.Cooperative.Registry.WalletAgreement.registry_id;
734
+ const Schema$W = {
662
735
  type: "object",
663
736
  properties: {
664
737
  meta: IMetaJSONSchema,
@@ -668,23 +741,23 @@ const Schema$L = {
668
741
  required: ["meta", "coop", "vars"],
669
742
  additionalProperties: true
670
743
  };
671
- const Template$L = {
744
+ const Template$W = {
672
745
  title: cooptypes.Cooperative.Registry.WalletAgreement.title,
673
746
  description: cooptypes.Cooperative.Registry.WalletAgreement.description,
674
- model: Schema$L,
747
+ model: Schema$W,
675
748
  context: cooptypes.Cooperative.Registry.WalletAgreement.context,
676
749
  translations: cooptypes.Cooperative.Registry.WalletAgreement.translations
677
750
  };
678
751
 
679
752
  const WalletAgreement = {
680
753
  __proto__: null,
681
- Schema: Schema$L,
682
- Template: Template$L,
683
- registry_id: registry_id$L
754
+ Schema: Schema$W,
755
+ Template: Template$W,
756
+ registry_id: registry_id$W
684
757
  };
685
758
 
686
- const registry_id$K = cooptypes.Cooperative.Registry.RegulationElectronicSignature.registry_id;
687
- const Schema$K = {
759
+ const registry_id$V = cooptypes.Cooperative.Registry.RegulationElectronicSignature.registry_id;
760
+ const Schema$V = {
688
761
  type: "object",
689
762
  properties: {
690
763
  meta: IMetaJSONSchema,
@@ -694,23 +767,23 @@ const Schema$K = {
694
767
  required: ["meta", "coop", "vars"],
695
768
  additionalProperties: true
696
769
  };
697
- const Template$K = {
770
+ const Template$V = {
698
771
  title: cooptypes.Cooperative.Registry.RegulationElectronicSignature.title,
699
772
  description: cooptypes.Cooperative.Registry.RegulationElectronicSignature.description,
700
- model: Schema$K,
773
+ model: Schema$V,
701
774
  context: cooptypes.Cooperative.Registry.RegulationElectronicSignature.context,
702
775
  translations: cooptypes.Cooperative.Registry.RegulationElectronicSignature.translations
703
776
  };
704
777
 
705
778
  const RegulationElectronicSignaturet = {
706
779
  __proto__: null,
707
- Schema: Schema$K,
708
- Template: Template$K,
709
- registry_id: registry_id$K
780
+ Schema: Schema$V,
781
+ Template: Template$V,
782
+ registry_id: registry_id$V
710
783
  };
711
784
 
712
- const registry_id$J = cooptypes.Cooperative.Registry.PrivacyPolicy.registry_id;
713
- const Schema$J = {
785
+ const registry_id$U = cooptypes.Cooperative.Registry.PrivacyPolicy.registry_id;
786
+ const Schema$U = {
714
787
  type: "object",
715
788
  properties: {
716
789
  meta: IMetaJSONSchema,
@@ -720,23 +793,23 @@ const Schema$J = {
720
793
  required: ["meta", "coop", "vars"],
721
794
  additionalProperties: true
722
795
  };
723
- const Template$J = {
796
+ const Template$U = {
724
797
  title: cooptypes.Cooperative.Registry.PrivacyPolicy.title,
725
798
  description: cooptypes.Cooperative.Registry.PrivacyPolicy.description,
726
- model: Schema$J,
799
+ model: Schema$U,
727
800
  context: cooptypes.Cooperative.Registry.PrivacyPolicy.context,
728
801
  translations: cooptypes.Cooperative.Registry.PrivacyPolicy.translations
729
802
  };
730
803
 
731
804
  const PrivacyPolicy = {
732
805
  __proto__: null,
733
- Schema: Schema$J,
734
- Template: Template$J,
735
- registry_id: registry_id$J
806
+ Schema: Schema$U,
807
+ Template: Template$U,
808
+ registry_id: registry_id$U
736
809
  };
737
810
 
738
- const registry_id$I = cooptypes.Cooperative.Registry.UserAgreement.registry_id;
739
- const Schema$I = {
811
+ const registry_id$T = cooptypes.Cooperative.Registry.UserAgreement.registry_id;
812
+ const Schema$T = {
740
813
  type: "object",
741
814
  properties: {
742
815
  meta: IMetaJSONSchema,
@@ -753,23 +826,23 @@ const Schema$I = {
753
826
  required: ["meta", "coop", "vars", "user"],
754
827
  additionalProperties: true
755
828
  };
756
- const Template$I = {
829
+ const Template$T = {
757
830
  title: cooptypes.Cooperative.Registry.UserAgreement.title,
758
831
  description: cooptypes.Cooperative.Registry.UserAgreement.description,
759
- model: Schema$I,
832
+ model: Schema$T,
760
833
  context: cooptypes.Cooperative.Registry.UserAgreement.context,
761
834
  translations: cooptypes.Cooperative.Registry.UserAgreement.translations
762
835
  };
763
836
 
764
837
  const UserAgreement = {
765
838
  __proto__: null,
766
- Schema: Schema$I,
767
- Template: Template$I,
768
- registry_id: registry_id$I
839
+ Schema: Schema$T,
840
+ Template: Template$T,
841
+ registry_id: registry_id$T
769
842
  };
770
843
 
771
- const registry_id$H = cooptypes.Cooperative.Registry.CoopenomicsAgreement.registry_id;
772
- const Schema$H = {
844
+ const registry_id$S = cooptypes.Cooperative.Registry.CoopenomicsAgreement.registry_id;
845
+ const Schema$S = {
773
846
  type: "object",
774
847
  properties: {
775
848
  meta: IMetaJSONSchema,
@@ -780,23 +853,23 @@ const Schema$H = {
780
853
  required: ["meta", "coop", "vars", "partner"],
781
854
  additionalProperties: true
782
855
  };
783
- const Template$H = {
856
+ const Template$S = {
784
857
  title: cooptypes.Cooperative.Registry.CoopenomicsAgreement.title,
785
858
  description: cooptypes.Cooperative.Registry.CoopenomicsAgreement.description,
786
- model: Schema$H,
859
+ model: Schema$S,
787
860
  context: cooptypes.Cooperative.Registry.CoopenomicsAgreement.context,
788
861
  translations: cooptypes.Cooperative.Registry.CoopenomicsAgreement.translations
789
862
  };
790
863
 
791
864
  const CoopenomicsAgreement = {
792
865
  __proto__: null,
793
- Schema: Schema$H,
794
- Template: Template$H,
795
- registry_id: registry_id$H
866
+ Schema: Schema$S,
867
+ Template: Template$S,
868
+ registry_id: registry_id$S
796
869
  };
797
870
 
798
- const registry_id$G = cooptypes.Cooperative.Registry.ConvertToAxonStatement.registry_id;
799
- const Schema$G = {
871
+ const registry_id$R = cooptypes.Cooperative.Registry.ConvertToAxonStatement.registry_id;
872
+ const Schema$R = {
800
873
  type: "object",
801
874
  properties: {
802
875
  meta: {
@@ -821,23 +894,23 @@ const Schema$G = {
821
894
  required: ["meta", "vars", "coop", "commonUser"],
822
895
  additionalProperties: true
823
896
  };
824
- const Template$G = {
897
+ const Template$R = {
825
898
  title: cooptypes.Cooperative.Registry.ConvertToAxonStatement.title,
826
899
  description: cooptypes.Cooperative.Registry.ConvertToAxonStatement.description,
827
- model: Schema$G,
900
+ model: Schema$R,
828
901
  context: cooptypes.Cooperative.Registry.ConvertToAxonStatement.context,
829
902
  translations: cooptypes.Cooperative.Registry.ConvertToAxonStatement.translations
830
903
  };
831
904
 
832
905
  const ConvertToAxonStatement = {
833
906
  __proto__: null,
834
- Schema: Schema$G,
835
- Template: Template$G,
836
- registry_id: registry_id$G
907
+ Schema: Schema$R,
908
+ Template: Template$R,
909
+ registry_id: registry_id$R
837
910
  };
838
911
 
839
- const registry_id$F = cooptypes.Cooperative.Registry.ParticipantApplication.registry_id;
840
- const Schema$F = {
912
+ const registry_id$Q = cooptypes.Cooperative.Registry.ParticipantApplication.registry_id;
913
+ const Schema$Q = {
841
914
  type: "object",
842
915
  properties: {
843
916
  type: {
@@ -926,23 +999,23 @@ const Schema$F = {
926
999
  required: ["meta", "coop", "type"],
927
1000
  additionalProperties: true
928
1001
  };
929
- const Template$F = {
1002
+ const Template$Q = {
930
1003
  title: cooptypes.Cooperative.Registry.ParticipantApplication.title,
931
1004
  description: cooptypes.Cooperative.Registry.ParticipantApplication.description,
932
- model: Schema$F,
1005
+ model: Schema$Q,
933
1006
  context: cooptypes.Cooperative.Registry.ParticipantApplication.context,
934
1007
  translations: cooptypes.Cooperative.Registry.ParticipantApplication.translations
935
1008
  };
936
1009
 
937
1010
  const ParticipantApplication = {
938
1011
  __proto__: null,
939
- Schema: Schema$F,
940
- Template: Template$F,
941
- registry_id: registry_id$F
1012
+ Schema: Schema$Q,
1013
+ Template: Template$Q,
1014
+ registry_id: registry_id$Q
942
1015
  };
943
1016
 
944
- const registry_id$E = cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.registry_id;
945
- const Schema$E = {
1017
+ const registry_id$P = cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.registry_id;
1018
+ const Schema$P = {
946
1019
  type: "object",
947
1020
  properties: {
948
1021
  type: {
@@ -1006,23 +1079,23 @@ const Schema$E = {
1006
1079
  // vars не добавляем в обязательные параметры для обратной совместимости (начиная с 2.26)
1007
1080
  additionalProperties: true
1008
1081
  };
1009
- const Template$E = {
1082
+ const Template$P = {
1010
1083
  title: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.title,
1011
1084
  description: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.description,
1012
- model: Schema$E,
1085
+ model: Schema$P,
1013
1086
  context: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.context,
1014
1087
  translations: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.translations
1015
1088
  };
1016
1089
 
1017
1090
  const DecisionOfParticipantApplication = {
1018
1091
  __proto__: null,
1019
- Schema: Schema$E,
1020
- Template: Template$E,
1021
- registry_id: registry_id$E
1092
+ Schema: Schema$P,
1093
+ Template: Template$P,
1094
+ registry_id: registry_id$P
1022
1095
  };
1023
1096
 
1024
- const registry_id$D = cooptypes.Cooperative.Registry.SelectBranchStatement.registry_id;
1025
- const Schema$D = {
1097
+ const registry_id$O = cooptypes.Cooperative.Registry.SelectBranchStatement.registry_id;
1098
+ const Schema$O = {
1026
1099
  type: "object",
1027
1100
  properties: {
1028
1101
  type: {
@@ -1085,23 +1158,23 @@ const Schema$D = {
1085
1158
  required: ["meta", "type", "branch", "vars", "coop"],
1086
1159
  additionalProperties: true
1087
1160
  };
1088
- const Template$D = {
1161
+ const Template$O = {
1089
1162
  title: cooptypes.Cooperative.Registry.SelectBranchStatement.title,
1090
1163
  description: cooptypes.Cooperative.Registry.SelectBranchStatement.description,
1091
- model: Schema$D,
1164
+ model: Schema$O,
1092
1165
  context: cooptypes.Cooperative.Registry.SelectBranchStatement.context,
1093
1166
  translations: cooptypes.Cooperative.Registry.SelectBranchStatement.translations
1094
1167
  };
1095
1168
 
1096
1169
  const SelectBranchStatement = {
1097
1170
  __proto__: null,
1098
- Schema: Schema$D,
1099
- Template: Template$D,
1100
- registry_id: registry_id$D
1171
+ Schema: Schema$O,
1172
+ Template: Template$O,
1173
+ registry_id: registry_id$O
1101
1174
  };
1102
1175
 
1103
- const registry_id$C = cooptypes.Cooperative.Registry.ProjectFreeDecision.registry_id;
1104
- const Schema$C = {
1176
+ const registry_id$N = cooptypes.Cooperative.Registry.ProjectFreeDecision.registry_id;
1177
+ const Schema$N = {
1105
1178
  type: "object",
1106
1179
  properties: {
1107
1180
  coop: {
@@ -1124,6 +1197,7 @@ const Schema$C = {
1124
1197
  type: "object",
1125
1198
  properties: {
1126
1199
  id: { type: "string" },
1200
+ title: { type: "string", nullable: true, maxLength: 200 },
1127
1201
  question: { type: "string" },
1128
1202
  decision: { type: "string" }
1129
1203
  },
@@ -1136,23 +1210,23 @@ const Schema$C = {
1136
1210
  required: ["meta", "coop", "project", "suggester_name", "vars"],
1137
1211
  additionalProperties: true
1138
1212
  };
1139
- const Template$C = {
1213
+ const Template$N = {
1140
1214
  title: cooptypes.Cooperative.Registry.ProjectFreeDecision.title,
1141
1215
  description: cooptypes.Cooperative.Registry.ProjectFreeDecision.description,
1142
- model: Schema$C,
1216
+ model: Schema$N,
1143
1217
  context: cooptypes.Cooperative.Registry.ProjectFreeDecision.context,
1144
1218
  translations: cooptypes.Cooperative.Registry.ProjectFreeDecision.translations
1145
1219
  };
1146
1220
 
1147
1221
  const ProjectFreeDecision = {
1148
1222
  __proto__: null,
1149
- Schema: Schema$C,
1150
- Template: Template$C,
1151
- registry_id: registry_id$C
1223
+ Schema: Schema$N,
1224
+ Template: Template$N,
1225
+ registry_id: registry_id$N
1152
1226
  };
1153
1227
 
1154
- const registry_id$B = cooptypes.Cooperative.Registry.FreeDecision.registry_id;
1155
- const Schema$B = {
1228
+ const registry_id$M = cooptypes.Cooperative.Registry.FreeDecision.registry_id;
1229
+ const Schema$M = {
1156
1230
  type: "object",
1157
1231
  properties: {
1158
1232
  coop: {
@@ -1183,6 +1257,7 @@ const Schema$B = {
1183
1257
  type: "object",
1184
1258
  properties: {
1185
1259
  id: { type: "string" },
1260
+ title: { type: "string", nullable: true },
1186
1261
  question: { type: "string" },
1187
1262
  decision: { type: "string" }
1188
1263
  },
@@ -1195,19 +1270,19 @@ const Schema$B = {
1195
1270
  // vars не вносим для обратной совместимости начиная с версии 2.25
1196
1271
  additionalProperties: true
1197
1272
  };
1198
- const Template$B = {
1273
+ const Template$M = {
1199
1274
  title: cooptypes.Cooperative.Registry.FreeDecision.title,
1200
1275
  description: cooptypes.Cooperative.Registry.FreeDecision.description,
1201
- model: Schema$B,
1276
+ model: Schema$M,
1202
1277
  context: cooptypes.Cooperative.Registry.FreeDecision.context,
1203
1278
  translations: cooptypes.Cooperative.Registry.FreeDecision.translations
1204
1279
  };
1205
1280
 
1206
1281
  const FreeDecision = {
1207
1282
  __proto__: null,
1208
- Schema: Schema$B,
1209
- Template: Template$B,
1210
- registry_id: registry_id$B
1283
+ Schema: Schema$M,
1284
+ Template: Template$M,
1285
+ registry_id: registry_id$M
1211
1286
  };
1212
1287
 
1213
1288
  const CommonRequestSchema = {
@@ -1237,8 +1312,8 @@ const CommonRequestSchema = {
1237
1312
  additionalProperties: true
1238
1313
  };
1239
1314
 
1240
- const registry_id$A = cooptypes.Cooperative.Registry.AssetContributionStatement.registry_id;
1241
- const Schema$A = {
1315
+ const registry_id$L = cooptypes.Cooperative.Registry.AssetContributionStatement.registry_id;
1316
+ const Schema$L = {
1242
1317
  type: "object",
1243
1318
  properties: {
1244
1319
  meta: IMetaJSONSchema,
@@ -1250,23 +1325,23 @@ const Schema$A = {
1250
1325
  required: ["meta", "coop", "vars", "request", "user"],
1251
1326
  additionalProperties: true
1252
1327
  };
1253
- const Template$A = {
1328
+ const Template$L = {
1254
1329
  title: cooptypes.Cooperative.Registry.AssetContributionStatement.title,
1255
1330
  description: cooptypes.Cooperative.Registry.AssetContributionStatement.description,
1256
- model: Schema$A,
1331
+ model: Schema$L,
1257
1332
  context: cooptypes.Cooperative.Registry.AssetContributionStatement.context,
1258
1333
  translations: cooptypes.Cooperative.Registry.AssetContributionStatement.translations
1259
1334
  };
1260
1335
 
1261
1336
  const AssetContributionStatement = {
1262
1337
  __proto__: null,
1263
- Schema: Schema$A,
1264
- Template: Template$A,
1265
- registry_id: registry_id$A
1338
+ Schema: Schema$L,
1339
+ Template: Template$L,
1340
+ registry_id: registry_id$L
1266
1341
  };
1267
1342
 
1268
- const registry_id$z = cooptypes.Cooperative.Registry.ReturnByAssetStatement.registry_id;
1269
- const Schema$z = {
1343
+ const registry_id$K = cooptypes.Cooperative.Registry.ReturnByAssetStatement.registry_id;
1344
+ const Schema$K = {
1270
1345
  type: "object",
1271
1346
  properties: {
1272
1347
  meta: IMetaJSONSchema,
@@ -1278,23 +1353,23 @@ const Schema$z = {
1278
1353
  required: ["meta", "coop", "vars", "request", "user"],
1279
1354
  additionalProperties: true
1280
1355
  };
1281
- const Template$z = {
1356
+ const Template$K = {
1282
1357
  title: cooptypes.Cooperative.Registry.ReturnByAssetStatement.title,
1283
1358
  description: cooptypes.Cooperative.Registry.ReturnByAssetStatement.description,
1284
- model: Schema$z,
1359
+ model: Schema$K,
1285
1360
  context: cooptypes.Cooperative.Registry.ReturnByAssetStatement.context,
1286
1361
  translations: cooptypes.Cooperative.Registry.ReturnByAssetStatement.translations
1287
1362
  };
1288
1363
 
1289
1364
  const ReturnByAssetStatement = {
1290
1365
  __proto__: null,
1291
- Schema: Schema$z,
1292
- Template: Template$z,
1293
- registry_id: registry_id$z
1366
+ Schema: Schema$K,
1367
+ Template: Template$K,
1368
+ registry_id: registry_id$K
1294
1369
  };
1295
1370
 
1296
- const registry_id$y = cooptypes.Cooperative.Registry.AssetContributionDecision.registry_id;
1297
- const Schema$y = {
1371
+ const registry_id$J = cooptypes.Cooperative.Registry.AssetContributionDecision.registry_id;
1372
+ const Schema$J = {
1298
1373
  type: "object",
1299
1374
  properties: {
1300
1375
  meta: IMetaJSONSchema,
@@ -1307,23 +1382,23 @@ const Schema$y = {
1307
1382
  required: ["meta", "coop", "vars", "request", "user", "decision"],
1308
1383
  additionalProperties: true
1309
1384
  };
1310
- const Template$y = {
1385
+ const Template$J = {
1311
1386
  title: cooptypes.Cooperative.Registry.AssetContributionDecision.title,
1312
1387
  description: cooptypes.Cooperative.Registry.AssetContributionDecision.description,
1313
- model: Schema$y,
1388
+ model: Schema$J,
1314
1389
  context: cooptypes.Cooperative.Registry.AssetContributionDecision.context,
1315
1390
  translations: cooptypes.Cooperative.Registry.AssetContributionDecision.translations
1316
1391
  };
1317
1392
 
1318
1393
  const AssetContributionDecision = {
1319
1394
  __proto__: null,
1320
- Schema: Schema$y,
1321
- Template: Template$y,
1322
- registry_id: registry_id$y
1395
+ Schema: Schema$J,
1396
+ Template: Template$J,
1397
+ registry_id: registry_id$J
1323
1398
  };
1324
1399
 
1325
- const registry_id$x = cooptypes.Cooperative.Registry.ReturnByAssetDecision.registry_id;
1326
- const Schema$x = {
1400
+ const registry_id$I = cooptypes.Cooperative.Registry.ReturnByAssetDecision.registry_id;
1401
+ const Schema$I = {
1327
1402
  type: "object",
1328
1403
  properties: {
1329
1404
  meta: IMetaJSONSchema,
@@ -1336,19 +1411,19 @@ const Schema$x = {
1336
1411
  required: ["meta", "coop", "vars", "request", "user", "decision"],
1337
1412
  additionalProperties: true
1338
1413
  };
1339
- const Template$x = {
1414
+ const Template$I = {
1340
1415
  title: cooptypes.Cooperative.Registry.ReturnByAssetDecision.title,
1341
1416
  description: cooptypes.Cooperative.Registry.ReturnByAssetDecision.description,
1342
- model: Schema$x,
1417
+ model: Schema$I,
1343
1418
  context: cooptypes.Cooperative.Registry.ReturnByAssetDecision.context,
1344
1419
  translations: cooptypes.Cooperative.Registry.ReturnByAssetDecision.translations
1345
1420
  };
1346
1421
 
1347
1422
  const ReturnByAssetDecision = {
1348
1423
  __proto__: null,
1349
- Schema: Schema$x,
1350
- Template: Template$x,
1351
- registry_id: registry_id$x
1424
+ Schema: Schema$I,
1425
+ Template: Template$I,
1426
+ registry_id: registry_id$I
1352
1427
  };
1353
1428
 
1354
1429
  const FirstLastMiddleNameSchema = {
@@ -1371,8 +1446,8 @@ const CommonProgramSchema = {
1371
1446
  additionalProperties: true
1372
1447
  };
1373
1448
 
1374
- const registry_id$w = cooptypes.Cooperative.Registry.AssetContributionAct.registry_id;
1375
- const Schema$w = {
1449
+ const registry_id$H = cooptypes.Cooperative.Registry.AssetContributionAct.registry_id;
1450
+ const Schema$H = {
1376
1451
  type: "object",
1377
1452
  properties: {
1378
1453
  meta: IMetaJSONSchema,
@@ -1389,23 +1464,23 @@ const Schema$w = {
1389
1464
  required: ["meta", "coop", "vars", "request", "user", "decision", "act_id", "receiver", "program"],
1390
1465
  additionalProperties: true
1391
1466
  };
1392
- const Template$w = {
1467
+ const Template$H = {
1393
1468
  title: cooptypes.Cooperative.Registry.AssetContributionAct.title,
1394
1469
  description: cooptypes.Cooperative.Registry.AssetContributionAct.description,
1395
- model: Schema$w,
1470
+ model: Schema$H,
1396
1471
  context: cooptypes.Cooperative.Registry.AssetContributionAct.context,
1397
1472
  translations: cooptypes.Cooperative.Registry.AssetContributionAct.translations
1398
1473
  };
1399
1474
 
1400
1475
  const AssetContributionAct = {
1401
1476
  __proto__: null,
1402
- Schema: Schema$w,
1403
- Template: Template$w,
1404
- registry_id: registry_id$w
1477
+ Schema: Schema$H,
1478
+ Template: Template$H,
1479
+ registry_id: registry_id$H
1405
1480
  };
1406
1481
 
1407
- const registry_id$v = cooptypes.Cooperative.Registry.ReturnByAssetAct.registry_id;
1408
- const Schema$v = {
1482
+ const registry_id$G = cooptypes.Cooperative.Registry.ReturnByAssetAct.registry_id;
1483
+ const Schema$G = {
1409
1484
  type: "object",
1410
1485
  properties: {
1411
1486
  meta: IMetaJSONSchema,
@@ -1422,23 +1497,23 @@ const Schema$v = {
1422
1497
  required: ["meta", "coop", "vars", "request", "user", "decision", "act_id", "transmitter", "program"],
1423
1498
  additionalProperties: true
1424
1499
  };
1425
- const Template$v = {
1500
+ const Template$G = {
1426
1501
  title: cooptypes.Cooperative.Registry.ReturnByAssetAct.title,
1427
1502
  description: cooptypes.Cooperative.Registry.ReturnByAssetAct.description,
1428
- model: Schema$v,
1503
+ model: Schema$G,
1429
1504
  context: cooptypes.Cooperative.Registry.ReturnByAssetAct.context,
1430
1505
  translations: cooptypes.Cooperative.Registry.ReturnByAssetAct.translations
1431
1506
  };
1432
1507
 
1433
1508
  const ReturnByAssetAct = {
1434
1509
  __proto__: null,
1435
- Schema: Schema$v,
1436
- Template: Template$v,
1437
- registry_id: registry_id$v
1510
+ Schema: Schema$G,
1511
+ Template: Template$G,
1512
+ registry_id: registry_id$G
1438
1513
  };
1439
1514
 
1440
- const registry_id$u = cooptypes.Cooperative.Registry.ReturnByMoney.registry_id;
1441
- const Schema$u = {
1515
+ const registry_id$F = cooptypes.Cooperative.Registry.ReturnByMoney.registry_id;
1516
+ const Schema$F = {
1442
1517
  type: "object",
1443
1518
  properties: {
1444
1519
  meta: IMetaJSONSchema,
@@ -1453,23 +1528,23 @@ const Schema$u = {
1453
1528
  required: ["meta", "coop", "vars", "user", "payment_details", "quantity", "currency", "payment_hash"],
1454
1529
  additionalProperties: false
1455
1530
  };
1456
- const Template$u = {
1531
+ const Template$F = {
1457
1532
  title: cooptypes.Cooperative.Registry.ReturnByMoney.title,
1458
1533
  description: cooptypes.Cooperative.Registry.ReturnByMoney.description,
1459
- model: Schema$u,
1534
+ model: Schema$F,
1460
1535
  context: cooptypes.Cooperative.Registry.ReturnByMoney.context,
1461
1536
  translations: cooptypes.Cooperative.Registry.ReturnByMoney.translations
1462
1537
  };
1463
1538
 
1464
1539
  const ReturnByMoney = {
1465
1540
  __proto__: null,
1466
- Schema: Schema$u,
1467
- Template: Template$u,
1468
- registry_id: registry_id$u
1541
+ Schema: Schema$F,
1542
+ Template: Template$F,
1543
+ registry_id: registry_id$F
1469
1544
  };
1470
1545
 
1471
- const registry_id$t = cooptypes.Cooperative.Registry.ReturnByMoneyDecision.registry_id;
1472
- const Schema$t = {
1546
+ const registry_id$E = cooptypes.Cooperative.Registry.ReturnByMoneyDecision.registry_id;
1547
+ const Schema$E = {
1473
1548
  type: "object",
1474
1549
  properties: {
1475
1550
  meta: {
@@ -1504,96 +1579,458 @@ const Schema$t = {
1504
1579
  required: ["meta", "coop", "decision", "user", "quantity", "currency", "vars"],
1505
1580
  additionalProperties: false
1506
1581
  };
1507
- const Template$t = {
1582
+ const Template$E = {
1508
1583
  title: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.title,
1509
1584
  description: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.description,
1510
- model: Schema$t,
1585
+ model: Schema$E,
1511
1586
  context: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.context,
1512
1587
  translations: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.translations
1513
1588
  };
1514
1589
 
1515
1590
  const ReturnByMoneyDecision = {
1516
1591
  __proto__: null,
1517
- Schema: Schema$t,
1518
- Template: Template$t,
1519
- registry_id: registry_id$t
1592
+ Schema: Schema$E,
1593
+ Template: Template$E,
1594
+ registry_id: registry_id$E
1520
1595
  };
1521
1596
 
1522
- const registry_id$s = cooptypes.Cooperative.Registry.CapitalizationAgreement.registry_id;
1523
- const Schema$s = {
1597
+ const registry_id$D = cooptypes.Cooperative.Registry.GeneratorProgramTemplate.registry_id;
1598
+ const Schema$D = {
1524
1599
  type: "object",
1525
1600
  properties: {
1526
- meta: IMetaJSONSchema
1601
+ meta: IMetaJSONSchema,
1602
+ coop: CooperativeSchema,
1603
+ vars: VarsSchema
1527
1604
  },
1528
- required: ["meta"],
1605
+ required: ["meta", "coop", "vars"],
1529
1606
  additionalProperties: true
1530
1607
  };
1531
- const Template$s = {
1532
- title: cooptypes.Cooperative.Registry.CapitalizationAgreement.title,
1533
- description: cooptypes.Cooperative.Registry.CapitalizationAgreement.description,
1534
- model: Schema$s,
1535
- context: cooptypes.Cooperative.Registry.CapitalizationAgreement.context,
1536
- translations: cooptypes.Cooperative.Registry.CapitalizationAgreement.translations
1608
+ const Template$D = {
1609
+ title: cooptypes.Cooperative.Registry.GeneratorProgramTemplate.title,
1610
+ description: cooptypes.Cooperative.Registry.GeneratorProgramTemplate.description,
1611
+ model: Schema$D,
1612
+ context: cooptypes.Cooperative.Registry.GeneratorProgramTemplate.context,
1613
+ translations: cooptypes.Cooperative.Registry.GeneratorProgramTemplate.translations
1537
1614
  };
1538
1615
 
1539
- const CapitalizationAgreement = {
1616
+ const GeneratorProgramTemplate = {
1540
1617
  __proto__: null,
1541
- Schema: Schema$s,
1542
- Template: Template$s,
1543
- registry_id: registry_id$s
1618
+ Schema: Schema$D,
1619
+ Template: Template$D,
1620
+ registry_id: registry_id$D
1544
1621
  };
1545
1622
 
1546
- const registry_id$r = cooptypes.Cooperative.Registry.GenerationAgreement.registry_id;
1547
- const Schema$r = {
1623
+ const registry_id$C = cooptypes.Cooperative.Registry.GeneratorOfferTemplate.registry_id;
1624
+ const Schema$C = {
1548
1625
  type: "object",
1549
1626
  properties: {
1550
1627
  meta: IMetaJSONSchema,
1551
- coop: CooperativeSchema
1628
+ coop: CooperativeSchema,
1629
+ vars: VarsSchema,
1630
+ common_user: CommonUserSchema
1552
1631
  },
1553
- required: ["meta", "coop"],
1632
+ required: ["meta", "coop", "vars", "common_user"],
1554
1633
  additionalProperties: true
1555
1634
  };
1556
- const Template$r = {
1557
- title: cooptypes.Cooperative.Registry.GenerationAgreement.title,
1558
- description: cooptypes.Cooperative.Registry.GenerationAgreement.description,
1559
- model: Schema$r,
1560
- context: cooptypes.Cooperative.Registry.GenerationAgreement.context,
1561
- translations: cooptypes.Cooperative.Registry.GenerationAgreement.translations
1635
+ const Template$C = {
1636
+ title: cooptypes.Cooperative.Registry.GeneratorOfferTemplate.title,
1637
+ description: cooptypes.Cooperative.Registry.GeneratorOfferTemplate.description,
1638
+ model: Schema$C,
1639
+ context: cooptypes.Cooperative.Registry.GeneratorOfferTemplate.context,
1640
+ translations: cooptypes.Cooperative.Registry.GeneratorOfferTemplate.translations
1562
1641
  };
1563
1642
 
1564
- const GenerationAgreement = {
1643
+ const GeneratorOfferTemplate = {
1565
1644
  __proto__: null,
1566
- Schema: Schema$r,
1567
- Template: Template$r,
1568
- registry_id: registry_id$r
1645
+ Schema: Schema$C,
1646
+ Template: Template$C,
1647
+ registry_id: registry_id$C
1569
1648
  };
1570
1649
 
1571
- const registry_id$q = cooptypes.Cooperative.Registry.AppendixGenerationAgreement.registry_id;
1572
- const Schema$q = {
1650
+ const registry_id$B = cooptypes.Cooperative.Registry.GeneratorOffer.registry_id;
1651
+ const Schema$B = {
1573
1652
  type: "object",
1574
1653
  properties: {
1575
- meta: IMetaJSONSchema
1654
+ meta: IMetaJSONSchema,
1655
+ coop: CooperativeSchema,
1656
+ vars: VarsSchema,
1657
+ common_user: CommonUserSchema,
1658
+ generator_agreement_number: { type: "string" },
1659
+ generator_agreement_created_at: { type: "string" }
1576
1660
  },
1577
- required: ["meta"],
1661
+ required: ["meta", "coop", "vars", "common_user", "generator_agreement_number", "generator_agreement_created_at"],
1578
1662
  additionalProperties: true
1579
1663
  };
1580
- const Template$q = {
1581
- title: cooptypes.Cooperative.Registry.AppendixGenerationAgreement.title,
1582
- description: cooptypes.Cooperative.Registry.AppendixGenerationAgreement.description,
1583
- model: Schema$q,
1584
- context: cooptypes.Cooperative.Registry.AppendixGenerationAgreement.context,
1585
- translations: cooptypes.Cooperative.Registry.AppendixGenerationAgreement.translations
1664
+ const Template$B = {
1665
+ title: cooptypes.Cooperative.Registry.GeneratorOffer.title,
1666
+ description: cooptypes.Cooperative.Registry.GeneratorOffer.description,
1667
+ model: Schema$B,
1668
+ context: cooptypes.Cooperative.Registry.GeneratorOffer.context,
1669
+ translations: cooptypes.Cooperative.Registry.GeneratorOffer.translations
1586
1670
  };
1587
1671
 
1588
- const AppendixGenerationAgreement = {
1672
+ const GeneratorOffer = {
1589
1673
  __proto__: null,
1590
- Schema: Schema$q,
1591
- Template: Template$q,
1592
- registry_id: registry_id$q
1674
+ Schema: Schema$B,
1675
+ Template: Template$B,
1676
+ registry_id: registry_id$B
1593
1677
  };
1594
1678
 
1595
- const registry_id$p = cooptypes.Cooperative.Registry.ExpenseStatement.registry_id;
1596
- const Schema$p = {
1679
+ const registry_id$A = cooptypes.Cooperative.Registry.BlagorostProgramTemplate.registry_id;
1680
+ const Schema$A = {
1681
+ type: "object",
1682
+ properties: {
1683
+ meta: IMetaJSONSchema,
1684
+ vars: VarsSchema
1685
+ },
1686
+ required: ["meta", "vars"],
1687
+ additionalProperties: true
1688
+ };
1689
+ const Template$A = {
1690
+ title: cooptypes.Cooperative.Registry.BlagorostProgramTemplate.title,
1691
+ description: cooptypes.Cooperative.Registry.BlagorostProgramTemplate.description,
1692
+ model: Schema$A,
1693
+ context: cooptypes.Cooperative.Registry.BlagorostProgramTemplate.context,
1694
+ translations: cooptypes.Cooperative.Registry.BlagorostProgramTemplate.translations
1695
+ };
1696
+
1697
+ const BlagorostProgramTemplate = {
1698
+ __proto__: null,
1699
+ Schema: Schema$A,
1700
+ Template: Template$A,
1701
+ registry_id: registry_id$A
1702
+ };
1703
+
1704
+ const registry_id$z = cooptypes.Cooperative.Registry.GenerationContractTemplate.registry_id;
1705
+ const Schema$z = {
1706
+ type: "object",
1707
+ properties: {
1708
+ meta: IMetaJSONSchema,
1709
+ coop: CooperativeSchema,
1710
+ vars: VarsSchema
1711
+ },
1712
+ required: ["meta", "coop", "vars"],
1713
+ additionalProperties: true
1714
+ };
1715
+ const Template$z = {
1716
+ title: cooptypes.Cooperative.Registry.GenerationContractTemplate.title,
1717
+ description: cooptypes.Cooperative.Registry.GenerationContractTemplate.description,
1718
+ model: Schema$z,
1719
+ context: cooptypes.Cooperative.Registry.GenerationContractTemplate.context,
1720
+ translations: cooptypes.Cooperative.Registry.GenerationContractTemplate.translations
1721
+ };
1722
+
1723
+ const GenerationContractTemplate = {
1724
+ __proto__: null,
1725
+ Schema: Schema$z,
1726
+ Template: Template$z,
1727
+ registry_id: registry_id$z
1728
+ };
1729
+
1730
+ const registry_id$y = cooptypes.Cooperative.Registry.BlagorostOfferTemplate.registry_id;
1731
+ const Schema$y = {
1732
+ type: "object",
1733
+ properties: {
1734
+ meta: IMetaJSONSchema,
1735
+ coop: CooperativeSchema,
1736
+ vars: VarsSchema
1737
+ },
1738
+ required: ["meta", "coop", "vars"],
1739
+ additionalProperties: true
1740
+ };
1741
+ const Template$y = {
1742
+ title: cooptypes.Cooperative.Registry.BlagorostOfferTemplate.title,
1743
+ description: cooptypes.Cooperative.Registry.BlagorostOfferTemplate.description,
1744
+ model: Schema$y,
1745
+ context: cooptypes.Cooperative.Registry.BlagorostOfferTemplate.context,
1746
+ translations: cooptypes.Cooperative.Registry.BlagorostOfferTemplate.translations
1747
+ };
1748
+
1749
+ const BlagorostOfferTemplate = {
1750
+ __proto__: null,
1751
+ Schema: Schema$y,
1752
+ Template: Template$y,
1753
+ registry_id: registry_id$y
1754
+ };
1755
+
1756
+ const registry_id$x = cooptypes.Cooperative.Registry.BlagorostOffer.registry_id;
1757
+ const Schema$x = {
1758
+ type: "object",
1759
+ properties: {
1760
+ meta: IMetaJSONSchema,
1761
+ coop: CooperativeSchema,
1762
+ vars: VarsSchema,
1763
+ common_user: CommonUserSchema,
1764
+ blagorost_agreement_number: { type: "string" },
1765
+ blagorost_agreement_created_at: { type: "string" }
1766
+ },
1767
+ required: ["meta", "coop", "vars", "common_user", "blagorost_agreement_number", "blagorost_agreement_created_at"],
1768
+ additionalProperties: true
1769
+ };
1770
+ const Template$x = {
1771
+ title: cooptypes.Cooperative.Registry.BlagorostOffer.title,
1772
+ description: cooptypes.Cooperative.Registry.BlagorostOffer.description,
1773
+ model: Schema$x,
1774
+ context: cooptypes.Cooperative.Registry.BlagorostOffer.context,
1775
+ translations: cooptypes.Cooperative.Registry.BlagorostOffer.translations
1776
+ };
1777
+
1778
+ const BlagorostOffer = {
1779
+ __proto__: null,
1780
+ Schema: Schema$x,
1781
+ Template: Template$x,
1782
+ registry_id: registry_id$x
1783
+ };
1784
+
1785
+ const registry_id$w = cooptypes.Cooperative.Registry.GenerationContract.registry_id;
1786
+ const Schema$w = {
1787
+ type: "object",
1788
+ properties: {
1789
+ meta: IMetaJSONSchema,
1790
+ coop: CooperativeSchema,
1791
+ vars: VarsSchema,
1792
+ user: CommonUserSchema,
1793
+ contributor_contract_number: { type: "string" }
1794
+ },
1795
+ required: ["meta", "coop", "vars", "user", "contributor_contract_number"],
1796
+ additionalProperties: true
1797
+ };
1798
+ const Template$w = {
1799
+ title: cooptypes.Cooperative.Registry.GenerationContract.title,
1800
+ description: cooptypes.Cooperative.Registry.GenerationContract.description,
1801
+ model: Schema$w,
1802
+ context: cooptypes.Cooperative.Registry.GenerationContract.context,
1803
+ translations: cooptypes.Cooperative.Registry.GenerationContract.translations
1804
+ };
1805
+
1806
+ const GenerationContract = {
1807
+ __proto__: null,
1808
+ Schema: Schema$w,
1809
+ Template: Template$w,
1810
+ registry_id: registry_id$w
1811
+ };
1812
+
1813
+ const registry_id$v = cooptypes.Cooperative.Registry.ProjectGenerationContract.registry_id;
1814
+ const Schema$v = {
1815
+ type: "object",
1816
+ properties: {
1817
+ meta: IMetaJSONSchema,
1818
+ coop: CooperativeSchema,
1819
+ vars: VarsSchema,
1820
+ user: CommonUserSchema,
1821
+ appendix_hash: { type: "string" },
1822
+ short_appendix_hash: { type: "string" },
1823
+ contributor_contract_number: { type: "string" },
1824
+ contributor_contract_created_at: { type: "string" },
1825
+ project_name: { type: "string" },
1826
+ project_hash: { type: "string" },
1827
+ generator_agreement_number: { type: "string" },
1828
+ generator_agreement_created_at: { type: "string" }
1829
+ },
1830
+ required: ["meta", "coop", "vars", "user", "appendix_hash", "short_appendix_hash", "contributor_contract_number", "contributor_contract_created_at", "project_name", "project_hash", "generator_agreement_number", "generator_agreement_created_at"],
1831
+ additionalProperties: true
1832
+ };
1833
+ const Template$v = {
1834
+ title: cooptypes.Cooperative.Registry.ProjectGenerationContract.title,
1835
+ description: cooptypes.Cooperative.Registry.ProjectGenerationContract.description,
1836
+ model: Schema$v,
1837
+ context: cooptypes.Cooperative.Registry.ProjectGenerationContract.context,
1838
+ translations: cooptypes.Cooperative.Registry.ProjectGenerationContract.translations
1839
+ };
1840
+
1841
+ const ProjectGenerationContract = {
1842
+ __proto__: null,
1843
+ Schema: Schema$v,
1844
+ Template: Template$v,
1845
+ registry_id: registry_id$v
1846
+ };
1847
+
1848
+ const registry_id$u = cooptypes.Cooperative.Registry.ComponentGenerationContract.registry_id;
1849
+ const Schema$u = {
1850
+ type: "object",
1851
+ properties: {
1852
+ meta: IMetaJSONSchema,
1853
+ coop: CooperativeSchema,
1854
+ vars: VarsSchema,
1855
+ user: CommonUserSchema,
1856
+ appendix_hash: { type: "string" },
1857
+ short_appendix_hash: { type: "string" },
1858
+ parent_appendix_hash: { type: "string" },
1859
+ short_parent_appendix_hash: { type: "string" },
1860
+ contributor_contract_number: { type: "string" },
1861
+ contributor_contract_created_at: { type: "string" },
1862
+ component_name: { type: "string" },
1863
+ component_hash: { type: "string" },
1864
+ project_name: { type: "string" },
1865
+ project_hash: { type: "string" }
1866
+ },
1867
+ required: ["meta", "coop", "vars", "user", "appendix_hash", "short_appendix_hash", "parent_appendix_hash", "short_parent_appendix_hash", "contributor_contract_number", "contributor_contract_created_at", "component_name", "component_hash", "project_name", "project_hash"],
1868
+ additionalProperties: true
1869
+ };
1870
+ const Template$u = {
1871
+ title: cooptypes.Cooperative.Registry.ComponentGenerationContract.title,
1872
+ description: cooptypes.Cooperative.Registry.ComponentGenerationContract.description,
1873
+ model: Schema$u,
1874
+ context: cooptypes.Cooperative.Registry.ComponentGenerationContract.context,
1875
+ translations: cooptypes.Cooperative.Registry.ComponentGenerationContract.translations
1876
+ };
1877
+
1878
+ const ComponentGenerationContract = {
1879
+ __proto__: null,
1880
+ Schema: Schema$u,
1881
+ Template: Template$u,
1882
+ registry_id: registry_id$u
1883
+ };
1884
+
1885
+ const registry_id$t = cooptypes.Cooperative.Registry.StorageAgreement.registry_id;
1886
+ const Schema$t = {
1887
+ type: "object",
1888
+ properties: {
1889
+ meta: IMetaJSONSchema,
1890
+ coop: CooperativeSchema,
1891
+ vars: VarsSchema,
1892
+ common_user: CommonUserSchema,
1893
+ blagorost_storage_agreement_number: { type: "string" },
1894
+ blagorost_storage_agreement_created_at: { type: "string" },
1895
+ contributor_contract_number: { type: "string" },
1896
+ generator_agreement_number: { type: "string" },
1897
+ generator_agreement_created_at: { type: "string" }
1898
+ },
1899
+ required: ["meta", "coop", "vars", "common_user", "blagorost_storage_agreement_number", "blagorost_storage_agreement_created_at", "contributor_contract_number", "generator_agreement_number", "generator_agreement_created_at"],
1900
+ additionalProperties: true
1901
+ };
1902
+ const Template$t = {
1903
+ title: cooptypes.Cooperative.Registry.StorageAgreement.title,
1904
+ description: cooptypes.Cooperative.Registry.StorageAgreement.description,
1905
+ model: Schema$t,
1906
+ context: cooptypes.Cooperative.Registry.StorageAgreement.context,
1907
+ translations: cooptypes.Cooperative.Registry.StorageAgreement.translations
1908
+ };
1909
+
1910
+ const StorageAgreement = {
1911
+ __proto__: null,
1912
+ Schema: Schema$t,
1913
+ Template: Template$t,
1914
+ registry_id: registry_id$t
1915
+ };
1916
+
1917
+ const registry_id$s = cooptypes.Cooperative.Registry.BlagorostAgreement.registry_id;
1918
+ const Schema$s = {
1919
+ type: "object",
1920
+ properties: {
1921
+ meta: IMetaJSONSchema,
1922
+ coop: CooperativeSchema,
1923
+ vars: VarsSchema,
1924
+ common_user: CommonUserSchema,
1925
+ blagorost_agreement_number: { type: "string" },
1926
+ contributor_contract_number: { type: "string" },
1927
+ contributor_contract_created_at: { type: "string" }
1928
+ },
1929
+ required: ["meta", "coop", "vars", "common_user", "blagorost_agreement_number", "contributor_contract_number", "contributor_contract_created_at"],
1930
+ additionalProperties: true
1931
+ };
1932
+ const Template$s = {
1933
+ title: cooptypes.Cooperative.Registry.BlagorostAgreement.title,
1934
+ description: cooptypes.Cooperative.Registry.BlagorostAgreement.description,
1935
+ model: Schema$s,
1936
+ context: cooptypes.Cooperative.Registry.BlagorostAgreement.context,
1937
+ translations: cooptypes.Cooperative.Registry.BlagorostAgreement.translations
1938
+ };
1939
+
1940
+ const BlagorostAgreement = {
1941
+ __proto__: null,
1942
+ Schema: Schema$s,
1943
+ Template: Template$s,
1944
+ registry_id: registry_id$s
1945
+ };
1946
+
1947
+ const registry_id$r = cooptypes.Cooperative.Registry.InitProjectStatement.registry_id;
1948
+ const Schema$r = {
1949
+ type: "object",
1950
+ properties: {
1951
+ meta: IMetaJSONSchema,
1952
+ coop: CooperativeSchema,
1953
+ vars: VarsSchema,
1954
+ user: CommonUserSchema,
1955
+ project_name: { type: "string" },
1956
+ project_hash: { type: "string" },
1957
+ component_name: { type: "string" },
1958
+ component_hash: { type: "string" },
1959
+ is_component: { type: "boolean" }
1960
+ },
1961
+ required: ["meta", "coop", "vars", "user", "project_name", "project_hash", "component_name", "component_hash", "is_component"],
1962
+ additionalProperties: true
1963
+ };
1964
+ const Template$r = {
1965
+ title: cooptypes.Cooperative.Registry.InitProjectStatement.title,
1966
+ description: cooptypes.Cooperative.Registry.InitProjectStatement.description,
1967
+ model: Schema$r,
1968
+ context: cooptypes.Cooperative.Registry.InitProjectStatement.context,
1969
+ translations: cooptypes.Cooperative.Registry.InitProjectStatement.translations
1970
+ };
1971
+
1972
+ const InitProjectStatement = {
1973
+ __proto__: null,
1974
+ Schema: Schema$r,
1975
+ Template: Template$r,
1976
+ registry_id: registry_id$r
1977
+ };
1978
+
1979
+ const registry_id$q = cooptypes.Cooperative.Registry.InitProjectDecision.registry_id;
1980
+ const Schema$q = {
1981
+ type: "object",
1982
+ properties: {
1983
+ coop: {
1984
+ type: "object",
1985
+ properties: {
1986
+ ...CooperativeSchema.properties
1987
+ },
1988
+ required: [...CooperativeSchema.required],
1989
+ additionalProperties: true
1990
+ },
1991
+ decision: {
1992
+ type: "object",
1993
+ properties: {
1994
+ ...decisionSchema.properties
1995
+ },
1996
+ required: [...decisionSchema.required],
1997
+ additionalProperties: true
1998
+ },
1999
+ meta: {
2000
+ type: "object",
2001
+ properties: {
2002
+ ...IMetaJSONSchema.properties
2003
+ },
2004
+ required: [...IMetaJSONSchema.required],
2005
+ additionalProperties: true
2006
+ },
2007
+ vars: VarsSchema,
2008
+ project_name: { type: "string" },
2009
+ project_hash: { type: "string" },
2010
+ component_name: { type: "string" },
2011
+ component_hash: { type: "string" },
2012
+ is_component: { type: "boolean" }
2013
+ },
2014
+ required: ["meta", "coop", "decision", "project_name", "project_hash", "component_name", "component_hash", "is_component"],
2015
+ additionalProperties: true
2016
+ };
2017
+ const Template$q = {
2018
+ title: cooptypes.Cooperative.Registry.InitProjectDecision.title,
2019
+ description: cooptypes.Cooperative.Registry.InitProjectDecision.description,
2020
+ model: Schema$q,
2021
+ context: cooptypes.Cooperative.Registry.InitProjectDecision.context,
2022
+ translations: cooptypes.Cooperative.Registry.InitProjectDecision.translations
2023
+ };
2024
+
2025
+ const InitProjectDecision = {
2026
+ __proto__: null,
2027
+ Schema: Schema$q,
2028
+ Template: Template$q,
2029
+ registry_id: registry_id$q
2030
+ };
2031
+
2032
+ const registry_id$p = cooptypes.Cooperative.Registry.ExpenseStatement.registry_id;
2033
+ const Schema$p = {
1597
2034
  type: "object",
1598
2035
  properties: {
1599
2036
  meta: IMetaJSONSchema
@@ -1644,9 +2081,35 @@ const registry_id$n = cooptypes.Cooperative.Registry.GenerationMoneyInvestStatem
1644
2081
  const Schema$n = {
1645
2082
  type: "object",
1646
2083
  properties: {
1647
- meta: IMetaJSONSchema
2084
+ meta: IMetaJSONSchema,
2085
+ coop: CooperativeSchema,
2086
+ vars: VarsSchema,
2087
+ common_user: CommonUserSchema,
2088
+ appendix_hash: { type: "string" },
2089
+ short_appendix_hash: { type: "string" },
2090
+ contributor_contract_number: { type: "string" },
2091
+ contributor_contract_created_at: { type: "string" },
2092
+ appendix_created_at: { type: "string" },
2093
+ project_hash: { type: "string" },
2094
+ amount: { type: "string" },
2095
+ blagorost_agreement_number: { type: "string" },
2096
+ blagorost_agreement_created_at: { type: "string" }
1648
2097
  },
1649
- required: ["meta"],
2098
+ required: [
2099
+ "meta",
2100
+ "coop",
2101
+ "vars",
2102
+ "common_user",
2103
+ "appendix_hash",
2104
+ "short_appendix_hash",
2105
+ "contributor_contract_number",
2106
+ "contributor_contract_created_at",
2107
+ "appendix_created_at",
2108
+ "project_hash",
2109
+ "amount",
2110
+ "blagorost_agreement_number",
2111
+ "blagorost_agreement_created_at"
2112
+ ],
1650
2113
  additionalProperties: true
1651
2114
  };
1652
2115
  const Template$n = {
@@ -1668,9 +2131,17 @@ const registry_id$m = cooptypes.Cooperative.Registry.GenerationMoneyReturnUnused
1668
2131
  const Schema$m = {
1669
2132
  type: "object",
1670
2133
  properties: {
1671
- meta: IMetaJSONSchema
2134
+ meta: IMetaJSONSchema,
2135
+ vars: VarsSchema,
2136
+ common_user: CommonUserSchema,
2137
+ contributor_contract_number: { type: "string" },
2138
+ contributor_contract_created_at: { type: "string" },
2139
+ generator_agreement_number: { type: "string" },
2140
+ generator_agreement_created_at: { type: "string" },
2141
+ project_hash: { type: "string" },
2142
+ amount: { type: "string" }
1672
2143
  },
1673
- required: ["meta"],
2144
+ required: ["meta", "vars", "common_user", "contributor_contract_number", "contributor_contract_created_at", "generator_agreement_number", "generator_agreement_created_at", "project_hash", "amount"],
1674
2145
  additionalProperties: true
1675
2146
  };
1676
2147
  const Template$m = {
@@ -1692,9 +2163,12 @@ const registry_id$l = cooptypes.Cooperative.Registry.CapitalizationMoneyInvestSt
1692
2163
  const Schema$l = {
1693
2164
  type: "object",
1694
2165
  properties: {
1695
- meta: IMetaJSONSchema
2166
+ meta: IMetaJSONSchema,
2167
+ vars: VarsSchema,
2168
+ common_user: CommonUserSchema,
2169
+ amount: { type: "string" }
1696
2170
  },
1697
- required: ["meta"],
2171
+ required: ["meta", "vars", "common_user", "amount"],
1698
2172
  additionalProperties: true
1699
2173
  };
1700
2174
  const Template$l = {
@@ -1716,9 +2190,22 @@ const registry_id$k = cooptypes.Cooperative.Registry.ResultContributionStatement
1716
2190
  const Schema$k = {
1717
2191
  type: "object",
1718
2192
  properties: {
1719
- meta: IMetaJSONSchema
2193
+ meta: IMetaJSONSchema,
2194
+ coop: CooperativeSchema,
2195
+ vars: VarsSchema,
2196
+ common_user: CommonUserSchema,
2197
+ contributor_contract_number: { type: "string" },
2198
+ contributor_contract_created_at: { type: "string" },
2199
+ blagorost_agreement_number: { type: "string" },
2200
+ blagorost_agreement_created_at: { type: "string" },
2201
+ project_name: { type: "string" },
2202
+ component_name: { type: "string" },
2203
+ result_hash: { type: "string" },
2204
+ result_short_hash: { type: "string" },
2205
+ percent_of_result: { type: "string" },
2206
+ total_amount: { type: "string" }
1720
2207
  },
1721
- required: ["meta"],
2208
+ required: ["meta", "coop", "vars", "common_user", "contributor_contract_number", "contributor_contract_created_at", "blagorost_agreement_number", "blagorost_agreement_created_at", "project_name", "component_name", "result_hash", "result_short_hash", "percent_of_result", "total_amount"],
1722
2209
  additionalProperties: true
1723
2210
  };
1724
2211
  const Template$k = {
@@ -1740,9 +2227,23 @@ const registry_id$j = cooptypes.Cooperative.Registry.ResultContributionDecision.
1740
2227
  const Schema$j = {
1741
2228
  type: "object",
1742
2229
  properties: {
1743
- meta: IMetaJSONSchema
2230
+ meta: IMetaJSONSchema,
2231
+ coop: CooperativeSchema,
2232
+ vars: VarsSchema,
2233
+ decision: decisionSchema,
2234
+ common_user: CommonUserSchema,
2235
+ contributor_contract_number: { type: "string" },
2236
+ contributor_contract_created_at: { type: "string" },
2237
+ blagorost_agreement_number: { type: "string" },
2238
+ blagorost_agreement_created_at: { type: "string" },
2239
+ project_name: { type: "string" },
2240
+ component_name: { type: "string" },
2241
+ result_hash: { type: "string" },
2242
+ result_short_hash: { type: "string" },
2243
+ percent_of_result: { type: "string" },
2244
+ total_amount: { type: "string" }
1744
2245
  },
1745
- required: ["meta"],
2246
+ required: ["meta", "coop", "vars", "decision", "common_user", "contributor_contract_number", "contributor_contract_created_at", "blagorost_agreement_number", "blagorost_agreement_created_at", "project_name", "component_name", "result_hash", "result_short_hash", "percent_of_result", "total_amount"],
1746
2247
  additionalProperties: true
1747
2248
  };
1748
2249
  const Template$j = {
@@ -1764,9 +2265,22 @@ const registry_id$i = cooptypes.Cooperative.Registry.ResultContributionAct.regis
1764
2265
  const Schema$i = {
1765
2266
  type: "object",
1766
2267
  properties: {
1767
- meta: IMetaJSONSchema
2268
+ meta: IMetaJSONSchema,
2269
+ coop: CooperativeSchema,
2270
+ vars: VarsSchema,
2271
+ decision: decisionSchema,
2272
+ common_user: CommonUserSchema,
2273
+ contributor_contract_number: { type: "string" },
2274
+ contributor_contract_created_at: { type: "string" },
2275
+ blagorost_agreement_number: { type: "string" },
2276
+ blagorost_agreement_created_at: { type: "string" },
2277
+ result_act_hash: { type: "string" },
2278
+ result_act_short_hash: { type: "string" },
2279
+ result_hash: { type: "string" },
2280
+ percent_of_result: { type: "string" },
2281
+ total_amount: { type: "string" }
1768
2282
  },
1769
- required: ["meta"],
2283
+ required: ["meta", "coop", "vars", "decision", "common_user", "contributor_contract_number", "contributor_contract_created_at", "blagorost_agreement_number", "blagorost_agreement_created_at", "result_act_hash", "result_act_short_hash", "result_hash", "percent_of_result", "total_amount"],
1770
2284
  additionalProperties: true
1771
2285
  };
1772
2286
  const Template$i = {
@@ -1980,9 +2494,22 @@ const registry_id$9 = cooptypes.Cooperative.Registry.GenerationToMainWalletConve
1980
2494
  const Schema$9 = {
1981
2495
  type: "object",
1982
2496
  properties: {
1983
- meta: IMetaJSONSchema
2497
+ meta: IMetaJSONSchema,
2498
+ coop: CooperativeSchema,
2499
+ vars: VarsSchema,
2500
+ common_user: CommonUserSchema,
2501
+ contributor_contract_number: { type: "string" },
2502
+ contributor_contract_created_at: { type: "string" },
2503
+ appendix_hash: { type: "string" },
2504
+ appendix_short_hash: { type: "string" },
2505
+ project_hash: { type: "string" },
2506
+ project_short_hash: { type: "string" },
2507
+ main_wallet_amount: { type: "string" },
2508
+ blagorost_wallet_amount: { type: "string" },
2509
+ to_wallet: { type: "boolean" },
2510
+ to_blagorost: { type: "boolean" }
1984
2511
  },
1985
- required: ["meta"],
2512
+ required: ["meta", "coop", "vars", "common_user", "contributor_contract_number", "contributor_contract_created_at", "appendix_hash", "appendix_short_hash", "project_hash", "project_short_hash", "main_wallet_amount", "blagorost_wallet_amount", "to_wallet", "to_blagorost"],
1986
2513
  additionalProperties: true
1987
2514
  };
1988
2515
  const Template$9 = {
@@ -2314,9 +2841,20 @@ const Registry = {
2314
2841
  802: ReturnByAssetAct,
2315
2842
  900: ReturnByMoney,
2316
2843
  901: ReturnByMoneyDecision,
2317
- 1e3: CapitalizationAgreement,
2318
- 1001: GenerationAgreement,
2319
- 1002: AppendixGenerationAgreement,
2844
+ 994: GeneratorProgramTemplate,
2845
+ 995: GeneratorOfferTemplate,
2846
+ 996: GeneratorOffer,
2847
+ 997: GenerationContractTemplate,
2848
+ 998: BlagorostProgramTemplate,
2849
+ 999: BlagorostOfferTemplate,
2850
+ 1e3: BlagorostOffer,
2851
+ 1001: GenerationContract,
2852
+ 1002: ProjectGenerationContract,
2853
+ 1003: ComponentGenerationContract,
2854
+ 1004: StorageAgreement,
2855
+ 1007: BlagorostAgreement,
2856
+ 1005: InitProjectStatement,
2857
+ 1006: InitProjectDecision,
2320
2858
  1010: ExpenseStatement,
2321
2859
  1011: ExpenseDecision,
2322
2860
  1020: GenerationMoneyInvestStatement,
@@ -2339,10 +2877,10 @@ const Registry = {
2339
2877
  1090: CapitalizationToMainWalletConvertStatement
2340
2878
  };
2341
2879
 
2342
- var __defProp$d = Object.defineProperty;
2343
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2344
- var __publicField$d = (obj, key, value) => {
2345
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
2880
+ var __defProp$e = Object.defineProperty;
2881
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2882
+ var __publicField$e = (obj, key, value) => {
2883
+ __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
2346
2884
  return value;
2347
2885
  };
2348
2886
  const ajv = new Ajv__default();
@@ -2353,8 +2891,8 @@ ajv.addFormat("phone", {
2353
2891
  });
2354
2892
  class Validator {
2355
2893
  constructor(schema, data) {
2356
- __publicField$d(this, "schema");
2357
- __publicField$d(this, "data");
2894
+ __publicField$e(this, "schema");
2895
+ __publicField$e(this, "data");
2358
2896
  this.schema = schema;
2359
2897
  this.data = data;
2360
2898
  }
@@ -2372,16 +2910,16 @@ class Validator {
2372
2910
  }
2373
2911
  }
2374
2912
 
2375
- var __defProp$c = Object.defineProperty;
2376
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2377
- var __publicField$c = (obj, key, value) => {
2378
- __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
2913
+ var __defProp$d = Object.defineProperty;
2914
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2915
+ var __publicField$d = (obj, key, value) => {
2916
+ __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
2379
2917
  return value;
2380
2918
  };
2381
2919
  class DataService {
2382
2920
  constructor(dbConnector, collectionName) {
2383
- __publicField$c(this, "collection");
2384
- __publicField$c(this, "state");
2921
+ __publicField$d(this, "collection");
2922
+ __publicField$d(this, "state");
2385
2923
  this.collection = dbConnector.getCollection(collectionName);
2386
2924
  this.state = dbConnector.getCollection("sync");
2387
2925
  }
@@ -2467,16 +3005,16 @@ async function getCurrentBlock() {
2467
3005
  return block_num;
2468
3006
  }
2469
3007
 
2470
- var __defProp$b = Object.defineProperty;
2471
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2472
- var __publicField$b = (obj, key, value) => {
2473
- __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
3008
+ var __defProp$c = Object.defineProperty;
3009
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3010
+ var __publicField$c = (obj, key, value) => {
3011
+ __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
2474
3012
  return value;
2475
3013
  };
2476
3014
  class Individual {
2477
3015
  constructor(storage, data) {
2478
- __publicField$b(this, "individual");
2479
- __publicField$b(this, "data_service");
3016
+ __publicField$c(this, "individual");
3017
+ __publicField$c(this, "data_service");
2480
3018
  this.individual = data;
2481
3019
  this.data_service = new DataService$1(storage, "individuals");
2482
3020
  }
@@ -2509,17 +3047,17 @@ class Individual {
2509
3047
  }
2510
3048
  }
2511
3049
 
2512
- var __defProp$a = Object.defineProperty;
2513
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2514
- var __publicField$a = (obj, key, value) => {
2515
- __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
3050
+ var __defProp$b = Object.defineProperty;
3051
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3052
+ var __publicField$b = (obj, key, value) => {
3053
+ __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
2516
3054
  return value;
2517
3055
  };
2518
3056
  class Organization {
2519
3057
  constructor(storage, data) {
2520
- __publicField$a(this, "db");
2521
- __publicField$a(this, "organization");
2522
- __publicField$a(this, "data_service");
3058
+ __publicField$b(this, "db");
3059
+ __publicField$b(this, "organization");
3060
+ __publicField$b(this, "data_service");
2523
3061
  this.db = storage;
2524
3062
  this.organization = data;
2525
3063
  this.data_service = new DataService$1(storage, "organizations");
@@ -2565,17 +3103,17 @@ class Organization {
2565
3103
  }
2566
3104
  }
2567
3105
 
2568
- var __defProp$9 = Object.defineProperty;
2569
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2570
- var __publicField$9 = (obj, key, value) => {
2571
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
3106
+ var __defProp$a = Object.defineProperty;
3107
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3108
+ var __publicField$a = (obj, key, value) => {
3109
+ __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
2572
3110
  return value;
2573
3111
  };
2574
3112
  class Entrepreneur {
2575
3113
  constructor(storage, data) {
2576
- __publicField$9(this, "db");
2577
- __publicField$9(this, "entrepreneur");
2578
- __publicField$9(this, "data_service");
3114
+ __publicField$a(this, "db");
3115
+ __publicField$a(this, "entrepreneur");
3116
+ __publicField$a(this, "data_service");
2579
3117
  this.db = storage;
2580
3118
  this.entrepreneur = data;
2581
3119
  this.data_service = new DataService$1(storage, "entrepreneurs");
@@ -3024,6 +3562,47 @@ function getEnvVar(key) {
3024
3562
  return envVar;
3025
3563
  }
3026
3564
 
3565
+ var __defProp$9 = Object.defineProperty;
3566
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3567
+ var __publicField$9 = (obj, key, value) => {
3568
+ __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
3569
+ return value;
3570
+ };
3571
+ class PaymentMethod {
3572
+ constructor(storage, data) {
3573
+ __publicField$9(this, "db");
3574
+ __publicField$9(this, "paymentMethod");
3575
+ __publicField$9(this, "data_service");
3576
+ this.db = storage;
3577
+ this.paymentMethod = data;
3578
+ this.data_service = new DataService$1(storage, "paymentMethods");
3579
+ }
3580
+ validate() {
3581
+ return new Validator(paymentMethodSchema, this.paymentMethod).validate();
3582
+ }
3583
+ async save() {
3584
+ await this.validate();
3585
+ if (!this.paymentMethod)
3586
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u043B\u0430\u0442\u0435\u0436\u043D\u043E\u0433\u043E \u043C\u0435\u0442\u043E\u0434\u0430 \u043D\u0435 \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u044B \u0434\u043B\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F");
3587
+ this.paymentMethod.deleted = false;
3588
+ this.paymentMethod.block_num = await getCurrentBlock();
3589
+ return await this.data_service.save(this.paymentMethod);
3590
+ }
3591
+ async getOne(filter) {
3592
+ const result = await this.data_service.getOne(filter);
3593
+ return result;
3594
+ }
3595
+ async getMany(filter) {
3596
+ return this.data_service.getMany({ deleted: false, ...filter }, ["username", "method_id"]);
3597
+ }
3598
+ async getHistory(filter) {
3599
+ return this.data_service.getHistory(filter);
3600
+ }
3601
+ async del(filter) {
3602
+ return this.data_service.updateMany({ ...filter, deleted: false }, { deleted: true });
3603
+ }
3604
+ }
3605
+
3027
3606
  var __defProp$8 = Object.defineProperty;
3028
3607
  var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3029
3608
  var __publicField$8 = (obj, key, value) => {
@@ -3083,12 +3662,25 @@ class Cooperative {
3083
3662
  if (member.position === "chairman")
3084
3663
  chairman = { ...member, ...userData };
3085
3664
  }
3665
+ const paymentMethodModel = new PaymentMethod(this.db);
3666
+ const defaultBankAccountData = await paymentMethodModel.getOne({
3667
+ username,
3668
+ is_default: true,
3669
+ method_type: "bank_transfer",
3670
+ deleted: false,
3671
+ ...block_filter
3672
+ });
3673
+ if (!defaultBankAccountData) {
3674
+ throw new Error("\u0414\u0435\u0444\u043E\u043B\u0442\u043D\u044B\u0439 \u0431\u0430\u043D\u043A\u043E\u0432\u0441\u043A\u0438\u0439 \u0441\u0447\u0435\u0442 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043D\u043D\u044B\u0445.");
3675
+ }
3676
+ const defaultBankAccount = defaultBankAccountData.data;
3086
3677
  this.cooperative = {
3087
3678
  ...organizationPrivateData,
3088
3679
  ...mappedCooperativeData,
3089
3680
  chairman,
3090
3681
  members,
3091
- totalMembers: members.length
3682
+ totalMembers: members.length,
3683
+ defaultBankAccount
3092
3684
  };
3093
3685
  this.validate();
3094
3686
  return this.cooperative;
@@ -3104,51 +3696,10 @@ var __publicField$7 = (obj, key, value) => {
3104
3696
  __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
3105
3697
  return value;
3106
3698
  };
3107
- class PaymentMethod {
3108
- constructor(storage, data) {
3109
- __publicField$7(this, "db");
3110
- __publicField$7(this, "paymentMethod");
3111
- __publicField$7(this, "data_service");
3112
- this.db = storage;
3113
- this.paymentMethod = data;
3114
- this.data_service = new DataService$1(storage, "paymentMethods");
3115
- }
3116
- validate() {
3117
- return new Validator(paymentMethodSchema, this.paymentMethod).validate();
3118
- }
3119
- async save() {
3120
- await this.validate();
3121
- if (!this.paymentMethod)
3122
- throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u043B\u0430\u0442\u0435\u0436\u043D\u043E\u0433\u043E \u043C\u0435\u0442\u043E\u0434\u0430 \u043D\u0435 \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u044B \u0434\u043B\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F");
3123
- this.paymentMethod.deleted = false;
3124
- this.paymentMethod.block_num = await getCurrentBlock();
3125
- return await this.data_service.save(this.paymentMethod);
3126
- }
3127
- async getOne(filter) {
3128
- const result = await this.data_service.getOne(filter);
3129
- return result;
3130
- }
3131
- async getMany(filter) {
3132
- return this.data_service.getMany({ deleted: false, ...filter }, ["username", "method_id"]);
3133
- }
3134
- async getHistory(filter) {
3135
- return this.data_service.getHistory(filter);
3136
- }
3137
- async del(filter) {
3138
- return this.data_service.updateMany({ ...filter, deleted: false }, { deleted: true });
3139
- }
3140
- }
3141
-
3142
- var __defProp$6 = Object.defineProperty;
3143
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3144
- var __publicField$6 = (obj, key, value) => {
3145
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
3146
- return value;
3147
- };
3148
3699
  class Vars {
3149
3700
  constructor(storage, data) {
3150
- __publicField$6(this, "data");
3151
- __publicField$6(this, "data_service");
3701
+ __publicField$7(this, "data");
3702
+ __publicField$7(this, "data_service");
3152
3703
  this.data = data;
3153
3704
  this.data_service = new DataService$1(storage, "vars");
3154
3705
  }
@@ -3176,6 +3727,9 @@ class Vars {
3176
3727
  async getHistory(filter) {
3177
3728
  return this.data_service.getHistory(filter);
3178
3729
  }
3730
+ async update(filter, updateData) {
3731
+ return this.data_service.updateMany(filter, updateData);
3732
+ }
3179
3733
  async del(filter) {
3180
3734
  return this.data_service.updateMany(filter, { deleted: true });
3181
3735
  }
@@ -3185,6 +3739,7 @@ const projectSchema = {
3185
3739
  type: "object",
3186
3740
  properties: {
3187
3741
  id: { type: "string" },
3742
+ title: { type: "string", nullable: true, maxLength: 200 },
3188
3743
  question: { type: "string" },
3189
3744
  decision: { type: "string" },
3190
3745
  block_num: { type: "number", nullable: true },
@@ -3194,16 +3749,16 @@ const projectSchema = {
3194
3749
  additionalProperties: true
3195
3750
  };
3196
3751
 
3197
- var __defProp$5 = Object.defineProperty;
3198
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3199
- var __publicField$5 = (obj, key, value) => {
3200
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
3752
+ var __defProp$6 = Object.defineProperty;
3753
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3754
+ var __publicField$6 = (obj, key, value) => {
3755
+ __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
3201
3756
  return value;
3202
3757
  };
3203
3758
  class Project {
3204
3759
  constructor(storage, data) {
3205
- __publicField$5(this, "project");
3206
- __publicField$5(this, "data_service");
3760
+ __publicField$6(this, "project");
3761
+ __publicField$6(this, "data_service");
3207
3762
  this.project = data;
3208
3763
  this.data_service = new DataService$1(storage, "projects");
3209
3764
  }
@@ -3236,6 +3791,51 @@ class Project {
3236
3791
  }
3237
3792
  }
3238
3793
 
3794
+ var __defProp$5 = Object.defineProperty;
3795
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3796
+ var __publicField$5 = (obj, key, value) => {
3797
+ __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
3798
+ return value;
3799
+ };
3800
+ class Udata {
3801
+ constructor(storage, data) {
3802
+ __publicField$5(this, "udata");
3803
+ __publicField$5(this, "data_service");
3804
+ this.udata = data;
3805
+ this.data_service = new DataService$1(storage, "udatas");
3806
+ }
3807
+ validate() {
3808
+ return new Validator(udataSchema, this.udata).validate();
3809
+ }
3810
+ async save() {
3811
+ await this.validate();
3812
+ if (!this.udata)
3813
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u043D\u0435 \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u044B \u0434\u043B\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F");
3814
+ const currentBlock = await getCurrentBlock();
3815
+ const udata = {
3816
+ ...this.udata,
3817
+ deleted: false,
3818
+ block_num: currentBlock
3819
+ };
3820
+ return await this.data_service.save(udata);
3821
+ }
3822
+ async getOne(filter) {
3823
+ const block_filter = "block_num" in filter && typeof filter.block_num === "number" ? { block_num: { $lte: filter.block_num } } : {};
3824
+ const { block_num, ...filterWithoutBlock } = filter;
3825
+ const finalFilter = { ...filterWithoutBlock, ...block_filter };
3826
+ return this.data_service.getOne(finalFilter);
3827
+ }
3828
+ async getMany(filter) {
3829
+ return this.data_service.getMany(filter, ["coopname", "username", "key"]);
3830
+ }
3831
+ async getHistory(filter) {
3832
+ return this.data_service.getHistory(filter);
3833
+ }
3834
+ async del(filter) {
3835
+ return this.data_service.updateMany(filter, { deleted: true });
3836
+ }
3837
+ }
3838
+
3239
3839
  var __defProp$4 = Object.defineProperty;
3240
3840
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3241
3841
  var __publicField$4 = (obj, key, value) => {
@@ -3265,12 +3865,34 @@ class TransExtension {
3265
3865
  class TemplateEngine {
3266
3866
  constructor(translation) {
3267
3867
  __publicField$4(this, "env");
3268
- this.env = new nunjucks__default.Environment();
3868
+ this.env = new nunjucks__default.Environment(void 0, { autoescape: false });
3269
3869
  const transExtension = new TransExtension(translation);
3270
3870
  this.env.addExtension("TransExtension", transExtension);
3271
3871
  }
3872
+ // Декодируем HTML-сущности, если до фабрики дошёл экранированный текст (например, <div>)
3873
+ decodeHtml(value) {
3874
+ return value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
3875
+ }
3876
+ prepareVars(value) {
3877
+ if (typeof value === "string") {
3878
+ return this.decodeHtml(value);
3879
+ }
3880
+ if (Array.isArray(value)) {
3881
+ return value.map((v) => this.prepareVars(v));
3882
+ }
3883
+ if (value && typeof value === "object") {
3884
+ const result = {};
3885
+ for (const [k, v] of Object.entries(value)) {
3886
+ result[k] = this.prepareVars(v);
3887
+ }
3888
+ return result;
3889
+ }
3890
+ return value;
3891
+ }
3272
3892
  renderTemplate(template, vars) {
3273
- return this.env.renderString(template, vars);
3893
+ const prepared = this.prepareVars(vars);
3894
+ const context = prepared && typeof prepared === "object" ? prepared : {};
3895
+ return this.env.renderString(template, context);
3274
3896
  }
3275
3897
  }
3276
3898
 
@@ -3295,8 +3917,11 @@ class PDFService {
3295
3917
  static async generatePDFBuffer(htmlContent) {
3296
3918
  const tempId = uuid.v4();
3297
3919
  const tempDir = path__default.join(__dirname, "tmp");
3298
- if (!fs__default.existsSync(tempDir)) {
3299
- fs__default.mkdirSync(tempDir);
3920
+ try {
3921
+ if (!fs__default.existsSync(tempDir)) {
3922
+ fs__default.mkdirSync(tempDir, { recursive: true });
3923
+ }
3924
+ } catch (dirError) {
3300
3925
  }
3301
3926
  const tempHtmlPath = path__default.join(tempDir, `${tempId}.html`);
3302
3927
  const tempPdfPath = path__default.join(tempDir, `${tempId}.pdf`);
@@ -3317,12 +3942,24 @@ class PDFService {
3317
3942
  return new Promise((resolve, reject) => {
3318
3943
  node_child_process.exec(`SOURCE_DATE_EPOCH=0 weasyprint ${tempHtmlPath} ${tempPdfPath}`, (error) => {
3319
3944
  if (error) {
3320
- fs__default.unlinkSync(tempHtmlPath);
3945
+ try {
3946
+ if (fs__default.existsSync(tempHtmlPath)) {
3947
+ fs__default.unlinkSync(tempHtmlPath);
3948
+ }
3949
+ } catch (_cleanupError) {
3950
+ }
3321
3951
  reject(error);
3322
3952
  } else {
3323
3953
  const pdfBuffer = fs__default.readFileSync(tempPdfPath);
3324
- fs__default.unlinkSync(tempHtmlPath);
3325
- fs__default.unlinkSync(tempPdfPath);
3954
+ try {
3955
+ if (fs__default.existsSync(tempHtmlPath)) {
3956
+ fs__default.unlinkSync(tempHtmlPath);
3957
+ }
3958
+ if (fs__default.existsSync(tempPdfPath)) {
3959
+ fs__default.unlinkSync(tempPdfPath);
3960
+ }
3961
+ } catch (_cleanupError) {
3962
+ }
3326
3963
  resolve(new Uint8Array(pdfBuffer));
3327
3964
  }
3328
3965
  });
@@ -3344,7 +3981,7 @@ class PDFService {
3344
3981
 
3345
3982
  const name = "@coopenomics/factory";
3346
3983
  const type = "module";
3347
- const version = "2025.12.2-alpha-3";
3984
+ const version = "2026.2.21-1";
3348
3985
  const description = "";
3349
3986
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
3350
3987
  const license = "MIT";
@@ -3394,7 +4031,7 @@ const dependencies = {
3394
4031
  "ajv-formats": "^3.0.1",
3395
4032
  "ajv-i18n": "^4.2.0",
3396
4033
  axios: "^1.7.2",
3397
- cooptypes: "2025.12.2-alpha-3",
4034
+ cooptypes: "2026.2.21-1",
3398
4035
  dotenv: "^16.4.5",
3399
4036
  "eosjs-ecc": "^4.0.7",
3400
4037
  handlebars: "^4.7.8",
@@ -3425,7 +4062,7 @@ const devDependencies = {
3425
4062
  vite: "^5.2.11",
3426
4063
  vitest: "^1.6.0"
3427
4064
  };
3428
- const gitHead = "e27228e735ebec2df66bd808eae15089373f34b5";
4065
+ const gitHead = "a549f4cae07739be1ac9ca9e19b527430ac9a10e";
3429
4066
  const packageJson = {
3430
4067
  name: name,
3431
4068
  type: type,
@@ -3484,6 +4121,8 @@ function formatDateTime(timestamp) {
3484
4121
  return `${day} ${month} ${year} ${hours}:${minutes} (\u041C\u0441\u043A)`;
3485
4122
  }
3486
4123
 
4124
+ const isEmpty = (value) => !value || value.trim() === "";
4125
+
3487
4126
  var __defProp$3 = Object.defineProperty;
3488
4127
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3489
4128
  var __publicField$3 = (obj, key, value) => {
@@ -3643,6 +4282,35 @@ class DocFactory {
3643
4282
  // decision,
3644
4283
  };
3645
4284
  }
4285
+ async getApprovedDecision(coop, coopname, decision_id) {
4286
+ const decision = (await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-actions`, new URLSearchParams({
4287
+ filter: JSON.stringify({
4288
+ "account": cooptypes.SovietContract.contractName.production,
4289
+ "name": cooptypes.SovietContract.Actions.Decisions.Authorize.actionName,
4290
+ "receiver": cooptypes.SovietContract.contractName.production,
4291
+ "data.decision_id": String(decision_id),
4292
+ "data.coopname": coopname
4293
+ })
4294
+ })))?.results[0]?.data;
4295
+ if (!decision) {
4296
+ throw new Error(`\u041F\u0440\u0438\u043D\u044F\u0442\u043E\u0435 \u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0432 \u0434\u0435\u043B\u044C\u0442\u0430\u0445: decision_id=${decision_id}, coopname=${coopname}`);
4297
+ }
4298
+ const authorizationDoc = decision.document;
4299
+ if (!authorizationDoc) {
4300
+ throw new Error(`\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0432 \u0440\u0435\u0448\u0435\u043D\u0438\u0438: decision_id=${decision_id}`);
4301
+ }
4302
+ let decisionCreatedAt;
4303
+ try {
4304
+ const meta = JSON.parse(authorizationDoc.meta || "{}");
4305
+ decisionCreatedAt = meta.created_at;
4306
+ if (!decisionCreatedAt) {
4307
+ throw new Error("\u041F\u043E\u043B\u0435 created_at \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0432 \u043C\u0435\u0442\u0430-\u0434\u0430\u043D\u043D\u044B\u0445 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438");
4308
+ }
4309
+ } catch (error) {
4310
+ throw new Error(`\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0430\u0440\u0441\u0438\u043D\u0433\u0430 \u043C\u0435\u0442\u0430-\u0434\u0430\u043D\u043D\u044B\u0445 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0448\u0435\u043D\u0438\u044F ${decision_id}: ${error}`);
4311
+ }
4312
+ return this.getDecision(coop, coopname, decision_id, decisionCreatedAt);
4313
+ }
3646
4314
  async getMeet(coopname, meet_hash, block_num) {
3647
4315
  const block_filter = block_num ? { block_num: { $lte: block_num } } : {};
3648
4316
  const meetResponse = await getFetch(`${getEnvVar("SIMPLE_EXPLORER_API")}/get-tables`, new URLSearchParams({
@@ -3849,12 +4517,8 @@ class DocFactory {
3849
4517
  year: dateWithTimezone.format("YY")
3850
4518
  };
3851
4519
  }
3852
- constructUHDContract(created_at) {
3853
- const date = created_at ? moment__default(created_at, "DD.MM.YYYY HH:mm") : moment__default();
3854
- return {
3855
- number: `\u0423\u0425\u0414-${date.format("DD")}-${date.format("MM")}-${date.format("YY")}`,
3856
- date: date.format("DD.MM.YYYY")
3857
- };
4520
+ constructUHDContractNumber(contributor_hash) {
4521
+ return `\u0423\u0425\u0414-${this.getShortHash(contributor_hash)}`;
3858
4522
  }
3859
4523
  getCommonUser(input) {
3860
4524
  switch (input.type) {
@@ -3864,7 +4528,9 @@ class DocFactory {
3864
4528
  return {
3865
4529
  abbr_full_name: this.extractPersonalAbbreviatedName(data),
3866
4530
  full_name_or_short_name: this.getFullParticipantName(data),
3867
- birthdate_or_ogrn: data.birthdate
4531
+ birthdate_or_ogrn: data.birthdate,
4532
+ email: data.email,
4533
+ phone: data.phone
3868
4534
  };
3869
4535
  }
3870
4536
  case "organization": {
@@ -3872,13 +4538,21 @@ class DocFactory {
3872
4538
  return {
3873
4539
  abbr_full_name: this.extractOrganizationName(data),
3874
4540
  full_name_or_short_name: this.getFullParticipantName(data),
3875
- birthdate_or_ogrn: data.details.ogrn
4541
+ birthdate_or_ogrn: data.details.ogrn,
4542
+ email: data.email,
4543
+ phone: data.phone
3876
4544
  };
3877
4545
  }
3878
4546
  default:
3879
4547
  throw new Error(`cant extract common user data`);
3880
4548
  }
3881
4549
  }
4550
+ getShortHash(hash, length = 16) {
4551
+ if (hash.includes("-") || hash.includes(" ")) {
4552
+ return hash;
4553
+ }
4554
+ return hash.substring(0, length).toUpperCase();
4555
+ }
3882
4556
  async saveDraft(document) {
3883
4557
  await this.storage.saveDraft(document);
3884
4558
  }
@@ -3924,6 +4598,12 @@ class DocFactory {
3924
4598
  ...restParams
3925
4599
  };
3926
4600
  }
4601
+ formatShare(value, precision = 2) {
4602
+ const parsed = typeof value === "string" ? Number.parseFloat(value) : value;
4603
+ if (Number.isNaN(parsed))
4604
+ return typeof value === "string" ? value : value.toString();
4605
+ return parsed.toFixed(precision);
4606
+ }
3927
4607
  formatAsset(asset, precision = 2) {
3928
4608
  if (!asset)
3929
4609
  return "";
@@ -3954,21 +4634,22 @@ class DocFactory {
3954
4634
  }
3955
4635
  }
3956
4636
 
3957
- let Factory$L = class Factory extends DocFactory {
4637
+ let Factory$W = class Factory extends DocFactory {
3958
4638
  constructor(storage) {
3959
4639
  super(storage);
3960
4640
  }
3961
4641
  async generateDocument(data, options) {
3962
4642
  let template;
3963
4643
  if (process.env.SOURCE === "local") {
3964
- template = Template$L;
4644
+ template = Template$W;
3965
4645
  } else {
3966
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$L, data.block_num);
4646
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$W, data.block_num);
3967
4647
  }
3968
4648
  const meta = await super.getMeta({ title: template.title, ...data });
3969
4649
  const coop = await super.getCooperative(data.coopname, data.block_num);
3970
4650
  const vars = await super.getVars(data.coopname, data.block_num);
3971
- const user = await super.getUser(data.username, data.block_num);
4651
+ if (!vars?.wallet_agreement || isEmpty(vars.wallet_agreement.protocol_number) || isEmpty(vars.wallet_agreement.protocol_day_month_year))
4652
+ throw new Error("\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0434\u043B\u044F \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043E \u0426\u041F\u041F \u043D\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u044B. \u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u0445 \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u044E.");
3972
4653
  const combinedData = {
3973
4654
  meta,
3974
4655
  coop,
@@ -3976,26 +4657,27 @@ let Factory$L = class Factory extends DocFactory {
3976
4657
  };
3977
4658
  await super.validate(combinedData, template.model);
3978
4659
  const translation = template.translations[meta.lang];
3979
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4660
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
3980
4661
  return document;
3981
4662
  }
3982
4663
  };
3983
4664
 
3984
- let Factory$K = class Factory extends DocFactory {
4665
+ let Factory$V = class Factory extends DocFactory {
3985
4666
  constructor(storage) {
3986
4667
  super(storage);
3987
4668
  }
3988
4669
  async generateDocument(data, options) {
3989
4670
  let template;
3990
4671
  if (process.env.SOURCE === "local") {
3991
- template = Template$K;
4672
+ template = Template$V;
3992
4673
  } else {
3993
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$K, data.block_num);
4674
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$V, data.block_num);
3994
4675
  }
3995
4676
  const meta = await super.getMeta({ title: template.title, ...data });
3996
4677
  const coop = await super.getCooperative(data.coopname, data.block_num);
3997
4678
  const vars = await super.getVars(data.coopname, data.block_num);
3998
- const user = await super.getUser(data.username, data.block_num);
4679
+ if (!vars?.signature_agreement || isEmpty(vars.signature_agreement.protocol_number) || isEmpty(vars.signature_agreement.protocol_day_month_year))
4680
+ throw new Error("\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043F\u043E \u043F\u0440\u043E\u0441\u0442\u043E\u0439 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u0438 \u043D\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u044B. \u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043D\u043E\u043C\u0435\u0440 \u0438 \u0434\u0430\u0442\u0443 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430.");
3999
4681
  const combinedData = {
4000
4682
  meta,
4001
4683
  coop,
@@ -4003,26 +4685,27 @@ let Factory$K = class Factory extends DocFactory {
4003
4685
  };
4004
4686
  await super.validate(combinedData, template.model);
4005
4687
  const translation = template.translations[meta.lang];
4006
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4688
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4007
4689
  return document;
4008
4690
  }
4009
4691
  };
4010
4692
 
4011
- let Factory$J = class Factory extends DocFactory {
4693
+ let Factory$U = class Factory extends DocFactory {
4012
4694
  constructor(storage) {
4013
4695
  super(storage);
4014
4696
  }
4015
4697
  async generateDocument(data, options) {
4016
4698
  let template;
4017
4699
  if (process.env.SOURCE === "local") {
4018
- template = Template$J;
4700
+ template = Template$U;
4019
4701
  } else {
4020
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$J, data.block_num);
4702
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$U, data.block_num);
4021
4703
  }
4022
4704
  const meta = await super.getMeta({ title: template.title, ...data });
4023
4705
  const coop = await super.getCooperative(data.coopname, data.block_num);
4024
4706
  const vars = await super.getVars(data.coopname, data.block_num);
4025
- const user = await super.getUser(data.username, data.block_num);
4707
+ if (!vars?.privacy_agreement || isEmpty(vars.privacy_agreement.protocol_number) || isEmpty(vars.privacy_agreement.protocol_day_month_year))
4708
+ throw new Error("\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043F\u043E \u043F\u043E\u043B\u0438\u0442\u0438\u043A\u0435 \u043A\u043E\u043D\u0444\u0438\u0434\u0435\u043D\u0446\u0438\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043D\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u044B. \u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043D\u043E\u043C\u0435\u0440 \u0438 \u0434\u0430\u0442\u0443 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430.");
4026
4709
  const combinedData = {
4027
4710
  meta,
4028
4711
  coop,
@@ -4030,27 +4713,29 @@ let Factory$J = class Factory extends DocFactory {
4030
4713
  };
4031
4714
  await super.validate(combinedData, template.model);
4032
4715
  const translation = template.translations[meta.lang];
4033
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4716
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4034
4717
  return document;
4035
4718
  }
4036
4719
  };
4037
4720
 
4038
- let Factory$I = class Factory extends DocFactory {
4721
+ let Factory$T = class Factory extends DocFactory {
4039
4722
  constructor(storage) {
4040
4723
  super(storage);
4041
4724
  }
4042
4725
  async generateDocument(data, options) {
4043
4726
  let template;
4044
4727
  if (process.env.SOURCE === "local") {
4045
- template = Template$I;
4728
+ template = Template$T;
4046
4729
  } else {
4047
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$I, data.block_num);
4730
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$T, data.block_num);
4048
4731
  }
4049
4732
  const meta = await super.getMeta({ title: template.title, ...data });
4050
4733
  const coop = await super.getCooperative(data.coopname, data.block_num);
4051
4734
  const vars = await super.getVars(data.coopname, data.block_num);
4052
4735
  const user = await super.getUser(data.username, data.block_num);
4053
4736
  const full_name = super.getFullName(user.data);
4737
+ if (!vars?.user_agreement || isEmpty(vars.user_agreement.protocol_number) || isEmpty(vars.user_agreement.protocol_day_month_year))
4738
+ throw new Error("\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043F\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u043C\u0443 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044E \u043D\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u044B. \u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043D\u043E\u043C\u0435\u0440 \u0438 \u0434\u0430\u0442\u0443 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430.");
4054
4739
  const combinedData = {
4055
4740
  meta,
4056
4741
  coop,
@@ -4061,27 +4746,26 @@ let Factory$I = class Factory extends DocFactory {
4061
4746
  };
4062
4747
  await super.validate(combinedData, template.model);
4063
4748
  const translation = template.translations[meta.lang];
4064
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4749
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4065
4750
  return document;
4066
4751
  }
4067
4752
  };
4068
4753
 
4069
- let Factory$H = class Factory extends DocFactory {
4754
+ let Factory$S = class Factory extends DocFactory {
4070
4755
  constructor(storage) {
4071
4756
  super(storage);
4072
4757
  }
4073
4758
  async generateDocument(data, options) {
4074
4759
  let template;
4075
4760
  if (process.env.SOURCE === "local") {
4076
- template = Template$H;
4761
+ template = Template$S;
4077
4762
  } else {
4078
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$H, data.block_num);
4763
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$S, data.block_num);
4079
4764
  }
4080
4765
  const meta = await super.getMeta({ title: template.title, ...data });
4081
4766
  const coop = await super.getCooperative(data.coopname, data.block_num);
4082
4767
  const vars = await super.getVars(data.coopname, data.block_num);
4083
4768
  const partner = await super.getOrganization(data.username, data.block_num);
4084
- const user = await super.getUser(data.username, data.block_num);
4085
4769
  const combinedData = {
4086
4770
  meta,
4087
4771
  coop,
@@ -4090,21 +4774,21 @@ let Factory$H = class Factory extends DocFactory {
4090
4774
  };
4091
4775
  await super.validate(combinedData, template.model);
4092
4776
  const translation = template.translations[meta.lang];
4093
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4777
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4094
4778
  return document;
4095
4779
  }
4096
4780
  };
4097
4781
 
4098
- let Factory$G = class Factory extends DocFactory {
4782
+ let Factory$R = class Factory extends DocFactory {
4099
4783
  constructor(storage) {
4100
4784
  super(storage);
4101
4785
  }
4102
4786
  async generateDocument(data, options) {
4103
4787
  let template;
4104
4788
  if (process.env.SOURCE === "local") {
4105
- template = Template$G;
4789
+ template = Template$R;
4106
4790
  } else {
4107
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$G, data.block_num);
4791
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$R, data.block_num);
4108
4792
  }
4109
4793
  const meta = await super.getMeta({ title: template.title, ...data });
4110
4794
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -4119,21 +4803,21 @@ let Factory$G = class Factory extends DocFactory {
4119
4803
  };
4120
4804
  await super.validate(combinedData, template.model);
4121
4805
  const translation = template.translations[meta.lang];
4122
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
4806
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4123
4807
  return document;
4124
4808
  }
4125
4809
  };
4126
4810
 
4127
- let Factory$F = class Factory extends DocFactory {
4811
+ let Factory$Q = class Factory extends DocFactory {
4128
4812
  constructor(storage) {
4129
4813
  super(storage);
4130
4814
  }
4131
4815
  async generateDocument(data, _options) {
4132
4816
  let template;
4133
4817
  if (process.env.SOURCE === "local") {
4134
- template = Template$D;
4818
+ template = Template$O;
4135
4819
  } else {
4136
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$D, data.block_num);
4820
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$O, data.block_num);
4137
4821
  }
4138
4822
  const user = await super.getUser(data.username, data.block_num);
4139
4823
  const userData = {
@@ -4147,24 +4831,26 @@ let Factory$F = class Factory extends DocFactory {
4147
4831
  const branch = await super.getOrganization(data.braname, data.block_num);
4148
4832
  const meta = await super.getMeta({ title: template.title, ...data });
4149
4833
  const vars = await super.getVars(data.coopname, data.block_num);
4834
+ if (!vars?.participant_application || isEmpty(vars.participant_application.protocol_number) || isEmpty(vars.participant_application.protocol_day_month_year))
4835
+ throw new Error("\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0434\u043B\u044F \u0437\u0430\u044F\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u0430 \u0432\u0441\u0442\u0443\u043F\u043B\u0435\u043D\u0438\u0435 \u043D\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u044B. \u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u043D\u043E\u043C\u0435\u0440 \u0438 \u0434\u0430\u0442\u0443 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430.");
4150
4836
  const combinedData = { ...userData, meta, branch, type: user.type, vars, coop };
4151
4837
  await super.validate(combinedData, template.model);
4152
4838
  const translation = template.translations[meta.lang];
4153
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, data.skip_save);
4839
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, data.skip_save);
4154
4840
  return document;
4155
4841
  }
4156
4842
  };
4157
4843
 
4158
- let Factory$E = class Factory extends DocFactory {
4844
+ let Factory$P = class Factory extends DocFactory {
4159
4845
  constructor(storage) {
4160
4846
  super(storage);
4161
4847
  }
4162
4848
  async generateDocument(data, _options) {
4163
4849
  let template;
4164
4850
  if (process.env.SOURCE === "local") {
4165
- template = Template$F;
4851
+ template = Template$Q;
4166
4852
  } else {
4167
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$F, data.block_num);
4853
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$Q, data.block_num);
4168
4854
  }
4169
4855
  const user = await super.getUser(data.username, data.block_num);
4170
4856
  let bank_account = {};
@@ -4205,6 +4891,8 @@ let Factory$E = class Factory extends DocFactory {
4205
4891
  }
4206
4892
  }
4207
4893
  const vars = await super.getVars(data.coopname, data.block_num);
4894
+ if (!vars?.participant_application || isEmpty(vars.participant_application.protocol_number) || isEmpty(vars.participant_application.protocol_day_month_year))
4895
+ throw new Error("\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0434\u043B\u044F \u0437\u0430\u044F\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u0430 \u0432\u0441\u0442\u0443\u043F\u043B\u0435\u043D\u0438\u0435 \u043D\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u044B. \u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u043D\u043E\u043C\u0435\u0440 \u0438 \u0434\u0430\u0442\u0443 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430.");
4208
4896
  const combinedData = {
4209
4897
  ...userData,
4210
4898
  meta,
@@ -4220,21 +4908,21 @@ let Factory$E = class Factory extends DocFactory {
4220
4908
  };
4221
4909
  await super.validate(combinedData, template.model);
4222
4910
  const translation = template.translations[meta.lang];
4223
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, data.skip_save);
4911
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, data.skip_save);
4224
4912
  return document;
4225
4913
  }
4226
4914
  };
4227
4915
 
4228
- let Factory$D = class Factory extends DocFactory {
4916
+ let Factory$O = class Factory extends DocFactory {
4229
4917
  constructor(storage) {
4230
4918
  super(storage);
4231
4919
  }
4232
4920
  async generateDocument(data, options) {
4233
4921
  let template;
4234
4922
  if (process.env.SOURCE === "local") {
4235
- template = Template$E;
4923
+ template = Template$P;
4236
4924
  } else {
4237
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$E, data.block_num);
4925
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$P, data.block_num);
4238
4926
  }
4239
4927
  const user = await super.getUser(data.username, data.block_num);
4240
4928
  const userData = {
@@ -4274,16 +4962,16 @@ let Factory$D = class Factory extends DocFactory {
4274
4962
  }
4275
4963
  };
4276
4964
 
4277
- let Factory$C = class Factory extends DocFactory {
4965
+ let Factory$N = class Factory extends DocFactory {
4278
4966
  constructor(storage) {
4279
4967
  super(storage);
4280
4968
  }
4281
4969
  async generateDocument(data, options) {
4282
4970
  let template;
4283
4971
  if (process.env.SOURCE === "local") {
4284
- template = Template$C;
4972
+ template = Template$N;
4285
4973
  } else {
4286
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$C, data.block_num);
4974
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$N, data.block_num);
4287
4975
  }
4288
4976
  const user = await this.getUser(data.username, data.block_num);
4289
4977
  const suggester_name = await this.getFullName(user.data);
@@ -4291,11 +4979,12 @@ let Factory$C = class Factory extends DocFactory {
4291
4979
  [user.type]: user.data
4292
4980
  };
4293
4981
  const coop = await this.getCooperative(data.coopname, data.block_num);
4982
+ const project = await this.getProject(data.project_id, data.block_num);
4983
+ const metaTitle = data.title?.trim()?.substring(0, 200) || project.title?.trim()?.substring(0, 200) || template.title;
4294
4984
  const meta = await this.getMeta({
4295
- title: template.title,
4296
- ...data
4985
+ ...data,
4986
+ title: metaTitle
4297
4987
  });
4298
- const project = await this.getProject(data.project_id, data.block_num);
4299
4988
  const vars = await super.getVars(data.coopname, data.block_num);
4300
4989
  const combinedData = {
4301
4990
  ...userData,
@@ -4319,16 +5008,16 @@ let Factory$C = class Factory extends DocFactory {
4319
5008
  }
4320
5009
  };
4321
5010
 
4322
- let Factory$B = class Factory extends DocFactory {
5011
+ let Factory$M = class Factory extends DocFactory {
4323
5012
  constructor(storage) {
4324
5013
  super(storage);
4325
5014
  }
4326
5015
  async generateDocument(data, options) {
4327
5016
  let template;
4328
5017
  if (process.env.SOURCE === "local") {
4329
- template = Template$B;
5018
+ template = Template$M;
4330
5019
  } else {
4331
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$B, data.block_num);
5020
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$M, data.block_num);
4332
5021
  }
4333
5022
  const user = await this.getUser(data.username, data.block_num);
4334
5023
  const userData = {
@@ -4371,16 +5060,16 @@ let Factory$B = class Factory extends DocFactory {
4371
5060
  }
4372
5061
  };
4373
5062
 
4374
- let Factory$A = class Factory extends DocFactory {
5063
+ let Factory$L = class Factory extends DocFactory {
4375
5064
  constructor(storage) {
4376
5065
  super(storage);
4377
5066
  }
4378
5067
  async generateDocument(data, options) {
4379
5068
  let template;
4380
5069
  if (process.env.SOURCE === "local") {
4381
- template = Template$A;
5070
+ template = Template$L;
4382
5071
  } else {
4383
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$A, data.block_num);
5072
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$L, data.block_num);
4384
5073
  }
4385
5074
  const meta = await super.getMeta({ title: template.title, ...data });
4386
5075
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -4402,16 +5091,16 @@ let Factory$A = class Factory extends DocFactory {
4402
5091
  }
4403
5092
  };
4404
5093
 
4405
- let Factory$z = class Factory extends DocFactory {
5094
+ let Factory$K = class Factory extends DocFactory {
4406
5095
  constructor(storage) {
4407
5096
  super(storage);
4408
5097
  }
4409
5098
  async generateDocument(data, options) {
4410
5099
  let template;
4411
5100
  if (process.env.SOURCE === "local") {
4412
- template = Template$z;
5101
+ template = Template$K;
4413
5102
  } else {
4414
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$z, data.block_num);
5103
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$K, data.block_num);
4415
5104
  }
4416
5105
  const meta = await this.getMeta({ title: template.title, ...data });
4417
5106
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -4433,7 +5122,7 @@ let Factory$z = class Factory extends DocFactory {
4433
5122
  }
4434
5123
  };
4435
5124
 
4436
- let Factory$y = class Factory extends DocFactory {
5125
+ let Factory$J = class Factory extends DocFactory {
4437
5126
  constructor(storage) {
4438
5127
  super(storage);
4439
5128
  }
@@ -4447,7 +5136,7 @@ let Factory$y = class Factory extends DocFactory {
4447
5136
  const meta = await super.getMeta({ title: template.title, ...data });
4448
5137
  const coop = await super.getCooperative(data.coopname, data.block_num);
4449
5138
  const vars = await super.getVars(data.coopname, data.block_num);
4450
- const user = await super.getUser(data.username, data.block_num);
5139
+ await super.getUser(data.username, data.block_num);
4451
5140
  const combinedData = {
4452
5141
  meta,
4453
5142
  coop,
@@ -4455,21 +5144,21 @@ let Factory$y = class Factory extends DocFactory {
4455
5144
  };
4456
5145
  await super.validate(combinedData, template.model);
4457
5146
  const translation = template.translations[meta.lang];
4458
- const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, options?.skip_save);
5147
+ const document = await super.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4459
5148
  return document;
4460
5149
  }
4461
5150
  };
4462
5151
 
4463
- let Factory$x = class Factory extends DocFactory {
5152
+ let Factory$I = class Factory extends DocFactory {
4464
5153
  constructor(storage) {
4465
5154
  super(storage);
4466
5155
  }
4467
5156
  async generateDocument(data, options) {
4468
5157
  let template;
4469
5158
  if (process.env.SOURCE === "local") {
4470
- template = Template$y;
5159
+ template = Template$J;
4471
5160
  } else {
4472
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$y, data.block_num);
5161
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$J, data.block_num);
4473
5162
  }
4474
5163
  const meta = await this.getMeta({ title: template.title, ...data });
4475
5164
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -4493,23 +5182,23 @@ let Factory$x = class Factory extends DocFactory {
4493
5182
  }
4494
5183
  };
4495
5184
 
4496
- let Factory$w = class Factory extends DocFactory {
5185
+ let Factory$H = class Factory extends DocFactory {
4497
5186
  constructor(storage) {
4498
5187
  super(storage);
4499
5188
  }
4500
5189
  async generateDocument(data, options) {
4501
5190
  let template;
4502
5191
  if (process.env.SOURCE === "local") {
4503
- template = Template$w;
5192
+ template = Template$H;
4504
5193
  } else {
4505
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$w, data.block_num);
5194
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$H, data.block_num);
4506
5195
  }
4507
5196
  const meta = await this.getMeta({ title: template.title, ...data });
4508
5197
  const coop = await this.getCooperative(data.coopname, data.block_num);
4509
5198
  const vars = await this.getVars(data.coopname, data.block_num);
4510
5199
  const user = await this.getUser(data.username, data.block_num);
4511
5200
  const request = await this.getRequest(data.request_id, data.block_num);
4512
- const decision = await this.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
5201
+ const decision = await this.getApprovedDecision(coop, data.coopname, data.decision_id);
4513
5202
  const commonUser = this.getCommonUser(user);
4514
5203
  const receiver = await this.getUser(data.receiver, data.block_num);
4515
5204
  if (coop.is_branched && !data.braname)
@@ -4537,16 +5226,16 @@ let Factory$w = class Factory extends DocFactory {
4537
5226
  }
4538
5227
  };
4539
5228
 
4540
- let Factory$v = class Factory extends DocFactory {
5229
+ let Factory$G = class Factory extends DocFactory {
4541
5230
  constructor(storage) {
4542
5231
  super(storage);
4543
5232
  }
4544
5233
  async generateDocument(data, options) {
4545
5234
  let template;
4546
5235
  if (process.env.SOURCE === "local") {
4547
- template = Template$x;
5236
+ template = Template$I;
4548
5237
  } else {
4549
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$x, data.block_num);
5238
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$I, data.block_num);
4550
5239
  }
4551
5240
  const meta = await this.getMeta({ title: template.title, ...data });
4552
5241
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -4570,23 +5259,23 @@ let Factory$v = class Factory extends DocFactory {
4570
5259
  }
4571
5260
  };
4572
5261
 
4573
- let Factory$u = class Factory extends DocFactory {
5262
+ let Factory$F = class Factory extends DocFactory {
4574
5263
  constructor(storage) {
4575
5264
  super(storage);
4576
5265
  }
4577
5266
  async generateDocument(data, options) {
4578
5267
  let template;
4579
5268
  if (process.env.SOURCE === "local") {
4580
- template = Template$v;
5269
+ template = Template$G;
4581
5270
  } else {
4582
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$v, data.block_num);
5271
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$G, data.block_num);
4583
5272
  }
4584
5273
  const meta = await this.getMeta({ title: template.title, ...data });
4585
5274
  const coop = await this.getCooperative(data.coopname, data.block_num);
4586
5275
  const vars = await this.getVars(data.coopname, data.block_num);
4587
5276
  const user = await this.getUser(data.username, data.block_num);
4588
5277
  const request = await this.getRequest(data.request_id, data.block_num);
4589
- const decision = await this.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
5278
+ const decision = await this.getApprovedDecision(coop, data.coopname, data.decision_id);
4590
5279
  const commonUser = this.getCommonUser(user);
4591
5280
  const transmitter = await this.getUser(data.transmitter, data.block_num);
4592
5281
  if (coop.is_branched && !data.braname)
@@ -4599,22 +5288,287 @@ let Factory$u = class Factory extends DocFactory {
4599
5288
  meta,
4600
5289
  coop,
4601
5290
  vars,
4602
- user: commonUser,
4603
- request,
4604
- decision,
4605
- program,
4606
- act_id: data.act_id,
4607
- transmitter: this.getFirstLastMiddleName(transmitter.data),
4608
- branch
5291
+ user: commonUser,
5292
+ request,
5293
+ decision,
5294
+ program,
5295
+ act_id: data.act_id,
5296
+ transmitter: this.getFirstLastMiddleName(transmitter.data),
5297
+ branch
5298
+ };
5299
+ await this.validate(combinedData, template.model);
5300
+ const translation = template.translations[meta.lang];
5301
+ const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
5302
+ return document;
5303
+ }
5304
+ };
5305
+
5306
+ let Factory$E = class Factory extends DocFactory {
5307
+ constructor(storage) {
5308
+ super(storage);
5309
+ }
5310
+ async generateDocument(data, options) {
5311
+ let template;
5312
+ if (process.env.SOURCE === "local") {
5313
+ template = Template$F;
5314
+ } else {
5315
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$F, data.block_num);
5316
+ }
5317
+ console.log(data);
5318
+ const meta = await this.getMeta({ title: template.title, ...data });
5319
+ const coop = await this.getCooperative(data.coopname, data.block_num);
5320
+ const vars = await this.getVars(data.coopname, data.block_num);
5321
+ const user = await this.getUser(data.username, data.block_num);
5322
+ const commonUser = this.getCommonUser(user);
5323
+ const paymentMethodService = new PaymentMethod(this.storage);
5324
+ const paymentMethod = await paymentMethodService.getOne({
5325
+ method_id: data.method_id,
5326
+ username: data.username,
5327
+ deleted: false
5328
+ });
5329
+ if (!paymentMethod) {
5330
+ throw new Error(`\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u044B\u0439 \u043C\u0435\u0442\u043E\u0434 \u0441 ID ${data.method_id} \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0434\u043B\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F ${data.username}`);
5331
+ }
5332
+ const combinedData = {
5333
+ meta,
5334
+ coop,
5335
+ vars,
5336
+ user: commonUser,
5337
+ payment_details: this.formatPaymentDetails(paymentMethod, commonUser.full_name_or_short_name),
5338
+ quantity: data.quantity,
5339
+ currency: data.currency,
5340
+ payment_hash: data.payment_hash
5341
+ };
5342
+ await this.validate(combinedData, template.model);
5343
+ const translation = template.translations[meta.lang];
5344
+ const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
5345
+ return document;
5346
+ }
5347
+ };
5348
+
5349
+ let Factory$D = class Factory extends DocFactory {
5350
+ constructor(storage) {
5351
+ super(storage);
5352
+ }
5353
+ async generateDocument(data, options) {
5354
+ let template;
5355
+ if (process.env.SOURCE === "local") {
5356
+ template = Template$E;
5357
+ } else {
5358
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$E, data.block_num);
5359
+ }
5360
+ const user = await super.getUser(data.username, data.block_num);
5361
+ const coop = await super.getCooperative(data.coopname, data.block_num);
5362
+ const vars = await super.getVars(data.coopname, data.block_num);
5363
+ const meta = await super.getMeta({
5364
+ title: template.title,
5365
+ ...data
5366
+ });
5367
+ const decision = await super.getDecision(
5368
+ coop,
5369
+ data.coopname,
5370
+ data.decision_id,
5371
+ meta.created_at
5372
+ );
5373
+ const combinedData = {
5374
+ vars,
5375
+ meta,
5376
+ coop,
5377
+ decision,
5378
+ user: super.getCommonUser(user),
5379
+ quantity: data.quantity,
5380
+ currency: data.currency
5381
+ };
5382
+ await super.validate(combinedData, template.model);
5383
+ const translation = template.translations[meta.lang];
5384
+ const document = await super.generatePDF(
5385
+ user.data,
5386
+ template.context,
5387
+ combinedData,
5388
+ translation,
5389
+ meta,
5390
+ options?.skip_save
5391
+ );
5392
+ return document;
5393
+ }
5394
+ };
5395
+
5396
+ let Factory$C = class Factory extends DocFactory {
5397
+ constructor(storage) {
5398
+ super(storage);
5399
+ }
5400
+ async generateDocument(data, options) {
5401
+ let template;
5402
+ if (process.env.SOURCE === "local") {
5403
+ template = Template$x;
5404
+ } else {
5405
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, 1e3, data.block_num);
5406
+ }
5407
+ const meta = await this.getMeta({ title: template.title, ...data });
5408
+ const vars = await this.getVars(data.coopname);
5409
+ const coop = await this.getCooperative(data.coopname);
5410
+ const userData = await this.getUser(data.username, data.block_num);
5411
+ const common_user = this.getCommonUser(userData);
5412
+ if (!vars.blagorost_program?.protocol_number || !vars.blagorost_program?.protocol_day_month_year) {
5413
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043E\u0431 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438 \u041F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u043E \u0426\u041F\u041F \xAB\u0411\u041B\u0410\u0413\u041E\u0420\u041E\u0421\u0422\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u041F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430.");
5414
+ }
5415
+ if (!vars.blagorost_offer_template?.protocol_number || !vars.blagorost_offer_template?.protocol_day_month_year) {
5416
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043E\u0431 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0430 \u043F\u0443\u0431\u043B\u0438\u0447\u043D\u043E\u0439 \u043E\u0444\u0435\u0440\u0442\u044B \u0426\u041F\u041F \xAB\u0411\u041B\u0410\u0413\u041E\u0420\u041E\u0421\u0422\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u0448\u0430\u0431\u043B\u043E\u043D \u043E\u0444\u0435\u0440\u0442\u044B \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430.");
5417
+ }
5418
+ const udataService = new Udata(this.storage);
5419
+ const blagorostAgreementUdata = await udataService.getOne({
5420
+ coopname: data.coopname,
5421
+ username: data.username,
5422
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER,
5423
+ block_num: data.block_num
5424
+ });
5425
+ if (!blagorostAgreementUdata?.value) {
5426
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
5427
+ }
5428
+ const blagorostAgreementCreatedAtUdata = await udataService.getOne({
5429
+ coopname: data.coopname,
5430
+ username: data.username,
5431
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT,
5432
+ block_num: data.block_num
5433
+ });
5434
+ if (!blagorostAgreementCreatedAtUdata?.value) {
5435
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
5436
+ }
5437
+ const combinedData = {
5438
+ meta,
5439
+ coop,
5440
+ vars,
5441
+ common_user,
5442
+ blagorost_agreement_number: String(blagorostAgreementUdata.value),
5443
+ blagorost_agreement_created_at: String(blagorostAgreementCreatedAtUdata.value)
5444
+ };
5445
+ await this.validate(combinedData, template.model);
5446
+ const translation = template.translations[meta.lang];
5447
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
5448
+ return document;
5449
+ }
5450
+ };
5451
+
5452
+ let Factory$B = class Factory extends DocFactory {
5453
+ constructor(storage) {
5454
+ super(storage);
5455
+ }
5456
+ async generateDocument(data, options) {
5457
+ let template;
5458
+ if (process.env.SOURCE === "local") {
5459
+ template = Template$w;
5460
+ } else {
5461
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$w, data.block_num);
5462
+ }
5463
+ const meta = await this.getMeta({ title: template.title, ...data });
5464
+ const coop = await super.getCooperative(data.coopname, data.block_num);
5465
+ const vars = await super.getVars(data.coopname, data.block_num);
5466
+ if (!vars.generation_contract_template?.protocol_number || !vars.generation_contract_template?.protocol_day_month_year) {
5467
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043E\u0431 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0435 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u0435 \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430.");
5468
+ }
5469
+ const userData = await super.getUser(data.username, data.block_num);
5470
+ const user = super.getCommonUser(userData);
5471
+ const udataService = new Udata(this.storage);
5472
+ const contributorContractUdata = await udataService.getOne({
5473
+ coopname: data.coopname,
5474
+ username: data.username,
5475
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
5476
+ block_num: data.block_num
5477
+ });
5478
+ if (!contributorContractUdata?.value) {
5479
+ throw new Error(
5480
+ `\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata \u0434\u043B\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F ${data.username}. \u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0441\u043D\u0430\u0447\u0430\u043B\u0430 \u0441\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 UdataDocumentParametersService.`
5481
+ );
5482
+ }
5483
+ const combinedData = {
5484
+ meta,
5485
+ coop,
5486
+ vars,
5487
+ user,
5488
+ contributor_contract_number: String(contributorContractUdata.value)
5489
+ };
5490
+ await this.validate(combinedData, template.model);
5491
+ const translation = template.translations[meta.lang];
5492
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
5493
+ return document;
5494
+ }
5495
+ };
5496
+
5497
+ let Factory$A = class Factory extends DocFactory {
5498
+ constructor(storage) {
5499
+ super(storage);
5500
+ }
5501
+ async generateDocument(data, options) {
5502
+ let template;
5503
+ if (process.env.SOURCE === "local") {
5504
+ template = Template$v;
5505
+ } else {
5506
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$v, data.block_num);
5507
+ }
5508
+ const meta = await this.getMeta({ title: template.title, ...data });
5509
+ const coop = await super.getCooperative(data.coopname, data.block_num);
5510
+ const vars = await super.getVars(data.coopname, data.block_num);
5511
+ const userData = await super.getUser(data.username, data.block_num);
5512
+ const user = super.getCommonUser(userData);
5513
+ const udataService = new Udata(this.storage);
5514
+ const generatorAgreementUdata = await udataService.getOne({
5515
+ coopname: data.coopname,
5516
+ username: data.username,
5517
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER,
5518
+ block_num: data.block_num
5519
+ });
5520
+ if (!generatorAgreementUdata?.value) {
5521
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
5522
+ }
5523
+ const generatorAgreementCreatedAtUdata = await udataService.getOne({
5524
+ coopname: data.coopname,
5525
+ username: data.username,
5526
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT,
5527
+ block_num: data.block_num
5528
+ });
5529
+ if (!generatorAgreementCreatedAtUdata?.value) {
5530
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
5531
+ }
5532
+ const contributorContractUdata = await udataService.getOne({
5533
+ coopname: data.coopname,
5534
+ username: data.username,
5535
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
5536
+ block_num: data.block_num
5537
+ });
5538
+ if (!contributorContractUdata?.value) {
5539
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
5540
+ }
5541
+ const contributorContractCreatedAtUdata = await udataService.getOne({
5542
+ coopname: data.coopname,
5543
+ username: data.username,
5544
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
5545
+ block_num: data.block_num
5546
+ });
5547
+ if (!contributorContractCreatedAtUdata?.value) {
5548
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
5549
+ }
5550
+ const combinedData = {
5551
+ meta,
5552
+ coop,
5553
+ vars,
5554
+ user,
5555
+ appendix_hash: data.appendix_hash,
5556
+ short_appendix_hash: this.getShortHash(data.appendix_hash),
5557
+ contributor_contract_number: String(contributorContractUdata.value),
5558
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
5559
+ project_name: data.project_name,
5560
+ project_hash: data.project_hash,
5561
+ generator_agreement_number: String(generatorAgreementUdata.value),
5562
+ generator_agreement_created_at: String(generatorAgreementCreatedAtUdata.value)
4609
5563
  };
4610
5564
  await this.validate(combinedData, template.model);
4611
5565
  const translation = template.translations[meta.lang];
4612
- const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
5566
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4613
5567
  return document;
4614
5568
  }
4615
5569
  };
4616
5570
 
4617
- let Factory$t = class Factory extends DocFactory {
5571
+ let Factory$z = class Factory extends DocFactory {
4618
5572
  constructor(storage) {
4619
5573
  super(storage);
4620
5574
  }
@@ -4625,39 +5579,72 @@ let Factory$t = class Factory extends DocFactory {
4625
5579
  } else {
4626
5580
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$u, data.block_num);
4627
5581
  }
4628
- console.log(data);
4629
5582
  const meta = await this.getMeta({ title: template.title, ...data });
4630
- const coop = await this.getCooperative(data.coopname, data.block_num);
4631
- const vars = await this.getVars(data.coopname, data.block_num);
4632
- const user = await this.getUser(data.username, data.block_num);
4633
- const commonUser = this.getCommonUser(user);
4634
- const paymentMethodService = new PaymentMethod(this.storage);
4635
- const paymentMethod = await paymentMethodService.getOne({
4636
- method_id: data.method_id,
5583
+ const coop = await super.getCooperative(data.coopname, data.block_num);
5584
+ const vars = await super.getVars(data.coopname, data.block_num);
5585
+ const userData = await super.getUser(data.username, data.block_num);
5586
+ const user = super.getCommonUser(userData);
5587
+ const udataService = new Udata(this.storage);
5588
+ const generatorAgreementUdata = await udataService.getOne({
5589
+ coopname: data.coopname,
4637
5590
  username: data.username,
4638
- deleted: false
5591
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER,
5592
+ block_num: data.block_num
4639
5593
  });
4640
- if (!paymentMethod) {
4641
- throw new Error(`\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u044B\u0439 \u043C\u0435\u0442\u043E\u0434 \u0441 ID ${data.method_id} \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0434\u043B\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F ${data.username}`);
5594
+ if (!generatorAgreementUdata?.value) {
5595
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
5596
+ }
5597
+ const generatorAgreementCreatedAtUdata = await udataService.getOne({
5598
+ coopname: data.coopname,
5599
+ username: data.username,
5600
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT,
5601
+ block_num: data.block_num
5602
+ });
5603
+ if (!generatorAgreementCreatedAtUdata?.value) {
5604
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
5605
+ }
5606
+ const contributorContractUdata = await udataService.getOne({
5607
+ coopname: data.coopname,
5608
+ username: data.username,
5609
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
5610
+ block_num: data.block_num
5611
+ });
5612
+ if (!contributorContractUdata?.value) {
5613
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
5614
+ }
5615
+ const contributorContractCreatedAtUdata = await udataService.getOne({
5616
+ coopname: data.coopname,
5617
+ username: data.username,
5618
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
5619
+ block_num: data.block_num
5620
+ });
5621
+ if (!contributorContractCreatedAtUdata?.value) {
5622
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
4642
5623
  }
4643
5624
  const combinedData = {
4644
5625
  meta,
4645
5626
  coop,
4646
5627
  vars,
4647
- user: commonUser,
4648
- payment_details: this.formatPaymentDetails(paymentMethod, commonUser.full_name_or_short_name),
4649
- quantity: data.quantity,
4650
- currency: data.currency,
4651
- payment_hash: data.payment_hash
5628
+ user,
5629
+ appendix_hash: data.appendix_hash,
5630
+ short_appendix_hash: this.getShortHash(data.appendix_hash),
5631
+ parent_appendix_hash: data.parent_appendix_hash,
5632
+ short_parent_appendix_hash: this.getShortHash(data.parent_appendix_hash),
5633
+ contributor_contract_number: String(contributorContractUdata.value),
5634
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
5635
+ component_name: data.component_name,
5636
+ component_hash: data.component_hash,
5637
+ project_name: data.project_name,
5638
+ project_hash: data.project_hash
4652
5639
  };
4653
5640
  await this.validate(combinedData, template.model);
4654
5641
  const translation = template.translations[meta.lang];
4655
- const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
5642
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4656
5643
  return document;
4657
5644
  }
4658
5645
  };
4659
5646
 
4660
- let Factory$s = class Factory extends DocFactory {
5647
+ let Factory$y = class Factory extends DocFactory {
4661
5648
  constructor(storage) {
4662
5649
  super(storage);
4663
5650
  }
@@ -4668,43 +5655,77 @@ let Factory$s = class Factory extends DocFactory {
4668
5655
  } else {
4669
5656
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$t, data.block_num);
4670
5657
  }
4671
- const user = await super.getUser(data.username, data.block_num);
5658
+ const meta = await this.getMeta({ title: template.title, ...data });
4672
5659
  const coop = await super.getCooperative(data.coopname, data.block_num);
4673
5660
  const vars = await super.getVars(data.coopname, data.block_num);
4674
- const meta = await super.getMeta({
4675
- title: template.title,
4676
- ...data
5661
+ const userData = await super.getUser(data.username, data.block_num);
5662
+ const common_user = super.getCommonUser(userData);
5663
+ const udataService = new Udata(this.storage);
5664
+ const storageAgreementUdata = await udataService.getOne({
5665
+ coopname: data.coopname,
5666
+ username: data.username,
5667
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_STORAGE_AGREEMENT_NUMBER,
5668
+ block_num: data.block_num
4677
5669
  });
4678
- const decision = await super.getDecision(
4679
- coop,
4680
- data.coopname,
4681
- data.decision_id,
4682
- meta.created_at
4683
- );
5670
+ const storageAgreementCreatedAtUdata = await udataService.getOne({
5671
+ coopname: data.coopname,
5672
+ username: data.username,
5673
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_STORAGE_AGREEMENT_CREATED_AT,
5674
+ block_num: data.block_num
5675
+ });
5676
+ const contributorContractUdata = await udataService.getOne({
5677
+ coopname: data.coopname,
5678
+ username: data.username,
5679
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
5680
+ block_num: data.block_num
5681
+ });
5682
+ const generatorAgreementUdata = await udataService.getOne({
5683
+ coopname: data.coopname,
5684
+ username: data.username,
5685
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER,
5686
+ block_num: data.block_num
5687
+ });
5688
+ const generatorAgreementCreatedAtUdata = await udataService.getOne({
5689
+ coopname: data.coopname,
5690
+ username: data.username,
5691
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT,
5692
+ block_num: data.block_num
5693
+ });
5694
+ const missingParams = [];
5695
+ if (!storageAgreementUdata?.value)
5696
+ missingParams.push("BLAGOROST_STORAGE_AGREEMENT_NUMBER");
5697
+ if (!storageAgreementCreatedAtUdata?.value)
5698
+ missingParams.push("BLAGOROST_STORAGE_AGREEMENT_CREATED_AT");
5699
+ if (!contributorContractUdata?.value)
5700
+ missingParams.push("BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER");
5701
+ if (!generatorAgreementUdata?.value)
5702
+ missingParams.push("GENERATOR_AGREEMENT_NUMBER");
5703
+ if (!generatorAgreementCreatedAtUdata?.value)
5704
+ missingParams.push("GENERATOR_AGREEMENT_CREATED_AT");
5705
+ if (missingParams.length > 0) {
5706
+ throw new Error(
5707
+ `\u041E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0432 Udata \u0434\u043B\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F ${data.username}: ${missingParams.join(", ")}. \u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0441\u043D\u0430\u0447\u0430\u043B\u0430 \u0441\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u0432 \u0447\u0435\u0440\u0435\u0437 UdataDocumentParametersService.`
5708
+ );
5709
+ }
4684
5710
  const combinedData = {
4685
- vars,
4686
5711
  meta,
4687
5712
  coop,
4688
- decision,
4689
- user: super.getCommonUser(user),
4690
- quantity: data.quantity,
4691
- currency: data.currency
5713
+ vars,
5714
+ common_user,
5715
+ blagorost_storage_agreement_number: String(storageAgreementUdata?.value || ""),
5716
+ blagorost_storage_agreement_created_at: String(storageAgreementCreatedAtUdata?.value || ""),
5717
+ contributor_contract_number: String(contributorContractUdata?.value || ""),
5718
+ generator_agreement_number: String(generatorAgreementUdata?.value || ""),
5719
+ generator_agreement_created_at: String(generatorAgreementCreatedAtUdata?.value || "")
4692
5720
  };
4693
- await super.validate(combinedData, template.model);
5721
+ await this.validate(combinedData, template.model);
4694
5722
  const translation = template.translations[meta.lang];
4695
- const document = await super.generatePDF(
4696
- user.data,
4697
- template.context,
4698
- combinedData,
4699
- translation,
4700
- meta,
4701
- options?.skip_save
4702
- );
5723
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
4703
5724
  return document;
4704
5725
  }
4705
5726
  };
4706
5727
 
4707
- let Factory$r = class Factory extends DocFactory {
5728
+ let Factory$x = class Factory extends DocFactory {
4708
5729
  constructor(storage) {
4709
5730
  super(storage);
4710
5731
  }
@@ -4716,7 +5737,48 @@ let Factory$r = class Factory extends DocFactory {
4716
5737
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$s, data.block_num);
4717
5738
  }
4718
5739
  const meta = await this.getMeta({ title: template.title, ...data });
4719
- const combinedData = { meta };
5740
+ const coop = await super.getCooperative(data.coopname, data.block_num);
5741
+ const vars = await super.getVars(data.coopname, data.block_num);
5742
+ const userData = await super.getUser(data.username, data.block_num);
5743
+ const common_user = super.getCommonUser(userData);
5744
+ const udataService = new Udata(this.storage);
5745
+ const blagorostAgreementUdata = await udataService.getOne({
5746
+ coopname: data.coopname,
5747
+ username: data.username,
5748
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER,
5749
+ block_num: data.block_num
5750
+ });
5751
+ const contributorContractUdata = await udataService.getOne({
5752
+ coopname: data.coopname,
5753
+ username: data.username,
5754
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
5755
+ block_num: data.block_num
5756
+ });
5757
+ const contributorContractCreatedAtUdata = await udataService.getOne({
5758
+ coopname: data.coopname,
5759
+ username: data.username,
5760
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
5761
+ block_num: data.block_num
5762
+ });
5763
+ const missingParams = [];
5764
+ if (!contributorContractUdata?.value)
5765
+ missingParams.push("BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER");
5766
+ if (!contributorContractCreatedAtUdata?.value)
5767
+ missingParams.push("BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT");
5768
+ if (missingParams.length > 0) {
5769
+ throw new Error(
5770
+ `\u041E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0432 Udata \u0434\u043B\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F ${data.username}: ${missingParams.join(", ")}. \u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0441\u043D\u0430\u0447\u0430\u043B\u0430 \u0441\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u0432 \u0447\u0435\u0440\u0435\u0437 UdataDocumentParametersService.`
5771
+ );
5772
+ }
5773
+ const combinedData = {
5774
+ meta,
5775
+ coop,
5776
+ vars,
5777
+ common_user,
5778
+ blagorost_agreement_number: String(blagorostAgreementUdata?.value || ""),
5779
+ contributor_contract_number: String(contributorContractUdata?.value || ""),
5780
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata?.value || "")
5781
+ };
4720
5782
  await this.validate(combinedData, template.model);
4721
5783
  const translation = template.translations[meta.lang];
4722
5784
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4724,7 +5786,7 @@ let Factory$r = class Factory extends DocFactory {
4724
5786
  }
4725
5787
  };
4726
5788
 
4727
- let Factory$q = class Factory extends DocFactory {
5789
+ let Factory$w = class Factory extends DocFactory {
4728
5790
  constructor(storage) {
4729
5791
  super(storage);
4730
5792
  }
@@ -4737,7 +5799,20 @@ let Factory$q = class Factory extends DocFactory {
4737
5799
  }
4738
5800
  const meta = await this.getMeta({ title: template.title, ...data });
4739
5801
  const coop = await super.getCooperative(data.coopname, data.block_num);
4740
- const combinedData = { meta, coop };
5802
+ const vars = await super.getVars(data.coopname, data.block_num);
5803
+ const userData = await super.getUser(data.username, data.block_num);
5804
+ const user = super.getCommonUser(userData);
5805
+ const combinedData = {
5806
+ meta,
5807
+ coop,
5808
+ vars,
5809
+ user,
5810
+ project_name: data.project_name,
5811
+ project_hash: data.project_hash,
5812
+ component_name: data.component_name,
5813
+ component_hash: data.component_hash,
5814
+ is_component: data.is_component
5815
+ };
4741
5816
  await this.validate(combinedData, template.model);
4742
5817
  const translation = template.translations[meta.lang];
4743
5818
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4745,7 +5820,7 @@ let Factory$q = class Factory extends DocFactory {
4745
5820
  }
4746
5821
  };
4747
5822
 
4748
- let Factory$p = class Factory extends DocFactory {
5823
+ let Factory$v = class Factory extends DocFactory {
4749
5824
  constructor(storage) {
4750
5825
  super(storage);
4751
5826
  }
@@ -4756,16 +5831,49 @@ let Factory$p = class Factory extends DocFactory {
4756
5831
  } else {
4757
5832
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$q, data.block_num);
4758
5833
  }
4759
- const meta = await this.getMeta({ title: template.title, ...data });
4760
- const combinedData = { meta };
5834
+ const user = await this.getUser(data.username, data.block_num);
5835
+ const userData = {
5836
+ [user.type]: user.data
5837
+ };
5838
+ const coop = await this.getCooperative(data.coopname, data.block_num);
5839
+ const meta = await this.getMeta({
5840
+ title: template.title,
5841
+ ...data
5842
+ });
5843
+ const decision = await this.getDecision(
5844
+ coop,
5845
+ data.coopname,
5846
+ data.decision_id,
5847
+ meta.created_at
5848
+ );
5849
+ const vars = await super.getVars(data.coopname, data.block_num);
5850
+ const combinedData = {
5851
+ ...userData,
5852
+ meta,
5853
+ coop,
5854
+ decision,
5855
+ project_name: data.project_name,
5856
+ project_hash: data.project_hash,
5857
+ component_name: data.component_name,
5858
+ component_hash: data.component_hash,
5859
+ is_component: data.is_component,
5860
+ vars
5861
+ };
4761
5862
  await this.validate(combinedData, template.model);
4762
5863
  const translation = template.translations[meta.lang];
4763
- const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
5864
+ const document = await this.generatePDF(
5865
+ "",
5866
+ template.context,
5867
+ combinedData,
5868
+ translation,
5869
+ meta,
5870
+ options?.skip_save
5871
+ );
4764
5872
  return document;
4765
5873
  }
4766
5874
  };
4767
5875
 
4768
- let Factory$o = class Factory extends DocFactory {
5876
+ let Factory$u = class Factory extends DocFactory {
4769
5877
  constructor(storage) {
4770
5878
  super(storage);
4771
5879
  }
@@ -4785,7 +5893,7 @@ let Factory$o = class Factory extends DocFactory {
4785
5893
  }
4786
5894
  };
4787
5895
 
4788
- let Factory$n = class Factory extends DocFactory {
5896
+ let Factory$t = class Factory extends DocFactory {
4789
5897
  constructor(storage) {
4790
5898
  super(storage);
4791
5899
  }
@@ -4805,7 +5913,7 @@ let Factory$n = class Factory extends DocFactory {
4805
5913
  }
4806
5914
  };
4807
5915
 
4808
- let Factory$m = class Factory extends DocFactory {
5916
+ let Factory$s = class Factory extends DocFactory {
4809
5917
  constructor(storage) {
4810
5918
  super(storage);
4811
5919
  }
@@ -4817,7 +5925,62 @@ let Factory$m = class Factory extends DocFactory {
4817
5925
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$n, data.block_num);
4818
5926
  }
4819
5927
  const meta = await this.getMeta({ title: template.title, ...data });
4820
- const combinedData = { meta };
5928
+ const coop = await super.getCooperative(data.coopname, data.block_num);
5929
+ const vars = await super.getVars(data.coopname, data.block_num);
5930
+ const userData = await super.getUser(data.username, data.block_num);
5931
+ const common_user = super.getCommonUser(userData);
5932
+ const udataService = new Udata(this.storage);
5933
+ const contributorContractUdata = await udataService.getOne({
5934
+ coopname: data.coopname,
5935
+ username: data.username,
5936
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
5937
+ block_num: data.block_num
5938
+ });
5939
+ if (!contributorContractUdata?.value) {
5940
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
5941
+ }
5942
+ const contributorContractCreatedAtUdata = await udataService.getOne({
5943
+ coopname: data.coopname,
5944
+ username: data.username,
5945
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
5946
+ block_num: data.block_num
5947
+ });
5948
+ if (!contributorContractCreatedAtUdata?.value) {
5949
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
5950
+ }
5951
+ const blagorostAgreementUdata = await udataService.getOne({
5952
+ coopname: data.coopname,
5953
+ username: data.username,
5954
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER,
5955
+ block_num: data.block_num
5956
+ });
5957
+ if (!blagorostAgreementUdata?.value) {
5958
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
5959
+ }
5960
+ const blagorostAgreementCreatedAtUdata = await udataService.getOne({
5961
+ coopname: data.coopname,
5962
+ username: data.username,
5963
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT,
5964
+ block_num: data.block_num
5965
+ });
5966
+ if (!blagorostAgreementCreatedAtUdata?.value) {
5967
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
5968
+ }
5969
+ const combinedData = {
5970
+ meta,
5971
+ coop,
5972
+ vars,
5973
+ common_user,
5974
+ appendix_hash: data.appendix_hash,
5975
+ short_appendix_hash: this.getShortHash(data.appendix_hash),
5976
+ contributor_contract_number: String(contributorContractUdata.value),
5977
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
5978
+ appendix_created_at: data.appendix_created_at,
5979
+ project_hash: data.project_hash,
5980
+ amount: super.formatAsset(data.amount),
5981
+ blagorost_agreement_number: String(blagorostAgreementUdata.value),
5982
+ blagorost_agreement_created_at: String(blagorostAgreementCreatedAtUdata.value)
5983
+ };
4821
5984
  await this.validate(combinedData, template.model);
4822
5985
  const translation = template.translations[meta.lang];
4823
5986
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4825,7 +5988,7 @@ let Factory$m = class Factory extends DocFactory {
4825
5988
  }
4826
5989
  };
4827
5990
 
4828
- let Factory$l = class Factory extends DocFactory {
5991
+ let Factory$r = class Factory extends DocFactory {
4829
5992
  constructor(storage) {
4830
5993
  super(storage);
4831
5994
  }
@@ -4837,7 +6000,57 @@ let Factory$l = class Factory extends DocFactory {
4837
6000
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$m, data.block_num);
4838
6001
  }
4839
6002
  const meta = await this.getMeta({ title: template.title, ...data });
4840
- const combinedData = { meta };
6003
+ const vars = await super.getVars(data.coopname, data.block_num);
6004
+ const userData = await super.getUser(data.username, data.block_num);
6005
+ const common_user = super.getCommonUser(userData);
6006
+ const udataService = new Udata(this.storage);
6007
+ const contributorContractUdata = await udataService.getOne({
6008
+ coopname: data.coopname,
6009
+ username: data.username,
6010
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
6011
+ block_num: data.block_num
6012
+ });
6013
+ if (!contributorContractUdata?.value) {
6014
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6015
+ }
6016
+ const contributorContractCreatedAtUdata = await udataService.getOne({
6017
+ coopname: data.coopname,
6018
+ username: data.username,
6019
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
6020
+ block_num: data.block_num
6021
+ });
6022
+ if (!contributorContractCreatedAtUdata?.value) {
6023
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6024
+ }
6025
+ const generatorAgreementUdata = await udataService.getOne({
6026
+ coopname: data.coopname,
6027
+ username: data.username,
6028
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER,
6029
+ block_num: data.block_num
6030
+ });
6031
+ if (!generatorAgreementUdata?.value) {
6032
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6033
+ }
6034
+ const generatorAgreementCreatedAtUdata = await udataService.getOne({
6035
+ coopname: data.coopname,
6036
+ username: data.username,
6037
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT,
6038
+ block_num: data.block_num
6039
+ });
6040
+ if (!generatorAgreementCreatedAtUdata?.value) {
6041
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6042
+ }
6043
+ const combinedData = {
6044
+ meta,
6045
+ vars,
6046
+ common_user,
6047
+ contributor_contract_number: String(contributorContractUdata.value),
6048
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
6049
+ generator_agreement_number: String(generatorAgreementUdata.value),
6050
+ generator_agreement_created_at: String(generatorAgreementCreatedAtUdata.value),
6051
+ project_hash: data.project_hash,
6052
+ amount: data.amount
6053
+ };
4841
6054
  await this.validate(combinedData, template.model);
4842
6055
  const translation = template.translations[meta.lang];
4843
6056
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4845,7 +6058,7 @@ let Factory$l = class Factory extends DocFactory {
4845
6058
  }
4846
6059
  };
4847
6060
 
4848
- let Factory$k = class Factory extends DocFactory {
6061
+ let Factory$q = class Factory extends DocFactory {
4849
6062
  constructor(storage) {
4850
6063
  super(storage);
4851
6064
  }
@@ -4857,7 +6070,15 @@ let Factory$k = class Factory extends DocFactory {
4857
6070
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$l, data.block_num);
4858
6071
  }
4859
6072
  const meta = await this.getMeta({ title: template.title, ...data });
4860
- const combinedData = { meta };
6073
+ const vars = await super.getVars(data.coopname, data.block_num);
6074
+ const userData = await super.getUser(data.username, data.block_num);
6075
+ const common_user = super.getCommonUser(userData);
6076
+ const combinedData = {
6077
+ meta,
6078
+ vars,
6079
+ common_user,
6080
+ amount: data.amount
6081
+ };
4861
6082
  await this.validate(combinedData, template.model);
4862
6083
  const translation = template.translations[meta.lang];
4863
6084
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4865,7 +6086,7 @@ let Factory$k = class Factory extends DocFactory {
4865
6086
  }
4866
6087
  };
4867
6088
 
4868
- let Factory$j = class Factory extends DocFactory {
6089
+ let Factory$p = class Factory extends DocFactory {
4869
6090
  constructor(storage) {
4870
6091
  super(storage);
4871
6092
  }
@@ -4877,7 +6098,63 @@ let Factory$j = class Factory extends DocFactory {
4877
6098
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$k, data.block_num);
4878
6099
  }
4879
6100
  const meta = await this.getMeta({ title: template.title, ...data });
4880
- const combinedData = { meta };
6101
+ const coop = await super.getCooperative(data.coopname, data.block_num);
6102
+ const vars = await super.getVars(data.coopname, data.block_num);
6103
+ const userData = await super.getUser(data.username, data.block_num);
6104
+ const common_user = super.getCommonUser(userData);
6105
+ const udataService = new Udata(this.storage);
6106
+ const contributorContractUdata = await udataService.getOne({
6107
+ coopname: data.coopname,
6108
+ username: data.username,
6109
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
6110
+ block_num: data.block_num
6111
+ });
6112
+ if (!contributorContractUdata?.value) {
6113
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6114
+ }
6115
+ const contributorContractCreatedAtUdata = await udataService.getOne({
6116
+ coopname: data.coopname,
6117
+ username: data.username,
6118
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
6119
+ block_num: data.block_num
6120
+ });
6121
+ if (!contributorContractCreatedAtUdata?.value) {
6122
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6123
+ }
6124
+ const blagorostAgreementUdata = await udataService.getOne({
6125
+ coopname: data.coopname,
6126
+ username: data.username,
6127
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER,
6128
+ block_num: data.block_num
6129
+ });
6130
+ if (!blagorostAgreementUdata?.value) {
6131
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6132
+ }
6133
+ const blagorostAgreementCreatedAtUdata = await udataService.getOne({
6134
+ coopname: data.coopname,
6135
+ username: data.username,
6136
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT,
6137
+ block_num: data.block_num
6138
+ });
6139
+ if (!blagorostAgreementCreatedAtUdata?.value) {
6140
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6141
+ }
6142
+ const combinedData = {
6143
+ meta,
6144
+ coop,
6145
+ vars,
6146
+ common_user,
6147
+ contributor_contract_number: String(contributorContractUdata.value),
6148
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
6149
+ blagorost_agreement_number: String(blagorostAgreementUdata.value),
6150
+ blagorost_agreement_created_at: String(blagorostAgreementCreatedAtUdata.value),
6151
+ project_name: data.project_name,
6152
+ component_name: data.component_name,
6153
+ result_hash: data.result_hash,
6154
+ result_short_hash: this.getShortHash(data.result_hash),
6155
+ percent_of_result: data.percent_of_result,
6156
+ total_amount: this.formatAsset(data.total_amount)
6157
+ };
4881
6158
  await this.validate(combinedData, template.model);
4882
6159
  const translation = template.translations[meta.lang];
4883
6160
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4885,7 +6162,7 @@ let Factory$j = class Factory extends DocFactory {
4885
6162
  }
4886
6163
  };
4887
6164
 
4888
- let Factory$i = class Factory extends DocFactory {
6165
+ let Factory$o = class Factory extends DocFactory {
4889
6166
  constructor(storage) {
4890
6167
  super(storage);
4891
6168
  }
@@ -4896,8 +6173,71 @@ let Factory$i = class Factory extends DocFactory {
4896
6173
  } else {
4897
6174
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$j, data.block_num);
4898
6175
  }
4899
- const meta = await this.getMeta({ title: template.title, ...data });
4900
- const combinedData = { meta };
6176
+ const meta = await this.getMeta({ title: template.title, ...data });
6177
+ const coop = await super.getCooperative(data.coopname, data.block_num);
6178
+ const vars = await super.getVars(data.coopname, data.block_num);
6179
+ const userData = await super.getUser(data.username, data.block_num);
6180
+ const common_user = super.getCommonUser(userData);
6181
+ const decision = await this.getDecision(
6182
+ coop,
6183
+ data.coopname,
6184
+ data.decision_id,
6185
+ meta.created_at
6186
+ );
6187
+ const udataService = new Udata(this.storage);
6188
+ const contributorContractUdata = await udataService.getOne({
6189
+ coopname: data.coopname,
6190
+ username: data.username,
6191
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
6192
+ block_num: data.block_num
6193
+ });
6194
+ if (!contributorContractUdata?.value) {
6195
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6196
+ }
6197
+ const contributorContractCreatedAtUdata = await udataService.getOne({
6198
+ coopname: data.coopname,
6199
+ username: data.username,
6200
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
6201
+ block_num: data.block_num
6202
+ });
6203
+ if (!contributorContractCreatedAtUdata?.value) {
6204
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6205
+ }
6206
+ const blagorostAgreementUdata = await udataService.getOne({
6207
+ coopname: data.coopname,
6208
+ username: data.username,
6209
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER,
6210
+ block_num: data.block_num
6211
+ });
6212
+ if (!blagorostAgreementUdata?.value) {
6213
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6214
+ }
6215
+ const blagorostAgreementCreatedAtUdata = await udataService.getOne({
6216
+ coopname: data.coopname,
6217
+ username: data.username,
6218
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT,
6219
+ block_num: data.block_num
6220
+ });
6221
+ if (!blagorostAgreementCreatedAtUdata?.value) {
6222
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6223
+ }
6224
+ const combinedData = {
6225
+ meta,
6226
+ coop,
6227
+ vars,
6228
+ decision,
6229
+ common_user,
6230
+ contributor_contract_number: String(contributorContractUdata.value),
6231
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
6232
+ blagorost_agreement_number: String(blagorostAgreementUdata.value),
6233
+ blagorost_agreement_created_at: String(blagorostAgreementCreatedAtUdata.value),
6234
+ project_name: data.project_name,
6235
+ component_name: data.component_name,
6236
+ result_hash: data.result_hash,
6237
+ result_short_hash: this.getShortHash(data.result_hash),
6238
+ percent_of_result: data.percent_of_result,
6239
+ total_amount: this.formatAsset(data.total_amount)
6240
+ };
4901
6241
  await this.validate(combinedData, template.model);
4902
6242
  const translation = template.translations[meta.lang];
4903
6243
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4905,7 +6245,7 @@ let Factory$i = class Factory extends DocFactory {
4905
6245
  }
4906
6246
  };
4907
6247
 
4908
- let Factory$h = class Factory extends DocFactory {
6248
+ let Factory$n = class Factory extends DocFactory {
4909
6249
  constructor(storage) {
4910
6250
  super(storage);
4911
6251
  }
@@ -4917,7 +6257,64 @@ let Factory$h = class Factory extends DocFactory {
4917
6257
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$i, data.block_num);
4918
6258
  }
4919
6259
  const meta = await this.getMeta({ title: template.title, ...data });
4920
- const combinedData = { meta };
6260
+ const coop = await super.getCooperative(data.coopname, data.block_num);
6261
+ const vars = await super.getVars(data.coopname, data.block_num);
6262
+ const userData = await super.getUser(data.username, data.block_num);
6263
+ const common_user = super.getCommonUser(userData);
6264
+ const decision = await this.getApprovedDecision(coop, data.coopname, data.decision_id);
6265
+ const udataService = new Udata(this.storage);
6266
+ const contributorContractUdata = await udataService.getOne({
6267
+ coopname: data.coopname,
6268
+ username: data.username,
6269
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
6270
+ block_num: data.block_num
6271
+ });
6272
+ if (!contributorContractUdata?.value) {
6273
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6274
+ }
6275
+ const contributorContractCreatedAtUdata = await udataService.getOne({
6276
+ coopname: data.coopname,
6277
+ username: data.username,
6278
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
6279
+ block_num: data.block_num
6280
+ });
6281
+ if (!contributorContractCreatedAtUdata?.value) {
6282
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6283
+ }
6284
+ const blagorostAgreementUdata = await udataService.getOne({
6285
+ coopname: data.coopname,
6286
+ username: data.username,
6287
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER,
6288
+ block_num: data.block_num
6289
+ });
6290
+ if (!blagorostAgreementUdata?.value) {
6291
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6292
+ }
6293
+ const blagorostAgreementCreatedAtUdata = await udataService.getOne({
6294
+ coopname: data.coopname,
6295
+ username: data.username,
6296
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT,
6297
+ block_num: data.block_num
6298
+ });
6299
+ if (!blagorostAgreementCreatedAtUdata?.value) {
6300
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6301
+ }
6302
+ const combinedData = {
6303
+ meta,
6304
+ coop,
6305
+ vars,
6306
+ decision,
6307
+ common_user,
6308
+ contributor_contract_number: String(contributorContractUdata.value),
6309
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
6310
+ blagorost_agreement_number: String(blagorostAgreementUdata.value),
6311
+ blagorost_agreement_created_at: String(blagorostAgreementCreatedAtUdata.value),
6312
+ result_act_hash: data.result_act_hash,
6313
+ result_act_short_hash: this.getShortHash(data.result_act_hash),
6314
+ result_hash: data.result_hash,
6315
+ percent_of_result: data.percent_of_result,
6316
+ total_amount: this.formatAsset(data.total_amount)
6317
+ };
4921
6318
  await this.validate(combinedData, template.model);
4922
6319
  const translation = template.translations[meta.lang];
4923
6320
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -4925,7 +6322,7 @@ let Factory$h = class Factory extends DocFactory {
4925
6322
  }
4926
6323
  };
4927
6324
 
4928
- let Factory$g = class Factory extends DocFactory {
6325
+ let Factory$m = class Factory extends DocFactory {
4929
6326
  constructor(storage) {
4930
6327
  super(storage);
4931
6328
  }
@@ -4945,7 +6342,7 @@ let Factory$g = class Factory extends DocFactory {
4945
6342
  }
4946
6343
  };
4947
6344
 
4948
- let Factory$f = class Factory extends DocFactory {
6345
+ let Factory$l = class Factory extends DocFactory {
4949
6346
  constructor(storage) {
4950
6347
  super(storage);
4951
6348
  }
@@ -4965,7 +6362,7 @@ let Factory$f = class Factory extends DocFactory {
4965
6362
  }
4966
6363
  };
4967
6364
 
4968
- let Factory$e = class Factory extends DocFactory {
6365
+ let Factory$k = class Factory extends DocFactory {
4969
6366
  constructor(storage) {
4970
6367
  super(storage);
4971
6368
  }
@@ -4985,7 +6382,7 @@ let Factory$e = class Factory extends DocFactory {
4985
6382
  }
4986
6383
  };
4987
6384
 
4988
- let Factory$d = class Factory extends DocFactory {
6385
+ let Factory$j = class Factory extends DocFactory {
4989
6386
  constructor(storage) {
4990
6387
  super(storage);
4991
6388
  }
@@ -5005,7 +6402,7 @@ let Factory$d = class Factory extends DocFactory {
5005
6402
  }
5006
6403
  };
5007
6404
 
5008
- let Factory$c = class Factory extends DocFactory {
6405
+ let Factory$i = class Factory extends DocFactory {
5009
6406
  constructor(storage) {
5010
6407
  super(storage);
5011
6408
  }
@@ -5025,7 +6422,7 @@ let Factory$c = class Factory extends DocFactory {
5025
6422
  }
5026
6423
  };
5027
6424
 
5028
- let Factory$b = class Factory extends DocFactory {
6425
+ let Factory$h = class Factory extends DocFactory {
5029
6426
  constructor(storage) {
5030
6427
  super(storage);
5031
6428
  }
@@ -5045,7 +6442,7 @@ let Factory$b = class Factory extends DocFactory {
5045
6442
  }
5046
6443
  };
5047
6444
 
5048
- let Factory$a = class Factory extends DocFactory {
6445
+ let Factory$g = class Factory extends DocFactory {
5049
6446
  constructor(storage) {
5050
6447
  super(storage);
5051
6448
  }
@@ -5065,7 +6462,7 @@ let Factory$a = class Factory extends DocFactory {
5065
6462
  }
5066
6463
  };
5067
6464
 
5068
- let Factory$9 = class Factory extends DocFactory {
6465
+ let Factory$f = class Factory extends DocFactory {
5069
6466
  constructor(storage) {
5070
6467
  super(storage);
5071
6468
  }
@@ -5085,7 +6482,7 @@ let Factory$9 = class Factory extends DocFactory {
5085
6482
  }
5086
6483
  };
5087
6484
 
5088
- let Factory$8 = class Factory extends DocFactory {
6485
+ let Factory$e = class Factory extends DocFactory {
5089
6486
  constructor(storage) {
5090
6487
  super(storage);
5091
6488
  }
@@ -5097,7 +6494,45 @@ let Factory$8 = class Factory extends DocFactory {
5097
6494
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$9, data.block_num);
5098
6495
  }
5099
6496
  const meta = await this.getMeta({ title: template.title, ...data });
5100
- const combinedData = { meta };
6497
+ const coop = await super.getCooperative(data.coopname, data.block_num);
6498
+ const vars = await super.getVars(data.coopname, data.block_num);
6499
+ const userData = await super.getUser(data.username, data.block_num);
6500
+ const common_user = super.getCommonUser(userData);
6501
+ const udataService = new Udata(this.storage);
6502
+ const contributorContractUdata = await udataService.getOne({
6503
+ coopname: data.coopname,
6504
+ username: data.username,
6505
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER,
6506
+ block_num: data.block_num
6507
+ });
6508
+ if (!contributorContractUdata?.value) {
6509
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6510
+ }
6511
+ const contributorContractCreatedAtUdata = await udataService.getOne({
6512
+ coopname: data.coopname,
6513
+ username: data.username,
6514
+ key: cooptypes.Cooperative.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT,
6515
+ block_num: data.block_num
6516
+ });
6517
+ if (!contributorContractCreatedAtUdata?.value) {
6518
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6519
+ }
6520
+ const combinedData = {
6521
+ meta,
6522
+ coop,
6523
+ vars,
6524
+ common_user,
6525
+ contributor_contract_number: String(contributorContractUdata.value),
6526
+ contributor_contract_created_at: String(contributorContractCreatedAtUdata.value),
6527
+ appendix_hash: data.appendix_hash,
6528
+ appendix_short_hash: this.getShortHash(data.appendix_hash),
6529
+ project_hash: data.project_hash,
6530
+ project_short_hash: this.getShortHash(data.project_hash),
6531
+ main_wallet_amount: data.main_wallet_amount,
6532
+ blagorost_wallet_amount: data.blagorost_wallet_amount,
6533
+ to_wallet: data.to_wallet,
6534
+ to_blagorost: data.to_blagorost
6535
+ };
5101
6536
  await this.validate(combinedData, template.model);
5102
6537
  const translation = template.translations[meta.lang];
5103
6538
  const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
@@ -5105,7 +6540,7 @@ let Factory$8 = class Factory extends DocFactory {
5105
6540
  }
5106
6541
  };
5107
6542
 
5108
- let Factory$7 = class Factory extends DocFactory {
6543
+ let Factory$d = class Factory extends DocFactory {
5109
6544
  constructor(storage) {
5110
6545
  super(storage);
5111
6546
  }
@@ -5125,7 +6560,7 @@ let Factory$7 = class Factory extends DocFactory {
5125
6560
  }
5126
6561
  };
5127
6562
 
5128
- let Factory$6 = class Factory extends DocFactory {
6563
+ let Factory$c = class Factory extends DocFactory {
5129
6564
  constructor(storage) {
5130
6565
  super(storage);
5131
6566
  }
@@ -5145,7 +6580,7 @@ let Factory$6 = class Factory extends DocFactory {
5145
6580
  }
5146
6581
  };
5147
6582
 
5148
- let Factory$5 = class Factory extends DocFactory {
6583
+ let Factory$b = class Factory extends DocFactory {
5149
6584
  constructor(storage) {
5150
6585
  super(storage);
5151
6586
  }
@@ -5165,7 +6600,7 @@ let Factory$5 = class Factory extends DocFactory {
5165
6600
  }
5166
6601
  };
5167
6602
 
5168
- let Factory$4 = class Factory extends DocFactory {
6603
+ let Factory$a = class Factory extends DocFactory {
5169
6604
  constructor(storage) {
5170
6605
  super(storage);
5171
6606
  }
@@ -5206,7 +6641,7 @@ let Factory$4 = class Factory extends DocFactory {
5206
6641
  }
5207
6642
  };
5208
6643
 
5209
- let Factory$3 = class Factory extends DocFactory {
6644
+ let Factory$9 = class Factory extends DocFactory {
5210
6645
  constructor(storage) {
5211
6646
  super(storage);
5212
6647
  }
@@ -5217,11 +6652,10 @@ let Factory$3 = class Factory extends DocFactory {
5217
6652
  } else {
5218
6653
  template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$3, data.block_num);
5219
6654
  }
5220
- console.log("data on gerate soviet decision", data);
5221
6655
  const meta = await super.getMeta({ title: template.title, ...data });
5222
6656
  const coop = await super.getCooperative(data.coopname, data.block_num);
5223
6657
  const vars = await super.getVars(data.coopname, data.block_num);
5224
- const decision = await super.getDecision(coop, data.coopname, data.decision_id, meta.created_at);
6658
+ const decision = await super.getApprovedDecision(coop, data.coopname, data.decision_id);
5225
6659
  const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
5226
6660
  const questions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
5227
6661
  const combinedData = {
@@ -5247,7 +6681,7 @@ let Factory$3 = class Factory extends DocFactory {
5247
6681
  }
5248
6682
  };
5249
6683
 
5250
- let Factory$2 = class Factory extends DocFactory {
6684
+ let Factory$8 = class Factory extends DocFactory {
5251
6685
  constructor(storage) {
5252
6686
  super(storage);
5253
6687
  }
@@ -5288,7 +6722,7 @@ let Factory$2 = class Factory extends DocFactory {
5288
6722
  }
5289
6723
  };
5290
6724
 
5291
- let Factory$1 = class Factory extends DocFactory {
6725
+ let Factory$7 = class Factory extends DocFactory {
5292
6726
  constructor(storage) {
5293
6727
  super(storage);
5294
6728
  }
@@ -5306,7 +6740,6 @@ let Factory$1 = class Factory extends DocFactory {
5306
6740
  const user = super.getCommonUser(userData);
5307
6741
  const meet = await super.getMeet(data.coopname, data.meet_hash, data.block_num);
5308
6742
  const meetQuestions = await super.getMeetQuestions(data.coopname, Number(meet.id), data.block_num);
5309
- console.log("meetQuestions", meetQuestions);
5310
6743
  const questions = meetQuestions.map((question) => ({
5311
6744
  id: question.id.toString(),
5312
6745
  number: question.number.toString(),
@@ -5339,7 +6772,7 @@ let Factory$1 = class Factory extends DocFactory {
5339
6772
  }
5340
6773
  };
5341
6774
 
5342
- class Factory extends DocFactory {
6775
+ let Factory$6 = class Factory extends DocFactory {
5343
6776
  constructor(storage) {
5344
6777
  super(storage);
5345
6778
  }
@@ -5376,6 +6809,196 @@ class Factory extends DocFactory {
5376
6809
  );
5377
6810
  return document;
5378
6811
  }
6812
+ };
6813
+
6814
+ let Factory$5 = class Factory extends DocFactory {
6815
+ constructor(storage) {
6816
+ super(storage);
6817
+ }
6818
+ async generateDocument(data, options) {
6819
+ let template;
6820
+ if (process.env.SOURCE === "local") {
6821
+ template = Template$D;
6822
+ } else {
6823
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$D, data.block_num);
6824
+ }
6825
+ const meta = await this.getMeta({ title: template.title, ...data });
6826
+ const vars = await this.getVars(data.coopname);
6827
+ const coop = await this.getCooperative(data.coopname);
6828
+ const combinedData = {
6829
+ meta,
6830
+ coop,
6831
+ vars
6832
+ };
6833
+ await this.validate(combinedData, template.model);
6834
+ const translation = template.translations[meta.lang];
6835
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
6836
+ return document;
6837
+ }
6838
+ };
6839
+
6840
+ let Factory$4 = class Factory extends DocFactory {
6841
+ constructor(storage) {
6842
+ super(storage);
6843
+ }
6844
+ async generateDocument(data, options) {
6845
+ let template;
6846
+ if (process.env.SOURCE === "local") {
6847
+ template = Template$C;
6848
+ } else {
6849
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$C, data.block_num);
6850
+ }
6851
+ const meta = await this.getMeta({ title: template.title, ...data });
6852
+ const vars = await this.getVars(data.coopname);
6853
+ const coop = await this.getCooperative(data.coopname);
6854
+ const user = await this.getUser(data.username, data.block_num);
6855
+ const common_user = this.getCommonUser(user);
6856
+ if (!vars.generator_program?.protocol_number || !vars.generator_program?.protocol_day_month_year) {
6857
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043E\u0431 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0439 \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u0443\u044E \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0443 \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430.");
6858
+ }
6859
+ const combinedData = {
6860
+ meta,
6861
+ coop,
6862
+ vars,
6863
+ common_user
6864
+ };
6865
+ await this.validate(combinedData, template.model);
6866
+ const translation = template.translations[meta.lang];
6867
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
6868
+ return document;
6869
+ }
6870
+ };
6871
+
6872
+ let Factory$3 = class Factory extends DocFactory {
6873
+ constructor(storage) {
6874
+ super(storage);
6875
+ }
6876
+ async generateDocument(data, options) {
6877
+ let template;
6878
+ if (process.env.SOURCE === "local") {
6879
+ template = Template$B;
6880
+ } else {
6881
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$B, data.block_num);
6882
+ }
6883
+ const meta = await this.getMeta({ title: template.title, ...data });
6884
+ const vars = await this.getVars(data.coopname);
6885
+ const coop = await this.getCooperative(data.coopname);
6886
+ const user = await this.getUser(data.username, data.block_num);
6887
+ const common_user = this.getCommonUser(user);
6888
+ if (!vars.generator_program?.protocol_number || !vars.generator_program?.protocol_day_month_year) {
6889
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043E\u0431 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0439 \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u0443\u044E \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0443 \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430.");
6890
+ }
6891
+ if (!vars.generator_offer_template?.protocol_number || !vars.generator_offer_template?.protocol_day_month_year) {
6892
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043E\u0431 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0430 \u043E\u0444\u0435\u0440\u0442\u044B \u0433\u0435\u043D\u0435\u0440\u0430\u0442\u043E\u0440\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u0448\u0430\u0431\u043B\u043E\u043D \u043E\u0444\u0435\u0440\u0442\u044B \u0433\u0435\u043D\u0435\u0440\u0430\u0442\u043E\u0440\u0430 \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430.");
6893
+ }
6894
+ const udataService = new Udata(this.storage);
6895
+ const generatorAgreementUdata = await udataService.getOne({
6896
+ coopname: data.coopname,
6897
+ username: data.username,
6898
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER,
6899
+ block_num: data.block_num
6900
+ });
6901
+ if (!generatorAgreementUdata?.value) {
6902
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
6903
+ }
6904
+ const generatorAgreementCreatedAtUdata = await udataService.getOne({
6905
+ coopname: data.coopname,
6906
+ username: data.username,
6907
+ key: cooptypes.Cooperative.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT,
6908
+ block_num: data.block_num
6909
+ });
6910
+ if (!generatorAgreementCreatedAtUdata?.value) {
6911
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
6912
+ }
6913
+ const combinedData = {
6914
+ meta,
6915
+ coop,
6916
+ vars,
6917
+ common_user,
6918
+ generator_agreement_number: String(generatorAgreementUdata.value),
6919
+ generator_agreement_created_at: String(generatorAgreementCreatedAtUdata.value)
6920
+ };
6921
+ await this.validate(combinedData, template.model);
6922
+ const translation = template.translations[meta.lang];
6923
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
6924
+ return document;
6925
+ }
6926
+ };
6927
+
6928
+ let Factory$2 = class Factory extends DocFactory {
6929
+ constructor(storage) {
6930
+ super(storage);
6931
+ }
6932
+ async generateDocument(data, options) {
6933
+ let template;
6934
+ if (process.env.SOURCE === "local") {
6935
+ template = Template$A;
6936
+ } else {
6937
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$A, data.block_num);
6938
+ }
6939
+ const meta = await this.getMeta({ title: template.title, ...data });
6940
+ const vars = await this.getVars(data.coopname);
6941
+ const combinedData = { meta, vars };
6942
+ await this.validate(combinedData, template.model);
6943
+ const translation = template.translations[meta.lang];
6944
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
6945
+ return document;
6946
+ }
6947
+ };
6948
+
6949
+ let Factory$1 = class Factory extends DocFactory {
6950
+ constructor(storage) {
6951
+ super(storage);
6952
+ }
6953
+ async generateDocument(data, options) {
6954
+ let template;
6955
+ if (process.env.SOURCE === "local") {
6956
+ template = Template$z;
6957
+ } else {
6958
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$z, data.block_num);
6959
+ }
6960
+ const meta = await this.getMeta({ title: template.title, ...data });
6961
+ const vars = await this.getVars(data.coopname);
6962
+ const coop = await this.getCooperative(data.coopname);
6963
+ const combinedData = {
6964
+ meta,
6965
+ coop,
6966
+ vars
6967
+ };
6968
+ await this.validate(combinedData, template.model);
6969
+ const translation = template.translations[meta.lang];
6970
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
6971
+ return document;
6972
+ }
6973
+ };
6974
+
6975
+ class Factory extends DocFactory {
6976
+ constructor(storage) {
6977
+ super(storage);
6978
+ }
6979
+ async generateDocument(data, options) {
6980
+ let template;
6981
+ if (process.env.SOURCE === "local") {
6982
+ template = Template$y;
6983
+ } else {
6984
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$y, data.block_num);
6985
+ }
6986
+ const meta = await this.getMeta({ title: template.title, ...data });
6987
+ const vars = await this.getVars(data.coopname);
6988
+ const coop = await this.getCooperative(data.coopname);
6989
+ if (!vars.blagorost_program?.protocol_number || !vars.blagorost_program?.protocol_day_month_year) {
6990
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430 \u043E\u0431 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438 \u041F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u043E \u0426\u041F\u041F \xAB\u0411\u041B\u0410\u0413\u041E\u0420\u041E\u0421\u0422\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u041F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u0430.");
6991
+ }
6992
+ const combinedData = {
6993
+ meta,
6994
+ coop,
6995
+ vars
6996
+ };
6997
+ await this.validate(combinedData, template.model);
6998
+ const translation = template.translations[meta.lang];
6999
+ const document = await this.generatePDF("", template.context, combinedData, translation, meta, options?.skip_save);
7000
+ return document;
7001
+ }
5379
7002
  }
5380
7003
 
5381
7004
  var __defProp$2 = Object.defineProperty;
@@ -5655,102 +7278,126 @@ class Generator {
5655
7278
  this.storage = new MongoDBConnector(mongoUri);
5656
7279
  this.searchService = new SearchService(this.storage);
5657
7280
  this.factories = {
5658
- [registry_id$L]: new Factory$L(this.storage),
7281
+ [registry_id$W]: new Factory$W(this.storage),
5659
7282
  // 1
5660
- [registry_id$K]: new Factory$K(this.storage),
7283
+ [registry_id$V]: new Factory$V(this.storage),
5661
7284
  // 2
5662
- [registry_id$J]: new Factory$J(this.storage),
7285
+ [registry_id$U]: new Factory$U(this.storage),
5663
7286
  // 3
5664
- [registry_id$I]: new Factory$I(this.storage),
7287
+ [registry_id$T]: new Factory$T(this.storage),
5665
7288
  // 4
5666
- [registry_id$H]: new Factory$H(this.storage),
7289
+ [registry_id$S]: new Factory$S(this.storage),
5667
7290
  // 50
5668
- [registry_id$G]: new Factory$G(this.storage),
7291
+ [registry_id$R]: new Factory$R(this.storage),
5669
7292
  // 51
5670
- [registry_id$F]: new Factory$E(this.storage),
7293
+ [registry_id$Q]: new Factory$P(this.storage),
5671
7294
  // 100
5672
- [registry_id$D]: new Factory$F(this.storage),
7295
+ [registry_id$O]: new Factory$Q(this.storage),
5673
7296
  // 101
5674
7297
  // общее собрание
5675
- [registry_id$4]: new Factory$4(this.storage),
7298
+ [registry_id$4]: new Factory$a(this.storage),
5676
7299
  // 300
5677
- [registry_id$3]: new Factory$3(this.storage),
7300
+ [registry_id$3]: new Factory$9(this.storage),
5678
7301
  // 301
5679
- [registry_id$2]: new Factory$2(this.storage),
7302
+ [registry_id$2]: new Factory$8(this.storage),
5680
7303
  // 302
5681
- [registry_id$1]: new Factory$1(this.storage),
7304
+ [registry_id$1]: new Factory$7(this.storage),
5682
7305
  // 303
5683
- [registry_id]: new Factory(this.storage),
7306
+ [registry_id]: new Factory$6(this.storage),
5684
7307
  // 304
5685
- [registry_id$E]: new Factory$D(this.storage),
7308
+ [registry_id$P]: new Factory$O(this.storage),
5686
7309
  // 501
5687
- [registry_id$C]: new Factory$C(this.storage),
7310
+ [registry_id$N]: new Factory$N(this.storage),
5688
7311
  // 599
5689
- [registry_id$B]: new Factory$B(this.storage),
7312
+ [registry_id$M]: new Factory$M(this.storage),
5690
7313
  // 600
5691
- [registry_id$5]: new Factory$y(this.storage),
7314
+ [registry_id$5]: new Factory$J(this.storage),
5692
7315
  // 699
5693
- [registry_id$A]: new Factory$A(this.storage),
7316
+ [registry_id$L]: new Factory$L(this.storage),
5694
7317
  // 700
5695
- [registry_id$z]: new Factory$z(this.storage),
7318
+ [registry_id$K]: new Factory$K(this.storage),
5696
7319
  // 800
5697
- [registry_id$x]: new Factory$v(this.storage),
7320
+ [registry_id$I]: new Factory$G(this.storage),
5698
7321
  // 801
5699
- [registry_id$v]: new Factory$u(this.storage),
7322
+ [registry_id$G]: new Factory$F(this.storage),
5700
7323
  // 802
5701
- [registry_id$u]: new Factory$t(this.storage),
7324
+ [registry_id$F]: new Factory$E(this.storage),
5702
7325
  // 900
5703
- [registry_id$t]: new Factory$s(this.storage),
7326
+ [registry_id$E]: new Factory$D(this.storage),
5704
7327
  // 901
5705
- [registry_id$y]: new Factory$x(this.storage),
7328
+ // ЦПП ГЕНЕРАТОР
7329
+ [registry_id$D]: new Factory$5(this.storage),
7330
+ // 994
7331
+ [registry_id$C]: new Factory$4(this.storage),
7332
+ // 995
7333
+ [registry_id$B]: new Factory$3(this.storage),
7334
+ // 996
7335
+ // ЦПП БЛАГОРОСТ
7336
+ [registry_id$z]: new Factory$1(this.storage),
7337
+ // 997
7338
+ [registry_id$A]: new Factory$2(this.storage),
7339
+ // 998
7340
+ [registry_id$y]: new Factory(this.storage),
7341
+ // 999
7342
+ [registry_id$x]: new Factory$C(this.storage),
7343
+ // 1000
7344
+ [registry_id$J]: new Factory$I(this.storage),
5706
7345
  // 701
5707
- [registry_id$w]: new Factory$w(this.storage),
7346
+ [registry_id$H]: new Factory$H(this.storage),
5708
7347
  // 702
5709
- [registry_id$s]: new Factory$r(this.storage),
5710
- // 1000
5711
- [registry_id$r]: new Factory$q(this.storage),
7348
+ [registry_id$w]: new Factory$B(this.storage),
5712
7349
  // 1001
5713
- [registry_id$q]: new Factory$p(this.storage),
7350
+ [registry_id$v]: new Factory$A(this.storage),
5714
7351
  // 1002
5715
- [registry_id$p]: new Factory$o(this.storage),
7352
+ [registry_id$u]: new Factory$z(this.storage),
7353
+ // 1003
7354
+ [registry_id$t]: new Factory$y(this.storage),
7355
+ // 1004
7356
+ [registry_id$s]: new Factory$x(this.storage),
7357
+ // 1007
7358
+ [registry_id$r]: new Factory$w(this.storage),
7359
+ // 1005
7360
+ [registry_id$q]: new Factory$v(this.storage),
7361
+ // 1006
7362
+ [registry_id$p]: new Factory$u(this.storage),
5716
7363
  // 1010
5717
- [registry_id$o]: new Factory$n(this.storage),
7364
+ [registry_id$o]: new Factory$t(this.storage),
5718
7365
  // 1011
5719
- [registry_id$n]: new Factory$m(this.storage),
7366
+ [registry_id$n]: new Factory$s(this.storage),
5720
7367
  // 1020
5721
- [registry_id$m]: new Factory$l(this.storage),
7368
+ [registry_id$m]: new Factory$r(this.storage),
5722
7369
  // 1025
5723
- [registry_id$l]: new Factory$k(this.storage),
7370
+ [registry_id$l]: new Factory$q(this.storage),
5724
7371
  // 1030
5725
- [registry_id$k]: new Factory$j(this.storage),
7372
+ [registry_id$k]: new Factory$p(this.storage),
5726
7373
  // 1040
5727
- [registry_id$j]: new Factory$i(this.storage),
7374
+ [registry_id$j]: new Factory$o(this.storage),
5728
7375
  // 1041
5729
- [registry_id$i]: new Factory$h(this.storage),
7376
+ [registry_id$i]: new Factory$n(this.storage),
5730
7377
  // 1042
5731
- [registry_id$h]: new Factory$g(this.storage),
7378
+ [registry_id$h]: new Factory$m(this.storage),
5732
7379
  // 1050
5733
- [registry_id$g]: new Factory$f(this.storage),
7380
+ [registry_id$g]: new Factory$l(this.storage),
5734
7381
  // 1051
5735
- [registry_id$f]: new Factory$e(this.storage),
7382
+ [registry_id$f]: new Factory$k(this.storage),
5736
7383
  // 1060
5737
- [registry_id$e]: new Factory$d(this.storage),
7384
+ [registry_id$e]: new Factory$j(this.storage),
5738
7385
  // 1061
5739
- [registry_id$d]: new Factory$c(this.storage),
7386
+ [registry_id$d]: new Factory$i(this.storage),
5740
7387
  // 1062
5741
- [registry_id$c]: new Factory$b(this.storage),
7388
+ [registry_id$c]: new Factory$h(this.storage),
5742
7389
  // 1070
5743
- [registry_id$b]: new Factory$a(this.storage),
7390
+ [registry_id$b]: new Factory$g(this.storage),
5744
7391
  // 1071
5745
- [registry_id$a]: new Factory$9(this.storage),
7392
+ [registry_id$a]: new Factory$f(this.storage),
5746
7393
  // 1072
5747
- [registry_id$9]: new Factory$8(this.storage),
7394
+ [registry_id$9]: new Factory$e(this.storage),
5748
7395
  // 1080
5749
- [registry_id$8]: new Factory$7(this.storage),
7396
+ [registry_id$8]: new Factory$d(this.storage),
5750
7397
  // 1081
5751
- [registry_id$7]: new Factory$6(this.storage),
7398
+ [registry_id$7]: new Factory$c(this.storage),
5752
7399
  // 1082
5753
- [registry_id$6]: new Factory$5(this.storage)
7400
+ [registry_id$6]: new Factory$b(this.storage)
5754
7401
  // 1090
5755
7402
  };
5756
7403
  await this.storage.connect();
@@ -5773,6 +7420,10 @@ class Generator {
5773
7420
  const model = this.getModel(type, data);
5774
7421
  return model.save();
5775
7422
  }
7423
+ async update(type, filter, data) {
7424
+ const model = this.getModel(type);
7425
+ return model.update(filter, data);
7426
+ }
5776
7427
  async del(type, filter) {
5777
7428
  const model = this.getModel(type);
5778
7429
  return model.del(filter);
@@ -5807,6 +7458,8 @@ class Generator {
5807
7458
  return new Vars(this.storage, data);
5808
7459
  case "project":
5809
7460
  return new Project(this.storage, data);
7461
+ case "udata":
7462
+ return new Udata(this.storage, data);
5810
7463
  default:
5811
7464
  throw new Error(`Unknown type: ${type}`);
5812
7465
  }
@@ -5827,18 +7480,21 @@ exports.AnnualGeneralMeetingDecision = AnnualGeneralMeetingDecision;
5827
7480
  exports.AnnualGeneralMeetingNotification = AnnualGeneralMeetingNotification;
5828
7481
  exports.AnnualGeneralMeetingSovietDecision = AnnualGeneralMeetingSovietDecision;
5829
7482
  exports.AnnualGeneralMeetingVotingBallot = AnnualGeneralMeetingVotingBallot;
5830
- exports.AppendixGenerationAgreement = AppendixGenerationAgreement;
5831
7483
  exports.AssetContributionAct = AssetContributionAct;
5832
7484
  exports.AssetContributionDecision = AssetContributionDecision;
5833
7485
  exports.AssetContributionStatement = AssetContributionStatement;
5834
7486
  exports.BankAccountSchema = BankAccountSchema;
5835
- exports.CapitalizationAgreement = CapitalizationAgreement;
7487
+ exports.BlagorostAgreement = BlagorostAgreement;
7488
+ exports.BlagorostOffer = BlagorostOffer;
7489
+ exports.BlagorostOfferTemplate = BlagorostOfferTemplate;
7490
+ exports.BlagorostProgramTemplate = BlagorostProgramTemplate;
5836
7491
  exports.CapitalizationMoneyInvestStatement = CapitalizationMoneyInvestStatement;
5837
7492
  exports.CapitalizationPropertyInvestAct = CapitalizationPropertyInvestAct;
5838
7493
  exports.CapitalizationPropertyInvestDecision = CapitalizationPropertyInvestDecision;
5839
7494
  exports.CapitalizationPropertyInvestStatement = CapitalizationPropertyInvestStatement;
5840
7495
  exports.CapitalizationToMainWalletConvertStatement = CapitalizationToMainWalletConvertStatement;
5841
7496
  exports.CommonUserSchema = CommonUserSchema;
7497
+ exports.ComponentGenerationContract = ComponentGenerationContract;
5842
7498
  exports.ConvertToAxonStatement = ConvertToAxonStatement;
5843
7499
  exports.CoopenomicsAgreement = CoopenomicsAgreement;
5844
7500
  exports.CooperativeSchema = CooperativeSchema;
@@ -5846,7 +7502,8 @@ exports.DecisionOfParticipantApplication = DecisionOfParticipantApplication;
5846
7502
  exports.ExpenseDecision = ExpenseDecision;
5847
7503
  exports.ExpenseStatement = ExpenseStatement;
5848
7504
  exports.FreeDecision = FreeDecision;
5849
- exports.GenerationAgreement = GenerationAgreement;
7505
+ exports.GenerationContract = GenerationContract;
7506
+ exports.GenerationContractTemplate = GenerationContractTemplate;
5850
7507
  exports.GenerationMoneyInvestStatement = GenerationMoneyInvestStatement;
5851
7508
  exports.GenerationMoneyReturnUnusedStatement = GenerationMoneyReturnUnusedStatement;
5852
7509
  exports.GenerationPropertyInvestAct = GenerationPropertyInvestAct;
@@ -5856,13 +7513,19 @@ exports.GenerationToCapitalizationConvertStatement = GenerationToCapitalizationC
5856
7513
  exports.GenerationToMainWalletConvertStatement = GenerationToMainWalletConvertStatement;
5857
7514
  exports.GenerationToProjectConvertStatement = GenerationToProjectConvertStatement;
5858
7515
  exports.Generator = Generator;
7516
+ exports.GeneratorOffer = GeneratorOffer;
7517
+ exports.GeneratorOfferTemplate = GeneratorOfferTemplate;
7518
+ exports.GeneratorProgramTemplate = GeneratorProgramTemplate;
5859
7519
  exports.GetLoanDecision = GetLoanDecision;
5860
7520
  exports.GetLoanStatement = GetLoanStatement;
7521
+ exports.InitProjectDecision = InitProjectDecision;
7522
+ exports.InitProjectStatement = InitProjectStatement;
5861
7523
  exports.MeetPointSchema = MeetPointSchema;
5862
7524
  exports.MeetSchema = MeetSchema;
5863
7525
  exports.ParticipantApplication = ParticipantApplication;
5864
7526
  exports.PrivacyPolicy = PrivacyPolicy;
5865
7527
  exports.ProjectFreeDecision = ProjectFreeDecision;
7528
+ exports.ProjectGenerationContract = ProjectGenerationContract;
5866
7529
  exports.QuestionExtendedSchema = QuestionExtendedSchema;
5867
7530
  exports.QuestionSchema = QuestionSchema$1;
5868
7531
  exports.Registry = Registry;
@@ -5877,6 +7540,7 @@ exports.ReturnByMoney = ReturnByMoney;
5877
7540
  exports.ReturnByMoneyDecision = ReturnByMoneyDecision;
5878
7541
  exports.SelectBranchStatement = SelectBranchStatement;
5879
7542
  exports.SosediAgreement = SosediAgreement;
7543
+ exports.StorageAgreement = StorageAgreement;
5880
7544
  exports.UserAgreement = UserAgreement;
5881
7545
  exports.VarsSchema = VarsSchema;
5882
7546
  exports.WalletAgreement = WalletAgreement;
@@ -5885,3 +7549,4 @@ exports.entrepreneurSchema = entrepreneurSchema;
5885
7549
  exports.individualSchema = individualSchema;
5886
7550
  exports.organizationSchema = organizationSchema;
5887
7551
  exports.paymentMethodSchema = paymentMethodSchema;
7552
+ exports.udataSchema = udataSchema;