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