@dmarket/p2p-tracker-headless 1.4.1-SNAPSHOT-development.271 → 1.4.1-SNAPSHOT-development.327

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/index.d.ts CHANGED
@@ -100,6 +100,25 @@ export interface TrackerState {
100
100
  readonly updateDueTimeMs: number | null;
101
101
  /** Each tracked deal's deadline, by deal id. */
102
102
  readonly dealDeadlines: Readonly<Record<string, number>>;
103
+ /**
104
+ * Whether the last attempt through the Steam proxy pushed with the token failed. While it is, nothing reaches
105
+ * Steam — nothing falls back to a direct connection — and no create or cancel is sent or reported failed. Cleared
106
+ * when a connection gets through it, or another proxy (or none) is pushed. The proxy itself is never readable back.
107
+ */
108
+ readonly steamProxyUnreachable: boolean;
109
+ /** Since when, while `steamProxyUnreachable`. */
110
+ readonly steamProxyUnreachableSinceMs: number | null;
111
+ }
112
+
113
+ /** The options of a Steam token push. */
114
+ export interface SteamTokenPushOptions {
115
+ /**
116
+ * The HTTP proxy this Steam account's traffic goes through, `http://user:pass@host:port` (HTTP CONNECT; no
117
+ * SOCKS), held with the token. Absent (or `undefined`): a renewal, the proxy held before stays — a push that names
118
+ * none never moves the account back to this host's address. A URL: that proxy from now on. `null`: no proxy from
119
+ * now on, Steam reached directly. A token that is not held changes neither. Write-only.
120
+ */
121
+ proxy?: string | null;
103
122
  }
104
123
 
105
124
  /** Why a prover process ended before its proof did. */
@@ -112,6 +131,7 @@ export type ProofFailure =
112
131
  | { readonly type: "notary_unreachable"; readonly detail: string; readonly summary: string }
113
132
  | { readonly type: "version_mismatch"; readonly detail: string; readonly summary: string }
114
133
  | { readonly type: "steam_failed"; readonly status: number | null; readonly detail: string; readonly summary: string }
134
+ | { readonly type: "proxy_unreachable"; readonly detail: string; readonly summary: string }
115
135
  | { readonly type: "limits_exceeded"; readonly detail: string; readonly summary: string }
116
136
  | { readonly type: "prover_killed"; readonly cause: KillCause; readonly detail: string | null; readonly summary: string }
117
137
  | { readonly type: "not_started"; readonly reason: string; readonly summary: string }
@@ -136,7 +156,10 @@ export declare function start(handle: TrackerHandle): void;
136
156
  /** Runs one cycle now, behind the cycle in flight. */
137
157
  export declare function cycle(handle: TrackerHandle): Promise<void>;
138
158
 
139
- /** Stops the tracker and kills every prover process at once. Every later call with the handle is refused. */
159
+ /**
160
+ * Stops the tracker; kills every prover process and every tunnel through its Steam proxy at once. Every later call with
161
+ * the handle is refused.
162
+ */
140
163
  export declare function stop(handle: TrackerHandle): Promise<void>;
141
164
 
142
165
  /** Pushes the DMarket Trading API key pair (hex). */
@@ -146,8 +169,21 @@ export declare function pushTradingApiKey(
146
169
  secretKey: string,
147
170
  ): Promise<TradingApiKeyPushResult>;
148
171
 
149
- /** Pushes a Steam access token. */
150
- export declare function pushSteamToken(handle: TrackerHandle, accessToken: string): Promise<SteamTokenPushResult>;
172
+ /**
173
+ * Pushes a Steam access token, and what becomes of the proxy its Steam traffic goes through (`options.proxy`: kept
174
+ * when absent, replaced by a URL, dropped by `null`). Every Steam call and
175
+ * every proof's Steam leg then tunnels through that proxy and fails rather than go direct: a failure is reported as
176
+ * the `SteamProxyUnreachable` event (`SteamProxyRecovered` ends it), `steamProxyUnreachable` in the state, a create
177
+ * or a cancel deferred (`SteamWriteDeferred`) with `reasons().steamProxyUnreachable` — never sent, read or reported
178
+ * failed — and a proof's `proxy_unreachable`. Rejects a `proxy` that is neither `null` nor an `http://` URL with a host
179
+ * and a port with an `Error` whose `code` is `steamProxyInvalidCode()`, naming the rule and never the value; resolves
180
+ * `invalid` where the host cannot route Steam through a proxy.
181
+ */
182
+ export declare function pushSteamToken(
183
+ handle: TrackerHandle,
184
+ accessToken: string,
185
+ options?: SteamTokenPushOptions,
186
+ ): Promise<SteamTokenPushResult>;
151
187
 
152
188
  /** What the tracker holds right now. */
153
189
  export declare function trackerState(handle: TrackerHandle): TrackerState;
@@ -159,6 +195,7 @@ export declare function reasons(): Readonly<{
159
195
  tokenExpiringDefer: "the Steam token expires before a create could be confirmed";
160
196
  proofTokenExpiring: "the Steam token is too close to its expiry to start a proof";
161
197
  noProver: "no notary prover is configured on this host";
198
+ steamProxyUnreachable: "not sent: the Steam proxy could not be reached";
162
199
  }>;
163
200
 
164
201
  /** The `kind` of a failed-cancel check, by name. The same frozen object each call. */
@@ -180,6 +217,12 @@ export declare function directiveActions(): Readonly<{
180
217
  /** The gateway's error code for a heartbeat refused because the DMarket account links no Steam account. */
181
218
  export declare function steamNotLinkedCode(): "P2P_STEAM_NOT_LINKED";
182
219
 
220
+ /**
221
+ * The `code` of the `Error` `pushSteamToken` rejects with when `options.proxy` is neither `null` nor an `http://` URL
222
+ * with a host and a port. Its message names the rule broken, never the value. No other rejection carries it.
223
+ */
224
+ export declare function steamProxyInvalidCode(): "STEAM_PROXY_INVALID";
225
+
183
226
  /** Under this much token life no create or proof starts. */
184
227
  export declare function minWriteTokenLifetimeMs(): number;
185
228
 
@@ -1798,6 +1798,9 @@ function single_2(_this__u8e3s4) {
1798
1798
  }
1799
1799
  return tmp;
1800
1800
  }
1801
+ function getOrNull_0(_this__u8e3s4, index) {
1802
+ return (0 <= index ? index <= (charSequenceLength(_this__u8e3s4) - 1 | 0) : false) ? charSequenceGet(_this__u8e3s4, index) : null;
1803
+ }
1801
1804
  function drop_0(_this__u8e3s4, n) {
1802
1805
  // Inline function 'kotlin.require' call
1803
1806
  if (!(n >= 0)) {
@@ -3995,12 +3998,12 @@ function reverse(_this__u8e3s4) {
3995
3998
  }
3996
3999
  while (!(index === midPoint));
3997
4000
  }
3998
- function minOf(a, b) {
3999
- return compareTo_0(a, b) <= 0 ? a : b;
4000
- }
4001
4001
  function maxOf(a, b) {
4002
4002
  return compareTo_0(a, b) >= 0 ? a : b;
4003
4003
  }
4004
+ function minOf(a, b) {
4005
+ return compareTo_0(a, b) <= 0 ? a : b;
4006
+ }
4004
4007
  function isDigitImpl(_this__u8e3s4) {
4005
4008
  return digitToIntImpl(_this__u8e3s4) >= 0;
4006
4009
  }
@@ -7701,6 +7704,15 @@ function isLetter(_this__u8e3s4) {
7701
7704
  }
7702
7705
  return isLetterImpl(_this__u8e3s4);
7703
7706
  }
7707
+ function isLetterOrDigit(_this__u8e3s4) {
7708
+ if ((_Char___init__impl__6a9atx(97) <= _this__u8e3s4 ? _this__u8e3s4 <= _Char___init__impl__6a9atx(122) : false) || (_Char___init__impl__6a9atx(65) <= _this__u8e3s4 ? _this__u8e3s4 <= _Char___init__impl__6a9atx(90) : false) || (_Char___init__impl__6a9atx(48) <= _this__u8e3s4 ? _this__u8e3s4 <= _Char___init__impl__6a9atx(57) : false)) {
7709
+ return true;
7710
+ }
7711
+ if (Char__compareTo_impl_ypi4mb(_this__u8e3s4, _Char___init__impl__6a9atx(128)) < 0) {
7712
+ return false;
7713
+ }
7714
+ return isDigitImpl(_this__u8e3s4) || isLetterImpl(_this__u8e3s4);
7715
+ }
7704
7716
  function toString_2(_this__u8e3s4, radix) {
7705
7717
  return toStringImpl(_this__u8e3s4, checkRadix(radix));
7706
7718
  }
@@ -8364,23 +8376,23 @@ function _init_properties_stringJs_kt__bg7zye() {
8364
8376
  STRING_CASE_INSENSITIVE_ORDER = new sam$kotlin_Comparator$0(tmp);
8365
8377
  }
8366
8378
  }
8367
- function endsWith(_this__u8e3s4, suffix, ignoreCase) {
8379
+ function startsWith(_this__u8e3s4, prefix, ignoreCase) {
8368
8380
  ignoreCase = ignoreCase === VOID ? false : ignoreCase;
8369
8381
  if (!ignoreCase) {
8370
- // Inline function 'kotlin.text.nativeEndsWith' call
8382
+ // Inline function 'kotlin.text.nativeStartsWith' call
8371
8383
  // Inline function 'kotlin.js.asDynamic' call
8372
- return _this__u8e3s4.endsWith(suffix);
8384
+ return _this__u8e3s4.startsWith(prefix, 0);
8373
8385
  } else
8374
- return regionMatches(_this__u8e3s4, _this__u8e3s4.length - suffix.length | 0, suffix, 0, suffix.length, ignoreCase);
8386
+ return regionMatches(_this__u8e3s4, 0, prefix, 0, prefix.length, ignoreCase);
8375
8387
  }
8376
- function startsWith(_this__u8e3s4, prefix, ignoreCase) {
8388
+ function endsWith(_this__u8e3s4, suffix, ignoreCase) {
8377
8389
  ignoreCase = ignoreCase === VOID ? false : ignoreCase;
8378
8390
  if (!ignoreCase) {
8379
- // Inline function 'kotlin.text.nativeStartsWith' call
8391
+ // Inline function 'kotlin.text.nativeEndsWith' call
8380
8392
  // Inline function 'kotlin.js.asDynamic' call
8381
- return _this__u8e3s4.startsWith(prefix, 0);
8393
+ return _this__u8e3s4.endsWith(suffix);
8382
8394
  } else
8383
- return regionMatches(_this__u8e3s4, 0, prefix, 0, prefix.length, ignoreCase);
8395
+ return regionMatches(_this__u8e3s4, _this__u8e3s4.length - suffix.length | 0, suffix, 0, suffix.length, ignoreCase);
8384
8396
  }
8385
8397
  function equals_0(_this__u8e3s4, other, ignoreCase) {
8386
8398
  ignoreCase = ignoreCase === VOID ? false : ignoreCase;
@@ -14849,6 +14861,17 @@ function indexOf_6(_this__u8e3s4, string, startIndex, ignoreCase) {
14849
14861
  }
14850
14862
  return tmp;
14851
14863
  }
14864
+ function substringBefore(_this__u8e3s4, delimiter, missingDelimiterValue) {
14865
+ missingDelimiterValue = missingDelimiterValue === VOID ? _this__u8e3s4 : missingDelimiterValue;
14866
+ var index = indexOf_6(_this__u8e3s4, delimiter);
14867
+ return index === -1 ? missingDelimiterValue : substring(_this__u8e3s4, 0, index);
14868
+ }
14869
+ function removePrefix(_this__u8e3s4, prefix) {
14870
+ if (startsWith_2(_this__u8e3s4, prefix)) {
14871
+ return substring_0(_this__u8e3s4, charSequenceLength(prefix));
14872
+ }
14873
+ return _this__u8e3s4;
14874
+ }
14852
14875
  function trimStart(_this__u8e3s4, chars) {
14853
14876
  // Inline function 'kotlin.text.trimStart' call
14854
14877
  var tmp0 = isCharSequence(_this__u8e3s4) ? _this__u8e3s4 : THROW_CCE();
@@ -14894,11 +14917,6 @@ function trimEnd(_this__u8e3s4, chars) {
14894
14917
  }
14895
14918
  return toString_1(tmp$ret$1);
14896
14919
  }
14897
- function substringBefore(_this__u8e3s4, delimiter, missingDelimiterValue) {
14898
- missingDelimiterValue = missingDelimiterValue === VOID ? _this__u8e3s4 : missingDelimiterValue;
14899
- var index = indexOf_6(_this__u8e3s4, delimiter);
14900
- return index === -1 ? missingDelimiterValue : substring(_this__u8e3s4, 0, index);
14901
- }
14902
14920
  function substringAfter(_this__u8e3s4, delimiter, missingDelimiterValue) {
14903
14921
  missingDelimiterValue = missingDelimiterValue === VOID ? _this__u8e3s4 : missingDelimiterValue;
14904
14922
  var index = indexOf_6(_this__u8e3s4, delimiter);
@@ -15641,6 +15659,32 @@ function findAnyOf(_this__u8e3s4, strings, startIndex, ignoreCase, last) {
15641
15659
  function lines(_this__u8e3s4) {
15642
15660
  return toList_2(lineSequence(_this__u8e3s4));
15643
15661
  }
15662
+ function trim_0(_this__u8e3s4, chars) {
15663
+ // Inline function 'kotlin.text.trim' call
15664
+ // Inline function 'kotlin.text.trim' call
15665
+ var this_0 = isCharSequence(_this__u8e3s4) ? _this__u8e3s4 : THROW_CCE();
15666
+ var startIndex = 0;
15667
+ var endIndex = charSequenceLength(this_0) - 1 | 0;
15668
+ var startFound = false;
15669
+ $l$loop: while (startIndex <= endIndex) {
15670
+ var index = !startFound ? startIndex : endIndex;
15671
+ var it = charSequenceGet(this_0, index);
15672
+ var match = contains_0(chars, it);
15673
+ if (!startFound) {
15674
+ if (!match)
15675
+ startFound = true;
15676
+ else
15677
+ startIndex = startIndex + 1 | 0;
15678
+ } else {
15679
+ if (!match)
15680
+ break $l$loop;
15681
+ else
15682
+ endIndex = endIndex - 1 | 0;
15683
+ }
15684
+ }
15685
+ var tmp$ret$1 = charSequenceSubSequence(this_0, startIndex, endIndex + 1 | 0);
15686
+ return toString_1(tmp$ret$1);
15687
+ }
15644
15688
  function iterator$1($this_iterator) {
15645
15689
  this.zp_1 = $this_iterator;
15646
15690
  CharIterator.call(this);
@@ -19786,6 +19830,7 @@ export {
19786
19830
  mapNotNull as mapNotNull3b8ce5hky4k2l,
19787
19831
  map as mapsbvh18eqox7a,
19788
19832
  sequence as sequence2vgswtrxvqoa7,
19833
+ CharacterCodingException as CharacterCodingException3mvgnmpleqbz9,
19789
19834
  asIterable_0 as asIterable3syp9x858o4em,
19790
19835
  concatToString as concatToString2syawgu50khxi,
19791
19836
  concatToString_0 as concatToString3cxf0c1gqonpo,
@@ -19798,6 +19843,7 @@ export {
19798
19843
  endsWith as endsWith3cq61xxngobwh,
19799
19844
  equals_0 as equals2v6cggk171b6e,
19800
19845
  first_1 as first3kg261hmihapu,
19846
+ getOrNull_0 as getOrNull1cdnsfrisdp41,
19801
19847
  hexToByteArray as hexToByteArrayj26yk4970vc7,
19802
19848
  indexOfAny as indexOfAny2ijjuuzpljsyd,
19803
19849
  indexOf_6 as indexOfwa4w6635jewi,
@@ -19805,14 +19851,17 @@ export {
19805
19851
  isBlank as isBlank1dvkhjjvox3p0,
19806
19852
  isDigit as isDigit3mimrri4wkzop,
19807
19853
  isHighSurrogate as isHighSurrogate11jfjw70ar0zf,
19854
+ isLetterOrDigit as isLetterOrDigit2kuxd9e198haf,
19808
19855
  isLowSurrogate as isLowSurrogateujxcv7hjn4ma,
19809
19856
  isSurrogate as isSurrogatewe8xicw8z84n,
19810
19857
  isWhitespace as isWhitespace25occ8z1ed1s9,
19811
19858
  get_lastIndex_3 as get_lastIndexld83bqhfgcdd,
19859
+ lastIndexOf_1 as lastIndexOfpmd3ei5son2n,
19812
19860
  lastIndexOf_0 as lastIndexOf2d52xhix5ymjr,
19813
19861
  last_1 as last2n4gf5az1lkn4,
19814
19862
  padEnd as padEnd2jv3jyj2267cs,
19815
19863
  padStart as padStart36w1507hs626a,
19864
+ removePrefix as removePrefix279df90bhrqqg,
19816
19865
  removeSuffix as removeSuffix3d61x5lsuvuho,
19817
19866
  removeSurrounding as removeSurroundingtenczfhnh0cp,
19818
19867
  replace as replace3le3ie7l9k8aq,
@@ -19839,6 +19888,7 @@ export {
19839
19888
  toDoubleOrNull as toDoubleOrNullkxwozihadygj,
19840
19889
  toDouble as toDouble1kn912gjoizjp,
19841
19890
  toHexString as toHexString5bhtjxqec7ow,
19891
+ toIntOrNull_0 as toIntOrNull1j8dcc6to13o4,
19842
19892
  toIntOrNull as toIntOrNull3w2d066r9pvwm,
19843
19893
  toInt as toInt2q8uldh7sc951,
19844
19894
  toLongOrNull as toLongOrNullutqivezb0wx1,
@@ -19855,6 +19905,7 @@ export {
19855
19905
  trimMargin as trimMarginhyd3fsmh8iev,
19856
19906
  trimStart_0 as trimStart5ewg8zf6cs5u,
19857
19907
  trimStart as trimStart1mkod6gyztuyy,
19908
+ trim_0 as trim6jpmwojjgb3l,
19858
19909
  trim as trim11nh7r46at6sx,
19859
19910
  zip_0 as zipaz5cve5d6gip,
19860
19911
  Duration as Duration5ynfiptaqcrg,