From 39f29c0a7f711dc3d77c847c89d4cecfffa682e5 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Tue, 20 Mar 2018 16:21:32 -0500 Subject: [PATCH 1/2] Restructure event output so that events aren't wrapped in log entries or nested under path steps --- cmd/docgen/run.go | 6 +- cmd/flowrunner/main.go | 14 +- cmd/flowrunner/runner_test.go | 4 +- .../testdata/flows/all_actions_test.json | 1042 +++++------ .../testdata/flows/brochure_test.json | 297 ++- .../testdata/flows/date_parse_test.json | 264 ++- .../testdata/flows/default_result_test.json | 285 ++- .../testdata/flows/dynamic_groups_test.json | 273 ++- cmd/flowrunner/testdata/flows/empty_test.json | 2 +- .../testdata/flows/no_contact_test.json | 101 +- .../testdata/flows/node_loop_test.json | 77 +- .../testdata/flows/subflow_loop_test.json | 186 +- .../testdata/flows/subflow_other_test.json | 1658 ++++++++--------- .../testdata/flows/subflow_test.json | 404 ++-- .../testdata/flows/triggered_test.json | 53 +- .../testdata/flows/two_questions_test.json | 566 +++--- .../testdata/flows/webhook_persists_test.json | 327 ++-- cmd/flowserver/config.go | 2 +- cmd/flowserver/server.go | 23 +- flows/engine/log.go | 54 - flows/engine/session.go | 15 +- flows/events/base.go | 8 +- flows/events/contact_urn_added.go | 2 +- flows/interfaces.go | 20 +- flows/runs/run.go | 36 +- flows/runs/step.go | 58 +- flows/waits/msg.go | 6 +- flows/waits/nothing.go | 2 +- flowserver.toml | 2 +- 29 files changed, 2728 insertions(+), 3059 deletions(-) delete mode 100644 flows/engine/log.go diff --git a/cmd/docgen/run.go b/cmd/docgen/run.go index ffe31da0e..0937d4e3d 100644 --- a/cmd/docgen/run.go +++ b/cmd/docgen/run.go @@ -117,10 +117,10 @@ func eventsForAction(actionJSON []byte) (json.RawMessage, error) { return nil, err } - eventLog := session.Log() + eventLog := session.Events() eventJSON := make([]json.RawMessage, len(eventLog)) - for i, logEntry := range eventLog { - typed, err := utils.EnvelopeFromTyped(logEntry.Event()) + for i, event := range eventLog { + typed, err := utils.EnvelopeFromTyped(event) if err != nil { return nil, err } diff --git a/cmd/flowrunner/main.go b/cmd/flowrunner/main.go index 90129e61b..3a0143f96 100644 --- a/cmd/flowrunner/main.go +++ b/cmd/flowrunner/main.go @@ -25,7 +25,7 @@ const ( type Output struct { Session json.RawMessage `json:"session"` - Log []json.RawMessage `json:"log"` + Log []json.RawMessage `json:"events"` } type FlowTest struct { @@ -47,7 +47,7 @@ func envelopesForEvents(events []flows.Event) []*utils.TypedEnvelope { return envelopes } -func marshalEventLog(eventLog []flows.LogEntry) []json.RawMessage { +func marshalEventLog(eventLog []flows.Event) []json.RawMessage { envelopes := make([]json.RawMessage, len(eventLog)) for i := range eventLog { envelope, err := json.Marshal(eventLog[i]) @@ -217,12 +217,12 @@ func main() { log.Fatal("Error marshalling output: ", err) } fmt.Printf("%s\n", outJSON) - outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Log())}) + outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Events())}) // print any msg_created events - for _, e := range session.Log() { - if e.Event().Type() == events.TypeMsgCreated { - fmt.Printf(">>> %s\n", e.Event().(*events.MsgCreatedEvent).Msg.Text()) + for _, event := range session.Events() { + if event.Type() == events.TypeMsgCreated { + fmt.Printf(">>> %s\n", event.(*events.MsgCreatedEvent).Msg.Text()) } } @@ -255,7 +255,7 @@ func main() { log.Fatal("Error marshalling output: ", err) } fmt.Printf("%s\n", outJSON) - outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Log())}) + outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Events())}) // write out our test file if *writePtr { diff --git a/cmd/flowrunner/runner_test.go b/cmd/flowrunner/runner_test.go index 2e726e428..614f84a9e 100644 --- a/cmd/flowrunner/runner_test.go +++ b/cmd/flowrunner/runner_test.go @@ -117,7 +117,7 @@ func runFlow(assetsFilename string, triggerEnvelope *utils.TypedEnvelope, caller if err != nil { return runResult{}, fmt.Errorf("Error marshalling output: %s", err) } - outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Log())}) + outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Events())}) session, err = engine.ReadSession(assetCache, engine.NewMockAssetServer(), outJSON) if err != nil { @@ -138,7 +138,7 @@ func runFlow(assetsFilename string, triggerEnvelope *utils.TypedEnvelope, caller if err != nil { return runResult{}, fmt.Errorf("Error marshalling output: %s", err) } - outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Log())}) + outputs = append(outputs, &Output{outJSON, marshalEventLog(session.Events())}) return runResult{assetCache, session, outputs}, nil } diff --git a/cmd/flowrunner/testdata/flows/all_actions_test.json b/cmd/flowrunner/testdata/flows/all_actions_test.json index 5930b677e..bcfe3ac9a 100644 --- a/cmd/flowrunner/testdata/flows/all_actions_test.json +++ b/cmd/flowrunner/testdata/flows/all_actions_test.json @@ -18,351 +18,275 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "ad154980-7bf7-4ab8-8728-545fd6378912", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", - "labels": [ - { - "name": "Spam", - "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" - }, - { - "name": "Azuay Messages", - "uuid": "b017c07a-d35b-4da4-8917-3bf8bff80168" - } - ], - "type": "input_labels_added" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", + "labels": [ + { + "name": "Spam", + "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" + }, + { + "name": "Azuay Messages", + "uuid": "b017c07a-d35b-4da4-8917-3bf8bff80168" + } + ], "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "ad154980-7bf7-4ab8-8728-545fd6378912", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "groups": [ - { - "name": "Survey Audience", - "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" - }, - { - "name": "Azuay State", - "uuid": "d7ff4872-9238-452f-9d38-2f558fea89e0" - } - ], - "type": "contact_groups_added" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ + { + "name": "Survey Audience", + "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" + }, + { + "name": "Azuay State", + "uuid": "d7ff4872-9238-452f-9d38-2f558fea89e0" + } + ], "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "ca5138c1-2a26-44c6-a29c-6ef695bc67ee", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "contact_urn_added", - "urn": "twitter:ben_haggerty" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "urn": "twitter:ben_haggerty" }, { - "action_uuid": "7bd8b3bf-0a3c-4928-bc46-df416e77ddf4", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "activation_token", - "label": "Activation Token" - }, - "type": "contact_field_changed", - "value": "XXX-YYY-ZZZ" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "activation_token", + "label": "Activation Token" }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "XXX-YYY-ZZZ" }, { - "action_uuid": "4f452fb8-f0aa-442d-865b-a2b629c09c21", - "event": { - "addresses": [ - "ben@macklemore", - "test@example.com" - ], - "body": "Hi Ben, Your activation token is XXX-YYY-ZZZ, your coupon is AAA-BBB-CCC", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "subject": "Here is your activation token", - "type": "email_created" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "addresses": [ + "ben@macklemore", + "test@example.com" + ], + "body": "Hi Ben, Your activation token is XXX-YYY-ZZZ, your coupon is AAA-BBB-CCC", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "subject": "Here is your activation token" }, { - "action_uuid": "9487a60e-a6ef-4a88-b35d-894bfe074144", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Collect Language", - "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Collect Language", + "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "3d8030d6-9ddd-472d-baed-d0393f592524", - "event": { - "contacts": [ - { - "name": "Bob", - "uuid": "820f5923-3369-41c6-b3cd-af577c0bd4b8" - } - ], - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Collect Language", - "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" - }, - "run": { - "contact": { - "fields": { - "activation_token": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "value": "XXX-YYY-ZZZ" - }, - "first_name": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "value": "Ben" - }, - "state": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "value": "Azuay" - } + "contacts": [ + { + "name": "Bob", + "uuid": "820f5923-3369-41c6-b3cd-af577c0bd4b8" + } + ], + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Collect Language", + "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" + }, + "run": { + "contact": { + "fields": { + "activation_token": { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "value": "XXX-YYY-ZZZ" }, - "groups": [ - { - "name": "Survey Audience", - "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" - } - ], - "language": "eng", - "name": "Ben Haggerty", - "timezone": "America/Guayaquil", - "urns": [ - "tel:+12065551212", - "facebook:1122334455667788", - "mailto:ben@macklemore", - "twitter:ben_haggerty" - ], - "uuid": "ba96bf7f-bc2a-4873-a7c7-254d1927c4e3" + "first_name": { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "value": "Ben" + }, + "state": { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "value": "Azuay" + } }, - "flow_uuid": "8ca44c09-791d-453a-9799-a70dd3303306", - "results": {}, - "status": "active", - "uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5" + "groups": [ + { + "name": "Survey Audience", + "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" + } + ], + "language": "eng", + "name": "Ben Haggerty", + "timezone": "America/Guayaquil", + "urns": [ + "tel:+12065551212", + "facebook:1122334455667788", + "mailto:ben@macklemore", + "twitter:ben_haggerty" + ], + "uuid": "ba96bf7f-bc2a-4873-a7c7-254d1927c4e3" }, - "type": "session_triggered" + "flow_uuid": "8ca44c09-791d-453a-9799-a70dd3303306", + "results": {}, + "status": "active", + "uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "ac110f56-a66c-4462-921c-b2c6d1c6dadb", - "event": { - "base_language": "eng", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "translations": { - "eng": { - "text": "Hi Ben Haggerty, are you ready?" - }, - "spa": { - "text": "Hola Ben Haggerty, ¿estás listo?" - } + "base_language": "eng", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "translations": { + "eng": { + "text": "Hi Ben Haggerty, are you ready?" }, - "type": "broadcast_created", - "urns": [ - "tel:+12065551212" - ] + "spa": { + "text": "Hola Ben Haggerty, ¿estás listo?" + } }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "urns": [ + "tel:+12065551212" + ] }, { - "action_uuid": "c0057fd9-be0a-43ea-91df-5c18e14f2c59", - "event": { - "base_language": "eng", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "groups": [ - { - "name": "Survey Audience", - "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" - } - ], - "translations": { - "eng": { - "attachments": [ - "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" - ], - "text": "Hi Ben Haggerty, are you ready for these attachments?" - }, - "spa": { - "attachments": [ - "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" - ], - "text": "Hi Ben Haggerty, are you ready for these attachments?" - } + "base_language": "eng", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ + { + "name": "Survey Audience", + "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" + } + ], + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "translations": { + "eng": { + "attachments": [ + "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" + ], + "text": "Hi Ben Haggerty, are you ready for these attachments?" }, - "type": "broadcast_created" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "spa": { + "attachments": [ + "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" + ], + "text": "Hi Ben Haggerty, are you ready for these attachments?" + } + } }, { - "action_uuid": "6d1346c0-48d8-4108-9c58-e45a1eb0ff7a", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "groups": [ - { - "name": "Survey Audience", - "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" - } - ], - "type": "contact_groups_removed" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ + { + "name": "Survey Audience", + "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" + } + ], "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "f01d693b-2af2-49fb-9e38-146eb00937e9", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty, are you ready to complete today's survey?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hi Ben Haggerty, are you ready to complete today's survey?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "d98c1e02-69df-4f95-8b89-8587a57ae0c3", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is a message to each of Ben Haggerty's urns.", - "urn": "tel:+12065551212", - "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "This is a message to each of Ben Haggerty's urns.", + "urn": "tel:+12065551212", + "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "d98c1e02-69df-4f95-8b89-8587a57ae0c3", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Facebook Channel", - "uuid": "4bb288a0-7fca-4da1-abe8-59a593aff648" - }, - "text": "This is a message to each of Ben Haggerty's urns.", - "urn": "facebook:1122334455667788", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Facebook Channel", + "uuid": "4bb288a0-7fca-4da1-abe8-59a593aff648" }, - "type": "msg_created" + "text": "This is a message to each of Ben Haggerty's urns.", + "urn": "facebook:1122334455667788", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "d98c1e02-69df-4f95-8b89-8587a57ae0c3", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Twitter Channel", - "uuid": "8e21f093-99aa-413b-b55b-758b54308fcb" - }, - "text": "This is a message to each of Ben Haggerty's urns.", - "urn": "twitter:ben_haggerty", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Twitter Channel", + "uuid": "8e21f093-99aa-413b-b55b-758b54308fcb" }, - "type": "msg_created" + "text": "This is a message to each of Ben Haggerty's urns.", + "urn": "twitter:ben_haggerty", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "62a30ab4-d73c-447d-a989-39c49115153e", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "attachments": [ - "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" - ], - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "quick_replies": [ - "Yes", - "No" - ], - "text": "This is a reply with attachments and quick replies", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "attachments": [ + "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" + ], + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "quick_replies": [ + "Yes", + "No" + ], + "text": "This is a reply with attachments and quick replies", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "5508e6a7-26ce-4b3b-b32e-bb4e2e614f5d", - "event": { - "category": "Male", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Gender", - "node_uuid": "a58be63b-907d-4a1a-856b-0bb5579d7507", - "type": "run_result_changed", - "value": "m" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "category": "Male", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Gender", + "node_uuid": "a58be63b-907d-4a1a-856b-0bb5579d7507", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "m" }, { - "action_uuid": "f3581032-e122-45ee-8be7-4f3c955d97f8", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "language", - "type": "contact_property_changed", - "value": "eng" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "language", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "eng" }, { - "action_uuid": "7bd8b3bf-0a3c-4928-bc46-df416e77ddf4", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "gender", - "label": "Gender" - }, - "type": "contact_field_changed", - "value": "Male" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "gender", + "label": "Gender" }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "Male" }, { - "action_uuid": "06153fbd-3e2c-413a-b0df-ed15d631835a", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", - "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", - "status": "success", - "status_code": 200, - "type": "webhook_called", - "url": "http://127.0.0.1:49999/?cmd=success" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", + "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", + "status": "success", + "status_code": 200, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "url": "http://127.0.0.1:49999/?cmd=success" } ], "session": { @@ -414,307 +338,327 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", - "exited_on": "2000-01-01T00:00:00.000000000-00:00", - "expires_on": "2000-01-01T00:00:00.000000000-00:00", - "flow_uuid": "8ca44c09-791d-453a-9799-a70dd3303306", - "input": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "text": "Ryan Lewis", - "type": "msg", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "path": [ + "events": [ { - "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Ryan Lewis", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", - "labels": [ - { - "name": "Spam", - "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" - }, - { - "name": "Azuay Messages", - "uuid": "b017c07a-d35b-4da4-8917-3bf8bff80168" - } - ], - "type": "input_labels_added" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "groups": [ - { - "name": "Survey Audience", - "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" - }, - { - "name": "Azuay State", - "uuid": "d7ff4872-9238-452f-9d38-2f558fea89e0" - } - ], - "type": "contact_groups_added" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, + "text": "Ryan Lewis", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_received" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", + "labels": [ { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "contact_urn_added", - "urn": "twitter:ben_haggerty" + "name": "Spam", + "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" }, { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "activation_token", - "label": "Activation Token" - }, - "type": "contact_field_changed", - "value": "XXX-YYY-ZZZ" - }, + "name": "Azuay Messages", + "uuid": "b017c07a-d35b-4da4-8917-3bf8bff80168" + } + ], + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "input_labels_added" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ { - "addresses": [ - "ben@macklemore", - "test@example.com" - ], - "body": "Hi Ben, Your activation token is XXX-YYY-ZZZ, your coupon is AAA-BBB-CCC", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "subject": "Here is your activation token", - "type": "email_created" + "name": "Survey Audience", + "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" }, { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Collect Language", - "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - }, + "name": "Azuay State", + "uuid": "d7ff4872-9238-452f-9d38-2f558fea89e0" + } + ], + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_groups_added" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_urn_added", + "urn": "twitter:ben_haggerty" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "activation_token", + "label": "Activation Token" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_field_changed", + "value": "XXX-YYY-ZZZ" + }, + { + "addresses": [ + "ben@macklemore", + "test@example.com" + ], + "body": "Hi Ben, Your activation token is XXX-YYY-ZZZ, your coupon is AAA-BBB-CCC", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "subject": "Here is your activation token", + "type": "email_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Collect Language", + "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "flow_triggered" + }, + { + "contacts": [ { - "contacts": [ - { - "name": "Bob", - "uuid": "820f5923-3369-41c6-b3cd-af577c0bd4b8" - } - ], - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Collect Language", - "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" - }, - "run": { - "contact": { - "fields": { - "activation_token": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "value": "XXX-YYY-ZZZ" - }, - "first_name": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "value": "Ben" - }, - "state": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "value": "Azuay" - } - }, - "groups": [ - { - "name": "Survey Audience", - "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" - } - ], - "language": "eng", - "name": "Ben Haggerty", - "timezone": "America/Guayaquil", - "urns": [ - "tel:+12065551212", - "facebook:1122334455667788", - "mailto:ben@macklemore", - "twitter:ben_haggerty" - ], - "uuid": "ba96bf7f-bc2a-4873-a7c7-254d1927c4e3" + "name": "Bob", + "uuid": "820f5923-3369-41c6-b3cd-af577c0bd4b8" + } + ], + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Collect Language", + "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d" + }, + "run": { + "contact": { + "fields": { + "activation_token": { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "value": "XXX-YYY-ZZZ" }, - "flow_uuid": "8ca44c09-791d-453a-9799-a70dd3303306", - "results": {}, - "status": "active", - "uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5" - }, - "type": "session_triggered" - }, - { - "base_language": "eng", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "translations": { - "eng": { - "text": "Hi Ben Haggerty, are you ready?" + "first_name": { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "value": "Ben" }, - "spa": { - "text": "Hola Ben Haggerty, ¿estás listo?" + "state": { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "value": "Azuay" } }, - "type": "broadcast_created", - "urns": [ - "tel:+12065551212" - ] - }, - { - "base_language": "eng", - "created_on": "2000-01-01T00:00:00.000000000-00:00", "groups": [ { "name": "Survey Audience", "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" } ], - "translations": { - "eng": { - "attachments": [ - "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" - ], - "text": "Hi Ben Haggerty, are you ready for these attachments?" - }, - "spa": { - "attachments": [ - "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" - ], - "text": "Hi Ben Haggerty, are you ready for these attachments?" - } - }, - "type": "broadcast_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "groups": [ - { - "name": "Survey Audience", - "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" - } + "language": "eng", + "name": "Ben Haggerty", + "timezone": "America/Guayaquil", + "urns": [ + "tel:+12065551212", + "facebook:1122334455667788", + "mailto:ben@macklemore", + "twitter:ben_haggerty" ], - "type": "contact_groups_removed" + "uuid": "ba96bf7f-bc2a-4873-a7c7-254d1927c4e3" }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty, are you ready to complete today's survey?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is a message to each of Ben Haggerty's urns.", - "urn": "tel:+12065551212", - "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" - }, - "type": "msg_created" + "flow_uuid": "8ca44c09-791d-453a-9799-a70dd3303306", + "results": {}, + "status": "active", + "uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "session_triggered" + }, + { + "base_language": "eng", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "translations": { + "eng": { + "text": "Hi Ben Haggerty, are you ready?" }, + "spa": { + "text": "Hola Ben Haggerty, ¿estás listo?" + } + }, + "type": "broadcast_created", + "urns": [ + "tel:+12065551212" + ] + }, + { + "base_language": "eng", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Facebook Channel", - "uuid": "4bb288a0-7fca-4da1-abe8-59a593aff648" - }, - "text": "This is a message to each of Ben Haggerty's urns.", - "urn": "facebook:1122334455667788", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" - }, - "type": "msg_created" + "name": "Survey Audience", + "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" + } + ], + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "translations": { + "eng": { + "attachments": [ + "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" + ], + "text": "Hi Ben Haggerty, are you ready for these attachments?" }, + "spa": { + "attachments": [ + "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" + ], + "text": "Hi Ben Haggerty, are you ready for these attachments?" + } + }, + "type": "broadcast_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Twitter Channel", - "uuid": "8e21f093-99aa-413b-b55b-758b54308fcb" - }, - "text": "This is a message to each of Ben Haggerty's urns.", - "urn": "twitter:ben_haggerty", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" + "name": "Survey Audience", + "uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817" + } + ], + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_groups_removed" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "attachments": [ - "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" - ], - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "quick_replies": [ - "Yes", - "No" - ], - "text": "This is a reply with attachments and quick replies", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" - }, - "type": "msg_created" + "text": "Hi Ben Haggerty, are you ready to complete today's survey?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - { - "category": "Male", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Gender", - "node_uuid": "a58be63b-907d-4a1a-856b-0bb5579d7507", - "type": "run_result_changed", - "value": "m" + "text": "This is a message to each of Ben Haggerty's urns.", + "urn": "tel:+12065551212", + "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Facebook Channel", + "uuid": "4bb288a0-7fca-4da1-abe8-59a593aff648" }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "language", - "type": "contact_property_changed", - "value": "eng" + "text": "This is a message to each of Ben Haggerty's urns.", + "urn": "facebook:1122334455667788", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Twitter Channel", + "uuid": "8e21f093-99aa-413b-b55b-758b54308fcb" }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "gender", - "label": "Gender" - }, - "type": "contact_field_changed", - "value": "Male" + "text": "This is a message to each of Ben Haggerty's urns.", + "urn": "twitter:ben_haggerty", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "attachments": [ + "image/jpeg:http://s3.amazon.com/bucket/test_en.jpg?a=Azuay" + ], + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", - "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", - "status": "success", - "status_code": 200, - "type": "webhook_called", - "url": "http://127.0.0.1:49999/?cmd=success" - } - ], + "quick_replies": [ + "Yes", + "No" + ], + "text": "This is a reply with attachments and quick replies", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "category": "Male", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Gender", + "node_uuid": "a58be63b-907d-4a1a-856b-0bb5579d7507", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "run_result_changed", + "value": "m" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "language", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_property_changed", + "value": "eng" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "gender", + "label": "Gender" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_field_changed", + "value": "Male" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", + "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", + "status": "success", + "status_code": 200, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "webhook_called", + "url": "http://127.0.0.1:49999/?cmd=success" + } + ], + "exited_on": "2000-01-01T00:00:00.000000000-00:00", + "expires_on": "2000-01-01T00:00:00.000000000-00:00", + "flow_uuid": "8ca44c09-791d-453a-9799-a70dd3303306", + "input": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "text": "Ryan Lewis", + "type": "msg", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "path": [ + { + "arrived_on": "2000-01-01T00:00:00.000000000-00:00", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "a58be63b-907d-4a1a-856b-0bb5579d7507", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" diff --git a/cmd/flowrunner/testdata/flows/brochure_test.json b/cmd/flowrunner/testdata/flows/brochure_test.json index 84bfc602e..041b24260 100644 --- a/cmd/flowrunner/testdata/flows/brochure_test.json +++ b/cmd/flowrunner/testdata/flows/brochure_test.json @@ -19,31 +19,24 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "9d9290a7-3713-4c22-8821-4af0a64c0821", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi! What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hi! What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00" } ], "session": { @@ -79,27 +72,34 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi! What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "25a2d8b2-ae7c-4fed-964a-506fb8c3f0c0", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi! What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "2d481ce6-efcf-4898-a825-f76208e32f2a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "32bc60ad-5c86-465e-a6b8-049c44ecce49", @@ -107,13 +107,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "3dcccbb4-d29c-41dd-a01f-16d814c9ab82", "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" } @@ -167,57 +160,42 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Name", - "node_uuid": "3dcccbb4-d29c-41dd-a01f-16d814c9ab82", - "operand": "Ryan Lewis", - "type": "run_result_changed", - "value": "Ryan Lewis" - }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "category": "", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Name", + "node_uuid": "3dcccbb4-d29c-41dd-a01f-16d814c9ab82", + "operand": "Ryan Lewis", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "value": "Ryan Lewis" }, { - "action_uuid": "455ba297-f6d2-45e6-bf3e-c1ef028b55ae", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "name", - "type": "contact_property_changed", - "value": "Ryan Lewis" - }, - "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "name", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "value": "Ryan Lewis" }, { - "action_uuid": "b3fa763e-474b-49df-b4d6-15e86507668f", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "groups": [ - { - "name": "Registered Users", - "uuid": "7be2f40b-38a0-4b06-9e6d-522dca592cc8" - } - ], - "type": "contact_groups_added" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ + { + "name": "Registered Users", + "uuid": "7be2f40b-38a0-4b06-9e6d-522dca592cc8" + } + ], "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, { - "action_uuid": "605e3486-503d-481c-94f7-cd553f196a8a", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Great, you are Ryan Lewis, thanks for joining!", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Great, you are Ryan Lewis, thanks for joining!", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" }, "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" } @@ -261,6 +239,84 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi! What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Ryan Lewis", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_received" + }, + { + "category": "", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Name", + "node_uuid": "3dcccbb4-d29c-41dd-a01f-16d814c9ab82", + "operand": "Ryan Lewis", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "run_result_changed", + "value": "Ryan Lewis" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "name", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "contact_property_changed", + "value": "Ryan Lewis" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "groups": [ + { + "name": "Registered Users", + "uuid": "7be2f40b-38a0-4b06-9e6d-522dca592cc8" + } + ], + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "contact_groups_added" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Great, you are Ryan Lewis, thanks for joining!", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "25a2d8b2-ae7c-4fed-964a-506fb8c3f0c0", @@ -278,21 +334,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi! What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "2d481ce6-efcf-4898-a825-f76208e32f2a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "32bc60ad-5c86-465e-a6b8-049c44ecce49", @@ -300,35 +341,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Ryan Lewis", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Name", - "node_uuid": "3dcccbb4-d29c-41dd-a01f-16d814c9ab82", - "operand": "Ryan Lewis", - "type": "run_result_changed", - "value": "Ryan Lewis" - } - ], "exit_uuid": "37d8813f-1402-4ad2-9cc2-e9054a96525b", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "3dcccbb4-d29c-41dd-a01f-16d814c9ab82", @@ -336,37 +348,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "name", - "type": "contact_property_changed", - "value": "Ryan Lewis" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "groups": [ - { - "name": "Registered Users", - "uuid": "7be2f40b-38a0-4b06-9e6d-522dca592cc8" - } - ], - "type": "contact_groups_added" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Great, you are Ryan Lewis, thanks for joining!", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" - } - ], "exit_uuid": "388bbce3-8079-4573-922f-8dea469d93f3", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7acb54fd-0db0-40b9-970b-93f7bfb4277b", diff --git a/cmd/flowrunner/testdata/flows/date_parse_test.json b/cmd/flowrunner/testdata/flows/date_parse_test.json index cfd0c802e..cce6bd81c 100644 --- a/cmd/flowrunner/testdata/flows/date_parse_test.json +++ b/cmd/flowrunner/testdata/flows/date_parse_test.json @@ -19,31 +19,24 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "e97cd6d5-3354-4dbd-85bc-6c1f87849eec", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty! When were you born, enter in format yyyy.MM.dd", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hi Ben Haggerty! When were you born, enter in format yyyy.MM.dd", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00" } ], "session": { @@ -79,32 +72,34 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi Ben Haggerty! When were you born, enter in format yyyy.MM.dd", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "615b8a0f-588c-4d20-a05f-363b0b4ce6f4", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty! When were you born, enter in format yyyy.MM.dd", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" } @@ -158,46 +153,35 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "Valid", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Birth Date", - "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", - "operand": "I was born on 1977.06.23 at 3:34 pm", - "type": "run_result_changed", - "value": "1977-06-23T15:34:00.000000-05:00" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "category": "Valid", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Birth Date", + "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", + "operand": "I was born on 1977.06.23 at 3:34 pm", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "1977-06-23T15:34:00.000000-05:00" }, { - "action_uuid": "afd5ac22-2a86-4576-a2c7-715f0bb10194", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "birth_date", - "label": "Birth Date" - }, - "type": "contact_field_changed", - "value": "1977-06-23T15:34:00.000000-05:00" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "birth_date", + "label": "Birth Date" }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "value": "1977-06-23T15:34:00.000000-05:00" }, { - "action_uuid": "d2a4052a-3fa9-4608-ab3e-5b9631440447", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Awesome, you were born on 06-23-1977 at 15:34", - "urn": "tel:+12065551212", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Awesome, you were born on 06-23-1977 at 15:34", + "urn": "tel:+12065551212", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" } @@ -239,6 +223,76 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi Ben Haggerty! When were you born, enter in format yyyy.MM.dd", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "I was born on 1977.06.23 at 3:34 pm", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_received" + }, + { + "category": "Valid", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Birth Date", + "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", + "operand": "I was born on 1977.06.23 at 3:34 pm", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "run_result_changed", + "value": "1977-06-23T15:34:00.000000-05:00" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "birth_date", + "label": "Birth Date" + }, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "contact_field_changed", + "value": "1977-06-23T15:34:00.000000-05:00" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Awesome, you were born on 06-23-1977 at 15:34", + "urn": "tel:+12065551212", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + }, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "615b8a0f-588c-4d20-a05f-363b0b4ce6f4", @@ -256,48 +310,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty! When were you born, enter in format yyyy.MM.dd", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "I was born on 1977.06.23 at 3:34 pm", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Valid", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Birth Date", - "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", - "operand": "I was born on 1977.06.23 at 3:34 pm", - "type": "run_result_changed", - "value": "1977-06-23T15:34:00.000000-05:00" - } - ], "exit_uuid": "598ae7a5-2f81-48f1-afac-595262514aa1", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", @@ -305,30 +317,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "birth_date", - "label": "Birth Date" - }, - "type": "contact_field_changed", - "value": "1977-06-23T15:34:00.000000-05:00" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Awesome, you were born on 06-23-1977 at 15:34", - "urn": "tel:+12065551212", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" - }, - "type": "msg_created" - } - ], "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "11a772f3-3ca2-4429-8b33-20fdcfc2b69e", "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" diff --git a/cmd/flowrunner/testdata/flows/default_result_test.json b/cmd/flowrunner/testdata/flows/default_result_test.json index b1d5b7896..4f22e3f07 100644 --- a/cmd/flowrunner/testdata/flows/default_result_test.json +++ b/cmd/flowrunner/testdata/flows/default_result_test.json @@ -19,29 +19,22 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "d3cd8da7-55f2-4bd3-9a0c-efc93c99e498", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" } ], @@ -76,27 +69,33 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "c37ae862-4802-447a-a783-1fe029a170e9", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "19f677bf-2b34-48bd-8a05-3839191b51b2", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "4fd923cc-b39f-4722-b1ea-22ce1ef388de", @@ -104,12 +103,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "3a430844-e259-4dcd-9a1d-7bef3168d43f", "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" } @@ -154,56 +147,41 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "All Responses", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Contact Name", - "node_uuid": "3a430844-e259-4dcd-9a1d-7bef3168d43f", - "operand": "Ryan Lewis", - "type": "run_result_changed", - "value": "Ryan Lewis" - }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "category": "All Responses", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Contact Name", + "node_uuid": "3a430844-e259-4dcd-9a1d-7bef3168d43f", + "operand": "Ryan Lewis", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "value": "Ryan Lewis" }, { - "action_uuid": "aafb505c-603d-4025-864d-471345ed236d", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "name", - "type": "contact_property_changed", - "value": "Ryan Lewis" - }, - "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "name", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "value": "Ryan Lewis" }, { - "action_uuid": "aafb505c-603d-4025-864d-471345ed237d", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "first_name", - "label": "First Name" - }, - "type": "contact_field_changed", - "value": "Ryan" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "first_name", + "label": "First Name" }, - "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "value": "Ryan" }, { - "action_uuid": "aafb505c-603d-4025-864d-471345ed237d", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Great, pleased to meet you Ryan", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Great, pleased to meet you Ryan", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" }, "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" } @@ -239,6 +217,82 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Ryan Lewis", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_received" + }, + { + "category": "All Responses", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Contact Name", + "node_uuid": "3a430844-e259-4dcd-9a1d-7bef3168d43f", + "operand": "Ryan Lewis", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "run_result_changed", + "value": "Ryan Lewis" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "name", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "contact_property_changed", + "value": "Ryan Lewis" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "first_name", + "label": "First Name" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "contact_field_changed", + "value": "Ryan" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Great, pleased to meet you Ryan", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "c37ae862-4802-447a-a783-1fe029a170e9", @@ -256,21 +310,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "19f677bf-2b34-48bd-8a05-3839191b51b2", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "4fd923cc-b39f-4722-b1ea-22ce1ef388de", @@ -278,34 +317,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Ryan Lewis", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "All Responses", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Contact Name", - "node_uuid": "3a430844-e259-4dcd-9a1d-7bef3168d43f", - "operand": "Ryan Lewis", - "type": "run_result_changed", - "value": "Ryan Lewis" - } - ], "exit_uuid": "cf9a2465-049a-4ba1-95ed-eb60fb45fd63", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "3a430844-e259-4dcd-9a1d-7bef3168d43f", @@ -313,36 +324,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "name", - "type": "contact_property_changed", - "value": "Ryan Lewis" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "first_name", - "label": "First Name" - }, - "type": "contact_field_changed", - "value": "Ryan" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Great, pleased to meet you Ryan", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" - } - ], "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "2929d2fc-2778-4d98-a4bc-73a7345710b0", "uuid": "5802813d-6c58-4292-8228-9728778b6c98" diff --git a/cmd/flowrunner/testdata/flows/dynamic_groups_test.json b/cmd/flowrunner/testdata/flows/dynamic_groups_test.json index 656c60dc4..17f3ddb5f 100644 --- a/cmd/flowrunner/testdata/flows/dynamic_groups_test.json +++ b/cmd/flowrunner/testdata/flows/dynamic_groups_test.json @@ -4,103 +4,75 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "7bd8b3bf-0a3c-4928-bc46-df416e77ddf4", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "gender", - "label": "Gender" - }, - "type": "contact_field_changed", - "value": "MALE" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "gender", + "label": "Gender" }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "MALE" }, { - "action_uuid": "ee4cd27e-1296-40fd-ac9c-8cd43e9fb8b5", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "age", - "label": "Age" - }, - "type": "contact_field_changed", - "value": "64" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "age", + "label": "Age" }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "64" }, { - "action_uuid": "f01d693b-2af2-49fb-9e38-146eb00937e9", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Current groups: Males, Old Men", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Current groups: Males, Old Men", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "bc94b3ba-4aad-410a-ae71-1861f69da0fe", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "contact_urn_added", - "urn": "tel:+250781234567" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "urn": "tel:+250781234567" }, { - "action_uuid": "5bc4894f-9ef4-430e-a040-e688fd2dd578", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Current groups: Males, Old Men", - "urn": "tel:+12065551212", - "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Current groups: Males, Old Men", + "urn": "tel:+12065551212", + "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "4ecf6abd-e8c8-424b-aef6-e904cf5b4fbe", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "age", - "label": "Age" - }, - "type": "contact_field_changed", - "value": "17" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "age", + "label": "Age" }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "17" }, { - "action_uuid": "279b0215-c9d5-4a90-b7df-f371812bcc78", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Current groups: Males, Youth, MTN Callers", - "urn": "tel:+12065551212", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Current groups: Males, Youth, MTN Callers", + "urn": "tel:+12065551212", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" } @@ -159,85 +131,92 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "gender", + "label": "Gender" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_field_changed", + "value": "MALE" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "age", + "label": "Age" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_field_changed", + "value": "64" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Current groups: Males, Old Men", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_urn_added", + "urn": "tel:+250781234567" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Current groups: Males, Old Men", + "urn": "tel:+12065551212", + "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "field": { + "key": "age", + "label": "Age" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "contact_field_changed", + "value": "17" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Current groups: Males, Youth, MTN Callers", + "urn": "tel:+12065551212", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "1b462ce8-983a-4393-b133-e15a0efdb70c", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "gender", - "label": "Gender" - }, - "type": "contact_field_changed", - "value": "MALE" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "age", - "label": "Age" - }, - "type": "contact_field_changed", - "value": "64" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Current groups: Males, Old Men", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "contact_urn_added", - "urn": "tel:+250781234567" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Current groups: Males, Old Men", - "urn": "tel:+12065551212", - "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "field": { - "key": "age", - "label": "Age" - }, - "type": "contact_field_changed", - "value": "17" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Current groups: Males, Youth, MTN Callers", - "urn": "tel:+12065551212", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" - }, - "type": "msg_created" - } - ], "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "a58be63b-907d-4a1a-856b-0bb5579d7507", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" diff --git a/cmd/flowrunner/testdata/flows/empty_test.json b/cmd/flowrunner/testdata/flows/empty_test.json index dd9f831f3..039b72e34 100644 --- a/cmd/flowrunner/testdata/flows/empty_test.json +++ b/cmd/flowrunner/testdata/flows/empty_test.json @@ -4,7 +4,7 @@ ], "outputs": [ { - "log": [], + "events": [], "session": { "contact": { "fields": { diff --git a/cmd/flowrunner/testdata/flows/no_contact_test.json b/cmd/flowrunner/testdata/flows/no_contact_test.json index 18bf6ae0a..64181b6a7 100644 --- a/cmd/flowrunner/testdata/flows/no_contact_test.json +++ b/cmd/flowrunner/testdata/flows/no_contact_test.json @@ -18,31 +18,23 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "ad154980-7bf7-4ab8-8728-545fd6378912", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", - "labels": [ - { - "name": "Spam", - "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" - } - ], - "type": "input_labels_added" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", + "labels": [ + { + "name": "Spam", + "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" + } + ], "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "ad154980-7bf7-4ab8-8728-545fd6378912", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "can't execute action in session without a contact", - "type": "error" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "text": "can't execute action in session without a contact" } ], "session": { @@ -57,6 +49,41 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Ryan Lewis", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_received" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", + "labels": [ + { + "name": "Spam", + "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" + } + ], + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "input_labels_added" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "text": "can't execute action in session without a contact", + "type": "error" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "8ca44c09-791d-453a-9799-a70dd3303306", @@ -74,38 +101,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Ryan Lewis", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "input_uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5", - "labels": [ - { - "name": "Spam", - "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea" - } - ], - "type": "input_labels_added" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "can't execute action in session without a contact", - "type": "error" - } - ], "node_uuid": "a58be63b-907d-4a1a-856b-0bb5579d7507", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" } diff --git a/cmd/flowrunner/testdata/flows/node_loop_test.json b/cmd/flowrunner/testdata/flows/node_loop_test.json index c5151d11c..3f3fc5771 100644 --- a/cmd/flowrunner/testdata/flows/node_loop_test.json +++ b/cmd/flowrunner/testdata/flows/node_loop_test.json @@ -4,32 +4,25 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "9d9290a7-3713-4c22-8821-4af0a64c0821", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi! What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hi! What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "flow loop detected, stopping execution before entering '32bc60ad-5c86-465e-a6b8-049c44ecce49'", - "type": "error" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "text": "flow loop detected, stopping execution before entering '32bc60ad-5c86-465e-a6b8-049c44ecce49'" } ], "session": { @@ -65,33 +58,35 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi! What is your name?", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "text": "flow loop detected, stopping execution before entering '32bc60ad-5c86-465e-a6b8-049c44ecce49'", + "type": "error" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "25a2d8b2-ae7c-4fed-964a-506fb8c3f0c0", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi! What is your name?", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "flow loop detected, stopping execution before entering '32bc60ad-5c86-465e-a6b8-049c44ecce49'", - "type": "error" - } - ], "exit_uuid": "2d481ce6-efcf-4898-a825-f76208e32f2a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "32bc60ad-5c86-465e-a6b8-049c44ecce49", diff --git a/cmd/flowrunner/testdata/flows/subflow_loop_test.json b/cmd/flowrunner/testdata/flows/subflow_loop_test.json index 6ed05cbbf..04614ffc4 100644 --- a/cmd/flowrunner/testdata/flows/subflow_loop_test.json +++ b/cmd/flowrunner/testdata/flows/subflow_loop_test.json @@ -4,72 +4,53 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "49f6c984-620f-4d9b-98c4-8ead1d1ef4f6", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the parent flow", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "This is the parent flow", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "300f02ba-e0b5-4991-bed6-4c240cdb8743", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Child Flow", - "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Child Flow", + "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "e5a03dde-3b2f-4603-b5d0-d927f6bcc361", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the child flow", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "This is the child flow", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" }, "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, { - "action_uuid": "a25014c5-aaa5-47d7-9376-429f317360f1", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "flow loop detected, stopping execution before starting flow: 76f0a02f-3b75-4b86-9064-e9195e1b3a02", - "type": "error" - }, - "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "text": "flow loop detected, stopping execution before starting flow: 76f0a02f-3b75-4b86-9064-e9195e1b3a02" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "child run for flow 'a8d27b94-d3d0-4a96-8074-0f162f342195' ended in error, ending execution", - "type": "error" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "text": "child run for flow 'a8d27b94-d3d0-4a96-8074-0f162f342195' ended in error, ending execution" } ], "session": { @@ -105,42 +86,45 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "This is the parent flow", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Child Flow", + "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "flow_triggered" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "text": "child run for flow 'a8d27b94-d3d0-4a96-8074-0f162f342195' ended in error, ending execution", + "type": "error" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "76f0a02f-3b75-4b86-9064-e9195e1b3a02", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the parent flow", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Child Flow", - "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "child run for flow 'a8d27b94-d3d0-4a96-8074-0f162f342195' ended in error, ending execution", - "type": "error" - } - ], "node_uuid": "e97a43c1-a15b-4566-bb6d-dfd2b18408e1", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" } @@ -150,6 +134,29 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "This is the child flow", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "fatal": true, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "text": "flow loop detected, stopping execution before starting flow: 76f0a02f-3b75-4b86-9064-e9195e1b3a02", + "type": "error" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195", @@ -157,27 +164,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the child flow", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "fatal": true, - "text": "flow loop detected, stopping execution before starting flow: 76f0a02f-3b75-4b86-9064-e9195e1b3a02", - "type": "error" - } - ], "node_uuid": "9f7632ee-6e35-4247-9235-c4c7663fd601", "uuid": "5802813d-6c58-4292-8228-9728778b6c98" } diff --git a/cmd/flowrunner/testdata/flows/subflow_other_test.json b/cmd/flowrunner/testdata/flows/subflow_other_test.json index 373dc4da9..9ac7ed28a 100644 --- a/cmd/flowrunner/testdata/flows/subflow_other_test.json +++ b/cmd/flowrunner/testdata/flows/subflow_other_test.json @@ -64,59 +64,44 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "ac403443-4e93-4127-8b03-469598cd7ae2", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi there, let's go to the child.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hi there, let's go to the child.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "87635c69-61e0-4a06-b967-6f8f7b930806", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Rules", - "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Rules", + "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" }, { - "action_uuid": "9b3d32d4-aa6c-44e0-95cd-92117c67738f", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Welcome to the child, say yes or no!", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Welcome to the child, say yes or no!", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" }, "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" } ], @@ -153,27 +138,38 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi there, let's go to the child.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Rules", + "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "flow_triggered" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "9e43da00-b2e5-450e-a351-0772f5469511", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi there, let's go to the child.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "e0db9dfe-28b1-4be0-9042-9cfcf651e8c9", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9166f3f9-da13-41c9-8346-44802a73cbdf", @@ -181,17 +177,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Rules", - "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - } - ], "node_uuid": "bf7accaf-70ce-4b87-9c23-c7bc02e3c06f", "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" } @@ -201,6 +186,27 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Welcome to the child, say yes or no!", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + }, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8", @@ -208,21 +214,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Welcome to the child, say yes or no!", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" - }, - "type": "msg_created" - } - ], "exit_uuid": "f84a4e1c-a1ba-4059-9218-52987ebd979a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "8a9101ba-d8a9-43ef-a926-7e050d188937", @@ -230,12 +221,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", "uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" } @@ -288,41 +273,31 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "neither", - "type": "run_result_changed", - "value": "neither" - }, - "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "neither", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "value": "neither" }, { - "action_uuid": "ef6b42af-9751-4120-972c-e60771904dd2", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither.", - "urn": "tel:+12065551212", - "uuid": "b88ce93d-4360-4455-a691-235cbe720980" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Nope, that's neither.", + "urn": "tel:+12065551212", + "uuid": "b88ce93d-4360-4455-a691-235cbe720980" }, "step_uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c" } ], @@ -359,27 +334,38 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi there, let's go to the child.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Rules", + "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "flow_triggered" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "9e43da00-b2e5-450e-a351-0772f5469511", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi there, let's go to the child.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "e0db9dfe-28b1-4be0-9042-9cfcf651e8c9", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9166f3f9-da13-41c9-8346-44802a73cbdf", @@ -387,17 +373,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Rules", - "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - } - ], "node_uuid": "bf7accaf-70ce-4b87-9c23-c7bc02e3c06f", "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" } @@ -407,6 +382,70 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Welcome to the child, say yes or no!", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + }, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "neither", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_received" + }, + { + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "neither", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "run_result_changed", + "value": "neither" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Nope, that's neither.", + "urn": "tel:+12065551212", + "uuid": "b88ce93d-4360-4455-a691-235cbe720980" + }, + "step_uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8", @@ -425,21 +464,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Welcome to the child, say yes or no!", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" - }, - "type": "msg_created" - } - ], "exit_uuid": "f84a4e1c-a1ba-4059-9218-52987ebd979a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "8a9101ba-d8a9-43ef-a926-7e050d188937", @@ -447,34 +471,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "neither", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "neither", - "type": "run_result_changed", - "value": "neither" - } - ], "exit_uuid": "47f7e70f-f7a5-4a24-a6cd-4853ef07487d", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", @@ -482,21 +478,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither.", - "urn": "tel:+12065551212", - "uuid": "b88ce93d-4360-4455-a691-235cbe720980" - }, - "type": "msg_created" - } - ], "exit_uuid": "6a4cbb55-7936-4c98-958b-eba1866a596e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "4ff04e17-96d0-4920-8920-8d4d5fb2ae17", @@ -504,12 +485,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", "uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c" } @@ -572,58 +547,44 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "Yes", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "yes", - "type": "run_result_changed", - "value": "yes" - }, - "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c" + "category": "Yes", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "yes", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "value": "yes" }, { - "action_uuid": "7d17e71a-2967-4dbb-86a4-eda028aca38a", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "You said yes", - "urn": "tel:+12065551212", - "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "You said yes", + "urn": "tel:+12065551212", + "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" }, "step_uuid": "4f15f627-b1e2-4851-8dbf-00ecf5d03034" }, { - "action_uuid": "54b10283-9863-4edf-abfa-705cf24a64fc", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hooray, you did it and said yes. Say yes or no!", - "urn": "tel:+12065551212", - "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hooray, you did it and said yes. Say yes or no!", + "urn": "tel:+12065551212", + "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" }, "step_uuid": "688e64f9-2456-4b42-afcb-91a2073e5459" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae" } ], @@ -660,27 +621,57 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi there, let's go to the child.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Rules", + "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "flow_triggered" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hooray, you did it and said yes. Say yes or no!", + "urn": "tel:+12065551212", + "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" + }, + "step_uuid": "688e64f9-2456-4b42-afcb-91a2073e5459", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "9e43da00-b2e5-450e-a351-0772f5469511", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi there, let's go to the child.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "e0db9dfe-28b1-4be0-9042-9cfcf651e8c9", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9166f3f9-da13-41c9-8346-44802a73cbdf", @@ -688,17 +679,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Rules", - "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - } - ], "exit_uuid": "f68d80e5-651c-404a-bbc0-efa6966254a6", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "bf7accaf-70ce-4b87-9c23-c7bc02e3c06f", @@ -706,21 +686,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hooray, you did it and said yes. Say yes or no!", - "urn": "tel:+12065551212", - "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" - }, - "type": "msg_created" - } - ], "exit_uuid": "2a67e061-c7da-42f7-91e5-32c8a9591020", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "70af8b8f-9caf-4af9-8e03-5686beb9336f", @@ -728,12 +693,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", "uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae" } @@ -743,6 +702,108 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Welcome to the child, say yes or no!", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + }, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "neither", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_received" + }, + { + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "neither", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "run_result_changed", + "value": "neither" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Nope, that's neither.", + "urn": "tel:+12065551212", + "uuid": "b88ce93d-4360-4455-a691-235cbe720980" + }, + "step_uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "yes", + "urn": "tel:+12065551212", + "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" + }, + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "msg_received" + }, + { + "category": "Yes", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "yes", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "run_result_changed", + "value": "yes" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "You said yes", + "urn": "tel:+12065551212", + "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" + }, + "step_uuid": "4f15f627-b1e2-4851-8dbf-00ecf5d03034", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8", @@ -761,21 +822,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Welcome to the child, say yes or no!", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" - }, - "type": "msg_created" - } - ], "exit_uuid": "f84a4e1c-a1ba-4059-9218-52987ebd979a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "8a9101ba-d8a9-43ef-a926-7e050d188937", @@ -783,34 +829,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "neither", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "neither", - "type": "run_result_changed", - "value": "neither" - } - ], "exit_uuid": "47f7e70f-f7a5-4a24-a6cd-4853ef07487d", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", @@ -818,21 +836,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither.", - "urn": "tel:+12065551212", - "uuid": "b88ce93d-4360-4455-a691-235cbe720980" - }, - "type": "msg_created" - } - ], "exit_uuid": "6a4cbb55-7936-4c98-958b-eba1866a596e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "4ff04e17-96d0-4920-8920-8d4d5fb2ae17", @@ -840,34 +843,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "yes", - "urn": "tel:+12065551212", - "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" - }, - "type": "msg_received" - }, - { - "category": "Yes", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "yes", - "type": "run_result_changed", - "value": "yes" - } - ], "exit_uuid": "49caa88e-95b2-4ee2-beef-8db17a829c61", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", @@ -875,21 +850,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "You said yes", - "urn": "tel:+12065551212", - "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" - }, - "type": "msg_created" - } - ], "exit_uuid": "8df047e3-465e-4d3c-a332-25b62aacdefb", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9b53d684-62a6-4f25-900c-268f762b192e", @@ -954,41 +914,31 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", - "operand": "never", - "type": "run_result_changed", - "value": "never" - }, - "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae" + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", + "operand": "never", + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "value": "never" }, { - "action_uuid": "27442755-3d94-499f-97d5-a9409ab83b67", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither", - "urn": "tel:+12065551212", - "uuid": "b504fe9e-d8a8-47fd-af9c-ff2f1faac4db" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Nope, that's neither", + "urn": "tel:+12065551212", + "uuid": "b504fe9e-d8a8-47fd-af9c-ff2f1faac4db" }, "step_uuid": "27b67219-e599-4697-b62c-3c781ca3b5da" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", "step_uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005" } ], @@ -1025,6 +975,94 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi there, let's go to the child.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Rules", + "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "flow_triggered" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hooray, you did it and said yes. Say yes or no!", + "urn": "tel:+12065551212", + "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" + }, + "step_uuid": "688e64f9-2456-4b42-afcb-91a2073e5459", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "never", + "urn": "tel:+12065551212", + "uuid": "3dcbe073-60ad-4104-9d4d-e4330f6d8ba1" + }, + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "type": "msg_received" + }, + { + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", + "operand": "never", + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "type": "run_result_changed", + "value": "never" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Nope, that's neither", + "urn": "tel:+12065551212", + "uuid": "b504fe9e-d8a8-47fd-af9c-ff2f1faac4db" + }, + "step_uuid": "27b67219-e599-4697-b62c-3c781ca3b5da", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "9e43da00-b2e5-450e-a351-0772f5469511", @@ -1042,21 +1080,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi there, let's go to the child.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "e0db9dfe-28b1-4be0-9042-9cfcf651e8c9", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9166f3f9-da13-41c9-8346-44802a73cbdf", @@ -1064,17 +1087,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Rules", - "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - } - ], "exit_uuid": "f68d80e5-651c-404a-bbc0-efa6966254a6", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "bf7accaf-70ce-4b87-9c23-c7bc02e3c06f", @@ -1082,21 +1094,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hooray, you did it and said yes. Say yes or no!", - "urn": "tel:+12065551212", - "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" - }, - "type": "msg_created" - } - ], "exit_uuid": "2a67e061-c7da-42f7-91e5-32c8a9591020", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "70af8b8f-9caf-4af9-8e03-5686beb9336f", @@ -1104,34 +1101,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "never", - "urn": "tel:+12065551212", - "uuid": "3dcbe073-60ad-4104-9d4d-e4330f6d8ba1" - }, - "type": "msg_received" - }, - { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", - "operand": "never", - "type": "run_result_changed", - "value": "never" - } - ], "exit_uuid": "3e3a8051-da19-495a-b0ad-69b11e2158f7", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", @@ -1139,21 +1108,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither", - "urn": "tel:+12065551212", - "uuid": "b504fe9e-d8a8-47fd-af9c-ff2f1faac4db" - }, - "type": "msg_created" - } - ], "exit_uuid": "4ff58def-89e7-4c52-bda7-ebea0ee5176e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "c6e9b298-77bc-4d4c-91b6-43fa18338742", @@ -1161,12 +1115,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", "uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005" } @@ -1186,6 +1134,108 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Welcome to the child, say yes or no!", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + }, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "neither", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_received" + }, + { + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "neither", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "run_result_changed", + "value": "neither" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Nope, that's neither.", + "urn": "tel:+12065551212", + "uuid": "b88ce93d-4360-4455-a691-235cbe720980" + }, + "step_uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "yes", + "urn": "tel:+12065551212", + "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" + }, + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "msg_received" + }, + { + "category": "Yes", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "yes", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "run_result_changed", + "value": "yes" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "You said yes", + "urn": "tel:+12065551212", + "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" + }, + "step_uuid": "4f15f627-b1e2-4851-8dbf-00ecf5d03034", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8", @@ -1204,21 +1254,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Welcome to the child, say yes or no!", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" - }, - "type": "msg_created" - } - ], "exit_uuid": "f84a4e1c-a1ba-4059-9218-52987ebd979a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "8a9101ba-d8a9-43ef-a926-7e050d188937", @@ -1226,34 +1261,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "neither", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "neither", - "type": "run_result_changed", - "value": "neither" - } - ], "exit_uuid": "47f7e70f-f7a5-4a24-a6cd-4853ef07487d", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", @@ -1261,21 +1268,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither.", - "urn": "tel:+12065551212", - "uuid": "b88ce93d-4360-4455-a691-235cbe720980" - }, - "type": "msg_created" - } - ], "exit_uuid": "6a4cbb55-7936-4c98-958b-eba1866a596e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "4ff04e17-96d0-4920-8920-8d4d5fb2ae17", @@ -1283,34 +1275,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "yes", - "urn": "tel:+12065551212", - "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" - }, - "type": "msg_received" - }, - { - "category": "Yes", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "yes", - "type": "run_result_changed", - "value": "yes" - } - ], "exit_uuid": "49caa88e-95b2-4ee2-beef-8db17a829c61", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", @@ -1318,21 +1282,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "You said yes", - "urn": "tel:+12065551212", - "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" - }, - "type": "msg_created" - } - ], "exit_uuid": "8df047e3-465e-4d3c-a332-25b62aacdefb", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9b53d684-62a6-4f25-900c-268f762b192e", @@ -1397,33 +1346,26 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "No", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", - "operand": "no", - "type": "run_result_changed", - "value": "no" - }, - "step_uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005" + "category": "No", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", + "operand": "no", + "step_uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005", + "value": "no" }, { - "action_uuid": "bd387e9c-1ea9-49c8-a292-858d8a23a2d0", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "All Done! You said yes in the child and no here.", - "urn": "tel:+12065551212", - "uuid": "b6c40a98-ecfa-4266-9853-0310d032b497" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "All Done! You said yes in the child and no here.", + "urn": "tel:+12065551212", + "uuid": "b6c40a98-ecfa-4266-9853-0310d032b497" }, "step_uuid": "3ceb7525-c2e1-40b0-bec9-e032f4f9af5f" } @@ -1461,6 +1403,132 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi there, let's go to the child.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Rules", + "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "flow_triggered" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hooray, you did it and said yes. Say yes or no!", + "urn": "tel:+12065551212", + "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" + }, + "step_uuid": "688e64f9-2456-4b42-afcb-91a2073e5459", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "never", + "urn": "tel:+12065551212", + "uuid": "3dcbe073-60ad-4104-9d4d-e4330f6d8ba1" + }, + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "type": "msg_received" + }, + { + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", + "operand": "never", + "step_uuid": "8ed05195-68cc-47fa-8e78-3bde7b3370ae", + "type": "run_result_changed", + "value": "never" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Nope, that's neither", + "urn": "tel:+12065551212", + "uuid": "b504fe9e-d8a8-47fd-af9c-ff2f1faac4db" + }, + "step_uuid": "27b67219-e599-4697-b62c-3c781ca3b5da", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "no", + "urn": "tel:+12065551212", + "uuid": "09350b41-cecd-4f3e-93cd-ea516cea4e0a" + }, + "step_uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005", + "type": "msg_received" + }, + { + "category": "No", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", + "operand": "no", + "step_uuid": "f5e0f002-41fc-4565-8d9f-e51d30290005", + "type": "run_result_changed", + "value": "no" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "All Done! You said yes in the child and no here.", + "urn": "tel:+12065551212", + "uuid": "b6c40a98-ecfa-4266-9853-0310d032b497" + }, + "step_uuid": "3ceb7525-c2e1-40b0-bec9-e032f4f9af5f", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "9e43da00-b2e5-450e-a351-0772f5469511", @@ -1478,21 +1546,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi there, let's go to the child.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "e0db9dfe-28b1-4be0-9042-9cfcf651e8c9", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9166f3f9-da13-41c9-8346-44802a73cbdf", @@ -1500,17 +1553,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Rules", - "uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - } - ], "exit_uuid": "f68d80e5-651c-404a-bbc0-efa6966254a6", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "bf7accaf-70ce-4b87-9c23-c7bc02e3c06f", @@ -1518,21 +1560,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hooray, you did it and said yes. Say yes or no!", - "urn": "tel:+12065551212", - "uuid": "b52a7f80-f820-4163-9654-8a7258fbaae4" - }, - "type": "msg_created" - } - ], "exit_uuid": "2a67e061-c7da-42f7-91e5-32c8a9591020", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "70af8b8f-9caf-4af9-8e03-5686beb9336f", @@ -1540,34 +1567,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "never", - "urn": "tel:+12065551212", - "uuid": "3dcbe073-60ad-4104-9d4d-e4330f6d8ba1" - }, - "type": "msg_received" - }, - { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", - "operand": "never", - "type": "run_result_changed", - "value": "never" - } - ], "exit_uuid": "3e3a8051-da19-495a-b0ad-69b11e2158f7", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", @@ -1575,21 +1574,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither", - "urn": "tel:+12065551212", - "uuid": "b504fe9e-d8a8-47fd-af9c-ff2f1faac4db" - }, - "type": "msg_created" - } - ], "exit_uuid": "4ff58def-89e7-4c52-bda7-ebea0ee5176e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "c6e9b298-77bc-4d4c-91b6-43fa18338742", @@ -1597,34 +1581,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "no", - "urn": "tel:+12065551212", - "uuid": "09350b41-cecd-4f3e-93cd-ea516cea4e0a" - }, - "type": "msg_received" - }, - { - "category": "No", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", - "operand": "no", - "type": "run_result_changed", - "value": "no" - } - ], "exit_uuid": "3f6401ba-4144-4f29-8b48-9e8a3a11ff26", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "6bd3b6ec-050d-41f7-84bf-f4030f2f01f7", @@ -1632,21 +1588,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "All Done! You said yes in the child and no here.", - "urn": "tel:+12065551212", - "uuid": "b6c40a98-ecfa-4266-9853-0310d032b497" - }, - "type": "msg_created" - } - ], "exit_uuid": "801c349a-2c2e-4666-b7b2-1e6ed4945d8a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "48d058e6-a40c-437f-a3b0-f757dbbdeda1", @@ -1668,6 +1609,108 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Welcome to the child, say yes or no!", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + }, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "neither", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_received" + }, + { + "category": "Other", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "neither", + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "run_result_changed", + "value": "neither" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Nope, that's neither.", + "urn": "tel:+12065551212", + "uuid": "b88ce93d-4360-4455-a691-235cbe720980" + }, + "step_uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "yes", + "urn": "tel:+12065551212", + "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" + }, + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "msg_received" + }, + { + "category": "Yes", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Answer", + "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", + "operand": "yes", + "step_uuid": "1b5491ec-2b83-445d-bebe-b4a1f677cf4c", + "type": "run_result_changed", + "value": "yes" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "You said yes", + "urn": "tel:+12065551212", + "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" + }, + "step_uuid": "4f15f627-b1e2-4851-8dbf-00ecf5d03034", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "d092cbbf-7745-4a41-b55d-bdafc4c96ab8", @@ -1686,21 +1729,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Welcome to the child, say yes or no!", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" - }, - "type": "msg_created" - } - ], "exit_uuid": "f84a4e1c-a1ba-4059-9218-52987ebd979a", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "8a9101ba-d8a9-43ef-a926-7e050d188937", @@ -1708,34 +1736,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "neither", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Other", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "neither", - "type": "run_result_changed", - "value": "neither" - } - ], "exit_uuid": "47f7e70f-f7a5-4a24-a6cd-4853ef07487d", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", @@ -1743,21 +1743,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Nope, that's neither.", - "urn": "tel:+12065551212", - "uuid": "b88ce93d-4360-4455-a691-235cbe720980" - }, - "type": "msg_created" - } - ], "exit_uuid": "6a4cbb55-7936-4c98-958b-eba1866a596e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "4ff04e17-96d0-4920-8920-8d4d5fb2ae17", @@ -1765,34 +1750,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "yes", - "urn": "tel:+12065551212", - "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" - }, - "type": "msg_received" - }, - { - "category": "Yes", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Answer", - "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", - "operand": "yes", - "type": "run_result_changed", - "value": "yes" - } - ], "exit_uuid": "49caa88e-95b2-4ee2-beef-8db17a829c61", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "7dbcb3fd-16ee-4ce6-bd56-54b45a647958", @@ -1800,21 +1757,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "You said yes", - "urn": "tel:+12065551212", - "uuid": "44fe8d72-00ed-4736-acca-bbca70987315" - }, - "type": "msg_created" - } - ], "exit_uuid": "8df047e3-465e-4d3c-a332-25b62aacdefb", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9b53d684-62a6-4f25-900c-268f762b192e", diff --git a/cmd/flowrunner/testdata/flows/subflow_test.json b/cmd/flowrunner/testdata/flows/subflow_test.json index fadc9a042..c63684f84 100644 --- a/cmd/flowrunner/testdata/flows/subflow_test.json +++ b/cmd/flowrunner/testdata/flows/subflow_test.json @@ -19,59 +19,44 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "49f6c984-620f-4d9b-98c4-8ead1d1ef4f6", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the parent flow", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "This is the parent flow", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "300f02ba-e0b5-4991-bed6-4c240cdb8743", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Child Flow", - "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Child Flow", + "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "e5a03dde-3b2f-4603-b5d0-d927f6bcc361", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "What is your name?", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "What is your name?", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" }, "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" } ], @@ -108,36 +93,38 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "This is the parent flow", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Child Flow", + "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "flow_triggered" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "76f0a02f-3b75-4b86-9064-e9195e1b3a02", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the parent flow", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Child Flow", - "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - } - ], "node_uuid": "e97a43c1-a15b-4566-bb6d-dfd2b18408e1", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" } @@ -147,6 +134,27 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "What is your name?", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195", @@ -154,25 +162,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "What is your name?", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "9f7632ee-6e35-4247-9235-c4c7663fd601", "uuid": "5802813d-6c58-4292-8228-9728778b6c98" } @@ -225,50 +214,39 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "Name", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Name", - "node_uuid": "9f7632ee-6e35-4247-9235-c4c7663fd601", - "operand": "Ryan Lewis", - "type": "run_result_changed", - "value": "Ryan Lewis" - }, - "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "category": "Name", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Name", + "node_uuid": "9f7632ee-6e35-4247-9235-c4c7663fd601", + "operand": "Ryan Lewis", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "value": "Ryan Lewis" }, { - "action_uuid": "d63929fe-e999-42ef-abf1-4b281f58891e", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Got it!", - "urn": "tel:+12065551212", - "uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Got it!", + "urn": "tel:+12065551212", + "uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" }, "step_uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" }, { - "action_uuid": "5d51eae6-be0f-4cc7-9402-150aa1ed80a1", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Flow succeeded, they said Ryan Lewis", - "urn": "tel:+12065551212", - "uuid": "b88ce93d-4360-4455-a691-235cbe720980" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Flow succeeded, they said Ryan Lewis", + "urn": "tel:+12065551212", + "uuid": "b88ce93d-4360-4455-a691-235cbe720980" }, "step_uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186" } @@ -306,36 +284,52 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "This is the parent flow", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "flow": { + "name": "Child Flow", + "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" + }, + "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "flow_triggered" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Flow succeeded, they said Ryan Lewis", + "urn": "tel:+12065551212", + "uuid": "b88ce93d-4360-4455-a691-235cbe720980" + }, + "step_uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "76f0a02f-3b75-4b86-9064-e9195e1b3a02", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the parent flow", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "flow": { - "name": "Child Flow", - "uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195" - }, - "parent_run_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5", - "type": "flow_triggered" - } - ], "exit_uuid": "2ce7eeea-ee70-4e1a-b8f4-84d8102a8aef", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "e97a43c1-a15b-4566-bb6d-dfd2b18408e1", @@ -343,21 +337,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Flow succeeded, they said Ryan Lewis", - "urn": "tel:+12065551212", - "uuid": "b88ce93d-4360-4455-a691-235cbe720980" - }, - "type": "msg_created" - } - ], "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "c8380f24-7524-4340-9d38-db8a131d2b70", "uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186" @@ -368,6 +347,65 @@ }, { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "What is your name?", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Ryan Lewis", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_received" + }, + { + "category": "Name", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Name", + "node_uuid": "9f7632ee-6e35-4247-9235-c4c7663fd601", + "operand": "Ryan Lewis", + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "run_result_changed", + "value": "Ryan Lewis" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Got it!", + "urn": "tel:+12065551212", + "uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" + }, + "step_uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "a8d27b94-d3d0-4a96-8074-0f162f342195", @@ -386,47 +424,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "What is your name?", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Ryan Lewis", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Name", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Name", - "node_uuid": "9f7632ee-6e35-4247-9235-c4c7663fd601", - "operand": "Ryan Lewis", - "type": "run_result_changed", - "value": "Ryan Lewis" - } - ], "exit_uuid": "58743fc9-6b4c-41dd-a844-8568f093e65b", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9f7632ee-6e35-4247-9235-c4c7663fd601", @@ -434,21 +431,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Got it!", - "urn": "tel:+12065551212", - "uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" - }, - "type": "msg_created" - } - ], "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "3689e39d-608e-4e85-8a18-c9aa6375bb43", "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" diff --git a/cmd/flowrunner/testdata/flows/triggered_test.json b/cmd/flowrunner/testdata/flows/triggered_test.json index 3f6aaef97..c905b4d20 100644 --- a/cmd/flowrunner/testdata/flows/triggered_test.json +++ b/cmd/flowrunner/testdata/flows/triggered_test.json @@ -4,21 +4,17 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "e97cd6d5-3354-4dbd-85bc-6c1f87849eec", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty you were started in this flow by Bob from the 'Parent Flow' flow. He is from Esmeraldas and is aged 33.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hi Ben Haggerty you were started in this flow by Bob from the 'Parent Flow' flow. He is from Esmeraldas and is aged 33.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" } @@ -56,27 +52,28 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi Ben Haggerty you were started in this flow by Bob from the 'Parent Flow' flow. He is from Esmeraldas and is aged 33.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "ce902e6f-bc0a-40cf-a58c-1e300d15ec85", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty you were started in this flow by Bob from the 'Parent Flow' flow. He is from Esmeraldas and is aged 33.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" diff --git a/cmd/flowrunner/testdata/flows/two_questions_test.json b/cmd/flowrunner/testdata/flows/two_questions_test.json index 11abd234b..51998ba9c 100644 --- a/cmd/flowrunner/testdata/flows/two_questions_test.json +++ b/cmd/flowrunner/testdata/flows/two_questions_test.json @@ -34,31 +34,24 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "e97cd6d5-3354-4dbd-85bc-6c1f87849eec", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00" } ], "session": { @@ -94,32 +87,34 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "615b8a0f-588c-4d20-a05f-363b0b4ce6f4", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", "uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" } @@ -173,53 +168,39 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "Blue", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Favorite Color", - "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", - "operand": "I like blue!", - "type": "run_result_changed", - "value": "blue" - }, - "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" + "category": "Blue", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Favorite Color", + "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", + "operand": "I like blue!", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "value": "blue" }, { - "action_uuid": "afd5ac22-2a86-4576-a2c7-715f0bb10194", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "language", - "type": "contact_property_changed", - "value": "fra" - }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "language", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "value": "fra" }, { - "action_uuid": "d2a4052a-3fa9-4608-ab3e-5b9631440447", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Blue! Bien sur! Quelle est votes soda preferee? (pepsi/coke)", - "urn": "tel:+12065551212", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Blue! Bien sur! Quelle est votes soda preferee? (pepsi/coke)", + "urn": "tel:+12065551212", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00" } ], "session": { @@ -255,6 +236,79 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "I like blue!", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_received" + }, + { + "category": "Blue", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Favorite Color", + "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", + "operand": "I like blue!", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "run_result_changed", + "value": "blue" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "language", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "contact_property_changed", + "value": "fra" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Blue! Bien sur! Quelle est votes soda preferee? (pepsi/coke)", + "urn": "tel:+12065551212", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + }, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "615b8a0f-588c-4d20-a05f-363b0b4ce6f4", @@ -272,48 +326,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "I like blue!", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Blue", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Favorite Color", - "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", - "operand": "I like blue!", - "type": "run_result_changed", - "value": "blue" - } - ], "exit_uuid": "c70fe86c-9aac-4cc2-a5cb-d35cbe3fed6e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", @@ -321,32 +333,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "language", - "type": "contact_property_changed", - "value": "fra" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Blue! Bien sur! Quelle est votes soda preferee? (pepsi/coke)", - "urn": "tel:+12065551212", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "11a772f3-3ca2-4429-8b33-20fdcfc2b69e", "uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" } @@ -410,46 +396,35 @@ } }, { - "log": [ + "events": [ { - "event": { - "category": "Coke", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Soda", - "node_uuid": "11a772f3-3ca2-4429-8b33-20fdcfc2b69e", - "operand": "Coke", - "type": "run_result_changed", - "value": "Coke" - }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "category": "Coke", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Soda", + "node_uuid": "11a772f3-3ca2-4429-8b33-20fdcfc2b69e", + "operand": "Coke", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "value": "Coke" }, { - "action_uuid": "ce2b5142-453b-4e43-868e-abdafafaa878", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "request": "POST /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nContent-Length: 69\r\nAccept-Encoding: gzip\r\n\r\n{ \"contact\": \"ba96bf7f-bc2a-4873-a7c7-254d1927c4e3\", \"soda\": \"Coke\" }", - "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", - "status": "success", - "status_code": 200, - "type": "webhook_called", - "url": "http://127.0.0.1:49999/?cmd=success" - }, - "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "request": "POST /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nContent-Length: 69\r\nAccept-Encoding: gzip\r\n\r\n{ \"contact\": \"ba96bf7f-bc2a-4873-a7c7-254d1927c4e3\", \"soda\": \"Coke\" }", + "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", + "status": "success", + "status_code": 200, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "url": "http://127.0.0.1:49999/?cmd=success" }, { - "action_uuid": "0a8467eb-911a-41db-8101-ccf415c48e6a", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Parfait, vous avez finis et tu aimes Coke", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "Parfait, vous avez finis et tu aimes Coke", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" }, "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" } @@ -487,6 +462,127 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "I like blue!", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_received" + }, + { + "category": "Blue", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Favorite Color", + "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", + "operand": "I like blue!", + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "run_result_changed", + "value": "blue" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "property": "language", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "contact_property_changed", + "value": "fra" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Blue! Bien sur! Quelle est votes soda preferee? (pepsi/coke)", + "urn": "tel:+12065551212", + "uuid": "5802813d-6c58-4292-8228-9728778b6c98" + }, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "timeout_on": "2000-01-01T00:00:00.000000000-00:00", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Coke", + "urn": "tel:+12065551212", + "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" + }, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "msg_received" + }, + { + "category": "Coke", + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "name": "Soda", + "node_uuid": "11a772f3-3ca2-4429-8b33-20fdcfc2b69e", + "operand": "Coke", + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "run_result_changed", + "value": "Coke" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "request": "POST /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nContent-Length: 69\r\nAccept-Encoding: gzip\r\n\r\n{ \"contact\": \"ba96bf7f-bc2a-4873-a7c7-254d1927c4e3\", \"soda\": \"Coke\" }", + "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", + "status": "success", + "status_code": 200, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "type": "webhook_called", + "url": "http://127.0.0.1:49999/?cmd=success" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Parfait, vous avez finis et tu aimes Coke", + "urn": "tel:+12065551212", + "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" + }, + "step_uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "615b8a0f-588c-4d20-a05f-363b0b4ce6f4", @@ -504,48 +600,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Hi Ben Haggerty! What is your favorite color? (red/blue) Your number is (206) 555-1212", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "I like blue!", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - }, - { - "category": "Blue", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Favorite Color", - "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", - "operand": "I like blue!", - "type": "run_result_changed", - "value": "blue" - } - ], "exit_uuid": "c70fe86c-9aac-4cc2-a5cb-d35cbe3fed6e", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "46d51f50-58de-49da-8d13-dadbf322685d", @@ -553,54 +607,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "property": "language", - "type": "contact_property_changed", - "value": "fra" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Blue! Bien sur! Quelle est votes soda preferee? (pepsi/coke)", - "urn": "tel:+12065551212", - "uuid": "5802813d-6c58-4292-8228-9728778b6c98" - }, - "type": "msg_created" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "timeout_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Coke", - "urn": "tel:+12065551212", - "uuid": "34bf602e-e86a-4957-8a47-fcb455e58cf4" - }, - "type": "msg_received" - }, - { - "category": "Coke", - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "name": "Soda", - "node_uuid": "11a772f3-3ca2-4429-8b33-20fdcfc2b69e", - "operand": "Coke", - "type": "run_result_changed", - "value": "Coke" - } - ], "exit_uuid": "c7bca181-0cb3-4ec6-8555-f7e5644238ad", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "11a772f3-3ca2-4429-8b33-20fdcfc2b69e", @@ -608,30 +614,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "request": "POST /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nContent-Length: 69\r\nAccept-Encoding: gzip\r\n\r\n{ \"contact\": \"ba96bf7f-bc2a-4873-a7c7-254d1927c4e3\", \"soda\": \"Coke\" }", - "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", - "status": "success", - "status_code": 200, - "type": "webhook_called", - "url": "http://127.0.0.1:49999/?cmd=success" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Parfait, vous avez finis et tu aimes Coke", - "urn": "tel:+12065551212", - "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" - }, - "type": "msg_created" - } - ], "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "cefd2817-38a8-4ddb-af97-34fffac7e6db", "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" diff --git a/cmd/flowrunner/testdata/flows/webhook_persists_test.json b/cmd/flowrunner/testdata/flows/webhook_persists_test.json index 36b1d07ce..2af2b0918 100644 --- a/cmd/flowrunner/testdata/flows/webhook_persists_test.json +++ b/cmd/flowrunner/testdata/flows/webhook_persists_test.json @@ -19,59 +19,44 @@ ], "outputs": [ { - "log": [ + "events": [ { - "action_uuid": "59cee8f1-ed9e-453e-bc17-6f1996e959d0", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the first message.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "This is the first message.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" }, "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716" }, { - "action_uuid": "881c9b75-d426-4f57-8562-d32bdc75b524", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", - "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", - "status": "success", - "status_code": 200, - "type": "webhook_called", - "url": "http://127.0.0.1:49999/?cmd=success" - }, - "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", + "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", + "status": "success", + "status_code": 200, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "url": "http://127.0.0.1:49999/?cmd=success" }, { - "action_uuid": "8453e418-03ec-40a0-935f-d757cd2ab075", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "The status is true. Send something", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "The status is true. Send something", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" }, "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98" }, { - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, + "created_on": "2000-01-01T00:00:00.000000000-00:00", "step_uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" } ], @@ -108,27 +93,57 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "This is the first message.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", + "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", + "status": "success", + "status_code": 200, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "webhook_called", + "url": "http://127.0.0.1:49999/?cmd=success" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "The status is true. Send something", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9", + "type": "msg_wait" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "08d8a831-ca01-4a33-a26d-40f83aa4b625", "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the first message.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "ea324c82-a83b-4e85-8c61-8642d0a70a3d", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "e7cd9720-9f37-4862-9e9e-007414a04762", @@ -136,17 +151,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", - "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", - "status": "success", - "status_code": 200, - "type": "webhook_called", - "url": "http://127.0.0.1:49999/?cmd=success" - } - ], "exit_uuid": "bb09f6b6-89f4-45bd-8cc9-1d4655914590", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "be37f70c-e02a-4a67-9ff2-07609e86bbeb", @@ -154,21 +158,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "The status is true. Send something", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" - } - ], "exit_uuid": "cf472a83-3041-4d4b-a765-dea6dc0a9c00", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "186ff11c-61ec-456c-8e28-ec59fa2fb523", @@ -176,12 +165,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - } - ], "node_uuid": "d08e402f-0d6f-413c-8336-bd8a3bcc432b", "uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9" } @@ -242,21 +225,17 @@ } }, { - "log": [ + "events": [ { - "action_uuid": "09cd20fb-9a8a-49a2-9c98-fac728c35300", - "event": { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "The status is now true", - "urn": "tel:+12065551212", - "uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186" + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" }, - "type": "msg_created" + "text": "The status is now true", + "urn": "tel:+12065551212", + "uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186" }, "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671" } @@ -294,6 +273,79 @@ "runs": [ { "created_on": "2000-01-01T00:00:00.000000000-00:00", + "events": [ + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "This is the first message.", + "urn": "tel:+12065551212", + "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" + }, + "step_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", + "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", + "status": "success", + "status_code": 200, + "step_uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb", + "type": "webhook_called", + "url": "http://127.0.0.1:49999/?cmd=success" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "The status is true. Send something", + "urn": "tel:+12065551212", + "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" + }, + "step_uuid": "5802813d-6c58-4292-8228-9728778b6c98", + "type": "msg_created" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "step_uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9", + "type": "msg_wait" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Nexmo", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "Something!", + "urn": "tel:+12065551212", + "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" + }, + "step_uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9", + "type": "msg_received" + }, + { + "created_on": "2000-01-01T00:00:00.000000000-00:00", + "msg": { + "channel": { + "name": "Android Channel", + "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" + }, + "text": "The status is now true", + "urn": "tel:+12065551212", + "uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186" + }, + "step_uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671", + "type": "msg_created" + } + ], "exited_on": "2000-01-01T00:00:00.000000000-00:00", "expires_on": "2000-01-01T00:00:00.000000000-00:00", "flow_uuid": "08d8a831-ca01-4a33-a26d-40f83aa4b625", @@ -311,21 +363,6 @@ "path": [ { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "This is the first message.", - "urn": "tel:+12065551212", - "uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094" - }, - "type": "msg_created" - } - ], "exit_uuid": "ea324c82-a83b-4e85-8c61-8642d0a70a3d", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "e7cd9720-9f37-4862-9e9e-007414a04762", @@ -333,17 +370,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "request": "GET /?cmd=success HTTP/1.1\r\nHost: 127.0.0.1:49999\r\nUser-Agent: Go-http-client/1.1\r\nAccept-Encoding: gzip\r\n\r\n", - "response": "HTTP/1.1 200 OK\r\nContent-Length: 16\r\nContent-Type: text/plain; charset=utf-8\r\nDate: \r\n\r\n{ \"ok\": \"true\" }", - "status": "success", - "status_code": 200, - "type": "webhook_called", - "url": "http://127.0.0.1:49999/?cmd=success" - } - ], "exit_uuid": "bb09f6b6-89f4-45bd-8cc9-1d4655914590", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "be37f70c-e02a-4a67-9ff2-07609e86bbeb", @@ -351,21 +377,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "The status is true. Send something", - "urn": "tel:+12065551212", - "uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623" - }, - "type": "msg_created" - } - ], "exit_uuid": "cf472a83-3041-4d4b-a765-dea6dc0a9c00", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "186ff11c-61ec-456c-8e28-ec59fa2fb523", @@ -373,25 +384,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "type": "msg_wait" - }, - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Nexmo", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "Something!", - "urn": "tel:+12065551212", - "uuid": "9bf91c2b-ce58-4cef-aacc-281e03f69ab5" - }, - "type": "msg_received" - } - ], "exit_uuid": "dd0d800b-97ce-418f-9eb7-f0985df89f08", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "d08e402f-0d6f-413c-8336-bd8a3bcc432b", @@ -399,21 +391,6 @@ }, { "arrived_on": "2000-01-01T00:00:00.000000000-00:00", - "events": [ - { - "created_on": "2000-01-01T00:00:00.000000000-00:00", - "msg": { - "channel": { - "name": "Android Channel", - "uuid": "57f1078f-88aa-46f4-a59a-948a5739c03d" - }, - "text": "The status is now true", - "urn": "tel:+12065551212", - "uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186" - }, - "type": "msg_created" - } - ], "exit_uuid": "accf4276-f719-4664-b0b1-4f18c0184f56", "left_on": "2000-01-01T00:00:00.000000000-00:00", "node_uuid": "9bd027cd-ae88-4906-b3ea-c003f30d8db5", diff --git a/cmd/flowserver/config.go b/cmd/flowserver/config.go index 64de343d7..6ea4b4e73 100644 --- a/cmd/flowserver/config.go +++ b/cmd/flowserver/config.go @@ -17,7 +17,7 @@ type Config struct { func NewDefaultConfig() *Config { return &Config{ Port: 8800, - LogLevel: "error", + LogLevel: "info", AssetCacheSize: 1000, AssetCachePrune: 100, AssetServerToken: "missing_temba_token", diff --git a/cmd/flowserver/server.go b/cmd/flowserver/server.go index 41d11befb..4d9a0c538 100644 --- a/cmd/flowserver/server.go +++ b/cmd/flowserver/server.go @@ -109,15 +109,26 @@ func (s *FlowServer) handleVersion(w http.ResponseWriter, r *http.Request) (inte } type sessionResponse struct { - Session flows.Session `json:"session"` - Log []flows.LogEntry `json:"log"` + Session flows.Session + Events []flows.Event } // MarshalJSON marshals this session response into JSON func (r *sessionResponse) MarshalJSON() ([]byte, error) { - envelope := sessionResponse{ + var err error + eventEnvelopes := make([]*utils.TypedEnvelope, len(r.Session.Events())) + for e, event := range r.Session.Events() { + if eventEnvelopes[e], err = utils.EnvelopeFromTyped(event); err != nil { + return nil, err + } + } + + envelope := struct { + Session flows.Session `json:"session"` + Events []*utils.TypedEnvelope `json:"events"` + }{ Session: r.Session, - Log: r.Session.Log(), + Events: eventEnvelopes, } return json.Marshal(envelope) @@ -183,7 +194,7 @@ func (s *FlowServer) handleStart(w http.ResponseWriter, r *http.Request) (interf return nil, err } - return &sessionResponse{Session: session, Log: session.Log()}, nil + return &sessionResponse{Session: session, Events: session.Events()}, nil } type resumeRequest struct { @@ -243,7 +254,7 @@ func (s *FlowServer) handleResume(w http.ResponseWriter, r *http.Request) (inter return nil, err } - return &sessionResponse{Session: session, Log: session.Log()}, nil + return &sessionResponse{Session: session, Events: session.Events()}, nil } type migrateRequest struct { diff --git a/flows/engine/log.go b/flows/engine/log.go deleted file mode 100644 index ae9920092..000000000 --- a/flows/engine/log.go +++ /dev/null @@ -1,54 +0,0 @@ -package engine - -import ( - "encoding/json" - - "github.com/nyaruka/goflow/flows" - "github.com/nyaruka/goflow/utils" -) - -type logEntry struct { - step flows.Step - action flows.Action - event flows.Event -} - -// NewLogEntry creates a new event log entry -func NewLogEntry(step flows.Step, action flows.Action, event flows.Event) flows.LogEntry { - return &logEntry{step: step, action: action, event: event} -} - -func (s *logEntry) Step() flows.Step { return s.step } -func (s *logEntry) Action() flows.Action { return s.action } -func (s *logEntry) Event() flows.Event { return s.event } - -//------------------------------------------------------------------------------------------ -// JSON Encoding / Decoding -//------------------------------------------------------------------------------------------ - -type logEntryEnvelope struct { - StepUUID flows.StepUUID `json:"step_uuid,omitempty"` - ActionUUID flows.ActionUUID `json:"action_uuid,omitempty"` - Event *utils.TypedEnvelope `json:"event" validate:"required"` -} - -// MarshalJSON marshals this log entry into JSON -func (s *logEntry) MarshalJSON() ([]byte, error) { - var se logEntryEnvelope - - if s.step != nil { - se.StepUUID = s.step.UUID() - } - if s.action != nil { - se.ActionUUID = s.action.UUID() - } - - eventData, err := json.Marshal(s.event) - if err != nil { - return nil, err - } - - se.Event = &utils.TypedEnvelope{Type: s.event.Type(), Data: eventData} - - return json.Marshal(se) -} diff --git a/flows/engine/session.go b/flows/engine/session.go index 5668cae1f..962d68c7b 100644 --- a/flows/engine/session.go +++ b/flows/engine/session.go @@ -31,12 +31,12 @@ type session struct { runs []flows.FlowRun status flows.SessionStatus wait flows.Wait - log []flows.LogEntry // state which is temporary to each call runsByUUID map[flows.RunUUID]flows.FlowRun pushedFlow *pushedFlow flowStack *flowStack + newEvents []flows.Event } // NewSession creates a new session @@ -45,7 +45,7 @@ func NewSession(assetCache *AssetCache, assetServer AssetServer) flows.Session { env: utils.NewDefaultEnvironment(), assets: NewSessionAssets(assetCache, assetServer), status: flows.SessionStatusActive, - log: []flows.LogEntry{}, + newEvents: []flows.Event{}, runsByUUID: make(map[flows.RunUUID]flows.FlowRun), flowStack: newFlowStack(), } @@ -101,11 +101,10 @@ func (s *session) waitingRun() flows.FlowRun { return nil } -func (s *session) LogEvent(step flows.Step, action flows.Action, event flows.Event) { - s.log = append(s.log, NewLogEntry(step, action, event)) +func (s *session) LogEvent(event flows.Event) { + s.newEvents = append(s.newEvents, event) } -func (s *session) Log() []flows.LogEntry { return s.log } -func (s *session) ClearLog() { s.log = nil } +func (s *session) Events() []flows.Event { return s.newEvents } //------------------------------------------------------------------------------------------ // Flow execution @@ -165,7 +164,7 @@ func (s *session) Resume(callerEvents []flows.Event) error { run.Exit(flows.RunStatusErrored) } s.status = flows.SessionStatusErrored - s.LogEvent(nil, nil, events.NewFatalErrorEvent(err)) + s.LogEvent(events.NewFatalErrorEvent(err)) } return nil @@ -193,7 +192,7 @@ func (s *session) tryToResume(waitingRun flows.FlowRun, callerEvents []flows.Eve // events can change run status so only proceed to the wait if we're still waiting if waitingRun.Status() == flows.RunStatusWaiting { - waitCanResume := s.wait.CanResume(waitingRun, step) + waitCanResume := s.wait.CanResume(callerEvents) waitHasTimedOut := s.wait.HasTimedOut() if waitCanResume || waitHasTimedOut { diff --git a/flows/events/base.go b/flows/events/base.go index 66b7dde5f..af1ec7570 100644 --- a/flows/events/base.go +++ b/flows/events/base.go @@ -6,8 +6,9 @@ import ( ) type baseEvent struct { - CreatedOn_ time.Time `json:"created_on" validate:"required"` - FromCaller_ bool `json:"-"` + CreatedOn_ time.Time `json:"created_on" validate:"required"` + StepUUID_ flows.StepUUID `json:"step_uuid,omitempty" validate:"omitempty,uuid4"` + FromCaller_ bool `json:"-"` } func newBaseEvent() baseEvent { @@ -17,6 +18,9 @@ func newBaseEvent() baseEvent { func (e *baseEvent) CreatedOn() time.Time { return e.CreatedOn_ } func (e *baseEvent) SetCreatedOn(time time.Time) { e.CreatedOn_ = time } +func (e *baseEvent) StepUUID() flows.StepUUID { return e.StepUUID_ } +func (e *baseEvent) SetStepUUID(stepUUID flows.StepUUID) { e.StepUUID_ = stepUUID } + func (e *baseEvent) FromCaller() bool { return e.FromCaller_ } func (e *baseEvent) SetFromCaller(fromCaller bool) { e.FromCaller_ = fromCaller } diff --git a/flows/events/contact_urn_added.go b/flows/events/contact_urn_added.go index de7f63ae7..33a4466ec 100644 --- a/flows/events/contact_urn_added.go +++ b/flows/events/contact_urn_added.go @@ -30,7 +30,7 @@ type ContactURNAddedEvent struct { // NewURNAddedEvent returns a new add URN event func NewURNAddedEvent(urn urns.URN) *ContactURNAddedEvent { - return &ContactURNAddedEvent{URN: urn} + return &ContactURNAddedEvent{baseEvent: newBaseEvent(), URN: urn} } // Type returns the type of this event diff --git a/flows/interfaces.go b/flows/interfaces.go index 61aca049f..d2c45d7e9 100644 --- a/flows/interfaces.go +++ b/flows/interfaces.go @@ -195,7 +195,7 @@ type Wait interface { utils.Typed Begin(FlowRun, Step) - CanResume(FlowRun, Step) bool + CanResume([]Event) bool HasTimedOut() bool Resume(FlowRun) @@ -241,8 +241,12 @@ type Event interface { CreatedOn() time.Time SetCreatedOn(time.Time) + StepUUID() StepUUID + SetStepUUID(StepUUID) + FromCaller() bool SetFromCaller(bool) + AllowedOrigin() EventOrigin Validate(SessionAssets) error @@ -275,15 +279,6 @@ type Step interface { LeftOn() *time.Time Leave(ExitUUID) - - Events() []Event -} - -// LogEntry is a container for a new event generated by the engine, i.e. not from the caller -type LogEntry interface { - Step() Step - Action() Action - Event() Event } // Session represents the session of a flow run which may contain many runs @@ -308,9 +303,8 @@ type Session interface { GetRun(RunUUID) (FlowRun, error) GetCurrentChild(FlowRun) FlowRun - Log() []LogEntry - LogEvent(Step, Action, Event) - ClearLog() + Events() []Event + LogEvent(Event) } // RunSummary represents the minimum information available about all runs (current or related) and is the diff --git a/flows/runs/run.go b/flows/runs/run.go index 891f99ba8..c0b6d1b9e 100644 --- a/flows/runs/run.go +++ b/flows/runs/run.go @@ -91,6 +91,7 @@ type flowRun struct { results flows.Results path []flows.Step + events []flows.Event status flows.RunStatus createdOn time.Time @@ -129,6 +130,7 @@ func (r *flowRun) SetContact(contact *flows.Contact) { r.contact = contact } func (r *flowRun) Context() utils.VariableResolver { return r.context } func (r *flowRun) Results() flows.Results { return r.results } +func (r *flowRun) Events() []flows.Event { return r.events } func (r *flowRun) Exit(status flows.RunStatus) { r.SetStatus(status) @@ -182,12 +184,12 @@ func (r *flowRun) ApplyEvent(s flows.Step, action flows.Action, event flows.Even } if s != nil { - fs := s.(*step) - fs.addEvent(event) + event.SetStepUUID(s.UUID()) + r.events = append(r.events, event) } if !event.FromCaller() { - r.Session().LogEvent(s, action, event) + r.Session().LogEvent(event) } if log.GetLevel() >= log.DebugLevel { @@ -206,11 +208,11 @@ func (r *flowRun) ApplyEvent(s flows.Step, action flows.Action, event flows.Even } func (r *flowRun) AddError(step flows.Step, action flows.Action, err error) { - r.ApplyEvent(step, action, &events.ErrorEvent{Text: err.Error(), Fatal: false}) + r.ApplyEvent(step, action, events.NewErrorEvent(err)) } func (r *flowRun) AddFatalError(step flows.Step, action flows.Action, err error) { - r.ApplyEvent(step, action, &events.ErrorEvent{Text: err.Error(), Fatal: true}) + r.ApplyEvent(step, action, events.NewFatalErrorEvent(err)) } func (r *flowRun) Path() []flows.Step { return r.path } @@ -347,9 +349,10 @@ var _ flows.RunSummary = (*flowRun)(nil) //------------------------------------------------------------------------------------------ type runEnvelope struct { - UUID flows.RunUUID `json:"uuid" validate:"required,uuid4"` - FlowUUID flows.FlowUUID `json:"flow_uuid" validate:"required,uuid4"` - Path []*step `json:"path" validate:"dive"` + UUID flows.RunUUID `json:"uuid" validate:"required,uuid4"` + FlowUUID flows.FlowUUID `json:"flow_uuid" validate:"required,uuid4"` + Path []*step `json:"path" validate:"dive"` + Events []*utils.TypedEnvelope `json:"events,omitempty"` Status flows.RunStatus `json:"status"` ParentUUID flows.RunUUID `json:"parent_uuid,omitempty" validate:"omitempty,uuid4"` @@ -413,6 +416,14 @@ func ReadRun(session flows.Session, data json.RawMessage) (flows.FlowRun, error) r.path[i] = step } + // read in our events + r.events = make([]flows.Event, len(envelope.Events)) + for i := range r.events { + if r.events[i], err = events.EventFromEnvelope(envelope.Events[i]); err != nil { + return nil, fmt.Errorf("error reading: %s -- %s", string(envelope.Events[i].Data), err) + } + } + // create a run specific environment and context r.environment = newRunEnvironment(session.Environment(), r) r.context = newRunContext(r) @@ -448,5 +459,14 @@ func (r *flowRun) MarshalJSON() ([]byte, error) { re.Path[i] = s.(*step) } + re.Events = make([]*utils.TypedEnvelope, len(r.events)) + for i, event := range r.events { + eventData, err := json.Marshal(event) + if err != nil { + return nil, err + } + re.Events[i] = &utils.TypedEnvelope{Type: event.Type(), Data: eventData} + } + return json.Marshal(re) } diff --git a/flows/runs/step.go b/flows/runs/step.go index 552273419..58a0ac6cc 100644 --- a/flows/runs/step.go +++ b/flows/runs/step.go @@ -5,8 +5,6 @@ import ( "time" "github.com/nyaruka/goflow/flows" - "github.com/nyaruka/goflow/flows/events" - "github.com/nyaruka/goflow/utils" ) type step struct { @@ -15,7 +13,6 @@ type step struct { exitUUID flows.ExitUUID arrivedOn time.Time leftOn *time.Time - events []flows.Event } func (s *step) UUID() flows.StepUUID { return s.stepUUID } @@ -23,7 +20,6 @@ func (s *step) NodeUUID() flows.NodeUUID { return s.nodeUUID } func (s *step) ExitUUID() flows.ExitUUID { return s.exitUUID } func (s *step) ArrivedOn() time.Time { return s.arrivedOn } func (s *step) LeftOn() *time.Time { return s.leftOn } -func (s *step) Events() []flows.Event { return s.events } func (s *step) Leave(exit flows.ExitUUID) { now := time.Now().UTC() @@ -31,26 +27,16 @@ func (s *step) Leave(exit flows.ExitUUID) { s.leftOn = &now } -func (s *step) addEvent(e flows.Event) { - e.SetCreatedOn(time.Now().UTC()) - s.events = append(s.events, e) -} - -func (s *step) addError(err error) { - s.addEvent(&events.ErrorEvent{Text: err.Error()}) -} - //------------------------------------------------------------------------------------------ // JSON Encoding / Decoding //------------------------------------------------------------------------------------------ type stepEnvelope struct { - UUID flows.StepUUID `json:"uuid" validate:"required,uuid4"` - NodeUUID flows.NodeUUID `json:"node_uuid" validate:"required,uuid4"` - ExitUUID flows.ExitUUID `json:"exit_uuid,omitempty" validate:"omitempty,uuid4"` - ArrivedOn time.Time `json:"arrived_on"` - LeftOn *time.Time `json:"left_on,omitempty"` - Events []*utils.TypedEnvelope `json:"events,omitempty" validate:"omitempty,dive"` + UUID flows.StepUUID `json:"uuid" validate:"required,uuid4"` + NodeUUID flows.NodeUUID `json:"node_uuid" validate:"required,uuid4"` + ExitUUID flows.ExitUUID `json:"exit_uuid,omitempty" validate:"omitempty,uuid4"` + ArrivedOn time.Time `json:"arrived_on"` + LeftOn *time.Time `json:"left_on,omitempty"` } // UnmarshalJSON unmarshals a run step from the given JSON @@ -68,36 +54,16 @@ func (s *step) UnmarshalJSON(data []byte) error { s.exitUUID = se.ExitUUID s.arrivedOn = se.ArrivedOn s.leftOn = se.LeftOn - - s.events = make([]flows.Event, len(se.Events)) - for i := range s.events { - s.events[i], err = events.EventFromEnvelope(se.Events[i]) - if err != nil { - return err - } - } - return err } // MarshalJSON marshals this run step into JSON func (s *step) MarshalJSON() ([]byte, error) { - var se stepEnvelope - - se.UUID = s.stepUUID - se.NodeUUID = s.nodeUUID - se.ExitUUID = s.exitUUID - se.ArrivedOn = s.arrivedOn - se.LeftOn = s.leftOn - - se.Events = make([]*utils.TypedEnvelope, len(s.events)) - for i, event := range s.events { - eventData, err := json.Marshal(event) - if err != nil { - return nil, err - } - se.Events[i] = &utils.TypedEnvelope{Type: event.Type(), Data: eventData} - } - - return json.Marshal(se) + return json.Marshal(&stepEnvelope{ + UUID: s.stepUUID, + NodeUUID: s.nodeUUID, + ExitUUID: s.exitUUID, + ArrivedOn: s.arrivedOn, + LeftOn: s.leftOn, + }) } diff --git a/flows/waits/msg.go b/flows/waits/msg.go index d4f0a6136..40d88fb16 100644 --- a/flows/waits/msg.go +++ b/flows/waits/msg.go @@ -23,9 +23,9 @@ func (w *MsgWait) Begin(run flows.FlowRun, step flows.Step) { run.ApplyEvent(step, nil, events.NewMsgWait(w.TimeoutOn)) } -// CanResume returns true for a message wait if a message has now been received on this step -func (w *MsgWait) CanResume(run flows.FlowRun, step flows.Step) bool { - for _, event := range step.Events() { +// CanResume returns true for a message wait if a message has now been received +func (w *MsgWait) CanResume(callerEvents []flows.Event) bool { + for _, event := range callerEvents { _, isMsg := event.(*events.MsgReceivedEvent) if isMsg { return true diff --git a/flows/waits/nothing.go b/flows/waits/nothing.go index ca10609a3..b71581937 100644 --- a/flows/waits/nothing.go +++ b/flows/waits/nothing.go @@ -20,7 +20,7 @@ func (w *NothingWait) Begin(run flows.FlowRun, step flows.Step) { } // CanResume always returns true for a nothing wait because it's not waiting for anything -func (w *NothingWait) CanResume(run flows.FlowRun, step flows.Step) bool { +func (w *NothingWait) CanResume(callerEvents []flows.Event) bool { return true } diff --git a/flowserver.toml b/flowserver.toml index 94f54a81c..2f5862dca 100644 --- a/flowserver.toml +++ b/flowserver.toml @@ -13,7 +13,7 @@ port = 8800 # Log level, one of: panic, fatal, error, warn, info, debug -log_level = "error" +log_level = "info" # directory where static content is served from static = "" From 1686f74fc20170be98a828c65b3b0ef8e3e12a8d Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Tue, 20 Mar 2018 16:42:35 -0500 Subject: [PATCH 2/2] Add events.EventsToEnvelopes --- cmd/flowrunner/main.go | 17 ++--------------- cmd/flowrunner/runner_test.go | 10 +++++----- cmd/flowserver/server.go | 10 +++------- flows/events/envelope.go | 12 ++++++++++++ flows/runs/run.go | 12 ++++-------- 5 files changed, 26 insertions(+), 35 deletions(-) diff --git a/cmd/flowrunner/main.go b/cmd/flowrunner/main.go index 3a0143f96..33e9acdbe 100644 --- a/cmd/flowrunner/main.go +++ b/cmd/flowrunner/main.go @@ -25,7 +25,7 @@ const ( type Output struct { Session json.RawMessage `json:"session"` - Log []json.RawMessage `json:"events"` + Events []json.RawMessage `json:"events"` } type FlowTest struct { @@ -34,19 +34,6 @@ type FlowTest struct { Outputs []json.RawMessage `json:"outputs"` } -func envelopesForEvents(events []flows.Event) []*utils.TypedEnvelope { - envelopes := make([]*utils.TypedEnvelope, len(events)) - for i := range events { - envelope, err := utils.EnvelopeFromTyped(events[i]) - if err != nil { - log.Fatalf("Error creating envelope for %s: %s", events[i], err) - } - - envelopes[i] = envelope - } - return envelopes -} - func marshalEventLog(eventLog []flows.Event) []json.RawMessage { envelopes := make([]json.RawMessage, len(eventLog)) for i := range eventLog { @@ -264,7 +251,7 @@ func main() { callerEventEnvelopes := make([][]*utils.TypedEnvelope, len(callerEvents)) for i := range callerEvents { - callerEventEnvelopes[i] = envelopesForEvents(callerEvents[i]) + callerEventEnvelopes[i], _ = events.EventsToEnvelopes(callerEvents[i]) } rawOutputs := make([]json.RawMessage, len(outputs)) diff --git a/cmd/flowrunner/runner_test.go b/cmd/flowrunner/runner_test.go index 614f84a9e..2e0d0f8a6 100644 --- a/cmd/flowrunner/runner_test.go +++ b/cmd/flowrunner/runner_test.go @@ -272,13 +272,13 @@ func TestFlows(t *testing.T) { } } - if len(actualOutput.Log) != len(expectedOutput.Log) { - t.Errorf("Actual events:\n%#v\n do not match expected:\n%#v\n for flow '%s'\n", actualOutput.Log, expectedOutput.Log, test.assets) + if len(actualOutput.Events) != len(expectedOutput.Events) { + t.Errorf("Actual events:\n%#v\n do not match expected:\n%#v\n for flow '%s'\n", actualOutput.Events, expectedOutput.Events, test.assets) } - for j := range actualOutput.Log { - event := actualOutput.Log[j] - expected := expectedOutput.Log[j] + for j := range actualOutput.Events { + event := actualOutput.Events[j] + expected := expectedOutput.Events[j] // write our events as json eventJSON, err := rawMessageAsJSON(event) diff --git a/cmd/flowserver/server.go b/cmd/flowserver/server.go index 4d9a0c538..309d147b4 100644 --- a/cmd/flowserver/server.go +++ b/cmd/flowserver/server.go @@ -115,14 +115,10 @@ type sessionResponse struct { // MarshalJSON marshals this session response into JSON func (r *sessionResponse) MarshalJSON() ([]byte, error) { - var err error - eventEnvelopes := make([]*utils.TypedEnvelope, len(r.Session.Events())) - for e, event := range r.Session.Events() { - if eventEnvelopes[e], err = utils.EnvelopeFromTyped(event); err != nil { - return nil, err - } + eventEnvelopes, err := events.EventsToEnvelopes(r.Session.Events()) + if err != nil { + return nil, err } - envelope := struct { Session flows.Session `json:"session"` Events []*utils.TypedEnvelope `json:"events"` diff --git a/flows/events/envelope.go b/flows/events/envelope.go index 34051db9b..6f0036824 100644 --- a/flows/events/envelope.go +++ b/flows/events/envelope.go @@ -74,3 +74,15 @@ func EventFromEnvelope(envelope *utils.TypedEnvelope) (flows.Event, error) { return event, utils.UnmarshalAndValidate(envelope.Data, event, fmt.Sprintf("event[type=%s]", envelope.Type)) } + +// EventsToEnvelopes converts the given events to typed envelopes +func EventsToEnvelopes(events []flows.Event) ([]*utils.TypedEnvelope, error) { + var err error + envelopes := make([]*utils.TypedEnvelope, len(events)) + for e, event := range events { + if envelopes[e], err = utils.EnvelopeFromTyped(event); err != nil { + return nil, err + } + } + return envelopes, nil +} diff --git a/flows/runs/run.go b/flows/runs/run.go index c0b6d1b9e..e55d6141f 100644 --- a/flows/runs/run.go +++ b/flows/runs/run.go @@ -420,7 +420,7 @@ func ReadRun(session flows.Session, data json.RawMessage) (flows.FlowRun, error) r.events = make([]flows.Event, len(envelope.Events)) for i := range r.events { if r.events[i], err = events.EventFromEnvelope(envelope.Events[i]); err != nil { - return nil, fmt.Errorf("error reading: %s -- %s", string(envelope.Events[i].Data), err) + return nil, err } } @@ -459,13 +459,9 @@ func (r *flowRun) MarshalJSON() ([]byte, error) { re.Path[i] = s.(*step) } - re.Events = make([]*utils.TypedEnvelope, len(r.events)) - for i, event := range r.events { - eventData, err := json.Marshal(event) - if err != nil { - return nil, err - } - re.Events[i] = &utils.TypedEnvelope{Type: event.Type(), Data: eventData} + re.Events, err = events.EventsToEnvelopes(r.events) + if err != nil { + return nil, err } return json.Marshal(re)