mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-25 13:36:21 +03:00
Merge pull request #50 from Bricklou/ts-typing
Created a declaration file for typescript
This commit is contained in:
commit
00fbb5a4af
3 changed files with 117 additions and 0 deletions
110
index.d.ts
vendored
Normal file
110
index.d.ts
vendored
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
|
||||||
|
declare module "minecraft-launcher-core" {
|
||||||
|
type OS = "windows" | "osx" | "linux";
|
||||||
|
|
||||||
|
interface IOverrides {
|
||||||
|
minArgs?: number;
|
||||||
|
minecraftJar?: string;
|
||||||
|
versionJson?: string;
|
||||||
|
directory?: string;
|
||||||
|
natives?: string;
|
||||||
|
assetRoot?: string;
|
||||||
|
libraryRoot?: string;
|
||||||
|
cwd?: string;
|
||||||
|
detached?: boolean;
|
||||||
|
classes?: Array<string>;
|
||||||
|
maxSockets?: number;
|
||||||
|
url?: {
|
||||||
|
meta?: string;
|
||||||
|
resources?: string;
|
||||||
|
mavenForge?: string;
|
||||||
|
defaultRepoForge?: string;
|
||||||
|
fallbackMaven?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ILauncherOptions {
|
||||||
|
clientPackage?: string;
|
||||||
|
removePackage?: boolean;
|
||||||
|
installer?: string;
|
||||||
|
root: string;
|
||||||
|
os?: OS;
|
||||||
|
customLaunchArgs?: Array<string>;
|
||||||
|
customArgs?: Array<string>;
|
||||||
|
version: {
|
||||||
|
number: string;
|
||||||
|
type: string;
|
||||||
|
custom?: string;
|
||||||
|
};
|
||||||
|
memory: {
|
||||||
|
max: string | number;
|
||||||
|
min: string | number;
|
||||||
|
};
|
||||||
|
forge?: string;
|
||||||
|
javaPath?: string;
|
||||||
|
server?: {
|
||||||
|
host: string;
|
||||||
|
port: string;
|
||||||
|
};
|
||||||
|
proxy?: {
|
||||||
|
host: string;
|
||||||
|
port: string;
|
||||||
|
username?: string;
|
||||||
|
password?: string;
|
||||||
|
};
|
||||||
|
timeout?: number;
|
||||||
|
window?: {
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
fullscreen?: boolean;
|
||||||
|
};
|
||||||
|
overrides?: IOverrides;
|
||||||
|
authorization: Promise<IUser>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUser {
|
||||||
|
access_token: string;
|
||||||
|
client_token: string;
|
||||||
|
uuid: string;
|
||||||
|
name: string;
|
||||||
|
user_properties: Partial<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IProfile {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAuthenticator {
|
||||||
|
getAuth(username: string, password?: string): Promise<IUser>;
|
||||||
|
validate(
|
||||||
|
access_token: string,
|
||||||
|
client_token: string
|
||||||
|
): Promise<boolean | Partial<any>>;
|
||||||
|
refreshAuth(
|
||||||
|
access_token: string,
|
||||||
|
client_token: string,
|
||||||
|
selectedProfile: IProfile
|
||||||
|
): Promise<IUser>;
|
||||||
|
invalidate(
|
||||||
|
access_token: string,
|
||||||
|
client_token: string
|
||||||
|
): Promise<boolean | Partial<any>>;
|
||||||
|
signOut(
|
||||||
|
username: string,
|
||||||
|
password: string
|
||||||
|
): Promise<boolean | Partial<any>>;
|
||||||
|
changeApiUrl(url: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { EventEmitter } from 'events'
|
||||||
|
import { ChildProcessWithoutNullStreams } from 'child_process'
|
||||||
|
|
||||||
|
export class Client extends EventEmitter {
|
||||||
|
launch(options: ILauncherOptions): ChildProcessWithoutNullStreams | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Authenticator: IAuthenticator;
|
||||||
|
}
|
||||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -36,6 +36,12 @@
|
||||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "14.0.27",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz",
|
||||||
|
"integrity": "sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "7.1.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"uuid": "^3.3.2"
|
"uuid": "^3.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "^14.0.27",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-standard": "^14.1.1",
|
"eslint-config-standard": "^14.1.1",
|
||||||
"eslint-plugin-import": "^2.20.2",
|
"eslint-plugin-import": "^2.20.2",
|
||||||
|
|
Loading…
Add table
Reference in a new issue