@coopenomics/factory 2.2.0
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/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/index.cjs +2369 -0
- package/dist/index.d.cts +400 -0
- package/dist/index.d.mts +400 -0
- package/dist/index.d.ts +400 -0
- package/dist/index.mjs +2337 -0
- package/package.json +95 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { Cooperative } from 'cooptypes';
|
|
3
|
+
import { InsertOneResult, Filter, UpdateResult, Document, MongoClient, Db, Collection } from 'mongodb';
|
|
4
|
+
|
|
5
|
+
declare const registry_id$9 = 1;
|
|
6
|
+
type Action$9 = Cooperative.Registry.WalletAgreement.Action;
|
|
7
|
+
type Model$9 = Cooperative.Registry.WalletAgreement.Model;
|
|
8
|
+
declare const Schema$9: JSONSchemaType<Model$9>;
|
|
9
|
+
declare const Template$9: ITemplate<Model$9>;
|
|
10
|
+
|
|
11
|
+
declare namespace WalletAgreement {
|
|
12
|
+
export { type Action$9 as Action, type Model$9 as Model, Schema$9 as Schema, Template$9 as Template, registry_id$9 as registry_id };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare const registry_id$8 = 2;
|
|
16
|
+
type Action$8 = Cooperative.Registry.RegulationElectronicSignature.Action;
|
|
17
|
+
type Model$8 = Cooperative.Registry.RegulationElectronicSignature.Model;
|
|
18
|
+
declare const Schema$8: JSONSchemaType<Model$8>;
|
|
19
|
+
declare const Template$8: ITemplate<Model$8>;
|
|
20
|
+
|
|
21
|
+
declare namespace RegulationElectronicSignaturet {
|
|
22
|
+
export { type Action$8 as Action, type Model$8 as Model, Schema$8 as Schema, Template$8 as Template, registry_id$8 as registry_id };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare const registry_id$7 = 3;
|
|
26
|
+
type Action$7 = Cooperative.Registry.PrivacyPolicy.Action;
|
|
27
|
+
type Model$7 = Cooperative.Registry.PrivacyPolicy.Model;
|
|
28
|
+
declare const Schema$7: JSONSchemaType<Model$7>;
|
|
29
|
+
declare const Template$7: ITemplate<Model$7>;
|
|
30
|
+
|
|
31
|
+
declare namespace PrivacyPolicy {
|
|
32
|
+
export { type Action$7 as Action, type Model$7 as Model, Schema$7 as Schema, Template$7 as Template, registry_id$7 as registry_id };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare const registry_id$6 = 4;
|
|
36
|
+
type Action$6 = Cooperative.Registry.UserAgreement.Action;
|
|
37
|
+
type Model$6 = Cooperative.Registry.UserAgreement.Model;
|
|
38
|
+
declare const Schema$6: JSONSchemaType<Model$6>;
|
|
39
|
+
declare const Template$6: ITemplate<Model$6>;
|
|
40
|
+
|
|
41
|
+
declare namespace UserAgreement {
|
|
42
|
+
export { type Action$6 as Action, type Model$6 as Model, Schema$6 as Schema, Template$6 as Template, registry_id$6 as registry_id };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const registry_id$5 = 50;
|
|
46
|
+
type Action$5 = Cooperative.Registry.CoopenomicsAgreement.Action;
|
|
47
|
+
type Model$5 = Cooperative.Registry.CoopenomicsAgreement.Model;
|
|
48
|
+
declare const Schema$5: JSONSchemaType<Model$5>;
|
|
49
|
+
declare const Template$5: ITemplate<Model$5>;
|
|
50
|
+
|
|
51
|
+
declare namespace CoopenomicsAgreement {
|
|
52
|
+
export { type Action$5 as Action, type Model$5 as Model, Schema$5 as Schema, Template$5 as Template, registry_id$5 as registry_id };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare const registry_id$4 = 100;
|
|
56
|
+
/**
|
|
57
|
+
* Интерфейс генерации заявления на вступление в кооператив
|
|
58
|
+
*/
|
|
59
|
+
type Action$4 = Cooperative.Registry.ParticipantApplication.Action;
|
|
60
|
+
type Model$4 = Cooperative.Registry.ParticipantApplication.Model;
|
|
61
|
+
declare const Schema$4: JSONSchemaType<Model$4>;
|
|
62
|
+
declare const Template$4: ITemplate<Model$4>;
|
|
63
|
+
|
|
64
|
+
declare namespace ParticipantApplication {
|
|
65
|
+
export { type Action$4 as Action, type Model$4 as Model, Schema$4 as Schema, Template$4 as Template, registry_id$4 as registry_id };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare const registry_id$3 = 501;
|
|
69
|
+
/**
|
|
70
|
+
* Интерфейс генерации решения совета
|
|
71
|
+
*/
|
|
72
|
+
type Action$3 = Cooperative.Registry.DecisionOfParticipantApplication.Action;
|
|
73
|
+
type Model$3 = Cooperative.Registry.DecisionOfParticipantApplication.Model;
|
|
74
|
+
declare const Schema$3: JSONSchemaType<Model$3>;
|
|
75
|
+
declare const Template$3: ITemplate<Model$3>;
|
|
76
|
+
|
|
77
|
+
declare namespace DecisionOfParticipantApplication {
|
|
78
|
+
export { type Action$3 as Action, type Model$3 as Model, Schema$3 as Schema, Template$3 as Template, registry_id$3 as registry_id };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare const registry_id$2 = 101;
|
|
82
|
+
/**
|
|
83
|
+
* Интерфейс генерации заявления на вступление в кооператив
|
|
84
|
+
*/
|
|
85
|
+
type Action$2 = Cooperative.Registry.SelectBranchStatement.Action;
|
|
86
|
+
type Model$2 = Cooperative.Registry.SelectBranchStatement.Model;
|
|
87
|
+
declare const Schema$2: JSONSchemaType<Model$2>;
|
|
88
|
+
declare const Template$2: ITemplate<Model$2>;
|
|
89
|
+
|
|
90
|
+
declare namespace SelectBranchStatement {
|
|
91
|
+
export { type Action$2 as Action, type Model$2 as Model, Schema$2 as Schema, Template$2 as Template, registry_id$2 as registry_id };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare const registry_id$1 = 599;
|
|
95
|
+
/**
|
|
96
|
+
* Интерфейс генерации решения совета
|
|
97
|
+
*/
|
|
98
|
+
type Action$1 = Cooperative.Registry.ProjectFreeDecision.Action;
|
|
99
|
+
type Model$1 = Cooperative.Registry.ProjectFreeDecision.Model;
|
|
100
|
+
declare const Schema$1: JSONSchemaType<Model$1>;
|
|
101
|
+
declare const Template$1: ITemplate<Model$1>;
|
|
102
|
+
|
|
103
|
+
declare namespace ProjectFreeDecision {
|
|
104
|
+
export { type Action$1 as Action, type Model$1 as Model, Schema$1 as Schema, Template$1 as Template, registry_id$1 as registry_id };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare const registry_id: 600;
|
|
108
|
+
/**
|
|
109
|
+
* Интерфейс генерации решения совета
|
|
110
|
+
*/
|
|
111
|
+
type Action = Cooperative.Registry.FreeDecision.Action;
|
|
112
|
+
type Model = Cooperative.Registry.FreeDecision.Model;
|
|
113
|
+
declare const Schema: JSONSchemaType<Model>;
|
|
114
|
+
declare const Template: ITemplate<Model>;
|
|
115
|
+
|
|
116
|
+
type FreeDecision_Action = Action;
|
|
117
|
+
type FreeDecision_Model = Model;
|
|
118
|
+
declare const FreeDecision_Schema: typeof Schema;
|
|
119
|
+
declare const FreeDecision_Template: typeof Template;
|
|
120
|
+
declare const FreeDecision_registry_id: typeof registry_id;
|
|
121
|
+
declare namespace FreeDecision {
|
|
122
|
+
export { type FreeDecision_Action as Action, type FreeDecision_Model as Model, FreeDecision_Schema as Schema, FreeDecision_Template as Template, FreeDecision_registry_id as registry_id };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
declare const Registry: {
|
|
126
|
+
1: typeof WalletAgreement;
|
|
127
|
+
2: typeof RegulationElectronicSignaturet;
|
|
128
|
+
3: typeof PrivacyPolicy;
|
|
129
|
+
4: typeof UserAgreement;
|
|
130
|
+
50: typeof CoopenomicsAgreement;
|
|
131
|
+
100: typeof ParticipantApplication;
|
|
132
|
+
101: typeof SelectBranchStatement;
|
|
133
|
+
501: typeof DecisionOfParticipantApplication;
|
|
134
|
+
599: typeof ProjectFreeDecision;
|
|
135
|
+
600: typeof FreeDecision;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
interface ValidateResult {
|
|
139
|
+
valid: boolean;
|
|
140
|
+
error: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type ExternalIndividualData = Cooperative.Users.IIndividualData;
|
|
144
|
+
type InternalIndividualData = ExternalIndividualData;
|
|
145
|
+
declare class Individual {
|
|
146
|
+
individual?: ExternalIndividualData;
|
|
147
|
+
private data_service;
|
|
148
|
+
constructor(storage: MongoDBConnector, data?: ExternalIndividualData);
|
|
149
|
+
validate(): ValidateResult;
|
|
150
|
+
save(): Promise<InsertOneResult<InternalIndividualData>>;
|
|
151
|
+
getOne(filter: Filter<InternalIndividualData>): Promise<ExternalIndividualData | null>;
|
|
152
|
+
getMany(filter: Filter<InternalIndividualData>): Promise<Cooperative.Document.IGetResponse<ExternalIndividualData>>;
|
|
153
|
+
getHistory(filter: Filter<InternalIndividualData>): Promise<ExternalIndividualData[]>;
|
|
154
|
+
del(filter: Filter<InternalIndividualData>): Promise<UpdateResult>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
type ExternalOrganizationData = Cooperative.Users.IOrganizationData;
|
|
158
|
+
type InternalOrganizationData = Cooperative.Users.IOrganizationData;
|
|
159
|
+
declare class Organization {
|
|
160
|
+
db: MongoDBConnector;
|
|
161
|
+
organization?: ExternalOrganizationData;
|
|
162
|
+
private data_service;
|
|
163
|
+
constructor(storage: MongoDBConnector, data?: ExternalOrganizationData);
|
|
164
|
+
validate(): ValidateResult;
|
|
165
|
+
save(): Promise<InsertOneResult<InternalOrganizationData>>;
|
|
166
|
+
getOne(filter: Filter<InternalOrganizationData>): Promise<ExternalOrganizationData | null>;
|
|
167
|
+
getMany(filter: Filter<InternalOrganizationData>): Promise<Cooperative.Document.IGetResponse<ExternalOrganizationData>>;
|
|
168
|
+
getHistory(filter: Filter<InternalOrganizationData>): Promise<ExternalOrganizationData[]>;
|
|
169
|
+
del(filter: Filter<InternalOrganizationData>): Promise<UpdateResult>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
type ExternalEntrepreneurData = Cooperative.Users.IEntrepreneurData;
|
|
173
|
+
type InternalEntrepreneurData = Omit<ExternalEntrepreneurData, 'bank_account'> & {
|
|
174
|
+
bank_account?: Cooperative.Payments.IBankAccount;
|
|
175
|
+
};
|
|
176
|
+
declare class Entrepreneur {
|
|
177
|
+
db: MongoDBConnector;
|
|
178
|
+
entrepreneur?: ExternalEntrepreneurData;
|
|
179
|
+
private data_service;
|
|
180
|
+
constructor(storage: MongoDBConnector, data?: ExternalEntrepreneurData);
|
|
181
|
+
validate(): ValidateResult;
|
|
182
|
+
save(): Promise<InsertOneResult<InternalEntrepreneurData>>;
|
|
183
|
+
getOne(filter: Filter<InternalEntrepreneurData>): Promise<ExternalEntrepreneurData | null>;
|
|
184
|
+
getMany(filter: Filter<InternalEntrepreneurData>): Promise<Cooperative.Document.IGetResponse<ExternalEntrepreneurData>>;
|
|
185
|
+
getHistory(filter: Filter<InternalEntrepreneurData>): Promise<ExternalEntrepreneurData[]>;
|
|
186
|
+
del(filter: Filter<InternalEntrepreneurData>): Promise<UpdateResult>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type PaymentData = IPaymentData;
|
|
190
|
+
declare class PaymentMethod {
|
|
191
|
+
db: MongoDBConnector;
|
|
192
|
+
paymentMethod?: PaymentData;
|
|
193
|
+
private data_service;
|
|
194
|
+
constructor(storage: MongoDBConnector, data?: PaymentData);
|
|
195
|
+
validate(): ValidateResult;
|
|
196
|
+
save(): Promise<InsertOneResult<PaymentData>>;
|
|
197
|
+
getOne(filter: Filter<PaymentData>): Promise<PaymentData | null>;
|
|
198
|
+
getMany(filter: Filter<PaymentData>): Promise<Cooperative.Document.IGetResponse<PaymentData>>;
|
|
199
|
+
getHistory(filter: Filter<PaymentData>): Promise<PaymentData[]>;
|
|
200
|
+
del(filter: Filter<PaymentData>): Promise<UpdateResult>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
type IVars = Cooperative.Model.IVars;
|
|
204
|
+
declare class Vars {
|
|
205
|
+
data?: IVars;
|
|
206
|
+
private data_service;
|
|
207
|
+
constructor(storage: MongoDBConnector, data?: IVars);
|
|
208
|
+
validate(): ValidateResult;
|
|
209
|
+
save(): Promise<InsertOneResult<IVars>>;
|
|
210
|
+
getOne(filter: Filter<IVars>): Promise<IVars | null>;
|
|
211
|
+
getMany(filter: Filter<IVars>): Promise<Cooperative.Document.IGetResponse<IVars>>;
|
|
212
|
+
getHistory(filter: Filter<IVars>): Promise<IVars[]>;
|
|
213
|
+
del(filter: Filter<IVars>): Promise<UpdateResult>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
type ExternalProjectData = Cooperative.Document.IProjectData;
|
|
217
|
+
interface InternalProjectData extends ExternalProjectData {
|
|
218
|
+
block_num?: number;
|
|
219
|
+
deleted?: boolean;
|
|
220
|
+
}
|
|
221
|
+
declare class Project {
|
|
222
|
+
project?: ExternalProjectData;
|
|
223
|
+
private data_service;
|
|
224
|
+
constructor(storage: MongoDBConnector, data?: ExternalProjectData);
|
|
225
|
+
validate(): ValidateResult;
|
|
226
|
+
save(): Promise<InsertOneResult<InternalProjectData>>;
|
|
227
|
+
getOne(filter: Filter<InternalProjectData>): Promise<InternalProjectData | null>;
|
|
228
|
+
getMany(filter: Filter<InternalProjectData>): Promise<Cooperative.Document.IGetResponse<InternalProjectData>>;
|
|
229
|
+
getHistory(filter: Filter<InternalProjectData>): Promise<InternalProjectData[]>;
|
|
230
|
+
del(filter: Filter<InternalProjectData>): Promise<UpdateResult>;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
type Currency = 'RUB' | 'Other';
|
|
234
|
+
type IBankAccount = Cooperative.Payments.IBankAccount;
|
|
235
|
+
type IPaymentData = Cooperative.Payments.IPaymentData;
|
|
236
|
+
|
|
237
|
+
interface IFilterDeltas {
|
|
238
|
+
present: boolean;
|
|
239
|
+
code: string;
|
|
240
|
+
scope: string;
|
|
241
|
+
table: string;
|
|
242
|
+
primary_key: string;
|
|
243
|
+
value?: any;
|
|
244
|
+
block_num: number;
|
|
245
|
+
block_id: string;
|
|
246
|
+
}
|
|
247
|
+
interface IFilterActions {
|
|
248
|
+
transaction_id: string;
|
|
249
|
+
account: string;
|
|
250
|
+
name: string;
|
|
251
|
+
authorization: Array<{
|
|
252
|
+
actor: string;
|
|
253
|
+
permission: string;
|
|
254
|
+
}>;
|
|
255
|
+
data: any;
|
|
256
|
+
}
|
|
257
|
+
interface IBCState {
|
|
258
|
+
key: string;
|
|
259
|
+
block_num: number;
|
|
260
|
+
}
|
|
261
|
+
interface IFilterDocuments extends Document, IGeneratedDocument {
|
|
262
|
+
}
|
|
263
|
+
type internalFilterTypes = InternalIndividualData | InternalEntrepreneurData | InternalOrganizationData | IPaymentData | IVars | InternalProjectData;
|
|
264
|
+
type externalDataTypes = ExternalIndividualData | ExternalEntrepreneurData | ExternalOrganizationData | PaymentData | IVars | ExternalProjectData;
|
|
265
|
+
type externalDataTypesArrays = ExternalIndividualData[] | ExternalEntrepreneurData[] | ExternalOrganizationData[] | PaymentData[] | IVars[] | ExternalProjectData[];
|
|
266
|
+
|
|
267
|
+
declare class MongoDBConnector {
|
|
268
|
+
client: MongoClient;
|
|
269
|
+
db: Db;
|
|
270
|
+
private documents;
|
|
271
|
+
constructor(uri: string);
|
|
272
|
+
private extractDbNameFromUri;
|
|
273
|
+
connect(): Promise<void>;
|
|
274
|
+
disconnect(): Promise<void>;
|
|
275
|
+
getCollection<T extends IDocument>(collectionName: string): Collection<T>;
|
|
276
|
+
getDocument(filter: Filter<IFilterDocuments>): Promise<IGeneratedDocument>;
|
|
277
|
+
saveDraft(document: IGeneratedDocument): Promise<void>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
interface IDocument {
|
|
281
|
+
[key: string]: any;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
type CooperativeData = Cooperative.Model.ICooperativeData;
|
|
285
|
+
|
|
286
|
+
type IMetaDocument = Cooperative.Document.IMetaDocument;
|
|
287
|
+
interface IGeneratedDocument {
|
|
288
|
+
full_title: string;
|
|
289
|
+
html: string;
|
|
290
|
+
hash: string;
|
|
291
|
+
meta: IMetaDocument;
|
|
292
|
+
binary: Uint8Array;
|
|
293
|
+
}
|
|
294
|
+
interface NestedRecord {
|
|
295
|
+
[key: string]: any;
|
|
296
|
+
}
|
|
297
|
+
type ITranslations = Record<string, NestedRecord>;
|
|
298
|
+
interface ITemplate<T> {
|
|
299
|
+
title: string;
|
|
300
|
+
description: string;
|
|
301
|
+
model: JSONSchemaType<T>;
|
|
302
|
+
context: string;
|
|
303
|
+
translations: ITranslations;
|
|
304
|
+
}
|
|
305
|
+
interface ICombinedData {
|
|
306
|
+
individual?: ExternalIndividualData;
|
|
307
|
+
organization?: ExternalOrganizationData;
|
|
308
|
+
entrepreneur?: ExternalEntrepreneurData;
|
|
309
|
+
coop?: CooperativeData;
|
|
310
|
+
meta: IMetaDocument;
|
|
311
|
+
}
|
|
312
|
+
type Numbers = keyof typeof Registry;
|
|
313
|
+
type LangType = 'ru';
|
|
314
|
+
interface IMetaDocumentPartial extends Partial<IMetaDocument> {
|
|
315
|
+
username: string;
|
|
316
|
+
coopname: string;
|
|
317
|
+
registry_id: number;
|
|
318
|
+
title: string;
|
|
319
|
+
}
|
|
320
|
+
type IGenerate = Cooperative.Document.IGenerate;
|
|
321
|
+
type IGenerationOptions = Cooperative.Document.IGenerationOptions;
|
|
322
|
+
|
|
323
|
+
declare const BankAccountSchema: JSONSchemaType<IBankAccount>;
|
|
324
|
+
|
|
325
|
+
declare const decisionSchema: JSONSchemaType<Cooperative.Document.IDecisionData>;
|
|
326
|
+
|
|
327
|
+
declare const entrepreneurSchema: JSONSchemaType<ExternalEntrepreneurData>;
|
|
328
|
+
|
|
329
|
+
declare const organizationSchema: JSONSchemaType<ExternalOrganizationData>;
|
|
330
|
+
|
|
331
|
+
declare const individualSchema: JSONSchemaType<ExternalIndividualData>;
|
|
332
|
+
|
|
333
|
+
declare const paymentMethodSchema: JSONSchemaType<IPaymentData>;
|
|
334
|
+
|
|
335
|
+
declare const CooperativeSchema: JSONSchemaType<CooperativeData>;
|
|
336
|
+
|
|
337
|
+
declare const VarsSchema: JSONSchemaType<IVars>;
|
|
338
|
+
|
|
339
|
+
declare abstract class DocFactory<T extends IGenerate> {
|
|
340
|
+
abstract generateDocument(data: T, options?: IGenerationOptions): Promise<IGeneratedDocument>;
|
|
341
|
+
storage: MongoDBConnector;
|
|
342
|
+
constructor(storage: MongoDBConnector);
|
|
343
|
+
validate(combinedData: ICombinedData, schema: any): Promise<ValidateResult>;
|
|
344
|
+
getOrganization(username: string, block_num?: number): Promise<ExternalOrganizationData>;
|
|
345
|
+
getBankAccount(username: string, block_num?: number): Promise<IBankAccount>;
|
|
346
|
+
getUser(username: string, block_num?: number): Promise<{
|
|
347
|
+
type: string;
|
|
348
|
+
data: externalDataTypes;
|
|
349
|
+
}>;
|
|
350
|
+
getCooperative(username: string, block_num?: number): Promise<CooperativeData>;
|
|
351
|
+
getProject(id: string, block_num?: number): Promise<InternalProjectData>;
|
|
352
|
+
getVars(coopname: string, block_num?: number): Promise<IVars>;
|
|
353
|
+
getDecision(coop: CooperativeData, coopname: string, decision_id: number, created_at: string): Promise<Cooperative.Document.IDecisionData>;
|
|
354
|
+
getTemplate<T>(scope: string, registry_id: number, block_num?: number): Promise<ITemplate<T>>;
|
|
355
|
+
generatePDF(data: externalDataTypes | string, context: string, vars: ICombinedData, translation: ITranslations, meta: IMetaDocument, skip_save?: boolean): Promise<IGeneratedDocument>;
|
|
356
|
+
getFullName(data: externalDataTypes | string): string;
|
|
357
|
+
saveDraft(document: IGeneratedDocument): Promise<void>;
|
|
358
|
+
getMeta<T extends IMetaDocumentPartial>({ title, username, coopname, registry_id, links, lang, generator, version, // TODO перенести в .env
|
|
359
|
+
created_at, block_num, timezone, // TODO перенести в .env
|
|
360
|
+
...restParams }: T): Promise<IMetaDocument>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
type dataTypes = 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project';
|
|
364
|
+
|
|
365
|
+
interface IGenerator {
|
|
366
|
+
connect: (mongoUri: string) => Promise<void>;
|
|
367
|
+
disconnect: () => Promise<void>;
|
|
368
|
+
generate: (data: IGenerate, options?: IGenerationOptions) => Promise<IGeneratedDocument>;
|
|
369
|
+
getDocument: (filter: Filter<IFilterDocuments>) => Promise<IGeneratedDocument>;
|
|
370
|
+
constructCooperative: (username: string, block_num?: number) => Promise<CooperativeData | null>;
|
|
371
|
+
save: ((type: 'individual', data: ExternalIndividualData) => Promise<InsertOneResult>) & ((type: 'entrepreneur', data: ExternalEntrepreneurData) => Promise<InsertOneResult>) & ((type: 'organization', data: ExternalOrganizationData) => Promise<InsertOneResult>) & ((type: 'paymentMethod', data: PaymentData) => Promise<InsertOneResult>) & ((type: 'vars', data: IVars) => Promise<InsertOneResult>) & ((type: 'project', data: ExternalProjectData) => Promise<InsertOneResult>);
|
|
372
|
+
get: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<externalDataTypes | null>;
|
|
373
|
+
del: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<UpdateResult>;
|
|
374
|
+
list: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<Cooperative.Document.IGetResponse<internalFilterTypes>>;
|
|
375
|
+
getHistory: (type: dataTypes, filter: Filter<internalFilterTypes>) => Promise<externalDataTypesArrays>;
|
|
376
|
+
}
|
|
377
|
+
declare class Generator implements IGenerator {
|
|
378
|
+
factories: {
|
|
379
|
+
[K in Numbers]: DocFactory<IGenerate>;
|
|
380
|
+
};
|
|
381
|
+
storage: MongoDBConnector;
|
|
382
|
+
connect(mongoUri: string): Promise<void>;
|
|
383
|
+
disconnect(): Promise<void>;
|
|
384
|
+
generate(data: IGenerate, options?: IGenerationOptions): Promise<IGeneratedDocument>;
|
|
385
|
+
getDocument(filter: Filter<IFilterDocuments>): Promise<IGeneratedDocument>;
|
|
386
|
+
save(type: 'individual', data: ExternalIndividualData): Promise<InsertOneResult>;
|
|
387
|
+
save(type: 'entrepreneur', data: ExternalEntrepreneurData): Promise<InsertOneResult>;
|
|
388
|
+
save(type: 'organization', data: ExternalOrganizationData): Promise<InsertOneResult>;
|
|
389
|
+
save(type: 'paymentMethod', data: PaymentData): Promise<InsertOneResult>;
|
|
390
|
+
save(type: 'vars', data: IVars): Promise<InsertOneResult>;
|
|
391
|
+
save(type: 'project', data: ExternalProjectData): Promise<InsertOneResult>;
|
|
392
|
+
del(type: dataTypes, filter: Filter<internalFilterTypes>): Promise<UpdateResult>;
|
|
393
|
+
get(type: dataTypes, filter: Filter<internalFilterTypes>): Promise<externalDataTypes | null>;
|
|
394
|
+
list(type: dataTypes, filter: Filter<internalFilterTypes>): Promise<Cooperative.Document.IGetResponse<externalDataTypes>>;
|
|
395
|
+
getHistory(type: 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project', filter: Filter<internalFilterTypes>): Promise<externalDataTypesArrays>;
|
|
396
|
+
getModel(type: dataTypes, data?: externalDataTypes): Individual | Entrepreneur | Organization | PaymentMethod | Vars | Project;
|
|
397
|
+
constructCooperative(username: string, block_num?: number): Promise<CooperativeData | null>;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export { BankAccountSchema, 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, type LangType, type NestedRecord, type Numbers, ParticipantApplication, PrivacyPolicy, ProjectFreeDecision, Registry, RegulationElectronicSignaturet as RegulationElectronicSignature, SelectBranchStatement, UserAgreement, VarsSchema, WalletAgreement, type dataTypes, decisionSchema, entrepreneurSchema, type externalDataTypes, type externalDataTypesArrays, individualSchema, type internalFilterTypes, organizationSchema, paymentMethodSchema };
|