@coopenomics/extension-kit 2026.8.18-2

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.mjs ADDED
@@ -0,0 +1,1885 @@
1
+ import { createParamDecorator, UnauthorizedException, applyDecorators, SetMetadata, Injectable, Inject, ForbiddenException, HttpException, HttpStatus, BadRequestException } from '@nestjs/common';
2
+ import { GqlExecutionContext, Directive, Field, InputType, registerEnumType, Int, IntersectionType, OmitType, ObjectType } from '@nestjs/graphql';
3
+ import { Reflector } from '@nestjs/core';
4
+ import { AuthGuard } from '@nestjs/passport';
5
+ import { z } from 'zod';
6
+ import { IsNumber, IsString, IsArray, ArrayMinSize, ValidateNested, IsEnum, IsInt, IsOptional, Matches, IsNotEmpty, IsObject } from 'class-validator';
7
+ import { Type } from 'class-transformer';
8
+ import { GraphQLJSON } from 'graphql-type-json';
9
+ import { Classes } from '@coopenomics/sdk';
10
+ import { Name } from '@wharfkit/antelope';
11
+ import moment from 'moment';
12
+ import moment$1 from 'moment-timezone';
13
+ import 'moment/locale/ru';
14
+ import crypto from 'crypto';
15
+
16
+ function AuthRoles(roles, options = {}) {
17
+ const self = options.self ?? [];
18
+ const args = self.length ? `roles: ${JSON.stringify(roles)}, self: ${JSON.stringify(self)}` : `roles: ${JSON.stringify(roles)}`;
19
+ return applyDecorators(SetMetadata("roles", roles), Directive(`@auth(${args})`));
20
+ }
21
+ const CurrentUser = createParamDecorator((data, context) => {
22
+ const ctx = GqlExecutionContext.create(context);
23
+ const request = ctx.getContext().req;
24
+ if (!request?.user) {
25
+ throw new UnauthorizedException("\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043D\u0435 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D");
26
+ }
27
+ return request?.user;
28
+ });
29
+ const OptionalCurrentUser = createParamDecorator(
30
+ (_data, context) => {
31
+ const ctx = GqlExecutionContext.create(context);
32
+ return ctx.getContext().req?.user ?? null;
33
+ }
34
+ );
35
+
36
+ let serverSecret;
37
+ function configureExtensionAuth(options) {
38
+ serverSecret = options.serverSecret;
39
+ }
40
+ function hasServerSecret(headers) {
41
+ if (!serverSecret)
42
+ return false;
43
+ return headers?.["server-secret"] === serverSecret;
44
+ }
45
+
46
+ var __defProp$g = Object.defineProperty;
47
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
48
+ var __decorateClass$g = (decorators, target, key, kind) => {
49
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
50
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
51
+ if (decorator = decorators[i])
52
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
53
+ if (kind && result)
54
+ __defProp$g(target, key, result);
55
+ return result;
56
+ };
57
+ var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
58
+ let GqlJwtAuthGuard = class extends AuthGuard("jwt") {
59
+ getRequest(context) {
60
+ const ctx = GqlExecutionContext.create(context);
61
+ const request = ctx.getContext().req;
62
+ if (hasServerSecret(request?.headers)) {
63
+ return request;
64
+ }
65
+ if (ctx.getType() === "ws") {
66
+ const { connectionParams } = ctx.getContext();
67
+ return { headers: { authorization: connectionParams?.authorization } };
68
+ }
69
+ return request;
70
+ }
71
+ canActivate(context) {
72
+ const request = this.getRequest(context);
73
+ if (hasServerSecret(request?.headers)) {
74
+ return true;
75
+ }
76
+ return super.canActivate(context);
77
+ }
78
+ };
79
+ GqlJwtAuthGuard = __decorateClass$g([
80
+ Injectable()
81
+ ], GqlJwtAuthGuard);
82
+ let OptionalGqlJwtAuthGuard = class extends AuthGuard("jwt") {
83
+ getRequest(context) {
84
+ const ctx = GqlExecutionContext.create(context);
85
+ return ctx.getContext().req;
86
+ }
87
+ // passport бросает на отсутствии/невалидном токене — гасим в null,
88
+ // запрос продолжается как гостевой.
89
+ handleRequest(_err, user) {
90
+ return user ?? null;
91
+ }
92
+ };
93
+ OptionalGqlJwtAuthGuard = __decorateClass$g([
94
+ Injectable()
95
+ ], OptionalGqlJwtAuthGuard);
96
+ let HttpJwtAuthGuard = class extends AuthGuard("jwt") {
97
+ getRequest(context) {
98
+ return context.switchToHttp().getRequest();
99
+ }
100
+ canActivate(context) {
101
+ const request = this.getRequest(context);
102
+ if (hasServerSecret(request?.headers)) {
103
+ return true;
104
+ }
105
+ return super.canActivate(context);
106
+ }
107
+ };
108
+ HttpJwtAuthGuard = __decorateClass$g([
109
+ Injectable()
110
+ ], HttpJwtAuthGuard);
111
+ let RolesGuard = class {
112
+ // Токен указан явно: пакет собирается esbuild'ом, а он не умеет
113
+ // `emitDecoratorMetadata`. Без `@Inject` Nest не увидел бы `design:paramtypes`,
114
+ // построил бы гард без аргументов, и `reflector` оказался бы `undefined` —
115
+ // отказ приходил бы не отказом, а 500 на первом же запросе с ролями.
116
+ constructor(reflector) {
117
+ this.reflector = reflector;
118
+ }
119
+ canActivate(context) {
120
+ const ctx = GqlExecutionContext.create(context);
121
+ const request = ctx.getContext().req;
122
+ if (hasServerSecret(request?.headers)) {
123
+ return true;
124
+ }
125
+ const allowedRoles = this.reflector.get("roles", context.getHandler());
126
+ if (!allowedRoles) {
127
+ return true;
128
+ }
129
+ const { user } = request;
130
+ const args = ctx.getArgs();
131
+ const data = args.data;
132
+ const filter = args.filter;
133
+ if (data && data.username && user.username === data.username || filter && filter.username && user.username === filter.username || args.username && user.username === args.username) {
134
+ return true;
135
+ }
136
+ if (allowedRoles.includes(user.role)) {
137
+ return true;
138
+ }
139
+ throw new UnauthorizedException(`\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432 \u0434\u043E\u0441\u0442\u0443\u043F\u0430`);
140
+ }
141
+ };
142
+ RolesGuard = __decorateClass$g([
143
+ Injectable(),
144
+ __decorateParam(0, Inject(Reflector))
145
+ ], RolesGuard);
146
+ const ACTIVE_USER_STATUS = "active";
147
+ let ActiveUserStatusGuard = class {
148
+ canActivate(context) {
149
+ const ctx = GqlExecutionContext.create(context);
150
+ const request = ctx.getContext().req;
151
+ if (hasServerSecret(request?.headers)) {
152
+ return true;
153
+ }
154
+ const user = request.user;
155
+ if (!user?.status) {
156
+ throw new ForbiddenException("\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C");
157
+ }
158
+ if (user.status !== ACTIVE_USER_STATUS) {
159
+ throw new ForbiddenException(
160
+ "\u0414\u043E\u0441\u0442\u0443\u043F \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u0432 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 \xABactive\xBB"
161
+ );
162
+ }
163
+ return true;
164
+ }
165
+ };
166
+ ActiveUserStatusGuard = __decorateClass$g([
167
+ Injectable()
168
+ ], ActiveUserStatusGuard);
169
+
170
+ var __defProp$f = Object.defineProperty;
171
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
172
+ var __decorateClass$f = (decorators, target, key, kind) => {
173
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
174
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
175
+ if (decorator = decorators[i])
176
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
177
+ if (kind && result)
178
+ __defProp$f(target, key, result);
179
+ return result;
180
+ };
181
+ let BaseExtensionModule = class {
182
+ constructor() {
183
+ this.configSchemas = z.object({});
184
+ }
185
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
186
+ async onModuleInit() {
187
+ }
188
+ };
189
+ BaseExtensionModule = __decorateClass$f([
190
+ Injectable()
191
+ ], BaseExtensionModule);
192
+
193
+ var __defProp$e = Object.defineProperty;
194
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
195
+ var __decorateClass$e = (decorators, target, key, kind) => {
196
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
197
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
198
+ if (decorator = decorators[i])
199
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
200
+ if (kind && result)
201
+ __defProp$e(target, key, result);
202
+ return result;
203
+ };
204
+ let PaymentProvider = class extends BaseExtensionModule {
205
+ };
206
+ PaymentProvider = __decorateClass$e([
207
+ Injectable()
208
+ ], PaymentProvider);
209
+ let PollingProvider = class extends PaymentProvider {
210
+ };
211
+ PollingProvider = __decorateClass$e([
212
+ Injectable()
213
+ ], PollingProvider);
214
+ let IPNProvider = class extends PaymentProvider {
215
+ };
216
+ IPNProvider = __decorateClass$e([
217
+ Injectable()
218
+ ], IPNProvider);
219
+
220
+ const REGISTERED = /* @__PURE__ */ new Map();
221
+ const BucketRegistry = {
222
+ add(cls, spec) {
223
+ const existing = REGISTERED.get(cls);
224
+ if (existing && existing.name !== spec.name) {
225
+ throw new Error(
226
+ `BucketRegistry: \u043A\u043B\u0430\u0441\u0441 ${cls.name} \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D \u043F\u043E\u0434 \u0431\u0430\u043A\u0435\u0442\u043E\u043C '${existing.name}', \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0430\u044F \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044F \u043F\u043E\u0434 '${spec.name}' \u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u0430`
227
+ );
228
+ }
229
+ REGISTERED.set(cls, spec);
230
+ },
231
+ get(cls) {
232
+ return REGISTERED.get(cls);
233
+ },
234
+ list() {
235
+ return Array.from(REGISTERED.entries()).map(([cls, spec]) => ({ cls, spec }));
236
+ },
237
+ /** Только для тестов: очистка реестра между сценариями. */
238
+ _resetForTests() {
239
+ REGISTERED.clear();
240
+ }
241
+ };
242
+ function bucketTokenFor(cls) {
243
+ return `__InterFileStorageBucket:${cls.name}`;
244
+ }
245
+ function UseBucket(spec) {
246
+ return (target) => {
247
+ BucketRegistry.add(target, spec);
248
+ };
249
+ }
250
+ function InjectBucket() {
251
+ return (target, propertyKey, parameterIndex) => {
252
+ const cls = target;
253
+ Inject(bucketTokenFor(cls))(target, propertyKey, parameterIndex);
254
+ };
255
+ }
256
+
257
+ function bucketProvidersFor(fileStoragePortToken, consumers) {
258
+ return consumers.map((cls) => {
259
+ const spec = BucketRegistry.get(cls);
260
+ if (!spec) {
261
+ throw new Error(
262
+ `bucketProvidersFor: \u043A\u043B\u0430\u0441\u0441 ${cls.name} \u043D\u0435 \u043F\u043E\u043C\u0435\u0447\u0435\u043D @UseBucket \u2014 \u043E\u0431\u044A\u044F\u0432\u0438\u0442\u0435 \u0445\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435 \u0440\u044F\u0434\u043E\u043C \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043E\u043C`
263
+ );
264
+ }
265
+ return {
266
+ provide: bucketTokenFor(cls),
267
+ useFactory: (source) => source.getBucket(spec),
268
+ inject: [fileStoragePortToken]
269
+ };
270
+ });
271
+ }
272
+
273
+ var __defProp$d = Object.defineProperty;
274
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
275
+ var __decorateClass$d = (decorators, target, key, kind) => {
276
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
277
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
278
+ if (decorator = decorators[i])
279
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
280
+ if (kind && result)
281
+ __defProp$d(target, key, result);
282
+ return result;
283
+ };
284
+ let SignatureInfoInputDTO = class {
285
+ };
286
+ __decorateClass$d([
287
+ Field(() => Number, { description: "\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043D\u043E\u043C\u0435\u0440\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u0438" }),
288
+ IsNumber()
289
+ ], SignatureInfoInputDTO.prototype, "id", 2);
290
+ __decorateClass$d([
291
+ Field(() => String, { description: "\u0410\u043A\u043A\u0430\u0443\u043D\u0442 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u0432\u0448\u0435\u0433\u043E" }),
292
+ IsString()
293
+ ], SignatureInfoInputDTO.prototype, "signer", 2);
294
+ __decorateClass$d([
295
+ Field(() => String, { description: "\u041F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 \u043A\u043B\u044E\u0447" }),
296
+ IsString()
297
+ ], SignatureInfoInputDTO.prototype, "public_key", 2);
298
+ __decorateClass$d([
299
+ Field(() => String, { description: "\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u0445\u044D\u0448\u0430" }),
300
+ IsString()
301
+ ], SignatureInfoInputDTO.prototype, "signature", 2);
302
+ __decorateClass$d([
303
+ Field(() => String, { description: "\u0412\u0440\u0435\u043C\u044F \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0438\u044F" }),
304
+ IsString()
305
+ ], SignatureInfoInputDTO.prototype, "signed_at", 2);
306
+ __decorateClass$d([
307
+ Field(() => String, { description: "\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u043D\u044B\u0439 \u0445\u044D\u0448" }),
308
+ IsString()
309
+ ], SignatureInfoInputDTO.prototype, "signed_hash", 2);
310
+ __decorateClass$d([
311
+ Field(() => String, { description: "\u041C\u0435\u0442\u0430-\u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u043E\u0434\u043F\u0438\u0441\u0438" }),
312
+ IsString()
313
+ ], SignatureInfoInputDTO.prototype, "meta", 2);
314
+ SignatureInfoInputDTO = __decorateClass$d([
315
+ InputType("SignatureInfoInput")
316
+ ], SignatureInfoInputDTO);
317
+ let SignedDigitalDocumentInputDTO = class {
318
+ constructor(data) {
319
+ Object.assign(this, data);
320
+ }
321
+ /**
322
+ * Преобразует подписанный документ DTO в формат IChainDocument для блокчейна
323
+ */
324
+ toDocument() {
325
+ return {
326
+ version: this.version,
327
+ hash: this.hash,
328
+ doc_hash: this.doc_hash,
329
+ meta_hash: this.meta_hash,
330
+ meta: JSON.stringify(this.meta),
331
+ signatures: this.signatures
332
+ };
333
+ }
334
+ };
335
+ __decorateClass$d([
336
+ Field(() => String, { description: "\u0412\u0435\u0440\u0441\u0438\u044F \u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
337
+ IsString()
338
+ ], SignedDigitalDocumentInputDTO.prototype, "version", 2);
339
+ __decorateClass$d([
340
+ Field(() => String, { description: "\u041E\u0431\u0449\u0438\u0439 \u0445\u044D\u0448 (doc_hash + meta_hash)" }),
341
+ IsString()
342
+ ], SignedDigitalDocumentInputDTO.prototype, "hash", 2);
343
+ __decorateClass$d([
344
+ Field(() => String, { description: "\u0425\u044D\u0448 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0433\u043E \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
345
+ IsString()
346
+ ], SignedDigitalDocumentInputDTO.prototype, "doc_hash", 2);
347
+ __decorateClass$d([
348
+ Field(() => String, { description: "\u0425\u044D\u0448 \u043C\u0435\u0442\u0430-\u0434\u0430\u043D\u043D\u044B\u0445" }),
349
+ IsString()
350
+ ], SignedDigitalDocumentInputDTO.prototype, "meta_hash", 2);
351
+ __decorateClass$d([
352
+ Field(() => GraphQLJSON, { description: "\u041C\u0435\u0442\u0430\u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" })
353
+ ], SignedDigitalDocumentInputDTO.prototype, "meta", 2);
354
+ __decorateClass$d([
355
+ Field(() => [SignatureInfoInputDTO], { description: "\u0412\u0435\u043A\u0442\u043E\u0440 \u043F\u043E\u0434\u043F\u0438\u0441\u0435\u0439" }),
356
+ IsArray(),
357
+ ArrayMinSize(1),
358
+ ValidateNested({ each: true }),
359
+ Type(() => SignatureInfoInputDTO)
360
+ ], SignedDigitalDocumentInputDTO.prototype, "signatures", 2);
361
+ SignedDigitalDocumentInputDTO = __decorateClass$d([
362
+ InputType("SignedDigitalDocumentInput")
363
+ ], SignedDigitalDocumentInputDTO);
364
+
365
+ var LangType = /* @__PURE__ */ ((LangType2) => {
366
+ LangType2["ru"] = "ru";
367
+ return LangType2;
368
+ })(LangType || {});
369
+ registerEnumType(LangType, {
370
+ name: "LangType",
371
+ description: "\u042F\u0437\u044B\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430"
372
+ });
373
+
374
+ var __defProp$c = Object.defineProperty;
375
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
376
+ var __decorateClass$c = (decorators, target, key, kind) => {
377
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
378
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
379
+ if (decorator = decorators[i])
380
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
381
+ if (kind && result)
382
+ __defProp$c(target, key, result);
383
+ return result;
384
+ };
385
+ let MetaDocumentInputDTO = class {
386
+ };
387
+ __decorateClass$c([
388
+ Field(() => String, { description: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
389
+ IsString()
390
+ ], MetaDocumentInputDTO.prototype, "title", 2);
391
+ __decorateClass$c([
392
+ Field(() => Int, { description: "ID \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435" }),
393
+ IsNumber()
394
+ ], MetaDocumentInputDTO.prototype, "registry_id", 2);
395
+ __decorateClass$c([
396
+ Field(() => String, { description: "\u042F\u0437\u044B\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
397
+ IsEnum(LangType)
398
+ ], MetaDocumentInputDTO.prototype, "lang", 2);
399
+ __decorateClass$c([
400
+ Field(() => String, { description: "\u0418\u043C\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0442\u043E\u0440\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u043B\u044F \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
401
+ IsString()
402
+ ], MetaDocumentInputDTO.prototype, "generator", 2);
403
+ __decorateClass$c([
404
+ Field(() => String, { description: "\u0412\u0435\u0440\u0441\u0438\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0442\u043E\u0440\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u043B\u044F \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
405
+ IsString()
406
+ ], MetaDocumentInputDTO.prototype, "version", 2);
407
+ __decorateClass$c([
408
+ Field(() => String, { description: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430, \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u043E\u0435 \u0441 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043C" }),
409
+ IsString()
410
+ ], MetaDocumentInputDTO.prototype, "coopname", 2);
411
+ __decorateClass$c([
412
+ Field(() => String, { description: "\u0418\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F, \u0441\u043E\u0437\u0434\u0430\u0432\u0448\u0435\u0433\u043E \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442" }),
413
+ IsString()
414
+ ], MetaDocumentInputDTO.prototype, "username", 2);
415
+ __decorateClass$c([
416
+ Field(() => String, { description: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
417
+ IsString()
418
+ ], MetaDocumentInputDTO.prototype, "created_at", 2);
419
+ __decorateClass$c([
420
+ Field(() => Int, { description: "\u041D\u043E\u043C\u0435\u0440 \u0431\u043B\u043E\u043A\u0430, \u043D\u0430 \u043A\u043E\u0442\u043E\u0440\u043E\u043C \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442" }),
421
+ IsInt()
422
+ ], MetaDocumentInputDTO.prototype, "block_num", 2);
423
+ __decorateClass$c([
424
+ Field(() => String, { description: "\u0427\u0430\u0441\u043E\u0432\u043E\u0439 \u043F\u043E\u044F\u0441, \u0432 \u043A\u043E\u0442\u043E\u0440\u043E\u043C \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442" }),
425
+ IsString()
426
+ ], MetaDocumentInputDTO.prototype, "timezone", 2);
427
+ __decorateClass$c([
428
+ Field(() => [String], { description: "\u0421\u0441\u044B\u043B\u043A\u0438, \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0441 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043C" }),
429
+ IsArray(),
430
+ IsString({ each: true })
431
+ ], MetaDocumentInputDTO.prototype, "links", 2);
432
+ MetaDocumentInputDTO = __decorateClass$c([
433
+ InputType("MetaDocumentInput")
434
+ ], MetaDocumentInputDTO);
435
+
436
+ var __defProp$b = Object.defineProperty;
437
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
438
+ var __decorateClass$b = (decorators, target, key, kind) => {
439
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
440
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
441
+ if (decorator = decorators[i])
442
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
443
+ if (kind && result)
444
+ __defProp$b(target, key, result);
445
+ return result;
446
+ };
447
+ let GenerateMetaDocumentInputDTO = class {
448
+ };
449
+ __decorateClass$b([
450
+ Field(() => String, { description: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", nullable: true }),
451
+ IsOptional(),
452
+ IsString()
453
+ ], GenerateMetaDocumentInputDTO.prototype, "title", 2);
454
+ __decorateClass$b([
455
+ Field(() => Int, { description: "ID \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435" }),
456
+ IsNumber()
457
+ ], GenerateMetaDocumentInputDTO.prototype, "registry_id", 2);
458
+ __decorateClass$b([
459
+ Field(() => String, { description: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u043E\u043E\u043F\u0435\u0440\u0430\u0442\u0438\u0432\u0430, \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u043E\u0435 \u0441 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043C" }),
460
+ IsString()
461
+ ], GenerateMetaDocumentInputDTO.prototype, "coopname", 2);
462
+ __decorateClass$b([
463
+ Field(() => String, { description: "\u0418\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F, \u0441\u043E\u0437\u0434\u0430\u0432\u0448\u0435\u0433\u043E \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442" }),
464
+ IsString()
465
+ ], GenerateMetaDocumentInputDTO.prototype, "username", 2);
466
+ __decorateClass$b([
467
+ Field(() => String, { description: "\u042F\u0437\u044B\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", nullable: true }),
468
+ IsOptional(),
469
+ IsEnum(LangType)
470
+ ], GenerateMetaDocumentInputDTO.prototype, "lang", 2);
471
+ __decorateClass$b([
472
+ Field(() => String, { description: "\u0418\u043C\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0442\u043E\u0440\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u043B\u044F \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", nullable: true }),
473
+ IsOptional(),
474
+ IsString()
475
+ ], GenerateMetaDocumentInputDTO.prototype, "generator", 2);
476
+ __decorateClass$b([
477
+ Field(() => String, { description: "\u0412\u0435\u0440\u0441\u0438\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0442\u043E\u0440\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u043B\u044F \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", nullable: true }),
478
+ IsOptional(),
479
+ IsString()
480
+ ], GenerateMetaDocumentInputDTO.prototype, "version", 2);
481
+ __decorateClass$b([
482
+ Field(() => String, { description: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", nullable: true }),
483
+ IsOptional()
484
+ ], GenerateMetaDocumentInputDTO.prototype, "created_at", 2);
485
+ __decorateClass$b([
486
+ Field(() => Int, { description: "\u041D\u043E\u043C\u0435\u0440 \u0431\u043B\u043E\u043A\u0430, \u043D\u0430 \u043A\u043E\u0442\u043E\u0440\u043E\u043C \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442", nullable: true }),
487
+ IsOptional(),
488
+ IsInt()
489
+ ], GenerateMetaDocumentInputDTO.prototype, "block_num", 2);
490
+ __decorateClass$b([
491
+ Field(() => String, { description: "\u0427\u0430\u0441\u043E\u0432\u043E\u0439 \u043F\u043E\u044F\u0441, \u0432 \u043A\u043E\u0442\u043E\u0440\u043E\u043C \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442", nullable: true }),
492
+ IsOptional(),
493
+ IsString()
494
+ ], GenerateMetaDocumentInputDTO.prototype, "timezone", 2);
495
+ __decorateClass$b([
496
+ Field(() => [String], { description: "\u0421\u0441\u044B\u043B\u043A\u0438, \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0441 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043C", nullable: true }),
497
+ IsOptional(),
498
+ IsArray(),
499
+ IsString({ each: true })
500
+ ], GenerateMetaDocumentInputDTO.prototype, "links", 2);
501
+ GenerateMetaDocumentInputDTO = __decorateClass$b([
502
+ InputType("GenerateMetaDocumentInput")
503
+ ], GenerateMetaDocumentInputDTO);
504
+
505
+ var __defProp$a = Object.defineProperty;
506
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
507
+ var __decorateClass$a = (decorators, target, key, kind) => {
508
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
509
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
510
+ if (decorator = decorators[i])
511
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
512
+ if (kind && result)
513
+ __defProp$a(target, key, result);
514
+ return result;
515
+ };
516
+ let ExpenseProposalItemInputDTO = class {
517
+ };
518
+ __decorateClass$a([
519
+ Field(() => String, { description: "\u041F\u043E\u0440\u044F\u0434\u043A\u043E\u0432\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0441\u0442\u0440\u043E\u043A\u0438" }),
520
+ IsString()
521
+ ], ExpenseProposalItemInputDTO.prototype, "number", 2);
522
+ __decorateClass$a([
523
+ Field(() => String, { description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u0430" }),
524
+ IsString()
525
+ ], ExpenseProposalItemInputDTO.prototype, "description", 2);
526
+ __decorateClass$a([
527
+ Field(() => String, { description: "\u0421\u0443\u043C\u043C\u0430 \u0441\u0442\u0440\u043E\u043A\u0438" }),
528
+ IsString()
529
+ ], ExpenseProposalItemInputDTO.prototype, "amount", 2);
530
+ __decorateClass$a([
531
+ Field(() => String, { description: "\u0422\u0438\u043F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F (SELF / MEMBER / ORG)" }),
532
+ IsString()
533
+ ], ExpenseProposalItemInputDTO.prototype, "recipient_type", 2);
534
+ __decorateClass$a([
535
+ Field(() => String, { description: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B (ADVANCE / DIRECT)" }),
536
+ IsString()
537
+ ], ExpenseProposalItemInputDTO.prototype, "mechanics", 2);
538
+ __decorateClass$a([
539
+ Field(() => String, { description: "\u0418\u043C\u044F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F", nullable: true }),
540
+ IsOptional(),
541
+ IsString()
542
+ ], ExpenseProposalItemInputDTO.prototype, "recipient_name", 2);
543
+ __decorateClass$a([
544
+ Field(() => String, { description: "\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F", nullable: true }),
545
+ IsOptional(),
546
+ IsString()
547
+ ], ExpenseProposalItemInputDTO.prototype, "requisites", 2);
548
+ __decorateClass$a([
549
+ Field(() => String, { description: "\u041D\u0430\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043B\u0430\u0442\u0435\u0436\u0430 \u2014 \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0439 \u0441\u0442\u0440\u043E\u043A\u043E\u0439 \u043F\u043E\u0441\u043B\u0435 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u043E\u0432", nullable: true }),
550
+ IsOptional(),
551
+ IsString()
552
+ ], ExpenseProposalItemInputDTO.prototype, "payment_purpose", 2);
553
+ __decorateClass$a([
554
+ Field(() => String, {
555
+ description: "\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0445 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u043E\u0432 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F-\u043F\u0430\u0439\u0449\u0438\u043A\u0430 \u2014 \u0441\u0435\u0440\u0432\u0435\u0440 \u043F\u043E\u0434\u0441\u0442\u0430\u0432\u0438\u0442 \u043F\u043E\u043B\u043D\u044B\u0435 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442.",
556
+ nullable: true
557
+ }),
558
+ IsOptional(),
559
+ IsString()
560
+ ], ExpenseProposalItemInputDTO.prototype, "payment_method_id", 2);
561
+ __decorateClass$a([
562
+ Field(() => String, {
563
+ description: "\u0418\u043C\u044F \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F-\u043F\u0430\u0439\u0449\u0438\u043A\u0430 (\u0432\u043B\u0430\u0434\u0435\u043B\u0435\u0446 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u043E\u0432).",
564
+ nullable: true
565
+ }),
566
+ IsOptional(),
567
+ IsString()
568
+ ], ExpenseProposalItemInputDTO.prototype, "recipient_username", 2);
569
+ ExpenseProposalItemInputDTO = __decorateClass$a([
570
+ InputType("ExpenseProposalItemInput")
571
+ ], ExpenseProposalItemInputDTO);
572
+ let ExpenseProposalSignedItemInputDTO = class {
573
+ };
574
+ __decorateClass$a([
575
+ Field(() => String, { description: "\u041F\u043E\u0440\u044F\u0434\u043A\u043E\u0432\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0441\u0442\u0440\u043E\u043A\u0438" }),
576
+ IsString()
577
+ ], ExpenseProposalSignedItemInputDTO.prototype, "number", 2);
578
+ __decorateClass$a([
579
+ Field(() => String, { description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u0430" }),
580
+ IsString()
581
+ ], ExpenseProposalSignedItemInputDTO.prototype, "description", 2);
582
+ __decorateClass$a([
583
+ Field(() => String, { description: "\u0421\u0443\u043C\u043C\u0430 \u0441\u0442\u0440\u043E\u043A\u0438" }),
584
+ IsString()
585
+ ], ExpenseProposalSignedItemInputDTO.prototype, "amount", 2);
586
+ __decorateClass$a([
587
+ Field(() => String, { description: "\u0422\u0438\u043F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F (SELF / MEMBER / ORG)" }),
588
+ IsString()
589
+ ], ExpenseProposalSignedItemInputDTO.prototype, "recipient_type", 2);
590
+ __decorateClass$a([
591
+ Field(() => String, { description: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B (ADVANCE / DIRECT)" }),
592
+ IsString()
593
+ ], ExpenseProposalSignedItemInputDTO.prototype, "mechanics", 2);
594
+ ExpenseProposalSignedItemInputDTO = __decorateClass$a([
595
+ InputType("ExpenseProposalSignedItemInput")
596
+ ], ExpenseProposalSignedItemInputDTO);
597
+ let ExpenseProposalHeaderInputDTO = class {
598
+ };
599
+ __decorateClass$a([
600
+ Field(() => String, { description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0446\u0435\u043B\u0438 \u0440\u0430\u0441\u0445\u043E\u0434\u043E\u0432" }),
601
+ IsString()
602
+ ], ExpenseProposalHeaderInputDTO.prototype, "description", 2);
603
+ __decorateClass$a([
604
+ Field(() => String, { description: "\u0418\u0442\u043E\u0433\u043E\u0432\u0430\u044F \u0441\u0443\u043C\u043C\u0430 \u0440\u0430\u0441\u0445\u043E\u0434\u043E\u0432" }),
605
+ IsString()
606
+ ], ExpenseProposalHeaderInputDTO.prototype, "total_amount", 2);
607
+ __decorateClass$a([
608
+ Field(() => Int, { description: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043F\u043E\u0437\u0438\u0446\u0438\u0439" }),
609
+ IsInt()
610
+ ], ExpenseProposalHeaderInputDTO.prototype, "items_count", 2);
611
+ __decorateClass$a([
612
+ Field(() => String, { description: "\u041A\u043E\u0448\u0435\u043B\u0451\u043A-\u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A" }),
613
+ IsString()
614
+ ], ExpenseProposalHeaderInputDTO.prototype, "source_wallet", 2);
615
+ __decorateClass$a([
616
+ Field(() => String, { description: "\u0421\u0440\u043E\u043A \u0438\u0441\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F (\xAB\u0432 \u0441\u0440\u043E\u043A \u0434\u043E\xBB), \u0444\u043E\u0440\u043C\u0430\u0442 DD.MM.YYYY" }),
617
+ IsString(),
618
+ Matches(/^\d{2}\.\d{2}\.\d{4}$/, {
619
+ message: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0441\u0440\u043E\u043A \u0438\u0441\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F \u0440\u0430\u0441\u0445\u043E\u0434\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 \u0414\u0414.\u041C\u041C.\u0413\u0413\u0413\u0413"
620
+ })
621
+ ], ExpenseProposalHeaderInputDTO.prototype, "deadline", 2);
622
+ __decorateClass$a([
623
+ Field(() => String, {
624
+ description: "\u0424\u043E\u043D\u0434 \u0441\u043F\u0438\u0441\u0430\u043D\u0438\u044F \u2014 \u043F\u043E\u0434\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0441\u0435\u0440\u0432\u0435\u0440\u043E\u043C \u0438\u0437 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432 \u0448\u0430\u0441\u0441\u0438 \u0440\u0430\u0441\u0445\u043E\u0434\u043E\u0432, \u043F\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044C \u043D\u0435 \u043D\u0443\u0436\u043D\u043E",
625
+ nullable: true
626
+ }),
627
+ IsOptional(),
628
+ IsString()
629
+ ], ExpenseProposalHeaderInputDTO.prototype, "fund_name", 2);
630
+ ExpenseProposalHeaderInputDTO = __decorateClass$a([
631
+ InputType("ExpenseProposalHeaderInput")
632
+ ], ExpenseProposalHeaderInputDTO);
633
+ let BaseExpenseProposalStatementGenerateMetaDocumentInputDTO = class {
634
+ };
635
+ __decorateClass$a([
636
+ Field(() => String, { description: "\u0425\u0435\u0448 \u0441\u043C\u0435\u0442\u044B \u0440\u0430\u0441\u0445\u043E\u0434\u0430 (\u0434\u0435\u0442\u0435\u0440\u043C\u0438\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439)" }),
637
+ IsString(),
638
+ IsNotEmpty()
639
+ ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO.prototype, "proposal_hash", 2);
640
+ __decorateClass$a([
641
+ Field(() => ExpenseProposalHeaderInputDTO, { description: "\u0428\u0430\u043F\u043A\u0430 \u0421\u0417" }),
642
+ ValidateNested(),
643
+ Type(() => ExpenseProposalHeaderInputDTO)
644
+ ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO.prototype, "proposal", 2);
645
+ __decorateClass$a([
646
+ Field(() => [ExpenseProposalItemInputDTO], { description: "\u041F\u043E\u0437\u0438\u0446\u0438\u0438 \u0440\u0430\u0441\u0445\u043E\u0434\u0430" }),
647
+ IsArray(),
648
+ ArrayMinSize(1),
649
+ ValidateNested({ each: true }),
650
+ Type(() => ExpenseProposalItemInputDTO)
651
+ ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO.prototype, "items", 2);
652
+ BaseExpenseProposalStatementGenerateMetaDocumentInputDTO = __decorateClass$a([
653
+ InputType("BaseExpenseProposalStatementGenerateMetaDocumentInput")
654
+ ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO);
655
+ let BaseExpenseProposalStatementSignedMetaDocumentInputDTO = class {
656
+ };
657
+ __decorateClass$a([
658
+ Field(() => String, { description: "\u0425\u0435\u0448 \u0441\u043C\u0435\u0442\u044B \u0440\u0430\u0441\u0445\u043E\u0434\u0430 (\u0434\u0435\u0442\u0435\u0440\u043C\u0438\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439)" }),
659
+ IsString(),
660
+ IsNotEmpty()
661
+ ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "proposal_hash", 2);
662
+ __decorateClass$a([
663
+ Field(() => ExpenseProposalHeaderInputDTO, { description: "\u0428\u0430\u043F\u043A\u0430 \u0421\u0417" }),
664
+ ValidateNested(),
665
+ Type(() => ExpenseProposalHeaderInputDTO)
666
+ ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "proposal", 2);
667
+ __decorateClass$a([
668
+ Field(() => [ExpenseProposalSignedItemInputDTO], { description: "\u041F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0435 \u043F\u043E\u0437\u0438\u0446\u0438\u0438 \u0440\u0430\u0441\u0445\u043E\u0434\u0430 (\u0431\u0435\u0437 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u043E\u0432)" }),
669
+ IsArray(),
670
+ ArrayMinSize(1),
671
+ ValidateNested({ each: true }),
672
+ Type(() => ExpenseProposalSignedItemInputDTO)
673
+ ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "items", 2);
674
+ __decorateClass$a([
675
+ Field(() => String, { description: "\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043F\u0440\u0438\u0432\u0430\u0442\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 off-chain (\u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B/\u0438\u043C\u044F/\u043D\u0430\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435)" }),
676
+ IsString(),
677
+ IsNotEmpty()
678
+ ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "doc_data_hash", 2);
679
+ BaseExpenseProposalStatementSignedMetaDocumentInputDTO = __decorateClass$a([
680
+ InputType("BaseExpenseProposalStatementSignedMetaDocumentInput")
681
+ ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO);
682
+ let ExpenseProposalStatementGenerateDocumentInputDTO = class extends IntersectionType(
683
+ BaseExpenseProposalStatementGenerateMetaDocumentInputDTO,
684
+ OmitType(GenerateMetaDocumentInputDTO, ["registry_id"])
685
+ ) {
686
+ };
687
+ ExpenseProposalStatementGenerateDocumentInputDTO = __decorateClass$a([
688
+ InputType("ExpenseProposalStatementGenerateDocumentInput")
689
+ ], ExpenseProposalStatementGenerateDocumentInputDTO);
690
+ let ExpenseProposalStatementSignedMetaDocumentInputDTO = class extends IntersectionType(
691
+ BaseExpenseProposalStatementSignedMetaDocumentInputDTO,
692
+ MetaDocumentInputDTO
693
+ ) {
694
+ };
695
+ ExpenseProposalStatementSignedMetaDocumentInputDTO = __decorateClass$a([
696
+ InputType("ExpenseProposalStatementSignedMetaDocumentInput")
697
+ ], ExpenseProposalStatementSignedMetaDocumentInputDTO);
698
+ let ExpenseProposalStatementSignedDocumentInputDTO = class extends SignedDigitalDocumentInputDTO {
699
+ };
700
+ __decorateClass$a([
701
+ Field(() => ExpenseProposalStatementSignedMetaDocumentInputDTO, {
702
+ description: "\u041C\u0435\u0442\u0430\u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0421\u0417-\u0437\u0430\u044F\u0432\u043B\u0435\u043D\u0438\u044F"
703
+ })
704
+ ], ExpenseProposalStatementSignedDocumentInputDTO.prototype, "meta", 2);
705
+ ExpenseProposalStatementSignedDocumentInputDTO = __decorateClass$a([
706
+ InputType("ExpenseProposalStatementSignedDocumentInput")
707
+ ], ExpenseProposalStatementSignedDocumentInputDTO);
708
+
709
+ var __defProp$9 = Object.defineProperty;
710
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
711
+ var __decorateClass$9 = (decorators, target, key, kind) => {
712
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
713
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
714
+ if (decorator = decorators[i])
715
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
716
+ if (kind && result)
717
+ __defProp$9(target, key, result);
718
+ return result;
719
+ };
720
+ var CandidateStatus = /* @__PURE__ */ ((CandidateStatus2) => {
721
+ CandidateStatus2["PENDING"] = "pending";
722
+ CandidateStatus2["REGISTERED"] = "registered";
723
+ CandidateStatus2["FAILED"] = "failed";
724
+ return CandidateStatus2;
725
+ })(CandidateStatus || {});
726
+ registerEnumType(CandidateStatus, {
727
+ name: "CandidateStatus"
728
+ });
729
+ let CandidateOutputDTO = class {
730
+ };
731
+ __decorateClass$9([
732
+ Field(() => String)
733
+ ], CandidateOutputDTO.prototype, "username", 2);
734
+ __decorateClass$9([
735
+ Field(() => String, { nullable: true })
736
+ ], CandidateOutputDTO.prototype, "username_display_name", 2);
737
+ __decorateClass$9([
738
+ Field(() => String)
739
+ ], CandidateOutputDTO.prototype, "coopname", 2);
740
+ __decorateClass$9([
741
+ Field(() => String, { nullable: true })
742
+ ], CandidateOutputDTO.prototype, "braname", 2);
743
+ __decorateClass$9([
744
+ Field(() => CandidateStatus)
745
+ ], CandidateOutputDTO.prototype, "status", 2);
746
+ __decorateClass$9([
747
+ Field(() => String)
748
+ ], CandidateOutputDTO.prototype, "type", 2);
749
+ __decorateClass$9([
750
+ Field(() => Date)
751
+ ], CandidateOutputDTO.prototype, "created_at", 2);
752
+ __decorateClass$9([
753
+ Field(() => Date, { nullable: true })
754
+ ], CandidateOutputDTO.prototype, "registered_at", 2);
755
+ __decorateClass$9([
756
+ Field(() => String, { nullable: true })
757
+ ], CandidateOutputDTO.prototype, "referer", 2);
758
+ __decorateClass$9([
759
+ Field(() => String, { nullable: true })
760
+ ], CandidateOutputDTO.prototype, "referer_display_name", 2);
761
+ __decorateClass$9([
762
+ Field(() => String)
763
+ ], CandidateOutputDTO.prototype, "public_key", 2);
764
+ __decorateClass$9([
765
+ Field(() => String, { nullable: true })
766
+ ], CandidateOutputDTO.prototype, "program_key", 2);
767
+ CandidateOutputDTO = __decorateClass$9([
768
+ ObjectType("Candidate")
769
+ ], CandidateOutputDTO);
770
+
771
+ var __defProp$8 = Object.defineProperty;
772
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
773
+ var __decorateClass$8 = (decorators, target, key, kind) => {
774
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
775
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
776
+ if (decorator = decorators[i])
777
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
778
+ if (kind && result)
779
+ __defProp$8(target, key, result);
780
+ return result;
781
+ };
782
+ let CandidateFilterInputDTO = class {
783
+ };
784
+ __decorateClass$8([
785
+ Field(() => String, { nullable: true })
786
+ ], CandidateFilterInputDTO.prototype, "referer", 2);
787
+ CandidateFilterInputDTO = __decorateClass$8([
788
+ InputType("CandidateFilterInput")
789
+ ], CandidateFilterInputDTO);
790
+
791
+ const ONBOARDING_EXPIRY_DAYS = 30;
792
+ const ONBOARDING_EXPIRY_MS = ONBOARDING_EXPIRY_DAYS * 24 * 60 * 60 * 1e3;
793
+ function computeOnboardingExpiresAt(startedAt) {
794
+ return new Date(startedAt.getTime() + ONBOARDING_EXPIRY_MS).toISOString();
795
+ }
796
+
797
+ class ExtensionDomainEntity {
798
+ constructor(name, enabled, config, created_at, updated_at, schema_version = 1) {
799
+ this.name = name;
800
+ this.enabled = enabled;
801
+ this.config = config;
802
+ this.created_at = created_at;
803
+ this.updated_at = updated_at;
804
+ this.schema_version = schema_version;
805
+ }
806
+ }
807
+
808
+ class LogExtensionDomainEntity {
809
+ constructor(id, name, extension_local_id, data, created_at, updated_at) {
810
+ this.id = id;
811
+ this.name = name;
812
+ this.extension_local_id = extension_local_id;
813
+ this.data = data;
814
+ this.created_at = created_at;
815
+ this.updated_at = updated_at;
816
+ }
817
+ }
818
+
819
+ const EXTENSION_REPOSITORY = Symbol.for("ExtensionKit.Repository.Extension");
820
+
821
+ const LOG_EXTENSION_REPOSITORY = Symbol.for("ExtensionKit.Repository.LogExtension");
822
+
823
+ const EXTENSION_APP_TERMINATE_EVENT = "extension.app.terminate";
824
+
825
+ var ExtensionAvailability = /* @__PURE__ */ ((ExtensionAvailability2) => {
826
+ ExtensionAvailability2["EVERYWHERE"] = "everywhere";
827
+ ExtensionAvailability2["NON_MAINNET_ONLY"] = "non_mainnet_only";
828
+ ExtensionAvailability2["NOWHERE"] = "nowhere";
829
+ return ExtensionAvailability2;
830
+ })(ExtensionAvailability || {});
831
+ function isExtensionAvailable(availability, isMainnet) {
832
+ switch (availability) {
833
+ case "everywhere" /* EVERYWHERE */:
834
+ return true;
835
+ case "non_mainnet_only" /* NON_MAINNET_ONLY */:
836
+ return !isMainnet;
837
+ case "nowhere" /* NOWHERE */:
838
+ return false;
839
+ }
840
+ }
841
+
842
+ let entities;
843
+ function registerExtensionEntities(list) {
844
+ if (entities) {
845
+ throw new Error(
846
+ "\u0421\u043E\u0441\u0442\u0430\u0432 \u0442\u0430\u0431\u043B\u0438\u0446 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0439 \u0443\u0436\u0435 \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D: registerExtensionEntities() \u0432\u044B\u0437\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u043E\u0434\u0438\u043D \u0440\u0430\u0437 \u043F\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435"
847
+ );
848
+ }
849
+ entities = [...list];
850
+ }
851
+ function extensionEntities() {
852
+ return entities ?? [];
853
+ }
854
+ function resetExtensionEntities() {
855
+ entities = void 0;
856
+ }
857
+
858
+ var __defProp$7 = Object.defineProperty;
859
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
860
+ var __decorateClass$7 = (decorators, target, key, kind) => {
861
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
862
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
863
+ if (decorator = decorators[i])
864
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
865
+ if (kind && result)
866
+ __defProp$7(target, key, result);
867
+ return result;
868
+ };
869
+ let PaginationInputDTO = class {
870
+ };
871
+ __decorateClass$7([
872
+ Field(() => Int, { description: "\u041D\u043E\u043C\u0435\u0440 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B", defaultValue: 1 })
873
+ ], PaginationInputDTO.prototype, "page", 2);
874
+ __decorateClass$7([
875
+ Field(() => Int, { description: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435", defaultValue: 10 })
876
+ ], PaginationInputDTO.prototype, "limit", 2);
877
+ __decorateClass$7([
878
+ Field(() => String, { nullable: true, description: '\u041A\u043B\u044E\u0447 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, "name")' })
879
+ ], PaginationInputDTO.prototype, "sortBy", 2);
880
+ __decorateClass$7([
881
+ Field(() => String, {
882
+ description: '\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438 ("ASC" \u0438\u043B\u0438 "DESC")',
883
+ defaultValue: "ASC"
884
+ })
885
+ ], PaginationInputDTO.prototype, "sortOrder", 2);
886
+ PaginationInputDTO = __decorateClass$7([
887
+ InputType("PaginationInput")
888
+ ], PaginationInputDTO);
889
+ class PaginationResult {
890
+ }
891
+ function createPaginationResult(ItemType, name) {
892
+ let PaginationResult2 = class {
893
+ };
894
+ __decorateClass$7([
895
+ Field(() => [ItemType], { description: "\u042D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u0442\u0435\u043A\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B" })
896
+ ], PaginationResult2.prototype, "items", 2);
897
+ __decorateClass$7([
898
+ Field(() => Int, { description: "\u041E\u0431\u0449\u0435\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" })
899
+ ], PaginationResult2.prototype, "totalCount", 2);
900
+ __decorateClass$7([
901
+ Field(() => Int, { description: "\u041E\u0431\u0449\u0435\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0441\u0442\u0440\u0430\u043D\u0438\u0446" })
902
+ ], PaginationResult2.prototype, "totalPages", 2);
903
+ __decorateClass$7([
904
+ Field(() => Int, { description: "\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430" })
905
+ ], PaginationResult2.prototype, "currentPage", 2);
906
+ PaginationResult2 = __decorateClass$7([
907
+ ObjectType(`${name}PaginationResult`, { isAbstract: true })
908
+ ], PaginationResult2);
909
+ return PaginationResult2;
910
+ }
911
+ function buildPaginationResult(raw, options, mapItem) {
912
+ const limit = options?.limit;
913
+ const page = options?.page != null ? Math.max(1, options.page) : 1;
914
+ const totalPages = limit != null && limit > 0 ? Math.max(1, Math.ceil(raw.totalCount / limit)) : 1;
915
+ return {
916
+ items: raw.items.map(mapItem),
917
+ totalCount: raw.totalCount,
918
+ totalPages,
919
+ currentPage: page
920
+ };
921
+ }
922
+ class PaginationUtils {
923
+ /** Собрать результат из выборки репозитория и параметров запроса. */
924
+ static createPaginationResult(items, totalCount, options) {
925
+ const { page = 1, limit = 10 } = options;
926
+ const totalPages = Math.ceil(totalCount / limit);
927
+ return {
928
+ items,
929
+ totalCount,
930
+ totalPages,
931
+ currentPage: page
932
+ };
933
+ }
934
+ /** Перевести номер страницы в `LIMIT`/`OFFSET`. */
935
+ static getSqlPaginationParams(options) {
936
+ const { page = 1, limit = 10 } = options;
937
+ const offset = (page - 1) * limit;
938
+ return {
939
+ limit,
940
+ offset
941
+ };
942
+ }
943
+ /**
944
+ * Проверить параметры и подставить умолчания.
945
+ *
946
+ * Верхняя граница `limit` — защита от выгрузки всей таблицы одним запросом,
947
+ * поэтому проверка живёт здесь, а не в каждом репозитории.
948
+ */
949
+ static validatePaginationOptions(options) {
950
+ const { page = 1, limit = 10, sortBy, sortOrder = "ASC" } = options;
951
+ if (page < 1) {
952
+ throw new Error("\u041D\u043E\u043C\u0435\u0440 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 0");
953
+ }
954
+ if (limit < 1 || limit > 1e3) {
955
+ throw new Error("\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043E\u0442 1 \u0434\u043E 1000");
956
+ }
957
+ if (sortOrder !== "ASC" && sortOrder !== "DESC") {
958
+ throw new Error("\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C ASC \u0438\u043B\u0438 DESC");
959
+ }
960
+ return {
961
+ page,
962
+ limit,
963
+ sortBy,
964
+ sortOrder
965
+ };
966
+ }
967
+ }
968
+ function paginationInputToOffset(options) {
969
+ const limit = options?.limit;
970
+ const page = options?.page != null ? Math.max(1, options.page) : 1;
971
+ const offset = limit != null ? (page - 1) * limit : void 0;
972
+ return {
973
+ limit,
974
+ offset,
975
+ sortBy: options?.sortBy,
976
+ sortOrder: options?.sortOrder
977
+ };
978
+ }
979
+
980
+ var __defProp$6 = Object.defineProperty;
981
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
982
+ var __decorateClass$6 = (decorators, target, key, kind) => {
983
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
984
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
985
+ if (decorator = decorators[i])
986
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
987
+ if (kind && result)
988
+ __defProp$6(target, key, result);
989
+ return result;
990
+ };
991
+ let TransactionDTO = class {
992
+ };
993
+ __decorateClass$6([
994
+ Field(() => GraphQLJSON, { description: "\u0411\u043B\u043E\u043A\u0447\u0435\u0439\u043D, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043B\u0441\u044F", nullable: true })
995
+ ], TransactionDTO.prototype, "chain", 2);
996
+ __decorateClass$6([
997
+ Field(() => GraphQLJSON, { description: "\u0417\u0430\u043F\u0440\u043E\u0441 \u043D\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438", nullable: true })
998
+ ], TransactionDTO.prototype, "request", 2);
999
+ __decorateClass$6([
1000
+ Field(() => GraphQLJSON, { description: "\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u043D\u044B\u0439 \u0437\u0430\u043F\u0440\u043E\u0441 \u043D\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438", nullable: true })
1001
+ ], TransactionDTO.prototype, "resolved", 2);
1002
+ __decorateClass$6([
1003
+ Field(() => GraphQLJSON, {
1004
+ description: "\u041E\u0442\u0432\u0435\u0442 \u043E\u0442 API \u043F\u043E\u0441\u043B\u0435 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0438 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438 (\u0435\u0441\u043B\u0438 \u0431\u044B\u043B \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D \u0431\u0440\u043E\u0434\u043A\u0430\u0441\u0442)",
1005
+ nullable: true
1006
+ })
1007
+ ], TransactionDTO.prototype, "response", 2);
1008
+ __decorateClass$6([
1009
+ Field(() => GraphQLJSON, { description: "\u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043C\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438", nullable: true })
1010
+ ], TransactionDTO.prototype, "returns", 2);
1011
+ __decorateClass$6([
1012
+ Field(() => GraphQLJSON, { description: "\u0420\u0435\u0432\u0438\u0437\u0438\u0438 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438, \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043D\u044B\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F\u043C\u0438 \u0432 ESR \u0444\u043E\u0440\u043C\u0430\u0442\u0435", nullable: true })
1013
+ ], TransactionDTO.prototype, "revisions", 2);
1014
+ __decorateClass$6([
1015
+ Field(() => GraphQLJSON, { description: "\u041F\u043E\u0434\u043F\u0438\u0441\u0438 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438", nullable: true })
1016
+ ], TransactionDTO.prototype, "signatures", 2);
1017
+ __decorateClass$6([
1018
+ Field(() => GraphQLJSON, { description: "\u0410\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442", nullable: true })
1019
+ ], TransactionDTO.prototype, "signer", 2);
1020
+ __decorateClass$6([
1021
+ Field(() => GraphQLJSON, { description: "\u0418\u0442\u043E\u0433\u043E\u0432\u0430\u044F \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u044F", nullable: true })
1022
+ ], TransactionDTO.prototype, "transaction", 2);
1023
+ TransactionDTO = __decorateClass$6([
1024
+ ObjectType("Transaction")
1025
+ ], TransactionDTO);
1026
+
1027
+ var ExtensionConfigSuppliedBy = /* @__PURE__ */ ((ExtensionConfigSuppliedBy2) => {
1028
+ ExtensionConfigSuppliedBy2["COOPERATIVE"] = "cooperative";
1029
+ ExtensionConfigSuppliedBy2["PROVIDER"] = "provider";
1030
+ return ExtensionConfigSuppliedBy2;
1031
+ })(ExtensionConfigSuppliedBy || {});
1032
+ const EXTENSION_SECRET_SET = "__secret_set__";
1033
+ const EXTENSION_SECRET_UNSET = "";
1034
+ function readPath(source, path) {
1035
+ return path.split(".").reduce((acc, part) => acc == null ? void 0 : acc[part], source);
1036
+ }
1037
+ function writePath(target, path, value) {
1038
+ const parts = path.split(".");
1039
+ const last = parts.pop();
1040
+ let cursor = target;
1041
+ for (const part of parts) {
1042
+ if (typeof cursor[part] !== "object" || cursor[part] === null)
1043
+ cursor[part] = {};
1044
+ cursor = cursor[part];
1045
+ }
1046
+ cursor[last] = value;
1047
+ }
1048
+ function redactSecretConfig(config, policy) {
1049
+ if (!policy)
1050
+ return config;
1051
+ const secretPaths = Object.keys(policy).filter((path) => policy[path]?.secret);
1052
+ if (secretPaths.length === 0)
1053
+ return config;
1054
+ const copy = structuredClone(config);
1055
+ for (const path of secretPaths) {
1056
+ const value = readPath(copy, path);
1057
+ const isSet = value !== void 0 && value !== null && value !== "";
1058
+ writePath(copy, path, isSet ? EXTENSION_SECRET_SET : EXTENSION_SECRET_UNSET);
1059
+ }
1060
+ return copy;
1061
+ }
1062
+ function mergeSecretConfig(incoming, stored, policy) {
1063
+ if (!policy || !stored)
1064
+ return incoming;
1065
+ const merged = structuredClone(incoming);
1066
+ for (const path of Object.keys(policy)) {
1067
+ if (!policy[path]?.secret)
1068
+ continue;
1069
+ if (readPath(merged, path) !== EXTENSION_SECRET_SET)
1070
+ continue;
1071
+ writePath(merged, path, readPath(stored, path));
1072
+ }
1073
+ return merged;
1074
+ }
1075
+ function providerSuppliedPaths(policy) {
1076
+ if (!policy)
1077
+ return [];
1078
+ return Object.keys(policy).filter((path) => policy[path]?.suppliedBy === "provider" /* PROVIDER */);
1079
+ }
1080
+
1081
+ let settings;
1082
+ function configurePlatformSettings(value) {
1083
+ settings = Object.freeze({ ...value, blockchain: Object.freeze({ ...value.blockchain }) });
1084
+ }
1085
+ function platformSettings() {
1086
+ if (!settings) {
1087
+ throw new Error(
1088
+ "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043A\u043E\u043D\u0442\u0443\u0440\u0430 \u043D\u0435 \u0437\u0430\u0434\u0430\u043D\u044B: composition root \u043E\u0431\u044F\u0437\u0430\u043D \u0432\u044B\u0437\u0432\u0430\u0442\u044C configurePlatformSettings() \u043F\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435"
1089
+ );
1090
+ }
1091
+ return settings;
1092
+ }
1093
+
1094
+ var __defProp$5 = Object.defineProperty;
1095
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1096
+ var __decorateClass$5 = (decorators, target, key, kind) => {
1097
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
1098
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1099
+ if (decorator = decorators[i])
1100
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1101
+ if (kind && result)
1102
+ __defProp$5(target, key, result);
1103
+ return result;
1104
+ };
1105
+ let GeneratedDocumentDTO = class {
1106
+ constructor(data) {
1107
+ if (data) {
1108
+ this.full_title = data.full_title;
1109
+ this.html = data.html;
1110
+ this.hash = data.hash;
1111
+ this.meta = data.meta;
1112
+ this.binary = data.binary;
1113
+ }
1114
+ }
1115
+ };
1116
+ __decorateClass$5([
1117
+ Field(() => String, { description: "\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
1118
+ IsString()
1119
+ ], GeneratedDocumentDTO.prototype, "full_title", 2);
1120
+ __decorateClass$5([
1121
+ Field(() => String, { description: "HTML \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
1122
+ IsString()
1123
+ ], GeneratedDocumentDTO.prototype, "html", 2);
1124
+ __decorateClass$5([
1125
+ Field(() => String, { description: "\u0425\u044D\u0448 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
1126
+ IsString()
1127
+ ], GeneratedDocumentDTO.prototype, "hash", 2);
1128
+ __decorateClass$5([
1129
+ Field(() => GraphQLJSON, { description: "\u041C\u0435\u0442\u0430\u0434\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" })
1130
+ ], GeneratedDocumentDTO.prototype, "meta", 2);
1131
+ __decorateClass$5([
1132
+ Field(() => String, { description: "\u0411\u0438\u043D\u0430\u0440\u043D\u043E\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 (base64)" }),
1133
+ IsObject()
1134
+ ], GeneratedDocumentDTO.prototype, "binary", 2);
1135
+ GeneratedDocumentDTO = __decorateClass$5([
1136
+ ObjectType("GeneratedDocument")
1137
+ ], GeneratedDocumentDTO);
1138
+
1139
+ var __defProp$4 = Object.defineProperty;
1140
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1141
+ var __decorateClass$4 = (decorators, target, key, kind) => {
1142
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
1143
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1144
+ if (decorator = decorators[i])
1145
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1146
+ if (kind && result)
1147
+ __defProp$4(target, key, result);
1148
+ return result;
1149
+ };
1150
+ let GenerateDocumentOptionsInputDTO = class {
1151
+ };
1152
+ __decorateClass$4([
1153
+ Field(() => Boolean, { nullable: true, description: "\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435" })
1154
+ ], GenerateDocumentOptionsInputDTO.prototype, "skip_save", 2);
1155
+ __decorateClass$4([
1156
+ Field(() => String, { nullable: true, description: "\u042F\u0437\u044B\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" })
1157
+ ], GenerateDocumentOptionsInputDTO.prototype, "lang", 2);
1158
+ GenerateDocumentOptionsInputDTO = __decorateClass$4([
1159
+ InputType("GenerateDocumentOptionsInput")
1160
+ ], GenerateDocumentOptionsInputDTO);
1161
+
1162
+ var __defProp$3 = Object.defineProperty;
1163
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
1164
+ var __decorateClass$3 = (decorators, target, key, kind) => {
1165
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
1166
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1167
+ if (decorator = decorators[i])
1168
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1169
+ if (kind && result)
1170
+ __defProp$3(target, key, result);
1171
+ return result;
1172
+ };
1173
+ let GenerateDocumentInputDTO = class extends OmitType(GenerateMetaDocumentInputDTO, ["registry_id"]) {
1174
+ constructor() {
1175
+ super();
1176
+ }
1177
+ };
1178
+ GenerateDocumentInputDTO = __decorateClass$3([
1179
+ InputType("GenerateDocumentInput")
1180
+ ], GenerateDocumentInputDTO);
1181
+
1182
+ var __defProp$2 = Object.defineProperty;
1183
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
1184
+ var __decorateClass$2 = (decorators, target, key, kind) => {
1185
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
1186
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1187
+ if (decorator = decorators[i])
1188
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1189
+ if (kind && result)
1190
+ __defProp$2(target, key, result);
1191
+ return result;
1192
+ };
1193
+ let SignatureInfoDTO = class {
1194
+ };
1195
+ __decorateClass$2([
1196
+ Field(() => Number)
1197
+ ], SignatureInfoDTO.prototype, "id", 2);
1198
+ __decorateClass$2([
1199
+ Field(() => String),
1200
+ IsString()
1201
+ ], SignatureInfoDTO.prototype, "signer", 2);
1202
+ __decorateClass$2([
1203
+ Field(() => String),
1204
+ IsString()
1205
+ ], SignatureInfoDTO.prototype, "public_key", 2);
1206
+ __decorateClass$2([
1207
+ Field(() => String),
1208
+ IsString()
1209
+ ], SignatureInfoDTO.prototype, "signature", 2);
1210
+ __decorateClass$2([
1211
+ Field(() => String),
1212
+ IsString()
1213
+ ], SignatureInfoDTO.prototype, "signed_at", 2);
1214
+ __decorateClass$2([
1215
+ Field(() => String),
1216
+ IsString()
1217
+ ], SignatureInfoDTO.prototype, "signed_hash", 2);
1218
+ __decorateClass$2([
1219
+ Field(() => GraphQLJSON)
1220
+ ], SignatureInfoDTO.prototype, "meta", 2);
1221
+ __decorateClass$2([
1222
+ Field(() => Boolean, { nullable: true })
1223
+ ], SignatureInfoDTO.prototype, "is_valid", 2);
1224
+ SignatureInfoDTO = __decorateClass$2([
1225
+ ObjectType("SignatureInfo")
1226
+ ], SignatureInfoDTO);
1227
+ let SignedDigitalDocumentDTO = class {
1228
+ constructor(data) {
1229
+ this.version = data.version;
1230
+ this.hash = data.hash;
1231
+ this.doc_hash = data.doc_hash;
1232
+ this.meta_hash = data.meta_hash;
1233
+ this.meta = data.meta;
1234
+ this.signatures = data.signatures;
1235
+ }
1236
+ };
1237
+ __decorateClass$2([
1238
+ Field(() => String),
1239
+ IsString()
1240
+ ], SignedDigitalDocumentDTO.prototype, "version", 2);
1241
+ __decorateClass$2([
1242
+ Field(() => String),
1243
+ IsString()
1244
+ ], SignedDigitalDocumentDTO.prototype, "hash", 2);
1245
+ __decorateClass$2([
1246
+ Field(() => String),
1247
+ IsString()
1248
+ ], SignedDigitalDocumentDTO.prototype, "doc_hash", 2);
1249
+ __decorateClass$2([
1250
+ Field(() => String),
1251
+ IsString()
1252
+ ], SignedDigitalDocumentDTO.prototype, "meta_hash", 2);
1253
+ __decorateClass$2([
1254
+ Field(() => GraphQLJSON)
1255
+ ], SignedDigitalDocumentDTO.prototype, "meta", 2);
1256
+ __decorateClass$2([
1257
+ Field(() => [SignatureInfoDTO]),
1258
+ ValidateNested({ each: true })
1259
+ ], SignedDigitalDocumentDTO.prototype, "signatures", 2);
1260
+ SignedDigitalDocumentDTO = __decorateClass$2([
1261
+ ObjectType("SignedDigitalDocument")
1262
+ ], SignedDigitalDocumentDTO);
1263
+
1264
+ var __defProp$1 = Object.defineProperty;
1265
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
1266
+ var __decorateClass$1 = (decorators, target, key, kind) => {
1267
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
1268
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1269
+ if (decorator = decorators[i])
1270
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1271
+ if (kind && result)
1272
+ __defProp$1(target, key, result);
1273
+ return result;
1274
+ };
1275
+ let DocumentAggregateDTO = class {
1276
+ /**
1277
+ * Принимает любой агрегат нужной формы: и доменный из ядра, и результат
1278
+ * `IDocumentPort.buildAggregate`. Номинальной связи с ними нет — каркас не
1279
+ * зависит ни от контроллера, ни от `@coopenomics/innercoop` (INV-007).
1280
+ */
1281
+ constructor(data) {
1282
+ if (data) {
1283
+ this.hash = data.hash;
1284
+ this.document = new SignedDigitalDocumentDTO(data.document);
1285
+ if (data.rawDocument) {
1286
+ this.rawDocument = new GeneratedDocumentDTO(data.rawDocument);
1287
+ }
1288
+ }
1289
+ }
1290
+ };
1291
+ __decorateClass$1([
1292
+ Field(() => String)
1293
+ ], DocumentAggregateDTO.prototype, "hash", 2);
1294
+ __decorateClass$1([
1295
+ Field(() => SignedDigitalDocumentDTO),
1296
+ ValidateNested()
1297
+ ], DocumentAggregateDTO.prototype, "document", 2);
1298
+ __decorateClass$1([
1299
+ Field(() => GeneratedDocumentDTO, { nullable: true })
1300
+ ], DocumentAggregateDTO.prototype, "rawDocument", 2);
1301
+ DocumentAggregateDTO = __decorateClass$1([
1302
+ ObjectType("DocumentAggregate")
1303
+ ], DocumentAggregateDTO);
1304
+
1305
+ class HttpApiError extends HttpException {
1306
+ constructor(statusCode, message, isOperational = true, stack, subcode) {
1307
+ super(message, statusCode);
1308
+ this.isOperational = isOperational;
1309
+ this.subcode = subcode;
1310
+ if (stack) {
1311
+ this.stack = stack;
1312
+ } else {
1313
+ Error.captureStackTrace(this, this.constructor);
1314
+ }
1315
+ }
1316
+ }
1317
+
1318
+ class CurrencyValidationUtil {
1319
+ /**
1320
+ * Проверяет, что сумма содержит правильный символ валюты
1321
+ * @param amount Сумма в формате "число символ" (например, "1000 RUB")
1322
+ * @returns boolean - true если символ валюты правильный
1323
+ */
1324
+ static hasValidCurrencySymbol(amount) {
1325
+ if (!amount || typeof amount !== "string") {
1326
+ return false;
1327
+ }
1328
+ const expectedSymbol = platformSettings().blockchain.rootGovernSymbol;
1329
+ return amount.includes(expectedSymbol);
1330
+ }
1331
+ /**
1332
+ * Валидирует сумму и выбрасывает ошибку, если символ валюты неправильный
1333
+ * @param amount Сумма в формате "число символ" (например, "1000 RUB")
1334
+ * @param fieldName Название поля для сообщения об ошибке (по умолчанию "сумма")
1335
+ * @throws Error если символ валюты неправильный
1336
+ */
1337
+ static validateCurrencySymbol(amount, fieldName = "\u0441\u0443\u043C\u043C\u0430") {
1338
+ if (!this.hasValidCurrencySymbol(amount)) {
1339
+ const expectedSymbol = platformSettings().blockchain.rootGovernSymbol;
1340
+ throw new Error(`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B \u0432\u0430\u043B\u044E\u0442\u044B \u0432 ${fieldName}. \u041E\u0436\u0438\u0434\u0430\u043B\u0441\u044F: ${expectedSymbol}`);
1341
+ }
1342
+ }
1343
+ /**
1344
+ * Извлекает символ валюты из суммы
1345
+ * @param amount Сумма в формате "число символ"
1346
+ * @returns string - символ валюты или пустая строка, если не найден
1347
+ */
1348
+ static extractCurrencySymbol(amount) {
1349
+ if (!amount || typeof amount !== "string") {
1350
+ return "";
1351
+ }
1352
+ const parts = amount.trim().split(" ");
1353
+ return parts.length > 1 ? parts[parts.length - 1] : "";
1354
+ }
1355
+ /**
1356
+ * Извлекает числовое значение из суммы
1357
+ * @param amount Сумма в формате "число символ"
1358
+ * @returns number - числовое значение или NaN, если не удалось распарсить
1359
+ */
1360
+ static extractAmountValue(amount) {
1361
+ if (!amount || typeof amount !== "string") {
1362
+ return NaN;
1363
+ }
1364
+ const parts = amount.trim().split(" ");
1365
+ const numericPart = parts.length > 1 ? parts[0] : amount;
1366
+ return parseFloat(numericPart);
1367
+ }
1368
+ /**
1369
+ * Форматирует сумму с правильным символом валюты
1370
+ * @param value Числовое значение
1371
+ * @param precision Количество знаков после запятой (по умолчанию из конфига)
1372
+ * @returns string - отформатированная сумма
1373
+ */
1374
+ static formatAmount(value, precision) {
1375
+ const actualPrecision = precision ?? config.blockchain.root_govern_precision;
1376
+ const symbol = platformSettings().blockchain.rootGovernSymbol;
1377
+ return `${value.toFixed(actualPrecision)} ${symbol}`;
1378
+ }
1379
+ }
1380
+
1381
+ async function verifySignedDocumentAgainstStoredDraft(loadGeneratedByDocHash, signed, metaVerifications) {
1382
+ const generated = await loadGeneratedByDocHash(signed.doc_hash);
1383
+ if (!generated) {
1384
+ throw new HttpApiError(
1385
+ HttpStatus.BAD_REQUEST,
1386
+ `\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0441 \u0445\u0435\u0448\u0435\u043C ${signed.doc_hash} \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0441\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442.`
1387
+ );
1388
+ }
1389
+ const comparison = await Classes.Document.compareDocuments(signed, generated);
1390
+ if (!comparison.isValid) {
1391
+ const differences = Object.entries(comparison.differences).map(([field, values]) => `${field}: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C "${values.expected}", \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E "${values.actual}"`).join("; ");
1392
+ throw new HttpApiError(
1393
+ HttpStatus.BAD_REQUEST,
1394
+ `\u0421\u0432\u0435\u0440\u043A\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 \u0441 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\u043E\u043C \u043D\u0435 \u043F\u0440\u043E\u0448\u043B\u0430: ${differences}. \u0412\u043E\u0437\u043C\u043E\u0436\u043D\u0430 \u043F\u043E\u0434\u043C\u0435\u043D\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430.`
1395
+ );
1396
+ }
1397
+ if (!metaVerifications || metaVerifications.length === 0) {
1398
+ return;
1399
+ }
1400
+ const meta = signed.meta ?? {};
1401
+ for (const { field, expected, mode } of metaVerifications) {
1402
+ const raw = meta[field];
1403
+ const actualStr = typeof raw === "string" ? raw.trim() : raw !== void 0 && raw !== null ? String(raw).trim() : "";
1404
+ if (!actualStr) {
1405
+ throw new HttpApiError(
1406
+ HttpStatus.BAD_REQUEST,
1407
+ `\u0412 \u043C\u0435\u0442\u0430\u0434\u0430\u043D\u043D\u044B\u0445 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043F\u043E\u043B\u0435 \xAB${field}\xBB, \u0442\u0440\u0435\u0431\u0443\u0435\u043C\u043E\u0435 \u0434\u043B\u044F \u0441\u0432\u0435\u0440\u043A\u0438.`
1408
+ );
1409
+ }
1410
+ const expectedTrimmed = expected.trim();
1411
+ switch (mode) {
1412
+ case "currency_amount": {
1413
+ const parsedExpected = CurrencyValidationUtil.extractAmountValue(expectedTrimmed);
1414
+ const parsedActual = CurrencyValidationUtil.extractAmountValue(actualStr);
1415
+ if (Number.isNaN(parsedExpected) || Number.isNaN(parsedActual)) {
1416
+ throw new HttpApiError(
1417
+ HttpStatus.BAD_REQUEST,
1418
+ `\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u0441\u0443\u043C\u043C\u044B \u0432 \u043F\u043E\u043B\u0435 \xAB${field}\xBB \u0438\u043B\u0438 \u0432 \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u043E\u043C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0438.`
1419
+ );
1420
+ }
1421
+ if (CurrencyValidationUtil.formatAmount(parsedExpected) !== CurrencyValidationUtil.formatAmount(parsedActual)) {
1422
+ throw new HttpApiError(
1423
+ HttpStatus.BAD_REQUEST,
1424
+ `\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E\u043B\u044F \xAB${field}\xBB \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0435 (${actualStr}) \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u044B\u043C (${expectedTrimmed}). \u0412\u043E\u0437\u043C\u043E\u0436\u043D\u0430 \u043F\u043E\u0434\u043C\u0435\u043D\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430.`
1425
+ );
1426
+ }
1427
+ break;
1428
+ }
1429
+ case "string_trim": {
1430
+ if (actualStr !== expectedTrimmed) {
1431
+ throw new HttpApiError(
1432
+ HttpStatus.BAD_REQUEST,
1433
+ `\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E\u043B\u044F \xAB${field}\xBB \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0435 (${actualStr}) \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u044B\u043C (${expectedTrimmed}). \u0412\u043E\u0437\u043C\u043E\u0436\u043D\u0430 \u043F\u043E\u0434\u043C\u0435\u043D\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430.`
1434
+ );
1435
+ }
1436
+ break;
1437
+ }
1438
+ case "hex_case_insensitive": {
1439
+ if (actualStr.toLowerCase() !== expectedTrimmed.toLowerCase()) {
1440
+ throw new HttpApiError(
1441
+ HttpStatus.BAD_REQUEST,
1442
+ `\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E\u043B\u044F \xAB${field}\xBB \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0435 (${actualStr}) \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u044B\u043C (${expectedTrimmed}). \u0412\u043E\u0437\u043C\u043E\u0436\u043D\u0430 \u043F\u043E\u0434\u043C\u0435\u043D\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430.`
1443
+ );
1444
+ }
1445
+ break;
1446
+ }
1447
+ default:
1448
+ throw new HttpApiError(HttpStatus.INTERNAL_SERVER_ERROR, `\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0440\u0435\u0436\u0438\u043C \u0441\u0440\u0430\u0432\u043D\u0435\u043D\u0438\u044F meta: ${String(mode)}`);
1449
+ }
1450
+ }
1451
+ }
1452
+
1453
+ var __defProp = Object.defineProperty;
1454
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1455
+ var __decorateClass = (decorators, target, key, kind) => {
1456
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
1457
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1458
+ if (decorator = decorators[i])
1459
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1460
+ if (kind && result)
1461
+ __defProp(target, key, result);
1462
+ return result;
1463
+ };
1464
+ let DomainToBlockchainUtils = class {
1465
+ /** Доменный подписанный документ → форма для отправки в цепь. */
1466
+ convertSignedDocumentToBlockchainFormat(document) {
1467
+ return {
1468
+ version: document.version,
1469
+ hash: document.hash,
1470
+ doc_hash: document.doc_hash,
1471
+ meta_hash: document.meta_hash,
1472
+ meta: JSON.stringify(document.meta),
1473
+ signatures: document.signatures
1474
+ };
1475
+ }
1476
+ /** Документ из цепи → доменная форма. */
1477
+ convertBlockchainDocumentToDomainFormat(chainDoc) {
1478
+ return DomainToBlockchainUtils.convertChainDocumentToDomainFormat(chainDoc);
1479
+ }
1480
+ /**
1481
+ * Свернуть checksum256 и учётное имя в один uint128-ключ — так составной
1482
+ * индекс задан в контракте (`combine_checksum_ids`), и поиск по таблице
1483
+ * обязан считать ключ ровно так же.
1484
+ */
1485
+ combineChecksumAndUsername(hash, username) {
1486
+ const hashBytes = Buffer.from(hash.replace(/^0x/, ""), "hex");
1487
+ const truncatedHash = hashBytes.readBigUInt64LE(0);
1488
+ const usernameName = Name.from(username);
1489
+ const usernameValue = usernameName.value.value;
1490
+ return BigInt(truncatedHash) << 64n | BigInt(usernameValue.toString());
1491
+ }
1492
+ /** Дата → строка `time_point_sec`, как её принимает цепь. */
1493
+ convertDateToBlockchainFormat(date) {
1494
+ return moment(date).format("YYYY-MM-DDTHH:mm:ss.SSS");
1495
+ }
1496
+ /**
1497
+ * Привести строку `«число символ»` к точности, объявленной для этого символа.
1498
+ *
1499
+ * Символ сверяется с настройками контура намеренно: цепь отвергает asset с
1500
+ * чужой точностью, и поймать это лучше здесь, чем в отказе транзакции.
1501
+ */
1502
+ formatQuantityWithPrecision(quantity) {
1503
+ const parts = quantity.split(" ");
1504
+ if (parts.length !== 2) {
1505
+ throw new Error(`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 quantity: ${quantity}. \u041E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F "\u0447\u0438\u0441\u043B\u043E \u0441\u0438\u043C\u0432\u043E\u043B"`);
1506
+ }
1507
+ const [amount, symbol] = parts;
1508
+ const numericAmount = parseFloat(amount);
1509
+ if (isNaN(numericAmount)) {
1510
+ throw new Error(`\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 quantity: ${amount}`);
1511
+ }
1512
+ const { rootSymbol, rootPrecision, rootGovernSymbol, rootGovernPrecision } = platformSettings().blockchain;
1513
+ let precision;
1514
+ if (symbol === rootSymbol) {
1515
+ precision = rootPrecision;
1516
+ } else if (symbol === rootGovernSymbol) {
1517
+ precision = rootGovernPrecision;
1518
+ } else {
1519
+ throw new Error(`\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B: ${symbol}. \u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E: ${rootSymbol}, ${rootGovernSymbol}`);
1520
+ }
1521
+ return `${numericAmount.toFixed(precision)} ${symbol}`;
1522
+ }
1523
+ /** Числовая строка + точность + символ → asset-строка цепи. */
1524
+ formatNumericStringToAssetString(numericString, precision, symbol) {
1525
+ const numericValue = parseFloat(numericString);
1526
+ if (isNaN(numericValue)) {
1527
+ throw new Error(`\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: ${numericString}`);
1528
+ }
1529
+ if (numericValue < 0) {
1530
+ throw new Error(`\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u043C: ${numericString}`);
1531
+ }
1532
+ return `${numericValue.toFixed(precision)} ${symbol}`;
1533
+ }
1534
+ static convertChainDocumentToSignedDocument2(chainDoc) {
1535
+ return DomainToBlockchainUtils.convertChainDocumentToDomainFormat(chainDoc);
1536
+ }
1537
+ /**
1538
+ * Документ из цепи → доменная форма.
1539
+ *
1540
+ * `meta` в цепи хранится строкой JSON, а пустая строка означает «мета нет»:
1541
+ * `JSON.parse('')` на ней бросил бы.
1542
+ */
1543
+ static convertChainDocumentToDomainFormat(chainDoc) {
1544
+ return {
1545
+ version: chainDoc.version,
1546
+ hash: chainDoc.hash,
1547
+ doc_hash: chainDoc.doc_hash,
1548
+ meta_hash: chainDoc.meta_hash,
1549
+ meta: typeof chainDoc.meta === "string" ? chainDoc.meta === "" ? {} : JSON.parse(chainDoc.meta) : chainDoc.meta,
1550
+ signatures: chainDoc.signatures
1551
+ };
1552
+ }
1553
+ static getEmptyHash() {
1554
+ return "0000000000000000000000000000000000000000000000000000000000000000";
1555
+ }
1556
+ };
1557
+ DomainToBlockchainUtils = __decorateClass([
1558
+ Injectable()
1559
+ ], DomainToBlockchainUtils);
1560
+
1561
+ class AssetUtils {
1562
+ /**
1563
+ * Парсит строку ассета и возвращает числовое значение и символ
1564
+ * @param asset Строка формата "100.0000 RUB"
1565
+ * @returns { amount: number, symbol: string } или { amount: 0, symbol: '' } если парсинг не удался
1566
+ */
1567
+ static parseAsset(asset) {
1568
+ if (!asset || typeof asset !== "string") {
1569
+ return { amount: 0, symbol: "" };
1570
+ }
1571
+ const trimmed = asset.trim();
1572
+ const match = trimmed.match(/^(\d+\.?\d*)\s+([A-Z]+)$/);
1573
+ if (!match) {
1574
+ return { amount: 0, symbol: "" };
1575
+ }
1576
+ return {
1577
+ amount: parseFloat(match[1]),
1578
+ symbol: match[2]
1579
+ };
1580
+ }
1581
+ /**
1582
+ * Форматирует числовое значение и символ обратно в строку ассета
1583
+ * @param amount Числовое значение
1584
+ * @param symbol Символ валюты
1585
+ * @param precision Количество знаков после запятой (по умолчанию 4)
1586
+ * @returns Строка формата "100.0000 RUB"
1587
+ */
1588
+ static formatAsset(amount, symbol, precision = 4) {
1589
+ if (!symbol) {
1590
+ return "0.0000";
1591
+ }
1592
+ return `${amount.toFixed(precision)} ${symbol}`;
1593
+ }
1594
+ /**
1595
+ * Складывает два ассета
1596
+ * @param asset1 Первый ассет в формате "100.0000 RUB"
1597
+ * @param asset2 Второй ассет в формате "50.0000 RUB"
1598
+ * @returns Результат сложения в формате "150.0000 RUB"
1599
+ * @throws Error если символы валют не совпадают
1600
+ */
1601
+ static addAssets(asset1, asset2) {
1602
+ const parsed1 = this.parseAsset(asset1);
1603
+ const parsed2 = this.parseAsset(asset2);
1604
+ if (!parsed1.symbol && !parsed2.symbol) {
1605
+ return "0.0000";
1606
+ }
1607
+ if (!parsed1.symbol) {
1608
+ return asset2 || "0.0000";
1609
+ }
1610
+ if (!parsed2.symbol) {
1611
+ return asset1 || "0.0000";
1612
+ }
1613
+ if (parsed1.symbol !== parsed2.symbol) {
1614
+ throw new Error(
1615
+ `Cannot add assets with different symbols: ${parsed1.symbol} and ${parsed2.symbol}`
1616
+ );
1617
+ }
1618
+ const sum = parsed1.amount + parsed2.amount;
1619
+ return this.formatAsset(sum, parsed1.symbol);
1620
+ }
1621
+ /**
1622
+ * Складывает массив ассетов
1623
+ * @param assets Массив ассетов в формате "100.0000 RUB"
1624
+ * @returns Результат сложения в формате "150.0000 RUB"
1625
+ * @throws Error если символы валют не совпадают
1626
+ */
1627
+ static sumAssets(assets) {
1628
+ if (!assets || assets.length === 0) {
1629
+ return "0.0000";
1630
+ }
1631
+ return assets.reduce((acc, asset) => {
1632
+ return this.addAssets(acc, asset);
1633
+ }, "0.0000");
1634
+ }
1635
+ }
1636
+
1637
+ class AmountFormatterUtils {
1638
+ /**
1639
+ * Форматирует сумму в читаемый формат.
1640
+ * @param amountStr Строка «число» или «число валюта»
1641
+ * (например, «1000.0000», «1000.0000 RUB»)
1642
+ * @returns «1 000,00» или «1 000,00 RUB»
1643
+ * @throws Error если формат некорректный
1644
+ */
1645
+ static formatAmount(amountStr) {
1646
+ if (!amountStr || typeof amountStr !== "string") {
1647
+ throw new Error(`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u0441\u0443\u043C\u043C\u044B: ${amountStr}. \u041E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F "\u0447\u0438\u0441\u043B\u043E" \u0438\u043B\u0438 "\u0447\u0438\u0441\u043B\u043E \u0432\u0430\u043B\u044E\u0442\u0430"`);
1648
+ }
1649
+ const parts = amountStr.trim().split(/\s+/);
1650
+ if (parts.length < 1 || !parts[0]) {
1651
+ throw new Error(`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u0441\u0443\u043C\u043C\u044B: ${amountStr}. \u041E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F "\u0447\u0438\u0441\u043B\u043E" \u0438\u043B\u0438 "\u0447\u0438\u0441\u043B\u043E \u0432\u0430\u043B\u044E\u0442\u0430"`);
1652
+ }
1653
+ const amountPart = parts[0].replace(",", ".");
1654
+ const currency = parts.length >= 2 ? parts.slice(1).join(" ") : "";
1655
+ const amount = parseFloat(amountPart);
1656
+ if (isNaN(amount)) {
1657
+ throw new Error(`\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 \u0441\u0443\u043C\u043C\u0435: ${parts[0]}`);
1658
+ }
1659
+ const formattedAmount = amount.toLocaleString("ru-RU", {
1660
+ minimumFractionDigits: 2,
1661
+ maximumFractionDigits: 2
1662
+ });
1663
+ return currency ? `${formattedAmount} ${currency}` : formattedAmount;
1664
+ }
1665
+ /**
1666
+ * То же, что {@link formatAmount}, но без throw: при сбое возвращает
1667
+ * исходную строку. Для non-blocking путей (уведомления), где ошибка
1668
+ * форматирования не должна рвать доставку.
1669
+ */
1670
+ static formatAmountSafe(amountStr) {
1671
+ if (amountStr == null || amountStr === "") {
1672
+ return "";
1673
+ }
1674
+ try {
1675
+ return this.formatAmount(amountStr);
1676
+ } catch {
1677
+ return amountStr;
1678
+ }
1679
+ }
1680
+ }
1681
+
1682
+ const EMPTY_HASH = "0000000000000000000000000000000000000000000000000000000000000000";
1683
+ const DEFAULT_DOCUMENT_VERSION = "1.0.0";
1684
+
1685
+ function getAmountPlusFee(amount, fee) {
1686
+ if (fee < 0 || fee >= 100) {
1687
+ throw new Error("Fee must be between 0 and 100.");
1688
+ }
1689
+ return amount / ((100 - fee) / 100);
1690
+ }
1691
+ function checkPaymentSymbol(incomeSymbol, extectedSymbol) {
1692
+ if (incomeSymbol != extectedSymbol)
1693
+ return { status: "error", message: `${incomeSymbol} != expectedSymbol` };
1694
+ else
1695
+ return { status: "success", message: "" };
1696
+ }
1697
+ function checkPaymentAmount(incomeAmount, expectedAmount, tolerancePercentage) {
1698
+ const tolerance = expectedAmount * (tolerancePercentage / 100);
1699
+ if (incomeAmount < expectedAmount - tolerance) {
1700
+ return {
1701
+ status: "error",
1702
+ message: `\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u0441\u0440\u0435\u0434\u0441\u0442\u0432, \u043F\u043E\u0441\u0442\u0443\u043F\u0438\u043B\u043E: ${incomeAmount}, \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F: ${expectedAmount}`
1703
+ };
1704
+ }
1705
+ return {
1706
+ status: "success",
1707
+ message: ""
1708
+ };
1709
+ }
1710
+
1711
+ class QuantityUtils {
1712
+ /**
1713
+ * Проверяет, поддерживается ли символ системой
1714
+ * @param symbol Символ для проверки
1715
+ * @returns true если символ поддерживается
1716
+ */
1717
+ static isSupportedSymbol(symbol) {
1718
+ const { rootSymbol, rootGovernSymbol } = platformSettings().blockchain;
1719
+ return symbol === rootSymbol || symbol === rootGovernSymbol;
1720
+ }
1721
+ /**
1722
+ * Получает precision для конкретного символа
1723
+ * @param symbol Символ валюты
1724
+ * @returns Precision для символа
1725
+ */
1726
+ static getPrecisionForSymbol(symbol) {
1727
+ const { rootSymbol, rootPrecision, rootGovernSymbol, rootGovernPrecision } = platformSettings().blockchain;
1728
+ if (symbol === rootSymbol) {
1729
+ return rootPrecision;
1730
+ } else if (symbol === rootGovernSymbol) {
1731
+ return rootGovernPrecision;
1732
+ } else {
1733
+ throw new Error(`\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B: ${symbol}. \u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E: ${rootSymbol}, ${rootGovernSymbol}`);
1734
+ }
1735
+ }
1736
+ /**
1737
+ * Валидирует символ и выбрасывает ошибку если не поддерживается
1738
+ * @param symbol Символ для валидации
1739
+ */
1740
+ static validateSymbol(symbol) {
1741
+ if (!this.isSupportedSymbol(symbol)) {
1742
+ const { rootSymbol, rootGovernSymbol } = platformSettings().blockchain;
1743
+ throw new Error(`\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B: ${symbol}. \u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E: ${rootSymbol}, ${rootGovernSymbol}`);
1744
+ }
1745
+ }
1746
+ /**
1747
+ * Форматирует количество с символом для блокчейна
1748
+ * @param amount Числовое значение
1749
+ * @param symbol Символ валюты
1750
+ * @returns Отформатированная строка quantity для блокчейна
1751
+ */
1752
+ static formatQuantityForBlockchain(amount, symbol) {
1753
+ this.validateSymbol(symbol);
1754
+ if (isNaN(amount) || amount < 0) {
1755
+ throw new Error(`\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: ${amount}`);
1756
+ }
1757
+ const precision = this.getPrecisionForSymbol(symbol);
1758
+ const formattedAmount = amount.toFixed(precision);
1759
+ return `${formattedAmount} ${symbol}`;
1760
+ }
1761
+ /**
1762
+ * Форматирует количество с символом из числа и строки символа в единую строку
1763
+ * @param amount Числовое значение
1764
+ * @param symbol Символ валюты
1765
+ * @returns Строка в формате "число символ"
1766
+ */
1767
+ static combineQuantityAndSymbol(amount, symbol) {
1768
+ this.validateSymbol(symbol);
1769
+ if (isNaN(amount) || amount < 0) {
1770
+ throw new Error(`\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: ${amount}`);
1771
+ }
1772
+ return `${amount} ${symbol}`;
1773
+ }
1774
+ /**
1775
+ * Парсит строку quantity в число и символ
1776
+ * @param quantity Строка в формате "число символ"
1777
+ * @returns Объект с числом и символом
1778
+ */
1779
+ static parseQuantityString(quantity) {
1780
+ const parts = quantity.split(" ");
1781
+ if (parts.length !== 2) {
1782
+ throw new Error(`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 quantity: ${quantity}. \u041E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F "\u0447\u0438\u0441\u043B\u043E \u0441\u0438\u043C\u0432\u043E\u043B"`);
1783
+ }
1784
+ const [amountStr, symbol] = parts;
1785
+ const amount = parseFloat(amountStr);
1786
+ if (isNaN(amount)) {
1787
+ throw new Error(`\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 quantity: ${amountStr}`);
1788
+ }
1789
+ this.validateSymbol(symbol);
1790
+ return { amount, symbol };
1791
+ }
1792
+ }
1793
+
1794
+ class DateUtils {
1795
+ /**
1796
+ * Преобразует UTC дату в локальную дату согласно временной зоне из конфигурации
1797
+ */
1798
+ static convertUtcToLocalTime(date) {
1799
+ return moment$1.utc(date).tz(platformSettings().timezone).toDate();
1800
+ }
1801
+ /**
1802
+ * Форматирует дату в локальном формате с учетом временной зоны
1803
+ */
1804
+ static formatLocalDate(date, format = "DD.MM.YYYY") {
1805
+ return moment$1.utc(date).tz(platformSettings().timezone).format(format);
1806
+ }
1807
+ /**
1808
+ * Форматирует время в локальном формате с учетом временной зоны
1809
+ */
1810
+ static formatLocalTime(date, format = "HH:mm") {
1811
+ return moment$1.utc(date).tz(platformSettings().timezone).format(format);
1812
+ }
1813
+ /**
1814
+ * Форматирует дату в локальном формате (дд.мм.гггг)
1815
+ */
1816
+ static formatLocalDateWithoutTimezone(dateString) {
1817
+ const date = new Date(dateString);
1818
+ return date.toLocaleDateString("ru-RU", { day: "2-digit", month: "2-digit", year: "numeric" });
1819
+ }
1820
+ /**
1821
+ * Форматирует время в локальном формате (чч:мм)
1822
+ */
1823
+ static formatLocalTimeWithoutTimezone(dateString) {
1824
+ const date = new Date(dateString);
1825
+ return date.toLocaleTimeString("ru-RU", { hour: "2-digit", minute: "2-digit" });
1826
+ }
1827
+ /**
1828
+ * Определяет, наступило ли уже указанное время с учетом временной зоны
1829
+ */
1830
+ static isTimeReached(targetDate) {
1831
+ const now = moment$1();
1832
+ const target = moment$1.utc(targetDate).tz(platformSettings().timezone);
1833
+ return now.isAfter(target) || now.isSame(target);
1834
+ }
1835
+ /**
1836
+ * Вычисляет дату за указанное количество дней до целевой даты
1837
+ */
1838
+ static getDaysBeforeDate(targetDate, days) {
1839
+ return moment$1.utc(targetDate).tz(platformSettings().timezone).subtract(days, "days").toDate();
1840
+ }
1841
+ /**
1842
+ * Форматирует разницу во времени в человекочитаемый вид на русском языке (например, 'через 3 дня')
1843
+ */
1844
+ static formatDurationHumanizeRu(minutes) {
1845
+ moment$1.locale("ru");
1846
+ return moment$1.duration({ minutes }).humanize(true);
1847
+ }
1848
+ }
1849
+
1850
+ async function waitAfterTransactBeforeChainTableRead() {
1851
+ const ms = platformSettings().blockchain.postTransactChainReadDelayMs;
1852
+ if (typeof ms !== "number" || !Number.isFinite(ms) || ms <= 0) {
1853
+ return;
1854
+ }
1855
+ await new Promise((resolve) => {
1856
+ setTimeout(resolve, ms);
1857
+ });
1858
+ }
1859
+
1860
+ function getAppliedBlockNum(transactResult) {
1861
+ const processed = transactResult?.response?.processed;
1862
+ const blockNum = Number(processed?.block_num);
1863
+ return Number.isFinite(blockNum) && blockNum > 0 ? blockNum : 0;
1864
+ }
1865
+
1866
+ function generateUniqueHash() {
1867
+ const timestamp = Date.now();
1868
+ const randomValue = Math.random().toString();
1869
+ return crypto.createHash("sha256").update(`${timestamp}-${randomValue}`).digest("hex");
1870
+ }
1871
+ function generateRandomHash() {
1872
+ return generateUniqueHash();
1873
+ }
1874
+ function generateHashFromString(input) {
1875
+ return crypto.createHash("sha256").update(input).digest("hex");
1876
+ }
1877
+
1878
+ function rethrowChainError(error) {
1879
+ const raw = error?.message ?? String(error);
1880
+ const match = raw.match(/assertion failure with message: (.+?)(?:\n|$)/);
1881
+ const clean = match ? match[1].trim() : raw;
1882
+ throw new BadRequestException(clean);
1883
+ }
1884
+
1885
+ export { ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, AuthRoles, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DateUtils, DocumentAggregateDTO, DomainToBlockchainUtils, EMPTY_HASH, EXTENSION_APP_TERMINATE_EVENT, EXTENSION_REPOSITORY, EXTENSION_SECRET_SET, EXTENSION_SECRET_UNSET, ExpenseProposalStatementGenerateDocumentInputDTO, ExpenseProposalStatementSignedDocumentInputDTO, ExpenseProposalStatementSignedMetaDocumentInputDTO, ExtensionAvailability, ExtensionConfigSuppliedBy, ExtensionDomainEntity, GenerateDocumentInputDTO, GenerateDocumentOptionsInputDTO, GenerateMetaDocumentInputDTO, GeneratedDocumentDTO, GqlJwtAuthGuard, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, LangType, LogExtensionDomainEntity, MetaDocumentInputDTO, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginationInputDTO, PaginationResult, PaginationUtils, PaymentProvider, PollingProvider, QuantityUtils, RolesGuard, SignatureInfoDTO, SignatureInfoInputDTO, SignedDigitalDocumentDTO, SignedDigitalDocumentInputDTO, TransactionDTO, UseBucket, bucketProvidersFor, bucketTokenFor, buildPaginationResult, checkPaymentAmount, checkPaymentSymbol, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, createPaginationResult, extensionEntities, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, isExtensionAvailable, mergeSecretConfig, paginationInputToOffset, platformSettings, providerSuppliedPaths, redactSecretConfig, registerExtensionEntities, resetExtensionEntities, rethrowChainError, verifySignedDocumentAgainstStoredDraft, waitAfterTransactBeforeChainTableRead };