@mdxui/do 2.1.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -323
- package/dist/{agents-xcIn2dUB.d.ts → agents-2_r9e9i7.d.ts} +213 -2
- package/dist/app/index.d.ts +347 -0
- package/dist/app/index.js +14 -0
- package/dist/app/index.js.map +1 -0
- package/dist/breadcrumbs-C9Qn3S7d.d.ts +81 -0
- package/dist/capnweb-client-Bq78FtEA.d.ts +229 -0
- package/dist/chunk-3XKYQRXY.js +192 -0
- package/dist/chunk-3XKYQRXY.js.map +1 -0
- package/dist/chunk-4KXVN3EQ.js +56 -0
- package/dist/chunk-4KXVN3EQ.js.map +1 -0
- package/dist/chunk-5SHZZC7L.js +234 -0
- package/dist/chunk-5SHZZC7L.js.map +1 -0
- package/dist/chunk-7UFINK3Q.js +1994 -0
- package/dist/chunk-7UFINK3Q.js.map +1 -0
- package/dist/chunk-JJLAES6W.js +76 -0
- package/dist/chunk-JJLAES6W.js.map +1 -0
- package/dist/chunk-KT52UU3U.js +985 -0
- package/dist/chunk-KT52UU3U.js.map +1 -0
- package/dist/chunk-LJIWB7KE.js +95 -0
- package/dist/chunk-LJIWB7KE.js.map +1 -0
- package/dist/chunk-NA652ART.js +596 -0
- package/dist/chunk-NA652ART.js.map +1 -0
- package/dist/chunk-OVLO7UOH.js +1071 -0
- package/dist/chunk-OVLO7UOH.js.map +1 -0
- package/dist/chunk-VRLUXCLD.js +31 -0
- package/dist/chunk-VRLUXCLD.js.map +1 -0
- package/dist/chunk-WMNT4OIE.js +249 -0
- package/dist/chunk-WMNT4OIE.js.map +1 -0
- package/dist/chunk-Y52IEYVM.js +131 -0
- package/dist/chunk-Y52IEYVM.js.map +1 -0
- package/dist/components/index.d.ts +14 -732
- package/dist/components/index.js +3 -6
- package/dist/config-CxvpD8Y6.d.ts +111 -0
- package/dist/{do-CaQVueZw.d.ts → do-D27i5bU0.d.ts} +32 -33
- package/dist/errors-DratdVIz.d.ts +346 -0
- package/dist/hooks/index.d.ts +450 -691
- package/dist/hooks/index.js +6 -4
- package/dist/hooks/things/index.d.ts +298 -0
- package/dist/hooks/things/index.js +8 -0
- package/dist/hooks/things/index.js.map +1 -0
- package/dist/index.d.ts +62 -989
- package/dist/index.js +12 -839
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +798 -0
- package/dist/lib/index.js +6 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/providers/index.d.ts +130 -34
- package/dist/providers/index.js +3 -2
- package/dist/query-keys-CZNFikIi.d.ts +153 -0
- package/dist/schemas/index.d.ts +5 -5
- package/dist/schemas/index.js +2 -2
- package/dist/schemas/index.js.map +1 -1
- package/dist/{thing-DtI25yZh.d.ts → thing-BF25aUtJ.d.ts} +72 -72
- package/dist/types/index.d.ts +693 -658
- package/dist/types/index.js +1 -2
- package/dist/views/index.d.ts +131 -0
- package/dist/views/index.js +11 -0
- package/dist/views/index.js.map +1 -0
- package/package.json +39 -17
- package/dist/__test-utils__/index.d.ts +0 -399
- package/dist/__test-utils__/index.js +0 -34641
- package/dist/__test-utils__/index.js.map +0 -1
- package/dist/chunk-EEDMN7UF.js +0 -1351
- package/dist/chunk-EEDMN7UF.js.map +0 -1
- package/dist/chunk-G3PMV62Z.js +0 -33
- package/dist/chunk-G3PMV62Z.js.map +0 -1
- package/dist/chunk-NXPXL5NA.js +0 -3789
- package/dist/chunk-NXPXL5NA.js.map +0 -1
- package/dist/chunk-PC5FJY6M.js +0 -20
- package/dist/chunk-PC5FJY6M.js.map +0 -1
- package/dist/chunk-XF6LKY2M.js +0 -445
- package/dist/chunk-XF6LKY2M.js.map +0 -1
- package/dist/magic-string.es-J7BYFTTJ.js +0 -1307
- package/dist/magic-string.es-J7BYFTTJ.js.map +0 -1
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
export { A as APIError, D as DEFAULT_REQUEST_TIMEOUT, F as FetchWithTimeoutOptions, N as NetworkError, R as RetryConfig, S as SyncError, V as ValidationError, c as camelToTitle, a as capitalize, b as cn, v as createFetchWithTimeout, d as debounce, f as fetchWithTimeout, e as formatBytes, g as formatDate, h as formatDateTime, i as formatDuration, j as formatNumber, k as formatRelativeTime, l as formatSemanticId, m as generateId, n as groupBy, o as isAPIError, p as isNetworkError, q as isSyncError, r as isValidationError, s as parseSemanticId, u as retryWithBackoff, t as truncate } from '../errors-DratdVIz.js';
|
|
2
|
+
export { P as Pagination, Q as QueryKeys, a as agentsKeys, c as createQueryKeys, r as relationshipsKeys, t as thingsKeys, w as workflowsKeys } from '../query-keys-CZNFikIi.js';
|
|
3
|
+
import * as zod from 'zod';
|
|
4
|
+
import { T as Thing, S as SemanticType } from '../thing-BF25aUtJ.js';
|
|
5
|
+
export { $ as $CapnwebContext, c as createCapnwebClient } from '../capnweb-client-Bq78FtEA.js';
|
|
6
|
+
import 'clsx';
|
|
7
|
+
import '../schemas/index.js';
|
|
8
|
+
import '../agents-2_r9e9i7.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* URL utilities for @mdxui/do
|
|
12
|
+
*
|
|
13
|
+
* Provides functions to normalize and derive URLs from the configuration.
|
|
14
|
+
* These utilities ensure consistent URL formatting across the package.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Normalize a URL to an RPC endpoint
|
|
20
|
+
*
|
|
21
|
+
* Transforms various URL formats into a consistent RPC endpoint URL:
|
|
22
|
+
* - Converts wss:// to https:// and ws:// to http://
|
|
23
|
+
* - Strips trailing /sync or /rpc if present
|
|
24
|
+
* - Appends /rpc
|
|
25
|
+
*
|
|
26
|
+
* @param url - The base URL (e.g., 'https://api.do/admin' or 'wss://api.do/do/workspace')
|
|
27
|
+
* @returns The normalized RPC URL (e.g., 'https://api.do/admin/rpc')
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* deriveRpcUrl('https://api.do/admin')
|
|
32
|
+
* // => 'https://api.do/admin/rpc'
|
|
33
|
+
*
|
|
34
|
+
* deriveRpcUrl('wss://api.do/do/workspace/sync')
|
|
35
|
+
* // => 'https://api.do/do/workspace/rpc'
|
|
36
|
+
*
|
|
37
|
+
* deriveRpcUrl('https://api.do/admin/rpc')
|
|
38
|
+
* // => 'https://api.do/admin/rpc' (unchanged)
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare function deriveRpcUrl(url: string): string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Configuration for health check behavior
|
|
45
|
+
*/
|
|
46
|
+
interface HealthCheckConfig {
|
|
47
|
+
/** API endpoint base URL (e.g., 'https://api.do/admin') */
|
|
48
|
+
apiEndpoint: string;
|
|
49
|
+
/** Optional auth token for Bearer authentication */
|
|
50
|
+
authToken?: string;
|
|
51
|
+
/** Request timeout in milliseconds (defaults to DEFAULT_REQUEST_TIMEOUT) */
|
|
52
|
+
requestTimeout?: number;
|
|
53
|
+
/** Number of retry attempts (defaults to 3) */
|
|
54
|
+
healthCheckRetries?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Result of the health check hook
|
|
58
|
+
*/
|
|
59
|
+
interface HealthCheckResult {
|
|
60
|
+
/** Whether the API is reachable */
|
|
61
|
+
isConnected: boolean;
|
|
62
|
+
/** Error from the last failed attempt, if any */
|
|
63
|
+
connectionError?: Error;
|
|
64
|
+
/** Manually trigger a health check */
|
|
65
|
+
checkConnection: () => Promise<void>;
|
|
66
|
+
/** Whether a check is currently in progress */
|
|
67
|
+
isChecking: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Hook to perform health checks against an API endpoint
|
|
71
|
+
*
|
|
72
|
+
* Automatically checks connection on mount with retry and exponential backoff.
|
|
73
|
+
* Can also be manually triggered via the returned `checkConnection` function.
|
|
74
|
+
*
|
|
75
|
+
* @param config - Health check configuration
|
|
76
|
+
* @returns Health check state and manual trigger function
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```tsx
|
|
80
|
+
* function MyComponent() {
|
|
81
|
+
* const { isConnected, connectionError, checkConnection } = useHealthCheck({
|
|
82
|
+
* apiEndpoint: 'https://api.do/admin',
|
|
83
|
+
* authToken: 'my-token',
|
|
84
|
+
* healthCheckRetries: 3,
|
|
85
|
+
* })
|
|
86
|
+
*
|
|
87
|
+
* if (connectionError) {
|
|
88
|
+
* return <div>Connection failed: {connectionError.message}</div>
|
|
89
|
+
* }
|
|
90
|
+
*
|
|
91
|
+
* if (!isConnected) {
|
|
92
|
+
* return <div>Connecting...</div>
|
|
93
|
+
* }
|
|
94
|
+
*
|
|
95
|
+
* return <div>Connected!</div>
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
declare function useHealthCheck(config: HealthCheckConfig): HealthCheckResult;
|
|
100
|
+
|
|
101
|
+
interface MockClientOptions {
|
|
102
|
+
/** Initial data to populate the store */
|
|
103
|
+
initialData?: Thing[];
|
|
104
|
+
/** Simulated network delay in ms (default: 100) */
|
|
105
|
+
delay?: number;
|
|
106
|
+
/** Whether to log operations (default: false) */
|
|
107
|
+
verbose?: boolean;
|
|
108
|
+
}
|
|
109
|
+
interface MockStore {
|
|
110
|
+
things: Map<string, Thing>;
|
|
111
|
+
deletedThings: Set<string>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Create a mock client that matches the DOClient interface
|
|
115
|
+
*/
|
|
116
|
+
declare function createMockClient(options?: MockClientOptions): {
|
|
117
|
+
/**
|
|
118
|
+
* Namespace operations
|
|
119
|
+
*/
|
|
120
|
+
Namespace: {
|
|
121
|
+
list(_params?: {
|
|
122
|
+
includeSystem?: boolean;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
}[]>;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Schema operations
|
|
130
|
+
*/
|
|
131
|
+
Schema: {
|
|
132
|
+
discover(_params?: {
|
|
133
|
+
ns?: string;
|
|
134
|
+
}): Promise<{
|
|
135
|
+
namespaces: string[];
|
|
136
|
+
types: string[];
|
|
137
|
+
schemas: string[];
|
|
138
|
+
}>;
|
|
139
|
+
get(params: {
|
|
140
|
+
ns?: string;
|
|
141
|
+
type: string;
|
|
142
|
+
}): Promise<{
|
|
143
|
+
label: string;
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
namespace: string;
|
|
147
|
+
properties: {
|
|
148
|
+
label: string;
|
|
149
|
+
name: string;
|
|
150
|
+
description: string;
|
|
151
|
+
required: boolean;
|
|
152
|
+
rangeIncludes: string[];
|
|
153
|
+
domainIncludes: string[];
|
|
154
|
+
isArray: boolean;
|
|
155
|
+
defaultValue?: unknown;
|
|
156
|
+
}[];
|
|
157
|
+
parentTypes: string[];
|
|
158
|
+
subtypes: string[];
|
|
159
|
+
description?: string | undefined;
|
|
160
|
+
examples?: zod.objectOutputType<{
|
|
161
|
+
'@context': zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodRecord<zod.ZodString, zod.ZodUnknown>]>>;
|
|
162
|
+
'@type': zod.ZodOptional<zod.ZodString>;
|
|
163
|
+
'@id': zod.ZodOptional<zod.ZodString>;
|
|
164
|
+
}, zod.ZodTypeAny, "passthrough">[] | undefined;
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Thing operations
|
|
169
|
+
*/
|
|
170
|
+
Thing: {
|
|
171
|
+
types(params: {
|
|
172
|
+
ns?: string;
|
|
173
|
+
includeSystem?: boolean;
|
|
174
|
+
}): Promise<{
|
|
175
|
+
name: string;
|
|
176
|
+
ns: string;
|
|
177
|
+
}[]>;
|
|
178
|
+
list(params: {
|
|
179
|
+
ns?: string;
|
|
180
|
+
type?: string;
|
|
181
|
+
limit?: number;
|
|
182
|
+
offset?: number;
|
|
183
|
+
}): Promise<{
|
|
184
|
+
data: {
|
|
185
|
+
data: {
|
|
186
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
187
|
+
'@type'?: string | undefined;
|
|
188
|
+
'@id'?: string | undefined;
|
|
189
|
+
} & {
|
|
190
|
+
[k: string]: unknown;
|
|
191
|
+
};
|
|
192
|
+
id: string;
|
|
193
|
+
type: string;
|
|
194
|
+
name: string;
|
|
195
|
+
ns: string;
|
|
196
|
+
ts: Date;
|
|
197
|
+
createdAt: Date;
|
|
198
|
+
updatedAt: Date;
|
|
199
|
+
variant?: string | undefined;
|
|
200
|
+
createdBy?: string | undefined;
|
|
201
|
+
updatedBy?: string | undefined;
|
|
202
|
+
deletedAt?: Date | null | undefined;
|
|
203
|
+
}[];
|
|
204
|
+
total: number;
|
|
205
|
+
}>;
|
|
206
|
+
get(params: {
|
|
207
|
+
ns?: string;
|
|
208
|
+
type: string;
|
|
209
|
+
id: string;
|
|
210
|
+
}): Promise<{
|
|
211
|
+
data: {
|
|
212
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
213
|
+
'@type'?: string | undefined;
|
|
214
|
+
'@id'?: string | undefined;
|
|
215
|
+
} & {
|
|
216
|
+
[k: string]: unknown;
|
|
217
|
+
};
|
|
218
|
+
id: string;
|
|
219
|
+
type: string;
|
|
220
|
+
name: string;
|
|
221
|
+
ns: string;
|
|
222
|
+
ts: Date;
|
|
223
|
+
createdAt: Date;
|
|
224
|
+
updatedAt: Date;
|
|
225
|
+
variant?: string | undefined;
|
|
226
|
+
createdBy?: string | undefined;
|
|
227
|
+
updatedBy?: string | undefined;
|
|
228
|
+
deletedAt?: Date | null | undefined;
|
|
229
|
+
} | null>;
|
|
230
|
+
create(params: {
|
|
231
|
+
ns?: string;
|
|
232
|
+
type: string;
|
|
233
|
+
name?: string;
|
|
234
|
+
data: unknown;
|
|
235
|
+
}): Promise<{
|
|
236
|
+
data: {
|
|
237
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
238
|
+
'@type'?: string | undefined;
|
|
239
|
+
'@id'?: string | undefined;
|
|
240
|
+
} & {
|
|
241
|
+
[k: string]: unknown;
|
|
242
|
+
};
|
|
243
|
+
id: string;
|
|
244
|
+
type: string;
|
|
245
|
+
name: string;
|
|
246
|
+
ns: string;
|
|
247
|
+
ts: Date;
|
|
248
|
+
createdAt: Date;
|
|
249
|
+
updatedAt: Date;
|
|
250
|
+
variant?: string | undefined;
|
|
251
|
+
createdBy?: string | undefined;
|
|
252
|
+
updatedBy?: string | undefined;
|
|
253
|
+
deletedAt?: Date | null | undefined;
|
|
254
|
+
}>;
|
|
255
|
+
update(params: {
|
|
256
|
+
ns?: string;
|
|
257
|
+
type: string;
|
|
258
|
+
id: string;
|
|
259
|
+
data: unknown;
|
|
260
|
+
}): Promise<{
|
|
261
|
+
data: {
|
|
262
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
263
|
+
'@type'?: string | undefined;
|
|
264
|
+
'@id'?: string | undefined;
|
|
265
|
+
} & {
|
|
266
|
+
[k: string]: unknown;
|
|
267
|
+
};
|
|
268
|
+
id: string;
|
|
269
|
+
type: string;
|
|
270
|
+
name: string;
|
|
271
|
+
ns: string;
|
|
272
|
+
ts: Date;
|
|
273
|
+
createdAt: Date;
|
|
274
|
+
updatedAt: Date;
|
|
275
|
+
variant?: string | undefined;
|
|
276
|
+
createdBy?: string | undefined;
|
|
277
|
+
updatedBy?: string | undefined;
|
|
278
|
+
deletedAt?: Date | null | undefined;
|
|
279
|
+
}>;
|
|
280
|
+
delete(params: {
|
|
281
|
+
ns?: string;
|
|
282
|
+
type: string;
|
|
283
|
+
id: string;
|
|
284
|
+
hard?: boolean;
|
|
285
|
+
}): Promise<{
|
|
286
|
+
success: boolean;
|
|
287
|
+
}>;
|
|
288
|
+
versions(_params: {
|
|
289
|
+
ns?: string;
|
|
290
|
+
type: string;
|
|
291
|
+
id: string;
|
|
292
|
+
}): Promise<never[]>;
|
|
293
|
+
stats(_params: {
|
|
294
|
+
ns?: string;
|
|
295
|
+
type?: string;
|
|
296
|
+
}): Promise<{
|
|
297
|
+
total: number;
|
|
298
|
+
byType: Record<string, number>;
|
|
299
|
+
}>;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* SQL operations (mock implementation)
|
|
303
|
+
*/
|
|
304
|
+
SQL: {
|
|
305
|
+
execute(params: {
|
|
306
|
+
query: string;
|
|
307
|
+
params?: unknown[];
|
|
308
|
+
}): Promise<{
|
|
309
|
+
rows: {
|
|
310
|
+
id: string;
|
|
311
|
+
ns: string;
|
|
312
|
+
type: string;
|
|
313
|
+
name: string;
|
|
314
|
+
createdAt: Date;
|
|
315
|
+
updatedAt: Date;
|
|
316
|
+
data: string;
|
|
317
|
+
}[];
|
|
318
|
+
columns: {
|
|
319
|
+
name: string;
|
|
320
|
+
type: string;
|
|
321
|
+
}[];
|
|
322
|
+
rowsAffected: number;
|
|
323
|
+
executionTimeMs: number;
|
|
324
|
+
}>;
|
|
325
|
+
};
|
|
326
|
+
dup: () => /*elided*/ any;
|
|
327
|
+
onRpcBroken: (_callback: (error: unknown) => void) => void;
|
|
328
|
+
[Symbol.dispose]: () => void;
|
|
329
|
+
_store: MockStore;
|
|
330
|
+
_reset: () => void;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Create a mock client context - factory function matching DOClient interface
|
|
334
|
+
*/
|
|
335
|
+
declare function $MockContext(options?: MockClientOptions): {
|
|
336
|
+
/**
|
|
337
|
+
* Namespace operations
|
|
338
|
+
*/
|
|
339
|
+
Namespace: {
|
|
340
|
+
list(_params?: {
|
|
341
|
+
includeSystem?: boolean;
|
|
342
|
+
}): Promise<{
|
|
343
|
+
id: string;
|
|
344
|
+
name: string;
|
|
345
|
+
}[]>;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* Schema operations
|
|
349
|
+
*/
|
|
350
|
+
Schema: {
|
|
351
|
+
discover(_params?: {
|
|
352
|
+
ns?: string;
|
|
353
|
+
}): Promise<{
|
|
354
|
+
namespaces: string[];
|
|
355
|
+
types: string[];
|
|
356
|
+
schemas: string[];
|
|
357
|
+
}>;
|
|
358
|
+
get(params: {
|
|
359
|
+
ns?: string;
|
|
360
|
+
type: string;
|
|
361
|
+
}): Promise<{
|
|
362
|
+
label: string;
|
|
363
|
+
id: string;
|
|
364
|
+
name: string;
|
|
365
|
+
namespace: string;
|
|
366
|
+
properties: {
|
|
367
|
+
label: string;
|
|
368
|
+
name: string;
|
|
369
|
+
description: string;
|
|
370
|
+
required: boolean;
|
|
371
|
+
rangeIncludes: string[];
|
|
372
|
+
domainIncludes: string[];
|
|
373
|
+
isArray: boolean;
|
|
374
|
+
defaultValue?: unknown;
|
|
375
|
+
}[];
|
|
376
|
+
parentTypes: string[];
|
|
377
|
+
subtypes: string[];
|
|
378
|
+
description?: string | undefined;
|
|
379
|
+
examples?: zod.objectOutputType<{
|
|
380
|
+
'@context': zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodRecord<zod.ZodString, zod.ZodUnknown>]>>;
|
|
381
|
+
'@type': zod.ZodOptional<zod.ZodString>;
|
|
382
|
+
'@id': zod.ZodOptional<zod.ZodString>;
|
|
383
|
+
}, zod.ZodTypeAny, "passthrough">[] | undefined;
|
|
384
|
+
}>;
|
|
385
|
+
};
|
|
386
|
+
/**
|
|
387
|
+
* Thing operations
|
|
388
|
+
*/
|
|
389
|
+
Thing: {
|
|
390
|
+
types(params: {
|
|
391
|
+
ns?: string;
|
|
392
|
+
includeSystem?: boolean;
|
|
393
|
+
}): Promise<{
|
|
394
|
+
name: string;
|
|
395
|
+
ns: string;
|
|
396
|
+
}[]>;
|
|
397
|
+
list(params: {
|
|
398
|
+
ns?: string;
|
|
399
|
+
type?: string;
|
|
400
|
+
limit?: number;
|
|
401
|
+
offset?: number;
|
|
402
|
+
}): Promise<{
|
|
403
|
+
data: {
|
|
404
|
+
data: {
|
|
405
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
406
|
+
'@type'?: string | undefined;
|
|
407
|
+
'@id'?: string | undefined;
|
|
408
|
+
} & {
|
|
409
|
+
[k: string]: unknown;
|
|
410
|
+
};
|
|
411
|
+
id: string;
|
|
412
|
+
type: string;
|
|
413
|
+
name: string;
|
|
414
|
+
ns: string;
|
|
415
|
+
ts: Date;
|
|
416
|
+
createdAt: Date;
|
|
417
|
+
updatedAt: Date;
|
|
418
|
+
variant?: string | undefined;
|
|
419
|
+
createdBy?: string | undefined;
|
|
420
|
+
updatedBy?: string | undefined;
|
|
421
|
+
deletedAt?: Date | null | undefined;
|
|
422
|
+
}[];
|
|
423
|
+
total: number;
|
|
424
|
+
}>;
|
|
425
|
+
get(params: {
|
|
426
|
+
ns?: string;
|
|
427
|
+
type: string;
|
|
428
|
+
id: string;
|
|
429
|
+
}): Promise<{
|
|
430
|
+
data: {
|
|
431
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
432
|
+
'@type'?: string | undefined;
|
|
433
|
+
'@id'?: string | undefined;
|
|
434
|
+
} & {
|
|
435
|
+
[k: string]: unknown;
|
|
436
|
+
};
|
|
437
|
+
id: string;
|
|
438
|
+
type: string;
|
|
439
|
+
name: string;
|
|
440
|
+
ns: string;
|
|
441
|
+
ts: Date;
|
|
442
|
+
createdAt: Date;
|
|
443
|
+
updatedAt: Date;
|
|
444
|
+
variant?: string | undefined;
|
|
445
|
+
createdBy?: string | undefined;
|
|
446
|
+
updatedBy?: string | undefined;
|
|
447
|
+
deletedAt?: Date | null | undefined;
|
|
448
|
+
} | null>;
|
|
449
|
+
create(params: {
|
|
450
|
+
ns?: string;
|
|
451
|
+
type: string;
|
|
452
|
+
name?: string;
|
|
453
|
+
data: unknown;
|
|
454
|
+
}): Promise<{
|
|
455
|
+
data: {
|
|
456
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
457
|
+
'@type'?: string | undefined;
|
|
458
|
+
'@id'?: string | undefined;
|
|
459
|
+
} & {
|
|
460
|
+
[k: string]: unknown;
|
|
461
|
+
};
|
|
462
|
+
id: string;
|
|
463
|
+
type: string;
|
|
464
|
+
name: string;
|
|
465
|
+
ns: string;
|
|
466
|
+
ts: Date;
|
|
467
|
+
createdAt: Date;
|
|
468
|
+
updatedAt: Date;
|
|
469
|
+
variant?: string | undefined;
|
|
470
|
+
createdBy?: string | undefined;
|
|
471
|
+
updatedBy?: string | undefined;
|
|
472
|
+
deletedAt?: Date | null | undefined;
|
|
473
|
+
}>;
|
|
474
|
+
update(params: {
|
|
475
|
+
ns?: string;
|
|
476
|
+
type: string;
|
|
477
|
+
id: string;
|
|
478
|
+
data: unknown;
|
|
479
|
+
}): Promise<{
|
|
480
|
+
data: {
|
|
481
|
+
'@context'?: string | Record<string, unknown> | undefined;
|
|
482
|
+
'@type'?: string | undefined;
|
|
483
|
+
'@id'?: string | undefined;
|
|
484
|
+
} & {
|
|
485
|
+
[k: string]: unknown;
|
|
486
|
+
};
|
|
487
|
+
id: string;
|
|
488
|
+
type: string;
|
|
489
|
+
name: string;
|
|
490
|
+
ns: string;
|
|
491
|
+
ts: Date;
|
|
492
|
+
createdAt: Date;
|
|
493
|
+
updatedAt: Date;
|
|
494
|
+
variant?: string | undefined;
|
|
495
|
+
createdBy?: string | undefined;
|
|
496
|
+
updatedBy?: string | undefined;
|
|
497
|
+
deletedAt?: Date | null | undefined;
|
|
498
|
+
}>;
|
|
499
|
+
delete(params: {
|
|
500
|
+
ns?: string;
|
|
501
|
+
type: string;
|
|
502
|
+
id: string;
|
|
503
|
+
hard?: boolean;
|
|
504
|
+
}): Promise<{
|
|
505
|
+
success: boolean;
|
|
506
|
+
}>;
|
|
507
|
+
versions(_params: {
|
|
508
|
+
ns?: string;
|
|
509
|
+
type: string;
|
|
510
|
+
id: string;
|
|
511
|
+
}): Promise<never[]>;
|
|
512
|
+
stats(_params: {
|
|
513
|
+
ns?: string;
|
|
514
|
+
type?: string;
|
|
515
|
+
}): Promise<{
|
|
516
|
+
total: number;
|
|
517
|
+
byType: Record<string, number>;
|
|
518
|
+
}>;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* SQL operations (mock implementation)
|
|
522
|
+
*/
|
|
523
|
+
SQL: {
|
|
524
|
+
execute(params: {
|
|
525
|
+
query: string;
|
|
526
|
+
params?: unknown[];
|
|
527
|
+
}): Promise<{
|
|
528
|
+
rows: {
|
|
529
|
+
id: string;
|
|
530
|
+
ns: string;
|
|
531
|
+
type: string;
|
|
532
|
+
name: string;
|
|
533
|
+
createdAt: Date;
|
|
534
|
+
updatedAt: Date;
|
|
535
|
+
data: string;
|
|
536
|
+
}[];
|
|
537
|
+
columns: {
|
|
538
|
+
name: string;
|
|
539
|
+
type: string;
|
|
540
|
+
}[];
|
|
541
|
+
rowsAffected: number;
|
|
542
|
+
executionTimeMs: number;
|
|
543
|
+
}>;
|
|
544
|
+
};
|
|
545
|
+
dup: () => /*elided*/ any;
|
|
546
|
+
onRpcBroken: (_callback: (error: unknown) => void) => void;
|
|
547
|
+
[Symbol.dispose]: () => void;
|
|
548
|
+
_store: MockStore;
|
|
549
|
+
_reset: () => void;
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* JSON-RPC Client for DO Admin API
|
|
554
|
+
*
|
|
555
|
+
* This client wraps the JSON-RPC API exposed by DO admin servers,
|
|
556
|
+
* translating the standard Thing/Schema interface to the server's
|
|
557
|
+
* actual RPC methods.
|
|
558
|
+
*
|
|
559
|
+
* Auto-discovers available types and endpoints from the server.
|
|
560
|
+
*
|
|
561
|
+
* @module
|
|
562
|
+
*/
|
|
563
|
+
/** SQL execution result */
|
|
564
|
+
interface SQLResult {
|
|
565
|
+
rows: Record<string, unknown>[];
|
|
566
|
+
columns: {
|
|
567
|
+
name: string;
|
|
568
|
+
type: string;
|
|
569
|
+
}[];
|
|
570
|
+
rowsAffected?: number;
|
|
571
|
+
executionTimeMs?: number;
|
|
572
|
+
}
|
|
573
|
+
interface JsonRpcClientOptions {
|
|
574
|
+
/** Auth token to include in Authorization header */
|
|
575
|
+
authToken?: string;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Create a JSON-RPC compatible client that matches the DOClient interface
|
|
579
|
+
*/
|
|
580
|
+
declare function createJsonRpcClient(baseUrl: string, options?: JsonRpcClientOptions): {
|
|
581
|
+
/**
|
|
582
|
+
* Namespace operations
|
|
583
|
+
*/
|
|
584
|
+
Namespace: {
|
|
585
|
+
list(_params?: {
|
|
586
|
+
includeSystem?: boolean;
|
|
587
|
+
}): Promise<{
|
|
588
|
+
id: string;
|
|
589
|
+
name: string;
|
|
590
|
+
}[]>;
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Schema operations
|
|
594
|
+
*/
|
|
595
|
+
Schema: {
|
|
596
|
+
discover(_params?: {
|
|
597
|
+
ns?: string;
|
|
598
|
+
}): Promise<{
|
|
599
|
+
namespaces: string[];
|
|
600
|
+
types: string[];
|
|
601
|
+
schemas: string[];
|
|
602
|
+
}>;
|
|
603
|
+
get(params: {
|
|
604
|
+
ns?: string;
|
|
605
|
+
type: string;
|
|
606
|
+
}): Promise<unknown>;
|
|
607
|
+
};
|
|
608
|
+
/**
|
|
609
|
+
* Thing operations (maps to REST endpoints)
|
|
610
|
+
*/
|
|
611
|
+
Thing: {
|
|
612
|
+
types(params: {
|
|
613
|
+
ns?: string;
|
|
614
|
+
includeSystem?: boolean;
|
|
615
|
+
}): Promise<{
|
|
616
|
+
name: string;
|
|
617
|
+
ns: string;
|
|
618
|
+
}[]>;
|
|
619
|
+
list(params: {
|
|
620
|
+
ns?: string;
|
|
621
|
+
type?: string;
|
|
622
|
+
limit?: number;
|
|
623
|
+
offset?: number;
|
|
624
|
+
}): Promise<{
|
|
625
|
+
data: unknown[];
|
|
626
|
+
total: number;
|
|
627
|
+
}>;
|
|
628
|
+
get(params: {
|
|
629
|
+
ns?: string;
|
|
630
|
+
type: string;
|
|
631
|
+
id: string;
|
|
632
|
+
}): Promise<unknown>;
|
|
633
|
+
create(params: {
|
|
634
|
+
ns?: string;
|
|
635
|
+
type: string;
|
|
636
|
+
data: unknown;
|
|
637
|
+
}): Promise<unknown>;
|
|
638
|
+
update(params: {
|
|
639
|
+
ns?: string;
|
|
640
|
+
type: string;
|
|
641
|
+
id: string;
|
|
642
|
+
data: unknown;
|
|
643
|
+
}): Promise<unknown>;
|
|
644
|
+
delete(params: {
|
|
645
|
+
ns?: string;
|
|
646
|
+
type: string;
|
|
647
|
+
id: string;
|
|
648
|
+
hard?: boolean;
|
|
649
|
+
}): Promise<{
|
|
650
|
+
success: boolean;
|
|
651
|
+
}>;
|
|
652
|
+
versions(_params: {
|
|
653
|
+
ns?: string;
|
|
654
|
+
type: string;
|
|
655
|
+
id: string;
|
|
656
|
+
}): Promise<never[]>;
|
|
657
|
+
stats(_params: {
|
|
658
|
+
ns?: string;
|
|
659
|
+
type?: string;
|
|
660
|
+
}): Promise<{
|
|
661
|
+
total: number;
|
|
662
|
+
byType: Record<string, number>;
|
|
663
|
+
}>;
|
|
664
|
+
};
|
|
665
|
+
/**
|
|
666
|
+
* SQL operations
|
|
667
|
+
*/
|
|
668
|
+
SQL: {
|
|
669
|
+
execute(params: {
|
|
670
|
+
query: string;
|
|
671
|
+
params?: unknown[];
|
|
672
|
+
}): Promise<SQLResult>;
|
|
673
|
+
};
|
|
674
|
+
dup: () => /*elided*/ any;
|
|
675
|
+
onRpcBroken: (_callback: (error: unknown) => void) => void;
|
|
676
|
+
[Symbol.dispose]: () => void;
|
|
677
|
+
};
|
|
678
|
+
/**
|
|
679
|
+
* Create a client context - factory function matching $Context interface
|
|
680
|
+
*/
|
|
681
|
+
declare function $JsonRpcContext(url: string, options?: JsonRpcClientOptions): {
|
|
682
|
+
/**
|
|
683
|
+
* Namespace operations
|
|
684
|
+
*/
|
|
685
|
+
Namespace: {
|
|
686
|
+
list(_params?: {
|
|
687
|
+
includeSystem?: boolean;
|
|
688
|
+
}): Promise<{
|
|
689
|
+
id: string;
|
|
690
|
+
name: string;
|
|
691
|
+
}[]>;
|
|
692
|
+
};
|
|
693
|
+
/**
|
|
694
|
+
* Schema operations
|
|
695
|
+
*/
|
|
696
|
+
Schema: {
|
|
697
|
+
discover(_params?: {
|
|
698
|
+
ns?: string;
|
|
699
|
+
}): Promise<{
|
|
700
|
+
namespaces: string[];
|
|
701
|
+
types: string[];
|
|
702
|
+
schemas: string[];
|
|
703
|
+
}>;
|
|
704
|
+
get(params: {
|
|
705
|
+
ns?: string;
|
|
706
|
+
type: string;
|
|
707
|
+
}): Promise<unknown>;
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* Thing operations (maps to REST endpoints)
|
|
711
|
+
*/
|
|
712
|
+
Thing: {
|
|
713
|
+
types(params: {
|
|
714
|
+
ns?: string;
|
|
715
|
+
includeSystem?: boolean;
|
|
716
|
+
}): Promise<{
|
|
717
|
+
name: string;
|
|
718
|
+
ns: string;
|
|
719
|
+
}[]>;
|
|
720
|
+
list(params: {
|
|
721
|
+
ns?: string;
|
|
722
|
+
type?: string;
|
|
723
|
+
limit?: number;
|
|
724
|
+
offset?: number;
|
|
725
|
+
}): Promise<{
|
|
726
|
+
data: unknown[];
|
|
727
|
+
total: number;
|
|
728
|
+
}>;
|
|
729
|
+
get(params: {
|
|
730
|
+
ns?: string;
|
|
731
|
+
type: string;
|
|
732
|
+
id: string;
|
|
733
|
+
}): Promise<unknown>;
|
|
734
|
+
create(params: {
|
|
735
|
+
ns?: string;
|
|
736
|
+
type: string;
|
|
737
|
+
data: unknown;
|
|
738
|
+
}): Promise<unknown>;
|
|
739
|
+
update(params: {
|
|
740
|
+
ns?: string;
|
|
741
|
+
type: string;
|
|
742
|
+
id: string;
|
|
743
|
+
data: unknown;
|
|
744
|
+
}): Promise<unknown>;
|
|
745
|
+
delete(params: {
|
|
746
|
+
ns?: string;
|
|
747
|
+
type: string;
|
|
748
|
+
id: string;
|
|
749
|
+
hard?: boolean;
|
|
750
|
+
}): Promise<{
|
|
751
|
+
success: boolean;
|
|
752
|
+
}>;
|
|
753
|
+
versions(_params: {
|
|
754
|
+
ns?: string;
|
|
755
|
+
type: string;
|
|
756
|
+
id: string;
|
|
757
|
+
}): Promise<never[]>;
|
|
758
|
+
stats(_params: {
|
|
759
|
+
ns?: string;
|
|
760
|
+
type?: string;
|
|
761
|
+
}): Promise<{
|
|
762
|
+
total: number;
|
|
763
|
+
byType: Record<string, number>;
|
|
764
|
+
}>;
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* SQL operations
|
|
768
|
+
*/
|
|
769
|
+
SQL: {
|
|
770
|
+
execute(params: {
|
|
771
|
+
query: string;
|
|
772
|
+
params?: unknown[];
|
|
773
|
+
}): Promise<SQLResult>;
|
|
774
|
+
};
|
|
775
|
+
dup: () => /*elided*/ any;
|
|
776
|
+
onRpcBroken: (_callback: (error: unknown) => void) => void;
|
|
777
|
+
[Symbol.dispose]: () => void;
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Mock Data Generators for DO Admin
|
|
782
|
+
*
|
|
783
|
+
* Generates realistic mock data for Things, Schemas, and other entities.
|
|
784
|
+
* Used by the mock client for demo/development mode.
|
|
785
|
+
*
|
|
786
|
+
* @module
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
declare const MOCK_TYPES: string[];
|
|
790
|
+
declare function generateMockSchema(typeName: string): SemanticType;
|
|
791
|
+
declare function generateMockThing(type: string, id?: string): Thing;
|
|
792
|
+
declare function generateMockThings(type: string, count: number): Thing[];
|
|
793
|
+
/**
|
|
794
|
+
* Generate initial mock data set with various types
|
|
795
|
+
*/
|
|
796
|
+
declare function generateInitialMockData(): Thing[];
|
|
797
|
+
|
|
798
|
+
export { $JsonRpcContext, $MockContext, type HealthCheckConfig, type HealthCheckResult, MOCK_TYPES, createJsonRpcClient, createMockClient, deriveRpcUrl, generateInitialMockData, generateMockSchema, generateMockThing, generateMockThings, useHealthCheck };
|