@dyrected/core 2.7.0 → 2.8.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/dist/app-config-7G-3tF_I.d.cts +2259 -0
- package/dist/app-config-7G-3tF_I.d.ts +2259 -0
- package/dist/app-config-B3ByBjCN.d.cts +2222 -0
- package/dist/app-config-B3ByBjCN.d.ts +2222 -0
- package/dist/app-config-BIkjQWzU.d.cts +2218 -0
- package/dist/app-config-BIkjQWzU.d.ts +2218 -0
- package/dist/app-config-BfpeE3bF.d.cts +2100 -0
- package/dist/app-config-BfpeE3bF.d.ts +2100 -0
- package/dist/app-config-CCe-yq9q.d.cts +2222 -0
- package/dist/app-config-CCe-yq9q.d.ts +2222 -0
- package/dist/app-config-CPOs7THF.d.cts +2217 -0
- package/dist/app-config-CPOs7THF.d.ts +2217 -0
- package/dist/app-config-Ctp454zB.d.cts +2214 -0
- package/dist/app-config-Ctp454zB.d.ts +2214 -0
- package/dist/app-config-DJmNYgYh.d.cts +2305 -0
- package/dist/app-config-DJmNYgYh.d.ts +2305 -0
- package/dist/app-config-DO3laV58.d.cts +2397 -0
- package/dist/app-config-DO3laV58.d.ts +2397 -0
- package/dist/app-config-DZf_mmi9.d.cts +2211 -0
- package/dist/app-config-DZf_mmi9.d.ts +2211 -0
- package/dist/app-config-SkUoN5JU.d.cts +2192 -0
- package/dist/app-config-SkUoN5JU.d.ts +2192 -0
- package/dist/app-config-oz8H_MOX.d.cts +2224 -0
- package/dist/app-config-oz8H_MOX.d.ts +2224 -0
- package/dist/chunk-2UXLA4YN.js +3139 -0
- package/dist/chunk-3TRRTN6U.js +3441 -0
- package/dist/chunk-5U2WRCNH.js +3140 -0
- package/dist/chunk-5ZIA5COH.js +3414 -0
- package/dist/chunk-6TWQ6GTD.js +3480 -0
- package/dist/chunk-AKYYGMFS.js +3365 -0
- package/dist/chunk-AQO4HI2Y.js +3204 -0
- package/dist/chunk-DFBLNYUH.js +3402 -0
- package/dist/chunk-EJG6AMYB.js +3537 -0
- package/dist/chunk-FRSJJO27.js +519 -0
- package/dist/chunk-G43REXPX.js +3147 -0
- package/dist/chunk-GFKBPBJJ.js +3637 -0
- package/dist/chunk-KEKOEAX6.js +3139 -0
- package/dist/chunk-LFGSRQLX.js +3568 -0
- package/dist/chunk-NNZRYF3U.js +3537 -0
- package/dist/chunk-PRQ2RF5C.js +3485 -0
- package/dist/chunk-PYE2JSY4.js +3568 -0
- package/dist/chunk-PZMDK3MH.js +3203 -0
- package/dist/chunk-QCXLDKZO.js +3272 -0
- package/dist/chunk-SM32ND5M.js +3472 -0
- package/dist/chunk-UKUEKTAO.js +513 -0
- package/dist/chunk-VM43G3IG.js +506 -0
- package/dist/chunk-VWJKFZQU.js +3139 -0
- package/dist/chunk-XX7N64NL.js +3550 -0
- package/dist/chunk-YSSHLGQ6.js +3139 -0
- package/dist/chunk-Z7CFUYVP.js +3653 -0
- package/dist/index.cjs +1421 -82
- package/dist/index.d.cts +362 -3
- package/dist/index.d.ts +362 -3
- package/dist/index.js +119 -1
- package/dist/observability-CNM4QFE4.js +34 -0
- package/dist/observability-KCMTV7GO.js +34 -0
- package/dist/observability-L5BORBB2.js +34 -0
- package/dist/server.cjs +1879 -1247
- package/dist/server.d.cts +52 -8
- package/dist/server.d.ts +52 -8
- package/dist/server.js +449 -387
- package/package.json +1 -1
package/dist/server.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as hono_types from 'hono/types';
|
|
2
2
|
import * as hono from 'hono';
|
|
3
|
-
import {
|
|
3
|
+
import { Context, Hono } from 'hono';
|
|
4
4
|
import { Logger } from 'pino';
|
|
5
|
-
import { D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig } from './app-config-
|
|
5
|
+
import { D as DyrectedConfig, aY as DyrectedObservabilityConfig, C as CollectionConfig, G as GlobalConfig } from './app-config-DO3laV58.cjs';
|
|
6
6
|
import { JWTPayload } from 'jose';
|
|
7
7
|
import { Tracer, Counter, Attributes, Histogram, Span } from '@opentelemetry/api';
|
|
8
8
|
import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
|
|
@@ -20,6 +20,7 @@ interface CollectionTokenPayload extends JWTPayload {
|
|
|
20
20
|
authSource?: 'local' | 'external';
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
type RequestVars = DyrectedContext["Variables"];
|
|
23
24
|
interface ResolvedObservabilityConfig {
|
|
24
25
|
requestLogging: {
|
|
25
26
|
enabled: boolean;
|
|
@@ -100,6 +101,30 @@ interface DyrectedObservabilityRuntime {
|
|
|
100
101
|
recordEmailSendFailure: (attributes?: Attributes) => void;
|
|
101
102
|
recordWorkflowHookFailure: (attributes?: Attributes) => void;
|
|
102
103
|
}
|
|
104
|
+
declare function resolveObservabilityConfig(config?: DyrectedObservabilityConfig): ResolvedObservabilityConfig;
|
|
105
|
+
declare function createObservabilityRuntime(config: DyrectedConfig): DyrectedObservabilityRuntime;
|
|
106
|
+
declare function bindObservabilityRuntime(config: DyrectedConfig, runtime: DyrectedObservabilityRuntime): void;
|
|
107
|
+
declare function getObservabilityRuntime(config: Pick<DyrectedConfig, "logger"> | undefined): DyrectedObservabilityRuntime | undefined;
|
|
108
|
+
declare function getConfigLogger(config: Pick<DyrectedConfig, "logger"> | undefined, component: string): Logger;
|
|
109
|
+
declare function getRequestLogger(c: Context<DyrectedContext>, component?: string): Logger;
|
|
110
|
+
declare function buildRequestLogger(runtime: DyrectedObservabilityRuntime, vars: RequestVars, requestId?: string): Logger;
|
|
111
|
+
declare function shouldSampleRequest(requestId: string | undefined, statusCode: number, sampling: ResolvedObservabilityConfig["sampling"], kind: "log" | "trace" | "body"): boolean;
|
|
112
|
+
declare function redactHeaders(headers: Record<string, string>, observability: ResolvedObservabilityConfig): Record<string, string>;
|
|
113
|
+
declare function captureRequestBody(request: Request, observability: ResolvedObservabilityConfig): Promise<RequestBodyCapture>;
|
|
114
|
+
declare function redactBody(value: unknown, redactPaths: string[]): unknown;
|
|
115
|
+
declare function createRequestSpan(runtime: DyrectedObservabilityRuntime, name: string, attributes: Attributes): RequestTraceContext | undefined;
|
|
116
|
+
declare function endRequestSpan(requestTrace: RequestTraceContext | undefined, statusCode: number, error?: unknown): void;
|
|
117
|
+
declare function attachRequestMetrics(runtime: DyrectedObservabilityRuntime, args: {
|
|
118
|
+
method: string;
|
|
119
|
+
route: string;
|
|
120
|
+
statusCode: number;
|
|
121
|
+
durationMs: number;
|
|
122
|
+
}): void;
|
|
123
|
+
declare function renderPrometheusMetrics(exporter: PrometheusExporter): Promise<{
|
|
124
|
+
body: string;
|
|
125
|
+
headers: Record<string, string>;
|
|
126
|
+
statusCode: number;
|
|
127
|
+
}>;
|
|
103
128
|
|
|
104
129
|
interface DyrectedContext {
|
|
105
130
|
Variables: {
|
|
@@ -129,8 +154,9 @@ interface DyrectedContext {
|
|
|
129
154
|
/**
|
|
130
155
|
* Create the main Dyrected Hono application.
|
|
131
156
|
*/
|
|
132
|
-
declare function createDyrectedApp(rawConfig: DyrectedConfig): Promise<Hono<DyrectedContext, hono_types.BlankSchema, "/">>;
|
|
157
|
+
declare function createDyrectedApp(rawConfig: DyrectedConfig | any): Promise<Hono<DyrectedContext, hono_types.BlankSchema, "/">>;
|
|
133
158
|
|
|
159
|
+
declare function serializeDetailForApi(detail?: any): any;
|
|
134
160
|
/**
|
|
135
161
|
* Register dynamic routes based on the provided configuration.
|
|
136
162
|
*/
|
|
@@ -281,6 +307,7 @@ declare class CollectionController {
|
|
|
281
307
|
constructor(collection: CollectionConfig);
|
|
282
308
|
private getDelegatedProvider;
|
|
283
309
|
private toHookRequestContext;
|
|
310
|
+
private sanitizeDoc;
|
|
284
311
|
private evaluateAccess;
|
|
285
312
|
find(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
286
313
|
message: string;
|
|
@@ -348,8 +375,6 @@ declare class CollectionController {
|
|
|
348
375
|
[x: string]: hono_utils_types.JSONValue;
|
|
349
376
|
}, 201, "json">)>;
|
|
350
377
|
update(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
351
|
-
[x: string]: hono_utils_types.JSONValue;
|
|
352
|
-
}, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
353
378
|
message: string;
|
|
354
379
|
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
355
380
|
message: string;
|
|
@@ -366,7 +391,9 @@ declare class CollectionController {
|
|
|
366
391
|
}, 404, "json">) | (Response & hono.TypedResponse<{
|
|
367
392
|
error: true;
|
|
368
393
|
message: string;
|
|
369
|
-
}, 403, "json">)
|
|
394
|
+
}, 403, "json">) | (Response & hono.TypedResponse<{
|
|
395
|
+
[x: string]: hono_utils_types.JSONValue;
|
|
396
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">)>;
|
|
370
397
|
transition(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
371
398
|
message: string;
|
|
372
399
|
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
@@ -441,12 +468,29 @@ declare class CollectionController {
|
|
|
441
468
|
seed(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
|
|
442
469
|
message: string;
|
|
443
470
|
}, hono_utils_http_status.ContentfulStatusCode, "json">>;
|
|
471
|
+
aggregate(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
472
|
+
message: string;
|
|
473
|
+
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
474
|
+
error: true;
|
|
475
|
+
message: string;
|
|
476
|
+
}, 403, "json">) | (Response & hono.TypedResponse<{
|
|
477
|
+
message: string;
|
|
478
|
+
}, 400, "json">) | (Response & hono.TypedResponse<{
|
|
479
|
+
[x: string]: number | null;
|
|
480
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">)>;
|
|
444
481
|
}
|
|
445
482
|
|
|
446
483
|
declare class GlobalController {
|
|
447
484
|
private global;
|
|
448
485
|
constructor(global: GlobalConfig);
|
|
449
|
-
get(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<
|
|
486
|
+
get(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
487
|
+
[x: string]: hono_utils_types.JSONValue;
|
|
488
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
489
|
+
message: string;
|
|
490
|
+
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
491
|
+
error: true;
|
|
492
|
+
message: string;
|
|
493
|
+
}, 403, "json">)>;
|
|
450
494
|
update(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
451
495
|
[x: string]: hono_utils_types.JSONValue;
|
|
452
496
|
}, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
@@ -532,4 +576,4 @@ declare class PreviewController {
|
|
|
532
576
|
}, 401, "json">)>;
|
|
533
577
|
}
|
|
534
578
|
|
|
535
|
-
export { AuthController, CollectionController, type DyrectedContext, GlobalController, MediaController, PreviewController, createDyrectedApp, registerRoutes };
|
|
579
|
+
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, shouldSampleRequest };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as hono_types from 'hono/types';
|
|
2
2
|
import * as hono from 'hono';
|
|
3
|
-
import {
|
|
3
|
+
import { Context, Hono } from 'hono';
|
|
4
4
|
import { Logger } from 'pino';
|
|
5
|
-
import { D as DyrectedConfig, C as CollectionConfig, G as GlobalConfig } from './app-config-
|
|
5
|
+
import { D as DyrectedConfig, aY as DyrectedObservabilityConfig, C as CollectionConfig, G as GlobalConfig } from './app-config-DO3laV58.js';
|
|
6
6
|
import { JWTPayload } from 'jose';
|
|
7
7
|
import { Tracer, Counter, Attributes, Histogram, Span } from '@opentelemetry/api';
|
|
8
8
|
import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
|
|
@@ -20,6 +20,7 @@ interface CollectionTokenPayload extends JWTPayload {
|
|
|
20
20
|
authSource?: 'local' | 'external';
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
type RequestVars = DyrectedContext["Variables"];
|
|
23
24
|
interface ResolvedObservabilityConfig {
|
|
24
25
|
requestLogging: {
|
|
25
26
|
enabled: boolean;
|
|
@@ -100,6 +101,30 @@ interface DyrectedObservabilityRuntime {
|
|
|
100
101
|
recordEmailSendFailure: (attributes?: Attributes) => void;
|
|
101
102
|
recordWorkflowHookFailure: (attributes?: Attributes) => void;
|
|
102
103
|
}
|
|
104
|
+
declare function resolveObservabilityConfig(config?: DyrectedObservabilityConfig): ResolvedObservabilityConfig;
|
|
105
|
+
declare function createObservabilityRuntime(config: DyrectedConfig): DyrectedObservabilityRuntime;
|
|
106
|
+
declare function bindObservabilityRuntime(config: DyrectedConfig, runtime: DyrectedObservabilityRuntime): void;
|
|
107
|
+
declare function getObservabilityRuntime(config: Pick<DyrectedConfig, "logger"> | undefined): DyrectedObservabilityRuntime | undefined;
|
|
108
|
+
declare function getConfigLogger(config: Pick<DyrectedConfig, "logger"> | undefined, component: string): Logger;
|
|
109
|
+
declare function getRequestLogger(c: Context<DyrectedContext>, component?: string): Logger;
|
|
110
|
+
declare function buildRequestLogger(runtime: DyrectedObservabilityRuntime, vars: RequestVars, requestId?: string): Logger;
|
|
111
|
+
declare function shouldSampleRequest(requestId: string | undefined, statusCode: number, sampling: ResolvedObservabilityConfig["sampling"], kind: "log" | "trace" | "body"): boolean;
|
|
112
|
+
declare function redactHeaders(headers: Record<string, string>, observability: ResolvedObservabilityConfig): Record<string, string>;
|
|
113
|
+
declare function captureRequestBody(request: Request, observability: ResolvedObservabilityConfig): Promise<RequestBodyCapture>;
|
|
114
|
+
declare function redactBody(value: unknown, redactPaths: string[]): unknown;
|
|
115
|
+
declare function createRequestSpan(runtime: DyrectedObservabilityRuntime, name: string, attributes: Attributes): RequestTraceContext | undefined;
|
|
116
|
+
declare function endRequestSpan(requestTrace: RequestTraceContext | undefined, statusCode: number, error?: unknown): void;
|
|
117
|
+
declare function attachRequestMetrics(runtime: DyrectedObservabilityRuntime, args: {
|
|
118
|
+
method: string;
|
|
119
|
+
route: string;
|
|
120
|
+
statusCode: number;
|
|
121
|
+
durationMs: number;
|
|
122
|
+
}): void;
|
|
123
|
+
declare function renderPrometheusMetrics(exporter: PrometheusExporter): Promise<{
|
|
124
|
+
body: string;
|
|
125
|
+
headers: Record<string, string>;
|
|
126
|
+
statusCode: number;
|
|
127
|
+
}>;
|
|
103
128
|
|
|
104
129
|
interface DyrectedContext {
|
|
105
130
|
Variables: {
|
|
@@ -129,8 +154,9 @@ interface DyrectedContext {
|
|
|
129
154
|
/**
|
|
130
155
|
* Create the main Dyrected Hono application.
|
|
131
156
|
*/
|
|
132
|
-
declare function createDyrectedApp(rawConfig: DyrectedConfig): Promise<Hono<DyrectedContext, hono_types.BlankSchema, "/">>;
|
|
157
|
+
declare function createDyrectedApp(rawConfig: DyrectedConfig | any): Promise<Hono<DyrectedContext, hono_types.BlankSchema, "/">>;
|
|
133
158
|
|
|
159
|
+
declare function serializeDetailForApi(detail?: any): any;
|
|
134
160
|
/**
|
|
135
161
|
* Register dynamic routes based on the provided configuration.
|
|
136
162
|
*/
|
|
@@ -281,6 +307,7 @@ declare class CollectionController {
|
|
|
281
307
|
constructor(collection: CollectionConfig);
|
|
282
308
|
private getDelegatedProvider;
|
|
283
309
|
private toHookRequestContext;
|
|
310
|
+
private sanitizeDoc;
|
|
284
311
|
private evaluateAccess;
|
|
285
312
|
find(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
286
313
|
message: string;
|
|
@@ -348,8 +375,6 @@ declare class CollectionController {
|
|
|
348
375
|
[x: string]: hono_utils_types.JSONValue;
|
|
349
376
|
}, 201, "json">)>;
|
|
350
377
|
update(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
351
|
-
[x: string]: hono_utils_types.JSONValue;
|
|
352
|
-
}, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
353
378
|
message: string;
|
|
354
379
|
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
355
380
|
message: string;
|
|
@@ -366,7 +391,9 @@ declare class CollectionController {
|
|
|
366
391
|
}, 404, "json">) | (Response & hono.TypedResponse<{
|
|
367
392
|
error: true;
|
|
368
393
|
message: string;
|
|
369
|
-
}, 403, "json">)
|
|
394
|
+
}, 403, "json">) | (Response & hono.TypedResponse<{
|
|
395
|
+
[x: string]: hono_utils_types.JSONValue;
|
|
396
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">)>;
|
|
370
397
|
transition(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
371
398
|
message: string;
|
|
372
399
|
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
@@ -441,12 +468,29 @@ declare class CollectionController {
|
|
|
441
468
|
seed(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<{
|
|
442
469
|
message: string;
|
|
443
470
|
}, hono_utils_http_status.ContentfulStatusCode, "json">>;
|
|
471
|
+
aggregate(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
472
|
+
message: string;
|
|
473
|
+
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
474
|
+
error: true;
|
|
475
|
+
message: string;
|
|
476
|
+
}, 403, "json">) | (Response & hono.TypedResponse<{
|
|
477
|
+
message: string;
|
|
478
|
+
}, 400, "json">) | (Response & hono.TypedResponse<{
|
|
479
|
+
[x: string]: number | null;
|
|
480
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">)>;
|
|
444
481
|
}
|
|
445
482
|
|
|
446
483
|
declare class GlobalController {
|
|
447
484
|
private global;
|
|
448
485
|
constructor(global: GlobalConfig);
|
|
449
|
-
get(c: Context<DyrectedContext>): Promise<Response & hono.TypedResponse<
|
|
486
|
+
get(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
487
|
+
[x: string]: hono_utils_types.JSONValue;
|
|
488
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
489
|
+
message: string;
|
|
490
|
+
}, 500, "json">) | (Response & hono.TypedResponse<{
|
|
491
|
+
error: true;
|
|
492
|
+
message: string;
|
|
493
|
+
}, 403, "json">)>;
|
|
450
494
|
update(c: Context<DyrectedContext>): Promise<(Response & hono.TypedResponse<{
|
|
451
495
|
[x: string]: hono_utils_types.JSONValue;
|
|
452
496
|
}, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
@@ -532,4 +576,4 @@ declare class PreviewController {
|
|
|
532
576
|
}, 401, "json">)>;
|
|
533
577
|
}
|
|
534
578
|
|
|
535
|
-
export { AuthController, CollectionController, type DyrectedContext, GlobalController, MediaController, PreviewController, createDyrectedApp, registerRoutes };
|
|
579
|
+
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, shouldSampleRequest };
|