Skip to content

Commit

Permalink
fix: bumped sdk version and fixed http errors
Browse files Browse the repository at this point in the history
Signed-off-by: Rubicon Lee <132176609+raff-wakflo@users.noreply.github.com>
  • Loading branch information
raff-wakflo committed Aug 9, 2024
1 parent e185aca commit d4ad6c5
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 71 deletions.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ go 1.22.2

require (
github.com/clarkmcc/go-typescript v0.7.0
github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2
github.com/dop251/goja v0.0.0-20240806095544-3491d4a58fbe
github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1
github.com/gookit/goutil v0.6.15
github.com/open2b/scriggo v0.56.1
github.com/opus-domini/fast-shot v0.10.0
github.com/opus-domini/fast-shot v1.1.2
github.com/rs/zerolog v1.33.0
github.com/wakflo/go-sdk v0.4.2
github.com/wakflo/go-sdk v0.4.3
golang.org/x/crypto v0.24.0
golang.org/x/oauth2 v0.20.0
google.golang.org/api v0.181.0
)

Expand All @@ -25,7 +26,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cavaliergopher/grab/v3 v3.0.1 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
Expand Down Expand Up @@ -62,7 +63,6 @@ require (
go.opentelemetry.io/otel/trace v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect
Expand Down
18 changes: 10 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo=
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 h1:OFTHt+yJDo/uaIKMGjEKzc3DGhrpQZoqvMUIloZv6ZY=
github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2/go.mod h1:o31y53rb/qiIAONF7w3FHJZRqqP3fzHUr1HqanthByw=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dop251/goja v0.0.0-20240806095544-3491d4a58fbe h1:jwFJkgsdelB87ohlXaAGSd05Cb5ALDFa9iW9IGRHcRM=
github.com/dop251/goja v0.0.0-20240806095544-3491d4a58fbe/go.mod h1:DF+w/nLMIkvRpyhd/0K+Okbh3fVZBtXLwRtS/ccAa5w=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
Expand Down Expand Up @@ -127,8 +127,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/open2b/scriggo v0.56.1 h1:h3IVNM0OEvszbtdmukaJj9lPo/xSvHPclYm/RqQqUxY=
github.com/open2b/scriggo v0.56.1/go.mod h1:FJS0k7CaKq2sNlrqAGMwU4dCltYqC1c+Eak3dj5w26Q=
github.com/opus-domini/fast-shot v0.10.0 h1:zWbPy6KJZvNs0pUa0erF9TyeDsLZHDVZf4oDHOd6JGY=
github.com/opus-domini/fast-shot v0.10.0/go.mod h1:sg5+f0VviAIIdrv24WLHL6kV7kWs4PsVDbSkr2TPYWw=
github.com/opus-domini/fast-shot v1.1.2 h1:02cyRhjASTWLJEY0QNLuUSmfNAbws5UMtfY1b6yimCA=
github.com/opus-domini/fast-shot v1.1.2/go.mod h1:BOr2JXHQJhOnYsxyCvFbgBP3BuYCjgh2YfzWKweEL0A=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -139,14 +139,16 @@ github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWR
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/wakflo/go-sdk v0.4.2 h1:CCmRrmyTm5tdjaxKrIas7uVD06XDbsPEqEVPzznK9o8=
github.com/wakflo/go-sdk v0.4.2/go.mod h1:hJ4utGZ8WYRdZ3Ey/ylv9ogswhDAjcmQ9Drk4IaXwvc=
github.com/wakflo/go-sdk v0.4.3 h1:azWuZCNVD4zu2UV0g4ENIWSgd2Yg1r63gFRqtzZaJmc=
github.com/wakflo/go-sdk v0.4.3/go.mod h1:hJ4utGZ8WYRdZ3Ey/ylv9ogswhDAjcmQ9Drk4IaXwvc=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
Expand Down
2 changes: 1 addition & 1 deletion internal/connectors/googledrive/lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestNewConnector(t *testing.T) {
// if err != nil {
// t.Errorf("NewConnector() RunTrigger() with name %v threw an error = %v", testCase.operationName, err)
// }
//} else {
// } else {
// _, err = spider.RunOperation(testCase.operationName, testCase.ctx)
// if err != nil {
// t.Errorf("NewConnector() RunOperation() with name %v threw an error = %v", testCase.operationName, err)
Expand Down
20 changes: 12 additions & 8 deletions internal/connectors/googledrive/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,17 +326,18 @@ func getParentFoldersInput() *sdkcore.AutoFormSchema {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
defer rsp.Body().Close()
byts, err := io.ReadAll(rsp.Body().Raw())
if err != nil {
return nil, err
}

var body ListFileResponse
err = json.Unmarshal(bytes, &body)
err = json.Unmarshal(byts, &body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -368,17 +369,20 @@ func getFoldersInput(title string, desc string, required bool) *sdkcore.AutoForm
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
defer rsp.Body().Close()

if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
defer rsp.Body().Close()
byts, err := io.ReadAll(rsp.Body().Raw())
if err != nil {
return nil, err
}

var body ListFileResponse
err = json.Unmarshal(bytes, &body)
err = json.Unmarshal(byts, &body)
if err != nil {
return nil, err
}
Expand Down
11 changes: 7 additions & 4 deletions internal/connectors/googledrive/trigger_new_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,20 @@ func NewTriggerNewFile() *TriggerNewFile {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
defer rsp.Body().Close()

if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
defer rsp.Body().Close()
byts, err := io.ReadAll(rsp.Body().Raw())
if err != nil {
return nil, err
}

var body ListFileResponse
err = json.Unmarshal(bytes, &body)
err = json.Unmarshal(byts, &body)
if err != nil {
return nil, err
}
Expand Down
1 change: 1 addition & 0 deletions internal/connectors/javascript/operation_run_jscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (c *RunJSOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
arg := map[string]interface{}{
"auth": ctx.Auth,
"input": input,
"steps": ctx.GetStepsState(),
}
res, err := execute(goja.Undefined(), vm.ToValue(arg))
if err != nil {
Expand Down
18 changes: 9 additions & 9 deletions internal/connectors/slack/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func getUsers(client fastshot.ClientHttpMethods) ([]SlackUser, error) {
return nil, err
}

if resp.IsError() {
return nil, fmt.Errorf("bad HTTP request - error: %s", resp.StatusText())
if resp.Status().IsError() {
return nil, fmt.Errorf("bad HTTP request - error: %s", resp.Status().Text())
}

respBytes, err := io.ReadAll(resp.RawBody())
respBytes, err := io.ReadAll(resp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -115,11 +115,11 @@ func getChannels(client fastshot.ClientHttpMethods, channelTypes string) ([]Slac
return nil, err
}

if resp.IsError() {
return nil, fmt.Errorf("bad request - error: %s", resp.StatusText())
if resp.Status().IsError() {
return nil, fmt.Errorf("bad request - error: %s", resp.Status().Text())
}

respBytes, err := io.ReadAll(resp.RawBody())
respBytes, err := io.ReadAll(resp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -162,11 +162,11 @@ func sendMessage(client fastshot.ClientHttpMethods, message string, channelID st
return err
}

if resp.IsError() {
return fmt.Errorf("bad request - error: %s", resp.StatusText())
if resp.Status().IsError() {
return fmt.Errorf("bad request - error: %s", resp.Status().Text())
}

respBytes, err := io.ReadAll(resp.RawBody())
respBytes, err := io.ReadAll(resp.Raw().Body)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/connectors/todoist/operation_create_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ func (c *CreateProjectOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/connectors/todoist/operation_create_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ func (c *CreateTaskOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/connectors/todoist/operation_get_active_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ func (c *GetActiveTaskOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
7 changes: 4 additions & 3 deletions internal/connectors/todoist/operation_get_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ func (c *GetProjectOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
if err != nil {
return nil, err
}
if rsp.IsError() {
return nil, errors.New(rsp.StatusText())

if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/connectors/todoist/operation_list_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ func (c *ListProjectsOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ func (c *ListProjectCollaboratorsOperation) Run(ctx *sdk.RunContext) (sdk.JSON,
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/connectors/todoist/operation_list_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ func (c *ListTasksOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/connectors/todoist/operation_update_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ func (c *UpdateProjectOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/connectors/todoist/operation_update_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ func (c *UpdateTaskOperation) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down
18 changes: 9 additions & 9 deletions internal/connectors/todoist/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ func getProjectsInput() *sdkcore.AutoFormSchema {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -106,11 +106,11 @@ func getSectionsInput() *sdkcore.AutoFormSchema {
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -171,11 +171,11 @@ func getTasksInput(title string, desc string, required bool) *sdkcore.AutoFormSc
return nil, err
}

if rsp.IsError() {
return nil, errors.New(rsp.StatusText())
if rsp.Status().IsError() {
return nil, errors.New(rsp.Status().Text())
}

bytes, err := io.ReadAll(rsp.RawBody())
bytes, err := io.ReadAll(rsp.Raw().Body)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d4ad6c5

Please sign in to comment.