@avtechno/sfr 2.0.4 → 2.0.6

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.
@@ -9,7 +9,7 @@ import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentation
9
9
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
10
10
  import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
11
11
  import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
12
- import { Resource } from "@opentelemetry/resources";
12
+ import { resourceFromAttributes } from "@opentelemetry/resources";
13
13
  import otel_semantics from "@opentelemetry/semantic-conventions";
14
14
  import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
15
15
  import { init_metrics } from "./metrics.mjs";
@@ -75,7 +75,7 @@ export function init_observability(oas_cfg, options = {}) {
75
75
  if (config.port) {
76
76
  resource_attributes["sfr.port"] = String(config.port);
77
77
  }
78
- const resource = new Resource(resource_attributes);
78
+ const resource = resourceFromAttributes(resource_attributes);
79
79
  // Configure exporters
80
80
  const trace_exporter = new OTLPTraceExporter({
81
81
  url: `${otlp_endpoint}/v1/traces`
@@ -98,7 +98,6 @@ export function init_observability(oas_cfg, options = {}) {
98
98
  sdk = new NodeSDK({
99
99
  resource,
100
100
  traceExporter: trace_exporter,
101
- // @ts-expect-error - Type mismatch between SDK packages, but compatible at runtime
102
101
  metricReader: metric_reader,
103
102
  instrumentations
104
103
  });
@@ -1,3 +1,3 @@
1
1
  export declare function REST<V, H, C>(struct: RESTHandlerDescriptor<V, H, C>): H & C;
2
2
  export declare function WS<V, H, C>(struct: WSHandlerDescriptor<V, H, C>): H & C;
3
- export declare function MQ<V, H, C>(struct: MQHandlerDescriptor<V, H, C>): H & C;
3
+ export declare function MQ<V, H>(struct: MQHandlerDescriptor<V, H>): H;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avtechno/sfr",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "An opinionated way of writing services using ExpressJS.",
5
5
  "type": "module",
6
6
  "files": [
@@ -10,7 +10,7 @@ import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentation
10
10
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
11
11
  import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
12
12
  import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
13
- import { resourceFromAttributes, type Resource } from "@opentelemetry/resources";
13
+ import { resourceFromAttributes } from "@opentelemetry/resources";
14
14
  import otel_semantics from "@opentelemetry/semantic-conventions";
15
15
  import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
16
16
 
package/src/templates.mts CHANGED
@@ -41,10 +41,10 @@ export function WS<V, H, C>(struct : WSHandlerDescriptor<V, H, C>): H & C {
41
41
  return { validators, controllers, handlers, cfg } as H & C;
42
42
  }
43
43
 
44
- export function MQ<V, H, C>(struct : MQHandlerDescriptor<V, H, C>): H & C{
44
+ export function MQ<V, H>(struct : MQHandlerDescriptor<V, H>): H{
45
45
  const validators : RequestValidators = struct.validators || {};
46
46
  const controllers : RequestControllers = struct.controllers || {};
47
- const handlers : MQRequestHandlers<C> = struct.handlers || {};
47
+ const handlers : MQRequestHandlers = struct.handlers || {};
48
48
  const cfg : SFRConfig = struct.cfg || {};
49
49
 
50
50
  //Bind controller injections to each controllers
@@ -377,7 +377,7 @@ declare type WSDeclarationArtifact = DeclarationArtifact & {
377
377
  declare type MQNamespaceDeclaration = {
378
378
  [namespace: string]: DeclarationArtifact & {
379
379
  content: {
380
- handlers: MQRequestHandlers<any>
380
+ handlers: MQRequestHandlers
381
381
  }
382
382
  }
383
383
  }
@@ -461,19 +461,19 @@ declare type PatternMQSet = {
461
461
  "Topic": BroadcastMQ;
462
462
  }
463
463
 
464
- declare type MQHandlerDescriptor<V, H, C> = {
464
+ declare type MQHandlerDescriptor<V, H> = {
465
465
  cfg?: SFRConfig;
466
466
  validators: RequestValidators & V;
467
- handlers: MQRequestHandlers<C> & H & ThisType<HandlerFacilities & C>;
468
- controllers?: RequestControllers & C & ThisType<ControllerFacilities & C>;
467
+ handlers: MQRequestHandlers & H & ThisType<HandlerFacilities>;
468
+ controllers?: RequestControllers & ThisType<ControllerFacilities >;
469
469
  };
470
470
 
471
- declare type MQRequestHandlers<C> = {
472
- "Point-to-Point"?: MQRequestHandlerMap & ThisType<{ mq: Omit<TargetedMQ, "type" | "reply"> } & C>;
473
- "Fanout"?: MQRequestHandlerMap & ThisType<{ mq: Omit<BroadcastMQ, "type"> } & C>;
474
- "Request-Reply"?: MQRequestHandlerMap & ThisType<{ mq: Omit<TargetedMQ, "type"> } & C>;
475
- "Direct"?: RoutingHandlerMap & ThisType<{ mq: Omit<BroadcastMQ, "type"> } & C>;
476
- "Topic"?: TopicHandlerMap & ThisType<{ mq: Omit<BroadcastMQ, "type"> } & C>;
471
+ declare type MQRequestHandlers = {
472
+ "Point-to-Point"?: MQRequestHandlerMap & ThisType<{ mq: Omit<TargetedMQ, "type" | "reply"> } & HandlerFacilities>;
473
+ "Fanout"?: MQRequestHandlerMap & ThisType<{ mq: Omit<BroadcastMQ, "type"> } & HandlerFacilities>;
474
+ "Request-Reply"?: MQRequestHandlerMap & ThisType<{ mq: Omit<TargetedMQ, "type"> } & HandlerFacilities>;
475
+ "Direct"?: RoutingHandlerMap & ThisType<{ mq: Omit<BroadcastMQ, "type"> } & HandlerFacilities>;
476
+ "Topic"?: TopicHandlerMap & ThisType<{ mq: Omit<BroadcastMQ, "type"> } & HandlerFacilities>;
477
477
  };
478
478
 
479
479
  declare type MQRequestHandlerMap = {