@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,137 @@
|
|
|
1
|
+
# Application-слой
|
|
2
|
+
|
|
3
|
+
> Type: Design Note. Документ фиксирует роль `application`-слоя в текущем SDK.
|
|
4
|
+
> Canonical границы слоев описаны в [Архитектура SDK](../architecture.md).
|
|
5
|
+
|
|
6
|
+
## Главная Идея
|
|
7
|
+
|
|
8
|
+
`application` содержит код, который должен оставаться независимым от runtime
|
|
9
|
+
entrypoints и конкретных transport/infrastructure деталей.
|
|
10
|
+
|
|
11
|
+
В Inventory application уже содержит use-case-ы, ports, reports, services и
|
|
12
|
+
pipeline orchestration. В текущем SDK этот слой меньше: есть только contracts и
|
|
13
|
+
reusable правила, которые нужны SDK facade и CLI-командам.
|
|
14
|
+
|
|
15
|
+
## Что Сейчас Есть В `application`
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
src/application
|
|
19
|
+
dto/
|
|
20
|
+
t-invest-options.ts
|
|
21
|
+
t-invest-services.ts
|
|
22
|
+
errors/
|
|
23
|
+
sdk-error.ts
|
|
24
|
+
reports/
|
|
25
|
+
*.report.ts
|
|
26
|
+
index.ts
|
|
27
|
+
services/
|
|
28
|
+
unary-limiter.ts
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Текущие зоны:
|
|
32
|
+
|
|
33
|
+
- `application/dto` - входные SDK options и application-level contracts;
|
|
34
|
+
- `application/errors` - стабильные transport-neutral errors и runtime guards;
|
|
35
|
+
- `application/reports` - стабильные output/report contracts API-команд;
|
|
36
|
+
- `application/services` - application ports и reusable правила, например
|
|
37
|
+
`TInvestUnaryLimiter` и его необязательная process-local реализация.
|
|
38
|
+
|
|
39
|
+
## Что Допустимо В `application`
|
|
40
|
+
|
|
41
|
+
`application` может содержать:
|
|
42
|
+
|
|
43
|
+
- request/result contracts, которые не завязаны на CLI parser;
|
|
44
|
+
- report contracts для output boundary;
|
|
45
|
+
- application services с переиспользуемыми правилами;
|
|
46
|
+
- будущие use-case-ы и ports, если команды перестанут быть тонкими SDK calls;
|
|
47
|
+
- application-level ошибки, если появятся сценарные решения.
|
|
48
|
+
|
|
49
|
+
`application` не должен знать про:
|
|
50
|
+
|
|
51
|
+
- `nice-grpc` channel/client creation;
|
|
52
|
+
- `process.env`;
|
|
53
|
+
- CLI parser details;
|
|
54
|
+
- stdout/stderr;
|
|
55
|
+
- filesystem paths;
|
|
56
|
+
- concrete infrastructure modules.
|
|
57
|
+
|
|
58
|
+
## Отчёты
|
|
59
|
+
|
|
60
|
+
`application/reports` описывает, что команда сообщает наружу, но не решает,
|
|
61
|
+
как это показать пользователю.
|
|
62
|
+
|
|
63
|
+
Пример ответственности:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
application/reports
|
|
67
|
+
shape stable output
|
|
68
|
+
|
|
69
|
+
CLI adapter/reporter
|
|
70
|
+
report -> JSON/CSV/table/string
|
|
71
|
+
|
|
72
|
+
icore TerminalApp/Output
|
|
73
|
+
normal string/stream -> TerminalApp -> Output.write -> stdout
|
|
74
|
+
warnings/errors -> Output.error -> stderr
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Report contract не должен импортировать `bootstrap` или concrete
|
|
78
|
+
infrastructure. Он может быть использован CLI, тестом, будущим HTTP transport
|
|
79
|
+
или file writer без изменения семантики.
|
|
80
|
+
|
|
81
|
+
## Ошибки
|
|
82
|
+
|
|
83
|
+
`application/errors/sdk-error.ts` задает публичные `SdkError`,
|
|
84
|
+
`SdkErrorCode`, `SdkErrorSource` и `isSdkError()`, не импортируя `nice-grpc`.
|
|
85
|
+
Infrastructure преобразует известные gRPC failures в этот contract, а
|
|
86
|
+
bootstrap facade создает lifecycle error после `close()`. Исходная ошибка
|
|
87
|
+
сохраняется как `cause`. Однозначные ошибки проверки TLS certificate chain и
|
|
88
|
+
hostname получают source `tls`, не меняя code `Unavailable`; обычные provider
|
|
89
|
+
и network failures сохраняют source `grpc`.
|
|
90
|
+
|
|
91
|
+
Error code предоставляет классификацию, но не объявляет операцию retryable:
|
|
92
|
+
решение о повторе дополнительно зависит от idempotency, provider metadata и
|
|
93
|
+
backoff policy Consumer-а.
|
|
94
|
+
|
|
95
|
+
## Сервисы
|
|
96
|
+
|
|
97
|
+
`application/services` подходит для небольших правил, которые:
|
|
98
|
+
|
|
99
|
+
- используются runtime-кодом;
|
|
100
|
+
- не являются transport/infrastructure detail;
|
|
101
|
+
- не требуют конкретного SDK adapter-а;
|
|
102
|
+
- имеют самостоятельное поведение и тесты.
|
|
103
|
+
|
|
104
|
+
`TInvestUnaryLimiter` получает готовые `path`, `bucket`, `maxRequests`,
|
|
105
|
+
`windowMs` и `AbortSignal`. Сопоставление gRPC method path с service/method
|
|
106
|
+
rule остаётся в transport adapter-е. Consumer может реализовать port без deep
|
|
107
|
+
imports; SDK не владеет lifecycle переданного объекта.
|
|
108
|
+
|
|
109
|
+
`createInMemoryUnaryLimiter()` предоставляет необязательную реализацию с
|
|
110
|
+
отменяемой bucket queue. Она не знает, какой transport выполняет вызов, и не
|
|
111
|
+
координирует другие процессы.
|
|
112
|
+
|
|
113
|
+
Если helper используется один раз и не выражает отдельное правило, его лучше
|
|
114
|
+
оставить рядом с consumer-ом.
|
|
115
|
+
|
|
116
|
+
## Чего Сейчас Нет
|
|
117
|
+
|
|
118
|
+
В текущем SDK пока нет:
|
|
119
|
+
|
|
120
|
+
- `application/use-cases`;
|
|
121
|
+
- `domain`.
|
|
122
|
+
|
|
123
|
+
Их не нужно создавать заранее. Добавление такой директории допустимо только
|
|
124
|
+
когда появляется реальная ответственность:
|
|
125
|
+
|
|
126
|
+
- use-case - если команда начинает координировать сценарий, а не просто
|
|
127
|
+
вызывает один SDK method;
|
|
128
|
+
- domain - если появляются provider-neutral правила или модели.
|
|
129
|
+
|
|
130
|
+
## Короткие Правила
|
|
131
|
+
|
|
132
|
+
- `application` описывает application-level контракт, а не формат
|
|
133
|
+
пользовательского вывода.
|
|
134
|
+
- Provider/gRPC mapping не должен протекать в чистые application contracts.
|
|
135
|
+
- Bootstrap может вызывать application, но application не импортирует bootstrap.
|
|
136
|
+
- Если output formatting содержит бизнес-семантику, нужно решить, это report
|
|
137
|
+
contract, application service или adapter logic.
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Разделение Форматирования И Вывода В CLI
|
|
2
|
+
|
|
3
|
+
> Type: Design Note. Документ фиксирует принятую границу между
|
|
4
|
+
> command-specific CLI formatting, generic JSON/CSV/table mechanics из `icore`
|
|
5
|
+
> и доставкой готового результата через `icore` `Output`.
|
|
6
|
+
|
|
7
|
+
## Контекст
|
|
8
|
+
|
|
9
|
+
CLI-команды живут в `bootstrap`, но не вся логика вокруг вывода имеет одну
|
|
10
|
+
ответственность. Команда определяет смысл пользовательского представления;
|
|
11
|
+
generic primitives сериализуют уже выбранные значения; terminal output
|
|
12
|
+
доставляет готовую строку или stream.
|
|
13
|
+
|
|
14
|
+
`icore` предоставляет generic mechanics как внешняя зависимость. Он не является
|
|
15
|
+
слоем проекта и не владеет application reports или output contract конкретной
|
|
16
|
+
команды.
|
|
17
|
+
|
|
18
|
+
Текущая структура:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
src/application
|
|
22
|
+
reports/
|
|
23
|
+
|
|
24
|
+
src/infrastructure
|
|
25
|
+
report-values.ts
|
|
26
|
+
|
|
27
|
+
src/bootstrap
|
|
28
|
+
index.ts
|
|
29
|
+
cli/
|
|
30
|
+
contract.ts
|
|
31
|
+
error.ts
|
|
32
|
+
runner.ts
|
|
33
|
+
commands/
|
|
34
|
+
<command>/
|
|
35
|
+
cli.ts
|
|
36
|
+
reporter.ts
|
|
37
|
+
|
|
38
|
+
external dependency
|
|
39
|
+
icore
|
|
40
|
+
renderJson
|
|
41
|
+
renderCsv
|
|
42
|
+
renderCsvRow
|
|
43
|
+
renderTextTable
|
|
44
|
+
TerminalApp
|
|
45
|
+
Output
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Основная Граница
|
|
49
|
+
|
|
50
|
+
Нужно разделять три операции:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
application report/command-local event -> command-specific output values
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Это responsibility `bootstrap/commands/*/reporter.ts`.
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
output values -> JSON / CSV document or row / table string
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Для общей механики reporter использует публичные render primitives `icore`.
|
|
63
|
+
Структура документа, headers и порядок rows остаются command-specific policy.
|
|
64
|
+
Trailing newline для JSON, CSV document и text table задают generic primitives.
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
string/AsyncIterable -> TerminalApp -> Output.write -> stdout
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
В штатном CLI flow это normal output responsibility `icore` `TerminalApp` и
|
|
71
|
+
`Output`, собранных в `bootstrap/cli/runner.ts`.
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
warnings/errors -> Output.error -> stderr
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Текст warnings определяет project CLI layer; текст errors и exit code -
|
|
78
|
+
политика ошибок проекта.
|
|
79
|
+
|
|
80
|
+
## Поток Команды
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
src/bootstrap/index.ts
|
|
84
|
+
↓
|
|
85
|
+
bootstrap/cli/runner.ts
|
|
86
|
+
↓
|
|
87
|
+
icore command resolution + typed options
|
|
88
|
+
↓
|
|
89
|
+
bootstrap/commands/<command>/cli.ts
|
|
90
|
+
↓
|
|
91
|
+
SDK call
|
|
92
|
+
↓
|
|
93
|
+
bootstrap/commands/<command>/reporter.ts
|
|
94
|
+
↓
|
|
95
|
+
application report или command-local event contract
|
|
96
|
+
↓
|
|
97
|
+
command-specific output values
|
|
98
|
+
↓
|
|
99
|
+
icore render primitive или project-specific formatter
|
|
100
|
+
↓
|
|
101
|
+
string/AsyncIterable
|
|
102
|
+
↓
|
|
103
|
+
icore TerminalApp -> Output.write
|
|
104
|
+
↓
|
|
105
|
+
stdout
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Runner отдельно владеет публичными short aliases, help/version shortcuts и
|
|
109
|
+
command warnings. Он направляет help/version через lightweight terminal app,
|
|
110
|
+
warnings через command terminal app, а normal command result передает в
|
|
111
|
+
`runPrepared`. Оба экземпляра используют один `Output` и одну error policy.
|
|
112
|
+
|
|
113
|
+
Последний аварийный fallback executable entrypoint использует `console.error`.
|
|
114
|
+
Поэтому `icore` `Output` является контрактом штатного terminal flow, а не
|
|
115
|
+
абсолютно единственной записью в process streams во всех аварийных сценариях.
|
|
116
|
+
|
|
117
|
+
## Что Остается В Reporter Команды
|
|
118
|
+
|
|
119
|
+
`bootstrap/commands/<command>/reporter.ts` отвечает за смысл пользовательского
|
|
120
|
+
вывода:
|
|
121
|
+
|
|
122
|
+
- mapping unary response в `application/reports` или stream event в локальный
|
|
123
|
+
контракт события команды;
|
|
124
|
+
- выбор полей;
|
|
125
|
+
- порядок и имена колонок;
|
|
126
|
+
- представление enum/date/nullable values;
|
|
127
|
+
- stable JSON contract конкретной команды;
|
|
128
|
+
- CSV headers и порядок rows;
|
|
129
|
+
- redaction или normalization, если они зависят от команды;
|
|
130
|
+
- project-specific formats, например JSONL event shape.
|
|
131
|
+
|
|
132
|
+
Reporter может импортировать `renderJson`, `renderCsv`, `renderCsvRow` и
|
|
133
|
+
`renderTextTable` из `icore`, но generic primitive не должен определять поля или
|
|
134
|
+
contract команды.
|
|
135
|
+
|
|
136
|
+
## Что Предоставляют Render Primitives `icore`
|
|
137
|
+
|
|
138
|
+
Generic primitives отвечают только за механику текстового формата:
|
|
139
|
+
|
|
140
|
+
- JSON serialization и trailing newline;
|
|
141
|
+
- CSV escaping, joining строк и terminal trailing newline для документа;
|
|
142
|
+
- расчет ширины, выравнивание и trailing newline plain-text таблицы.
|
|
143
|
+
|
|
144
|
+
Они не должны получать ответственность за:
|
|
145
|
+
|
|
146
|
+
- названия CLI-команд;
|
|
147
|
+
- `AccountsReport`, `CandlesReport` или другие project reports;
|
|
148
|
+
- generated provider DTO;
|
|
149
|
+
- SDK clients;
|
|
150
|
+
- выбор пользовательских полей;
|
|
151
|
+
- command-specific redaction или normalization;
|
|
152
|
+
- сборку CSV-документа конкретной команды.
|
|
153
|
+
|
|
154
|
+
Если общей primitive недостаточно, project-specific formatter остается рядом с
|
|
155
|
+
reporter-ом. Это не повод создавать forwarding wrapper, который только повторяет
|
|
156
|
+
public API `icore`.
|
|
157
|
+
|
|
158
|
+
## Что Предоставляют `TerminalApp` И `Output`
|
|
159
|
+
|
|
160
|
+
`bootstrap/cli/runner.ts` создает default output через `createOutput` или
|
|
161
|
+
принимает injected `Output`. Lightweight terminal app обслуживает shortcuts и
|
|
162
|
+
external errors без загрузки command definitions; command terminal app создается
|
|
163
|
+
после lazy import registry. Оба получают один и тот же `Output`.
|
|
164
|
+
|
|
165
|
+
Output boundary отвечает за:
|
|
166
|
+
|
|
167
|
+
- запись готового normal result через `Output.write` в stdout;
|
|
168
|
+
- запись warnings/errors через `Output.error` в stderr;
|
|
169
|
+
- ожидание asynchronous writes и backpressure;
|
|
170
|
+
- единый terminal error delivery через project-owned error policy.
|
|
171
|
+
|
|
172
|
+
Output boundary не должен знать:
|
|
173
|
+
|
|
174
|
+
- JSON, CSV или таблицы;
|
|
175
|
+
- application reports;
|
|
176
|
+
- command names;
|
|
177
|
+
- правила отображения значений;
|
|
178
|
+
- какие поля нужно скрыть или показать.
|
|
179
|
+
|
|
180
|
+
Project `terminalErrorPolicy` определяет текст ошибки и exit code. `icore`
|
|
181
|
+
terminal app применяет policy и выполняет delivery. Поэтому error ownership
|
|
182
|
+
также разделено, а не целиком передано зависимости.
|
|
183
|
+
|
|
184
|
+
Command registry типизирует результаты публичным `TerminalCommandOutput` из
|
|
185
|
+
`icore`. Текущие SDK commands возвращают строки, async string streams или
|
|
186
|
+
`undefined`; runtime narrowing выполняет `TerminalApp.runPrepared()` через
|
|
187
|
+
собственный публичный guard, поэтому локальная повторная проверка не нужна.
|
|
188
|
+
|
|
189
|
+
## Почему Не Нужны Локальные Generic Wrappers
|
|
190
|
+
|
|
191
|
+
Удаленные project-owned renderers и writers больше не являются архитектурными
|
|
192
|
+
точками расширения. Wrapper без собственного контракта добавит второй source of
|
|
193
|
+
truth и снова позволит документации и runtime разойтись.
|
|
194
|
+
|
|
195
|
+
Локальный adapter оправдан, только если он добавляет самостоятельное
|
|
196
|
+
project-specific поведение:
|
|
197
|
+
|
|
198
|
+
- новый stable contract;
|
|
199
|
+
- reuse нескольких команд поверх generic primitives;
|
|
200
|
+
- policy, которой нет в `icore`;
|
|
201
|
+
- изоляцию внешней зависимости, необходимую для наблюдаемого поведения.
|
|
202
|
+
|
|
203
|
+
Сам по себе более короткий import или предполагаемая будущая замена зависимости
|
|
204
|
+
не является достаточной причиной.
|
|
205
|
+
|
|
206
|
+
## Правило Для Новых Команд
|
|
207
|
+
|
|
208
|
+
При добавлении новой API-команды:
|
|
209
|
+
|
|
210
|
+
- declarative option schema передается command mechanics `icore`;
|
|
211
|
+
- `cli.ts` получает typed options, выполняет API-specific validation, строит
|
|
212
|
+
generated request, вызывает SDK и закрывает его;
|
|
213
|
+
- `reporter.ts` строит stable report и command-specific output;
|
|
214
|
+
- generic JSON/CSV-row/table mechanics переиспользуется из public API `icore`;
|
|
215
|
+
- повторяющиеся scalar value conversions переиспользуются из
|
|
216
|
+
`infrastructure/report-values.ts`;
|
|
217
|
+
- handler возвращает готовую строку или stream terminal app и не пишет normal
|
|
218
|
+
result напрямую в `process.stdout`;
|
|
219
|
+
- generated DTO не становится стабильным CLI output contract;
|
|
220
|
+
- output contract выбирается для конкретной команды, а не для будущего
|
|
221
|
+
неизвестного списка команд.
|
|
222
|
+
|
|
223
|
+
## Признаки Неверной Границы
|
|
224
|
+
|
|
225
|
+
Command-specific policy утекла в generic mechanics, если код:
|
|
226
|
+
|
|
227
|
+
- знает имя команды;
|
|
228
|
+
- импортирует `application/reports` ради выбора пользовательских полей;
|
|
229
|
+
- форматирует enum/date по правилам конкретной команды;
|
|
230
|
+
- скрывает или нормализует данные конкретного output contract;
|
|
231
|
+
- меняется при изменении CLI JSON contract.
|
|
232
|
+
|
|
233
|
+
Technical mechanics необоснованно дублируется в reporter-е, если код:
|
|
234
|
+
|
|
235
|
+
- повторяет CSV escaping;
|
|
236
|
+
- повторяет generic pretty JSON;
|
|
237
|
+
- повторяет расчет ширины таблицы;
|
|
238
|
+
- пишет normal result напрямую в `process.stdout`, хотя достаточно вернуть его
|
|
239
|
+
terminal app.
|
|
240
|
+
|
|
241
|
+
## Итог
|
|
242
|
+
|
|
243
|
+
```text
|
|
244
|
+
CLI executable -> src/bootstrap/index.ts
|
|
245
|
+
CLI runner -> src/bootstrap/cli/runner.ts
|
|
246
|
+
CLI error policy -> src/bootstrap/cli/error.ts
|
|
247
|
+
CLI commands -> src/bootstrap/commands
|
|
248
|
+
stable unary reports -> src/application/reports
|
|
249
|
+
scalar adapters -> src/infrastructure/report-values.ts
|
|
250
|
+
format mechanics -> public render primitives `icore`
|
|
251
|
+
normal output -> `icore` TerminalApp -> Output.write -> stdout
|
|
252
|
+
diagnostics -> `icore` Output.error -> stderr
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Так project-owned presentation policy не смешивается с generic serialization и
|
|
256
|
+
технической доставкой результата.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# DTO и отчёты
|
|
2
|
+
|
|
3
|
+
> Type: Design Note. Документ объясняет boundary contracts текущего SDK.
|
|
4
|
+
|
|
5
|
+
## Кратко
|
|
6
|
+
|
|
7
|
+
В текущем проекте есть несколько разных типов contracts, и их нельзя смешивать:
|
|
8
|
+
|
|
9
|
+
- proto-generated DTO из `src/generated/*.ts`;
|
|
10
|
+
- application DTO из `src/application/dto/**`;
|
|
11
|
+
- application report contracts из `src/application/reports/**`;
|
|
12
|
+
- CLI command option schemas из `src/bootstrap/commands/**` и общие SDK options
|
|
13
|
+
из `src/bootstrap/args/**`.
|
|
14
|
+
|
|
15
|
+
## Сгенерированные DTO
|
|
16
|
+
|
|
17
|
+
Vendored T-Invest proto-файлы хранятся в плоской структуре
|
|
18
|
+
`contracts/*.proto`. `src/generated/*.ts` зеркально воспроизводится из этого
|
|
19
|
+
layout. Официальный upstream snapshot фиксируется в `contracts/upstream.json`.
|
|
20
|
+
|
|
21
|
+
Это wire contracts внешнего API. Их нельзя редактировать вручную и нельзя
|
|
22
|
+
использовать как место для project-specific правил.
|
|
23
|
+
|
|
24
|
+
Допустимо:
|
|
25
|
+
|
|
26
|
+
- импортировать generated types в infrastructure adapters;
|
|
27
|
+
- использовать generated service definitions при создании gRPC clients внутри
|
|
28
|
+
bootstrap/infrastructure;
|
|
29
|
+
- использовать generated request/response DTO в package-owned public service
|
|
30
|
+
interfaces SDK facade.
|
|
31
|
+
|
|
32
|
+
Нежелательно:
|
|
33
|
+
|
|
34
|
+
- делать generated DTO основой новых application reports;
|
|
35
|
+
- добавлять handwritten mapping или helpers в generated файлы;
|
|
36
|
+
- завязывать CLI output format на нестабильный generated JSON shape.
|
|
37
|
+
- экспортировать generated service clients как root public API.
|
|
38
|
+
|
|
39
|
+
Исключение: server-side generated `*ServiceDefinition` и
|
|
40
|
+
`*ServiceImplementation` являются частью root public API, потому что пакет
|
|
41
|
+
поддерживает nice-grpc server adapters у потребителей.
|
|
42
|
+
|
|
43
|
+
## DTO уровня application
|
|
44
|
+
|
|
45
|
+
`src/application/dto/t-invest-options.ts` описывает options SDK facade.
|
|
46
|
+
|
|
47
|
+
Это не CLI DTO и не gRPC DTO. Один и тот же contract может использоваться из
|
|
48
|
+
bootstrap, tests и публичного SDK facade.
|
|
49
|
+
|
|
50
|
+
Правило:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
CLI/env parsing -> TInvestOptions -> SDK facade/infrastructure
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`application/dto` не должен читать env и не должен знать про CLI flags.
|
|
57
|
+
|
|
58
|
+
`src/application/dto/t-invest-services.ts` описывает публичные service
|
|
59
|
+
interfaces SDK facade: `UsersService`, `OrdersService`,
|
|
60
|
+
`MarketDataStreamService` и т.п. Эти interfaces сохраняют upstream method names
|
|
61
|
+
и generated request/response DTO, но не раскрывают `nice-grpc`
|
|
62
|
+
`*ServiceClient`, `*ServiceDefinition`, `CallOptions` или `CallContext`.
|
|
63
|
+
|
|
64
|
+
## Отчёты
|
|
65
|
+
|
|
66
|
+
`src/application/reports/**` содержит stable output contracts API-команд.
|
|
67
|
+
|
|
68
|
+
Reports отвечают на вопрос:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
что команда сообщает наружу?
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Они не отвечают на вопрос:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
как это вывести в JSON, CSV, table или stdout?
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Форматирование должно жить во внешнем adapter/presentation слое.
|
|
81
|
+
|
|
82
|
+
## Входные данные CLI
|
|
83
|
+
|
|
84
|
+
Raw `process.argv` остается на executable-границе `src/bootstrap/index.ts`; дальше
|
|
85
|
+
`bootstrap/cli/runner.ts` обрабатывает argv через `icore` terminal app и command registry:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
process.argv -> src/bootstrap/index.ts -> bootstrap/cli/runner.ts -> icore terminal app -> command registry -> typed command options -> command handler
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Runner использует двухфазный flow `prepare -> runPrepared`: это позволяет
|
|
92
|
+
вывести warnings после command resolution без повторного разбора argv. Ошибки
|
|
93
|
+
всех terminal-фаз проходят через policy из `bootstrap/cli/error.ts`.
|
|
94
|
+
`isUsageError()` из `icore` распознаёт framework usage errors и публичный
|
|
95
|
+
`CliUsageError`, используемый project validators; они получают exit code `2`.
|
|
96
|
+
Runtime и command-definition errors получают exit code `1`.
|
|
97
|
+
|
|
98
|
+
Command-specific primitive options описываются декларативными `icore` schemas в
|
|
99
|
+
`src/bootstrap/commands/**`. Общие SDK options нормализуются в
|
|
100
|
+
`src/bootstrap/args/**`. Эти модули не должны создавать SDK clients, вызывать API
|
|
101
|
+
или форматировать reports.
|
|
102
|
+
|
|
103
|
+
После `icore` validation command handler работает с typed command options. Raw
|
|
104
|
+
CLI option maps не должны передаваться ни в command-local parser helpers, ни в
|
|
105
|
+
request builders. Project-specific `parse*` helper может преобразовывать
|
|
106
|
+
отдельное уже типизированное значение, например RFC 3339 date-time или
|
|
107
|
+
comma-separated список. Mapping typed options в generated request DTO должен
|
|
108
|
+
жить в `create*Request` helper-е.
|
|
109
|
+
|
|
110
|
+
## Mapping
|
|
111
|
+
|
|
112
|
+
Текущий flow API-команды:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
process.argv
|
|
116
|
+
-> icore terminal app
|
|
117
|
+
-> icore schema parser/validator
|
|
118
|
+
-> typed command options
|
|
119
|
+
-> project API-specific validation
|
|
120
|
+
-> generated request DTO
|
|
121
|
+
-> generated SDK call
|
|
122
|
+
-> application report или command-local stream event contract
|
|
123
|
+
-> CLI output
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Где должен жить mapping:
|
|
127
|
+
|
|
128
|
+
| Mapping | Текущее место | Возможное целевое место |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| typed command options -> `TInvestOptions` | `bootstrap/args` | без изменений |
|
|
131
|
+
| typed command options -> generated request DTO | `bootstrap/commands/*/cli.ts`, `create*Request` | application use-case, если command перестает быть тонким adapter-ом |
|
|
132
|
+
| generated unary response -> application report | `bootstrap/commands/*/reporter.ts` | CLI adapter или application use-case, зависит от выбранной границы |
|
|
133
|
+
| stream event -> command-local event contract | `bootstrap/commands/stream-run/reporter.ts` | application report, если contract потребуется вне CLI |
|
|
134
|
+
| report/event contract -> command-specific output values | `bootstrap/commands/*/reporter.ts` | без изменений для компактного Inventory-style CLI |
|
|
135
|
+
| output values -> JSON/CSV/table | публичные `renderJson`, `renderCsv`, `renderCsvRow`, `renderTextTable` из `icore`, вызываемые reporter-ами | command-specific поля и структура остаются в reporter-е |
|
|
136
|
+
| string/stream -> stdout | `icore` `TerminalApp`/`Output.write`, собираемые в `bootstrap/cli/runner.ts` | штатный normal output wiring остается в runner-е |
|
|
137
|
+
| warning/error -> stderr | `icore` `Output.error`; project CLI/error policy владеет содержанием | без изменений |
|
|
138
|
+
|
|
139
|
+
## Типичные Ошибки
|
|
140
|
+
|
|
141
|
+
- передавать raw CLI args глубже bootstrap boundary;
|
|
142
|
+
- смешивать raw CLI parsing и generated request DTO mapping в одной функции;
|
|
143
|
+
- форматировать пользовательский output внутри application report contract;
|
|
144
|
+
- класть JSON/CSV/table logic в stdout sink;
|
|
145
|
+
- считать generated DTO стабильным CLI output contract;
|
|
146
|
+
- создавать generic DTO только ради красивой структуры.
|
|
147
|
+
|
|
148
|
+
## Резюме
|
|
149
|
+
|
|
150
|
+
- DTO и reports - это boundary contracts, а не domain models.
|
|
151
|
+
- Generated contracts принадлежат proto workflow.
|
|
152
|
+
- Application reports стабильны и transport-neutral.
|
|
153
|
+
- CLI formatting должен быть отделен от записи в stdout.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Заметки по Clean Architecture
|
|
2
|
+
|
|
3
|
+
> Type: Navigation. Этот раздел переносит и адаптирует Clean Architecture notes
|
|
4
|
+
> из Inventory под текущий компактный SDK.
|
|
5
|
+
|
|
6
|
+
Canonical source of truth по фактической карте слоев:
|
|
7
|
+
[Архитектура SDK](../architecture.md).
|
|
8
|
+
|
|
9
|
+
Policy source of truth по ограничениям и направлению зависимостей:
|
|
10
|
+
[Архитектурная политика](https://github.com/woodger/t-invest-node-sdk/blob/main/docs/policy/architecture.md).
|
|
11
|
+
|
|
12
|
+
## Зачем Этот Раздел
|
|
13
|
+
|
|
14
|
+
Текущий SDK меньше Inventory: здесь пока нет `domain`, `use-cases`,
|
|
15
|
+
`ports`, HTTP transport и dataset pipeline. Но уже появились `application`,
|
|
16
|
+
`infrastructure`, `bootstrap` и первые API-команды CLI.
|
|
17
|
+
|
|
18
|
+
Эти notes нужны для двух задач:
|
|
19
|
+
|
|
20
|
+
- объяснить, как применять Clean Architecture Lite к текущей структуре;
|
|
21
|
+
- зафиксировать, куда двигать `commands`-слой, если CLI formatting и adapters
|
|
22
|
+
начнут расти.
|
|
23
|
+
|
|
24
|
+
## Документы
|
|
25
|
+
|
|
26
|
+
- [Application-слой](./application.md) - роль `application` в текущем SDK.
|
|
27
|
+
- [DTO и Reports](./dto.md) - где живут boundary contracts.
|
|
28
|
+
- [API-команды](./api-commands.md) - текущий CLI flow и границы command layer.
|
|
29
|
+
- [Adapters](./adapters.md) - место project adapters и граница с `icore`.
|
|
30
|
+
- [Разделение форматирования и вывода в CLI](./cli-output-boundaries.md) -
|
|
31
|
+
границы command-specific formatting, generic primitives и terminal output.
|
|
32
|
+
- [Справочник потокового CLI](../cli-stream-reference.md) - текущий контракт
|
|
33
|
+
`stream run` и будущие stream-расширения.
|
|
34
|
+
- [Справочник конфигурации потокового CLI](../cli-stream-configuration.md) -
|
|
35
|
+
JSON config для stream CLI.
|
|
36
|
+
|
|
37
|
+
## Текущая Карта
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
src/application
|
|
41
|
+
dto/
|
|
42
|
+
errors/
|
|
43
|
+
reports/
|
|
44
|
+
services/
|
|
45
|
+
|
|
46
|
+
src/infrastructure
|
|
47
|
+
interceptor/
|
|
48
|
+
report-values.ts
|
|
49
|
+
transport/
|
|
50
|
+
grpc/
|
|
51
|
+
|
|
52
|
+
src/bootstrap
|
|
53
|
+
index.ts
|
|
54
|
+
args/
|
|
55
|
+
cli/
|
|
56
|
+
contract.ts
|
|
57
|
+
error.ts
|
|
58
|
+
help.ts
|
|
59
|
+
registry.ts
|
|
60
|
+
runner.ts
|
|
61
|
+
version.ts
|
|
62
|
+
commands/
|
|
63
|
+
proto/
|
|
64
|
+
compile-proto.ts
|
|
65
|
+
t-invest-node-sdk.ts
|
|
66
|
+
|
|
67
|
+
external dependency
|
|
68
|
+
icore
|
|
69
|
+
option/command mechanics
|
|
70
|
+
JSON/CSV-row/table primitives
|
|
71
|
+
TerminalApp/Output
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`domain` пока не выделен: SDK сейчас в основном оборачивает generated gRPC
|
|
75
|
+
contracts и не содержит самостоятельную provider-neutral доменную модель.
|
|
76
|
+
|
|
77
|
+
## Главная Идея
|
|
78
|
+
|
|
79
|
+
Слой должен выбираться по ответственности, а не по удобству imports:
|
|
80
|
+
|
|
81
|
+
- `application` описывает стабильные контракты и reusable application rules;
|
|
82
|
+
- `infrastructure` содержит внешние технологии и adapters;
|
|
83
|
+
- `bootstrap` собирает runtime entrypoints, связывает зависимости и интегрирует
|
|
84
|
+
публичный API `icore` с project-owned CLI contracts;
|
|
85
|
+
- `generated` содержит proto-generated contracts в плоском source layout и не редактируется вручную;
|
|
86
|
+
- `bootstrap/generated-exports.ts` остается generated DTO/enums и server-side contracts public export exception.
|
|
87
|
+
|
|
88
|
+
Если новая логика не укладывается в эту карту, нужно сначала уточнить
|
|
89
|
+
архитектурное намерение и обновить документацию.
|