@clear-street/studio-sdk 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/LICENSE +201 -0
- package/README.md +288 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +90 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +239 -0
- package/core.d.ts.map +1 -0
- package/core.js +881 -0
- package/core.js.map +1 -0
- package/core.mjs +850 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +53 -0
- package/error.d.ts.map +1 -0
- package/error.js +143 -0
- package/error.js.map +1 -0
- package/error.mjs +127 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +128 -0
- package/index.d.ts +128 -0
- package/index.d.ts.map +1 -0
- package/index.js +112 -0
- package/index.js.map +1 -0
- package/index.mjs +84 -0
- package/index.mjs.map +1 -0
- package/package.json +104 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/accounts/accounts.d.ts +74 -0
- package/resources/accounts/accounts.d.ts.map +1 -0
- package/resources/accounts/accounts.js +73 -0
- package/resources/accounts/accounts.js.map +1 -0
- package/resources/accounts/accounts.mjs +46 -0
- package/resources/accounts/accounts.mjs.map +1 -0
- package/resources/accounts/bulk-orders.d.ts +137 -0
- package/resources/accounts/bulk-orders.d.ts.map +1 -0
- package/resources/accounts/bulk-orders.js +29 -0
- package/resources/accounts/bulk-orders.js.map +1 -0
- package/resources/accounts/bulk-orders.mjs +25 -0
- package/resources/accounts/bulk-orders.mjs.map +1 -0
- package/resources/accounts/easy-borrows.d.ts +17 -0
- package/resources/accounts/easy-borrows.d.ts.map +1 -0
- package/resources/accounts/easy-borrows.js +18 -0
- package/resources/accounts/easy-borrows.js.map +1 -0
- package/resources/accounts/easy-borrows.mjs +14 -0
- package/resources/accounts/easy-borrows.mjs.map +1 -0
- package/resources/accounts/index.d.ts +10 -0
- package/resources/accounts/index.d.ts.map +1 -0
- package/resources/accounts/index.js +23 -0
- package/resources/accounts/index.js.map +1 -0
- package/resources/accounts/index.mjs +11 -0
- package/resources/accounts/index.mjs.map +1 -0
- package/resources/accounts/locate-orders.d.ts +56 -0
- package/resources/accounts/locate-orders.d.ts.map +1 -0
- package/resources/accounts/locate-orders.js +39 -0
- package/resources/accounts/locate-orders.js.map +1 -0
- package/resources/accounts/locate-orders.mjs +35 -0
- package/resources/accounts/locate-orders.mjs.map +1 -0
- package/resources/accounts/orders.d.ts +168 -0
- package/resources/accounts/orders.d.ts.map +1 -0
- package/resources/accounts/orders.js +53 -0
- package/resources/accounts/orders.js.map +1 -0
- package/resources/accounts/orders.mjs +49 -0
- package/resources/accounts/orders.mjs.map +1 -0
- package/resources/accounts/pnl-details.d.ts +113 -0
- package/resources/accounts/pnl-details.d.ts.map +1 -0
- package/resources/accounts/pnl-details.js +17 -0
- package/resources/accounts/pnl-details.js.map +1 -0
- package/resources/accounts/pnl-details.mjs +13 -0
- package/resources/accounts/pnl-details.mjs.map +1 -0
- package/resources/accounts/pnl-summary.d.ts +10 -0
- package/resources/accounts/pnl-summary.d.ts.map +1 -0
- package/resources/accounts/pnl-summary.js +15 -0
- package/resources/accounts/pnl-summary.js.map +1 -0
- package/resources/accounts/pnl-summary.mjs +11 -0
- package/resources/accounts/pnl-summary.mjs.map +1 -0
- package/resources/accounts/positions.d.ts +37 -0
- package/resources/accounts/positions.d.ts.map +1 -0
- package/resources/accounts/positions.js +24 -0
- package/resources/accounts/positions.js.map +1 -0
- package/resources/accounts/positions.mjs +20 -0
- package/resources/accounts/positions.mjs.map +1 -0
- package/resources/accounts/trades.d.ts +37 -0
- package/resources/accounts/trades.d.ts.map +1 -0
- package/resources/accounts/trades.js +24 -0
- package/resources/accounts/trades.js.map +1 -0
- package/resources/accounts/trades.mjs +20 -0
- package/resources/accounts/trades.mjs.map +1 -0
- package/resources/entities/entities.d.ts +458 -0
- package/resources/entities/entities.d.ts.map +1 -0
- package/resources/entities/entities.js +61 -0
- package/resources/entities/entities.js.map +1 -0
- package/resources/entities/entities.mjs +34 -0
- package/resources/entities/entities.mjs.map +1 -0
- package/resources/entities/index.d.ts +6 -0
- package/resources/entities/index.d.ts.map +1 -0
- package/resources/entities/index.js +15 -0
- package/resources/entities/index.js.map +1 -0
- package/resources/entities/index.mjs +7 -0
- package/resources/entities/index.mjs.map +1 -0
- package/resources/entities/pnl-summaries.d.ts +10 -0
- package/resources/entities/pnl-summaries.d.ts.map +1 -0
- package/resources/entities/pnl-summaries.js +15 -0
- package/resources/entities/pnl-summaries.js.map +1 -0
- package/resources/entities/pnl-summaries.mjs +11 -0
- package/resources/entities/pnl-summaries.mjs.map +1 -0
- package/resources/entities/portfolio-margins.d.ts +10 -0
- package/resources/entities/portfolio-margins.d.ts.map +1 -0
- package/resources/entities/portfolio-margins.js +15 -0
- package/resources/entities/portfolio-margins.js.map +1 -0
- package/resources/entities/portfolio-margins.mjs +11 -0
- package/resources/entities/portfolio-margins.mjs.map +1 -0
- package/resources/entities/regt-margin-simulations.d.ts +97 -0
- package/resources/entities/regt-margin-simulations.d.ts.map +1 -0
- package/resources/entities/regt-margin-simulations.js +30 -0
- package/resources/entities/regt-margin-simulations.js.map +1 -0
- package/resources/entities/regt-margin-simulations.mjs +26 -0
- package/resources/entities/regt-margin-simulations.mjs.map +1 -0
- package/resources/entities/regt-margins.d.ts +10 -0
- package/resources/entities/regt-margins.d.ts.map +1 -0
- package/resources/entities/regt-margins.js +15 -0
- package/resources/entities/regt-margins.js.map +1 -0
- package/resources/entities/regt-margins.mjs +11 -0
- package/resources/entities/regt-margins.mjs.map +1 -0
- package/resources/index.d.ts +5 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +26 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +6 -0
- package/resources/index.mjs.map +1 -0
- package/resources/instruments.d.ts +45 -0
- package/resources/instruments.d.ts.map +1 -0
- package/resources/instruments.js +18 -0
- package/resources/instruments.js.map +1 -0
- package/resources/instruments.mjs +14 -0
- package/resources/instruments.mjs.map +1 -0
- package/resources/shared.d.ts +251 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/shims/node.d.ts +29 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +83 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1165 -0
- package/src/error.ts +146 -0
- package/src/index.ts +206 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +11 -0
- package/src/resources/accounts/accounts.ts +87 -0
- package/src/resources/accounts/bulk-orders.ts +163 -0
- package/src/resources/accounts/easy-borrows.ts +23 -0
- package/src/resources/accounts/index.ts +25 -0
- package/src/resources/accounts/locate-orders.ts +94 -0
- package/src/resources/accounts/orders.ts +246 -0
- package/src/resources/accounts/pnl-details.ts +143 -0
- package/src/resources/accounts/pnl-summary.ts +14 -0
- package/src/resources/accounts/positions.ts +66 -0
- package/src/resources/accounts/trades.ts +62 -0
- package/src/resources/entities/entities.ts +562 -0
- package/src/resources/entities/index.ts +12 -0
- package/src/resources/entities/pnl-summaries.ts +14 -0
- package/src/resources/entities/portfolio-margins.ts +14 -0
- package/src/resources/entities/regt-margin-simulations.ts +127 -0
- package/src/resources/entities/regt-margins.ts +14 -0
- package/src/resources/index.ts +13 -0
- package/src/resources/instruments.ts +70 -0
- package/src/resources/shared.ts +320 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +248 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +165 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +152 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import * as EntitiesAPI from '@clear-street/studio-sdk/resources/entities/entities';
|
|
2
|
+
import * as RegtMarginSimulationsAPI from '@clear-street/studio-sdk/resources/entities/regt-margin-simulations';
|
|
3
|
+
export interface LocateOrder {
|
|
4
|
+
/**
|
|
5
|
+
* Account ID for the account.
|
|
6
|
+
*/
|
|
7
|
+
account_id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Unique locate ID assigned by us.
|
|
10
|
+
*/
|
|
11
|
+
locate_order_id: string;
|
|
12
|
+
/**
|
|
13
|
+
* Unique MPID assigned by us.
|
|
14
|
+
*/
|
|
15
|
+
mpid: string;
|
|
16
|
+
/**
|
|
17
|
+
* The timestamp indicating when the locate order was requested.
|
|
18
|
+
*/
|
|
19
|
+
requested_at: number;
|
|
20
|
+
/**
|
|
21
|
+
* String representation of quantity.
|
|
22
|
+
*/
|
|
23
|
+
requested_quantity: string;
|
|
24
|
+
/**
|
|
25
|
+
* The status of the locate order.
|
|
26
|
+
*/
|
|
27
|
+
status: 'pending' | 'offered' | 'filled' | 'rejected' | 'declined' | 'expired' | 'cancelled';
|
|
28
|
+
symbol: string;
|
|
29
|
+
/**
|
|
30
|
+
* The timestamp indicating when the locate order was last updated.
|
|
31
|
+
*/
|
|
32
|
+
updated_at: number;
|
|
33
|
+
/**
|
|
34
|
+
* The rate charged if the instrument is held overnight.
|
|
35
|
+
*/
|
|
36
|
+
borrow_rate?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Comment from the desk.
|
|
39
|
+
*/
|
|
40
|
+
desk_comment?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The timestamp indicating when the locate-order will expire.
|
|
43
|
+
*/
|
|
44
|
+
expires_at?: number;
|
|
45
|
+
/**
|
|
46
|
+
* The locate ID, available once the locate order has been offered
|
|
47
|
+
*/
|
|
48
|
+
locate_id?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The timestamp indicating when the locate-order was located.
|
|
51
|
+
*/
|
|
52
|
+
located_at?: number;
|
|
53
|
+
/**
|
|
54
|
+
* The quantity that has been located.
|
|
55
|
+
*/
|
|
56
|
+
located_quantity?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The reference ID provided by you.
|
|
59
|
+
*/
|
|
60
|
+
reference_id?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The total cost of the locate.
|
|
63
|
+
*/
|
|
64
|
+
total_cost?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Comment from the trader.
|
|
67
|
+
*/
|
|
68
|
+
trader_comment?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface Order {
|
|
71
|
+
/**
|
|
72
|
+
* Account ID for the account.
|
|
73
|
+
*/
|
|
74
|
+
account_id: string;
|
|
75
|
+
/**
|
|
76
|
+
* When the order was created in milliseconds since epoch.
|
|
77
|
+
*/
|
|
78
|
+
created_at: number;
|
|
79
|
+
/**
|
|
80
|
+
* The quantity that has been filled.
|
|
81
|
+
*/
|
|
82
|
+
filled_quantity: string;
|
|
83
|
+
/**
|
|
84
|
+
* An internally generated unique ID for this order.
|
|
85
|
+
*/
|
|
86
|
+
order_id: string;
|
|
87
|
+
/**
|
|
88
|
+
* The type of order, can be one of the following:
|
|
89
|
+
*
|
|
90
|
+
* - `limit`: A limit order will execute at-or-better than the limit price you
|
|
91
|
+
* specify
|
|
92
|
+
* - `market`: An order that will execute at the prevailing market prices
|
|
93
|
+
*/
|
|
94
|
+
order_type: 'limit' | 'market';
|
|
95
|
+
/**
|
|
96
|
+
* The requested quantity on this order.
|
|
97
|
+
*/
|
|
98
|
+
quantity: string;
|
|
99
|
+
/**
|
|
100
|
+
* Buy, sell, sell-short indicator.
|
|
101
|
+
*/
|
|
102
|
+
side: 'buy' | 'sell' | 'sell-short';
|
|
103
|
+
/**
|
|
104
|
+
* Simplified order state, which is inferred from `OrderStatus`. Makes it easier to
|
|
105
|
+
* determine whether an order can be executed against.
|
|
106
|
+
*
|
|
107
|
+
* - `open`: Order _can_ potentially be executed against.
|
|
108
|
+
* - `rejected`: Order _cannot_ be executed against because it was rejected. This
|
|
109
|
+
* is a terminal state.
|
|
110
|
+
* - `closed`: Order _cannot_ be executed against. This is a terminal state.
|
|
111
|
+
*/
|
|
112
|
+
state: 'open' | 'rejected' | 'closed';
|
|
113
|
+
/**
|
|
114
|
+
* Granular order status using
|
|
115
|
+
* [standard values come FIX tag 39](https://www.fixtrading.org/online-specification/order-state-changes).
|
|
116
|
+
*/
|
|
117
|
+
status: 'new' | 'partially-filled' | 'filled' | 'canceled' | 'replaced' | 'pending-cancel' | 'stopped' | 'rejected' | 'suspended' | 'pending-new' | 'calculated' | 'expired' | 'accepted-for-bidding' | 'pending-replace' | 'done-for-day';
|
|
118
|
+
/**
|
|
119
|
+
* Strategy type used for execution, can be one of below. Note, we use sensible
|
|
120
|
+
* defaults for strategy parameters at the moment. In future, we will provide a way
|
|
121
|
+
* to provide specify these parameters.
|
|
122
|
+
*
|
|
123
|
+
* - `sor`: Smart order router
|
|
124
|
+
* - `dark`: Dark pool
|
|
125
|
+
* - `ap`: Arrival price
|
|
126
|
+
* - `pov`: Percentage of volume
|
|
127
|
+
* - `twap`: Time weighted average price
|
|
128
|
+
* - `vwap`: Volume weighted average price
|
|
129
|
+
*
|
|
130
|
+
* For more information on these strategies, please refer to our
|
|
131
|
+
* [documentation](https://docs.clearstreet.io/studio/docs/execution-strategies).
|
|
132
|
+
*/
|
|
133
|
+
strategy_type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap';
|
|
134
|
+
symbol: string;
|
|
135
|
+
/**
|
|
136
|
+
* The lifecycle enforcement of this order.
|
|
137
|
+
*
|
|
138
|
+
* - `day`: The order will exist for the duration of the current trading session
|
|
139
|
+
* - `ioc`: The order will immediately be executed or cancelled
|
|
140
|
+
* - `day-plus`: The order will exist only for the duration the current trading
|
|
141
|
+
* session plus extended hours, if applicable
|
|
142
|
+
* - `at-open`: The order will exist only for the opening auction of the next
|
|
143
|
+
* session
|
|
144
|
+
* - `at-close`: The order will exist only for the closing auction of the current
|
|
145
|
+
* session
|
|
146
|
+
*/
|
|
147
|
+
time_in_force: 'day' | 'ioc' | 'day-plus' | 'at-open' | 'at-close';
|
|
148
|
+
/**
|
|
149
|
+
* When the order was updated in milliseconds since epoch.
|
|
150
|
+
*/
|
|
151
|
+
updated_at: number;
|
|
152
|
+
/**
|
|
153
|
+
* A monotonically increasing number indicating the version of this order. A higher
|
|
154
|
+
* number indicates a more recent version of the order.
|
|
155
|
+
*/
|
|
156
|
+
version: number;
|
|
157
|
+
/**
|
|
158
|
+
* Calculated average price of all fills on this order.
|
|
159
|
+
*/
|
|
160
|
+
average_price?: number;
|
|
161
|
+
/**
|
|
162
|
+
* The last reason why this order was updated
|
|
163
|
+
*/
|
|
164
|
+
order_update_reason?: 'place' | 'modify' | 'cancel' | 'execution-report' | 'cancel-reject';
|
|
165
|
+
/**
|
|
166
|
+
* The requsted limit price on this order.
|
|
167
|
+
*/
|
|
168
|
+
price?: string;
|
|
169
|
+
/**
|
|
170
|
+
* The ID you provided when creating this order.
|
|
171
|
+
*/
|
|
172
|
+
reference_id?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Free form text typically contains reasons for a reject.
|
|
175
|
+
*/
|
|
176
|
+
text?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface PnlSummaryForAccount extends EntitiesAPI.PnlSummary {
|
|
179
|
+
/**
|
|
180
|
+
* Account ID
|
|
181
|
+
*/
|
|
182
|
+
account_id: string;
|
|
183
|
+
}
|
|
184
|
+
export interface Position {
|
|
185
|
+
/**
|
|
186
|
+
* Account ID for the account.
|
|
187
|
+
*/
|
|
188
|
+
account_id?: string;
|
|
189
|
+
/**
|
|
190
|
+
* String representation of quantity.
|
|
191
|
+
*/
|
|
192
|
+
quantity?: string;
|
|
193
|
+
symbol?: string;
|
|
194
|
+
}
|
|
195
|
+
export interface RegtMarginSimulation {
|
|
196
|
+
/**
|
|
197
|
+
* The margin calculation after applying simulated trades.
|
|
198
|
+
*/
|
|
199
|
+
after: EntitiesAPI.RegtMargin;
|
|
200
|
+
/**
|
|
201
|
+
* The margin calculation before applying simulated trades.
|
|
202
|
+
*/
|
|
203
|
+
before: EntitiesAPI.RegtMargin;
|
|
204
|
+
/**
|
|
205
|
+
* Timestamp of when this simulation was created.
|
|
206
|
+
*/
|
|
207
|
+
created_at: number;
|
|
208
|
+
/**
|
|
209
|
+
* Name of this simulation that you provided when creating it.
|
|
210
|
+
*/
|
|
211
|
+
name: string;
|
|
212
|
+
/**
|
|
213
|
+
* Unique ID for a simulation.
|
|
214
|
+
*/
|
|
215
|
+
simulation_id: RegtMarginSimulationsAPI.SimulationID;
|
|
216
|
+
}
|
|
217
|
+
export interface Trade {
|
|
218
|
+
/**
|
|
219
|
+
* When this trade happened in milliseconds since epoch.
|
|
220
|
+
*/
|
|
221
|
+
created_at: number;
|
|
222
|
+
/**
|
|
223
|
+
* The order ID of the order this trade occurred on.
|
|
224
|
+
*/
|
|
225
|
+
order_id: string;
|
|
226
|
+
/**
|
|
227
|
+
* The traded price.
|
|
228
|
+
*/
|
|
229
|
+
price: string;
|
|
230
|
+
/**
|
|
231
|
+
* The amount that was traded.
|
|
232
|
+
*/
|
|
233
|
+
quantity: string;
|
|
234
|
+
/**
|
|
235
|
+
* The side this trade occurred on.
|
|
236
|
+
*/
|
|
237
|
+
side: 'buy' | 'sell' | 'sell-short';
|
|
238
|
+
/**
|
|
239
|
+
* Unique trade ID assigned by us.
|
|
240
|
+
*/
|
|
241
|
+
trade_id: string;
|
|
242
|
+
/**
|
|
243
|
+
* Account ID for the account.
|
|
244
|
+
*/
|
|
245
|
+
account_id?: string;
|
|
246
|
+
/**
|
|
247
|
+
* The symbol this trade was for.
|
|
248
|
+
*/
|
|
249
|
+
symbol?: string;
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.mjs","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
package/shims/node.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import * as types from "../_shims/node-types.js";
|
|
5
|
+
declare module '../_shims/manual-types' {
|
|
6
|
+
namespace manual {
|
|
7
|
+
type Agent = types.Agent;
|
|
8
|
+
export import fetch = types.fetch;
|
|
9
|
+
type Request = types.Request;
|
|
10
|
+
type RequestInfo = types.RequestInfo;
|
|
11
|
+
type RequestInit = types.RequestInit;
|
|
12
|
+
type Response = types.Response;
|
|
13
|
+
type ResponseInit = types.ResponseInit;
|
|
14
|
+
type ResponseType = types.ResponseType;
|
|
15
|
+
type BodyInit = types.BodyInit;
|
|
16
|
+
type Headers = types.Headers;
|
|
17
|
+
type HeadersInit = types.HeadersInit;
|
|
18
|
+
type BlobPropertyBag = types.BlobPropertyBag;
|
|
19
|
+
type FilePropertyBag = types.FilePropertyBag;
|
|
20
|
+
type FileFromPathOptions = types.FileFromPathOptions;
|
|
21
|
+
export import FormData = types.FormData;
|
|
22
|
+
export import File = types.File;
|
|
23
|
+
export import Blob = types.Blob;
|
|
24
|
+
type Readable = types.Readable;
|
|
25
|
+
type FsReadStream = types.FsReadStream;
|
|
26
|
+
export import ReadableStream = types.ReadableStream;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAK9C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
|
package/shims/node.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
const types = __importStar(require("../_shims/node-types.js"));
|
|
28
|
+
const registry_1 = require("../_shims/registry.js");
|
|
29
|
+
const node_runtime_1 = require("../_shims/node-runtime.js");
|
|
30
|
+
(0, registry_1.setShims)((0, node_runtime_1.getRuntime)());
|
|
31
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,+DAA8C;AAC9C,oDAA8C;AAC9C,4DAAoD;AACpD,IAAA,mBAAQ,EAAC,IAAA,yBAAU,GAAE,CAAC,CAAC"}
|
package/shims/node.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.mjs","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":"OACO,KAAK,KAAK;OACV,EAAE,QAAQ,EAAE;OACZ,EAAE,UAAU,EAAE;AACrB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC"}
|
package/shims/web.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as types from "../_shims/web-types.js";
|
|
2
|
+
declare module '../_shims/manual-types' {
|
|
3
|
+
namespace manual {
|
|
4
|
+
type Agent = types.Agent;
|
|
5
|
+
export import fetch = types.fetch;
|
|
6
|
+
type Request = types.Request;
|
|
7
|
+
type RequestInfo = types.RequestInfo;
|
|
8
|
+
type RequestInit = types.RequestInit;
|
|
9
|
+
type Response = types.Response;
|
|
10
|
+
type ResponseInit = types.ResponseInit;
|
|
11
|
+
type ResponseType = types.ResponseType;
|
|
12
|
+
type BodyInit = types.BodyInit;
|
|
13
|
+
type Headers = types.Headers;
|
|
14
|
+
type HeadersInit = types.HeadersInit;
|
|
15
|
+
type BlobPropertyBag = types.BlobPropertyBag;
|
|
16
|
+
type FilePropertyBag = types.FilePropertyBag;
|
|
17
|
+
type FileFromPathOptions = types.FileFromPathOptions;
|
|
18
|
+
export import FormData = types.FormData;
|
|
19
|
+
export import File = types.File;
|
|
20
|
+
export import Blob = types.Blob;
|
|
21
|
+
type Readable = types.Readable;
|
|
22
|
+
type FsReadStream = types.FsReadStream;
|
|
23
|
+
export import ReadableStream = types.ReadableStream;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/shims/web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAK7C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
|
package/shims/web.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
const types = __importStar(require("../_shims/web-types.js"));
|
|
28
|
+
const registry_1 = require("../_shims/registry.js");
|
|
29
|
+
const web_runtime_1 = require("../_shims/web-runtime.js");
|
|
30
|
+
(0, registry_1.setShims)((0, web_runtime_1.getRuntime)({ manuallyImported: true }));
|
|
31
|
+
//# sourceMappingURL=web.js.map
|
package/shims/web.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/shims/web.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,8DAA6C;AAC7C,oDAA8C;AAC9C,0DAAmD;AACnD,IAAA,mBAAQ,EAAC,IAAA,wBAAU,EAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
package/shims/web.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.mjs","sourceRoot":"","sources":["../src/shims/web.ts"],"names":[],"mappings":"OACO,KAAK,KAAK;OACV,EAAE,QAAQ,EAAE;OACZ,EAAE,UAAU,EAAE;AACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 👋 Wondering what everything in here does?
|
|
2
|
+
|
|
3
|
+
`@clear-street/studio-sdk` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
|
|
4
|
+
edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
|
|
5
|
+
|
|
6
|
+
To do this, `@clear-street/studio-sdk` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
|
|
7
|
+
|
|
8
|
+
It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
|
|
9
|
+
automatically select the correct shims for each environment. However, conditional exports are a fairly new
|
|
10
|
+
feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"`
|
|
11
|
+
|
|
12
|
+
setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does.
|
|
13
|
+
Unfortunately that's still the default setting, and it can result in errors like
|
|
14
|
+
getting the wrong raw `Response` type from `.asResponse()`, for example.
|
|
15
|
+
|
|
16
|
+
The user can work around these issues by manually importing one of:
|
|
17
|
+
|
|
18
|
+
- `import '@clear-street/studio-sdk/shims/node'`
|
|
19
|
+
- `import '@clear-street/studio-sdk/shims/web'`
|
|
20
|
+
|
|
21
|
+
All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
|
|
22
|
+
|
|
23
|
+
### How it works - Runtime
|
|
24
|
+
|
|
25
|
+
Runtime shims get installed by calling `setShims` exported by `@clear-street/studio-sdk/_shims/registry`.
|
|
26
|
+
|
|
27
|
+
Manually importing `@clear-street/studio-sdk/shims/node` or `@clear-street/studio-sdk/shims/web`, calls `setShims` with the respective runtime shims.
|
|
28
|
+
|
|
29
|
+
All client code imports shims from `@clear-street/studio-sdk/_shims/index`, which:
|
|
30
|
+
|
|
31
|
+
- checks if shims have been set manually
|
|
32
|
+
- if not, calls `setShims` with the shims from `@clear-street/studio-sdk/_shims/auto/runtime`
|
|
33
|
+
- re-exports the installed shims from `@clear-street/studio-sdk/_shims/registry`.
|
|
34
|
+
|
|
35
|
+
`@clear-street/studio-sdk/_shims/auto/runtime` exports web runtime shims.
|
|
36
|
+
If the `node` export condition is set, the export map replaces it with `@clear-street/studio-sdk/_shims/auto/runtime-node`.
|
|
37
|
+
|
|
38
|
+
### How it works - Type time
|
|
39
|
+
|
|
40
|
+
All client code imports shim types from `@clear-street/studio-sdk/_shims/index`, which selects the manual types from `@clear-street/studio-sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@clear-street/studio-sdk/_shims/auto/types`.
|
|
41
|
+
|
|
42
|
+
`@clear-street/studio-sdk/_shims/manual-types` exports an empty namespace.
|
|
43
|
+
Manually importing `@clear-street/studio-sdk/shims/node` or `@clear-street/studio-sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@clear-street/studio-sdk/_shims/index`.
|
|
44
|
+
|
|
45
|
+
`@clear-street/studio-sdk/_shims/auto/types` exports web type definitions.
|
|
46
|
+
If the `node` export condition is set, the export map replaces it with `@clear-street/studio-sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
|
+
*/
|
|
4
|
+
export type Agent = any;
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
declare const _fetch: typeof fetch;
|
|
8
|
+
export { _fetch as fetch };
|
|
9
|
+
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
type _Request = Request;
|
|
12
|
+
export { _Request as Request };
|
|
13
|
+
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
type _RequestInfo = RequestInfo;
|
|
16
|
+
export { type _RequestInfo as RequestInfo };
|
|
17
|
+
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
type _RequestInit = RequestInit;
|
|
20
|
+
export { type _RequestInit as RequestInit };
|
|
21
|
+
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
type _Response = Response;
|
|
24
|
+
export { _Response as Response };
|
|
25
|
+
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
type _ResponseInit = ResponseInit;
|
|
28
|
+
export { type _ResponseInit as ResponseInit };
|
|
29
|
+
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
type _ResponseType = ResponseType;
|
|
32
|
+
export { type _ResponseType as ResponseType };
|
|
33
|
+
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
type _BodyInit = BodyInit;
|
|
36
|
+
export { type _BodyInit as BodyInit };
|
|
37
|
+
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
type _Headers = Headers;
|
|
40
|
+
export { _Headers as Headers };
|
|
41
|
+
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
type _HeadersInit = HeadersInit;
|
|
44
|
+
export { type _HeadersInit as HeadersInit };
|
|
45
|
+
|
|
46
|
+
type EndingType = 'native' | 'transparent';
|
|
47
|
+
|
|
48
|
+
export interface BlobPropertyBag {
|
|
49
|
+
endings?: EndingType;
|
|
50
|
+
type?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
|
54
|
+
lastModified?: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
|
58
|
+
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
type _FormData = FormData;
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
declare const _FormData: typeof FormData;
|
|
63
|
+
export { _FormData as FormData };
|
|
64
|
+
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
type _File = File;
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
declare const _File: typeof File;
|
|
69
|
+
export { _File as File };
|
|
70
|
+
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
type _Blob = Blob;
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
declare const _Blob: typeof Blob;
|
|
75
|
+
export { _Blob as Blob };
|
|
76
|
+
|
|
77
|
+
export declare class Readable {
|
|
78
|
+
readable: boolean;
|
|
79
|
+
readonly readableEnded: boolean;
|
|
80
|
+
readonly readableFlowing: boolean | null;
|
|
81
|
+
readonly readableHighWaterMark: number;
|
|
82
|
+
readonly readableLength: number;
|
|
83
|
+
readonly readableObjectMode: boolean;
|
|
84
|
+
destroyed: boolean;
|
|
85
|
+
read(size?: number): any;
|
|
86
|
+
pause(): this;
|
|
87
|
+
resume(): this;
|
|
88
|
+
isPaused(): boolean;
|
|
89
|
+
destroy(error?: Error): this;
|
|
90
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export declare class FsReadStream extends Readable {
|
|
94
|
+
path: {}; // node type is string | Buffer
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
type _ReadableStream<R = any> = ReadableStream<R>;
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
declare const _ReadableStream: typeof ReadableStream;
|
|
101
|
+
export { _ReadableStream as ReadableStream };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
|
+
*/
|
|
4
|
+
import { type Shims } from './registry';
|
|
5
|
+
import { getRuntime as getWebRuntime } from './web-runtime';
|
|
6
|
+
import { ReadStream as FsReadStream } from 'node:fs';
|
|
7
|
+
|
|
8
|
+
export function getRuntime(): Shims {
|
|
9
|
+
const runtime = getWebRuntime();
|
|
10
|
+
function isFsReadStream(value: any): value is FsReadStream {
|
|
11
|
+
return value instanceof FsReadStream;
|
|
12
|
+
}
|
|
13
|
+
return { ...runtime, isFsReadStream };
|
|
14
|
+
}
|