@adaptic/utils 0.0.99

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 (238) hide show
  1. package/README.md +916 -0
  2. package/dist/index.cjs +71971 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.mjs +71677 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/test.js +7799 -0
  7. package/dist/test.js.map +1 -0
  8. package/dist/types/__tests__/alpaca-functions.test.d.ts +2 -0
  9. package/dist/types/__tests__/alpaca-functions.test.d.ts.map +1 -0
  10. package/dist/types/__tests__/api-endpoints.test.d.ts +2 -0
  11. package/dist/types/__tests__/api-endpoints.test.d.ts.map +1 -0
  12. package/dist/types/__tests__/asset-allocation.test.d.ts +2 -0
  13. package/dist/types/__tests__/asset-allocation.test.d.ts.map +1 -0
  14. package/dist/types/__tests__/auth-validator.test.d.ts +2 -0
  15. package/dist/types/__tests__/auth-validator.test.d.ts.map +1 -0
  16. package/dist/types/__tests__/cache.test.d.ts +2 -0
  17. package/dist/types/__tests__/cache.test.d.ts.map +1 -0
  18. package/dist/types/__tests__/errors.test.d.ts +2 -0
  19. package/dist/types/__tests__/errors.test.d.ts.map +1 -0
  20. package/dist/types/__tests__/financial-regression.test.d.ts +2 -0
  21. package/dist/types/__tests__/financial-regression.test.d.ts.map +1 -0
  22. package/dist/types/__tests__/format-tools.test.d.ts +2 -0
  23. package/dist/types/__tests__/format-tools.test.d.ts.map +1 -0
  24. package/dist/types/__tests__/http-keep-alive.test.d.ts +2 -0
  25. package/dist/types/__tests__/http-keep-alive.test.d.ts.map +1 -0
  26. package/dist/types/__tests__/http-timeout.test.d.ts +2 -0
  27. package/dist/types/__tests__/http-timeout.test.d.ts.map +1 -0
  28. package/dist/types/__tests__/logger.test.d.ts +2 -0
  29. package/dist/types/__tests__/logger.test.d.ts.map +1 -0
  30. package/dist/types/__tests__/market-time.test.d.ts +2 -0
  31. package/dist/types/__tests__/market-time.test.d.ts.map +1 -0
  32. package/dist/types/__tests__/misc-utils.test.d.ts +2 -0
  33. package/dist/types/__tests__/misc-utils.test.d.ts.map +1 -0
  34. package/dist/types/__tests__/paginator.test.d.ts +2 -0
  35. package/dist/types/__tests__/paginator.test.d.ts.map +1 -0
  36. package/dist/types/__tests__/performance-metrics.test.d.ts +2 -0
  37. package/dist/types/__tests__/performance-metrics.test.d.ts.map +1 -0
  38. package/dist/types/__tests__/polygon.test.d.ts +2 -0
  39. package/dist/types/__tests__/polygon.test.d.ts.map +1 -0
  40. package/dist/types/__tests__/price-utils.test.d.ts +2 -0
  41. package/dist/types/__tests__/price-utils.test.d.ts.map +1 -0
  42. package/dist/types/__tests__/property-based-financial.test.d.ts +2 -0
  43. package/dist/types/__tests__/property-based-financial.test.d.ts.map +1 -0
  44. package/dist/types/__tests__/rate-limiter.test.d.ts +2 -0
  45. package/dist/types/__tests__/rate-limiter.test.d.ts.map +1 -0
  46. package/dist/types/__tests__/schema-validation.test.d.ts +2 -0
  47. package/dist/types/__tests__/schema-validation.test.d.ts.map +1 -0
  48. package/dist/types/__tests__/technical-analysis.test.d.ts +2 -0
  49. package/dist/types/__tests__/technical-analysis.test.d.ts.map +1 -0
  50. package/dist/types/__tests__/time-utils.test.d.ts +2 -0
  51. package/dist/types/__tests__/time-utils.test.d.ts.map +1 -0
  52. package/dist/types/adaptic.d.ts +52 -0
  53. package/dist/types/adaptic.d.ts.map +1 -0
  54. package/dist/types/alpaca/client.d.ts +95 -0
  55. package/dist/types/alpaca/client.d.ts.map +1 -0
  56. package/dist/types/alpaca/crypto/data.d.ts +281 -0
  57. package/dist/types/alpaca/crypto/data.d.ts.map +1 -0
  58. package/dist/types/alpaca/crypto/index.d.ts +75 -0
  59. package/dist/types/alpaca/crypto/index.d.ts.map +1 -0
  60. package/dist/types/alpaca/crypto/orders.d.ts +221 -0
  61. package/dist/types/alpaca/crypto/orders.d.ts.map +1 -0
  62. package/dist/types/alpaca/index.d.ts +205 -0
  63. package/dist/types/alpaca/index.d.ts.map +1 -0
  64. package/dist/types/alpaca/legacy/account.d.ts +34 -0
  65. package/dist/types/alpaca/legacy/account.d.ts.map +1 -0
  66. package/dist/types/alpaca/legacy/assets.d.ts +13 -0
  67. package/dist/types/alpaca/legacy/assets.d.ts.map +1 -0
  68. package/dist/types/alpaca/legacy/auth.d.ts +18 -0
  69. package/dist/types/alpaca/legacy/auth.d.ts.map +1 -0
  70. package/dist/types/alpaca/legacy/index.d.ts +15 -0
  71. package/dist/types/alpaca/legacy/index.d.ts.map +1 -0
  72. package/dist/types/alpaca/legacy/market-data.d.ts +32 -0
  73. package/dist/types/alpaca/legacy/market-data.d.ts.map +1 -0
  74. package/dist/types/alpaca/legacy/orders.d.ts +84 -0
  75. package/dist/types/alpaca/legacy/orders.d.ts.map +1 -0
  76. package/dist/types/alpaca/legacy/positions.d.ts +66 -0
  77. package/dist/types/alpaca/legacy/positions.d.ts.map +1 -0
  78. package/dist/types/alpaca/legacy/utils.d.ts +18 -0
  79. package/dist/types/alpaca/legacy/utils.d.ts.map +1 -0
  80. package/dist/types/alpaca/market-data/bars.d.ts +142 -0
  81. package/dist/types/alpaca/market-data/bars.d.ts.map +1 -0
  82. package/dist/types/alpaca/market-data/index.d.ts +13 -0
  83. package/dist/types/alpaca/market-data/index.d.ts.map +1 -0
  84. package/dist/types/alpaca/market-data/news.d.ts +87 -0
  85. package/dist/types/alpaca/market-data/news.d.ts.map +1 -0
  86. package/dist/types/alpaca/market-data/quotes.d.ts +85 -0
  87. package/dist/types/alpaca/market-data/quotes.d.ts.map +1 -0
  88. package/dist/types/alpaca/market-data/trades.d.ts +98 -0
  89. package/dist/types/alpaca/market-data/trades.d.ts.map +1 -0
  90. package/dist/types/alpaca/options/contracts.d.ts +279 -0
  91. package/dist/types/alpaca/options/contracts.d.ts.map +1 -0
  92. package/dist/types/alpaca/options/data.d.ts +126 -0
  93. package/dist/types/alpaca/options/data.d.ts.map +1 -0
  94. package/dist/types/alpaca/options/index.d.ts +17 -0
  95. package/dist/types/alpaca/options/index.d.ts.map +1 -0
  96. package/dist/types/alpaca/options/orders.d.ts +366 -0
  97. package/dist/types/alpaca/options/orders.d.ts.map +1 -0
  98. package/dist/types/alpaca/options/strategies.d.ts +224 -0
  99. package/dist/types/alpaca/options/strategies.d.ts.map +1 -0
  100. package/dist/types/alpaca/streams/base-stream.d.ts +143 -0
  101. package/dist/types/alpaca/streams/base-stream.d.ts.map +1 -0
  102. package/dist/types/alpaca/streams/crypto-stream.d.ts +173 -0
  103. package/dist/types/alpaca/streams/crypto-stream.d.ts.map +1 -0
  104. package/dist/types/alpaca/streams/index.d.ts +54 -0
  105. package/dist/types/alpaca/streams/index.d.ts.map +1 -0
  106. package/dist/types/alpaca/streams/option-stream.d.ts +167 -0
  107. package/dist/types/alpaca/streams/option-stream.d.ts.map +1 -0
  108. package/dist/types/alpaca/streams/stock-stream.d.ts +176 -0
  109. package/dist/types/alpaca/streams/stock-stream.d.ts.map +1 -0
  110. package/dist/types/alpaca/streams/stream-manager.d.ts +277 -0
  111. package/dist/types/alpaca/streams/stream-manager.d.ts.map +1 -0
  112. package/dist/types/alpaca/streams/trading-stream.d.ts +186 -0
  113. package/dist/types/alpaca/streams/trading-stream.d.ts.map +1 -0
  114. package/dist/types/alpaca/streams.d.ts +88 -0
  115. package/dist/types/alpaca/streams.d.ts.map +1 -0
  116. package/dist/types/alpaca/test-imports.d.ts +7 -0
  117. package/dist/types/alpaca/test-imports.d.ts.map +1 -0
  118. package/dist/types/alpaca/trading/account.d.ts +198 -0
  119. package/dist/types/alpaca/trading/account.d.ts.map +1 -0
  120. package/dist/types/alpaca/trading/bracket-orders.d.ts +162 -0
  121. package/dist/types/alpaca/trading/bracket-orders.d.ts.map +1 -0
  122. package/dist/types/alpaca/trading/clock.d.ts +99 -0
  123. package/dist/types/alpaca/trading/clock.d.ts.map +1 -0
  124. package/dist/types/alpaca/trading/index.d.ts +15 -0
  125. package/dist/types/alpaca/trading/index.d.ts.map +1 -0
  126. package/dist/types/alpaca/trading/oco-orders.d.ts +203 -0
  127. package/dist/types/alpaca/trading/oco-orders.d.ts.map +1 -0
  128. package/dist/types/alpaca/trading/order-utils.d.ts +404 -0
  129. package/dist/types/alpaca/trading/order-utils.d.ts.map +1 -0
  130. package/dist/types/alpaca/trading/orders.d.ts +199 -0
  131. package/dist/types/alpaca/trading/orders.d.ts.map +1 -0
  132. package/dist/types/alpaca/trading/oto-orders.d.ts +282 -0
  133. package/dist/types/alpaca/trading/oto-orders.d.ts.map +1 -0
  134. package/dist/types/alpaca/trading/positions.d.ts +389 -0
  135. package/dist/types/alpaca/trading/positions.d.ts.map +1 -0
  136. package/dist/types/alpaca/trading/smart-orders.d.ts +301 -0
  137. package/dist/types/alpaca/trading/smart-orders.d.ts.map +1 -0
  138. package/dist/types/alpaca/trading/trailing-stops.d.ts +240 -0
  139. package/dist/types/alpaca/trading/trailing-stops.d.ts.map +1 -0
  140. package/dist/types/alpaca-market-data-api.d.ts +386 -0
  141. package/dist/types/alpaca-market-data-api.d.ts.map +1 -0
  142. package/dist/types/alpaca-trading-api.d.ts +315 -0
  143. package/dist/types/alpaca-trading-api.d.ts.map +1 -0
  144. package/dist/types/alphavantage.d.ts +44 -0
  145. package/dist/types/alphavantage.d.ts.map +1 -0
  146. package/dist/types/asset-allocation-algorithm.d.ts +143 -0
  147. package/dist/types/asset-allocation-algorithm.d.ts.map +1 -0
  148. package/dist/types/cache/stampede-protected-cache.d.ts +565 -0
  149. package/dist/types/cache/stampede-protected-cache.d.ts.map +1 -0
  150. package/dist/types/config/api-endpoints.d.ts +94 -0
  151. package/dist/types/config/api-endpoints.d.ts.map +1 -0
  152. package/dist/types/crypto.d.ts +76 -0
  153. package/dist/types/crypto.d.ts.map +1 -0
  154. package/dist/types/display-manager.d.ts +24 -0
  155. package/dist/types/display-manager.d.ts.map +1 -0
  156. package/dist/types/errors/index.d.ts +130 -0
  157. package/dist/types/errors/index.d.ts.map +1 -0
  158. package/dist/types/examples/asset-allocation-example.d.ts +36 -0
  159. package/dist/types/examples/asset-allocation-example.d.ts.map +1 -0
  160. package/dist/types/examples/rate-limiter-example.d.ts +7 -0
  161. package/dist/types/examples/rate-limiter-example.d.ts.map +1 -0
  162. package/dist/types/format-tools.d.ts +54 -0
  163. package/dist/types/format-tools.d.ts.map +1 -0
  164. package/dist/types/http-timeout.d.ts +37 -0
  165. package/dist/types/http-timeout.d.ts.map +1 -0
  166. package/dist/types/index.d.ts +766 -0
  167. package/dist/types/index.d.ts.map +1 -0
  168. package/dist/types/logger.d.ts +56 -0
  169. package/dist/types/logger.d.ts.map +1 -0
  170. package/dist/types/logging.d.ts +12 -0
  171. package/dist/types/logging.d.ts.map +1 -0
  172. package/dist/types/market-hours.d.ts +24 -0
  173. package/dist/types/market-hours.d.ts.map +1 -0
  174. package/dist/types/market-time.d.ts +246 -0
  175. package/dist/types/market-time.d.ts.map +1 -0
  176. package/dist/types/metrics-calcs.d.ts +6 -0
  177. package/dist/types/metrics-calcs.d.ts.map +1 -0
  178. package/dist/types/misc-utils.d.ts +52 -0
  179. package/dist/types/misc-utils.d.ts.map +1 -0
  180. package/dist/types/performance-metrics.d.ts +88 -0
  181. package/dist/types/performance-metrics.d.ts.map +1 -0
  182. package/dist/types/polygon-indices.d.ts +85 -0
  183. package/dist/types/polygon-indices.d.ts.map +1 -0
  184. package/dist/types/polygon.d.ts +126 -0
  185. package/dist/types/polygon.d.ts.map +1 -0
  186. package/dist/types/price-utils.d.ts +26 -0
  187. package/dist/types/price-utils.d.ts.map +1 -0
  188. package/dist/types/rate-limiter.d.ts +171 -0
  189. package/dist/types/rate-limiter.d.ts.map +1 -0
  190. package/dist/types/schemas/alpaca-schemas.d.ts +779 -0
  191. package/dist/types/schemas/alpaca-schemas.d.ts.map +1 -0
  192. package/dist/types/schemas/alphavantage-schemas.d.ts +255 -0
  193. package/dist/types/schemas/alphavantage-schemas.d.ts.map +1 -0
  194. package/dist/types/schemas/index.d.ts +21 -0
  195. package/dist/types/schemas/index.d.ts.map +1 -0
  196. package/dist/types/schemas/polygon-schemas.d.ts +551 -0
  197. package/dist/types/schemas/polygon-schemas.d.ts.map +1 -0
  198. package/dist/types/schemas/validate-response.d.ts +88 -0
  199. package/dist/types/schemas/validate-response.d.ts.map +1 -0
  200. package/dist/types/technical-analysis.d.ts +90 -0
  201. package/dist/types/technical-analysis.d.ts.map +1 -0
  202. package/dist/types/test.d.ts +2 -0
  203. package/dist/types/test.d.ts.map +1 -0
  204. package/dist/types/testing/options-ws.d.ts +2 -0
  205. package/dist/types/testing/options-ws.d.ts.map +1 -0
  206. package/dist/types/time-utils.d.ts +17 -0
  207. package/dist/types/time-utils.d.ts.map +1 -0
  208. package/dist/types/types/adaptic-types.d.ts +11 -0
  209. package/dist/types/types/adaptic-types.d.ts.map +1 -0
  210. package/dist/types/types/alpaca-types.d.ts +1165 -0
  211. package/dist/types/types/alpaca-types.d.ts.map +1 -0
  212. package/dist/types/types/alphavantage-types.d.ts +66 -0
  213. package/dist/types/types/alphavantage-types.d.ts.map +1 -0
  214. package/dist/types/types/asset-allocation-types.d.ts +328 -0
  215. package/dist/types/types/asset-allocation-types.d.ts.map +1 -0
  216. package/dist/types/types/index.d.ts +21 -0
  217. package/dist/types/types/index.d.ts.map +1 -0
  218. package/dist/types/types/logging-types.d.ts +10 -0
  219. package/dist/types/types/logging-types.d.ts.map +1 -0
  220. package/dist/types/types/market-time-types.d.ts +59 -0
  221. package/dist/types/types/market-time-types.d.ts.map +1 -0
  222. package/dist/types/types/metrics-types.d.ts +33 -0
  223. package/dist/types/types/metrics-types.d.ts.map +1 -0
  224. package/dist/types/types/polygon-indices-types.d.ts +190 -0
  225. package/dist/types/types/polygon-indices-types.d.ts.map +1 -0
  226. package/dist/types/types/polygon-types.d.ts +204 -0
  227. package/dist/types/types/polygon-types.d.ts.map +1 -0
  228. package/dist/types/types/ta-types.d.ts +89 -0
  229. package/dist/types/types/ta-types.d.ts.map +1 -0
  230. package/dist/types/utils/auth-validator.d.ts +32 -0
  231. package/dist/types/utils/auth-validator.d.ts.map +1 -0
  232. package/dist/types/utils/http-keep-alive.d.ts +110 -0
  233. package/dist/types/utils/http-keep-alive.d.ts.map +1 -0
  234. package/dist/types/utils/paginator.d.ts +154 -0
  235. package/dist/types/utils/paginator.d.ts.map +1 -0
  236. package/dist/types/utils/retry.d.ts +78 -0
  237. package/dist/types/utils/retry.d.ts.map +1 -0
  238. package/package.json +78 -0
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Types for Polygon Indices API
3
+ */
4
+ /**
5
+ * Base response interface for Polygon API responses
6
+ */
7
+ export interface PolygonIndicesBaseResponse {
8
+ /** The status of the response. */
9
+ status: string;
10
+ /** The request ID. */
11
+ request_id: string;
12
+ }
13
+ /**
14
+ * Error response from Polygon Indices API
15
+ */
16
+ export interface PolygonIndicesErrorResponse extends PolygonIndicesBaseResponse {
17
+ /** The status of the error response. */
18
+ status: "ERROR" | "NOT_AUTHORIZED" | string;
19
+ /** The error message. */
20
+ message: string;
21
+ }
22
+ /**
23
+ * Represents a single bar/aggregate data point for an index
24
+ */
25
+ export interface PolygonIndicesBar {
26
+ /** The close value for the index in the given time period. */
27
+ c: number;
28
+ /** The highest value for the index in the given time period. */
29
+ h: number;
30
+ /** The lowest value for the index in the given time period. */
31
+ l: number;
32
+ /** The open value for the index in the given time period. */
33
+ o: number;
34
+ /** The Unix Msec timestamp for the start of the aggregate window. */
35
+ t: number;
36
+ }
37
+ /**
38
+ * Response for the aggregates (bars) endpoint
39
+ */
40
+ export interface PolygonIndicesAggregatesResponse extends PolygonIndicesBaseResponse {
41
+ /** The ticker symbol of the index. */
42
+ ticker: string;
43
+ /** The number of aggregates used to generate the response. */
44
+ queryCount: number;
45
+ /** The total number of results for this request. */
46
+ resultsCount?: number;
47
+ /** The count of results returned. */
48
+ count?: number;
49
+ /** The array of aggregate results. */
50
+ results: PolygonIndicesBar[];
51
+ }
52
+ /**
53
+ * Represents a previous close result for an index
54
+ */
55
+ export interface PolygonIndicesPrevCloseResult {
56
+ /** The ticker symbol. */
57
+ T: string;
58
+ /** The close value for the index in the given time period. */
59
+ c: number;
60
+ /** The highest value for the index in the given time period. */
61
+ h: number;
62
+ /** The lowest value for the index in the given time period. */
63
+ l: number;
64
+ /** The open value for the index in the given time period. */
65
+ o: number;
66
+ /** The Unix Msec timestamp for the start of the aggregate window. */
67
+ t: number;
68
+ }
69
+ /**
70
+ * Response for the previous close endpoint
71
+ */
72
+ export interface PolygonIndicesPrevCloseResponse extends PolygonIndicesBaseResponse {
73
+ /** The ticker symbol of the index. */
74
+ ticker: string;
75
+ /** The number of aggregates used to generate the response. */
76
+ queryCount: number;
77
+ /** The total number of results for this request. */
78
+ resultsCount: number;
79
+ /** The array of previous close results. */
80
+ results: PolygonIndicesPrevCloseResult[];
81
+ }
82
+ /**
83
+ * Response for the daily open/close endpoint
84
+ */
85
+ export interface PolygonIndicesDailyOpenCloseResponse {
86
+ /** The after-hours value of the index, if available. */
87
+ afterHours?: number;
88
+ /** The close value for the index. */
89
+ close: number;
90
+ /** The date of the data in ISO format. */
91
+ from: string;
92
+ /** The highest value for the index during the day. */
93
+ high: number;
94
+ /** The lowest value for the index during the day. */
95
+ low: number;
96
+ /** The open value for the index. */
97
+ open: number;
98
+ /** The pre-market value of the index, if available. */
99
+ preMarket?: number;
100
+ /** The status of the response. */
101
+ status: string;
102
+ /** The ticker symbol of the index. */
103
+ symbol: string;
104
+ }
105
+ /**
106
+ * Represents a session data for an index in the snapshot
107
+ */
108
+ export interface PolygonIndicesSession {
109
+ /** The value of the change for the index from the previous trading day. */
110
+ change: number;
111
+ /** The percent of the change for the index from the previous trading day. */
112
+ change_percent: number;
113
+ /** The closing value for the index of the day. */
114
+ close: number;
115
+ /** The highest value for the index of the day. */
116
+ high: number;
117
+ /** The lowest value for the index of the day. */
118
+ low: number;
119
+ /** The open value for the index of the day. */
120
+ open: number;
121
+ /** The closing value for the index of previous trading day. */
122
+ previous_close: number;
123
+ }
124
+ /**
125
+ * Represents a single index result in the snapshot response
126
+ */
127
+ export interface PolygonIndicesSnapshotResult {
128
+ /** The nanosecond timestamp of when this information was updated. */
129
+ last_updated?: number;
130
+ /** The market status for the market that trades this index. */
131
+ market_status?: string;
132
+ /** Name of the index. */
133
+ name?: string;
134
+ /** Session data for the index. */
135
+ session?: PolygonIndicesSession;
136
+ /** Ticker of the index. */
137
+ ticker: string;
138
+ /** The time relevance of the data. */
139
+ timeframe?: "DELAYED" | "REAL-TIME";
140
+ /** The type of the asset. */
141
+ type?: "indices";
142
+ /** Value of the index. */
143
+ value?: number;
144
+ /** Error message if there was an issue with this ticker. */
145
+ error?: string;
146
+ /** Error message details. */
147
+ message?: string;
148
+ }
149
+ /**
150
+ * Response for the indices snapshot endpoint
151
+ */
152
+ export interface PolygonIndicesSnapshotResponse extends PolygonIndicesBaseResponse {
153
+ /** URL for the next page of results, if available. */
154
+ next_url?: string;
155
+ /** The array of index snapshot results. */
156
+ results: PolygonIndicesSnapshotResult[];
157
+ }
158
+ /**
159
+ * Parameters for fetching aggregates (bars) for an index
160
+ */
161
+ export interface PolygonIndicesAggregatesParams {
162
+ /** The ticker symbol of the index. */
163
+ indicesTicker: string;
164
+ /** The size of the timespan multiplier. */
165
+ multiplier: number;
166
+ /** The size of the time window (minute, hour, day, week, month, quarter, year). */
167
+ timespan: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
168
+ /** The start of the aggregate time window (YYYY-MM-DD or millisecond timestamp). */
169
+ from: string | number;
170
+ /** The end of the aggregate time window (YYYY-MM-DD or millisecond timestamp). */
171
+ to: string | number;
172
+ /** Sort the results by timestamp (asc or desc). */
173
+ sort?: "asc" | "desc";
174
+ /** Limits the number of base aggregates queried. */
175
+ limit?: number;
176
+ }
177
+ /**
178
+ * Parameters for fetching indices snapshot
179
+ */
180
+ export interface PolygonIndicesSnapshotParams {
181
+ /** Comma separated list of tickers. */
182
+ tickers?: string[];
183
+ /** Order results based on the sort field. */
184
+ order?: "asc" | "desc";
185
+ /** Limit the number of results returned. */
186
+ limit?: number;
187
+ /** Sort field used for ordering. */
188
+ sort?: string;
189
+ }
190
+ //# sourceMappingURL=polygon-indices-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon-indices-types.d.ts","sourceRoot":"","sources":["../../../src/types/polygon-indices-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,0BAA0B;IAC7E,wCAAwC;IACxC,MAAM,EAAE,OAAO,GAAG,gBAAgB,GAAG,MAAM,CAAC;IAC5C,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,CAAC,EAAE,MAAM,CAAC;IACV,gEAAgE;IAChE,CAAC,EAAE,MAAM,CAAC;IACV,+DAA+D;IAC/D,CAAC,EAAE,MAAM,CAAC;IACV,6DAA6D;IAC7D,CAAC,EAAE,MAAM,CAAC;IACV,qEAAqE;IACrE,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,gCAAiC,SAAQ,0BAA0B;IAClF,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,yBAAyB;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,8DAA8D;IAC9D,CAAC,EAAE,MAAM,CAAC;IACV,gEAAgE;IAChE,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C,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Represents a unit of price data for a specific symbol on a given date.
3
+ */
4
+ export type PolygonPriceData = {
5
+ /** The symbol of the asset. */
6
+ symbol: string;
7
+ /** The date of the price data. */
8
+ date: string;
9
+ /** The timestamp of the price data. */
10
+ timeStamp: number;
11
+ /** The opening price. */
12
+ open: number;
13
+ /** The highest price during the period. */
14
+ high: number;
15
+ /** The lowest price during the period. */
16
+ low: number;
17
+ /** The closing price. */
18
+ close: number;
19
+ /** The volume of trades. */
20
+ vol: number;
21
+ /** The volume-weighted average price. */
22
+ vwap: number;
23
+ /** The number of trades. */
24
+ trades: number;
25
+ };
26
+ /**
27
+ * Represents a quote for a specific asset.
28
+ */
29
+ export type PolygonQuote = {
30
+ /** The price of the asset. */
31
+ price: number;
32
+ /** The volume of the asset. */
33
+ vol: number;
34
+ /** The time of the quote. */
35
+ time: Date;
36
+ };
37
+ /**
38
+ * The Polygon API response for grouped daily data.
39
+ */
40
+ export type PolygonGroupedDailyResponse = {
41
+ /** Indicates if the data is adjusted. */
42
+ adjusted: boolean;
43
+ /** The count of queries made. */
44
+ queryCount: number;
45
+ /** The request ID. */
46
+ request_id: string;
47
+ /** The count of results returned. */
48
+ resultsCount: number;
49
+ /** The status of the response. */
50
+ status: string;
51
+ /** The array of price data results. */
52
+ results: PolygonPriceData[];
53
+ };
54
+ /**
55
+ * Represents raw price data from Polygon.
56
+ */
57
+ export interface RawPolygonPriceData {
58
+ /** The ticker symbol. */
59
+ T: string;
60
+ /** The closing price. */
61
+ c: number;
62
+ /** The highest price. */
63
+ h: number;
64
+ /** The lowest price. */
65
+ l: number;
66
+ /** The number of trades. */
67
+ n: number;
68
+ /** The opening price. */
69
+ o: number;
70
+ /** The timestamp. */
71
+ t: number;
72
+ /** The volume. */
73
+ v: number;
74
+ /** The volume-weighted average price. */
75
+ vw: number;
76
+ }
77
+ /**
78
+ * Represents information about a ticker including its name, market cap, and outstanding shares.
79
+ */
80
+ export interface PolygonTickerInfo {
81
+ /** Indicates if the ticker is active. */
82
+ active: boolean;
83
+ /** The name of the currency. */
84
+ currency_name: string;
85
+ /** The UTC time when the ticker was delisted, if applicable. */
86
+ delisted_utc?: string;
87
+ /** A description of the ticker. */
88
+ description: string;
89
+ /** The locale of the ticker. */
90
+ locale: string;
91
+ /** The market in which the ticker operates. */
92
+ market: "stocks" | "crypto" | "indices" | "fx" | "otc";
93
+ /** The market capitalization. */
94
+ market_cap: number;
95
+ /** The name of the ticker. */
96
+ name: string;
97
+ /** The primary exchange for the ticker. */
98
+ primary_exchange: string;
99
+ /** The number of shares outstanding. */
100
+ share_class_shares_outstanding?: number | null;
101
+ /** The ticker symbol. */
102
+ ticker: string;
103
+ /** The type of asset - CS, PFD, ETF, etc. */
104
+ type: string;
105
+ }
106
+ /**
107
+ * Represents the Polygon API response for ticker information.
108
+ */
109
+ export interface PolygonTickerResponse {
110
+ /** The count of tickers returned. */
111
+ count: number;
112
+ /** The next URL for pagination, if applicable. */
113
+ next_url: string | null;
114
+ /** The request ID. */
115
+ request_id: string;
116
+ /** The array of ticker information results. */
117
+ results: PolygonTickerInfo[];
118
+ /** The status of the response. */
119
+ status: string;
120
+ }
121
+ /**
122
+ * Represents daily open and close data for a ticker for grouped daily data.
123
+ */
124
+ export interface PolygonDailyOpenClose {
125
+ /** The after-hours price, if applicable. */
126
+ afterHours?: number;
127
+ /** The closing price. */
128
+ close: number;
129
+ /** The date from which the data is taken. */
130
+ from: string;
131
+ /** The highest price during the day. */
132
+ high: number;
133
+ /** The lowest price during the day. */
134
+ low: number;
135
+ /** The opening price. */
136
+ open: number;
137
+ /** The pre-market price, if applicable. */
138
+ preMarket?: number;
139
+ /** The status of the market. */
140
+ status: string;
141
+ /** The symbol of the asset. */
142
+ symbol: string;
143
+ /** The volume of trades. */
144
+ volume: number;
145
+ }
146
+ /**
147
+ * Represents a trade in the Polygon system.
148
+ */
149
+ export interface PolygonTrade {
150
+ /** The conditions of the trade. */
151
+ conditions: number[];
152
+ /** The correction status, if applicable. */
153
+ correction?: number;
154
+ /** The exchange where the trade occurred. */
155
+ exchange: number;
156
+ /** The unique identifier for the trade. */
157
+ id: string;
158
+ /** The timestamp of the participant. */
159
+ participant_timestamp: number;
160
+ /** The price of the trade. */
161
+ price: number;
162
+ /** The sequence number of the trade. */
163
+ sequence_number: number;
164
+ /** The timestamp from the SIP. */
165
+ sip_timestamp: number;
166
+ /** The size of the trade. */
167
+ size: number;
168
+ /** The tape number, if applicable. */
169
+ tape?: number;
170
+ /** The transfer ID, if applicable. */
171
+ trf_id?: number;
172
+ /** The timestamp of the transfer, if applicable. */
173
+ trf_timestamp?: number;
174
+ }
175
+ /**
176
+ * Represents the base response structure from Polygon.
177
+ */
178
+ export interface PolygonBaseResponse {
179
+ /** The status of the response. */
180
+ status: string;
181
+ /** The request ID. */
182
+ request_id: string;
183
+ }
184
+ /**
185
+ * Represents the response for trades from Polygon.
186
+ */
187
+ export interface PolygonTradesResponse extends PolygonBaseResponse {
188
+ /** The status of the response, which should be 'OK'. */
189
+ status: "OK";
190
+ /** The next URL for pagination, if applicable. */
191
+ next_url?: string;
192
+ /** The array of trade results. */
193
+ results: PolygonTrade[];
194
+ }
195
+ /**
196
+ * Represents an error response from Polygon.
197
+ */
198
+ export interface PolygonErrorResponse extends PolygonBaseResponse {
199
+ /** The status of the error response. */
200
+ status: "ERROR" | "NOT_AUTHORIZED" | string;
201
+ /** The error message. */
202
+ message: string;
203
+ }
204
+ //# sourceMappingURL=polygon-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon-types.d.ts","sourceRoot":"","sources":["../../../src/types/polygon-types.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,qBAAsB,SAAQ,mBAAmB;IAChE,wDAAwD;IACxD,MAAM,EAAE,IAAI,CAAC;IACb,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,wCAAwC;IACxC,MAAM,EAAE,OAAO,GAAG,gBAAgB,GAAG,MAAM,CAAC;IAC5C,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,89 @@
1
+ export interface BollingerBandsParams {
2
+ period?: number;
3
+ standardDeviations?: number;
4
+ }
5
+ export interface BollingerBandsData {
6
+ date: string;
7
+ middle: number;
8
+ upper: number;
9
+ lower: number;
10
+ close: number;
11
+ }
12
+ export interface EMAParams {
13
+ period?: number;
14
+ period2?: number;
15
+ }
16
+ export interface EMAData {
17
+ date: string;
18
+ ema: number;
19
+ ema2?: number;
20
+ close: number;
21
+ }
22
+ export interface MACDParams {
23
+ shortPeriod?: number;
24
+ longPeriod?: number;
25
+ signalPeriod?: number;
26
+ }
27
+ export interface MACDData {
28
+ date: string;
29
+ macd: number;
30
+ signal: number;
31
+ histogram: number;
32
+ close: number;
33
+ }
34
+ export interface FibonacciParams {
35
+ lookbackPeriod?: number;
36
+ retracementLevels?: number[];
37
+ extensionLevels?: number[];
38
+ reverseDirection?: boolean;
39
+ }
40
+ export interface FibonacciLevel {
41
+ level: number;
42
+ price: number;
43
+ type: "retracement" | "extension";
44
+ }
45
+ export interface FibonacciData {
46
+ date: string;
47
+ levels?: FibonacciLevel[];
48
+ swingHigh?: number;
49
+ swingLow?: number;
50
+ trend?: "uptrend" | "downtrend";
51
+ close: number;
52
+ }
53
+ export interface RSIParams {
54
+ period?: number;
55
+ }
56
+ export interface RSIData {
57
+ date: string;
58
+ rsi: number;
59
+ close: number;
60
+ }
61
+ export interface StochasticParams {
62
+ lookbackPeriod?: number;
63
+ signalPeriod?: number;
64
+ smoothingFactor?: number;
65
+ }
66
+ export interface StochData {
67
+ date: string;
68
+ slowK: number;
69
+ slowD: number;
70
+ close: number;
71
+ }
72
+ export interface SupportResistanceParams {
73
+ windowSize?: number;
74
+ sensitivity?: number;
75
+ minGapBetweenLevels?: number;
76
+ maxLevels?: number;
77
+ lookbackPeriod?: number;
78
+ }
79
+ export interface SupportResistanceLevel {
80
+ price: number;
81
+ strength: number;
82
+ type: "support" | "resistance";
83
+ }
84
+ export interface SupportResistanceData {
85
+ date: string;
86
+ levels: SupportResistanceLevel[];
87
+ close: number;
88
+ }
89
+ //# sourceMappingURL=ta-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ta-types.d.ts","sourceRoot":"","sources":["../../../src/types/ta-types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM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AC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * API credential validation utilities
3
+ * Provides fast, synchronous validation of API credentials before making requests
4
+ */
5
+ /**
6
+ * Validates Alpaca API credentials
7
+ * @param auth - Authentication object containing API key and secret
8
+ * @param options - Validation options
9
+ * @param options.throwOnMissing - If false, missing credentials will log a warning instead of throwing (default: true)
10
+ * @throws {Error} If credentials are invalid (when throwOnMissing is true)
11
+ * @returns {boolean} True if credentials are valid, false if missing (when throwOnMissing is false)
12
+ */
13
+ export declare function validateAlpacaCredentials(auth: {
14
+ apiKey?: string;
15
+ apiSecret?: string;
16
+ isPaper?: boolean;
17
+ }, options?: {
18
+ throwOnMissing?: boolean;
19
+ }): boolean;
20
+ /**
21
+ * Validates Polygon API key
22
+ * @param apiKey - Polygon API key
23
+ * @throws {Error} If API key is invalid or missing
24
+ */
25
+ export declare function validatePolygonApiKey(apiKey: string): void;
26
+ /**
27
+ * Validates Alpha Vantage API key
28
+ * @param apiKey - Alpha Vantage API key
29
+ * @throws {Error} If API key is invalid or missing
30
+ */
31
+ export declare function validateAlphaVantageApiKey(apiKey: string): void;
32
+ //# sourceMappingURL=auth-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-validator.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-validator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,EACD,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAA6B,GAC/D,OAAO,CA2CT;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAM/D"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * HTTP connection pooling and keep-alive configuration.
3
+ *
4
+ * Node.js (>=20) uses undici as its built-in fetch implementation, which
5
+ * automatically maintains an internal connection pool with keep-alive enabled
6
+ * by default. This module provides:
7
+ *
8
+ * 1. Explicit documentation of the connection pooling behavior
9
+ * 2. A configured HTTP Agent for use with node:http/node:https if needed
10
+ * 3. Verification utilities to confirm keep-alive is active
11
+ *
12
+ * ## Connection Pooling Behavior
13
+ *
14
+ * **Native fetch (undici):** The global `fetch()` used throughout this package
15
+ * uses Node.js built-in undici which maintains persistent connections by default.
16
+ * Connections are kept alive and reused across requests to the same origin.
17
+ * No additional configuration is needed for fetch-based API calls.
18
+ *
19
+ * **Alpaca SDK (@alpacahq/alpaca-trade-api):** The SDK uses its own internal
20
+ * HTTP client with connection reuse. The SDK is configured through `AlpacaClient`
21
+ * in `src/alpaca/client.ts` via the `createAlpacaClient()` factory which caches
22
+ * client instances by API key + account type.
23
+ *
24
+ * **WebSocket connections:** Trading API and market data WebSocket connections
25
+ * are long-lived persistent connections managed by `AlpacaTradingAPI` and
26
+ * `AlpacaMarketDataAPI` respectively.
27
+ *
28
+ * ## API Client Summary
29
+ *
30
+ * | API Client | Transport | Keep-Alive | Connection Reuse |
31
+ * |------------|-----------|------------|------------------|
32
+ * | Alpaca Trading (direct) | fetch() | Built-in | Undici pool |
33
+ * | Alpaca Market Data | fetch() | Built-in | Undici pool |
34
+ * | Alpaca SDK | internal | Built-in | SDK managed |
35
+ * | Polygon.io | fetch() via fetchWithRetry | Built-in | Undici pool |
36
+ * | Alpha Vantage | fetch() | Built-in | Undici pool |
37
+ * | WebSocket (Trading) | ws | Persistent | Long-lived |
38
+ * | WebSocket (Market Data) | ws | Persistent | Long-lived |
39
+ */
40
+ import http from "http";
41
+ import https from "https";
42
+ /**
43
+ * Default keep-alive configuration values.
44
+ * These are applied when creating explicit HTTP agents for non-fetch use cases.
45
+ */
46
+ export declare const KEEP_ALIVE_DEFAULTS: {
47
+ /** Enable keep-alive connections */
48
+ readonly keepAlive: true;
49
+ /** Initial delay before sending keep-alive probes (in milliseconds) */
50
+ readonly keepAliveMsecs: 60000;
51
+ /** Maximum number of sockets per host */
52
+ readonly maxSockets: 50;
53
+ /** Maximum total number of sockets */
54
+ readonly maxTotalSockets: 256;
55
+ /** Maximum number of free (idle) sockets per host */
56
+ readonly maxFreeSockets: 10;
57
+ /** Socket timeout for idle connections (in milliseconds) */
58
+ readonly timeout: 60000;
59
+ };
60
+ /**
61
+ * Pre-configured HTTP agent with keep-alive enabled.
62
+ * Use this when making requests through node:http (not needed for fetch).
63
+ */
64
+ export declare const httpAgent: http.Agent;
65
+ /**
66
+ * Pre-configured HTTPS agent with keep-alive enabled.
67
+ * Use this when making requests through node:https (not needed for fetch).
68
+ */
69
+ export declare const httpsAgent: https.Agent;
70
+ /**
71
+ * Connection pool status information
72
+ */
73
+ export interface ConnectionPoolStatus {
74
+ /** Name of the HTTP agent */
75
+ name: string;
76
+ /** Whether keep-alive is enabled */
77
+ keepAlive: boolean;
78
+ /** Number of active sockets */
79
+ activeSockets: number;
80
+ /** Number of free (idle) sockets */
81
+ freeSockets: number;
82
+ /** Number of pending requests (waiting for a socket) */
83
+ pendingRequests: number;
84
+ /** Maximum sockets per host */
85
+ maxSockets: number;
86
+ /** Maximum free sockets per host */
87
+ maxFreeSockets: number;
88
+ }
89
+ /**
90
+ * Get the connection pool status for an HTTP/HTTPS agent.
91
+ * Useful for monitoring and debugging connection reuse.
92
+ *
93
+ * @param agent - The HTTP/HTTPS agent to inspect
94
+ * @param name - A human-readable name for the agent
95
+ * @returns Connection pool status information
96
+ */
97
+ export declare function getAgentPoolStatus(agent: http.Agent | https.Agent, name?: string): ConnectionPoolStatus;
98
+ /**
99
+ * Verifies that keep-alive is properly configured for the Node.js built-in fetch.
100
+ * Node.js >= 20 uses undici internally, which has keep-alive enabled by default.
101
+ *
102
+ * @returns Object indicating whether keep-alive is expected to be active
103
+ */
104
+ export declare function verifyFetchKeepAlive(): {
105
+ supported: boolean;
106
+ nodeVersion: string;
107
+ undiciBuiltIn: boolean;
108
+ keepAliveExpected: boolean;
109
+ };
110
+ //# sourceMappingURL=http-keep-alive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-keep-alive.d.ts","sourceRoot":"","sources":["../../../src/utils/http-keep-alive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IAC9B,oCAAoC;;IAEpC,uEAAuE;;IAEvE,yCAAyC;;IAEzC,sCAAsC;;IAEtC,qDAAqD;;IAErD,4DAA4D;;CAEpD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,SAAS,YAOpB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU,aAOrB,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,EAC/B,IAAI,GAAE,MAAkB,GACvB,oBAAoB,CA4BtB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAeA"}