pterocli 1.1.2 → 1.1.3

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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "pterocli",
3
3
  "module": "src/cli.ts",
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "build": "tsc",
8
- "prepack": "bun run build"
7
+ "build": "tsup",
8
+ "prepack": "npm run build"
9
9
  },
10
10
  "bin": {
11
11
  "pterocli": "./dist/cli.js"
@@ -16,6 +16,7 @@
16
16
  "devDependencies": {
17
17
  "dotenv": "^17.3.1",
18
18
  "minimist": "^1.2.8",
19
+ "tsup": "^8.5.1",
19
20
  "zod": "^4.1.12"
20
21
  },
21
22
  "peerDependencies": {
@@ -1,25 +0,0 @@
1
- import z from "zod";
2
- export const websocketAuthResponseSchema = z.object({
3
- // object: z.literal("websocket_token"),
4
- data: z.object({
5
- token: z.string(),
6
- socket: z.string().startsWith("wss://").endsWith("/ws"),
7
- }),
8
- });
9
- export const websocketResponseSchema = z.union([
10
- z.object({
11
- event: z.literal("auth success"),
12
- }),
13
- z.object({
14
- event: z.literal("status"),
15
- args: z.array(z.union([z.literal("running"), z.literal("starting"), z.literal("stopping"), z.literal("offline")])).length(1),
16
- }),
17
- z.object({
18
- event: z.literal("stats"),
19
- args: z.array(z.string()).length(1), // TODO: parse with transformer
20
- }),
21
- z.object({
22
- event: z.literal("console output"),
23
- args: z.array(z.string()).length(1),
24
- }),
25
- ]);
package/dist/api.js DELETED
@@ -1,29 +0,0 @@
1
- import z from "zod";
2
- import { websocketAuthResponseSchema } from "./api-schema";
3
- export async function authWebsocket(server) {
4
- // console.log("b", server);
5
- const response = await server.fetch("/websocket");
6
- const json = await response.json();
7
- // console.log("respon", json);
8
- const data = z.parse(websocketAuthResponseSchema, json);
9
- return data.data;
10
- }
11
- export function createServerContext(options) {
12
- return {
13
- ...options,
14
- getApiPath(endpoint) {
15
- return `${this.baseUrl}/api/client/servers/${this.serverId}${endpoint}`;
16
- },
17
- fetch(endpoint, init) {
18
- // console.log("endpoint", this.getApiPath(endpoint));
19
- return fetch(this.getApiPath(endpoint), {
20
- ...init,
21
- headers: {
22
- Authorization: `Bearer ${this.apiKey}`,
23
- Accept: "Application/vnd.pterodactyl.v1+json",
24
- ...init?.headers,
25
- },
26
- });
27
- },
28
- };
29
- }