@ampless/admin 1.0.0-alpha.84 → 1.0.0-beta.100

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 (43) hide show
  1. package/README.ja.md +2 -2
  2. package/README.md +2 -2
  3. package/dist/api/index.d.ts +34 -7
  4. package/dist/api/index.js +8 -3
  5. package/dist/{chunk-SQ6LFPXH.js → chunk-2TBGPB5H.js} +2 -2
  6. package/dist/{chunk-K44QF3MV.js → chunk-4OFRX6QX.js} +1 -1
  7. package/dist/{chunk-BRTC5O3E.js → chunk-4WYMEUYU.js} +361 -224
  8. package/dist/chunk-7HSWOQWV.js +172 -0
  9. package/dist/{chunk-J6R356H3.js → chunk-7OZ23MLD.js} +1 -1
  10. package/dist/{chunk-OFPNBZKP.js → chunk-7W7LAQXY.js} +76 -8
  11. package/dist/{chunk-HN3UFHP7.js → chunk-ANME5KDN.js} +1 -1
  12. package/dist/{chunk-GGHN2RKQ.js → chunk-E5VF3Y65.js} +69 -3
  13. package/dist/{chunk-V6JNTCPS.js → chunk-JLCTF5HY.js} +8 -2
  14. package/dist/{chunk-YU5MPQXB.js → chunk-LXY3BRKQ.js} +2 -2
  15. package/dist/{chunk-MKWYNK4J.js → chunk-NHMG2MRJ.js} +2 -2
  16. package/dist/{chunk-WXIYV2PO.js → chunk-OPVLQOOB.js} +44 -13
  17. package/dist/{chunk-SMI7Y77B.js → chunk-ORXOMW7M.js} +265 -190
  18. package/dist/{chunk-W4VHP2JW.js → chunk-SYAEM5DM.js} +1 -1
  19. package/dist/{chunk-7NQERXNY.js → chunk-TJZ4FTU6.js} +1 -1
  20. package/dist/{chunk-CFIOUXVE.js → chunk-V5XORHKX.js} +1 -1
  21. package/dist/chunk-ZDIDJCSU.js +40 -0
  22. package/dist/components/account-view.d.ts +8 -0
  23. package/dist/components/account-view.js +10 -0
  24. package/dist/components/admin-dashboard.js +3 -3
  25. package/dist/components/edit-post-view.js +5 -5
  26. package/dist/components/index.d.ts +4 -2
  27. package/dist/components/index.js +7 -7
  28. package/dist/components/login-view.d.ts +3 -1
  29. package/dist/components/login-view.js +4 -3
  30. package/dist/components/mcp-tokens-view.js +3 -3
  31. package/dist/components/media-view.js +5 -5
  32. package/dist/components/new-post-view.js +5 -5
  33. package/dist/components/plugin-settings-form.d.ts +2 -10
  34. package/dist/components/plugin-settings-form.js +5 -7
  35. package/dist/components/posts-list-view.js +3 -3
  36. package/dist/components/users-list-view.js +3 -3
  37. package/dist/{i18n-DA-aakRX.d.ts → i18n-Bd8q9aTl.d.ts} +108 -5
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.js +1 -1
  40. package/dist/metafile-esm.json +1 -1
  41. package/dist/pages/index.d.ts +21 -4
  42. package/dist/pages/index.js +54 -24
  43. package/package.json +5 -6
@@ -1,23 +1,23 @@
1
1
  'use client';
2
+ import {
3
+ setMcpTokenStore
4
+ } from "./chunk-C7G5AQ3L.js";
2
5
  import {
3
6
  invalidateSiteSettingsCache
4
7
  } from "./chunk-D72XF3Q3.js";
5
8
  import {
6
9
  clearAllDrafts
7
- } from "./chunk-BRTC5O3E.js";
10
+ } from "./chunk-4WYMEUYU.js";
8
11
  import {
9
12
  setAdminCmsConfigClient
10
- } from "./chunk-HN3UFHP7.js";
13
+ } from "./chunk-ANME5KDN.js";
11
14
  import {
12
15
  setAdminMediaContext
13
16
  } from "./chunk-2ITWLRYF.js";
14
- import {
15
- setMcpTokenStore
16
- } from "./chunk-C7G5AQ3L.js";
17
17
  import {
18
18
  useLocale,
19
19
  useT
20
- } from "./chunk-K44QF3MV.js";
20
+ } from "./chunk-4OFRX6QX.js";
21
21
 
22
22
  // src/lib/amplify-client.ts
23
23
  import { Amplify } from "aws-amplify";
@@ -94,10 +94,14 @@ function installAdminPostsProvider() {
94
94
  const filter = {};
95
95
  if (status !== "all") filter.status = { eq: status };
96
96
  const hasFilter = Object.keys(filter).length > 0;
97
- const { data } = await client.models.Post.list({
97
+ const { data, errors } = await client.models.Post.list({
98
98
  filter: hasFilter ? filter : void 0,
99
99
  limit: opts.limit ?? 100
100
100
  });
101
+ if (errors && errors.length > 0) {
102
+ console.error("[ampless admin] Post.list failed:", errors);
103
+ throw new Error(errors[0]?.message ?? "Post.list failed");
104
+ }
101
105
  return data.map(toCorePost);
102
106
  },
103
107
  async listSummaries(opts = {}) {
@@ -131,14 +135,22 @@ function installAdminPostsProvider() {
131
135
  return out;
132
136
  },
133
137
  async get(slug) {
134
- const { data } = await client.models.Post.list({
138
+ const { data, errors } = await client.models.Post.list({
135
139
  filter: { slug: { eq: slug } },
136
140
  limit: 1
137
141
  });
142
+ if (errors && errors.length > 0) {
143
+ console.error("[ampless admin] Post.get (by slug) failed:", errors);
144
+ throw new Error(errors[0]?.message ?? "Post.get failed");
145
+ }
138
146
  return data[0] ? toCorePost(data[0]) : null;
139
147
  },
140
148
  async getById(postId) {
141
- const { data } = await client.models.Post.get({ postId });
149
+ const { data, errors } = await client.models.Post.get({ postId });
150
+ if (errors && errors.length > 0) {
151
+ console.error("[ampless admin] Post.get failed:", errors);
152
+ throw new Error(errors[0]?.message ?? "Post.get failed");
153
+ }
142
154
  return data ? toCorePost(data) : null;
143
155
  },
144
156
  async create(input) {
@@ -342,6 +354,7 @@ import {
342
354
  Puzzle,
343
355
  LogOut,
344
356
  ExternalLink,
357
+ UserCircle,
345
358
  Menu,
346
359
  X
347
360
  } from "lucide-react";
@@ -360,7 +373,8 @@ var navItems = [
360
373
  ];
361
374
  function Sidebar({
362
375
  email,
363
- isAdmin
376
+ isAdmin,
377
+ siteName
364
378
  }) {
365
379
  const pathname = usePathname();
366
380
  const t = useT();
@@ -378,7 +392,10 @@ function Sidebar({
378
392
  }, [open]);
379
393
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
380
394
  /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-30 flex h-14 items-center justify-between border-b bg-background px-4 md:hidden", children: [
381
- /* @__PURE__ */ jsx2(Link, { href: "/admin", className: "font-semibold", children: t("sidebar.brand") }),
395
+ /* @__PURE__ */ jsx2(Link, { href: "/admin", className: "font-semibold", children: siteName ? /* @__PURE__ */ jsxs("span", { className: "flex flex-col leading-tight", children: [
396
+ /* @__PURE__ */ jsx2("span", { className: "truncate font-semibold", children: siteName }),
397
+ /* @__PURE__ */ jsx2("span", { className: "text-xs text-muted-foreground", children: t("sidebar.brand") })
398
+ ] }) : t("sidebar.brand") }),
382
399
  /* @__PURE__ */ jsx2(
383
400
  Button,
384
401
  {
@@ -413,7 +430,10 @@ function Sidebar({
413
430
  "aria-label": t("sidebar.brand"),
414
431
  children: [
415
432
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b p-4", children: [
416
- /* @__PURE__ */ jsx2(Link, { href: "/admin", className: "font-semibold", children: t("sidebar.brand") }),
433
+ /* @__PURE__ */ jsx2(Link, { href: "/admin", className: "font-semibold", children: siteName ? /* @__PURE__ */ jsxs("span", { className: "flex flex-col leading-tight", children: [
434
+ /* @__PURE__ */ jsx2("span", { className: "truncate font-semibold", children: siteName }),
435
+ /* @__PURE__ */ jsx2("span", { className: "text-xs text-muted-foreground", children: t("sidebar.brand") })
436
+ ] }) : t("sidebar.brand") }),
417
437
  /* @__PURE__ */ jsx2(
418
438
  Button,
419
439
  {
@@ -459,7 +479,18 @@ function Sidebar({
459
479
  ]
460
480
  }
461
481
  ),
462
- /* @__PURE__ */ jsx2("div", { className: "px-3 py-2 text-xs text-muted-foreground truncate", children: email }),
482
+ /* @__PURE__ */ jsxs(
483
+ Link,
484
+ {
485
+ href: "/admin/account",
486
+ className: "flex items-center gap-3 rounded-md px-3 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground",
487
+ title: t("sidebar.account"),
488
+ children: [
489
+ /* @__PURE__ */ jsx2(UserCircle, { className: "h-4 w-4 shrink-0" }),
490
+ /* @__PURE__ */ jsx2("span", { className: "truncate", children: email })
491
+ ]
492
+ }
493
+ ),
463
494
  /* @__PURE__ */ jsxs(
464
495
  Button,
465
496
  {