@skinpricer/sdk 0.4.0 → 0.5.0

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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @skinpricer/sdk
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Breaking changes
6
+
7
+ - `ExecutionAdjustedBestPrice.appliedFeeBps` and `withdrawalFlatUsdCents` can be `null`.
8
+ - Typed fixtures for aggregations, market analytics, recommendations, freshness and latency status, and the bulk liquidity map need the new camelCase fields.
9
+ - Earlier SDK versions stop working for NBBO lookups by name on 2027-01-15, when the API rejects `market_hash_name`. Upgrade before then.
10
+
11
+ ### Minor Changes
12
+
13
+ - 8364e62: - Add the camelCase name beside every snake_case response field on aggregations, market analytics, recommendations, freshness and latency status, and the bulk liquidity map, for example `marketHashName` beside `market_hash_name` and `updatedAt` beside `updated_at`. The snake_case fields are marked `@deprecated`. The API stops sending them on 2027-01-15, so switch reads to the camelCase names before then. Typed fixtures for these responses need the camelCase fields.
14
+ - `nbbo.get()` and `nbbo.depth()` send `marketHashName` instead of the deprecated `market_hash_name` query parameter, which the API rejects with a 400 error from 2027-01-15. Earlier SDK versions stop working for NBBO lookups by name on that date.
15
+ - `ValidationError.messages` lists the rejected fields and parameters from the error body's `details`, and the error message includes them. Errors take `requestId` from the response body when the `X-Request-Id` header is missing.
16
+ - Add the price-meaning fields: `priceKind` and `purchasable` on quotes and best prices, `valueKind` on bids, `sellBasis` on market analytics and sell-offer history series, `priceKind` on history responses and aggregates, `suggestedPriceKind` on recommendations, and `feeStatus` and `feeModelVersion` on execution-adjusted NBBO quotes. New exported types: `QuotePriceKind`, `ValueKind`, `SellBasis`, `FeeStatus` and `HistoryPriceKind`.
17
+ - `ExecutionAdjustedBestPrice.appliedFeeBps` and `withdrawalFlatUsdCents` can be `null` when the fees are unknown. Handle null before calculating with them.
18
+ - 038b323: Add `bestMarketToListPayout` to `LiquidityResponse`, `LiquiditySummaryResponse` and `LiquidityBulkItem`, plus the `LiquidityPayout` type. It says what `bestMarketToList` pays the seller: `cash`, `wallet`, `bot_rate` or `unknown`, and is null exactly when `bestMarketToList` is null. `wallet` means Steam Community Market, which pays Steam Wallet funds that cannot be withdrawn. Check it before treating the best market as a cash exit.
19
+
20
+ ### Patch Changes
21
+
22
+ - 9253aff: Document the `candidateLimit` range of `arbitrage.opportunities()` as 50–1000. The API rejects values above 1000 with a 400 error.
23
+
3
24
  ## 0.4.0
4
25
 
5
26
  ### Breaking changes
package/README.md CHANGED
@@ -210,6 +210,12 @@ const client = new SkinpricerClient({
210
210
  | `client.schema` | `snapshot`, `get`, `changes`, `changesEach` |
211
211
  | `client.prices` | `latestAll` |
212
212
 
213
+ Aggregations, market analytics, recommendations, freshness/latency status and the
214
+ bulk liquidity map return each field in camelCase (`marketHashName`, `updatedAt`)
215
+ beside a snake_case alias (`market_hash_name`, `updated_at`). The aliases are
216
+ marked `@deprecated`; the API stops sending them on 2027-01-15, so read the
217
+ camelCase names.
218
+
213
219
  Every method accepts an optional trailing `RequestOptions` (`{ signal, timeoutMs, retry }`).
214
220
 
215
221
  ## Error handling
@@ -240,6 +246,10 @@ try {
240
246
  }
241
247
  ```
242
248
 
249
+ A `ValidationError` (400) lists each rejected field or parameter in `messages`.
250
+ Errors from an API response carry its `requestId`; include it when you report a
251
+ problem.
252
+
243
253
  ## Rate-limit metadata
244
254
 
245
255
  Methods return the response data directly. Rate-limit headers and status are attached as
package/dist/index.cjs CHANGED
@@ -274,7 +274,7 @@ var NbboResource = class extends BaseResource {
274
274
  path: "/nbbo",
275
275
  query: {
276
276
  id: params.id,
277
- market_hash_name: params.marketHashName,
277
+ marketHashName: params.marketHashName,
278
278
  markets: params.markets
279
279
  }
280
280
  },
@@ -289,7 +289,7 @@ var NbboResource = class extends BaseResource {
289
289
  path: "/nbbo/depth",
290
290
  query: {
291
291
  id: params.id,
292
- market_hash_name: params.marketHashName,
292
+ marketHashName: params.marketHashName,
293
293
  markets: params.markets,
294
294
  depth: params.depth
295
295
  }
@@ -395,7 +395,7 @@ var GameClient = class {
395
395
  };
396
396
 
397
397
  // src/version.ts
398
- var VERSION = "0.4.0";
398
+ var VERSION = "0.5.0";
399
399
 
400
400
  // src/config.ts
401
401
  var DEFAULT_BASE_URL = "https://pricing.skinpricer.com/v1";
@@ -566,6 +566,16 @@ function extractErrorFields(body, status) {
566
566
  const message = typeof err.message === "string" ? err.message : defaultMessage(status);
567
567
  const result = { message };
568
568
  if (typeof err.code === "string") result.code = err.code;
569
+ if (Array.isArray(err.details)) {
570
+ const messages = err.details.filter(
571
+ (entry) => typeof entry === "string"
572
+ );
573
+ if (messages.length > 0) {
574
+ result.message = `${message}: ${messages.join(", ")}`;
575
+ result.messages = messages;
576
+ }
577
+ }
578
+ if (typeof body.requestId === "string") result.requestId = body.requestId;
569
579
  return result;
570
580
  }
571
581
  const rawMessage = body.message;
@@ -595,11 +605,14 @@ function looksLikeFeatureError(message) {
595
605
  }
596
606
  function errorFromResponse(input) {
597
607
  const { status, body, meta } = input;
598
- const { code, message, messages } = extractErrorFields(body, status);
608
+ const { code, message, messages, requestId } = extractErrorFields(
609
+ body,
610
+ status
611
+ );
599
612
  const base = {
600
613
  status,
601
614
  code,
602
- requestId: meta.requestId,
615
+ requestId: meta.requestId ?? requestId ?? null,
603
616
  responseBody: body,
604
617
  rateLimit: meta.rateLimit
605
618
  };