@coopenomics/extension-kit 2026.12.3-dev.9 → 2026.12.5-dev.19

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 CHANGED
@@ -2862,7 +2862,21 @@ function parseChainAssert(message) {
2862
2862
  const coded = body.match(CODED);
2863
2863
  return coded ? { code: coded[1], text: coded[2].trim() } : { text: body };
2864
2864
  }
2865
+ const REFUSAL_CODE = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/;
2866
+ function portRefusalOf(error) {
2867
+ if (!error || typeof error !== "object" || error instanceof DomainError)
2868
+ return null;
2869
+ const { code, status, params, message } = error;
2870
+ if (typeof code !== "string" || !REFUSAL_CODE.test(code))
2871
+ return null;
2872
+ if (typeof status !== "number" || status < 400 || status >= 500)
2873
+ return null;
2874
+ const known = params && typeof params === "object" ? params : {};
2875
+ const text = typeof known.message === "string" ? known.message : typeof message === "string" ? message : void 0;
2876
+ return new DomainError(code, text === void 0 ? { ...known } : { ...known, message: text }, status);
2877
+ }
2865
2878
  function chainErrorCode(error) {
2879
+ error = portRefusalOf(error) ?? error;
2866
2880
  if (error instanceof DomainError) {
2867
2881
  if (error.code !== "CHAIN_ASSERT" && error.code !== "CHAIN_ERROR")
2868
2882
  return error.code;
@@ -2874,6 +2888,9 @@ function chainErrorCode(error) {
2874
2888
  function chainRefusalOf(error) {
2875
2889
  if (error instanceof DomainError)
2876
2890
  return error;
2891
+ const portRefusal = portRefusalOf(error);
2892
+ if (portRefusal)
2893
+ return portRefusal;
2877
2894
  const raw = error?.message ?? String(error);
2878
2895
  const encoding = raw.match(ENCODING);
2879
2896
  if (encoding) {
@@ -2888,6 +2905,9 @@ function chainRefusalOf(error) {
2888
2905
  function rethrowChainError(error) {
2889
2906
  if (error instanceof DomainError)
2890
2907
  throw error;
2908
+ const portRefusal = portRefusalOf(error);
2909
+ if (portRefusal)
2910
+ throw portRefusal;
2891
2911
  const raw = error?.message ?? String(error);
2892
2912
  const match = raw.match(ASSERT_PREFIX);
2893
2913
  if (!match)
@@ -3011,6 +3031,7 @@ exports.paginationInputToOffset = paginationInputToOffset;
3011
3031
  exports.parseChainAssert = parseChainAssert;
3012
3032
  exports.pickDefined = pickDefined;
3013
3033
  exports.platformSettings = platformSettings;
3034
+ exports.portRefusalOf = portRefusalOf;
3014
3035
  exports.processContentRegistry = processContentRegistry;
3015
3036
  exports.providerSuppliedPaths = providerSuppliedPaths;
3016
3037
  exports.redactSecretConfig = redactSecretConfig;
package/dist/index.d.cts CHANGED
@@ -2273,6 +2273,17 @@ declare function parseChainAssert(message: string): {
2273
2273
  code?: string;
2274
2274
  text: string;
2275
2275
  };
2276
+ /**
2277
+ * Отказ ядра, полученный приложением каталога по порту (`CorePortError`
2278
+ * extension-sdk): код, параметры и HTTP-статус ответа ядра. Узнаётся по форме —
2279
+ * каркас от SDK не зависит. Только отказ (статус 4xx): сбой ядра или сети
2280
+ * остаётся сбоем.
2281
+ *
2282
+ * Без перевода отказ цепи, который ядро уже разобрало (`CHAIN_ASSERT`,
2283
+ * `GATEWAY_OUTCOME_NOT_FOUND`), приложение переписывало в `CHAIN_ERROR` и терял
2284
+ * код контракта (Blackbox 05.12.2026, «Стол заказов» — mkt.order.break.02).
2285
+ */
2286
+ declare function portRefusalOf(error: unknown): DomainError | null;
2276
2287
  /**
2277
2288
  * Код отказа контракта — из DomainError, в который отказ уже превращён,
2278
2289
  * или из сырой ошибки цепи. Отказ без кода — undefined. Сравнивать отказы
@@ -2302,5 +2313,5 @@ declare function chainRefusalOf(error: unknown): DomainError | null;
2302
2313
  */
2303
2314
  declare function rethrowChainError(error: unknown): never;
2304
2315
 
2305
- export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, verifySignedDocumentAgainstStoredDraft, waitForEvent };
2316
+ export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, portRefusalOf, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, verifySignedDocumentAgainstStoredDraft, waitForEvent };
2306
2317
  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, MemberRole, NarrowRightScope, PaymentDetails, PlatformBlockchainSettings, PlatformSettings, ProcessContentProvider, 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
@@ -2273,6 +2273,17 @@ declare function parseChainAssert(message: string): {
2273
2273
  code?: string;
2274
2274
  text: string;
2275
2275
  };
2276
+ /**
2277
+ * Отказ ядра, полученный приложением каталога по порту (`CorePortError`
2278
+ * extension-sdk): код, параметры и HTTP-статус ответа ядра. Узнаётся по форме —
2279
+ * каркас от SDK не зависит. Только отказ (статус 4xx): сбой ядра или сети
2280
+ * остаётся сбоем.
2281
+ *
2282
+ * Без перевода отказ цепи, который ядро уже разобрало (`CHAIN_ASSERT`,
2283
+ * `GATEWAY_OUTCOME_NOT_FOUND`), приложение переписывало в `CHAIN_ERROR` и терял
2284
+ * код контракта (Blackbox 05.12.2026, «Стол заказов» — mkt.order.break.02).
2285
+ */
2286
+ declare function portRefusalOf(error: unknown): DomainError | null;
2276
2287
  /**
2277
2288
  * Код отказа контракта — из DomainError, в который отказ уже превращён,
2278
2289
  * или из сырой ошибки цепи. Отказ без кода — undefined. Сравнивать отказы
@@ -2302,5 +2313,5 @@ declare function chainRefusalOf(error: unknown): DomainError | null;
2302
2313
  */
2303
2314
  declare function rethrowChainError(error: unknown): never;
2304
2315
 
2305
- export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, verifySignedDocumentAgainstStoredDraft, waitForEvent };
2316
+ export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, portRefusalOf, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, verifySignedDocumentAgainstStoredDraft, waitForEvent };
2306
2317
  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, MemberRole, NarrowRightScope, PaymentDetails, PlatformBlockchainSettings, PlatformSettings, ProcessContentProvider, 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
@@ -2273,6 +2273,17 @@ declare function parseChainAssert(message: string): {
2273
2273
  code?: string;
2274
2274
  text: string;
2275
2275
  };
2276
+ /**
2277
+ * Отказ ядра, полученный приложением каталога по порту (`CorePortError`
2278
+ * extension-sdk): код, параметры и HTTP-статус ответа ядра. Узнаётся по форме —
2279
+ * каркас от SDK не зависит. Только отказ (статус 4xx): сбой ядра или сети
2280
+ * остаётся сбоем.
2281
+ *
2282
+ * Без перевода отказ цепи, который ядро уже разобрало (`CHAIN_ASSERT`,
2283
+ * `GATEWAY_OUTCOME_NOT_FOUND`), приложение переписывало в `CHAIN_ERROR` и терял
2284
+ * код контракта (Blackbox 05.12.2026, «Стол заказов» — mkt.order.break.02).
2285
+ */
2286
+ declare function portRefusalOf(error: unknown): DomainError | null;
2276
2287
  /**
2277
2288
  * Код отказа контракта — из DomainError, в который отказ уже превращён,
2278
2289
  * или из сырой ошибки цепи. Отказ без кода — undefined. Сравнивать отказы
@@ -2302,5 +2313,5 @@ declare function chainRefusalOf(error: unknown): DomainError | null;
2302
2313
  */
2303
2314
  declare function rethrowChainError(error: unknown): never;
2304
2315
 
2305
- export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, verifySignedDocumentAgainstStoredDraft, waitForEvent };
2316
+ export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, portRefusalOf, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, verifySignedDocumentAgainstStoredDraft, waitForEvent };
2306
2317
  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, MemberRole, NarrowRightScope, PaymentDetails, PlatformBlockchainSettings, PlatformSettings, ProcessContentProvider, 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
@@ -2854,7 +2854,21 @@ function parseChainAssert(message) {
2854
2854
  const coded = body.match(CODED);
2855
2855
  return coded ? { code: coded[1], text: coded[2].trim() } : { text: body };
2856
2856
  }
2857
+ const REFUSAL_CODE = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/;
2858
+ function portRefusalOf(error) {
2859
+ if (!error || typeof error !== "object" || error instanceof DomainError)
2860
+ return null;
2861
+ const { code, status, params, message } = error;
2862
+ if (typeof code !== "string" || !REFUSAL_CODE.test(code))
2863
+ return null;
2864
+ if (typeof status !== "number" || status < 400 || status >= 500)
2865
+ return null;
2866
+ const known = params && typeof params === "object" ? params : {};
2867
+ const text = typeof known.message === "string" ? known.message : typeof message === "string" ? message : void 0;
2868
+ return new DomainError(code, text === void 0 ? { ...known } : { ...known, message: text }, status);
2869
+ }
2857
2870
  function chainErrorCode(error) {
2871
+ error = portRefusalOf(error) ?? error;
2858
2872
  if (error instanceof DomainError) {
2859
2873
  if (error.code !== "CHAIN_ASSERT" && error.code !== "CHAIN_ERROR")
2860
2874
  return error.code;
@@ -2866,6 +2880,9 @@ function chainErrorCode(error) {
2866
2880
  function chainRefusalOf(error) {
2867
2881
  if (error instanceof DomainError)
2868
2882
  return error;
2883
+ const portRefusal = portRefusalOf(error);
2884
+ if (portRefusal)
2885
+ return portRefusal;
2869
2886
  const raw = error?.message ?? String(error);
2870
2887
  const encoding = raw.match(ENCODING);
2871
2888
  if (encoding) {
@@ -2880,6 +2897,9 @@ function chainRefusalOf(error) {
2880
2897
  function rethrowChainError(error) {
2881
2898
  if (error instanceof DomainError)
2882
2899
  throw error;
2900
+ const portRefusal = portRefusalOf(error);
2901
+ if (portRefusal)
2902
+ throw portRefusal;
2883
2903
  const raw = error?.message ?? String(error);
2884
2904
  const match = raw.match(ASSERT_PREFIX);
2885
2905
  if (!match)
@@ -2888,4 +2908,4 @@ function rethrowChainError(error) {
2888
2908
  throw DomainError.badRequest(code ?? "CHAIN_ASSERT", { message: text });
2889
2909
  }
2890
2910
 
2891
- export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, verifySignedDocumentAgainstStoredDraft, waitForEvent };
2911
+ export { APP_RIGHTS, ActiveUserStatusGuard, AmountFormatterUtils, AssetUtils, BaseExtensionModule, BucketRegistry, CandidateFilterInputDTO, CandidateOutputDTO, CandidateStatus, CouncilField, CurrencyValidationUtil, CurrentUser, DEFAULT_DOCUMENT_VERSION, DOCUMENT_GENERATION_THROTTLE, DateUtils, 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, GetLedger2HistoryInputDTO, GetLedger2PostingsInputDTO, GqlJwtAuthGuard, GrantedScope, HttpApiError, HttpJwtAuthGuard, IPNProvider, InjectBucket, LOG_EXTENSION_REPOSITORY, Ledger2AccountDTO, Ledger2HistoryResponseDTO, Ledger2OperationDTO, Ledger2PostingDTO, Ledger2PostingsResponseDTO, Ledger2WalletDTO, LogExtensionDomainEntity, ONBOARDING_EXPIRY_DAYS, ONBOARDING_EXPIRY_MS, OptionalCurrentUser, OptionalGqlJwtAuthGuard, PaginatedProcessSummary, PaginationUtils, PaymentProvider, PollingProvider, ProcessActionDTO, ProcessContentDTO, ProcessContentFactDTO, ProcessContentLineDTO, ProcessContentLinkDTO, ProcessDeltaDTO, ProcessDocumentDTO, ProcessDocumentSourceDTO, ProcessSummaryDTO, ProcessViewDTO, ProcessesFilterInput, QuantityUtils, RIGHT_METADATA_KEY, RequireRight, RightsGuard, SCOPE_DENIALS, SELF, SafeMarkup, UseBucket, bankSafeText, bucketProvidersFor, bucketTokenFor, buildPaginationResult, catalogAppTitle, chainErrorCode, chainRefusalOf, chainTextDigest, checkPaymentAmount, checkPaymentSymbol, checkRight, checkRightScope, computeOnboardingExpiresAt, configureExtensionAuth, configurePlatformSettings, contentAsset, contentDay, contentFact, contentMoney, councilRolesOf, 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, paginationInputToOffset, parseChainAssert, pickDefined, platformSettings, portRefusalOf, processContentRegistry, providerSuppliedPaths, redactSecretConfig, registerExtensionDatabaseMigrations, resetExtensionDatabaseMigrations, resolveChainText, rethrowChainError, rightConditions, rightGrants, rightMatches, rightsByRole, rightsHeld, sanitizeUserText, scopeConditions, scopeOfRight, scopesMatched, standDaySeconds, standMonthSeconds, standNextPeriodStart, standPeriodKey, standWorkerPaceSeconds, timeZoneOffsetMs, 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.12.3-dev.9",
4
+ "version": "2026.12.5-dev.19",
5
5
  "description": "Служебный каркас расширения цифрового кооператива: базовый модуль, сущности и репозитории расширения, авторизация, каркас блокчейн-синхронизации, контракт миграций схемы, контракт реестра",
6
6
  "author": "Alex Ant <dacom.dark.sun@gmail.com>",
7
7
  "license": "MIT",
@@ -38,13 +38,13 @@
38
38
  "typecheck": "tsc --noEmit"
39
39
  },
40
40
  "dependencies": {
41
- "@coopenomics/extension-sdk": "2026.12.3-dev.9"
41
+ "@coopenomics/extension-sdk": "2026.12.5-dev.19"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@casl/ability": "^7.0.0",
45
45
  "@coopenomics/docs-templates": "1.6.16",
46
46
  "@coopenomics/i18n": "workspace:*",
47
- "@coopenomics/sdk": "2026.12.3-dev.9",
47
+ "@coopenomics/sdk": "2026.12.5-dev.19",
48
48
  "@nestjs/common": "^10.0.0",
49
49
  "@nestjs/core": "^10.0.0",
50
50
  "@nestjs/graphql": "^12.2.1",
@@ -66,7 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@casl/ability": "^7.0.0",
68
68
  "@coopenomics/docs-templates": "1.6.16",
69
- "@coopenomics/i18n": "2026.12.3-dev.9",
69
+ "@coopenomics/i18n": "2026.12.5-dev.19",
70
70
  "@nestjs/common": "^10.0.0",
71
71
  "@nestjs/core": "^10.0.0",
72
72
  "@nestjs/graphql": "^12.2.1",
@@ -75,7 +75,7 @@
75
75
  "@wharfkit/session": "^1.4.0",
76
76
  "class-transformer": "^0.5.1",
77
77
  "class-validator": "^0.14.1",
78
- "cooptypes": "2026.12.3-dev.9",
78
+ "cooptypes": "2026.12.5-dev.19",
79
79
  "graphql": "^16.9.0",
80
80
  "graphql-type-json": "^0.3.2",
81
81
  "kysely": "0.28.17",
@@ -87,5 +87,5 @@
87
87
  "unbuild": "^2.0.0",
88
88
  "zod": "^3.0.0"
89
89
  },
90
- "gitHead": "fc4c9831c89c1b57539226ec94e37c0aa57a8139"
90
+ "gitHead": "5ad75d83577abf2ca2dab1a07004c311571264bf"
91
91
  }