@coopenomics/factory 2025.6.24 → 2025.7.1-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
@@ -657,8 +657,8 @@ const AgendaQuestionSchema = {
657
657
  additionalProperties: true
658
658
  };
659
659
 
660
- const registry_id$q = cooptypes.Cooperative.Registry.WalletAgreement.registry_id;
661
- const Schema$q = {
660
+ const registry_id$s = cooptypes.Cooperative.Registry.WalletAgreement.registry_id;
661
+ const Schema$s = {
662
662
  type: "object",
663
663
  properties: {
664
664
  meta: IMetaJSONSchema,
@@ -668,23 +668,23 @@ const Schema$q = {
668
668
  required: ["meta", "coop", "vars"],
669
669
  additionalProperties: true
670
670
  };
671
- const Template$q = {
671
+ const Template$s = {
672
672
  title: cooptypes.Cooperative.Registry.WalletAgreement.title,
673
673
  description: cooptypes.Cooperative.Registry.WalletAgreement.description,
674
- model: Schema$q,
674
+ model: Schema$s,
675
675
  context: cooptypes.Cooperative.Registry.WalletAgreement.context,
676
676
  translations: cooptypes.Cooperative.Registry.WalletAgreement.translations
677
677
  };
678
678
 
679
679
  const WalletAgreement = {
680
680
  __proto__: null,
681
- Schema: Schema$q,
682
- Template: Template$q,
683
- registry_id: registry_id$q
681
+ Schema: Schema$s,
682
+ Template: Template$s,
683
+ registry_id: registry_id$s
684
684
  };
685
685
 
686
- const registry_id$p = cooptypes.Cooperative.Registry.RegulationElectronicSignature.registry_id;
687
- const Schema$p = {
686
+ const registry_id$r = cooptypes.Cooperative.Registry.RegulationElectronicSignature.registry_id;
687
+ const Schema$r = {
688
688
  type: "object",
689
689
  properties: {
690
690
  meta: IMetaJSONSchema,
@@ -694,23 +694,23 @@ const Schema$p = {
694
694
  required: ["meta", "coop", "vars"],
695
695
  additionalProperties: true
696
696
  };
697
- const Template$p = {
697
+ const Template$r = {
698
698
  title: cooptypes.Cooperative.Registry.RegulationElectronicSignature.title,
699
699
  description: cooptypes.Cooperative.Registry.RegulationElectronicSignature.description,
700
- model: Schema$p,
700
+ model: Schema$r,
701
701
  context: cooptypes.Cooperative.Registry.RegulationElectronicSignature.context,
702
702
  translations: cooptypes.Cooperative.Registry.RegulationElectronicSignature.translations
703
703
  };
704
704
 
705
705
  const RegulationElectronicSignaturet = {
706
706
  __proto__: null,
707
- Schema: Schema$p,
708
- Template: Template$p,
709
- registry_id: registry_id$p
707
+ Schema: Schema$r,
708
+ Template: Template$r,
709
+ registry_id: registry_id$r
710
710
  };
711
711
 
712
- const registry_id$o = cooptypes.Cooperative.Registry.PrivacyPolicy.registry_id;
713
- const Schema$o = {
712
+ const registry_id$q = cooptypes.Cooperative.Registry.PrivacyPolicy.registry_id;
713
+ const Schema$q = {
714
714
  type: "object",
715
715
  properties: {
716
716
  meta: IMetaJSONSchema,
@@ -720,23 +720,23 @@ const Schema$o = {
720
720
  required: ["meta", "coop", "vars"],
721
721
  additionalProperties: true
722
722
  };
723
- const Template$o = {
723
+ const Template$q = {
724
724
  title: cooptypes.Cooperative.Registry.PrivacyPolicy.title,
725
725
  description: cooptypes.Cooperative.Registry.PrivacyPolicy.description,
726
- model: Schema$o,
726
+ model: Schema$q,
727
727
  context: cooptypes.Cooperative.Registry.PrivacyPolicy.context,
728
728
  translations: cooptypes.Cooperative.Registry.PrivacyPolicy.translations
729
729
  };
730
730
 
731
731
  const PrivacyPolicy = {
732
732
  __proto__: null,
733
- Schema: Schema$o,
734
- Template: Template$o,
735
- registry_id: registry_id$o
733
+ Schema: Schema$q,
734
+ Template: Template$q,
735
+ registry_id: registry_id$q
736
736
  };
737
737
 
738
- const registry_id$n = cooptypes.Cooperative.Registry.UserAgreement.registry_id;
739
- const Schema$n = {
738
+ const registry_id$p = cooptypes.Cooperative.Registry.UserAgreement.registry_id;
739
+ const Schema$p = {
740
740
  type: "object",
741
741
  properties: {
742
742
  meta: IMetaJSONSchema,
@@ -753,23 +753,23 @@ const Schema$n = {
753
753
  required: ["meta", "coop", "vars", "user"],
754
754
  additionalProperties: true
755
755
  };
756
- const Template$n = {
756
+ const Template$p = {
757
757
  title: cooptypes.Cooperative.Registry.UserAgreement.title,
758
758
  description: cooptypes.Cooperative.Registry.UserAgreement.description,
759
- model: Schema$n,
759
+ model: Schema$p,
760
760
  context: cooptypes.Cooperative.Registry.UserAgreement.context,
761
761
  translations: cooptypes.Cooperative.Registry.UserAgreement.translations
762
762
  };
763
763
 
764
764
  const UserAgreement = {
765
765
  __proto__: null,
766
- Schema: Schema$n,
767
- Template: Template$n,
768
- registry_id: registry_id$n
766
+ Schema: Schema$p,
767
+ Template: Template$p,
768
+ registry_id: registry_id$p
769
769
  };
770
770
 
771
- const registry_id$m = cooptypes.Cooperative.Registry.CoopenomicsAgreement.registry_id;
772
- const Schema$m = {
771
+ const registry_id$o = cooptypes.Cooperative.Registry.CoopenomicsAgreement.registry_id;
772
+ const Schema$o = {
773
773
  type: "object",
774
774
  properties: {
775
775
  meta: IMetaJSONSchema,
@@ -780,23 +780,23 @@ const Schema$m = {
780
780
  required: ["meta", "coop", "vars", "partner"],
781
781
  additionalProperties: true
782
782
  };
783
- const Template$m = {
783
+ const Template$o = {
784
784
  title: cooptypes.Cooperative.Registry.CoopenomicsAgreement.title,
785
785
  description: cooptypes.Cooperative.Registry.CoopenomicsAgreement.description,
786
- model: Schema$m,
786
+ model: Schema$o,
787
787
  context: cooptypes.Cooperative.Registry.CoopenomicsAgreement.context,
788
788
  translations: cooptypes.Cooperative.Registry.CoopenomicsAgreement.translations
789
789
  };
790
790
 
791
791
  const CoopenomicsAgreement = {
792
792
  __proto__: null,
793
- Schema: Schema$m,
794
- Template: Template$m,
795
- registry_id: registry_id$m
793
+ Schema: Schema$o,
794
+ Template: Template$o,
795
+ registry_id: registry_id$o
796
796
  };
797
797
 
798
- const registry_id$l = cooptypes.Cooperative.Registry.ParticipantApplication.registry_id;
799
- const Schema$l = {
798
+ const registry_id$n = cooptypes.Cooperative.Registry.ParticipantApplication.registry_id;
799
+ const Schema$n = {
800
800
  type: "object",
801
801
  properties: {
802
802
  type: {
@@ -885,23 +885,23 @@ const Schema$l = {
885
885
  required: ["meta", "coop", "type"],
886
886
  additionalProperties: true
887
887
  };
888
- const Template$l = {
888
+ const Template$n = {
889
889
  title: cooptypes.Cooperative.Registry.ParticipantApplication.title,
890
890
  description: cooptypes.Cooperative.Registry.ParticipantApplication.description,
891
- model: Schema$l,
891
+ model: Schema$n,
892
892
  context: cooptypes.Cooperative.Registry.ParticipantApplication.context,
893
893
  translations: cooptypes.Cooperative.Registry.ParticipantApplication.translations
894
894
  };
895
895
 
896
896
  const ParticipantApplication = {
897
897
  __proto__: null,
898
- Schema: Schema$l,
899
- Template: Template$l,
900
- registry_id: registry_id$l
898
+ Schema: Schema$n,
899
+ Template: Template$n,
900
+ registry_id: registry_id$n
901
901
  };
902
902
 
903
- const registry_id$k = cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.registry_id;
904
- const Schema$k = {
903
+ const registry_id$m = cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.registry_id;
904
+ const Schema$m = {
905
905
  type: "object",
906
906
  properties: {
907
907
  type: {
@@ -965,23 +965,23 @@ const Schema$k = {
965
965
  // vars не добавляем в обязательные параметры для обратной совместимости (начиная с 2.26)
966
966
  additionalProperties: true
967
967
  };
968
- const Template$k = {
968
+ const Template$m = {
969
969
  title: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.title,
970
970
  description: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.description,
971
- model: Schema$k,
971
+ model: Schema$m,
972
972
  context: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.context,
973
973
  translations: cooptypes.Cooperative.Registry.DecisionOfParticipantApplication.translations
974
974
  };
975
975
 
976
976
  const DecisionOfParticipantApplication = {
977
977
  __proto__: null,
978
- Schema: Schema$k,
979
- Template: Template$k,
980
- registry_id: registry_id$k
978
+ Schema: Schema$m,
979
+ Template: Template$m,
980
+ registry_id: registry_id$m
981
981
  };
982
982
 
983
- const registry_id$j = cooptypes.Cooperative.Registry.SelectBranchStatement.registry_id;
984
- const Schema$j = {
983
+ const registry_id$l = cooptypes.Cooperative.Registry.SelectBranchStatement.registry_id;
984
+ const Schema$l = {
985
985
  type: "object",
986
986
  properties: {
987
987
  type: {
@@ -1044,23 +1044,23 @@ const Schema$j = {
1044
1044
  required: ["meta", "type", "branch", "vars", "coop"],
1045
1045
  additionalProperties: true
1046
1046
  };
1047
- const Template$j = {
1047
+ const Template$l = {
1048
1048
  title: cooptypes.Cooperative.Registry.SelectBranchStatement.title,
1049
1049
  description: cooptypes.Cooperative.Registry.SelectBranchStatement.description,
1050
- model: Schema$j,
1050
+ model: Schema$l,
1051
1051
  context: cooptypes.Cooperative.Registry.SelectBranchStatement.context,
1052
1052
  translations: cooptypes.Cooperative.Registry.SelectBranchStatement.translations
1053
1053
  };
1054
1054
 
1055
1055
  const SelectBranchStatement = {
1056
1056
  __proto__: null,
1057
- Schema: Schema$j,
1058
- Template: Template$j,
1059
- registry_id: registry_id$j
1057
+ Schema: Schema$l,
1058
+ Template: Template$l,
1059
+ registry_id: registry_id$l
1060
1060
  };
1061
1061
 
1062
- const registry_id$i = cooptypes.Cooperative.Registry.ProjectFreeDecision.registry_id;
1063
- const Schema$i = {
1062
+ const registry_id$k = cooptypes.Cooperative.Registry.ProjectFreeDecision.registry_id;
1063
+ const Schema$k = {
1064
1064
  type: "object",
1065
1065
  properties: {
1066
1066
  coop: {
@@ -1095,23 +1095,23 @@ const Schema$i = {
1095
1095
  required: ["meta", "coop", "project", "suggester_name", "vars"],
1096
1096
  additionalProperties: true
1097
1097
  };
1098
- const Template$i = {
1098
+ const Template$k = {
1099
1099
  title: cooptypes.Cooperative.Registry.ProjectFreeDecision.title,
1100
1100
  description: cooptypes.Cooperative.Registry.ProjectFreeDecision.description,
1101
- model: Schema$i,
1101
+ model: Schema$k,
1102
1102
  context: cooptypes.Cooperative.Registry.ProjectFreeDecision.context,
1103
1103
  translations: cooptypes.Cooperative.Registry.ProjectFreeDecision.translations
1104
1104
  };
1105
1105
 
1106
1106
  const ProjectFreeDecision = {
1107
1107
  __proto__: null,
1108
- Schema: Schema$i,
1109
- Template: Template$i,
1110
- registry_id: registry_id$i
1108
+ Schema: Schema$k,
1109
+ Template: Template$k,
1110
+ registry_id: registry_id$k
1111
1111
  };
1112
1112
 
1113
- const registry_id$h = cooptypes.Cooperative.Registry.FreeDecision.registry_id;
1114
- const Schema$h = {
1113
+ const registry_id$j = cooptypes.Cooperative.Registry.FreeDecision.registry_id;
1114
+ const Schema$j = {
1115
1115
  type: "object",
1116
1116
  properties: {
1117
1117
  coop: {
@@ -1154,19 +1154,19 @@ const Schema$h = {
1154
1154
  // vars не вносим для обратной совместимости начиная с версии 2.25
1155
1155
  additionalProperties: true
1156
1156
  };
1157
- const Template$h = {
1157
+ const Template$j = {
1158
1158
  title: cooptypes.Cooperative.Registry.FreeDecision.title,
1159
1159
  description: cooptypes.Cooperative.Registry.FreeDecision.description,
1160
- model: Schema$h,
1160
+ model: Schema$j,
1161
1161
  context: cooptypes.Cooperative.Registry.FreeDecision.context,
1162
1162
  translations: cooptypes.Cooperative.Registry.FreeDecision.translations
1163
1163
  };
1164
1164
 
1165
1165
  const FreeDecision = {
1166
1166
  __proto__: null,
1167
- Schema: Schema$h,
1168
- Template: Template$h,
1169
- registry_id: registry_id$h
1167
+ Schema: Schema$j,
1168
+ Template: Template$j,
1169
+ registry_id: registry_id$j
1170
1170
  };
1171
1171
 
1172
1172
  const CommonRequestSchema = {
@@ -1196,8 +1196,8 @@ const CommonRequestSchema = {
1196
1196
  additionalProperties: true
1197
1197
  };
1198
1198
 
1199
- const registry_id$g = cooptypes.Cooperative.Registry.AssetContributionStatement.registry_id;
1200
- const Schema$g = {
1199
+ const registry_id$i = cooptypes.Cooperative.Registry.AssetContributionStatement.registry_id;
1200
+ const Schema$i = {
1201
1201
  type: "object",
1202
1202
  properties: {
1203
1203
  meta: IMetaJSONSchema,
@@ -1209,23 +1209,23 @@ const Schema$g = {
1209
1209
  required: ["meta", "coop", "vars", "request", "user"],
1210
1210
  additionalProperties: true
1211
1211
  };
1212
- const Template$g = {
1212
+ const Template$i = {
1213
1213
  title: cooptypes.Cooperative.Registry.AssetContributionStatement.title,
1214
1214
  description: cooptypes.Cooperative.Registry.AssetContributionStatement.description,
1215
- model: Schema$g,
1215
+ model: Schema$i,
1216
1216
  context: cooptypes.Cooperative.Registry.AssetContributionStatement.context,
1217
1217
  translations: cooptypes.Cooperative.Registry.AssetContributionStatement.translations
1218
1218
  };
1219
1219
 
1220
1220
  const AssetContributionStatement = {
1221
1221
  __proto__: null,
1222
- Schema: Schema$g,
1223
- Template: Template$g,
1224
- registry_id: registry_id$g
1222
+ Schema: Schema$i,
1223
+ Template: Template$i,
1224
+ registry_id: registry_id$i
1225
1225
  };
1226
1226
 
1227
- const registry_id$f = cooptypes.Cooperative.Registry.ReturnByAssetStatement.registry_id;
1228
- const Schema$f = {
1227
+ const registry_id$h = cooptypes.Cooperative.Registry.ReturnByAssetStatement.registry_id;
1228
+ const Schema$h = {
1229
1229
  type: "object",
1230
1230
  properties: {
1231
1231
  meta: IMetaJSONSchema,
@@ -1237,23 +1237,23 @@ const Schema$f = {
1237
1237
  required: ["meta", "coop", "vars", "request", "user"],
1238
1238
  additionalProperties: true
1239
1239
  };
1240
- const Template$f = {
1240
+ const Template$h = {
1241
1241
  title: cooptypes.Cooperative.Registry.ReturnByAssetStatement.title,
1242
1242
  description: cooptypes.Cooperative.Registry.ReturnByAssetStatement.description,
1243
- model: Schema$f,
1243
+ model: Schema$h,
1244
1244
  context: cooptypes.Cooperative.Registry.ReturnByAssetStatement.context,
1245
1245
  translations: cooptypes.Cooperative.Registry.ReturnByAssetStatement.translations
1246
1246
  };
1247
1247
 
1248
1248
  const ReturnByAssetStatement = {
1249
1249
  __proto__: null,
1250
- Schema: Schema$f,
1251
- Template: Template$f,
1252
- registry_id: registry_id$f
1250
+ Schema: Schema$h,
1251
+ Template: Template$h,
1252
+ registry_id: registry_id$h
1253
1253
  };
1254
1254
 
1255
- const registry_id$e = cooptypes.Cooperative.Registry.AssetContributionDecision.registry_id;
1256
- const Schema$e = {
1255
+ const registry_id$g = cooptypes.Cooperative.Registry.AssetContributionDecision.registry_id;
1256
+ const Schema$g = {
1257
1257
  type: "object",
1258
1258
  properties: {
1259
1259
  meta: IMetaJSONSchema,
@@ -1266,23 +1266,23 @@ const Schema$e = {
1266
1266
  required: ["meta", "coop", "vars", "request", "user", "decision"],
1267
1267
  additionalProperties: true
1268
1268
  };
1269
- const Template$e = {
1269
+ const Template$g = {
1270
1270
  title: cooptypes.Cooperative.Registry.AssetContributionDecision.title,
1271
1271
  description: cooptypes.Cooperative.Registry.AssetContributionDecision.description,
1272
- model: Schema$e,
1272
+ model: Schema$g,
1273
1273
  context: cooptypes.Cooperative.Registry.AssetContributionDecision.context,
1274
1274
  translations: cooptypes.Cooperative.Registry.AssetContributionDecision.translations
1275
1275
  };
1276
1276
 
1277
1277
  const AssetContributionDecision = {
1278
1278
  __proto__: null,
1279
- Schema: Schema$e,
1280
- Template: Template$e,
1281
- registry_id: registry_id$e
1279
+ Schema: Schema$g,
1280
+ Template: Template$g,
1281
+ registry_id: registry_id$g
1282
1282
  };
1283
1283
 
1284
- const registry_id$d = cooptypes.Cooperative.Registry.ReturnByAssetDecision.registry_id;
1285
- const Schema$d = {
1284
+ const registry_id$f = cooptypes.Cooperative.Registry.ReturnByAssetDecision.registry_id;
1285
+ const Schema$f = {
1286
1286
  type: "object",
1287
1287
  properties: {
1288
1288
  meta: IMetaJSONSchema,
@@ -1295,19 +1295,19 @@ const Schema$d = {
1295
1295
  required: ["meta", "coop", "vars", "request", "user", "decision"],
1296
1296
  additionalProperties: true
1297
1297
  };
1298
- const Template$d = {
1298
+ const Template$f = {
1299
1299
  title: cooptypes.Cooperative.Registry.ReturnByAssetDecision.title,
1300
1300
  description: cooptypes.Cooperative.Registry.ReturnByAssetDecision.description,
1301
- model: Schema$d,
1301
+ model: Schema$f,
1302
1302
  context: cooptypes.Cooperative.Registry.ReturnByAssetDecision.context,
1303
1303
  translations: cooptypes.Cooperative.Registry.ReturnByAssetDecision.translations
1304
1304
  };
1305
1305
 
1306
1306
  const ReturnByAssetDecision = {
1307
1307
  __proto__: null,
1308
- Schema: Schema$d,
1309
- Template: Template$d,
1310
- registry_id: registry_id$d
1308
+ Schema: Schema$f,
1309
+ Template: Template$f,
1310
+ registry_id: registry_id$f
1311
1311
  };
1312
1312
 
1313
1313
  const FirstLastMiddleNameSchema = {
@@ -1330,8 +1330,8 @@ const CommonProgramSchema = {
1330
1330
  additionalProperties: true
1331
1331
  };
1332
1332
 
1333
- const registry_id$c = cooptypes.Cooperative.Registry.AssetContributionAct.registry_id;
1334
- const Schema$c = {
1333
+ const registry_id$e = cooptypes.Cooperative.Registry.AssetContributionAct.registry_id;
1334
+ const Schema$e = {
1335
1335
  type: "object",
1336
1336
  properties: {
1337
1337
  meta: IMetaJSONSchema,
@@ -1348,23 +1348,23 @@ const Schema$c = {
1348
1348
  required: ["meta", "coop", "vars", "request", "user", "decision", "act_id", "receiver", "program"],
1349
1349
  additionalProperties: true
1350
1350
  };
1351
- const Template$c = {
1351
+ const Template$e = {
1352
1352
  title: cooptypes.Cooperative.Registry.AssetContributionAct.title,
1353
1353
  description: cooptypes.Cooperative.Registry.AssetContributionAct.description,
1354
- model: Schema$c,
1354
+ model: Schema$e,
1355
1355
  context: cooptypes.Cooperative.Registry.AssetContributionAct.context,
1356
1356
  translations: cooptypes.Cooperative.Registry.AssetContributionAct.translations
1357
1357
  };
1358
1358
 
1359
1359
  const AssetContributionAct = {
1360
1360
  __proto__: null,
1361
- Schema: Schema$c,
1362
- Template: Template$c,
1363
- registry_id: registry_id$c
1361
+ Schema: Schema$e,
1362
+ Template: Template$e,
1363
+ registry_id: registry_id$e
1364
1364
  };
1365
1365
 
1366
- const registry_id$b = cooptypes.Cooperative.Registry.ReturnByAssetAct.registry_id;
1367
- const Schema$b = {
1366
+ const registry_id$d = cooptypes.Cooperative.Registry.ReturnByAssetAct.registry_id;
1367
+ const Schema$d = {
1368
1368
  type: "object",
1369
1369
  properties: {
1370
1370
  meta: IMetaJSONSchema,
@@ -1381,15 +1381,97 @@ const Schema$b = {
1381
1381
  required: ["meta", "coop", "vars", "request", "user", "decision", "act_id", "transmitter", "program"],
1382
1382
  additionalProperties: true
1383
1383
  };
1384
- const Template$b = {
1384
+ const Template$d = {
1385
1385
  title: cooptypes.Cooperative.Registry.ReturnByAssetAct.title,
1386
1386
  description: cooptypes.Cooperative.Registry.ReturnByAssetAct.description,
1387
- model: Schema$b,
1387
+ model: Schema$d,
1388
1388
  context: cooptypes.Cooperative.Registry.ReturnByAssetAct.context,
1389
1389
  translations: cooptypes.Cooperative.Registry.ReturnByAssetAct.translations
1390
1390
  };
1391
1391
 
1392
1392
  const ReturnByAssetAct = {
1393
+ __proto__: null,
1394
+ Schema: Schema$d,
1395
+ Template: Template$d,
1396
+ registry_id: registry_id$d
1397
+ };
1398
+
1399
+ const registry_id$c = cooptypes.Cooperative.Registry.ReturnByMoney.registry_id;
1400
+ const Schema$c = {
1401
+ type: "object",
1402
+ properties: {
1403
+ meta: IMetaJSONSchema,
1404
+ coop: CooperativeSchema,
1405
+ vars: VarsSchema,
1406
+ user: CommonUserSchema,
1407
+ payment_details: { type: "string" },
1408
+ quantity: { type: "string" },
1409
+ currency: { type: "string" },
1410
+ payment_hash: { type: "string" }
1411
+ },
1412
+ required: ["meta", "coop", "vars", "user", "payment_details", "quantity", "currency", "payment_hash"],
1413
+ additionalProperties: false
1414
+ };
1415
+ const Template$c = {
1416
+ title: cooptypes.Cooperative.Registry.ReturnByMoney.title,
1417
+ description: cooptypes.Cooperative.Registry.ReturnByMoney.description,
1418
+ model: Schema$c,
1419
+ context: cooptypes.Cooperative.Registry.ReturnByMoney.context,
1420
+ translations: cooptypes.Cooperative.Registry.ReturnByMoney.translations
1421
+ };
1422
+
1423
+ const ReturnByMoney = {
1424
+ __proto__: null,
1425
+ Schema: Schema$c,
1426
+ Template: Template$c,
1427
+ registry_id: registry_id$c
1428
+ };
1429
+
1430
+ const registry_id$b = cooptypes.Cooperative.Registry.ReturnByMoneyDecision.registry_id;
1431
+ const Schema$b = {
1432
+ type: "object",
1433
+ properties: {
1434
+ meta: {
1435
+ type: "object",
1436
+ properties: {
1437
+ ...IMetaJSONSchema.properties
1438
+ },
1439
+ required: [...IMetaJSONSchema.required],
1440
+ additionalProperties: true
1441
+ },
1442
+ coop: {
1443
+ type: "object",
1444
+ properties: {
1445
+ ...CooperativeSchema.properties
1446
+ },
1447
+ required: [...CooperativeSchema.required],
1448
+ additionalProperties: true
1449
+ },
1450
+ decision: {
1451
+ type: "object",
1452
+ properties: {
1453
+ ...decisionSchema.properties
1454
+ },
1455
+ required: [...decisionSchema.required],
1456
+ additionalProperties: true
1457
+ },
1458
+ user: CommonUserSchema,
1459
+ quantity: { type: "string" },
1460
+ currency: { type: "string" },
1461
+ vars: VarsSchema
1462
+ },
1463
+ required: ["meta", "coop", "decision", "user", "quantity", "currency", "vars"],
1464
+ additionalProperties: false
1465
+ };
1466
+ const Template$b = {
1467
+ title: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.title,
1468
+ description: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.description,
1469
+ model: Schema$b,
1470
+ context: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.context,
1471
+ translations: cooptypes.Cooperative.Registry.ReturnByMoneyDecision.translations
1472
+ };
1473
+
1474
+ const ReturnByMoneyDecision = {
1393
1475
  __proto__: null,
1394
1476
  Schema: Schema$b,
1395
1477
  Template: Template$b,
@@ -1892,6 +1974,8 @@ const Registry = {
1892
1974
  800: ReturnByAssetStatement,
1893
1975
  801: ReturnByAssetDecision,
1894
1976
  802: ReturnByAssetAct,
1977
+ 900: ReturnByMoney,
1978
+ 901: ReturnByMoneyDecision,
1895
1979
  1e3: InvestmentAgreement,
1896
1980
  1001: InvestByResultStatement,
1897
1981
  1002: InvestByResultAct,
@@ -2181,7 +2265,322 @@ class Entrepreneur {
2181
2265
  }
2182
2266
  }
2183
2267
 
2268
+ function matchMock({ code, table, value, actionName }, url, params) {
2269
+ if (!url.includes("/get-tables") && !url.includes("/get-actions")) {
2270
+ return false;
2271
+ }
2272
+ if (!params) {
2273
+ return false;
2274
+ }
2275
+ const filter = params.get("filter");
2276
+ if (!filter) {
2277
+ return false;
2278
+ }
2279
+ try {
2280
+ const obj = JSON.parse(filter);
2281
+ if (url.includes("/get-actions")) {
2282
+ if (code && obj.account !== code) {
2283
+ return false;
2284
+ }
2285
+ if (actionName && obj.name !== actionName) {
2286
+ return false;
2287
+ }
2288
+ } else {
2289
+ if (code && obj.code !== code) {
2290
+ return false;
2291
+ }
2292
+ if (table && obj.table !== table) {
2293
+ return false;
2294
+ }
2295
+ }
2296
+ if (value) {
2297
+ for (const key in value) {
2298
+ if (obj[key] !== value[key]) {
2299
+ return false;
2300
+ }
2301
+ }
2302
+ }
2303
+ return true;
2304
+ } catch {
2305
+ return false;
2306
+ }
2307
+ }
2308
+
2309
+ const meetValue = {
2310
+ id: "14",
2311
+ hash: "TEST_MEET_HASH_12345",
2312
+ coopname: "voskhod",
2313
+ type: "regular",
2314
+ level: "cooperative",
2315
+ initiator: "ant",
2316
+ presider: "ant",
2317
+ secretary: "ant",
2318
+ status: "created",
2319
+ created_at: "2025-06-23T12:31:46.000",
2320
+ open_at: "2025-06-23T12:20:00.000",
2321
+ close_at: "2025-06-23T12:22:00.000",
2322
+ notified_users: [],
2323
+ quorum_percent: 75,
2324
+ signed_ballots: "100",
2325
+ current_quorum_percent: 0,
2326
+ cycle: "1",
2327
+ quorum_passed: false,
2328
+ proposal: {
2329
+ version: "1.0.0",
2330
+ hash: "0EADEE40FCCBA221729FA5F5719F973E7BA90B2CA04841A9778D2A9F17F7F590",
2331
+ doc_hash: "C2EFB045E14EA76FC220102EEB2F13F38E771B74F4EE22EB7BDA66C70FD34530",
2332
+ meta_hash: "45D1F9A527D32A84295BD59D61FA28CB5162CD0BE179423926AE44F9CA84AA00",
2333
+ meta: '{"block_num":1700158,"coopname":"voskhod","created_at":"23.06.2025 15:31","generator":"coopjs","is_repeated":false,"lang":"ru","links":[],"meet":{"close_at_datetime":"23.06.2025 15:22 (\u041C\u0441\u043A)","open_at_datetime":"23.06.2025 15:20 (\u041C\u0441\u043A)","type":"regular"},"questions":[{"context":"\u0422\u0443\u0442 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u043A \u0432\u043E\u043F\u0440\u043E\u0441\u0443","decision":"\u0422\u0443\u0442 \u043F\u0440\u043E\u0435\u043A\u0442 \u0440\u0435\u0448\u0435\u043D\u0438\u044F \u043F\u043E \u0432\u043E\u043F\u0440\u043E\u0441\u0443","number":"1","title":"\u0422\u0435\u0441\u0442\u043E\u0432\u044B\u0439 \u0432\u043E\u043F\u0440\u043E\u0441"}],"registry_id":300,"timezone":"Europe/Moscow","title":"\u041F\u0440\u0435\u0434\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u043F\u043E\u0432\u0435\u0441\u0442\u043A\u0438 \u0434\u043D\u044F \u043E\u0431\u0449\u0435\u0433\u043E \u0441\u043E\u0431\u0440\u0430\u043D\u0438\u044F","username":"ant","version":"2025.6.19"}',
2334
+ signatures: [
2335
+ {
2336
+ id: 1,
2337
+ signed_hash: "B452BB6063CF5DBBDF9E30EB1D2BA64CB65265C8C311DD5013C1237FA4327CDF",
2338
+ signer: "ant",
2339
+ public_key: "PUB_K1_6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5BoDq63",
2340
+ signature: "SIG_K1_Kd6HWvecCZ1nmSZyvy3c2B9Rkvj3Y8tiv8yubXEK7V46E2ERUZSpLoedASi6vCwJQcu3cUK1WzR4oxbYKPRbvnom3QfZLa",
2341
+ signed_at: "2025-06-23T12:31:45.000",
2342
+ meta: "{}"
2343
+ }
2344
+ ]
2345
+ },
2346
+ authorization: {
2347
+ version: "",
2348
+ hash: "0000000000000000000000000000000000000000000000000000000000000000",
2349
+ doc_hash: "0000000000000000000000000000000000000000000000000000000000000000",
2350
+ meta_hash: "0000000000000000000000000000000000000000000000000000000000000000",
2351
+ meta: "",
2352
+ signatures: []
2353
+ },
2354
+ decision1: {
2355
+ version: "",
2356
+ hash: "0000000000000000000000000000000000000000000000000000000000000000",
2357
+ doc_hash: "0000000000000000000000000000000000000000000000000000000000000000",
2358
+ meta_hash: "0000000000000000000000000000000000000000000000000000000000000000",
2359
+ meta: "",
2360
+ signatures: []
2361
+ },
2362
+ decision2: {
2363
+ version: "",
2364
+ hash: "0000000000000000000000000000000000000000000000000000000000000000",
2365
+ doc_hash: "0000000000000000000000000000000000000000000000000000000000000000",
2366
+ meta_hash: "0000000000000000000000000000000000000000000000000000000000000000",
2367
+ meta: "",
2368
+ signatures: []
2369
+ }
2370
+ };
2371
+ const meetTableFull = {
2372
+ _id: "685949339bd56240ad71b34f",
2373
+ chain_id: "f50256680336ee6daaeee93915b945c1166b5dfc98977adcb717403ae225c559",
2374
+ block_num: 1700165,
2375
+ block_id: "0019F1455FEF5180A7106C1F80FB651C0FC1B7596A83FA33E4774C525929A0E4",
2376
+ present: true,
2377
+ code: "meet",
2378
+ scope: "voskhod",
2379
+ table: "meets",
2380
+ primary_key: "14",
2381
+ value: meetValue
2382
+ };
2383
+ const meetTableMock = {
2384
+ code: "meet",
2385
+ table: "meets",
2386
+ value: { "value.hash": "TEST_MEET_HASH_12345" },
2387
+ data: {
2388
+ results: [meetTableFull]
2389
+ },
2390
+ match: (_url, _params) => false
2391
+ };
2392
+
2393
+ meetTableMock.match = function(url, params) {
2394
+ return matchMock(this, url, params);
2395
+ };
2396
+ const tablesMocks = [meetTableMock];
2397
+
2398
+ const voteForAction = {
2399
+ _id: "6852b0389bd56240ad71b225",
2400
+ chain_id: "f50256680336ee6daaeee93915b945c1166b5dfc98977adcb717403ae225c559",
2401
+ block_id: "000CBF518A8998507069881FF00EE74E1E2E5345CD9B3D1F34E09DA732AC1D3D",
2402
+ block_num: 835409,
2403
+ transaction_id: "F79ED54A8D37076C3ADC73D3A10EF2A3933089D7B2B3D87F46D8703BCB34DA5B",
2404
+ global_sequence: "836089",
2405
+ receipt: {
2406
+ receiver: "soviet",
2407
+ act_digest: "642C266D89D4FB33ACB2A41E4294A382A451F361FCD040F5D202F8D1816FBFF2",
2408
+ global_sequence: "836089",
2409
+ recv_sequence: "163",
2410
+ auth_sequence: [{ account: "xtszqmpgtuiv", sequence: "3" }],
2411
+ code_sequence: 1,
2412
+ abi_sequence: 1
2413
+ },
2414
+ account: "soviet",
2415
+ name: "votefor",
2416
+ authorization: [{ actor: "xtszqmpgtuiv", permission: "active" }],
2417
+ data: {
2418
+ version: "1.0.0",
2419
+ coopname: "voskhod",
2420
+ username: "xtszqmpgtuiv",
2421
+ decision_id: "17",
2422
+ signed_at: "2025-06-18T12:25:23.000",
2423
+ signed_hash: "940734E565D3FA78527CC85C90D8601D7801F896EC5B40F6D1CC1DF0C6600948",
2424
+ signature: "SIG_K1_KkSjs8tZtmDmTyLvaCEETVZ2QQQpshMF3ZyEjVXadNXivsAQfjbkrN6smKRoApqXjBhc5vHhL8vbSt4itAzYRbrvHF18WF",
2425
+ public_key: "PUB_K1_52YPV66yKaju9WTXKuk8xWRSsCZ18Ewt9Z6SW24yMsRySPi2mZ"
2426
+ },
2427
+ action_ordinal: 1,
2428
+ creator_action_ordinal: 0,
2429
+ receiver: "soviet",
2430
+ context_free: false,
2431
+ elapsed: "0",
2432
+ console: "",
2433
+ account_ram_deltas: [{ account: "soviet", delta: "8" }],
2434
+ return_value: ""
2435
+ };
2436
+ const voteforActionMock = {
2437
+ code: "soviet",
2438
+ actionName: "votefor",
2439
+ value: { "data.decision_id": "17", "data.coopname": "voskhod" },
2440
+ data: {
2441
+ results: [voteForAction]
2442
+ },
2443
+ match: (_url, _params) => false
2444
+ };
2445
+
2446
+ const returnByMoneyDecisionAction = {
2447
+ _id: "6852b0389bd56240ad71b998",
2448
+ chain_id: "f50256680336ee6daaeee93915b945c1166b5dfc98977adcb717403ae225c559",
2449
+ block_id: "000CBF518A8998507069881FF00EE74E1E2E5345CD9B3D1F34E09DA732AC1D3D",
2450
+ block_num: 835409,
2451
+ transaction_id: "F79ED54A8D37076C3ADC73D3A10EF2A3933089D7B2B3D87F46D8703BCB34DA5B",
2452
+ global_sequence: "836089",
2453
+ receipt: {
2454
+ receiver: "soviet",
2455
+ act_digest: "642C266D89D4FB33ACB2A41E4294A382A451F361FCD040F5D202F8D1816FBFF2",
2456
+ global_sequence: "836089",
2457
+ recv_sequence: "163",
2458
+ auth_sequence: [{ account: "ant", sequence: "3" }],
2459
+ code_sequence: 1,
2460
+ abi_sequence: 1
2461
+ },
2462
+ account: "soviet",
2463
+ name: "returnbymoneydecision",
2464
+ authorization: [{ actor: "ant", permission: "active" }],
2465
+ data: {
2466
+ version: "1.0.0",
2467
+ coopname: "voskhod",
2468
+ username: "ant",
2469
+ decision_id: "9001",
2470
+ payment_hash: "abc123def456hash789",
2471
+ amount: "50000",
2472
+ currency: "\u0440\u0443\u0431.",
2473
+ signed_at: "2025-06-18T12:25:23.000",
2474
+ signed_hash: "940734E565D3FA78527CC85C90D8601D7801F896EC5B40F6D1CC1DF0C6600948",
2475
+ signature: "SIG_K1_KkSjs8tZtmDmTyLvaCEETVZ2QQQpshMF3ZyEjVXadNXivsAQfjbkrN6smKRoApqXjBhc5vHhL8vbSt4itAzYRbrvHF18WF",
2476
+ public_key: "PUB_K1_52YPV66yKaju9WTXKuk8xWRSsCZ18Ewt9Z6SW24yMsRySPi2mZ"
2477
+ },
2478
+ action_ordinal: 1,
2479
+ creator_action_ordinal: 0,
2480
+ receiver: "soviet",
2481
+ context_free: false,
2482
+ elapsed: "0",
2483
+ console: "",
2484
+ account_ram_deltas: [{ account: "soviet", delta: "8" }],
2485
+ return_value: ""
2486
+ };
2487
+ const voteForAction9001_1 = {
2488
+ _id: "6852b0389bd56240ad71b990",
2489
+ chain_id: "f50256680336ee6daaeee93915b945c1166b5dfc98977adcb717403ae225c559",
2490
+ block_id: "000CBF518A8998507069881FF00EE74E1E2E5345CD9B3D1F34E09DA732AC1D3D",
2491
+ block_num: 835400,
2492
+ transaction_id: "F79ED54A8D37076C3ADC73D3A10EF2A3933089D7B2B3D87F46D8703BCB34DA5A",
2493
+ global_sequence: "836080",
2494
+ receipt: {
2495
+ receiver: "soviet",
2496
+ act_digest: "642C266D89D4FB33ACB2A41E4294A382A451F361FCD040F5D202F8D1816FBFF1",
2497
+ global_sequence: "836080",
2498
+ recv_sequence: "160",
2499
+ auth_sequence: [{ account: "member1", sequence: "1" }],
2500
+ code_sequence: 1,
2501
+ abi_sequence: 1
2502
+ },
2503
+ account: "soviet",
2504
+ name: "votefor",
2505
+ authorization: [{ actor: "member1", permission: "active" }],
2506
+ data: {
2507
+ version: "1.0.0",
2508
+ coopname: "voskhod",
2509
+ username: "member1",
2510
+ decision_id: "9001",
2511
+ signed_at: "2025-06-18T12:20:00.000",
2512
+ signed_hash: "940734E565D3FA78527CC85C90D8601D7801F896EC5B40F6D1CC1DF0C6600940",
2513
+ signature: "SIG_K1_KkSjs8tZtmDmTyLvaCEETVZ2QQQpshMF3ZyEjVXadNXivsAQfjbkrN6smKRoApqXjBhc5vHhL8vbSt4itAzYRbrvHF18WA",
2514
+ public_key: "PUB_K1_52YPV66yKaju9WTXKuk8xWRSsCZ18Ewt9Z6SW24yMsRySPi2mA"
2515
+ },
2516
+ action_ordinal: 1,
2517
+ creator_action_ordinal: 0,
2518
+ receiver: "soviet",
2519
+ context_free: false,
2520
+ elapsed: "0",
2521
+ console: "",
2522
+ account_ram_deltas: [{ account: "soviet", delta: "8" }],
2523
+ return_value: ""
2524
+ };
2525
+ const voteAgainstAction9001 = [];
2526
+ const returnByMoneyDecisionActionMock = {
2527
+ code: "soviet",
2528
+ actionName: "returnbymoneydecision",
2529
+ value: { "data.decision_id": "9001", "data.coopname": "voskhod" },
2530
+ data: {
2531
+ results: [returnByMoneyDecisionAction]
2532
+ },
2533
+ match: (_url, _params) => false
2534
+ };
2535
+ const voteForDecision9001Mock = {
2536
+ code: "soviet",
2537
+ actionName: "votefor",
2538
+ value: { "data.decision_id": "9001", "data.coopname": "voskhod" },
2539
+ data: {
2540
+ results: [voteForAction9001_1]
2541
+ },
2542
+ match: (_url, _params) => false
2543
+ };
2544
+ const voteAgainstDecision9001Mock = {
2545
+ code: "soviet",
2546
+ actionName: "voteagainst",
2547
+ value: { "data.decision_id": "9001", "data.coopname": "voskhod" },
2548
+ data: {
2549
+ results: voteAgainstAction9001
2550
+ },
2551
+ match: (_url, _params) => false
2552
+ };
2553
+
2554
+ voteforActionMock.match = function(url, params) {
2555
+ return matchMock(this, url, params);
2556
+ };
2557
+ returnByMoneyDecisionActionMock.match = function(url, params) {
2558
+ return matchMock(this, url, params);
2559
+ };
2560
+ voteForDecision9001Mock.match = function(url, params) {
2561
+ return matchMock(this, url, params);
2562
+ };
2563
+ voteAgainstDecision9001Mock.match = function(url, params) {
2564
+ return matchMock(this, url, params);
2565
+ };
2566
+ const actionsMocks = [
2567
+ voteforActionMock,
2568
+ returnByMoneyDecisionActionMock,
2569
+ voteForDecision9001Mock,
2570
+ voteAgainstDecision9001Mock
2571
+ ];
2572
+
2573
+ const testMocks = [
2574
+ ...tablesMocks,
2575
+ ...actionsMocks
2576
+ ];
2577
+
2184
2578
  async function getFetch(url, params) {
2579
+ if (process.env.NODE_ENV === "test") {
2580
+ const mock = testMocks.find((m) => m.match(url, params));
2581
+ if (mock)
2582
+ return mock.data;
2583
+ }
2185
2584
  try {
2186
2585
  const response = await fetch(`${url}?${params?.toString()}`, {
2187
2586
  method: "GET",
@@ -2517,7 +2916,7 @@ class PDFService {
2517
2916
 
2518
2917
  const name = "@coopenomics/factory";
2519
2918
  const type = "module";
2520
- const version = "2025.6.24";
2919
+ const version = "2025.7.1-1";
2521
2920
  const packageManager = "pnpm@9.0.6";
2522
2921
  const description = "";
2523
2922
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
@@ -2560,14 +2959,15 @@ const scripts = {
2560
2959
  prepublishOnly: "nr build",
2561
2960
  release: "bumpp && npm publish",
2562
2961
  test: "vitest --dir test --testTimeout=240000 --exclude documents --watch=false",
2563
- typecheck: "tsc --noEmit"
2962
+ typecheck: "tsc --noEmit",
2963
+ "setup-indexes": "tsx scripts/setup-indexes.ts"
2564
2964
  };
2565
2965
  const dependencies = {
2566
2966
  ajv: "^8.13.0",
2567
2967
  "ajv-formats": "^3.0.1",
2568
2968
  "ajv-i18n": "^4.2.0",
2569
2969
  axios: "^1.7.2",
2570
- cooptypes: "2025.6.24",
2970
+ cooptypes: "2025.7.1-1",
2571
2971
  dotenv: "^16.4.5",
2572
2972
  "eosjs-ecc": "^4.0.7",
2573
2973
  handlebars: "^4.7.8",
@@ -2608,7 +3008,7 @@ const pnpm = {
2608
3008
  "vite@>=5.1.0 <=5.1.6": ">=5.1.7"
2609
3009
  }
2610
3010
  };
2611
- const gitHead = "32e6a45f0597e651c2f3ab787462f7aa723c1732";
3011
+ const gitHead = "226c7f9473373d1de78790b126422f50fa3d9396";
2612
3012
  const packageJson = {
2613
3013
  name: name,
2614
3014
  type: type,
@@ -3092,18 +3492,37 @@ class DocFactory {
3092
3492
  const [, amount, symbol] = match;
3093
3493
  return `${Number.parseFloat(amount).toFixed(precision)} ${symbol}`;
3094
3494
  }
3495
+ formatPaymentDetails(paymentMethod, recipientName) {
3496
+ switch (paymentMethod.method_type) {
3497
+ case "bank_transfer": {
3498
+ const bankData = paymentMethod.data;
3499
+ return `\u2116 \u0441\u0447\u0435\u0442\u0430 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F: ${bankData.account_number}
3500
+ \u0411\u0430\u043D\u043A \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F: ${bankData.bank_name}
3501
+ \u041A\u043E\u0440\u0440. \u0441\u0447\u0435\u0442 \u0431\u0430\u043D\u043A\u0430: ${bankData.details?.corr || ""}
3502
+ \u0411\u0418\u041A ${bankData.details?.bik || ""}
3503
+ \u041F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044C: ${recipientName}`;
3504
+ }
3505
+ case "sbp": {
3506
+ const sbpData = paymentMethod.data;
3507
+ return `\u0421\u0411\u041F
3508
+ \u0422\u0435\u043B\u0435\u0444\u043E\u043D \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F: ${sbpData.phone}`;
3509
+ }
3510
+ default:
3511
+ return JSON.stringify(paymentMethod.data);
3512
+ }
3513
+ }
3095
3514
  }
3096
3515
 
3097
- let Factory$q = class Factory extends DocFactory {
3516
+ let Factory$s = class Factory extends DocFactory {
3098
3517
  constructor(storage) {
3099
3518
  super(storage);
3100
3519
  }
3101
3520
  async generateDocument(data, options) {
3102
3521
  let template;
3103
3522
  if (process.env.SOURCE === "local") {
3104
- template = Template$q;
3523
+ template = Template$s;
3105
3524
  } else {
3106
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$q, data.block_num);
3525
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$s, data.block_num);
3107
3526
  }
3108
3527
  const meta = await super.getMeta({ title: template.title, ...data });
3109
3528
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -3121,16 +3540,16 @@ let Factory$q = class Factory extends DocFactory {
3121
3540
  }
3122
3541
  };
3123
3542
 
3124
- let Factory$p = class Factory extends DocFactory {
3543
+ let Factory$r = class Factory extends DocFactory {
3125
3544
  constructor(storage) {
3126
3545
  super(storage);
3127
3546
  }
3128
3547
  async generateDocument(data, options) {
3129
3548
  let template;
3130
3549
  if (process.env.SOURCE === "local") {
3131
- template = Template$p;
3550
+ template = Template$r;
3132
3551
  } else {
3133
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$p, data.block_num);
3552
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$r, data.block_num);
3134
3553
  }
3135
3554
  const meta = await super.getMeta({ title: template.title, ...data });
3136
3555
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -3148,16 +3567,16 @@ let Factory$p = class Factory extends DocFactory {
3148
3567
  }
3149
3568
  };
3150
3569
 
3151
- let Factory$o = class Factory extends DocFactory {
3570
+ let Factory$q = class Factory extends DocFactory {
3152
3571
  constructor(storage) {
3153
3572
  super(storage);
3154
3573
  }
3155
3574
  async generateDocument(data, options) {
3156
3575
  let template;
3157
3576
  if (process.env.SOURCE === "local") {
3158
- template = Template$o;
3577
+ template = Template$q;
3159
3578
  } else {
3160
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$o, data.block_num);
3579
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$q, data.block_num);
3161
3580
  }
3162
3581
  const meta = await super.getMeta({ title: template.title, ...data });
3163
3582
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -3175,16 +3594,16 @@ let Factory$o = class Factory extends DocFactory {
3175
3594
  }
3176
3595
  };
3177
3596
 
3178
- let Factory$n = class Factory extends DocFactory {
3597
+ let Factory$p = class Factory extends DocFactory {
3179
3598
  constructor(storage) {
3180
3599
  super(storage);
3181
3600
  }
3182
3601
  async generateDocument(data, options) {
3183
3602
  let template;
3184
3603
  if (process.env.SOURCE === "local") {
3185
- template = Template$n;
3604
+ template = Template$p;
3186
3605
  } else {
3187
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$n, data.block_num);
3606
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$p, data.block_num);
3188
3607
  }
3189
3608
  const meta = await super.getMeta({ title: template.title, ...data });
3190
3609
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -3206,16 +3625,16 @@ let Factory$n = class Factory extends DocFactory {
3206
3625
  }
3207
3626
  };
3208
3627
 
3209
- let Factory$m = class Factory extends DocFactory {
3628
+ let Factory$o = class Factory extends DocFactory {
3210
3629
  constructor(storage) {
3211
3630
  super(storage);
3212
3631
  }
3213
3632
  async generateDocument(data, options) {
3214
3633
  let template;
3215
3634
  if (process.env.SOURCE === "local") {
3216
- template = Template$m;
3635
+ template = Template$o;
3217
3636
  } else {
3218
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$m, data.block_num);
3637
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$o, data.block_num);
3219
3638
  }
3220
3639
  const meta = await super.getMeta({ title: template.title, ...data });
3221
3640
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -3235,16 +3654,16 @@ let Factory$m = class Factory extends DocFactory {
3235
3654
  }
3236
3655
  };
3237
3656
 
3238
- let Factory$l = class Factory extends DocFactory {
3657
+ let Factory$n = class Factory extends DocFactory {
3239
3658
  constructor(storage) {
3240
3659
  super(storage);
3241
3660
  }
3242
3661
  async generateDocument(data, _options) {
3243
3662
  let template;
3244
3663
  if (process.env.SOURCE === "local") {
3245
- template = Template$j;
3664
+ template = Template$l;
3246
3665
  } else {
3247
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$j, data.block_num);
3666
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$l, data.block_num);
3248
3667
  }
3249
3668
  const user = await super.getUser(data.username, data.block_num);
3250
3669
  const userData = {
@@ -3266,16 +3685,16 @@ let Factory$l = class Factory extends DocFactory {
3266
3685
  }
3267
3686
  };
3268
3687
 
3269
- let Factory$k = class Factory extends DocFactory {
3688
+ let Factory$m = class Factory extends DocFactory {
3270
3689
  constructor(storage) {
3271
3690
  super(storage);
3272
3691
  }
3273
3692
  async generateDocument(data, _options) {
3274
3693
  let template;
3275
3694
  if (process.env.SOURCE === "local") {
3276
- template = Template$l;
3695
+ template = Template$n;
3277
3696
  } else {
3278
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$l, data.block_num);
3697
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$n, data.block_num);
3279
3698
  }
3280
3699
  const user = await super.getUser(data.username, data.block_num);
3281
3700
  let bank_account = {};
@@ -3336,16 +3755,16 @@ let Factory$k = class Factory extends DocFactory {
3336
3755
  }
3337
3756
  };
3338
3757
 
3339
- let Factory$j = class Factory extends DocFactory {
3758
+ let Factory$l = class Factory extends DocFactory {
3340
3759
  constructor(storage) {
3341
3760
  super(storage);
3342
3761
  }
3343
3762
  async generateDocument(data, options) {
3344
3763
  let template;
3345
3764
  if (process.env.SOURCE === "local") {
3346
- template = Template$k;
3765
+ template = Template$m;
3347
3766
  } else {
3348
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$k, data.block_num);
3767
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$m, data.block_num);
3349
3768
  }
3350
3769
  const user = await super.getUser(data.username, data.block_num);
3351
3770
  const userData = {
@@ -3385,16 +3804,16 @@ let Factory$j = class Factory extends DocFactory {
3385
3804
  }
3386
3805
  };
3387
3806
 
3388
- let Factory$i = class Factory extends DocFactory {
3807
+ let Factory$k = class Factory extends DocFactory {
3389
3808
  constructor(storage) {
3390
3809
  super(storage);
3391
3810
  }
3392
3811
  async generateDocument(data, options) {
3393
3812
  let template;
3394
3813
  if (process.env.SOURCE === "local") {
3395
- template = Template$i;
3814
+ template = Template$k;
3396
3815
  } else {
3397
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$i, data.block_num);
3816
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$k, data.block_num);
3398
3817
  }
3399
3818
  const user = await this.getUser(data.username, data.block_num);
3400
3819
  const suggester_name = await this.getFullName(user.data);
@@ -3430,16 +3849,16 @@ let Factory$i = class Factory extends DocFactory {
3430
3849
  }
3431
3850
  };
3432
3851
 
3433
- let Factory$h = class Factory extends DocFactory {
3852
+ let Factory$j = class Factory extends DocFactory {
3434
3853
  constructor(storage) {
3435
3854
  super(storage);
3436
3855
  }
3437
3856
  async generateDocument(data, options) {
3438
3857
  let template;
3439
3858
  if (process.env.SOURCE === "local") {
3440
- template = Template$h;
3859
+ template = Template$j;
3441
3860
  } else {
3442
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$h, data.block_num);
3861
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$j, data.block_num);
3443
3862
  }
3444
3863
  const user = await this.getUser(data.username, data.block_num);
3445
3864
  const userData = {
@@ -3482,16 +3901,16 @@ let Factory$h = class Factory extends DocFactory {
3482
3901
  }
3483
3902
  };
3484
3903
 
3485
- let Factory$g = class Factory extends DocFactory {
3904
+ let Factory$i = class Factory extends DocFactory {
3486
3905
  constructor(storage) {
3487
3906
  super(storage);
3488
3907
  }
3489
3908
  async generateDocument(data, options) {
3490
3909
  let template;
3491
3910
  if (process.env.SOURCE === "local") {
3492
- template = Template$g;
3911
+ template = Template$i;
3493
3912
  } else {
3494
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$g, data.block_num);
3913
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$i, data.block_num);
3495
3914
  }
3496
3915
  const meta = await super.getMeta({ title: template.title, ...data });
3497
3916
  const coop = await super.getCooperative(data.coopname, data.block_num);
@@ -3513,16 +3932,16 @@ let Factory$g = class Factory extends DocFactory {
3513
3932
  }
3514
3933
  };
3515
3934
 
3516
- let Factory$f = class Factory extends DocFactory {
3935
+ let Factory$h = class Factory extends DocFactory {
3517
3936
  constructor(storage) {
3518
3937
  super(storage);
3519
3938
  }
3520
3939
  async generateDocument(data, options) {
3521
3940
  let template;
3522
3941
  if (process.env.SOURCE === "local") {
3523
- template = Template$f;
3942
+ template = Template$h;
3524
3943
  } else {
3525
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$f, data.block_num);
3944
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$h, data.block_num);
3526
3945
  }
3527
3946
  const meta = await this.getMeta({ title: template.title, ...data });
3528
3947
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -3544,7 +3963,7 @@ let Factory$f = class Factory extends DocFactory {
3544
3963
  }
3545
3964
  };
3546
3965
 
3547
- let Factory$e = class Factory extends DocFactory {
3966
+ let Factory$g = class Factory extends DocFactory {
3548
3967
  constructor(storage) {
3549
3968
  super(storage);
3550
3969
  }
@@ -3571,16 +3990,16 @@ let Factory$e = class Factory extends DocFactory {
3571
3990
  }
3572
3991
  };
3573
3992
 
3574
- let Factory$d = class Factory extends DocFactory {
3993
+ let Factory$f = class Factory extends DocFactory {
3575
3994
  constructor(storage) {
3576
3995
  super(storage);
3577
3996
  }
3578
3997
  async generateDocument(data, options) {
3579
3998
  let template;
3580
3999
  if (process.env.SOURCE === "local") {
3581
- template = Template$e;
4000
+ template = Template$g;
3582
4001
  } else {
3583
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$e, data.block_num);
4002
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$g, data.block_num);
3584
4003
  }
3585
4004
  const meta = await this.getMeta({ title: template.title, ...data });
3586
4005
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -3604,16 +4023,16 @@ let Factory$d = class Factory extends DocFactory {
3604
4023
  }
3605
4024
  };
3606
4025
 
3607
- let Factory$c = class Factory extends DocFactory {
4026
+ let Factory$e = class Factory extends DocFactory {
3608
4027
  constructor(storage) {
3609
4028
  super(storage);
3610
4029
  }
3611
4030
  async generateDocument(data, options) {
3612
4031
  let template;
3613
4032
  if (process.env.SOURCE === "local") {
3614
- template = Template$c;
4033
+ template = Template$e;
3615
4034
  } else {
3616
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$c, data.block_num);
4035
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$e, data.block_num);
3617
4036
  }
3618
4037
  const meta = await this.getMeta({ title: template.title, ...data });
3619
4038
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -3648,16 +4067,16 @@ let Factory$c = class Factory extends DocFactory {
3648
4067
  }
3649
4068
  };
3650
4069
 
3651
- let Factory$b = class Factory extends DocFactory {
4070
+ let Factory$d = class Factory extends DocFactory {
3652
4071
  constructor(storage) {
3653
4072
  super(storage);
3654
4073
  }
3655
4074
  async generateDocument(data, options) {
3656
4075
  let template;
3657
4076
  if (process.env.SOURCE === "local") {
3658
- template = Template$d;
4077
+ template = Template$f;
3659
4078
  } else {
3660
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$d, data.block_num);
4079
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$f, data.block_num);
3661
4080
  }
3662
4081
  const meta = await this.getMeta({ title: template.title, ...data });
3663
4082
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -3681,16 +4100,16 @@ let Factory$b = class Factory extends DocFactory {
3681
4100
  }
3682
4101
  };
3683
4102
 
3684
- let Factory$a = class Factory extends DocFactory {
4103
+ let Factory$c = class Factory extends DocFactory {
3685
4104
  constructor(storage) {
3686
4105
  super(storage);
3687
4106
  }
3688
4107
  async generateDocument(data, options) {
3689
4108
  let template;
3690
4109
  if (process.env.SOURCE === "local") {
3691
- template = Template$b;
4110
+ template = Template$d;
3692
4111
  } else {
3693
- template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$b, data.block_num);
4112
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$d, data.block_num);
3694
4113
  }
3695
4114
  const meta = await this.getMeta({ title: template.title, ...data });
3696
4115
  const coop = await this.getCooperative(data.coopname, data.block_num);
@@ -3725,6 +4144,96 @@ let Factory$a = class Factory extends DocFactory {
3725
4144
  }
3726
4145
  };
3727
4146
 
4147
+ let Factory$b = class Factory extends DocFactory {
4148
+ constructor(storage) {
4149
+ super(storage);
4150
+ }
4151
+ async generateDocument(data, options) {
4152
+ let template;
4153
+ if (process.env.SOURCE === "local") {
4154
+ template = Template$c;
4155
+ } else {
4156
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$c, data.block_num);
4157
+ }
4158
+ console.log(data);
4159
+ const meta = await this.getMeta({ title: template.title, ...data });
4160
+ const coop = await this.getCooperative(data.coopname, data.block_num);
4161
+ const vars = await this.getVars(data.coopname, data.block_num);
4162
+ const user = await this.getUser(data.username, data.block_num);
4163
+ const commonUser = this.getCommonUser(user);
4164
+ const paymentMethodService = new PaymentMethod(this.storage);
4165
+ const paymentMethod = await paymentMethodService.getOne({
4166
+ method_id: data.method_id,
4167
+ username: data.username,
4168
+ deleted: false
4169
+ });
4170
+ if (!paymentMethod) {
4171
+ 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}`);
4172
+ }
4173
+ const combinedData = {
4174
+ meta,
4175
+ coop,
4176
+ vars,
4177
+ user: commonUser,
4178
+ payment_details: this.formatPaymentDetails(paymentMethod, commonUser.full_name_or_short_name),
4179
+ quantity: data.quantity,
4180
+ currency: data.currency,
4181
+ payment_hash: data.payment_hash
4182
+ };
4183
+ await this.validate(combinedData, template.model);
4184
+ const translation = template.translations[meta.lang];
4185
+ const document = await this.generatePDF(commonUser.full_name_or_short_name, template.context, combinedData, translation, meta, options?.skip_save);
4186
+ return document;
4187
+ }
4188
+ };
4189
+
4190
+ let Factory$a = class Factory extends DocFactory {
4191
+ constructor(storage) {
4192
+ super(storage);
4193
+ }
4194
+ async generateDocument(data, options) {
4195
+ let template;
4196
+ if (process.env.SOURCE === "local") {
4197
+ template = Template$b;
4198
+ } else {
4199
+ template = await this.getTemplate(cooptypes.DraftContract.contractName.production, registry_id$b, data.block_num);
4200
+ }
4201
+ const user = await super.getUser(data.username, data.block_num);
4202
+ const coop = await super.getCooperative(data.coopname, data.block_num);
4203
+ const vars = await super.getVars(data.coopname, data.block_num);
4204
+ const meta = await super.getMeta({
4205
+ title: template.title,
4206
+ ...data
4207
+ });
4208
+ const decision = await super.getDecision(
4209
+ coop,
4210
+ data.coopname,
4211
+ data.decision_id,
4212
+ meta.created_at
4213
+ );
4214
+ const combinedData = {
4215
+ vars,
4216
+ meta,
4217
+ coop,
4218
+ decision,
4219
+ user: super.getCommonUser(user),
4220
+ quantity: data.quantity,
4221
+ currency: data.currency
4222
+ };
4223
+ await super.validate(combinedData, template.model);
4224
+ const translation = template.translations[meta.lang];
4225
+ const document = await super.generatePDF(
4226
+ user.data,
4227
+ template.context,
4228
+ combinedData,
4229
+ translation,
4230
+ meta,
4231
+ options?.skip_save
4232
+ );
4233
+ return document;
4234
+ }
4235
+ };
4236
+
3728
4237
  let Factory$9 = class Factory extends DocFactory {
3729
4238
  constructor(storage) {
3730
4239
  super(storage);
@@ -3926,7 +4435,6 @@ let Factory$4 = class Factory extends DocFactory {
3926
4435
  const user = super.getCommonUser(userData);
3927
4436
  const meet = { ...data.meet };
3928
4437
  const questions = [...data.questions];
3929
- console.log("coop os: ", coop);
3930
4438
  const combinedData = {
3931
4439
  meta,
3932
4440
  coop,
@@ -4178,28 +4686,40 @@ class SearchService {
4178
4686
  __publicField$1(this, "storage");
4179
4687
  this.storage = storage;
4180
4688
  }
4689
+ // Экранирование специальных символов регулярных выражений
4690
+ escapeRegex(text) {
4691
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4692
+ }
4181
4693
  async search(query) {
4182
4694
  if (!query || query.trim().length === 0) {
4183
4695
  return [];
4184
4696
  }
4185
4697
  const results = [];
4186
4698
  const trimmedQuery = query.trim();
4187
- const regex = new RegExp(trimmedQuery, "i");
4699
+ console.log(`[SearchService] \u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0443: "${trimmedQuery}"`);
4700
+ const escapedQuery = this.escapeRegex(trimmedQuery);
4188
4701
  const queryWords = trimmedQuery.split(/\s+/).filter((word) => word.length > 0);
4189
4702
  try {
4190
- const individualResults = await this.searchIndividuals(regex, queryWords);
4703
+ console.log(`[SearchService] \u041F\u043E\u0438\u0441\u043A \u0432 individuals...`);
4704
+ const individualResults = await this.searchIndividuals(escapedQuery, queryWords, trimmedQuery);
4705
+ console.log(`[SearchService] \u041D\u0430\u0439\u0434\u0435\u043D\u043E individuals: ${individualResults.length}`);
4191
4706
  results.push(...individualResults);
4192
- const entrepreneurResults = await this.searchEntrepreneurs(regex, queryWords);
4707
+ console.log(`[SearchService] \u041F\u043E\u0438\u0441\u043A \u0432 entrepreneurs...`);
4708
+ const entrepreneurResults = await this.searchEntrepreneurs(escapedQuery, queryWords, trimmedQuery);
4709
+ console.log(`[SearchService] \u041D\u0430\u0439\u0434\u0435\u043D\u043E entrepreneurs: ${entrepreneurResults.length}`);
4193
4710
  results.push(...entrepreneurResults);
4194
- const organizationResults = await this.searchOrganizations(regex);
4711
+ console.log(`[SearchService] \u041F\u043E\u0438\u0441\u043A \u0432 organizations...`);
4712
+ const organizationResults = await this.searchOrganizations(escapedQuery);
4713
+ console.log(`[SearchService] \u041D\u0430\u0439\u0434\u0435\u043D\u043E organizations: ${organizationResults.length}`);
4195
4714
  results.push(...organizationResults);
4715
+ console.log(`[SearchService] \u041E\u0431\u0449\u0435\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u043E\u0432: ${results.length}`);
4196
4716
  return results.slice(0, 10);
4197
4717
  } catch (error) {
4198
- console.error("Error during search:", error);
4718
+ console.error("[SearchService] \u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0438 \u043F\u043E\u0438\u0441\u043A\u0435:", error);
4199
4719
  return [];
4200
4720
  }
4201
4721
  }
4202
- async searchIndividuals(regex, queryWords) {
4722
+ async searchIndividuals(regexPattern, queryWords, originalQuery) {
4203
4723
  const individualModel = new Individual(this.storage);
4204
4724
  const results = [];
4205
4725
  let filter;
@@ -4208,16 +4728,16 @@ class SearchService {
4208
4728
  deleted: false,
4209
4729
  $or: [
4210
4730
  // Поиск по отдельным полям
4211
- { first_name: { $regex: regex } },
4212
- { last_name: { $regex: regex } },
4213
- { middle_name: { $regex: regex } },
4731
+ { first_name: { $regex: regexPattern, $options: "i" } },
4732
+ { last_name: { $regex: regexPattern, $options: "i" } },
4733
+ { middle_name: { $regex: regexPattern, $options: "i" } },
4214
4734
  // Поиск по полному ФИО (все слова должны быть найдены)
4215
4735
  {
4216
4736
  $and: queryWords.map((word) => ({
4217
4737
  $or: [
4218
- { first_name: { $regex: new RegExp(word, "i") } },
4219
- { last_name: { $regex: new RegExp(word, "i") } },
4220
- { middle_name: { $regex: new RegExp(word, "i") } }
4738
+ { first_name: { $regex: this.escapeRegex(word), $options: "i" } },
4739
+ { last_name: { $regex: this.escapeRegex(word), $options: "i" } },
4740
+ { middle_name: { $regex: this.escapeRegex(word), $options: "i" } }
4221
4741
  ]
4222
4742
  }))
4223
4743
  }
@@ -4227,22 +4747,30 @@ class SearchService {
4227
4747
  filter = {
4228
4748
  deleted: false,
4229
4749
  $or: [
4230
- { first_name: { $regex: regex } },
4231
- { last_name: { $regex: regex } },
4232
- { middle_name: { $regex: regex } }
4750
+ { first_name: { $regex: regexPattern, $options: "i" } },
4751
+ { last_name: { $regex: regexPattern, $options: "i" } },
4752
+ { middle_name: { $regex: regexPattern, $options: "i" } }
4233
4753
  ]
4234
4754
  };
4235
4755
  }
4756
+ console.log(`[SearchService] \u0424\u0438\u043B\u044C\u0442\u0440 \u0434\u043B\u044F individuals:`, JSON.stringify(filter, null, 2));
4236
4757
  const individuals = await individualModel.getMany(filter);
4758
+ console.log(`[SearchService] \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u043F\u043E\u0438\u0441\u043A\u0430 individuals:`, {
4759
+ total: individuals.totalResults,
4760
+ found: individuals.results.length,
4761
+ query: originalQuery,
4762
+ names: individuals.results.map((ind) => `${ind.last_name} ${ind.first_name} ${ind.middle_name || ""} (deleted: ${ind.deleted || false})`)
4763
+ });
4237
4764
  for (const individual of individuals.results) {
4238
4765
  const highlightedFields = [];
4239
- if (regex.test(individual.first_name))
4766
+ const testRegex = new RegExp(regexPattern, "i");
4767
+ if (individual.first_name && testRegex.test(individual.first_name))
4240
4768
  highlightedFields.push("first_name");
4241
- if (regex.test(individual.last_name))
4769
+ if (individual.last_name && testRegex.test(individual.last_name))
4242
4770
  highlightedFields.push("last_name");
4243
- if (regex.test(individual.middle_name))
4771
+ if (individual.middle_name && testRegex.test(individual.middle_name))
4244
4772
  highlightedFields.push("middle_name");
4245
- const fullName = `${individual.last_name} ${individual.first_name} ${individual.middle_name}`.trim();
4773
+ const fullName = `${individual.last_name || ""} ${individual.first_name || ""} ${individual.middle_name || ""}`.trim();
4246
4774
  if (this.matchesFullName(fullName, queryWords)) {
4247
4775
  highlightedFields.push("full_name");
4248
4776
  }
@@ -4254,7 +4782,7 @@ class SearchService {
4254
4782
  }
4255
4783
  return results;
4256
4784
  }
4257
- async searchEntrepreneurs(regex, queryWords) {
4785
+ async searchEntrepreneurs(regexPattern, queryWords, originalQuery) {
4258
4786
  const entrepreneurModel = new Entrepreneur(this.storage);
4259
4787
  const results = [];
4260
4788
  let filter;
@@ -4263,18 +4791,18 @@ class SearchService {
4263
4791
  deleted: false,
4264
4792
  $or: [
4265
4793
  // Поиск по отдельным полям
4266
- { first_name: { $regex: regex } },
4267
- { last_name: { $regex: regex } },
4268
- { middle_name: { $regex: regex } },
4269
- { "details.inn": { $regex: regex } },
4270
- { "details.ogrn": { $regex: regex } },
4794
+ { first_name: { $regex: regexPattern, $options: "i" } },
4795
+ { last_name: { $regex: regexPattern, $options: "i" } },
4796
+ { middle_name: { $regex: regexPattern, $options: "i" } },
4797
+ { "details.inn": { $regex: regexPattern, $options: "i" } },
4798
+ { "details.ogrn": { $regex: regexPattern, $options: "i" } },
4271
4799
  // Поиск по полному ФИО
4272
4800
  {
4273
4801
  $and: queryWords.map((word) => ({
4274
4802
  $or: [
4275
- { first_name: { $regex: new RegExp(word, "i") } },
4276
- { last_name: { $regex: new RegExp(word, "i") } },
4277
- { middle_name: { $regex: new RegExp(word, "i") } }
4803
+ { first_name: { $regex: this.escapeRegex(word), $options: "i" } },
4804
+ { last_name: { $regex: this.escapeRegex(word), $options: "i" } },
4805
+ { middle_name: { $regex: this.escapeRegex(word), $options: "i" } }
4278
4806
  ]
4279
4807
  }))
4280
4808
  }
@@ -4284,28 +4812,36 @@ class SearchService {
4284
4812
  filter = {
4285
4813
  deleted: false,
4286
4814
  $or: [
4287
- { first_name: { $regex: regex } },
4288
- { last_name: { $regex: regex } },
4289
- { middle_name: { $regex: regex } },
4290
- { "details.inn": { $regex: regex } },
4291
- { "details.ogrn": { $regex: regex } }
4815
+ { first_name: { $regex: regexPattern, $options: "i" } },
4816
+ { last_name: { $regex: regexPattern, $options: "i" } },
4817
+ { middle_name: { $regex: regexPattern, $options: "i" } },
4818
+ { "details.inn": { $regex: regexPattern, $options: "i" } },
4819
+ { "details.ogrn": { $regex: regexPattern, $options: "i" } }
4292
4820
  ]
4293
4821
  };
4294
4822
  }
4823
+ console.log(`[SearchService] \u0424\u0438\u043B\u044C\u0442\u0440 \u0434\u043B\u044F entrepreneurs:`, JSON.stringify(filter, null, 2));
4295
4824
  const entrepreneurs = await entrepreneurModel.getMany(filter);
4825
+ console.log(`[SearchService] \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u043F\u043E\u0438\u0441\u043A\u0430 entrepreneurs:`, {
4826
+ total: entrepreneurs.totalResults,
4827
+ found: entrepreneurs.results.length,
4828
+ query: originalQuery,
4829
+ names: entrepreneurs.results.map((ent) => `${ent.last_name} ${ent.first_name} ${ent.middle_name || ""} (deleted: ${ent.deleted || false})`)
4830
+ });
4296
4831
  for (const entrepreneur of entrepreneurs.results) {
4297
4832
  const highlightedFields = [];
4298
- if (regex.test(entrepreneur.first_name))
4833
+ const testRegex = new RegExp(regexPattern, "i");
4834
+ if (entrepreneur.first_name && testRegex.test(entrepreneur.first_name))
4299
4835
  highlightedFields.push("first_name");
4300
- if (regex.test(entrepreneur.last_name))
4836
+ if (entrepreneur.last_name && testRegex.test(entrepreneur.last_name))
4301
4837
  highlightedFields.push("last_name");
4302
- if (regex.test(entrepreneur.middle_name))
4838
+ if (entrepreneur.middle_name && testRegex.test(entrepreneur.middle_name))
4303
4839
  highlightedFields.push("middle_name");
4304
- if (entrepreneur.details?.inn && regex.test(entrepreneur.details.inn))
4840
+ if (entrepreneur.details?.inn && testRegex.test(entrepreneur.details.inn))
4305
4841
  highlightedFields.push("details.inn");
4306
- if (entrepreneur.details?.ogrn && regex.test(entrepreneur.details.ogrn))
4842
+ if (entrepreneur.details?.ogrn && testRegex.test(entrepreneur.details.ogrn))
4307
4843
  highlightedFields.push("details.ogrn");
4308
- const fullName = `${entrepreneur.last_name} ${entrepreneur.first_name} ${entrepreneur.middle_name}`.trim();
4844
+ const fullName = `${entrepreneur.last_name || ""} ${entrepreneur.first_name || ""} ${entrepreneur.middle_name || ""}`.trim();
4309
4845
  if (this.matchesFullName(fullName, queryWords)) {
4310
4846
  highlightedFields.push("full_name");
4311
4847
  }
@@ -4317,24 +4853,25 @@ class SearchService {
4317
4853
  }
4318
4854
  return results;
4319
4855
  }
4320
- async searchOrganizations(regex) {
4856
+ async searchOrganizations(regexPattern) {
4321
4857
  const organizationModel = new Organization(this.storage);
4322
4858
  const results = [];
4323
4859
  const organizations = await organizationModel.getMany({
4324
4860
  deleted: false,
4325
4861
  $or: [
4326
- { short_name: { $regex: regex } },
4327
- { "details.inn": { $regex: regex } },
4328
- { "details.ogrn": { $regex: regex } }
4862
+ { short_name: { $regex: regexPattern, $options: "i" } },
4863
+ { "details.inn": { $regex: regexPattern, $options: "i" } },
4864
+ { "details.ogrn": { $regex: regexPattern, $options: "i" } }
4329
4865
  ]
4330
4866
  });
4331
4867
  for (const organization of organizations.results) {
4332
4868
  const highlightedFields = [];
4333
- if (regex.test(organization.short_name))
4869
+ const testRegex = new RegExp(regexPattern, "i");
4870
+ if (testRegex.test(organization.short_name))
4334
4871
  highlightedFields.push("short_name");
4335
- if (organization.details?.inn && regex.test(organization.details.inn))
4872
+ if (organization.details?.inn && testRegex.test(organization.details.inn))
4336
4873
  highlightedFields.push("details.inn");
4337
- if (organization.details?.ogrn && regex.test(organization.details.ogrn))
4874
+ if (organization.details?.ogrn && testRegex.test(organization.details.ogrn))
4338
4875
  highlightedFields.push("details.ogrn");
4339
4876
  results.push({
4340
4877
  type: "organization",
@@ -4370,19 +4907,19 @@ class Generator {
4370
4907
  this.storage = new MongoDBConnector(mongoUri);
4371
4908
  this.searchService = new SearchService(this.storage);
4372
4909
  this.factories = {
4373
- [registry_id$q]: new Factory$q(this.storage),
4910
+ [registry_id$s]: new Factory$s(this.storage),
4374
4911
  // 1
4375
- [registry_id$p]: new Factory$p(this.storage),
4912
+ [registry_id$r]: new Factory$r(this.storage),
4376
4913
  // 2
4377
- [registry_id$o]: new Factory$o(this.storage),
4914
+ [registry_id$q]: new Factory$q(this.storage),
4378
4915
  // 3
4379
- [registry_id$n]: new Factory$n(this.storage),
4916
+ [registry_id$p]: new Factory$p(this.storage),
4380
4917
  // 4
4381
- [registry_id$m]: new Factory$m(this.storage),
4918
+ [registry_id$o]: new Factory$o(this.storage),
4382
4919
  // 50
4383
- [registry_id$l]: new Factory$k(this.storage),
4920
+ [registry_id$n]: new Factory$m(this.storage),
4384
4921
  // 100
4385
- [registry_id$j]: new Factory$l(this.storage),
4922
+ [registry_id$l]: new Factory$n(this.storage),
4386
4923
  // 101
4387
4924
  // общее собрание
4388
4925
  [registry_id$4]: new Factory$4(this.storage),
@@ -4395,25 +4932,29 @@ class Generator {
4395
4932
  // 303
4396
4933
  [registry_id]: new Factory(this.storage),
4397
4934
  // 304
4398
- [registry_id$k]: new Factory$j(this.storage),
4935
+ [registry_id$m]: new Factory$l(this.storage),
4399
4936
  // 501
4400
- [registry_id$i]: new Factory$i(this.storage),
4937
+ [registry_id$k]: new Factory$k(this.storage),
4401
4938
  // 599
4402
- [registry_id$h]: new Factory$h(this.storage),
4939
+ [registry_id$j]: new Factory$j(this.storage),
4403
4940
  // 600
4404
- [registry_id$5]: new Factory$e(this.storage),
4941
+ [registry_id$5]: new Factory$g(this.storage),
4405
4942
  // 699
4406
- [registry_id$g]: new Factory$g(this.storage),
4943
+ [registry_id$i]: new Factory$i(this.storage),
4407
4944
  // 700
4408
- [registry_id$f]: new Factory$f(this.storage),
4945
+ [registry_id$h]: new Factory$h(this.storage),
4409
4946
  // 800
4410
- [registry_id$d]: new Factory$b(this.storage),
4947
+ [registry_id$f]: new Factory$d(this.storage),
4411
4948
  // 801
4412
- [registry_id$b]: new Factory$a(this.storage),
4949
+ [registry_id$d]: new Factory$c(this.storage),
4413
4950
  // 802
4414
- [registry_id$e]: new Factory$d(this.storage),
4951
+ [registry_id$c]: new Factory$b(this.storage),
4952
+ // 900
4953
+ [registry_id$b]: new Factory$a(this.storage),
4954
+ // 901
4955
+ [registry_id$g]: new Factory$f(this.storage),
4415
4956
  // 701
4416
- [registry_id$c]: new Factory$c(this.storage),
4957
+ [registry_id$e]: new Factory$e(this.storage),
4417
4958
  // 702
4418
4959
  [registry_id$a]: new Factory$9(this.storage),
4419
4960
  // 1000
@@ -4527,6 +5068,8 @@ exports.RegulationElectronicSignature = RegulationElectronicSignaturet;
4527
5068
  exports.ReturnByAssetAct = ReturnByAssetAct;
4528
5069
  exports.ReturnByAssetDecision = ReturnByAssetDecision;
4529
5070
  exports.ReturnByAssetStatement = ReturnByAssetStatement;
5071
+ exports.ReturnByMoney = ReturnByMoney;
5072
+ exports.ReturnByMoneyDecision = ReturnByMoneyDecision;
4530
5073
  exports.SelectBranchStatement = SelectBranchStatement;
4531
5074
  exports.SosediAgreement = SosediAgreement;
4532
5075
  exports.UserAgreement = UserAgreement;