@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
@@ -222,12 +222,12 @@ export declare const commandLineCommands: import("icore").Commands<readonly [Wit
222
222
  };
223
223
  readonly direction: {
224
224
  readonly type: 'string';
225
- readonly choices: ("buy" | "sell")[];
225
+ readonly choices: readonly ["buy", "sell"];
226
226
  readonly required: true;
227
227
  };
228
228
  readonly 'order-type': {
229
229
  readonly type: 'string';
230
- readonly choices: ("bestprice" | "limit" | "market")[];
230
+ readonly choices: readonly ["limit", "market", "bestprice"];
231
231
  readonly required: true;
232
232
  };
233
233
  readonly 'order-id': {
@@ -313,7 +313,7 @@ export declare const commandLineCommands: import("icore").Commands<readonly [Wit
313
313
  };
314
314
  readonly 'price-type': {
315
315
  readonly type: 'string';
316
- readonly choices: ("currency" | "point")[];
316
+ readonly choices: readonly ["point", "currency"];
317
317
  readonly required: true;
318
318
  };
319
319
  readonly format: {
@@ -1095,7 +1095,7 @@ export declare const commandLineCommands: import("icore").Commands<readonly [Wit
1095
1095
  };
1096
1096
  readonly state: {
1097
1097
  readonly type: 'string';
1098
- readonly choices: ("canceled" | "executed" | "progress" | "unspecified")[];
1098
+ readonly choices: readonly ["unspecified", "executed", "canceled", "progress"];
1099
1099
  readonly default: 'unspecified';
1100
1100
  };
1101
1101
  readonly 'account-id': {
@@ -1132,7 +1132,7 @@ export declare const commandLineCommands: import("icore").Commands<readonly [Wit
1132
1132
  };
1133
1133
  readonly state: {
1134
1134
  readonly type: 'string';
1135
- readonly choices: ("canceled" | "executed" | "progress" | "unspecified")[];
1135
+ readonly choices: readonly ["unspecified", "executed", "canceled", "progress"];
1136
1136
  readonly default: 'unspecified';
1137
1137
  };
1138
1138
  readonly limit: {
@@ -1265,7 +1265,7 @@ export declare const commandLineCommands: import("icore").Commands<readonly [Wit
1265
1265
  };
1266
1266
  readonly currency: {
1267
1267
  readonly type: 'string';
1268
- readonly choices: ("eur" | "rub" | "usd")[];
1268
+ readonly choices: readonly ["rub", "usd", "eur"];
1269
1269
  readonly default: 'rub';
1270
1270
  };
1271
1271
  readonly format: {
@@ -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 { GetAccountsResponse } from '../../../generated/users';
13
- import { formatAccounts } from './reporter';
14
13
  type AccountsSdk = {
15
14
  users: {
16
15
  getAccounts(request: Record<string, never>): Promise<GetAccountsResponse>;
@@ -60,4 +59,4 @@ export declare const accountsCommand: Omit<import("icore").CommandDefinition<{
60
59
  }, undefined, string, readonly ["account", "list"], undefined, void, readonly []>, "metadata"> & {
61
60
  metadata?: undefined;
62
61
  };
63
- export { formatAccounts };
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.formatAccounts = exports.accountsCommand = void 0;
13
+ exports.accountsCommand = void 0;
14
14
  exports.createAccountsCommand = createAccountsCommand;
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, "formatAccounts", { enumerable: true, get: function () { return reporter_1.formatAccounts; } });
21
20
  const accountsCommandPath = ['account', 'list'];
22
21
  const defaultAccountsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
23
22
  const accountsOptionsSchema = (0, command_options_1.withSdkOptions)({
@@ -39,12 +38,8 @@ function createAccountsCommand(createSdk = defaultAccountsSdkFactory) {
39
38
  exports.accountsCommand = createAccountsCommand();
40
39
  async function runAccountsCommand(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.users.getAccounts({});
45
43
  return (0, reporter_1.formatAccounts)(response.accounts, 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 { GetAccruedInterestsRequest, type GetAccruedInterestsResponse } from '../../../generated/instruments';
13
13
  import { type InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatAccruedInterests } from './reporter';
16
15
  type AccruedInterestsSdk = {
17
16
  instruments: {
18
17
  getAccruedInterests(request: GetAccruedInterestsRequest): Promise<GetAccruedInterestsResponse>;
@@ -125,5 +124,5 @@ export declare const accruedInterestsCommand: Omit<import("icore").CommandDefini
125
124
  }, undefined, string, readonly ["instrument", "bond", "accrued"], undefined, void, readonly []>, "metadata"> & {
126
125
  metadata?: undefined;
127
126
  };
128
- export { formatAccruedInterests };
129
127
  export declare function createAccruedInterestsRequest(options: AccruedInterestsRequestOptions): GetAccruedInterestsRequest;
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.formatAccruedInterests = exports.accruedInterestsCommand = void 0;
13
+ exports.accruedInterestsCommand = void 0;
14
14
  exports.createAccruedInterestsCommand = createAccruedInterestsCommand;
15
15
  exports.createAccruedInterestsRequest = createAccruedInterestsRequest;
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, "formatAccruedInterests", { enumerable: true, get: function () { return reporter_1.formatAccruedInterests; } });
25
24
  const accruedInterestsCommandPath = ['instrument', 'bond', 'accrued'];
26
25
  const defaultAccruedInterestsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
27
26
  const accruedInterestsRequestOptionsSchema = {
@@ -56,14 +55,10 @@ exports.accruedInterestsCommand = createAccruedInterestsCommand();
56
55
  async function runAccruedInterestsCommand(options, createSdk) {
57
56
  const request = createAccruedInterestsRequest(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.getAccruedInterests(request);
62
60
  return (0, reporter_1.formatAccruedInterests)(response.accruedInterests, format);
63
- }
64
- finally {
65
- sdk.close();
66
- }
61
+ });
67
62
  }
68
63
  function createAccruedInterestsRequest(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 { AssetRequest, AssetResponse } from '../../../generated/instruments';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatAsset } from './reporter';
16
15
  type AssetSdk = {
17
16
  instruments: {
18
17
  getAssetBy(request: AssetRequest): Promise<AssetResponse>;
@@ -95,5 +94,5 @@ export declare const assetCommand: Omit<import("icore").CommandDefinition<{
95
94
  }, undefined, string, readonly ["instrument", "asset", "show"], undefined, void, readonly []>, "metadata"> & {
96
95
  metadata?: undefined;
97
96
  };
98
- export { formatAsset };
99
97
  export declare function createAssetRequest(options: AssetRequestOptions): AssetRequest;
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.formatAsset = exports.assetCommand = void 0;
13
+ exports.assetCommand = void 0;
14
14
  exports.createAssetCommand = createAssetCommand;
15
15
  exports.createAssetRequest = createAssetRequest;
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, "formatAsset", { enumerable: true, get: function () { return reporter_1.formatAsset; } });
22
21
  const assetCommandPath = ['instrument', 'asset', 'show'];
23
22
  const defaultAssetSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const assetRequestOptionsSchema = {
@@ -48,14 +47,10 @@ exports.assetCommand = createAssetCommand();
48
47
  async function runAssetCommand(options, createSdk) {
49
48
  const request = createAssetRequest(options);
50
49
  const { format } = options;
51
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
52
- try {
50
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
53
51
  const response = await sdk.instruments.getAssetBy(request);
54
52
  return (0, reporter_1.formatAsset)(response, format);
55
- }
56
- finally {
57
- sdk.close();
58
- }
53
+ });
59
54
  }
60
55
  function createAssetRequest(options) {
61
56
  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,7 +12,6 @@ import type { TInvestOptions } from '../../../application/dto/t-invest-options';
12
12
  import type { AssetsRequest, AssetsResponse } from '../../../generated/instruments';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatAssets } from './reporter';
16
15
  type AssetsSdk = {
17
16
  instruments: {
18
17
  getAssets(request: AssetsRequest): Promise<AssetsResponse>;
@@ -98,5 +97,5 @@ export declare const assetsCommand: Omit<import("icore").CommandDefinition<{
98
97
  }, undefined, string, readonly ["instrument", "asset", "list"], undefined, void, readonly []>, "metadata"> & {
99
98
  metadata?: undefined;
100
99
  };
101
- export { formatAssets };
102
100
  export declare function createAssetsRequest(options: AssetsRequestOptions): AssetsRequest;
101
+ 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.formatAssets = exports.assetsCommand = void 0;
13
+ exports.assetsCommand = void 0;
14
14
  exports.createAssetsCommand = createAssetsCommand;
15
15
  exports.createAssetsRequest = createAssetsRequest;
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, "formatAssets", { enumerable: true, get: function () { return reporter_1.formatAssets; } });
23
22
  const assetsCommandPath = ['instrument', 'asset', 'list'];
24
23
  const defaultAssetsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
25
24
  const assetInstrumentTypes = {
@@ -62,14 +61,10 @@ exports.assetsCommand = createAssetsCommand();
62
61
  async function runAssetsCommand(options, createSdk) {
63
62
  const request = createAssetsRequest(options);
64
63
  const { format } = options;
65
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
66
- try {
64
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
67
65
  const response = await sdk.instruments.getAssets(request);
68
66
  return (0, reporter_1.formatAssets)(response.assets, format);
69
- }
70
- finally {
71
- sdk.close();
72
- }
67
+ });
73
68
  }
74
69
  function createAssetsRequest(options) {
75
70
  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 { BondResponse, InstrumentRequest } from '../../../generated/instruments';
13
- import { formatBond } from './reporter';
14
13
  type BondSdk = {
15
14
  instruments: {
16
15
  bondBy(request: InstrumentRequest): Promise<BondResponse>;
@@ -80,4 +79,4 @@ export declare const bondCommand: Omit<import("icore").CommandDefinition<{
80
79
  }, undefined, string, readonly ["instrument", "bond", "show"], undefined, void, readonly []>, "metadata"> & {
81
80
  metadata?: undefined;
82
81
  };
83
- export { formatBond };
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.formatBond = exports.bondCommand = void 0;
13
+ exports.bondCommand = void 0;
14
14
  exports.createBondCommand = createBondCommand;
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, "formatBond", { enumerable: true, get: function () { return reporter_1.formatBond; } });
22
21
  const bondCommandPath = ['instrument', 'bond', 'show'];
23
22
  const defaultBondSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const bondFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.bondCommand = createBondCommand();
42
41
  async function runBondCommand(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.bondBy(request);
48
46
  return (0, reporter_1.formatBond)(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 { GetBondCouponsRequest, type GetBondCouponsResponse } from '../../../generated/instruments';
13
13
  import { type InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatBondCoupons } from './reporter';
16
15
  type BondCouponsSdk = {
17
16
  instruments: {
18
17
  getBondCoupons(request: GetBondCouponsRequest): Promise<GetBondCouponsResponse>;
@@ -125,5 +124,5 @@ export declare const bondCouponsCommand: Omit<import("icore").CommandDefinition<
125
124
  }, undefined, string, readonly ["instrument", "bond", "coupons"], undefined, void, readonly []>, "metadata"> & {
126
125
  metadata?: undefined;
127
126
  };
128
- export { formatBondCoupons };
129
127
  export declare function createBondCouponsRequest(options: BondCouponsRequestOptions): GetBondCouponsRequest;
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.formatBondCoupons = exports.bondCouponsCommand = void 0;
13
+ exports.bondCouponsCommand = void 0;
14
14
  exports.createBondCouponsCommand = createBondCouponsCommand;
15
15
  exports.createBondCouponsRequest = createBondCouponsRequest;
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, "formatBondCoupons", { enumerable: true, get: function () { return reporter_1.formatBondCoupons; } });
25
24
  const bondCouponsCommandPath = ['instrument', 'bond', 'coupons'];
26
25
  const defaultBondCouponsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
27
26
  const bondCouponsRequestOptionsSchema = {
@@ -56,14 +55,10 @@ exports.bondCouponsCommand = createBondCouponsCommand();
56
55
  async function runBondCouponsCommand(options, createSdk) {
57
56
  const request = createBondCouponsRequest(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.getBondCoupons(request);
62
60
  return (0, reporter_1.formatBondCoupons)(response.events, format);
63
- }
64
- finally {
65
- sdk.close();
66
- }
61
+ });
67
62
  }
68
63
  function createBondCouponsRequest(options) {
69
64
  const from = (0, command_options_1.parseDateTimeOption)(options.from, 'from');
@@ -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 { BondsResponse, InstrumentsRequest } from '../../../generated/instruments';
13
- import { formatBonds } from './reporter';
14
13
  type BondsSdk = {
15
14
  instruments: {
16
15
  bonds(request: InstrumentsRequest): Promise<BondsResponse>;
@@ -70,4 +69,4 @@ export declare const bondsCommand: Omit<import("icore").CommandDefinition<{
70
69
  }, undefined, string, readonly ["instrument", "bond", "list"], undefined, void, readonly []>, "metadata"> & {
71
70
  metadata?: undefined;
72
71
  };
73
- export { formatBonds };
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.formatBonds = exports.bondsCommand = void 0;
13
+ exports.bondsCommand = void 0;
14
14
  exports.createBondsCommand = createBondsCommand;
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, "formatBonds", { enumerable: true, get: function () { return reporter_1.formatBonds; } });
22
21
  const bondsCommandPath = ['instrument', 'bond', 'list'];
23
22
  const defaultBondsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const bondsFormatOptionsSchema = {
@@ -42,12 +41,8 @@ exports.bondsCommand = createBondsCommand();
42
41
  async function runBondsCommand(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.bonds(request);
48
46
  return (0, reporter_1.formatBonds)(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 type { Brand, GetBrandRequest } from '../../../generated/instruments';
13
13
  import type { InferOptions } from 'icore';
14
14
  import type { CommandRequestOptions } from '../../args/command-options';
15
- import { formatBrand } from './reporter';
16
15
  type BrandSdk = {
17
16
  instruments: {
18
17
  getBrandBy(request: GetBrandRequest): Promise<Brand>;
@@ -95,5 +94,5 @@ export declare const brandCommand: Omit<import("icore").CommandDefinition<{
95
94
  }, undefined, string, readonly ["instrument", "brand", "show"], undefined, void, readonly []>, "metadata"> & {
96
95
  metadata?: undefined;
97
96
  };
98
- export { formatBrand };
99
97
  export declare function createBrandRequest(options: BrandRequestOptions): GetBrandRequest;
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.formatBrand = exports.brandCommand = void 0;
13
+ exports.brandCommand = void 0;
14
14
  exports.createBrandCommand = createBrandCommand;
15
15
  exports.createBrandRequest = createBrandRequest;
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, "formatBrand", { enumerable: true, get: function () { return reporter_1.formatBrand; } });
22
21
  const brandCommandPath = ['instrument', 'brand', 'show'];
23
22
  const defaultBrandSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
24
23
  const brandRequestOptionsSchema = {
@@ -48,14 +47,10 @@ exports.brandCommand = createBrandCommand();
48
47
  async function runBrandCommand(options, createSdk) {
49
48
  const request = createBrandRequest(options);
50
49
  const { format } = options;
51
- const sdk = createSdk((0, args_1.resolveSdkOptionsFromCommandOptions)(options));
52
- try {
50
+ return (0, sdk_command_lifecycle_1.runSdkCommand)(options, createSdk, async (sdk) => {
53
51
  const response = await sdk.instruments.getBrandBy(request);
54
52
  return (0, reporter_1.formatBrand)(response, format);
55
- }
56
- finally {
57
- sdk.close();
58
- }
53
+ });
59
54
  }
60
55
  function createBrandRequest(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 { GetBrandsRequest, GetBrandsResponse } from '../../../generated/instruments';
13
- import { formatBrands } from './reporter';
14
13
  type BrandsSdk = {
15
14
  instruments: {
16
15
  getBrands(request: GetBrandsRequest): Promise<GetBrandsResponse>;
@@ -60,4 +59,4 @@ export declare const brandsCommand: Omit<import("icore").CommandDefinition<{
60
59
  }, undefined, string, readonly ["instrument", "brand", "list"], undefined, void, readonly []>, "metadata"> & {
61
60
  metadata?: undefined;
62
61
  };
63
- export { formatBrands };
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.formatBrands = exports.brandsCommand = void 0;
13
+ exports.brandsCommand = void 0;
14
14
  exports.createBrandsCommand = createBrandsCommand;
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, "formatBrands", { enumerable: true, get: function () { return reporter_1.formatBrands; } });
21
20
  const brandsCommandPath = ['instrument', 'brand', 'list'];
22
21
  const defaultBrandsSdkFactory = (options) => new t_invest_node_sdk_1.TInvestNodeSDK(options);
23
22
  const brandsOptionsSchema = (0, command_options_1.withSdkOptions)({
@@ -39,12 +38,8 @@ function createBrandsCommand(createSdk = defaultBrandsSdkFactory) {
39
38
  exports.brandsCommand = createBrandsCommand();
40
39
  async function runBrandsCommand(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.getBrands({ paging: undefined });
45
43
  return (0, reporter_1.formatBrands)(response.brands, format);
46
- }
47
- finally {
48
- sdk.close();
49
- }
44
+ });
50
45
  }