@mdxui/do 2.1.1 → 3.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 +253 -266
- 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 +13 -0
- package/dist/app/index.js.map +1 -0
- package/dist/chunk-4KXVN3EQ.js +56 -0
- package/dist/chunk-4KXVN3EQ.js.map +1 -0
- package/dist/chunk-5AWTQDRF.js +76 -0
- package/dist/chunk-5AWTQDRF.js.map +1 -0
- package/dist/chunk-EQVOEEQO.js +95 -0
- package/dist/chunk-EQVOEEQO.js.map +1 -0
- package/dist/chunk-FO3N7SXV.js +469 -0
- package/dist/chunk-FO3N7SXV.js.map +1 -0
- package/dist/chunk-IESVTECE.js +536 -0
- package/dist/chunk-IESVTECE.js.map +1 -0
- package/dist/chunk-JWKIONEO.js +234 -0
- package/dist/chunk-JWKIONEO.js.map +1 -0
- package/dist/chunk-NTSEARBC.js +715 -0
- package/dist/chunk-NTSEARBC.js.map +1 -0
- package/dist/chunk-OWEAW4U6.js +116 -0
- package/dist/chunk-OWEAW4U6.js.map +1 -0
- package/dist/chunk-VRLUXCLD.js +31 -0
- package/dist/chunk-VRLUXCLD.js.map +1 -0
- package/dist/chunk-Y52IEYVM.js +131 -0
- package/dist/chunk-Y52IEYVM.js.map +1 -0
- package/dist/chunk-YGIBMNRH.js +1991 -0
- package/dist/chunk-YGIBMNRH.js.map +1 -0
- package/dist/components/index.d.ts +1 -738
- package/dist/components/index.js +2 -6
- package/dist/config-CmZBQQaT.d.ts +122 -0
- package/dist/{do-CaQVueZw.d.ts → do-C-t9UgjT.d.ts} +31 -33
- package/dist/errors-B4Oyyj4Z.d.ts +346 -0
- package/dist/hooks/index.d.ts +428 -696
- 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 +21 -1010
- package/dist/index.js +11 -839
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +100 -0
- package/dist/lib/index.js +6 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/providers/index.d.ts +244 -32
- package/dist/providers/index.js +3 -2
- package/dist/query-keys-BC901wog.d.ts +153 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +2 -2
- package/dist/schemas/index.js.map +1 -1
- package/dist/{thing-DtI25yZh.d.ts → thing-BVhCTzOi.d.ts} +4 -4
- package/dist/types/index.d.ts +251 -216
- 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
|
@@ -1,4 +1,215 @@
|
|
|
1
|
-
import { ExecutionError, TokenUsage } from './schemas/index.js';
|
|
1
|
+
import { EntityReference, ExecutionError, TokenUsage } from './schemas/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Relationship Types - Semantic Graph Connections
|
|
5
|
+
*
|
|
6
|
+
* Relationships form a semantic knowledge graph connecting Things.
|
|
7
|
+
* Uses the $.Subject.predicate.Object pattern throughout.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* The Relationships table uses MergeTree with ORDER BY (toNs, toId, fromNs, fromId)
|
|
11
|
+
* optimized for reverse lookups ("who references me?").
|
|
12
|
+
*
|
|
13
|
+
* 64+ semantic predicates across categories:
|
|
14
|
+
* - Temporal: before, after, during, since, until...
|
|
15
|
+
* - Spatial: above, below, near, between, within...
|
|
16
|
+
* - Directional: through, toward, from, into, across...
|
|
17
|
+
* - Relational: of, about, for, including, regarding...
|
|
18
|
+
* - Causal: because, considering, but
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Core relationship record from database
|
|
23
|
+
*/
|
|
24
|
+
interface Relationship {
|
|
25
|
+
/** Unique relationship identifier */
|
|
26
|
+
relationshipId: string;
|
|
27
|
+
/** Semantic predicate type */
|
|
28
|
+
relationshipType: SemanticPredicate;
|
|
29
|
+
/** Source entity namespace */
|
|
30
|
+
fromNs: string;
|
|
31
|
+
/** Source entity type */
|
|
32
|
+
fromType: string;
|
|
33
|
+
/** Source entity ID */
|
|
34
|
+
fromId: string;
|
|
35
|
+
/** Target entity namespace */
|
|
36
|
+
toNs: string;
|
|
37
|
+
/** Target entity type */
|
|
38
|
+
toType: string;
|
|
39
|
+
/** Target entity ID */
|
|
40
|
+
toId: string;
|
|
41
|
+
/** Creation timestamp */
|
|
42
|
+
createdAt: Date;
|
|
43
|
+
/** Creator user ID */
|
|
44
|
+
createdBy: string;
|
|
45
|
+
/** Soft delete timestamp */
|
|
46
|
+
deletedAt?: Date | null;
|
|
47
|
+
/** Deleter user ID */
|
|
48
|
+
deletedBy?: string;
|
|
49
|
+
/** Additional relationship metadata */
|
|
50
|
+
metadata: RelationshipMetadata;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Semantic predicate categories
|
|
54
|
+
*/
|
|
55
|
+
type SemanticPredicateCategory = 'temporal' | 'spatial' | 'directional' | 'relational' | 'causal' | 'ownership' | 'membership' | 'dependency' | 'custom';
|
|
56
|
+
/**
|
|
57
|
+
* Built-in semantic predicates
|
|
58
|
+
*/
|
|
59
|
+
type SemanticPredicate = 'before' | 'after' | 'during' | 'since' | 'until' | 'by' | 'at' | 'in' | 'on' | 'past' | 'throughout' | 'till' | 'above' | 'below' | 'under' | 'near' | 'between' | 'among' | 'beside' | 'within' | 'amid' | 'around' | 'behind' | 'beneath' | 'beyond' | 'inside' | 'upon' | 'outside' | 'over' | 'opposite' | 'underneath' | 'round' | 'through' | 'toward' | 'to' | 'from' | 'into' | 'across' | 'along' | 'against' | 'down' | 'off' | 'onto' | 'up' | 'via' | 'out' | 'with' | 'of' | 'about' | 'concerning' | 'for' | 'including' | 'regarding' | 'like' | 'as' | 'than' | 'unlike' | 'besides' | 'except' | 'despite' | 'without' | 'per' | 'because' | 'considering' | 'but' | 'owns' | 'worksFor' | 'contains' | 'belongsTo' | 'employs' | 'locatedAt' | 'handoff' | 'uses' | 'validates' | 'blocks' | 'dependsOn' | 'references' | 'parentOf' | 'childOf' | 'siblingOf' | string;
|
|
60
|
+
/**
|
|
61
|
+
* Predicate definition with metadata
|
|
62
|
+
*/
|
|
63
|
+
interface PredicateDefinition {
|
|
64
|
+
/** Predicate name */
|
|
65
|
+
name: SemanticPredicate;
|
|
66
|
+
/** Category */
|
|
67
|
+
category: SemanticPredicateCategory;
|
|
68
|
+
/** Human-readable label */
|
|
69
|
+
label: string;
|
|
70
|
+
/** Description */
|
|
71
|
+
description: string;
|
|
72
|
+
/** Inverse predicate (e.g., 'owns' -> 'ownedBy') */
|
|
73
|
+
inverse?: SemanticPredicate;
|
|
74
|
+
/** Is this predicate symmetric? */
|
|
75
|
+
symmetric: boolean;
|
|
76
|
+
/** Is this predicate transitive? */
|
|
77
|
+
transitive: boolean;
|
|
78
|
+
/** Valid source types (empty = any) */
|
|
79
|
+
validFromTypes: string[];
|
|
80
|
+
/** Valid target types (empty = any) */
|
|
81
|
+
validToTypes: string[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Additional metadata for relationships
|
|
85
|
+
*/
|
|
86
|
+
interface RelationshipMetadata {
|
|
87
|
+
/** Relationship strength/weight (0-1) */
|
|
88
|
+
weight?: number;
|
|
89
|
+
/** Confidence score (0-1) */
|
|
90
|
+
confidence?: number;
|
|
91
|
+
/** Source of the relationship (manual, inferred, imported) */
|
|
92
|
+
source?: 'manual' | 'inferred' | 'imported' | 'system';
|
|
93
|
+
/** Start date (for temporal relationships) */
|
|
94
|
+
startDate?: Date;
|
|
95
|
+
/** End date (for temporal relationships) */
|
|
96
|
+
endDate?: Date;
|
|
97
|
+
/** Additional properties */
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Semantic triple representation ($.Subject.predicate.Object)
|
|
102
|
+
*/
|
|
103
|
+
interface SemanticTriple {
|
|
104
|
+
/** Subject (from) entity reference */
|
|
105
|
+
subject: EntityReference;
|
|
106
|
+
/** Predicate (relationship type) */
|
|
107
|
+
predicate: SemanticPredicate;
|
|
108
|
+
/** Object (to) entity reference */
|
|
109
|
+
object: EntityReference;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Graph query pattern for finding relationships
|
|
113
|
+
*/
|
|
114
|
+
interface GraphPattern {
|
|
115
|
+
/** Subject pattern (supports wildcards) */
|
|
116
|
+
subject?: Partial<EntityReference> & {
|
|
117
|
+
pattern?: string;
|
|
118
|
+
};
|
|
119
|
+
/** Predicate filter */
|
|
120
|
+
predicate?: SemanticPredicate | SemanticPredicate[];
|
|
121
|
+
/** Object pattern (supports wildcards) */
|
|
122
|
+
object?: Partial<EntityReference> & {
|
|
123
|
+
pattern?: string;
|
|
124
|
+
};
|
|
125
|
+
/** Maximum depth for traversal */
|
|
126
|
+
depth?: number;
|
|
127
|
+
/** Direction of traversal */
|
|
128
|
+
direction?: 'outgoing' | 'incoming' | 'both';
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Relationship creation payload
|
|
132
|
+
*/
|
|
133
|
+
interface RelationshipCreateInput {
|
|
134
|
+
/** Predicate type */
|
|
135
|
+
relationshipType: SemanticPredicate;
|
|
136
|
+
/** Source entity */
|
|
137
|
+
from: EntityReference;
|
|
138
|
+
/** Target entity */
|
|
139
|
+
to: EntityReference;
|
|
140
|
+
/** Metadata */
|
|
141
|
+
metadata?: RelationshipMetadata;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Query filters for relationships
|
|
145
|
+
*/
|
|
146
|
+
interface RelationshipFilter {
|
|
147
|
+
/** Filter by predicate type */
|
|
148
|
+
predicates?: SemanticPredicate[];
|
|
149
|
+
/** Filter by source entity */
|
|
150
|
+
from?: Partial<EntityReference>;
|
|
151
|
+
/** Filter by target entity */
|
|
152
|
+
to?: Partial<EntityReference>;
|
|
153
|
+
/** Filter by category */
|
|
154
|
+
categories?: SemanticPredicateCategory[];
|
|
155
|
+
/** Include deleted */
|
|
156
|
+
includeDeleted?: boolean;
|
|
157
|
+
/** Filter by metadata */
|
|
158
|
+
metadata?: Partial<RelationshipMetadata>;
|
|
159
|
+
/** Date range */
|
|
160
|
+
createdAfter?: Date;
|
|
161
|
+
createdBefore?: Date;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Graph traversal result
|
|
165
|
+
*/
|
|
166
|
+
interface GraphTraversalResult {
|
|
167
|
+
/** Root entity */
|
|
168
|
+
root: EntityReference;
|
|
169
|
+
/** All nodes found */
|
|
170
|
+
nodes: EntityReference[];
|
|
171
|
+
/** All edges (relationships) found */
|
|
172
|
+
edges: Relationship[];
|
|
173
|
+
/** Traversal depth reached */
|
|
174
|
+
depth: number;
|
|
175
|
+
/** Paths from root to each node */
|
|
176
|
+
paths: GraphPath[];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A path in the graph
|
|
180
|
+
*/
|
|
181
|
+
interface GraphPath {
|
|
182
|
+
/** Starting node */
|
|
183
|
+
start: EntityReference;
|
|
184
|
+
/** Ending node */
|
|
185
|
+
end: EntityReference;
|
|
186
|
+
/** Edges traversed */
|
|
187
|
+
edges: Relationship[];
|
|
188
|
+
/** Total weight (sum of edge weights) */
|
|
189
|
+
totalWeight: number;
|
|
190
|
+
/** Path length (number of edges) */
|
|
191
|
+
length: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Statistics for the relationship graph
|
|
195
|
+
*/
|
|
196
|
+
interface GraphStats {
|
|
197
|
+
/** Total relationships */
|
|
198
|
+
totalRelationships: number;
|
|
199
|
+
/** Active relationships (not deleted) */
|
|
200
|
+
activeRelationships: number;
|
|
201
|
+
/** Count by predicate type */
|
|
202
|
+
byPredicate: Record<string, number>;
|
|
203
|
+
/** Count by category */
|
|
204
|
+
byCategory: Record<SemanticPredicateCategory, number>;
|
|
205
|
+
/** Average degree (connections per node) */
|
|
206
|
+
averageDegree: number;
|
|
207
|
+
/** Most connected nodes */
|
|
208
|
+
topConnectedNodes: Array<{
|
|
209
|
+
entity: EntityReference;
|
|
210
|
+
degree: number;
|
|
211
|
+
}>;
|
|
212
|
+
}
|
|
2
213
|
|
|
3
214
|
/**
|
|
4
215
|
* Workflow Types - Business Process Orchestration
|
|
@@ -829,4 +1040,4 @@ interface AgentExecutionFilter {
|
|
|
829
1040
|
minRating?: number;
|
|
830
1041
|
}
|
|
831
1042
|
|
|
832
|
-
export type { AIStepConfig as A,
|
|
1043
|
+
export type { AgentOutput as $, AIStepConfig as A, WorkflowFilter as B, ChoiceCondition as C, DatabaseStepConfig as D, EventTrigger as E, ExecutionFilter as F, GraphPattern as G, HttpStepConfig as H, Agent as I, AgentType as J, RoleCategory as K, AgentClassification as L, ManualTrigger as M, NotificationConfig as N, CharacterBible as O, PredicateDefinition as P, AgentGuardrail as Q, Relationship as R, SemanticPredicateCategory as S, TriggerType as T, HandoffRule as U, AgentStatus as V, WorkflowStatus as W, AgentMetrics as X, AgentExecution as Y, AgentExecutionStatus as Z, AgentInput as _, SemanticPredicate as a, AgentArtifact as a0, AgentTrace as a1, AgentHandoff as a2, GuardrailViolation as a3, AgentFeedback as a4, AgentFilter as a5, AgentExecutionFilter as a6, RelationshipMetadata as b, SemanticTriple as c, RelationshipCreateInput as d, RelationshipFilter as e, GraphTraversalResult as f, GraphPath as g, GraphStats as h, Workflow as i, TriggerBase as j, ScheduleTrigger as k, WebhookTrigger as l, WorkflowTrigger as m, StepType as n, WorkflowStep as o, StepConfig as p, EventStepConfig as q, RetryConfig as r, ErrorHandlingConfig as s, CompensationConfig as t, WorkflowConfig as u, ExecutionStatus as v, WorkflowExecution as w, TriggerData as x, ExecutionContext as y, StepExecution as z };
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { d as DOShellConfig, e as DOShellContextValue } from '../config-CmZBQQaT.js';
|
|
5
|
+
import { Sidebar } from '@mdxui/primitives';
|
|
6
|
+
import { useAuth } from '@workos-inc/authkit-react';
|
|
7
|
+
export { DOClient, DOContextValue, DOProvider, DOProviderProps, useDO, useDOClient, useDOUrls, useDataProviderSafe, useSyncStatus } from '../providers/index.js';
|
|
8
|
+
export { useQueryClient } from '@tanstack/react-query';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import '../do-C-t9UgjT.js';
|
|
11
|
+
import '@mdxui/app';
|
|
12
|
+
|
|
13
|
+
interface DOAppProps {
|
|
14
|
+
/** Shell configuration */
|
|
15
|
+
config: DOShellConfig;
|
|
16
|
+
/** Optional custom content to render in the shell header */
|
|
17
|
+
headerContent?: React.ReactNode;
|
|
18
|
+
/** Optional custom content to render in the sidebar header */
|
|
19
|
+
sidebarHeaderContent?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* DOApp - Complete routed DO Admin Dashboard application with authentication
|
|
23
|
+
*
|
|
24
|
+
* This is the main entry point for using DO Admin with WorkOS authentication and routing.
|
|
25
|
+
* It sets up all necessary providers, routing, and the shell.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import { DOApp } from '@mdxui/do'
|
|
30
|
+
*
|
|
31
|
+
* function App() {
|
|
32
|
+
* return (
|
|
33
|
+
* <DOApp
|
|
34
|
+
* config={{
|
|
35
|
+
* do: {
|
|
36
|
+
* apiEndpoint: 'https://api.do.ai',
|
|
37
|
+
* authMethod: 'jwt',
|
|
38
|
+
* bindings: [],
|
|
39
|
+
* realTimeUpdates: true,
|
|
40
|
+
* },
|
|
41
|
+
* identity: {
|
|
42
|
+
* clientId: 'client_xxx',
|
|
43
|
+
* devMode: true,
|
|
44
|
+
* },
|
|
45
|
+
* branding: {
|
|
46
|
+
* name: 'My DO Admin',
|
|
47
|
+
* },
|
|
48
|
+
* defaultNamespace: 'production',
|
|
49
|
+
* }}
|
|
50
|
+
* />
|
|
51
|
+
* )
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare function DOApp({ config, headerContent, sidebarHeaderContent }: DOAppProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
|
|
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
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
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.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```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 />} />
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
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;
|
|
125
|
+
|
|
126
|
+
interface AuthGateProps {
|
|
127
|
+
children: ReactNode;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* AuthGate handles authentication state and shows appropriate UI:
|
|
131
|
+
* - Loading state while checking auth
|
|
132
|
+
* - Landing page or redirect when not authenticated
|
|
133
|
+
* - Children (dashboard) when authenticated
|
|
134
|
+
*/
|
|
135
|
+
declare function AuthGate({ children }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
136
|
+
|
|
137
|
+
interface DOShellProviderProps {
|
|
138
|
+
config: DOShellConfig;
|
|
139
|
+
children: ReactNode;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* DOShellProvider - Context provider for DOShell configuration
|
|
143
|
+
*
|
|
144
|
+
* Provides shell configuration to all child components.
|
|
145
|
+
* Should be used inside the DOAppProviders composition.
|
|
146
|
+
*/
|
|
147
|
+
declare function DOShellProvider({ config, children }: DOShellProviderProps): react_jsx_runtime.JSX.Element;
|
|
148
|
+
/**
|
|
149
|
+
* Hook to access DOShell configuration
|
|
150
|
+
*/
|
|
151
|
+
declare function useDOShell(): DOShellContextValue;
|
|
152
|
+
/**
|
|
153
|
+
* Hook to access enabled routes configuration
|
|
154
|
+
*/
|
|
155
|
+
declare function useDOShellRoutes(): Partial<Record<string, boolean>>;
|
|
156
|
+
|
|
157
|
+
interface AppProvidersProps {
|
|
158
|
+
config: DOShellConfig;
|
|
159
|
+
children: ReactNode;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* AppProviders - Composed provider hierarchy for DOShell
|
|
163
|
+
*
|
|
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
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```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>
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
declare function AppProviders({ config, children }: AppProvidersProps): react_jsx_runtime.JSX.Element;
|
|
183
|
+
declare const DOAppProviders: typeof AppProviders;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Hook to access identity/auth state.
|
|
187
|
+
* Re-exports useAuth from WorkOS AuthKit for convenience.
|
|
188
|
+
*/
|
|
189
|
+
declare const useIdentity: typeof useAuth;
|
|
190
|
+
interface DOIdentityProviderProps {
|
|
191
|
+
children: ReactNode;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Identity provider that wraps the shell with WorkOS AuthKit authentication.
|
|
195
|
+
*
|
|
196
|
+
* Provides authentication context to all child components.
|
|
197
|
+
*/
|
|
198
|
+
declare function DOIdentityProvider({ children }: DOIdentityProviderProps): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
/**
|
|
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
|
|
230
|
+
*
|
|
231
|
+
* Route: /functions
|
|
232
|
+
*/
|
|
233
|
+
declare function FunctionsPage(): react_jsx_runtime.JSX.Element;
|
|
234
|
+
|
|
235
|
+
interface PlaceholderPageProps {
|
|
236
|
+
/** Title for the page */
|
|
237
|
+
title: string;
|
|
238
|
+
/** Description of what this page will contain */
|
|
239
|
+
description?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* PlaceholderPage - Shows a "coming soon" message for unimplemented routes
|
|
243
|
+
*/
|
|
244
|
+
declare function PlaceholderPage({ title, description }: PlaceholderPageProps): react_jsx_runtime.JSX.Element;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Route parameter schemas for DO Shell routes
|
|
248
|
+
*
|
|
249
|
+
* These Zod schemas define and validate route parameters.
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Schema for database route params
|
|
254
|
+
*/
|
|
255
|
+
declare const DatabaseRouteParams: z.ZodObject<{
|
|
256
|
+
ns: z.ZodOptional<z.ZodString>;
|
|
257
|
+
type: z.ZodOptional<z.ZodString>;
|
|
258
|
+
}, "strip", z.ZodTypeAny, {
|
|
259
|
+
type?: string | undefined;
|
|
260
|
+
ns?: string | undefined;
|
|
261
|
+
}, {
|
|
262
|
+
type?: string | undefined;
|
|
263
|
+
ns?: string | undefined;
|
|
264
|
+
}>;
|
|
265
|
+
type DatabaseRouteParamsType = z.infer<typeof DatabaseRouteParams>;
|
|
266
|
+
/**
|
|
267
|
+
* Schema for things browse route params
|
|
268
|
+
*/
|
|
269
|
+
declare const ThingsRouteParams: z.ZodObject<{
|
|
270
|
+
ns: z.ZodOptional<z.ZodString>;
|
|
271
|
+
type: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, "strip", z.ZodTypeAny, {
|
|
273
|
+
type?: string | undefined;
|
|
274
|
+
ns?: string | undefined;
|
|
275
|
+
}, {
|
|
276
|
+
type?: string | undefined;
|
|
277
|
+
ns?: string | undefined;
|
|
278
|
+
}>;
|
|
279
|
+
type ThingsRouteParamsType = z.infer<typeof ThingsRouteParams>;
|
|
280
|
+
/**
|
|
281
|
+
* Schema for document route params
|
|
282
|
+
*/
|
|
283
|
+
declare const DocumentRouteParams: z.ZodObject<{
|
|
284
|
+
ns: z.ZodString;
|
|
285
|
+
type: z.ZodString;
|
|
286
|
+
id: z.ZodString;
|
|
287
|
+
}, "strip", z.ZodTypeAny, {
|
|
288
|
+
type: string;
|
|
289
|
+
ns: string;
|
|
290
|
+
id: string;
|
|
291
|
+
}, {
|
|
292
|
+
type: string;
|
|
293
|
+
ns: string;
|
|
294
|
+
id: string;
|
|
295
|
+
}>;
|
|
296
|
+
type DocumentRouteParamsType = z.infer<typeof DocumentRouteParams>;
|
|
297
|
+
/**
|
|
298
|
+
* Schema for generic type-filtered route params
|
|
299
|
+
*/
|
|
300
|
+
declare const TypeFilteredRouteParams: z.ZodObject<{
|
|
301
|
+
type: z.ZodOptional<z.ZodString>;
|
|
302
|
+
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
type?: string | undefined;
|
|
304
|
+
}, {
|
|
305
|
+
type?: string | undefined;
|
|
306
|
+
}>;
|
|
307
|
+
type TypeFilteredRouteParamsType = z.infer<typeof TypeFilteredRouteParams>;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* DO Shell Routes
|
|
311
|
+
*
|
|
312
|
+
* Route definitions and parameter schemas for the DO Admin Dashboard.
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Route paths for DO Shell navigation
|
|
317
|
+
*
|
|
318
|
+
* These paths are used throughout the shell for navigation links
|
|
319
|
+
* and route matching.
|
|
320
|
+
*/
|
|
321
|
+
declare const doRoutePaths: {
|
|
322
|
+
readonly overview: "/";
|
|
323
|
+
readonly agents: "/agents";
|
|
324
|
+
readonly functions: "/functions";
|
|
325
|
+
readonly workflows: "/workflows";
|
|
326
|
+
readonly databases: "/databases";
|
|
327
|
+
readonly databaseTable: "/databases/:ns/:type";
|
|
328
|
+
readonly things: "/things";
|
|
329
|
+
readonly thingsBrowse: "/things/:ns/:type?";
|
|
330
|
+
readonly document: "/things/:ns/:type/:id";
|
|
331
|
+
readonly nouns: "/nouns";
|
|
332
|
+
readonly verbs: "/verbs";
|
|
333
|
+
readonly actions: "/actions";
|
|
334
|
+
readonly relationships: "/relationships";
|
|
335
|
+
readonly events: "/events";
|
|
336
|
+
readonly customers: "/customers";
|
|
337
|
+
readonly subscriptions: "/subscriptions";
|
|
338
|
+
readonly integrations: "/integrations";
|
|
339
|
+
readonly orgs: "/orgs";
|
|
340
|
+
readonly roles: "/roles";
|
|
341
|
+
readonly users: "/users";
|
|
342
|
+
readonly apiKeys: "/api-keys";
|
|
343
|
+
readonly settings: "/settings";
|
|
344
|
+
};
|
|
345
|
+
type DORoutePath = typeof doRoutePaths[keyof typeof doRoutePaths];
|
|
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 };
|
|
@@ -0,0 +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';
|
|
4
|
+
import '../chunk-GKSP5RIA.js';
|
|
5
|
+
import '../chunk-IESVTECE.js';
|
|
6
|
+
import '../chunk-JWKIONEO.js';
|
|
7
|
+
import '../chunk-4KXVN3EQ.js';
|
|
8
|
+
export { DOProvider, useDO, useDOClient, useDOUrls, useDataProviderSafe, useQueryClient, useSyncStatus } from '../chunk-FO3N7SXV.js';
|
|
9
|
+
import '../chunk-OWEAW4U6.js';
|
|
10
|
+
import '../chunk-Y52IEYVM.js';
|
|
11
|
+
import '../chunk-GGO5GW72.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/lib/query-keys.ts
|
|
2
|
+
var thingsKeys = {
|
|
3
|
+
all: ["things"],
|
|
4
|
+
lists: () => [...thingsKeys.all, "list"],
|
|
5
|
+
list: (filter, sort, pagination) => [...thingsKeys.lists(), { filter, sort, pagination }],
|
|
6
|
+
details: () => [...thingsKeys.all, "detail"],
|
|
7
|
+
detail: (ns, type, id) => [...thingsKeys.details(), ns, type, id],
|
|
8
|
+
versions: (ns, type, id) => [...thingsKeys.detail(ns, type, id), "versions"],
|
|
9
|
+
types: () => [...thingsKeys.all, "types"],
|
|
10
|
+
typeStats: (ns, type) => [...thingsKeys.types(), ns, type]
|
|
11
|
+
};
|
|
12
|
+
var agentsKeys = {
|
|
13
|
+
all: ["agents"],
|
|
14
|
+
lists: () => [...agentsKeys.all, "list"],
|
|
15
|
+
list: (filter) => [...agentsKeys.lists(), filter],
|
|
16
|
+
details: () => [...agentsKeys.all, "detail"],
|
|
17
|
+
detail: (id) => [...agentsKeys.details(), id],
|
|
18
|
+
metrics: (id) => [...agentsKeys.detail(id), "metrics"],
|
|
19
|
+
executions: () => [...agentsKeys.all, "executions"],
|
|
20
|
+
executionsList: (filter) => [...agentsKeys.executions(), "list", filter],
|
|
21
|
+
execution: (id) => [...agentsKeys.executions(), "detail", id]
|
|
22
|
+
};
|
|
23
|
+
var workflowsKeys = {
|
|
24
|
+
all: ["workflows"],
|
|
25
|
+
lists: () => [...workflowsKeys.all, "list"],
|
|
26
|
+
list: (filter) => [...workflowsKeys.lists(), filter],
|
|
27
|
+
details: () => [...workflowsKeys.all, "detail"],
|
|
28
|
+
detail: (id) => [...workflowsKeys.details(), id],
|
|
29
|
+
executions: () => [...workflowsKeys.all, "executions"],
|
|
30
|
+
executionsList: (filter) => [...workflowsKeys.executions(), "list", filter],
|
|
31
|
+
execution: (id) => [...workflowsKeys.executions(), "detail", id]
|
|
32
|
+
};
|
|
33
|
+
var relationshipsKeys = {
|
|
34
|
+
all: ["relationships"],
|
|
35
|
+
lists: () => [...relationshipsKeys.all, "list"],
|
|
36
|
+
list: (filter) => [...relationshipsKeys.lists(), filter],
|
|
37
|
+
details: () => [...relationshipsKeys.all, "detail"],
|
|
38
|
+
detail: (id) => [...relationshipsKeys.details(), id],
|
|
39
|
+
graph: () => [...relationshipsKeys.all, "graph"],
|
|
40
|
+
traverse: (entity, pattern) => [...relationshipsKeys.graph(), entity, pattern],
|
|
41
|
+
stats: () => [...relationshipsKeys.all, "stats"]
|
|
42
|
+
};
|
|
43
|
+
function createQueryKeys(resource) {
|
|
44
|
+
const keys = {
|
|
45
|
+
all: [resource],
|
|
46
|
+
lists: () => [resource, "list"],
|
|
47
|
+
list: (filter) => [...keys.lists(), filter],
|
|
48
|
+
details: () => [resource, "detail"],
|
|
49
|
+
detail: (id) => [resource, "detail", id]
|
|
50
|
+
};
|
|
51
|
+
return keys;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { agentsKeys, createQueryKeys, relationshipsKeys, thingsKeys, workflowsKeys };
|
|
55
|
+
//# sourceMappingURL=chunk-4KXVN3EQ.js.map
|
|
56
|
+
//# sourceMappingURL=chunk-4KXVN3EQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/query-keys.ts"],"names":[],"mappings":"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","file":"chunk-4KXVN3EQ.js","sourcesContent":["/**\n * Query Key Factory Pattern\n *\n * Provides a generic factory for creating type-safe TanStack Query keys.\n * Eliminates copy-paste duplication across hook files while maintaining\n * consistent cache invalidation patterns.\n *\n * @example\n * ```typescript\n * // Create typed keys for a resource\n * export const agentsKeys = createQueryKeys<AgentFilter>('agents')\n *\n * // Usage in hooks\n * const queryKey = agentsKeys.list({ status: ['active'] })\n * queryClient.invalidateQueries({ queryKey: agentsKeys.all })\n * ```\n */\n\nimport type {\n ThingFilter,\n ThingSort,\n ThingPagination,\n AgentFilter,\n AgentExecutionFilter,\n WorkflowFilter,\n ExecutionFilter,\n RelationshipFilter,\n EntityReference,\n GraphPattern,\n} from '../types'\n\n/**\n * Generic pagination parameters for list queries\n */\nexport interface Pagination {\n page?: number\n perPage?: number\n cursor?: string\n}\n\n// ============================================================================\n// Pre-defined keys for known resources\n// ============================================================================\n\n/**\n * Query keys for Things resource\n *\n * Things have a special key structure because:\n * - List queries include filter, sort, and pagination\n * - Detail queries use composite keys (ns, type, id) instead of a single id\n * - Additional sub-queries for versions and type stats\n */\nexport const thingsKeys = {\n all: ['things'] as const,\n lists: () => [...thingsKeys.all, 'list'] as const,\n list: (filter: ThingFilter, sort?: ThingSort, pagination?: ThingPagination) =>\n [...thingsKeys.lists(), { filter, sort, pagination }] as const,\n details: () => [...thingsKeys.all, 'detail'] as const,\n detail: (ns: string, type: string, id: string) => [...thingsKeys.details(), ns, type, id] as const,\n versions: (ns: string, type: string, id: string) =>\n [...thingsKeys.detail(ns, type, id), 'versions'] as const,\n types: () => [...thingsKeys.all, 'types'] as const,\n typeStats: (ns: string, type: string) => [...thingsKeys.types(), ns, type] as const,\n}\n\n/**\n * Query keys for Agents resource\n *\n * Includes keys for:\n * - Agent lists and details\n * - Agent metrics (per-agent)\n * - Agent executions (list and detail)\n */\nexport const agentsKeys = {\n all: ['agents'] as const,\n lists: () => [...agentsKeys.all, 'list'] as const,\n list: (filter: AgentFilter) => [...agentsKeys.lists(), filter] as const,\n details: () => [...agentsKeys.all, 'detail'] as const,\n detail: (id: string) => [...agentsKeys.details(), id] as const,\n metrics: (id: string) => [...agentsKeys.detail(id), 'metrics'] as const,\n executions: () => [...agentsKeys.all, 'executions'] as const,\n executionsList: (filter: AgentExecutionFilter) => [...agentsKeys.executions(), 'list', filter] as const,\n execution: (id: string) => [...agentsKeys.executions(), 'detail', id] as const,\n}\n\n/**\n * Query keys for Workflows resource\n *\n * Includes keys for:\n * - Workflow lists and details\n * - Workflow executions (list and detail)\n */\nexport const workflowsKeys = {\n all: ['workflows'] as const,\n lists: () => [...workflowsKeys.all, 'list'] as const,\n list: (filter: WorkflowFilter) => [...workflowsKeys.lists(), filter] as const,\n details: () => [...workflowsKeys.all, 'detail'] as const,\n detail: (id: string) => [...workflowsKeys.details(), id] as const,\n executions: () => [...workflowsKeys.all, 'executions'] as const,\n executionsList: (filter: ExecutionFilter) => [...workflowsKeys.executions(), 'list', filter] as const,\n execution: (id: string) => [...workflowsKeys.executions(), 'detail', id] as const,\n}\n\n/**\n * Query keys for Relationships resource\n *\n * Includes keys for:\n * - Relationship lists and details\n * - Graph traversal queries\n * - Graph statistics\n */\nexport const relationshipsKeys = {\n all: ['relationships'] as const,\n lists: () => [...relationshipsKeys.all, 'list'] as const,\n list: (filter: RelationshipFilter) => [...relationshipsKeys.lists(), filter] as const,\n details: () => [...relationshipsKeys.all, 'detail'] as const,\n detail: (id: string) => [...relationshipsKeys.details(), id] as const,\n graph: () => [...relationshipsKeys.all, 'graph'] as const,\n traverse: (entity: EntityReference, pattern: GraphPattern) =>\n [...relationshipsKeys.graph(), entity, pattern] as const,\n stats: () => [...relationshipsKeys.all, 'stats'] as const,\n}\n\n// ============================================================================\n// Generic Factory Functions (for custom resources)\n// ============================================================================\n\n/**\n * Base query keys structure that all resources share\n */\nexport interface QueryKeys<TFilter = unknown> {\n /** Root key for all queries of this resource */\n all: readonly [string]\n /** Key for all list queries */\n lists: () => readonly [string, 'list']\n /** Key for a specific list query with filter */\n list: (filter: TFilter) => readonly unknown[]\n /** Key for all detail queries */\n details: () => readonly [string, 'detail']\n /** Key for a specific detail query */\n detail: (id: string) => readonly [string, 'detail', string]\n}\n\n/**\n * Create a basic query key factory for a resource\n *\n * @param resource - The resource name (e.g., 'agents', 'workflows')\n * @returns Query key factory with type-safe keys\n *\n * @example\n * ```typescript\n * const customKeys = createQueryKeys<CustomFilter>('custom')\n *\n * // All queries\n * customKeys.all // ['custom']\n *\n * // List queries\n * customKeys.lists() // ['custom', 'list']\n * customKeys.list({ status: 'active' }) // ['custom', 'list', { status: 'active' }]\n *\n * // Detail queries\n * customKeys.details() // ['custom', 'detail']\n * customKeys.detail('item-1') // ['custom', 'detail', 'item-1']\n * ```\n */\nexport function createQueryKeys<TFilter = unknown>(resource: string): QueryKeys<TFilter> {\n const keys: QueryKeys<TFilter> = {\n all: [resource] as const,\n lists: () => [resource, 'list'] as const,\n list: (filter: TFilter) => [...keys.lists(), filter] as const,\n details: () => [resource, 'detail'] as const,\n detail: (id: string) => [resource, 'detail', id] as const,\n }\n return keys\n}\n"]}
|