@mdxui/do 3.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -275
- package/dist/app/index.d.ts +127 -127
- package/dist/app/index.js +8 -7
- 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-YGIBMNRH.js → chunk-GYIMQZE7.js} +30 -27
- package/dist/chunk-GYIMQZE7.js.map +1 -0
- package/dist/{chunk-NTSEARBC.js → chunk-IQ23B4ME.js} +480 -251
- package/dist/chunk-IQ23B4ME.js.map +1 -0
- package/dist/{chunk-5AWTQDRF.js → chunk-JJLAES6W.js} +2 -2
- package/dist/{chunk-5AWTQDRF.js.map → chunk-JJLAES6W.js.map} +1 -1
- package/dist/chunk-KAZJ43F6.js +1071 -0
- package/dist/chunk-KAZJ43F6.js.map +1 -0
- package/dist/{chunk-EQVOEEQO.js → chunk-LJIWB7KE.js} +2 -2
- package/dist/{chunk-EQVOEEQO.js.map → chunk-LJIWB7KE.js.map} +1 -1
- package/dist/chunk-OHWWWONS.js +249 -0
- package/dist/chunk-OHWWWONS.js.map +1 -0
- package/dist/{chunk-IESVTECE.js → chunk-XH3LVW7J.js} +64 -4
- package/dist/chunk-XH3LVW7J.js.map +1 -0
- package/dist/{chunk-JWKIONEO.js → chunk-YMQRC6IC.js} +3 -3
- package/dist/{chunk-JWKIONEO.js.map → chunk-YMQRC6IC.js.map} +1 -1
- package/dist/components/index.d.ts +20 -1
- package/dist/components/index.js +2 -1
- package/dist/{config-CmZBQQaT.d.ts → config-CxvpD8Y6.d.ts} +2 -13
- package/dist/{do-C-t9UgjT.d.ts → do-D27i5bU0.d.ts} +2 -1
- package/dist/{errors-B4Oyyj4Z.d.ts → errors-DratdVIz.d.ts} +1 -1
- package/dist/hooks/index.d.ts +30 -3
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/things/index.d.ts +2 -2
- package/dist/hooks/things/index.js +3 -3
- package/dist/index.d.ts +77 -15
- package/dist/index.js +9 -8
- package/dist/lib/index.d.ts +703 -5
- package/dist/lib/index.js +2 -2
- package/dist/providers/index.d.ts +7 -123
- package/dist/providers/index.js +2 -2
- package/dist/{query-keys-BC901wog.d.ts → query-keys-CZNFikIi.d.ts} +3 -3
- package/dist/schemas/index.d.ts +5 -5
- package/dist/{thing-BVhCTzOi.d.ts → thing-BF25aUtJ.d.ts} +68 -68
- package/dist/types/index.d.ts +445 -445
- package/dist/views/index.d.ts +1 -1
- package/dist/views/index.js +6 -6
- package/package.json +22 -22
- package/dist/chunk-FO3N7SXV.js +0 -469
- package/dist/chunk-FO3N7SXV.js.map +0 -1
- package/dist/chunk-IESVTECE.js.map +0 -1
- package/dist/chunk-NTSEARBC.js.map +0 -1
- package/dist/chunk-OWEAW4U6.js +0 -116
- package/dist/chunk-OWEAW4U6.js.map +0 -1
- package/dist/chunk-YGIBMNRH.js.map +0 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNamespaces, useTypes } from './chunk-
|
|
3
|
-
import { useThings } from './chunk-
|
|
4
|
-
import { DOProvider,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { DataGridView, DocumentEditorView, FunctionEditorView, DataBrowserView } from './chunk-GYIMQZE7.js';
|
|
2
|
+
import { useBreadcrumbs, useNamespaces, useTypes } from './chunk-XH3LVW7J.js';
|
|
3
|
+
import { useThings } from './chunk-YMQRC6IC.js';
|
|
4
|
+
import { useDO, useEndpoint, DOProvider, useDOState } from './chunk-OHWWWONS.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';
|
|
7
8
|
import * as React from 'react';
|
|
8
|
-
import { createContext,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
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';
|
|
9
|
+
import { createContext, useMemo, useContext, useState, useEffect } from 'react';
|
|
10
|
+
import { useAuth, IdentityProvider, WidgetsProvider } from '@mdxui/auth';
|
|
11
|
+
import { ThemeProvider } from 'next-themes';
|
|
12
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
import { useSidebar, 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';
|
|
13
14
|
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';
|
|
14
15
|
import { z } from 'zod';
|
|
15
16
|
|
|
16
|
-
var
|
|
17
|
+
var DOConfigContext = createContext(null);
|
|
17
18
|
var defaultIdentity = {
|
|
18
19
|
clientId: "",
|
|
19
20
|
devMode: false,
|
|
@@ -28,8 +29,7 @@ var defaultConfig = {
|
|
|
28
29
|
routes: {},
|
|
29
30
|
customRoutes: []
|
|
30
31
|
};
|
|
31
|
-
function
|
|
32
|
-
const [namespace, setNamespace] = useState(config.defaultNamespace ?? "default");
|
|
32
|
+
function DOConfigProvider({ config, children }) {
|
|
33
33
|
const value = useMemo(() => {
|
|
34
34
|
const mergedConfig = {
|
|
35
35
|
...defaultConfig,
|
|
@@ -38,69 +38,28 @@ function DOShellProvider({ config, children }) {
|
|
|
38
38
|
theme: { ...defaultConfig.theme, ...config.theme },
|
|
39
39
|
identity: { ...defaultIdentity, ...config.identity }
|
|
40
40
|
};
|
|
41
|
-
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setNamespace
|
|
45
|
-
};
|
|
46
|
-
}, [config, namespace]);
|
|
47
|
-
return /* @__PURE__ */ jsx(DOShellContext.Provider, { value, children });
|
|
41
|
+
return { config: mergedConfig };
|
|
42
|
+
}, [config]);
|
|
43
|
+
return /* @__PURE__ */ jsx(DOConfigContext.Provider, { value, children });
|
|
48
44
|
}
|
|
49
|
-
function
|
|
50
|
-
const context = useContext(
|
|
45
|
+
function useDOConfig() {
|
|
46
|
+
const context = useContext(DOConfigContext);
|
|
51
47
|
if (!context) {
|
|
52
|
-
throw new Error("
|
|
48
|
+
throw new Error("useDOConfig must be used within a DOConfigProvider");
|
|
53
49
|
}
|
|
54
50
|
return context;
|
|
55
51
|
}
|
|
56
|
-
function
|
|
57
|
-
const { config } =
|
|
52
|
+
function useDORoutes() {
|
|
53
|
+
const { config } = useDOConfig();
|
|
58
54
|
return config.routes ?? {};
|
|
59
55
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const [isDark, setIsDark] = useState(false);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
setMounted(true);
|
|
66
|
-
const checkDarkMode = () => {
|
|
67
|
-
const isDarkClass = document.documentElement.classList.contains("dark");
|
|
68
|
-
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
69
|
-
setIsDark(isDarkClass || !document.documentElement.classList.contains("light") && prefersDark);
|
|
70
|
-
};
|
|
71
|
-
checkDarkMode();
|
|
72
|
-
const observer = new MutationObserver(checkDarkMode);
|
|
73
|
-
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
|
|
74
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
75
|
-
mediaQuery.addEventListener("change", checkDarkMode);
|
|
76
|
-
return () => {
|
|
77
|
-
observer.disconnect();
|
|
78
|
-
mediaQuery.removeEventListener("change", checkDarkMode);
|
|
79
|
-
};
|
|
80
|
-
}, []);
|
|
81
|
-
const appearance = mounted ? isDark ? "dark" : "light" : "inherit";
|
|
82
|
-
return /* @__PURE__ */ jsx(
|
|
83
|
-
WorkOsWidgets,
|
|
84
|
-
{
|
|
85
|
-
theme: {
|
|
86
|
-
appearance,
|
|
87
|
-
radius: "medium",
|
|
88
|
-
scaling: "100%"
|
|
89
|
-
},
|
|
90
|
-
elements: {
|
|
91
|
-
primaryButton: {
|
|
92
|
-
variant: "solid"
|
|
93
|
-
},
|
|
94
|
-
secondaryButton: {
|
|
95
|
-
variant: "outline"
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
children
|
|
99
|
-
}
|
|
100
|
-
);
|
|
56
|
+
function useDOCustomRoutes() {
|
|
57
|
+
const { config } = useDOConfig();
|
|
58
|
+
return config.customRoutes ?? [];
|
|
101
59
|
}
|
|
60
|
+
var useIdentity = useAuth;
|
|
102
61
|
function DOIdentityProvider({ children }) {
|
|
103
|
-
const { config } =
|
|
62
|
+
const { config } = useDOConfig();
|
|
104
63
|
const { identity } = config;
|
|
105
64
|
const redirectUri = identity.redirectUri ?? (typeof window !== "undefined" ? `${window.location.origin}${config.basePath ?? "/"}` : void 0);
|
|
106
65
|
const onRedirectCallback = () => {
|
|
@@ -112,17 +71,42 @@ function DOIdentityProvider({ children }) {
|
|
|
112
71
|
}
|
|
113
72
|
};
|
|
114
73
|
return /* @__PURE__ */ jsx(
|
|
115
|
-
|
|
74
|
+
IdentityProvider,
|
|
116
75
|
{
|
|
117
76
|
clientId: identity.clientId,
|
|
118
77
|
apiHostname: identity.apiHostname,
|
|
119
78
|
devMode: identity.devMode,
|
|
120
79
|
redirectUri,
|
|
121
80
|
onRedirectCallback,
|
|
122
|
-
children: /* @__PURE__ */ jsx(
|
|
81
|
+
children: /* @__PURE__ */ jsx(WidgetsProvider, { children })
|
|
123
82
|
}
|
|
124
83
|
);
|
|
125
84
|
}
|
|
85
|
+
function DOProviderWithState({
|
|
86
|
+
config,
|
|
87
|
+
initialNamespace,
|
|
88
|
+
children
|
|
89
|
+
}) {
|
|
90
|
+
const { getAccessToken, user } = useAuth();
|
|
91
|
+
const [accessToken, setAccessToken] = useState(void 0);
|
|
92
|
+
const endpoint = useEndpoint(config.apiEndpoint);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (user) {
|
|
95
|
+
getAccessToken().then(setAccessToken).catch(() => setAccessToken(void 0));
|
|
96
|
+
} else {
|
|
97
|
+
setAccessToken(void 0);
|
|
98
|
+
}
|
|
99
|
+
}, [user, getAccessToken]);
|
|
100
|
+
const authenticatedConfig = useMemo(() => {
|
|
101
|
+
const authToken = accessToken ?? config.authToken;
|
|
102
|
+
return {
|
|
103
|
+
...config,
|
|
104
|
+
apiEndpoint: endpoint,
|
|
105
|
+
authToken
|
|
106
|
+
};
|
|
107
|
+
}, [config, accessToken, endpoint]);
|
|
108
|
+
return /* @__PURE__ */ jsx(DOProvider, { config: authenticatedConfig, initialNamespace, children });
|
|
109
|
+
}
|
|
126
110
|
function AppProviders({ config, children }) {
|
|
127
111
|
const themeMode = config.theme?.mode ?? "system";
|
|
128
112
|
return /* @__PURE__ */ jsx(
|
|
@@ -132,8 +116,8 @@ function AppProviders({ config, children }) {
|
|
|
132
116
|
defaultTheme: themeMode,
|
|
133
117
|
enableSystem: themeMode === "system",
|
|
134
118
|
disableTransitionOnChange: true,
|
|
135
|
-
children: /* @__PURE__ */ jsx(
|
|
136
|
-
|
|
119
|
+
children: /* @__PURE__ */ jsx(DOConfigProvider, { config, children: /* @__PURE__ */ jsx(DOIdentityProvider, { children: /* @__PURE__ */ jsx(
|
|
120
|
+
DOProviderWithState,
|
|
137
121
|
{
|
|
138
122
|
config: config.do,
|
|
139
123
|
initialNamespace: config.defaultNamespace,
|
|
@@ -143,7 +127,54 @@ function AppProviders({ config, children }) {
|
|
|
143
127
|
}
|
|
144
128
|
);
|
|
145
129
|
}
|
|
146
|
-
|
|
130
|
+
function DefaultLandingPage() {
|
|
131
|
+
const { signIn } = useAuth();
|
|
132
|
+
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: [
|
|
133
|
+
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight mb-4", children: "DO Admin" }),
|
|
134
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-8", children: "Sign in to access the admin dashboard and manage your Durable Objects." }),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
"button",
|
|
137
|
+
{
|
|
138
|
+
type: "button",
|
|
139
|
+
onClick: () => signIn(),
|
|
140
|
+
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",
|
|
141
|
+
children: "Sign In"
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] }) });
|
|
145
|
+
}
|
|
146
|
+
function AuthGate({ children }) {
|
|
147
|
+
const { config } = useDOConfig();
|
|
148
|
+
const { user, isLoading } = useAuth();
|
|
149
|
+
const { identity } = config;
|
|
150
|
+
const required = identity.required ?? true;
|
|
151
|
+
const onUnauthenticated = identity.onUnauthenticated ?? "landing";
|
|
152
|
+
if (!required) {
|
|
153
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
154
|
+
}
|
|
155
|
+
if (isLoading) {
|
|
156
|
+
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: [
|
|
157
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }),
|
|
158
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading..." })
|
|
159
|
+
] }) });
|
|
160
|
+
}
|
|
161
|
+
if (user) {
|
|
162
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
163
|
+
}
|
|
164
|
+
switch (onUnauthenticated) {
|
|
165
|
+
case "redirect":
|
|
166
|
+
if (identity.unauthenticatedRedirectUrl && typeof window !== "undefined") {
|
|
167
|
+
window.location.href = identity.unauthenticatedRedirectUrl;
|
|
168
|
+
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..." }) });
|
|
169
|
+
}
|
|
170
|
+
return identity.landingComponent ? /* @__PURE__ */ jsx(Fragment, { children: identity.landingComponent }) : /* @__PURE__ */ jsx(DefaultLandingPage, {});
|
|
171
|
+
case "allow":
|
|
172
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
173
|
+
case "landing":
|
|
174
|
+
default:
|
|
175
|
+
return identity.landingComponent ? /* @__PURE__ */ jsx(Fragment, { children: identity.landingComponent }) : /* @__PURE__ */ jsx(DefaultLandingPage, {});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
147
178
|
function getInitials(name) {
|
|
148
179
|
if (!name) return "?";
|
|
149
180
|
const parts = name.trim().split(/\s+/);
|
|
@@ -152,6 +183,7 @@ function getInitials(name) {
|
|
|
152
183
|
}
|
|
153
184
|
function UserMenu({ compact = false }) {
|
|
154
185
|
const { user, signOut, isLoading } = useAuth();
|
|
186
|
+
const { isMobile } = useSidebar();
|
|
155
187
|
if (isLoading) {
|
|
156
188
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-2", children: [
|
|
157
189
|
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-pulse rounded-full bg-muted" }),
|
|
@@ -185,8 +217,8 @@ function UserMenu({ compact = false }) {
|
|
|
185
217
|
/* @__PURE__ */ jsxs(
|
|
186
218
|
DropdownMenuContent,
|
|
187
219
|
{
|
|
188
|
-
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded
|
|
189
|
-
side: "bottom",
|
|
220
|
+
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded",
|
|
221
|
+
side: isMobile ? "bottom" : "right",
|
|
190
222
|
align: "end",
|
|
191
223
|
sideOffset: 4,
|
|
192
224
|
children: [
|
|
@@ -223,41 +255,82 @@ var navGroups = {
|
|
|
223
255
|
main: [{ title: "Overview", url: "/", icon: Home, routeKey: "overview" }],
|
|
224
256
|
development: [
|
|
225
257
|
{ title: "Agents", url: "/agents", icon: Bot, routeKey: "agents" },
|
|
226
|
-
{
|
|
227
|
-
|
|
228
|
-
|
|
258
|
+
{
|
|
259
|
+
title: "Functions",
|
|
260
|
+
url: "/functions",
|
|
261
|
+
icon: Code,
|
|
262
|
+
routeKey: "functions"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
title: "Workflows",
|
|
266
|
+
url: "/workflows",
|
|
267
|
+
icon: GitBranch,
|
|
268
|
+
routeKey: "workflows"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
title: "Databases",
|
|
272
|
+
url: "/databases",
|
|
273
|
+
icon: Database,
|
|
274
|
+
routeKey: "databases"
|
|
275
|
+
}
|
|
229
276
|
],
|
|
230
277
|
dataModel: [
|
|
231
278
|
{ title: "Things", url: "/things", icon: Shapes, routeKey: "things" },
|
|
232
279
|
{ title: "Nouns", url: "/nouns", icon: BookOpen, routeKey: "nouns" },
|
|
233
280
|
{ title: "Verbs", url: "/verbs", icon: Zap, routeKey: "verbs" },
|
|
234
281
|
{ title: "Actions", url: "/actions", icon: Play, routeKey: "actions" },
|
|
235
|
-
{
|
|
282
|
+
{
|
|
283
|
+
title: "Relationships",
|
|
284
|
+
url: "/relationships",
|
|
285
|
+
icon: Network,
|
|
286
|
+
routeKey: "relationships"
|
|
287
|
+
},
|
|
236
288
|
{ title: "Events", url: "/events", icon: Activity, routeKey: "events" }
|
|
237
289
|
],
|
|
238
290
|
saas: [
|
|
239
|
-
{
|
|
240
|
-
|
|
241
|
-
|
|
291
|
+
{
|
|
292
|
+
title: "Customers",
|
|
293
|
+
url: "/customers",
|
|
294
|
+
icon: Users,
|
|
295
|
+
routeKey: "customers"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
title: "Subscriptions",
|
|
299
|
+
url: "/subscriptions",
|
|
300
|
+
icon: CreditCard,
|
|
301
|
+
routeKey: "subscriptions"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
title: "Integrations",
|
|
305
|
+
url: "/integrations",
|
|
306
|
+
icon: Plug,
|
|
307
|
+
routeKey: "integrations"
|
|
308
|
+
}
|
|
242
309
|
],
|
|
243
310
|
admin: [
|
|
244
311
|
{ title: "Organizations", url: "/orgs", icon: Building, routeKey: "orgs" },
|
|
245
312
|
{ title: "Roles", url: "/roles", icon: Shield, routeKey: "roles" },
|
|
246
313
|
{ title: "Users", url: "/users", icon: UserCog, routeKey: "users" },
|
|
247
314
|
{ title: "API Keys", url: "/api-keys", icon: Key, routeKey: "apiKeys" },
|
|
248
|
-
{
|
|
315
|
+
{
|
|
316
|
+
title: "Settings",
|
|
317
|
+
url: "/settings",
|
|
318
|
+
icon: Settings,
|
|
319
|
+
routeKey: "settings"
|
|
320
|
+
}
|
|
249
321
|
]
|
|
250
322
|
};
|
|
251
323
|
function DOShellNav({ headerContent, ...props }) {
|
|
252
|
-
const
|
|
253
|
-
const { config } =
|
|
254
|
-
const routesConfig =
|
|
324
|
+
const routerState = useRouterState();
|
|
325
|
+
const { config } = useDOConfig();
|
|
326
|
+
const routesConfig = useDORoutes();
|
|
255
327
|
const branding = config.branding;
|
|
328
|
+
const pathname = routerState.location.pathname;
|
|
256
329
|
const isActive = (url) => {
|
|
257
330
|
if (url === "/") {
|
|
258
|
-
return
|
|
331
|
+
return pathname === "/" || pathname === "";
|
|
259
332
|
}
|
|
260
|
-
return
|
|
333
|
+
return pathname.startsWith(url);
|
|
261
334
|
};
|
|
262
335
|
const isRouteEnabled = (routeKey) => {
|
|
263
336
|
if (!routeKey) return true;
|
|
@@ -269,7 +342,7 @@ function DOShellNav({ headerContent, ...props }) {
|
|
|
269
342
|
};
|
|
270
343
|
return /* @__PURE__ */ jsxs(Sidebar, { variant: "inset", ...props, children: [
|
|
271
344
|
/* @__PURE__ */ jsxs(SidebarHeader, { children: [
|
|
272
|
-
/* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, { size: "lg", asChild: true, children: /* @__PURE__ */ jsxs(
|
|
345
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, { size: "lg", asChild: true, children: /* @__PURE__ */ jsxs(Link, { to: "/", children: [
|
|
273
346
|
/* @__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" }) }),
|
|
274
347
|
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
275
348
|
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: branding?.name ?? "DO Admin" }),
|
|
@@ -279,122 +352,149 @@ function DOShellNav({ headerContent, ...props }) {
|
|
|
279
352
|
headerContent
|
|
280
353
|
] }),
|
|
281
354
|
/* @__PURE__ */ jsxs(SidebarContent, { children: [
|
|
282
|
-
/* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.main).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
355
|
+
/* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.main).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
356
|
+
SidebarMenuButton,
|
|
357
|
+
{
|
|
358
|
+
asChild: true,
|
|
359
|
+
isActive: isActive(item.url),
|
|
360
|
+
tooltip: item.title,
|
|
361
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
362
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
363
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
364
|
+
] })
|
|
365
|
+
}
|
|
366
|
+
) }, item.title)) }) }),
|
|
286
367
|
filterNavItems(navGroups.development).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
287
368
|
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Development" }),
|
|
288
|
-
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.development).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
369
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.development).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
370
|
+
SidebarMenuButton,
|
|
371
|
+
{
|
|
372
|
+
asChild: true,
|
|
373
|
+
isActive: isActive(item.url),
|
|
374
|
+
tooltip: item.title,
|
|
375
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
376
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
377
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
378
|
+
] })
|
|
379
|
+
}
|
|
380
|
+
) }, item.title)) })
|
|
292
381
|
] }),
|
|
293
382
|
filterNavItems(navGroups.dataModel).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
294
383
|
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Data Model" }),
|
|
295
|
-
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.dataModel).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
384
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.dataModel).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
385
|
+
SidebarMenuButton,
|
|
386
|
+
{
|
|
387
|
+
asChild: true,
|
|
388
|
+
isActive: isActive(item.url),
|
|
389
|
+
tooltip: item.title,
|
|
390
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
391
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
392
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
393
|
+
] })
|
|
394
|
+
}
|
|
395
|
+
) }, item.title)) })
|
|
299
396
|
] }),
|
|
300
397
|
filterNavItems(navGroups.saas).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
301
398
|
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "SaaS" }),
|
|
302
|
-
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.saas).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
399
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.saas).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
400
|
+
SidebarMenuButton,
|
|
401
|
+
{
|
|
402
|
+
asChild: true,
|
|
403
|
+
isActive: isActive(item.url),
|
|
404
|
+
tooltip: item.title,
|
|
405
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
406
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
407
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
408
|
+
] })
|
|
409
|
+
}
|
|
410
|
+
) }, item.title)) })
|
|
306
411
|
] }),
|
|
307
412
|
filterNavItems(navGroups.admin).length > 0 && /* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
308
413
|
/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Admin" }),
|
|
309
|
-
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.admin).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
414
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: filterNavItems(navGroups.admin).map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
415
|
+
SidebarMenuButton,
|
|
416
|
+
{
|
|
417
|
+
asChild: true,
|
|
418
|
+
isActive: isActive(item.url),
|
|
419
|
+
tooltip: item.title,
|
|
420
|
+
children: /* @__PURE__ */ jsxs(Link, { to: item.url, children: [
|
|
421
|
+
/* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
422
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
423
|
+
] })
|
|
424
|
+
}
|
|
425
|
+
) }, item.title)) })
|
|
313
426
|
] })
|
|
314
427
|
] }),
|
|
315
428
|
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(UserMenu, {}) }) }) })
|
|
316
429
|
] });
|
|
317
430
|
}
|
|
318
|
-
function
|
|
319
|
-
|
|
320
|
-
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: [
|
|
321
|
-
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight mb-4", children: "DO Admin" }),
|
|
322
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-8", children: "Sign in to access the admin dashboard and manage your Durable Objects." }),
|
|
323
|
-
/* @__PURE__ */ jsx(
|
|
324
|
-
"button",
|
|
325
|
-
{
|
|
326
|
-
type: "button",
|
|
327
|
-
onClick: () => signIn(),
|
|
328
|
-
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",
|
|
329
|
-
children: "Sign In"
|
|
330
|
-
}
|
|
331
|
-
)
|
|
332
|
-
] }) });
|
|
333
|
-
}
|
|
334
|
-
function AuthGate({ children }) {
|
|
335
|
-
const { config } = useDOShell();
|
|
336
|
-
const { user, isLoading } = useAuth();
|
|
337
|
-
const { identity } = config;
|
|
338
|
-
const required = identity.required ?? true;
|
|
339
|
-
const onUnauthenticated = identity.onUnauthenticated ?? "landing";
|
|
340
|
-
if (!required) {
|
|
341
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
342
|
-
}
|
|
343
|
-
if (isLoading) {
|
|
344
|
-
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: [
|
|
345
|
-
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }),
|
|
346
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading..." })
|
|
347
|
-
] }) });
|
|
348
|
-
}
|
|
349
|
-
if (user) {
|
|
350
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
351
|
-
}
|
|
352
|
-
switch (onUnauthenticated) {
|
|
353
|
-
case "redirect":
|
|
354
|
-
if (identity.unauthenticatedRedirectUrl && typeof window !== "undefined") {
|
|
355
|
-
window.location.href = identity.unauthenticatedRedirectUrl;
|
|
356
|
-
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..." }) });
|
|
357
|
-
}
|
|
358
|
-
return identity.landingComponent ? /* @__PURE__ */ jsx(Fragment, { children: identity.landingComponent }) : /* @__PURE__ */ jsx(DefaultLandingPage, {});
|
|
359
|
-
case "allow":
|
|
360
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
361
|
-
case "landing":
|
|
362
|
-
default:
|
|
363
|
-
return identity.landingComponent ? /* @__PURE__ */ jsx(Fragment, { children: identity.landingComponent }) : /* @__PURE__ */ jsx(DefaultLandingPage, {});
|
|
364
|
-
}
|
|
431
|
+
function RouterLink({ href, children, className }) {
|
|
432
|
+
return /* @__PURE__ */ jsx(Link, { to: href, className, children });
|
|
365
433
|
}
|
|
366
434
|
function DOShell({
|
|
367
435
|
children,
|
|
368
436
|
sidebarHeaderContent,
|
|
369
437
|
headerContent,
|
|
370
|
-
breadcrumbs
|
|
438
|
+
breadcrumbs: breadcrumbsProp
|
|
371
439
|
}) {
|
|
440
|
+
const autoBreadcrumbs = useBreadcrumbs();
|
|
441
|
+
const breadcrumbs = breadcrumbsProp ?? autoBreadcrumbs;
|
|
372
442
|
return /* @__PURE__ */ jsx(AuthGate, { children: /* @__PURE__ */ jsxs(SidebarProvider, { className: "h-svh!", children: [
|
|
373
443
|
/* @__PURE__ */ jsx(DOShellNav, { headerContent: sidebarHeaderContent }),
|
|
374
444
|
/* @__PURE__ */ jsxs(SidebarInset, { className: "overflow-hidden", children: [
|
|
375
|
-
/* @__PURE__ */ jsxs("header", { className: "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: [
|
|
376
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-4", children: [
|
|
445
|
+
/* @__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: [
|
|
446
|
+
/* @__PURE__ */ jsxs("div", { className: "z-10 flex shrink-0 items-center gap-2 bg-background px-4", children: [
|
|
377
447
|
/* @__PURE__ */ jsx(SidebarTrigger, { className: "-ml-1" }),
|
|
378
448
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mr-2 h-4" }),
|
|
379
|
-
breadcrumbs
|
|
380
|
-
index > 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "/" }),
|
|
381
|
-
crumb.href ? /* @__PURE__ */ jsx(
|
|
382
|
-
"a",
|
|
383
|
-
{
|
|
384
|
-
href: crumb.href,
|
|
385
|
-
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
386
|
-
children: crumb.label
|
|
387
|
-
}
|
|
388
|
-
) : /* @__PURE__ */ jsx("span", { className: "text-foreground", children: crumb.label })
|
|
389
|
-
] }, crumb.label)) })
|
|
449
|
+
breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Breadcrumbs, { items: breadcrumbs, LinkComponent: RouterLink })
|
|
390
450
|
] }),
|
|
391
|
-
headerContent && /* @__PURE__ */ jsx("div", { className: "
|
|
451
|
+
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 }) })
|
|
392
452
|
] }),
|
|
393
|
-
/* @__PURE__ */ jsx("main", { className: "flex-1 overflow-auto
|
|
453
|
+
/* @__PURE__ */ jsx("main", { className: "flex-1 overflow-auto", children })
|
|
394
454
|
] }),
|
|
395
455
|
/* @__PURE__ */ jsx(Toaster, { closeButton: true, position: "top-right" })
|
|
396
456
|
] }) });
|
|
397
457
|
}
|
|
458
|
+
function DatabasesPage() {
|
|
459
|
+
const params = useParams({ strict: false });
|
|
460
|
+
const ns = params.ns;
|
|
461
|
+
const type = params.type;
|
|
462
|
+
return /* @__PURE__ */ jsx(
|
|
463
|
+
DataGridView,
|
|
464
|
+
{
|
|
465
|
+
initialNamespace: ns,
|
|
466
|
+
initialType: type,
|
|
467
|
+
className: "h-full"
|
|
468
|
+
}
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
function DocumentPage() {
|
|
472
|
+
const params = useParams({ strict: false });
|
|
473
|
+
const ns = params.ns;
|
|
474
|
+
const type = params.type;
|
|
475
|
+
const id = params.id;
|
|
476
|
+
const navigate = useNavigate();
|
|
477
|
+
const handleBack = () => {
|
|
478
|
+
navigate({ to: `/things/${ns}/${type}` });
|
|
479
|
+
};
|
|
480
|
+
const handleDelete = () => {
|
|
481
|
+
navigate({ to: `/things/${ns}/${type}` });
|
|
482
|
+
};
|
|
483
|
+
return /* @__PURE__ */ jsx(
|
|
484
|
+
DocumentEditorView,
|
|
485
|
+
{
|
|
486
|
+
initialNamespace: ns,
|
|
487
|
+
initialType: type,
|
|
488
|
+
initialId: id,
|
|
489
|
+
onBack: handleBack,
|
|
490
|
+
onDelete: handleDelete,
|
|
491
|
+
className: "h-full"
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
function FunctionsPage() {
|
|
496
|
+
return /* @__PURE__ */ jsx(FunctionEditorView, { className: "h-full" });
|
|
497
|
+
}
|
|
398
498
|
function StatCard({ title, value, description, icon: Icon, href }) {
|
|
399
499
|
const content = /* @__PURE__ */ jsxs(Card, { className: "hover:bg-muted/50 transition-colors", children: [
|
|
400
500
|
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
@@ -407,13 +507,13 @@ function StatCard({ title, value, description, icon: Icon, href }) {
|
|
|
407
507
|
] })
|
|
408
508
|
] });
|
|
409
509
|
if (href) {
|
|
410
|
-
return /* @__PURE__ */ jsx(
|
|
510
|
+
return /* @__PURE__ */ jsx(Link, { to: href, className: "block", children: content });
|
|
411
511
|
}
|
|
412
512
|
return content;
|
|
413
513
|
}
|
|
414
514
|
function QuickAction({ title, description, icon: Icon, href }) {
|
|
415
515
|
return /* @__PURE__ */ jsxs(
|
|
416
|
-
|
|
516
|
+
Link,
|
|
417
517
|
{
|
|
418
518
|
to: href,
|
|
419
519
|
className: "flex items-center gap-4 rounded-(--radius) border p-4 hover:bg-muted/50 transition-colors",
|
|
@@ -557,11 +657,26 @@ function OverviewPage() {
|
|
|
557
657
|
] }) })
|
|
558
658
|
] });
|
|
559
659
|
}
|
|
660
|
+
function PlaceholderPage({ title, description }) {
|
|
661
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center p-4", children: /* @__PURE__ */ jsxs(Card, { className: "max-w-md", children: [
|
|
662
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "text-center", children: [
|
|
663
|
+
/* @__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" }) }),
|
|
664
|
+
/* @__PURE__ */ jsx(CardTitle, { children: title }),
|
|
665
|
+
/* @__PURE__ */ jsx(CardDescription, { children: description ?? "This feature is coming soon." })
|
|
666
|
+
] }),
|
|
667
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "text-center text-sm text-muted-foreground", children: [
|
|
668
|
+
/* @__PURE__ */ jsx("p", { children: "We're working hard to bring you this functionality." }),
|
|
669
|
+
/* @__PURE__ */ jsx("p", { children: "Check back soon for updates." })
|
|
670
|
+
] })
|
|
671
|
+
] }) });
|
|
672
|
+
}
|
|
560
673
|
function ThingsPage() {
|
|
561
|
-
const {
|
|
674
|
+
const params = useParams({ strict: false });
|
|
675
|
+
const ns = params.ns;
|
|
676
|
+
const type = params.type;
|
|
562
677
|
const navigate = useNavigate();
|
|
563
678
|
const handleOpen = (thing) => {
|
|
564
|
-
navigate(`/things/${thing.ns}/${thing.type}/${thing.id}`);
|
|
679
|
+
navigate({ to: `/things/${thing.ns}/${thing.type}/${thing.id}` });
|
|
565
680
|
};
|
|
566
681
|
return /* @__PURE__ */ jsx(
|
|
567
682
|
DataBrowserView,
|
|
@@ -573,94 +688,208 @@ function ThingsPage() {
|
|
|
573
688
|
}
|
|
574
689
|
);
|
|
575
690
|
}
|
|
576
|
-
function
|
|
577
|
-
const
|
|
691
|
+
function TypedThingsPage({ type }) {
|
|
692
|
+
const navigate = useNavigate();
|
|
693
|
+
const handleOpen = (thing) => {
|
|
694
|
+
navigate({ to: `/things/${thing.ns}/${thing.type}/${thing.id}` });
|
|
695
|
+
};
|
|
578
696
|
return /* @__PURE__ */ jsx(
|
|
579
|
-
|
|
697
|
+
DataBrowserView,
|
|
580
698
|
{
|
|
581
|
-
initialNamespace: ns,
|
|
582
699
|
initialType: type,
|
|
700
|
+
onOpen: handleOpen,
|
|
583
701
|
className: "h-full"
|
|
584
702
|
}
|
|
585
703
|
);
|
|
586
704
|
}
|
|
587
|
-
function
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
705
|
+
function NounsPage() {
|
|
706
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Noun" });
|
|
707
|
+
}
|
|
708
|
+
function VerbsPage() {
|
|
709
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Verb" });
|
|
710
|
+
}
|
|
711
|
+
function ActionsPage() {
|
|
712
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Action" });
|
|
713
|
+
}
|
|
714
|
+
function RelationshipsPage() {
|
|
715
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Relationship" });
|
|
716
|
+
}
|
|
717
|
+
function EventsPage() {
|
|
718
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Event" });
|
|
719
|
+
}
|
|
720
|
+
function CustomersPage() {
|
|
721
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Customer" });
|
|
722
|
+
}
|
|
723
|
+
function SubscriptionsPage() {
|
|
724
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Subscription" });
|
|
725
|
+
}
|
|
726
|
+
function OrgsPage() {
|
|
727
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Org" });
|
|
728
|
+
}
|
|
729
|
+
function RolesPage() {
|
|
730
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "Role" });
|
|
731
|
+
}
|
|
732
|
+
function UsersPage() {
|
|
733
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "User" });
|
|
734
|
+
}
|
|
735
|
+
function APIKeysPage() {
|
|
736
|
+
return /* @__PURE__ */ jsx(TypedThingsPage, { type: "APIKey" });
|
|
737
|
+
}
|
|
738
|
+
var doRoutes = {
|
|
739
|
+
// Main
|
|
740
|
+
overview: {
|
|
741
|
+
path: "/",
|
|
742
|
+
component: OverviewPage
|
|
743
|
+
},
|
|
744
|
+
// Development
|
|
745
|
+
agents: {
|
|
746
|
+
path: "/agents",
|
|
747
|
+
component: () => /* @__PURE__ */ jsx(PlaceholderPage, { title: "Agents", description: "Autonomous AI workers" })
|
|
748
|
+
},
|
|
749
|
+
functions: {
|
|
750
|
+
path: "/functions",
|
|
751
|
+
component: FunctionsPage
|
|
752
|
+
},
|
|
753
|
+
workflows: {
|
|
754
|
+
path: "/workflows",
|
|
755
|
+
component: FunctionsPage
|
|
756
|
+
// Uses FunctionEditorView for now
|
|
757
|
+
},
|
|
758
|
+
databases: {
|
|
759
|
+
path: "/databases",
|
|
760
|
+
component: DatabasesPage
|
|
761
|
+
},
|
|
762
|
+
databasesWithParams: {
|
|
763
|
+
path: "/databases/:ns/:type",
|
|
764
|
+
component: DatabasesPage
|
|
765
|
+
},
|
|
766
|
+
// Data Model
|
|
767
|
+
things: {
|
|
768
|
+
path: "/things",
|
|
769
|
+
component: ThingsPage
|
|
770
|
+
},
|
|
771
|
+
thingsWithNs: {
|
|
772
|
+
path: "/things/:ns",
|
|
773
|
+
component: ThingsPage
|
|
774
|
+
},
|
|
775
|
+
thingsWithType: {
|
|
776
|
+
path: "/things/:ns/:type",
|
|
777
|
+
component: ThingsPage
|
|
778
|
+
},
|
|
779
|
+
document: {
|
|
780
|
+
path: "/things/:ns/:type/:id",
|
|
781
|
+
component: DocumentPage
|
|
782
|
+
},
|
|
783
|
+
nouns: {
|
|
784
|
+
path: "/nouns",
|
|
785
|
+
component: NounsPage
|
|
786
|
+
},
|
|
787
|
+
verbs: {
|
|
788
|
+
path: "/verbs",
|
|
789
|
+
component: VerbsPage
|
|
790
|
+
},
|
|
791
|
+
actions: {
|
|
792
|
+
path: "/actions",
|
|
793
|
+
component: ActionsPage
|
|
794
|
+
},
|
|
795
|
+
relationships: {
|
|
796
|
+
path: "/relationships",
|
|
797
|
+
component: RelationshipsPage
|
|
798
|
+
},
|
|
799
|
+
events: {
|
|
800
|
+
path: "/events",
|
|
801
|
+
component: EventsPage
|
|
802
|
+
},
|
|
803
|
+
// SaaS
|
|
804
|
+
customers: {
|
|
805
|
+
path: "/customers",
|
|
806
|
+
component: CustomersPage
|
|
807
|
+
},
|
|
808
|
+
subscriptions: {
|
|
809
|
+
path: "/subscriptions",
|
|
810
|
+
component: SubscriptionsPage
|
|
811
|
+
},
|
|
812
|
+
integrations: {
|
|
813
|
+
path: "/integrations",
|
|
814
|
+
component: () => /* @__PURE__ */ jsx(
|
|
815
|
+
PlaceholderPage,
|
|
816
|
+
{
|
|
817
|
+
title: "Integrations",
|
|
818
|
+
description: "External service connections"
|
|
819
|
+
}
|
|
820
|
+
)
|
|
821
|
+
},
|
|
822
|
+
// Admin
|
|
823
|
+
orgs: {
|
|
824
|
+
path: "/orgs",
|
|
825
|
+
component: OrgsPage
|
|
826
|
+
},
|
|
827
|
+
roles: {
|
|
828
|
+
path: "/roles",
|
|
829
|
+
component: RolesPage
|
|
830
|
+
},
|
|
831
|
+
users: {
|
|
832
|
+
path: "/users",
|
|
833
|
+
component: UsersPage
|
|
834
|
+
},
|
|
835
|
+
apiKeys: {
|
|
836
|
+
path: "/api-keys",
|
|
837
|
+
component: APIKeysPage
|
|
838
|
+
},
|
|
839
|
+
settings: {
|
|
840
|
+
path: "/settings",
|
|
841
|
+
component: () => /* @__PURE__ */ jsx(PlaceholderPage, { title: "Settings", description: "Application settings" })
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
function DefaultHeaderContent() {
|
|
845
|
+
const { config } = useDOConfig();
|
|
846
|
+
const { endpoint, setEndpoint, recentEndpoints } = useDOState({
|
|
847
|
+
endpoint: config.do.apiEndpoint
|
|
848
|
+
});
|
|
596
849
|
return /* @__PURE__ */ jsx(
|
|
597
|
-
|
|
850
|
+
EndpointSelector,
|
|
598
851
|
{
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
onDelete: handleDelete,
|
|
604
|
-
className: "h-full"
|
|
852
|
+
endpoint,
|
|
853
|
+
onEndpointChange: setEndpoint,
|
|
854
|
+
recentEndpoints,
|
|
855
|
+
className: "w-full max-w-md"
|
|
605
856
|
}
|
|
606
857
|
);
|
|
607
858
|
}
|
|
608
|
-
function
|
|
609
|
-
return
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
/* @__PURE__ */ jsx("p", { children: "We're working hard to bring you this functionality." }),
|
|
620
|
-
/* @__PURE__ */ jsx("p", { children: "Check back soon for updates." })
|
|
621
|
-
] })
|
|
622
|
-
] }) });
|
|
859
|
+
function createShellComponent(headerContent, sidebarHeaderContent) {
|
|
860
|
+
return function ShellLayout() {
|
|
861
|
+
return /* @__PURE__ */ jsx(
|
|
862
|
+
DOShell,
|
|
863
|
+
{
|
|
864
|
+
headerContent: headerContent ?? /* @__PURE__ */ jsx(DefaultHeaderContent, {}),
|
|
865
|
+
sidebarHeaderContent,
|
|
866
|
+
children: /* @__PURE__ */ jsx(WebOutlet, {})
|
|
867
|
+
}
|
|
868
|
+
);
|
|
869
|
+
};
|
|
623
870
|
}
|
|
624
|
-
function DOApp({
|
|
871
|
+
function DOApp({
|
|
872
|
+
config,
|
|
873
|
+
headerContent,
|
|
874
|
+
sidebarHeaderContent
|
|
875
|
+
}) {
|
|
625
876
|
const basePath = config.basePath ?? "";
|
|
626
|
-
|
|
627
|
-
|
|
877
|
+
const router = React.useMemo(() => {
|
|
878
|
+
const ShellComponent = createShellComponent(
|
|
879
|
+
headerContent,
|
|
880
|
+
sidebarHeaderContent
|
|
881
|
+
);
|
|
882
|
+
return createWebRouter(doRoutes, {
|
|
883
|
+
rootComponent: ShellComponent,
|
|
884
|
+
basepath: basePath || void 0
|
|
885
|
+
});
|
|
886
|
+
}, [basePath, headerContent, sidebarHeaderContent]);
|
|
887
|
+
return /* @__PURE__ */ jsx(AppProviders, { config, children: /* @__PURE__ */ jsx(
|
|
888
|
+
RouterProvider,
|
|
628
889
|
{
|
|
629
|
-
|
|
630
|
-
element: /* @__PURE__ */ jsx(
|
|
631
|
-
DOShell,
|
|
632
|
-
{
|
|
633
|
-
headerContent,
|
|
634
|
-
sidebarHeaderContent
|
|
635
|
-
}
|
|
636
|
-
),
|
|
637
|
-
children: [
|
|
638
|
-
/* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(OverviewPage, {}) }),
|
|
639
|
-
/* @__PURE__ */ jsx(Route, { path: "agents", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Agents", description: "Autonomous AI workers" }) }),
|
|
640
|
-
/* @__PURE__ */ jsx(Route, { path: "functions", element: /* @__PURE__ */ jsx(FunctionsPage, {}) }),
|
|
641
|
-
/* @__PURE__ */ jsx(Route, { path: "workflows", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Workflows", description: "Business process orchestration" }) }),
|
|
642
|
-
/* @__PURE__ */ jsx(Route, { path: "databases", element: /* @__PURE__ */ jsx(DatabasesPage, {}) }),
|
|
643
|
-
/* @__PURE__ */ jsx(Route, { path: "databases/:ns/:type", element: /* @__PURE__ */ jsx(DatabasesPage, {}) }),
|
|
644
|
-
/* @__PURE__ */ jsx(Route, { path: "things", element: /* @__PURE__ */ jsx(ThingsPage, {}) }),
|
|
645
|
-
/* @__PURE__ */ jsx(Route, { path: "things/:ns", element: /* @__PURE__ */ jsx(ThingsPage, {}) }),
|
|
646
|
-
/* @__PURE__ */ jsx(Route, { path: "things/:ns/:type", element: /* @__PURE__ */ jsx(ThingsPage, {}) }),
|
|
647
|
-
/* @__PURE__ */ jsx(Route, { path: "things/:ns/:type/:id", element: /* @__PURE__ */ jsx(DocumentPage, {}) }),
|
|
648
|
-
/* @__PURE__ */ jsx(Route, { path: "nouns", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Nouns", description: "Semantic entities and concepts" }) }),
|
|
649
|
-
/* @__PURE__ */ jsx(Route, { path: "verbs", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Verbs", description: "Actions and operations" }) }),
|
|
650
|
-
/* @__PURE__ */ jsx(Route, { path: "actions", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Actions", description: "Executable operations" }) }),
|
|
651
|
-
/* @__PURE__ */ jsx(Route, { path: "relationships", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Relationships", description: "Entity connections and graph" }) }),
|
|
652
|
-
/* @__PURE__ */ jsx(Route, { path: "events", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Events", description: "Operation log and semantic events" }) }),
|
|
653
|
-
/* @__PURE__ */ jsx(Route, { path: "customers", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Customers", description: "Customer management" }) }),
|
|
654
|
-
/* @__PURE__ */ jsx(Route, { path: "subscriptions", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Subscriptions", description: "Subscription management" }) }),
|
|
655
|
-
/* @__PURE__ */ jsx(Route, { path: "integrations", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Integrations", description: "External service connections" }) }),
|
|
656
|
-
/* @__PURE__ */ jsx(Route, { path: "orgs", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Organizations", description: "Organization management" }) }),
|
|
657
|
-
/* @__PURE__ */ jsx(Route, { path: "roles", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Roles", description: "Role-based access control" }) }),
|
|
658
|
-
/* @__PURE__ */ jsx(Route, { path: "users", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Users", description: "User management" }) }),
|
|
659
|
-
/* @__PURE__ */ jsx(Route, { path: "api-keys", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "API Keys", description: "API key management" }) }),
|
|
660
|
-
/* @__PURE__ */ jsx(Route, { path: "settings", element: /* @__PURE__ */ jsx(PlaceholderPage, { title: "Settings", description: "Application settings" }) })
|
|
661
|
-
]
|
|
890
|
+
router
|
|
662
891
|
}
|
|
663
|
-
) })
|
|
892
|
+
) });
|
|
664
893
|
}
|
|
665
894
|
var DatabaseRouteParams = z.object({
|
|
666
895
|
ns: z.string().optional(),
|
|
@@ -710,6 +939,6 @@ var doRoutePaths = {
|
|
|
710
939
|
settings: "/settings"
|
|
711
940
|
};
|
|
712
941
|
|
|
713
|
-
export { AppProviders, AuthGate, DOApp,
|
|
714
|
-
//# sourceMappingURL=chunk-
|
|
715
|
-
//# sourceMappingURL=chunk-
|
|
942
|
+
export { AppProviders, AuthGate, DOApp, DOConfigProvider, DOIdentityProvider, DOShell, DOShellNav, DatabaseRouteParams, DatabasesPage, DocumentPage, DocumentRouteParams, FunctionsPage, OverviewPage, PlaceholderPage, ThingsPage, ThingsRouteParams, TypeFilteredRouteParams, UserMenu, doRoutePaths, useDOConfig, useDOCustomRoutes, useDORoutes, useIdentity };
|
|
943
|
+
//# sourceMappingURL=chunk-IQ23B4ME.js.map
|
|
944
|
+
//# sourceMappingURL=chunk-IQ23B4ME.js.map
|