@plank-cms/plank 0.28.3 → 0.28.4

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.
@@ -12,7 +12,7 @@
12
12
  href="https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap"
13
13
  rel="stylesheet"
14
14
  />
15
- <script type="module" crossorigin src="/admin/assets/index-CPyjdIRP.js"></script>
15
+ <script type="module" crossorigin src="/admin/assets/index--fTytGO-.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/admin/assets/index-CHJ8C--M.css">
17
17
  </head>
18
18
  <body>
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ function getUpdateScriptCommand(name) {
93
93
  }
94
94
 
95
95
  // src/commands/init.ts
96
- var PACKAGE_VERSION = "0.28.3";
96
+ var PACKAGE_VERSION = "0.28.4";
97
97
  function generateSecret() {
98
98
  return randomBytes(32).toString("hex");
99
99
  }
@@ -202,7 +202,7 @@ import { dirname, join as join3, resolve as resolve2 } from "path";
202
202
  async function start() {
203
203
  config({ path: resolve2(process.cwd(), ".env") });
204
204
  process.env.PLANK_ADMIN_DIST = join3(dirname(fileURLToPath(import.meta.url)), "admin");
205
- const { start: startServer } = await import("./server-WDWBRWGH.js");
205
+ const { start: startServer } = await import("./server-KCPJO7V7.js");
206
206
  await startServer();
207
207
  }
208
208
 
@@ -5580,6 +5580,24 @@ async function updateAddonEnabled(id, enabled) {
5580
5580
  slots_json`, [id, enabled]);
5581
5581
  return rows[0] ?? null;
5582
5582
  }
5583
+ async function deleteAddonRow(id) {
5584
+ const { rows } = await pool_default.query(`DELETE FROM plank_addons
5585
+ WHERE id = $1
5586
+ RETURNING
5587
+ id,
5588
+ package_name,
5589
+ name,
5590
+ version,
5591
+ plank_range,
5592
+ description,
5593
+ installed,
5594
+ enabled,
5595
+ compatible,
5596
+ has_admin_ui,
5597
+ settings_namespace,
5598
+ slots_json`, [id]);
5599
+ return rows[0] ?? null;
5600
+ }
5583
5601
  async function buildAdminAddonsRegistry() {
5584
5602
  const rows = await listAddonRows();
5585
5603
  const enabledRows = rows.filter((row) => row.installed && row.enabled && row.compatible);
@@ -5659,6 +5677,19 @@ async function disableAddon(req, res) {
5659
5677
  const updated = await updateAddonEnabled(req.params.id, false);
5660
5678
  res.json(mapAddon(updated));
5661
5679
  }
5680
+ async function deleteAddon(req, res) {
5681
+ const addon = await getAddonRow(req.params.id);
5682
+ if (!addon) {
5683
+ res.status(404).json({ error: "Addon not found" });
5684
+ return;
5685
+ }
5686
+ if (addon.installed && addon.compatible) {
5687
+ res.status(409).json({ error: "Only missing or incompatible add-ons can be removed" });
5688
+ return;
5689
+ }
5690
+ const deleted = await deleteAddonRow(req.params.id);
5691
+ res.json(mapAddon(deleted));
5692
+ }
5662
5693
  async function getAddonSettings(req, res) {
5663
5694
  const result = await getSettingsAddon(req.params.id);
5664
5695
  if ("error" in result) {
@@ -5786,6 +5817,7 @@ router2.get("/addons/registry", authorize("addons:read"), getAddonsRegistry);
5786
5817
  router2.get("/addons", authorize("addons:read"), listAddons);
5787
5818
  router2.post("/addons/:id/enable", authorize("addons:write"), enableAddon);
5788
5819
  router2.post("/addons/:id/disable", authorize("addons:write"), disableAddon);
5820
+ router2.delete("/addons/:id", authorize("addons:write"), deleteAddon);
5789
5821
  router2.get("/addons/:id/admin-module", authorize("addons:read"), getAddonAdminModuleDefinition);
5790
5822
  router2.get("/addons/:id/admin-entry.js", authorize("addons:read"), getAddonAdminEntry);
5791
5823
  router2.post("/addons/:id/actions", authorize("addons:read"), runAddonAction);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plank-cms/plank",
3
- "version": "0.28.3",
3
+ "version": "0.28.4",
4
4
  "description": "Self-hosted headless CMS. Deploy in minutes on your own infrastructure.",
5
5
  "type": "module",
6
6
  "files": [
@@ -55,9 +55,9 @@
55
55
  "devDependencies": {
56
56
  "@types/fs-extra": "^11.0.4",
57
57
  "tsup": "^8.5.0",
58
- "@plank-cms/db": "0.28.3",
59
- "@plank-cms/schema": "0.28.3",
60
- "@plank-cms/core": "0.28.3"
58
+ "@plank-cms/core": "0.28.4",
59
+ "@plank-cms/db": "0.28.4",
60
+ "@plank-cms/schema": "0.28.4"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "tsup",