@woodger/t-invest-node-sdk 0.5.2 → 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.
Files changed (227) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/{THIRD_PARTY_NOTICES.md → LICENSE-APACHE-2.0} +1 -106
  3. package/NOTICE +98 -0
  4. package/dist/application/services/unary-limiter.js +9 -9
  5. package/dist/bootstrap/args/sdk-options.d.ts +1 -2
  6. package/dist/bootstrap/cli/help-catalog.d.ts +733 -0
  7. package/dist/bootstrap/cli/help-catalog.js +1649 -0
  8. package/dist/bootstrap/cli/help.d.ts +2 -730
  9. package/dist/bootstrap/cli/help.js +5 -1647
  10. package/dist/bootstrap/cli/registry.d.ts +6 -6
  11. package/dist/bootstrap/commands/accounts/cli.d.ts +2 -3
  12. package/dist/bootstrap/commands/accounts/cli.js +5 -10
  13. package/dist/bootstrap/commands/accrued-interests/cli.d.ts +2 -3
  14. package/dist/bootstrap/commands/accrued-interests/cli.js +5 -10
  15. package/dist/bootstrap/commands/asset/cli.d.ts +2 -3
  16. package/dist/bootstrap/commands/asset/cli.js +5 -10
  17. package/dist/bootstrap/commands/assets/cli.d.ts +2 -3
  18. package/dist/bootstrap/commands/assets/cli.js +5 -10
  19. package/dist/bootstrap/commands/bond/cli.d.ts +2 -3
  20. package/dist/bootstrap/commands/bond/cli.js +5 -10
  21. package/dist/bootstrap/commands/bond-coupons/cli.d.ts +2 -3
  22. package/dist/bootstrap/commands/bond-coupons/cli.js +5 -10
  23. package/dist/bootstrap/commands/bonds/cli.d.ts +2 -3
  24. package/dist/bootstrap/commands/bonds/cli.js +5 -10
  25. package/dist/bootstrap/commands/brand/cli.d.ts +2 -3
  26. package/dist/bootstrap/commands/brand/cli.js +5 -10
  27. package/dist/bootstrap/commands/brands/cli.d.ts +2 -3
  28. package/dist/bootstrap/commands/brands/cli.js +5 -10
  29. package/dist/bootstrap/commands/broker-report/cli.d.ts +2 -3
  30. package/dist/bootstrap/commands/broker-report/cli.js +5 -10
  31. package/dist/bootstrap/commands/cancel-order/cli.d.ts +3 -39
  32. package/dist/bootstrap/commands/cancel-order/cli.js +8 -19
  33. package/dist/bootstrap/commands/cancel-order/request.mapper.d.ts +7 -0
  34. package/dist/bootstrap/commands/cancel-order/request.mapper.js +9 -0
  35. package/dist/bootstrap/commands/cancel-stop-order/cli.d.ts +3 -4
  36. package/dist/bootstrap/commands/cancel-stop-order/cli.js +6 -11
  37. package/dist/bootstrap/commands/candles/cli.d.ts +3 -4
  38. package/dist/bootstrap/commands/candles/cli.js +6 -11
  39. package/dist/bootstrap/commands/close-prices/cli.d.ts +3 -4
  40. package/dist/bootstrap/commands/close-prices/cli.js +6 -11
  41. package/dist/bootstrap/commands/countries/cli.d.ts +2 -3
  42. package/dist/bootstrap/commands/countries/cli.js +5 -10
  43. package/dist/bootstrap/commands/currencies/cli.d.ts +2 -3
  44. package/dist/bootstrap/commands/currencies/cli.js +5 -10
  45. package/dist/bootstrap/commands/currency/cli.d.ts +2 -3
  46. package/dist/bootstrap/commands/currency/cli.js +5 -10
  47. package/dist/bootstrap/commands/dividends/cli.d.ts +2 -3
  48. package/dist/bootstrap/commands/dividends/cli.js +5 -10
  49. package/dist/bootstrap/commands/dividends-foreign-issuer/cli.d.ts +2 -3
  50. package/dist/bootstrap/commands/dividends-foreign-issuer/cli.js +5 -10
  51. package/dist/bootstrap/commands/edit-favorites/cli.d.ts +2 -3
  52. package/dist/bootstrap/commands/edit-favorites/cli.js +5 -10
  53. package/dist/bootstrap/commands/etf/cli.d.ts +2 -3
  54. package/dist/bootstrap/commands/etf/cli.js +5 -10
  55. package/dist/bootstrap/commands/etfs/cli.d.ts +2 -3
  56. package/dist/bootstrap/commands/etfs/cli.js +5 -10
  57. package/dist/bootstrap/commands/favorites/cli.d.ts +2 -3
  58. package/dist/bootstrap/commands/favorites/cli.js +5 -10
  59. package/dist/bootstrap/commands/find-instrument/cli.d.ts +2 -3
  60. package/dist/bootstrap/commands/find-instrument/cli.js +5 -10
  61. package/dist/bootstrap/commands/future/cli.d.ts +2 -3
  62. package/dist/bootstrap/commands/future/cli.js +5 -10
  63. package/dist/bootstrap/commands/futures/cli.d.ts +2 -3
  64. package/dist/bootstrap/commands/futures/cli.js +5 -10
  65. package/dist/bootstrap/commands/futures-margin/cli.d.ts +2 -3
  66. package/dist/bootstrap/commands/futures-margin/cli.js +5 -10
  67. package/dist/bootstrap/commands/instrument/cli.d.ts +2 -3
  68. package/dist/bootstrap/commands/instrument/cli.js +5 -10
  69. package/dist/bootstrap/commands/last-prices/cli.d.ts +3 -4
  70. package/dist/bootstrap/commands/last-prices/cli.js +6 -11
  71. package/dist/bootstrap/commands/last-trades/cli.d.ts +3 -4
  72. package/dist/bootstrap/commands/last-trades/cli.js +6 -11
  73. package/dist/bootstrap/commands/margin-attributes/cli.d.ts +2 -3
  74. package/dist/bootstrap/commands/margin-attributes/cli.js +5 -10
  75. package/dist/bootstrap/commands/operations/cli.d.ts +5 -53
  76. package/dist/bootstrap/commands/operations/cli.js +9 -36
  77. package/dist/bootstrap/commands/operations/request.mapper.d.ts +23 -0
  78. package/dist/bootstrap/commands/operations/request.mapper.js +33 -0
  79. package/dist/bootstrap/commands/operations-by-cursor/cli.d.ts +5 -69
  80. package/dist/bootstrap/commands/operations-by-cursor/cli.js +9 -74
  81. package/dist/bootstrap/commands/operations-by-cursor/request.mapper.d.ts +28 -0
  82. package/dist/bootstrap/commands/operations-by-cursor/request.mapper.js +70 -0
  83. package/dist/bootstrap/commands/option/cli.d.ts +2 -3
  84. package/dist/bootstrap/commands/option/cli.js +5 -10
  85. package/dist/bootstrap/commands/options-by/cli.d.ts +2 -3
  86. package/dist/bootstrap/commands/options-by/cli.js +5 -10
  87. package/dist/bootstrap/commands/order-book/cli.d.ts +3 -4
  88. package/dist/bootstrap/commands/order-book/cli.js +6 -11
  89. package/dist/bootstrap/commands/order-state/cli.d.ts +3 -36
  90. package/dist/bootstrap/commands/order-state/cli.js +8 -21
  91. package/dist/bootstrap/commands/order-state/request.mapper.d.ts +13 -0
  92. package/dist/bootstrap/commands/order-state/request.mapper.js +17 -0
  93. package/dist/bootstrap/commands/orders/cli.d.ts +3 -32
  94. package/dist/bootstrap/commands/orders/cli.js +8 -18
  95. package/dist/bootstrap/commands/orders/request.mapper.d.ts +6 -0
  96. package/dist/bootstrap/commands/orders/request.mapper.js +8 -0
  97. package/dist/bootstrap/commands/portfolio/cli.d.ts +6 -40
  98. package/dist/bootstrap/commands/portfolio/cli.js +9 -26
  99. package/dist/bootstrap/commands/portfolio/request.mapper.d.ts +18 -0
  100. package/dist/bootstrap/commands/portfolio/request.mapper.js +21 -0
  101. package/dist/bootstrap/commands/positions/cli.d.ts +3 -32
  102. package/dist/bootstrap/commands/positions/cli.js +8 -18
  103. package/dist/bootstrap/commands/positions/request.mapper.d.ts +6 -0
  104. package/dist/bootstrap/commands/positions/request.mapper.js +8 -0
  105. package/dist/bootstrap/commands/post-order/cli.d.ts +8 -68
  106. package/dist/bootstrap/commands/post-order/cli.js +9 -39
  107. package/dist/bootstrap/commands/post-order/request.mapper.d.ts +27 -0
  108. package/dist/bootstrap/commands/post-order/request.mapper.js +35 -0
  109. package/dist/bootstrap/commands/post-stop-order/cli.d.ts +3 -4
  110. package/dist/bootstrap/commands/post-stop-order/cli.js +6 -11
  111. package/dist/bootstrap/commands/replace-order/cli.d.ts +5 -61
  112. package/dist/bootstrap/commands/replace-order/cli.js +9 -30
  113. package/dist/bootstrap/commands/replace-order/request.mapper.d.ts +22 -0
  114. package/dist/bootstrap/commands/replace-order/request.mapper.js +26 -0
  115. package/dist/bootstrap/commands/sandbox-accounts/cli.d.ts +2 -3
  116. package/dist/bootstrap/commands/sandbox-accounts/cli.js +5 -10
  117. package/dist/bootstrap/commands/sandbox-cancel-order/cli.d.ts +3 -4
  118. package/dist/bootstrap/commands/sandbox-cancel-order/cli.js +8 -13
  119. package/dist/bootstrap/commands/sandbox-close-account/cli.d.ts +2 -3
  120. package/dist/bootstrap/commands/sandbox-close-account/cli.js +5 -10
  121. package/dist/bootstrap/commands/sandbox-open-account/cli.d.ts +2 -3
  122. package/dist/bootstrap/commands/sandbox-open-account/cli.js +5 -10
  123. package/dist/bootstrap/commands/sandbox-operations/cli.d.ts +3 -4
  124. package/dist/bootstrap/commands/sandbox-operations/cli.js +8 -13
  125. package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.d.ts +3 -4
  126. package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.js +8 -13
  127. package/dist/bootstrap/commands/sandbox-order-state/cli.d.ts +3 -4
  128. package/dist/bootstrap/commands/sandbox-order-state/cli.js +8 -13
  129. package/dist/bootstrap/commands/sandbox-orders/cli.d.ts +3 -4
  130. package/dist/bootstrap/commands/sandbox-orders/cli.js +8 -13
  131. package/dist/bootstrap/commands/sandbox-pay-in/cli.d.ts +2 -3
  132. package/dist/bootstrap/commands/sandbox-pay-in/cli.js +5 -10
  133. package/dist/bootstrap/commands/sandbox-portfolio/cli.d.ts +3 -4
  134. package/dist/bootstrap/commands/sandbox-portfolio/cli.js +8 -13
  135. package/dist/bootstrap/commands/sandbox-positions/cli.d.ts +3 -4
  136. package/dist/bootstrap/commands/sandbox-positions/cli.js +8 -13
  137. package/dist/bootstrap/commands/sandbox-post-order/cli.d.ts +3 -4
  138. package/dist/bootstrap/commands/sandbox-post-order/cli.js +8 -13
  139. package/dist/bootstrap/commands/sandbox-replace-order/cli.d.ts +3 -4
  140. package/dist/bootstrap/commands/sandbox-replace-order/cli.js +8 -13
  141. package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.d.ts +3 -4
  142. package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.js +8 -13
  143. package/dist/bootstrap/commands/sdk-command-lifecycle.d.ts +15 -0
  144. package/dist/bootstrap/commands/sdk-command-lifecycle.js +21 -0
  145. package/dist/bootstrap/commands/share/cli.d.ts +2 -3
  146. package/dist/bootstrap/commands/share/cli.js +5 -10
  147. package/dist/bootstrap/commands/shares/cli.d.ts +2 -3
  148. package/dist/bootstrap/commands/shares/cli.js +5 -10
  149. package/dist/bootstrap/commands/stop-orders/cli.d.ts +3 -4
  150. package/dist/bootstrap/commands/stop-orders/cli.js +6 -11
  151. package/dist/bootstrap/commands/stream-run/cli.d.ts +2 -24
  152. package/dist/bootstrap/commands/stream-run/cli.js +7 -142
  153. package/dist/bootstrap/commands/stream-run/config.d.ts +7 -15
  154. package/dist/bootstrap/commands/stream-run/config.js +1 -101
  155. package/dist/bootstrap/commands/stream-run/request.mapper.d.ts +14 -0
  156. package/dist/bootstrap/commands/stream-run/request.mapper.js +111 -0
  157. package/dist/bootstrap/commands/stream-run/stream-session.d.ts +37 -0
  158. package/dist/bootstrap/commands/stream-run/stream-session.js +152 -0
  159. package/dist/bootstrap/commands/trading-schedules/cli.d.ts +2 -3
  160. package/dist/bootstrap/commands/trading-schedules/cli.js +5 -10
  161. package/dist/bootstrap/commands/trading-status/cli.d.ts +3 -4
  162. package/dist/bootstrap/commands/trading-status/cli.js +6 -11
  163. package/dist/bootstrap/commands/trading-statuses/cli.d.ts +3 -4
  164. package/dist/bootstrap/commands/trading-statuses/cli.js +6 -11
  165. package/dist/bootstrap/commands/user-info/cli.d.ts +2 -3
  166. package/dist/bootstrap/commands/user-info/cli.js +5 -10
  167. package/dist/bootstrap/commands/user-tariff/cli.d.ts +2 -3
  168. package/dist/bootstrap/commands/user-tariff/cli.js +5 -10
  169. package/dist/bootstrap/commands/withdraw-limits/cli.d.ts +3 -32
  170. package/dist/bootstrap/commands/withdraw-limits/cli.js +8 -18
  171. package/dist/bootstrap/commands/withdraw-limits/request.mapper.d.ts +6 -0
  172. package/dist/bootstrap/commands/withdraw-limits/request.mapper.js +8 -0
  173. package/dist/bootstrap/index.js +2 -2
  174. package/dist/bootstrap/proto/compile-proto.d.ts +1 -1
  175. package/dist/bootstrap/proto/compile-proto.js +28 -35
  176. package/dist/bootstrap/t-invest-node-sdk.d.ts +9 -9
  177. package/dist/bootstrap/t-invest-node-sdk.js +33 -18
  178. package/dist/bootstrap/unary-limit-config.js +4 -4
  179. package/dist/generated/common.js +1 -1
  180. package/dist/generated/google/api/field_behavior.js +1 -1
  181. package/dist/generated/google/protobuf/descriptor.js +1 -1
  182. package/dist/generated/google/protobuf/timestamp.js +1 -1
  183. package/dist/generated/instruments.js +1 -1
  184. package/dist/generated/marketdata.js +1 -1
  185. package/dist/generated/operations.js +1 -1
  186. package/dist/generated/orders.js +1 -1
  187. package/dist/generated/sandbox.js +1 -1
  188. package/dist/generated/signals.js +1 -1
  189. package/dist/generated/stoporders.js +1 -1
  190. package/dist/generated/users.js +1 -1
  191. package/dist/infrastructure/interceptor/warning-interceptor.d.ts +1 -1
  192. package/dist/infrastructure/interceptor/warning-interceptor.js +2 -2
  193. package/dist/infrastructure/transport/grpc/sdk-call-error.d.ts +12 -0
  194. package/dist/infrastructure/transport/grpc/sdk-call-error.js +180 -0
  195. package/dist/infrastructure/transport/grpc/sdk-client.d.ts +1 -1
  196. package/dist/infrastructure/transport/grpc/sdk-client.js +2 -2
  197. package/dist/infrastructure/transport/grpc/sdk-middleware.d.ts +1 -1
  198. package/dist/infrastructure/transport/grpc/sdk-middleware.js +8 -174
  199. package/dist/infrastructure/transport/grpc/unary-limit-resolver.d.ts +3 -1
  200. package/dist/infrastructure/transport/grpc/unary-limit-resolver.js +19 -18
  201. package/docs/architecture.md +44 -41
  202. package/docs/bundled-ca.md +12 -12
  203. package/docs/clean-architecture/adapters.md +15 -15
  204. package/docs/clean-architecture/api-commands.md +63 -52
  205. package/docs/clean-architecture/application.md +13 -13
  206. package/docs/clean-architecture/cli-output-boundaries.md +23 -23
  207. package/docs/clean-architecture/dto.md +9 -9
  208. package/docs/clean-architecture/index.md +13 -12
  209. package/docs/cli-stream-configuration.md +9 -9
  210. package/docs/cli-stream-reference.md +11 -11
  211. package/docs/guides/custom-unary-limiter.md +30 -30
  212. package/docs/guides/errors-and-lifecycle.md +10 -10
  213. package/docs/guides/getting-started.md +9 -9
  214. package/docs/guides/index.md +3 -3
  215. package/docs/guides/streams-and-cancellation.md +6 -6
  216. package/docs/guides/testing-with-service-definitions.md +4 -4
  217. package/docs/guides/unary-calls.md +8 -8
  218. package/docs/index.md +9 -9
  219. package/docs/limits-policy.md +10 -10
  220. package/docs/roadmap.md +12 -12
  221. package/docs/tls-policy.md +7 -7
  222. package/package.json +2 -1
  223. package/readme.md +42 -41
  224. package/dist/infrastructure/interceptor/index.d.ts +0 -1
  225. package/dist/infrastructure/interceptor/index.js +0 -17
  226. /package/dist/infrastructure/transport/grpc/{unary-limits.d.ts → unary-method-path.d.ts} +0 -0
  227. /package/dist/infrastructure/transport/grpc/{unary-limits.js → unary-method-path.js} +0 -0
@@ -4,7 +4,7 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
@@ -12,7 +12,6 @@ import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import type { BrokerReportRequest, BrokerReportResponse } from '../../../generated/operations';
13
13
  import { type InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatBrokerReport } from './reporter';
16
15
  type BrokerReportSdk = {
17
16
  operations: {
18
17
  getBrokerReport(request: BrokerReportRequest): Promise<BrokerReportResponse>;
@@ -129,4 +128,4 @@ export declare const brokerReportCommand: Omit<import("icore").CommandDefinition
129
128
  }, undefined, string, readonly ["operation", "broker-report"], undefined, void, readonly []>, "metadata"> & {
130
129
  metadata?: undefined;
131
130
  };
132
- export { formatBrokerReport };
131
+ export {};
@@ -5,21 +5,20 @@
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
7
  * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatBrokerReport = exports.brokerReportCommand = void 0;
13
+ exports.brokerReportCommand = void 0;
14
14
  exports.createBrokerReportRequest = createBrokerReportRequest;
15
15
  exports.createBrokerReportCommand = createBrokerReportCommand;
16
16
  const icore_1 = require("icore");
17
17
  const contract_1 = require("../../cli/contract");
18
- const args_1 = require("../../args");
18
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
19
19
  const command_options_1 = require("../../args/command-options");
20
20
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
21
21
  const reporter_1 = require("./reporter");
22
- Object.defineProperty(exports, "formatBrokerReport", { enumerable: true, get: function () { return reporter_1.formatBrokerReport; } });
23
22
  const brokerReportCommandPath = ['operation', 'broker-report'];
24
23
  const defaultBrokerReportSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
25
24
  const brokerReportRequestOptionsSchema = {
@@ -94,12 +93,8 @@ exports.brokerReportCommand = createBrokerReportCommand();
94
93
  async function runBrokerReportCommand(options, createSdk) {
95
94
  const request = createBrokerReportRequest(options);
96
95
  const { format } = options;
97
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
98
- try {
96
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
99
97
  const response = await sdk.operations.getBrokerReport(request);
100
98
  return (0, reporter_1.formatBrokerReport)(response, format);
101
- }
102
- finally {
103
- sdk.close();
104
- }
99
+ });
105
100
  }
@@ -3,16 +3,13 @@
3
3
  *
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
- * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
6
+ * - делегирование request mapping в command-owned mapper;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
11
11
  import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import type { CancelOrderRequest, CancelOrderResponse } from '../../../generated/orders';
13
- import type { InferOptions } from 'icore';
14
- import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatCancelOrder } from './reporter';
16
13
  type CancelOrderSdk = {
17
14
  orders: {
18
15
  cancelOrder(request: CancelOrderRequest): Promise<CancelOrderResponse>;
@@ -20,38 +17,6 @@ type CancelOrderSdk = {
20
17
  close(): void;
21
18
  };
22
19
  type CancelOrderSdkFactory = (options: TInvestOptions) => CancelOrderSdk;
23
- declare const cancelOrderOptionsSchema: {
24
- readonly token: {
25
- readonly type: 'string';
26
- };
27
- readonly endpoint: {
28
- readonly type: 'string';
29
- };
30
- readonly 'app-name': {
31
- readonly type: 'string';
32
- };
33
- readonly insecure: {
34
- readonly type: 'boolean';
35
- };
36
- readonly confirm: {
37
- readonly type: 'boolean';
38
- };
39
- readonly 'account-id': {
40
- readonly type: 'string';
41
- readonly required: true;
42
- };
43
- readonly 'order-id': {
44
- readonly type: 'string';
45
- readonly required: true;
46
- };
47
- readonly format: {
48
- readonly type: 'string';
49
- readonly choices: readonly ["json", "table"];
50
- readonly default: 'table';
51
- };
52
- };
53
- type CancelOrderOptions = InferOptions<typeof cancelOrderOptionsSchema>;
54
- type CancelOrderRequestOptions = CommandRequestOptions<CancelOrderOptions, 'account-id' | 'order-id'>;
55
20
  export declare function createCancelOrderCommand(createSdk?: CancelOrderSdkFactory): Omit<import("icore").CommandDefinition<{
56
21
  readonly token: {
57
22
  readonly type: 'string';
@@ -116,5 +81,4 @@ export declare const cancelOrderCommand: Omit<import("icore").CommandDefinition<
116
81
  }, undefined, string, readonly ["order", "cancel"], undefined, void, readonly []>, "metadata"> & {
117
82
  metadata?: undefined;
118
83
  };
119
- export { formatCancelOrder };
120
- export declare function createCancelOrderRequest(options: CancelOrderRequestOptions): CancelOrderRequest;
84
+ export {};
@@ -4,22 +4,21 @@
4
4
  *
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
- * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - делегирование request mapping в command-owned mapper;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatCancelOrder = exports.cancelOrderCommand = void 0;
13
+ exports.cancelOrderCommand = void 0;
14
14
  exports.createCancelOrderCommand = createCancelOrderCommand;
15
- exports.createCancelOrderRequest = createCancelOrderRequest;
16
15
  const contract_1 = require("../../cli/contract");
17
- const args_1 = require("../../args");
16
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
18
17
  const command_options_1 = require("../../args/command-options");
19
18
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
20
19
  const side_effect_args_1 = require("../../args/side-effect-args");
21
20
  const reporter_1 = require("./reporter");
22
- Object.defineProperty(exports, "formatCancelOrder", { enumerable: true, get: function () { return reporter_1.formatCancelOrder; } });
21
+ const request_mapper_1 = require("./request.mapper");
23
22
  const cancelOrderCommandPath = ['order', 'cancel'];
24
23
  const defaultCancelOrderSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
25
24
  const cancelOrderRequestOptionsSchema = {
@@ -52,20 +51,10 @@ function createCancelOrderCommand(createSdk = defaultCancelOrderSdkFactory) {
52
51
  exports.cancelOrderCommand = createCancelOrderCommand();
53
52
  async function runCancelOrderCommand(options, createSdk) {
54
53
  (0, side_effect_args_1.assertSideEffectConfirmed)(options.confirm);
55
- const request = createCancelOrderRequest(options);
54
+ const request = (0, request_mapper_1.createCancelOrderRequest)(options);
56
55
  const { format } = options;
57
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
58
- try {
56
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
59
57
  const response = await sdk.orders.cancelOrder(request);
60
58
  return (0, reporter_1.formatCancelOrder)(response, format);
61
- }
62
- finally {
63
- sdk.close();
64
- }
65
- }
66
- function createCancelOrderRequest(options) {
67
- return {
68
- accountId: options['account-id'],
69
- orderId: options['order-id']
70
- };
59
+ });
71
60
  }
@@ -0,0 +1,7 @@
1
+ import type { CancelOrderRequest } from '../../../generated/orders';
2
+ interface CancelOrderRequestOptions {
3
+ readonly 'account-id': string;
4
+ readonly 'order-id': string;
5
+ }
6
+ export declare function createCancelOrderRequest(options: CancelOrderRequestOptions): CancelOrderRequest;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCancelOrderRequest = createCancelOrderRequest;
4
+ function createCancelOrderRequest(options) {
5
+ return {
6
+ accountId: options['account-id'],
7
+ orderId: options['order-id']
8
+ };
9
+ }
@@ -4,7 +4,7 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
@@ -12,9 +12,8 @@ import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import type { CancelStopOrderRequest, CancelStopOrderResponse } from '../../../generated/stoporders';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatCancelStopOrder } from './reporter';
16
15
  type CancelStopOrderSdk = {
17
- stoporders: {
16
+ stopOrders: {
18
17
  cancelStopOrder(request: CancelStopOrderRequest): Promise<CancelStopOrderResponse>;
19
18
  };
20
19
  close(): void;
@@ -116,5 +115,5 @@ export declare const cancelStopOrderCommand: Omit<import("icore").CommandDefinit
116
115
  }, undefined, string, readonly ["stop-order", "cancel"], undefined, void, readonly []>, "metadata"> & {
117
116
  metadata?: undefined;
118
117
  };
119
- export { formatCancelStopOrder };
120
118
  export declare function createCancelStopOrderRequest(options: CancelStopOrderRequestOptions): CancelStopOrderRequest;
119
+ export {};
@@ -5,21 +5,20 @@
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
7
  * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatCancelStopOrder = exports.cancelStopOrderCommand = void 0;
13
+ exports.cancelStopOrderCommand = void 0;
14
14
  exports.createCancelStopOrderCommand = createCancelStopOrderCommand;
15
15
  exports.createCancelStopOrderRequest = createCancelStopOrderRequest;
16
16
  const contract_1 = require("../../cli/contract");
17
- const args_1 = require("../../args");
17
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
18
18
  const command_options_1 = require("../../args/command-options");
19
19
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
20
20
  const side_effect_args_1 = require("../../args/side-effect-args");
21
21
  const reporter_1 = require("./reporter");
22
- Object.defineProperty(exports, "formatCancelStopOrder", { enumerable: true, get: function () { return reporter_1.formatCancelStopOrder; } });
23
22
  const cancelStopOrderCommandPath = ['stop-order', 'cancel'];
24
23
  const defaultCancelStopOrderSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
25
24
  const cancelStopOrderRequestOptionsSchema = {
@@ -54,14 +53,10 @@ async function runCancelStopOrderCommand(options, createSdk) {
54
53
  (0, side_effect_args_1.assertSideEffectConfirmed)(options.confirm);
55
54
  const request = createCancelStopOrderRequest(options);
56
55
  const { format } = options;
57
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
58
- try {
59
- const response = await sdk.stoporders.cancelStopOrder(request);
56
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
57
+ const response = await sdk.stopOrders.cancelStopOrder(request);
60
58
  return (0, reporter_1.formatCancelStopOrder)(response, format);
61
- }
62
- finally {
63
- sdk.close();
64
- }
59
+ });
65
60
  }
66
61
  function createCancelStopOrderRequest(options) {
67
62
  return {
@@ -4,7 +4,7 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
@@ -12,9 +12,8 @@ import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import { GetCandlesRequest, type GetCandlesResponse } from '../../../generated/marketdata';
13
13
  import { type InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatCandles } from './reporter';
16
15
  type CandlesSdk = {
17
- marketdata: {
16
+ marketData: {
18
17
  getCandles(request: GetCandlesRequest): Promise<GetCandlesResponse>;
19
18
  };
20
19
  close(): void;
@@ -134,5 +133,5 @@ export declare const candlesCommand: Omit<import("icore").CommandDefinition<{
134
133
  }, undefined, string, readonly ["market", "candles"], undefined, void, readonly []>, "metadata"> & {
135
134
  metadata?: undefined;
136
135
  };
137
- export { formatCandles };
138
136
  export declare function createCandlesRequest(options: CandlesRequestOptions): GetCandlesRequest;
137
+ export {};
@@ -5,22 +5,21 @@
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
7
  * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatCandles = exports.candlesCommand = void 0;
13
+ exports.candlesCommand = void 0;
14
14
  exports.createCandlesCommand = createCandlesCommand;
15
15
  exports.createCandlesRequest = createCandlesRequest;
16
16
  const marketdata_1 = require("../../../generated/marketdata");
17
17
  const icore_1 = require("icore");
18
18
  const contract_1 = require("../../cli/contract");
19
- const args_1 = require("../../args");
19
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
20
20
  const command_options_1 = require("../../args/command-options");
21
21
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
22
22
  const reporter_1 = require("./reporter");
23
- Object.defineProperty(exports, "formatCandles", { enumerable: true, get: function () { return reporter_1.formatCandles; } });
24
23
  const candlesCommandPath = ['market', 'candles'];
25
24
  const defaultCandlesSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
26
25
  const candleIntervals = {
@@ -80,14 +79,10 @@ exports.candlesCommand = createCandlesCommand();
80
79
  async function runCandlesCommand(options, createSdk) {
81
80
  const request = createCandlesRequest(options);
82
81
  const { format } = options;
83
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
84
- try {
85
- const response = await sdk.marketdata.getCandles(request);
82
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
83
+ const response = await sdk.marketData.getCandles(request);
86
84
  return (0, reporter_1.formatCandles)(response.candles, format);
87
- }
88
- finally {
89
- sdk.close();
90
- }
85
+ });
91
86
  }
92
87
  function createCandlesRequest(options) {
93
88
  const from = (0, command_options_1.parseDateTimeOption)(options.from, 'from');
@@ -4,7 +4,7 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
@@ -12,9 +12,8 @@ import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import type { GetClosePricesRequest, GetClosePricesResponse } from '../../../generated/marketdata';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatClosePrices } from './reporter';
16
15
  type ClosePricesSdk = {
17
- marketdata: {
16
+ marketData: {
18
17
  getClosePrices(request: GetClosePricesRequest): Promise<GetClosePricesResponse>;
19
18
  };
20
19
  close(): void;
@@ -95,5 +94,5 @@ export declare const closePricesCommand: Omit<import("icore").CommandDefinition<
95
94
  }, undefined, string, readonly ["market", "close-prices"], undefined, void, readonly []>, "metadata"> & {
96
95
  metadata?: undefined;
97
96
  };
98
- export { formatClosePrices };
99
97
  export declare function createClosePricesRequest(options: ClosePricesRequestOptions): GetClosePricesRequest;
98
+ export {};
@@ -5,20 +5,19 @@
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
7
  * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatClosePrices = exports.closePricesCommand = void 0;
13
+ exports.closePricesCommand = void 0;
14
14
  exports.createClosePricesCommand = createClosePricesCommand;
15
15
  exports.createClosePricesRequest = createClosePricesRequest;
16
16
  const contract_1 = require("../../cli/contract");
17
- const args_1 = require("../../args");
17
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
18
18
  const command_options_1 = require("../../args/command-options");
19
19
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
20
20
  const reporter_1 = require("./reporter");
21
- Object.defineProperty(exports, "formatClosePrices", { enumerable: true, get: function () { return reporter_1.formatClosePrices; } });
22
21
  const closePricesCommandPath = ['market', 'close-prices'];
23
22
  const defaultClosePricesSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const closePricesInstrumentIdsOptionsSchema = {
@@ -48,14 +47,10 @@ exports.closePricesCommand = createClosePricesCommand();
48
47
  async function runClosePricesCommand(options, createSdk) {
49
48
  const request = createClosePricesRequest(options);
50
49
  const { format } = options;
51
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
52
- try {
53
- const response = await sdk.marketdata.getClosePrices(request);
50
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
51
+ const response = await sdk.marketData.getClosePrices(request);
54
52
  return (0, reporter_1.formatClosePrices)(response.closePrices, format);
55
- }
56
- finally {
57
- sdk.close();
58
- }
53
+ });
59
54
  }
60
55
  function createClosePricesRequest(options) {
61
56
  return {
@@ -4,13 +4,12 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
11
11
  import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import type { GetCountriesRequest, GetCountriesResponse } from '../../../generated/instruments';
13
- import { formatCountries } from './reporter';
14
13
  type CountriesSdk = {
15
14
  instruments: {
16
15
  getCountries(request: GetCountriesRequest): Promise<GetCountriesResponse>;
@@ -60,4 +59,4 @@ export declare const countriesCommand: Omit<import("icore").CommandDefinition<{
60
59
  }, undefined, string, readonly ["instrument", "country", "list"], undefined, void, readonly []>, "metadata"> & {
61
60
  metadata?: undefined;
62
61
  };
63
- export { formatCountries };
62
+ export {};
@@ -5,19 +5,18 @@
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
7
  * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatCountries = exports.countriesCommand = void 0;
13
+ exports.countriesCommand = void 0;
14
14
  exports.createCountriesCommand = createCountriesCommand;
15
15
  const contract_1 = require("../../cli/contract");
16
- const args_1 = require("../../args");
16
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
17
17
  const command_options_1 = require("../../args/command-options");
18
18
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
19
19
  const reporter_1 = require("./reporter");
20
- Object.defineProperty(exports, "formatCountries", { enumerable: true, get: function () { return reporter_1.formatCountries; } });
21
20
  const countriesCommandPath = ['instrument', 'country', 'list'];
22
21
  const defaultCountriesSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
23
22
  const countriesOptionsSchema = (0, command_options_1.withSdkOptions)({
@@ -39,12 +38,8 @@ function createCountriesCommand(createSdk = defaultCountriesSdkFactory) {
39
38
  exports.countriesCommand = createCountriesCommand();
40
39
  async function runCountriesCommand(options, createSdk) {
41
40
  const { format } = options;
42
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
43
- try {
41
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
44
42
  const response = await sdk.instruments.getCountries({});
45
43
  return (0, reporter_1.formatCountries)(response.countries, format);
46
- }
47
- finally {
48
- sdk.close();
49
- }
44
+ });
50
45
  }
@@ -4,13 +4,12 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
11
11
  import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import { type CurrenciesResponse, type InstrumentsRequest } from '../../../generated/instruments';
13
- import { formatCurrencies } from './reporter';
14
13
  type CurrenciesSdk = {
15
14
  instruments: {
16
15
  currencies(request: InstrumentsRequest): Promise<CurrenciesResponse>;
@@ -70,4 +69,4 @@ export declare const currenciesCommand: Omit<import("icore").CommandDefinition<{
70
69
  }, undefined, string, readonly ["instrument", "currency", "list"], undefined, void, readonly []>, "metadata"> & {
71
70
  metadata?: undefined;
72
71
  };
73
- export { formatCurrencies };
72
+ export {};
@@ -5,20 +5,19 @@
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
7
  * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatCurrencies = exports.currenciesCommand = void 0;
13
+ exports.currenciesCommand = void 0;
14
14
  exports.createCurrenciesCommand = createCurrenciesCommand;
15
15
  const contract_1 = require("../../cli/contract");
16
- const args_1 = require("../../args");
16
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
17
17
  const command_options_1 = require("../../args/command-options");
18
18
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
19
19
  const instruments_args_1 = require("../../args/instruments-args");
20
20
  const reporter_1 = require("./reporter");
21
- Object.defineProperty(exports, "formatCurrencies", { enumerable: true, get: function () { return reporter_1.formatCurrencies; } });
22
21
  const currenciesCommandPath = ['instrument', 'currency', 'list'];
23
22
  const defaultCurrenciesSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const currenciesFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.currenciesCommand = createCurrenciesCommand();
42
41
  async function runCurrenciesCommand(options, createSdk) {
43
42
  const { format } = options;
44
43
  const request = (0, instruments_args_1.createInstrumentsRequestFromOptions)(options);
45
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
46
- try {
44
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
47
45
  const response = await sdk.instruments.currencies(request);
48
46
  return (0, reporter_1.formatCurrencies)(response.instruments, format);
49
- }
50
- finally {
51
- sdk.close();
52
- }
47
+ });
53
48
  }
@@ -4,13 +4,12 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
11
11
  import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import { type CurrencyResponse, type InstrumentRequest } from '../../../generated/instruments';
13
- import { formatCurrency } from './reporter';
14
13
  type CurrencySdk = {
15
14
  instruments: {
16
15
  currencyBy(request: InstrumentRequest): Promise<CurrencyResponse>;
@@ -80,4 +79,4 @@ export declare const currencyCommand: Omit<import("icore").CommandDefinition<{
80
79
  }, undefined, string, readonly ["instrument", "currency", "show"], undefined, void, readonly []>, "metadata"> & {
81
80
  metadata?: undefined;
82
81
  };
83
- export { formatCurrency };
82
+ export {};
@@ -5,20 +5,19 @@
5
5
  * Здесь допустимы:
6
6
  * - объявление command path и option schema;
7
7
  * - преобразование CLI options в generated request;
8
- * - создание SDK через bootstrap factory и закрытие SDK resource;
8
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
9
9
  *
10
10
  * Здесь не должно быть ручного table/json rendering или application report contracts.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.formatCurrency = exports.currencyCommand = void 0;
13
+ exports.currencyCommand = void 0;
14
14
  exports.createCurrencyCommand = createCurrencyCommand;
15
15
  const contract_1 = require("../../cli/contract");
16
- const args_1 = require("../../args");
16
+ const sdk_command_lifecycle_1 = require("../sdk-command-lifecycle");
17
17
  const command_options_1 = require("../../args/command-options");
18
18
  const t_invest_node_sdk_1 = require("../../t-invest-node-sdk");
19
19
  const instruments_args_1 = require("../../args/instruments-args");
20
20
  const reporter_1 = require("./reporter");
21
- Object.defineProperty(exports, "formatCurrency", { enumerable: true, get: function () { return reporter_1.formatCurrency; } });
22
21
  const currencyCommandPath = ['instrument', 'currency', 'show'];
23
22
  const defaultCurrencySdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const currencyFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.currencyCommand = createCurrencyCommand();
42
41
  async function runCurrencyCommand(options, createSdk) {
43
42
  const { format } = options;
44
43
  const request = (0, instruments_args_1.createInstrumentLookupRequestFromOptions)(options);
45
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
46
- try {
44
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
47
45
  const response = await sdk.instruments.currencyBy(request);
48
46
  return (0, reporter_1.formatCurrency)(response, format);
49
- }
50
- finally {
51
- sdk.close();
52
- }
47
+ });
53
48
  }
@@ -4,7 +4,7 @@
4
4
  * Здесь допустимы:
5
5
  * - объявление command path и option schema;
6
6
  * - преобразование CLI options в generated request;
7
- * - создание SDK через bootstrap factory и закрытие SDK resource;
7
+ * - выполнение короткого SDK lifecycle через общий bootstrap helper;
8
8
  *
9
9
  * Здесь не должно быть ручного table/json rendering или application report contracts.
10
10
  */
@@ -12,7 +12,6 @@ import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import { GetDividendsRequest, type GetDividendsResponse } from '../../../generated/instruments';
13
13
  import { type InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatDividends } from './reporter';
16
15
  type DividendsSdk = {
17
16
  instruments: {
18
17
  getDividends(request: GetDividendsRequest): Promise<GetDividendsResponse>;
@@ -125,5 +124,5 @@ export declare const dividendsCommand: Omit<import("icore").CommandDefinition<{
125
124
  }, undefined, string, readonly ["instrument", "dividends"], undefined, void, readonly []>, "metadata"> & {
126
125
  metadata?: undefined;
127
126
  };
128
- export { formatDividends };
129
127
  export declare function createDividendsRequest(options: DividendsRequestOptions): GetDividendsRequest;
128
+ export {};