@forklaunch/core 0.13.3 → 0.13.4
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/lib/http/index.d.mts +2 -3
- package/lib/http/index.d.ts +2 -3
- package/lib/http/index.js +9 -8
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +9 -8
- package/lib/http/index.mjs.map +1 -1
- package/package.json +4 -4
package/lib/http/index.mjs
CHANGED
@@ -395,7 +395,7 @@ async function parseRequestAuth(req, res, next) {
|
|
395
395
|
const auth = req.contractDetails.auth;
|
396
396
|
const [error, message] = await checkAuthorizationToken(
|
397
397
|
auth,
|
398
|
-
req._globalOptions?.auth,
|
398
|
+
req._globalOptions?.()?.auth,
|
399
399
|
req.headers[auth?.headerName ?? "Authorization"] || req.headers[auth?.headerName ?? "authorization"],
|
400
400
|
req
|
401
401
|
) ?? [];
|
@@ -469,7 +469,6 @@ import {
|
|
469
469
|
ATTR_SERVICE_NAME as ATTR_SERVICE_NAME2
|
470
470
|
} from "@opentelemetry/semantic-conventions";
|
471
471
|
import dotenv from "dotenv";
|
472
|
-
import { v4 as v42 } from "uuid";
|
473
472
|
|
474
473
|
// src/http/guards/isForklaunchRequest.ts
|
475
474
|
function isForklaunchRequest(request) {
|
@@ -640,6 +639,9 @@ function logger(level, meta2 = {}) {
|
|
640
639
|
|
641
640
|
// src/http/telemetry/openTelemetryCollector.ts
|
642
641
|
var OpenTelemetryCollector = class {
|
642
|
+
logger;
|
643
|
+
serviceName;
|
644
|
+
metrics;
|
643
645
|
// scoped creation and create this in middleware when api execute. Also add correlation id
|
644
646
|
constructor(serviceName, level, metricDefinitions) {
|
645
647
|
this.serviceName = serviceName;
|
@@ -677,9 +679,6 @@ var OpenTelemetryCollector = class {
|
|
677
679
|
"OpenTelemetry Collector (Traces + Logs + Metrics) started"
|
678
680
|
);
|
679
681
|
}
|
680
|
-
uuid = v42();
|
681
|
-
logger;
|
682
|
-
metrics;
|
683
682
|
log(level, ...args) {
|
684
683
|
this.logger.log(level, ...args);
|
685
684
|
}
|
@@ -792,7 +791,8 @@ function isRequestShape(maybeResponseShape) {
|
|
792
791
|
|
793
792
|
// src/http/middleware/request/parse.middleware.ts
|
794
793
|
function parse(req, res, next) {
|
795
|
-
const
|
794
|
+
const globalOptions = req._globalOptions?.();
|
795
|
+
const collapsedOptions = req.contractDetails.options?.requestValidation ?? (globalOptions?.validation === false ? "none" : globalOptions?.validation?.request);
|
796
796
|
const request = {
|
797
797
|
params: req.params,
|
798
798
|
query: req.query,
|
@@ -1074,7 +1074,7 @@ var ForklaunchExpressLikeRouter = class _ForklaunchExpressLikeRouter {
|
|
1074
1074
|
requestSchema,
|
1075
1075
|
responseSchemas,
|
1076
1076
|
this.openTelemetryCollector,
|
1077
|
-
this.routerOptions
|
1077
|
+
() => this.routerOptions
|
1078
1078
|
),
|
1079
1079
|
...this.postEnrichMiddleware,
|
1080
1080
|
parse,
|
@@ -3180,7 +3180,8 @@ function isResponseCompiledSchema(schema) {
|
|
3180
3180
|
function parse2(req, res, next) {
|
3181
3181
|
let headers;
|
3182
3182
|
let responses;
|
3183
|
-
const
|
3183
|
+
const globalOptions = req._globalOptions?.();
|
3184
|
+
const collapsedOptions = req.contractDetails.options?.responseValidation ?? (globalOptions?.validation === false ? "none" : globalOptions?.validation?.response);
|
3184
3185
|
if (collapsedOptions === "none") {
|
3185
3186
|
next?.();
|
3186
3187
|
return;
|