@rivascva/dt-idl 1.1.69 → 1.1.70

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/go/log/log.go CHANGED
@@ -45,19 +45,19 @@ func NewLogWithPrefix(prefix string) *Log {
45
45
  }
46
46
 
47
47
  func (l *Log) Info(m any) {
48
- l.info.Println(l.prefix, ToJson(m, l.kvs))
48
+ l.info.Println(l.prefix, toJson(m, l.kvs))
49
49
  }
50
50
 
51
51
  func (l *Log) Warn(m any) {
52
- l.warn.Println(l.prefix, ToJson(m, l.kvs))
52
+ l.warn.Println(l.prefix, toJson(m, l.kvs))
53
53
  }
54
54
 
55
55
  func (l *Log) Error(m any) {
56
- l.error.Println(l.prefix, ToJson(m, l.kvs))
56
+ l.error.Println(l.prefix, toJson(m, l.kvs))
57
57
  }
58
58
 
59
59
  func (l *Log) Fatal(m any) {
60
- l.error.Fatal(l.prefix, ToJson(m, l.kvs))
60
+ l.error.Fatal(l.prefix, toJson(m, l.kvs))
61
61
  }
62
62
 
63
63
  func (l *Log) With(kvs ...any) Logger {
package/go/log/utils.go CHANGED
@@ -5,8 +5,8 @@ import (
5
5
  "maps"
6
6
  )
7
7
 
8
- // ToJson converts the message and key-value pairs to a JSON string.
9
- func ToJson(m any, kvs map[string]any) string {
8
+ // toJson converts the message and key-value pairs to a JSON string.
9
+ func toJson(m any, kvs map[string]any) string {
10
10
  // copy the key-value pairs into a new map and add the message
11
11
  out := make(map[string]any, len(kvs)+1)
12
12
  maps.Copy(out, kvs)
@@ -0,0 +1,17 @@
1
+ package utils
2
+
3
+ import (
4
+ "context"
5
+
6
+ "github.com/RivasCVA/dt-idl/go/models"
7
+ "github.com/golang-jwt/jwt/v5"
8
+ )
9
+
10
+ // GetTokenFromContext retrieves the JWT token from the given context.
11
+ func GetTokenFromContext(ctx context.Context) *jwt.Token {
12
+ token, ok := ctx.Value(models.TokenKey).(*jwt.Token)
13
+ if !ok {
14
+ return nil
15
+ }
16
+ return token
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.69",
3
+ "version": "1.1.70",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",