zudoku 0.7.2-dev.1 → 0.7.2-dev.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/cli/cli.js +3 -3
  2. package/dist/cli/cli.js.map +1 -1
  3. package/dist/cli/common/analytics/lib.js +1 -1
  4. package/dist/cli/common/analytics/lib.js.map +1 -1
  5. package/dist/cli/common/outdated.js +11 -20
  6. package/dist/cli/common/outdated.js.map +1 -1
  7. package/dist/cli/common/xdg/lib.d.ts +3 -3
  8. package/dist/cli/common/xdg/lib.js +3 -3
  9. package/dist/cli/common/xdg/lib.js.map +1 -1
  10. package/dist/cli/dev/handler.js +7 -26
  11. package/dist/cli/dev/handler.js.map +1 -1
  12. package/dist/config/validators/InputSidebarSchema.d.ts +0 -9
  13. package/dist/config/validators/InputSidebarSchema.js +0 -2
  14. package/dist/config/validators/InputSidebarSchema.js.map +1 -1
  15. package/dist/config/validators/SidebarSchema.d.ts +3 -9
  16. package/dist/config/validators/SidebarSchema.js +3 -7
  17. package/dist/config/validators/SidebarSchema.js.map +1 -1
  18. package/dist/config/validators/validate.d.ts +0 -115
  19. package/dist/config/validators/validate.js +0 -43
  20. package/dist/config/validators/validate.js.map +1 -1
  21. package/dist/lib/components/navigation/SidebarCategory.js +3 -5
  22. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  23. package/dist/lib/components/navigation/SidebarItem.js +2 -2
  24. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  25. package/dist/lib/ui/Button.d.ts +2 -2
  26. package/dist/vite/config.d.ts +3 -3
  27. package/dist/vite/config.js +22 -23
  28. package/dist/vite/config.js.map +1 -1
  29. package/dist/vite/config.test.js +4 -1
  30. package/dist/vite/config.test.js.map +1 -1
  31. package/dist/vite/dev-server.js +4 -1
  32. package/dist/vite/dev-server.js.map +1 -1
  33. package/dist/vite/plugin-sidebar.js +1 -10
  34. package/dist/vite/plugin-sidebar.js.map +1 -1
  35. package/dist/vite/plugin.js +0 -2
  36. package/dist/vite/plugin.js.map +1 -1
  37. package/dist/vite/prerender.js +0 -7
  38. package/dist/vite/prerender.js.map +1 -1
  39. package/lib/AuthenticationPlugin-DYnkydqa.js +55 -0
  40. package/lib/{AuthenticationPlugin-BMjOjKqE.js.map → AuthenticationPlugin-DYnkydqa.js.map} +1 -1
  41. package/lib/CategoryHeading-w2EW676o.js +10 -0
  42. package/lib/{CategoryHeading-BE8e6QdS.js.map → CategoryHeading-w2EW676o.js.map} +1 -1
  43. package/lib/DeveloperHint-D87KcpDW.js +16 -0
  44. package/lib/{DeveloperHint-Bl9gIdNI.js.map → DeveloperHint-D87KcpDW.js.map} +1 -1
  45. package/lib/ErrorPage-BdHAg3Rg.js +18 -0
  46. package/lib/{ErrorPage-CPR1XVKW.js.map → ErrorPage-BdHAg3Rg.js.map} +1 -1
  47. package/lib/Input-BmwltPfA.js +2214 -0
  48. package/lib/Input-BmwltPfA.js.map +1 -0
  49. package/lib/{Markdown-CCNihH_N.js → Markdown-BZUoEvL7.js} +3354 -3189
  50. package/lib/Markdown-BZUoEvL7.js.map +1 -0
  51. package/lib/MdxPage-E4NFxzHQ.js +183 -0
  52. package/lib/MdxPage-E4NFxzHQ.js.map +1 -0
  53. package/lib/OperationList-DVIuzHN7.js +628 -0
  54. package/lib/OperationList-DVIuzHN7.js.map +1 -0
  55. package/lib/Route-5sI-urRK.js +14 -0
  56. package/lib/{Route-xRJ9mJgH.js.map → Route-5sI-urRK.js.map} +1 -1
  57. package/lib/{SidebarBadge-2JcxswKF.js → SidebarBadge-6EEz-Bwe.js} +47 -47
  58. package/lib/{SidebarBadge-2JcxswKF.js.map → SidebarBadge-6EEz-Bwe.js.map} +1 -1
  59. package/lib/SlotletProvider-CNyl5wU0.js +262 -0
  60. package/lib/SlotletProvider-CNyl5wU0.js.map +1 -0
  61. package/lib/Spinner-B9eFggre.js +15 -0
  62. package/lib/Spinner-B9eFggre.js.map +1 -0
  63. package/lib/{ZudokuContext-JoyeA9dT.js → ZudokuContext-BHNQL3XO.js} +79 -78
  64. package/lib/{ZudokuContext-JoyeA9dT.js.map → ZudokuContext-BHNQL3XO.js.map} +1 -1
  65. package/lib/{_commonjsHelpers-BkfeUUK-.js → _commonjsHelpers-BVfed4GL.js} +3 -3
  66. package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
  67. package/lib/{index-BLvMkqjO.js → index-BGY8VjAV.js} +26 -26
  68. package/lib/{index-BLvMkqjO.js.map → index-BGY8VjAV.js.map} +1 -1
  69. package/lib/{index-G1-TGLO1.js → index-CbJpF8Yf.js} +8 -8
  70. package/lib/{index-G1-TGLO1.js.map → index-CbJpF8Yf.js.map} +1 -1
  71. package/lib/index-ChhUJhLT.js +1771 -0
  72. package/lib/index-ChhUJhLT.js.map +1 -0
  73. package/lib/{index-BF4cn28H.js → index-DdUotMOQ.js} +2196 -1953
  74. package/lib/index-DdUotMOQ.js.map +1 -0
  75. package/lib/jsx-runtime-B6kdoens.js +635 -0
  76. package/lib/jsx-runtime-B6kdoens.js.map +1 -0
  77. package/lib/{router-D2p7Olpn.js → router-BiRCp01d.js} +22 -22
  78. package/lib/{router-D2p7Olpn.js.map → router-BiRCp01d.js.map} +1 -1
  79. package/lib/{slugify-DbLhpSPt.js → slugify-CiPVjteN.js} +2 -2
  80. package/lib/{slugify-DbLhpSPt.js.map → slugify-CiPVjteN.js.map} +1 -1
  81. package/lib/{state-lIwt9isb.js → state-DsXXkBLH.js} +15 -15
  82. package/lib/{state-lIwt9isb.js.map → state-DsXXkBLH.js.map} +1 -1
  83. package/lib/{utils-B8R4grFM.js → utils-BPHLKjns.js} +153 -152
  84. package/lib/{utils-B8R4grFM.js.map → utils-BPHLKjns.js.map} +1 -1
  85. package/lib/zudoku.auth-auth0.js +21 -16
  86. package/lib/zudoku.auth-auth0.js.map +1 -1
  87. package/lib/zudoku.auth-clerk.js +37 -32
  88. package/lib/zudoku.auth-clerk.js.map +1 -1
  89. package/lib/zudoku.auth-openid.js +505 -485
  90. package/lib/zudoku.auth-openid.js.map +1 -1
  91. package/lib/zudoku.components.js +1782 -1574
  92. package/lib/zudoku.components.js.map +1 -1
  93. package/lib/zudoku.openapi-worker.js +2 -2
  94. package/lib/zudoku.plugin-api-keys.js +268 -153
  95. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  96. package/lib/zudoku.plugin-custom-page.js +6 -5
  97. package/lib/zudoku.plugin-custom-page.js.map +1 -1
  98. package/lib/zudoku.plugin-markdown.js +13 -12
  99. package/lib/zudoku.plugin-markdown.js.map +1 -1
  100. package/lib/zudoku.plugin-openapi.js +8 -8
  101. package/lib/zudoku.plugin-redirect.js +3 -3
  102. package/lib/zudoku.plugin-search-inkeep.js +21 -20
  103. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  104. package/package.json +4 -9
  105. package/src/lib/components/navigation/SidebarCategory.tsx +31 -43
  106. package/src/lib/components/navigation/SidebarItem.tsx +1 -2
  107. package/dist/lib/icons.d.ts +0 -1
  108. package/dist/lib/icons.js +0 -2
  109. package/dist/lib/icons.js.map +0 -1
  110. package/dist/vite/plugin-icons.d.ts +0 -3
  111. package/dist/vite/plugin-icons.js +0 -47
  112. package/dist/vite/plugin-icons.js.map +0 -1
  113. package/dist/vite/sitemap.d.ts +0 -19
  114. package/dist/vite/sitemap.js +0 -40
  115. package/dist/vite/sitemap.js.map +0 -1
  116. package/lib/AuthenticationPlugin-BMjOjKqE.js +0 -54
  117. package/lib/CategoryHeading-BE8e6QdS.js +0 -9
  118. package/lib/DeveloperHint-Bl9gIdNI.js +0 -12
  119. package/lib/ErrorPage-CPR1XVKW.js +0 -12
  120. package/lib/Input-BBlyeDuG.js +0 -2192
  121. package/lib/Input-BBlyeDuG.js.map +0 -1
  122. package/lib/Markdown-CCNihH_N.js.map +0 -1
  123. package/lib/MdxPage-BavkYqzi.js +0 -140
  124. package/lib/MdxPage-BavkYqzi.js.map +0 -1
  125. package/lib/OperationList-C6Ps2keZ.js +0 -460
  126. package/lib/OperationList-C6Ps2keZ.js.map +0 -1
  127. package/lib/Route-xRJ9mJgH.js +0 -13
  128. package/lib/SlotletProvider-CuB3Ts8r.js +0 -213
  129. package/lib/SlotletProvider-CuB3Ts8r.js.map +0 -1
  130. package/lib/Spinner-BlxzaFFF.js +0 -6
  131. package/lib/Spinner-BlxzaFFF.js.map +0 -1
  132. package/lib/_commonjsHelpers-BkfeUUK-.js.map +0 -1
  133. package/lib/index-BF4cn28H.js.map +0 -1
  134. package/lib/jsx-runtime-lNnQYwFN.js +0 -2403
  135. package/lib/jsx-runtime-lNnQYwFN.js.map +0 -1
  136. package/lib/zudoku.icons.js +0 -2
  137. package/lib/zudoku.icons.js.map +0 -1
  138. package/src/lib/icons.ts +0 -1
@@ -14,8 +14,8 @@ var vn = (t, e, n, i) => ({
14
14
  }
15
15
  });
16
16
  import { C as Ua, c as Va, m as Ba, f as Ga } from "./urql-YhcsXYy8.js";
17
- import { g as Al } from "./_commonjsHelpers-BkfeUUK-.js";
18
- import { s as xl } from "./slugify-DbLhpSPt.js";
17
+ import { a as Al } from "./_commonjsHelpers-BVfed4GL.js";
18
+ import { s as xl } from "./slugify-CiPVjteN.js";
19
19
  function Fl(t, e) {
20
20
  for (var n = 0; n < e.length; n++) {
21
21
  const i = e[n];
@@ -1,186 +1,301 @@
1
- import { S as u, R as f } from "./SlotletProvider-CuB3Ts8r.js";
2
- import { u as R, a as o, I as g, S as h, b as x, c as v, d as k, e as w, f as d } from "./Input-BBlyeDuG.js";
3
- import { a as b, L as m, O as K } from "./jsx-runtime-lNnQYwFN.js";
4
- import { u as y, a as N, b as I } from "./ZudokuContext-JoyeA9dT.js";
5
- import { B as l, m as S } from "./index-BLvMkqjO.js";
6
- import { D as A } from "./DeveloperHint-Bl9gIdNI.js";
7
- import { RotateCwIcon as C, TrashIcon as P, EyeOffIcon as D, EyeIcon as q, CheckIcon as O, CopyIcon as z } from "lucide-react";
8
- import { useState as p } from "react";
9
- import { a as T } from "./Markdown-CCNihH_N.js";
10
- function i(e, t) {
11
- if (e)
1
+ import { j as e } from "./jsx-runtime-B6kdoens.js";
2
+ import { S as p, R as g } from "./SlotletProvider-CNyl5wU0.js";
3
+ import { u as j, a as u, I as v, S as k, b as w, c as b, d as K, e as N, f as y } from "./Input-BmwltPfA.js";
4
+ import { e as E, L as x, O as A } from "./index-ChhUJhLT.js";
5
+ import { u as m, t as C, j as S } from "./ZudokuContext-BHNQL3XO.js";
6
+ import { B as l, p as I } from "./index-BGY8VjAV.js";
7
+ import { D as P } from "./DeveloperHint-D87KcpDW.js";
8
+ import { useState as h } from "react";
9
+ import { c as d, a as D, C as R, g as q } from "./Markdown-BZUoEvL7.js";
10
+ /**
11
+ * @license lucide-react v0.378.0 - ISC
12
+ *
13
+ * This source code is licensed under the ISC license.
14
+ * See the LICENSE file in the root directory of this source tree.
15
+ */
16
+ const z = d("EyeOff", [
17
+ ["path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24", key: "1jxqfv" }],
18
+ [
19
+ "path",
20
+ {
21
+ d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",
22
+ key: "9wicm4"
23
+ }
24
+ ],
25
+ [
26
+ "path",
27
+ { d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61", key: "1jreej" }
28
+ ],
29
+ ["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }]
30
+ ]);
31
+ /**
32
+ * @license lucide-react v0.378.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */
37
+ const O = d("Eye", [
38
+ ["path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z", key: "rwhkz3" }],
39
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
40
+ ]);
41
+ /**
42
+ * @license lucide-react v0.378.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */
47
+ const M = d("RotateCw", [
48
+ ["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
49
+ ["path", { d: "M21 3v5h-5", key: "1q7to0" }]
50
+ ]);
51
+ /**
52
+ * @license lucide-react v0.378.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */
57
+ const T = d("Trash", [
58
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
59
+ ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
60
+ ["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }]
61
+ ]);
62
+ function c(t, s) {
63
+ if (t)
12
64
  return;
13
- const n = typeof t == "function" ? t() : t;
14
- throw new F(n ?? "Invariant failed");
65
+ const r = typeof s == "function" ? s() : s;
66
+ throw new F(r ?? "Invariant failed");
15
67
  }
16
68
  class F extends Error {
17
- constructor(t) {
18
- super(t), this.name = "ZudokuError";
69
+ constructor(s) {
70
+ super(s), this.name = "ZudokuError";
19
71
  }
20
72
  }
21
- const j = ({ service: e }) => {
22
- const t = y(), n = b(), a = R({
73
+ const L = ({ service: t }) => {
74
+ const s = m(), r = E(), n = j({
23
75
  defaultValues: {
24
76
  expiresOn: "30"
25
77
  }
26
- }), s = o({
27
- mutationFn: ({ description: c, expiresOn: r }) => {
28
- if (!e.createKey)
78
+ }), o = u({
79
+ mutationFn: ({ description: i, expiresOn: a }) => {
80
+ if (!t.createKey)
29
81
  throw new Error("deleteKey not implemented");
30
- const E = r !== "never" ? L(Number(r)) : void 0;
31
- return e.createKey(
32
- { description: c, expiresOn: E },
33
- t
82
+ const f = a !== "never" ? V(Number(a)) : void 0;
83
+ return t.createKey(
84
+ { description: i, expiresOn: f },
85
+ s
34
86
  );
35
87
  },
36
- onSuccess: () => n("/settings/api-keys/")
88
+ onSuccess: () => r("/settings/api-keys/")
37
89
  });
38
- return e.createKey ? /* @__PURE__ */ React.createElement("div", { className: "max-w-screen-lg pt-[--padding-content-top] pb-[--padding-content-bottom]" }, /* @__PURE__ */ React.createElement("div", { className: "flex justify-between mb-4 border-b pb-1" }, /* @__PURE__ */ React.createElement("h1", { className: "font-medium text-2xl" }, "New API Key")), /* @__PURE__ */ React.createElement(
39
- "form",
40
- {
41
- onSubmit: a.handleSubmit((c) => s.mutate(c))
42
- },
43
- /* @__PURE__ */ React.createElement("div", { className: "flex gap-2 flex-col" }, "Note", /* @__PURE__ */ React.createElement(g, { ...a.register("description") }), "Expiration", /* @__PURE__ */ React.createElement(
44
- h,
90
+ return t.createKey ? /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-lg pt-[--padding-content-top] pb-[--padding-content-bottom]", children: [
91
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-between mb-4 border-b pb-1", children: /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "New API Key" }) }),
92
+ /* @__PURE__ */ e.jsx(
93
+ "form",
45
94
  {
46
- onValueChange: (c) => a.setValue("expiresOn", c),
47
- defaultValue: a.getValues("expiresOn")
48
- },
49
- /* @__PURE__ */ React.createElement(x, null, /* @__PURE__ */ React.createElement(v, null)),
50
- /* @__PURE__ */ React.createElement(k, null, /* @__PURE__ */ React.createElement(w, null, [7, 30, 60, 90].map((c) => /* @__PURE__ */ React.createElement(d, { value: String(c), key: c }, c, " days")), /* @__PURE__ */ React.createElement(d, { value: "never" }, "Never")))
51
- ), /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React.createElement(l, null, "Generate Key"), /* @__PURE__ */ React.createElement(l, { variant: "outline", asChild: !0 }, /* @__PURE__ */ React.createElement(m, { to: "/settings/api-keys/" }, "Cancel"))))
52
- )) : null;
53
- }, L = (e) => {
54
- const t = /* @__PURE__ */ new Date();
55
- return t.setDate(t.getDate() + e), t.toISOString();
56
- }, V = () => {
57
- const e = S();
58
- return e.isAuthEnabled && e.isPending ? null : e.isAuthenticated ? /* @__PURE__ */ React.createElement(K, null) : e.isAuthEnabled ? /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2" }, "Please login first to view this page", /* @__PURE__ */ React.createElement(l, { onClick: () => e.login() }, "Login")) : /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2" }, /* @__PURE__ */ React.createElement(A, { className: "max-w-[600px]" }, "Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ", /* @__PURE__ */ React.createElement("code", null, "authentication"), "."));
59
- }, M = ({ service: e }) => {
60
- const t = y(), n = N(), { data: a } = I({
61
- queryFn: () => e.getKeys(t),
95
+ onSubmit: n.handleSubmit((i) => o.mutate(i)),
96
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col", children: [
97
+ "Note",
98
+ /* @__PURE__ */ e.jsx(v, { ...n.register("description") }),
99
+ "Expiration",
100
+ /* @__PURE__ */ e.jsxs(
101
+ k,
102
+ {
103
+ onValueChange: (i) => n.setValue("expiresOn", i),
104
+ defaultValue: n.getValues("expiresOn"),
105
+ children: [
106
+ /* @__PURE__ */ e.jsx(w, { children: /* @__PURE__ */ e.jsx(b, {}) }),
107
+ /* @__PURE__ */ e.jsx(K, { children: /* @__PURE__ */ e.jsxs(N, { children: [
108
+ [7, 30, 60, 90].map((i) => /* @__PURE__ */ e.jsxs(y, { value: String(i), children: [
109
+ i,
110
+ " days"
111
+ ] }, i)),
112
+ /* @__PURE__ */ e.jsx(y, { value: "never", children: "Never" })
113
+ ] }) })
114
+ ]
115
+ }
116
+ ),
117
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
118
+ /* @__PURE__ */ e.jsx(l, { children: "Generate Key" }),
119
+ /* @__PURE__ */ e.jsx(l, { variant: "outline", asChild: !0, children: /* @__PURE__ */ e.jsx(x, { to: "/settings/api-keys/", children: "Cancel" }) })
120
+ ] })
121
+ ] })
122
+ }
123
+ )
124
+ ] }) : null;
125
+ }, V = (t) => {
126
+ const s = /* @__PURE__ */ new Date();
127
+ return s.setDate(s.getDate() + t), s.toISOString();
128
+ }, Z = () => {
129
+ const t = I();
130
+ return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(A, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
131
+ "Please login first to view this page",
132
+ /* @__PURE__ */ e.jsx(l, { onClick: () => t.login(), children: "Login" })
133
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(P, { className: "max-w-[600px]", children: [
134
+ "Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ",
135
+ /* @__PURE__ */ e.jsx("code", { children: "authentication" }),
136
+ "."
137
+ ] }) });
138
+ }, _ = ({ service: t }) => {
139
+ const s = m(), r = C(), { data: n } = S({
140
+ queryFn: () => t.getKeys(s),
62
141
  queryKey: ["api-keys"],
63
142
  retry: !1
64
- }), s = o({
65
- mutationFn: (r) => {
66
- if (!e.deleteKey)
143
+ }), o = u({
144
+ mutationFn: (a) => {
145
+ if (!t.deleteKey)
67
146
  throw new Error("deleteKey not implemented");
68
- return e.deleteKey(r, t);
147
+ return t.deleteKey(a, s);
69
148
  },
70
149
  onSuccess: () => {
71
- n.invalidateQueries({ queryKey: ["api-keys"] });
150
+ r.invalidateQueries({ queryKey: ["api-keys"] });
72
151
  }
73
- }), c = o({
74
- mutationFn: (r) => {
75
- if (!e.rollKey)
152
+ }), i = u({
153
+ mutationFn: (a) => {
154
+ if (!t.rollKey)
76
155
  throw new Error("rollKey not implemented");
77
- return e.rollKey(r, t);
156
+ return t.rollKey(a, s);
78
157
  },
79
- onSuccess: () => n.invalidateQueries({ queryKey: ["api-keys"] })
158
+ onSuccess: () => r.invalidateQueries({ queryKey: ["api-keys"] })
80
159
  });
81
- return /* @__PURE__ */ React.createElement("div", { className: "max-w-screen-lg h-full pt-[--padding-content-top] pb-[--padding-content-bottom]" }, /* @__PURE__ */ React.createElement(u, { name: "api-keys-list-page" }), /* @__PURE__ */ React.createElement("div", { className: "flex justify-between mb-4 border-b pb-3" }, /* @__PURE__ */ React.createElement("h1", { className: "font-medium text-2xl" }, "API Keys"), e.createKey && /* @__PURE__ */ React.createElement(l, { asChild: !0 }, /* @__PURE__ */ React.createElement(m, { to: "/settings/api-keys/new" }, "Create API Key"))), /* @__PURE__ */ React.createElement(u, { name: "api-keys-list-page-before-keys" }), a.length === 0 ? /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center gap-4 items-center p-8 border rounded bg-muted/30 text-muted-foreground" }, /* @__PURE__ */ React.createElement("p", { className: "text-center" }, "No API keys created yet.", /* @__PURE__ */ React.createElement("br", null), "Get started and create your first key."), e.createKey && /* @__PURE__ */ React.createElement(l, { asChild: !0, variant: "outline" }, /* @__PURE__ */ React.createElement(m, { to: "/settings/api-keys/new" }, "Create API Key"))) : /* @__PURE__ */ React.createElement(
82
- "ul",
83
- {
84
- className: T(
85
- "grid grid-cols-1 rounded border divide-y divide-border",
86
- "lg:grid-cols-[minmax(250px,min-content)_1fr_min-content]"
87
- )
88
- },
89
- a.map((r) => /* @__PURE__ */ React.createElement(
90
- "li",
160
+ return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-lg h-full pt-[--padding-content-top] pb-[--padding-content-bottom]", children: [
161
+ /* @__PURE__ */ e.jsx(p, { name: "api-keys-list-page" }),
162
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between mb-4 border-b pb-3", children: [
163
+ /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
164
+ t.createKey && /* @__PURE__ */ e.jsx(l, { asChild: !0, children: /* @__PURE__ */ e.jsx(x, { to: "/settings/api-keys/new", children: "Create API Key" }) })
165
+ ] }),
166
+ /* @__PURE__ */ e.jsx(p, { name: "api-keys-list-page-before-keys" }),
167
+ n.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-4 items-center p-8 border rounded bg-muted/30 text-muted-foreground", children: [
168
+ /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
169
+ "No API keys created yet.",
170
+ /* @__PURE__ */ e.jsx("br", {}),
171
+ "Get started and create your first key."
172
+ ] }),
173
+ t.createKey && /* @__PURE__ */ e.jsx(l, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx(x, { to: "/settings/api-keys/new", children: "Create API Key" }) })
174
+ ] }) : /* @__PURE__ */ e.jsx(
175
+ "ul",
91
176
  {
92
- className: "p-5 grid grid-cols-subgrid col-span-full gap-2 items-center",
93
- key: r.id
94
- },
95
- /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-1 text-sm" }, r.description ?? r.id, /* @__PURE__ */ React.createElement("div", { className: "text-muted-foreground text-xs" }, r.createdOn && /* @__PURE__ */ React.createElement("div", null, "Created on ", new Date(r.createdOn).toLocaleDateString()), r.expiresOn && /* @__PURE__ */ React.createElement("div", null, "Expires on ", new Date(r.expiresOn).toLocaleDateString()))),
96
- /* @__PURE__ */ React.createElement("div", { className: "items-center flex lg:justify-center" }, /* @__PURE__ */ React.createElement(_, { apiKey: r.key })),
97
- /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, e.rollKey && /* @__PURE__ */ React.createElement(
98
- l,
99
- {
100
- size: "icon",
101
- title: "Roll this key",
102
- variant: "ghost",
103
- onClick: () => {
104
- confirm("Do you want to roll this key?") && c.mutate(r.id);
105
- }
106
- },
107
- /* @__PURE__ */ React.createElement(C, { size: 16 })
108
- ), e.deleteKey && /* @__PURE__ */ React.createElement(
109
- l,
110
- {
111
- variant: "ghost",
112
- size: "icon",
113
- onClick: () => {
114
- confirm("Do you want to delete this key?") && s.mutate(r.id);
177
+ className: D(
178
+ "grid grid-cols-1 rounded border divide-y divide-border",
179
+ "lg:grid-cols-[minmax(250px,min-content)_1fr_min-content]"
180
+ ),
181
+ children: n.map((a) => /* @__PURE__ */ e.jsxs(
182
+ "li",
183
+ {
184
+ className: "p-5 grid grid-cols-subgrid col-span-full gap-2 items-center",
185
+ children: [
186
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1 text-sm", children: [
187
+ a.description ?? a.id,
188
+ /* @__PURE__ */ e.jsxs("div", { className: "text-muted-foreground text-xs", children: [
189
+ a.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
190
+ "Created on ",
191
+ new Date(a.createdOn).toLocaleDateString()
192
+ ] }),
193
+ a.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
194
+ "Expires on ",
195
+ new Date(a.expiresOn).toLocaleDateString()
196
+ ] })
197
+ ] })
198
+ ] }),
199
+ /* @__PURE__ */ e.jsx("div", { className: "items-center flex lg:justify-center", children: /* @__PURE__ */ e.jsx(Q, { apiKey: a.key }) }),
200
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
201
+ t.rollKey && /* @__PURE__ */ e.jsx(
202
+ l,
203
+ {
204
+ size: "icon",
205
+ title: "Roll this key",
206
+ variant: "ghost",
207
+ onClick: () => {
208
+ confirm("Do you want to roll this key?") && i.mutate(a.id);
209
+ },
210
+ children: /* @__PURE__ */ e.jsx(M, { size: 16 })
211
+ }
212
+ ),
213
+ t.deleteKey && /* @__PURE__ */ e.jsx(
214
+ l,
215
+ {
216
+ variant: "ghost",
217
+ size: "icon",
218
+ onClick: () => {
219
+ confirm("Do you want to delete this key?") && o.mutate(a.id);
220
+ },
221
+ disabled: o.isPending,
222
+ children: /* @__PURE__ */ e.jsx(T, { size: 16 })
223
+ }
224
+ )
225
+ ] })
226
+ ]
115
227
  },
116
- disabled: s.isPending
228
+ a.id
229
+ ))
230
+ }
231
+ )
232
+ ] });
233
+ }, Q = ({ apiKey: t }) => {
234
+ const [s, r] = h(!1), [n, o] = h(!1);
235
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center text-sm", children: [
236
+ /* @__PURE__ */ e.jsx("div", { className: "border rounded bg-gray-100 dark:bg-gray-950 p-1 font-mono truncate h-9 items-center flex px-2", children: s ? t : "•".repeat(t.length) }),
237
+ /* @__PURE__ */ e.jsx(
238
+ l,
239
+ {
240
+ variant: "outline",
241
+ onClick: () => r((i) => !i),
242
+ size: "icon",
243
+ children: s ? /* @__PURE__ */ e.jsx(z, { size: 16 }) : /* @__PURE__ */ e.jsx(O, { size: 16 })
244
+ }
245
+ ),
246
+ /* @__PURE__ */ e.jsx(
247
+ l,
248
+ {
249
+ variant: "outline",
250
+ onClick: () => {
251
+ navigator.clipboard.writeText(t).then(() => {
252
+ o(!0), setTimeout(() => o(!1), 2e3);
253
+ });
117
254
  },
118
- /* @__PURE__ */ React.createElement(P, { size: 16 })
119
- ))
120
- ))
121
- ));
122
- }, _ = ({ apiKey: e }) => {
123
- const [t, n] = p(!1), [a, s] = p(!1);
124
- return /* @__PURE__ */ React.createElement("div", { className: "flex gap-2 items-center text-sm" }, /* @__PURE__ */ React.createElement("div", { className: "border rounded bg-gray-100 dark:bg-gray-950 p-1 font-mono truncate h-9 items-center flex px-2" }, t ? e : "•".repeat(e.length)), /* @__PURE__ */ React.createElement(
125
- l,
126
- {
127
- variant: "outline",
128
- onClick: () => n((c) => !c),
129
- size: "icon"
130
- },
131
- t ? /* @__PURE__ */ React.createElement(D, { size: 16 }) : /* @__PURE__ */ React.createElement(q, { size: 16 })
132
- ), /* @__PURE__ */ React.createElement(
133
- l,
134
- {
135
- variant: "outline",
136
- onClick: () => {
137
- navigator.clipboard.writeText(e).then(() => {
138
- s(!0), setTimeout(() => s(!1), 2e3);
139
- });
140
- },
141
- size: "icon"
142
- },
143
- a ? /* @__PURE__ */ React.createElement(O, { size: 16 }) : /* @__PURE__ */ React.createElement(z, { size: 16 })
144
- ));
145
- }, Q = "https://zudoku-rewiringamerica-main-ef9c9c0.d2.zuplo.dev", Z = (e) => ({
146
- deleteKey: async (t, n) => {
147
- const a = new Request(e + `/v1/developer/api-keys/${t}`, {
255
+ size: "icon",
256
+ children: n ? /* @__PURE__ */ e.jsx(R, { size: 16 }) : /* @__PURE__ */ e.jsx(q, { size: 16 })
257
+ }
258
+ )
259
+ ] });
260
+ }, B = "https://zudoku-rewiringamerica-main-ef9c9c0.d2.zuplo.dev", G = (t) => ({
261
+ deleteKey: async (s, r) => {
262
+ const n = new Request(t + `/v1/developer/api-keys/${s}`, {
148
263
  method: "DELETE"
149
264
  });
150
- await n.signRequest(a);
151
- const s = await fetch(a);
152
- i(s.ok, "Failed to delete API key");
265
+ await r.signRequest(n);
266
+ const o = await fetch(n);
267
+ c(o.ok, "Failed to delete API key");
153
268
  },
154
- rollKey: async (t, n) => {
155
- const a = await fetch(
156
- await n.signRequest(
157
- new Request(e + `/v1/developer/api-keys/${t}/key`, {
269
+ rollKey: async (s, r) => {
270
+ const n = await fetch(
271
+ await r.signRequest(
272
+ new Request(t + `/v1/developer/api-keys/${s}/key`, {
158
273
  method: "DELETE"
159
274
  })
160
275
  )
161
276
  );
162
- i(a.ok, "Failed to delete API key");
277
+ c(n.ok, "Failed to delete API key");
163
278
  },
164
- createKey: async (t, n) => {
165
- const a = new Request(e + "/v1/developer/api-keys", {
279
+ createKey: async (s, r) => {
280
+ const n = new Request(t + "/v1/developer/api-keys", {
166
281
  method: "POST",
167
282
  headers: {
168
283
  "Content-Type": "application/json"
169
284
  },
170
- body: JSON.stringify(t)
285
+ body: JSON.stringify(s)
171
286
  });
172
- await n.signRequest(a);
173
- const s = await fetch(a);
174
- i(s.ok, "Failed to create API key");
287
+ await r.signRequest(n);
288
+ const o = await fetch(n);
289
+ c(o.ok, "Failed to create API key");
175
290
  },
176
- getKeys: async (t) => {
177
- const n = new Request(e + "/v1/developer/api-keys");
178
- await t.signRequest(n);
179
- const a = await fetch(n);
180
- return i(a.ok, "Failed to fetch API keys"), await a.json();
291
+ getKeys: async (s) => {
292
+ const r = new Request(t + "/v1/developer/api-keys");
293
+ await s.signRequest(r);
294
+ const n = await fetch(r);
295
+ return c(n.ok, "Failed to fetch API keys"), await n.json();
181
296
  }
182
- }), ee = (e) => {
183
- const t = "endpoint" in e ? e.endpoint : Q, n = "getKeys" in e ? e : Z(t);
297
+ }), se = (t) => {
298
+ const s = "endpoint" in t ? t.endpoint : B, r = "getKeys" in t ? t : G(s);
184
299
  return {
185
300
  getProfileMenuItems: () => [
186
301
  {
@@ -188,12 +303,12 @@ const j = ({ service: e }) => {
188
303
  path: "/settings/api-keys"
189
304
  }
190
305
  ],
191
- getIdentities: async (a) => {
306
+ getIdentities: async (n) => {
192
307
  try {
193
- return (await n.getKeys(a)).map((c) => ({
194
- authorizeRequest: (r) => (r.headers.set("Authorization", `Bearer ${c.key}`), r),
195
- id: c.id,
196
- label: c.description ?? c.id
308
+ return (await r.getKeys(n)).map((i) => ({
309
+ authorizeRequest: (a) => (a.headers.set("Authorization", `Bearer ${i.key}`), a),
310
+ id: i.id,
311
+ label: i.description ?? i.id
197
312
  }));
198
313
  } catch {
199
314
  return [];
@@ -201,16 +316,16 @@ const j = ({ service: e }) => {
201
316
  },
202
317
  getRoutes: () => [
203
318
  {
204
- element: /* @__PURE__ */ React.createElement(V, null),
205
- errorElement: /* @__PURE__ */ React.createElement(f, null),
319
+ element: /* @__PURE__ */ e.jsx(Z, {}),
320
+ errorElement: /* @__PURE__ */ e.jsx(g, {}),
206
321
  children: [
207
322
  {
208
323
  path: "/settings/api-keys",
209
- element: /* @__PURE__ */ React.createElement(M, { service: n })
324
+ element: /* @__PURE__ */ e.jsx(_, { service: r })
210
325
  },
211
326
  {
212
327
  path: "/settings/api-keys/new",
213
- element: /* @__PURE__ */ React.createElement(j, { service: n })
328
+ element: /* @__PURE__ */ e.jsx(L, { service: r })
214
329
  }
215
330
  ]
216
331
  }
@@ -218,6 +333,6 @@ const j = ({ service: e }) => {
218
333
  };
219
334
  };
220
335
  export {
221
- ee as apiKeyPlugin
336
+ se as apiKeyPlugin
222
337
  };
223
338
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map