poe-api-manager 1.2.18 → 1.2.19
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/Changelog.md +6 -0
- package/README.md +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -0
- package/dist/lib/AbstractClass/PoeNinja.d.ts +6 -7
- package/dist/lib/AbstractClass/PoeNinja.js +6 -7
- package/dist/lib/AbstractClass/PoeWatch.d.ts +11 -3
- package/dist/lib/AbstractClass/PoeWatch.js +11 -3
- package/dist/lib/Utils.d.ts +3 -2
- package/dist/lib/Utils.js +3 -2
- package/dist/lib/errors/ApiError.d.ts +12 -0
- package/dist/lib/errors/ApiError.js +12 -0
- package/dist/lib/errors/CustomError.d.ts +7 -0
- package/dist/lib/errors/CustomError.js +7 -0
- package/dist/lib/errors/ValidationError.d.ts +8 -0
- package/dist/lib/errors/ValidationError.js +8 -0
- package/dist/lib/mainfunctions/propertyFilter.d.ts +3 -3
- package/dist/lib/mainfunctions/propertyFilter.js +3 -3
- package/dist/lib/modules/poe.watch/WatchViewModule.d.ts +4 -1
- package/dist/lib/modules/poe.watch/WatchViewModule.js +7 -7
- package/dist/lib/modules/poe.watch/allModules/subModules/DivsModule.js +1 -1
- package/dist/lib/modules/poe.watch/allModules/subModules/UniqueMapsModule.js +1 -1
- package/package.json +1 -1
- package/tsconfig.json +11 -12
package/Changelog.md
CHANGED
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Main Entry Point for the poe-api-manager package.
|
|
4
|
+
* This file exports the main classes and functions.
|
|
5
|
+
* @module poe-api-manager
|
|
6
|
+
*/
|
|
2
7
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
9
|
};
|
|
@@ -12,17 +12,16 @@ declare abstract class PoeNinja implements IPoeNinja {
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents a PoeNinja object.
|
|
14
14
|
* @constructor
|
|
15
|
-
* @param league - The league name.
|
|
16
|
-
* @param typeName
|
|
17
|
-
* @param type - The type.
|
|
18
|
-
* @implements {IPoeNinja}
|
|
15
|
+
* @param {string} league - The league name.
|
|
16
|
+
* @param {string} typeName
|
|
17
|
+
* @param {string} type - The type.
|
|
19
18
|
*/
|
|
20
19
|
constructor(league: string, typeName: string, type: string);
|
|
21
20
|
/**
|
|
22
21
|
* Retrieves data from the API based on the specified league, type name, and type.
|
|
23
|
-
* @param requestedProperties - Optional array of properties to include in the retrieved data.
|
|
24
|
-
* @returns A promise that resolves to an array of objects containing the retrieved data.
|
|
25
|
-
* @throws If there is an error retrieving the data.
|
|
22
|
+
* @param {string} requestedProperties - Optional array of properties to include in the retrieved data.
|
|
23
|
+
* @returns {Promise<object[]>} A promise that resolves to an array of objects containing the retrieved data.
|
|
24
|
+
* @throws {Error} If there is an error retrieving the data.
|
|
26
25
|
*/
|
|
27
26
|
getData(requestedProperties?: string[]): Promise<object[]>;
|
|
28
27
|
}
|
|
@@ -17,10 +17,9 @@ class PoeNinja {
|
|
|
17
17
|
/**
|
|
18
18
|
* Represents a PoeNinja object.
|
|
19
19
|
* @constructor
|
|
20
|
-
* @param league - The league name.
|
|
21
|
-
* @param typeName
|
|
22
|
-
* @param type - The type.
|
|
23
|
-
* @implements {IPoeNinja}
|
|
20
|
+
* @param {string} league - The league name.
|
|
21
|
+
* @param {string} typeName
|
|
22
|
+
* @param {string} type - The type.
|
|
24
23
|
*/
|
|
25
24
|
constructor(league, typeName, type) {
|
|
26
25
|
this.league = league;
|
|
@@ -29,9 +28,9 @@ class PoeNinja {
|
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* Retrieves data from the API based on the specified league, type name, and type.
|
|
32
|
-
* @param requestedProperties - Optional array of properties to include in the retrieved data.
|
|
33
|
-
* @returns A promise that resolves to an array of objects containing the retrieved data.
|
|
34
|
-
* @throws If there is an error retrieving the data.
|
|
31
|
+
* @param {string} requestedProperties - Optional array of properties to include in the retrieved data.
|
|
32
|
+
* @returns {Promise<object[]>} A promise that resolves to an array of objects containing the retrieved data.
|
|
33
|
+
* @throws {Error} If there is an error retrieving the data.
|
|
35
34
|
*/
|
|
36
35
|
async getData(requestedProperties) {
|
|
37
36
|
try {
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import IPoeWatch from "../Interfaces/IPoeWatch";
|
|
2
2
|
/**
|
|
3
3
|
* Represents an abstract class for interacting with the PoeWatch API.
|
|
4
|
+
* @abstract
|
|
5
|
+
* @class
|
|
6
|
+
* @implements {IPoeWatch}
|
|
4
7
|
*/
|
|
5
8
|
declare abstract class PoeWatch implements IPoeWatch {
|
|
6
9
|
protected readonly league: string;
|
|
7
10
|
protected readonly type: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new instance of PoeWatch.
|
|
13
|
+
* @param {string} league - The league name to get data from.
|
|
14
|
+
* @param {string} type - The type of data to retrieve (e.g. 'currency', 'items', etc.).
|
|
15
|
+
*/
|
|
8
16
|
constructor(league: string, type: string);
|
|
9
17
|
/**
|
|
10
18
|
* Retrieves data from the PoeWatch API.
|
|
11
|
-
* @param requestedProperties Optional array of properties to include in the response.
|
|
12
|
-
* @returns A promise that resolves to an array of objects containing the requested data.
|
|
13
|
-
* @throws If there is an error retrieving the data.
|
|
19
|
+
* @param {string[]} requestedProperties Optional array of properties to include in the response.
|
|
20
|
+
* @returns {Promise<object[]>} A promise that resolves to an array of objects containing the requested data.
|
|
21
|
+
* @throws {Error} If there is an error retrieving the data.
|
|
14
22
|
*/
|
|
15
23
|
getData(requestedProperties?: string[]): Promise<object[]>;
|
|
16
24
|
}
|
|
@@ -6,19 +6,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const getData_1 = __importDefault(require("../modules/poe.watch/func/getData"));
|
|
7
7
|
/**
|
|
8
8
|
* Represents an abstract class for interacting with the PoeWatch API.
|
|
9
|
+
* @abstract
|
|
10
|
+
* @class
|
|
11
|
+
* @implements {IPoeWatch}
|
|
9
12
|
*/
|
|
10
13
|
class PoeWatch {
|
|
11
14
|
league;
|
|
12
15
|
type;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new instance of PoeWatch.
|
|
18
|
+
* @param {string} league - The league name to get data from.
|
|
19
|
+
* @param {string} type - The type of data to retrieve (e.g. 'currency', 'items', etc.).
|
|
20
|
+
*/
|
|
13
21
|
constructor(league, type) {
|
|
14
22
|
this.league = league;
|
|
15
23
|
this.type = type;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Retrieves data from the PoeWatch API.
|
|
19
|
-
* @param requestedProperties Optional array of properties to include in the response.
|
|
20
|
-
* @returns A promise that resolves to an array of objects containing the requested data.
|
|
21
|
-
* @throws If there is an error retrieving the data.
|
|
27
|
+
* @param {string[]} requestedProperties Optional array of properties to include in the response.
|
|
28
|
+
* @returns {Promise<object[]>} A promise that resolves to an array of objects containing the requested data.
|
|
29
|
+
* @throws {Error} If there is an error retrieving the data.
|
|
22
30
|
*/
|
|
23
31
|
async getData(requestedProperties) {
|
|
24
32
|
try {
|
package/dist/lib/Utils.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare class Utils {
|
|
|
7
7
|
/**
|
|
8
8
|
* Fetches the list of leagues for the game.
|
|
9
9
|
* @returns {string[]} The array of league names.
|
|
10
|
-
* @throws If there's an error fetching the leagues.
|
|
10
|
+
* @throws {Error} If there's an error fetching the leagues.
|
|
11
11
|
*/
|
|
12
12
|
getLeagues(): Promise<string[]>;
|
|
13
13
|
/**
|
|
@@ -15,7 +15,8 @@ declare class Utils {
|
|
|
15
15
|
*
|
|
16
16
|
* @param {object[]} data - The array of objects to filter.
|
|
17
17
|
* @param {string[]} properties - The array of property names to include in the result.
|
|
18
|
-
* @returns {object[]} - An array of objects with only the specified properties.
|
|
18
|
+
* @returns {Promise<object[]>} - An array of objects with only the specified properties.
|
|
19
|
+
* @throws {Error} If there's an error filtering the properties.
|
|
19
20
|
*/
|
|
20
21
|
filterProperties(data: object[], properties: string[]): Promise<object[]>;
|
|
21
22
|
}
|
package/dist/lib/Utils.js
CHANGED
|
@@ -14,7 +14,7 @@ class Utils {
|
|
|
14
14
|
/**
|
|
15
15
|
* Fetches the list of leagues for the game.
|
|
16
16
|
* @returns {string[]} The array of league names.
|
|
17
|
-
* @throws If there's an error fetching the leagues.
|
|
17
|
+
* @throws {Error} If there's an error fetching the leagues.
|
|
18
18
|
*/
|
|
19
19
|
async getLeagues() {
|
|
20
20
|
try {
|
|
@@ -29,7 +29,8 @@ class Utils {
|
|
|
29
29
|
*
|
|
30
30
|
* @param {object[]} data - The array of objects to filter.
|
|
31
31
|
* @param {string[]} properties - The array of property names to include in the result.
|
|
32
|
-
* @returns {object[]} - An array of objects with only the specified properties.
|
|
32
|
+
* @returns {Promise<object[]>} - An array of objects with only the specified properties.
|
|
33
|
+
* @throws {Error} If there's an error filtering the properties.
|
|
33
34
|
*/
|
|
34
35
|
async filterProperties(data, properties) {
|
|
35
36
|
try {
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import CustomError from "./CustomError";
|
|
2
2
|
/**
|
|
3
3
|
* Represents an API error with a message, status code, and additional details.
|
|
4
|
+
* @class
|
|
5
|
+
* @extends {CustomError}
|
|
4
6
|
*/
|
|
5
7
|
declare class ApiError extends CustomError {
|
|
8
|
+
/**
|
|
9
|
+
* The additional details of the error.
|
|
10
|
+
* @type {any}
|
|
11
|
+
*/
|
|
6
12
|
details: any;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new instance of ApiError.
|
|
15
|
+
* @param {string} message - The error message.
|
|
16
|
+
* @param {number} statusCode - The HTTP status code.
|
|
17
|
+
* @param {any} details - The additional details of the error.
|
|
18
|
+
*/
|
|
7
19
|
constructor(message: string, statusCode: number, details?: any);
|
|
8
20
|
}
|
|
9
21
|
export default ApiError;
|
|
@@ -6,9 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const CustomError_1 = __importDefault(require("./CustomError"));
|
|
7
7
|
/**
|
|
8
8
|
* Represents an API error with a message, status code, and additional details.
|
|
9
|
+
* @class
|
|
10
|
+
* @extends {CustomError}
|
|
9
11
|
*/
|
|
10
12
|
class ApiError extends CustomError_1.default {
|
|
13
|
+
/**
|
|
14
|
+
* The additional details of the error.
|
|
15
|
+
* @type {any}
|
|
16
|
+
*/
|
|
11
17
|
details;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new instance of ApiError.
|
|
20
|
+
* @param {string} message - The error message.
|
|
21
|
+
* @param {number} statusCode - The HTTP status code.
|
|
22
|
+
* @param {any} details - The additional details of the error.
|
|
23
|
+
*/
|
|
12
24
|
constructor(message, statusCode, details) {
|
|
13
25
|
super(message, statusCode);
|
|
14
26
|
this.details = details;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a custom error with a message and a status code.
|
|
3
|
+
* @class
|
|
4
|
+
* @extends {Error}
|
|
3
5
|
*/
|
|
4
6
|
declare class CustomError extends Error {
|
|
5
7
|
statusCode: number;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new instance of CustomError.
|
|
10
|
+
* @param {string} message - The error message.
|
|
11
|
+
* @param {number} statusCode - The HTTP status code.
|
|
12
|
+
*/
|
|
6
13
|
constructor(message: string, statusCode: number);
|
|
7
14
|
}
|
|
8
15
|
export default CustomError;
|
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
4
|
* Represents a custom error with a message and a status code.
|
|
5
|
+
* @class
|
|
6
|
+
* @extends {Error}
|
|
5
7
|
*/
|
|
6
8
|
class CustomError extends Error {
|
|
7
9
|
statusCode;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new instance of CustomError.
|
|
12
|
+
* @param {string} message - The error message.
|
|
13
|
+
* @param {number} statusCode - The HTTP status code.
|
|
14
|
+
*/
|
|
8
15
|
constructor(message, statusCode) {
|
|
9
16
|
super(message);
|
|
10
17
|
this.statusCode = statusCode;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import CustomError from "./CustomError";
|
|
2
2
|
/**
|
|
3
3
|
* Represents an API error with a message, status code, and additional details.
|
|
4
|
+
* @class
|
|
5
|
+
* @extends {CustomError}
|
|
4
6
|
*/
|
|
5
7
|
declare class ValidationError extends CustomError {
|
|
6
8
|
details: any;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new instance of ApiError.
|
|
11
|
+
* @param {string} message - The error message.
|
|
12
|
+
* @param {number} statusCode - The HTTP status code.
|
|
13
|
+
* @param {any} details - The additional details of the error.
|
|
14
|
+
*/
|
|
7
15
|
constructor(message: string, statusCode: number, details?: any);
|
|
8
16
|
}
|
|
9
17
|
export default ValidationError;
|
|
@@ -6,9 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const CustomError_1 = __importDefault(require("./CustomError"));
|
|
7
7
|
/**
|
|
8
8
|
* Represents an API error with a message, status code, and additional details.
|
|
9
|
+
* @class
|
|
10
|
+
* @extends {CustomError}
|
|
9
11
|
*/
|
|
10
12
|
class ValidationError extends CustomError_1.default {
|
|
11
13
|
details;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new instance of ApiError.
|
|
16
|
+
* @param {string} message - The error message.
|
|
17
|
+
* @param {number} statusCode - The HTTP status code.
|
|
18
|
+
* @param {any} details - The additional details of the error.
|
|
19
|
+
*/
|
|
12
20
|
constructor(message, statusCode, details) {
|
|
13
21
|
super(message, statusCode);
|
|
14
22
|
this.details = details;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters properties of objects in an array based on the specified properties.
|
|
3
|
-
* @param data The array of objects to filter.
|
|
4
|
-
* @param requestedProperties The array of property names to include in the result.
|
|
5
|
-
* @returns An array of objects with only the specified properties.
|
|
3
|
+
* @param {Record<string, any> []} data The array of objects to filter.
|
|
4
|
+
* @param {string} requestedProperties The array of property names to include in the result.
|
|
5
|
+
* @returns {object[]} An array of objects with only the specified properties.
|
|
6
6
|
*/
|
|
7
7
|
export default function filterProperties(data: Record<string, any>[], requestedProperties: string[]): object[];
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
4
|
* Filters properties of objects in an array based on the specified properties.
|
|
5
|
-
* @param data The array of objects to filter.
|
|
6
|
-
* @param requestedProperties The array of property names to include in the result.
|
|
7
|
-
* @returns An array of objects with only the specified properties.
|
|
5
|
+
* @param {Record<string, any> []} data The array of objects to filter.
|
|
6
|
+
* @param {string} requestedProperties The array of property names to include in the result.
|
|
7
|
+
* @returns {object[]} An array of objects with only the specified properties.
|
|
8
8
|
*/
|
|
9
9
|
function filterProperties(data, requestedProperties) {
|
|
10
10
|
const result = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CurrencyModule, AccessoryModule, ArmourModule, BaseModule, BeastModule, EssenceModule, FossilModule, FragmentModule, MapModule, FlaskModule, JewelModule, GemModule, InvitationModule, OilModule, ScarabModule, SextantModule, WeaponModule } from "./allModules/Modules";
|
|
1
|
+
import { CurrencyModule, AccessoryModule, ArmourModule, BaseModule, BeastModule, DeliriumOrbModule, DivsModule, EssenceModule, FossilModule, FragmentModule, MapModule, FlaskModule, JewelModule, GemModule, InvitationModule, OilModule, ScarabModule, SextantModule, UniqueMapsModule, WeaponModule } from "./allModules/Modules";
|
|
2
2
|
/**
|
|
3
3
|
* Represents a module for fetching data related to Watchstones and Watchstone Regions.
|
|
4
4
|
*/
|
|
@@ -26,9 +26,11 @@ export declare class WatchViewModule {
|
|
|
26
26
|
/**
|
|
27
27
|
* Module for fetching data related to DeliriumOrb.
|
|
28
28
|
*/
|
|
29
|
+
deliriumOrb: DeliriumOrbModule;
|
|
29
30
|
/**
|
|
30
31
|
* Module for fetching data related to Divs.
|
|
31
32
|
*/
|
|
33
|
+
divs: DivsModule;
|
|
32
34
|
/**
|
|
33
35
|
* Module for fetching data related to Essence.
|
|
34
36
|
*/
|
|
@@ -79,6 +81,7 @@ export declare class WatchViewModule {
|
|
|
79
81
|
/**
|
|
80
82
|
* Module for fetching data related to UniqueMaps.
|
|
81
83
|
*/
|
|
84
|
+
uniqueMaps: UniqueMapsModule;
|
|
82
85
|
/**
|
|
83
86
|
* Module for fetching data related to Weapon.
|
|
84
87
|
*/
|
|
@@ -29,11 +29,11 @@ class WatchViewModule {
|
|
|
29
29
|
/**
|
|
30
30
|
* Module for fetching data related to DeliriumOrb.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
deliriumOrb;
|
|
33
33
|
/**
|
|
34
34
|
* Module for fetching data related to Divs.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
divs;
|
|
37
37
|
/**
|
|
38
38
|
* Module for fetching data related to Essence.
|
|
39
39
|
*/
|
|
@@ -85,7 +85,7 @@ class WatchViewModule {
|
|
|
85
85
|
/**
|
|
86
86
|
* Module for fetching data related to UniqueMaps.
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
uniqueMaps;
|
|
89
89
|
/**
|
|
90
90
|
* Module for fetching data related to Weapon.
|
|
91
91
|
*/
|
|
@@ -100,8 +100,6 @@ class WatchViewModule {
|
|
|
100
100
|
this.armour = new Modules_1.ArmourModule(league);
|
|
101
101
|
this.base = new Modules_1.BaseModule(league);
|
|
102
102
|
this.beast = new Modules_1.BeastModule(league);
|
|
103
|
-
//this.deliriumOrb = new DeliriumOrbModule(league);
|
|
104
|
-
//this.divs = new DivsModule(league);
|
|
105
103
|
this.essence = new Modules_1.EssenceModule(league);
|
|
106
104
|
this.fossil = new Modules_1.FossilModule(league);
|
|
107
105
|
this.fragment = new Modules_1.FragmentModule(league);
|
|
@@ -109,13 +107,15 @@ class WatchViewModule {
|
|
|
109
107
|
this.flask = new Modules_1.FlaskModule(league);
|
|
110
108
|
this.jewel = new Modules_1.JewelModule(league);
|
|
111
109
|
this.gem = new Modules_1.GemModule(league);
|
|
112
|
-
//this.inscribed = new InscribedModule(league);
|
|
113
110
|
this.invitation = new Modules_1.InvitationModule(league);
|
|
114
111
|
this.oil = new Modules_1.OilModule(league);
|
|
115
112
|
this.scarab = new Modules_1.ScarabModule(league);
|
|
116
113
|
this.sextant = new Modules_1.SextantModule(league);
|
|
117
|
-
//this.uniqueMaps = new UniqueMapsModule(league);
|
|
118
114
|
this.weapon = new Modules_1.WeaponModule(league);
|
|
115
|
+
this.uniqueMaps = new Modules_1.UniqueMapsModule(league);
|
|
116
|
+
this.deliriumOrb = new Modules_1.DeliriumOrbModule(league);
|
|
117
|
+
this.divs = new Modules_1.DivsModule(league);
|
|
118
|
+
//this.inscribed = new InscribedModule(league);- not now
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
exports.WatchViewModule = WatchViewModule;
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true
|
|
9
|
+
},
|
|
10
|
+
"include": ["src/**/*"],
|
|
11
|
+
"exclude": ["node_modules", "dist"]
|
|
12
|
+
}
|