zudoku 0.54.3 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/components/navigation/NavigationCategory.js +1 -1
- package/dist/lib/components/navigation/NavigationCategory.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/SettingsApiKeys.js +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.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/lib/ui/CodeBlock.js +6 -6
- package/dist/lib/ui/CodeBlock.js.map +1 -1
- package/dist/vite/shadcn-registry.d.ts +4 -4
- package/lib/{CodeBlock-NFCmSWOK.js → CodeBlock-CVT6z0PP.js} +15 -15
- package/lib/CodeBlock-CVT6z0PP.js.map +1 -0
- package/lib/{MdxPage-C6Ru5mfp.js → MdxPage-BKyikAKk.js} +8 -8
- package/lib/{MdxPage-C6Ru5mfp.js.map → MdxPage-BKyikAKk.js.map} +1 -1
- package/lib/{OAuthErrorPage-Dd0fl6Lh.js → OAuthErrorPage--neTdY8H.js} +7 -7
- package/lib/{OAuthErrorPage-Dd0fl6Lh.js.map → OAuthErrorPage--neTdY8H.js.map} +1 -1
- package/lib/{OasProvider-DNmLItHj.js → OasProvider-yysXhMVI.js} +3 -3
- package/lib/{OasProvider-DNmLItHj.js.map → OasProvider-yysXhMVI.js.map} +1 -1
- package/lib/{OperationList-BE_BNejn.js → OperationList-CSYrpcpD.js} +12 -12
- package/lib/{OperationList-BE_BNejn.js.map → OperationList-CSYrpcpD.js.map} +1 -1
- package/lib/{Pagination-29CJ3c2k.js → Pagination-QsyyJuoq.js} +3 -3
- package/lib/{Pagination-29CJ3c2k.js.map → Pagination-QsyyJuoq.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-CSZkqmwI.js} +8 -8
- package/lib/{SchemaList-BTkZiol0.js.map → SchemaList-CSZkqmwI.js.map} +1 -1
- package/lib/{SchemaView-Bc5_uIbh.js → SchemaView-bhJ_U4vL.js} +4 -4
- package/lib/{SchemaView-Bc5_uIbh.js.map → SchemaView-bhJ_U4vL.js.map} +1 -1
- package/lib/{Select-DVKfV8Vb.js → Select-DlfI9FFO.js} +3 -3
- package/lib/{Select-DVKfV8Vb.js.map → Select-DlfI9FFO.js.map} +1 -1
- package/lib/{SignUp-DUmbxjcy.js → SignUp-C6ogvx5s.js} +4 -4
- package/lib/{SignUp-DUmbxjcy.js.map → SignUp-C6ogvx5s.js.map} +1 -1
- package/lib/{Slot-BahfuM5e.js → Slot-Dgy8tqef.js} +14 -14
- package/lib/{Slot-BahfuM5e.js.map → Slot-Dgy8tqef.js.map} +1 -1
- package/lib/{SyntaxHighlight-BaPoOBLD.js → SyntaxHighlight-BD_Z_Csq.js} +3 -3
- package/lib/{SyntaxHighlight-BaPoOBLD.js.map → SyntaxHighlight-BD_Z_Csq.js.map} +1 -1
- package/lib/{Toc-MF9YxB9B.js → Toc-CjX59Ljo.js} +2 -2
- package/lib/{Toc-MF9YxB9B.js.map → Toc-CjX59Ljo.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-Q4G1nwyb.js} +2 -2
- package/lib/{circular-Bv1c2Yd3.js.map → circular-Q4G1nwyb.js.map} +1 -1
- package/lib/{createServer-B4o75XI3.js → createServer-Dtstxqn7.js} +4 -4
- package/lib/{createServer-B4o75XI3.js.map → createServer-Dtstxqn7.js.map} +1 -1
- package/lib/{errors-7Pb4eZXa.js → errors-BoJYHL2E.js} +2 -2
- package/lib/{errors-7Pb4eZXa.js.map → errors-BoJYHL2E.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-Bl1W774G.js} +2 -2
- package/lib/{index-fHJ5WmM5.js.map → index-Bl1W774G.js.map} +1 -1
- package/lib/{index-D_weJvKR.js → index-DRkS-pvf.js} +16 -16
- package/lib/{index-D_weJvKR.js.map → index-DRkS-pvf.js.map} +1 -1
- package/lib/{index-BqrVgyZ3.js → index-DYs8gxKX.js} +7 -7
- package/lib/{index-BqrVgyZ3.js.map → index-DYs8gxKX.js.map} +1 -1
- package/lib/ui/CodeBlock.js +1 -1
- package/lib/ui/SyntaxHighlight.js +3 -3
- 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 +190 -191
- 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/components/navigation/NavigationCategory.tsx +1 -1
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +6 -3
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +1 -3
- package/src/lib/plugins/api-keys/index.tsx +10 -4
- package/src/lib/ui/CodeBlock.tsx +6 -6
- package/dist/flat-config.d.ts +0 -327
- package/lib/CodeBlock-NFCmSWOK.js.map +0 -1
- 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-Dgy8tqef.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-DlfI9FFO.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-CVT6z0PP.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,109 +250,106 @@ 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" }),
|
|
335
337
|
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
|
|
336
|
-
/* @__PURE__ */ e.
|
|
337
|
-
"API Keys ",
|
|
338
|
-
typeof t.createKey
|
|
339
|
-
] }),
|
|
338
|
+
/* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
|
|
340
339
|
t.createKey && /* @__PURE__ */ e.jsxs(
|
|
341
|
-
|
|
340
|
+
L,
|
|
342
341
|
{
|
|
343
342
|
open: d,
|
|
344
|
-
onOpenChange:
|
|
343
|
+
onOpenChange: g,
|
|
345
344
|
children: [
|
|
346
|
-
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
345
|
+
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Create API Key" }) }),
|
|
347
346
|
/* @__PURE__ */ e.jsxs(B, { children: [
|
|
348
347
|
/* @__PURE__ */ e.jsx(H, { children: /* @__PURE__ */ e.jsx(V, { children: "Create API Key" }) }),
|
|
349
348
|
/* @__PURE__ */ e.jsx(
|
|
350
|
-
|
|
349
|
+
rt,
|
|
351
350
|
{
|
|
352
351
|
service: t,
|
|
353
|
-
onOpenChange:
|
|
352
|
+
onOpenChange: g
|
|
354
353
|
}
|
|
355
354
|
)
|
|
356
355
|
] })
|
|
@@ -361,37 +360,37 @@ const it = ({
|
|
|
361
360
|
/* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
|
|
362
361
|
/* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page-before-keys" }),
|
|
363
362
|
/* @__PURE__ */ e.jsx("div", { className: "h-8" }),
|
|
363
|
+
m.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
364
|
+
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
365
|
+
/* @__PURE__ */ e.jsx(M, { children: m.error.message })
|
|
366
|
+
] }),
|
|
364
367
|
p.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
365
|
-
/* @__PURE__ */ e.jsx(
|
|
368
|
+
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
366
369
|
/* @__PURE__ */ e.jsx(M, { children: p.error.message })
|
|
367
370
|
] }),
|
|
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
371
|
u.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
373
|
-
/* @__PURE__ */ e.jsx(
|
|
372
|
+
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
374
373
|
/* @__PURE__ */ e.jsx(M, { children: u.error.message })
|
|
375
374
|
] }),
|
|
376
|
-
/* @__PURE__ */ e.jsx("div", { className: "", children:
|
|
375
|
+
/* @__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
376
|
/* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
|
|
378
377
|
"You have no API keys yet.",
|
|
379
378
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
380
379
|
t.createKey && "Get started and create your first key."
|
|
381
380
|
] }),
|
|
382
|
-
t.createKey && /* @__PURE__ */ e.jsx(
|
|
381
|
+
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
382
|
] }) : /* @__PURE__ */ e.jsx(
|
|
384
383
|
"ul",
|
|
385
384
|
{
|
|
386
385
|
className: N(
|
|
387
386
|
"grid grid-cols-[1fr_min-content] divide-y divide-border col-span-6"
|
|
388
387
|
),
|
|
389
|
-
children:
|
|
390
|
-
|
|
388
|
+
children: f.map((o) => /* @__PURE__ */ e.jsxs(
|
|
389
|
+
$e,
|
|
391
390
|
{
|
|
392
391
|
className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
|
|
393
392
|
children: [
|
|
394
|
-
/* @__PURE__ */ e.jsxs(
|
|
393
|
+
/* @__PURE__ */ e.jsxs(Fe, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
|
|
395
394
|
/* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
|
|
396
395
|
/* @__PURE__ */ e.jsxs("div", { className: "font-medium text-lg flex items-center gap-2", children: [
|
|
397
396
|
n === o.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
|
|
@@ -400,9 +399,9 @@ const it = ({
|
|
|
400
399
|
{
|
|
401
400
|
maxLength: 32,
|
|
402
401
|
value: a,
|
|
403
|
-
onChange: (
|
|
404
|
-
onKeyDown: (
|
|
405
|
-
|
|
402
|
+
onChange: (l) => c(l.target.value),
|
|
403
|
+
onKeyDown: (l) => {
|
|
404
|
+
l.key === "Enter" ? j(o.id) : l.key === "Escape" && A();
|
|
406
405
|
},
|
|
407
406
|
className: "text-lg font-medium",
|
|
408
407
|
autoFocus: !0
|
|
@@ -410,21 +409,21 @@ const it = ({
|
|
|
410
409
|
),
|
|
411
410
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
412
411
|
/* @__PURE__ */ e.jsx(
|
|
413
|
-
|
|
412
|
+
y,
|
|
414
413
|
{
|
|
415
414
|
size: "icon",
|
|
416
415
|
variant: "ghost",
|
|
417
|
-
onClick: () =>
|
|
416
|
+
onClick: () => j(o.id),
|
|
418
417
|
disabled: !a.trim(),
|
|
419
418
|
children: /* @__PURE__ */ e.jsx(te, { size: 16 })
|
|
420
419
|
}
|
|
421
420
|
),
|
|
422
421
|
/* @__PURE__ */ e.jsx(
|
|
423
|
-
|
|
422
|
+
y,
|
|
424
423
|
{
|
|
425
424
|
size: "icon",
|
|
426
425
|
variant: "ghost",
|
|
427
|
-
onClick:
|
|
426
|
+
onClick: A,
|
|
428
427
|
children: /* @__PURE__ */ e.jsx(ue, { size: 16 })
|
|
429
428
|
}
|
|
430
429
|
)
|
|
@@ -447,10 +446,10 @@ const it = ({
|
|
|
447
446
|
] }),
|
|
448
447
|
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
|
|
449
448
|
t.updateConsumer && /* @__PURE__ */ e.jsxs(
|
|
450
|
-
|
|
449
|
+
y,
|
|
451
450
|
{
|
|
452
451
|
variant: "ghost",
|
|
453
|
-
onClick: () =>
|
|
452
|
+
onClick: () => x(o.id, o.label),
|
|
454
453
|
className: N(
|
|
455
454
|
"flex gap-2",
|
|
456
455
|
n === o.id && "opacity-0! pointer-events-none"
|
|
@@ -462,20 +461,20 @@ const it = ({
|
|
|
462
461
|
]
|
|
463
462
|
}
|
|
464
463
|
),
|
|
465
|
-
t.rollKey && /* @__PURE__ */ e.jsxs(
|
|
464
|
+
t.rollKey && /* @__PURE__ */ e.jsxs(L, { children: [
|
|
466
465
|
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
467
|
-
|
|
466
|
+
y,
|
|
468
467
|
{
|
|
469
468
|
title: "Roll this key",
|
|
470
469
|
variant: "ghost",
|
|
471
|
-
disabled:
|
|
470
|
+
disabled: m.isPending,
|
|
472
471
|
className: "flex items-center gap-2",
|
|
473
472
|
children: [
|
|
474
473
|
/* @__PURE__ */ e.jsx(
|
|
475
474
|
fe,
|
|
476
475
|
{
|
|
477
476
|
size: 16,
|
|
478
|
-
className:
|
|
477
|
+
className: m.isPending ? "animate-spin" : void 0
|
|
479
478
|
}
|
|
480
479
|
),
|
|
481
480
|
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
|
|
@@ -488,12 +487,12 @@ const it = ({
|
|
|
488
487
|
/* @__PURE__ */ e.jsx(re, { children: "Are you sure you want to roll this API key?" })
|
|
489
488
|
] }),
|
|
490
489
|
/* @__PURE__ */ e.jsxs(W, { children: [
|
|
491
|
-
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
490
|
+
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Cancel" }) }),
|
|
492
491
|
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
493
|
-
|
|
492
|
+
y,
|
|
494
493
|
{
|
|
495
494
|
onClick: () => {
|
|
496
|
-
|
|
495
|
+
m.mutate(o.id);
|
|
497
496
|
},
|
|
498
497
|
children: "Roll Key"
|
|
499
498
|
}
|
|
@@ -503,22 +502,22 @@ const it = ({
|
|
|
503
502
|
] })
|
|
504
503
|
] })
|
|
505
504
|
] }),
|
|
506
|
-
/* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(
|
|
505
|
+
/* @__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
506
|
/* @__PURE__ */ e.jsx(
|
|
508
|
-
|
|
507
|
+
ct,
|
|
509
508
|
{
|
|
510
|
-
apiKey:
|
|
509
|
+
apiKey: l,
|
|
511
510
|
onDeleteKey: () => {
|
|
512
511
|
u.mutate({
|
|
513
512
|
consumerId: o.id,
|
|
514
|
-
keyId:
|
|
513
|
+
keyId: l.id
|
|
515
514
|
});
|
|
516
515
|
},
|
|
517
|
-
className: u.variables?.keyId ===
|
|
516
|
+
className: u.variables?.keyId === l.id && (u.isPending || h) ? "opacity-10!" : void 0
|
|
518
517
|
}
|
|
519
518
|
),
|
|
520
519
|
/* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
|
|
521
|
-
] },
|
|
520
|
+
] }, l.id)) }) })
|
|
522
521
|
]
|
|
523
522
|
},
|
|
524
523
|
o.id
|
|
@@ -526,17 +525,17 @@ const it = ({
|
|
|
526
525
|
}
|
|
527
526
|
) })
|
|
528
527
|
] });
|
|
529
|
-
},
|
|
528
|
+
}, lt = (t) => {
|
|
530
529
|
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
530
|
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
|
-
},
|
|
531
|
+
}, ct = ({
|
|
533
532
|
apiKey: t,
|
|
534
533
|
onDeleteKey: i,
|
|
535
534
|
className: s
|
|
536
535
|
}) => {
|
|
537
|
-
const [n, r] = K(!1), [a,
|
|
536
|
+
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
537
|
(new Date(d).getTime() - (/* @__PURE__ */ new Date()).getTime()) / (1e3 * 60 * 60 * 24)
|
|
539
|
-
) : 1 / 0,
|
|
538
|
+
) : 1 / 0, p = u <= 7 && !g;
|
|
540
539
|
return /* @__PURE__ */ e.jsxs("div", { className: N("grid col-span-full grid-cols-subgrid p-6", s), children: [
|
|
541
540
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
542
541
|
/* @__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 +545,7 @@ const it = ({
|
|
|
546
545
|
{
|
|
547
546
|
className: N(
|
|
548
547
|
"rounded-full w-2 h-2 bg-emerald-400 mr-2",
|
|
549
|
-
(
|
|
548
|
+
(p || g) && "bg-neutral-200"
|
|
550
549
|
)
|
|
551
550
|
}
|
|
552
551
|
),
|
|
@@ -558,63 +557,63 @@ const it = ({
|
|
|
558
557
|
"w-40 inline-block md:w-full truncate",
|
|
559
558
|
n ? "" : "opacity-20"
|
|
560
559
|
),
|
|
561
|
-
children: n ?
|
|
560
|
+
children: n ? f.slice(0, -5) : "**** ".repeat(f.slice(0, -5).length / 5) + "*".repeat(f.slice(0, -5).length % 5)
|
|
562
561
|
}
|
|
563
562
|
),
|
|
564
|
-
/* @__PURE__ */ e.jsx("span", { children:
|
|
563
|
+
/* @__PURE__ */ e.jsx("span", { children: f.slice(-5) })
|
|
565
564
|
] })
|
|
566
565
|
] }),
|
|
567
566
|
/* @__PURE__ */ e.jsx(
|
|
568
|
-
|
|
567
|
+
y,
|
|
569
568
|
{
|
|
570
569
|
variant: "ghost",
|
|
571
|
-
onClick: () => r((
|
|
570
|
+
onClick: () => r((m) => !m),
|
|
572
571
|
size: "icon",
|
|
573
572
|
children: n ? /* @__PURE__ */ e.jsx(pe, { size: 16 }) : /* @__PURE__ */ e.jsx(me, { size: 16 })
|
|
574
573
|
}
|
|
575
574
|
),
|
|
576
575
|
/* @__PURE__ */ e.jsx(
|
|
577
|
-
|
|
576
|
+
y,
|
|
578
577
|
{
|
|
579
578
|
variant: "ghost",
|
|
580
|
-
onClick: () =>
|
|
579
|
+
onClick: () => c(f),
|
|
581
580
|
size: "icon",
|
|
582
581
|
children: a ? /* @__PURE__ */ e.jsx(te, { size: 16 }) : /* @__PURE__ */ e.jsx(xe, { size: 16 })
|
|
583
582
|
}
|
|
584
583
|
)
|
|
585
584
|
] }),
|
|
586
585
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
|
|
587
|
-
|
|
586
|
+
h && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
588
587
|
"Created ",
|
|
589
|
-
|
|
588
|
+
lt(h),
|
|
590
589
|
"."
|
|
591
590
|
] }),
|
|
592
591
|
" ",
|
|
593
|
-
d &&
|
|
592
|
+
d && p && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
594
593
|
"Expires in ",
|
|
595
594
|
u,
|
|
596
595
|
" ",
|
|
597
596
|
u === 1 ? "day" : "days",
|
|
598
597
|
"."
|
|
599
598
|
] }),
|
|
600
|
-
d &&
|
|
599
|
+
d && g && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
601
600
|
"Expired",
|
|
602
601
|
" ",
|
|
603
602
|
u === 0 ? "today." : `${u * -1} days ago.`
|
|
604
603
|
] })
|
|
605
604
|
] })
|
|
606
605
|
] }),
|
|
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(
|
|
606
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && i && /* @__PURE__ */ e.jsxs(L, { children: [
|
|
607
|
+
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(ye, { size: 16 }) }) }),
|
|
609
608
|
/* @__PURE__ */ e.jsxs(B, { children: [
|
|
610
609
|
/* @__PURE__ */ e.jsxs(H, { children: [
|
|
611
610
|
/* @__PURE__ */ e.jsx(V, { children: "Delete API Key" }),
|
|
612
611
|
/* @__PURE__ */ e.jsx(re, { children: "Are you sure you want to delete this API key?" })
|
|
613
612
|
] }),
|
|
614
613
|
/* @__PURE__ */ e.jsxs(W, { children: [
|
|
615
|
-
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
614
|
+
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Cancel" }) }),
|
|
616
615
|
/* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
617
|
-
|
|
616
|
+
y,
|
|
618
617
|
{
|
|
619
618
|
onClick: () => {
|
|
620
619
|
i();
|
|
@@ -626,7 +625,7 @@ const it = ({
|
|
|
626
625
|
] })
|
|
627
626
|
] }) })
|
|
628
627
|
] });
|
|
629
|
-
}, S = "https://api.zuploedge.com/v2/client",
|
|
628
|
+
}, S = "https://api.zuploedge.com/v2/client", dt = async (t) => {
|
|
630
629
|
try {
|
|
631
630
|
return await t.json();
|
|
632
631
|
} catch {
|
|
@@ -635,11 +634,11 @@ const it = ({
|
|
|
635
634
|
}, T = async (t) => {
|
|
636
635
|
const i = t.headers.get("content-type");
|
|
637
636
|
if (!t.ok && i?.includes("application/problem+json")) {
|
|
638
|
-
const s = await
|
|
637
|
+
const s = await dt(t);
|
|
639
638
|
if (s.type && s.title)
|
|
640
639
|
throw new Error(s.detail ?? s.title);
|
|
641
640
|
}
|
|
642
|
-
},
|
|
641
|
+
}, ut = (t, i) => ({
|
|
643
642
|
deleteKey: async (s, n, r) => {
|
|
644
643
|
const a = new Request(
|
|
645
644
|
S + `/${t}/consumers/${s}/keys/${n}`,
|
|
@@ -648,8 +647,8 @@ const it = ({
|
|
|
648
647
|
}
|
|
649
648
|
);
|
|
650
649
|
await r.signRequest(a);
|
|
651
|
-
const
|
|
652
|
-
await T(
|
|
650
|
+
const c = await fetch(a);
|
|
651
|
+
await T(c), P(c.ok, "Failed to delete API key");
|
|
653
652
|
},
|
|
654
653
|
updateConsumer: async (s, n) => {
|
|
655
654
|
const r = await fetch(
|
|
@@ -668,7 +667,7 @@ const it = ({
|
|
|
668
667
|
)
|
|
669
668
|
)
|
|
670
669
|
);
|
|
671
|
-
await T(r),
|
|
670
|
+
await T(r), P(r.ok, "Failed to update API key description");
|
|
672
671
|
},
|
|
673
672
|
rollKey: async (s, n) => {
|
|
674
673
|
const r = await fetch(
|
|
@@ -685,7 +684,7 @@ const it = ({
|
|
|
685
684
|
)
|
|
686
685
|
)
|
|
687
686
|
);
|
|
688
|
-
await T(r),
|
|
687
|
+
await T(r), P(r.ok, "Failed to delete API key");
|
|
689
688
|
},
|
|
690
689
|
getConsumers: async (s) => {
|
|
691
690
|
const n = new Request(
|
|
@@ -693,16 +692,16 @@ const it = ({
|
|
|
693
692
|
);
|
|
694
693
|
await s.signRequest(n);
|
|
695
694
|
const r = await fetch(n);
|
|
696
|
-
return await T(r),
|
|
697
|
-
id:
|
|
698
|
-
label:
|
|
699
|
-
apiKeys:
|
|
700
|
-
key:
|
|
695
|
+
return await T(r), P(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((c) => ({
|
|
696
|
+
id: c.id,
|
|
697
|
+
label: c.label || c.subject || "API Key",
|
|
698
|
+
apiKeys: c.apiKeys.data,
|
|
699
|
+
key: c.apiKeys.data.at(0)
|
|
701
700
|
}));
|
|
702
701
|
},
|
|
703
702
|
...i
|
|
704
|
-
}),
|
|
705
|
-
const i = "deploymentName" in t ?
|
|
703
|
+
}), Pt = (t) => t, Rt = (t) => {
|
|
704
|
+
const i = "deploymentName" in t ? ut(t.deploymentName, t) : t;
|
|
706
705
|
return {
|
|
707
706
|
getProfileMenuItems: () => [
|
|
708
707
|
{
|
|
@@ -728,12 +727,12 @@ const it = ({
|
|
|
728
727
|
},
|
|
729
728
|
getRoutes: () => [
|
|
730
729
|
{
|
|
731
|
-
element: /* @__PURE__ */ e.jsx(
|
|
730
|
+
element: /* @__PURE__ */ e.jsx(_e, {}),
|
|
732
731
|
errorElement: /* @__PURE__ */ e.jsx(Ce, {}),
|
|
733
732
|
children: [
|
|
734
733
|
{
|
|
735
734
|
path: "/settings/api-keys",
|
|
736
|
-
element: /* @__PURE__ */ e.jsx(
|
|
735
|
+
element: /* @__PURE__ */ e.jsx(ot, { service: i })
|
|
737
736
|
}
|
|
738
737
|
]
|
|
739
738
|
}
|
|
@@ -741,7 +740,7 @@ const it = ({
|
|
|
741
740
|
};
|
|
742
741
|
};
|
|
743
742
|
export {
|
|
744
|
-
|
|
745
|
-
|
|
743
|
+
Rt as apiKeyPlugin,
|
|
744
|
+
Pt as createApiKeyService
|
|
746
745
|
};
|
|
747
746
|
//# sourceMappingURL=zudoku.plugin-api-keys.js.map
|