@lizard-build/cli 0.3.73 → 0.3.75

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/src/lib/api.ts CHANGED
@@ -131,6 +131,30 @@ async function request<T = any>(
131
131
  return JSON.parse(text) as T;
132
132
  }
133
133
 
134
+ /** Like api.get, but returns the raw response body instead of JSON.parse-ing
135
+ * it — for endpoints that reply with `text/plain` (e.g. sandbox file reads). */
136
+ export async function getRawText(path: string): Promise<string> {
137
+ const url = baseURL + path;
138
+ const token = _accessToken || getToken();
139
+ const headers: Record<string, string> = { "User-Agent": USER_AGENT };
140
+ if (token) headers["Authorization"] = `Bearer ${token}`;
141
+
142
+ const res = await fetch(url, { method: "GET", headers });
143
+ if (!res.ok) {
144
+ let msg = res.statusText;
145
+ let code = "";
146
+ let body: unknown = null;
147
+ try {
148
+ const j = (await res.json()) as any;
149
+ body = j;
150
+ msg = j.error || j.message || msg;
151
+ code = j.code || "";
152
+ } catch {}
153
+ throw new APIError(res.status, msg, code, body);
154
+ }
155
+ return res.text();
156
+ }
157
+
134
158
  export const api = {
135
159
  get: <T = any>(path: string) => request<T>("GET", path),
136
160
  post: <T = any>(path: string, body?: unknown, headers?: Record<string, string>) =>
@@ -139,7 +163,7 @@ export const api = {
139
163
  request<T>("PUT", path, body),
140
164
  patch: <T = any>(path: string, body?: unknown) =>
141
165
  request<T>("PATCH", path, body),
142
- delete: <T = any>(path: string) => request<T>("DELETE", path),
166
+ delete: <T = any>(path: string, body?: unknown) => request<T>("DELETE", path, body),
143
167
  };
144
168
 
145
169
  /** Compare two Redis-stream-style event ids (`<ms>-<seq>`). Returns true when
@@ -5,7 +5,7 @@ import { join, dirname } from "node:path";
5
5
  import os from "node:os";
6
6
  import { spawn } from "node:child_process";
7
7
 
8
- export const CURRENT_VERSION = "0.3.73";
8
+ export const CURRENT_VERSION = "0.3.75";
9
9
  const RELEASES_API = "https://api.github.com/repos/lizard-build/lizard-cli/releases/latest";
10
10
  const RELEASE_BASE = "https://github.com/lizard-build/lizard-cli/releases/latest/download";
11
11