@woodger/t-invest-node-sdk 0.5.2 → 0.5.4

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 (229) hide show
  1. package/CHANGELOG.md +30 -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.d.ts +10 -1
  5. package/dist/application/services/unary-limiter.js +35 -11
  6. package/dist/bootstrap/args/sdk-options.d.ts +1 -2
  7. package/dist/bootstrap/cli/help-catalog.d.ts +733 -0
  8. package/dist/bootstrap/cli/help-catalog.js +1649 -0
  9. package/dist/bootstrap/cli/help.d.ts +2 -730
  10. package/dist/bootstrap/cli/help.js +5 -1647
  11. package/dist/bootstrap/cli/registry.d.ts +6 -6
  12. package/dist/bootstrap/commands/accounts/cli.d.ts +2 -3
  13. package/dist/bootstrap/commands/accounts/cli.js +5 -10
  14. package/dist/bootstrap/commands/accrued-interests/cli.d.ts +2 -3
  15. package/dist/bootstrap/commands/accrued-interests/cli.js +5 -10
  16. package/dist/bootstrap/commands/asset/cli.d.ts +2 -3
  17. package/dist/bootstrap/commands/asset/cli.js +5 -10
  18. package/dist/bootstrap/commands/assets/cli.d.ts +2 -3
  19. package/dist/bootstrap/commands/assets/cli.js +5 -10
  20. package/dist/bootstrap/commands/bond/cli.d.ts +2 -3
  21. package/dist/bootstrap/commands/bond/cli.js +5 -10
  22. package/dist/bootstrap/commands/bond-coupons/cli.d.ts +2 -3
  23. package/dist/bootstrap/commands/bond-coupons/cli.js +5 -10
  24. package/dist/bootstrap/commands/bonds/cli.d.ts +2 -3
  25. package/dist/bootstrap/commands/bonds/cli.js +5 -10
  26. package/dist/bootstrap/commands/brand/cli.d.ts +2 -3
  27. package/dist/bootstrap/commands/brand/cli.js +5 -10
  28. package/dist/bootstrap/commands/brands/cli.d.ts +2 -3
  29. package/dist/bootstrap/commands/brands/cli.js +5 -10
  30. package/dist/bootstrap/commands/broker-report/cli.d.ts +2 -3
  31. package/dist/bootstrap/commands/broker-report/cli.js +5 -10
  32. package/dist/bootstrap/commands/cancel-order/cli.d.ts +3 -39
  33. package/dist/bootstrap/commands/cancel-order/cli.js +8 -19
  34. package/dist/bootstrap/commands/cancel-order/request.mapper.d.ts +7 -0
  35. package/dist/bootstrap/commands/cancel-order/request.mapper.js +9 -0
  36. package/dist/bootstrap/commands/cancel-stop-order/cli.d.ts +3 -4
  37. package/dist/bootstrap/commands/cancel-stop-order/cli.js +6 -11
  38. package/dist/bootstrap/commands/candles/cli.d.ts +3 -4
  39. package/dist/bootstrap/commands/candles/cli.js +6 -11
  40. package/dist/bootstrap/commands/close-prices/cli.d.ts +3 -4
  41. package/dist/bootstrap/commands/close-prices/cli.js +6 -11
  42. package/dist/bootstrap/commands/countries/cli.d.ts +2 -3
  43. package/dist/bootstrap/commands/countries/cli.js +5 -10
  44. package/dist/bootstrap/commands/currencies/cli.d.ts +2 -3
  45. package/dist/bootstrap/commands/currencies/cli.js +5 -10
  46. package/dist/bootstrap/commands/currency/cli.d.ts +2 -3
  47. package/dist/bootstrap/commands/currency/cli.js +5 -10
  48. package/dist/bootstrap/commands/dividends/cli.d.ts +2 -3
  49. package/dist/bootstrap/commands/dividends/cli.js +5 -10
  50. package/dist/bootstrap/commands/dividends-foreign-issuer/cli.d.ts +2 -3
  51. package/dist/bootstrap/commands/dividends-foreign-issuer/cli.js +5 -10
  52. package/dist/bootstrap/commands/edit-favorites/cli.d.ts +2 -3
  53. package/dist/bootstrap/commands/edit-favorites/cli.js +5 -10
  54. package/dist/bootstrap/commands/etf/cli.d.ts +2 -3
  55. package/dist/bootstrap/commands/etf/cli.js +5 -10
  56. package/dist/bootstrap/commands/etfs/cli.d.ts +2 -3
  57. package/dist/bootstrap/commands/etfs/cli.js +5 -10
  58. package/dist/bootstrap/commands/favorites/cli.d.ts +2 -3
  59. package/dist/bootstrap/commands/favorites/cli.js +5 -10
  60. package/dist/bootstrap/commands/find-instrument/cli.d.ts +2 -3
  61. package/dist/bootstrap/commands/find-instrument/cli.js +5 -10
  62. package/dist/bootstrap/commands/future/cli.d.ts +2 -3
  63. package/dist/bootstrap/commands/future/cli.js +5 -10
  64. package/dist/bootstrap/commands/futures/cli.d.ts +2 -3
  65. package/dist/bootstrap/commands/futures/cli.js +5 -10
  66. package/dist/bootstrap/commands/futures-margin/cli.d.ts +2 -3
  67. package/dist/bootstrap/commands/futures-margin/cli.js +5 -10
  68. package/dist/bootstrap/commands/instrument/cli.d.ts +2 -3
  69. package/dist/bootstrap/commands/instrument/cli.js +5 -10
  70. package/dist/bootstrap/commands/last-prices/cli.d.ts +3 -4
  71. package/dist/bootstrap/commands/last-prices/cli.js +6 -11
  72. package/dist/bootstrap/commands/last-trades/cli.d.ts +3 -4
  73. package/dist/bootstrap/commands/last-trades/cli.js +6 -11
  74. package/dist/bootstrap/commands/margin-attributes/cli.d.ts +2 -3
  75. package/dist/bootstrap/commands/margin-attributes/cli.js +5 -10
  76. package/dist/bootstrap/commands/operations/cli.d.ts +5 -53
  77. package/dist/bootstrap/commands/operations/cli.js +9 -36
  78. package/dist/bootstrap/commands/operations/request.mapper.d.ts +23 -0
  79. package/dist/bootstrap/commands/operations/request.mapper.js +33 -0
  80. package/dist/bootstrap/commands/operations-by-cursor/cli.d.ts +5 -69
  81. package/dist/bootstrap/commands/operations-by-cursor/cli.js +9 -74
  82. package/dist/bootstrap/commands/operations-by-cursor/request.mapper.d.ts +28 -0
  83. package/dist/bootstrap/commands/operations-by-cursor/request.mapper.js +70 -0
  84. package/dist/bootstrap/commands/option/cli.d.ts +2 -3
  85. package/dist/bootstrap/commands/option/cli.js +5 -10
  86. package/dist/bootstrap/commands/options-by/cli.d.ts +2 -3
  87. package/dist/bootstrap/commands/options-by/cli.js +5 -10
  88. package/dist/bootstrap/commands/order-book/cli.d.ts +3 -4
  89. package/dist/bootstrap/commands/order-book/cli.js +6 -11
  90. package/dist/bootstrap/commands/order-state/cli.d.ts +3 -36
  91. package/dist/bootstrap/commands/order-state/cli.js +8 -21
  92. package/dist/bootstrap/commands/order-state/request.mapper.d.ts +13 -0
  93. package/dist/bootstrap/commands/order-state/request.mapper.js +17 -0
  94. package/dist/bootstrap/commands/orders/cli.d.ts +3 -32
  95. package/dist/bootstrap/commands/orders/cli.js +8 -18
  96. package/dist/bootstrap/commands/orders/request.mapper.d.ts +6 -0
  97. package/dist/bootstrap/commands/orders/request.mapper.js +8 -0
  98. package/dist/bootstrap/commands/portfolio/cli.d.ts +6 -40
  99. package/dist/bootstrap/commands/portfolio/cli.js +9 -26
  100. package/dist/bootstrap/commands/portfolio/request.mapper.d.ts +18 -0
  101. package/dist/bootstrap/commands/portfolio/request.mapper.js +21 -0
  102. package/dist/bootstrap/commands/positions/cli.d.ts +3 -32
  103. package/dist/bootstrap/commands/positions/cli.js +8 -18
  104. package/dist/bootstrap/commands/positions/request.mapper.d.ts +6 -0
  105. package/dist/bootstrap/commands/positions/request.mapper.js +8 -0
  106. package/dist/bootstrap/commands/post-order/cli.d.ts +8 -68
  107. package/dist/bootstrap/commands/post-order/cli.js +9 -39
  108. package/dist/bootstrap/commands/post-order/request.mapper.d.ts +27 -0
  109. package/dist/bootstrap/commands/post-order/request.mapper.js +35 -0
  110. package/dist/bootstrap/commands/post-stop-order/cli.d.ts +3 -4
  111. package/dist/bootstrap/commands/post-stop-order/cli.js +6 -11
  112. package/dist/bootstrap/commands/replace-order/cli.d.ts +5 -61
  113. package/dist/bootstrap/commands/replace-order/cli.js +9 -30
  114. package/dist/bootstrap/commands/replace-order/request.mapper.d.ts +22 -0
  115. package/dist/bootstrap/commands/replace-order/request.mapper.js +26 -0
  116. package/dist/bootstrap/commands/sandbox-accounts/cli.d.ts +2 -3
  117. package/dist/bootstrap/commands/sandbox-accounts/cli.js +5 -10
  118. package/dist/bootstrap/commands/sandbox-cancel-order/cli.d.ts +3 -4
  119. package/dist/bootstrap/commands/sandbox-cancel-order/cli.js +8 -13
  120. package/dist/bootstrap/commands/sandbox-close-account/cli.d.ts +2 -3
  121. package/dist/bootstrap/commands/sandbox-close-account/cli.js +5 -10
  122. package/dist/bootstrap/commands/sandbox-open-account/cli.d.ts +2 -3
  123. package/dist/bootstrap/commands/sandbox-open-account/cli.js +5 -10
  124. package/dist/bootstrap/commands/sandbox-operations/cli.d.ts +3 -4
  125. package/dist/bootstrap/commands/sandbox-operations/cli.js +8 -13
  126. package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.d.ts +3 -4
  127. package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.js +8 -13
  128. package/dist/bootstrap/commands/sandbox-order-state/cli.d.ts +3 -4
  129. package/dist/bootstrap/commands/sandbox-order-state/cli.js +8 -13
  130. package/dist/bootstrap/commands/sandbox-orders/cli.d.ts +3 -4
  131. package/dist/bootstrap/commands/sandbox-orders/cli.js +8 -13
  132. package/dist/bootstrap/commands/sandbox-pay-in/cli.d.ts +2 -3
  133. package/dist/bootstrap/commands/sandbox-pay-in/cli.js +5 -10
  134. package/dist/bootstrap/commands/sandbox-portfolio/cli.d.ts +3 -4
  135. package/dist/bootstrap/commands/sandbox-portfolio/cli.js +8 -13
  136. package/dist/bootstrap/commands/sandbox-positions/cli.d.ts +3 -4
  137. package/dist/bootstrap/commands/sandbox-positions/cli.js +8 -13
  138. package/dist/bootstrap/commands/sandbox-post-order/cli.d.ts +3 -4
  139. package/dist/bootstrap/commands/sandbox-post-order/cli.js +8 -13
  140. package/dist/bootstrap/commands/sandbox-replace-order/cli.d.ts +3 -4
  141. package/dist/bootstrap/commands/sandbox-replace-order/cli.js +8 -13
  142. package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.d.ts +3 -4
  143. package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.js +8 -13
  144. package/dist/bootstrap/commands/sdk-command-lifecycle.d.ts +15 -0
  145. package/dist/bootstrap/commands/sdk-command-lifecycle.js +21 -0
  146. package/dist/bootstrap/commands/share/cli.d.ts +2 -3
  147. package/dist/bootstrap/commands/share/cli.js +5 -10
  148. package/dist/bootstrap/commands/shares/cli.d.ts +2 -3
  149. package/dist/bootstrap/commands/shares/cli.js +5 -10
  150. package/dist/bootstrap/commands/stop-orders/cli.d.ts +3 -4
  151. package/dist/bootstrap/commands/stop-orders/cli.js +6 -11
  152. package/dist/bootstrap/commands/stream-run/cli.d.ts +2 -24
  153. package/dist/bootstrap/commands/stream-run/cli.js +7 -142
  154. package/dist/bootstrap/commands/stream-run/config.d.ts +7 -15
  155. package/dist/bootstrap/commands/stream-run/config.js +1 -101
  156. package/dist/bootstrap/commands/stream-run/request.mapper.d.ts +14 -0
  157. package/dist/bootstrap/commands/stream-run/request.mapper.js +111 -0
  158. package/dist/bootstrap/commands/stream-run/stream-session.d.ts +37 -0
  159. package/dist/bootstrap/commands/stream-run/stream-session.js +152 -0
  160. package/dist/bootstrap/commands/trading-schedules/cli.d.ts +2 -3
  161. package/dist/bootstrap/commands/trading-schedules/cli.js +5 -10
  162. package/dist/bootstrap/commands/trading-status/cli.d.ts +3 -4
  163. package/dist/bootstrap/commands/trading-status/cli.js +6 -11
  164. package/dist/bootstrap/commands/trading-statuses/cli.d.ts +3 -4
  165. package/dist/bootstrap/commands/trading-statuses/cli.js +6 -11
  166. package/dist/bootstrap/commands/user-info/cli.d.ts +2 -3
  167. package/dist/bootstrap/commands/user-info/cli.js +5 -10
  168. package/dist/bootstrap/commands/user-tariff/cli.d.ts +2 -3
  169. package/dist/bootstrap/commands/user-tariff/cli.js +5 -10
  170. package/dist/bootstrap/commands/withdraw-limits/cli.d.ts +3 -32
  171. package/dist/bootstrap/commands/withdraw-limits/cli.js +8 -18
  172. package/dist/bootstrap/commands/withdraw-limits/request.mapper.d.ts +6 -0
  173. package/dist/bootstrap/commands/withdraw-limits/request.mapper.js +8 -0
  174. package/dist/bootstrap/index.js +2 -2
  175. package/dist/bootstrap/proto/compile-proto.d.ts +1 -1
  176. package/dist/bootstrap/proto/compile-proto.js +28 -35
  177. package/dist/bootstrap/t-invest-node-sdk.d.ts +9 -9
  178. package/dist/bootstrap/t-invest-node-sdk.js +33 -18
  179. package/dist/bootstrap/unary-limit-config.js +4 -4
  180. package/dist/generated/common.js +2 -2
  181. package/dist/generated/google/api/field_behavior.js +2 -2
  182. package/dist/generated/google/protobuf/descriptor.js +2 -2
  183. package/dist/generated/google/protobuf/timestamp.js +2 -2
  184. package/dist/generated/instruments.js +2 -2
  185. package/dist/generated/marketdata.js +2 -2
  186. package/dist/generated/operations.js +2 -2
  187. package/dist/generated/orders.js +2 -2
  188. package/dist/generated/sandbox.js +2 -2
  189. package/dist/generated/signals.js +2 -2
  190. package/dist/generated/stoporders.js +2 -2
  191. package/dist/generated/users.js +2 -2
  192. package/dist/index.d.ts +1 -1
  193. package/dist/infrastructure/interceptor/warning-interceptor.d.ts +1 -1
  194. package/dist/infrastructure/interceptor/warning-interceptor.js +2 -2
  195. package/dist/infrastructure/transport/grpc/sdk-call-error.d.ts +12 -0
  196. package/dist/infrastructure/transport/grpc/sdk-call-error.js +180 -0
  197. package/dist/infrastructure/transport/grpc/sdk-client.d.ts +1 -1
  198. package/dist/infrastructure/transport/grpc/sdk-client.js +2 -2
  199. package/dist/infrastructure/transport/grpc/sdk-middleware.d.ts +1 -1
  200. package/dist/infrastructure/transport/grpc/sdk-middleware.js +8 -174
  201. package/dist/infrastructure/transport/grpc/unary-limit-resolver.d.ts +3 -1
  202. package/dist/infrastructure/transport/grpc/unary-limit-resolver.js +19 -18
  203. package/docs/architecture.md +45 -42
  204. package/docs/bundled-ca.md +12 -12
  205. package/docs/clean-architecture/adapters.md +15 -15
  206. package/docs/clean-architecture/api-commands.md +63 -52
  207. package/docs/clean-architecture/application.md +13 -13
  208. package/docs/clean-architecture/cli-output-boundaries.md +23 -23
  209. package/docs/clean-architecture/dto.md +9 -9
  210. package/docs/clean-architecture/index.md +13 -12
  211. package/docs/cli-stream-configuration.md +9 -9
  212. package/docs/cli-stream-reference.md +11 -11
  213. package/docs/guides/custom-unary-limiter.md +44 -30
  214. package/docs/guides/errors-and-lifecycle.md +10 -10
  215. package/docs/guides/getting-started.md +9 -9
  216. package/docs/guides/index.md +3 -3
  217. package/docs/guides/streams-and-cancellation.md +6 -6
  218. package/docs/guides/testing-with-service-definitions.md +4 -4
  219. package/docs/guides/unary-calls.md +8 -8
  220. package/docs/index.md +14 -10
  221. package/docs/limits-policy.md +10 -10
  222. package/docs/roadmap.md +14 -14
  223. package/docs/tls-policy.md +7 -7
  224. package/package.json +6 -5
  225. package/readme.md +37 -85
  226. package/dist/infrastructure/interceptor/index.d.ts +0 -1
  227. package/dist/infrastructure/interceptor/index.js +0 -17
  228. /package/dist/infrastructure/transport/grpc/{unary-limits.d.ts → unary-method-path.d.ts} +0 -0
  229. /package/dist/infrastructure/transport/grpc/{unary-limits.js → unary-method-path.js} +0 -0
@@ -5,23 +5,22 @@
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.formatDividends = exports.dividendsCommand = void 0;
13
+ exports.dividendsCommand = void 0;
14
14
  exports.createDividendsCommand = createDividendsCommand;
15
15
  exports.createDividendsRequest = createDividendsRequest;
16
16
  const instruments_1 = require("../../../generated/instruments");
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 instrument_id_options_1 = require("../../args/instrument-id-options");
23
23
  const reporter_1 = require("./reporter");
24
- Object.defineProperty(exports, "formatDividends", { enumerable: true, get: function () { return reporter_1.formatDividends; } });
25
24
  const dividendsCommandPath = ['instrument', 'dividends'];
26
25
  const defaultDividendsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
27
26
  const dividendsRequestOptionsSchema = {
@@ -56,14 +55,10 @@ exports.dividendsCommand = createDividendsCommand();
56
55
  async function runDividendsCommand(options, createSdk) {
57
56
  const request = createDividendsRequest(options);
58
57
  const { format } = options;
59
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
60
- try {
58
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
61
59
  const response = await sdk.instruments.getDividends(request);
62
60
  return (0, reporter_1.formatDividends)(response.dividends, format);
63
- }
64
- finally {
65
- sdk.close();
66
- }
61
+ });
67
62
  }
68
63
  function createDividendsRequest(options) {
69
64
  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,7 +12,6 @@ import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import type { GetDividendsForeignIssuerRequest, GetDividendsForeignIssuerResponse } from '../../../generated/operations';
13
13
  import { type InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatDividendsForeignIssuer } from './reporter';
16
15
  type DividendsForeignIssuerSdk = {
17
16
  operations: {
18
17
  getDividendsForeignIssuer(request: GetDividendsForeignIssuerRequest): Promise<GetDividendsForeignIssuerResponse>;
@@ -129,4 +128,4 @@ export declare const dividendsForeignIssuerCommand: Omit<import("icore").Command
129
128
  }, undefined, string, readonly ["operation", "foreign-dividends-report"], undefined, void, readonly []>, "metadata"> & {
130
129
  metadata?: undefined;
131
130
  };
132
- export { formatDividendsForeignIssuer };
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.formatDividendsForeignIssuer = exports.dividendsForeignIssuerCommand = void 0;
13
+ exports.dividendsForeignIssuerCommand = void 0;
14
14
  exports.createDividendsForeignIssuerRequest = createDividendsForeignIssuerRequest;
15
15
  exports.createDividendsForeignIssuerCommand = createDividendsForeignIssuerCommand;
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, "formatDividendsForeignIssuer", { enumerable: true, get: function () { return reporter_1.formatDividendsForeignIssuer; } });
23
22
  const dividendsForeignIssuerCommandPath = ['operation', 'foreign-dividends-report'];
24
23
  const defaultDividendsForeignIssuerSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
25
24
  const dividendsForeignIssuerRequestOptionsSchema = {
@@ -94,12 +93,8 @@ exports.dividendsForeignIssuerCommand = createDividendsForeignIssuerCommand();
94
93
  async function runDividendsForeignIssuerCommand(options, createSdk) {
95
94
  const request = createDividendsForeignIssuerRequest(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.getDividendsForeignIssuer(request);
100
98
  return (0, reporter_1.formatDividendsForeignIssuer)(response, format);
101
- }
102
- finally {
103
- sdk.close();
104
- }
99
+ });
105
100
  }
@@ -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 { EditFavoritesRequest, type EditFavoritesResponse } from '../../../generated/instruments';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatEditFavorites } from './reporter';
16
15
  type EditFavoritesSdk = {
17
16
  instruments: {
18
17
  editFavorites(request: EditFavoritesRequest): Promise<EditFavoritesResponse>;
@@ -125,5 +124,5 @@ export declare const editFavoritesCommand: Omit<import("icore").CommandDefinitio
125
124
  }, undefined, string, readonly ["instrument", "favorite", "edit"], undefined, void, readonly []>, "metadata"> & {
126
125
  metadata?: undefined;
127
126
  };
128
- export { formatEditFavorites };
129
127
  export declare function createEditFavoritesRequest(options: EditFavoritesRequestOptions): EditFavoritesRequest;
128
+ export {};
@@ -5,23 +5,22 @@
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.formatEditFavorites = exports.editFavoritesCommand = void 0;
13
+ exports.editFavoritesCommand = void 0;
14
14
  exports.createEditFavoritesCommand = createEditFavoritesCommand;
15
15
  exports.createEditFavoritesRequest = createEditFavoritesRequest;
16
16
  const instruments_1 = require("../../../generated/instruments");
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 side_effect_args_1 = require("../../args/side-effect-args");
22
22
  const instrument_id_options_1 = require("../../args/instrument-id-options");
23
23
  const reporter_1 = require("./reporter");
24
- Object.defineProperty(exports, "formatEditFavorites", { enumerable: true, get: function () { return reporter_1.formatEditFavorites; } });
25
24
  const editFavoritesCommandPath = ['instrument', 'favorite', 'edit'];
26
25
  const defaultEditFavoritesSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
27
26
  const editFavoriteActions = {
@@ -59,14 +58,10 @@ async function runEditFavoritesCommand(options, createSdk) {
59
58
  (0, side_effect_args_1.assertSideEffectConfirmed)(options.confirm);
60
59
  const request = createEditFavoritesRequest(options);
61
60
  const { format } = options;
62
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
63
- try {
61
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
64
62
  const response = await sdk.instruments.editFavorites(request);
65
63
  return (0, reporter_1.formatEditFavorites)(response, format);
66
- }
67
- finally {
68
- sdk.close();
69
- }
64
+ });
70
65
  }
71
66
  function createEditFavoritesRequest(options) {
72
67
  return instruments_1.EditFavoritesRequest.create({
@@ -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 { EtfResponse, InstrumentRequest } from '../../../generated/instruments';
13
- import { formatEtf } from './reporter';
14
13
  type EtfSdk = {
15
14
  instruments: {
16
15
  etfBy(request: InstrumentRequest): Promise<EtfResponse>;
@@ -80,4 +79,4 @@ export declare const etfCommand: Omit<import("icore").CommandDefinition<{
80
79
  }, undefined, string, readonly ["instrument", "etf", "show"], undefined, void, readonly []>, "metadata"> & {
81
80
  metadata?: undefined;
82
81
  };
83
- export { formatEtf };
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.formatEtf = exports.etfCommand = void 0;
13
+ exports.etfCommand = void 0;
14
14
  exports.createEtfCommand = createEtfCommand;
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, "formatEtf", { enumerable: true, get: function () { return reporter_1.formatEtf; } });
22
21
  const etfCommandPath = ['instrument', 'etf', 'show'];
23
22
  const defaultEtfSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const etfFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.etfCommand = createEtfCommand();
42
41
  async function runEtfCommand(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.etfBy(request);
48
46
  return (0, reporter_1.formatEtf)(response, 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 { EtfsResponse, InstrumentsRequest } from '../../../generated/instruments';
13
- import { formatEtfs } from './reporter';
14
13
  type EtfsSdk = {
15
14
  instruments: {
16
15
  etfs(request: InstrumentsRequest): Promise<EtfsResponse>;
@@ -70,4 +69,4 @@ export declare const etfsCommand: Omit<import("icore").CommandDefinition<{
70
69
  }, undefined, string, readonly ["instrument", "etf", "list"], undefined, void, readonly []>, "metadata"> & {
71
70
  metadata?: undefined;
72
71
  };
73
- export { formatEtfs };
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.formatEtfs = exports.etfsCommand = void 0;
13
+ exports.etfsCommand = void 0;
14
14
  exports.createEtfsCommand = createEtfsCommand;
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, "formatEtfs", { enumerable: true, get: function () { return reporter_1.formatEtfs; } });
22
21
  const etfsCommandPath = ['instrument', 'etf', 'list'];
23
22
  const defaultEtfsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const etfsFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.etfsCommand = createEtfsCommand();
42
41
  async function runEtfsCommand(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.etfs(request);
48
46
  return (0, reporter_1.formatEtfs)(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 { GetFavoritesRequest, GetFavoritesResponse } from '../../../generated/instruments';
13
- import { formatFavorites } from './reporter';
14
13
  type FavoritesSdk = {
15
14
  instruments: {
16
15
  getFavorites(request: GetFavoritesRequest): Promise<GetFavoritesResponse>;
@@ -60,4 +59,4 @@ export declare const favoritesCommand: Omit<import("icore").CommandDefinition<{
60
59
  }, undefined, string, readonly ["instrument", "favorite", "list"], undefined, void, readonly []>, "metadata"> & {
61
60
  metadata?: undefined;
62
61
  };
63
- export { formatFavorites };
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.formatFavorites = exports.favoritesCommand = void 0;
13
+ exports.favoritesCommand = void 0;
14
14
  exports.createFavoritesCommand = createFavoritesCommand;
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, "formatFavorites", { enumerable: true, get: function () { return reporter_1.formatFavorites; } });
21
20
  const favoritesCommandPath = ['instrument', 'favorite', 'list'];
22
21
  const defaultFavoritesSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
23
22
  const favoritesOptionsSchema = (0, command_options_1.withSdkOptions)({
@@ -39,12 +38,8 @@ function createFavoritesCommand(createSdk = defaultFavoritesSdkFactory) {
39
38
  exports.favoritesCommand = createFavoritesCommand();
40
39
  async function runFavoritesCommand(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.getFavorites({});
45
43
  return (0, reporter_1.formatFavorites)(response.favoriteInstruments, format);
46
- }
47
- finally {
48
- sdk.close();
49
- }
44
+ });
50
45
  }
@@ -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 { FindInstrumentRequest, FindInstrumentResponse } from '../../../generated/instruments';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatFindInstrument } from './reporter';
16
15
  type FindInstrumentSdk = {
17
16
  instruments: {
18
17
  findInstrument(request: FindInstrumentRequest): Promise<FindInstrumentResponse>;
@@ -122,5 +121,5 @@ export declare const findInstrumentCommand: Omit<import("icore").CommandDefiniti
122
121
  }, undefined, string, readonly ["instrument", "search"], undefined, void, readonly []>, "metadata"> & {
123
122
  metadata?: undefined;
124
123
  };
125
- export { formatFindInstrument };
126
124
  export declare function createFindInstrumentRequest(options: FindInstrumentRequestOptions): FindInstrumentRequest;
125
+ 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.formatFindInstrument = exports.findInstrumentCommand = void 0;
13
+ exports.findInstrumentCommand = void 0;
14
14
  exports.createFindInstrumentCommand = createFindInstrumentCommand;
15
15
  exports.createFindInstrumentRequest = createFindInstrumentRequest;
16
16
  const common_1 = require("../../../generated/common");
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, "formatFindInstrument", { enumerable: true, get: function () { return reporter_1.formatFindInstrument; } });
23
22
  const findInstrumentCommandPath = ['instrument', 'search'];
24
23
  const defaultFindInstrumentSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
25
24
  const instrumentKinds = {
@@ -70,14 +69,10 @@ exports.findInstrumentCommand = createFindInstrumentCommand();
70
69
  async function runFindInstrumentCommand(options, createSdk) {
71
70
  const request = createFindInstrumentRequest(options);
72
71
  const { format } = options;
73
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
74
- try {
72
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
75
73
  const response = await sdk.instruments.findInstrument(request);
76
74
  return (0, reporter_1.formatFindInstrument)(response.instruments, format);
77
- }
78
- finally {
79
- sdk.close();
80
- }
75
+ });
81
76
  }
82
77
  function createFindInstrumentRequest(options) {
83
78
  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 { FutureResponse, InstrumentRequest } from '../../../generated/instruments';
13
- import { formatFuture } from './reporter';
14
13
  type FutureSdk = {
15
14
  instruments: {
16
15
  futureBy(request: InstrumentRequest): Promise<FutureResponse>;
@@ -80,4 +79,4 @@ export declare const futureCommand: Omit<import("icore").CommandDefinition<{
80
79
  }, undefined, string, readonly ["instrument", "future", "show"], undefined, void, readonly []>, "metadata"> & {
81
80
  metadata?: undefined;
82
81
  };
83
- export { formatFuture };
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.formatFuture = exports.futureCommand = void 0;
13
+ exports.futureCommand = void 0;
14
14
  exports.createFutureCommand = createFutureCommand;
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, "formatFuture", { enumerable: true, get: function () { return reporter_1.formatFuture; } });
22
21
  const futureCommandPath = ['instrument', 'future', 'show'];
23
22
  const defaultFutureSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const futureFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.futureCommand = createFutureCommand();
42
41
  async function runFutureCommand(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.futureBy(request);
48
46
  return (0, reporter_1.formatFuture)(response, 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 { FuturesResponse, InstrumentsRequest } from '../../../generated/instruments';
13
- import { formatFutures } from './reporter';
14
13
  type FuturesSdk = {
15
14
  instruments: {
16
15
  futures(request: InstrumentsRequest): Promise<FuturesResponse>;
@@ -70,4 +69,4 @@ export declare const futuresCommand: Omit<import("icore").CommandDefinition<{
70
69
  }, undefined, string, readonly ["instrument", "future", "list"], undefined, void, readonly []>, "metadata"> & {
71
70
  metadata?: undefined;
72
71
  };
73
- export { formatFutures };
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.formatFutures = exports.futuresCommand = void 0;
13
+ exports.futuresCommand = void 0;
14
14
  exports.createFuturesCommand = createFuturesCommand;
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, "formatFutures", { enumerable: true, get: function () { return reporter_1.formatFutures; } });
22
21
  const futuresCommandPath = ['instrument', 'future', 'list'];
23
22
  const defaultFuturesSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const futuresFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.futuresCommand = createFuturesCommand();
42
41
  async function runFuturesCommand(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.futures(request);
48
46
  return (0, reporter_1.formatFutures)(response.instruments, 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 { GetFuturesMarginRequest, type GetFuturesMarginResponse } from '../../../generated/instruments';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatFuturesMargin } from './reporter';
16
15
  type FuturesMarginSdk = {
17
16
  instruments: {
18
17
  getFuturesMargin(request: GetFuturesMarginRequest): Promise<GetFuturesMarginResponse>;
@@ -101,5 +100,5 @@ export declare const futuresMarginCommand: Omit<import("icore").CommandDefinitio
101
100
  }, undefined, string, readonly ["instrument", "future", "margin"], undefined, void, readonly []>, "metadata"> & {
102
101
  metadata?: undefined;
103
102
  };
104
- export { formatFuturesMargin };
105
103
  export declare function createFuturesMarginRequest(options: FuturesMarginRequestOptions): GetFuturesMarginRequest;
104
+ 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.formatFuturesMargin = exports.futuresMarginCommand = void 0;
13
+ exports.futuresMarginCommand = void 0;
14
14
  exports.createFuturesMarginCommand = createFuturesMarginCommand;
15
15
  exports.createFuturesMarginRequest = createFuturesMarginRequest;
16
16
  const instruments_1 = require("../../../generated/instruments");
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 instrument_id_options_1 = require("../../args/instrument-id-options");
22
22
  const reporter_1 = require("./reporter");
23
- Object.defineProperty(exports, "formatFuturesMargin", { enumerable: true, get: function () { return reporter_1.formatFuturesMargin; } });
24
23
  const futuresMarginCommandPath = ['instrument', 'future', 'margin'];
25
24
  const defaultFuturesMarginSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
26
25
  const futuresMarginRequestOptionsSchema = {
@@ -47,14 +46,10 @@ exports.futuresMarginCommand = createFuturesMarginCommand();
47
46
  async function runFuturesMarginCommand(options, createSdk) {
48
47
  const request = createFuturesMarginRequest(options);
49
48
  const { format } = options;
50
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
51
- try {
49
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
52
50
  const response = await sdk.instruments.getFuturesMargin(request);
53
51
  return (0, reporter_1.formatFuturesMargin)(response, format);
54
- }
55
- finally {
56
- sdk.close();
57
- }
52
+ });
58
53
  }
59
54
  function createFuturesMarginRequest(options) {
60
55
  const instrumentId = (0, instrument_id_options_1.resolveInstrumentIdOption)(options);