@woodger/t-invest-node-sdk 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +44 -16
  2. package/{THIRD_PARTY_NOTICES.md → LICENSE-APACHE-2.0} +1 -106
  3. package/NOTICE +98 -0
  4. package/dist/application/services/unary-limiter.js +9 -9
  5. package/dist/bootstrap/args/sdk-options.d.ts +1 -2
  6. package/dist/bootstrap/cli/help-catalog.d.ts +733 -0
  7. package/dist/bootstrap/cli/help-catalog.js +1649 -0
  8. package/dist/bootstrap/cli/help.d.ts +2 -730
  9. package/dist/bootstrap/cli/help.js +5 -1647
  10. package/dist/bootstrap/cli/registry.d.ts +6 -6
  11. package/dist/bootstrap/commands/accounts/cli.d.ts +2 -3
  12. package/dist/bootstrap/commands/accounts/cli.js +5 -10
  13. package/dist/bootstrap/commands/accrued-interests/cli.d.ts +2 -3
  14. package/dist/bootstrap/commands/accrued-interests/cli.js +5 -10
  15. package/dist/bootstrap/commands/asset/cli.d.ts +2 -3
  16. package/dist/bootstrap/commands/asset/cli.js +5 -10
  17. package/dist/bootstrap/commands/assets/cli.d.ts +2 -3
  18. package/dist/bootstrap/commands/assets/cli.js +5 -10
  19. package/dist/bootstrap/commands/bond/cli.d.ts +2 -3
  20. package/dist/bootstrap/commands/bond/cli.js +5 -10
  21. package/dist/bootstrap/commands/bond-coupons/cli.d.ts +2 -3
  22. package/dist/bootstrap/commands/bond-coupons/cli.js +5 -10
  23. package/dist/bootstrap/commands/bonds/cli.d.ts +2 -3
  24. package/dist/bootstrap/commands/bonds/cli.js +5 -10
  25. package/dist/bootstrap/commands/brand/cli.d.ts +2 -3
  26. package/dist/bootstrap/commands/brand/cli.js +5 -10
  27. package/dist/bootstrap/commands/brands/cli.d.ts +2 -3
  28. package/dist/bootstrap/commands/brands/cli.js +5 -10
  29. package/dist/bootstrap/commands/broker-report/cli.d.ts +2 -3
  30. package/dist/bootstrap/commands/broker-report/cli.js +5 -10
  31. package/dist/bootstrap/commands/cancel-order/cli.d.ts +3 -39
  32. package/dist/bootstrap/commands/cancel-order/cli.js +8 -19
  33. package/dist/bootstrap/commands/cancel-order/request.mapper.d.ts +7 -0
  34. package/dist/bootstrap/commands/cancel-order/request.mapper.js +9 -0
  35. package/dist/bootstrap/commands/cancel-stop-order/cli.d.ts +3 -4
  36. package/dist/bootstrap/commands/cancel-stop-order/cli.js +6 -11
  37. package/dist/bootstrap/commands/candles/cli.d.ts +3 -4
  38. package/dist/bootstrap/commands/candles/cli.js +6 -11
  39. package/dist/bootstrap/commands/close-prices/cli.d.ts +3 -4
  40. package/dist/bootstrap/commands/close-prices/cli.js +6 -11
  41. package/dist/bootstrap/commands/countries/cli.d.ts +2 -3
  42. package/dist/bootstrap/commands/countries/cli.js +5 -10
  43. package/dist/bootstrap/commands/currencies/cli.d.ts +2 -3
  44. package/dist/bootstrap/commands/currencies/cli.js +5 -10
  45. package/dist/bootstrap/commands/currency/cli.d.ts +2 -3
  46. package/dist/bootstrap/commands/currency/cli.js +5 -10
  47. package/dist/bootstrap/commands/dividends/cli.d.ts +2 -3
  48. package/dist/bootstrap/commands/dividends/cli.js +5 -10
  49. package/dist/bootstrap/commands/dividends-foreign-issuer/cli.d.ts +2 -3
  50. package/dist/bootstrap/commands/dividends-foreign-issuer/cli.js +5 -10
  51. package/dist/bootstrap/commands/edit-favorites/cli.d.ts +2 -3
  52. package/dist/bootstrap/commands/edit-favorites/cli.js +5 -10
  53. package/dist/bootstrap/commands/etf/cli.d.ts +2 -3
  54. package/dist/bootstrap/commands/etf/cli.js +5 -10
  55. package/dist/bootstrap/commands/etfs/cli.d.ts +2 -3
  56. package/dist/bootstrap/commands/etfs/cli.js +5 -10
  57. package/dist/bootstrap/commands/favorites/cli.d.ts +2 -3
  58. package/dist/bootstrap/commands/favorites/cli.js +5 -10
  59. package/dist/bootstrap/commands/find-instrument/cli.d.ts +2 -3
  60. package/dist/bootstrap/commands/find-instrument/cli.js +5 -10
  61. package/dist/bootstrap/commands/future/cli.d.ts +2 -3
  62. package/dist/bootstrap/commands/future/cli.js +5 -10
  63. package/dist/bootstrap/commands/futures/cli.d.ts +2 -3
  64. package/dist/bootstrap/commands/futures/cli.js +5 -10
  65. package/dist/bootstrap/commands/futures-margin/cli.d.ts +2 -3
  66. package/dist/bootstrap/commands/futures-margin/cli.js +5 -10
  67. package/dist/bootstrap/commands/instrument/cli.d.ts +2 -3
  68. package/dist/bootstrap/commands/instrument/cli.js +5 -10
  69. package/dist/bootstrap/commands/last-prices/cli.d.ts +3 -4
  70. package/dist/bootstrap/commands/last-prices/cli.js +6 -11
  71. package/dist/bootstrap/commands/last-trades/cli.d.ts +3 -4
  72. package/dist/bootstrap/commands/last-trades/cli.js +6 -11
  73. package/dist/bootstrap/commands/margin-attributes/cli.d.ts +2 -3
  74. package/dist/bootstrap/commands/margin-attributes/cli.js +5 -10
  75. package/dist/bootstrap/commands/operations/cli.d.ts +5 -53
  76. package/dist/bootstrap/commands/operations/cli.js +9 -36
  77. package/dist/bootstrap/commands/operations/request.mapper.d.ts +23 -0
  78. package/dist/bootstrap/commands/operations/request.mapper.js +33 -0
  79. package/dist/bootstrap/commands/operations-by-cursor/cli.d.ts +5 -69
  80. package/dist/bootstrap/commands/operations-by-cursor/cli.js +9 -74
  81. package/dist/bootstrap/commands/operations-by-cursor/request.mapper.d.ts +28 -0
  82. package/dist/bootstrap/commands/operations-by-cursor/request.mapper.js +70 -0
  83. package/dist/bootstrap/commands/option/cli.d.ts +2 -3
  84. package/dist/bootstrap/commands/option/cli.js +5 -10
  85. package/dist/bootstrap/commands/options-by/cli.d.ts +2 -3
  86. package/dist/bootstrap/commands/options-by/cli.js +5 -10
  87. package/dist/bootstrap/commands/order-book/cli.d.ts +3 -4
  88. package/dist/bootstrap/commands/order-book/cli.js +6 -11
  89. package/dist/bootstrap/commands/order-state/cli.d.ts +3 -36
  90. package/dist/bootstrap/commands/order-state/cli.js +8 -21
  91. package/dist/bootstrap/commands/order-state/request.mapper.d.ts +13 -0
  92. package/dist/bootstrap/commands/order-state/request.mapper.js +17 -0
  93. package/dist/bootstrap/commands/orders/cli.d.ts +3 -32
  94. package/dist/bootstrap/commands/orders/cli.js +8 -18
  95. package/dist/bootstrap/commands/orders/request.mapper.d.ts +6 -0
  96. package/dist/bootstrap/commands/orders/request.mapper.js +8 -0
  97. package/dist/bootstrap/commands/portfolio/cli.d.ts +6 -40
  98. package/dist/bootstrap/commands/portfolio/cli.js +9 -26
  99. package/dist/bootstrap/commands/portfolio/request.mapper.d.ts +18 -0
  100. package/dist/bootstrap/commands/portfolio/request.mapper.js +21 -0
  101. package/dist/bootstrap/commands/positions/cli.d.ts +3 -32
  102. package/dist/bootstrap/commands/positions/cli.js +8 -18
  103. package/dist/bootstrap/commands/positions/request.mapper.d.ts +6 -0
  104. package/dist/bootstrap/commands/positions/request.mapper.js +8 -0
  105. package/dist/bootstrap/commands/post-order/cli.d.ts +8 -68
  106. package/dist/bootstrap/commands/post-order/cli.js +9 -39
  107. package/dist/bootstrap/commands/post-order/request.mapper.d.ts +27 -0
  108. package/dist/bootstrap/commands/post-order/request.mapper.js +35 -0
  109. package/dist/bootstrap/commands/post-stop-order/cli.d.ts +3 -4
  110. package/dist/bootstrap/commands/post-stop-order/cli.js +6 -11
  111. package/dist/bootstrap/commands/replace-order/cli.d.ts +5 -61
  112. package/dist/bootstrap/commands/replace-order/cli.js +9 -30
  113. package/dist/bootstrap/commands/replace-order/request.mapper.d.ts +22 -0
  114. package/dist/bootstrap/commands/replace-order/request.mapper.js +26 -0
  115. package/dist/bootstrap/commands/sandbox-accounts/cli.d.ts +2 -3
  116. package/dist/bootstrap/commands/sandbox-accounts/cli.js +5 -10
  117. package/dist/bootstrap/commands/sandbox-cancel-order/cli.d.ts +3 -4
  118. package/dist/bootstrap/commands/sandbox-cancel-order/cli.js +8 -13
  119. package/dist/bootstrap/commands/sandbox-close-account/cli.d.ts +2 -3
  120. package/dist/bootstrap/commands/sandbox-close-account/cli.js +5 -10
  121. package/dist/bootstrap/commands/sandbox-open-account/cli.d.ts +2 -3
  122. package/dist/bootstrap/commands/sandbox-open-account/cli.js +5 -10
  123. package/dist/bootstrap/commands/sandbox-operations/cli.d.ts +3 -4
  124. package/dist/bootstrap/commands/sandbox-operations/cli.js +8 -13
  125. package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.d.ts +3 -4
  126. package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.js +8 -13
  127. package/dist/bootstrap/commands/sandbox-order-state/cli.d.ts +3 -4
  128. package/dist/bootstrap/commands/sandbox-order-state/cli.js +8 -13
  129. package/dist/bootstrap/commands/sandbox-orders/cli.d.ts +3 -4
  130. package/dist/bootstrap/commands/sandbox-orders/cli.js +8 -13
  131. package/dist/bootstrap/commands/sandbox-pay-in/cli.d.ts +2 -3
  132. package/dist/bootstrap/commands/sandbox-pay-in/cli.js +5 -10
  133. package/dist/bootstrap/commands/sandbox-portfolio/cli.d.ts +3 -4
  134. package/dist/bootstrap/commands/sandbox-portfolio/cli.js +8 -13
  135. package/dist/bootstrap/commands/sandbox-positions/cli.d.ts +3 -4
  136. package/dist/bootstrap/commands/sandbox-positions/cli.js +8 -13
  137. package/dist/bootstrap/commands/sandbox-post-order/cli.d.ts +3 -4
  138. package/dist/bootstrap/commands/sandbox-post-order/cli.js +8 -13
  139. package/dist/bootstrap/commands/sandbox-replace-order/cli.d.ts +3 -4
  140. package/dist/bootstrap/commands/sandbox-replace-order/cli.js +8 -13
  141. package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.d.ts +3 -4
  142. package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.js +8 -13
  143. package/dist/bootstrap/commands/sdk-command-lifecycle.d.ts +15 -0
  144. package/dist/bootstrap/commands/sdk-command-lifecycle.js +21 -0
  145. package/dist/bootstrap/commands/share/cli.d.ts +2 -3
  146. package/dist/bootstrap/commands/share/cli.js +5 -10
  147. package/dist/bootstrap/commands/shares/cli.d.ts +2 -3
  148. package/dist/bootstrap/commands/shares/cli.js +5 -10
  149. package/dist/bootstrap/commands/stop-orders/cli.d.ts +3 -4
  150. package/dist/bootstrap/commands/stop-orders/cli.js +6 -11
  151. package/dist/bootstrap/commands/stream-run/cli.d.ts +2 -24
  152. package/dist/bootstrap/commands/stream-run/cli.js +7 -142
  153. package/dist/bootstrap/commands/stream-run/config.d.ts +7 -15
  154. package/dist/bootstrap/commands/stream-run/config.js +1 -101
  155. package/dist/bootstrap/commands/stream-run/request.mapper.d.ts +14 -0
  156. package/dist/bootstrap/commands/stream-run/request.mapper.js +111 -0
  157. package/dist/bootstrap/commands/stream-run/stream-session.d.ts +37 -0
  158. package/dist/bootstrap/commands/stream-run/stream-session.js +152 -0
  159. package/dist/bootstrap/commands/trading-schedules/cli.d.ts +2 -3
  160. package/dist/bootstrap/commands/trading-schedules/cli.js +5 -10
  161. package/dist/bootstrap/commands/trading-status/cli.d.ts +3 -4
  162. package/dist/bootstrap/commands/trading-status/cli.js +6 -11
  163. package/dist/bootstrap/commands/trading-statuses/cli.d.ts +3 -4
  164. package/dist/bootstrap/commands/trading-statuses/cli.js +6 -11
  165. package/dist/bootstrap/commands/user-info/cli.d.ts +2 -3
  166. package/dist/bootstrap/commands/user-info/cli.js +5 -10
  167. package/dist/bootstrap/commands/user-tariff/cli.d.ts +2 -3
  168. package/dist/bootstrap/commands/user-tariff/cli.js +5 -10
  169. package/dist/bootstrap/commands/withdraw-limits/cli.d.ts +3 -32
  170. package/dist/bootstrap/commands/withdraw-limits/cli.js +8 -18
  171. package/dist/bootstrap/commands/withdraw-limits/request.mapper.d.ts +6 -0
  172. package/dist/bootstrap/commands/withdraw-limits/request.mapper.js +8 -0
  173. package/dist/bootstrap/index.js +2 -2
  174. package/dist/bootstrap/proto/compile-proto.d.ts +1 -1
  175. package/dist/bootstrap/proto/compile-proto.js +28 -35
  176. package/dist/bootstrap/t-invest-node-sdk.d.ts +9 -9
  177. package/dist/bootstrap/t-invest-node-sdk.js +33 -18
  178. package/dist/bootstrap/unary-limit-config.js +4 -4
  179. package/dist/generated/common.js +1 -1
  180. package/dist/generated/google/api/field_behavior.js +1 -1
  181. package/dist/generated/google/protobuf/descriptor.js +1 -1
  182. package/dist/generated/google/protobuf/timestamp.js +1 -1
  183. package/dist/generated/instruments.js +1 -1
  184. package/dist/generated/marketdata.js +1 -1
  185. package/dist/generated/operations.js +1 -1
  186. package/dist/generated/orders.js +1 -1
  187. package/dist/generated/sandbox.js +1 -1
  188. package/dist/generated/signals.js +1 -1
  189. package/dist/generated/stoporders.js +1 -1
  190. package/dist/generated/users.js +1 -1
  191. package/dist/infrastructure/interceptor/warning-interceptor.d.ts +1 -1
  192. package/dist/infrastructure/interceptor/warning-interceptor.js +2 -2
  193. package/dist/infrastructure/transport/grpc/sdk-call-error.d.ts +12 -0
  194. package/dist/infrastructure/transport/grpc/sdk-call-error.js +180 -0
  195. package/dist/infrastructure/transport/grpc/sdk-client.d.ts +1 -1
  196. package/dist/infrastructure/transport/grpc/sdk-client.js +2 -2
  197. package/dist/infrastructure/transport/grpc/sdk-middleware.d.ts +1 -1
  198. package/dist/infrastructure/transport/grpc/sdk-middleware.js +8 -174
  199. package/dist/infrastructure/transport/grpc/unary-limit-resolver.d.ts +3 -1
  200. package/dist/infrastructure/transport/grpc/unary-limit-resolver.js +19 -18
  201. package/docs/architecture.md +88 -259
  202. package/docs/bundled-ca.md +19 -65
  203. package/docs/clean-architecture/adapters.md +26 -55
  204. package/docs/clean-architecture/api-commands.md +141 -263
  205. package/docs/clean-architecture/application.md +20 -46
  206. package/docs/clean-architecture/cli-output-boundaries.md +34 -74
  207. package/docs/clean-architecture/dto.md +18 -45
  208. package/docs/clean-architecture/index.md +18 -29
  209. package/docs/cli-stream-configuration.md +18 -40
  210. package/docs/cli-stream-reference.md +16 -44
  211. package/docs/guides/custom-unary-limiter.md +47 -117
  212. package/docs/guides/errors-and-lifecycle.md +17 -50
  213. package/docs/guides/getting-started.md +12 -26
  214. package/docs/guides/index.md +9 -20
  215. package/docs/guides/streams-and-cancellation.md +6 -21
  216. package/docs/guides/testing-with-service-definitions.md +5 -13
  217. package/docs/guides/unary-calls.md +22 -57
  218. package/docs/index.md +26 -55
  219. package/docs/limits-policy.md +25 -84
  220. package/docs/roadmap.md +35 -92
  221. package/docs/tls-policy.md +11 -34
  222. package/package.json +2 -1
  223. package/readme.md +75 -216
  224. package/dist/infrastructure/interceptor/index.d.ts +0 -1
  225. package/dist/infrastructure/interceptor/index.js +0 -17
  226. /package/dist/infrastructure/transport/grpc/{unary-limits.d.ts → unary-method-path.d.ts} +0 -0
  227. /package/dist/infrastructure/transport/grpc/{unary-limits.js → unary-method-path.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -13,32 +13,49 @@
13
13
 
14
14
  ## [Не выпущено]
15
15
 
16
+ ## [0.5.3] - 2026-09-09
17
+
18
+ ### Изменено
19
+
20
+ - Публичные service getters фасада приведены к именам `marketData` и `stopOrders`.
21
+ - Повторяемый lifecycle 66 коротких API-команд вынесен в `runSdkCommand()`. Общий production/Sandbox request mapping больше не импортируется через соседние command entrypoints, а formatter-ы доступны только из файлов-владельцев.
22
+ - Config parsing, generated request mapping и lifecycle команды `stream run` разделены по самостоятельным модулям; transport error classification отделена от выполнения gRPC middleware, а статический каталог CLI-справки — от rendering.
23
+ - Внутренние имена facade client cache, service client factory, in-memory limiter и process warning hook приведены к их фактической ответственности. Файл построения gRPC method path переименован в `unary-method-path.ts`, однострочный interceptor barrel удалён.
24
+ - Разрешение unary-квоты больше не перебирает всю таблицу правил для каждого
25
+ RPC: точный method path и service fallback читаются напрямую с прежним
26
+ приоритетом.
27
+ - Генерация proto переведена с незакреплённого системного `protoc` на локальную
28
+ dev-зависимость `protoc@36.0.0`. Команда `dev compile-proto` не требует
29
+ compiler в `PATH`, не скачивает инструменты во время запуска и воспроизводит
30
+ прежний generated API; в generated-заголовках обновлена только версия
31
+ compiler.
32
+ - Документация переписана более прямым языком без изменения описанных API и runtime-контрактов.
33
+ - Полный текст Apache License 2.0 вынесен в корневой `LICENSE-APACHE-2.0`; `LICENSE` по-прежнему содержит только MIT License SDK, а `NOTICE` — границы сторонних компонентов, атрибуцию и условия Protocol Buffers.
34
+
35
+ ## [0.5.2] - 2026-09-08
36
+
16
37
  ### Добавлено
17
38
 
18
- - Добавлен отдельный документ о встроенном Russian Trusted Root CA: в нём
19
- зафиксированы официальный источник и путь получения, X.509 fingerprint,
20
- официальный прецедент T-Invest Python SDK, границы распространения, package
21
- path и пример `tls.rootCertificates`. MIT License SDK явно не представлена
22
- как отдельное лицензионное разрешение на сертификат.
39
+ - В README добавлены бейджи версии npm-пакета, поддерживаемой версии Node.js,
40
+ наличия TypeScript declarations и лицензии.
23
41
 
24
42
  ### Изменено
25
43
 
26
- - Пакет подготовлен к публичной публикации в npm под именем
27
- `@woodger/t-invest-node-sdk`: снят флаг `private`, для пакета с областью
28
- видимости явно задан `publishConfig.access: public`, а сборка архива
29
- перенесена с `prepare` на `prepack`. Поддерживаемым каналом установки
30
- становится реестр npm; при установке Git-зависимости npm по-прежнему запускает
31
- `prepack`. Имя CLI-команды и вывод версии остаются `t-invest-node-sdk`.
32
- - Для T-Invest proto-контрактов версии 1.49 и производного generated-кода
33
- зафиксирована Apache License 2.0 со ссылкой на официальный
34
- `ru.tinkoff.piapi:java-sdk-grpc-contract:1.49`. Полный текст лицензии
35
- приведён в `THIRD_PARTY_NOTICES.md` и включён в package archive; MIT License
36
- продолжает применяться только к собственному коду SDK.
44
+ - В README и `docs/**/*.md` удалены ручные переносы обычных абзацев и пробелы в
45
+ конце строк. Правило однострочного хранения абзацев закреплено в политике
46
+ документации; содержание документов, таблиц и блоков кода не изменено.
47
+ - Раздел установки в README сокращён до публичного имени пакета, требования к
48
+ Node.js и команды `npm install`.
37
49
 
38
50
  ## [0.5.1] - 2026-09-08
39
51
 
40
52
  ### Добавлено
41
53
 
54
+ - Добавлен отдельный документ о встроенном Russian Trusted Root CA: в нём
55
+ зафиксированы официальный источник и путь получения, X.509 fingerprint,
56
+ официальный прецедент T-Invest Python SDK, границы распространения, package
57
+ path и пример `tls.rootCertificates`. MIT License SDK явно не представлена
58
+ как отдельное лицензионное разрешение на сертификат.
42
59
  - Добавлен публичный структурный port `TInvestUnaryLimiter`. Перед каждым
43
60
  unary transport call SDK передаёт реализации полный gRPC `path`,
44
61
  разрешённые `bucket`, `maxRequests`, `windowMs` и объединённый
@@ -53,6 +70,17 @@
53
70
 
54
71
  ### Изменено
55
72
 
73
+ - Пакет подготовлен к публичной публикации в npm под именем
74
+ `@woodger/t-invest-node-sdk`: снят флаг `private`, для пакета с областью
75
+ видимости явно задан `publishConfig.access: public`, а сборка архива
76
+ перенесена с `prepare` на `prepack`. Поддерживаемым каналом установки
77
+ становится реестр npm; при установке Git-зависимости npm по-прежнему запускает
78
+ `prepack`. Имя CLI-команды и вывод версии остаются `t-invest-node-sdk`.
79
+ - Для T-Invest proto-контрактов версии 1.49 и производного generated-кода
80
+ зафиксирована Apache License 2.0 со ссылкой на официальный
81
+ `ru.tinkoff.piapi:java-sdk-grpc-contract:1.49`. Полный текст лицензии
82
+ приведён в `THIRD_PARTY_NOTICES.md` и включён в package archive; MIT License
83
+ продолжает применяться только к собственному коду SDK.
56
84
  - Unary limiter больше не создаётся фасадом SDK автоматически. Без
57
85
  `TInvestOptions.unaryLimiter` unary-вызов сразу передаётся transport-у;
58
86
  встроенный CLI также не добавляет limiter. Streams через этот port не
@@ -1,108 +1,4 @@
1
- # Уведомления о сторонних компонентах
2
-
3
- MIT License в [`LICENSE`](./LICENSE) применяется к исходному коду SDK,
4
- созданному в этом проекте. Артефакты, полученные из сторонних proto-контрактов,
5
- остаются под условиями соответствующих правообладателей.
6
-
7
- ## T-Invest API contracts
8
-
9
- Пакет содержит JavaScript-код и TypeScript declarations, сгенерированные из
10
- официальных proto-контрактов T-Invest API версии 1.49. Исходный snapshot
11
- зафиксирован в
12
- [`contracts/upstream.json`](https://github.com/woodger/t-invest-node-sdk/blob/main/contracts/upstream.json).
13
-
14
- Официальный артефакт
15
- [`ru.tinkoff.piapi:java-sdk-grpc-contract:1.49`](https://central.sonatype.com/artifact/ru.tinkoff.piapi/java-sdk-grpc-contract/1.49)
16
- содержит тот же snapshot контрактов и опубликован на условиях Apache License
17
- 2.0. Сгенерированные из этих контрактов файлы `dist/generated/*.js` и
18
- `dist/generated/*.d.ts` распространяются с сохранением этих условий. Полный
19
- текст лицензии приведён в разделе
20
- [`Apache License 2.0`](#apache-license-20).
21
-
22
- Проект не заявляет права собственности на контракты и не является
23
- аффилированным, одобренным или спонсируемым T-Invest, T-Bank либо связанными с
24
- ними организациями.
25
-
26
- ## Russian Trusted Root CA
27
-
28
- Пакет содержит публичный корневой X.509-сертификат Russian Trusted Root CA,
29
- полученный по официальному маршруту со страницы сертификатов Госуслуг и
30
- используемый для проверки TLS-цепочки T-Invest API. Соответствующий приватный
31
- ключ в пакет не входит.
32
-
33
- Проект не заявляет авторство сертификата и не представляет MIT License SDK как
34
- отдельное лицензионное разрешение на этот trust material. Официальный источник,
35
- X.509 fingerprint, основание package-модели и границы распространения описаны в
36
- документе
37
- [`docs/bundled-ca.md`](./docs/bundled-ca.md).
38
-
39
- ## Google API field behavior contract
40
-
41
- Пакет содержит артефакты, полученные из
42
- [`google/api/field_behavior.proto`](https://github.com/googleapis/googleapis/blob/master/google/api/field_behavior.proto).
43
- Исходный контракт опубликован на условиях Apache License 2.0. Полный текст
44
- лицензии приведён в разделе [`Apache License 2.0`](#apache-license-20).
45
-
46
- Исходный контракт содержит следующее уведомление:
47
-
48
- ```text
49
- Copyright 2023 Google LLC
50
-
51
- Licensed under the Apache License, Version 2.0 (the "License");
52
- you may not use this file except in compliance with the License.
53
- You may obtain a copy of the License at
54
-
55
- http://www.apache.org/licenses/LICENSE-2.0
56
-
57
- Unless required by applicable law or agreed to in writing, software
58
- distributed under the License is distributed on an "AS IS" BASIS,
59
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60
- See the License for the specific language governing permissions and
61
- limitations under the License.
62
- ```
63
-
64
- ## Google Protocol Buffers contracts
65
-
66
- Пакет может содержать артефакты, полученные из контрактов Google Protocol
67
- Buffers. Исходные контракты содержат следующее уведомление:
68
-
69
- ```text
70
- Protocol Buffers - Google's data interchange format
71
- Copyright 2008 Google Inc. All rights reserved.
72
- https://developers.google.com/protocol-buffers/
73
-
74
- Redistribution and use in source and binary forms, with or without
75
- modification, are permitted provided that the following conditions are
76
- met:
77
-
78
- * Redistributions of source code must retain the above copyright
79
- notice, this list of conditions and the following disclaimer.
80
- * Redistributions in binary form must reproduce the above
81
- copyright notice, this list of conditions and the following disclaimer
82
- in the documentation and/or other materials provided with the
83
- distribution.
84
- * Neither the name of Google Inc. nor the names of its
85
- contributors may be used to endorse or promote products derived from
86
- this software without specific prior written permission.
87
-
88
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
89
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
90
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
91
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
92
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
93
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
94
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
95
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
96
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
97
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
98
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99
- ```
100
-
101
- ## Apache License 2.0
102
-
103
- Полный текст лицензии, применяемой к указанным выше компонентам:
104
-
105
- ```text
1
+
106
2
  Apache License
107
3
  Version 2.0, January 2004
108
4
  http://www.apache.org/licenses/
@@ -304,4 +200,3 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
304
200
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
305
201
  See the License for the specific language governing permissions and
306
202
  limitations under the License.
307
- ```
package/NOTICE ADDED
@@ -0,0 +1,98 @@
1
+ # Уведомления о сторонних компонентах
2
+
3
+ MIT License в [`LICENSE`](./LICENSE) применяется к исходному коду SDK,
4
+ созданному в этом проекте. Артефакты, полученные из сторонних proto-контрактов,
5
+ остаются под условиями соответствующих правообладателей.
6
+
7
+ ## T-Invest API contracts
8
+
9
+ Пакет содержит JavaScript-код и TypeScript declarations, сгенерированные из
10
+ официальных proto-контрактов T-Invest API версии 1.49. Исходный snapshot
11
+ зафиксирован в
12
+ [`contracts/upstream.json`](https://github.com/woodger/t-invest-node-sdk/blob/main/contracts/upstream.json).
13
+
14
+ Официальный артефакт
15
+ [`ru.tinkoff.piapi:java-sdk-grpc-contract:1.49`](https://central.sonatype.com/artifact/ru.tinkoff.piapi/java-sdk-grpc-contract/1.49)
16
+ содержит тот же snapshot контрактов и опубликован на условиях Apache License
17
+ 2.0. Сгенерированные из этих контрактов файлы `dist/generated/*.js` и
18
+ `dist/generated/*.d.ts` распространяются с сохранением этих условий. Полный
19
+ текст лицензии приведён в [`LICENSE-APACHE-2.0`](./LICENSE-APACHE-2.0).
20
+
21
+ Проект не заявляет права собственности на контракты и не является
22
+ аффилированным, одобренным или спонсируемым T-Invest, T-Bank либо связанными с
23
+ ними организациями.
24
+
25
+ ## Russian Trusted Root CA
26
+
27
+ Пакет содержит публичный корневой X.509-сертификат Russian Trusted Root CA,
28
+ полученный по официальному маршруту со страницы сертификатов Госуслуг и
29
+ используемый для проверки TLS-цепочки T-Invest API. Соответствующий приватный
30
+ ключ в пакет не входит.
31
+
32
+ Проект не заявляет авторство сертификата и не представляет MIT License SDK как
33
+ отдельное лицензионное разрешение на этот trust material. Официальный источник,
34
+ X.509 fingerprint, основание package-модели и границы распространения описаны в
35
+ документе
36
+ [`docs/bundled-ca.md`](./docs/bundled-ca.md).
37
+
38
+ ## Google API field behavior contract
39
+
40
+ Пакет содержит артефакты, полученные из
41
+ [`google/api/field_behavior.proto`](https://github.com/googleapis/googleapis/blob/master/google/api/field_behavior.proto).
42
+ Исходный контракт опубликован на условиях Apache License 2.0. Полный текст
43
+ лицензии приведён в [`LICENSE-APACHE-2.0`](./LICENSE-APACHE-2.0).
44
+
45
+ Исходный контракт содержит следующее уведомление:
46
+
47
+ ```text
48
+ Copyright 2023 Google LLC
49
+
50
+ Licensed under the Apache License, Version 2.0 (the "License");
51
+ you may not use this file except in compliance with the License.
52
+ You may obtain a copy of the License at
53
+
54
+ http://www.apache.org/licenses/LICENSE-2.0
55
+
56
+ Unless required by applicable law or agreed to in writing, software
57
+ distributed under the License is distributed on an "AS IS" BASIS,
58
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
+ See the License for the specific language governing permissions and
60
+ limitations under the License.
61
+ ```
62
+
63
+ ## Google Protocol Buffers contracts
64
+
65
+ Пакет может содержать артефакты, полученные из контрактов Google Protocol
66
+ Buffers. Исходные контракты содержат следующее уведомление:
67
+
68
+ ```text
69
+ Protocol Buffers - Google's data interchange format
70
+ Copyright 2008 Google Inc. All rights reserved.
71
+ https://developers.google.com/protocol-buffers/
72
+
73
+ Redistribution and use in source and binary forms, with or without
74
+ modification, are permitted provided that the following conditions are
75
+ met:
76
+
77
+ * Redistributions of source code must retain the above copyright
78
+ notice, this list of conditions and the following disclaimer.
79
+ * Redistributions in binary form must reproduce the above
80
+ copyright notice, this list of conditions and the following disclaimer
81
+ in the documentation and/or other materials provided with the
82
+ distribution.
83
+ * Neither the name of Google Inc. nor the names of its
84
+ contributors may be used to endorse or promote products derived from
85
+ this software without specific prior written permission.
86
+
87
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
88
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
89
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
90
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
91
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
92
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
93
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
94
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
95
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
96
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
97
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
98
+ ```
@@ -27,11 +27,11 @@ class InMemoryUnaryLimiter {
27
27
  if (context.signal.aborted) {
28
28
  throw abortReason(context.signal);
29
29
  }
30
- const interval = Math.ceil(context.quota.windowMs / context.quota.maxRequests);
30
+ const intervalMs = Math.ceil(context.quota.windowMs / context.quota.maxRequests);
31
31
  const schedule = this.getSchedule(context.quota);
32
32
  await new Promise((resolve, reject) => {
33
33
  const request = {
34
- interval,
34
+ intervalMs,
35
35
  signal: context.signal,
36
36
  resolve,
37
37
  reject,
@@ -40,7 +40,7 @@ class InMemoryUnaryLimiter {
40
40
  }
41
41
  };
42
42
  context.signal.addEventListener('abort', request.onAbort, { once: true });
43
- schedule.requests.push(request);
43
+ schedule.pendingRequests.push(request);
44
44
  this.start(schedule);
45
45
  });
46
46
  }
@@ -51,7 +51,7 @@ class InMemoryUnaryLimiter {
51
51
  maxRequests: quota.maxRequests,
52
52
  windowMs: quota.windowMs,
53
53
  nextAvailableAt: 0,
54
- requests: [],
54
+ pendingRequests: [],
55
55
  timer: undefined
56
56
  };
57
57
  this.schedules.set(quota.bucket, schedule);
@@ -63,7 +63,7 @@ class InMemoryUnaryLimiter {
63
63
  return schedule;
64
64
  }
65
65
  start(schedule) {
66
- if (schedule.timer !== undefined || schedule.requests.length === 0) {
66
+ if (schedule.timer !== undefined || schedule.pendingRequests.length === 0) {
67
67
  return;
68
68
  }
69
69
  const time = performance.now();
@@ -90,23 +90,23 @@ class InMemoryUnaryLimiter {
90
90
  }, Math.min(delay, maxTimerDelayMs));
91
91
  }
92
92
  dispatch(schedule, scheduledAt) {
93
- const request = schedule.requests.shift();
93
+ const request = schedule.pendingRequests.shift();
94
94
  if (request === undefined) {
95
95
  return;
96
96
  }
97
97
  request.signal.removeEventListener('abort', request.onAbort);
98
98
  const dispatchedAt = Math.max(scheduledAt, performance.now());
99
- schedule.nextAvailableAt = dispatchedAt + request.interval;
99
+ schedule.nextAvailableAt = dispatchedAt + request.intervalMs;
100
100
  request.resolve();
101
101
  this.start(schedule);
102
102
  }
103
103
  cancel(schedule, request) {
104
- const requestIndex = schedule.requests.indexOf(request);
104
+ const requestIndex = schedule.pendingRequests.indexOf(request);
105
105
  if (requestIndex < 0) {
106
106
  return;
107
107
  }
108
108
  const isHead = requestIndex === 0;
109
- schedule.requests.splice(requestIndex, 1);
109
+ schedule.pendingRequests.splice(requestIndex, 1);
110
110
  request.signal.removeEventListener('abort', request.onAbort);
111
111
  if (isHead) {
112
112
  this.clearTimer(schedule);
@@ -9,11 +9,10 @@
9
9
  * Здесь не должно быть создания `TInvestNodeSDK` или вызовов API.
10
10
  */
11
11
  import type { TInvestOptions } from '../../application/dto/t-invest-options';
12
- type SdkCommandOptions = {
12
+ export type SdkCommandOptions = {
13
13
  token?: string | undefined;
14
14
  endpoint?: string | undefined;
15
15
  'app-name'?: string | undefined;
16
16
  insecure?: boolean | undefined;
17
17
  };
18
18
  export declare function resolveSdkOptionsFromCommandOptions(options: SdkCommandOptions, env?: NodeJS.ProcessEnv): TInvestOptions;
19
- export {};