krawlet-js 1.3.5 → 2.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/dist/index.cjs +71 -43
- package/dist/index.d.cts +140 -33
- package/dist/index.d.ts +140 -33
- package/dist/index.js +71 -43
- package/package.json +8 -7
package/dist/index.cjs
CHANGED
|
@@ -425,7 +425,7 @@ var StorageResource = class {
|
|
|
425
425
|
}
|
|
426
426
|
/**
|
|
427
427
|
* Store ender storage data (requires authentication)
|
|
428
|
-
* @param data -
|
|
428
|
+
* @param data - Ender storage payload to store
|
|
429
429
|
* @param token - Ender Storage API token
|
|
430
430
|
* @returns Success message and timestamp
|
|
431
431
|
* @throws KrawletError with BAD_REQUEST if data is invalid
|
|
@@ -464,11 +464,14 @@ var ReportsResource = class {
|
|
|
464
464
|
* @returns Validation failure records
|
|
465
465
|
*/
|
|
466
466
|
async getValidationFailures(options) {
|
|
467
|
-
const response = await this.client.request(
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
const response = await this.client.request(
|
|
468
|
+
"/v1/reports/validation-failures",
|
|
469
|
+
{
|
|
470
|
+
params: {
|
|
471
|
+
limit: options?.limit || 50
|
|
472
|
+
}
|
|
470
473
|
}
|
|
471
|
-
|
|
474
|
+
);
|
|
472
475
|
return response.data;
|
|
473
476
|
}
|
|
474
477
|
/**
|
|
@@ -478,11 +481,14 @@ var ReportsResource = class {
|
|
|
478
481
|
* @returns Successful post records
|
|
479
482
|
*/
|
|
480
483
|
async getSuccessfulPosts(options) {
|
|
481
|
-
const response = await this.client.request(
|
|
482
|
-
|
|
483
|
-
|
|
484
|
+
const response = await this.client.request(
|
|
485
|
+
"/v1/reports/successful-posts",
|
|
486
|
+
{
|
|
487
|
+
params: {
|
|
488
|
+
limit: options?.limit || 50
|
|
489
|
+
}
|
|
484
490
|
}
|
|
485
|
-
|
|
491
|
+
);
|
|
486
492
|
return response.data;
|
|
487
493
|
}
|
|
488
494
|
/**
|
|
@@ -493,12 +499,18 @@ var ReportsResource = class {
|
|
|
493
499
|
* @returns Shop change event records
|
|
494
500
|
*/
|
|
495
501
|
async getShopChanges(options) {
|
|
496
|
-
const response = await this.client.request(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
502
|
+
const response = await this.client.request(
|
|
503
|
+
"/v1/reports/shop-changes",
|
|
504
|
+
{
|
|
505
|
+
params: {
|
|
506
|
+
limit: options?.limit || 50,
|
|
507
|
+
shopId: options?.shopId,
|
|
508
|
+
since: options?.since,
|
|
509
|
+
until: options?.until,
|
|
510
|
+
source: options?.source
|
|
511
|
+
}
|
|
500
512
|
}
|
|
501
|
-
|
|
513
|
+
);
|
|
502
514
|
return response.data;
|
|
503
515
|
}
|
|
504
516
|
/**
|
|
@@ -509,12 +521,19 @@ var ReportsResource = class {
|
|
|
509
521
|
* @returns Item change event records
|
|
510
522
|
*/
|
|
511
523
|
async getItemChanges(options) {
|
|
512
|
-
const response = await this.client.request(
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
524
|
+
const response = await this.client.request(
|
|
525
|
+
"/v1/reports/item-changes",
|
|
526
|
+
{
|
|
527
|
+
params: {
|
|
528
|
+
limit: options?.limit || 50,
|
|
529
|
+
shopId: options?.shopId,
|
|
530
|
+
changeType: options?.changeType,
|
|
531
|
+
since: options?.since,
|
|
532
|
+
until: options?.until,
|
|
533
|
+
source: options?.source
|
|
534
|
+
}
|
|
516
535
|
}
|
|
517
|
-
|
|
536
|
+
);
|
|
518
537
|
return response.data;
|
|
519
538
|
}
|
|
520
539
|
/**
|
|
@@ -523,15 +542,18 @@ var ReportsResource = class {
|
|
|
523
542
|
* @returns Response containing count (number of logs in this response), total (total logs matching query), and logs (array of ShopChangeLog)
|
|
524
543
|
*/
|
|
525
544
|
async getShopChangeLogs(options) {
|
|
526
|
-
const response = await this.client.request(
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
545
|
+
const response = await this.client.request(
|
|
546
|
+
"/v1/reports/shop-change-logs",
|
|
547
|
+
{
|
|
548
|
+
params: {
|
|
549
|
+
limit: options?.limit,
|
|
550
|
+
offset: options?.offset,
|
|
551
|
+
shopId: options?.shopId,
|
|
552
|
+
since: options?.since,
|
|
553
|
+
until: options?.until
|
|
554
|
+
}
|
|
533
555
|
}
|
|
534
|
-
|
|
556
|
+
);
|
|
535
557
|
return response.data;
|
|
536
558
|
}
|
|
537
559
|
/**
|
|
@@ -540,15 +562,18 @@ var ReportsResource = class {
|
|
|
540
562
|
* @returns Response containing count (number of logs in this response), total (total logs matching query), and logs (array of ItemChangeLog)
|
|
541
563
|
*/
|
|
542
564
|
async getItemChangeLogs(options) {
|
|
543
|
-
const response = await this.client.request(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
565
|
+
const response = await this.client.request(
|
|
566
|
+
"/v1/reports/item-change-logs",
|
|
567
|
+
{
|
|
568
|
+
params: {
|
|
569
|
+
limit: options?.limit,
|
|
570
|
+
offset: options?.offset,
|
|
571
|
+
shopId: options?.shopId,
|
|
572
|
+
since: options?.since,
|
|
573
|
+
until: options?.until
|
|
574
|
+
}
|
|
550
575
|
}
|
|
551
|
-
|
|
576
|
+
);
|
|
552
577
|
return response.data;
|
|
553
578
|
}
|
|
554
579
|
/**
|
|
@@ -557,15 +582,18 @@ var ReportsResource = class {
|
|
|
557
582
|
* @returns Response containing count (number of logs in this response), total (total logs matching query), and logs (array of PriceChangeLog)
|
|
558
583
|
*/
|
|
559
584
|
async getPriceChangeLogs(options) {
|
|
560
|
-
const response = await this.client.request(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
585
|
+
const response = await this.client.request(
|
|
586
|
+
"/v1/reports/price-change-logs",
|
|
587
|
+
{
|
|
588
|
+
params: {
|
|
589
|
+
limit: options?.limit,
|
|
590
|
+
offset: options?.offset,
|
|
591
|
+
shopId: options?.shopId,
|
|
592
|
+
since: options?.since,
|
|
593
|
+
until: options?.until
|
|
594
|
+
}
|
|
567
595
|
}
|
|
568
|
-
|
|
596
|
+
);
|
|
569
597
|
return response.data;
|
|
570
598
|
}
|
|
571
599
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -113,6 +113,66 @@ interface PriceChangeLog {
|
|
|
113
113
|
createdAt: string;
|
|
114
114
|
updatedAt: string;
|
|
115
115
|
}
|
|
116
|
+
interface ShopChangeField {
|
|
117
|
+
field: string;
|
|
118
|
+
previousValue: unknown;
|
|
119
|
+
newValue: unknown;
|
|
120
|
+
}
|
|
121
|
+
interface ReporterStats {
|
|
122
|
+
validationFailures: number;
|
|
123
|
+
successfulPosts: number;
|
|
124
|
+
shopChanges: number;
|
|
125
|
+
itemChanges: number;
|
|
126
|
+
oldestRecord: string | null;
|
|
127
|
+
newestRecord: string | null;
|
|
128
|
+
persistent: {
|
|
129
|
+
shopChanges: number;
|
|
130
|
+
itemChanges: number;
|
|
131
|
+
priceChanges: number;
|
|
132
|
+
total: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
interface ValidationFailureRecord {
|
|
136
|
+
id: string;
|
|
137
|
+
timestamp: string;
|
|
138
|
+
rawData: unknown;
|
|
139
|
+
errors: string[];
|
|
140
|
+
shopName?: string;
|
|
141
|
+
computerId?: number;
|
|
142
|
+
}
|
|
143
|
+
interface SuccessfulPostRecord {
|
|
144
|
+
id: string;
|
|
145
|
+
timestamp: string;
|
|
146
|
+
shopId: string;
|
|
147
|
+
shopName: string;
|
|
148
|
+
rawData: ShopSyncData;
|
|
149
|
+
itemCount: number;
|
|
150
|
+
}
|
|
151
|
+
interface ShopChangeRecord {
|
|
152
|
+
id: string;
|
|
153
|
+
timestamp: string;
|
|
154
|
+
shopId: string;
|
|
155
|
+
shopName: string;
|
|
156
|
+
changes: ShopChangeField[];
|
|
157
|
+
isNewShop: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface ItemSummary {
|
|
160
|
+
name: string;
|
|
161
|
+
displayName: string;
|
|
162
|
+
hash: string;
|
|
163
|
+
}
|
|
164
|
+
interface ItemUpdateSummary extends ItemSummary {
|
|
165
|
+
changes: ShopChangeField[];
|
|
166
|
+
}
|
|
167
|
+
interface ItemChangeRecord {
|
|
168
|
+
id: string;
|
|
169
|
+
timestamp: string;
|
|
170
|
+
shopId: string;
|
|
171
|
+
shopName: string;
|
|
172
|
+
added: ItemSummary[];
|
|
173
|
+
removed: ItemSummary[];
|
|
174
|
+
updated: ItemUpdateSummary[];
|
|
175
|
+
}
|
|
116
176
|
interface ShopSyncData {
|
|
117
177
|
sourceType?: ShopSourceType;
|
|
118
178
|
info: {
|
|
@@ -290,34 +350,64 @@ interface DetailedHealthResponse {
|
|
|
290
350
|
};
|
|
291
351
|
services: HealthServicesDetailed;
|
|
292
352
|
}
|
|
353
|
+
type EnderStorageColor = {
|
|
354
|
+
name: string;
|
|
355
|
+
color: number;
|
|
356
|
+
};
|
|
357
|
+
type EnderStorageItem = {
|
|
358
|
+
name: string;
|
|
359
|
+
displayName: string;
|
|
360
|
+
rawName: string;
|
|
361
|
+
maxCount: number;
|
|
362
|
+
count: number;
|
|
363
|
+
mapColor?: number;
|
|
364
|
+
mapColour?: number;
|
|
365
|
+
itemGroups: Record<string, unknown>;
|
|
366
|
+
tags: Record<string, unknown>;
|
|
367
|
+
[key: string]: unknown;
|
|
368
|
+
};
|
|
369
|
+
type EnderStorageChest = {
|
|
370
|
+
colors: EnderStorageColor[];
|
|
371
|
+
contents: Record<string, EnderStorageItem>;
|
|
372
|
+
name?: string;
|
|
373
|
+
description?: string;
|
|
374
|
+
displayName?: string;
|
|
375
|
+
[key: string]: unknown;
|
|
376
|
+
};
|
|
377
|
+
type EnderStorageCollection = {
|
|
378
|
+
data: EnderStorageChest[];
|
|
379
|
+
retrievedAt: string;
|
|
380
|
+
};
|
|
381
|
+
type EnderStorageMeta = {
|
|
382
|
+
timestamp: string;
|
|
383
|
+
elapsed: number;
|
|
384
|
+
version: string;
|
|
385
|
+
requestId: string;
|
|
386
|
+
[key: string]: unknown;
|
|
387
|
+
};
|
|
388
|
+
type EnderStorageApiPayload = {
|
|
389
|
+
success: boolean;
|
|
390
|
+
data: EnderStorageCollection;
|
|
391
|
+
meta?: EnderStorageMeta;
|
|
392
|
+
[key: string]: unknown;
|
|
393
|
+
};
|
|
394
|
+
type EnderStoragePayload = EnderStorageApiPayload | EnderStorageChest[];
|
|
293
395
|
interface StorageData {
|
|
294
|
-
data:
|
|
396
|
+
data: EnderStorageChest[];
|
|
295
397
|
retrievedAt: string;
|
|
296
398
|
}
|
|
297
|
-
interface ReportRecords {
|
|
298
|
-
count: number;
|
|
299
|
-
records: unknown[];
|
|
300
|
-
}
|
|
301
|
-
interface ChangeLogResult {
|
|
399
|
+
interface ReportRecords<TRecord = unknown> {
|
|
302
400
|
count: number;
|
|
303
|
-
|
|
304
|
-
logs: unknown[];
|
|
401
|
+
records: TRecord[];
|
|
305
402
|
}
|
|
306
|
-
interface
|
|
403
|
+
interface ChangeLogResult<TLog = unknown> {
|
|
307
404
|
count: number;
|
|
308
405
|
total: number;
|
|
309
|
-
logs:
|
|
310
|
-
}
|
|
311
|
-
interface ItemChangeLogResponse {
|
|
312
|
-
count: number;
|
|
313
|
-
total: number;
|
|
314
|
-
logs: ItemChangeLog[];
|
|
315
|
-
}
|
|
316
|
-
interface PriceChangeLogResponse {
|
|
317
|
-
count: number;
|
|
318
|
-
total: number;
|
|
319
|
-
logs: PriceChangeLog[];
|
|
406
|
+
logs: TLog[];
|
|
320
407
|
}
|
|
408
|
+
type ShopChangeLogResponse = ChangeLogResult<ShopChangeLog>;
|
|
409
|
+
type ItemChangeLogResponse = ChangeLogResult<ItemChangeLog>;
|
|
410
|
+
type PriceChangeLogResponse = ChangeLogResult<PriceChangeLog>;
|
|
321
411
|
interface ChangeLogOptions {
|
|
322
412
|
limit?: number;
|
|
323
413
|
offset?: number;
|
|
@@ -325,6 +415,29 @@ interface ChangeLogOptions {
|
|
|
325
415
|
since?: string;
|
|
326
416
|
until?: string;
|
|
327
417
|
}
|
|
418
|
+
interface BaseQueryParams {
|
|
419
|
+
limit?: number;
|
|
420
|
+
offset?: number;
|
|
421
|
+
}
|
|
422
|
+
interface ShopChangesParams extends BaseQueryParams {
|
|
423
|
+
shopId?: string;
|
|
424
|
+
since?: string;
|
|
425
|
+
until?: string;
|
|
426
|
+
source?: 'memory' | 'persistent' | 'both';
|
|
427
|
+
}
|
|
428
|
+
interface ItemChangesParams extends BaseQueryParams {
|
|
429
|
+
shopId?: string;
|
|
430
|
+
changeType?: 'added' | 'removed';
|
|
431
|
+
since?: string;
|
|
432
|
+
until?: string;
|
|
433
|
+
source?: 'memory' | 'persistent' | 'both';
|
|
434
|
+
}
|
|
435
|
+
interface PriceChangesParams extends BaseQueryParams {
|
|
436
|
+
shopId?: string;
|
|
437
|
+
itemHash?: string;
|
|
438
|
+
since?: string;
|
|
439
|
+
until?: string;
|
|
440
|
+
}
|
|
328
441
|
|
|
329
442
|
interface HttpClientConfig {
|
|
330
443
|
baseUrl: string;
|
|
@@ -405,7 +518,7 @@ declare class StorageResource {
|
|
|
405
518
|
private client;
|
|
406
519
|
constructor(client: HttpClient);
|
|
407
520
|
get(): Promise<StorageData>;
|
|
408
|
-
set(data:
|
|
521
|
+
set(data: EnderStoragePayload, token: string): Promise<{
|
|
409
522
|
message: string;
|
|
410
523
|
timestamp: string;
|
|
411
524
|
}>;
|
|
@@ -414,21 +527,15 @@ declare class StorageResource {
|
|
|
414
527
|
declare class ReportsResource {
|
|
415
528
|
private client;
|
|
416
529
|
constructor(client: HttpClient);
|
|
417
|
-
getStats(): Promise<
|
|
530
|
+
getStats(): Promise<ReporterStats>;
|
|
418
531
|
getValidationFailures(options?: {
|
|
419
532
|
limit?: number;
|
|
420
|
-
}): Promise<ReportRecords
|
|
533
|
+
}): Promise<ReportRecords<ValidationFailureRecord>>;
|
|
421
534
|
getSuccessfulPosts(options?: {
|
|
422
535
|
limit?: number;
|
|
423
|
-
}): Promise<ReportRecords
|
|
424
|
-
getShopChanges(options?:
|
|
425
|
-
|
|
426
|
-
shopId?: string;
|
|
427
|
-
}): Promise<ReportRecords>;
|
|
428
|
-
getItemChanges(options?: {
|
|
429
|
-
limit?: number;
|
|
430
|
-
shopId?: string;
|
|
431
|
-
}): Promise<ReportRecords>;
|
|
536
|
+
}): Promise<ReportRecords<SuccessfulPostRecord>>;
|
|
537
|
+
getShopChanges(options?: ShopChangesParams): Promise<ReportRecords<ShopChangeRecord>>;
|
|
538
|
+
getItemChanges(options?: ItemChangesParams): Promise<ReportRecords<ItemChangeRecord>>;
|
|
432
539
|
getShopChangeLogs(options?: ChangeLogOptions): Promise<ShopChangeLogResponse>;
|
|
433
540
|
getItemChangeLogs(options?: ChangeLogOptions): Promise<ItemChangeLogResponse>;
|
|
434
541
|
getPriceChangeLogs(options?: ChangeLogOptions): Promise<PriceChangeLogResponse>;
|
|
@@ -486,4 +593,4 @@ declare class KrawletError extends Error {
|
|
|
486
593
|
isRateLimitError(): boolean;
|
|
487
594
|
}
|
|
488
595
|
|
|
489
|
-
export { AddressesResource, type ApiKeyInfo, ApiKeyResource, type ApiKeyTier, type ApiKeyUsage, type ApiResponse, type ApiResponseMeta, type ChangeLogOptions, type ChangeLogResult, type ChatboxServiceInfo, type DetailedHealthResponse, type DiscordServiceInfo, ErrorCode, type ErrorResponse, type HealthChecks, HealthResource, type HealthResponse, type HealthServices, type HealthServicesDetailed, type Item, type ItemChangeLog, type ItemChangeLogResponse, type ItemChangeType, ItemsResource, type KnownAddress, type KnownAddressType, KrawletClient, type KrawletClientConfig, KrawletError, type KromerServiceInfo, type Player, type PlayerNotifications, PlayersResource, type Price, type PriceChangeLog, type PriceChangeLogResponse, type QuickCodeGenerateResponse, type QuickCodeRedeemResponse, type RateLimit, type ReportRecords, ReportsResource, type RequestLog, type RequestLogsResponse, type ServiceInfo, type ServiceName, type ServiceStatus, type Shop, type ShopChangeLog, type ShopChangeLogResponse, type ShopSourceType, type ShopSyncData, ShopsResource, type StorageData, StorageResource };
|
|
596
|
+
export { AddressesResource, type ApiKeyInfo, ApiKeyResource, type ApiKeyTier, type ApiKeyUsage, type ApiResponse, type ApiResponseMeta, type BaseQueryParams, type ChangeLogOptions, type ChangeLogResult, type ChatboxServiceInfo, type DetailedHealthResponse, type DiscordServiceInfo, type EnderStorageApiPayload, type EnderStorageChest, type EnderStorageCollection, type EnderStorageColor, type EnderStorageItem, type EnderStorageMeta, type EnderStoragePayload, ErrorCode, type ErrorResponse, type HealthChecks, HealthResource, type HealthResponse, type HealthServices, type HealthServicesDetailed, type Item, type ItemChangeLog, type ItemChangeLogResponse, type ItemChangeRecord, type ItemChangeType, type ItemChangesParams, type ItemSummary, type ItemUpdateSummary, ItemsResource, type KnownAddress, type KnownAddressType, KrawletClient, type KrawletClientConfig, KrawletError, type KromerServiceInfo, type Player, type PlayerNotifications, PlayersResource, type Price, type PriceChangeLog, type PriceChangeLogResponse, type PriceChangesParams, type QuickCodeGenerateResponse, type QuickCodeRedeemResponse, type RateLimit, type ReportRecords, type ReporterStats, ReportsResource, type RequestLog, type RequestLogsResponse, type ServiceInfo, type ServiceName, type ServiceStatus, type Shop, type ShopChangeField, type ShopChangeLog, type ShopChangeLogResponse, type ShopChangeRecord, type ShopChangesParams, type ShopSourceType, type ShopSyncData, ShopsResource, type StorageData, StorageResource, type SuccessfulPostRecord, type ValidationFailureRecord };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,66 @@ interface PriceChangeLog {
|
|
|
113
113
|
createdAt: string;
|
|
114
114
|
updatedAt: string;
|
|
115
115
|
}
|
|
116
|
+
interface ShopChangeField {
|
|
117
|
+
field: string;
|
|
118
|
+
previousValue: unknown;
|
|
119
|
+
newValue: unknown;
|
|
120
|
+
}
|
|
121
|
+
interface ReporterStats {
|
|
122
|
+
validationFailures: number;
|
|
123
|
+
successfulPosts: number;
|
|
124
|
+
shopChanges: number;
|
|
125
|
+
itemChanges: number;
|
|
126
|
+
oldestRecord: string | null;
|
|
127
|
+
newestRecord: string | null;
|
|
128
|
+
persistent: {
|
|
129
|
+
shopChanges: number;
|
|
130
|
+
itemChanges: number;
|
|
131
|
+
priceChanges: number;
|
|
132
|
+
total: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
interface ValidationFailureRecord {
|
|
136
|
+
id: string;
|
|
137
|
+
timestamp: string;
|
|
138
|
+
rawData: unknown;
|
|
139
|
+
errors: string[];
|
|
140
|
+
shopName?: string;
|
|
141
|
+
computerId?: number;
|
|
142
|
+
}
|
|
143
|
+
interface SuccessfulPostRecord {
|
|
144
|
+
id: string;
|
|
145
|
+
timestamp: string;
|
|
146
|
+
shopId: string;
|
|
147
|
+
shopName: string;
|
|
148
|
+
rawData: ShopSyncData;
|
|
149
|
+
itemCount: number;
|
|
150
|
+
}
|
|
151
|
+
interface ShopChangeRecord {
|
|
152
|
+
id: string;
|
|
153
|
+
timestamp: string;
|
|
154
|
+
shopId: string;
|
|
155
|
+
shopName: string;
|
|
156
|
+
changes: ShopChangeField[];
|
|
157
|
+
isNewShop: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface ItemSummary {
|
|
160
|
+
name: string;
|
|
161
|
+
displayName: string;
|
|
162
|
+
hash: string;
|
|
163
|
+
}
|
|
164
|
+
interface ItemUpdateSummary extends ItemSummary {
|
|
165
|
+
changes: ShopChangeField[];
|
|
166
|
+
}
|
|
167
|
+
interface ItemChangeRecord {
|
|
168
|
+
id: string;
|
|
169
|
+
timestamp: string;
|
|
170
|
+
shopId: string;
|
|
171
|
+
shopName: string;
|
|
172
|
+
added: ItemSummary[];
|
|
173
|
+
removed: ItemSummary[];
|
|
174
|
+
updated: ItemUpdateSummary[];
|
|
175
|
+
}
|
|
116
176
|
interface ShopSyncData {
|
|
117
177
|
sourceType?: ShopSourceType;
|
|
118
178
|
info: {
|
|
@@ -290,34 +350,64 @@ interface DetailedHealthResponse {
|
|
|
290
350
|
};
|
|
291
351
|
services: HealthServicesDetailed;
|
|
292
352
|
}
|
|
353
|
+
type EnderStorageColor = {
|
|
354
|
+
name: string;
|
|
355
|
+
color: number;
|
|
356
|
+
};
|
|
357
|
+
type EnderStorageItem = {
|
|
358
|
+
name: string;
|
|
359
|
+
displayName: string;
|
|
360
|
+
rawName: string;
|
|
361
|
+
maxCount: number;
|
|
362
|
+
count: number;
|
|
363
|
+
mapColor?: number;
|
|
364
|
+
mapColour?: number;
|
|
365
|
+
itemGroups: Record<string, unknown>;
|
|
366
|
+
tags: Record<string, unknown>;
|
|
367
|
+
[key: string]: unknown;
|
|
368
|
+
};
|
|
369
|
+
type EnderStorageChest = {
|
|
370
|
+
colors: EnderStorageColor[];
|
|
371
|
+
contents: Record<string, EnderStorageItem>;
|
|
372
|
+
name?: string;
|
|
373
|
+
description?: string;
|
|
374
|
+
displayName?: string;
|
|
375
|
+
[key: string]: unknown;
|
|
376
|
+
};
|
|
377
|
+
type EnderStorageCollection = {
|
|
378
|
+
data: EnderStorageChest[];
|
|
379
|
+
retrievedAt: string;
|
|
380
|
+
};
|
|
381
|
+
type EnderStorageMeta = {
|
|
382
|
+
timestamp: string;
|
|
383
|
+
elapsed: number;
|
|
384
|
+
version: string;
|
|
385
|
+
requestId: string;
|
|
386
|
+
[key: string]: unknown;
|
|
387
|
+
};
|
|
388
|
+
type EnderStorageApiPayload = {
|
|
389
|
+
success: boolean;
|
|
390
|
+
data: EnderStorageCollection;
|
|
391
|
+
meta?: EnderStorageMeta;
|
|
392
|
+
[key: string]: unknown;
|
|
393
|
+
};
|
|
394
|
+
type EnderStoragePayload = EnderStorageApiPayload | EnderStorageChest[];
|
|
293
395
|
interface StorageData {
|
|
294
|
-
data:
|
|
396
|
+
data: EnderStorageChest[];
|
|
295
397
|
retrievedAt: string;
|
|
296
398
|
}
|
|
297
|
-
interface ReportRecords {
|
|
298
|
-
count: number;
|
|
299
|
-
records: unknown[];
|
|
300
|
-
}
|
|
301
|
-
interface ChangeLogResult {
|
|
399
|
+
interface ReportRecords<TRecord = unknown> {
|
|
302
400
|
count: number;
|
|
303
|
-
|
|
304
|
-
logs: unknown[];
|
|
401
|
+
records: TRecord[];
|
|
305
402
|
}
|
|
306
|
-
interface
|
|
403
|
+
interface ChangeLogResult<TLog = unknown> {
|
|
307
404
|
count: number;
|
|
308
405
|
total: number;
|
|
309
|
-
logs:
|
|
310
|
-
}
|
|
311
|
-
interface ItemChangeLogResponse {
|
|
312
|
-
count: number;
|
|
313
|
-
total: number;
|
|
314
|
-
logs: ItemChangeLog[];
|
|
315
|
-
}
|
|
316
|
-
interface PriceChangeLogResponse {
|
|
317
|
-
count: number;
|
|
318
|
-
total: number;
|
|
319
|
-
logs: PriceChangeLog[];
|
|
406
|
+
logs: TLog[];
|
|
320
407
|
}
|
|
408
|
+
type ShopChangeLogResponse = ChangeLogResult<ShopChangeLog>;
|
|
409
|
+
type ItemChangeLogResponse = ChangeLogResult<ItemChangeLog>;
|
|
410
|
+
type PriceChangeLogResponse = ChangeLogResult<PriceChangeLog>;
|
|
321
411
|
interface ChangeLogOptions {
|
|
322
412
|
limit?: number;
|
|
323
413
|
offset?: number;
|
|
@@ -325,6 +415,29 @@ interface ChangeLogOptions {
|
|
|
325
415
|
since?: string;
|
|
326
416
|
until?: string;
|
|
327
417
|
}
|
|
418
|
+
interface BaseQueryParams {
|
|
419
|
+
limit?: number;
|
|
420
|
+
offset?: number;
|
|
421
|
+
}
|
|
422
|
+
interface ShopChangesParams extends BaseQueryParams {
|
|
423
|
+
shopId?: string;
|
|
424
|
+
since?: string;
|
|
425
|
+
until?: string;
|
|
426
|
+
source?: 'memory' | 'persistent' | 'both';
|
|
427
|
+
}
|
|
428
|
+
interface ItemChangesParams extends BaseQueryParams {
|
|
429
|
+
shopId?: string;
|
|
430
|
+
changeType?: 'added' | 'removed';
|
|
431
|
+
since?: string;
|
|
432
|
+
until?: string;
|
|
433
|
+
source?: 'memory' | 'persistent' | 'both';
|
|
434
|
+
}
|
|
435
|
+
interface PriceChangesParams extends BaseQueryParams {
|
|
436
|
+
shopId?: string;
|
|
437
|
+
itemHash?: string;
|
|
438
|
+
since?: string;
|
|
439
|
+
until?: string;
|
|
440
|
+
}
|
|
328
441
|
|
|
329
442
|
interface HttpClientConfig {
|
|
330
443
|
baseUrl: string;
|
|
@@ -405,7 +518,7 @@ declare class StorageResource {
|
|
|
405
518
|
private client;
|
|
406
519
|
constructor(client: HttpClient);
|
|
407
520
|
get(): Promise<StorageData>;
|
|
408
|
-
set(data:
|
|
521
|
+
set(data: EnderStoragePayload, token: string): Promise<{
|
|
409
522
|
message: string;
|
|
410
523
|
timestamp: string;
|
|
411
524
|
}>;
|
|
@@ -414,21 +527,15 @@ declare class StorageResource {
|
|
|
414
527
|
declare class ReportsResource {
|
|
415
528
|
private client;
|
|
416
529
|
constructor(client: HttpClient);
|
|
417
|
-
getStats(): Promise<
|
|
530
|
+
getStats(): Promise<ReporterStats>;
|
|
418
531
|
getValidationFailures(options?: {
|
|
419
532
|
limit?: number;
|
|
420
|
-
}): Promise<ReportRecords
|
|
533
|
+
}): Promise<ReportRecords<ValidationFailureRecord>>;
|
|
421
534
|
getSuccessfulPosts(options?: {
|
|
422
535
|
limit?: number;
|
|
423
|
-
}): Promise<ReportRecords
|
|
424
|
-
getShopChanges(options?:
|
|
425
|
-
|
|
426
|
-
shopId?: string;
|
|
427
|
-
}): Promise<ReportRecords>;
|
|
428
|
-
getItemChanges(options?: {
|
|
429
|
-
limit?: number;
|
|
430
|
-
shopId?: string;
|
|
431
|
-
}): Promise<ReportRecords>;
|
|
536
|
+
}): Promise<ReportRecords<SuccessfulPostRecord>>;
|
|
537
|
+
getShopChanges(options?: ShopChangesParams): Promise<ReportRecords<ShopChangeRecord>>;
|
|
538
|
+
getItemChanges(options?: ItemChangesParams): Promise<ReportRecords<ItemChangeRecord>>;
|
|
432
539
|
getShopChangeLogs(options?: ChangeLogOptions): Promise<ShopChangeLogResponse>;
|
|
433
540
|
getItemChangeLogs(options?: ChangeLogOptions): Promise<ItemChangeLogResponse>;
|
|
434
541
|
getPriceChangeLogs(options?: ChangeLogOptions): Promise<PriceChangeLogResponse>;
|
|
@@ -486,4 +593,4 @@ declare class KrawletError extends Error {
|
|
|
486
593
|
isRateLimitError(): boolean;
|
|
487
594
|
}
|
|
488
595
|
|
|
489
|
-
export { AddressesResource, type ApiKeyInfo, ApiKeyResource, type ApiKeyTier, type ApiKeyUsage, type ApiResponse, type ApiResponseMeta, type ChangeLogOptions, type ChangeLogResult, type ChatboxServiceInfo, type DetailedHealthResponse, type DiscordServiceInfo, ErrorCode, type ErrorResponse, type HealthChecks, HealthResource, type HealthResponse, type HealthServices, type HealthServicesDetailed, type Item, type ItemChangeLog, type ItemChangeLogResponse, type ItemChangeType, ItemsResource, type KnownAddress, type KnownAddressType, KrawletClient, type KrawletClientConfig, KrawletError, type KromerServiceInfo, type Player, type PlayerNotifications, PlayersResource, type Price, type PriceChangeLog, type PriceChangeLogResponse, type QuickCodeGenerateResponse, type QuickCodeRedeemResponse, type RateLimit, type ReportRecords, ReportsResource, type RequestLog, type RequestLogsResponse, type ServiceInfo, type ServiceName, type ServiceStatus, type Shop, type ShopChangeLog, type ShopChangeLogResponse, type ShopSourceType, type ShopSyncData, ShopsResource, type StorageData, StorageResource };
|
|
596
|
+
export { AddressesResource, type ApiKeyInfo, ApiKeyResource, type ApiKeyTier, type ApiKeyUsage, type ApiResponse, type ApiResponseMeta, type BaseQueryParams, type ChangeLogOptions, type ChangeLogResult, type ChatboxServiceInfo, type DetailedHealthResponse, type DiscordServiceInfo, type EnderStorageApiPayload, type EnderStorageChest, type EnderStorageCollection, type EnderStorageColor, type EnderStorageItem, type EnderStorageMeta, type EnderStoragePayload, ErrorCode, type ErrorResponse, type HealthChecks, HealthResource, type HealthResponse, type HealthServices, type HealthServicesDetailed, type Item, type ItemChangeLog, type ItemChangeLogResponse, type ItemChangeRecord, type ItemChangeType, type ItemChangesParams, type ItemSummary, type ItemUpdateSummary, ItemsResource, type KnownAddress, type KnownAddressType, KrawletClient, type KrawletClientConfig, KrawletError, type KromerServiceInfo, type Player, type PlayerNotifications, PlayersResource, type Price, type PriceChangeLog, type PriceChangeLogResponse, type PriceChangesParams, type QuickCodeGenerateResponse, type QuickCodeRedeemResponse, type RateLimit, type ReportRecords, type ReporterStats, ReportsResource, type RequestLog, type RequestLogsResponse, type ServiceInfo, type ServiceName, type ServiceStatus, type Shop, type ShopChangeField, type ShopChangeLog, type ShopChangeLogResponse, type ShopChangeRecord, type ShopChangesParams, type ShopSourceType, type ShopSyncData, ShopsResource, type StorageData, StorageResource, type SuccessfulPostRecord, type ValidationFailureRecord };
|
package/dist/index.js
CHANGED
|
@@ -389,7 +389,7 @@ var StorageResource = class {
|
|
|
389
389
|
}
|
|
390
390
|
/**
|
|
391
391
|
* Store ender storage data (requires authentication)
|
|
392
|
-
* @param data -
|
|
392
|
+
* @param data - Ender storage payload to store
|
|
393
393
|
* @param token - Ender Storage API token
|
|
394
394
|
* @returns Success message and timestamp
|
|
395
395
|
* @throws KrawletError with BAD_REQUEST if data is invalid
|
|
@@ -428,11 +428,14 @@ var ReportsResource = class {
|
|
|
428
428
|
* @returns Validation failure records
|
|
429
429
|
*/
|
|
430
430
|
async getValidationFailures(options) {
|
|
431
|
-
const response = await this.client.request(
|
|
432
|
-
|
|
433
|
-
|
|
431
|
+
const response = await this.client.request(
|
|
432
|
+
"/v1/reports/validation-failures",
|
|
433
|
+
{
|
|
434
|
+
params: {
|
|
435
|
+
limit: options?.limit || 50
|
|
436
|
+
}
|
|
434
437
|
}
|
|
435
|
-
|
|
438
|
+
);
|
|
436
439
|
return response.data;
|
|
437
440
|
}
|
|
438
441
|
/**
|
|
@@ -442,11 +445,14 @@ var ReportsResource = class {
|
|
|
442
445
|
* @returns Successful post records
|
|
443
446
|
*/
|
|
444
447
|
async getSuccessfulPosts(options) {
|
|
445
|
-
const response = await this.client.request(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
+
const response = await this.client.request(
|
|
449
|
+
"/v1/reports/successful-posts",
|
|
450
|
+
{
|
|
451
|
+
params: {
|
|
452
|
+
limit: options?.limit || 50
|
|
453
|
+
}
|
|
448
454
|
}
|
|
449
|
-
|
|
455
|
+
);
|
|
450
456
|
return response.data;
|
|
451
457
|
}
|
|
452
458
|
/**
|
|
@@ -457,12 +463,18 @@ var ReportsResource = class {
|
|
|
457
463
|
* @returns Shop change event records
|
|
458
464
|
*/
|
|
459
465
|
async getShopChanges(options) {
|
|
460
|
-
const response = await this.client.request(
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
466
|
+
const response = await this.client.request(
|
|
467
|
+
"/v1/reports/shop-changes",
|
|
468
|
+
{
|
|
469
|
+
params: {
|
|
470
|
+
limit: options?.limit || 50,
|
|
471
|
+
shopId: options?.shopId,
|
|
472
|
+
since: options?.since,
|
|
473
|
+
until: options?.until,
|
|
474
|
+
source: options?.source
|
|
475
|
+
}
|
|
464
476
|
}
|
|
465
|
-
|
|
477
|
+
);
|
|
466
478
|
return response.data;
|
|
467
479
|
}
|
|
468
480
|
/**
|
|
@@ -473,12 +485,19 @@ var ReportsResource = class {
|
|
|
473
485
|
* @returns Item change event records
|
|
474
486
|
*/
|
|
475
487
|
async getItemChanges(options) {
|
|
476
|
-
const response = await this.client.request(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
488
|
+
const response = await this.client.request(
|
|
489
|
+
"/v1/reports/item-changes",
|
|
490
|
+
{
|
|
491
|
+
params: {
|
|
492
|
+
limit: options?.limit || 50,
|
|
493
|
+
shopId: options?.shopId,
|
|
494
|
+
changeType: options?.changeType,
|
|
495
|
+
since: options?.since,
|
|
496
|
+
until: options?.until,
|
|
497
|
+
source: options?.source
|
|
498
|
+
}
|
|
480
499
|
}
|
|
481
|
-
|
|
500
|
+
);
|
|
482
501
|
return response.data;
|
|
483
502
|
}
|
|
484
503
|
/**
|
|
@@ -487,15 +506,18 @@ var ReportsResource = class {
|
|
|
487
506
|
* @returns Response containing count (number of logs in this response), total (total logs matching query), and logs (array of ShopChangeLog)
|
|
488
507
|
*/
|
|
489
508
|
async getShopChangeLogs(options) {
|
|
490
|
-
const response = await this.client.request(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
509
|
+
const response = await this.client.request(
|
|
510
|
+
"/v1/reports/shop-change-logs",
|
|
511
|
+
{
|
|
512
|
+
params: {
|
|
513
|
+
limit: options?.limit,
|
|
514
|
+
offset: options?.offset,
|
|
515
|
+
shopId: options?.shopId,
|
|
516
|
+
since: options?.since,
|
|
517
|
+
until: options?.until
|
|
518
|
+
}
|
|
497
519
|
}
|
|
498
|
-
|
|
520
|
+
);
|
|
499
521
|
return response.data;
|
|
500
522
|
}
|
|
501
523
|
/**
|
|
@@ -504,15 +526,18 @@ var ReportsResource = class {
|
|
|
504
526
|
* @returns Response containing count (number of logs in this response), total (total logs matching query), and logs (array of ItemChangeLog)
|
|
505
527
|
*/
|
|
506
528
|
async getItemChangeLogs(options) {
|
|
507
|
-
const response = await this.client.request(
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
529
|
+
const response = await this.client.request(
|
|
530
|
+
"/v1/reports/item-change-logs",
|
|
531
|
+
{
|
|
532
|
+
params: {
|
|
533
|
+
limit: options?.limit,
|
|
534
|
+
offset: options?.offset,
|
|
535
|
+
shopId: options?.shopId,
|
|
536
|
+
since: options?.since,
|
|
537
|
+
until: options?.until
|
|
538
|
+
}
|
|
514
539
|
}
|
|
515
|
-
|
|
540
|
+
);
|
|
516
541
|
return response.data;
|
|
517
542
|
}
|
|
518
543
|
/**
|
|
@@ -521,15 +546,18 @@ var ReportsResource = class {
|
|
|
521
546
|
* @returns Response containing count (number of logs in this response), total (total logs matching query), and logs (array of PriceChangeLog)
|
|
522
547
|
*/
|
|
523
548
|
async getPriceChangeLogs(options) {
|
|
524
|
-
const response = await this.client.request(
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
549
|
+
const response = await this.client.request(
|
|
550
|
+
"/v1/reports/price-change-logs",
|
|
551
|
+
{
|
|
552
|
+
params: {
|
|
553
|
+
limit: options?.limit,
|
|
554
|
+
offset: options?.offset,
|
|
555
|
+
shopId: options?.shopId,
|
|
556
|
+
since: options?.since,
|
|
557
|
+
until: options?.until
|
|
558
|
+
}
|
|
531
559
|
}
|
|
532
|
-
|
|
560
|
+
);
|
|
533
561
|
return response.data;
|
|
534
562
|
}
|
|
535
563
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "krawlet-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "TypeScript/JavaScript client library for the Krawlet Minecraft economy tracking API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -31,14 +31,15 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.10.5",
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
35
|
-
"@typescript-eslint/parser": "^8.
|
|
36
|
-
"@vitest/coverage-v8": "^
|
|
37
|
-
"eslint": "^9.
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
35
|
+
"@typescript-eslint/parser": "^8.58.1",
|
|
36
|
+
"@vitest/coverage-v8": "^4.1.4",
|
|
37
|
+
"eslint": "^9.39.4",
|
|
38
38
|
"prettier": "^3.4.2",
|
|
39
|
-
"tsup": "^8.
|
|
39
|
+
"tsup": "^8.5.1",
|
|
40
40
|
"typescript": "^5.7.2",
|
|
41
|
-
"
|
|
41
|
+
"vite": "^8.0.8",
|
|
42
|
+
"vitest": "^4.1.4"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|