@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.d.mts
CHANGED
@@ -60,9 +60,8 @@ interface TelemetryOptions {
|
|
60
60
|
}
|
61
61
|
|
62
62
|
declare class OpenTelemetryCollector<AppliedMetricsDefinition extends MetricsDefinition> {
|
63
|
-
private readonly serviceName;
|
64
|
-
private readonly uuid;
|
65
63
|
private readonly logger;
|
64
|
+
private readonly serviceName;
|
66
65
|
private readonly metrics;
|
67
66
|
constructor(serviceName: string, level?: LevelWithSilentOrString, metricDefinitions?: AppliedMetricsDefinition);
|
68
67
|
log(level: LevelWithSilent, ...args: (string | unknown | LoggerMeta)[]): void;
|
@@ -688,7 +687,7 @@ interface ForklaunchRequest<SV extends AnySchemaValidator, P extends ParamsDicti
|
|
688
687
|
/** Parsed versions */
|
689
688
|
_parsedVersions: string[] | number;
|
690
689
|
/** Global options */
|
691
|
-
_globalOptions
|
690
|
+
_globalOptions: () => ExpressLikeRouterOptions<SV, SessionSchema> | undefined;
|
692
691
|
}
|
693
692
|
/**
|
694
693
|
* Represents the types of data that can be sent in a response.
|
package/lib/http/index.d.ts
CHANGED
@@ -60,9 +60,8 @@ interface TelemetryOptions {
|
|
60
60
|
}
|
61
61
|
|
62
62
|
declare class OpenTelemetryCollector<AppliedMetricsDefinition extends MetricsDefinition> {
|
63
|
-
private readonly serviceName;
|
64
|
-
private readonly uuid;
|
65
63
|
private readonly logger;
|
64
|
+
private readonly serviceName;
|
66
65
|
private readonly metrics;
|
67
66
|
constructor(serviceName: string, level?: LevelWithSilentOrString, metricDefinitions?: AppliedMetricsDefinition);
|
68
67
|
log(level: LevelWithSilent, ...args: (string | unknown | LoggerMeta)[]): void;
|
@@ -688,7 +687,7 @@ interface ForklaunchRequest<SV extends AnySchemaValidator, P extends ParamsDicti
|
|
688
687
|
/** Parsed versions */
|
689
688
|
_parsedVersions: string[] | number;
|
690
689
|
/** Global options */
|
691
|
-
_globalOptions
|
690
|
+
_globalOptions: () => ExpressLikeRouterOptions<SV, SessionSchema> | undefined;
|
692
691
|
}
|
693
692
|
/**
|
694
693
|
* Represents the types of data that can be sent in a response.
|
package/lib/http/index.js
CHANGED
@@ -471,7 +471,7 @@ async function parseRequestAuth(req, res, next) {
|
|
471
471
|
const auth = req.contractDetails.auth;
|
472
472
|
const [error, message] = await checkAuthorizationToken(
|
473
473
|
auth,
|
474
|
-
req._globalOptions?.auth,
|
474
|
+
req._globalOptions?.()?.auth,
|
475
475
|
req.headers[auth?.headerName ?? "Authorization"] || req.headers[auth?.headerName ?? "authorization"],
|
476
476
|
req
|
477
477
|
) ?? [];
|
@@ -536,7 +536,6 @@ var import_sdk_metrics = require("@opentelemetry/sdk-metrics");
|
|
536
536
|
var import_sdk_node = require("@opentelemetry/sdk-node");
|
537
537
|
var import_semantic_conventions2 = require("@opentelemetry/semantic-conventions");
|
538
538
|
var import_dotenv = __toESM(require("dotenv"));
|
539
|
-
var import_uuid2 = require("uuid");
|
540
539
|
|
541
540
|
// src/http/guards/isForklaunchRequest.ts
|
542
541
|
function isForklaunchRequest(request) {
|
@@ -707,6 +706,9 @@ function logger(level, meta2 = {}) {
|
|
707
706
|
|
708
707
|
// src/http/telemetry/openTelemetryCollector.ts
|
709
708
|
var OpenTelemetryCollector = class {
|
709
|
+
logger;
|
710
|
+
serviceName;
|
711
|
+
metrics;
|
710
712
|
// scoped creation and create this in middleware when api execute. Also add correlation id
|
711
713
|
constructor(serviceName, level, metricDefinitions) {
|
712
714
|
this.serviceName = serviceName;
|
@@ -744,9 +746,6 @@ var OpenTelemetryCollector = class {
|
|
744
746
|
"OpenTelemetry Collector (Traces + Logs + Metrics) started"
|
745
747
|
);
|
746
748
|
}
|
747
|
-
uuid = (0, import_uuid2.v4)();
|
748
|
-
logger;
|
749
|
-
metrics;
|
750
749
|
log(level, ...args) {
|
751
750
|
this.logger.log(level, ...args);
|
752
751
|
}
|
@@ -857,7 +856,8 @@ function isRequestShape(maybeResponseShape) {
|
|
857
856
|
|
858
857
|
// src/http/middleware/request/parse.middleware.ts
|
859
858
|
function parse(req, res, next) {
|
860
|
-
const
|
859
|
+
const globalOptions = req._globalOptions?.();
|
860
|
+
const collapsedOptions = req.contractDetails.options?.requestValidation ?? (globalOptions?.validation === false ? "none" : globalOptions?.validation?.request);
|
861
861
|
const request = {
|
862
862
|
params: req.params,
|
863
863
|
query: req.query,
|
@@ -1139,7 +1139,7 @@ var ForklaunchExpressLikeRouter = class _ForklaunchExpressLikeRouter {
|
|
1139
1139
|
requestSchema,
|
1140
1140
|
responseSchemas,
|
1141
1141
|
this.openTelemetryCollector,
|
1142
|
-
this.routerOptions
|
1142
|
+
() => this.routerOptions
|
1143
1143
|
),
|
1144
1144
|
...this.postEnrichMiddleware,
|
1145
1145
|
parse,
|
@@ -3243,7 +3243,8 @@ function isResponseCompiledSchema(schema) {
|
|
3243
3243
|
function parse2(req, res, next) {
|
3244
3244
|
let headers;
|
3245
3245
|
let responses;
|
3246
|
-
const
|
3246
|
+
const globalOptions = req._globalOptions?.();
|
3247
|
+
const collapsedOptions = req.contractDetails.options?.responseValidation ?? (globalOptions?.validation === false ? "none" : globalOptions?.validation?.response);
|
3247
3248
|
if (collapsedOptions === "none") {
|
3248
3249
|
next?.();
|
3249
3250
|
return;
|