@coopenomics/factory 2025.6.19 → 2025.6.24
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 +271 -80
- package/dist/index.d.cts +13 -3
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.mjs +271 -80
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1899,10 +1899,10 @@ const Registry = {
|
|
|
1899
1899
|
1010: InvestMembershipConvertation
|
|
1900
1900
|
};
|
|
1901
1901
|
|
|
1902
|
-
var __defProp$
|
|
1903
|
-
var __defNormalProp$
|
|
1904
|
-
var __publicField$
|
|
1905
|
-
__defNormalProp$
|
|
1902
|
+
var __defProp$d = Object.defineProperty;
|
|
1903
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1904
|
+
var __publicField$d = (obj, key, value) => {
|
|
1905
|
+
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1906
1906
|
return value;
|
|
1907
1907
|
};
|
|
1908
1908
|
const ajv = new Ajv__default();
|
|
@@ -1913,8 +1913,8 @@ ajv.addFormat("phone", {
|
|
|
1913
1913
|
});
|
|
1914
1914
|
class Validator {
|
|
1915
1915
|
constructor(schema, data) {
|
|
1916
|
-
__publicField$
|
|
1917
|
-
__publicField$
|
|
1916
|
+
__publicField$d(this, "schema");
|
|
1917
|
+
__publicField$d(this, "data");
|
|
1918
1918
|
this.schema = schema;
|
|
1919
1919
|
this.data = data;
|
|
1920
1920
|
}
|
|
@@ -1932,16 +1932,16 @@ class Validator {
|
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
1934
|
|
|
1935
|
-
var __defProp$
|
|
1936
|
-
var __defNormalProp$
|
|
1937
|
-
var __publicField$
|
|
1938
|
-
__defNormalProp$
|
|
1935
|
+
var __defProp$c = Object.defineProperty;
|
|
1936
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1937
|
+
var __publicField$c = (obj, key, value) => {
|
|
1938
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1939
1939
|
return value;
|
|
1940
1940
|
};
|
|
1941
1941
|
class DataService {
|
|
1942
1942
|
constructor(dbConnector, collectionName) {
|
|
1943
|
-
__publicField$
|
|
1944
|
-
__publicField$
|
|
1943
|
+
__publicField$c(this, "collection");
|
|
1944
|
+
__publicField$c(this, "state");
|
|
1945
1945
|
this.collection = dbConnector.getCollection(collectionName);
|
|
1946
1946
|
this.state = dbConnector.getCollection("sync");
|
|
1947
1947
|
}
|
|
@@ -2027,16 +2027,16 @@ async function getCurrentBlock() {
|
|
|
2027
2027
|
return block_num;
|
|
2028
2028
|
}
|
|
2029
2029
|
|
|
2030
|
-
var __defProp$
|
|
2031
|
-
var __defNormalProp$
|
|
2032
|
-
var __publicField$
|
|
2033
|
-
__defNormalProp$
|
|
2030
|
+
var __defProp$b = Object.defineProperty;
|
|
2031
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2032
|
+
var __publicField$b = (obj, key, value) => {
|
|
2033
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2034
2034
|
return value;
|
|
2035
2035
|
};
|
|
2036
2036
|
class Individual {
|
|
2037
2037
|
constructor(storage, data) {
|
|
2038
|
-
__publicField$
|
|
2039
|
-
__publicField$
|
|
2038
|
+
__publicField$b(this, "individual");
|
|
2039
|
+
__publicField$b(this, "data_service");
|
|
2040
2040
|
this.individual = data;
|
|
2041
2041
|
this.data_service = new DataService$1(storage, "individuals");
|
|
2042
2042
|
}
|
|
@@ -2069,17 +2069,17 @@ class Individual {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
}
|
|
2071
2071
|
|
|
2072
|
-
var __defProp$
|
|
2073
|
-
var __defNormalProp$
|
|
2074
|
-
var __publicField$
|
|
2075
|
-
__defNormalProp$
|
|
2072
|
+
var __defProp$a = Object.defineProperty;
|
|
2073
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2074
|
+
var __publicField$a = (obj, key, value) => {
|
|
2075
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2076
2076
|
return value;
|
|
2077
2077
|
};
|
|
2078
2078
|
class Organization {
|
|
2079
2079
|
constructor(storage, data) {
|
|
2080
|
-
__publicField$
|
|
2081
|
-
__publicField$
|
|
2082
|
-
__publicField$
|
|
2080
|
+
__publicField$a(this, "db");
|
|
2081
|
+
__publicField$a(this, "organization");
|
|
2082
|
+
__publicField$a(this, "data_service");
|
|
2083
2083
|
this.db = storage;
|
|
2084
2084
|
this.organization = data;
|
|
2085
2085
|
this.data_service = new DataService$1(storage, "organizations");
|
|
@@ -2125,17 +2125,17 @@ class Organization {
|
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
2127
|
|
|
2128
|
-
var __defProp$
|
|
2129
|
-
var __defNormalProp$
|
|
2130
|
-
var __publicField$
|
|
2131
|
-
__defNormalProp$
|
|
2128
|
+
var __defProp$9 = Object.defineProperty;
|
|
2129
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2130
|
+
var __publicField$9 = (obj, key, value) => {
|
|
2131
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2132
2132
|
return value;
|
|
2133
2133
|
};
|
|
2134
2134
|
class Entrepreneur {
|
|
2135
2135
|
constructor(storage, data) {
|
|
2136
|
-
__publicField$
|
|
2137
|
-
__publicField$
|
|
2138
|
-
__publicField$
|
|
2136
|
+
__publicField$9(this, "db");
|
|
2137
|
+
__publicField$9(this, "entrepreneur");
|
|
2138
|
+
__publicField$9(this, "data_service");
|
|
2139
2139
|
this.db = storage;
|
|
2140
2140
|
this.entrepreneur = data;
|
|
2141
2141
|
this.data_service = new DataService$1(storage, "entrepreneurs");
|
|
@@ -2203,17 +2203,17 @@ function getEnvVar(key) {
|
|
|
2203
2203
|
return envVar;
|
|
2204
2204
|
}
|
|
2205
2205
|
|
|
2206
|
-
var __defProp$
|
|
2207
|
-
var __defNormalProp$
|
|
2208
|
-
var __publicField$
|
|
2209
|
-
__defNormalProp$
|
|
2206
|
+
var __defProp$8 = Object.defineProperty;
|
|
2207
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2208
|
+
var __publicField$8 = (obj, key, value) => {
|
|
2209
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2210
2210
|
return value;
|
|
2211
2211
|
};
|
|
2212
2212
|
class Cooperative {
|
|
2213
2213
|
constructor(storage) {
|
|
2214
|
-
__publicField$
|
|
2215
|
-
__publicField$
|
|
2216
|
-
__publicField$
|
|
2214
|
+
__publicField$8(this, "cooperative");
|
|
2215
|
+
__publicField$8(this, "db");
|
|
2216
|
+
__publicField$8(this, "data_service");
|
|
2217
2217
|
this.db = storage;
|
|
2218
2218
|
this.cooperative = null;
|
|
2219
2219
|
this.data_service = new DataService$1(storage, "cooperatives");
|
|
@@ -2271,17 +2271,17 @@ class Cooperative {
|
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
2273
2273
|
|
|
2274
|
-
var __defProp$
|
|
2275
|
-
var __defNormalProp$
|
|
2276
|
-
var __publicField$
|
|
2277
|
-
__defNormalProp$
|
|
2274
|
+
var __defProp$7 = Object.defineProperty;
|
|
2275
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2276
|
+
var __publicField$7 = (obj, key, value) => {
|
|
2277
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2278
2278
|
return value;
|
|
2279
2279
|
};
|
|
2280
2280
|
class PaymentMethod {
|
|
2281
2281
|
constructor(storage, data) {
|
|
2282
|
-
__publicField$
|
|
2283
|
-
__publicField$
|
|
2284
|
-
__publicField$
|
|
2282
|
+
__publicField$7(this, "db");
|
|
2283
|
+
__publicField$7(this, "paymentMethod");
|
|
2284
|
+
__publicField$7(this, "data_service");
|
|
2285
2285
|
this.db = storage;
|
|
2286
2286
|
this.paymentMethod = data;
|
|
2287
2287
|
this.data_service = new DataService$1(storage, "paymentMethods");
|
|
@@ -2312,16 +2312,16 @@ class PaymentMethod {
|
|
|
2312
2312
|
}
|
|
2313
2313
|
}
|
|
2314
2314
|
|
|
2315
|
-
var __defProp$
|
|
2316
|
-
var __defNormalProp$
|
|
2317
|
-
var __publicField$
|
|
2318
|
-
__defNormalProp$
|
|
2315
|
+
var __defProp$6 = Object.defineProperty;
|
|
2316
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2317
|
+
var __publicField$6 = (obj, key, value) => {
|
|
2318
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2319
2319
|
return value;
|
|
2320
2320
|
};
|
|
2321
2321
|
class Vars {
|
|
2322
2322
|
constructor(storage, data) {
|
|
2323
|
-
__publicField$
|
|
2324
|
-
__publicField$
|
|
2323
|
+
__publicField$6(this, "data");
|
|
2324
|
+
__publicField$6(this, "data_service");
|
|
2325
2325
|
this.data = data;
|
|
2326
2326
|
this.data_service = new DataService$1(storage, "vars");
|
|
2327
2327
|
}
|
|
@@ -2367,16 +2367,16 @@ const projectSchema = {
|
|
|
2367
2367
|
additionalProperties: true
|
|
2368
2368
|
};
|
|
2369
2369
|
|
|
2370
|
-
var __defProp$
|
|
2371
|
-
var __defNormalProp$
|
|
2372
|
-
var __publicField$
|
|
2373
|
-
__defNormalProp$
|
|
2370
|
+
var __defProp$5 = Object.defineProperty;
|
|
2371
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2372
|
+
var __publicField$5 = (obj, key, value) => {
|
|
2373
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2374
2374
|
return value;
|
|
2375
2375
|
};
|
|
2376
2376
|
class Project {
|
|
2377
2377
|
constructor(storage, data) {
|
|
2378
|
-
__publicField$
|
|
2379
|
-
__publicField$
|
|
2378
|
+
__publicField$5(this, "project");
|
|
2379
|
+
__publicField$5(this, "data_service");
|
|
2380
2380
|
this.project = data;
|
|
2381
2381
|
this.data_service = new DataService$1(storage, "projects");
|
|
2382
2382
|
}
|
|
@@ -2409,16 +2409,16 @@ class Project {
|
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
2411
|
|
|
2412
|
-
var __defProp$
|
|
2413
|
-
var __defNormalProp$
|
|
2414
|
-
var __publicField$
|
|
2415
|
-
__defNormalProp$
|
|
2412
|
+
var __defProp$4 = Object.defineProperty;
|
|
2413
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2414
|
+
var __publicField$4 = (obj, key, value) => {
|
|
2415
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2416
2416
|
return value;
|
|
2417
2417
|
};
|
|
2418
2418
|
class TransExtension {
|
|
2419
2419
|
constructor(translation) {
|
|
2420
|
-
__publicField$
|
|
2421
|
-
__publicField$
|
|
2420
|
+
__publicField$4(this, "tags", ["trans"]);
|
|
2421
|
+
__publicField$4(this, "translation");
|
|
2422
2422
|
this.translation = translation;
|
|
2423
2423
|
}
|
|
2424
2424
|
parse(parser, nodes) {
|
|
@@ -2437,7 +2437,7 @@ class TransExtension {
|
|
|
2437
2437
|
}
|
|
2438
2438
|
class TemplateEngine {
|
|
2439
2439
|
constructor(translation) {
|
|
2440
|
-
__publicField$
|
|
2440
|
+
__publicField$4(this, "env");
|
|
2441
2441
|
this.env = new nunjucks__default.Environment();
|
|
2442
2442
|
const transExtension = new TransExtension(translation);
|
|
2443
2443
|
this.env.addExtension("TransExtension", transExtension);
|
|
@@ -2517,7 +2517,7 @@ class PDFService {
|
|
|
2517
2517
|
|
|
2518
2518
|
const name = "@coopenomics/factory";
|
|
2519
2519
|
const type = "module";
|
|
2520
|
-
const version = "2025.6.
|
|
2520
|
+
const version = "2025.6.24";
|
|
2521
2521
|
const packageManager = "pnpm@9.0.6";
|
|
2522
2522
|
const description = "";
|
|
2523
2523
|
const author = "Alex Ant <chairman.voskhod@gmail.com>";
|
|
@@ -2567,7 +2567,7 @@ const dependencies = {
|
|
|
2567
2567
|
"ajv-formats": "^3.0.1",
|
|
2568
2568
|
"ajv-i18n": "^4.2.0",
|
|
2569
2569
|
axios: "^1.7.2",
|
|
2570
|
-
cooptypes: "2025.6.
|
|
2570
|
+
cooptypes: "2025.6.24",
|
|
2571
2571
|
dotenv: "^16.4.5",
|
|
2572
2572
|
"eosjs-ecc": "^4.0.7",
|
|
2573
2573
|
handlebars: "^4.7.8",
|
|
@@ -2608,7 +2608,7 @@ const pnpm = {
|
|
|
2608
2608
|
"vite@>=5.1.0 <=5.1.6": ">=5.1.7"
|
|
2609
2609
|
}
|
|
2610
2610
|
};
|
|
2611
|
-
const gitHead = "
|
|
2611
|
+
const gitHead = "32e6a45f0597e651c2f3ab787462f7aa723c1732";
|
|
2612
2612
|
const packageJson = {
|
|
2613
2613
|
name: name,
|
|
2614
2614
|
type: type,
|
|
@@ -2669,16 +2669,16 @@ function formatDateTime(timestamp) {
|
|
|
2669
2669
|
return `${day} ${month} ${year} ${hours}:${minutes} (\u041C\u0441\u043A)`;
|
|
2670
2670
|
}
|
|
2671
2671
|
|
|
2672
|
-
var __defProp$
|
|
2673
|
-
var __defNormalProp$
|
|
2674
|
-
var __publicField$
|
|
2675
|
-
__defNormalProp$
|
|
2672
|
+
var __defProp$3 = Object.defineProperty;
|
|
2673
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2674
|
+
var __publicField$3 = (obj, key, value) => {
|
|
2675
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2676
2676
|
return value;
|
|
2677
2677
|
};
|
|
2678
2678
|
const packageVersion = packageJson.version;
|
|
2679
2679
|
class DocFactory {
|
|
2680
2680
|
constructor(storage) {
|
|
2681
|
-
__publicField$
|
|
2681
|
+
__publicField$3(this, "storage");
|
|
2682
2682
|
this.storage = storage;
|
|
2683
2683
|
}
|
|
2684
2684
|
async validate(combinedData, schema) {
|
|
@@ -3926,6 +3926,7 @@ let Factory$4 = class Factory extends DocFactory {
|
|
|
3926
3926
|
const user = super.getCommonUser(userData);
|
|
3927
3927
|
const meet = { ...data.meet };
|
|
3928
3928
|
const questions = [...data.questions];
|
|
3929
|
+
console.log("coop os: ", coop);
|
|
3929
3930
|
const combinedData = {
|
|
3930
3931
|
meta,
|
|
3931
3932
|
coop,
|
|
@@ -4121,17 +4122,17 @@ class Factory extends DocFactory {
|
|
|
4121
4122
|
}
|
|
4122
4123
|
}
|
|
4123
4124
|
|
|
4124
|
-
var __defProp$
|
|
4125
|
-
var __defNormalProp$
|
|
4126
|
-
var __publicField$
|
|
4127
|
-
__defNormalProp$
|
|
4125
|
+
var __defProp$2 = Object.defineProperty;
|
|
4126
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4127
|
+
var __publicField$2 = (obj, key, value) => {
|
|
4128
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4128
4129
|
return value;
|
|
4129
4130
|
};
|
|
4130
4131
|
class MongoDBConnector {
|
|
4131
4132
|
constructor(uri) {
|
|
4132
|
-
__publicField$
|
|
4133
|
-
__publicField$
|
|
4134
|
-
__publicField$
|
|
4133
|
+
__publicField$2(this, "client");
|
|
4134
|
+
__publicField$2(this, "db");
|
|
4135
|
+
__publicField$2(this, "documents");
|
|
4135
4136
|
this.client = new mongodb.MongoClient(uri);
|
|
4136
4137
|
const dbName = this.extractDbNameFromUri(uri);
|
|
4137
4138
|
if (!dbName)
|
|
@@ -4166,6 +4167,189 @@ class MongoDBConnector {
|
|
|
4166
4167
|
}
|
|
4167
4168
|
}
|
|
4168
4169
|
|
|
4170
|
+
var __defProp$1 = Object.defineProperty;
|
|
4171
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4172
|
+
var __publicField$1 = (obj, key, value) => {
|
|
4173
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4174
|
+
return value;
|
|
4175
|
+
};
|
|
4176
|
+
class SearchService {
|
|
4177
|
+
constructor(storage) {
|
|
4178
|
+
__publicField$1(this, "storage");
|
|
4179
|
+
this.storage = storage;
|
|
4180
|
+
}
|
|
4181
|
+
async search(query) {
|
|
4182
|
+
if (!query || query.trim().length === 0) {
|
|
4183
|
+
return [];
|
|
4184
|
+
}
|
|
4185
|
+
const results = [];
|
|
4186
|
+
const trimmedQuery = query.trim();
|
|
4187
|
+
const regex = new RegExp(trimmedQuery, "i");
|
|
4188
|
+
const queryWords = trimmedQuery.split(/\s+/).filter((word) => word.length > 0);
|
|
4189
|
+
try {
|
|
4190
|
+
const individualResults = await this.searchIndividuals(regex, queryWords);
|
|
4191
|
+
results.push(...individualResults);
|
|
4192
|
+
const entrepreneurResults = await this.searchEntrepreneurs(regex, queryWords);
|
|
4193
|
+
results.push(...entrepreneurResults);
|
|
4194
|
+
const organizationResults = await this.searchOrganizations(regex);
|
|
4195
|
+
results.push(...organizationResults);
|
|
4196
|
+
return results.slice(0, 10);
|
|
4197
|
+
} catch (error) {
|
|
4198
|
+
console.error("Error during search:", error);
|
|
4199
|
+
return [];
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
async searchIndividuals(regex, queryWords) {
|
|
4203
|
+
const individualModel = new Individual(this.storage);
|
|
4204
|
+
const results = [];
|
|
4205
|
+
let filter;
|
|
4206
|
+
if (queryWords.length > 1) {
|
|
4207
|
+
filter = {
|
|
4208
|
+
deleted: false,
|
|
4209
|
+
$or: [
|
|
4210
|
+
// Поиск по отдельным полям
|
|
4211
|
+
{ first_name: { $regex: regex } },
|
|
4212
|
+
{ last_name: { $regex: regex } },
|
|
4213
|
+
{ middle_name: { $regex: regex } },
|
|
4214
|
+
// Поиск по полному ФИО (все слова должны быть найдены)
|
|
4215
|
+
{
|
|
4216
|
+
$and: queryWords.map((word) => ({
|
|
4217
|
+
$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") } }
|
|
4221
|
+
]
|
|
4222
|
+
}))
|
|
4223
|
+
}
|
|
4224
|
+
]
|
|
4225
|
+
};
|
|
4226
|
+
} else {
|
|
4227
|
+
filter = {
|
|
4228
|
+
deleted: false,
|
|
4229
|
+
$or: [
|
|
4230
|
+
{ first_name: { $regex: regex } },
|
|
4231
|
+
{ last_name: { $regex: regex } },
|
|
4232
|
+
{ middle_name: { $regex: regex } }
|
|
4233
|
+
]
|
|
4234
|
+
};
|
|
4235
|
+
}
|
|
4236
|
+
const individuals = await individualModel.getMany(filter);
|
|
4237
|
+
for (const individual of individuals.results) {
|
|
4238
|
+
const highlightedFields = [];
|
|
4239
|
+
if (regex.test(individual.first_name))
|
|
4240
|
+
highlightedFields.push("first_name");
|
|
4241
|
+
if (regex.test(individual.last_name))
|
|
4242
|
+
highlightedFields.push("last_name");
|
|
4243
|
+
if (regex.test(individual.middle_name))
|
|
4244
|
+
highlightedFields.push("middle_name");
|
|
4245
|
+
const fullName = `${individual.last_name} ${individual.first_name} ${individual.middle_name}`.trim();
|
|
4246
|
+
if (this.matchesFullName(fullName, queryWords)) {
|
|
4247
|
+
highlightedFields.push("full_name");
|
|
4248
|
+
}
|
|
4249
|
+
results.push({
|
|
4250
|
+
type: "individual",
|
|
4251
|
+
data: individual,
|
|
4252
|
+
highlightedFields
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4255
|
+
return results;
|
|
4256
|
+
}
|
|
4257
|
+
async searchEntrepreneurs(regex, queryWords) {
|
|
4258
|
+
const entrepreneurModel = new Entrepreneur(this.storage);
|
|
4259
|
+
const results = [];
|
|
4260
|
+
let filter;
|
|
4261
|
+
if (queryWords.length > 1) {
|
|
4262
|
+
filter = {
|
|
4263
|
+
deleted: false,
|
|
4264
|
+
$or: [
|
|
4265
|
+
// Поиск по отдельным полям
|
|
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 } },
|
|
4271
|
+
// Поиск по полному ФИО
|
|
4272
|
+
{
|
|
4273
|
+
$and: queryWords.map((word) => ({
|
|
4274
|
+
$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") } }
|
|
4278
|
+
]
|
|
4279
|
+
}))
|
|
4280
|
+
}
|
|
4281
|
+
]
|
|
4282
|
+
};
|
|
4283
|
+
} else {
|
|
4284
|
+
filter = {
|
|
4285
|
+
deleted: false,
|
|
4286
|
+
$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 } }
|
|
4292
|
+
]
|
|
4293
|
+
};
|
|
4294
|
+
}
|
|
4295
|
+
const entrepreneurs = await entrepreneurModel.getMany(filter);
|
|
4296
|
+
for (const entrepreneur of entrepreneurs.results) {
|
|
4297
|
+
const highlightedFields = [];
|
|
4298
|
+
if (regex.test(entrepreneur.first_name))
|
|
4299
|
+
highlightedFields.push("first_name");
|
|
4300
|
+
if (regex.test(entrepreneur.last_name))
|
|
4301
|
+
highlightedFields.push("last_name");
|
|
4302
|
+
if (regex.test(entrepreneur.middle_name))
|
|
4303
|
+
highlightedFields.push("middle_name");
|
|
4304
|
+
if (entrepreneur.details?.inn && regex.test(entrepreneur.details.inn))
|
|
4305
|
+
highlightedFields.push("details.inn");
|
|
4306
|
+
if (entrepreneur.details?.ogrn && regex.test(entrepreneur.details.ogrn))
|
|
4307
|
+
highlightedFields.push("details.ogrn");
|
|
4308
|
+
const fullName = `${entrepreneur.last_name} ${entrepreneur.first_name} ${entrepreneur.middle_name}`.trim();
|
|
4309
|
+
if (this.matchesFullName(fullName, queryWords)) {
|
|
4310
|
+
highlightedFields.push("full_name");
|
|
4311
|
+
}
|
|
4312
|
+
results.push({
|
|
4313
|
+
type: "entrepreneur",
|
|
4314
|
+
data: entrepreneur,
|
|
4315
|
+
highlightedFields
|
|
4316
|
+
});
|
|
4317
|
+
}
|
|
4318
|
+
return results;
|
|
4319
|
+
}
|
|
4320
|
+
async searchOrganizations(regex) {
|
|
4321
|
+
const organizationModel = new Organization(this.storage);
|
|
4322
|
+
const results = [];
|
|
4323
|
+
const organizations = await organizationModel.getMany({
|
|
4324
|
+
deleted: false,
|
|
4325
|
+
$or: [
|
|
4326
|
+
{ short_name: { $regex: regex } },
|
|
4327
|
+
{ "details.inn": { $regex: regex } },
|
|
4328
|
+
{ "details.ogrn": { $regex: regex } }
|
|
4329
|
+
]
|
|
4330
|
+
});
|
|
4331
|
+
for (const organization of organizations.results) {
|
|
4332
|
+
const highlightedFields = [];
|
|
4333
|
+
if (regex.test(organization.short_name))
|
|
4334
|
+
highlightedFields.push("short_name");
|
|
4335
|
+
if (organization.details?.inn && regex.test(organization.details.inn))
|
|
4336
|
+
highlightedFields.push("details.inn");
|
|
4337
|
+
if (organization.details?.ogrn && regex.test(organization.details.ogrn))
|
|
4338
|
+
highlightedFields.push("details.ogrn");
|
|
4339
|
+
results.push({
|
|
4340
|
+
type: "organization",
|
|
4341
|
+
data: organization,
|
|
4342
|
+
highlightedFields
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
return results;
|
|
4346
|
+
}
|
|
4347
|
+
matchesFullName(fullName, queryWords) {
|
|
4348
|
+
const fullNameLower = fullName.toLowerCase();
|
|
4349
|
+
return queryWords.every((word) => fullNameLower.includes(word.toLowerCase()));
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4169
4353
|
var __defProp = Object.defineProperty;
|
|
4170
4354
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4171
4355
|
var __publicField = (obj, key, value) => {
|
|
@@ -4178,10 +4362,13 @@ class Generator {
|
|
|
4178
4362
|
__publicField(this, "factories");
|
|
4179
4363
|
// Определение хранилища
|
|
4180
4364
|
__publicField(this, "storage");
|
|
4365
|
+
// Сервис поиска
|
|
4366
|
+
__publicField(this, "searchService");
|
|
4181
4367
|
}
|
|
4182
4368
|
// Метод подключения к хранилищу
|
|
4183
4369
|
async connect(mongoUri) {
|
|
4184
4370
|
this.storage = new MongoDBConnector(mongoUri);
|
|
4371
|
+
this.searchService = new SearchService(this.storage);
|
|
4185
4372
|
this.factories = {
|
|
4186
4373
|
[registry_id$q]: new Factory$q(this.storage),
|
|
4187
4374
|
// 1
|
|
@@ -4300,6 +4487,10 @@ class Generator {
|
|
|
4300
4487
|
async constructCooperative(username, block_num) {
|
|
4301
4488
|
return new Cooperative(this.storage).getOne(username, block_num);
|
|
4302
4489
|
}
|
|
4490
|
+
// Новый метод поиска
|
|
4491
|
+
async search(query) {
|
|
4492
|
+
return this.searchService.search(query);
|
|
4493
|
+
}
|
|
4303
4494
|
}
|
|
4304
4495
|
|
|
4305
4496
|
exports.AgendaMeetSchema = AgendaMeetSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -457,6 +457,10 @@ type internalFilterTypes = InternalIndividualData | InternalEntrepreneurData | I
|
|
|
457
457
|
type externalDataTypes = ExternalIndividualData | ExternalEntrepreneurData | ExternalOrganizationData | PaymentData | IVars | ExternalProjectData;
|
|
458
458
|
type externalDataTypesArrays = ExternalIndividualData[] | ExternalEntrepreneurData[] | ExternalOrganizationData[] | PaymentData[] | IVars[] | ExternalProjectData[];
|
|
459
459
|
|
|
460
|
+
interface IDocument {
|
|
461
|
+
[key: string]: any;
|
|
462
|
+
}
|
|
463
|
+
|
|
460
464
|
declare class MongoDBConnector {
|
|
461
465
|
client: MongoClient;
|
|
462
466
|
db: Db;
|
|
@@ -470,8 +474,11 @@ declare class MongoDBConnector {
|
|
|
470
474
|
saveDraft(document: IGeneratedDocument): Promise<void>;
|
|
471
475
|
}
|
|
472
476
|
|
|
473
|
-
interface
|
|
474
|
-
|
|
477
|
+
interface ISearchResult {
|
|
478
|
+
type: 'individual' | 'entrepreneur' | 'organization';
|
|
479
|
+
data: ExternalIndividualData | ExternalEntrepreneurData | ExternalOrganizationData;
|
|
480
|
+
score?: number;
|
|
481
|
+
highlightedFields?: string[];
|
|
475
482
|
}
|
|
476
483
|
|
|
477
484
|
type CooperativeData = Cooperative.Model.ICooperativeData;
|
|
@@ -612,12 +619,14 @@ interface IGenerator {
|
|
|
612
619
|
del: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<UpdateResult>;
|
|
613
620
|
list: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<Cooperative.Document.IGetResponse<internalFilterTypes>>;
|
|
614
621
|
getHistory: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<externalDataTypesArrays>;
|
|
622
|
+
search: (query: string) => Promise<ISearchResult[]>;
|
|
615
623
|
}
|
|
616
624
|
declare class Generator implements IGenerator {
|
|
617
625
|
factories: {
|
|
618
626
|
[K in Numbers]: DocFactory<IGenerate>;
|
|
619
627
|
};
|
|
620
628
|
storage: MongoDBConnector;
|
|
629
|
+
private searchService;
|
|
621
630
|
connect(mongoUri: string): Promise<void>;
|
|
622
631
|
disconnect(): Promise<void>;
|
|
623
632
|
generate(data: IGenerate, options?: IGenerationOptions): Promise<IGeneratedDocument>;
|
|
@@ -634,6 +643,7 @@ declare class Generator implements IGenerator {
|
|
|
634
643
|
getHistory(type: 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project', filter: Filter<internalFilterTypes>): Promise<externalDataTypesArrays>;
|
|
635
644
|
getModel(type: dataTypes, data?: externalDataTypes): Individual | Entrepreneur | Organization | PaymentMethod | Vars | Project;
|
|
636
645
|
constructCooperative(username: string, block_num?: number): Promise<CooperativeData | null>;
|
|
646
|
+
search(query: string): Promise<ISearchResult[]>;
|
|
637
647
|
}
|
|
638
648
|
|
|
639
|
-
export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, type Currency, DecisionOfParticipantApplication, FreeDecision, Generator, type IBCState, type IBankAccount, type ICombinedData, type CooperativeData as ICooperativeData, type ExternalEntrepreneurData as IEntrepreneurData, type ExternalProjectData as IExternalProjectData, type IFilterActions, type IFilterDeltas, type IFilterDocuments, type IGenerate, type IGeneratedDocument, type IGenerationOptions, type IGenerator, type ExternalIndividualData as IIndividualData, type IMetaDocument, type IMetaDocumentPartial, type ExternalOrganizationData as IOrganizationData, type IPaymentData, type ITemplate, type ITranslations, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, type LangType, MeetPointSchema, MeetSchema, type NestedRecord, type Numbers, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, type dataTypes, decisionSchema, entrepreneurSchema, type externalDataTypes, type externalDataTypesArrays, individualSchema, type internalFilterTypes, organizationSchema, paymentMethodSchema };
|
|
649
|
+
export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, type Currency, DecisionOfParticipantApplication, FreeDecision, Generator, type IBCState, type IBankAccount, type ICombinedData, type CooperativeData as ICooperativeData, type ExternalEntrepreneurData as IEntrepreneurData, type ExternalProjectData as IExternalProjectData, type IFilterActions, type IFilterDeltas, type IFilterDocuments, type IGenerate, type IGeneratedDocument, type IGenerationOptions, type IGenerator, type ExternalIndividualData as IIndividualData, type IMetaDocument, type IMetaDocumentPartial, type ExternalOrganizationData as IOrganizationData, type IPaymentData, type ISearchResult, type ITemplate, type ITranslations, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, type LangType, MeetPointSchema, MeetSchema, type NestedRecord, type Numbers, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, type dataTypes, decisionSchema, entrepreneurSchema, type externalDataTypes, type externalDataTypesArrays, individualSchema, type internalFilterTypes, organizationSchema, paymentMethodSchema };
|
package/dist/index.d.mts
CHANGED
|
@@ -457,6 +457,10 @@ type internalFilterTypes = InternalIndividualData | InternalEntrepreneurData | I
|
|
|
457
457
|
type externalDataTypes = ExternalIndividualData | ExternalEntrepreneurData | ExternalOrganizationData | PaymentData | IVars | ExternalProjectData;
|
|
458
458
|
type externalDataTypesArrays = ExternalIndividualData[] | ExternalEntrepreneurData[] | ExternalOrganizationData[] | PaymentData[] | IVars[] | ExternalProjectData[];
|
|
459
459
|
|
|
460
|
+
interface IDocument {
|
|
461
|
+
[key: string]: any;
|
|
462
|
+
}
|
|
463
|
+
|
|
460
464
|
declare class MongoDBConnector {
|
|
461
465
|
client: MongoClient;
|
|
462
466
|
db: Db;
|
|
@@ -470,8 +474,11 @@ declare class MongoDBConnector {
|
|
|
470
474
|
saveDraft(document: IGeneratedDocument): Promise<void>;
|
|
471
475
|
}
|
|
472
476
|
|
|
473
|
-
interface
|
|
474
|
-
|
|
477
|
+
interface ISearchResult {
|
|
478
|
+
type: 'individual' | 'entrepreneur' | 'organization';
|
|
479
|
+
data: ExternalIndividualData | ExternalEntrepreneurData | ExternalOrganizationData;
|
|
480
|
+
score?: number;
|
|
481
|
+
highlightedFields?: string[];
|
|
475
482
|
}
|
|
476
483
|
|
|
477
484
|
type CooperativeData = Cooperative.Model.ICooperativeData;
|
|
@@ -612,12 +619,14 @@ interface IGenerator {
|
|
|
612
619
|
del: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<UpdateResult>;
|
|
613
620
|
list: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<Cooperative.Document.IGetResponse<internalFilterTypes>>;
|
|
614
621
|
getHistory: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<externalDataTypesArrays>;
|
|
622
|
+
search: (query: string) => Promise<ISearchResult[]>;
|
|
615
623
|
}
|
|
616
624
|
declare class Generator implements IGenerator {
|
|
617
625
|
factories: {
|
|
618
626
|
[K in Numbers]: DocFactory<IGenerate>;
|
|
619
627
|
};
|
|
620
628
|
storage: MongoDBConnector;
|
|
629
|
+
private searchService;
|
|
621
630
|
connect(mongoUri: string): Promise<void>;
|
|
622
631
|
disconnect(): Promise<void>;
|
|
623
632
|
generate(data: IGenerate, options?: IGenerationOptions): Promise<IGeneratedDocument>;
|
|
@@ -634,6 +643,7 @@ declare class Generator implements IGenerator {
|
|
|
634
643
|
getHistory(type: 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project', filter: Filter<internalFilterTypes>): Promise<externalDataTypesArrays>;
|
|
635
644
|
getModel(type: dataTypes, data?: externalDataTypes): Individual | Entrepreneur | Organization | PaymentMethod | Vars | Project;
|
|
636
645
|
constructCooperative(username: string, block_num?: number): Promise<CooperativeData | null>;
|
|
646
|
+
search(query: string): Promise<ISearchResult[]>;
|
|
637
647
|
}
|
|
638
648
|
|
|
639
|
-
export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, type Currency, DecisionOfParticipantApplication, FreeDecision, Generator, type IBCState, type IBankAccount, type ICombinedData, type CooperativeData as ICooperativeData, type ExternalEntrepreneurData as IEntrepreneurData, type ExternalProjectData as IExternalProjectData, type IFilterActions, type IFilterDeltas, type IFilterDocuments, type IGenerate, type IGeneratedDocument, type IGenerationOptions, type IGenerator, type ExternalIndividualData as IIndividualData, type IMetaDocument, type IMetaDocumentPartial, type ExternalOrganizationData as IOrganizationData, type IPaymentData, type ITemplate, type ITranslations, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, type LangType, MeetPointSchema, MeetSchema, type NestedRecord, type Numbers, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, type dataTypes, decisionSchema, entrepreneurSchema, type externalDataTypes, type externalDataTypesArrays, individualSchema, type internalFilterTypes, organizationSchema, paymentMethodSchema };
|
|
649
|
+
export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, type Currency, DecisionOfParticipantApplication, FreeDecision, Generator, type IBCState, type IBankAccount, type ICombinedData, type CooperativeData as ICooperativeData, type ExternalEntrepreneurData as IEntrepreneurData, type ExternalProjectData as IExternalProjectData, type IFilterActions, type IFilterDeltas, type IFilterDocuments, type IGenerate, type IGeneratedDocument, type IGenerationOptions, type IGenerator, type ExternalIndividualData as IIndividualData, type IMetaDocument, type IMetaDocumentPartial, type ExternalOrganizationData as IOrganizationData, type IPaymentData, type ISearchResult, type ITemplate, type ITranslations, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, type LangType, MeetPointSchema, MeetSchema, type NestedRecord, type Numbers, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, type dataTypes, decisionSchema, entrepreneurSchema, type externalDataTypes, type externalDataTypesArrays, individualSchema, type internalFilterTypes, organizationSchema, paymentMethodSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -457,6 +457,10 @@ type internalFilterTypes = InternalIndividualData | InternalEntrepreneurData | I
|
|
|
457
457
|
type externalDataTypes = ExternalIndividualData | ExternalEntrepreneurData | ExternalOrganizationData | PaymentData | IVars | ExternalProjectData;
|
|
458
458
|
type externalDataTypesArrays = ExternalIndividualData[] | ExternalEntrepreneurData[] | ExternalOrganizationData[] | PaymentData[] | IVars[] | ExternalProjectData[];
|
|
459
459
|
|
|
460
|
+
interface IDocument {
|
|
461
|
+
[key: string]: any;
|
|
462
|
+
}
|
|
463
|
+
|
|
460
464
|
declare class MongoDBConnector {
|
|
461
465
|
client: MongoClient;
|
|
462
466
|
db: Db;
|
|
@@ -470,8 +474,11 @@ declare class MongoDBConnector {
|
|
|
470
474
|
saveDraft(document: IGeneratedDocument): Promise<void>;
|
|
471
475
|
}
|
|
472
476
|
|
|
473
|
-
interface
|
|
474
|
-
|
|
477
|
+
interface ISearchResult {
|
|
478
|
+
type: 'individual' | 'entrepreneur' | 'organization';
|
|
479
|
+
data: ExternalIndividualData | ExternalEntrepreneurData | ExternalOrganizationData;
|
|
480
|
+
score?: number;
|
|
481
|
+
highlightedFields?: string[];
|
|
475
482
|
}
|
|
476
483
|
|
|
477
484
|
type CooperativeData = Cooperative.Model.ICooperativeData;
|
|
@@ -612,12 +619,14 @@ interface IGenerator {
|
|
|
612
619
|
del: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<UpdateResult>;
|
|
613
620
|
list: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<Cooperative.Document.IGetResponse<internalFilterTypes>>;
|
|
614
621
|
getHistory: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<externalDataTypesArrays>;
|
|
622
|
+
search: (query: string) => Promise<ISearchResult[]>;
|
|
615
623
|
}
|
|
616
624
|
declare class Generator implements IGenerator {
|
|
617
625
|
factories: {
|
|
618
626
|
[K in Numbers]: DocFactory<IGenerate>;
|
|
619
627
|
};
|
|
620
628
|
storage: MongoDBConnector;
|
|
629
|
+
private searchService;
|
|
621
630
|
connect(mongoUri: string): Promise<void>;
|
|
622
631
|
disconnect(): Promise<void>;
|
|
623
632
|
generate(data: IGenerate, options?: IGenerationOptions): Promise<IGeneratedDocument>;
|
|
@@ -634,6 +643,7 @@ declare class Generator implements IGenerator {
|
|
|
634
643
|
getHistory(type: 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project', filter: Filter<internalFilterTypes>): Promise<externalDataTypesArrays>;
|
|
635
644
|
getModel(type: dataTypes, data?: externalDataTypes): Individual | Entrepreneur | Organization | PaymentMethod | Vars | Project;
|
|
636
645
|
constructCooperative(username: string, block_num?: number): Promise<CooperativeData | null>;
|
|
646
|
+
search(query: string): Promise<ISearchResult[]>;
|
|
637
647
|
}
|
|
638
648
|
|
|
639
|
-
export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, type Currency, DecisionOfParticipantApplication, FreeDecision, Generator, type IBCState, type IBankAccount, type ICombinedData, type CooperativeData as ICooperativeData, type ExternalEntrepreneurData as IEntrepreneurData, type ExternalProjectData as IExternalProjectData, type IFilterActions, type IFilterDeltas, type IFilterDocuments, type IGenerate, type IGeneratedDocument, type IGenerationOptions, type IGenerator, type ExternalIndividualData as IIndividualData, type IMetaDocument, type IMetaDocumentPartial, type ExternalOrganizationData as IOrganizationData, type IPaymentData, type ITemplate, type ITranslations, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, type LangType, MeetPointSchema, MeetSchema, type NestedRecord, type Numbers, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, type dataTypes, decisionSchema, entrepreneurSchema, type externalDataTypes, type externalDataTypesArrays, individualSchema, type internalFilterTypes, organizationSchema, paymentMethodSchema };
|
|
649
|
+
export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, type Currency, DecisionOfParticipantApplication, FreeDecision, Generator, type IBCState, type IBankAccount, type ICombinedData, type CooperativeData as ICooperativeData, type ExternalEntrepreneurData as IEntrepreneurData, type ExternalProjectData as IExternalProjectData, type IFilterActions, type IFilterDeltas, type IFilterDocuments, type IGenerate, type IGeneratedDocument, type IGenerationOptions, type IGenerator, type ExternalIndividualData as IIndividualData, type IMetaDocument, type IMetaDocumentPartial, type ExternalOrganizationData as IOrganizationData, type IPaymentData, type ISearchResult, type ITemplate, type ITranslations, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, type LangType, MeetPointSchema, MeetSchema, type NestedRecord, type Numbers, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, type dataTypes, decisionSchema, entrepreneurSchema, type externalDataTypes, type externalDataTypesArrays, individualSchema, type internalFilterTypes, organizationSchema, paymentMethodSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -1886,10 +1886,10 @@ const Registry = {
|
|
|
1886
1886
|
1010: InvestMembershipConvertation
|
|
1887
1887
|
};
|
|
1888
1888
|
|
|
1889
|
-
var __defProp$
|
|
1890
|
-
var __defNormalProp$
|
|
1891
|
-
var __publicField$
|
|
1892
|
-
__defNormalProp$
|
|
1889
|
+
var __defProp$d = Object.defineProperty;
|
|
1890
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1891
|
+
var __publicField$d = (obj, key, value) => {
|
|
1892
|
+
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1893
1893
|
return value;
|
|
1894
1894
|
};
|
|
1895
1895
|
const ajv = new Ajv();
|
|
@@ -1900,8 +1900,8 @@ ajv.addFormat("phone", {
|
|
|
1900
1900
|
});
|
|
1901
1901
|
class Validator {
|
|
1902
1902
|
constructor(schema, data) {
|
|
1903
|
-
__publicField$
|
|
1904
|
-
__publicField$
|
|
1903
|
+
__publicField$d(this, "schema");
|
|
1904
|
+
__publicField$d(this, "data");
|
|
1905
1905
|
this.schema = schema;
|
|
1906
1906
|
this.data = data;
|
|
1907
1907
|
}
|
|
@@ -1919,16 +1919,16 @@ class Validator {
|
|
|
1919
1919
|
}
|
|
1920
1920
|
}
|
|
1921
1921
|
|
|
1922
|
-
var __defProp$
|
|
1923
|
-
var __defNormalProp$
|
|
1924
|
-
var __publicField$
|
|
1925
|
-
__defNormalProp$
|
|
1922
|
+
var __defProp$c = Object.defineProperty;
|
|
1923
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1924
|
+
var __publicField$c = (obj, key, value) => {
|
|
1925
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1926
1926
|
return value;
|
|
1927
1927
|
};
|
|
1928
1928
|
class DataService {
|
|
1929
1929
|
constructor(dbConnector, collectionName) {
|
|
1930
|
-
__publicField$
|
|
1931
|
-
__publicField$
|
|
1930
|
+
__publicField$c(this, "collection");
|
|
1931
|
+
__publicField$c(this, "state");
|
|
1932
1932
|
this.collection = dbConnector.getCollection(collectionName);
|
|
1933
1933
|
this.state = dbConnector.getCollection("sync");
|
|
1934
1934
|
}
|
|
@@ -2014,16 +2014,16 @@ async function getCurrentBlock() {
|
|
|
2014
2014
|
return block_num;
|
|
2015
2015
|
}
|
|
2016
2016
|
|
|
2017
|
-
var __defProp$
|
|
2018
|
-
var __defNormalProp$
|
|
2019
|
-
var __publicField$
|
|
2020
|
-
__defNormalProp$
|
|
2017
|
+
var __defProp$b = Object.defineProperty;
|
|
2018
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2019
|
+
var __publicField$b = (obj, key, value) => {
|
|
2020
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2021
2021
|
return value;
|
|
2022
2022
|
};
|
|
2023
2023
|
class Individual {
|
|
2024
2024
|
constructor(storage, data) {
|
|
2025
|
-
__publicField$
|
|
2026
|
-
__publicField$
|
|
2025
|
+
__publicField$b(this, "individual");
|
|
2026
|
+
__publicField$b(this, "data_service");
|
|
2027
2027
|
this.individual = data;
|
|
2028
2028
|
this.data_service = new DataService$1(storage, "individuals");
|
|
2029
2029
|
}
|
|
@@ -2056,17 +2056,17 @@ class Individual {
|
|
|
2056
2056
|
}
|
|
2057
2057
|
}
|
|
2058
2058
|
|
|
2059
|
-
var __defProp$
|
|
2060
|
-
var __defNormalProp$
|
|
2061
|
-
var __publicField$
|
|
2062
|
-
__defNormalProp$
|
|
2059
|
+
var __defProp$a = Object.defineProperty;
|
|
2060
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2061
|
+
var __publicField$a = (obj, key, value) => {
|
|
2062
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2063
2063
|
return value;
|
|
2064
2064
|
};
|
|
2065
2065
|
class Organization {
|
|
2066
2066
|
constructor(storage, data) {
|
|
2067
|
-
__publicField$
|
|
2068
|
-
__publicField$
|
|
2069
|
-
__publicField$
|
|
2067
|
+
__publicField$a(this, "db");
|
|
2068
|
+
__publicField$a(this, "organization");
|
|
2069
|
+
__publicField$a(this, "data_service");
|
|
2070
2070
|
this.db = storage;
|
|
2071
2071
|
this.organization = data;
|
|
2072
2072
|
this.data_service = new DataService$1(storage, "organizations");
|
|
@@ -2112,17 +2112,17 @@ class Organization {
|
|
|
2112
2112
|
}
|
|
2113
2113
|
}
|
|
2114
2114
|
|
|
2115
|
-
var __defProp$
|
|
2116
|
-
var __defNormalProp$
|
|
2117
|
-
var __publicField$
|
|
2118
|
-
__defNormalProp$
|
|
2115
|
+
var __defProp$9 = Object.defineProperty;
|
|
2116
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2117
|
+
var __publicField$9 = (obj, key, value) => {
|
|
2118
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2119
2119
|
return value;
|
|
2120
2120
|
};
|
|
2121
2121
|
class Entrepreneur {
|
|
2122
2122
|
constructor(storage, data) {
|
|
2123
|
-
__publicField$
|
|
2124
|
-
__publicField$
|
|
2125
|
-
__publicField$
|
|
2123
|
+
__publicField$9(this, "db");
|
|
2124
|
+
__publicField$9(this, "entrepreneur");
|
|
2125
|
+
__publicField$9(this, "data_service");
|
|
2126
2126
|
this.db = storage;
|
|
2127
2127
|
this.entrepreneur = data;
|
|
2128
2128
|
this.data_service = new DataService$1(storage, "entrepreneurs");
|
|
@@ -2190,17 +2190,17 @@ function getEnvVar(key) {
|
|
|
2190
2190
|
return envVar;
|
|
2191
2191
|
}
|
|
2192
2192
|
|
|
2193
|
-
var __defProp$
|
|
2194
|
-
var __defNormalProp$
|
|
2195
|
-
var __publicField$
|
|
2196
|
-
__defNormalProp$
|
|
2193
|
+
var __defProp$8 = Object.defineProperty;
|
|
2194
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2195
|
+
var __publicField$8 = (obj, key, value) => {
|
|
2196
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2197
2197
|
return value;
|
|
2198
2198
|
};
|
|
2199
2199
|
class Cooperative {
|
|
2200
2200
|
constructor(storage) {
|
|
2201
|
-
__publicField$
|
|
2202
|
-
__publicField$
|
|
2203
|
-
__publicField$
|
|
2201
|
+
__publicField$8(this, "cooperative");
|
|
2202
|
+
__publicField$8(this, "db");
|
|
2203
|
+
__publicField$8(this, "data_service");
|
|
2204
2204
|
this.db = storage;
|
|
2205
2205
|
this.cooperative = null;
|
|
2206
2206
|
this.data_service = new DataService$1(storage, "cooperatives");
|
|
@@ -2258,17 +2258,17 @@ class Cooperative {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
}
|
|
2260
2260
|
|
|
2261
|
-
var __defProp$
|
|
2262
|
-
var __defNormalProp$
|
|
2263
|
-
var __publicField$
|
|
2264
|
-
__defNormalProp$
|
|
2261
|
+
var __defProp$7 = Object.defineProperty;
|
|
2262
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2263
|
+
var __publicField$7 = (obj, key, value) => {
|
|
2264
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2265
2265
|
return value;
|
|
2266
2266
|
};
|
|
2267
2267
|
class PaymentMethod {
|
|
2268
2268
|
constructor(storage, data) {
|
|
2269
|
-
__publicField$
|
|
2270
|
-
__publicField$
|
|
2271
|
-
__publicField$
|
|
2269
|
+
__publicField$7(this, "db");
|
|
2270
|
+
__publicField$7(this, "paymentMethod");
|
|
2271
|
+
__publicField$7(this, "data_service");
|
|
2272
2272
|
this.db = storage;
|
|
2273
2273
|
this.paymentMethod = data;
|
|
2274
2274
|
this.data_service = new DataService$1(storage, "paymentMethods");
|
|
@@ -2299,16 +2299,16 @@ class PaymentMethod {
|
|
|
2299
2299
|
}
|
|
2300
2300
|
}
|
|
2301
2301
|
|
|
2302
|
-
var __defProp$
|
|
2303
|
-
var __defNormalProp$
|
|
2304
|
-
var __publicField$
|
|
2305
|
-
__defNormalProp$
|
|
2302
|
+
var __defProp$6 = Object.defineProperty;
|
|
2303
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2304
|
+
var __publicField$6 = (obj, key, value) => {
|
|
2305
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2306
2306
|
return value;
|
|
2307
2307
|
};
|
|
2308
2308
|
class Vars {
|
|
2309
2309
|
constructor(storage, data) {
|
|
2310
|
-
__publicField$
|
|
2311
|
-
__publicField$
|
|
2310
|
+
__publicField$6(this, "data");
|
|
2311
|
+
__publicField$6(this, "data_service");
|
|
2312
2312
|
this.data = data;
|
|
2313
2313
|
this.data_service = new DataService$1(storage, "vars");
|
|
2314
2314
|
}
|
|
@@ -2354,16 +2354,16 @@ const projectSchema = {
|
|
|
2354
2354
|
additionalProperties: true
|
|
2355
2355
|
};
|
|
2356
2356
|
|
|
2357
|
-
var __defProp$
|
|
2358
|
-
var __defNormalProp$
|
|
2359
|
-
var __publicField$
|
|
2360
|
-
__defNormalProp$
|
|
2357
|
+
var __defProp$5 = Object.defineProperty;
|
|
2358
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2359
|
+
var __publicField$5 = (obj, key, value) => {
|
|
2360
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2361
2361
|
return value;
|
|
2362
2362
|
};
|
|
2363
2363
|
class Project {
|
|
2364
2364
|
constructor(storage, data) {
|
|
2365
|
-
__publicField$
|
|
2366
|
-
__publicField$
|
|
2365
|
+
__publicField$5(this, "project");
|
|
2366
|
+
__publicField$5(this, "data_service");
|
|
2367
2367
|
this.project = data;
|
|
2368
2368
|
this.data_service = new DataService$1(storage, "projects");
|
|
2369
2369
|
}
|
|
@@ -2396,16 +2396,16 @@ class Project {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
}
|
|
2398
2398
|
|
|
2399
|
-
var __defProp$
|
|
2400
|
-
var __defNormalProp$
|
|
2401
|
-
var __publicField$
|
|
2402
|
-
__defNormalProp$
|
|
2399
|
+
var __defProp$4 = Object.defineProperty;
|
|
2400
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2401
|
+
var __publicField$4 = (obj, key, value) => {
|
|
2402
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2403
2403
|
return value;
|
|
2404
2404
|
};
|
|
2405
2405
|
class TransExtension {
|
|
2406
2406
|
constructor(translation) {
|
|
2407
|
-
__publicField$
|
|
2408
|
-
__publicField$
|
|
2407
|
+
__publicField$4(this, "tags", ["trans"]);
|
|
2408
|
+
__publicField$4(this, "translation");
|
|
2409
2409
|
this.translation = translation;
|
|
2410
2410
|
}
|
|
2411
2411
|
parse(parser, nodes) {
|
|
@@ -2424,7 +2424,7 @@ class TransExtension {
|
|
|
2424
2424
|
}
|
|
2425
2425
|
class TemplateEngine {
|
|
2426
2426
|
constructor(translation) {
|
|
2427
|
-
__publicField$
|
|
2427
|
+
__publicField$4(this, "env");
|
|
2428
2428
|
this.env = new nunjucks.Environment();
|
|
2429
2429
|
const transExtension = new TransExtension(translation);
|
|
2430
2430
|
this.env.addExtension("TransExtension", transExtension);
|
|
@@ -2504,7 +2504,7 @@ class PDFService {
|
|
|
2504
2504
|
|
|
2505
2505
|
const name = "@coopenomics/factory";
|
|
2506
2506
|
const type = "module";
|
|
2507
|
-
const version = "2025.6.
|
|
2507
|
+
const version = "2025.6.24";
|
|
2508
2508
|
const packageManager = "pnpm@9.0.6";
|
|
2509
2509
|
const description = "";
|
|
2510
2510
|
const author = "Alex Ant <chairman.voskhod@gmail.com>";
|
|
@@ -2554,7 +2554,7 @@ const dependencies = {
|
|
|
2554
2554
|
"ajv-formats": "^3.0.1",
|
|
2555
2555
|
"ajv-i18n": "^4.2.0",
|
|
2556
2556
|
axios: "^1.7.2",
|
|
2557
|
-
cooptypes: "2025.6.
|
|
2557
|
+
cooptypes: "2025.6.24",
|
|
2558
2558
|
dotenv: "^16.4.5",
|
|
2559
2559
|
"eosjs-ecc": "^4.0.7",
|
|
2560
2560
|
handlebars: "^4.7.8",
|
|
@@ -2595,7 +2595,7 @@ const pnpm = {
|
|
|
2595
2595
|
"vite@>=5.1.0 <=5.1.6": ">=5.1.7"
|
|
2596
2596
|
}
|
|
2597
2597
|
};
|
|
2598
|
-
const gitHead = "
|
|
2598
|
+
const gitHead = "32e6a45f0597e651c2f3ab787462f7aa723c1732";
|
|
2599
2599
|
const packageJson = {
|
|
2600
2600
|
name: name,
|
|
2601
2601
|
type: type,
|
|
@@ -2656,16 +2656,16 @@ function formatDateTime(timestamp) {
|
|
|
2656
2656
|
return `${day} ${month} ${year} ${hours}:${minutes} (\u041C\u0441\u043A)`;
|
|
2657
2657
|
}
|
|
2658
2658
|
|
|
2659
|
-
var __defProp$
|
|
2660
|
-
var __defNormalProp$
|
|
2661
|
-
var __publicField$
|
|
2662
|
-
__defNormalProp$
|
|
2659
|
+
var __defProp$3 = Object.defineProperty;
|
|
2660
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2661
|
+
var __publicField$3 = (obj, key, value) => {
|
|
2662
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2663
2663
|
return value;
|
|
2664
2664
|
};
|
|
2665
2665
|
const packageVersion = packageJson.version;
|
|
2666
2666
|
class DocFactory {
|
|
2667
2667
|
constructor(storage) {
|
|
2668
|
-
__publicField$
|
|
2668
|
+
__publicField$3(this, "storage");
|
|
2669
2669
|
this.storage = storage;
|
|
2670
2670
|
}
|
|
2671
2671
|
async validate(combinedData, schema) {
|
|
@@ -3913,6 +3913,7 @@ let Factory$4 = class Factory extends DocFactory {
|
|
|
3913
3913
|
const user = super.getCommonUser(userData);
|
|
3914
3914
|
const meet = { ...data.meet };
|
|
3915
3915
|
const questions = [...data.questions];
|
|
3916
|
+
console.log("coop os: ", coop);
|
|
3916
3917
|
const combinedData = {
|
|
3917
3918
|
meta,
|
|
3918
3919
|
coop,
|
|
@@ -4108,17 +4109,17 @@ class Factory extends DocFactory {
|
|
|
4108
4109
|
}
|
|
4109
4110
|
}
|
|
4110
4111
|
|
|
4111
|
-
var __defProp$
|
|
4112
|
-
var __defNormalProp$
|
|
4113
|
-
var __publicField$
|
|
4114
|
-
__defNormalProp$
|
|
4112
|
+
var __defProp$2 = Object.defineProperty;
|
|
4113
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4114
|
+
var __publicField$2 = (obj, key, value) => {
|
|
4115
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4115
4116
|
return value;
|
|
4116
4117
|
};
|
|
4117
4118
|
class MongoDBConnector {
|
|
4118
4119
|
constructor(uri) {
|
|
4119
|
-
__publicField$
|
|
4120
|
-
__publicField$
|
|
4121
|
-
__publicField$
|
|
4120
|
+
__publicField$2(this, "client");
|
|
4121
|
+
__publicField$2(this, "db");
|
|
4122
|
+
__publicField$2(this, "documents");
|
|
4122
4123
|
this.client = new MongoClient(uri);
|
|
4123
4124
|
const dbName = this.extractDbNameFromUri(uri);
|
|
4124
4125
|
if (!dbName)
|
|
@@ -4153,6 +4154,189 @@ class MongoDBConnector {
|
|
|
4153
4154
|
}
|
|
4154
4155
|
}
|
|
4155
4156
|
|
|
4157
|
+
var __defProp$1 = Object.defineProperty;
|
|
4158
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4159
|
+
var __publicField$1 = (obj, key, value) => {
|
|
4160
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4161
|
+
return value;
|
|
4162
|
+
};
|
|
4163
|
+
class SearchService {
|
|
4164
|
+
constructor(storage) {
|
|
4165
|
+
__publicField$1(this, "storage");
|
|
4166
|
+
this.storage = storage;
|
|
4167
|
+
}
|
|
4168
|
+
async search(query) {
|
|
4169
|
+
if (!query || query.trim().length === 0) {
|
|
4170
|
+
return [];
|
|
4171
|
+
}
|
|
4172
|
+
const results = [];
|
|
4173
|
+
const trimmedQuery = query.trim();
|
|
4174
|
+
const regex = new RegExp(trimmedQuery, "i");
|
|
4175
|
+
const queryWords = trimmedQuery.split(/\s+/).filter((word) => word.length > 0);
|
|
4176
|
+
try {
|
|
4177
|
+
const individualResults = await this.searchIndividuals(regex, queryWords);
|
|
4178
|
+
results.push(...individualResults);
|
|
4179
|
+
const entrepreneurResults = await this.searchEntrepreneurs(regex, queryWords);
|
|
4180
|
+
results.push(...entrepreneurResults);
|
|
4181
|
+
const organizationResults = await this.searchOrganizations(regex);
|
|
4182
|
+
results.push(...organizationResults);
|
|
4183
|
+
return results.slice(0, 10);
|
|
4184
|
+
} catch (error) {
|
|
4185
|
+
console.error("Error during search:", error);
|
|
4186
|
+
return [];
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
async searchIndividuals(regex, queryWords) {
|
|
4190
|
+
const individualModel = new Individual(this.storage);
|
|
4191
|
+
const results = [];
|
|
4192
|
+
let filter;
|
|
4193
|
+
if (queryWords.length > 1) {
|
|
4194
|
+
filter = {
|
|
4195
|
+
deleted: false,
|
|
4196
|
+
$or: [
|
|
4197
|
+
// Поиск по отдельным полям
|
|
4198
|
+
{ first_name: { $regex: regex } },
|
|
4199
|
+
{ last_name: { $regex: regex } },
|
|
4200
|
+
{ middle_name: { $regex: regex } },
|
|
4201
|
+
// Поиск по полному ФИО (все слова должны быть найдены)
|
|
4202
|
+
{
|
|
4203
|
+
$and: queryWords.map((word) => ({
|
|
4204
|
+
$or: [
|
|
4205
|
+
{ first_name: { $regex: new RegExp(word, "i") } },
|
|
4206
|
+
{ last_name: { $regex: new RegExp(word, "i") } },
|
|
4207
|
+
{ middle_name: { $regex: new RegExp(word, "i") } }
|
|
4208
|
+
]
|
|
4209
|
+
}))
|
|
4210
|
+
}
|
|
4211
|
+
]
|
|
4212
|
+
};
|
|
4213
|
+
} else {
|
|
4214
|
+
filter = {
|
|
4215
|
+
deleted: false,
|
|
4216
|
+
$or: [
|
|
4217
|
+
{ first_name: { $regex: regex } },
|
|
4218
|
+
{ last_name: { $regex: regex } },
|
|
4219
|
+
{ middle_name: { $regex: regex } }
|
|
4220
|
+
]
|
|
4221
|
+
};
|
|
4222
|
+
}
|
|
4223
|
+
const individuals = await individualModel.getMany(filter);
|
|
4224
|
+
for (const individual of individuals.results) {
|
|
4225
|
+
const highlightedFields = [];
|
|
4226
|
+
if (regex.test(individual.first_name))
|
|
4227
|
+
highlightedFields.push("first_name");
|
|
4228
|
+
if (regex.test(individual.last_name))
|
|
4229
|
+
highlightedFields.push("last_name");
|
|
4230
|
+
if (regex.test(individual.middle_name))
|
|
4231
|
+
highlightedFields.push("middle_name");
|
|
4232
|
+
const fullName = `${individual.last_name} ${individual.first_name} ${individual.middle_name}`.trim();
|
|
4233
|
+
if (this.matchesFullName(fullName, queryWords)) {
|
|
4234
|
+
highlightedFields.push("full_name");
|
|
4235
|
+
}
|
|
4236
|
+
results.push({
|
|
4237
|
+
type: "individual",
|
|
4238
|
+
data: individual,
|
|
4239
|
+
highlightedFields
|
|
4240
|
+
});
|
|
4241
|
+
}
|
|
4242
|
+
return results;
|
|
4243
|
+
}
|
|
4244
|
+
async searchEntrepreneurs(regex, queryWords) {
|
|
4245
|
+
const entrepreneurModel = new Entrepreneur(this.storage);
|
|
4246
|
+
const results = [];
|
|
4247
|
+
let filter;
|
|
4248
|
+
if (queryWords.length > 1) {
|
|
4249
|
+
filter = {
|
|
4250
|
+
deleted: false,
|
|
4251
|
+
$or: [
|
|
4252
|
+
// Поиск по отдельным полям
|
|
4253
|
+
{ first_name: { $regex: regex } },
|
|
4254
|
+
{ last_name: { $regex: regex } },
|
|
4255
|
+
{ middle_name: { $regex: regex } },
|
|
4256
|
+
{ "details.inn": { $regex: regex } },
|
|
4257
|
+
{ "details.ogrn": { $regex: regex } },
|
|
4258
|
+
// Поиск по полному ФИО
|
|
4259
|
+
{
|
|
4260
|
+
$and: queryWords.map((word) => ({
|
|
4261
|
+
$or: [
|
|
4262
|
+
{ first_name: { $regex: new RegExp(word, "i") } },
|
|
4263
|
+
{ last_name: { $regex: new RegExp(word, "i") } },
|
|
4264
|
+
{ middle_name: { $regex: new RegExp(word, "i") } }
|
|
4265
|
+
]
|
|
4266
|
+
}))
|
|
4267
|
+
}
|
|
4268
|
+
]
|
|
4269
|
+
};
|
|
4270
|
+
} else {
|
|
4271
|
+
filter = {
|
|
4272
|
+
deleted: false,
|
|
4273
|
+
$or: [
|
|
4274
|
+
{ first_name: { $regex: regex } },
|
|
4275
|
+
{ last_name: { $regex: regex } },
|
|
4276
|
+
{ middle_name: { $regex: regex } },
|
|
4277
|
+
{ "details.inn": { $regex: regex } },
|
|
4278
|
+
{ "details.ogrn": { $regex: regex } }
|
|
4279
|
+
]
|
|
4280
|
+
};
|
|
4281
|
+
}
|
|
4282
|
+
const entrepreneurs = await entrepreneurModel.getMany(filter);
|
|
4283
|
+
for (const entrepreneur of entrepreneurs.results) {
|
|
4284
|
+
const highlightedFields = [];
|
|
4285
|
+
if (regex.test(entrepreneur.first_name))
|
|
4286
|
+
highlightedFields.push("first_name");
|
|
4287
|
+
if (regex.test(entrepreneur.last_name))
|
|
4288
|
+
highlightedFields.push("last_name");
|
|
4289
|
+
if (regex.test(entrepreneur.middle_name))
|
|
4290
|
+
highlightedFields.push("middle_name");
|
|
4291
|
+
if (entrepreneur.details?.inn && regex.test(entrepreneur.details.inn))
|
|
4292
|
+
highlightedFields.push("details.inn");
|
|
4293
|
+
if (entrepreneur.details?.ogrn && regex.test(entrepreneur.details.ogrn))
|
|
4294
|
+
highlightedFields.push("details.ogrn");
|
|
4295
|
+
const fullName = `${entrepreneur.last_name} ${entrepreneur.first_name} ${entrepreneur.middle_name}`.trim();
|
|
4296
|
+
if (this.matchesFullName(fullName, queryWords)) {
|
|
4297
|
+
highlightedFields.push("full_name");
|
|
4298
|
+
}
|
|
4299
|
+
results.push({
|
|
4300
|
+
type: "entrepreneur",
|
|
4301
|
+
data: entrepreneur,
|
|
4302
|
+
highlightedFields
|
|
4303
|
+
});
|
|
4304
|
+
}
|
|
4305
|
+
return results;
|
|
4306
|
+
}
|
|
4307
|
+
async searchOrganizations(regex) {
|
|
4308
|
+
const organizationModel = new Organization(this.storage);
|
|
4309
|
+
const results = [];
|
|
4310
|
+
const organizations = await organizationModel.getMany({
|
|
4311
|
+
deleted: false,
|
|
4312
|
+
$or: [
|
|
4313
|
+
{ short_name: { $regex: regex } },
|
|
4314
|
+
{ "details.inn": { $regex: regex } },
|
|
4315
|
+
{ "details.ogrn": { $regex: regex } }
|
|
4316
|
+
]
|
|
4317
|
+
});
|
|
4318
|
+
for (const organization of organizations.results) {
|
|
4319
|
+
const highlightedFields = [];
|
|
4320
|
+
if (regex.test(organization.short_name))
|
|
4321
|
+
highlightedFields.push("short_name");
|
|
4322
|
+
if (organization.details?.inn && regex.test(organization.details.inn))
|
|
4323
|
+
highlightedFields.push("details.inn");
|
|
4324
|
+
if (organization.details?.ogrn && regex.test(organization.details.ogrn))
|
|
4325
|
+
highlightedFields.push("details.ogrn");
|
|
4326
|
+
results.push({
|
|
4327
|
+
type: "organization",
|
|
4328
|
+
data: organization,
|
|
4329
|
+
highlightedFields
|
|
4330
|
+
});
|
|
4331
|
+
}
|
|
4332
|
+
return results;
|
|
4333
|
+
}
|
|
4334
|
+
matchesFullName(fullName, queryWords) {
|
|
4335
|
+
const fullNameLower = fullName.toLowerCase();
|
|
4336
|
+
return queryWords.every((word) => fullNameLower.includes(word.toLowerCase()));
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
|
|
4156
4340
|
var __defProp = Object.defineProperty;
|
|
4157
4341
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4158
4342
|
var __publicField = (obj, key, value) => {
|
|
@@ -4165,10 +4349,13 @@ class Generator {
|
|
|
4165
4349
|
__publicField(this, "factories");
|
|
4166
4350
|
// Определение хранилища
|
|
4167
4351
|
__publicField(this, "storage");
|
|
4352
|
+
// Сервис поиска
|
|
4353
|
+
__publicField(this, "searchService");
|
|
4168
4354
|
}
|
|
4169
4355
|
// Метод подключения к хранилищу
|
|
4170
4356
|
async connect(mongoUri) {
|
|
4171
4357
|
this.storage = new MongoDBConnector(mongoUri);
|
|
4358
|
+
this.searchService = new SearchService(this.storage);
|
|
4172
4359
|
this.factories = {
|
|
4173
4360
|
[registry_id$q]: new Factory$q(this.storage),
|
|
4174
4361
|
// 1
|
|
@@ -4287,6 +4474,10 @@ class Generator {
|
|
|
4287
4474
|
async constructCooperative(username, block_num) {
|
|
4288
4475
|
return new Cooperative(this.storage).getOne(username, block_num);
|
|
4289
4476
|
}
|
|
4477
|
+
// Новый метод поиска
|
|
4478
|
+
async search(query) {
|
|
4479
|
+
return this.searchService.search(query);
|
|
4480
|
+
}
|
|
4290
4481
|
}
|
|
4291
4482
|
|
|
4292
4483
|
export { AgendaMeetSchema, AgendaQuestionSchema, AnnualGeneralMeetingAgenda, AnnualGeneralMeetingDecision, AnnualGeneralMeetingNotification, AnnualGeneralMeetingSovietDecision, AnnualGeneralMeetingVotingBallot, AssetContributionAct, AssetContributionDecision, AssetContributionStatement, BankAccountSchema, CommonUserSchema, CoopenomicsAgreement, CooperativeSchema, DecisionOfParticipantApplication, FreeDecision, Generator, InvestByMoneyStatement, InvestByResultAct, InvestByResultStatement, InvestMembershipConvertation, InvestmentAgreement, MeetPointSchema, MeetSchema, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, QuestionExtendedSchema, QuestionSchema$1 as QuestionSchema, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, ReturnByAssetAct, ReturnByAssetDecision, ReturnByAssetStatement, SelectBranchStatement, SosediAgreement, UserAgreement, VarsSchema, WalletAgreement, decisionSchema, entrepreneurSchema, individualSchema, organizationSchema, paymentMethodSchema };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopenomics/factory",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2025.6.
|
|
4
|
+
"version": "2025.6.24",
|
|
5
5
|
"packageManager": "pnpm@9.0.6",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "Alex Ant <chairman.voskhod@gmail.com>",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"ajv-formats": "^3.0.1",
|
|
51
51
|
"ajv-i18n": "^4.2.0",
|
|
52
52
|
"axios": "^1.7.2",
|
|
53
|
-
"cooptypes": "2025.6.
|
|
53
|
+
"cooptypes": "2025.6.24",
|
|
54
54
|
"dotenv": "^16.4.5",
|
|
55
55
|
"eosjs-ecc": "^4.0.7",
|
|
56
56
|
"handlebars": "^4.7.8",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"vite@>=5.1.0 <=5.1.6": ">=5.1.7"
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "32e6a45f0597e651c2f3ab787462f7aa723c1732"
|
|
95
95
|
}
|