airship-cli 1.1.0 → 1.2.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/README.MD +28 -4
- package/out/AirshipTypes.d.ts +19 -3
- package/out/AirshipTypes.d.ts.map +1 -1
- package/out/AirshipTypes.js +2 -0
- package/out/AirshipTypes.js.map +1 -1
- package/out/cli.d.ts +11 -5
- package/out/cli.d.ts.map +1 -1
- package/out/cli.js +70 -23
- package/out/cli.js.map +1 -1
- package/out/commands/ExitCommand.d.ts +3 -0
- package/out/commands/ExitCommand.d.ts.map +1 -0
- package/out/commands/ExitCommand.js +13 -0
- package/out/commands/ExitCommand.js.map +1 -0
- package/out/commands/FavoriteGame.d.ts +3 -0
- package/out/commands/FavoriteGame.d.ts.map +1 -0
- package/out/commands/FavoriteGame.js +22 -0
- package/out/commands/FavoriteGame.js.map +1 -0
- package/out/commands/FetchGame.d.ts.map +1 -1
- package/out/commands/FetchGame.js +28 -54
- package/out/commands/FetchGame.js.map +1 -1
- package/out/commands/FetchProfilePhoto.d.ts +3 -0
- package/out/commands/FetchProfilePhoto.d.ts.map +1 -0
- package/out/commands/FetchProfilePhoto.js +31 -0
- package/out/commands/FetchProfilePhoto.js.map +1 -0
- package/out/commands/FetchUser.d.ts.map +1 -1
- package/out/commands/FetchUser.js +26 -52
- package/out/commands/FetchUser.js.map +1 -1
- package/out/commands/FetchUserPhoto.d.ts +3 -0
- package/out/commands/FetchUserPhoto.d.ts.map +1 -0
- package/out/commands/FetchUserPhoto.js +45 -0
- package/out/commands/FetchUserPhoto.js.map +1 -0
- package/out/commands/HelpCommand.d.ts +3 -0
- package/out/commands/HelpCommand.d.ts.map +1 -0
- package/out/commands/HelpCommand.js +39 -0
- package/out/commands/HelpCommand.js.map +1 -0
- package/out/commands/RestartCommand copy.d.ts +3 -0
- package/out/commands/RestartCommand copy.d.ts.map +1 -0
- package/out/commands/RestartCommand copy.js +14 -0
- package/out/commands/RestartCommand copy.js.map +1 -0
- package/out/commands/RestartCommand.d.ts +3 -0
- package/out/commands/RestartCommand.d.ts.map +1 -0
- package/out/commands/RestartCommand.js +14 -0
- package/out/commands/RestartCommand.js.map +1 -0
- package/out/commands/games/FavoriteGame.d.ts +3 -0
- package/out/commands/games/FavoriteGame.d.ts.map +1 -0
- package/out/commands/games/FavoriteGame.js +22 -0
- package/out/commands/games/FavoriteGame.js.map +1 -0
- package/out/commands/games/FetchGame.d.ts +3 -0
- package/out/commands/games/FetchGame.d.ts.map +1 -0
- package/out/commands/games/FetchGame.js +42 -0
- package/out/commands/games/FetchGame.js.map +1 -0
- package/out/commands/users/FetchProfilePhoto.d.ts +3 -0
- package/out/commands/users/FetchProfilePhoto.d.ts.map +1 -0
- package/out/commands/users/FetchProfilePhoto.js +31 -0
- package/out/commands/users/FetchProfilePhoto.js.map +1 -0
- package/out/commands/users/FetchUser.d.ts +3 -0
- package/out/commands/users/FetchUser.d.ts.map +1 -0
- package/out/commands/users/FetchUser.js +40 -0
- package/out/commands/users/FetchUser.js.map +1 -0
- package/out/util/IdentifierConversion.d.ts +2 -0
- package/out/util/IdentifierConversion.d.ts.map +1 -0
- package/out/util/IdentifierConversion.js +14 -0
- package/out/util/IdentifierConversion.js.map +1 -0
- package/out/util/TokenManager.d.ts.map +1 -1
- package/out/util/TokenManager.js +44 -3
- package/out/util/TokenManager.js.map +1 -1
- package/out/util/platform/FavoriteGame.d.ts +3 -0
- package/out/util/platform/FavoriteGame.d.ts.map +1 -0
- package/out/util/platform/FavoriteGame.js +28 -0
- package/out/util/platform/FavoriteGame.js.map +1 -0
- package/out/util/platform/FetchGame.d.ts +6 -0
- package/out/util/platform/FetchGame.d.ts.map +1 -0
- package/out/util/platform/FetchGame.js +14 -0
- package/out/util/platform/FetchGame.js.map +1 -0
- package/out/util/platform/FetchUser.d.ts +6 -0
- package/out/util/platform/FetchUser.d.ts.map +1 -0
- package/out/util/platform/FetchUser.js +14 -0
- package/out/util/platform/FetchUser.js.map +1 -0
- package/package.json +6 -2
- package/.github/workflows/npm-publish.yml +0 -22
- package/src/AirshipTypes.ts +0 -63
- package/src/cli.ts +0 -68
- package/src/commands/CommandTypes.ts +0 -8
- package/src/commands/FetchGame.ts +0 -77
- package/src/commands/FetchUser.ts +0 -75
- package/src/commands/Help.ts +0 -37
- package/src/util/Styles.ts +0 -20
- package/src/util/TokenManager.ts +0 -22
- package/tsconfig.json +0 -42
package/README.MD
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
# Airship CLI
|
|
2
|
-
|
|
2
|
+
Interact with the Airship.gg API from your Terminal!
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## How to Use
|
|
7
|
+
Simply install the NPM Package
|
|
8
|
+
|
|
9
|
+
`npm install -g airship-cli`
|
|
10
|
+
|
|
11
|
+
and run the command, `airship`!
|
|
12
|
+
|
|
13
|
+
## Current Commands
|
|
14
|
+
*Note: Some commands (marked below) require an [Airship Installation](https://store.steampowered.com/app/2381730/Airship/) for the authentication token!*
|
|
15
|
+
|
|
16
|
+
Users:
|
|
17
|
+
- Fetch User
|
|
18
|
+
- Fetch Profile Picture (returns CDN path)
|
|
19
|
+
|
|
20
|
+
Games:
|
|
21
|
+
- Fetch Game
|
|
22
|
+
- Favorite Game *(auth)*
|
|
23
|
+
|
|
24
|
+
# Development Stats
|
|
25
|
+

|
|
26
|
+
[](https://www.npmjs.com/package/airship-cli)
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+

|
|
5
30
|
|
|
6
31
|
# License
|
|
7
32
|
|
|
8
|
-
Copyright (c) 2026 Max McDaniel
|
|
9
|
-
Licensed under the GPL 3.0 license.
|
|
33
|
+
Copyright (c) 2026 Max McDaniel - Licensed under the GPL 3.0 license.
|
package/out/AirshipTypes.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export type AirshipUser = {
|
|
|
7
7
|
uid: string;
|
|
8
8
|
username: string;
|
|
9
9
|
usernameLower: string;
|
|
10
|
-
statusText
|
|
11
|
-
profileImageId
|
|
12
|
-
lastOnlineTime
|
|
10
|
+
statusText?: string;
|
|
11
|
+
profileImageId?: string;
|
|
12
|
+
lastOnlineTime?: string;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
export type AirshipError = {
|
|
@@ -56,5 +56,21 @@ export type AirshipGame = {
|
|
|
56
56
|
organization: AirshipOrganization;
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
export interface AccessTokenResult {
|
|
60
|
+
access_token: string;
|
|
61
|
+
expires_in: string;
|
|
62
|
+
token_type: string;
|
|
63
|
+
refresh_token: string;
|
|
64
|
+
id_token: string;
|
|
65
|
+
user_id: string;
|
|
66
|
+
project_id: string;
|
|
67
|
+
}
|
|
68
|
+
export interface AccessTokenError {
|
|
69
|
+
error: {
|
|
70
|
+
code: number;
|
|
71
|
+
message: string;
|
|
72
|
+
status: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
59
75
|
export {};
|
|
60
76
|
//# sourceMappingURL=AirshipTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirshipTypes.d.ts","sourceRoot":"","sources":["../src/AirshipTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAA;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"AirshipTypes.d.ts","sourceRoot":"","sources":["../src/AirshipTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAA;CACf,CAAC;AAEF,MAAM,MAAM,WA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AC;QAC1B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,KAAK,EAAE,QAAQ,EAAE,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,YAAY,EAAE,mBAAmB,CAAA;KACpC,CAAA;CACJ,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAA;KACjB,CAAA;CACJ"}
|
package/out/AirshipTypes.js
CHANGED
package/out/AirshipTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirshipTypes.js","sourceRoot":"","sources":["../src/AirshipTypes.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AirshipTypes.js","sourceRoot":"","sources":["../src/AirshipTypes.ts"],"names":[],"mappings":"AAwEC,CAAC;AAQD,CAAC"}
|
package/out/cli.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
};
|
|
2
|
+
import type { CLICommand } from './commands/CommandTypes.js';
|
|
3
|
+
interface CommandMap {
|
|
4
|
+
"default": {
|
|
5
|
+
[key: string]: CLICommand;
|
|
6
|
+
};
|
|
7
|
+
[key: string]: {
|
|
8
|
+
[key: string]: CLICommand;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const commandMap: CommandMap;
|
|
7
12
|
export declare function StartTool(): Promise<void>;
|
|
8
13
|
export declare function RestartTool(): Promise<void>;
|
|
14
|
+
export {};
|
|
9
15
|
//# sourceMappingURL=cli.d.ts.map
|
package/out/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAUA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAK7D,UAAU,UAAU;IAChB,SAAS,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAC5B,CAAC;IAEF,CAAC,GAAG,EAAE,MAAM,GAAG;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAC5B,CAAA;CACJ;AAED,eAAO,MAAM,UAAU,EAAE,UAaxB,CAAC;AAEF,wBAAsB,SAAS,kBAK9B;AAED,wBAAsB,WAAW,kBAYhC"}
|
package/out/cli.js
CHANGED
|
@@ -2,14 +2,28 @@
|
|
|
2
2
|
import { confirm, input, select } from '@inquirer/prompts';
|
|
3
3
|
import { PrintHeader, PrintError, PrintTitle } from './util/Styles.js';
|
|
4
4
|
import { AirshipToken } from './util/TokenManager.js';
|
|
5
|
-
import { helpCommand } from './commands/
|
|
6
|
-
import { fetchUserCommand } from './commands/FetchUser.js';
|
|
7
|
-
import { fetchGameCommand } from './commands/FetchGame.js';
|
|
5
|
+
import { helpCommand } from './commands/HelpCommand.js';
|
|
6
|
+
import { fetchUserCommand } from './commands/users/FetchUser.js';
|
|
7
|
+
import { fetchGameCommand } from './commands/games/FetchGame.js';
|
|
8
8
|
import { setTimeout } from 'node:timers/promises';
|
|
9
|
+
import { fetchProfilePhotoCommand } from './commands/users/FetchProfilePhoto.js';
|
|
10
|
+
import { favoriteGameCommand } from './commands/games/FavoriteGame.js';
|
|
11
|
+
import { restartCommand } from './commands/RestartCommand.js';
|
|
12
|
+
import { exitCommand } from './commands/ExitCommand.js';
|
|
13
|
+
;
|
|
9
14
|
export const commandMap = {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
"default": {
|
|
16
|
+
"Help": helpCommand,
|
|
17
|
+
"Exit": exitCommand
|
|
18
|
+
},
|
|
19
|
+
"Users": {
|
|
20
|
+
"Fetch User": fetchUserCommand,
|
|
21
|
+
"Fetch Profile Photo": fetchProfilePhotoCommand
|
|
22
|
+
},
|
|
23
|
+
"Games": {
|
|
24
|
+
"Fetch Game": fetchGameCommand,
|
|
25
|
+
"Favorite Game": favoriteGameCommand
|
|
26
|
+
}
|
|
13
27
|
};
|
|
14
28
|
export async function StartTool() {
|
|
15
29
|
PrintTitle();
|
|
@@ -27,6 +41,7 @@ export async function RestartTool() {
|
|
|
27
41
|
;
|
|
28
42
|
}
|
|
29
43
|
catch (err) {
|
|
44
|
+
console.error(err);
|
|
30
45
|
process.exit(0);
|
|
31
46
|
}
|
|
32
47
|
;
|
|
@@ -34,36 +49,68 @@ export async function RestartTool() {
|
|
|
34
49
|
;
|
|
35
50
|
async function PromptCommand() {
|
|
36
51
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
// Remove "default" from choices
|
|
53
|
+
let choices = Object.keys(commandMap).slice(1);
|
|
54
|
+
// Readd the default commands yay!
|
|
55
|
+
for (let defaultCmd of Object.keys(commandMap.default)) {
|
|
56
|
+
choices.push(defaultCmd);
|
|
57
|
+
}
|
|
58
|
+
;
|
|
59
|
+
const categoryAnswer = await select({ message: "What would you like to do?", choices });
|
|
60
|
+
const cmdCategories = Object.entries(commandMap);
|
|
61
|
+
for (let [categoryName, commands] of cmdCategories) {
|
|
62
|
+
// Handle special exceptions for commands in default category
|
|
63
|
+
if (categoryName !== "default") {
|
|
64
|
+
commands["Back"] = restartCommand;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
;
|
|
68
|
+
if (categoryAnswer === "Help") {
|
|
69
|
+
helpCommand.execute();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
;
|
|
73
|
+
if (categoryAnswer === "Exit") {
|
|
74
|
+
exitCommand.execute();
|
|
50
75
|
return;
|
|
51
76
|
}
|
|
52
77
|
;
|
|
78
|
+
if (categoryAnswer === categoryName) {
|
|
79
|
+
const cmdAnswer = await select({ message: "What would you like to do?", choices: Object.keys(commands) });
|
|
80
|
+
HandleCommand(commands[cmdAnswer], cmdAnswer);
|
|
81
|
+
}
|
|
82
|
+
;
|
|
53
83
|
}
|
|
54
84
|
;
|
|
55
85
|
}
|
|
56
86
|
catch (err) {
|
|
87
|
+
console.error(err);
|
|
57
88
|
process.exit(0);
|
|
58
89
|
}
|
|
59
90
|
;
|
|
60
91
|
}
|
|
61
92
|
;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
93
|
+
async function HandleCommand(command, answer) {
|
|
94
|
+
const cmdName = command.displayName;
|
|
95
|
+
const requiresToken = command.requiresToken;
|
|
96
|
+
const cmdFunction = command;
|
|
97
|
+
if (answer === cmdName) {
|
|
98
|
+
if (AirshipToken === undefined && requiresToken) {
|
|
99
|
+
PrintError("An authenticated Airship installation is required to run this command!");
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
;
|
|
103
|
+
await setTimeout(250);
|
|
104
|
+
cmdFunction.execute();
|
|
105
|
+
return;
|
|
65
106
|
}
|
|
66
107
|
;
|
|
67
|
-
}
|
|
108
|
+
}
|
|
109
|
+
;
|
|
110
|
+
// process.on("exit", (signal) => {
|
|
111
|
+
// if (signal === 0) {
|
|
112
|
+
// console.clear();
|
|
113
|
+
// };
|
|
114
|
+
// });
|
|
68
115
|
StartTool();
|
|
69
116
|
//# sourceMappingURL=cli.js.map
|
package/out/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAA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AAC;IACpC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC5C,MAAM,WAAW,GAAG,OAAO,CAAA;IAE3B,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACrB,IAAI,YAAY,KAAK,SAAS,IAAI,aAAa,EAAE,CAAC;YAC9C,UAAU,CAAC,wEAAwE,CAAC,CAAC;YACrF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAAA,CAAC;QAEF,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;QACtB,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO;IACX,CAAC;IAAA,CAAC;AACN,CAAC;AAAA,CAAC;AAEF,mCAAmC;AACnC,0BAA0B;AAC1B,2BAA2B;AAC3B,SAAS;AACT,MAAM;AAEN,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExitCommand.d.ts","sourceRoot":"","sources":["../../src/commands/ExitCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,UAUzB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { setTimeout } from "node:timers/promises";
|
|
2
|
+
export const exitCommand = {
|
|
3
|
+
name: "exit",
|
|
4
|
+
displayName: "Exit",
|
|
5
|
+
description: "Exits the CLI tool.",
|
|
6
|
+
usage: "exit",
|
|
7
|
+
requiresToken: false,
|
|
8
|
+
execute: async () => {
|
|
9
|
+
console.clear();
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=ExitCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExitCommand.js","sourceRoot":"","sources":["../../src/commands/ExitCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,MAAM,CAAC,MAAM,WAAW,GAAe;IACnC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,qBAAqB;IAClC,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FavoriteGame.d.ts","sourceRoot":"","sources":["../../src/commands/FavoriteGame.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKpD,eAAO,MAAM,mBAAmB,EAAE,UAmBjC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { input, select } from "@inquirer/prompts";
|
|
2
|
+
import { FetchGame, gameApiMap } from "../util/platform/FetchGame.js";
|
|
3
|
+
import { FavoriteGame } from "../util/platform/FavoriteGame.js";
|
|
4
|
+
import { RestartTool } from "../cli.js";
|
|
5
|
+
export const favoriteGameCommand = {
|
|
6
|
+
name: "favorite-game",
|
|
7
|
+
displayName: "Favorite Game",
|
|
8
|
+
description: "Mark a game as your favorite. Requires Auth Token!",
|
|
9
|
+
usage: "",
|
|
10
|
+
requiresToken: true,
|
|
11
|
+
execute: async () => {
|
|
12
|
+
const action = await select({ message: "What would you like to do?", choices: ["Favorite", "Remove Favorite"] });
|
|
13
|
+
const fetchType = await select({ message: "Which method would you like to use?", choices: Object.keys(gameApiMap) });
|
|
14
|
+
const gameIdentifier = await input({ message: `What is the ${fetchType}?` });
|
|
15
|
+
const isFavorite = action === "Favorite" ? true : false;
|
|
16
|
+
const result = await FavoriteGame(fetchType, gameIdentifier, isFavorite);
|
|
17
|
+
console.log(result);
|
|
18
|
+
RestartTool();
|
|
19
|
+
return;
|
|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d,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchGame.d.ts","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FetchGame.d.ts","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQpD,eAAO,MAAM,gBAAgB,EAAE,UAsC9B,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { input, select
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { setTimeout } from "node:timers/promises";
|
|
1
|
+
import { input, select } from '@inquirer/prompts';
|
|
2
|
+
import { RestartTool } from "../cli.js";
|
|
3
|
+
import { FetchGame, gameApiMap } from "../util/platform/FetchGame.js";
|
|
4
|
+
import { PrintError } from "../util/Styles.js";
|
|
6
5
|
import chalk from "chalk";
|
|
7
|
-
const apiMap = {
|
|
8
|
-
"Slug": "https://api.airship.gg/content/games/slug/",
|
|
9
|
-
"GameId": "https://api.airship.gg/content/games/game-id/"
|
|
10
|
-
};
|
|
11
6
|
export const fetchGameCommand = {
|
|
12
7
|
name: "fetch-game",
|
|
13
8
|
displayName: "Fetch Game",
|
|
@@ -15,54 +10,33 @@ export const fetchGameCommand = {
|
|
|
15
10
|
usage: "fetch-game <method: slug | gameId> <identifier: string>",
|
|
16
11
|
requiresToken: false,
|
|
17
12
|
execute: async () => {
|
|
18
|
-
|
|
19
|
-
PrintHeader("Fetch Game");
|
|
20
|
-
await setTimeout(250);
|
|
21
|
-
const fetchMethod = await select({ message: "Which method would you like to use?", choices: [
|
|
22
|
-
"Slug",
|
|
23
|
-
"GameId"
|
|
24
|
-
] });
|
|
25
|
-
const gameIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(gameApiMap) });
|
|
26
14
|
const dataType = await select({ message: "How would you like your data?", choices: ["Simple", "Verbose"] });
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.log(`${chalk.green("Developer")}: ${userData.organization.name}`);
|
|
49
|
-
console.log(`${chalk.green("Description")}: ${userData.description || ""}\n`);
|
|
50
|
-
break;
|
|
51
|
-
case "Verbose":
|
|
52
|
-
console.dir(result, { depth: null });
|
|
53
|
-
console.log();
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
;
|
|
57
|
-
})).catch((err) => {
|
|
58
|
-
PrintError(err);
|
|
59
|
-
});
|
|
60
|
-
RestartTool();
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
;
|
|
15
|
+
const gameIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
16
|
+
const result = await FetchGame(fetchMethod, gameIdentifier);
|
|
17
|
+
const entries = Object.entries(result);
|
|
18
|
+
const keys = Object.keys(result);
|
|
19
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
20
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
const game = result.game;
|
|
24
|
+
switch (dataType) {
|
|
25
|
+
case "Simple":
|
|
26
|
+
console.log(`\n${chalk.green("Game Id")}: ${game.id}`);
|
|
27
|
+
console.log(`${chalk.green("Name")}: ${game.name}`);
|
|
28
|
+
console.log(`${chalk.green("Slug")}: ${game.slug || ""}`);
|
|
29
|
+
console.log(`${chalk.green("Developer")}: ${game.organization.name}`);
|
|
30
|
+
console.log(`${chalk.green("Description")}: ${game.description || ""}\n`);
|
|
31
|
+
break;
|
|
32
|
+
case "Verbose":
|
|
33
|
+
console.dir(result, { depth: null });
|
|
34
|
+
console.log();
|
|
35
|
+
break;
|
|
64
36
|
}
|
|
65
37
|
;
|
|
38
|
+
RestartTool();
|
|
39
|
+
return;
|
|
66
40
|
}
|
|
67
41
|
};
|
|
68
42
|
//# sourceMappingURL=FetchGame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchGame.js","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"FetchGame.js","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAe;IACxC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE,yDAAyD;IAChE,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,CAAC,CAAC;QACtH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,OAAO,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WAAW,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC1E,MAAM;YACV,KAAK,SAAS;gBACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM;QACd,CAAC;QAAA,CAAC;QAEF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchProfilePhoto.d.ts","sourceRoot":"","sources":["../../src/commands/FetchProfilePhoto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,eAAO,MAAM,wBAAwB,EAAE,UA2BtC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PrintError } from "../util/Styles.js";
|
|
2
|
+
import { input, select } from "@inquirer/prompts";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { RestartTool } from "../cli.js";
|
|
5
|
+
import { FetchUser, userApiMap } from "../util/platform/FetchUser.js";
|
|
6
|
+
export const FetchProfilePhotoCommand = {
|
|
7
|
+
name: "fetch-profile-photo",
|
|
8
|
+
displayName: "Fetch Profile Photo",
|
|
9
|
+
description: "Returns the profile picture of the given user.",
|
|
10
|
+
usage: "<method: username | userId> <identifier: string>",
|
|
11
|
+
requiresToken: false,
|
|
12
|
+
execute: async () => {
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(userApiMap) });
|
|
14
|
+
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
15
|
+
const result = await FetchUser(fetchMethod, userIdentifier);
|
|
16
|
+
const entries = Object.entries(result);
|
|
17
|
+
const keys = Object.keys(result);
|
|
18
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
19
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
const user = result.user;
|
|
23
|
+
const profileImageId = user.profileImageId;
|
|
24
|
+
if (!profileImageId)
|
|
25
|
+
return PrintError("User has no profile image!");
|
|
26
|
+
console.log(chalk.green(`\nhttps://cdn.airship.gg/images/${profileImageId}\n`));
|
|
27
|
+
RestartTool();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=FetchProfilePhoto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchProfilePhoto.js","sourceRoot":"","sources":["../../src/commands/FetchProfilePhoto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,CAAC,MAAM,wBAAwB,GAAe;IAChD,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,gDAAgD;IAC7D,KAAK,EAAE,kDAAkD;IACzD,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,CAAC,CAAC;QACtH,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,oBAAoB,WAAW,GAAG,EAAE,CAAC,CAAC;QAEpF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACjE,OAAO,UAAU,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;QAChD,CAAC;QAAA,CAAC;QAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,cAAc;YAAE,OAAO,UAAU,CAAC,4BAA4B,CAAC,CAAC;QAErE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mCAAmC,cAAc,IAAI,CAAC,CAAC,CAAC;QAEhF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchUser.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FetchUser.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,eAAO,MAAM,gBAAgB,EAAE,UAmC9B,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { input, select
|
|
2
|
-
import { PrintError
|
|
3
|
-
import {
|
|
4
|
-
import { RestartTool, StartTool } from "../cli.js";
|
|
1
|
+
import { input, select } from '@inquirer/prompts';
|
|
2
|
+
import { PrintError } from '../util/Styles.js';
|
|
3
|
+
import { RestartTool } from "../cli.js";
|
|
5
4
|
import chalk from "chalk";
|
|
6
|
-
import {
|
|
7
|
-
const apiMap = {
|
|
8
|
-
"Username": "https://api.airship.gg/game-coordinator/users/user?username=",
|
|
9
|
-
"UserId": "https://api.airship.gg/game-coordinator/users/uid/"
|
|
10
|
-
};
|
|
5
|
+
import { FetchUser, userApiMap } from "../util/platform/FetchUser.js";
|
|
11
6
|
export const fetchUserCommand = {
|
|
12
7
|
name: "fetch-user",
|
|
13
8
|
displayName: "Fetch User",
|
|
@@ -15,52 +10,31 @@ export const fetchUserCommand = {
|
|
|
15
10
|
usage: "fetch-user <method: username | userId> <identifier: string>",
|
|
16
11
|
requiresToken: false,
|
|
17
12
|
execute: async () => {
|
|
18
|
-
|
|
19
|
-
PrintHeader("Fetch User");
|
|
20
|
-
await setTimeout(250);
|
|
21
|
-
const fetchMethod = await select({ message: "Which method would you like to use?", choices: [
|
|
22
|
-
"Username",
|
|
23
|
-
"UserId"
|
|
24
|
-
] });
|
|
25
|
-
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(userApiMap) });
|
|
26
14
|
const dataType = await select({ message: "How would you like your data?", choices: ["Simple", "Verbose"] });
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
console.log(`${chalk.green("Username")}: ${userData.username}`);
|
|
47
|
-
console.log(`${chalk.green("Status Text")}: ${userData.statusText || ""}\n`);
|
|
48
|
-
break;
|
|
49
|
-
case "Verbose":
|
|
50
|
-
console.dir(result, { depth: null });
|
|
51
|
-
console.log();
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
;
|
|
55
|
-
})).catch((err) => {
|
|
56
|
-
PrintError(err);
|
|
57
|
-
});
|
|
58
|
-
RestartTool();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
;
|
|
15
|
+
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
16
|
+
const result = await FetchUser(fetchMethod, userIdentifier);
|
|
17
|
+
const entries = Object.entries(result);
|
|
18
|
+
const keys = Object.keys(result);
|
|
19
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
20
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
const user = result.user;
|
|
24
|
+
switch (dataType) {
|
|
25
|
+
case "Simple":
|
|
26
|
+
console.log(`\n${chalk.green("User Id")}: ${user.uid}`);
|
|
27
|
+
console.log(`${chalk.green("Username")}: ${user.username}`);
|
|
28
|
+
console.log(`${chalk.green("Status Text")}: ${user.statusText || ""}\n`);
|
|
29
|
+
break;
|
|
30
|
+
case "Verbose":
|
|
31
|
+
console.dir(result, { depth: null });
|
|
32
|
+
console.log();
|
|
33
|
+
break;
|
|
62
34
|
}
|
|
63
35
|
;
|
|
36
|
+
RestartTool();
|
|
37
|
+
return;
|
|
64
38
|
}
|
|
65
39
|
};
|
|
66
40
|
//# sourceMappingURL=FetchUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchUser.js","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"FetchUser.js","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EA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