@experts_hub/shared 1.0.612 → 1.0.614

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/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import Transport from 'winston-transport';
1
2
  import { MicroserviceOptions } from '@nestjs/microservices';
2
3
 
3
4
  declare const AUTHENTICATION_PATTERN: {
@@ -4139,9 +4140,9 @@ interface WinstonLogInfo {
4139
4140
  error?: string;
4140
4141
  [key: string]: any;
4141
4142
  }
4142
- declare class DiscordTransport {
4143
+ declare class DiscordTransport extends Transport {
4143
4144
  private readonly discordService;
4144
- private readonly options;
4145
+ private readonly transportOptions;
4145
4146
  private logsSent;
4146
4147
  constructor(options: DiscordTransportOptions);
4147
4148
  log(info: WinstonLogInfo, callback: () => void): void;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import Transport from 'winston-transport';
1
2
  import { MicroserviceOptions } from '@nestjs/microservices';
2
3
 
3
4
  declare const AUTHENTICATION_PATTERN: {
@@ -4139,9 +4140,9 @@ interface WinstonLogInfo {
4139
4140
  error?: string;
4140
4141
  [key: string]: any;
4141
4142
  }
4142
- declare class DiscordTransport {
4143
+ declare class DiscordTransport extends Transport {
4143
4144
  private readonly discordService;
4144
- private readonly options;
4145
+ private readonly transportOptions;
4145
4146
  private logsSent;
4146
4147
  constructor(options: DiscordTransportOptions);
4147
4148
  log(info: WinstonLogInfo, callback: () => void): void;
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
  var __decorateClass = (decorators, target, key, kind) => {
19
29
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
@@ -11509,15 +11519,19 @@ var DiscordAlertService = class {
11509
11519
  };
11510
11520
 
11511
11521
  // src/modules/discord/winston-discord.transport.ts
11512
- var DiscordTransport = class {
11522
+ var import_winston_transport = __toESM(require("winston-transport"));
11523
+ var DiscordTransport = class extends import_winston_transport.default {
11513
11524
  /**
11514
11525
  * Creates a new Winston Discord transport
11515
11526
  *
11516
11527
  * @param options - Transport configuration
11517
11528
  */
11518
11529
  constructor(options) {
11530
+ super({
11531
+ level: options.level || "error"
11532
+ });
11519
11533
  this.logsSent = 0;
11520
- this.options = {
11534
+ this.transportOptions = {
11521
11535
  level: options.level || "error",
11522
11536
  microserviceName: options.microserviceName,
11523
11537
  environment: options.environment,
@@ -11527,24 +11541,23 @@ var DiscordTransport = class {
11527
11541
  };
11528
11542
  this.discordService = new DiscordAlertService({
11529
11543
  errorWebhookUrl: options.webhookUrl,
11530
- microserviceName: this.options.microserviceName,
11531
- environment: this.options.environment,
11532
- enabled: this.options.enabled
11544
+ microserviceName: this.transportOptions.microserviceName,
11545
+ environment: this.transportOptions.environment,
11546
+ enabled: this.transportOptions.enabled
11533
11547
  });
11534
11548
  }
11535
11549
  /**
11536
11550
  * Log method called by Winston for each log entry
11551
+ * Required by winston-transport.Transport
11537
11552
  *
11538
11553
  * @param info - Winston log info object
11539
11554
  * @param callback - Callback to call when done
11540
11555
  */
11541
11556
  log(info, callback) {
11542
11557
  setImmediate(() => {
11543
- if (typeof this.emit === "function") {
11544
- this.emit("logged", info);
11545
- }
11558
+ this.emit("logged", info);
11546
11559
  });
11547
- if (!this.options.enabled || !this.shouldLog(info.level)) {
11560
+ if (!this.transportOptions.enabled || !this.shouldLog(info.level)) {
11548
11561
  callback();
11549
11562
  return;
11550
11563
  }
@@ -11573,7 +11586,7 @@ var DiscordTransport = class {
11573
11586
  debug: 5,
11574
11587
  silly: 6
11575
11588
  };
11576
- const targetLevel = levels[this.options.level] || 0;
11589
+ const targetLevel = levels[this.transportOptions.level] || 0;
11577
11590
  const currentLevel = levels[level] || 999;
11578
11591
  return currentLevel <= targetLevel;
11579
11592
  }
@@ -11605,7 +11618,7 @@ var DiscordTransport = class {
11605
11618
  const severity = this.mapLogLevelToSeverity(info.level);
11606
11619
  await this.discordService.sendAlert({
11607
11620
  severity,
11608
- category: this.options.category,
11621
+ category: this.transportOptions.category,
11609
11622
  title: this.buildTitle(info),
11610
11623
  description: info.message,
11611
11624
  fields: Object.keys(fields).length > 0 ? fields : void 0,
package/dist/index.mjs CHANGED
@@ -11625,15 +11625,19 @@ var DiscordAlertService = class {
11625
11625
  };
11626
11626
 
11627
11627
  // src/modules/discord/winston-discord.transport.ts
11628
- var DiscordTransport = class {
11628
+ import Transport from "winston-transport";
11629
+ var DiscordTransport = class extends Transport {
11629
11630
  /**
11630
11631
  * Creates a new Winston Discord transport
11631
11632
  *
11632
11633
  * @param options - Transport configuration
11633
11634
  */
11634
11635
  constructor(options) {
11636
+ super({
11637
+ level: options.level || "error"
11638
+ });
11635
11639
  this.logsSent = 0;
11636
- this.options = {
11640
+ this.transportOptions = {
11637
11641
  level: options.level || "error",
11638
11642
  microserviceName: options.microserviceName,
11639
11643
  environment: options.environment,
@@ -11643,24 +11647,23 @@ var DiscordTransport = class {
11643
11647
  };
11644
11648
  this.discordService = new DiscordAlertService({
11645
11649
  errorWebhookUrl: options.webhookUrl,
11646
- microserviceName: this.options.microserviceName,
11647
- environment: this.options.environment,
11648
- enabled: this.options.enabled
11650
+ microserviceName: this.transportOptions.microserviceName,
11651
+ environment: this.transportOptions.environment,
11652
+ enabled: this.transportOptions.enabled
11649
11653
  });
11650
11654
  }
11651
11655
  /**
11652
11656
  * Log method called by Winston for each log entry
11657
+ * Required by winston-transport.Transport
11653
11658
  *
11654
11659
  * @param info - Winston log info object
11655
11660
  * @param callback - Callback to call when done
11656
11661
  */
11657
11662
  log(info, callback) {
11658
11663
  setImmediate(() => {
11659
- if (typeof this.emit === "function") {
11660
- this.emit("logged", info);
11661
- }
11664
+ this.emit("logged", info);
11662
11665
  });
11663
- if (!this.options.enabled || !this.shouldLog(info.level)) {
11666
+ if (!this.transportOptions.enabled || !this.shouldLog(info.level)) {
11664
11667
  callback();
11665
11668
  return;
11666
11669
  }
@@ -11689,7 +11692,7 @@ var DiscordTransport = class {
11689
11692
  debug: 5,
11690
11693
  silly: 6
11691
11694
  };
11692
- const targetLevel = levels[this.options.level] || 0;
11695
+ const targetLevel = levels[this.transportOptions.level] || 0;
11693
11696
  const currentLevel = levels[level] || 999;
11694
11697
  return currentLevel <= targetLevel;
11695
11698
  }
@@ -11721,7 +11724,7 @@ var DiscordTransport = class {
11721
11724
  const severity = this.mapLogLevelToSeverity(info.level);
11722
11725
  await this.discordService.sendAlert({
11723
11726
  severity,
11724
- category: this.options.category,
11727
+ category: this.transportOptions.category,
11725
11728
  title: this.buildTitle(info),
11726
11729
  description: info.message,
11727
11730
  fields: Object.keys(fields).length > 0 ? fields : void 0,
@@ -11787,12 +11790,12 @@ function createDiscordTransport(options) {
11787
11790
 
11788
11791
  // src/adapters/tcp/user.tcp.adapter.ts
11789
11792
  import { config } from "dotenv";
11790
- import { Transport } from "@nestjs/microservices";
11793
+ import { Transport as Transport2 } from "@nestjs/microservices";
11791
11794
  config();
11792
11795
  var UserTCPAdapter = () => {
11793
11796
  return {
11794
11797
  name: "USER_MICROSERVICE",
11795
- transport: Transport.TCP,
11798
+ transport: Transport2.TCP,
11796
11799
  options: {
11797
11800
  host: process.env.USER_MICROSERVICE_TCP_HOST || "localhost",
11798
11801
  port: parseInt(process.env.USER_MICROSERVICE_TCP_PORT || "4001", 10)
@@ -11802,12 +11805,12 @@ var UserTCPAdapter = () => {
11802
11805
 
11803
11806
  // src/adapters/tcp/job.tcp.adapter.ts
11804
11807
  import { config as config2 } from "dotenv";
11805
- import { Transport as Transport2 } from "@nestjs/microservices";
11808
+ import { Transport as Transport3 } from "@nestjs/microservices";
11806
11809
  config2();
11807
11810
  var JobTCPAdapter = () => {
11808
11811
  return {
11809
11812
  name: "JOB_MICROSERVICE",
11810
- transport: Transport2.TCP,
11813
+ transport: Transport3.TCP,
11811
11814
  options: {
11812
11815
  host: process.env.JOB_MICROSERVICE_TCP_HOST || "localhost",
11813
11816
  port: parseInt(process.env.JOB_MICROSERVICE_TCP_PORT || "4002", 10)
@@ -11817,12 +11820,12 @@ var JobTCPAdapter = () => {
11817
11820
 
11818
11821
  // src/adapters/tcp/contract.tcp.adapter.ts
11819
11822
  import { config as config3 } from "dotenv";
11820
- import { Transport as Transport3 } from "@nestjs/microservices";
11823
+ import { Transport as Transport4 } from "@nestjs/microservices";
11821
11824
  config3();
11822
11825
  var ContractTCPAdapter = () => {
11823
11826
  return {
11824
11827
  name: "CONTRACT_MICROSERVICE",
11825
- transport: Transport3.TCP,
11828
+ transport: Transport4.TCP,
11826
11829
  options: {
11827
11830
  host: process.env.CONTRACT_MICROSERVICE_TCP_HOST || "localhost",
11828
11831
  port: parseInt(process.env.CONTRACT_MICROSERVICE_TCP_PORT || "4004", 10)
@@ -11832,12 +11835,12 @@ var ContractTCPAdapter = () => {
11832
11835
 
11833
11836
  // src/adapters/tcp/notification.tcp.adapter.ts
11834
11837
  import { config as config4 } from "dotenv";
11835
- import { Transport as Transport4 } from "@nestjs/microservices";
11838
+ import { Transport as Transport5 } from "@nestjs/microservices";
11836
11839
  config4();
11837
11840
  var NotificationTCPAdapter = () => {
11838
11841
  return {
11839
11842
  name: "NOTIFICATION_MICROSERVICE",
11840
- transport: Transport4.TCP,
11843
+ transport: Transport5.TCP,
11841
11844
  options: {
11842
11845
  host: process.env.NOTIFICATION_MICROSERVICE_TCP_HOST || "localhost",
11843
11846
  port: parseInt(process.env.NOTIFICATION_MICROSERVICE_TCP_PORT || "4003", 10)
@@ -11847,12 +11850,12 @@ var NotificationTCPAdapter = () => {
11847
11850
 
11848
11851
  // src/adapters/tcp/chat.tcp.adapter.ts
11849
11852
  import { config as config5 } from "dotenv";
11850
- import { Transport as Transport5 } from "@nestjs/microservices";
11853
+ import { Transport as Transport6 } from "@nestjs/microservices";
11851
11854
  config5();
11852
11855
  var ChatTCPAdapter = () => {
11853
11856
  return {
11854
11857
  name: "CHAT_MICROSERVICE",
11855
- transport: Transport5.TCP,
11858
+ transport: Transport6.TCP,
11856
11859
  options: {
11857
11860
  host: process.env.CHAT_MICROSERVICE_TCP_HOST || "localhost",
11858
11861
  port: parseInt(process.env.CHAT_MICROSERVICE_TCP_PORT || "4005", 10)
@@ -11862,7 +11865,7 @@ var ChatTCPAdapter = () => {
11862
11865
 
11863
11866
  // src/adapters/rmq/user.rmq.adapter.ts
11864
11867
  import { config as config6 } from "dotenv";
11865
- import { Transport as Transport6 } from "@nestjs/microservices";
11868
+ import { Transport as Transport7 } from "@nestjs/microservices";
11866
11869
  config6();
11867
11870
  var UserRMQAdapter = (mode = "microservice") => {
11868
11871
  const urls = process.env.USER_MICROSERVICE_RMQ_URL?.split(",") || [
@@ -11882,7 +11885,7 @@ var UserRMQAdapter = (mode = "microservice") => {
11882
11885
  );
11883
11886
  const config11 = {
11884
11887
  name: "USER_MICROSERVICE",
11885
- transport: Transport6.RMQ,
11888
+ transport: Transport7.RMQ,
11886
11889
  options: {
11887
11890
  urls,
11888
11891
  queue,
@@ -11919,7 +11922,7 @@ var UserRMQAdapter = (mode = "microservice") => {
11919
11922
 
11920
11923
  // src/adapters/rmq/job.rmq.adapter.ts
11921
11924
  import { config as config7 } from "dotenv";
11922
- import { Transport as Transport7 } from "@nestjs/microservices";
11925
+ import { Transport as Transport8 } from "@nestjs/microservices";
11923
11926
  config7();
11924
11927
  var JobRMQAdapter = (mode = "microservice") => {
11925
11928
  const urls = process.env.JOB_MICROSERVICE_RMQ_URL?.split(",") || [
@@ -11939,7 +11942,7 @@ var JobRMQAdapter = (mode = "microservice") => {
11939
11942
  );
11940
11943
  const config11 = {
11941
11944
  name: "JOB_MICROSERVICE",
11942
- transport: Transport7.RMQ,
11945
+ transport: Transport8.RMQ,
11943
11946
  options: {
11944
11947
  urls,
11945
11948
  queue,
@@ -11976,7 +11979,7 @@ var JobRMQAdapter = (mode = "microservice") => {
11976
11979
 
11977
11980
  // src/adapters/rmq/contract.rmq.adapter.ts
11978
11981
  import { config as config8 } from "dotenv";
11979
- import { Transport as Transport8 } from "@nestjs/microservices";
11982
+ import { Transport as Transport9 } from "@nestjs/microservices";
11980
11983
  config8();
11981
11984
  var ContractRMQAdapter = (mode = "microservice") => {
11982
11985
  const urls = process.env.CONTRACT_MICROSERVICE_RMQ_URL?.split(",") || [
@@ -11996,7 +11999,7 @@ var ContractRMQAdapter = (mode = "microservice") => {
11996
11999
  );
11997
12000
  const config11 = {
11998
12001
  name: "CONTRACT_MICROSERVICE",
11999
- transport: Transport8.RMQ,
12002
+ transport: Transport9.RMQ,
12000
12003
  options: {
12001
12004
  urls,
12002
12005
  queue,
@@ -12033,7 +12036,7 @@ var ContractRMQAdapter = (mode = "microservice") => {
12033
12036
 
12034
12037
  // src/adapters/rmq/notification.rmq.adapter.ts
12035
12038
  import { config as config9 } from "dotenv";
12036
- import { Transport as Transport9 } from "@nestjs/microservices";
12039
+ import { Transport as Transport10 } from "@nestjs/microservices";
12037
12040
  config9();
12038
12041
  var NotificationRMQAdapter = (mode = "microservice") => {
12039
12042
  const urls = process.env.NOTIFICATION_MICROSERVICE_RMQ_URL?.split(",") || [
@@ -12053,7 +12056,7 @@ var NotificationRMQAdapter = (mode = "microservice") => {
12053
12056
  );
12054
12057
  const config11 = {
12055
12058
  name: "NOTIFICATION_MICROSERVICE",
12056
- transport: Transport9.RMQ,
12059
+ transport: Transport10.RMQ,
12057
12060
  options: {
12058
12061
  urls,
12059
12062
  queue,
@@ -12090,7 +12093,7 @@ var NotificationRMQAdapter = (mode = "microservice") => {
12090
12093
 
12091
12094
  // src/adapters/rmq/chat.rmq.adapter.ts
12092
12095
  import { config as config10 } from "dotenv";
12093
- import { Transport as Transport10 } from "@nestjs/microservices";
12096
+ import { Transport as Transport11 } from "@nestjs/microservices";
12094
12097
  config10();
12095
12098
  var ChatRMQAdapter = (mode = "microservice") => {
12096
12099
  const urls = process.env.CHAT_MICROSERVICE_RMQ_URL?.split(",") || [
@@ -12110,7 +12113,7 @@ var ChatRMQAdapter = (mode = "microservice") => {
12110
12113
  );
12111
12114
  const config11 = {
12112
12115
  name: "CHAT_MICROSERVICE",
12113
- transport: Transport10.RMQ,
12116
+ transport: Transport11.RMQ,
12114
12117
  options: {
12115
12118
  urls,
12116
12119
  queue,
@@ -1,3 +1,4 @@
1
+ import Transport from 'winston-transport';
1
2
  import { DiscordAlertService } from './discord-alert.service';
2
3
  import { AlertSeverity, AlertCategory } from './discord-alert.interface';
3
4
  export interface DiscordTransportOptions {
@@ -19,9 +20,9 @@ interface WinstonLogInfo {
19
20
  error?: string;
20
21
  [key: string]: any;
21
22
  }
22
- export declare class DiscordTransport {
23
+ export declare class DiscordTransport extends Transport {
23
24
  private readonly discordService;
24
- private readonly options;
25
+ private readonly transportOptions;
25
26
  private logsSent;
26
27
  constructor(options: DiscordTransportOptions);
27
28
  log(info: WinstonLogInfo, callback: () => void): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experts_hub/shared",
3
- "version": "1.0.612",
3
+ "version": "1.0.614",
4
4
  "description": "Shared DTOs, interfaces, and utilities for experts hub applications",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -46,7 +46,8 @@
46
46
  "peerDependencies": {
47
47
  "@nestjs/common": "^10.0.0 || ^11.0.0",
48
48
  "class-transformer": "^0.5.1",
49
- "class-validator": "^0.14.0"
49
+ "class-validator": "^0.14.0",
50
+ "winston-transport": "^4.0.0"
50
51
  },
51
52
  "dependencies": {
52
53
  "@nestjs/microservices": "^11.0.19",