@coopenomics/extension-kit 2026.9.24-3 → 2026.10.11

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 CHANGED
@@ -1,13 +1,16 @@
1
- import { HttpException, HttpStatus, BadGatewayException, ServiceUnavailableException, BadRequestException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, UnprocessableEntityException, InternalServerErrorException, createParamDecorator, SetMetadata, applyDecorators, Injectable, Inject } from '@nestjs/common';
1
+ import { HttpException, HttpStatus, BadGatewayException, ServiceUnavailableException, BadRequestException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, UnprocessableEntityException, InternalServerErrorException, createParamDecorator, Injectable, SetMetadata, Inject, Logger } from '@nestjs/common';
2
2
  import { GqlExecutionContext, Directive, Field, InputType, registerEnumType, Int, IntersectionType, OmitType, ObjectType } from '@nestjs/graphql';
3
3
  import { te, t } from '@coopenomics/i18n/server';
4
- import { Reflector } from '@nestjs/core';
5
4
  import { AuthGuard } from '@nestjs/passport';
6
5
  import { timingSafeEqual } from 'node:crypto';
6
+ import { createMongoAbility, subject } from '@casl/ability';
7
+ import { Reflector } from '@nestjs/core';
7
8
  import { z } from 'zod';
8
- import { IsNumber, IsString, IsArray, ArrayMinSize, ValidateNested, IsEnum, IsInt, IsOptional, Matches, IsNotEmpty, IsObject } from 'class-validator';
9
+ import { IsNumber, IsString, IsArray, ArrayMinSize, ValidateNested, IsEnum, IsInt, IsOptional, Matches, IsNotEmpty, IsIn, MaxLength, IsDate, Min, Max, IsObject, registerDecorator } from 'class-validator';
9
10
  import { Type } from 'class-transformer';
10
- import { GraphQLJSON } from 'graphql-type-json';
11
+ import GraphQLJSON$1, { GraphQLJSON } from 'graphql-type-json';
12
+ import { o as oneOf } from './shared/extension-kit.d5437cba.mjs';
13
+ export { K as KYSELY, M as MAIN_DATABASE, S as SqlBuilder, T as TableStore, d as affectedCount, t as bindNamed, c as camelRow, k as configureLocalChangePublisher, j as contains, h as ilike, q as inTransaction, i as isNull, f as lessOrEqual, l as lessThan, g as moreOrEqual, m as moreThan, e as notEqual, n as notNull, p as pendingLocalChanges, r as rawQuery, b as snakeRow, s as sortColumn, a as sortDirection, w as within } from './shared/extension-kit.d5437cba.mjs';
11
14
  import { Classes } from '@coopenomics/sdk';
12
15
  import { Name } from '@wharfkit/antelope';
13
16
  import moment from 'moment';
@@ -15,6 +18,8 @@ import crypto, { createHash } from 'crypto';
15
18
  import moment$1 from 'moment-timezone';
16
19
  import 'moment/locale/ru';
17
20
  import { _Common } from 'cooptypes';
21
+ import 'kysely';
22
+ import 'node:async_hooks';
18
23
 
19
24
  const DOMAIN_ERROR = Symbol.for("@coopenomics/extension-kit/DomainError");
20
25
  function domainErrorMessage(code, params = {}) {
@@ -160,17 +165,9 @@ function validationMessage(key, params = {}) {
160
165
  return (args) => t(key, { property: args.property, value: String(args.value ?? ""), ...params });
161
166
  }
162
167
 
163
- const ROLES_DENY_SELF_KEY = "roles_deny_self";
164
- const ROLES_ANY_STATUS_KEY = "roles_any_status";
165
- function AuthRoles(roles, options = {}) {
166
- const self = options.self ?? [];
167
- const args = self.length ? `roles: ${JSON.stringify(roles)}, self: ${JSON.stringify(self)}` : `roles: ${JSON.stringify(roles)}`;
168
- const decorators = [SetMetadata("roles", roles), Directive(`@auth(${args})`)];
169
- if (options.allowSelf === false)
170
- decorators.push(SetMetadata(ROLES_DENY_SELF_KEY, true));
171
- if (options.anyStatus === true)
172
- decorators.push(SetMetadata(ROLES_ANY_STATUS_KEY, true));
173
- return applyDecorators(...decorators);
168
+ function CouncilField(self = []) {
169
+ const council = 'roles: ["chairman", "member"]';
170
+ return Directive(`@auth(${self.length ? `${council}, self: ${JSON.stringify(self)}` : council})`);
174
171
  }
175
172
  const CurrentUser = createParamDecorator((data, context) => {
176
173
  const ctx = GqlExecutionContext.create(context);
@@ -202,20 +199,18 @@ function hasServerSecret(headers) {
202
199
  return a.length === b.length && timingSafeEqual(a, b);
203
200
  }
204
201
 
205
- var __defProp$g = Object.defineProperty;
206
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
207
- var __decorateClass$g = (decorators, target, key, kind) => {
208
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
202
+ var __defProp$q = Object.defineProperty;
203
+ var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
204
+ var __decorateClass$q = (decorators, target, key, kind) => {
205
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
209
206
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
210
207
  if (decorator = decorators[i])
211
208
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
212
209
  if (kind && result)
213
- __defProp$g(target, key, result);
210
+ __defProp$q(target, key, result);
214
211
  return result;
215
212
  };
216
- var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
217
213
  const ACTIVE_USER_STATUS = "active";
218
- const PARTICIPANT_ROLE = "user";
219
214
  let GqlJwtAuthGuard = class extends AuthGuard("jwt") {
220
215
  getRequest(context) {
221
216
  const ctx = GqlExecutionContext.create(context);
@@ -237,7 +232,7 @@ let GqlJwtAuthGuard = class extends AuthGuard("jwt") {
237
232
  return super.canActivate(context);
238
233
  }
239
234
  };
240
- GqlJwtAuthGuard = __decorateClass$g([
235
+ GqlJwtAuthGuard = __decorateClass$q([
241
236
  Injectable()
242
237
  ], GqlJwtAuthGuard);
243
238
  function hasAuthorizationHeader(headers) {
@@ -262,7 +257,7 @@ let OptionalGqlJwtAuthGuard = class extends AuthGuard("jwt") {
262
257
  throw DomainError.unauthorized("KIT_SESSION_ENDED");
263
258
  }
264
259
  };
265
- OptionalGqlJwtAuthGuard = __decorateClass$g([
260
+ OptionalGqlJwtAuthGuard = __decorateClass$q([
266
261
  Injectable()
267
262
  ], OptionalGqlJwtAuthGuard);
268
263
  let HttpJwtAuthGuard = class extends AuthGuard("jwt") {
@@ -277,49 +272,9 @@ let HttpJwtAuthGuard = class extends AuthGuard("jwt") {
277
272
  return super.canActivate(context);
278
273
  }
279
274
  };
280
- HttpJwtAuthGuard = __decorateClass$g([
275
+ HttpJwtAuthGuard = __decorateClass$q([
281
276
  Injectable()
282
277
  ], HttpJwtAuthGuard);
283
- let RolesGuard = class {
284
- // Токен указан явно: пакет собирается esbuild'ом, а он не умеет
285
- // `emitDecoratorMetadata`. Без `@Inject` Nest не увидел бы `design:paramtypes`,
286
- // построил бы гард без аргументов, и `reflector` оказался бы `undefined` —
287
- // отказ приходил бы не отказом, а 500 на первом же запросе с ролями.
288
- constructor(reflector) {
289
- this.reflector = reflector;
290
- }
291
- canActivate(context) {
292
- const ctx = GqlExecutionContext.create(context);
293
- const request = ctx.getContext().req;
294
- if (hasServerSecret(request?.headers)) {
295
- return true;
296
- }
297
- const allowedRoles = this.reflector.get("roles", context.getHandler());
298
- if (!allowedRoles) {
299
- return true;
300
- }
301
- const { user } = request;
302
- const args = ctx.getArgs();
303
- const data = args.data;
304
- const filter = args.filter;
305
- const denySelf = this.reflector.get(ROLES_DENY_SELF_KEY, context.getHandler()) === true;
306
- if (!denySelf && (data && data.username && user.username === data.username || filter && filter.username && user.username === filter.username || args.username && user.username === args.username)) {
307
- return true;
308
- }
309
- if (allowedRoles.includes(user.role)) {
310
- const anyStatus = this.reflector.get(ROLES_ANY_STATUS_KEY, context.getHandler()) === true;
311
- if (user.role === PARTICIPANT_ROLE && !anyStatus && user.status !== ACTIVE_USER_STATUS) {
312
- throw DomainError.forbidden("KIT_MEMBERS_ONLY");
313
- }
314
- return true;
315
- }
316
- throw DomainError.unauthorized("KIT_INSUFFICIENT_RIGHTS");
317
- }
318
- };
319
- RolesGuard = __decorateClass$g([
320
- Injectable(),
321
- __decorateParam(0, Inject(Reflector))
322
- ], RolesGuard);
323
278
  let ActiveUserStatusGuard = class {
324
279
  canActivate(context) {
325
280
  const ctx = GqlExecutionContext.create(context);
@@ -337,19 +292,380 @@ let ActiveUserStatusGuard = class {
337
292
  return true;
338
293
  }
339
294
  };
340
- ActiveUserStatusGuard = __decorateClass$g([
295
+ ActiveUserStatusGuard = __decorateClass$q([
341
296
  Injectable()
342
297
  ], ActiveUserStatusGuard);
343
298
 
344
- var __defProp$f = Object.defineProperty;
345
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
346
- var __decorateClass$f = (decorators, target, key, kind) => {
347
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
299
+ const NARROW_SCOPES = /* @__PURE__ */ new Set(["own", "own-KU", "chaired-KU", "to-self"]);
300
+ function rightMatches(actions, action) {
301
+ if (actions.includes(action))
302
+ return true;
303
+ const colon = action.lastIndexOf(":");
304
+ if (colon > 0 && NARROW_SCOPES.has(action.slice(colon + 1))) {
305
+ return actions.includes(`${action.slice(0, colon)}:all`);
306
+ }
307
+ return false;
308
+ }
309
+ function rightConditions(table, roles, resource, action) {
310
+ const out = [];
311
+ for (const role of roles) {
312
+ for (const group of table[role] ?? []) {
313
+ const actions = group.rights[resource];
314
+ if (actions && rightMatches(actions, action))
315
+ out.push(group.when);
316
+ }
317
+ }
318
+ return out;
319
+ }
320
+ function rightGrants(table, roles, resource, action) {
321
+ const out = [];
322
+ for (const role of roles) {
323
+ for (const group of table[role] ?? []) {
324
+ const actions = group.rights[resource];
325
+ if (!actions)
326
+ continue;
327
+ if (!rightMatches(actions, action))
328
+ continue;
329
+ const colon = action.lastIndexOf(":");
330
+ const narrow = colon > 0 && NARROW_SCOPES.has(action.slice(colon + 1));
331
+ out.push({ when: group.when, wide: narrow && actions.includes(`${action.slice(0, colon)}:all`) });
332
+ }
333
+ }
334
+ return out;
335
+ }
336
+ function rightsHeld(table, roles, held) {
337
+ const set = /* @__PURE__ */ new Set();
338
+ for (const role of roles) {
339
+ for (const group of table[role] ?? []) {
340
+ if (!group.when.every((condition) => held.has(condition)))
341
+ continue;
342
+ for (const [resource, actions] of Object.entries(group.rights)) {
343
+ for (const action of actions)
344
+ set.add(`${resource}:${action}`);
345
+ }
346
+ }
347
+ }
348
+ return [...set];
349
+ }
350
+ function rightsByRole(table) {
351
+ const out = {};
352
+ for (const role of Object.keys(table)) {
353
+ const merged = {};
354
+ for (const group of table[role]) {
355
+ for (const [resource, actions] of Object.entries(group.rights)) {
356
+ merged[resource] = [...merged[resource] ?? [], ...actions];
357
+ }
358
+ }
359
+ out[role] = merged;
360
+ }
361
+ return out;
362
+ }
363
+ function expandRights(rights) {
364
+ const set = /* @__PURE__ */ new Set();
365
+ for (const right of rights) {
366
+ set.add(right);
367
+ const colon = right.lastIndexOf(":");
368
+ if (colon > 0 && right.slice(colon + 1) === "all") {
369
+ for (const scope of NARROW_SCOPES)
370
+ set.add(`${right.slice(0, colon)}:${scope}`);
371
+ }
372
+ }
373
+ return [...set];
374
+ }
375
+ const RIGHT_METADATA_KEY = "required_right";
376
+ const SELF = { self: true };
377
+ const RequireRight = (resource, action, source) => SetMetadata(RIGHT_METADATA_KEY, { resource, action, source });
378
+ function scopeOfRight(resource, action, implied = {}) {
379
+ const colon = action.lastIndexOf(":");
380
+ const tail = colon > 0 ? action.slice(colon + 1) : "";
381
+ if (tail === "all" || NARROW_SCOPES.has(tail))
382
+ return tail;
383
+ return implied[`${resource}:${action}`] ?? null;
384
+ }
385
+ function scopeConditions(scope, actor) {
386
+ switch (scope) {
387
+ case "own":
388
+ return { owner: actor.username };
389
+ case "to-self":
390
+ return { recipient: actor.username };
391
+ case "own-KU":
392
+ return { ku: { $in: [...actor.kus] } };
393
+ case "chaired-KU":
394
+ return { ku: { $in: [...actor.chairedKus] } };
395
+ }
396
+ }
397
+ function scopesMatched(resource, scopes, actor, facts) {
398
+ return scopes.filter((scope) => {
399
+ const ability = createMongoAbility([{ action: "act", subject: resource, conditions: scopeConditions(scope, actor) }]);
400
+ return ability.can("act", subject(resource, { ...facts }));
401
+ });
402
+ }
403
+ const SCOPE_DENIALS = {
404
+ own: "KIT_RIGHT_SCOPE_OWN",
405
+ "own-KU": "KIT_RIGHT_SCOPE_OWN_KU",
406
+ "chaired-KU": "KIT_RIGHT_SCOPE_CHAIRED_KU",
407
+ "to-self": "KIT_RIGHT_SCOPE_TO_SELF"
408
+ };
409
+ function readPath$1(args, path) {
410
+ let value = args;
411
+ for (const key of path.split(".")) {
412
+ if (value === null || typeof value !== "object")
413
+ return void 0;
414
+ value = value[key];
415
+ }
416
+ return value;
417
+ }
418
+ function unique(items) {
419
+ return [...new Set(items)];
420
+ }
421
+ async function checkRightScope(input) {
422
+ const sources = Array.isArray(input.source) ? input.source : [input.source];
423
+ let merged;
424
+ for (const source of sources) {
425
+ const one = await checkScopeOfSource(input, source);
426
+ if (!one.allowed)
427
+ return one;
428
+ merged = merged ? { scopes: unique([...merged.scopes, ...one.scope.scopes]), kus: one.scope.kus !== void 0 ? one.scope.kus : merged.kus } : one.scope;
429
+ }
430
+ return { allowed: true, scope: merged ?? { scopes: [] } };
431
+ }
432
+ async function checkScopeOfSource(input, source) {
433
+ const { resource, args } = input;
434
+ const scopes = unique(
435
+ input.granted.map((grant) => grant.wide ? "all" : scopeOfRight(resource, grant.action, input.implied)).filter(
436
+ (scope) => scope !== null
437
+ )
438
+ );
439
+ const wide = scopes.includes("all") || input.granted.some((grant) => !grant.wide && scopeOfRight(resource, grant.action, input.implied) === null);
440
+ const narrow = scopes.filter((scope) => scope !== "all");
441
+ const pass = (scope) => ({ allowed: true, scope });
442
+ const deny = (scope = narrow[0]) => ({ allowed: false, denial: SCOPE_DENIALS[scope], scope: { scopes: [] } });
443
+ if (!source || "self" in source)
444
+ return pass({ scopes });
445
+ const actor = async () => ({
446
+ username: input.username,
447
+ kus: narrow.includes("own-KU") ? await input.kus() : [],
448
+ chairedKus: narrow.includes("chaired-KU") ? await input.chairedKus() : []
449
+ });
450
+ if ("list" in source) {
451
+ const value = source.list === null ? null : readPath$1(args, source.list);
452
+ const requested = value === void 0 || value === null || value === "" ? null : String(value);
453
+ if (wide)
454
+ return pass({ scopes, kus: requested ? [requested] : null });
455
+ const kuScope = narrow.find((scope) => scope === "own-KU" || scope === "chaired-KU");
456
+ if (!kuScope)
457
+ return pass({ scopes });
458
+ const { kus, chairedKus } = await actor();
459
+ const own = unique([...kus, ...chairedKus]);
460
+ if (requested && !own.includes(requested))
461
+ return deny(kuScope);
462
+ return pass({ scopes, kus: requested ? [requested] : own });
463
+ }
464
+ if (wide)
465
+ return pass({ scopes });
466
+ let facts;
467
+ if ("owner" in source) {
468
+ const value = readPath$1(args, source.owner);
469
+ facts = [value === void 0 || value === null || value === "" ? {} : { owner: String(value) }];
470
+ } else if ("ku" in source) {
471
+ const value = readPath$1(args, source.ku);
472
+ facts = value === void 0 || value === null ? [] : [{ ku: String(value) }];
473
+ } else {
474
+ const value = readPath$1(args, source.id);
475
+ const ids = (Array.isArray(value) ? value : [value]).filter((id) => id !== void 0 && id !== null).map(String);
476
+ facts = ids.length > 0 ? await input.locate(source.of, ids) : [];
477
+ }
478
+ if (facts.length === 0)
479
+ return pass({ scopes: [] });
480
+ const who = await actor();
481
+ const matched = facts.map((one) => scopesMatched(resource, narrow, who, one));
482
+ const any = "of" in source && source.match === "any";
483
+ const allowed = any ? matched.some((list) => list.length > 0) : matched.every((list) => list.length > 0);
484
+ if (!allowed)
485
+ return deny();
486
+ return pass({ scopes: unique(matched.flat()) });
487
+ }
488
+ const GRANTED_SCOPE_KEY = "grantedScope";
489
+ const GrantedScope = createParamDecorator((_data, context) => {
490
+ const request = GqlExecutionContext.create(context).getContext().req;
491
+ return request?.[GRANTED_SCOPE_KEY] ?? { scopes: [] };
492
+ });
493
+
494
+ var __defProp$p = Object.defineProperty;
495
+ var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
496
+ var __decorateClass$p = (decorators, target, key, kind) => {
497
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
348
498
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
349
499
  if (decorator = decorators[i])
350
500
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
351
501
  if (kind && result)
352
- __defProp$f(target, key, result);
502
+ __defProp$p(target, key, result);
503
+ return result;
504
+ };
505
+ var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
506
+ const APP_RIGHTS = Symbol("APP_RIGHTS");
507
+ function councilRolesOf(role) {
508
+ const core = String(role ?? "").toLowerCase();
509
+ if (core === "chairman")
510
+ return ["council", "chairman"];
511
+ if (core === "member")
512
+ return ["council"];
513
+ return [];
514
+ }
515
+ const ACCEPTED_STATUS = "active";
516
+ function memberRolesOf(caller) {
517
+ const accepted = caller.status === ACCEPTED_STATUS ? ["participant"] : [];
518
+ return [...accepted, ...councilRolesOf(caller.role)];
519
+ }
520
+ const NO_RIGHT = "KIT_INSUFFICIENT_RIGHTS";
521
+ function conditionOrder(def) {
522
+ return Object.keys(def.conditionDenials ?? {});
523
+ }
524
+ async function grantedActions(def, caller, roles, resource, actions) {
525
+ const lazy = new Set(def.lazyConditions ?? []);
526
+ const held = /* @__PURE__ */ new Set();
527
+ const read = /* @__PURE__ */ new Set();
528
+ const resolve = async (wanted) => {
529
+ const fresh = wanted.filter((condition) => !read.has(condition));
530
+ if (fresh.length === 0 || !def.conditions)
531
+ return;
532
+ fresh.forEach((condition) => read.add(condition));
533
+ for (const condition of await def.conditions(caller, roles, fresh))
534
+ held.add(condition);
535
+ };
536
+ const granted = [];
537
+ const unmet = [];
538
+ for (const action of actions) {
539
+ const rows = rightGrants(def.table, roles, resource, action);
540
+ if (rows.length === 0)
541
+ continue;
542
+ const satisfied = () => rows.filter((row) => row.when.every((condition) => held.has(condition)));
543
+ const settled = rows.some((row) => row.when.length === 0) && !rows.some((row) => row.wide);
544
+ if (!settled) {
545
+ await resolve(rows.flatMap((row) => row.when).filter((condition) => !lazy.has(condition)));
546
+ if (satisfied().length === 0) {
547
+ const worth = rows.filter((row) => row.when.every((condition) => lazy.has(condition) || held.has(condition)));
548
+ await resolve(worth.flatMap((row) => row.when).filter((condition) => lazy.has(condition)));
549
+ }
550
+ }
551
+ const ok = satisfied();
552
+ if (ok.length > 0)
553
+ granted.push({ action, wide: ok.some((row) => row.wide) });
554
+ else
555
+ unmet.push(...rows.map((row) => row.when.filter((condition) => !held.has(condition))));
556
+ }
557
+ if (granted.length > 0 || unmet.length === 0)
558
+ return { granted };
559
+ const nearest = [...unmet].sort((a, b) => a.length - b.length)[0];
560
+ const order = conditionOrder(def);
561
+ return { granted, missing: order.find((condition) => nearest.includes(condition)) ?? nearest[0] };
562
+ }
563
+ async function checkRight(def, caller, roles, requirement, args) {
564
+ const actions = Array.isArray(requirement.action) ? requirement.action : [requirement.action];
565
+ const { granted, missing } = await grantedActions(def, caller, roles, requirement.resource, actions);
566
+ if (granted.length === 0) {
567
+ if (missing === void 0)
568
+ return { allowed: false, reason: "right", denial: NO_RIGHT };
569
+ return { allowed: false, reason: "condition", denial: def.conditionDenials?.[missing] ?? NO_RIGHT };
570
+ }
571
+ const scope = await checkRightScope({
572
+ resource: requirement.resource,
573
+ granted,
574
+ source: requirement.source,
575
+ implied: def.impliedScopes,
576
+ args,
577
+ username: caller.username,
578
+ kus: async () => def.kus ? def.kus(caller.username) : [],
579
+ chairedKus: async () => def.chairedKus ? def.chairedKus(caller.username) : [],
580
+ locate: async (kind, ids) => def.locate ? def.locate(kind, ids) : []
581
+ });
582
+ if (!scope.allowed)
583
+ return { allowed: false, reason: "scope", denial: scope.denial ?? NO_RIGHT };
584
+ return { allowed: true, scope: scope.scope };
585
+ }
586
+ function allConditions(table) {
587
+ const out = /* @__PURE__ */ new Set();
588
+ for (const groups of Object.values(table))
589
+ for (const group of groups)
590
+ group.when.forEach((condition) => out.add(condition));
591
+ return [...out];
592
+ }
593
+ async function desktopGrants(def, caller, config) {
594
+ const roles = await def.roles(caller);
595
+ if (roles.length === 0)
596
+ return [];
597
+ const wanted = allConditions(def.table);
598
+ const held = def.conditions && wanted.length > 0 ? await def.conditions(caller, roles, wanted, config) : /* @__PURE__ */ new Set();
599
+ const grants = new Set(expandRights(rightsHeld(def.table, roles, held)));
600
+ for (const extra of def.extraGrants?.(caller, roles, held) ?? [])
601
+ grants.add(extra);
602
+ return [...grants];
603
+ }
604
+ function desktopGrantsOf(def) {
605
+ return {
606
+ extensionName: def.extensionName,
607
+ resolveGrants: async (ctx) => {
608
+ const open = def.publicGrants ?? [];
609
+ if (!ctx.username)
610
+ return [...open];
611
+ const held = await desktopGrants(def, { username: ctx.username, role: ctx.userRole, status: ctx.userStatus }, ctx.config ?? null);
612
+ return open.length > 0 ? [.../* @__PURE__ */ new Set([...open, ...held])] : held;
613
+ }
614
+ };
615
+ }
616
+ let RightsGuard = class {
617
+ constructor(reflector, def) {
618
+ this.reflector = reflector;
619
+ this.def = def;
620
+ this.logger = new Logger(RightsGuard.name);
621
+ }
622
+ async canActivate(context) {
623
+ const requirement = this.reflector.getAllAndOverride(RIGHT_METADATA_KEY, [
624
+ context.getHandler(),
625
+ context.getClass()
626
+ ]);
627
+ if (!requirement)
628
+ return true;
629
+ const gql = GqlExecutionContext.create(context);
630
+ const request = gql.getContext()?.req;
631
+ if (hasServerSecret(request?.headers)) {
632
+ const everything = { scopes: ["all"], kus: null };
633
+ if (request)
634
+ request[GRANTED_SCOPE_KEY] = everything;
635
+ return true;
636
+ }
637
+ const user = request?.user;
638
+ if (!user?.username)
639
+ throw DomainError.unauthorized("KIT_USER_NOT_AUTHORIZED");
640
+ const caller = { username: user.username, role: user.role, status: user.status };
641
+ const roles = await this.def.roles(caller, request);
642
+ const outcome = await checkRight(this.def, caller, roles, requirement, gql.getArgs() ?? {});
643
+ if (!outcome.allowed) {
644
+ const actions = Array.isArray(requirement.action) ? requirement.action.join("|") : requirement.action;
645
+ this.logger.warn(
646
+ `forbidden-attempt: member=${caller.username} extension=${this.def.extensionName} operation=${context.getClass()?.name}.${context.getHandler()?.name} right=${requirement.resource}:${actions} reason=${outcome.reason} denial=${outcome.denial} roles=[${roles.join(", ")}]`
647
+ );
648
+ throw DomainError.forbidden(outcome.denial);
649
+ }
650
+ request[GRANTED_SCOPE_KEY] = outcome.scope;
651
+ return true;
652
+ }
653
+ };
654
+ RightsGuard = __decorateClass$p([
655
+ Injectable(),
656
+ __decorateParam(0, Inject(Reflector)),
657
+ __decorateParam(1, Inject(APP_RIGHTS))
658
+ ], RightsGuard);
659
+
660
+ var __defProp$o = Object.defineProperty;
661
+ var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
662
+ var __decorateClass$o = (decorators, target, key, kind) => {
663
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
664
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
665
+ if (decorator = decorators[i])
666
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
667
+ if (kind && result)
668
+ __defProp$o(target, key, result);
353
669
  return result;
354
670
  };
355
671
  let BaseExtensionModule = class {
@@ -360,34 +676,34 @@ let BaseExtensionModule = class {
360
676
  async onModuleInit() {
361
677
  }
362
678
  };
363
- BaseExtensionModule = __decorateClass$f([
679
+ BaseExtensionModule = __decorateClass$o([
364
680
  Injectable()
365
681
  ], BaseExtensionModule);
366
682
 
367
- var __defProp$e = Object.defineProperty;
368
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
369
- var __decorateClass$e = (decorators, target, key, kind) => {
370
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
683
+ var __defProp$n = Object.defineProperty;
684
+ var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
685
+ var __decorateClass$n = (decorators, target, key, kind) => {
686
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
371
687
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
372
688
  if (decorator = decorators[i])
373
689
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
374
690
  if (kind && result)
375
- __defProp$e(target, key, result);
691
+ __defProp$n(target, key, result);
376
692
  return result;
377
693
  };
378
694
  let PaymentProvider = class extends BaseExtensionModule {
379
695
  };
380
- PaymentProvider = __decorateClass$e([
696
+ PaymentProvider = __decorateClass$n([
381
697
  Injectable()
382
698
  ], PaymentProvider);
383
699
  let PollingProvider = class extends PaymentProvider {
384
700
  };
385
- PollingProvider = __decorateClass$e([
701
+ PollingProvider = __decorateClass$n([
386
702
  Injectable()
387
703
  ], PollingProvider);
388
704
  let IPNProvider = class extends PaymentProvider {
389
705
  };
390
- IPNProvider = __decorateClass$e([
706
+ IPNProvider = __decorateClass$n([
391
707
  Injectable()
392
708
  ], IPNProvider);
393
709
 
@@ -446,48 +762,48 @@ function bucketProvidersFor(fileStoragePortToken, consumers) {
446
762
  });
447
763
  }
448
764
 
449
- var __defProp$d = Object.defineProperty;
450
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
451
- var __decorateClass$d = (decorators, target, key, kind) => {
452
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
765
+ var __defProp$m = Object.defineProperty;
766
+ var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
767
+ var __decorateClass$m = (decorators, target, key, kind) => {
768
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
453
769
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
454
770
  if (decorator = decorators[i])
455
771
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
456
772
  if (kind && result)
457
- __defProp$d(target, key, result);
773
+ __defProp$m(target, key, result);
458
774
  return result;
459
775
  };
460
776
  let SignatureInfoInputDTO = class {
461
777
  };
462
- __decorateClass$d([
778
+ __decorateClass$m([
463
779
  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" }),
464
780
  IsNumber()
465
781
  ], SignatureInfoInputDTO.prototype, "id", 2);
466
- __decorateClass$d([
782
+ __decorateClass$m([
467
783
  Field(() => String, { description: "\u0410\u043A\u043A\u0430\u0443\u043D\u0442 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u0432\u0448\u0435\u0433\u043E" }),
468
784
  IsString()
469
785
  ], SignatureInfoInputDTO.prototype, "signer", 2);
470
- __decorateClass$d([
786
+ __decorateClass$m([
471
787
  Field(() => String, { description: "\u041F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 \u043A\u043B\u044E\u0447" }),
472
788
  IsString()
473
789
  ], SignatureInfoInputDTO.prototype, "public_key", 2);
474
- __decorateClass$d([
790
+ __decorateClass$m([
475
791
  Field(() => String, { description: "\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u0445\u044D\u0448\u0430" }),
476
792
  IsString()
477
793
  ], SignatureInfoInputDTO.prototype, "signature", 2);
478
- __decorateClass$d([
794
+ __decorateClass$m([
479
795
  Field(() => String, { description: "\u0412\u0440\u0435\u043C\u044F \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0438\u044F" }),
480
796
  IsString()
481
797
  ], SignatureInfoInputDTO.prototype, "signed_at", 2);
482
- __decorateClass$d([
798
+ __decorateClass$m([
483
799
  Field(() => String, { description: "\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u043D\u044B\u0439 \u0445\u044D\u0448" }),
484
800
  IsString()
485
801
  ], SignatureInfoInputDTO.prototype, "signed_hash", 2);
486
- __decorateClass$d([
802
+ __decorateClass$m([
487
803
  Field(() => String, { description: "\u041C\u0435\u0442\u0430-\u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u043E\u0434\u043F\u0438\u0441\u0438" }),
488
804
  IsString()
489
805
  ], SignatureInfoInputDTO.prototype, "meta", 2);
490
- SignatureInfoInputDTO = __decorateClass$d([
806
+ SignatureInfoInputDTO = __decorateClass$m([
491
807
  InputType("SignatureInfoInput")
492
808
  ], SignatureInfoInputDTO);
493
809
  let SignedDigitalDocumentInputDTO = class {
@@ -508,33 +824,33 @@ let SignedDigitalDocumentInputDTO = class {
508
824
  };
509
825
  }
510
826
  };
511
- __decorateClass$d([
827
+ __decorateClass$m([
512
828
  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" }),
513
829
  IsString()
514
830
  ], SignedDigitalDocumentInputDTO.prototype, "version", 2);
515
- __decorateClass$d([
831
+ __decorateClass$m([
516
832
  Field(() => String, { description: "\u041E\u0431\u0449\u0438\u0439 \u0445\u044D\u0448 (doc_hash + meta_hash)" }),
517
833
  IsString()
518
834
  ], SignedDigitalDocumentInputDTO.prototype, "hash", 2);
519
- __decorateClass$d([
835
+ __decorateClass$m([
520
836
  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" }),
521
837
  IsString()
522
838
  ], SignedDigitalDocumentInputDTO.prototype, "doc_hash", 2);
523
- __decorateClass$d([
839
+ __decorateClass$m([
524
840
  Field(() => String, { description: "\u0425\u044D\u0448 \u043C\u0435\u0442\u0430-\u0434\u0430\u043D\u043D\u044B\u0445" }),
525
841
  IsString()
526
842
  ], SignedDigitalDocumentInputDTO.prototype, "meta_hash", 2);
527
- __decorateClass$d([
843
+ __decorateClass$m([
528
844
  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" })
529
845
  ], SignedDigitalDocumentInputDTO.prototype, "meta", 2);
530
- __decorateClass$d([
846
+ __decorateClass$m([
531
847
  Field(() => [SignatureInfoInputDTO], { description: "\u0412\u0435\u043A\u0442\u043E\u0440 \u043F\u043E\u0434\u043F\u0438\u0441\u0435\u0439" }),
532
848
  IsArray(),
533
849
  ArrayMinSize(1),
534
850
  ValidateNested({ each: true }),
535
851
  Type(() => SignatureInfoInputDTO)
536
852
  ], SignedDigitalDocumentInputDTO.prototype, "signatures", 2);
537
- SignedDigitalDocumentInputDTO = __decorateClass$d([
853
+ SignedDigitalDocumentInputDTO = __decorateClass$m([
538
854
  InputType("SignedDigitalDocumentInput")
539
855
  ], SignedDigitalDocumentInputDTO);
540
856
 
@@ -547,186 +863,186 @@ registerEnumType(LangType, {
547
863
  description: "\u042F\u0437\u044B\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430"
548
864
  });
549
865
 
550
- var __defProp$c = Object.defineProperty;
551
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
552
- var __decorateClass$c = (decorators, target, key, kind) => {
553
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
866
+ var __defProp$l = Object.defineProperty;
867
+ var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
868
+ var __decorateClass$l = (decorators, target, key, kind) => {
869
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
554
870
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
555
871
  if (decorator = decorators[i])
556
872
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
557
873
  if (kind && result)
558
- __defProp$c(target, key, result);
874
+ __defProp$l(target, key, result);
559
875
  return result;
560
876
  };
561
877
  let MetaDocumentInputDTO = class {
562
878
  };
563
- __decorateClass$c([
879
+ __decorateClass$l([
564
880
  Field(() => String, { description: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
565
881
  IsString()
566
882
  ], MetaDocumentInputDTO.prototype, "title", 2);
567
- __decorateClass$c([
883
+ __decorateClass$l([
568
884
  Field(() => Int, { description: "ID \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435" }),
569
885
  IsNumber()
570
886
  ], MetaDocumentInputDTO.prototype, "registry_id", 2);
571
- __decorateClass$c([
887
+ __decorateClass$l([
572
888
  Field(() => String, { description: "\u042F\u0437\u044B\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430" }),
573
889
  IsEnum(LangType)
574
890
  ], MetaDocumentInputDTO.prototype, "lang", 2);
575
- __decorateClass$c([
891
+ __decorateClass$l([
576
892
  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" }),
577
893
  IsString()
578
894
  ], MetaDocumentInputDTO.prototype, "generator", 2);
579
- __decorateClass$c([
895
+ __decorateClass$l([
580
896
  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" }),
581
897
  IsString()
582
898
  ], MetaDocumentInputDTO.prototype, "version", 2);
583
- __decorateClass$c([
899
+ __decorateClass$l([
584
900
  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" }),
585
901
  IsString()
586
902
  ], MetaDocumentInputDTO.prototype, "coopname", 2);
587
- __decorateClass$c([
903
+ __decorateClass$l([
588
904
  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" }),
589
905
  IsString()
590
906
  ], MetaDocumentInputDTO.prototype, "username", 2);
591
- __decorateClass$c([
907
+ __decorateClass$l([
592
908
  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" }),
593
909
  IsString()
594
910
  ], MetaDocumentInputDTO.prototype, "created_at", 2);
595
- __decorateClass$c([
911
+ __decorateClass$l([
596
912
  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" }),
597
913
  IsInt()
598
914
  ], MetaDocumentInputDTO.prototype, "block_num", 2);
599
- __decorateClass$c([
915
+ __decorateClass$l([
600
916
  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" }),
601
917
  IsString()
602
918
  ], MetaDocumentInputDTO.prototype, "timezone", 2);
603
- __decorateClass$c([
919
+ __decorateClass$l([
604
920
  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" }),
605
921
  IsArray(),
606
922
  IsString({ each: true })
607
923
  ], MetaDocumentInputDTO.prototype, "links", 2);
608
- MetaDocumentInputDTO = __decorateClass$c([
924
+ MetaDocumentInputDTO = __decorateClass$l([
609
925
  InputType("MetaDocumentInput")
610
926
  ], MetaDocumentInputDTO);
611
927
 
612
- var __defProp$b = Object.defineProperty;
613
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
614
- var __decorateClass$b = (decorators, target, key, kind) => {
615
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
928
+ var __defProp$k = Object.defineProperty;
929
+ var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
930
+ var __decorateClass$k = (decorators, target, key, kind) => {
931
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
616
932
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
617
933
  if (decorator = decorators[i])
618
934
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
619
935
  if (kind && result)
620
- __defProp$b(target, key, result);
936
+ __defProp$k(target, key, result);
621
937
  return result;
622
938
  };
623
939
  let GenerateMetaDocumentInputDTO = class {
624
940
  };
625
- __decorateClass$b([
941
+ __decorateClass$k([
626
942
  Field(() => String, { description: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", nullable: true }),
627
943
  IsOptional(),
628
944
  IsString()
629
945
  ], GenerateMetaDocumentInputDTO.prototype, "title", 2);
630
- __decorateClass$b([
946
+ __decorateClass$k([
631
947
  Field(() => Int, { description: "ID \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435" }),
632
948
  IsNumber()
633
949
  ], GenerateMetaDocumentInputDTO.prototype, "registry_id", 2);
634
- __decorateClass$b([
950
+ __decorateClass$k([
635
951
  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" }),
636
952
  IsString()
637
953
  ], GenerateMetaDocumentInputDTO.prototype, "coopname", 2);
638
- __decorateClass$b([
954
+ __decorateClass$k([
639
955
  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" }),
640
956
  IsString()
641
957
  ], GenerateMetaDocumentInputDTO.prototype, "username", 2);
642
- __decorateClass$b([
958
+ __decorateClass$k([
643
959
  Field(() => String, { description: "\u042F\u0437\u044B\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", nullable: true }),
644
960
  IsOptional(),
645
961
  IsEnum(LangType)
646
962
  ], GenerateMetaDocumentInputDTO.prototype, "lang", 2);
647
- __decorateClass$b([
963
+ __decorateClass$k([
648
964
  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 }),
649
965
  IsOptional(),
650
966
  IsString()
651
967
  ], GenerateMetaDocumentInputDTO.prototype, "generator", 2);
652
- __decorateClass$b([
968
+ __decorateClass$k([
653
969
  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 }),
654
970
  IsOptional(),
655
971
  IsString()
656
972
  ], GenerateMetaDocumentInputDTO.prototype, "version", 2);
657
- __decorateClass$b([
973
+ __decorateClass$k([
658
974
  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 }),
659
975
  IsOptional()
660
976
  ], GenerateMetaDocumentInputDTO.prototype, "created_at", 2);
661
- __decorateClass$b([
977
+ __decorateClass$k([
662
978
  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 }),
663
979
  IsOptional(),
664
980
  IsInt()
665
981
  ], GenerateMetaDocumentInputDTO.prototype, "block_num", 2);
666
- __decorateClass$b([
982
+ __decorateClass$k([
667
983
  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 }),
668
984
  IsOptional(),
669
985
  IsString()
670
986
  ], GenerateMetaDocumentInputDTO.prototype, "timezone", 2);
671
- __decorateClass$b([
987
+ __decorateClass$k([
672
988
  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 }),
673
989
  IsOptional(),
674
990
  IsArray(),
675
991
  IsString({ each: true })
676
992
  ], GenerateMetaDocumentInputDTO.prototype, "links", 2);
677
- GenerateMetaDocumentInputDTO = __decorateClass$b([
993
+ GenerateMetaDocumentInputDTO = __decorateClass$k([
678
994
  InputType("GenerateMetaDocumentInput")
679
995
  ], GenerateMetaDocumentInputDTO);
680
996
 
681
- var __defProp$a = Object.defineProperty;
682
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
683
- var __decorateClass$a = (decorators, target, key, kind) => {
684
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
997
+ var __defProp$j = Object.defineProperty;
998
+ var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
999
+ var __decorateClass$j = (decorators, target, key, kind) => {
1000
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
685
1001
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
686
1002
  if (decorator = decorators[i])
687
1003
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
688
1004
  if (kind && result)
689
- __defProp$a(target, key, result);
1005
+ __defProp$j(target, key, result);
690
1006
  return result;
691
1007
  };
692
1008
  let ExpenseProposalItemInputDTO = class {
693
1009
  };
694
- __decorateClass$a([
1010
+ __decorateClass$j([
695
1011
  Field(() => String, { description: "\u041F\u043E\u0440\u044F\u0434\u043A\u043E\u0432\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0441\u0442\u0440\u043E\u043A\u0438" }),
696
1012
  IsString()
697
1013
  ], ExpenseProposalItemInputDTO.prototype, "number", 2);
698
- __decorateClass$a([
1014
+ __decorateClass$j([
699
1015
  Field(() => String, { description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u0430" }),
700
1016
  IsString()
701
1017
  ], ExpenseProposalItemInputDTO.prototype, "description", 2);
702
- __decorateClass$a([
1018
+ __decorateClass$j([
703
1019
  Field(() => String, { description: "\u0421\u0443\u043C\u043C\u0430 \u0441\u0442\u0440\u043E\u043A\u0438" }),
704
1020
  IsString()
705
1021
  ], ExpenseProposalItemInputDTO.prototype, "amount", 2);
706
- __decorateClass$a([
1022
+ __decorateClass$j([
707
1023
  Field(() => String, { description: "\u0422\u0438\u043F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F (SELF / MEMBER / ORG)" }),
708
1024
  IsString()
709
1025
  ], ExpenseProposalItemInputDTO.prototype, "recipient_type", 2);
710
- __decorateClass$a([
1026
+ __decorateClass$j([
711
1027
  Field(() => String, { description: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B (ADVANCE / DIRECT)" }),
712
1028
  IsString()
713
1029
  ], ExpenseProposalItemInputDTO.prototype, "mechanics", 2);
714
- __decorateClass$a([
1030
+ __decorateClass$j([
715
1031
  Field(() => String, { description: "\u0418\u043C\u044F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F", nullable: true }),
716
1032
  IsOptional(),
717
1033
  IsString()
718
1034
  ], ExpenseProposalItemInputDTO.prototype, "recipient_name", 2);
719
- __decorateClass$a([
1035
+ __decorateClass$j([
720
1036
  Field(() => String, { description: "\u0420\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F", nullable: true }),
721
1037
  IsOptional(),
722
1038
  IsString()
723
1039
  ], ExpenseProposalItemInputDTO.prototype, "requisites", 2);
724
- __decorateClass$a([
1040
+ __decorateClass$j([
725
1041
  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 }),
726
1042
  IsOptional(),
727
1043
  IsString()
728
1044
  ], ExpenseProposalItemInputDTO.prototype, "payment_purpose", 2);
729
- __decorateClass$a([
1045
+ __decorateClass$j([
730
1046
  Field(() => String, {
731
1047
  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.",
732
1048
  nullable: true
@@ -734,7 +1050,7 @@ __decorateClass$a([
734
1050
  IsOptional(),
735
1051
  IsString()
736
1052
  ], ExpenseProposalItemInputDTO.prototype, "payment_method_id", 2);
737
- __decorateClass$a([
1053
+ __decorateClass$j([
738
1054
  Field(() => String, {
739
1055
  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).",
740
1056
  nullable: true
@@ -742,60 +1058,60 @@ __decorateClass$a([
742
1058
  IsOptional(),
743
1059
  IsString()
744
1060
  ], ExpenseProposalItemInputDTO.prototype, "recipient_username", 2);
745
- ExpenseProposalItemInputDTO = __decorateClass$a([
1061
+ ExpenseProposalItemInputDTO = __decorateClass$j([
746
1062
  InputType("ExpenseProposalItemInput")
747
1063
  ], ExpenseProposalItemInputDTO);
748
1064
  let ExpenseProposalSignedItemInputDTO = class {
749
1065
  };
750
- __decorateClass$a([
1066
+ __decorateClass$j([
751
1067
  Field(() => String, { description: "\u041F\u043E\u0440\u044F\u0434\u043A\u043E\u0432\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0441\u0442\u0440\u043E\u043A\u0438" }),
752
1068
  IsString()
753
1069
  ], ExpenseProposalSignedItemInputDTO.prototype, "number", 2);
754
- __decorateClass$a([
1070
+ __decorateClass$j([
755
1071
  Field(() => String, { description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u0430" }),
756
1072
  IsString()
757
1073
  ], ExpenseProposalSignedItemInputDTO.prototype, "description", 2);
758
- __decorateClass$a([
1074
+ __decorateClass$j([
759
1075
  Field(() => String, { description: "\u0421\u0443\u043C\u043C\u0430 \u0441\u0442\u0440\u043E\u043A\u0438" }),
760
1076
  IsString()
761
1077
  ], ExpenseProposalSignedItemInputDTO.prototype, "amount", 2);
762
- __decorateClass$a([
1078
+ __decorateClass$j([
763
1079
  Field(() => String, { description: "\u0422\u0438\u043F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F (SELF / MEMBER / ORG)" }),
764
1080
  IsString()
765
1081
  ], ExpenseProposalSignedItemInputDTO.prototype, "recipient_type", 2);
766
- __decorateClass$a([
1082
+ __decorateClass$j([
767
1083
  Field(() => String, { description: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B (ADVANCE / DIRECT)" }),
768
1084
  IsString()
769
1085
  ], ExpenseProposalSignedItemInputDTO.prototype, "mechanics", 2);
770
- ExpenseProposalSignedItemInputDTO = __decorateClass$a([
1086
+ ExpenseProposalSignedItemInputDTO = __decorateClass$j([
771
1087
  InputType("ExpenseProposalSignedItemInput")
772
1088
  ], ExpenseProposalSignedItemInputDTO);
773
1089
  let ExpenseProposalHeaderInputDTO = class {
774
1090
  };
775
- __decorateClass$a([
1091
+ __decorateClass$j([
776
1092
  Field(() => String, { description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0446\u0435\u043B\u0438 \u0440\u0430\u0441\u0445\u043E\u0434\u043E\u0432" }),
777
1093
  IsString()
778
1094
  ], ExpenseProposalHeaderInputDTO.prototype, "description", 2);
779
- __decorateClass$a([
1095
+ __decorateClass$j([
780
1096
  Field(() => String, { description: "\u0418\u0442\u043E\u0433\u043E\u0432\u0430\u044F \u0441\u0443\u043C\u043C\u0430 \u0440\u0430\u0441\u0445\u043E\u0434\u043E\u0432" }),
781
1097
  IsString()
782
1098
  ], ExpenseProposalHeaderInputDTO.prototype, "total_amount", 2);
783
- __decorateClass$a([
1099
+ __decorateClass$j([
784
1100
  Field(() => Int, { description: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043F\u043E\u0437\u0438\u0446\u0438\u0439" }),
785
1101
  IsInt()
786
1102
  ], ExpenseProposalHeaderInputDTO.prototype, "items_count", 2);
787
- __decorateClass$a([
1103
+ __decorateClass$j([
788
1104
  Field(() => String, { description: "\u041A\u043E\u0448\u0435\u043B\u0451\u043A-\u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A" }),
789
1105
  IsString()
790
1106
  ], ExpenseProposalHeaderInputDTO.prototype, "source_wallet", 2);
791
- __decorateClass$a([
1107
+ __decorateClass$j([
792
1108
  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" }),
793
1109
  IsString(),
794
1110
  Matches(/^\d{2}\.\d{2}\.\d{4}$/, {
795
1111
  message: validationMessage("kit.expenseStatement.dueDateFormat")
796
1112
  })
797
1113
  ], ExpenseProposalHeaderInputDTO.prototype, "deadline", 2);
798
- __decorateClass$a([
1114
+ __decorateClass$j([
799
1115
  Field(() => String, {
800
1116
  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",
801
1117
  nullable: true
@@ -803,56 +1119,56 @@ __decorateClass$a([
803
1119
  IsOptional(),
804
1120
  IsString()
805
1121
  ], ExpenseProposalHeaderInputDTO.prototype, "fund_name", 2);
806
- ExpenseProposalHeaderInputDTO = __decorateClass$a([
1122
+ ExpenseProposalHeaderInputDTO = __decorateClass$j([
807
1123
  InputType("ExpenseProposalHeaderInput")
808
1124
  ], ExpenseProposalHeaderInputDTO);
809
1125
  let BaseExpenseProposalStatementGenerateMetaDocumentInputDTO = class {
810
1126
  };
811
- __decorateClass$a([
1127
+ __decorateClass$j([
812
1128
  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)" }),
813
1129
  IsString(),
814
1130
  IsNotEmpty()
815
1131
  ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO.prototype, "proposal_hash", 2);
816
- __decorateClass$a([
1132
+ __decorateClass$j([
817
1133
  Field(() => ExpenseProposalHeaderInputDTO, { description: "\u0428\u0430\u043F\u043A\u0430 \u0421\u0417" }),
818
1134
  ValidateNested(),
819
1135
  Type(() => ExpenseProposalHeaderInputDTO)
820
1136
  ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO.prototype, "proposal", 2);
821
- __decorateClass$a([
1137
+ __decorateClass$j([
822
1138
  Field(() => [ExpenseProposalItemInputDTO], { description: "\u041F\u043E\u0437\u0438\u0446\u0438\u0438 \u0440\u0430\u0441\u0445\u043E\u0434\u0430" }),
823
1139
  IsArray(),
824
1140
  ArrayMinSize(1),
825
1141
  ValidateNested({ each: true }),
826
1142
  Type(() => ExpenseProposalItemInputDTO)
827
1143
  ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO.prototype, "items", 2);
828
- BaseExpenseProposalStatementGenerateMetaDocumentInputDTO = __decorateClass$a([
1144
+ BaseExpenseProposalStatementGenerateMetaDocumentInputDTO = __decorateClass$j([
829
1145
  InputType("BaseExpenseProposalStatementGenerateMetaDocumentInput")
830
1146
  ], BaseExpenseProposalStatementGenerateMetaDocumentInputDTO);
831
1147
  let BaseExpenseProposalStatementSignedMetaDocumentInputDTO = class {
832
1148
  };
833
- __decorateClass$a([
1149
+ __decorateClass$j([
834
1150
  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)" }),
835
1151
  IsString(),
836
1152
  IsNotEmpty()
837
1153
  ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "proposal_hash", 2);
838
- __decorateClass$a([
1154
+ __decorateClass$j([
839
1155
  Field(() => ExpenseProposalHeaderInputDTO, { description: "\u0428\u0430\u043F\u043A\u0430 \u0421\u0417" }),
840
1156
  ValidateNested(),
841
1157
  Type(() => ExpenseProposalHeaderInputDTO)
842
1158
  ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "proposal", 2);
843
- __decorateClass$a([
1159
+ __decorateClass$j([
844
1160
  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)" }),
845
1161
  IsArray(),
846
1162
  ArrayMinSize(1),
847
1163
  ValidateNested({ each: true }),
848
1164
  Type(() => ExpenseProposalSignedItemInputDTO)
849
1165
  ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "items", 2);
850
- __decorateClass$a([
1166
+ __decorateClass$j([
851
1167
  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)" }),
852
1168
  IsString(),
853
1169
  IsNotEmpty()
854
1170
  ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO.prototype, "doc_data_hash", 2);
855
- BaseExpenseProposalStatementSignedMetaDocumentInputDTO = __decorateClass$a([
1171
+ BaseExpenseProposalStatementSignedMetaDocumentInputDTO = __decorateClass$j([
856
1172
  InputType("BaseExpenseProposalStatementSignedMetaDocumentInput")
857
1173
  ], BaseExpenseProposalStatementSignedMetaDocumentInputDTO);
858
1174
  let ExpenseProposalStatementGenerateDocumentInputDTO = class extends IntersectionType(
@@ -860,7 +1176,7 @@ let ExpenseProposalStatementGenerateDocumentInputDTO = class extends Intersectio
860
1176
  OmitType(GenerateMetaDocumentInputDTO, ["registry_id"])
861
1177
  ) {
862
1178
  };
863
- ExpenseProposalStatementGenerateDocumentInputDTO = __decorateClass$a([
1179
+ ExpenseProposalStatementGenerateDocumentInputDTO = __decorateClass$j([
864
1180
  InputType("ExpenseProposalStatementGenerateDocumentInput")
865
1181
  ], ExpenseProposalStatementGenerateDocumentInputDTO);
866
1182
  let ExpenseProposalStatementSignedMetaDocumentInputDTO = class extends IntersectionType(
@@ -868,29 +1184,29 @@ let ExpenseProposalStatementSignedMetaDocumentInputDTO = class extends Intersect
868
1184
  MetaDocumentInputDTO
869
1185
  ) {
870
1186
  };
871
- ExpenseProposalStatementSignedMetaDocumentInputDTO = __decorateClass$a([
1187
+ ExpenseProposalStatementSignedMetaDocumentInputDTO = __decorateClass$j([
872
1188
  InputType("ExpenseProposalStatementSignedMetaDocumentInput")
873
1189
  ], ExpenseProposalStatementSignedMetaDocumentInputDTO);
874
1190
  let ExpenseProposalStatementSignedDocumentInputDTO = class extends SignedDigitalDocumentInputDTO {
875
1191
  };
876
- __decorateClass$a([
1192
+ __decorateClass$j([
877
1193
  Field(() => ExpenseProposalStatementSignedMetaDocumentInputDTO, {
878
1194
  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"
879
1195
  })
880
1196
  ], ExpenseProposalStatementSignedDocumentInputDTO.prototype, "meta", 2);
881
- ExpenseProposalStatementSignedDocumentInputDTO = __decorateClass$a([
1197
+ ExpenseProposalStatementSignedDocumentInputDTO = __decorateClass$j([
882
1198
  InputType("ExpenseProposalStatementSignedDocumentInput")
883
1199
  ], ExpenseProposalStatementSignedDocumentInputDTO);
884
1200
 
885
- var __defProp$9 = Object.defineProperty;
886
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
887
- var __decorateClass$9 = (decorators, target, key, kind) => {
888
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
1201
+ var __defProp$i = Object.defineProperty;
1202
+ var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
1203
+ var __decorateClass$i = (decorators, target, key, kind) => {
1204
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
889
1205
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
890
1206
  if (decorator = decorators[i])
891
1207
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
892
1208
  if (kind && result)
893
- __defProp$9(target, key, result);
1209
+ __defProp$i(target, key, result);
894
1210
  return result;
895
1211
  };
896
1212
  var CandidateStatus = /* @__PURE__ */ ((CandidateStatus2) => {
@@ -904,63 +1220,63 @@ registerEnumType(CandidateStatus, {
904
1220
  });
905
1221
  let CandidateOutputDTO = class {
906
1222
  };
907
- __decorateClass$9([
1223
+ __decorateClass$i([
908
1224
  Field(() => String)
909
1225
  ], CandidateOutputDTO.prototype, "username", 2);
910
- __decorateClass$9([
1226
+ __decorateClass$i([
911
1227
  Field(() => String, { nullable: true })
912
1228
  ], CandidateOutputDTO.prototype, "username_display_name", 2);
913
- __decorateClass$9([
1229
+ __decorateClass$i([
914
1230
  Field(() => String)
915
1231
  ], CandidateOutputDTO.prototype, "coopname", 2);
916
- __decorateClass$9([
1232
+ __decorateClass$i([
917
1233
  Field(() => String, { nullable: true })
918
1234
  ], CandidateOutputDTO.prototype, "braname", 2);
919
- __decorateClass$9([
1235
+ __decorateClass$i([
920
1236
  Field(() => CandidateStatus)
921
1237
  ], CandidateOutputDTO.prototype, "status", 2);
922
- __decorateClass$9([
1238
+ __decorateClass$i([
923
1239
  Field(() => String)
924
1240
  ], CandidateOutputDTO.prototype, "type", 2);
925
- __decorateClass$9([
1241
+ __decorateClass$i([
926
1242
  Field(() => Date)
927
1243
  ], CandidateOutputDTO.prototype, "created_at", 2);
928
- __decorateClass$9([
1244
+ __decorateClass$i([
929
1245
  Field(() => Date, { nullable: true })
930
1246
  ], CandidateOutputDTO.prototype, "registered_at", 2);
931
- __decorateClass$9([
1247
+ __decorateClass$i([
932
1248
  Field(() => String, { nullable: true })
933
1249
  ], CandidateOutputDTO.prototype, "referer", 2);
934
- __decorateClass$9([
1250
+ __decorateClass$i([
935
1251
  Field(() => String, { nullable: true })
936
1252
  ], CandidateOutputDTO.prototype, "referer_display_name", 2);
937
- __decorateClass$9([
1253
+ __decorateClass$i([
938
1254
  Field(() => String)
939
1255
  ], CandidateOutputDTO.prototype, "public_key", 2);
940
- __decorateClass$9([
1256
+ __decorateClass$i([
941
1257
  Field(() => String, { nullable: true })
942
1258
  ], CandidateOutputDTO.prototype, "program_key", 2);
943
- CandidateOutputDTO = __decorateClass$9([
1259
+ CandidateOutputDTO = __decorateClass$i([
944
1260
  ObjectType("Candidate")
945
1261
  ], CandidateOutputDTO);
946
1262
 
947
- var __defProp$8 = Object.defineProperty;
948
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
949
- var __decorateClass$8 = (decorators, target, key, kind) => {
950
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
1263
+ var __defProp$h = Object.defineProperty;
1264
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
1265
+ var __decorateClass$h = (decorators, target, key, kind) => {
1266
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
951
1267
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
952
1268
  if (decorator = decorators[i])
953
1269
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
954
1270
  if (kind && result)
955
- __defProp$8(target, key, result);
1271
+ __defProp$h(target, key, result);
956
1272
  return result;
957
1273
  };
958
1274
  let CandidateFilterInputDTO = class {
959
1275
  };
960
- __decorateClass$8([
1276
+ __decorateClass$h([
961
1277
  Field(() => String, { nullable: true })
962
1278
  ], CandidateFilterInputDTO.prototype, "referer", 2);
963
- CandidateFilterInputDTO = __decorateClass$8([
1279
+ CandidateFilterInputDTO = __decorateClass$h([
964
1280
  InputType("CandidateFilterInput")
965
1281
  ], CandidateFilterInputDTO);
966
1282
 
@@ -1015,23 +1331,6 @@ function isExtensionAvailable(availability, isMainnet) {
1015
1331
  }
1016
1332
  }
1017
1333
 
1018
- let entities;
1019
- function registerExtensionEntities(list) {
1020
- if (entities) {
1021
- throw new Error(
1022
- // i18n-ignore: ошибка сборки приложения при старте, до пайщика не доходит
1023
- "\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"
1024
- );
1025
- }
1026
- entities = [...list];
1027
- }
1028
- function extensionEntities() {
1029
- return entities ?? [];
1030
- }
1031
- function resetExtensionEntities() {
1032
- entities = void 0;
1033
- }
1034
-
1035
1334
  let migrations;
1036
1335
  function registerExtensionDatabaseMigrations(list) {
1037
1336
  if (migrations) {
@@ -1049,38 +1348,67 @@ function resetExtensionDatabaseMigrations() {
1049
1348
  migrations = void 0;
1050
1349
  }
1051
1350
 
1052
- var __defProp$7 = Object.defineProperty;
1053
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
1054
- var __decorateClass$7 = (decorators, target, key, kind) => {
1055
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
1351
+ async function attachOne(records, related, property, keys) {
1352
+ if (records.length === 0)
1353
+ return;
1354
+ const pairs = Object.entries(keys);
1355
+ const read = (record, field) => record[field];
1356
+ const where = {};
1357
+ for (const [relatedField, ownField] of pairs) {
1358
+ const values = [...new Set(records.map((record) => read(record, ownField)).filter((value) => value !== null && value !== void 0))];
1359
+ if (values.length === 0)
1360
+ return;
1361
+ where[relatedField] = oneOf(values);
1362
+ }
1363
+ const found = await related.find(where);
1364
+ const signature = (record, side) => pairs.map((pair) => String(read(record, pair[side]))).join("\0");
1365
+ const index = /* @__PURE__ */ new Map();
1366
+ for (const candidate of found) {
1367
+ const key = signature(candidate, 0);
1368
+ if (!index.has(key))
1369
+ index.set(key, candidate);
1370
+ }
1371
+ for (const record of records) {
1372
+ const match = index.get(signature(record, 1));
1373
+ if (match)
1374
+ record[property] = match;
1375
+ }
1376
+ }
1377
+
1378
+ var __defProp$g = Object.defineProperty;
1379
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
1380
+ var __decorateClass$g = (decorators, target, key, kind) => {
1381
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
1056
1382
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
1057
1383
  if (decorator = decorators[i])
1058
1384
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1059
1385
  if (kind && result)
1060
- __defProp$7(target, key, result);
1386
+ __defProp$g(target, key, result);
1061
1387
  return result;
1062
1388
  };
1063
1389
  const SORT_FIELD_PATTERN = /^([A-Za-z_][A-Za-z0-9_]*(:(asc|desc))?)?$/i;
1064
1390
  let PaginationInputDTO = class {
1065
1391
  };
1066
- __decorateClass$7([
1392
+ __decorateClass$g([
1067
1393
  Field(() => Int, { description: "\u041D\u043E\u043C\u0435\u0440 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B", defaultValue: 1 })
1068
1394
  ], PaginationInputDTO.prototype, "page", 2);
1069
- __decorateClass$7([
1395
+ __decorateClass$g([
1070
1396
  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 })
1071
1397
  ], PaginationInputDTO.prototype, "limit", 2);
1072
- __decorateClass$7([
1398
+ __decorateClass$g([
1073
1399
  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")' }),
1074
1400
  IsOptional(),
1075
1401
  Matches(SORT_FIELD_PATTERN, { message: validationMessage("kit.pagination.invalidSortField") })
1076
1402
  ], PaginationInputDTO.prototype, "sortBy", 2);
1077
- __decorateClass$7([
1403
+ __decorateClass$g([
1078
1404
  Field(() => String, {
1079
1405
  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")',
1080
1406
  defaultValue: "ASC"
1081
- })
1407
+ }),
1408
+ IsOptional(),
1409
+ IsIn(["ASC", "DESC"], { message: validationMessage("kit.pagination.invalidSortOrder") })
1082
1410
  ], PaginationInputDTO.prototype, "sortOrder", 2);
1083
- PaginationInputDTO = __decorateClass$7([
1411
+ PaginationInputDTO = __decorateClass$g([
1084
1412
  InputType("PaginationInput")
1085
1413
  ], PaginationInputDTO);
1086
1414
  class PaginationResult {
@@ -1088,19 +1416,19 @@ class PaginationResult {
1088
1416
  function createPaginationResult(ItemType, name) {
1089
1417
  let PaginationResult2 = class {
1090
1418
  };
1091
- __decorateClass$7([
1419
+ __decorateClass$g([
1092
1420
  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" })
1093
1421
  ], PaginationResult2.prototype, "items", 2);
1094
- __decorateClass$7([
1422
+ __decorateClass$g([
1095
1423
  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" })
1096
1424
  ], PaginationResult2.prototype, "totalCount", 2);
1097
- __decorateClass$7([
1425
+ __decorateClass$g([
1098
1426
  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" })
1099
1427
  ], PaginationResult2.prototype, "totalPages", 2);
1100
- __decorateClass$7([
1428
+ __decorateClass$g([
1101
1429
  Field(() => Int, { description: "\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430" })
1102
1430
  ], PaginationResult2.prototype, "currentPage", 2);
1103
- PaginationResult2 = __decorateClass$7([
1431
+ PaginationResult2 = __decorateClass$g([
1104
1432
  ObjectType(`${name}PaginationResult`, { isAbstract: true })
1105
1433
  ], PaginationResult2);
1106
1434
  return PaginationResult2;
@@ -1146,16 +1474,16 @@ class PaginationUtils {
1146
1474
  static validatePaginationOptions(options) {
1147
1475
  const { page = 1, limit = 10, sortBy, sortOrder = "ASC" } = options;
1148
1476
  if (page < 1) {
1149
- throw DomainError.internal("KIT_PAGE_NUMBER_INVALID");
1477
+ throw DomainError.badRequest("KIT_PAGE_NUMBER_INVALID");
1150
1478
  }
1151
1479
  if (limit < 1 || limit > 1e3) {
1152
- throw DomainError.internal("KIT_PAGE_LIMIT_INVALID");
1480
+ throw DomainError.badRequest("KIT_PAGE_LIMIT_INVALID");
1153
1481
  }
1154
1482
  if (sortOrder !== "ASC" && sortOrder !== "DESC") {
1155
- throw DomainError.internal("KIT_SORT_ORDER_INVALID");
1483
+ throw DomainError.badRequest("KIT_SORT_ORDER_INVALID");
1156
1484
  }
1157
1485
  if (sortBy !== void 0 && sortBy !== null && !SORT_FIELD_PATTERN.test(sortBy)) {
1158
- throw DomainError.internal("KIT_SORT_FIELD_INVALID");
1486
+ throw DomainError.badRequest("KIT_SORT_FIELD_INVALID");
1159
1487
  }
1160
1488
  return {
1161
1489
  page,
@@ -1177,39 +1505,698 @@ function paginationInputToOffset(options) {
1177
1505
  };
1178
1506
  }
1179
1507
 
1180
- var __defProp$6 = Object.defineProperty;
1181
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
1182
- var __decorateClass$6 = (decorators, target, key, kind) => {
1183
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
1508
+ var __defProp$f = Object.defineProperty;
1509
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
1510
+ var __decorateClass$f = (decorators, target, key, kind) => {
1511
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
1184
1512
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
1185
1513
  if (decorator = decorators[i])
1186
1514
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1187
1515
  if (kind && result)
1188
- __defProp$6(target, key, result);
1516
+ __defProp$f(target, key, result);
1189
1517
  return result;
1190
1518
  };
1191
- let TransactionDTO = class {
1519
+ let Ledger2AccountDTO = class {
1192
1520
  };
1193
- __decorateClass$6([
1194
- 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 })
1195
- ], TransactionDTO.prototype, "chain", 2);
1196
- __decorateClass$6([
1197
- 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 })
1198
- ], TransactionDTO.prototype, "request", 2);
1199
- __decorateClass$6([
1200
- 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 })
1201
- ], TransactionDTO.prototype, "resolved", 2);
1202
- __decorateClass$6([
1203
- Field(() => GraphQLJSON, {
1204
- 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)",
1205
- nullable: true
1206
- })
1207
- ], TransactionDTO.prototype, "response", 2);
1208
- __decorateClass$6([
1209
- 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 })
1210
- ], TransactionDTO.prototype, "returns", 2);
1211
- __decorateClass$6([
1212
- 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 })
1521
+ __decorateClass$f([
1522
+ Field(() => Int, { description: "ID \u0441\u0447\u0451\u0442\u0430 (\xD71000 offset): 51000/80000/86000/..." })
1523
+ ], Ledger2AccountDTO.prototype, "id", 2);
1524
+ __decorateClass$f([
1525
+ Field(() => String, { description: "\u0420\u0443\u0441\u0441\u043A\u043E\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0441\u0447\u0451\u0442\u0430 \u0438\u0437 \u043F\u043B\u0430\u043D\u0430" })
1526
+ ], Ledger2AccountDTO.prototype, "name", 2);
1527
+ __decorateClass$f([
1528
+ Field(() => String, { description: '\u0421\u0430\u043B\u044C\u0434\u043E (EOSIO asset: "7000.0000 RUB")' })
1529
+ ], Ledger2AccountDTO.prototype, "balance", 2);
1530
+ __decorateClass$f([
1531
+ Field(() => String, { description: "\u0414\u0435\u0431\u0435\u0442\u043E\u0432\u044B\u0439 \u043E\u0431\u043E\u0440\u043E\u0442" })
1532
+ ], Ledger2AccountDTO.prototype, "debitBalance", 2);
1533
+ __decorateClass$f([
1534
+ Field(() => String, { description: "\u041A\u0440\u0435\u0434\u0438\u0442\u043E\u0432\u044B\u0439 \u043E\u0431\u043E\u0440\u043E\u0442" })
1535
+ ], Ledger2AccountDTO.prototype, "creditBalance", 2);
1536
+ __decorateClass$f([
1537
+ Field(() => Int, { description: "0 = active (\u0434\u0435\u0431\u0435\u0442\u043E\u0432\u044B\u0439), 1 = passive (\u043A\u0440\u0435\u0434\u0438\u0442\u043E\u0432\u044B\u0439)" })
1538
+ ], Ledger2AccountDTO.prototype, "accountType", 2);
1539
+ Ledger2AccountDTO = __decorateClass$f([
1540
+ ObjectType("Ledger2Account")
1541
+ ], Ledger2AccountDTO);
1542
+
1543
+ var __defProp$e = Object.defineProperty;
1544
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
1545
+ var __decorateClass$e = (decorators, target, key, kind) => {
1546
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
1547
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1548
+ if (decorator = decorators[i])
1549
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1550
+ if (kind && result)
1551
+ __defProp$e(target, key, result);
1552
+ return result;
1553
+ };
1554
+ let Ledger2WalletDTO = class {
1555
+ };
1556
+ __decorateClass$e([
1557
+ Field(() => String, { description: "eosio::name-\u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430 (w.<contract>.<waltype>)" })
1558
+ ], Ledger2WalletDTO.prototype, "id", 2);
1559
+ __decorateClass$e([
1560
+ Field(() => String, { description: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430" })
1561
+ ], Ledger2WalletDTO.prototype, "name", 2);
1562
+ __decorateClass$e([
1563
+ Field(() => String, { description: "\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0439 \u0431\u0430\u043B\u0430\u043D\u0441" })
1564
+ ], Ledger2WalletDTO.prototype, "available", 2);
1565
+ Ledger2WalletDTO = __decorateClass$e([
1566
+ ObjectType("Ledger2Wallet")
1567
+ ], Ledger2WalletDTO);
1568
+
1569
+ var __defProp$d = Object.defineProperty;
1570
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
1571
+ var __decorateClass$d = (decorators, target, key, kind) => {
1572
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
1573
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1574
+ if (decorator = decorators[i])
1575
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1576
+ if (kind && result)
1577
+ __defProp$d(target, key, result);
1578
+ return result;
1579
+ };
1580
+ let Ledger2OperationDTO = class {
1581
+ };
1582
+ __decorateClass$d([
1583
+ Field(() => String, {
1584
+ description: "global_sequence \u0431\u043B\u043E\u043A\u0447\u0435\u0439\u043D\u0430 (\u0441\u0442\u0440\u043E\u043A\u0430 \u2014 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0434\u043E 2^53 overflow)"
1585
+ })
1586
+ ], Ledger2OperationDTO.prototype, "globalSequence", 2);
1587
+ __decorateClass$d([
1588
+ Field(() => Int)
1589
+ ], Ledger2OperationDTO.prototype, "blockNum", 2);
1590
+ __decorateClass$d([
1591
+ Field(() => String)
1592
+ ], Ledger2OperationDTO.prototype, "coopname", 2);
1593
+ __decorateClass$d([
1594
+ Field(() => String, {
1595
+ description: "apply | walletop | debit | credit"
1596
+ })
1597
+ ], Ledger2OperationDTO.prototype, "action", 2);
1598
+ __decorateClass$d([
1599
+ Field(() => String, {
1600
+ nullable: true,
1601
+ description: "\u0414\u043B\u044F apply: OPERATION_REGISTRY code (o.cap.lend / o.wal.depcpl / ...)"
1602
+ })
1603
+ ], Ledger2OperationDTO.prototype, "operationCode", 2);
1604
+ __decorateClass$d([
1605
+ Field(() => String, { nullable: true, description: "process_hash (32-hex)" })
1606
+ ], Ledger2OperationDTO.prototype, "processHash", 2);
1607
+ __decorateClass$d([
1608
+ Field(() => String, { nullable: true })
1609
+ ], Ledger2OperationDTO.prototype, "username", 2);
1610
+ __decorateClass$d([
1611
+ Field(() => Int, { nullable: true, description: "ID \u0441\u0447\u0451\u0442\u0430/\u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430 (\xD71000)" })
1612
+ ], Ledger2OperationDTO.prototype, "accountId", 2);
1613
+ __decorateClass$d([
1614
+ Field(() => String, { nullable: true, description: "walletop: wallet_from (eosio::name w.<contract>.<waltype>)" })
1615
+ ], Ledger2OperationDTO.prototype, "walletFrom", 2);
1616
+ __decorateClass$d([
1617
+ Field(() => String, { nullable: true, description: "walletop: wallet_to (eosio::name w.<contract>.<waltype>)" })
1618
+ ], Ledger2OperationDTO.prototype, "walletTo", 2);
1619
+ __decorateClass$d([
1620
+ Field(() => String, { nullable: true, description: 'Asset "100.0000 RUB"' })
1621
+ ], Ledger2OperationDTO.prototype, "quantity", 2);
1622
+ __decorateClass$d([
1623
+ Field(() => String, { nullable: true })
1624
+ ], Ledger2OperationDTO.prototype, "memo", 2);
1625
+ __decorateClass$d([
1626
+ Field(() => String, {
1627
+ nullable: true,
1628
+ description: "global_sequence \u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E apply (parser2: transaction_id + action_ordinal=this.creator_action_ordinal) \u2014 \u0434\u043B\u044F \u0442\u043E\u0447\u0435\u0447\u043D\u043E\u0433\u043E cross-link \u043D\u0430 \u043A\u043E\u043D\u043A\u0440\u0435\u0442\u043D\u0443\u044E \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044E."
1629
+ })
1630
+ ], Ledger2OperationDTO.prototype, "parentApplyGlobalSequence", 2);
1631
+ __decorateClass$d([
1632
+ Field(() => Date)
1633
+ ], Ledger2OperationDTO.prototype, "createdAt", 2);
1634
+ Ledger2OperationDTO = __decorateClass$d([
1635
+ ObjectType("Ledger2Operation")
1636
+ ], Ledger2OperationDTO);
1637
+ let Ledger2HistoryResponseDTO = class {
1638
+ };
1639
+ __decorateClass$d([
1640
+ Field(() => [Ledger2OperationDTO])
1641
+ ], Ledger2HistoryResponseDTO.prototype, "items", 2);
1642
+ __decorateClass$d([
1643
+ Field(() => Int)
1644
+ ], Ledger2HistoryResponseDTO.prototype, "totalCount", 2);
1645
+ __decorateClass$d([
1646
+ Field(() => Int)
1647
+ ], Ledger2HistoryResponseDTO.prototype, "totalPages", 2);
1648
+ __decorateClass$d([
1649
+ Field(() => Int)
1650
+ ], Ledger2HistoryResponseDTO.prototype, "currentPage", 2);
1651
+ Ledger2HistoryResponseDTO = __decorateClass$d([
1652
+ ObjectType("Ledger2HistoryResponse")
1653
+ ], Ledger2HistoryResponseDTO);
1654
+
1655
+ var __defProp$c = Object.defineProperty;
1656
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
1657
+ var __decorateClass$c = (decorators, target, key, kind) => {
1658
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
1659
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1660
+ if (decorator = decorators[i])
1661
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1662
+ if (kind && result)
1663
+ __defProp$c(target, key, result);
1664
+ return result;
1665
+ };
1666
+ let Ledger2PostingDTO = class {
1667
+ };
1668
+ __decorateClass$c([
1669
+ Field(() => String, { description: "\u0421\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0434\u043B\u044F UI: debitSeq_creditSeq" })
1670
+ ], Ledger2PostingDTO.prototype, "key", 2);
1671
+ __decorateClass$c([
1672
+ Field(() => Int)
1673
+ ], Ledger2PostingDTO.prototype, "blockNum", 2);
1674
+ __decorateClass$c([
1675
+ Field(() => String, { nullable: true, description: "process_hash (32-hex)" })
1676
+ ], Ledger2PostingDTO.prototype, "processHash", 2);
1677
+ __decorateClass$c([
1678
+ Field(() => String, {
1679
+ nullable: true,
1680
+ description: "OPERATION_REGISTRY \u043A\u043E\u0434 \u0438\u0437 parent apply (`o.cap.lend` / `o.wal.depcpl` / ...)"
1681
+ })
1682
+ ], Ledger2PostingDTO.prototype, "operationCode", 2);
1683
+ __decorateClass$c([
1684
+ Field(() => String, {
1685
+ nullable: true,
1686
+ description: "global_sequence parent apply (\u0434\u043B\u044F cross-link \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0439)"
1687
+ })
1688
+ ], Ledger2PostingDTO.prototype, "parentApplyGlobalSequence", 2);
1689
+ __decorateClass$c([
1690
+ Field(() => String, { nullable: true, description: "global_sequence debit-action" })
1691
+ ], Ledger2PostingDTO.prototype, "debitGlobalSequence", 2);
1692
+ __decorateClass$c([
1693
+ Field(() => Int, { nullable: true, description: "id \u0431\u0443\u0445.\u0441\u0447\u0451\u0442\u0430 debit (\xD71000)" })
1694
+ ], Ledger2PostingDTO.prototype, "debitAccountId", 2);
1695
+ __decorateClass$c([
1696
+ Field(() => String, { nullable: true, description: "global_sequence credit-action" })
1697
+ ], Ledger2PostingDTO.prototype, "creditGlobalSequence", 2);
1698
+ __decorateClass$c([
1699
+ Field(() => Int, { nullable: true, description: "id \u0431\u0443\u0445.\u0441\u0447\u0451\u0442\u0430 credit (\xD71000)" })
1700
+ ], Ledger2PostingDTO.prototype, "creditAccountId", 2);
1701
+ __decorateClass$c([
1702
+ Field(() => String, { nullable: true, description: 'Asset "100.0000 RUB"' })
1703
+ ], Ledger2PostingDTO.prototype, "quantity", 2);
1704
+ __decorateClass$c([
1705
+ Field(() => String, { nullable: true })
1706
+ ], Ledger2PostingDTO.prototype, "memo", 2);
1707
+ __decorateClass$c([
1708
+ Field(() => String, { nullable: true })
1709
+ ], Ledger2PostingDTO.prototype, "username", 2);
1710
+ __decorateClass$c([
1711
+ Field(() => Date)
1712
+ ], Ledger2PostingDTO.prototype, "createdAt", 2);
1713
+ Ledger2PostingDTO = __decorateClass$c([
1714
+ ObjectType("Ledger2Posting")
1715
+ ], Ledger2PostingDTO);
1716
+ let Ledger2PostingsResponseDTO = class {
1717
+ };
1718
+ __decorateClass$c([
1719
+ Field(() => [Ledger2PostingDTO])
1720
+ ], Ledger2PostingsResponseDTO.prototype, "items", 2);
1721
+ __decorateClass$c([
1722
+ Field(() => Int)
1723
+ ], Ledger2PostingsResponseDTO.prototype, "totalCount", 2);
1724
+ __decorateClass$c([
1725
+ Field(() => Int)
1726
+ ], Ledger2PostingsResponseDTO.prototype, "totalPages", 2);
1727
+ __decorateClass$c([
1728
+ Field(() => Int)
1729
+ ], Ledger2PostingsResponseDTO.prototype, "currentPage", 2);
1730
+ Ledger2PostingsResponseDTO = __decorateClass$c([
1731
+ ObjectType("Ledger2PostingsResponse")
1732
+ ], Ledger2PostingsResponseDTO);
1733
+
1734
+ var __defProp$b = Object.defineProperty;
1735
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
1736
+ var __decorateClass$b = (decorators, target, key, kind) => {
1737
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
1738
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1739
+ if (decorator = decorators[i])
1740
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1741
+ if (kind && result)
1742
+ __defProp$b(target, key, result);
1743
+ return result;
1744
+ };
1745
+ let GetLedger2HistoryInputDTO = class {
1746
+ };
1747
+ __decorateClass$b([
1748
+ Field(() => String),
1749
+ IsString()
1750
+ ], GetLedger2HistoryInputDTO.prototype, "coopname", 2);
1751
+ __decorateClass$b([
1752
+ Field(() => Int, { nullable: true, description: "\u0411\u0443\u0445.\u0441\u0447\u0451\u0442 (\xD71000): 51000/80000/86000 \u2014 \u0434\u043B\u044F debit/credit \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439." }),
1753
+ IsOptional(),
1754
+ IsInt()
1755
+ ], GetLedger2HistoryInputDTO.prototype, "accountId", 2);
1756
+ __decorateClass$b([
1757
+ Field(() => String, {
1758
+ nullable: true,
1759
+ description: "eosio::name \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430 (`w.<contract>.<waltype>`) \u2014 \u0434\u043B\u044F walletop \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439."
1760
+ }),
1761
+ IsOptional(),
1762
+ IsString(),
1763
+ MaxLength(13)
1764
+ ], GetLedger2HistoryInputDTO.prototype, "walletName", 2);
1765
+ __decorateClass$b([
1766
+ Field(() => [String], {
1767
+ nullable: true,
1768
+ description: "\u0418\u043C\u0435\u043D\u0430 blockchain-\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439: apply | walletop | debit | credit"
1769
+ }),
1770
+ IsOptional(),
1771
+ IsArray(),
1772
+ IsString({ each: true })
1773
+ ], GetLedger2HistoryInputDTO.prototype, "actionNames", 2);
1774
+ __decorateClass$b([
1775
+ Field(() => [String], {
1776
+ nullable: true,
1777
+ description: "OPERATION_REGISTRY \u043A\u043E\u0434\u044B: o.cap.lend, o.wal.depcpl, o.mig.minshr \u0438 \u0442.\u0434."
1778
+ }),
1779
+ IsOptional(),
1780
+ IsArray(),
1781
+ IsString({ each: true })
1782
+ ], GetLedger2HistoryInputDTO.prototype, "operationCodes", 2);
1783
+ __decorateClass$b([
1784
+ Field(() => String, { nullable: true }),
1785
+ IsOptional(),
1786
+ IsString(),
1787
+ MaxLength(64)
1788
+ ], GetLedger2HistoryInputDTO.prototype, "username", 2);
1789
+ __decorateClass$b([
1790
+ Field(() => String, { nullable: true, description: "process_hash (hex-64) \u0434\u043B\u044F \u0432\u044B\u0431\u043E\u0440\u043A\u0438 \u0432\u0441\u0435\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043E\u0434\u043D\u043E\u0439 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438" }),
1791
+ IsOptional(),
1792
+ IsString(),
1793
+ MaxLength(66),
1794
+ Matches(/^[0-9a-fA-F]{64}$/, {
1795
+ message: validationMessage("ledger2.getLedger2HistoryInput.processHashInvalidFormat")
1796
+ })
1797
+ ], GetLedger2HistoryInputDTO.prototype, "processHash", 2);
1798
+ __decorateClass$b([
1799
+ Field(() => String, {
1800
+ nullable: true,
1801
+ description: "global_sequence \u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E apply: \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E inline-\u0441\u0438\u0431\u0441\u043E\u0432 (walletop/debit/credit) \u044D\u0442\u043E\u0433\u043E apply \u0447\u0435\u0440\u0435\u0437 \u0442\u043E\u0447\u0435\u0447\u043D\u0443\u044E \u0441\u0432\u044F\u0437\u044C parser2 (transaction_id + creator_action_ordinal=apply.action_ordinal)."
1802
+ }),
1803
+ IsOptional(),
1804
+ IsString(),
1805
+ MaxLength(24)
1806
+ ], GetLedger2HistoryInputDTO.prototype, "parentApplyGlobalSequence", 2);
1807
+ __decorateClass$b([
1808
+ Field(() => String, {
1809
+ nullable: true,
1810
+ description: "\u2116 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 = apply.global_sequence. \u0422\u043E\u0447\u0435\u0447\u043D\u0430\u044F \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044F \u043E\u0434\u043D\u043E\u0439 apply-\u0433\u0440\u0443\u043F\u043F\u044B (apply + walletop/debit/credit)."
1811
+ }),
1812
+ IsOptional(),
1813
+ IsString(),
1814
+ MaxLength(24)
1815
+ ], GetLedger2HistoryInputDTO.prototype, "applyGlobalSequence", 2);
1816
+ __decorateClass$b([
1817
+ Field(() => String, {
1818
+ nullable: true,
1819
+ description: "\u2116 \u0434\u0432\u0438\u0436\u0435\u043D\u0438\u044F \u043F\u043E \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0443 = walletop.global_sequence. \u0423\u043D\u0438\u043A\u0430\u043B\u0435\u043D."
1820
+ }),
1821
+ IsOptional(),
1822
+ IsString(),
1823
+ MaxLength(24)
1824
+ ], GetLedger2HistoryInputDTO.prototype, "walletopGlobalSequence", 2);
1825
+ __decorateClass$b([
1826
+ Field(() => Date, { nullable: true }),
1827
+ IsOptional(),
1828
+ IsDate(),
1829
+ Type(() => Date)
1830
+ ], GetLedger2HistoryInputDTO.prototype, "dateFrom", 2);
1831
+ __decorateClass$b([
1832
+ Field(() => Date, { nullable: true }),
1833
+ IsOptional(),
1834
+ IsDate(),
1835
+ Type(() => Date)
1836
+ ], GetLedger2HistoryInputDTO.prototype, "dateTo", 2);
1837
+ __decorateClass$b([
1838
+ Field(() => Int, { nullable: true, defaultValue: 1 }),
1839
+ IsOptional(),
1840
+ IsInt(),
1841
+ Min(1)
1842
+ ], GetLedger2HistoryInputDTO.prototype, "page", 2);
1843
+ __decorateClass$b([
1844
+ Field(() => Int, { nullable: true, defaultValue: 50 }),
1845
+ IsOptional(),
1846
+ IsInt(),
1847
+ Min(1),
1848
+ Max(500)
1849
+ ], GetLedger2HistoryInputDTO.prototype, "limit", 2);
1850
+ __decorateClass$b([
1851
+ Field(() => String, { nullable: true, defaultValue: "DESC" }),
1852
+ IsOptional(),
1853
+ IsIn(["ASC", "DESC"])
1854
+ ], GetLedger2HistoryInputDTO.prototype, "sortOrder", 2);
1855
+ GetLedger2HistoryInputDTO = __decorateClass$b([
1856
+ InputType("GetLedger2HistoryInput")
1857
+ ], GetLedger2HistoryInputDTO);
1858
+
1859
+ var __defProp$a = Object.defineProperty;
1860
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
1861
+ var __decorateClass$a = (decorators, target, key, kind) => {
1862
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
1863
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1864
+ if (decorator = decorators[i])
1865
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1866
+ if (kind && result)
1867
+ __defProp$a(target, key, result);
1868
+ return result;
1869
+ };
1870
+ let GetLedger2PostingsInputDTO = class {
1871
+ };
1872
+ __decorateClass$a([
1873
+ Field(() => String),
1874
+ IsString()
1875
+ ], GetLedger2PostingsInputDTO.prototype, "coopname", 2);
1876
+ __decorateClass$a([
1877
+ Field(() => Int, {
1878
+ nullable: true,
1879
+ description: "\u0411\u0443\u0445.\u0441\u0447\u0451\u0442 (\xD71000) \u2014 \u043F\u043E\u043F\u0430\u0434\u0430\u043D\u0438\u0435 \u0432 debit \u0418\u041B\u0418 credit \u043D\u043E\u0433\u0435 \u043F\u0440\u043E\u0432\u043E\u0434\u043A\u0438."
1880
+ }),
1881
+ IsOptional(),
1882
+ IsInt()
1883
+ ], GetLedger2PostingsInputDTO.prototype, "accountId", 2);
1884
+ __decorateClass$a([
1885
+ Field(() => String, { nullable: true }),
1886
+ IsOptional(),
1887
+ IsString(),
1888
+ MaxLength(64)
1889
+ ], GetLedger2PostingsInputDTO.prototype, "username", 2);
1890
+ __decorateClass$a([
1891
+ Field(() => String, { nullable: true, description: "process_hash \u0434\u043B\u044F \u0432\u044B\u0431\u043E\u0440\u043A\u0438 \u0432\u0441\u0435\u0445 \u043F\u0440\u043E\u0432\u043E\u0434\u043E\u043A \u043E\u0434\u043D\u043E\u0439 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438" }),
1892
+ IsOptional(),
1893
+ IsString(),
1894
+ MaxLength(66)
1895
+ ], GetLedger2PostingsInputDTO.prototype, "processHash", 2);
1896
+ __decorateClass$a([
1897
+ Field(() => String, {
1898
+ nullable: true,
1899
+ description: "\u2116 \u043F\u0440\u043E\u0432\u043E\u0434\u043A\u0438 = debit.global_sequence (unique). \u041F\u0430\u0440\u043D\u044B\u0439 credit \u043F\u043E\u0434\u0442\u044F\u043D\u0435\u0442\u0441\u044F \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438."
1900
+ }),
1901
+ IsOptional(),
1902
+ IsString(),
1903
+ MaxLength(24)
1904
+ ], GetLedger2PostingsInputDTO.prototype, "debitGlobalSequence", 2);
1905
+ __decorateClass$a([
1906
+ Field(() => String, {
1907
+ nullable: true,
1908
+ description: "\u2116 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 = apply.global_sequence. \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043F\u0440\u043E\u0432\u043E\u0434\u043A\u0438 \u0440\u043E\u0432\u043D\u043E \u044D\u0442\u043E\u0439 apply-\u0433\u0440\u0443\u043F\u043F\u044B."
1909
+ }),
1910
+ IsOptional(),
1911
+ IsString(),
1912
+ MaxLength(24)
1913
+ ], GetLedger2PostingsInputDTO.prototype, "applyGlobalSequence", 2);
1914
+ __decorateClass$a([
1915
+ Field(() => Date, { nullable: true }),
1916
+ IsOptional(),
1917
+ IsDate(),
1918
+ Type(() => Date)
1919
+ ], GetLedger2PostingsInputDTO.prototype, "dateFrom", 2);
1920
+ __decorateClass$a([
1921
+ Field(() => Date, { nullable: true }),
1922
+ IsOptional(),
1923
+ IsDate(),
1924
+ Type(() => Date)
1925
+ ], GetLedger2PostingsInputDTO.prototype, "dateTo", 2);
1926
+ __decorateClass$a([
1927
+ Field(() => Int, { nullable: true, defaultValue: 1 }),
1928
+ IsOptional(),
1929
+ IsInt(),
1930
+ Min(1)
1931
+ ], GetLedger2PostingsInputDTO.prototype, "page", 2);
1932
+ __decorateClass$a([
1933
+ Field(() => Int, { nullable: true, defaultValue: 50 }),
1934
+ IsOptional(),
1935
+ IsInt(),
1936
+ Min(1),
1937
+ Max(500)
1938
+ ], GetLedger2PostingsInputDTO.prototype, "limit", 2);
1939
+ __decorateClass$a([
1940
+ Field(() => String, { nullable: true, defaultValue: "DESC" }),
1941
+ IsOptional(),
1942
+ IsIn(["ASC", "DESC"])
1943
+ ], GetLedger2PostingsInputDTO.prototype, "sortOrder", 2);
1944
+ GetLedger2PostingsInputDTO = __decorateClass$a([
1945
+ InputType("GetLedger2PostingsInput")
1946
+ ], GetLedger2PostingsInputDTO);
1947
+
1948
+ var __defProp$9 = Object.defineProperty;
1949
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
1950
+ var __decorateClass$9 = (decorators, target, key, kind) => {
1951
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
1952
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1953
+ if (decorator = decorators[i])
1954
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1955
+ if (kind && result)
1956
+ __defProp$9(target, key, result);
1957
+ return result;
1958
+ };
1959
+ let ProcessesFilterInput = class {
1960
+ };
1961
+ __decorateClass$9([
1962
+ Field(() => String)
1963
+ ], ProcessesFilterInput.prototype, "coopname", 2);
1964
+ __decorateClass$9([
1965
+ Field(() => String, { nullable: true })
1966
+ ], ProcessesFilterInput.prototype, "processType", 2);
1967
+ __decorateClass$9([
1968
+ Field(() => String, { nullable: true })
1969
+ ], ProcessesFilterInput.prototype, "username", 2);
1970
+ __decorateClass$9([
1971
+ Field(() => String, { nullable: true, description: "\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430 \u2014 \u0442\u043E\u0447\u0435\u0447\u043D\u0430\u044F \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044F \u043E\u0434\u043D\u043E\u0433\u043E \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430 \u043F\u043E \u0435\u0433\u043E \u0445\u044D\u0448\u0443" })
1972
+ ], ProcessesFilterInput.prototype, "processHash", 2);
1973
+ __decorateClass$9([
1974
+ Field(() => Int, { nullable: true })
1975
+ ], ProcessesFilterInput.prototype, "fromBlock", 2);
1976
+ __decorateClass$9([
1977
+ Field(() => Int, { nullable: true })
1978
+ ], ProcessesFilterInput.prototype, "toBlock", 2);
1979
+ ProcessesFilterInput = __decorateClass$9([
1980
+ InputType("ProcessesFilter")
1981
+ ], ProcessesFilterInput);
1982
+
1983
+ var __defProp$8 = Object.defineProperty;
1984
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
1985
+ var __decorateClass$8 = (decorators, target, key, kind) => {
1986
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
1987
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1988
+ if (decorator = decorators[i])
1989
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1990
+ if (kind && result)
1991
+ __defProp$8(target, key, result);
1992
+ return result;
1993
+ };
1994
+ let ProcessSummaryDTO = class {
1995
+ // actionCount/deltaCount/documentCount удалены: N+1 counters на каждой
1996
+ // странице listProcesses были запросы 300+ на request. UI читает
1997
+ // getProcess(hash) при раскрытии — там счётчики выводимы из массивов.
1998
+ };
1999
+ __decorateClass$8([
2000
+ Field(() => String)
2001
+ ], ProcessSummaryDTO.prototype, "processType", 2);
2002
+ __decorateClass$8([
2003
+ Field(() => String)
2004
+ ], ProcessSummaryDTO.prototype, "processHash", 2);
2005
+ __decorateClass$8([
2006
+ Field(() => String)
2007
+ ], ProcessSummaryDTO.prototype, "coopname", 2);
2008
+ __decorateClass$8([
2009
+ Field(() => String, { nullable: true })
2010
+ ], ProcessSummaryDTO.prototype, "username", 2);
2011
+ __decorateClass$8([
2012
+ Field(() => Date)
2013
+ ], ProcessSummaryDTO.prototype, "firstSeenAt", 2);
2014
+ __decorateClass$8([
2015
+ Field(() => Date)
2016
+ ], ProcessSummaryDTO.prototype, "lastSeenAt", 2);
2017
+ __decorateClass$8([
2018
+ Field(() => String, { nullable: true, description: "\u0421\u0443\u043C\u043C\u0430 \u0433\u043B\u0430\u0432\u043D\u043E\u0439 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430 \u2014 \u043D\u0430\u0438\u0431\u043E\u043B\u044C\u0448\u0430\u044F \u0441\u0440\u0435\u0434\u0438 \u0435\u0433\u043E \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0439" })
2019
+ ], ProcessSummaryDTO.prototype, "amount", 2);
2020
+ __decorateClass$8([
2021
+ Field(() => String, { nullable: true, description: "\u041D\u0430\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0433\u043B\u0430\u0432\u043D\u043E\u0439 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430" })
2022
+ ], ProcessSummaryDTO.prototype, "memo", 2);
2023
+ ProcessSummaryDTO = __decorateClass$8([
2024
+ ObjectType("ProcessSummary")
2025
+ ], ProcessSummaryDTO);
2026
+ const PaginatedProcessSummary = createPaginationResult(ProcessSummaryDTO, "ProcessSummary");
2027
+
2028
+ var __defProp$7 = Object.defineProperty;
2029
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
2030
+ var __decorateClass$7 = (decorators, target, key, kind) => {
2031
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
2032
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2033
+ if (decorator = decorators[i])
2034
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2035
+ if (kind && result)
2036
+ __defProp$7(target, key, result);
2037
+ return result;
2038
+ };
2039
+ let ProcessActionDTO = class {
2040
+ };
2041
+ __decorateClass$7([
2042
+ Field(() => String)
2043
+ ], ProcessActionDTO.prototype, "id", 2);
2044
+ __decorateClass$7([
2045
+ Field(() => String)
2046
+ ], ProcessActionDTO.prototype, "account", 2);
2047
+ __decorateClass$7([
2048
+ Field(() => String)
2049
+ ], ProcessActionDTO.prototype, "name", 2);
2050
+ __decorateClass$7([
2051
+ Field(() => GraphQLJSON$1, { nullable: true })
2052
+ ], ProcessActionDTO.prototype, "data", 2);
2053
+ __decorateClass$7([
2054
+ Field(() => Number)
2055
+ ], ProcessActionDTO.prototype, "block_num", 2);
2056
+ __decorateClass$7([
2057
+ Field(() => String)
2058
+ ], ProcessActionDTO.prototype, "block_id", 2);
2059
+ __decorateClass$7([
2060
+ Field(() => String)
2061
+ ], ProcessActionDTO.prototype, "global_sequence", 2);
2062
+ __decorateClass$7([
2063
+ Field(() => String)
2064
+ ], ProcessActionDTO.prototype, "transaction_id", 2);
2065
+ __decorateClass$7([
2066
+ Field(() => Date)
2067
+ ], ProcessActionDTO.prototype, "created_at", 2);
2068
+ ProcessActionDTO = __decorateClass$7([
2069
+ ObjectType("ProcessAction")
2070
+ ], ProcessActionDTO);
2071
+ let ProcessDeltaDTO = class {
2072
+ };
2073
+ __decorateClass$7([
2074
+ Field(() => String)
2075
+ ], ProcessDeltaDTO.prototype, "id", 2);
2076
+ __decorateClass$7([
2077
+ Field(() => String)
2078
+ ], ProcessDeltaDTO.prototype, "code", 2);
2079
+ __decorateClass$7([
2080
+ Field(() => String)
2081
+ ], ProcessDeltaDTO.prototype, "scope", 2);
2082
+ __decorateClass$7([
2083
+ Field(() => String)
2084
+ ], ProcessDeltaDTO.prototype, "table", 2);
2085
+ __decorateClass$7([
2086
+ Field(() => String)
2087
+ ], ProcessDeltaDTO.prototype, "primary_key", 2);
2088
+ __decorateClass$7([
2089
+ Field(() => Boolean)
2090
+ ], ProcessDeltaDTO.prototype, "present", 2);
2091
+ __decorateClass$7([
2092
+ Field(() => GraphQLJSON$1, { nullable: true })
2093
+ ], ProcessDeltaDTO.prototype, "value", 2);
2094
+ __decorateClass$7([
2095
+ Field(() => Number)
2096
+ ], ProcessDeltaDTO.prototype, "block_num", 2);
2097
+ __decorateClass$7([
2098
+ Field(() => Date)
2099
+ ], ProcessDeltaDTO.prototype, "created_at", 2);
2100
+ ProcessDeltaDTO = __decorateClass$7([
2101
+ ObjectType("ProcessDelta")
2102
+ ], ProcessDeltaDTO);
2103
+ let ProcessDocumentSourceDTO = class {
2104
+ };
2105
+ __decorateClass$7([
2106
+ Field(() => String)
2107
+ ], ProcessDocumentSourceDTO.prototype, "code", 2);
2108
+ __decorateClass$7([
2109
+ Field(() => String)
2110
+ ], ProcessDocumentSourceDTO.prototype, "table", 2);
2111
+ __decorateClass$7([
2112
+ Field(() => String)
2113
+ ], ProcessDocumentSourceDTO.prototype, "field", 2);
2114
+ __decorateClass$7([
2115
+ Field(() => String)
2116
+ ], ProcessDocumentSourceDTO.prototype, "primary_key", 2);
2117
+ ProcessDocumentSourceDTO = __decorateClass$7([
2118
+ ObjectType("ProcessDocumentSource")
2119
+ ], ProcessDocumentSourceDTO);
2120
+ let ProcessDocumentDTO = class {
2121
+ };
2122
+ __decorateClass$7([
2123
+ Field(() => String)
2124
+ ], ProcessDocumentDTO.prototype, "hash", 2);
2125
+ __decorateClass$7([
2126
+ Field(() => ProcessDocumentSourceDTO)
2127
+ ], ProcessDocumentDTO.prototype, "source", 2);
2128
+ __decorateClass$7([
2129
+ Field(() => GraphQLJSON$1)
2130
+ ], ProcessDocumentDTO.prototype, "document", 2);
2131
+ __decorateClass$7([
2132
+ Field(() => GraphQLJSON$1, { nullable: true })
2133
+ ], ProcessDocumentDTO.prototype, "raw", 2);
2134
+ ProcessDocumentDTO = __decorateClass$7([
2135
+ ObjectType("ProcessDocument")
2136
+ ], ProcessDocumentDTO);
2137
+ let ProcessViewDTO = class {
2138
+ };
2139
+ __decorateClass$7([
2140
+ Field(() => String)
2141
+ ], ProcessViewDTO.prototype, "process_type", 2);
2142
+ __decorateClass$7([
2143
+ Field(() => String)
2144
+ ], ProcessViewDTO.prototype, "process_hash", 2);
2145
+ __decorateClass$7([
2146
+ Field(() => String)
2147
+ ], ProcessViewDTO.prototype, "coopname", 2);
2148
+ __decorateClass$7([
2149
+ Field(() => Date)
2150
+ ], ProcessViewDTO.prototype, "first_seen_at", 2);
2151
+ __decorateClass$7([
2152
+ Field(() => Date)
2153
+ ], ProcessViewDTO.prototype, "last_seen_at", 2);
2154
+ __decorateClass$7([
2155
+ Field(() => [ProcessActionDTO])
2156
+ ], ProcessViewDTO.prototype, "actions", 2);
2157
+ __decorateClass$7([
2158
+ Field(() => [ProcessDeltaDTO])
2159
+ ], ProcessViewDTO.prototype, "delta_history", 2);
2160
+ __decorateClass$7([
2161
+ Field(() => [ProcessDocumentDTO])
2162
+ ], ProcessViewDTO.prototype, "documents", 2);
2163
+ ProcessViewDTO = __decorateClass$7([
2164
+ ObjectType("ProcessView")
2165
+ ], ProcessViewDTO);
2166
+
2167
+ var __defProp$6 = Object.defineProperty;
2168
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
2169
+ var __decorateClass$6 = (decorators, target, key, kind) => {
2170
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
2171
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2172
+ if (decorator = decorators[i])
2173
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2174
+ if (kind && result)
2175
+ __defProp$6(target, key, result);
2176
+ return result;
2177
+ };
2178
+ let TransactionDTO = class {
2179
+ };
2180
+ __decorateClass$6([
2181
+ 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 })
2182
+ ], TransactionDTO.prototype, "chain", 2);
2183
+ __decorateClass$6([
2184
+ 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 })
2185
+ ], TransactionDTO.prototype, "request", 2);
2186
+ __decorateClass$6([
2187
+ 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 })
2188
+ ], TransactionDTO.prototype, "resolved", 2);
2189
+ __decorateClass$6([
2190
+ Field(() => GraphQLJSON, {
2191
+ 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)",
2192
+ nullable: true
2193
+ })
2194
+ ], TransactionDTO.prototype, "response", 2);
2195
+ __decorateClass$6([
2196
+ 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 })
2197
+ ], TransactionDTO.prototype, "returns", 2);
2198
+ __decorateClass$6([
2199
+ 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 })
1213
2200
  ], TransactionDTO.prototype, "revisions", 2);
1214
2201
  __decorateClass$6([
1215
2202
  Field(() => GraphQLJSON, { description: "\u041F\u043E\u0434\u043F\u0438\u0441\u0438 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438", nullable: true })
@@ -1525,7 +2512,7 @@ class CurrencyValidationUtil {
1525
2512
  static validateCurrencySymbol(amount, fieldName = t("kit.currency.defaultFieldName")) {
1526
2513
  if (!this.hasValidCurrencySymbol(amount)) {
1527
2514
  const expectedSymbol = platformSettings().blockchain.rootGovernSymbol;
1528
- throw DomainError.internal("KIT_CURRENCY_SYMBOL_INVALID", { fieldName, expectedSymbol });
2515
+ throw DomainError.badRequest("KIT_CURRENCY_SYMBOL_INVALID", { fieldName, expectedSymbol });
1529
2516
  }
1530
2517
  }
1531
2518
  /**
@@ -1670,12 +2657,12 @@ let DomainToBlockchainUtils = class {
1670
2657
  formatQuantityWithPrecision(quantity) {
1671
2658
  const parts = quantity.split(" ");
1672
2659
  if (parts.length !== 2) {
1673
- throw DomainError.internal("KIT_QUANTITY_FORMAT_INVALID", { quantity });
2660
+ throw DomainError.badRequest("KIT_QUANTITY_FORMAT_INVALID", { quantity });
1674
2661
  }
1675
2662
  const [amount, symbol] = parts;
1676
2663
  const numericAmount = parseFloat(amount);
1677
2664
  if (isNaN(numericAmount)) {
1678
- throw DomainError.internal("KIT_QUANTITY_AMOUNT_INVALID", { amount });
2665
+ throw DomainError.badRequest("KIT_QUANTITY_AMOUNT_INVALID", { amount });
1679
2666
  }
1680
2667
  const { rootSymbol, rootPrecision, rootGovernSymbol, rootGovernPrecision } = platformSettings().blockchain;
1681
2668
  let precision;
@@ -1684,7 +2671,7 @@ let DomainToBlockchainUtils = class {
1684
2671
  } else if (symbol === rootGovernSymbol) {
1685
2672
  precision = rootGovernPrecision;
1686
2673
  } else {
1687
- throw DomainError.internal("KIT_SYMBOL_UNSUPPORTED", { symbol, rootSymbol, rootGovernSymbol });
2674
+ throw DomainError.badRequest("KIT_SYMBOL_UNSUPPORTED", { symbol, rootSymbol, rootGovernSymbol });
1688
2675
  }
1689
2676
  return `${numericAmount.toFixed(precision)} ${symbol}`;
1690
2677
  }
@@ -1692,10 +2679,10 @@ let DomainToBlockchainUtils = class {
1692
2679
  formatNumericStringToAssetString(numericString, precision, symbol) {
1693
2680
  const numericValue = parseFloat(numericString);
1694
2681
  if (isNaN(numericValue)) {
1695
- throw DomainError.internal("KIT_NUMBER_INVALID", { value: numericString });
2682
+ throw DomainError.badRequest("KIT_NUMBER_INVALID", { value: numericString });
1696
2683
  }
1697
2684
  if (numericValue < 0) {
1698
- throw DomainError.internal("KIT_NUMBER_NEGATIVE", { value: numericString });
2685
+ throw DomainError.badRequest("KIT_NUMBER_NEGATIVE", { value: numericString });
1699
2686
  }
1700
2687
  return `${numericValue.toFixed(precision)} ${symbol}`;
1701
2688
  }
@@ -1726,7 +2713,7 @@ DomainToBlockchainUtils = __decorateClass([
1726
2713
  Injectable()
1727
2714
  ], DomainToBlockchainUtils);
1728
2715
 
1729
- const DIGEST_RE = /^[0-9a-f]{64}$/;
2716
+ const DIGEST_RE = /^[0-9a-f]{64}$/i;
1730
2717
  function chainTextDigest(text) {
1731
2718
  if (!text)
1732
2719
  return "";
@@ -1735,6 +2722,9 @@ function chainTextDigest(text) {
1735
2722
  function isChainTextDigest(value) {
1736
2723
  return typeof value === "string" && DIGEST_RE.test(value);
1737
2724
  }
2725
+ function isChainTextOf(text, chainValue) {
2726
+ return chainTextDigest(text) === (chainValue ?? "").toLowerCase();
2727
+ }
1738
2728
  function resolveChainText(chainValue, current) {
1739
2729
  return isChainTextDigest(chainValue) ? current ?? "" : chainValue;
1740
2730
  }
@@ -1825,17 +2815,17 @@ class AmountFormatterUtils {
1825
2815
  */
1826
2816
  static formatAmount(amountStr) {
1827
2817
  if (!amountStr || typeof amountStr !== "string") {
1828
- throw DomainError.internal("KIT_AMOUNT_FORMAT_INVALID", { amount: amountStr });
2818
+ throw DomainError.badRequest("KIT_AMOUNT_FORMAT_INVALID", { amount: amountStr });
1829
2819
  }
1830
2820
  const parts = amountStr.trim().split(/\s+/);
1831
2821
  if (parts.length < 1 || !parts[0]) {
1832
- throw DomainError.internal("KIT_AMOUNT_FORMAT_INVALID", { amount: amountStr });
2822
+ throw DomainError.badRequest("KIT_AMOUNT_FORMAT_INVALID", { amount: amountStr });
1833
2823
  }
1834
2824
  const amountPart = parts[0].replace(",", ".");
1835
2825
  const currency = parts.length >= 2 ? parts.slice(1).join(" ") : "";
1836
2826
  const amount = parseFloat(amountPart);
1837
2827
  if (isNaN(amount)) {
1838
- throw DomainError.internal("KIT_AMOUNT_NUMBER_INVALID", { value: parts[0] });
2828
+ throw DomainError.badRequest("KIT_AMOUNT_NUMBER_INVALID", { value: parts[0] });
1839
2829
  }
1840
2830
  const formattedAmount = amount.toLocaleString("ru-RU", {
1841
2831
  minimumFractionDigits: 2,
@@ -1911,7 +2901,7 @@ class QuantityUtils {
1911
2901
  } else if (symbol === rootGovernSymbol) {
1912
2902
  return rootGovernPrecision;
1913
2903
  } else {
1914
- throw DomainError.internal("KIT_SYMBOL_UNSUPPORTED", { symbol, rootSymbol, rootGovernSymbol });
2904
+ throw DomainError.badRequest("KIT_SYMBOL_UNSUPPORTED", { symbol, rootSymbol, rootGovernSymbol });
1915
2905
  }
1916
2906
  }
1917
2907
  /**
@@ -1921,7 +2911,7 @@ class QuantityUtils {
1921
2911
  static validateSymbol(symbol) {
1922
2912
  if (!this.isSupportedSymbol(symbol)) {
1923
2913
  const { rootSymbol, rootGovernSymbol } = platformSettings().blockchain;
1924
- throw DomainError.internal("KIT_SYMBOL_UNSUPPORTED", { symbol, rootSymbol, rootGovernSymbol });
2914
+ throw DomainError.badRequest("KIT_SYMBOL_UNSUPPORTED", { symbol, rootSymbol, rootGovernSymbol });
1925
2915
  }
1926
2916
  }
1927
2917
  /**
@@ -1933,7 +2923,7 @@ class QuantityUtils {
1933
2923
  static formatQuantityForBlockchain(amount, symbol) {
1934
2924
  this.validateSymbol(symbol);
1935
2925
  if (isNaN(amount) || amount < 0) {
1936
- throw DomainError.internal("KIT_NUMBER_INVALID", { value: amount });
2926
+ throw DomainError.badRequest("KIT_NUMBER_INVALID", { value: amount });
1937
2927
  }
1938
2928
  const precision = this.getPrecisionForSymbol(symbol);
1939
2929
  const formattedAmount = amount.toFixed(precision);
@@ -1948,7 +2938,7 @@ class QuantityUtils {
1948
2938
  static combineQuantityAndSymbol(amount, symbol) {
1949
2939
  this.validateSymbol(symbol);
1950
2940
  if (isNaN(amount) || amount < 0) {
1951
- throw DomainError.internal("KIT_NUMBER_INVALID", { value: amount });
2941
+ throw DomainError.badRequest("KIT_NUMBER_INVALID", { value: amount });
1952
2942
  }
1953
2943
  return `${amount} ${symbol}`;
1954
2944
  }
@@ -1960,12 +2950,12 @@ class QuantityUtils {
1960
2950
  static parseQuantityString(quantity) {
1961
2951
  const parts = quantity.split(" ");
1962
2952
  if (parts.length !== 2) {
1963
- throw DomainError.internal("KIT_QUANTITY_FORMAT_INVALID", { quantity });
2953
+ throw DomainError.badRequest("KIT_QUANTITY_FORMAT_INVALID", { quantity });
1964
2954
  }
1965
2955
  const [amountStr, symbol] = parts;
1966
2956
  const amount = parseFloat(amountStr);
1967
2957
  if (isNaN(amount)) {
1968
- throw DomainError.internal("KIT_QUANTITY_AMOUNT_INVALID", { amount: amountStr });
2958
+ throw DomainError.badRequest("KIT_QUANTITY_AMOUNT_INVALID", { amount: amountStr });
1969
2959
  }
1970
2960
  this.validateSymbol(symbol);
1971
2961
  return { amount, symbol };
@@ -2077,13 +3067,29 @@ function sanitizeUserText(value) {
2077
3067
  return _Common.Text.sanitizeEditorMarkdown(value);
2078
3068
  }
2079
3069
 
2080
- function resolveSortColumn(repository, sortBy, fallback) {
2081
- if (!sortBy)
2082
- return fallback;
2083
- const isKnownColumn = repository.metadata.columns.some(
2084
- (column) => column.propertyName === sortBy || column.databaseName === sortBy
2085
- );
2086
- return isKnownColumn ? sortBy : fallback;
3070
+ function SafeMarkup(validationOptions) {
3071
+ return function(object, propertyName) {
3072
+ registerDecorator({
3073
+ name: "safeMarkup",
3074
+ target: object.constructor,
3075
+ propertyName,
3076
+ options: { message: validationMessage("kit.markup.executable"), ...validationOptions },
3077
+ validator: {
3078
+ validate(value) {
3079
+ return typeof value !== "string" || !_Common.Text.hasExecutableMarkup(value);
3080
+ }
3081
+ }
3082
+ });
3083
+ };
3084
+ }
3085
+
3086
+ function pickDefined(source, keys) {
3087
+ const picked = {};
3088
+ for (const key of keys) {
3089
+ if (source[key] !== void 0)
3090
+ picked[key] = source[key];
3091
+ }
3092
+ return picked;
2087
3093
  }
2088
3094
 
2089
3095
  class HttpApiError extends HttpException {
@@ -2101,6 +3107,7 @@ class HttpApiError extends HttpException {
2101
3107
 
2102
3108
  const ASSERT_PREFIX = /assertion failure with message: (.+?)(?:\n|$)/;
2103
3109
  const CODED = /^([A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+):\s*(.*)$/s;
3110
+ const ENCODING = /^Encoding error at root<[^>]*>((?:\.[^.<:]+<[^>]*>)*):/;
2104
3111
  function parseChainAssert(message) {
2105
3112
  const assert = message.match(ASSERT_PREFIX);
2106
3113
  const body = (assert ? assert[1] : message).trim();
@@ -2116,7 +3123,23 @@ function chainErrorCode(error) {
2116
3123
  const raw = error?.message ?? String(error);
2117
3124
  return parseChainAssert(raw).code;
2118
3125
  }
3126
+ function chainRefusalOf(error) {
3127
+ if (error instanceof DomainError)
3128
+ return error;
3129
+ const raw = error?.message ?? String(error);
3130
+ const encoding = raw.match(ENCODING);
3131
+ if (encoding) {
3132
+ const field = encoding[1].split(".").filter(Boolean).map((part) => part.replace(/<[^>]*>$/, "")).join(".");
3133
+ return DomainError.badRequest("CHAIN_ACTION_ARGUMENT_INVALID", { field });
3134
+ }
3135
+ if (!ASSERT_PREFIX.test(raw))
3136
+ return null;
3137
+ const { code, text } = parseChainAssert(raw);
3138
+ return DomainError.badRequest(code ?? "CHAIN_ASSERT", { message: text });
3139
+ }
2119
3140
  function rethrowChainError(error) {
3141
+ if (error instanceof DomainError)
3142
+ throw error;
2120
3143
  const raw = error?.message ?? String(error);
2121
3144
  const match = raw.match(ASSERT_PREFIX);
2122
3145
  if (!match)
@@ -2125,4 +3148,4 @@ function rethrowChainError(error) {
2125
3148
  throw DomainError.badRequest(code ?? "CHAIN_ASSERT", { message: text });
2126
3149
  }
2127
3150
 
2128
- export { ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, AuthRoles, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DateUtils, DocumentAggregateDTO, DomainError, 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, ROLES_ANY_STATUS_KEY, ROLES_DENY_SELF_KEY, RolesGuard, SORT_FIELD_PATTERN, SignatureInfoDTO, SignatureInfoInputDTO, SignedDigitalDocumentDTO, SignedDigitalDocumentInputDTO, TransactionDTO, UseBucket, bucketProvidersFor, bucketTokenFor, buildPaginationResult, chainErrorCode, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, createPaginationResult, domainErrorMessage, extensionDatabaseMigrations, extensionEntities, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, isChainTextDigest, isExtensionAvailable, mergeSecretConfig, paginationInputToOffset, parseChainAssert, platformSettings, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, registerExtensionEntities, resetExtensionDatabaseMigrations, resetExtensionEntities, resolveChainText, resolveSortColumn, rethrowChainError, sanitizeUserText, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
3151
+ export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DateUtils, DocumentAggregateDTO, DomainError, DomainToBlockchainUtils, EMPTY_HASH, EXTENSION_APP_TERMINATE_EVENT, EXTENSION_REPOSITORY, EXTENSION_SECRET_SET, EXTENSION_SECRET_UNSET, ExpenseProposalStatementGenerateDocumentInputDTO, ExpenseProposalStatementSignedDocumentInputDTO, ExpenseProposalStatementSignedMetaDocumentInputDTO, ExtensionAvailability, ExtensionConfigSuppliedBy, ExtensionDomainEntity, GRANTED_SCOPE_KEY, GenerateDocumentInputDTO, GenerateDocumentOptionsInputDTO, GenerateMetaDocumentInputDTO, GeneratedDocumentDTO, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, LangType, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, MetaDocumentInputDTO, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationInputDTO, PaginationResult, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SORT_FIELD_PATTERN, SafeMarkup, SignatureInfoDTO, SignatureInfoInputDTO, SignedDigitalDocumentDTO, SignedDigitalDocumentInputDTO, TransactionDTO, UseBucket, attachOne, bucketProvidersFor, bucketTokenFor, buildPaginationResult, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, councilRolesOf, createPaginationResult, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, isChainTextDigest, isChainTextOf, isExtensionAvailable, memberRolesOf, mergeSecretConfig, oneOf, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };