@finatic/client 0.0.131
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.
- package/README.md +489 -0
- package/dist/index.d.ts +2037 -0
- package/dist/index.js +4815 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4787 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/client/ApiClient.d.ts +234 -0
- package/dist/types/client/FinaticConnect.d.ts +307 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/mocks/MockApiClient.d.ts +228 -0
- package/dist/types/mocks/MockDataProvider.d.ts +132 -0
- package/dist/types/mocks/MockFactory.d.ts +53 -0
- package/dist/types/mocks/index.d.ts +5 -0
- package/dist/types/mocks/utils.d.ts +29 -0
- package/dist/types/portal/PortalUI.d.ts +38 -0
- package/dist/types/security/ApiSecurity.d.ts +24 -0
- package/dist/types/security/RuntimeSecurity.d.ts +28 -0
- package/dist/types/security/SecurityUtils.d.ts +21 -0
- package/dist/types/security/index.d.ts +2 -0
- package/dist/types/services/AnalyticsService.d.ts +18 -0
- package/dist/types/services/ApiClient.d.ts +121 -0
- package/dist/types/services/PortalService.d.ts +24 -0
- package/dist/types/services/TradingService.d.ts +55 -0
- package/dist/types/services/api.d.ts +23 -0
- package/dist/types/services/auth.d.ts +9 -0
- package/dist/types/services/index.d.ts +4 -0
- package/dist/types/services/portfolio.d.ts +10 -0
- package/dist/types/services/trading.d.ts +10 -0
- package/dist/types/shared/index.d.ts +2 -0
- package/dist/types/shared/themes/index.d.ts +2 -0
- package/dist/types/shared/themes/portalPresets.d.ts +8 -0
- package/dist/types/shared/themes/presets.d.ts +3 -0
- package/dist/types/shared/themes/system.d.ts +2 -0
- package/dist/types/shared/types/index.d.ts +110 -0
- package/dist/types/types/api.d.ts +486 -0
- package/dist/types/types/config.d.ts +12 -0
- package/dist/types/types/connect.d.ts +51 -0
- package/dist/types/types/errors.d.ts +47 -0
- package/dist/types/types/portal.d.ts +75 -0
- package/dist/types/types/security.d.ts +35 -0
- package/dist/types/types/shared.d.ts +50 -0
- package/dist/types/types/theme.d.ts +101 -0
- package/dist/types/types.d.ts +157 -0
- package/dist/types/utils/errors.d.ts +42 -0
- package/dist/types/utils/events.d.ts +12 -0
- package/dist/types/utils/themeUtils.d.ts +34 -0
- package/package.json +56 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API-related types for Finatic Connect SDK
|
|
3
|
+
*/
|
|
4
|
+
export interface SessionInitResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
data: {
|
|
8
|
+
one_time_token: string;
|
|
9
|
+
expires_at: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface SessionResponseData {
|
|
13
|
+
session_id: string;
|
|
14
|
+
company_id: string;
|
|
15
|
+
status: 'pending';
|
|
16
|
+
expires_at: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SessionStartResponse {
|
|
19
|
+
data: SessionResponseData;
|
|
20
|
+
message: 'Session started successfully';
|
|
21
|
+
}
|
|
22
|
+
export interface OtpRequestResponse {
|
|
23
|
+
success: boolean;
|
|
24
|
+
message: string;
|
|
25
|
+
data: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface OtpVerifyResponse {
|
|
28
|
+
success: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
data: {
|
|
31
|
+
access_token: string;
|
|
32
|
+
refresh_token: string;
|
|
33
|
+
user_id: string;
|
|
34
|
+
expires_in: number;
|
|
35
|
+
scope: string;
|
|
36
|
+
token_type: 'Bearer';
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface PortalUrlResponse {
|
|
40
|
+
success: boolean;
|
|
41
|
+
message: string;
|
|
42
|
+
data: {
|
|
43
|
+
portal_url: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface UserToken {
|
|
47
|
+
accessToken: string;
|
|
48
|
+
refreshToken: string;
|
|
49
|
+
expiresIn: number;
|
|
50
|
+
user_id: string;
|
|
51
|
+
tokenType: string;
|
|
52
|
+
scope: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ApiError {
|
|
55
|
+
code: string;
|
|
56
|
+
message: string;
|
|
57
|
+
details?: Record<string, any>;
|
|
58
|
+
}
|
|
59
|
+
export interface ApiConfig {
|
|
60
|
+
baseUrl: string;
|
|
61
|
+
apiKey?: string;
|
|
62
|
+
sandbox?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface RequestHeaders {
|
|
65
|
+
'Content-Type': string;
|
|
66
|
+
'X-API-Key'?: string;
|
|
67
|
+
Authorization?: string;
|
|
68
|
+
'X-CSRF-Token'?: string;
|
|
69
|
+
token?: string;
|
|
70
|
+
'User-Agent'?: string;
|
|
71
|
+
'X-Device-Info'?: string;
|
|
72
|
+
'X-Request-ID'?: string;
|
|
73
|
+
'X-Request-Timestamp'?: string;
|
|
74
|
+
'X-Request-Signature'?: string;
|
|
75
|
+
[key: string]: string | undefined;
|
|
76
|
+
}
|
|
77
|
+
export declare enum SessionState {
|
|
78
|
+
PENDING = "PENDING",
|
|
79
|
+
AUTHENTICATING = "AUTHENTICATING",
|
|
80
|
+
ACTIVE = "ACTIVE",
|
|
81
|
+
COMPLETED = "COMPLETED",
|
|
82
|
+
EXPIRED = "EXPIRED"
|
|
83
|
+
}
|
|
84
|
+
export type SessionStatus = SessionState;
|
|
85
|
+
export interface ApiResponse<T> {
|
|
86
|
+
data: T;
|
|
87
|
+
error?: string;
|
|
88
|
+
status: number;
|
|
89
|
+
}
|
|
90
|
+
export interface Order {
|
|
91
|
+
symbol: string;
|
|
92
|
+
side: 'buy' | 'sell';
|
|
93
|
+
quantity: number;
|
|
94
|
+
type_: 'market' | 'limit' | 'stop' | 'stop_limit';
|
|
95
|
+
price?: number;
|
|
96
|
+
stopPrice?: number;
|
|
97
|
+
timeInForce: 'day' | 'gtc' | 'opg' | 'cls' | 'ioc' | 'fok';
|
|
98
|
+
}
|
|
99
|
+
export interface OptionsOrder extends Order {
|
|
100
|
+
optionType: 'call' | 'put';
|
|
101
|
+
strikePrice: number;
|
|
102
|
+
expirationDate: string;
|
|
103
|
+
}
|
|
104
|
+
export interface BrokerAccount {
|
|
105
|
+
id: string;
|
|
106
|
+
user_broker_connection_id: string;
|
|
107
|
+
broker_provided_account_id: string;
|
|
108
|
+
account_name: string;
|
|
109
|
+
account_type: string;
|
|
110
|
+
currency: string;
|
|
111
|
+
cash_balance: number;
|
|
112
|
+
buying_power: number;
|
|
113
|
+
status: string;
|
|
114
|
+
/** ISO 8601 timestamp with timezone information */
|
|
115
|
+
created_at: string;
|
|
116
|
+
/** ISO 8601 timestamp with timezone information */
|
|
117
|
+
updated_at: string;
|
|
118
|
+
/** ISO 8601 timestamp with timezone information */
|
|
119
|
+
last_synced_at: string;
|
|
120
|
+
}
|
|
121
|
+
export interface BrokerOrder {
|
|
122
|
+
id: string;
|
|
123
|
+
user_broker_connection_id: string;
|
|
124
|
+
broker_provided_account_id: string;
|
|
125
|
+
order_id: string;
|
|
126
|
+
symbol: string;
|
|
127
|
+
order_type: string;
|
|
128
|
+
side: 'buy' | 'sell';
|
|
129
|
+
quantity: number;
|
|
130
|
+
price: number;
|
|
131
|
+
status: string;
|
|
132
|
+
/** ISO 8601 timestamp with timezone information */
|
|
133
|
+
created_at: string;
|
|
134
|
+
/** ISO 8601 timestamp with timezone information */
|
|
135
|
+
updated_at: string;
|
|
136
|
+
/** ISO 8601 timestamp with timezone information, null if not filled */
|
|
137
|
+
filled_at: string | null;
|
|
138
|
+
filled_quantity: number;
|
|
139
|
+
filled_avg_price: number;
|
|
140
|
+
}
|
|
141
|
+
export interface BrokerPosition {
|
|
142
|
+
id: string;
|
|
143
|
+
user_broker_connection_id: string;
|
|
144
|
+
broker_provided_account_id: string;
|
|
145
|
+
symbol: string;
|
|
146
|
+
asset_type: string;
|
|
147
|
+
quantity: number;
|
|
148
|
+
average_price: number;
|
|
149
|
+
market_value: number;
|
|
150
|
+
cost_basis: number;
|
|
151
|
+
unrealized_gain_loss: number;
|
|
152
|
+
unrealized_gain_loss_percent: number;
|
|
153
|
+
current_price: number;
|
|
154
|
+
last_price: number;
|
|
155
|
+
/** ISO 8601 timestamp with timezone information */
|
|
156
|
+
last_price_updated_at: string;
|
|
157
|
+
/** ISO 8601 timestamp with timezone information */
|
|
158
|
+
created_at: string;
|
|
159
|
+
/** ISO 8601 timestamp with timezone information */
|
|
160
|
+
updated_at: string;
|
|
161
|
+
}
|
|
162
|
+
export interface BrokerDataOptions {
|
|
163
|
+
broker_name?: string;
|
|
164
|
+
account_id?: string;
|
|
165
|
+
symbol?: string;
|
|
166
|
+
}
|
|
167
|
+
export interface PortfolioSnapshot {
|
|
168
|
+
timestamp: string;
|
|
169
|
+
totalValue: number;
|
|
170
|
+
cash: number;
|
|
171
|
+
equity: number;
|
|
172
|
+
positions: {
|
|
173
|
+
symbol: string;
|
|
174
|
+
quantity: number;
|
|
175
|
+
averagePrice: number;
|
|
176
|
+
currentPrice: number;
|
|
177
|
+
marketValue: number;
|
|
178
|
+
unrealizedPnL: number;
|
|
179
|
+
}[];
|
|
180
|
+
}
|
|
181
|
+
export interface PerformanceMetrics {
|
|
182
|
+
totalReturn: number;
|
|
183
|
+
dailyReturn: number;
|
|
184
|
+
weeklyReturn: number;
|
|
185
|
+
monthlyReturn: number;
|
|
186
|
+
yearlyReturn: number;
|
|
187
|
+
maxDrawdown: number;
|
|
188
|
+
sharpeRatio: number;
|
|
189
|
+
beta: number;
|
|
190
|
+
alpha: number;
|
|
191
|
+
}
|
|
192
|
+
export interface Holding {
|
|
193
|
+
symbol: string;
|
|
194
|
+
quantity: number;
|
|
195
|
+
averagePrice: number;
|
|
196
|
+
currentPrice: number;
|
|
197
|
+
marketValue: number;
|
|
198
|
+
unrealizedPnL: number;
|
|
199
|
+
realizedPnL: number;
|
|
200
|
+
costBasis: number;
|
|
201
|
+
currency: string;
|
|
202
|
+
}
|
|
203
|
+
export interface Portfolio {
|
|
204
|
+
id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
type: string;
|
|
207
|
+
status: string;
|
|
208
|
+
cash: number;
|
|
209
|
+
buyingPower: number;
|
|
210
|
+
equity: number;
|
|
211
|
+
longMarketValue: number;
|
|
212
|
+
shortMarketValue: number;
|
|
213
|
+
initialMargin: number;
|
|
214
|
+
maintenanceMargin: number;
|
|
215
|
+
lastEquity: number;
|
|
216
|
+
positions: Holding[];
|
|
217
|
+
performance: PerformanceMetrics;
|
|
218
|
+
}
|
|
219
|
+
export interface PortalResponse {
|
|
220
|
+
portalUrl: string;
|
|
221
|
+
token: string;
|
|
222
|
+
expiresIn: number;
|
|
223
|
+
}
|
|
224
|
+
export interface SessionValidationResponse {
|
|
225
|
+
valid: boolean;
|
|
226
|
+
company_id: string;
|
|
227
|
+
status: string;
|
|
228
|
+
}
|
|
229
|
+
export interface SessionAuthenticateResponse {
|
|
230
|
+
success: boolean;
|
|
231
|
+
message: string;
|
|
232
|
+
data: {
|
|
233
|
+
access_token: string;
|
|
234
|
+
refresh_token: string;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export interface RefreshTokenRequest {
|
|
238
|
+
refresh_token: string;
|
|
239
|
+
}
|
|
240
|
+
export interface RefreshTokenResponse {
|
|
241
|
+
success: boolean;
|
|
242
|
+
response_data: {
|
|
243
|
+
access_token: string;
|
|
244
|
+
refresh_token: string;
|
|
245
|
+
expires_at: string;
|
|
246
|
+
company_id: string;
|
|
247
|
+
company_name: string;
|
|
248
|
+
email_verified: boolean;
|
|
249
|
+
};
|
|
250
|
+
message: string;
|
|
251
|
+
}
|
|
252
|
+
export interface TokenInfo {
|
|
253
|
+
accessToken: string;
|
|
254
|
+
refreshToken: string;
|
|
255
|
+
expiresAt: string;
|
|
256
|
+
userId?: string;
|
|
257
|
+
}
|
|
258
|
+
export interface SessionResponse {
|
|
259
|
+
data: {
|
|
260
|
+
session_id: string;
|
|
261
|
+
state: SessionState;
|
|
262
|
+
device_info?: Record<string, string>;
|
|
263
|
+
company_id?: string;
|
|
264
|
+
status?: string;
|
|
265
|
+
expires_at?: string;
|
|
266
|
+
user_id?: string | null;
|
|
267
|
+
auto_login?: boolean;
|
|
268
|
+
access_token?: string;
|
|
269
|
+
refresh_token?: string;
|
|
270
|
+
expires_in?: number;
|
|
271
|
+
token_type?: string;
|
|
272
|
+
scope?: string;
|
|
273
|
+
};
|
|
274
|
+
message: string;
|
|
275
|
+
}
|
|
276
|
+
export interface BrokerInfo {
|
|
277
|
+
id: string;
|
|
278
|
+
name: string;
|
|
279
|
+
display_name: string;
|
|
280
|
+
description: string;
|
|
281
|
+
website: string;
|
|
282
|
+
features: string[];
|
|
283
|
+
auth_type: 'oauth' | 'api_key';
|
|
284
|
+
logo_path: string;
|
|
285
|
+
is_active: boolean;
|
|
286
|
+
}
|
|
287
|
+
export interface DeviceInfo {
|
|
288
|
+
ip_address: string;
|
|
289
|
+
user_agent: string;
|
|
290
|
+
fingerprint: string;
|
|
291
|
+
}
|
|
292
|
+
export interface BrokerOrderParams {
|
|
293
|
+
broker: 'robinhood' | 'tasty_trade' | 'ninja_trader';
|
|
294
|
+
accountNumber: string;
|
|
295
|
+
symbol: string;
|
|
296
|
+
orderQty: number;
|
|
297
|
+
action: 'Buy' | 'Sell';
|
|
298
|
+
orderType: 'Market' | 'Limit' | 'Stop' | 'TrailingStop';
|
|
299
|
+
assetType: 'Stock' | 'Option' | 'Crypto' | 'Futures';
|
|
300
|
+
timeInForce: 'day' | 'gtc' | 'gtd' | 'ioc' | 'fok';
|
|
301
|
+
price?: number;
|
|
302
|
+
stopPrice?: number;
|
|
303
|
+
}
|
|
304
|
+
export interface BrokerExtras {
|
|
305
|
+
robinhood?: {
|
|
306
|
+
extendedHours?: boolean;
|
|
307
|
+
marketHours?: 'regular_hours' | 'extended_hours';
|
|
308
|
+
trailType?: 'percentage' | 'amount';
|
|
309
|
+
};
|
|
310
|
+
ninjaTrader?: {
|
|
311
|
+
accountSpec?: string;
|
|
312
|
+
isAutomated?: boolean;
|
|
313
|
+
activationTime?: string;
|
|
314
|
+
text?: string;
|
|
315
|
+
pegDifference?: number;
|
|
316
|
+
expireTime?: string;
|
|
317
|
+
};
|
|
318
|
+
tastyTrade?: {
|
|
319
|
+
automatedSource?: boolean;
|
|
320
|
+
priceEffect?: 'Debit' | 'Credit';
|
|
321
|
+
externalIdentifier?: string;
|
|
322
|
+
partitionKey?: string;
|
|
323
|
+
preflightId?: string;
|
|
324
|
+
source?: string;
|
|
325
|
+
valueEffect?: 'Debit' | 'Credit';
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
export interface CryptoOrderOptions {
|
|
329
|
+
quantity?: number;
|
|
330
|
+
notional?: number;
|
|
331
|
+
}
|
|
332
|
+
export interface OptionsOrderOptions {
|
|
333
|
+
strikePrice: number;
|
|
334
|
+
expirationDate: string;
|
|
335
|
+
optionType: 'call' | 'put';
|
|
336
|
+
contractSize?: number;
|
|
337
|
+
}
|
|
338
|
+
export interface OrderResponse {
|
|
339
|
+
success: boolean;
|
|
340
|
+
response_data: {
|
|
341
|
+
orderId: string;
|
|
342
|
+
status: string;
|
|
343
|
+
broker?: string;
|
|
344
|
+
accountNumber?: string;
|
|
345
|
+
};
|
|
346
|
+
message: string;
|
|
347
|
+
status_code: number;
|
|
348
|
+
}
|
|
349
|
+
export interface TradingContext {
|
|
350
|
+
broker?: string;
|
|
351
|
+
accountNumber?: string;
|
|
352
|
+
accountId?: string;
|
|
353
|
+
}
|
|
354
|
+
export interface BrokerConnection {
|
|
355
|
+
id: string;
|
|
356
|
+
broker_id: string;
|
|
357
|
+
user_id: string;
|
|
358
|
+
company_id: string;
|
|
359
|
+
status: 'connected' | 'disconnected' | 'error';
|
|
360
|
+
connected_at: string;
|
|
361
|
+
last_synced_at: string | null;
|
|
362
|
+
permissions: {
|
|
363
|
+
read: boolean;
|
|
364
|
+
write: boolean;
|
|
365
|
+
};
|
|
366
|
+
metadata: {
|
|
367
|
+
nickname?: string;
|
|
368
|
+
[key: string]: any;
|
|
369
|
+
};
|
|
370
|
+
needs_reauth: boolean;
|
|
371
|
+
}
|
|
372
|
+
export interface OrdersFilter {
|
|
373
|
+
broker_id?: string;
|
|
374
|
+
connection_id?: string;
|
|
375
|
+
account_id?: string;
|
|
376
|
+
symbol?: string;
|
|
377
|
+
status?: 'filled' | 'pending' | 'cancelled' | 'rejected' | 'partially_filled';
|
|
378
|
+
side?: 'buy' | 'sell';
|
|
379
|
+
asset_type?: 'stock' | 'option' | 'crypto' | 'future';
|
|
380
|
+
limit?: number;
|
|
381
|
+
offset?: number;
|
|
382
|
+
created_after?: string;
|
|
383
|
+
created_before?: string;
|
|
384
|
+
with_metadata?: boolean;
|
|
385
|
+
}
|
|
386
|
+
export interface PositionsFilter {
|
|
387
|
+
broker_id?: string;
|
|
388
|
+
connection_id?: string;
|
|
389
|
+
account_id?: string;
|
|
390
|
+
symbol?: string;
|
|
391
|
+
side?: 'long' | 'short';
|
|
392
|
+
asset_type?: 'stock' | 'option' | 'crypto' | 'future';
|
|
393
|
+
position_status?: 'open' | 'closed';
|
|
394
|
+
limit?: number;
|
|
395
|
+
offset?: number;
|
|
396
|
+
updated_after?: string;
|
|
397
|
+
updated_before?: string;
|
|
398
|
+
with_metadata?: boolean;
|
|
399
|
+
}
|
|
400
|
+
export interface AccountsFilter {
|
|
401
|
+
broker_id?: string;
|
|
402
|
+
connection_id?: string;
|
|
403
|
+
account_type?: 'margin' | 'cash' | 'crypto_wallet' | 'live' | 'sim';
|
|
404
|
+
status?: 'active' | 'inactive';
|
|
405
|
+
currency?: string;
|
|
406
|
+
limit?: number;
|
|
407
|
+
offset?: number;
|
|
408
|
+
with_metadata?: boolean;
|
|
409
|
+
}
|
|
410
|
+
export interface BrokerDataOrder {
|
|
411
|
+
id: string;
|
|
412
|
+
broker_id: string;
|
|
413
|
+
connection_id: string;
|
|
414
|
+
account_id: string;
|
|
415
|
+
order_id: string;
|
|
416
|
+
symbol: string;
|
|
417
|
+
order_type: string;
|
|
418
|
+
side: 'buy' | 'sell';
|
|
419
|
+
quantity: number;
|
|
420
|
+
price: number;
|
|
421
|
+
status: 'filled' | 'pending' | 'cancelled' | 'rejected' | 'partially_filled';
|
|
422
|
+
asset_type: 'stock' | 'option' | 'crypto' | 'future';
|
|
423
|
+
created_at: string;
|
|
424
|
+
updated_at: string;
|
|
425
|
+
filled_at?: string;
|
|
426
|
+
filled_quantity: number;
|
|
427
|
+
filled_avg_price: number;
|
|
428
|
+
metadata?: Record<string, any>;
|
|
429
|
+
}
|
|
430
|
+
export interface BrokerDataPosition {
|
|
431
|
+
id: string;
|
|
432
|
+
broker_id: string;
|
|
433
|
+
connection_id: string;
|
|
434
|
+
account_id: string;
|
|
435
|
+
symbol: string;
|
|
436
|
+
asset_type: 'stock' | 'option' | 'crypto' | 'future';
|
|
437
|
+
side: 'long' | 'short';
|
|
438
|
+
quantity: number;
|
|
439
|
+
average_price: number;
|
|
440
|
+
market_value: number;
|
|
441
|
+
cost_basis: number;
|
|
442
|
+
unrealized_gain_loss: number;
|
|
443
|
+
unrealized_gain_loss_percent: number;
|
|
444
|
+
current_price: number;
|
|
445
|
+
last_price: number;
|
|
446
|
+
last_price_updated_at: string;
|
|
447
|
+
position_status: 'open' | 'closed';
|
|
448
|
+
created_at: string;
|
|
449
|
+
updated_at: string;
|
|
450
|
+
metadata?: Record<string, any>;
|
|
451
|
+
}
|
|
452
|
+
export interface BrokerDataAccount {
|
|
453
|
+
id: string;
|
|
454
|
+
broker_id: string;
|
|
455
|
+
connection_id: string;
|
|
456
|
+
account_id: string;
|
|
457
|
+
account_name: string;
|
|
458
|
+
account_type: 'margin' | 'cash' | 'crypto_wallet' | 'live' | 'sim';
|
|
459
|
+
status: 'active' | 'inactive';
|
|
460
|
+
currency: string;
|
|
461
|
+
cash_balance: number;
|
|
462
|
+
buying_power: number;
|
|
463
|
+
equity: number;
|
|
464
|
+
created_at: string;
|
|
465
|
+
updated_at: string;
|
|
466
|
+
last_synced_at: string;
|
|
467
|
+
metadata?: Record<string, any>;
|
|
468
|
+
}
|
|
469
|
+
export interface FilteredOrdersResponse {
|
|
470
|
+
orders: BrokerDataOrder[];
|
|
471
|
+
total: number;
|
|
472
|
+
limit: number;
|
|
473
|
+
offset: number;
|
|
474
|
+
}
|
|
475
|
+
export interface FilteredPositionsResponse {
|
|
476
|
+
positions: BrokerDataPosition[];
|
|
477
|
+
total: number;
|
|
478
|
+
limit: number;
|
|
479
|
+
offset: number;
|
|
480
|
+
}
|
|
481
|
+
export interface FilteredAccountsResponse {
|
|
482
|
+
accounts: BrokerDataAccount[];
|
|
483
|
+
total: number;
|
|
484
|
+
limit: number;
|
|
485
|
+
offset: number;
|
|
486
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Theme } from './theme';
|
|
2
|
+
export interface SDKConfig {
|
|
3
|
+
token: string;
|
|
4
|
+
theme?: Theme;
|
|
5
|
+
sandbox?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const DEFAULT_THEME: Theme;
|
|
8
|
+
export declare const DEFAULT_CONFIG: SDKConfig;
|
|
9
|
+
export interface PortalConfig {
|
|
10
|
+
companyId: string;
|
|
11
|
+
theme?: Theme;
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Theme } from './theme';
|
|
2
|
+
import { UserToken } from './api';
|
|
3
|
+
import { PortalTheme } from './portal';
|
|
4
|
+
export interface FinaticConnectOptions {
|
|
5
|
+
/** The portal token from your backend */
|
|
6
|
+
token: string;
|
|
7
|
+
/** Optional base URL for API requests */
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
/** Optional origin for the portal */
|
|
10
|
+
origin?: string;
|
|
11
|
+
/** Callback when user successfully connects */
|
|
12
|
+
onSuccess?: (tokens: UserToken) => void;
|
|
13
|
+
/** Callback when an error occurs */
|
|
14
|
+
onError?: (error: Error) => void;
|
|
15
|
+
/** Callback when the portal is closed */
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
/** Optional theme configuration */
|
|
18
|
+
theme?: Theme;
|
|
19
|
+
/** Callback when tokens are received */
|
|
20
|
+
onTokensReceived?: (tokens: {
|
|
21
|
+
access_token?: string;
|
|
22
|
+
refresh_token?: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface FinaticUserToken {
|
|
26
|
+
accessToken: string;
|
|
27
|
+
refreshToken: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
companyId: string;
|
|
30
|
+
expiresAt: Date;
|
|
31
|
+
}
|
|
32
|
+
export interface PortalMessage {
|
|
33
|
+
type: 'success' | 'error' | 'close' | 'resize';
|
|
34
|
+
userId?: string;
|
|
35
|
+
error?: string;
|
|
36
|
+
height?: number;
|
|
37
|
+
access_token?: string;
|
|
38
|
+
refresh_token?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface PortalOptions {
|
|
41
|
+
/** Callback when user successfully connects */
|
|
42
|
+
onSuccess?: (userId: string) => void;
|
|
43
|
+
/** Callback when an error occurs */
|
|
44
|
+
onError?: (error: Error) => void;
|
|
45
|
+
/** Callback when the portal is closed */
|
|
46
|
+
onClose?: () => void;
|
|
47
|
+
/** Callback when portal events occur */
|
|
48
|
+
onEvent?: (type: string, data: any) => void;
|
|
49
|
+
/** Optional theme configuration for the portal */
|
|
50
|
+
theme?: PortalTheme;
|
|
51
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error-related types for Finatic Connect SDK
|
|
3
|
+
*/
|
|
4
|
+
export interface BaseError {
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
details?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface ApiError extends BaseError {
|
|
10
|
+
status: number;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
export interface SessionError extends BaseError {
|
|
14
|
+
sessionId?: string;
|
|
15
|
+
status?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface AuthenticationError extends BaseError {
|
|
18
|
+
userId?: string;
|
|
19
|
+
tokenType?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AuthorizationError extends BaseError {
|
|
22
|
+
resource?: string;
|
|
23
|
+
permission?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface RateLimitError extends BaseError {
|
|
26
|
+
retryAfter?: number;
|
|
27
|
+
limit?: number;
|
|
28
|
+
remaining?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface TokenError extends BaseError {
|
|
31
|
+
tokenType?: string;
|
|
32
|
+
expiresAt?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ValidationError extends BaseError {
|
|
35
|
+
field?: string;
|
|
36
|
+
value?: any;
|
|
37
|
+
constraints?: string[];
|
|
38
|
+
}
|
|
39
|
+
export interface NetworkError extends BaseError {
|
|
40
|
+
url?: string;
|
|
41
|
+
method?: string;
|
|
42
|
+
status?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface SecurityError extends BaseError {
|
|
45
|
+
securityContext?: Record<string, any>;
|
|
46
|
+
validationResult?: Record<string, any>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export interface PortalConfig {
|
|
2
|
+
width?: string;
|
|
3
|
+
height?: string;
|
|
4
|
+
position?: 'center' | 'top' | 'bottom';
|
|
5
|
+
zIndex?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PortalThemeConfig {
|
|
8
|
+
mode: 'dark' | 'light' | 'auto';
|
|
9
|
+
colors: {
|
|
10
|
+
background: {
|
|
11
|
+
primary: string;
|
|
12
|
+
secondary: string;
|
|
13
|
+
tertiary: string;
|
|
14
|
+
accent: string;
|
|
15
|
+
glass: string;
|
|
16
|
+
};
|
|
17
|
+
status: {
|
|
18
|
+
connected: string;
|
|
19
|
+
disconnected: string;
|
|
20
|
+
warning: string;
|
|
21
|
+
pending: string;
|
|
22
|
+
error: string;
|
|
23
|
+
success: string;
|
|
24
|
+
};
|
|
25
|
+
text: {
|
|
26
|
+
primary: string;
|
|
27
|
+
secondary: string;
|
|
28
|
+
muted: string;
|
|
29
|
+
inverse: string;
|
|
30
|
+
};
|
|
31
|
+
border: {
|
|
32
|
+
primary: string;
|
|
33
|
+
secondary: string;
|
|
34
|
+
hover: string;
|
|
35
|
+
focus: string;
|
|
36
|
+
accent: string;
|
|
37
|
+
};
|
|
38
|
+
input: {
|
|
39
|
+
background: string;
|
|
40
|
+
border: string;
|
|
41
|
+
borderFocus: string;
|
|
42
|
+
text: string;
|
|
43
|
+
placeholder: string;
|
|
44
|
+
};
|
|
45
|
+
button: {
|
|
46
|
+
primary: {
|
|
47
|
+
background: string;
|
|
48
|
+
text: string;
|
|
49
|
+
hover: string;
|
|
50
|
+
active: string;
|
|
51
|
+
};
|
|
52
|
+
secondary: {
|
|
53
|
+
background: string;
|
|
54
|
+
text: string;
|
|
55
|
+
border: string;
|
|
56
|
+
hover: string;
|
|
57
|
+
active: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
branding?: {
|
|
62
|
+
primaryColor?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export type PortalThemePreset = 'dark' | 'light' | 'corporateBlue' | 'purple' | 'green' | 'orange';
|
|
66
|
+
export interface PortalTheme {
|
|
67
|
+
preset?: PortalThemePreset;
|
|
68
|
+
custom?: PortalThemeConfig;
|
|
69
|
+
}
|
|
70
|
+
export interface PortalProps {
|
|
71
|
+
config: PortalConfig;
|
|
72
|
+
onClose?: () => void;
|
|
73
|
+
onReady?: () => void;
|
|
74
|
+
onError?: (error: Error) => void;
|
|
75
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security-related types for Finatic Connect SDK
|
|
3
|
+
*/
|
|
4
|
+
export interface DeviceFingerprint {
|
|
5
|
+
userAgent: string;
|
|
6
|
+
language: string;
|
|
7
|
+
platform: string;
|
|
8
|
+
screenResolution: string;
|
|
9
|
+
timezone: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SecurityHeaders {
|
|
12
|
+
'X-Request-ID': string;
|
|
13
|
+
'X-Request-Timestamp': string;
|
|
14
|
+
'X-Request-Signature': string;
|
|
15
|
+
'X-Device-Fingerprint': string;
|
|
16
|
+
'User-Agent': string;
|
|
17
|
+
}
|
|
18
|
+
export interface SecurityConfig {
|
|
19
|
+
requestTimeout: number;
|
|
20
|
+
maxRetries: number;
|
|
21
|
+
retryDelay: number;
|
|
22
|
+
validateDeviceFingerprint: boolean;
|
|
23
|
+
validateRequestSignature: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface SecurityContext {
|
|
26
|
+
deviceFingerprint: string | null;
|
|
27
|
+
userAgent: string | null;
|
|
28
|
+
lastRequestTimestamp: number;
|
|
29
|
+
requestCount: number;
|
|
30
|
+
}
|
|
31
|
+
export interface SecurityValidationResult {
|
|
32
|
+
isValid: boolean;
|
|
33
|
+
error?: string;
|
|
34
|
+
details?: Record<string, any>;
|
|
35
|
+
}
|