@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,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Модуль gRPC middleware adapter связывает transport calls с unary limiter port.
|
|
4
|
+
*
|
|
5
|
+
* Здесь допустимы:
|
|
6
|
+
* - разрешение gRPC path в transport-neutral quota;
|
|
7
|
+
* - вызов Consumer-owned limiter-а перед unary transport call;
|
|
8
|
+
* - пропуск response stream calls без limiter-а;
|
|
9
|
+
* - проверка SDK lifecycle и mapping известных call failures в `SdkError`;
|
|
10
|
+
* - делегирование actual call execution в nice-grpc middleware chain;
|
|
11
|
+
*
|
|
12
|
+
* Здесь не должно быть retry policy или stream lifecycle management.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.createSdkMiddleware = createSdkMiddleware;
|
|
16
|
+
const nice_grpc_1 = require("nice-grpc");
|
|
17
|
+
const sdk_error_1 = require("../../../application/errors/sdk-error");
|
|
18
|
+
function createSdkMiddleware(unaryLimiter, unaryLimitResolver, runtime) {
|
|
19
|
+
return async function* (call, options) {
|
|
20
|
+
runtime?.assertOpen();
|
|
21
|
+
if (!call.responseStream && unaryLimiter !== undefined) {
|
|
22
|
+
await acquireUnaryPermit(unaryLimiter, unaryLimitResolver, call.method.path, options.signal, runtime?.signal);
|
|
23
|
+
}
|
|
24
|
+
const callbackBoundary = createCallCallbackBoundary(options);
|
|
25
|
+
try {
|
|
26
|
+
runtime?.assertOpen();
|
|
27
|
+
if (!call.responseStream) {
|
|
28
|
+
throwIfAborted(options.signal);
|
|
29
|
+
const response = yield* call.next(call.request, callbackBoundary?.options ?? options);
|
|
30
|
+
throwCallCallbackFailure(callbackBoundary);
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
throwIfAborted(options.signal);
|
|
34
|
+
for await (const response of call.next(call.request, callbackBoundary?.options ?? options)) {
|
|
35
|
+
throwCallCallbackFailure(callbackBoundary);
|
|
36
|
+
yield response;
|
|
37
|
+
}
|
|
38
|
+
throwCallCallbackFailure(callbackBoundary);
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (callbackBoundary?.failure !== undefined) {
|
|
43
|
+
throw callbackBoundary.failure.reason;
|
|
44
|
+
}
|
|
45
|
+
throw mapSdkCallError(error, call.method.path, options.signal, runtime?.useSsl === true, runtime?.maxReceiveMessageLength);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
throwCallCallbackFailure(callbackBoundary);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const grpcErrorCodes = {
|
|
53
|
+
[nice_grpc_1.Status.CANCELLED]: sdk_error_1.SdkErrorCode.Cancelled,
|
|
54
|
+
[nice_grpc_1.Status.UNKNOWN]: sdk_error_1.SdkErrorCode.Unknown,
|
|
55
|
+
[nice_grpc_1.Status.INVALID_ARGUMENT]: sdk_error_1.SdkErrorCode.InvalidArgument,
|
|
56
|
+
[nice_grpc_1.Status.DEADLINE_EXCEEDED]: sdk_error_1.SdkErrorCode.DeadlineExceeded,
|
|
57
|
+
[nice_grpc_1.Status.NOT_FOUND]: sdk_error_1.SdkErrorCode.NotFound,
|
|
58
|
+
[nice_grpc_1.Status.ALREADY_EXISTS]: sdk_error_1.SdkErrorCode.AlreadyExists,
|
|
59
|
+
[nice_grpc_1.Status.PERMISSION_DENIED]: sdk_error_1.SdkErrorCode.PermissionDenied,
|
|
60
|
+
[nice_grpc_1.Status.RESOURCE_EXHAUSTED]: sdk_error_1.SdkErrorCode.ResourceExhausted,
|
|
61
|
+
[nice_grpc_1.Status.FAILED_PRECONDITION]: sdk_error_1.SdkErrorCode.FailedPrecondition,
|
|
62
|
+
[nice_grpc_1.Status.ABORTED]: sdk_error_1.SdkErrorCode.Aborted,
|
|
63
|
+
[nice_grpc_1.Status.OUT_OF_RANGE]: sdk_error_1.SdkErrorCode.OutOfRange,
|
|
64
|
+
[nice_grpc_1.Status.UNIMPLEMENTED]: sdk_error_1.SdkErrorCode.Unimplemented,
|
|
65
|
+
[nice_grpc_1.Status.INTERNAL]: sdk_error_1.SdkErrorCode.Internal,
|
|
66
|
+
[nice_grpc_1.Status.UNAVAILABLE]: sdk_error_1.SdkErrorCode.Unavailable,
|
|
67
|
+
[nice_grpc_1.Status.DATA_LOSS]: sdk_error_1.SdkErrorCode.DataLoss,
|
|
68
|
+
[nice_grpc_1.Status.UNAUTHENTICATED]: sdk_error_1.SdkErrorCode.Unauthenticated
|
|
69
|
+
};
|
|
70
|
+
const tlsCertificateErrorCodes = [
|
|
71
|
+
'CERT_CHAIN_TOO_LONG',
|
|
72
|
+
'CERT_HAS_EXPIRED',
|
|
73
|
+
'CERT_NOT_YET_VALID',
|
|
74
|
+
'CERT_REJECTED',
|
|
75
|
+
'CERT_REVOKED',
|
|
76
|
+
'CERT_SIGNATURE_FAILURE',
|
|
77
|
+
'CERT_UNTRUSTED',
|
|
78
|
+
'CRL_HAS_EXPIRED',
|
|
79
|
+
'CRL_NOT_YET_VALID',
|
|
80
|
+
'CRL_SIGNATURE_FAILURE',
|
|
81
|
+
'DEPTH_ZERO_SELF_SIGNED_CERT',
|
|
82
|
+
'ERR_TLS_CERT_ALTNAME_FORMAT',
|
|
83
|
+
'ERR_TLS_CERT_ALTNAME_INVALID',
|
|
84
|
+
'HOSTNAME_MISMATCH',
|
|
85
|
+
'INVALID_CA',
|
|
86
|
+
'INVALID_PURPOSE',
|
|
87
|
+
'PATH_LENGTH_EXCEEDED',
|
|
88
|
+
'SELF_SIGNED_CERT_IN_CHAIN',
|
|
89
|
+
'UNABLE_TO_GET_CRL',
|
|
90
|
+
'UNABLE_TO_GET_ISSUER_CERT',
|
|
91
|
+
'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
|
|
92
|
+
'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
|
|
93
|
+
];
|
|
94
|
+
const tlsCertificateErrorMessages = [
|
|
95
|
+
'certificate has expired',
|
|
96
|
+
'certificate is not yet valid',
|
|
97
|
+
'certificate is not trusted',
|
|
98
|
+
'certificate rejected',
|
|
99
|
+
'certificate revoked',
|
|
100
|
+
'certificate verification failed',
|
|
101
|
+
'certificate verify failed',
|
|
102
|
+
'hostname does not match certificate',
|
|
103
|
+
'hostname/ip does not match certificate',
|
|
104
|
+
'self signed certificate',
|
|
105
|
+
'self-signed certificate',
|
|
106
|
+
'unable to get issuer certificate',
|
|
107
|
+
'unable to get local issuer certificate',
|
|
108
|
+
'unable to verify the first certificate',
|
|
109
|
+
'unable to verify leaf signature'
|
|
110
|
+
];
|
|
111
|
+
const standaloneTlsCertificateErrorMessages = new Set([
|
|
112
|
+
...tlsCertificateErrorMessages,
|
|
113
|
+
'self signed certificate in certificate chain',
|
|
114
|
+
'self-signed certificate in certificate chain'
|
|
115
|
+
]);
|
|
116
|
+
const grpcConnectionErrorMarker = 'no connection established. last error:';
|
|
117
|
+
const passiveUnaryLimitSignal = new AbortController().signal;
|
|
118
|
+
async function acquireUnaryPermit(limiter, resolver, path, callSignal, lifecycleSignal) {
|
|
119
|
+
const quota = resolver.resolve(path);
|
|
120
|
+
if (quota === undefined) {
|
|
121
|
+
throw new sdk_error_1.SdkError(sdk_error_1.SdkErrorCode.UnknownUnaryLimit, `Unhandled unary limits for ${path}`, {
|
|
122
|
+
source: 'sdk',
|
|
123
|
+
path
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const signal = resolveUnaryLimitSignal(callSignal, lifecycleSignal);
|
|
127
|
+
try {
|
|
128
|
+
throwIfAborted(signal);
|
|
129
|
+
await limiter.acquire({
|
|
130
|
+
path,
|
|
131
|
+
quota,
|
|
132
|
+
signal
|
|
133
|
+
});
|
|
134
|
+
throwIfAborted(signal);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
if (isCallCancellation(error, callSignal)) {
|
|
138
|
+
throw new sdk_error_1.SdkError(sdk_error_1.SdkErrorCode.Cancelled, errorMessage(error, `SDK call ${path} was cancelled`), {
|
|
139
|
+
source: 'abort',
|
|
140
|
+
path,
|
|
141
|
+
cause: error
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (lifecycleSignal?.aborted === true
|
|
145
|
+
&& (error === lifecycleSignal.reason
|
|
146
|
+
|| errorName(error) === 'AbortError')) {
|
|
147
|
+
throw lifecycleSignal.reason ?? error;
|
|
148
|
+
}
|
|
149
|
+
if ((0, sdk_error_1.isSdkError)(error)) {
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function resolveUnaryLimitSignal(callSignal, lifecycleSignal) {
|
|
156
|
+
if (callSignal !== undefined && lifecycleSignal !== undefined) {
|
|
157
|
+
return AbortSignal.any([callSignal, lifecycleSignal]);
|
|
158
|
+
}
|
|
159
|
+
return callSignal ?? lifecycleSignal ?? passiveUnaryLimitSignal;
|
|
160
|
+
}
|
|
161
|
+
function throwIfAborted(signal) {
|
|
162
|
+
if (signal?.aborted) {
|
|
163
|
+
throw signal.reason ?? createAbortError();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function mapSdkCallError(error, path, signal, useSsl, maxReceiveMessageLength) {
|
|
167
|
+
if (isCallCancellation(error, signal)) {
|
|
168
|
+
return new sdk_error_1.SdkError(sdk_error_1.SdkErrorCode.Cancelled, errorMessage(error, `SDK call ${path} was cancelled`), {
|
|
169
|
+
source: 'abort',
|
|
170
|
+
path,
|
|
171
|
+
cause: error
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if ((0, sdk_error_1.isSdkError)(error)) {
|
|
175
|
+
return error;
|
|
176
|
+
}
|
|
177
|
+
if (error instanceof nice_grpc_1.ClientError) {
|
|
178
|
+
return new sdk_error_1.SdkError(grpcErrorCodes[error.code] ?? sdk_error_1.SdkErrorCode.Unknown, error.message, {
|
|
179
|
+
source: resolveClientErrorSource(error, useSsl, maxReceiveMessageLength),
|
|
180
|
+
path: error.path,
|
|
181
|
+
details: error.details,
|
|
182
|
+
cause: error
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return error;
|
|
186
|
+
}
|
|
187
|
+
function resolveClientErrorSource(error, useSsl, maxReceiveMessageLength) {
|
|
188
|
+
if (isTlsCertificateError(error, useSsl)) {
|
|
189
|
+
return 'tls';
|
|
190
|
+
}
|
|
191
|
+
if (isLocalReceiveMessageLimitError(error, maxReceiveMessageLength)) {
|
|
192
|
+
return 'sdk';
|
|
193
|
+
}
|
|
194
|
+
if (isLocalRequestSerializationError(error)) {
|
|
195
|
+
return 'sdk';
|
|
196
|
+
}
|
|
197
|
+
if (isLocalResponseParsingError(error)) {
|
|
198
|
+
return 'sdk';
|
|
199
|
+
}
|
|
200
|
+
return 'grpc';
|
|
201
|
+
}
|
|
202
|
+
const requestSerializationFailurePrefix = 'Request message serialization failure:';
|
|
203
|
+
function isLocalRequestSerializationError(error) {
|
|
204
|
+
return error.code === nice_grpc_1.Status.INTERNAL
|
|
205
|
+
&& error.details.startsWith(requestSerializationFailurePrefix);
|
|
206
|
+
}
|
|
207
|
+
const responseParsingFailurePrefix = 'Response message parsing error:';
|
|
208
|
+
function isLocalResponseParsingError(error) {
|
|
209
|
+
return error.code === nice_grpc_1.Status.INTERNAL
|
|
210
|
+
&& error.details.startsWith(responseParsingFailurePrefix);
|
|
211
|
+
}
|
|
212
|
+
const receivedMessageLargerThanMaxPattern = /^Received message larger than max \((\d+) vs (\d+)\)$/;
|
|
213
|
+
function isLocalReceiveMessageLimitError(error, maxReceiveMessageLength) {
|
|
214
|
+
if (maxReceiveMessageLength === undefined
|
|
215
|
+
|| error.code !== nice_grpc_1.Status.RESOURCE_EXHAUSTED) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
const rawMessageMatch = receivedMessageLargerThanMaxPattern.exec(error.details);
|
|
219
|
+
if (rawMessageMatch !== null) {
|
|
220
|
+
const receivedMessageLength = rawMessageMatch[1];
|
|
221
|
+
const configuredMessageLength = rawMessageMatch[2];
|
|
222
|
+
return receivedMessageLength !== undefined
|
|
223
|
+
&& configuredMessageLength === String(maxReceiveMessageLength)
|
|
224
|
+
&& Number(receivedMessageLength) > maxReceiveMessageLength;
|
|
225
|
+
}
|
|
226
|
+
return error.details ===
|
|
227
|
+
`Received message that decompresses to a size larger than ${maxReceiveMessageLength}`;
|
|
228
|
+
}
|
|
229
|
+
function isTlsCertificateError(error, useSsl) {
|
|
230
|
+
if (!useSsl || error.code !== nice_grpc_1.Status.UNAVAILABLE) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
const normalizedDetails = error.details.toLowerCase();
|
|
234
|
+
if (tlsCertificateErrorCodes.some((code) => error.details.includes(code))) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
const hasCertificateErrorMessage = tlsCertificateErrorMessages.some((message) => normalizedDetails.includes(message));
|
|
238
|
+
return hasCertificateErrorMessage
|
|
239
|
+
&& (normalizedDetails.includes(grpcConnectionErrorMarker)
|
|
240
|
+
|| standaloneTlsCertificateErrorMessages.has(normalizedDetails.trim()));
|
|
241
|
+
}
|
|
242
|
+
function isCallCancellation(error, signal) {
|
|
243
|
+
return signal?.aborted === true
|
|
244
|
+
&& (error === signal.reason || errorName(error) === 'AbortError');
|
|
245
|
+
}
|
|
246
|
+
function createCallCallbackBoundary(options) {
|
|
247
|
+
if (options.onHeader === undefined && options.onTrailer === undefined) {
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
// nice-grpc вызывает эти callbacks из EventEmitter handlers. Исключение
|
|
251
|
+
// нужно вернуть владельцу RPC, иначе оно обходит Promise/AsyncIterable.
|
|
252
|
+
const controller = new AbortController();
|
|
253
|
+
let failure;
|
|
254
|
+
const captureFailure = (reason) => {
|
|
255
|
+
if (failure === undefined) {
|
|
256
|
+
failure = { reason };
|
|
257
|
+
controller.abort(reason);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const protectedOptions = {
|
|
261
|
+
...options,
|
|
262
|
+
signal: options.signal === undefined
|
|
263
|
+
? controller.signal
|
|
264
|
+
: AbortSignal.any([options.signal, controller.signal])
|
|
265
|
+
};
|
|
266
|
+
if (options.onHeader !== undefined) {
|
|
267
|
+
protectedOptions.onHeader = protectCallCallback(options.onHeader, captureFailure);
|
|
268
|
+
}
|
|
269
|
+
if (options.onTrailer !== undefined) {
|
|
270
|
+
protectedOptions.onTrailer = protectCallCallback(options.onTrailer, captureFailure);
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
options: protectedOptions,
|
|
274
|
+
get failure() {
|
|
275
|
+
return failure;
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function protectCallCallback(callback, captureFailure) {
|
|
280
|
+
return (metadata) => {
|
|
281
|
+
try {
|
|
282
|
+
callback(metadata);
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
captureFailure(error);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function throwCallCallbackFailure(boundary) {
|
|
290
|
+
if (boundary?.failure !== undefined) {
|
|
291
|
+
throw boundary.failure.reason;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function errorName(error) {
|
|
295
|
+
if (typeof error !== 'object' || error === null) {
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
const name = error['name'];
|
|
299
|
+
return typeof name === 'string' ? name : undefined;
|
|
300
|
+
}
|
|
301
|
+
function errorMessage(error, fallback) {
|
|
302
|
+
if (typeof error !== 'object' || error === null) {
|
|
303
|
+
return fallback;
|
|
304
|
+
}
|
|
305
|
+
const message = error['message'];
|
|
306
|
+
return typeof message === 'string' ? message : fallback;
|
|
307
|
+
}
|
|
308
|
+
function createAbortError() {
|
|
309
|
+
const error = new Error('The operation was aborted');
|
|
310
|
+
error.name = 'AbortError';
|
|
311
|
+
return error;
|
|
312
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Модуль trust material загружает корневой сертификат из package asset.
|
|
3
|
+
*
|
|
4
|
+
* Здесь допустимы:
|
|
5
|
+
* - разрешение стабильного пути от compiled module к package root;
|
|
6
|
+
* - ленивое кешированное чтение bundled PEM;
|
|
7
|
+
*
|
|
8
|
+
* Здесь не должно быть сетевой загрузки или изменения system trust store.
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadBundledTlsRootCertificates(): Buffer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Модуль trust material загружает корневой сертификат из package asset.
|
|
4
|
+
*
|
|
5
|
+
* Здесь допустимы:
|
|
6
|
+
* - разрешение стабильного пути от compiled module к package root;
|
|
7
|
+
* - ленивое кешированное чтение bundled PEM;
|
|
8
|
+
*
|
|
9
|
+
* Здесь не должно быть сетевой загрузки или изменения system trust store.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadBundledTlsRootCertificates = loadBundledTlsRootCertificates;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
14
|
+
const node_path_1 = require("node:path");
|
|
15
|
+
const bundledTlsRootCertificatesPath = (0, node_path_1.resolve)(__dirname, '../../../../certificates/russian-trusted-root-ca.pem');
|
|
16
|
+
let bundledTlsRootCertificates;
|
|
17
|
+
function loadBundledTlsRootCertificates() {
|
|
18
|
+
bundledTlsRootCertificates ??= (0, node_fs_1.readFileSync)(bundledTlsRootCertificatesPath);
|
|
19
|
+
return bundledTlsRootCertificates;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport resolver сопоставляет gRPC method path с готовыми unary quotas.
|
|
3
|
+
*
|
|
4
|
+
* Здесь допустимы:
|
|
5
|
+
* - точное сопоставление method paths;
|
|
6
|
+
* - разрешение service fallback по qualified gRPC service name;
|
|
7
|
+
* - выбор runtime bucket для найденного правила.
|
|
8
|
+
*
|
|
9
|
+
* Здесь не должно быть compilation package config, validation limits или
|
|
10
|
+
* limiter state.
|
|
11
|
+
*/
|
|
12
|
+
import type { TInvestUnaryLimit, TInvestUnaryQuota } from '../../../application/services/unary-limiter';
|
|
13
|
+
type UnaryLimitRules = Readonly<Record<string, TInvestUnaryLimit>>;
|
|
14
|
+
type UnaryLimitBuckets = Readonly<Record<string, string>>;
|
|
15
|
+
export declare class UnaryLimitResolver {
|
|
16
|
+
private readonly limits;
|
|
17
|
+
private readonly buckets;
|
|
18
|
+
constructor(limits: UnaryLimitRules, buckets?: UnaryLimitBuckets);
|
|
19
|
+
resolve(path: string): TInvestUnaryQuota | undefined;
|
|
20
|
+
private matchesRule;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Transport resolver сопоставляет gRPC method path с готовыми unary quotas.
|
|
4
|
+
*
|
|
5
|
+
* Здесь допустимы:
|
|
6
|
+
* - точное сопоставление method paths;
|
|
7
|
+
* - разрешение service fallback по qualified gRPC service name;
|
|
8
|
+
* - выбор runtime bucket для найденного правила.
|
|
9
|
+
*
|
|
10
|
+
* Здесь не должно быть compilation package config, validation limits или
|
|
11
|
+
* limiter state.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.UnaryLimitResolver = void 0;
|
|
15
|
+
class UnaryLimitResolver {
|
|
16
|
+
limits;
|
|
17
|
+
buckets;
|
|
18
|
+
constructor(limits, buckets = {}) {
|
|
19
|
+
this.limits = limits;
|
|
20
|
+
this.buckets = buckets;
|
|
21
|
+
}
|
|
22
|
+
resolve(path) {
|
|
23
|
+
let matchedKey;
|
|
24
|
+
let matchedLimit;
|
|
25
|
+
for (const [key, limit] of Object.entries(this.limits)) {
|
|
26
|
+
if (this.matchesRule(path, key)
|
|
27
|
+
&& (matchedKey === undefined || key.length > matchedKey.length)) {
|
|
28
|
+
matchedKey = key;
|
|
29
|
+
matchedLimit = limit;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (matchedKey === undefined || matchedLimit === undefined) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const quotaBucket = this.buckets[matchedKey];
|
|
36
|
+
return {
|
|
37
|
+
bucket: quotaBucket === undefined
|
|
38
|
+
? `rule:${matchedKey}`
|
|
39
|
+
: `quota:${quotaBucket}`,
|
|
40
|
+
maxRequests: matchedLimit.maxRequests,
|
|
41
|
+
windowMs: matchedLimit.windowMs
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
matchesRule(path, key) {
|
|
45
|
+
if (path === key) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (key.indexOf('/') > -1) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const methodSeparator = path.lastIndexOf('/');
|
|
52
|
+
if (methodSeparator < 1) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const qualifiedService = path.slice(0, methodSeparator);
|
|
56
|
+
const serviceSeparator = Math.max(qualifiedService.lastIndexOf('.'), qualifiedService.lastIndexOf('/'));
|
|
57
|
+
return qualifiedService.slice(serviceSeparator + 1) === key;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.UnaryLimitResolver = UnaryLimitResolver;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unaryMethodPath(service: string, method: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unaryMethodPath = unaryMethodPath;
|
|
4
|
+
const grpcServicePathPrefix = '/tinkoff.public.invest.api.contract.v1.';
|
|
5
|
+
function unaryMethodPath(service, method) {
|
|
6
|
+
return `${grpcServicePathPrefix}${service}/${method}`;
|
|
7
|
+
}
|