krawlet-js 2.0.1 → 2.1.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 CHANGED
@@ -30,7 +30,8 @@ __export(index_exports, {
30
30
  PlayersResource: () => PlayersResource,
31
31
  ReportsResource: () => ReportsResource,
32
32
  ShopsResource: () => ShopsResource,
33
- StorageResource: () => StorageResource
33
+ StorageResource: () => StorageResource,
34
+ TransfersResource: () => TransfersResource
34
35
  });
35
36
  module.exports = __toCommonJS(index_exports);
36
37
 
@@ -749,6 +750,84 @@ var ApiKeyResource = class {
749
750
  }
750
751
  };
751
752
 
753
+ // src/resources/transfers.ts
754
+ var TransfersResource = class {
755
+ constructor(client) {
756
+ this.client = client;
757
+ }
758
+ /**
759
+ * List all transfers where the authenticated player is sender or recipient
760
+ * @returns Array of transfer records
761
+ */
762
+ async getAll() {
763
+ const response = await this.client.request("/v1/transfers");
764
+ return response.data;
765
+ }
766
+ /**
767
+ * Queue a new transfer request
768
+ * @param data - Transfer request payload
769
+ * @returns Transfer record
770
+ */
771
+ async create(data) {
772
+ const response = await this.client.request("/v1/transfers", {
773
+ method: "POST",
774
+ body: data
775
+ });
776
+ return response.data;
777
+ }
778
+ /**
779
+ * Retrieve transfer details by ID
780
+ * @param transferId - Transfer UUID
781
+ * @returns Transfer record
782
+ */
783
+ async get(transferId) {
784
+ const response = await this.client.request(`/v1/transfers/${transferId}`);
785
+ return response.data;
786
+ }
787
+ /**
788
+ * Cancel a pending or in-progress transfer
789
+ * @param transferId - Transfer UUID
790
+ * @returns Updated transfer record
791
+ */
792
+ async cancel(transferId) {
793
+ const response = await this.client.request(`/v1/transfers/${transferId}/cancel`, {
794
+ method: "POST"
795
+ });
796
+ return response.data;
797
+ }
798
+ /**
799
+ * Get current ender storage contents for the authenticated player
800
+ * @returns Contents snapshot
801
+ */
802
+ async getContents() {
803
+ const response = await this.client.request("/v1/transfers/contents");
804
+ return response.data;
805
+ }
806
+ /**
807
+ * List active transfer targets available to the authenticated user
808
+ * @returns Array of transfer targets
809
+ */
810
+ async getTargets() {
811
+ const response = await this.client.request("/v1/transfers/targets");
812
+ return response.data;
813
+ }
814
+ /**
815
+ * Request transfer from public/service storage into the authenticated player's storage
816
+ * @param data - Public storage transfer payload
817
+ * @returns Transfer and resolved source entity information
818
+ */
819
+ async requestPublicStorage(data) {
820
+ const response = await this.client.request(
821
+ "/v1/requests/public-storage",
822
+ {
823
+ method: "POST",
824
+ body: data
825
+ }
826
+ );
827
+ return response.data;
828
+ }
829
+ };
830
+
752
831
  // src/client.ts
753
832
  var KrawletClient = class {
754
833
  /**
@@ -774,6 +853,7 @@ var KrawletClient = class {
774
853
  this.storage = new StorageResource(this.httpClient);
775
854
  this.reports = new ReportsResource(this.httpClient);
776
855
  this.apiKey = new ApiKeyResource(this.httpClient);
856
+ this.transfers = new TransfersResource(this.httpClient);
777
857
  }
778
858
  /**
779
859
  * Get the last known rate limit information
@@ -813,5 +893,6 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
813
893
  PlayersResource,
814
894
  ReportsResource,
815
895
  ShopsResource,
816
- StorageResource
896
+ StorageResource,
897
+ TransfersResource
817
898
  });
package/dist/index.d.cts CHANGED
@@ -396,6 +396,68 @@ interface StorageData {
396
396
  data: EnderStorageChest[];
397
397
  retrievedAt: string;
398
398
  }
399
+ interface StorageSlotItem {
400
+ name: string;
401
+ count: number;
402
+ nbt?: string | null;
403
+ }
404
+ interface StorageSlotContents {
405
+ items: StorageSlotItem[];
406
+ }
407
+ interface TransferTargetLink {
408
+ type: string;
409
+ value: string;
410
+ }
411
+ interface TransferTarget {
412
+ id: string;
413
+ name: string;
414
+ type: string;
415
+ links: TransferTargetLink[];
416
+ }
417
+ type TransferStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled';
418
+ interface Transfer {
419
+ id: string;
420
+ status: TransferStatus;
421
+ error: string | null;
422
+ workerId?: number | null;
423
+ fromUUID: string;
424
+ fromUsername: string;
425
+ toUUID: string;
426
+ toUsername: string;
427
+ itemName: string | null;
428
+ itemNbt: string | null;
429
+ memo: string;
430
+ quantity: number | null;
431
+ quantityTransferred: number;
432
+ timestamp: string;
433
+ }
434
+ interface TransferCreateRequest {
435
+ to: string;
436
+ itemName?: string;
437
+ itemNbt?: string;
438
+ memo: string;
439
+ quantity?: number;
440
+ timeout?: number;
441
+ }
442
+ type EStorageEntityType = 'private' | 'service' | 'public' | 'public_storage';
443
+ interface PublicStorageSourceEntity {
444
+ id: string;
445
+ name: string;
446
+ type: EStorageEntityType;
447
+ alias?: string;
448
+ }
449
+ interface PublicStorageTransferRequest {
450
+ itemName: string;
451
+ itemNbt?: string;
452
+ quantity: number;
453
+ timeout?: number;
454
+ source?: string;
455
+ colors?: [number, number, number];
456
+ }
457
+ interface PublicStorageTransferResponse {
458
+ transfer: Transfer;
459
+ sourceEntity: PublicStorageSourceEntity;
460
+ }
399
461
  interface ReportRecords<TRecord = unknown> {
400
462
  count: number;
401
463
  records: TRecord[];
@@ -558,6 +620,18 @@ declare class ApiKeyResource {
558
620
  redeemQuickCode(code: string): Promise<QuickCodeRedeemResponse>;
559
621
  }
560
622
 
623
+ declare class TransfersResource {
624
+ private client;
625
+ constructor(client: HttpClient);
626
+ getAll(): Promise<Transfer[]>;
627
+ create(data: TransferCreateRequest): Promise<Transfer>;
628
+ get(transferId: string): Promise<Transfer>;
629
+ cancel(transferId: string): Promise<Transfer>;
630
+ getContents(): Promise<StorageSlotContents>;
631
+ getTargets(): Promise<TransferTarget[]>;
632
+ requestPublicStorage(data: PublicStorageTransferRequest): Promise<PublicStorageTransferResponse>;
633
+ }
634
+
561
635
  interface KrawletClientConfig {
562
636
  baseUrl?: string;
563
637
  apiKey?: string;
@@ -577,6 +651,7 @@ declare class KrawletClient {
577
651
  readonly storage: StorageResource;
578
652
  readonly reports: ReportsResource;
579
653
  readonly apiKey: ApiKeyResource;
654
+ readonly transfers: TransfersResource;
580
655
  constructor(config?: KrawletClientConfig);
581
656
  getRateLimit(): RateLimit | undefined;
582
657
  }
@@ -593,4 +668,4 @@ declare class KrawletError extends Error {
593
668
  isRateLimitError(): boolean;
594
669
  }
595
670
 
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 };
671
+ 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 EStorageEntityType, 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 PublicStorageSourceEntity, type PublicStorageTransferRequest, type PublicStorageTransferResponse, 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 StorageSlotContents, type StorageSlotItem, type SuccessfulPostRecord, type Transfer, type TransferCreateRequest, type TransferStatus, type TransferTarget, type TransferTargetLink, TransfersResource, type ValidationFailureRecord };
package/dist/index.d.ts CHANGED
@@ -396,6 +396,68 @@ interface StorageData {
396
396
  data: EnderStorageChest[];
397
397
  retrievedAt: string;
398
398
  }
399
+ interface StorageSlotItem {
400
+ name: string;
401
+ count: number;
402
+ nbt?: string | null;
403
+ }
404
+ interface StorageSlotContents {
405
+ items: StorageSlotItem[];
406
+ }
407
+ interface TransferTargetLink {
408
+ type: string;
409
+ value: string;
410
+ }
411
+ interface TransferTarget {
412
+ id: string;
413
+ name: string;
414
+ type: string;
415
+ links: TransferTargetLink[];
416
+ }
417
+ type TransferStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled';
418
+ interface Transfer {
419
+ id: string;
420
+ status: TransferStatus;
421
+ error: string | null;
422
+ workerId?: number | null;
423
+ fromUUID: string;
424
+ fromUsername: string;
425
+ toUUID: string;
426
+ toUsername: string;
427
+ itemName: string | null;
428
+ itemNbt: string | null;
429
+ memo: string;
430
+ quantity: number | null;
431
+ quantityTransferred: number;
432
+ timestamp: string;
433
+ }
434
+ interface TransferCreateRequest {
435
+ to: string;
436
+ itemName?: string;
437
+ itemNbt?: string;
438
+ memo: string;
439
+ quantity?: number;
440
+ timeout?: number;
441
+ }
442
+ type EStorageEntityType = 'private' | 'service' | 'public' | 'public_storage';
443
+ interface PublicStorageSourceEntity {
444
+ id: string;
445
+ name: string;
446
+ type: EStorageEntityType;
447
+ alias?: string;
448
+ }
449
+ interface PublicStorageTransferRequest {
450
+ itemName: string;
451
+ itemNbt?: string;
452
+ quantity: number;
453
+ timeout?: number;
454
+ source?: string;
455
+ colors?: [number, number, number];
456
+ }
457
+ interface PublicStorageTransferResponse {
458
+ transfer: Transfer;
459
+ sourceEntity: PublicStorageSourceEntity;
460
+ }
399
461
  interface ReportRecords<TRecord = unknown> {
400
462
  count: number;
401
463
  records: TRecord[];
@@ -558,6 +620,18 @@ declare class ApiKeyResource {
558
620
  redeemQuickCode(code: string): Promise<QuickCodeRedeemResponse>;
559
621
  }
560
622
 
623
+ declare class TransfersResource {
624
+ private client;
625
+ constructor(client: HttpClient);
626
+ getAll(): Promise<Transfer[]>;
627
+ create(data: TransferCreateRequest): Promise<Transfer>;
628
+ get(transferId: string): Promise<Transfer>;
629
+ cancel(transferId: string): Promise<Transfer>;
630
+ getContents(): Promise<StorageSlotContents>;
631
+ getTargets(): Promise<TransferTarget[]>;
632
+ requestPublicStorage(data: PublicStorageTransferRequest): Promise<PublicStorageTransferResponse>;
633
+ }
634
+
561
635
  interface KrawletClientConfig {
562
636
  baseUrl?: string;
563
637
  apiKey?: string;
@@ -577,6 +651,7 @@ declare class KrawletClient {
577
651
  readonly storage: StorageResource;
578
652
  readonly reports: ReportsResource;
579
653
  readonly apiKey: ApiKeyResource;
654
+ readonly transfers: TransfersResource;
580
655
  constructor(config?: KrawletClientConfig);
581
656
  getRateLimit(): RateLimit | undefined;
582
657
  }
@@ -593,4 +668,4 @@ declare class KrawletError extends Error {
593
668
  isRateLimitError(): boolean;
594
669
  }
595
670
 
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 };
671
+ 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 EStorageEntityType, 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 PublicStorageSourceEntity, type PublicStorageTransferRequest, type PublicStorageTransferResponse, 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 StorageSlotContents, type StorageSlotItem, type SuccessfulPostRecord, type Transfer, type TransferCreateRequest, type TransferStatus, type TransferTarget, type TransferTargetLink, TransfersResource, type ValidationFailureRecord };
package/dist/index.js CHANGED
@@ -713,6 +713,84 @@ var ApiKeyResource = class {
713
713
  }
714
714
  };
715
715
 
716
+ // src/resources/transfers.ts
717
+ var TransfersResource = class {
718
+ constructor(client) {
719
+ this.client = client;
720
+ }
721
+ /**
722
+ * List all transfers where the authenticated player is sender or recipient
723
+ * @returns Array of transfer records
724
+ */
725
+ async getAll() {
726
+ const response = await this.client.request("/v1/transfers");
727
+ return response.data;
728
+ }
729
+ /**
730
+ * Queue a new transfer request
731
+ * @param data - Transfer request payload
732
+ * @returns Transfer record
733
+ */
734
+ async create(data) {
735
+ const response = await this.client.request("/v1/transfers", {
736
+ method: "POST",
737
+ body: data
738
+ });
739
+ return response.data;
740
+ }
741
+ /**
742
+ * Retrieve transfer details by ID
743
+ * @param transferId - Transfer UUID
744
+ * @returns Transfer record
745
+ */
746
+ async get(transferId) {
747
+ const response = await this.client.request(`/v1/transfers/${transferId}`);
748
+ return response.data;
749
+ }
750
+ /**
751
+ * Cancel a pending or in-progress transfer
752
+ * @param transferId - Transfer UUID
753
+ * @returns Updated transfer record
754
+ */
755
+ async cancel(transferId) {
756
+ const response = await this.client.request(`/v1/transfers/${transferId}/cancel`, {
757
+ method: "POST"
758
+ });
759
+ return response.data;
760
+ }
761
+ /**
762
+ * Get current ender storage contents for the authenticated player
763
+ * @returns Contents snapshot
764
+ */
765
+ async getContents() {
766
+ const response = await this.client.request("/v1/transfers/contents");
767
+ return response.data;
768
+ }
769
+ /**
770
+ * List active transfer targets available to the authenticated user
771
+ * @returns Array of transfer targets
772
+ */
773
+ async getTargets() {
774
+ const response = await this.client.request("/v1/transfers/targets");
775
+ return response.data;
776
+ }
777
+ /**
778
+ * Request transfer from public/service storage into the authenticated player's storage
779
+ * @param data - Public storage transfer payload
780
+ * @returns Transfer and resolved source entity information
781
+ */
782
+ async requestPublicStorage(data) {
783
+ const response = await this.client.request(
784
+ "/v1/requests/public-storage",
785
+ {
786
+ method: "POST",
787
+ body: data
788
+ }
789
+ );
790
+ return response.data;
791
+ }
792
+ };
793
+
716
794
  // src/client.ts
717
795
  var KrawletClient = class {
718
796
  /**
@@ -738,6 +816,7 @@ var KrawletClient = class {
738
816
  this.storage = new StorageResource(this.httpClient);
739
817
  this.reports = new ReportsResource(this.httpClient);
740
818
  this.apiKey = new ApiKeyResource(this.httpClient);
819
+ this.transfers = new TransfersResource(this.httpClient);
741
820
  }
742
821
  /**
743
822
  * Get the last known rate limit information
@@ -776,5 +855,6 @@ export {
776
855
  PlayersResource,
777
856
  ReportsResource,
778
857
  ShopsResource,
779
- StorageResource
858
+ StorageResource,
859
+ TransfersResource
780
860
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "krawlet-js",
3
- "version": "2.0.1",
3
+ "version": "2.1.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",