@dyrected/core 0.0.0-pr-18-20260828214838

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.
@@ -0,0 +1,602 @@
1
+ import * as hono_types from 'hono/types';
2
+ import * as hono from 'hono';
3
+ import { Context, Hono } from 'hono';
4
+ import { Logger } from 'pino';
5
+ import { D as DyrectedConfig, bp as DyrectedObservabilityConfig, C as CollectionConfig, G as GlobalConfig } from './app-config-BgV9qpFu.js';
6
+ import { JWTPayload } from 'jose';
7
+ import { Tracer, Counter, Attributes, Histogram, Span } from '@opentelemetry/api';
8
+ import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
9
+ import * as hono_utils_types from 'hono/utils/types';
10
+ import * as hono_utils_http_status from 'hono/utils/http-status';
11
+ import 'lucide-react';
12
+ import 'zod';
13
+
14
+ interface CollectionTokenPayload extends JWTPayload {
15
+ sub: string;
16
+ email: string;
17
+ collection: string;
18
+ sid?: string;
19
+ purpose?: 'invite' | 'reset';
20
+ providerId?: string;
21
+ authSource?: 'local' | 'external';
22
+ }
23
+
24
+ type RequestVars = DyrectedContext["Variables"];
25
+ interface ResolvedObservabilityConfig {
26
+ requestLogging: {
27
+ enabled: boolean;
28
+ logBodies: boolean;
29
+ maxBodyBytes: number;
30
+ redactPaths: string[];
31
+ includeHeaders: string[];
32
+ redactHeaders: string[];
33
+ };
34
+ sampling: {
35
+ successRate: number;
36
+ traceSuccessRate: number;
37
+ bodySuccessRate: number;
38
+ alwaysKeep4xx: boolean;
39
+ alwaysKeep5xx: boolean;
40
+ };
41
+ tracing: {
42
+ enabled: boolean;
43
+ serviceName: string;
44
+ exporter: "otlp" | "console" | "none";
45
+ headers: Record<string, string>;
46
+ endpoint?: string;
47
+ };
48
+ metrics: {
49
+ enabled: boolean;
50
+ exporter: "otlp" | "prometheus" | "none";
51
+ endpoint?: string;
52
+ path: string;
53
+ };
54
+ transports: {
55
+ targets: Array<{
56
+ type: "stdout";
57
+ } | {
58
+ type: "stderr";
59
+ } | {
60
+ type: "file";
61
+ path: string;
62
+ } | {
63
+ type: "otlp";
64
+ endpoint: string;
65
+ headers?: Record<string, string>;
66
+ }>;
67
+ };
68
+ }
69
+ interface RequestTraceContext {
70
+ span: Span;
71
+ traceId: string;
72
+ spanId: string;
73
+ sampled: boolean;
74
+ }
75
+ interface RequestBodyCapture {
76
+ attempted: boolean;
77
+ contentType?: string;
78
+ contentLength?: number;
79
+ truncated?: boolean;
80
+ parseFailed?: boolean;
81
+ body?: unknown;
82
+ }
83
+ interface MetricsRuntime {
84
+ requestCount: Counter<Attributes>;
85
+ authFailureCount: Counter<Attributes>;
86
+ uncaughtErrorCount: Counter<Attributes>;
87
+ auditWriteFailureCount: Counter<Attributes>;
88
+ emailSendFailureCount: Counter<Attributes>;
89
+ workflowHookFailureCount: Counter<Attributes>;
90
+ requestDuration: Histogram<Attributes>;
91
+ }
92
+ interface DyrectedObservabilityRuntime {
93
+ logger: Logger;
94
+ config: ResolvedObservabilityConfig;
95
+ tracer?: Tracer;
96
+ metrics?: MetricsRuntime;
97
+ prometheusExporter?: PrometheusExporter;
98
+ shutdown: () => Promise<void>;
99
+ recordAuthFailure: (attributes?: Attributes) => void;
100
+ recordUncaughtError: (attributes?: Attributes) => void;
101
+ recordAuditWriteFailure: (attributes?: Attributes) => void;
102
+ recordEmailSendFailure: (attributes?: Attributes) => void;
103
+ recordWorkflowHookFailure: (attributes?: Attributes) => void;
104
+ }
105
+ declare function resolveObservabilityConfig(config?: DyrectedObservabilityConfig): ResolvedObservabilityConfig;
106
+ declare function createObservabilityRuntime(config: DyrectedConfig): DyrectedObservabilityRuntime;
107
+ declare function bindObservabilityRuntime(config: DyrectedConfig, runtime: DyrectedObservabilityRuntime): void;
108
+ declare function getObservabilityRuntime(config: Pick<DyrectedConfig, "logger"> | undefined): DyrectedObservabilityRuntime | undefined;
109
+ declare function getConfigLogger(config: Pick<DyrectedConfig, "logger"> | undefined, component: string): Logger;
110
+ declare function getRequestLogger(c: Context<DyrectedContext>, component?: string): Logger;
111
+ declare function buildRequestLogger(runtime: DyrectedObservabilityRuntime, vars: RequestVars, requestId?: string): Logger;
112
+ declare function shouldSampleRequest(requestId: string | undefined, statusCode: number, sampling: ResolvedObservabilityConfig["sampling"], kind: "log" | "trace" | "body"): boolean;
113
+ declare function redactHeaders(headers: Record<string, string>, observability: ResolvedObservabilityConfig): Record<string, string>;
114
+ declare function captureRequestBody(request: Request, observability: ResolvedObservabilityConfig): Promise<RequestBodyCapture>;
115
+ declare function redactBody(value: unknown, redactPaths: string[]): unknown;
116
+ declare function createRequestSpan(runtime: DyrectedObservabilityRuntime, name: string, attributes: Attributes): RequestTraceContext | undefined;
117
+ declare function endRequestSpan(requestTrace: RequestTraceContext | undefined, statusCode: number, error?: unknown): void;
118
+ declare function attachRequestMetrics(runtime: DyrectedObservabilityRuntime, args: {
119
+ method: string;
120
+ route: string;
121
+ statusCode: number;
122
+ durationMs: number;
123
+ }): void;
124
+ declare function renderPrometheusMetrics(exporter: PrometheusExporter): Promise<{
125
+ body: string;
126
+ headers: Record<string, string>;
127
+ statusCode: number;
128
+ }>;
129
+
130
+ interface DyrectedContext {
131
+ Variables: {
132
+ config: DyrectedConfig;
133
+ logger?: Logger;
134
+ observability?: DyrectedObservabilityRuntime;
135
+ siteId?: string;
136
+ workspaceId?: string;
137
+ requestBodyCapture?: RequestBodyCapture;
138
+ requestTrace?: RequestTraceContext;
139
+ /**
140
+ * The authenticated user set by requireAuth() or optionalAuth() middleware.
141
+ * Hydrated from the full user record (minus password) when a db adapter is
142
+ * configured, so collection fields like `roles` are available; falls back to
143
+ * the token's identity claims otherwise.
144
+ */
145
+ user?: {
146
+ sub: string;
147
+ email?: string;
148
+ collection: string;
149
+ [key: string]: any;
150
+ };
151
+ clientIp?: string;
152
+ authTokenPayload?: CollectionTokenPayload;
153
+ };
154
+ }
155
+ /**
156
+ * Create the main Dyrected Hono application.
157
+ */
158
+ declare function createDyrectedApp(rawConfig: DyrectedConfig | any): Promise<Hono<DyrectedContext, hono_types.BlankSchema, "/">>;
159
+
160
+ declare function serializeDetailForApi(detail?: any): any;
161
+ /**
162
+ * Serializes an operational view config for the Admin API.
163
+ * Function properties (action handlers) are stripped so the payload stays
164
+ * JSON-safe; access rules are resolved to static values the admin can evaluate.
165
+ */
166
+ declare function serializeViewForApi(view: any, serializeAccess: (access: any) => Promise<any>): Promise<any>;
167
+ /**
168
+ * Register dynamic routes based on the provided configuration.
169
+ */
170
+ declare function registerRoutes(app: Hono<DyrectedContext>, config: DyrectedConfig): void;
171
+
172
+ /**
173
+ * Handles auth endpoints for collections with `auth: true`.
174
+ *
175
+ * Routes registered (relative to `/api/collections/:slug`):
176
+ * POST /login
177
+ * POST /logout
178
+ * GET /me
179
+ * POST /refresh-token
180
+ * POST /forgot-password
181
+ * POST /reset-password
182
+ * POST /invite
183
+ * POST /accept-invite
184
+ */
185
+ declare class AuthController {
186
+ private collection;
187
+ constructor(collection: CollectionConfig);
188
+ private sanitizeUser;
189
+ private hasField;
190
+ private buildPendingInviteData;
191
+ private buildAcceptedInviteData;
192
+ private clearLockoutState;
193
+ private recordFailedLogin;
194
+ init(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
195
+ message: string;
196
+ }, 500, "json">) | (Response & hono.TypedResponse<{
197
+ initialized: boolean;
198
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
199
+ registerFirstUser(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
200
+ message: string;
201
+ }, 500, "json">) | (Response & hono.TypedResponse<{
202
+ error: true;
203
+ message: string;
204
+ }, 403, "json">) | (Response & hono.TypedResponse<{
205
+ error: true;
206
+ message: string;
207
+ }, 400, "json">) | (Response & hono.TypedResponse<{
208
+ token: string;
209
+ user: {
210
+ [x: string]: hono_utils_types.JSONValue;
211
+ };
212
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
213
+ login(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
214
+ message: string;
215
+ }, 500, "json">) | (Response & hono.TypedResponse<{
216
+ error: true;
217
+ message: string;
218
+ }, 400, "json">) | (Response & hono.TypedResponse<{
219
+ error: true;
220
+ message: string;
221
+ }, 401, "json">) | (Response & hono.TypedResponse<{
222
+ error: true;
223
+ message: string;
224
+ }, 403, "json">) | (Response & hono.TypedResponse<{
225
+ error: true;
226
+ message: string;
227
+ retryAfterSeconds: number;
228
+ }, 429, "json">) | (Response & hono.TypedResponse<{
229
+ token: string;
230
+ user: {
231
+ [x: string]: hono_utils_types.JSONValue;
232
+ };
233
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
234
+ logout(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
235
+ error: true;
236
+ message: string;
237
+ }, 401, "json">) | (Response & hono.TypedResponse<{
238
+ success: true;
239
+ message: string;
240
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
241
+ me(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
242
+ message: string;
243
+ }, 500, "json">) | (Response & hono.TypedResponse<{
244
+ error: true;
245
+ message: string;
246
+ }, 401, "json">) | (Response & hono.TypedResponse<{
247
+ error: true;
248
+ message: string;
249
+ }, 404, "json">) | (Response & hono.TypedResponse<{
250
+ [x: string]: hono_utils_types.JSONValue;
251
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
252
+ refreshToken(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
253
+ error: true;
254
+ message: string;
255
+ }, 401, "json">) | (Response & hono.TypedResponse<{
256
+ error: true;
257
+ message: string;
258
+ }, 400, "json">) | (Response & hono.TypedResponse<{
259
+ token: string;
260
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
261
+ forgotPassword(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
262
+ message: string;
263
+ }, 500, "json">) | (Response & hono.TypedResponse<{
264
+ error: true;
265
+ message: string;
266
+ }, 400, "json">) | (Response & hono.TypedResponse<{
267
+ success: true;
268
+ message: string;
269
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
270
+ resetPassword(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
271
+ message: string;
272
+ }, 500, "json">) | (Response & hono.TypedResponse<{
273
+ error: true;
274
+ message: string;
275
+ }, 400, "json">) | (Response & hono.TypedResponse<{
276
+ success: true;
277
+ message: string;
278
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
279
+ invite(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
280
+ message: string;
281
+ }, 500, "json">) | (Response & hono.TypedResponse<{
282
+ error: true;
283
+ message: string;
284
+ }, 401, "json">) | (Response & hono.TypedResponse<{
285
+ error: true;
286
+ message: string;
287
+ }, 400, "json">) | (Response & hono.TypedResponse<{
288
+ error: true;
289
+ message: string;
290
+ }, 409, "json">) | (Response & hono.TypedResponse<{
291
+ success: true;
292
+ message: string;
293
+ token: string;
294
+ inviteUrl: string | undefined;
295
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
296
+ acceptInvite(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
297
+ message: string;
298
+ }, 500, "json">) | (Response & hono.TypedResponse<{
299
+ error: true;
300
+ message: string;
301
+ }, 400, "json">) | (Response & hono.TypedResponse<{
302
+ error: true;
303
+ message: string;
304
+ }, 409, "json">) | (Response & hono.TypedResponse<{
305
+ token: string;
306
+ user: {
307
+ [x: string]: hono_utils_types.JSONValue;
308
+ };
309
+ }, 201, "json">)>;
310
+ }
311
+
312
+ declare class CollectionController {
313
+ private collection;
314
+ constructor(collection: CollectionConfig);
315
+ private getDelegatedProvider;
316
+ private toHookRequestContext;
317
+ private sanitizeDoc;
318
+ private evaluateAccess;
319
+ find(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
320
+ message: string;
321
+ }, 500, "json">) | (Response & hono.TypedResponse<{
322
+ docs: {
323
+ id: string;
324
+ externalSubject: string;
325
+ email: string;
326
+ name?: string | undefined;
327
+ roles: string[];
328
+ siteAccess?: string[] | undefined;
329
+ status?: "active" | "pending" | undefined;
330
+ }[];
331
+ totalDocs: number;
332
+ limit: number;
333
+ page: number;
334
+ totalPages: number;
335
+ hasNextPage: boolean;
336
+ hasPrevPage: boolean;
337
+ }, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
338
+ error: true;
339
+ message: string;
340
+ }, 403, "json">) | (Response & hono.TypedResponse<{
341
+ docs: {
342
+ [x: string]: any;
343
+ }[];
344
+ total: number;
345
+ limit: number;
346
+ page: number;
347
+ totalPages: number;
348
+ hasNextPage: boolean;
349
+ hasPrevPage: boolean;
350
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
351
+ findOne(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<any, hono_utils_http_status.ContentfulStatusCode, "json">>;
352
+ create(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
353
+ message: string;
354
+ }, 500, "json">) | (Response & hono.TypedResponse<{
355
+ message: string;
356
+ }, 400, "json">) | (Response & hono.TypedResponse<{
357
+ message: string;
358
+ }, 413 | 415, "json">) | (Response & hono.TypedResponse<{
359
+ error: true;
360
+ message: string;
361
+ }, 403, "json">) | (Response & hono.TypedResponse<{
362
+ [x: string]: hono_utils_types.JSONValue;
363
+ }, 201, "json">) | (Response & hono.TypedResponse<{
364
+ id: string;
365
+ externalSubject: string;
366
+ email: string;
367
+ name?: string | undefined;
368
+ roles: string[];
369
+ siteAccess?: string[] | undefined;
370
+ status?: "active" | "pending" | undefined;
371
+ }, 201, "json">)>;
372
+ upload(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
373
+ message: string;
374
+ }, 500, "json">) | (Response & hono.TypedResponse<{
375
+ message: string;
376
+ }, 400, "json">) | (Response & hono.TypedResponse<{
377
+ message: string;
378
+ }, 413 | 415, "json">) | (Response & hono.TypedResponse<{
379
+ error: true;
380
+ message: string;
381
+ }, 403, "json">) | (Response & hono.TypedResponse<{
382
+ [x: string]: hono_utils_types.JSONValue;
383
+ }, 201, "json">)>;
384
+ update(c: Context<DyrectedContext>): Promise<Response>;
385
+ /**
386
+ * Core update pipeline shared by PATCH requests and operational actions:
387
+ * auth-field stripping, timestamps, access enforcement, field write access,
388
+ * beforeChange hooks, persistence (or workflow draft), audit logging,
389
+ * afterChange/afterRead hooks, and field read access on the response.
390
+ */
391
+ private performUpdate;
392
+ /**
393
+ * Runs an operational view action (`defineAction`) against one or more documents.
394
+ * Declarative mutations are resolved server-side (`now()`, `input.*`, `doc.*`)
395
+ * and every write flows through the standard update pipeline so the
396
+ * collection's lifecycle hooks and audit trail still apply.
397
+ */
398
+ runViewAction(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
399
+ message: string;
400
+ }, 500, "json">) | (Response & hono.TypedResponse<{
401
+ error: true;
402
+ message: string;
403
+ }, 404, "json">) | (Response & hono.TypedResponse<{
404
+ error: true;
405
+ message: string;
406
+ }, 400, "json">) | (Response & hono.TypedResponse<{
407
+ error: true;
408
+ message: string;
409
+ }, 403, "json">) | (Response & hono.TypedResponse<never, any, "json">) | (Response & hono.TypedResponse<hono_utils_types.JSONValue, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
410
+ updated: number;
411
+ failed: number;
412
+ results: {
413
+ id: string;
414
+ ok: boolean;
415
+ status?: number | undefined;
416
+ doc?: hono_utils_types.JSONValue | undefined;
417
+ error?: hono_utils_types.JSONValue | undefined;
418
+ }[];
419
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
420
+ transition(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
421
+ message: string;
422
+ }, 500, "json">) | (Response & hono.TypedResponse<{
423
+ message: string;
424
+ }, 404, "json">) | (Response & hono.TypedResponse<{
425
+ [x: string]: any;
426
+ id: string;
427
+ } | null, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
428
+ error: true;
429
+ message: string;
430
+ }, 400, "json">)>;
431
+ workflowHistory(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
432
+ docs: {
433
+ [x: string]: any;
434
+ }[];
435
+ total: number;
436
+ limit: number;
437
+ page: number;
438
+ totalPages: number;
439
+ hasNextPage: boolean;
440
+ hasPrevPage: boolean;
441
+ }, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
442
+ message: string;
443
+ }, 500, "json">) | (Response & hono.TypedResponse<{
444
+ message: string;
445
+ }, 404, "json">) | (Response & hono.TypedResponse<{
446
+ message: string;
447
+ }, 400, "json">) | (Response & hono.TypedResponse<{
448
+ error: true;
449
+ message: string;
450
+ }, 403, "json">)>;
451
+ /**
452
+ * POST /api/collections/:slug/:id/change-password
453
+ *
454
+ * Dedicated endpoint for password changes. Requires the caller to supply:
455
+ * { oldPassword, newPassword, confirmPassword }
456
+ *
457
+ * Rules:
458
+ * - Only the account owner or an admin may change the password.
459
+ * - Non-admin callers MUST provide a valid oldPassword.
460
+ * - newPassword and confirmPassword must match.
461
+ */
462
+ changePassword(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
463
+ message: string;
464
+ }, 500, "json">) | (Response & hono.TypedResponse<{
465
+ message: string;
466
+ }, 400, "json">) | (Response & hono.TypedResponse<{
467
+ message: string;
468
+ }, 401, "json">) | (Response & hono.TypedResponse<{
469
+ message: string;
470
+ }, 403, "json">) | (Response & hono.TypedResponse<{
471
+ message: string;
472
+ }, 404, "json">) | (Response & hono.TypedResponse<{
473
+ success: true;
474
+ message: string;
475
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
476
+ delete(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
477
+ message: string;
478
+ }, hono_utils_http_status.ContentfulStatusCode, "json">>;
479
+ deleteMany(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
480
+ message: string;
481
+ }, 500, "json">) | (Response & hono.TypedResponse<{
482
+ message: string;
483
+ }, 400, "json">) | (Response & hono.TypedResponse<{
484
+ failed?: {
485
+ id: string;
486
+ error: string;
487
+ }[] | undefined;
488
+ message: string;
489
+ deleted: string[];
490
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
491
+ seed(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
492
+ message: string;
493
+ }, hono_utils_http_status.ContentfulStatusCode, "json">>;
494
+ aggregate(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
495
+ message: string;
496
+ }, 500, "json">) | (Response & hono.TypedResponse<{
497
+ error: true;
498
+ message: string;
499
+ }, 403, "json">) | (Response & hono.TypedResponse<{
500
+ message: string;
501
+ }, 400, "json">) | (Response & hono.TypedResponse<{
502
+ [x: string]: any;
503
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
504
+ }
505
+
506
+ declare class GlobalController {
507
+ private global;
508
+ constructor(global: GlobalConfig);
509
+ get(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
510
+ [x: string]: hono_utils_types.JSONValue;
511
+ }, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
512
+ message: string;
513
+ }, 500, "json">) | (Response & hono.TypedResponse<{
514
+ error: true;
515
+ message: string;
516
+ }, 403, "json">)>;
517
+ update(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
518
+ [x: string]: hono_utils_types.JSONValue;
519
+ }, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
520
+ message: string;
521
+ }, 500, "json">) | (Response & hono.TypedResponse<{
522
+ error: true;
523
+ message: string;
524
+ }, 403, "json">)>;
525
+ seed(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
526
+ message: string;
527
+ }, hono_utils_http_status.ContentfulStatusCode, "json">>;
528
+ }
529
+
530
+ declare class MediaController {
531
+ private collection;
532
+ private loggerComponent;
533
+ constructor(collection?: string);
534
+ upload(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
535
+ message: string;
536
+ }, 500, "json">) | (Response & hono.TypedResponse<{
537
+ message: string;
538
+ }, 400, "json">) | (Response & hono.TypedResponse<{
539
+ message: string;
540
+ }, 413 | 415, "json">) | (Response & hono.TypedResponse<{
541
+ [x: string]: any;
542
+ id: string;
543
+ }, 201, "json">)>;
544
+ find(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
545
+ docs: {
546
+ [x: string]: any;
547
+ }[];
548
+ total: number;
549
+ limit: number;
550
+ page: number;
551
+ totalPages: number;
552
+ hasNextPage: boolean;
553
+ hasPrevPage: boolean;
554
+ }, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
555
+ message: string;
556
+ }, 500, "json">)>;
557
+ delete(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
558
+ message: string;
559
+ }, hono_utils_http_status.ContentfulStatusCode, "json">>;
560
+ serve(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
561
+ message: string;
562
+ }, 404, "json">) | (Response & hono.TypedResponse<{
563
+ message: string;
564
+ }, 400, "json">) | (Response & hono.TypedResponse<any, hono_utils_http_status.ContentfulStatusCode, "body">)>;
565
+ }
566
+
567
+ declare class PreviewController {
568
+ private getSecret;
569
+ /**
570
+ * POST /api/preview-token
571
+ * Generates a short-lived token for previewing unsaved data.
572
+ */
573
+ createToken(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
574
+ error: true;
575
+ message: string;
576
+ }, 400, "json">) | (Response & hono.TypedResponse<{
577
+ token: string;
578
+ expiresAt: string;
579
+ }, hono_utils_http_status.ContentfulStatusCode, "json">)>;
580
+ /**
581
+ * GET /api/preview-data?token=<jwt>
582
+ * Returns the data stored in the preview token.
583
+ */
584
+ getData(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
585
+ error: true;
586
+ message: string;
587
+ }, 400, "json">) | (Response & hono.TypedResponse<{
588
+ [x: string]: hono_utils_types.JSONValue;
589
+ iss?: string | undefined;
590
+ sub?: string | undefined;
591
+ aud?: string | string[] | undefined;
592
+ jti?: string | undefined;
593
+ nbf?: number | undefined;
594
+ exp?: number | undefined;
595
+ iat?: number | undefined;
596
+ }, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
597
+ error: true;
598
+ message: string;
599
+ }, 401, "json">)>;
600
+ }
601
+
602
+ export { AuthController, CollectionController, type DyrectedContext, type DyrectedObservabilityRuntime, GlobalController, MediaController, PreviewController, type RequestBodyCapture, type RequestTraceContext, type ResolvedObservabilityConfig, attachRequestMetrics, bindObservabilityRuntime, buildRequestLogger, captureRequestBody, createDyrectedApp, createObservabilityRuntime, createRequestSpan, endRequestSpan, getConfigLogger, getObservabilityRuntime, getRequestLogger, redactBody, redactHeaders, registerRoutes, renderPrometheusMetrics, resolveObservabilityConfig, serializeDetailForApi, serializeViewForApi, shouldSampleRequest };