@zeitvu97/cms-sdk 0.1.0

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 (274) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +478 -0
  3. package/dist/chunks/_shared-48T7q0V3.js +26 -0
  4. package/dist/chunks/_shared-48T7q0V3.js.map +1 -0
  5. package/dist/chunks/auth.constant-DO7ZmsKg.js +68 -0
  6. package/dist/chunks/auth.constant-DO7ZmsKg.js.map +1 -0
  7. package/dist/chunks/mt5Retcode-DlZLQOLA.js +178 -0
  8. package/dist/chunks/mt5Retcode-DlZLQOLA.js.map +1 -0
  9. package/dist/chunks/storage.constant--64BDSPW.js +44 -0
  10. package/dist/chunks/storage.constant--64BDSPW.js.map +1 -0
  11. package/dist/common/constants/auth.constant.d.ts +54 -0
  12. package/dist/common/constants/auth.constant.d.ts.map +1 -0
  13. package/dist/common/constants/bars.constant.d.ts +15 -0
  14. package/dist/common/constants/bars.constant.d.ts.map +1 -0
  15. package/dist/common/constants/content-types.constant.d.ts +29 -0
  16. package/dist/common/constants/content-types.constant.d.ts.map +1 -0
  17. package/dist/common/constants/content.constant.d.ts +114 -0
  18. package/dist/common/constants/content.constant.d.ts.map +1 -0
  19. package/dist/common/constants/executions.constant.d.ts +56 -0
  20. package/dist/common/constants/executions.constant.d.ts.map +1 -0
  21. package/dist/common/constants/gov.constant.d.ts +118 -0
  22. package/dist/common/constants/gov.constant.d.ts.map +1 -0
  23. package/dist/common/constants/history.constant.d.ts +108 -0
  24. package/dist/common/constants/history.constant.d.ts.map +1 -0
  25. package/dist/common/constants/http.constant.d.ts +46 -0
  26. package/dist/common/constants/http.constant.d.ts.map +1 -0
  27. package/dist/common/constants/index.d.ts +16 -0
  28. package/dist/common/constants/index.d.ts.map +1 -0
  29. package/dist/common/constants/kalshi.constant.d.ts +35 -0
  30. package/dist/common/constants/kalshi.constant.d.ts.map +1 -0
  31. package/dist/common/constants/llm.constant.d.ts +37 -0
  32. package/dist/common/constants/llm.constant.d.ts.map +1 -0
  33. package/dist/common/constants/mt5-action.constant.d.ts +131 -0
  34. package/dist/common/constants/mt5-action.constant.d.ts.map +1 -0
  35. package/dist/common/constants/mt5.constant.d.ts +254 -0
  36. package/dist/common/constants/mt5.constant.d.ts.map +1 -0
  37. package/dist/common/constants/notifications.constant.d.ts +45 -0
  38. package/dist/common/constants/notifications.constant.d.ts.map +1 -0
  39. package/dist/common/constants/people.constant.d.ts +269 -0
  40. package/dist/common/constants/people.constant.d.ts.map +1 -0
  41. package/dist/common/constants/rules.constant.d.ts +14 -0
  42. package/dist/common/constants/rules.constant.d.ts.map +1 -0
  43. package/dist/common/constants/settings.constant.d.ts +17 -0
  44. package/dist/common/constants/settings.constant.d.ts.map +1 -0
  45. package/dist/common/constants/sort.constant.d.ts +14 -0
  46. package/dist/common/constants/sort.constant.d.ts.map +1 -0
  47. package/dist/common/constants/storage.constant.d.ts +74 -0
  48. package/dist/common/constants/storage.constant.d.ts.map +1 -0
  49. package/dist/common/helpers/format.d.ts +7 -0
  50. package/dist/common/helpers/format.d.ts.map +1 -0
  51. package/dist/common/helpers/format.js +20 -0
  52. package/dist/common/helpers/format.js.map +1 -0
  53. package/dist/common/helpers/mt5Retcode.d.ts +18 -0
  54. package/dist/common/helpers/mt5Retcode.d.ts.map +1 -0
  55. package/dist/common/helpers/mt5Retcode.js +2 -0
  56. package/dist/common/helpers/mt5Retcode.js.map +1 -0
  57. package/dist/common/utils/case.d.ts +12 -0
  58. package/dist/common/utils/case.d.ts.map +1 -0
  59. package/dist/common/utils/clone.d.ts +9 -0
  60. package/dist/common/utils/clone.d.ts.map +1 -0
  61. package/dist/composables/cbsStateKey.d.ts +27 -0
  62. package/dist/composables/cbsStateKey.d.ts.map +1 -0
  63. package/dist/core/createApi.d.ts +69 -0
  64. package/dist/core/createApi.d.ts.map +1 -0
  65. package/dist/core/createCmsSDK.d.ts +19 -0
  66. package/dist/core/createCmsSDK.d.ts.map +1 -0
  67. package/dist/core/credentials/TokenManager.d.ts +38 -0
  68. package/dist/core/credentials/TokenManager.d.ts.map +1 -0
  69. package/dist/core/credentials/credential.type.d.ts +16 -0
  70. package/dist/core/credentials/credential.type.d.ts.map +1 -0
  71. package/dist/core/credentials/resolveStorage.d.ts +6 -0
  72. package/dist/core/credentials/resolveStorage.d.ts.map +1 -0
  73. package/dist/core/credentials/storages/cookieStorage.d.ts +18 -0
  74. package/dist/core/credentials/storages/cookieStorage.d.ts.map +1 -0
  75. package/dist/core/credentials/storages/localStorageAdapter.d.ts +8 -0
  76. package/dist/core/credentials/storages/localStorageAdapter.d.ts.map +1 -0
  77. package/dist/core/credentials/storages/memoryStorage.d.ts +7 -0
  78. package/dist/core/credentials/storages/memoryStorage.d.ts.map +1 -0
  79. package/dist/core/errors.d.ts +26 -0
  80. package/dist/core/errors.d.ts.map +1 -0
  81. package/dist/core/sdk.type.d.ts +115 -0
  82. package/dist/core/sdk.type.d.ts.map +1 -0
  83. package/dist/core/ws/createEaeraWebSocket.d.ts +21 -0
  84. package/dist/core/ws/createEaeraWebSocket.d.ts.map +1 -0
  85. package/dist/core/ws/index.d.ts +4 -0
  86. package/dist/core/ws/index.d.ts.map +1 -0
  87. package/dist/core/ws/ws.constants.d.ts +246 -0
  88. package/dist/core/ws/ws.constants.d.ts.map +1 -0
  89. package/dist/core/ws/ws.events.d.ts +264 -0
  90. package/dist/core/ws/ws.events.d.ts.map +1 -0
  91. package/dist/core/ws/ws.type.d.ts +225 -0
  92. package/dist/core/ws/ws.type.d.ts.map +1 -0
  93. package/dist/index.d.ts +130 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +8416 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/nuxt.d.ts +49 -0
  98. package/dist/nuxt.d.ts.map +1 -0
  99. package/dist/nuxt.js +47 -0
  100. package/dist/nuxt.js.map +1 -0
  101. package/dist/runtime/plugin.d.ts +6 -0
  102. package/dist/runtime/plugin.js +188 -0
  103. package/dist/runtime/plugin.js.map +1 -0
  104. package/dist/server/auth/cbs-callback.post.js +42 -0
  105. package/dist/server/auth/cbs-callback.post.js.map +1 -0
  106. package/dist/server/auth/cbs-start.post.js +34 -0
  107. package/dist/server/auth/cbs-start.post.js.map +1 -0
  108. package/dist/server/auth/idp-callback.get.js +52 -0
  109. package/dist/server/auth/idp-callback.get.js.map +1 -0
  110. package/dist/server/auth/idp-link.post.js +38 -0
  111. package/dist/server/auth/idp-link.post.js.map +1 -0
  112. package/dist/server/auth/idp-login.get.js +42 -0
  113. package/dist/server/auth/idp-login.get.js.map +1 -0
  114. package/dist/server/auth/idp-unlink.delete.js +38 -0
  115. package/dist/server/auth/idp-unlink.delete.js.map +1 -0
  116. package/dist/server/auth/login.post.js +42 -0
  117. package/dist/server/auth/login.post.js.map +1 -0
  118. package/dist/server/auth/logout.post.js +31 -0
  119. package/dist/server/auth/logout.post.js.map +1 -0
  120. package/dist/server/auth/refresh.post.js +46 -0
  121. package/dist/server/auth/refresh.post.js.map +1 -0
  122. package/dist/server/clear-token.delete.js +12 -0
  123. package/dist/server/clear-token.delete.js.map +1 -0
  124. package/dist/server/persist.post.js +31 -0
  125. package/dist/server/persist.post.js.map +1 -0
  126. package/dist/server/set-token.post.js +27 -0
  127. package/dist/server/set-token.post.js.map +1 -0
  128. package/dist/services/auth/auth.type.d.ts +66 -0
  129. package/dist/services/auth/auth.type.d.ts.map +1 -0
  130. package/dist/services/auth/index.d.ts +127 -0
  131. package/dist/services/auth/index.d.ts.map +1 -0
  132. package/dist/services/auth/mock.d.ts +13 -0
  133. package/dist/services/auth/mock.d.ts.map +1 -0
  134. package/dist/services/bars/bars.type.d.ts +78 -0
  135. package/dist/services/bars/bars.type.d.ts.map +1 -0
  136. package/dist/services/bars/index.d.ts +24 -0
  137. package/dist/services/bars/index.d.ts.map +1 -0
  138. package/dist/services/bars/mock.d.ts +23 -0
  139. package/dist/services/bars/mock.d.ts.map +1 -0
  140. package/dist/services/content/content.type.d.ts +832 -0
  141. package/dist/services/content/content.type.d.ts.map +1 -0
  142. package/dist/services/content/filter.d.ts +46 -0
  143. package/dist/services/content/filter.d.ts.map +1 -0
  144. package/dist/services/content/index.d.ts +35 -0
  145. package/dist/services/content/index.d.ts.map +1 -0
  146. package/dist/services/content/mock.d.ts +16 -0
  147. package/dist/services/content/mock.d.ts.map +1 -0
  148. package/dist/services/content-types/content-types.type.d.ts +70 -0
  149. package/dist/services/content-types/content-types.type.d.ts.map +1 -0
  150. package/dist/services/content-types/index.d.ts +18 -0
  151. package/dist/services/content-types/index.d.ts.map +1 -0
  152. package/dist/services/content-types/mock.d.ts +15 -0
  153. package/dist/services/content-types/mock.d.ts.map +1 -0
  154. package/dist/services/executions/executions.type.d.ts +67 -0
  155. package/dist/services/executions/executions.type.d.ts.map +1 -0
  156. package/dist/services/executions/index.d.ts +30 -0
  157. package/dist/services/executions/index.d.ts.map +1 -0
  158. package/dist/services/executions/mock.d.ts +29 -0
  159. package/dist/services/executions/mock.d.ts.map +1 -0
  160. package/dist/services/gov/gov.type.d.ts +740 -0
  161. package/dist/services/gov/gov.type.d.ts.map +1 -0
  162. package/dist/services/gov/index.d.ts +84 -0
  163. package/dist/services/gov/index.d.ts.map +1 -0
  164. package/dist/services/history/history.type.d.ts +167 -0
  165. package/dist/services/history/history.type.d.ts.map +1 -0
  166. package/dist/services/history/index.d.ts +38 -0
  167. package/dist/services/history/index.d.ts.map +1 -0
  168. package/dist/services/history/mock.d.ts +21 -0
  169. package/dist/services/history/mock.d.ts.map +1 -0
  170. package/dist/services/kalshi/index.d.ts +19 -0
  171. package/dist/services/kalshi/index.d.ts.map +1 -0
  172. package/dist/services/kalshi/kalshi.type.d.ts +99 -0
  173. package/dist/services/kalshi/kalshi.type.d.ts.map +1 -0
  174. package/dist/services/kalshi/mock.d.ts +5 -0
  175. package/dist/services/kalshi/mock.d.ts.map +1 -0
  176. package/dist/services/llm/index.d.ts +38 -0
  177. package/dist/services/llm/index.d.ts.map +1 -0
  178. package/dist/services/llm/llm.type.d.ts +106 -0
  179. package/dist/services/llm/llm.type.d.ts.map +1 -0
  180. package/dist/services/notifications/index.d.ts +38 -0
  181. package/dist/services/notifications/index.d.ts.map +1 -0
  182. package/dist/services/notifications/mock.d.ts +39 -0
  183. package/dist/services/notifications/mock.d.ts.map +1 -0
  184. package/dist/services/notifications/notifications.type.d.ts +75 -0
  185. package/dist/services/notifications/notifications.type.d.ts.map +1 -0
  186. package/dist/services/people/_invoke.d.ts +26 -0
  187. package/dist/services/people/_invoke.d.ts.map +1 -0
  188. package/dist/services/people/copilot/index.d.ts +132 -0
  189. package/dist/services/people/copilot/index.d.ts.map +1 -0
  190. package/dist/services/people/identity/actions.d.ts +116 -0
  191. package/dist/services/people/identity/actions.d.ts.map +1 -0
  192. package/dist/services/people/identity/ct.types.d.ts +133 -0
  193. package/dist/services/people/identity/ct.types.d.ts.map +1 -0
  194. package/dist/services/people/identity/index.d.ts +14 -0
  195. package/dist/services/people/identity/index.d.ts.map +1 -0
  196. package/dist/services/people/identity/projections.d.ts +63 -0
  197. package/dist/services/people/identity/projections.d.ts.map +1 -0
  198. package/dist/services/people/index.d.ts +31 -0
  199. package/dist/services/people/index.d.ts.map +1 -0
  200. package/dist/services/people/legal/actions.d.ts +161 -0
  201. package/dist/services/people/legal/actions.d.ts.map +1 -0
  202. package/dist/services/people/legal/ct.types.d.ts +186 -0
  203. package/dist/services/people/legal/ct.types.d.ts.map +1 -0
  204. package/dist/services/people/legal/index.d.ts +15 -0
  205. package/dist/services/people/legal/index.d.ts.map +1 -0
  206. package/dist/services/people/packops/index.d.ts +70 -0
  207. package/dist/services/people/packops/index.d.ts.map +1 -0
  208. package/dist/services/people/packops/packops.type.d.ts +183 -0
  209. package/dist/services/people/packops/packops.type.d.ts.map +1 -0
  210. package/dist/services/people/perms/actions.d.ts +214 -0
  211. package/dist/services/people/perms/actions.d.ts.map +1 -0
  212. package/dist/services/people/perms/ct.types.d.ts +140 -0
  213. package/dist/services/people/perms/ct.types.d.ts.map +1 -0
  214. package/dist/services/people/perms/index.d.ts +14 -0
  215. package/dist/services/people/perms/index.d.ts.map +1 -0
  216. package/dist/services/people/perms/projections.d.ts +47 -0
  217. package/dist/services/people/perms/projections.d.ts.map +1 -0
  218. package/dist/services/people/process/actions.d.ts +154 -0
  219. package/dist/services/people/process/actions.d.ts.map +1 -0
  220. package/dist/services/people/process/ct.types.d.ts +304 -0
  221. package/dist/services/people/process/ct.types.d.ts.map +1 -0
  222. package/dist/services/people/process/index.d.ts +12 -0
  223. package/dist/services/people/process/index.d.ts.map +1 -0
  224. package/dist/services/people/shared.types.d.ts +36 -0
  225. package/dist/services/people/shared.types.d.ts.map +1 -0
  226. package/dist/services/rules/conditions.d.ts +264 -0
  227. package/dist/services/rules/conditions.d.ts.map +1 -0
  228. package/dist/services/rules/index.d.ts +49 -0
  229. package/dist/services/rules/index.d.ts.map +1 -0
  230. package/dist/services/rules/llm-rule.constant.d.ts +84 -0
  231. package/dist/services/rules/llm-rule.constant.d.ts.map +1 -0
  232. package/dist/services/rules/mock.d.ts +20 -0
  233. package/dist/services/rules/mock.d.ts.map +1 -0
  234. package/dist/services/rules/rules.type.d.ts +262 -0
  235. package/dist/services/rules/rules.type.d.ts.map +1 -0
  236. package/dist/services/rules/triggers.d.ts +140 -0
  237. package/dist/services/rules/triggers.d.ts.map +1 -0
  238. package/dist/services/settings/index.d.ts +36 -0
  239. package/dist/services/settings/index.d.ts.map +1 -0
  240. package/dist/services/settings/mock.d.ts +14 -0
  241. package/dist/services/settings/mock.d.ts.map +1 -0
  242. package/dist/services/settings/settings.type.d.ts +39 -0
  243. package/dist/services/settings/settings.type.d.ts.map +1 -0
  244. package/dist/stores/auth.d.ts +192 -0
  245. package/dist/stores/auth.d.ts.map +1 -0
  246. package/dist/stores/bars.d.ts +288 -0
  247. package/dist/stores/bars.d.ts.map +1 -0
  248. package/dist/stores/content.d.ts +4101 -0
  249. package/dist/stores/content.d.ts.map +1 -0
  250. package/dist/stores/executions.d.ts +249 -0
  251. package/dist/stores/executions.d.ts.map +1 -0
  252. package/dist/stores/gov.d.ts +238 -0
  253. package/dist/stores/gov.d.ts.map +1 -0
  254. package/dist/stores/history.d.ts +833 -0
  255. package/dist/stores/history.d.ts.map +1 -0
  256. package/dist/stores/index.d.ts +15 -0
  257. package/dist/stores/index.d.ts.map +1 -0
  258. package/dist/stores/kalshi.d.ts +728 -0
  259. package/dist/stores/kalshi.d.ts.map +1 -0
  260. package/dist/stores/llm-providers.d.ts +97 -0
  261. package/dist/stores/llm-providers.d.ts.map +1 -0
  262. package/dist/stores/llm.d.ts +102 -0
  263. package/dist/stores/llm.d.ts.map +1 -0
  264. package/dist/stores/people.d.ts +596 -0
  265. package/dist/stores/people.d.ts.map +1 -0
  266. package/dist/stores/persist.d.ts +58 -0
  267. package/dist/stores/persist.d.ts.map +1 -0
  268. package/dist/stores/rules.d.ts +485 -0
  269. package/dist/stores/rules.d.ts.map +1 -0
  270. package/dist/stores/settings.d.ts +36 -0
  271. package/dist/stores/settings.d.ts.map +1 -0
  272. package/dist/stores/ws.d.ts +66 -0
  273. package/dist/stores/ws.d.ts.map +1 -0
  274. package/package.json +90 -0
@@ -0,0 +1,246 @@
1
+ /**
2
+ * WebSocket-layer defaults + protocol constants.
3
+ *
4
+ * Pattern (per FE coding rules §1.5):
5
+ * `export const X = { FOO: 'foo', BAR: 'bar' } as const;`
6
+ * `export type XKey = (typeof X)[keyof typeof X];`
7
+ *
8
+ * See `eaera-docs/cbs/eaera-cms/docs/eaera-cms-websocket-integration-guide.md`
9
+ * for the wire protocol this client implements.
10
+ */
11
+ /**
12
+ * Re-export the MT5 domain constants so WS consumers can grab the server
13
+ * name + interval enum from the same place they import the topic builders.
14
+ */
15
+ export { MT5_INTERVAL, MT5_SERVER_NAME } from '../../common/constants/mt5.constant';
16
+ export type { MT5Interval, MT5ServerName } from '../../common/constants/mt5.constant';
17
+ /** Lifecycle states surfaced by `IWsClient.connectionState`. */
18
+ export declare const WS_CONNECTION_STATE: {
19
+ readonly IDLE: "idle";
20
+ readonly OPENING: "opening";
21
+ readonly AUTHENTICATING: "authenticating";
22
+ readonly OPEN: "open";
23
+ readonly RECONNECTING: "reconnecting";
24
+ readonly CLOSED: "closed";
25
+ };
26
+ export type WsConnectionState = (typeof WS_CONNECTION_STATE)[keyof typeof WS_CONNECTION_STATE];
27
+ /**
28
+ * WebSocket close codes. `NORMAL` is the only one the client sends; the
29
+ * rest mirror what the CMS server uses (see FEAT-010 guide §3).
30
+ */
31
+ export declare const WS_CLOSE_CODE: {
32
+ /** RFC 6455 — clean shutdown (e.g. user logout). */
33
+ readonly NORMAL: 1000;
34
+ /** RFC 6455 — `invalid_token` / `token_expired` / `auth_timeout`. */
35
+ readonly POLICY_VIOLATION: 1008;
36
+ /** RFC 6455 — `service_unavailable` (token service not configured). */
37
+ readonly INTERNAL_ERROR: 1011;
38
+ /** RFC 6455 — graceful server shutdown. */
39
+ readonly TRY_AGAIN_LATER: 1013;
40
+ /**
41
+ * Non-standard — client-side deadline: server did not reply to `auth`
42
+ * within `WS_AUTH_TIMEOUT_MS`. Closes the socket so the consumer can
43
+ * react.
44
+ */
45
+ readonly CLIENT_AUTH_TIMEOUT: 4000;
46
+ };
47
+ export type WsCloseCode = (typeof WS_CLOSE_CODE)[keyof typeof WS_CLOSE_CODE];
48
+ /** Server-emitted error codes during the `auth` handshake / mid-session (ws-guide §3.4). */
49
+ export declare const WS_AUTH_ERROR_CODE: {
50
+ readonly INVALID_TOKEN: "invalid_token";
51
+ readonly TOKEN_EXPIRED: "token_expired";
52
+ readonly AUTH_TIMEOUT: "auth_timeout";
53
+ readonly INVALID_MESSAGE: "invalid_message";
54
+ readonly SERVICE_UNAVAILABLE: "service_unavailable";
55
+ };
56
+ export type WsAuthErrorCode = (typeof WS_AUTH_ERROR_CODE)[keyof typeof WS_AUTH_ERROR_CODE];
57
+ /**
58
+ * Close-frame reason strings (ws-guide §4.1). These accompany the RFC 6455
59
+ * close codes in `WS_CLOSE_CODE` — they are NOT auth error codes. Surfaced so
60
+ * consumers can match `CloseEvent.reason` against stable strings.
61
+ */
62
+ export declare const WS_CLOSE_REASON: {
63
+ readonly NORMAL: "normal";
64
+ readonly INVALID_TOKEN: "invalid_token";
65
+ readonly TOKEN_EXPIRED: "token_expired";
66
+ readonly AUTH_TIMEOUT: "auth_timeout";
67
+ readonly PING_TIMEOUT: "ping_timeout";
68
+ readonly AUTH_REQUIRED: "auth required";
69
+ readonly AUTH_SERVICE_UNAVAILABLE: "auth service unavailable";
70
+ readonly SERVER_SHUTTING_DOWN: "server shutting down";
71
+ };
72
+ export type WsCloseReason = (typeof WS_CLOSE_REASON)[keyof typeof WS_CLOSE_REASON];
73
+ /** Server-emitted error codes on the action invocation path (FEAT-008). */
74
+ /** Accepted-stage error codes — returned on `action_accepted` (ws-guide §9.3). */
75
+ export declare const WS_ACTION_ACCEPTED_ERROR_CODE: {
76
+ readonly VALIDATION_ERROR: "validation_error";
77
+ readonly NOT_FOUND: "not_found";
78
+ readonly PERMISSION_DENIED: "permission_denied";
79
+ readonly DUPLICATE: "duplicate";
80
+ readonly INTERNAL_ERROR: "internal_error";
81
+ readonly CONFIGURATION_ERROR: "configuration_error";
82
+ };
83
+ export type WsActionAcceptedErrorCode = (typeof WS_ACTION_ACCEPTED_ERROR_CODE)[keyof typeof WS_ACTION_ACCEPTED_ERROR_CODE];
84
+ /** Result-stage error codes — returned on `action_result` (ws-guide §9.4). */
85
+ export declare const WS_ACTION_RESULT_ERROR_CODE: {
86
+ readonly TIMEOUT: "timeout";
87
+ };
88
+ export type WsActionResultErrorCode = (typeof WS_ACTION_RESULT_ERROR_CODE)[keyof typeof WS_ACTION_RESULT_ERROR_CODE];
89
+ /**
90
+ * All action error codes — union of the accepted-stage and result-stage maps
91
+ * (ws-guide §9.3 + §9.4). Kept for back-compat with consumers that do not yet
92
+ * distinguish the stage; prefer the stage-specific maps above for new code.
93
+ */
94
+ export declare const WS_ACTION_ERROR_CODE: {
95
+ readonly TIMEOUT: "timeout";
96
+ readonly VALIDATION_ERROR: "validation_error";
97
+ readonly NOT_FOUND: "not_found";
98
+ readonly PERMISSION_DENIED: "permission_denied";
99
+ readonly DUPLICATE: "duplicate";
100
+ readonly INTERNAL_ERROR: "internal_error";
101
+ readonly CONFIGURATION_ERROR: "configuration_error";
102
+ };
103
+ export type WsActionErrorCode = (typeof WS_ACTION_ERROR_CODE)[keyof typeof WS_ACTION_ERROR_CODE];
104
+ /**
105
+ * Wire `type` field for every server→client and client→server message.
106
+ *
107
+ * TypeScript discriminated unions require the `type` field to be a string
108
+ * literal (not a const reference) on each interface — so these constants are
109
+ * used for **runtime comparisons** (`switch (msg.type)`) and the interfaces
110
+ * in `ws.type.ts` keep their literal `type: '…'` annotations for narrowing.
111
+ */
112
+ export declare const WS_MESSAGE_TYPE: {
113
+ readonly AUTH_OK: "auth_ok";
114
+ readonly AUTH_FAIL: "auth_fail";
115
+ readonly AUTH_EXPIRED: "auth_expired";
116
+ readonly SUB_OK: "sub_ok";
117
+ readonly SUB_ERROR: "sub_error";
118
+ readonly UNSUB_OK: "unsub_ok";
119
+ readonly PING: "ping";
120
+ readonly EVENT: "event";
121
+ readonly ACTION_ACCEPTED: "action_accepted";
122
+ readonly ACTION_RESULT: "action_result";
123
+ readonly ERROR: "error";
124
+ readonly ADMIN_DISCONNECT: "admin_disconnect";
125
+ readonly AUTH: "auth";
126
+ readonly SUBSCRIBE: "subscribe";
127
+ readonly UNSUBSCRIBE: "unsubscribe";
128
+ readonly UNSUBSCRIBE_ALL: "unsubscribe_all";
129
+ readonly PONG: "pong";
130
+ readonly ACTION: "action";
131
+ readonly FETCH_RESULT: "fetch_result";
132
+ };
133
+ export type WsMessageType = (typeof WS_MESSAGE_TYPE)[keyof typeof WS_MESSAGE_TYPE];
134
+ /**
135
+ * Built-in topic namespaces (guide §5.4). Server-side permissions are
136
+ * enforced (`risk:*` requires `content:read`, `mt5:*` requires `mt5:viewer`,
137
+ * etc.). Use these as the first segment of every topic you publish /
138
+ * subscribe to.
139
+ */
140
+ export declare const WS_TOPIC_NAMESPACE: {
141
+ readonly RISK: "risk";
142
+ readonly MT5: "mt5";
143
+ readonly SYMBOL: "symbol";
144
+ readonly ACCOUNT: "account";
145
+ readonly USER: "user";
146
+ readonly STREAM: "stream";
147
+ readonly ADMIN: "admin";
148
+ };
149
+ export type WsTopicNamespace = (typeof WS_TOPIC_NAMESPACE)[keyof typeof WS_TOPIC_NAMESPACE];
150
+ /**
151
+ * Canonical topic strings for the built-in namespaces. The server-side
152
+ * authz pipeline (FEAT-011) checks the prefix against the user's effective
153
+ * permissions.
154
+ *
155
+ * MT5 topics must be built with `mt5Topic(server, eventType)` — the server
156
+ * segment must match `MT5_SERVER_NAME` exactly (including spaces).
157
+ */
158
+ export declare const WS_TOPIC: {
159
+ readonly RISK_RULES: "risk:rules";
160
+ readonly RISK_EXECUTIONS: "risk:executions";
161
+ };
162
+ export type WsTopic = (typeof WS_TOPIC)[keyof typeof WS_TOPIC];
163
+ /** MT5 event types — third segment of `mt5:events:{server}:{event_type}`. */
164
+ export declare const WS_MT5_EVENT_TYPE: {
165
+ readonly TICK: "tick";
166
+ readonly ORDER: "order";
167
+ readonly POSITION: "position";
168
+ readonly STATEMENT: "statement";
169
+ readonly DEAL: "deal";
170
+ };
171
+ export type WsMt5EventType = (typeof WS_MT5_EVENT_TYPE)[keyof typeof WS_MT5_EVENT_TYPE];
172
+ /**
173
+ * Build an MT5 topic for a specific server + event type. The server segment
174
+ * MUST match `MT5_SERVER_NAME` exactly (including spaces).
175
+ */
176
+ export declare const mt5Topic: (serverName: string, eventType: WsMt5EventType) => string;
177
+ /**
178
+ * Build a per-account state topic: `account:<Mt5Account.uuid>`.
179
+ * Subscribe with the account's UUID (NOT the numeric login) [ws§7.4, api-inventory §9.9].
180
+ */
181
+ export declare const accountTopic: (accountUuid: string) => string;
182
+ /**
183
+ * Build a per-symbol tick topic: `symbol:<server>:<SYMBOL>`.
184
+ * The preferred live-tick path for charts (one topic per (server, symbol) isolates
185
+ * per-connection cost to one symbol's tick rate) [ws§7.3, api-inventory §9.3].
186
+ */
187
+ export declare const symbolTopic: (serverName: string, symbol: string) => string;
188
+ /**
189
+ * Build a user-scoped notification topic: `user:<id>` [ws§5].
190
+ */
191
+ export declare const userTopic: (userId: number | string) => string;
192
+ /**
193
+ * Build a stream-processor output topic: `stream:<id>` [ws§5].
194
+ */
195
+ export declare const streamTopic: (streamId: string) => string;
196
+ /**
197
+ * Build an admin topic: `admin:<name>` [ws§5].
198
+ */
199
+ export declare const adminTopic: (name: string) => string;
200
+ /** Hard cap on topics per connection (server-side default). */
201
+ export declare const WS_MAX_SUBSCRIPTIONS = 50;
202
+ /** Reconnect backoff schedule (matches the integration guide's recommendation). */
203
+ export declare const WS_RECONNECT_INITIAL_MS = 1000;
204
+ export declare const WS_RECONNECT_MAX_MS = 30000;
205
+ /** Random jitter added to each reconnect delay, in milliseconds. */
206
+ export declare const WS_RECONNECT_JITTER_MS = 250;
207
+ /** Server-driven ping interval (server sends `ping` every N seconds). */
208
+ export declare const WS_PING_INTERVAL_MS = 30000;
209
+ /**
210
+ * Client-side ping-watchdog multiplier. The watchdog force-closes the socket
211
+ * after `pingIntervalMs * WS_PING_WATCHDOG_FACTOR` without a server `ping`,
212
+ * catching half-open (sleep / NAT-timeout) connections before the server's
213
+ * own 2-missed-pong timeout (ws-guide §8).
214
+ */
215
+ export declare const WS_PING_WATCHDOG_FACTOR = 1.5;
216
+ /** Floor for the watchdog interval check (never probe more often than this). */
217
+ export declare const WS_PING_WATCHDOG_CHECK_MS = 15000;
218
+ /**
219
+ * Max reconnect attempts before the client transitions to terminal `CLOSED`
220
+ * (ws-guide §10). Prevents an infinite `RECONNECTING` loop on a prolonged
221
+ * outage so consumers (e.g. the Nuxt recovery plugin) can surface a
222
+ * "connection lost" notification instead of retrying silently forever.
223
+ */
224
+ export declare const WS_MAX_RECONNECT_ATTEMPTS = 10;
225
+ /** Window in which the server expects the first `auth` message. */
226
+ export declare const WS_AUTH_TIMEOUT_MS = 10000;
227
+ /**
228
+ * Server-side TTL for an in-flight `action` after disconnect. The client
229
+ * uses `fetch_result` within this window to recover a missed `action_result`.
230
+ */
231
+ export declare const WS_ACTION_RESULT_TTL_MS: number;
232
+ /**
233
+ * MT5 broker retcodes surfaced through `action_result.output.data.retcode`.
234
+ * Source: eaera-docs §7.5 / ws-guide §12.6.
235
+ */
236
+ export declare const MT5_RETCODE: {
237
+ readonly REQ_REJECT: 10004;
238
+ readonly REQ_CANCELLED: 10006;
239
+ readonly PRICE_OFF_QUOTES: 10016;
240
+ readonly REQUEST_CHANGED: 10024;
241
+ readonly PRICE_OFF: 10030;
242
+ readonly CONNECTION_LOST: 10031;
243
+ readonly NETWORK_ERROR: 10032;
244
+ };
245
+ export type Mt5Retcode = (typeof MT5_RETCODE)[keyof typeof MT5_RETCODE];
246
+ //# sourceMappingURL=ws.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws.constants.d.ts","sourceRoot":"","sources":["../../../src/core/ws/ws.constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACpF,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAItF,gEAAgE;AAChE,eAAO,MAAM,mBAAmB;;;;;;;CAOtB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAI/F;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB,oDAAoD;;IAEpD,qEAAqE;;IAErE,uEAAuE;;IAEvE,2CAA2C;;IAE3C;;;;OAIG;;CAEK,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAI7E,4FAA4F;AAC5F,eAAO,M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M,WAAW;;;;;;;;CAQd,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,264 @@
1
+ import { MT5DealEntry, MT5TradeSide } from '../../common/constants/mt5.constant';
2
+ /**
3
+ * `data.event` discriminator values emitted by the backend. Not every payload
4
+ * carries one (e.g. the `tick` topic omits it — see {@link ITickEvent}); those
5
+ * are dispatched on `topic` instead. Kept here so consumers can route without
6
+ * hard-coding string literals.
7
+ */
8
+ export declare const WS_EVENT_NAME: {
9
+ readonly ACCOUNT_STATE: "account_state";
10
+ readonly POSITION: "position";
11
+ readonly ORDER: "order";
12
+ readonly DEAL: "deal";
13
+ readonly SYMBOL_TICK: "symbol_tick";
14
+ readonly LAST_TICK: "last_tick";
15
+ };
16
+ export type WsEventName = (typeof WS_EVENT_NAME)[keyof typeof WS_EVENT_NAME];
17
+ /**
18
+ * Per-position row embedded inside an {@link IAccountStateEvent} snapshot
19
+ * (ws-guide §7.4.1). The `server`, `login`, and `timestampServer` columns that
20
+ * live on the parent envelope are stripped here by the CMS `account_bridge`.
21
+ *
22
+ * Note the `action` divergence: this snapshot uses the **numeric** MT5 type
23
+ * (`0` = Buy, `1` = Sell), whereas the live {@link IPositionEvent} /
24
+ * {@link IDealEvent} use the decoded **string** (`'BUY' | 'SELL'`). Consumers
25
+ * that merge both feeds must coerce once at their boundary.
26
+ */
27
+ export interface IAccountStatePosition {
28
+ /** MT5 `Position` ticket — stable identity. */
29
+ positionId: number;
30
+ symbol: string;
31
+ /** `0` = Buy, `1` = Sell (numeric — see interface note above). */
32
+ action: number;
33
+ /** Initial open lot size. */
34
+ volume: number;
35
+ /** Cumulative volume already closed by partial fills. */
36
+ volumeClosed: number;
37
+ /** Still-open size (`volume − volumeClosed`). */
38
+ volumeRemaining: number;
39
+ /** Current market price at `wave_ts`. */
40
+ price: number;
41
+ /** Entry / open price. */
42
+ pricePosition: number;
43
+ /** Stop-loss price; `0` if not set. */
44
+ priceSl: number;
45
+ /** Take-profit price; `0` if not set. */
46
+ priceTp: number;
47
+ /** Gross floating PnL (before swap/commission). */
48
+ profit: number;
49
+ /** Net floating PnL (after swap/commission/fee). */
50
+ netProfit: number;
51
+ /**
52
+ * Swap/rollover accumulated on the open position. The BE emits this on the
53
+ * wire but the ws-guide §7.4.1 field list has not been updated to include
54
+ * it — optional so consumers on older BE envs stay honest.
55
+ */
56
+ swap?: number;
57
+ /** Broker open-time, unix-**millisecond** tick. */
58
+ timestampOpen: number;
59
+ /** Wave snapshot time (ISO-8601). */
60
+ timestamp: string;
61
+ /** Broker comment (≤ 31 chars). */
62
+ comment: string;
63
+ }
64
+ /**
65
+ * Per-order row embedded inside an {@link IAccountStateEvent} snapshot
66
+ * (ws-guide §7.4). The pending orders the account holds at `wave_ts`. The
67
+ * `server` / `login` columns that live on the parent envelope are stripped
68
+ * here by the CMS `account_bridge`, mirroring {@link IAccountStatePosition}.
69
+ */
70
+ export interface IAccountStateOrder {
71
+ /** MT5 `Order` ticket — stable identity. */
72
+ orderId: number;
73
+ symbol: string;
74
+ /** Initial requested lot size. */
75
+ volume: number;
76
+ /** Limit / stop trigger price. */
77
+ price: number;
78
+ /** Order stop-loss level; `0` if not set. */
79
+ priceSl: number;
80
+ /** Order take-profit level; `0` if not set. */
81
+ priceTp: number;
82
+ /** Raw MT5 integer code; `orderTypeStr` is the decoded form. */
83
+ orderType: number;
84
+ /** Decoded order type, e.g. `'BUY_LIMIT' | 'SELL_STOP' | …`. */
85
+ orderTypeStr: string;
86
+ /** Raw MT5 integer state code; `stateStr` is the decoded form. */
87
+ state: number;
88
+ /** `PLACED` | `STARTED` | … (snapshot rows are pending). */
89
+ stateStr: string;
90
+ /** `'DAY' | 'GTC' | …`. */
91
+ duration: string;
92
+ /** Setup time, unix-**millisecond** integer. */
93
+ timestampSetup: number;
94
+ /** Wave snapshot time (ISO-8601). */
95
+ timestamp: string;
96
+ /** Broker comment (≤ 31 chars). */
97
+ comment: string;
98
+ }
99
+ /**
100
+ * Aggregate account-state payload delivered on topic `account:<Mt5Account.uuid>`
101
+ * (ws-guide §7.4). Carries the balance/equity/margin summary **and** the
102
+ * authoritative open-positions + pending-orders lists. This is the camelCase
103
+ * form the SDK hands to `onEvent` handlers — consumers no longer need a
104
+ * `toAccountState` adapter.
105
+ */
106
+ export interface IAccountStateEvent {
107
+ event: typeof WS_EVENT_NAME.ACCOUNT_STATE;
108
+ /** `Mt5Account.uuid` — matches the topic suffix. */
109
+ accountUuid: string;
110
+ server: string;
111
+ login: number;
112
+ /** Statement wave's `wave_ts` (not the publish time). */
113
+ timestamp: string;
114
+ balance: number;
115
+ equity: number;
116
+ /** Used margin (in use by open positions). */
117
+ margin: number;
118
+ /** `equity − margin`. */
119
+ marginFree: number;
120
+ /** `equity / margin × 100` (percentage). */
121
+ marginLevel: number;
122
+ /** Closed-trade PnL. */
123
+ profit: number;
124
+ /** Unrealised PnL of all open positions. */
125
+ floating: number;
126
+ /** Wave-snapshot open-position count (should equal `positions.length`). */
127
+ openPositions: number;
128
+ /** Wave-snapshot pending-order count (should equal `orders.length`). */
129
+ pendingOrders: number;
130
+ positions: IAccountStatePosition[];
131
+ /** Authoritative pending-orders list at `wave_ts`. */
132
+ orders: IAccountStateOrder[];
133
+ currency: string;
134
+ currencyDigits: number;
135
+ group: string;
136
+ leverage: number;
137
+ publisher: string;
138
+ }
139
+ /** Live position event (Appendix A.3, topic `mt5:events:<server>:position`). */
140
+ export interface IPositionEvent {
141
+ event: typeof WS_EVENT_NAME.POSITION;
142
+ eventId: string;
143
+ server: string;
144
+ login: number;
145
+ positionId: number;
146
+ symbol: string;
147
+ action: MT5TradeSide;
148
+ volume: number;
149
+ volumeClosed: number;
150
+ volumeRemaining: number;
151
+ price: number | null;
152
+ pricePosition: number;
153
+ priceSl: number | null;
154
+ priceTp: number | null;
155
+ profit: number;
156
+ netProfit: number;
157
+ /** Swap/rollover — the wire key is `swap`. */
158
+ swap: number;
159
+ /** @deprecated Legacy key — the BE now emits `swap`. Optional for consumers still on older wires. */
160
+ storage?: number;
161
+ timestamp: string;
162
+ timestampServer: number;
163
+ /** Broker open-time, unix-**millisecond** integer. */
164
+ timestampOpen: number;
165
+ timestampOpenServer: number;
166
+ durationOfPosition: number;
167
+ comment: string;
168
+ }
169
+ /** Live order event (Appendix A.2, topic `mt5:events:<server>:order`). */
170
+ export interface IOrderEvent {
171
+ event: typeof WS_EVENT_NAME.ORDER;
172
+ eventId: string;
173
+ server: string;
174
+ login: number;
175
+ orderId: number;
176
+ symbol: string;
177
+ volume: number;
178
+ price: number;
179
+ priceSl: number;
180
+ priceTp: number;
181
+ /** Raw MT5 integer code; `orderTypeStr` is the decoded form. */
182
+ orderType: number;
183
+ orderTypeStr: string;
184
+ /** Raw MT5 integer code; `stateStr` is the decoded form. */
185
+ state: number;
186
+ stateStr: string;
187
+ duration: string;
188
+ timestampSetup: number;
189
+ timestamp: string;
190
+ comment: string;
191
+ }
192
+ /** Live deal event (Appendix A.4, topic `mt5:events:<server>:deal`). */
193
+ export interface IDealEvent {
194
+ event: typeof WS_EVENT_NAME.DEAL;
195
+ eventId: string;
196
+ server: string;
197
+ login: number;
198
+ dealId: number;
199
+ orderId: number;
200
+ positionId: number;
201
+ action: MT5TradeSide;
202
+ entry: MT5DealEntry;
203
+ symbol: string;
204
+ volume: number;
205
+ price: number;
206
+ profit: number;
207
+ commission: number;
208
+ fee: number;
209
+ storage: number;
210
+ swap: number;
211
+ comment: string;
212
+ reason: number;
213
+ externalId: string;
214
+ timestamp: string;
215
+ timestampServer: number;
216
+ group: string;
217
+ currency: string;
218
+ }
219
+ /**
220
+ * Tick event (Appendix A.1, topic `mt5:events:<server>:tick` **or**
221
+ * `symbol:<server>:<SYMBOL>`). Note: there is **no** `event` discriminator in
222
+ * the payload — dispatch on `topic` (or on `data.event: "symbol_tick"`).
223
+ */
224
+ export interface ITickEvent {
225
+ eventId: string;
226
+ server: string;
227
+ symbol: string;
228
+ bid: number;
229
+ ask: number;
230
+ last: number;
231
+ volume: number;
232
+ timestamp: string;
233
+ flags: number;
234
+ }
235
+ /**
236
+ * Single depth-of-market (DOM) ladder level. The backend emits one DOM
237
+ * snapshot per symbol; consumers aggregate the levels into a bid/ask ladder.
238
+ */
239
+ export interface IDomEntry {
240
+ price: number;
241
+ quantity: number;
242
+ }
243
+ /**
244
+ * Depth-of-market snapshot event. Delivered on a per-symbol DOM topic; there is
245
+ * no `event` discriminator — dispatch on `topic` + the `symbol` field. The
246
+ * ladder (`dom[]`) is the authoritative bid/ask depth at the snapshot time.
247
+ */
248
+ export interface IDomEvent {
249
+ symbol: string;
250
+ dom: IDomEntry[];
251
+ }
252
+ /**
253
+ * Time & sales (the tape) event. Each frame is one executed print for a symbol;
254
+ * dispatched on `topic` (no `event` discriminator). `side` uses the decoded
255
+ * `'BUY' | 'SELL'` form.
256
+ */
257
+ export interface ITimeNSaleEvent {
258
+ symbol: string;
259
+ price: number;
260
+ side: MT5TradeSide;
261
+ quantity: number;
262
+ timestamp: string;
263
+ }
264
+ //# sourceMappingURL=ws.events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws.events.d.ts","sourceRoot":"","sources":["../../../src/core/ws/ws.events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAI3F;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;CAOhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAI7E;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,MAA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