@woodger/t-invest-node-sdk 0.5.1 → 0.5.3
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 +44 -16
- package/{THIRD_PARTY_NOTICES.md → LICENSE-APACHE-2.0} +1 -106
- package/NOTICE +98 -0
- package/dist/application/services/unary-limiter.js +9 -9
- package/dist/bootstrap/args/sdk-options.d.ts +1 -2
- package/dist/bootstrap/cli/help-catalog.d.ts +733 -0
- package/dist/bootstrap/cli/help-catalog.js +1649 -0
- package/dist/bootstrap/cli/help.d.ts +2 -730
- package/dist/bootstrap/cli/help.js +5 -1647
- package/dist/bootstrap/cli/registry.d.ts +6 -6
- package/dist/bootstrap/commands/accounts/cli.d.ts +2 -3
- package/dist/bootstrap/commands/accounts/cli.js +5 -10
- package/dist/bootstrap/commands/accrued-interests/cli.d.ts +2 -3
- package/dist/bootstrap/commands/accrued-interests/cli.js +5 -10
- package/dist/bootstrap/commands/asset/cli.d.ts +2 -3
- package/dist/bootstrap/commands/asset/cli.js +5 -10
- package/dist/bootstrap/commands/assets/cli.d.ts +2 -3
- package/dist/bootstrap/commands/assets/cli.js +5 -10
- package/dist/bootstrap/commands/bond/cli.d.ts +2 -3
- package/dist/bootstrap/commands/bond/cli.js +5 -10
- package/dist/bootstrap/commands/bond-coupons/cli.d.ts +2 -3
- package/dist/bootstrap/commands/bond-coupons/cli.js +5 -10
- package/dist/bootstrap/commands/bonds/cli.d.ts +2 -3
- package/dist/bootstrap/commands/bonds/cli.js +5 -10
- package/dist/bootstrap/commands/brand/cli.d.ts +2 -3
- package/dist/bootstrap/commands/brand/cli.js +5 -10
- package/dist/bootstrap/commands/brands/cli.d.ts +2 -3
- package/dist/bootstrap/commands/brands/cli.js +5 -10
- package/dist/bootstrap/commands/broker-report/cli.d.ts +2 -3
- package/dist/bootstrap/commands/broker-report/cli.js +5 -10
- package/dist/bootstrap/commands/cancel-order/cli.d.ts +3 -39
- package/dist/bootstrap/commands/cancel-order/cli.js +8 -19
- package/dist/bootstrap/commands/cancel-order/request.mapper.d.ts +7 -0
- package/dist/bootstrap/commands/cancel-order/request.mapper.js +9 -0
- package/dist/bootstrap/commands/cancel-stop-order/cli.d.ts +3 -4
- package/dist/bootstrap/commands/cancel-stop-order/cli.js +6 -11
- package/dist/bootstrap/commands/candles/cli.d.ts +3 -4
- package/dist/bootstrap/commands/candles/cli.js +6 -11
- package/dist/bootstrap/commands/close-prices/cli.d.ts +3 -4
- package/dist/bootstrap/commands/close-prices/cli.js +6 -11
- package/dist/bootstrap/commands/countries/cli.d.ts +2 -3
- package/dist/bootstrap/commands/countries/cli.js +5 -10
- package/dist/bootstrap/commands/currencies/cli.d.ts +2 -3
- package/dist/bootstrap/commands/currencies/cli.js +5 -10
- package/dist/bootstrap/commands/currency/cli.d.ts +2 -3
- package/dist/bootstrap/commands/currency/cli.js +5 -10
- package/dist/bootstrap/commands/dividends/cli.d.ts +2 -3
- package/dist/bootstrap/commands/dividends/cli.js +5 -10
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.d.ts +2 -3
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.js +5 -10
- package/dist/bootstrap/commands/edit-favorites/cli.d.ts +2 -3
- package/dist/bootstrap/commands/edit-favorites/cli.js +5 -10
- package/dist/bootstrap/commands/etf/cli.d.ts +2 -3
- package/dist/bootstrap/commands/etf/cli.js +5 -10
- package/dist/bootstrap/commands/etfs/cli.d.ts +2 -3
- package/dist/bootstrap/commands/etfs/cli.js +5 -10
- package/dist/bootstrap/commands/favorites/cli.d.ts +2 -3
- package/dist/bootstrap/commands/favorites/cli.js +5 -10
- package/dist/bootstrap/commands/find-instrument/cli.d.ts +2 -3
- package/dist/bootstrap/commands/find-instrument/cli.js +5 -10
- package/dist/bootstrap/commands/future/cli.d.ts +2 -3
- package/dist/bootstrap/commands/future/cli.js +5 -10
- package/dist/bootstrap/commands/futures/cli.d.ts +2 -3
- package/dist/bootstrap/commands/futures/cli.js +5 -10
- package/dist/bootstrap/commands/futures-margin/cli.d.ts +2 -3
- package/dist/bootstrap/commands/futures-margin/cli.js +5 -10
- package/dist/bootstrap/commands/instrument/cli.d.ts +2 -3
- package/dist/bootstrap/commands/instrument/cli.js +5 -10
- package/dist/bootstrap/commands/last-prices/cli.d.ts +3 -4
- package/dist/bootstrap/commands/last-prices/cli.js +6 -11
- package/dist/bootstrap/commands/last-trades/cli.d.ts +3 -4
- package/dist/bootstrap/commands/last-trades/cli.js +6 -11
- package/dist/bootstrap/commands/margin-attributes/cli.d.ts +2 -3
- package/dist/bootstrap/commands/margin-attributes/cli.js +5 -10
- package/dist/bootstrap/commands/operations/cli.d.ts +5 -53
- package/dist/bootstrap/commands/operations/cli.js +9 -36
- package/dist/bootstrap/commands/operations/request.mapper.d.ts +23 -0
- package/dist/bootstrap/commands/operations/request.mapper.js +33 -0
- package/dist/bootstrap/commands/operations-by-cursor/cli.d.ts +5 -69
- package/dist/bootstrap/commands/operations-by-cursor/cli.js +9 -74
- package/dist/bootstrap/commands/operations-by-cursor/request.mapper.d.ts +28 -0
- package/dist/bootstrap/commands/operations-by-cursor/request.mapper.js +70 -0
- package/dist/bootstrap/commands/option/cli.d.ts +2 -3
- package/dist/bootstrap/commands/option/cli.js +5 -10
- package/dist/bootstrap/commands/options-by/cli.d.ts +2 -3
- package/dist/bootstrap/commands/options-by/cli.js +5 -10
- package/dist/bootstrap/commands/order-book/cli.d.ts +3 -4
- package/dist/bootstrap/commands/order-book/cli.js +6 -11
- package/dist/bootstrap/commands/order-state/cli.d.ts +3 -36
- package/dist/bootstrap/commands/order-state/cli.js +8 -21
- package/dist/bootstrap/commands/order-state/request.mapper.d.ts +13 -0
- package/dist/bootstrap/commands/order-state/request.mapper.js +17 -0
- package/dist/bootstrap/commands/orders/cli.d.ts +3 -32
- package/dist/bootstrap/commands/orders/cli.js +8 -18
- package/dist/bootstrap/commands/orders/request.mapper.d.ts +6 -0
- package/dist/bootstrap/commands/orders/request.mapper.js +8 -0
- package/dist/bootstrap/commands/portfolio/cli.d.ts +6 -40
- package/dist/bootstrap/commands/portfolio/cli.js +9 -26
- package/dist/bootstrap/commands/portfolio/request.mapper.d.ts +18 -0
- package/dist/bootstrap/commands/portfolio/request.mapper.js +21 -0
- package/dist/bootstrap/commands/positions/cli.d.ts +3 -32
- package/dist/bootstrap/commands/positions/cli.js +8 -18
- package/dist/bootstrap/commands/positions/request.mapper.d.ts +6 -0
- package/dist/bootstrap/commands/positions/request.mapper.js +8 -0
- package/dist/bootstrap/commands/post-order/cli.d.ts +8 -68
- package/dist/bootstrap/commands/post-order/cli.js +9 -39
- package/dist/bootstrap/commands/post-order/request.mapper.d.ts +27 -0
- package/dist/bootstrap/commands/post-order/request.mapper.js +35 -0
- package/dist/bootstrap/commands/post-stop-order/cli.d.ts +3 -4
- package/dist/bootstrap/commands/post-stop-order/cli.js +6 -11
- package/dist/bootstrap/commands/replace-order/cli.d.ts +5 -61
- package/dist/bootstrap/commands/replace-order/cli.js +9 -30
- package/dist/bootstrap/commands/replace-order/request.mapper.d.ts +22 -0
- package/dist/bootstrap/commands/replace-order/request.mapper.js +26 -0
- package/dist/bootstrap/commands/sandbox-accounts/cli.d.ts +2 -3
- package/dist/bootstrap/commands/sandbox-accounts/cli.js +5 -10
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-close-account/cli.d.ts +2 -3
- package/dist/bootstrap/commands/sandbox-close-account/cli.js +5 -10
- package/dist/bootstrap/commands/sandbox-open-account/cli.d.ts +2 -3
- package/dist/bootstrap/commands/sandbox-open-account/cli.js +5 -10
- package/dist/bootstrap/commands/sandbox-operations/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-operations/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-order-state/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-order-state/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-orders/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-orders/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-pay-in/cli.d.ts +2 -3
- package/dist/bootstrap/commands/sandbox-pay-in/cli.js +5 -10
- package/dist/bootstrap/commands/sandbox-portfolio/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-portfolio/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-positions/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-positions/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-post-order/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-post-order/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-replace-order/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-replace-order/cli.js +8 -13
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.d.ts +3 -4
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.js +8 -13
- package/dist/bootstrap/commands/sdk-command-lifecycle.d.ts +15 -0
- package/dist/bootstrap/commands/sdk-command-lifecycle.js +21 -0
- package/dist/bootstrap/commands/share/cli.d.ts +2 -3
- package/dist/bootstrap/commands/share/cli.js +5 -10
- package/dist/bootstrap/commands/shares/cli.d.ts +2 -3
- package/dist/bootstrap/commands/shares/cli.js +5 -10
- package/dist/bootstrap/commands/stop-orders/cli.d.ts +3 -4
- package/dist/bootstrap/commands/stop-orders/cli.js +6 -11
- package/dist/bootstrap/commands/stream-run/cli.d.ts +2 -24
- package/dist/bootstrap/commands/stream-run/cli.js +7 -142
- package/dist/bootstrap/commands/stream-run/config.d.ts +7 -15
- package/dist/bootstrap/commands/stream-run/config.js +1 -101
- package/dist/bootstrap/commands/stream-run/request.mapper.d.ts +14 -0
- package/dist/bootstrap/commands/stream-run/request.mapper.js +111 -0
- package/dist/bootstrap/commands/stream-run/stream-session.d.ts +37 -0
- package/dist/bootstrap/commands/stream-run/stream-session.js +152 -0
- package/dist/bootstrap/commands/trading-schedules/cli.d.ts +2 -3
- package/dist/bootstrap/commands/trading-schedules/cli.js +5 -10
- package/dist/bootstrap/commands/trading-status/cli.d.ts +3 -4
- package/dist/bootstrap/commands/trading-status/cli.js +6 -11
- package/dist/bootstrap/commands/trading-statuses/cli.d.ts +3 -4
- package/dist/bootstrap/commands/trading-statuses/cli.js +6 -11
- package/dist/bootstrap/commands/user-info/cli.d.ts +2 -3
- package/dist/bootstrap/commands/user-info/cli.js +5 -10
- package/dist/bootstrap/commands/user-tariff/cli.d.ts +2 -3
- package/dist/bootstrap/commands/user-tariff/cli.js +5 -10
- package/dist/bootstrap/commands/withdraw-limits/cli.d.ts +3 -32
- package/dist/bootstrap/commands/withdraw-limits/cli.js +8 -18
- package/dist/bootstrap/commands/withdraw-limits/request.mapper.d.ts +6 -0
- package/dist/bootstrap/commands/withdraw-limits/request.mapper.js +8 -0
- package/dist/bootstrap/index.js +2 -2
- package/dist/bootstrap/proto/compile-proto.d.ts +1 -1
- package/dist/bootstrap/proto/compile-proto.js +28 -35
- package/dist/bootstrap/t-invest-node-sdk.d.ts +9 -9
- package/dist/bootstrap/t-invest-node-sdk.js +33 -18
- package/dist/bootstrap/unary-limit-config.js +4 -4
- package/dist/generated/common.js +1 -1
- package/dist/generated/google/api/field_behavior.js +1 -1
- package/dist/generated/google/protobuf/descriptor.js +1 -1
- package/dist/generated/google/protobuf/timestamp.js +1 -1
- package/dist/generated/instruments.js +1 -1
- package/dist/generated/marketdata.js +1 -1
- package/dist/generated/operations.js +1 -1
- package/dist/generated/orders.js +1 -1
- package/dist/generated/sandbox.js +1 -1
- package/dist/generated/signals.js +1 -1
- package/dist/generated/stoporders.js +1 -1
- package/dist/generated/users.js +1 -1
- package/dist/infrastructure/interceptor/warning-interceptor.d.ts +1 -1
- package/dist/infrastructure/interceptor/warning-interceptor.js +2 -2
- package/dist/infrastructure/transport/grpc/sdk-call-error.d.ts +12 -0
- package/dist/infrastructure/transport/grpc/sdk-call-error.js +180 -0
- package/dist/infrastructure/transport/grpc/sdk-client.d.ts +1 -1
- package/dist/infrastructure/transport/grpc/sdk-client.js +2 -2
- package/dist/infrastructure/transport/grpc/sdk-middleware.d.ts +1 -1
- package/dist/infrastructure/transport/grpc/sdk-middleware.js +8 -174
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.d.ts +3 -1
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.js +19 -18
- package/docs/architecture.md +88 -259
- package/docs/bundled-ca.md +19 -65
- package/docs/clean-architecture/adapters.md +26 -55
- package/docs/clean-architecture/api-commands.md +141 -263
- package/docs/clean-architecture/application.md +20 -46
- package/docs/clean-architecture/cli-output-boundaries.md +34 -74
- package/docs/clean-architecture/dto.md +18 -45
- package/docs/clean-architecture/index.md +18 -29
- package/docs/cli-stream-configuration.md +18 -40
- package/docs/cli-stream-reference.md +16 -44
- package/docs/guides/custom-unary-limiter.md +47 -117
- package/docs/guides/errors-and-lifecycle.md +17 -50
- package/docs/guides/getting-started.md +12 -26
- package/docs/guides/index.md +9 -20
- package/docs/guides/streams-and-cancellation.md +6 -21
- package/docs/guides/testing-with-service-definitions.md +5 -13
- package/docs/guides/unary-calls.md +22 -57
- package/docs/index.md +26 -55
- package/docs/limits-policy.md +25 -84
- package/docs/roadmap.md +35 -92
- package/docs/tls-policy.md +11 -34
- package/package.json +2 -1
- package/readme.md +75 -216
- package/dist/infrastructure/interceptor/index.d.ts +0 -1
- package/dist/infrastructure/interceptor/index.js +0 -17
- /package/dist/infrastructure/transport/grpc/{unary-limits.d.ts → unary-method-path.d.ts} +0 -0
- /package/dist/infrastructure/transport/grpc/{unary-limits.js → unary-method-path.js} +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# API-команды
|
|
2
2
|
|
|
3
|
-
> Type: Design Note.
|
|
4
|
-
> проблему роста `bootstrap`.
|
|
3
|
+
> Type: Design Note. Здесь описаны текущая структура CLI API-команд и риск разрастания `bootstrap`.
|
|
5
4
|
|
|
6
5
|
## Контекст
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
friendly path: `<domain> <resource/action>`.
|
|
7
|
+
SDK публикует API-команды в виде preferred friendly path: `<domain> <resource/action>`.
|
|
10
8
|
|
|
11
9
|
Публичные domains:
|
|
12
10
|
|
|
@@ -20,178 +18,92 @@ friendly path: `<domain> <resource/action>`.
|
|
|
20
18
|
- `stream`;
|
|
21
19
|
- `dev`.
|
|
22
20
|
|
|
23
|
-
Technical и legacy paths
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- `
|
|
30
|
-
|
|
31
|
-
- `
|
|
32
|
-
|
|
33
|
-
- `
|
|
34
|
-
|
|
35
|
-
- `
|
|
36
|
-
|
|
37
|
-
- `
|
|
38
|
-
|
|
39
|
-
- `
|
|
40
|
-
|
|
41
|
-
- `
|
|
42
|
-
|
|
43
|
-
- `
|
|
44
|
-
|
|
45
|
-
- `
|
|
46
|
-
|
|
47
|
-
- `
|
|
48
|
-
|
|
49
|
-
- `
|
|
50
|
-
|
|
51
|
-
- `instrument
|
|
52
|
-
|
|
53
|
-
- `instrument show` -> `sdk.instruments.
|
|
54
|
-
|
|
55
|
-
- `instrument
|
|
56
|
-
|
|
57
|
-
- `instrument
|
|
58
|
-
|
|
59
|
-
- `instrument
|
|
60
|
-
|
|
61
|
-
- `instrument
|
|
62
|
-
|
|
63
|
-
- `
|
|
64
|
-
|
|
65
|
-
- `
|
|
66
|
-
|
|
67
|
-
- `
|
|
68
|
-
|
|
69
|
-
- `
|
|
70
|
-
|
|
71
|
-
- `
|
|
72
|
-
|
|
73
|
-
- `
|
|
74
|
-
|
|
75
|
-
- `
|
|
76
|
-
|
|
77
|
-
- `
|
|
78
|
-
|
|
79
|
-
- `
|
|
80
|
-
|
|
81
|
-
- `
|
|
82
|
-
|
|
83
|
-
- `
|
|
84
|
-
|
|
85
|
-
- `
|
|
86
|
-
|
|
87
|
-
- `
|
|
88
|
-
|
|
89
|
-
- `
|
|
90
|
-
|
|
91
|
-
- `instrument option show` -> `sdk.instruments.optionBy`
|
|
92
|
-
(`instrument option-by`, `instruments option-by`);
|
|
93
|
-
- `instrument asset list` -> `sdk.instruments.getAssets`
|
|
94
|
-
(`instrument get-assets`, `instruments get-assets`);
|
|
95
|
-
- `instrument asset show` -> `sdk.instruments.getAssetBy`
|
|
96
|
-
(`instrument get-asset-by`, `instruments get-asset-by`);
|
|
97
|
-
- `instrument brand list` -> `sdk.instruments.getBrands`
|
|
98
|
-
(`instrument get-brands`, `instruments get-brands`);
|
|
99
|
-
- `instrument brand show` -> `sdk.instruments.getBrandBy`
|
|
100
|
-
(`instrument get-brand-by`, `instruments get-brand-by`);
|
|
101
|
-
- `instrument country list` -> `sdk.instruments.getCountries`
|
|
102
|
-
(`instrument get-countries`, `instruments get-countries`);
|
|
103
|
-
- `order list` -> `sdk.orders.getOrders`
|
|
104
|
-
(`order get-orders`, `orders get-orders`);
|
|
105
|
-
- `order show` -> `sdk.orders.getOrderState`
|
|
106
|
-
(`order get-order-state`, `orders get-order-state`);
|
|
107
|
-
- `order place` -> `sdk.orders.postOrder`
|
|
108
|
-
(`order post-order`, `orders post-order`);
|
|
109
|
-
- `order cancel` -> `sdk.orders.cancelOrder`
|
|
110
|
-
(`order cancel-order`, `orders cancel-order`);
|
|
111
|
-
- `order replace` -> `sdk.orders.replaceOrder`
|
|
112
|
-
(`order replace-order`, `orders replace-order`);
|
|
113
|
-
- `operation list` -> `sdk.operations.getOperations`
|
|
114
|
-
(`operation get-operations`, `operations get-operations`);
|
|
115
|
-
- `operation page` -> `sdk.operations.getOperationsByCursor`
|
|
116
|
-
(`operation get-operations-by-cursor`, `operations get-operations-by-cursor`);
|
|
117
|
-
- `operation broker-report` -> `sdk.operations.getBrokerReport`
|
|
118
|
-
(`operation get-broker-report`, `operations get-broker-report`);
|
|
119
|
-
- `operation foreign-dividends-report` -> `sdk.operations.getDividendsForeignIssuer`
|
|
120
|
-
(`operation get-dividends-foreign-issuer`, `operations get-dividends-foreign-issuer`);
|
|
121
|
-
- `operation portfolio` -> `sdk.operations.getPortfolio`
|
|
122
|
-
(`operation get-portfolio`, `operations get-portfolio`);
|
|
123
|
-
- `operation positions` -> `sdk.operations.getPositions`
|
|
124
|
-
(`operation get-positions`, `operations get-positions`);
|
|
125
|
-
- `operation withdraw-limits` -> `sdk.operations.getWithdrawLimits`
|
|
126
|
-
(`operation get-withdraw-limits`, `operations get-withdraw-limits`);
|
|
127
|
-
- `stop-order list` -> `sdk.stoporders.getStopOrders`
|
|
128
|
-
(`stop-order get-stop-orders`, `stoporders get-stop-orders`);
|
|
129
|
-
- `stop-order place` -> `sdk.stoporders.postStopOrder`
|
|
130
|
-
(`stop-order post-stop-order`, `stoporders post-stop-order`);
|
|
131
|
-
- `stop-order cancel` -> `sdk.stoporders.cancelStopOrder`
|
|
132
|
-
(`stop-order cancel-stop-order`, `stoporders cancel-stop-order`);
|
|
133
|
-
- `sandbox account list` -> `sdk.sandbox.getSandboxAccounts`
|
|
134
|
-
(`sandbox get-sandbox-accounts`);
|
|
135
|
-
- `sandbox account open` -> `sdk.sandbox.openSandboxAccount`
|
|
136
|
-
(`sandbox open-sandbox-account`);
|
|
137
|
-
- `sandbox account close` -> `sdk.sandbox.closeSandboxAccount`
|
|
138
|
-
(`sandbox close-sandbox-account`);
|
|
139
|
-
- `sandbox order list` -> `sdk.sandbox.getSandboxOrders`
|
|
140
|
-
(`sandbox get-sandbox-orders`);
|
|
141
|
-
- `sandbox order show` -> `sdk.sandbox.getSandboxOrderState`
|
|
142
|
-
(`sandbox get-sandbox-order-state`);
|
|
143
|
-
- `sandbox order place` -> `sdk.sandbox.postSandboxOrder`
|
|
144
|
-
(`sandbox post-sandbox-order`);
|
|
145
|
-
- `sandbox order replace` -> `sdk.sandbox.replaceSandboxOrder`
|
|
146
|
-
(`sandbox replace-sandbox-order`);
|
|
147
|
-
- `sandbox order cancel` -> `sdk.sandbox.cancelSandboxOrder`
|
|
148
|
-
(`sandbox cancel-sandbox-order`);
|
|
149
|
-
- `sandbox position list` -> `sdk.sandbox.getSandboxPositions`
|
|
150
|
-
(`sandbox get-sandbox-positions`);
|
|
151
|
-
- `sandbox operation list` -> `sdk.sandbox.getSandboxOperations`
|
|
152
|
-
(`sandbox get-sandbox-operations`);
|
|
153
|
-
- `sandbox operation page` -> `sdk.sandbox.getSandboxOperationsByCursor`
|
|
154
|
-
(`sandbox get-sandbox-operations-by-cursor`);
|
|
155
|
-
- `sandbox portfolio` -> `sdk.sandbox.getSandboxPortfolio`
|
|
156
|
-
(`sandbox get-sandbox-portfolio`);
|
|
157
|
-
- `sandbox withdraw-limits` -> `sdk.sandbox.getSandboxWithdrawLimits`
|
|
158
|
-
(`sandbox get-sandbox-withdraw-limits`);
|
|
159
|
-
- `sandbox pay-in` -> `sdk.sandbox.sandboxPayIn`
|
|
160
|
-
(`sandbox sandbox-pay-in`);
|
|
21
|
+
Technical и legacy paths работают как compatibility aliases, но help и документация показывают только preferred paths. Registry хранит один canonical definition на команду и передаёт остальные пути через first-class aliases `icore`. В resolved command поля `name` и `path` содержат preferred identity, а `matchedPath` — введённый путь. Текущий CLI contract:
|
|
22
|
+
|
|
23
|
+
- `account list` -> `sdk.users.getAccounts` (`account get-accounts`, `users get-accounts`);
|
|
24
|
+
- `account info` -> `sdk.users.getInfo` (`account get-info`, `users get-info`);
|
|
25
|
+
- `account margin` -> `sdk.users.getMarginAttributes` (`account get-margin-attributes`, `users get-margin-attributes`);
|
|
26
|
+
- `account tariff` -> `sdk.users.getUserTariff` (`account get-user-tariff`, `users get-user-tariff`);
|
|
27
|
+
- `market candles` -> `sdk.marketData.getCandles` (`market get-candles`, `marketdata get-candles`);
|
|
28
|
+
- `market close-prices` -> `sdk.marketData.getClosePrices` (`market get-close-prices`, `marketdata get-close-prices`);
|
|
29
|
+
- `market last-prices` -> `sdk.marketData.getLastPrices` (`market get-last-prices`, `marketdata get-last-prices`);
|
|
30
|
+
- `market trades` -> `sdk.marketData.getLastTrades` (`market get-last-trades`, `marketdata get-last-trades`);
|
|
31
|
+
- `market order-book` -> `sdk.marketData.getOrderBook` (`market get-order-book`, `marketdata get-order-book`);
|
|
32
|
+
- `market status` -> `sdk.marketData.getTradingStatus` (`market get-trading-status`, `marketdata get-trading-status`);
|
|
33
|
+
- `market statuses` -> `sdk.marketData.getTradingStatuses` (`market get-trading-statuses`, `marketdata get-trading-statuses`);
|
|
34
|
+
- `instrument search` -> `sdk.instruments.findInstrument` (`instrument find-instrument`, `instruments find-instrument`);
|
|
35
|
+
- `instrument show` -> `sdk.instruments.getInstrumentBy` (`instrument get-instrument-by`, `instruments get-instrument-by`);
|
|
36
|
+
- `instrument dividends` -> `sdk.instruments.getDividends` (`instrument get-dividends`, `instruments get-dividends`);
|
|
37
|
+
- `instrument schedules` -> `sdk.instruments.tradingSchedules` (`instrument trading-schedules`, `instruments trading-schedules`);
|
|
38
|
+
- `instrument favorite list` -> `sdk.instruments.getFavorites` (`instrument get-favorites`, `instruments get-favorites`);
|
|
39
|
+
- `instrument favorite edit` -> `sdk.instruments.editFavorites` (`instrument edit-favorites`, `instruments edit-favorites`);
|
|
40
|
+
- `instrument share list` -> `sdk.instruments.shares` (`instrument shares`, `instruments shares`);
|
|
41
|
+
- `instrument share show` -> `sdk.instruments.shareBy` (`instrument share-by`, `instruments share-by`);
|
|
42
|
+
- `instrument bond list` -> `sdk.instruments.bonds` (`instrument bonds`, `instruments bonds`);
|
|
43
|
+
- `instrument bond show` -> `sdk.instruments.bondBy` (`instrument bond-by`, `instruments bond-by`);
|
|
44
|
+
- `instrument bond coupons` -> `sdk.instruments.getBondCoupons` (`instrument get-bond-coupons`, `instruments get-bond-coupons`);
|
|
45
|
+
- `instrument bond accrued` -> `sdk.instruments.getAccruedInterests` (`instrument get-accrued-interests`, `instruments get-accrued-interests`);
|
|
46
|
+
- `instrument etf list` -> `sdk.instruments.etfs` (`instrument etfs`, `instruments etfs`);
|
|
47
|
+
- `instrument etf show` -> `sdk.instruments.etfBy` (`instrument etf-by`, `instruments etf-by`);
|
|
48
|
+
- `instrument currency list` -> `sdk.instruments.currencies` (`instrument currencies`, `instruments currencies`);
|
|
49
|
+
- `instrument currency show` -> `sdk.instruments.currencyBy` (`instrument currency-by`, `instruments currency-by`);
|
|
50
|
+
- `instrument future list` -> `sdk.instruments.futures` (`instrument futures`, `instruments futures`);
|
|
51
|
+
- `instrument future show` -> `sdk.instruments.futureBy` (`instrument future-by`, `instruments future-by`);
|
|
52
|
+
- `instrument future margin` -> `sdk.instruments.getFuturesMargin` (`instrument get-futures-margin`, `instruments get-futures-margin`);
|
|
53
|
+
- `instrument option list` -> `sdk.instruments.optionsBy` (`instrument options-by`, `instruments options-by`);
|
|
54
|
+
- `instrument option show` -> `sdk.instruments.optionBy` (`instrument option-by`, `instruments option-by`);
|
|
55
|
+
- `instrument asset list` -> `sdk.instruments.getAssets` (`instrument get-assets`, `instruments get-assets`);
|
|
56
|
+
- `instrument asset show` -> `sdk.instruments.getAssetBy` (`instrument get-asset-by`, `instruments get-asset-by`);
|
|
57
|
+
- `instrument brand list` -> `sdk.instruments.getBrands` (`instrument get-brands`, `instruments get-brands`);
|
|
58
|
+
- `instrument brand show` -> `sdk.instruments.getBrandBy` (`instrument get-brand-by`, `instruments get-brand-by`);
|
|
59
|
+
- `instrument country list` -> `sdk.instruments.getCountries` (`instrument get-countries`, `instruments get-countries`);
|
|
60
|
+
- `order list` -> `sdk.orders.getOrders` (`order get-orders`, `orders get-orders`);
|
|
61
|
+
- `order show` -> `sdk.orders.getOrderState` (`order get-order-state`, `orders get-order-state`);
|
|
62
|
+
- `order place` -> `sdk.orders.postOrder` (`order post-order`, `orders post-order`);
|
|
63
|
+
- `order cancel` -> `sdk.orders.cancelOrder` (`order cancel-order`, `orders cancel-order`);
|
|
64
|
+
- `order replace` -> `sdk.orders.replaceOrder` (`order replace-order`, `orders replace-order`);
|
|
65
|
+
- `operation list` -> `sdk.operations.getOperations` (`operation get-operations`, `operations get-operations`);
|
|
66
|
+
- `operation page` -> `sdk.operations.getOperationsByCursor` (`operation get-operations-by-cursor`, `operations get-operations-by-cursor`);
|
|
67
|
+
- `operation broker-report` -> `sdk.operations.getBrokerReport` (`operation get-broker-report`, `operations get-broker-report`);
|
|
68
|
+
- `operation foreign-dividends-report` -> `sdk.operations.getDividendsForeignIssuer` (`operation get-dividends-foreign-issuer`, `operations get-dividends-foreign-issuer`);
|
|
69
|
+
- `operation portfolio` -> `sdk.operations.getPortfolio` (`operation get-portfolio`, `operations get-portfolio`);
|
|
70
|
+
- `operation positions` -> `sdk.operations.getPositions` (`operation get-positions`, `operations get-positions`);
|
|
71
|
+
- `operation withdraw-limits` -> `sdk.operations.getWithdrawLimits` (`operation get-withdraw-limits`, `operations get-withdraw-limits`);
|
|
72
|
+
- `stop-order list` -> `sdk.stopOrders.getStopOrders` (`stop-order get-stop-orders`, `stoporders get-stop-orders`);
|
|
73
|
+
- `stop-order place` -> `sdk.stopOrders.postStopOrder` (`stop-order post-stop-order`, `stoporders post-stop-order`);
|
|
74
|
+
- `stop-order cancel` -> `sdk.stopOrders.cancelStopOrder` (`stop-order cancel-stop-order`, `stoporders cancel-stop-order`);
|
|
75
|
+
- `sandbox account list` -> `sdk.sandbox.getSandboxAccounts` (`sandbox get-sandbox-accounts`);
|
|
76
|
+
- `sandbox account open` -> `sdk.sandbox.openSandboxAccount` (`sandbox open-sandbox-account`);
|
|
77
|
+
- `sandbox account close` -> `sdk.sandbox.closeSandboxAccount` (`sandbox close-sandbox-account`);
|
|
78
|
+
- `sandbox order list` -> `sdk.sandbox.getSandboxOrders` (`sandbox get-sandbox-orders`);
|
|
79
|
+
- `sandbox order show` -> `sdk.sandbox.getSandboxOrderState` (`sandbox get-sandbox-order-state`);
|
|
80
|
+
- `sandbox order place` -> `sdk.sandbox.postSandboxOrder` (`sandbox post-sandbox-order`);
|
|
81
|
+
- `sandbox order replace` -> `sdk.sandbox.replaceSandboxOrder` (`sandbox replace-sandbox-order`);
|
|
82
|
+
- `sandbox order cancel` -> `sdk.sandbox.cancelSandboxOrder` (`sandbox cancel-sandbox-order`);
|
|
83
|
+
- `sandbox position list` -> `sdk.sandbox.getSandboxPositions` (`sandbox get-sandbox-positions`);
|
|
84
|
+
- `sandbox operation list` -> `sdk.sandbox.getSandboxOperations` (`sandbox get-sandbox-operations`);
|
|
85
|
+
- `sandbox operation page` -> `sdk.sandbox.getSandboxOperationsByCursor` (`sandbox get-sandbox-operations-by-cursor`);
|
|
86
|
+
- `sandbox portfolio` -> `sdk.sandbox.getSandboxPortfolio` (`sandbox get-sandbox-portfolio`);
|
|
87
|
+
- `sandbox withdraw-limits` -> `sdk.sandbox.getSandboxWithdrawLimits` (`sandbox get-sandbox-withdraw-limits`);
|
|
88
|
+
- `sandbox pay-in` -> `sdk.sandbox.sandboxPayIn` (`sandbox sandbox-pay-in`);
|
|
161
89
|
- `stream run` -> поток выбирается в JSON config;
|
|
162
90
|
- `dev compile-proto` -> TypeScript contract generation (`compile-proto`).
|
|
163
91
|
- `help` -> встроенная справка по CLI, домену или команде;
|
|
164
92
|
- `version` -> версия пакета.
|
|
165
93
|
|
|
166
|
-
|
|
167
|
-
method и понятен CLI-контракт команды. Preferred path должен быть добавлен в
|
|
168
|
-
command definition и help, а technical/legacy aliases - только через единый
|
|
169
|
-
alias layer, который передает их в native command definition `icore`.
|
|
94
|
+
Добавляйте API-команды по одной, когда выбран конкретный SDK method и понятен CLI-контракт. Preferred path должен попасть в command definition и help, а technical/legacy aliases — только в единый alias layer, который передаёт их в native command definition `icore`.
|
|
170
95
|
|
|
171
96
|
## Отложенные расширения
|
|
172
97
|
|
|
173
|
-
|
|
174
|
-
отдельного проектирования и изменения документации.
|
|
98
|
+
Ниже перечислены возможности, которые не входят в текущий CLI-контракт и потребуют отдельного проектирования и обновления документации.
|
|
175
99
|
|
|
176
|
-
|
|
177
|
-
умолчанию требуют явный `--confirm` через
|
|
178
|
-
`defaultConfig.requireSideEffectConfirmation`. CLI не генерирует idempotency
|
|
179
|
-
keys автоматически:
|
|
180
|
-
`order place` принимает `--order-id`, а `order replace` принимает
|
|
181
|
-
`--idempotency-key`.
|
|
100
|
+
Действующие команды с side effects входят в текущий CLI-контракт и по умолчанию требуют явный `--confirm` через `defaultConfig.requireSideEffectConfirmation`. CLI не генерирует idempotency keys автоматически: `order place` принимает `--order-id`, а `order replace` — `--idempotency-key`.
|
|
182
101
|
|
|
183
|
-
`sandbox pay-in` принимает `--currency=rub|usd`.
|
|
184
|
-
значения отклоняются CLI parser-ом, а `--currency=usd` завершается ошибкой как
|
|
185
|
-
явно неподдержанный provider-кейс.
|
|
102
|
+
`sandbox pay-in` принимает `--currency=rub|usd`. CLI parser отклоняет неизвестные currency values, а для явно неподдержанного provider-кейса `--currency=usd` команда возвращает ошибку.
|
|
186
103
|
|
|
187
|
-
Stream API
|
|
188
|
-
`stream run --config=PATH`. CLI-контракт для долгоживущих подписок, завершения
|
|
189
|
-
процесса и формата событий описан в
|
|
190
|
-
[справочнике потокового CLI](../cli-stream-reference.md) и
|
|
191
|
-
[справочнике его конфигурации](../cli-stream-configuration.md).
|
|
104
|
+
Для Stream API есть отдельная utility-команда `stream run --config=PATH`. Контракт долгоживущих подписок, завершения процесса и формата событий описан в [справочнике потокового CLI](../cli-stream-reference.md) и [справочнике его конфигурации](../cli-stream-configuration.md).
|
|
192
105
|
|
|
193
|
-
|
|
194
|
-
request contract для bidirectional market data stream:
|
|
106
|
+
Сейчас CLI поддерживает server-side streams и статический initial request contract для bidirectional market data stream:
|
|
195
107
|
|
|
196
108
|
- `sdk.marketdataStream.marketDataStream`;
|
|
197
109
|
- `sdk.marketdataStream.marketDataServerSideStream`;
|
|
@@ -201,30 +113,25 @@ request contract для bidirectional market data stream:
|
|
|
201
113
|
|
|
202
114
|
Динамические bidirectional request sources остаются отложенным API-контрактом.
|
|
203
115
|
|
|
204
|
-
|
|
116
|
+
Публичный CLI не добавляет команды для deprecated generated methods:
|
|
205
117
|
|
|
206
|
-
- `sdk.instruments.options` - deprecated в generated contract; вместо него
|
|
207
|
-
используется `instrument option list` / `sdk.instruments.optionsBy`.
|
|
118
|
+
- `sdk.instruments.options` - deprecated в generated contract; вместо него используется `instrument option list` / `sdk.instruments.optionsBy`.
|
|
208
119
|
|
|
209
|
-
Перед расширением stream command
|
|
210
|
-
reference-документами и отдельно фиксировать любые изменения контракта.
|
|
120
|
+
Перед расширением stream command сверьте поведение с этими reference-документами и отдельно опишите любое изменение контракта.
|
|
211
121
|
|
|
212
|
-
|
|
122
|
+
В command flow участвуют несколько ответственностей:
|
|
213
123
|
|
|
214
124
|
1. runner и `icore` разбирают CLI args и валидируют primitive options по schema;
|
|
215
|
-
2. command handler выполняет API-specific validation и request mapping;
|
|
216
|
-
3.
|
|
125
|
+
2. command handler или его command-owned mapper выполняет API-specific validation и request mapping;
|
|
126
|
+
3. общий lifecycle helper создает `TInvestNodeSDK` для короткой команды;
|
|
217
127
|
4. command handler вызывает API method;
|
|
218
|
-
5. reporter преобразует unary response в stable report или stream event в
|
|
219
|
-
|
|
220
|
-
6. reporter выбирает command-specific output и использует generic render
|
|
221
|
-
primitives, когда они подходят;
|
|
128
|
+
5. reporter преобразует unary response в stable report или stream event в локальный контракт вывода команды;
|
|
129
|
+
6. reporter выбирает command-specific output и использует generic render primitives, когда они подходят;
|
|
222
130
|
7. terminal app получает готовую строку или stream для вывода.
|
|
223
131
|
|
|
224
|
-
Если
|
|
225
|
-
станет местом для любой логики вокруг CLI.
|
|
132
|
+
Если снова собрать эти обязанности в одном command handler, command layer быстро начнёт принимать любую логику вокруг CLI.
|
|
226
133
|
|
|
227
|
-
## Текущая
|
|
134
|
+
## Текущая структура
|
|
228
135
|
|
|
229
136
|
```text
|
|
230
137
|
src/bootstrap
|
|
@@ -237,12 +144,21 @@ src/bootstrap
|
|
|
237
144
|
cli/
|
|
238
145
|
contract.ts
|
|
239
146
|
error.ts
|
|
147
|
+
help-catalog.ts
|
|
240
148
|
help.ts
|
|
241
149
|
registry.ts
|
|
242
150
|
runner.ts
|
|
243
151
|
commands/
|
|
152
|
+
sdk-command-lifecycle.ts
|
|
244
153
|
<command-adapter>/
|
|
245
154
|
cli.ts
|
|
155
|
+
request.mapper.ts # когда mapping разделяют production и Sandbox
|
|
156
|
+
reporter.ts
|
|
157
|
+
stream-run/
|
|
158
|
+
cli.ts
|
|
159
|
+
config.ts
|
|
160
|
+
request.mapper.ts
|
|
161
|
+
stream-session.ts
|
|
246
162
|
reporter.ts
|
|
247
163
|
|
|
248
164
|
src/infrastructure
|
|
@@ -257,19 +173,16 @@ external dependency
|
|
|
257
173
|
TerminalApp/Output
|
|
258
174
|
```
|
|
259
175
|
|
|
260
|
-
`cli.ts`
|
|
176
|
+
`cli.ts` отвечает за:
|
|
261
177
|
|
|
262
|
-
- объявление command path, declarative option schema и handler-а через локальный
|
|
263
|
-
|
|
264
|
-
- mapping typed command options в generated request DTO;
|
|
178
|
+
- объявление command path, declarative option schema и handler-а через локальный command facade над `icore`;
|
|
179
|
+
- локальный request mapping или делегирование в `request.mapper.ts`, когда mapping разделяет несколько команд;
|
|
265
180
|
- API-specific validation, которая не выражается primitive schema;
|
|
266
|
-
-
|
|
181
|
+
- передачу короткого SDK lifecycle в `runSdkCommand()`;
|
|
267
182
|
- вызов API;
|
|
268
|
-
-
|
|
183
|
+
- выбор reporter-а для результата.
|
|
269
184
|
|
|
270
|
-
Логические CLI options используют синтаксис флагов `icore`: `--flag` и, если
|
|
271
|
-
команда поддерживает отрицательное переопределение, `--no-flag`. Формы со
|
|
272
|
-
значением `--flag=true` и `--flag=false` не входят в публичный CLI-контракт.
|
|
185
|
+
Логические CLI options используют синтаксис флагов `icore`: `--flag` и, если команда поддерживает отрицательное переопределение, `--no-flag`. Публичный CLI-контракт не принимает формы `--flag=true` и `--flag=false`.
|
|
273
186
|
|
|
274
187
|
Внутри command module нужно различать parsing и request mapping:
|
|
275
188
|
|
|
@@ -279,52 +192,37 @@ parse* -> typed primitive value -> project-specific value
|
|
|
279
192
|
create*Request -> typed command options -> generated request DTO
|
|
280
193
|
```
|
|
281
194
|
|
|
282
|
-
Command-local `parse*` helpers не должны повторно принимать raw option map:
|
|
283
|
-
format, enum и primitive schema validation принадлежат `icore`. Project-specific
|
|
284
|
-
helper допустим для преобразования отдельного typed значения, например
|
|
285
|
-
comma-separated списка. `create*Request` не принимает raw CLI args: он получает
|
|
286
|
-
typed options после `icore` и отвечает за generated request DTO shape и
|
|
287
|
-
request-level validation вроде date range или mutually exclusive modes.
|
|
195
|
+
Command-local `parse*` helpers не должны повторно принимать raw option map: `icore` отвечает за format, enum и primitive schema validation. Project-specific helper может преобразовать отдельное typed значение, например comma-separated список. `create*Request` получает не raw CLI args, а typed options после `icore`; он отвечает за форму generated request DTO и request-level validation, например date range или mutually exclusive modes.
|
|
288
196
|
|
|
289
|
-
`reporter.ts`
|
|
197
|
+
`reporter.ts` отвечает за:
|
|
290
198
|
|
|
291
|
-
- mapping unary response в application report или stream event в command-local
|
|
292
|
-
output contract;
|
|
199
|
+
- mapping unary response в application report или stream event в command-local output contract;
|
|
293
200
|
- выбор command-specific output contract;
|
|
294
201
|
- выбор полей, headers, порядка и подготовку значений для JSON/CSV/table output;
|
|
295
202
|
- вызов generic render primitives `icore`, когда они подходят формату.
|
|
296
203
|
|
|
297
|
-
`icore`
|
|
204
|
+
`icore` предоставляет:
|
|
298
205
|
|
|
299
206
|
- primitive option parsing, typed schema validation и command mechanics;
|
|
300
207
|
- технические детали JSON, plain-text table и CSV rendering;
|
|
301
|
-
- `TerminalApp`/`Output.write` для штатной записи готовой строки или stream в
|
|
302
|
-
stdout;
|
|
208
|
+
- `TerminalApp`/`Output.write` для штатной записи готовой строки или stream в stdout;
|
|
303
209
|
- `Output.error` для warnings/errors в stderr.
|
|
304
210
|
|
|
305
|
-
Project CLI layer собирает terminal app, объявляет native short aliases,
|
|
306
|
-
передает compatible command paths как first-class aliases canonical definitions,
|
|
307
|
-
обслуживает help/version shortcuts и warnings, а project error policy определяет
|
|
308
|
-
текст ошибки и exit code.
|
|
211
|
+
Project CLI layer собирает terminal app, объявляет native short aliases, передаёт compatibility paths как first-class aliases canonical definitions и обслуживает help/version shortcuts и warnings. Project error policy задаёт текст ошибки и exit code.
|
|
309
212
|
|
|
310
|
-
Директории внутри `bootstrap/commands/*`
|
|
311
|
-
adapter-модулей. Они не задают публичный CLI path: публичный контракт команды
|
|
312
|
-
фиксируется в `bootstrap/cli/registry.ts` и `bootstrap/cli/help.ts`.
|
|
213
|
+
Директории внутри `bootstrap/commands/*` носят компактные имена adapter-модулей и не задают публичный CLI path. Контракт команды находится в `bootstrap/cli/registry.ts`, а статические данные справки — в `bootstrap/cli/help-catalog.ts`.
|
|
313
214
|
|
|
314
|
-
## Что
|
|
215
|
+
## Что уже хорошо
|
|
315
216
|
|
|
316
|
-
- primitive option validation выражена `icore` schemas, а reusable
|
|
317
|
-
project-specific normalizers отделены в `bootstrap/args`;
|
|
217
|
+
- primitive option validation выражена `icore` schemas, а reusable project-specific normalizers отделены в `bootstrap/args`;
|
|
318
218
|
- raw CLI parsing отделен от typed generated request mapping;
|
|
319
|
-
- stable unary output shape вынесен в `application/reports`, а stream contract
|
|
320
|
-
|
|
321
|
-
- команды закрывают SDK в `finally`;
|
|
219
|
+
- stable unary output shape вынесен в `application/reports`, а stream contract зафиксирован отдельно;
|
|
220
|
+
- общий helper закрывает SDK коротких команд в `finally`, а stream session владеет собственным cleanup;
|
|
322
221
|
- formatting logic вынесена из `cli.ts`;
|
|
323
|
-
- JSON pretty-print, table alignment и CSV escaping не дублируются в command
|
|
324
|
-
reporter-ах;
|
|
222
|
+
- JSON pretty-print, table alignment и CSV escaping не дублируются в command reporter-ах;
|
|
325
223
|
- `stdout`/`stderr` delivery отделен от построения JSON/CSV/table.
|
|
326
224
|
|
|
327
|
-
## Текущая
|
|
225
|
+
## Текущая проблема
|
|
328
226
|
|
|
329
227
|
`bootstrap` по смыслу должен быть composition/entrypoint layer:
|
|
330
228
|
|
|
@@ -332,7 +230,7 @@ adapter-модулей. Они не задают публичный CLI path: п
|
|
|
332
230
|
parse entrypoint -> assemble dependencies -> call command -> return status/output
|
|
333
231
|
```
|
|
334
232
|
|
|
335
|
-
В `bootstrap`
|
|
233
|
+
В `bootstrap` остаётся command-specific presentation/adaptation logic:
|
|
336
234
|
|
|
337
235
|
```text
|
|
338
236
|
unary response -> stable report
|
|
@@ -340,17 +238,11 @@ stream event -> command-local output contract
|
|
|
340
238
|
report/event contract -> command-specific output values
|
|
341
239
|
```
|
|
342
240
|
|
|
343
|
-
Это осознанный компактный вариант, близкий к Inventory.
|
|
344
|
-
generic primitives начнут использоваться как место выбора полей, redaction,
|
|
345
|
-
normalization или версионирования output конкретной команды. Обратный риск -
|
|
346
|
-
дублировать JSON/CSV/table механику в reporter-ах или создавать локальные
|
|
347
|
-
forwarding wrappers над `icore` без собственного контракта.
|
|
241
|
+
Это осознанный компактный вариант, близкий к Inventory. Проблема возникнет, если generic primitives начнут выбирать поля, выполнять redaction или normalization либо версионировать output конкретной команды. Другая крайность — дублировать механику JSON/CSV/table в reporter-ах или создавать forwarding wrappers над `icore` без собственного контракта.
|
|
348
242
|
|
|
349
|
-
Подробные правила разделения command-specific formatting, generic render
|
|
350
|
-
primitives и stdout delivery описаны в
|
|
351
|
-
[Разделение форматирования и вывода в CLI](./cli-output-boundaries.md).
|
|
243
|
+
Подробные правила разделения command-specific formatting, generic render primitives и stdout delivery приведены в документе [«Разделение форматирования и вывода в CLI»](./cli-output-boundaries.md).
|
|
352
244
|
|
|
353
|
-
## Важное
|
|
245
|
+
## Важное разделение
|
|
354
246
|
|
|
355
247
|
Нужно различать три ответственности:
|
|
356
248
|
|
|
@@ -378,7 +270,7 @@ warnings/errors -> Output.error -> stderr
|
|
|
378
270
|
|
|
379
271
|
Output boundary не должен знать, как строить JSON, CSV или table.
|
|
380
272
|
|
|
381
|
-
## Принятое
|
|
273
|
+
## Принятое разделение
|
|
382
274
|
|
|
383
275
|
```text
|
|
384
276
|
src/bootstrap
|
|
@@ -409,21 +301,17 @@ external dependency
|
|
|
409
301
|
|
|
410
302
|
Граница:
|
|
411
303
|
|
|
412
|
-
- `bootstrap/commands/*/cli.ts` - command definition, API-specific
|
|
413
|
-
|
|
414
|
-
- `bootstrap/commands/*/reporter.ts` - provider result -> stable report или
|
|
415
|
-
локальный контракт события -> специализированный вывод CLI-команды;
|
|
304
|
+
- `bootstrap/commands/*/cli.ts` - command definition, API-specific orchestration и вызов общего SDK lifecycle;
|
|
305
|
+
- `bootstrap/commands/*/request.mapper.ts` - shared production/Sandbox request mapping там, где он действительно переиспользуется;
|
|
306
|
+
- `bootstrap/commands/*/reporter.ts` - provider result -> stable report или локальный контракт события -> специализированный вывод CLI-команды;
|
|
416
307
|
- public render primitives `icore` - механика JSON/CSV-row/table rendering;
|
|
417
|
-
- `icore` `TerminalApp`/`Output.write`, собранные в
|
|
418
|
-
`bootstrap/cli/runner.ts`, - штатная запись готовой строки или stream в
|
|
419
|
-
stdout;
|
|
308
|
+
- `icore` `TerminalApp`/`Output.write`, собранные в `bootstrap/cli/runner.ts`, - штатная запись готовой строки или stream в stdout;
|
|
420
309
|
- `icore` `Output.error` - warnings/errors в stderr;
|
|
421
310
|
- `application/reports/**` - стабильные контракты вывода unary-команд.
|
|
422
311
|
|
|
423
|
-
## Когда
|
|
312
|
+
## Когда нужен use-case
|
|
424
313
|
|
|
425
|
-
Текущие API-команды тонкие: они вызывают один SDK method и форматируют результат.
|
|
426
|
-
Для таких команд отдельный use-case не обязателен.
|
|
314
|
+
Текущие API-команды тонкие: они вызывают один SDK method и форматируют результат. Отдельный use-case им не нужен.
|
|
427
315
|
|
|
428
316
|
Use-case стоит выделять, если появляется хотя бы одно:
|
|
429
317
|
|
|
@@ -434,38 +322,31 @@ Use-case стоит выделять, если появляется хотя б
|
|
|
434
322
|
- reuse того же сценария вне CLI;
|
|
435
323
|
- тесты начинают мокать слишком много деталей SDK.
|
|
436
324
|
|
|
437
|
-
## Правило
|
|
325
|
+
## Правило для новых команд
|
|
438
326
|
|
|
439
327
|
- не добавлять новую formatting logic в `cli.ts`;
|
|
440
328
|
- держать command handler тонким;
|
|
441
|
-
- описывать stable unary output в `application/reports`, а специализированный
|
|
442
|
-
stream contract фиксировать отдельно;
|
|
329
|
+
- описывать stable unary output в `application/reports`, а специализированный stream contract фиксировать отдельно;
|
|
443
330
|
- держать command-specific output policy в `bootstrap/commands/*/reporter.ts`;
|
|
444
|
-
- использовать public render primitives `icore` только для общей механики
|
|
445
|
-
|
|
446
|
-
-
|
|
447
|
-
|
|
448
|
-
- регистрировать команду в `bootstrap/cli/registry.ts` в canonical форме
|
|
449
|
-
`<domain> <command>`;
|
|
450
|
-
- добавлять technical/legacy paths только через project alias inventory; registry
|
|
451
|
-
передаст их в `aliases` canonical definition;
|
|
331
|
+
- использовать public render primitives `icore` только для общей механики формата;
|
|
332
|
+
- возвращать normal result terminal app и не переносить JSON/CSV/table policy в output facade;
|
|
333
|
+
- регистрировать команду в `bootstrap/cli/registry.ts` в canonical форме `<domain> <command>`;
|
|
334
|
+
- добавлять technical/legacy paths только через project alias inventory; registry передаст их в `aliases` canonical definition;
|
|
452
335
|
- не добавлять short option aliases для API-команд;
|
|
453
|
-
- добавлять help metadata в `bootstrap/cli/help.ts`;
|
|
336
|
+
- добавлять help metadata в `bootstrap/cli/help-catalog.ts`;
|
|
454
337
|
- добавлять тесты рядом с конкретными файлами команды;
|
|
455
|
-
- не вводить общий command framework до появления реального повторения в
|
|
456
|
-
|
|
457
|
-
- сверять новые output-решения с
|
|
458
|
-
[Разделением форматирования и вывода в CLI](./cli-output-boundaries.md).
|
|
338
|
+
- не вводить общий command framework до появления реального повторения в нескольких командах;
|
|
339
|
+
- сверять новые output-решения с [Разделением форматирования и вывода в CLI](./cli-output-boundaries.md).
|
|
459
340
|
|
|
460
|
-
## Когда
|
|
341
|
+
## Когда обобщать commands
|
|
461
342
|
|
|
462
|
-
|
|
463
|
-
одинаковой ответственностью.
|
|
343
|
+
Обобщайте command lifecycle только после появления повторения с одинаковой ответственностью.
|
|
464
344
|
|
|
465
|
-
|
|
345
|
+
Каждая команда остаётся явной, а общий lifecycle коротких вызовов вынесен отдельно:
|
|
466
346
|
|
|
467
347
|
```text
|
|
468
348
|
bootstrap/commands/<command-adapter>/cli.ts
|
|
349
|
+
bootstrap/commands/sdk-command-lifecycle.ts
|
|
469
350
|
bootstrap/commands/<command-adapter>/reporter.ts
|
|
470
351
|
application/reports/<command-adapter>.report.ts
|
|
471
352
|
```
|
|
@@ -473,15 +354,12 @@ application/reports/<command-adapter>.report.ts
|
|
|
473
354
|
Допустимые причины для extract-а:
|
|
474
355
|
|
|
475
356
|
- один и тот же SDK lifecycle повторяется в 3+ API-командах;
|
|
476
|
-
- одинаковый parsing/validation pattern больше не выражается существующими
|
|
477
|
-
`icore` option schemas;
|
|
357
|
+
- одинаковый parsing/validation pattern больше не выражается существующими `icore` option schemas;
|
|
478
358
|
- tests начинают дублировать setup без изменения сценария;
|
|
479
|
-
- общий код получает понятную ответственность и не скрывает command-specific
|
|
480
|
-
различия.
|
|
359
|
+
- общий код получает понятную ответственность и не скрывает command-specific различия.
|
|
481
360
|
|
|
482
361
|
Недопустимые причины:
|
|
483
362
|
|
|
484
363
|
- будущий список команд неизвестен, поэтому хочется подготовить framework;
|
|
485
|
-
- две команды выглядят похожими внешне, но имеют разные request/report/output
|
|
486
|
-
правила;
|
|
364
|
+
- две команды выглядят похожими внешне, но имеют разные request/report/output правила;
|
|
487
365
|
- хочется сократить количество строк в `commands/*/cli.ts`.
|