@mdxui/do 4.0.0 → 4.0.8
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/dist/app/index.d.ts +32 -186
- package/dist/app/index.js +19 -11
- package/dist/auth/index.d.ts +48 -0
- package/dist/auth/index.js +4 -0
- package/dist/{breadcrumbs-C9Qn3S7d.d.ts → breadcrumbs-DltlCiHt.d.ts} +3 -3
- package/dist/chunk-2FWXT4HH.js +576 -0
- package/dist/chunk-2FWXT4HH.js.map +1 -0
- package/dist/chunk-5PC6U46L.js +604 -0
- package/dist/chunk-5PC6U46L.js.map +1 -0
- package/dist/chunk-63VCRTDQ.js +2505 -0
- package/dist/chunk-63VCRTDQ.js.map +1 -0
- package/dist/chunk-7J3RSIG4.js +178 -0
- package/dist/chunk-7J3RSIG4.js.map +1 -0
- package/dist/chunk-7QCTRNEJ.js +173 -0
- package/dist/chunk-7QCTRNEJ.js.map +1 -0
- package/dist/chunk-7TFHUKS7.js +66 -0
- package/dist/chunk-7TFHUKS7.js.map +1 -0
- package/dist/{chunk-LJIWB7KE.js → chunk-BU5HMHGQ.js} +3 -3
- package/dist/chunk-BU5HMHGQ.js.map +1 -0
- package/dist/{chunk-GGO5GW72.js → chunk-BZURBNFD.js} +305 -51
- package/dist/chunk-BZURBNFD.js.map +1 -0
- package/dist/{chunk-NA652ART.js → chunk-FM2RTAHV.js} +5 -65
- package/dist/chunk-FM2RTAHV.js.map +1 -0
- package/dist/{chunk-WMNT4OIE.js → chunk-HC4PBXV4.js} +131 -58
- package/dist/chunk-HC4PBXV4.js.map +1 -0
- package/dist/{chunk-Y52IEYVM.js → chunk-JPZ6RZJE.js} +78 -45
- package/dist/chunk-JPZ6RZJE.js.map +1 -0
- package/dist/{chunk-OVLO7UOH.js → chunk-KLN5OTQH.js} +168 -361
- package/dist/chunk-KLN5OTQH.js.map +1 -0
- package/dist/chunk-LCYBQR35.js +79 -0
- package/dist/chunk-LCYBQR35.js.map +1 -0
- package/dist/chunk-PJYGRD7N.js +216 -0
- package/dist/chunk-PJYGRD7N.js.map +1 -0
- package/dist/chunk-QEXY4FZV.js +292 -0
- package/dist/chunk-QEXY4FZV.js.map +1 -0
- package/dist/chunk-SX4IIE2R.js +53 -0
- package/dist/chunk-SX4IIE2R.js.map +1 -0
- package/dist/chunk-UCWMSKCW.js +901 -0
- package/dist/chunk-UCWMSKCW.js.map +1 -0
- package/dist/{chunk-5SHZZC7L.js → chunk-WC6SFBAF.js} +59 -6
- package/dist/chunk-WC6SFBAF.js.map +1 -0
- package/dist/chunk-WIKU77ZY.js +18 -0
- package/dist/chunk-WIKU77ZY.js.map +1 -0
- package/dist/chunk-X3AWNFBF.js +47 -0
- package/dist/chunk-X3AWNFBF.js.map +1 -0
- package/dist/chunk-ZZTQGMLX.js +23 -0
- package/dist/chunk-ZZTQGMLX.js.map +1 -0
- package/dist/{lib → client}/index.d.ts +97 -345
- package/dist/client/index.js +3 -0
- package/dist/common-DW_JM2dW.d.ts +454 -0
- package/dist/components/index.d.ts +11 -2
- package/dist/components/index.js +8 -3
- package/dist/{config-CxvpD8Y6.d.ts → config-DB14_LhF.d.ts} +1 -1
- package/dist/{do-D27i5bU0.d.ts → do-D37hbmL9.d.ts} +6 -14
- package/dist/dotdo-client-2DkwXHM2.d.ts +344 -0
- package/dist/errors-BOY11CJs.d.ts +373 -0
- package/dist/features/data-browser/index.d.ts +51 -0
- package/dist/features/data-browser/index.js +12 -0
- package/dist/features/data-browser/index.js.map +1 -0
- package/dist/features/data-grid/index.d.ts +22 -0
- package/dist/features/data-grid/index.js +12 -0
- package/dist/features/data-grid/index.js.map +1 -0
- package/dist/features/document-editor/index.d.ts +26 -0
- package/dist/features/document-editor/index.js +12 -0
- package/dist/features/document-editor/index.js.map +1 -0
- package/dist/features/function-editor/index.d.ts +215 -0
- package/dist/features/function-editor/index.js +7 -0
- package/dist/features/function-editor/index.js.map +1 -0
- package/dist/hooks/index.d.ts +64 -7
- package/dist/hooks/index.js +8 -7
- package/dist/hooks/things/index.d.ts +5 -297
- package/dist/hooks/things/index.js +6 -6
- package/dist/index-C0m9UI6W.d.ts +444 -0
- package/dist/index.d.ts +42 -32
- package/dist/index.js +21 -13
- package/dist/providers/index.d.ts +16 -28
- package/dist/providers/index.js +3 -3
- package/dist/schemas/index.d.ts +4551 -109
- package/dist/schemas/index.js +2 -260
- package/dist/schemas/index.js.map +1 -1
- package/dist/shell/index.d.ts +92 -0
- package/dist/shell/index.js +6 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/{thing-BF25aUtJ.d.ts → thing-Dc3AE2XI.d.ts} +22 -22
- package/dist/thing-adapters-aMjF0h9u.d.ts +1214 -0
- package/dist/types/index.d.ts +954 -7521
- package/dist/types/index.js +2 -2
- package/dist/ui-filters-BvrjMP_U.d.ts +108 -0
- package/dist/{errors-DratdVIz.d.ts → utils/index.d.ts} +38 -77
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist-app/assets/index-DWX3479M.js +7 -0
- package/dist-app/assets/index-DWX3479M.js.map +1 -0
- package/dist-app/assets/main-BptePr_C.js +318 -0
- package/dist-app/assets/main-BptePr_C.js.map +1 -0
- package/dist-app/assets/main-CS9jgKzj.css +1 -0
- package/dist-app/index.html +38 -0
- package/package.json +32 -19
- package/dist/agents-2_r9e9i7.d.ts +0 -1043
- package/dist/capnweb-client-Bq78FtEA.d.ts +0 -229
- package/dist/chunk-3XKYQRXY.js +0 -192
- package/dist/chunk-3XKYQRXY.js.map +0 -1
- package/dist/chunk-4KXVN3EQ.js +0 -56
- package/dist/chunk-4KXVN3EQ.js.map +0 -1
- package/dist/chunk-5SHZZC7L.js.map +0 -1
- package/dist/chunk-7UFINK3Q.js +0 -1994
- package/dist/chunk-7UFINK3Q.js.map +0 -1
- package/dist/chunk-GGO5GW72.js.map +0 -1
- package/dist/chunk-JJLAES6W.js +0 -76
- package/dist/chunk-JJLAES6W.js.map +0 -1
- package/dist/chunk-KT52UU3U.js +0 -985
- package/dist/chunk-KT52UU3U.js.map +0 -1
- package/dist/chunk-LJIWB7KE.js.map +0 -1
- package/dist/chunk-NA652ART.js.map +0 -1
- package/dist/chunk-OVLO7UOH.js.map +0 -1
- package/dist/chunk-VRLUXCLD.js +0 -31
- package/dist/chunk-VRLUXCLD.js.map +0 -1
- package/dist/chunk-WMNT4OIE.js.map +0 -1
- package/dist/chunk-Y52IEYVM.js.map +0 -1
- package/dist/lib/index.js +0 -6
- package/dist/query-keys-CZNFikIi.d.ts +0 -153
- package/dist/views/index.d.ts +0 -131
- package/dist/views/index.js +0 -11
- /package/dist/{lib → auth}/index.js.map +0 -0
- /package/dist/{views → client}/index.js.map +0 -0
|
@@ -1,102 +1,6 @@
|
|
|
1
|
-
export {
|
|
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';
|
|
1
|
+
export { $ as $DOContext, D as DOContextClient, a as DOContextOptions, S as SQLResult, c as createDOClient } from '../dotdo-client-2DkwXHM2.js';
|
|
3
2
|
import * as zod from 'zod';
|
|
4
|
-
import { T as Thing, S as SemanticType } from '../thing-
|
|
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;
|
|
3
|
+
import { T as Thing, S as SemanticType } from '../thing-Dc3AE2XI.js';
|
|
100
4
|
|
|
101
5
|
interface MockClientOptions {
|
|
102
6
|
/** Initial data to populate the store */
|
|
@@ -143,7 +47,6 @@ declare function createMockClient(options?: MockClientOptions): {
|
|
|
143
47
|
label: string;
|
|
144
48
|
id: string;
|
|
145
49
|
name: string;
|
|
146
|
-
namespace: string;
|
|
147
50
|
properties: {
|
|
148
51
|
label: string;
|
|
149
52
|
name: string;
|
|
@@ -154,6 +57,7 @@ declare function createMockClient(options?: MockClientOptions): {
|
|
|
154
57
|
isArray: boolean;
|
|
155
58
|
defaultValue?: unknown;
|
|
156
59
|
}[];
|
|
60
|
+
namespace: string;
|
|
157
61
|
parentTypes: string[];
|
|
158
62
|
subtypes: string[];
|
|
159
63
|
description?: string | undefined;
|
|
@@ -192,10 +96,10 @@ declare function createMockClient(options?: MockClientOptions): {
|
|
|
192
96
|
id: string;
|
|
193
97
|
type: string;
|
|
194
98
|
name: string;
|
|
195
|
-
ns: string;
|
|
196
|
-
ts: Date;
|
|
197
99
|
createdAt: Date;
|
|
198
100
|
updatedAt: Date;
|
|
101
|
+
ns: string;
|
|
102
|
+
ts: Date;
|
|
199
103
|
variant?: string | undefined;
|
|
200
104
|
createdBy?: string | undefined;
|
|
201
105
|
updatedBy?: string | undefined;
|
|
@@ -218,10 +122,10 @@ declare function createMockClient(options?: MockClientOptions): {
|
|
|
218
122
|
id: string;
|
|
219
123
|
type: string;
|
|
220
124
|
name: string;
|
|
221
|
-
ns: string;
|
|
222
|
-
ts: Date;
|
|
223
125
|
createdAt: Date;
|
|
224
126
|
updatedAt: Date;
|
|
127
|
+
ns: string;
|
|
128
|
+
ts: Date;
|
|
225
129
|
variant?: string | undefined;
|
|
226
130
|
createdBy?: string | undefined;
|
|
227
131
|
updatedBy?: string | undefined;
|
|
@@ -243,10 +147,10 @@ declare function createMockClient(options?: MockClientOptions): {
|
|
|
243
147
|
id: string;
|
|
244
148
|
type: string;
|
|
245
149
|
name: string;
|
|
246
|
-
ns: string;
|
|
247
|
-
ts: Date;
|
|
248
150
|
createdAt: Date;
|
|
249
151
|
updatedAt: Date;
|
|
152
|
+
ns: string;
|
|
153
|
+
ts: Date;
|
|
250
154
|
variant?: string | undefined;
|
|
251
155
|
createdBy?: string | undefined;
|
|
252
156
|
updatedBy?: string | undefined;
|
|
@@ -268,10 +172,10 @@ declare function createMockClient(options?: MockClientOptions): {
|
|
|
268
172
|
id: string;
|
|
269
173
|
type: string;
|
|
270
174
|
name: string;
|
|
271
|
-
ns: string;
|
|
272
|
-
ts: Date;
|
|
273
175
|
createdAt: Date;
|
|
274
176
|
updatedAt: Date;
|
|
177
|
+
ns: string;
|
|
178
|
+
ts: Date;
|
|
275
179
|
variant?: string | undefined;
|
|
276
180
|
createdBy?: string | undefined;
|
|
277
181
|
updatedBy?: string | undefined;
|
|
@@ -362,7 +266,6 @@ declare function $MockContext(options?: MockClientOptions): {
|
|
|
362
266
|
label: string;
|
|
363
267
|
id: string;
|
|
364
268
|
name: string;
|
|
365
|
-
namespace: string;
|
|
366
269
|
properties: {
|
|
367
270
|
label: string;
|
|
368
271
|
name: string;
|
|
@@ -373,6 +276,7 @@ declare function $MockContext(options?: MockClientOptions): {
|
|
|
373
276
|
isArray: boolean;
|
|
374
277
|
defaultValue?: unknown;
|
|
375
278
|
}[];
|
|
279
|
+
namespace: string;
|
|
376
280
|
parentTypes: string[];
|
|
377
281
|
subtypes: string[];
|
|
378
282
|
description?: string | undefined;
|
|
@@ -411,10 +315,10 @@ declare function $MockContext(options?: MockClientOptions): {
|
|
|
411
315
|
id: string;
|
|
412
316
|
type: string;
|
|
413
317
|
name: string;
|
|
414
|
-
ns: string;
|
|
415
|
-
ts: Date;
|
|
416
318
|
createdAt: Date;
|
|
417
319
|
updatedAt: Date;
|
|
320
|
+
ns: string;
|
|
321
|
+
ts: Date;
|
|
418
322
|
variant?: string | undefined;
|
|
419
323
|
createdBy?: string | undefined;
|
|
420
324
|
updatedBy?: string | undefined;
|
|
@@ -437,10 +341,10 @@ declare function $MockContext(options?: MockClientOptions): {
|
|
|
437
341
|
id: string;
|
|
438
342
|
type: string;
|
|
439
343
|
name: string;
|
|
440
|
-
ns: string;
|
|
441
|
-
ts: Date;
|
|
442
344
|
createdAt: Date;
|
|
443
345
|
updatedAt: Date;
|
|
346
|
+
ns: string;
|
|
347
|
+
ts: Date;
|
|
444
348
|
variant?: string | undefined;
|
|
445
349
|
createdBy?: string | undefined;
|
|
446
350
|
updatedBy?: string | undefined;
|
|
@@ -462,10 +366,10 @@ declare function $MockContext(options?: MockClientOptions): {
|
|
|
462
366
|
id: string;
|
|
463
367
|
type: string;
|
|
464
368
|
name: string;
|
|
465
|
-
ns: string;
|
|
466
|
-
ts: Date;
|
|
467
369
|
createdAt: Date;
|
|
468
370
|
updatedAt: Date;
|
|
371
|
+
ns: string;
|
|
372
|
+
ts: Date;
|
|
469
373
|
variant?: string | undefined;
|
|
470
374
|
createdBy?: string | undefined;
|
|
471
375
|
updatedBy?: string | undefined;
|
|
@@ -487,10 +391,10 @@ declare function $MockContext(options?: MockClientOptions): {
|
|
|
487
391
|
id: string;
|
|
488
392
|
type: string;
|
|
489
393
|
name: string;
|
|
490
|
-
ns: string;
|
|
491
|
-
ts: Date;
|
|
492
394
|
createdAt: Date;
|
|
493
395
|
updatedAt: Date;
|
|
396
|
+
ns: string;
|
|
397
|
+
ts: Date;
|
|
494
398
|
variant?: string | undefined;
|
|
495
399
|
createdBy?: string | undefined;
|
|
496
400
|
updatedBy?: string | undefined;
|
|
@@ -549,234 +453,6 @@ declare function $MockContext(options?: MockClientOptions): {
|
|
|
549
453
|
_reset: () => void;
|
|
550
454
|
};
|
|
551
455
|
|
|
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
456
|
/**
|
|
781
457
|
* Mock Data Generators for DO Admin
|
|
782
458
|
*
|
|
@@ -795,4 +471,80 @@ declare function generateMockThings(type: string, count: number): Thing[];
|
|
|
795
471
|
*/
|
|
796
472
|
declare function generateInitialMockData(): Thing[];
|
|
797
473
|
|
|
798
|
-
|
|
474
|
+
/**
|
|
475
|
+
* Fetch wrapper with configurable timeout
|
|
476
|
+
*
|
|
477
|
+
* Prevents indefinite hangs on slow networks or unresponsive servers
|
|
478
|
+
* by wrapping fetch with AbortController-based timeout.
|
|
479
|
+
*
|
|
480
|
+
* @module
|
|
481
|
+
*/
|
|
482
|
+
/**
|
|
483
|
+
* Default timeout in milliseconds (30 seconds)
|
|
484
|
+
*/
|
|
485
|
+
declare const DEFAULT_REQUEST_TIMEOUT = 30000;
|
|
486
|
+
/**
|
|
487
|
+
* Extended RequestInit that includes optional timeout
|
|
488
|
+
*/
|
|
489
|
+
interface FetchWithTimeoutOptions extends RequestInit {
|
|
490
|
+
/** Timeout in milliseconds. Defaults to 30000 (30 seconds) */
|
|
491
|
+
timeout?: number;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Fetch wrapper with configurable timeout
|
|
495
|
+
*
|
|
496
|
+
* Uses AbortController to cancel requests that exceed the timeout.
|
|
497
|
+
* If the request already has a signal, a composite abort will be used
|
|
498
|
+
* that respects both the existing signal and the timeout.
|
|
499
|
+
*
|
|
500
|
+
* @param url - The URL to fetch
|
|
501
|
+
* @param options - Fetch options including optional timeout
|
|
502
|
+
* @returns Promise resolving to the Response
|
|
503
|
+
* @throws {DOMException} AbortError if the request times out
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```typescript
|
|
507
|
+
* // Basic usage with default 30s timeout
|
|
508
|
+
* const response = await fetchWithTimeout('https://api.example.com/data')
|
|
509
|
+
*
|
|
510
|
+
* // Custom timeout
|
|
511
|
+
* const response = await fetchWithTimeout('https://api.example.com/data', {
|
|
512
|
+
* timeout: 5000, // 5 seconds
|
|
513
|
+
* })
|
|
514
|
+
*
|
|
515
|
+
* // With other fetch options
|
|
516
|
+
* const response = await fetchWithTimeout('https://api.example.com/data', {
|
|
517
|
+
* method: 'POST',
|
|
518
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
519
|
+
* body: JSON.stringify({ key: 'value' }),
|
|
520
|
+
* timeout: 10000,
|
|
521
|
+
* })
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
declare function fetchWithTimeout(url: string, options?: FetchWithTimeoutOptions): Promise<Response>;
|
|
525
|
+
/**
|
|
526
|
+
* Create a fetch wrapper with a default timeout from config
|
|
527
|
+
*
|
|
528
|
+
* Useful for creating a configured fetch function that can be shared
|
|
529
|
+
* across multiple hooks/components with consistent timeout behavior.
|
|
530
|
+
*
|
|
531
|
+
* @param defaultTimeout - Default timeout in milliseconds
|
|
532
|
+
* @returns A fetch function with the default timeout applied
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```typescript
|
|
536
|
+
* // Create a configured fetch
|
|
537
|
+
* const configuredFetch = createFetchWithTimeout(5000)
|
|
538
|
+
*
|
|
539
|
+
* // Use it (timeout defaults to 5000ms)
|
|
540
|
+
* const response = await configuredFetch('https://api.example.com/data')
|
|
541
|
+
*
|
|
542
|
+
* // Override the default timeout
|
|
543
|
+
* const response = await configuredFetch('https://api.example.com/data', {
|
|
544
|
+
* timeout: 10000,
|
|
545
|
+
* })
|
|
546
|
+
* ```
|
|
547
|
+
*/
|
|
548
|
+
declare function createFetchWithTimeout(defaultTimeout: number): (url: string, options?: FetchWithTimeoutOptions) => Promise<Response>;
|
|
549
|
+
|
|
550
|
+
export { $MockContext, DEFAULT_REQUEST_TIMEOUT, type FetchWithTimeoutOptions, MOCK_TYPES, type MockClientOptions, createFetchWithTimeout, createMockClient, fetchWithTimeout, generateInitialMockData, generateMockSchema, generateMockThing, generateMockThings };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { $DOContext, $MockContext, DEFAULT_REQUEST_TIMEOUT, MOCK_TYPES, createDOClient, createFetchWithTimeout, createMockClient, fetchWithTimeout, generateInitialMockData, generateMockSchema, generateMockThing, generateMockThings } from '../chunk-KLN5OTQH.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|