Skip to content

Commit 477a6d1

Browse files
committed
Update docs, better linting
1 parent 24b0c46 commit 477a6d1

File tree

207 files changed

+31874
-786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+31874
-786
lines changed

dist/application/ApplicationRequest.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default class Request {
1+
export declare class Request {
22
readonly host: string;
33
readonly key: string;
44
constructor(host: string, key: string);

dist/application/ApplicationRequest.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33
return (mod && mod.__esModule) ? mod : { "default": mod };
44
};
55
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.Request = void 0;
67
const node_fetch_1 = __importDefault(require("node-fetch"));
7-
const Error_1 = __importDefault(require("../modules/Error"));
8+
const Error_1 = require("../modules/Error");
89
class Request {
910
constructor(host, key) {
1011
this.host = host;
@@ -31,7 +32,7 @@ class Request {
3132
options.body = JSON.stringify(data);
3233
const rawData = await node_fetch_1.default(URL, options);
3334
if (!rawData.ok)
34-
throw new Error_1.default(rawData, await rawData.json(), data, requestType);
35+
throw new Error_1.JSPteroAPIError(rawData, await rawData.json(), data, requestType);
3536
if (rawData.status == 204)
3637
return dataObj;
3738
const res = await rawData.json();
@@ -45,4 +46,4 @@ class Request {
4546
}
4647
}
4748
}
48-
exports.default = Request;
49+
exports.Request = Request;

dist/application/index.d.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ declare class Application {
1111
@internal
1212
*/
1313
private testAPI;
14-
getAllServers: (options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").default[]>;
15-
getAllNodes: (options?: import("./interfaces/Node").NodeIncludeInput | undefined) => Promise<import("./interfaces/Node").default[]>;
16-
getAllUsers: (options?: import("./interfaces/User").UserIncludeInput | undefined) => Promise<import("./interfaces/User").default[]>;
14+
getAllServers: (options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").Server[]>;
15+
getAllNodes: (options?: import("./interfaces/Node").NodeIncludeInput | undefined) => Promise<import("./interfaces/Node").Node[]>;
16+
getAllUsers: (options?: import("./interfaces/User").UserIncludeInput | undefined) => Promise<import("./interfaces/User").User[]>;
1717
getUserInfo: (userId: number, options?: import("./interfaces/User").UserIncludeInput | undefined) => Promise<import("./interfaces/User").UserAttributes>;
1818
getNodeInfo: (nodeId: number, options?: import("./interfaces/Node").NodeIncludeInput | undefined) => Promise<import("./interfaces/Node").NodeAttributes>;
1919
getServerInfo: (serverId: number, options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").ServerAttributes>;
20-
getAllNests: (options?: import("./interfaces/Nest").NestIncludeInput | undefined) => Promise<import("./interfaces/Nest").default[]>;
20+
getAllNests: (options?: import("./interfaces/Nest").NestIncludeInput | undefined) => Promise<import("./interfaces/Nest").Nest[]>;
2121
getNestInfo: (nestId: number, options?: import("./interfaces/Nest").NestIncludeInput | undefined) => Promise<import("./interfaces/Nest").NestAttributes>;
22-
getAllNestEggs: (nestId: number, options?: import("./interfaces/Nest").EggIncludeInput | undefined) => Promise<import("./interfaces/Egg").default[]>;
22+
getAllNestEggs: (nestId: number, options?: import("./interfaces/Nest").EggIncludeInput | undefined) => Promise<import("./interfaces/Egg").Egg[]>;
2323
getEggInfo: (nestID: number, eggId: number, options?: import("./interfaces/Nest").EggIncludeInput | undefined) => Promise<import("./interfaces/Egg").EggAttributes>;
2424
getServerInfoByExtId: (serverId: string, options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").ServerAttributes>;
25-
getServersDatabases: (serverId: number, options?: import("./interfaces/Database").DatabaseIncludeInput | undefined) => Promise<import("./interfaces/Database").default[]>;
25+
getServersDatabases: (serverId: number, options?: import("./interfaces/Database").DatabaseIncludeInput | undefined) => Promise<import("./interfaces/Database").Database[]>;
2626
getServersDatabaseInfo: (serverId: number, databaseId: number, options?: import("./interfaces/Database").DatabaseIncludeInput | undefined) => Promise<import("./interfaces/Database").DatabaseAttributes>;
2727
getNodeConfig: (nodeId: number) => Promise<import("./interfaces/Node").NodeConfig>;
28-
getAllAllocations: (nodeId: number, options?: import("./interfaces/Allocation").AllocationIncludeInput | undefined) => Promise<import("./interfaces/Allocation").default[]>;
28+
getAllAllocations: (nodeId: number, options?: import("./interfaces/Allocation").AllocationIncludeInput | undefined) => Promise<import("./interfaces/Allocation").Allocation[]>;
2929
createUser: (username: string, firstName: string, lastName: string, email: string, password?: string, isAdmin?: boolean, language?: string, externalId?: string | undefined) => Promise<import("./interfaces/User").UserAttributes>;
3030
createServer: (name: string, ownerId: number, description: string, nestId: number, eggId: number, environment?: import("./interfaces/Server").ServerEnvironment | undefined, cpu?: number, ram?: number, disk?: number, amountOfDatabases?: number, amountOfAllocations?: number, amountOfBackups?: number, startupCmd?: string | undefined, dockerImage?: string | undefined, swap?: number, io?: number, options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").ServerAttributes>;
3131
createNode: (name: string, description: string, locationID: number, fqdn: string, scheme: "http" | "https", ram: number, disk: number, isPublic?: boolean, daemonPort?: number, daemonSFTPPort?: number, ramOverAllocate?: number, diskOverallocate?: number, daemonDir?: string, maintenceMode?: boolean, maxUploadSize?: number, behindProxy?: boolean, options?: import("./interfaces/Node").NodeIncludeInput | undefined) => Promise<import("./interfaces/Node").NodeAttributes>;

dist/application/index.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
55
Object.defineProperty(exports, "__esModule", { value: true });
66
exports.Application = void 0;
77
const node_fetch_1 = __importDefault(require("node-fetch")); // import node-fetch
8-
const allocationMethods_1 = __importDefault(require("./methods/allocationMethods"));
9-
const databaseMethods_1 = __importDefault(require("./methods/databaseMethods"));
10-
const nestMethods_1 = __importDefault(require("./methods/nestMethods"));
11-
const nodeMethods_1 = __importDefault(require("./methods/nodeMethods"));
12-
const serverMethods_1 = __importDefault(require("./methods/serverMethods"));
13-
const userMethods_1 = __importDefault(require("./methods/userMethods"));
8+
const allocationMethods_1 = require("./methods/allocationMethods");
9+
const databaseMethods_1 = require("./methods/databaseMethods");
10+
const nestMethods_1 = require("./methods/nestMethods");
11+
const nodeMethods_1 = require("./methods/nodeMethods");
12+
const serverMethods_1 = require("./methods/serverMethods");
13+
const userMethods_1 = require("./methods/userMethods");
1414
class Application {
1515
/**
1616
* @param host - Panels address
@@ -26,7 +26,7 @@ class Application {
2626
this.host = host;
2727
if (!fast)
2828
this.testAPI();
29-
const servermethods = new serverMethods_1.default(host, key);
29+
const servermethods = new serverMethods_1.serverMethods(host, key);
3030
this.getAllServers = servermethods.getAllServers;
3131
this.getServerInfo = servermethods.getServerInfo;
3232
this.createServer = servermethods.createServer;
@@ -38,31 +38,31 @@ class Application {
3838
this.editServerDetails = servermethods.editServerDetails;
3939
this.editServerBuild = servermethods.editServerBuild;
4040
this.editServerStartup = servermethods.editServerStartup;
41-
const nestmethods = new nestMethods_1.default(host, key);
41+
const nestmethods = new nestMethods_1.nestMethods(host, key);
4242
this.getAllNests = nestmethods.getAllNests;
4343
this.getNestInfo = nestmethods.getNestInfo;
4444
this.getAllNestEggs = nestmethods.getAllNestEggs;
4545
this.getEggInfo = nestmethods.getEggInfo;
46-
const databasemethods = new databaseMethods_1.default(host, key);
46+
const databasemethods = new databaseMethods_1.databaseMethods(host, key);
4747
this.getServersDatabases = databasemethods.getServersDatabases;
4848
this.getServersDatabaseInfo = databasemethods.getServersDatabaseInfo;
4949
this.createDatabase = databasemethods.createDatabase;
5050
this.resetDatabasePassword = databasemethods.resetDatabasePassword;
5151
this.deleteDatabase = databasemethods.deleteDatabase;
52-
const usermethods = new userMethods_1.default(host, key);
52+
const usermethods = new userMethods_1.userMethods(host, key);
5353
this.getAllUsers = usermethods.getAllUsers;
5454
this.getUserInfo = usermethods.getUserInfo;
5555
this.createUser = usermethods.createUser;
5656
this.editUser = usermethods.editUser;
5757
this.deleteUser = usermethods.deleteUser;
58-
const nodemethods = new nodeMethods_1.default(host, key);
58+
const nodemethods = new nodeMethods_1.nodeMethods(host, key);
5959
this.getAllNodes = nodemethods.getAllNodes;
6060
this.getNodeInfo = nodemethods.getNodeInfo;
6161
this.getNodeConfig = nodemethods.getNodeConfig;
6262
this.createNode = nodemethods.createNode;
6363
this.editNode = nodemethods.editNode;
6464
this.deleteNode = nodemethods.deleteNode;
65-
const allocationmethods = new allocationMethods_1.default(host, key);
65+
const allocationmethods = new allocationMethods_1.allocationMethods(host, key);
6666
this.getAllAllocations = allocationmethods.getAllAllocations;
6767
this.createAllocation = allocationmethods.createAllocation;
6868
this.deleteAllocation = allocationmethods.deleteAllocation;

dist/application/interfaces/Allocation.d.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import Node from './Node';
2-
import Server from './Server';
1+
/** @module ApplicationAllocation */
2+
import { Node } from './Node';
3+
import { Server } from './Server';
34
export interface AllocationIncludeInput {
45
node?: boolean;
56
server?: boolean;
@@ -17,7 +18,7 @@ export interface AllocationAttributes {
1718
assigned: boolean;
1819
relationships?: AllocationRelationships;
1920
}
20-
export default interface Allocation {
21+
export interface Allocation {
2122
onject: string;
2223
attributes: AllocationAttributes;
2324
}

dist/application/interfaces/Database.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @module ApplicationDatabase */
12
export interface DatabaseIncludeInput {
23
password?: boolean;
34
host?: boolean;
@@ -39,7 +40,7 @@ export interface DatabaseAttributes {
3940
updated_at: string;
4041
relationships?: DatabaseRelationships;
4142
}
42-
export default interface Database {
43+
export interface Database {
4344
object: string;
4445
attributes: DatabaseAttributes;
4546
}

dist/application/interfaces/Egg.d.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import Nest from './Nest';
2-
import Server from './Server';
1+
/** @module ApplicationEgg*/
2+
import { Nest } from './Nest';
3+
import { Server } from './Server';
34
export interface EggConfig {
45
files: unknown[];
56
startup: Record<string, string>;
@@ -61,7 +62,7 @@ export interface EggAttributes {
6162
updated_at: '2021-01-27T13:46:16+00:00';
6263
relationships?: EggRelationships;
6364
}
64-
export default interface Egg {
65+
export interface Egg {
6566
object: string;
6667
attributes: EggAttributes;
6768
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
/** @module ApplicationLocation */
12
export interface LocationAttributes {
23
id: number;
34
short: string;
45
long: string;
56
updated_at: string;
67
created_at: string;
78
}
8-
export default interface Location {
9+
export interface Location {
910
object: string;
1011
attributes: LocationAttributes;
1112
}

dist/application/interfaces/Nest.d.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import Egg from './Egg';
2-
import Server from './Server';
1+
/** @module ApplicationNest */
2+
import { Egg } from './Egg';
3+
import { Server } from './Server';
34
export interface NestIncludeInput {
45
eggs?: boolean;
56
servers?: boolean;
@@ -31,7 +32,7 @@ export interface NestAttributes {
3132
updated_at: string;
3233
relationships?: NestRelationships;
3334
}
34-
export default interface Nest {
35+
export interface Nest {
3536
object: string;
3637
attributes: NestAttributes;
3738
}

dist/application/interfaces/Node.d.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
/** @module ApplicationNode */
12
import { Allocations } from './Allocation';
2-
import Location from './Location';
3-
import Server from './Server';
3+
import { Location } from './Location';
4+
import { Server } from './Server';
45
export interface NodeIncludeInput {
56
allocations?: boolean;
67
location?: boolean;
@@ -71,7 +72,7 @@ export interface NodeAttributes {
7172
allocated_resources: NodeAllocatedResources;
7273
relationships?: NodeRelationships;
7374
}
74-
export default interface Node {
75+
export interface Node {
7576
object: string;
7677
attributes: NodeAttributes;
7778
}

dist/application/interfaces/Server.d.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import Database from './Database';
2-
import Egg from './Egg';
3-
import Location from './Location';
4-
import Nest from './Nest';
5-
import Node from './Node';
6-
import User from './User';
1+
/** @module ApplicationServer */
2+
import { Database } from './Database';
3+
import { Egg } from './Egg';
4+
import { Location } from './Location';
5+
import { Nest } from './Nest';
6+
import { Node } from './Node';
7+
import { User } from './User';
78
export interface ServerEnvironment {
89
[key: string]: unknown;
910
MAX_USERS?: number;
@@ -175,7 +176,7 @@ export interface ServerAttributes {
175176
created_at: string;
176177
relationships?: ServerRelationships;
177178
}
178-
export default interface Server {
179+
export interface Server {
179180
object: string;
180181
attributes: ServerAttributes;
181182
}

dist/application/interfaces/User.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import Server from './Server';
1+
/** @module ApplicationUser */
2+
import { Server } from './Server';
23
export interface UserIncludeInput {
34
servers: boolean;
45
}
@@ -24,7 +25,7 @@ export interface UserAttributes {
2425
'updated_at': string;
2526
'relationships'?: UserRelationships;
2627
}
27-
export default interface User {
28+
export interface User {
2829
object: string;
2930
attributes: UserAttributes;
3031
}

dist/application/methods/allocationMethods.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Allocation, { AllocationIncludeInput } from '../interfaces/Allocation';
2-
export default class allocationMethods {
1+
import { Allocation, AllocationIncludeInput } from '../interfaces/Allocation';
2+
export declare class allocationMethods {
33
private host;
44
private key;
55
constructor(host: string, key: string);

dist/application/methods/allocationMethods.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"use strict";
2-
var __importDefault = (this && this.__importDefault) || function (mod) {
3-
return (mod && mod.__esModule) ? mod : { "default": mod };
4-
};
52
Object.defineProperty(exports, "__esModule", { value: true });
6-
const ApplicationRequest_1 = __importDefault(require("../ApplicationRequest"));
7-
const Functions_1 = __importDefault(require("../../modules/Functions"));
3+
exports.allocationMethods = void 0;
4+
const ApplicationRequest_1 = require("../ApplicationRequest");
5+
const Functions_1 = require("../../modules/Functions");
86
class allocationMethods {
97
constructor(host, key) {
108
this.host = host;
@@ -23,7 +21,7 @@ class allocationMethods {
2321
* ```
2422
*/
2523
this.getAllAllocations = async (nodeId, options) => {
26-
return new ApplicationRequest_1.default(this.host, this.key).request('GET', null, 'data', `/api/application/nodes/${nodeId}/allocations${Functions_1.default(options)}`);
24+
return new ApplicationRequest_1.Request(this.host, this.key).request('GET', null, 'data', `/api/application/nodes/${nodeId}/allocations${Functions_1.makeIncludes(options)}`);
2725
};
2826
/**
2927
* @param nodeId - The node id of which you want to create allocations
@@ -41,7 +39,7 @@ class allocationMethods {
4139
* ```
4240
*/
4341
this.createAllocation = async (nodeId, ip = '0.0.0.0', ports, alias = '') => {
44-
return new ApplicationRequest_1.default(this.host, this.key).request('POST', {
42+
return new ApplicationRequest_1.Request(this.host, this.key).request('POST', {
4543
ip: ip,
4644
ports: ports,
4745
allocation_alias: alias,
@@ -61,8 +59,8 @@ class allocationMethods {
6159
* ```
6260
*/
6361
this.deleteAllocation = async (nodeId, allocationId) => {
64-
return new ApplicationRequest_1.default(this.host, this.key).request('DELETE', null, 'Successfully deleted!', `/api/application/nodes/${nodeId}/allocations/${allocationId}`);
62+
return new ApplicationRequest_1.Request(this.host, this.key).request('DELETE', null, 'Successfully deleted!', `/api/application/nodes/${nodeId}/allocations/${allocationId}`);
6563
};
6664
}
6765
}
68-
exports.default = allocationMethods;
66+
exports.allocationMethods = allocationMethods;

dist/application/methods/databaseMethods.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Database, { DatabaseAttributes, DatabaseIncludeInput } from '../interfaces/Database';
2-
export default class databaseMethods {
1+
import { Database, DatabaseAttributes, DatabaseIncludeInput } from '../interfaces/Database';
2+
export declare class databaseMethods {
33
private host;
44
private key;
55
constructor(host: string, key: string);

0 commit comments

Comments
 (0)