@skinpricer/sdk 0.3.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/dist/index.js CHANGED
@@ -33,8 +33,367 @@ var ConfigurationError = class extends SkinpricerError {
33
33
  var ParseError = class extends SkinpricerError {
34
34
  };
35
35
 
36
+ // src/utils/url.ts
37
+ function encodePathSegment(segment) {
38
+ return encodeURIComponent(segment);
39
+ }
40
+ function joinUrl(baseUrl, path) {
41
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
42
+ return `${baseUrl}${normalizedPath}`;
43
+ }
44
+
45
+ // src/meta.ts
46
+ var RESPONSE_META = /* @__PURE__ */ Symbol("skinpricer.responseMeta");
47
+ function attachMeta(data, meta) {
48
+ if (data !== null && typeof data === "object") {
49
+ Object.defineProperty(data, RESPONSE_META, {
50
+ value: meta,
51
+ enumerable: false,
52
+ writable: false,
53
+ configurable: true
54
+ });
55
+ }
56
+ return data;
57
+ }
58
+ function getMeta(value) {
59
+ if (value !== null && typeof value === "object") {
60
+ return value[RESPONSE_META];
61
+ }
62
+ return void 0;
63
+ }
64
+
65
+ // src/resources/resource.ts
66
+ function assertPathSegments(path) {
67
+ const segments = path.split("/").slice(1);
68
+ if (segments.some(
69
+ (segment) => segment === "" || segment === "." || segment === ".."
70
+ )) {
71
+ throw new ConfigurationError(
72
+ `Path segments cannot be empty, "." or "..": "${path}"`
73
+ );
74
+ }
75
+ }
76
+ var BaseResource = class {
77
+ constructor(http, game) {
78
+ this.http = http;
79
+ this.game = game;
80
+ }
81
+ http;
82
+ game;
83
+ /** Performs a request and returns the data with {@link ResponseMeta} attached. */
84
+ async call(input, options) {
85
+ assertPathSegments(input.path);
86
+ const scoped = this.game === void 0 ? input : {
87
+ ...input,
88
+ baseUrl: this.http.versionedBaseUrl("v2", input.baseUrl),
89
+ query: { ...input.query, game: this.game }
90
+ };
91
+ const { data, meta } = await this.http.request(scoped, options);
92
+ return attachMeta(data, meta);
93
+ }
94
+ };
95
+
96
+ // src/resources/history.ts
97
+ function historyQuery(params) {
98
+ return {
99
+ from: params.from,
100
+ to: params.to,
101
+ markets: params.markets,
102
+ listingType: params.listingType,
103
+ salesWindow: params.salesWindow,
104
+ interval: params.interval
105
+ };
106
+ }
107
+ var HistoryResource = class extends BaseResource {
108
+ /** `GET /v1/pricing/:marketHashName/history` — aggregated time series. */
109
+ get(marketHashName, params = {}, options) {
110
+ return this.call(
111
+ {
112
+ method: "GET",
113
+ path: `/pricing/${encodePathSegment(marketHashName)}/history`,
114
+ query: historyQuery(params)
115
+ },
116
+ options
117
+ );
118
+ }
119
+ /** `GET /v1/pricing/:marketHashName/history/markets` — per-market series. */
120
+ byMarket(marketHashName, params = {}, options) {
121
+ return this.call(
122
+ {
123
+ method: "GET",
124
+ path: `/pricing/${encodePathSegment(marketHashName)}/history/markets`,
125
+ query: historyQuery(params)
126
+ },
127
+ options
128
+ );
129
+ }
130
+ };
131
+
132
+ // src/resources/items.ts
133
+ var ItemSearchResource = class extends BaseResource {
134
+ /** GET /v1/items — paginated item search with current pricing. */
135
+ search(params = {}, options) {
136
+ return this.call(
137
+ {
138
+ method: "GET",
139
+ path: "/items",
140
+ query: {
141
+ search: params.search,
142
+ markets: params.markets,
143
+ page: params.page,
144
+ perPage: params.perPage
145
+ }
146
+ },
147
+ options
148
+ );
149
+ }
150
+ /** Async iterator over every matching item, walking pages. */
151
+ async *searchEach(params = {}, options) {
152
+ let page = params.page ?? 1;
153
+ for (; ; ) {
154
+ const res = await this.search({ ...params, page }, options);
155
+ for (const item of res.data) {
156
+ yield item;
157
+ }
158
+ const next = res.pagination.nextPage;
159
+ if (next === null || next <= page) return;
160
+ page = next;
161
+ }
162
+ }
163
+ };
164
+ var ItemsResource = class extends ItemSearchResource {
165
+ /** GET /v1/items/all — every tracked item with latest prices (capped, unpaginated). */
166
+ all(options) {
167
+ return this.call(
168
+ { method: "GET", path: "/items/all" },
169
+ options
170
+ );
171
+ }
172
+ };
173
+
174
+ // src/resources/liquidity.ts
175
+ var ItemLiquidityResource = class extends BaseResource {
176
+ /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
177
+ get(marketHashName, params = {}, options) {
178
+ return this.call(
179
+ {
180
+ method: "GET",
181
+ path: `/liquidity/${encodePathSegment(marketHashName)}`,
182
+ query: { askPrice: params.askPrice, market: params.market }
183
+ },
184
+ options
185
+ );
186
+ }
187
+ /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
188
+ summary(marketHashName, params = {}, options) {
189
+ return this.call(
190
+ {
191
+ method: "GET",
192
+ path: `/liquidity/summary/${encodePathSegment(marketHashName)}`,
193
+ query: { askPrice: params.askPrice, market: params.market }
194
+ },
195
+ options
196
+ );
197
+ }
198
+ /** `POST /v1/liquidity/batch` — score up to 100 items in one call. */
199
+ batch(body, options) {
200
+ return this.call(
201
+ {
202
+ method: "POST",
203
+ path: "/liquidity/batch",
204
+ body: { marketHashNames: body.marketHashNames, market: body.market }
205
+ },
206
+ options
207
+ );
208
+ }
209
+ };
210
+ var LiquidityResource = class extends ItemLiquidityResource {
211
+ /** `GET /v1/liquidity/:marketHashName`. `"items"` is reserved for {@link bulk}. */
212
+ get(marketHashName, params = {}, options) {
213
+ if (marketHashName === "items") {
214
+ return Promise.reject(
215
+ new ConfigurationError(
216
+ '"items" is not an item name. Use `bulk()` for the whole-catalog map.'
217
+ )
218
+ );
219
+ }
220
+ return super.get(marketHashName, params, options);
221
+ }
222
+ bulk(params = {}, options) {
223
+ return this.call(
224
+ {
225
+ method: "GET",
226
+ path: "/liquidity/items",
227
+ ifNoneMatch: params.ifNoneMatch
228
+ },
229
+ options
230
+ );
231
+ }
232
+ manifest(params = {}, options) {
233
+ return this.call(
234
+ {
235
+ method: "GET",
236
+ path: "/liquidity/items/manifest",
237
+ ifNoneMatch: params.ifNoneMatch
238
+ },
239
+ options
240
+ );
241
+ }
242
+ };
243
+
244
+ // src/resources/markets.ts
245
+ var MarketsResource = class extends BaseResource {
246
+ /**
247
+ * `GET /v1/markets/health` — per-market ingest status, last event time, and
248
+ * listing counts for every integrated market. Returns a plain array of
249
+ * {@link import("../types/markets").MarketHealthRow}.
250
+ */
251
+ health(options) {
252
+ return this.call(
253
+ // Keyless: served by the public `api.` host, not the pricing base.
254
+ {
255
+ method: "GET",
256
+ authenticated: false,
257
+ path: "/markets/health",
258
+ baseUrl: this.http.publicBaseUrl
259
+ },
260
+ options
261
+ );
262
+ }
263
+ };
264
+
265
+ // src/resources/nbbo.ts
266
+ var NbboResource = class extends BaseResource {
267
+ /** `GET /v1/nbbo` — best bid/ask across markets. Pass `id` or `marketHashName`. */
268
+ get(params, options) {
269
+ return this.call(
270
+ {
271
+ method: "GET",
272
+ path: "/nbbo",
273
+ query: {
274
+ id: params.id,
275
+ marketHashName: params.marketHashName,
276
+ markets: params.markets
277
+ }
278
+ },
279
+ options
280
+ );
281
+ }
282
+ /** `GET /v1/nbbo/depth` — aggregated order-book depth per side. */
283
+ depth(params, options) {
284
+ return this.call(
285
+ {
286
+ method: "GET",
287
+ path: "/nbbo/depth",
288
+ query: {
289
+ id: params.id,
290
+ marketHashName: params.marketHashName,
291
+ markets: params.markets,
292
+ depth: params.depth
293
+ }
294
+ },
295
+ options
296
+ );
297
+ }
298
+ };
299
+
300
+ // src/resources/pricing.ts
301
+ var PricingResource = class extends BaseResource {
302
+ /** `GET /v1/pricing/:marketHashName` — full cross-market pricing snapshot. */
303
+ get(marketHashName, params = {}, options) {
304
+ return this.call(
305
+ {
306
+ method: "GET",
307
+ path: `/pricing/${encodePathSegment(marketHashName)}`,
308
+ query: { markets: params.markets }
309
+ },
310
+ options
311
+ );
312
+ }
313
+ /** `GET /v1/pricing/:marketHashName/listings` — individual listing samples. */
314
+ listings(marketHashName, params = {}, options) {
315
+ return this.call(
316
+ {
317
+ method: "GET",
318
+ path: `/pricing/${encodePathSegment(marketHashName)}/listings`,
319
+ query: { limit: params.limit, markets: params.markets }
320
+ },
321
+ options
322
+ );
323
+ }
324
+ };
325
+
326
+ // src/resources/schema.ts
327
+ var SchemaResource = class extends BaseResource {
328
+ /** Full catalog snapshot. A matching conditional ETag returns null. */
329
+ snapshot(params = {}, options) {
330
+ return this.call(
331
+ { method: "GET", path: "/schema", ifNoneMatch: params.ifNoneMatch },
332
+ options
333
+ );
334
+ }
335
+ /** Look up one item by canonical id or exact name; v2 also accepts its game-scoped slug. */
336
+ get(idOrName, options) {
337
+ return this.call(
338
+ { method: "GET", path: `/schema/items/${encodePathSegment(idOrName)}` },
339
+ options
340
+ );
341
+ }
342
+ /** One page of items changed after a catalog version or timestamp. */
343
+ changes(params, options) {
344
+ return this.call(
345
+ {
346
+ method: "GET",
347
+ path: "/schema/changes",
348
+ query: {
349
+ since: params.since,
350
+ cursor: params.cursor,
351
+ limit: params.limit
352
+ }
353
+ },
354
+ options
355
+ );
356
+ }
357
+ /** Iterate changes without moving the original version boundary while paging. */
358
+ async *changesEach(params, options) {
359
+ let cursor = params.cursor;
360
+ for (; ; ) {
361
+ const response = await this.changes({ ...params, cursor }, options);
362
+ for (const item of response.items) yield item;
363
+ const next = response.nextCursor;
364
+ if (!response.hasMore || next === null || next === cursor) return;
365
+ cursor = next;
366
+ }
367
+ }
368
+ };
369
+
370
+ // src/game-client.ts
371
+ var GameClient = class {
372
+ constructor(http, game) {
373
+ this.game = game;
374
+ if (game !== "cs2" && game !== "rust") {
375
+ throw new ConfigurationError('The game must be "cs2" or "rust".');
376
+ }
377
+ this.pricing = new PricingResource(http, game);
378
+ this.history = new HistoryResource(http, game);
379
+ this.items = new ItemSearchResource(http, game);
380
+ this.nbbo = new NbboResource(http, game);
381
+ this.liquidity = new ItemLiquidityResource(http, game);
382
+ this.schema = new SchemaResource(http, game);
383
+ this.markets = new MarketsResource(http, game);
384
+ }
385
+ game;
386
+ pricing;
387
+ history;
388
+ items;
389
+ nbbo;
390
+ liquidity;
391
+ schema;
392
+ markets;
393
+ };
394
+
36
395
  // src/version.ts
37
- var VERSION = "0.3.0";
396
+ var VERSION = "0.5.0";
38
397
 
39
398
  // src/config.ts
40
399
  var DEFAULT_BASE_URL = "https://pricing.skinpricer.com/v1";
@@ -205,6 +564,16 @@ function extractErrorFields(body, status) {
205
564
  const message = typeof err.message === "string" ? err.message : defaultMessage(status);
206
565
  const result = { message };
207
566
  if (typeof err.code === "string") result.code = err.code;
567
+ if (Array.isArray(err.details)) {
568
+ const messages = err.details.filter(
569
+ (entry) => typeof entry === "string"
570
+ );
571
+ if (messages.length > 0) {
572
+ result.message = `${message}: ${messages.join(", ")}`;
573
+ result.messages = messages;
574
+ }
575
+ }
576
+ if (typeof body.requestId === "string") result.requestId = body.requestId;
208
577
  return result;
209
578
  }
210
579
  const rawMessage = body.message;
@@ -234,11 +603,14 @@ function looksLikeFeatureError(message) {
234
603
  }
235
604
  function errorFromResponse(input) {
236
605
  const { status, body, meta } = input;
237
- const { code, message, messages } = extractErrorFields(body, status);
606
+ const { code, message, messages, requestId } = extractErrorFields(
607
+ body,
608
+ status
609
+ );
238
610
  const base = {
239
611
  status,
240
612
  code,
241
- requestId: meta.requestId,
613
+ requestId: meta.requestId ?? requestId ?? null,
242
614
  responseBody: body,
243
615
  rateLimit: meta.rateLimit
244
616
  };
@@ -302,8 +674,10 @@ function tryJsonParse(text) {
302
674
  return void 0;
303
675
  }
304
676
  }
305
- async function parseResponse(response) {
677
+ async function parseResponse(response, allowNotModified = false) {
306
678
  const meta = buildMeta(response);
679
+ if (allowNotModified && response.status === 304)
680
+ return { data: null, meta };
307
681
  const text = await response.text();
308
682
  if (response.ok) {
309
683
  if (text.length === 0) {
@@ -326,15 +700,6 @@ async function parseResponse(response) {
326
700
  throw errorFromResponse({ status: response.status, body, meta });
327
701
  }
328
702
 
329
- // src/utils/url.ts
330
- function encodePathSegment(segment) {
331
- return encodeURIComponent(segment);
332
- }
333
- function joinUrl(baseUrl, path) {
334
- const normalizedPath = path.startsWith("/") ? path : `/${path}`;
335
- return `${baseUrl}${normalizedPath}`;
336
- }
337
-
338
703
  // src/http/query.ts
339
704
  function serializeQuery(params) {
340
705
  const search = new URLSearchParams();
@@ -363,14 +728,21 @@ function buildRequest(config, input) {
363
728
  Accept: "application/json",
364
729
  "User-Agent": config.userAgent,
365
730
  "X-Skinpricer-Client": config.userAgent,
366
- ...config.headers
731
+ ...Object.fromEntries(
732
+ Object.entries(config.headers).filter(
733
+ ([name]) => name.toLowerCase() !== "authorization"
734
+ )
735
+ )
367
736
  };
368
737
  let body;
369
738
  if (input.body !== void 0) {
370
739
  body = JSON.stringify(input.body);
371
740
  headers["Content-Type"] = "application/json";
372
741
  }
373
- headers["Authorization"] = `${config.authScheme} ${config.apiKey}`;
742
+ if (input.authenticated !== false)
743
+ headers["Authorization"] = `${config.authScheme} ${config.apiKey}`;
744
+ if (input.ifNoneMatch !== void 0)
745
+ headers["If-None-Match"] = input.ifNoneMatch;
374
746
  const prepared = { url, method: input.method, headers };
375
747
  if (body !== void 0) prepared.body = body;
376
748
  return prepared;
@@ -457,6 +829,12 @@ var HttpClient = class {
457
829
  get publicBaseUrl() {
458
830
  return this.config.publicBaseUrl;
459
831
  }
832
+ /** Selects an API version while retaining a configured gateway prefix. */
833
+ versionedBaseUrl(version, baseUrl = this.config.baseUrl) {
834
+ const url = new URL(baseUrl);
835
+ url.pathname = /\/v[0-9]+$/.test(url.pathname) ? url.pathname.replace(/\/v[0-9]+$/, `/${version}`) : `${url.pathname.replace(/\/$/, "")}/${version}`;
836
+ return url.toString().replace(/\/$/, "");
837
+ }
460
838
  async request(input, options = {}) {
461
839
  const prepared = buildRequest(this.config, input);
462
840
  const retry = resolveRequestRetry(this.config.retry, options.retry);
@@ -472,46 +850,18 @@ var HttpClient = class {
472
850
  url: prepared.url,
473
851
  attempt
474
852
  });
475
- let response;
476
853
  try {
477
- response = await this.config.fetch(prepared.url, {
854
+ const response = await this.config.fetch(prepared.url, {
478
855
  method: prepared.method,
479
856
  headers: prepared.headers,
480
857
  body: prepared.body,
481
858
  signal: handle.signal
482
859
  });
483
- } catch (error) {
860
+ const parsed = await parseResponse(
861
+ response,
862
+ input.ifNoneMatch !== void 0
863
+ );
484
864
  handle.cleanup();
485
- if (callerSignal?.aborted && !handle.didTimeout()) {
486
- throw abortError(callerSignal);
487
- }
488
- if (retry && shouldRetry({ method: input.method, attempt, retry, status: null })) {
489
- const delayMs = retryDelayMs({
490
- attempt,
491
- retry,
492
- retryAfterSeconds: null
493
- });
494
- await runHook(hooks.onRetry, {
495
- method: input.method,
496
- url: prepared.url,
497
- attempt,
498
- delayMs,
499
- status: null
500
- });
501
- await sleep(delayMs, callerSignal);
502
- attempt += 1;
503
- continue;
504
- }
505
- if (handle.didTimeout()) {
506
- throw new TimeoutError(`Request timed out after ${timeoutMs}ms`, {
507
- cause: error
508
- });
509
- }
510
- throw new NetworkError(networkMessage(error), { cause: error });
511
- }
512
- handle.cleanup();
513
- try {
514
- const parsed = await parseResponse(response);
515
865
  this.recordRateLimit(parsed.meta.rateLimit);
516
866
  await runHook(hooks.onResponse, {
517
867
  method: input.method,
@@ -522,30 +872,32 @@ var HttpClient = class {
522
872
  });
523
873
  return parsed;
524
874
  } catch (error) {
525
- if (error instanceof RateLimitError) {
526
- this.recordRateLimit(error.rateLimit, error.retryAfterSeconds);
875
+ handle.cleanup();
876
+ if (callerSignal?.aborted && !handle.didTimeout())
877
+ throw abortError(callerSignal);
878
+ const failure = handle.didTimeout() ? new TimeoutError(`Request timed out after ${timeoutMs}ms`, {
879
+ cause: error
880
+ }) : error instanceof SkinpricerError ? error : new NetworkError(networkMessage(error), { cause: error });
881
+ if (failure instanceof RateLimitError) {
882
+ this.recordRateLimit(failure.rateLimit, failure.retryAfterSeconds);
527
883
  }
528
- if (error instanceof SkinpricerError && error.status !== void 0 && retry && shouldRetry({
529
- method: input.method,
530
- attempt,
531
- retry,
532
- status: error.status
533
- })) {
534
- const retryAfterSeconds = error instanceof RateLimitError ? error.retryAfterSeconds : error.rateLimit?.retryAfterSeconds ?? null;
884
+ const status = failure.status ?? null;
885
+ if (retry && shouldRetry({ method: input.method, attempt, retry, status })) {
886
+ const retryAfterSeconds = failure instanceof RateLimitError ? failure.retryAfterSeconds : failure.rateLimit?.retryAfterSeconds ?? null;
535
887
  const delayMs = retryDelayMs({ attempt, retry, retryAfterSeconds });
536
888
  await runHook(hooks.onRetry, {
537
889
  method: input.method,
538
890
  url: prepared.url,
539
891
  attempt,
540
892
  delayMs,
541
- status: error.status,
542
- error
893
+ status,
894
+ error: failure
543
895
  });
544
896
  await sleep(delayMs, callerSignal);
545
897
  attempt += 1;
546
898
  continue;
547
899
  }
548
- throw error;
900
+ throw failure;
549
901
  }
550
902
  }
551
903
  }
@@ -591,39 +943,6 @@ async function mapWithConcurrency(items, limit, fn) {
591
943
  return results;
592
944
  }
593
945
 
594
- // src/meta.ts
595
- var RESPONSE_META = /* @__PURE__ */ Symbol("skinpricer.responseMeta");
596
- function attachMeta(data, meta) {
597
- if (data !== null && typeof data === "object") {
598
- Object.defineProperty(data, RESPONSE_META, {
599
- value: meta,
600
- enumerable: false,
601
- writable: false,
602
- configurable: true
603
- });
604
- }
605
- return data;
606
- }
607
- function getMeta(value) {
608
- if (value !== null && typeof value === "object") {
609
- return value[RESPONSE_META];
610
- }
611
- return void 0;
612
- }
613
-
614
- // src/resources/resource.ts
615
- var BaseResource = class {
616
- constructor(http) {
617
- this.http = http;
618
- }
619
- http;
620
- /** Performs a request and returns the data with {@link ResponseMeta} attached. */
621
- async call(input, options) {
622
- const { data, meta } = await this.http.request(input, options);
623
- return attachMeta(data, meta);
624
- }
625
- };
626
-
627
946
  // src/resources/aggregations.ts
628
947
  var MAX_IDS_PER_REQUEST = 100;
629
948
  var DEFAULT_BATCH_CONCURRENCY = 5;
@@ -826,141 +1145,6 @@ var Buff163Resource = class extends BaseResource {
826
1145
  }
827
1146
  };
828
1147
 
829
- // src/resources/history.ts
830
- function historyQuery(params) {
831
- return {
832
- from: params.from,
833
- to: params.to,
834
- markets: params.markets,
835
- listingType: params.listingType,
836
- salesWindow: params.salesWindow,
837
- interval: params.interval
838
- };
839
- }
840
- var HistoryResource = class extends BaseResource {
841
- /** `GET /v1/pricing/:marketHashName/history` — aggregated time series. */
842
- get(marketHashName, params = {}, options) {
843
- return this.call(
844
- {
845
- method: "GET",
846
- path: `/pricing/${encodePathSegment(marketHashName)}/history`,
847
- query: historyQuery(params)
848
- },
849
- options
850
- );
851
- }
852
- /** `GET /v1/pricing/:marketHashName/history/markets` — per-market series. */
853
- byMarket(marketHashName, params = {}, options) {
854
- return this.call(
855
- {
856
- method: "GET",
857
- path: `/pricing/${encodePathSegment(marketHashName)}/history/markets`,
858
- query: historyQuery(params)
859
- },
860
- options
861
- );
862
- }
863
- };
864
-
865
- // src/resources/items.ts
866
- var ItemsResource = class extends BaseResource {
867
- /** GET /v1/items — paginated item search with current pricing. */
868
- search(params = {}, options) {
869
- return this.call(
870
- {
871
- method: "GET",
872
- path: "/items",
873
- query: {
874
- search: params.search,
875
- markets: params.markets,
876
- page: params.page,
877
- perPage: params.perPage
878
- }
879
- },
880
- options
881
- );
882
- }
883
- /** GET /v1/items/all — every tracked item with latest prices (capped, unpaginated). */
884
- all(options) {
885
- return this.call(
886
- { method: "GET", path: "/items/all" },
887
- options
888
- );
889
- }
890
- /** Async iterator over every matching item, walking pages. */
891
- async *searchEach(params = {}, options) {
892
- let page = params.page ?? 1;
893
- for (; ; ) {
894
- const res = await this.search({ ...params, page }, options);
895
- for (const item of res.data) {
896
- yield item;
897
- }
898
- const next = res.pagination.nextPage;
899
- if (next === null || next <= page) return;
900
- page = next;
901
- }
902
- }
903
- };
904
-
905
- // src/resources/liquidity.ts
906
- var LiquidityResource = class extends BaseResource {
907
- /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
908
- get(marketHashName, params = {}, options) {
909
- return this.call(
910
- {
911
- method: "GET",
912
- path: `/liquidity/${encodePathSegment(marketHashName)}`,
913
- query: { askPrice: params.askPrice, market: params.market }
914
- },
915
- options
916
- );
917
- }
918
- /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
919
- summary(marketHashName, params = {}, options) {
920
- return this.call(
921
- {
922
- method: "GET",
923
- path: `/liquidity/summary/${encodePathSegment(marketHashName)}`,
924
- query: { askPrice: params.askPrice, market: params.market }
925
- },
926
- options
927
- );
928
- }
929
- /** `POST /v1/liquidity/batch` — score up to 100 items in one call. */
930
- batch(body, options) {
931
- return this.call(
932
- {
933
- method: "POST",
934
- path: "/liquidity/batch",
935
- body: { marketHashNames: body.marketHashNames, market: body.market }
936
- },
937
- options
938
- );
939
- }
940
- /**
941
- * `GET /v1/liquidity/items` — Enterprise: the whole-catalog liquidity map,
942
- * rematerialized every ~10 minutes. Poll {@link manifest} and compare
943
- * `version` before refetching this heavier payload.
944
- */
945
- bulk(options) {
946
- return this.call(
947
- { method: "GET", path: "/liquidity/items" },
948
- options
949
- );
950
- }
951
- /**
952
- * `GET /v1/liquidity/items/manifest` — Enterprise: a cheap change-probe for
953
- * the {@link bulk} map (`version`, `calculatedAt`, `cadence`, `markets`,
954
- * `itemCount`). Refetch the bulk map only when `version` changes.
955
- */
956
- manifest(options) {
957
- return this.call(
958
- { method: "GET", path: "/liquidity/items/manifest" },
959
- options
960
- );
961
- }
962
- };
963
-
964
1148
  // src/resources/market-analytics.ts
965
1149
  var MarketAnalyticsResource = class extends BaseResource {
966
1150
  /** `GET /v1/market-analytics/:marketHashName` — per-market analytics rows. */
@@ -976,77 +1160,16 @@ var MarketAnalyticsResource = class extends BaseResource {
976
1160
  }
977
1161
  };
978
1162
 
979
- // src/resources/markets.ts
980
- var MarketsResource = class extends BaseResource {
981
- /**
982
- * `GET /v1/markets/health` — per-market ingest status, last event time, and
983
- * listing counts for every integrated market. Returns a plain array of
984
- * {@link import("../types/markets").MarketHealthRow}.
985
- */
986
- health(options) {
987
- return this.call(
988
- // Keyless: served by the public `api.` host, not the pricing base.
989
- { method: "GET", path: "/markets/health", baseUrl: this.http.publicBaseUrl },
990
- options
991
- );
992
- }
993
- };
994
-
995
- // src/resources/nbbo.ts
996
- var NbboResource = class extends BaseResource {
997
- /** `GET /v1/nbbo` — best bid/ask across markets. Pass `id` or `marketHashName`. */
998
- get(params, options) {
999
- return this.call(
1000
- {
1001
- method: "GET",
1002
- path: "/nbbo",
1003
- query: {
1004
- id: params.id,
1005
- market_hash_name: params.marketHashName,
1006
- markets: params.markets
1007
- }
1008
- },
1009
- options
1010
- );
1011
- }
1012
- /** `GET /v1/nbbo/depth` — aggregated order-book depth per side. */
1013
- depth(params, options) {
1014
- return this.call(
1015
- {
1016
- method: "GET",
1017
- path: "/nbbo/depth",
1018
- query: {
1019
- id: params.id,
1020
- market_hash_name: params.marketHashName,
1021
- markets: params.markets,
1022
- depth: params.depth
1023
- }
1024
- },
1025
- options
1026
- );
1027
- }
1028
- };
1029
-
1030
- // src/resources/pricing.ts
1031
- var PricingResource = class extends BaseResource {
1032
- /** `GET /v1/pricing/:marketHashName` — full cross-market pricing snapshot. */
1033
- get(marketHashName, params = {}, options) {
1034
- return this.call(
1035
- {
1036
- method: "GET",
1037
- path: `/pricing/${encodePathSegment(marketHashName)}`,
1038
- query: { markets: params.markets }
1039
- },
1040
- options
1041
- );
1042
- }
1043
- /** `GET /v1/pricing/:marketHashName/listings` — individual listing samples. */
1044
- listings(marketHashName, params = {}, options) {
1163
+ // src/resources/prices.ts
1164
+ var PricesResource = class extends BaseResource {
1165
+ latestAll(params, options) {
1045
1166
  return this.call(
1046
1167
  {
1047
1168
  method: "GET",
1048
- path: `/pricing/${encodePathSegment(marketHashName)}/listings`,
1049
- query: { limit: params.limit, markets: params.markets }
1169
+ path: "/prices/latest",
1170
+ baseUrl: this.http.versionedBaseUrl("v2"),
1171
+ query: { game: params.game },
1172
+ ifNoneMatch: params.ifNoneMatch
1050
1173
  },
1051
1174
  options
1052
1175
  );
@@ -1101,6 +1224,12 @@ var SkinpricerClient = class {
1101
1224
  buff163;
1102
1225
  liquidity;
1103
1226
  markets;
1227
+ schema;
1228
+ prices;
1229
+ /** Access the v2 endpoints supported by the selected game. */
1230
+ forGame(game) {
1231
+ return new GameClient(this.httpClient, game);
1232
+ }
1104
1233
  httpClient;
1105
1234
  constructor(config) {
1106
1235
  this.httpClient = new HttpClient(resolveConfig(config));
@@ -1117,6 +1246,8 @@ var SkinpricerClient = class {
1117
1246
  this.buff163 = new Buff163Resource(this.httpClient);
1118
1247
  this.liquidity = new LiquidityResource(this.httpClient);
1119
1248
  this.markets = new MarketsResource(this.httpClient);
1249
+ this.schema = new SchemaResource(this.httpClient);
1250
+ this.prices = new PricesResource(this.httpClient);
1120
1251
  }
1121
1252
  };
1122
1253
 
@@ -1136,10 +1267,15 @@ var KNOWN_MARKETS = [
1136
1267
  "whitemarket",
1137
1268
  "waxpeer",
1138
1269
  "lootfarm",
1270
+ "rapidskins",
1139
1271
  "avanmarket",
1140
1272
  "tradeit-store",
1141
1273
  "tradeit-trade",
1142
- "steamcommunity"
1274
+ "steamcommunity",
1275
+ "youpin",
1276
+ "mannco-store",
1277
+ "rusttm",
1278
+ "rustskins"
1143
1279
  ];
1144
1280
  var ATTRIBUTE_MARKETS = [
1145
1281
  "buff163",
@@ -1157,7 +1293,8 @@ var LIQUIDITY_BADGES = [
1157
1293
  "ILLIQUID",
1158
1294
  "VERY_ILLIQUID",
1159
1295
  "EXTREMELY_ILLIQUID",
1160
- "UNTRADED"
1296
+ "UNTRADED",
1297
+ "INSUFFICIENT_DATA"
1161
1298
  ];
1162
1299
  var LIQUIDITY_CONFIDENCE = [
1163
1300
  "HIGH",
@@ -1178,9 +1315,10 @@ var SUPPORTED_LIQUIDITY_MARKETS = [
1178
1315
  "skinport",
1179
1316
  "marketcsgo",
1180
1317
  "dmarket",
1181
- "csdeals",
1318
+ "steamcommunity",
1182
1319
  "csfloat"
1183
1320
  ];
1321
+ var SUPPORTED_RUST_LIQUIDITY_MARKETS = ["rusttm", "skinport"];
1184
1322
 
1185
1323
  // src/utils/money.ts
1186
1324
  function centsToUsd(cents) {
@@ -1198,6 +1336,6 @@ function parseIsoDate(value) {
1198
1336
  return new Date(value);
1199
1337
  }
1200
1338
 
1201
- export { APIError, ATTRIBUTE_MARKETS, AggregationsResource, ArbitrageResource, AttributePricesResource, AuthenticationError, BaseResource, Buff163Resource, ConfigurationError, DEFAULT_BASE_URL, DEFAULT_PUBLIC_BASE_URL, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, FeatureNotAvailableError, HistoryResource, ItemsResource, KNOWN_MARKETS, LIQUIDITY_BADGES, LIQUIDITY_CONFIDENCE, LIQUIDITY_LABELS, LiquidityResource, MarketAnalyticsResource, MarketsResource, NbboResource, NetworkError, NotFoundError, ParseError, PermissionError, PricingResource, RESPONSE_META, RateLimitError, RecommendationsResource, SUPPORTED_LIQUIDITY_MARKETS, ServerError, SkinpricerClient, SkinpricerError, StatusResource, TimeoutError, VERSION, ValidationError, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };
1339
+ export { APIError, ATTRIBUTE_MARKETS, AggregationsResource, ArbitrageResource, AttributePricesResource, AuthenticationError, BaseResource, Buff163Resource, ConfigurationError, DEFAULT_BASE_URL, DEFAULT_PUBLIC_BASE_URL, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, FeatureNotAvailableError, GameClient, HistoryResource, ItemsResource, KNOWN_MARKETS, LIQUIDITY_BADGES, LIQUIDITY_CONFIDENCE, LIQUIDITY_LABELS, LiquidityResource, MarketAnalyticsResource, MarketsResource, NbboResource, NetworkError, NotFoundError, ParseError, PermissionError, PricesResource, PricingResource, RESPONSE_META, RateLimitError, RecommendationsResource, SUPPORTED_LIQUIDITY_MARKETS, SUPPORTED_RUST_LIQUIDITY_MARKETS, SchemaResource, ServerError, SkinpricerClient, SkinpricerError, StatusResource, TimeoutError, VERSION, ValidationError, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };
1202
1340
  //# sourceMappingURL=index.js.map
1203
1341
  //# sourceMappingURL=index.js.map