Skip to content

Commit e8ada4e

Browse files
committed
applied rename to dependents
1 parent db5d04b commit e8ada4e

File tree

8 files changed

+36
-35
lines changed

8 files changed

+36
-35
lines changed

internals/proxy/middlewares/body.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strconv"
88

99
middlewareTypes "github.com/codeshelldev/secured-signal-api/internals/proxy/middlewares/types"
10-
"github.com/codeshelldev/secured-signal-api/utils"
10+
jsonutils "github.com/codeshelldev/secured-signal-api/utils/jsonutils"
1111
log "github.com/codeshelldev/secured-signal-api/utils/logger"
1212
request "github.com/codeshelldev/secured-signal-api/utils/request"
1313
)
@@ -90,7 +90,7 @@ func getMessage(aliases []middlewareTypes.MessageAlias, data map[string]any) (st
9090
func processAlias(alias middlewareTypes.MessageAlias, data map[string]any) (string, int, bool) {
9191
aliasKey := alias.Alias
9292

93-
value, ok := utils.GetByPath(aliasKey, data)
93+
value, ok := jsonutils.GetByPath(aliasKey, data)
9494

9595
aliasValue, isStr := value.(string)
9696

internals/proxy/middlewares/template.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"net/url"
88
"strconv"
99

10-
"github.com/codeshelldev/secured-signal-api/utils"
10+
jsonutils "github.com/codeshelldev/secured-signal-api/utils/jsonutils"
1111
log "github.com/codeshelldev/secured-signal-api/utils/logger"
12-
"github.com/codeshelldev/secured-signal-api/utils/query"
12+
query "github.com/codeshelldev/secured-signal-api/utils/query"
1313
request "github.com/codeshelldev/secured-signal-api/utils/request"
14-
"github.com/codeshelldev/secured-signal-api/utils/templating"
14+
templating "github.com/codeshelldev/secured-signal-api/utils/templating"
1515
)
1616

1717
type TemplateMiddleware struct {
@@ -113,8 +113,8 @@ func TemplateBody(data map[string]any, VARIABLES any) (map[string]any, bool, err
113113
return data, false, err
114114
}
115115

116-
beforeStr := utils.ToJson(templatedData)
117-
afterStr := utils.ToJson(data)
116+
beforeStr := jsonutils.ToJson(templatedData)
117+
afterStr := jsonutils.ToJson(data)
118118

119119
modified = beforeStr == afterStr
120120

tests/json_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package tests
33
import (
44
"testing"
55

6-
"github.com/codeshelldev/secured-signal-api/utils"
7-
"github.com/codeshelldev/secured-signal-api/utils/templating"
6+
jsonutils "github.com/codeshelldev/secured-signal-api/utils/jsonutils"
7+
templating "github.com/codeshelldev/secured-signal-api/utils/templating"
88
)
99

1010
func TestJsonTemplating(t *testing.T) {
@@ -28,7 +28,7 @@ func TestJsonTemplating(t *testing.T) {
2828
"key2": "{{.int}}"
2929
}`
3030

31-
data := utils.GetJson[map[string]any](json)
31+
data := jsonutils.GetJson[map[string]any](json)
3232

3333
expected := map[string]any{
3434
"dict": map[string]any{
@@ -48,8 +48,8 @@ func TestJsonTemplating(t *testing.T) {
4848
t.Error("Error Templating JSON: ", err.Error())
4949
}
5050

51-
expectedStr := utils.ToJson(expected)
52-
gotStr := utils.ToJson(got)
51+
expectedStr := jsonutils.ToJson(expected)
52+
gotStr := jsonutils.ToJson(got)
5353

5454
if expectedStr != gotStr {
5555
t.Error("\nExpected: ", expectedStr, "\nGot: ", gotStr)
@@ -71,7 +71,7 @@ func TestJsonPath(t *testing.T) {
7171
"key": "val"
7272
}`
7373

74-
data := utils.GetJson[map[string]any](json)
74+
data := jsonutils.GetJson[map[string]any](json)
7575

7676
cases := []struct{
7777
key string
@@ -107,7 +107,7 @@ func TestJsonPath(t *testing.T) {
107107
key := c.key
108108
expected := c.expected
109109

110-
got, ok := utils.GetByPath(key, data)
110+
got, ok := jsonutils.GetByPath(key, data)
111111

112112
if !ok || got.(string) != expected {
113113
t.Error("Expected: ", key, " == ", expected, "; Got: ", got)

tests/request_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package tests
33
import (
44
"testing"
55

6-
"github.com/codeshelldev/secured-signal-api/utils"
7-
"github.com/codeshelldev/secured-signal-api/utils/query"
8-
"github.com/codeshelldev/secured-signal-api/utils/templating"
6+
jsonutils "github.com/codeshelldev/secured-signal-api/utils/jsonutils"
7+
query "github.com/codeshelldev/secured-signal-api/utils/query"
8+
templating "github.com/codeshelldev/secured-signal-api/utils/templating"
99
)
1010

1111
func TestQueryTemplating(t *testing.T) {
@@ -45,8 +45,8 @@ func TestTypedQuery(t *testing.T) {
4545
},
4646
}
4747

48-
expectedStr := utils.ToJson(expected)
49-
gotStr := utils.ToJson(got)
48+
expectedStr := jsonutils.ToJson(expected)
49+
gotStr := jsonutils.ToJson(got)
5050

5151
if expectedStr != gotStr {
5252
t.Error("\nExpected: ", expectedStr, "\nGot: ", gotStr)

tests/string_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ import (
44
"reflect"
55
"testing"
66

7-
"github.com/codeshelldev/secured-signal-api/utils/safestrings"
7+
stringutils "github.com/codeshelldev/secured-signal-api/utils/stringutils"
88
)
99

1010
func TestStringEscaping(t *testing.T) {
1111
str1 := `\#`
1212

13-
res1 := safestrings.IsEscaped(str1, "#")
13+
res1 := stringutils.IsEscaped(str1, "#")
1414

1515
if !res1 {
1616
t.Error("Expected: ", str1, " == true", "; Got: ", str1, " == ", res1)
1717
}
1818

1919
str2 := "#"
2020

21-
res2 := safestrings.IsEscaped(str2, "#")
21+
res2 := stringutils.IsEscaped(str2, "#")
2222

2323
if res2 {
2424
t.Error("Expected: ", str2, " == false", "; Got: ", str2, " == ", res2)
2525
}
2626

2727
str3 := `#\#`
2828

29-
res3 := safestrings.Contains(str3, "#")
29+
res3 := stringutils.Contains(str3, "#")
3030

3131
if !res3 {
3232
t.Error("Expected: ", str3, " == true", "; Got: ", str3, " == ", res3)
@@ -36,15 +36,15 @@ func TestStringEscaping(t *testing.T) {
3636
func TestStringEnclosement(t *testing.T) {
3737
str1 := "[enclosed]"
3838

39-
res1 := safestrings.IsEnclosedBy(str1, `[`, `]`)
39+
res1 := stringutils.IsEnclosedBy(str1, `[`, `]`)
4040

4141
if !res1 {
4242
t.Error("Expected: ", str1, " == true", "; Got: ", str1, " == ", res1)
4343
}
4444

4545
str2 := `\[enclosed]`
4646

47-
res2 := safestrings.IsEnclosedBy(str2, `[`, `]`)
47+
res2 := stringutils.IsEnclosedBy(str2, `[`, `]`)
4848

4949
if res2 {
5050
t.Error("Expected: ", str2, " == false", "; Got: ", str2, " == ", res2)
@@ -54,23 +54,23 @@ func TestStringEnclosement(t *testing.T) {
5454
func TestStringToType(t *testing.T) {
5555
str1 := `[item1,item2]`
5656

57-
res1 := safestrings.ToType(str1)
57+
res1 := stringutils.ToType(str1)
5858

5959
if reflect.TypeOf(res1) != reflect.TypeFor[[]string]() {
6060
t.Error("Expected: ", str1, " == []string", "; Got: ", str1, " == ", reflect.TypeOf(res1))
6161
}
6262

6363
str2 := `1`
6464

65-
res2 := safestrings.ToType(str2)
65+
res2 := stringutils.ToType(str2)
6666

6767
if reflect.TypeOf(res2) != reflect.TypeFor[int]() {
6868
t.Error("Expected: ", str2, " == int", "; Got: ", str2, " == ", reflect.TypeOf(res2))
6969
}
7070

7171
str3 := `{ "key": "value" }`
7272

73-
res3 := safestrings.ToType(str3)
73+
res3 := stringutils.ToType(str3)
7474

7575
if reflect.TypeOf(res3) != reflect.TypeFor[map[string]any]() {
7676
t.Error("Expected: ", str3, " == map[string]any", "; Got: ", str3, " == ", reflect.TypeOf(res3))

utils/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"sync"
99

1010
log "github.com/codeshelldev/secured-signal-api/utils/logger"
11-
"github.com/codeshelldev/secured-signal-api/utils/safestrings"
11+
stringutils "github.com/codeshelldev/secured-signal-api/utils/stringutils"
1212

1313
"github.com/knadh/koanf/providers/confmap"
1414
"github.com/knadh/koanf/providers/env/v2"
@@ -218,5 +218,5 @@ func normalizeEnv(key string, value string) (string, any) {
218218
key = strings.ReplaceAll(key, "__", ".")
219219
key = strings.ReplaceAll(key, "_", "")
220220

221-
return key, safestrings.ToType(value)
221+
return key, stringutils.ToType(value)
222222
}

utils/config/loader.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import (
88
"strings"
99

1010
middlewareTypes "github.com/codeshelldev/secured-signal-api/internals/proxy/middlewares/types"
11-
"github.com/codeshelldev/secured-signal-api/utils"
11+
jsonutils "github.com/codeshelldev/secured-signal-api/utils/jsonutils"
1212
log "github.com/codeshelldev/secured-signal-api/utils/logger"
13+
1314
"github.com/knadh/koanf/parsers/yaml"
1415
)
1516

@@ -68,8 +69,8 @@ func Load() {
6869

6970
log.Info("Finished Loading Configuration")
7071

71-
log.Dev("Loaded Config:\n" + utils.ToJson(config.All()))
72-
log.Dev("Loaded Token Configs:\n" + utils.ToJson(tokensLayer.All()))
72+
log.Dev("Loaded Config:\n" + jsonutils.ToJson(config.All()))
73+
log.Dev("Loaded Token Configs:\n" + jsonutils.ToJson(tokensLayer.All()))
7374
}
7475

7576
func InitEnv() {

utils/query/query.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package query
33
import (
44
"strings"
55

6-
"github.com/codeshelldev/secured-signal-api/utils/safestrings"
6+
stringutils "github.com/codeshelldev/secured-signal-api/utils/stringutils"
77
)
88

99
func ParseRawQuery(raw string) map[string][]string {
@@ -33,7 +33,7 @@ func ParseRawQuery(raw string) map[string][]string {
3333
func ParseTypedQueryValues(values []string) any {
3434
raw := values[len(values)-1]
3535

36-
return safestrings.ToType(raw)
36+
return stringutils.ToType(raw)
3737
}
3838

3939
func ParseTypedQuery(query string, matchPrefix string) (map[string]any) {

0 commit comments

Comments
 (0)