@woodger/t-invest-node-sdk 0.5.1
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/CHANGELOG.md +611 -0
- package/LICENSE +21 -0
- package/THIRD_PARTY_NOTICES.md +307 -0
- package/certificates/russian-trusted-root-ca.pem +33 -0
- package/dist/application/dto/t-invest-options.d.ts +30 -0
- package/dist/application/dto/t-invest-options.js +11 -0
- package/dist/application/dto/t-invest-services.d.ts +168 -0
- package/dist/application/dto/t-invest-services.js +12 -0
- package/dist/application/errors/sdk-error.d.ts +47 -0
- package/dist/application/errors/sdk-error.js +84 -0
- package/dist/application/reports/accounts.report.d.ts +26 -0
- package/dist/application/reports/accounts.report.js +11 -0
- package/dist/application/reports/accrued-interests.report.d.ts +22 -0
- package/dist/application/reports/accrued-interests.report.js +11 -0
- package/dist/application/reports/asset.report.d.ts +72 -0
- package/dist/application/reports/asset.report.js +11 -0
- package/dist/application/reports/bond-coupons.report.d.ts +31 -0
- package/dist/application/reports/bond-coupons.report.js +11 -0
- package/dist/application/reports/bond.report.d.ts +82 -0
- package/dist/application/reports/bond.report.js +11 -0
- package/dist/application/reports/brands.report.d.ts +24 -0
- package/dist/application/reports/brands.report.js +11 -0
- package/dist/application/reports/broker-report.report.d.ts +74 -0
- package/dist/application/reports/broker-report.report.js +11 -0
- package/dist/application/reports/cancel-order.report.d.ts +14 -0
- package/dist/application/reports/cancel-order.report.js +11 -0
- package/dist/application/reports/cancel-stop-order.report.d.ts +14 -0
- package/dist/application/reports/cancel-stop-order.report.js +11 -0
- package/dist/application/reports/candles.report.d.ts +26 -0
- package/dist/application/reports/candles.report.js +11 -0
- package/dist/application/reports/close-prices.report.d.ts +20 -0
- package/dist/application/reports/close-prices.report.js +11 -0
- package/dist/application/reports/countries.report.d.ts +20 -0
- package/dist/application/reports/countries.report.js +11 -0
- package/dist/application/reports/currency.report.d.ts +58 -0
- package/dist/application/reports/currency.report.js +11 -0
- package/dist/application/reports/dividends-foreign-issuer.report.d.ts +51 -0
- package/dist/application/reports/dividends-foreign-issuer.report.js +11 -0
- package/dist/application/reports/dividends.report.d.ts +33 -0
- package/dist/application/reports/dividends.report.js +11 -0
- package/dist/application/reports/etf.report.d.ts +62 -0
- package/dist/application/reports/etf.report.js +11 -0
- package/dist/application/reports/favorites.report.d.ts +24 -0
- package/dist/application/reports/favorites.report.js +11 -0
- package/dist/application/reports/find-instrument.report.d.ts +34 -0
- package/dist/application/reports/find-instrument.report.js +11 -0
- package/dist/application/reports/future.report.d.ts +66 -0
- package/dist/application/reports/future.report.js +11 -0
- package/dist/application/reports/futures-margin.report.d.ts +21 -0
- package/dist/application/reports/futures-margin.report.js +11 -0
- package/dist/application/reports/index.d.ts +50 -0
- package/dist/application/reports/index.js +66 -0
- package/dist/application/reports/instrument.report.d.ts +47 -0
- package/dist/application/reports/instrument.report.js +11 -0
- package/dist/application/reports/last-prices.report.d.ts +20 -0
- package/dist/application/reports/last-prices.report.js +11 -0
- package/dist/application/reports/last-trades.report.d.ts +24 -0
- package/dist/application/reports/last-trades.report.js +11 -0
- package/dist/application/reports/margin-attributes.report.d.ts +25 -0
- package/dist/application/reports/margin-attributes.report.js +11 -0
- package/dist/application/reports/money.report.d.ts +15 -0
- package/dist/application/reports/money.report.js +11 -0
- package/dist/application/reports/operations-by-cursor.report.d.ts +65 -0
- package/dist/application/reports/operations-by-cursor.report.js +11 -0
- package/dist/application/reports/operations.report.d.ts +40 -0
- package/dist/application/reports/operations.report.js +11 -0
- package/dist/application/reports/option.report.d.ts +76 -0
- package/dist/application/reports/option.report.js +11 -0
- package/dist/application/reports/order-book.report.d.ts +38 -0
- package/dist/application/reports/order-book.report.js +11 -0
- package/dist/application/reports/order-mutation.report.d.ts +45 -0
- package/dist/application/reports/order-mutation.report.js +11 -0
- package/dist/application/reports/order-state.report.d.ts +12 -0
- package/dist/application/reports/order-state.report.js +11 -0
- package/dist/application/reports/orders.report.d.ts +53 -0
- package/dist/application/reports/orders.report.js +11 -0
- package/dist/application/reports/portfolio.report.d.ts +54 -0
- package/dist/application/reports/portfolio.report.js +11 -0
- package/dist/application/reports/positions.report.d.ts +45 -0
- package/dist/application/reports/positions.report.js +11 -0
- package/dist/application/reports/post-stop-order.report.d.ts +14 -0
- package/dist/application/reports/post-stop-order.report.js +11 -0
- package/dist/application/reports/sandbox-account.report.d.ts +20 -0
- package/dist/application/reports/sandbox-account.report.js +11 -0
- package/dist/application/reports/share.report.d.ts +66 -0
- package/dist/application/reports/share.report.js +11 -0
- package/dist/application/reports/stop-orders.report.d.ts +34 -0
- package/dist/application/reports/stop-orders.report.js +11 -0
- package/dist/application/reports/trading-schedules.report.d.ts +44 -0
- package/dist/application/reports/trading-schedules.report.js +11 -0
- package/dist/application/reports/trading-status.report.d.ts +19 -0
- package/dist/application/reports/trading-status.report.js +11 -0
- package/dist/application/reports/trading-statuses.report.d.ts +12 -0
- package/dist/application/reports/trading-statuses.report.js +11 -0
- package/dist/application/reports/user-info.report.d.ts +16 -0
- package/dist/application/reports/user-info.report.js +11 -0
- package/dist/application/reports/user-tariff.report.d.ts +28 -0
- package/dist/application/reports/user-tariff.report.js +11 -0
- package/dist/application/reports/withdraw-limits.report.d.ts +16 -0
- package/dist/application/reports/withdraw-limits.report.js +11 -0
- package/dist/application/services/unary-limiter.d.ts +44 -0
- package/dist/application/services/unary-limiter.js +138 -0
- package/dist/bootstrap/args/command-options.d.ts +43 -0
- package/dist/bootstrap/args/command-options.js +125 -0
- package/dist/bootstrap/args/index.d.ts +1 -0
- package/dist/bootstrap/args/index.js +5 -0
- package/dist/bootstrap/args/instrument-id-options.d.ts +24 -0
- package/dist/bootstrap/args/instrument-id-options.js +47 -0
- package/dist/bootstrap/args/instruments-args.d.ts +49 -0
- package/dist/bootstrap/args/instruments-args.js +89 -0
- package/dist/bootstrap/args/sdk-options.d.ts +19 -0
- package/dist/bootstrap/args/sdk-options.js +40 -0
- package/dist/bootstrap/args/side-effect-args.d.ts +20 -0
- package/dist/bootstrap/args/side-effect-args.js +50 -0
- package/dist/bootstrap/cli/contract.d.ts +16 -0
- package/dist/bootstrap/cli/contract.js +15 -0
- package/dist/bootstrap/cli/domains.d.ts +260 -0
- package/dist/bootstrap/cli/domains.js +631 -0
- package/dist/bootstrap/cli/error.d.ts +15 -0
- package/dist/bootstrap/cli/error.js +40 -0
- package/dist/bootstrap/cli/help.d.ts +751 -0
- package/dist/bootstrap/cli/help.js +1789 -0
- package/dist/bootstrap/cli/registry.d.ts +2102 -0
- package/dist/bootstrap/cli/registry.js +186 -0
- package/dist/bootstrap/cli/runner.d.ts +10 -0
- package/dist/bootstrap/cli/runner.js +151 -0
- package/dist/bootstrap/cli/version.d.ts +17 -0
- package/dist/bootstrap/cli/version.js +26 -0
- package/dist/bootstrap/commands/accounts/cli.d.ts +63 -0
- package/dist/bootstrap/commands/accounts/cli.js +50 -0
- package/dist/bootstrap/commands/accounts/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/accounts/reporter.js +50 -0
- package/dist/bootstrap/commands/accrued-interests/cli.d.ts +129 -0
- package/dist/bootstrap/commands/accrued-interests/cli.js +80 -0
- package/dist/bootstrap/commands/accrued-interests/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/accrued-interests/reporter.js +43 -0
- package/dist/bootstrap/commands/asset/cli.d.ts +99 -0
- package/dist/bootstrap/commands/asset/cli.js +64 -0
- package/dist/bootstrap/commands/asset/reporter.d.ts +16 -0
- package/dist/bootstrap/commands/asset/reporter.js +122 -0
- package/dist/bootstrap/commands/assets/cli.d.ts +102 -0
- package/dist/bootstrap/commands/assets/cli.js +78 -0
- package/dist/bootstrap/commands/assets/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/assets/reporter.js +27 -0
- package/dist/bootstrap/commands/bond/cli.d.ts +83 -0
- package/dist/bootstrap/commands/bond/cli.js +53 -0
- package/dist/bootstrap/commands/bond/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/bond/reporter.js +123 -0
- package/dist/bootstrap/commands/bond-coupons/cli.d.ts +129 -0
- package/dist/bootstrap/commands/bond-coupons/cli.js +80 -0
- package/dist/bootstrap/commands/bond-coupons/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/bond-coupons/reporter.js +64 -0
- package/dist/bootstrap/commands/bonds/cli.d.ts +73 -0
- package/dist/bootstrap/commands/bonds/cli.js +53 -0
- package/dist/bootstrap/commands/bonds/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/bonds/reporter.js +27 -0
- package/dist/bootstrap/commands/brand/cli.d.ts +99 -0
- package/dist/bootstrap/commands/brand/cli.js +64 -0
- package/dist/bootstrap/commands/brand/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/brand/reporter.js +37 -0
- package/dist/bootstrap/commands/brands/cli.d.ts +63 -0
- package/dist/bootstrap/commands/brands/cli.js +50 -0
- package/dist/bootstrap/commands/brands/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/brands/reporter.js +49 -0
- package/dist/bootstrap/commands/broker-report/cli.d.ts +132 -0
- package/dist/bootstrap/commands/broker-report/cli.js +105 -0
- package/dist/bootstrap/commands/broker-report/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/broker-report/reporter.js +123 -0
- package/dist/bootstrap/commands/cancel-order/cli.d.ts +120 -0
- package/dist/bootstrap/commands/cancel-order/cli.js +71 -0
- package/dist/bootstrap/commands/cancel-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/cancel-order/reporter.js +32 -0
- package/dist/bootstrap/commands/cancel-stop-order/cli.d.ts +120 -0
- package/dist/bootstrap/commands/cancel-stop-order/cli.js +71 -0
- package/dist/bootstrap/commands/cancel-stop-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/cancel-stop-order/reporter.js +32 -0
- package/dist/bootstrap/commands/candles/cli.d.ts +138 -0
- package/dist/bootstrap/commands/candles/cli.js +104 -0
- package/dist/bootstrap/commands/candles/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/candles/reporter.js +49 -0
- package/dist/bootstrap/commands/close-prices/cli.d.ts +99 -0
- package/dist/bootstrap/commands/close-prices/cli.js +66 -0
- package/dist/bootstrap/commands/close-prices/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/close-prices/reporter.js +43 -0
- package/dist/bootstrap/commands/compile-proto/cli.d.ts +12 -0
- package/dist/bootstrap/commands/compile-proto/cli.js +22 -0
- package/dist/bootstrap/commands/countries/cli.d.ts +63 -0
- package/dist/bootstrap/commands/countries/cli.js +50 -0
- package/dist/bootstrap/commands/countries/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/countries/reporter.js +42 -0
- package/dist/bootstrap/commands/currencies/cli.d.ts +73 -0
- package/dist/bootstrap/commands/currencies/cli.js +53 -0
- package/dist/bootstrap/commands/currencies/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/currencies/reporter.js +27 -0
- package/dist/bootstrap/commands/currency/cli.d.ts +83 -0
- package/dist/bootstrap/commands/currency/cli.js +53 -0
- package/dist/bootstrap/commands/currency/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/currency/reporter.js +104 -0
- package/dist/bootstrap/commands/dividends/cli.d.ts +129 -0
- package/dist/bootstrap/commands/dividends/cli.js +80 -0
- package/dist/bootstrap/commands/dividends/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/dividends/reporter.js +62 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.d.ts +132 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.js +105 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/reporter.js +108 -0
- package/dist/bootstrap/commands/edit-favorites/cli.d.ts +129 -0
- package/dist/bootstrap/commands/edit-favorites/cli.js +78 -0
- package/dist/bootstrap/commands/edit-favorites/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/edit-favorites/reporter.js +23 -0
- package/dist/bootstrap/commands/etf/cli.d.ts +83 -0
- package/dist/bootstrap/commands/etf/cli.js +53 -0
- package/dist/bootstrap/commands/etf/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/etf/reporter.js +109 -0
- package/dist/bootstrap/commands/etfs/cli.d.ts +73 -0
- package/dist/bootstrap/commands/etfs/cli.js +53 -0
- package/dist/bootstrap/commands/etfs/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/etfs/reporter.js +27 -0
- package/dist/bootstrap/commands/favorites/cli.d.ts +63 -0
- package/dist/bootstrap/commands/favorites/cli.js +50 -0
- package/dist/bootstrap/commands/favorites/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/favorites/reporter.js +60 -0
- package/dist/bootstrap/commands/find-instrument/cli.d.ts +126 -0
- package/dist/bootstrap/commands/find-instrument/cli.js +88 -0
- package/dist/bootstrap/commands/find-instrument/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/find-instrument/reporter.js +71 -0
- package/dist/bootstrap/commands/future/cli.d.ts +83 -0
- package/dist/bootstrap/commands/future/cli.js +53 -0
- package/dist/bootstrap/commands/future/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/future/reporter.js +116 -0
- package/dist/bootstrap/commands/futures/cli.d.ts +73 -0
- package/dist/bootstrap/commands/futures/cli.js +53 -0
- package/dist/bootstrap/commands/futures/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/futures/reporter.js +27 -0
- package/dist/bootstrap/commands/futures-margin/cli.d.ts +105 -0
- package/dist/bootstrap/commands/futures-margin/cli.js +64 -0
- package/dist/bootstrap/commands/futures-margin/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/futures-margin/reporter.js +40 -0
- package/dist/bootstrap/commands/help/cli.d.ts +13 -0
- package/dist/bootstrap/commands/help/cli.js +26 -0
- package/dist/bootstrap/commands/instrument/cli.d.ts +83 -0
- package/dist/bootstrap/commands/instrument/cli.js +53 -0
- package/dist/bootstrap/commands/instrument/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/instrument/reporter.js +91 -0
- package/dist/bootstrap/commands/last-prices/cli.d.ts +99 -0
- package/dist/bootstrap/commands/last-prices/cli.js +66 -0
- package/dist/bootstrap/commands/last-prices/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/last-prices/reporter.js +43 -0
- package/dist/bootstrap/commands/last-trades/cli.d.ts +123 -0
- package/dist/bootstrap/commands/last-trades/cli.js +82 -0
- package/dist/bootstrap/commands/last-trades/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/last-trades/reporter.js +48 -0
- package/dist/bootstrap/commands/margin-attributes/cli.d.ts +99 -0
- package/dist/bootstrap/commands/margin-attributes/cli.js +64 -0
- package/dist/bootstrap/commands/margin-attributes/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/margin-attributes/reporter.js +51 -0
- package/dist/bootstrap/commands/operations/cli.d.ts +156 -0
- package/dist/bootstrap/commands/operations/cli.js +99 -0
- package/dist/bootstrap/commands/operations/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/operations/reporter.js +78 -0
- package/dist/bootstrap/commands/operations-by-cursor/cli.d.ts +204 -0
- package/dist/bootstrap/commands/operations-by-cursor/cli.js +164 -0
- package/dist/bootstrap/commands/operations-by-cursor/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/operations-by-cursor/reporter.js +107 -0
- package/dist/bootstrap/commands/option/cli.d.ts +83 -0
- package/dist/bootstrap/commands/option/cli.js +53 -0
- package/dist/bootstrap/commands/option/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/option/reporter.js +125 -0
- package/dist/bootstrap/commands/options-by/cli.d.ts +108 -0
- package/dist/bootstrap/commands/options-by/cli.js +68 -0
- package/dist/bootstrap/commands/options-by/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/options-by/reporter.js +27 -0
- package/dist/bootstrap/commands/order-book/cli.d.ts +120 -0
- package/dist/bootstrap/commands/order-book/cli.js +73 -0
- package/dist/bootstrap/commands/order-book/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/order-book/reporter.js +60 -0
- package/dist/bootstrap/commands/order-state/cli.d.ts +111 -0
- package/dist/bootstrap/commands/order-state/cli.js +71 -0
- package/dist/bootstrap/commands/order-state/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/order-state/reporter.js +57 -0
- package/dist/bootstrap/commands/orders/cli.d.ts +99 -0
- package/dist/bootstrap/commands/orders/cli.js +64 -0
- package/dist/bootstrap/commands/orders/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/orders/reporter.js +88 -0
- package/dist/bootstrap/commands/portfolio/cli.d.ts +114 -0
- package/dist/bootstrap/commands/portfolio/cli.js +77 -0
- package/dist/bootstrap/commands/portfolio/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/portfolio/reporter.js +95 -0
- package/dist/bootstrap/commands/positions/cli.d.ts +99 -0
- package/dist/bootstrap/commands/positions/cli.js +64 -0
- package/dist/bootstrap/commands/positions/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/positions/reporter.js +116 -0
- package/dist/bootstrap/commands/post-order/cli.d.ts +192 -0
- package/dist/bootstrap/commands/post-order/cli.js +113 -0
- package/dist/bootstrap/commands/post-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/post-order/reporter.js +77 -0
- package/dist/bootstrap/commands/post-stop-order/cli.d.ts +216 -0
- package/dist/bootstrap/commands/post-stop-order/cli.js +145 -0
- package/dist/bootstrap/commands/post-stop-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/post-stop-order/reporter.js +31 -0
- package/dist/bootstrap/commands/replace-order/cli.d.ts +180 -0
- package/dist/bootstrap/commands/replace-order/cli.js +99 -0
- package/dist/bootstrap/commands/replace-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/replace-order/reporter.js +17 -0
- package/dist/bootstrap/commands/sandbox-accounts/cli.d.ts +64 -0
- package/dist/bootstrap/commands/sandbox-accounts/cli.js +54 -0
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.d.ts +120 -0
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.js +69 -0
- package/dist/bootstrap/commands/sandbox-close-account/cli.d.ts +108 -0
- package/dist/bootstrap/commands/sandbox-close-account/cli.js +66 -0
- package/dist/bootstrap/commands/sandbox-close-account/reporter.d.ts +12 -0
- package/dist/bootstrap/commands/sandbox-close-account/reporter.js +32 -0
- package/dist/bootstrap/commands/sandbox-open-account/cli.d.ts +70 -0
- package/dist/bootstrap/commands/sandbox-open-account/cli.js +57 -0
- package/dist/bootstrap/commands/sandbox-open-account/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/sandbox-open-account/reporter.js +31 -0
- package/dist/bootstrap/commands/sandbox-operations/cli.d.ts +156 -0
- package/dist/bootstrap/commands/sandbox-operations/cli.js +78 -0
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.d.ts +204 -0
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.js +98 -0
- package/dist/bootstrap/commands/sandbox-order-state/cli.d.ts +111 -0
- package/dist/bootstrap/commands/sandbox-order-state/cli.js +67 -0
- package/dist/bootstrap/commands/sandbox-orders/cli.d.ts +99 -0
- package/dist/bootstrap/commands/sandbox-orders/cli.js +63 -0
- package/dist/bootstrap/commands/sandbox-pay-in/cli.d.ts +135 -0
- package/dist/bootstrap/commands/sandbox-pay-in/cli.js +86 -0
- package/dist/bootstrap/commands/sandbox-pay-in/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/sandbox-pay-in/reporter.js +32 -0
- package/dist/bootstrap/commands/sandbox-portfolio/cli.d.ts +114 -0
- package/dist/bootstrap/commands/sandbox-portfolio/cli.js +68 -0
- package/dist/bootstrap/commands/sandbox-positions/cli.d.ts +99 -0
- package/dist/bootstrap/commands/sandbox-positions/cli.js +63 -0
- package/dist/bootstrap/commands/sandbox-post-order/cli.d.ts +192 -0
- package/dist/bootstrap/commands/sandbox-post-order/cli.js +90 -0
- package/dist/bootstrap/commands/sandbox-replace-order/cli.d.ts +180 -0
- package/dist/bootstrap/commands/sandbox-replace-order/cli.js +86 -0
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.d.ts +99 -0
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.js +63 -0
- package/dist/bootstrap/commands/share/cli.d.ts +83 -0
- package/dist/bootstrap/commands/share/cli.js +53 -0
- package/dist/bootstrap/commands/share/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/share/reporter.js +111 -0
- package/dist/bootstrap/commands/shares/cli.d.ts +73 -0
- package/dist/bootstrap/commands/shares/cli.js +53 -0
- package/dist/bootstrap/commands/shares/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/shares/reporter.js +27 -0
- package/dist/bootstrap/commands/stop-orders/cli.d.ts +99 -0
- package/dist/bootstrap/commands/stop-orders/cli.js +68 -0
- package/dist/bootstrap/commands/stop-orders/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/stop-orders/reporter.js +69 -0
- package/dist/bootstrap/commands/stream-run/cli.d.ts +138 -0
- package/dist/bootstrap/commands/stream-run/cli.js +229 -0
- package/dist/bootstrap/commands/stream-run/config.d.ts +56 -0
- package/dist/bootstrap/commands/stream-run/config.js +468 -0
- package/dist/bootstrap/commands/stream-run/reporter.d.ts +30 -0
- package/dist/bootstrap/commands/stream-run/reporter.js +76 -0
- package/dist/bootstrap/commands/trading-schedules/cli.d.ts +120 -0
- package/dist/bootstrap/commands/trading-schedules/cli.js +79 -0
- package/dist/bootstrap/commands/trading-schedules/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/trading-schedules/reporter.js +58 -0
- package/dist/bootstrap/commands/trading-status/cli.d.ts +99 -0
- package/dist/bootstrap/commands/trading-status/cli.js +65 -0
- package/dist/bootstrap/commands/trading-status/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/trading-status/reporter.js +51 -0
- package/dist/bootstrap/commands/trading-statuses/cli.d.ts +99 -0
- package/dist/bootstrap/commands/trading-statuses/cli.js +64 -0
- package/dist/bootstrap/commands/trading-statuses/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/trading-statuses/reporter.js +44 -0
- package/dist/bootstrap/commands/user-info/cli.d.ts +63 -0
- package/dist/bootstrap/commands/user-info/cli.js +50 -0
- package/dist/bootstrap/commands/user-info/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/user-info/reporter.js +39 -0
- package/dist/bootstrap/commands/user-tariff/cli.d.ts +63 -0
- package/dist/bootstrap/commands/user-tariff/cli.js +50 -0
- package/dist/bootstrap/commands/user-tariff/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/user-tariff/reporter.js +50 -0
- package/dist/bootstrap/commands/version/cli.d.ts +13 -0
- package/dist/bootstrap/commands/version/cli.js +22 -0
- package/dist/bootstrap/commands/withdraw-limits/cli.d.ts +99 -0
- package/dist/bootstrap/commands/withdraw-limits/cli.js +64 -0
- package/dist/bootstrap/commands/withdraw-limits/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/withdraw-limits/reporter.js +59 -0
- package/dist/bootstrap/generated-exports.d.ts +29 -0
- package/dist/bootstrap/generated-exports.js +590 -0
- package/dist/bootstrap/index.d.ts +6 -0
- package/dist/bootstrap/index.js +22 -0
- package/dist/bootstrap/proto/compile-proto.d.ts +18 -0
- package/dist/bootstrap/proto/compile-proto.js +122 -0
- package/dist/bootstrap/sdk-config.d.ts +21 -0
- package/dist/bootstrap/sdk-config.js +152 -0
- package/dist/bootstrap/t-invest-node-sdk.d.ts +42 -0
- package/dist/bootstrap/t-invest-node-sdk.js +115 -0
- package/dist/bootstrap/unary-limit-config.d.ts +38 -0
- package/dist/bootstrap/unary-limit-config.js +130 -0
- package/dist/config.d.ts +160 -0
- package/dist/config.js +173 -0
- package/dist/config.types.d.ts +89 -0
- package/dist/config.types.js +13 -0
- package/dist/generated/common.d.ts +214 -0
- package/dist/generated/common.js +1336 -0
- package/dist/generated/google/api/field_behavior.d.ts +61 -0
- package/dist/generated/google/api/field_behavior.js +126 -0
- package/dist/generated/google/protobuf/descriptor.d.ts +1330 -0
- package/dist/generated/google/protobuf/descriptor.js +5984 -0
- package/dist/generated/google/protobuf/timestamp.d.ts +122 -0
- package/dist/generated/google/protobuf/timestamp.js +102 -0
- package/dist/generated/instruments.d.ts +3230 -0
- package/dist/generated/instruments.js +24246 -0
- package/dist/generated/marketdata.d.ts +1268 -0
- package/dist/generated/marketdata.js +8922 -0
- package/dist/generated/operations.d.ts +1165 -0
- package/dist/generated/operations.js +8625 -0
- package/dist/generated/orders.d.ts +806 -0
- package/dist/generated/orders.js +5639 -0
- package/dist/generated/sandbox.d.ts +356 -0
- package/dist/generated/sandbox.js +603 -0
- package/dist/generated/signals.d.ts +196 -0
- package/dist/generated/signals.js +1261 -0
- package/dist/generated/stoporders.d.ts +328 -0
- package/dist/generated/stoporders.js +1990 -0
- package/dist/generated/users.d.ts +453 -0
- package/dist/generated/users.js +2334 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +30 -0
- package/dist/infrastructure/interceptor/index.d.ts +1 -0
- package/dist/infrastructure/interceptor/index.js +17 -0
- package/dist/infrastructure/interceptor/warning-interceptor.d.ts +23 -0
- package/dist/infrastructure/interceptor/warning-interceptor.js +38 -0
- package/dist/infrastructure/report-values.d.ts +19 -0
- package/dist/infrastructure/report-values.js +50 -0
- package/dist/infrastructure/transport/grpc/index.d.ts +5 -0
- package/dist/infrastructure/transport/grpc/index.js +13 -0
- package/dist/infrastructure/transport/grpc/sdk-channel.d.ts +12 -0
- package/dist/infrastructure/transport/grpc/sdk-channel.js +23 -0
- package/dist/infrastructure/transport/grpc/sdk-client.d.ts +16 -0
- package/dist/infrastructure/transport/grpc/sdk-client.js +33 -0
- package/dist/infrastructure/transport/grpc/sdk-metadata.d.ts +12 -0
- package/dist/infrastructure/transport/grpc/sdk-metadata.js +22 -0
- package/dist/infrastructure/transport/grpc/sdk-middleware.d.ts +22 -0
- package/dist/infrastructure/transport/grpc/sdk-middleware.js +312 -0
- package/dist/infrastructure/transport/grpc/tls-root-certificates.d.ts +10 -0
- package/dist/infrastructure/transport/grpc/tls-root-certificates.js +20 -0
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.d.ts +22 -0
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.js +60 -0
- package/dist/infrastructure/transport/grpc/unary-limits.d.ts +1 -0
- package/dist/infrastructure/transport/grpc/unary-limits.js +7 -0
- package/docs/architecture.md +378 -0
- package/docs/bundled-ca.md +157 -0
- package/docs/clean-architecture/adapters.md +173 -0
- package/docs/clean-architecture/api-commands.md +487 -0
- package/docs/clean-architecture/application.md +137 -0
- package/docs/clean-architecture/cli-output-boundaries.md +256 -0
- package/docs/clean-architecture/dto.md +153 -0
- package/docs/clean-architecture/index.md +89 -0
- package/docs/cli-stream-configuration.md +305 -0
- package/docs/cli-stream-reference.md +195 -0
- package/docs/guides/custom-unary-limiter.md +552 -0
- package/docs/guides/errors-and-lifecycle.md +196 -0
- package/docs/guides/getting-started.md +100 -0
- package/docs/guides/index.md +43 -0
- package/docs/guides/streams-and-cancellation.md +177 -0
- package/docs/guides/testing-with-service-definitions.md +110 -0
- package/docs/guides/unary-calls.md +216 -0
- package/docs/index.md +86 -0
- package/docs/limits-policy.md +201 -0
- package/docs/roadmap.md +204 -0
- package/docs/tls-policy.md +62 -0
- package/package.json +62 -0
- package/readme.md +472 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# Архитектура SDK
|
|
2
|
+
|
|
3
|
+
> Type: Reference. Этот документ фиксирует текущую карту слоев SDK и служит
|
|
4
|
+
> practical companion к
|
|
5
|
+
> [архитектурной политике](https://github.com/woodger/t-invest-node-sdk/blob/main/docs/policy/architecture.md).
|
|
6
|
+
> Дополнительные design notes по развитию слоев находятся в
|
|
7
|
+
> [заметках по Clean Architecture](./clean-architecture/index.md).
|
|
8
|
+
|
|
9
|
+
Проект использует Clean Architecture Lite. Слои выделяются только там, где у
|
|
10
|
+
кода есть самостоятельная ответственность.
|
|
11
|
+
|
|
12
|
+
## Карта слоев
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
src/bootstrap
|
|
16
|
+
-> src/infrastructure
|
|
17
|
+
-> src/application
|
|
18
|
+
-> external icore CLI/presentation/output API
|
|
19
|
+
|
|
20
|
+
src/infrastructure
|
|
21
|
+
-> src/application
|
|
22
|
+
|
|
23
|
+
src/application
|
|
24
|
+
-> чистые DTO и application services
|
|
25
|
+
|
|
26
|
+
src/generated
|
|
27
|
+
-> generated proto contracts in flat source layout
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`src/domain` сейчас не выделен: в SDK нет самостоятельной доменной модели,
|
|
31
|
+
отделенной от gRPC contract. Добавлять `domain` нужно только вместе с реальными
|
|
32
|
+
provider-neutral правилами или моделями.
|
|
33
|
+
|
|
34
|
+
## `application`
|
|
35
|
+
|
|
36
|
+
`application` содержит contracts и reusable правила, которые не должны знать о
|
|
37
|
+
`nice-grpc`.
|
|
38
|
+
|
|
39
|
+
Текущие зоны:
|
|
40
|
+
|
|
41
|
+
- `application/dto` - входные SDK options и другие application-level contracts;
|
|
42
|
+
- `application/dto/t-invest-services.ts` - публичные package-owned
|
|
43
|
+
service interfaces SDK facade, отделенные от generated `*ServiceClient`;
|
|
44
|
+
- `application/errors` - transport-neutral `SdkError`, стабильные symbolic
|
|
45
|
+
codes и runtime narrowing;
|
|
46
|
+
- `application/reports` - стабильные output/report contracts API-команд;
|
|
47
|
+
- `application/services` - transport-neutral unary limiter port и его
|
|
48
|
+
необязательная process-local реализация.
|
|
49
|
+
|
|
50
|
+
## `infrastructure`
|
|
51
|
+
|
|
52
|
+
`infrastructure` содержит внешние технологии и adapter-level wiring.
|
|
53
|
+
|
|
54
|
+
Текущие зоны:
|
|
55
|
+
|
|
56
|
+
- `infrastructure/transport/grpc` - создание `nice-grpc` channel, metadata,
|
|
57
|
+
middleware и typed clients, а также построение и разрешение полных gRPC
|
|
58
|
+
paths в transport-neutral quotas, вызов Consumer-owned limiter-а и mapping transport failures в
|
|
59
|
+
публичный `SdkError`.
|
|
60
|
+
- `infrastructure/interceptor` - технический hook для фильтрации известных
|
|
61
|
+
process warnings.
|
|
62
|
+
- `infrastructure/report-values.ts` - общие scalar adapters для преобразования
|
|
63
|
+
provider DTO значений вроде `MoneyValue`, `Quotation` и `Date` в стабильные
|
|
64
|
+
report values. Десятичная строка строится из целых `units` и `nano` без
|
|
65
|
+
потери точности через floating-point arithmetic. `MoneyValue` становится
|
|
66
|
+
структурным `ReportMoney`, а command-specific table/text представление
|
|
67
|
+
строится отдельно. Здесь не выбираются поля команд и не формируются
|
|
68
|
+
command-specific output contracts.
|
|
69
|
+
|
|
70
|
+
Здесь допустимы imports из `nice-grpc`, generated service definitions и
|
|
71
|
+
application services. Application не должен импортировать concrete
|
|
72
|
+
infrastructure modules.
|
|
73
|
+
|
|
74
|
+
## `bootstrap`
|
|
75
|
+
|
|
76
|
+
Runtime entrypoints разделены между публичными package entrypoints и
|
|
77
|
+
bootstrap-механикой.
|
|
78
|
+
|
|
79
|
+
Текущие зоны:
|
|
80
|
+
|
|
81
|
+
- `bootstrap/index.ts` - executable CLI entrypoint, который публикуется как
|
|
82
|
+
package binary `dist/bootstrap/index.js`;
|
|
83
|
+
- `bootstrap/t-invest-node-sdk.ts` - публичный runtime facade SDK,
|
|
84
|
+
владелец shared channel и lifecycle `close()`;
|
|
85
|
+
- `bootstrap/unary-limit-config.ts` и `bootstrap/sdk-config.ts` - compiler и
|
|
86
|
+
runtime adapter с [разделенным ownership](#конфигурация-терминология-и-ownership);
|
|
87
|
+
- `bootstrap/proto/compile-proto.ts` - proto generation mechanics через системный
|
|
88
|
+
`protoc` и локальный `ts-proto` plugin;
|
|
89
|
+
- `bootstrap/args` - reusable guards и normalizers для CLI options;
|
|
90
|
+
- `bootstrap/cli` - CLI contract, registry, help, version, terminal error
|
|
91
|
+
policy и runner layer;
|
|
92
|
+
- `bootstrap/commands` - handlers CLI-команд;
|
|
93
|
+
- `bootstrap/commands/*/reporter.ts` - command-specific mapping и presentation
|
|
94
|
+
formatting. Unary reporter-ы обычно строят `application/reports`, а
|
|
95
|
+
специализированный stream reporter может владеть локальным event contract.
|
|
96
|
+
|
|
97
|
+
Generic option/command mechanics, JSON/CSV-row/table primitives и default
|
|
98
|
+
terminal output facade предоставляет внешняя зависимость `icore`. Она не
|
|
99
|
+
является отдельным слоем проекта: integration wiring остается в `bootstrap`,
|
|
100
|
+
а project-specific adapters и policies остаются в файлах-владельцах.
|
|
101
|
+
|
|
102
|
+
CLI слой сейчас поддерживает utility-команды `help`, `version` и API-команды
|
|
103
|
+
в preferred friendly форме `<domain> <resource/action>`. Публичные domains:
|
|
104
|
+
`account`, `instrument`, `market`, `order`, `stop-order`, `operation`,
|
|
105
|
+
`sandbox`, `stream`, `dev`. Proto generation доступен как
|
|
106
|
+
`dev compile-proto`.
|
|
107
|
+
|
|
108
|
+
Technical и legacy paths вида `account get-accounts`, `users get-accounts`,
|
|
109
|
+
`market get-candles`, `marketdata get-candles`, `instrument shares`,
|
|
110
|
+
`instruments shares`, `order post-order`, `orders post-order`,
|
|
111
|
+
`stop-order get-stop-orders`, `stoporders get-stop-orders`,
|
|
112
|
+
`operation get-portfolio`, `operations get-portfolio`,
|
|
113
|
+
`sandbox get-sandbox-accounts` и `compile-proto` остаются совместимыми aliases,
|
|
114
|
+
но help продвигает только preferred paths.
|
|
115
|
+
|
|
116
|
+
API-команды остаются тонкими bootstrap handlers. Runner объявляет короткие
|
|
117
|
+
`-h`/`-v` через native option aliases `icore`. Project registry прикрепляет
|
|
118
|
+
technical и legacy paths к единственному canonical command definition через
|
|
119
|
+
first-class command aliases `icore`: `name`/`path` остаются preferred, а
|
|
120
|
+
фактически использованный путь доступен как `matchedPath`. Затем `icore`
|
|
121
|
+
terminal app разрешает command path, валидирует declarative schema и передает
|
|
122
|
+
handler-у typed command options. API-specific validation и mapping в generated
|
|
123
|
+
request остаются в project-owned helpers.
|
|
124
|
+
|
|
125
|
+
Глобальные help/version shortcuts используют lightweight `TerminalApp` без
|
|
126
|
+
command definitions. Полный registry загружается через dynamic import только
|
|
127
|
+
перед `prepare`, поэтому shortcut path не инициализирует API commands, SDK facade
|
|
128
|
+
и generated contracts. Оба экземпляра `TerminalApp` используют один injected
|
|
129
|
+
`Output` и одну project error policy.
|
|
130
|
+
|
|
131
|
+
`bootstrap/cli/contract.ts` один раз закрепляет общие application-level типы
|
|
132
|
+
команд через `createCommand.withTypes()`, сохраняя конкретные schema, path,
|
|
133
|
+
payload и result каждого definition. Registry добавляет вычисленные
|
|
134
|
+
compatibility aliases capability-based декоратором: ограничение требует только
|
|
135
|
+
читаемый декоратором `path`, исходный definition проходит без расширения, а
|
|
136
|
+
runtime aliases честно представлены как `readonly CommandPath[]`.
|
|
137
|
+
|
|
138
|
+
Runner один раз выполняет `prepare`, пишет command warnings и передает prepared
|
|
139
|
+
command в `runPrepared`. В штатном terminal flow общая error policy сохраняет
|
|
140
|
+
единый stderr для фаз `prepare`, `execute`, `render`, `write` и внешних
|
|
141
|
+
bootstrap-операций.
|
|
142
|
+
|
|
143
|
+
Exit code определяется типом ошибки, а не фазой. Публичный `isUsageError()` из
|
|
144
|
+
`icore` распознаёт framework errors категории `usage` и application validators,
|
|
145
|
+
которые выбрасывают публичный `CliUsageError`; они завершаются с кодом `2`.
|
|
146
|
+
Runtime, provider, output и `icore` definition errors завершаются с кодом `1`.
|
|
147
|
+
`CliUsageError` используется для command-specific аргументов, обязательных
|
|
148
|
+
CLI/ENV-значений и уже прочитанной JSON command config; ошибки чтения файла
|
|
149
|
+
остаются runtime.
|
|
150
|
+
Command `cli.ts` создает generated request DTO из typed options, создает SDK
|
|
151
|
+
facade и передает provider response в reporter-модуль. Unary reporter-ы обычно
|
|
152
|
+
преобразуют generated DTO в `application/reports` contracts; stream reporter
|
|
153
|
+
может формировать command-local event contract. Reporter выбирает поля, порядок
|
|
154
|
+
и command-specific представление, а для общей механики формата при необходимости
|
|
155
|
+
вызывает публичные `renderJson`, `renderCsv`, `renderCsvRow` и `renderTextTable`
|
|
156
|
+
из `icore`.
|
|
157
|
+
Готовую строку или stream terminal app штатно направляет через `Output.write` в
|
|
158
|
+
stdout; help/version используют тот же канал, а warnings и errors проходят
|
|
159
|
+
через `Output.error` в stderr. Runner принимает injected `Output` или создает
|
|
160
|
+
default facade.
|
|
161
|
+
|
|
162
|
+
`bootstrap/args` не вызывает SDK и не создает gRPC-клиенты. Он содержит общие
|
|
163
|
+
option schemas, проверяет project-specific значения уже типизированных опций и
|
|
164
|
+
нормализует `TInvestOptions` из CLI/ENV. Разбор raw argv и schema-level
|
|
165
|
+
валидация принадлежат `icore`.
|
|
166
|
+
|
|
167
|
+
## Публичные точки входа
|
|
168
|
+
|
|
169
|
+
Поддерживаемая public surface собирается `src/index.ts`. Public service
|
|
170
|
+
interfaces экспортируются из application DTO. Generated server-side service
|
|
171
|
+
definitions/implementation types входят в root public surface для nice-grpc
|
|
172
|
+
server adapters; generated service clients остаются внутри
|
|
173
|
+
bootstrap/infrastructure:
|
|
174
|
+
|
|
175
|
+
- `src/index.ts` - основной package entrypoint;
|
|
176
|
+
- `src/bootstrap/sdk-config.ts` - владелец публичного flat `defaultConfig`;
|
|
177
|
+
- `src/bootstrap/generated-exports.ts` - aggregation layer для публичных generated exports.
|
|
178
|
+
|
|
179
|
+
Package policy хранится отдельно и не образует дополнительный public
|
|
180
|
+
entrypoint:
|
|
181
|
+
|
|
182
|
+
- `src/config.ts` и `src/config.types.ts` - source declaration и ее type
|
|
183
|
+
contracts; точные границы зафиксированы ниже.
|
|
184
|
+
|
|
185
|
+
Публичные runtime/provider errors задаются
|
|
186
|
+
`src/application/errors/sdk-error.ts`. gRPC mapping остается в
|
|
187
|
+
`infrastructure/transport/grpc`, а lifecycle errors создает facade. Retry
|
|
188
|
+
policy не входит в error contract: один status code не определяет безопасность
|
|
189
|
+
повторения конкретной операции.
|
|
190
|
+
|
|
191
|
+
Новый код должен импортировать реализацию из слоя-владельца. Root-level
|
|
192
|
+
compatibility wrappers не создаются.
|
|
193
|
+
|
|
194
|
+
## Конфигурация: терминология и ownership
|
|
195
|
+
|
|
196
|
+
Для package defaults и runtime policies используются следующие термины:
|
|
197
|
+
|
|
198
|
+
- `source config` - единственная authoring-форма package policy;
|
|
199
|
+
- `authoring contract` - TypeScript-типы, которые проверяют source config при
|
|
200
|
+
компиляции;
|
|
201
|
+
- `compiled package baseline` - нормализованные limits и quota buckets,
|
|
202
|
+
один раз собранные из source config;
|
|
203
|
+
- `public runtime config` - совместимое публичное представление
|
|
204
|
+
скомпилированных defaults;
|
|
205
|
+
- `per-instance overrides` - вход от consumer-а для одного SDK instance,
|
|
206
|
+
а не второй source package policy;
|
|
207
|
+
- `resolved runtime snapshot` - изолированный итог для одного SDK
|
|
208
|
+
instance, который не изменяет baseline или `defaultConfig`.
|
|
209
|
+
|
|
210
|
+
Декларативный package config — это неисполняемые данные (inert data):
|
|
211
|
+
значения записаны непосредственно в object literal и проверяются через
|
|
212
|
+
`as const satisfies`. Вызов builder-а или mapper-а над object literal,
|
|
213
|
+
например `defineConfig({...})`, является executable DSL, а не package
|
|
214
|
+
source config. В source config не допускаются runtime imports, function
|
|
215
|
+
calls, spreads, merge/resolver logic и параллельные декларации одной
|
|
216
|
+
policy.
|
|
217
|
+
|
|
218
|
+
Unary quota config проходит следующий pipeline:
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
packageConfig -- compileUnaryLimits --> internal package baseline
|
|
222
|
+
|-- copy limits --> defaultConfig
|
|
223
|
+
`-- limits + buckets ---------.
|
|
224
|
+
current defaultConfig.unaryLimits -------------------------------------+--> resolveUnaryLimitConfig
|
|
225
|
+
per-instance unaryLimits ----------------------------------------------'
|
|
226
|
+
|
|
|
227
|
+
`--> runtime snapshot
|
|
228
|
+
|
|
229
|
+
runtime snapshot -----.
|
|
230
|
+
+--> UnaryLimitResolver --> TInvestUnaryQuota --.
|
|
231
|
+
gRPC method path ------' |
|
|
232
|
+
+--> unaryLimiter.acquire()
|
|
233
|
+
per-instance unaryLimiter --------------------------------------'
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Package-owned gRPC transport policy проходит без public или per-instance
|
|
237
|
+
override:
|
|
238
|
+
|
|
239
|
+
```text
|
|
240
|
+
packageConfig.grpc.maxReceiveMessageLength
|
|
241
|
+
--> TInvestNodeSDK bootstrap
|
|
242
|
+
|--> createSdkChannel --> grpc.max_receive_message_length
|
|
243
|
+
'--> SdkCallRuntime --> error source classification
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Так SDK явно фиксирует максимальный размер входящего сообщения и не наследует
|
|
247
|
+
неявный default transport dependency. Локальное превышение этого лимита
|
|
248
|
+
сохраняет gRPC-код `RESOURCE_EXHAUSTED`, но получает публичный `source: 'sdk'`;
|
|
249
|
+
квота провайдера с тем же кодом остается в `source: 'grpc'`. Специфичная для
|
|
250
|
+
транспорта диагностика распознается внутри адаптера и не становится контрактом
|
|
251
|
+
Consumer-а.
|
|
252
|
+
|
|
253
|
+
Тот же transport adapter отделяет локальные ошибки сериализации request и
|
|
254
|
+
разбора response от provider-side `INTERNAL`: code сохраняется, но локальные
|
|
255
|
+
случаи получают `source: 'sdk'`. Response metadata callbacks защищены там же,
|
|
256
|
+
потому что `nice-grpc` вызывает их из EventEmitter handlers: синхронное
|
|
257
|
+
исключение возвращается владельцу RPC, а не process-level
|
|
258
|
+
`uncaughtException`.
|
|
259
|
+
|
|
260
|
+
TLS trust material разрешается отдельно для каждого channel:
|
|
261
|
+
|
|
262
|
+
```text
|
|
263
|
+
certificates/russian-trusted-root-ca.pem -- default --.
|
|
264
|
+
+--> createSsl(rootCertificates)
|
|
265
|
+
per-instance tls.rootCertificates ------- override-'
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Infrastructure лениво читает bundled asset только для TLS channel. Explicit
|
|
269
|
+
buffer полностью заменяет package root bundle; `useSsl: false` выбирает
|
|
270
|
+
insecure credentials без чтения сертификата. Ни system trust store, ни
|
|
271
|
+
process-wide environment SDK не изменяет.
|
|
272
|
+
|
|
273
|
+
Middleware получает resolved `useSsl` вместе с call runtime. Для известных
|
|
274
|
+
ошибок проверки certificate chain и hostname он сохраняет gRPC code
|
|
275
|
+
`UNAVAILABLE`, но меняет публичный source на `tls`. Provider и network
|
|
276
|
+
`UNAVAILABLE` остаются `grpc`; transport adapter не принимает retry-решений.
|
|
277
|
+
|
|
278
|
+
Package defaults для публичных instance options разрешаются при создании SDK:
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
packageConfig.sdk -- defaults --.
|
|
282
|
+
+--> resolved TInvestOptions
|
|
283
|
+
per-instance options -----------'
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Per-instance `useSsl` имеет приоритет над package default, а `undefined` не
|
|
287
|
+
отключает package policy. `unaryLimiter` не имеет package default: без него SDK
|
|
288
|
+
не выполняет скрытого ожидания. Обязательные `token` и `endpoint` проверяются
|
|
289
|
+
до создания transport channel. Значения `token` и непустого `appName`
|
|
290
|
+
дополнительно проверяются как строковые gRPC metadata, а ошибки итоговых
|
|
291
|
+
`unaryLimits` преобразуются в публичный `InvalidArgument` с `source: 'sdk'`.
|
|
292
|
+
Допустимые service names и полные method paths выводятся из generated unary
|
|
293
|
+
service definitions, поэтому опечатка не превращается в неиспользуемое
|
|
294
|
+
правило. `packageConfig.sdk` остаётся внутренней authoring-формой и не
|
|
295
|
+
расширяет публичный `defaultConfig`.
|
|
296
|
+
|
|
297
|
+
`defaultConfig.unaryLimits` остаётся изменяемым public facade.
|
|
298
|
+
`resolveUnaryLimitConfig()` читает его текущие values при создании SDK
|
|
299
|
+
instance, накладывает per-instance overrides и возвращает отдельный snapshot.
|
|
300
|
+
|
|
301
|
+
Ownership разделен так:
|
|
302
|
+
|
|
303
|
+
- `src/config.ts` владеет values и связями package policy;
|
|
304
|
+
- `src/config.types.ts` владеет authoring и public runtime contracts, но не
|
|
305
|
+
default values или runtime validation;
|
|
306
|
+
- `src/application/dto/t-invest-options.ts` владеет публичным
|
|
307
|
+
per-instance input, но не package defaults или merge semantics;
|
|
308
|
+
- `src/bootstrap/unary-limit-config.ts` владеет compilation, package baseline
|
|
309
|
+
validation, runtime snapshot invariants и их type contract;
|
|
310
|
+
публичный `defineUnaryLimits()` остается только адаптером читаемой
|
|
311
|
+
формы per-instance overrides и не владеет package defaults;
|
|
312
|
+
- `src/bootstrap/sdk-config.ts` владеет public `defaultConfig`, merge overrides,
|
|
313
|
+
quota group reconciliation и вызовом проверки итогового runtime snapshot;
|
|
314
|
+
- `src/infrastructure/transport/grpc/sdk-channel.ts` владеет mapping готовой
|
|
315
|
+
package transport policy в channel options, но не default value;
|
|
316
|
+
- `src/infrastructure/transport/grpc/tls-root-certificates.ts` владеет только
|
|
317
|
+
разрешением package asset и ленивым чтением bundled trust material;
|
|
318
|
+
- `src/application/services/unary-limiter.ts` владеет публичным limiter port и
|
|
319
|
+
необязательной process-local реализацией, не интерпретируя source config или
|
|
320
|
+
gRPC paths;
|
|
321
|
+
- `src/infrastructure/transport/grpc/unary-limits.ts` владеет только
|
|
322
|
+
transport-specific построением gRPC method path;
|
|
323
|
+
- `src/infrastructure/transport/grpc/unary-limit-resolver.ts` владеет
|
|
324
|
+
сопоставлением path с method/service rule и выбором runtime bucket, но не
|
|
325
|
+
compilation package policy или состоянием limiter-а;
|
|
326
|
+
- Consumer владеет переданным `unaryLimiter`, его внешними ресурсами и scope;
|
|
327
|
+
`TInvestNodeSDK.close()` этот lifecycle не завершает.
|
|
328
|
+
|
|
329
|
+
Новая структурная config semantics добавляется в authoring contract и
|
|
330
|
+
соответствующий compiler. Готовые scalar values bootstrap передает напрямую
|
|
331
|
+
adapter-у — без compiler-а и второй декларации. Mapping/resolver logic не
|
|
332
|
+
должна возвращаться в `src/config.ts`.
|
|
333
|
+
|
|
334
|
+
## Сгенерированный код
|
|
335
|
+
|
|
336
|
+
Официальный upstream T-Invest API — активный репозиторий
|
|
337
|
+
`https://opensource.tbank.ru/invest/invest-contracts`. Его tag, commit и
|
|
338
|
+
исходный каталог фиксируются в
|
|
339
|
+
[manifest репозитория](https://github.com/woodger/t-invest-node-sdk/blob/main/contracts/upstream.json).
|
|
340
|
+
|
|
341
|
+
Proto compiler читает `local.rawContractsPath` и `local.generatedPath` из этого
|
|
342
|
+
manifest. Пути до vendored и generated контрактов не дублируются в bootstrap
|
|
343
|
+
коде.
|
|
344
|
+
|
|
345
|
+
T-Invest proto-файлы копируются без изменения плоской структуры и import-путей
|
|
346
|
+
в `contracts/*.proto`. Supporting Google contracts перечислены отдельно в
|
|
347
|
+
`local.supportingContracts` и не считаются частью T-Invest upstream snapshot.
|
|
348
|
+
`google/api/field_behavior.proto` поставляется в том же snapshot T-Invest, а
|
|
349
|
+
источник `google/protobuf/descriptor.proto` и
|
|
350
|
+
`google/protobuf/timestamp.proto` зафиксирован в `supportingSources` как
|
|
351
|
+
официальный protobuf `v32.1`.
|
|
352
|
+
|
|
353
|
+
`src/generated/*.ts` зеркально воспроизводится из плоского layout контрактов и
|
|
354
|
+
не редактируется вручную.
|
|
355
|
+
`src/generated/**` и `src/bootstrap/generated-exports.ts` являются исключениями
|
|
356
|
+
из обычной слоевой структуры, потому что package entrypoint реэкспортирует
|
|
357
|
+
generated DTO/enums public API и server-side
|
|
358
|
+
`*ServiceDefinition` / `*ServiceImplementation` contracts. Generated
|
|
359
|
+
`*ServiceClient` contracts остаются внутренними transport contracts и не
|
|
360
|
+
являются root public exports.
|
|
361
|
+
|
|
362
|
+
### Обновление proto snapshot
|
|
363
|
+
|
|
364
|
+
При обновлении контрактов нужно:
|
|
365
|
+
|
|
366
|
+
1. получить `*.proto` из `source.path` на точном `source.commit` или
|
|
367
|
+
`source.release`;
|
|
368
|
+
2. заменить T-Invest файлы в `local.rawContractsPath`;
|
|
369
|
+
3. обновить source commit/release в `contracts/upstream.json`;
|
|
370
|
+
4. при изменении вспомогательных contracts получить их из точного выпуска и
|
|
371
|
+
обновить соответствующую запись `supportingSources`;
|
|
372
|
+
5. выполнить `local.generationCommand`, затем `npm run build`, `npm run lint` и
|
|
373
|
+
`npm test`.
|
|
374
|
+
|
|
375
|
+
Proto generation использует только vendored snapshot и не выполняет network IO.
|
|
376
|
+
Версия системного `protoc` не закреплена package dependency. Для побайтового
|
|
377
|
+
воспроизведения нужно использовать версию из заголовков текущих generated
|
|
378
|
+
файлов; сейчас это `protoc 3.19.6`.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Встроенный Russian Trusted Root CA
|
|
2
|
+
|
|
3
|
+
> Type: Notice. Документ фиксирует происхождение, границы распространения и
|
|
4
|
+
> техническое подключение корневого сертификата, включённого в package SDK.
|
|
5
|
+
|
|
6
|
+
## Назначение документа
|
|
7
|
+
|
|
8
|
+
SDK содержит публичный корневой X.509-сертификат Russian Trusted Root CA,
|
|
9
|
+
необходимый для проверки TLS-цепочки T-Invest API. В package не входит
|
|
10
|
+
соответствующий приватный ключ.
|
|
11
|
+
|
|
12
|
+
Сертификат не является исходным кодом, созданным авторами SDK. Проект не
|
|
13
|
+
заявляет авторство сертификата и не представляет MIT License из корневого
|
|
14
|
+
[`LICENSE`](../LICENSE) как отдельное лицензионное разрешение на сертификат.
|
|
15
|
+
Этот документ фиксирует доступные официальные источники и принятое проектом
|
|
16
|
+
основание для включения trust material, но не заменяет условия, установленные
|
|
17
|
+
его издателем, или индивидуальную правовую оценку распространителя.
|
|
18
|
+
|
|
19
|
+
## Основание для включения в package
|
|
20
|
+
|
|
21
|
+
[Документация T-Invest](https://developer.tbank.ru/invest/intro/developer/network)
|
|
22
|
+
указывает, что для подключения к API необходимы сертификаты НУЦ Минцифры РФ,
|
|
23
|
+
и направляет пользователей на страницу сертификатов Госуслуг. Та же
|
|
24
|
+
документация сообщает, что официальный Python SDK может проверять соединение
|
|
25
|
+
по сертификату Минцифры, встроенному в библиотеку, без установки сертификата в
|
|
26
|
+
систему.
|
|
27
|
+
|
|
28
|
+
Официальный Python SDK действительно содержит
|
|
29
|
+
[`RussianTrustedRootCA.pem`](https://opensource.tbank.ru/invest/invest-python/-/blob/master/t_tech/invest/certs/RussianTrustedRootCA.pem)
|
|
30
|
+
и передаёт его в
|
|
31
|
+
[`grpc.ssl_channel_credentials()`](https://opensource.tbank.ru/invest/invest-python/-/blob/master/t_tech/invest/channels.py).
|
|
32
|
+
X.509 fingerprint этого сертификата совпадает с fingerprint asset-а SDK.
|
|
33
|
+
|
|
34
|
+
Проект следует той же модели поставки trust material: сертификат находится в
|
|
35
|
+
package, читается локально и применяется только к создаваемому gRPC channel.
|
|
36
|
+
Install и runtime не загружают и не обновляют его через сеть.
|
|
37
|
+
|
|
38
|
+
## Официальный источник и путь получения
|
|
39
|
+
|
|
40
|
+
Публичная точка входа источника:
|
|
41
|
+
|
|
42
|
+
1. [страница сертификатов Госуслуг](https://www.gosuslugi.ru/crt);
|
|
43
|
+
2. размещённый на ней
|
|
44
|
+
[официальный PEM download endpoint](https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt).
|
|
45
|
+
|
|
46
|
+
Текущий asset был добавлен в репозиторий 5 августа 2026 года. Для проверки
|
|
47
|
+
актуального файла источник можно загрузить отдельно и исследовать без замены
|
|
48
|
+
package asset-а:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
curl --fail --location --proto '=https' --tlsv1.2 \
|
|
52
|
+
--output russian_trusted_root_ca_pem.crt \
|
|
53
|
+
https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt
|
|
54
|
+
|
|
55
|
+
openssl x509 \
|
|
56
|
+
-in russian_trusted_root_ca_pem.crt \
|
|
57
|
+
-noout -subject -issuer -dates -fingerprint -sha256
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Текстовое PEM-представление может отличаться переносами строк. Идентичность
|
|
61
|
+
сертификата проверяется по декодированному X.509 и его SHA-256 fingerprint, а
|
|
62
|
+
не по checksum текстового файла.
|
|
63
|
+
|
|
64
|
+
## Идентификаторы сертификата
|
|
65
|
+
|
|
66
|
+
| Поле | Значение |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| Subject | `C=RU, O=The Ministry of Digital Development and Communications, CN=Russian Trusted Root CA` |
|
|
69
|
+
| Issuer | совпадает с Subject |
|
|
70
|
+
| CA | `true` |
|
|
71
|
+
| Valid from | `2022-03-01T21:04:15Z` |
|
|
72
|
+
| Valid to | `2032-02-27T21:04:15Z` |
|
|
73
|
+
| SHA-256 fingerprint | `D2:6D:2D:02:31:B7:C3:9F:92:CC:73:85:12:BA:54:10:35:19:E4:40:5D:68:B5:BD:70:3E:97:88:CA:8E:CF:31` |
|
|
74
|
+
|
|
75
|
+
Fingerprint относится к X.509-сертификату. Эти поля и признак CA проверяет
|
|
76
|
+
regression-тест
|
|
77
|
+
[`src/infrastructure/transport/grpc/tls-root-certificates.test.ts`](https://github.com/woodger/t-invest-node-sdk/blob/main/src/infrastructure/transport/grpc/tls-root-certificates.test.ts).
|
|
78
|
+
|
|
79
|
+
## Границы распространения
|
|
80
|
+
|
|
81
|
+
Сертификат опубликован официальным источником для установки в доверенные
|
|
82
|
+
хранилища, а официальный поставщик T-Invest API распространяет тот же trust
|
|
83
|
+
material внутри собственного SDK. Это является фактическим основанием
|
|
84
|
+
выбранной package-модели.
|
|
85
|
+
|
|
86
|
+
При этом в проверенных материалах — на странице Госуслуг, в download endpoint
|
|
87
|
+
и внутри самого X.509-сертификата — не обнаружено отдельного текста лицензии
|
|
88
|
+
или явно сформулированных условий повторного распространения. Сам по себе
|
|
89
|
+
официальный пример встраивания не следует трактовать как отдельную лицензию от
|
|
90
|
+
имени издателя сертификата.
|
|
91
|
+
|
|
92
|
+
Поэтому проект:
|
|
93
|
+
|
|
94
|
+
- сохраняет сертификат как отдельный неизменяемый asset;
|
|
95
|
+
- явно указывает его источник и идентификаторы;
|
|
96
|
+
- не заявляет права собственности на сертификат;
|
|
97
|
+
- не относит сертификат к собственному коду SDK под MIT License;
|
|
98
|
+
- обновляет или заменяет trust material только отдельным проверяемым релизом;
|
|
99
|
+
- должен учесть новые официальные условия, если издатель опубликует их.
|
|
100
|
+
|
|
101
|
+
Уведомление о наличии сертификата в package также приведено в
|
|
102
|
+
[`THIRD_PARTY_NOTICES.md`](../THIRD_PARTY_NOTICES.md).
|
|
103
|
+
|
|
104
|
+
## Хранение и подключение по умолчанию
|
|
105
|
+
|
|
106
|
+
В репозитории и установленном package сертификат хранится по пути:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
certificates/russian-trusted-root-ca.pem
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Внутренний модуль
|
|
113
|
+
[`src/infrastructure/transport/grpc/tls-root-certificates.ts`](https://github.com/woodger/t-invest-node-sdk/blob/main/src/infrastructure/transport/grpc/tls-root-certificates.ts)
|
|
114
|
+
лениво и синхронно читает этот файл относительно скомпилированного модуля и
|
|
115
|
+
кеширует полученный `Buffer` в пределах процесса. При `useSsl: true` transport
|
|
116
|
+
передаёт его в `ChannelCredentials.createSsl()`.
|
|
117
|
+
|
|
118
|
+
Bundled CA применяется только к channel конкретного SDK instance. SDK не
|
|
119
|
+
изменяет system trust store, не использует `NODE_EXTRA_CA_CERTS` и не выполняет
|
|
120
|
+
скрытых сетевых запросов для получения trust material.
|
|
121
|
+
|
|
122
|
+
## Переопределение в коде Consumer-а
|
|
123
|
+
|
|
124
|
+
Для custom или test endpoint Consumer может передать содержимое собственного
|
|
125
|
+
PEM root bundle:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { readFile } from 'node:fs/promises';
|
|
129
|
+
import { TInvestNodeSDK } from '@woodger/t-invest-node-sdk';
|
|
130
|
+
|
|
131
|
+
const rootCertificates = await readFile('./certificates/custom-root.pem');
|
|
132
|
+
const sdk = new TInvestNodeSDK({
|
|
133
|
+
token,
|
|
134
|
+
endpoint,
|
|
135
|
+
tls: {
|
|
136
|
+
rootCertificates
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`tls.rootCertificates` принимает `Buffer`, а не filesystem path. Переданный
|
|
142
|
+
bundle полностью заменяет встроенный сертификат для этого channel; стандартные
|
|
143
|
+
roots Node.js автоматически не добавляются. При `useSsl: false` SDK создаёт
|
|
144
|
+
insecure credentials и не читает встроенный PEM.
|
|
145
|
+
|
|
146
|
+
## Обновление сертификата
|
|
147
|
+
|
|
148
|
+
Автоматическая загрузка или rotation сертификата не является контрактом SDK.
|
|
149
|
+
Для обновления необходимо:
|
|
150
|
+
|
|
151
|
+
1. получить новый файл по опубликованному официальному маршруту;
|
|
152
|
+
2. проверить назначение, Subject, Issuer, признак CA, срок действия и
|
|
153
|
+
согласованный fingerprint;
|
|
154
|
+
3. проверить изменение относительно предыдущего X.509-сертификата;
|
|
155
|
+
4. одним изменением обновить asset, этот notice и regression-тест;
|
|
156
|
+
5. проверить локальный TLS-вызов и наличие asset-а в package archive;
|
|
157
|
+
6. выпустить новую версию SDK с описанием изменения trust material.
|