airship-cli 1.0.0

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.
Files changed (53) hide show
  1. package/LICENSE +674 -0
  2. package/out/AirshipTypes.d.ts +60 -0
  3. package/out/AirshipTypes.d.ts.map +1 -0
  4. package/out/AirshipTypes.js +2 -0
  5. package/out/AirshipTypes.js.map +1 -0
  6. package/out/Types.d.ts +2 -0
  7. package/out/Types.d.ts.map +1 -0
  8. package/out/Types.js +2 -0
  9. package/out/Types.js.map +1 -0
  10. package/out/cli.d.ts +9 -0
  11. package/out/cli.d.ts.map +1 -0
  12. package/out/cli.js +44 -0
  13. package/out/cli.js.map +1 -0
  14. package/out/commands/CommandTypes.d.ts +8 -0
  15. package/out/commands/CommandTypes.d.ts.map +1 -0
  16. package/out/commands/CommandTypes.js +2 -0
  17. package/out/commands/CommandTypes.js.map +1 -0
  18. package/out/commands/FetchGame.d.ts +3 -0
  19. package/out/commands/FetchGame.d.ts.map +1 -0
  20. package/out/commands/FetchGame.js +55 -0
  21. package/out/commands/FetchGame.js.map +1 -0
  22. package/out/commands/FetchUser copy.d.ts +3 -0
  23. package/out/commands/FetchUser copy.d.ts.map +1 -0
  24. package/out/commands/FetchUser copy.js +46 -0
  25. package/out/commands/FetchUser copy.js.map +1 -0
  26. package/out/commands/FetchUser.d.ts +3 -0
  27. package/out/commands/FetchUser.d.ts.map +1 -0
  28. package/out/commands/FetchUser.js +55 -0
  29. package/out/commands/FetchUser.js.map +1 -0
  30. package/out/commands/help.d.ts +3 -0
  31. package/out/commands/help.d.ts.map +1 -0
  32. package/out/commands/help.js +34 -0
  33. package/out/commands/help.js.map +1 -0
  34. package/out/index.d.ts.map +1 -0
  35. package/out/index.js.map +1 -0
  36. package/out/util/Styles.d.ts +4 -0
  37. package/out/util/Styles.d.ts.map +1 -0
  38. package/out/util/Styles.js +19 -0
  39. package/out/util/Styles.js.map +1 -0
  40. package/out/util/TokenManager.d.ts +2 -0
  41. package/out/util/TokenManager.d.ts.map +1 -0
  42. package/out/util/TokenManager.js +16 -0
  43. package/out/util/TokenManager.js.map +1 -0
  44. package/package.json +24 -0
  45. package/src/AirshipTypes.ts +63 -0
  46. package/src/cli.ts +49 -0
  47. package/src/commands/CommandTypes.ts +7 -0
  48. package/src/commands/FetchGame.ts +61 -0
  49. package/src/commands/FetchUser.ts +61 -0
  50. package/src/commands/Help.ts +36 -0
  51. package/src/util/Styles.ts +20 -0
  52. package/src/util/TokenManager.ts +20 -0
  53. package/tsconfig.json +42 -0
@@ -0,0 +1,60 @@
1
+ export type AccountInfo = {
2
+ refreshToken: string;
3
+ time: number;
4
+ };
5
+ export type AirshipUser = {
6
+ user: {
7
+ uid: string;
8
+ username: string;
9
+ usernameLower: string;
10
+ statusText: string;
11
+ profileImageId: string;
12
+ lastOnlineTime: string;
13
+ };
14
+ };
15
+ export type AirshipUserError = {
16
+ message: string[];
17
+ error: string;
18
+ statusCode: number;
19
+ };
20
+ export type AirshipOrganization = {
21
+ id: string;
22
+ slug: string;
23
+ slugProperCase: string;
24
+ name: string;
25
+ description: string | null;
26
+ iconImageId: string;
27
+ createdAt: string;
28
+ adminBanned: boolean;
29
+ };
30
+ type GameLink = {
31
+ type: "DISCORD";
32
+ url: string;
33
+ };
34
+ export type AirshipGame = {
35
+ game: {
36
+ id: string;
37
+ slug: string | null;
38
+ slugProperCase: string | null;
39
+ name: string;
40
+ description: string | null;
41
+ iconImageId: string;
42
+ organizationId: string;
43
+ createdAt: string;
44
+ visibility: "PUBLIC" | "UNLISTED" | "PRIVATE";
45
+ lastVersionUpdate: string;
46
+ archivedAt: string | null;
47
+ loadingScreenImageId: string | null;
48
+ logoImageId: string | null;
49
+ videoId: string | null;
50
+ links: GameLink[];
51
+ plays: number;
52
+ favorites: number;
53
+ plays24h: number;
54
+ uniquePlays24h: number;
55
+ platforms: string[];
56
+ organization: AirshipOrganization;
57
+ };
58
+ };
59
+ export {};
60
+ //# sourceMappingURL=AirshipTypes.d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W,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;QAC9C,iBAAiB,EAAE,MAAM,CAAC;QAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AirshipTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AirshipTypes.js","sourceRoot":"","sources":["../src/AirshipTypes.ts"],"names":[],"mappings":""}
package/out/Types.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":""}
package/out/Types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.js","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":""}
package/out/cli.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ export declare const commandMap: {
3
+ Help: import("./commands/CommandTypes.js").CLICommand;
4
+ "Fetch User": import("./commands/CommandTypes.js").CLICommand;
5
+ "Fetch Game": import("./commands/CommandTypes.js").CLICommand;
6
+ };
7
+ export declare const commandList: string[];
8
+ export declare function StartTool(): void;
9
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAUA,eAAO,MAAM,UAAU;;;;CAItB,CAAC;AAEF,eAAO,MAAM,WAAW,UAIvB,CAAC;AAEF,wBAAgB,SAAS,SAMxB"}
package/out/cli.js ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { input, select } from '@inquirer/prompts';
3
+ import { PrintHeader, PrintError, PrintTitle } from './util/Styles.js';
4
+ import { AirshipToken } from './util/TokenManager.js';
5
+ import { isInt16Array } from 'node:util/types';
6
+ import { helpCommand } from './commands/help.js';
7
+ import { fetchUserCommand } from './commands/FetchUser.js';
8
+ import { fetchGameCommand } from './commands/FetchGame.js';
9
+ export const commandMap = {
10
+ "Help": helpCommand,
11
+ "Fetch User": fetchUserCommand,
12
+ "Fetch Game": fetchGameCommand
13
+ };
14
+ export const commandList = [
15
+ "Help",
16
+ "Fetch User",
17
+ "Fetch Game"
18
+ ];
19
+ export function StartTool() {
20
+ PrintTitle();
21
+ setTimeout(() => {
22
+ PromptCommand();
23
+ }, 250);
24
+ }
25
+ ;
26
+ StartTool();
27
+ async function PromptCommand() {
28
+ const answer = await select({ message: "What would you like to do?", choices: commandList });
29
+ for (let command of Object.entries(commandMap)) {
30
+ const cmdName = command[0];
31
+ const cmdFunction = command[1];
32
+ if (answer === cmdName) {
33
+ PrintTitle();
34
+ setTimeout(() => {
35
+ cmdFunction.execute();
36
+ }, 250);
37
+ return;
38
+ }
39
+ ;
40
+ }
41
+ ;
42
+ }
43
+ ;
44
+ //# sourceMappingURL=cli.js.map
package/out/cli.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,E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E,CAAC;YAC1B,CAAC,EAAE,GAAG,CAAC,CAAC;YACR,OAAO;QACX,CAAC;QAAA,CAAC;IACN,CAAC;IAAA,CAAC;AACN,CAAC;AAAA,CAAC"}
@@ -0,0 +1,8 @@
1
+ export type CLICommand = {
2
+ name: string;
3
+ description: string;
4
+ usage: string;
5
+ requiresToken: boolean;
6
+ execute: () => void;
7
+ };
8
+ //# sourceMappingURL=CommandTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandTypes.d.ts","sourceRoot":"","sources":["../../src/commands/CommandTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAA;CACtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CommandTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandTypes.js","sourceRoot":"","sources":["../../src/commands/CommandTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { CLICommand } from "./CommandTypes.js";
2
+ export declare const fetchGameCommand: CLICommand;
3
+ //# sourceMappingURL=FetchGame.d.ts.map
@@ -0,0 +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;AAYpD,eAAO,MAAM,gBAAgB,EAAE,UAgD9B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { input, select, confirm } from '@inquirer/prompts';
2
+ import { PrintHeader, PrintError, PrintTitle } from '../util/Styles.js';
3
+ import { AirshipToken } from '../util/TokenManager.js';
4
+ import { StartTool } from "../cli.js";
5
+ const apiMap = {
6
+ "Slug": "https://api.airship.gg/content/games/slug/",
7
+ "GameId": "https://api.airship.gg/content/games/game-id/"
8
+ };
9
+ export const fetchGameCommand = {
10
+ name: "fetch-game",
11
+ description: "Returns data related to the specified game.",
12
+ usage: "fetch-game <method: slug | gameId> <identifier: string>",
13
+ requiresToken: false,
14
+ execute: async () => {
15
+ const fetchMethod = await select({ message: "Which method would you like to use?", choices: [
16
+ "Slug",
17
+ "GameId"
18
+ ] });
19
+ const gameIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
20
+ for (let data of Object.entries(apiMap)) {
21
+ const method = data[0];
22
+ const url = data[1];
23
+ if (method === fetchMethod) {
24
+ fetch(url + gameIdentifier, {
25
+ method: "GET"
26
+ }).then(raw => raw.text().then(data => {
27
+ const gameData = JSON.parse(data);
28
+ const entries = Object.entries(gameData);
29
+ if (entries.length === 0) {
30
+ PrintError(`Invalid ${fetchMethod}!`);
31
+ }
32
+ else if (entries.length === 3) {
33
+ // const styledError = `${entries[0]?.[1]}`.replaceAll("username", "Username").replaceAll(",", ", ");
34
+ // PrintError(styledError);
35
+ }
36
+ ;
37
+ console.log(gameData);
38
+ })).catch((err) => {
39
+ PrintError(err);
40
+ });
41
+ setTimeout(async () => {
42
+ const restartTool = await confirm({ message: "Would you like to anything else?" });
43
+ if (restartTool) {
44
+ StartTool();
45
+ }
46
+ ;
47
+ }, 1000);
48
+ return;
49
+ }
50
+ ;
51
+ }
52
+ ;
53
+ }
54
+ };
55
+ //# sourceMappingURL=FetchGame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetchGame.js","sourceRoot":"","sources":["../../src/commands/FetchGame.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,SAA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AM,KAAK,CAAC,EAAE,CAAC;wBAC9B,qGAAqG;wBACrG,2BAA2B;oBAC/B,CAAC;oBAAA,CAAC;oBAEF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC1B,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACd,UAAU,CAAC,GAAG,CAAC,CAAC;gBACpB,CAAC,CAAC,CAAC;gBAEH,UAAU,CAAC,KAAK,IAAI,EAAE;oBAClB,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC,CAAC;oBAEnF,IAAI,WAAW,EAAE,CAAC;wBACd,SAAS,EAAE,CAAC;oBAChB,CAAC;oBAAA,CAAC;gBACN,CAAC,EAAE,IAAI,CAAC,CAAC;gBAET,OAAO;YACX,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CLICommand } from "./CommandTypes.js";
2
+ export declare const fetchUserCommand: CLICommand;
3
+ //# sourceMappingURL=FetchUser%20copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetchUser copy.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUser copy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAWpD,eAAO,MAAM,gBAAgB,EAAE,UAsC9B,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { input, select } from '@inquirer/prompts';
2
+ import { PrintHeader, PrintError, PrintTitle } from '../util/Styles.js';
3
+ import { AirshipToken } from '../util/TokenManager.js';
4
+ const apiMap = {
5
+ "Username": "https://api.airship.gg/game-coordinator/users/user?username=",
6
+ "UserId": "https://api.airship.gg/game-coordinator/users/uid/"
7
+ };
8
+ export const fetchUserCommand = {
9
+ name: "fetch-user",
10
+ description: "Returns data related to the specified user.",
11
+ usage: "fetch-user <method: username | userId> <identifier: string>",
12
+ requiresToken: false,
13
+ execute: async () => {
14
+ const fetchMethod = await select({ message: "Which method would you like to use?", choices: [
15
+ "Username",
16
+ "UserId"
17
+ ] });
18
+ const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
19
+ for (let data of Object.entries(apiMap)) {
20
+ const method = data[0];
21
+ const url = data[1];
22
+ if (method === fetchMethod) {
23
+ fetch(url + userIdentifier, {
24
+ method: "GET"
25
+ }).then(raw => raw.text().then(data => {
26
+ const userData = JSON.parse(data);
27
+ const entries = Object.entries(userData);
28
+ if (entries.length === 0) {
29
+ PrintError(`Invalid ${fetchMethod}!`);
30
+ }
31
+ else if (entries.length === 3) {
32
+ const styledError = `${entries[0]?.[1]}`.replaceAll("username", "Username").replaceAll(",", ", ");
33
+ PrintError(styledError);
34
+ }
35
+ ;
36
+ })).catch((err) => {
37
+ PrintError(err);
38
+ });
39
+ return;
40
+ }
41
+ ;
42
+ }
43
+ ;
44
+ }
45
+ };
46
+ //# sourceMappingURL=FetchUser%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetchUser copy.js","sourceRoot":"","sources":["../../src/commands/FetchUser copy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,MAAM,MAAM,GAAG;IACX,UAAU,EAAE,8DAA8D;IAC1E,QAAQ,EAAE,oDAAoD;CACjE,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAe;IACxC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE,6DAA6D;IACpE,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,MAAM,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AAE;oBACd,UAAU,CAAC,GAAG,CAAC,CAAC;gBACpB,CAAC,CAAC,CAAC;gBAEH,OAAO;YACX,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CLICommand } from "./CommandTypes.js";
2
+ export declare const fetchUserCommand: CLICommand;
3
+ //# sourceMappingURL=FetchUser.d.ts.map
@@ -0,0 +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;AAYpD,eAAO,MAAM,gBAAgB,EAAE,UAgD9B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { input, select, confirm } from '@inquirer/prompts';
2
+ import { PrintHeader, PrintError, PrintTitle } from '../util/Styles.js';
3
+ import { AirshipToken } from '../util/TokenManager.js';
4
+ import { StartTool } from "../cli.js";
5
+ const apiMap = {
6
+ "Username": "https://api.airship.gg/game-coordinator/users/user?username=",
7
+ "UserId": "https://api.airship.gg/game-coordinator/users/uid/"
8
+ };
9
+ export const fetchUserCommand = {
10
+ name: "fetch-user",
11
+ description: "Returns data related to the specified user.",
12
+ usage: "fetch-user <method: username | userId> <identifier: string>",
13
+ requiresToken: false,
14
+ execute: async () => {
15
+ const fetchMethod = await select({ message: "Which method would you like to use?", choices: [
16
+ "Username",
17
+ "UserId"
18
+ ] });
19
+ const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
20
+ for (let data of Object.entries(apiMap)) {
21
+ const method = data[0];
22
+ const url = data[1];
23
+ if (method === fetchMethod) {
24
+ fetch(url + userIdentifier, {
25
+ method: "GET"
26
+ }).then(raw => raw.text().then(data => {
27
+ const userData = JSON.parse(data);
28
+ const entries = Object.entries(userData);
29
+ if (entries.length === 0) {
30
+ PrintError(`Invalid ${fetchMethod}!`);
31
+ }
32
+ else if (entries.length === 3) {
33
+ const styledError = `${entries[0]?.[1]}`.replaceAll("username", "Username").replaceAll(",", ", ");
34
+ PrintError(styledError);
35
+ }
36
+ ;
37
+ console.log(userData);
38
+ })).catch((err) => {
39
+ PrintError(err);
40
+ });
41
+ setTimeout(async () => {
42
+ const restartTool = await confirm({ message: "Would you like to anything else?" });
43
+ if (restartTool) {
44
+ StartTool();
45
+ }
46
+ ;
47
+ }, 1000);
48
+ return;
49
+ }
50
+ ;
51
+ }
52
+ ;
53
+ }
54
+ };
55
+ //# sourceMappingURL=FetchUser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetchUser.js","sourceRoot":"","sources":["../../src/commands/FetchUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,GAAG;IACX,UAAU,EAAE,8DAA8D;IAC1E,QAAQ,EAAE,oDAAoD;CACjE,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAe;IACxC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE,6DAA6D;IACpE,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,OAAO,EAAE;gBACxF,UAAU;gBACV,QAAQ;aACX,EAAC,CAAC,CAAC;QAEJ,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,oBAAoB,WAAW,GAAG,EAAE,CAAC,CAAC;QAEpF,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,OAA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AEnF,IAAI,WAAW,EAAE,CAAC;wBACd,SAAS,EAAE,CAAC;oBAChB,CAAC;oBAAA,CAAC;gBACN,CAAC,EAAE,IAAI,CAAC,CAAC;gBAET,OAAO;YACX,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CLICommand } from "./CommandTypes.js";
2
+ export declare const helpCommand: CLICommand;
3
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,eAAO,MAAM,WAAW,EAAE,UA4BzB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import chalk from "chalk";
2
+ import { input, select, confirm } from '@inquirer/prompts';
3
+ import { PrintHeader, PrintError, PrintTitle } from '../util/Styles.js';
4
+ import { AirshipToken } from '../util/TokenManager.js';
5
+ import { commandMap, commandList, StartTool } from "../cli.js";
6
+ export const helpCommand = {
7
+ name: "help",
8
+ description: "Returns the usage of a command.",
9
+ usage: "help <command: string>",
10
+ requiresToken: false,
11
+ execute: async () => {
12
+ const commandSelect = await select({ message: "Which command do you need help with?", choices: commandList.slice(1) });
13
+ for (let command of Object.entries(commandMap)) {
14
+ if (command[0] === commandSelect) {
15
+ console.log(`\n`);
16
+ console.log(`${chalk.bold(chalk.green(`${commandSelect} Help:`))}`);
17
+ console.log(`- Description: ${chalk.gray(command[1].description)}`);
18
+ console.log(`- Usage: ${chalk.gray(command[1].usage)}`);
19
+ console.log(`\n`);
20
+ setTimeout(async () => {
21
+ const restartTool = await confirm({ message: "Would you like to anything else?" });
22
+ if (restartTool) {
23
+ StartTool();
24
+ }
25
+ ;
26
+ }, 0);
27
+ return;
28
+ }
29
+ ;
30
+ }
31
+ ;
32
+ }
33
+ };
34
+ //# sourceMappingURL=help.js.map
@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CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACxD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAElB,UAAU,CAAC,KAAK,IAAI,EAAE;oBAClB,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC,CAAC;oBAEnF,IAAI,WAAW,EAAE,CAAC;wBACd,SAAS,EAAE,CAAC;oBAChB,CAAC;oBAAA,CAAC;gBACN,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEN,OAAO;YACX,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;IACN,CAAC;CACJ,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU;;;;CAItB,CAAC;AAEF,eAAO,MAAM,WAAW,UAIvB,CAAC;AAEF,wBAAgB,SAAS,SAMxB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,MAAM,EAAE,WAAW;IACnB,YAAY,EAAE,gBAAgB;IAC9B,YAAY,EAAE,gBAAgB;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,MAAM;IACN,YAAY;IACZ,YAAY;CACf,CAAC;AAEF,MAAM,UAAU,SAAS;IACrB,UAAU,EAAE,CAAC;IAEb,UAAU,CAAC,GAAG,EAAE;QACZ,aAAa,EAAE,CAAC;IACpB,CAAC,EAAE,GAAG,CAAC,CAAC;AACZ,CAAC;AAAA,CAAC;AAEF,SAAS,EAAE,CAAC;AAEZ,KAAK,UAAU,aAAa;IACxB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,OAAO,EAAE,WAAW,EAAC,CAAC,CAAC;IAE5F,KAAK,IAAI,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAE/B,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACrB,UAAU,EAAE,CAAC;YAEb,UAAU,CAAC,GAAG,EAAE;gBACZ,WAAW,CAAC,OAAO,EAAE,CAAC;YAC1B,CAAC,EAAE,GAAG,CAAC,CAAC;YACR,OAAO;QACX,CAAC;QAAA,CAAC;IACN,CAAC;IAAA,CAAC;AACN,CAAC;AAAA,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function PrintHeader(message: string): Promise<void>;
2
+ export declare function PrintError(message: string): Promise<void>;
3
+ export declare function PrintTitle(): void;
4
+ //# sourceMappingURL=Styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../src/util/Styles.ts"],"names":[],"mappings":"AAGA,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,iBAKhD;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,iBAI/C;AAED,wBAAgB,UAAU,SAGzB"}
@@ -0,0 +1,19 @@
1
+ import figlet from "figlet";
2
+ import chalk from "chalk";
3
+ export async function PrintHeader(message) {
4
+ const textArt = await figlet.text(message);
5
+ const coloredText = chalk.blue(textArt);
6
+ console.log(chalk.bold(coloredText));
7
+ }
8
+ ;
9
+ export async function PrintError(message) {
10
+ const coloredText = chalk.red(message);
11
+ console.log(chalk.bold(coloredText));
12
+ }
13
+ ;
14
+ export function PrintTitle() {
15
+ console.clear();
16
+ PrintHeader(`Airship CLI\n\n`);
17
+ }
18
+ ;
19
+ //# sourceMappingURL=Styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Styles.js","sourceRoot":"","sources":["../../src/util/Styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAe;IAC7C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAExC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AACzC,CAAC;AAAA,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAe;IAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AACzC,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,UAAU;IACtB,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,WAAW,CAAC,iBAAiB,CAAC,CAAC;AACnC,CAAC;AAAA,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const AirshipToken: string;
2
+ //# sourceMappingURL=TokenManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenManager.d.ts","sourceRoot":"","sources":["../../src/util/TokenManager.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,YAAY,QAAsB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import * as fs from 'fs';
2
+ import { PrintError } from './Styles.js';
3
+ const airshipAccountPath = process.env.APPDATA + `../../LocalLow/Easy/Airship/account.json`;
4
+ function FetchAirshipToken() {
5
+ const accountsFile = fs.readFileSync(airshipAccountPath);
6
+ if (!accountsFile) {
7
+ PrintError("No Airship Installation Found!");
8
+ process.exit(1);
9
+ }
10
+ ;
11
+ const jsonData = JSON.parse(accountsFile.toString("utf8"));
12
+ return jsonData.refreshToken;
13
+ }
14
+ ;
15
+ export const AirshipToken = FetchAirshipToken();
16
+ //# sourceMappingURL=TokenManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenManager.js","sourceRoot":"","sources":["../../src/util/TokenManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,0CAA0C,CAAC;AAE5F,SAAS,iBAAiB;IACtB,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IACzD,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,UAAU,CAAC,gCAAgC,CAAC,CAAC;QAE7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAAA,CAAC;IAEF,MAAM,QAAQ,GAAgB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAExE,OAAO,QAAQ,CAAC,YAAY,CAAC;AACjC,CAAC;AAAA,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "airship-cli",
3
+ "version": "1.0.0",
4
+ "description": "A CLI Tool to interact with Airship's API endpoints.",
5
+ "main": "out/cli.js",
6
+ "bin": {
7
+ "airship": "out/cli.js"
8
+ },
9
+ "type": "module",
10
+ "scripts": {
11
+ "tsc": "tsc --w"
12
+ },
13
+ "author": "Max McDaniel",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "@inquirer/prompts": "^8.2.0",
17
+ "chalk": "^5.6.2",
18
+ "figlet": "^1.9.4",
19
+ "fs": "^0.0.1-security"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^25.0.10"
23
+ }
24
+ }
@@ -0,0 +1,63 @@
1
+ export type AccountInfo = {
2
+ refreshToken: string,
3
+ time: number
4
+ };
5
+
6
+ export type AirshipUser = {
7
+ user: {
8
+ uid: string,
9
+ username: string,
10
+ usernameLower: string,
11
+ statusText: string,
12
+ profileImageId: string,
13
+ lastOnlineTime: string
14
+ }
15
+ };
16
+
17
+ export type AirshipUserError = {
18
+ message: string[],
19
+ error: string,
20
+ statusCode: number
21
+ };
22
+
23
+ export type AirshipOrganization = {
24
+ id: string,
25
+ slug: string,
26
+ slugProperCase: string,
27
+ name: string,
28
+ description: string | null,
29
+ iconImageId: string,
30
+ createdAt: string,
31
+ adminBanned: boolean
32
+ }
33
+
34
+ type GameLink = {
35
+ type: "DISCORD",
36
+ url: string
37
+ };
38
+
39
+ export type AirshipGame = {
40
+ game: {
41
+ id: string,
42
+ slug: string | null,
43
+ slugProperCase: string | null,
44
+ name: string,
45
+ description: string | null,
46
+ iconImageId: string,
47
+ organizationId: string,
48
+ createdAt: string,
49
+ visibility: "PUBLIC" | "UNLISTED" | "PRIVATE",
50
+ lastVersionUpdate: string,
51
+ archivedAt: string | null,
52
+ loadingScreenImageId: string | null,
53
+ logoImageId: string | null,
54
+ videoId: string | null,
55
+ links: GameLink[],
56
+ plays: number,
57
+ favorites: number,
58
+ plays24h: number,
59
+ uniquePlays24h: number,
60
+ platforms: string[],
61
+ organization: AirshipOrganization
62
+ }
63
+ };
package/src/cli.ts ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { input, select } from '@inquirer/prompts';
4
+ import { PrintHeader, PrintError, PrintTitle } from './util/Styles.js';
5
+ import { AirshipToken } from './util/TokenManager.js';
6
+ import { isInt16Array } from 'node:util/types';
7
+ import { helpCommand } from './commands/help.js';
8
+ import { fetchUserCommand } from './commands/FetchUser.js';
9
+ import { fetchGameCommand } from './commands/FetchGame.js';
10
+
11
+ export const commandMap = {
12
+ "Help": helpCommand,
13
+ "Fetch User": fetchUserCommand,
14
+ "Fetch Game": fetchGameCommand
15
+ };
16
+
17
+ export const commandList = [
18
+ "Help",
19
+ "Fetch User",
20
+ "Fetch Game"
21
+ ];
22
+
23
+ export function StartTool() {
24
+ PrintTitle();
25
+
26
+ setTimeout(() => {
27
+ PromptCommand();
28
+ }, 250);
29
+ };
30
+
31
+ StartTool();
32
+
33
+ async function PromptCommand() {
34
+ const answer = await select({ message: "What would you like to do?", choices: commandList});
35
+
36
+ for (let command of Object.entries(commandMap)) {
37
+ const cmdName = command[0];
38
+ const cmdFunction = command[1];
39
+
40
+ if (answer === cmdName) {
41
+ PrintTitle();
42
+
43
+ setTimeout(() => {
44
+ cmdFunction.execute();
45
+ }, 250);
46
+ return;
47
+ };
48
+ };
49
+ };