zudoku 0.48.0 → 0.48.2

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 (75) hide show
  1. package/dist/config/loader.js +1 -1
  2. package/dist/config/loader.js.map +1 -1
  3. package/dist/flat-config.d.ts +320 -0
  4. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +3 -2
  5. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  6. package/dist/lib/plugins/api-keys/index.js +23 -2
  7. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  8. package/dist/lib/plugins/openapi/Sidecar.js +1 -1
  9. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  10. package/dist/lib/ui/Alert.d.ts +5 -4
  11. package/dist/lib/ui/Alert.js +12 -10
  12. package/dist/lib/ui/Alert.js.map +1 -1
  13. package/dist/lib/ui/CodeBlock.d.ts +1 -2
  14. package/dist/lib/ui/CodeBlock.js +9 -9
  15. package/dist/lib/ui/CodeBlock.js.map +1 -1
  16. package/dist/lib/ui/EmbeddedCodeBlock.d.ts +15 -0
  17. package/dist/lib/ui/EmbeddedCodeBlock.js +18 -0
  18. package/dist/lib/ui/EmbeddedCodeBlock.js.map +1 -0
  19. package/dist/lib/ui/SyntaxHighlight.d.ts +3 -1
  20. package/dist/lib/ui/SyntaxHighlight.js +3 -2
  21. package/dist/lib/ui/SyntaxHighlight.js.map +1 -1
  22. package/dist/lib/util/MdxComponents.d.ts +3 -1
  23. package/dist/vite/config.js +11 -2
  24. package/dist/vite/config.js.map +1 -1
  25. package/dist/vite/plugin-frontmatter.js +2 -0
  26. package/dist/vite/plugin-frontmatter.js.map +1 -1
  27. package/lib/{Markdown-DCAIYXF5.js → Markdown-BQ8YqLsz.js} +80 -88
  28. package/lib/{Markdown-DCAIYXF5.js.map → Markdown-BQ8YqLsz.js.map} +1 -1
  29. package/lib/{MdxPage-Cf9YXWoC.js → MdxPage-DJvKmI-r.js} +3 -3
  30. package/lib/{MdxPage-Cf9YXWoC.js.map → MdxPage-DJvKmI-r.js.map} +1 -1
  31. package/lib/{OasProvider-JMVTfG6_.js → OasProvider-BC0q5m3u.js} +2 -2
  32. package/lib/{OasProvider-JMVTfG6_.js.map → OasProvider-BC0q5m3u.js.map} +1 -1
  33. package/lib/{OperationList-m4tFCI4S.js → OperationList-Dpip6ozi.js} +6 -5
  34. package/lib/{OperationList-m4tFCI4S.js.map → OperationList-Dpip6ozi.js.map} +1 -1
  35. package/lib/{SchemaList-_wRy4aQ0.js → SchemaList-t4BIfh6Z.js} +5 -5
  36. package/lib/{SchemaList-_wRy4aQ0.js.map → SchemaList-t4BIfh6Z.js.map} +1 -1
  37. package/lib/{SchemaView-CRl_cQYH.js → SchemaView-CLxthVcA.js} +3 -3
  38. package/lib/{SchemaView-CRl_cQYH.js.map → SchemaView-CLxthVcA.js.map} +1 -1
  39. package/lib/{Slot-BkYrj_uC.js → Slot-CSEIvwwO.js} +57 -56
  40. package/lib/Slot-CSEIvwwO.js.map +1 -0
  41. package/lib/{SyntaxHighlight-CH9OUJre.js → SyntaxHighlight-C5ja40ix.js} +715 -714
  42. package/lib/{SyntaxHighlight-CH9OUJre.js.map → SyntaxHighlight-C5ja40ix.js.map} +1 -1
  43. package/lib/{Toc-DRxqEsFc.js → Toc-BS0f4GTe.js} +2 -2
  44. package/lib/{Toc-DRxqEsFc.js.map → Toc-BS0f4GTe.js.map} +1 -1
  45. package/lib/{circular-wJaV4vh_.js → circular-DfOaDE_x.js} +2 -2
  46. package/lib/{circular-wJaV4vh_.js.map → circular-DfOaDE_x.js.map} +1 -1
  47. package/lib/{createServer-DN5AJLcN.js → createServer-DjOMygls.js} +3 -3
  48. package/lib/{createServer-DN5AJLcN.js.map → createServer-DjOMygls.js.map} +1 -1
  49. package/lib/{index-DJVaRmzI.js → index-DW2qmCJa.js} +7 -7
  50. package/lib/{index-DJVaRmzI.js.map → index-DW2qmCJa.js.map} +1 -1
  51. package/lib/ui/Alert.js +54 -38
  52. package/lib/ui/Alert.js.map +1 -1
  53. package/lib/ui/CodeBlock.js +54 -62
  54. package/lib/ui/CodeBlock.js.map +1 -1
  55. package/lib/ui/EmbeddedCodeBlock.js +80 -0
  56. package/lib/ui/EmbeddedCodeBlock.js.map +1 -0
  57. package/lib/ui/SyntaxHighlight.js +3 -2
  58. package/lib/ui/SyntaxHighlight.js.map +1 -1
  59. package/lib/zudoku.components.js +2 -2
  60. package/lib/zudoku.plugin-api-catalog.js +1 -1
  61. package/lib/zudoku.plugin-api-keys.js +268 -200
  62. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  63. package/lib/zudoku.plugin-custom-pages.js +1 -1
  64. package/lib/zudoku.plugin-markdown.js +1 -1
  65. package/lib/zudoku.plugin-openapi.js +1 -1
  66. package/package.json +1 -1
  67. package/src/app/main.css +4 -1
  68. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +22 -3
  69. package/src/lib/plugins/api-keys/index.tsx +26 -4
  70. package/src/lib/plugins/openapi/Sidecar.tsx +1 -0
  71. package/src/lib/ui/Alert.tsx +44 -38
  72. package/src/lib/ui/CodeBlock.tsx +39 -53
  73. package/src/lib/ui/EmbeddedCodeBlock.tsx +94 -0
  74. package/src/lib/ui/SyntaxHighlight.tsx +11 -3
  75. package/lib/Slot-BkYrj_uC.js.map +0 -1
@@ -1,49 +1,50 @@
1
1
  import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
- import { CheckIcon as _, XIcon as se, PencilLineIcon as ne, RefreshCwIcon as ie, EyeOffIcon as re, EyeIcon as ae, CopyIcon as oe, TrashIcon as le, KeyRoundIcon as de } from "lucide-react";
3
- import { D as ce, S as O, R as ue } from "./Slot-BkYrj_uC.js";
4
- import { i as P } from "./invariant-DAFpPywt.js";
5
- import { O as fe, L as Q } from "./chunk-DQRVZFIR-BblmKnHy.js";
6
- import { i as he, k as pe, e as xe, d as me } from "./hook-CHXroBFt.js";
2
+ import { CircleSlashIcon as M, CheckIcon as V, XIcon as ae, PencilLineIcon as oe, RefreshCwIcon as le, EyeOffIcon as ce, EyeIcon as de, CopyIcon as ue, TrashIcon as fe, KeyRoundIcon as he } from "lucide-react";
3
+ import { D as pe, S as B, R as me } from "./Slot-CSEIvwwO.js";
4
+ import { i as D } from "./invariant-DAFpPywt.js";
5
+ import { O as xe, L as J } from "./chunk-DQRVZFIR-BblmKnHy.js";
6
+ import { i as ye, k as ge, e as je, d as ve } from "./hook-CHXroBFt.js";
7
7
  import { Button as j } from "./ui/Button.js";
8
- import { u as z } from "./useMutation-N4ockVKi.js";
9
- import * as S from "react";
10
- import ye, { createContext as q, useRef as D, useLayoutEffect as ge, useEffect as B, useId as L, useContext as $, useInsertionEffect as je, useMemo as M, useCallback as Ce, Children as ve, isValidElement as we, useState as E } from "react";
11
- import { C as ke, a as be } from "./Card-DPhGbYUM.js";
12
- import { D as U, e as W, a as X, b as Y, c as G, d as J, f as V, g as K } from "./Dialog-BxpuVLh9.js";
13
- import { Input as Ee } from "./ui/Input.js";
14
- import { c as R } from "./cn-wvCW-ho6.js";
15
- const De = () => {
16
- const t = he();
17
- return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(fe, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
8
+ import { u as S } from "./useMutation-N4ockVKi.js";
9
+ import * as F from "react";
10
+ import Ce, { createContext as O, useRef as P, useLayoutEffect as we, useEffect as W, useId as Q, useContext as _, useInsertionEffect as ke, useMemo as $, useCallback as be, Children as Ee, isValidElement as Ne, useState as E } from "react";
11
+ import { c as Pe } from "./index-DI5SPFK9.js";
12
+ import { c as N } from "./cn-wvCW-ho6.js";
13
+ import { C as De, a as Ie } from "./Card-DPhGbYUM.js";
14
+ import { D as X, e as Y, a as G, b as Z, c as ee, d as te, f as se, g as A } from "./Dialog-BxpuVLh9.js";
15
+ import { Input as Ke } from "./ui/Input.js";
16
+ const Re = () => {
17
+ const t = ye();
18
+ return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(xe, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
18
19
  "Please login first to view this page",
19
20
  /* @__PURE__ */ e.jsx(j, { onClick: () => t.login(), children: "Login" })
20
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(ce, { className: "max-w-[600px]", children: [
21
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(pe, { className: "max-w-[600px]", children: [
21
22
  "Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ",
22
23
  /* @__PURE__ */ e.jsx("code", { children: "authentication" }),
23
24
  "."
24
25
  ] }) });
25
- }, Pe = q({});
26
- function Z(t) {
27
- const i = D(null);
26
+ }, Ae = O({});
27
+ function ne(t) {
28
+ const i = P(null);
28
29
  return i.current === null && (i.current = t()), i.current;
29
30
  }
30
- const Ne = typeof window < "u", Ie = Ne ? ge : B, ee = /* @__PURE__ */ q(null);
31
- function Ke(t) {
31
+ const Te = typeof window < "u", ze = Te ? we : W, ie = /* @__PURE__ */ O(null);
32
+ function Me(t) {
32
33
  return typeof t == "object" && t !== null;
33
34
  }
34
- function Re(t) {
35
- return Ke(t) && "offsetHeight" in t;
35
+ function Se(t) {
36
+ return Me(t) && "offsetHeight" in t;
36
37
  }
37
- const Ae = q({
38
+ const qe = O({
38
39
  transformPagePoint: (t) => t,
39
40
  isStatic: !1,
40
41
  reducedMotion: "never"
41
42
  });
42
- class Te extends S.Component {
43
+ class Le extends F.Component {
43
44
  getSnapshotBeforeUpdate(i) {
44
45
  const s = this.props.childRef.current;
45
46
  if (s && i.isPresent && !this.props.isPresent) {
46
- const n = s.offsetParent, o = Re(n) && n.offsetWidth || 0, r = this.props.sizeRef.current;
47
+ const n = s.offsetParent, o = Se(n) && n.offsetWidth || 0, r = this.props.sizeRef.current;
47
48
  r.height = s.offsetHeight || 0, r.width = s.offsetWidth || 0, r.top = s.offsetTop, r.left = s.offsetLeft, r.right = o - r.width - r.left;
48
49
  }
49
50
  return null;
@@ -57,223 +58,277 @@ class Te extends S.Component {
57
58
  return this.props.children;
58
59
  }
59
60
  }
60
- function ze({ children: t, isPresent: i, anchorX: s }) {
61
- const n = L(), o = D(null), r = D({
61
+ function $e({ children: t, isPresent: i, anchorX: s }) {
62
+ const n = Q(), o = P(null), r = P({
62
63
  width: 0,
63
64
  height: 0,
64
65
  top: 0,
65
66
  left: 0,
66
67
  right: 0
67
- }), { nonce: u } = $(Ae);
68
- return je(() => {
69
- const { width: m, height: f, top: x, left: c, right: d } = r.current;
70
- if (i || !o.current || !m || !f)
68
+ }), { nonce: u } = _(qe);
69
+ return ke(() => {
70
+ const { width: x, height: f, top: h, left: d, right: l } = r.current;
71
+ if (i || !o.current || !x || !f)
71
72
  return;
72
- const y = s === "left" ? `left: ${c}` : `right: ${d}`;
73
+ const y = s === "left" ? `left: ${d}` : `right: ${l}`;
73
74
  o.current.dataset.motionPopId = n;
74
- const h = document.createElement("style");
75
- return u && (h.nonce = u), document.head.appendChild(h), h.sheet && h.sheet.insertRule(`
75
+ const p = document.createElement("style");
76
+ return u && (p.nonce = u), document.head.appendChild(p), p.sheet && p.sheet.insertRule(`
76
77
  [data-motion-pop-id="${n}"] {
77
78
  position: absolute !important;
78
- width: ${m}px !important;
79
+ width: ${x}px !important;
79
80
  height: ${f}px !important;
80
81
  ${y}px !important;
81
- top: ${x}px !important;
82
+ top: ${h}px !important;
82
83
  }
83
84
  `), () => {
84
- document.head.contains(h) && document.head.removeChild(h);
85
+ document.head.contains(p) && document.head.removeChild(p);
85
86
  };
86
- }, [i]), e.jsx(Te, { isPresent: i, childRef: o, sizeRef: r, children: S.cloneElement(t, { ref: o }) });
87
+ }, [i]), e.jsx(Le, { isPresent: i, childRef: o, sizeRef: r, children: F.cloneElement(t, { ref: o }) });
87
88
  }
88
- const Me = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: o, presenceAffectsLayout: r, mode: u, anchorX: m }) => {
89
- const f = Z(Se), x = L();
90
- let c = !0, d = M(() => (c = !1, {
91
- id: x,
89
+ const Fe = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: o, presenceAffectsLayout: r, mode: u, anchorX: x }) => {
90
+ const f = ne(Oe), h = Q();
91
+ let d = !0, l = $(() => (d = !1, {
92
+ id: h,
92
93
  initial: i,
93
94
  isPresent: s,
94
95
  custom: o,
95
96
  onExitComplete: (y) => {
96
97
  f.set(y, !0);
97
- for (const h of f.values())
98
- if (!h)
98
+ for (const p of f.values())
99
+ if (!p)
99
100
  return;
100
101
  n && n();
101
102
  },
102
103
  register: (y) => (f.set(y, !1), () => f.delete(y))
103
104
  }), [s, f, n]);
104
- return r && c && (d = { ...d }), M(() => {
105
- f.forEach((y, h) => f.set(h, !1));
106
- }, [s]), S.useEffect(() => {
105
+ return r && d && (l = { ...l }), $(() => {
106
+ f.forEach((y, p) => f.set(p, !1));
107
+ }, [s]), F.useEffect(() => {
107
108
  !s && !f.size && n && n();
108
- }, [s]), u === "popLayout" && (t = e.jsx(ze, { isPresent: s, anchorX: m, children: t })), e.jsx(ee.Provider, { value: d, children: t });
109
+ }, [s]), u === "popLayout" && (t = e.jsx($e, { isPresent: s, anchorX: x, children: t })), e.jsx(ie.Provider, { value: l, children: t });
109
110
  };
110
- function Se() {
111
+ function Oe() {
111
112
  return /* @__PURE__ */ new Map();
112
113
  }
113
- function qe(t = !0) {
114
- const i = $(ee);
114
+ function Qe(t = !0) {
115
+ const i = _(ie);
115
116
  if (i === null)
116
117
  return [!0, null];
117
- const { isPresent: s, onExitComplete: n, register: o } = i, r = L();
118
- B(() => {
118
+ const { isPresent: s, onExitComplete: n, register: o } = i, r = Q();
119
+ W(() => {
119
120
  if (t)
120
121
  return o(r);
121
122
  }, [t]);
122
- const u = Ce(() => t && n && n(r), [r, n, t]);
123
+ const u = be(() => t && n && n(r), [r, n, t]);
123
124
  return !s && n ? [!1, u] : [!0];
124
125
  }
125
- const N = (t) => t.key || "";
126
- function H(t) {
126
+ const I = (t) => t.key || "";
127
+ function U(t) {
127
128
  const i = [];
128
- return ve.forEach(t, (s) => {
129
- we(s) && i.push(s);
129
+ return Ee.forEach(t, (s) => {
130
+ Ne(s) && i.push(s);
130
131
  }), i;
131
132
  }
132
- const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presenceAffectsLayout: o = !0, mode: r = "sync", propagate: u = !1, anchorX: m = "left" }) => {
133
- const [f, x] = qe(u), c = M(() => H(t), [t]), d = u && !f ? [] : c.map(N), y = D(!0), h = D(c), k = Z(() => /* @__PURE__ */ new Map()), [a, l] = E(c), [p, v] = E(c);
134
- Ie(() => {
135
- y.current = !1, h.current = c;
136
- for (let w = 0; w < p.length; w++) {
137
- const g = N(p[w]);
138
- d.includes(g) ? k.delete(g) : k.get(g) !== !0 && k.set(g, !1);
133
+ const _e = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presenceAffectsLayout: o = !0, mode: r = "sync", propagate: u = !1, anchorX: x = "left" }) => {
134
+ const [f, h] = Qe(u), d = $(() => U(t), [t]), l = u && !f ? [] : d.map(I), y = P(!0), p = P(d), k = ne(() => /* @__PURE__ */ new Map()), [a, c] = E(d), [m, C] = E(d);
135
+ ze(() => {
136
+ y.current = !1, p.current = d;
137
+ for (let w = 0; w < m.length; w++) {
138
+ const g = I(m[w]);
139
+ l.includes(g) ? k.delete(g) : k.get(g) !== !0 && k.set(g, !1);
139
140
  }
140
- }, [p, d.length, d.join("-")]);
141
- const C = [];
142
- if (c !== a) {
143
- let w = [...c];
144
- for (let g = 0; g < p.length; g++) {
145
- const b = p[g], T = N(b);
146
- d.includes(T) || (w.splice(g, 0, b), C.push(b));
141
+ }, [m, l.length, l.join("-")]);
142
+ const v = [];
143
+ if (d !== a) {
144
+ let w = [...d];
145
+ for (let g = 0; g < m.length; g++) {
146
+ const b = m[g], z = I(b);
147
+ l.includes(z) || (w.splice(g, 0, b), v.push(b));
147
148
  }
148
- return r === "wait" && C.length && (w = C), v(H(w)), l(c), null;
149
+ return r === "wait" && v.length && (w = v), C(U(w)), c(d), null;
149
150
  }
150
- process.env.NODE_ENV !== "production" && r === "wait" && p.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
151
- const { forceRender: A } = $(Pe);
152
- return e.jsx(e.Fragment, { children: p.map((w) => {
153
- const g = N(w), b = u && !f ? !1 : c === p || d.includes(g), T = () => {
151
+ process.env.NODE_ENV !== "production" && r === "wait" && m.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
152
+ const { forceRender: T } = _(Ae);
153
+ return e.jsx(e.Fragment, { children: m.map((w) => {
154
+ const g = I(w), b = u && !f ? !1 : d === m || l.includes(g), z = () => {
154
155
  if (k.has(g))
155
156
  k.set(g, !0);
156
157
  else
157
158
  return;
158
- let F = !0;
159
- k.forEach((te) => {
160
- te || (F = !1);
161
- }), F && (A?.(), v(h.current), u && x?.(), n && n());
159
+ let H = !0;
160
+ k.forEach((re) => {
161
+ re || (H = !1);
162
+ }), H && (T?.(), C(p.current), u && h?.(), n && n());
162
163
  };
163
- return e.jsx(Me, { isPresent: b, initial: !y.current || s ? void 0 : !1, custom: i, presenceAffectsLayout: o, mode: r, onExitComplete: b ? void 0 : T, anchorX: m, children: w }, g);
164
+ return e.jsx(Fe, { isPresent: b, initial: !y.current || s ? void 0 : !1, custom: i, presenceAffectsLayout: o, mode: r, onExitComplete: b ? void 0 : z, anchorX: x, children: w }, g);
164
165
  }) });
165
- }, $e = ({ service: t }) => {
166
- const i = pe(), s = xe(), [n, o] = E(
166
+ }, He = Pe(
167
+ "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
168
+ {
169
+ variants: {
170
+ variant: {
171
+ default: "bg-card text-card-foreground",
172
+ destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"
173
+ }
174
+ },
175
+ defaultVariants: {
176
+ variant: "default"
177
+ }
178
+ }
179
+ );
180
+ function q({
181
+ className: t,
182
+ variant: i,
183
+ ...s
184
+ }) {
185
+ return /* @__PURE__ */ e.jsx(
186
+ "div",
187
+ {
188
+ "data-slot": "alert",
189
+ role: "alert",
190
+ className: N(He({ variant: i }), t),
191
+ ...s
192
+ }
193
+ );
194
+ }
195
+ function L({ className: t, ...i }) {
196
+ return /* @__PURE__ */ e.jsx(
197
+ "div",
198
+ {
199
+ "data-slot": "alert-title",
200
+ className: N(
201
+ "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
202
+ t
203
+ ),
204
+ ...i
205
+ }
206
+ );
207
+ }
208
+ const Be = ({ service: t }) => {
209
+ const i = ge(), s = je(), [n, o] = E(
167
210
  null
168
- ), [r, u] = E(""), { data: m, isFetching: f } = me({
211
+ ), [r, u] = E(""), { data: x, isFetching: f } = ve({
169
212
  queryFn: () => t.getConsumers(i),
170
213
  queryKey: ["api-keys"],
171
214
  retry: !1
172
- }), x = z({
215
+ }), h = S({
173
216
  mutationFn: ({
174
217
  consumerId: a,
175
- keyId: l
218
+ keyId: c
176
219
  }) => {
177
220
  if (!t.deleteKey)
178
221
  throw new Error("deleteKey not implemented");
179
- return t.deleteKey(a, l, i);
222
+ return t.deleteKey(a, c, i);
180
223
  },
181
- onMutate: async ({ consumerId: a, keyId: l }) => {
224
+ onMutate: async ({ consumerId: a, keyId: c }) => {
182
225
  await s.cancelQueries({ queryKey: ["api-keys"] });
183
- const p = s.getQueryData([
226
+ const m = s.getQueryData([
184
227
  "api-keys"
185
228
  ]);
186
- return s.setQueryData(["api-keys"], (v) => v && v.map((C) => C.id === a ? {
187
- ...C,
188
- apiKeys: C.apiKeys.filter((A) => A.id !== l)
189
- } : C)), { previousData: p };
229
+ return s.setQueryData(["api-keys"], (C) => C && C.map((v) => v.id === a ? {
230
+ ...v,
231
+ apiKeys: v.apiKeys.filter((T) => T.id !== c)
232
+ } : v)), { previousData: m };
190
233
  },
191
- onError: (a, l, p) => {
192
- p?.previousData && s.setQueryData(["api-keys"], p.previousData);
234
+ onError: (a, c, m) => {
235
+ m?.previousData && s.setQueryData(["api-keys"], m.previousData);
193
236
  },
194
237
  onSuccess: () => {
195
238
  s.invalidateQueries({ queryKey: ["api-keys"] });
196
239
  }
197
- }), c = z({
240
+ }), d = S({
198
241
  mutationFn: ({
199
242
  consumerId: a,
200
- label: l
243
+ label: c
201
244
  }) => {
202
245
  if (!t.updateConsumer)
203
246
  throw new Error("updateConsumer not implemented");
204
- return t.updateConsumer({ id: a, label: l }, i);
247
+ return t.updateConsumer({ id: a, label: c }, i);
205
248
  },
206
- onMutate: async ({ consumerId: a, label: l }) => {
249
+ onMutate: async ({ consumerId: a, label: c }) => {
207
250
  await s.cancelQueries({ queryKey: ["api-keys"] });
208
- const p = s.getQueryData(["api-keys"]);
209
- return s.setQueryData(["api-keys"], (v) => v && v.map((C) => C.id === a ? {
210
- ...C,
211
- label: l
212
- } : C)), { previousData: p };
251
+ const m = s.getQueryData(["api-keys"]);
252
+ return s.setQueryData(["api-keys"], (C) => C && C.map((v) => v.id === a ? {
253
+ ...v,
254
+ label: c
255
+ } : v)), { previousData: m };
213
256
  },
214
- onError: (a, l, p) => {
215
- p?.previousData && s.setQueryData(["api-keys"], p.previousData);
257
+ onError: (a, c, m) => {
258
+ m?.previousData && s.setQueryData(["api-keys"], m.previousData);
216
259
  },
217
260
  onSuccess: () => {
218
261
  s.invalidateQueries({ queryKey: ["api-keys"] });
219
262
  }
220
- }), d = z({
263
+ }), l = S({
221
264
  mutationFn: (a) => {
222
265
  if (!t.rollKey)
223
266
  throw new Error("rollKey not implemented");
224
267
  return t.rollKey(a, i);
225
268
  },
226
269
  onSuccess: () => s.invalidateQueries({ queryKey: ["api-keys"] })
227
- }), y = (a, l) => {
228
- o(a), u(l);
229
- }, h = (a) => {
230
- r.trim() && c.mutate({
270
+ }), y = (a, c) => {
271
+ o(a), u(c);
272
+ }, p = (a) => {
273
+ r.trim() && d.mutate({
231
274
  consumerId: a,
232
275
  label: r.trim()
233
276
  }), o(null), u("");
234
277
  }, k = () => {
235
278
  o(null), u("");
236
279
  };
237
- return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-lg h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
238
- /* @__PURE__ */ e.jsx(O.Target, { name: "api-keys-list-page" }),
280
+ return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-md h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
281
+ /* @__PURE__ */ e.jsx(B.Target, { name: "api-keys-list-page" }),
239
282
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
240
283
  /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
241
- t.createKey && /* @__PURE__ */ e.jsx(j, { asChild: !0, children: /* @__PURE__ */ e.jsx(Q, { to: "/settings/api-keys/new", children: "Create API Key" }) })
284
+ t.createKey && /* @__PURE__ */ e.jsx(j, { asChild: !0, children: /* @__PURE__ */ e.jsx(J, { to: "/settings/api-keys/new", children: "Create API Key" }) })
242
285
  ] }),
243
286
  /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
244
- /* @__PURE__ */ e.jsx(O.Target, { name: "api-keys-list-page-before-keys" }),
287
+ /* @__PURE__ */ e.jsx(B.Target, { name: "api-keys-list-page-before-keys" }),
245
288
  /* @__PURE__ */ e.jsx("div", { className: "h-8" }),
246
- /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-8", children: m.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
289
+ l.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
290
+ /* @__PURE__ */ e.jsx(M, { size: 16 }),
291
+ /* @__PURE__ */ e.jsx(L, { children: l.error.message })
292
+ ] }),
293
+ d.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
294
+ /* @__PURE__ */ e.jsx(M, { size: 16 }),
295
+ /* @__PURE__ */ e.jsx(L, { children: d.error.message })
296
+ ] }),
297
+ h.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
298
+ /* @__PURE__ */ e.jsx(M, { size: 16 }),
299
+ /* @__PURE__ */ e.jsx(L, { children: h.error.message })
300
+ ] }),
301
+ /* @__PURE__ */ e.jsx("div", { className: "", children: x.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
247
302
  /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
248
303
  "You have no API keys yet.",
249
304
  /* @__PURE__ */ e.jsx("br", {}),
250
305
  t.createKey && "Get started and create your first key."
251
306
  ] }),
252
- t.createKey && /* @__PURE__ */ e.jsx(j, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx(Q, { to: "/settings/api-keys/new", children: "Create API Key" }) })
307
+ t.createKey && /* @__PURE__ */ e.jsx(j, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx(J, { to: "/settings/api-keys/new", children: "Create API Key" }) })
253
308
  ] }) : /* @__PURE__ */ e.jsx(
254
309
  "ul",
255
310
  {
256
- className: R(
311
+ className: N(
257
312
  "grid grid-cols-1 divide-y divide-border col-span-6",
258
313
  "lg:grid-cols-[1fr_min-content]"
259
314
  ),
260
- children: m.map((a) => /* @__PURE__ */ e.jsxs(
261
- ke,
315
+ children: x.map((a) => /* @__PURE__ */ e.jsxs(
316
+ De,
262
317
  {
263
318
  className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
264
319
  children: [
265
- /* @__PURE__ */ e.jsxs(be, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
320
+ /* @__PURE__ */ e.jsxs(Ie, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
266
321
  /* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
267
322
  /* @__PURE__ */ e.jsxs("div", { className: "font-medium text-lg flex items-center gap-2", children: [
268
323
  n === a.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
269
324
  /* @__PURE__ */ e.jsx(
270
- Ee,
325
+ Ke,
271
326
  {
272
327
  maxLength: 32,
273
328
  value: r,
274
- onChange: (l) => u(l.target.value),
275
- onKeyDown: (l) => {
276
- l.key === "Enter" ? h(a.id) : l.key === "Escape" && k();
329
+ onChange: (c) => u(c.target.value),
330
+ onKeyDown: (c) => {
331
+ c.key === "Enter" ? p(a.id) : c.key === "Escape" && k();
277
332
  },
278
333
  className: "text-lg font-medium",
279
334
  autoFocus: !0
@@ -285,9 +340,9 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
285
340
  {
286
341
  size: "icon",
287
342
  variant: "ghost",
288
- onClick: () => h(a.id),
343
+ onClick: () => p(a.id),
289
344
  disabled: !r.trim(),
290
- children: /* @__PURE__ */ e.jsx(_, { size: 16 })
345
+ children: /* @__PURE__ */ e.jsx(V, { size: 16 })
291
346
  }
292
347
  ),
293
348
  /* @__PURE__ */ e.jsx(
@@ -296,7 +351,7 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
296
351
  size: "icon",
297
352
  variant: "ghost",
298
353
  onClick: k,
299
- children: /* @__PURE__ */ e.jsx(se, { size: 16 })
354
+ children: /* @__PURE__ */ e.jsx(ae, { size: 16 })
300
355
  }
301
356
  )
302
357
  ] })
@@ -322,49 +377,49 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
322
377
  {
323
378
  variant: "ghost",
324
379
  onClick: () => y(a.id, a.label),
325
- className: R(
380
+ className: N(
326
381
  "flex gap-2",
327
382
  n === a.id && "opacity-0! pointer-events-none"
328
383
  ),
329
384
  disabled: n === a.id,
330
385
  children: [
331
- /* @__PURE__ */ e.jsx(ne, { size: 16 }),
386
+ /* @__PURE__ */ e.jsx(oe, { size: 16 }),
332
387
  "Edit label"
333
388
  ]
334
389
  }
335
390
  ),
336
- t.rollKey && /* @__PURE__ */ e.jsxs(U, { children: [
337
- /* @__PURE__ */ e.jsx(W, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
391
+ t.rollKey && /* @__PURE__ */ e.jsxs(X, { children: [
392
+ /* @__PURE__ */ e.jsx(Y, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
338
393
  j,
339
394
  {
340
395
  title: "Roll this key",
341
396
  variant: "ghost",
342
- disabled: d.isPending,
397
+ disabled: l.isPending,
343
398
  className: "flex items-center gap-2",
344
399
  children: [
345
400
  /* @__PURE__ */ e.jsx(
346
- ie,
401
+ le,
347
402
  {
348
403
  size: 16,
349
- className: d.isPending ? "animate-spin" : void 0
404
+ className: l.isPending ? "animate-spin" : void 0
350
405
  }
351
406
  ),
352
407
  "Roll key"
353
408
  ]
354
409
  }
355
410
  ) }),
356
- /* @__PURE__ */ e.jsxs(X, { children: [
357
- /* @__PURE__ */ e.jsxs(Y, { children: [
358
- /* @__PURE__ */ e.jsx(G, { children: "Roll API Key" }),
359
- /* @__PURE__ */ e.jsx(J, { children: "Are you sure you want to roll this API key?" })
411
+ /* @__PURE__ */ e.jsxs(G, { children: [
412
+ /* @__PURE__ */ e.jsxs(Z, { children: [
413
+ /* @__PURE__ */ e.jsx(ee, { children: "Roll API Key" }),
414
+ /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to roll this API key?" })
360
415
  ] }),
361
- /* @__PURE__ */ e.jsxs(V, { children: [
362
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
363
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(
416
+ /* @__PURE__ */ e.jsxs(se, { children: [
417
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
418
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
364
419
  j,
365
420
  {
366
421
  onClick: () => {
367
- d.mutate(a.id);
422
+ l.mutate(a.id);
368
423
  },
369
424
  children: "Roll Key"
370
425
  }
@@ -374,22 +429,22 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
374
429
  ] })
375
430
  ] })
376
431
  ] }),
377
- /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(Le, { children: a.apiKeys.map((l) => /* @__PURE__ */ e.jsxs(ye.Fragment, { children: [
432
+ /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(_e, { children: a.apiKeys.map((c) => /* @__PURE__ */ e.jsxs(Ce.Fragment, { children: [
378
433
  /* @__PURE__ */ e.jsx(
379
- Oe,
434
+ Ue,
380
435
  {
381
- apiKey: l,
436
+ apiKey: c,
382
437
  onDeleteKey: () => {
383
- x.mutate({
438
+ h.mutate({
384
439
  consumerId: a.id,
385
- keyId: l.id
440
+ keyId: c.id
386
441
  });
387
442
  },
388
- className: x.variables?.keyId === l.id && (x.isPending || f) ? "opacity-10!" : void 0
443
+ className: h.variables?.keyId === c.id && (h.isPending || f) ? "opacity-10!" : void 0
389
444
  }
390
445
  ),
391
446
  /* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
392
- ] }, l.id)) }) })
447
+ ] }, c.id)) }) })
393
448
  ]
394
449
  },
395
450
  a.id
@@ -397,42 +452,42 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
397
452
  }
398
453
  ) })
399
454
  ] });
400
- }, Fe = (t) => {
455
+ }, Je = (t) => {
401
456
  const i = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((i.getTime() - s.getTime()) / 1e3), o = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
402
457
  return n < 60 ? o.format(-n, "second") : n < 3600 ? o.format(-Math.floor(n / 60), "minute") : n < 86400 ? o.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? o.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? o.format(-Math.floor(n / 2592e3), "month") : o.format(-Math.floor(n / 31536e3), "year");
403
- }, Oe = ({
458
+ }, Ue = ({
404
459
  apiKey: t,
405
460
  onDeleteKey: i,
406
461
  className: s
407
462
  }) => {
408
- const [n, o] = E(!1), [r, u] = E(!1), { key: m, createdOn: f, expiresOn: x } = t, c = x && new Date(x) < /* @__PURE__ */ new Date(), d = x ? Math.ceil(
409
- (new Date(x).getTime() - (/* @__PURE__ */ new Date()).getTime()) / (1e3 * 60 * 60 * 24)
410
- ) : 1 / 0, y = d <= 7 && !c;
411
- return /* @__PURE__ */ e.jsxs("div", { className: R("grid col-span-full grid-cols-subgrid p-6", s), children: [
463
+ const [n, o] = E(!1), [r, u] = E(!1), { key: x, createdOn: f, expiresOn: h } = t, d = h && new Date(h) < /* @__PURE__ */ new Date(), l = h ? Math.ceil(
464
+ (new Date(h).getTime() - (/* @__PURE__ */ new Date()).getTime()) / (1e3 * 60 * 60 * 24)
465
+ ) : 1 / 0, y = l <= 7 && !d;
466
+ return /* @__PURE__ */ e.jsxs("div", { className: N("grid col-span-full grid-cols-subgrid p-6", s), children: [
412
467
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
413
468
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center text-sm border rounded-md w-fit px-1", children: [
414
469
  /* @__PURE__ */ e.jsxs("div", { className: "font-mono truncate h-9 items-center flex px-2 text-xs gap-2", children: [
415
470
  /* @__PURE__ */ e.jsx(
416
471
  "div",
417
472
  {
418
- className: R(
473
+ className: N(
419
474
  "rounded-full w-2 h-2 bg-emerald-400 mr-2",
420
- (y || c) && "bg-neutral-200"
475
+ (y || d) && "bg-neutral-200"
421
476
  )
422
477
  }
423
478
  ),
424
479
  /* @__PURE__ */ e.jsxs("span", { children: [
425
- /* @__PURE__ */ e.jsx("span", { className: n ? "" : "opacity-20", children: n ? m.slice(0, -5) : "**** ".repeat(m.slice(0, -5).length / 5) + "*".repeat(m.slice(0, -5).length % 5) }),
426
- /* @__PURE__ */ e.jsx("span", { children: m.slice(-5) })
480
+ /* @__PURE__ */ e.jsx("span", { className: n ? "" : "opacity-20", children: n ? x.slice(0, -5) : "**** ".repeat(x.slice(0, -5).length / 5) + "*".repeat(x.slice(0, -5).length % 5) }),
481
+ /* @__PURE__ */ e.jsx("span", { children: x.slice(-5) })
427
482
  ] })
428
483
  ] }),
429
484
  /* @__PURE__ */ e.jsx(
430
485
  j,
431
486
  {
432
487
  variant: "ghost",
433
- onClick: () => o((h) => !h),
488
+ onClick: () => o((p) => !p),
434
489
  size: "icon",
435
- children: n ? /* @__PURE__ */ e.jsx(re, { size: 16 }) : /* @__PURE__ */ e.jsx(ae, { size: 16 })
490
+ children: n ? /* @__PURE__ */ e.jsx(ce, { size: 16 }) : /* @__PURE__ */ e.jsx(de, { size: 16 })
436
491
  }
437
492
  ),
438
493
  /* @__PURE__ */ e.jsx(
@@ -440,46 +495,46 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
440
495
  {
441
496
  variant: "ghost",
442
497
  onClick: () => {
443
- navigator.clipboard.writeText(m).then(() => {
498
+ navigator.clipboard.writeText(x).then(() => {
444
499
  u(!0), setTimeout(() => u(!1), 2e3);
445
500
  });
446
501
  },
447
502
  size: "icon",
448
- children: r ? /* @__PURE__ */ e.jsx(_, { size: 16 }) : /* @__PURE__ */ e.jsx(oe, { size: 16 })
503
+ children: r ? /* @__PURE__ */ e.jsx(V, { size: 16 }) : /* @__PURE__ */ e.jsx(ue, { size: 16 })
449
504
  }
450
505
  )
451
506
  ] }),
452
507
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
453
508
  f && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
454
509
  "Created ",
455
- Fe(f),
510
+ Je(f),
456
511
  "."
457
512
  ] }),
458
513
  " ",
459
- x && y && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
514
+ h && y && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
460
515
  "Expires in ",
461
- d,
516
+ l,
462
517
  " ",
463
- d === 1 ? "day" : "days",
518
+ l === 1 ? "day" : "days",
464
519
  "."
465
520
  ] }),
466
- x && c && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
521
+ h && d && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
467
522
  "Expired",
468
523
  " ",
469
- d === 0 ? "today." : `${d * -1} days ago.`
524
+ l === 0 ? "today." : `${l * -1} days ago.`
470
525
  ] })
471
526
  ] })
472
527
  ] }),
473
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: x && i && /* @__PURE__ */ e.jsxs(U, { children: [
474
- /* @__PURE__ */ e.jsx(W, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(le, { size: 16 }) }) }),
475
- /* @__PURE__ */ e.jsxs(X, { children: [
476
- /* @__PURE__ */ e.jsxs(Y, { children: [
477
- /* @__PURE__ */ e.jsx(G, { children: "Delete API Key" }),
478
- /* @__PURE__ */ e.jsx(J, { children: "Are you sure you want to delete this API key?" })
528
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: h && i && /* @__PURE__ */ e.jsxs(X, { children: [
529
+ /* @__PURE__ */ e.jsx(Y, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(fe, { size: 16 }) }) }),
530
+ /* @__PURE__ */ e.jsxs(G, { children: [
531
+ /* @__PURE__ */ e.jsxs(Z, { children: [
532
+ /* @__PURE__ */ e.jsx(ee, { children: "Delete API Key" }),
533
+ /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to delete this API key?" })
479
534
  ] }),
480
- /* @__PURE__ */ e.jsxs(V, { children: [
481
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
482
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(
535
+ /* @__PURE__ */ e.jsxs(se, { children: [
536
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
537
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
483
538
  j,
484
539
  {
485
540
  onClick: () => {
@@ -492,23 +547,36 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
492
547
  ] })
493
548
  ] }) })
494
549
  ] });
495
- }, I = "https://api.zuploedge.com/v2/client", Qe = (t) => ({
550
+ }, K = "https://api.zuploedge.com/v2/client", Ve = async (t) => {
551
+ try {
552
+ return await t.json();
553
+ } catch {
554
+ return;
555
+ }
556
+ }, R = async (t) => {
557
+ const i = t.headers.get("content-type");
558
+ if (!t.ok && i?.includes("application/problem+json")) {
559
+ const s = await Ve(t);
560
+ if (s.type && s.title)
561
+ throw new Error(s.detail ?? s.title);
562
+ }
563
+ }, We = (t) => ({
496
564
  deleteKey: async (i, s, n) => {
497
565
  const o = new Request(
498
- I + `/${t}/consumers/${i}/keys/${s}`,
566
+ K + `/${t}/consumers/${i}/keys/${s}`,
499
567
  {
500
568
  method: "DELETE"
501
569
  }
502
570
  );
503
571
  await n.signRequest(o);
504
572
  const r = await fetch(o);
505
- P(r.ok, "Failed to delete API key");
573
+ await R(r), D(r.ok, "Failed to delete API key");
506
574
  },
507
575
  updateConsumer: async (i, s) => {
508
576
  const n = await fetch(
509
577
  await s.signRequest(
510
578
  new Request(
511
- I + `/${t}/consumers/${i.id}`,
579
+ K + `/${t}/consumers/${i.id}`,
512
580
  {
513
581
  method: "PATCH",
514
582
  headers: {
@@ -521,13 +589,13 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
521
589
  )
522
590
  )
523
591
  );
524
- P(n.ok, "Failed to update API key description");
592
+ await R(n), D(n.ok, "Failed to update API key description");
525
593
  },
526
594
  rollKey: async (i, s) => {
527
595
  const n = await fetch(
528
596
  await s.signRequest(
529
597
  new Request(
530
- I + `/${t}/consumers/${i}/roll-key`,
598
+ K + `/${t}/consumers/${i}/roll-key`,
531
599
  {
532
600
  method: "POST",
533
601
  headers: {
@@ -538,30 +606,30 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
538
606
  )
539
607
  )
540
608
  );
541
- P(n.ok, "Failed to delete API key");
609
+ await R(n), D(n.ok, "Failed to delete API key");
542
610
  },
543
611
  getConsumers: async (i) => {
544
612
  const s = new Request(
545
- I + `/${t}/consumers`
613
+ K + `/${t}/consumers`
546
614
  );
547
615
  await i.signRequest(s);
548
616
  const n = await fetch(s);
549
- return P(n.ok, "Failed to fetch API keys"), (await n.json()).data.map((r) => ({
617
+ return await R(n), D(n.ok, "Failed to fetch API keys"), (await n.json()).data.map((r) => ({
550
618
  id: r.id,
551
- label: r.label || "API Key",
619
+ label: r.label ?? r.subject ?? "API Key",
552
620
  apiKeys: r.apiKeys.data,
553
621
  key: r.apiKeys.data.at(0)
554
622
  }));
555
623
  }
556
- }), st = (t) => t, nt = (t) => {
557
- const i = "deploymentName" in t ? Qe(t.deploymentName) : t;
624
+ }), dt = (t) => t, ut = (t) => {
625
+ const i = "deploymentName" in t ? We(t.deploymentName) : t;
558
626
  return {
559
627
  getProfileMenuItems: () => [
560
628
  {
561
629
  label: "API Keys",
562
630
  path: "/settings/api-keys",
563
631
  category: "middle",
564
- icon: de
632
+ icon: he
565
633
  }
566
634
  ],
567
635
  getIdentities: async (s) => {
@@ -572,7 +640,7 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
572
640
  `Bearer ${o.apiKeys.at(0)?.key}`
573
641
  ), r),
574
642
  id: o.id,
575
- label: o.description ?? o.id
643
+ label: o.label
576
644
  }));
577
645
  } catch {
578
646
  return [];
@@ -580,12 +648,12 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
580
648
  },
581
649
  getRoutes: () => [
582
650
  {
583
- element: /* @__PURE__ */ e.jsx(De, {}),
584
- errorElement: /* @__PURE__ */ e.jsx(ue, {}),
651
+ element: /* @__PURE__ */ e.jsx(Re, {}),
652
+ errorElement: /* @__PURE__ */ e.jsx(me, {}),
585
653
  children: [
586
654
  {
587
655
  path: "/settings/api-keys",
588
- element: /* @__PURE__ */ e.jsx($e, { service: i })
656
+ element: /* @__PURE__ */ e.jsx(Be, { service: i })
589
657
  }
590
658
  // {
591
659
  // path: "/settings/api-keys/new",
@@ -597,7 +665,7 @@ const Le = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
597
665
  };
598
666
  };
599
667
  export {
600
- nt as apiKeyPlugin,
601
- st as createApiKeyService
668
+ ut as apiKeyPlugin,
669
+ dt as createApiKeyService
602
670
  };
603
671
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map