@mdxui/do 3.0.0 → 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.
Files changed (52) hide show
  1. package/README.md +80 -275
  2. package/dist/app/index.d.ts +125 -125
  3. package/dist/app/index.js +8 -7
  4. package/dist/breadcrumbs-C9Qn3S7d.d.ts +81 -0
  5. package/dist/capnweb-client-Bq78FtEA.d.ts +229 -0
  6. package/dist/chunk-3XKYQRXY.js +192 -0
  7. package/dist/chunk-3XKYQRXY.js.map +1 -0
  8. package/dist/{chunk-JWKIONEO.js → chunk-5SHZZC7L.js} +3 -3
  9. package/dist/{chunk-JWKIONEO.js.map → chunk-5SHZZC7L.js.map} +1 -1
  10. package/dist/{chunk-YGIBMNRH.js → chunk-7UFINK3Q.js} +30 -27
  11. package/dist/chunk-7UFINK3Q.js.map +1 -0
  12. package/dist/{chunk-5AWTQDRF.js → chunk-JJLAES6W.js} +2 -2
  13. package/dist/{chunk-5AWTQDRF.js.map → chunk-JJLAES6W.js.map} +1 -1
  14. package/dist/{chunk-NTSEARBC.js → chunk-KT52UU3U.js} +473 -203
  15. package/dist/chunk-KT52UU3U.js.map +1 -0
  16. package/dist/{chunk-EQVOEEQO.js → chunk-LJIWB7KE.js} +2 -2
  17. package/dist/{chunk-EQVOEEQO.js.map → chunk-LJIWB7KE.js.map} +1 -1
  18. package/dist/{chunk-IESVTECE.js → chunk-NA652ART.js} +64 -4
  19. package/dist/chunk-NA652ART.js.map +1 -0
  20. package/dist/chunk-OVLO7UOH.js +1071 -0
  21. package/dist/chunk-OVLO7UOH.js.map +1 -0
  22. package/dist/chunk-WMNT4OIE.js +249 -0
  23. package/dist/chunk-WMNT4OIE.js.map +1 -0
  24. package/dist/components/index.d.ts +20 -1
  25. package/dist/components/index.js +2 -1
  26. package/dist/{config-CmZBQQaT.d.ts → config-CxvpD8Y6.d.ts} +2 -13
  27. package/dist/{do-C-t9UgjT.d.ts → do-D27i5bU0.d.ts} +2 -1
  28. package/dist/{errors-B4Oyyj4Z.d.ts → errors-DratdVIz.d.ts} +1 -1
  29. package/dist/hooks/index.d.ts +30 -3
  30. package/dist/hooks/index.js +4 -4
  31. package/dist/hooks/things/index.d.ts +2 -2
  32. package/dist/hooks/things/index.js +3 -3
  33. package/dist/index.d.ts +76 -14
  34. package/dist/index.js +9 -8
  35. package/dist/lib/index.d.ts +703 -5
  36. package/dist/lib/index.js +2 -2
  37. package/dist/providers/index.d.ts +7 -123
  38. package/dist/providers/index.js +2 -2
  39. package/dist/{query-keys-BC901wog.d.ts → query-keys-CZNFikIi.d.ts} +3 -3
  40. package/dist/schemas/index.d.ts +5 -5
  41. package/dist/{thing-BVhCTzOi.d.ts → thing-BF25aUtJ.d.ts} +68 -68
  42. package/dist/types/index.d.ts +445 -445
  43. package/dist/views/index.d.ts +1 -1
  44. package/dist/views/index.js +6 -6
  45. package/package.json +2 -2
  46. package/dist/chunk-FO3N7SXV.js +0 -469
  47. package/dist/chunk-FO3N7SXV.js.map +0 -1
  48. package/dist/chunk-IESVTECE.js.map +0 -1
  49. package/dist/chunk-NTSEARBC.js.map +0 -1
  50. package/dist/chunk-OWEAW4U6.js +0 -116
  51. package/dist/chunk-OWEAW4U6.js.map +0 -1
  52. package/dist/chunk-YGIBMNRH.js.map +0 -1
@@ -1,14 +1,51 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { ReactNode } from 'react';
4
- import { d as DOShellConfig, e as DOShellContextValue } from '../config-CmZBQQaT.js';
4
+ import { d as DOShellConfig, c as DOCustomRoute } from '../config-CxvpD8Y6.js';
5
+ import { a as BreadcrumbItemConfig } from '../breadcrumbs-C9Qn3S7d.js';
5
6
  import { Sidebar } from '@mdxui/primitives';
6
7
  import { useAuth } from '@workos-inc/authkit-react';
7
8
  export { DOClient, DOContextValue, DOProvider, DOProviderProps, useDO, useDOClient, useDOUrls, useDataProviderSafe, useSyncStatus } from '../providers/index.js';
8
9
  export { useQueryClient } from '@tanstack/react-query';
9
10
  import { z } from 'zod';
10
- import '../do-C-t9UgjT.js';
11
+ import '../do-D27i5bU0.js';
11
12
  import '@mdxui/app';
13
+ import '../capnweb-client-Bq78FtEA.js';
14
+
15
+ /**
16
+ * DatabasesPage - Renders DataGridView with route params
17
+ *
18
+ * Route: /databases/:ns?/:type?
19
+ */
20
+ declare function DatabasesPage(): react_jsx_runtime.JSX.Element;
21
+
22
+ /**
23
+ * DocumentPage - Renders DocumentEditorView with route params
24
+ *
25
+ * Route: /things/$ns/$type/$id
26
+ */
27
+ declare function DocumentPage(): react_jsx_runtime.JSX.Element;
28
+
29
+ /**
30
+ * FunctionsPage - Renders FunctionEditorView
31
+ *
32
+ * Route: /functions
33
+ */
34
+ declare function FunctionsPage(): react_jsx_runtime.JSX.Element;
35
+
36
+ /**
37
+ * OverviewPage - Main dashboard landing page
38
+ *
39
+ * Shows stats, quick actions, and recent activity.
40
+ */
41
+ declare function OverviewPage(): react_jsx_runtime.JSX.Element;
42
+
43
+ /**
44
+ * ThingsPage - Renders DataBrowserView with route params
45
+ *
46
+ * Route: /things/$ns?/$type?
47
+ */
48
+ declare function ThingsPage(): react_jsx_runtime.JSX.Element;
12
49
 
13
50
  interface DOAppProps {
14
51
  /** Shell configuration */
@@ -52,76 +89,28 @@ interface DOAppProps {
52
89
  * }
53
90
  * ```
54
91
  */
55
- declare function DOApp({ config, headerContent, sidebarHeaderContent }: DOAppProps): react_jsx_runtime.JSX.Element;
92
+ declare function DOApp({ config, headerContent, sidebarHeaderContent, }: DOAppProps): react_jsx_runtime.JSX.Element;
56
93
 
57
- interface DOShellProps {
58
- /** Optional children to render instead of using Outlet */
59
- children?: React.ReactNode;
60
- /** Optional header content for the sidebar */
61
- sidebarHeaderContent?: React.ReactNode;
62
- /** Optional content to render in the header after breadcrumbs */
63
- headerContent?: React.ReactNode;
64
- /** Breadcrumb items to display (future enhancement) */
65
- breadcrumbs?: Array<{
66
- label: string;
67
- href?: string;
68
- }>;
94
+ interface AppProvidersProps {
95
+ config: DOShellConfig;
96
+ children: ReactNode;
69
97
  }
70
98
  /**
71
- * DOShell - Main layout wrapper for the DO Admin Dashboard.
72
- *
73
- * This layout provides:
74
- * - Authentication gate (shows landing page if not authenticated)
75
- * - A collapsible sidebar with navigation on the left
76
- * - A main content area with a header containing breadcrumbs
77
- * - Toast notifications via Sonner
78
- * - Responsive design that works on mobile and desktop
79
- *
80
- * The layout uses react-router-dom's Outlet for nested routes.
99
+ * AppProviders - Composed provider hierarchy for DOShell
81
100
  *
82
101
  * @example
83
102
  * ```tsx
84
- * // As a route layout using Outlet
85
- * <DOShell />
86
- *
87
- * // With custom children
88
- * <DOShell>
89
- * <CustomContent />
90
- * </DOShell>
91
- *
92
- * // With header content
93
- * <DOShell headerContent={<SearchBar />} />
103
+ * <AppProviders
104
+ * config={{
105
+ * do: { apiEndpoint: '...', authMethod: 'jwt', bindings: [], realTimeUpdates: true },
106
+ * identity: { clientId: 'client_xxx', devMode: true },
107
+ * }}
108
+ * >
109
+ * <DOShell />
110
+ * </AppProviders>
94
111
  * ```
95
112
  */
96
- declare function DOShell({ children, sidebarHeaderContent, headerContent, breadcrumbs, }: DOShellProps): react_jsx_runtime.JSX.Element;
97
-
98
- interface DOShellNavProps extends React.ComponentProps<typeof Sidebar> {
99
- /** Optional header content to display at the top of the sidebar */
100
- headerContent?: React.ReactNode;
101
- }
102
- /**
103
- * DOShellNav - Sidebar navigation component for the DO Shell.
104
- *
105
- * Features:
106
- * - Highlights active route based on current location
107
- * - Uses lucide-react icons for each navigation item
108
- * - Collapsible on mobile via the Sidebar component
109
- * - Supports custom header content
110
- * - Routes can be enabled/disabled via config
111
- */
112
- declare function DOShellNav({ headerContent, ...props }: DOShellNavProps): react_jsx_runtime.JSX.Element;
113
-
114
- interface UserMenuProps {
115
- /** Whether to show in compact mode (icon only) */
116
- compact?: boolean;
117
- }
118
- /**
119
- * UserMenu - User dropdown with profile info and sign out
120
- *
121
- * Displays the current user's avatar and name, with options for
122
- * settings and signing out.
123
- */
124
- declare function UserMenu({ compact }: UserMenuProps): react_jsx_runtime.JSX.Element | null;
113
+ declare function AppProviders({ config, children }: AppProvidersProps): react_jsx_runtime.JSX.Element;
125
114
 
126
115
  interface AuthGateProps {
127
116
  children: ReactNode;
@@ -134,53 +123,87 @@ interface AuthGateProps {
134
123
  */
135
124
  declare function AuthGate({ children }: AuthGateProps): react_jsx_runtime.JSX.Element;
136
125
 
137
- interface DOShellProviderProps {
126
+ /**
127
+ * Static config context value (no state, just config)
128
+ */
129
+ interface DOConfigContextValue {
130
+ /** Merged shell configuration */
131
+ config: DOShellConfig;
132
+ }
133
+ interface DOConfigProviderProps {
138
134
  config: DOShellConfig;
139
135
  children: ReactNode;
140
136
  }
141
137
  /**
142
- * DOShellProvider - Context provider for DOShell configuration
138
+ * DOConfigProvider - Provides static shell configuration
143
139
  *
144
- * Provides shell configuration to all child components.
145
- * Should be used inside the DOAppProviders composition.
140
+ * This is a minimal context for static config only.
141
+ * Dynamic state (endpoint, namespace) is managed via TanStack Query.
146
142
  */
147
- declare function DOShellProvider({ config, children }: DOShellProviderProps): react_jsx_runtime.JSX.Element;
143
+ declare function DOConfigProvider({ config, children }: DOConfigProviderProps): react_jsx_runtime.JSX.Element;
148
144
  /**
149
- * Hook to access DOShell configuration
145
+ * Hook to access static shell configuration
150
146
  */
151
- declare function useDOShell(): DOShellContextValue;
147
+ declare function useDOConfig(): DOConfigContextValue;
152
148
  /**
153
149
  * Hook to access enabled routes configuration
154
150
  */
155
- declare function useDOShellRoutes(): Partial<Record<string, boolean>>;
151
+ declare function useDORoutes(): Partial<Record<string, boolean>>;
152
+ /**
153
+ * Hook to access custom routes
154
+ */
155
+ declare function useDOCustomRoutes(): DOCustomRoute[];
156
156
 
157
- interface AppProvidersProps {
158
- config: DOShellConfig;
159
- children: ReactNode;
157
+ interface DOShellProps {
158
+ /** Children to render in the main content area (typically TanStack Router Outlet) */
159
+ children: React.ReactNode;
160
+ /** Optional header content for the sidebar */
161
+ sidebarHeaderContent?: React.ReactNode;
162
+ /** Optional content to render in the header after breadcrumbs */
163
+ headerContent?: React.ReactNode;
164
+ /**
165
+ * Breadcrumb items to display.
166
+ * If not provided, auto-generates from current route.
167
+ * Pass empty array to disable breadcrumbs.
168
+ */
169
+ breadcrumbs?: BreadcrumbItemConfig[];
160
170
  }
161
171
  /**
162
- * AppProviders - Composed provider hierarchy for DOShell
172
+ * DOShell - Main layout wrapper for the DO Admin Dashboard.
173
+ *
174
+ * This layout provides:
175
+ * - Authentication gate (shows landing page if not authenticated)
176
+ * - A collapsible sidebar with navigation on the left
177
+ * - A main content area with a header containing breadcrumbs
178
+ * - Toast notifications via Sonner
179
+ * - Responsive design that works on mobile and desktop
163
180
  *
164
- * Provider hierarchy:
165
- * - ThemeProvider (next-themes) - Theme mode (light/dark/system)
166
- * - DOShellProvider - Shell config context
167
- * - DOIdentityProvider - WorkOS AuthKit authentication
168
- * - DOProvider - RPC client, namespace, TanStack Query
181
+ * Uses TanStack Router for navigation.
169
182
  *
170
183
  * @example
171
184
  * ```tsx
172
- * <AppProviders
173
- * config={{
174
- * do: { apiEndpoint: '...', authMethod: 'jwt', bindings: [], realTimeUpdates: true },
175
- * identity: { clientId: 'client_xxx', devMode: true },
176
- * }}
177
- * >
178
- * <DOShell />
179
- * </AppProviders>
185
+ * <DOShell headerContent={<SearchBar />}>
186
+ * <Outlet />
187
+ * </DOShell>
180
188
  * ```
181
189
  */
182
- declare function AppProviders({ config, children }: AppProvidersProps): react_jsx_runtime.JSX.Element;
183
- declare const DOAppProviders: typeof AppProviders;
190
+ declare function DOShell({ children, sidebarHeaderContent, headerContent, breadcrumbs: breadcrumbsProp, }: DOShellProps): react_jsx_runtime.JSX.Element;
191
+
192
+ interface DOShellNavProps extends React.ComponentProps<typeof Sidebar> {
193
+ /** Optional header content to display at the top of the sidebar */
194
+ headerContent?: React.ReactNode;
195
+ }
196
+ /**
197
+ * DOShellNav - Sidebar navigation component for the DO Shell.
198
+ *
199
+ * Features:
200
+ * - Highlights active route based on current location
201
+ * - Uses lucide-react icons for each navigation item
202
+ * - Collapsible on mobile via the Sidebar component
203
+ * - Supports custom header content
204
+ * - Routes can be enabled/disabled via config
205
+ */
206
+ declare function DOShellNav({ headerContent, ...props }: DOShellNavProps): react_jsx_runtime.JSX.Element;
184
207
 
185
208
  /**
186
209
  * Hook to access identity/auth state.
@@ -197,40 +220,17 @@ interface DOIdentityProviderProps {
197
220
  */
198
221
  declare function DOIdentityProvider({ children }: DOIdentityProviderProps): react_jsx_runtime.JSX.Element;
199
222
 
223
+ interface UserMenuProps {
224
+ /** Whether to show in compact mode (icon only) */
225
+ compact?: boolean;
226
+ }
200
227
  /**
201
- * OverviewPage - Main dashboard landing page
202
- *
203
- * Shows stats, quick actions, and recent activity.
204
- */
205
- declare function OverviewPage(): react_jsx_runtime.JSX.Element;
206
-
207
- /**
208
- * ThingsPage - Renders DataBrowserView with route params
209
- *
210
- * Route: /things/:ns?/:type?
211
- */
212
- declare function ThingsPage(): react_jsx_runtime.JSX.Element;
213
-
214
- /**
215
- * DatabasesPage - Renders DataGridView with route params
216
- *
217
- * Route: /databases/:ns?/:type?
218
- */
219
- declare function DatabasesPage(): react_jsx_runtime.JSX.Element;
220
-
221
- /**
222
- * DocumentPage - Renders DocumentEditorView with route params
223
- *
224
- * Route: /things/:ns/:type/:id
225
- */
226
- declare function DocumentPage(): react_jsx_runtime.JSX.Element;
227
-
228
- /**
229
- * FunctionsPage - Renders FunctionEditorView
228
+ * UserMenu - User dropdown with profile info and sign out
230
229
  *
231
- * Route: /functions
230
+ * Displays the current user's avatar and name, with options for
231
+ * settings and signing out.
232
232
  */
233
- declare function FunctionsPage(): react_jsx_runtime.JSX.Element;
233
+ declare function UserMenu({ compact }: UserMenuProps): react_jsx_runtime.JSX.Element | null;
234
234
 
235
235
  interface PlaceholderPageProps {
236
236
  /** Title for the page */
@@ -285,13 +285,13 @@ declare const DocumentRouteParams: z.ZodObject<{
285
285
  type: z.ZodString;
286
286
  id: z.ZodString;
287
287
  }, "strip", z.ZodTypeAny, {
288
+ id: string;
288
289
  type: string;
289
290
  ns: string;
290
- id: string;
291
291
  }, {
292
+ id: string;
292
293
  type: string;
293
294
  ns: string;
294
- id: string;
295
295
  }>;
296
296
  type DocumentRouteParamsType = z.infer<typeof DocumentRouteParams>;
297
297
  /**
@@ -344,4 +344,4 @@ declare const doRoutePaths: {
344
344
  };
345
345
  type DORoutePath = typeof doRoutePaths[keyof typeof doRoutePaths];
346
346
 
347
- export { AppProviders, type AppProvidersProps, AuthGate, type AuthGateProps, DOApp, type DOAppProps, DOAppProviders, DOIdentityProvider, type DOIdentityProviderProps, type DORoutePath, DOShell, DOShellNav, type DOShellNavProps, type DOShellProps, DOShellProvider, DatabaseRouteParams, type DatabaseRouteParamsType, DatabasesPage, DocumentPage, DocumentRouteParams, type DocumentRouteParamsType, FunctionsPage, OverviewPage, PlaceholderPage, ThingsPage, ThingsRouteParams, type ThingsRouteParamsType, TypeFilteredRouteParams, type TypeFilteredRouteParamsType, UserMenu, doRoutePaths, useDOShell, useDOShellRoutes, useIdentity };
347
+ export { AppProviders, type AppProvidersProps, AuthGate, type AuthGateProps, DOApp, type DOAppProps, type DOConfigContextValue, DOConfigProvider, DOIdentityProvider, type DOIdentityProviderProps, type DORoutePath, DOShell, DOShellNav, type DOShellNavProps, type DOShellProps, DatabaseRouteParams, type DatabaseRouteParamsType, DatabasesPage, DocumentPage, DocumentRouteParams, type DocumentRouteParamsType, FunctionsPage, OverviewPage, PlaceholderPage, ThingsPage, ThingsRouteParams, type ThingsRouteParamsType, TypeFilteredRouteParams, type TypeFilteredRouteParamsType, UserMenu, doRoutePaths, useDOConfig, useDOCustomRoutes, useDORoutes, useIdentity };
package/dist/app/index.js CHANGED
@@ -1,12 +1,13 @@
1
- export { AppProviders, AuthGate, DOApp, DOAppProviders, DOIdentityProvider, DOShell, DOShellNav, DOShellProvider, DatabaseRouteParams, DatabasesPage, DocumentPage, DocumentRouteParams, FunctionsPage, OverviewPage, PlaceholderPage, ThingsPage, ThingsRouteParams, TypeFilteredRouteParams, UserMenu, doRoutePaths, useDOShell, useDOShellRoutes, useIdentity } from '../chunk-NTSEARBC.js';
2
- import '../chunk-YGIBMNRH.js';
3
- import '../chunk-5AWTQDRF.js';
1
+ export { AppProviders, AuthGate, DOApp, DOConfigProvider, DOIdentityProvider, DOShell, DOShellNav, DatabaseRouteParams, DatabasesPage, DocumentPage, DocumentRouteParams, FunctionsPage, OverviewPage, PlaceholderPage, ThingsPage, ThingsRouteParams, TypeFilteredRouteParams, UserMenu, doRoutePaths, useDOConfig, useDOCustomRoutes, useDORoutes, useIdentity } from '../chunk-KT52UU3U.js';
2
+ import '../chunk-7UFINK3Q.js';
3
+ import '../chunk-JJLAES6W.js';
4
4
  import '../chunk-GKSP5RIA.js';
5
- import '../chunk-IESVTECE.js';
6
- import '../chunk-JWKIONEO.js';
5
+ import '../chunk-NA652ART.js';
6
+ import '../chunk-5SHZZC7L.js';
7
7
  import '../chunk-4KXVN3EQ.js';
8
- export { DOProvider, useDO, useDOClient, useDOUrls, useDataProviderSafe, useQueryClient, useSyncStatus } from '../chunk-FO3N7SXV.js';
9
- import '../chunk-OWEAW4U6.js';
8
+ export { DOProvider, useDO, useDOClient, useDOUrls, useDataProviderSafe, useQueryClient, useSyncStatus } from '../chunk-WMNT4OIE.js';
9
+ import '../chunk-OVLO7UOH.js';
10
+ import '../chunk-3XKYQRXY.js';
10
11
  import '../chunk-Y52IEYVM.js';
11
12
  import '../chunk-GGO5GW72.js';
12
13
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,81 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ /**
5
+ * Props for the Link component
6
+ */
7
+ interface BreadcrumbLinkProps {
8
+ href: string;
9
+ children: React.ReactNode;
10
+ className?: string;
11
+ onClick?: () => void;
12
+ }
13
+ /**
14
+ * Single breadcrumb item configuration
15
+ */
16
+ interface BreadcrumbItemConfig {
17
+ /** Display label */
18
+ label: string;
19
+ /** Route path - last item should not have href */
20
+ href?: string;
21
+ }
22
+ /**
23
+ * Props for the Breadcrumbs component
24
+ */
25
+ interface BreadcrumbsProps {
26
+ /** Array of breadcrumb items */
27
+ items: BreadcrumbItemConfig[];
28
+ /** Custom link component (e.g., Next.js Link, TanStack Link) */
29
+ LinkComponent?: React.ComponentType<BreadcrumbLinkProps>;
30
+ /** Additional class names */
31
+ className?: string;
32
+ /** Maximum items to show before collapsing */
33
+ maxItems?: number;
34
+ /** Custom separator element */
35
+ separator?: React.ReactNode;
36
+ }
37
+ /**
38
+ * Breadcrumbs provides navigation context showing the user's location.
39
+ *
40
+ * Features:
41
+ * - Router-agnostic - works with any Link component
42
+ * - Automatic collapse with dropdown for long paths
43
+ * - Accessible breadcrumb semantics
44
+ * - Custom separator support
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * // With default anchor tags
49
+ * <Breadcrumbs
50
+ * items={[
51
+ * { label: 'Home', href: '/' },
52
+ * { label: 'Users', href: '/users' },
53
+ * { label: 'John Doe' },
54
+ * ]}
55
+ * />
56
+ *
57
+ * // With TanStack Router Link
58
+ * import { Link } from '@tanstack/react-router'
59
+ *
60
+ * <Breadcrumbs
61
+ * items={breadcrumbItems}
62
+ * LinkComponent={({ href, children, className }) => (
63
+ * <Link to={href} className={className}>{children}</Link>
64
+ * )}
65
+ * />
66
+ *
67
+ * // With Next.js Link
68
+ * import NextLink from 'next/link'
69
+ *
70
+ * <Breadcrumbs
71
+ * items={breadcrumbItems}
72
+ * LinkComponent={NextLink}
73
+ * />
74
+ * ```
75
+ */
76
+ declare function Breadcrumbs({ items, LinkComponent, className, maxItems, separator, }: BreadcrumbsProps): react_jsx_runtime.JSX.Element | null;
77
+ declare namespace Breadcrumbs {
78
+ var displayName: string;
79
+ }
80
+
81
+ export { type BreadcrumbLinkProps as B, type BreadcrumbItemConfig as a, type BreadcrumbsProps as b, Breadcrumbs as c };
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Cap'n Web Client Wrapper for DO Admin API
3
+ *
4
+ * This wraps the raw capnweb HTTP batch client to provide a structured interface
5
+ * matching the DOClient interface (client.Thing.list, client.Schema.discover, etc.)
6
+ *
7
+ * @module
8
+ */
9
+ /** SQL execution result */
10
+ interface SQLResult {
11
+ rows: Record<string, unknown>[];
12
+ columns: {
13
+ name: string;
14
+ type: string;
15
+ }[];
16
+ rowsAffected?: number;
17
+ executionTimeMs?: number;
18
+ }
19
+ interface CapnwebClientOptions {
20
+ /** Auth token to include in Authorization header */
21
+ authToken?: string;
22
+ }
23
+ /**
24
+ * Create a Cap'n Web client that matches the DOClient interface
25
+ *
26
+ * @param baseUrl - The base URL for the RPC endpoint
27
+ * @param options - Client options including auth token
28
+ */
29
+ declare function createCapnwebClient(baseUrl: string, options?: CapnwebClientOptions): {
30
+ /**
31
+ * Namespace operations
32
+ */
33
+ Namespace: {
34
+ list(_params?: {
35
+ includeSystem?: boolean;
36
+ }): Promise<{
37
+ id: string;
38
+ name: string;
39
+ }[]>;
40
+ };
41
+ /**
42
+ * Schema operations
43
+ */
44
+ Schema: {
45
+ discover(_params?: {
46
+ ns?: string;
47
+ }): Promise<{
48
+ namespaces: string[];
49
+ types: string[];
50
+ schemas: string[];
51
+ }>;
52
+ get(params: {
53
+ ns?: string;
54
+ type: string;
55
+ }): Promise<unknown>;
56
+ };
57
+ /**
58
+ * Thing operations
59
+ */
60
+ Thing: {
61
+ types(params: {
62
+ ns?: string;
63
+ includeSystem?: boolean;
64
+ }): Promise<{
65
+ name: string;
66
+ ns: string;
67
+ }[]>;
68
+ list(params: {
69
+ ns?: string;
70
+ type?: string;
71
+ limit?: number;
72
+ offset?: number;
73
+ }): Promise<{
74
+ data: unknown[];
75
+ total: number;
76
+ }>;
77
+ get(params: {
78
+ ns?: string;
79
+ type: string;
80
+ id: string;
81
+ }): Promise<unknown>;
82
+ create(params: {
83
+ ns?: string;
84
+ type: string;
85
+ data: unknown;
86
+ }): Promise<unknown>;
87
+ update(params: {
88
+ ns?: string;
89
+ type: string;
90
+ id: string;
91
+ data: unknown;
92
+ }): Promise<unknown>;
93
+ delete(params: {
94
+ ns?: string;
95
+ type: string;
96
+ id: string;
97
+ hard?: boolean;
98
+ }): Promise<{
99
+ success: boolean;
100
+ }>;
101
+ versions(_params: {
102
+ ns?: string;
103
+ type: string;
104
+ id: string;
105
+ }): Promise<never[]>;
106
+ stats(_params: {
107
+ ns?: string;
108
+ type?: string;
109
+ }): Promise<{
110
+ total: number;
111
+ byType: Record<string, number>;
112
+ }>;
113
+ };
114
+ /**
115
+ * SQL operations (not supported by capnweb servers)
116
+ */
117
+ SQL: {
118
+ execute(_params: {
119
+ query: string;
120
+ params?: unknown[];
121
+ }): Promise<SQLResult>;
122
+ };
123
+ dup: () => /*elided*/ any;
124
+ onRpcBroken: (callback: (error: unknown) => void) => void;
125
+ [Symbol.dispose]: () => void;
126
+ };
127
+ /**
128
+ * Create a capnweb client context - factory function matching DOClient interface
129
+ */
130
+ declare function $CapnwebContext(url: string, options?: CapnwebClientOptions): {
131
+ /**
132
+ * Namespace operations
133
+ */
134
+ Namespace: {
135
+ list(_params?: {
136
+ includeSystem?: boolean;
137
+ }): Promise<{
138
+ id: string;
139
+ name: string;
140
+ }[]>;
141
+ };
142
+ /**
143
+ * Schema operations
144
+ */
145
+ Schema: {
146
+ discover(_params?: {
147
+ ns?: string;
148
+ }): Promise<{
149
+ namespaces: string[];
150
+ types: string[];
151
+ schemas: string[];
152
+ }>;
153
+ get(params: {
154
+ ns?: string;
155
+ type: string;
156
+ }): Promise<unknown>;
157
+ };
158
+ /**
159
+ * Thing operations
160
+ */
161
+ Thing: {
162
+ types(params: {
163
+ ns?: string;
164
+ includeSystem?: boolean;
165
+ }): Promise<{
166
+ name: string;
167
+ ns: string;
168
+ }[]>;
169
+ list(params: {
170
+ ns?: string;
171
+ type?: string;
172
+ limit?: number;
173
+ offset?: number;
174
+ }): Promise<{
175
+ data: unknown[];
176
+ total: number;
177
+ }>;
178
+ get(params: {
179
+ ns?: string;
180
+ type: string;
181
+ id: string;
182
+ }): Promise<unknown>;
183
+ create(params: {
184
+ ns?: string;
185
+ type: string;
186
+ data: unknown;
187
+ }): Promise<unknown>;
188
+ update(params: {
189
+ ns?: string;
190
+ type: string;
191
+ id: string;
192
+ data: unknown;
193
+ }): Promise<unknown>;
194
+ delete(params: {
195
+ ns?: string;
196
+ type: string;
197
+ id: string;
198
+ hard?: boolean;
199
+ }): Promise<{
200
+ success: boolean;
201
+ }>;
202
+ versions(_params: {
203
+ ns?: string;
204
+ type: string;
205
+ id: string;
206
+ }): Promise<never[]>;
207
+ stats(_params: {
208
+ ns?: string;
209
+ type?: string;
210
+ }): Promise<{
211
+ total: number;
212
+ byType: Record<string, number>;
213
+ }>;
214
+ };
215
+ /**
216
+ * SQL operations (not supported by capnweb servers)
217
+ */
218
+ SQL: {
219
+ execute(_params: {
220
+ query: string;
221
+ params?: unknown[];
222
+ }): Promise<SQLResult>;
223
+ };
224
+ dup: () => /*elided*/ any;
225
+ onRpcBroken: (callback: (error: unknown) => void) => void;
226
+ [Symbol.dispose]: () => void;
227
+ };
228
+
229
+ export { $CapnwebContext as $, createCapnwebClient as c };