@mdxui/do 2.1.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -323
- package/dist/{agents-xcIn2dUB.d.ts → agents-2_r9e9i7.d.ts} +213 -2
- package/dist/app/index.d.ts +347 -0
- package/dist/app/index.js +14 -0
- package/dist/app/index.js.map +1 -0
- package/dist/breadcrumbs-C9Qn3S7d.d.ts +81 -0
- package/dist/capnweb-client-Bq78FtEA.d.ts +229 -0
- package/dist/chunk-3XKYQRXY.js +192 -0
- package/dist/chunk-3XKYQRXY.js.map +1 -0
- package/dist/chunk-4KXVN3EQ.js +56 -0
- package/dist/chunk-4KXVN3EQ.js.map +1 -0
- package/dist/chunk-5SHZZC7L.js +234 -0
- package/dist/chunk-5SHZZC7L.js.map +1 -0
- package/dist/chunk-7UFINK3Q.js +1994 -0
- package/dist/chunk-7UFINK3Q.js.map +1 -0
- package/dist/chunk-JJLAES6W.js +76 -0
- package/dist/chunk-JJLAES6W.js.map +1 -0
- package/dist/chunk-KT52UU3U.js +985 -0
- package/dist/chunk-KT52UU3U.js.map +1 -0
- package/dist/chunk-LJIWB7KE.js +95 -0
- package/dist/chunk-LJIWB7KE.js.map +1 -0
- package/dist/chunk-NA652ART.js +596 -0
- package/dist/chunk-NA652ART.js.map +1 -0
- package/dist/chunk-OVLO7UOH.js +1071 -0
- package/dist/chunk-OVLO7UOH.js.map +1 -0
- package/dist/chunk-VRLUXCLD.js +31 -0
- package/dist/chunk-VRLUXCLD.js.map +1 -0
- package/dist/chunk-WMNT4OIE.js +249 -0
- package/dist/chunk-WMNT4OIE.js.map +1 -0
- package/dist/chunk-Y52IEYVM.js +131 -0
- package/dist/chunk-Y52IEYVM.js.map +1 -0
- package/dist/components/index.d.ts +14 -732
- package/dist/components/index.js +3 -6
- package/dist/config-CxvpD8Y6.d.ts +111 -0
- package/dist/{do-CaQVueZw.d.ts → do-D27i5bU0.d.ts} +32 -33
- package/dist/errors-DratdVIz.d.ts +346 -0
- package/dist/hooks/index.d.ts +450 -691
- package/dist/hooks/index.js +6 -4
- package/dist/hooks/things/index.d.ts +298 -0
- package/dist/hooks/things/index.js +8 -0
- package/dist/hooks/things/index.js.map +1 -0
- package/dist/index.d.ts +62 -989
- package/dist/index.js +12 -839
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +798 -0
- package/dist/lib/index.js +6 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/providers/index.d.ts +130 -34
- package/dist/providers/index.js +3 -2
- package/dist/query-keys-CZNFikIi.d.ts +153 -0
- package/dist/schemas/index.d.ts +5 -5
- package/dist/schemas/index.js +2 -2
- package/dist/schemas/index.js.map +1 -1
- package/dist/{thing-DtI25yZh.d.ts → thing-BF25aUtJ.d.ts} +72 -72
- package/dist/types/index.d.ts +693 -658
- package/dist/types/index.js +1 -2
- package/dist/views/index.d.ts +131 -0
- package/dist/views/index.js +11 -0
- package/dist/views/index.js.map +1 -0
- package/package.json +39 -17
- package/dist/__test-utils__/index.d.ts +0 -399
- package/dist/__test-utils__/index.js +0 -34641
- package/dist/__test-utils__/index.js.map +0 -1
- package/dist/chunk-EEDMN7UF.js +0 -1351
- package/dist/chunk-EEDMN7UF.js.map +0 -1
- package/dist/chunk-G3PMV62Z.js +0 -33
- package/dist/chunk-G3PMV62Z.js.map +0 -1
- package/dist/chunk-NXPXL5NA.js +0 -3789
- package/dist/chunk-NXPXL5NA.js.map +0 -1
- package/dist/chunk-PC5FJY6M.js +0 -20
- package/dist/chunk-PC5FJY6M.js.map +0 -1
- package/dist/chunk-XF6LKY2M.js +0 -445
- package/dist/chunk-XF6LKY2M.js.map +0 -1
- package/dist/magic-string.es-J7BYFTTJ.js +0 -1307
- package/dist/magic-string.es-J7BYFTTJ.js.map +0 -1
|
@@ -0,0 +1,985 @@
|
|
|
1
|
+
import { DataGridView, DocumentEditorView, FunctionEditorView, DataBrowserView } from './chunk-7UFINK3Q.js';
|
|
2
|
+
import { useBreadcrumbs, useNamespaces, useTypes } from './chunk-NA652ART.js';
|
|
3
|
+
import { useThings } from './chunk-5SHZZC7L.js';
|
|
4
|
+
import { useDO, useEndpoint, DOProvider, useDOState } from './chunk-WMNT4OIE.js';
|
|
5
|
+
import { Breadcrumbs, EndpointSelector } from './chunk-3XKYQRXY.js';
|
|
6
|
+
import { createWebRouter, WebOutlet } from '@mdxui/navigation/web';
|
|
7
|
+
import { useRouterState, Link, useParams, useNavigate, RouterProvider } from '@tanstack/react-router';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { createContext, useMemo, useContext, useState, useEffect } from 'react';
|
|
10
|
+
import { useAuth, AuthKitProvider } from '@workos-inc/authkit-react';
|
|
11
|
+
import { ThemeProvider } from 'next-themes';
|
|
12
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
import { WorkOsWidgets } from '@workos-inc/widgets';
|
|
14
|
+
import { DropdownMenu, DropdownMenuTrigger, SidebarMenuButton, Avatar, AvatarImage, AvatarFallback, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuItem, Sidebar, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarFooter, SidebarProvider, SidebarInset, SidebarTrigger, Separator, Toaster, Card, CardHeader, CardTitle, CardDescription, CardContent } from '@mdxui/primitives';
|
|
15
|
+
import { ChevronsUpDown, User, Settings, LogOut, Database, Shapes, Activity, Network, Code, Users, CreditCard, Building, Construction, Home, Bot, GitBranch, BookOpen, Zap, Play, Plug, Shield, UserCog, Key } from 'lucide-react';
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
|
|
18
|
+
var DOConfigContext = createContext(null);
|
|
19
|
+
var defaultIdentity = {
|
|
20
|
+
clientId: "",
|
|
21
|
+
devMode: false,
|
|
22
|
+
required: true,
|
|
23
|
+
onUnauthenticated: "landing"
|
|
24
|
+
};
|
|
25
|
+
var defaultConfig = {
|
|
26
|
+
basePath: "/",
|
|
27
|
+
defaultNamespace: "default",
|
|
28
|
+
branding: { name: "DO Admin" },
|
|
29
|
+
theme: { mode: "system" },
|
|
30
|
+
routes: {},
|
|
31
|
+
customRoutes: []
|
|
32
|
+
};
|
|
33
|
+
function DOConfigProvider({ config, children }) {
|
|
34
|
+
const value = useMemo(() => {
|
|
35
|
+
const mergedConfig = {
|
|
36
|
+
...defaultConfig,
|
|
37
|
+
...config,
|
|
38
|
+
branding: { ...defaultConfig.branding, ...config.branding },
|
|
39
|
+
theme: { ...defaultConfig.theme, ...config.theme },
|
|
40
|
+
identity: { ...defaultIdentity, ...config.identity }
|
|
41
|
+
};
|
|
42
|
+
return { config: mergedConfig };
|
|
43
|
+
}, [config]);
|
|
44
|
+
return /* @__PURE__ */ jsx(DOConfigContext.Provider, { value, children });
|
|
45
|
+
}
|
|
46
|
+
function useDOConfig() {
|
|
47
|
+
const context = useContext(DOConfigContext);
|
|
48
|
+
if (!context) {
|
|
49
|
+
throw new Error("useDOConfig must be used within a DOConfigProvider");
|
|
50
|
+
}
|
|
51
|
+
return context;
|
|
52
|
+
}
|
|
53
|
+
function useDORoutes() {
|
|
54
|
+
const { config } = useDOConfig();
|
|
55
|
+
return config.routes ?? {};
|
|
56
|
+
}
|
|
57
|
+
function useDOCustomRoutes() {
|
|
58
|
+
const { config } = useDOConfig();
|
|
59
|
+
return config.customRoutes ?? [];
|
|
60
|
+
}
|
|
61
|
+
var useIdentity = useAuth;
|
|
62
|
+
function IdentityWidgetsWrapper({ children }) {
|
|
63
|
+
const [mounted, setMounted] = useState(false);
|
|
64
|
+
const [isDark, setIsDark] = useState(false);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
setMounted(true);
|
|
67
|
+
const checkDarkMode = () => {
|
|
68
|
+
const isDarkClass = document.documentElement.classList.contains("dark");
|
|
69
|
+
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
70
|
+
setIsDark(isDarkClass || !document.documentElement.classList.contains("light") && prefersDark);
|
|
71
|
+
};
|
|
72
|
+
checkDarkMode();
|
|
73
|
+
const observer = new MutationObserver(checkDarkMode);
|
|
74
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
|
|
75
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
76
|
+
mediaQuery.addEventListener("change", checkDarkMode);
|
|
77
|
+
return () => {
|
|
78
|
+
observer.disconnect();
|
|
79
|
+
mediaQuery.removeEventListener("change", checkDarkMode);
|
|
80
|
+
};
|
|
81
|
+
}, []);
|
|
82
|
+
const appearance = mounted ? isDark ? "dark" : "light" : "inherit";
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
WorkOsWidgets,
|
|
85
|
+
{
|
|
86
|
+
theme: {
|
|
87
|
+
appearance,
|
|
88
|
+
radius: "medium",
|
|
89
|
+
scaling: "100%"
|
|
90
|
+
},
|
|
91
|
+
elements: {
|
|
92
|
+
primaryButton: {
|
|
93
|
+
variant: "solid"
|
|
94
|
+
},
|
|
95
|
+
secondaryButton: {
|
|
96
|
+
variant: "outline"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
children
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function DOIdentityProvider({ children }) {
|
|
104
|
+
const { config } = useDOConfig();
|
|
105
|
+
const { identity } = config;
|
|
106
|
+
const redirectUri = identity.redirectUri ?? (typeof window !== "undefined" ? `${window.location.origin}${config.basePath ?? "/"}` : void 0);
|
|
107
|
+
const onRedirectCallback = () => {
|
|
108
|
+
if (typeof window !== "undefined") {
|
|
109
|
+
const url = new URL(window.location.href);
|
|
110
|
+
url.searchParams.delete("code");
|
|
111
|
+
url.searchParams.delete("state");
|
|
112
|
+
window.history.replaceState({}, "", url.pathname);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
return /* @__PURE__ */ jsx(
|
|
116
|
+
AuthKitProvider,
|
|
117
|
+
{
|
|
118
|
+
clientId: identity.clientId,
|
|
119
|
+
apiHostname: identity.apiHostname,
|
|
120
|
+
devMode: identity.devMode,
|
|
121
|
+
redirectUri,
|
|
122
|
+
onRedirectCallback,
|
|
123
|
+
children: /* @__PURE__ */ jsx(IdentityWidgetsWrapper, { children })
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function DOProviderWithState({
|
|
128
|
+
config,
|
|
129
|
+
initialNamespace,
|
|
130
|
+
children
|
|
131
|
+
}) {
|
|
132
|
+
const { getAccessToken, user } = useAuth();
|
|
133
|
+
const [accessToken, setAccessToken] = useState(void 0);
|
|
134
|
+
const endpoint = useEndpoint(config.apiEndpoint);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (user) {
|
|
137
|
+
getAccessToken().then(setAccessToken).catch(() => setAccessToken(void 0));
|
|
138
|
+
} else {
|
|
139
|
+
setAccessToken(void 0);
|
|
140
|
+
}
|
|
141
|
+
}, [user, getAccessToken]);
|
|
142
|
+
const authenticatedConfig = useMemo(() => {
|
|
143
|
+
const authToken = accessToken ?? config.authToken;
|
|
144
|
+
return {
|
|
145
|
+
...config,
|
|
146
|
+
apiEndpoint: endpoint,
|
|
147
|
+
authToken
|
|
148
|
+
};
|
|
149
|
+
}, [config, accessToken, endpoint]);
|
|
150
|
+
return /* @__PURE__ */ jsx(DOProvider, { config: authenticatedConfig, initialNamespace, children });
|
|
151
|
+
}
|
|
152
|
+
function AppProviders({ config, children }) {
|
|
153
|
+
const themeMode = config.theme?.mode ?? "system";
|
|
154
|
+
return /* @__PURE__ */ jsx(
|
|
155
|
+
ThemeProvider,
|
|
156
|
+
{
|
|
157
|
+
attribute: "class",
|
|
158
|
+
defaultTheme: themeMode,
|
|
159
|
+
enableSystem: themeMode === "system",
|
|
160
|
+
disableTransitionOnChange: true,
|
|
161
|
+
children: /* @__PURE__ */ jsx(DOConfigProvider, { config, children: /* @__PURE__ */ jsx(DOIdentityProvider, { children: /* @__PURE__ */ jsx(
|
|
162
|
+
DOProviderWithState,
|
|
163
|
+
{
|
|
164
|
+
config: config.do,
|
|
165
|
+
initialNamespace: config.defaultNamespace,
|
|
166
|
+
children
|
|
167
|
+
}
|
|
168
|
+
) }) })
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
function DefaultLandingPage() {
|
|
173
|
+
const { signIn } = useAuth();
|
|
174
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-background flex flex-col items-center justify-center p-4", children: /* @__PURE__ */ jsxs("div", { className: "text-center max-w-md", children: [
|
|
175
|
+
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight mb-4", children: "DO Admin" }),
|
|
176
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-8", children: "Sign in to access the admin dashboard and manage your Durable Objects." }),
|
|
177
|
+
/* @__PURE__ */ jsx(
|
|
178
|
+
"button",
|
|
179
|
+
{
|
|
180
|
+
type: "button",
|
|
181
|
+
onClick: () => signIn(),
|
|
182
|
+
className: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-md)] text-sm font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-6",
|
|
183
|
+
children: "Sign In"
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] }) });
|
|
187
|
+
}
|
|
188
|
+
function AuthGate({ children }) {
|
|
189
|
+
const { config } = useDOConfig();
|
|
190
|
+
const { user, isLoading } = useAuth();
|
|
191
|
+
const { identity } = config;
|
|
192
|
+
const required = identity.required ?? true;
|
|
193
|
+
const onUnauthenticated = identity.onUnauthenticated ?? "landing";
|
|
194
|
+
if (!required) {
|
|
195
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
196
|
+
}
|
|
197
|
+
if (isLoading) {
|
|
198
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
199
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }),
|
|
200
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading..." })
|
|
201
|
+
] }) });
|
|
202
|
+
}
|
|
203
|
+
if (user) {
|
|
204
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
205
|
+
}
|
|
206
|
+
switch (onUnauthenticated) {
|
|
207
|
+
case "redirect":
|
|
208
|
+
if (identity.unauthenticatedRedirectUrl && typeof window !== "undefined") {
|
|
209
|
+
window.location.href = identity.unauthenticatedRedirectUrl;
|
|
210
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Redirecting..." }) });
|
|
211
|
+
}
|
|
212
|
+
return identity.landingComponent ? /* @__PURE__ */ jsx(Fragment, { children: identity.landingComponent }) : /* @__PURE__ */ jsx(DefaultLandingPage, {});
|
|
213
|
+
case "allow":
|
|
214
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
215
|
+
case "landing":
|
|
216
|
+
default:
|
|
217
|
+
return identity.landingComponent ? /* @__PURE__ */ jsx(Fragment, { children: identity.landingComponent }) : /* @__PURE__ */ jsx(DefaultLandingPage, {});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function getInitials(name) {
|
|
221
|
+
if (!name) return "?";
|
|
222
|
+
const parts = name.trim().split(/\s+/);
|
|
223
|
+
if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
|
|
224
|
+
return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
|
|
225
|
+
}
|
|
226
|
+
function UserMenu({ compact = false }) {
|
|
227
|
+
const { user, signOut, isLoading } = useAuth();
|
|
228
|
+
if (isLoading) {
|
|
229
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-2", children: [
|
|
230
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-pulse rounded-full bg-muted" }),
|
|
231
|
+
!compact && /* @__PURE__ */ jsx("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" })
|
|
232
|
+
] });
|
|
233
|
+
}
|
|
234
|
+
if (!user) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
const displayName = user.firstName ? `${user.firstName}${user.lastName ? ` ${user.lastName}` : ""}` : user.email;
|
|
238
|
+
const initials = getInitials(user.firstName ? `${user.firstName} ${user.lastName ?? ""}` : user.email);
|
|
239
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
240
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
241
|
+
SidebarMenuButton,
|
|
242
|
+
{
|
|
243
|
+
size: "lg",
|
|
244
|
+
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
247
|
+
/* @__PURE__ */ jsx(AvatarImage, { src: user.profilePictureUrl ?? void 0, alt: displayName }),
|
|
248
|
+
/* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-lg", children: initials })
|
|
249
|
+
] }),
|
|
250
|
+
!compact && /* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
251
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-semibold", children: displayName }),
|
|
252
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto size-4" })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
) }),
|
|
258
|
+
/* @__PURE__ */ jsxs(
|
|
259
|
+
DropdownMenuContent,
|
|
260
|
+
{
|
|
261
|
+
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-[var(--radius)]",
|
|
262
|
+
side: "bottom",
|
|
263
|
+
align: "end",
|
|
264
|
+
sideOffset: 4,
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
267
|
+
/* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
268
|
+
/* @__PURE__ */ jsx(AvatarImage, { src: user.profilePictureUrl ?? void 0, alt: displayName }),
|
|
269
|
+
/* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-lg", children: initials })
|
|
270
|
+
] }),
|
|
271
|
+
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
272
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-semibold", children: displayName }),
|
|
273
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
274
|
+
] })
|
|
275
|
+
] }) }),
|
|
276
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
277
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
|
|
278
|
+
/* @__PURE__ */ jsx(User, { className: "mr-2 size-4" }),
|
|
279
|
+
"Account"
|
|
280
|
+
] }),
|
|
281
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
|
|
282
|
+
/* @__PURE__ */ jsx(Settings, { className: "mr-2 size-4" }),
|
|
283
|
+
"Settings"
|
|
284
|
+
] }),
|
|
285
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
286
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => signOut(), children: [
|
|
287
|
+
/* @__PURE__ */ jsx(LogOut, { className: "mr-2 size-4" }),
|
|
288
|
+
"Sign Out"
|
|
289
|
+
] })
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
] });
|
|
294
|
+
}
|
|
295
|
+
var navGroups = {
|
|
296
|
+
main: [{ title: "Overview", url: "/", icon: Home, routeKey: "overview" }],
|
|
297
|
+
development: [
|
|
298
|
+
{ title: "Agents", url: "/agents", icon: Bot, routeKey: "agents" },
|
|
299
|
+
{
|
|
300
|
+
title: "Functions",
|
|
301
|
+
url: "/functions",
|
|
302
|
+
icon: Code,
|
|
303
|
+
routeKey: "functions"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
title: "Workflows",
|
|
307
|
+
url: "/workflows",
|
|
308
|
+
icon: GitBranch,
|
|
309
|
+
routeKey: "workflows"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
title: "Databases",
|
|
313
|
+
url: "/databases",
|
|
314
|
+
icon: Database,
|
|
315
|
+
routeKey: "databases"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
dataModel: [
|
|
319
|
+
{ title: "Things", url: "/things", icon: Shapes, routeKey: "things" },
|
|
320
|
+
{ title: "Nouns", url: "/nouns", icon: BookOpen, routeKey: "nouns" },
|
|
321
|
+
{ title: "Verbs", url: "/verbs", icon: Zap, routeKey: "verbs" },
|
|
322
|
+
{ title: "Actions", url: "/actions", icon: Play, routeKey: "actions" },
|
|
323
|
+
{
|
|
324
|
+
title: "Relationships",
|
|
325
|
+
url: "/relationships",
|
|
326
|
+
icon: Network,
|
|
327
|
+
routeKey: "relationships"
|
|
328
|
+
},
|
|
329
|
+
{ title: "Events", url: "/events", icon: Activity, routeKey: "events" }
|
|
330
|
+
],
|
|
331
|
+
saas: [
|
|
332
|
+
{
|
|
333
|
+
title: "Customers",
|
|
334
|
+
url: "/customers",
|
|
335
|
+
icon: Users,
|
|
336
|
+
routeKey: "customers"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
title: "Subscriptions",
|
|
340
|
+
url: "/subscriptions",
|
|
341
|
+
icon: CreditCard,
|
|
342
|
+
routeKey: "subscriptions"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
title: "Integrations",
|
|
346
|
+
url: "/integrations",
|
|
347
|
+
icon: Plug,
|
|
348
|
+
routeKey: "integrations"
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
admin: [
|
|
352
|
+
{ title: "Organizations", url: "/orgs", icon: Building, routeKey: "orgs" },
|
|
353
|
+
{ title: "Roles", url: "/roles", icon: Shield, routeKey: "roles" },
|
|
354
|
+
{ title: "Users", url: "/users", icon: UserCog, routeKey: "users" },
|
|
355
|
+
{ title: "API Keys", url: "/api-keys", icon: Key, routeKey: "apiKeys" },
|
|
356
|
+
{
|
|
357
|
+
title: "Settings",
|
|
358
|
+
url: "/settings",
|
|
359
|
+
icon: Settings,
|
|
360
|
+
routeKey: "settings"
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
};
|
|
364
|
+
function DOShellNav({ headerContent, ...props }) {
|
|
365
|
+
const routerState = useRouterState();
|
|
366
|
+
const { config } = useDOConfig();
|
|
367
|
+
const routesConfig = useDORoutes();
|
|
368
|
+
const branding = config.branding;
|
|
369
|
+
const pathname = routerState.location.pathname;
|
|
370
|
+
const isActive = (url) => {
|
|
371
|
+
if (url === "/") {
|
|
372
|
+
return pathname === "/" || pathname === "";
|
|
373
|
+
}
|
|
374
|
+
return pathname.startsWith(url);
|
|
375
|
+
};
|
|
376
|
+
const isRouteEnabled = (routeKey) => {
|
|
377
|
+
if (!routeKey) return true;
|
|
378
|
+
if (routesConfig[routeKey] === false) return false;
|
|
379
|
+
return true;
|
|
380
|
+
};
|
|
381
|
+
const filterNavItems = (items) => {
|
|
382
|
+
return items.filter((item) => isRouteEnabled(item.routeKey));
|
|
383
|
+
};
|
|
384
|
+
return /* @__PURE__ */ jsxs(Sidebar, { variant: "inset", ...props, children: [
|
|
385
|
+
/* @__PURE__ */ jsxs(SidebarHeader, { children: [
|
|
386
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, { size: "lg", asChild: true, children: /* @__PURE__ */ jsxs(Link, { to: "/", children: [
|
|
387
|
+
/* @__PURE__ */ jsx("div", { className: "bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-(--radius)", children: branding?.logo ?? /* @__PURE__ */ jsx(Database, { className: "size-4" }) }),
|
|
388
|
+
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
389
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: branding?.name ?? "DO Admin" }),
|
|
390
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs", children: "Dashboard" })
|
|
391
|
+
] })
|
|
392
|
+
] }) }) }) }),
|
|
393
|
+
headerContent
|
|
394
|
+
] }),
|
|
395
|
+
/* @__PURE__ */ jsxs(SidebarContent, { children: [
|
|
396
|
+
/* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.main).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
397
|
+
SidebarMenuButton,
|
|
398
|
+
{
|
|
399
|
+
asChild: true,
|
|
400
|
+
isActive: isActive(item.url),
|
|
401
|
+
tooltip: item.title,
|
|
402
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
403
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
404
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
405
|
+
] })
|
|
406
|
+
}
|
|
407
|
+
) }, item.title)) }) }),
|
|
408
|
+
filterNavItems(navGroups.development).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
409
|
+
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Development" }),
|
|
410
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.development).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
411
|
+
SidebarMenuButton,
|
|
412
|
+
{
|
|
413
|
+
asChild: true,
|
|
414
|
+
isActive: isActive(item.url),
|
|
415
|
+
tooltip: item.title,
|
|
416
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
417
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
418
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
419
|
+
] })
|
|
420
|
+
}
|
|
421
|
+
) }, item.title)) })
|
|
422
|
+
] }),
|
|
423
|
+
filterNavItems(navGroups.dataModel).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
424
|
+
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Data Model" }),
|
|
425
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.dataModel).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
426
|
+
SidebarMenuButton,
|
|
427
|
+
{
|
|
428
|
+
asChild: true,
|
|
429
|
+
isActive: isActive(item.url),
|
|
430
|
+
tooltip: item.title,
|
|
431
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
432
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
433
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
434
|
+
] })
|
|
435
|
+
}
|
|
436
|
+
) }, item.title)) })
|
|
437
|
+
] }),
|
|
438
|
+
filterNavItems(navGroups.saas).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
439
|
+
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "SaaS" }),
|
|
440
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.saas).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
441
|
+
SidebarMenuButton,
|
|
442
|
+
{
|
|
443
|
+
asChild: true,
|
|
444
|
+
isActive: isActive(item.url),
|
|
445
|
+
tooltip: item.title,
|
|
446
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
447
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
448
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
449
|
+
] })
|
|
450
|
+
}
|
|
451
|
+
) }, item.title)) })
|
|
452
|
+
] }),
|
|
453
|
+
filterNavItems(navGroups.admin).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
454
|
+
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Admin" }),
|
|
455
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.admin).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
456
|
+
SidebarMenuButton,
|
|
457
|
+
{
|
|
458
|
+
asChild: true,
|
|
459
|
+
isActive: isActive(item.url),
|
|
460
|
+
tooltip: item.title,
|
|
461
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
462
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
463
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
464
|
+
] })
|
|
465
|
+
}
|
|
466
|
+
) }, item.title)) })
|
|
467
|
+
] })
|
|
468
|
+
] }),
|
|
469
|
+
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(UserMenu, {}) }) }) })
|
|
470
|
+
] });
|
|
471
|
+
}
|
|
472
|
+
function RouterLink({ href, children, className }) {
|
|
473
|
+
return /* @__PURE__ */ jsx(Link, { to: href, className, children });
|
|
474
|
+
}
|
|
475
|
+
function DOShell({
|
|
476
|
+
children,
|
|
477
|
+
sidebarHeaderContent,
|
|
478
|
+
headerContent,
|
|
479
|
+
breadcrumbs: breadcrumbsProp
|
|
480
|
+
}) {
|
|
481
|
+
const autoBreadcrumbs = useBreadcrumbs();
|
|
482
|
+
const breadcrumbs = breadcrumbsProp ?? autoBreadcrumbs;
|
|
483
|
+
return /* @__PURE__ */ jsx(AuthGate, { children: /* @__PURE__ */ jsxs(SidebarProvider, { className: "h-svh!", children: [
|
|
484
|
+
/* @__PURE__ */ jsx(DOShellNav, { headerContent: sidebarHeaderContent }),
|
|
485
|
+
/* @__PURE__ */ jsxs(SidebarInset, { className: "overflow-hidden", children: [
|
|
486
|
+
/* @__PURE__ */ jsxs("header", { className: "relative flex h-16 shrink-0 items-center gap-2 border-b bg-background transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: [
|
|
487
|
+
/* @__PURE__ */ jsxs("div", { className: "z-10 flex shrink-0 items-center gap-2 bg-background px-4", children: [
|
|
488
|
+
/* @__PURE__ */ jsx(SidebarTrigger, { className: "-ml-1" }),
|
|
489
|
+
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mr-2 h-4" }),
|
|
490
|
+
breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Breadcrumbs, { items: breadcrumbs, LinkComponent: RouterLink })
|
|
491
|
+
] }),
|
|
492
|
+
headerContent && /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center px-4 xl:absolute xl:inset-0 xl:justify-center", children: /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: headerContent }) })
|
|
493
|
+
] }),
|
|
494
|
+
/* @__PURE__ */ jsx("main", { className: "flex-1 overflow-auto", children })
|
|
495
|
+
] }),
|
|
496
|
+
/* @__PURE__ */ jsx(Toaster, { closeButton: true, position: "top-right" })
|
|
497
|
+
] }) });
|
|
498
|
+
}
|
|
499
|
+
function DatabasesPage() {
|
|
500
|
+
const params = useParams({ strict: false });
|
|
501
|
+
const ns = params.ns;
|
|
502
|
+
const type = params.type;
|
|
503
|
+
return /* @__PURE__ */ jsx(
|
|
504
|
+
DataGridView,
|
|
505
|
+
{
|
|
506
|
+
initialNamespace: ns,
|
|
507
|
+
initialType: type,
|
|
508
|
+
className: "h-full"
|
|
509
|
+
}
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
function DocumentPage() {
|
|
513
|
+
const params = useParams({ strict: false });
|
|
514
|
+
const ns = params.ns;
|
|
515
|
+
const type = params.type;
|
|
516
|
+
const id = params.id;
|
|
517
|
+
const navigate = useNavigate();
|
|
518
|
+
const handleBack = () => {
|
|
519
|
+
navigate({ to: `/things/${ns}/${type}` });
|
|
520
|
+
};
|
|
521
|
+
const handleDelete = () => {
|
|
522
|
+
navigate({ to: `/things/${ns}/${type}` });
|
|
523
|
+
};
|
|
524
|
+
return /* @__PURE__ */ jsx(
|
|
525
|
+
DocumentEditorView,
|
|
526
|
+
{
|
|
527
|
+
initialNamespace: ns,
|
|
528
|
+
initialType: type,
|
|
529
|
+
initialId: id,
|
|
530
|
+
onBack: handleBack,
|
|
531
|
+
onDelete: handleDelete,
|
|
532
|
+
className: "h-full"
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
function FunctionsPage() {
|
|
537
|
+
return /* @__PURE__ */ jsx(FunctionEditorView, { className: "h-full" });
|
|
538
|
+
}
|
|
539
|
+
function StatCard({ title, value, description, icon: Icon, href }) {
|
|
540
|
+
const content = /* @__PURE__ */ jsxs(Card, { className: "hover:bg-muted/50 transition-colors", children: [
|
|
541
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
542
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-sm font-medium", children: title }),
|
|
543
|
+
/* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 text-muted-foreground" })
|
|
544
|
+
] }),
|
|
545
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
546
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold", children: value }),
|
|
547
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: description })
|
|
548
|
+
] })
|
|
549
|
+
] });
|
|
550
|
+
if (href) {
|
|
551
|
+
return /* @__PURE__ */ jsx(Link, { to: href, className: "block", children: content });
|
|
552
|
+
}
|
|
553
|
+
return content;
|
|
554
|
+
}
|
|
555
|
+
function QuickAction({ title, description, icon: Icon, href }) {
|
|
556
|
+
return /* @__PURE__ */ jsxs(
|
|
557
|
+
Link,
|
|
558
|
+
{
|
|
559
|
+
to: href,
|
|
560
|
+
className: "flex items-center gap-4 rounded-(--radius) border p-4 hover:bg-muted/50 transition-colors",
|
|
561
|
+
children: [
|
|
562
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-(--radius) bg-primary/10", children: /* @__PURE__ */ jsx(Icon, { className: "h-5 w-5 text-primary" }) }),
|
|
563
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
564
|
+
/* @__PURE__ */ jsx("h3", { className: "font-medium", children: title }),
|
|
565
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
|
|
566
|
+
] })
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
function OverviewPage() {
|
|
572
|
+
const { namespace, isConnected } = useDO();
|
|
573
|
+
const { data: namespaces } = useNamespaces();
|
|
574
|
+
const { data: types } = useTypes({ ns: namespace });
|
|
575
|
+
const { data: thingsResult } = useThings({ ns: namespace, limit: 1 });
|
|
576
|
+
const namespaceCount = namespaces?.length ?? 0;
|
|
577
|
+
const typeCount = types?.length ?? 0;
|
|
578
|
+
const thingCount = thingsResult?.total ?? 0;
|
|
579
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
580
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
581
|
+
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight", children: "Dashboard" }),
|
|
582
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "Welcome to DO Admin. Manage your Durable Objects and data." })
|
|
583
|
+
] }),
|
|
584
|
+
!isConnected && /* @__PURE__ */ jsx(Card, { className: "border-destructive", children: /* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
585
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-destructive", children: "Connection Error" }),
|
|
586
|
+
/* @__PURE__ */ jsx(CardDescription, { children: "Unable to connect to the backend. Please check your configuration." })
|
|
587
|
+
] }) }),
|
|
588
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-4", children: [
|
|
589
|
+
/* @__PURE__ */ jsx(
|
|
590
|
+
StatCard,
|
|
591
|
+
{
|
|
592
|
+
title: "Namespaces",
|
|
593
|
+
value: namespaceCount,
|
|
594
|
+
description: "Active namespaces",
|
|
595
|
+
icon: Database,
|
|
596
|
+
href: "/databases"
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ jsx(
|
|
600
|
+
StatCard,
|
|
601
|
+
{
|
|
602
|
+
title: "Types",
|
|
603
|
+
value: typeCount,
|
|
604
|
+
description: "Defined types",
|
|
605
|
+
icon: Shapes,
|
|
606
|
+
href: "/things"
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
/* @__PURE__ */ jsx(
|
|
610
|
+
StatCard,
|
|
611
|
+
{
|
|
612
|
+
title: "Things",
|
|
613
|
+
value: thingCount,
|
|
614
|
+
description: "Total records",
|
|
615
|
+
icon: Activity,
|
|
616
|
+
href: "/things"
|
|
617
|
+
}
|
|
618
|
+
),
|
|
619
|
+
/* @__PURE__ */ jsx(
|
|
620
|
+
StatCard,
|
|
621
|
+
{
|
|
622
|
+
title: "Namespace",
|
|
623
|
+
value: namespace,
|
|
624
|
+
description: "Currently selected",
|
|
625
|
+
icon: Network
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
] }),
|
|
629
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
630
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-4", children: "Quick Actions" }),
|
|
631
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: [
|
|
632
|
+
/* @__PURE__ */ jsx(
|
|
633
|
+
QuickAction,
|
|
634
|
+
{
|
|
635
|
+
title: "Browse Things",
|
|
636
|
+
description: "View and manage all your Things",
|
|
637
|
+
icon: Shapes,
|
|
638
|
+
href: "/things"
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
/* @__PURE__ */ jsx(
|
|
642
|
+
QuickAction,
|
|
643
|
+
{
|
|
644
|
+
title: "Query Database",
|
|
645
|
+
description: "Run queries on your data",
|
|
646
|
+
icon: Database,
|
|
647
|
+
href: "/databases"
|
|
648
|
+
}
|
|
649
|
+
),
|
|
650
|
+
/* @__PURE__ */ jsx(
|
|
651
|
+
QuickAction,
|
|
652
|
+
{
|
|
653
|
+
title: "Run Functions",
|
|
654
|
+
description: "Execute code against your DO",
|
|
655
|
+
icon: Code,
|
|
656
|
+
href: "/functions"
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ jsx(
|
|
660
|
+
QuickAction,
|
|
661
|
+
{
|
|
662
|
+
title: "Manage Customers",
|
|
663
|
+
description: "View and manage customers",
|
|
664
|
+
icon: Users,
|
|
665
|
+
href: "/customers"
|
|
666
|
+
}
|
|
667
|
+
),
|
|
668
|
+
/* @__PURE__ */ jsx(
|
|
669
|
+
QuickAction,
|
|
670
|
+
{
|
|
671
|
+
title: "View Subscriptions",
|
|
672
|
+
description: "Manage billing and subscriptions",
|
|
673
|
+
icon: CreditCard,
|
|
674
|
+
href: "/subscriptions"
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
/* @__PURE__ */ jsx(
|
|
678
|
+
QuickAction,
|
|
679
|
+
{
|
|
680
|
+
title: "Organizations",
|
|
681
|
+
description: "Manage organizations and teams",
|
|
682
|
+
icon: Building,
|
|
683
|
+
href: "/orgs"
|
|
684
|
+
}
|
|
685
|
+
)
|
|
686
|
+
] })
|
|
687
|
+
] }),
|
|
688
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
689
|
+
/* @__PURE__ */ jsxs(CardTitle, { children: [
|
|
690
|
+
"Current Namespace: ",
|
|
691
|
+
namespace
|
|
692
|
+
] }),
|
|
693
|
+
/* @__PURE__ */ jsxs(CardDescription, { children: [
|
|
694
|
+
'You are currently working in the "',
|
|
695
|
+
namespace,
|
|
696
|
+
'" namespace. Switch namespaces from the Things or Databases view.'
|
|
697
|
+
] })
|
|
698
|
+
] }) })
|
|
699
|
+
] });
|
|
700
|
+
}
|
|
701
|
+
function PlaceholderPage({ title, description }) {
|
|
702
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center p-4", children: /* @__PURE__ */ jsxs(Card, { className: "max-w-md", children: [
|
|
703
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "text-center", children: [
|
|
704
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ jsx(Construction, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
705
|
+
/* @__PURE__ */ jsx(CardTitle, { children: title }),
|
|
706
|
+
/* @__PURE__ */ jsx(CardDescription, { children: description ?? "This feature is coming soon." })
|
|
707
|
+
] }),
|
|
708
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "text-center text-sm text-muted-foreground", children: [
|
|
709
|
+
/* @__PURE__ */ jsx("p", { children: "We're working hard to bring you this functionality." }),
|
|
710
|
+
/* @__PURE__ */ jsx("p", { children: "Check back soon for updates." })
|
|
711
|
+
] })
|
|
712
|
+
] }) });
|
|
713
|
+
}
|
|
714
|
+
function ThingsPage() {
|
|
715
|
+
const params = useParams({ strict: false });
|
|
716
|
+
const ns = params.ns;
|
|
717
|
+
const type = params.type;
|
|
718
|
+
const navigate = useNavigate();
|
|
719
|
+
const handleOpen = (thing) => {
|
|
720
|
+
navigate({ to: `/things/${thing.ns}/${thing.type}/${thing.id}` });
|
|
721
|
+
};
|
|
722
|
+
return /* @__PURE__ */ jsx(
|
|
723
|
+
DataBrowserView,
|
|
724
|
+
{
|
|
725
|
+
initialNamespace: ns,
|
|
726
|
+
initialType: type,
|
|
727
|
+
onOpen: handleOpen,
|
|
728
|
+
className: "h-full"
|
|
729
|
+
}
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
function TypedThingsPage({ type }) {
|
|
733
|
+
const navigate = useNavigate();
|
|
734
|
+
const handleOpen = (thing) => {
|
|
735
|
+
navigate({ to: `/things/${thing.ns}/${thing.type}/${thing.id}` });
|
|
736
|
+
};
|
|
737
|
+
return /* @__PURE__ */ jsx(
|
|
738
|
+
DataBrowserView,
|
|
739
|
+
{
|
|
740
|
+
initialType: type,
|
|
741
|
+
onOpen: handleOpen,
|
|
742
|
+
className: "h-full"
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
function NounsPage() {
|
|
747
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Noun" });
|
|
748
|
+
}
|
|
749
|
+
function VerbsPage() {
|
|
750
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Verb" });
|
|
751
|
+
}
|
|
752
|
+
function ActionsPage() {
|
|
753
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Action" });
|
|
754
|
+
}
|
|
755
|
+
function RelationshipsPage() {
|
|
756
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Relationship" });
|
|
757
|
+
}
|
|
758
|
+
function EventsPage() {
|
|
759
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Event" });
|
|
760
|
+
}
|
|
761
|
+
function CustomersPage() {
|
|
762
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Customer" });
|
|
763
|
+
}
|
|
764
|
+
function SubscriptionsPage() {
|
|
765
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Subscription" });
|
|
766
|
+
}
|
|
767
|
+
function OrgsPage() {
|
|
768
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Org" });
|
|
769
|
+
}
|
|
770
|
+
function RolesPage() {
|
|
771
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Role" });
|
|
772
|
+
}
|
|
773
|
+
function UsersPage() {
|
|
774
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "User" });
|
|
775
|
+
}
|
|
776
|
+
function APIKeysPage() {
|
|
777
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "APIKey" });
|
|
778
|
+
}
|
|
779
|
+
var doRoutes = {
|
|
780
|
+
// Main
|
|
781
|
+
overview: {
|
|
782
|
+
path: "/",
|
|
783
|
+
component: OverviewPage
|
|
784
|
+
},
|
|
785
|
+
// Development
|
|
786
|
+
agents: {
|
|
787
|
+
path: "/agents",
|
|
788
|
+
component: () => /* @__PURE__ */ jsx(PlaceholderPage, { title: "Agents", description: "Autonomous AI workers" })
|
|
789
|
+
},
|
|
790
|
+
functions: {
|
|
791
|
+
path: "/functions",
|
|
792
|
+
component: FunctionsPage
|
|
793
|
+
},
|
|
794
|
+
workflows: {
|
|
795
|
+
path: "/workflows",
|
|
796
|
+
component: FunctionsPage
|
|
797
|
+
// Uses FunctionEditorView for now
|
|
798
|
+
},
|
|
799
|
+
databases: {
|
|
800
|
+
path: "/databases",
|
|
801
|
+
component: DatabasesPage
|
|
802
|
+
},
|
|
803
|
+
databasesWithParams: {
|
|
804
|
+
path: "/databases/:ns/:type",
|
|
805
|
+
component: DatabasesPage
|
|
806
|
+
},
|
|
807
|
+
// Data Model
|
|
808
|
+
things: {
|
|
809
|
+
path: "/things",
|
|
810
|
+
component: ThingsPage
|
|
811
|
+
},
|
|
812
|
+
thingsWithNs: {
|
|
813
|
+
path: "/things/:ns",
|
|
814
|
+
component: ThingsPage
|
|
815
|
+
},
|
|
816
|
+
thingsWithType: {
|
|
817
|
+
path: "/things/:ns/:type",
|
|
818
|
+
component: ThingsPage
|
|
819
|
+
},
|
|
820
|
+
document: {
|
|
821
|
+
path: "/things/:ns/:type/:id",
|
|
822
|
+
component: DocumentPage
|
|
823
|
+
},
|
|
824
|
+
nouns: {
|
|
825
|
+
path: "/nouns",
|
|
826
|
+
component: NounsPage
|
|
827
|
+
},
|
|
828
|
+
verbs: {
|
|
829
|
+
path: "/verbs",
|
|
830
|
+
component: VerbsPage
|
|
831
|
+
},
|
|
832
|
+
actions: {
|
|
833
|
+
path: "/actions",
|
|
834
|
+
component: ActionsPage
|
|
835
|
+
},
|
|
836
|
+
relationships: {
|
|
837
|
+
path: "/relationships",
|
|
838
|
+
component: RelationshipsPage
|
|
839
|
+
},
|
|
840
|
+
events: {
|
|
841
|
+
path: "/events",
|
|
842
|
+
component: EventsPage
|
|
843
|
+
},
|
|
844
|
+
// SaaS
|
|
845
|
+
customers: {
|
|
846
|
+
path: "/customers",
|
|
847
|
+
component: CustomersPage
|
|
848
|
+
},
|
|
849
|
+
subscriptions: {
|
|
850
|
+
path: "/subscriptions",
|
|
851
|
+
component: SubscriptionsPage
|
|
852
|
+
},
|
|
853
|
+
integrations: {
|
|
854
|
+
path: "/integrations",
|
|
855
|
+
component: () => /* @__PURE__ */ jsx(
|
|
856
|
+
PlaceholderPage,
|
|
857
|
+
{
|
|
858
|
+
title: "Integrations",
|
|
859
|
+
description: "External service connections"
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
},
|
|
863
|
+
// Admin
|
|
864
|
+
orgs: {
|
|
865
|
+
path: "/orgs",
|
|
866
|
+
component: OrgsPage
|
|
867
|
+
},
|
|
868
|
+
roles: {
|
|
869
|
+
path: "/roles",
|
|
870
|
+
component: RolesPage
|
|
871
|
+
},
|
|
872
|
+
users: {
|
|
873
|
+
path: "/users",
|
|
874
|
+
component: UsersPage
|
|
875
|
+
},
|
|
876
|
+
apiKeys: {
|
|
877
|
+
path: "/api-keys",
|
|
878
|
+
component: APIKeysPage
|
|
879
|
+
},
|
|
880
|
+
settings: {
|
|
881
|
+
path: "/settings",
|
|
882
|
+
component: () => /* @__PURE__ */ jsx(PlaceholderPage, { title: "Settings", description: "Application settings" })
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
function DefaultHeaderContent() {
|
|
886
|
+
const { config } = useDOConfig();
|
|
887
|
+
const { endpoint, setEndpoint, recentEndpoints } = useDOState({
|
|
888
|
+
endpoint: config.do.apiEndpoint
|
|
889
|
+
});
|
|
890
|
+
return /* @__PURE__ */ jsx(
|
|
891
|
+
EndpointSelector,
|
|
892
|
+
{
|
|
893
|
+
endpoint,
|
|
894
|
+
onEndpointChange: setEndpoint,
|
|
895
|
+
recentEndpoints,
|
|
896
|
+
className: "w-full max-w-md"
|
|
897
|
+
}
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
function createShellComponent(headerContent, sidebarHeaderContent) {
|
|
901
|
+
return function ShellLayout() {
|
|
902
|
+
return /* @__PURE__ */ jsx(
|
|
903
|
+
DOShell,
|
|
904
|
+
{
|
|
905
|
+
headerContent: headerContent ?? /* @__PURE__ */ jsx(DefaultHeaderContent, {}),
|
|
906
|
+
sidebarHeaderContent,
|
|
907
|
+
children: /* @__PURE__ */ jsx(WebOutlet, {})
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
function DOApp({
|
|
913
|
+
config,
|
|
914
|
+
headerContent,
|
|
915
|
+
sidebarHeaderContent
|
|
916
|
+
}) {
|
|
917
|
+
const basePath = config.basePath ?? "";
|
|
918
|
+
const router = React.useMemo(() => {
|
|
919
|
+
const ShellComponent = createShellComponent(
|
|
920
|
+
headerContent,
|
|
921
|
+
sidebarHeaderContent
|
|
922
|
+
);
|
|
923
|
+
return createWebRouter(doRoutes, {
|
|
924
|
+
rootComponent: ShellComponent,
|
|
925
|
+
basepath: basePath || void 0
|
|
926
|
+
});
|
|
927
|
+
}, [basePath, headerContent, sidebarHeaderContent]);
|
|
928
|
+
return /* @__PURE__ */ jsx(AppProviders, { config, children: /* @__PURE__ */ jsx(
|
|
929
|
+
RouterProvider,
|
|
930
|
+
{
|
|
931
|
+
router
|
|
932
|
+
}
|
|
933
|
+
) });
|
|
934
|
+
}
|
|
935
|
+
var DatabaseRouteParams = z.object({
|
|
936
|
+
ns: z.string().optional(),
|
|
937
|
+
type: z.string().optional()
|
|
938
|
+
});
|
|
939
|
+
var ThingsRouteParams = z.object({
|
|
940
|
+
ns: z.string().optional(),
|
|
941
|
+
type: z.string().optional()
|
|
942
|
+
});
|
|
943
|
+
var DocumentRouteParams = z.object({
|
|
944
|
+
ns: z.string(),
|
|
945
|
+
type: z.string(),
|
|
946
|
+
id: z.string()
|
|
947
|
+
});
|
|
948
|
+
var TypeFilteredRouteParams = z.object({
|
|
949
|
+
type: z.string().optional()
|
|
950
|
+
});
|
|
951
|
+
|
|
952
|
+
// src/app/routes.ts
|
|
953
|
+
var doRoutePaths = {
|
|
954
|
+
// Main
|
|
955
|
+
overview: "/",
|
|
956
|
+
// Development
|
|
957
|
+
agents: "/agents",
|
|
958
|
+
functions: "/functions",
|
|
959
|
+
workflows: "/workflows",
|
|
960
|
+
databases: "/databases",
|
|
961
|
+
databaseTable: "/databases/:ns/:type",
|
|
962
|
+
// Data Model
|
|
963
|
+
things: "/things",
|
|
964
|
+
thingsBrowse: "/things/:ns/:type?",
|
|
965
|
+
document: "/things/:ns/:type/:id",
|
|
966
|
+
nouns: "/nouns",
|
|
967
|
+
verbs: "/verbs",
|
|
968
|
+
actions: "/actions",
|
|
969
|
+
relationships: "/relationships",
|
|
970
|
+
events: "/events",
|
|
971
|
+
// SaaS
|
|
972
|
+
customers: "/customers",
|
|
973
|
+
subscriptions: "/subscriptions",
|
|
974
|
+
integrations: "/integrations",
|
|
975
|
+
// Admin
|
|
976
|
+
orgs: "/orgs",
|
|
977
|
+
roles: "/roles",
|
|
978
|
+
users: "/users",
|
|
979
|
+
apiKeys: "/api-keys",
|
|
980
|
+
settings: "/settings"
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
export { AppProviders, AuthGate, DOApp, DOConfigProvider, DOIdentityProvider, DOShell, DOShellNav, DatabaseRouteParams, DatabasesPage, DocumentPage, DocumentRouteParams, FunctionsPage, OverviewPage, PlaceholderPage, ThingsPage, ThingsRouteParams, TypeFilteredRouteParams, UserMenu, doRoutePaths, useDOConfig, useDOCustomRoutes, useDORoutes, useIdentity };
|
|
984
|
+
//# sourceMappingURL=chunk-KT52UU3U.js.map
|
|
985
|
+
//# sourceMappingURL=chunk-KT52UU3U.js.map
|