zudoku 0.54.3 → 0.55.0
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/config/validators/InputNavigationSchema.d.ts +63 -63
- package/dist/config/validators/validate.d.ts +24 -15
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js +9 -3
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +9 -5
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/vite/shadcn-registry.d.ts +4 -4
- package/lib/{MdxPage-C6Ru5mfp.js → MdxPage-D1XC3kwu.js} +8 -8
- package/lib/{MdxPage-C6Ru5mfp.js.map → MdxPage-D1XC3kwu.js.map} +1 -1
- package/lib/{OAuthErrorPage-Dd0fl6Lh.js → OAuthErrorPage-CSYvzsNJ.js} +7 -7
- package/lib/{OAuthErrorPage-Dd0fl6Lh.js.map → OAuthErrorPage-CSYvzsNJ.js.map} +1 -1
- package/lib/{OasProvider-DNmLItHj.js → OasProvider-Ch3fGSNb.js} +3 -3
- package/lib/{OasProvider-DNmLItHj.js.map → OasProvider-Ch3fGSNb.js.map} +1 -1
- package/lib/{OperationList-BE_BNejn.js → OperationList-Boc5tg5n.js} +12 -12
- package/lib/{OperationList-BE_BNejn.js.map → OperationList-Boc5tg5n.js.map} +1 -1
- package/lib/{Pagination-29CJ3c2k.js → Pagination-DdqTabDR.js} +3 -3
- package/lib/{Pagination-29CJ3c2k.js.map → Pagination-DdqTabDR.js.map} +1 -1
- package/lib/{RouteGuard-0wPUKdxJ.js → RouteGuard-D17dUEM_.js} +4 -4
- package/lib/{RouteGuard-0wPUKdxJ.js.map → RouteGuard-D17dUEM_.js.map} +1 -1
- package/lib/{SchemaList-BTkZiol0.js → SchemaList-BbkMdqgT.js} +8 -8
- package/lib/{SchemaList-BTkZiol0.js.map → SchemaList-BbkMdqgT.js.map} +1 -1
- package/lib/{SchemaView-Bc5_uIbh.js → SchemaView-Bo48Qzuu.js} +4 -4
- package/lib/{SchemaView-Bc5_uIbh.js.map → SchemaView-Bo48Qzuu.js.map} +1 -1
- package/lib/{Select-DVKfV8Vb.js → Select-BgBGJ5cF.js} +3 -3
- package/lib/{Select-DVKfV8Vb.js.map → Select-BgBGJ5cF.js.map} +1 -1
- package/lib/{SignUp-DUmbxjcy.js → SignUp-ckLqfC6h.js} +4 -4
- package/lib/{SignUp-DUmbxjcy.js.map → SignUp-ckLqfC6h.js.map} +1 -1
- package/lib/{Slot-BahfuM5e.js → Slot-CkWazhCn.js} +6 -6
- package/lib/{Slot-BahfuM5e.js.map → Slot-CkWazhCn.js.map} +1 -1
- package/lib/{SyntaxHighlight-BaPoOBLD.js → SyntaxHighlight-DQ64ObSH.js} +2 -2
- package/lib/{SyntaxHighlight-BaPoOBLD.js.map → SyntaxHighlight-DQ64ObSH.js.map} +1 -1
- package/lib/{Toc-MF9YxB9B.js → Toc-cVDQRzE6.js} +2 -2
- package/lib/{Toc-MF9YxB9B.js.map → Toc-cVDQRzE6.js.map} +1 -1
- package/lib/{ZudokuContext-CLl5w57E.js → ZudokuContext-Coxa0DfE.js} +2 -2
- package/lib/{ZudokuContext-CLl5w57E.js.map → ZudokuContext-Coxa0DfE.js.map} +1 -1
- package/lib/{chunk-QMGIS6GS-CEOk3lro.js → chunk-QMGIS6GS-CdEm9pzB.js} +6 -6
- package/lib/{chunk-QMGIS6GS-CEOk3lro.js.map → chunk-QMGIS6GS-CdEm9pzB.js.map} +1 -1
- package/lib/{circular-Bv1c2Yd3.js → circular-CshZkiOV.js} +2 -2
- package/lib/{circular-Bv1c2Yd3.js.map → circular-CshZkiOV.js.map} +1 -1
- package/lib/{createServer-B4o75XI3.js → createServer-CHAS8ilN.js} +4 -4
- package/lib/{createServer-B4o75XI3.js.map → createServer-CHAS8ilN.js.map} +1 -1
- package/lib/{errors-7Pb4eZXa.js → errors-BQk2rSTP.js} +2 -2
- package/lib/{errors-7Pb4eZXa.js.map → errors-BQk2rSTP.js.map} +1 -1
- package/lib/{hook-DbUCLQNg.js → hook-DEPqwjke.js} +2 -2
- package/lib/{hook-DbUCLQNg.js.map → hook-DEPqwjke.js.map} +1 -1
- package/lib/{index-fHJ5WmM5.js → index-BB_X3XYb.js} +2 -2
- package/lib/{index-fHJ5WmM5.js.map → index-BB_X3XYb.js.map} +1 -1
- package/lib/{index-D_weJvKR.js → index-BIP4zJwn.js} +15 -15
- package/lib/{index-D_weJvKR.js.map → index-BIP4zJwn.js.map} +1 -1
- package/lib/{index-BqrVgyZ3.js → index-BruDSPOJ.js} +7 -7
- package/lib/{index-BqrVgyZ3.js.map → index-BruDSPOJ.js.map} +1 -1
- package/lib/ui/SyntaxHighlight.js +2 -2
- package/lib/useExposedProps-DUoV7MCU.js +113 -0
- package/lib/useExposedProps-DUoV7MCU.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-azureb2c.js +5 -5
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +5 -5
- package/lib/zudoku.auth-supabase.js +2 -2
- package/lib/zudoku.components.js +7 -7
- package/lib/zudoku.hooks.js +18 -19
- package/lib/zudoku.hooks.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +7 -7
- package/lib/zudoku.plugin-api-keys.js +189 -187
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +4 -4
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +10 -10
- package/package.json +1 -1
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +6 -3
- package/src/lib/plugins/api-keys/index.tsx +10 -4
- package/src/shiki/langs/vue-vine.js +1 -0
- package/lib/index-Bm35Tkgf.js +0 -107
- package/lib/index-Bm35Tkgf.js.map +0 -1
- package/lib/useExposedProps-KcgXHKeE.js +0 -9
- package/lib/useExposedProps-KcgXHKeE.js.map +0 -1
|
@@ -1,54 +1,55 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import { CircleSlashIcon as
|
|
3
|
-
import { D as je, a as Y, R as Ce } from "./Slot-
|
|
4
|
-
import { i as
|
|
5
|
-
import { O as ve,
|
|
6
|
-
import { a as ke } from "./hook-
|
|
7
|
-
import { Button as
|
|
8
|
-
import { c as se, e as ne, b as Ne } from "./ZudokuContext-
|
|
9
|
-
import { u as z, A as O, a as M, b as Ee, S as Ke, c as De, d as Ie, e as
|
|
2
|
+
import { CircleSlashIcon as $, CheckIcon as te, XIcon as ue, PencilLineIcon as he, RefreshCwIcon as fe, EyeOffIcon as pe, EyeIcon as me, CopyIcon as xe, TrashIcon as ye, KeyRoundIcon as ge } from "lucide-react";
|
|
3
|
+
import { D as je, a as Y, R as Ce } from "./Slot-CkWazhCn.js";
|
|
4
|
+
import { i as P } from "./invariant-Bm-FVUQE.js";
|
|
5
|
+
import { O as ve, b as we, L as be } from "./chunk-QMGIS6GS-CdEm9pzB.js";
|
|
6
|
+
import { a as ke } from "./hook-DEPqwjke.js";
|
|
7
|
+
import { Button as y } from "./ui/Button.js";
|
|
8
|
+
import { c as se, e as ne, b as Ne } from "./ZudokuContext-Coxa0DfE.js";
|
|
9
|
+
import { u as z, A as O, a as M, b as Ee, S as Ke, c as De, d as Ie, e as Ae, f as Pe, g as Z } from "./Select-BgBGJ5cF.js";
|
|
10
10
|
import * as _ from "react";
|
|
11
|
-
import Re, { createContext as G, useRef as D, useLayoutEffect as Se, useEffect as ie, useId as J, useContext as U, useInsertionEffect as Te, useMemo as
|
|
12
|
-
import { C as
|
|
13
|
-
import { e as W, f as I, D as
|
|
11
|
+
import Re, { createContext as G, useRef as D, useLayoutEffect as Se, useEffect as ie, useId as J, useContext as U, useInsertionEffect as Te, useMemo as F, useCallback as ze, Children as Oe, isValidElement as Me, useState as K, forwardRef as qe } from "react";
|
|
12
|
+
import { C as $e, a as Fe } from "./Card-CMDQUPM4.js";
|
|
13
|
+
import { e as W, f as I, D as L, g as Q, a as B, c as H, b as V, d as re } from "./Dialog-u9Uz9sTt.js";
|
|
14
14
|
import { Input as ae } from "./ui/Input.js";
|
|
15
15
|
import { c as N } from "./cn-dYga0KKN.js";
|
|
16
|
-
import { u as
|
|
16
|
+
import { u as Le } from "./CodeBlock-NFCmSWOK.js";
|
|
17
17
|
import { a as Qe } from "./index.esm-CdzlRw50.js";
|
|
18
18
|
import { B as Be } from "./Button-B3o-2Xdf.js";
|
|
19
19
|
import { S as He } from "./Spinner-mNLZ6awP.js";
|
|
20
|
-
|
|
20
|
+
import { useAuth as Ve } from "./zudoku.hooks.js";
|
|
21
|
+
const _e = () => {
|
|
21
22
|
const t = ke();
|
|
22
23
|
return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(ve, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
|
|
23
24
|
"Please login first to view this page",
|
|
24
|
-
/* @__PURE__ */ e.jsx(
|
|
25
|
+
/* @__PURE__ */ e.jsx(y, { onClick: () => t.login(), children: "Login" })
|
|
25
26
|
] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(je, { className: "max-w-[600px]", children: [
|
|
26
27
|
"Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ",
|
|
27
28
|
/* @__PURE__ */ e.jsx("code", { children: "authentication" }),
|
|
28
29
|
"."
|
|
29
30
|
] }) });
|
|
30
|
-
},
|
|
31
|
+
}, Ge = G({});
|
|
31
32
|
function oe(t) {
|
|
32
33
|
const i = D(null);
|
|
33
34
|
return i.current === null && (i.current = t()), i.current;
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
-
function
|
|
36
|
+
const Je = typeof window < "u", Ue = Je ? Se : ie, le = /* @__PURE__ */ G(null);
|
|
37
|
+
function We(t) {
|
|
37
38
|
return typeof t == "object" && t !== null;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
40
|
+
function Xe(t) {
|
|
41
|
+
return We(t) && "offsetHeight" in t;
|
|
41
42
|
}
|
|
42
|
-
const
|
|
43
|
+
const Ye = G({
|
|
43
44
|
transformPagePoint: (t) => t,
|
|
44
45
|
isStatic: !1,
|
|
45
46
|
reducedMotion: "never"
|
|
46
47
|
});
|
|
47
|
-
class
|
|
48
|
+
class Ze extends _.Component {
|
|
48
49
|
getSnapshotBeforeUpdate(i) {
|
|
49
50
|
const s = this.props.childRef.current;
|
|
50
51
|
if (s && i.isPresent && !this.props.isPresent) {
|
|
51
|
-
const n = s.offsetParent, r =
|
|
52
|
+
const n = s.offsetParent, r = Xe(n) && n.offsetWidth || 0, a = this.props.sizeRef.current;
|
|
52
53
|
a.height = s.offsetHeight || 0, a.width = s.offsetWidth || 0, a.top = s.offsetTop, a.left = s.offsetLeft, a.right = r - a.width - a.left;
|
|
53
54
|
}
|
|
54
55
|
return null;
|
|
@@ -62,62 +63,62 @@ class Ye extends _.Component {
|
|
|
62
63
|
return this.props.children;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
-
const r = J(), a = D(null),
|
|
66
|
+
function et({ children: t, isPresent: i, anchorX: s, root: n }) {
|
|
67
|
+
const r = J(), a = D(null), c = D({
|
|
67
68
|
width: 0,
|
|
68
69
|
height: 0,
|
|
69
70
|
top: 0,
|
|
70
71
|
left: 0,
|
|
71
72
|
right: 0
|
|
72
|
-
}), { nonce:
|
|
73
|
+
}), { nonce: f } = U(Ye);
|
|
73
74
|
return Te(() => {
|
|
74
|
-
const { width:
|
|
75
|
-
if (i || !a.current || !
|
|
75
|
+
const { width: h, height: d, top: g, left: u, right: p } = c.current;
|
|
76
|
+
if (i || !a.current || !h || !d)
|
|
76
77
|
return;
|
|
77
|
-
const
|
|
78
|
+
const m = s === "left" ? `left: ${u}` : `right: ${p}`;
|
|
78
79
|
a.current.dataset.motionPopId = r;
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
return
|
|
80
|
+
const x = document.createElement("style");
|
|
81
|
+
f && (x.nonce = f);
|
|
82
|
+
const j = n ?? document.head;
|
|
83
|
+
return j.appendChild(x), x.sheet && x.sheet.insertRule(`
|
|
83
84
|
[data-motion-pop-id="${r}"] {
|
|
84
85
|
position: absolute !important;
|
|
85
|
-
width: ${
|
|
86
|
+
width: ${h}px !important;
|
|
86
87
|
height: ${d}px !important;
|
|
87
|
-
${
|
|
88
|
-
top: ${
|
|
88
|
+
${m}px !important;
|
|
89
|
+
top: ${g}px !important;
|
|
89
90
|
}
|
|
90
91
|
`), () => {
|
|
91
|
-
|
|
92
|
+
j.removeChild(x), j.contains(x) && j.removeChild(x);
|
|
92
93
|
};
|
|
93
|
-
}, [i]), e.jsx(
|
|
94
|
+
}, [i]), e.jsx(Ze, { isPresent: i, childRef: a, sizeRef: c, children: _.cloneElement(t, { ref: a }) });
|
|
94
95
|
}
|
|
95
|
-
const
|
|
96
|
-
const d = oe(
|
|
97
|
-
let u = !0,
|
|
98
|
-
id:
|
|
96
|
+
const tt = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: a, mode: c, anchorX: f, root: h }) => {
|
|
97
|
+
const d = oe(st), g = J();
|
|
98
|
+
let u = !0, p = F(() => (u = !1, {
|
|
99
|
+
id: g,
|
|
99
100
|
initial: i,
|
|
100
101
|
isPresent: s,
|
|
101
102
|
custom: r,
|
|
102
|
-
onExitComplete: (
|
|
103
|
-
d.set(
|
|
104
|
-
for (const
|
|
105
|
-
if (!
|
|
103
|
+
onExitComplete: (m) => {
|
|
104
|
+
d.set(m, !0);
|
|
105
|
+
for (const x of d.values())
|
|
106
|
+
if (!x)
|
|
106
107
|
return;
|
|
107
108
|
n && n();
|
|
108
109
|
},
|
|
109
|
-
register: (
|
|
110
|
+
register: (m) => (d.set(m, !1), () => d.delete(m))
|
|
110
111
|
}), [s, d, n]);
|
|
111
|
-
return a && u && (
|
|
112
|
-
d.forEach((
|
|
112
|
+
return a && u && (p = { ...p }), F(() => {
|
|
113
|
+
d.forEach((m, x) => d.set(x, !1));
|
|
113
114
|
}, [s]), _.useEffect(() => {
|
|
114
115
|
!s && !d.size && n && n();
|
|
115
|
-
}, [s]),
|
|
116
|
+
}, [s]), c === "popLayout" && (t = e.jsx(et, { isPresent: s, anchorX: f, root: h, children: t })), e.jsx(le.Provider, { value: p, children: t });
|
|
116
117
|
};
|
|
117
|
-
function
|
|
118
|
+
function st() {
|
|
118
119
|
return /* @__PURE__ */ new Map();
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
+
function nt(t = !0) {
|
|
121
122
|
const i = U(le);
|
|
122
123
|
if (i === null)
|
|
123
124
|
return [!0, null];
|
|
@@ -126,8 +127,8 @@ function st(t = !0) {
|
|
|
126
127
|
if (t)
|
|
127
128
|
return r(a);
|
|
128
129
|
}, [t]);
|
|
129
|
-
const
|
|
130
|
-
return !s && n ? [!1,
|
|
130
|
+
const c = ze(() => t && n && n(a), [a, n, t]);
|
|
131
|
+
return !s && n ? [!1, c] : [!0];
|
|
131
132
|
}
|
|
132
133
|
const R = (t) => t.key || "";
|
|
133
134
|
function ee(t) {
|
|
@@ -136,38 +137,38 @@ function ee(t) {
|
|
|
136
137
|
Me(s) && i.push(s);
|
|
137
138
|
}), i;
|
|
138
139
|
}
|
|
139
|
-
const
|
|
140
|
-
const [d,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
for (let w = 0; w <
|
|
144
|
-
const
|
|
145
|
-
|
|
140
|
+
const it = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: a = "sync", propagate: c = !1, anchorX: f = "left", root: h }) => {
|
|
141
|
+
const [d, g] = nt(c), u = F(() => ee(t), [t]), p = c && !d ? [] : u.map(R), m = D(!0), x = D(u), j = oe(() => /* @__PURE__ */ new Map()), [A, o] = K(u), [l, v] = K(u);
|
|
142
|
+
Ue(() => {
|
|
143
|
+
m.current = !1, x.current = u;
|
|
144
|
+
for (let w = 0; w < l.length; w++) {
|
|
145
|
+
const C = R(l[w]);
|
|
146
|
+
p.includes(C) ? j.delete(C) : j.get(C) !== !0 && j.set(C, !1);
|
|
146
147
|
}
|
|
147
|
-
}, [
|
|
148
|
+
}, [l, p.length, p.join("-")]);
|
|
148
149
|
const b = [];
|
|
149
|
-
if (u !==
|
|
150
|
+
if (u !== A) {
|
|
150
151
|
let w = [...u];
|
|
151
|
-
for (let
|
|
152
|
-
const E =
|
|
153
|
-
|
|
152
|
+
for (let C = 0; C < l.length; C++) {
|
|
153
|
+
const E = l[C], q = R(E);
|
|
154
|
+
p.includes(q) || (w.splice(C, 0, E), b.push(E));
|
|
154
155
|
}
|
|
155
156
|
return a === "wait" && b.length && (w = b), v(ee(w)), o(u), null;
|
|
156
157
|
}
|
|
157
|
-
process.env.NODE_ENV !== "production" && a === "wait" &&
|
|
158
|
-
const { forceRender: k } = U(
|
|
159
|
-
return e.jsx(e.Fragment, { children:
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
|
|
158
|
+
process.env.NODE_ENV !== "production" && a === "wait" && l.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.`);
|
|
159
|
+
const { forceRender: k } = U(Ge);
|
|
160
|
+
return e.jsx(e.Fragment, { children: l.map((w) => {
|
|
161
|
+
const C = R(w), E = c && !d ? !1 : u === l || p.includes(C), q = () => {
|
|
162
|
+
if (j.has(C))
|
|
163
|
+
j.set(C, !0);
|
|
163
164
|
else
|
|
164
165
|
return;
|
|
165
166
|
let X = !0;
|
|
166
|
-
|
|
167
|
+
j.forEach((de) => {
|
|
167
168
|
de || (X = !1);
|
|
168
|
-
}), X && (k?.(), v(
|
|
169
|
+
}), X && (k?.(), v(x.current), c && g?.(), n && n());
|
|
169
170
|
};
|
|
170
|
-
return e.jsx(
|
|
171
|
+
return e.jsx(tt, { isPresent: E, initial: !m.current || s ? void 0 : !1, custom: i, presenceAffectsLayout: r, mode: a, root: h, onExitComplete: E ? void 0 : q, anchorX: f, children: w }, C);
|
|
171
172
|
}) });
|
|
172
173
|
}, ce = qe(
|
|
173
174
|
({ isPending: t, children: i, className: s, ...n }, r) => /* @__PURE__ */ e.jsxs(
|
|
@@ -185,7 +186,7 @@ const nt = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
185
186
|
)
|
|
186
187
|
);
|
|
187
188
|
ce.displayName = "ActionButton";
|
|
188
|
-
const
|
|
189
|
+
const rt = ({
|
|
189
190
|
service: t,
|
|
190
191
|
onOpenChange: i
|
|
191
192
|
}) => {
|
|
@@ -193,18 +194,19 @@ const it = ({
|
|
|
193
194
|
defaultValues: {
|
|
194
195
|
expiresOn: "30"
|
|
195
196
|
}
|
|
196
|
-
}),
|
|
197
|
-
mutationFn: ({ description: h, expiresOn:
|
|
197
|
+
}), c = Ve(), f = z({
|
|
198
|
+
mutationFn: ({ description: h, expiresOn: d }) => {
|
|
198
199
|
if (!t.createKey)
|
|
199
200
|
throw new Error("createKey not implemented");
|
|
200
|
-
const
|
|
201
|
-
return t.createKey(
|
|
202
|
-
{
|
|
201
|
+
const g = d !== "never" ? at(Number(d)) : void 0;
|
|
202
|
+
return t.createKey({
|
|
203
|
+
apiKey: {
|
|
203
204
|
description: h || "Secret Key",
|
|
204
|
-
expiresOn:
|
|
205
|
+
expiresOn: g
|
|
205
206
|
},
|
|
206
|
-
s
|
|
207
|
-
|
|
207
|
+
context: s,
|
|
208
|
+
auth: c
|
|
209
|
+
});
|
|
208
210
|
},
|
|
209
211
|
onSuccess: async () => {
|
|
210
212
|
await n.invalidateQueries({ queryKey: ["api-keys"] }), await r("/settings/api-keys/");
|
|
@@ -214,7 +216,7 @@ const it = ({
|
|
|
214
216
|
"form",
|
|
215
217
|
{
|
|
216
218
|
onSubmit: a.handleSubmit(
|
|
217
|
-
(h) =>
|
|
219
|
+
(h) => f.mutate(
|
|
218
220
|
{ ...h },
|
|
219
221
|
{
|
|
220
222
|
onSuccess: () => i(!1)
|
|
@@ -222,9 +224,9 @@ const it = ({
|
|
|
222
224
|
)
|
|
223
225
|
),
|
|
224
226
|
children: [
|
|
225
|
-
|
|
227
|
+
f.error && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
226
228
|
/* @__PURE__ */ e.jsx(M, { children: "Error" }),
|
|
227
|
-
/* @__PURE__ */ e.jsx(Ee, { children:
|
|
229
|
+
/* @__PURE__ */ e.jsx(Ee, { children: f.error.message })
|
|
228
230
|
] }),
|
|
229
231
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
|
|
230
232
|
"Name",
|
|
@@ -237,7 +239,7 @@ const it = ({
|
|
|
237
239
|
defaultValue: a.getValues("expiresOn"),
|
|
238
240
|
children: [
|
|
239
241
|
/* @__PURE__ */ e.jsx(De, { children: /* @__PURE__ */ e.jsx(Ie, {}) }),
|
|
240
|
-
/* @__PURE__ */ e.jsx(
|
|
242
|
+
/* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsxs(Pe, { children: [
|
|
241
243
|
[7, 30, 60, 90].map((h) => /* @__PURE__ */ e.jsxs(Z, { value: String(h), children: [
|
|
242
244
|
h,
|
|
243
245
|
" days"
|
|
@@ -248,87 +250,87 @@ const it = ({
|
|
|
248
250
|
}
|
|
249
251
|
),
|
|
250
252
|
/* @__PURE__ */ e.jsxs(W, { children: [
|
|
251
|
-
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
252
|
-
/* @__PURE__ */ e.jsx(ce, { isPending:
|
|
253
|
+
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Cancel" }) }),
|
|
254
|
+
/* @__PURE__ */ e.jsx(ce, { isPending: f.isPending, children: "Generate Key" })
|
|
253
255
|
] })
|
|
254
256
|
] })
|
|
255
257
|
]
|
|
256
258
|
}
|
|
257
259
|
) : null;
|
|
258
|
-
},
|
|
260
|
+
}, at = (t) => {
|
|
259
261
|
const i = /* @__PURE__ */ new Date();
|
|
260
262
|
return i.setDate(i.getDate() + t), i.toISOString();
|
|
261
|
-
},
|
|
263
|
+
}, ot = ({ service: t }) => {
|
|
262
264
|
const i = se(), s = ne(), [n, r] = K(
|
|
263
265
|
null
|
|
264
|
-
), [a,
|
|
266
|
+
), [a, c] = K(""), { data: f, isFetching: h } = Ne({
|
|
265
267
|
queryFn: () => t.getConsumers(i),
|
|
266
268
|
queryKey: ["api-keys"],
|
|
267
269
|
retry: !1
|
|
268
|
-
}), [d,
|
|
270
|
+
}), [d, g] = K(!1), u = z({
|
|
269
271
|
mutationFn: ({
|
|
270
272
|
consumerId: o,
|
|
271
|
-
keyId:
|
|
273
|
+
keyId: l
|
|
272
274
|
}) => {
|
|
273
275
|
if (!t.deleteKey)
|
|
274
276
|
throw new Error("deleteKey not implemented");
|
|
275
|
-
return t.deleteKey(o,
|
|
277
|
+
return t.deleteKey(o, l, i);
|
|
276
278
|
},
|
|
277
|
-
onMutate: async ({ consumerId: o, keyId:
|
|
279
|
+
onMutate: async ({ consumerId: o, keyId: l }) => {
|
|
278
280
|
await s.cancelQueries({ queryKey: ["api-keys"] });
|
|
279
281
|
const v = s.getQueryData([
|
|
280
282
|
"api-keys"
|
|
281
283
|
]);
|
|
282
284
|
return s.setQueryData(["api-keys"], (b) => b && b.map((k) => k.id === o ? {
|
|
283
285
|
...k,
|
|
284
|
-
apiKeys: k.apiKeys.filter((w) => w.id !==
|
|
286
|
+
apiKeys: k.apiKeys.filter((w) => w.id !== l)
|
|
285
287
|
} : k)), { previousData: v };
|
|
286
288
|
},
|
|
287
|
-
onError: (o,
|
|
289
|
+
onError: (o, l, v) => {
|
|
288
290
|
v?.previousData && s.setQueryData(["api-keys"], v.previousData);
|
|
289
291
|
},
|
|
290
292
|
onSuccess: () => {
|
|
291
293
|
s.invalidateQueries({ queryKey: ["api-keys"] });
|
|
292
294
|
}
|
|
293
|
-
}),
|
|
295
|
+
}), p = z({
|
|
294
296
|
mutationFn: ({
|
|
295
297
|
consumerId: o,
|
|
296
|
-
label:
|
|
298
|
+
label: l
|
|
297
299
|
}) => {
|
|
298
300
|
if (!t.updateConsumer)
|
|
299
301
|
throw new Error("updateConsumer not implemented");
|
|
300
|
-
return t.updateConsumer({ id: o, label:
|
|
302
|
+
return t.updateConsumer({ id: o, label: l }, i);
|
|
301
303
|
},
|
|
302
|
-
onMutate: async ({ consumerId: o, label:
|
|
304
|
+
onMutate: async ({ consumerId: o, label: l }) => {
|
|
303
305
|
await s.cancelQueries({ queryKey: ["api-keys"] });
|
|
304
306
|
const v = s.getQueryData(["api-keys"]);
|
|
305
307
|
return s.setQueryData(["api-keys"], (b) => b && b.map((k) => k.id === o ? {
|
|
306
308
|
...k,
|
|
307
|
-
label:
|
|
309
|
+
label: l
|
|
308
310
|
} : k)), { previousData: v };
|
|
309
311
|
},
|
|
310
|
-
onError: (o,
|
|
312
|
+
onError: (o, l, v) => {
|
|
311
313
|
v?.previousData && s.setQueryData(["api-keys"], v.previousData);
|
|
312
314
|
},
|
|
313
315
|
onSuccess: () => {
|
|
314
316
|
s.invalidateQueries({ queryKey: ["api-keys"] });
|
|
315
317
|
}
|
|
316
|
-
}),
|
|
318
|
+
}), m = z({
|
|
317
319
|
mutationFn: (o) => {
|
|
318
320
|
if (!t.rollKey)
|
|
319
321
|
throw new Error("rollKey not implemented");
|
|
320
322
|
return t.rollKey(o, i);
|
|
321
323
|
},
|
|
322
324
|
onSuccess: () => s.invalidateQueries({ queryKey: ["api-keys"] })
|
|
323
|
-
}),
|
|
324
|
-
r(o), l
|
|
325
|
-
},
|
|
326
|
-
a.trim() &&
|
|
325
|
+
}), x = (o, l) => {
|
|
326
|
+
r(o), c(l);
|
|
327
|
+
}, j = (o) => {
|
|
328
|
+
a.trim() && p.mutate({
|
|
327
329
|
consumerId: o,
|
|
328
330
|
label: a.trim()
|
|
329
|
-
}), r(null),
|
|
330
|
-
},
|
|
331
|
-
r(null),
|
|
331
|
+
}), r(null), c("");
|
|
332
|
+
}, A = () => {
|
|
333
|
+
r(null), c("");
|
|
332
334
|
};
|
|
333
335
|
return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-md h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
|
|
334
336
|
/* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page" }),
|
|
@@ -338,19 +340,19 @@ const it = ({
|
|
|
338
340
|
typeof t.createKey
|
|
339
341
|
] }),
|
|
340
342
|
t.createKey && /* @__PURE__ */ e.jsxs(
|
|
341
|
-
|
|
343
|
+
L,
|
|
342
344
|
{
|
|
343
345
|
open: d,
|
|
344
|
-
onOpenChange:
|
|
346
|
+
onOpenChange: g,
|
|
345
347
|
children: [
|
|
346
|
-
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
348
|
+
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Create API Key" }) }),
|
|
347
349
|
/* @__PURE__ */ e.jsxs(B, { children: [
|
|
348
350
|
/* @__PURE__ */ e.jsx(H, { children: /* @__PURE__ */ e.jsx(V, { children: "Create API Key" }) }),
|
|
349
351
|
/* @__PURE__ */ e.jsx(
|
|
350
|
-
|
|
352
|
+
rt,
|
|
351
353
|
{
|
|
352
354
|
service: t,
|
|
353
|
-
onOpenChange:
|
|
355
|
+
onOpenChange: g
|
|
354
356
|
}
|
|
355
357
|
)
|
|
356
358
|
] })
|
|
@@ -361,37 +363,37 @@ const it = ({
|
|
|
361
363
|
/* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
|
|
362
364
|
/* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page-before-keys" }),
|
|
363
365
|
/* @__PURE__ */ e.jsx("div", { className: "h-8" }),
|
|
366
|
+
m.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
367
|
+
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
368
|
+
/* @__PURE__ */ e.jsx(M, { children: m.error.message })
|
|
369
|
+
] }),
|
|
364
370
|
p.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
365
|
-
/* @__PURE__ */ e.jsx(
|
|
371
|
+
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
366
372
|
/* @__PURE__ */ e.jsx(M, { children: p.error.message })
|
|
367
373
|
] }),
|
|
368
|
-
f.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
369
|
-
/* @__PURE__ */ e.jsx(F, { size: 16 }),
|
|
370
|
-
/* @__PURE__ */ e.jsx(M, { children: f.error.message })
|
|
371
|
-
] }),
|
|
372
374
|
u.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
373
|
-
/* @__PURE__ */ e.jsx(
|
|
375
|
+
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
374
376
|
/* @__PURE__ */ e.jsx(M, { children: u.error.message })
|
|
375
377
|
] }),
|
|
376
|
-
/* @__PURE__ */ e.jsx("div", { className: "", children:
|
|
378
|
+
/* @__PURE__ */ e.jsx("div", { className: "", children: f.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: [
|
|
377
379
|
/* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
|
|
378
380
|
"You have no API keys yet.",
|
|
379
381
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
380
382
|
t.createKey && "Get started and create your first key."
|
|
381
383
|
] }),
|
|
382
|
-
t.createKey && /* @__PURE__ */ e.jsx(
|
|
384
|
+
t.createKey && /* @__PURE__ */ e.jsx(y, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx(be, { to: "/settings/api-keys/new", children: "Create API Key" }) })
|
|
383
385
|
] }) : /* @__PURE__ */ e.jsx(
|
|
384
386
|
"ul",
|
|
385
387
|
{
|
|
386
388
|
className: N(
|
|
387
389
|
"grid grid-cols-[1fr_min-content] divide-y divide-border col-span-6"
|
|
388
390
|
),
|
|
389
|
-
children:
|
|
390
|
-
|
|
391
|
+
children: f.map((o) => /* @__PURE__ */ e.jsxs(
|
|
392
|
+
$e,
|
|
391
393
|
{
|
|
392
394
|
className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
|
|
393
395
|
children: [
|
|
394
|
-
/* @__PURE__ */ e.jsxs(
|
|
396
|
+
/* @__PURE__ */ e.jsxs(Fe, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
|
|
395
397
|
/* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
|
|
396
398
|
/* @__PURE__ */ e.jsxs("div", { className: "font-medium text-lg flex items-center gap-2", children: [
|
|
397
399
|
n === o.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
|
|
@@ -400,9 +402,9 @@ const it = ({
|
|
|
400
402
|
{
|
|
401
403
|
maxLength: 32,
|
|
402
404
|
value: a,
|
|
403
|
-
onChange: (
|
|
404
|
-
onKeyDown: (
|
|
405
|
-
|
|
405
|
+
onChange: (l) => c(l.target.value),
|
|
406
|
+
onKeyDown: (l) => {
|
|
407
|
+
l.key === "Enter" ? j(o.id) : l.key === "Escape" && A();
|
|
406
408
|
},
|
|
407
409
|
className: "text-lg font-medium",
|
|
408
410
|
autoFocus: !0
|
|
@@ -410,21 +412,21 @@ const it = ({
|
|
|
410
412
|
),
|
|
411
413
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
412
414
|
/* @__PURE__ */ e.jsx(
|
|
413
|
-
|
|
415
|
+
y,
|
|
414
416
|
{
|
|
415
417
|
size: "icon",
|
|
416
418
|
variant: "ghost",
|
|
417
|
-
onClick: () =>
|
|
419
|
+
onClick: () => j(o.id),
|
|
418
420
|
disabled: !a.trim(),
|
|
419
421
|
children: /* @__PURE__ */ e.jsx(te, { size: 16 })
|
|
420
422
|
}
|
|
421
423
|
),
|
|
422
424
|
/* @__PURE__ */ e.jsx(
|
|
423
|
-
|
|
425
|
+
y,
|
|
424
426
|
{
|
|
425
427
|
size: "icon",
|
|
426
428
|
variant: "ghost",
|
|
427
|
-
onClick:
|
|
429
|
+
onClick: A,
|
|
428
430
|
children: /* @__PURE__ */ e.jsx(ue, { size: 16 })
|
|
429
431
|
}
|
|
430
432
|
)
|
|
@@ -447,10 +449,10 @@ const it = ({
|
|
|
447
449
|
] }),
|
|
448
450
|
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
|
|
449
451
|
t.updateConsumer && /* @__PURE__ */ e.jsxs(
|
|
450
|
-
|
|
452
|
+
y,
|
|
451
453
|
{
|
|
452
454
|
variant: "ghost",
|
|
453
|
-
onClick: () =>
|
|
455
|
+
onClick: () => x(o.id, o.label),
|
|
454
456
|
className: N(
|
|
455
457
|
"flex gap-2",
|
|
456
458
|
n === o.id && "opacity-0! pointer-events-none"
|
|
@@ -462,20 +464,20 @@ const it = ({
|
|
|
462
464
|
]
|
|
463
465
|
}
|
|
464
466
|
),
|
|
465
|
-
t.rollKey && /* @__PURE__ */ e.jsxs(
|
|
467
|
+
t.rollKey && /* @__PURE__ */ e.jsxs(L, { children: [
|
|
466
468
|
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
467
|
-
|
|
469
|
+
y,
|
|
468
470
|
{
|
|
469
471
|
title: "Roll this key",
|
|
470
472
|
variant: "ghost",
|
|
471
|
-
disabled:
|
|
473
|
+
disabled: m.isPending,
|
|
472
474
|
className: "flex items-center gap-2",
|
|
473
475
|
children: [
|
|
474
476
|
/* @__PURE__ */ e.jsx(
|
|
475
477
|
fe,
|
|
476
478
|
{
|
|
477
479
|
size: 16,
|
|
478
|
-
className:
|
|
480
|
+
className: m.isPending ? "animate-spin" : void 0
|
|
479
481
|
}
|
|
480
482
|
),
|
|
481
483
|
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
|
|
@@ -488,12 +490,12 @@ const it = ({
|
|
|
488
490
|
/* @__PURE__ */ e.jsx(re, { children: "Are you sure you want to roll this API key?" })
|
|
489
491
|
] }),
|
|
490
492
|
/* @__PURE__ */ e.jsxs(W, { children: [
|
|
491
|
-
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
493
|
+
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Cancel" }) }),
|
|
492
494
|
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
493
|
-
|
|
495
|
+
y,
|
|
494
496
|
{
|
|
495
497
|
onClick: () => {
|
|
496
|
-
|
|
498
|
+
m.mutate(o.id);
|
|
497
499
|
},
|
|
498
500
|
children: "Roll Key"
|
|
499
501
|
}
|
|
@@ -503,22 +505,22 @@ const it = ({
|
|
|
503
505
|
] })
|
|
504
506
|
] })
|
|
505
507
|
] }),
|
|
506
|
-
/* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(
|
|
508
|
+
/* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(it, { children: o.apiKeys.map((l) => /* @__PURE__ */ e.jsxs(Re.Fragment, { children: [
|
|
507
509
|
/* @__PURE__ */ e.jsx(
|
|
508
|
-
|
|
510
|
+
ct,
|
|
509
511
|
{
|
|
510
|
-
apiKey:
|
|
512
|
+
apiKey: l,
|
|
511
513
|
onDeleteKey: () => {
|
|
512
514
|
u.mutate({
|
|
513
515
|
consumerId: o.id,
|
|
514
|
-
keyId:
|
|
516
|
+
keyId: l.id
|
|
515
517
|
});
|
|
516
518
|
},
|
|
517
|
-
className: u.variables?.keyId ===
|
|
519
|
+
className: u.variables?.keyId === l.id && (u.isPending || h) ? "opacity-10!" : void 0
|
|
518
520
|
}
|
|
519
521
|
),
|
|
520
522
|
/* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
|
|
521
|
-
] },
|
|
523
|
+
] }, l.id)) }) })
|
|
522
524
|
]
|
|
523
525
|
},
|
|
524
526
|
o.id
|
|
@@ -526,17 +528,17 @@ const it = ({
|
|
|
526
528
|
}
|
|
527
529
|
) })
|
|
528
530
|
] });
|
|
529
|
-
},
|
|
531
|
+
}, lt = (t) => {
|
|
530
532
|
const i = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((i.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
531
533
|
return n < 60 ? r.format(-n, "second") : n < 3600 ? r.format(-Math.floor(n / 60), "minute") : n < 86400 ? r.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? r.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? r.format(-Math.floor(n / 2592e3), "month") : r.format(-Math.floor(n / 31536e3), "year");
|
|
532
|
-
},
|
|
534
|
+
}, ct = ({
|
|
533
535
|
apiKey: t,
|
|
534
536
|
onDeleteKey: i,
|
|
535
537
|
className: s
|
|
536
538
|
}) => {
|
|
537
|
-
const [n, r] = K(!1), [a,
|
|
539
|
+
const [n, r] = K(!1), [a, c] = Le(), { key: f, createdOn: h, expiresOn: d } = t, g = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
|
|
538
540
|
(new Date(d).getTime() - (/* @__PURE__ */ new Date()).getTime()) / (1e3 * 60 * 60 * 24)
|
|
539
|
-
) : 1 / 0,
|
|
541
|
+
) : 1 / 0, p = u <= 7 && !g;
|
|
540
542
|
return /* @__PURE__ */ e.jsxs("div", { className: N("grid col-span-full grid-cols-subgrid p-6", s), children: [
|
|
541
543
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
542
544
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center text-sm border rounded-md w-full max-w-fit px-1", children: [
|
|
@@ -546,7 +548,7 @@ const it = ({
|
|
|
546
548
|
{
|
|
547
549
|
className: N(
|
|
548
550
|
"rounded-full w-2 h-2 bg-emerald-400 mr-2",
|
|
549
|
-
(
|
|
551
|
+
(p || g) && "bg-neutral-200"
|
|
550
552
|
)
|
|
551
553
|
}
|
|
552
554
|
),
|
|
@@ -558,63 +560,63 @@ const it = ({
|
|
|
558
560
|
"w-40 inline-block md:w-full truncate",
|
|
559
561
|
n ? "" : "opacity-20"
|
|
560
562
|
),
|
|
561
|
-
children: n ?
|
|
563
|
+
children: n ? f.slice(0, -5) : "**** ".repeat(f.slice(0, -5).length / 5) + "*".repeat(f.slice(0, -5).length % 5)
|
|
562
564
|
}
|
|
563
565
|
),
|
|
564
|
-
/* @__PURE__ */ e.jsx("span", { children:
|
|
566
|
+
/* @__PURE__ */ e.jsx("span", { children: f.slice(-5) })
|
|
565
567
|
] })
|
|
566
568
|
] }),
|
|
567
569
|
/* @__PURE__ */ e.jsx(
|
|
568
|
-
|
|
570
|
+
y,
|
|
569
571
|
{
|
|
570
572
|
variant: "ghost",
|
|
571
|
-
onClick: () => r((
|
|
573
|
+
onClick: () => r((m) => !m),
|
|
572
574
|
size: "icon",
|
|
573
575
|
children: n ? /* @__PURE__ */ e.jsx(pe, { size: 16 }) : /* @__PURE__ */ e.jsx(me, { size: 16 })
|
|
574
576
|
}
|
|
575
577
|
),
|
|
576
578
|
/* @__PURE__ */ e.jsx(
|
|
577
|
-
|
|
579
|
+
y,
|
|
578
580
|
{
|
|
579
581
|
variant: "ghost",
|
|
580
|
-
onClick: () =>
|
|
582
|
+
onClick: () => c(f),
|
|
581
583
|
size: "icon",
|
|
582
584
|
children: a ? /* @__PURE__ */ e.jsx(te, { size: 16 }) : /* @__PURE__ */ e.jsx(xe, { size: 16 })
|
|
583
585
|
}
|
|
584
586
|
)
|
|
585
587
|
] }),
|
|
586
588
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
|
|
587
|
-
|
|
589
|
+
h && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
588
590
|
"Created ",
|
|
589
|
-
|
|
591
|
+
lt(h),
|
|
590
592
|
"."
|
|
591
593
|
] }),
|
|
592
594
|
" ",
|
|
593
|
-
d &&
|
|
595
|
+
d && p && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
594
596
|
"Expires in ",
|
|
595
597
|
u,
|
|
596
598
|
" ",
|
|
597
599
|
u === 1 ? "day" : "days",
|
|
598
600
|
"."
|
|
599
601
|
] }),
|
|
600
|
-
d &&
|
|
602
|
+
d && g && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
601
603
|
"Expired",
|
|
602
604
|
" ",
|
|
603
605
|
u === 0 ? "today." : `${u * -1} days ago.`
|
|
604
606
|
] })
|
|
605
607
|
] })
|
|
606
608
|
] }),
|
|
607
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && i && /* @__PURE__ */ e.jsxs(
|
|
608
|
-
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
609
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && i && /* @__PURE__ */ e.jsxs(L, { children: [
|
|
610
|
+
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(ye, { size: 16 }) }) }),
|
|
609
611
|
/* @__PURE__ */ e.jsxs(B, { children: [
|
|
610
612
|
/* @__PURE__ */ e.jsxs(H, { children: [
|
|
611
613
|
/* @__PURE__ */ e.jsx(V, { children: "Delete API Key" }),
|
|
612
614
|
/* @__PURE__ */ e.jsx(re, { children: "Are you sure you want to delete this API key?" })
|
|
613
615
|
] }),
|
|
614
616
|
/* @__PURE__ */ e.jsxs(W, { children: [
|
|
615
|
-
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
617
|
+
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Cancel" }) }),
|
|
616
618
|
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
617
|
-
|
|
619
|
+
y,
|
|
618
620
|
{
|
|
619
621
|
onClick: () => {
|
|
620
622
|
i();
|
|
@@ -626,7 +628,7 @@ const it = ({
|
|
|
626
628
|
] })
|
|
627
629
|
] }) })
|
|
628
630
|
] });
|
|
629
|
-
}, S = "https://api.zuploedge.com/v2/client",
|
|
631
|
+
}, S = "https://api.zuploedge.com/v2/client", dt = async (t) => {
|
|
630
632
|
try {
|
|
631
633
|
return await t.json();
|
|
632
634
|
} catch {
|
|
@@ -635,11 +637,11 @@ const it = ({
|
|
|
635
637
|
}, T = async (t) => {
|
|
636
638
|
const i = t.headers.get("content-type");
|
|
637
639
|
if (!t.ok && i?.includes("application/problem+json")) {
|
|
638
|
-
const s = await
|
|
640
|
+
const s = await dt(t);
|
|
639
641
|
if (s.type && s.title)
|
|
640
642
|
throw new Error(s.detail ?? s.title);
|
|
641
643
|
}
|
|
642
|
-
},
|
|
644
|
+
}, ut = (t, i) => ({
|
|
643
645
|
deleteKey: async (s, n, r) => {
|
|
644
646
|
const a = new Request(
|
|
645
647
|
S + `/${t}/consumers/${s}/keys/${n}`,
|
|
@@ -648,8 +650,8 @@ const it = ({
|
|
|
648
650
|
}
|
|
649
651
|
);
|
|
650
652
|
await r.signRequest(a);
|
|
651
|
-
const
|
|
652
|
-
await T(
|
|
653
|
+
const c = await fetch(a);
|
|
654
|
+
await T(c), P(c.ok, "Failed to delete API key");
|
|
653
655
|
},
|
|
654
656
|
updateConsumer: async (s, n) => {
|
|
655
657
|
const r = await fetch(
|
|
@@ -668,7 +670,7 @@ const it = ({
|
|
|
668
670
|
)
|
|
669
671
|
)
|
|
670
672
|
);
|
|
671
|
-
await T(r),
|
|
673
|
+
await T(r), P(r.ok, "Failed to update API key description");
|
|
672
674
|
},
|
|
673
675
|
rollKey: async (s, n) => {
|
|
674
676
|
const r = await fetch(
|
|
@@ -685,7 +687,7 @@ const it = ({
|
|
|
685
687
|
)
|
|
686
688
|
)
|
|
687
689
|
);
|
|
688
|
-
await T(r),
|
|
690
|
+
await T(r), P(r.ok, "Failed to delete API key");
|
|
689
691
|
},
|
|
690
692
|
getConsumers: async (s) => {
|
|
691
693
|
const n = new Request(
|
|
@@ -693,16 +695,16 @@ const it = ({
|
|
|
693
695
|
);
|
|
694
696
|
await s.signRequest(n);
|
|
695
697
|
const r = await fetch(n);
|
|
696
|
-
return await T(r),
|
|
697
|
-
id:
|
|
698
|
-
label:
|
|
699
|
-
apiKeys:
|
|
700
|
-
key:
|
|
698
|
+
return await T(r), P(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((c) => ({
|
|
699
|
+
id: c.id,
|
|
700
|
+
label: c.label || c.subject || "API Key",
|
|
701
|
+
apiKeys: c.apiKeys.data,
|
|
702
|
+
key: c.apiKeys.data.at(0)
|
|
701
703
|
}));
|
|
702
704
|
},
|
|
703
705
|
...i
|
|
704
|
-
}),
|
|
705
|
-
const i = "deploymentName" in t ?
|
|
706
|
+
}), Pt = (t) => t, Rt = (t) => {
|
|
707
|
+
const i = "deploymentName" in t ? ut(t.deploymentName, t) : t;
|
|
706
708
|
return {
|
|
707
709
|
getProfileMenuItems: () => [
|
|
708
710
|
{
|
|
@@ -728,12 +730,12 @@ const it = ({
|
|
|
728
730
|
},
|
|
729
731
|
getRoutes: () => [
|
|
730
732
|
{
|
|
731
|
-
element: /* @__PURE__ */ e.jsx(
|
|
733
|
+
element: /* @__PURE__ */ e.jsx(_e, {}),
|
|
732
734
|
errorElement: /* @__PURE__ */ e.jsx(Ce, {}),
|
|
733
735
|
children: [
|
|
734
736
|
{
|
|
735
737
|
path: "/settings/api-keys",
|
|
736
|
-
element: /* @__PURE__ */ e.jsx(
|
|
738
|
+
element: /* @__PURE__ */ e.jsx(ot, { service: i })
|
|
737
739
|
}
|
|
738
740
|
]
|
|
739
741
|
}
|
|
@@ -741,7 +743,7 @@ const it = ({
|
|
|
741
743
|
};
|
|
742
744
|
};
|
|
743
745
|
export {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
+
Rt as apiKeyPlugin,
|
|
747
|
+
Pt as createApiKeyService
|
|
746
748
|
};
|
|
747
749
|
//# sourceMappingURL=zudoku.plugin-api-keys.js.map
|