@stxapp/stx-typescript 0.6.2 → 0.6.3
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 +4 -0
- package/dist/{chunk-WGIYEJBI.cjs → chunk-CSHPFQ2V.cjs} +65 -10
- package/dist/chunk-CSHPFQ2V.cjs.map +1 -0
- package/dist/{chunk-X7B7WXJ3.js → chunk-PZUVKPHZ.js} +65 -10
- package/dist/{chunk-X7B7WXJ3.js.map → chunk-PZUVKPHZ.js.map} +1 -1
- package/dist/{client-C0G5lsiP.d.cts → client-Dkd5vesS.d.cts} +2 -2
- package/dist/{client-C0G5lsiP.d.ts → client-Dkd5vesS.d.ts} +2 -2
- 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-WGIYEJBI.cjs.map +0 -1
|
@@ -2556,8 +2556,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
2556
2556
|
toString(): string;
|
|
2557
2557
|
}
|
|
2558
2558
|
|
|
2559
|
-
declare const VERSION = "0.6.
|
|
2560
|
-
declare const USER_AGENT = "stx-typescript/0.6.
|
|
2559
|
+
declare const VERSION = "0.6.3";
|
|
2560
|
+
declare const USER_AGENT = "stx-typescript/0.6.3";
|
|
2561
2561
|
/**
|
|
2562
2562
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
2563
2563
|
* `await using client = new STX()` works there; a registered stand-in on
|
|
@@ -2556,8 +2556,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
2556
2556
|
toString(): string;
|
|
2557
2557
|
}
|
|
2558
2558
|
|
|
2559
|
-
declare const VERSION = "0.6.
|
|
2560
|
-
declare const USER_AGENT = "stx-typescript/0.6.
|
|
2559
|
+
declare const VERSION = "0.6.3";
|
|
2560
|
+
declare const USER_AGENT = "stx-typescript/0.6.3";
|
|
2561
2561
|
/**
|
|
2562
2562
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
2563
2563
|
* `await using client = new STX()` works there; a registered stand-in on
|
package/dist/index.cjs
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
var
|
|
60
|
+
var _chunkCSHPFQ2Vcjs = require('./chunk-CSHPFQ2V.cjs');
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
@@ -117,5 +117,5 @@ var _chunkWGIYEJBIcjs = require('./chunk-WGIYEJBI.cjs');
|
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
exports.AccountView =
|
|
120
|
+
exports.AccountView = _chunkCSHPFQ2Vcjs.AccountView; exports.ApiKeyCredentials = _chunkCSHPFQ2Vcjs.ApiKeyCredentials; exports.Channel = _chunkCSHPFQ2Vcjs.Channel; exports.ChannelMessage = _chunkCSHPFQ2Vcjs.ChannelMessage; exports.Environment = _chunkCSHPFQ2Vcjs.Environment; exports.Environments = _chunkCSHPFQ2Vcjs.Environments; exports.HOSTS = _chunkCSHPFQ2Vcjs.HOSTS; exports.KEY_HEADER = _chunkCSHPFQ2Vcjs.KEY_HEADER; exports.NO_RETRY = _chunkCSHPFQ2Vcjs.NO_RETRY; exports.OPERATIONS = _chunkCSHPFQ2Vcjs.OPERATIONS; exports.Page = _chunkCSHPFQ2Vcjs.Page; exports.ReconnectPolicy = _chunkCSHPFQ2Vcjs.ReconnectPolicy; exports.Region = _chunkCSHPFQ2Vcjs.Region; exports.RetryPolicy = _chunkCSHPFQ2Vcjs.RetryPolicy; exports.SIGNATURE_HEADER = _chunkCSHPFQ2Vcjs.SIGNATURE_HEADER; exports.SNAPSHOT_EVENTS = _chunkCSHPFQ2Vcjs.SNAPSHOT_EVENTS; exports.STX = _chunkCSHPFQ2Vcjs.STX; exports.STXAPIException = _chunkCSHPFQ2Vcjs.STXAPIException; exports.STXAuthenticationException = _chunkCSHPFQ2Vcjs.STXAuthenticationException; exports.STXChannelException = _chunkCSHPFQ2Vcjs.STXChannelException; exports.STXConfigException = _chunkCSHPFQ2Vcjs.STXConfigException; exports.STXException = _chunkCSHPFQ2Vcjs.STXException; exports.STXForbiddenException = _chunkCSHPFQ2Vcjs.STXForbiddenException; exports.STXGeoLocationException = _chunkCSHPFQ2Vcjs.STXGeoLocationException; exports.STXInsufficientScopeException = _chunkCSHPFQ2Vcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkCSHPFQ2Vcjs.STXInvalidTokenException; exports.STXNotFoundException = _chunkCSHPFQ2Vcjs.STXNotFoundException; exports.STXRateLimitException = _chunkCSHPFQ2Vcjs.STXRateLimitException; exports.STXRejectedException = _chunkCSHPFQ2Vcjs.STXRejectedException; exports.STXServerException = _chunkCSHPFQ2Vcjs.STXServerException; exports.STXTimeoutException = _chunkCSHPFQ2Vcjs.STXTimeoutException; exports.STXTransportException = _chunkCSHPFQ2Vcjs.STXTransportException; exports.STXValidationException = _chunkCSHPFQ2Vcjs.STXValidationException; exports.STXWebSocket = _chunkCSHPFQ2Vcjs.STXWebSocket; exports.TERMINAL_ORDER_STATUSES = _chunkCSHPFQ2Vcjs.TERMINAL_ORDER_STATUSES; exports.TIMESTAMP_HEADER = _chunkCSHPFQ2Vcjs.TIMESTAMP_HEADER; exports.USER_AGENT = _chunkCSHPFQ2Vcjs.USER_AGENT; exports.VERSION = _chunkCSHPFQ2Vcjs.VERSION; exports.baseUrlFor = _chunkCSHPFQ2Vcjs.baseUrlFor; exports.buildMessage = _chunkCSHPFQ2Vcjs.buildMessage; exports.centsToDollars = _chunkCSHPFQ2Vcjs.centsToDollars; exports.convertBook = _chunkCSHPFQ2Vcjs.convertBook; exports.convertMarketChannelPayload = _chunkCSHPFQ2Vcjs.convertMarketChannelPayload; exports.convertMarketPayload = _chunkCSHPFQ2Vcjs.convertMarketPayload; exports.convertMarketsFrame = _chunkCSHPFQ2Vcjs.convertMarketsFrame; exports.environmentNamed = _chunkCSHPFQ2Vcjs.environmentNamed; exports.errorForStatus = _chunkCSHPFQ2Vcjs.errorForStatus; exports.geoRejection = _chunkCSHPFQ2Vcjs.geoRejection; exports.handshakePath = _chunkCSHPFQ2Vcjs.handshakePath; exports.loadPrivateKey = _chunkCSHPFQ2Vcjs.loadPrivateKey; exports.orderBody = _chunkCSHPFQ2Vcjs.orderBody; exports.requestPath = _chunkCSHPFQ2Vcjs.requestPath; exports.resolveHost = _chunkCSHPFQ2Vcjs.resolveHost; exports.resolveSettings = _chunkCSHPFQ2Vcjs.resolveSettings; exports.signerFromPrivateKey = _chunkCSHPFQ2Vcjs.signerFromPrivateKey; exports.socketUrlFor = _chunkCSHPFQ2Vcjs.socketUrlFor; exports.toDollarString = _chunkCSHPFQ2Vcjs.toDollarString; exports.toQuantity = _chunkCSHPFQ2Vcjs.toQuantity;
|
|
121
121
|
//# 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, E as Environment, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP 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, E as Environment, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP as socketUrlFor } from './client-Dkd5vesS.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, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP 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, E as Environment, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP as socketUrlFor } from './client-Dkd5vesS.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 _chunkCSHPFQ2Vcjs = require('./chunk-CSHPFQ2V.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, _chunkCSHPFQ2Vcjs.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, _chunkCSHPFQ2Vcjs.STXConfigException)("No fetch implementation available. Use Node 18+, or pass { fetch }.");
|
|
31
31
|
}
|
|
32
|
-
return { baseUrl:
|
|
32
|
+
return { baseUrl: _chunkCSHPFQ2Vcjs.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 _chunkCSHPFQ2Vcjs.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 _chunkWGIYEJBIcjs.STXAuthenticationExcepti
|
|
|
56
56
|
this.retryAfter = retryAfter;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
var STXGrantRevokedException = class extends
|
|
59
|
+
var STXGrantRevokedException = class extends _chunkCSHPFQ2Vcjs.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, _chunkCSHPFQ2Vcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
|
|
145
145
|
statusCode: status,
|
|
146
146
|
body: text,
|
|
147
147
|
path
|
|
@@ -290,7 +290,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
290
290
|
*/
|
|
291
291
|
async beginAuthorization(pending, params = {}) {
|
|
292
292
|
const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
|
|
293
|
-
if (!redirectUri) throw new (0,
|
|
293
|
+
if (!redirectUri) throw new (0, _chunkCSHPFQ2Vcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
|
|
294
294
|
const auth = await this.authorizationUrl({ ...params, redirectUri });
|
|
295
295
|
await pending.put(auth.state, {
|
|
296
296
|
codeVerifier: auth.codeVerifier,
|
|
@@ -332,7 +332,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
332
332
|
let memberKey;
|
|
333
333
|
if (opts.store) {
|
|
334
334
|
memberKey = typeof opts.memberKey === "function" ? opts.memberKey(entry.data) : opts.memberKey;
|
|
335
|
-
if (!memberKey) throw new (0,
|
|
335
|
+
if (!memberKey) throw new (0, _chunkCSHPFQ2Vcjs.STXConfigException)("Pass memberKey along with store.");
|
|
336
336
|
await opts.store.set(memberKey, tokenSetToStored(tokens));
|
|
337
337
|
}
|
|
338
338
|
return { tokens, scopes: parseScopes(tokens.scope), data: entry.data, memberKey };
|
|
@@ -341,7 +341,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
341
341
|
buildAuthorizeUrl(params) {
|
|
342
342
|
const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
|
|
343
343
|
if (!redirectUri) {
|
|
344
|
-
throw new (0,
|
|
344
|
+
throw new (0, _chunkCSHPFQ2Vcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
|
|
345
345
|
}
|
|
346
346
|
const url = new URL(joinUrl(this.baseUrl, this.endpoints.authorize));
|
|
347
347
|
const search = {
|
|
@@ -363,7 +363,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
363
363
|
exchangeCode(args) {
|
|
364
364
|
const redirectUri = _nullishCoalesce(args.redirectUri, () => ( this.redirectUri));
|
|
365
365
|
if (!redirectUri) {
|
|
366
|
-
throw new (0,
|
|
366
|
+
throw new (0, _chunkCSHPFQ2Vcjs.STXConfigException)("redirectUri is required to exchange a code.");
|
|
367
367
|
}
|
|
368
368
|
return this.postToken(
|
|
369
369
|
new URLSearchParams({
|
|
@@ -404,7 +404,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
404
404
|
*/
|
|
405
405
|
clientCredentials(scope) {
|
|
406
406
|
if (this.isPublic) {
|
|
407
|
-
throw new (0,
|
|
407
|
+
throw new (0, _chunkCSHPFQ2Vcjs.STXConfigException)(
|
|
408
408
|
"client_credentials needs a client secret; a public client cannot mint an app token."
|
|
409
409
|
);
|
|
410
410
|
}
|
|
@@ -508,7 +508,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
508
508
|
*/
|
|
509
509
|
memberClient(store, memberKey, opts = {}) {
|
|
510
510
|
const { session, ...rest } = opts;
|
|
511
|
-
return new (0,
|
|
511
|
+
return new (0, _chunkCSHPFQ2Vcjs.STX)({
|
|
512
512
|
...rest,
|
|
513
513
|
host: this.baseUrl,
|
|
514
514
|
fetch: _nullishCoalesce(rest.fetch, () => ( this.fetch)),
|
|
@@ -521,7 +521,7 @@ var OAuthClient = (_class = class _OAuthClient {
|
|
|
521
521
|
* market channels. Scope defaults to every app scope the client may hold.
|
|
522
522
|
*/
|
|
523
523
|
appClient(scope, opts = {}) {
|
|
524
|
-
return new (0,
|
|
524
|
+
return new (0, _chunkCSHPFQ2Vcjs.STX)({ ...opts, host: this.baseUrl, fetch: _nullishCoalesce(opts.fetch, () => ( this.fetch)), auth: this.app(scope) });
|
|
525
525
|
}
|
|
526
526
|
/** @internal The in-flight refresh map for one store; see `OAuthSessionAuth`. */
|
|
527
527
|
_refreshesFor(store) {
|
|
@@ -697,7 +697,7 @@ var OAuthSessionAuth = (_class4 = class {
|
|
|
697
697
|
async tokens() {
|
|
698
698
|
let tokens = await this.load();
|
|
699
699
|
if (!tokens) {
|
|
700
|
-
throw new (0,
|
|
700
|
+
throw new (0, _chunkCSHPFQ2Vcjs.STXConfigException)(`No tokens stored for member "${this.memberKey}". Complete the OAuth flow first.`);
|
|
701
701
|
}
|
|
702
702
|
if (tokens.refreshToken && tokens.expiresAt !== void 0 && tokens.expiresAt - Date.now() <= this.skewMs) {
|
|
703
703
|
const refreshed = await this.refresh(tokens.refreshToken);
|
|
@@ -879,7 +879,7 @@ async function fetchWellKnown(baseUrl, path, opts) {
|
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
881
|
function httpError2(status, text, path) {
|
|
882
|
-
return new (0,
|
|
882
|
+
return new (0, _chunkCSHPFQ2Vcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
|
|
883
883
|
statusCode: status,
|
|
884
884
|
body: text,
|
|
885
885
|
path
|
|
@@ -963,5 +963,5 @@ var MemoryPendingAuthorizationStore = (_class7 = class {constructor() { _class7.
|
|
|
963
963
|
|
|
964
964
|
|
|
965
965
|
|
|
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 =
|
|
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 = _chunkCSHPFQ2Vcjs.STXAuthenticationException; exports.STXForbiddenException = _chunkCSHPFQ2Vcjs.STXForbiddenException; exports.STXGrantRevokedException = STXGrantRevokedException; exports.STXInsufficientScopeException = _chunkCSHPFQ2Vcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkCSHPFQ2Vcjs.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
967
|
//# sourceMappingURL=oauth.cjs.map
|
package/dist/oauth.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a9 as STXAuthenticationException, g as AuthProvider, h as AuthRequest, aC as WebSocketAuthContext, aj as STXOptions, a7 as STX } from './client-
|
|
2
|
-
export { ae as STXForbiddenException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException } from './client-
|
|
1
|
+
import { a9 as STXAuthenticationException, g as AuthProvider, h as AuthRequest, aC as WebSocketAuthContext, aj as STXOptions, a7 as STX } from './client-Dkd5vesS.cjs';
|
|
2
|
+
export { ae as STXForbiddenException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException } from './client-Dkd5vesS.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 { a9 as STXAuthenticationException, g as AuthProvider, h as AuthRequest, aC as WebSocketAuthContext, aj as STXOptions, a7 as STX } from './client-
|
|
2
|
-
export { ae as STXForbiddenException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException } from './client-
|
|
1
|
+
import { a9 as STXAuthenticationException, g as AuthProvider, h as AuthRequest, aC as WebSocketAuthContext, aj as STXOptions, a7 as STX } from './client-Dkd5vesS.js';
|
|
2
|
+
export { ae as STXForbiddenException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException } from './client-Dkd5vesS.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.6.
|
|
3
|
+
"version": "0.6.3",
|
|
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",
|