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