@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.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
+ market_hash_name: 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
+ market_hash_name: 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.4.0";
38
397
 
39
398
  // src/config.ts
40
399
  var DEFAULT_BASE_URL = "https://pricing.skinpricer.com/v1";
@@ -302,8 +661,10 @@ function tryJsonParse(text) {
302
661
  return void 0;
303
662
  }
304
663
  }
305
- async function parseResponse(response) {
664
+ async function parseResponse(response, allowNotModified = false) {
306
665
  const meta = buildMeta(response);
666
+ if (allowNotModified && response.status === 304)
667
+ return { data: null, meta };
307
668
  const text = await response.text();
308
669
  if (response.ok) {
309
670
  if (text.length === 0) {
@@ -317,22 +678,13 @@ async function parseResponse(response) {
317
678
  responseBody: text,
318
679
  cause,
319
680
  rateLimit: meta.rateLimit,
320
- requestId: meta.requestId
321
- });
322
- }
323
- }
324
- const parsed = text.length > 0 ? tryJsonParse(text) : void 0;
325
- const body = parsed !== void 0 ? parsed : text.length > 0 ? text : void 0;
326
- throw errorFromResponse({ status: response.status, body, meta });
327
- }
328
-
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}`;
681
+ requestId: meta.requestId
682
+ });
683
+ }
684
+ }
685
+ const parsed = text.length > 0 ? tryJsonParse(text) : void 0;
686
+ const body = parsed !== void 0 ? parsed : text.length > 0 ? text : void 0;
687
+ throw errorFromResponse({ status: response.status, body, meta });
336
688
  }
337
689
 
338
690
  // src/http/query.ts
@@ -363,14 +715,21 @@ function buildRequest(config, input) {
363
715
  Accept: "application/json",
364
716
  "User-Agent": config.userAgent,
365
717
  "X-Skinpricer-Client": config.userAgent,
366
- ...config.headers
718
+ ...Object.fromEntries(
719
+ Object.entries(config.headers).filter(
720
+ ([name]) => name.toLowerCase() !== "authorization"
721
+ )
722
+ )
367
723
  };
368
724
  let body;
369
725
  if (input.body !== void 0) {
370
726
  body = JSON.stringify(input.body);
371
727
  headers["Content-Type"] = "application/json";
372
728
  }
373
- headers["Authorization"] = `${config.authScheme} ${config.apiKey}`;
729
+ if (input.authenticated !== false)
730
+ headers["Authorization"] = `${config.authScheme} ${config.apiKey}`;
731
+ if (input.ifNoneMatch !== void 0)
732
+ headers["If-None-Match"] = input.ifNoneMatch;
374
733
  const prepared = { url, method: input.method, headers };
375
734
  if (body !== void 0) prepared.body = body;
376
735
  return prepared;
@@ -457,6 +816,12 @@ var HttpClient = class {
457
816
  get publicBaseUrl() {
458
817
  return this.config.publicBaseUrl;
459
818
  }
819
+ /** Selects an API version while retaining a configured gateway prefix. */
820
+ versionedBaseUrl(version, baseUrl = this.config.baseUrl) {
821
+ const url = new URL(baseUrl);
822
+ url.pathname = /\/v[0-9]+$/.test(url.pathname) ? url.pathname.replace(/\/v[0-9]+$/, `/${version}`) : `${url.pathname.replace(/\/$/, "")}/${version}`;
823
+ return url.toString().replace(/\/$/, "");
824
+ }
460
825
  async request(input, options = {}) {
461
826
  const prepared = buildRequest(this.config, input);
462
827
  const retry = resolveRequestRetry(this.config.retry, options.retry);
@@ -472,46 +837,18 @@ var HttpClient = class {
472
837
  url: prepared.url,
473
838
  attempt
474
839
  });
475
- let response;
476
840
  try {
477
- response = await this.config.fetch(prepared.url, {
841
+ const response = await this.config.fetch(prepared.url, {
478
842
  method: prepared.method,
479
843
  headers: prepared.headers,
480
844
  body: prepared.body,
481
845
  signal: handle.signal
482
846
  });
483
- } catch (error) {
847
+ const parsed = await parseResponse(
848
+ response,
849
+ input.ifNoneMatch !== void 0
850
+ );
484
851
  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
852
  this.recordRateLimit(parsed.meta.rateLimit);
516
853
  await runHook(hooks.onResponse, {
517
854
  method: input.method,
@@ -522,30 +859,32 @@ var HttpClient = class {
522
859
  });
523
860
  return parsed;
524
861
  } catch (error) {
525
- if (error instanceof RateLimitError) {
526
- this.recordRateLimit(error.rateLimit, error.retryAfterSeconds);
862
+ handle.cleanup();
863
+ if (callerSignal?.aborted && !handle.didTimeout())
864
+ throw abortError(callerSignal);
865
+ const failure = handle.didTimeout() ? new TimeoutError(`Request timed out after ${timeoutMs}ms`, {
866
+ cause: error
867
+ }) : error instanceof SkinpricerError ? error : new NetworkError(networkMessage(error), { cause: error });
868
+ if (failure instanceof RateLimitError) {
869
+ this.recordRateLimit(failure.rateLimit, failure.retryAfterSeconds);
527
870
  }
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;
871
+ const status = failure.status ?? null;
872
+ if (retry && shouldRetry({ method: input.method, attempt, retry, status })) {
873
+ const retryAfterSeconds = failure instanceof RateLimitError ? failure.retryAfterSeconds : failure.rateLimit?.retryAfterSeconds ?? null;
535
874
  const delayMs = retryDelayMs({ attempt, retry, retryAfterSeconds });
536
875
  await runHook(hooks.onRetry, {
537
876
  method: input.method,
538
877
  url: prepared.url,
539
878
  attempt,
540
879
  delayMs,
541
- status: error.status,
542
- error
880
+ status,
881
+ error: failure
543
882
  });
544
883
  await sleep(delayMs, callerSignal);
545
884
  attempt += 1;
546
885
  continue;
547
886
  }
548
- throw error;
887
+ throw failure;
549
888
  }
550
889
  }
551
890
  }
@@ -591,39 +930,6 @@ async function mapWithConcurrency(items, limit, fn) {
591
930
  return results;
592
931
  }
593
932
 
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
933
  // src/resources/aggregations.ts
628
934
  var MAX_IDS_PER_REQUEST = 100;
629
935
  var DEFAULT_BATCH_CONCURRENCY = 5;
@@ -826,141 +1132,6 @@ var Buff163Resource = class extends BaseResource {
826
1132
  }
827
1133
  };
828
1134
 
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
1135
  // src/resources/market-analytics.ts
965
1136
  var MarketAnalyticsResource = class extends BaseResource {
966
1137
  /** `GET /v1/market-analytics/:marketHashName` — per-market analytics rows. */
@@ -976,77 +1147,16 @@ var MarketAnalyticsResource = class extends BaseResource {
976
1147
  }
977
1148
  };
978
1149
 
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) {
1150
+ // src/resources/prices.ts
1151
+ var PricesResource = class extends BaseResource {
1152
+ latestAll(params, options) {
1045
1153
  return this.call(
1046
1154
  {
1047
1155
  method: "GET",
1048
- path: `/pricing/${encodePathSegment(marketHashName)}/listings`,
1049
- query: { limit: params.limit, markets: params.markets }
1156
+ path: "/prices/latest",
1157
+ baseUrl: this.http.versionedBaseUrl("v2"),
1158
+ query: { game: params.game },
1159
+ ifNoneMatch: params.ifNoneMatch
1050
1160
  },
1051
1161
  options
1052
1162
  );
@@ -1101,6 +1211,12 @@ var SkinpricerClient = class {
1101
1211
  buff163;
1102
1212
  liquidity;
1103
1213
  markets;
1214
+ schema;
1215
+ prices;
1216
+ /** Access the v2 endpoints supported by the selected game. */
1217
+ forGame(game) {
1218
+ return new GameClient(this.httpClient, game);
1219
+ }
1104
1220
  httpClient;
1105
1221
  constructor(config) {
1106
1222
  this.httpClient = new HttpClient(resolveConfig(config));
@@ -1117,6 +1233,8 @@ var SkinpricerClient = class {
1117
1233
  this.buff163 = new Buff163Resource(this.httpClient);
1118
1234
  this.liquidity = new LiquidityResource(this.httpClient);
1119
1235
  this.markets = new MarketsResource(this.httpClient);
1236
+ this.schema = new SchemaResource(this.httpClient);
1237
+ this.prices = new PricesResource(this.httpClient);
1120
1238
  }
1121
1239
  };
1122
1240
 
@@ -1136,10 +1254,15 @@ var KNOWN_MARKETS = [
1136
1254
  "whitemarket",
1137
1255
  "waxpeer",
1138
1256
  "lootfarm",
1257
+ "rapidskins",
1139
1258
  "avanmarket",
1140
1259
  "tradeit-store",
1141
1260
  "tradeit-trade",
1142
- "steamcommunity"
1261
+ "steamcommunity",
1262
+ "youpin",
1263
+ "mannco-store",
1264
+ "rusttm",
1265
+ "rustskins"
1143
1266
  ];
1144
1267
  var ATTRIBUTE_MARKETS = [
1145
1268
  "buff163",
@@ -1157,7 +1280,8 @@ var LIQUIDITY_BADGES = [
1157
1280
  "ILLIQUID",
1158
1281
  "VERY_ILLIQUID",
1159
1282
  "EXTREMELY_ILLIQUID",
1160
- "UNTRADED"
1283
+ "UNTRADED",
1284
+ "INSUFFICIENT_DATA"
1161
1285
  ];
1162
1286
  var LIQUIDITY_CONFIDENCE = [
1163
1287
  "HIGH",
@@ -1178,9 +1302,10 @@ var SUPPORTED_LIQUIDITY_MARKETS = [
1178
1302
  "skinport",
1179
1303
  "marketcsgo",
1180
1304
  "dmarket",
1181
- "csdeals",
1305
+ "steamcommunity",
1182
1306
  "csfloat"
1183
1307
  ];
1308
+ var SUPPORTED_RUST_LIQUIDITY_MARKETS = ["rusttm", "skinport"];
1184
1309
 
1185
1310
  // src/utils/money.ts
1186
1311
  function centsToUsd(cents) {
@@ -1198,6 +1323,6 @@ function parseIsoDate(value) {
1198
1323
  return new Date(value);
1199
1324
  }
1200
1325
 
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 };
1326
+ 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
1327
  //# sourceMappingURL=index.js.map
1203
1328
  //# sourceMappingURL=index.js.map