@stxapp/stx-typescript 0.8.1 → 0.8.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 +7 -0
- package/dist/{chunk-GLUTQFBV.js → chunk-BDKOZ6S2.js} +29 -20
- package/dist/chunk-BDKOZ6S2.js.map +1 -0
- package/dist/{chunk-VLNOUSFW.cjs → chunk-JHREXRKD.cjs} +29 -20
- package/dist/chunk-JHREXRKD.cjs.map +1 -0
- package/dist/{client-CRccD5B2.d.cts → client-jcBBoio1.d.cts} +45 -16
- package/dist/{client-CRccD5B2.d.ts → client-jcBBoio1.d.ts} +45 -16
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/oauth.cjs +17 -17
- package/dist/oauth.d.cts +2 -2
- package/dist/oauth.d.ts +2 -2
- package/dist/oauth.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GLUTQFBV.js.map +0 -1
- package/dist/chunk-VLNOUSFW.cjs.map +0 -1
|
@@ -254,8 +254,11 @@ interface EventPlayers {
|
|
|
254
254
|
}
|
|
255
255
|
/** One market to create. */
|
|
256
256
|
interface NewMarketInput {
|
|
257
|
-
/**
|
|
258
|
-
|
|
257
|
+
/**
|
|
258
|
+
* The market rule. `"player_stat_line"`, the only one today and the default;
|
|
259
|
+
* the exchange answers any other with `unsupported_rule`.
|
|
260
|
+
*/
|
|
261
|
+
rule?: "player_stat_line" | (string & {});
|
|
259
262
|
/** From `eventPlayers()`. */
|
|
260
263
|
playerId: string;
|
|
261
264
|
/** One of the event's stats, e.g. `Stats.Basketball.POINTS`. */
|
|
@@ -266,30 +269,48 @@ interface NewMarketInput {
|
|
|
266
269
|
* are rejected with `invalid_line`.
|
|
267
270
|
*/
|
|
268
271
|
line: number;
|
|
269
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* @deprecated Not sent. A player stat line is always over/under.
|
|
274
|
+
*/
|
|
270
275
|
propType?: "ou";
|
|
271
276
|
}
|
|
272
277
|
/** Why a market was not created. */
|
|
273
|
-
type MarketRejectionReason = "invalid_market" | "
|
|
274
|
-
/**
|
|
278
|
+
type MarketRejectionReason = "invalid_market" | "unsupported_rule" | "unsupported_stat" | "invalid_line" | "unknown_player" | "event_not_open" | "not_created" | (string & {});
|
|
279
|
+
/** The market a result is for, as it was requested. */
|
|
275
280
|
interface MarketRequestEcho {
|
|
281
|
+
rule?: string;
|
|
276
282
|
player_id?: string;
|
|
277
283
|
stat?: string;
|
|
278
|
-
prop_type?: string;
|
|
279
284
|
line?: number;
|
|
280
285
|
[key: string]: unknown;
|
|
281
286
|
}
|
|
282
|
-
/**
|
|
287
|
+
/**
|
|
288
|
+
* The outcome for one requested market. `index` is the market's position in
|
|
289
|
+
* the list given to `createMarkets()`, and `market` is that market as
|
|
290
|
+
* requested.
|
|
291
|
+
*/
|
|
283
292
|
type CreateMarketResult = {
|
|
293
|
+
index: number;
|
|
284
294
|
status: "created";
|
|
285
295
|
market_id: string;
|
|
296
|
+
reason: null;
|
|
286
297
|
market: MarketRequestEcho;
|
|
287
298
|
} | {
|
|
299
|
+
index: number;
|
|
288
300
|
status: "exists";
|
|
289
301
|
market_id: string;
|
|
302
|
+
reason: null;
|
|
290
303
|
market: MarketRequestEcho;
|
|
291
304
|
} | {
|
|
305
|
+
index: number;
|
|
306
|
+
status: "valid";
|
|
307
|
+
market_id: null;
|
|
308
|
+
reason: null;
|
|
309
|
+
market: MarketRequestEcho;
|
|
310
|
+
} | {
|
|
311
|
+
index: number;
|
|
292
312
|
status: "rejected";
|
|
313
|
+
market_id: null;
|
|
293
314
|
reason: MarketRejectionReason;
|
|
294
315
|
market: MarketRequestEcho;
|
|
295
316
|
};
|
|
@@ -303,6 +324,11 @@ interface CreateMarketsOptions {
|
|
|
303
324
|
* needs the `events` scope.
|
|
304
325
|
*/
|
|
305
326
|
validate?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Run every check on the exchange and create nothing. A market that would
|
|
329
|
+
* be created, or a repeat of one, comes back `valid`.
|
|
330
|
+
*/
|
|
331
|
+
dryRun?: boolean;
|
|
306
332
|
}
|
|
307
333
|
/** The most markets one `createMarkets()` call takes. */
|
|
308
334
|
declare const MAX_MARKETS_PER_REQUEST = 25;
|
|
@@ -2905,7 +2931,7 @@ declare class STXTimeoutException extends STXChannelException {
|
|
|
2905
2931
|
/**
|
|
2906
2932
|
* Combos are not available on this environment: the exchange refused the
|
|
2907
2933
|
* join to the player or maker topic with `unmatched topic`. Nothing else is
|
|
2908
|
-
* affected.
|
|
2934
|
+
* affected. Combos are available on US demo.
|
|
2909
2935
|
*/
|
|
2910
2936
|
declare class STXCombosUnavailableException extends STXChannelException {
|
|
2911
2937
|
}
|
|
@@ -3052,8 +3078,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
3052
3078
|
toString(): string;
|
|
3053
3079
|
}
|
|
3054
3080
|
|
|
3055
|
-
declare const VERSION = "0.8.
|
|
3056
|
-
declare const USER_AGENT = "stx-typescript/0.8.
|
|
3081
|
+
declare const VERSION = "0.8.2";
|
|
3082
|
+
declare const USER_AGENT = "stx-typescript/0.8.2";
|
|
3057
3083
|
/**
|
|
3058
3084
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
3059
3085
|
* `await using client = new STX()` works there; a registered stand-in on
|
|
@@ -3406,7 +3432,7 @@ declare abstract class ComboSession<E extends {
|
|
|
3406
3432
|
* The player's side of combos, on `rfq:<user_id>`. Get one with
|
|
3407
3433
|
* `ws.comboPlayer()`.
|
|
3408
3434
|
*
|
|
3409
|
-
*
|
|
3435
|
+
* Available on US demo.
|
|
3410
3436
|
*
|
|
3411
3437
|
* A request belongs to this channel: leaving, a dropped socket or a geo lapse
|
|
3412
3438
|
* ends it `cancelled`, and the SDK's automatic rejoin does not bring it back.
|
|
@@ -3464,7 +3490,7 @@ declare class ComboPlayer extends ComboSession<ComboPlayerEvent> {
|
|
|
3464
3490
|
* `ws.comboMaker()`. Joining subscribes to every request opened after the
|
|
3465
3491
|
* join (`rfq_opened`); earlier requests are not replayed.
|
|
3466
3492
|
*
|
|
3467
|
-
*
|
|
3493
|
+
* Available on US demo.
|
|
3468
3494
|
*
|
|
3469
3495
|
* A quote belongs to this channel: leaving or a dropped socket withdraws it.
|
|
3470
3496
|
* Every refusal throws `STXComboRefusedException` with the exchange's
|
|
@@ -3826,7 +3852,7 @@ declare class STXWebSocket {
|
|
|
3826
3852
|
* Join `rfq:{user_id}` and return a `ComboPlayer`: request quotes on a
|
|
3827
3853
|
* combination, cash one out, accept, cancel and read a request.
|
|
3828
3854
|
*
|
|
3829
|
-
*
|
|
3855
|
+
* Available on US demo.
|
|
3830
3856
|
* Where combos are not available, rejects with
|
|
3831
3857
|
* `STXCombosUnavailableException`. Other join refusals (a read-only key, an
|
|
3832
3858
|
* account that may not trade) reject with `STXComboRefusedException`.
|
|
@@ -3836,7 +3862,7 @@ declare class STXWebSocket {
|
|
|
3836
3862
|
* Join `combo_quote:{user_id}` and return a `ComboMaker`: receive every
|
|
3837
3863
|
* request opened from now on (`rfq_opened`), quote and withdraw quotes.
|
|
3838
3864
|
*
|
|
3839
|
-
*
|
|
3865
|
+
* Available on US demo.
|
|
3840
3866
|
* Where combos are not available, rejects with
|
|
3841
3867
|
* `STXCombosUnavailableException`.
|
|
3842
3868
|
*/
|
|
@@ -4111,14 +4137,17 @@ declare class STX {
|
|
|
4111
4137
|
* `markets.write`, which STX grants, from the client's IP allow-list.
|
|
4112
4138
|
*
|
|
4113
4139
|
* Returns one result per market, in order: `created` or `exists` (both with
|
|
4114
|
-
* `market_id`), or `rejected` with a `reason`.
|
|
4140
|
+
* `market_id`), `valid` with `dryRun`, or `rejected` with a `reason`. Each
|
|
4141
|
+
* result's `index` is its position in `markets`, and `market` is that market
|
|
4142
|
+
* as requested. A rejected market is a
|
|
4115
4143
|
* result, not an error, and resending is safe: a market that is already
|
|
4116
4144
|
* listed comes back `exists`. A refused request throws (`403` without
|
|
4117
4145
|
* `markets.write`, `404` unknown event, `422` event not open).
|
|
4118
4146
|
*
|
|
4119
4147
|
* Each `line` must be a positive number ending in `.5`, e.g. `18.5`. More
|
|
4120
4148
|
* than `MAX_MARKETS_PER_REQUEST` markets throws `TypeError` before any
|
|
4121
|
-
* request. `
|
|
4149
|
+
* request. `dryRun` runs every check and creates nothing. `validate` also
|
|
4150
|
+
* needs the `events` scope.
|
|
4122
4151
|
*/
|
|
4123
4152
|
createMarkets(eventId: string, markets: readonly NewMarketInput[], opts?: CreateMarketsOptions): Promise<CreateMarketResult[]>;
|
|
4124
4153
|
/** `GET /api/v1/orders`: one page of your orders, newest first. */
|
|
@@ -254,8 +254,11 @@ interface EventPlayers {
|
|
|
254
254
|
}
|
|
255
255
|
/** One market to create. */
|
|
256
256
|
interface NewMarketInput {
|
|
257
|
-
/**
|
|
258
|
-
|
|
257
|
+
/**
|
|
258
|
+
* The market rule. `"player_stat_line"`, the only one today and the default;
|
|
259
|
+
* the exchange answers any other with `unsupported_rule`.
|
|
260
|
+
*/
|
|
261
|
+
rule?: "player_stat_line" | (string & {});
|
|
259
262
|
/** From `eventPlayers()`. */
|
|
260
263
|
playerId: string;
|
|
261
264
|
/** One of the event's stats, e.g. `Stats.Basketball.POINTS`. */
|
|
@@ -266,30 +269,48 @@ interface NewMarketInput {
|
|
|
266
269
|
* are rejected with `invalid_line`.
|
|
267
270
|
*/
|
|
268
271
|
line: number;
|
|
269
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* @deprecated Not sent. A player stat line is always over/under.
|
|
274
|
+
*/
|
|
270
275
|
propType?: "ou";
|
|
271
276
|
}
|
|
272
277
|
/** Why a market was not created. */
|
|
273
|
-
type MarketRejectionReason = "invalid_market" | "
|
|
274
|
-
/**
|
|
278
|
+
type MarketRejectionReason = "invalid_market" | "unsupported_rule" | "unsupported_stat" | "invalid_line" | "unknown_player" | "event_not_open" | "not_created" | (string & {});
|
|
279
|
+
/** The market a result is for, as it was requested. */
|
|
275
280
|
interface MarketRequestEcho {
|
|
281
|
+
rule?: string;
|
|
276
282
|
player_id?: string;
|
|
277
283
|
stat?: string;
|
|
278
|
-
prop_type?: string;
|
|
279
284
|
line?: number;
|
|
280
285
|
[key: string]: unknown;
|
|
281
286
|
}
|
|
282
|
-
/**
|
|
287
|
+
/**
|
|
288
|
+
* The outcome for one requested market. `index` is the market's position in
|
|
289
|
+
* the list given to `createMarkets()`, and `market` is that market as
|
|
290
|
+
* requested.
|
|
291
|
+
*/
|
|
283
292
|
type CreateMarketResult = {
|
|
293
|
+
index: number;
|
|
284
294
|
status: "created";
|
|
285
295
|
market_id: string;
|
|
296
|
+
reason: null;
|
|
286
297
|
market: MarketRequestEcho;
|
|
287
298
|
} | {
|
|
299
|
+
index: number;
|
|
288
300
|
status: "exists";
|
|
289
301
|
market_id: string;
|
|
302
|
+
reason: null;
|
|
290
303
|
market: MarketRequestEcho;
|
|
291
304
|
} | {
|
|
305
|
+
index: number;
|
|
306
|
+
status: "valid";
|
|
307
|
+
market_id: null;
|
|
308
|
+
reason: null;
|
|
309
|
+
market: MarketRequestEcho;
|
|
310
|
+
} | {
|
|
311
|
+
index: number;
|
|
292
312
|
status: "rejected";
|
|
313
|
+
market_id: null;
|
|
293
314
|
reason: MarketRejectionReason;
|
|
294
315
|
market: MarketRequestEcho;
|
|
295
316
|
};
|
|
@@ -303,6 +324,11 @@ interface CreateMarketsOptions {
|
|
|
303
324
|
* needs the `events` scope.
|
|
304
325
|
*/
|
|
305
326
|
validate?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Run every check on the exchange and create nothing. A market that would
|
|
329
|
+
* be created, or a repeat of one, comes back `valid`.
|
|
330
|
+
*/
|
|
331
|
+
dryRun?: boolean;
|
|
306
332
|
}
|
|
307
333
|
/** The most markets one `createMarkets()` call takes. */
|
|
308
334
|
declare const MAX_MARKETS_PER_REQUEST = 25;
|
|
@@ -2905,7 +2931,7 @@ declare class STXTimeoutException extends STXChannelException {
|
|
|
2905
2931
|
/**
|
|
2906
2932
|
* Combos are not available on this environment: the exchange refused the
|
|
2907
2933
|
* join to the player or maker topic with `unmatched topic`. Nothing else is
|
|
2908
|
-
* affected.
|
|
2934
|
+
* affected. Combos are available on US demo.
|
|
2909
2935
|
*/
|
|
2910
2936
|
declare class STXCombosUnavailableException extends STXChannelException {
|
|
2911
2937
|
}
|
|
@@ -3052,8 +3078,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
3052
3078
|
toString(): string;
|
|
3053
3079
|
}
|
|
3054
3080
|
|
|
3055
|
-
declare const VERSION = "0.8.
|
|
3056
|
-
declare const USER_AGENT = "stx-typescript/0.8.
|
|
3081
|
+
declare const VERSION = "0.8.2";
|
|
3082
|
+
declare const USER_AGENT = "stx-typescript/0.8.2";
|
|
3057
3083
|
/**
|
|
3058
3084
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
3059
3085
|
* `await using client = new STX()` works there; a registered stand-in on
|
|
@@ -3406,7 +3432,7 @@ declare abstract class ComboSession<E extends {
|
|
|
3406
3432
|
* The player's side of combos, on `rfq:<user_id>`. Get one with
|
|
3407
3433
|
* `ws.comboPlayer()`.
|
|
3408
3434
|
*
|
|
3409
|
-
*
|
|
3435
|
+
* Available on US demo.
|
|
3410
3436
|
*
|
|
3411
3437
|
* A request belongs to this channel: leaving, a dropped socket or a geo lapse
|
|
3412
3438
|
* ends it `cancelled`, and the SDK's automatic rejoin does not bring it back.
|
|
@@ -3464,7 +3490,7 @@ declare class ComboPlayer extends ComboSession<ComboPlayerEvent> {
|
|
|
3464
3490
|
* `ws.comboMaker()`. Joining subscribes to every request opened after the
|
|
3465
3491
|
* join (`rfq_opened`); earlier requests are not replayed.
|
|
3466
3492
|
*
|
|
3467
|
-
*
|
|
3493
|
+
* Available on US demo.
|
|
3468
3494
|
*
|
|
3469
3495
|
* A quote belongs to this channel: leaving or a dropped socket withdraws it.
|
|
3470
3496
|
* Every refusal throws `STXComboRefusedException` with the exchange's
|
|
@@ -3826,7 +3852,7 @@ declare class STXWebSocket {
|
|
|
3826
3852
|
* Join `rfq:{user_id}` and return a `ComboPlayer`: request quotes on a
|
|
3827
3853
|
* combination, cash one out, accept, cancel and read a request.
|
|
3828
3854
|
*
|
|
3829
|
-
*
|
|
3855
|
+
* Available on US demo.
|
|
3830
3856
|
* Where combos are not available, rejects with
|
|
3831
3857
|
* `STXCombosUnavailableException`. Other join refusals (a read-only key, an
|
|
3832
3858
|
* account that may not trade) reject with `STXComboRefusedException`.
|
|
@@ -3836,7 +3862,7 @@ declare class STXWebSocket {
|
|
|
3836
3862
|
* Join `combo_quote:{user_id}` and return a `ComboMaker`: receive every
|
|
3837
3863
|
* request opened from now on (`rfq_opened`), quote and withdraw quotes.
|
|
3838
3864
|
*
|
|
3839
|
-
*
|
|
3865
|
+
* Available on US demo.
|
|
3840
3866
|
* Where combos are not available, rejects with
|
|
3841
3867
|
* `STXCombosUnavailableException`.
|
|
3842
3868
|
*/
|
|
@@ -4111,14 +4137,17 @@ declare class STX {
|
|
|
4111
4137
|
* `markets.write`, which STX grants, from the client's IP allow-list.
|
|
4112
4138
|
*
|
|
4113
4139
|
* Returns one result per market, in order: `created` or `exists` (both with
|
|
4114
|
-
* `market_id`), or `rejected` with a `reason`.
|
|
4140
|
+
* `market_id`), `valid` with `dryRun`, or `rejected` with a `reason`. Each
|
|
4141
|
+
* result's `index` is its position in `markets`, and `market` is that market
|
|
4142
|
+
* as requested. A rejected market is a
|
|
4115
4143
|
* result, not an error, and resending is safe: a market that is already
|
|
4116
4144
|
* listed comes back `exists`. A refused request throws (`403` without
|
|
4117
4145
|
* `markets.write`, `404` unknown event, `422` event not open).
|
|
4118
4146
|
*
|
|
4119
4147
|
* Each `line` must be a positive number ending in `.5`, e.g. `18.5`. More
|
|
4120
4148
|
* than `MAX_MARKETS_PER_REQUEST` markets throws `TypeError` before any
|
|
4121
|
-
* request. `
|
|
4149
|
+
* request. `dryRun` runs every check and creates nothing. `validate` also
|
|
4150
|
+
* needs the `events` scope.
|
|
4122
4151
|
*/
|
|
4123
4152
|
createMarkets(eventId: string, markets: readonly NewMarketInput[], opts?: CreateMarketsOptions): Promise<CreateMarketResult[]>;
|
|
4124
4153
|
/** `GET /api/v1/orders`: one page of your orders, newest first. */
|
package/dist/index.cjs
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
var
|
|
68
|
+
var _chunkJHREXRKDcjs = require('./chunk-JHREXRKD.cjs');
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
@@ -133,5 +133,5 @@ var _chunkVLNOUSFWcjs = require('./chunk-VLNOUSFW.cjs');
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
|
|
136
|
-
exports.AccountView =
|
|
136
|
+
exports.AccountView = _chunkJHREXRKDcjs.AccountView; exports.ApiKeyCredentials = _chunkJHREXRKDcjs.ApiKeyCredentials; exports.Channel = _chunkJHREXRKDcjs.Channel; exports.ChannelMessage = _chunkJHREXRKDcjs.ChannelMessage; exports.ComboMaker = _chunkJHREXRKDcjs.ComboMaker; exports.ComboPlayer = _chunkJHREXRKDcjs.ComboPlayer; exports.Environment = _chunkJHREXRKDcjs.Environment; exports.Environments = _chunkJHREXRKDcjs.Environments; exports.HOSTS = _chunkJHREXRKDcjs.HOSTS; exports.KEY_HEADER = _chunkJHREXRKDcjs.KEY_HEADER; exports.MAX_MARKETS_PER_REQUEST = _chunkJHREXRKDcjs.MAX_MARKETS_PER_REQUEST; exports.NO_RETRY = _chunkJHREXRKDcjs.NO_RETRY; exports.OPERATIONS = _chunkJHREXRKDcjs.OPERATIONS; exports.Page = _chunkJHREXRKDcjs.Page; exports.ReconnectPolicy = _chunkJHREXRKDcjs.ReconnectPolicy; exports.Region = _chunkJHREXRKDcjs.Region; exports.RetryPolicy = _chunkJHREXRKDcjs.RetryPolicy; exports.SIGNATURE_HEADER = _chunkJHREXRKDcjs.SIGNATURE_HEADER; exports.SNAPSHOT_EVENTS = _chunkJHREXRKDcjs.SNAPSHOT_EVENTS; exports.STX = _chunkJHREXRKDcjs.STX; exports.STXAPIException = _chunkJHREXRKDcjs.STXAPIException; exports.STXAuthenticationException = _chunkJHREXRKDcjs.STXAuthenticationException; exports.STXChannelException = _chunkJHREXRKDcjs.STXChannelException; exports.STXComboPriceMovedException = _chunkJHREXRKDcjs.STXComboPriceMovedException; exports.STXComboRefusedException = _chunkJHREXRKDcjs.STXComboRefusedException; exports.STXCombosUnavailableException = _chunkJHREXRKDcjs.STXCombosUnavailableException; exports.STXConfigException = _chunkJHREXRKDcjs.STXConfigException; exports.STXException = _chunkJHREXRKDcjs.STXException; exports.STXForbiddenException = _chunkJHREXRKDcjs.STXForbiddenException; exports.STXGeoLocationException = _chunkJHREXRKDcjs.STXGeoLocationException; exports.STXInsufficientScopeException = _chunkJHREXRKDcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkJHREXRKDcjs.STXInvalidTokenException; exports.STXNotFoundException = _chunkJHREXRKDcjs.STXNotFoundException; exports.STXRateLimitException = _chunkJHREXRKDcjs.STXRateLimitException; exports.STXRejectedException = _chunkJHREXRKDcjs.STXRejectedException; exports.STXServerException = _chunkJHREXRKDcjs.STXServerException; exports.STXTimeoutException = _chunkJHREXRKDcjs.STXTimeoutException; exports.STXTransportException = _chunkJHREXRKDcjs.STXTransportException; exports.STXValidationException = _chunkJHREXRKDcjs.STXValidationException; exports.STXWebSocket = _chunkJHREXRKDcjs.STXWebSocket; exports.Stats = _chunkJHREXRKDcjs.Stats; exports.TERMINAL_ORDER_STATUSES = _chunkJHREXRKDcjs.TERMINAL_ORDER_STATUSES; exports.TIMESTAMP_HEADER = _chunkJHREXRKDcjs.TIMESTAMP_HEADER; exports.USER_AGENT = _chunkJHREXRKDcjs.USER_AGENT; exports.VERSION = _chunkJHREXRKDcjs.VERSION; exports.baseUrlFor = _chunkJHREXRKDcjs.baseUrlFor; exports.buildMessage = _chunkJHREXRKDcjs.buildMessage; exports.centsToDollars = _chunkJHREXRKDcjs.centsToDollars; exports.convertBook = _chunkJHREXRKDcjs.convertBook; exports.convertMarketChannelPayload = _chunkJHREXRKDcjs.convertMarketChannelPayload; exports.convertMarketPayload = _chunkJHREXRKDcjs.convertMarketPayload; exports.convertMarketsFrame = _chunkJHREXRKDcjs.convertMarketsFrame; exports.environmentNamed = _chunkJHREXRKDcjs.environmentNamed; exports.errorForStatus = _chunkJHREXRKDcjs.errorForStatus; exports.geoRejection = _chunkJHREXRKDcjs.geoRejection; exports.handshakePath = _chunkJHREXRKDcjs.handshakePath; exports.isValidLine = _chunkJHREXRKDcjs.isValidLine; exports.loadPrivateKey = _chunkJHREXRKDcjs.loadPrivateKey; exports.orderBody = _chunkJHREXRKDcjs.orderBody; exports.requestPath = _chunkJHREXRKDcjs.requestPath; exports.resolveHost = _chunkJHREXRKDcjs.resolveHost; exports.resolveSettings = _chunkJHREXRKDcjs.resolveSettings; exports.signerFromPrivateKey = _chunkJHREXRKDcjs.signerFromPrivateKey; exports.socketUrlFor = _chunkJHREXRKDcjs.socketUrlFor; exports.toDollarString = _chunkJHREXRKDcjs.toDollarString; exports.toQuantity = _chunkJHREXRKDcjs.toQuantity;
|
|
137
137
|
//# sourceMappingURL=index.cjs.map
|
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, 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-
|
|
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-jcBBoio1.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, 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-
|
|
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-jcBBoio1.js';
|
|
2
2
|
import 'node:crypto';
|
|
3
3
|
|
|
4
4
|
/** The fully resolved configuration the clients consume. */
|
package/dist/index.js
CHANGED
package/dist/oauth.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkJHREXRKDcjs = require('./chunk-JHREXRKD.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, _chunkJHREXRKDcjs.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, _chunkJHREXRKDcjs.STXConfigException)("No fetch implementation available. Use Node 18+, or pass { fetch }.");
|
|
31
31
|
}
|
|
32
|
-
return { baseUrl:
|
|
32
|
+
return { baseUrl: _chunkJHREXRKDcjs.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 _chunkJHREXRKDcjs.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 _chunkVLNOUSFWcjs.STXAuthenticationExcepti
|
|
|
56
56
|
this.retryAfter = retryAfter;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
var STXGrantRevokedException = class extends
|
|
59
|
+
var STXGrantRevokedException = class extends _chunkJHREXRKDcjs.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, _chunkJHREXRKDcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
|
|
145
145
|
statusCode: status,
|
|
146
146
|
body: text,
|
|
147
147
|
path
|
|
@@ -292,7 +292,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
292
292
|
*/
|
|
293
293
|
async beginAuthorization(pending, params = {}) {
|
|
294
294
|
const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
|
|
295
|
-
if (!redirectUri) throw new (0,
|
|
295
|
+
if (!redirectUri) throw new (0, _chunkJHREXRKDcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
|
|
296
296
|
const auth = await this.authorizationUrl({ ...params, redirectUri });
|
|
297
297
|
await pending.put(auth.state, {
|
|
298
298
|
codeVerifier: auth.codeVerifier,
|
|
@@ -334,7 +334,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
334
334
|
let memberKey;
|
|
335
335
|
if (opts.store) {
|
|
336
336
|
memberKey = typeof opts.memberKey === "function" ? opts.memberKey(entry.data) : opts.memberKey;
|
|
337
|
-
if (!memberKey) throw new (0,
|
|
337
|
+
if (!memberKey) throw new (0, _chunkJHREXRKDcjs.STXConfigException)("Pass memberKey along with store.");
|
|
338
338
|
await opts.store.set(memberKey, tokenSetToStored(tokens));
|
|
339
339
|
}
|
|
340
340
|
return { tokens, scopes: parseScopes(tokens.scope), data: entry.data, memberKey };
|
|
@@ -343,7 +343,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
343
343
|
buildAuthorizeUrl(params) {
|
|
344
344
|
const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
|
|
345
345
|
if (!redirectUri) {
|
|
346
|
-
throw new (0,
|
|
346
|
+
throw new (0, _chunkJHREXRKDcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
|
|
347
347
|
}
|
|
348
348
|
const url = new URL(joinUrl(this.baseUrl, this.endpoints.authorize));
|
|
349
349
|
const search = {
|
|
@@ -365,7 +365,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
365
365
|
exchangeCode(args) {
|
|
366
366
|
const redirectUri = _nullishCoalesce(args.redirectUri, () => ( this.redirectUri));
|
|
367
367
|
if (!redirectUri) {
|
|
368
|
-
throw new (0,
|
|
368
|
+
throw new (0, _chunkJHREXRKDcjs.STXConfigException)("redirectUri is required to exchange a code.");
|
|
369
369
|
}
|
|
370
370
|
return this.postToken(
|
|
371
371
|
new URLSearchParams({
|
|
@@ -406,7 +406,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
406
406
|
*/
|
|
407
407
|
clientCredentials(scope) {
|
|
408
408
|
if (this.isPublic) {
|
|
409
|
-
throw new (0,
|
|
409
|
+
throw new (0, _chunkJHREXRKDcjs.STXConfigException)(
|
|
410
410
|
"client_credentials needs a client secret; a public client cannot mint an app token."
|
|
411
411
|
);
|
|
412
412
|
}
|
|
@@ -510,7 +510,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
510
510
|
*/
|
|
511
511
|
memberClient(store, memberKey, opts = {}) {
|
|
512
512
|
const { session, ...rest } = opts;
|
|
513
|
-
return new (0,
|
|
513
|
+
return new (0, _chunkJHREXRKDcjs.STX)({
|
|
514
514
|
...rest,
|
|
515
515
|
host: this.baseUrl,
|
|
516
516
|
fetch: _nullishCoalesce(rest.fetch, () => ( this.fetch)),
|
|
@@ -523,7 +523,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
523
523
|
* market channels. Scope defaults to every app scope the client may hold.
|
|
524
524
|
*/
|
|
525
525
|
appClient(scope, opts = {}) {
|
|
526
|
-
return new (0,
|
|
526
|
+
return new (0, _chunkJHREXRKDcjs.STX)({ ...opts, host: this.baseUrl, fetch: _nullishCoalesce(opts.fetch, () => ( this.fetch)), auth: this.app(scope) });
|
|
527
527
|
}
|
|
528
528
|
/** @internal The in-flight refresh map for one store; see `OAuthSessionAuth`. */
|
|
529
529
|
_refreshesFor(store) {
|
|
@@ -699,7 +699,7 @@ var OAuthSessionAuth = (_class4 = class {
|
|
|
699
699
|
async tokens() {
|
|
700
700
|
let tokens = await this.load();
|
|
701
701
|
if (!tokens) {
|
|
702
|
-
throw new (0,
|
|
702
|
+
throw new (0, _chunkJHREXRKDcjs.STXConfigException)(`No tokens stored for member "${this.memberKey}". Complete the OAuth flow first.`);
|
|
703
703
|
}
|
|
704
704
|
if (tokens.refreshToken && tokens.expiresAt !== void 0 && tokens.expiresAt - Date.now() <= this.skewMs) {
|
|
705
705
|
const refreshed = await this.refresh(tokens.refreshToken);
|
|
@@ -881,7 +881,7 @@ async function fetchWellKnown(baseUrl, path, opts) {
|
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
883
|
function httpError2(status, text, path) {
|
|
884
|
-
return new (0,
|
|
884
|
+
return new (0, _chunkJHREXRKDcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
|
|
885
885
|
statusCode: status,
|
|
886
886
|
body: text,
|
|
887
887
|
path
|
|
@@ -965,5 +965,5 @@ var MemoryPendingAuthorizationStore = (_class7 = class {constructor() { _class7.
|
|
|
965
965
|
|
|
966
966
|
|
|
967
967
|
|
|
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 =
|
|
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 = _chunkJHREXRKDcjs.STXAuthenticationException; exports.STXForbiddenException = _chunkJHREXRKDcjs.STXForbiddenException; exports.STXGrantRevokedException = STXGrantRevokedException; exports.STXInsufficientScopeException = _chunkJHREXRKDcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkJHREXRKDcjs.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;
|
|
969
969
|
//# sourceMappingURL=oauth.cjs.map
|
package/dist/oauth.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aR as STXAuthenticationException, g as AuthProvider, h as AuthRequest, bn as WebSocketAuthContext, b2 as STXOptions, aP as STX } from './client-
|
|
2
|
-
export { aZ as STXForbiddenException, a$ as STXInsufficientScopeException, b0 as STXInvalidTokenException } from './client-
|
|
1
|
+
import { aR as STXAuthenticationException, g as AuthProvider, h as AuthRequest, bn as WebSocketAuthContext, b2 as STXOptions, aP as STX } from './client-jcBBoio1.cjs';
|
|
2
|
+
export { aZ as STXForbiddenException, a$ as STXInsufficientScopeException, b0 as STXInvalidTokenException } from './client-jcBBoio1.cjs';
|
|
3
3
|
import 'node:crypto';
|
|
4
4
|
|
|
5
5
|
interface OAuthEndpoints$1 {
|
package/dist/oauth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aR as STXAuthenticationException, g as AuthProvider, h as AuthRequest, bn as WebSocketAuthContext, b2 as STXOptions, aP as STX } from './client-
|
|
2
|
-
export { aZ as STXForbiddenException, a$ as STXInsufficientScopeException, b0 as STXInvalidTokenException } from './client-
|
|
1
|
+
import { aR as STXAuthenticationException, g as AuthProvider, h as AuthRequest, bn as WebSocketAuthContext, b2 as STXOptions, aP as STX } from './client-jcBBoio1.js';
|
|
2
|
+
export { aZ as STXForbiddenException, a$ as STXInsufficientScopeException, b0 as STXInvalidTokenException } from './client-jcBBoio1.js';
|
|
3
3
|
import 'node:crypto';
|
|
4
4
|
|
|
5
5
|
interface OAuthEndpoints$1 {
|
package/dist/oauth.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stxapp/stx-typescript",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "The TypeScript SDK for the STX exchange: markets, trading, your account and live WebSocket channels, with API-key signing and typed responses.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|