zudoku 0.66.4 → 0.66.5
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/lib/authentication/components/CallbackHandler.js +1 -1
- package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
- package/dist/lib/core/RouteGuard.js +12 -7
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +9 -5
- package/dist/lib/plugins/api-keys/index.js +18 -8
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js +3 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js.map +1 -1
- package/dist/lib/util/invariant.d.ts +1 -1
- package/dist/lib/util/invariant.js +2 -2
- package/dist/lib/util/invariant.js.map +1 -1
- package/dist/vite/mdx/remark-link-rewrite.js +1 -1
- package/dist/vite/plugin-api-keys.js +1 -0
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/lib/{ActionButton-BSM2oNHF.js → ActionButton-B0CXL1Lq.js} +3 -3
- package/lib/{ActionButton-BSM2oNHF.js.map → ActionButton-B0CXL1Lq.js.map} +1 -1
- package/lib/{Button-IOAeVaIH.js → Button-GUVe7pmt.js} +2 -2
- package/lib/{Button-IOAeVaIH.js.map → Button-GUVe7pmt.js.map} +1 -1
- package/lib/{Card-KFniaZn5.js → Card-DCdq37aA.js} +2 -2
- package/lib/{Card-KFniaZn5.js.map → Card-DCdq37aA.js.map} +1 -1
- package/lib/{ClaudeLogo-DgjivS8A.js → ClaudeLogo-ByzA8TYR.js} +3 -3
- package/lib/{ClaudeLogo-DgjivS8A.js.map → ClaudeLogo-ByzA8TYR.js.map} +1 -1
- package/lib/{Command-BpT1iBE6.js → Command-N6VujV30.js} +3 -3
- package/lib/{Command-BpT1iBE6.js.map → Command-N6VujV30.js.map} +1 -1
- package/lib/{Dialog-BQciPiHN.js → Dialog-hlvmmQ_c.js} +2 -2
- package/lib/{Dialog-BQciPiHN.js.map → Dialog-hlvmmQ_c.js.map} +1 -1
- package/lib/{Drawer-BRMcpfuF.js → Drawer-Ch7927PF.js} +2 -2
- package/lib/{Drawer-BRMcpfuF.js.map → Drawer-Ch7927PF.js.map} +1 -1
- package/lib/{DropdownMenu-C8SX_-S_.js → DropdownMenu-DN0jNrjj.js} +2 -2
- package/lib/{DropdownMenu-C8SX_-S_.js.map → DropdownMenu-DN0jNrjj.js.map} +1 -1
- package/lib/{Frame-DxlznfVd.js → Frame-DKlOmSkU.js} +2 -2
- package/lib/{Frame-DxlznfVd.js.map → Frame-DKlOmSkU.js.map} +1 -1
- package/lib/{IndexingDialog-DZWj_3cU.js → IndexingDialog-D0YdGfbn.js} +3 -3
- package/lib/{IndexingDialog-DZWj_3cU.js.map → IndexingDialog-D0YdGfbn.js.map} +1 -1
- package/lib/{Input-D-kqEQ5M.js → Input-nskrp_mj.js} +39 -18
- package/lib/Input-nskrp_mj.js.map +1 -0
- package/lib/{MdxPage-BL-HbZrv.js → MdxPage-Bh5YNRV9.js} +10 -10
- package/lib/{MdxPage-BL-HbZrv.js.map → MdxPage-Bh5YNRV9.js.map} +1 -1
- package/lib/{Mermaid-BjSczjLW.js → Mermaid-CGRoylZf.js} +4 -4
- package/lib/{Mermaid-BjSczjLW.js.map → Mermaid-CGRoylZf.js.map} +1 -1
- package/lib/{OAuthErrorPage-DQtg28Go.js → OAuthErrorPage-CsTKz5hX.js} +8 -8
- package/lib/OAuthErrorPage-CsTKz5hX.js.map +1 -0
- package/lib/{OasProvider--qcZwrKS.js → OasProvider-BBAbJiYa.js} +3 -3
- package/lib/{OasProvider--qcZwrKS.js.map → OasProvider-BBAbJiYa.js.map} +1 -1
- package/lib/{OperationList-CSJYzxQY.js → OperationList-DUxrNisd.js} +16 -16
- package/lib/{OperationList-CSJYzxQY.js.map → OperationList-DUxrNisd.js.map} +1 -1
- package/lib/RouteGuard-CIN9Ou-r.js +77 -0
- package/lib/RouteGuard-CIN9Ou-r.js.map +1 -0
- package/lib/{SchemaList-DtyuDrQA.js → SchemaList-BbnkfjIe.js} +9 -9
- package/lib/{SchemaList-DtyuDrQA.js.map → SchemaList-BbnkfjIe.js.map} +1 -1
- package/lib/{SchemaView-G-SVXxAG.js → SchemaView-BrUf6_nP.js} +6 -6
- package/lib/{SchemaView-G-SVXxAG.js.map → SchemaView-BrUf6_nP.js.map} +1 -1
- package/lib/{Secret-BxGpIhDP.js → Secret-BDBqq4p3.js} +2 -2
- package/lib/{Secret-BxGpIhDP.js.map → Secret-BDBqq4p3.js.map} +1 -1
- package/lib/{Separator-CTPSeW1S.js → Separator-BXt1LYnm.js} +2 -2
- package/lib/{Separator-CTPSeW1S.js.map → Separator-BXt1LYnm.js.map} +1 -1
- package/lib/{SignUp-CDl7bQj3.js → SignUp-AlaaduyY.js} +4 -4
- package/lib/{SignUp-CDl7bQj3.js.map → SignUp-AlaaduyY.js.map} +1 -1
- package/lib/{SyntaxHighlight-Dgd0AaaX.js → SyntaxHighlight-DveJcTOQ.js} +4 -4
- package/lib/{SyntaxHighlight-Dgd0AaaX.js.map → SyntaxHighlight-DveJcTOQ.js.map} +1 -1
- package/lib/{Toc-D_Rj4jVx.js → Toc-B4ShtN-I.js} +3 -3
- package/lib/{Toc-D_Rj4jVx.js.map → Toc-B4ShtN-I.js.map} +1 -1
- package/lib/{ZudokuContext-DNHMZfcP.js → ZudokuContext-CDJYKqMY.js} +542 -469
- package/lib/ZudokuContext-CDJYKqMY.js.map +1 -0
- package/lib/{___vite-browser-external_commonjs-proxy-Cga3HsWk.js → ___vite-browser-external_commonjs-proxy-BttVsNON.js} +2 -2
- package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js.map +1 -0
- package/lib/{circular-BxODTa7z.js → circular-CuSWVYOZ.js} +2 -2
- package/lib/{circular-BxODTa7z.js.map → circular-CuSWVYOZ.js.map} +1 -1
- package/lib/{cn-dYga0KKN.js → cn-5-Gd1Dss.js} +531 -498
- package/lib/cn-5-Gd1Dss.js.map +1 -0
- package/lib/{createServer-BpreIXp6.js → createServer-B1_RUTJP.js} +6 -6
- package/lib/{createServer-BpreIXp6.js.map → createServer-B1_RUTJP.js.map} +1 -1
- package/lib/{createVariantComponent-CQVt-H3r.js → createVariantComponent-Dc0vtOvr.js} +2 -2
- package/lib/{createVariantComponent-CQVt-H3r.js.map → createVariantComponent-Dc0vtOvr.js.map} +1 -1
- package/lib/{errors-DliW1dED.js → errors-iDfQAr_v.js} +3 -3
- package/lib/{errors-DliW1dED.js.map → errors-iDfQAr_v.js.map} +1 -1
- package/lib/{firebase-D4tbaCYB.js → firebase-I54w2ZsH.js} +20 -20
- package/lib/{firebase-D4tbaCYB.js.map → firebase-I54w2ZsH.js.map} +1 -1
- package/lib/{hook-CHw_R_xu.js → hook-BxWvqzB0.js} +2 -2
- package/lib/{hook-CHw_R_xu.js.map → hook-BxWvqzB0.js.map} +1 -1
- package/lib/{index-CboxZOVW.js → index-A5Cre871.js} +11 -11
- package/lib/{index-CboxZOVW.js.map → index-A5Cre871.js.map} +1 -1
- package/lib/{index-9MxNUgg4.js → index-B4puReRo.js} +20 -20
- package/lib/{index-9MxNUgg4.js.map → index-B4puReRo.js.map} +1 -1
- package/lib/{index-DXXZDuSJ.js → index-CjTisMeX.js} +3 -3
- package/lib/{index-DXXZDuSJ.js.map → index-CjTisMeX.js.map} +1 -1
- package/lib/{index-1TbL0HXQ.js → index-Dbrv6d94.js} +2 -2
- package/lib/{index-1TbL0HXQ.js.map → index-Dbrv6d94.js.map} +1 -1
- package/lib/{index.esm-DtzT_KoE.js → index.esm-B_0dvNjB.js} +2 -2
- package/lib/{index.esm-DtzT_KoE.js.map → index.esm-B_0dvNjB.js.map} +1 -1
- package/lib/{index.esm-ti5zvZS_.js → index.esm-BxIXRKtj.js} +2 -2
- package/lib/index.esm-BxIXRKtj.js.map +1 -0
- package/lib/{invariant-CGOLuIIz.js → invariant-BJAl77rw.js} +4 -4
- package/lib/invariant-BJAl77rw.js.map +1 -0
- package/lib/{mutation-DMHWqmFp.js → mutation-Cq0wKBqW.js} +70 -44
- package/lib/mutation-Cq0wKBqW.js.map +1 -0
- package/lib/ui/Accordion.js +1 -1
- package/lib/ui/ActionButton.js +2 -2
- package/lib/ui/Alert.js +1 -1
- package/lib/ui/AlertDialog.js +1 -1
- package/lib/ui/Badge.js +1 -1
- package/lib/ui/Breadcrumb.js +1 -1
- package/lib/ui/Button.js +1 -1
- package/lib/ui/ButtonGroup.js +1 -1
- package/lib/ui/Callout.js +1 -1
- package/lib/ui/Card.js +1 -1
- package/lib/ui/Carousel.js +1 -1
- package/lib/ui/Checkbox.js +1 -1
- package/lib/ui/CodeBlock.js +1 -1
- package/lib/ui/Command.js +2 -2
- package/lib/ui/Dialog.js +1 -1
- package/lib/ui/Drawer.js +2 -2
- package/lib/ui/DropdownMenu.js +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/lib/ui/Form.js +1 -1
- package/lib/ui/Frame.js +1 -1
- package/lib/ui/HoverCard.js +1 -1
- package/lib/ui/Input.js +1 -1
- package/lib/ui/Item.js +1 -1
- package/lib/ui/Label.js +1 -1
- package/lib/ui/NativeSelect.js +1 -1
- package/lib/ui/Pagination.js +1 -1
- package/lib/ui/Popover.js +1 -1
- package/lib/ui/Progress.js +1 -1
- package/lib/ui/RadioGroup.js +1 -1
- package/lib/ui/ScrollArea.js +1 -1
- package/lib/ui/Secret.js +1 -1
- package/lib/ui/Separator.js +1 -1
- package/lib/ui/Skeleton.js +1 -1
- package/lib/ui/Slider.js +1 -1
- package/lib/ui/Switch.js +1 -1
- package/lib/ui/SyntaxHighlight.js +3 -3
- package/lib/ui/Tabs.js +1 -1
- package/lib/ui/Textarea.js +1 -1
- package/lib/ui/Toggle.js +1 -1
- package/lib/ui/ToggleGroup.js +1 -1
- package/lib/ui/Value.js +1 -1
- package/lib/ui/util.js +1 -1
- package/lib/zudoku.__internal.js +576 -574
- package/lib/zudoku.__internal.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-azureb2c.js +4 -4
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-firebase.js +5 -5
- package/lib/zudoku.auth-openid.js +5 -5
- package/lib/zudoku.auth-supabase.js +4 -4
- package/lib/zudoku.components.js +5 -5
- package/lib/zudoku.hooks.js +3 -3
- package/lib/zudoku.mermaid.js +3 -3
- package/lib/zudoku.plugin-api-catalog.js +4 -4
- package/lib/zudoku.plugin-api-keys.js +258 -240
- 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 +2 -2
- package/lib/zudoku.plugin-search-pagefind.js +6 -6
- package/package.json +3 -3
- package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
- package/src/lib/core/RouteGuard.tsx +30 -24
- package/src/lib/plugins/api-keys/index.tsx +46 -16
- package/src/lib/plugins/api-keys/settings/ApiKeyList.tsx +3 -0
- package/src/lib/util/invariant.ts +2 -1
- package/lib/Input-D-kqEQ5M.js.map +0 -1
- package/lib/OAuthErrorPage-DQtg28Go.js.map +0 -1
- package/lib/RouteGuard-D0f743SM.js +0 -77
- package/lib/RouteGuard-D0f743SM.js.map +0 -1
- package/lib/ZudokuContext-DNHMZfcP.js.map +0 -1
- package/lib/___vite-browser-external_commonjs-proxy-Cga3HsWk.js.map +0 -1
- package/lib/cn-dYga0KKN.js.map +0 -1
- package/lib/index.esm-ti5zvZS_.js.map +0 -1
- package/lib/invariant-CGOLuIIz.js.map +0 -1
- package/lib/mutation-DMHWqmFp.js.map +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { TrashIcon as
|
|
3
|
-
import { Z as
|
|
4
|
-
import * as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { D as
|
|
7
|
-
import { b as
|
|
8
|
-
import { F as
|
|
9
|
-
import { A as D, a as
|
|
10
|
-
import { e as
|
|
11
|
-
import { Button as
|
|
12
|
-
import { a as U, g as
|
|
13
|
-
import { u as
|
|
14
|
-
import { a as
|
|
15
|
-
import { u as
|
|
16
|
-
import { A as Ve } from "./ActionButton-
|
|
17
|
-
import { S as
|
|
2
|
+
import { TrashIcon as me, CircleSlashIcon as z, CheckIcon as xe, XIcon as ye, PencilLineIcon as ge, RefreshCwIcon as je, KeyRoundIcon as ve } from "lucide-react";
|
|
3
|
+
import { Z as M, i as E } from "./invariant-BJAl77rw.js";
|
|
4
|
+
import * as F from "react";
|
|
5
|
+
import { createContext as Q, useRef as A, useLayoutEffect as Ce, useEffect as ie, useId as H, useContext as V, useInsertionEffect as we, useMemo as L, useCallback as ke, Children as Ee, isValidElement as Ie, useState as I } from "react";
|
|
6
|
+
import { D as be, c as Ke, d as ee, B as De, E as Pe } from "./index-A5Cre871.js";
|
|
7
|
+
import { b as re } from "./index-CjTisMeX.js";
|
|
8
|
+
import { F as Ae, g as Se, j as Re, h as Ne, d as Oe, I as Te, a as qe, b as Me, k as Fe, c as $e } from "./Frame-DKlOmSkU.js";
|
|
9
|
+
import { A as D, a as P, b as ae } from "./Mermaid-CGRoylZf.js";
|
|
10
|
+
import { e as _, f as S, D as B, g as Z, a as G, b as J, c as Y, d as oe } from "./Dialog-hlvmmQ_c.js";
|
|
11
|
+
import { Button as le } from "./ui/Button.js";
|
|
12
|
+
import { a as U, g as ce, e as ze } from "./ZudokuContext-CDJYKqMY.js";
|
|
13
|
+
import { u as q, I as Le } from "./Input-nskrp_mj.js";
|
|
14
|
+
import { a as Qe } from "./index.esm-BYObtETB.js";
|
|
15
|
+
import { u as He } from "./chunk-PVWAREVJ-ClM0m2aJ.js";
|
|
16
|
+
import { A as Ve } from "./ActionButton-B0CXL1Lq.js";
|
|
17
|
+
import { S as _e, a as Be, b as Ze, c as Ge, d as Je, e as te, f as Ye } from "./Secret-BDBqq4p3.js";
|
|
18
18
|
import { Input as Ue } from "./ui/Input.js";
|
|
19
|
-
import { c as W } from "./cn-
|
|
20
|
-
import { B as k } from "./Button-
|
|
19
|
+
import { c as W } from "./cn-5-Gd1Dss.js";
|
|
20
|
+
import { B as k } from "./Button-GUVe7pmt.js";
|
|
21
21
|
function We({ error: t }) {
|
|
22
|
-
const
|
|
22
|
+
const a = t instanceof Error ? t.message : "Something went wrong", s = process.env.NODE_ENV === "development", n = t instanceof M ? t.developerHint : void 0, r = t instanceof M ? t.title : "Something went wrong", i = t instanceof Error ? t.stack : void 0, o = t instanceof Error ? t.cause : void 0, d = o instanceof Error ? String(o.stack) : i;
|
|
23
23
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
24
24
|
/* @__PURE__ */ e.jsxs(D, { variant: "destructive", children: [
|
|
25
|
-
/* @__PURE__ */ e.jsx(
|
|
26
|
-
/* @__PURE__ */ e.jsx(
|
|
25
|
+
/* @__PURE__ */ e.jsx(P, { children: r }),
|
|
26
|
+
/* @__PURE__ */ e.jsx(ae, { children: a })
|
|
27
27
|
] }),
|
|
28
|
-
s && n && /* @__PURE__ */ e.jsx(
|
|
28
|
+
s && n && /* @__PURE__ */ e.jsx(be, { className: "mb-4", children: n }),
|
|
29
29
|
s && d && /* @__PURE__ */ e.jsx(
|
|
30
|
-
|
|
30
|
+
Ke,
|
|
31
31
|
{
|
|
32
32
|
className: "max-h-[400px] [&>pre]:p-4",
|
|
33
33
|
language: "js",
|
|
@@ -38,21 +38,21 @@ function We({ error: t }) {
|
|
|
38
38
|
}
|
|
39
39
|
const Xe = ({
|
|
40
40
|
service: t,
|
|
41
|
-
onOpenChange:
|
|
41
|
+
onOpenChange: a
|
|
42
42
|
}) => {
|
|
43
|
-
const s = U(), n =
|
|
43
|
+
const s = U(), n = ce(), r = He(), i = Qe({
|
|
44
44
|
defaultValues: {
|
|
45
45
|
expiresOn: "30"
|
|
46
46
|
}
|
|
47
|
-
}), o =
|
|
47
|
+
}), o = re(), d = q({
|
|
48
48
|
mutationFn: ({ description: c, expiresOn: u }) => {
|
|
49
49
|
if (!t.createKey)
|
|
50
50
|
throw new Error("createKey not implemented");
|
|
51
|
-
const
|
|
51
|
+
const p = u !== "never" ? et(Number(u)) : void 0;
|
|
52
52
|
return t.createKey({
|
|
53
53
|
apiKey: {
|
|
54
54
|
description: c || "Secret Key",
|
|
55
|
-
expiresOn:
|
|
55
|
+
expiresOn: p
|
|
56
56
|
},
|
|
57
57
|
context: s,
|
|
58
58
|
auth: o
|
|
@@ -65,113 +65,113 @@ const Xe = ({
|
|
|
65
65
|
return t.createKey ? /* @__PURE__ */ e.jsxs(
|
|
66
66
|
"form",
|
|
67
67
|
{
|
|
68
|
-
onSubmit:
|
|
68
|
+
onSubmit: i.handleSubmit(
|
|
69
69
|
(c) => d.mutate(
|
|
70
70
|
{ ...c },
|
|
71
71
|
{
|
|
72
|
-
onSuccess: () =>
|
|
72
|
+
onSuccess: () => a(!1)
|
|
73
73
|
}
|
|
74
74
|
)
|
|
75
75
|
),
|
|
76
76
|
children: [
|
|
77
77
|
d.error && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
78
|
-
/* @__PURE__ */ e.jsx(
|
|
79
|
-
/* @__PURE__ */ e.jsx(
|
|
78
|
+
/* @__PURE__ */ e.jsx(P, { children: "Error" }),
|
|
79
|
+
/* @__PURE__ */ e.jsx(ae, { children: d.error.message })
|
|
80
80
|
] }),
|
|
81
81
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
|
|
82
82
|
"Name",
|
|
83
|
-
/* @__PURE__ */ e.jsx(Ue, { ...
|
|
83
|
+
/* @__PURE__ */ e.jsx(Ue, { ...i.register("description") }),
|
|
84
84
|
"Expiration",
|
|
85
85
|
/* @__PURE__ */ e.jsxs(
|
|
86
|
-
|
|
86
|
+
_e,
|
|
87
87
|
{
|
|
88
|
-
onValueChange: (c) =>
|
|
89
|
-
defaultValue:
|
|
88
|
+
onValueChange: (c) => i.setValue("expiresOn", c),
|
|
89
|
+
defaultValue: i.getValues("expiresOn"),
|
|
90
90
|
children: [
|
|
91
|
-
/* @__PURE__ */ e.jsx(
|
|
91
|
+
/* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsx(Ze, {}) }),
|
|
92
92
|
/* @__PURE__ */ e.jsx(Ge, { children: /* @__PURE__ */ e.jsxs(Je, { children: [
|
|
93
|
-
[7, 30, 60, 90].map((c) => /* @__PURE__ */ e.jsxs(
|
|
93
|
+
[7, 30, 60, 90].map((c) => /* @__PURE__ */ e.jsxs(te, { value: String(c), children: [
|
|
94
94
|
c,
|
|
95
95
|
" days"
|
|
96
96
|
] }, c)),
|
|
97
|
-
/* @__PURE__ */ e.jsx(
|
|
97
|
+
/* @__PURE__ */ e.jsx(te, { value: "never", children: "Never" })
|
|
98
98
|
] }) })
|
|
99
99
|
]
|
|
100
100
|
}
|
|
101
101
|
),
|
|
102
|
-
/* @__PURE__ */ e.jsxs(
|
|
103
|
-
/* @__PURE__ */ e.jsx(
|
|
102
|
+
/* @__PURE__ */ e.jsxs(_, { children: [
|
|
103
|
+
/* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(le, { variant: "outline", children: "Cancel" }) }),
|
|
104
104
|
/* @__PURE__ */ e.jsx(Ve, { isPending: d.isPending, children: "Generate Key" })
|
|
105
105
|
] })
|
|
106
106
|
] })
|
|
107
107
|
]
|
|
108
108
|
}
|
|
109
109
|
) : null;
|
|
110
|
-
},
|
|
111
|
-
const
|
|
112
|
-
return
|
|
113
|
-
},
|
|
110
|
+
}, et = (t) => {
|
|
111
|
+
const a = /* @__PURE__ */ new Date();
|
|
112
|
+
return a.setDate(a.getDate() + t), a.toISOString();
|
|
113
|
+
}, de = ({
|
|
114
114
|
service: t,
|
|
115
|
-
isOpen:
|
|
115
|
+
isOpen: a,
|
|
116
116
|
onOpenChange: s,
|
|
117
117
|
trigger: n,
|
|
118
118
|
buttonVariant: r = "outline"
|
|
119
119
|
}) => {
|
|
120
|
-
const
|
|
121
|
-
return /* @__PURE__ */ e.jsxs(
|
|
122
|
-
/* @__PURE__ */ e.jsx(
|
|
120
|
+
const i = /* @__PURE__ */ e.jsx(le, { variant: r, children: "Create API Key" });
|
|
121
|
+
return /* @__PURE__ */ e.jsxs(B, { open: a, onOpenChange: s, children: [
|
|
122
|
+
/* @__PURE__ */ e.jsx(Z, { asChild: !0, children: n ?? i }),
|
|
123
123
|
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
124
124
|
/* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Y, { children: "Create API Key" }) }),
|
|
125
125
|
/* @__PURE__ */ e.jsx(Xe, { service: t, onOpenChange: s })
|
|
126
126
|
] })
|
|
127
127
|
] });
|
|
128
|
-
},
|
|
129
|
-
function
|
|
130
|
-
const
|
|
131
|
-
return
|
|
128
|
+
}, tt = Q({});
|
|
129
|
+
function ue(t) {
|
|
130
|
+
const a = A(null);
|
|
131
|
+
return a.current === null && (a.current = t()), a.current;
|
|
132
132
|
}
|
|
133
|
-
const
|
|
134
|
-
function
|
|
133
|
+
const st = typeof window < "u", nt = st ? Ce : ie, fe = /* @__PURE__ */ Q(null);
|
|
134
|
+
function it(t) {
|
|
135
135
|
return typeof t == "object" && t !== null;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
137
|
+
function rt(t) {
|
|
138
|
+
return it(t) && "offsetHeight" in t;
|
|
139
139
|
}
|
|
140
|
-
const
|
|
140
|
+
const at = Q({
|
|
141
141
|
transformPagePoint: (t) => t,
|
|
142
142
|
isStatic: !1,
|
|
143
143
|
reducedMotion: "never"
|
|
144
144
|
});
|
|
145
|
-
function
|
|
145
|
+
function se(t, a) {
|
|
146
146
|
if (typeof t == "function")
|
|
147
|
-
return t(
|
|
148
|
-
t != null && (t.current =
|
|
147
|
+
return t(a);
|
|
148
|
+
t != null && (t.current = a);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
return (
|
|
150
|
+
function ot(...t) {
|
|
151
|
+
return (a) => {
|
|
152
152
|
let s = !1;
|
|
153
153
|
const n = t.map((r) => {
|
|
154
|
-
const
|
|
155
|
-
return !s && typeof
|
|
154
|
+
const i = se(r, a);
|
|
155
|
+
return !s && typeof i == "function" && (s = !0), i;
|
|
156
156
|
});
|
|
157
157
|
if (s)
|
|
158
158
|
return () => {
|
|
159
159
|
for (let r = 0; r < n.length; r++) {
|
|
160
|
-
const
|
|
161
|
-
typeof
|
|
160
|
+
const i = n[r];
|
|
161
|
+
typeof i == "function" ? i() : se(t[r], null);
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
return
|
|
166
|
+
function lt(...t) {
|
|
167
|
+
return F.useCallback(ot(...t), t);
|
|
168
168
|
}
|
|
169
|
-
class
|
|
170
|
-
getSnapshotBeforeUpdate(
|
|
169
|
+
class ct extends F.Component {
|
|
170
|
+
getSnapshotBeforeUpdate(a) {
|
|
171
171
|
const s = this.props.childRef.current;
|
|
172
|
-
if (s &&
|
|
173
|
-
const n = s.offsetParent, r =
|
|
174
|
-
|
|
172
|
+
if (s && a.isPresent && !this.props.isPresent) {
|
|
173
|
+
const n = s.offsetParent, r = rt(n) && n.offsetWidth || 0, i = this.props.sizeRef.current;
|
|
174
|
+
i.height = s.offsetHeight || 0, i.width = s.offsetWidth || 0, i.top = s.offsetTop, i.left = s.offsetLeft, i.right = r - i.width - i.left;
|
|
175
175
|
}
|
|
176
176
|
return null;
|
|
177
177
|
}
|
|
@@ -184,20 +184,20 @@ class lt extends q.Component {
|
|
|
184
184
|
return this.props.children;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
const r =
|
|
187
|
+
function dt({ children: t, isPresent: a, anchorX: s, root: n }) {
|
|
188
|
+
const r = H(), i = A(null), o = A({
|
|
189
189
|
width: 0,
|
|
190
190
|
height: 0,
|
|
191
191
|
top: 0,
|
|
192
192
|
left: 0,
|
|
193
193
|
right: 0
|
|
194
|
-
}), { nonce: d } = V(
|
|
195
|
-
return
|
|
196
|
-
const { width: u, height:
|
|
197
|
-
if (
|
|
194
|
+
}), { nonce: d } = V(at), c = lt(i, t?.ref);
|
|
195
|
+
return we(() => {
|
|
196
|
+
const { width: u, height: p, top: f, left: m, right: g } = o.current;
|
|
197
|
+
if (a || !i.current || !u || !p)
|
|
198
198
|
return;
|
|
199
199
|
const j = s === "left" ? `left: ${m}` : `right: ${g}`;
|
|
200
|
-
|
|
200
|
+
i.current.dataset.motionPopId = r;
|
|
201
201
|
const l = document.createElement("style");
|
|
202
202
|
d && (l.nonce = d);
|
|
203
203
|
const x = n ?? document.head;
|
|
@@ -205,20 +205,20 @@ function ct({ children: t, isPresent: i, anchorX: s, root: n }) {
|
|
|
205
205
|
[data-motion-pop-id="${r}"] {
|
|
206
206
|
position: absolute !important;
|
|
207
207
|
width: ${u}px !important;
|
|
208
|
-
height: ${
|
|
208
|
+
height: ${p}px !important;
|
|
209
209
|
${j}px !important;
|
|
210
210
|
top: ${f}px !important;
|
|
211
211
|
}
|
|
212
212
|
`), () => {
|
|
213
213
|
x.contains(l) && x.removeChild(l);
|
|
214
214
|
};
|
|
215
|
-
}, [
|
|
215
|
+
}, [a]), e.jsx(ct, { isPresent: a, childRef: i, sizeRef: o, children: F.cloneElement(t, { ref: c }) });
|
|
216
216
|
}
|
|
217
|
-
const
|
|
218
|
-
const u =
|
|
219
|
-
let f = !0, m =
|
|
220
|
-
id:
|
|
221
|
-
initial:
|
|
217
|
+
const ut = ({ children: t, initial: a, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: i, mode: o, anchorX: d, root: c }) => {
|
|
218
|
+
const u = ue(ft), p = H();
|
|
219
|
+
let f = !0, m = L(() => (f = !1, {
|
|
220
|
+
id: p,
|
|
221
|
+
initial: a,
|
|
222
222
|
isPresent: s,
|
|
223
223
|
custom: r,
|
|
224
224
|
onExitComplete: (g) => {
|
|
@@ -230,56 +230,56 @@ const dt = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom:
|
|
|
230
230
|
},
|
|
231
231
|
register: (g) => (u.set(g, !1), () => u.delete(g))
|
|
232
232
|
}), [s, u, n]);
|
|
233
|
-
return
|
|
233
|
+
return i && f && (m = { ...m }), L(() => {
|
|
234
234
|
u.forEach((g, j) => u.set(j, !1));
|
|
235
|
-
}, [s]),
|
|
235
|
+
}, [s]), F.useEffect(() => {
|
|
236
236
|
!s && !u.size && n && n();
|
|
237
|
-
}, [s]), o === "popLayout" && (t = e.jsx(
|
|
237
|
+
}, [s]), o === "popLayout" && (t = e.jsx(dt, { isPresent: s, anchorX: d, root: c, children: t })), e.jsx(fe.Provider, { value: m, children: t });
|
|
238
238
|
};
|
|
239
|
-
function
|
|
239
|
+
function ft() {
|
|
240
240
|
return /* @__PURE__ */ new Map();
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
const
|
|
244
|
-
if (
|
|
242
|
+
function pt(t = !0) {
|
|
243
|
+
const a = V(fe);
|
|
244
|
+
if (a === null)
|
|
245
245
|
return [!0, null];
|
|
246
|
-
const { isPresent: s, onExitComplete: n, register: r } =
|
|
247
|
-
|
|
246
|
+
const { isPresent: s, onExitComplete: n, register: r } = a, i = H();
|
|
247
|
+
ie(() => {
|
|
248
248
|
if (t)
|
|
249
|
-
return r(
|
|
249
|
+
return r(i);
|
|
250
250
|
}, [t]);
|
|
251
|
-
const o =
|
|
251
|
+
const o = ke(() => t && n && n(i), [i, n, t]);
|
|
252
252
|
return !s && n ? [!1, o] : [!0];
|
|
253
253
|
}
|
|
254
|
-
const
|
|
255
|
-
function
|
|
256
|
-
const
|
|
257
|
-
return
|
|
258
|
-
|
|
259
|
-
}),
|
|
254
|
+
const R = (t) => t.key || "";
|
|
255
|
+
function ne(t) {
|
|
256
|
+
const a = [];
|
|
257
|
+
return Ee.forEach(t, (s) => {
|
|
258
|
+
Ie(s) && a.push(s);
|
|
259
|
+
}), a;
|
|
260
260
|
}
|
|
261
|
-
const ht = ({ children: t, custom:
|
|
262
|
-
const [u,
|
|
263
|
-
|
|
261
|
+
const ht = ({ children: t, custom: a, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: i = "sync", propagate: o = !1, anchorX: d = "left", root: c }) => {
|
|
262
|
+
const [u, p] = pt(o), f = L(() => ne(t), [t]), m = o && !u ? [] : f.map(R), g = A(!0), j = A(f), l = ue(() => /* @__PURE__ */ new Map()), [x, v] = I(f), [h, C] = I(f);
|
|
263
|
+
nt(() => {
|
|
264
264
|
g.current = !1, j.current = f;
|
|
265
|
-
for (let w = 0; w <
|
|
266
|
-
const y =
|
|
265
|
+
for (let w = 0; w < h.length; w++) {
|
|
266
|
+
const y = R(h[w]);
|
|
267
267
|
m.includes(y) ? l.delete(y) : l.get(y) !== !0 && l.set(y, !1);
|
|
268
268
|
}
|
|
269
|
-
}, [
|
|
270
|
-
const
|
|
269
|
+
}, [h, m.length, m.join("-")]);
|
|
270
|
+
const K = [];
|
|
271
271
|
if (f !== x) {
|
|
272
272
|
let w = [...f];
|
|
273
|
-
for (let y = 0; y <
|
|
274
|
-
const
|
|
275
|
-
m.includes(
|
|
273
|
+
for (let y = 0; y < h.length; y++) {
|
|
274
|
+
const b = h[y], $ = R(b);
|
|
275
|
+
m.includes($) || (w.splice(y, 0, b), K.push(b));
|
|
276
276
|
}
|
|
277
|
-
return
|
|
277
|
+
return i === "wait" && K.length && (w = K), C(ne(w)), v(f), null;
|
|
278
278
|
}
|
|
279
|
-
process.env.NODE_ENV !== "production" &&
|
|
280
|
-
const { forceRender:
|
|
281
|
-
return e.jsx(e.Fragment, { children:
|
|
282
|
-
const y =
|
|
279
|
+
process.env.NODE_ENV !== "production" && i === "wait" && h.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.`);
|
|
280
|
+
const { forceRender: pe } = V(tt);
|
|
281
|
+
return e.jsx(e.Fragment, { children: h.map((w) => {
|
|
282
|
+
const y = R(w), b = o && !u ? !1 : f === h || m.includes(y), $ = () => {
|
|
283
283
|
if (l.has(y))
|
|
284
284
|
l.set(y, !0);
|
|
285
285
|
else
|
|
@@ -287,26 +287,26 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
287
287
|
let X = !0;
|
|
288
288
|
l.forEach((he) => {
|
|
289
289
|
he || (X = !1);
|
|
290
|
-
}), X && (
|
|
290
|
+
}), X && (pe?.(), C(j.current), o && p?.(), n && n());
|
|
291
291
|
};
|
|
292
|
-
return e.jsx(
|
|
292
|
+
return e.jsx(ut, { isPresent: b, initial: !g.current || s ? void 0 : !1, custom: a, presenceAffectsLayout: r, mode: i, root: c, onExitComplete: b ? void 0 : $, anchorX: d, children: w }, y);
|
|
293
293
|
}) });
|
|
294
|
-
},
|
|
294
|
+
}, mt = ({
|
|
295
295
|
apiKey: t,
|
|
296
|
-
onDeleteKey:
|
|
296
|
+
onDeleteKey: a,
|
|
297
297
|
className: s
|
|
298
298
|
}) => {
|
|
299
|
-
const [n, r] =
|
|
299
|
+
const [n, r] = I(!1), { key: i, createdOn: o, expiresOn: d } = t, c = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
|
|
300
300
|
(new Date(d).getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
|
|
301
|
-
) : 1 / 0,
|
|
301
|
+
) : 1 / 0, p = u <= 7 && !c;
|
|
302
302
|
return /* @__PURE__ */ e.jsxs("div", { className: W("grid col-span-full grid-cols-subgrid p-6", s), children: [
|
|
303
303
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
304
304
|
/* @__PURE__ */ e.jsx(
|
|
305
305
|
Ye,
|
|
306
306
|
{
|
|
307
307
|
className: "max-w-fit w-full",
|
|
308
|
-
secret:
|
|
309
|
-
status: c ? "expired" :
|
|
308
|
+
secret: i,
|
|
309
|
+
status: c ? "expired" : p ? "expiring" : "active",
|
|
310
310
|
revealed: n,
|
|
311
311
|
onReveal: r
|
|
312
312
|
}
|
|
@@ -314,11 +314,11 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
314
314
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
|
|
315
315
|
o && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
316
316
|
"Created ",
|
|
317
|
-
|
|
317
|
+
xt(o),
|
|
318
318
|
"."
|
|
319
319
|
] }),
|
|
320
320
|
" ",
|
|
321
|
-
d &&
|
|
321
|
+
d && p && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
322
322
|
"Expires in ",
|
|
323
323
|
u,
|
|
324
324
|
" ",
|
|
@@ -332,20 +332,20 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
332
332
|
] })
|
|
333
333
|
] })
|
|
334
334
|
] }),
|
|
335
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d &&
|
|
336
|
-
/* @__PURE__ */ e.jsx(
|
|
335
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && a && /* @__PURE__ */ e.jsxs(B, { children: [
|
|
336
|
+
/* @__PURE__ */ e.jsx(Z, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(me, { size: 16 }) }) }),
|
|
337
337
|
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
338
338
|
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
339
339
|
/* @__PURE__ */ e.jsx(Y, { children: "Delete API Key" }),
|
|
340
|
-
/* @__PURE__ */ e.jsx(
|
|
340
|
+
/* @__PURE__ */ e.jsx(oe, { children: "Are you sure you want to delete this API key?" })
|
|
341
341
|
] }),
|
|
342
|
-
/* @__PURE__ */ e.jsxs(
|
|
343
|
-
/* @__PURE__ */ e.jsx(
|
|
344
|
-
/* @__PURE__ */ e.jsx(
|
|
342
|
+
/* @__PURE__ */ e.jsxs(_, { children: [
|
|
343
|
+
/* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
|
|
344
|
+
/* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
345
345
|
k,
|
|
346
346
|
{
|
|
347
347
|
onClick: () => {
|
|
348
|
-
|
|
348
|
+
a();
|
|
349
349
|
},
|
|
350
350
|
children: "Delete"
|
|
351
351
|
}
|
|
@@ -354,23 +354,23 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
354
354
|
] })
|
|
355
355
|
] }) })
|
|
356
356
|
] });
|
|
357
|
-
},
|
|
358
|
-
const
|
|
357
|
+
}, xt = (t) => {
|
|
358
|
+
const a = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((a.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
359
359
|
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");
|
|
360
|
-
},
|
|
360
|
+
}, yt = ({
|
|
361
361
|
consumer: t,
|
|
362
|
-
onUpdate:
|
|
362
|
+
onUpdate: a,
|
|
363
363
|
onRollKey: s,
|
|
364
364
|
onDeleteKey: n
|
|
365
365
|
}) => {
|
|
366
|
-
const [r,
|
|
366
|
+
const [r, i] = I(!1), [o, d] = I(t.label), c = ce(), u = U(), p = q({
|
|
367
367
|
mutationFn: async (l) => {
|
|
368
368
|
if (!s)
|
|
369
369
|
throw new Error("rollKey not implemented");
|
|
370
370
|
return await s?.(l, u);
|
|
371
371
|
},
|
|
372
372
|
onSuccess: () => void c.invalidateQueries({ queryKey: ["api-keys"] })
|
|
373
|
-
}), f =
|
|
373
|
+
}), f = q({
|
|
374
374
|
mutationFn: ({
|
|
375
375
|
consumerId: l,
|
|
376
376
|
keyId: x
|
|
@@ -384,9 +384,9 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
384
384
|
const v = c.getQueryData([
|
|
385
385
|
"api-keys"
|
|
386
386
|
]);
|
|
387
|
-
return c.setQueryData(["api-keys"], (
|
|
387
|
+
return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
|
|
388
388
|
...C,
|
|
389
|
-
apiKeys: C.apiKeys.filter((
|
|
389
|
+
apiKeys: C.apiKeys.filter((K) => K.id !== x)
|
|
390
390
|
} : C)), { previousData: v };
|
|
391
391
|
},
|
|
392
392
|
onError: (l, x, v) => {
|
|
@@ -395,19 +395,19 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
395
395
|
onSuccess: () => {
|
|
396
396
|
c.invalidateQueries({ queryKey: ["api-keys"] });
|
|
397
397
|
}
|
|
398
|
-
}), m =
|
|
398
|
+
}), m = q({
|
|
399
399
|
mutationFn: ({
|
|
400
400
|
consumerId: l,
|
|
401
401
|
label: x
|
|
402
402
|
}) => {
|
|
403
|
-
if (!
|
|
403
|
+
if (!a)
|
|
404
404
|
throw new Error("updateConsumer not implemented");
|
|
405
|
-
return
|
|
405
|
+
return a({ id: l, label: x }, u);
|
|
406
406
|
},
|
|
407
407
|
onMutate: async ({ consumerId: l, label: x }) => {
|
|
408
408
|
await c.cancelQueries({ queryKey: ["api-keys"] });
|
|
409
409
|
const v = c.getQueryData(["api-keys"]);
|
|
410
|
-
return c.setQueryData(["api-keys"], (
|
|
410
|
+
return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
|
|
411
411
|
...C,
|
|
412
412
|
label: x
|
|
413
413
|
} : C)), { previousData: v };
|
|
@@ -419,42 +419,42 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
419
419
|
c.invalidateQueries({ queryKey: ["api-keys"] });
|
|
420
420
|
}
|
|
421
421
|
}), g = () => {
|
|
422
|
-
|
|
422
|
+
i(!0), d(t.label);
|
|
423
423
|
}, j = () => {
|
|
424
424
|
o.trim() && m.mutate({
|
|
425
425
|
label: o.trim(),
|
|
426
426
|
consumerId: t.id
|
|
427
|
-
}),
|
|
427
|
+
}), i(!1);
|
|
428
428
|
};
|
|
429
429
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
430
|
-
|
|
431
|
-
/* @__PURE__ */ e.jsx(
|
|
432
|
-
/* @__PURE__ */ e.jsx(
|
|
430
|
+
p.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
431
|
+
/* @__PURE__ */ e.jsx(z, { size: 16 }),
|
|
432
|
+
/* @__PURE__ */ e.jsx(P, { children: p.error.message })
|
|
433
433
|
] }),
|
|
434
434
|
m.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
435
|
-
/* @__PURE__ */ e.jsx(
|
|
436
|
-
/* @__PURE__ */ e.jsx(
|
|
435
|
+
/* @__PURE__ */ e.jsx(z, { size: 16 }),
|
|
436
|
+
/* @__PURE__ */ e.jsx(P, { children: m.error.message })
|
|
437
437
|
] }),
|
|
438
438
|
f.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
439
|
-
/* @__PURE__ */ e.jsx(
|
|
440
|
-
/* @__PURE__ */ e.jsx(
|
|
439
|
+
/* @__PURE__ */ e.jsx(z, { size: 16 }),
|
|
440
|
+
/* @__PURE__ */ e.jsx(P, { children: f.error.message })
|
|
441
441
|
] }),
|
|
442
442
|
/* @__PURE__ */ e.jsxs(
|
|
443
|
-
|
|
443
|
+
Ae,
|
|
444
444
|
{
|
|
445
445
|
className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
|
|
446
446
|
children: [
|
|
447
|
-
/* @__PURE__ */ e.jsxs(
|
|
447
|
+
/* @__PURE__ */ e.jsxs(Se, { className: "col-span-full flex-row items-start justify-between gap-4", children: [
|
|
448
448
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
449
449
|
r ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
450
450
|
/* @__PURE__ */ e.jsx(
|
|
451
|
-
|
|
451
|
+
Le,
|
|
452
452
|
{
|
|
453
453
|
maxLength: 32,
|
|
454
454
|
value: o,
|
|
455
455
|
onChange: (l) => d(l.target.value),
|
|
456
456
|
onKeyDown: (l) => {
|
|
457
|
-
l.key === "Enter" ? j() : l.key === "Escape" &&
|
|
457
|
+
l.key === "Enter" ? j() : l.key === "Escape" && i(!1);
|
|
458
458
|
},
|
|
459
459
|
autoFocus: !0
|
|
460
460
|
}
|
|
@@ -467,7 +467,7 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
467
467
|
variant: "ghost",
|
|
468
468
|
onClick: j,
|
|
469
469
|
disabled: !o.trim(),
|
|
470
|
-
children: /* @__PURE__ */ e.jsx(
|
|
470
|
+
children: /* @__PURE__ */ e.jsx(xe, { size: 16 })
|
|
471
471
|
}
|
|
472
472
|
),
|
|
473
473
|
/* @__PURE__ */ e.jsx(
|
|
@@ -475,13 +475,13 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
475
475
|
{
|
|
476
476
|
size: "icon",
|
|
477
477
|
variant: "ghost",
|
|
478
|
-
onClick: () =>
|
|
479
|
-
children: /* @__PURE__ */ e.jsx(
|
|
478
|
+
onClick: () => i(!1),
|
|
479
|
+
children: /* @__PURE__ */ e.jsx(ye, { size: 16 })
|
|
480
480
|
}
|
|
481
481
|
)
|
|
482
482
|
] })
|
|
483
|
-
] }) : /* @__PURE__ */ e.jsx(
|
|
484
|
-
/* @__PURE__ */ e.jsxs(
|
|
483
|
+
] }) : /* @__PURE__ */ e.jsx(Re, { children: t.label }),
|
|
484
|
+
/* @__PURE__ */ e.jsxs(Ne, { children: [
|
|
485
485
|
t.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
486
486
|
"Created on ",
|
|
487
487
|
new Date(t.createdOn).toLocaleDateString()
|
|
@@ -493,7 +493,7 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
493
493
|
] })
|
|
494
494
|
] }),
|
|
495
495
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
|
|
496
|
-
|
|
496
|
+
a && /* @__PURE__ */ e.jsxs(
|
|
497
497
|
k,
|
|
498
498
|
{
|
|
499
499
|
variant: "ghost",
|
|
@@ -504,25 +504,25 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
504
504
|
),
|
|
505
505
|
disabled: r,
|
|
506
506
|
children: [
|
|
507
|
-
/* @__PURE__ */ e.jsx(
|
|
507
|
+
/* @__PURE__ */ e.jsx(ge, { size: 16 }),
|
|
508
508
|
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
|
|
509
509
|
]
|
|
510
510
|
}
|
|
511
511
|
),
|
|
512
|
-
s && /* @__PURE__ */ e.jsxs(
|
|
513
|
-
/* @__PURE__ */ e.jsx(
|
|
512
|
+
s && /* @__PURE__ */ e.jsxs(B, { children: [
|
|
513
|
+
/* @__PURE__ */ e.jsx(Z, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
514
514
|
k,
|
|
515
515
|
{
|
|
516
516
|
title: "Roll this key",
|
|
517
517
|
variant: "ghost",
|
|
518
|
-
disabled:
|
|
518
|
+
disabled: p.isPending,
|
|
519
519
|
className: "flex items-center gap-2",
|
|
520
520
|
children: [
|
|
521
521
|
/* @__PURE__ */ e.jsx(
|
|
522
|
-
|
|
522
|
+
je,
|
|
523
523
|
{
|
|
524
524
|
size: 16,
|
|
525
|
-
className:
|
|
525
|
+
className: p.isPending ? "animate-spin" : void 0
|
|
526
526
|
}
|
|
527
527
|
),
|
|
528
528
|
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
|
|
@@ -532,15 +532,15 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
532
532
|
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
533
533
|
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
534
534
|
/* @__PURE__ */ e.jsx(Y, { children: "Roll API Key" }),
|
|
535
|
-
/* @__PURE__ */ e.jsx(
|
|
535
|
+
/* @__PURE__ */ e.jsx(oe, { children: "Are you sure you want to roll this API key?" })
|
|
536
536
|
] }),
|
|
537
|
-
/* @__PURE__ */ e.jsxs(
|
|
538
|
-
/* @__PURE__ */ e.jsx(
|
|
539
|
-
/* @__PURE__ */ e.jsx(
|
|
537
|
+
/* @__PURE__ */ e.jsxs(_, { children: [
|
|
538
|
+
/* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
|
|
539
|
+
/* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
540
540
|
k,
|
|
541
541
|
{
|
|
542
542
|
onClick: () => {
|
|
543
|
-
|
|
543
|
+
p.mutate(t.id);
|
|
544
544
|
},
|
|
545
545
|
children: "Roll Key"
|
|
546
546
|
}
|
|
@@ -550,8 +550,8 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
550
550
|
] })
|
|
551
551
|
] })
|
|
552
552
|
] }),
|
|
553
|
-
/* @__PURE__ */ e.jsx(
|
|
554
|
-
|
|
553
|
+
/* @__PURE__ */ e.jsx(Oe, { className: "p-0 grid grid-cols-subgrid col-span-full divide-y divide-border", children: /* @__PURE__ */ e.jsx(ht, { children: t.apiKeys.map((l) => /* @__PURE__ */ e.jsx(
|
|
554
|
+
mt,
|
|
555
555
|
{
|
|
556
556
|
apiKey: l,
|
|
557
557
|
onDeleteKey: () => {
|
|
@@ -569,14 +569,14 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
569
569
|
t.id
|
|
570
570
|
)
|
|
571
571
|
] });
|
|
572
|
-
},
|
|
573
|
-
const
|
|
572
|
+
}, gt = ({ service: t }) => {
|
|
573
|
+
const a = U(), { data: s } = ze({
|
|
574
574
|
queryFn: async () => {
|
|
575
575
|
try {
|
|
576
|
-
return await t.getConsumers(
|
|
577
|
-
} catch (
|
|
578
|
-
throw new
|
|
579
|
-
cause:
|
|
576
|
+
return await t.getConsumers(a);
|
|
577
|
+
} catch (i) {
|
|
578
|
+
throw i instanceof M ? i : new M("Cannot get API keys", {
|
|
579
|
+
cause: i,
|
|
580
580
|
title: "Error getting API keys",
|
|
581
581
|
developerHint: "Check the response of the API request for more information."
|
|
582
582
|
});
|
|
@@ -584,7 +584,7 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
584
584
|
},
|
|
585
585
|
queryKey: ["api-keys"],
|
|
586
586
|
retry: !1
|
|
587
|
-
}), [n, r] =
|
|
587
|
+
}), [n, r] = I(!1);
|
|
588
588
|
return /* @__PURE__ */ e.jsx("div", { className: "mt-8", children: s.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: [
|
|
589
589
|
/* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
|
|
590
590
|
"You have no API keys yet.",
|
|
@@ -592,82 +592,94 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
592
592
|
t.createKey && "Get started and create your first key."
|
|
593
593
|
] }),
|
|
594
594
|
t.createKey && /* @__PURE__ */ e.jsx(
|
|
595
|
-
|
|
595
|
+
de,
|
|
596
596
|
{
|
|
597
597
|
service: t,
|
|
598
598
|
isOpen: n,
|
|
599
599
|
onOpenChange: r
|
|
600
600
|
}
|
|
601
601
|
)
|
|
602
|
-
] }) : /* @__PURE__ */ e.jsx("ul", { className: W("grid grid-cols-[1fr_min-content] col-span-6"), children: s.map((
|
|
603
|
-
|
|
602
|
+
] }) : /* @__PURE__ */ e.jsx("ul", { className: W("grid grid-cols-[1fr_min-content] col-span-6"), children: s.map((i) => /* @__PURE__ */ e.jsx(
|
|
603
|
+
yt,
|
|
604
604
|
{
|
|
605
|
-
consumer:
|
|
605
|
+
consumer: i,
|
|
606
606
|
onUpdate: t.updateConsumer,
|
|
607
607
|
onRollKey: t.rollKey,
|
|
608
608
|
onDeleteKey: t.deleteKey
|
|
609
609
|
},
|
|
610
|
-
|
|
610
|
+
i.id
|
|
611
611
|
)) }) });
|
|
612
|
-
},
|
|
613
|
-
const [
|
|
612
|
+
}, jt = ({ service: t }) => {
|
|
613
|
+
const [a, s] = I(!1), n = re();
|
|
614
614
|
return /* @__PURE__ */ e.jsxs("div", { className: "max-w-3xl h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
|
|
615
|
-
/* @__PURE__ */ e.jsx(
|
|
615
|
+
/* @__PURE__ */ e.jsx(ee.Target, { name: "api-keys-list-page" }),
|
|
616
616
|
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
|
|
617
617
|
/* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
|
|
618
618
|
t.createKey && /* @__PURE__ */ e.jsx(
|
|
619
|
-
|
|
619
|
+
de,
|
|
620
620
|
{
|
|
621
621
|
service: t,
|
|
622
|
-
isOpen:
|
|
622
|
+
isOpen: a,
|
|
623
623
|
onOpenChange: s
|
|
624
624
|
}
|
|
625
625
|
)
|
|
626
626
|
] }),
|
|
627
627
|
/* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
|
|
628
|
-
/* @__PURE__ */ e.jsx(
|
|
629
|
-
n.profile?.emailVerified === !1 ? /* @__PURE__ */ e.jsxs(
|
|
630
|
-
/* @__PURE__ */ e.jsxs(
|
|
631
|
-
/* @__PURE__ */ e.jsx(
|
|
632
|
-
/* @__PURE__ */ e.jsx(
|
|
628
|
+
/* @__PURE__ */ e.jsx(ee.Target, { name: "api-keys-list-page-before-keys" }),
|
|
629
|
+
n.profile?.emailVerified === !1 ? /* @__PURE__ */ e.jsxs(Te, { variant: "outline", children: [
|
|
630
|
+
/* @__PURE__ */ e.jsxs(qe, { children: [
|
|
631
|
+
/* @__PURE__ */ e.jsx(Me, { children: "Verified email required" }),
|
|
632
|
+
/* @__PURE__ */ e.jsx(Fe, { children: "You need to verify your email to access API keys." })
|
|
633
633
|
] }),
|
|
634
|
-
/* @__PURE__ */ e.jsx(
|
|
634
|
+
/* @__PURE__ */ e.jsx($e, { children: /* @__PURE__ */ e.jsx(De, { onClick: () => n.requestEmailVerification(), children: "Verify email" }) })
|
|
635
635
|
] }) : /* @__PURE__ */ e.jsx(
|
|
636
|
-
|
|
636
|
+
Pe,
|
|
637
637
|
{
|
|
638
638
|
fallbackRender: ({ error: r }) => /* @__PURE__ */ e.jsx(We, { error: r }),
|
|
639
|
-
children: /* @__PURE__ */ e.jsx(
|
|
639
|
+
children: /* @__PURE__ */ e.jsx(gt, { service: t })
|
|
640
640
|
}
|
|
641
641
|
)
|
|
642
642
|
] });
|
|
643
|
-
},
|
|
643
|
+
}, N = "https://api.zuploedge.com/v2/client", vt = async (t) => {
|
|
644
644
|
try {
|
|
645
645
|
return await t.json();
|
|
646
646
|
} catch {
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
649
649
|
}, O = async (t) => {
|
|
650
|
-
const
|
|
651
|
-
if (!t.ok &&
|
|
652
|
-
const s = await
|
|
650
|
+
const a = t.headers.get("content-type");
|
|
651
|
+
if (!t.ok && a?.includes("application/problem+json")) {
|
|
652
|
+
const s = await vt(t);
|
|
653
653
|
if (s.type && s.title)
|
|
654
654
|
throw new Error(s.detail ?? s.title);
|
|
655
655
|
}
|
|
656
|
-
},
|
|
656
|
+
}, T = {
|
|
657
|
+
developerHint: "This project is not linked to a Zuplo deployment. Run `zuplo link` to get started with API Keys.",
|
|
658
|
+
title: "Not linked to a Zuplo deployment"
|
|
659
|
+
}, Ct = ({
|
|
660
|
+
deploymentName: t,
|
|
661
|
+
...a
|
|
662
|
+
}) => ({
|
|
657
663
|
deleteKey: async (s, n, r) => {
|
|
658
|
-
|
|
659
|
-
|
|
664
|
+
E(t, "Cannot delete API key.", T);
|
|
665
|
+
const i = new Request(
|
|
666
|
+
N + `/${t}/consumers/${s}/keys/${n}`,
|
|
660
667
|
{
|
|
661
668
|
method: "DELETE"
|
|
662
669
|
}
|
|
663
|
-
), o = await fetch(await r.signRequest(
|
|
664
|
-
await O(o),
|
|
670
|
+
), o = await fetch(await r.signRequest(i));
|
|
671
|
+
await O(o), E(o.ok, "Failed to delete API key");
|
|
665
672
|
},
|
|
666
673
|
updateConsumer: async (s, n) => {
|
|
674
|
+
E(
|
|
675
|
+
t,
|
|
676
|
+
"Cannot update API key description.",
|
|
677
|
+
T
|
|
678
|
+
);
|
|
667
679
|
const r = await fetch(
|
|
668
680
|
await n.signRequest(
|
|
669
681
|
new Request(
|
|
670
|
-
|
|
682
|
+
`${N}/${t}/consumers/${s.id}`,
|
|
671
683
|
{
|
|
672
684
|
method: "PATCH",
|
|
673
685
|
headers: {
|
|
@@ -680,13 +692,14 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
680
692
|
)
|
|
681
693
|
)
|
|
682
694
|
);
|
|
683
|
-
await O(r),
|
|
695
|
+
await O(r), E(r.ok, "Failed to update API key description");
|
|
684
696
|
},
|
|
685
697
|
rollKey: async (s, n) => {
|
|
698
|
+
E(t, "Cannot roll API key.", T);
|
|
686
699
|
const r = await fetch(
|
|
687
700
|
await n.signRequest(
|
|
688
701
|
new Request(
|
|
689
|
-
|
|
702
|
+
`${N}/${t}/consumers/${s}/roll-key`,
|
|
690
703
|
{
|
|
691
704
|
method: "POST",
|
|
692
705
|
headers: {
|
|
@@ -697,15 +710,16 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
697
710
|
)
|
|
698
711
|
)
|
|
699
712
|
);
|
|
700
|
-
await O(r),
|
|
713
|
+
await O(r), E(r.ok, "Failed to roll API key");
|
|
701
714
|
},
|
|
702
715
|
getConsumers: async (s) => {
|
|
716
|
+
E(t, "Cannot get API keys.", T);
|
|
703
717
|
const n = new Request(
|
|
704
|
-
`${
|
|
718
|
+
`${N}/${t}/consumers`
|
|
705
719
|
);
|
|
706
720
|
await s.signRequest(n);
|
|
707
721
|
const r = await fetch(n);
|
|
708
|
-
return await O(r),
|
|
722
|
+
return await O(r), E(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((o) => ({
|
|
709
723
|
id: o.id,
|
|
710
724
|
createdOn: o.createdOn,
|
|
711
725
|
updatedOn: o.updatedOn,
|
|
@@ -715,17 +729,21 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
715
729
|
key: o.apiKeys.data.at(0)
|
|
716
730
|
}));
|
|
717
731
|
},
|
|
718
|
-
...
|
|
719
|
-
}),
|
|
732
|
+
...a
|
|
733
|
+
}), Lt = (t) => t, Qt = ({
|
|
720
734
|
deploymentName: t,
|
|
721
|
-
|
|
735
|
+
isZuplo: a,
|
|
736
|
+
...s
|
|
722
737
|
}) => {
|
|
723
|
-
|
|
724
|
-
|
|
738
|
+
a && !t && console.warn(
|
|
739
|
+
"This project is not linked to a Zuplo deployment. Run `zuplo link` to get started."
|
|
740
|
+
);
|
|
741
|
+
const n = a ? Ct({ deploymentName: t, ...s }) : s;
|
|
742
|
+
if (!n.getConsumers)
|
|
725
743
|
throw new Error("getConsumers is required when using the apiKeyPlugin");
|
|
726
|
-
const
|
|
727
|
-
...
|
|
728
|
-
getConsumers:
|
|
744
|
+
const r = {
|
|
745
|
+
...n,
|
|
746
|
+
getConsumers: n.getConsumers
|
|
729
747
|
};
|
|
730
748
|
return {
|
|
731
749
|
getProfileMenuItems: () => [
|
|
@@ -733,18 +751,18 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
733
751
|
label: "API Keys",
|
|
734
752
|
path: "/settings/api-keys",
|
|
735
753
|
category: "middle",
|
|
736
|
-
icon:
|
|
754
|
+
icon: ve
|
|
737
755
|
}
|
|
738
756
|
],
|
|
739
|
-
getIdentities: async (
|
|
757
|
+
getIdentities: async (i) => {
|
|
740
758
|
try {
|
|
741
|
-
return (await
|
|
742
|
-
authorizeRequest: (
|
|
759
|
+
return (await r.getConsumers(i)).map((d) => ({
|
|
760
|
+
authorizeRequest: (c) => (c.headers.set(
|
|
743
761
|
"Authorization",
|
|
744
|
-
`Bearer ${
|
|
745
|
-
),
|
|
746
|
-
id:
|
|
747
|
-
label:
|
|
762
|
+
`Bearer ${d.apiKeys.at(0)?.key}`
|
|
763
|
+
), c),
|
|
764
|
+
id: d.id,
|
|
765
|
+
label: d.label
|
|
748
766
|
}));
|
|
749
767
|
} catch {
|
|
750
768
|
return [];
|
|
@@ -753,14 +771,14 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
|
|
|
753
771
|
getRoutes: () => [
|
|
754
772
|
{
|
|
755
773
|
path: "/settings/api-keys",
|
|
756
|
-
element: /* @__PURE__ */ e.jsx(
|
|
774
|
+
element: /* @__PURE__ */ e.jsx(jt, { service: r })
|
|
757
775
|
}
|
|
758
776
|
],
|
|
759
777
|
getProtectedRoutes: () => ["/settings/api-keys"]
|
|
760
778
|
};
|
|
761
779
|
};
|
|
762
780
|
export {
|
|
763
|
-
|
|
764
|
-
|
|
781
|
+
Qt as apiKeyPlugin,
|
|
782
|
+
Lt as createApiKeyService
|
|
765
783
|
};
|
|
766
784
|
//# sourceMappingURL=zudoku.plugin-api-keys.js.map
|