warframe-nexus-query 2.3.10 → 3.0.1
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/README.md +10 -5
- package/dist/basedir.d.mts +3 -0
- package/dist/basedir.mjs +7 -0
- package/dist/index.d.mts +868 -0
- package/dist/index.mjs +1778 -0
- package/package.json +31 -17
- package/basedir.js +0 -4
- package/index.js +0 -172
- package/lib/AttachmentCreator.js +0 -198
- package/lib/Settings.js +0 -53
- package/lib/market/v2/MarketFetcherV2.js +0 -447
- package/lib/market/v2/constants.js +0 -60
- package/lib/market/v2/index.js +0 -12
- package/lib/market/v2/models/Item.js +0 -135
- package/lib/market/v2/models/Order.js +0 -197
- package/lib/market/v2/models/Summary.js +0 -165
- package/lib/market/v2/types.d.ts +0 -137
- package/lib/market/v2/utils/cache.js +0 -291
- package/lib/market/v2/utils/http.js +0 -246
- package/lib/market/v2/utils/i18n.js +0 -40
- package/lib/market/v2/utils/statistics.js +0 -185
- package/lib/priceCheckOptions.js +0 -71
- package/lib/promiseTimeout.js +0 -19
- package/types/index.d.ts +0 -522
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,868 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings storage for nexus query
|
|
3
|
+
*/
|
|
4
|
+
declare class Settings {
|
|
5
|
+
userAgent: string;
|
|
6
|
+
urls: {
|
|
7
|
+
market: string;
|
|
8
|
+
marketAssets: string;
|
|
9
|
+
};
|
|
10
|
+
platforms: Record<string, string | Record<string, string>>;
|
|
11
|
+
timeouts: {
|
|
12
|
+
market: number;
|
|
13
|
+
};
|
|
14
|
+
defaultString: string;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Look up real platform for platform alias
|
|
18
|
+
* @param platformAlias - Alias of platform
|
|
19
|
+
* @param market - Whether or not to use market-specific aliases
|
|
20
|
+
* @returns Real platform identifier
|
|
21
|
+
*/
|
|
22
|
+
lookupAlias(platformAlias: string, market?: boolean): string | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Shared types for Warframe Market API v2.
|
|
26
|
+
*/
|
|
27
|
+
type Platform = 'pc' | 'ps4' | 'xbox' | 'switch' | 'mobile';
|
|
28
|
+
type Language = 'en' | 'es' | 'fr' | 'de' | 'it' | 'pl' | 'pt' | 'ru' | 'ko' | 'zh-hans' | 'zh-hant' | 'uk';
|
|
29
|
+
type OrderType = 'buy' | 'sell';
|
|
30
|
+
type UserStatus = 'invisible' | 'offline' | 'online' | 'ingame';
|
|
31
|
+
type ActivityType = 'UNKNOWN' | 'IDLE' | 'ON_MISSION' | 'IN_DOJO' | 'IN_ORBITER' | 'IN_RELAY';
|
|
32
|
+
type Rarity = 'common' | 'uncommon' | 'rare' | 'legendary';
|
|
33
|
+
interface Logger {
|
|
34
|
+
debug?(message?: unknown, ...args: unknown[]): void;
|
|
35
|
+
info?(message?: unknown, ...args: unknown[]): void;
|
|
36
|
+
warn?(message?: unknown, ...args: unknown[]): void;
|
|
37
|
+
error?(message?: unknown, ...args: unknown[]): void;
|
|
38
|
+
log?(message?: unknown, ...args: unknown[]): void;
|
|
39
|
+
}
|
|
40
|
+
interface LocalizedData {
|
|
41
|
+
name?: string | null;
|
|
42
|
+
description?: string;
|
|
43
|
+
icon?: string;
|
|
44
|
+
thumb?: string;
|
|
45
|
+
subIcon?: string;
|
|
46
|
+
wikiLink?: string;
|
|
47
|
+
[field: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
interface I18nData {
|
|
50
|
+
[lang: string]: LocalizedData | undefined;
|
|
51
|
+
}
|
|
52
|
+
interface ItemData {
|
|
53
|
+
id: string;
|
|
54
|
+
slug: string;
|
|
55
|
+
gameRef?: string;
|
|
56
|
+
tags?: string[];
|
|
57
|
+
rarity?: Rarity;
|
|
58
|
+
tradingTax?: number;
|
|
59
|
+
ducats?: number;
|
|
60
|
+
vosfor?: number;
|
|
61
|
+
baseEndo?: number;
|
|
62
|
+
endoMultiplier?: number;
|
|
63
|
+
reqMasteryRank?: number;
|
|
64
|
+
maxRank?: number;
|
|
65
|
+
maxCharges?: number;
|
|
66
|
+
maxAmberStars?: number;
|
|
67
|
+
maxCyanStars?: number;
|
|
68
|
+
setRoot?: boolean | string;
|
|
69
|
+
setParts?: string[];
|
|
70
|
+
quantityInSet?: number;
|
|
71
|
+
bulkTradable?: boolean;
|
|
72
|
+
subtypes?: string[];
|
|
73
|
+
tradable?: boolean;
|
|
74
|
+
vaulted?: boolean;
|
|
75
|
+
thumb?: string | null;
|
|
76
|
+
icon?: string | null;
|
|
77
|
+
i18n?: I18nData;
|
|
78
|
+
}
|
|
79
|
+
interface UserActivity {
|
|
80
|
+
type?: ActivityType | string;
|
|
81
|
+
details?: string;
|
|
82
|
+
startedAt?: string;
|
|
83
|
+
}
|
|
84
|
+
interface OrderUserData {
|
|
85
|
+
id: string;
|
|
86
|
+
ingameName: string;
|
|
87
|
+
avatar?: string;
|
|
88
|
+
reputation?: number;
|
|
89
|
+
locale?: string;
|
|
90
|
+
platform?: Platform | string;
|
|
91
|
+
crossplay?: boolean;
|
|
92
|
+
status?: UserStatus | string;
|
|
93
|
+
activity?: UserActivity;
|
|
94
|
+
lastSeen?: string;
|
|
95
|
+
}
|
|
96
|
+
interface OrderData {
|
|
97
|
+
id: string;
|
|
98
|
+
type: OrderType | string;
|
|
99
|
+
platinum: number;
|
|
100
|
+
quantity: number;
|
|
101
|
+
perTrade?: boolean | number;
|
|
102
|
+
rank?: number;
|
|
103
|
+
charges?: number;
|
|
104
|
+
subtype?: string;
|
|
105
|
+
amberStars?: number;
|
|
106
|
+
cyanStars?: number;
|
|
107
|
+
visible?: boolean;
|
|
108
|
+
createdAt?: string;
|
|
109
|
+
updatedAt?: string;
|
|
110
|
+
itemId?: string;
|
|
111
|
+
group?: string;
|
|
112
|
+
user?: OrderUserData;
|
|
113
|
+
}
|
|
114
|
+
interface StatisticsData {
|
|
115
|
+
volume: number;
|
|
116
|
+
orderCount: number;
|
|
117
|
+
median: number;
|
|
118
|
+
min: number;
|
|
119
|
+
max: number;
|
|
120
|
+
avg: number;
|
|
121
|
+
q1?: number;
|
|
122
|
+
q3?: number;
|
|
123
|
+
}
|
|
124
|
+
interface SummaryPrices {
|
|
125
|
+
soldCount: number;
|
|
126
|
+
soldPrice: number;
|
|
127
|
+
minimum: number;
|
|
128
|
+
maximum: number;
|
|
129
|
+
average: number;
|
|
130
|
+
volume: number;
|
|
131
|
+
}
|
|
132
|
+
interface TraderInfo {
|
|
133
|
+
ingameName: string;
|
|
134
|
+
platinum: number;
|
|
135
|
+
quantity: number;
|
|
136
|
+
status?: string;
|
|
137
|
+
activity?: string | null;
|
|
138
|
+
reputation?: number;
|
|
139
|
+
platform?: Platform | string;
|
|
140
|
+
crossplay?: boolean;
|
|
141
|
+
}
|
|
142
|
+
interface PriceCheckOptions {
|
|
143
|
+
rank?: number;
|
|
144
|
+
ranks?: Array<number | undefined>;
|
|
145
|
+
rankLt?: number;
|
|
146
|
+
charges?: number;
|
|
147
|
+
chargesLt?: number;
|
|
148
|
+
amberStars?: number;
|
|
149
|
+
amberStarsLt?: number;
|
|
150
|
+
cyanStars?: number;
|
|
151
|
+
cyanStarsLt?: number;
|
|
152
|
+
subtype?: string;
|
|
153
|
+
}
|
|
154
|
+
interface QueryOptions extends PriceCheckOptions {
|
|
155
|
+
platform?: string;
|
|
156
|
+
successfulQuery?: () => void;
|
|
157
|
+
minPrice?: number;
|
|
158
|
+
maxPrice?: number;
|
|
159
|
+
}
|
|
160
|
+
interface HttpClientOptions {
|
|
161
|
+
baseURL?: string;
|
|
162
|
+
timeout?: number;
|
|
163
|
+
locale?: string;
|
|
164
|
+
logger?: Logger;
|
|
165
|
+
userAgent?: string;
|
|
166
|
+
minRequestInterval?: number;
|
|
167
|
+
}
|
|
168
|
+
interface HttpRequestOptions {
|
|
169
|
+
platform?: string;
|
|
170
|
+
locale?: string;
|
|
171
|
+
query?: Record<string, unknown>;
|
|
172
|
+
token?: string;
|
|
173
|
+
headers?: Record<string, string>;
|
|
174
|
+
}
|
|
175
|
+
interface CacheOptions {
|
|
176
|
+
maxSize?: number;
|
|
177
|
+
ttl?: number;
|
|
178
|
+
cacheId?: string;
|
|
179
|
+
persistent?: boolean;
|
|
180
|
+
logger?: Logger;
|
|
181
|
+
userAgent?: string;
|
|
182
|
+
minRequestInterval?: number;
|
|
183
|
+
}
|
|
184
|
+
interface VersionedCacheVersionData {
|
|
185
|
+
apiVersion?: string;
|
|
186
|
+
data?: {
|
|
187
|
+
collections?: Record<string, string>;
|
|
188
|
+
[key: string]: unknown;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
interface MarketFetcherV2Options {
|
|
192
|
+
locale?: string;
|
|
193
|
+
timeout?: number;
|
|
194
|
+
logger?: Logger;
|
|
195
|
+
cacheSize?: number;
|
|
196
|
+
ordersCacheSize?: number;
|
|
197
|
+
cacheTTL?: number;
|
|
198
|
+
baseURL?: string;
|
|
199
|
+
userAgent?: string;
|
|
200
|
+
minRequestInterval?: number;
|
|
201
|
+
}
|
|
202
|
+
interface CalculateStatisticsOptions {
|
|
203
|
+
type?: OrderType | string;
|
|
204
|
+
onlineOnly?: boolean;
|
|
205
|
+
includeOutliers?: boolean;
|
|
206
|
+
}
|
|
207
|
+
interface GetBestOrdersOptions {
|
|
208
|
+
limit?: number;
|
|
209
|
+
onlineOnly?: boolean;
|
|
210
|
+
}
|
|
211
|
+
interface DiscordEmbedField {
|
|
212
|
+
name: string;
|
|
213
|
+
value: string;
|
|
214
|
+
inline?: boolean;
|
|
215
|
+
}
|
|
216
|
+
interface DiscordEmbed {
|
|
217
|
+
type: 'rich';
|
|
218
|
+
title: string;
|
|
219
|
+
color: number;
|
|
220
|
+
url: string;
|
|
221
|
+
fields: DiscordEmbedField[];
|
|
222
|
+
thumbnail?: {
|
|
223
|
+
url: string;
|
|
224
|
+
};
|
|
225
|
+
footer?: {
|
|
226
|
+
text: string;
|
|
227
|
+
icon_url?: string;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
interface PriceCheckQuerierOptions {
|
|
231
|
+
logger?: Logger;
|
|
232
|
+
marketCache?: MarketFetcherLike;
|
|
233
|
+
skipMarket?: boolean;
|
|
234
|
+
/** Accepted and ignored. Older callers passed this instead of `skipMarket`. */
|
|
235
|
+
skipNexus?: boolean;
|
|
236
|
+
}
|
|
237
|
+
interface MarketFetcherLike {
|
|
238
|
+
queryMarket(query: string, options: QueryOptions): Promise<unknown[]>;
|
|
239
|
+
stop?: () => void;
|
|
240
|
+
marketCache?: {
|
|
241
|
+
stop: () => void;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Create the attachment itself
|
|
246
|
+
*/
|
|
247
|
+
declare class AttachmentCreator {
|
|
248
|
+
/**
|
|
249
|
+
* Build an attachment from the provided components
|
|
250
|
+
* @param components - collected array of components with market data
|
|
251
|
+
* @param query - Search query that these components match
|
|
252
|
+
* @param platform - Platform for the request, defaults to 'pc'
|
|
253
|
+
* @returns Discord-ready attachment describing the item
|
|
254
|
+
*/
|
|
255
|
+
attachmentFromComponents(components: unknown, _query?: string, platform?: string): DiscordEmbed;
|
|
256
|
+
}
|
|
257
|
+
declare class Item {
|
|
258
|
+
id: string;
|
|
259
|
+
slug: string;
|
|
260
|
+
gameRef?: string;
|
|
261
|
+
tags: string[];
|
|
262
|
+
setRoot?: boolean | string;
|
|
263
|
+
setParts: string[];
|
|
264
|
+
quantityInSet?: number;
|
|
265
|
+
rarity?: Rarity;
|
|
266
|
+
bulkTradable: boolean;
|
|
267
|
+
subtypes: string[];
|
|
268
|
+
tradable?: boolean;
|
|
269
|
+
vaulted?: boolean;
|
|
270
|
+
maxRank?: number;
|
|
271
|
+
maxCharges?: number;
|
|
272
|
+
maxAmberStars?: number;
|
|
273
|
+
maxCyanStars?: number;
|
|
274
|
+
ducats?: number;
|
|
275
|
+
vosfor?: number;
|
|
276
|
+
tradingTax?: number;
|
|
277
|
+
baseEndo?: number;
|
|
278
|
+
endoMultiplier?: number;
|
|
279
|
+
reqMasteryRank?: number;
|
|
280
|
+
i18n: I18nData;
|
|
281
|
+
locale: string;
|
|
282
|
+
name: string;
|
|
283
|
+
description?: string;
|
|
284
|
+
wikiLink?: string;
|
|
285
|
+
icon?: string;
|
|
286
|
+
thumb?: string;
|
|
287
|
+
subIcon?: string;
|
|
288
|
+
type: 'market-v2';
|
|
289
|
+
/**
|
|
290
|
+
* @param data - Raw item data from API
|
|
291
|
+
* @param locale - Language code for i18n
|
|
292
|
+
*/
|
|
293
|
+
constructor(data: ItemData, locale?: string);
|
|
294
|
+
/**
|
|
295
|
+
* Get localized field
|
|
296
|
+
* @param field - Field name
|
|
297
|
+
* @param lang - Language code (defaults to instance locale)
|
|
298
|
+
* @returns Localized value
|
|
299
|
+
*/
|
|
300
|
+
getLocalized(field: string, lang?: Language | string): unknown;
|
|
301
|
+
/**
|
|
302
|
+
* Get full icon URL
|
|
303
|
+
* @param baseUrl - Base URL for assets
|
|
304
|
+
* @returns Icon URL, or null when the item has no icon
|
|
305
|
+
*/
|
|
306
|
+
getIconUrl(baseUrl?: string): string | null;
|
|
307
|
+
/**
|
|
308
|
+
* Get full thumbnail URL
|
|
309
|
+
* @param baseUrl - Base URL for assets
|
|
310
|
+
* @returns Thumbnail URL, or null when the item has no thumbnail
|
|
311
|
+
*/
|
|
312
|
+
getThumbUrl(baseUrl?: string): string | null;
|
|
313
|
+
/**
|
|
314
|
+
* Check if item is part of a set
|
|
315
|
+
* @returns Whether the item lists set parts
|
|
316
|
+
*/
|
|
317
|
+
isPartOfSet(): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Check if item is vaulted
|
|
320
|
+
* @returns Whether the item is vaulted
|
|
321
|
+
*/
|
|
322
|
+
isVaulted(): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Convert to JSON
|
|
325
|
+
* @returns JSON-safe item
|
|
326
|
+
*/
|
|
327
|
+
toJSON(): {
|
|
328
|
+
id: string;
|
|
329
|
+
slug: string;
|
|
330
|
+
name: string;
|
|
331
|
+
thumb: string | undefined;
|
|
332
|
+
icon: string | undefined;
|
|
333
|
+
tradingTax: number | undefined;
|
|
334
|
+
ducats: number | undefined;
|
|
335
|
+
vosfor: number | undefined;
|
|
336
|
+
masteryLevel: number | undefined;
|
|
337
|
+
tradable: boolean | undefined;
|
|
338
|
+
vaulted: boolean | undefined;
|
|
339
|
+
wikiUrl: string | undefined;
|
|
340
|
+
description: string | undefined;
|
|
341
|
+
tags: string[];
|
|
342
|
+
type: "market-v2";
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Convert to string representation
|
|
346
|
+
* @returns Item label
|
|
347
|
+
*/
|
|
348
|
+
toString(): string;
|
|
349
|
+
}
|
|
350
|
+
declare class OrderUser {
|
|
351
|
+
id: string;
|
|
352
|
+
ingameName: string;
|
|
353
|
+
avatar?: string;
|
|
354
|
+
reputation: number;
|
|
355
|
+
locale?: string;
|
|
356
|
+
platform?: string;
|
|
357
|
+
crossplay: boolean;
|
|
358
|
+
status?: string;
|
|
359
|
+
activity?: UserActivity;
|
|
360
|
+
lastSeen: Date | null;
|
|
361
|
+
constructor(data: OrderUserData);
|
|
362
|
+
/**
|
|
363
|
+
* Check if user is online
|
|
364
|
+
* @returns Whether the user is online or in game
|
|
365
|
+
*/
|
|
366
|
+
isOnline(): boolean;
|
|
367
|
+
/**
|
|
368
|
+
* Get activity description
|
|
369
|
+
* @returns Activity text, or null when unknown
|
|
370
|
+
*/
|
|
371
|
+
getActivityDescription(): string | null;
|
|
372
|
+
/**
|
|
373
|
+
* Get status emoji
|
|
374
|
+
* @returns Status emoji
|
|
375
|
+
*/
|
|
376
|
+
getStatusEmoji(): string;
|
|
377
|
+
/**
|
|
378
|
+
* Convert to JSON
|
|
379
|
+
* @returns JSON-safe user
|
|
380
|
+
*/
|
|
381
|
+
toJSON(): {
|
|
382
|
+
id: string;
|
|
383
|
+
ingameName: string;
|
|
384
|
+
avatar: string | undefined;
|
|
385
|
+
reputation: number;
|
|
386
|
+
locale: string | undefined;
|
|
387
|
+
platform: string | undefined;
|
|
388
|
+
crossplay: boolean;
|
|
389
|
+
status: string | undefined;
|
|
390
|
+
activity: UserActivity | undefined;
|
|
391
|
+
lastSeen: string | undefined;
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Order model for Warframe Market API v2
|
|
396
|
+
* Represents a buy or sell order with optional user information
|
|
397
|
+
*/
|
|
398
|
+
declare class Order {
|
|
399
|
+
id: string;
|
|
400
|
+
type: string;
|
|
401
|
+
platinum: number;
|
|
402
|
+
quantity: number;
|
|
403
|
+
perTrade?: boolean | number;
|
|
404
|
+
rank?: number;
|
|
405
|
+
charges?: number;
|
|
406
|
+
subtype?: string;
|
|
407
|
+
amberStars?: number;
|
|
408
|
+
cyanStars?: number;
|
|
409
|
+
visible?: boolean;
|
|
410
|
+
createdAt: Date | null;
|
|
411
|
+
updatedAt: Date | null;
|
|
412
|
+
itemId?: string;
|
|
413
|
+
group?: string;
|
|
414
|
+
user: OrderUser | null;
|
|
415
|
+
/**
|
|
416
|
+
* @param data - Raw order data from API
|
|
417
|
+
*/
|
|
418
|
+
constructor(data: OrderData);
|
|
419
|
+
/**
|
|
420
|
+
* Check if order is from an online user
|
|
421
|
+
* @returns Whether the order user is online
|
|
422
|
+
*/
|
|
423
|
+
isUserOnline(): boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Check if order is buy type
|
|
426
|
+
* @returns Whether this is a buy order
|
|
427
|
+
*/
|
|
428
|
+
isBuyOrder(): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Check if order is sell type
|
|
431
|
+
* @returns Whether this is a sell order
|
|
432
|
+
*/
|
|
433
|
+
isSellOrder(): boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Get order age in hours
|
|
436
|
+
* @returns Age in hours
|
|
437
|
+
*/
|
|
438
|
+
getAgeHours(): number;
|
|
439
|
+
/**
|
|
440
|
+
* Convert to JSON
|
|
441
|
+
* @returns JSON-safe order
|
|
442
|
+
*/
|
|
443
|
+
toJSON(): {
|
|
444
|
+
id: string;
|
|
445
|
+
type: string;
|
|
446
|
+
platinum: number;
|
|
447
|
+
quantity: number;
|
|
448
|
+
perTrade: number | boolean | undefined;
|
|
449
|
+
rank: number | undefined;
|
|
450
|
+
charges: number | undefined;
|
|
451
|
+
subtype: string | undefined;
|
|
452
|
+
amberStars: number | undefined;
|
|
453
|
+
cyanStars: number | undefined;
|
|
454
|
+
visible: boolean | undefined;
|
|
455
|
+
createdAt: string | undefined;
|
|
456
|
+
updatedAt: string | undefined;
|
|
457
|
+
itemId: string | undefined;
|
|
458
|
+
group: string | undefined;
|
|
459
|
+
user: {
|
|
460
|
+
id: string;
|
|
461
|
+
ingameName: string;
|
|
462
|
+
avatar: string | undefined;
|
|
463
|
+
reputation: number;
|
|
464
|
+
locale: string | undefined;
|
|
465
|
+
platform: string | undefined;
|
|
466
|
+
crossplay: boolean;
|
|
467
|
+
status: string | undefined;
|
|
468
|
+
activity: UserActivity | undefined;
|
|
469
|
+
lastSeen: string | undefined;
|
|
470
|
+
} | undefined;
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* Convert to string representation
|
|
474
|
+
* @returns Order label
|
|
475
|
+
*/
|
|
476
|
+
toString(): string;
|
|
477
|
+
}
|
|
478
|
+
interface OrderBook {
|
|
479
|
+
buy: Order[];
|
|
480
|
+
sell: Order[];
|
|
481
|
+
}
|
|
482
|
+
interface SummaryStatistics {
|
|
483
|
+
buy: Partial<StatisticsData>;
|
|
484
|
+
sell: Partial<StatisticsData>;
|
|
485
|
+
}
|
|
486
|
+
declare class SummaryV2 {
|
|
487
|
+
name: string;
|
|
488
|
+
slug: string;
|
|
489
|
+
thumbnail: string | null;
|
|
490
|
+
partThumb: string | null;
|
|
491
|
+
icon: string | null;
|
|
492
|
+
tradingTax: number;
|
|
493
|
+
ducats: number;
|
|
494
|
+
vosfor: number;
|
|
495
|
+
masteryLevel?: number;
|
|
496
|
+
tradable?: boolean;
|
|
497
|
+
vaulted?: boolean;
|
|
498
|
+
wikiUrl?: string;
|
|
499
|
+
description: string;
|
|
500
|
+
codex: string;
|
|
501
|
+
url: string;
|
|
502
|
+
tags: string[];
|
|
503
|
+
prices: SummaryPrices;
|
|
504
|
+
orders: OrderBook;
|
|
505
|
+
statistics: SummaryStatistics;
|
|
506
|
+
type: 'market-v2';
|
|
507
|
+
/**
|
|
508
|
+
* Create a summary from v2 Item and Order data
|
|
509
|
+
* @param item - Item object
|
|
510
|
+
* @param orders - Orders object with buy and sell lists
|
|
511
|
+
* @param statistics - Statistics object with buy and sell stats
|
|
512
|
+
*/
|
|
513
|
+
constructor(item: Item, orders: OrderBook, statistics: SummaryStatistics);
|
|
514
|
+
/**
|
|
515
|
+
* Get best online sellers
|
|
516
|
+
* @param limit - Number of sellers to return
|
|
517
|
+
* @returns Online sellers
|
|
518
|
+
*/
|
|
519
|
+
getOnlineSellers(limit?: number): TraderInfo[];
|
|
520
|
+
/**
|
|
521
|
+
* Get best online buyers
|
|
522
|
+
* @param limit - Number of buyers to return
|
|
523
|
+
* @returns Online buyers
|
|
524
|
+
*/
|
|
525
|
+
getOnlineBuyers(limit?: number): TraderInfo[];
|
|
526
|
+
/**
|
|
527
|
+
* String representation (v1 compatible)
|
|
528
|
+
* @param opt - Option: 'codex', 'item', 'location', 'traders', or 'all'
|
|
529
|
+
* @returns Formatted summary
|
|
530
|
+
*/
|
|
531
|
+
toString(opt?: string): string;
|
|
532
|
+
/**
|
|
533
|
+
* Padding helper (v1 compatibility)
|
|
534
|
+
* @param str - String to pad
|
|
535
|
+
* @param length - Target length
|
|
536
|
+
* @param character - Padding character
|
|
537
|
+
* @returns Padded string
|
|
538
|
+
*/
|
|
539
|
+
pad(str: string, length?: number, character?: string): string;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Normalize language code
|
|
543
|
+
* @param lang - Language code
|
|
544
|
+
* @returns Normalized language code
|
|
545
|
+
*/
|
|
546
|
+
export declare function normalizeLanguage(lang?: string): Language;
|
|
547
|
+
/**
|
|
548
|
+
* Extract localized data from i18n object
|
|
549
|
+
* @param i18n - i18n object
|
|
550
|
+
* @param locale - Preferred locale
|
|
551
|
+
* @returns Localized data
|
|
552
|
+
*/
|
|
553
|
+
export declare function extractLocalized(i18n: I18nData | undefined, locale?: string): LocalizedData;
|
|
554
|
+
/**
|
|
555
|
+
* Get field from i18n object with fallback
|
|
556
|
+
* @param i18n - i18n object
|
|
557
|
+
* @param field - Field name
|
|
558
|
+
* @param locale - Preferred locale
|
|
559
|
+
* @param defaultValue - Default value if not found
|
|
560
|
+
* @returns Localized field or the default
|
|
561
|
+
*/
|
|
562
|
+
export declare function getLocalizedField(i18n: I18nData | undefined, field: string, locale?: string, defaultValue?: unknown): any;
|
|
563
|
+
interface TopOrders {
|
|
564
|
+
buy: Order[];
|
|
565
|
+
sell: Order[];
|
|
566
|
+
}
|
|
567
|
+
declare class MarketFetcherV2 {
|
|
568
|
+
#private;
|
|
569
|
+
locale: ReturnType<typeof normalizeLanguage>;
|
|
570
|
+
logger: Logger;
|
|
571
|
+
/**
|
|
572
|
+
* @param options - Fetcher options
|
|
573
|
+
*/
|
|
574
|
+
constructor(options?: MarketFetcherV2Options);
|
|
575
|
+
/**
|
|
576
|
+
* Get list of all tradable items
|
|
577
|
+
* @returns Tradable items
|
|
578
|
+
*/
|
|
579
|
+
getItems(): Promise<Item[]>;
|
|
580
|
+
/**
|
|
581
|
+
* Get item by slug
|
|
582
|
+
* @param slug - Item slug
|
|
583
|
+
* @returns Item
|
|
584
|
+
*/
|
|
585
|
+
getItemBySlug(slug: string): Promise<Item>;
|
|
586
|
+
/**
|
|
587
|
+
* Get all items in a set
|
|
588
|
+
* @param slug - Item slug
|
|
589
|
+
* @returns Set id and items
|
|
590
|
+
*/
|
|
591
|
+
getItemSet(slug: string): Promise<{
|
|
592
|
+
id: string;
|
|
593
|
+
items: Item[];
|
|
594
|
+
}>;
|
|
595
|
+
/**
|
|
596
|
+
* Get top orders for an item (RECOMMENDED for price checks)
|
|
597
|
+
* @param slug - Item slug
|
|
598
|
+
* @param options - Options
|
|
599
|
+
* @returns Top buy and sell orders
|
|
600
|
+
*/
|
|
601
|
+
getTopOrders(slug: string, options?: QueryOptions): Promise<TopOrders>;
|
|
602
|
+
/**
|
|
603
|
+
* Get all orders for an item
|
|
604
|
+
* @param slug - Item slug
|
|
605
|
+
* @param platform - Platform (pc, ps4, xbox, switch)
|
|
606
|
+
* @returns Orders
|
|
607
|
+
*/
|
|
608
|
+
getAllOrders(slug: string, platform: string): Promise<Order[]>;
|
|
609
|
+
/**
|
|
610
|
+
* Get recent orders (last 4 hours)
|
|
611
|
+
* @param platform - Platform (pc, ps4, xbox, switch)
|
|
612
|
+
* @returns Recent orders
|
|
613
|
+
*/
|
|
614
|
+
getRecentOrders(platform: string): Promise<Order[]>;
|
|
615
|
+
/**
|
|
616
|
+
* Calculate statistics from orders
|
|
617
|
+
* @param orders - Orders array
|
|
618
|
+
* @param options - Calculation options
|
|
619
|
+
* @returns Statistics
|
|
620
|
+
*/
|
|
621
|
+
calculateStatistics(orders: Order[], options?: CalculateStatisticsOptions): StatisticsData;
|
|
622
|
+
/**
|
|
623
|
+
* Get best orders (sorted)
|
|
624
|
+
* @param orders - Orders array
|
|
625
|
+
* @param options - Options
|
|
626
|
+
* @returns Best buy and sell orders
|
|
627
|
+
*/
|
|
628
|
+
getBestOrders(orders: Order[], options?: GetBestOrdersOptions): TopOrders;
|
|
629
|
+
/**
|
|
630
|
+
* Format price range string
|
|
631
|
+
* @param stats - Statistics object
|
|
632
|
+
* @returns Price range text
|
|
633
|
+
*/
|
|
634
|
+
formatPriceRange(stats: StatisticsData): string;
|
|
635
|
+
/**
|
|
636
|
+
* Format statistics for display
|
|
637
|
+
* @param stats - Statistics object
|
|
638
|
+
* @param type - Order type
|
|
639
|
+
* @returns Formatted statistics
|
|
640
|
+
*/
|
|
641
|
+
formatStatistics(stats: StatisticsData, type?: string): string;
|
|
642
|
+
/**
|
|
643
|
+
* Query market for item (v1 compatibility method)
|
|
644
|
+
* @param query - Search query
|
|
645
|
+
* @param options - Query options
|
|
646
|
+
* @returns Matching summaries
|
|
647
|
+
*/
|
|
648
|
+
queryMarket(query: string, options?: QueryOptions): Promise<SummaryV2[]>;
|
|
649
|
+
/**
|
|
650
|
+
* Price check query (v1 compatibility method)
|
|
651
|
+
* @param query - Search query
|
|
652
|
+
* @param platform - Platform
|
|
653
|
+
* @param options - Optional order filters (rank, ranks, rankLt, etc.)
|
|
654
|
+
* @returns Matching summaries
|
|
655
|
+
*/
|
|
656
|
+
priceCheckQuery(query: string, platform: string, options?: QueryOptions): Promise<SummaryV2[]>;
|
|
657
|
+
/**
|
|
658
|
+
* Clear all caches
|
|
659
|
+
*/
|
|
660
|
+
clearCache(): void;
|
|
661
|
+
/**
|
|
662
|
+
* Check API versions
|
|
663
|
+
* @returns Version payload
|
|
664
|
+
*/
|
|
665
|
+
checkVersions(): Promise<VersionedCacheVersionData>;
|
|
666
|
+
/**
|
|
667
|
+
* Normalize platform
|
|
668
|
+
* @param platform - Platform alias
|
|
669
|
+
* @returns Normalized platform
|
|
670
|
+
*/
|
|
671
|
+
normalizePlatform(platform: string): string;
|
|
672
|
+
normalizePlatform(platform?: string): string | undefined;
|
|
673
|
+
/**
|
|
674
|
+
* Set locale
|
|
675
|
+
* @param locale - Language code
|
|
676
|
+
*/
|
|
677
|
+
setLocale(locale: string): void;
|
|
678
|
+
/**
|
|
679
|
+
* Stop and cleanup (clears all caches)
|
|
680
|
+
*/
|
|
681
|
+
stop(): void;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Version-based cache system for Warframe Market API v2
|
|
685
|
+
* Uses version hashes from /v2/versions endpoint to invalidate cache
|
|
686
|
+
* Backs up to persistent storage using flat-cache
|
|
687
|
+
*/
|
|
688
|
+
declare class VersionedCache {
|
|
689
|
+
#private;
|
|
690
|
+
maxSize: number;
|
|
691
|
+
ttl: number;
|
|
692
|
+
constructor({ maxSize, ttl, cacheId, persistent, userAgent, minRequestInterval }?: CacheOptions);
|
|
693
|
+
/**
|
|
694
|
+
* Get item from cache or fetch it
|
|
695
|
+
* @param key - Cache key
|
|
696
|
+
* @param collection - Collection name (items, rivens, etc.)
|
|
697
|
+
* @param fetchFn - Function to fetch data if cache miss
|
|
698
|
+
* @returns Cached or freshly fetched value
|
|
699
|
+
*/
|
|
700
|
+
get<T>(key: string, collection: string | undefined, fetchFn: () => Promise<T>): Promise<T>;
|
|
701
|
+
/**
|
|
702
|
+
* Set item in cache
|
|
703
|
+
* @param key - Cache key
|
|
704
|
+
* @param value - Value to cache
|
|
705
|
+
* @param collection - Collection name for version tracking
|
|
706
|
+
*/
|
|
707
|
+
set<T>(key: string, value: T, collection?: string): void;
|
|
708
|
+
/**
|
|
709
|
+
* Check if collection should be refreshed
|
|
710
|
+
* @param collection - Collection name
|
|
711
|
+
* @returns Whether the cached collection version is stale
|
|
712
|
+
*/
|
|
713
|
+
shouldRefresh(collection: string): Promise<boolean>;
|
|
714
|
+
/**
|
|
715
|
+
* Refresh cache entry
|
|
716
|
+
* @param key - Cache key
|
|
717
|
+
* @param collection - Collection name
|
|
718
|
+
* @param fetchFn - Function to fetch fresh data
|
|
719
|
+
* @returns Fresh value
|
|
720
|
+
*/
|
|
721
|
+
refresh<T>(key: string, collection: string, fetchFn: () => Promise<T>): Promise<T>;
|
|
722
|
+
/**
|
|
723
|
+
* Check versions from server
|
|
724
|
+
* @returns Version payload
|
|
725
|
+
*/
|
|
726
|
+
checkVersions(): Promise<VersionedCacheVersionData>;
|
|
727
|
+
/**
|
|
728
|
+
* Clear entire cache
|
|
729
|
+
*/
|
|
730
|
+
clear(): void;
|
|
731
|
+
/**
|
|
732
|
+
* Delete specific key from cache
|
|
733
|
+
* @param key - Cache key
|
|
734
|
+
*/
|
|
735
|
+
delete(key: string): void;
|
|
736
|
+
/**
|
|
737
|
+
* Get cache size
|
|
738
|
+
* @returns Number of in-memory entries
|
|
739
|
+
*/
|
|
740
|
+
size(): number;
|
|
741
|
+
/**
|
|
742
|
+
* Check if key exists in cache (and is valid)
|
|
743
|
+
* @param key - Cache key
|
|
744
|
+
* @returns Whether the key is present and unexpired
|
|
745
|
+
*/
|
|
746
|
+
has(key: string): boolean;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* HTTP Client for Warframe Market API v2
|
|
750
|
+
*/
|
|
751
|
+
declare class HttpClient {
|
|
752
|
+
#private;
|
|
753
|
+
/**
|
|
754
|
+
* @param options - Client options
|
|
755
|
+
*/
|
|
756
|
+
constructor(options?: HttpClientOptions);
|
|
757
|
+
/**
|
|
758
|
+
* Make GET request
|
|
759
|
+
* @param path - API path
|
|
760
|
+
* @param options - Request options
|
|
761
|
+
* @returns Unwrapped response data
|
|
762
|
+
*/
|
|
763
|
+
get<T = unknown>(path: string, options?: HttpRequestOptions): Promise<T>;
|
|
764
|
+
/**
|
|
765
|
+
* Make POST request
|
|
766
|
+
* @param path - API path
|
|
767
|
+
* @param body - Request body
|
|
768
|
+
* @param options - Request options
|
|
769
|
+
* @returns Unwrapped response data
|
|
770
|
+
*/
|
|
771
|
+
post<T = unknown>(path: string, body: unknown, options?: HttpRequestOptions): Promise<T>;
|
|
772
|
+
/**
|
|
773
|
+
* Set default locale
|
|
774
|
+
* @param locale - Language code
|
|
775
|
+
*/
|
|
776
|
+
setLocale(locale: string): void;
|
|
777
|
+
/**
|
|
778
|
+
* Set timeout
|
|
779
|
+
* @param timeout - Timeout in milliseconds
|
|
780
|
+
*/
|
|
781
|
+
setTimeout(timeout: number): void;
|
|
782
|
+
}
|
|
783
|
+
interface StatOrder {
|
|
784
|
+
type: string;
|
|
785
|
+
platinum: number;
|
|
786
|
+
quantity: number;
|
|
787
|
+
isUserOnline(): boolean;
|
|
788
|
+
isBuyOrder(): boolean;
|
|
789
|
+
isSellOrder(): boolean;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Calculate statistics from order list
|
|
793
|
+
* @param orders - Array of orders
|
|
794
|
+
* @param options - Calculation options
|
|
795
|
+
* @returns Statistics object
|
|
796
|
+
*/
|
|
797
|
+
export declare function calculateStatistics(orders: StatOrder[], options?: CalculateStatisticsOptions): StatisticsData;
|
|
798
|
+
/**
|
|
799
|
+
* Get best orders (lowest sell / highest buy)
|
|
800
|
+
* @param orders - Array of orders
|
|
801
|
+
* @param options - Options
|
|
802
|
+
* @returns Best buy and sell orders
|
|
803
|
+
*/
|
|
804
|
+
export declare function getBestOrders<T extends StatOrder>(orders: T[], options?: GetBestOrdersOptions): {
|
|
805
|
+
buy: T[];
|
|
806
|
+
sell: T[];
|
|
807
|
+
};
|
|
808
|
+
/**
|
|
809
|
+
* Format price range string
|
|
810
|
+
* @param stats - Statistics object
|
|
811
|
+
* @returns Price range text
|
|
812
|
+
*/
|
|
813
|
+
export declare function formatPriceRange(stats: Pick<StatisticsData, 'orderCount' | 'min' | 'max' | 'median'>): string;
|
|
814
|
+
/**
|
|
815
|
+
* Format statistics for display
|
|
816
|
+
* @param stats - Statistics object
|
|
817
|
+
* @param type - Order type ('buy' or 'sell')
|
|
818
|
+
* @returns Formatted statistics
|
|
819
|
+
*/
|
|
820
|
+
export declare function formatStatistics(stats: StatisticsData, type?: string): string;
|
|
821
|
+
type QueryResult = {
|
|
822
|
+
toString(): string;
|
|
823
|
+
};
|
|
824
|
+
export default class PriceCheckQuerier {
|
|
825
|
+
#private;
|
|
826
|
+
settings: Settings;
|
|
827
|
+
logger: Logger;
|
|
828
|
+
skipMarket: boolean;
|
|
829
|
+
marketFetcher?: MarketFetcherV2 | MarketFetcherLike;
|
|
830
|
+
apiVersion?: 'v1' | 'v2';
|
|
831
|
+
creator: AttachmentCreator;
|
|
832
|
+
/**
|
|
833
|
+
* Creates an instance representing a WarframeNexusStats data object
|
|
834
|
+
* @param options - Querier options
|
|
835
|
+
*/
|
|
836
|
+
constructor({ logger, marketCache, skipMarket }?: PriceCheckQuerierOptions);
|
|
837
|
+
/**
|
|
838
|
+
* Lookup a list of results for a query
|
|
839
|
+
* @param query - Query to search the nexus-stats database against
|
|
840
|
+
* @param platform - Platform to query price data for. One of 'pc', 'ps4', 'xb1'
|
|
841
|
+
* @param options - Optional market order filters (rank, ranks, rankLt, etc.)
|
|
842
|
+
* @returns a Promise of an array of Item objects
|
|
843
|
+
*/
|
|
844
|
+
priceCheckQuery(query: string, platform?: string, options?: PriceCheckOptions): Promise<QueryResult[]>;
|
|
845
|
+
/**
|
|
846
|
+
* Lookup a list of results for a query
|
|
847
|
+
* @param query - Query to search the nexus-stats database against
|
|
848
|
+
* @param priorResults - results provided from a prior search
|
|
849
|
+
* @param platform - Platform to query price data for. One of 'pc', 'ps4', 'xb1'
|
|
850
|
+
* @param options - Optional market order filters (rank, ranks, rankLt, etc.)
|
|
851
|
+
* @returns a Promise of a string containing the results of the query
|
|
852
|
+
*/
|
|
853
|
+
priceCheckQueryString(query: string, priorResults?: QueryResult[], platform?: string, options?: PriceCheckOptions): Promise<string>;
|
|
854
|
+
/**
|
|
855
|
+
* Lookup a list of results for a query
|
|
856
|
+
* @param query - Query to search the nexus-stats database against
|
|
857
|
+
* @param priorResults - results provided from a prior search
|
|
858
|
+
* @param platform - Platform to query price data for. One of 'pc', 'ps4', 'xb1'
|
|
859
|
+
* @param options - Optional market order filters (rank, ranks, rankLt, etc.)
|
|
860
|
+
* @returns a Promise of an array of attachment objects
|
|
861
|
+
*/
|
|
862
|
+
priceCheckQueryAttachment(query: string, priorResults?: QueryResult[], platform?: string, options?: PriceCheckOptions): Promise<DiscordEmbed[]>;
|
|
863
|
+
/**
|
|
864
|
+
* Stop updating caches
|
|
865
|
+
*/
|
|
866
|
+
stopUpdating(): Promise<void>;
|
|
867
|
+
}
|
|
868
|
+
export { type ActivityType, type CalculateStatisticsOptions, type DiscordEmbed, type DiscordEmbedField, type GetBestOrdersOptions, HttpClient, type HttpClientOptions, Item, type ItemData, type Language, type Logger, MarketFetcherV2, type MarketFetcherV2Options, Order, type OrderData, type OrderType, OrderUser, type Platform, type PriceCheckOptions, type QueryOptions, type Rarity, type StatisticsData, SummaryV2 as Summary, SummaryV2, type SummaryPrices, type TraderInfo, type UserStatus, VersionedCache };
|