leglas 0.7.0 → 0.7.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/dist/bin.js CHANGED
@@ -5192,10 +5192,8 @@ async function startServer(options) {
5192
5192
  let body = "";
5193
5193
  req.on("data", (chunk) => body += chunk);
5194
5194
  return void req.on("end", async () => {
5195
- let parsed2;
5196
- try {
5197
- parsed2 = JSON.parse(body || "{}");
5198
- } catch {
5195
+ const parsed2 = jsonBody(body);
5196
+ if (parsed2 === null) {
5199
5197
  return sendJson(res, 400, { ok: false, error: "Body must be JSON." });
5200
5198
  }
5201
5199
  if (typeof parsed2.title !== "string" || parsed2.title === "") {
@@ -5519,16 +5517,10 @@ async function startServer(options) {
5519
5517
  let body = "";
5520
5518
  req.on("data", (chunk) => body += chunk);
5521
5519
  return void req.on("end", async () => {
5522
- let read;
5523
- try {
5524
- read = JSON.parse(body || "{}");
5525
- } catch {
5520
+ const parsed2 = jsonBody(body);
5521
+ if (parsed2 === null) {
5526
5522
  return sendJson(res, 400, { ok: false, error: "Body must be JSON." });
5527
5523
  }
5528
- if (typeof read !== "object" || read === null || Array.isArray(read)) {
5529
- return sendJson(res, 400, { ok: false, error: "Body must be a JSON object." });
5530
- }
5531
- const parsed2 = read;
5532
5524
  if (typeof parsed2.id !== "string" || parsed2.id === "") {
5533
5525
  return sendJson(res, 400, { ok: false, error: "Body needs the note to reword." });
5534
5526
  }
package/dist/index.js CHANGED
@@ -5568,10 +5568,8 @@ async function startServer(options) {
5568
5568
  let body = "";
5569
5569
  req.on("data", (chunk) => body += chunk);
5570
5570
  return void req.on("end", async () => {
5571
- let parsed;
5572
- try {
5573
- parsed = JSON.parse(body || "{}");
5574
- } catch {
5571
+ const parsed = jsonBody(body);
5572
+ if (parsed === null) {
5575
5573
  return sendJson(res, 400, { ok: false, error: "Body must be JSON." });
5576
5574
  }
5577
5575
  if (typeof parsed.title !== "string" || parsed.title === "") {
@@ -5895,16 +5893,10 @@ async function startServer(options) {
5895
5893
  let body = "";
5896
5894
  req.on("data", (chunk) => body += chunk);
5897
5895
  return void req.on("end", async () => {
5898
- let read;
5899
- try {
5900
- read = JSON.parse(body || "{}");
5901
- } catch {
5896
+ const parsed = jsonBody(body);
5897
+ if (parsed === null) {
5902
5898
  return sendJson(res, 400, { ok: false, error: "Body must be JSON." });
5903
5899
  }
5904
- if (typeof read !== "object" || read === null || Array.isArray(read)) {
5905
- return sendJson(res, 400, { ok: false, error: "Body must be a JSON object." });
5906
- }
5907
- const parsed = read;
5908
5900
  if (typeof parsed.id !== "string" || parsed.id === "") {
5909
5901
  return sendJson(res, 400, { ok: false, error: "Body needs the note to reword." });
5910
5902
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leglas",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Compare design directions inside your own running app.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,8 +28,8 @@
28
28
  "types": "./dist/index.d.ts",
29
29
  "devDependencies": {
30
30
  "tsup": "^8.5.0",
31
- "@leglas/shell": "0.0.0",
32
- "@leglas/server": "0.0.0"
31
+ "@leglas/server": "0.0.0",
32
+ "@leglas/shell": "0.0.0"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=24"