Skip to content

Commit

Permalink
Merge branch 'main' into no_more_ticketers
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jan 2, 2024
2 parents 0d39ca9 + 90233b2 commit cb23381
Show file tree
Hide file tree
Showing 28 changed files with 53 additions and 48 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.197.7 (2023-12-12)
-------------------------
* Merge pull request #1198 from nyaruka/trim_attachments
* Trim whitespace from evaluated message attachments

v0.197.6 (2023-11-27)
-------------------------
* Update to latest gocommon
Expand Down
4 changes: 2 additions & 2 deletions flows/actions/open_ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ type OpenTicketAction struct {
baseAction
onlineAction

Topic *assets.TopicReference `json:"topic" validate:"omitempty,dive"`
Topic *assets.TopicReference `json:"topic" validate:"omitempty"`
Body string `json:"body" engine:"evaluated"`
Assignee *assets.UserReference `json:"assignee" validate:"omitempty,dive"`
Assignee *assets.UserReference `json:"assignee" validate:"omitempty"`
ResultName string `json:"result_name" validate:"required"`
}

Expand Down
2 changes: 1 addition & 1 deletion flows/actions/request_optin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type RequestOptInAction struct {
baseAction
onlineAction

OptIn *assets.OptInReference `json:"optin" validate:"required,dive"`
OptIn *assets.OptInReference `json:"optin" validate:"required"`
}

// NewRequestOptIn creates a new request optin action
Expand Down
2 changes: 1 addition & 1 deletion flows/actions/send_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type SendMsgAction struct {
createMsgAction

AllURNs bool `json:"all_urns,omitempty"`
Templating *Templating `json:"templating,omitempty" validate:"omitempty,dive"`
Templating *Templating `json:"templating,omitempty" validate:"omitempty"`
Topic flows.MsgTopic `json:"topic,omitempty" validate:"omitempty,msg_topic"`
}

Expand Down
2 changes: 1 addition & 1 deletion flows/actions/set_contact_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type SetContactChannelAction struct {
baseAction
onlineAction

Channel *assets.ChannelReference `json:"channel" validate:"omitempty,dive"`
Channel *assets.ChannelReference `json:"channel" validate:"omitempty"`
}

// NewSetContactChannel creates a new set channel action
Expand Down
2 changes: 1 addition & 1 deletion flows/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (c *Call) URN() urns.URN { return c.urn }
//------------------------------------------------------------------------------------------

type callEnvelope struct {
Channel *assets.ChannelReference `json:"channel" validate:"required,dive"`
Channel *assets.ChannelReference `json:"channel" validate:"required"`
URN urns.URN `json:"urn" validate:"required,urn"`
}

Expand Down
2 changes: 1 addition & 1 deletion flows/events/dial_ended.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TypeDialEnded string = "dial_ended"
type DialEndedEvent struct {
BaseEvent

Dial *flows.Dial `json:"dial" validate:"required,dive"`
Dial *flows.Dial `json:"dial" validate:"required"`
}

// NewDialEnded returns a new dial ended event
Expand Down
2 changes: 1 addition & 1 deletion flows/events/ivr_created.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const TypeIVRCreated string = "ivr_created"
type IVRCreatedEvent struct {
BaseEvent

Msg *flows.MsgOut `json:"msg" validate:"required,dive"`
Msg *flows.MsgOut `json:"msg" validate:"required"`
}

// NewIVRCreated creates a new IVR created event
Expand Down
2 changes: 1 addition & 1 deletion flows/events/msg_created.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const TypeMsgCreated string = "msg_created"
type MsgCreatedEvent struct {
BaseEvent

Msg *flows.MsgOut `json:"msg" validate:"required,dive"`
Msg *flows.MsgOut `json:"msg" validate:"required"`
}

// NewMsgCreated creates a new outgoing msg event to a single contact
Expand Down
2 changes: 1 addition & 1 deletion flows/events/msg_received.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const TypeMsgReceived string = "msg_received"
type MsgReceivedEvent struct {
BaseEvent

Msg flows.MsgIn `json:"msg" validate:"required,dive"`
Msg flows.MsgIn `json:"msg" validate:"required"`
}

// NewMsgReceived creates a new incoming msg event for the passed in channel, URN and text
Expand Down
4 changes: 2 additions & 2 deletions flows/events/optin_requested.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const TypeOptInRequested string = "optin_requested"
type OptInRequestedEvent struct {
BaseEvent

OptIn *assets.OptInReference `json:"optin" validate:"required,dive"`
Channel *assets.ChannelReference `json:"channel" validate:"required,dive"`
OptIn *assets.OptInReference `json:"optin" validate:"required"`
Channel *assets.ChannelReference `json:"channel" validate:"required"`
URN urns.URN `json:"urn" validate:"required"`
}

Expand Down
4 changes: 2 additions & 2 deletions flows/events/ticket_opened.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const TypeTicketOpened string = "ticket_opened"

type Ticket struct {
UUID flows.TicketUUID `json:"uuid" validate:"required,uuid4"`
Topic *assets.TopicReference `json:"topic" validate:"omitempty,dive"`
Topic *assets.TopicReference `json:"topic" validate:"omitempty"`
Body string `json:"body"`
Assignee *assets.UserReference `json:"assignee,omitempty" validate:"omitempty,dive"`
Assignee *assets.UserReference `json:"assignee,omitempty" validate:"omitempty"`
}

// TicketOpenedEvent events are created when a new ticket is opened.
Expand Down
2 changes: 1 addition & 1 deletion flows/inputs/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (i *baseInput) CreatedOn() time.Time { return i.createdOn }
type baseInputEnvelope struct {
Type string `json:"type" validate:"required"`
UUID flows.InputUUID `json:"uuid"`
Channel *assets.ChannelReference `json:"channel,omitempty" validate:"omitempty,dive"`
Channel *assets.ChannelReference `json:"channel,omitempty" validate:"omitempty"`
CreatedOn time.Time `json:"created_on" validate:"required"`
}

Expand Down
2 changes: 1 addition & 1 deletion flows/modifiers/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var _ flows.Modifier = (*ChannelModifier)(nil)

type channelModifierEnvelope struct {
utils.TypedEnvelope
Channel *assets.ChannelReference `json:"channel" validate:"omitempty,dive"`
Channel *assets.ChannelReference `json:"channel" validate:"omitempty"`
}

func readChannelModifier(assets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Modifier, error) {
Expand Down
2 changes: 1 addition & 1 deletion flows/resumes/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var _ flows.Resume = (*DialResume)(nil)
type dialResumeEnvelope struct {
baseResumeEnvelope

Dial *flows.Dial `json:"dial" validate:"required,dive"`
Dial *flows.Dial `json:"dial" validate:"required"`
}

func readDialResume(sessionAssets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Resume, error) {
Expand Down
2 changes: 1 addition & 1 deletion flows/resumes/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ flows.Resume = (*MsgResume)(nil)

type msgResumeEnvelope struct {
baseResumeEnvelope
Msg *flows.MsgIn `json:"msg" validate:"required,dive"`
Msg *flows.MsgIn `json:"msg" validate:"required"`
}

func readMsgResume(sessionAssets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Resume, error) {
Expand Down
2 changes: 1 addition & 1 deletion flows/routers/waits/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (w *baseWait) expiresOn(run flows.Run) *time.Time {

type baseWaitEnvelope struct {
Type string `json:"type" validate:"required"`
Timeout *Timeout `json:"timeout,omitempty" validate:"omitempty,dive"`
Timeout *Timeout `json:"timeout,omitempty" validate:"omitempty"`
}

// ReadWait reads a wait from the given JSON
Expand Down
2 changes: 1 addition & 1 deletion flows/runs/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ var _ flows.RunSummary = (*run)(nil)

type runEnvelope struct {
UUID flows.RunUUID `json:"uuid" validate:"required,uuid4"`
Flow *assets.FlowReference `json:"flow" validate:"required,dive"`
Flow *assets.FlowReference `json:"flow" validate:"required"`
Path []*step `json:"path" validate:"dive"`
Events []json.RawMessage `json:"events,omitempty"`
Results flows.Results `json:"results,omitempty" validate:"omitempty,dive"`
Expand Down
2 changes: 1 addition & 1 deletion flows/runs/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func FormatRunSummary(env envs.Environment, run flows.RunSummary) string {

type runSummaryEnvelope struct {
UUID flows.RunUUID `json:"uuid" validate:"uuid4"`
Flow *assets.FlowReference `json:"flow" validate:"required,dive"`
Flow *assets.FlowReference `json:"flow" validate:"required"`
Contact json.RawMessage `json:"contact"`
Status flows.RunStatus `json:"status" validate:"required"`
Results flows.Results `json:"results"`
Expand Down
4 changes: 2 additions & 2 deletions flows/tickets.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (t *Ticket) Context(env envs.Environment) map[string]types.XValue {

type ticketEnvelope struct {
UUID TicketUUID `json:"uuid" validate:"required,uuid4"`
Topic *assets.TopicReference `json:"topic" validate:"omitempty,dive"`
Topic *assets.TopicReference `json:"topic" validate:"omitempty"`
Body string `json:"body"`
Assignee *assets.UserReference `json:"assignee,omitempty" validate:"omitempty,dive"`
Assignee *assets.UserReference `json:"assignee,omitempty" validate:"omitempty"`
}

// ReadTicket decodes a contact from the passed in JSON. If the topic or assigned user can't
Expand Down
4 changes: 2 additions & 2 deletions flows/triggers/campaign.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *CampaignReference) Context(env envs.Environment) map[string]types.XValu
// CampaignEvent describes the specific event in the campaign that triggered the session
type CampaignEvent struct {
UUID CampaignEventUUID `json:"uuid" validate:"required,uuid4"`
Campaign *CampaignReference `json:"campaign" validate:"required,dive"`
Campaign *CampaignReference `json:"campaign" validate:"required"`
}

// CampaignTrigger is used when a session was triggered by a campaign event
Expand Down Expand Up @@ -111,7 +111,7 @@ func (b *CampaignBuilder) Build() *CampaignTrigger {

type campaignTriggerEnvelope struct {
baseTriggerEnvelope
Event *CampaignEvent `json:"event" validate:"required,dive"`
Event *CampaignEvent `json:"event" validate:"required"`
}

func readCampaignTrigger(sessionAssets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Trigger, error) {
Expand Down
4 changes: 2 additions & 2 deletions flows/triggers/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
// ChannelEvent describes the specific event on the channel that triggered the session
type ChannelEvent struct {
Type ChannelEventType `json:"type" validate:"required"`
Channel *assets.ChannelReference `json:"channel" validate:"required,dive"`
Channel *assets.ChannelReference `json:"channel" validate:"required"`
}

// ChannelTrigger is used when a session was triggered by a channel event
Expand Down Expand Up @@ -102,7 +102,7 @@ func (b *ChannelBuilder) Build() *ChannelTrigger {

type channelTriggerEnvelope struct {
baseTriggerEnvelope
Event *ChannelEvent `json:"event" validate:"required,dive"`
Event *ChannelEvent `json:"event" validate:"required"`
}

func readChannelTrigger(sessionAssets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Trigger, error) {
Expand Down
2 changes: 1 addition & 1 deletion flows/triggers/manual.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (b *ManualBuilder) Build() *ManualTrigger {

type manualTriggerEnvelope struct {
baseTriggerEnvelope
User *assets.UserReference `json:"user,omitempty" validate:"omitempty,dive"`
User *assets.UserReference `json:"user,omitempty" validate:"omitempty"`
Origin string `json:"origin,omitempty"`
}

Expand Down
4 changes: 2 additions & 2 deletions flows/triggers/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ func (b *MsgBuilder) Build() *MsgTrigger {

type msgTriggerEnvelope struct {
baseTriggerEnvelope
Msg *flows.MsgIn `json:"msg" validate:"required,dive"`
Match *KeywordMatch `json:"keyword_match,omitempty" validate:"omitempty,dive"`
Msg *flows.MsgIn `json:"msg" validate:"required"`
Match *KeywordMatch `json:"keyword_match,omitempty" validate:"omitempty"`
}

func readMsgTrigger(sessionAssets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Trigger, error) {
Expand Down
4 changes: 2 additions & 2 deletions flows/triggers/optin.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ func (b *OptInBuilder) Build() *OptInTrigger {

type optInEventEnvelope struct {
Type OptInEventType `json:"type" validate:"required"`
OptIn *assets.OptInReference `json:"optin" validate:"required,dive"`
OptIn *assets.OptInReference `json:"optin" validate:"required"`
}

type optInTriggerEnvelope struct {
baseTriggerEnvelope
Event *optInEventEnvelope `json:"event" validate:"required,dive"`
Event *optInEventEnvelope `json:"event" validate:"required"`
}

func readOptInTrigger(sa flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Trigger, error) {
Expand Down
2 changes: 1 addition & 1 deletion flows/triggers/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ type ticketEventEnvelope struct {

type ticketTriggerEnvelope struct {
baseTriggerEnvelope
Event ticketEventEnvelope `json:"event" validate:"required,dive"`
Event ticketEventEnvelope `json:"event" validate:"required"`
}

func readTicketTrigger(sa flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Trigger, error) {
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ require (
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12
github.com/blevesearch/segment v0.9.1
github.com/buger/jsonparser v1.1.1
github.com/go-playground/validator/v10 v10.14.1
github.com/go-playground/validator/v10 v10.16.0
github.com/nyaruka/gocommon v1.42.6
github.com/olivere/elastic/v7 v7.0.32
github.com/pkg/errors v0.9.1
github.com/sergi/go-diff v1.3.1
github.com/shopspring/decimal v1.3.1
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/net v0.18.0
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb
golang.org/x/net v0.19.0
golang.org/x/text v0.14.0
)

Expand All @@ -33,8 +33,8 @@ require (
github.com/nyaruka/null/v2 v2.0.3 // indirect
github.com/nyaruka/phonenumbers v1.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE=
github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
Expand Down Expand Up @@ -71,14 +71,14 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb h1:c0vyKkb6yr3KR7jEfJaOSv4lG7xPkbN6r52aJz1d8a8=
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down

0 comments on commit cb23381

Please sign in to comment.