@onebullex-group/cli 1.1.2
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 +61 -0
- package/README.md +243 -0
- package/dist/chunk-AKGCHJPQ.js +88 -0
- package/dist/chunk-CVOY2SOS.js +139 -0
- package/dist/chunk-FTINNKNR.js +492 -0
- package/dist/chunk-J3TAAD3Q.js +58 -0
- package/dist/chunk-JRUFIHU7.js +45 -0
- package/dist/chunk-LVNSFQXS.js +31 -0
- package/dist/chunk-OOLZIYXS.js +41 -0
- package/dist/chunk-ZYO5P4DH.js +19 -0
- package/dist/core/config.d.ts +44 -0
- package/dist/core/config.js +19 -0
- package/dist/core/errors.d.ts +23 -0
- package/dist/core/errors.js +13 -0
- package/dist/core/http-client.d.ts +29 -0
- package/dist/core/http-client.js +13 -0
- package/dist/core/redact.d.ts +15 -0
- package/dist/core/redact.js +10 -0
- package/dist/core/signature.d.ts +39 -0
- package/dist/core/signature.js +11 -0
- package/dist/core/types.d.ts +46 -0
- package/dist/core/types.js +7 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +1627 -0
- package/dist/lint-api.d.ts +38 -0
- package/dist/lint-api.js +257 -0
- package/dist/output-UIZGG7EU.js +13 -0
- package/dist/registry.d.ts +5 -0
- package/dist/registry.js +7 -0
- package/package.json +54 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/registry.ts
|
|
4
|
+
var REGISTRY = [
|
|
5
|
+
// ───── Public (no auth) ─────
|
|
6
|
+
{
|
|
7
|
+
command: "public time",
|
|
8
|
+
method: "GET",
|
|
9
|
+
path: "/v2/public/time",
|
|
10
|
+
isWrite: false,
|
|
11
|
+
needsAuth: false,
|
|
12
|
+
implFile: "src/commands/public/time.ts"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
command: "symbol list",
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/v2/public/symbol/list",
|
|
18
|
+
isWrite: false,
|
|
19
|
+
needsAuth: false,
|
|
20
|
+
implFile: "src/commands/symbol/list.ts"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
command: "symbol get",
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/v2/public/symbol/detail",
|
|
26
|
+
isWrite: false,
|
|
27
|
+
needsAuth: false,
|
|
28
|
+
implFile: "src/commands/symbol/get.ts"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
command: "symbol coins",
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: "/v2/public/symbol/coins",
|
|
34
|
+
isWrite: false,
|
|
35
|
+
needsAuth: false,
|
|
36
|
+
implFile: "src/commands/symbol/coins.ts"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
command: "symbol all",
|
|
40
|
+
method: "GET",
|
|
41
|
+
path: "/v2/public/symbol/all",
|
|
42
|
+
isWrite: false,
|
|
43
|
+
needsAuth: false,
|
|
44
|
+
implFile: "src/commands/symbol/all.ts"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
command: "ticker get",
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: "/v2/public/q/ticker",
|
|
50
|
+
isWrite: false,
|
|
51
|
+
needsAuth: false,
|
|
52
|
+
implFile: "src/commands/ticker/get.ts"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
command: "ticker list",
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: "/v2/public/q/tickers",
|
|
58
|
+
isWrite: false,
|
|
59
|
+
needsAuth: false,
|
|
60
|
+
implFile: "src/commands/ticker/list.ts"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
command: "ticker agg",
|
|
64
|
+
method: "GET",
|
|
65
|
+
path: "/v2/public/q/agg-ticker",
|
|
66
|
+
isWrite: false,
|
|
67
|
+
needsAuth: false,
|
|
68
|
+
implFile: "src/commands/ticker/agg.ts"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
command: "ticker agg-list",
|
|
72
|
+
method: "GET",
|
|
73
|
+
path: "/v2/public/q/agg-tickers",
|
|
74
|
+
isWrite: false,
|
|
75
|
+
needsAuth: false,
|
|
76
|
+
implFile: "src/commands/ticker/agg-list.ts"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
command: "depth get",
|
|
80
|
+
method: "GET",
|
|
81
|
+
path: "/v2/public/q/depth",
|
|
82
|
+
isWrite: false,
|
|
83
|
+
needsAuth: false,
|
|
84
|
+
implFile: "src/commands/depth/get.ts"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
command: "deal list",
|
|
88
|
+
method: "GET",
|
|
89
|
+
path: "/v2/public/q/deal",
|
|
90
|
+
isWrite: false,
|
|
91
|
+
needsAuth: false,
|
|
92
|
+
implFile: "src/commands/deal/list.ts"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
command: "kline list",
|
|
96
|
+
method: "GET",
|
|
97
|
+
path: "/v2/public/q/kline",
|
|
98
|
+
isWrite: false,
|
|
99
|
+
needsAuth: false,
|
|
100
|
+
implFile: "src/commands/kline/list.ts"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
command: "mark-price list",
|
|
104
|
+
method: "GET",
|
|
105
|
+
path: "/v2/public/q/mark-price",
|
|
106
|
+
isWrite: false,
|
|
107
|
+
needsAuth: false,
|
|
108
|
+
implFile: "src/commands/mark-price/list.ts"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
command: "mark-price get",
|
|
112
|
+
method: "GET",
|
|
113
|
+
path: "/v2/public/q/symbol-mark-price",
|
|
114
|
+
isWrite: false,
|
|
115
|
+
needsAuth: false,
|
|
116
|
+
implFile: "src/commands/mark-price/get.ts"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
command: "index-price list",
|
|
120
|
+
method: "GET",
|
|
121
|
+
path: "/v2/public/q/index-price",
|
|
122
|
+
isWrite: false,
|
|
123
|
+
needsAuth: false,
|
|
124
|
+
implFile: "src/commands/index-price/list.ts"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
command: "index-price get",
|
|
128
|
+
method: "GET",
|
|
129
|
+
path: "/v2/public/q/symbol-index-price",
|
|
130
|
+
isWrite: false,
|
|
131
|
+
needsAuth: true,
|
|
132
|
+
implFile: "src/commands/index-price/get.ts"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
command: "funding rate",
|
|
136
|
+
method: "GET",
|
|
137
|
+
path: "/v2/public/q/funding-rate",
|
|
138
|
+
isWrite: false,
|
|
139
|
+
needsAuth: false,
|
|
140
|
+
implFile: "src/commands/funding/rate.ts"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
command: "funding history",
|
|
144
|
+
method: "GET",
|
|
145
|
+
path: "/v2/public/q/funding-rate-record",
|
|
146
|
+
isWrite: false,
|
|
147
|
+
needsAuth: false,
|
|
148
|
+
implFile: "src/commands/funding/history.ts"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
command: "risk-balance list",
|
|
152
|
+
method: "GET",
|
|
153
|
+
path: "/v2/public/contract/risk-balance",
|
|
154
|
+
isWrite: false,
|
|
155
|
+
needsAuth: false,
|
|
156
|
+
implFile: "src/commands/risk-balance/list.ts"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
command: "open-interest get",
|
|
160
|
+
method: "GET",
|
|
161
|
+
path: "/v2/public/contract/open-interest",
|
|
162
|
+
isWrite: false,
|
|
163
|
+
needsAuth: false,
|
|
164
|
+
implFile: "src/commands/open-interest/get.ts"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
command: "leverage brackets-list",
|
|
168
|
+
method: "GET",
|
|
169
|
+
path: "/v2/public/leverage/bracket/list",
|
|
170
|
+
isWrite: false,
|
|
171
|
+
needsAuth: false,
|
|
172
|
+
implFile: "src/commands/leverage/brackets-list.ts"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
command: "leverage brackets-get",
|
|
176
|
+
method: "GET",
|
|
177
|
+
path: "/v2/public/leverage/bracket/detail",
|
|
178
|
+
isWrite: false,
|
|
179
|
+
needsAuth: false,
|
|
180
|
+
implFile: "src/commands/leverage/brackets-get.ts"
|
|
181
|
+
},
|
|
182
|
+
// ───── Private read-only ─────
|
|
183
|
+
{
|
|
184
|
+
command: "listen-key get",
|
|
185
|
+
method: "GET",
|
|
186
|
+
path: "/v2/user/listen-key",
|
|
187
|
+
isWrite: false,
|
|
188
|
+
needsAuth: true,
|
|
189
|
+
implFile: "src/commands/listen-key/get.ts"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
command: "balance list",
|
|
193
|
+
method: "GET",
|
|
194
|
+
path: "/v2/balance/list",
|
|
195
|
+
isWrite: false,
|
|
196
|
+
needsAuth: true,
|
|
197
|
+
implFile: "src/commands/balance/list.ts"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
command: "balance get",
|
|
201
|
+
method: "GET",
|
|
202
|
+
path: "/v2/balance/detail",
|
|
203
|
+
isWrite: false,
|
|
204
|
+
needsAuth: true,
|
|
205
|
+
implFile: "src/commands/balance/get.ts"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
command: "balance bills",
|
|
209
|
+
method: "GET",
|
|
210
|
+
path: "/v2/balance/bills",
|
|
211
|
+
isWrite: false,
|
|
212
|
+
needsAuth: true,
|
|
213
|
+
implFile: "src/commands/balance/bills.ts"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
command: "order list-unfinished",
|
|
217
|
+
method: "GET",
|
|
218
|
+
path: "/v2/order/listUnfinished",
|
|
219
|
+
isWrite: false,
|
|
220
|
+
needsAuth: true,
|
|
221
|
+
implFile: "src/commands/order/list-unfinished.ts"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
command: "order list-unfinished-multi",
|
|
225
|
+
method: "GET",
|
|
226
|
+
path: "/v2/order/all/listUnfinished",
|
|
227
|
+
isWrite: false,
|
|
228
|
+
needsAuth: true,
|
|
229
|
+
implFile: "src/commands/order/list-unfinished-multi.ts"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
command: "order list",
|
|
233
|
+
method: "GET",
|
|
234
|
+
path: "/v2/order/list",
|
|
235
|
+
isWrite: false,
|
|
236
|
+
needsAuth: true,
|
|
237
|
+
implFile: "src/commands/order/list.ts"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
command: "order list-by-ids",
|
|
241
|
+
method: "POST",
|
|
242
|
+
path: "/v2/order/list-by-ids",
|
|
243
|
+
isWrite: false,
|
|
244
|
+
needsAuth: true,
|
|
245
|
+
implFile: "src/commands/order/list-by-ids.ts"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
command: "order list-history",
|
|
249
|
+
method: "GET",
|
|
250
|
+
path: "/v2/order/list-history",
|
|
251
|
+
isWrite: false,
|
|
252
|
+
needsAuth: true,
|
|
253
|
+
implFile: "src/commands/order/list-history.ts"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
command: "order get",
|
|
257
|
+
method: "GET",
|
|
258
|
+
path: "/v2/order/detail",
|
|
259
|
+
isWrite: false,
|
|
260
|
+
needsAuth: true,
|
|
261
|
+
implFile: "src/commands/order/get.ts"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
command: "order trades",
|
|
265
|
+
method: "GET",
|
|
266
|
+
path: "/v2/order/trade-list",
|
|
267
|
+
isWrite: false,
|
|
268
|
+
needsAuth: true,
|
|
269
|
+
implFile: "src/commands/order/trades.ts"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
command: "entrust plan-list",
|
|
273
|
+
method: "GET",
|
|
274
|
+
path: "/v2/entrust/plan-list",
|
|
275
|
+
isWrite: false,
|
|
276
|
+
needsAuth: true,
|
|
277
|
+
implFile: "src/commands/entrust/plan-list.ts"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
command: "entrust plan-history",
|
|
281
|
+
method: "GET",
|
|
282
|
+
path: "/v2/entrust/plan-list-history",
|
|
283
|
+
isWrite: false,
|
|
284
|
+
needsAuth: true,
|
|
285
|
+
implFile: "src/commands/entrust/plan-history.ts"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
command: "entrust plan-get",
|
|
289
|
+
method: "GET",
|
|
290
|
+
path: "/v2/entrust/plan-detail",
|
|
291
|
+
isWrite: false,
|
|
292
|
+
needsAuth: true,
|
|
293
|
+
implFile: "src/commands/entrust/plan-get.ts"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
command: "entrust profit-list",
|
|
297
|
+
method: "GET",
|
|
298
|
+
path: "/v2/entrust/profit-list",
|
|
299
|
+
isWrite: false,
|
|
300
|
+
needsAuth: true,
|
|
301
|
+
implFile: "src/commands/entrust/profit-list.ts"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
command: "entrust profit-get",
|
|
305
|
+
method: "GET",
|
|
306
|
+
path: "/v2/entrust/profit-detail",
|
|
307
|
+
isWrite: false,
|
|
308
|
+
needsAuth: true,
|
|
309
|
+
implFile: "src/commands/entrust/profit-get.ts"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
command: "order-entrust list",
|
|
313
|
+
method: "GET",
|
|
314
|
+
path: "/v2/order-entrust/list",
|
|
315
|
+
isWrite: false,
|
|
316
|
+
needsAuth: true,
|
|
317
|
+
implFile: "src/commands/order-entrust/list.ts"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
command: "position list",
|
|
321
|
+
method: "GET",
|
|
322
|
+
path: "/v2/position/list",
|
|
323
|
+
isWrite: false,
|
|
324
|
+
needsAuth: true,
|
|
325
|
+
implFile: "src/commands/position/list.ts"
|
|
326
|
+
},
|
|
327
|
+
// ───── Phase 2: write operations ─────
|
|
328
|
+
{
|
|
329
|
+
command: "order create",
|
|
330
|
+
method: "POST",
|
|
331
|
+
path: "/v2/order/create",
|
|
332
|
+
isWrite: true,
|
|
333
|
+
needsAuth: true,
|
|
334
|
+
implFile: "src/commands/order/create.ts"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
command: "order create-batch",
|
|
338
|
+
method: "POST",
|
|
339
|
+
path: "/v2/order/create-batch",
|
|
340
|
+
isWrite: true,
|
|
341
|
+
needsAuth: true,
|
|
342
|
+
implFile: "src/commands/order/create-batch.ts"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
command: "order cancel",
|
|
346
|
+
method: "POST",
|
|
347
|
+
path: "/v2/order/cancel",
|
|
348
|
+
isWrite: true,
|
|
349
|
+
needsAuth: true,
|
|
350
|
+
implFile: "src/commands/order/cancel.ts"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
command: "order cancel-batch",
|
|
354
|
+
method: "POST",
|
|
355
|
+
path: "/v2/order/cancel-batch",
|
|
356
|
+
isWrite: true,
|
|
357
|
+
needsAuth: true,
|
|
358
|
+
implFile: "src/commands/order/cancel-batch.ts"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
command: "order cancel-all",
|
|
362
|
+
method: "POST",
|
|
363
|
+
path: "/v2/order/cancel-all",
|
|
364
|
+
isWrite: true,
|
|
365
|
+
needsAuth: true,
|
|
366
|
+
implFile: "src/commands/order/cancel-all.ts"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
command: "entrust create-plan",
|
|
370
|
+
method: "POST",
|
|
371
|
+
path: "/v2/entrust/create-plan",
|
|
372
|
+
isWrite: true,
|
|
373
|
+
needsAuth: true,
|
|
374
|
+
implFile: "src/commands/entrust/create-plan.ts"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
command: "entrust create-profit",
|
|
378
|
+
method: "POST",
|
|
379
|
+
path: "/v2/entrust/create-profit",
|
|
380
|
+
isWrite: true,
|
|
381
|
+
needsAuth: true,
|
|
382
|
+
implFile: "src/commands/entrust/create-profit.ts"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
command: "entrust cancel-plan",
|
|
386
|
+
method: "POST",
|
|
387
|
+
path: "/v2/entrust/cancel-plan",
|
|
388
|
+
isWrite: true,
|
|
389
|
+
needsAuth: true,
|
|
390
|
+
implFile: "src/commands/entrust/cancel-plan.ts"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
command: "entrust cancel-profit",
|
|
394
|
+
method: "POST",
|
|
395
|
+
path: "/v2/entrust/cancel-profit-stop",
|
|
396
|
+
isWrite: true,
|
|
397
|
+
needsAuth: true,
|
|
398
|
+
implFile: "src/commands/entrust/cancel-profit.ts"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
command: "entrust update-profit",
|
|
402
|
+
method: "POST",
|
|
403
|
+
path: "/v2/entrust/update-profit-stop",
|
|
404
|
+
isWrite: true,
|
|
405
|
+
needsAuth: true,
|
|
406
|
+
implFile: "src/commands/entrust/update-profit.ts"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
command: "entrust cancel-all-plan",
|
|
410
|
+
method: "POST",
|
|
411
|
+
path: "/v2/entrust/cancel-all-plan",
|
|
412
|
+
isWrite: true,
|
|
413
|
+
needsAuth: true,
|
|
414
|
+
implFile: "src/commands/entrust/cancel-all-plan.ts"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
command: "entrust cancel-all-profit",
|
|
418
|
+
method: "POST",
|
|
419
|
+
path: "/v2/entrust/cancel-all-profit-stop",
|
|
420
|
+
isWrite: true,
|
|
421
|
+
needsAuth: true,
|
|
422
|
+
implFile: "src/commands/entrust/cancel-all-profit.ts"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
command: "order-entrust cancel",
|
|
426
|
+
method: "POST",
|
|
427
|
+
path: "/v2/order-entrust/cancel",
|
|
428
|
+
isWrite: true,
|
|
429
|
+
needsAuth: true,
|
|
430
|
+
implFile: "src/commands/order-entrust/cancel.ts"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
command: "order-entrust cancel-all",
|
|
434
|
+
method: "POST",
|
|
435
|
+
path: "/v2/order-entrust/cancel-all",
|
|
436
|
+
isWrite: true,
|
|
437
|
+
needsAuth: true,
|
|
438
|
+
implFile: "src/commands/order-entrust/cancel-all.ts"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
command: "position adjust-leverage",
|
|
442
|
+
method: "POST",
|
|
443
|
+
path: "/v2/position/adjust-leverage",
|
|
444
|
+
isWrite: true,
|
|
445
|
+
needsAuth: true,
|
|
446
|
+
implFile: "src/commands/position/adjust-leverage.ts"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
command: "position margin",
|
|
450
|
+
method: "POST",
|
|
451
|
+
path: "/v2/position/margin",
|
|
452
|
+
isWrite: true,
|
|
453
|
+
needsAuth: true,
|
|
454
|
+
implFile: "src/commands/position/margin.ts"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
command: "position auto-margin",
|
|
458
|
+
method: "POST",
|
|
459
|
+
path: "/v2/position/auto-margin",
|
|
460
|
+
isWrite: true,
|
|
461
|
+
needsAuth: true,
|
|
462
|
+
implFile: "src/commands/position/auto-margin.ts"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
command: "position close-all",
|
|
466
|
+
method: "POST",
|
|
467
|
+
path: "/v2/position/close-all",
|
|
468
|
+
isWrite: true,
|
|
469
|
+
needsAuth: true,
|
|
470
|
+
implFile: "src/commands/position/close-all.ts"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
command: "position merge",
|
|
474
|
+
method: "POST",
|
|
475
|
+
path: "/v2/position/merge",
|
|
476
|
+
isWrite: true,
|
|
477
|
+
needsAuth: true,
|
|
478
|
+
implFile: "src/commands/position/merge.ts"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
command: "position change-type",
|
|
482
|
+
method: "POST",
|
|
483
|
+
path: "/v2/position/change-type",
|
|
484
|
+
isWrite: true,
|
|
485
|
+
needsAuth: true,
|
|
486
|
+
implFile: "src/commands/position/change-type.ts"
|
|
487
|
+
}
|
|
488
|
+
];
|
|
489
|
+
|
|
490
|
+
export {
|
|
491
|
+
REGISTRY
|
|
492
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/output.ts
|
|
4
|
+
import Table from "cli-table3";
|
|
5
|
+
var TIME_KEY_RE = /(time|Time|^t$|At$)/;
|
|
6
|
+
function effectiveFormat(requested, isTTY) {
|
|
7
|
+
if (requested !== void 0) return requested;
|
|
8
|
+
return isTTY ? "table" : "json";
|
|
9
|
+
}
|
|
10
|
+
function formatTimestamp(ms) {
|
|
11
|
+
const d = new Date(ms);
|
|
12
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
13
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
14
|
+
}
|
|
15
|
+
function isTimeCell(key, value) {
|
|
16
|
+
return TIME_KEY_RE.test(key) && typeof value === "number" && value > 1e12;
|
|
17
|
+
}
|
|
18
|
+
function cellStr(key, value) {
|
|
19
|
+
if (isTimeCell(key, value)) return formatTimestamp(value);
|
|
20
|
+
if (value === null || value === void 0) return "";
|
|
21
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
22
|
+
return String(value);
|
|
23
|
+
}
|
|
24
|
+
function renderTable(data) {
|
|
25
|
+
if (Array.isArray(data) && data.length === 0) {
|
|
26
|
+
return "(empty)";
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(data) && data.length > 0 && typeof data[0] === "object" && data[0] !== null) {
|
|
29
|
+
const keys = Object.keys(data[0]);
|
|
30
|
+
const table = new Table({ head: keys });
|
|
31
|
+
for (const row of data) {
|
|
32
|
+
const r = row;
|
|
33
|
+
table.push(keys.map((k) => cellStr(k, r[k])));
|
|
34
|
+
}
|
|
35
|
+
return table.toString();
|
|
36
|
+
}
|
|
37
|
+
if (typeof data === "object" && data !== null && !Array.isArray(data)) {
|
|
38
|
+
const table = new Table({ head: ["Key", "Value"] });
|
|
39
|
+
for (const [k, v] of Object.entries(data)) {
|
|
40
|
+
table.push([k, cellStr(k, v)]);
|
|
41
|
+
}
|
|
42
|
+
return table.toString();
|
|
43
|
+
}
|
|
44
|
+
return String(data);
|
|
45
|
+
}
|
|
46
|
+
function render(data, opts) {
|
|
47
|
+
if (opts.format === "json") {
|
|
48
|
+
return JSON.stringify(data, null, 2);
|
|
49
|
+
}
|
|
50
|
+
return renderTable(data);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
effectiveFormat,
|
|
55
|
+
formatTimestamp,
|
|
56
|
+
renderTable,
|
|
57
|
+
render
|
|
58
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/errors.ts
|
|
4
|
+
var EXIT = {
|
|
5
|
+
OK: 0,
|
|
6
|
+
GENERIC: 1,
|
|
7
|
+
API_ERROR: 2,
|
|
8
|
+
NETWORK: 3,
|
|
9
|
+
DRY_RUN: 4
|
|
10
|
+
};
|
|
11
|
+
var OneBullExError = class extends Error {
|
|
12
|
+
constructor(message, returnCode, httpStatus, endpoint, requestId) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.returnCode = returnCode;
|
|
15
|
+
this.httpStatus = httpStatus;
|
|
16
|
+
this.endpoint = endpoint;
|
|
17
|
+
this.requestId = requestId;
|
|
18
|
+
this.name = "OneBullExError";
|
|
19
|
+
}
|
|
20
|
+
returnCode;
|
|
21
|
+
httpStatus;
|
|
22
|
+
endpoint;
|
|
23
|
+
requestId;
|
|
24
|
+
};
|
|
25
|
+
var DryRunInterception = class extends Error {
|
|
26
|
+
constructor(preview) {
|
|
27
|
+
super("Dry-run: pass --confirm to execute");
|
|
28
|
+
this.preview = preview;
|
|
29
|
+
this.name = "DryRunInterception";
|
|
30
|
+
}
|
|
31
|
+
preview;
|
|
32
|
+
};
|
|
33
|
+
var ConfigError = class extends Error {
|
|
34
|
+
constructor(message) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = "ConfigError";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
EXIT,
|
|
42
|
+
OneBullExError,
|
|
43
|
+
DryRunInterception,
|
|
44
|
+
ConfigError
|
|
45
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/signature.ts
|
|
4
|
+
import { createHmac, randomUUID } from "crypto";
|
|
5
|
+
function valueToString(v) {
|
|
6
|
+
if (typeof v === "boolean") return v ? "true" : "false";
|
|
7
|
+
return String(v);
|
|
8
|
+
}
|
|
9
|
+
function buildSortedQueryString(params) {
|
|
10
|
+
const keys = Object.keys(params).sort();
|
|
11
|
+
if (keys.length === 0) return "";
|
|
12
|
+
return keys.map((k) => `${k}=${valueToString(params[k])}`).join("&");
|
|
13
|
+
}
|
|
14
|
+
function sign(p) {
|
|
15
|
+
const merged = {
|
|
16
|
+
...p.params,
|
|
17
|
+
nonce: p.nonce,
|
|
18
|
+
timestamp: p.timestamp
|
|
19
|
+
};
|
|
20
|
+
const data = buildSortedQueryString(merged);
|
|
21
|
+
return createHmac("sha256", p.secret).update(data, "utf8").digest("hex");
|
|
22
|
+
}
|
|
23
|
+
function generateNonce() {
|
|
24
|
+
return randomUUID().replace(/-/g, "");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
buildSortedQueryString,
|
|
29
|
+
sign,
|
|
30
|
+
generateNonce
|
|
31
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
SENSITIVE_KEYS
|
|
4
|
+
} from "./chunk-ZYO5P4DH.js";
|
|
5
|
+
|
|
6
|
+
// src/core/redact.ts
|
|
7
|
+
function redactSecret(value) {
|
|
8
|
+
if (value.length < 8) {
|
|
9
|
+
return "****";
|
|
10
|
+
}
|
|
11
|
+
return `${value.slice(0, 2)}****${value.slice(-4)}`;
|
|
12
|
+
}
|
|
13
|
+
function redactObject(obj) {
|
|
14
|
+
if (obj === null || obj === void 0) {
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(obj)) {
|
|
18
|
+
return obj.map((item) => redactObject(item));
|
|
19
|
+
}
|
|
20
|
+
if (typeof obj === "object") {
|
|
21
|
+
const result = {};
|
|
22
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
23
|
+
if (SENSITIVE_KEYS.has(key)) {
|
|
24
|
+
if (key === "secret") {
|
|
25
|
+
result[key] = "****";
|
|
26
|
+
} else {
|
|
27
|
+
result[key] = typeof value === "string" ? redactSecret(value) : value;
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
result[key] = redactObject(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
return obj;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
redactSecret,
|
|
40
|
+
redactObject
|
|
41
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/types.ts
|
|
4
|
+
var SENSITIVE_KEYS = /* @__PURE__ */ new Set([
|
|
5
|
+
"secret",
|
|
6
|
+
"api-key",
|
|
7
|
+
"apiKey",
|
|
8
|
+
"apikey",
|
|
9
|
+
"X-API-KEY",
|
|
10
|
+
"x-api-key",
|
|
11
|
+
"X-Signature",
|
|
12
|
+
"x-signature",
|
|
13
|
+
"Authorization",
|
|
14
|
+
"authorization"
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
SENSITIVE_KEYS
|
|
19
|
+
};
|