@stxapp/stx-typescript 0.7.0 → 0.8.1
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 +11 -0
- package/dist/{chunk-CDXZOW53.js → chunk-GLUTQFBV.js} +591 -6
- package/dist/chunk-GLUTQFBV.js.map +1 -0
- package/dist/{chunk-ASOLCDBG.cjs → chunk-VLNOUSFW.cjs} +595 -10
- package/dist/chunk-VLNOUSFW.cjs.map +1 -0
- package/dist/{client-CA1d-osT.d.cts → client-CRccD5B2.d.cts} +1000 -109
- package/dist/{client-CA1d-osT.d.ts → client-CRccD5B2.d.ts} +1000 -109
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/dist/oauth.cjs +21 -19
- package/dist/oauth.cjs.map +1 -1
- package/dist/oauth.d.cts +8 -4
- package/dist/oauth.d.ts +8 -4
- package/dist/oauth.js +5 -3
- package/dist/oauth.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ASOLCDBG.cjs.map +0 -1
- package/dist/chunk-CDXZOW53.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
var _chunkASOLCDBGcjs = require('./chunk-ASOLCDBG.cjs');
|
|
61
60
|
|
|
62
61
|
|
|
63
62
|
|
|
@@ -66,6 +65,7 @@ var _chunkASOLCDBGcjs = require('./chunk-ASOLCDBG.cjs');
|
|
|
66
65
|
|
|
67
66
|
|
|
68
67
|
|
|
68
|
+
var _chunkVLNOUSFWcjs = require('./chunk-VLNOUSFW.cjs');
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
@@ -117,5 +117,21 @@ var _chunkASOLCDBGcjs = require('./chunk-ASOLCDBG.cjs');
|
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
exports.AccountView = _chunkVLNOUSFWcjs.AccountView; exports.ApiKeyCredentials = _chunkVLNOUSFWcjs.ApiKeyCredentials; exports.Channel = _chunkVLNOUSFWcjs.Channel; exports.ChannelMessage = _chunkVLNOUSFWcjs.ChannelMessage; exports.ComboMaker = _chunkVLNOUSFWcjs.ComboMaker; exports.ComboPlayer = _chunkVLNOUSFWcjs.ComboPlayer; exports.Environment = _chunkVLNOUSFWcjs.Environment; exports.Environments = _chunkVLNOUSFWcjs.Environments; exports.HOSTS = _chunkVLNOUSFWcjs.HOSTS; exports.KEY_HEADER = _chunkVLNOUSFWcjs.KEY_HEADER; exports.MAX_MARKETS_PER_REQUEST = _chunkVLNOUSFWcjs.MAX_MARKETS_PER_REQUEST; exports.NO_RETRY = _chunkVLNOUSFWcjs.NO_RETRY; exports.OPERATIONS = _chunkVLNOUSFWcjs.OPERATIONS; exports.Page = _chunkVLNOUSFWcjs.Page; exports.ReconnectPolicy = _chunkVLNOUSFWcjs.ReconnectPolicy; exports.Region = _chunkVLNOUSFWcjs.Region; exports.RetryPolicy = _chunkVLNOUSFWcjs.RetryPolicy; exports.SIGNATURE_HEADER = _chunkVLNOUSFWcjs.SIGNATURE_HEADER; exports.SNAPSHOT_EVENTS = _chunkVLNOUSFWcjs.SNAPSHOT_EVENTS; exports.STX = _chunkVLNOUSFWcjs.STX; exports.STXAPIException = _chunkVLNOUSFWcjs.STXAPIException; exports.STXAuthenticationException = _chunkVLNOUSFWcjs.STXAuthenticationException; exports.STXChannelException = _chunkVLNOUSFWcjs.STXChannelException; exports.STXComboPriceMovedException = _chunkVLNOUSFWcjs.STXComboPriceMovedException; exports.STXComboRefusedException = _chunkVLNOUSFWcjs.STXComboRefusedException; exports.STXCombosUnavailableException = _chunkVLNOUSFWcjs.STXCombosUnavailableException; exports.STXConfigException = _chunkVLNOUSFWcjs.STXConfigException; exports.STXException = _chunkVLNOUSFWcjs.STXException; exports.STXForbiddenException = _chunkVLNOUSFWcjs.STXForbiddenException; exports.STXGeoLocationException = _chunkVLNOUSFWcjs.STXGeoLocationException; exports.STXInsufficientScopeException = _chunkVLNOUSFWcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkVLNOUSFWcjs.STXInvalidTokenException; exports.STXNotFoundException = _chunkVLNOUSFWcjs.STXNotFoundException; exports.STXRateLimitException = _chunkVLNOUSFWcjs.STXRateLimitException; exports.STXRejectedException = _chunkVLNOUSFWcjs.STXRejectedException; exports.STXServerException = _chunkVLNOUSFWcjs.STXServerException; exports.STXTimeoutException = _chunkVLNOUSFWcjs.STXTimeoutException; exports.STXTransportException = _chunkVLNOUSFWcjs.STXTransportException; exports.STXValidationException = _chunkVLNOUSFWcjs.STXValidationException; exports.STXWebSocket = _chunkVLNOUSFWcjs.STXWebSocket; exports.Stats = _chunkVLNOUSFWcjs.Stats; exports.TERMINAL_ORDER_STATUSES = _chunkVLNOUSFWcjs.TERMINAL_ORDER_STATUSES; exports.TIMESTAMP_HEADER = _chunkVLNOUSFWcjs.TIMESTAMP_HEADER; exports.USER_AGENT = _chunkVLNOUSFWcjs.USER_AGENT; exports.VERSION = _chunkVLNOUSFWcjs.VERSION; exports.baseUrlFor = _chunkVLNOUSFWcjs.baseUrlFor; exports.buildMessage = _chunkVLNOUSFWcjs.buildMessage; exports.centsToDollars = _chunkVLNOUSFWcjs.centsToDollars; exports.convertBook = _chunkVLNOUSFWcjs.convertBook; exports.convertMarketChannelPayload = _chunkVLNOUSFWcjs.convertMarketChannelPayload; exports.convertMarketPayload = _chunkVLNOUSFWcjs.convertMarketPayload; exports.convertMarketsFrame = _chunkVLNOUSFWcjs.convertMarketsFrame; exports.environmentNamed = _chunkVLNOUSFWcjs.environmentNamed; exports.errorForStatus = _chunkVLNOUSFWcjs.errorForStatus; exports.geoRejection = _chunkVLNOUSFWcjs.geoRejection; exports.handshakePath = _chunkVLNOUSFWcjs.handshakePath; exports.isValidLine = _chunkVLNOUSFWcjs.isValidLine; exports.loadPrivateKey = _chunkVLNOUSFWcjs.loadPrivateKey; exports.orderBody = _chunkVLNOUSFWcjs.orderBody; exports.requestPath = _chunkVLNOUSFWcjs.requestPath; exports.resolveHost = _chunkVLNOUSFWcjs.resolveHost; exports.resolveSettings = _chunkVLNOUSFWcjs.resolveSettings; exports.signerFromPrivateKey = _chunkVLNOUSFWcjs.signerFromPrivateKey; exports.socketUrlFor = _chunkVLNOUSFWcjs.socketUrlFor; exports.toDollarString = _chunkVLNOUSFWcjs.toDollarString; exports.toQuantity = _chunkVLNOUSFWcjs.toQuantity;
|
|
121
137
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/tssdk/tssdk/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/tssdk/tssdk/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,m8HAAC","file":"/home/runner/work/tssdk/tssdk/dist/index.cjs"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, E as Environment,
|
|
1
|
+
export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, m as ComboBestQuote, n as ComboBestQuoteEvent, o as ComboCancelReply, p as ComboCashOutReply, q as ComboJoinOptions, r as ComboJoinReply, s as ComboLeg, t as ComboMaker, u as ComboMakerEvent, v as ComboMakerPlacedEvent, w as ComboOutcome, x as ComboPlacedEvent, y as ComboPlacement, z as ComboPlayer, D as ComboPlayerEvent, E as ComboQuoteAcceptedEvent, F as ComboQuoteClosedEvent, G as ComboQuoteClosedReason, H as ComboQuoteReply, I as ComboRefusalReason, J as ComboRequestClosedEvent, K as ComboRequestClosedReason, L as ComboRequestReply, M as ComboRfqClosedEvent, N as ComboRfqClosedReason, O as ComboRfqLeg, P as ComboRfqOpenedEvent, Q as ComboSnapshot, R as ComboWithdrawReply, S as CreateMarketResult, T as CreateMarketsOptions, U as Environment, V as Environments, W as Error, X as Event, Y as EventPlayer, Z as EventPlayers, _ as EventStat, $ as EventTeam, a0 as EventsQuery, a1 as FeeTransaction, a2 as FetchLike, a3 as Fill, a4 as FillsQuery, a5 as GeoCheckResult, a6 as GeoLocationProvider, a7 as GeoOption, a8 as GeoRejection, a9 as HOSTS, aa as KEY_HEADER, ab as KnownStat, ac as Leaderboard, ad as LeaderboardEntry, ae as LeaderboardStanding, af as Logger, ag as MAX_MARKETS_PER_REQUEST, ah as Market, ai as MarketFilter, aj as MarketRejectionReason, ak as MarketRequestEcho, al as MarketStat, am as MarketStatsQuery, an as MarketsQuery, ao as Me, ap as MessageHandler, aq as NO_RETRY, ar as NewMarketInput, as as NewOrder, at as NewOrderInput, au as OPERATIONS, av as Operation, aw as OperationId, ax as Order, ay as OrderOptions, az as OrdersQuery, aA as Page, aB as PageQuery, aC as PaymentTransaction, aD as Position, aE as PrivateKeyInput, aF as ProfileUpdate, aG as RecentTrade, aH as ReconnectPolicy, aI as ReconnectPolicyOptions, aJ as Region, aK as ResponseEvent, aL as RetryPolicy, aM as RetryPolicyOptions, aN as SIGNATURE_HEADER, aO as SNAPSHOT_EVENTS, aP as STX, aQ as STXAPIException, aR as STXAuthenticationException, aS as STXChannelException, aT as STXComboPriceMovedException, aU as STXComboRefusedException, aV as STXCombosUnavailableException, aW as STXConfigException, aX as STXEnvironment, aY as STXException, aZ as STXForbiddenException, a_ as STXGeoLocationException, a$ as STXInsufficientScopeException, b0 as STXInvalidTokenException, b1 as STXNotFoundException, b2 as STXOptions, b3 as STXRateLimitException, b4 as STXRejectedException, b5 as STXServerException, b6 as STXTimeoutException, b7 as STXTransportException, b8 as STXValidationException, b9 as STXWebSocket, ba as STXWebSocketOptions, bb as Settlement, bc as SettlementsQuery, bd as Signer, be as Stat, bf as StatDetail, bg as Stats, bh as StrList, bi as TERMINAL_ORDER_STATUSES, bj as TIMESTAMP_HEADER, bk as Transaction, bl as USER_AGENT, bm as VERSION, bn as WebSocketAuthContext, bo as baseUrlFor, bp as buildMessage, bq as environmentNamed, br as errorForStatus, bs as geoRejection, bt as handshakePath, bu as isValidLine, bv as loadPrivateKey, bw as models, bx as orderBody, by as requestPath, bz as resolveHost, bA as signerFromPrivateKey, bB as socketUrlFor } from './client-CRccD5B2.cjs';
|
|
2
2
|
import 'node:crypto';
|
|
3
3
|
|
|
4
4
|
/** The fully resolved configuration the clients consume. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, E as Environment,
|
|
1
|
+
export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, m as ComboBestQuote, n as ComboBestQuoteEvent, o as ComboCancelReply, p as ComboCashOutReply, q as ComboJoinOptions, r as ComboJoinReply, s as ComboLeg, t as ComboMaker, u as ComboMakerEvent, v as ComboMakerPlacedEvent, w as ComboOutcome, x as ComboPlacedEvent, y as ComboPlacement, z as ComboPlayer, D as ComboPlayerEvent, E as ComboQuoteAcceptedEvent, F as ComboQuoteClosedEvent, G as ComboQuoteClosedReason, H as ComboQuoteReply, I as ComboRefusalReason, J as ComboRequestClosedEvent, K as ComboRequestClosedReason, L as ComboRequestReply, M as ComboRfqClosedEvent, N as ComboRfqClosedReason, O as ComboRfqLeg, P as ComboRfqOpenedEvent, Q as ComboSnapshot, R as ComboWithdrawReply, S as CreateMarketResult, T as CreateMarketsOptions, U as Environment, V as Environments, W as Error, X as Event, Y as EventPlayer, Z as EventPlayers, _ as EventStat, $ as EventTeam, a0 as EventsQuery, a1 as FeeTransaction, a2 as FetchLike, a3 as Fill, a4 as FillsQuery, a5 as GeoCheckResult, a6 as GeoLocationProvider, a7 as GeoOption, a8 as GeoRejection, a9 as HOSTS, aa as KEY_HEADER, ab as KnownStat, ac as Leaderboard, ad as LeaderboardEntry, ae as LeaderboardStanding, af as Logger, ag as MAX_MARKETS_PER_REQUEST, ah as Market, ai as MarketFilter, aj as MarketRejectionReason, ak as MarketRequestEcho, al as MarketStat, am as MarketStatsQuery, an as MarketsQuery, ao as Me, ap as MessageHandler, aq as NO_RETRY, ar as NewMarketInput, as as NewOrder, at as NewOrderInput, au as OPERATIONS, av as Operation, aw as OperationId, ax as Order, ay as OrderOptions, az as OrdersQuery, aA as Page, aB as PageQuery, aC as PaymentTransaction, aD as Position, aE as PrivateKeyInput, aF as ProfileUpdate, aG as RecentTrade, aH as ReconnectPolicy, aI as ReconnectPolicyOptions, aJ as Region, aK as ResponseEvent, aL as RetryPolicy, aM as RetryPolicyOptions, aN as SIGNATURE_HEADER, aO as SNAPSHOT_EVENTS, aP as STX, aQ as STXAPIException, aR as STXAuthenticationException, aS as STXChannelException, aT as STXComboPriceMovedException, aU as STXComboRefusedException, aV as STXCombosUnavailableException, aW as STXConfigException, aX as STXEnvironment, aY as STXException, aZ as STXForbiddenException, a_ as STXGeoLocationException, a$ as STXInsufficientScopeException, b0 as STXInvalidTokenException, b1 as STXNotFoundException, b2 as STXOptions, b3 as STXRateLimitException, b4 as STXRejectedException, b5 as STXServerException, b6 as STXTimeoutException, b7 as STXTransportException, b8 as STXValidationException, b9 as STXWebSocket, ba as STXWebSocketOptions, bb as Settlement, bc as SettlementsQuery, bd as Signer, be as Stat, bf as StatDetail, bg as Stats, bh as StrList, bi as TERMINAL_ORDER_STATUSES, bj as TIMESTAMP_HEADER, bk as Transaction, bl as USER_AGENT, bm as VERSION, bn as WebSocketAuthContext, bo as baseUrlFor, bp as buildMessage, bq as environmentNamed, br as errorForStatus, bs as geoRejection, bt as handshakePath, bu as isValidLine, bv as loadPrivateKey, bw as models, bx as orderBody, by as requestPath, bz as resolveHost, bA as signerFromPrivateKey, bB as socketUrlFor } from './client-CRccD5B2.js';
|
|
2
2
|
import 'node:crypto';
|
|
3
3
|
|
|
4
4
|
/** The fully resolved configuration the clients consume. */
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,13 @@ import {
|
|
|
3
3
|
ApiKeyCredentials,
|
|
4
4
|
Channel,
|
|
5
5
|
ChannelMessage,
|
|
6
|
+
ComboMaker,
|
|
7
|
+
ComboPlayer,
|
|
6
8
|
Environment,
|
|
7
9
|
Environments,
|
|
8
10
|
HOSTS,
|
|
9
11
|
KEY_HEADER,
|
|
12
|
+
MAX_MARKETS_PER_REQUEST,
|
|
10
13
|
NO_RETRY,
|
|
11
14
|
OPERATIONS,
|
|
12
15
|
Page,
|
|
@@ -19,6 +22,9 @@ import {
|
|
|
19
22
|
STXAPIException,
|
|
20
23
|
STXAuthenticationException,
|
|
21
24
|
STXChannelException,
|
|
25
|
+
STXComboPriceMovedException,
|
|
26
|
+
STXComboRefusedException,
|
|
27
|
+
STXCombosUnavailableException,
|
|
22
28
|
STXConfigException,
|
|
23
29
|
STXException,
|
|
24
30
|
STXForbiddenException,
|
|
@@ -33,6 +39,7 @@ import {
|
|
|
33
39
|
STXTransportException,
|
|
34
40
|
STXValidationException,
|
|
35
41
|
STXWebSocket,
|
|
42
|
+
Stats,
|
|
36
43
|
TERMINAL_ORDER_STATUSES,
|
|
37
44
|
TIMESTAMP_HEADER,
|
|
38
45
|
USER_AGENT,
|
|
@@ -48,6 +55,7 @@ import {
|
|
|
48
55
|
errorForStatus,
|
|
49
56
|
geoRejection,
|
|
50
57
|
handshakePath,
|
|
58
|
+
isValidLine,
|
|
51
59
|
loadPrivateKey,
|
|
52
60
|
orderBody,
|
|
53
61
|
requestPath,
|
|
@@ -57,16 +65,19 @@ import {
|
|
|
57
65
|
socketUrlFor,
|
|
58
66
|
toDollarString,
|
|
59
67
|
toQuantity
|
|
60
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-GLUTQFBV.js";
|
|
61
69
|
export {
|
|
62
70
|
AccountView,
|
|
63
71
|
ApiKeyCredentials,
|
|
64
72
|
Channel,
|
|
65
73
|
ChannelMessage,
|
|
74
|
+
ComboMaker,
|
|
75
|
+
ComboPlayer,
|
|
66
76
|
Environment,
|
|
67
77
|
Environments,
|
|
68
78
|
HOSTS,
|
|
69
79
|
KEY_HEADER,
|
|
80
|
+
MAX_MARKETS_PER_REQUEST,
|
|
70
81
|
NO_RETRY,
|
|
71
82
|
OPERATIONS,
|
|
72
83
|
Page,
|
|
@@ -79,6 +90,9 @@ export {
|
|
|
79
90
|
STXAPIException,
|
|
80
91
|
STXAuthenticationException,
|
|
81
92
|
STXChannelException,
|
|
93
|
+
STXComboPriceMovedException,
|
|
94
|
+
STXComboRefusedException,
|
|
95
|
+
STXCombosUnavailableException,
|
|
82
96
|
STXConfigException,
|
|
83
97
|
STXException,
|
|
84
98
|
STXForbiddenException,
|
|
@@ -93,6 +107,7 @@ export {
|
|
|
93
107
|
STXTransportException,
|
|
94
108
|
STXValidationException,
|
|
95
109
|
STXWebSocket,
|
|
110
|
+
Stats,
|
|
96
111
|
TERMINAL_ORDER_STATUSES,
|
|
97
112
|
TIMESTAMP_HEADER,
|
|
98
113
|
USER_AGENT,
|
|
@@ -108,6 +123,7 @@ export {
|
|
|
108
123
|
errorForStatus,
|
|
109
124
|
geoRejection,
|
|
110
125
|
handshakePath,
|
|
126
|
+
isValidLine,
|
|
111
127
|
loadPrivateKey,
|
|
112
128
|
orderBody,
|
|
113
129
|
requestPath,
|
package/dist/oauth.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkVLNOUSFWcjs = require('./chunk-VLNOUSFW.cjs');
|
|
11
11
|
|
|
12
12
|
// src/oauth/endpoints.ts
|
|
13
13
|
var DEFAULT_ENDPOINTS = {
|
|
@@ -24,12 +24,12 @@ var WELL_KNOWN = {
|
|
|
24
24
|
function resolveOAuthConfig(input) {
|
|
25
25
|
const env = _nullishCoalesce(_optionalChain([globalThis, 'access', _ => _.process, 'optionalAccess', _2 => _2.env]), () => ( {}));
|
|
26
26
|
const host = _nullishCoalesce(_nullishCoalesce(input.baseUrl, () => ( env.STX_HOST)), () => ( env.STX_BASE_URL));
|
|
27
|
-
if (!host) throw new (0,
|
|
27
|
+
if (!host) throw new (0, _chunkVLNOUSFWcjs.STXConfigException)("An OAuth base URL is required. Pass { baseUrl } or set STX_HOST.");
|
|
28
28
|
const fetchImpl = _nullishCoalesce(input.fetch, () => ( globalThis.fetch));
|
|
29
29
|
if (typeof fetchImpl !== "function") {
|
|
30
|
-
throw new (0,
|
|
30
|
+
throw new (0, _chunkVLNOUSFWcjs.STXConfigException)("No fetch implementation available. Use Node 18+, or pass { fetch }.");
|
|
31
31
|
}
|
|
32
|
-
return { baseUrl:
|
|
32
|
+
return { baseUrl: _chunkVLNOUSFWcjs.baseUrlFor.call(void 0, null, null, host), fetch: fetchImpl };
|
|
33
33
|
}
|
|
34
34
|
function joinUrl(baseUrl, path) {
|
|
35
35
|
if (/^https?:\/\//i.test(path)) return path;
|
|
@@ -37,7 +37,7 @@ function joinUrl(baseUrl, path) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// src/oauth/errors.ts
|
|
40
|
-
var STXOAuthException = class extends
|
|
40
|
+
var STXOAuthException = class extends _chunkVLNOUSFWcjs.STXAuthenticationException {
|
|
41
41
|
/** The RFC error code: `invalid_client`, `invalid_grant`, `invalid_scope`, ... */
|
|
42
42
|
|
|
43
43
|
|
|
@@ -56,7 +56,7 @@ var STXOAuthException = class extends _chunkASOLCDBGcjs.STXAuthenticationExcepti
|
|
|
56
56
|
this.retryAfter = retryAfter;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
var STXGrantRevokedException = class extends
|
|
59
|
+
var STXGrantRevokedException = class extends _chunkVLNOUSFWcjs.STXAuthenticationException {
|
|
60
60
|
constructor(message = "OAuth grant revoked: the member must re-authorize.") {
|
|
61
61
|
super(message, { statusCode: 400 });
|
|
62
62
|
}
|
|
@@ -141,7 +141,7 @@ function rfcError(text) {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
function httpError(status, text, path) {
|
|
144
|
-
return new (0,
|
|
144
|
+
return new (0, _chunkVLNOUSFWcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
|
|
145
145
|
statusCode: status,
|
|
146
146
|
body: text,
|
|
147
147
|
path
|
|
@@ -168,8 +168,10 @@ var MemberScopes = {
|
|
|
168
168
|
var AppScopes = {
|
|
169
169
|
/** The market catalog (`GET /api/v1/markets`) and the market data channels. */
|
|
170
170
|
MARKET_DATA: "market_data",
|
|
171
|
-
/** The event catalog (`GET /api/v1/events
|
|
172
|
-
EVENTS: "events"
|
|
171
|
+
/** The event catalog (`GET /api/v1/events`, an event's players) and the `events` channel. */
|
|
172
|
+
EVENTS: "events",
|
|
173
|
+
/** Create markets (`POST /api/v1/markets`). Granted by STX only. */
|
|
174
|
+
MARKETS_WRITE: "markets.write"
|
|
173
175
|
};
|
|
174
176
|
var Scopes = { ...MemberScopes, ...AppScopes };
|
|
175
177
|
var ALL_MEMBER_SCOPES = Object.values(MemberScopes);
|
|
@@ -290,7 +292,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
290
292
|
*/
|
|
291
293
|
async beginAuthorization(pending, params = {}) {
|
|
292
294
|
const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
|
|
293
|
-
if (!redirectUri) throw new (0,
|
|
295
|
+
if (!redirectUri) throw new (0, _chunkVLNOUSFWcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
|
|
294
296
|
const auth = await this.authorizationUrl({ ...params, redirectUri });
|
|
295
297
|
await pending.put(auth.state, {
|
|
296
298
|
codeVerifier: auth.codeVerifier,
|
|
@@ -332,7 +334,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
332
334
|
let memberKey;
|
|
333
335
|
if (opts.store) {
|
|
334
336
|
memberKey = typeof opts.memberKey === "function" ? opts.memberKey(entry.data) : opts.memberKey;
|
|
335
|
-
if (!memberKey) throw new (0,
|
|
337
|
+
if (!memberKey) throw new (0, _chunkVLNOUSFWcjs.STXConfigException)("Pass memberKey along with store.");
|
|
336
338
|
await opts.store.set(memberKey, tokenSetToStored(tokens));
|
|
337
339
|
}
|
|
338
340
|
return { tokens, scopes: parseScopes(tokens.scope), data: entry.data, memberKey };
|
|
@@ -341,7 +343,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
341
343
|
buildAuthorizeUrl(params) {
|
|
342
344
|
const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
|
|
343
345
|
if (!redirectUri) {
|
|
344
|
-
throw new (0,
|
|
346
|
+
throw new (0, _chunkVLNOUSFWcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
|
|
345
347
|
}
|
|
346
348
|
const url = new URL(joinUrl(this.baseUrl, this.endpoints.authorize));
|
|
347
349
|
const search = {
|
|
@@ -363,7 +365,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
363
365
|
exchangeCode(args) {
|
|
364
366
|
const redirectUri = _nullishCoalesce(args.redirectUri, () => ( this.redirectUri));
|
|
365
367
|
if (!redirectUri) {
|
|
366
|
-
throw new (0,
|
|
368
|
+
throw new (0, _chunkVLNOUSFWcjs.STXConfigException)("redirectUri is required to exchange a code.");
|
|
367
369
|
}
|
|
368
370
|
return this.postToken(
|
|
369
371
|
new URLSearchParams({
|
|
@@ -404,7 +406,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
404
406
|
*/
|
|
405
407
|
clientCredentials(scope) {
|
|
406
408
|
if (this.isPublic) {
|
|
407
|
-
throw new (0,
|
|
409
|
+
throw new (0, _chunkVLNOUSFWcjs.STXConfigException)(
|
|
408
410
|
"client_credentials needs a client secret; a public client cannot mint an app token."
|
|
409
411
|
);
|
|
410
412
|
}
|
|
@@ -508,7 +510,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
508
510
|
*/
|
|
509
511
|
memberClient(store, memberKey, opts = {}) {
|
|
510
512
|
const { session, ...rest } = opts;
|
|
511
|
-
return new (0,
|
|
513
|
+
return new (0, _chunkVLNOUSFWcjs.STX)({
|
|
512
514
|
...rest,
|
|
513
515
|
host: this.baseUrl,
|
|
514
516
|
fetch: _nullishCoalesce(rest.fetch, () => ( this.fetch)),
|
|
@@ -521,7 +523,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
521
523
|
* market channels. Scope defaults to every app scope the client may hold.
|
|
522
524
|
*/
|
|
523
525
|
appClient(scope, opts = {}) {
|
|
524
|
-
return new (0,
|
|
526
|
+
return new (0, _chunkVLNOUSFWcjs.STX)({ ...opts, host: this.baseUrl, fetch: _nullishCoalesce(opts.fetch, () => ( this.fetch)), auth: this.app(scope) });
|
|
525
527
|
}
|
|
526
528
|
/** @internal The in-flight refresh map for one store; see `OAuthSessionAuth`. */
|
|
527
529
|
_refreshesFor(store) {
|
|
@@ -697,7 +699,7 @@ var OAuthSessionAuth = (_class4 = class {
|
|
|
697
699
|
async tokens() {
|
|
698
700
|
let tokens = await this.load();
|
|
699
701
|
if (!tokens) {
|
|
700
|
-
throw new (0,
|
|
702
|
+
throw new (0, _chunkVLNOUSFWcjs.STXConfigException)(`No tokens stored for member "${this.memberKey}". Complete the OAuth flow first.`);
|
|
701
703
|
}
|
|
702
704
|
if (tokens.refreshToken && tokens.expiresAt !== void 0 && tokens.expiresAt - Date.now() <= this.skewMs) {
|
|
703
705
|
const refreshed = await this.refresh(tokens.refreshToken);
|
|
@@ -879,7 +881,7 @@ async function fetchWellKnown(baseUrl, path, opts) {
|
|
|
879
881
|
}
|
|
880
882
|
}
|
|
881
883
|
function httpError2(status, text, path) {
|
|
882
|
-
return new (0,
|
|
884
|
+
return new (0, _chunkVLNOUSFWcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
|
|
883
885
|
statusCode: status,
|
|
884
886
|
body: text,
|
|
885
887
|
path
|
|
@@ -963,5 +965,5 @@ var MemoryPendingAuthorizationStore = (_class7 = class {constructor() { _class7.
|
|
|
963
965
|
|
|
964
966
|
|
|
965
967
|
|
|
966
|
-
exports.ALL_APP_SCOPES = ALL_APP_SCOPES; exports.ALL_MEMBER_SCOPES = ALL_MEMBER_SCOPES; exports.AppScopes = AppScopes; exports.AppTokenProvider = AppTokenProvider; exports.DEFAULT_ENDPOINTS = DEFAULT_ENDPOINTS; exports.LEGACY_SCOPES = LEGACY_SCOPES; exports.MemberScopes = MemberScopes; exports.MemoryPendingAuthorizationStore = MemoryPendingAuthorizationStore; exports.MemoryTokenStore = MemoryTokenStore; exports.OAuthAppAuth = OAuthAppAuth; exports.OAuthBearerAuth = OAuthBearerAuth; exports.OAuthClient = OAuthClient; exports.OAuthSessionAuth = OAuthSessionAuth; exports.STXAuthenticationException =
|
|
968
|
+
exports.ALL_APP_SCOPES = ALL_APP_SCOPES; exports.ALL_MEMBER_SCOPES = ALL_MEMBER_SCOPES; exports.AppScopes = AppScopes; exports.AppTokenProvider = AppTokenProvider; exports.DEFAULT_ENDPOINTS = DEFAULT_ENDPOINTS; exports.LEGACY_SCOPES = LEGACY_SCOPES; exports.MemberScopes = MemberScopes; exports.MemoryPendingAuthorizationStore = MemoryPendingAuthorizationStore; exports.MemoryTokenStore = MemoryTokenStore; exports.OAuthAppAuth = OAuthAppAuth; exports.OAuthBearerAuth = OAuthBearerAuth; exports.OAuthClient = OAuthClient; exports.OAuthSessionAuth = OAuthSessionAuth; exports.STXAuthenticationException = _chunkVLNOUSFWcjs.STXAuthenticationException; exports.STXForbiddenException = _chunkVLNOUSFWcjs.STXForbiddenException; exports.STXGrantRevokedException = STXGrantRevokedException; exports.STXInsufficientScopeException = _chunkVLNOUSFWcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkVLNOUSFWcjs.STXInvalidTokenException; exports.STXOAuthException = STXOAuthException; exports.Scopes = Scopes; exports.WELL_KNOWN = WELL_KNOWN; exports.base64url = base64url; exports.canonicalScope = canonicalScope; exports.codeChallengeS256 = codeChallengeS256; exports.createPkce = createPkce; exports.discoverMetadata = discoverMetadata; exports.discoverProtectedResource = discoverProtectedResource; exports.formatScopes = formatScopes; exports.generateCodeVerifier = generateCodeVerifier; exports.generateState = generateState; exports.isAppScope = isAppScope; exports.isMemberScope = isMemberScope; exports.joinUrl = joinUrl; exports.parseScopes = parseScopes; exports.parseTokenResponse = parseTokenResponse; exports.readCallback = readCallback; exports.registerClient = registerClient; exports.rfcError = rfcError; exports.tokenSetToStored = tokenSetToStored;
|
|
967
969
|
//# sourceMappingURL=oauth.cjs.map
|