diff --git a/CHANGELOG.md b/CHANGELOG.md index e135657c..e5a24884 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ - Fixed the UI settings update form to prevent sending empty string for the mail password or the S3 secret options on resave of the form. +- ⚠️ Added an exception for the `OAuth2` field in the GO->JSVM name mapping rules: + ``` + // old -> new + collection.oAuth2.* -> collection.oauth2.* + ``` + - Added more user friendly view collection truncate error message. - Added `FieldsList.AddMarshaledJSON([]byte)` helper method to load a serialized json array of objects or a single json object into an existing collection fields list. diff --git a/go.mod b/go.mod index 409f2787..4502e6e9 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/aws/smithy-go v1.22.0 github.com/disintegration/imaging v1.6.2 github.com/domodwyer/mailyak/v3 v3.6.2 - github.com/dop251/goja v0.0.0-20240927123429-241b342198c2 + github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc github.com/fatih/color v1.17.0 github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index 233667cc..05a14d1d 100644 --- a/go.sum +++ b/go.sum @@ -80,6 +80,8 @@ github.com/domodwyer/mailyak/v3 v3.6.2 h1:x3tGMsyFhTCaxp6ycgR0FE/bu5QiNp+hetUuCO github.com/domodwyer/mailyak/v3 v3.6.2/go.mod h1:lOm/u9CyCVWHeaAmHIdF4RiKVxKUT/H5XX10lIKAL6c= github.com/dop251/goja v0.0.0-20240927123429-241b342198c2 h1:Ux9RXuPQmTB4C1MKagNLme0krvq8ulewfor+ORO/QL4= github.com/dop251/goja v0.0.0-20240927123429-241b342198c2/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= +github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 h1:MXsAuToxwsTn5BEEYm2DheqIiC4jWGmkEJ1uy+KFhvQ= +github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc h1:MKYt39yZJi0Z9xEeRmDX2L4ocE0ETKcHKw6MVL3R+co= github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc/go.mod h1:VULptt4Q/fNzQUJlqY/GP3qHyU7ZH46mFkBZe0ZTokU= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= diff --git a/plugins/jsvm/mapper.go b/plugins/jsvm/mapper.go index 27f35431..d9c16bb0 100644 --- a/plugins/jsvm/mapper.go +++ b/plugins/jsvm/mapper.go @@ -29,7 +29,13 @@ func (u FieldMapper) MethodName(_ reflect.Type, m reflect.Method) string { return convertGoToJSName(m.Name) } +var nameExceptions = map[string]string{"OAuth2": "oauth2"} + func convertGoToJSName(name string) string { + if v, ok := nameExceptions[name]; ok { + return v + } + startUppercase := make([]rune, 0, len(name)) for _, c := range name { diff --git a/plugins/jsvm/mapper_test.go b/plugins/jsvm/mapper_test.go index 4ddfd628..0cc020eb 100644 --- a/plugins/jsvm/mapper_test.go +++ b/plugins/jsvm/mapper_test.go @@ -25,6 +25,7 @@ func TestFieldMapper(t *testing.T) { {"ALL_CAPS_WITH_UNDERSCORE", "all_caps_with_underscore"}, {"OIDCMap", "oidcMap"}, {"MD5", "md5"}, + {"OAuth2", "oauth2"}, } for i, s := range scenarios {