@coopenomics/extension-kit 2026.10.30-1 → 2026.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +184 -0
- package/dist/index.d.cts +136 -2
- package/dist/index.d.mts +136 -2
- package/dist/index.d.ts +136 -2
- package/dist/index.mjs +167 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -718,6 +718,12 @@ exports.IPNProvider = __decorateClass$n([
|
|
|
718
718
|
common.Injectable()
|
|
719
719
|
], exports.IPNProvider);
|
|
720
720
|
|
|
721
|
+
function bankSafeText(text) {
|
|
722
|
+
if (text == null)
|
|
723
|
+
return text;
|
|
724
|
+
return text.replace(/ё/g, "\u0435").replace(/Ё/g, "\u0415");
|
|
725
|
+
}
|
|
726
|
+
|
|
721
727
|
const REGISTERED = /* @__PURE__ */ new Map();
|
|
722
728
|
const BucketRegistry = {
|
|
723
729
|
add(cls, spec) {
|
|
@@ -1077,6 +1083,14 @@ __decorateClass$j([
|
|
|
1077
1083
|
classValidator.IsOptional(),
|
|
1078
1084
|
classValidator.IsString()
|
|
1079
1085
|
], ExpenseProposalItemInputDTO.prototype, "recipient_username", 2);
|
|
1086
|
+
__decorateClass$j([
|
|
1087
|
+
graphql.Field(() => graphql.Int, {
|
|
1088
|
+
description: "\u041A\u043E\u043D\u0442\u0440\u0430\u0433\u0435\u043D\u0442-\u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044C \u0438\u0437 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u043A\u043E\u043D\u0442\u0440\u0430\u0433\u0435\u043D\u0442\u043E\u0432 \u2014 \u0441\u0435\u0440\u0432\u0435\u0440 \u043F\u043E\u0434\u0441\u0442\u0430\u0432\u0438\u0442 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0438 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442.",
|
|
1089
|
+
nullable: true
|
|
1090
|
+
}),
|
|
1091
|
+
classValidator.IsOptional(),
|
|
1092
|
+
classValidator.IsInt()
|
|
1093
|
+
], ExpenseProposalItemInputDTO.prototype, "counterparty_id", 2);
|
|
1080
1094
|
ExpenseProposalItemInputDTO = __decorateClass$j([
|
|
1081
1095
|
graphql.InputType("ExpenseProposalItemInput")
|
|
1082
1096
|
], ExpenseProposalItemInputDTO);
|
|
@@ -1217,6 +1231,61 @@ exports.ExpenseProposalStatementSignedDocumentInputDTO = __decorateClass$j([
|
|
|
1217
1231
|
graphql.InputType("ExpenseProposalStatementSignedDocumentInput")
|
|
1218
1232
|
], exports.ExpenseProposalStatementSignedDocumentInputDTO);
|
|
1219
1233
|
|
|
1234
|
+
const EXPENSE_PLAN_RECURRENCE_MONTHS = {
|
|
1235
|
+
NONE: 0,
|
|
1236
|
+
MONTHLY: 1,
|
|
1237
|
+
QUARTERLY: 3,
|
|
1238
|
+
YEARLY: 12
|
|
1239
|
+
};
|
|
1240
|
+
function expensePlanRecurrenceMonths(recurrence) {
|
|
1241
|
+
if (!recurrence)
|
|
1242
|
+
return 0;
|
|
1243
|
+
return EXPENSE_PLAN_RECURRENCE_MONTHS[recurrence] ?? 0;
|
|
1244
|
+
}
|
|
1245
|
+
function nextExpensePlanDate(from, months) {
|
|
1246
|
+
if (!Number.isInteger(months) || months <= 0)
|
|
1247
|
+
return null;
|
|
1248
|
+
const year = from.getUTCFullYear();
|
|
1249
|
+
const month = from.getUTCMonth() + months;
|
|
1250
|
+
const lastDay = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
|
1251
|
+
const day = Math.min(from.getUTCDate(), lastDay);
|
|
1252
|
+
return new Date(
|
|
1253
|
+
Date.UTC(
|
|
1254
|
+
year,
|
|
1255
|
+
month,
|
|
1256
|
+
day,
|
|
1257
|
+
from.getUTCHours(),
|
|
1258
|
+
from.getUTCMinutes(),
|
|
1259
|
+
from.getUTCSeconds(),
|
|
1260
|
+
from.getUTCMilliseconds()
|
|
1261
|
+
)
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
function expensePlanScheduleDates(first, months, count) {
|
|
1265
|
+
if (count <= 0)
|
|
1266
|
+
return [];
|
|
1267
|
+
const dates = [first];
|
|
1268
|
+
let current = first;
|
|
1269
|
+
while (dates.length < count && current) {
|
|
1270
|
+
current = nextExpensePlanDate(current, months);
|
|
1271
|
+
if (current)
|
|
1272
|
+
dates.push(current);
|
|
1273
|
+
}
|
|
1274
|
+
return dates;
|
|
1275
|
+
}
|
|
1276
|
+
function expensePlanReserveShare(amount, monthsAhead, periodMonths) {
|
|
1277
|
+
if (amount <= 0n)
|
|
1278
|
+
return 0n;
|
|
1279
|
+
if (monthsAhead <= 0)
|
|
1280
|
+
return amount;
|
|
1281
|
+
if (!Number.isInteger(periodMonths) || periodMonths <= 1 || monthsAhead >= periodMonths)
|
|
1282
|
+
return 0n;
|
|
1283
|
+
return amount * BigInt(periodMonths - monthsAhead) / BigInt(periodMonths);
|
|
1284
|
+
}
|
|
1285
|
+
function expensePlanReserveMonths(periodMonths) {
|
|
1286
|
+
return Number.isInteger(periodMonths) && periodMonths > 1 ? periodMonths : 1;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1220
1289
|
const DOCUMENT_GENERATION_THROTTLE = { default: { limit: 60, ttl: 6e4 } };
|
|
1221
1290
|
|
|
1222
1291
|
var __defProp$i = Object.defineProperty;
|
|
@@ -2307,6 +2376,103 @@ function platformSettings() {
|
|
|
2307
2376
|
return settings;
|
|
2308
2377
|
}
|
|
2309
2378
|
|
|
2379
|
+
function timeZoneOffsetMs(date, timeZone) {
|
|
2380
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
2381
|
+
timeZone,
|
|
2382
|
+
hourCycle: "h23",
|
|
2383
|
+
year: "numeric",
|
|
2384
|
+
month: "2-digit",
|
|
2385
|
+
day: "2-digit",
|
|
2386
|
+
hour: "2-digit",
|
|
2387
|
+
minute: "2-digit",
|
|
2388
|
+
second: "2-digit"
|
|
2389
|
+
}).formatToParts(date);
|
|
2390
|
+
const get = (type) => Number(parts.find((p) => p.type === type)?.value ?? 0);
|
|
2391
|
+
const asUtc = Date.UTC(get("year"), get("month") - 1, get("day"), get("hour"), get("minute"), get("second"));
|
|
2392
|
+
return asUtc - Math.floor(date.getTime() / 1e3) * 1e3;
|
|
2393
|
+
}
|
|
2394
|
+
function nextLocalMidnight(date, timeZone) {
|
|
2395
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(date);
|
|
2396
|
+
const get = (type) => Number(parts.find((p) => p.type === type)?.value ?? 0);
|
|
2397
|
+
const utcMidnight = Date.UTC(get("year"), get("month") - 1, get("day") + 1);
|
|
2398
|
+
return new Date(utcMidnight - timeZoneOffsetMs(new Date(utcMidnight), timeZone));
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
const SECONDS_IN_DAY = 24 * 60 * 60;
|
|
2402
|
+
const DAYS_IN_COMPRESSED_MONTH = 10;
|
|
2403
|
+
const COMPRESSED_WORKER_PACE_SECONDS = 60;
|
|
2404
|
+
function inProduction() {
|
|
2405
|
+
return process.env.NODE_ENV === "production";
|
|
2406
|
+
}
|
|
2407
|
+
function envSeconds(name, allowZero) {
|
|
2408
|
+
const raw = process.env[name];
|
|
2409
|
+
if (raw === void 0 || raw.trim() === "")
|
|
2410
|
+
return null;
|
|
2411
|
+
const value = Number(raw);
|
|
2412
|
+
if (!Number.isFinite(value))
|
|
2413
|
+
return null;
|
|
2414
|
+
if (allowZero ? value < 0 : value <= 0)
|
|
2415
|
+
return null;
|
|
2416
|
+
return Math.floor(value);
|
|
2417
|
+
}
|
|
2418
|
+
function standDaySeconds() {
|
|
2419
|
+
if (inProduction())
|
|
2420
|
+
return SECONDS_IN_DAY;
|
|
2421
|
+
return envSeconds("STAND_DAY_SECONDS", false) ?? SECONDS_IN_DAY;
|
|
2422
|
+
}
|
|
2423
|
+
function isStandTimeConfigured() {
|
|
2424
|
+
if (inProduction())
|
|
2425
|
+
return false;
|
|
2426
|
+
return envSeconds("STAND_DAY_SECONDS", false) !== null || envSeconds("STAND_MONTH_SECONDS", true) !== null || envSeconds("STAND_WORKER_PACE_SECONDS", false) !== null;
|
|
2427
|
+
}
|
|
2428
|
+
function standMonthSeconds() {
|
|
2429
|
+
if (inProduction())
|
|
2430
|
+
return 0;
|
|
2431
|
+
const custom = envSeconds("STAND_MONTH_SECONDS", true);
|
|
2432
|
+
if (custom !== null)
|
|
2433
|
+
return custom;
|
|
2434
|
+
return standDaySeconds() !== SECONDS_IN_DAY ? DAYS_IN_COMPRESSED_MONTH * standDaySeconds() : 0;
|
|
2435
|
+
}
|
|
2436
|
+
function isStandTimeCompressed() {
|
|
2437
|
+
return standDaySeconds() !== SECONDS_IN_DAY || standMonthSeconds() > 0;
|
|
2438
|
+
}
|
|
2439
|
+
function standWorkerPaceSeconds(productionPaceSeconds) {
|
|
2440
|
+
if (!isStandTimeCompressed())
|
|
2441
|
+
return productionPaceSeconds;
|
|
2442
|
+
return envSeconds("STAND_WORKER_PACE_SECONDS", false) ?? COMPRESSED_WORKER_PACE_SECONDS;
|
|
2443
|
+
}
|
|
2444
|
+
function isStandWorkerTurn(productionPaceSeconds, now = /* @__PURE__ */ new Date()) {
|
|
2445
|
+
const paceMinutes = Math.max(1, Math.round(standWorkerPaceSeconds(productionPaceSeconds) / 60));
|
|
2446
|
+
const minutes = Math.floor(now.getTime() / 6e4);
|
|
2447
|
+
return minutes % paceMinutes === 0;
|
|
2448
|
+
}
|
|
2449
|
+
function standPeriodKey(date, timeZone) {
|
|
2450
|
+
const monthSeconds = standMonthSeconds();
|
|
2451
|
+
if (monthSeconds > 0)
|
|
2452
|
+
return Math.floor(date.getTime() / 1e3 / monthSeconds);
|
|
2453
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit" }).formatToParts(date);
|
|
2454
|
+
const year = Number(parts.find((p) => p.type === "year")?.value ?? 0);
|
|
2455
|
+
const month = Number(parts.find((p) => p.type === "month")?.value ?? 0);
|
|
2456
|
+
return year * 12 + month;
|
|
2457
|
+
}
|
|
2458
|
+
function standNextPeriodStart(date, timeZone) {
|
|
2459
|
+
const monthSeconds = standMonthSeconds();
|
|
2460
|
+
if (monthSeconds > 0) {
|
|
2461
|
+
return new Date((Math.floor(date.getTime() / 1e3 / monthSeconds) + 1) * monthSeconds * 1e3);
|
|
2462
|
+
}
|
|
2463
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit" }).formatToParts(date);
|
|
2464
|
+
const year = Number(parts.find((p) => p.type === "year")?.value ?? 0);
|
|
2465
|
+
const month = Number(parts.find((p) => p.type === "month")?.value ?? 1);
|
|
2466
|
+
const utcMidnight = Date.UTC(month === 12 ? year + 1 : year, month === 12 ? 0 : month, 1);
|
|
2467
|
+
return new Date(utcMidnight - timeZoneOffsetMs(new Date(utcMidnight), timeZone));
|
|
2468
|
+
}
|
|
2469
|
+
function describeStandTime() {
|
|
2470
|
+
if (!isStandTimeCompressed())
|
|
2471
|
+
return "\u0432\u0440\u0435\u043C\u044F \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435";
|
|
2472
|
+
const month = standMonthSeconds();
|
|
2473
|
+
return `\u0432\u0440\u0435\u043C\u044F \u0441\u0442\u0435\u043D\u0434\u0430 \u0441\u0436\u0430\u0442\u043E: \u0441\u0443\u0442\u043A\u0438 ${standDaySeconds()} \u0441, \u043C\u0435\u0441\u044F\u0446 ${month > 0 ? `${month} \u0441` : "\u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0438\u0439"}, \u0448\u0430\u0433 \u043E\u0431\u0445\u043E\u0434\u043E\u0432 ${standWorkerPaceSeconds(0)} \u0441`;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2310
2476
|
var __defProp$5 = Object.defineProperty;
|
|
2311
2477
|
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
2312
2478
|
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
@@ -3214,6 +3380,7 @@ exports.DOCUMENT_GENERATION_THROTTLE = DOCUMENT_GENERATION_THROTTLE;
|
|
|
3214
3380
|
exports.DateUtils = DateUtils;
|
|
3215
3381
|
exports.DomainError = DomainError;
|
|
3216
3382
|
exports.EMPTY_HASH = EMPTY_HASH;
|
|
3383
|
+
exports.EXPENSE_PLAN_RECURRENCE_MONTHS = EXPENSE_PLAN_RECURRENCE_MONTHS;
|
|
3217
3384
|
exports.EXTENSION_APP_TERMINATE_EVENT = EXTENSION_APP_TERMINATE_EVENT;
|
|
3218
3385
|
exports.EXTENSION_REPOSITORY = EXTENSION_REPOSITORY;
|
|
3219
3386
|
exports.EXTENSION_SECRET_SET = EXTENSION_SECRET_SET;
|
|
@@ -3243,6 +3410,7 @@ exports.SORT_FIELD_PATTERN = SORT_FIELD_PATTERN;
|
|
|
3243
3410
|
exports.SafeMarkup = SafeMarkup;
|
|
3244
3411
|
exports.UseBucket = UseBucket;
|
|
3245
3412
|
exports.attachOne = attachOne;
|
|
3413
|
+
exports.bankSafeText = bankSafeText;
|
|
3246
3414
|
exports.bucketProvidersFor = bucketProvidersFor;
|
|
3247
3415
|
exports.bucketTokenFor = bucketTokenFor;
|
|
3248
3416
|
exports.buildPaginationResult = buildPaginationResult;
|
|
@@ -3259,10 +3427,15 @@ exports.configurePlatformSettings = configurePlatformSettings;
|
|
|
3259
3427
|
exports.councilRolesOf = councilRolesOf;
|
|
3260
3428
|
exports.createPaginationResult = createPaginationResult;
|
|
3261
3429
|
exports.describeConfigField = describeConfigField;
|
|
3430
|
+
exports.describeStandTime = describeStandTime;
|
|
3262
3431
|
exports.desktopGrants = desktopGrants;
|
|
3263
3432
|
exports.desktopGrantsOf = desktopGrantsOf;
|
|
3264
3433
|
exports.domainErrorMessage = domainErrorMessage;
|
|
3265
3434
|
exports.expandRights = expandRights;
|
|
3435
|
+
exports.expensePlanRecurrenceMonths = expensePlanRecurrenceMonths;
|
|
3436
|
+
exports.expensePlanReserveMonths = expensePlanReserveMonths;
|
|
3437
|
+
exports.expensePlanReserveShare = expensePlanReserveShare;
|
|
3438
|
+
exports.expensePlanScheduleDates = expensePlanScheduleDates;
|
|
3266
3439
|
exports.extensionDatabaseMigrations = extensionDatabaseMigrations;
|
|
3267
3440
|
exports.generateHashFromString = generateHashFromString;
|
|
3268
3441
|
exports.generateRandomHash = generateRandomHash;
|
|
@@ -3273,8 +3446,13 @@ exports.hasServerSecret = hasServerSecret;
|
|
|
3273
3446
|
exports.isChainTextDigest = isChainTextDigest;
|
|
3274
3447
|
exports.isChainTextOf = isChainTextOf;
|
|
3275
3448
|
exports.isExtensionAvailable = isExtensionAvailable;
|
|
3449
|
+
exports.isStandTimeCompressed = isStandTimeCompressed;
|
|
3450
|
+
exports.isStandTimeConfigured = isStandTimeConfigured;
|
|
3451
|
+
exports.isStandWorkerTurn = isStandWorkerTurn;
|
|
3276
3452
|
exports.memberRolesOf = memberRolesOf;
|
|
3277
3453
|
exports.mergeSecretConfig = mergeSecretConfig;
|
|
3454
|
+
exports.nextExpensePlanDate = nextExpensePlanDate;
|
|
3455
|
+
exports.nextLocalMidnight = nextLocalMidnight;
|
|
3278
3456
|
exports.paginationInputToOffset = paginationInputToOffset;
|
|
3279
3457
|
exports.parseChainAssert = parseChainAssert;
|
|
3280
3458
|
exports.pickDefined = pickDefined;
|
|
@@ -3294,6 +3472,12 @@ exports.sanitizeUserText = sanitizeUserText;
|
|
|
3294
3472
|
exports.scopeConditions = scopeConditions;
|
|
3295
3473
|
exports.scopeOfRight = scopeOfRight;
|
|
3296
3474
|
exports.scopesMatched = scopesMatched;
|
|
3475
|
+
exports.standDaySeconds = standDaySeconds;
|
|
3476
|
+
exports.standMonthSeconds = standMonthSeconds;
|
|
3477
|
+
exports.standNextPeriodStart = standNextPeriodStart;
|
|
3478
|
+
exports.standPeriodKey = standPeriodKey;
|
|
3479
|
+
exports.standWorkerPaceSeconds = standWorkerPaceSeconds;
|
|
3480
|
+
exports.timeZoneOffsetMs = timeZoneOffsetMs;
|
|
3297
3481
|
exports.validationMessage = validationMessage;
|
|
3298
3482
|
exports.verifySignedDocumentAgainstStoredDraft = verifySignedDocumentAgainstStoredDraft;
|
|
3299
3483
|
exports.waitForEvent = waitForEvent;
|
package/dist/index.d.cts
CHANGED
|
@@ -560,6 +560,19 @@ declare abstract class IPNProvider extends PaymentProvider {
|
|
|
560
560
|
abstract handleIPN(request: any): Promise<void>;
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Текст для банковского поручения: назначение платежа, строка QR-кода оплаты.
|
|
565
|
+
*
|
|
566
|
+
* Банки не принимают букву «ё» в назначении платежа: пайщик копирует
|
|
567
|
+
* назначение в банк, и поручение с «Цифровой Кошелёк» или «аванс под отчёт»
|
|
568
|
+
* отклоняется (владелец 06.11.2026). Буква заменяется на «е» там, где
|
|
569
|
+
* назначение записывается в платёж, заявку на выплату или реквизиты, — один
|
|
570
|
+
* раз и для всех источников: подписи в словарях и тексты интерфейса остаются
|
|
571
|
+
* с «ё», меняется только текст, который передаётся в банк.
|
|
572
|
+
*/
|
|
573
|
+
declare function bankSafeText(text: string): string;
|
|
574
|
+
declare function bankSafeText(text: string | null | undefined): string | null | undefined;
|
|
575
|
+
|
|
563
576
|
/**
|
|
564
577
|
* Объявление хранилища файлов, которое заводит себе расширение.
|
|
565
578
|
*
|
|
@@ -735,6 +748,7 @@ declare class ExpenseProposalItemInputDTO {
|
|
|
735
748
|
payment_purpose?: string;
|
|
736
749
|
payment_method_id?: string;
|
|
737
750
|
recipient_username?: string;
|
|
751
|
+
counterparty_id?: number;
|
|
738
752
|
}
|
|
739
753
|
/**
|
|
740
754
|
* Публичная позиция подписанной meta — ровно то, что публикуется on-chain.
|
|
@@ -792,6 +806,57 @@ declare class ExpenseProposalStatementSignedDocumentInputDTO extends SignedDigit
|
|
|
792
806
|
readonly meta: ExpenseProposalStatementSignedMetaDocumentInputDTO;
|
|
793
807
|
}
|
|
794
808
|
|
|
809
|
+
/**
|
|
810
|
+
* Календарь повторяющегося планового расхода (задача 99D-34, решение
|
|
811
|
+
* владельца 11.11.2026).
|
|
812
|
+
*
|
|
813
|
+
* Одна реализация на два расширения: расходы продолжают по ней серию записей
|
|
814
|
+
* реестра, Стол заказов по ней же показывает председателю сроки будущих
|
|
815
|
+
* платежей и считает резерв участка. Если правило поменяется только в одном
|
|
816
|
+
* месте, экран пообещает один срок, а реестр заведёт другой.
|
|
817
|
+
*
|
|
818
|
+
* Календарь ведётся по UTC — как месяцы контракта и узла.
|
|
819
|
+
*/
|
|
820
|
+
/** Периодичность записи реестра плановых расходов — значения перечисления `ExpensePlanRecurrence`. */
|
|
821
|
+
type ExpensePlanRecurrenceKey = 'NONE' | 'MONTHLY' | 'QUARTERLY' | 'YEARLY';
|
|
822
|
+
/** Шаг серии в месяцах; 0 — разовый расход. */
|
|
823
|
+
declare const EXPENSE_PLAN_RECURRENCE_MONTHS: Readonly<Record<ExpensePlanRecurrenceKey, number>>;
|
|
824
|
+
/** Шаг серии в месяцах по значению периодичности; неизвестное значение и пустота — разовый расход. */
|
|
825
|
+
declare function expensePlanRecurrenceMonths(recurrence: string | null | undefined): number;
|
|
826
|
+
/**
|
|
827
|
+
* Срок следующего платежа серии через `months` месяцев; `null` для разового расхода.
|
|
828
|
+
*
|
|
829
|
+
* Число месяца сохраняется: платёж «11-го» остаётся 11-м. Если в целевом месяце
|
|
830
|
+
* такого числа нет (31-е в феврале), берётся последний день месяца, а не
|
|
831
|
+
* перескок в следующий месяц. Время суток сохраняется.
|
|
832
|
+
*/
|
|
833
|
+
declare function nextExpensePlanDate(from: Date, months: number): Date | null;
|
|
834
|
+
/**
|
|
835
|
+
* Сроки `count` платежей серии, начиная с `first` включительно.
|
|
836
|
+
*
|
|
837
|
+
* Каждый срок считается от предыдущего — так расширение расходов продолжает
|
|
838
|
+
* серию: новая запись получает срок от срока прошлой записи. Серия «31-го»
|
|
839
|
+
* после февраля остаётся на последнем дне февраля.
|
|
840
|
+
*/
|
|
841
|
+
declare function expensePlanScheduleDates(first: Date, months: number, count: number): Date[];
|
|
842
|
+
/**
|
|
843
|
+
* Доля суммы платежа, которую резерв держит к концу месяца.
|
|
844
|
+
*
|
|
845
|
+
* `monthsAhead` — сколько месяцев от последнего месяца, который покрывает
|
|
846
|
+
* резерв, до месяца срока платежа. Ноль и меньше — срок внутри покрытия или
|
|
847
|
+
* прошёл: резерв держит всю сумму. Повторяющийся платёж с шагом `periodMonths`
|
|
848
|
+
* собирается равными долями за `periodMonths` месяцев: за `k` месяцев до срока
|
|
849
|
+
* резерв держит `(periodMonths − k) / periodMonths` суммы, раньше — ничего.
|
|
850
|
+
* Квартальный платёж копится три месяца, годовой — двенадцать, ежемесячный и
|
|
851
|
+
* разовый — один месяц, целиком.
|
|
852
|
+
*
|
|
853
|
+
* Доля округляется вниз до единицы суммы; последний месяц перед сроком
|
|
854
|
+
* добирает остаток, и к сроку в резерве лежит вся сумма.
|
|
855
|
+
*/
|
|
856
|
+
declare function expensePlanReserveShare(amount: bigint, monthsAhead: number, periodMonths: number): bigint;
|
|
857
|
+
/** Сколько месяцев резерв копит один платёж: период повторяющегося расхода, для разового и ежемесячного — один. */
|
|
858
|
+
declare function expensePlanReserveMonths(periodMonths: number): number;
|
|
859
|
+
|
|
795
860
|
/**
|
|
796
861
|
* Предел частоты сборки документов на одного пайщика — общий для ядра и
|
|
797
862
|
* расширений, чтобы не держать число в полусотне резолверов.
|
|
@@ -1762,6 +1827,75 @@ declare function configurePlatformSettings(value: PlatformSettings): void;
|
|
|
1762
1827
|
*/
|
|
1763
1828
|
declare function platformSettings(): PlatformSettings;
|
|
1764
1829
|
|
|
1830
|
+
/**
|
|
1831
|
+
* Шкала времени стенда — общая для всех приложений (решение владельца 01.11.2026).
|
|
1832
|
+
*
|
|
1833
|
+
* В работе сутки и месяцы настоящие. На стенде разработки время сжимают, чтобы
|
|
1834
|
+
* процессы со сроками проходились за минуты: гарантийный срок заказа, списание
|
|
1835
|
+
* обеспечительной части первого числа месяца, сроки курсов «Образования».
|
|
1836
|
+
* Каждое приложение берёт длины из этой шкалы, а не держит свои переменные, — иначе
|
|
1837
|
+
* на одном стенде сутки разной длины в разных приложениях, и процессы,
|
|
1838
|
+
* связанные между собой, расходятся.
|
|
1839
|
+
*
|
|
1840
|
+
* Переменные окружения контроллера:
|
|
1841
|
+
* - `STAND_DAY_SECONDS` — длина суток, секунд (86400 — настоящие);
|
|
1842
|
+
* - `STAND_MONTH_SECONDS` — длина месяца, секунд; 0 — настоящий месяц. Не
|
|
1843
|
+
* задана — при укороченных сутках месяц равен десяти суткам;
|
|
1844
|
+
* - `STAND_WORKER_PACE_SECONDS` — шаг фоновых обходов при сжатом времени,
|
|
1845
|
+
* секунд; не задан — минута.
|
|
1846
|
+
*
|
|
1847
|
+
* `NODE_ENV=production` (боевая и тестовая сеть) — сжатия нет никогда, переменные
|
|
1848
|
+
* не действуют: ошибка в окружении прода не сокращает ничьих сроков.
|
|
1849
|
+
*
|
|
1850
|
+
* Прежние переменные «Образования» (`EDUBRIDGE_GUARANTEE_DAY_SECONDS` и др.)
|
|
1851
|
+
* читает само «Образование» как запасные — ради стендов, где они уже стоят.
|
|
1852
|
+
*/
|
|
1853
|
+
/** Длина суток на стенде, секунд. В работе — всегда настоящие сутки. */
|
|
1854
|
+
declare function standDaySeconds(): number;
|
|
1855
|
+
/** Задана ли шкала стенда явно (хоть одна из переменных). */
|
|
1856
|
+
declare function isStandTimeConfigured(): boolean;
|
|
1857
|
+
/** Длина месяца на стенде, секунд; 0 — настоящий месяц. */
|
|
1858
|
+
declare function standMonthSeconds(): number;
|
|
1859
|
+
/** Время сжато: сутки короче настоящих либо месяц задан длиной. */
|
|
1860
|
+
declare function isStandTimeCompressed(): boolean;
|
|
1861
|
+
/**
|
|
1862
|
+
* Шаг фонового обхода, секунд: в работе — свой шаг приложения, при сжатом
|
|
1863
|
+
* времени — шаг стенда (по умолчанию минута).
|
|
1864
|
+
*/
|
|
1865
|
+
declare function standWorkerPaceSeconds(productionPaceSeconds: number): number;
|
|
1866
|
+
/**
|
|
1867
|
+
* Черёд фонового обхода, который просыпается каждую минуту: в работе — на
|
|
1868
|
+
* каждой минуте, кратной своему шагу (шаг часа — нулевая минута часа), при
|
|
1869
|
+
* сжатом времени — по шагу стенда.
|
|
1870
|
+
*/
|
|
1871
|
+
declare function isStandWorkerTurn(productionPaceSeconds: number, now?: Date): boolean;
|
|
1872
|
+
/**
|
|
1873
|
+
* Номер расчётного периода «месяц», в который попадает момент. В работе —
|
|
1874
|
+
* календарный месяц в часовом поясе кооператива (год × 12 + месяц). При
|
|
1875
|
+
* заданной длине месяца стенда — номер отрезка этой длины от начала эпохи:
|
|
1876
|
+
* «первое число» наступает каждые `STAND_MONTH_SECONDS` секунд.
|
|
1877
|
+
*/
|
|
1878
|
+
declare function standPeriodKey(date: Date, timeZone: string): number;
|
|
1879
|
+
/**
|
|
1880
|
+
* Начало расчётного месяца, следующего за моментом: «первое число», с
|
|
1881
|
+
* которого строка созревает к списанию. В работе — 00:00 первого числа
|
|
1882
|
+
* следующего календарного месяца в часовом поясе кооператива, при заданной
|
|
1883
|
+
* длине месяца стенда — начало следующего отрезка этой длины.
|
|
1884
|
+
*/
|
|
1885
|
+
declare function standNextPeriodStart(date: Date, timeZone: string): Date;
|
|
1886
|
+
/** Строка для журнала при запуске: какая шкала действует. */
|
|
1887
|
+
declare function describeStandTime(): string;
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Календарный день по часовому поясу кооператива. Сроки, которые человек
|
|
1891
|
+
* понимает «до конца дня» (код передачи на пункте выдачи), считаются здесь:
|
|
1892
|
+
* полночь — местная, а не UTC.
|
|
1893
|
+
*/
|
|
1894
|
+
/** Смещение часового пояса от UTC в момент, миллисекунд (Москва — +3 ч). */
|
|
1895
|
+
declare function timeZoneOffsetMs(date: Date, timeZone: string): number;
|
|
1896
|
+
/** Полночь, которой кончается текущий день момента в часовом поясе кооператива. */
|
|
1897
|
+
declare function nextLocalMidnight(date: Date, timeZone: string): Date;
|
|
1898
|
+
|
|
1765
1899
|
type GeneratedDocumentDomainInterface = Omit<IGeneratedDocument, 'binary'> & {
|
|
1766
1900
|
binary: string;
|
|
1767
1901
|
};
|
|
@@ -2365,5 +2499,5 @@ declare function chainRefusalOf(error: unknown): DomainError | null;
|
|
|
2365
2499
|
*/
|
|
2366
2500
|
declare function rethrowChainError(error: unknown): never;
|
|
2367
2501
|
|
|
2368
|
-
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, 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, KYSELY, LOG_EXTENSION_REPOSITORY, LangType, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, MAIN_DATABASE, 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, TableStore, TransactionDTO, UseBucket, affectedCount, attachOne, bucketProvidersFor, bucketTokenFor, buildPaginationResult, camelRow, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configureLocalChangePublisher, configurePlatformSettings, councilRolesOf, createPaginationResult, describeConfigField, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, inTransaction, isChainTextDigest, isChainTextOf, isExtensionAvailable, memberRolesOf, mergeSecretConfig, paginationInputToOffset, parseChainAssert, pendingLocalChanges, pickDefined, platformSettings, providerSuppliedPaths, rawQuery, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, snakeRow, sortColumn, sortDirection, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
|
|
2369
|
-
export type { AppRights, AssignableRole, AttachedRole, BucketSource, BucketSpec, CouncilRole, DeserializedDescriptionOfExtension, DesktopGrantsRequest, DomainErrorParams, EventSource, EventWait, ExcludeCommonProps, ExtensionAppTerminatePayload, ExtensionAuthOptions, ExtensionConfigFieldPolicy, ExtensionConfigPolicy, ExtensionDatabaseMigrationClass, ExtensionDomainInterface, ExtensionDomainRepository, ExtensionSchemaMigrationAfterContext, GeneratedDocumentDomainInterface, GeneratedDocumentDraft, GrantedAction, IDesktopConfig, IExtensionSchemaMigration, IGrantedScope, IRegistryExtension, IResolvedRegistryExtension, IRightRequirement, LoadGeneratedDocumentByDocHash, LogExtensionDomainInterface, LogExtensionDomainRepository, LogExtensionFilter, LogExtensionPaginationOptions, LogExtensionPaginationResult, MainDatabase, MemberRole, NarrowRightScope, PaymentDetails, PendingLocalChange, PlatformBlockchainSettings, PlatformSettings, RegisteredBucket, RequireFields, RightActor, RightFacts, RightGrant, RightOutcome, RightScope, RightSource, RightsCaller, RightsGroup, RightsTable, RolePermission, SchemaMigration, SchemaMigrationClass, SchemaQueryRunner, ScopeCheckInput, ScopeCheckResult, SignedDocumentMetaCompareMode, SignedDocumentMetaVerification, SignedDocumentToVerify, TransactResultWithResponse };
|
|
2502
|
+
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, DocumentAggregateDTO, DomainError, DomainToBlockchainUtils, EMPTY_HASH, EXPENSE_PLAN_RECURRENCE_MONTHS, 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, KYSELY, LOG_EXTENSION_REPOSITORY, LangType, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, MAIN_DATABASE, 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, TableStore, TransactionDTO, UseBucket, affectedCount, attachOne, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, camelRow, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configureLocalChangePublisher, configurePlatformSettings, councilRolesOf, createPaginationResult, describeConfigField, describeStandTime, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, expensePlanRecurrenceMonths, expensePlanReserveMonths, expensePlanReserveShare, expensePlanScheduleDates, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, inTransaction, isChainTextDigest, isChainTextOf, isExtensionAvailable, isStandTimeCompressed, isStandTimeConfigured, isStandWorkerTurn, memberRolesOf, mergeSecretConfig, nextExpensePlanDate, nextLocalMidnight, paginationInputToOffset, parseChainAssert, pendingLocalChanges, pickDefined, platformSettings, providerSuppliedPaths, rawQuery, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, snakeRow, sortColumn, sortDirection, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
|
|
2503
|
+
export type { AppRights, AssignableRole, AttachedRole, BucketSource, BucketSpec, CouncilRole, DeserializedDescriptionOfExtension, DesktopGrantsRequest, DomainErrorParams, EventSource, EventWait, ExcludeCommonProps, ExpensePlanRecurrenceKey, ExtensionAppTerminatePayload, ExtensionAuthOptions, ExtensionConfigFieldPolicy, ExtensionConfigPolicy, ExtensionDatabaseMigrationClass, ExtensionDomainInterface, ExtensionDomainRepository, ExtensionSchemaMigrationAfterContext, GeneratedDocumentDomainInterface, GeneratedDocumentDraft, GrantedAction, IDesktopConfig, IExtensionSchemaMigration, IGrantedScope, IRegistryExtension, IResolvedRegistryExtension, IRightRequirement, LoadGeneratedDocumentByDocHash, LogExtensionDomainInterface, LogExtensionDomainRepository, LogExtensionFilter, LogExtensionPaginationOptions, LogExtensionPaginationResult, MainDatabase, MemberRole, NarrowRightScope, PaymentDetails, PendingLocalChange, PlatformBlockchainSettings, PlatformSettings, RegisteredBucket, RequireFields, RightActor, RightFacts, RightGrant, RightOutcome, RightScope, RightSource, RightsCaller, RightsGroup, RightsTable, RolePermission, SchemaMigration, SchemaMigrationClass, SchemaQueryRunner, ScopeCheckInput, ScopeCheckResult, SignedDocumentMetaCompareMode, SignedDocumentMetaVerification, SignedDocumentToVerify, TransactResultWithResponse };
|
package/dist/index.d.mts
CHANGED
|
@@ -560,6 +560,19 @@ declare abstract class IPNProvider extends PaymentProvider {
|
|
|
560
560
|
abstract handleIPN(request: any): Promise<void>;
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Текст для банковского поручения: назначение платежа, строка QR-кода оплаты.
|
|
565
|
+
*
|
|
566
|
+
* Банки не принимают букву «ё» в назначении платежа: пайщик копирует
|
|
567
|
+
* назначение в банк, и поручение с «Цифровой Кошелёк» или «аванс под отчёт»
|
|
568
|
+
* отклоняется (владелец 06.11.2026). Буква заменяется на «е» там, где
|
|
569
|
+
* назначение записывается в платёж, заявку на выплату или реквизиты, — один
|
|
570
|
+
* раз и для всех источников: подписи в словарях и тексты интерфейса остаются
|
|
571
|
+
* с «ё», меняется только текст, который передаётся в банк.
|
|
572
|
+
*/
|
|
573
|
+
declare function bankSafeText(text: string): string;
|
|
574
|
+
declare function bankSafeText(text: string | null | undefined): string | null | undefined;
|
|
575
|
+
|
|
563
576
|
/**
|
|
564
577
|
* Объявление хранилища файлов, которое заводит себе расширение.
|
|
565
578
|
*
|
|
@@ -735,6 +748,7 @@ declare class ExpenseProposalItemInputDTO {
|
|
|
735
748
|
payment_purpose?: string;
|
|
736
749
|
payment_method_id?: string;
|
|
737
750
|
recipient_username?: string;
|
|
751
|
+
counterparty_id?: number;
|
|
738
752
|
}
|
|
739
753
|
/**
|
|
740
754
|
* Публичная позиция подписанной meta — ровно то, что публикуется on-chain.
|
|
@@ -792,6 +806,57 @@ declare class ExpenseProposalStatementSignedDocumentInputDTO extends SignedDigit
|
|
|
792
806
|
readonly meta: ExpenseProposalStatementSignedMetaDocumentInputDTO;
|
|
793
807
|
}
|
|
794
808
|
|
|
809
|
+
/**
|
|
810
|
+
* Календарь повторяющегося планового расхода (задача 99D-34, решение
|
|
811
|
+
* владельца 11.11.2026).
|
|
812
|
+
*
|
|
813
|
+
* Одна реализация на два расширения: расходы продолжают по ней серию записей
|
|
814
|
+
* реестра, Стол заказов по ней же показывает председателю сроки будущих
|
|
815
|
+
* платежей и считает резерв участка. Если правило поменяется только в одном
|
|
816
|
+
* месте, экран пообещает один срок, а реестр заведёт другой.
|
|
817
|
+
*
|
|
818
|
+
* Календарь ведётся по UTC — как месяцы контракта и узла.
|
|
819
|
+
*/
|
|
820
|
+
/** Периодичность записи реестра плановых расходов — значения перечисления `ExpensePlanRecurrence`. */
|
|
821
|
+
type ExpensePlanRecurrenceKey = 'NONE' | 'MONTHLY' | 'QUARTERLY' | 'YEARLY';
|
|
822
|
+
/** Шаг серии в месяцах; 0 — разовый расход. */
|
|
823
|
+
declare const EXPENSE_PLAN_RECURRENCE_MONTHS: Readonly<Record<ExpensePlanRecurrenceKey, number>>;
|
|
824
|
+
/** Шаг серии в месяцах по значению периодичности; неизвестное значение и пустота — разовый расход. */
|
|
825
|
+
declare function expensePlanRecurrenceMonths(recurrence: string | null | undefined): number;
|
|
826
|
+
/**
|
|
827
|
+
* Срок следующего платежа серии через `months` месяцев; `null` для разового расхода.
|
|
828
|
+
*
|
|
829
|
+
* Число месяца сохраняется: платёж «11-го» остаётся 11-м. Если в целевом месяце
|
|
830
|
+
* такого числа нет (31-е в феврале), берётся последний день месяца, а не
|
|
831
|
+
* перескок в следующий месяц. Время суток сохраняется.
|
|
832
|
+
*/
|
|
833
|
+
declare function nextExpensePlanDate(from: Date, months: number): Date | null;
|
|
834
|
+
/**
|
|
835
|
+
* Сроки `count` платежей серии, начиная с `first` включительно.
|
|
836
|
+
*
|
|
837
|
+
* Каждый срок считается от предыдущего — так расширение расходов продолжает
|
|
838
|
+
* серию: новая запись получает срок от срока прошлой записи. Серия «31-го»
|
|
839
|
+
* после февраля остаётся на последнем дне февраля.
|
|
840
|
+
*/
|
|
841
|
+
declare function expensePlanScheduleDates(first: Date, months: number, count: number): Date[];
|
|
842
|
+
/**
|
|
843
|
+
* Доля суммы платежа, которую резерв держит к концу месяца.
|
|
844
|
+
*
|
|
845
|
+
* `monthsAhead` — сколько месяцев от последнего месяца, который покрывает
|
|
846
|
+
* резерв, до месяца срока платежа. Ноль и меньше — срок внутри покрытия или
|
|
847
|
+
* прошёл: резерв держит всю сумму. Повторяющийся платёж с шагом `periodMonths`
|
|
848
|
+
* собирается равными долями за `periodMonths` месяцев: за `k` месяцев до срока
|
|
849
|
+
* резерв держит `(periodMonths − k) / periodMonths` суммы, раньше — ничего.
|
|
850
|
+
* Квартальный платёж копится три месяца, годовой — двенадцать, ежемесячный и
|
|
851
|
+
* разовый — один месяц, целиком.
|
|
852
|
+
*
|
|
853
|
+
* Доля округляется вниз до единицы суммы; последний месяц перед сроком
|
|
854
|
+
* добирает остаток, и к сроку в резерве лежит вся сумма.
|
|
855
|
+
*/
|
|
856
|
+
declare function expensePlanReserveShare(amount: bigint, monthsAhead: number, periodMonths: number): bigint;
|
|
857
|
+
/** Сколько месяцев резерв копит один платёж: период повторяющегося расхода, для разового и ежемесячного — один. */
|
|
858
|
+
declare function expensePlanReserveMonths(periodMonths: number): number;
|
|
859
|
+
|
|
795
860
|
/**
|
|
796
861
|
* Предел частоты сборки документов на одного пайщика — общий для ядра и
|
|
797
862
|
* расширений, чтобы не держать число в полусотне резолверов.
|
|
@@ -1762,6 +1827,75 @@ declare function configurePlatformSettings(value: PlatformSettings): void;
|
|
|
1762
1827
|
*/
|
|
1763
1828
|
declare function platformSettings(): PlatformSettings;
|
|
1764
1829
|
|
|
1830
|
+
/**
|
|
1831
|
+
* Шкала времени стенда — общая для всех приложений (решение владельца 01.11.2026).
|
|
1832
|
+
*
|
|
1833
|
+
* В работе сутки и месяцы настоящие. На стенде разработки время сжимают, чтобы
|
|
1834
|
+
* процессы со сроками проходились за минуты: гарантийный срок заказа, списание
|
|
1835
|
+
* обеспечительной части первого числа месяца, сроки курсов «Образования».
|
|
1836
|
+
* Каждое приложение берёт длины из этой шкалы, а не держит свои переменные, — иначе
|
|
1837
|
+
* на одном стенде сутки разной длины в разных приложениях, и процессы,
|
|
1838
|
+
* связанные между собой, расходятся.
|
|
1839
|
+
*
|
|
1840
|
+
* Переменные окружения контроллера:
|
|
1841
|
+
* - `STAND_DAY_SECONDS` — длина суток, секунд (86400 — настоящие);
|
|
1842
|
+
* - `STAND_MONTH_SECONDS` — длина месяца, секунд; 0 — настоящий месяц. Не
|
|
1843
|
+
* задана — при укороченных сутках месяц равен десяти суткам;
|
|
1844
|
+
* - `STAND_WORKER_PACE_SECONDS` — шаг фоновых обходов при сжатом времени,
|
|
1845
|
+
* секунд; не задан — минута.
|
|
1846
|
+
*
|
|
1847
|
+
* `NODE_ENV=production` (боевая и тестовая сеть) — сжатия нет никогда, переменные
|
|
1848
|
+
* не действуют: ошибка в окружении прода не сокращает ничьих сроков.
|
|
1849
|
+
*
|
|
1850
|
+
* Прежние переменные «Образования» (`EDUBRIDGE_GUARANTEE_DAY_SECONDS` и др.)
|
|
1851
|
+
* читает само «Образование» как запасные — ради стендов, где они уже стоят.
|
|
1852
|
+
*/
|
|
1853
|
+
/** Длина суток на стенде, секунд. В работе — всегда настоящие сутки. */
|
|
1854
|
+
declare function standDaySeconds(): number;
|
|
1855
|
+
/** Задана ли шкала стенда явно (хоть одна из переменных). */
|
|
1856
|
+
declare function isStandTimeConfigured(): boolean;
|
|
1857
|
+
/** Длина месяца на стенде, секунд; 0 — настоящий месяц. */
|
|
1858
|
+
declare function standMonthSeconds(): number;
|
|
1859
|
+
/** Время сжато: сутки короче настоящих либо месяц задан длиной. */
|
|
1860
|
+
declare function isStandTimeCompressed(): boolean;
|
|
1861
|
+
/**
|
|
1862
|
+
* Шаг фонового обхода, секунд: в работе — свой шаг приложения, при сжатом
|
|
1863
|
+
* времени — шаг стенда (по умолчанию минута).
|
|
1864
|
+
*/
|
|
1865
|
+
declare function standWorkerPaceSeconds(productionPaceSeconds: number): number;
|
|
1866
|
+
/**
|
|
1867
|
+
* Черёд фонового обхода, который просыпается каждую минуту: в работе — на
|
|
1868
|
+
* каждой минуте, кратной своему шагу (шаг часа — нулевая минута часа), при
|
|
1869
|
+
* сжатом времени — по шагу стенда.
|
|
1870
|
+
*/
|
|
1871
|
+
declare function isStandWorkerTurn(productionPaceSeconds: number, now?: Date): boolean;
|
|
1872
|
+
/**
|
|
1873
|
+
* Номер расчётного периода «месяц», в который попадает момент. В работе —
|
|
1874
|
+
* календарный месяц в часовом поясе кооператива (год × 12 + месяц). При
|
|
1875
|
+
* заданной длине месяца стенда — номер отрезка этой длины от начала эпохи:
|
|
1876
|
+
* «первое число» наступает каждые `STAND_MONTH_SECONDS` секунд.
|
|
1877
|
+
*/
|
|
1878
|
+
declare function standPeriodKey(date: Date, timeZone: string): number;
|
|
1879
|
+
/**
|
|
1880
|
+
* Начало расчётного месяца, следующего за моментом: «первое число», с
|
|
1881
|
+
* которого строка созревает к списанию. В работе — 00:00 первого числа
|
|
1882
|
+
* следующего календарного месяца в часовом поясе кооператива, при заданной
|
|
1883
|
+
* длине месяца стенда — начало следующего отрезка этой длины.
|
|
1884
|
+
*/
|
|
1885
|
+
declare function standNextPeriodStart(date: Date, timeZone: string): Date;
|
|
1886
|
+
/** Строка для журнала при запуске: какая шкала действует. */
|
|
1887
|
+
declare function describeStandTime(): string;
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Календарный день по часовому поясу кооператива. Сроки, которые человек
|
|
1891
|
+
* понимает «до конца дня» (код передачи на пункте выдачи), считаются здесь:
|
|
1892
|
+
* полночь — местная, а не UTC.
|
|
1893
|
+
*/
|
|
1894
|
+
/** Смещение часового пояса от UTC в момент, миллисекунд (Москва — +3 ч). */
|
|
1895
|
+
declare function timeZoneOffsetMs(date: Date, timeZone: string): number;
|
|
1896
|
+
/** Полночь, которой кончается текущий день момента в часовом поясе кооператива. */
|
|
1897
|
+
declare function nextLocalMidnight(date: Date, timeZone: string): Date;
|
|
1898
|
+
|
|
1765
1899
|
type GeneratedDocumentDomainInterface = Omit<IGeneratedDocument, 'binary'> & {
|
|
1766
1900
|
binary: string;
|
|
1767
1901
|
};
|
|
@@ -2365,5 +2499,5 @@ declare function chainRefusalOf(error: unknown): DomainError | null;
|
|
|
2365
2499
|
*/
|
|
2366
2500
|
declare function rethrowChainError(error: unknown): never;
|
|
2367
2501
|
|
|
2368
|
-
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, 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, KYSELY, LOG_EXTENSION_REPOSITORY, LangType, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, MAIN_DATABASE, 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, TableStore, TransactionDTO, UseBucket, affectedCount, attachOne, bucketProvidersFor, bucketTokenFor, buildPaginationResult, camelRow, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configureLocalChangePublisher, configurePlatformSettings, councilRolesOf, createPaginationResult, describeConfigField, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, inTransaction, isChainTextDigest, isChainTextOf, isExtensionAvailable, memberRolesOf, mergeSecretConfig, paginationInputToOffset, parseChainAssert, pendingLocalChanges, pickDefined, platformSettings, providerSuppliedPaths, rawQuery, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, snakeRow, sortColumn, sortDirection, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
|
|
2369
|
-
export type { AppRights, AssignableRole, AttachedRole, BucketSource, BucketSpec, CouncilRole, DeserializedDescriptionOfExtension, DesktopGrantsRequest, DomainErrorParams, EventSource, EventWait, ExcludeCommonProps, ExtensionAppTerminatePayload, ExtensionAuthOptions, ExtensionConfigFieldPolicy, ExtensionConfigPolicy, ExtensionDatabaseMigrationClass, ExtensionDomainInterface, ExtensionDomainRepository, ExtensionSchemaMigrationAfterContext, GeneratedDocumentDomainInterface, GeneratedDocumentDraft, GrantedAction, IDesktopConfig, IExtensionSchemaMigration, IGrantedScope, IRegistryExtension, IResolvedRegistryExtension, IRightRequirement, LoadGeneratedDocumentByDocHash, LogExtensionDomainInterface, LogExtensionDomainRepository, LogExtensionFilter, LogExtensionPaginationOptions, LogExtensionPaginationResult, MainDatabase, MemberRole, NarrowRightScope, PaymentDetails, PendingLocalChange, PlatformBlockchainSettings, PlatformSettings, RegisteredBucket, RequireFields, RightActor, RightFacts, RightGrant, RightOutcome, RightScope, RightSource, RightsCaller, RightsGroup, RightsTable, RolePermission, SchemaMigration, SchemaMigrationClass, SchemaQueryRunner, ScopeCheckInput, ScopeCheckResult, SignedDocumentMetaCompareMode, SignedDocumentMetaVerification, SignedDocumentToVerify, TransactResultWithResponse };
|
|
2502
|
+
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, DocumentAggregateDTO, DomainError, DomainToBlockchainUtils, EMPTY_HASH, EXPENSE_PLAN_RECURRENCE_MONTHS, 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, KYSELY, LOG_EXTENSION_REPOSITORY, LangType, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, MAIN_DATABASE, 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, TableStore, TransactionDTO, UseBucket, affectedCount, attachOne, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, camelRow, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configureLocalChangePublisher, configurePlatformSettings, councilRolesOf, createPaginationResult, describeConfigField, describeStandTime, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, expensePlanRecurrenceMonths, expensePlanReserveMonths, expensePlanReserveShare, expensePlanScheduleDates, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, inTransaction, isChainTextDigest, isChainTextOf, isExtensionAvailable, isStandTimeCompressed, isStandTimeConfigured, isStandWorkerTurn, memberRolesOf, mergeSecretConfig, nextExpensePlanDate, nextLocalMidnight, paginationInputToOffset, parseChainAssert, pendingLocalChanges, pickDefined, platformSettings, providerSuppliedPaths, rawQuery, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, snakeRow, sortColumn, sortDirection, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
|
|
2503
|
+
export type { AppRights, AssignableRole, AttachedRole, BucketSource, BucketSpec, CouncilRole, DeserializedDescriptionOfExtension, DesktopGrantsRequest, DomainErrorParams, EventSource, EventWait, ExcludeCommonProps, ExpensePlanRecurrenceKey, ExtensionAppTerminatePayload, ExtensionAuthOptions, ExtensionConfigFieldPolicy, ExtensionConfigPolicy, ExtensionDatabaseMigrationClass, ExtensionDomainInterface, ExtensionDomainRepository, ExtensionSchemaMigrationAfterContext, GeneratedDocumentDomainInterface, GeneratedDocumentDraft, GrantedAction, IDesktopConfig, IExtensionSchemaMigration, IGrantedScope, IRegistryExtension, IResolvedRegistryExtension, IRightRequirement, LoadGeneratedDocumentByDocHash, LogExtensionDomainInterface, LogExtensionDomainRepository, LogExtensionFilter, LogExtensionPaginationOptions, LogExtensionPaginationResult, MainDatabase, MemberRole, NarrowRightScope, PaymentDetails, PendingLocalChange, PlatformBlockchainSettings, PlatformSettings, RegisteredBucket, RequireFields, RightActor, RightFacts, RightGrant, RightOutcome, RightScope, RightSource, RightsCaller, RightsGroup, RightsTable, RolePermission, SchemaMigration, SchemaMigrationClass, SchemaQueryRunner, ScopeCheckInput, ScopeCheckResult, SignedDocumentMetaCompareMode, SignedDocumentMetaVerification, SignedDocumentToVerify, TransactResultWithResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -560,6 +560,19 @@ declare abstract class IPNProvider extends PaymentProvider {
|
|
|
560
560
|
abstract handleIPN(request: any): Promise<void>;
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Текст для банковского поручения: назначение платежа, строка QR-кода оплаты.
|
|
565
|
+
*
|
|
566
|
+
* Банки не принимают букву «ё» в назначении платежа: пайщик копирует
|
|
567
|
+
* назначение в банк, и поручение с «Цифровой Кошелёк» или «аванс под отчёт»
|
|
568
|
+
* отклоняется (владелец 06.11.2026). Буква заменяется на «е» там, где
|
|
569
|
+
* назначение записывается в платёж, заявку на выплату или реквизиты, — один
|
|
570
|
+
* раз и для всех источников: подписи в словарях и тексты интерфейса остаются
|
|
571
|
+
* с «ё», меняется только текст, который передаётся в банк.
|
|
572
|
+
*/
|
|
573
|
+
declare function bankSafeText(text: string): string;
|
|
574
|
+
declare function bankSafeText(text: string | null | undefined): string | null | undefined;
|
|
575
|
+
|
|
563
576
|
/**
|
|
564
577
|
* Объявление хранилища файлов, которое заводит себе расширение.
|
|
565
578
|
*
|
|
@@ -735,6 +748,7 @@ declare class ExpenseProposalItemInputDTO {
|
|
|
735
748
|
payment_purpose?: string;
|
|
736
749
|
payment_method_id?: string;
|
|
737
750
|
recipient_username?: string;
|
|
751
|
+
counterparty_id?: number;
|
|
738
752
|
}
|
|
739
753
|
/**
|
|
740
754
|
* Публичная позиция подписанной meta — ровно то, что публикуется on-chain.
|
|
@@ -792,6 +806,57 @@ declare class ExpenseProposalStatementSignedDocumentInputDTO extends SignedDigit
|
|
|
792
806
|
readonly meta: ExpenseProposalStatementSignedMetaDocumentInputDTO;
|
|
793
807
|
}
|
|
794
808
|
|
|
809
|
+
/**
|
|
810
|
+
* Календарь повторяющегося планового расхода (задача 99D-34, решение
|
|
811
|
+
* владельца 11.11.2026).
|
|
812
|
+
*
|
|
813
|
+
* Одна реализация на два расширения: расходы продолжают по ней серию записей
|
|
814
|
+
* реестра, Стол заказов по ней же показывает председателю сроки будущих
|
|
815
|
+
* платежей и считает резерв участка. Если правило поменяется только в одном
|
|
816
|
+
* месте, экран пообещает один срок, а реестр заведёт другой.
|
|
817
|
+
*
|
|
818
|
+
* Календарь ведётся по UTC — как месяцы контракта и узла.
|
|
819
|
+
*/
|
|
820
|
+
/** Периодичность записи реестра плановых расходов — значения перечисления `ExpensePlanRecurrence`. */
|
|
821
|
+
type ExpensePlanRecurrenceKey = 'NONE' | 'MONTHLY' | 'QUARTERLY' | 'YEARLY';
|
|
822
|
+
/** Шаг серии в месяцах; 0 — разовый расход. */
|
|
823
|
+
declare const EXPENSE_PLAN_RECURRENCE_MONTHS: Readonly<Record<ExpensePlanRecurrenceKey, number>>;
|
|
824
|
+
/** Шаг серии в месяцах по значению периодичности; неизвестное значение и пустота — разовый расход. */
|
|
825
|
+
declare function expensePlanRecurrenceMonths(recurrence: string | null | undefined): number;
|
|
826
|
+
/**
|
|
827
|
+
* Срок следующего платежа серии через `months` месяцев; `null` для разового расхода.
|
|
828
|
+
*
|
|
829
|
+
* Число месяца сохраняется: платёж «11-го» остаётся 11-м. Если в целевом месяце
|
|
830
|
+
* такого числа нет (31-е в феврале), берётся последний день месяца, а не
|
|
831
|
+
* перескок в следующий месяц. Время суток сохраняется.
|
|
832
|
+
*/
|
|
833
|
+
declare function nextExpensePlanDate(from: Date, months: number): Date | null;
|
|
834
|
+
/**
|
|
835
|
+
* Сроки `count` платежей серии, начиная с `first` включительно.
|
|
836
|
+
*
|
|
837
|
+
* Каждый срок считается от предыдущего — так расширение расходов продолжает
|
|
838
|
+
* серию: новая запись получает срок от срока прошлой записи. Серия «31-го»
|
|
839
|
+
* после февраля остаётся на последнем дне февраля.
|
|
840
|
+
*/
|
|
841
|
+
declare function expensePlanScheduleDates(first: Date, months: number, count: number): Date[];
|
|
842
|
+
/**
|
|
843
|
+
* Доля суммы платежа, которую резерв держит к концу месяца.
|
|
844
|
+
*
|
|
845
|
+
* `monthsAhead` — сколько месяцев от последнего месяца, который покрывает
|
|
846
|
+
* резерв, до месяца срока платежа. Ноль и меньше — срок внутри покрытия или
|
|
847
|
+
* прошёл: резерв держит всю сумму. Повторяющийся платёж с шагом `periodMonths`
|
|
848
|
+
* собирается равными долями за `periodMonths` месяцев: за `k` месяцев до срока
|
|
849
|
+
* резерв держит `(periodMonths − k) / periodMonths` суммы, раньше — ничего.
|
|
850
|
+
* Квартальный платёж копится три месяца, годовой — двенадцать, ежемесячный и
|
|
851
|
+
* разовый — один месяц, целиком.
|
|
852
|
+
*
|
|
853
|
+
* Доля округляется вниз до единицы суммы; последний месяц перед сроком
|
|
854
|
+
* добирает остаток, и к сроку в резерве лежит вся сумма.
|
|
855
|
+
*/
|
|
856
|
+
declare function expensePlanReserveShare(amount: bigint, monthsAhead: number, periodMonths: number): bigint;
|
|
857
|
+
/** Сколько месяцев резерв копит один платёж: период повторяющегося расхода, для разового и ежемесячного — один. */
|
|
858
|
+
declare function expensePlanReserveMonths(periodMonths: number): number;
|
|
859
|
+
|
|
795
860
|
/**
|
|
796
861
|
* Предел частоты сборки документов на одного пайщика — общий для ядра и
|
|
797
862
|
* расширений, чтобы не держать число в полусотне резолверов.
|
|
@@ -1762,6 +1827,75 @@ declare function configurePlatformSettings(value: PlatformSettings): void;
|
|
|
1762
1827
|
*/
|
|
1763
1828
|
declare function platformSettings(): PlatformSettings;
|
|
1764
1829
|
|
|
1830
|
+
/**
|
|
1831
|
+
* Шкала времени стенда — общая для всех приложений (решение владельца 01.11.2026).
|
|
1832
|
+
*
|
|
1833
|
+
* В работе сутки и месяцы настоящие. На стенде разработки время сжимают, чтобы
|
|
1834
|
+
* процессы со сроками проходились за минуты: гарантийный срок заказа, списание
|
|
1835
|
+
* обеспечительной части первого числа месяца, сроки курсов «Образования».
|
|
1836
|
+
* Каждое приложение берёт длины из этой шкалы, а не держит свои переменные, — иначе
|
|
1837
|
+
* на одном стенде сутки разной длины в разных приложениях, и процессы,
|
|
1838
|
+
* связанные между собой, расходятся.
|
|
1839
|
+
*
|
|
1840
|
+
* Переменные окружения контроллера:
|
|
1841
|
+
* - `STAND_DAY_SECONDS` — длина суток, секунд (86400 — настоящие);
|
|
1842
|
+
* - `STAND_MONTH_SECONDS` — длина месяца, секунд; 0 — настоящий месяц. Не
|
|
1843
|
+
* задана — при укороченных сутках месяц равен десяти суткам;
|
|
1844
|
+
* - `STAND_WORKER_PACE_SECONDS` — шаг фоновых обходов при сжатом времени,
|
|
1845
|
+
* секунд; не задан — минута.
|
|
1846
|
+
*
|
|
1847
|
+
* `NODE_ENV=production` (боевая и тестовая сеть) — сжатия нет никогда, переменные
|
|
1848
|
+
* не действуют: ошибка в окружении прода не сокращает ничьих сроков.
|
|
1849
|
+
*
|
|
1850
|
+
* Прежние переменные «Образования» (`EDUBRIDGE_GUARANTEE_DAY_SECONDS` и др.)
|
|
1851
|
+
* читает само «Образование» как запасные — ради стендов, где они уже стоят.
|
|
1852
|
+
*/
|
|
1853
|
+
/** Длина суток на стенде, секунд. В работе — всегда настоящие сутки. */
|
|
1854
|
+
declare function standDaySeconds(): number;
|
|
1855
|
+
/** Задана ли шкала стенда явно (хоть одна из переменных). */
|
|
1856
|
+
declare function isStandTimeConfigured(): boolean;
|
|
1857
|
+
/** Длина месяца на стенде, секунд; 0 — настоящий месяц. */
|
|
1858
|
+
declare function standMonthSeconds(): number;
|
|
1859
|
+
/** Время сжато: сутки короче настоящих либо месяц задан длиной. */
|
|
1860
|
+
declare function isStandTimeCompressed(): boolean;
|
|
1861
|
+
/**
|
|
1862
|
+
* Шаг фонового обхода, секунд: в работе — свой шаг приложения, при сжатом
|
|
1863
|
+
* времени — шаг стенда (по умолчанию минута).
|
|
1864
|
+
*/
|
|
1865
|
+
declare function standWorkerPaceSeconds(productionPaceSeconds: number): number;
|
|
1866
|
+
/**
|
|
1867
|
+
* Черёд фонового обхода, который просыпается каждую минуту: в работе — на
|
|
1868
|
+
* каждой минуте, кратной своему шагу (шаг часа — нулевая минута часа), при
|
|
1869
|
+
* сжатом времени — по шагу стенда.
|
|
1870
|
+
*/
|
|
1871
|
+
declare function isStandWorkerTurn(productionPaceSeconds: number, now?: Date): boolean;
|
|
1872
|
+
/**
|
|
1873
|
+
* Номер расчётного периода «месяц», в который попадает момент. В работе —
|
|
1874
|
+
* календарный месяц в часовом поясе кооператива (год × 12 + месяц). При
|
|
1875
|
+
* заданной длине месяца стенда — номер отрезка этой длины от начала эпохи:
|
|
1876
|
+
* «первое число» наступает каждые `STAND_MONTH_SECONDS` секунд.
|
|
1877
|
+
*/
|
|
1878
|
+
declare function standPeriodKey(date: Date, timeZone: string): number;
|
|
1879
|
+
/**
|
|
1880
|
+
* Начало расчётного месяца, следующего за моментом: «первое число», с
|
|
1881
|
+
* которого строка созревает к списанию. В работе — 00:00 первого числа
|
|
1882
|
+
* следующего календарного месяца в часовом поясе кооператива, при заданной
|
|
1883
|
+
* длине месяца стенда — начало следующего отрезка этой длины.
|
|
1884
|
+
*/
|
|
1885
|
+
declare function standNextPeriodStart(date: Date, timeZone: string): Date;
|
|
1886
|
+
/** Строка для журнала при запуске: какая шкала действует. */
|
|
1887
|
+
declare function describeStandTime(): string;
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Календарный день по часовому поясу кооператива. Сроки, которые человек
|
|
1891
|
+
* понимает «до конца дня» (код передачи на пункте выдачи), считаются здесь:
|
|
1892
|
+
* полночь — местная, а не UTC.
|
|
1893
|
+
*/
|
|
1894
|
+
/** Смещение часового пояса от UTC в момент, миллисекунд (Москва — +3 ч). */
|
|
1895
|
+
declare function timeZoneOffsetMs(date: Date, timeZone: string): number;
|
|
1896
|
+
/** Полночь, которой кончается текущий день момента в часовом поясе кооператива. */
|
|
1897
|
+
declare function nextLocalMidnight(date: Date, timeZone: string): Date;
|
|
1898
|
+
|
|
1765
1899
|
type GeneratedDocumentDomainInterface = Omit<IGeneratedDocument, 'binary'> & {
|
|
1766
1900
|
binary: string;
|
|
1767
1901
|
};
|
|
@@ -2365,5 +2499,5 @@ declare function chainRefusalOf(error: unknown): DomainError | null;
|
|
|
2365
2499
|
*/
|
|
2366
2500
|
declare function rethrowChainError(error: unknown): never;
|
|
2367
2501
|
|
|
2368
|
-
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, 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, KYSELY, LOG_EXTENSION_REPOSITORY, LangType, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, MAIN_DATABASE, 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, TableStore, TransactionDTO, UseBucket, affectedCount, attachOne, bucketProvidersFor, bucketTokenFor, buildPaginationResult, camelRow, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configureLocalChangePublisher, configurePlatformSettings, councilRolesOf, createPaginationResult, describeConfigField, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, inTransaction, isChainTextDigest, isChainTextOf, isExtensionAvailable, memberRolesOf, mergeSecretConfig, paginationInputToOffset, parseChainAssert, pendingLocalChanges, pickDefined, platformSettings, providerSuppliedPaths, rawQuery, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, snakeRow, sortColumn, sortDirection, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
|
|
2369
|
-
export type { AppRights, AssignableRole, AttachedRole, BucketSource, BucketSpec, CouncilRole, DeserializedDescriptionOfExtension, DesktopGrantsRequest, DomainErrorParams, EventSource, EventWait, ExcludeCommonProps, ExtensionAppTerminatePayload, ExtensionAuthOptions, ExtensionConfigFieldPolicy, ExtensionConfigPolicy, ExtensionDatabaseMigrationClass, ExtensionDomainInterface, ExtensionDomainRepository, ExtensionSchemaMigrationAfterContext, GeneratedDocumentDomainInterface, GeneratedDocumentDraft, GrantedAction, IDesktopConfig, IExtensionSchemaMigration, IGrantedScope, IRegistryExtension, IResolvedRegistryExtension, IRightRequirement, LoadGeneratedDocumentByDocHash, LogExtensionDomainInterface, LogExtensionDomainRepository, LogExtensionFilter, LogExtensionPaginationOptions, LogExtensionPaginationResult, MainDatabase, MemberRole, NarrowRightScope, PaymentDetails, PendingLocalChange, PlatformBlockchainSettings, PlatformSettings, RegisteredBucket, RequireFields, RightActor, RightFacts, RightGrant, RightOutcome, RightScope, RightSource, RightsCaller, RightsGroup, RightsTable, RolePermission, SchemaMigration, SchemaMigrationClass, SchemaQueryRunner, ScopeCheckInput, ScopeCheckResult, SignedDocumentMetaCompareMode, SignedDocumentMetaVerification, SignedDocumentToVerify, TransactResultWithResponse };
|
|
2502
|
+
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, DocumentAggregateDTO, DomainError, DomainToBlockchainUtils, EMPTY_HASH, EXPENSE_PLAN_RECURRENCE_MONTHS, 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, KYSELY, LOG_EXTENSION_REPOSITORY, LangType, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, MAIN_DATABASE, 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, TableStore, TransactionDTO, UseBucket, affectedCount, attachOne, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, camelRow, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configureLocalChangePublisher, configurePlatformSettings, councilRolesOf, createPaginationResult, describeConfigField, describeStandTime, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, expensePlanRecurrenceMonths, expensePlanReserveMonths, expensePlanReserveShare, expensePlanScheduleDates, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, inTransaction, isChainTextDigest, isChainTextOf, isExtensionAvailable, isStandTimeCompressed, isStandTimeConfigured, isStandWorkerTurn, memberRolesOf, mergeSecretConfig, nextExpensePlanDate, nextLocalMidnight, paginationInputToOffset, parseChainAssert, pendingLocalChanges, pickDefined, platformSettings, providerSuppliedPaths, rawQuery, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, snakeRow, sortColumn, sortDirection, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
|
|
2503
|
+
export type { AppRights, AssignableRole, AttachedRole, BucketSource, BucketSpec, CouncilRole, DeserializedDescriptionOfExtension, DesktopGrantsRequest, DomainErrorParams, EventSource, EventWait, ExcludeCommonProps, ExpensePlanRecurrenceKey, ExtensionAppTerminatePayload, ExtensionAuthOptions, ExtensionConfigFieldPolicy, ExtensionConfigPolicy, ExtensionDatabaseMigrationClass, ExtensionDomainInterface, ExtensionDomainRepository, ExtensionSchemaMigrationAfterContext, GeneratedDocumentDomainInterface, GeneratedDocumentDraft, GrantedAction, IDesktopConfig, IExtensionSchemaMigration, IGrantedScope, IRegistryExtension, IResolvedRegistryExtension, IRightRequirement, LoadGeneratedDocumentByDocHash, LogExtensionDomainInterface, LogExtensionDomainRepository, LogExtensionFilter, LogExtensionPaginationOptions, LogExtensionPaginationResult, MainDatabase, MemberRole, NarrowRightScope, PaymentDetails, PendingLocalChange, PlatformBlockchainSettings, PlatformSettings, RegisteredBucket, RequireFields, RightActor, RightFacts, RightGrant, RightOutcome, RightScope, RightSource, RightsCaller, RightsGroup, RightsTable, RolePermission, SchemaMigration, SchemaMigrationClass, SchemaQueryRunner, ScopeCheckInput, ScopeCheckResult, SignedDocumentMetaCompareMode, SignedDocumentMetaVerification, SignedDocumentToVerify, TransactResultWithResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -710,6 +710,12 @@ IPNProvider = __decorateClass$n([
|
|
|
710
710
|
Injectable()
|
|
711
711
|
], IPNProvider);
|
|
712
712
|
|
|
713
|
+
function bankSafeText(text) {
|
|
714
|
+
if (text == null)
|
|
715
|
+
return text;
|
|
716
|
+
return text.replace(/ё/g, "\u0435").replace(/Ё/g, "\u0415");
|
|
717
|
+
}
|
|
718
|
+
|
|
713
719
|
const REGISTERED = /* @__PURE__ */ new Map();
|
|
714
720
|
const BucketRegistry = {
|
|
715
721
|
add(cls, spec) {
|
|
@@ -1069,6 +1075,14 @@ __decorateClass$j([
|
|
|
1069
1075
|
IsOptional(),
|
|
1070
1076
|
IsString()
|
|
1071
1077
|
], ExpenseProposalItemInputDTO.prototype, "recipient_username", 2);
|
|
1078
|
+
__decorateClass$j([
|
|
1079
|
+
Field(() => Int, {
|
|
1080
|
+
description: "\u041A\u043E\u043D\u0442\u0440\u0430\u0433\u0435\u043D\u0442-\u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044C \u0438\u0437 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u043A\u043E\u043D\u0442\u0440\u0430\u0433\u0435\u043D\u0442\u043E\u0432 \u2014 \u0441\u0435\u0440\u0432\u0435\u0440 \u043F\u043E\u0434\u0441\u0442\u0430\u0432\u0438\u0442 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0438 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u044B \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442.",
|
|
1081
|
+
nullable: true
|
|
1082
|
+
}),
|
|
1083
|
+
IsOptional(),
|
|
1084
|
+
IsInt()
|
|
1085
|
+
], ExpenseProposalItemInputDTO.prototype, "counterparty_id", 2);
|
|
1072
1086
|
ExpenseProposalItemInputDTO = __decorateClass$j([
|
|
1073
1087
|
InputType("ExpenseProposalItemInput")
|
|
1074
1088
|
], ExpenseProposalItemInputDTO);
|
|
@@ -1209,6 +1223,61 @@ ExpenseProposalStatementSignedDocumentInputDTO = __decorateClass$j([
|
|
|
1209
1223
|
InputType("ExpenseProposalStatementSignedDocumentInput")
|
|
1210
1224
|
], ExpenseProposalStatementSignedDocumentInputDTO);
|
|
1211
1225
|
|
|
1226
|
+
const EXPENSE_PLAN_RECURRENCE_MONTHS = {
|
|
1227
|
+
NONE: 0,
|
|
1228
|
+
MONTHLY: 1,
|
|
1229
|
+
QUARTERLY: 3,
|
|
1230
|
+
YEARLY: 12
|
|
1231
|
+
};
|
|
1232
|
+
function expensePlanRecurrenceMonths(recurrence) {
|
|
1233
|
+
if (!recurrence)
|
|
1234
|
+
return 0;
|
|
1235
|
+
return EXPENSE_PLAN_RECURRENCE_MONTHS[recurrence] ?? 0;
|
|
1236
|
+
}
|
|
1237
|
+
function nextExpensePlanDate(from, months) {
|
|
1238
|
+
if (!Number.isInteger(months) || months <= 0)
|
|
1239
|
+
return null;
|
|
1240
|
+
const year = from.getUTCFullYear();
|
|
1241
|
+
const month = from.getUTCMonth() + months;
|
|
1242
|
+
const lastDay = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
|
1243
|
+
const day = Math.min(from.getUTCDate(), lastDay);
|
|
1244
|
+
return new Date(
|
|
1245
|
+
Date.UTC(
|
|
1246
|
+
year,
|
|
1247
|
+
month,
|
|
1248
|
+
day,
|
|
1249
|
+
from.getUTCHours(),
|
|
1250
|
+
from.getUTCMinutes(),
|
|
1251
|
+
from.getUTCSeconds(),
|
|
1252
|
+
from.getUTCMilliseconds()
|
|
1253
|
+
)
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
function expensePlanScheduleDates(first, months, count) {
|
|
1257
|
+
if (count <= 0)
|
|
1258
|
+
return [];
|
|
1259
|
+
const dates = [first];
|
|
1260
|
+
let current = first;
|
|
1261
|
+
while (dates.length < count && current) {
|
|
1262
|
+
current = nextExpensePlanDate(current, months);
|
|
1263
|
+
if (current)
|
|
1264
|
+
dates.push(current);
|
|
1265
|
+
}
|
|
1266
|
+
return dates;
|
|
1267
|
+
}
|
|
1268
|
+
function expensePlanReserveShare(amount, monthsAhead, periodMonths) {
|
|
1269
|
+
if (amount <= 0n)
|
|
1270
|
+
return 0n;
|
|
1271
|
+
if (monthsAhead <= 0)
|
|
1272
|
+
return amount;
|
|
1273
|
+
if (!Number.isInteger(periodMonths) || periodMonths <= 1 || monthsAhead >= periodMonths)
|
|
1274
|
+
return 0n;
|
|
1275
|
+
return amount * BigInt(periodMonths - monthsAhead) / BigInt(periodMonths);
|
|
1276
|
+
}
|
|
1277
|
+
function expensePlanReserveMonths(periodMonths) {
|
|
1278
|
+
return Number.isInteger(periodMonths) && periodMonths > 1 ? periodMonths : 1;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1212
1281
|
const DOCUMENT_GENERATION_THROTTLE = { default: { limit: 60, ttl: 6e4 } };
|
|
1213
1282
|
|
|
1214
1283
|
var __defProp$i = Object.defineProperty;
|
|
@@ -2299,6 +2368,103 @@ function platformSettings() {
|
|
|
2299
2368
|
return settings;
|
|
2300
2369
|
}
|
|
2301
2370
|
|
|
2371
|
+
function timeZoneOffsetMs(date, timeZone) {
|
|
2372
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
2373
|
+
timeZone,
|
|
2374
|
+
hourCycle: "h23",
|
|
2375
|
+
year: "numeric",
|
|
2376
|
+
month: "2-digit",
|
|
2377
|
+
day: "2-digit",
|
|
2378
|
+
hour: "2-digit",
|
|
2379
|
+
minute: "2-digit",
|
|
2380
|
+
second: "2-digit"
|
|
2381
|
+
}).formatToParts(date);
|
|
2382
|
+
const get = (type) => Number(parts.find((p) => p.type === type)?.value ?? 0);
|
|
2383
|
+
const asUtc = Date.UTC(get("year"), get("month") - 1, get("day"), get("hour"), get("minute"), get("second"));
|
|
2384
|
+
return asUtc - Math.floor(date.getTime() / 1e3) * 1e3;
|
|
2385
|
+
}
|
|
2386
|
+
function nextLocalMidnight(date, timeZone) {
|
|
2387
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(date);
|
|
2388
|
+
const get = (type) => Number(parts.find((p) => p.type === type)?.value ?? 0);
|
|
2389
|
+
const utcMidnight = Date.UTC(get("year"), get("month") - 1, get("day") + 1);
|
|
2390
|
+
return new Date(utcMidnight - timeZoneOffsetMs(new Date(utcMidnight), timeZone));
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
const SECONDS_IN_DAY = 24 * 60 * 60;
|
|
2394
|
+
const DAYS_IN_COMPRESSED_MONTH = 10;
|
|
2395
|
+
const COMPRESSED_WORKER_PACE_SECONDS = 60;
|
|
2396
|
+
function inProduction() {
|
|
2397
|
+
return process.env.NODE_ENV === "production";
|
|
2398
|
+
}
|
|
2399
|
+
function envSeconds(name, allowZero) {
|
|
2400
|
+
const raw = process.env[name];
|
|
2401
|
+
if (raw === void 0 || raw.trim() === "")
|
|
2402
|
+
return null;
|
|
2403
|
+
const value = Number(raw);
|
|
2404
|
+
if (!Number.isFinite(value))
|
|
2405
|
+
return null;
|
|
2406
|
+
if (allowZero ? value < 0 : value <= 0)
|
|
2407
|
+
return null;
|
|
2408
|
+
return Math.floor(value);
|
|
2409
|
+
}
|
|
2410
|
+
function standDaySeconds() {
|
|
2411
|
+
if (inProduction())
|
|
2412
|
+
return SECONDS_IN_DAY;
|
|
2413
|
+
return envSeconds("STAND_DAY_SECONDS", false) ?? SECONDS_IN_DAY;
|
|
2414
|
+
}
|
|
2415
|
+
function isStandTimeConfigured() {
|
|
2416
|
+
if (inProduction())
|
|
2417
|
+
return false;
|
|
2418
|
+
return envSeconds("STAND_DAY_SECONDS", false) !== null || envSeconds("STAND_MONTH_SECONDS", true) !== null || envSeconds("STAND_WORKER_PACE_SECONDS", false) !== null;
|
|
2419
|
+
}
|
|
2420
|
+
function standMonthSeconds() {
|
|
2421
|
+
if (inProduction())
|
|
2422
|
+
return 0;
|
|
2423
|
+
const custom = envSeconds("STAND_MONTH_SECONDS", true);
|
|
2424
|
+
if (custom !== null)
|
|
2425
|
+
return custom;
|
|
2426
|
+
return standDaySeconds() !== SECONDS_IN_DAY ? DAYS_IN_COMPRESSED_MONTH * standDaySeconds() : 0;
|
|
2427
|
+
}
|
|
2428
|
+
function isStandTimeCompressed() {
|
|
2429
|
+
return standDaySeconds() !== SECONDS_IN_DAY || standMonthSeconds() > 0;
|
|
2430
|
+
}
|
|
2431
|
+
function standWorkerPaceSeconds(productionPaceSeconds) {
|
|
2432
|
+
if (!isStandTimeCompressed())
|
|
2433
|
+
return productionPaceSeconds;
|
|
2434
|
+
return envSeconds("STAND_WORKER_PACE_SECONDS", false) ?? COMPRESSED_WORKER_PACE_SECONDS;
|
|
2435
|
+
}
|
|
2436
|
+
function isStandWorkerTurn(productionPaceSeconds, now = /* @__PURE__ */ new Date()) {
|
|
2437
|
+
const paceMinutes = Math.max(1, Math.round(standWorkerPaceSeconds(productionPaceSeconds) / 60));
|
|
2438
|
+
const minutes = Math.floor(now.getTime() / 6e4);
|
|
2439
|
+
return minutes % paceMinutes === 0;
|
|
2440
|
+
}
|
|
2441
|
+
function standPeriodKey(date, timeZone) {
|
|
2442
|
+
const monthSeconds = standMonthSeconds();
|
|
2443
|
+
if (monthSeconds > 0)
|
|
2444
|
+
return Math.floor(date.getTime() / 1e3 / monthSeconds);
|
|
2445
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit" }).formatToParts(date);
|
|
2446
|
+
const year = Number(parts.find((p) => p.type === "year")?.value ?? 0);
|
|
2447
|
+
const month = Number(parts.find((p) => p.type === "month")?.value ?? 0);
|
|
2448
|
+
return year * 12 + month;
|
|
2449
|
+
}
|
|
2450
|
+
function standNextPeriodStart(date, timeZone) {
|
|
2451
|
+
const monthSeconds = standMonthSeconds();
|
|
2452
|
+
if (monthSeconds > 0) {
|
|
2453
|
+
return new Date((Math.floor(date.getTime() / 1e3 / monthSeconds) + 1) * monthSeconds * 1e3);
|
|
2454
|
+
}
|
|
2455
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit" }).formatToParts(date);
|
|
2456
|
+
const year = Number(parts.find((p) => p.type === "year")?.value ?? 0);
|
|
2457
|
+
const month = Number(parts.find((p) => p.type === "month")?.value ?? 1);
|
|
2458
|
+
const utcMidnight = Date.UTC(month === 12 ? year + 1 : year, month === 12 ? 0 : month, 1);
|
|
2459
|
+
return new Date(utcMidnight - timeZoneOffsetMs(new Date(utcMidnight), timeZone));
|
|
2460
|
+
}
|
|
2461
|
+
function describeStandTime() {
|
|
2462
|
+
if (!isStandTimeCompressed())
|
|
2463
|
+
return "\u0432\u0440\u0435\u043C\u044F \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435";
|
|
2464
|
+
const month = standMonthSeconds();
|
|
2465
|
+
return `\u0432\u0440\u0435\u043C\u044F \u0441\u0442\u0435\u043D\u0434\u0430 \u0441\u0436\u0430\u0442\u043E: \u0441\u0443\u0442\u043A\u0438 ${standDaySeconds()} \u0441, \u043C\u0435\u0441\u044F\u0446 ${month > 0 ? `${month} \u0441` : "\u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0438\u0439"}, \u0448\u0430\u0433 \u043E\u0431\u0445\u043E\u0434\u043E\u0432 ${standWorkerPaceSeconds(0)} \u0441`;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2302
2468
|
var __defProp$5 = Object.defineProperty;
|
|
2303
2469
|
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
2304
2470
|
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
@@ -3168,4 +3334,4 @@ function rethrowChainError(error) {
|
|
|
3168
3334
|
throw DomainError.badRequest(code ?? "CHAIN_ASSERT", { message: text });
|
|
3169
3335
|
}
|
|
3170
3336
|
|
|
3171
|
-
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, 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, describeConfigField, 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 };
|
|
3337
|
+
export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, DocumentAggregateDTO, DomainError, DomainToBlockchainUtils, EMPTY_HASH, EXPENSE_PLAN_RECURRENCE_MONTHS, 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, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, councilRolesOf, createPaginationResult, describeConfigField, describeStandTime, desktopGrants, desktopGrantsOf, domainErrorMessage, expandRights, expensePlanRecurrenceMonths, expensePlanReserveMonths, expensePlanReserveShare, expensePlanScheduleDates, extensionDatabaseMigrations, generateHashFromString, generateRandomHash, generateUniqueHash, getAmountPlusFee, getAppliedBlockNum, hasServerSecret, isChainTextDigest, isChainTextOf, isExtensionAvailable, isStandTimeCompressed, isStandTimeConfigured, isStandWorkerTurn, memberRolesOf, mergeSecretConfig, nextExpensePlanDate, nextLocalMidnight, oneOf, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, validationMessage, verifySignedDocumentAgainstStoredDraft, waitForEvent };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopenomics/extension-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2026.
|
|
4
|
+
"version": "2026.11.12",
|
|
5
5
|
"description": "Служебный каркас расширения цифрового кооператива: базовый модуль, сущности и репозитории расширения, авторизация, каркас блокчейн-синхронизации, контракт миграций схемы, контракт реестра",
|
|
6
6
|
"author": "Alex Ant <dacom.dark.sun@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@casl/ability": "^7.0.0",
|
|
42
|
-
"@coopenomics/docs-templates": "1.
|
|
42
|
+
"@coopenomics/docs-templates": "1.6.8",
|
|
43
43
|
"@coopenomics/i18n": "workspace:*",
|
|
44
|
-
"@coopenomics/sdk": "2026.
|
|
44
|
+
"@coopenomics/sdk": "2026.11.12",
|
|
45
45
|
"@nestjs/common": "^10.0.0",
|
|
46
46
|
"@nestjs/core": "^10.0.0",
|
|
47
47
|
"@nestjs/graphql": "^12.2.1",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@casl/ability": "^7.0.0",
|
|
65
|
-
"@coopenomics/docs-templates": "1.
|
|
66
|
-
"@coopenomics/i18n": "2026.
|
|
65
|
+
"@coopenomics/docs-templates": "1.6.8",
|
|
66
|
+
"@coopenomics/i18n": "2026.11.12",
|
|
67
67
|
"@nestjs/common": "^10.0.0",
|
|
68
68
|
"@nestjs/core": "^10.0.0",
|
|
69
69
|
"@nestjs/graphql": "^12.2.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@wharfkit/session": "^1.4.0",
|
|
73
73
|
"class-transformer": "^0.5.1",
|
|
74
74
|
"class-validator": "^0.14.1",
|
|
75
|
-
"cooptypes": "2026.
|
|
75
|
+
"cooptypes": "2026.11.12",
|
|
76
76
|
"graphql": "^16.9.0",
|
|
77
77
|
"graphql-type-json": "^0.3.2",
|
|
78
78
|
"kysely": "0.28.17",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"unbuild": "^2.0.0",
|
|
85
85
|
"zod": "^3.0.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "9fa6f0a01605abfd193f774f6a2f5211e92f9482"
|
|
88
88
|
}
|